marko 6.1.11 → 6.1.12
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/common/accessor.d.ts +2 -2
- package/dist/common/accessor.debug.d.ts +2 -2
- package/dist/common/errors.d.ts +0 -2
- package/dist/common/types.d.ts +2 -2
- package/dist/debug/dom.js +53 -46
- package/dist/debug/dom.mjs +53 -46
- package/dist/dom/queue.d.ts +2 -2
- package/dist/dom/scope.d.ts +3 -0
- package/dist/dom.d.ts +2 -1
- package/dist/dom.js +48 -37
- package/dist/dom.mjs +48 -37
- package/dist/html/writer.d.ts +1 -1
- package/dist/translator/index.js +4 -4
- package/package.json +1 -1
package/dist/debug/dom.mjs
CHANGED
|
@@ -29,10 +29,6 @@ function _hoist_read_error() {
|
|
|
29
29
|
function _assert_hoist(value) {
|
|
30
30
|
if (typeof value !== "function") throw new Error(`Hoisted values must be functions, received type "${typeof value}".`);
|
|
31
31
|
}
|
|
32
|
-
function _assert_init(scope, accessor) {
|
|
33
|
-
if (scope["#Creating"] || !(accessor in scope)) throw new ReferenceError(`Cannot access '${accessor}' before initialization`);
|
|
34
|
-
return scope[accessor];
|
|
35
|
-
}
|
|
36
32
|
function assertExclusiveAttrs(attrs, onError = throwErr) {
|
|
37
33
|
if (attrs) {
|
|
38
34
|
let exclusiveAttrs;
|
|
@@ -200,16 +196,34 @@ function parseHTML(html, ns) {
|
|
|
200
196
|
//#endregion
|
|
201
197
|
//#region src/dom/scope.ts
|
|
202
198
|
let nextScopeId = 1e6;
|
|
199
|
+
let collectingScopes;
|
|
203
200
|
function createScope($global, closestBranch) {
|
|
204
201
|
const scope = {
|
|
205
202
|
["#Id"]: nextScopeId++,
|
|
206
|
-
["#
|
|
203
|
+
["#Gen"]: runId,
|
|
207
204
|
["#ClosestBranch"]: closestBranch,
|
|
208
205
|
["$global"]: $global
|
|
209
206
|
};
|
|
210
|
-
|
|
207
|
+
collectingScopes?.push(scope);
|
|
211
208
|
return scope;
|
|
212
209
|
}
|
|
210
|
+
function syncGen(scope) {
|
|
211
|
+
scope["#Gen"] = runId;
|
|
212
|
+
}
|
|
213
|
+
function _assert_init(scope, accessor) {
|
|
214
|
+
if (scope["#Gen"] === runId || !(accessor in scope)) throw new ReferenceError(`Cannot access '${accessor}' before initialization`);
|
|
215
|
+
return scope[accessor];
|
|
216
|
+
}
|
|
217
|
+
function collectScopes(fn) {
|
|
218
|
+
const prev = collectingScopes;
|
|
219
|
+
collectingScopes = [];
|
|
220
|
+
try {
|
|
221
|
+
fn();
|
|
222
|
+
return collectingScopes;
|
|
223
|
+
} finally {
|
|
224
|
+
collectingScopes = prev;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
213
227
|
function skipScope() {
|
|
214
228
|
return nextScopeId++;
|
|
215
229
|
}
|
|
@@ -223,13 +237,13 @@ function destroyBranch(branch) {
|
|
|
223
237
|
destroyNestedScopes(branch);
|
|
224
238
|
}
|
|
225
239
|
function destroyScope(scope) {
|
|
226
|
-
if (
|
|
240
|
+
if (scope["#Gen"]) {
|
|
227
241
|
destroyNestedScopes(scope);
|
|
228
242
|
resetControllers(scope);
|
|
229
243
|
}
|
|
230
244
|
}
|
|
231
245
|
const destroyNestedScopes = function destroyNestedScopes(scope) {
|
|
232
|
-
scope["#
|
|
246
|
+
scope["#Gen"] = 0;
|
|
233
247
|
scope["#BranchScopes"]?.forEach(destroyNestedScopes);
|
|
234
248
|
scope["#AbortScopes"]?.forEach(resetControllers);
|
|
235
249
|
};
|
|
@@ -288,7 +302,7 @@ function _let(id, fn) {
|
|
|
288
302
|
id = +id.slice(id.lastIndexOf("/") + 1);
|
|
289
303
|
return (scope, value) => {
|
|
290
304
|
if (rendering) {
|
|
291
|
-
if (scope["#
|
|
305
|
+
if (scope["#Gen"] === runId) {
|
|
292
306
|
scope[valueAccessor] = value;
|
|
293
307
|
fn?.(scope);
|
|
294
308
|
}
|
|
@@ -323,7 +337,7 @@ function _const(valueAccessor, fn) {
|
|
|
323
337
|
}
|
|
324
338
|
function _or(id, fn, defaultPending = 1, scopeIdAccessor = "#Id") {
|
|
325
339
|
return (scope) => {
|
|
326
|
-
if (scope["#
|
|
340
|
+
if (scope["#Gen"] === runId) if (id in scope) {
|
|
327
341
|
if (!--scope[id]) fn(scope);
|
|
328
342
|
} else scope[id] = defaultPending;
|
|
329
343
|
else queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
|
@@ -334,7 +348,7 @@ function _for_closure(ownerLoopNodeAccessor, fn) {
|
|
|
334
348
|
const ownerSignal = (ownerScope) => {
|
|
335
349
|
const scopes = toArray(ownerScope[scopeAccessor]);
|
|
336
350
|
if (scopes.length) queueRender(ownerScope, () => {
|
|
337
|
-
for (const scope of scopes) if (
|
|
351
|
+
for (const scope of scopes) if (scope["#Gen"] > 0 && scope["#Gen"] < runId) fn(scope);
|
|
338
352
|
}, -1, 0, scopes[0]["#Id"]);
|
|
339
353
|
};
|
|
340
354
|
ownerSignal._ = fn;
|
|
@@ -345,7 +359,7 @@ function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
|
|
|
345
359
|
const branchAccessor = "ConditionalRenderer:" + ownerConditionalNodeAccessor;
|
|
346
360
|
const ownerSignal = (scope) => {
|
|
347
361
|
const ifScope = scope[scopeAccessor];
|
|
348
|
-
if (ifScope &&
|
|
362
|
+
if (ifScope && ifScope["#Gen"] > 0 && ifScope["#Gen"] < runId && (scope[branchAccessor] || 0) === branch) queueRender(ifScope, fn, -1);
|
|
349
363
|
};
|
|
350
364
|
ownerSignal._ = fn;
|
|
351
365
|
return ownerSignal;
|
|
@@ -364,7 +378,7 @@ function _closure(...closureSignals) {
|
|
|
364
378
|
for (let i = closureSignals.length; i--;) closureSignals[i]["index"] = i;
|
|
365
379
|
return (scope) => {
|
|
366
380
|
if (scope[scopeInstances]) {
|
|
367
|
-
for (const childScope of scope[scopeInstances]) if (
|
|
381
|
+
for (const childScope of scope[scopeInstances]) if (childScope["#Gen"] > 0 && childScope["#Gen"] < runId) queueRender(childScope, closureSignals[childScope[signalIndex] || 0], -1);
|
|
368
382
|
}
|
|
369
383
|
};
|
|
370
384
|
}
|
|
@@ -604,6 +618,7 @@ function init(runtimeId = "M") {
|
|
|
604
618
|
renderId
|
|
605
619
|
};
|
|
606
620
|
const initScope = (scope) => {
|
|
621
|
+
scope["#Gen"] = 1;
|
|
607
622
|
scope["$global"] = initGlobal();
|
|
608
623
|
if (branchesEnabled && scope["#ClosestBranchId"]) scope["#ClosestBranch"] = getScope(scope["#ClosestBranchId"]);
|
|
609
624
|
return scope;
|
|
@@ -768,7 +783,7 @@ function _attr_input_checked_default(scope, nodeAccessor, checked) {
|
|
|
768
783
|
const el = scope[nodeAccessor];
|
|
769
784
|
const normalizedChecked = isNotVoid(checked);
|
|
770
785
|
if (el.defaultChecked !== normalizedChecked) {
|
|
771
|
-
const restoreValue = scope["#
|
|
786
|
+
const restoreValue = scope["#Gen"] < runId ? el.checked : normalizedChecked;
|
|
772
787
|
el.defaultChecked = normalizedChecked;
|
|
773
788
|
if (restoreValue !== normalizedChecked) el.checked = restoreValue;
|
|
774
789
|
}
|
|
@@ -778,7 +793,7 @@ function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
|
|
|
778
793
|
const normalizedChecked = isNotVoid(checked);
|
|
779
794
|
scope["ControlledHandler:" + nodeAccessor] = checkedChange;
|
|
780
795
|
scope["ControlledType:" + nodeAccessor] = checkedChange ? 0 : 5;
|
|
781
|
-
if (checkedChange &&
|
|
796
|
+
if (checkedChange && scope["#Gen"] < runId) el.checked = normalizedChecked;
|
|
782
797
|
else _attr_input_checked_default(scope, nodeAccessor, normalizedChecked);
|
|
783
798
|
}
|
|
784
799
|
function _attr_input_checked_script(scope, nodeAccessor) {
|
|
@@ -806,7 +821,7 @@ function _attr_input_checkedValue(scope, nodeAccessor, checkedValue, checkedValu
|
|
|
806
821
|
const normalizedCheckedValue = scope["ControlledValue:" + nodeAccessor] = multiple ? checkedValue.map(normalizeStrProp) : normalizeStrProp(checkedValue);
|
|
807
822
|
scope["ControlledHandler:" + nodeAccessor] = checkedValueChange;
|
|
808
823
|
scope["ControlledType:" + nodeAccessor] = checkedValueChange ? 1 : 5;
|
|
809
|
-
if (checkedValueChange &&
|
|
824
|
+
if (checkedValueChange && scope["#Gen"] < runId) {
|
|
810
825
|
el.checked = multiple ? normalizedCheckedValue.includes(normalizeStrProp(value)) : normalizeStrProp(value) === normalizedCheckedValue;
|
|
811
826
|
_attr(el, "value", value);
|
|
812
827
|
} else _attr_input_checkedValue_default(scope, nodeAccessor, checkedValue, value);
|
|
@@ -832,7 +847,7 @@ function _attr_input_value_default(scope, nodeAccessor, value) {
|
|
|
832
847
|
const el = scope[nodeAccessor];
|
|
833
848
|
const normalizedValue = normalizeAttrValue(value) || "";
|
|
834
849
|
if (el.defaultValue !== normalizedValue) {
|
|
835
|
-
const restoreValue = scope["#
|
|
850
|
+
const restoreValue = scope["#Gen"] < runId ? el.value : normalizedValue;
|
|
836
851
|
el.defaultValue = normalizedValue;
|
|
837
852
|
setInputValue(el, restoreValue);
|
|
838
853
|
}
|
|
@@ -843,7 +858,7 @@ function _attr_input_value(scope, nodeAccessor, value, valueChange) {
|
|
|
843
858
|
scope["ControlledHandler:" + nodeAccessor] = valueChange;
|
|
844
859
|
scope["ControlledValue:" + nodeAccessor] = normalizedValue;
|
|
845
860
|
scope["ControlledType:" + nodeAccessor] = valueChange ? 2 : 5;
|
|
846
|
-
if (valueChange &&
|
|
861
|
+
if (valueChange && scope["#Gen"] < runId) setInputValue(el, normalizedValue);
|
|
847
862
|
else _attr_input_value_default(scope, nodeAccessor, normalizedValue);
|
|
848
863
|
}
|
|
849
864
|
function _attr_input_value_script(scope, nodeAccessor) {
|
|
@@ -869,14 +884,14 @@ function setInputValue(el, value) {
|
|
|
869
884
|
function _attr_select_value_default(scope, nodeAccessor, value) {
|
|
870
885
|
let restoreValue;
|
|
871
886
|
const el = scope[nodeAccessor];
|
|
872
|
-
const
|
|
887
|
+
const live = scope["#Gen"] < runId;
|
|
873
888
|
const multiple = Array.isArray(value);
|
|
874
889
|
const normalizedValue = multiple ? value.map(normalizeStrProp) : normalizeStrProp(value);
|
|
875
890
|
pendingEffects.unshift(() => {
|
|
876
891
|
for (const opt of el.options) {
|
|
877
892
|
const selected = multiple ? normalizedValue.includes(opt.value) : opt.value === normalizedValue;
|
|
878
893
|
if (opt.defaultSelected !== selected) {
|
|
879
|
-
if (
|
|
894
|
+
if (live) restoreValue ??= getSelectValue(el, multiple);
|
|
880
895
|
opt.defaultSelected = selected;
|
|
881
896
|
}
|
|
882
897
|
}
|
|
@@ -885,7 +900,7 @@ function _attr_select_value_default(scope, nodeAccessor, value) {
|
|
|
885
900
|
}
|
|
886
901
|
function _attr_select_value(scope, nodeAccessor, value, valueChange) {
|
|
887
902
|
const el = scope[nodeAccessor];
|
|
888
|
-
const existing =
|
|
903
|
+
const existing = scope["#Gen"] < runId;
|
|
889
904
|
const multiple = Array.isArray(value);
|
|
890
905
|
const normalizedValue = scope["ControlledValue:" + nodeAccessor] = multiple ? value.map(normalizeStrProp) : normalizeStrProp(value);
|
|
891
906
|
scope["ControlledHandler:" + nodeAccessor] = valueChange;
|
|
@@ -933,13 +948,13 @@ function getSelectValue(el, multiple) {
|
|
|
933
948
|
return multiple ? Array.from(el.selectedOptions, (opt) => opt.value) : el.value;
|
|
934
949
|
}
|
|
935
950
|
function _attr_details_or_dialog_open_default(scope, nodeAccessor, open) {
|
|
936
|
-
if (scope["#
|
|
951
|
+
if (scope["#Gen"] === runId) scope[nodeAccessor].open = isNotVoid(open);
|
|
937
952
|
}
|
|
938
953
|
function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
|
|
939
954
|
const normalizedOpen = scope["ControlledValue:" + nodeAccessor] = isNotVoid(open);
|
|
940
955
|
scope["ControlledHandler:" + nodeAccessor] = openChange;
|
|
941
956
|
scope["ControlledType:" + nodeAccessor] = openChange ? 4 : 5;
|
|
942
|
-
if (openChange &&
|
|
957
|
+
if (openChange && scope["#Gen"] < runId) scope[nodeAccessor].open = normalizedOpen;
|
|
943
958
|
else _attr_details_or_dialog_open_default(scope, nodeAccessor, normalizedOpen);
|
|
944
959
|
}
|
|
945
960
|
function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
|
|
@@ -1243,7 +1258,7 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1243
1258
|
scope[promiseAccessor] = 0;
|
|
1244
1259
|
queueAsyncRender(scope, () => {
|
|
1245
1260
|
if ((awaitBranch = scope[branchAccessor])["#DetachedAwait"]) {
|
|
1246
|
-
|
|
1261
|
+
awaitBranch["#PendingScopes"] = awaitBranch["#PendingScopes"]?.forEach(syncGen);
|
|
1247
1262
|
setupBranch(awaitBranch["#DetachedAwait"], awaitBranch);
|
|
1248
1263
|
awaitBranch["#DetachedAwait"] = 0;
|
|
1249
1264
|
insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]);
|
|
@@ -1284,8 +1299,8 @@ function _await_content(nodeAccessor, template, walks, setup) {
|
|
|
1284
1299
|
const branchAccessor = "BranchScopes:" + nodeAccessor;
|
|
1285
1300
|
const renderer = _content("", template, walks, setup)();
|
|
1286
1301
|
return (scope) => {
|
|
1287
|
-
(scope[branchAccessor] = createBranch(scope["$global"], renderer, scope, scope[nodeAccessor].parentNode))["#DetachedAwait"] = renderer;
|
|
1288
|
-
pendingScopes
|
|
1302
|
+
const pendingScopes = collectScopes(() => (scope[branchAccessor] = createBranch(scope["$global"], renderer, scope, scope[nodeAccessor].parentNode))["#DetachedAwait"] = renderer);
|
|
1303
|
+
scope[branchAccessor]["#PendingScopes"] = pendingScopes;
|
|
1289
1304
|
};
|
|
1290
1305
|
}
|
|
1291
1306
|
function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, "#PlaceholderContent")) {
|
|
@@ -1548,13 +1563,12 @@ function byFirstArg(name) {
|
|
|
1548
1563
|
}
|
|
1549
1564
|
//#endregion
|
|
1550
1565
|
//#region src/dom/queue.ts
|
|
1551
|
-
let
|
|
1552
|
-
let
|
|
1566
|
+
let rendering;
|
|
1567
|
+
let runId = 2;
|
|
1553
1568
|
const caughtError = /* @__PURE__ */ new WeakSet();
|
|
1554
1569
|
const placeholderShown = /* @__PURE__ */ new WeakSet();
|
|
1555
1570
|
let pendingEffects = [];
|
|
1556
|
-
let
|
|
1557
|
-
let rendering;
|
|
1571
|
+
let pendingRenders = [];
|
|
1558
1572
|
const scopeKeyOffset = 1e3;
|
|
1559
1573
|
function queueRender(scope, signal, signalKey, value, scopeKey = scope["#Id"]) {
|
|
1560
1574
|
let render;
|
|
@@ -1647,13 +1661,11 @@ function runRenders() {
|
|
|
1647
1661
|
}
|
|
1648
1662
|
runRender(render);
|
|
1649
1663
|
}
|
|
1650
|
-
for (const scope of pendingScopes) scope["#Creating"] = 0;
|
|
1651
|
-
pendingScopes = [];
|
|
1652
1664
|
}
|
|
1653
1665
|
let runRender = (render) => render["signal"](render["scope"], render["value"]);
|
|
1654
1666
|
function skipDestroyedRenders() {
|
|
1655
1667
|
runRender = ((runRender) => (render) => {
|
|
1656
|
-
if (
|
|
1668
|
+
if (render["scope"]["#ClosestBranch"]?.["#Gen"] !== 0) runRender(render);
|
|
1657
1669
|
})(runRender);
|
|
1658
1670
|
}
|
|
1659
1671
|
let catchEnabled;
|
|
@@ -1676,8 +1688,7 @@ function _enable_catch() {
|
|
|
1676
1688
|
for (; i < effects.length;) {
|
|
1677
1689
|
fn = effects[i++];
|
|
1678
1690
|
scope = effects[i++];
|
|
1679
|
-
branch = scope["#ClosestBranch"];
|
|
1680
|
-
if (!branch?.["#Destroyed"] && !(checkPending && handlePendingTry(fn, scope, branch))) fn(scope);
|
|
1691
|
+
if ((branch = scope["#ClosestBranch"])?.["#Gen"] !== 0 && !(checkPending && handlePendingTry(fn, scope, branch))) fn(scope);
|
|
1681
1692
|
}
|
|
1682
1693
|
} else runEffects(effects);
|
|
1683
1694
|
})(runEffects);
|
|
@@ -1901,13 +1912,12 @@ function _load_setup(nodeAccessor, childScopeAccessor, load) {
|
|
|
1901
1912
|
}
|
|
1902
1913
|
function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
1903
1914
|
const parent = marker.parentNode;
|
|
1904
|
-
branch
|
|
1915
|
+
syncGen(branch);
|
|
1905
1916
|
renderer["clone"](branch, parent.namespaceURI);
|
|
1906
1917
|
setupBranch(renderer, branch);
|
|
1907
1918
|
applyLoad(branch, () => {
|
|
1908
1919
|
insertBranchBefore(branch, parent, marker);
|
|
1909
1920
|
marker.remove();
|
|
1910
|
-
pendingScopes.push(branch);
|
|
1911
1921
|
awaitCounter?.c();
|
|
1912
1922
|
});
|
|
1913
1923
|
}
|
|
@@ -1923,14 +1933,11 @@ function applyLoad(scope, insert) {
|
|
|
1923
1933
|
scope["#Load"] = 0;
|
|
1924
1934
|
if (remaining = values?.size) for (const [promise, entry] of values) promise.then((signal) => {
|
|
1925
1935
|
entry["signal"] = signal;
|
|
1926
|
-
if (!--remaining) {
|
|
1927
|
-
scope
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
insert();
|
|
1932
|
-
});
|
|
1933
|
-
}
|
|
1936
|
+
if (!--remaining) queueAsyncRender(scope, (scope) => {
|
|
1937
|
+
syncGen(scope);
|
|
1938
|
+
values.forEach((e) => e["signal"]._(scope, e["value"]));
|
|
1939
|
+
insert();
|
|
1940
|
+
});
|
|
1934
1941
|
}, () => 0);
|
|
1935
1942
|
else insert();
|
|
1936
1943
|
}
|
|
@@ -1939,7 +1946,7 @@ function _load_signal(load) {
|
|
|
1939
1946
|
let signal;
|
|
1940
1947
|
return (scope, value) => {
|
|
1941
1948
|
pending ||= load();
|
|
1942
|
-
if (scope["#Load"] || !("#Load" in scope) && scope["#
|
|
1949
|
+
if (scope["#Load"] || !("#Load" in scope) && scope["#Gen"] === runId) (scope["#Load"] ||= /* @__PURE__ */ new Map()).set(pending, { ["value"]: value });
|
|
1943
1950
|
else if (signal) signal(scope, value);
|
|
1944
1951
|
else pending.then((mod) => queueAsyncRender(scope, signal = mod._, value), () => 0);
|
|
1945
1952
|
};
|
package/dist/dom/queue.d.ts
CHANGED
|
@@ -9,11 +9,11 @@ export type PendingRender = {
|
|
|
9
9
|
[PendingRenderProp.Gen]: number;
|
|
10
10
|
[PendingRenderProp.Pending]?: 0 | 1;
|
|
11
11
|
};
|
|
12
|
+
export declare let rendering: undefined | 0 | 1;
|
|
13
|
+
export declare let runId: number;
|
|
12
14
|
export declare const caughtError: WeakSet<unknown[]>;
|
|
13
15
|
export declare const placeholderShown: WeakSet<unknown[]>;
|
|
14
16
|
export declare let pendingEffects: unknown[];
|
|
15
|
-
export declare let pendingScopes: Scope[];
|
|
16
|
-
export declare let rendering: undefined | 0 | 1;
|
|
17
17
|
export declare function queueRender<T, U extends Scope = Scope>(scope: U, signal: Signal<T, U>, signalKey: number, value?: T, scopeKey?: number): void;
|
|
18
18
|
export declare function queuePendingRender(render: PendingRender): void;
|
|
19
19
|
export declare function queueEffect<S extends Scope, T extends ExecFn<S>>(scope: S, fn: T): void;
|
package/dist/dom/scope.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { AccessorProp, type BranchScope, type Scope } from "../common/types";
|
|
2
2
|
export declare function createScope($global: Scope[AccessorProp.Global], closestBranch?: BranchScope): Scope;
|
|
3
|
+
export declare function syncGen(scope: Scope): void;
|
|
4
|
+
export declare function _assert_init(scope: Scope, accessor: string): any;
|
|
5
|
+
export declare function collectScopes(fn: () => void): Scope[];
|
|
3
6
|
export declare function skipScope(): number;
|
|
4
7
|
export declare function findBranchWithKey(scope: Scope, key: string): BranchScope | undefined;
|
|
5
8
|
export declare function destroyBranch(branch: BranchScope): void;
|
package/dist/dom.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { attrTag, attrTags } from "./common/attr-tag";
|
|
2
|
-
export { _assert_hoist
|
|
2
|
+
export { _assert_hoist } from "./common/errors";
|
|
3
3
|
export { forIn, forOf, forTo, forUntil } from "./common/for";
|
|
4
4
|
export { _call } from "./common/helpers";
|
|
5
5
|
export { $signal, $signalReset } from "./dom/abort-signal";
|
|
@@ -12,5 +12,6 @@ export { _load_event_trigger, _load_idle_trigger, _load_media_trigger, _load_rac
|
|
|
12
12
|
export { _enable_catch, run } from "./dom/queue";
|
|
13
13
|
export { _content, _content_closures, _content_resume } from "./dom/renderer";
|
|
14
14
|
export { _el, _resume, _var_resume, init, initEmbedded, ready, } from "./dom/resume";
|
|
15
|
+
export { _assert_init } from "./dom/scope";
|
|
15
16
|
export { _child_setup, _closure, _closure_get, _const, _el_read, _for_closure, _hoist, _hoist_resume, _id, _if_closure, _let, _let_change, _or, _return, _return_change, _script, _var, _var_change, } from "./dom/signals";
|
|
16
17
|
export { _template } from "./dom/template";
|
package/dist/dom.js
CHANGED
|
@@ -4,8 +4,8 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
4
4
|
else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
|
5
5
|
else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
|
6
6
|
return str;
|
|
7
|
-
}, decodeAccessor = (num) => (num + (num < 26 ? 10 : num < 962 ? 334 : 11998)).toString(36), defaultDelegator = /* @__PURE__ */ createDelegator(), R = /[^\p{L}\p{N}]/gu, parsers = {}, nextScopeId = 1e6, destroyNestedScopes = function destroyNestedScopes(scope) {
|
|
8
|
-
scope.
|
|
7
|
+
}, decodeAccessor = (num) => (num + (num < 26 ? 10 : num < 962 ? 334 : 11998)).toString(36), defaultDelegator = /* @__PURE__ */ createDelegator(), R = /[^\p{L}\p{N}]/gu, parsers = {}, nextScopeId = 1e6, collectingScopes, destroyNestedScopes = function destroyNestedScopes(scope) {
|
|
8
|
+
scope.H = 0, scope.D?.forEach(destroyNestedScopes), scope.B?.forEach(resetControllers);
|
|
9
9
|
}, isScheduled, channel, _return = (scope, value) => scope.T?.(value), _var_change = (scope, value) => scope.U?.(value), tagIdsByGlobal = /* @__PURE__ */ new WeakMap(), walker = /* @__PURE__ */ document.createTreeWalker(document), walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
10
10
|
let value, currentMultiplier, storedMultiplier = 0, currentScopeIndex = 0;
|
|
11
11
|
for (; currentWalkIndex < walkCodes.length;) if (value = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value === 32) {
|
|
@@ -49,7 +49,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
49
49
|
};
|
|
50
50
|
}, _for_of = /* @__PURE__ */ loop(([all, by = bySecondArg], cb) => {
|
|
51
51
|
typeof by == "string" ? forOf(all, (item, i) => cb(item[by], [item, i])) : forOf(all, (item, i) => cb(by(item, i), [item, i]));
|
|
52
|
-
}), _for_in = /* @__PURE__ */ loop(([obj, by = byFirstArg], cb) => forIn(obj, (key, value) => cb(by(key, value), [key, value]))), _for_to = /* @__PURE__ */ loop(([to, from, step, by = byFirstArg], cb) => forTo(to, from, step, (v) => cb(by(v), [v]))), _for_until = /* @__PURE__ */ loop(([until, from, step, by = byFirstArg], cb) => forUntil(until, from, step, (v) => cb(by(v), [v]))),
|
|
52
|
+
}), _for_in = /* @__PURE__ */ loop(([obj, by = byFirstArg], cb) => forIn(obj, (key, value) => cb(by(key, value), [key, value]))), _for_to = /* @__PURE__ */ loop(([to, from, step, by = byFirstArg], cb) => forTo(to, from, step, (v) => cb(by(v), [v]))), _for_until = /* @__PURE__ */ loop(([until, from, step, by = byFirstArg], cb) => forUntil(until, from, step, (v) => cb(by(v), [v]))), rendering, runId = 2, caughtError = /* @__PURE__ */ new WeakSet(), placeholderShown = /* @__PURE__ */ new WeakSet(), pendingEffects = [], pendingRenders = [], scopeKeyOffset = 1e3, runEffects = ((effects) => {
|
|
53
53
|
for (let i = 0; i < effects.length;) effects[i++](effects[i++]);
|
|
54
54
|
}), runRender = (render) => render.c(render.b, render.d), catchEnabled, classIdToBranch = /* @__PURE__ */ new Map(), scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
|
|
55
55
|
let render = self[$global.runtimeId]?.[$global.renderId], scopes = render && scopesByRender.get(render);
|
|
@@ -119,9 +119,6 @@ function* attrTagIterator() {
|
|
|
119
119
|
yield this, yield* this[rest];
|
|
120
120
|
}
|
|
121
121
|
function _assert_hoist(value) {}
|
|
122
|
-
function _assert_init(scope, accessor) {
|
|
123
|
-
return scope[accessor];
|
|
124
|
-
}
|
|
125
122
|
//#endregion
|
|
126
123
|
//#region src/common/for.ts
|
|
127
124
|
function forIn(obj, cb) {
|
|
@@ -216,11 +213,26 @@ function parseHTML(html, ns) {
|
|
|
216
213
|
function createScope($global, closestBranch) {
|
|
217
214
|
let scope = {
|
|
218
215
|
L: nextScopeId++,
|
|
219
|
-
H:
|
|
216
|
+
H: runId,
|
|
220
217
|
F: closestBranch,
|
|
221
218
|
$: $global
|
|
222
219
|
};
|
|
223
|
-
return
|
|
220
|
+
return collectingScopes?.push(scope), scope;
|
|
221
|
+
}
|
|
222
|
+
function syncGen(scope) {
|
|
223
|
+
scope.H = runId;
|
|
224
|
+
}
|
|
225
|
+
function _assert_init(scope, accessor) {
|
|
226
|
+
return scope[accessor];
|
|
227
|
+
}
|
|
228
|
+
function collectScopes(fn) {
|
|
229
|
+
let prev = collectingScopes;
|
|
230
|
+
collectingScopes = [];
|
|
231
|
+
try {
|
|
232
|
+
return fn(), collectingScopes;
|
|
233
|
+
} finally {
|
|
234
|
+
collectingScopes = prev;
|
|
235
|
+
}
|
|
224
236
|
}
|
|
225
237
|
function skipScope() {
|
|
226
238
|
return nextScopeId++;
|
|
@@ -234,7 +246,7 @@ function destroyBranch(branch) {
|
|
|
234
246
|
branch.N?.D?.delete(branch), destroyNestedScopes(branch);
|
|
235
247
|
}
|
|
236
248
|
function destroyScope(scope) {
|
|
237
|
-
scope.
|
|
249
|
+
scope.H && (destroyNestedScopes(scope), resetControllers(scope));
|
|
238
250
|
}
|
|
239
251
|
function resetControllers(scope) {
|
|
240
252
|
for (let id in scope.A) $signalReset(scope, id);
|
|
@@ -266,7 +278,7 @@ function triggerMacroTask() {
|
|
|
266
278
|
//#region src/dom/signals.ts
|
|
267
279
|
function _let(id, fn) {
|
|
268
280
|
let valueAccessor = decodeAccessor(id);
|
|
269
|
-
return (scope, value) => (rendering ? scope.H && (scope[valueAccessor] = value, fn?.(scope)) : (scope[valueAccessor] !== value || !(valueAccessor in scope)) && (scope[valueAccessor] = value, fn) && (schedule(), queueRender(scope, fn, id)), value);
|
|
281
|
+
return (scope, value) => (rendering ? scope.H === runId && (scope[valueAccessor] = value, fn?.(scope)) : (scope[valueAccessor] !== value || !(valueAccessor in scope)) && (scope[valueAccessor] = value, fn) && (schedule(), queueRender(scope, fn, id)), value);
|
|
270
282
|
}
|
|
271
283
|
function _let_change(id, fn) {
|
|
272
284
|
let valueAccessor = decodeAccessor(id), valueChangeAccessor = "M" + valueAccessor, base = _let(id, fn);
|
|
@@ -279,7 +291,7 @@ function _const(valueAccessor, fn) {
|
|
|
279
291
|
}
|
|
280
292
|
function _or(id, fn, defaultPending = 1, scopeIdAccessor = "L") {
|
|
281
293
|
return scopeIdAccessor !== "L" && (scopeIdAccessor = decodeAccessor(scopeIdAccessor)), (scope) => {
|
|
282
|
-
scope.H ? id in scope ? --scope[id] || fn(scope) : scope[id] = defaultPending : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
|
294
|
+
scope.H === runId ? id in scope ? --scope[id] || fn(scope) : scope[id] = defaultPending : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
|
283
295
|
};
|
|
284
296
|
}
|
|
285
297
|
function _for_closure(ownerLoopNodeAccessor, fn) {
|
|
@@ -287,7 +299,7 @@ function _for_closure(ownerLoopNodeAccessor, fn) {
|
|
|
287
299
|
let scopeAccessor = "A" + ownerLoopNodeAccessor, ownerSignal = (ownerScope) => {
|
|
288
300
|
let scopes = toArray(ownerScope[scopeAccessor]);
|
|
289
301
|
scopes.length && queueRender(ownerScope, () => {
|
|
290
|
-
for (let scope of scopes)
|
|
302
|
+
for (let scope of scopes) scope.H > 0 && scope.H < runId && fn(scope);
|
|
291
303
|
}, -1, 0, scopes[0].L);
|
|
292
304
|
};
|
|
293
305
|
return ownerSignal._ = fn, ownerSignal;
|
|
@@ -296,7 +308,7 @@ function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
|
|
|
296
308
|
ownerConditionalNodeAccessor = decodeAccessor(ownerConditionalNodeAccessor);
|
|
297
309
|
let scopeAccessor = "A" + ownerConditionalNodeAccessor, branchAccessor = "D" + ownerConditionalNodeAccessor, ownerSignal = (scope) => {
|
|
298
310
|
let ifScope = scope[scopeAccessor];
|
|
299
|
-
ifScope &&
|
|
311
|
+
ifScope && ifScope.H > 0 && ifScope.H < runId && (scope[branchAccessor] || 0) === branch && queueRender(ifScope, fn, -1);
|
|
300
312
|
};
|
|
301
313
|
return ownerSignal._ = fn, ownerSignal;
|
|
302
314
|
}
|
|
@@ -308,7 +320,7 @@ function _closure(...closureSignals) {
|
|
|
308
320
|
let [firstSignal] = closureSignals, scopeInstances = firstSignal.a, signalIndex = firstSignal.b;
|
|
309
321
|
for (let i = closureSignals.length; i--;) closureSignals[i].c = i;
|
|
310
322
|
return (scope) => {
|
|
311
|
-
if (scope[scopeInstances]) for (let childScope of scope[scopeInstances]) childScope.H
|
|
323
|
+
if (scope[scopeInstances]) for (let childScope of scope[scopeInstances]) childScope.H > 0 && childScope.H < runId && queueRender(childScope, closureSignals[childScope[signalIndex] || 0], -1);
|
|
312
324
|
};
|
|
313
325
|
}
|
|
314
326
|
function _closure_get(valueAccessor, fn, getOwnerScope, resumeId) {
|
|
@@ -440,7 +452,7 @@ function init(runtimeId = "M") {
|
|
|
440
452
|
let render = curRenders[renderId] = renders[renderId] || renders(renderId), walk = render.w, scopeLookup = {}, getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { L: +id }) : initGlobal()), initGlobal = () => scopeLookup[0] ||= {
|
|
441
453
|
runtimeId,
|
|
442
454
|
renderId
|
|
443
|
-
}, initScope = (scope) => (scope.$ = initGlobal(), branchesEnabled && scope.G && (scope.F = getScope(scope.G)), scope), applyScopes = (partials) => {
|
|
455
|
+
}, initScope = (scope) => (scope.H = 1, scope.$ = initGlobal(), branchesEnabled && scope.G && (scope.F = getScope(scope.G)), scope), applyScopes = (partials) => {
|
|
444
456
|
let scopeId = partials[0];
|
|
445
457
|
for (let i = 1; i < partials.length; i++) {
|
|
446
458
|
let partial = partials[i];
|
|
@@ -527,13 +539,13 @@ function _el(id, accessor) {
|
|
|
527
539
|
function _attr_input_checked_default(scope, nodeAccessor, checked) {
|
|
528
540
|
let el = scope[nodeAccessor], normalizedChecked = isNotVoid(checked);
|
|
529
541
|
if (el.defaultChecked !== normalizedChecked) {
|
|
530
|
-
let restoreValue = scope.H
|
|
542
|
+
let restoreValue = scope.H < runId ? el.checked : normalizedChecked;
|
|
531
543
|
el.defaultChecked = normalizedChecked, restoreValue !== normalizedChecked && (el.checked = restoreValue);
|
|
532
544
|
}
|
|
533
545
|
}
|
|
534
546
|
function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
|
|
535
547
|
let el = scope[nodeAccessor], normalizedChecked = isNotVoid(checked);
|
|
536
|
-
scope["E" + nodeAccessor] = checkedChange, scope["F" + nodeAccessor] = checkedChange ? 0 : 5, checkedChange &&
|
|
548
|
+
scope["E" + nodeAccessor] = checkedChange, scope["F" + nodeAccessor] = checkedChange ? 0 : 5, checkedChange && scope.H < runId ? el.checked = normalizedChecked : _attr_input_checked_default(scope, nodeAccessor, normalizedChecked);
|
|
537
549
|
}
|
|
538
550
|
function _attr_input_checked_script(scope, nodeAccessor) {
|
|
539
551
|
let el = scope[nodeAccessor];
|
|
@@ -551,7 +563,7 @@ function _attr_input_checkedValue_default(scope, nodeAccessor, checkedValue, val
|
|
|
551
563
|
}
|
|
552
564
|
function _attr_input_checkedValue(scope, nodeAccessor, checkedValue, checkedValueChange, value) {
|
|
553
565
|
let el = scope[nodeAccessor], multiple = Array.isArray(checkedValue), normalizedCheckedValue = scope["G" + nodeAccessor] = multiple ? checkedValue.map(normalizeStrProp) : normalizeStrProp(checkedValue);
|
|
554
|
-
scope["E" + nodeAccessor] = checkedValueChange, scope["F" + nodeAccessor] = checkedValueChange ? 1 : 5, checkedValueChange &&
|
|
566
|
+
scope["E" + nodeAccessor] = checkedValueChange, scope["F" + nodeAccessor] = checkedValueChange ? 1 : 5, checkedValueChange && scope.H < runId ? (el.checked = multiple ? normalizedCheckedValue.includes(normalizeStrProp(value)) : normalizeStrProp(value) === normalizedCheckedValue, _attr(el, "value", value)) : _attr_input_checkedValue_default(scope, nodeAccessor, checkedValue, value);
|
|
555
567
|
}
|
|
556
568
|
function _attr_input_checkedValue_script(scope, nodeAccessor) {
|
|
557
569
|
let el = scope[nodeAccessor];
|
|
@@ -568,13 +580,13 @@ function _attr_input_checkedValue_script(scope, nodeAccessor) {
|
|
|
568
580
|
function _attr_input_value_default(scope, nodeAccessor, value) {
|
|
569
581
|
let el = scope[nodeAccessor], normalizedValue = normalizeAttrValue(value) || "";
|
|
570
582
|
if (el.defaultValue !== normalizedValue) {
|
|
571
|
-
let restoreValue = scope.H
|
|
583
|
+
let restoreValue = scope.H < runId ? el.value : normalizedValue;
|
|
572
584
|
el.defaultValue = normalizedValue, setInputValue(el, restoreValue);
|
|
573
585
|
}
|
|
574
586
|
}
|
|
575
587
|
function _attr_input_value(scope, nodeAccessor, value, valueChange) {
|
|
576
588
|
let el = scope[nodeAccessor], normalizedValue = normalizeAttrValue(value) || "";
|
|
577
|
-
scope["E" + nodeAccessor] = valueChange, scope["G" + nodeAccessor] = normalizedValue, scope["F" + nodeAccessor] = valueChange ? 2 : 5, valueChange &&
|
|
589
|
+
scope["E" + nodeAccessor] = valueChange, scope["G" + nodeAccessor] = normalizedValue, scope["F" + nodeAccessor] = valueChange ? 2 : 5, valueChange && scope.H < runId ? setInputValue(el, normalizedValue) : _attr_input_value_default(scope, nodeAccessor, normalizedValue);
|
|
578
590
|
}
|
|
579
591
|
function _attr_input_value_script(scope, nodeAccessor) {
|
|
580
592
|
let el = scope[nodeAccessor];
|
|
@@ -590,17 +602,17 @@ function setInputValue(el, value) {
|
|
|
590
602
|
}
|
|
591
603
|
}
|
|
592
604
|
function _attr_select_value_default(scope, nodeAccessor, value) {
|
|
593
|
-
let restoreValue, el = scope[nodeAccessor],
|
|
605
|
+
let restoreValue, el = scope[nodeAccessor], live = scope.H < runId, multiple = Array.isArray(value), normalizedValue = multiple ? value.map(normalizeStrProp) : normalizeStrProp(value);
|
|
594
606
|
pendingEffects.unshift(() => {
|
|
595
607
|
for (let opt of el.options) {
|
|
596
608
|
let selected = multiple ? normalizedValue.includes(opt.value) : opt.value === normalizedValue;
|
|
597
|
-
opt.defaultSelected !== selected && (
|
|
609
|
+
opt.defaultSelected !== selected && (live && (restoreValue ??= getSelectValue(el, multiple)), opt.defaultSelected = selected);
|
|
598
610
|
}
|
|
599
611
|
restoreValue !== void 0 && setSelectValue(el, restoreValue, multiple);
|
|
600
612
|
}, scope);
|
|
601
613
|
}
|
|
602
614
|
function _attr_select_value(scope, nodeAccessor, value, valueChange) {
|
|
603
|
-
let el = scope[nodeAccessor], existing =
|
|
615
|
+
let el = scope[nodeAccessor], existing = scope.H < runId, multiple = Array.isArray(value), normalizedValue = scope["G" + nodeAccessor] = multiple ? value.map(normalizeStrProp) : normalizeStrProp(value);
|
|
604
616
|
scope["E" + nodeAccessor] = valueChange, scope["F" + nodeAccessor] = valueChange ? 3 : 5, valueChange && existing ? pendingEffects.unshift(() => setSelectValue(el, normalizedValue, multiple), scope) : _attr_select_value_default(scope, nodeAccessor, normalizedValue);
|
|
605
617
|
}
|
|
606
618
|
function _attr_select_value_script(scope, nodeAccessor) {
|
|
@@ -637,11 +649,11 @@ function getSelectValue(el, multiple) {
|
|
|
637
649
|
return multiple ? Array.from(el.selectedOptions, (opt) => opt.value) : el.value;
|
|
638
650
|
}
|
|
639
651
|
function _attr_details_or_dialog_open_default(scope, nodeAccessor, open) {
|
|
640
|
-
scope.H && (scope[nodeAccessor].open = isNotVoid(open));
|
|
652
|
+
scope.H === runId && (scope[nodeAccessor].open = isNotVoid(open));
|
|
641
653
|
}
|
|
642
654
|
function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
|
|
643
655
|
let normalizedOpen = scope["G" + nodeAccessor] = isNotVoid(open);
|
|
644
|
-
scope["E" + nodeAccessor] = openChange, scope["F" + nodeAccessor] = openChange ? 4 : 5, openChange &&
|
|
656
|
+
scope["E" + nodeAccessor] = openChange, scope["F" + nodeAccessor] = openChange ? 4 : 5, openChange && scope.H < runId ? scope[nodeAccessor].open = normalizedOpen : _attr_details_or_dialog_open_default(scope, nodeAccessor, normalizedOpen);
|
|
645
657
|
}
|
|
646
658
|
function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
|
|
647
659
|
let el = scope[nodeAccessor];
|
|
@@ -873,7 +885,7 @@ function _await_promise(nodeAccessor, params) {
|
|
|
873
885
|
if (thisPromise === scope[promiseAccessor]) {
|
|
874
886
|
let referenceNode = scope[nodeAccessor];
|
|
875
887
|
scope[promiseAccessor] = 0, queueAsyncRender(scope, () => {
|
|
876
|
-
(awaitBranch = scope[branchAccessor]).V && (
|
|
888
|
+
(awaitBranch = scope[branchAccessor]).V && (awaitBranch.Y = awaitBranch.Y?.forEach(syncGen), setupBranch(awaitBranch.V, awaitBranch), awaitBranch.V = 0, insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]), referenceNode.remove()), params?.(awaitBranch, [data]);
|
|
877
889
|
let pendingRenders = awaitBranch.W;
|
|
878
890
|
if (awaitBranch.W = 0, pendingRenders?.forEach(queuePendingRender), placeholderShown.add(pendingEffects), awaitCounter.c(), awaitCounter.m) {
|
|
879
891
|
let fnScopes = /* @__PURE__ */ new Map(), effects = awaitCounter.m([]);
|
|
@@ -897,7 +909,8 @@ function _await_content(nodeAccessor, template, walks, setup) {
|
|
|
897
909
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
898
910
|
let branchAccessor = "A" + nodeAccessor, renderer = _content("", template, walks, setup)();
|
|
899
911
|
return (scope) => {
|
|
900
|
-
(scope[branchAccessor] = createBranch(scope.$, renderer, scope, scope[nodeAccessor].parentNode)).V = renderer
|
|
912
|
+
let pendingScopes = collectScopes(() => (scope[branchAccessor] = createBranch(scope.$, renderer, scope, scope[nodeAccessor].parentNode)).V = renderer);
|
|
913
|
+
scope[branchAccessor].Y = pendingScopes;
|
|
901
914
|
};
|
|
902
915
|
}
|
|
903
916
|
function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, "Q")) {
|
|
@@ -1069,12 +1082,10 @@ function runRenders() {
|
|
|
1069
1082
|
}
|
|
1070
1083
|
runRender(render);
|
|
1071
1084
|
}
|
|
1072
|
-
for (let scope of pendingScopes) scope.H = 0;
|
|
1073
|
-
pendingScopes = [];
|
|
1074
1085
|
}
|
|
1075
1086
|
function skipDestroyedRenders() {
|
|
1076
1087
|
runRender = ((runRender) => (render) => {
|
|
1077
|
-
render.b.F?.
|
|
1088
|
+
render.b.F?.H !== 0 && runRender(render);
|
|
1078
1089
|
})(runRender);
|
|
1079
1090
|
}
|
|
1080
1091
|
function _enable_catch() {
|
|
@@ -1089,7 +1100,7 @@ function _enable_catch() {
|
|
|
1089
1100
|
runEffects = ((runEffects) => (effects, checkPending = placeholderShown.has(effects)) => {
|
|
1090
1101
|
if (checkPending || caughtError.has(effects)) {
|
|
1091
1102
|
let i = 0, fn, scope, branch;
|
|
1092
|
-
for (; i < effects.length;) fn = effects[i++], scope = effects[i++], branch = scope.F
|
|
1103
|
+
for (; i < effects.length;) fn = effects[i++], scope = effects[i++], (branch = scope.F)?.H !== 0 && !(checkPending && handlePendingTry(fn, scope, branch)) && fn(scope);
|
|
1093
1104
|
} else runEffects(effects);
|
|
1094
1105
|
})(runEffects), runRender = ((runRender) => (render) => {
|
|
1095
1106
|
try {
|
|
@@ -1193,8 +1204,8 @@ function _load_setup(nodeAccessor, childScopeAccessor, load) {
|
|
|
1193
1204
|
}
|
|
1194
1205
|
function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
1195
1206
|
let parent = marker.parentNode;
|
|
1196
|
-
branch
|
|
1197
|
-
insertBranchBefore(branch, parent, marker), marker.remove(),
|
|
1207
|
+
syncGen(branch), renderer.b(branch, parent.namespaceURI), setupBranch(renderer, branch), applyLoad(branch, () => {
|
|
1208
|
+
insertBranchBefore(branch, parent, marker), marker.remove(), awaitCounter?.c();
|
|
1198
1209
|
});
|
|
1199
1210
|
}
|
|
1200
1211
|
function loadFailed(scope, awaitCounter) {
|
|
@@ -1205,16 +1216,16 @@ function loadFailed(scope, awaitCounter) {
|
|
|
1205
1216
|
function applyLoad(scope, insert) {
|
|
1206
1217
|
let values = scope.X, remaining;
|
|
1207
1218
|
if (scope.X = 0, remaining = values?.size) for (let [promise, entry] of values) promise.then((signal) => {
|
|
1208
|
-
entry.b = signal, --remaining ||
|
|
1209
|
-
values.forEach((e) => e.b._(scope, e.a)), insert();
|
|
1210
|
-
})
|
|
1219
|
+
entry.b = signal, --remaining || queueAsyncRender(scope, (scope) => {
|
|
1220
|
+
syncGen(scope), values.forEach((e) => e.b._(scope, e.a)), insert();
|
|
1221
|
+
});
|
|
1211
1222
|
}, () => 0);
|
|
1212
1223
|
else insert();
|
|
1213
1224
|
}
|
|
1214
1225
|
function _load_signal(load) {
|
|
1215
1226
|
let pending, signal;
|
|
1216
1227
|
return (scope, value) => {
|
|
1217
|
-
pending ||= load(), scope.X || !("X" in scope) && scope.H ? (scope.X ||= /* @__PURE__ */ new Map()).set(pending, { a: value }) : signal ? signal(scope, value) : pending.then((mod) => queueAsyncRender(scope, signal = mod._, value), () => 0);
|
|
1228
|
+
pending ||= load(), scope.X || !("X" in scope) && scope.H === runId ? (scope.X ||= /* @__PURE__ */ new Map()).set(pending, { a: value }) : signal ? signal(scope, value) : pending.then((mod) => queueAsyncRender(scope, signal = mod._, value), () => 0);
|
|
1218
1229
|
};
|
|
1219
1230
|
}
|
|
1220
1231
|
function _load_visible_trigger(selector, options) {
|