marko 6.0.0-next.3.60 → 6.0.0-next.3.61
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 +24 -0
- package/dist/common/accessor.debug.d.ts +24 -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 +68 -68
- package/dist/dom.mjs +68 -68
- package/dist/html.js +7 -7
- package/dist/html.mjs +7 -7
- package/dist/translator/index.js +82 -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
@@ -0,0 +1,24 @@
|
|
1
|
+
export declare enum AccessorPrefix {
|
2
|
+
ClosureScopes = "a",
|
3
|
+
ClosureSignalIndex = "b",
|
4
|
+
ConditionalRenderer = "c",
|
5
|
+
ConditionalScope = "d",
|
6
|
+
ControlledHandler = "e",
|
7
|
+
ControlledType = "f",
|
8
|
+
ControlledValue = "g",
|
9
|
+
DynamicPlaceholderLastChild = "h",
|
10
|
+
EventAttributes = "i",
|
11
|
+
Getter = "j",
|
12
|
+
LifecycleAbortController = "k",
|
13
|
+
LoopScopeArray = "l",
|
14
|
+
LoopScopeMap = "m",
|
15
|
+
Promise = "n"
|
16
|
+
}
|
17
|
+
export declare enum AccessorProp {
|
18
|
+
BranchAccessor = "*",
|
19
|
+
CatchContent = "^",
|
20
|
+
PlaceholderBranch = "#",
|
21
|
+
PlaceholderContent = "%",
|
22
|
+
TagVariable = "/",
|
23
|
+
TagVariableChange = "@"
|
24
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
export declare enum AccessorPrefix {
|
2
|
+
ClosureScopes = "ClosureScopes:",
|
3
|
+
ClosureSignalIndex = "ClosureSignalIndex:",
|
4
|
+
ConditionalRenderer = "ConditionalRenderer:",
|
5
|
+
ConditionalScope = "ConditionalScope:",
|
6
|
+
ControlledHandler = "ControlledHandler:",
|
7
|
+
ControlledType = "ControlledType:",
|
8
|
+
ControlledValue = "ControlledValue:",
|
9
|
+
DynamicPlaceholderLastChild = "DynamicPlaceholderLastChild:",
|
10
|
+
EventAttributes = "EventAttributes:",
|
11
|
+
Getter = "Getter:",
|
12
|
+
LifecycleAbortController = "LifecycleAbortController:",
|
13
|
+
LoopScopeArray = "LoopScopeArray:",
|
14
|
+
LoopScopeMap = "LoopScopeMap:",
|
15
|
+
Promise = "Promise:"
|
16
|
+
}
|
17
|
+
export declare enum AccessorProp {
|
18
|
+
BranchAccessor = "*BranchAccessor",
|
19
|
+
CatchContent = "^CatchContent",
|
20
|
+
PlaceholderBranch = "#PlaceholderBranch",
|
21
|
+
PlaceholderContent = "%PlaceholderContent",
|
22
|
+
TagVariable = "/TagVariable",
|
23
|
+
TagVariableChange = "@TagVariableChange"
|
24
|
+
}
|
package/dist/common/types.d.ts
CHANGED
@@ -9,6 +9,7 @@ export interface BranchScope extends Scope {
|
|
9
9
|
___abortScopes: Set<Scope> | undefined;
|
10
10
|
___branchScopes: Set<BranchScope> | undefined;
|
11
11
|
___renderer: ClientRenderer | string;
|
12
|
+
___pendingAsyncCount: number | undefined;
|
12
13
|
}
|
13
14
|
export interface Scope {
|
14
15
|
$global: Record<string, unknown> & {
|
@@ -30,29 +31,7 @@ export declare enum ResumeSymbol {
|
|
30
31
|
BranchSingleNodeOnlyChildInParent = "=",
|
31
32
|
ClosestBranch = "$"
|
32
33
|
}
|
33
|
-
export
|
34
|
-
ClosureScopes = "!",
|
35
|
-
ClosureSignalIndex = "(",
|
36
|
-
ConditionalScope = "!",
|
37
|
-
ConditionalRenderer = "(",
|
38
|
-
LoopScopeArray = "!",
|
39
|
-
LoopScopeMap = "(",
|
40
|
-
LifecycleAbortController = "-",
|
41
|
-
DynamicPlaceholderLastChild = "-",
|
42
|
-
TagVariable = "/",
|
43
|
-
TagVariableChange = "@",
|
44
|
-
EventAttributes = "~",
|
45
|
-
ControlledValue = ":",
|
46
|
-
ControlledHandler = ";",
|
47
|
-
ControlledType = "=",
|
48
|
-
Getter = ">",
|
49
|
-
BranchAccessor = "*",
|
50
|
-
CatchContent = "^",
|
51
|
-
PlaceholderContent = "%",
|
52
|
-
PlaceholderBranch = "#",
|
53
|
-
PendingCount = ".",
|
54
|
-
Promise = "?"
|
55
|
-
}
|
34
|
+
export { AccessorPrefix, AccessorProp } from "./accessor.debug";
|
56
35
|
export declare enum NodeType {
|
57
36
|
Element = 1,
|
58
37
|
Text = 3,
|
package/dist/debug/dom.js
CHANGED
@@ -322,7 +322,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
322
322
|
const token = commentText[commentPrefixLen];
|
323
323
|
if (token === "*" /* Node */) {
|
324
324
|
const node = scope[data2] = visit.previousSibling;
|
325
|
-
scope[
|
325
|
+
scope["Getter:" /* Getter */ + data2] = () => node;
|
326
326
|
} else if (token === "$" /* ClosestBranch */) {
|
327
327
|
closestBranchMarkers.set(scopeId, visit);
|
328
328
|
} else if (token === "[" /* BranchStart */) {
|
@@ -467,7 +467,7 @@ function controllable_input_checked(scope, nodeAccessor, checked, checkedChange)
|
|
467
467
|
function controllable_input_checked_effect(scope, nodeAccessor) {
|
468
468
|
const el = scope[nodeAccessor];
|
469
469
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
470
|
-
const checkedChange = scope[
|
470
|
+
const checkedChange = scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor];
|
471
471
|
if (checkedChange) {
|
472
472
|
const newValue = el.checked;
|
473
473
|
el.checked = !newValue;
|
@@ -477,7 +477,7 @@ function controllable_input_checked_effect(scope, nodeAccessor) {
|
|
477
477
|
});
|
478
478
|
}
|
479
479
|
function controllable_input_checkedValue(scope, nodeAccessor, checkedValue, checkedValueChange, value2) {
|
480
|
-
scope[
|
480
|
+
scope["ControlledValue:" /* ControlledValue */ + nodeAccessor] = checkedValue;
|
481
481
|
attr(scope[nodeAccessor], "value", value2);
|
482
482
|
setCheckboxValue(
|
483
483
|
scope,
|
@@ -490,9 +490,9 @@ function controllable_input_checkedValue(scope, nodeAccessor, checkedValue, chec
|
|
490
490
|
function controllable_input_checkedValue_effect(scope, nodeAccessor) {
|
491
491
|
const el = scope[nodeAccessor];
|
492
492
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
493
|
-
const checkedValueChange = scope[
|
493
|
+
const checkedValueChange = scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor];
|
494
494
|
if (checkedValueChange) {
|
495
|
-
const oldValue = scope[
|
495
|
+
const oldValue = scope["ControlledValue:" /* ControlledValue */ + nodeAccessor];
|
496
496
|
const newValue = Array.isArray(oldValue) ? updateList(oldValue, el.value, el.checked) : el.checked ? el.value : void 0;
|
497
497
|
if (el.name && el.type[0] === "r") {
|
498
498
|
for (const radio of el.getRootNode().querySelectorAll(
|
@@ -513,33 +513,33 @@ function controllable_input_checkedValue_effect(scope, nodeAccessor) {
|
|
513
513
|
function controllable_input_value(scope, nodeAccessor, value2, valueChange) {
|
514
514
|
const el = scope[nodeAccessor];
|
515
515
|
const normalizedValue = normalizeStrProp(value2);
|
516
|
-
scope[
|
516
|
+
scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor] = valueChange;
|
517
517
|
if (valueChange) {
|
518
|
-
scope[
|
519
|
-
scope[
|
518
|
+
scope["ControlledType:" /* ControlledType */ + nodeAccessor] = 0 /* InputChecked */;
|
519
|
+
scope["ControlledValue:" /* ControlledValue */ + nodeAccessor] = value2;
|
520
520
|
if (el.isConnected) {
|
521
521
|
setValueAndUpdateSelection(el, normalizedValue);
|
522
522
|
} else {
|
523
523
|
el.defaultValue = normalizedValue;
|
524
524
|
}
|
525
525
|
} else {
|
526
|
-
scope[
|
526
|
+
scope["ControlledType:" /* ControlledType */ + nodeAccessor] = 5 /* None */;
|
527
527
|
el.defaultValue = normalizedValue;
|
528
528
|
}
|
529
529
|
}
|
530
530
|
function controllable_input_value_effect(scope, nodeAccessor) {
|
531
531
|
const el = scope[nodeAccessor];
|
532
532
|
if (isResuming) {
|
533
|
-
scope[
|
533
|
+
scope["ControlledValue:" /* ControlledValue */ + nodeAccessor] = el.defaultValue;
|
534
534
|
}
|
535
535
|
syncControllable(el, "input", hasValueChanged, (ev) => {
|
536
|
-
const valueChange = scope[
|
536
|
+
const valueChange = scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor];
|
537
537
|
if (valueChange) {
|
538
538
|
const newValue = el.value;
|
539
539
|
inputType = ev?.inputType;
|
540
540
|
setValueAndUpdateSelection(
|
541
541
|
el,
|
542
|
-
scope[
|
542
|
+
scope["ControlledValue:" /* ControlledValue */ + nodeAccessor]
|
543
543
|
);
|
544
544
|
valueChange(newValue);
|
545
545
|
run();
|
@@ -548,12 +548,12 @@ function controllable_input_value_effect(scope, nodeAccessor) {
|
|
548
548
|
});
|
549
549
|
}
|
550
550
|
function controllable_select_value(scope, nodeAccessor, value2, valueChange) {
|
551
|
-
scope[
|
551
|
+
scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor] = valueChange;
|
552
552
|
if (valueChange) {
|
553
|
-
scope[
|
554
|
-
scope[
|
553
|
+
scope["ControlledType:" /* ControlledType */ + nodeAccessor] = 3 /* SelectValue */;
|
554
|
+
scope["ControlledValue:" /* ControlledValue */ + nodeAccessor] = value2;
|
555
555
|
} else {
|
556
|
-
scope[
|
556
|
+
scope["ControlledType:" /* ControlledType */ + nodeAccessor] = 5 /* None */;
|
557
557
|
}
|
558
558
|
pendingEffects.unshift(
|
559
559
|
() => setSelectOptions(
|
@@ -567,14 +567,14 @@ function controllable_select_value(scope, nodeAccessor, value2, valueChange) {
|
|
567
567
|
function controllable_select_value_effect(scope, nodeAccessor) {
|
568
568
|
const el = scope[nodeAccessor];
|
569
569
|
const onChange = () => {
|
570
|
-
const valueChange = scope[
|
570
|
+
const valueChange = scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor];
|
571
571
|
if (valueChange) {
|
572
572
|
const newValue = Array.isArray(
|
573
|
-
scope[
|
573
|
+
scope["ControlledValue:" /* ControlledValue */ + nodeAccessor]
|
574
574
|
) ? Array.from(el.selectedOptions, toValueProp) : el.value;
|
575
575
|
setSelectOptions(
|
576
576
|
el,
|
577
|
-
scope[
|
577
|
+
scope["ControlledValue:" /* ControlledValue */ + nodeAccessor],
|
578
578
|
valueChange
|
579
579
|
);
|
580
580
|
valueChange(newValue);
|
@@ -583,7 +583,7 @@ function controllable_select_value_effect(scope, nodeAccessor) {
|
|
583
583
|
};
|
584
584
|
if (!el._) {
|
585
585
|
new MutationObserver(() => {
|
586
|
-
const value2 = scope[
|
586
|
+
const value2 = scope["ControlledValue:" /* ControlledValue */ + nodeAccessor];
|
587
587
|
if (Array.isArray(value2) ? value2.length !== el.selectedOptions.length || value2.some((value3, i) => value3 != el.selectedOptions[i].value) : el.value != value2) {
|
588
588
|
onChange();
|
589
589
|
}
|
@@ -616,23 +616,23 @@ function setSelectOptions(el, value2, valueChange) {
|
|
616
616
|
}
|
617
617
|
}
|
618
618
|
function controllable_detailsOrDialog_open(scope, nodeAccessor, open, openChange) {
|
619
|
-
scope[
|
619
|
+
scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor] = openChange;
|
620
620
|
if (openChange) {
|
621
|
-
scope[
|
621
|
+
scope["ControlledType:" /* ControlledType */ + nodeAccessor] = 4 /* DetailsOrDialogOpen */;
|
622
622
|
} else {
|
623
|
-
scope[
|
623
|
+
scope["ControlledType:" /* ControlledType */ + nodeAccessor] = 5 /* None */;
|
624
624
|
}
|
625
|
-
scope[nodeAccessor].open = scope[
|
625
|
+
scope[nodeAccessor].open = scope["ControlledValue:" /* ControlledValue */ + nodeAccessor] = normalizeBoolProp(open);
|
626
626
|
}
|
627
627
|
function controllable_detailsOrDialog_open_effect(scope, nodeAccessor) {
|
628
628
|
const el = scope[nodeAccessor];
|
629
|
-
const hasChanged = () => el.open !== scope[
|
629
|
+
const hasChanged = () => el.open !== scope["ControlledValue:" /* ControlledValue */ + nodeAccessor];
|
630
630
|
syncControllable(
|
631
631
|
el,
|
632
632
|
el.tagName === "DIALOG" ? "close" : "toggle",
|
633
633
|
hasChanged,
|
634
634
|
() => {
|
635
|
-
const openChange = scope[
|
635
|
+
const openChange = scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor];
|
636
636
|
if (openChange && hasChanged()) {
|
637
637
|
const newValue = el.open;
|
638
638
|
el.open = !newValue;
|
@@ -657,12 +657,12 @@ function setValueAndUpdateSelection(el, value2) {
|
|
657
657
|
}
|
658
658
|
}
|
659
659
|
function setCheckboxValue(scope, nodeAccessor, type, checked, checkedChange) {
|
660
|
-
scope[
|
660
|
+
scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor] = checkedChange;
|
661
661
|
if (checkedChange) {
|
662
|
-
scope[
|
662
|
+
scope["ControlledType:" /* ControlledType */ + nodeAccessor] = type;
|
663
663
|
scope[nodeAccessor].checked = checked;
|
664
664
|
} else {
|
665
|
-
scope[
|
665
|
+
scope["ControlledType:" /* ControlledType */ + nodeAccessor] = 5 /* None */;
|
666
666
|
scope[nodeAccessor].defaultChecked = checked;
|
667
667
|
}
|
668
668
|
}
|
@@ -874,7 +874,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
874
874
|
break;
|
875
875
|
default: {
|
876
876
|
if (isEventHandler(name)) {
|
877
|
-
(events ||= scope[
|
877
|
+
(events ||= scope["EventAttributes:" /* EventAttributes */ + nodeAccessor] = {})[getEventHandlerName(name)] = value2;
|
878
878
|
} else if (!skip?.test(name)) {
|
879
879
|
attr(el, name, value2);
|
880
880
|
}
|
@@ -884,8 +884,8 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
884
884
|
}
|
885
885
|
function attrsEvents(scope, nodeAccessor) {
|
886
886
|
const el = scope[nodeAccessor];
|
887
|
-
const events = scope[
|
888
|
-
switch (scope[
|
887
|
+
const events = scope["EventAttributes:" /* EventAttributes */ + nodeAccessor];
|
888
|
+
switch (scope["ControlledType:" /* ControlledType */ + nodeAccessor]) {
|
889
889
|
case 0 /* InputChecked */:
|
890
890
|
controllable_input_checked_effect(scope, nodeAccessor);
|
891
891
|
break;
|
@@ -909,7 +909,7 @@ function attrsEvents(scope, nodeAccessor) {
|
|
909
909
|
function html(scope, value2, accessor) {
|
910
910
|
const firstChild = scope[accessor];
|
911
911
|
const parentNode = firstChild.parentNode;
|
912
|
-
const lastChild = scope[
|
912
|
+
const lastChild = scope["DynamicPlaceholderLastChild:" /* DynamicPlaceholderLastChild */ + accessor] || firstChild;
|
913
913
|
const newContent = parseHTML(
|
914
914
|
value2 || value2 === 0 ? value2 + "" : "",
|
915
915
|
parentNode.namespaceURI
|
@@ -918,7 +918,7 @@ function html(scope, value2, accessor) {
|
|
918
918
|
parentNode,
|
919
919
|
firstChild,
|
920
920
|
scope[accessor] = newContent.firstChild || newContent.appendChild(new Text()),
|
921
|
-
scope[
|
921
|
+
scope["DynamicPlaceholderLastChild:" /* DynamicPlaceholderLastChild */ + accessor] = newContent.lastChild
|
922
922
|
);
|
923
923
|
removeChildNodes(firstChild, lastChild);
|
924
924
|
}
|
@@ -956,7 +956,7 @@ function lifecycle(scope, index, thisObj) {
|
|
956
956
|
thisObj.onMount?.();
|
957
957
|
getAbortSignal(
|
958
958
|
scope,
|
959
|
-
"
|
959
|
+
"LifecycleAbortController:" /* LifecycleAbortController */ + index
|
960
960
|
).onabort = () => thisObj.onDestroy?.();
|
961
961
|
}
|
962
962
|
}
|
@@ -1033,7 +1033,7 @@ function insertBranchBefore(branch, parentNode, nextSibling) {
|
|
1033
1033
|
}
|
1034
1034
|
function tempDetatchBranch(branch) {
|
1035
1035
|
insertChildNodes(
|
1036
|
-
|
1036
|
+
new DocumentFragment(),
|
1037
1037
|
null,
|
1038
1038
|
branch.___startNode,
|
1039
1039
|
branch.___endNode
|
@@ -1224,7 +1224,7 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
1224
1224
|
if (value2 === 32 /* Get */) {
|
1225
1225
|
const node = walker.currentNode;
|
1226
1226
|
scope[true ? getDebugKey(currentScopeIndex, walker.currentNode) : currentScopeIndex] = node;
|
1227
|
-
scope[(true ? getDebugKey(currentScopeIndex++, walker.currentNode) : currentScopeIndex++)
|
1227
|
+
scope["Getter:" /* Getter */ + (true ? getDebugKey(currentScopeIndex++, walker.currentNode) : currentScopeIndex++)] = () => node;
|
1228
1228
|
} else if (value2 === 37 /* Replace */ || value2 === 49 /* DynamicTagWithVar */) {
|
1229
1229
|
walker.currentNode.replaceWith(
|
1230
1230
|
walker.currentNode = scope[true ? getDebugKey(currentScopeIndex++, "#text") : currentScopeIndex++] = new Text()
|
@@ -1437,7 +1437,7 @@ function state(valueAccessor, fn) {
|
|
1437
1437
|
valueAccessor.lastIndexOf("/")
|
1438
1438
|
);
|
1439
1439
|
}
|
1440
|
-
const valueChangeAccessor =
|
1440
|
+
const valueChangeAccessor = "@TagVariableChange" /* TagVariableChange */ + valueAccessor;
|
1441
1441
|
const update = (scope, value2) => {
|
1442
1442
|
if (scope[valueAccessor] !== value2) {
|
1443
1443
|
scope[valueAccessor] = value2;
|
@@ -1488,8 +1488,8 @@ function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__
|
|
1488
1488
|
}
|
1489
1489
|
function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
1490
1490
|
const childSignal = closure(valueAccessor, fn);
|
1491
|
-
const loopScopeAccessor =
|
1492
|
-
const loopScopeMapAccessor =
|
1491
|
+
const loopScopeAccessor = "LoopScopeArray:" /* LoopScopeArray */ + ownerLoopNodeAccessor;
|
1492
|
+
const loopScopeMapAccessor = "LoopScopeMap:" /* LoopScopeMap */ + ownerLoopNodeAccessor;
|
1493
1493
|
const ownerSignal = (ownerScope) => {
|
1494
1494
|
const scopes = ownerScope[loopScopeAccessor] || ownerScope[loopScopeMapAccessor]?.values() || [];
|
1495
1495
|
const [firstScope] = scopes;
|
@@ -1514,8 +1514,8 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
1514
1514
|
}
|
1515
1515
|
function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch, fn) {
|
1516
1516
|
const childSignal = closure(valueAccessor, fn);
|
1517
|
-
const scopeAccessor =
|
1518
|
-
const branchAccessor =
|
1517
|
+
const scopeAccessor = "ConditionalScope:" /* ConditionalScope */ + ownerConditionalNodeAccessor;
|
1518
|
+
const branchAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + ownerConditionalNodeAccessor;
|
1519
1519
|
const ownerSignal = (scope) => {
|
1520
1520
|
const ifScope = scope[scopeAccessor];
|
1521
1521
|
if (ifScope && !ifScope.___pending && scope[branchAccessor] === branch) {
|
@@ -1565,8 +1565,8 @@ function dynamicClosureRead(valueAccessor, fn, getOwnerScope) {
|
|
1565
1565
|
scope
|
1566
1566
|
);
|
1567
1567
|
};
|
1568
|
-
closureSignal.___scopeInstancesAccessor =
|
1569
|
-
closureSignal.___signalIndexAccessor =
|
1568
|
+
closureSignal.___scopeInstancesAccessor = "ClosureScopes:" /* ClosureScopes */ + valueAccessor;
|
1569
|
+
closureSignal.___signalIndexAccessor = "ClosureSignalIndex:" /* ClosureSignalIndex */ + valueAccessor;
|
1570
1570
|
return closureSignal;
|
1571
1571
|
}
|
1572
1572
|
function closure(valueAccessor, fn, getOwnerScope) {
|
@@ -1575,13 +1575,13 @@ function closure(valueAccessor, fn, getOwnerScope) {
|
|
1575
1575
|
};
|
1576
1576
|
}
|
1577
1577
|
function setTagVar(scope, childAccessor, tagVarSignal2) {
|
1578
|
-
scope[childAccessor]["/" /* TagVariable */] = (value2) => tagVarSignal2(scope, value2);
|
1578
|
+
scope[childAccessor]["/TagVariable" /* TagVariable */] = (value2) => tagVarSignal2(scope, value2);
|
1579
1579
|
}
|
1580
|
-
var tagVarSignal = (scope, value2) => scope["/" /* TagVariable */]?.(value2);
|
1580
|
+
var tagVarSignal = (scope, value2) => scope["/TagVariable" /* TagVariable */]?.(value2);
|
1581
1581
|
function setTagVarChange(scope, changeHandler) {
|
1582
|
-
scope["@" /* TagVariableChange */] = changeHandler;
|
1582
|
+
scope["@TagVariableChange" /* TagVariableChange */] = changeHandler;
|
1583
1583
|
}
|
1584
|
-
var tagVarSignalChange = (scope, value2) => scope["@" /* TagVariableChange */]?.(value2);
|
1584
|
+
var tagVarSignalChange = (scope, value2) => scope["@TagVariableChange" /* TagVariableChange */]?.(value2);
|
1585
1585
|
var tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
1586
1586
|
function nextTagId({ $global }) {
|
1587
1587
|
const id = tagIdsByGlobal.get($global) || 0;
|
@@ -1617,14 +1617,14 @@ function hoist(...path) {
|
|
1617
1617
|
|
1618
1618
|
// src/dom/control-flow.ts
|
1619
1619
|
function awaitTag(nodeAccessor, renderer) {
|
1620
|
-
const promiseAccessor =
|
1621
|
-
const branchAccessor =
|
1620
|
+
const promiseAccessor = "Promise:" /* Promise */ + nodeAccessor;
|
1621
|
+
const branchAccessor = "ConditionalScope:" /* ConditionalScope */ + nodeAccessor;
|
1622
1622
|
return (scope, promise) => {
|
1623
1623
|
let tryBranch = scope.___closestBranch;
|
1624
1624
|
let awaitBranch = scope[branchAccessor];
|
1625
1625
|
const referenceNode = scope[nodeAccessor];
|
1626
1626
|
const namespaceNode = (awaitBranch?.___startNode ?? referenceNode).parentNode;
|
1627
|
-
while (tryBranch && !tryBranch["%" /* PlaceholderContent */]) {
|
1627
|
+
while (tryBranch && !tryBranch["%PlaceholderContent" /* PlaceholderContent */]) {
|
1628
1628
|
tryBranch = tryBranch.___parentBranch;
|
1629
1629
|
}
|
1630
1630
|
const thisPromise = scope[promiseAccessor] = promise.then((data2) => {
|
@@ -1649,8 +1649,8 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1649
1649
|
renderer.___params?.(awaitBranch, [data2]);
|
1650
1650
|
});
|
1651
1651
|
if (tryBranch) {
|
1652
|
-
if (!--tryBranch
|
1653
|
-
const placeholderBranch = tryBranch["#" /* PlaceholderBranch */];
|
1652
|
+
if (!--tryBranch.___pendingAsyncCount) {
|
1653
|
+
const placeholderBranch = tryBranch["#PlaceholderBranch" /* PlaceholderBranch */];
|
1654
1654
|
if (placeholderBranch) {
|
1655
1655
|
insertBranchBefore(
|
1656
1656
|
tryBranch,
|
@@ -1671,7 +1671,7 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1671
1671
|
}
|
1672
1672
|
}).catch((error) => {
|
1673
1673
|
let tryBranch2 = scope.___closestBranch;
|
1674
|
-
while (tryBranch2 && !tryBranch2["^" /* CatchContent */]) {
|
1674
|
+
while (tryBranch2 && !tryBranch2["^CatchContent" /* CatchContent */]) {
|
1675
1675
|
tryBranch2 = tryBranch2.___parentBranch;
|
1676
1676
|
}
|
1677
1677
|
if (!tryBranch2) {
|
@@ -1681,24 +1681,24 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1681
1681
|
} else {
|
1682
1682
|
setConditionalRenderer(
|
1683
1683
|
tryBranch2._,
|
1684
|
-
tryBranch2["*" /* BranchAccessor */],
|
1685
|
-
tryBranch2["^" /* CatchContent */],
|
1684
|
+
tryBranch2["*BranchAccessor" /* BranchAccessor */],
|
1685
|
+
tryBranch2["^CatchContent" /* CatchContent */],
|
1686
1686
|
createAndSetupBranch
|
1687
1687
|
);
|
1688
|
-
tryBranch2["^" /* CatchContent */].___params?.(
|
1689
|
-
tryBranch2._[
|
1688
|
+
tryBranch2["^CatchContent" /* CatchContent */].___params?.(
|
1689
|
+
tryBranch2._["ConditionalScope:" /* ConditionalScope */ + tryBranch2["*BranchAccessor" /* BranchAccessor */]],
|
1690
1690
|
[error]
|
1691
1691
|
);
|
1692
1692
|
}
|
1693
1693
|
});
|
1694
1694
|
if (tryBranch) {
|
1695
|
-
if (!tryBranch
|
1696
|
-
tryBranch
|
1695
|
+
if (!tryBranch.___pendingAsyncCount) {
|
1696
|
+
tryBranch.___pendingAsyncCount = 0;
|
1697
1697
|
requestAnimationFrame(() => {
|
1698
|
-
if (tryBranch
|
1699
|
-
const placeholderBranch = tryBranch["#" /* PlaceholderBranch */] = createAndSetupBranch(
|
1698
|
+
if (tryBranch.___pendingAsyncCount && !tryBranch.___destroyed) {
|
1699
|
+
const placeholderBranch = tryBranch["#PlaceholderBranch" /* PlaceholderBranch */] = createAndSetupBranch(
|
1700
1700
|
scope.$global,
|
1701
|
-
tryBranch["%" /* PlaceholderContent */],
|
1701
|
+
tryBranch["%PlaceholderContent" /* PlaceholderContent */],
|
1702
1702
|
tryBranch._,
|
1703
1703
|
tryBranch.___startNode.parentNode
|
1704
1704
|
);
|
@@ -1711,7 +1711,7 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1711
1711
|
}
|
1712
1712
|
});
|
1713
1713
|
}
|
1714
|
-
tryBranch
|
1714
|
+
tryBranch.___pendingAsyncCount++;
|
1715
1715
|
} else if (awaitBranch) {
|
1716
1716
|
awaitBranch.___startNode.parentNode.insertBefore(
|
1717
1717
|
referenceNode,
|
@@ -1722,7 +1722,7 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1722
1722
|
};
|
1723
1723
|
}
|
1724
1724
|
function createTry(nodeAccessor, tryContent) {
|
1725
|
-
const branchAccessor =
|
1725
|
+
const branchAccessor = "ConditionalScope:" /* ConditionalScope */ + nodeAccessor;
|
1726
1726
|
return (scope, input) => {
|
1727
1727
|
if (!scope[branchAccessor]) {
|
1728
1728
|
setConditionalRenderer(
|
@@ -1734,16 +1734,16 @@ function createTry(nodeAccessor, tryContent) {
|
|
1734
1734
|
}
|
1735
1735
|
const branch = scope[branchAccessor];
|
1736
1736
|
if (branch) {
|
1737
|
-
branch["*" /* BranchAccessor */] = nodeAccessor;
|
1738
|
-
branch["^" /* CatchContent */] = normalizeDynamicRenderer(input.catch);
|
1739
|
-
branch["%" /* PlaceholderContent */] = normalizeDynamicRenderer(
|
1737
|
+
branch["*BranchAccessor" /* BranchAccessor */] = nodeAccessor;
|
1738
|
+
branch["^CatchContent" /* CatchContent */] = normalizeDynamicRenderer(input.catch);
|
1739
|
+
branch["%PlaceholderContent" /* PlaceholderContent */] = normalizeDynamicRenderer(
|
1740
1740
|
input.placeholder
|
1741
1741
|
);
|
1742
1742
|
}
|
1743
1743
|
};
|
1744
1744
|
}
|
1745
1745
|
function conditional(nodeAccessor, ...branches) {
|
1746
|
-
const branchAccessor =
|
1746
|
+
const branchAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + nodeAccessor;
|
1747
1747
|
return (scope, newBranch) => {
|
1748
1748
|
if (newBranch !== scope[branchAccessor]) {
|
1749
1749
|
setConditionalRenderer(
|
@@ -1759,8 +1759,8 @@ function patchDynamicTag(fn) {
|
|
1759
1759
|
dynamicTag = fn(dynamicTag);
|
1760
1760
|
}
|
1761
1761
|
var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
1762
|
-
const childScopeAccessor =
|
1763
|
-
const rendererAccessor =
|
1762
|
+
const childScopeAccessor = "ConditionalScope:" /* ConditionalScope */ + nodeAccessor;
|
1763
|
+
const rendererAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + nodeAccessor;
|
1764
1764
|
return (scope, newRenderer, getInput) => {
|
1765
1765
|
const normalizedRenderer = normalizeDynamicRenderer(newRenderer);
|
1766
1766
|
if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.___id || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) {
|
@@ -1786,7 +1786,7 @@ var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, input
|
|
1786
1786
|
subscribeToScopeSet(
|
1787
1787
|
content.___owner,
|
1788
1788
|
content.___accessor,
|
1789
|
-
scope[childScopeAccessor][(true ? `#${normalizedRenderer}/0` : 0)
|
1789
|
+
scope[childScopeAccessor]["ConditionalScope:" /* ConditionalScope */ + (true ? `#${normalizedRenderer}/0` : 0)]
|
1790
1790
|
);
|
1791
1791
|
}
|
1792
1792
|
}
|
@@ -1828,9 +1828,9 @@ var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, input
|
|
1828
1828
|
};
|
1829
1829
|
function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2) {
|
1830
1830
|
const referenceNode = scope[nodeAccessor];
|
1831
|
-
const prevBranch = scope[
|
1831
|
+
const prevBranch = scope["ConditionalScope:" /* ConditionalScope */ + nodeAccessor];
|
1832
1832
|
const parentNode = referenceNode.nodeType > 1 /* Element */ ? (prevBranch?.___startNode || referenceNode).parentNode : referenceNode;
|
1833
|
-
const newBranch = scope[
|
1833
|
+
const newBranch = scope["ConditionalScope:" /* ConditionalScope */ + nodeAccessor] = newRenderer && createBranch2(scope.$global, newRenderer, scope, parentNode);
|
1834
1834
|
if (referenceNode === parentNode) {
|
1835
1835
|
if (prevBranch) {
|
1836
1836
|
destroyBranch(prevBranch);
|
@@ -1885,13 +1885,13 @@ function loop(nodeAccessor, renderer, forEach) {
|
|
1885
1885
|
const params = renderer.___params;
|
1886
1886
|
return (scope, value2) => {
|
1887
1887
|
const referenceNode = scope[nodeAccessor];
|
1888
|
-
const oldMap = scope[
|
1889
|
-
const oldArray = oldMap ? scope[
|
1888
|
+
const oldMap = scope["LoopScopeMap:" /* LoopScopeMap */ + nodeAccessor];
|
1889
|
+
const oldArray = oldMap ? scope["LoopScopeArray:" /* LoopScopeArray */ + nodeAccessor] || [
|
1890
1890
|
...oldMap.values()
|
1891
1891
|
] : [];
|
1892
1892
|
const parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0].___startNode.parentNode : referenceNode;
|
1893
|
-
const newMap = scope[
|
1894
|
-
const newArray = scope[
|
1893
|
+
const newMap = scope["LoopScopeMap:" /* LoopScopeMap */ + nodeAccessor] = /* @__PURE__ */ new Map();
|
1894
|
+
const newArray = scope["LoopScopeArray:" /* LoopScopeArray */ + nodeAccessor] = [];
|
1895
1895
|
forEach(value2, (key, args) => {
|
1896
1896
|
const branch = oldMap?.get(key) || createAndSetupBranch(scope.$global, renderer, scope, parentNode);
|
1897
1897
|
params?.(branch, args);
|
@@ -2048,19 +2048,19 @@ var enableCatch = () => {
|
|
2048
2048
|
runRender2(render);
|
2049
2049
|
} catch (error) {
|
2050
2050
|
let branch = render.___scope.___closestBranch;
|
2051
|
-
while (branch && !branch["^" /* CatchContent */])
|
2051
|
+
while (branch && !branch["^CatchContent" /* CatchContent */])
|
2052
2052
|
branch = branch.___parentBranch;
|
2053
2053
|
if (!branch) {
|
2054
2054
|
throw error;
|
2055
2055
|
} else {
|
2056
2056
|
setConditionalRenderer(
|
2057
2057
|
branch._,
|
2058
|
-
branch["*" /* BranchAccessor */],
|
2059
|
-
branch["^" /* CatchContent */],
|
2058
|
+
branch["*BranchAccessor" /* BranchAccessor */],
|
2059
|
+
branch["^CatchContent" /* CatchContent */],
|
2060
2060
|
createAndSetupBranch
|
2061
2061
|
);
|
2062
|
-
branch["^" /* CatchContent */].___params?.(
|
2063
|
-
branch._[
|
2062
|
+
branch["^CatchContent" /* CatchContent */].___params?.(
|
2063
|
+
branch._["ConditionalScope:" /* ConditionalScope */ + branch["*BranchAccessor" /* BranchAccessor */]],
|
2064
2064
|
[error]
|
2065
2065
|
);
|
2066
2066
|
}
|