marko 6.0.13 → 6.0.15
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/debug/dom.js +2 -2
- package/dist/debug/dom.mjs +2 -2
- package/dist/debug/html.js +47 -169
- package/dist/debug/html.mjs +47 -165
- package/dist/dom/renderer.d.ts +9 -3
- package/dist/dom.js +2 -2
- package/dist/dom.mjs +2 -2
- package/dist/html/writer.d.ts +4 -8
- package/dist/html.d.ts +1 -1
- package/dist/html.js +30 -134
- package/dist/html.mjs +30 -130
- package/dist/translator/index.js +23 -27
- package/package.json +1 -1
package/dist/debug/dom.js
CHANGED
@@ -1338,7 +1338,7 @@ function createContent(id, template, walks, setup, params, closures, dynamicScop
|
|
1338
1338
|
walks = walks ? walks.replace(/[^\0-1]+$/, "") : "";
|
1339
1339
|
setup ||= void 0;
|
1340
1340
|
params ||= void 0;
|
1341
|
-
closures
|
1341
|
+
closures = closures ? closures._ || closures : void 0;
|
1342
1342
|
const clone = template ? (branch, ns) => {
|
1343
1343
|
((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(
|
1344
1344
|
template,
|
@@ -1507,7 +1507,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
1507
1507
|
const loopScopeAccessor = "LoopScopeArray:" /* LoopScopeArray */ + ownerLoopNodeAccessor;
|
1508
1508
|
const loopScopeMapAccessor = "LoopScopeMap:" /* LoopScopeMap */ + ownerLoopNodeAccessor;
|
1509
1509
|
const ownerSignal = (ownerScope) => {
|
1510
|
-
const scopes = ownerScope[loopScopeAccessor]
|
1510
|
+
const scopes = ownerScope[loopScopeAccessor] ||= ownerScope[loopScopeMapAccessor] ? [...ownerScope[loopScopeMapAccessor].values()] : [];
|
1511
1511
|
const [firstScope] = scopes;
|
1512
1512
|
if (firstScope) {
|
1513
1513
|
queueRender(
|
package/dist/debug/dom.mjs
CHANGED
@@ -1246,7 +1246,7 @@ function createContent(id, template, walks, setup, params, closures, dynamicScop
|
|
1246
1246
|
walks = walks ? walks.replace(/[^\0-1]+$/, "") : "";
|
1247
1247
|
setup ||= void 0;
|
1248
1248
|
params ||= void 0;
|
1249
|
-
closures
|
1249
|
+
closures = closures ? closures._ || closures : void 0;
|
1250
1250
|
const clone = template ? (branch, ns) => {
|
1251
1251
|
((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(
|
1252
1252
|
template,
|
@@ -1415,7 +1415,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
1415
1415
|
const loopScopeAccessor = "LoopScopeArray:" /* LoopScopeArray */ + ownerLoopNodeAccessor;
|
1416
1416
|
const loopScopeMapAccessor = "LoopScopeMap:" /* LoopScopeMap */ + ownerLoopNodeAccessor;
|
1417
1417
|
const ownerSignal = (ownerScope) => {
|
1418
|
-
const scopes = ownerScope[loopScopeAccessor]
|
1418
|
+
const scopes = ownerScope[loopScopeAccessor] ||= ownerScope[loopScopeMapAccessor] ? [...ownerScope[loopScopeMapAccessor].values()] : [];
|
1419
1419
|
const [firstScope] = scopes;
|
1420
1420
|
if (firstScope) {
|
1421
1421
|
queueRender(
|
package/dist/debug/html.js
CHANGED
@@ -64,10 +64,6 @@ __export(html_exports, {
|
|
64
64
|
resumeForIn: () => resumeForIn,
|
65
65
|
resumeForOf: () => resumeForOf,
|
66
66
|
resumeForTo: () => resumeForTo,
|
67
|
-
resumeSingleNodeConditional: () => resumeSingleNodeConditional,
|
68
|
-
resumeSingleNodeForIn: () => resumeSingleNodeForIn,
|
69
|
-
resumeSingleNodeForOf: () => resumeSingleNodeForOf,
|
70
|
-
resumeSingleNodeForTo: () => resumeSingleNodeForTo,
|
71
67
|
serializeGuard: () => serializeGuard,
|
72
68
|
serializeIf: () => serializeIf,
|
73
69
|
setTagVar: () => setTagVar,
|
@@ -1790,55 +1786,23 @@ var branchIdKey = Symbol();
|
|
1790
1786
|
function withBranchId(branchId, cb) {
|
1791
1787
|
return withContext(branchIdKey, branchId, cb);
|
1792
1788
|
}
|
1793
|
-
function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1794
|
-
const
|
1795
|
-
const resumeMarker = serializeMarker !== 0;
|
1796
|
-
if (resumeBranch) {
|
1797
|
-
const loopScopes = /* @__PURE__ */ new Map();
|
1798
|
-
forOf(list, (item, index) => {
|
1799
|
-
const branchId = peekNextScopeId();
|
1800
|
-
if (resumeMarker) {
|
1801
|
-
$chunk.writeHTML(
|
1802
|
-
$chunk.boundary.state.mark(
|
1803
|
-
"[" /* BranchStart */,
|
1804
|
-
branchId + (index ? " " : "")
|
1805
|
-
)
|
1806
|
-
);
|
1807
|
-
}
|
1808
|
-
withBranchId(branchId, () => {
|
1809
|
-
cb(item, index);
|
1810
|
-
loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1811
|
-
});
|
1812
|
-
});
|
1813
|
-
if (loopScopes.size) {
|
1814
|
-
writeScope(scopeId, {
|
1815
|
-
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1816
|
-
});
|
1817
|
-
}
|
1818
|
-
} else {
|
1819
|
-
forOf(list, cb);
|
1820
|
-
}
|
1821
|
-
writeBranchEnd(
|
1822
|
-
scopeId,
|
1823
|
-
accessor,
|
1824
|
-
resumeMarker,
|
1825
|
-
parentEndTag,
|
1826
|
-
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1827
|
-
"]" /* BranchEnd */,
|
1828
|
-
scopeId + " " + accessor
|
1829
|
-
)
|
1830
|
-
);
|
1831
|
-
}
|
1832
|
-
function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1789
|
+
function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1790
|
+
const { state } = $chunk.boundary;
|
1833
1791
|
const resumeBranch = serializeBranch !== 0;
|
1834
1792
|
const resumeMarker = serializeMarker !== 0;
|
1835
|
-
let
|
1793
|
+
let singleNodeBranchIds = "";
|
1836
1794
|
if (resumeBranch) {
|
1837
1795
|
const loopScopes = /* @__PURE__ */ new Map();
|
1838
1796
|
forOf(list, (item, index) => {
|
1839
1797
|
const branchId = peekNextScopeId();
|
1840
1798
|
if (resumeMarker) {
|
1841
|
-
|
1799
|
+
if (singleNode) {
|
1800
|
+
singleNodeBranchIds = " " + branchId + singleNodeBranchIds;
|
1801
|
+
} else {
|
1802
|
+
$chunk.writeHTML(
|
1803
|
+
state.mark("[" /* BranchStart */, branchId + (index ? " " : ""))
|
1804
|
+
);
|
1805
|
+
}
|
1842
1806
|
}
|
1843
1807
|
withBranchId(branchId, () => {
|
1844
1808
|
cb(item, index);
|
@@ -1858,60 +1822,31 @@ function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch,
|
|
1858
1822
|
accessor,
|
1859
1823
|
resumeMarker,
|
1860
1824
|
parentEndTag,
|
1861
|
-
resumeMarker && (!parentEndTag || resumeBranch) &&
|
1825
|
+
resumeMarker && (!parentEndTag || resumeBranch) && (singleNode ? state.mark(
|
1862
1826
|
parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1863
|
-
scopeId + " " + accessor +
|
1864
|
-
)
|
1827
|
+
scopeId + " " + accessor + singleNodeBranchIds
|
1828
|
+
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1865
1829
|
);
|
1866
1830
|
}
|
1867
|
-
function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1831
|
+
function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1832
|
+
const { state } = $chunk.boundary;
|
1868
1833
|
const resumeBranch = serializeBranch !== 0;
|
1869
1834
|
const resumeMarker = serializeMarker !== 0;
|
1835
|
+
let singleNodeBranchIds = "";
|
1870
1836
|
if (resumeBranch) {
|
1871
1837
|
const loopScopes = /* @__PURE__ */ new Map();
|
1872
1838
|
let sep = "";
|
1873
1839
|
forIn(obj, (key, value) => {
|
1874
1840
|
const branchId = peekNextScopeId();
|
1875
1841
|
if (resumeMarker) {
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1879
|
-
|
1880
|
-
|
1881
|
-
|
1882
|
-
|
1883
|
-
|
1884
|
-
});
|
1885
|
-
});
|
1886
|
-
if (loopScopes.size) {
|
1887
|
-
writeScope(scopeId, {
|
1888
|
-
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1889
|
-
});
|
1890
|
-
}
|
1891
|
-
} else {
|
1892
|
-
forIn(obj, cb);
|
1893
|
-
}
|
1894
|
-
writeBranchEnd(
|
1895
|
-
scopeId,
|
1896
|
-
accessor,
|
1897
|
-
resumeMarker,
|
1898
|
-
parentEndTag,
|
1899
|
-
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1900
|
-
"]" /* BranchEnd */,
|
1901
|
-
scopeId + " " + accessor
|
1902
|
-
)
|
1903
|
-
);
|
1904
|
-
}
|
1905
|
-
function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1906
|
-
const resumeBranch = serializeBranch !== 0;
|
1907
|
-
const resumeMarker = serializeMarker !== 0;
|
1908
|
-
let branchIds = "";
|
1909
|
-
if (resumeBranch) {
|
1910
|
-
const loopScopes = /* @__PURE__ */ new Map();
|
1911
|
-
forIn(obj, (key, value) => {
|
1912
|
-
const branchId = peekNextScopeId();
|
1913
|
-
if (resumeMarker) {
|
1914
|
-
branchIds = " " + branchId + branchIds;
|
1842
|
+
if (singleNode) {
|
1843
|
+
singleNodeBranchIds = " " + branchId + singleNodeBranchIds;
|
1844
|
+
} else {
|
1845
|
+
$chunk.writeHTML(
|
1846
|
+
state.mark("[" /* BranchStart */, branchId + sep)
|
1847
|
+
);
|
1848
|
+
sep = " ";
|
1849
|
+
}
|
1915
1850
|
}
|
1916
1851
|
withBranchId(branchId, () => {
|
1917
1852
|
cb(key, value);
|
@@ -1931,60 +1866,31 @@ function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch,
|
|
1931
1866
|
accessor,
|
1932
1867
|
resumeMarker,
|
1933
1868
|
parentEndTag,
|
1934
|
-
resumeMarker && (!parentEndTag || resumeBranch) &&
|
1869
|
+
resumeMarker && (!parentEndTag || resumeBranch) && (singleNode ? state.mark(
|
1935
1870
|
parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1936
|
-
scopeId + " " + accessor +
|
1937
|
-
)
|
1871
|
+
scopeId + " " + accessor + singleNodeBranchIds
|
1872
|
+
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1938
1873
|
);
|
1939
1874
|
}
|
1940
|
-
function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1875
|
+
function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1876
|
+
const { state } = $chunk.boundary;
|
1941
1877
|
const resumeBranch = serializeBranch !== 0;
|
1942
1878
|
const resumeMarker = serializeMarker !== 0;
|
1879
|
+
let singleNodeBranchIds = "";
|
1943
1880
|
if (resumeBranch) {
|
1944
1881
|
const loopScopes = /* @__PURE__ */ new Map();
|
1945
1882
|
let sep = "";
|
1946
1883
|
forTo(to, from, step, (i) => {
|
1947
1884
|
const branchId = peekNextScopeId();
|
1948
1885
|
if (resumeMarker) {
|
1949
|
-
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
1953
|
-
|
1954
|
-
|
1955
|
-
|
1956
|
-
|
1957
|
-
});
|
1958
|
-
});
|
1959
|
-
if (loopScopes.size) {
|
1960
|
-
writeScope(scopeId, {
|
1961
|
-
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1962
|
-
});
|
1963
|
-
}
|
1964
|
-
} else {
|
1965
|
-
forTo(to, from, step, cb);
|
1966
|
-
}
|
1967
|
-
writeBranchEnd(
|
1968
|
-
scopeId,
|
1969
|
-
accessor,
|
1970
|
-
resumeMarker,
|
1971
|
-
parentEndTag,
|
1972
|
-
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1973
|
-
"]" /* BranchEnd */,
|
1974
|
-
scopeId + " " + accessor
|
1975
|
-
)
|
1976
|
-
);
|
1977
|
-
}
|
1978
|
-
function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1979
|
-
const resumeBranch = serializeBranch !== 0;
|
1980
|
-
const resumeMarker = serializeMarker !== 0;
|
1981
|
-
let branchIds = "";
|
1982
|
-
if (resumeBranch) {
|
1983
|
-
const loopScopes = /* @__PURE__ */ new Map();
|
1984
|
-
forTo(to, from, step, (i) => {
|
1985
|
-
const branchId = peekNextScopeId();
|
1986
|
-
if (resumeMarker) {
|
1987
|
-
branchIds = " " + branchId + branchIds;
|
1886
|
+
if (singleNode) {
|
1887
|
+
singleNodeBranchIds = " " + branchId + singleNodeBranchIds;
|
1888
|
+
} else {
|
1889
|
+
$chunk.writeHTML(
|
1890
|
+
state.mark("[" /* BranchStart */, branchId + sep)
|
1891
|
+
);
|
1892
|
+
sep = " ";
|
1893
|
+
}
|
1988
1894
|
}
|
1989
1895
|
withBranchId(branchId, () => {
|
1990
1896
|
cb(i);
|
@@ -2004,45 +1910,21 @@ function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serial
|
|
2004
1910
|
accessor,
|
2005
1911
|
resumeMarker,
|
2006
1912
|
parentEndTag,
|
2007
|
-
resumeMarker && (!parentEndTag || resumeBranch) &&
|
1913
|
+
resumeMarker && (!parentEndTag || resumeBranch) && (singleNode ? state.mark(
|
2008
1914
|
parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
2009
|
-
scopeId + " " + accessor +
|
2010
|
-
)
|
1915
|
+
scopeId + " " + accessor + singleNodeBranchIds
|
1916
|
+
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
2011
1917
|
);
|
2012
1918
|
}
|
2013
|
-
function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1919
|
+
function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1920
|
+
const { state } = $chunk.boundary;
|
2014
1921
|
const resumeBranch = serializeBranch !== 0;
|
2015
1922
|
const resumeMarker = serializeMarker !== 0;
|
2016
1923
|
const branchId = peekNextScopeId();
|
2017
|
-
if (resumeMarker && resumeBranch) {
|
2018
|
-
$chunk.writeHTML(
|
2019
|
-
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
|
2020
|
-
);
|
1924
|
+
if (resumeMarker && resumeBranch && !singleNode) {
|
1925
|
+
$chunk.writeHTML(state.mark("[" /* BranchStart */, branchId + ""));
|
2021
1926
|
}
|
2022
1927
|
const branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb();
|
2023
|
-
const rendered = branchIndex !== void 0;
|
2024
|
-
if (resumeBranch && rendered) {
|
2025
|
-
writeScope(scopeId, {
|
2026
|
-
["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
|
2027
|
-
["ConditionalScope:" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
2028
|
-
});
|
2029
|
-
}
|
2030
|
-
writeBranchEnd(
|
2031
|
-
scopeId,
|
2032
|
-
accessor,
|
2033
|
-
resumeMarker,
|
2034
|
-
parentEndTag,
|
2035
|
-
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
2036
|
-
"]" /* BranchEnd */,
|
2037
|
-
scopeId + " " + accessor
|
2038
|
-
)
|
2039
|
-
);
|
2040
|
-
}
|
2041
|
-
function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
2042
|
-
const resumeBranch = serializeBranch !== 0;
|
2043
|
-
const resumeMarker = serializeMarker !== 0;
|
2044
|
-
const branchId = peekNextScopeId();
|
2045
|
-
const branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb();
|
2046
1928
|
const shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
2047
1929
|
if (shouldWriteBranch) {
|
2048
1930
|
writeScope(scopeId, {
|
@@ -2055,10 +1937,10 @@ function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, ser
|
|
2055
1937
|
accessor,
|
2056
1938
|
resumeMarker,
|
2057
1939
|
parentEndTag,
|
2058
|
-
resumeMarker && (!parentEndTag || resumeBranch) &&
|
1940
|
+
resumeMarker && (!parentEndTag || resumeBranch) && (singleNode ? state.mark(
|
2059
1941
|
parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
2060
1942
|
scopeId + " " + accessor + (shouldWriteBranch ? " " + branchId : "")
|
2061
|
-
)
|
1943
|
+
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
2062
1944
|
);
|
2063
1945
|
}
|
2064
1946
|
function writeBranchEnd(scopeId, accessor, resumeMarker, parentEndTag, mark) {
|
@@ -3442,10 +3324,6 @@ var compat = {
|
|
3442
3324
|
resumeForIn,
|
3443
3325
|
resumeForOf,
|
3444
3326
|
resumeForTo,
|
3445
|
-
resumeSingleNodeConditional,
|
3446
|
-
resumeSingleNodeForIn,
|
3447
|
-
resumeSingleNodeForOf,
|
3448
|
-
resumeSingleNodeForTo,
|
3449
3327
|
serializeGuard,
|
3450
3328
|
serializeIf,
|
3451
3329
|
setTagVar,
|
package/dist/debug/html.mjs
CHANGED
@@ -1705,55 +1705,23 @@ var branchIdKey = Symbol();
|
|
1705
1705
|
function withBranchId(branchId, cb) {
|
1706
1706
|
return withContext(branchIdKey, branchId, cb);
|
1707
1707
|
}
|
1708
|
-
function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1709
|
-
const
|
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);
|
1735
|
-
}
|
1736
|
-
writeBranchEnd(
|
1737
|
-
scopeId,
|
1738
|
-
accessor,
|
1739
|
-
resumeMarker,
|
1740
|
-
parentEndTag,
|
1741
|
-
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1742
|
-
"]" /* BranchEnd */,
|
1743
|
-
scopeId + " " + accessor
|
1744
|
-
)
|
1745
|
-
);
|
1746
|
-
}
|
1747
|
-
function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1708
|
+
function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1709
|
+
const { state } = $chunk.boundary;
|
1748
1710
|
const resumeBranch = serializeBranch !== 0;
|
1749
1711
|
const resumeMarker = serializeMarker !== 0;
|
1750
|
-
let
|
1712
|
+
let singleNodeBranchIds = "";
|
1751
1713
|
if (resumeBranch) {
|
1752
1714
|
const loopScopes = /* @__PURE__ */ new Map();
|
1753
1715
|
forOf(list, (item, index) => {
|
1754
1716
|
const branchId = peekNextScopeId();
|
1755
1717
|
if (resumeMarker) {
|
1756
|
-
|
1718
|
+
if (singleNode) {
|
1719
|
+
singleNodeBranchIds = " " + branchId + singleNodeBranchIds;
|
1720
|
+
} else {
|
1721
|
+
$chunk.writeHTML(
|
1722
|
+
state.mark("[" /* BranchStart */, branchId + (index ? " " : ""))
|
1723
|
+
);
|
1724
|
+
}
|
1757
1725
|
}
|
1758
1726
|
withBranchId(branchId, () => {
|
1759
1727
|
cb(item, index);
|
@@ -1773,60 +1741,31 @@ function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch,
|
|
1773
1741
|
accessor,
|
1774
1742
|
resumeMarker,
|
1775
1743
|
parentEndTag,
|
1776
|
-
resumeMarker && (!parentEndTag || resumeBranch) &&
|
1744
|
+
resumeMarker && (!parentEndTag || resumeBranch) && (singleNode ? state.mark(
|
1777
1745
|
parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1778
|
-
scopeId + " " + accessor +
|
1779
|
-
)
|
1746
|
+
scopeId + " " + accessor + singleNodeBranchIds
|
1747
|
+
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1780
1748
|
);
|
1781
1749
|
}
|
1782
|
-
function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1750
|
+
function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1751
|
+
const { state } = $chunk.boundary;
|
1783
1752
|
const resumeBranch = serializeBranch !== 0;
|
1784
1753
|
const resumeMarker = serializeMarker !== 0;
|
1754
|
+
let singleNodeBranchIds = "";
|
1785
1755
|
if (resumeBranch) {
|
1786
1756
|
const loopScopes = /* @__PURE__ */ new Map();
|
1787
1757
|
let sep = "";
|
1788
1758
|
forIn(obj, (key, value) => {
|
1789
1759
|
const branchId = peekNextScopeId();
|
1790
1760
|
if (resumeMarker) {
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
});
|
1800
|
-
});
|
1801
|
-
if (loopScopes.size) {
|
1802
|
-
writeScope(scopeId, {
|
1803
|
-
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1804
|
-
});
|
1805
|
-
}
|
1806
|
-
} else {
|
1807
|
-
forIn(obj, cb);
|
1808
|
-
}
|
1809
|
-
writeBranchEnd(
|
1810
|
-
scopeId,
|
1811
|
-
accessor,
|
1812
|
-
resumeMarker,
|
1813
|
-
parentEndTag,
|
1814
|
-
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1815
|
-
"]" /* BranchEnd */,
|
1816
|
-
scopeId + " " + accessor
|
1817
|
-
)
|
1818
|
-
);
|
1819
|
-
}
|
1820
|
-
function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1821
|
-
const resumeBranch = serializeBranch !== 0;
|
1822
|
-
const resumeMarker = serializeMarker !== 0;
|
1823
|
-
let branchIds = "";
|
1824
|
-
if (resumeBranch) {
|
1825
|
-
const loopScopes = /* @__PURE__ */ new Map();
|
1826
|
-
forIn(obj, (key, value) => {
|
1827
|
-
const branchId = peekNextScopeId();
|
1828
|
-
if (resumeMarker) {
|
1829
|
-
branchIds = " " + branchId + branchIds;
|
1761
|
+
if (singleNode) {
|
1762
|
+
singleNodeBranchIds = " " + branchId + singleNodeBranchIds;
|
1763
|
+
} else {
|
1764
|
+
$chunk.writeHTML(
|
1765
|
+
state.mark("[" /* BranchStart */, branchId + sep)
|
1766
|
+
);
|
1767
|
+
sep = " ";
|
1768
|
+
}
|
1830
1769
|
}
|
1831
1770
|
withBranchId(branchId, () => {
|
1832
1771
|
cb(key, value);
|
@@ -1846,60 +1785,31 @@ function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch,
|
|
1846
1785
|
accessor,
|
1847
1786
|
resumeMarker,
|
1848
1787
|
parentEndTag,
|
1849
|
-
resumeMarker && (!parentEndTag || resumeBranch) &&
|
1788
|
+
resumeMarker && (!parentEndTag || resumeBranch) && (singleNode ? state.mark(
|
1850
1789
|
parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1851
|
-
scopeId + " " + accessor +
|
1852
|
-
)
|
1790
|
+
scopeId + " " + accessor + singleNodeBranchIds
|
1791
|
+
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1853
1792
|
);
|
1854
1793
|
}
|
1855
|
-
function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1794
|
+
function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1795
|
+
const { state } = $chunk.boundary;
|
1856
1796
|
const resumeBranch = serializeBranch !== 0;
|
1857
1797
|
const resumeMarker = serializeMarker !== 0;
|
1798
|
+
let singleNodeBranchIds = "";
|
1858
1799
|
if (resumeBranch) {
|
1859
1800
|
const loopScopes = /* @__PURE__ */ new Map();
|
1860
1801
|
let sep = "";
|
1861
1802
|
forTo(to, from, step, (i) => {
|
1862
1803
|
const branchId = peekNextScopeId();
|
1863
1804
|
if (resumeMarker) {
|
1864
|
-
|
1865
|
-
|
1866
|
-
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1870
|
-
|
1871
|
-
|
1872
|
-
});
|
1873
|
-
});
|
1874
|
-
if (loopScopes.size) {
|
1875
|
-
writeScope(scopeId, {
|
1876
|
-
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1877
|
-
});
|
1878
|
-
}
|
1879
|
-
} else {
|
1880
|
-
forTo(to, from, step, cb);
|
1881
|
-
}
|
1882
|
-
writeBranchEnd(
|
1883
|
-
scopeId,
|
1884
|
-
accessor,
|
1885
|
-
resumeMarker,
|
1886
|
-
parentEndTag,
|
1887
|
-
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1888
|
-
"]" /* BranchEnd */,
|
1889
|
-
scopeId + " " + accessor
|
1890
|
-
)
|
1891
|
-
);
|
1892
|
-
}
|
1893
|
-
function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1894
|
-
const resumeBranch = serializeBranch !== 0;
|
1895
|
-
const resumeMarker = serializeMarker !== 0;
|
1896
|
-
let branchIds = "";
|
1897
|
-
if (resumeBranch) {
|
1898
|
-
const loopScopes = /* @__PURE__ */ new Map();
|
1899
|
-
forTo(to, from, step, (i) => {
|
1900
|
-
const branchId = peekNextScopeId();
|
1901
|
-
if (resumeMarker) {
|
1902
|
-
branchIds = " " + branchId + branchIds;
|
1805
|
+
if (singleNode) {
|
1806
|
+
singleNodeBranchIds = " " + branchId + singleNodeBranchIds;
|
1807
|
+
} else {
|
1808
|
+
$chunk.writeHTML(
|
1809
|
+
state.mark("[" /* BranchStart */, branchId + sep)
|
1810
|
+
);
|
1811
|
+
sep = " ";
|
1812
|
+
}
|
1903
1813
|
}
|
1904
1814
|
withBranchId(branchId, () => {
|
1905
1815
|
cb(i);
|
@@ -1919,45 +1829,21 @@ function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serial
|
|
1919
1829
|
accessor,
|
1920
1830
|
resumeMarker,
|
1921
1831
|
parentEndTag,
|
1922
|
-
resumeMarker && (!parentEndTag || resumeBranch) &&
|
1832
|
+
resumeMarker && (!parentEndTag || resumeBranch) && (singleNode ? state.mark(
|
1923
1833
|
parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1924
|
-
scopeId + " " + accessor +
|
1925
|
-
)
|
1834
|
+
scopeId + " " + accessor + singleNodeBranchIds
|
1835
|
+
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1926
1836
|
);
|
1927
1837
|
}
|
1928
|
-
function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1838
|
+
function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1839
|
+
const { state } = $chunk.boundary;
|
1929
1840
|
const resumeBranch = serializeBranch !== 0;
|
1930
1841
|
const resumeMarker = serializeMarker !== 0;
|
1931
1842
|
const branchId = peekNextScopeId();
|
1932
|
-
if (resumeMarker && resumeBranch) {
|
1933
|
-
$chunk.writeHTML(
|
1934
|
-
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
|
1935
|
-
);
|
1843
|
+
if (resumeMarker && resumeBranch && !singleNode) {
|
1844
|
+
$chunk.writeHTML(state.mark("[" /* BranchStart */, branchId + ""));
|
1936
1845
|
}
|
1937
1846
|
const branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb();
|
1938
|
-
const rendered = branchIndex !== void 0;
|
1939
|
-
if (resumeBranch && rendered) {
|
1940
|
-
writeScope(scopeId, {
|
1941
|
-
["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
|
1942
|
-
["ConditionalScope:" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
1943
|
-
});
|
1944
|
-
}
|
1945
|
-
writeBranchEnd(
|
1946
|
-
scopeId,
|
1947
|
-
accessor,
|
1948
|
-
resumeMarker,
|
1949
|
-
parentEndTag,
|
1950
|
-
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1951
|
-
"]" /* BranchEnd */,
|
1952
|
-
scopeId + " " + accessor
|
1953
|
-
)
|
1954
|
-
);
|
1955
|
-
}
|
1956
|
-
function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1957
|
-
const resumeBranch = serializeBranch !== 0;
|
1958
|
-
const resumeMarker = serializeMarker !== 0;
|
1959
|
-
const branchId = peekNextScopeId();
|
1960
|
-
const branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb();
|
1961
1847
|
const shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
1962
1848
|
if (shouldWriteBranch) {
|
1963
1849
|
writeScope(scopeId, {
|
@@ -1970,10 +1856,10 @@ function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, ser
|
|
1970
1856
|
accessor,
|
1971
1857
|
resumeMarker,
|
1972
1858
|
parentEndTag,
|
1973
|
-
resumeMarker && (!parentEndTag || resumeBranch) &&
|
1859
|
+
resumeMarker && (!parentEndTag || resumeBranch) && (singleNode ? state.mark(
|
1974
1860
|
parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1975
1861
|
scopeId + " " + accessor + (shouldWriteBranch ? " " + branchId : "")
|
1976
|
-
)
|
1862
|
+
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1977
1863
|
);
|
1978
1864
|
}
|
1979
1865
|
function writeBranchEnd(scopeId, accessor, resumeMarker, parentEndTag, mark) {
|
@@ -3356,10 +3242,6 @@ export {
|
|
3356
3242
|
resumeForIn,
|
3357
3243
|
resumeForOf,
|
3358
3244
|
resumeForTo,
|
3359
|
-
resumeSingleNodeConditional,
|
3360
|
-
resumeSingleNodeForIn,
|
3361
|
-
resumeSingleNodeForOf,
|
3362
|
-
resumeSingleNodeForTo,
|
3363
3245
|
serializeGuard,
|
3364
3246
|
serializeIf,
|
3365
3247
|
setTagVar,
|
package/dist/dom/renderer.d.ts
CHANGED
@@ -13,7 +13,13 @@ type SetupFn = (scope: Scope) => void;
|
|
13
13
|
export declare function createBranch($global: Scope["$global"], renderer: Renderer | string, parentScope: Scope | undefined, parentNode: ParentNode): BranchScope;
|
14
14
|
export declare function createAndSetupBranch($global: Scope["$global"], renderer: Renderer, parentScope: Scope | undefined, parentNode: ParentNode): BranchScope;
|
15
15
|
export declare function setupBranch(renderer: Renderer, branch: BranchScope): BranchScope;
|
16
|
-
export declare function createContent(id: string, template: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown> | 0, closures?:
|
17
|
-
|
18
|
-
|
16
|
+
export declare function createContent(id: string, template: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown> | 0, closures?: {
|
17
|
+
_: Signal<unknown>;
|
18
|
+
} | Signal<unknown> | 0, dynamicScopesAccessor?: Accessor): (owner?: Scope) => Renderer;
|
19
|
+
export declare function registerContent(id: string, template: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown> | 0, closures?: {
|
20
|
+
_: Signal<unknown>;
|
21
|
+
} | Signal<unknown> | 0, dynamicScopesAccessor?: Accessor): (owner?: Scope) => Renderer;
|
22
|
+
export declare function createRenderer(template: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown> | 0, closures?: {
|
23
|
+
_: Signal<unknown>;
|
24
|
+
} | Signal<unknown> | 0): Renderer;
|
19
25
|
export {};
|
package/dist/dom.js
CHANGED
@@ -884,7 +884,7 @@ function setupBranch(renderer, branch) {
|
|
884
884
|
), branch;
|
885
885
|
}
|
886
886
|
function createContent(id, template, walks, setup, params, closures, dynamicScopesAccessor) {
|
887
|
-
walks = walks ? walks.replace(/[^\0-1]+$/, "") : "", setup ||= void 0, params ||= void 0, closures
|
887
|
+
walks = walks ? walks.replace(/[^\0-1]+$/, "") : "", setup ||= void 0, params ||= void 0, closures = closures ? closures._ || closures : void 0;
|
888
888
|
let clone = template ? (branch, ns) => {
|
889
889
|
((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(
|
890
890
|
template,
|
@@ -980,7 +980,7 @@ function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__
|
|
980
980
|
}
|
981
981
|
function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
982
982
|
let childSignal = closure(valueAccessor, fn), loopScopeAccessor = "l" /* LoopScopeArray */ + ownerLoopNodeAccessor, loopScopeMapAccessor = "m" /* LoopScopeMap */ + ownerLoopNodeAccessor, ownerSignal = (ownerScope) => {
|
983
|
-
let scopes = ownerScope[loopScopeAccessor]
|
983
|
+
let scopes = ownerScope[loopScopeAccessor] ||= ownerScope[loopScopeMapAccessor] ? [...ownerScope[loopScopeMapAccessor].values()] : [], [firstScope] = scopes;
|
984
984
|
firstScope && queueRender(
|
985
985
|
ownerScope,
|
986
986
|
() => {
|
package/dist/dom.mjs
CHANGED
@@ -795,7 +795,7 @@ function setupBranch(renderer, branch) {
|
|
795
795
|
), branch;
|
796
796
|
}
|
797
797
|
function createContent(id, template, walks, setup, params, closures, dynamicScopesAccessor) {
|
798
|
-
walks = walks ? walks.replace(/[^\0-1]+$/, "") : "", setup ||= void 0, params ||= void 0, closures
|
798
|
+
walks = walks ? walks.replace(/[^\0-1]+$/, "") : "", setup ||= void 0, params ||= void 0, closures = closures ? closures._ || closures : void 0;
|
799
799
|
let clone = template ? (branch, ns) => {
|
800
800
|
((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(
|
801
801
|
template,
|
@@ -891,7 +891,7 @@ function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__
|
|
891
891
|
}
|
892
892
|
function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
893
893
|
let childSignal = closure(valueAccessor, fn), loopScopeAccessor = "l" /* LoopScopeArray */ + ownerLoopNodeAccessor, loopScopeMapAccessor = "m" /* LoopScopeMap */ + ownerLoopNodeAccessor, ownerSignal = (ownerScope) => {
|
894
|
-
let scopes = ownerScope[loopScopeAccessor]
|
894
|
+
let scopes = ownerScope[loopScopeAccessor] ||= ownerScope[loopScopeMapAccessor] ? [...ownerScope[loopScopeMapAccessor].values()] : [], [firstScope] = scopes;
|
895
895
|
firstScope && queueRender(
|
896
896
|
ownerScope,
|
897
897
|
() => {
|
package/dist/html/writer.d.ts
CHANGED
@@ -35,14 +35,10 @@ export declare function hoist(scopeId: number, id?: string): {
|
|
35
35
|
};
|
36
36
|
export declare function resumeClosestBranch(scopeId: number): void;
|
37
37
|
export declare function withBranchId<T>(branchId: number, cb: () => T): T;
|
38
|
-
export declare function resumeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string): void;
|
39
|
-
export declare function
|
40
|
-
export declare function
|
41
|
-
export declare function
|
42
|
-
export declare function resumeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string): void;
|
43
|
-
export declare function resumeSingleNodeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string): void;
|
44
|
-
export declare function resumeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string): void;
|
45
|
-
export declare function resumeSingleNodeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string): void;
|
38
|
+
export declare function resumeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1): void;
|
39
|
+
export declare function resumeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1): void;
|
40
|
+
export declare function resumeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1): void;
|
41
|
+
export declare function resumeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1): void;
|
46
42
|
declare let writeScope: (scopeId: number, partialScope: PartialScope) => ScopeInternals;
|
47
43
|
export { writeScope };
|
48
44
|
export declare function writeExistingScope(scopeId: number): ScopeInternals;
|
package/dist/html.d.ts
CHANGED
@@ -5,4 +5,4 @@ export { escapeScript, escapeStyle, escapeXML, toString } from "./html/content";
|
|
5
5
|
export { createContent, dynamicTag, registerContent } from "./html/dynamic-tag";
|
6
6
|
export { forIn, forInBy, forOf, forOfBy, forTo, forToBy } from "./html/for";
|
7
7
|
export { createTemplate } from "./html/template";
|
8
|
-
export { $global, commentSeparator, ensureScopeWithId, fork, getScopeById, hoist, markResumeNode, nextScopeId, nextTagId, nodeRef, peekNextScopeId, register, resumeClosestBranch, resumeConditional, resumeForIn, resumeForOf, resumeForTo,
|
8
|
+
export { $global, commentSeparator, ensureScopeWithId, fork, getScopeById, hoist, markResumeNode, nextScopeId, nextTagId, nodeRef, peekNextScopeId, register, resumeClosestBranch, resumeConditional, resumeForIn, resumeForOf, resumeForTo, serializeGuard, serializeIf, setTagVar, tryContent, write, writeEffect, writeExistingScope, writeScope, writeSubscribe, writeTrailers, } from "./html/writer";
|
package/dist/html.js
CHANGED
@@ -61,10 +61,6 @@ __export(html_exports, {
|
|
61
61
|
resumeForIn: () => resumeForIn,
|
62
62
|
resumeForOf: () => resumeForOf,
|
63
63
|
resumeForTo: () => resumeForTo,
|
64
|
-
resumeSingleNodeConditional: () => resumeSingleNodeConditional,
|
65
|
-
resumeSingleNodeForIn: () => resumeSingleNodeForIn,
|
66
|
-
resumeSingleNodeForOf: () => resumeSingleNodeForOf,
|
67
|
-
resumeSingleNodeForTo: () => resumeSingleNodeForTo,
|
68
64
|
serializeGuard: () => serializeGuard,
|
69
65
|
serializeIf: () => serializeIf,
|
70
66
|
setTagVar: () => setTagVar,
|
@@ -1172,43 +1168,15 @@ var branchIdKey = Symbol();
|
|
1172
1168
|
function withBranchId(branchId, cb) {
|
1173
1169
|
return withContext(branchIdKey, branchId, cb);
|
1174
1170
|
}
|
1175
|
-
function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1176
|
-
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0;
|
1171
|
+
function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1172
|
+
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, singleNodeBranchIds = "";
|
1177
1173
|
if (resumeBranch) {
|
1178
1174
|
let loopScopes = /* @__PURE__ */ new Map();
|
1179
1175
|
forOf(list, (item, index) => {
|
1180
1176
|
let branchId = peekNextScopeId();
|
1181
|
-
resumeMarker && $chunk.writeHTML(
|
1182
|
-
|
1183
|
-
|
1184
|
-
branchId + (index ? " " : "")
|
1185
|
-
)
|
1186
|
-
), withBranchId(branchId, () => {
|
1187
|
-
cb(item, index), loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1188
|
-
});
|
1189
|
-
}), loopScopes.size && writeScope(scopeId, {
|
1190
|
-
["m" /* LoopScopeMap */ + accessor]: loopScopes
|
1191
|
-
});
|
1192
|
-
} else
|
1193
|
-
forOf(list, cb);
|
1194
|
-
writeBranchEnd(
|
1195
|
-
scopeId,
|
1196
|
-
accessor,
|
1197
|
-
resumeMarker,
|
1198
|
-
parentEndTag,
|
1199
|
-
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1200
|
-
"]" /* BranchEnd */,
|
1201
|
-
scopeId + " " + accessor
|
1202
|
-
)
|
1203
|
-
);
|
1204
|
-
}
|
1205
|
-
function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1206
|
-
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchIds = "";
|
1207
|
-
if (resumeBranch) {
|
1208
|
-
let loopScopes = /* @__PURE__ */ new Map();
|
1209
|
-
forOf(list, (item, index) => {
|
1210
|
-
let branchId = peekNextScopeId();
|
1211
|
-
resumeMarker && (branchIds = " " + branchId + branchIds), withBranchId(branchId, () => {
|
1177
|
+
resumeMarker && (singleNode ? singleNodeBranchIds = " " + branchId + singleNodeBranchIds : $chunk.writeHTML(
|
1178
|
+
state.mark("[" /* BranchStart */, branchId + (index ? " " : ""))
|
1179
|
+
)), withBranchId(branchId, () => {
|
1212
1180
|
cb(item, index), loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1213
1181
|
});
|
1214
1182
|
}), loopScopes.size && writeScope(scopeId, {
|
@@ -1221,21 +1189,21 @@ function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch,
|
|
1221
1189
|
accessor,
|
1222
1190
|
resumeMarker,
|
1223
1191
|
parentEndTag,
|
1224
|
-
resumeMarker && (!parentEndTag || resumeBranch) &&
|
1192
|
+
resumeMarker && (!parentEndTag || resumeBranch) && (singleNode ? state.mark(
|
1225
1193
|
parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1226
|
-
scopeId + " " + accessor +
|
1227
|
-
)
|
1194
|
+
scopeId + " " + accessor + singleNodeBranchIds
|
1195
|
+
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1228
1196
|
);
|
1229
1197
|
}
|
1230
|
-
function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1231
|
-
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0;
|
1198
|
+
function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1199
|
+
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, singleNodeBranchIds = "";
|
1232
1200
|
if (resumeBranch) {
|
1233
1201
|
let loopScopes = /* @__PURE__ */ new Map(), sep = "";
|
1234
1202
|
forIn(obj, (key, value) => {
|
1235
1203
|
let branchId = peekNextScopeId();
|
1236
|
-
resumeMarker && ($chunk.writeHTML(
|
1237
|
-
|
1238
|
-
), sep = " "), withBranchId(branchId, () => {
|
1204
|
+
resumeMarker && (singleNode ? singleNodeBranchIds = " " + branchId + singleNodeBranchIds : ($chunk.writeHTML(
|
1205
|
+
state.mark("[" /* BranchStart */, branchId + sep)
|
1206
|
+
), sep = " ")), withBranchId(branchId, () => {
|
1239
1207
|
cb(key, value), loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
|
1240
1208
|
});
|
1241
1209
|
}), loopScopes.size && writeScope(scopeId, {
|
@@ -1248,46 +1216,21 @@ function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeM
|
|
1248
1216
|
accessor,
|
1249
1217
|
resumeMarker,
|
1250
1218
|
parentEndTag,
|
1251
|
-
resumeMarker && (!parentEndTag || resumeBranch) &&
|
1252
|
-
"]" /* BranchEnd */,
|
1253
|
-
scopeId + " " + accessor
|
1254
|
-
)
|
1255
|
-
);
|
1256
|
-
}
|
1257
|
-
function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1258
|
-
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchIds = "";
|
1259
|
-
if (resumeBranch) {
|
1260
|
-
let loopScopes = /* @__PURE__ */ new Map();
|
1261
|
-
forIn(obj, (key, value) => {
|
1262
|
-
let branchId = peekNextScopeId();
|
1263
|
-
resumeMarker && (branchIds = " " + branchId + branchIds), withBranchId(branchId, () => {
|
1264
|
-
cb(key, value), loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
|
1265
|
-
});
|
1266
|
-
}), loopScopes.size && writeScope(scopeId, {
|
1267
|
-
["m" /* LoopScopeMap */ + accessor]: loopScopes
|
1268
|
-
});
|
1269
|
-
} else
|
1270
|
-
forIn(obj, cb);
|
1271
|
-
writeBranchEnd(
|
1272
|
-
scopeId,
|
1273
|
-
accessor,
|
1274
|
-
resumeMarker,
|
1275
|
-
parentEndTag,
|
1276
|
-
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1219
|
+
resumeMarker && (!parentEndTag || resumeBranch) && (singleNode ? state.mark(
|
1277
1220
|
parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1278
|
-
scopeId + " " + accessor +
|
1279
|
-
)
|
1221
|
+
scopeId + " " + accessor + singleNodeBranchIds
|
1222
|
+
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1280
1223
|
);
|
1281
1224
|
}
|
1282
|
-
function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1283
|
-
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0;
|
1225
|
+
function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1226
|
+
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, singleNodeBranchIds = "";
|
1284
1227
|
if (resumeBranch) {
|
1285
1228
|
let loopScopes = /* @__PURE__ */ new Map(), sep = "";
|
1286
1229
|
forTo(to, from, step, (i) => {
|
1287
1230
|
let branchId = peekNextScopeId();
|
1288
|
-
resumeMarker && ($chunk.writeHTML(
|
1289
|
-
|
1290
|
-
), sep = " "), withBranchId(branchId, () => {
|
1231
|
+
resumeMarker && (singleNode ? singleNodeBranchIds = " " + branchId + singleNodeBranchIds : ($chunk.writeHTML(
|
1232
|
+
state.mark("[" /* BranchStart */, branchId + sep)
|
1233
|
+
), sep = " ")), withBranchId(branchId, () => {
|
1291
1234
|
cb(i), loopScopes.set(forToBy(by, i), writeScope(branchId, {}));
|
1292
1235
|
});
|
1293
1236
|
}), loopScopes.size && writeScope(scopeId, {
|
@@ -1300,59 +1243,16 @@ function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch,
|
|
1300
1243
|
accessor,
|
1301
1244
|
resumeMarker,
|
1302
1245
|
parentEndTag,
|
1303
|
-
resumeMarker && (!parentEndTag || resumeBranch) &&
|
1304
|
-
"]" /* BranchEnd */,
|
1305
|
-
scopeId + " " + accessor
|
1306
|
-
)
|
1307
|
-
);
|
1308
|
-
}
|
1309
|
-
function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1310
|
-
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchIds = "";
|
1311
|
-
if (resumeBranch) {
|
1312
|
-
let loopScopes = /* @__PURE__ */ new Map();
|
1313
|
-
forTo(to, from, step, (i) => {
|
1314
|
-
let branchId = peekNextScopeId();
|
1315
|
-
resumeMarker && (branchIds = " " + branchId + branchIds), withBranchId(branchId, () => {
|
1316
|
-
cb(i), loopScopes.set(forToBy(by, i), writeScope(branchId, {}));
|
1317
|
-
});
|
1318
|
-
}), loopScopes.size && writeScope(scopeId, {
|
1319
|
-
["m" /* LoopScopeMap */ + accessor]: loopScopes
|
1320
|
-
});
|
1321
|
-
} else
|
1322
|
-
forTo(to, from, step, cb);
|
1323
|
-
writeBranchEnd(
|
1324
|
-
scopeId,
|
1325
|
-
accessor,
|
1326
|
-
resumeMarker,
|
1327
|
-
parentEndTag,
|
1328
|
-
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1246
|
+
resumeMarker && (!parentEndTag || resumeBranch) && (singleNode ? state.mark(
|
1329
1247
|
parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1330
|
-
scopeId + " " + accessor +
|
1331
|
-
)
|
1332
|
-
);
|
1333
|
-
}
|
1334
|
-
function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1335
|
-
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchId = peekNextScopeId();
|
1336
|
-
resumeMarker && resumeBranch && $chunk.writeHTML(
|
1337
|
-
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
|
1338
|
-
);
|
1339
|
-
let branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb();
|
1340
|
-
resumeBranch && branchIndex !== void 0 && writeScope(scopeId, {
|
1341
|
-
["c" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
|
1342
|
-
["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
1343
|
-
}), writeBranchEnd(
|
1344
|
-
scopeId,
|
1345
|
-
accessor,
|
1346
|
-
resumeMarker,
|
1347
|
-
parentEndTag,
|
1348
|
-
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1349
|
-
"]" /* BranchEnd */,
|
1350
|
-
scopeId + " " + accessor
|
1351
|
-
)
|
1248
|
+
scopeId + " " + accessor + singleNodeBranchIds
|
1249
|
+
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1352
1250
|
);
|
1353
1251
|
}
|
1354
|
-
function
|
1355
|
-
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchId = peekNextScopeId()
|
1252
|
+
function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1253
|
+
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchId = peekNextScopeId();
|
1254
|
+
resumeMarker && resumeBranch && !singleNode && $chunk.writeHTML(state.mark("[" /* BranchStart */, branchId + ""));
|
1255
|
+
let branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
1356
1256
|
shouldWriteBranch && writeScope(scopeId, {
|
1357
1257
|
["c" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
|
1358
1258
|
["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
@@ -1361,10 +1261,10 @@ function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, ser
|
|
1361
1261
|
accessor,
|
1362
1262
|
resumeMarker,
|
1363
1263
|
parentEndTag,
|
1364
|
-
resumeMarker && (!parentEndTag || resumeBranch) &&
|
1264
|
+
resumeMarker && (!parentEndTag || resumeBranch) && (singleNode ? state.mark(
|
1365
1265
|
parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1366
1266
|
scopeId + " " + accessor + (shouldWriteBranch ? " " + branchId : "")
|
1367
|
-
)
|
1267
|
+
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1368
1268
|
);
|
1369
1269
|
}
|
1370
1270
|
function writeBranchEnd(scopeId, accessor, resumeMarker, parentEndTag, mark) {
|
@@ -2267,10 +2167,6 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
2267
2167
|
resumeForIn,
|
2268
2168
|
resumeForOf,
|
2269
2169
|
resumeForTo,
|
2270
|
-
resumeSingleNodeConditional,
|
2271
|
-
resumeSingleNodeForIn,
|
2272
|
-
resumeSingleNodeForOf,
|
2273
|
-
resumeSingleNodeForTo,
|
2274
2170
|
serializeGuard,
|
2275
2171
|
serializeIf,
|
2276
2172
|
setTagVar,
|
package/dist/html.mjs
CHANGED
@@ -1090,43 +1090,15 @@ var branchIdKey = Symbol();
|
|
1090
1090
|
function withBranchId(branchId, cb) {
|
1091
1091
|
return withContext(branchIdKey, branchId, cb);
|
1092
1092
|
}
|
1093
|
-
function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1094
|
-
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0;
|
1093
|
+
function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1094
|
+
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, singleNodeBranchIds = "";
|
1095
1095
|
if (resumeBranch) {
|
1096
1096
|
let loopScopes = /* @__PURE__ */ new Map();
|
1097
1097
|
forOf(list, (item, index) => {
|
1098
1098
|
let branchId = peekNextScopeId();
|
1099
|
-
resumeMarker && $chunk.writeHTML(
|
1100
|
-
|
1101
|
-
|
1102
|
-
branchId + (index ? " " : "")
|
1103
|
-
)
|
1104
|
-
), withBranchId(branchId, () => {
|
1105
|
-
cb(item, index), loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1106
|
-
});
|
1107
|
-
}), loopScopes.size && writeScope(scopeId, {
|
1108
|
-
["m" /* LoopScopeMap */ + accessor]: loopScopes
|
1109
|
-
});
|
1110
|
-
} else
|
1111
|
-
forOf(list, cb);
|
1112
|
-
writeBranchEnd(
|
1113
|
-
scopeId,
|
1114
|
-
accessor,
|
1115
|
-
resumeMarker,
|
1116
|
-
parentEndTag,
|
1117
|
-
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1118
|
-
"]" /* BranchEnd */,
|
1119
|
-
scopeId + " " + accessor
|
1120
|
-
)
|
1121
|
-
);
|
1122
|
-
}
|
1123
|
-
function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1124
|
-
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchIds = "";
|
1125
|
-
if (resumeBranch) {
|
1126
|
-
let loopScopes = /* @__PURE__ */ new Map();
|
1127
|
-
forOf(list, (item, index) => {
|
1128
|
-
let branchId = peekNextScopeId();
|
1129
|
-
resumeMarker && (branchIds = " " + branchId + branchIds), withBranchId(branchId, () => {
|
1099
|
+
resumeMarker && (singleNode ? singleNodeBranchIds = " " + branchId + singleNodeBranchIds : $chunk.writeHTML(
|
1100
|
+
state.mark("[" /* BranchStart */, branchId + (index ? " " : ""))
|
1101
|
+
)), withBranchId(branchId, () => {
|
1130
1102
|
cb(item, index), loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1131
1103
|
});
|
1132
1104
|
}), loopScopes.size && writeScope(scopeId, {
|
@@ -1139,21 +1111,21 @@ function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch,
|
|
1139
1111
|
accessor,
|
1140
1112
|
resumeMarker,
|
1141
1113
|
parentEndTag,
|
1142
|
-
resumeMarker && (!parentEndTag || resumeBranch) &&
|
1114
|
+
resumeMarker && (!parentEndTag || resumeBranch) && (singleNode ? state.mark(
|
1143
1115
|
parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1144
|
-
scopeId + " " + accessor +
|
1145
|
-
)
|
1116
|
+
scopeId + " " + accessor + singleNodeBranchIds
|
1117
|
+
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1146
1118
|
);
|
1147
1119
|
}
|
1148
|
-
function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1149
|
-
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0;
|
1120
|
+
function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1121
|
+
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, singleNodeBranchIds = "";
|
1150
1122
|
if (resumeBranch) {
|
1151
1123
|
let loopScopes = /* @__PURE__ */ new Map(), sep = "";
|
1152
1124
|
forIn(obj, (key, value) => {
|
1153
1125
|
let branchId = peekNextScopeId();
|
1154
|
-
resumeMarker && ($chunk.writeHTML(
|
1155
|
-
|
1156
|
-
), sep = " "), withBranchId(branchId, () => {
|
1126
|
+
resumeMarker && (singleNode ? singleNodeBranchIds = " " + branchId + singleNodeBranchIds : ($chunk.writeHTML(
|
1127
|
+
state.mark("[" /* BranchStart */, branchId + sep)
|
1128
|
+
), sep = " ")), withBranchId(branchId, () => {
|
1157
1129
|
cb(key, value), loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
|
1158
1130
|
});
|
1159
1131
|
}), loopScopes.size && writeScope(scopeId, {
|
@@ -1166,46 +1138,21 @@ function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeM
|
|
1166
1138
|
accessor,
|
1167
1139
|
resumeMarker,
|
1168
1140
|
parentEndTag,
|
1169
|
-
resumeMarker && (!parentEndTag || resumeBranch) &&
|
1170
|
-
"]" /* BranchEnd */,
|
1171
|
-
scopeId + " " + accessor
|
1172
|
-
)
|
1173
|
-
);
|
1174
|
-
}
|
1175
|
-
function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1176
|
-
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchIds = "";
|
1177
|
-
if (resumeBranch) {
|
1178
|
-
let loopScopes = /* @__PURE__ */ new Map();
|
1179
|
-
forIn(obj, (key, value) => {
|
1180
|
-
let branchId = peekNextScopeId();
|
1181
|
-
resumeMarker && (branchIds = " " + branchId + branchIds), withBranchId(branchId, () => {
|
1182
|
-
cb(key, value), loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
|
1183
|
-
});
|
1184
|
-
}), loopScopes.size && writeScope(scopeId, {
|
1185
|
-
["m" /* LoopScopeMap */ + accessor]: loopScopes
|
1186
|
-
});
|
1187
|
-
} else
|
1188
|
-
forIn(obj, cb);
|
1189
|
-
writeBranchEnd(
|
1190
|
-
scopeId,
|
1191
|
-
accessor,
|
1192
|
-
resumeMarker,
|
1193
|
-
parentEndTag,
|
1194
|
-
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1141
|
+
resumeMarker && (!parentEndTag || resumeBranch) && (singleNode ? state.mark(
|
1195
1142
|
parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1196
|
-
scopeId + " " + accessor +
|
1197
|
-
)
|
1143
|
+
scopeId + " " + accessor + singleNodeBranchIds
|
1144
|
+
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1198
1145
|
);
|
1199
1146
|
}
|
1200
|
-
function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1201
|
-
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0;
|
1147
|
+
function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1148
|
+
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, singleNodeBranchIds = "";
|
1202
1149
|
if (resumeBranch) {
|
1203
1150
|
let loopScopes = /* @__PURE__ */ new Map(), sep = "";
|
1204
1151
|
forTo(to, from, step, (i) => {
|
1205
1152
|
let branchId = peekNextScopeId();
|
1206
|
-
resumeMarker && ($chunk.writeHTML(
|
1207
|
-
|
1208
|
-
), sep = " "), withBranchId(branchId, () => {
|
1153
|
+
resumeMarker && (singleNode ? singleNodeBranchIds = " " + branchId + singleNodeBranchIds : ($chunk.writeHTML(
|
1154
|
+
state.mark("[" /* BranchStart */, branchId + sep)
|
1155
|
+
), sep = " ")), withBranchId(branchId, () => {
|
1209
1156
|
cb(i), loopScopes.set(forToBy(by, i), writeScope(branchId, {}));
|
1210
1157
|
});
|
1211
1158
|
}), loopScopes.size && writeScope(scopeId, {
|
@@ -1218,59 +1165,16 @@ function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch,
|
|
1218
1165
|
accessor,
|
1219
1166
|
resumeMarker,
|
1220
1167
|
parentEndTag,
|
1221
|
-
resumeMarker && (!parentEndTag || resumeBranch) &&
|
1222
|
-
"]" /* BranchEnd */,
|
1223
|
-
scopeId + " " + accessor
|
1224
|
-
)
|
1225
|
-
);
|
1226
|
-
}
|
1227
|
-
function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1228
|
-
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchIds = "";
|
1229
|
-
if (resumeBranch) {
|
1230
|
-
let loopScopes = /* @__PURE__ */ new Map();
|
1231
|
-
forTo(to, from, step, (i) => {
|
1232
|
-
let branchId = peekNextScopeId();
|
1233
|
-
resumeMarker && (branchIds = " " + branchId + branchIds), withBranchId(branchId, () => {
|
1234
|
-
cb(i), loopScopes.set(forToBy(by, i), writeScope(branchId, {}));
|
1235
|
-
});
|
1236
|
-
}), loopScopes.size && writeScope(scopeId, {
|
1237
|
-
["m" /* LoopScopeMap */ + accessor]: loopScopes
|
1238
|
-
});
|
1239
|
-
} else
|
1240
|
-
forTo(to, from, step, cb);
|
1241
|
-
writeBranchEnd(
|
1242
|
-
scopeId,
|
1243
|
-
accessor,
|
1244
|
-
resumeMarker,
|
1245
|
-
parentEndTag,
|
1246
|
-
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1168
|
+
resumeMarker && (!parentEndTag || resumeBranch) && (singleNode ? state.mark(
|
1247
1169
|
parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1248
|
-
scopeId + " " + accessor +
|
1249
|
-
)
|
1250
|
-
);
|
1251
|
-
}
|
1252
|
-
function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1253
|
-
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchId = peekNextScopeId();
|
1254
|
-
resumeMarker && resumeBranch && $chunk.writeHTML(
|
1255
|
-
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
|
1256
|
-
);
|
1257
|
-
let branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb();
|
1258
|
-
resumeBranch && branchIndex !== void 0 && writeScope(scopeId, {
|
1259
|
-
["c" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
|
1260
|
-
["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
1261
|
-
}), writeBranchEnd(
|
1262
|
-
scopeId,
|
1263
|
-
accessor,
|
1264
|
-
resumeMarker,
|
1265
|
-
parentEndTag,
|
1266
|
-
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1267
|
-
"]" /* BranchEnd */,
|
1268
|
-
scopeId + " " + accessor
|
1269
|
-
)
|
1170
|
+
scopeId + " " + accessor + singleNodeBranchIds
|
1171
|
+
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1270
1172
|
);
|
1271
1173
|
}
|
1272
|
-
function
|
1273
|
-
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchId = peekNextScopeId()
|
1174
|
+
function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1175
|
+
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchId = peekNextScopeId();
|
1176
|
+
resumeMarker && resumeBranch && !singleNode && $chunk.writeHTML(state.mark("[" /* BranchStart */, branchId + ""));
|
1177
|
+
let branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
1274
1178
|
shouldWriteBranch && writeScope(scopeId, {
|
1275
1179
|
["c" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
|
1276
1180
|
["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
@@ -1279,10 +1183,10 @@ function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, ser
|
|
1279
1183
|
accessor,
|
1280
1184
|
resumeMarker,
|
1281
1185
|
parentEndTag,
|
1282
|
-
resumeMarker && (!parentEndTag || resumeBranch) &&
|
1186
|
+
resumeMarker && (!parentEndTag || resumeBranch) && (singleNode ? state.mark(
|
1283
1187
|
parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1284
1188
|
scopeId + " " + accessor + (shouldWriteBranch ? " " + branchId : "")
|
1285
|
-
)
|
1189
|
+
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1286
1190
|
);
|
1287
1191
|
}
|
1288
1192
|
function writeBranchEnd(scopeId, accessor, resumeMarker, parentEndTag, mark) {
|
@@ -2184,10 +2088,6 @@ export {
|
|
2184
2088
|
resumeForIn,
|
2185
2089
|
resumeForOf,
|
2186
2090
|
resumeForTo,
|
2187
|
-
resumeSingleNodeConditional,
|
2188
|
-
resumeSingleNodeForIn,
|
2189
|
-
resumeSingleNodeForOf,
|
2190
|
-
resumeSingleNodeForTo,
|
2191
2091
|
serializeGuard,
|
2192
2092
|
serializeIf,
|
2193
2093
|
setTagVar,
|
package/dist/translator/index.js
CHANGED
@@ -2008,7 +2008,7 @@ function getOrCreateSection(path5) {
|
|
2008
2008
|
let cur = path5;
|
2009
2009
|
while (true) {
|
2010
2010
|
if (cur.type === "Program" || cur.type === "MarkoTagBody" && !cur.node.attributeTags && !isNativeNode(cur.parentPath)) {
|
2011
|
-
return startSection(cur);
|
2011
|
+
return (path5.node.extra ??= {}).section = startSection(cur);
|
2012
2012
|
}
|
2013
2013
|
cur = cur.parentPath;
|
2014
2014
|
}
|
@@ -4040,7 +4040,7 @@ var dom_default = {
|
|
4040
4040
|
const tagParamsSignal = childSection.params && initValue(childSection.params);
|
4041
4041
|
const { walks: walks2, writes: writes2, setup: setup2 } = getSectionMeta(childSection);
|
4042
4042
|
const identifier = import_compiler21.types.identifier(childSection.name);
|
4043
|
-
const referencedClosures = childSection.referencedClosures ? import_compiler21.types.arrowFunctionExpression(
|
4043
|
+
const referencedClosures = childSection.referencedClosures ? Array.isArray(childSection.referencedClosures) ? import_compiler21.types.arrowFunctionExpression(
|
4044
4044
|
[scopeIdentifier],
|
4045
4045
|
toFirstExpressionOrBlock(
|
4046
4046
|
toArray(childSection.referencedClosures, (closure) => {
|
@@ -4056,7 +4056,7 @@ var dom_default = {
|
|
4056
4056
|
);
|
4057
4057
|
})
|
4058
4058
|
)
|
4059
|
-
) : void 0;
|
4059
|
+
) : getSignal(childSection, childSection.referencedClosures).identifier : void 0;
|
4060
4060
|
const renderer = getSectionParentIsOwner(childSection) ? callRuntime(
|
4061
4061
|
"createRenderer",
|
4062
4062
|
...replaceNullishAndEmptyFunctionsWith0([
|
@@ -6708,7 +6708,7 @@ var for_default = {
|
|
6708
6708
|
flushInto(tag);
|
6709
6709
|
writeHTMLResumeStatements(tagBody);
|
6710
6710
|
const forTagArgs = getBaseArgsInForTag(forType, forAttrs);
|
6711
|
-
const forTagHTMLRuntime = branchSerializeReason ? forTypeToHTMLResumeRuntime(forType
|
6711
|
+
const forTagHTMLRuntime = branchSerializeReason ? forTypeToHTMLResumeRuntime(forType) : forTypeToRuntime(forType);
|
6712
6712
|
forTagArgs.push(
|
6713
6713
|
import_compiler33.types.arrowFunctionExpression(params, import_compiler33.types.blockStatement(bodyStatements))
|
6714
6714
|
);
|
@@ -6716,7 +6716,7 @@ var for_default = {
|
|
6716
6716
|
const skipParentEnd = onlyChildParentTagName && markerSerializeReason;
|
6717
6717
|
const markerSerializeArg = getSerializeGuard(
|
6718
6718
|
markerSerializeReason,
|
6719
|
-
!skipParentEnd
|
6719
|
+
!(skipParentEnd || singleNodeOptimization)
|
6720
6720
|
);
|
6721
6721
|
forTagArgs.push(
|
6722
6722
|
forAttrs.by || import_compiler33.types.numericLiteral(0),
|
@@ -6729,6 +6729,12 @@ var for_default = {
|
|
6729
6729
|
getParentTag(tag).node.extra[kSkipEndTag] = true;
|
6730
6730
|
forTagArgs.push(import_compiler33.types.stringLiteral(`</${onlyChildParentTagName}>`));
|
6731
6731
|
}
|
6732
|
+
if (singleNodeOptimization) {
|
6733
|
+
if (!skipParentEnd) {
|
6734
|
+
forTagArgs.push(import_compiler33.types.numericLiteral(0));
|
6735
|
+
}
|
6736
|
+
forTagArgs.push(import_compiler33.types.numericLiteral(1));
|
6737
|
+
}
|
6732
6738
|
}
|
6733
6739
|
statements.push(
|
6734
6740
|
import_compiler33.types.expressionStatement(callRuntime(forTagHTMLRuntime, ...forTagArgs))
|
@@ -6884,25 +6890,14 @@ function forTypeToRuntime(type) {
|
|
6884
6890
|
return "forTo";
|
6885
6891
|
}
|
6886
6892
|
}
|
6887
|
-
function forTypeToHTMLResumeRuntime(type
|
6888
|
-
|
6889
|
-
|
6890
|
-
|
6891
|
-
|
6892
|
-
|
6893
|
-
|
6894
|
-
|
6895
|
-
return "resumeSingleNodeForTo";
|
6896
|
-
}
|
6897
|
-
} else {
|
6898
|
-
switch (type) {
|
6899
|
-
case "of":
|
6900
|
-
return "resumeForOf";
|
6901
|
-
case "in":
|
6902
|
-
return "resumeForIn";
|
6903
|
-
case "to":
|
6904
|
-
return "resumeForTo";
|
6905
|
-
}
|
6893
|
+
function forTypeToHTMLResumeRuntime(type) {
|
6894
|
+
switch (type) {
|
6895
|
+
case "of":
|
6896
|
+
return "resumeForOf";
|
6897
|
+
case "in":
|
6898
|
+
return "resumeForIn";
|
6899
|
+
case "to":
|
6900
|
+
return "resumeForTo";
|
6906
6901
|
}
|
6907
6902
|
}
|
6908
6903
|
function forTypeToDOMRuntime(type) {
|
@@ -8601,7 +8596,7 @@ var IfTag = {
|
|
8601
8596
|
}
|
8602
8597
|
const markerSerializeArg = getSerializeGuard(
|
8603
8598
|
markerSerializeReason,
|
8604
|
-
!skipParentEnd
|
8599
|
+
!(skipParentEnd || singleNodeOptimization)
|
8605
8600
|
);
|
8606
8601
|
const cbNode = import_compiler42.types.arrowFunctionExpression(
|
8607
8602
|
[],
|
@@ -8609,7 +8604,7 @@ var IfTag = {
|
|
8609
8604
|
);
|
8610
8605
|
statement = import_compiler42.types.expressionStatement(
|
8611
8606
|
callRuntime(
|
8612
|
-
|
8607
|
+
"resumeConditional",
|
8613
8608
|
cbNode,
|
8614
8609
|
getScopeIdIdentifier(ifTagSection),
|
8615
8610
|
getScopeAccessorLiteral(nodeBinding),
|
@@ -8618,7 +8613,8 @@ var IfTag = {
|
|
8618
8613
|
!markerSerializeArg
|
8619
8614
|
),
|
8620
8615
|
markerSerializeArg,
|
8621
|
-
skipParentEnd
|
8616
|
+
skipParentEnd ? import_compiler42.types.stringLiteral(`</${onlyChildParentTagName}>`) : singleNodeOptimization ? import_compiler42.types.numericLiteral(0) : void 0,
|
8617
|
+
singleNodeOptimization ? import_compiler42.types.numericLiteral(1) : void 0
|
8622
8618
|
)
|
8623
8619
|
);
|
8624
8620
|
}
|