Skip to content

Commit

Permalink
feat: 0.0.30
Browse files Browse the repository at this point in the history
  • Loading branch information
theajack3 committed Sep 19, 2023
1 parent 056534d commit 654dde3
Show file tree
Hide file tree
Showing 26 changed files with 57 additions and 108 deletions.
6 changes: 3 additions & 3 deletions packages/client-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alins",
"version": "0.0.29",
"version": "0.0.30",
"description": "All-in-js Web UI Framework, No jsx/template/vdom/css/html",
"main": "src/index.ts",
"typings": "src/index.ts",
Expand All @@ -19,8 +19,8 @@
"license": "MIT",
"type": "module",
"dependencies": {
"alins-reactive": "^0.0.29",
"alins-utils": "^0.0.29"
"alins-reactive": "^0.0.30",
"alins-utils": "^0.0.30"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/"
Expand Down
2 changes: 1 addition & 1 deletion packages/client-core/src/element/alins.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ export interface IBaseAttributes extends IEventAttributes {
}

export interface IControlAttributes {
$mount?: ITrueElement|string;
$mount?: ITrueElement|string|HTMLElement;
$show?: boolean|(()=>boolean);
}

Expand Down
8 changes: 6 additions & 2 deletions packages/client-core/src/element/dom-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
*/

import {
isProxy, isRef, watch, IBindingReaction
isProxy, isRef, watch
} from 'alins-reactive';
import { IJson, IProxyListener, IRefData } from 'alins-utils';
import { IJson, IProxyListener, IRefData, ISimpleValue } from 'alins-utils';

export type IBindingReaction<T = any> = IRefData<T>|(()=>T)|ISimpleValue;

export type IBindingRef<T=any> = IRefData<T>|(()=>T)|T;

export type IChildren = {v:any}|IBindingReaction|null;

Expand Down
3 changes: 1 addition & 2 deletions packages/client-core/src/element/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ import type { IElement, IFragment, ITrueElement, IAttributes } from './alins.d';
import { Renderer, appendChild } from './renderer';
import {
IBindingReactionEnable, reactiveBindingEnable,
IChildren, reactiveBindingValue,
IChildren, reactiveBindingValue, IBindingReaction, IBindingRef
} from './dom-util';
import { IJson } from 'alins-utils';
import { IBindingReaction, IBindingRef } from 'alins-reactive';
import { parseStyle, parseStyleSuffix } from './style';
import { parseModel } from './model';
import { parseAttributes } from './attributes';
Expand Down
1 change: 1 addition & 0 deletions packages/client-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ export * from 'alins-reactive';
export const version = __VERSION__;

export { reactiveBindingEnable } from './element/dom-util';
export * from 'alins-utils';
4 changes: 2 additions & 2 deletions packages/client-reactive/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alins-reactive",
"version": "0.0.29",
"version": "0.0.30",
"description": "All-in-js Web UI Framework, No jsx/template/vdom/css/html",
"main": "src/index.ts",
"typings": "src/index.ts",
Expand All @@ -19,7 +19,7 @@
"license": "MIT",
"type": "module",
"dependencies": {
"alins-utils": "^0.0.29"
"alins-utils": "^0.0.30"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/"
Expand Down
59 changes: 0 additions & 59 deletions packages/client-reactive/src/binding.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/client-reactive/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ export * from './proxy';
export * from './react';
export * from './computed';
export * from './watch';
export * from './binding';

export * from 'alins-utils';

export * from './array-proxy';
Expand Down
12 changes: 7 additions & 5 deletions packages/client-reactive/src/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,25 @@ import {
isStringTemplateArray,
} from 'alins-utils';
import { createProxy, isProxy, wrapReactive } from './proxy';
import { createBinding, IBindingReaction, IReactBindingResult } from './binding';

// ! 重载顺序不能更改
// 生成响应数据绑定
export function react(ts: TemplateStringsArray, ...reactions: (IBindingReaction)[]): string|IReactBindingResult;
export function react(ts: TemplateStringsArray, ...reactions: any[]): any[];
// 初始化响应数据
export function react<T>(data: T): IProxyData<T>;
// // es6兼容写法
// export function react(data: string, ...reactions: (TReactionItem | string)[]): IReactBuilder;

export function react<T extends IJson> (
data: TemplateStringsArray | T | string,
...reactions: (IBindingReaction)[]
...reactions: any[]
) {
if (isStringTemplateArray(data)) {
// console.log(data, reactions);
return createBinding(data as any as string[], reactions);
const result: any[] = [];
for (let i = 0; i < reactions.length; i++)
result.push(data[i], reactions[i]);
return result;
}
return createProxy<T>(wrapReactive(data) as T);
}
Expand All @@ -36,4 +38,4 @@ export function reactive<T extends IJson> (data: T, shallow = false): IProxyData
if (isProxy(data.v)) return data as any;

return createProxy<T>(wrapReactive(data) as T, { shallow });
}
}
4 changes: 2 additions & 2 deletions packages/client-standalone/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alins-standalone",
"version": "0.0.29",
"version": "0.0.30",
"description": "All-in-js Web UI Framework, No jsx/template/vdom/css/html",
"main": "src/index.ts",
"typings": "src/index.ts",
Expand All @@ -24,7 +24,7 @@
"unpkg": "dist/alins-standalone.iife.min.js",
"jsdelivr": "dist/alins-standalone.iife.min.js",
"dependencies": {
"alins": "^0.0.29"
"alins": "^0.0.30"
},
"module": "src/index.ts"
}
5 changes: 3 additions & 2 deletions packages/client-standalone/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Renderer,
reactiveBindingEnable,
map,
_$ce
_$ce,
} from 'alins';

type IValueCond<T> = (()=>T)|IRefData<T>;
Expand All @@ -29,7 +29,8 @@ type IDomGenerator = ()=>IGeneralElement|IGeneralElement[];
export { react, watch, computed } from 'alins';
import { react, watch, computed } from 'alins';

export function ref<T> (v: T) {
export function ref<T> (v: T): IRefData<T> {
// @ts-ignore
return react({ v });
}

Expand Down
2 changes: 1 addition & 1 deletion packages/client-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alins-utils",
"version": "0.0.29",
"version": "0.0.30",
"description": "All-in-js Web UI Framework, No jsx/template/vdom/css/html",
"main": "src/index.ts",
"typings": "src/index.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alins-compiler-core",
"version": "0.0.29",
"version": "0.0.30",
"description": "All-in-js Web UI Framework, No jsx/template/vdom/css/html",
"main": "src/index.ts",
"typings": "src/index.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/compiler-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alins-compiler-node",
"version": "0.0.29",
"version": "0.0.30",
"description": "All-in-js Web UI Framework, No jsx/template/vdom/css/html",
"main": "src/index.ts",
"typings": "src/index.ts",
Expand All @@ -25,7 +25,7 @@
"@babel/core": "^7.22.9",
"@babel/preset-react": "^7.22.5",
"@babel/preset-typescript": "^7.22.5",
"alins-compiler-core": "^0.0.29"
"alins-compiler-core": "^0.0.30"
},
"module": "src/index.ts"
}
6 changes: 3 additions & 3 deletions packages/compiler-web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alins-compiler-web",
"version": "0.0.29",
"version": "0.0.30",
"description": "All-in-js Web UI Framework, No jsx/template/vdom/css/html",
"main": "src/index.ts",
"typings": "src/index.ts",
Expand All @@ -22,8 +22,8 @@
"registry": "https://registry.npmjs.org/"
},
"dependencies": {
"alins": "^0.0.29",
"alins-compiler-core": "^0.0.29"
"alins": "^0.0.30",
"alins-compiler-core": "^0.0.30"
},
"module": "src/index.ts",
"unpkg": "dist/alins-compiler-web.iife.min.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-babel-preset/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-preset-alins",
"version": "0.0.29",
"version": "0.0.30",
"description": "All-in-js Web UI Framework, No jsx/template/vdom/css/html",
"main": "src/index.ts",
"typings": "src/index.ts",
Expand All @@ -24,7 +24,7 @@
"dependencies": {
"@babel/preset-react": "^7.22.5",
"@babel/preset-typescript": "^7.22.5",
"babel-plugin-alins": "^0.0.29"
"babel-plugin-alins": "^0.0.30"
},
"module": "src/index.ts"
}
4 changes: 2 additions & 2 deletions packages/plugin-babel/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-plugin-alins",
"version": "0.0.29",
"version": "0.0.30",
"description": "All-in-js Web UI Framework, No jsx/template/vdom/css/html",
"main": "src/index.ts",
"typings": "src/index.ts",
Expand All @@ -22,7 +22,7 @@
"registry": "https://registry.npmjs.org/"
},
"dependencies": {
"alins-compiler-core": "^0.0.29"
"alins-compiler-core": "^0.0.30"
},
"module": "src/index.ts"
}
4 changes: 2 additions & 2 deletions packages/plugin-esbuild/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "esbuild-plugin-alins",
"version": "0.0.29",
"version": "0.0.30",
"description": "All-in-js Web UI Framework, No jsx/template/vdom/css/html",
"main": "src/index.ts",
"typings": "src/index.ts",
Expand All @@ -22,7 +22,7 @@
"registry": "https://registry.npmjs.org/"
},
"dependencies": {
"alins-compiler-node": "^0.0.29"
"alins-compiler-node": "^0.0.30"
},
"module": "src/index.ts"
}
2 changes: 1 addition & 1 deletion packages/plugin-eslint/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-alins",
"version": "0.0.29",
"version": "0.0.30",
"description": "All-in-js Web UI Framework, No jsx/template/vdom/css/html",
"main": "src/index.ts",
"repository": "[email protected]:alinsjs/alins.git",
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-rollup/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rollup-plugin-alins",
"version": "0.0.29",
"version": "0.0.30",
"description": "All-in-js Web UI Framework, No jsx/template/vdom/css/html",
"main": "src/index.ts",
"typings": "src/index.ts",
Expand All @@ -22,7 +22,7 @@
"registry": "https://registry.npmjs.org/"
},
"dependencies": {
"alins-compiler-node": "^0.0.29"
"alins-compiler-node": "^0.0.30"
},
"module": "src/index.ts"
}
4 changes: 2 additions & 2 deletions packages/plugin-vite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vite-plugin-alins",
"version": "0.0.29",
"version": "0.0.30",
"description": "All-in-js Web UI Framework, No jsx/template/vdom/css/html",
"main": "src/index.ts",
"typings": "src/index.ts",
Expand All @@ -22,7 +22,7 @@
"registry": "https://registry.npmjs.org/"
},
"dependencies": {
"alins-compiler-node": "^0.0.29"
"alins-compiler-node": "^0.0.30"
},
"module": "src/index.ts"
}
4 changes: 2 additions & 2 deletions packages/plugin-webpack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alins-loader",
"version": "0.0.29",
"version": "0.0.30",
"description": "All-in-js Web UI Framework, No jsx/template/vdom/css/html",
"main": "src/index.ts",
"typings": "src/index.ts",
Expand All @@ -22,7 +22,7 @@
"registry": "https://registry.npmjs.org/"
},
"dependencies": {
"alins-compiler-node": "^0.0.29"
"alins-compiler-node": "^0.0.30"
},
"module": "src/index.ts"
}
2 changes: 1 addition & 1 deletion scripts/build/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const {

let isWebPackage = false;

const isDev = true;
const isDev = false;

// npx lerna version v0.0.29 --no-git-tag-version --force-publish --yes
// npm run build
Expand Down
Loading

0 comments on commit 654dde3

Please sign in to comment.