marko 6.3.56 → 6.4.1
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 -3
- package/dist/common/constants/accessor-prefix.d.ts +2 -0
- package/dist/common/constants/accessor-prefix.debug.d.ts +2 -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/reserved-id.d.ts +5 -0
- package/dist/common/errors.d.ts +1 -1
- package/dist/common/types.d.ts +11 -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-ClV4kVOO.js} +263 -193
- package/dist/debug/{dom-BeCNT5R5.mjs → dom-LFrKxOk5.mjs} +246 -182
- package/dist/debug/dom.js +14 -12
- package/dist/debug/dom.mjs +14 -12
- package/dist/debug/html.js +826 -685
- package/dist/debug/html.mjs +822 -683
- 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/signals.d.ts +3 -2
- package/dist/{dom-QEF0csuC.js → dom-CNglVi8P.js} +222 -185
- package/dist/{dom-BwNsIevR.mjs → dom-DfP3MCo0.mjs} +126 -90
- package/dist/dom.js +59 -56
- package/dist/dom.mjs +34 -32
- package/dist/html/attrs.d.ts +4 -2
- package/dist/html/dynamic-tag.d.ts +1 -1
- package/dist/html/inlined-runtimes.d.ts +1 -1
- package/dist/html/inlined-runtimes.debug.d.ts +1 -1
- package/dist/html/serializer.d.ts +1 -1
- package/dist/html/writer.d.ts +39 -33
- package/dist/html.d.ts +2 -2
- package/dist/html.js +526 -424
- package/dist/html.mjs +524 -423
- package/dist/translator/core/html-comment.d.ts +0 -7
- package/dist/translator/core/let.d.ts +0 -5
- package/dist/translator/core/show.d.ts +2 -5
- package/dist/translator/core/style.d.ts +6 -8
- package/dist/translator/index.d.ts +9 -0
- package/dist/translator/index.js +8195 -7939
- package/dist/translator/util/binding-has-prop.d.ts +3 -1
- package/dist/translator/util/binding-prop-tree.d.ts +4 -4
- package/dist/translator/util/bindings.d.ts +127 -0
- package/dist/translator/util/body-to-text-literal.d.ts +1 -2
- package/dist/translator/util/branch-tag.d.ts +7 -7
- package/dist/translator/util/constants/binding-type.d.ts +5 -6
- package/dist/translator/util/constants/slot-kind.d.ts +14 -0
- package/dist/translator/util/constants/structure-kind.d.ts +1 -1
- package/dist/translator/util/entry-builder.d.ts +2 -0
- package/dist/translator/util/evaluate.d.ts +11 -10
- package/dist/translator/util/finalize-references.d.ts +4 -0
- package/dist/translator/util/for-selector.d.ts +1 -1
- package/dist/translator/util/generate-uid.d.ts +7 -0
- package/dist/translator/util/get-declared-binding-expression.d.ts +2 -2
- package/dist/translator/util/is-core-tag.d.ts +0 -3
- package/dist/translator/util/is-only-child-in-parent.d.ts +2 -7
- package/dist/translator/util/known-tag.d.ts +8 -7
- package/dist/translator/util/read-replacement.d.ts +3 -0
- package/dist/translator/util/reasons.d.ts +32 -0
- package/dist/translator/util/references.d.ts +69 -167
- package/dist/translator/util/runtime.d.ts +3 -3
- package/dist/translator/util/scope-accessor.d.ts +14 -0
- package/dist/translator/util/scope-read.d.ts +1 -1
- package/dist/translator/util/sections.d.ts +56 -50
- package/dist/translator/util/set-tag-derived-from.d.ts +7 -0
- package/dist/translator/util/setup-work.d.ts +4 -0
- package/dist/translator/util/signals.d.ts +8 -12
- package/dist/translator/util/slots.d.ts +50 -0
- package/dist/translator/util/solve-reasons.d.ts +10 -0
- package/dist/translator/util/sources.d.ts +21 -0
- package/dist/translator/util/structure.d.ts +5 -2
- package/dist/translator/util/tag-facts.d.ts +21 -0
- package/dist/translator/util/tag-name-type.d.ts +4 -1
- package/dist/translator/util/translate-attrs.d.ts +2 -0
- package/dist/translator/util/translate-var.d.ts +3 -0
- package/dist/translator/util/write-guard.d.ts +12 -0
- package/dist/translator/util/writer.d.ts +3 -3
- package/dist/translator/visitors/export-declaration.d.ts +9 -0
- package/dist/translator/visitors/function.d.ts +5 -4
- package/dist/translator/visitors/import-declaration.d.ts +2 -2
- package/dist/translator/visitors/placeholder.d.ts +0 -3
- package/dist/translator/visitors/program/index.d.ts +13 -3
- package/dist/translator/visitors/referenced-identifier.d.ts +2 -1
- package/dist/translator/visitors/tag/custom-tag.d.ts +1 -1
- package/dist/translator/visitors/tag/dynamic-tag.d.ts +0 -3
- package/dist/translator/visitors/tag/index.d.ts +2 -1
- package/dist/translator/visitors/tag/native-tag.d.ts +26 -11
- package/package.json +3 -3
- package/dist/translator/util/insertion-context.d.ts +0 -1
- package/dist/translator/util/is-non-html-text.d.ts +0 -3
- package/dist/translator/util/serialize-guard.d.ts +0 -11
- package/dist/translator/util/serialize-reasons.d.ts +0 -37
- package/dist/translator/util/set-tag-sections-downstream.d.ts +0 -6
- 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());
|
|
@@ -27,8 +29,17 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
|
|
|
27
29
|
for (; !currentNode.nextSibling && currentNode.parentNode;) currentNode = currentNode.parentNode;
|
|
28
30
|
walkNextSibling();
|
|
29
31
|
}, walkNextSibling = () => currentNode = currentNode.nextSibling || currentNode, _resumed = {}, curRenders, embedRenders, readyIds, lazyEnabled, isResuming, cloneCache = {}, _html = /*@__PURE__*/ withDynamicHtml(function(scope, value, accessor) {
|
|
30
|
-
let
|
|
31
|
-
|
|
32
|
+
let prevValue = scope["R" + accessor];
|
|
33
|
+
if (prevValue !== (scope["R" + accessor] = _to_text(value))) {
|
|
34
|
+
let firstChild = scope[accessor], parentNode = firstChild.parentNode, lastChild = scope["H" + accessor] || firstChild, newContent = parseHTML(scope["R" + accessor], parentNode.namespaceURI);
|
|
35
|
+
if (prevValue === void 0 && lastChild !== firstChild) {
|
|
36
|
+
let node = firstChild, newNode = newContent.firstChild;
|
|
37
|
+
for (; (node = node.nextSibling) !== lastChild && node.isEqualNode(newNode);) newNode = newNode.nextSibling;
|
|
38
|
+
if (node === lastChild && !newNode) return;
|
|
39
|
+
}
|
|
40
|
+
let newFirstChild = scope[accessor] = newContent.firstChild || newContent.appendChild(new Text()), newLastChild = scope["H" + accessor] = newContent.lastChild, branch = scope.F;
|
|
41
|
+
branch?.S === firstChild && (branch.S = newFirstChild), branch?.K === lastChild && (branch.K = newLastChild), insertChildNodes(parentNode, firstChild, newFirstChild, newLastChild), removeChildNodes(firstChild, lastChild);
|
|
42
|
+
}
|
|
32
43
|
}), R = /[\p{L}\p{N}]/gu, inputType = "", controllableScripts = {}, controllableRenders = {}, _if = /*@__PURE__*/ withBranches((nodeAccessor, ...branchesArgs) => {
|
|
33
44
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
34
45
|
let branchAccessor = "D" + nodeAccessor, branches = [], i = 0;
|
|
@@ -67,13 +78,15 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
|
|
|
67
78
|
if (normalizedRenderer) {
|
|
68
79
|
let childScope = scope[childScopeAccessor], args = getInput?.();
|
|
69
80
|
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
|
-
|
|
81
|
+
else if (normalizedRenderer.g?.(childScope), normalizedRenderer.d) {
|
|
82
|
+
if (inputIsArgs) normalizedRenderer.d(childScope, normalizedRenderer._ ? args[0] : args);
|
|
83
|
+
else {
|
|
84
|
+
let inputWithContent = getContent ? {
|
|
85
|
+
...args,
|
|
86
|
+
content: getContent(scope)
|
|
87
|
+
} : args || {};
|
|
88
|
+
normalizedRenderer.d(childScope, normalizedRenderer._ ? inputWithContent : [inputWithContent]);
|
|
89
|
+
}
|
|
77
90
|
}
|
|
78
91
|
}
|
|
79
92
|
};
|
|
@@ -232,8 +245,8 @@ function prepareEffects(fn) {
|
|
|
232
245
|
}
|
|
233
246
|
return preparedEffects;
|
|
234
247
|
}
|
|
235
|
-
function installCatch(
|
|
236
|
-
catchEnabled = 1, withBranches(), runEffects =
|
|
248
|
+
function installCatch(catchEffects, wrapRender) {
|
|
249
|
+
catchEnabled = 1, withBranches(), runEffects = catchEffects, runRender = wrapRender(runRender);
|
|
237
250
|
}
|
|
238
251
|
function runRenders() {
|
|
239
252
|
for (; pendingRenders.length;) {
|
|
@@ -259,6 +272,10 @@ function $signalReset(scope, id) {
|
|
|
259
272
|
function $signal(scope, id) {
|
|
260
273
|
return abortsEnabled = 1, trackCleanup(scope), ((scope.A ||= {})[id] ||= new AbortController()).signal;
|
|
261
274
|
}
|
|
275
|
+
/** Runs `abort` as a destroyed scope's `$signal` would fire, without creating one. */
|
|
276
|
+
function trackAbort(scope, id, abort) {
|
|
277
|
+
abortsEnabled = 1, trackCleanup(scope), (scope.A ||= {})[id] = { abort };
|
|
278
|
+
}
|
|
262
279
|
/** Enrols `scope` with its branch so destroying the branch cleans it up. */
|
|
263
280
|
function trackCleanup(scope, subscribers) {
|
|
264
281
|
let branch = scope.F;
|
|
@@ -273,8 +290,10 @@ function toArray(opt) {
|
|
|
273
290
|
return opt ? Array.isArray(opt) ? opt : [opt] : [];
|
|
274
291
|
}
|
|
275
292
|
function forEach(opt, cb) {
|
|
276
|
-
if (opt)
|
|
277
|
-
|
|
293
|
+
if (opt) {
|
|
294
|
+
if (Array.isArray(opt)) for (let item of opt) cb(item);
|
|
295
|
+
else cb(opt);
|
|
296
|
+
}
|
|
278
297
|
}
|
|
279
298
|
function push(opt, item) {
|
|
280
299
|
return opt ? Array.isArray(opt) ? (opt.push(item), opt) : [opt, item] : item;
|
|
@@ -323,11 +342,6 @@ function collectScopes(fn) {
|
|
|
323
342
|
function skipScope() {
|
|
324
343
|
return nextScopeId++;
|
|
325
344
|
}
|
|
326
|
-
function findBranchWithKey(scope, key) {
|
|
327
|
-
let branch = scope.F;
|
|
328
|
-
for (; branch && branch[key] == null;) branch = branch.N;
|
|
329
|
-
return branch;
|
|
330
|
-
}
|
|
331
345
|
function destroyBranch(branch) {
|
|
332
346
|
branch.N?.D?.delete(branch), destroyNestedScopes(branch);
|
|
333
347
|
}
|
|
@@ -449,7 +463,7 @@ function _closure_get(valueAccessor, fn, getOwnerScope, resumeId) {
|
|
|
449
463
|
valueAccessor = decodeAccessor(valueAccessor);
|
|
450
464
|
let closureSignal = ((scope, resumed) => {
|
|
451
465
|
let ownerScope = getOwnerScope ? getOwnerScope(scope) : scope._;
|
|
452
|
-
scope[closureSignal.b] = closureSignal.c,
|
|
466
|
+
scope[closureSignal.b] = closureSignal.c, resumed ? ownerScope[closureSignal.a]._ && queueAsyncRender(scope, closureSignal) : fn(scope), subscribeToScopeSet(ownerScope, closureSignal.a, scope);
|
|
453
467
|
});
|
|
454
468
|
return closureSignal.a = valueAccessor, closureSignal.b = "C" + valueAccessor, resumeId && (_resumed[resumeId] = (scope) => closureSignal(scope, 1)), closureSignal;
|
|
455
469
|
}
|
|
@@ -459,7 +473,8 @@ function _child_setup(setup) {
|
|
|
459
473
|
}, setup;
|
|
460
474
|
}
|
|
461
475
|
function _var(scope, childAccessor, signal) {
|
|
462
|
-
scope[decodeAccessor(childAccessor)]
|
|
476
|
+
let childScope = scope[decodeAccessor(childAccessor)];
|
|
477
|
+
childScope.T = (value) => signal(scope, value), "RV" in childScope && signal(scope, childScope.RV);
|
|
463
478
|
}
|
|
464
479
|
function _return_change(scope, changeHandler) {
|
|
465
480
|
scope.U = changeHandler || void 0;
|
|
@@ -478,20 +493,22 @@ function _script(id, fn) {
|
|
|
478
493
|
};
|
|
479
494
|
}
|
|
480
495
|
function _global_read($global, key) {
|
|
481
|
-
return
|
|
496
|
+
return $global[key];
|
|
482
497
|
}
|
|
483
498
|
function _el_read(value) {
|
|
484
499
|
return value;
|
|
485
500
|
}
|
|
486
501
|
function* traverse(scope, path, args, i = path.length - 1) {
|
|
487
|
-
if (scope)
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
502
|
+
if (scope) {
|
|
503
|
+
if (Symbol.iterator in scope) for (let childScope of scope.values()) childScope.H !== 0 && (yield* traverse(childScope, path, args, i));
|
|
504
|
+
else {
|
|
505
|
+
let step = path[i], item = Array.isArray(step) ? (scope[step[1]] || 0) === step[2] && scope[step[0]] : scope[step];
|
|
506
|
+
i ? yield* traverse(item, path, args, i - 1) : yield typeof item == "function" ? item(...args) : item;
|
|
507
|
+
}
|
|
491
508
|
}
|
|
492
509
|
}
|
|
493
510
|
function _hoist(...path) {
|
|
494
|
-
return path = path.map((p) => typeof p == "
|
|
511
|
+
return path = path.map((p) => typeof p == "number" ? decodeAccessor(p) : p), (scope) => {
|
|
495
512
|
let fn = (...args) => traverse(scope, path, args).next().value;
|
|
496
513
|
return fn[Symbol.iterator] = () => traverse(scope, path, []), fn;
|
|
497
514
|
};
|
|
@@ -512,8 +529,8 @@ function ready(readyId) {
|
|
|
512
529
|
for (let renderId in curRenders) runResumeEffects(curRenders[renderId]);
|
|
513
530
|
}
|
|
514
531
|
function readyFailed(readyId) {}
|
|
515
|
-
function withLazy(
|
|
516
|
-
|
|
532
|
+
function withLazy() {
|
|
533
|
+
lazyEnabled = 1;
|
|
517
534
|
}
|
|
518
535
|
function initEmbedded(readyId, runtimeId) {
|
|
519
536
|
embedRenders || (embedRenders = /* @__PURE__ */ new Map(), new MutationObserver(() => {
|
|
@@ -547,7 +564,7 @@ function init(runtimeId = "M") {
|
|
|
547
564
|
}
|
|
548
565
|
for (visitType !== "[" && (visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit, accessor = "A" + (nodeAccessor = lastToken), singleNode = visitType !== "]" && visitType !== ")", nextToken()); branchId = +lastToken;) {
|
|
549
566
|
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 &&
|
|
567
|
+
for (; startVisit.previousSibling && (startVisit = startVisit.previousSibling).nodeType > 1;);
|
|
551
568
|
branch._ ??= visitScope, branch.K = branch.S = startVisit, visitType === "(" && (branch.a = startVisit);
|
|
552
569
|
} 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
570
|
for (; pending.at(-1)?.L >= branchId;) adopt(pending.pop(), branch);
|
|
@@ -599,7 +616,7 @@ function init(runtimeId = "M") {
|
|
|
599
616
|
}
|
|
600
617
|
function runResumeEffects(render) {
|
|
601
618
|
try {
|
|
602
|
-
isResuming = 1, runEffects(render.m([])
|
|
619
|
+
isResuming = 1, runEffects(render.m([]));
|
|
603
620
|
} finally {
|
|
604
621
|
isResuming = 0;
|
|
605
622
|
}
|
|
@@ -771,9 +788,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
|
|
|
771
788
|
case "style":
|
|
772
789
|
_attr_style(el, value);
|
|
773
790
|
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;
|
|
791
|
+
default: isEventHandler(name) ? (events ||= scope["I" + nodeAccessor] = {})[getEventHandlerName(name)] = value : skip?.test(name) || name === "content" && el.tagName !== "META" || _attr(el, name, value);
|
|
777
792
|
}
|
|
778
793
|
}
|
|
779
794
|
}
|
|
@@ -795,7 +810,7 @@ function normalizeAttrValue(value) {
|
|
|
795
810
|
}
|
|
796
811
|
function _lifecycle(scope, thisObj, index = 0) {
|
|
797
812
|
let accessor = "K" + index, instance = scope[accessor];
|
|
798
|
-
instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[accessor] = thisObj, Object.assign(thisObj, thisObj.onMount?.()),
|
|
813
|
+
instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[accessor] = thisObj, Object.assign(thisObj, thisObj.onMount?.()), trackAbort(scope, accessor, () => thisObj.onDestroy?.()));
|
|
799
814
|
}
|
|
800
815
|
function removeChildNodes(startNode, endNode) {
|
|
801
816
|
let stop = endNode.nextSibling;
|
|
@@ -932,14 +947,16 @@ function _attr_select_value_script(scope, nodeAccessor) {
|
|
|
932
947
|
setSelectValue(el, oldValue, multiple), valueChange(newValue), run();
|
|
933
948
|
}
|
|
934
949
|
};
|
|
935
|
-
if (isResuming)
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
950
|
+
if (isResuming) {
|
|
951
|
+
if (el.multiple) {
|
|
952
|
+
scope["G" + nodeAccessor] = [];
|
|
953
|
+
for (let opt of el.options) opt.defaultSelected && scope["G" + nodeAccessor].push(opt.value);
|
|
954
|
+
} else {
|
|
955
|
+
scope["G" + nodeAccessor] = "";
|
|
956
|
+
for (let opt of el.options) if (opt.defaultSelected) {
|
|
957
|
+
scope["G" + nodeAccessor] = opt.value;
|
|
958
|
+
break;
|
|
959
|
+
}
|
|
943
960
|
}
|
|
944
961
|
}
|
|
945
962
|
syncControllableFormInput(el, hasSelectChanged, onChange), observeOnce(scope, nodeAccessor, {
|
|
@@ -1025,23 +1042,25 @@ function _controllable_open(scope, nodeAccessor, nextAttrs) {
|
|
|
1025
1042
|
//#region src/dom/control-flow.ts
|
|
1026
1043
|
function _await_promise(nodeAccessor, params) {
|
|
1027
1044
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
1028
|
-
let promiseAccessor = "L" + nodeAccessor, branchAccessor = "A" + nodeAccessor, resolveAwait = (scope, referenceNode, value) => {
|
|
1045
|
+
let promiseAccessor = "L" + nodeAccessor, branchAccessor = "A" + nodeAccessor, tryAccessor = "Q" + nodeAccessor, resolveAwait = (scope, referenceNode, value) => {
|
|
1029
1046
|
let awaitBranch = scope[branchAccessor];
|
|
1030
1047
|
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
1048
|
}, awaitPromise = (scope, promise) => {
|
|
1032
1049
|
isPromise(scope[promiseAccessor]) || (scope[promiseAccessor] = 0);
|
|
1033
|
-
let awaitBranch = scope[branchAccessor],
|
|
1050
|
+
let awaitBranch = scope[branchAccessor], tryBranch = scope[tryAccessor] || isPromise(promise) && findTryWithPlaceholder(scope) || awaitBranch;
|
|
1034
1051
|
if (!tryBranch) {
|
|
1035
|
-
let deferred = scope[promiseAccessor] = () => deferred === scope[promiseAccessor] && awaitPromise(scope, promise), awaitCounter =
|
|
1052
|
+
let deferred = scope[promiseAccessor] = () => deferred === scope[promiseAccessor] && awaitPromise(scope, promise), awaitCounter = findTryWithPlaceholder(scope)?.O;
|
|
1036
1053
|
if (awaitCounter?.i) {
|
|
1037
1054
|
let complete = awaitCounter.c;
|
|
1038
1055
|
awaitCounter.c = () => complete() || queueAsyncRender(scope, deferred);
|
|
1039
1056
|
}
|
|
1040
1057
|
return;
|
|
1041
1058
|
}
|
|
1042
|
-
if (!isPromise(promise)) return scope[
|
|
1059
|
+
if (!isPromise(promise)) return scope[tryAccessor] ? awaitPromise(scope, Promise.resolve(promise)) : resolveAwait(scope, scope[nodeAccessor], promise);
|
|
1043
1060
|
let awaitCounter = tryBranch.O;
|
|
1044
|
-
|
|
1061
|
+
scope[tryAccessor] || (scope[tryAccessor] = tryBranch, trackAbort(scope, promiseAccessor, () => {
|
|
1062
|
+
scope[promiseAccessor] = 0, scope[tryAccessor] && queueAsyncRender(scope[tryAccessor], completeAwaitCounter, awaitCounter);
|
|
1063
|
+
}), awaitBranch && (awaitBranch.W ||= []), tryBranch === awaitBranch ? (awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, () => {
|
|
1045
1064
|
if (tryBranch === scope[branchAccessor]) {
|
|
1046
1065
|
let anchor = scope[nodeAccessor];
|
|
1047
1066
|
if (anchor.parentNode) {
|
|
@@ -1049,34 +1068,22 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1049
1068
|
detachedParent === anchor.parentNode ? anchor.remove() : anchor.replaceWith(detachedParent);
|
|
1050
1069
|
}
|
|
1051
1070
|
}
|
|
1052
|
-
})),
|
|
1071
|
+
})), scheduleAwaitFrame(awaitCounter, scope, () => {
|
|
1053
1072
|
awaitBranch.V || (awaitBranch.S.parentNode.insertBefore(scope[nodeAccessor], awaitBranch.S), tempDetachBranch(tryBranch));
|
|
1054
|
-
}));
|
|
1073
|
+
})) : awaitCounter = addAwaitCounter(scope, tryBranch));
|
|
1055
1074
|
let thisPromise = scope[promiseAccessor] = promise.then((data) => {
|
|
1056
1075
|
if (thisPromise === scope[promiseAccessor]) {
|
|
1057
1076
|
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
|
-
}
|
|
1077
|
+
scope[promiseAccessor] = 0, scope[branchAccessor] ? queueAsyncRender(scope, () => {
|
|
1078
|
+
if (!scope[promiseAccessor]) {
|
|
1079
|
+
awaitBranch = resolveAwait(scope, referenceNode, data);
|
|
1080
|
+
let pendingRenders = awaitBranch.W;
|
|
1081
|
+
awaitBranch.W = 0, pendingRenders?.forEach(queuePendingRender), scope[tryAccessor] = 0, queueCompleteAwaitCounter(tryBranch, awaitCounter);
|
|
1075
1082
|
}
|
|
1076
|
-
});
|
|
1083
|
+
}) : (scope[tryAccessor] = 0, awaitPromise(scope, data), awaitCounter.c(), run());
|
|
1077
1084
|
}
|
|
1078
1085
|
}, (error) => {
|
|
1079
|
-
thisPromise === scope[promiseAccessor] && (scope[promiseAccessor] = 0,
|
|
1086
|
+
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
1087
|
});
|
|
1081
1088
|
};
|
|
1082
1089
|
return awaitPromise;
|
|
@@ -1089,16 +1096,32 @@ function _await_content(nodeAccessor, template, walks, setup) {
|
|
|
1089
1096
|
scope[branchAccessor].Y = pendingScopes, typeof scope[promiseAccessor] == "function" && scope[promiseAccessor]();
|
|
1090
1097
|
};
|
|
1091
1098
|
}
|
|
1092
|
-
function addAwaitCounter(scope, tryBranch =
|
|
1099
|
+
function addAwaitCounter(scope, tryBranch = findTryWithPlaceholder(scope)) {
|
|
1093
1100
|
if (!tryBranch) return;
|
|
1094
1101
|
let awaitCounter = tryBranch.O;
|
|
1095
|
-
return awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch))),
|
|
1096
|
-
|
|
1102
|
+
return awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch))), scheduleAwaitFrame(awaitCounter, tryBranch, () => {
|
|
1103
|
+
(tryBranch.P = createAndSetupBranch(tryBranch.$, tryBranch.Q(), tryBranch._, tryBranch.S.parentNode)).PT = tryBranch, insertBranchBefore(tryBranch.P, tryBranch.S.parentNode, tryBranch.S), tempDetachBranch(tryBranch);
|
|
1097
1104
|
}), awaitCounter;
|
|
1098
1105
|
}
|
|
1099
1106
|
function scheduleAwaitFrame(awaitCounter, scope, render) {
|
|
1100
1107
|
awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, render, -1))));
|
|
1101
1108
|
}
|
|
1109
|
+
function queueCompleteAwaitCounter(tryBranch, awaitCounter) {
|
|
1110
|
+
queueRender(tryBranch, completeAwaitCounter, -1, awaitCounter, tryBranch.L + 1e9);
|
|
1111
|
+
}
|
|
1112
|
+
function completeAwaitCounter(_scope, awaitCounter) {
|
|
1113
|
+
if (awaitCounter.c(), awaitCounter.m) {
|
|
1114
|
+
let fnScopes = /* @__PURE__ */ new Map(), effects = awaitCounter.m([]);
|
|
1115
|
+
for (let i = 0; i < pendingEffects.length;) {
|
|
1116
|
+
let fn = pendingEffects[i++], scopes = fnScopes.get(fn);
|
|
1117
|
+
scopes || fnScopes.set(fn, scopes = /* @__PURE__ */ new Set()), scopes.add(pendingEffects[i++]);
|
|
1118
|
+
}
|
|
1119
|
+
for (let i = 0; i < effects.length;) {
|
|
1120
|
+
let fn = effects[i++], scope = effects[i++];
|
|
1121
|
+
fnScopes.get(fn)?.has(scope) || queueEffect(scope, fn);
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1102
1125
|
function createAwaitCounter(tryBranch, done) {
|
|
1103
1126
|
let awaitCounter = tryBranch.O = {
|
|
1104
1127
|
i: 0,
|
|
@@ -1109,30 +1132,41 @@ function createAwaitCounter(tryBranch, done) {
|
|
|
1109
1132
|
};
|
|
1110
1133
|
return awaitCounter;
|
|
1111
1134
|
}
|
|
1112
|
-
function runPendingEffects(
|
|
1113
|
-
|
|
1114
|
-
effects && (scope.J = [], runEffects(effects, 1));
|
|
1135
|
+
function runPendingEffects(tryBranch) {
|
|
1136
|
+
tryBranch.JS?.forEach((scope) => scope.J.forEach((fn) => runEffects([fn, scope]), scope.J = null), tryBranch.JS = null);
|
|
1115
1137
|
}
|
|
1116
1138
|
function dismissPlaceholder(tryBranch) {
|
|
1117
1139
|
let placeholderBranch = tryBranch.P;
|
|
1118
1140
|
placeholderBranch && (tryBranch.P = 0, placeholderBranch.S.parentNode.insertBefore(tryBranch.S.parentNode, placeholderBranch.S), removeAndDestroyBranch(placeholderBranch));
|
|
1119
1141
|
}
|
|
1120
|
-
function _try(nodeAccessor, template, walks, setup) {
|
|
1142
|
+
function _try(nodeAccessor, template, walks, setup, placeholderContent, catchContent) {
|
|
1121
1143
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
1122
1144
|
let branchAccessor = "A" + nodeAccessor, renderer = _content("", template, walks, setup)();
|
|
1123
|
-
return (scope
|
|
1124
|
-
|
|
1145
|
+
return (scope) => {
|
|
1146
|
+
setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch);
|
|
1125
1147
|
let branch = scope[branchAccessor];
|
|
1126
|
-
branch
|
|
1148
|
+
branch.C = nodeAccessor, branch.E = catchContent, branch.Q = placeholderContent || void 0;
|
|
1127
1149
|
};
|
|
1128
1150
|
}
|
|
1129
1151
|
function renderCatch(scope, error) {
|
|
1130
|
-
let tryWithCatch =
|
|
1152
|
+
let tryWithCatch = findTryWithCatch(scope);
|
|
1131
1153
|
if (tryWithCatch) {
|
|
1132
1154
|
let owner = tryWithCatch._, placeholderBranch = tryWithCatch.P;
|
|
1133
|
-
placeholderBranch && (tryWithCatch.O && (tryWithCatch.O.i = 0), owner["A" + tryWithCatch.C] = placeholderBranch, destroyBranch(tryWithCatch))
|
|
1155
|
+
placeholderBranch && (tryWithCatch.O && (tryWithCatch.O.i = 0), owner["A" + tryWithCatch.C] = placeholderBranch, destroyBranch(tryWithCatch));
|
|
1156
|
+
let catchContent = tryWithCatch.E();
|
|
1157
|
+
setConditionalRenderer(owner, tryWithCatch.C, catchContent, createAndSetupBranch), catchContent.d?.(owner["A" + tryWithCatch.C], [error]);
|
|
1134
1158
|
} else throw error;
|
|
1135
1159
|
}
|
|
1160
|
+
function findTryWithPlaceholder(scope) {
|
|
1161
|
+
let branch = scope.F;
|
|
1162
|
+
for (; branch && !branch.Q;) branch = branch.N;
|
|
1163
|
+
return branch;
|
|
1164
|
+
}
|
|
1165
|
+
function findTryWithCatch(scope) {
|
|
1166
|
+
let branch = scope.F;
|
|
1167
|
+
for (; branch && !branch.E;) branch = branch.PT || branch.N;
|
|
1168
|
+
return branch;
|
|
1169
|
+
}
|
|
1136
1170
|
function rendererKey(renderer) {
|
|
1137
1171
|
return renderer?.e ? renderer.a + " " + renderer.e.L : renderer?.a || renderer;
|
|
1138
1172
|
}
|
|
@@ -1152,10 +1186,12 @@ function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch)
|
|
|
1152
1186
|
function reorderKeyed(newScopes, start, newEnd, parentNode, afterReference) {
|
|
1153
1187
|
let diffLen = newEnd - start + 1, sources = Array(diffLen), pred = Array(diffLen), tails = [], tail = -1, lo, hi, mid;
|
|
1154
1188
|
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
|
-
|
|
1189
|
+
for (let i = 0; i < diffLen; i++) if (~sources[i]) {
|
|
1190
|
+
if (tail < 0 || sources[tails[tail]] < sources[i]) ~tail && (pred[i] = tails[tail]), tails[++tail] = i;
|
|
1191
|
+
else {
|
|
1192
|
+
for (lo = 0, hi = tail; lo < hi;) mid = (lo + hi) / 2 | 0, sources[tails[mid]] < sources[i] ? lo = mid + 1 : hi = mid;
|
|
1193
|
+
sources[i] < sources[tails[lo]] && (lo > 0 && (pred[i] = tails[lo - 1]), tails[lo] = i);
|
|
1194
|
+
}
|
|
1159
1195
|
}
|
|
1160
1196
|
for (hi = tails[tail], lo = tail + 1; lo-- > 0;) tails[lo] = hi, hi = pred[hi];
|
|
1161
1197
|
for (let i = diffLen; i--;) ~tail && i === tails[tail] ? tail-- : insertBranchBefore(newScopes[start + i], parentNode, afterReference), afterReference = newScopes[start + i].S;
|
|
@@ -1171,4 +1207,4 @@ function byFirstArg(name) {
|
|
|
1171
1207
|
return name;
|
|
1172
1208
|
}
|
|
1173
1209
|
//#endregion
|
|
1174
|
-
export {
|
|
1210
|
+
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 };
|