marko 6.0.14 → 6.0.16
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 +194 -189
- package/dist/debug/dom.mjs +194 -189
- package/dist/debug/html.js +47 -169
- package/dist/debug/html.mjs +47 -165
- package/dist/dom/renderer.d.ts +9 -11
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +140 -138
- package/dist/dom.mjs +140 -138
- 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 +168 -100
- package/dist/translator/util/references.d.ts +3 -2
- package/dist/translator/util/sections.d.ts +1 -0
- package/dist/translator/util/signals.d.ts +2 -1
- package/package.json +1 -1
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
@@ -1,25 +1,23 @@
|
|
1
1
|
import { type Accessor, type BranchScope, type Scope } from "../common/types";
|
2
|
-
import type
|
2
|
+
import { type Signal, type SignalFn } from "./signals";
|
3
3
|
export type Renderer = {
|
4
4
|
___id: string;
|
5
|
-
___setup: undefined |
|
5
|
+
___setup: undefined | SetupFn;
|
6
6
|
___clone: (branch: BranchScope, ns: string) => void;
|
7
7
|
___params: Signal<unknown> | undefined;
|
8
|
-
___closures: SetupFn | undefined;
|
9
8
|
___owner: Scope | undefined;
|
10
9
|
___accessor: Accessor | undefined;
|
10
|
+
___localClosures?: Record<Accessor, Signal<unknown>>;
|
11
|
+
___localClosureValues?: Record<Accessor, unknown>;
|
11
12
|
};
|
12
13
|
type SetupFn = (scope: Scope) => void;
|
13
14
|
export declare function createBranch($global: Scope["$global"], renderer: Renderer | string, parentScope: Scope | undefined, parentNode: ParentNode): BranchScope;
|
14
15
|
export declare function createAndSetupBranch($global: Scope["$global"], renderer: Renderer, parentScope: Scope | undefined, parentNode: ParentNode): BranchScope;
|
15
16
|
export declare function setupBranch(renderer: Renderer, branch: BranchScope): BranchScope;
|
16
|
-
export declare function createContent(id: string, template: string | 0, walks?: string | 0, setup?:
|
17
|
+
export declare function createContent(id: string, template: string | 0, walks?: string | 0, setup?: {
|
17
18
|
_: 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,
|
20
|
-
|
21
|
-
|
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
|
+
} | SetupFn | 0, params?: Signal<unknown> | 0, dynamicScopesAccessor?: Accessor): (owner?: Scope) => Renderer;
|
20
|
+
export declare function registerContent(id: string, template: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown> | 0, dynamicScopesAccessor?: Accessor): (owner?: Scope) => Renderer;
|
21
|
+
export declare function localClosures(renderer: ReturnType<typeof createContent>, closureFns: Record<Accessor, SignalFn<unknown>>): (owner: Scope, closureValues: Record<Accessor, unknown>) => Renderer;
|
22
|
+
export declare function createRenderer(template: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown> | 0): Renderer;
|
25
23
|
export {};
|
package/dist/dom.d.ts
CHANGED
@@ -7,7 +7,7 @@ export { controllable_detailsOrDialog_open, controllable_detailsOrDialog_open_ef
|
|
7
7
|
export { attr, attrs, attrsEvents, classAttr, classItem, classItems, data, html, lifecycle, partialAttrs, props, styleAttr, styleItem, styleItems, textContent, } from "./dom/dom";
|
8
8
|
export { on } from "./dom/event";
|
9
9
|
export { enableCatch, run } from "./dom/queue";
|
10
|
-
export { createContent, createRenderer, registerContent } from "./dom/renderer";
|
10
|
+
export { createContent, createRenderer, localClosures, registerContent, } from "./dom/renderer";
|
11
11
|
export { init, nodeRef, register, registerBoundSignal } from "./dom/resume";
|
12
12
|
export { conditionalClosure, dynamicClosure, dynamicClosureRead, effect, hoist, intersection, loopClosure, nextTagId, setTagVar, setTagVarChange, state, tagVarSignal, tagVarSignalChange, value, } from "./dom/signals";
|
13
13
|
export { createTemplate } from "./dom/template";
|