sibujs 3.3.2 → 3.4.0

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.
Files changed (77) hide show
  1. package/dist/browser.cjs +21 -4
  2. package/dist/browser.js +4 -4
  3. package/dist/build.cjs +3343 -3009
  4. package/dist/build.js +12 -11
  5. package/dist/cdn.global.js +7 -7
  6. package/dist/{chunk-AEOLHSSQ.js → chunk-3DVGCW7O.js} +72 -25
  7. package/dist/{chunk-6TCOWMGY.js → chunk-3Z2NGWQI.js} +1 -1
  8. package/dist/chunk-7ZHH77QA.js +9 -0
  9. package/dist/{chunk-2ARSB7NG.js → chunk-APFRCIRI.js} +2906 -2569
  10. package/dist/{chunk-62V653X2.js → chunk-AXFWGY32.js} +79 -44
  11. package/dist/{chunk-N5TQVEKE.js → chunk-BUKYCWHX.js} +1 -1
  12. package/dist/{chunk-655B7MMR.js → chunk-CEBWDD63.js} +15 -8
  13. package/dist/{chunk-YUBEOWII.js → chunk-ELXMRSVN.js} +16 -5
  14. package/dist/{chunk-FJIRS3FM.js → chunk-F7HW2NI5.js} +1 -3
  15. package/dist/{chunk-P7C7SEJV.js → chunk-FKQG7FTY.js} +5 -5
  16. package/dist/{chunk-RLTFJYDN.js → chunk-H5FI5WDP.js} +1 -1
  17. package/dist/{chunk-G6N3LMO2.js → chunk-ITWCTZYH.js} +1 -1
  18. package/dist/{chunk-YUR5SX7F.js → chunk-JCO7AHNU.js} +70 -59
  19. package/dist/{chunk-ZEUP4TUD.js → chunk-JNGGM2XE.js} +6 -6
  20. package/dist/{chunk-QCFBIVIQ.js → chunk-K35BAR4P.js} +1 -1
  21. package/dist/{chunk-JCQG2I2G.js → chunk-KZBEVFXZ.js} +1 -1
  22. package/dist/{chunk-FJO2ZL4Q.js → chunk-OAVXAFAY.js} +73 -16
  23. package/dist/{chunk-A7CZH3GN.js → chunk-ODXVQ3CS.js} +41 -20
  24. package/dist/{chunk-4NJEAPLI.js → chunk-OOUQUCNN.js} +1 -1
  25. package/dist/{chunk-5VH3GIDX.js → chunk-RT3IYFN2.js} +1 -1
  26. package/dist/{chunk-Q46YIQYW.js → chunk-S3V6ZXPI.js} +22 -5
  27. package/dist/{chunk-IQJ36UTJ.js → chunk-WSGLJYFI.js} +31 -24
  28. package/dist/{chunk-3JHCYHWN.js → chunk-WWV3SJ3L.js} +19 -13
  29. package/dist/data.cjs +16 -2
  30. package/dist/data.js +7 -6
  31. package/dist/devtools.cjs +71 -21
  32. package/dist/devtools.d.cts +12 -5
  33. package/dist/devtools.d.ts +12 -5
  34. package/dist/devtools.js +6 -5
  35. package/dist/ecosystem.cjs +11 -2
  36. package/dist/ecosystem.d.cts +1 -1
  37. package/dist/ecosystem.d.ts +1 -1
  38. package/dist/ecosystem.js +10 -9
  39. package/dist/extras.cjs +454 -250
  40. package/dist/extras.d.cts +2 -2
  41. package/dist/extras.d.ts +2 -2
  42. package/dist/extras.js +26 -22
  43. package/dist/index.cjs +3385 -3045
  44. package/dist/index.d.cts +1179 -1057
  45. package/dist/index.d.ts +1179 -1057
  46. package/dist/index.js +32 -19
  47. package/dist/motion.cjs +223 -204
  48. package/dist/motion.d.cts +8 -1
  49. package/dist/motion.d.ts +8 -1
  50. package/dist/motion.js +6 -3
  51. package/dist/patterns.cjs +13 -6
  52. package/dist/patterns.d.cts +4 -1
  53. package/dist/patterns.d.ts +4 -1
  54. package/dist/patterns.js +5 -5
  55. package/dist/performance.cjs +70 -56
  56. package/dist/performance.js +6 -5
  57. package/dist/plugins.cjs +98 -42
  58. package/dist/plugins.d.cts +2 -1
  59. package/dist/plugins.d.ts +2 -1
  60. package/dist/plugins.js +89 -36
  61. package/dist/ssr.cjs +112 -91
  62. package/dist/ssr.d.cts +8 -1
  63. package/dist/ssr.d.ts +8 -1
  64. package/dist/ssr.js +9 -8
  65. package/dist/{tagFactory-S17H2qxu.d.ts → tagFactory-Bzupt4Pj.d.cts} +1 -1
  66. package/dist/{tagFactory-S17H2qxu.d.cts → tagFactory-Bzupt4Pj.d.ts} +1 -1
  67. package/dist/testing.cjs +18 -4
  68. package/dist/testing.js +18 -7
  69. package/dist/ui.cjs +322 -281
  70. package/dist/ui.d.cts +0 -20
  71. package/dist/ui.d.ts +0 -20
  72. package/dist/ui.js +27 -21
  73. package/dist/widgets.cjs +75 -13
  74. package/dist/widgets.d.cts +6 -1
  75. package/dist/widgets.d.ts +6 -1
  76. package/dist/widgets.js +7 -6
  77. package/package.json +4 -1
package/dist/ssr.cjs CHANGED
@@ -713,8 +713,69 @@ function escapeAttr(str) {
713
713
  return str.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
714
714
  }
715
715
 
716
- // src/reactivity/track-core.ts
716
+ // src/core/rendering/dispose.ts
717
+ var elementDisposers = /* @__PURE__ */ new WeakMap();
717
718
  var _isDev3 = isDev();
719
+ var activeBindingCount = 0;
720
+ function registerDisposer(node, teardown) {
721
+ let disposers = elementDisposers.get(node);
722
+ if (!disposers) {
723
+ disposers = [];
724
+ elementDisposers.set(node, disposers);
725
+ }
726
+ disposers.push(teardown);
727
+ if (_isDev3) activeBindingCount++;
728
+ }
729
+ function dispose(node) {
730
+ const stack = [node];
731
+ const order = [];
732
+ while (stack.length > 0) {
733
+ const current = stack.pop();
734
+ order.push(current);
735
+ const children = Array.from(current.childNodes);
736
+ for (let i2 = 0; i2 < children.length; i2++) {
737
+ stack.push(children[i2]);
738
+ }
739
+ }
740
+ for (let i2 = order.length - 1; i2 >= 0; i2--) {
741
+ const current = order[i2];
742
+ const disposers = elementDisposers.get(current);
743
+ if (disposers) {
744
+ const snapshot = disposers.slice();
745
+ elementDisposers.delete(current);
746
+ if (_isDev3) activeBindingCount -= snapshot.length;
747
+ for (const d of snapshot) {
748
+ try {
749
+ d();
750
+ } catch (err) {
751
+ if (_isDev3 && typeof console !== "undefined") {
752
+ console.warn("[SibuJS] Disposer threw during cleanup:", err);
753
+ }
754
+ }
755
+ }
756
+ let extraPasses = 0;
757
+ while (extraPasses++ < 8) {
758
+ const added = elementDisposers.get(current);
759
+ if (!added || added.length === 0) break;
760
+ const moreSnapshot = added.slice();
761
+ elementDisposers.delete(current);
762
+ if (_isDev3) activeBindingCount -= moreSnapshot.length;
763
+ for (const d of moreSnapshot) {
764
+ try {
765
+ d();
766
+ } catch (err) {
767
+ if (_isDev3 && typeof console !== "undefined") {
768
+ console.warn("[SibuJS] Disposer threw during cleanup:", err);
769
+ }
770
+ }
771
+ }
772
+ }
773
+ }
774
+ }
775
+ }
776
+
777
+ // src/reactivity/track-core.ts
778
+ var _isDev4 = isDev();
718
779
  var POOL_MAX = 4096;
719
780
  var nodePool = [];
720
781
  function createNode() {
@@ -806,7 +867,7 @@ function safeInvoke(sub2) {
806
867
  try {
807
868
  sub2();
808
869
  } catch (err) {
809
- if (_isDev3) devWarn(`Subscriber threw during notification: ${err instanceof Error ? err.message : String(err)}`);
870
+ if (_isDev4) devWarn(`Subscriber threw during notification: ${err instanceof Error ? err.message : String(err)}`);
810
871
  }
811
872
  }
812
873
  var suspendDepth = 0;
@@ -1128,14 +1189,14 @@ function forEachSubscriber(signal2, visit) {
1128
1189
  }
1129
1190
 
1130
1191
  // src/reactivity/track.ts
1131
- var _isDev4 = isDev();
1132
- var _runtimeVersion = true ? "3.3.2" : "dev";
1192
+ var _isDev5 = isDev();
1193
+ var _runtimeVersion = true ? "3.4.0" : "dev";
1133
1194
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
1134
1195
  function resolveReactiveApi() {
1135
1196
  const g2 = globalThis;
1136
1197
  const existing = g2[REGISTRY_KEY];
1137
1198
  if (existing) {
1138
- if (_isDev4 && !existing.__dupWarned) {
1199
+ if (_isDev5 && !existing.__dupWarned) {
1139
1200
  existing.__dupWarned = true;
1140
1201
  devWarn(
1141
1202
  `Multiple instances of the reactive runtime detected on this page (active: ${existing.version}, duplicate: ${_runtimeVersion}). Reactivity still works \u2014 all copies share the first one \u2014 but de-duplicate sibujs in your bundler (e.g. Vite optimizeDeps.exclude: ['sibujs'] or resolve.dedupe: ['sibujs']).`
@@ -1430,6 +1491,7 @@ function Head(props) {
1430
1491
  }
1431
1492
  };
1432
1493
  apply();
1494
+ registerDisposer(anchor, cleanup3);
1433
1495
  return anchor;
1434
1496
  }
1435
1497
  function setStructuredData(data2) {
@@ -1522,7 +1584,7 @@ var isBatching = API2.isBatching;
1522
1584
 
1523
1585
  // src/core/signals/signal.ts
1524
1586
  var _g2 = globalThis;
1525
- var _isDev5 = isDev();
1587
+ var _isDev6 = isDev();
1526
1588
  function signal(initial, options) {
1527
1589
  const state = {
1528
1590
  value: initial,
@@ -1533,7 +1595,7 @@ function signal(initial, options) {
1533
1595
  __activeNode: null,
1534
1596
  __name: void 0
1535
1597
  };
1536
- const debugName = _isDev5 ? options?.name : void 0;
1598
+ const debugName = _isDev6 ? options?.name : void 0;
1537
1599
  const equalsFn = options?.equals;
1538
1600
  if (debugName) state.__name = debugName;
1539
1601
  function get() {
@@ -1550,7 +1612,7 @@ function signal(initial, options) {
1550
1612
  if (equalsFn(prev, newValue)) return;
1551
1613
  state.value = newValue;
1552
1614
  state.__v++;
1553
- if (_isDev5) {
1615
+ if (_isDev6) {
1554
1616
  const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
1555
1617
  if (hook) hook.emit("signal:update", { signal: state, name: debugName, oldValue: prev, newValue });
1556
1618
  }
@@ -1558,7 +1620,7 @@ function signal(initial, options) {
1558
1620
  notifySubscribers2(state);
1559
1621
  }
1560
1622
  };
1561
- } else if (_isDev5) {
1623
+ } else if (_isDev6) {
1562
1624
  set = (next) => {
1563
1625
  const prev = state.value;
1564
1626
  const newValue = typeof next === "function" ? next(prev) : next;
@@ -1583,7 +1645,7 @@ function signal(initial, options) {
1583
1645
  }
1584
1646
  };
1585
1647
  }
1586
- if (_isDev5) {
1648
+ if (_isDev6) {
1587
1649
  const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
1588
1650
  if (hook) hook.emit("signal:create", { signal: state, name: debugName, getter: get, initial });
1589
1651
  }
@@ -1640,24 +1702,30 @@ function createAction(actionFn) {
1640
1702
  const [data2, setData] = signal(void 0);
1641
1703
  const [error, setError] = signal(void 0);
1642
1704
  const [loading, setLoading] = signal(false);
1705
+ let activeRun = 0;
1643
1706
  const submit = async (input2) => {
1707
+ const runId = ++activeRun;
1644
1708
  batch(() => {
1645
1709
  setLoading(true);
1646
1710
  setError(void 0);
1647
1711
  });
1648
1712
  try {
1649
1713
  const result = await actionFn(input2);
1650
- batch(() => {
1651
- setData(result);
1652
- setLoading(false);
1653
- });
1714
+ if (runId === activeRun) {
1715
+ batch(() => {
1716
+ setData(result);
1717
+ setLoading(false);
1718
+ });
1719
+ }
1654
1720
  return result;
1655
1721
  } catch (err) {
1656
1722
  const actionError = err instanceof Error ? err : new Error(String(err));
1657
- batch(() => {
1658
- setError(actionError);
1659
- setLoading(false);
1660
- });
1723
+ if (runId === activeRun) {
1724
+ batch(() => {
1725
+ setError(actionError);
1726
+ setLoading(false);
1727
+ });
1728
+ }
1661
1729
  throw actionError;
1662
1730
  }
1663
1731
  };
@@ -1671,15 +1739,14 @@ function scrollRestoration(options) {
1671
1739
  let popstateHandler = null;
1672
1740
  let currentKey = null;
1673
1741
  const save = (key) => {
1674
- positions.set(key, {
1675
- x: window.scrollX,
1676
- y: window.scrollY
1677
- });
1742
+ if (typeof window !== "undefined") {
1743
+ positions.set(key, { x: window.scrollX, y: window.scrollY });
1744
+ }
1678
1745
  currentKey = key;
1679
1746
  };
1680
1747
  const restore = (key) => {
1681
1748
  const pos = positions.get(key);
1682
- if (pos) {
1749
+ if (pos && typeof window !== "undefined") {
1683
1750
  window.scrollTo(pos.x, pos.y);
1684
1751
  }
1685
1752
  currentKey = key;
@@ -1687,7 +1754,7 @@ function scrollRestoration(options) {
1687
1754
  const getPosition = (key) => {
1688
1755
  return positions.get(key);
1689
1756
  };
1690
- if (mode === "auto") {
1757
+ if (mode === "auto" && typeof window !== "undefined") {
1691
1758
  popstateHandler = () => {
1692
1759
  if (currentKey) {
1693
1760
  save(currentKey);
@@ -1737,13 +1804,13 @@ function createMiddlewareChain() {
1737
1804
  }
1738
1805
 
1739
1806
  // src/reactivity/bindAttribute.ts
1740
- var _isDev6 = isDev();
1807
+ var _isDev7 = isDev();
1741
1808
  function setProp(el, key, val) {
1742
1809
  el[key] = val;
1743
1810
  }
1744
1811
  function bindAttribute(el, attr, getter) {
1745
1812
  if (isEventHandlerAttr(attr)) {
1746
- if (_isDev6)
1813
+ if (_isDev7)
1747
1814
  devWarn(
1748
1815
  `bindAttribute: refusing to bind event-handler attribute "${attr}". Use on:{ ${attr.slice(2)}: fn } instead.`
1749
1816
  );
@@ -1755,7 +1822,7 @@ function bindAttribute(el, attr, getter) {
1755
1822
  try {
1756
1823
  value = getter();
1757
1824
  } catch (err) {
1758
- if (_isDev6)
1825
+ if (_isDev7)
1759
1826
  devWarn(`bindAttribute: getter for "${attr}" threw: ${err instanceof Error ? err.message : String(err)}`);
1760
1827
  return;
1761
1828
  }
@@ -1779,67 +1846,6 @@ function bindAttribute(el, attr, getter) {
1779
1846
  return reactiveBinding2(commit);
1780
1847
  }
1781
1848
 
1782
- // src/core/rendering/dispose.ts
1783
- var elementDisposers = /* @__PURE__ */ new WeakMap();
1784
- var _isDev7 = isDev();
1785
- var activeBindingCount = 0;
1786
- function registerDisposer(node, teardown) {
1787
- let disposers = elementDisposers.get(node);
1788
- if (!disposers) {
1789
- disposers = [];
1790
- elementDisposers.set(node, disposers);
1791
- }
1792
- disposers.push(teardown);
1793
- if (_isDev7) activeBindingCount++;
1794
- }
1795
- function dispose(node) {
1796
- const stack = [node];
1797
- const order = [];
1798
- while (stack.length > 0) {
1799
- const current = stack.pop();
1800
- order.push(current);
1801
- const children = Array.from(current.childNodes);
1802
- for (let i2 = 0; i2 < children.length; i2++) {
1803
- stack.push(children[i2]);
1804
- }
1805
- }
1806
- for (let i2 = order.length - 1; i2 >= 0; i2--) {
1807
- const current = order[i2];
1808
- const disposers = elementDisposers.get(current);
1809
- if (disposers) {
1810
- const snapshot = disposers.slice();
1811
- elementDisposers.delete(current);
1812
- if (_isDev7) activeBindingCount -= snapshot.length;
1813
- for (const d of snapshot) {
1814
- try {
1815
- d();
1816
- } catch (err) {
1817
- if (_isDev7 && typeof console !== "undefined") {
1818
- console.warn("[SibuJS] Disposer threw during cleanup:", err);
1819
- }
1820
- }
1821
- }
1822
- let extraPasses = 0;
1823
- while (extraPasses++ < 8) {
1824
- const added = elementDisposers.get(current);
1825
- if (!added || added.length === 0) break;
1826
- const moreSnapshot = added.slice();
1827
- elementDisposers.delete(current);
1828
- if (_isDev7) activeBindingCount -= moreSnapshot.length;
1829
- for (const d of moreSnapshot) {
1830
- try {
1831
- d();
1832
- } catch (err) {
1833
- if (_isDev7 && typeof console !== "undefined") {
1834
- console.warn("[SibuJS] Disposer threw during cleanup:", err);
1835
- }
1836
- }
1837
- }
1838
- }
1839
- }
1840
- }
1841
- }
1842
-
1843
1849
  // src/reactivity/bindChildNode.ts
1844
1850
  var _isDev8 = isDev();
1845
1851
  function bindChildNode(placeholder, getter) {
@@ -2309,8 +2315,17 @@ var center = tagFactory("center");
2309
2315
  var font = tagFactory("font");
2310
2316
  var marquee = tagFactory("marquee");
2311
2317
 
2318
+ // src/utils/globalSingleton.ts
2319
+ function globalSingleton(key, create) {
2320
+ const g2 = globalThis;
2321
+ return g2[key] ?? (g2[key] = create());
2322
+ }
2323
+
2312
2324
  // src/platform/microfrontend.ts
2313
- var moduleCache = /* @__PURE__ */ new Map();
2325
+ var moduleCache = globalSingleton(
2326
+ /* @__PURE__ */ Symbol.for("sibujs.microfrontend.moduleCache.v1"),
2327
+ () => /* @__PURE__ */ new Map()
2328
+ );
2314
2329
  function createMicroApp(config) {
2315
2330
  const host = config.container ?? document.createElement("div");
2316
2331
  host.setAttribute("data-micro-app", config.name);
@@ -2727,8 +2742,14 @@ function createWorkerPool(workerFn2, poolSize) {
2727
2742
  }
2728
2743
 
2729
2744
  // src/platform/wasm.ts
2730
- var moduleCache2 = /* @__PURE__ */ new Map();
2731
- var instanceCache = /* @__PURE__ */ new Map();
2745
+ var moduleCache2 = globalSingleton(
2746
+ /* @__PURE__ */ Symbol.for("sibujs.wasm.moduleCache.v1"),
2747
+ () => /* @__PURE__ */ new Map()
2748
+ );
2749
+ var instanceCache = globalSingleton(
2750
+ /* @__PURE__ */ Symbol.for("sibujs.wasm.instanceCache.v1"),
2751
+ () => /* @__PURE__ */ new Map()
2752
+ );
2732
2753
  function wasm(source2, config = {}) {
2733
2754
  const [instance, setInstance] = signal(null);
2734
2755
  const [loading, setLoading] = signal(true);
package/dist/ssr.d.cts CHANGED
@@ -138,7 +138,14 @@ declare function wasm<T extends Record<string, unknown> = Record<string, unknown
138
138
  /**
139
139
  * Load and instantiate a WebAssembly module.
140
140
  * Supports loading from URL, ArrayBuffer, or Uint8Array.
141
- * Caches compiled modules for reuse.
141
+ *
142
+ * Caching: keyed by `cacheKey` (or, for a URL source, the URL itself). A keyed
143
+ * load is memoized as a **singleton instance** — every caller with the same key
144
+ * receives the *same* `WebAssembly.Instance`, which shares one linear memory and
145
+ * mutable globals. This is intentional (load-once / reuse), but it means callers
146
+ * that need isolated state must use distinct cache keys, or pass a non-URL source
147
+ * with no `cacheKey` (which instantiates fresh every call). Compiled modules are
148
+ * immutable and always safe to share.
142
149
  */
143
150
  interface LoadWasmOptions {
144
151
  imports?: WebAssembly.Imports;
package/dist/ssr.d.ts CHANGED
@@ -138,7 +138,14 @@ declare function wasm<T extends Record<string, unknown> = Record<string, unknown
138
138
  /**
139
139
  * Load and instantiate a WebAssembly module.
140
140
  * Supports loading from URL, ArrayBuffer, or Uint8Array.
141
- * Caches compiled modules for reuse.
141
+ *
142
+ * Caching: keyed by `cacheKey` (or, for a URL source, the URL itself). A keyed
143
+ * load is memoized as a **singleton instance** — every caller with the same key
144
+ * receives the *same* `WebAssembly.Instance`, which shares one linear memory and
145
+ * mutable globals. This is intentional (load-once / reuse), but it means callers
146
+ * that need isolated state must use distinct cache keys, or pass a non-URL source
147
+ * with no `cacheKey` (which instantiates fresh every call). Compiled modules are
148
+ * immutable and always safe to share.
142
149
  */
143
150
  interface LoadWasmOptions {
144
151
  imports?: WebAssembly.Imports;
package/dist/ssr.js CHANGED
@@ -22,8 +22,8 @@ import {
22
22
  wasm,
23
23
  worker,
24
24
  workerFn
25
- } from "./chunk-A7CZH3GN.js";
26
- import "./chunk-6TCOWMGY.js";
25
+ } from "./chunk-ODXVQ3CS.js";
26
+ import "./chunk-3Z2NGWQI.js";
27
27
  import {
28
28
  collectStream,
29
29
  deserializeState,
@@ -44,14 +44,15 @@ import {
44
44
  suspenseSwapScript,
45
45
  trustHTML
46
46
  } from "./chunk-EX77FXTT.js";
47
- import "./chunk-ZEUP4TUD.js";
48
- import "./chunk-QCFBIVIQ.js";
49
- import "./chunk-5VGSK6D2.js";
47
+ import "./chunk-JNGGM2XE.js";
48
+ import "./chunk-K35BAR4P.js";
49
+ import "./chunk-7ZHH77QA.js";
50
50
  import "./chunk-L3GAGWCC.js";
51
- import "./chunk-N5TQVEKE.js";
51
+ import "./chunk-BUKYCWHX.js";
52
52
  import "./chunk-S3NFJO6L.js";
53
- import "./chunk-JCQG2I2G.js";
54
- import "./chunk-4NJEAPLI.js";
53
+ import "./chunk-5VGSK6D2.js";
54
+ import "./chunk-KZBEVFXZ.js";
55
+ import "./chunk-OOUQUCNN.js";
55
56
  import "./chunk-COY6PUD2.js";
56
57
  export {
57
58
  Head,
@@ -52,4 +52,4 @@ interface TagProps {
52
52
  */
53
53
  declare const tagFactory: (tag: string, ns?: string) => (first?: TagProps | NodeChildren, second?: NodeChildren) => Element;
54
54
 
55
- export { type Dispose as D, type NodeChildren as N, SVG_NS as S, type TagProps as T, type NodeChild as a, tagFactory as t };
55
+ export { type Dispose as D, type NodeChild as N, SVG_NS as S, type TagProps as T, type NodeChildren as a, tagFactory as t };
@@ -52,4 +52,4 @@ interface TagProps {
52
52
  */
53
53
  declare const tagFactory: (tag: string, ns?: string) => (first?: TagProps | NodeChildren, second?: NodeChildren) => Element;
54
54
 
55
- export { type Dispose as D, type NodeChildren as N, SVG_NS as S, type TagProps as T, type NodeChild as a, tagFactory as t };
55
+ export { type Dispose as D, type NodeChild as N, SVG_NS as S, type TagProps as T, type NodeChildren as a, tagFactory as t };
package/dist/testing.cjs CHANGED
@@ -140,6 +140,12 @@ function dispose(node) {
140
140
  }
141
141
  }
142
142
 
143
+ // src/utils/globalSingleton.ts
144
+ function globalSingleton(key, create) {
145
+ const g = globalThis;
146
+ return g[key] ?? (g[key] = create());
147
+ }
148
+
143
149
  // src/testing/a11y.ts
144
150
  function escSel(value) {
145
151
  return value.replace(/["\\]/g, "\\$&");
@@ -641,7 +647,7 @@ function checkAriaAttributes(root) {
641
647
  if (attr.name === "aria-checked" || attr.name === "aria-pressed") {
642
648
  validValues.push("mixed");
643
649
  }
644
- if (!validValues.includes(attr.value) && attr.value !== "undefined") {
650
+ if (!validValues.includes(attr.value)) {
645
651
  violations.push({
646
652
  rule: "aria-valid-attr-value",
647
653
  level: "error",
@@ -1297,7 +1303,15 @@ function createHttpMock(routes = [], options = {}) {
1297
1303
  const mockFetch = async (input, init) => {
1298
1304
  const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
1299
1305
  const method = init?.method || "GET";
1300
- const body = init?.body ? JSON.parse(String(init.body)) : void 0;
1306
+ let body;
1307
+ if (init?.body != null) {
1308
+ const raw = String(init.body);
1309
+ try {
1310
+ body = JSON.parse(raw);
1311
+ } catch {
1312
+ body = raw;
1313
+ }
1314
+ }
1301
1315
  requestLog.push({ url, method, body, timestamp: Date.now() });
1302
1316
  const route = matchRoute(url, method);
1303
1317
  if (!route) {
@@ -1980,7 +1994,7 @@ function forEachSubscriber(signal, visit) {
1980
1994
 
1981
1995
  // src/reactivity/track.ts
1982
1996
  var _isDev4 = isDev();
1983
- var _runtimeVersion = true ? "3.3.2" : "dev";
1997
+ var _runtimeVersion = true ? "3.4.0" : "dev";
1984
1998
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
1985
1999
  function resolveReactiveApi() {
1986
2000
  const g = globalThis;
@@ -2654,7 +2668,7 @@ function escapeSelector(value) {
2654
2668
  if (g.CSS && typeof g.CSS.escape === "function") return g.CSS.escape(value);
2655
2669
  return value.replace(/[^\w-]/g, (m) => `\\${m.charCodeAt(0).toString(16)} `);
2656
2670
  }
2657
- var _renderedContainers = /* @__PURE__ */ new Set();
2671
+ var _renderedContainers = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.testing.containers.v1"), () => /* @__PURE__ */ new Set());
2658
2672
  function unmountAll() {
2659
2673
  for (const container of _renderedContainers) {
2660
2674
  for (const child of Array.from(container.childNodes)) dispose(child);
package/dist/testing.js CHANGED
@@ -1,11 +1,14 @@
1
1
  import {
2
- dispose
3
- } from "./chunk-5VGSK6D2.js";
2
+ globalSingleton
3
+ } from "./chunk-7ZHH77QA.js";
4
4
  import {
5
5
  effect
6
- } from "./chunk-N5TQVEKE.js";
6
+ } from "./chunk-BUKYCWHX.js";
7
7
  import "./chunk-S3NFJO6L.js";
8
- import "./chunk-4NJEAPLI.js";
8
+ import {
9
+ dispose
10
+ } from "./chunk-5VGSK6D2.js";
11
+ import "./chunk-OOUQUCNN.js";
9
12
  import "./chunk-COY6PUD2.js";
10
13
 
11
14
  // src/testing/a11y.ts
@@ -509,7 +512,7 @@ function checkAriaAttributes(root) {
509
512
  if (attr.name === "aria-checked" || attr.name === "aria-pressed") {
510
513
  validValues.push("mixed");
511
514
  }
512
- if (!validValues.includes(attr.value) && attr.value !== "undefined") {
515
+ if (!validValues.includes(attr.value)) {
513
516
  violations.push({
514
517
  rule: "aria-valid-attr-value",
515
518
  level: "error",
@@ -1165,7 +1168,15 @@ function createHttpMock(routes = [], options = {}) {
1165
1168
  const mockFetch = async (input, init) => {
1166
1169
  const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
1167
1170
  const method = init?.method || "GET";
1168
- const body = init?.body ? JSON.parse(String(init.body)) : void 0;
1171
+ let body;
1172
+ if (init?.body != null) {
1173
+ const raw = String(init.body);
1174
+ try {
1175
+ body = JSON.parse(raw);
1176
+ } catch {
1177
+ body = raw;
1178
+ }
1179
+ }
1169
1180
  requestLog.push({ url, method, body, timestamp: Date.now() });
1170
1181
  const route = matchRoute(url, method);
1171
1182
  if (!route) {
@@ -1894,7 +1905,7 @@ function escapeSelector(value) {
1894
1905
  if (g.CSS && typeof g.CSS.escape === "function") return g.CSS.escape(value);
1895
1906
  return value.replace(/[^\w-]/g, (m) => `\\${m.charCodeAt(0).toString(16)} `);
1896
1907
  }
1897
- var _renderedContainers = /* @__PURE__ */ new Set();
1908
+ var _renderedContainers = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.testing.containers.v1"), () => /* @__PURE__ */ new Set());
1898
1909
  function unmountAll() {
1899
1910
  for (const container of _renderedContainers) {
1900
1911
  for (const child of Array.from(container.childNodes)) dispose(child);