@viewfly/platform-browser 0.0.18 → 0.0.19
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 +2 -1
- package/bundles/create-app.d.ts +3 -4
- package/bundles/fork.d.ts +1 -1
- package/bundles/index.esm.js +16 -22
- package/bundles/index.js +15 -21
- package/package.json +4 -4
package/README.md
CHANGED
package/bundles/create-app.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { Viewfly,
|
|
1
|
+
import { Viewfly, JSXNode } from '@viewfly/core';
|
|
2
2
|
/**
|
|
3
3
|
* 创建一个 Viewfly 实例
|
|
4
|
-
* @param host 应用根节点
|
|
5
4
|
* @param root 应用根节点
|
|
6
5
|
* @param autoUpdate 是否自动更新视图,默认为 true,当值为 false 时,Viewfly
|
|
7
6
|
* 只会首次渲染,直到手动调用 Renderer 类的 refresh() 方法,这在单元测试中非常有用,
|
|
8
7
|
* 我们无需等待 Viewfly 默认的异步调度,实现同步更新视图
|
|
9
8
|
* ```tsx
|
|
10
|
-
* const app = createApp(document.getElementById('app')
|
|
9
|
+
* const app = createApp(<App/>, false).mount(document.getElementById('app'))
|
|
11
10
|
* const renderer = app.get(Renderer)
|
|
12
11
|
*
|
|
13
12
|
* // do something...
|
|
@@ -15,4 +14,4 @@ import { Viewfly, JSXInternal } from '@viewfly/core';
|
|
|
15
14
|
* renderer.refresh() // 手动更新视图
|
|
16
15
|
* ```
|
|
17
16
|
*/
|
|
18
|
-
export declare function createApp(
|
|
17
|
+
export declare function createApp(root: JSXNode, autoUpdate?: boolean): Viewfly<HTMLElement>;
|
package/bundles/fork.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { JSXInternal, Viewfly } from '@viewfly/core';
|
|
2
|
-
export declare function fork(root: JSXInternal.Element): Viewfly
|
|
2
|
+
export declare function fork(root: JSXInternal.Element, autoUpdate?: boolean): Viewfly<import("@viewfly/core").NativeNode>;
|
package/bundles/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NativeRenderer, Viewfly, makeError,
|
|
1
|
+
import { NativeRenderer, Viewfly, makeError, inject, Injector, THROW_IF_NOT_FOUND, InjectFlags, onDestroy } from '@viewfly/core';
|
|
2
2
|
import { Injectable } from '@tanbo/di';
|
|
3
3
|
|
|
4
4
|
/******************************************************************************
|
|
@@ -232,13 +232,12 @@ DomRenderer = __decorate([
|
|
|
232
232
|
|
|
233
233
|
/**
|
|
234
234
|
* 创建一个 Viewfly 实例
|
|
235
|
-
* @param host 应用根节点
|
|
236
235
|
* @param root 应用根节点
|
|
237
236
|
* @param autoUpdate 是否自动更新视图,默认为 true,当值为 false 时,Viewfly
|
|
238
237
|
* 只会首次渲染,直到手动调用 Renderer 类的 refresh() 方法,这在单元测试中非常有用,
|
|
239
238
|
* 我们无需等待 Viewfly 默认的异步调度,实现同步更新视图
|
|
240
239
|
* ```tsx
|
|
241
|
-
* const app = createApp(document.getElementById('app')
|
|
240
|
+
* const app = createApp(<App/>, false).mount(document.getElementById('app'))
|
|
242
241
|
* const renderer = app.get(Renderer)
|
|
243
242
|
*
|
|
244
243
|
* // do something...
|
|
@@ -246,41 +245,36 @@ DomRenderer = __decorate([
|
|
|
246
245
|
* renderer.refresh() // 手动更新视图
|
|
247
246
|
* ```
|
|
248
247
|
*/
|
|
249
|
-
function createApp(
|
|
250
|
-
host.innerHTML = '';
|
|
248
|
+
function createApp(root, autoUpdate = true) {
|
|
251
249
|
const app = new Viewfly({
|
|
252
250
|
root,
|
|
253
251
|
autoUpdate,
|
|
254
|
-
providers: [
|
|
255
|
-
{
|
|
256
|
-
provide: NativeRenderer,
|
|
257
|
-
useClass: DomRenderer
|
|
258
|
-
}
|
|
259
|
-
]
|
|
260
252
|
});
|
|
261
|
-
app.
|
|
253
|
+
app.provide({
|
|
254
|
+
provide: NativeRenderer,
|
|
255
|
+
useClass: DomRenderer
|
|
256
|
+
});
|
|
262
257
|
return app;
|
|
263
258
|
}
|
|
264
259
|
|
|
265
260
|
const forkErrorFn = makeError('fork');
|
|
266
|
-
function fork(root) {
|
|
267
|
-
let
|
|
261
|
+
function fork(root, autoUpdate = true) {
|
|
262
|
+
let injector;
|
|
268
263
|
try {
|
|
269
|
-
|
|
264
|
+
injector = inject(Injector, THROW_IF_NOT_FOUND, InjectFlags.Default);
|
|
270
265
|
}
|
|
271
266
|
catch (_a) {
|
|
272
267
|
throw forkErrorFn('The fork function can only be called synchronously within a component.');
|
|
273
268
|
}
|
|
274
269
|
const app = new Viewfly({
|
|
275
270
|
root,
|
|
276
|
-
context:
|
|
277
|
-
|
|
278
|
-
{
|
|
279
|
-
provide: NativeRenderer,
|
|
280
|
-
useClass: DomRenderer
|
|
281
|
-
}
|
|
282
|
-
]
|
|
271
|
+
context: injector,
|
|
272
|
+
autoUpdate
|
|
283
273
|
});
|
|
274
|
+
app.provide([{
|
|
275
|
+
provide: NativeRenderer,
|
|
276
|
+
useClass: DomRenderer
|
|
277
|
+
}]);
|
|
284
278
|
onDestroy(() => {
|
|
285
279
|
app.destroy();
|
|
286
280
|
});
|
package/bundles/index.js
CHANGED
|
@@ -234,13 +234,12 @@ exports.DomRenderer = __decorate([
|
|
|
234
234
|
|
|
235
235
|
/**
|
|
236
236
|
* 创建一个 Viewfly 实例
|
|
237
|
-
* @param host 应用根节点
|
|
238
237
|
* @param root 应用根节点
|
|
239
238
|
* @param autoUpdate 是否自动更新视图,默认为 true,当值为 false 时,Viewfly
|
|
240
239
|
* 只会首次渲染,直到手动调用 Renderer 类的 refresh() 方法,这在单元测试中非常有用,
|
|
241
240
|
* 我们无需等待 Viewfly 默认的异步调度,实现同步更新视图
|
|
242
241
|
* ```tsx
|
|
243
|
-
* const app = createApp(document.getElementById('app')
|
|
242
|
+
* const app = createApp(<App/>, false).mount(document.getElementById('app'))
|
|
244
243
|
* const renderer = app.get(Renderer)
|
|
245
244
|
*
|
|
246
245
|
* // do something...
|
|
@@ -248,41 +247,36 @@ exports.DomRenderer = __decorate([
|
|
|
248
247
|
* renderer.refresh() // 手动更新视图
|
|
249
248
|
* ```
|
|
250
249
|
*/
|
|
251
|
-
function createApp(
|
|
252
|
-
host.innerHTML = '';
|
|
250
|
+
function createApp(root, autoUpdate = true) {
|
|
253
251
|
const app = new core.Viewfly({
|
|
254
252
|
root,
|
|
255
253
|
autoUpdate,
|
|
256
|
-
providers: [
|
|
257
|
-
{
|
|
258
|
-
provide: core.NativeRenderer,
|
|
259
|
-
useClass: exports.DomRenderer
|
|
260
|
-
}
|
|
261
|
-
]
|
|
262
254
|
});
|
|
263
|
-
app.
|
|
255
|
+
app.provide({
|
|
256
|
+
provide: core.NativeRenderer,
|
|
257
|
+
useClass: exports.DomRenderer
|
|
258
|
+
});
|
|
264
259
|
return app;
|
|
265
260
|
}
|
|
266
261
|
|
|
267
262
|
const forkErrorFn = core.makeError('fork');
|
|
268
|
-
function fork(root) {
|
|
269
|
-
let
|
|
263
|
+
function fork(root, autoUpdate = true) {
|
|
264
|
+
let injector;
|
|
270
265
|
try {
|
|
271
|
-
|
|
266
|
+
injector = core.inject(core.Injector, core.THROW_IF_NOT_FOUND, core.InjectFlags.Default);
|
|
272
267
|
}
|
|
273
268
|
catch (_a) {
|
|
274
269
|
throw forkErrorFn('The fork function can only be called synchronously within a component.');
|
|
275
270
|
}
|
|
276
271
|
const app = new core.Viewfly({
|
|
277
272
|
root,
|
|
278
|
-
context:
|
|
279
|
-
|
|
280
|
-
{
|
|
281
|
-
provide: core.NativeRenderer,
|
|
282
|
-
useClass: exports.DomRenderer
|
|
283
|
-
}
|
|
284
|
-
]
|
|
273
|
+
context: injector,
|
|
274
|
+
autoUpdate
|
|
285
275
|
});
|
|
276
|
+
app.provide([{
|
|
277
|
+
provide: core.NativeRenderer,
|
|
278
|
+
useClass: exports.DomRenderer
|
|
279
|
+
}]);
|
|
286
280
|
core.onDestroy(() => {
|
|
287
281
|
app.destroy();
|
|
288
282
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viewfly/platform-browser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"description": "This project is used to enable the Viewfly framework to run in a browser.",
|
|
5
5
|
"main": "./bundles/index.js",
|
|
6
6
|
"module": "./bundles/index.esm.js",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"keywords": [],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@tanbo/di": "^1.1.
|
|
16
|
-
"@viewfly/core": "^0.0.
|
|
15
|
+
"@tanbo/di": "^1.1.8",
|
|
16
|
+
"@viewfly/core": "^0.0.19",
|
|
17
17
|
"csstype": "^3.1.2",
|
|
18
18
|
"reflect-metadata": "^0.1.13"
|
|
19
19
|
},
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"bugs": {
|
|
36
36
|
"url": "https://github.com/viewfly/viewfly.git/issues"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "9276451814bcda728846876797e327d297a31b0e"
|
|
39
39
|
}
|