@viewfly/platform-browser 0.5.1 → 0.5.3
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-portal.d.ts +4 -1
- package/bundles/index.esm.js +5 -35
- package/bundles/index.js +3 -34
- package/bundles/public-api.d.ts +0 -1
- package/package.json +3 -3
- package/bundles/fork.d.ts +0 -3
|
@@ -28,4 +28,7 @@ import { JSXNode, NativeNode } from '@viewfly/core';
|
|
|
28
28
|
* }
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
|
-
export declare function createPortal<T extends NativeNode>(childRender: () => JSXNode, host: T):
|
|
31
|
+
export declare function createPortal<T extends NativeNode>(childRender: () => JSXNode, host: T): {
|
|
32
|
+
$portalHost: T;
|
|
33
|
+
$render: () => JSXNode;
|
|
34
|
+
};
|
package/bundles/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NativeRenderer, viewfly
|
|
1
|
+
import { NativeRenderer, viewfly } from '@viewfly/core';
|
|
2
2
|
|
|
3
3
|
class DomRenderer extends NativeRenderer {
|
|
4
4
|
constructor() {
|
|
@@ -149,42 +149,12 @@ function createApp(root, config = true) {
|
|
|
149
149
|
* ```
|
|
150
150
|
*/
|
|
151
151
|
function createPortal(childRender, host) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
onPropsChanged(() => {
|
|
156
|
-
component.markAsDirtied();
|
|
157
|
-
});
|
|
158
|
-
const render = createRenderer(component, nativeRenderer);
|
|
159
|
-
return function () {
|
|
160
|
-
render(host);
|
|
161
|
-
return null;
|
|
152
|
+
return {
|
|
153
|
+
$portalHost: host,
|
|
154
|
+
$render: childRender
|
|
162
155
|
};
|
|
163
156
|
}
|
|
164
157
|
|
|
165
|
-
const forkErrorFn = makeError('fork');
|
|
166
|
-
function fork(root, config = true) {
|
|
167
|
-
const c = { autoUpdate: true };
|
|
168
|
-
if (typeof config === 'boolean') {
|
|
169
|
-
c.autoUpdate = config;
|
|
170
|
-
}
|
|
171
|
-
else if (typeof config === 'object') {
|
|
172
|
-
Object.assign(c, config);
|
|
173
|
-
}
|
|
174
|
-
let injector;
|
|
175
|
-
try {
|
|
176
|
-
injector = inject(Injector, THROW_IF_NOT_FOUND, InjectFlags.Default);
|
|
177
|
-
}
|
|
178
|
-
catch (_a) {
|
|
179
|
-
throw forkErrorFn('The fork function can only be called synchronously within a component.');
|
|
180
|
-
}
|
|
181
|
-
const app = viewfly(Object.assign(Object.assign({}, c), { root, context: injector, nativeRenderer: new DomRenderer() }));
|
|
182
|
-
onUnmounted(() => {
|
|
183
|
-
app.destroy();
|
|
184
|
-
});
|
|
185
|
-
return app;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
158
|
class VDOMElement {
|
|
189
159
|
constructor(name) {
|
|
190
160
|
this.name = name;
|
|
@@ -356,4 +326,4 @@ OutputTranslator.simpleXSSFilter = {
|
|
|
356
326
|
}
|
|
357
327
|
};
|
|
358
328
|
|
|
359
|
-
export { DomRenderer, HTMLRenderer, OutputTranslator, VDOMElement, VDomText, createApp, createPortal
|
|
329
|
+
export { DomRenderer, HTMLRenderer, OutputTranslator, VDOMElement, VDomText, createApp, createPortal };
|
package/bundles/index.js
CHANGED
|
@@ -151,42 +151,12 @@ function createApp(root, config = true) {
|
|
|
151
151
|
* ```
|
|
152
152
|
*/
|
|
153
153
|
function createPortal(childRender, host) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
core.onPropsChanged(() => {
|
|
158
|
-
component.markAsDirtied();
|
|
159
|
-
});
|
|
160
|
-
const render = core.createRenderer(component, nativeRenderer);
|
|
161
|
-
return function () {
|
|
162
|
-
render(host);
|
|
163
|
-
return null;
|
|
154
|
+
return {
|
|
155
|
+
$portalHost: host,
|
|
156
|
+
$render: childRender
|
|
164
157
|
};
|
|
165
158
|
}
|
|
166
159
|
|
|
167
|
-
const forkErrorFn = core.makeError('fork');
|
|
168
|
-
function fork(root, config = true) {
|
|
169
|
-
const c = { autoUpdate: true };
|
|
170
|
-
if (typeof config === 'boolean') {
|
|
171
|
-
c.autoUpdate = config;
|
|
172
|
-
}
|
|
173
|
-
else if (typeof config === 'object') {
|
|
174
|
-
Object.assign(c, config);
|
|
175
|
-
}
|
|
176
|
-
let injector;
|
|
177
|
-
try {
|
|
178
|
-
injector = core.inject(core.Injector, core.THROW_IF_NOT_FOUND, core.InjectFlags.Default);
|
|
179
|
-
}
|
|
180
|
-
catch (_a) {
|
|
181
|
-
throw forkErrorFn('The fork function can only be called synchronously within a component.');
|
|
182
|
-
}
|
|
183
|
-
const app = core.viewfly(Object.assign(Object.assign({}, c), { root, context: injector, nativeRenderer: new DomRenderer() }));
|
|
184
|
-
core.onUnmounted(() => {
|
|
185
|
-
app.destroy();
|
|
186
|
-
});
|
|
187
|
-
return app;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
160
|
class VDOMElement {
|
|
191
161
|
constructor(name) {
|
|
192
162
|
this.name = name;
|
|
@@ -365,4 +335,3 @@ exports.VDOMElement = VDOMElement;
|
|
|
365
335
|
exports.VDomText = VDomText;
|
|
366
336
|
exports.createApp = createApp;
|
|
367
337
|
exports.createPortal = createPortal;
|
|
368
|
-
exports.fork = fork;
|
package/bundles/public-api.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viewfly/platform-browser",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
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.5.
|
|
15
|
+
"@viewfly/core": "^0.5.3",
|
|
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": "7dadc17107c6fc4b8db6e620e9b95141db09e042"
|
|
37
37
|
}
|
package/bundles/fork.d.ts
DELETED