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/dom.mjs
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);
|
|
@@ -118,9 +118,6 @@ function* attrTagIterator() {
|
|
|
118
118
|
yield this, yield* this[rest];
|
|
119
119
|
}
|
|
120
120
|
function _assert_hoist(value) {}
|
|
121
|
-
function _assert_init(scope, accessor) {
|
|
122
|
-
return scope[accessor];
|
|
123
|
-
}
|
|
124
121
|
//#endregion
|
|
125
122
|
//#region src/common/for.ts
|
|
126
123
|
function forIn(obj, cb) {
|
|
@@ -215,11 +212,26 @@ function parseHTML(html, ns) {
|
|
|
215
212
|
function createScope($global, closestBranch) {
|
|
216
213
|
let scope = {
|
|
217
214
|
L: nextScopeId++,
|
|
218
|
-
H:
|
|
215
|
+
H: runId,
|
|
219
216
|
F: closestBranch,
|
|
220
217
|
$: $global
|
|
221
218
|
};
|
|
222
|
-
return
|
|
219
|
+
return collectingScopes?.push(scope), scope;
|
|
220
|
+
}
|
|
221
|
+
function syncGen(scope) {
|
|
222
|
+
scope.H = runId;
|
|
223
|
+
}
|
|
224
|
+
function _assert_init(scope, accessor) {
|
|
225
|
+
return scope[accessor];
|
|
226
|
+
}
|
|
227
|
+
function collectScopes(fn) {
|
|
228
|
+
let prev = collectingScopes;
|
|
229
|
+
collectingScopes = [];
|
|
230
|
+
try {
|
|
231
|
+
return fn(), collectingScopes;
|
|
232
|
+
} finally {
|
|
233
|
+
collectingScopes = prev;
|
|
234
|
+
}
|
|
223
235
|
}
|
|
224
236
|
function skipScope() {
|
|
225
237
|
return nextScopeId++;
|
|
@@ -233,7 +245,7 @@ function destroyBranch(branch) {
|
|
|
233
245
|
branch.N?.D?.delete(branch), destroyNestedScopes(branch);
|
|
234
246
|
}
|
|
235
247
|
function destroyScope(scope) {
|
|
236
|
-
scope.
|
|
248
|
+
scope.H && (destroyNestedScopes(scope), resetControllers(scope));
|
|
237
249
|
}
|
|
238
250
|
function resetControllers(scope) {
|
|
239
251
|
for (let id in scope.A) $signalReset(scope, id);
|
|
@@ -265,7 +277,7 @@ function triggerMacroTask() {
|
|
|
265
277
|
//#region src/dom/signals.ts
|
|
266
278
|
function _let(id, fn) {
|
|
267
279
|
let valueAccessor = decodeAccessor(id);
|
|
268
|
-
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);
|
|
280
|
+
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);
|
|
269
281
|
}
|
|
270
282
|
function _let_change(id, fn) {
|
|
271
283
|
let valueAccessor = decodeAccessor(id), valueChangeAccessor = "M" + valueAccessor, base = _let(id, fn);
|
|
@@ -278,7 +290,7 @@ function _const(valueAccessor, fn) {
|
|
|
278
290
|
}
|
|
279
291
|
function _or(id, fn, defaultPending = 1, scopeIdAccessor = "L") {
|
|
280
292
|
return scopeIdAccessor !== "L" && (scopeIdAccessor = decodeAccessor(scopeIdAccessor)), (scope) => {
|
|
281
|
-
scope.H ? id in scope ? --scope[id] || fn(scope) : scope[id] = defaultPending : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
|
293
|
+
scope.H === runId ? id in scope ? --scope[id] || fn(scope) : scope[id] = defaultPending : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
|
282
294
|
};
|
|
283
295
|
}
|
|
284
296
|
function _for_closure(ownerLoopNodeAccessor, fn) {
|
|
@@ -286,7 +298,7 @@ function _for_closure(ownerLoopNodeAccessor, fn) {
|
|
|
286
298
|
let scopeAccessor = "A" + ownerLoopNodeAccessor, ownerSignal = (ownerScope) => {
|
|
287
299
|
let scopes = toArray(ownerScope[scopeAccessor]);
|
|
288
300
|
scopes.length && queueRender(ownerScope, () => {
|
|
289
|
-
for (let scope of scopes)
|
|
301
|
+
for (let scope of scopes) scope.H > 0 && scope.H < runId && fn(scope);
|
|
290
302
|
}, -1, 0, scopes[0].L);
|
|
291
303
|
};
|
|
292
304
|
return ownerSignal._ = fn, ownerSignal;
|
|
@@ -295,7 +307,7 @@ function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
|
|
|
295
307
|
ownerConditionalNodeAccessor = decodeAccessor(ownerConditionalNodeAccessor);
|
|
296
308
|
let scopeAccessor = "A" + ownerConditionalNodeAccessor, branchAccessor = "D" + ownerConditionalNodeAccessor, ownerSignal = (scope) => {
|
|
297
309
|
let ifScope = scope[scopeAccessor];
|
|
298
|
-
ifScope &&
|
|
310
|
+
ifScope && ifScope.H > 0 && ifScope.H < runId && (scope[branchAccessor] || 0) === branch && queueRender(ifScope, fn, -1);
|
|
299
311
|
};
|
|
300
312
|
return ownerSignal._ = fn, ownerSignal;
|
|
301
313
|
}
|
|
@@ -307,7 +319,7 @@ function _closure(...closureSignals) {
|
|
|
307
319
|
let [firstSignal] = closureSignals, scopeInstances = firstSignal.a, signalIndex = firstSignal.b;
|
|
308
320
|
for (let i = closureSignals.length; i--;) closureSignals[i].c = i;
|
|
309
321
|
return (scope) => {
|
|
310
|
-
if (scope[scopeInstances]) for (let childScope of scope[scopeInstances]) childScope.H
|
|
322
|
+
if (scope[scopeInstances]) for (let childScope of scope[scopeInstances]) childScope.H > 0 && childScope.H < runId && queueRender(childScope, closureSignals[childScope[signalIndex] || 0], -1);
|
|
311
323
|
};
|
|
312
324
|
}
|
|
313
325
|
function _closure_get(valueAccessor, fn, getOwnerScope, resumeId) {
|
|
@@ -439,7 +451,7 @@ function init(runtimeId = "M") {
|
|
|
439
451
|
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] ||= {
|
|
440
452
|
runtimeId,
|
|
441
453
|
renderId
|
|
442
|
-
}, initScope = (scope) => (scope.$ = initGlobal(), branchesEnabled && scope.G && (scope.F = getScope(scope.G)), scope), applyScopes = (partials) => {
|
|
454
|
+
}, initScope = (scope) => (scope.H = 1, scope.$ = initGlobal(), branchesEnabled && scope.G && (scope.F = getScope(scope.G)), scope), applyScopes = (partials) => {
|
|
443
455
|
let scopeId = partials[0];
|
|
444
456
|
for (let i = 1; i < partials.length; i++) {
|
|
445
457
|
let partial = partials[i];
|
|
@@ -526,13 +538,13 @@ function _el(id, accessor) {
|
|
|
526
538
|
function _attr_input_checked_default(scope, nodeAccessor, checked) {
|
|
527
539
|
let el = scope[nodeAccessor], normalizedChecked = isNotVoid(checked);
|
|
528
540
|
if (el.defaultChecked !== normalizedChecked) {
|
|
529
|
-
let restoreValue = scope.H
|
|
541
|
+
let restoreValue = scope.H < runId ? el.checked : normalizedChecked;
|
|
530
542
|
el.defaultChecked = normalizedChecked, restoreValue !== normalizedChecked && (el.checked = restoreValue);
|
|
531
543
|
}
|
|
532
544
|
}
|
|
533
545
|
function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
|
|
534
546
|
let el = scope[nodeAccessor], normalizedChecked = isNotVoid(checked);
|
|
535
|
-
scope["E" + nodeAccessor] = checkedChange, scope["F" + nodeAccessor] = checkedChange ? 0 : 5, checkedChange &&
|
|
547
|
+
scope["E" + nodeAccessor] = checkedChange, scope["F" + nodeAccessor] = checkedChange ? 0 : 5, checkedChange && scope.H < runId ? el.checked = normalizedChecked : _attr_input_checked_default(scope, nodeAccessor, normalizedChecked);
|
|
536
548
|
}
|
|
537
549
|
function _attr_input_checked_script(scope, nodeAccessor) {
|
|
538
550
|
let el = scope[nodeAccessor];
|
|
@@ -550,7 +562,7 @@ function _attr_input_checkedValue_default(scope, nodeAccessor, checkedValue, val
|
|
|
550
562
|
}
|
|
551
563
|
function _attr_input_checkedValue(scope, nodeAccessor, checkedValue, checkedValueChange, value) {
|
|
552
564
|
let el = scope[nodeAccessor], multiple = Array.isArray(checkedValue), normalizedCheckedValue = scope["G" + nodeAccessor] = multiple ? checkedValue.map(normalizeStrProp) : normalizeStrProp(checkedValue);
|
|
553
|
-
scope["E" + nodeAccessor] = checkedValueChange, scope["F" + nodeAccessor] = checkedValueChange ? 1 : 5, checkedValueChange &&
|
|
565
|
+
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);
|
|
554
566
|
}
|
|
555
567
|
function _attr_input_checkedValue_script(scope, nodeAccessor) {
|
|
556
568
|
let el = scope[nodeAccessor];
|
|
@@ -567,13 +579,13 @@ function _attr_input_checkedValue_script(scope, nodeAccessor) {
|
|
|
567
579
|
function _attr_input_value_default(scope, nodeAccessor, value) {
|
|
568
580
|
let el = scope[nodeAccessor], normalizedValue = normalizeAttrValue(value) || "";
|
|
569
581
|
if (el.defaultValue !== normalizedValue) {
|
|
570
|
-
let restoreValue = scope.H
|
|
582
|
+
let restoreValue = scope.H < runId ? el.value : normalizedValue;
|
|
571
583
|
el.defaultValue = normalizedValue, setInputValue(el, restoreValue);
|
|
572
584
|
}
|
|
573
585
|
}
|
|
574
586
|
function _attr_input_value(scope, nodeAccessor, value, valueChange) {
|
|
575
587
|
let el = scope[nodeAccessor], normalizedValue = normalizeAttrValue(value) || "";
|
|
576
|
-
scope["E" + nodeAccessor] = valueChange, scope["G" + nodeAccessor] = normalizedValue, scope["F" + nodeAccessor] = valueChange ? 2 : 5, valueChange &&
|
|
588
|
+
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);
|
|
577
589
|
}
|
|
578
590
|
function _attr_input_value_script(scope, nodeAccessor) {
|
|
579
591
|
let el = scope[nodeAccessor];
|
|
@@ -589,17 +601,17 @@ function setInputValue(el, value) {
|
|
|
589
601
|
}
|
|
590
602
|
}
|
|
591
603
|
function _attr_select_value_default(scope, nodeAccessor, value) {
|
|
592
|
-
let restoreValue, el = scope[nodeAccessor],
|
|
604
|
+
let restoreValue, el = scope[nodeAccessor], live = scope.H < runId, multiple = Array.isArray(value), normalizedValue = multiple ? value.map(normalizeStrProp) : normalizeStrProp(value);
|
|
593
605
|
pendingEffects.unshift(() => {
|
|
594
606
|
for (let opt of el.options) {
|
|
595
607
|
let selected = multiple ? normalizedValue.includes(opt.value) : opt.value === normalizedValue;
|
|
596
|
-
opt.defaultSelected !== selected && (
|
|
608
|
+
opt.defaultSelected !== selected && (live && (restoreValue ??= getSelectValue(el, multiple)), opt.defaultSelected = selected);
|
|
597
609
|
}
|
|
598
610
|
restoreValue !== void 0 && setSelectValue(el, restoreValue, multiple);
|
|
599
611
|
}, scope);
|
|
600
612
|
}
|
|
601
613
|
function _attr_select_value(scope, nodeAccessor, value, valueChange) {
|
|
602
|
-
let el = scope[nodeAccessor], existing =
|
|
614
|
+
let el = scope[nodeAccessor], existing = scope.H < runId, multiple = Array.isArray(value), normalizedValue = scope["G" + nodeAccessor] = multiple ? value.map(normalizeStrProp) : normalizeStrProp(value);
|
|
603
615
|
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);
|
|
604
616
|
}
|
|
605
617
|
function _attr_select_value_script(scope, nodeAccessor) {
|
|
@@ -636,11 +648,11 @@ function getSelectValue(el, multiple) {
|
|
|
636
648
|
return multiple ? Array.from(el.selectedOptions, (opt) => opt.value) : el.value;
|
|
637
649
|
}
|
|
638
650
|
function _attr_details_or_dialog_open_default(scope, nodeAccessor, open) {
|
|
639
|
-
scope.H && (scope[nodeAccessor].open = isNotVoid(open));
|
|
651
|
+
scope.H === runId && (scope[nodeAccessor].open = isNotVoid(open));
|
|
640
652
|
}
|
|
641
653
|
function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
|
|
642
654
|
let normalizedOpen = scope["G" + nodeAccessor] = isNotVoid(open);
|
|
643
|
-
scope["E" + nodeAccessor] = openChange, scope["F" + nodeAccessor] = openChange ? 4 : 5, openChange &&
|
|
655
|
+
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);
|
|
644
656
|
}
|
|
645
657
|
function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
|
|
646
658
|
let el = scope[nodeAccessor];
|
|
@@ -872,7 +884,7 @@ function _await_promise(nodeAccessor, params) {
|
|
|
872
884
|
if (thisPromise === scope[promiseAccessor]) {
|
|
873
885
|
let referenceNode = scope[nodeAccessor];
|
|
874
886
|
scope[promiseAccessor] = 0, queueAsyncRender(scope, () => {
|
|
875
|
-
(awaitBranch = scope[branchAccessor]).V && (
|
|
887
|
+
(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]);
|
|
876
888
|
let pendingRenders = awaitBranch.W;
|
|
877
889
|
if (awaitBranch.W = 0, pendingRenders?.forEach(queuePendingRender), placeholderShown.add(pendingEffects), awaitCounter.c(), awaitCounter.m) {
|
|
878
890
|
let fnScopes = /* @__PURE__ */ new Map(), effects = awaitCounter.m([]);
|
|
@@ -896,7 +908,8 @@ function _await_content(nodeAccessor, template, walks, setup) {
|
|
|
896
908
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
897
909
|
let branchAccessor = "A" + nodeAccessor, renderer = _content("", template, walks, setup)();
|
|
898
910
|
return (scope) => {
|
|
899
|
-
(scope[branchAccessor] = createBranch(scope.$, renderer, scope, scope[nodeAccessor].parentNode)).V = renderer
|
|
911
|
+
let pendingScopes = collectScopes(() => (scope[branchAccessor] = createBranch(scope.$, renderer, scope, scope[nodeAccessor].parentNode)).V = renderer);
|
|
912
|
+
scope[branchAccessor].Y = pendingScopes;
|
|
900
913
|
};
|
|
901
914
|
}
|
|
902
915
|
function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, "Q")) {
|
|
@@ -1068,12 +1081,10 @@ function runRenders() {
|
|
|
1068
1081
|
}
|
|
1069
1082
|
runRender(render);
|
|
1070
1083
|
}
|
|
1071
|
-
for (let scope of pendingScopes) scope.H = 0;
|
|
1072
|
-
pendingScopes = [];
|
|
1073
1084
|
}
|
|
1074
1085
|
function skipDestroyedRenders() {
|
|
1075
1086
|
runRender = ((runRender) => (render) => {
|
|
1076
|
-
render.b.F?.
|
|
1087
|
+
render.b.F?.H !== 0 && runRender(render);
|
|
1077
1088
|
})(runRender);
|
|
1078
1089
|
}
|
|
1079
1090
|
function _enable_catch() {
|
|
@@ -1088,7 +1099,7 @@ function _enable_catch() {
|
|
|
1088
1099
|
runEffects = ((runEffects) => (effects, checkPending = placeholderShown.has(effects)) => {
|
|
1089
1100
|
if (checkPending || caughtError.has(effects)) {
|
|
1090
1101
|
let i = 0, fn, scope, branch;
|
|
1091
|
-
for (; i < effects.length;) fn = effects[i++], scope = effects[i++], branch = scope.F
|
|
1102
|
+
for (; i < effects.length;) fn = effects[i++], scope = effects[i++], (branch = scope.F)?.H !== 0 && !(checkPending && handlePendingTry(fn, scope, branch)) && fn(scope);
|
|
1092
1103
|
} else runEffects(effects);
|
|
1093
1104
|
})(runEffects), runRender = ((runRender) => (render) => {
|
|
1094
1105
|
try {
|
|
@@ -1192,8 +1203,8 @@ function _load_setup(nodeAccessor, childScopeAccessor, load) {
|
|
|
1192
1203
|
}
|
|
1193
1204
|
function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
1194
1205
|
let parent = marker.parentNode;
|
|
1195
|
-
branch
|
|
1196
|
-
insertBranchBefore(branch, parent, marker), marker.remove(),
|
|
1206
|
+
syncGen(branch), renderer.b(branch, parent.namespaceURI), setupBranch(renderer, branch), applyLoad(branch, () => {
|
|
1207
|
+
insertBranchBefore(branch, parent, marker), marker.remove(), awaitCounter?.c();
|
|
1197
1208
|
});
|
|
1198
1209
|
}
|
|
1199
1210
|
function loadFailed(scope, awaitCounter) {
|
|
@@ -1204,16 +1215,16 @@ function loadFailed(scope, awaitCounter) {
|
|
|
1204
1215
|
function applyLoad(scope, insert) {
|
|
1205
1216
|
let values = scope.X, remaining;
|
|
1206
1217
|
if (scope.X = 0, remaining = values?.size) for (let [promise, entry] of values) promise.then((signal) => {
|
|
1207
|
-
entry.b = signal, --remaining ||
|
|
1208
|
-
values.forEach((e) => e.b._(scope, e.a)), insert();
|
|
1209
|
-
})
|
|
1218
|
+
entry.b = signal, --remaining || queueAsyncRender(scope, (scope) => {
|
|
1219
|
+
syncGen(scope), values.forEach((e) => e.b._(scope, e.a)), insert();
|
|
1220
|
+
});
|
|
1210
1221
|
}, () => 0);
|
|
1211
1222
|
else insert();
|
|
1212
1223
|
}
|
|
1213
1224
|
function _load_signal(load) {
|
|
1214
1225
|
let pending, signal;
|
|
1215
1226
|
return (scope, value) => {
|
|
1216
|
-
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);
|
|
1227
|
+
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);
|
|
1217
1228
|
};
|
|
1218
1229
|
}
|
|
1219
1230
|
function _load_visible_trigger(selector, options) {
|
package/dist/html/writer.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export declare function getScopeById(scopeId: number | undefined): ScopeInternal
|
|
|
40
40
|
export declare function _set_serialize_reason(reason: undefined | 0 | 1): void;
|
|
41
41
|
export declare function _scope_reason(): 0 | 1 | undefined;
|
|
42
42
|
export declare function _serialize_if(condition: undefined | 1 | Record<string, 1>, key: string): 1 | undefined;
|
|
43
|
-
export declare function _serialize_guard(condition: undefined | 1 | Record<string, 1>, key: string):
|
|
43
|
+
export declare function _serialize_guard(condition: undefined | 1 | Record<string, 1>, key: string): 1 | 0;
|
|
44
44
|
export declare function _el_resume(scopeId: number, accessor: Accessor, shouldResume?: 0 | 1): string;
|
|
45
45
|
export declare function _sep(shouldResume: 0 | 1): "" | "<!>";
|
|
46
46
|
export declare function _el(scopeId: number, id: string): () => void;
|
package/dist/translator/index.js
CHANGED
|
@@ -113,8 +113,7 @@ let AccessorProp$1 = /* @__PURE__ */ function(AccessorProp) {
|
|
|
113
113
|
AccessorProp["CatchContent"] = "#CatchContent";
|
|
114
114
|
AccessorProp["ClosestBranch"] = "#ClosestBranch";
|
|
115
115
|
AccessorProp["ClosestBranchId"] = "#ClosestBranchId";
|
|
116
|
-
AccessorProp["
|
|
117
|
-
AccessorProp["Destroyed"] = "#Destroyed";
|
|
116
|
+
AccessorProp["Gen"] = "#Gen";
|
|
118
117
|
AccessorProp["DetachedAwait"] = "#DetachedAwait";
|
|
119
118
|
AccessorProp["EndNode"] = "#EndNode";
|
|
120
119
|
AccessorProp["Id"] = "#Id";
|
|
@@ -123,6 +122,7 @@ let AccessorProp$1 = /* @__PURE__ */ function(AccessorProp) {
|
|
|
123
122
|
AccessorProp["ParentBranch"] = "#ParentBranch";
|
|
124
123
|
AccessorProp["PendingEffects"] = "#PendingEffects";
|
|
125
124
|
AccessorProp["PendingRenders"] = "#PendingRenders";
|
|
125
|
+
AccessorProp["PendingScopes"] = "#PendingScopes";
|
|
126
126
|
AccessorProp["PlaceholderBranch"] = "#PlaceholderBranch";
|
|
127
127
|
AccessorProp["PlaceholderContent"] = "#PlaceholderContent";
|
|
128
128
|
AccessorProp["Renderer"] = "#Renderer";
|
|
@@ -1052,8 +1052,7 @@ let AccessorProp = /* @__PURE__ */ function(AccessorProp) {
|
|
|
1052
1052
|
AccessorProp["CatchContent"] = "E";
|
|
1053
1053
|
AccessorProp["ClosestBranch"] = "F";
|
|
1054
1054
|
AccessorProp["ClosestBranchId"] = "G";
|
|
1055
|
-
AccessorProp["
|
|
1056
|
-
AccessorProp["Destroyed"] = "I";
|
|
1055
|
+
AccessorProp["Gen"] = "H";
|
|
1057
1056
|
AccessorProp["DetachedAwait"] = "V";
|
|
1058
1057
|
AccessorProp["EndNode"] = "K";
|
|
1059
1058
|
AccessorProp["Id"] = "L";
|
|
@@ -1062,6 +1061,7 @@ let AccessorProp = /* @__PURE__ */ function(AccessorProp) {
|
|
|
1062
1061
|
AccessorProp["ParentBranch"] = "N";
|
|
1063
1062
|
AccessorProp["PendingEffects"] = "J";
|
|
1064
1063
|
AccessorProp["PendingRenders"] = "W";
|
|
1064
|
+
AccessorProp["PendingScopes"] = "Y";
|
|
1065
1065
|
AccessorProp["PlaceholderBranch"] = "P";
|
|
1066
1066
|
AccessorProp["PlaceholderContent"] = "Q";
|
|
1067
1067
|
AccessorProp["Renderer"] = "R";
|