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