@viewfly/platform-browser 0.0.26 → 0.0.28
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/bundles/create-app.d.ts +4 -5
- package/bundles/fork.d.ts +2 -2
- package/bundles/index.esm.js +10 -50
- package/bundles/index.js +10 -49
- package/package.json +3 -3
package/bundles/create-app.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { JSXNode } from '@viewfly/core';
|
|
2
2
|
/**
|
|
3
3
|
* 创建一个 Viewfly 实例
|
|
4
4
|
* @param root 应用根节点
|
|
5
5
|
* @param autoUpdate 是否自动更新视图,默认为 true,当值为 false 时,Viewfly
|
|
6
|
-
* 只会首次渲染,直到手动调用
|
|
6
|
+
* 只会首次渲染,直到手动调用 app 的 render() 方法,这在单元测试中非常有用,
|
|
7
7
|
* 我们无需等待 Viewfly 默认的异步调度,实现同步更新视图
|
|
8
8
|
* ```tsx
|
|
9
9
|
* const app = createApp(<App/>, false).mount(document.getElementById('app'))
|
|
10
|
-
* const renderer = app.get(Renderer)
|
|
11
10
|
*
|
|
12
11
|
* // do something...
|
|
13
12
|
*
|
|
14
|
-
*
|
|
13
|
+
* app.render() // 手动更新视图
|
|
15
14
|
* ```
|
|
16
15
|
*/
|
|
17
|
-
export declare function createApp(root: JSXNode, autoUpdate?: boolean):
|
|
16
|
+
export declare function createApp(root: JSXNode, autoUpdate?: boolean): import("@viewfly/core").Application<HTMLElement>;
|
package/bundles/fork.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { JSXInternal
|
|
2
|
-
export declare function fork(root: JSXInternal.Element, autoUpdate?: boolean):
|
|
1
|
+
import { JSXInternal } from '@viewfly/core';
|
|
2
|
+
export declare function fork(root: JSXInternal.Element, autoUpdate?: boolean): import("@viewfly/core").Application<import("@viewfly/core").NativeNode>;
|
package/bundles/index.esm.js
CHANGED
|
@@ -1,35 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NativeRenderer, viewfly, makeError, inject, Injector, THROW_IF_NOT_FOUND, InjectFlags, onDestroy } from '@viewfly/core';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
Copyright (c) Microsoft Corporation.
|
|
5
|
-
|
|
6
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
7
|
-
purpose with or without fee is hereby granted.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
-
***************************************************************************** */
|
|
17
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
function __decorate(decorators, target, key, desc) {
|
|
21
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
22
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
23
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
24
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
28
|
-
var e = new Error(message);
|
|
29
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
let DomRenderer = class DomRenderer extends NativeRenderer {
|
|
3
|
+
class DomRenderer extends NativeRenderer {
|
|
33
4
|
constructor() {
|
|
34
5
|
super(...arguments);
|
|
35
6
|
this.isSVG = new RegExp(`^(${[
|
|
@@ -224,36 +195,28 @@ let DomRenderer = class DomRenderer extends NativeRenderer {
|
|
|
224
195
|
insertBefore(newNode, ref) {
|
|
225
196
|
ref.parentNode.insertBefore(newNode, ref);
|
|
226
197
|
}
|
|
227
|
-
}
|
|
228
|
-
DomRenderer = __decorate([
|
|
229
|
-
Injectable()
|
|
230
|
-
], DomRenderer);
|
|
198
|
+
}
|
|
231
199
|
|
|
232
200
|
/**
|
|
233
201
|
* 创建一个 Viewfly 实例
|
|
234
202
|
* @param root 应用根节点
|
|
235
203
|
* @param autoUpdate 是否自动更新视图,默认为 true,当值为 false 时,Viewfly
|
|
236
|
-
* 只会首次渲染,直到手动调用
|
|
204
|
+
* 只会首次渲染,直到手动调用 app 的 render() 方法,这在单元测试中非常有用,
|
|
237
205
|
* 我们无需等待 Viewfly 默认的异步调度,实现同步更新视图
|
|
238
206
|
* ```tsx
|
|
239
207
|
* const app = createApp(<App/>, false).mount(document.getElementById('app'))
|
|
240
|
-
* const renderer = app.get(Renderer)
|
|
241
208
|
*
|
|
242
209
|
* // do something...
|
|
243
210
|
*
|
|
244
|
-
*
|
|
211
|
+
* app.render() // 手动更新视图
|
|
245
212
|
* ```
|
|
246
213
|
*/
|
|
247
214
|
function createApp(root, autoUpdate = true) {
|
|
248
|
-
|
|
215
|
+
return viewfly({
|
|
249
216
|
root,
|
|
250
217
|
autoUpdate,
|
|
218
|
+
nativeRenderer: new DomRenderer()
|
|
251
219
|
});
|
|
252
|
-
app.provide({
|
|
253
|
-
provide: NativeRenderer,
|
|
254
|
-
useClass: DomRenderer
|
|
255
|
-
});
|
|
256
|
-
return app;
|
|
257
220
|
}
|
|
258
221
|
|
|
259
222
|
const forkErrorFn = makeError('fork');
|
|
@@ -265,15 +228,12 @@ function fork(root, autoUpdate = true) {
|
|
|
265
228
|
catch (_a) {
|
|
266
229
|
throw forkErrorFn('The fork function can only be called synchronously within a component.');
|
|
267
230
|
}
|
|
268
|
-
const app =
|
|
231
|
+
const app = viewfly({
|
|
269
232
|
root,
|
|
270
233
|
context: injector,
|
|
271
|
-
autoUpdate
|
|
234
|
+
autoUpdate,
|
|
235
|
+
nativeRenderer: new DomRenderer()
|
|
272
236
|
});
|
|
273
|
-
app.provide([{
|
|
274
|
-
provide: NativeRenderer,
|
|
275
|
-
useClass: DomRenderer
|
|
276
|
-
}]);
|
|
277
237
|
onDestroy(() => {
|
|
278
238
|
app.destroy();
|
|
279
239
|
});
|
package/bundles/index.js
CHANGED
|
@@ -2,36 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var core = require('@viewfly/core');
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
Copyright (c) Microsoft Corporation.
|
|
7
|
-
|
|
8
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
9
|
-
purpose with or without fee is hereby granted.
|
|
10
|
-
|
|
11
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
12
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
13
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
14
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
15
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
16
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
18
|
-
***************************************************************************** */
|
|
19
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function __decorate(decorators, target, key, desc) {
|
|
23
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
24
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
25
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
26
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
30
|
-
var e = new Error(message);
|
|
31
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
exports.DomRenderer = class DomRenderer extends core.NativeRenderer {
|
|
5
|
+
class DomRenderer extends core.NativeRenderer {
|
|
35
6
|
constructor() {
|
|
36
7
|
super(...arguments);
|
|
37
8
|
this.isSVG = new RegExp(`^(${[
|
|
@@ -226,36 +197,28 @@ exports.DomRenderer = class DomRenderer extends core.NativeRenderer {
|
|
|
226
197
|
insertBefore(newNode, ref) {
|
|
227
198
|
ref.parentNode.insertBefore(newNode, ref);
|
|
228
199
|
}
|
|
229
|
-
}
|
|
230
|
-
exports.DomRenderer = __decorate([
|
|
231
|
-
core.Injectable()
|
|
232
|
-
], exports.DomRenderer);
|
|
200
|
+
}
|
|
233
201
|
|
|
234
202
|
/**
|
|
235
203
|
* 创建一个 Viewfly 实例
|
|
236
204
|
* @param root 应用根节点
|
|
237
205
|
* @param autoUpdate 是否自动更新视图,默认为 true,当值为 false 时,Viewfly
|
|
238
|
-
* 只会首次渲染,直到手动调用
|
|
206
|
+
* 只会首次渲染,直到手动调用 app 的 render() 方法,这在单元测试中非常有用,
|
|
239
207
|
* 我们无需等待 Viewfly 默认的异步调度,实现同步更新视图
|
|
240
208
|
* ```tsx
|
|
241
209
|
* const app = createApp(<App/>, false).mount(document.getElementById('app'))
|
|
242
|
-
* const renderer = app.get(Renderer)
|
|
243
210
|
*
|
|
244
211
|
* // do something...
|
|
245
212
|
*
|
|
246
|
-
*
|
|
213
|
+
* app.render() // 手动更新视图
|
|
247
214
|
* ```
|
|
248
215
|
*/
|
|
249
216
|
function createApp(root, autoUpdate = true) {
|
|
250
|
-
|
|
217
|
+
return core.viewfly({
|
|
251
218
|
root,
|
|
252
219
|
autoUpdate,
|
|
220
|
+
nativeRenderer: new DomRenderer()
|
|
253
221
|
});
|
|
254
|
-
app.provide({
|
|
255
|
-
provide: core.NativeRenderer,
|
|
256
|
-
useClass: exports.DomRenderer
|
|
257
|
-
});
|
|
258
|
-
return app;
|
|
259
222
|
}
|
|
260
223
|
|
|
261
224
|
const forkErrorFn = core.makeError('fork');
|
|
@@ -267,20 +230,18 @@ function fork(root, autoUpdate = true) {
|
|
|
267
230
|
catch (_a) {
|
|
268
231
|
throw forkErrorFn('The fork function can only be called synchronously within a component.');
|
|
269
232
|
}
|
|
270
|
-
const app =
|
|
233
|
+
const app = core.viewfly({
|
|
271
234
|
root,
|
|
272
235
|
context: injector,
|
|
273
|
-
autoUpdate
|
|
236
|
+
autoUpdate,
|
|
237
|
+
nativeRenderer: new DomRenderer()
|
|
274
238
|
});
|
|
275
|
-
app.provide([{
|
|
276
|
-
provide: core.NativeRenderer,
|
|
277
|
-
useClass: exports.DomRenderer
|
|
278
|
-
}]);
|
|
279
239
|
core.onDestroy(() => {
|
|
280
240
|
app.destroy();
|
|
281
241
|
});
|
|
282
242
|
return app;
|
|
283
243
|
}
|
|
284
244
|
|
|
245
|
+
exports.DomRenderer = DomRenderer;
|
|
285
246
|
exports.createApp = createApp;
|
|
286
247
|
exports.fork = fork;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viewfly/platform-browser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
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,7 +12,7 @@
|
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"keywords": [],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@viewfly/core": "^0.0.
|
|
15
|
+
"@viewfly/core": "^0.0.28",
|
|
16
16
|
"csstype": "^3.1.2"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"bugs": {
|
|
34
34
|
"url": "https://github.com/viewfly/viewfly.git/issues"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "fab3872455d5c34634ef007b4e154025ced3b833"
|
|
37
37
|
}
|