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.
@@ -125,6 +125,29 @@ function forTo(to, from, step, cb) {
125
125
  }
126
126
  }
127
127
 
128
+ // src/html/for.ts
129
+ function forOfBy(by, item, index) {
130
+ if (by) {
131
+ if (typeof by === "string") {
132
+ return item[by];
133
+ }
134
+ return by(item, index);
135
+ }
136
+ return index;
137
+ }
138
+ function forInBy(by, name, value) {
139
+ if (by) {
140
+ return by(name, value);
141
+ }
142
+ return name;
143
+ }
144
+ function forToBy(by, index) {
145
+ if (by) {
146
+ return by(index);
147
+ }
148
+ return index;
149
+ }
150
+
128
151
  // src/html/inlined-runtimes.ts
129
152
  var WALKER_RUNTIME_CODE = true ? (
130
153
  /* js */
@@ -1686,213 +1709,232 @@ var branchIdKey = Symbol();
1686
1709
  function withBranchId(branchId, cb) {
1687
1710
  return withContext(branchIdKey, branchId, cb);
1688
1711
  }
1689
- function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch) {
1690
- if (serializeBranch === 0) {
1691
- return forOf(list, cb);
1712
+ function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
1713
+ const resumeBranch = serializeBranch !== 0;
1714
+ const resumeMarker = serializeMarker !== 0;
1715
+ if (resumeBranch) {
1716
+ const loopScopes = /* @__PURE__ */ new Map();
1717
+ forOf(list, (item, index) => {
1718
+ const branchId = peekNextScopeId();
1719
+ if (resumeMarker) {
1720
+ $chunk.writeHTML(
1721
+ $chunk.boundary.state.mark(
1722
+ "[" /* BranchStart */,
1723
+ branchId + (index ? " " : "")
1724
+ )
1725
+ );
1726
+ }
1727
+ withBranchId(branchId, () => {
1728
+ cb(item, index);
1729
+ loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
1730
+ });
1731
+ });
1732
+ if (loopScopes.size) {
1733
+ writeScope(scopeId, {
1734
+ ["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
1735
+ });
1736
+ }
1737
+ } else {
1738
+ forOf(list, cb);
1692
1739
  }
1693
- const loopScopes = /* @__PURE__ */ new Map();
1694
- forOf(list, (item, index) => {
1695
- const branchId = peekNextScopeId();
1740
+ if (resumeMarker) {
1696
1741
  $chunk.writeHTML(
1697
1742
  $chunk.boundary.state.mark(
1698
- "[" /* BranchStart */,
1699
- branchId + (index ? " " : "")
1743
+ "]" /* BranchEnd */,
1744
+ scopeId + " " + accessor
1700
1745
  )
1701
1746
  );
1702
- withBranchId(branchId, () => {
1703
- cb(item, index);
1704
- loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
1705
- });
1706
- });
1707
- if (loopScopes.size) {
1708
- writeScope(scopeId, {
1709
- ["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
1710
- });
1711
1747
  }
1712
- $chunk.writeHTML(
1713
- $chunk.boundary.state.mark(
1714
- "]" /* BranchEnd */,
1715
- scopeId + " " + accessor
1716
- )
1717
- );
1718
1748
  }
1719
- function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, onlyChildInParent) {
1720
- if (serializeBranch === 0) {
1721
- return forOf(list, cb);
1722
- }
1723
- const loopScopes = /* @__PURE__ */ new Map();
1749
+ function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1750
+ const resumeBranch = serializeBranch !== 0;
1751
+ const resumeMarker = serializeMarker !== 0;
1724
1752
  let branchIds = "";
1725
- forOf(list, (item, index) => {
1726
- const branchId = peekNextScopeId();
1727
- branchIds = " " + branchId + branchIds;
1728
- withBranchId(branchId, () => {
1729
- cb(item, index);
1730
- loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
1731
- });
1732
- });
1733
- if (loopScopes.size) {
1734
- writeScope(scopeId, {
1735
- ["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
1753
+ if (resumeBranch) {
1754
+ const loopScopes = /* @__PURE__ */ new Map();
1755
+ forOf(list, (item, index) => {
1756
+ const branchId = peekNextScopeId();
1757
+ if (resumeMarker) {
1758
+ branchIds = " " + branchId + branchIds;
1759
+ }
1760
+ withBranchId(branchId, () => {
1761
+ cb(item, index);
1762
+ loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
1763
+ });
1736
1764
  });
1737
- }
1738
- $chunk.writeHTML(
1739
- $chunk.boundary.state.mark(
1740
- onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1741
- scopeId + " " + accessor + branchIds
1742
- )
1743
- );
1744
- }
1745
- function forOfBy(by, item, index) {
1746
- if (by) {
1747
- if (typeof by === "string") {
1748
- return item[by];
1765
+ if (loopScopes.size) {
1766
+ writeScope(scopeId, {
1767
+ ["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
1768
+ });
1749
1769
  }
1750
- return by(item, index);
1770
+ } else {
1771
+ forOf(list, cb);
1772
+ }
1773
+ if (resumeMarker) {
1774
+ $chunk.writeHTML(
1775
+ $chunk.boundary.state.mark(
1776
+ onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1777
+ scopeId + " " + accessor + branchIds
1778
+ )
1779
+ );
1751
1780
  }
1752
- return index;
1753
1781
  }
1754
- function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch) {
1755
- if (serializeBranch === 0) {
1756
- return forIn(obj, cb);
1782
+ function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
1783
+ const resumeBranch = serializeBranch !== 0;
1784
+ const resumeMarker = serializeMarker !== 0;
1785
+ if (resumeBranch) {
1786
+ const loopScopes = /* @__PURE__ */ new Map();
1787
+ let sep = "";
1788
+ forIn(obj, (key, value) => {
1789
+ const branchId = peekNextScopeId();
1790
+ if (resumeMarker) {
1791
+ $chunk.writeHTML(
1792
+ $chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
1793
+ );
1794
+ sep = " ";
1795
+ }
1796
+ withBranchId(branchId, () => {
1797
+ cb(key, value);
1798
+ loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
1799
+ });
1800
+ });
1801
+ if (loopScopes.size) {
1802
+ writeScope(scopeId, {
1803
+ ["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
1804
+ });
1805
+ }
1806
+ } else {
1807
+ forIn(obj, cb);
1757
1808
  }
1758
- const loopScopes = /* @__PURE__ */ new Map();
1759
- let sep = "";
1760
- forIn(obj, (key, value) => {
1761
- const branchId = peekNextScopeId();
1809
+ if (resumeMarker) {
1762
1810
  $chunk.writeHTML(
1763
- $chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
1811
+ $chunk.boundary.state.mark(
1812
+ "]" /* BranchEnd */,
1813
+ scopeId + " " + accessor
1814
+ )
1764
1815
  );
1765
- sep = " ";
1766
- withBranchId(branchId, () => {
1767
- cb(key, value);
1768
- loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
1769
- });
1770
- });
1771
- if (loopScopes.size) {
1772
- writeScope(scopeId, {
1773
- ["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
1774
- });
1775
1816
  }
1776
- $chunk.writeHTML(
1777
- $chunk.boundary.state.mark(
1778
- "]" /* BranchEnd */,
1779
- scopeId + " " + accessor
1780
- )
1781
- );
1782
1817
  }
1783
- function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch, onlyChild) {
1784
- if (serializeBranch === 0) {
1785
- return forIn(obj, cb);
1786
- }
1787
- const loopScopes = /* @__PURE__ */ new Map();
1818
+ function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1819
+ const resumeBranch = serializeBranch !== 0;
1820
+ const resumeMarker = serializeMarker !== 0;
1788
1821
  let branchIds = "";
1789
- forIn(obj, (key, value) => {
1790
- const branchId = peekNextScopeId();
1791
- branchIds = " " + branchId + branchIds;
1792
- withBranchId(branchId, () => {
1793
- cb(key, value);
1794
- loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
1795
- });
1796
- });
1797
- if (loopScopes.size) {
1798
- writeScope(scopeId, {
1799
- ["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
1822
+ if (resumeBranch) {
1823
+ const loopScopes = /* @__PURE__ */ new Map();
1824
+ forIn(obj, (key, value) => {
1825
+ const branchId = peekNextScopeId();
1826
+ if (resumeMarker) {
1827
+ branchIds = " " + branchId + branchIds;
1828
+ }
1829
+ withBranchId(branchId, () => {
1830
+ cb(key, value);
1831
+ loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
1832
+ });
1800
1833
  });
1834
+ if (loopScopes.size) {
1835
+ writeScope(scopeId, {
1836
+ ["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
1837
+ });
1838
+ }
1839
+ } else {
1840
+ forIn(obj, cb);
1801
1841
  }
1802
- $chunk.writeHTML(
1803
- $chunk.boundary.state.mark(
1804
- onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1805
- scopeId + " " + accessor + branchIds
1806
- )
1807
- );
1808
- }
1809
- function forInBy(by, name, value) {
1810
- if (by) {
1811
- return by(name, value);
1842
+ if (resumeMarker) {
1843
+ $chunk.writeHTML(
1844
+ $chunk.boundary.state.mark(
1845
+ onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1846
+ scopeId + " " + accessor + branchIds
1847
+ )
1848
+ );
1812
1849
  }
1813
- return name;
1814
1850
  }
1815
- function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch) {
1816
- if (serializeBranch === 0) {
1817
- return forTo(to, from, step, cb);
1851
+ function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
1852
+ const resumeBranch = serializeBranch !== 0;
1853
+ const resumeMarker = serializeMarker !== 0;
1854
+ if (resumeBranch) {
1855
+ const loopScopes = /* @__PURE__ */ new Map();
1856
+ let sep = "";
1857
+ forTo(to, from, step, (i) => {
1858
+ const branchId = peekNextScopeId();
1859
+ if (resumeMarker) {
1860
+ $chunk.writeHTML(
1861
+ $chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
1862
+ );
1863
+ sep = " ";
1864
+ }
1865
+ withBranchId(branchId, () => {
1866
+ cb(i);
1867
+ loopScopes.set(forToBy(by, i), writeScope(branchId, {}));
1868
+ });
1869
+ });
1870
+ if (loopScopes.size) {
1871
+ writeScope(scopeId, {
1872
+ ["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
1873
+ });
1874
+ }
1875
+ } else {
1876
+ forTo(to, from, step, cb);
1818
1877
  }
1819
- const loopScopes = /* @__PURE__ */ new Map();
1820
- let sep = "";
1821
- forTo(to, from, step, (index) => {
1822
- const branchId = peekNextScopeId();
1878
+ if (resumeMarker) {
1823
1879
  $chunk.writeHTML(
1824
- $chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
1880
+ $chunk.boundary.state.mark(
1881
+ "]" /* BranchEnd */,
1882
+ scopeId + " " + accessor
1883
+ )
1825
1884
  );
1826
- sep = " ";
1827
- withBranchId(branchId, () => {
1828
- cb(index);
1829
- loopScopes.set(forToBy(by, index), writeScope(branchId, {}));
1830
- });
1831
- });
1832
- if (loopScopes.size) {
1833
- writeScope(scopeId, {
1834
- ["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
1835
- });
1836
1885
  }
1837
- $chunk.writeHTML(
1838
- $chunk.boundary.state.mark(
1839
- "]" /* BranchEnd */,
1840
- scopeId + " " + accessor
1841
- )
1842
- );
1843
1886
  }
1844
- function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, onlyChild) {
1845
- if (serializeBranch === 0) {
1846
- return forTo(to, from, step, cb);
1847
- }
1848
- const loopScopes = /* @__PURE__ */ new Map();
1887
+ function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1888
+ const resumeBranch = serializeBranch !== 0;
1889
+ const resumeMarker = serializeMarker !== 0;
1849
1890
  let branchIds = "";
1850
- forTo(to, from, step, (index) => {
1851
- const branchId = peekNextScopeId();
1852
- branchIds = " " + branchId + branchIds;
1853
- withBranchId(branchId, () => {
1854
- cb(index);
1855
- loopScopes.set(forToBy(by, index), writeScope(branchId, {}));
1856
- });
1857
- });
1858
- if (loopScopes.size) {
1859
- writeScope(scopeId, {
1860
- ["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
1891
+ if (resumeBranch) {
1892
+ const loopScopes = /* @__PURE__ */ new Map();
1893
+ forTo(to, from, step, (i) => {
1894
+ const branchId = peekNextScopeId();
1895
+ if (resumeMarker) {
1896
+ branchIds = " " + branchId + branchIds;
1897
+ }
1898
+ withBranchId(branchId, () => {
1899
+ cb(i);
1900
+ loopScopes.set(forToBy(by, i), writeScope(branchId, {}));
1901
+ });
1861
1902
  });
1903
+ if (loopScopes.size) {
1904
+ writeScope(scopeId, {
1905
+ ["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
1906
+ });
1907
+ }
1908
+ } else {
1909
+ forTo(to, from, step, cb);
1862
1910
  }
1863
- $chunk.writeHTML(
1864
- $chunk.boundary.state.mark(
1865
- onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1866
- scopeId + " " + accessor + branchIds
1867
- )
1868
- );
1869
- }
1870
- function forToBy(by, index) {
1871
- if (by) {
1872
- return by(index);
1911
+ if (resumeMarker) {
1912
+ $chunk.writeHTML(
1913
+ $chunk.boundary.state.mark(
1914
+ onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1915
+ scopeId + " " + accessor + branchIds
1916
+ )
1917
+ );
1873
1918
  }
1874
- return index;
1875
1919
  }
1876
1920
  function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker) {
1877
- if (serializeBranch === 0) {
1878
- return cb();
1879
- }
1921
+ const resumeBranch = serializeBranch !== 0;
1922
+ const resumeMarker = serializeMarker !== 0;
1880
1923
  const branchId = peekNextScopeId();
1881
- if (serializeMarker) {
1924
+ if (resumeMarker && resumeBranch) {
1882
1925
  $chunk.writeHTML(
1883
1926
  $chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
1884
1927
  );
1885
1928
  }
1886
- const branchIndex = withBranchId(branchId, cb);
1887
- if (branchIndex !== void 0) {
1929
+ const branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb();
1930
+ const rendered = branchIndex !== void 0;
1931
+ if (resumeBranch && rendered) {
1888
1932
  writeScope(scopeId, {
1889
- ["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]: serializeMarker ? branchIndex : void 0,
1933
+ ["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
1890
1934
  ["ConditionalScope:" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
1891
1935
  });
1892
- } else {
1893
- nextScopeId();
1894
1936
  }
1895
- if (serializeMarker) {
1937
+ if (resumeMarker) {
1896
1938
  $chunk.writeHTML(
1897
1939
  $chunk.boundary.state.mark(
1898
1940
  "]" /* BranchEnd */,
@@ -1901,26 +1943,23 @@ function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMark
1901
1943
  );
1902
1944
  }
1903
1945
  }
1904
- function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, onlyChild) {
1905
- if (serializeBranch === 0) {
1906
- return cb();
1907
- }
1946
+ function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1947
+ const resumeBranch = serializeBranch !== 0;
1948
+ const resumeMarker = serializeMarker !== 0;
1908
1949
  const branchId = peekNextScopeId();
1909
- const branchIndex = withBranchId(branchId, cb);
1910
- const rendered = branchIndex !== void 0;
1911
- if (rendered) {
1950
+ const branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb();
1951
+ const shouldWriteBranch = resumeBranch && branchIndex !== void 0;
1952
+ if (shouldWriteBranch) {
1912
1953
  writeScope(scopeId, {
1913
- ["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]: serializeMarker ? branchIndex : void 0,
1954
+ ["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
1914
1955
  ["ConditionalScope:" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
1915
1956
  });
1916
- } else {
1917
- nextScopeId();
1918
1957
  }
1919
- if (serializeMarker) {
1958
+ if (resumeMarker) {
1920
1959
  $chunk.writeHTML(
1921
1960
  $chunk.boundary.state.mark(
1922
- onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1923
- scopeId + " " + accessor + (rendered ? " " + branchId : "")
1961
+ onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1962
+ scopeId + " " + accessor + (shouldWriteBranch ? " " + branchId : "")
1924
1963
  )
1925
1964
  );
1926
1965
  }
@@ -2112,7 +2151,7 @@ function tryCatch(content, catchContent) {
2112
2151
  cur.async = false;
2113
2152
  cur.next = bodyNext;
2114
2153
  cur.html = endMarker;
2115
- cur.scripts = cur.effects = "";
2154
+ cur.scripts = cur.effects = cur.lastEffect = "";
2116
2155
  cur.placeholderBody = cur.placeholderRender = cur.reorderId = null;
2117
2156
  }
2118
2157
  cur = next;
@@ -2243,6 +2282,7 @@ var Chunk = class {
2243
2282
  html = "";
2244
2283
  scripts = "";
2245
2284
  effects = "";
2285
+ lastEffect = "";
2246
2286
  async = false;
2247
2287
  consumed = false;
2248
2288
  reorderId = null;
@@ -2252,10 +2292,15 @@ var Chunk = class {
2252
2292
  this.html += html;
2253
2293
  }
2254
2294
  writeEffect(scopeId, registryId) {
2255
- this.effects = concatEffects(
2256
- this.effects,
2257
- scopeId + ',"' + registryId + '"'
2258
- );
2295
+ if (this.lastEffect === registryId) {
2296
+ this.effects += "," + scopeId;
2297
+ } else {
2298
+ this.effects = concatEffects(
2299
+ this.effects,
2300
+ '"' + registryId + '",' + scopeId
2301
+ );
2302
+ }
2303
+ this.lastEffect = registryId;
2259
2304
  }
2260
2305
  writeScript(script) {
2261
2306
  this.scripts = concatScripts(this.scripts, script);
@@ -2264,6 +2309,7 @@ var Chunk = class {
2264
2309
  this.html += chunk.html;
2265
2310
  this.effects = concatEffects(this.effects, chunk.effects);
2266
2311
  this.scripts = concatScripts(this.scripts, chunk.scripts);
2312
+ this.lastEffect = chunk.lastEffect || this.lastEffect;
2267
2313
  }
2268
2314
  flushPlaceholder() {
2269
2315
  if (this.placeholderBody) {
@@ -2293,17 +2339,20 @@ var Chunk = class {
2293
2339
  let html = "";
2294
2340
  let effects = "";
2295
2341
  let scripts = "";
2342
+ let lastEffect = "";
2296
2343
  do {
2297
2344
  cur.flushPlaceholder();
2298
2345
  html += cur.html;
2299
2346
  effects = concatEffects(effects, cur.effects);
2300
2347
  scripts = concatScripts(scripts, cur.scripts);
2348
+ lastEffect = cur.lastEffect || lastEffect;
2301
2349
  cur.consumed = true;
2302
2350
  cur = cur.next;
2303
2351
  } while (cur.next && !cur.async);
2304
2352
  cur.html = html + cur.html;
2305
2353
  cur.effects = concatEffects(effects, cur.effects);
2306
2354
  cur.scripts = concatScripts(scripts, cur.scripts);
2355
+ cur.lastEffect = lastEffect;
2307
2356
  }
2308
2357
  return cur;
2309
2358
  }
@@ -2382,7 +2431,7 @@ var Chunk = class {
2382
2431
  "#" /* ReorderMarker */,
2383
2432
  cur.reorderId = state.nextReorderId()
2384
2433
  );
2385
- cur.html = cur.effects = cur.scripts = "";
2434
+ cur.html = cur.effects = cur.scripts = cur.lastEffect = "";
2386
2435
  cur.next = null;
2387
2436
  }
2388
2437
  if (next) {
@@ -3013,7 +3062,8 @@ function NOOP2() {
3013
3062
 
3014
3063
  // src/html/dynamic-tag.ts
3015
3064
  var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/;
3016
- var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, shouldResume) => {
3065
+ var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
3066
+ const shouldResume = serializeReason !== 0;
3017
3067
  const renderer = normalizeDynamicRenderer(tag);
3018
3068
  if (true) {
3019
3069
  if (renderer && typeof renderer !== "function" && typeof renderer !== "string") {
@@ -3084,7 +3134,7 @@ var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, sho
3084
3134
  const input = inputIsArgs ? inputOrArgs[0] : inputOrArgs;
3085
3135
  return renderer(
3086
3136
  content ? { ...input, content } : input,
3087
- shouldResume
3137
+ shouldResume ? 1 : 0
3088
3138
  );
3089
3139
  }
3090
3140
  return inputIsArgs ? renderer(...inputOrArgs) : renderer(
@@ -3228,29 +3278,6 @@ var compat = {
3228
3278
  register(RENDER_BODY_ID, fn);
3229
3279
  }
3230
3280
  };
3231
-
3232
- // src/html/for.ts
3233
- function forOfBy2(by, item, index) {
3234
- if (by) {
3235
- if (typeof by === "string") {
3236
- return item[by];
3237
- }
3238
- return by(item, index);
3239
- }
3240
- return index;
3241
- }
3242
- function forInBy2(by, name, value) {
3243
- if (by) {
3244
- return by(name, value);
3245
- }
3246
- return name;
3247
- }
3248
- function forToBy2(by, index) {
3249
- if (by) {
3250
- return by(index);
3251
- }
3252
- return index;
3253
- }
3254
3281
  export {
3255
3282
  $global,
3256
3283
  attr,
@@ -3274,11 +3301,11 @@ export {
3274
3301
  escapeStyle,
3275
3302
  escapeXML,
3276
3303
  forIn,
3277
- forInBy2 as forInBy,
3304
+ forInBy,
3278
3305
  forOf,
3279
- forOfBy2 as forOfBy,
3306
+ forOfBy,
3280
3307
  forTo,
3281
- forToBy2 as forToBy,
3308
+ forToBy,
3282
3309
  fork,
3283
3310
  getScopeById,
3284
3311
  hoist,
package/dist/dom.js CHANGED
@@ -213,7 +213,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
213
213
  value: resumeRender = (renderId) => {
214
214
  let render = resumeRender[renderId] = renders2[renderId] || renders2(renderId), walk2 = render.w, commentPrefixLen = render.i.length, branchStack = [], scopeLookup = render.s = {}, serializeContext = {
215
215
  _: registeredValues
216
- }, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map(), currentBranchId, $global, lastScopeId = 0;
216
+ }, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map(), lastEffect, currentBranchId, $global, lastScopeId = 0;
217
217
  return render.w = () => {
218
218
  walk2.call(render);
219
219
  let visits = render.v, resumes = render.r;
@@ -287,7 +287,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
287
287
  }
288
288
  }
289
289
  else
290
- registeredValues[resumes[++i]](
290
+ typeof serialized == "string" && (lastEffect = serialized, serialized = resumes[++i]), registeredValues[lastEffect](
291
291
  scopeLookup[serialized],
292
292
  scopeLookup[serialized]
293
293
  );
package/dist/dom.mjs CHANGED
@@ -128,7 +128,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
128
128
  value: resumeRender = (renderId) => {
129
129
  let render = resumeRender[renderId] = renders2[renderId] || renders2(renderId), walk2 = render.w, commentPrefixLen = render.i.length, branchStack = [], scopeLookup = render.s = {}, serializeContext = {
130
130
  _: registeredValues
131
- }, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map(), currentBranchId, $global, lastScopeId = 0;
131
+ }, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map(), lastEffect, currentBranchId, $global, lastScopeId = 0;
132
132
  return render.w = () => {
133
133
  walk2.call(render);
134
134
  let visits = render.v, resumes = render.r;
@@ -202,7 +202,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
202
202
  }
203
203
  }
204
204
  else
205
- registeredValues[resumes[++i]](
205
+ typeof serialized == "string" && (lastEffect = serialized, serialized = resumes[++i]), registeredValues[lastEffect](
206
206
  scopeLookup[serialized],
207
207
  scopeLookup[serialized]
208
208
  );
@@ -4,7 +4,7 @@ interface BodyContentObject {
4
4
  [x: PropertyKey]: unknown;
5
5
  content: ServerRenderer;
6
6
  }
7
- export declare let dynamicTag: (scopeId: number, accessor: Accessor, tag: unknown | string | ServerRenderer | BodyContentObject, inputOrArgs: unknown, content?: (() => void) | 0, inputIsArgs?: 1, shouldResume?: 1 | 0) => unknown;
7
+ export declare let dynamicTag: (scopeId: number, accessor: Accessor, tag: unknown | string | ServerRenderer | BodyContentObject, inputOrArgs: unknown, content?: (() => void) | 0, inputIsArgs?: 1, serializeReason?: 1 | 0) => unknown;
8
8
  export declare function createContent(id: string, fn: ServerRenderer): ServerRenderer;
9
9
  export declare function registerContent(id: string, fn: ServerRenderer, scopeId?: number): ServerRenderer;
10
10
  export declare function patchDynamicTag(patch: (scopeId: number, accessor: Accessor, tag: unknown | string | ServerRenderer | BodyContentObject) => unknown): void;