marko 6.0.2 → 6.0.4
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 +7 -2
- package/dist/debug/dom.mjs +7 -2
- package/dist/debug/html.js +239 -212
- package/dist/debug/html.mjs +239 -212
- package/dist/dom.js +2 -2
- package/dist/dom.mjs +2 -2
- package/dist/html/dynamic-tag.d.ts +1 -1
- package/dist/html/writer.d.ts +9 -8
- package/dist/html.js +135 -129
- package/dist/html.mjs +135 -129
- package/dist/translator/index.js +104 -81
- package/dist/translator/util/references.d.ts +1 -0
- package/dist/translator/visitors/program/html.d.ts +1 -1
- package/package.json +2 -2
package/dist/debug/dom.js
CHANGED
@@ -276,6 +276,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
276
276
|
};
|
277
277
|
const branchIds = /* @__PURE__ */ new Set();
|
278
278
|
const parentBranchIds = /* @__PURE__ */ new Map();
|
279
|
+
let lastEffect;
|
279
280
|
let currentBranchId;
|
280
281
|
let $global;
|
281
282
|
let lastScopeId = 0;
|
@@ -361,7 +362,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
361
362
|
render.r = [];
|
362
363
|
isResuming = 1;
|
363
364
|
for (let i = 0; i < resumes.length; i++) {
|
364
|
-
|
365
|
+
let serialized = resumes[i];
|
365
366
|
if (typeof serialized === "function") {
|
366
367
|
for (const scope of serialized(serializeContext)) {
|
367
368
|
if (!$global) {
|
@@ -403,7 +404,11 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
403
404
|
}
|
404
405
|
}
|
405
406
|
} else {
|
406
|
-
|
407
|
+
if (typeof serialized === "string") {
|
408
|
+
lastEffect = serialized;
|
409
|
+
serialized = resumes[++i];
|
410
|
+
}
|
411
|
+
registeredValues[lastEffect](
|
407
412
|
scopeLookup[serialized],
|
408
413
|
scopeLookup[serialized]
|
409
414
|
);
|
package/dist/debug/dom.mjs
CHANGED
@@ -188,6 +188,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
188
188
|
};
|
189
189
|
const branchIds = /* @__PURE__ */ new Set();
|
190
190
|
const parentBranchIds = /* @__PURE__ */ new Map();
|
191
|
+
let lastEffect;
|
191
192
|
let currentBranchId;
|
192
193
|
let $global;
|
193
194
|
let lastScopeId = 0;
|
@@ -273,7 +274,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
273
274
|
render.r = [];
|
274
275
|
isResuming = 1;
|
275
276
|
for (let i = 0; i < resumes.length; i++) {
|
276
|
-
|
277
|
+
let serialized = resumes[i];
|
277
278
|
if (typeof serialized === "function") {
|
278
279
|
for (const scope of serialized(serializeContext)) {
|
279
280
|
if (!$global) {
|
@@ -315,7 +316,11 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
315
316
|
}
|
316
317
|
}
|
317
318
|
} else {
|
318
|
-
|
319
|
+
if (typeof serialized === "string") {
|
320
|
+
lastEffect = serialized;
|
321
|
+
serialized = resumes[++i];
|
322
|
+
}
|
323
|
+
registeredValues[lastEffect](
|
319
324
|
scopeLookup[serialized],
|
320
325
|
scopeLookup[serialized]
|
321
326
|
);
|
package/dist/debug/html.js
CHANGED
@@ -42,11 +42,11 @@ __export(html_exports, {
|
|
42
42
|
escapeStyle: () => escapeStyle,
|
43
43
|
escapeXML: () => escapeXML,
|
44
44
|
forIn: () => forIn,
|
45
|
-
forInBy: () =>
|
45
|
+
forInBy: () => forInBy,
|
46
46
|
forOf: () => forOf,
|
47
|
-
forOfBy: () =>
|
47
|
+
forOfBy: () => forOfBy,
|
48
48
|
forTo: () => forTo,
|
49
|
-
forToBy: () =>
|
49
|
+
forToBy: () => forToBy,
|
50
50
|
fork: () => fork,
|
51
51
|
getScopeById: () => getScopeById,
|
52
52
|
hoist: () => hoist,
|
@@ -210,6 +210,29 @@ function forTo(to, from, step, cb) {
|
|
210
210
|
}
|
211
211
|
}
|
212
212
|
|
213
|
+
// src/html/for.ts
|
214
|
+
function forOfBy(by, item, index) {
|
215
|
+
if (by) {
|
216
|
+
if (typeof by === "string") {
|
217
|
+
return item[by];
|
218
|
+
}
|
219
|
+
return by(item, index);
|
220
|
+
}
|
221
|
+
return index;
|
222
|
+
}
|
223
|
+
function forInBy(by, name, value) {
|
224
|
+
if (by) {
|
225
|
+
return by(name, value);
|
226
|
+
}
|
227
|
+
return name;
|
228
|
+
}
|
229
|
+
function forToBy(by, index) {
|
230
|
+
if (by) {
|
231
|
+
return by(index);
|
232
|
+
}
|
233
|
+
return index;
|
234
|
+
}
|
235
|
+
|
213
236
|
// src/html/inlined-runtimes.ts
|
214
237
|
var WALKER_RUNTIME_CODE = true ? (
|
215
238
|
/* js */
|
@@ -1771,213 +1794,232 @@ var branchIdKey = Symbol();
|
|
1771
1794
|
function withBranchId(branchId, cb) {
|
1772
1795
|
return withContext(branchIdKey, branchId, cb);
|
1773
1796
|
}
|
1774
|
-
function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch) {
|
1775
|
-
|
1776
|
-
|
1797
|
+
function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
|
1798
|
+
const resumeBranch = serializeBranch !== 0;
|
1799
|
+
const resumeMarker = serializeMarker !== 0;
|
1800
|
+
if (resumeBranch) {
|
1801
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1802
|
+
forOf(list, (item, index) => {
|
1803
|
+
const branchId = peekNextScopeId();
|
1804
|
+
if (resumeMarker) {
|
1805
|
+
$chunk.writeHTML(
|
1806
|
+
$chunk.boundary.state.mark(
|
1807
|
+
"[" /* BranchStart */,
|
1808
|
+
branchId + (index ? " " : "")
|
1809
|
+
)
|
1810
|
+
);
|
1811
|
+
}
|
1812
|
+
withBranchId(branchId, () => {
|
1813
|
+
cb(item, index);
|
1814
|
+
loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1815
|
+
});
|
1816
|
+
});
|
1817
|
+
if (loopScopes.size) {
|
1818
|
+
writeScope(scopeId, {
|
1819
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1820
|
+
});
|
1821
|
+
}
|
1822
|
+
} else {
|
1823
|
+
forOf(list, cb);
|
1777
1824
|
}
|
1778
|
-
|
1779
|
-
forOf(list, (item, index) => {
|
1780
|
-
const branchId = peekNextScopeId();
|
1825
|
+
if (resumeMarker) {
|
1781
1826
|
$chunk.writeHTML(
|
1782
1827
|
$chunk.boundary.state.mark(
|
1783
|
-
"
|
1784
|
-
|
1828
|
+
"]" /* BranchEnd */,
|
1829
|
+
scopeId + " " + accessor
|
1785
1830
|
)
|
1786
1831
|
);
|
1787
|
-
withBranchId(branchId, () => {
|
1788
|
-
cb(item, index);
|
1789
|
-
loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1790
|
-
});
|
1791
|
-
});
|
1792
|
-
if (loopScopes.size) {
|
1793
|
-
writeScope(scopeId, {
|
1794
|
-
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1795
|
-
});
|
1796
1832
|
}
|
1797
|
-
$chunk.writeHTML(
|
1798
|
-
$chunk.boundary.state.mark(
|
1799
|
-
"]" /* BranchEnd */,
|
1800
|
-
scopeId + " " + accessor
|
1801
|
-
)
|
1802
|
-
);
|
1803
1833
|
}
|
1804
|
-
function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, onlyChildInParent) {
|
1805
|
-
|
1806
|
-
|
1807
|
-
}
|
1808
|
-
const loopScopes = /* @__PURE__ */ new Map();
|
1834
|
+
function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
|
1835
|
+
const resumeBranch = serializeBranch !== 0;
|
1836
|
+
const resumeMarker = serializeMarker !== 0;
|
1809
1837
|
let branchIds = "";
|
1810
|
-
|
1811
|
-
const
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
|
1819
|
-
|
1820
|
-
|
1838
|
+
if (resumeBranch) {
|
1839
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1840
|
+
forOf(list, (item, index) => {
|
1841
|
+
const branchId = peekNextScopeId();
|
1842
|
+
if (resumeMarker) {
|
1843
|
+
branchIds = " " + branchId + branchIds;
|
1844
|
+
}
|
1845
|
+
withBranchId(branchId, () => {
|
1846
|
+
cb(item, index);
|
1847
|
+
loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1848
|
+
});
|
1821
1849
|
});
|
1822
|
-
|
1823
|
-
|
1824
|
-
|
1825
|
-
|
1826
|
-
scopeId + " " + accessor + branchIds
|
1827
|
-
)
|
1828
|
-
);
|
1829
|
-
}
|
1830
|
-
function forOfBy(by, item, index) {
|
1831
|
-
if (by) {
|
1832
|
-
if (typeof by === "string") {
|
1833
|
-
return item[by];
|
1850
|
+
if (loopScopes.size) {
|
1851
|
+
writeScope(scopeId, {
|
1852
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1853
|
+
});
|
1834
1854
|
}
|
1835
|
-
|
1855
|
+
} else {
|
1856
|
+
forOf(list, cb);
|
1857
|
+
}
|
1858
|
+
if (resumeMarker) {
|
1859
|
+
$chunk.writeHTML(
|
1860
|
+
$chunk.boundary.state.mark(
|
1861
|
+
onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1862
|
+
scopeId + " " + accessor + branchIds
|
1863
|
+
)
|
1864
|
+
);
|
1836
1865
|
}
|
1837
|
-
return index;
|
1838
1866
|
}
|
1839
|
-
function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch) {
|
1840
|
-
|
1841
|
-
|
1867
|
+
function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
|
1868
|
+
const resumeBranch = serializeBranch !== 0;
|
1869
|
+
const resumeMarker = serializeMarker !== 0;
|
1870
|
+
if (resumeBranch) {
|
1871
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1872
|
+
let sep = "";
|
1873
|
+
forIn(obj, (key, value) => {
|
1874
|
+
const branchId = peekNextScopeId();
|
1875
|
+
if (resumeMarker) {
|
1876
|
+
$chunk.writeHTML(
|
1877
|
+
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
|
1878
|
+
);
|
1879
|
+
sep = " ";
|
1880
|
+
}
|
1881
|
+
withBranchId(branchId, () => {
|
1882
|
+
cb(key, value);
|
1883
|
+
loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
|
1884
|
+
});
|
1885
|
+
});
|
1886
|
+
if (loopScopes.size) {
|
1887
|
+
writeScope(scopeId, {
|
1888
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1889
|
+
});
|
1890
|
+
}
|
1891
|
+
} else {
|
1892
|
+
forIn(obj, cb);
|
1842
1893
|
}
|
1843
|
-
|
1844
|
-
let sep = "";
|
1845
|
-
forIn(obj, (key, value) => {
|
1846
|
-
const branchId = peekNextScopeId();
|
1894
|
+
if (resumeMarker) {
|
1847
1895
|
$chunk.writeHTML(
|
1848
|
-
$chunk.boundary.state.mark(
|
1896
|
+
$chunk.boundary.state.mark(
|
1897
|
+
"]" /* BranchEnd */,
|
1898
|
+
scopeId + " " + accessor
|
1899
|
+
)
|
1849
1900
|
);
|
1850
|
-
sep = " ";
|
1851
|
-
withBranchId(branchId, () => {
|
1852
|
-
cb(key, value);
|
1853
|
-
loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
|
1854
|
-
});
|
1855
|
-
});
|
1856
|
-
if (loopScopes.size) {
|
1857
|
-
writeScope(scopeId, {
|
1858
|
-
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1859
|
-
});
|
1860
1901
|
}
|
1861
|
-
$chunk.writeHTML(
|
1862
|
-
$chunk.boundary.state.mark(
|
1863
|
-
"]" /* BranchEnd */,
|
1864
|
-
scopeId + " " + accessor
|
1865
|
-
)
|
1866
|
-
);
|
1867
1902
|
}
|
1868
|
-
function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch,
|
1869
|
-
|
1870
|
-
|
1871
|
-
}
|
1872
|
-
const loopScopes = /* @__PURE__ */ new Map();
|
1903
|
+
function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
|
1904
|
+
const resumeBranch = serializeBranch !== 0;
|
1905
|
+
const resumeMarker = serializeMarker !== 0;
|
1873
1906
|
let branchIds = "";
|
1874
|
-
|
1875
|
-
const
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1879
|
-
|
1880
|
-
|
1881
|
-
|
1882
|
-
|
1883
|
-
|
1884
|
-
|
1907
|
+
if (resumeBranch) {
|
1908
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1909
|
+
forIn(obj, (key, value) => {
|
1910
|
+
const branchId = peekNextScopeId();
|
1911
|
+
if (resumeMarker) {
|
1912
|
+
branchIds = " " + branchId + branchIds;
|
1913
|
+
}
|
1914
|
+
withBranchId(branchId, () => {
|
1915
|
+
cb(key, value);
|
1916
|
+
loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
|
1917
|
+
});
|
1885
1918
|
});
|
1919
|
+
if (loopScopes.size) {
|
1920
|
+
writeScope(scopeId, {
|
1921
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1922
|
+
});
|
1923
|
+
}
|
1924
|
+
} else {
|
1925
|
+
forIn(obj, cb);
|
1886
1926
|
}
|
1887
|
-
|
1888
|
-
$chunk.
|
1889
|
-
|
1890
|
-
|
1891
|
-
|
1892
|
-
|
1893
|
-
|
1894
|
-
function forInBy(by, name, value) {
|
1895
|
-
if (by) {
|
1896
|
-
return by(name, value);
|
1927
|
+
if (resumeMarker) {
|
1928
|
+
$chunk.writeHTML(
|
1929
|
+
$chunk.boundary.state.mark(
|
1930
|
+
onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1931
|
+
scopeId + " " + accessor + branchIds
|
1932
|
+
)
|
1933
|
+
);
|
1897
1934
|
}
|
1898
|
-
return name;
|
1899
1935
|
}
|
1900
|
-
function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch) {
|
1901
|
-
|
1902
|
-
|
1936
|
+
function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
|
1937
|
+
const resumeBranch = serializeBranch !== 0;
|
1938
|
+
const resumeMarker = serializeMarker !== 0;
|
1939
|
+
if (resumeBranch) {
|
1940
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1941
|
+
let sep = "";
|
1942
|
+
forTo(to, from, step, (i) => {
|
1943
|
+
const branchId = peekNextScopeId();
|
1944
|
+
if (resumeMarker) {
|
1945
|
+
$chunk.writeHTML(
|
1946
|
+
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
|
1947
|
+
);
|
1948
|
+
sep = " ";
|
1949
|
+
}
|
1950
|
+
withBranchId(branchId, () => {
|
1951
|
+
cb(i);
|
1952
|
+
loopScopes.set(forToBy(by, i), writeScope(branchId, {}));
|
1953
|
+
});
|
1954
|
+
});
|
1955
|
+
if (loopScopes.size) {
|
1956
|
+
writeScope(scopeId, {
|
1957
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1958
|
+
});
|
1959
|
+
}
|
1960
|
+
} else {
|
1961
|
+
forTo(to, from, step, cb);
|
1903
1962
|
}
|
1904
|
-
|
1905
|
-
let sep = "";
|
1906
|
-
forTo(to, from, step, (index) => {
|
1907
|
-
const branchId = peekNextScopeId();
|
1963
|
+
if (resumeMarker) {
|
1908
1964
|
$chunk.writeHTML(
|
1909
|
-
$chunk.boundary.state.mark(
|
1965
|
+
$chunk.boundary.state.mark(
|
1966
|
+
"]" /* BranchEnd */,
|
1967
|
+
scopeId + " " + accessor
|
1968
|
+
)
|
1910
1969
|
);
|
1911
|
-
sep = " ";
|
1912
|
-
withBranchId(branchId, () => {
|
1913
|
-
cb(index);
|
1914
|
-
loopScopes.set(forToBy(by, index), writeScope(branchId, {}));
|
1915
|
-
});
|
1916
|
-
});
|
1917
|
-
if (loopScopes.size) {
|
1918
|
-
writeScope(scopeId, {
|
1919
|
-
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1920
|
-
});
|
1921
1970
|
}
|
1922
|
-
$chunk.writeHTML(
|
1923
|
-
$chunk.boundary.state.mark(
|
1924
|
-
"]" /* BranchEnd */,
|
1925
|
-
scopeId + " " + accessor
|
1926
|
-
)
|
1927
|
-
);
|
1928
1971
|
}
|
1929
|
-
function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch,
|
1930
|
-
|
1931
|
-
|
1932
|
-
}
|
1933
|
-
const loopScopes = /* @__PURE__ */ new Map();
|
1972
|
+
function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
|
1973
|
+
const resumeBranch = serializeBranch !== 0;
|
1974
|
+
const resumeMarker = serializeMarker !== 0;
|
1934
1975
|
let branchIds = "";
|
1935
|
-
|
1936
|
-
const
|
1937
|
-
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
|
1942
|
-
|
1943
|
-
|
1944
|
-
|
1945
|
-
|
1976
|
+
if (resumeBranch) {
|
1977
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1978
|
+
forTo(to, from, step, (i) => {
|
1979
|
+
const branchId = peekNextScopeId();
|
1980
|
+
if (resumeMarker) {
|
1981
|
+
branchIds = " " + branchId + branchIds;
|
1982
|
+
}
|
1983
|
+
withBranchId(branchId, () => {
|
1984
|
+
cb(i);
|
1985
|
+
loopScopes.set(forToBy(by, i), writeScope(branchId, {}));
|
1986
|
+
});
|
1946
1987
|
});
|
1988
|
+
if (loopScopes.size) {
|
1989
|
+
writeScope(scopeId, {
|
1990
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1991
|
+
});
|
1992
|
+
}
|
1993
|
+
} else {
|
1994
|
+
forTo(to, from, step, cb);
|
1947
1995
|
}
|
1948
|
-
|
1949
|
-
$chunk.
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
1953
|
-
|
1954
|
-
|
1955
|
-
function forToBy(by, index) {
|
1956
|
-
if (by) {
|
1957
|
-
return by(index);
|
1996
|
+
if (resumeMarker) {
|
1997
|
+
$chunk.writeHTML(
|
1998
|
+
$chunk.boundary.state.mark(
|
1999
|
+
onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
2000
|
+
scopeId + " " + accessor + branchIds
|
2001
|
+
)
|
2002
|
+
);
|
1958
2003
|
}
|
1959
|
-
return index;
|
1960
2004
|
}
|
1961
2005
|
function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker) {
|
1962
|
-
|
1963
|
-
|
1964
|
-
}
|
2006
|
+
const resumeBranch = serializeBranch !== 0;
|
2007
|
+
const resumeMarker = serializeMarker !== 0;
|
1965
2008
|
const branchId = peekNextScopeId();
|
1966
|
-
if (
|
2009
|
+
if (resumeMarker && resumeBranch) {
|
1967
2010
|
$chunk.writeHTML(
|
1968
2011
|
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
|
1969
2012
|
);
|
1970
2013
|
}
|
1971
|
-
const branchIndex = withBranchId(branchId, cb);
|
1972
|
-
|
2014
|
+
const branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb();
|
2015
|
+
const rendered = branchIndex !== void 0;
|
2016
|
+
if (resumeBranch && rendered) {
|
1973
2017
|
writeScope(scopeId, {
|
1974
|
-
["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]:
|
2018
|
+
["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
|
1975
2019
|
["ConditionalScope:" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
1976
2020
|
});
|
1977
|
-
} else {
|
1978
|
-
nextScopeId();
|
1979
2021
|
}
|
1980
|
-
if (
|
2022
|
+
if (resumeMarker) {
|
1981
2023
|
$chunk.writeHTML(
|
1982
2024
|
$chunk.boundary.state.mark(
|
1983
2025
|
"]" /* BranchEnd */,
|
@@ -1986,26 +2028,23 @@ function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMark
|
|
1986
2028
|
);
|
1987
2029
|
}
|
1988
2030
|
}
|
1989
|
-
function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker,
|
1990
|
-
|
1991
|
-
|
1992
|
-
}
|
2031
|
+
function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
|
2032
|
+
const resumeBranch = serializeBranch !== 0;
|
2033
|
+
const resumeMarker = serializeMarker !== 0;
|
1993
2034
|
const branchId = peekNextScopeId();
|
1994
|
-
const branchIndex = withBranchId(branchId, cb);
|
1995
|
-
const
|
1996
|
-
if (
|
2035
|
+
const branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb();
|
2036
|
+
const shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
2037
|
+
if (shouldWriteBranch) {
|
1997
2038
|
writeScope(scopeId, {
|
1998
|
-
["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]:
|
2039
|
+
["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
|
1999
2040
|
["ConditionalScope:" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
2000
2041
|
});
|
2001
|
-
} else {
|
2002
|
-
nextScopeId();
|
2003
2042
|
}
|
2004
|
-
if (
|
2043
|
+
if (resumeMarker) {
|
2005
2044
|
$chunk.writeHTML(
|
2006
2045
|
$chunk.boundary.state.mark(
|
2007
|
-
|
2008
|
-
scopeId + " " + accessor + (
|
2046
|
+
onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
2047
|
+
scopeId + " " + accessor + (shouldWriteBranch ? " " + branchId : "")
|
2009
2048
|
)
|
2010
2049
|
);
|
2011
2050
|
}
|
@@ -2197,7 +2236,7 @@ function tryCatch(content, catchContent) {
|
|
2197
2236
|
cur.async = false;
|
2198
2237
|
cur.next = bodyNext;
|
2199
2238
|
cur.html = endMarker;
|
2200
|
-
cur.scripts = cur.effects = "";
|
2239
|
+
cur.scripts = cur.effects = cur.lastEffect = "";
|
2201
2240
|
cur.placeholderBody = cur.placeholderRender = cur.reorderId = null;
|
2202
2241
|
}
|
2203
2242
|
cur = next;
|
@@ -2328,6 +2367,7 @@ var Chunk = class {
|
|
2328
2367
|
html = "";
|
2329
2368
|
scripts = "";
|
2330
2369
|
effects = "";
|
2370
|
+
lastEffect = "";
|
2331
2371
|
async = false;
|
2332
2372
|
consumed = false;
|
2333
2373
|
reorderId = null;
|
@@ -2337,10 +2377,15 @@ var Chunk = class {
|
|
2337
2377
|
this.html += html;
|
2338
2378
|
}
|
2339
2379
|
writeEffect(scopeId, registryId) {
|
2340
|
-
this.
|
2341
|
-
this.effects,
|
2342
|
-
|
2343
|
-
|
2380
|
+
if (this.lastEffect === registryId) {
|
2381
|
+
this.effects += "," + scopeId;
|
2382
|
+
} else {
|
2383
|
+
this.effects = concatEffects(
|
2384
|
+
this.effects,
|
2385
|
+
'"' + registryId + '",' + scopeId
|
2386
|
+
);
|
2387
|
+
}
|
2388
|
+
this.lastEffect = registryId;
|
2344
2389
|
}
|
2345
2390
|
writeScript(script) {
|
2346
2391
|
this.scripts = concatScripts(this.scripts, script);
|
@@ -2349,6 +2394,7 @@ var Chunk = class {
|
|
2349
2394
|
this.html += chunk.html;
|
2350
2395
|
this.effects = concatEffects(this.effects, chunk.effects);
|
2351
2396
|
this.scripts = concatScripts(this.scripts, chunk.scripts);
|
2397
|
+
this.lastEffect = chunk.lastEffect || this.lastEffect;
|
2352
2398
|
}
|
2353
2399
|
flushPlaceholder() {
|
2354
2400
|
if (this.placeholderBody) {
|
@@ -2378,17 +2424,20 @@ var Chunk = class {
|
|
2378
2424
|
let html = "";
|
2379
2425
|
let effects = "";
|
2380
2426
|
let scripts = "";
|
2427
|
+
let lastEffect = "";
|
2381
2428
|
do {
|
2382
2429
|
cur.flushPlaceholder();
|
2383
2430
|
html += cur.html;
|
2384
2431
|
effects = concatEffects(effects, cur.effects);
|
2385
2432
|
scripts = concatScripts(scripts, cur.scripts);
|
2433
|
+
lastEffect = cur.lastEffect || lastEffect;
|
2386
2434
|
cur.consumed = true;
|
2387
2435
|
cur = cur.next;
|
2388
2436
|
} while (cur.next && !cur.async);
|
2389
2437
|
cur.html = html + cur.html;
|
2390
2438
|
cur.effects = concatEffects(effects, cur.effects);
|
2391
2439
|
cur.scripts = concatScripts(scripts, cur.scripts);
|
2440
|
+
cur.lastEffect = lastEffect;
|
2392
2441
|
}
|
2393
2442
|
return cur;
|
2394
2443
|
}
|
@@ -2467,7 +2516,7 @@ var Chunk = class {
|
|
2467
2516
|
"#" /* ReorderMarker */,
|
2468
2517
|
cur.reorderId = state.nextReorderId()
|
2469
2518
|
);
|
2470
|
-
cur.html = cur.effects = cur.scripts = "";
|
2519
|
+
cur.html = cur.effects = cur.scripts = cur.lastEffect = "";
|
2471
2520
|
cur.next = null;
|
2472
2521
|
}
|
2473
2522
|
if (next) {
|
@@ -3098,7 +3147,8 @@ function NOOP2() {
|
|
3098
3147
|
|
3099
3148
|
// src/html/dynamic-tag.ts
|
3100
3149
|
var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/;
|
3101
|
-
var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs,
|
3150
|
+
var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
|
3151
|
+
const shouldResume = serializeReason !== 0;
|
3102
3152
|
const renderer = normalizeDynamicRenderer(tag);
|
3103
3153
|
if (true) {
|
3104
3154
|
if (renderer && typeof renderer !== "function" && typeof renderer !== "string") {
|
@@ -3169,7 +3219,7 @@ var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, sho
|
|
3169
3219
|
const input = inputIsArgs ? inputOrArgs[0] : inputOrArgs;
|
3170
3220
|
return renderer(
|
3171
3221
|
content ? { ...input, content } : input,
|
3172
|
-
shouldResume
|
3222
|
+
shouldResume ? 1 : 0
|
3173
3223
|
);
|
3174
3224
|
}
|
3175
3225
|
return inputIsArgs ? renderer(...inputOrArgs) : renderer(
|
@@ -3313,29 +3363,6 @@ var compat = {
|
|
3313
3363
|
register(RENDER_BODY_ID, fn);
|
3314
3364
|
}
|
3315
3365
|
};
|
3316
|
-
|
3317
|
-
// src/html/for.ts
|
3318
|
-
function forOfBy2(by, item, index) {
|
3319
|
-
if (by) {
|
3320
|
-
if (typeof by === "string") {
|
3321
|
-
return item[by];
|
3322
|
-
}
|
3323
|
-
return by(item, index);
|
3324
|
-
}
|
3325
|
-
return index;
|
3326
|
-
}
|
3327
|
-
function forInBy2(by, name, value) {
|
3328
|
-
if (by) {
|
3329
|
-
return by(name, value);
|
3330
|
-
}
|
3331
|
-
return name;
|
3332
|
-
}
|
3333
|
-
function forToBy2(by, index) {
|
3334
|
-
if (by) {
|
3335
|
-
return by(index);
|
3336
|
-
}
|
3337
|
-
return index;
|
3338
|
-
}
|
3339
3366
|
// Annotate the CommonJS export names for ESM import in node:
|
3340
3367
|
0 && (module.exports = {
|
3341
3368
|
$global,
|