@viewfly/core 0.0.1-alpha.11 → 0.0.1-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/bundles/index.esm.js +9 -7
- package/bundles/index.js +9 -7
- package/bundles/model/component.d.ts +1 -1
- package/bundles/viewfly.d.ts +2 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
Viewfly
|
|
2
2
|
================================
|
|
3
3
|
|
|
4
|
-
Viewfly
|
|
4
|
+
Viewfly 是一个简单、数据驱动的前端视图库。此包为 Viewfly 的内核实现,要开发完整的应该的应用,还需要结合 `@viewfly/platform-browser` 包,才能在浏览器运行。
|
|
5
|
+
|
|
6
|
+
完整文档请参考官方网站:[viewfly.org](https://viewfly.org)
|
package/bundles/index.esm.js
CHANGED
|
@@ -227,7 +227,7 @@ class Component extends ReflectiveInjector {
|
|
|
227
227
|
* }
|
|
228
228
|
* ```
|
|
229
229
|
*/
|
|
230
|
-
function
|
|
230
|
+
function onMounted(callback) {
|
|
231
231
|
const component = getSetupContext();
|
|
232
232
|
component.mountCallbacks.push(callback);
|
|
233
233
|
}
|
|
@@ -809,7 +809,7 @@ let Renderer = class Renderer {
|
|
|
809
809
|
});
|
|
810
810
|
}
|
|
811
811
|
};
|
|
812
|
-
while (newAtom
|
|
812
|
+
while (newAtom) {
|
|
813
813
|
this.createChanges(newAtom, expectIndex, oldChildren, changeCommits);
|
|
814
814
|
newAtom = newAtom.sibling;
|
|
815
815
|
expectIndex++;
|
|
@@ -1147,8 +1147,8 @@ let Renderer = class Renderer {
|
|
|
1147
1147
|
};
|
|
1148
1148
|
}
|
|
1149
1149
|
applyRefs(refs, nativeNode, binding) {
|
|
1150
|
-
|
|
1151
|
-
for (const item of
|
|
1150
|
+
const refList = Array.isArray(refs) ? refs : [refs];
|
|
1151
|
+
for (const item of refList) {
|
|
1152
1152
|
if (item instanceof Ref) {
|
|
1153
1153
|
binding ? item.bind(nativeNode) : item.unBind(nativeNode);
|
|
1154
1154
|
}
|
|
@@ -1174,7 +1174,6 @@ class Viewfly extends ReflectiveInjector {
|
|
|
1174
1174
|
provide: RootComponentRef,
|
|
1175
1175
|
useFactory: () => {
|
|
1176
1176
|
return {
|
|
1177
|
-
host: config.host,
|
|
1178
1177
|
component: this.rootComponent
|
|
1179
1178
|
};
|
|
1180
1179
|
}
|
|
@@ -1193,8 +1192,11 @@ class Viewfly extends ReflectiveInjector {
|
|
|
1193
1192
|
}
|
|
1194
1193
|
/**
|
|
1195
1194
|
* 启动 Viewfly
|
|
1195
|
+
* @param host 应用根节点
|
|
1196
1196
|
*/
|
|
1197
|
-
|
|
1197
|
+
mount(host) {
|
|
1198
|
+
const rootComponentRef = this.get(RootComponentRef);
|
|
1199
|
+
rootComponentRef.host = host;
|
|
1198
1200
|
const renderer = this.get(Renderer);
|
|
1199
1201
|
renderer.render();
|
|
1200
1202
|
if (this.config.autoUpdate === false) {
|
|
@@ -1223,4 +1225,4 @@ class Viewfly extends ReflectiveInjector {
|
|
|
1223
1225
|
}
|
|
1224
1226
|
}
|
|
1225
1227
|
|
|
1226
|
-
export { Component, Fragment, JSXComponent, JSXElement, JSXText, NativeRenderer, Ref, Renderer, RootComponent, RootComponentRef, Viewfly, inject, jsx, jsxs, makeError, onDestroy,
|
|
1228
|
+
export { Component, Fragment, JSXComponent, JSXElement, JSXText, NativeRenderer, Ref, Renderer, RootComponent, RootComponentRef, Viewfly, inject, jsx, jsxs, makeError, onDestroy, onMounted, onPropsChanged, onUpdated, provide, useDerived, useEffect, useRef, useSignal };
|
package/bundles/index.js
CHANGED
|
@@ -228,7 +228,7 @@ class Component extends di.ReflectiveInjector {
|
|
|
228
228
|
* }
|
|
229
229
|
* ```
|
|
230
230
|
*/
|
|
231
|
-
function
|
|
231
|
+
function onMounted(callback) {
|
|
232
232
|
const component = getSetupContext();
|
|
233
233
|
component.mountCallbacks.push(callback);
|
|
234
234
|
}
|
|
@@ -810,7 +810,7 @@ exports.Renderer = class Renderer {
|
|
|
810
810
|
});
|
|
811
811
|
}
|
|
812
812
|
};
|
|
813
|
-
while (newAtom
|
|
813
|
+
while (newAtom) {
|
|
814
814
|
this.createChanges(newAtom, expectIndex, oldChildren, changeCommits);
|
|
815
815
|
newAtom = newAtom.sibling;
|
|
816
816
|
expectIndex++;
|
|
@@ -1148,8 +1148,8 @@ exports.Renderer = class Renderer {
|
|
|
1148
1148
|
};
|
|
1149
1149
|
}
|
|
1150
1150
|
applyRefs(refs, nativeNode, binding) {
|
|
1151
|
-
|
|
1152
|
-
for (const item of
|
|
1151
|
+
const refList = Array.isArray(refs) ? refs : [refs];
|
|
1152
|
+
for (const item of refList) {
|
|
1153
1153
|
if (item instanceof Ref) {
|
|
1154
1154
|
binding ? item.bind(nativeNode) : item.unBind(nativeNode);
|
|
1155
1155
|
}
|
|
@@ -1175,7 +1175,6 @@ class Viewfly extends di.ReflectiveInjector {
|
|
|
1175
1175
|
provide: RootComponentRef,
|
|
1176
1176
|
useFactory: () => {
|
|
1177
1177
|
return {
|
|
1178
|
-
host: config.host,
|
|
1179
1178
|
component: this.rootComponent
|
|
1180
1179
|
};
|
|
1181
1180
|
}
|
|
@@ -1194,8 +1193,11 @@ class Viewfly extends di.ReflectiveInjector {
|
|
|
1194
1193
|
}
|
|
1195
1194
|
/**
|
|
1196
1195
|
* 启动 Viewfly
|
|
1196
|
+
* @param host 应用根节点
|
|
1197
1197
|
*/
|
|
1198
|
-
|
|
1198
|
+
mount(host) {
|
|
1199
|
+
const rootComponentRef = this.get(RootComponentRef);
|
|
1200
|
+
rootComponentRef.host = host;
|
|
1199
1201
|
const renderer = this.get(exports.Renderer);
|
|
1200
1202
|
renderer.render();
|
|
1201
1203
|
if (this.config.autoUpdate === false) {
|
|
@@ -1239,7 +1241,7 @@ exports.jsx = jsx;
|
|
|
1239
1241
|
exports.jsxs = jsxs;
|
|
1240
1242
|
exports.makeError = makeError;
|
|
1241
1243
|
exports.onDestroy = onDestroy;
|
|
1242
|
-
exports.
|
|
1244
|
+
exports.onMounted = onMounted;
|
|
1243
1245
|
exports.onPropsChanged = onPropsChanged;
|
|
1244
1246
|
exports.onUpdated = onUpdated;
|
|
1245
1247
|
exports.provide = provide;
|
|
@@ -61,7 +61,7 @@ export interface PropsChangedCallback<T extends Props<any>> {
|
|
|
61
61
|
* }
|
|
62
62
|
* ```
|
|
63
63
|
*/
|
|
64
|
-
export declare function
|
|
64
|
+
export declare function onMounted(callback: LifeCycleCallback): void;
|
|
65
65
|
/**
|
|
66
66
|
* 当组件视图更新后调用
|
|
67
67
|
* @param callback
|
package/bundles/viewfly.d.ts
CHANGED
|
@@ -6,8 +6,6 @@ export type RootNode = JSXElement | JSXComponent;
|
|
|
6
6
|
* Viewfly 配置项
|
|
7
7
|
*/
|
|
8
8
|
export interface Config {
|
|
9
|
-
/** 应用根节点 */
|
|
10
|
-
host: NativeNode;
|
|
11
9
|
/** Viewfly IoC 容器中提供者集合 */
|
|
12
10
|
providers?: Provider[];
|
|
13
11
|
/** 是否自动更新视图 */
|
|
@@ -28,8 +26,9 @@ export declare class Viewfly extends ReflectiveInjector {
|
|
|
28
26
|
constructor(config: Config);
|
|
29
27
|
/**
|
|
30
28
|
* 启动 Viewfly
|
|
29
|
+
* @param host 应用根节点
|
|
31
30
|
*/
|
|
32
|
-
|
|
31
|
+
mount(host: NativeNode): void;
|
|
33
32
|
/**
|
|
34
33
|
* 销毁 Viewfly 实例
|
|
35
34
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viewfly/core",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.12",
|
|
4
4
|
"description": "Viewfly is a simple and easy-to-use JavaScript framework with an intuitive development experience.",
|
|
5
5
|
"main": "./bundles/index.js",
|
|
6
6
|
"module": "./bundles/index.esm.js",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"bugs": {
|
|
38
38
|
"url": "https://github.com/viewfly/viewfly.git/issues"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "e5fdc69779bbfd6a1128b98a30d8732dbda7fcd3"
|
|
41
41
|
}
|