marko 6.3.55 → 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 +3 -2
- package/dist/common/accessor.d.ts +3 -0
- package/dist/common/accessor.debug.d.ts +3 -0
- 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/constants/closure-scopes-prop.d.ts +4 -0
- package/dist/common/constants/closure-scopes-prop.debug.d.ts +4 -0
- package/dist/common/types.d.ts +9 -3
- 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-CI0Vojyk.js → dom-BRO5aArp.js} +248 -193
- package/dist/debug/{dom-tl43c2wO.mjs → dom-Btj2QJhk.mjs} +225 -176
- package/dist/debug/dom.js +15 -13
- package/dist/debug/dom.mjs +15 -13
- package/dist/debug/html.js +605 -523
- package/dist/debug/html.mjs +604 -524
- 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 +2 -2
- package/dist/dom/scope.d.ts +0 -1
- package/dist/dom/signals.d.ts +1 -1
- package/dist/{dom-4udEPZaj.mjs → dom-B-v8Gw6T.mjs} +122 -92
- package/dist/{dom-C1mr-TA7.js → dom-BSsI9OPC.js} +218 -187
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +59 -56
- package/dist/dom.mjs +35 -33
- 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 +367 -327
- package/dist/html.mjs +366 -327
- package/dist/translator/index.js +866 -748
- 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/optional.d.ts +1 -3
- package/dist/translator/util/references.d.ts +6 -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 +3 -1
- package/dist/translator/util/setup-work.d.ts +5 -0
- package/dist/translator/util/signals.d.ts +5 -7
- package/dist/translator/util/translate-attrs.d.ts +2 -1
- package/dist/translator/visitors/tag/native-tag.d.ts +1 -0
- package/package.json +3 -3
- package/tags-html.d.ts +4 -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
|
}
|
|
@@ -439,16 +444,19 @@ function _closure(...closureSignals) {
|
|
|
439
444
|
let [firstSignal] = closureSignals, scopeInstances = firstSignal.a, signalIndex = firstSignal.b;
|
|
440
445
|
for (let i = closureSignals.length; i--;) closureSignals[i].c = i;
|
|
441
446
|
return (scope) => {
|
|
442
|
-
if (scope[scopeInstances])
|
|
447
|
+
if (scope[scopeInstances]) {
|
|
448
|
+
scope[scopeInstances]._ = 1;
|
|
449
|
+
for (let childScope of scope[scopeInstances]) childScope.H > 0 && childScope.H < runId && queueRender(childScope, closureSignals[childScope[signalIndex] || 0], -1);
|
|
450
|
+
}
|
|
443
451
|
};
|
|
444
452
|
}
|
|
445
|
-
function _closure_get(valueAccessor, fn, getOwnerScope, resumeId
|
|
453
|
+
function _closure_get(valueAccessor, fn, getOwnerScope, resumeId) {
|
|
446
454
|
valueAccessor = decodeAccessor(valueAccessor);
|
|
447
455
|
let closureSignal = ((scope, resumed) => {
|
|
448
456
|
let ownerScope = getOwnerScope ? getOwnerScope(scope) : scope._;
|
|
449
|
-
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);
|
|
450
458
|
});
|
|
451
|
-
return closureSignal.a = valueAccessor, closureSignal.b = "C" + valueAccessor, resumeId && (
|
|
459
|
+
return closureSignal.a = valueAccessor, closureSignal.b = "C" + valueAccessor, resumeId && (_resumed[resumeId] = (scope) => closureSignal(scope, 1)), closureSignal;
|
|
452
460
|
}
|
|
453
461
|
function _child_setup(setup) {
|
|
454
462
|
return setup._ = (scope, owner) => {
|
|
@@ -456,7 +464,8 @@ function _child_setup(setup) {
|
|
|
456
464
|
}, setup;
|
|
457
465
|
}
|
|
458
466
|
function _var(scope, childAccessor, signal) {
|
|
459
|
-
scope[decodeAccessor(childAccessor)]
|
|
467
|
+
let childScope = scope[decodeAccessor(childAccessor)];
|
|
468
|
+
childScope.T = (value) => signal(scope, value), "RV" in childScope && signal(scope, childScope.RV);
|
|
460
469
|
}
|
|
461
470
|
function _return_change(scope, changeHandler) {
|
|
462
471
|
scope.U = changeHandler || void 0;
|
|
@@ -475,16 +484,18 @@ function _script(id, fn) {
|
|
|
475
484
|
};
|
|
476
485
|
}
|
|
477
486
|
function _global_read($global, key) {
|
|
478
|
-
return
|
|
487
|
+
return $global[key];
|
|
479
488
|
}
|
|
480
489
|
function _el_read(value) {
|
|
481
490
|
return value;
|
|
482
491
|
}
|
|
483
492
|
function* traverse(scope, path, args, i = path.length - 1) {
|
|
484
|
-
if (scope)
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
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
|
+
}
|
|
488
499
|
}
|
|
489
500
|
}
|
|
490
501
|
function _hoist(...path) {
|
|
@@ -509,8 +520,8 @@ function ready(readyId) {
|
|
|
509
520
|
for (let renderId in curRenders) runResumeEffects(curRenders[renderId]);
|
|
510
521
|
}
|
|
511
522
|
function readyFailed(readyId) {}
|
|
512
|
-
function withLazy(
|
|
513
|
-
|
|
523
|
+
function withLazy() {
|
|
524
|
+
lazyEnabled = 1;
|
|
514
525
|
}
|
|
515
526
|
function initEmbedded(readyId, runtimeId) {
|
|
516
527
|
embedRenders || (embedRenders = /* @__PURE__ */ new Map(), new MutationObserver(() => {
|
|
@@ -544,7 +555,7 @@ function init(runtimeId = "M") {
|
|
|
544
555
|
}
|
|
545
556
|
for (visitType !== "[" && (visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit, accessor = "A" + (nodeAccessor = lastToken), singleNode = visitType !== "]" && visitType !== ")", nextToken()); branchId = +lastToken;) {
|
|
546
557
|
if ((endedBranches ||= []).push(branch = getScope(branchId)), setParentBranch(branch, branch.F), (branch.O = render.p?.[branchId]) && (branch.O.m = render.m), singleNode) {
|
|
547
|
-
for (; startVisit.previousSibling &&
|
|
558
|
+
for (; startVisit.previousSibling && (startVisit = startVisit.previousSibling).nodeType > 1;);
|
|
548
559
|
branch._ ??= visitScope, branch.K = branch.S = startVisit, visitType === "(" && (branch.a = startVisit);
|
|
549
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);
|
|
550
561
|
for (; pending.at(-1)?.L >= branchId;) adopt(pending.pop(), branch);
|
|
@@ -596,7 +607,7 @@ function init(runtimeId = "M") {
|
|
|
596
607
|
}
|
|
597
608
|
function runResumeEffects(render) {
|
|
598
609
|
try {
|
|
599
|
-
isResuming = 1, runEffects(render.m([])
|
|
610
|
+
isResuming = 1, runEffects(render.m([]));
|
|
600
611
|
} finally {
|
|
601
612
|
isResuming = 0;
|
|
602
613
|
}
|
|
@@ -610,7 +621,7 @@ function _var_resume(id, signal) {
|
|
|
610
621
|
function _el(id, accessor) {
|
|
611
622
|
return accessor = decodeAccessor(accessor), _resumed[id] = (scope) => () => scope[accessor];
|
|
612
623
|
}
|
|
613
|
-
function
|
|
624
|
+
function _dynamic_tag_var_resume(accessor) {
|
|
614
625
|
accessor = decodeAccessor(accessor), _resumed["-" + accessor] = (scope) => () => {
|
|
615
626
|
let node = scope[accessor];
|
|
616
627
|
return node.nodeType === 8 ? node.previousSibling : node;
|
|
@@ -768,9 +779,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
|
|
|
768
779
|
case "style":
|
|
769
780
|
_attr_style(el, value);
|
|
770
781
|
break;
|
|
771
|
-
default:
|
|
772
|
-
isEventHandler(name) ? (events ||= scope["I" + nodeAccessor] = {})[getEventHandlerName(name)] = value : skip?.test(name) || name === "content" && el.tagName !== "META" || _attr(el, name, value);
|
|
773
|
-
break;
|
|
782
|
+
default: isEventHandler(name) ? (events ||= scope["I" + nodeAccessor] = {})[getEventHandlerName(name)] = value : skip?.test(name) || name === "content" && el.tagName !== "META" || _attr(el, name, value);
|
|
774
783
|
}
|
|
775
784
|
}
|
|
776
785
|
}
|
|
@@ -792,7 +801,7 @@ function normalizeAttrValue(value) {
|
|
|
792
801
|
}
|
|
793
802
|
function _lifecycle(scope, thisObj, index = 0) {
|
|
794
803
|
let accessor = "K" + index, instance = scope[accessor];
|
|
795
|
-
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?.()));
|
|
796
805
|
}
|
|
797
806
|
function removeChildNodes(startNode, endNode) {
|
|
798
807
|
let stop = endNode.nextSibling;
|
|
@@ -929,14 +938,16 @@ function _attr_select_value_script(scope, nodeAccessor) {
|
|
|
929
938
|
setSelectValue(el, oldValue, multiple), valueChange(newValue), run();
|
|
930
939
|
}
|
|
931
940
|
};
|
|
932
|
-
if (isResuming)
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
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
|
+
}
|
|
940
951
|
}
|
|
941
952
|
}
|
|
942
953
|
syncControllableFormInput(el, hasSelectChanged, onChange), observeOnce(scope, nodeAccessor, {
|
|
@@ -1022,23 +1033,25 @@ function _controllable_open(scope, nodeAccessor, nextAttrs) {
|
|
|
1022
1033
|
//#region src/dom/control-flow.ts
|
|
1023
1034
|
function _await_promise(nodeAccessor, params) {
|
|
1024
1035
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
1025
|
-
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) => {
|
|
1026
1037
|
let awaitBranch = scope[branchAccessor];
|
|
1027
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;
|
|
1028
1039
|
}, awaitPromise = (scope, promise) => {
|
|
1029
1040
|
isPromise(scope[promiseAccessor]) || (scope[promiseAccessor] = 0);
|
|
1030
|
-
let awaitBranch = scope[branchAccessor],
|
|
1041
|
+
let awaitBranch = scope[branchAccessor], tryBranch = scope[tryAccessor] || isPromise(promise) && findTryWithPlaceholder(scope) || awaitBranch;
|
|
1031
1042
|
if (!tryBranch) {
|
|
1032
|
-
let
|
|
1043
|
+
let deferred = scope[promiseAccessor] = () => deferred === scope[promiseAccessor] && awaitPromise(scope, promise), awaitCounter = findTryWithPlaceholder(scope)?.O;
|
|
1033
1044
|
if (awaitCounter?.i) {
|
|
1034
1045
|
let complete = awaitCounter.c;
|
|
1035
|
-
awaitCounter.c = () => complete() || queueAsyncRender(scope,
|
|
1046
|
+
awaitCounter.c = () => complete() || queueAsyncRender(scope, deferred);
|
|
1036
1047
|
}
|
|
1037
1048
|
return;
|
|
1038
1049
|
}
|
|
1039
|
-
if (!isPromise(promise)) return scope[
|
|
1050
|
+
if (!isPromise(promise)) return scope[tryAccessor] ? awaitPromise(scope, Promise.resolve(promise)) : resolveAwait(scope, scope[nodeAccessor], promise);
|
|
1040
1051
|
let awaitCounter = tryBranch.O;
|
|
1041
|
-
|
|
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, () => {
|
|
1042
1055
|
if (tryBranch === scope[branchAccessor]) {
|
|
1043
1056
|
let anchor = scope[nodeAccessor];
|
|
1044
1057
|
if (anchor.parentNode) {
|
|
@@ -1046,34 +1059,22 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1046
1059
|
detachedParent === anchor.parentNode ? anchor.remove() : anchor.replaceWith(detachedParent);
|
|
1047
1060
|
}
|
|
1048
1061
|
}
|
|
1049
|
-
})),
|
|
1062
|
+
})), scheduleAwaitFrame(awaitCounter, scope, () => {
|
|
1050
1063
|
awaitBranch.V || (awaitBranch.S.parentNode.insertBefore(scope[nodeAccessor], awaitBranch.S), tempDetachBranch(tryBranch));
|
|
1051
|
-
}));
|
|
1064
|
+
})) : awaitCounter = addAwaitCounter(scope, tryBranch));
|
|
1052
1065
|
let thisPromise = scope[promiseAccessor] = promise.then((data) => {
|
|
1053
1066
|
if (thisPromise === scope[promiseAccessor]) {
|
|
1054
1067
|
let referenceNode = scope[nodeAccessor];
|
|
1055
|
-
|
|
1056
|
-
scope[
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
awaitBranch = resolveAwait(scope, referenceNode, data);
|
|
1061
|
-
let pendingRenders = awaitBranch.W;
|
|
1062
|
-
if (awaitBranch.W = 0, pendingRenders?.forEach(queuePendingRender), placeholderShown.add(pendingEffects), awaitCounter.c(), awaitCounter.m) {
|
|
1063
|
-
let fnScopes = /* @__PURE__ */ new Map(), effects = awaitCounter.m([]);
|
|
1064
|
-
for (let i = 0; i < pendingEffects.length;) {
|
|
1065
|
-
let fn = pendingEffects[i++], scopes = fnScopes.get(fn);
|
|
1066
|
-
scopes || fnScopes.set(fn, scopes = /* @__PURE__ */ new Set()), scopes.add(pendingEffects[i++]);
|
|
1067
|
-
}
|
|
1068
|
-
for (let i = 0; i < effects.length;) {
|
|
1069
|
-
let fn = effects[i++], scope = effects[i++];
|
|
1070
|
-
fnScopes.get(fn)?.has(scope) || queueEffect(scope, fn);
|
|
1071
|
-
}
|
|
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);
|
|
1072
1073
|
}
|
|
1073
|
-
});
|
|
1074
|
+
}) : (scope[tryAccessor] = 0, awaitPromise(scope, data), awaitCounter.c(), run());
|
|
1074
1075
|
}
|
|
1075
1076
|
}, (error) => {
|
|
1076
|
-
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);
|
|
1077
1078
|
});
|
|
1078
1079
|
};
|
|
1079
1080
|
return awaitPromise;
|
|
@@ -1086,16 +1087,32 @@ function _await_content(nodeAccessor, template, walks, setup) {
|
|
|
1086
1087
|
scope[branchAccessor].Y = pendingScopes, typeof scope[promiseAccessor] == "function" && scope[promiseAccessor]();
|
|
1087
1088
|
};
|
|
1088
1089
|
}
|
|
1089
|
-
function addAwaitCounter(scope, tryBranch =
|
|
1090
|
+
function addAwaitCounter(scope, tryBranch = findTryWithPlaceholder(scope)) {
|
|
1090
1091
|
if (!tryBranch) return;
|
|
1091
1092
|
let awaitCounter = tryBranch.O;
|
|
1092
|
-
return awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch))),
|
|
1093
|
-
|
|
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);
|
|
1094
1095
|
}), awaitCounter;
|
|
1095
1096
|
}
|
|
1096
1097
|
function scheduleAwaitFrame(awaitCounter, scope, render) {
|
|
1097
1098
|
awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, render, -1))));
|
|
1098
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
|
+
}
|
|
1099
1116
|
function createAwaitCounter(tryBranch, done) {
|
|
1100
1117
|
let awaitCounter = tryBranch.O = {
|
|
1101
1118
|
i: 0,
|
|
@@ -1106,30 +1123,41 @@ function createAwaitCounter(tryBranch, done) {
|
|
|
1106
1123
|
};
|
|
1107
1124
|
return awaitCounter;
|
|
1108
1125
|
}
|
|
1109
|
-
function runPendingEffects(
|
|
1110
|
-
|
|
1111
|
-
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);
|
|
1112
1128
|
}
|
|
1113
1129
|
function dismissPlaceholder(tryBranch) {
|
|
1114
1130
|
let placeholderBranch = tryBranch.P;
|
|
1115
1131
|
placeholderBranch && (tryBranch.P = 0, placeholderBranch.S.parentNode.insertBefore(tryBranch.S.parentNode, placeholderBranch.S), removeAndDestroyBranch(placeholderBranch));
|
|
1116
1132
|
}
|
|
1117
|
-
function _try(nodeAccessor, template, walks, setup) {
|
|
1133
|
+
function _try(nodeAccessor, template, walks, setup, placeholderContent, catchContent) {
|
|
1118
1134
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
1119
1135
|
let branchAccessor = "A" + nodeAccessor, renderer = _content("", template, walks, setup)();
|
|
1120
|
-
return (scope
|
|
1121
|
-
|
|
1136
|
+
return (scope) => {
|
|
1137
|
+
setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch);
|
|
1122
1138
|
let branch = scope[branchAccessor];
|
|
1123
|
-
branch
|
|
1139
|
+
branch.C = nodeAccessor, branch.E = catchContent, branch.Q = placeholderContent || void 0;
|
|
1124
1140
|
};
|
|
1125
1141
|
}
|
|
1126
1142
|
function renderCatch(scope, error) {
|
|
1127
|
-
let tryWithCatch =
|
|
1143
|
+
let tryWithCatch = findTryWithCatch(scope);
|
|
1128
1144
|
if (tryWithCatch) {
|
|
1129
1145
|
let owner = tryWithCatch._, placeholderBranch = tryWithCatch.P;
|
|
1130
|
-
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]);
|
|
1131
1149
|
} else throw error;
|
|
1132
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
|
+
}
|
|
1133
1161
|
function rendererKey(renderer) {
|
|
1134
1162
|
return renderer?.e ? renderer.a + " " + renderer.e.L : renderer?.a || renderer;
|
|
1135
1163
|
}
|
|
@@ -1149,10 +1177,12 @@ function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch)
|
|
|
1149
1177
|
function reorderKeyed(newScopes, start, newEnd, parentNode, afterReference) {
|
|
1150
1178
|
let diffLen = newEnd - start + 1, sources = Array(diffLen), pred = Array(diffLen), tails = [], tail = -1, lo, hi, mid;
|
|
1151
1179
|
for (let i = diffLen; i--;) sources[i] = newScopes[start + i].I ?? -1;
|
|
1152
|
-
for (let i = 0; i < diffLen; i++) if (~sources[i])
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
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
|
+
}
|
|
1156
1186
|
}
|
|
1157
1187
|
for (hi = tails[tail], lo = tail + 1; lo-- > 0;) tails[lo] = hi, hi = pred[hi];
|
|
1158
1188
|
for (let i = diffLen; i--;) ~tail && i === tails[tail] ? tail-- : insertBranchBefore(newScopes[start + i], parentNode, afterReference), afterReference = newScopes[start + i].S;
|
|
@@ -1168,4 +1198,4 @@ function byFirstArg(name) {
|
|
|
1168
1198
|
return name;
|
|
1169
1199
|
}
|
|
1170
1200
|
//#endregion
|
|
1171
|
-
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 };
|