marko 6.0.0-next.3.68 → 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 -1
- package/dist/debug/dom.mjs +1 -1
- package/dist/debug/html.js +234 -178
- package/dist/debug/html.mjs +233 -175
- package/dist/dom.js +1 -1
- package/dist/dom.mjs +1 -1
- 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 +134 -129
- package/dist/html.mjs +133 -126
- package/dist/translator/index.js +49 -211
- package/package.json +1 -1
package/dist/debug/dom.js
CHANGED
@@ -290,7 +290,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
290
290
|
const branchEnd = (branchId, reference) => {
|
291
291
|
const branch = scopeLookup[branchId] ||= {};
|
292
292
|
let endNode = reference;
|
293
|
-
while (visitNodes.has(endNode = endNode.previousSibling)) ;
|
293
|
+
while (endNode.previousSibling !== branch.___startNode && visitNodes.has(endNode = endNode.previousSibling)) ;
|
294
294
|
if (endNode === lastEndNode) {
|
295
295
|
endNode = reference.parentNode.insertBefore(
|
296
296
|
new Text(),
|
package/dist/debug/dom.mjs
CHANGED
@@ -202,7 +202,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
202
202
|
const branchEnd = (branchId, reference) => {
|
203
203
|
const branch = scopeLookup[branchId] ||= {};
|
204
204
|
let endNode = reference;
|
205
|
-
while (visitNodes.has(endNode = endNode.previousSibling)) ;
|
205
|
+
while (endNode.previousSibling !== branch.___startNode && visitNodes.has(endNode = endNode.previousSibling)) ;
|
206
206
|
if (endNode === lastEndNode) {
|
207
207
|
endNode = reference.parentNode.insertBefore(
|
208
208
|
new Text(),
|
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,
|
@@ -585,11 +583,7 @@ var Reference = class {
|
|
585
583
|
};
|
586
584
|
var DEBUG = /* @__PURE__ */ new WeakMap();
|
587
585
|
function setDebugInfo(obj, file, loc, vars) {
|
588
|
-
DEBUG.set(obj, {
|
589
|
-
file,
|
590
|
-
loc,
|
591
|
-
vars
|
592
|
-
});
|
586
|
+
DEBUG.set(obj, { file, loc, vars });
|
593
587
|
}
|
594
588
|
var Serializer = class {
|
595
589
|
#state = new State();
|
@@ -648,10 +642,7 @@ function register(id, val, scope) {
|
|
648
642
|
function getRegistered(val) {
|
649
643
|
const registered = REGISTRY.get(val);
|
650
644
|
if (registered) {
|
651
|
-
return {
|
652
|
-
id: registered.id,
|
653
|
-
scope: registered.scope
|
654
|
-
};
|
645
|
+
return { id: registered.id, scope: registered.scope };
|
655
646
|
}
|
656
647
|
}
|
657
648
|
function writeRoot(state, root) {
|
@@ -821,7 +812,7 @@ function writeRegistered(state, val, parent, accessor, { access, scope, getter }
|
|
821
812
|
return true;
|
822
813
|
}
|
823
814
|
if (scopeRef) {
|
824
|
-
if (isCircular(parent, scopeRef)) {
|
815
|
+
if (parent && (state.assigned.has(scopeRef) || isCircular(parent, scopeRef))) {
|
825
816
|
state.assigned.add(parent);
|
826
817
|
state.assigned.add(fnRef);
|
827
818
|
fnRef.init = access + "(" + ensureId(state, scopeRef) + ")";
|
@@ -1677,7 +1668,7 @@ function withContext(key, value, cb) {
|
|
1677
1668
|
ctx[kPendingContexts]++;
|
1678
1669
|
ctx[key] = value;
|
1679
1670
|
try {
|
1680
|
-
cb();
|
1671
|
+
return cb();
|
1681
1672
|
} finally {
|
1682
1673
|
ctx[kPendingContexts]--;
|
1683
1674
|
ctx[key] = prev;
|
@@ -1738,23 +1729,33 @@ function hoist(scopeId, id) {
|
|
1738
1729
|
function resumeClosestBranch(scopeId) {
|
1739
1730
|
const branchId = $chunk.context?.[branchIdKey];
|
1740
1731
|
if (branchId !== void 0 && branchId !== scopeId) {
|
1741
|
-
writeScope(scopeId, {
|
1742
|
-
["#ClosestBranchId" /* ClosestBranchId */]: branchId
|
1743
|
-
});
|
1732
|
+
writeScope(scopeId, { ["#ClosestBranchId" /* ClosestBranchId */]: branchId });
|
1744
1733
|
}
|
1745
1734
|
}
|
1746
1735
|
var branchIdKey = Symbol();
|
1747
|
-
function
|
1748
|
-
|
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) => {
|
1749
1742
|
const branchId = peekNextScopeId();
|
1750
1743
|
$chunk.writeHTML(
|
1751
1744
|
$chunk.boundary.state.mark(
|
1752
1745
|
"[" /* BranchStart */,
|
1753
|
-
branchId + (
|
1746
|
+
branchId + (index ? " " : "")
|
1754
1747
|
)
|
1755
1748
|
);
|
1756
|
-
|
1749
|
+
withBranchId(branchId, () => {
|
1750
|
+
cb(item, index);
|
1751
|
+
loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1752
|
+
});
|
1757
1753
|
});
|
1754
|
+
if (loopScopes.size) {
|
1755
|
+
writeScope(scopeId, {
|
1756
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1757
|
+
});
|
1758
|
+
}
|
1758
1759
|
$chunk.writeHTML(
|
1759
1760
|
$chunk.boundary.state.mark(
|
1760
1761
|
"]" /* BranchEnd */,
|
@@ -1762,13 +1763,22 @@ function resumeForOf(list, cb, scopeId, accessor) {
|
|
1762
1763
|
)
|
1763
1764
|
);
|
1764
1765
|
}
|
1765
|
-
function resumeSingleNodeForOf(list, cb, scopeId, accessor, onlyChildInParent) {
|
1766
|
+
function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, onlyChildInParent) {
|
1767
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1766
1768
|
let branchIds = "";
|
1767
1769
|
forOf(list, (item, index) => {
|
1768
1770
|
const branchId = peekNextScopeId();
|
1769
1771
|
branchIds = " " + branchId + branchIds;
|
1770
|
-
|
1772
|
+
withBranchId(branchId, () => {
|
1773
|
+
cb(item, index);
|
1774
|
+
loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1775
|
+
});
|
1771
1776
|
});
|
1777
|
+
if (loopScopes.size) {
|
1778
|
+
writeScope(scopeId, {
|
1779
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1780
|
+
});
|
1781
|
+
}
|
1772
1782
|
$chunk.writeHTML(
|
1773
1783
|
$chunk.boundary.state.mark(
|
1774
1784
|
onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
@@ -1776,7 +1786,17 @@ function resumeSingleNodeForOf(list, cb, scopeId, accessor, onlyChildInParent) {
|
|
1776
1786
|
)
|
1777
1787
|
);
|
1778
1788
|
}
|
1779
|
-
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();
|
1780
1800
|
let sep = "";
|
1781
1801
|
forIn(obj, (key, value) => {
|
1782
1802
|
const branchId = peekNextScopeId();
|
@@ -1784,8 +1804,16 @@ function resumeForIn(obj, cb, scopeId, accessor) {
|
|
1784
1804
|
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
|
1785
1805
|
);
|
1786
1806
|
sep = " ";
|
1787
|
-
|
1807
|
+
withBranchId(branchId, () => {
|
1808
|
+
cb(key, value);
|
1809
|
+
loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
|
1810
|
+
});
|
1788
1811
|
});
|
1812
|
+
if (loopScopes.size) {
|
1813
|
+
writeScope(scopeId, {
|
1814
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1815
|
+
});
|
1816
|
+
}
|
1789
1817
|
$chunk.writeHTML(
|
1790
1818
|
$chunk.boundary.state.mark(
|
1791
1819
|
"]" /* BranchEnd */,
|
@@ -1793,13 +1821,22 @@ function resumeForIn(obj, cb, scopeId, accessor) {
|
|
1793
1821
|
)
|
1794
1822
|
);
|
1795
1823
|
}
|
1796
|
-
function resumeSingleNodeForIn(obj, cb, scopeId, accessor, onlyChild) {
|
1824
|
+
function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, onlyChild) {
|
1825
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1797
1826
|
let branchIds = "";
|
1798
1827
|
forIn(obj, (key, value) => {
|
1799
1828
|
const branchId = peekNextScopeId();
|
1800
1829
|
branchIds = " " + branchId + branchIds;
|
1801
|
-
|
1830
|
+
withBranchId(branchId, () => {
|
1831
|
+
cb(key, value);
|
1832
|
+
loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
|
1833
|
+
});
|
1802
1834
|
});
|
1835
|
+
if (loopScopes.size) {
|
1836
|
+
writeScope(scopeId, {
|
1837
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1838
|
+
});
|
1839
|
+
}
|
1803
1840
|
$chunk.writeHTML(
|
1804
1841
|
$chunk.boundary.state.mark(
|
1805
1842
|
onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
@@ -1807,7 +1844,14 @@ function resumeSingleNodeForIn(obj, cb, scopeId, accessor, onlyChild) {
|
|
1807
1844
|
)
|
1808
1845
|
);
|
1809
1846
|
}
|
1810
|
-
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();
|
1811
1855
|
let sep = "";
|
1812
1856
|
forTo(to, from, step, (index) => {
|
1813
1857
|
const branchId = peekNextScopeId();
|
@@ -1815,8 +1859,16 @@ function resumeForTo(to, from, step, cb, scopeId, accessor) {
|
|
1815
1859
|
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
|
1816
1860
|
);
|
1817
1861
|
sep = " ";
|
1818
|
-
|
1862
|
+
withBranchId(branchId, () => {
|
1863
|
+
cb(index);
|
1864
|
+
loopScopes.set(forToBy(by, index), writeScope(branchId, {}));
|
1865
|
+
});
|
1819
1866
|
});
|
1867
|
+
if (loopScopes.size) {
|
1868
|
+
writeScope(scopeId, {
|
1869
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1870
|
+
});
|
1871
|
+
}
|
1820
1872
|
$chunk.writeHTML(
|
1821
1873
|
$chunk.boundary.state.mark(
|
1822
1874
|
"]" /* BranchEnd */,
|
@@ -1824,13 +1876,22 @@ function resumeForTo(to, from, step, cb, scopeId, accessor) {
|
|
1824
1876
|
)
|
1825
1877
|
);
|
1826
1878
|
}
|
1827
|
-
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();
|
1828
1881
|
let branchIds = "";
|
1829
1882
|
forTo(to, from, step, (index) => {
|
1830
1883
|
const branchId = peekNextScopeId();
|
1831
1884
|
branchIds = " " + branchId + branchIds;
|
1832
|
-
|
1885
|
+
withBranchId(branchId, () => {
|
1886
|
+
cb(index);
|
1887
|
+
loopScopes.set(forToBy(by, index), writeScope(branchId, {}));
|
1888
|
+
});
|
1833
1889
|
});
|
1890
|
+
if (loopScopes.size) {
|
1891
|
+
writeScope(scopeId, {
|
1892
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1893
|
+
});
|
1894
|
+
}
|
1834
1895
|
$chunk.writeHTML(
|
1835
1896
|
$chunk.boundary.state.mark(
|
1836
1897
|
onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
@@ -1838,40 +1899,57 @@ function resumeSingleNodeForTo(to, from, step, cb, scopeId, accessor, onlyChild)
|
|
1838
1899
|
)
|
1839
1900
|
);
|
1840
1901
|
}
|
1841
|
-
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) {
|
1842
1909
|
const branchId = peekNextScopeId();
|
1843
|
-
|
1844
|
-
$chunk.
|
1845
|
-
|
1846
|
-
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
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
|
+
});
|
1850
1921
|
} else {
|
1851
1922
|
nextScopeId();
|
1852
1923
|
}
|
1853
|
-
|
1854
|
-
$chunk.
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1924
|
+
if (dynamic) {
|
1925
|
+
$chunk.writeHTML(
|
1926
|
+
$chunk.boundary.state.mark(
|
1927
|
+
"]" /* BranchEnd */,
|
1928
|
+
scopeId + " " + accessor
|
1929
|
+
)
|
1930
|
+
);
|
1931
|
+
}
|
1859
1932
|
}
|
1860
|
-
function resumeSingleNodeConditional(cb, scopeId, accessor, onlyChild) {
|
1933
|
+
function resumeSingleNodeConditional(cb, scopeId, accessor, dynamic, onlyChild) {
|
1861
1934
|
const branchId = peekNextScopeId();
|
1862
|
-
|
1863
|
-
const rendered =
|
1935
|
+
const branchIndex = withBranchId(branchId, cb);
|
1936
|
+
const rendered = branchIndex !== void 0;
|
1864
1937
|
if (rendered) {
|
1865
|
-
writeScope(
|
1938
|
+
writeScope(scopeId, {
|
1939
|
+
["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]: dynamic ? branchIndex : void 0,
|
1940
|
+
["ConditionalScope:" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
1941
|
+
});
|
1866
1942
|
} else {
|
1867
1943
|
nextScopeId();
|
1868
1944
|
}
|
1869
|
-
|
1870
|
-
$chunk.
|
1871
|
-
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1945
|
+
if (dynamic) {
|
1946
|
+
$chunk.writeHTML(
|
1947
|
+
$chunk.boundary.state.mark(
|
1948
|
+
onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1949
|
+
scopeId + " " + accessor + (rendered ? " " + branchId : "")
|
1950
|
+
)
|
1951
|
+
);
|
1952
|
+
}
|
1875
1953
|
}
|
1876
1954
|
var writeScope = (scopeId, partialScope) => {
|
1877
1955
|
const { state } = $chunk.boundary;
|
@@ -2724,117 +2802,97 @@ var DEFAULT_RENDER_ID = "_";
|
|
2724
2802
|
|
2725
2803
|
// src/html/dynamic-tag.ts
|
2726
2804
|
var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/;
|
2727
|
-
|
2728
|
-
const
|
2729
|
-
|
2730
|
-
|
2731
|
-
|
2732
|
-
|
2733
|
-
nextScopeId();
|
2734
|
-
return;
|
2735
|
-
}
|
2736
|
-
if (!tag) {
|
2737
|
-
resumeConditional(content, scopeId, accessor);
|
2738
|
-
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
|
+
}
|
2739
2811
|
}
|
2740
|
-
|
2741
|
-
|
2742
|
-
|
2743
|
-
|
2744
|
-
|
2745
|
-
|
2746
|
-
|
2747
|
-
|
2748
|
-
|
2749
|
-
|
2750
|
-
|
2751
|
-
|
2752
|
-
|
2753
|
-
controllable_textarea_value(
|
2754
|
-
scopeId,
|
2755
|
-
accessor,
|
2756
|
-
input.value,
|
2757
|
-
input.valueChange
|
2758
|
-
)
|
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."
|
2759
2825
|
);
|
2760
|
-
} else if (content) {
|
2761
|
-
if (tag === "select" && ("value" in input || "valueChange" in input)) {
|
2762
|
-
controllable_select_value(
|
2763
|
-
scopeId,
|
2764
|
-
accessor,
|
2765
|
-
input.value,
|
2766
|
-
input.valueChange,
|
2767
|
-
content
|
2768
|
-
);
|
2769
|
-
} else {
|
2770
|
-
content();
|
2771
|
-
}
|
2772
2826
|
}
|
2773
|
-
write(
|
2827
|
+
write(
|
2828
|
+
controllable_textarea_value(
|
2829
|
+
scopeId,
|
2830
|
+
accessor,
|
2831
|
+
input.value,
|
2832
|
+
input.valueChange
|
2833
|
+
)
|
2834
|
+
);
|
2774
2835
|
} else if (content) {
|
2775
|
-
|
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
|
+
}
|
2776
2847
|
}
|
2777
|
-
}
|
2778
|
-
|
2779
|
-
|
2780
|
-
|
2781
|
-
|
2782
|
-
|
2783
|
-
|
2784
|
-
|
2785
|
-
|
2786
|
-
|
2787
|
-
|
2788
|
-
|
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
|
+
);
|
2789
2860
|
}
|
2790
|
-
}
|
2791
|
-
|
2792
|
-
|
2793
|
-
|
2794
|
-
|
2795
|
-
}
|
2796
|
-
|
2797
|
-
|
2798
|
-
|
2799
|
-
|
2800
|
-
};
|
2801
|
-
var dynamicTagArgs = (scopeId, accessor, tag, args) => {
|
2802
|
-
if (!tag) {
|
2803
|
-
nextScopeId();
|
2804
|
-
return;
|
2805
|
-
}
|
2806
|
-
if (typeof tag === "string") {
|
2807
|
-
resumeSingleNodeConditional(
|
2808
|
-
() => {
|
2809
|
-
nextScopeId();
|
2810
|
-
write(
|
2811
|
-
`<${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
|
2812
2871
|
);
|
2813
|
-
|
2814
|
-
|
2815
|
-
|
2816
|
-
|
2817
|
-
|
2818
|
-
|
2819
|
-
|
2820
|
-
|
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
|
+
}
|
2821
2884
|
}
|
2822
|
-
const
|
2823
|
-
|
2824
|
-
|
2825
|
-
|
2826
|
-
|
2827
|
-
|
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
|
+
});
|
2828
2892
|
}
|
2893
|
+
} else {
|
2894
|
+
nextScopeId();
|
2829
2895
|
}
|
2830
|
-
let result;
|
2831
|
-
resumeConditional(
|
2832
|
-
() => {
|
2833
|
-
result = renderer(...args);
|
2834
|
-
},
|
2835
|
-
scopeId,
|
2836
|
-
accessor
|
2837
|
-
);
|
2838
2896
|
return result;
|
2839
2897
|
};
|
2840
2898
|
function createContent(id, fn) {
|
@@ -2845,19 +2903,19 @@ function registerContent(id, fn, scopeId) {
|
|
2845
2903
|
return register2(createContent(id, fn), id, scopeId);
|
2846
2904
|
}
|
2847
2905
|
function patchDynamicTag(patch) {
|
2848
|
-
|
2849
|
-
scopeId,
|
2850
|
-
|
2851
|
-
|
2852
|
-
|
2853
|
-
|
2854
|
-
|
2855
|
-
|
2856
|
-
|
2857
|
-
|
2858
|
-
|
2859
|
-
|
2860
|
-
)
|
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);
|
2861
2919
|
}
|
2862
2920
|
|
2863
2921
|
// src/html/compat.ts
|
@@ -2957,7 +3015,7 @@ var compat = {
|
|
2957
3015
|
};
|
2958
3016
|
|
2959
3017
|
// src/html/for.ts
|
2960
|
-
function
|
3018
|
+
function forOfBy2(by, item, index) {
|
2961
3019
|
if (by) {
|
2962
3020
|
if (typeof by === "string") {
|
2963
3021
|
return item[by];
|
@@ -2966,13 +3024,13 @@ function forOfBy(by, item, index) {
|
|
2966
3024
|
}
|
2967
3025
|
return index;
|
2968
3026
|
}
|
2969
|
-
function
|
3027
|
+
function forInBy2(by, name, value) {
|
2970
3028
|
if (by) {
|
2971
3029
|
return by(name, value);
|
2972
3030
|
}
|
2973
3031
|
return name;
|
2974
3032
|
}
|
2975
|
-
function
|
3033
|
+
function forToBy2(by, index) {
|
2976
3034
|
if (by) {
|
2977
3035
|
return by(index);
|
2978
3036
|
}
|
@@ -3218,9 +3276,7 @@ function NOOP2() {
|
|
3218
3276
|
controllable_textarea_value,
|
3219
3277
|
createContent,
|
3220
3278
|
createTemplate,
|
3221
|
-
|
3222
|
-
dynamicTagId,
|
3223
|
-
dynamicTagInput,
|
3279
|
+
dynamicTag,
|
3224
3280
|
ensureScopeWithId,
|
3225
3281
|
escapeScript,
|
3226
3282
|
escapeStyle,
|