marko 6.3.56 → 6.4.0
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/cheatsheet.md +2 -2
- package/dist/common/constants/accessor-prefix.d.ts +1 -0
- package/dist/common/constants/accessor-prefix.debug.d.ts +1 -0
- package/dist/common/constants/accessor-prop.d.ts +3 -0
- package/dist/common/constants/accessor-prop.debug.d.ts +3 -0
- package/dist/common/types.d.ts +8 -2
- package/dist/debug/dom/catch.feat.js +12 -14
- package/dist/debug/dom/catch.feat.mjs +12 -14
- package/dist/debug/dom/controllable-input.feat.js +1 -1
- package/dist/debug/dom/controllable-input.feat.mjs +1 -1
- package/dist/debug/dom/controllable-open.feat.js +1 -1
- package/dist/debug/dom/controllable-open.feat.mjs +1 -1
- package/dist/debug/dom/controllable-select.feat.js +1 -1
- package/dist/debug/dom/controllable-select.feat.mjs +1 -1
- package/dist/debug/dom/controllable-textarea.feat.js +1 -1
- package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/debug/dom/controllable.feat.js +1 -1
- package/dist/debug/dom/controllable.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/debug/dom/lazy.feat.js +4 -0
- package/dist/debug/dom/lazy.feat.mjs +4 -0
- package/dist/debug/dom/placeholder.feat.js +1 -1
- package/dist/debug/dom/placeholder.feat.mjs +1 -1
- package/dist/debug/{dom-DcwejnYg.js → dom-BRO5aArp.js} +232 -178
- package/dist/debug/{dom-BeCNT5R5.mjs → dom-Btj2QJhk.mjs} +215 -167
- package/dist/debug/dom.js +14 -12
- package/dist/debug/dom.mjs +14 -12
- package/dist/debug/html.js +603 -517
- package/dist/debug/html.mjs +602 -518
- package/dist/dom/abort-signal.d.ts +2 -0
- package/dist/dom/catch.feat.js +6 -7
- package/dist/dom/catch.feat.mjs +5 -7
- package/dist/dom/control-flow.d.ts +3 -5
- package/dist/dom/controllable-input.feat.js +3 -2
- package/dist/dom/controllable-input.feat.mjs +1 -1
- package/dist/dom/controllable-open.feat.js +3 -2
- package/dist/dom/controllable-open.feat.mjs +1 -1
- package/dist/dom/controllable-select.feat.js +3 -2
- package/dist/dom/controllable-select.feat.mjs +1 -1
- package/dist/dom/controllable-textarea.feat.js +3 -2
- package/dist/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/dom/controllable.feat.js +3 -2
- package/dist/dom/controllable.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-script.feat.js +3 -2
- package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-var.feat.js +2 -1
- package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/dom/lazy.feat.d.ts +1 -0
- package/dist/dom/lazy.feat.js +4 -0
- package/dist/dom/lazy.feat.mjs +4 -0
- package/dist/dom/load.d.ts +3 -3
- package/dist/dom/placeholder.feat.js +4 -3
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/dom/queue.d.ts +2 -4
- package/dist/dom/resume.d.ts +1 -1
- package/dist/dom/scope.d.ts +0 -1
- package/dist/{dom-BwNsIevR.mjs → dom-B-v8Gw6T.mjs} +114 -87
- package/dist/{dom-QEF0csuC.js → dom-BSsI9OPC.js} +210 -182
- package/dist/dom.js +59 -56
- package/dist/dom.mjs +34 -32
- package/dist/html/attrs.d.ts +2 -0
- package/dist/html/writer.d.ts +5 -11
- package/dist/html.d.ts +1 -1
- package/dist/html.js +362 -317
- package/dist/html.mjs +361 -317
- package/dist/translator/index.js +791 -650
- package/dist/translator/util/binding-has-prop.d.ts +2 -0
- package/dist/translator/util/entry-builder.d.ts +2 -0
- package/dist/translator/util/generate-uid.d.ts +5 -0
- package/dist/translator/util/references.d.ts +3 -2
- package/dist/translator/util/runtime.d.ts +3 -3
- package/dist/translator/util/sections.d.ts +8 -2
- package/dist/translator/util/serialize-reasons.d.ts +2 -2
- package/dist/translator/util/setup-work.d.ts +5 -0
- package/dist/translator/util/signals.d.ts +5 -7
- package/dist/translator/visitors/tag/native-tag.d.ts +1 -0
- package/package.json +3 -3
- package/dist/translator/util/setup-statements.d.ts +0 -5
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "\\3B " : "\\\\", toDelimitedString = function toDelimitedString(val, delimiter, stringify) {
|
|
2
2
|
let str = "", sep = "", part;
|
|
3
|
-
if (val)
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
if (val) {
|
|
4
|
+
if (typeof val != "object") str += val;
|
|
5
|
+
else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
|
6
|
+
else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
|
7
|
+
}
|
|
6
8
|
return str;
|
|
7
|
-
}, decodeAccessor = (num) => (num + (num < 26 ? 10 : num < 962 ? 334 : 11998)).toString(36), branchesEnabled, dynamicHtmlEnabled, rendering, runId = 2,
|
|
9
|
+
}, decodeAccessor = (num) => (num + (num < 26 ? 10 : num < 962 ? 334 : 11998)).toString(36), branchesEnabled, dynamicHtmlEnabled, rendering, runId = 2, pendingEffects = [], pendingRenders = [], runEffects = ((effects) => {
|
|
8
10
|
for (let i = 0; i < effects.length;) effects[i++](effects[i++]);
|
|
9
11
|
}), runRender = (render) => {
|
|
10
12
|
(!branchesEnabled || render.b.F?.H !== 0) && render.c(render.b, render.d);
|
|
11
13
|
}, catchEnabled, abortsEnabled, subscriptionsEnabled, delegate = (type, handler) => handler[1 + type] ||= (document.addEventListener(type, handler, !0), 1), parsers = {}, nextScopeId = 1e6, collectingScopes, destroyNestedScopes = function destroyNestedScopes(scope) {
|
|
12
14
|
scope.H = 0, scope.D?.forEach(destroyNestedScopes), scope.B?.forEach(cleanupScope);
|
|
13
|
-
}, isScheduled, channel, _return = (scope, value) => scope.T
|
|
15
|
+
}, isScheduled, channel, _return = (scope, value) => scope.T ? scope.T(value) : scope.RV = value, _var_change = (scope, value) => scope.U?.(value), tagIdsByGlobal = /* @__PURE__ */ new WeakMap(), currentNode, walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
14
16
|
let value, currentMultiplier, storedMultiplier = 0, currentScopeIndex = 0;
|
|
15
17
|
for (; currentWalkIndex < walkCodes.length;) if (value = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value === 32) scope[decodeAccessor(currentScopeIndex++)] = currentNode;
|
|
16
18
|
else if (value === 37 || value === 49) currentNode.replaceWith(currentNode = scope[decodeAccessor(currentScopeIndex++)] = new Text()), value === 49 && (scope[decodeAccessor(currentScopeIndex++)] = skipScope());
|
|
@@ -67,13 +69,15 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
|
|
|
67
69
|
if (normalizedRenderer) {
|
|
68
70
|
let childScope = scope[childScopeAccessor], args = getInput?.();
|
|
69
71
|
if (typeof normalizedRenderer == "string") (getContent ? _attrs : _attrs_content)(childScope, "a", (inputIsArgs ? args[0] : args) || {}, controllableRenders[childScope.a.tagName]), (childScope.Ia || childScope.Ea) && queueEffect(childScope, dynamicTagScript);
|
|
70
|
-
else if (normalizedRenderer.g?.(childScope), normalizedRenderer.d)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
else if (normalizedRenderer.g?.(childScope), normalizedRenderer.d) {
|
|
73
|
+
if (inputIsArgs) normalizedRenderer.d(childScope, normalizedRenderer._ ? args[0] : args);
|
|
74
|
+
else {
|
|
75
|
+
let inputWithContent = getContent ? {
|
|
76
|
+
...args,
|
|
77
|
+
content: getContent(scope)
|
|
78
|
+
} : args || {};
|
|
79
|
+
normalizedRenderer.d(childScope, normalizedRenderer._ ? inputWithContent : [inputWithContent]);
|
|
80
|
+
}
|
|
77
81
|
}
|
|
78
82
|
}
|
|
79
83
|
};
|
|
@@ -232,8 +236,8 @@ function prepareEffects(fn) {
|
|
|
232
236
|
}
|
|
233
237
|
return preparedEffects;
|
|
234
238
|
}
|
|
235
|
-
function installCatch(
|
|
236
|
-
catchEnabled = 1, withBranches(), runEffects =
|
|
239
|
+
function installCatch(catchEffects, wrapRender) {
|
|
240
|
+
catchEnabled = 1, withBranches(), runEffects = catchEffects, runRender = wrapRender(runRender);
|
|
237
241
|
}
|
|
238
242
|
function runRenders() {
|
|
239
243
|
for (; pendingRenders.length;) {
|
|
@@ -259,6 +263,10 @@ function $signalReset(scope, id) {
|
|
|
259
263
|
function $signal(scope, id) {
|
|
260
264
|
return abortsEnabled = 1, trackCleanup(scope), ((scope.A ||= {})[id] ||= new AbortController()).signal;
|
|
261
265
|
}
|
|
266
|
+
/** Runs `abort` as a destroyed scope's `$signal` would fire, without creating one. */
|
|
267
|
+
function trackAbort(scope, id, abort) {
|
|
268
|
+
abortsEnabled = 1, trackCleanup(scope), (scope.A ||= {})[id] = { abort };
|
|
269
|
+
}
|
|
262
270
|
/** Enrols `scope` with its branch so destroying the branch cleans it up. */
|
|
263
271
|
function trackCleanup(scope, subscribers) {
|
|
264
272
|
let branch = scope.F;
|
|
@@ -273,8 +281,10 @@ function toArray(opt) {
|
|
|
273
281
|
return opt ? Array.isArray(opt) ? opt : [opt] : [];
|
|
274
282
|
}
|
|
275
283
|
function forEach(opt, cb) {
|
|
276
|
-
if (opt)
|
|
277
|
-
|
|
284
|
+
if (opt) {
|
|
285
|
+
if (Array.isArray(opt)) for (let item of opt) cb(item);
|
|
286
|
+
else cb(opt);
|
|
287
|
+
}
|
|
278
288
|
}
|
|
279
289
|
function push(opt, item) {
|
|
280
290
|
return opt ? Array.isArray(opt) ? (opt.push(item), opt) : [opt, item] : item;
|
|
@@ -323,11 +333,6 @@ function collectScopes(fn) {
|
|
|
323
333
|
function skipScope() {
|
|
324
334
|
return nextScopeId++;
|
|
325
335
|
}
|
|
326
|
-
function findBranchWithKey(scope, key) {
|
|
327
|
-
let branch = scope.F;
|
|
328
|
-
for (; branch && branch[key] == null;) branch = branch.N;
|
|
329
|
-
return branch;
|
|
330
|
-
}
|
|
331
336
|
function destroyBranch(branch) {
|
|
332
337
|
branch.N?.D?.delete(branch), destroyNestedScopes(branch);
|
|
333
338
|
}
|
|
@@ -449,7 +454,7 @@ function _closure_get(valueAccessor, fn, getOwnerScope, resumeId) {
|
|
|
449
454
|
valueAccessor = decodeAccessor(valueAccessor);
|
|
450
455
|
let closureSignal = ((scope, resumed) => {
|
|
451
456
|
let ownerScope = getOwnerScope ? getOwnerScope(scope) : scope._;
|
|
452
|
-
scope[closureSignal.b] = closureSignal.c,
|
|
457
|
+
scope[closureSignal.b] = closureSignal.c, resumed ? ownerScope[closureSignal.a]._ && queueAsyncRender(scope, closureSignal) : fn(scope), subscribeToScopeSet(ownerScope, closureSignal.a, scope);
|
|
453
458
|
});
|
|
454
459
|
return closureSignal.a = valueAccessor, closureSignal.b = "C" + valueAccessor, resumeId && (_resumed[resumeId] = (scope) => closureSignal(scope, 1)), closureSignal;
|
|
455
460
|
}
|
|
@@ -459,7 +464,8 @@ function _child_setup(setup) {
|
|
|
459
464
|
}, setup;
|
|
460
465
|
}
|
|
461
466
|
function _var(scope, childAccessor, signal) {
|
|
462
|
-
scope[decodeAccessor(childAccessor)]
|
|
467
|
+
let childScope = scope[decodeAccessor(childAccessor)];
|
|
468
|
+
childScope.T = (value) => signal(scope, value), "RV" in childScope && signal(scope, childScope.RV);
|
|
463
469
|
}
|
|
464
470
|
function _return_change(scope, changeHandler) {
|
|
465
471
|
scope.U = changeHandler || void 0;
|
|
@@ -478,16 +484,18 @@ function _script(id, fn) {
|
|
|
478
484
|
};
|
|
479
485
|
}
|
|
480
486
|
function _global_read($global, key) {
|
|
481
|
-
return
|
|
487
|
+
return $global[key];
|
|
482
488
|
}
|
|
483
489
|
function _el_read(value) {
|
|
484
490
|
return value;
|
|
485
491
|
}
|
|
486
492
|
function* traverse(scope, path, args, i = path.length - 1) {
|
|
487
|
-
if (scope)
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
493
|
+
if (scope) {
|
|
494
|
+
if (Symbol.iterator in scope) for (let childScope of scope.values()) childScope.H !== 0 && (yield* traverse(childScope, path, args, i));
|
|
495
|
+
else {
|
|
496
|
+
let item = scope[path[i]];
|
|
497
|
+
i ? yield* traverse(item, path, args, i - 1) : yield typeof item == "function" ? item(...args) : item;
|
|
498
|
+
}
|
|
491
499
|
}
|
|
492
500
|
}
|
|
493
501
|
function _hoist(...path) {
|
|
@@ -512,8 +520,8 @@ function ready(readyId) {
|
|
|
512
520
|
for (let renderId in curRenders) runResumeEffects(curRenders[renderId]);
|
|
513
521
|
}
|
|
514
522
|
function readyFailed(readyId) {}
|
|
515
|
-
function withLazy(
|
|
516
|
-
|
|
523
|
+
function withLazy() {
|
|
524
|
+
lazyEnabled = 1;
|
|
517
525
|
}
|
|
518
526
|
function initEmbedded(readyId, runtimeId) {
|
|
519
527
|
embedRenders || (embedRenders = /* @__PURE__ */ new Map(), new MutationObserver(() => {
|
|
@@ -547,7 +555,7 @@ function init(runtimeId = "M") {
|
|
|
547
555
|
}
|
|
548
556
|
for (visitType !== "[" && (visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit, accessor = "A" + (nodeAccessor = lastToken), singleNode = visitType !== "]" && visitType !== ")", nextToken()); branchId = +lastToken;) {
|
|
549
557
|
if ((endedBranches ||= []).push(branch = getScope(branchId)), setParentBranch(branch, branch.F), (branch.O = render.p?.[branchId]) && (branch.O.m = render.m), singleNode) {
|
|
550
|
-
for (; startVisit.previousSibling &&
|
|
558
|
+
for (; startVisit.previousSibling && (startVisit = startVisit.previousSibling).nodeType > 1;);
|
|
551
559
|
branch._ ??= visitScope, branch.K = branch.S = startVisit, visitType === "(" && (branch.a = startVisit);
|
|
552
560
|
} else branch.C = nodeAccessor, curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, forEach(curBranchScopes, (scope) => scope._ ??= visitScope), curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
|
|
553
561
|
for (; pending.at(-1)?.L >= branchId;) adopt(pending.pop(), branch);
|
|
@@ -599,7 +607,7 @@ function init(runtimeId = "M") {
|
|
|
599
607
|
}
|
|
600
608
|
function runResumeEffects(render) {
|
|
601
609
|
try {
|
|
602
|
-
isResuming = 1, runEffects(render.m([])
|
|
610
|
+
isResuming = 1, runEffects(render.m([]));
|
|
603
611
|
} finally {
|
|
604
612
|
isResuming = 0;
|
|
605
613
|
}
|
|
@@ -771,9 +779,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
|
|
|
771
779
|
case "style":
|
|
772
780
|
_attr_style(el, value);
|
|
773
781
|
break;
|
|
774
|
-
default:
|
|
775
|
-
isEventHandler(name) ? (events ||= scope["I" + nodeAccessor] = {})[getEventHandlerName(name)] = value : skip?.test(name) || name === "content" && el.tagName !== "META" || _attr(el, name, value);
|
|
776
|
-
break;
|
|
782
|
+
default: isEventHandler(name) ? (events ||= scope["I" + nodeAccessor] = {})[getEventHandlerName(name)] = value : skip?.test(name) || name === "content" && el.tagName !== "META" || _attr(el, name, value);
|
|
777
783
|
}
|
|
778
784
|
}
|
|
779
785
|
}
|
|
@@ -795,7 +801,7 @@ function normalizeAttrValue(value) {
|
|
|
795
801
|
}
|
|
796
802
|
function _lifecycle(scope, thisObj, index = 0) {
|
|
797
803
|
let accessor = "K" + index, instance = scope[accessor];
|
|
798
|
-
instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[accessor] = thisObj, Object.assign(thisObj, thisObj.onMount?.()),
|
|
804
|
+
instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[accessor] = thisObj, Object.assign(thisObj, thisObj.onMount?.()), trackAbort(scope, accessor, () => thisObj.onDestroy?.()));
|
|
799
805
|
}
|
|
800
806
|
function removeChildNodes(startNode, endNode) {
|
|
801
807
|
let stop = endNode.nextSibling;
|
|
@@ -932,14 +938,16 @@ function _attr_select_value_script(scope, nodeAccessor) {
|
|
|
932
938
|
setSelectValue(el, oldValue, multiple), valueChange(newValue), run();
|
|
933
939
|
}
|
|
934
940
|
};
|
|
935
|
-
if (isResuming)
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
941
|
+
if (isResuming) {
|
|
942
|
+
if (el.multiple) {
|
|
943
|
+
scope["G" + nodeAccessor] = [];
|
|
944
|
+
for (let opt of el.options) opt.defaultSelected && scope["G" + nodeAccessor].push(opt.value);
|
|
945
|
+
} else {
|
|
946
|
+
scope["G" + nodeAccessor] = "";
|
|
947
|
+
for (let opt of el.options) if (opt.defaultSelected) {
|
|
948
|
+
scope["G" + nodeAccessor] = opt.value;
|
|
949
|
+
break;
|
|
950
|
+
}
|
|
943
951
|
}
|
|
944
952
|
}
|
|
945
953
|
syncControllableFormInput(el, hasSelectChanged, onChange), observeOnce(scope, nodeAccessor, {
|
|
@@ -1025,23 +1033,25 @@ function _controllable_open(scope, nodeAccessor, nextAttrs) {
|
|
|
1025
1033
|
//#region src/dom/control-flow.ts
|
|
1026
1034
|
function _await_promise(nodeAccessor, params) {
|
|
1027
1035
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
1028
|
-
let promiseAccessor = "L" + nodeAccessor, branchAccessor = "A" + nodeAccessor, resolveAwait = (scope, referenceNode, value) => {
|
|
1036
|
+
let promiseAccessor = "L" + nodeAccessor, branchAccessor = "A" + nodeAccessor, tryAccessor = "Q" + nodeAccessor, resolveAwait = (scope, referenceNode, value) => {
|
|
1029
1037
|
let awaitBranch = scope[branchAccessor];
|
|
1030
1038
|
return awaitBranch.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, [value]), awaitBranch;
|
|
1031
1039
|
}, awaitPromise = (scope, promise) => {
|
|
1032
1040
|
isPromise(scope[promiseAccessor]) || (scope[promiseAccessor] = 0);
|
|
1033
|
-
let awaitBranch = scope[branchAccessor],
|
|
1041
|
+
let awaitBranch = scope[branchAccessor], tryBranch = scope[tryAccessor] || isPromise(promise) && findTryWithPlaceholder(scope) || awaitBranch;
|
|
1034
1042
|
if (!tryBranch) {
|
|
1035
|
-
let deferred = scope[promiseAccessor] = () => deferred === scope[promiseAccessor] && awaitPromise(scope, promise), awaitCounter =
|
|
1043
|
+
let deferred = scope[promiseAccessor] = () => deferred === scope[promiseAccessor] && awaitPromise(scope, promise), awaitCounter = findTryWithPlaceholder(scope)?.O;
|
|
1036
1044
|
if (awaitCounter?.i) {
|
|
1037
1045
|
let complete = awaitCounter.c;
|
|
1038
1046
|
awaitCounter.c = () => complete() || queueAsyncRender(scope, deferred);
|
|
1039
1047
|
}
|
|
1040
1048
|
return;
|
|
1041
1049
|
}
|
|
1042
|
-
if (!isPromise(promise)) return scope[
|
|
1050
|
+
if (!isPromise(promise)) return scope[tryAccessor] ? awaitPromise(scope, Promise.resolve(promise)) : resolveAwait(scope, scope[nodeAccessor], promise);
|
|
1043
1051
|
let awaitCounter = tryBranch.O;
|
|
1044
|
-
|
|
1052
|
+
scope[tryAccessor] || (scope[tryAccessor] = tryBranch, trackAbort(scope, promiseAccessor, () => {
|
|
1053
|
+
scope[promiseAccessor] = 0, scope[tryAccessor] && queueAsyncRender(scope[tryAccessor], completeAwaitCounter, awaitCounter);
|
|
1054
|
+
}), awaitBranch && (awaitBranch.W ||= []), tryBranch === awaitBranch ? (awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, () => {
|
|
1045
1055
|
if (tryBranch === scope[branchAccessor]) {
|
|
1046
1056
|
let anchor = scope[nodeAccessor];
|
|
1047
1057
|
if (anchor.parentNode) {
|
|
@@ -1049,34 +1059,22 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1049
1059
|
detachedParent === anchor.parentNode ? anchor.remove() : anchor.replaceWith(detachedParent);
|
|
1050
1060
|
}
|
|
1051
1061
|
}
|
|
1052
|
-
})),
|
|
1062
|
+
})), scheduleAwaitFrame(awaitCounter, scope, () => {
|
|
1053
1063
|
awaitBranch.V || (awaitBranch.S.parentNode.insertBefore(scope[nodeAccessor], awaitBranch.S), tempDetachBranch(tryBranch));
|
|
1054
|
-
}));
|
|
1064
|
+
})) : awaitCounter = addAwaitCounter(scope, tryBranch));
|
|
1055
1065
|
let thisPromise = scope[promiseAccessor] = promise.then((data) => {
|
|
1056
1066
|
if (thisPromise === scope[promiseAccessor]) {
|
|
1057
1067
|
let referenceNode = scope[nodeAccessor];
|
|
1058
|
-
|
|
1059
|
-
scope[
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
awaitBranch = resolveAwait(scope, referenceNode, data);
|
|
1064
|
-
let pendingRenders = awaitBranch.W;
|
|
1065
|
-
if (awaitBranch.W = 0, pendingRenders?.forEach(queuePendingRender), placeholderShown.add(pendingEffects), awaitCounter.c(), awaitCounter.m) {
|
|
1066
|
-
let fnScopes = /* @__PURE__ */ new Map(), effects = awaitCounter.m([]);
|
|
1067
|
-
for (let i = 0; i < pendingEffects.length;) {
|
|
1068
|
-
let fn = pendingEffects[i++], scopes = fnScopes.get(fn);
|
|
1069
|
-
scopes || fnScopes.set(fn, scopes = /* @__PURE__ */ new Set()), scopes.add(pendingEffects[i++]);
|
|
1070
|
-
}
|
|
1071
|
-
for (let i = 0; i < effects.length;) {
|
|
1072
|
-
let fn = effects[i++], scope = effects[i++];
|
|
1073
|
-
fnScopes.get(fn)?.has(scope) || queueEffect(scope, fn);
|
|
1074
|
-
}
|
|
1068
|
+
scope[promiseAccessor] = 0, scope[branchAccessor] ? queueAsyncRender(scope, () => {
|
|
1069
|
+
if (!scope[promiseAccessor]) {
|
|
1070
|
+
awaitBranch = resolveAwait(scope, referenceNode, data);
|
|
1071
|
+
let pendingRenders = awaitBranch.W;
|
|
1072
|
+
awaitBranch.W = 0, pendingRenders?.forEach(queuePendingRender), scope[tryAccessor] = 0, queueCompleteAwaitCounter(tryBranch, awaitCounter);
|
|
1075
1073
|
}
|
|
1076
|
-
});
|
|
1074
|
+
}) : (scope[tryAccessor] = 0, awaitPromise(scope, data), awaitCounter.c(), run());
|
|
1077
1075
|
}
|
|
1078
1076
|
}, (error) => {
|
|
1079
|
-
thisPromise === scope[promiseAccessor] && (scope[promiseAccessor] = 0,
|
|
1077
|
+
thisPromise === scope[promiseAccessor] && (scope[promiseAccessor] = scope[tryAccessor] = 0, queueAsyncRender(scope, renderCatch, error), tryBranch !== awaitBranch && !awaitCounter.m ? findTryWithCatch(scope) ? queueCompleteAwaitCounter(tryBranch, awaitCounter) : awaitCounter.c() : awaitCounter.i = 0);
|
|
1080
1078
|
});
|
|
1081
1079
|
};
|
|
1082
1080
|
return awaitPromise;
|
|
@@ -1089,16 +1087,32 @@ function _await_content(nodeAccessor, template, walks, setup) {
|
|
|
1089
1087
|
scope[branchAccessor].Y = pendingScopes, typeof scope[promiseAccessor] == "function" && scope[promiseAccessor]();
|
|
1090
1088
|
};
|
|
1091
1089
|
}
|
|
1092
|
-
function addAwaitCounter(scope, tryBranch =
|
|
1090
|
+
function addAwaitCounter(scope, tryBranch = findTryWithPlaceholder(scope)) {
|
|
1093
1091
|
if (!tryBranch) return;
|
|
1094
1092
|
let awaitCounter = tryBranch.O;
|
|
1095
|
-
return awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch))),
|
|
1096
|
-
|
|
1093
|
+
return awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch))), scheduleAwaitFrame(awaitCounter, tryBranch, () => {
|
|
1094
|
+
(tryBranch.P = createAndSetupBranch(tryBranch.$, tryBranch.Q(), tryBranch._, tryBranch.S.parentNode)).PT = tryBranch, insertBranchBefore(tryBranch.P, tryBranch.S.parentNode, tryBranch.S), tempDetachBranch(tryBranch);
|
|
1097
1095
|
}), awaitCounter;
|
|
1098
1096
|
}
|
|
1099
1097
|
function scheduleAwaitFrame(awaitCounter, scope, render) {
|
|
1100
1098
|
awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, render, -1))));
|
|
1101
1099
|
}
|
|
1100
|
+
function queueCompleteAwaitCounter(tryBranch, awaitCounter) {
|
|
1101
|
+
queueRender(tryBranch, completeAwaitCounter, -1, awaitCounter, tryBranch.L + 1e9);
|
|
1102
|
+
}
|
|
1103
|
+
function completeAwaitCounter(_scope, awaitCounter) {
|
|
1104
|
+
if (awaitCounter.c(), awaitCounter.m) {
|
|
1105
|
+
let fnScopes = /* @__PURE__ */ new Map(), effects = awaitCounter.m([]);
|
|
1106
|
+
for (let i = 0; i < pendingEffects.length;) {
|
|
1107
|
+
let fn = pendingEffects[i++], scopes = fnScopes.get(fn);
|
|
1108
|
+
scopes || fnScopes.set(fn, scopes = /* @__PURE__ */ new Set()), scopes.add(pendingEffects[i++]);
|
|
1109
|
+
}
|
|
1110
|
+
for (let i = 0; i < effects.length;) {
|
|
1111
|
+
let fn = effects[i++], scope = effects[i++];
|
|
1112
|
+
fnScopes.get(fn)?.has(scope) || queueEffect(scope, fn);
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1102
1116
|
function createAwaitCounter(tryBranch, done) {
|
|
1103
1117
|
let awaitCounter = tryBranch.O = {
|
|
1104
1118
|
i: 0,
|
|
@@ -1109,30 +1123,41 @@ function createAwaitCounter(tryBranch, done) {
|
|
|
1109
1123
|
};
|
|
1110
1124
|
return awaitCounter;
|
|
1111
1125
|
}
|
|
1112
|
-
function runPendingEffects(
|
|
1113
|
-
|
|
1114
|
-
effects && (scope.J = [], runEffects(effects, 1));
|
|
1126
|
+
function runPendingEffects(tryBranch) {
|
|
1127
|
+
tryBranch.JS?.forEach((scope) => scope.J.forEach((fn) => runEffects([fn, scope]), scope.J = null), tryBranch.JS = null);
|
|
1115
1128
|
}
|
|
1116
1129
|
function dismissPlaceholder(tryBranch) {
|
|
1117
1130
|
let placeholderBranch = tryBranch.P;
|
|
1118
1131
|
placeholderBranch && (tryBranch.P = 0, placeholderBranch.S.parentNode.insertBefore(tryBranch.S.parentNode, placeholderBranch.S), removeAndDestroyBranch(placeholderBranch));
|
|
1119
1132
|
}
|
|
1120
|
-
function _try(nodeAccessor, template, walks, setup) {
|
|
1133
|
+
function _try(nodeAccessor, template, walks, setup, placeholderContent, catchContent) {
|
|
1121
1134
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
1122
1135
|
let branchAccessor = "A" + nodeAccessor, renderer = _content("", template, walks, setup)();
|
|
1123
|
-
return (scope
|
|
1124
|
-
|
|
1136
|
+
return (scope) => {
|
|
1137
|
+
setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch);
|
|
1125
1138
|
let branch = scope[branchAccessor];
|
|
1126
|
-
branch
|
|
1139
|
+
branch.C = nodeAccessor, branch.E = catchContent, branch.Q = placeholderContent || void 0;
|
|
1127
1140
|
};
|
|
1128
1141
|
}
|
|
1129
1142
|
function renderCatch(scope, error) {
|
|
1130
|
-
let tryWithCatch =
|
|
1143
|
+
let tryWithCatch = findTryWithCatch(scope);
|
|
1131
1144
|
if (tryWithCatch) {
|
|
1132
1145
|
let owner = tryWithCatch._, placeholderBranch = tryWithCatch.P;
|
|
1133
|
-
placeholderBranch && (tryWithCatch.O && (tryWithCatch.O.i = 0), owner["A" + tryWithCatch.C] = placeholderBranch, destroyBranch(tryWithCatch))
|
|
1146
|
+
placeholderBranch && (tryWithCatch.O && (tryWithCatch.O.i = 0), owner["A" + tryWithCatch.C] = placeholderBranch, destroyBranch(tryWithCatch));
|
|
1147
|
+
let catchContent = tryWithCatch.E();
|
|
1148
|
+
setConditionalRenderer(owner, tryWithCatch.C, catchContent, createAndSetupBranch), catchContent.d?.(owner["A" + tryWithCatch.C], [error]);
|
|
1134
1149
|
} else throw error;
|
|
1135
1150
|
}
|
|
1151
|
+
function findTryWithPlaceholder(scope) {
|
|
1152
|
+
let branch = scope.F;
|
|
1153
|
+
for (; branch && !branch.Q;) branch = branch.N;
|
|
1154
|
+
return branch;
|
|
1155
|
+
}
|
|
1156
|
+
function findTryWithCatch(scope) {
|
|
1157
|
+
let branch = scope.F;
|
|
1158
|
+
for (; branch && !branch.E;) branch = branch.PT || branch.N;
|
|
1159
|
+
return branch;
|
|
1160
|
+
}
|
|
1136
1161
|
function rendererKey(renderer) {
|
|
1137
1162
|
return renderer?.e ? renderer.a + " " + renderer.e.L : renderer?.a || renderer;
|
|
1138
1163
|
}
|
|
@@ -1152,10 +1177,12 @@ function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch)
|
|
|
1152
1177
|
function reorderKeyed(newScopes, start, newEnd, parentNode, afterReference) {
|
|
1153
1178
|
let diffLen = newEnd - start + 1, sources = Array(diffLen), pred = Array(diffLen), tails = [], tail = -1, lo, hi, mid;
|
|
1154
1179
|
for (let i = diffLen; i--;) sources[i] = newScopes[start + i].I ?? -1;
|
|
1155
|
-
for (let i = 0; i < diffLen; i++) if (~sources[i])
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1180
|
+
for (let i = 0; i < diffLen; i++) if (~sources[i]) {
|
|
1181
|
+
if (tail < 0 || sources[tails[tail]] < sources[i]) ~tail && (pred[i] = tails[tail]), tails[++tail] = i;
|
|
1182
|
+
else {
|
|
1183
|
+
for (lo = 0, hi = tail; lo < hi;) mid = (lo + hi) / 2 | 0, sources[tails[mid]] < sources[i] ? lo = mid + 1 : hi = mid;
|
|
1184
|
+
sources[i] < sources[tails[lo]] && (lo > 0 && (pred[i] = tails[lo - 1]), tails[lo] = i);
|
|
1185
|
+
}
|
|
1159
1186
|
}
|
|
1160
1187
|
for (hi = tails[tail], lo = tail + 1; lo-- > 0;) tails[lo] = hi, hi = pred[hi];
|
|
1161
1188
|
for (let i = diffLen; i--;) ~tail && i === tails[tail] ? tail-- : insertBranchBefore(newScopes[start + i], parentNode, afterReference), afterReference = newScopes[start + i].S;
|
|
@@ -1171,4 +1198,4 @@ function byFirstArg(name) {
|
|
|
1171
1198
|
return name;
|
|
1172
1199
|
}
|
|
1173
1200
|
//#endregion
|
|
1174
|
-
export {
|
|
1201
|
+
export { _attrs as $, syncGen as $t, _attr_input_value as A, _closure as At, _controllable_select as B, _if_closure as Bt, _attr_details_or_dialog_open_script as C, getRegisteredWithScope as Ct, _attr_input_checkedValue_script as D, readyFailed as Dt, _attr_input_checkedValue_default as E, ready as Et, _attr_select_value as F, _for_selector as Ft, _attr_class as G, _return_change as Gt, controllableRenders as H, _let_change as Ht, _attr_select_value_default as I, _global_read as It, _attr_content as J, _var_change as Jt, _attr_class_item as K, _script as Kt, _attr_select_value_script as L, _hoist as Lt, _attr_input_value_default as M, _const as Mt, _attr_input_value_dynamic_default as N, _el_read as Nt, _attr_input_checked_default as O, withLazy as Ot, _attr_input_value_script as P, _for_closure as Pt, _attr_style_items as Q, removeAndDestroyBranch as Qt, _controllable_input as R, _hoist_resume as Rt, _attr_details_or_dialog_open_default as S, _var_resume as St, _attr_input_checkedValue as T, initEmbedded as Tt, controllableScripts as U, _or as Ut, _controllable_textarea as V, _let as Vt, _attr as W, _return as Wt, _attr_style as X, destroyBranch as Xt, _attr_nonce as Y, _assert_init as Yt, _attr_style_item as Z, insertBranchBefore as Zt, installDynamicTagVar as _, _hoist_read_error as _n, createBranch as _t, _for_in as a, queueAsyncRender as an, _lifecycle as at, runPendingEffects as b, _el as bt, _for_to as c, rendering as cn, _text as ct, _for_until_unkeyed as d, runId as dn, insertChildNodes as dt, _on as en, _attrs_content as et, _if as f, forIn as fn, toInsertNode as ft, dynamicTagScript as g, _assert_hoist as gn, createAndSetupBranch as gt, addAwaitCounter as h, forUntil as hn, _content_resume as ht, _dynamic_tag_content as i, prepareEffects as in, _html as it, _attr_input_value_attribute_default as j, _closure_get as jt, _attr_input_checked_script as k, _child_setup as kt, _for_to_unkeyed as l, run as ln, _text_content as lt, _try as m, forTo as mn, _content_closures as mt, _await_promise as n, $signalReset as nn, _attrs_partial_content as nt, _for_of as o, queueEffect as on, _style_rule_item as ot, _show as p, forOf as pn, _content as pt, _attr_class_items as q, _var as qt, _dynamic_tag as r, installCatch as rn, _attrs_script as rt, _for_of_unkeyed as s, queueRender as sn, _style_shell as st, _await_content as t, $signal as tn, _attrs_partial as tt, _for_until as u, runEffects as un, _to_text as ut, patchDynamicTag as v, _call as vn, setupBranch as vt, _attr_input_checked as w, init as wt, _attr_details_or_dialog_open as x, _resumed as xt, renderCatch as y, withBranches as yn, _dynamic_tag_var_resume as yt, _controllable_open as z, _id as zt };
|