nexa-runtime 0.7.2 → 0.7.4
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/dist/scheduler.js +1 -1
- package/dist/vdom/dom.js +6 -5
- package/dist/vdom/patch.js +4 -2
- package/dist/vdom/unmount.js +7 -0
- package/package.json +2 -2
package/dist/scheduler.js
CHANGED
|
@@ -25,7 +25,7 @@ export function flushJobs() {
|
|
|
25
25
|
const jobs = Array.from(pendingJobs).sort((a, b) => a.depth - b.depth);
|
|
26
26
|
pendingJobs.clear();
|
|
27
27
|
for (const instance of jobs) {
|
|
28
|
-
if (instance.update && typeof instance.update.run === 'function') {
|
|
28
|
+
if (instance.update && typeof instance.update.run === 'function' && instance.update.active) {
|
|
29
29
|
instance.update.run();
|
|
30
30
|
}
|
|
31
31
|
}
|
package/dist/vdom/dom.js
CHANGED
|
@@ -94,10 +94,6 @@ export const domOptions = {
|
|
|
94
94
|
else if (key === 'htmlFor') {
|
|
95
95
|
el.setAttribute('for', String(nextValue));
|
|
96
96
|
}
|
|
97
|
-
else if (key === 'ref') {
|
|
98
|
-
if (typeof nextValue === 'function')
|
|
99
|
-
nextValue(el);
|
|
100
|
-
}
|
|
101
97
|
else if (typeof nextValue === 'boolean') {
|
|
102
98
|
if (nextValue)
|
|
103
99
|
el.setAttribute(key, '');
|
|
@@ -114,7 +110,12 @@ export const domOptions = {
|
|
|
114
110
|
}
|
|
115
111
|
},
|
|
116
112
|
insert(el, parent, anchor = null) {
|
|
117
|
-
|
|
113
|
+
if (anchor && anchor.parentNode !== parent) {
|
|
114
|
+
parent.appendChild(el);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
parent.insertBefore(el, anchor);
|
|
118
|
+
}
|
|
118
119
|
},
|
|
119
120
|
remove(el) {
|
|
120
121
|
const parent = el.parentNode;
|
package/dist/vdom/patch.js
CHANGED
|
@@ -62,9 +62,10 @@ export function mount(vnode, parent, options, anchor = null) {
|
|
|
62
62
|
const el = createText('');
|
|
63
63
|
vnode.el = el;
|
|
64
64
|
if (typeof vnode.text === 'function') {
|
|
65
|
-
effect(() => {
|
|
65
|
+
const textEffect = effect(() => {
|
|
66
66
|
setText(el, String(vnode.text()));
|
|
67
67
|
});
|
|
68
|
+
vnode._textEffect = textEffect;
|
|
68
69
|
}
|
|
69
70
|
else {
|
|
70
71
|
setText(el, vnode.text ?? '');
|
|
@@ -136,7 +137,8 @@ function mountChildren(vnode, parent, options, anchor = null) {
|
|
|
136
137
|
}
|
|
137
138
|
function replaceNode(oldV, newV, parent, options, anchor) {
|
|
138
139
|
unmount(oldV, parent, options);
|
|
139
|
-
|
|
140
|
+
const safeAnchor = (anchor && anchor.parentNode === parent) ? anchor : null;
|
|
141
|
+
mount(newV, parent, options, safeAnchor);
|
|
140
142
|
}
|
|
141
143
|
function updateNode(vnode, options) {
|
|
142
144
|
const { patchProp, setText } = options;
|
package/dist/vdom/unmount.js
CHANGED
|
@@ -8,6 +8,9 @@ export function unmount(vnode, parent, options) {
|
|
|
8
8
|
runLifecycle(instance, 'beforeUnmount');
|
|
9
9
|
const devtools = typeof window !== 'undefined' && window.__NEXA_DEVTOOLS__;
|
|
10
10
|
devtools?.unregisterComponent(instance);
|
|
11
|
+
if (instance.update) {
|
|
12
|
+
instance.update.dispose();
|
|
13
|
+
}
|
|
11
14
|
if (instance.vnode) {
|
|
12
15
|
unmount(instance.vnode, parent, options);
|
|
13
16
|
}
|
|
@@ -18,6 +21,10 @@ export function unmount(vnode, parent, options) {
|
|
|
18
21
|
}
|
|
19
22
|
// Remove the physical element/node
|
|
20
23
|
if (vnode.el) {
|
|
24
|
+
if (vnode._textEffect) {
|
|
25
|
+
vnode._textEffect.dispose();
|
|
26
|
+
delete vnode._textEffect;
|
|
27
|
+
}
|
|
21
28
|
if (vnode.el._vShowEffect) {
|
|
22
29
|
vnode.el._vShowEffect.dispose();
|
|
23
30
|
delete vnode.el._vShowEffect;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nexa-runtime",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"nexa-reactivity": "0.7.
|
|
16
|
+
"nexa-reactivity": "0.7.4"
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
19
|
"dist"
|