marko 6.0.0-next.3.60 → 6.0.0-next.3.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/accessor.d.ts +25 -0
- package/dist/common/accessor.debug.d.ts +25 -0
- package/dist/common/types.d.ts +2 -23
- package/dist/debug/dom.js +83 -83
- package/dist/debug/dom.mjs +83 -83
- package/dist/debug/html.js +11 -11
- package/dist/debug/html.mjs +11 -11
- package/dist/dom.js +171 -171
- package/dist/dom.mjs +171 -171
- package/dist/html.js +14 -14
- package/dist/html.mjs +14 -14
- package/dist/translator/index.js +84 -16
- package/dist/translator/util/get-accessor-char.d.ts +4 -0
- package/dist/translator/util/sections.d.ts +1 -1
- package/package.json +1 -1
package/dist/dom.js
CHANGED
@@ -226,9 +226,9 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
226
226
|
endNode === lastEndNode && (endNode = reference.parentNode.insertBefore(
|
227
227
|
new Text(),
|
228
228
|
reference
|
229
|
-
)), branch.
|
229
|
+
)), branch.h = lastEndNode = endNode, branch.g ||= endNode;
|
230
230
|
for (let [markerScopeId, markerNode] of closestBranchMarkers)
|
231
|
-
branch.
|
231
|
+
branch.g.compareDocumentPosition(markerNode) & 4 && reference.compareDocumentPosition(markerNode) & 2 && (parentBranchIds.set(markerScopeId, branchId), closestBranchMarkers.delete(markerScopeId));
|
232
232
|
return branchIds.add(branchId), closestBranchMarkers.set(branchId, visit), branch;
|
233
233
|
};
|
234
234
|
for (let visit of visits) {
|
@@ -236,22 +236,22 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
236
236
|
commentPrefixLen + 1,
|
237
237
|
dataIndex ? dataIndex - 1 : commentText.length
|
238
238
|
), scope = scopeLookup[scopeId] ||= {
|
239
|
-
|
239
|
+
l: +scopeId
|
240
240
|
}, data2 = dataIndex ? commentText.slice(dataIndex) : "", token = commentText[commentPrefixLen];
|
241
241
|
if (token === "*" /* Node */) {
|
242
242
|
let node = scope[data2] = visit.previousSibling;
|
243
|
-
scope[
|
243
|
+
scope["j" /* Getter */ + data2] = () => node;
|
244
244
|
} else if (token === "$" /* ClosestBranch */)
|
245
245
|
closestBranchMarkers.set(scopeId, visit);
|
246
246
|
else if (token === "[" /* BranchStart */)
|
247
|
-
currentScopeId && (dataIndex && branchEnd(currentScopeId, visit, visit), scopeStack.push(currentScopeId)), currentScopeId = scopeId, scope.
|
247
|
+
currentScopeId && (dataIndex && branchEnd(currentScopeId, visit, visit), scopeStack.push(currentScopeId)), currentScopeId = scopeId, scope.g = visit;
|
248
248
|
else if (token === "]" /* BranchEnd */) {
|
249
249
|
scope[data2] = visit;
|
250
250
|
let curParent = visit.parentNode, startNode = branchEnd(
|
251
251
|
currentScopeId,
|
252
252
|
visit,
|
253
253
|
visit
|
254
|
-
).
|
254
|
+
).g;
|
255
255
|
curParent !== startNode.parentNode && curParent.prepend(startNode), currentScopeId = scopeStack.pop();
|
256
256
|
} else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
|
257
257
|
let next = data2.indexOf(" "), curNode = visit;
|
@@ -262,7 +262,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
262
262
|
start,
|
263
263
|
~next ? next : data2.length
|
264
264
|
);
|
265
|
-
curNode = branchEnd(childScopeId, visit, curNode).
|
265
|
+
curNode = branchEnd(childScopeId, visit, curNode).h;
|
266
266
|
}
|
267
267
|
}
|
268
268
|
}
|
@@ -274,18 +274,18 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
274
274
|
let serialized = resumes[i];
|
275
275
|
if (typeof serialized == "function") {
|
276
276
|
let scopes = serialized(serializeContext), { $global } = scopeLookup;
|
277
|
-
$global || (scopeLookup.$global = $global = scopes.$ || {}, $global.runtimeId = runtimeId, $global.renderId = renderId, $global.
|
277
|
+
$global || (scopeLookup.$global = $global = scopes.$ || {}, $global.runtimeId = runtimeId, $global.renderId = renderId, $global.m = 1e6);
|
278
278
|
for (let scopeId in scopes)
|
279
279
|
if (scopeId !== "$") {
|
280
280
|
let scope = scopes[scopeId], prevScope = scopeLookup[scopeId];
|
281
|
-
scope.$global = $global, scope.
|
281
|
+
scope.$global = $global, scope.l = +scopeId, prevScope !== scope && (scopeLookup[scopeId] = Object.assign(
|
282
282
|
scope,
|
283
283
|
prevScope
|
284
284
|
));
|
285
285
|
let parentBranchId = parentBranchIds.get(scopeId);
|
286
|
-
if (parentBranchId && (scope.
|
287
|
-
let branch = scope, parentBranch = branch.
|
288
|
-
scope.
|
286
|
+
if (parentBranchId && (scope.j = scopes[parentBranchId]), branchIds.has(scopeId)) {
|
287
|
+
let branch = scope, parentBranch = branch.j;
|
288
|
+
scope.j = branch, parentBranch && (branch.n = parentBranch, (parentBranch.z ||= /* @__PURE__ */ new Set()).add(
|
289
289
|
branch
|
290
290
|
));
|
291
291
|
}
|
@@ -341,7 +341,7 @@ function controllable_input_checked(scope, nodeAccessor, checked, checkedChange)
|
|
341
341
|
function controllable_input_checked_effect(scope, nodeAccessor) {
|
342
342
|
let el = scope[nodeAccessor];
|
343
343
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
344
|
-
let checkedChange = scope[
|
344
|
+
let checkedChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
345
345
|
if (checkedChange) {
|
346
346
|
let newValue = el.checked;
|
347
347
|
el.checked = !newValue, checkedChange(newValue), run();
|
@@ -349,7 +349,7 @@ function controllable_input_checked_effect(scope, nodeAccessor) {
|
|
349
349
|
});
|
350
350
|
}
|
351
351
|
function controllable_input_checkedValue(scope, nodeAccessor, checkedValue, checkedValueChange, value2) {
|
352
|
-
scope[
|
352
|
+
scope["g" /* ControlledValue */ + nodeAccessor] = checkedValue, attr(scope[nodeAccessor], "value", value2), setCheckboxValue(
|
353
353
|
scope,
|
354
354
|
nodeAccessor,
|
355
355
|
1 /* InputCheckedValue */,
|
@@ -360,9 +360,9 @@ function controllable_input_checkedValue(scope, nodeAccessor, checkedValue, chec
|
|
360
360
|
function controllable_input_checkedValue_effect(scope, nodeAccessor) {
|
361
361
|
let el = scope[nodeAccessor];
|
362
362
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
363
|
-
let checkedValueChange = scope[
|
363
|
+
let checkedValueChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
364
364
|
if (checkedValueChange) {
|
365
|
-
let oldValue = scope[
|
365
|
+
let oldValue = scope["g" /* ControlledValue */ + nodeAccessor], newValue = Array.isArray(oldValue) ? updateList(oldValue, el.value, el.checked) : el.checked ? el.value : void 0;
|
366
366
|
if (el.name && el.type[0] === "r")
|
367
367
|
for (let radio of el.getRootNode().querySelectorAll(
|
368
368
|
`[type=radio][name=${CSS.escape(el.name)}]`
|
@@ -376,23 +376,23 @@ function controllable_input_checkedValue_effect(scope, nodeAccessor) {
|
|
376
376
|
}
|
377
377
|
function controllable_input_value(scope, nodeAccessor, value2, valueChange) {
|
378
378
|
let el = scope[nodeAccessor], normalizedValue = normalizeStrProp(value2);
|
379
|
-
scope[
|
379
|
+
scope["e" /* ControlledHandler */ + nodeAccessor] = valueChange, valueChange ? (scope["f" /* ControlledType */ + nodeAccessor] = 0 /* InputChecked */, scope["g" /* ControlledValue */ + nodeAccessor] = value2, el.isConnected ? setValueAndUpdateSelection(el, normalizedValue) : el.defaultValue = normalizedValue) : (scope["f" /* ControlledType */ + nodeAccessor] = 5 /* None */, el.defaultValue = normalizedValue);
|
380
380
|
}
|
381
381
|
function controllable_input_value_effect(scope, nodeAccessor) {
|
382
382
|
let el = scope[nodeAccessor];
|
383
|
-
isResuming && (scope[
|
384
|
-
let valueChange = scope[
|
383
|
+
isResuming && (scope["g" /* ControlledValue */ + nodeAccessor] = el.defaultValue), syncControllable(el, "input", hasValueChanged, (ev) => {
|
384
|
+
let valueChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
385
385
|
if (valueChange) {
|
386
386
|
let newValue = el.value;
|
387
387
|
inputType = ev?.inputType, setValueAndUpdateSelection(
|
388
388
|
el,
|
389
|
-
scope[
|
389
|
+
scope["g" /* ControlledValue */ + nodeAccessor]
|
390
390
|
), valueChange(newValue), run(), inputType = "";
|
391
391
|
}
|
392
392
|
});
|
393
393
|
}
|
394
394
|
function controllable_select_value(scope, nodeAccessor, value2, valueChange) {
|
395
|
-
scope[
|
395
|
+
scope["e" /* ControlledHandler */ + nodeAccessor] = valueChange, valueChange ? (scope["f" /* ControlledType */ + nodeAccessor] = 3 /* SelectValue */, scope["g" /* ControlledValue */ + nodeAccessor] = value2) : scope["f" /* ControlledType */ + nodeAccessor] = 5 /* None */, pendingEffects.unshift(
|
396
396
|
() => setSelectOptions(
|
397
397
|
scope[nodeAccessor],
|
398
398
|
value2,
|
@@ -403,20 +403,20 @@ function controllable_select_value(scope, nodeAccessor, value2, valueChange) {
|
|
403
403
|
}
|
404
404
|
function controllable_select_value_effect(scope, nodeAccessor) {
|
405
405
|
let el = scope[nodeAccessor], onChange = () => {
|
406
|
-
let valueChange = scope[
|
406
|
+
let valueChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
407
407
|
if (valueChange) {
|
408
408
|
let newValue = Array.isArray(
|
409
|
-
scope[
|
409
|
+
scope["g" /* ControlledValue */ + nodeAccessor]
|
410
410
|
) ? Array.from(el.selectedOptions, toValueProp) : el.value;
|
411
411
|
setSelectOptions(
|
412
412
|
el,
|
413
|
-
scope[
|
413
|
+
scope["g" /* ControlledValue */ + nodeAccessor],
|
414
414
|
valueChange
|
415
415
|
), valueChange(newValue), run();
|
416
416
|
}
|
417
417
|
};
|
418
418
|
el._ || new MutationObserver(() => {
|
419
|
-
let value2 = scope[
|
419
|
+
let value2 = scope["g" /* ControlledValue */ + nodeAccessor];
|
420
420
|
(Array.isArray(value2) ? value2.length !== el.selectedOptions.length || value2.some((value3, i) => value3 != el.selectedOptions[i].value) : el.value != value2) && onChange();
|
421
421
|
}).observe(el, {
|
422
422
|
childList: !0,
|
@@ -439,16 +439,16 @@ function setSelectOptions(el, value2, valueChange) {
|
|
439
439
|
}
|
440
440
|
}
|
441
441
|
function controllable_detailsOrDialog_open(scope, nodeAccessor, open, openChange) {
|
442
|
-
scope[
|
442
|
+
scope["e" /* ControlledHandler */ + nodeAccessor] = openChange, openChange ? scope["f" /* ControlledType */ + nodeAccessor] = 4 /* DetailsOrDialogOpen */ : scope["f" /* ControlledType */ + nodeAccessor] = 5 /* None */, scope[nodeAccessor].open = scope["g" /* ControlledValue */ + nodeAccessor] = normalizeBoolProp(open);
|
443
443
|
}
|
444
444
|
function controllable_detailsOrDialog_open_effect(scope, nodeAccessor) {
|
445
|
-
let el = scope[nodeAccessor], hasChanged = () => el.open !== scope[
|
445
|
+
let el = scope[nodeAccessor], hasChanged = () => el.open !== scope["g" /* ControlledValue */ + nodeAccessor];
|
446
446
|
syncControllable(
|
447
447
|
el,
|
448
448
|
el.tagName === "DIALOG" ? "close" : "toggle",
|
449
449
|
hasChanged,
|
450
450
|
() => {
|
451
|
-
let openChange = scope[
|
451
|
+
let openChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
452
452
|
if (openChange && hasChanged()) {
|
453
453
|
let newValue = el.open;
|
454
454
|
el.open = !newValue, openChange(newValue), run();
|
@@ -469,7 +469,7 @@ function setValueAndUpdateSelection(el, value2) {
|
|
469
469
|
}
|
470
470
|
}
|
471
471
|
function setCheckboxValue(scope, nodeAccessor, type, checked, checkedChange) {
|
472
|
-
scope[
|
472
|
+
scope["e" /* ControlledHandler */ + nodeAccessor] = checkedChange, checkedChange ? (scope["f" /* ControlledType */ + nodeAccessor] = type, scope[nodeAccessor].checked = checked) : (scope["f" /* ControlledType */ + nodeAccessor] = 5 /* None */, scope[nodeAccessor].defaultChecked = checked);
|
473
473
|
}
|
474
474
|
var controllableDelegate = createDelegator();
|
475
475
|
function syncControllable(el, event, hasChanged, onChange) {
|
@@ -633,13 +633,13 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
633
633
|
case "content":
|
634
634
|
break;
|
635
635
|
default:
|
636
|
-
isEventHandler(name) ? (events ||= scope[
|
636
|
+
isEventHandler(name) ? (events ||= scope["i" /* EventAttributes */ + nodeAccessor] = {})[getEventHandlerName(name)] = value2 : skip?.test(name) || attr(el, name, value2);
|
637
637
|
}
|
638
638
|
}
|
639
639
|
}
|
640
640
|
function attrsEvents(scope, nodeAccessor) {
|
641
|
-
let el = scope[nodeAccessor], events = scope[
|
642
|
-
switch (scope[
|
641
|
+
let el = scope[nodeAccessor], events = scope["i" /* EventAttributes */ + nodeAccessor];
|
642
|
+
switch (scope["f" /* ControlledType */ + nodeAccessor]) {
|
643
643
|
case 0 /* InputChecked */:
|
644
644
|
controllable_input_checked_effect(scope, nodeAccessor);
|
645
645
|
break;
|
@@ -660,7 +660,7 @@ function attrsEvents(scope, nodeAccessor) {
|
|
660
660
|
on(el, name, events[name]);
|
661
661
|
}
|
662
662
|
function html(scope, value2, accessor) {
|
663
|
-
let firstChild = scope[accessor], parentNode = firstChild.parentNode, lastChild = scope[
|
663
|
+
let firstChild = scope[accessor], parentNode = firstChild.parentNode, lastChild = scope["h" /* DynamicPlaceholderLastChild */ + accessor] || firstChild, newContent = parseHTML(
|
664
664
|
value2 || value2 === 0 ? value2 + "" : "",
|
665
665
|
parentNode.namespaceURI
|
666
666
|
);
|
@@ -668,7 +668,7 @@ function html(scope, value2, accessor) {
|
|
668
668
|
parentNode,
|
669
669
|
firstChild,
|
670
670
|
scope[accessor] = newContent.firstChild || newContent.appendChild(new Text()),
|
671
|
-
scope[
|
671
|
+
scope["h" /* DynamicPlaceholderLastChild */ + accessor] = newContent.lastChild
|
672
672
|
), removeChildNodes(firstChild, lastChild);
|
673
673
|
}
|
674
674
|
function props(scope, nodeIndex, index) {
|
@@ -691,7 +691,7 @@ function lifecycle(scope, index, thisObj) {
|
|
691
691
|
let instance = scope[index];
|
692
692
|
instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[index] = thisObj, thisObj.onMount?.(), getAbortSignal(
|
693
693
|
scope,
|
694
|
-
"
|
694
|
+
"k" /* LifecycleAbortController */ + index
|
695
695
|
).onabort = () => thisObj.onDestroy?.());
|
696
696
|
}
|
697
697
|
function removeChildNodes(startNode, endNode) {
|
@@ -718,47 +718,47 @@ function toInsertNode(startNode, endNode) {
|
|
718
718
|
var pendingScopes = [];
|
719
719
|
function createScope($global, closestBranch) {
|
720
720
|
let scope = {
|
721
|
-
|
722
|
-
|
723
|
-
|
721
|
+
l: $global.m++,
|
722
|
+
o: 1,
|
723
|
+
j: closestBranch,
|
724
724
|
$global
|
725
725
|
};
|
726
726
|
return pendingScopes.push(scope), scope;
|
727
727
|
}
|
728
728
|
function skipScope(scope) {
|
729
|
-
return scope.$global.
|
729
|
+
return scope.$global.m++;
|
730
730
|
}
|
731
731
|
function finishPendingScopes() {
|
732
732
|
for (let scope of pendingScopes)
|
733
|
-
scope.
|
733
|
+
scope.o = 0;
|
734
734
|
pendingScopes = [];
|
735
735
|
}
|
736
736
|
function destroyBranch(branch) {
|
737
|
-
branch.
|
737
|
+
branch.n?.z?.delete(branch), destroyNestedBranches(branch);
|
738
738
|
}
|
739
739
|
function destroyNestedBranches(branch) {
|
740
|
-
branch.
|
741
|
-
for (let id in scope.
|
742
|
-
scope.
|
740
|
+
branch.q = 1, branch.z?.forEach(destroyNestedBranches), branch.H?.forEach((scope) => {
|
741
|
+
for (let id in scope.t)
|
742
|
+
scope.t[id]?.abort();
|
743
743
|
});
|
744
744
|
}
|
745
745
|
function removeAndDestroyBranch(branch) {
|
746
|
-
destroyBranch(branch), removeChildNodes(branch.
|
746
|
+
destroyBranch(branch), removeChildNodes(branch.g, branch.h);
|
747
747
|
}
|
748
748
|
function insertBranchBefore(branch, parentNode, nextSibling) {
|
749
749
|
insertChildNodes(
|
750
750
|
parentNode,
|
751
751
|
nextSibling,
|
752
|
-
branch.
|
753
|
-
branch.
|
752
|
+
branch.g,
|
753
|
+
branch.h
|
754
754
|
);
|
755
755
|
}
|
756
756
|
function tempDetatchBranch(branch) {
|
757
757
|
insertChildNodes(
|
758
|
-
|
758
|
+
new DocumentFragment(),
|
759
759
|
null,
|
760
|
-
branch.
|
761
|
-
branch.
|
760
|
+
branch.g,
|
761
|
+
branch.h
|
762
762
|
);
|
763
763
|
}
|
764
764
|
|
@@ -780,7 +780,7 @@ function reconcile(parent, oldBranches, newBranches, afterReference) {
|
|
780
780
|
}
|
781
781
|
if (oldStart > oldEnd) {
|
782
782
|
if (newStart <= newEnd) {
|
783
|
-
k = newEnd + 1, nextSibling = k < newBranches.length ? newBranches[k].
|
783
|
+
k = newEnd + 1, nextSibling = k < newBranches.length ? newBranches[k].g : afterReference;
|
784
784
|
do
|
785
785
|
insertBranchBefore(newBranches[newStart++], parent, nextSibling);
|
786
786
|
while (newStart <= newEnd);
|
@@ -809,10 +809,10 @@ function reconcile(parent, oldBranches, newBranches, afterReference) {
|
|
809
809
|
if (pos === WRONG_POS) {
|
810
810
|
let seq = longestIncreasingSubsequence(sources);
|
811
811
|
for (j = seq.length - 1, k = newBranches.length, i = newLength - 1; i >= 0; --i)
|
812
|
-
sources[i] === -1 ? (pos = i + newStart, newBranch = newBranches[pos++], nextSibling = pos < k ? newBranches[pos].
|
812
|
+
sources[i] === -1 ? (pos = i + newStart, newBranch = newBranches[pos++], nextSibling = pos < k ? newBranches[pos].g : afterReference, insertBranchBefore(newBranch, parent, nextSibling)) : j < 0 || i !== seq[j] ? (pos = i + newStart, newBranch = newBranches[pos++], nextSibling = pos < k ? newBranches[pos].g : afterReference, insertBranchBefore(newBranch, parent, nextSibling)) : --j;
|
813
813
|
} else if (synced !== newLength)
|
814
814
|
for (k = newBranches.length, i = newLength - 1; i >= 0; --i)
|
815
|
-
sources[i] === -1 && (pos = i + newStart, newBranch = newBranches[pos++], nextSibling = pos < k ? newBranches[pos].
|
815
|
+
sources[i] === -1 && (pos = i + newStart, newBranch = newBranches[pos++], nextSibling = pos < k ? newBranches[pos].g : afterReference, insertBranchBefore(newBranch, parent, nextSibling));
|
816
816
|
}
|
817
817
|
}
|
818
818
|
}
|
@@ -847,7 +847,7 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
847
847
|
for (; currentWalkIndex < walkCodes.length; )
|
848
848
|
if (value2 = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value2 === 32 /* Get */) {
|
849
849
|
let node = walker.currentNode;
|
850
|
-
scope[currentScopeIndex] = node, scope[
|
850
|
+
scope[currentScopeIndex] = node, scope["j" /* Getter */ + currentScopeIndex++] = () => node;
|
851
851
|
} else if (value2 === 37 /* Replace */ || value2 === 49 /* DynamicTagWithVar */)
|
852
852
|
walker.currentNode.replaceWith(
|
853
853
|
walker.currentNode = scope[currentScopeIndex++] = new Text()
|
@@ -859,7 +859,7 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
859
859
|
currentWalkIndex = walkInternal(
|
860
860
|
currentWalkIndex,
|
861
861
|
walkCodes,
|
862
|
-
scope[currentScopeIndex++] = createScope(scope.$global, scope.
|
862
|
+
scope[currentScopeIndex++] = createScope(scope.$global, scope.j)
|
863
863
|
), value2 === 48 /* BeginChildWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
|
864
864
|
else if (value2 < 92)
|
865
865
|
for (value2 = 20 /* Next */ * currentMultiplier + value2 - 67 /* Next */; value2--; )
|
@@ -878,8 +878,8 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
878
878
|
|
879
879
|
// src/dom/renderer.ts
|
880
880
|
function createBranch($global, renderer, parentScope, parentNode) {
|
881
|
-
let branch = createScope($global), parentBranch = parentScope?.
|
882
|
-
return branch._ = renderer.
|
881
|
+
let branch = createScope($global), parentBranch = parentScope?.j;
|
882
|
+
return branch._ = renderer.u || parentScope, branch.j = branch, parentBranch && (branch.n = parentBranch, (parentBranch.z ||= /* @__PURE__ */ new Set()).add(branch)), renderer.A?.(
|
883
883
|
branch,
|
884
884
|
parentNode.namespaceURI
|
885
885
|
), branch;
|
@@ -891,10 +891,10 @@ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
|
|
891
891
|
);
|
892
892
|
}
|
893
893
|
function setupBranch(renderer, branch) {
|
894
|
-
return (renderer.
|
894
|
+
return (renderer.B || renderer.D) && queueRender(
|
895
895
|
branch,
|
896
896
|
(branch2) => {
|
897
|
-
renderer.
|
897
|
+
renderer.B?.(branch2), renderer.D?.(branch2);
|
898
898
|
},
|
899
899
|
-1
|
900
900
|
), branch;
|
@@ -908,19 +908,19 @@ function createContent(id, template, walks, setup, params, closures, dynamicScop
|
|
908
908
|
))(branch, walks);
|
909
909
|
} : (branch) => {
|
910
910
|
walk(
|
911
|
-
branch.
|
911
|
+
branch.g = branch.h = new Text(),
|
912
912
|
walks,
|
913
913
|
branch
|
914
914
|
);
|
915
915
|
};
|
916
916
|
return (owner) => ({
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
917
|
+
l: id,
|
918
|
+
A: clone,
|
919
|
+
u: owner,
|
920
|
+
B: setup,
|
921
|
+
k: params,
|
922
|
+
D: closures,
|
923
|
+
x: dynamicScopesAccessor
|
924
924
|
});
|
925
925
|
}
|
926
926
|
function registerContent(id, template, walks, setup, params, closures, dynamicScopesAccessor) {
|
@@ -945,13 +945,13 @@ function createCloneableHTML(html2, ns) {
|
|
945
945
|
let { firstChild, lastChild } = parseHTML(html2, ns), parent = document.createElementNS(ns, "t");
|
946
946
|
return insertChildNodes(parent, null, firstChild, lastChild), firstChild === lastChild && firstChild.nodeType < 8 /* Comment */ ? (branch, walks) => {
|
947
947
|
walk(
|
948
|
-
branch.
|
948
|
+
branch.g = branch.h = firstChild.cloneNode(!0),
|
949
949
|
walks,
|
950
950
|
branch
|
951
951
|
);
|
952
952
|
} : (branch, walks) => {
|
953
953
|
let clone = parent.cloneNode(!0);
|
954
|
-
walk(clone.firstChild, walks, branch), branch.
|
954
|
+
walk(clone.firstChild, walks, branch), branch.g = clone.firstChild, branch.h = clone.lastChild;
|
955
955
|
};
|
956
956
|
}
|
957
957
|
|
@@ -976,7 +976,7 @@ function triggerMacroTask() {
|
|
976
976
|
function state(valueAccessor, fn) {
|
977
977
|
if (0)
|
978
978
|
var id;
|
979
|
-
let valueChangeAccessor =
|
979
|
+
let valueChangeAccessor = "o" /* TagVariableChange */ + valueAccessor, update = (scope, value2) => {
|
980
980
|
scope[valueAccessor] !== value2 && (scope[valueAccessor] = value2, fn(scope, value2));
|
981
981
|
};
|
982
982
|
return (scope, value2, valueChange) => (rendering ? ((scope[valueChangeAccessor] = valueChange) && scope[valueAccessor] !== value2 || !(valueAccessor in scope)) && (scope[valueAccessor] = value2, fn(scope, value2)) : scope[valueChangeAccessor] ? scope[valueChangeAccessor](value2) : (schedule(), queueRender(
|
@@ -992,31 +992,31 @@ function value(valueAccessor, fn = () => {
|
|
992
992
|
(!(valueAccessor in scope) || scope[valueAccessor] !== value2) && (scope[valueAccessor] = value2, fn(scope, value2));
|
993
993
|
};
|
994
994
|
}
|
995
|
-
function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "
|
995
|
+
function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "l") {
|
996
996
|
return (scope) => {
|
997
|
-
scope.
|
997
|
+
scope.o ? scope[id] === void 0 ? scope[id] = defaultPending : --scope[id] || fn(scope) : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
998
998
|
};
|
999
999
|
}
|
1000
1000
|
function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
1001
|
-
let childSignal = closure(valueAccessor, fn), loopScopeAccessor =
|
1001
|
+
let childSignal = closure(valueAccessor, fn), loopScopeAccessor = "l" /* LoopScopeArray */ + ownerLoopNodeAccessor, loopScopeMapAccessor = "m" /* LoopScopeMap */ + ownerLoopNodeAccessor, ownerSignal = (ownerScope) => {
|
1002
1002
|
let scopes = ownerScope[loopScopeAccessor] || ownerScope[loopScopeMapAccessor]?.values() || [], [firstScope] = scopes;
|
1003
1003
|
firstScope && queueRender(
|
1004
1004
|
ownerScope,
|
1005
1005
|
() => {
|
1006
1006
|
for (let scope of scopes)
|
1007
|
-
!scope.
|
1007
|
+
!scope.o && !scope.q && childSignal(scope);
|
1008
1008
|
},
|
1009
1009
|
-1,
|
1010
1010
|
0,
|
1011
|
-
firstScope.
|
1011
|
+
firstScope.l
|
1012
1012
|
);
|
1013
1013
|
};
|
1014
1014
|
return ownerSignal._ = childSignal, ownerSignal;
|
1015
1015
|
}
|
1016
1016
|
function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch, fn) {
|
1017
|
-
let childSignal = closure(valueAccessor, fn), scopeAccessor =
|
1017
|
+
let childSignal = closure(valueAccessor, fn), scopeAccessor = "d" /* ConditionalScope */ + ownerConditionalNodeAccessor, branchAccessor = "c" /* ConditionalRenderer */ + ownerConditionalNodeAccessor, ownerSignal = (scope) => {
|
1018
1018
|
let ifScope = scope[scopeAccessor];
|
1019
|
-
ifScope && !ifScope.
|
1019
|
+
ifScope && !ifScope.o && scope[branchAccessor] === branch && queueRender(ifScope, childSignal, -1);
|
1020
1020
|
};
|
1021
1021
|
return ownerSignal._ = childSignal, ownerSignal;
|
1022
1022
|
}
|
@@ -1028,13 +1028,13 @@ function subscribeToScopeSet(ownerScope, accessor, scope) {
|
|
1028
1028
|
));
|
1029
1029
|
}
|
1030
1030
|
function dynamicClosure(...closureSignals) {
|
1031
|
-
let [{
|
1031
|
+
let [{ E: ___scopeInstancesAccessor, F: ___signalIndexAccessor }] = closureSignals;
|
1032
1032
|
for (let i = closureSignals.length; i--; )
|
1033
|
-
closureSignals[i].
|
1033
|
+
closureSignals[i].I = i;
|
1034
1034
|
return (scope) => {
|
1035
1035
|
if (scope[___scopeInstancesAccessor])
|
1036
1036
|
for (let childScope of scope[___scopeInstancesAccessor])
|
1037
|
-
childScope.
|
1037
|
+
childScope.o || queueRender(
|
1038
1038
|
childScope,
|
1039
1039
|
closureSignals[childScope[___signalIndexAccessor]],
|
1040
1040
|
-1
|
@@ -1043,13 +1043,13 @@ function dynamicClosure(...closureSignals) {
|
|
1043
1043
|
}
|
1044
1044
|
function dynamicClosureRead(valueAccessor, fn, getOwnerScope) {
|
1045
1045
|
let childSignal = closure(valueAccessor, fn, getOwnerScope), closureSignal = (scope) => {
|
1046
|
-
scope[closureSignal.
|
1046
|
+
scope[closureSignal.F] = closureSignal.I, childSignal(scope), subscribeToScopeSet(
|
1047
1047
|
getOwnerScope ? getOwnerScope(scope) : scope._,
|
1048
|
-
closureSignal.
|
1048
|
+
closureSignal.E,
|
1049
1049
|
scope
|
1050
1050
|
);
|
1051
1051
|
};
|
1052
|
-
return closureSignal.
|
1052
|
+
return closureSignal.E = "a" /* ClosureScopes */ + valueAccessor, closureSignal.F = "b" /* ClosureSignalIndex */ + valueAccessor, closureSignal;
|
1053
1053
|
}
|
1054
1054
|
function closure(valueAccessor, fn, getOwnerScope) {
|
1055
1055
|
return (scope) => {
|
@@ -1057,13 +1057,13 @@ function closure(valueAccessor, fn, getOwnerScope) {
|
|
1057
1057
|
};
|
1058
1058
|
}
|
1059
1059
|
function setTagVar(scope, childAccessor, tagVarSignal2) {
|
1060
|
-
scope[childAccessor]
|
1060
|
+
scope[childAccessor].e = (value2) => tagVarSignal2(scope, value2);
|
1061
1061
|
}
|
1062
|
-
var tagVarSignal = (scope, value2) => scope
|
1062
|
+
var tagVarSignal = (scope, value2) => scope.e?.(value2);
|
1063
1063
|
function setTagVarChange(scope, changeHandler) {
|
1064
|
-
scope
|
1064
|
+
scope.f = changeHandler;
|
1065
1065
|
}
|
1066
|
-
var tagVarSignalChange = (scope, value2) => scope
|
1066
|
+
var tagVarSignalChange = (scope, value2) => scope.f?.(value2), tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
1067
1067
|
function nextTagId({ $global }) {
|
1068
1068
|
let id = tagIdsByGlobal.get($global) || 0;
|
1069
1069
|
return tagIdsByGlobal.set($global, id + 1), "c" + $global.runtimeId + $global.renderId + id.toString(36);
|
@@ -1089,13 +1089,13 @@ function hoist(...path) {
|
|
1089
1089
|
|
1090
1090
|
// src/dom/control-flow.ts
|
1091
1091
|
function awaitTag(nodeAccessor, renderer) {
|
1092
|
-
let promiseAccessor =
|
1092
|
+
let promiseAccessor = "n" /* Promise */ + nodeAccessor, branchAccessor = "d" /* ConditionalScope */ + nodeAccessor;
|
1093
1093
|
return (scope, promise) => {
|
1094
|
-
let tryBranch = scope.
|
1095
|
-
for (; tryBranch && !tryBranch
|
1096
|
-
tryBranch = tryBranch.
|
1094
|
+
let tryBranch = scope.j, awaitBranch = scope[branchAccessor], referenceNode = scope[nodeAccessor], namespaceNode = (awaitBranch?.g ?? referenceNode).parentNode;
|
1095
|
+
for (; tryBranch && !tryBranch.d; )
|
1096
|
+
tryBranch = tryBranch.n;
|
1097
1097
|
let thisPromise = scope[promiseAccessor] = promise.then((data2) => {
|
1098
|
-
if (scope.
|
1098
|
+
if (scope.j?.q || scope[promiseAccessor] !== thisPromise)
|
1099
1099
|
return;
|
1100
1100
|
scope[promiseAccessor] = void 0;
|
1101
1101
|
let effects = prepareEffects(() => {
|
@@ -1108,15 +1108,15 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1108
1108
|
),
|
1109
1109
|
referenceNode.parentNode,
|
1110
1110
|
referenceNode
|
1111
|
-
), referenceNode.remove()), renderer.
|
1111
|
+
), referenceNode.remove()), renderer.k?.(awaitBranch, [data2]);
|
1112
1112
|
});
|
1113
1113
|
if (tryBranch) {
|
1114
|
-
if (!--tryBranch
|
1115
|
-
let placeholderBranch = tryBranch
|
1114
|
+
if (!--tryBranch.y) {
|
1115
|
+
let placeholderBranch = tryBranch.c;
|
1116
1116
|
placeholderBranch ? (insertBranchBefore(
|
1117
1117
|
tryBranch,
|
1118
|
-
placeholderBranch.
|
1119
|
-
placeholderBranch.
|
1118
|
+
placeholderBranch.g.parentNode,
|
1119
|
+
placeholderBranch.g
|
1120
1120
|
), removeAndDestroyBranch(placeholderBranch)) : insertBranchBefore(
|
1121
1121
|
tryBranch,
|
1122
1122
|
referenceNode.parentNode,
|
@@ -1126,43 +1126,43 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1126
1126
|
} else
|
1127
1127
|
runEffects(effects);
|
1128
1128
|
}).catch((error) => {
|
1129
|
-
let tryBranch2 = scope.
|
1130
|
-
for (; tryBranch2 && !tryBranch2
|
1131
|
-
tryBranch2 = tryBranch2.
|
1129
|
+
let tryBranch2 = scope.j;
|
1130
|
+
for (; tryBranch2 && !tryBranch2.b; )
|
1131
|
+
tryBranch2 = tryBranch2.n;
|
1132
1132
|
tryBranch2 ? (setConditionalRenderer(
|
1133
1133
|
tryBranch2._,
|
1134
|
-
tryBranch2
|
1135
|
-
tryBranch2
|
1134
|
+
tryBranch2.a,
|
1135
|
+
tryBranch2.b,
|
1136
1136
|
createAndSetupBranch
|
1137
|
-
), tryBranch2
|
1138
|
-
tryBranch2._[
|
1137
|
+
), tryBranch2.b.k?.(
|
1138
|
+
tryBranch2._["d" /* ConditionalScope */ + tryBranch2.a],
|
1139
1139
|
[error]
|
1140
1140
|
)) : setTimeout(() => {
|
1141
1141
|
throw error;
|
1142
1142
|
});
|
1143
1143
|
});
|
1144
|
-
tryBranch ? (tryBranch
|
1145
|
-
if (tryBranch
|
1146
|
-
let placeholderBranch = tryBranch
|
1144
|
+
tryBranch ? (tryBranch.y || (tryBranch.y = 0, requestAnimationFrame(() => {
|
1145
|
+
if (tryBranch.y && !tryBranch.q) {
|
1146
|
+
let placeholderBranch = tryBranch.c = createAndSetupBranch(
|
1147
1147
|
scope.$global,
|
1148
|
-
tryBranch
|
1148
|
+
tryBranch.d,
|
1149
1149
|
tryBranch._,
|
1150
|
-
tryBranch.
|
1150
|
+
tryBranch.g.parentNode
|
1151
1151
|
);
|
1152
1152
|
insertBranchBefore(
|
1153
1153
|
placeholderBranch,
|
1154
|
-
tryBranch.
|
1155
|
-
tryBranch.
|
1154
|
+
tryBranch.g.parentNode,
|
1155
|
+
tryBranch.g
|
1156
1156
|
), tempDetatchBranch(tryBranch);
|
1157
1157
|
}
|
1158
|
-
})), tryBranch
|
1158
|
+
})), tryBranch.y++) : awaitBranch && (awaitBranch.g.parentNode.insertBefore(
|
1159
1159
|
referenceNode,
|
1160
|
-
awaitBranch.
|
1160
|
+
awaitBranch.g
|
1161
1161
|
), tempDetatchBranch(awaitBranch));
|
1162
1162
|
};
|
1163
1163
|
}
|
1164
1164
|
function createTry(nodeAccessor, tryContent) {
|
1165
|
-
let branchAccessor =
|
1165
|
+
let branchAccessor = "d" /* ConditionalScope */ + nodeAccessor;
|
1166
1166
|
return (scope, input) => {
|
1167
1167
|
scope[branchAccessor] || setConditionalRenderer(
|
1168
1168
|
scope,
|
@@ -1171,13 +1171,13 @@ function createTry(nodeAccessor, tryContent) {
|
|
1171
1171
|
createAndSetupBranch
|
1172
1172
|
);
|
1173
1173
|
let branch = scope[branchAccessor];
|
1174
|
-
branch && (branch
|
1174
|
+
branch && (branch.a = nodeAccessor, branch.b = normalizeDynamicRenderer(input.catch), branch.d = normalizeDynamicRenderer(
|
1175
1175
|
input.placeholder
|
1176
1176
|
));
|
1177
1177
|
};
|
1178
1178
|
}
|
1179
1179
|
function conditional(nodeAccessor, ...branches) {
|
1180
|
-
let branchAccessor =
|
1180
|
+
let branchAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
|
1181
1181
|
return (scope, newBranch) => {
|
1182
1182
|
newBranch !== scope[branchAccessor] && setConditionalRenderer(
|
1183
1183
|
scope,
|
@@ -1191,10 +1191,10 @@ function patchDynamicTag(fn) {
|
|
1191
1191
|
dynamicTag = fn(dynamicTag);
|
1192
1192
|
}
|
1193
1193
|
var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
1194
|
-
let childScopeAccessor =
|
1194
|
+
let childScopeAccessor = "d" /* ConditionalScope */ + nodeAccessor, rendererAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
|
1195
1195
|
return (scope, newRenderer, getInput) => {
|
1196
1196
|
let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
|
1197
|
-
if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.
|
1197
|
+
if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.l || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor]))
|
1198
1198
|
if (setConditionalRenderer(
|
1199
1199
|
scope,
|
1200
1200
|
nodeAccessor,
|
@@ -1208,15 +1208,15 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1208
1208
|
0,
|
1209
1209
|
content,
|
1210
1210
|
createAndSetupBranch
|
1211
|
-
), content.
|
1212
|
-
content.
|
1213
|
-
content.
|
1214
|
-
scope[childScopeAccessor][
|
1211
|
+
), content.x && subscribeToScopeSet(
|
1212
|
+
content.u,
|
1213
|
+
content.x,
|
1214
|
+
scope[childScopeAccessor]["d" /* ConditionalScope */ + 0]
|
1215
1215
|
);
|
1216
1216
|
}
|
1217
|
-
} else normalizedRenderer?.
|
1218
|
-
normalizedRenderer.
|
1219
|
-
normalizedRenderer.
|
1217
|
+
} else normalizedRenderer?.x && subscribeToScopeSet(
|
1218
|
+
normalizedRenderer.u,
|
1219
|
+
normalizedRenderer.x,
|
1220
1220
|
scope[childScopeAccessor]
|
1221
1221
|
);
|
1222
1222
|
if (normalizedRenderer) {
|
@@ -1227,9 +1227,9 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1227
1227
|
0,
|
1228
1228
|
(inputIsArgs ? args[0] : args) || {}
|
1229
1229
|
);
|
1230
|
-
else if (normalizedRenderer.
|
1230
|
+
else if (normalizedRenderer.k)
|
1231
1231
|
if (inputIsArgs)
|
1232
|
-
normalizedRenderer.
|
1232
|
+
normalizedRenderer.k(
|
1233
1233
|
scope[childScopeAccessor],
|
1234
1234
|
normalizedRenderer._ ? args[0] : args
|
1235
1235
|
);
|
@@ -1238,7 +1238,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1238
1238
|
...args,
|
1239
1239
|
content: getContent(scope)
|
1240
1240
|
} : args || {};
|
1241
|
-
normalizedRenderer.
|
1241
|
+
normalizedRenderer.k(
|
1242
1242
|
scope[childScopeAccessor],
|
1243
1243
|
normalizedRenderer._ ? inputWithContent : [inputWithContent]
|
1244
1244
|
);
|
@@ -1247,8 +1247,8 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1247
1247
|
};
|
1248
1248
|
};
|
1249
1249
|
function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2) {
|
1250
|
-
let referenceNode = scope[nodeAccessor], prevBranch = scope[
|
1251
|
-
referenceNode === parentNode ? (prevBranch && (destroyBranch(prevBranch), referenceNode.textContent = ""), newBranch && insertBranchBefore(newBranch, parentNode, null)) : prevBranch ? (newBranch ? insertBranchBefore(newBranch, parentNode, prevBranch.
|
1250
|
+
let referenceNode = scope[nodeAccessor], prevBranch = scope["d" /* ConditionalScope */ + nodeAccessor], parentNode = referenceNode.nodeType > 1 /* Element */ ? (prevBranch?.g || referenceNode).parentNode : referenceNode, newBranch = scope["d" /* ConditionalScope */ + nodeAccessor] = newRenderer && createBranch2(scope.$global, newRenderer, scope, parentNode);
|
1251
|
+
referenceNode === parentNode ? (prevBranch && (destroyBranch(prevBranch), referenceNode.textContent = ""), newBranch && insertBranchBefore(newBranch, parentNode, null)) : prevBranch ? (newBranch ? insertBranchBefore(newBranch, parentNode, prevBranch.g) : parentNode.insertBefore(referenceNode, prevBranch.g), removeAndDestroyBranch(prevBranch)) : newBranch && (insertBranchBefore(newBranch, parentNode, referenceNode), referenceNode.remove());
|
1252
1252
|
}
|
1253
1253
|
function loopOf(nodeAccessor, renderer) {
|
1254
1254
|
return loop(
|
@@ -1277,17 +1277,17 @@ function loopTo(nodeAccessor, renderer) {
|
|
1277
1277
|
);
|
1278
1278
|
}
|
1279
1279
|
function loop(nodeAccessor, renderer, forEach) {
|
1280
|
-
let params = renderer.
|
1280
|
+
let params = renderer.k;
|
1281
1281
|
return (scope, value2) => {
|
1282
|
-
let referenceNode = scope[nodeAccessor], oldMap = scope[
|
1282
|
+
let referenceNode = scope[nodeAccessor], oldMap = scope["m" /* LoopScopeMap */ + nodeAccessor], oldArray = oldMap ? scope["l" /* LoopScopeArray */ + nodeAccessor] || [
|
1283
1283
|
...oldMap.values()
|
1284
|
-
] : [], parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0].
|
1284
|
+
] : [], parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0].g.parentNode : referenceNode, newMap = scope["m" /* LoopScopeMap */ + nodeAccessor] = /* @__PURE__ */ new Map(), newArray = scope["l" /* LoopScopeArray */ + nodeAccessor] = [];
|
1285
1285
|
forEach(value2, (key, args) => {
|
1286
1286
|
let branch = oldMap?.get(key) || createAndSetupBranch(scope.$global, renderer, scope, parentNode);
|
1287
1287
|
params?.(branch, args), newMap.set(key, branch), newArray.push(branch);
|
1288
1288
|
});
|
1289
1289
|
let afterReference = null;
|
1290
|
-
referenceNode !== parentNode && (oldArray.length ? (afterReference = oldArray[oldArray.length - 1].
|
1290
|
+
referenceNode !== parentNode && (oldArray.length ? (afterReference = oldArray[oldArray.length - 1].h.nextSibling, newArray.length || parentNode.insertBefore(referenceNode, afterReference)) : newArray.length && (afterReference = referenceNode.nextSibling, referenceNode.remove())), reconcile(parentNode, oldArray, newArray, afterReference);
|
1291
1291
|
};
|
1292
1292
|
}
|
1293
1293
|
function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
|
@@ -1297,7 +1297,7 @@ function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentSco
|
|
1297
1297
|
parentScope,
|
1298
1298
|
parentNode
|
1299
1299
|
);
|
1300
|
-
return typeof tagNameOrRenderer == "string" ? branch[0] = branch.
|
1300
|
+
return typeof tagNameOrRenderer == "string" ? branch[0] = branch.g = branch.h = document.createElementNS(
|
1301
1301
|
tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI,
|
1302
1302
|
tagNameOrRenderer
|
1303
1303
|
) : setupBranch(tagNameOrRenderer, branch), branch;
|
@@ -1311,20 +1311,20 @@ function byFirstArg(name) {
|
|
1311
1311
|
|
1312
1312
|
// src/dom/queue.ts
|
1313
1313
|
var pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), pendingEffects = [], rendering = !1, scopeKeyOffset = 1e3;
|
1314
|
-
function queueRender(scope, signal, signalKey, value2, scopeKey = scope.
|
1314
|
+
function queueRender(scope, signal, signalKey, value2, scopeKey = scope.l) {
|
1315
1315
|
let key = scopeKey * scopeKeyOffset + signalKey, existingRender = signalKey >= 0 && pendingRendersLookup.get(key);
|
1316
1316
|
if (existingRender)
|
1317
|
-
existingRender.
|
1317
|
+
existingRender.G = value2;
|
1318
1318
|
else {
|
1319
1319
|
let render = {
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1320
|
+
p: key,
|
1321
|
+
C: scope,
|
1322
|
+
J: signal,
|
1323
|
+
G: value2
|
1324
1324
|
}, i = pendingRenders.push(render) - 1;
|
1325
1325
|
for (; i; ) {
|
1326
1326
|
let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
|
1327
|
-
if (key - parent.
|
1327
|
+
if (key - parent.p >= 0) break;
|
1328
1328
|
pendingRenders[i] = parent, i = parentIndex;
|
1329
1329
|
}
|
1330
1330
|
signalKey >= 0 && pendingRendersLookup.set(key, render), pendingRenders[i] = render;
|
@@ -1363,36 +1363,36 @@ function runRenders() {
|
|
1363
1363
|
for (; pendingRenders.length; ) {
|
1364
1364
|
let render = pendingRenders[0], item = pendingRenders.pop();
|
1365
1365
|
if (render !== item) {
|
1366
|
-
let i = 0, mid = pendingRenders.length >> 1, key = (pendingRenders[0] = item).
|
1366
|
+
let i = 0, mid = pendingRenders.length >> 1, key = (pendingRenders[0] = item).p;
|
1367
1367
|
for (; i < mid; ) {
|
1368
1368
|
let bestChild = (i << 1) + 1, right = bestChild + 1;
|
1369
|
-
if (right < pendingRenders.length && pendingRenders[right].
|
1369
|
+
if (right < pendingRenders.length && pendingRenders[right].p - pendingRenders[bestChild].p < 0 && (bestChild = right), pendingRenders[bestChild].p - key >= 0)
|
1370
1370
|
break;
|
1371
1371
|
pendingRenders[i] = pendingRenders[bestChild], i = bestChild;
|
1372
1372
|
}
|
1373
1373
|
pendingRenders[i] = item;
|
1374
1374
|
}
|
1375
|
-
render.
|
1375
|
+
render.C.j?.q || runRender(render);
|
1376
1376
|
}
|
1377
1377
|
finishPendingScopes();
|
1378
1378
|
}
|
1379
|
-
var runRender = (render) => render.
|
1379
|
+
var runRender = (render) => render.J(render.C, render.G), enableCatch = () => {
|
1380
1380
|
enableCatch = () => {
|
1381
1381
|
}, runRender = /* @__PURE__ */ ((runRender2) => (render) => {
|
1382
1382
|
try {
|
1383
1383
|
runRender2(render);
|
1384
1384
|
} catch (error) {
|
1385
|
-
let branch = render.
|
1386
|
-
for (; branch && !branch
|
1387
|
-
branch = branch.
|
1385
|
+
let branch = render.C.j;
|
1386
|
+
for (; branch && !branch.b; )
|
1387
|
+
branch = branch.n;
|
1388
1388
|
if (branch)
|
1389
1389
|
setConditionalRenderer(
|
1390
1390
|
branch._,
|
1391
|
-
branch
|
1392
|
-
branch
|
1391
|
+
branch.a,
|
1392
|
+
branch.b,
|
1393
1393
|
createAndSetupBranch
|
1394
|
-
), branch
|
1395
|
-
branch._[
|
1394
|
+
), branch.b.k?.(
|
1395
|
+
branch._["d" /* ConditionalScope */ + branch.a],
|
1396
1396
|
[error]
|
1397
1397
|
);
|
1398
1398
|
else
|
@@ -1403,11 +1403,11 @@ var runRender = (render) => render.C(render.t, render.z), enableCatch = () => {
|
|
1403
1403
|
|
1404
1404
|
// src/dom/abort-signal.ts
|
1405
1405
|
function resetAbortSignal(scope, id) {
|
1406
|
-
let ctrl = scope.
|
1407
|
-
ctrl && (queueEffect(ctrl, abort), scope.
|
1406
|
+
let ctrl = scope.t?.[id];
|
1407
|
+
ctrl && (queueEffect(ctrl, abort), scope.t[id] = void 0);
|
1408
1408
|
}
|
1409
1409
|
function getAbortSignal(scope, id) {
|
1410
|
-
return scope.
|
1410
|
+
return scope.j && (scope.j.H ||= /* @__PURE__ */ new Set()).add(scope), ((scope.t ||= {})[id] ||= new AbortController()).signal;
|
1411
1411
|
}
|
1412
1412
|
function abort(ctrl) {
|
1413
1413
|
ctrl.abort();
|
@@ -1429,13 +1429,13 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1429
1429
|
register(RENDERER_REGISTER_ID, fn);
|
1430
1430
|
},
|
1431
1431
|
isRenderer(renderer) {
|
1432
|
-
return renderer.
|
1432
|
+
return renderer.A;
|
1433
1433
|
},
|
1434
1434
|
getStartNode(branch) {
|
1435
|
-
return branch.
|
1435
|
+
return branch.g;
|
1436
1436
|
},
|
1437
1437
|
setScopeNodes(branch, startNode, endNode) {
|
1438
|
-
branch.
|
1438
|
+
branch.g = startNode, branch.h = endNode;
|
1439
1439
|
},
|
1440
1440
|
runComponentEffects() {
|
1441
1441
|
runEffects(this.effects);
|
@@ -1454,9 +1454,9 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1454
1454
|
},
|
1455
1455
|
createRenderer(params, clone) {
|
1456
1456
|
let renderer = createRenderer(0, 0, 0, params);
|
1457
|
-
return renderer.
|
1457
|
+
return renderer.A = (branch) => {
|
1458
1458
|
let cloned = clone();
|
1459
|
-
branch.
|
1459
|
+
branch.g = cloned.startNode, branch.h = cloned.endNode;
|
1460
1460
|
}, renderer;
|
1461
1461
|
},
|
1462
1462
|
render(out, component, renderer, args) {
|
@@ -1469,14 +1469,14 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1469
1469
|
normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
1470
1470
|
}
|
1471
1471
|
if (component.effects = prepareEffects(() => {
|
1472
|
-
branch ? existing = !0 : (out.global.
|
1472
|
+
branch ? existing = !0 : (out.global.m ||= 0, branch = component.scope = createAndSetupBranch(
|
1473
1473
|
out.global,
|
1474
1474
|
renderer,
|
1475
|
-
renderer.
|
1475
|
+
renderer.u,
|
1476
1476
|
document.body
|
1477
|
-
)), renderer.
|
1477
|
+
)), renderer.k?.(branch, renderer._ ? args[0] : args);
|
1478
1478
|
}), !existing)
|
1479
|
-
return toInsertNode(branch.
|
1479
|
+
return toInsertNode(branch.g, branch.h);
|
1480
1480
|
}
|
1481
1481
|
};
|
1482
1482
|
|
@@ -1494,12 +1494,12 @@ var createTemplate = (id, template, walks, setup, inputSignal) => {
|
|
1494
1494
|
function mount(input = {}, reference, position) {
|
1495
1495
|
let branch, parentNode = reference, nextSibling = null, { $global } = input;
|
1496
1496
|
switch ($global ? ({ $global, ...input } = input, $global = {
|
1497
|
-
|
1497
|
+
m: 0,
|
1498
1498
|
runtimeId: DEFAULT_RUNTIME_ID,
|
1499
1499
|
renderId: DEFAULT_RENDER_ID,
|
1500
1500
|
...$global
|
1501
1501
|
}) : $global = {
|
1502
|
-
|
1502
|
+
m: 0,
|
1503
1503
|
runtimeId: DEFAULT_RUNTIME_ID,
|
1504
1504
|
renderId: DEFAULT_RENDER_ID
|
1505
1505
|
}, position) {
|
@@ -1513,19 +1513,19 @@ function mount(input = {}, reference, position) {
|
|
1513
1513
|
parentNode = reference.parentNode, nextSibling = reference.nextSibling;
|
1514
1514
|
break;
|
1515
1515
|
}
|
1516
|
-
let args = this.
|
1516
|
+
let args = this.k, effects = prepareEffects(() => {
|
1517
1517
|
branch = createBranch(
|
1518
1518
|
$global,
|
1519
1519
|
this,
|
1520
1520
|
void 0,
|
1521
1521
|
parentNode
|
1522
|
-
), this.
|
1522
|
+
), this.B?.(branch), args?.(branch, input);
|
1523
1523
|
});
|
1524
1524
|
return insertChildNodes(
|
1525
1525
|
parentNode,
|
1526
1526
|
nextSibling,
|
1527
|
-
branch.
|
1528
|
-
branch.
|
1527
|
+
branch.g,
|
1528
|
+
branch.h
|
1529
1529
|
), runEffects(effects), {
|
1530
1530
|
update(newInput) {
|
1531
1531
|
args && runEffects(
|