@estjs/template 0.0.16-beta.2 → 0.0.16-beta.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/{chunk-3E4EK64L.dev.esm.js → chunk-JT6RSDKI.dev.esm.js} +11 -11
- package/dist/chunk-JT6RSDKI.dev.esm.js.map +1 -0
- package/dist/chunk-WWGSC3TY.esm.js +2 -0
- package/dist/chunk-WWGSC3TY.esm.js.map +1 -0
- package/dist/{internal-Bz6h0aPa.d.cts → internal-DSKAj-zW.d.cts} +4 -0
- package/dist/{internal-Bz6h0aPa.d.ts → internal-DSKAj-zW.d.ts} +4 -0
- package/dist/internal.cjs.js +1 -1
- package/dist/internal.cjs.js.map +1 -1
- package/dist/internal.d.cts +2 -1
- package/dist/internal.d.ts +2 -1
- package/dist/internal.dev.cjs.js +9 -9
- package/dist/internal.dev.cjs.js.map +1 -1
- package/dist/internal.dev.esm.js +1 -1
- package/dist/internal.esm.js +1 -1
- package/dist/template.cjs.js +2 -2
- package/dist/template.cjs.js.map +1 -1
- package/dist/template.d.cts +2 -2
- package/dist/template.d.ts +2 -2
- package/dist/template.dev.cjs.js +21 -19
- package/dist/template.dev.cjs.js.map +1 -1
- package/dist/template.dev.esm.js +14 -11
- package/dist/template.dev.esm.js.map +1 -1
- package/dist/template.esm.js +2 -2
- package/dist/template.esm.js.map +1 -1
- package/package.json +7 -3
- package/dist/chunk-3E4EK64L.dev.esm.js.map +0 -1
- package/dist/chunk-IRDMO5MX.esm.js +0 -2
- package/dist/chunk-IRDMO5MX.esm.js.map +0 -1
package/dist/template.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Signal, Computed } from '@estjs/signals';
|
|
2
|
-
import { S as Scope } from './internal-
|
|
3
|
-
export { I as InjectionKey, i as inject, p as provide } from './internal-
|
|
2
|
+
import { S as Scope } from './internal-DSKAj-zW.cjs';
|
|
3
|
+
export { I as InjectionKey, i as inject, p as provide } from './internal-DSKAj-zW.cjs';
|
|
4
4
|
import { normalizeClassName } from '@estjs/shared';
|
|
5
5
|
|
|
6
6
|
declare enum COMPONENT_STATE {
|
package/dist/template.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Signal, Computed } from '@estjs/signals';
|
|
2
|
-
import { S as Scope } from './internal-
|
|
3
|
-
export { I as InjectionKey, i as inject, p as provide } from './internal-
|
|
2
|
+
import { S as Scope } from './internal-DSKAj-zW.js';
|
|
3
|
+
export { I as InjectionKey, i as inject, p as provide } from './internal-DSKAj-zW.js';
|
|
4
4
|
import { normalizeClassName } from '@estjs/shared';
|
|
5
5
|
|
|
6
6
|
declare enum COMPONENT_STATE {
|
package/dist/template.dev.cjs.js
CHANGED
|
@@ -56,8 +56,10 @@ function getActiveScope() {
|
|
|
56
56
|
return activeScope;
|
|
57
57
|
}
|
|
58
58
|
function createScope(parent = activeScope) {
|
|
59
|
+
const reactiveScope = parent ? parent.effectScope.run(() => signals.effectScope()) : signals.effectScope(true);
|
|
59
60
|
const scope = {
|
|
60
61
|
id: ++scopeId,
|
|
62
|
+
effectScope: reactiveScope,
|
|
61
63
|
parent,
|
|
62
64
|
children: null,
|
|
63
65
|
// Lazy initialized
|
|
@@ -86,7 +88,7 @@ function runWithScope(scope, fn) {
|
|
|
86
88
|
const prevScope = activeScope;
|
|
87
89
|
activeScope = scope;
|
|
88
90
|
try {
|
|
89
|
-
return fn
|
|
91
|
+
return scope.effectScope.run(fn);
|
|
90
92
|
} finally {
|
|
91
93
|
activeScope = prevScope;
|
|
92
94
|
}
|
|
@@ -106,15 +108,13 @@ function disposeScope(scope) {
|
|
|
106
108
|
}
|
|
107
109
|
scope.children.clear();
|
|
108
110
|
}
|
|
109
|
-
|
|
110
|
-
activeScope = scope;
|
|
111
|
-
try {
|
|
111
|
+
runWithScope(scope, () => {
|
|
112
112
|
if (scope.onDestroy) {
|
|
113
113
|
for (let i = 0; i < scope.onDestroy.length; i++) {
|
|
114
114
|
try {
|
|
115
115
|
scope.onDestroy[i]();
|
|
116
116
|
} catch (error_) {
|
|
117
|
-
|
|
117
|
+
{
|
|
118
118
|
shared.error(`Scope(${scope.id}): Error in destroy hook:`, error_);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
@@ -126,16 +126,15 @@ function disposeScope(scope) {
|
|
|
126
126
|
try {
|
|
127
127
|
scope.cleanup[i]();
|
|
128
128
|
} catch (error_) {
|
|
129
|
-
|
|
129
|
+
{
|
|
130
130
|
shared.error(`Scope(${scope.id}): Error in cleanup:`, error_);
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
scope.cleanup = null;
|
|
135
135
|
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
}
|
|
136
|
+
});
|
|
137
|
+
scope.effectScope.stop();
|
|
139
138
|
if ((_a2 = scope.parent) == null ? void 0 : _a2.children) {
|
|
140
139
|
scope.parent.children.delete(scope);
|
|
141
140
|
}
|
|
@@ -692,7 +691,7 @@ function normalizeNode(node) {
|
|
|
692
691
|
}
|
|
693
692
|
function insert(parent, nodeFactory, before) {
|
|
694
693
|
if (!parent) return;
|
|
695
|
-
const
|
|
694
|
+
const parentScope = getActiveScope();
|
|
696
695
|
let renderedNodes = [];
|
|
697
696
|
let isFirstRun = true;
|
|
698
697
|
const resolveNodes = (raw) => {
|
|
@@ -716,8 +715,8 @@ function insert(parent, nodeFactory, before) {
|
|
|
716
715
|
renderedNodes = reconcileArrays(parent, renderedNodes, nodes, before);
|
|
717
716
|
isFirstRun = false;
|
|
718
717
|
};
|
|
719
|
-
if (
|
|
720
|
-
runWithScope(
|
|
718
|
+
if (parentScope && !parentScope.isDestroyed) {
|
|
719
|
+
runWithScope(parentScope, executeUpdate);
|
|
721
720
|
} else {
|
|
722
721
|
executeUpdate();
|
|
723
722
|
}
|
|
@@ -918,7 +917,9 @@ var Component = class {
|
|
|
918
917
|
if (shared.isFunction(result)) {
|
|
919
918
|
result = result(this.reactiveProps);
|
|
920
919
|
}
|
|
921
|
-
if (signals.isSignal(result)
|
|
920
|
+
if (signals.isSignal(result)) {
|
|
921
|
+
result = result.value;
|
|
922
|
+
} else if (signals.isComputed(result)) {
|
|
922
923
|
result = result.value;
|
|
923
924
|
}
|
|
924
925
|
return (_a3 = insert(parentNode, result, beforeNode)) != null ? _a3 : [];
|
|
@@ -1019,11 +1020,12 @@ var Component = class {
|
|
|
1019
1020
|
return () => value(null);
|
|
1020
1021
|
}
|
|
1021
1022
|
if (signals.isSignal(value)) {
|
|
1022
|
-
const
|
|
1023
|
-
|
|
1023
|
+
const ref = value;
|
|
1024
|
+
const previousValue = ref.value;
|
|
1025
|
+
ref.value = root;
|
|
1024
1026
|
return () => {
|
|
1025
|
-
if (
|
|
1026
|
-
|
|
1027
|
+
if (ref.value === root) {
|
|
1028
|
+
ref.value = previousValue;
|
|
1027
1029
|
}
|
|
1028
1030
|
};
|
|
1029
1031
|
}
|
|
@@ -1449,10 +1451,10 @@ function Portal(props) {
|
|
|
1449
1451
|
placeholder[PORTAL_COMPONENT] = true;
|
|
1450
1452
|
const { children } = props;
|
|
1451
1453
|
if (children == null) return placeholder;
|
|
1452
|
-
const
|
|
1454
|
+
const parentScope = getActiveScope();
|
|
1453
1455
|
let innerScope = null;
|
|
1454
1456
|
const mountAt = (parent, before) => {
|
|
1455
|
-
innerScope = createScope(
|
|
1457
|
+
innerScope = createScope(parentScope);
|
|
1456
1458
|
runWithScope(innerScope, () => {
|
|
1457
1459
|
insert(parent, () => children, before);
|
|
1458
1460
|
});
|