@viewfly/platform-browser 0.5.1 → 0.5.2
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/index.esm.js +5 -25
- package/bundles/index.js +3 -24
- package/bundles/public-api.d.ts +0 -1
- package/package.json +2 -2
- package/bundles/fork.d.ts +0 -3
package/bundles/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NativeRenderer, viewfly, getCurrentInstance, inject, Component, onPropsChanged,
|
|
1
|
+
import { NativeRenderer, viewfly, getCurrentInstance, inject, Component, onPropsChanged, onUpdated, createRenderer } from '@viewfly/core';
|
|
2
2
|
|
|
3
3
|
class DomRenderer extends NativeRenderer {
|
|
4
4
|
constructor() {
|
|
@@ -155,6 +155,9 @@ function createPortal(childRender, host) {
|
|
|
155
155
|
onPropsChanged(() => {
|
|
156
156
|
component.markAsDirtied();
|
|
157
157
|
});
|
|
158
|
+
onUpdated(() => {
|
|
159
|
+
instance.$$view.atom.child = component.$$view.atom;
|
|
160
|
+
});
|
|
158
161
|
const render = createRenderer(component, nativeRenderer);
|
|
159
162
|
return function () {
|
|
160
163
|
render(host);
|
|
@@ -162,29 +165,6 @@ function createPortal(childRender, host) {
|
|
|
162
165
|
};
|
|
163
166
|
}
|
|
164
167
|
|
|
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
168
|
class VDOMElement {
|
|
189
169
|
constructor(name) {
|
|
190
170
|
this.name = name;
|
|
@@ -356,4 +336,4 @@ OutputTranslator.simpleXSSFilter = {
|
|
|
356
336
|
}
|
|
357
337
|
};
|
|
358
338
|
|
|
359
|
-
export { DomRenderer, HTMLRenderer, OutputTranslator, VDOMElement, VDomText, createApp, createPortal
|
|
339
|
+
export { DomRenderer, HTMLRenderer, OutputTranslator, VDOMElement, VDomText, createApp, createPortal };
|
package/bundles/index.js
CHANGED
|
@@ -157,6 +157,9 @@ function createPortal(childRender, host) {
|
|
|
157
157
|
core.onPropsChanged(() => {
|
|
158
158
|
component.markAsDirtied();
|
|
159
159
|
});
|
|
160
|
+
core.onUpdated(() => {
|
|
161
|
+
instance.$$view.atom.child = component.$$view.atom;
|
|
162
|
+
});
|
|
160
163
|
const render = core.createRenderer(component, nativeRenderer);
|
|
161
164
|
return function () {
|
|
162
165
|
render(host);
|
|
@@ -164,29 +167,6 @@ function createPortal(childRender, host) {
|
|
|
164
167
|
};
|
|
165
168
|
}
|
|
166
169
|
|
|
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
170
|
class VDOMElement {
|
|
191
171
|
constructor(name) {
|
|
192
172
|
this.name = name;
|
|
@@ -365,4 +345,3 @@ exports.VDOMElement = VDOMElement;
|
|
|
365
345
|
exports.VDomText = VDomText;
|
|
366
346
|
exports.createApp = createApp;
|
|
367
347
|
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.2",
|
|
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",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"bugs": {
|
|
34
34
|
"url": "https://github.com/viewfly/viewfly.git/issues"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "0e5643bc49cc0aad94f3a21ba430d5ac926a7a10"
|
|
37
37
|
}
|
package/bundles/fork.d.ts
DELETED