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.mjs
CHANGED
@@ -195,16 +195,12 @@ runtime.x = (op, id, node, start, placeholderCallback) => {
|
|
195
195
|
placeholders[id] = {
|
196
196
|
i: 1,
|
197
197
|
c(end = runtime.l[id] || node) {
|
198
|
-
while (end.parentNode !== start.parentNode) {
|
199
|
-
end = end.parentNode;
|
200
|
-
}
|
201
|
-
|
202
198
|
for (
|
203
199
|
;
|
204
|
-
end
|
205
|
-
|
200
|
+
(nextSibling = end.previousSibling || start).remove(),
|
201
|
+
start != nextSibling;
|
206
202
|
);
|
207
|
-
replace(
|
203
|
+
replace(end, node);
|
208
204
|
},
|
209
205
|
};
|
210
206
|
}
|
@@ -226,7 +222,7 @@ runtime.x = (op, id, node, start, placeholderCallback) => {
|
|
226
222
|
}
|
227
223
|
};
|
228
224
|
})`
|
229
|
-
) : `(e=>{let i,t,r
|
225
|
+
) : `(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)))}})`;
|
230
226
|
|
231
227
|
// src/html/serializer.ts
|
232
228
|
var { hasOwnProperty } = {};
|
@@ -505,11 +501,7 @@ var Reference = class {
|
|
505
501
|
};
|
506
502
|
var DEBUG = /* @__PURE__ */ new WeakMap();
|
507
503
|
function setDebugInfo(obj, file, loc, vars) {
|
508
|
-
DEBUG.set(obj, {
|
509
|
-
file,
|
510
|
-
loc,
|
511
|
-
vars
|
512
|
-
});
|
504
|
+
DEBUG.set(obj, { file, loc, vars });
|
513
505
|
}
|
514
506
|
var Serializer = class {
|
515
507
|
#state = new State();
|
@@ -568,10 +560,7 @@ function register(id, val, scope) {
|
|
568
560
|
function getRegistered(val) {
|
569
561
|
const registered = REGISTRY.get(val);
|
570
562
|
if (registered) {
|
571
|
-
return {
|
572
|
-
id: registered.id,
|
573
|
-
scope: registered.scope
|
574
|
-
};
|
563
|
+
return { id: registered.id, scope: registered.scope };
|
575
564
|
}
|
576
565
|
}
|
577
566
|
function writeRoot(state, root) {
|
@@ -741,7 +730,7 @@ function writeRegistered(state, val, parent, accessor, { access, scope, getter }
|
|
741
730
|
return true;
|
742
731
|
}
|
743
732
|
if (scopeRef) {
|
744
|
-
if (isCircular(parent, scopeRef)) {
|
733
|
+
if (parent && (state.assigned.has(scopeRef) || isCircular(parent, scopeRef))) {
|
745
734
|
state.assigned.add(parent);
|
746
735
|
state.assigned.add(fnRef);
|
747
736
|
fnRef.init = access + "(" + ensureId(state, scopeRef) + ")";
|
@@ -1597,7 +1586,7 @@ function withContext(key, value, cb) {
|
|
1597
1586
|
ctx[kPendingContexts]++;
|
1598
1587
|
ctx[key] = value;
|
1599
1588
|
try {
|
1600
|
-
cb();
|
1589
|
+
return cb();
|
1601
1590
|
} finally {
|
1602
1591
|
ctx[kPendingContexts]--;
|
1603
1592
|
ctx[key] = prev;
|
@@ -1658,23 +1647,33 @@ function hoist(scopeId, id) {
|
|
1658
1647
|
function resumeClosestBranch(scopeId) {
|
1659
1648
|
const branchId = $chunk.context?.[branchIdKey];
|
1660
1649
|
if (branchId !== void 0 && branchId !== scopeId) {
|
1661
|
-
writeScope(scopeId, {
|
1662
|
-
["#ClosestBranchId" /* ClosestBranchId */]: branchId
|
1663
|
-
});
|
1650
|
+
writeScope(scopeId, { ["#ClosestBranchId" /* ClosestBranchId */]: branchId });
|
1664
1651
|
}
|
1665
1652
|
}
|
1666
1653
|
var branchIdKey = Symbol();
|
1667
|
-
function
|
1668
|
-
|
1654
|
+
function withBranchId(branchId, cb) {
|
1655
|
+
return withContext(branchIdKey, branchId, cb);
|
1656
|
+
}
|
1657
|
+
function resumeForOf(list, cb, by, scopeId, accessor) {
|
1658
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1659
|
+
forOf(list, (item, index) => {
|
1669
1660
|
const branchId = peekNextScopeId();
|
1670
1661
|
$chunk.writeHTML(
|
1671
1662
|
$chunk.boundary.state.mark(
|
1672
1663
|
"[" /* BranchStart */,
|
1673
|
-
branchId + (
|
1664
|
+
branchId + (index ? " " : "")
|
1674
1665
|
)
|
1675
1666
|
);
|
1676
|
-
|
1667
|
+
withBranchId(branchId, () => {
|
1668
|
+
cb(item, index);
|
1669
|
+
loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1670
|
+
});
|
1677
1671
|
});
|
1672
|
+
if (loopScopes.size) {
|
1673
|
+
writeScope(scopeId, {
|
1674
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1675
|
+
});
|
1676
|
+
}
|
1678
1677
|
$chunk.writeHTML(
|
1679
1678
|
$chunk.boundary.state.mark(
|
1680
1679
|
"]" /* BranchEnd */,
|
@@ -1682,13 +1681,22 @@ function resumeForOf(list, cb, scopeId, accessor) {
|
|
1682
1681
|
)
|
1683
1682
|
);
|
1684
1683
|
}
|
1685
|
-
function resumeSingleNodeForOf(list, cb, scopeId, accessor, onlyChildInParent) {
|
1684
|
+
function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, onlyChildInParent) {
|
1685
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1686
1686
|
let branchIds = "";
|
1687
1687
|
forOf(list, (item, index) => {
|
1688
1688
|
const branchId = peekNextScopeId();
|
1689
1689
|
branchIds = " " + branchId + branchIds;
|
1690
|
-
|
1690
|
+
withBranchId(branchId, () => {
|
1691
|
+
cb(item, index);
|
1692
|
+
loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1693
|
+
});
|
1691
1694
|
});
|
1695
|
+
if (loopScopes.size) {
|
1696
|
+
writeScope(scopeId, {
|
1697
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1698
|
+
});
|
1699
|
+
}
|
1692
1700
|
$chunk.writeHTML(
|
1693
1701
|
$chunk.boundary.state.mark(
|
1694
1702
|
onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
@@ -1696,7 +1704,17 @@ function resumeSingleNodeForOf(list, cb, scopeId, accessor, onlyChildInParent) {
|
|
1696
1704
|
)
|
1697
1705
|
);
|
1698
1706
|
}
|
1699
|
-
function
|
1707
|
+
function forOfBy(by, item, index) {
|
1708
|
+
if (by) {
|
1709
|
+
if (typeof by === "string") {
|
1710
|
+
return item[by];
|
1711
|
+
}
|
1712
|
+
return by(item, index);
|
1713
|
+
}
|
1714
|
+
return index;
|
1715
|
+
}
|
1716
|
+
function resumeForIn(obj, cb, by, scopeId, accessor) {
|
1717
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1700
1718
|
let sep = "";
|
1701
1719
|
forIn(obj, (key, value) => {
|
1702
1720
|
const branchId = peekNextScopeId();
|
@@ -1704,8 +1722,16 @@ function resumeForIn(obj, cb, scopeId, accessor) {
|
|
1704
1722
|
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
|
1705
1723
|
);
|
1706
1724
|
sep = " ";
|
1707
|
-
|
1725
|
+
withBranchId(branchId, () => {
|
1726
|
+
cb(key, value);
|
1727
|
+
loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
|
1728
|
+
});
|
1708
1729
|
});
|
1730
|
+
if (loopScopes.size) {
|
1731
|
+
writeScope(scopeId, {
|
1732
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1733
|
+
});
|
1734
|
+
}
|
1709
1735
|
$chunk.writeHTML(
|
1710
1736
|
$chunk.boundary.state.mark(
|
1711
1737
|
"]" /* BranchEnd */,
|
@@ -1713,13 +1739,22 @@ function resumeForIn(obj, cb, scopeId, accessor) {
|
|
1713
1739
|
)
|
1714
1740
|
);
|
1715
1741
|
}
|
1716
|
-
function resumeSingleNodeForIn(obj, cb, scopeId, accessor, onlyChild) {
|
1742
|
+
function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, onlyChild) {
|
1743
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1717
1744
|
let branchIds = "";
|
1718
1745
|
forIn(obj, (key, value) => {
|
1719
1746
|
const branchId = peekNextScopeId();
|
1720
1747
|
branchIds = " " + branchId + branchIds;
|
1721
|
-
|
1748
|
+
withBranchId(branchId, () => {
|
1749
|
+
cb(key, value);
|
1750
|
+
loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
|
1751
|
+
});
|
1722
1752
|
});
|
1753
|
+
if (loopScopes.size) {
|
1754
|
+
writeScope(scopeId, {
|
1755
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1756
|
+
});
|
1757
|
+
}
|
1723
1758
|
$chunk.writeHTML(
|
1724
1759
|
$chunk.boundary.state.mark(
|
1725
1760
|
onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
@@ -1727,7 +1762,14 @@ function resumeSingleNodeForIn(obj, cb, scopeId, accessor, onlyChild) {
|
|
1727
1762
|
)
|
1728
1763
|
);
|
1729
1764
|
}
|
1730
|
-
function
|
1765
|
+
function forInBy(by, name, value) {
|
1766
|
+
if (by) {
|
1767
|
+
return by(name, value);
|
1768
|
+
}
|
1769
|
+
return name;
|
1770
|
+
}
|
1771
|
+
function resumeForTo(to, from, step, cb, by, scopeId, accessor) {
|
1772
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1731
1773
|
let sep = "";
|
1732
1774
|
forTo(to, from, step, (index) => {
|
1733
1775
|
const branchId = peekNextScopeId();
|
@@ -1735,8 +1777,16 @@ function resumeForTo(to, from, step, cb, scopeId, accessor) {
|
|
1735
1777
|
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
|
1736
1778
|
);
|
1737
1779
|
sep = " ";
|
1738
|
-
|
1780
|
+
withBranchId(branchId, () => {
|
1781
|
+
cb(index);
|
1782
|
+
loopScopes.set(forToBy(by, index), writeScope(branchId, {}));
|
1783
|
+
});
|
1739
1784
|
});
|
1785
|
+
if (loopScopes.size) {
|
1786
|
+
writeScope(scopeId, {
|
1787
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1788
|
+
});
|
1789
|
+
}
|
1740
1790
|
$chunk.writeHTML(
|
1741
1791
|
$chunk.boundary.state.mark(
|
1742
1792
|
"]" /* BranchEnd */,
|
@@ -1744,13 +1794,22 @@ function resumeForTo(to, from, step, cb, scopeId, accessor) {
|
|
1744
1794
|
)
|
1745
1795
|
);
|
1746
1796
|
}
|
1747
|
-
function resumeSingleNodeForTo(to, from, step, cb, scopeId, accessor, onlyChild) {
|
1797
|
+
function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, onlyChild) {
|
1798
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1748
1799
|
let branchIds = "";
|
1749
1800
|
forTo(to, from, step, (index) => {
|
1750
1801
|
const branchId = peekNextScopeId();
|
1751
1802
|
branchIds = " " + branchId + branchIds;
|
1752
|
-
|
1803
|
+
withBranchId(branchId, () => {
|
1804
|
+
cb(index);
|
1805
|
+
loopScopes.set(forToBy(by, index), writeScope(branchId, {}));
|
1806
|
+
});
|
1753
1807
|
});
|
1808
|
+
if (loopScopes.size) {
|
1809
|
+
writeScope(scopeId, {
|
1810
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1811
|
+
});
|
1812
|
+
}
|
1754
1813
|
$chunk.writeHTML(
|
1755
1814
|
$chunk.boundary.state.mark(
|
1756
1815
|
onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
@@ -1758,40 +1817,57 @@ function resumeSingleNodeForTo(to, from, step, cb, scopeId, accessor, onlyChild)
|
|
1758
1817
|
)
|
1759
1818
|
);
|
1760
1819
|
}
|
1761
|
-
function
|
1820
|
+
function forToBy(by, index) {
|
1821
|
+
if (by) {
|
1822
|
+
return by(index);
|
1823
|
+
}
|
1824
|
+
return index;
|
1825
|
+
}
|
1826
|
+
function resumeConditional(cb, scopeId, accessor, dynamic) {
|
1762
1827
|
const branchId = peekNextScopeId();
|
1763
|
-
|
1764
|
-
$chunk.
|
1765
|
-
|
1766
|
-
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1828
|
+
if (dynamic) {
|
1829
|
+
$chunk.writeHTML(
|
1830
|
+
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
|
1831
|
+
);
|
1832
|
+
}
|
1833
|
+
const branchIndex = withBranchId(branchId, cb);
|
1834
|
+
if (branchIndex !== void 0) {
|
1835
|
+
writeScope(scopeId, {
|
1836
|
+
["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]: dynamic ? branchIndex : void 0,
|
1837
|
+
["ConditionalScope:" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
1838
|
+
});
|
1770
1839
|
} else {
|
1771
1840
|
nextScopeId();
|
1772
1841
|
}
|
1773
|
-
|
1774
|
-
$chunk.
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1842
|
+
if (dynamic) {
|
1843
|
+
$chunk.writeHTML(
|
1844
|
+
$chunk.boundary.state.mark(
|
1845
|
+
"]" /* BranchEnd */,
|
1846
|
+
scopeId + " " + accessor
|
1847
|
+
)
|
1848
|
+
);
|
1849
|
+
}
|
1779
1850
|
}
|
1780
|
-
function resumeSingleNodeConditional(cb, scopeId, accessor, onlyChild) {
|
1851
|
+
function resumeSingleNodeConditional(cb, scopeId, accessor, dynamic, onlyChild) {
|
1781
1852
|
const branchId = peekNextScopeId();
|
1782
|
-
|
1783
|
-
const rendered =
|
1853
|
+
const branchIndex = withBranchId(branchId, cb);
|
1854
|
+
const rendered = branchIndex !== void 0;
|
1784
1855
|
if (rendered) {
|
1785
|
-
writeScope(
|
1856
|
+
writeScope(scopeId, {
|
1857
|
+
["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]: dynamic ? branchIndex : void 0,
|
1858
|
+
["ConditionalScope:" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
1859
|
+
});
|
1786
1860
|
} else {
|
1787
1861
|
nextScopeId();
|
1788
1862
|
}
|
1789
|
-
|
1790
|
-
$chunk.
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1863
|
+
if (dynamic) {
|
1864
|
+
$chunk.writeHTML(
|
1865
|
+
$chunk.boundary.state.mark(
|
1866
|
+
onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1867
|
+
scopeId + " " + accessor + (rendered ? " " + branchId : "")
|
1868
|
+
)
|
1869
|
+
);
|
1870
|
+
}
|
1795
1871
|
}
|
1796
1872
|
var writeScope = (scopeId, partialScope) => {
|
1797
1873
|
const { state } = $chunk.boundary;
|
@@ -2257,8 +2333,8 @@ function prepareChunk(chunk) {
|
|
2257
2333
|
let cur = reorderedChunk;
|
2258
2334
|
reorderedChunk.reorderId = null;
|
2259
2335
|
for (; ; ) {
|
2260
|
-
const { next } = cur;
|
2261
2336
|
cur.flushPlaceholder();
|
2337
|
+
const { next } = cur;
|
2262
2338
|
cur.consumed = true;
|
2263
2339
|
reorderHTML += cur.html;
|
2264
2340
|
reorderEffects = concatEffects(reorderEffects, cur.effects);
|
@@ -2644,117 +2720,97 @@ var DEFAULT_RENDER_ID = "_";
|
|
2644
2720
|
|
2645
2721
|
// src/html/dynamic-tag.ts
|
2646
2722
|
var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/;
|
2647
|
-
|
2648
|
-
const
|
2649
|
-
|
2650
|
-
|
2651
|
-
|
2652
|
-
|
2653
|
-
nextScopeId();
|
2654
|
-
return;
|
2655
|
-
}
|
2656
|
-
if (!tag) {
|
2657
|
-
resumeConditional(content, scopeId, accessor);
|
2658
|
-
return;
|
2723
|
+
var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, resume) => {
|
2724
|
+
const renderer = normalizeDynamicRenderer(tag);
|
2725
|
+
if (true) {
|
2726
|
+
if (renderer && typeof renderer !== "function" && typeof renderer !== "string") {
|
2727
|
+
throw new Error(`Invalid renderer passed for dynamic tag: ${renderer}`);
|
2728
|
+
}
|
2659
2729
|
}
|
2660
|
-
|
2661
|
-
|
2662
|
-
|
2663
|
-
|
2664
|
-
|
2665
|
-
|
2666
|
-
|
2667
|
-
|
2668
|
-
|
2669
|
-
|
2670
|
-
|
2671
|
-
|
2672
|
-
|
2673
|
-
controllable_textarea_value(
|
2674
|
-
scopeId,
|
2675
|
-
accessor,
|
2676
|
-
input.value,
|
2677
|
-
input.valueChange
|
2678
|
-
)
|
2730
|
+
const chunk = getChunk();
|
2731
|
+
const branchId = peekNextScopeId();
|
2732
|
+
let result;
|
2733
|
+
if (typeof renderer === "string") {
|
2734
|
+
const input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
2735
|
+
nextScopeId();
|
2736
|
+
write(`<${renderer}${attrs(input, accessor, scopeId, renderer)}>`);
|
2737
|
+
if (!voidElementsReg.test(renderer)) {
|
2738
|
+
withBranchId(branchId, () => {
|
2739
|
+
if (renderer === "textarea") {
|
2740
|
+
if (content) {
|
2741
|
+
throw new Error(
|
2742
|
+
"A dynamic tag rendering a `<textarea>` cannot have `content` and must use the `value` attribute instead."
|
2679
2743
|
);
|
2680
|
-
} else if (content) {
|
2681
|
-
if (tag === "select" && ("value" in input || "valueChange" in input)) {
|
2682
|
-
controllable_select_value(
|
2683
|
-
scopeId,
|
2684
|
-
accessor,
|
2685
|
-
input.value,
|
2686
|
-
input.valueChange,
|
2687
|
-
content
|
2688
|
-
);
|
2689
|
-
} else {
|
2690
|
-
content();
|
2691
|
-
}
|
2692
2744
|
}
|
2693
|
-
write(
|
2745
|
+
write(
|
2746
|
+
controllable_textarea_value(
|
2747
|
+
scopeId,
|
2748
|
+
accessor,
|
2749
|
+
input.value,
|
2750
|
+
input.valueChange
|
2751
|
+
)
|
2752
|
+
);
|
2694
2753
|
} else if (content) {
|
2695
|
-
|
2754
|
+
if (renderer === "select" && ("value" in input || "valueChange" in input)) {
|
2755
|
+
controllable_select_value(
|
2756
|
+
scopeId,
|
2757
|
+
accessor,
|
2758
|
+
input.value,
|
2759
|
+
input.valueChange,
|
2760
|
+
content
|
2761
|
+
);
|
2762
|
+
} else {
|
2763
|
+
content();
|
2764
|
+
}
|
2696
2765
|
}
|
2697
|
-
}
|
2698
|
-
|
2699
|
-
|
2700
|
-
|
2701
|
-
|
2702
|
-
|
2703
|
-
|
2704
|
-
|
2705
|
-
|
2706
|
-
|
2707
|
-
|
2708
|
-
|
2766
|
+
});
|
2767
|
+
write(`</${renderer}>`);
|
2768
|
+
} else if (content) {
|
2769
|
+
throw new Error(`Body content is not supported for a "${renderer}" tag.`);
|
2770
|
+
}
|
2771
|
+
if (resume) {
|
2772
|
+
chunk.writeHTML(
|
2773
|
+
chunk.boundary.state.mark(
|
2774
|
+
"|" /* BranchSingleNode */,
|
2775
|
+
scopeId + " " + accessor + " " + branchId
|
2776
|
+
)
|
2777
|
+
);
|
2709
2778
|
}
|
2710
|
-
}
|
2711
|
-
|
2712
|
-
|
2713
|
-
|
2714
|
-
|
2715
|
-
}
|
2716
|
-
|
2717
|
-
|
2718
|
-
|
2719
|
-
|
2720
|
-
};
|
2721
|
-
var dynamicTagArgs = (scopeId, accessor, tag, args) => {
|
2722
|
-
if (!tag) {
|
2723
|
-
nextScopeId();
|
2724
|
-
return;
|
2725
|
-
}
|
2726
|
-
if (typeof tag === "string") {
|
2727
|
-
resumeSingleNodeConditional(
|
2728
|
-
() => {
|
2729
|
-
nextScopeId();
|
2730
|
-
write(
|
2731
|
-
`<${tag}${attrs(args[0], accessor, scopeId, tag)}>`
|
2779
|
+
} else {
|
2780
|
+
if (resume) {
|
2781
|
+
chunk.writeHTML(
|
2782
|
+
chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
|
2783
|
+
);
|
2784
|
+
}
|
2785
|
+
result = withBranchId(branchId, () => {
|
2786
|
+
if (renderer) {
|
2787
|
+
return inputIsArgs ? renderer(...inputOrArgs) : renderer(
|
2788
|
+
content ? { ...inputOrArgs, content } : inputOrArgs
|
2732
2789
|
);
|
2733
|
-
|
2734
|
-
|
2735
|
-
|
2736
|
-
|
2737
|
-
|
2738
|
-
|
2739
|
-
|
2740
|
-
|
2790
|
+
} else if (content) {
|
2791
|
+
return content();
|
2792
|
+
}
|
2793
|
+
});
|
2794
|
+
if (resume) {
|
2795
|
+
chunk.writeHTML(
|
2796
|
+
chunk.boundary.state.mark(
|
2797
|
+
"]" /* BranchEnd */,
|
2798
|
+
scopeId + " " + accessor
|
2799
|
+
)
|
2800
|
+
);
|
2801
|
+
}
|
2741
2802
|
}
|
2742
|
-
const
|
2743
|
-
|
2744
|
-
|
2745
|
-
|
2746
|
-
|
2747
|
-
|
2803
|
+
const rendered = peekNextScopeId() !== branchId;
|
2804
|
+
if (rendered) {
|
2805
|
+
if (resume) {
|
2806
|
+
writeScope(scopeId, {
|
2807
|
+
["ConditionalScope:" /* ConditionalScope */ + accessor]: writeScope(branchId, {}),
|
2808
|
+
["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]: renderer?.___id || renderer
|
2809
|
+
});
|
2748
2810
|
}
|
2811
|
+
} else {
|
2812
|
+
nextScopeId();
|
2749
2813
|
}
|
2750
|
-
let result;
|
2751
|
-
resumeConditional(
|
2752
|
-
() => {
|
2753
|
-
result = renderer(...args);
|
2754
|
-
},
|
2755
|
-
scopeId,
|
2756
|
-
accessor
|
2757
|
-
);
|
2758
2814
|
return result;
|
2759
2815
|
};
|
2760
2816
|
function createContent(id, fn) {
|
@@ -2765,19 +2821,19 @@ function registerContent(id, fn, scopeId) {
|
|
2765
2821
|
return register2(createContent(id, fn), id, scopeId);
|
2766
2822
|
}
|
2767
2823
|
function patchDynamicTag(patch) {
|
2768
|
-
|
2769
|
-
scopeId,
|
2770
|
-
|
2771
|
-
|
2772
|
-
|
2773
|
-
|
2774
|
-
|
2775
|
-
|
2776
|
-
|
2777
|
-
|
2778
|
-
|
2779
|
-
|
2780
|
-
)
|
2824
|
+
dynamicTag = /* @__PURE__ */ ((originalDynamicTag) => (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
|
2825
|
+
const patched = patch(scopeId, accessor, tag);
|
2826
|
+
patched.___id = tag;
|
2827
|
+
return originalDynamicTag(
|
2828
|
+
scopeId,
|
2829
|
+
accessor,
|
2830
|
+
patched,
|
2831
|
+
input,
|
2832
|
+
content,
|
2833
|
+
inputIsArgs,
|
2834
|
+
resume
|
2835
|
+
);
|
2836
|
+
})(dynamicTag);
|
2781
2837
|
}
|
2782
2838
|
|
2783
2839
|
// src/html/compat.ts
|
@@ -2877,7 +2933,7 @@ var compat = {
|
|
2877
2933
|
};
|
2878
2934
|
|
2879
2935
|
// src/html/for.ts
|
2880
|
-
function
|
2936
|
+
function forOfBy2(by, item, index) {
|
2881
2937
|
if (by) {
|
2882
2938
|
if (typeof by === "string") {
|
2883
2939
|
return item[by];
|
@@ -2886,13 +2942,13 @@ function forOfBy(by, item, index) {
|
|
2886
2942
|
}
|
2887
2943
|
return index;
|
2888
2944
|
}
|
2889
|
-
function
|
2945
|
+
function forInBy2(by, name, value) {
|
2890
2946
|
if (by) {
|
2891
2947
|
return by(name, value);
|
2892
2948
|
}
|
2893
2949
|
return name;
|
2894
2950
|
}
|
2895
|
-
function
|
2951
|
+
function forToBy2(by, index) {
|
2896
2952
|
if (by) {
|
2897
2953
|
return by(index);
|
2898
2954
|
}
|
@@ -3137,19 +3193,17 @@ export {
|
|
3137
3193
|
controllable_textarea_value,
|
3138
3194
|
createContent,
|
3139
3195
|
createTemplate,
|
3140
|
-
|
3141
|
-
dynamicTagId,
|
3142
|
-
dynamicTagInput,
|
3196
|
+
dynamicTag,
|
3143
3197
|
ensureScopeWithId,
|
3144
3198
|
escapeScript,
|
3145
3199
|
escapeStyle,
|
3146
3200
|
escapeXML,
|
3147
3201
|
forIn,
|
3148
|
-
forInBy,
|
3202
|
+
forInBy2 as forInBy,
|
3149
3203
|
forOf,
|
3150
|
-
forOfBy,
|
3204
|
+
forOfBy2 as forOfBy,
|
3151
3205
|
forTo,
|
3152
|
-
forToBy,
|
3206
|
+
forToBy2 as forToBy,
|
3153
3207
|
fork,
|
3154
3208
|
getScopeById,
|
3155
3209
|
hoist,
|
package/dist/dom.js
CHANGED
@@ -222,7 +222,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
222
222
|
visits.length = 0;
|
223
223
|
let branchEnd = (branchId, reference) => {
|
224
224
|
let branch = scopeLookup[branchId] ||= {}, endNode = reference;
|
225
|
-
for (; visitNodes.has(endNode = endNode.previousSibling); ) ;
|
225
|
+
for (; endNode.previousSibling !== branch.h && visitNodes.has(endNode = endNode.previousSibling); ) ;
|
226
226
|
return endNode === lastEndNode && (endNode = reference.parentNode.insertBefore(
|
227
227
|
new Text(),
|
228
228
|
reference
|
@@ -1112,15 +1112,11 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1112
1112
|
})
|
1113
1113
|
), tryWithPlaceholder && !--tryWithPlaceholder.q)) {
|
1114
1114
|
let placeholderBranch = tryWithPlaceholder.c;
|
1115
|
-
tryWithPlaceholder.c = void 0, placeholderBranch
|
1115
|
+
tryWithPlaceholder.c = void 0, placeholderBranch && (insertBranchBefore(
|
1116
1116
|
tryWithPlaceholder,
|
1117
1117
|
placeholderBranch.h.parentNode,
|
1118
1118
|
placeholderBranch.h
|
1119
|
-
), removeAndDestroyBranch(placeholderBranch))
|
1120
|
-
tryWithPlaceholder,
|
1121
|
-
referenceNode.parentNode,
|
1122
|
-
referenceNode
|
1123
|
-
), tryWithPlaceholder.H && runEffects(tryWithPlaceholder.H, !0);
|
1119
|
+
), removeAndDestroyBranch(placeholderBranch)), tryWithPlaceholder.H && runEffects(tryWithPlaceholder.H, !0);
|
1124
1120
|
}
|
1125
1121
|
}).catch((error) => {
|
1126
1122
|
renderCatch(scope, error, !0);
|