marko 6.0.3 → 6.0.5
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/helpers.d.ts +2 -2
- package/dist/debug/dom.js +138 -136
- package/dist/debug/dom.mjs +138 -136
- package/dist/debug/html.js +250 -237
- package/dist/debug/html.mjs +250 -237
- package/dist/dom/dom.d.ts +5 -0
- package/dist/dom/queue.d.ts +1 -0
- package/dist/dom/scope.d.ts +0 -1
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +85 -90
- package/dist/dom.mjs +85 -90
- package/dist/html/dynamic-tag.d.ts +1 -1
- package/dist/html/writer.d.ts +8 -8
- package/dist/html.js +141 -145
- package/dist/html.mjs +141 -145
- package/dist/translator/index.js +677 -420
- package/dist/translator/util/css-px-props.d.ts +2 -0
- package/dist/translator/util/references.d.ts +1 -0
- package/dist/translator/visitors/program/html.d.ts +1 -1
- package/dist/translator/visitors/tag/native-tag.d.ts +2 -2
- package/package.json +2 -2
package/dist/debug/html.mjs
CHANGED
@@ -23,48 +23,44 @@ function* attrTagIterator() {
|
|
23
23
|
}
|
24
24
|
|
25
25
|
// src/common/helpers.ts
|
26
|
-
function classValue(
|
27
|
-
return toDelimitedString(
|
26
|
+
function classValue(classValue2) {
|
27
|
+
return toDelimitedString(classValue2, " ", stringifyClassObject);
|
28
28
|
}
|
29
29
|
function stringifyClassObject(name, value) {
|
30
30
|
return value ? name : "";
|
31
31
|
}
|
32
|
-
function styleValue(
|
33
|
-
return toDelimitedString(
|
32
|
+
function styleValue(styleValue2) {
|
33
|
+
return toDelimitedString(styleValue2, ";", stringifyStyleObject);
|
34
34
|
}
|
35
35
|
function stringifyStyleObject(name, value) {
|
36
|
-
return value || value === 0 ? `${name}:${typeof value === "number" &&
|
36
|
+
return value || value === 0 ? `${name}:${value && typeof value === "number" && !/^(--|ta|or|li|z)|cou|nk|it|ag|we|do|w$/.test(name) ? value + "px" : value}` : "";
|
37
37
|
}
|
38
38
|
function toDelimitedString(val, delimiter, stringify) {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
curDelimiter = delimiter;
|
52
|
-
}
|
53
|
-
}
|
54
|
-
} else {
|
55
|
-
for (const name in val) {
|
56
|
-
const v = val[name];
|
57
|
-
const part = stringify(name, v);
|
58
|
-
if (part !== "") {
|
59
|
-
result += curDelimiter + part;
|
60
|
-
curDelimiter = delimiter;
|
61
|
-
}
|
62
|
-
}
|
39
|
+
let str = "";
|
40
|
+
let sep = "";
|
41
|
+
let part;
|
42
|
+
if (val) {
|
43
|
+
if (typeof val !== "object") {
|
44
|
+
str += val;
|
45
|
+
} else if (Array.isArray(val)) {
|
46
|
+
for (const v of val) {
|
47
|
+
part = toDelimitedString(v, delimiter, stringify);
|
48
|
+
if (part) {
|
49
|
+
str += sep + part;
|
50
|
+
sep = delimiter;
|
63
51
|
}
|
64
|
-
return result;
|
65
52
|
}
|
53
|
+
} else {
|
54
|
+
for (const name in val) {
|
55
|
+
part = stringify(name, val[name]);
|
56
|
+
if (part) {
|
57
|
+
str += sep + part;
|
58
|
+
sep = delimiter;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
66
62
|
}
|
67
|
-
return
|
63
|
+
return str;
|
68
64
|
}
|
69
65
|
function isEventHandler(name) {
|
70
66
|
return /^on[A-Z-]/.test(name);
|
@@ -125,6 +121,29 @@ function forTo(to, from, step, cb) {
|
|
125
121
|
}
|
126
122
|
}
|
127
123
|
|
124
|
+
// src/html/for.ts
|
125
|
+
function forOfBy(by, item, index) {
|
126
|
+
if (by) {
|
127
|
+
if (typeof by === "string") {
|
128
|
+
return item[by];
|
129
|
+
}
|
130
|
+
return by(item, index);
|
131
|
+
}
|
132
|
+
return index;
|
133
|
+
}
|
134
|
+
function forInBy(by, name, value) {
|
135
|
+
if (by) {
|
136
|
+
return by(name, value);
|
137
|
+
}
|
138
|
+
return name;
|
139
|
+
}
|
140
|
+
function forToBy(by, index) {
|
141
|
+
if (by) {
|
142
|
+
return by(index);
|
143
|
+
}
|
144
|
+
return index;
|
145
|
+
}
|
146
|
+
|
128
147
|
// src/html/inlined-runtimes.ts
|
129
148
|
var WALKER_RUNTIME_CODE = true ? (
|
130
149
|
/* js */
|
@@ -1686,213 +1705,232 @@ var branchIdKey = Symbol();
|
|
1686
1705
|
function withBranchId(branchId, cb) {
|
1687
1706
|
return withContext(branchIdKey, branchId, cb);
|
1688
1707
|
}
|
1689
|
-
function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch) {
|
1690
|
-
|
1691
|
-
|
1708
|
+
function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
|
1709
|
+
const resumeBranch = serializeBranch !== 0;
|
1710
|
+
const resumeMarker = serializeMarker !== 0;
|
1711
|
+
if (resumeBranch) {
|
1712
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1713
|
+
forOf(list, (item, index) => {
|
1714
|
+
const branchId = peekNextScopeId();
|
1715
|
+
if (resumeMarker) {
|
1716
|
+
$chunk.writeHTML(
|
1717
|
+
$chunk.boundary.state.mark(
|
1718
|
+
"[" /* BranchStart */,
|
1719
|
+
branchId + (index ? " " : "")
|
1720
|
+
)
|
1721
|
+
);
|
1722
|
+
}
|
1723
|
+
withBranchId(branchId, () => {
|
1724
|
+
cb(item, index);
|
1725
|
+
loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1726
|
+
});
|
1727
|
+
});
|
1728
|
+
if (loopScopes.size) {
|
1729
|
+
writeScope(scopeId, {
|
1730
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1731
|
+
});
|
1732
|
+
}
|
1733
|
+
} else {
|
1734
|
+
forOf(list, cb);
|
1692
1735
|
}
|
1693
|
-
|
1694
|
-
forOf(list, (item, index) => {
|
1695
|
-
const branchId = peekNextScopeId();
|
1736
|
+
if (resumeMarker) {
|
1696
1737
|
$chunk.writeHTML(
|
1697
1738
|
$chunk.boundary.state.mark(
|
1698
|
-
"
|
1699
|
-
|
1739
|
+
"]" /* BranchEnd */,
|
1740
|
+
scopeId + " " + accessor
|
1700
1741
|
)
|
1701
1742
|
);
|
1702
|
-
withBranchId(branchId, () => {
|
1703
|
-
cb(item, index);
|
1704
|
-
loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1705
|
-
});
|
1706
|
-
});
|
1707
|
-
if (loopScopes.size) {
|
1708
|
-
writeScope(scopeId, {
|
1709
|
-
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1710
|
-
});
|
1711
1743
|
}
|
1712
|
-
$chunk.writeHTML(
|
1713
|
-
$chunk.boundary.state.mark(
|
1714
|
-
"]" /* BranchEnd */,
|
1715
|
-
scopeId + " " + accessor
|
1716
|
-
)
|
1717
|
-
);
|
1718
1744
|
}
|
1719
|
-
function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, onlyChildInParent) {
|
1720
|
-
|
1721
|
-
|
1722
|
-
}
|
1723
|
-
const loopScopes = /* @__PURE__ */ new Map();
|
1745
|
+
function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
|
1746
|
+
const resumeBranch = serializeBranch !== 0;
|
1747
|
+
const resumeMarker = serializeMarker !== 0;
|
1724
1748
|
let branchIds = "";
|
1725
|
-
|
1726
|
-
const
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1735
|
-
|
1749
|
+
if (resumeBranch) {
|
1750
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1751
|
+
forOf(list, (item, index) => {
|
1752
|
+
const branchId = peekNextScopeId();
|
1753
|
+
if (resumeMarker) {
|
1754
|
+
branchIds = " " + branchId + branchIds;
|
1755
|
+
}
|
1756
|
+
withBranchId(branchId, () => {
|
1757
|
+
cb(item, index);
|
1758
|
+
loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1759
|
+
});
|
1736
1760
|
});
|
1737
|
-
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1741
|
-
scopeId + " " + accessor + branchIds
|
1742
|
-
)
|
1743
|
-
);
|
1744
|
-
}
|
1745
|
-
function forOfBy(by, item, index) {
|
1746
|
-
if (by) {
|
1747
|
-
if (typeof by === "string") {
|
1748
|
-
return item[by];
|
1761
|
+
if (loopScopes.size) {
|
1762
|
+
writeScope(scopeId, {
|
1763
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1764
|
+
});
|
1749
1765
|
}
|
1750
|
-
|
1766
|
+
} else {
|
1767
|
+
forOf(list, cb);
|
1768
|
+
}
|
1769
|
+
if (resumeMarker) {
|
1770
|
+
$chunk.writeHTML(
|
1771
|
+
$chunk.boundary.state.mark(
|
1772
|
+
onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1773
|
+
scopeId + " " + accessor + branchIds
|
1774
|
+
)
|
1775
|
+
);
|
1751
1776
|
}
|
1752
|
-
return index;
|
1753
1777
|
}
|
1754
|
-
function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch) {
|
1755
|
-
|
1756
|
-
|
1778
|
+
function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
|
1779
|
+
const resumeBranch = serializeBranch !== 0;
|
1780
|
+
const resumeMarker = serializeMarker !== 0;
|
1781
|
+
if (resumeBranch) {
|
1782
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1783
|
+
let sep = "";
|
1784
|
+
forIn(obj, (key, value) => {
|
1785
|
+
const branchId = peekNextScopeId();
|
1786
|
+
if (resumeMarker) {
|
1787
|
+
$chunk.writeHTML(
|
1788
|
+
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
|
1789
|
+
);
|
1790
|
+
sep = " ";
|
1791
|
+
}
|
1792
|
+
withBranchId(branchId, () => {
|
1793
|
+
cb(key, value);
|
1794
|
+
loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
|
1795
|
+
});
|
1796
|
+
});
|
1797
|
+
if (loopScopes.size) {
|
1798
|
+
writeScope(scopeId, {
|
1799
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1800
|
+
});
|
1801
|
+
}
|
1802
|
+
} else {
|
1803
|
+
forIn(obj, cb);
|
1757
1804
|
}
|
1758
|
-
|
1759
|
-
let sep = "";
|
1760
|
-
forIn(obj, (key, value) => {
|
1761
|
-
const branchId = peekNextScopeId();
|
1805
|
+
if (resumeMarker) {
|
1762
1806
|
$chunk.writeHTML(
|
1763
|
-
$chunk.boundary.state.mark(
|
1807
|
+
$chunk.boundary.state.mark(
|
1808
|
+
"]" /* BranchEnd */,
|
1809
|
+
scopeId + " " + accessor
|
1810
|
+
)
|
1764
1811
|
);
|
1765
|
-
sep = " ";
|
1766
|
-
withBranchId(branchId, () => {
|
1767
|
-
cb(key, value);
|
1768
|
-
loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
|
1769
|
-
});
|
1770
|
-
});
|
1771
|
-
if (loopScopes.size) {
|
1772
|
-
writeScope(scopeId, {
|
1773
|
-
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1774
|
-
});
|
1775
1812
|
}
|
1776
|
-
$chunk.writeHTML(
|
1777
|
-
$chunk.boundary.state.mark(
|
1778
|
-
"]" /* BranchEnd */,
|
1779
|
-
scopeId + " " + accessor
|
1780
|
-
)
|
1781
|
-
);
|
1782
1813
|
}
|
1783
|
-
function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch,
|
1784
|
-
|
1785
|
-
|
1786
|
-
}
|
1787
|
-
const loopScopes = /* @__PURE__ */ new Map();
|
1814
|
+
function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
|
1815
|
+
const resumeBranch = serializeBranch !== 0;
|
1816
|
+
const resumeMarker = serializeMarker !== 0;
|
1788
1817
|
let branchIds = "";
|
1789
|
-
|
1790
|
-
const
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1818
|
+
if (resumeBranch) {
|
1819
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1820
|
+
forIn(obj, (key, value) => {
|
1821
|
+
const branchId = peekNextScopeId();
|
1822
|
+
if (resumeMarker) {
|
1823
|
+
branchIds = " " + branchId + branchIds;
|
1824
|
+
}
|
1825
|
+
withBranchId(branchId, () => {
|
1826
|
+
cb(key, value);
|
1827
|
+
loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
|
1828
|
+
});
|
1800
1829
|
});
|
1830
|
+
if (loopScopes.size) {
|
1831
|
+
writeScope(scopeId, {
|
1832
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1833
|
+
});
|
1834
|
+
}
|
1835
|
+
} else {
|
1836
|
+
forIn(obj, cb);
|
1801
1837
|
}
|
1802
|
-
|
1803
|
-
$chunk.
|
1804
|
-
|
1805
|
-
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
function forInBy(by, name, value) {
|
1810
|
-
if (by) {
|
1811
|
-
return by(name, value);
|
1838
|
+
if (resumeMarker) {
|
1839
|
+
$chunk.writeHTML(
|
1840
|
+
$chunk.boundary.state.mark(
|
1841
|
+
onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1842
|
+
scopeId + " " + accessor + branchIds
|
1843
|
+
)
|
1844
|
+
);
|
1812
1845
|
}
|
1813
|
-
return name;
|
1814
1846
|
}
|
1815
|
-
function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch) {
|
1816
|
-
|
1817
|
-
|
1847
|
+
function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
|
1848
|
+
const resumeBranch = serializeBranch !== 0;
|
1849
|
+
const resumeMarker = serializeMarker !== 0;
|
1850
|
+
if (resumeBranch) {
|
1851
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1852
|
+
let sep = "";
|
1853
|
+
forTo(to, from, step, (i) => {
|
1854
|
+
const branchId = peekNextScopeId();
|
1855
|
+
if (resumeMarker) {
|
1856
|
+
$chunk.writeHTML(
|
1857
|
+
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
|
1858
|
+
);
|
1859
|
+
sep = " ";
|
1860
|
+
}
|
1861
|
+
withBranchId(branchId, () => {
|
1862
|
+
cb(i);
|
1863
|
+
loopScopes.set(forToBy(by, i), writeScope(branchId, {}));
|
1864
|
+
});
|
1865
|
+
});
|
1866
|
+
if (loopScopes.size) {
|
1867
|
+
writeScope(scopeId, {
|
1868
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1869
|
+
});
|
1870
|
+
}
|
1871
|
+
} else {
|
1872
|
+
forTo(to, from, step, cb);
|
1818
1873
|
}
|
1819
|
-
|
1820
|
-
let sep = "";
|
1821
|
-
forTo(to, from, step, (index) => {
|
1822
|
-
const branchId = peekNextScopeId();
|
1874
|
+
if (resumeMarker) {
|
1823
1875
|
$chunk.writeHTML(
|
1824
|
-
$chunk.boundary.state.mark(
|
1876
|
+
$chunk.boundary.state.mark(
|
1877
|
+
"]" /* BranchEnd */,
|
1878
|
+
scopeId + " " + accessor
|
1879
|
+
)
|
1825
1880
|
);
|
1826
|
-
sep = " ";
|
1827
|
-
withBranchId(branchId, () => {
|
1828
|
-
cb(index);
|
1829
|
-
loopScopes.set(forToBy(by, index), writeScope(branchId, {}));
|
1830
|
-
});
|
1831
|
-
});
|
1832
|
-
if (loopScopes.size) {
|
1833
|
-
writeScope(scopeId, {
|
1834
|
-
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1835
|
-
});
|
1836
1881
|
}
|
1837
|
-
$chunk.writeHTML(
|
1838
|
-
$chunk.boundary.state.mark(
|
1839
|
-
"]" /* BranchEnd */,
|
1840
|
-
scopeId + " " + accessor
|
1841
|
-
)
|
1842
|
-
);
|
1843
1882
|
}
|
1844
|
-
function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch,
|
1845
|
-
|
1846
|
-
|
1847
|
-
}
|
1848
|
-
const loopScopes = /* @__PURE__ */ new Map();
|
1883
|
+
function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
|
1884
|
+
const resumeBranch = serializeBranch !== 0;
|
1885
|
+
const resumeMarker = serializeMarker !== 0;
|
1849
1886
|
let branchIds = "";
|
1850
|
-
|
1851
|
-
const
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1887
|
+
if (resumeBranch) {
|
1888
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1889
|
+
forTo(to, from, step, (i) => {
|
1890
|
+
const branchId = peekNextScopeId();
|
1891
|
+
if (resumeMarker) {
|
1892
|
+
branchIds = " " + branchId + branchIds;
|
1893
|
+
}
|
1894
|
+
withBranchId(branchId, () => {
|
1895
|
+
cb(i);
|
1896
|
+
loopScopes.set(forToBy(by, i), writeScope(branchId, {}));
|
1897
|
+
});
|
1861
1898
|
});
|
1899
|
+
if (loopScopes.size) {
|
1900
|
+
writeScope(scopeId, {
|
1901
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1902
|
+
});
|
1903
|
+
}
|
1904
|
+
} else {
|
1905
|
+
forTo(to, from, step, cb);
|
1862
1906
|
}
|
1863
|
-
|
1864
|
-
$chunk.
|
1865
|
-
|
1866
|
-
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1870
|
-
function forToBy(by, index) {
|
1871
|
-
if (by) {
|
1872
|
-
return by(index);
|
1907
|
+
if (resumeMarker) {
|
1908
|
+
$chunk.writeHTML(
|
1909
|
+
$chunk.boundary.state.mark(
|
1910
|
+
onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1911
|
+
scopeId + " " + accessor + branchIds
|
1912
|
+
)
|
1913
|
+
);
|
1873
1914
|
}
|
1874
|
-
return index;
|
1875
1915
|
}
|
1876
1916
|
function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker) {
|
1877
|
-
|
1878
|
-
|
1879
|
-
}
|
1917
|
+
const resumeBranch = serializeBranch !== 0;
|
1918
|
+
const resumeMarker = serializeMarker !== 0;
|
1880
1919
|
const branchId = peekNextScopeId();
|
1881
|
-
if (
|
1920
|
+
if (resumeMarker && resumeBranch) {
|
1882
1921
|
$chunk.writeHTML(
|
1883
1922
|
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
|
1884
1923
|
);
|
1885
1924
|
}
|
1886
|
-
const branchIndex = withBranchId(branchId, cb);
|
1887
|
-
|
1925
|
+
const branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb();
|
1926
|
+
const rendered = branchIndex !== void 0;
|
1927
|
+
if (resumeBranch && rendered) {
|
1888
1928
|
writeScope(scopeId, {
|
1889
|
-
["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]:
|
1929
|
+
["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
|
1890
1930
|
["ConditionalScope:" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
1891
1931
|
});
|
1892
|
-
} else {
|
1893
|
-
nextScopeId();
|
1894
1932
|
}
|
1895
|
-
if (
|
1933
|
+
if (resumeMarker) {
|
1896
1934
|
$chunk.writeHTML(
|
1897
1935
|
$chunk.boundary.state.mark(
|
1898
1936
|
"]" /* BranchEnd */,
|
@@ -1901,26 +1939,23 @@ function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMark
|
|
1901
1939
|
);
|
1902
1940
|
}
|
1903
1941
|
}
|
1904
|
-
function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker,
|
1905
|
-
|
1906
|
-
|
1907
|
-
}
|
1942
|
+
function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
|
1943
|
+
const resumeBranch = serializeBranch !== 0;
|
1944
|
+
const resumeMarker = serializeMarker !== 0;
|
1908
1945
|
const branchId = peekNextScopeId();
|
1909
|
-
const branchIndex = withBranchId(branchId, cb);
|
1910
|
-
const
|
1911
|
-
if (
|
1946
|
+
const branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb();
|
1947
|
+
const shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
1948
|
+
if (shouldWriteBranch) {
|
1912
1949
|
writeScope(scopeId, {
|
1913
|
-
["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]:
|
1950
|
+
["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
|
1914
1951
|
["ConditionalScope:" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
1915
1952
|
});
|
1916
|
-
} else {
|
1917
|
-
nextScopeId();
|
1918
1953
|
}
|
1919
|
-
if (
|
1954
|
+
if (resumeMarker) {
|
1920
1955
|
$chunk.writeHTML(
|
1921
1956
|
$chunk.boundary.state.mark(
|
1922
|
-
|
1923
|
-
scopeId + " " + accessor + (
|
1957
|
+
onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1958
|
+
scopeId + " " + accessor + (shouldWriteBranch ? " " + branchId : "")
|
1924
1959
|
)
|
1925
1960
|
);
|
1926
1961
|
}
|
@@ -3023,7 +3058,8 @@ function NOOP2() {
|
|
3023
3058
|
|
3024
3059
|
// src/html/dynamic-tag.ts
|
3025
3060
|
var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/;
|
3026
|
-
var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs,
|
3061
|
+
var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
|
3062
|
+
const shouldResume = serializeReason !== 0;
|
3027
3063
|
const renderer = normalizeDynamicRenderer(tag);
|
3028
3064
|
if (true) {
|
3029
3065
|
if (renderer && typeof renderer !== "function" && typeof renderer !== "string") {
|
@@ -3094,7 +3130,7 @@ var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, sho
|
|
3094
3130
|
const input = inputIsArgs ? inputOrArgs[0] : inputOrArgs;
|
3095
3131
|
return renderer(
|
3096
3132
|
content ? { ...input, content } : input,
|
3097
|
-
shouldResume
|
3133
|
+
shouldResume ? 1 : 0
|
3098
3134
|
);
|
3099
3135
|
}
|
3100
3136
|
return inputIsArgs ? renderer(...inputOrArgs) : renderer(
|
@@ -3238,29 +3274,6 @@ var compat = {
|
|
3238
3274
|
register(RENDER_BODY_ID, fn);
|
3239
3275
|
}
|
3240
3276
|
};
|
3241
|
-
|
3242
|
-
// src/html/for.ts
|
3243
|
-
function forOfBy2(by, item, index) {
|
3244
|
-
if (by) {
|
3245
|
-
if (typeof by === "string") {
|
3246
|
-
return item[by];
|
3247
|
-
}
|
3248
|
-
return by(item, index);
|
3249
|
-
}
|
3250
|
-
return index;
|
3251
|
-
}
|
3252
|
-
function forInBy2(by, name, value) {
|
3253
|
-
if (by) {
|
3254
|
-
return by(name, value);
|
3255
|
-
}
|
3256
|
-
return name;
|
3257
|
-
}
|
3258
|
-
function forToBy2(by, index) {
|
3259
|
-
if (by) {
|
3260
|
-
return by(index);
|
3261
|
-
}
|
3262
|
-
return index;
|
3263
|
-
}
|
3264
3277
|
export {
|
3265
3278
|
$global,
|
3266
3279
|
attr,
|
@@ -3284,11 +3297,11 @@ export {
|
|
3284
3297
|
escapeStyle,
|
3285
3298
|
escapeXML,
|
3286
3299
|
forIn,
|
3287
|
-
|
3300
|
+
forInBy,
|
3288
3301
|
forOf,
|
3289
|
-
|
3302
|
+
forOfBy,
|
3290
3303
|
forTo,
|
3291
|
-
|
3304
|
+
forToBy,
|
3292
3305
|
fork,
|
3293
3306
|
getScopeById,
|
3294
3307
|
hoist,
|
package/dist/dom/dom.d.ts
CHANGED
@@ -2,7 +2,12 @@ import { type Accessor, type Scope } from "../common/types";
|
|
2
2
|
export declare function attr(element: Element, name: string, value: unknown): void;
|
3
3
|
export declare function setAttribute(element: Element, name: string, value: string | undefined): void;
|
4
4
|
export declare function classAttr(element: Element, value: unknown): void;
|
5
|
+
export declare function classItems(element: Element, items: Record<string, unknown>): void;
|
6
|
+
export declare function classItem(element: Element, name: string, value: unknown): void;
|
5
7
|
export declare function styleAttr(element: Element, value: unknown): void;
|
8
|
+
export declare function styleItems(element: HTMLElement, items: Record<string, unknown>): void;
|
9
|
+
export declare function styleItem(element: HTMLElement, name: string, value: unknown): void;
|
10
|
+
export declare function styleItemValue(value: unknown): unknown;
|
6
11
|
export declare function data(node: Text | Comment, value: unknown): void;
|
7
12
|
export declare function textContent(node: ParentNode, value: unknown): void;
|
8
13
|
export declare function attrs(scope: Scope, nodeAccessor: Accessor, nextAttrs: Record<string, unknown>): void;
|
package/dist/dom/queue.d.ts
CHANGED
@@ -4,6 +4,7 @@ type ExecFn<S extends Scope = Scope> = (scope: S, arg?: any) => void;
|
|
4
4
|
export declare const caughtError: WeakSet<unknown[]>;
|
5
5
|
export declare const placeholderShown: WeakSet<unknown[]>;
|
6
6
|
export declare let pendingEffects: unknown[];
|
7
|
+
export declare let pendingScopes: Scope[];
|
7
8
|
export declare let rendering: undefined | 0 | 1;
|
8
9
|
export declare function queueRender<T>(scope: Scope, signal: Signal<T>, signalKey: number, value?: T, scopeKey?: number): void;
|
9
10
|
export declare function queueEffect<S extends Scope, T extends ExecFn<S>>(scope: S, fn: T): void;
|
package/dist/dom/scope.d.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import type { BranchScope, Scope } from "../common/types";
|
2
2
|
export declare function createScope($global: Scope["$global"], closestBranch?: BranchScope): Scope;
|
3
3
|
export declare function skipScope(scope: Scope): number;
|
4
|
-
export declare function finishPendingScopes(): void;
|
5
4
|
export declare function findBranchWithKey(scope: Scope, key: string): BranchScope | undefined;
|
6
5
|
export declare function destroyBranch(branch: BranchScope): void;
|
7
6
|
export declare function removeAndDestroyBranch(branch: BranchScope): void;
|
package/dist/dom.d.ts
CHANGED
@@ -4,7 +4,7 @@ export { getAbortSignal, resetAbortSignal } from "./dom/abort-signal";
|
|
4
4
|
export { compat } from "./dom/compat";
|
5
5
|
export { awaitTag, conditional, createTry, dynamicTag, loopIn, loopOf, loopTo, } from "./dom/control-flow";
|
6
6
|
export { controllable_detailsOrDialog_open, controllable_detailsOrDialog_open_effect, controllable_input_checked, controllable_input_checked_effect, controllable_input_checkedValue, controllable_input_checkedValue_effect, controllable_input_value, controllable_input_value_effect, controllable_select_value, controllable_select_value_effect, controllable_textarea_value, controllable_textarea_value_effect, } from "./dom/controllable";
|
7
|
-
export { attr, attrs, attrsEvents, classAttr, data, html, lifecycle, partialAttrs, props, styleAttr, textContent, } from "./dom/dom";
|
7
|
+
export { attr, attrs, attrsEvents, classAttr, classItem, classItems, data, html, lifecycle, partialAttrs, props, styleAttr, styleItem, styleItems, styleItemValue, textContent, } from "./dom/dom";
|
8
8
|
export { on } from "./dom/event";
|
9
9
|
export { enableCatch, run } from "./dom/queue";
|
10
10
|
export { createContent, createRenderer, registerContent } from "./dom/renderer";
|