marko 6.0.0-next.3.61 → 6.0.0-next.3.63
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 +8 -7
- package/dist/common/accessor.debug.d.ts +7 -6
- package/dist/debug/dom.js +20 -20
- package/dist/debug/dom.mjs +20 -20
- package/dist/debug/html.js +83 -38
- package/dist/debug/html.mjs +83 -38
- package/dist/dom.js +137 -137
- package/dist/dom.mjs +137 -137
- package/dist/html.js +38 -23
- package/dist/html.mjs +38 -23
- package/dist/translator/index.js +14 -12
- package/package.json +1 -1
@@ -12,13 +12,14 @@ export declare enum AccessorPrefix {
|
|
12
12
|
LifecycleAbortController = "k",
|
13
13
|
LoopScopeArray = "l",
|
14
14
|
LoopScopeMap = "m",
|
15
|
-
Promise = "n"
|
15
|
+
Promise = "n",
|
16
|
+
TagVariableChange = "o"
|
16
17
|
}
|
17
18
|
export declare enum AccessorProp {
|
18
|
-
BranchAccessor = "
|
19
|
-
CatchContent = "
|
20
|
-
PlaceholderBranch = "
|
21
|
-
PlaceholderContent = "
|
22
|
-
TagVariable = "
|
23
|
-
TagVariableChange = "
|
19
|
+
BranchAccessor = "a",
|
20
|
+
CatchContent = "b",
|
21
|
+
PlaceholderBranch = "c",
|
22
|
+
PlaceholderContent = "d",
|
23
|
+
TagVariable = "e",
|
24
|
+
TagVariableChange = "f"
|
24
25
|
}
|
@@ -12,13 +12,14 @@ export declare enum AccessorPrefix {
|
|
12
12
|
LifecycleAbortController = "LifecycleAbortController:",
|
13
13
|
LoopScopeArray = "LoopScopeArray:",
|
14
14
|
LoopScopeMap = "LoopScopeMap:",
|
15
|
-
Promise = "Promise:"
|
15
|
+
Promise = "Promise:",
|
16
|
+
TagVariableChange = "TagVariableChange:"
|
16
17
|
}
|
17
18
|
export declare enum AccessorProp {
|
18
|
-
BranchAccessor = "
|
19
|
-
CatchContent = "
|
19
|
+
BranchAccessor = "#BranchAccessor",
|
20
|
+
CatchContent = "#CatchContent",
|
20
21
|
PlaceholderBranch = "#PlaceholderBranch",
|
21
|
-
PlaceholderContent = "
|
22
|
-
TagVariable = "
|
23
|
-
TagVariableChange = "
|
22
|
+
PlaceholderContent = "#PlaceholderContent",
|
23
|
+
TagVariable = "#TagVariable",
|
24
|
+
TagVariableChange = "#TagVariableChange"
|
24
25
|
}
|
package/dist/debug/dom.js
CHANGED
@@ -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;
|
@@ -1575,13 +1575,13 @@ function closure(valueAccessor, fn, getOwnerScope) {
|
|
1575
1575
|
};
|
1576
1576
|
}
|
1577
1577
|
function setTagVar(scope, childAccessor, tagVarSignal2) {
|
1578
|
-
scope[childAccessor]["
|
1578
|
+
scope[childAccessor]["#TagVariable" /* TagVariable */] = (value2) => tagVarSignal2(scope, value2);
|
1579
1579
|
}
|
1580
|
-
var tagVarSignal = (scope, value2) => scope["
|
1580
|
+
var tagVarSignal = (scope, value2) => scope["#TagVariable" /* TagVariable */]?.(value2);
|
1581
1581
|
function setTagVarChange(scope, changeHandler) {
|
1582
|
-
scope["
|
1582
|
+
scope["#TagVariableChange" /* TagVariableChange */] = changeHandler;
|
1583
1583
|
}
|
1584
|
-
var tagVarSignalChange = (scope, value2) => scope["
|
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;
|
@@ -1624,7 +1624,7 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1624
1624
|
let awaitBranch = scope[branchAccessor];
|
1625
1625
|
const referenceNode = scope[nodeAccessor];
|
1626
1626
|
const namespaceNode = (awaitBranch?.___startNode ?? referenceNode).parentNode;
|
1627
|
-
while (tryBranch && !tryBranch["
|
1627
|
+
while (tryBranch && !tryBranch["#PlaceholderContent" /* PlaceholderContent */]) {
|
1628
1628
|
tryBranch = tryBranch.___parentBranch;
|
1629
1629
|
}
|
1630
1630
|
const thisPromise = scope[promiseAccessor] = promise.then((data2) => {
|
@@ -1671,7 +1671,7 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1671
1671
|
}
|
1672
1672
|
}).catch((error) => {
|
1673
1673
|
let tryBranch2 = scope.___closestBranch;
|
1674
|
-
while (tryBranch2 && !tryBranch2["
|
1674
|
+
while (tryBranch2 && !tryBranch2["#CatchContent" /* CatchContent */]) {
|
1675
1675
|
tryBranch2 = tryBranch2.___parentBranch;
|
1676
1676
|
}
|
1677
1677
|
if (!tryBranch2) {
|
@@ -1681,12 +1681,12 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1681
1681
|
} else {
|
1682
1682
|
setConditionalRenderer(
|
1683
1683
|
tryBranch2._,
|
1684
|
-
tryBranch2["
|
1685
|
-
tryBranch2["
|
1684
|
+
tryBranch2["#BranchAccessor" /* BranchAccessor */],
|
1685
|
+
tryBranch2["#CatchContent" /* CatchContent */],
|
1686
1686
|
createAndSetupBranch
|
1687
1687
|
);
|
1688
|
-
tryBranch2["
|
1689
|
-
tryBranch2._["ConditionalScope:" /* ConditionalScope */ + tryBranch2["
|
1688
|
+
tryBranch2["#CatchContent" /* CatchContent */].___params?.(
|
1689
|
+
tryBranch2._["ConditionalScope:" /* ConditionalScope */ + tryBranch2["#BranchAccessor" /* BranchAccessor */]],
|
1690
1690
|
[error]
|
1691
1691
|
);
|
1692
1692
|
}
|
@@ -1698,7 +1698,7 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1698
1698
|
if (tryBranch.___pendingAsyncCount && !tryBranch.___destroyed) {
|
1699
1699
|
const placeholderBranch = tryBranch["#PlaceholderBranch" /* PlaceholderBranch */] = createAndSetupBranch(
|
1700
1700
|
scope.$global,
|
1701
|
-
tryBranch["
|
1701
|
+
tryBranch["#PlaceholderContent" /* PlaceholderContent */],
|
1702
1702
|
tryBranch._,
|
1703
1703
|
tryBranch.___startNode.parentNode
|
1704
1704
|
);
|
@@ -1734,9 +1734,9 @@ function createTry(nodeAccessor, tryContent) {
|
|
1734
1734
|
}
|
1735
1735
|
const branch = scope[branchAccessor];
|
1736
1736
|
if (branch) {
|
1737
|
-
branch["
|
1738
|
-
branch["
|
1739
|
-
branch["
|
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
|
}
|
@@ -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["
|
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["
|
2059
|
-
branch["
|
2058
|
+
branch["#BranchAccessor" /* BranchAccessor */],
|
2059
|
+
branch["#CatchContent" /* CatchContent */],
|
2060
2060
|
createAndSetupBranch
|
2061
2061
|
);
|
2062
|
-
branch["
|
2063
|
-
branch._["ConditionalScope:" /* ConditionalScope */ + branch["
|
2062
|
+
branch["#CatchContent" /* CatchContent */].___params?.(
|
2063
|
+
branch._["ConditionalScope:" /* ConditionalScope */ + branch["#BranchAccessor" /* BranchAccessor */]],
|
2064
2064
|
[error]
|
2065
2065
|
);
|
2066
2066
|
}
|
package/dist/debug/dom.mjs
CHANGED
@@ -1349,7 +1349,7 @@ function state(valueAccessor, fn) {
|
|
1349
1349
|
valueAccessor.lastIndexOf("/")
|
1350
1350
|
);
|
1351
1351
|
}
|
1352
|
-
const valueChangeAccessor = "
|
1352
|
+
const valueChangeAccessor = "TagVariableChange:" /* TagVariableChange */ + valueAccessor;
|
1353
1353
|
const update = (scope, value2) => {
|
1354
1354
|
if (scope[valueAccessor] !== value2) {
|
1355
1355
|
scope[valueAccessor] = value2;
|
@@ -1487,13 +1487,13 @@ function closure(valueAccessor, fn, getOwnerScope) {
|
|
1487
1487
|
};
|
1488
1488
|
}
|
1489
1489
|
function setTagVar(scope, childAccessor, tagVarSignal2) {
|
1490
|
-
scope[childAccessor]["
|
1490
|
+
scope[childAccessor]["#TagVariable" /* TagVariable */] = (value2) => tagVarSignal2(scope, value2);
|
1491
1491
|
}
|
1492
|
-
var tagVarSignal = (scope, value2) => scope["
|
1492
|
+
var tagVarSignal = (scope, value2) => scope["#TagVariable" /* TagVariable */]?.(value2);
|
1493
1493
|
function setTagVarChange(scope, changeHandler) {
|
1494
|
-
scope["
|
1494
|
+
scope["#TagVariableChange" /* TagVariableChange */] = changeHandler;
|
1495
1495
|
}
|
1496
|
-
var tagVarSignalChange = (scope, value2) => scope["
|
1496
|
+
var tagVarSignalChange = (scope, value2) => scope["#TagVariableChange" /* TagVariableChange */]?.(value2);
|
1497
1497
|
var tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
1498
1498
|
function nextTagId({ $global }) {
|
1499
1499
|
const id = tagIdsByGlobal.get($global) || 0;
|
@@ -1536,7 +1536,7 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1536
1536
|
let awaitBranch = scope[branchAccessor];
|
1537
1537
|
const referenceNode = scope[nodeAccessor];
|
1538
1538
|
const namespaceNode = (awaitBranch?.___startNode ?? referenceNode).parentNode;
|
1539
|
-
while (tryBranch && !tryBranch["
|
1539
|
+
while (tryBranch && !tryBranch["#PlaceholderContent" /* PlaceholderContent */]) {
|
1540
1540
|
tryBranch = tryBranch.___parentBranch;
|
1541
1541
|
}
|
1542
1542
|
const thisPromise = scope[promiseAccessor] = promise.then((data2) => {
|
@@ -1583,7 +1583,7 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1583
1583
|
}
|
1584
1584
|
}).catch((error) => {
|
1585
1585
|
let tryBranch2 = scope.___closestBranch;
|
1586
|
-
while (tryBranch2 && !tryBranch2["
|
1586
|
+
while (tryBranch2 && !tryBranch2["#CatchContent" /* CatchContent */]) {
|
1587
1587
|
tryBranch2 = tryBranch2.___parentBranch;
|
1588
1588
|
}
|
1589
1589
|
if (!tryBranch2) {
|
@@ -1593,12 +1593,12 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1593
1593
|
} else {
|
1594
1594
|
setConditionalRenderer(
|
1595
1595
|
tryBranch2._,
|
1596
|
-
tryBranch2["
|
1597
|
-
tryBranch2["
|
1596
|
+
tryBranch2["#BranchAccessor" /* BranchAccessor */],
|
1597
|
+
tryBranch2["#CatchContent" /* CatchContent */],
|
1598
1598
|
createAndSetupBranch
|
1599
1599
|
);
|
1600
|
-
tryBranch2["
|
1601
|
-
tryBranch2._["ConditionalScope:" /* ConditionalScope */ + tryBranch2["
|
1600
|
+
tryBranch2["#CatchContent" /* CatchContent */].___params?.(
|
1601
|
+
tryBranch2._["ConditionalScope:" /* ConditionalScope */ + tryBranch2["#BranchAccessor" /* BranchAccessor */]],
|
1602
1602
|
[error]
|
1603
1603
|
);
|
1604
1604
|
}
|
@@ -1610,7 +1610,7 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1610
1610
|
if (tryBranch.___pendingAsyncCount && !tryBranch.___destroyed) {
|
1611
1611
|
const placeholderBranch = tryBranch["#PlaceholderBranch" /* PlaceholderBranch */] = createAndSetupBranch(
|
1612
1612
|
scope.$global,
|
1613
|
-
tryBranch["
|
1613
|
+
tryBranch["#PlaceholderContent" /* PlaceholderContent */],
|
1614
1614
|
tryBranch._,
|
1615
1615
|
tryBranch.___startNode.parentNode
|
1616
1616
|
);
|
@@ -1646,9 +1646,9 @@ function createTry(nodeAccessor, tryContent) {
|
|
1646
1646
|
}
|
1647
1647
|
const branch = scope[branchAccessor];
|
1648
1648
|
if (branch) {
|
1649
|
-
branch["
|
1650
|
-
branch["
|
1651
|
-
branch["
|
1649
|
+
branch["#BranchAccessor" /* BranchAccessor */] = nodeAccessor;
|
1650
|
+
branch["#CatchContent" /* CatchContent */] = normalizeDynamicRenderer(input.catch);
|
1651
|
+
branch["#PlaceholderContent" /* PlaceholderContent */] = normalizeDynamicRenderer(
|
1652
1652
|
input.placeholder
|
1653
1653
|
);
|
1654
1654
|
}
|
@@ -1960,19 +1960,19 @@ var enableCatch = () => {
|
|
1960
1960
|
runRender2(render);
|
1961
1961
|
} catch (error) {
|
1962
1962
|
let branch = render.___scope.___closestBranch;
|
1963
|
-
while (branch && !branch["
|
1963
|
+
while (branch && !branch["#CatchContent" /* CatchContent */])
|
1964
1964
|
branch = branch.___parentBranch;
|
1965
1965
|
if (!branch) {
|
1966
1966
|
throw error;
|
1967
1967
|
} else {
|
1968
1968
|
setConditionalRenderer(
|
1969
1969
|
branch._,
|
1970
|
-
branch["
|
1971
|
-
branch["
|
1970
|
+
branch["#BranchAccessor" /* BranchAccessor */],
|
1971
|
+
branch["#CatchContent" /* CatchContent */],
|
1972
1972
|
createAndSetupBranch
|
1973
1973
|
);
|
1974
|
-
branch["
|
1975
|
-
branch._["ConditionalScope:" /* ConditionalScope */ + branch["
|
1974
|
+
branch["#CatchContent" /* CatchContent */].___params?.(
|
1975
|
+
branch._["ConditionalScope:" /* ConditionalScope */ + branch["#BranchAccessor" /* BranchAccessor */]],
|
1976
1976
|
[error]
|
1977
1977
|
);
|
1978
1978
|
}
|
package/dist/debug/html.js
CHANGED
@@ -564,6 +564,7 @@ var State = class {
|
|
564
564
|
ids = 0;
|
565
565
|
flush = 0;
|
566
566
|
flushed = false;
|
567
|
+
wroteUndefined = false;
|
567
568
|
buf = [];
|
568
569
|
refs = /* @__PURE__ */ new WeakMap();
|
569
570
|
assigned = /* @__PURE__ */ new Set();
|
@@ -689,7 +690,12 @@ function writeRoot(state, root) {
|
|
689
690
|
for (const chunk of buf) {
|
690
691
|
result += chunk;
|
691
692
|
}
|
692
|
-
|
693
|
+
if (state.wroteUndefined) {
|
694
|
+
state.wroteUndefined = false;
|
695
|
+
return "(_,$)=>" + result;
|
696
|
+
} else {
|
697
|
+
return "_=>" + result;
|
698
|
+
}
|
693
699
|
}
|
694
700
|
function writeAssigned(state) {
|
695
701
|
if (state.assigned.size) {
|
@@ -981,13 +987,23 @@ function writePlainObject(state, val, ref) {
|
|
981
987
|
return true;
|
982
988
|
}
|
983
989
|
function writeArray(state, val, ref) {
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
state.buf.push(
|
988
|
-
|
990
|
+
let sep = "[";
|
991
|
+
for (let i = 0; i < val.length; i++) {
|
992
|
+
const item = val[i];
|
993
|
+
state.buf.push(sep);
|
994
|
+
sep = ",";
|
995
|
+
if (item === void 0) {
|
996
|
+
state.wroteUndefined = true;
|
997
|
+
state.buf.push("$");
|
998
|
+
} else {
|
999
|
+
writeProp(state, item, ref, "" + i);
|
1000
|
+
}
|
1001
|
+
}
|
1002
|
+
if (sep === "[") {
|
1003
|
+
state.buf.push("[]");
|
1004
|
+
} else {
|
1005
|
+
state.buf.push("]");
|
989
1006
|
}
|
990
|
-
state.buf.push("]");
|
991
1007
|
return true;
|
992
1008
|
}
|
993
1009
|
function writeDate(state, val) {
|
@@ -1016,23 +1032,6 @@ function writeMap(state, val, ref) {
|
|
1016
1032
|
state.buf.push("new Map");
|
1017
1033
|
return true;
|
1018
1034
|
}
|
1019
|
-
const items = [];
|
1020
|
-
let assigns;
|
1021
|
-
for (let [itemKey, itemValue] of val) {
|
1022
|
-
if (itemKey === val) {
|
1023
|
-
itemKey = void 0;
|
1024
|
-
(assigns ||= []).push("i[" + items.length + "][0]");
|
1025
|
-
}
|
1026
|
-
if (itemValue === val) {
|
1027
|
-
itemValue = void 0;
|
1028
|
-
(assigns ||= []).push("i[" + items.length + "][1]");
|
1029
|
-
}
|
1030
|
-
if (itemValue === void 0) {
|
1031
|
-
items.push([itemKey]);
|
1032
|
-
} else {
|
1033
|
-
items.push([itemKey, itemValue]);
|
1034
|
-
}
|
1035
|
-
}
|
1036
1035
|
const arrayRef = new Reference(
|
1037
1036
|
ref,
|
1038
1037
|
null,
|
@@ -1040,11 +1039,56 @@ function writeMap(state, val, ref) {
|
|
1040
1039
|
null,
|
1041
1040
|
nextRefAccess(state)
|
1042
1041
|
);
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1042
|
+
const items = [];
|
1043
|
+
let assigns;
|
1044
|
+
let i = 0;
|
1045
|
+
if (val.size < 25) {
|
1046
|
+
for (let [itemKey, itemValue] of val) {
|
1047
|
+
if (itemKey === val) {
|
1048
|
+
itemKey = void 0;
|
1049
|
+
(assigns ||= []).push("a[" + i + "][0]");
|
1050
|
+
}
|
1051
|
+
if (itemValue === val) {
|
1052
|
+
itemValue = void 0;
|
1053
|
+
(assigns ||= []).push("a[" + i + "][1]");
|
1054
|
+
}
|
1055
|
+
i = items.push(
|
1056
|
+
itemValue === void 0 ? itemKey === void 0 ? [] : [itemKey] : [itemKey, itemValue]
|
1057
|
+
);
|
1058
|
+
}
|
1059
|
+
if (assigns) {
|
1060
|
+
state.buf.push(
|
1061
|
+
"((m,a)=>(" + assignsToString(assigns, "m") + ",a.forEach(i=>m.set(i[0],i[1])),m))(new Map," + arrayRef.id + "="
|
1062
|
+
);
|
1063
|
+
} else {
|
1064
|
+
state.buf.push("new Map(" + arrayRef.id + "=");
|
1065
|
+
}
|
1066
|
+
writeArray(state, items, arrayRef);
|
1067
|
+
state.buf.push(")");
|
1068
|
+
} else {
|
1069
|
+
for (let [itemKey, itemValue] of val) {
|
1070
|
+
if (itemKey === val) {
|
1071
|
+
itemKey = 0;
|
1072
|
+
(assigns ||= []).push("a[" + i + "]");
|
1073
|
+
}
|
1074
|
+
if (itemValue === val) {
|
1075
|
+
itemValue = 0;
|
1076
|
+
(assigns ||= []).push("a[" + (i + 1) + "]");
|
1077
|
+
}
|
1078
|
+
i = items.push(itemKey, itemValue);
|
1079
|
+
}
|
1080
|
+
if (assigns) {
|
1081
|
+
state.buf.push(
|
1082
|
+
"(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1])," + assignsToString(assigns, "new Map") + "))(" + arrayRef.id + "="
|
1083
|
+
);
|
1084
|
+
} else {
|
1085
|
+
state.buf.push(
|
1086
|
+
"(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1]),new Map))(" + arrayRef.id + "="
|
1087
|
+
);
|
1088
|
+
}
|
1089
|
+
writeArray(state, items, arrayRef);
|
1090
|
+
state.buf.push(")");
|
1091
|
+
}
|
1048
1092
|
return true;
|
1049
1093
|
}
|
1050
1094
|
function writeSet(state, val, ref) {
|
@@ -1054,12 +1098,13 @@ function writeSet(state, val, ref) {
|
|
1054
1098
|
}
|
1055
1099
|
const items = [];
|
1056
1100
|
let assigns;
|
1101
|
+
let i = 0;
|
1057
1102
|
for (let item of val) {
|
1058
1103
|
if (item === val) {
|
1059
|
-
item =
|
1060
|
-
(assigns ||= []).push("i[" +
|
1104
|
+
item = 0;
|
1105
|
+
(assigns ||= []).push("i[" + i + "]");
|
1061
1106
|
}
|
1062
|
-
items.push(item);
|
1107
|
+
i = items.push(item);
|
1063
1108
|
}
|
1064
1109
|
const arrayRef = new Reference(
|
1065
1110
|
ref,
|
@@ -1151,7 +1196,7 @@ function writeFormData(state, val) {
|
|
1151
1196
|
let valStr = "";
|
1152
1197
|
for (const [key, value] of val) {
|
1153
1198
|
if (typeof value === "string") {
|
1154
|
-
valStr += sep +
|
1199
|
+
valStr += sep + quote(key, 0) + "," + quote(value, 0);
|
1155
1200
|
sep = ",";
|
1156
1201
|
}
|
1157
1202
|
}
|
@@ -1159,7 +1204,7 @@ function writeFormData(state, val) {
|
|
1159
1204
|
state.buf.push("new FormData");
|
1160
1205
|
} else {
|
1161
1206
|
state.buf.push(
|
1162
|
-
"((f,i)=>
|
1207
|
+
valStr + "].reduce((f,v,i,a)=>i%2&&f.append(v,a[i+1])||f,new FormData)"
|
1163
1208
|
);
|
1164
1209
|
}
|
1165
1210
|
return true;
|
@@ -1644,7 +1689,7 @@ function withContext(key, value, cb) {
|
|
1644
1689
|
}
|
1645
1690
|
function setTagVar(parentScopeId, scopeOffsetAccessor, childScope, registryId) {
|
1646
1691
|
ensureScopeWithId(parentScopeId)[scopeOffsetAccessor] = nextScopeId();
|
1647
|
-
childScope["
|
1692
|
+
childScope["#TagVariable" /* TagVariable */] = register2(
|
1648
1693
|
{},
|
1649
1694
|
registryId,
|
1650
1695
|
parentScopeId
|
@@ -1961,9 +2006,9 @@ function tryContent(scopeId, accessor, content, input) {
|
|
1961
2006
|
content();
|
1962
2007
|
}
|
1963
2008
|
writeScope(branchId, {
|
1964
|
-
["
|
1965
|
-
["
|
1966
|
-
["
|
2009
|
+
["#BranchAccessor" /* BranchAccessor */]: accessor,
|
2010
|
+
["#CatchContent" /* CatchContent */]: catchContent,
|
2011
|
+
["#PlaceholderContent" /* PlaceholderContent */]: placeholderContent
|
1967
2012
|
});
|
1968
2013
|
writeScope(scopeId, {
|
1969
2014
|
["ConditionalScope:" /* ConditionalScope */ + accessor]: getScopeById(branchId)
|
package/dist/debug/html.mjs
CHANGED
@@ -480,6 +480,7 @@ var State = class {
|
|
480
480
|
ids = 0;
|
481
481
|
flush = 0;
|
482
482
|
flushed = false;
|
483
|
+
wroteUndefined = false;
|
483
484
|
buf = [];
|
484
485
|
refs = /* @__PURE__ */ new WeakMap();
|
485
486
|
assigned = /* @__PURE__ */ new Set();
|
@@ -605,7 +606,12 @@ function writeRoot(state, root) {
|
|
605
606
|
for (const chunk of buf) {
|
606
607
|
result += chunk;
|
607
608
|
}
|
608
|
-
|
609
|
+
if (state.wroteUndefined) {
|
610
|
+
state.wroteUndefined = false;
|
611
|
+
return "(_,$)=>" + result;
|
612
|
+
} else {
|
613
|
+
return "_=>" + result;
|
614
|
+
}
|
609
615
|
}
|
610
616
|
function writeAssigned(state) {
|
611
617
|
if (state.assigned.size) {
|
@@ -897,13 +903,23 @@ function writePlainObject(state, val, ref) {
|
|
897
903
|
return true;
|
898
904
|
}
|
899
905
|
function writeArray(state, val, ref) {
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
state.buf.push(
|
904
|
-
|
906
|
+
let sep = "[";
|
907
|
+
for (let i = 0; i < val.length; i++) {
|
908
|
+
const item = val[i];
|
909
|
+
state.buf.push(sep);
|
910
|
+
sep = ",";
|
911
|
+
if (item === void 0) {
|
912
|
+
state.wroteUndefined = true;
|
913
|
+
state.buf.push("$");
|
914
|
+
} else {
|
915
|
+
writeProp(state, item, ref, "" + i);
|
916
|
+
}
|
917
|
+
}
|
918
|
+
if (sep === "[") {
|
919
|
+
state.buf.push("[]");
|
920
|
+
} else {
|
921
|
+
state.buf.push("]");
|
905
922
|
}
|
906
|
-
state.buf.push("]");
|
907
923
|
return true;
|
908
924
|
}
|
909
925
|
function writeDate(state, val) {
|
@@ -932,23 +948,6 @@ function writeMap(state, val, ref) {
|
|
932
948
|
state.buf.push("new Map");
|
933
949
|
return true;
|
934
950
|
}
|
935
|
-
const items = [];
|
936
|
-
let assigns;
|
937
|
-
for (let [itemKey, itemValue] of val) {
|
938
|
-
if (itemKey === val) {
|
939
|
-
itemKey = void 0;
|
940
|
-
(assigns ||= []).push("i[" + items.length + "][0]");
|
941
|
-
}
|
942
|
-
if (itemValue === val) {
|
943
|
-
itemValue = void 0;
|
944
|
-
(assigns ||= []).push("i[" + items.length + "][1]");
|
945
|
-
}
|
946
|
-
if (itemValue === void 0) {
|
947
|
-
items.push([itemKey]);
|
948
|
-
} else {
|
949
|
-
items.push([itemKey, itemValue]);
|
950
|
-
}
|
951
|
-
}
|
952
951
|
const arrayRef = new Reference(
|
953
952
|
ref,
|
954
953
|
null,
|
@@ -956,11 +955,56 @@ function writeMap(state, val, ref) {
|
|
956
955
|
null,
|
957
956
|
nextRefAccess(state)
|
958
957
|
);
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
958
|
+
const items = [];
|
959
|
+
let assigns;
|
960
|
+
let i = 0;
|
961
|
+
if (val.size < 25) {
|
962
|
+
for (let [itemKey, itemValue] of val) {
|
963
|
+
if (itemKey === val) {
|
964
|
+
itemKey = void 0;
|
965
|
+
(assigns ||= []).push("a[" + i + "][0]");
|
966
|
+
}
|
967
|
+
if (itemValue === val) {
|
968
|
+
itemValue = void 0;
|
969
|
+
(assigns ||= []).push("a[" + i + "][1]");
|
970
|
+
}
|
971
|
+
i = items.push(
|
972
|
+
itemValue === void 0 ? itemKey === void 0 ? [] : [itemKey] : [itemKey, itemValue]
|
973
|
+
);
|
974
|
+
}
|
975
|
+
if (assigns) {
|
976
|
+
state.buf.push(
|
977
|
+
"((m,a)=>(" + assignsToString(assigns, "m") + ",a.forEach(i=>m.set(i[0],i[1])),m))(new Map," + arrayRef.id + "="
|
978
|
+
);
|
979
|
+
} else {
|
980
|
+
state.buf.push("new Map(" + arrayRef.id + "=");
|
981
|
+
}
|
982
|
+
writeArray(state, items, arrayRef);
|
983
|
+
state.buf.push(")");
|
984
|
+
} else {
|
985
|
+
for (let [itemKey, itemValue] of val) {
|
986
|
+
if (itemKey === val) {
|
987
|
+
itemKey = 0;
|
988
|
+
(assigns ||= []).push("a[" + i + "]");
|
989
|
+
}
|
990
|
+
if (itemValue === val) {
|
991
|
+
itemValue = 0;
|
992
|
+
(assigns ||= []).push("a[" + (i + 1) + "]");
|
993
|
+
}
|
994
|
+
i = items.push(itemKey, itemValue);
|
995
|
+
}
|
996
|
+
if (assigns) {
|
997
|
+
state.buf.push(
|
998
|
+
"(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1])," + assignsToString(assigns, "new Map") + "))(" + arrayRef.id + "="
|
999
|
+
);
|
1000
|
+
} else {
|
1001
|
+
state.buf.push(
|
1002
|
+
"(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1]),new Map))(" + arrayRef.id + "="
|
1003
|
+
);
|
1004
|
+
}
|
1005
|
+
writeArray(state, items, arrayRef);
|
1006
|
+
state.buf.push(")");
|
1007
|
+
}
|
964
1008
|
return true;
|
965
1009
|
}
|
966
1010
|
function writeSet(state, val, ref) {
|
@@ -970,12 +1014,13 @@ function writeSet(state, val, ref) {
|
|
970
1014
|
}
|
971
1015
|
const items = [];
|
972
1016
|
let assigns;
|
1017
|
+
let i = 0;
|
973
1018
|
for (let item of val) {
|
974
1019
|
if (item === val) {
|
975
|
-
item =
|
976
|
-
(assigns ||= []).push("i[" +
|
1020
|
+
item = 0;
|
1021
|
+
(assigns ||= []).push("i[" + i + "]");
|
977
1022
|
}
|
978
|
-
items.push(item);
|
1023
|
+
i = items.push(item);
|
979
1024
|
}
|
980
1025
|
const arrayRef = new Reference(
|
981
1026
|
ref,
|
@@ -1067,7 +1112,7 @@ function writeFormData(state, val) {
|
|
1067
1112
|
let valStr = "";
|
1068
1113
|
for (const [key, value] of val) {
|
1069
1114
|
if (typeof value === "string") {
|
1070
|
-
valStr += sep +
|
1115
|
+
valStr += sep + quote(key, 0) + "," + quote(value, 0);
|
1071
1116
|
sep = ",";
|
1072
1117
|
}
|
1073
1118
|
}
|
@@ -1075,7 +1120,7 @@ function writeFormData(state, val) {
|
|
1075
1120
|
state.buf.push("new FormData");
|
1076
1121
|
} else {
|
1077
1122
|
state.buf.push(
|
1078
|
-
"((f,i)=>
|
1123
|
+
valStr + "].reduce((f,v,i,a)=>i%2&&f.append(v,a[i+1])||f,new FormData)"
|
1079
1124
|
);
|
1080
1125
|
}
|
1081
1126
|
return true;
|
@@ -1560,7 +1605,7 @@ function withContext(key, value, cb) {
|
|
1560
1605
|
}
|
1561
1606
|
function setTagVar(parentScopeId, scopeOffsetAccessor, childScope, registryId) {
|
1562
1607
|
ensureScopeWithId(parentScopeId)[scopeOffsetAccessor] = nextScopeId();
|
1563
|
-
childScope["
|
1608
|
+
childScope["#TagVariable" /* TagVariable */] = register2(
|
1564
1609
|
{},
|
1565
1610
|
registryId,
|
1566
1611
|
parentScopeId
|
@@ -1877,9 +1922,9 @@ function tryContent(scopeId, accessor, content, input) {
|
|
1877
1922
|
content();
|
1878
1923
|
}
|
1879
1924
|
writeScope(branchId, {
|
1880
|
-
["
|
1881
|
-
["
|
1882
|
-
["
|
1925
|
+
["#BranchAccessor" /* BranchAccessor */]: accessor,
|
1926
|
+
["#CatchContent" /* CatchContent */]: catchContent,
|
1927
|
+
["#PlaceholderContent" /* PlaceholderContent */]: placeholderContent
|
1883
1928
|
});
|
1884
1929
|
writeScope(scopeId, {
|
1885
1930
|
["ConditionalScope:" /* ConditionalScope */ + accessor]: getScopeById(branchId)
|