marko 6.0.0-next.3.67 → 6.0.0-next.3.69
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 +1 -8
- package/dist/debug/dom.mjs +1 -8
- package/dist/debug/html.js +239 -187
- package/dist/debug/html.mjs +238 -184
- package/dist/dom.js +3 -7
- package/dist/dom.mjs +3 -7
- package/dist/html/dynamic-tag.d.ts +2 -4
- package/dist/html/writer.d.ts +10 -9
- package/dist/html.d.ts +1 -1
- package/dist/html.js +137 -131
- package/dist/html.mjs +136 -128
- package/dist/translator/index.js +49 -211
- package/package.json +1 -1
package/dist/debug/html.js
CHANGED
@@ -35,19 +35,17 @@ __export(html_exports, {
|
|
35
35
|
controllable_textarea_value: () => controllable_textarea_value,
|
36
36
|
createContent: () => createContent,
|
37
37
|
createTemplate: () => createTemplate,
|
38
|
-
|
39
|
-
dynamicTagId: () => dynamicTagId,
|
40
|
-
dynamicTagInput: () => dynamicTagInput,
|
38
|
+
dynamicTag: () => dynamicTag,
|
41
39
|
ensureScopeWithId: () => ensureScopeWithId,
|
42
40
|
escapeScript: () => escapeScript,
|
43
41
|
escapeStyle: () => escapeStyle,
|
44
42
|
escapeXML: () => escapeXML,
|
45
43
|
forIn: () => forIn,
|
46
|
-
forInBy: () =>
|
44
|
+
forInBy: () => forInBy2,
|
47
45
|
forOf: () => forOf,
|
48
|
-
forOfBy: () =>
|
46
|
+
forOfBy: () => forOfBy2,
|
49
47
|
forTo: () => forTo,
|
50
|
-
forToBy: () =>
|
48
|
+
forToBy: () => forToBy2,
|
51
49
|
fork: () => fork,
|
52
50
|
getScopeById: () => getScopeById,
|
53
51
|
hoist: () => hoist,
|
@@ -279,16 +277,12 @@ runtime.x = (op, id, node, start, placeholderCallback) => {
|
|
279
277
|
placeholders[id] = {
|
280
278
|
i: 1,
|
281
279
|
c(end = runtime.l[id] || node) {
|
282
|
-
while (end.parentNode !== start.parentNode) {
|
283
|
-
end = end.parentNode;
|
284
|
-
}
|
285
|
-
|
286
280
|
for (
|
287
281
|
;
|
288
|
-
end
|
289
|
-
|
282
|
+
(nextSibling = end.previousSibling || start).remove(),
|
283
|
+
start != nextSibling;
|
290
284
|
);
|
291
|
-
replace(
|
285
|
+
replace(end, node);
|
292
286
|
},
|
293
287
|
};
|
294
288
|
}
|
@@ -310,7 +304,7 @@ runtime.x = (op, id, node, start, placeholderCallback) => {
|
|
310
304
|
}
|
311
305
|
};
|
312
306
|
})`
|
313
|
-
) : `(e=>{let i,t,r
|
307
|
+
) : `(e=>{let i,l,t,r={},c=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(d,o,n,a,g)=>{"#"==d?(r[o]=l).i++:n==t&&i(),"T"==n.tagName&&(o=n.getAttribute(e.i))&&((a=e.l["^"+o])&&(r[o]={i:1,c(i=e.l[o]||n){for(;(t=i.previousSibling||a).remove(),a!=t;);c(i,n)}}),t=n.nextSibling,l=r[o],i=()=>{a||c(e.l[o],n),--l.i||l.c()},(d=e.j[o])&&(g=l.c,l.c=()=>g()+d(e.r)))}})`;
|
314
308
|
|
315
309
|
// src/html/serializer.ts
|
316
310
|
var { hasOwnProperty } = {};
|
@@ -589,11 +583,7 @@ var Reference = class {
|
|
589
583
|
};
|
590
584
|
var DEBUG = /* @__PURE__ */ new WeakMap();
|
591
585
|
function setDebugInfo(obj, file, loc, vars) {
|
592
|
-
DEBUG.set(obj, {
|
593
|
-
file,
|
594
|
-
loc,
|
595
|
-
vars
|
596
|
-
});
|
586
|
+
DEBUG.set(obj, { file, loc, vars });
|
597
587
|
}
|
598
588
|
var Serializer = class {
|
599
589
|
#state = new State();
|
@@ -652,10 +642,7 @@ function register(id, val, scope) {
|
|
652
642
|
function getRegistered(val) {
|
653
643
|
const registered = REGISTRY.get(val);
|
654
644
|
if (registered) {
|
655
|
-
return {
|
656
|
-
id: registered.id,
|
657
|
-
scope: registered.scope
|
658
|
-
};
|
645
|
+
return { id: registered.id, scope: registered.scope };
|
659
646
|
}
|
660
647
|
}
|
661
648
|
function writeRoot(state, root) {
|
@@ -825,7 +812,7 @@ function writeRegistered(state, val, parent, accessor, { access, scope, getter }
|
|
825
812
|
return true;
|
826
813
|
}
|
827
814
|
if (scopeRef) {
|
828
|
-
if (isCircular(parent, scopeRef)) {
|
815
|
+
if (parent && (state.assigned.has(scopeRef) || isCircular(parent, scopeRef))) {
|
829
816
|
state.assigned.add(parent);
|
830
817
|
state.assigned.add(fnRef);
|
831
818
|
fnRef.init = access + "(" + ensureId(state, scopeRef) + ")";
|
@@ -1681,7 +1668,7 @@ function withContext(key, value, cb) {
|
|
1681
1668
|
ctx[kPendingContexts]++;
|
1682
1669
|
ctx[key] = value;
|
1683
1670
|
try {
|
1684
|
-
cb();
|
1671
|
+
return cb();
|
1685
1672
|
} finally {
|
1686
1673
|
ctx[kPendingContexts]--;
|
1687
1674
|
ctx[key] = prev;
|
@@ -1742,23 +1729,33 @@ function hoist(scopeId, id) {
|
|
1742
1729
|
function resumeClosestBranch(scopeId) {
|
1743
1730
|
const branchId = $chunk.context?.[branchIdKey];
|
1744
1731
|
if (branchId !== void 0 && branchId !== scopeId) {
|
1745
|
-
writeScope(scopeId, {
|
1746
|
-
["#ClosestBranchId" /* ClosestBranchId */]: branchId
|
1747
|
-
});
|
1732
|
+
writeScope(scopeId, { ["#ClosestBranchId" /* ClosestBranchId */]: branchId });
|
1748
1733
|
}
|
1749
1734
|
}
|
1750
1735
|
var branchIdKey = Symbol();
|
1751
|
-
function
|
1752
|
-
|
1736
|
+
function withBranchId(branchId, cb) {
|
1737
|
+
return withContext(branchIdKey, branchId, cb);
|
1738
|
+
}
|
1739
|
+
function resumeForOf(list, cb, by, scopeId, accessor) {
|
1740
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1741
|
+
forOf(list, (item, index) => {
|
1753
1742
|
const branchId = peekNextScopeId();
|
1754
1743
|
$chunk.writeHTML(
|
1755
1744
|
$chunk.boundary.state.mark(
|
1756
1745
|
"[" /* BranchStart */,
|
1757
|
-
branchId + (
|
1746
|
+
branchId + (index ? " " : "")
|
1758
1747
|
)
|
1759
1748
|
);
|
1760
|
-
|
1749
|
+
withBranchId(branchId, () => {
|
1750
|
+
cb(item, index);
|
1751
|
+
loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1752
|
+
});
|
1761
1753
|
});
|
1754
|
+
if (loopScopes.size) {
|
1755
|
+
writeScope(scopeId, {
|
1756
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1757
|
+
});
|
1758
|
+
}
|
1762
1759
|
$chunk.writeHTML(
|
1763
1760
|
$chunk.boundary.state.mark(
|
1764
1761
|
"]" /* BranchEnd */,
|
@@ -1766,13 +1763,22 @@ function resumeForOf(list, cb, scopeId, accessor) {
|
|
1766
1763
|
)
|
1767
1764
|
);
|
1768
1765
|
}
|
1769
|
-
function resumeSingleNodeForOf(list, cb, scopeId, accessor, onlyChildInParent) {
|
1766
|
+
function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, onlyChildInParent) {
|
1767
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1770
1768
|
let branchIds = "";
|
1771
1769
|
forOf(list, (item, index) => {
|
1772
1770
|
const branchId = peekNextScopeId();
|
1773
1771
|
branchIds = " " + branchId + branchIds;
|
1774
|
-
|
1772
|
+
withBranchId(branchId, () => {
|
1773
|
+
cb(item, index);
|
1774
|
+
loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1775
|
+
});
|
1775
1776
|
});
|
1777
|
+
if (loopScopes.size) {
|
1778
|
+
writeScope(scopeId, {
|
1779
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1780
|
+
});
|
1781
|
+
}
|
1776
1782
|
$chunk.writeHTML(
|
1777
1783
|
$chunk.boundary.state.mark(
|
1778
1784
|
onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
@@ -1780,7 +1786,17 @@ function resumeSingleNodeForOf(list, cb, scopeId, accessor, onlyChildInParent) {
|
|
1780
1786
|
)
|
1781
1787
|
);
|
1782
1788
|
}
|
1783
|
-
function
|
1789
|
+
function forOfBy(by, item, index) {
|
1790
|
+
if (by) {
|
1791
|
+
if (typeof by === "string") {
|
1792
|
+
return item[by];
|
1793
|
+
}
|
1794
|
+
return by(item, index);
|
1795
|
+
}
|
1796
|
+
return index;
|
1797
|
+
}
|
1798
|
+
function resumeForIn(obj, cb, by, scopeId, accessor) {
|
1799
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1784
1800
|
let sep = "";
|
1785
1801
|
forIn(obj, (key, value) => {
|
1786
1802
|
const branchId = peekNextScopeId();
|
@@ -1788,8 +1804,16 @@ function resumeForIn(obj, cb, scopeId, accessor) {
|
|
1788
1804
|
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
|
1789
1805
|
);
|
1790
1806
|
sep = " ";
|
1791
|
-
|
1807
|
+
withBranchId(branchId, () => {
|
1808
|
+
cb(key, value);
|
1809
|
+
loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
|
1810
|
+
});
|
1792
1811
|
});
|
1812
|
+
if (loopScopes.size) {
|
1813
|
+
writeScope(scopeId, {
|
1814
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1815
|
+
});
|
1816
|
+
}
|
1793
1817
|
$chunk.writeHTML(
|
1794
1818
|
$chunk.boundary.state.mark(
|
1795
1819
|
"]" /* BranchEnd */,
|
@@ -1797,13 +1821,22 @@ function resumeForIn(obj, cb, scopeId, accessor) {
|
|
1797
1821
|
)
|
1798
1822
|
);
|
1799
1823
|
}
|
1800
|
-
function resumeSingleNodeForIn(obj, cb, scopeId, accessor, onlyChild) {
|
1824
|
+
function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, onlyChild) {
|
1825
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1801
1826
|
let branchIds = "";
|
1802
1827
|
forIn(obj, (key, value) => {
|
1803
1828
|
const branchId = peekNextScopeId();
|
1804
1829
|
branchIds = " " + branchId + branchIds;
|
1805
|
-
|
1830
|
+
withBranchId(branchId, () => {
|
1831
|
+
cb(key, value);
|
1832
|
+
loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
|
1833
|
+
});
|
1806
1834
|
});
|
1835
|
+
if (loopScopes.size) {
|
1836
|
+
writeScope(scopeId, {
|
1837
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1838
|
+
});
|
1839
|
+
}
|
1807
1840
|
$chunk.writeHTML(
|
1808
1841
|
$chunk.boundary.state.mark(
|
1809
1842
|
onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
@@ -1811,7 +1844,14 @@ function resumeSingleNodeForIn(obj, cb, scopeId, accessor, onlyChild) {
|
|
1811
1844
|
)
|
1812
1845
|
);
|
1813
1846
|
}
|
1814
|
-
function
|
1847
|
+
function forInBy(by, name, value) {
|
1848
|
+
if (by) {
|
1849
|
+
return by(name, value);
|
1850
|
+
}
|
1851
|
+
return name;
|
1852
|
+
}
|
1853
|
+
function resumeForTo(to, from, step, cb, by, scopeId, accessor) {
|
1854
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1815
1855
|
let sep = "";
|
1816
1856
|
forTo(to, from, step, (index) => {
|
1817
1857
|
const branchId = peekNextScopeId();
|
@@ -1819,8 +1859,16 @@ function resumeForTo(to, from, step, cb, scopeId, accessor) {
|
|
1819
1859
|
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
|
1820
1860
|
);
|
1821
1861
|
sep = " ";
|
1822
|
-
|
1862
|
+
withBranchId(branchId, () => {
|
1863
|
+
cb(index);
|
1864
|
+
loopScopes.set(forToBy(by, index), writeScope(branchId, {}));
|
1865
|
+
});
|
1823
1866
|
});
|
1867
|
+
if (loopScopes.size) {
|
1868
|
+
writeScope(scopeId, {
|
1869
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1870
|
+
});
|
1871
|
+
}
|
1824
1872
|
$chunk.writeHTML(
|
1825
1873
|
$chunk.boundary.state.mark(
|
1826
1874
|
"]" /* BranchEnd */,
|
@@ -1828,13 +1876,22 @@ function resumeForTo(to, from, step, cb, scopeId, accessor) {
|
|
1828
1876
|
)
|
1829
1877
|
);
|
1830
1878
|
}
|
1831
|
-
function resumeSingleNodeForTo(to, from, step, cb, scopeId, accessor, onlyChild) {
|
1879
|
+
function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, onlyChild) {
|
1880
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1832
1881
|
let branchIds = "";
|
1833
1882
|
forTo(to, from, step, (index) => {
|
1834
1883
|
const branchId = peekNextScopeId();
|
1835
1884
|
branchIds = " " + branchId + branchIds;
|
1836
|
-
|
1885
|
+
withBranchId(branchId, () => {
|
1886
|
+
cb(index);
|
1887
|
+
loopScopes.set(forToBy(by, index), writeScope(branchId, {}));
|
1888
|
+
});
|
1837
1889
|
});
|
1890
|
+
if (loopScopes.size) {
|
1891
|
+
writeScope(scopeId, {
|
1892
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1893
|
+
});
|
1894
|
+
}
|
1838
1895
|
$chunk.writeHTML(
|
1839
1896
|
$chunk.boundary.state.mark(
|
1840
1897
|
onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
@@ -1842,40 +1899,57 @@ function resumeSingleNodeForTo(to, from, step, cb, scopeId, accessor, onlyChild)
|
|
1842
1899
|
)
|
1843
1900
|
);
|
1844
1901
|
}
|
1845
|
-
function
|
1902
|
+
function forToBy(by, index) {
|
1903
|
+
if (by) {
|
1904
|
+
return by(index);
|
1905
|
+
}
|
1906
|
+
return index;
|
1907
|
+
}
|
1908
|
+
function resumeConditional(cb, scopeId, accessor, dynamic) {
|
1846
1909
|
const branchId = peekNextScopeId();
|
1847
|
-
|
1848
|
-
$chunk.
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1910
|
+
if (dynamic) {
|
1911
|
+
$chunk.writeHTML(
|
1912
|
+
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
|
1913
|
+
);
|
1914
|
+
}
|
1915
|
+
const branchIndex = withBranchId(branchId, cb);
|
1916
|
+
if (branchIndex !== void 0) {
|
1917
|
+
writeScope(scopeId, {
|
1918
|
+
["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]: dynamic ? branchIndex : void 0,
|
1919
|
+
["ConditionalScope:" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
1920
|
+
});
|
1854
1921
|
} else {
|
1855
1922
|
nextScopeId();
|
1856
1923
|
}
|
1857
|
-
|
1858
|
-
$chunk.
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1924
|
+
if (dynamic) {
|
1925
|
+
$chunk.writeHTML(
|
1926
|
+
$chunk.boundary.state.mark(
|
1927
|
+
"]" /* BranchEnd */,
|
1928
|
+
scopeId + " " + accessor
|
1929
|
+
)
|
1930
|
+
);
|
1931
|
+
}
|
1863
1932
|
}
|
1864
|
-
function resumeSingleNodeConditional(cb, scopeId, accessor, onlyChild) {
|
1933
|
+
function resumeSingleNodeConditional(cb, scopeId, accessor, dynamic, onlyChild) {
|
1865
1934
|
const branchId = peekNextScopeId();
|
1866
|
-
|
1867
|
-
const rendered =
|
1935
|
+
const branchIndex = withBranchId(branchId, cb);
|
1936
|
+
const rendered = branchIndex !== void 0;
|
1868
1937
|
if (rendered) {
|
1869
|
-
writeScope(
|
1938
|
+
writeScope(scopeId, {
|
1939
|
+
["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]: dynamic ? branchIndex : void 0,
|
1940
|
+
["ConditionalScope:" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
1941
|
+
});
|
1870
1942
|
} else {
|
1871
1943
|
nextScopeId();
|
1872
1944
|
}
|
1873
|
-
|
1874
|
-
$chunk.
|
1875
|
-
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1945
|
+
if (dynamic) {
|
1946
|
+
$chunk.writeHTML(
|
1947
|
+
$chunk.boundary.state.mark(
|
1948
|
+
onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1949
|
+
scopeId + " " + accessor + (rendered ? " " + branchId : "")
|
1950
|
+
)
|
1951
|
+
);
|
1952
|
+
}
|
1879
1953
|
}
|
1880
1954
|
var writeScope = (scopeId, partialScope) => {
|
1881
1955
|
const { state } = $chunk.boundary;
|
@@ -2341,8 +2415,8 @@ function prepareChunk(chunk) {
|
|
2341
2415
|
let cur = reorderedChunk;
|
2342
2416
|
reorderedChunk.reorderId = null;
|
2343
2417
|
for (; ; ) {
|
2344
|
-
const { next } = cur;
|
2345
2418
|
cur.flushPlaceholder();
|
2419
|
+
const { next } = cur;
|
2346
2420
|
cur.consumed = true;
|
2347
2421
|
reorderHTML += cur.html;
|
2348
2422
|
reorderEffects = concatEffects(reorderEffects, cur.effects);
|
@@ -2728,117 +2802,97 @@ var DEFAULT_RENDER_ID = "_";
|
|
2728
2802
|
|
2729
2803
|
// src/html/dynamic-tag.ts
|
2730
2804
|
var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/;
|
2731
|
-
|
2732
|
-
const
|
2733
|
-
|
2734
|
-
|
2735
|
-
|
2736
|
-
|
2737
|
-
nextScopeId();
|
2738
|
-
return;
|
2739
|
-
}
|
2740
|
-
if (!tag) {
|
2741
|
-
resumeConditional(content, scopeId, accessor);
|
2742
|
-
return;
|
2805
|
+
var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, resume) => {
|
2806
|
+
const renderer = normalizeDynamicRenderer(tag);
|
2807
|
+
if (true) {
|
2808
|
+
if (renderer && typeof renderer !== "function" && typeof renderer !== "string") {
|
2809
|
+
throw new Error(`Invalid renderer passed for dynamic tag: ${renderer}`);
|
2810
|
+
}
|
2743
2811
|
}
|
2744
|
-
|
2745
|
-
|
2746
|
-
|
2747
|
-
|
2748
|
-
|
2749
|
-
|
2750
|
-
|
2751
|
-
|
2752
|
-
|
2753
|
-
|
2754
|
-
|
2755
|
-
|
2756
|
-
|
2757
|
-
controllable_textarea_value(
|
2758
|
-
scopeId,
|
2759
|
-
accessor,
|
2760
|
-
input.value,
|
2761
|
-
input.valueChange
|
2762
|
-
)
|
2812
|
+
const chunk = getChunk();
|
2813
|
+
const branchId = peekNextScopeId();
|
2814
|
+
let result;
|
2815
|
+
if (typeof renderer === "string") {
|
2816
|
+
const input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
2817
|
+
nextScopeId();
|
2818
|
+
write(`<${renderer}${attrs(input, accessor, scopeId, renderer)}>`);
|
2819
|
+
if (!voidElementsReg.test(renderer)) {
|
2820
|
+
withBranchId(branchId, () => {
|
2821
|
+
if (renderer === "textarea") {
|
2822
|
+
if (content) {
|
2823
|
+
throw new Error(
|
2824
|
+
"A dynamic tag rendering a `<textarea>` cannot have `content` and must use the `value` attribute instead."
|
2763
2825
|
);
|
2764
|
-
} else if (content) {
|
2765
|
-
if (tag === "select" && ("value" in input || "valueChange" in input)) {
|
2766
|
-
controllable_select_value(
|
2767
|
-
scopeId,
|
2768
|
-
accessor,
|
2769
|
-
input.value,
|
2770
|
-
input.valueChange,
|
2771
|
-
content
|
2772
|
-
);
|
2773
|
-
} else {
|
2774
|
-
content();
|
2775
|
-
}
|
2776
2826
|
}
|
2777
|
-
write(
|
2827
|
+
write(
|
2828
|
+
controllable_textarea_value(
|
2829
|
+
scopeId,
|
2830
|
+
accessor,
|
2831
|
+
input.value,
|
2832
|
+
input.valueChange
|
2833
|
+
)
|
2834
|
+
);
|
2778
2835
|
} else if (content) {
|
2779
|
-
|
2836
|
+
if (renderer === "select" && ("value" in input || "valueChange" in input)) {
|
2837
|
+
controllable_select_value(
|
2838
|
+
scopeId,
|
2839
|
+
accessor,
|
2840
|
+
input.value,
|
2841
|
+
input.valueChange,
|
2842
|
+
content
|
2843
|
+
);
|
2844
|
+
} else {
|
2845
|
+
content();
|
2846
|
+
}
|
2780
2847
|
}
|
2781
|
-
}
|
2782
|
-
|
2783
|
-
|
2784
|
-
|
2785
|
-
|
2786
|
-
|
2787
|
-
|
2788
|
-
|
2789
|
-
|
2790
|
-
|
2791
|
-
|
2792
|
-
|
2848
|
+
});
|
2849
|
+
write(`</${renderer}>`);
|
2850
|
+
} else if (content) {
|
2851
|
+
throw new Error(`Body content is not supported for a "${renderer}" tag.`);
|
2852
|
+
}
|
2853
|
+
if (resume) {
|
2854
|
+
chunk.writeHTML(
|
2855
|
+
chunk.boundary.state.mark(
|
2856
|
+
"|" /* BranchSingleNode */,
|
2857
|
+
scopeId + " " + accessor + " " + branchId
|
2858
|
+
)
|
2859
|
+
);
|
2793
2860
|
}
|
2794
|
-
}
|
2795
|
-
|
2796
|
-
|
2797
|
-
|
2798
|
-
|
2799
|
-
}
|
2800
|
-
|
2801
|
-
|
2802
|
-
|
2803
|
-
|
2804
|
-
};
|
2805
|
-
var dynamicTagArgs = (scopeId, accessor, tag, args) => {
|
2806
|
-
if (!tag) {
|
2807
|
-
nextScopeId();
|
2808
|
-
return;
|
2809
|
-
}
|
2810
|
-
if (typeof tag === "string") {
|
2811
|
-
resumeSingleNodeConditional(
|
2812
|
-
() => {
|
2813
|
-
nextScopeId();
|
2814
|
-
write(
|
2815
|
-
`<${tag}${attrs(args[0], accessor, scopeId, tag)}>`
|
2861
|
+
} else {
|
2862
|
+
if (resume) {
|
2863
|
+
chunk.writeHTML(
|
2864
|
+
chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
|
2865
|
+
);
|
2866
|
+
}
|
2867
|
+
result = withBranchId(branchId, () => {
|
2868
|
+
if (renderer) {
|
2869
|
+
return inputIsArgs ? renderer(...inputOrArgs) : renderer(
|
2870
|
+
content ? { ...inputOrArgs, content } : inputOrArgs
|
2816
2871
|
);
|
2817
|
-
|
2818
|
-
|
2819
|
-
|
2820
|
-
|
2821
|
-
|
2822
|
-
|
2823
|
-
|
2824
|
-
|
2872
|
+
} else if (content) {
|
2873
|
+
return content();
|
2874
|
+
}
|
2875
|
+
});
|
2876
|
+
if (resume) {
|
2877
|
+
chunk.writeHTML(
|
2878
|
+
chunk.boundary.state.mark(
|
2879
|
+
"]" /* BranchEnd */,
|
2880
|
+
scopeId + " " + accessor
|
2881
|
+
)
|
2882
|
+
);
|
2883
|
+
}
|
2825
2884
|
}
|
2826
|
-
const
|
2827
|
-
|
2828
|
-
|
2829
|
-
|
2830
|
-
|
2831
|
-
|
2885
|
+
const rendered = peekNextScopeId() !== branchId;
|
2886
|
+
if (rendered) {
|
2887
|
+
if (resume) {
|
2888
|
+
writeScope(scopeId, {
|
2889
|
+
["ConditionalScope:" /* ConditionalScope */ + accessor]: writeScope(branchId, {}),
|
2890
|
+
["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]: renderer?.___id || renderer
|
2891
|
+
});
|
2832
2892
|
}
|
2893
|
+
} else {
|
2894
|
+
nextScopeId();
|
2833
2895
|
}
|
2834
|
-
let result;
|
2835
|
-
resumeConditional(
|
2836
|
-
() => {
|
2837
|
-
result = renderer(...args);
|
2838
|
-
},
|
2839
|
-
scopeId,
|
2840
|
-
accessor
|
2841
|
-
);
|
2842
2896
|
return result;
|
2843
2897
|
};
|
2844
2898
|
function createContent(id, fn) {
|
@@ -2849,19 +2903,19 @@ function registerContent(id, fn, scopeId) {
|
|
2849
2903
|
return register2(createContent(id, fn), id, scopeId);
|
2850
2904
|
}
|
2851
2905
|
function patchDynamicTag(patch) {
|
2852
|
-
|
2853
|
-
scopeId,
|
2854
|
-
|
2855
|
-
|
2856
|
-
|
2857
|
-
|
2858
|
-
|
2859
|
-
|
2860
|
-
|
2861
|
-
|
2862
|
-
|
2863
|
-
|
2864
|
-
)
|
2906
|
+
dynamicTag = /* @__PURE__ */ ((originalDynamicTag) => (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
|
2907
|
+
const patched = patch(scopeId, accessor, tag);
|
2908
|
+
patched.___id = tag;
|
2909
|
+
return originalDynamicTag(
|
2910
|
+
scopeId,
|
2911
|
+
accessor,
|
2912
|
+
patched,
|
2913
|
+
input,
|
2914
|
+
content,
|
2915
|
+
inputIsArgs,
|
2916
|
+
resume
|
2917
|
+
);
|
2918
|
+
})(dynamicTag);
|
2865
2919
|
}
|
2866
2920
|
|
2867
2921
|
// src/html/compat.ts
|
@@ -2961,7 +3015,7 @@ var compat = {
|
|
2961
3015
|
};
|
2962
3016
|
|
2963
3017
|
// src/html/for.ts
|
2964
|
-
function
|
3018
|
+
function forOfBy2(by, item, index) {
|
2965
3019
|
if (by) {
|
2966
3020
|
if (typeof by === "string") {
|
2967
3021
|
return item[by];
|
@@ -2970,13 +3024,13 @@ function forOfBy(by, item, index) {
|
|
2970
3024
|
}
|
2971
3025
|
return index;
|
2972
3026
|
}
|
2973
|
-
function
|
3027
|
+
function forInBy2(by, name, value) {
|
2974
3028
|
if (by) {
|
2975
3029
|
return by(name, value);
|
2976
3030
|
}
|
2977
3031
|
return name;
|
2978
3032
|
}
|
2979
|
-
function
|
3033
|
+
function forToBy2(by, index) {
|
2980
3034
|
if (by) {
|
2981
3035
|
return by(index);
|
2982
3036
|
}
|
@@ -3222,9 +3276,7 @@ function NOOP2() {
|
|
3222
3276
|
controllable_textarea_value,
|
3223
3277
|
createContent,
|
3224
3278
|
createTemplate,
|
3225
|
-
|
3226
|
-
dynamicTagId,
|
3227
|
-
dynamicTagInput,
|
3279
|
+
dynamicTag,
|
3228
3280
|
ensureScopeWithId,
|
3229
3281
|
escapeScript,
|
3230
3282
|
escapeStyle,
|