sibujs 4.5.0 → 4.6.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 (109) hide show
  1. package/dist/browser.cjs +309 -129
  2. package/dist/browser.d.cts +46 -14
  3. package/dist/browser.d.ts +46 -14
  4. package/dist/browser.js +8 -6
  5. package/dist/build.cjs +184 -72
  6. package/dist/build.js +15 -16
  7. package/dist/cdn.dev.global.js +12 -12
  8. package/dist/cdn.full.dev.global.js +11 -11
  9. package/dist/cdn.full.global.js +10 -10
  10. package/dist/cdn.global.js +12 -12
  11. package/dist/{chunk-IXKSNWV5.js → chunk-2INLLLMZ.js} +1 -1
  12. package/dist/chunk-3ISI6ACU.js +44 -0
  13. package/dist/{chunk-ONOHFDLG.js → chunk-47M47FOM.js} +3 -3
  14. package/dist/chunk-5HZXGZ6T.js +24 -0
  15. package/dist/{chunk-KKLW7YWL.js → chunk-5MT6SJ3P.js} +275 -144
  16. package/dist/{chunk-UGRX3S57.js → chunk-5Q4R7HCL.js} +12 -3
  17. package/dist/{chunk-S373NSMK.js → chunk-7GQCWFOE.js} +150 -59
  18. package/dist/{chunk-FTIR4QW2.js → chunk-7NCARGJW.js} +6 -8
  19. package/dist/{chunk-5DXA2J44.js → chunk-7XHATCIH.js} +5 -2
  20. package/dist/{chunk-VZKNK2V7.js → chunk-AIF3Z2T7.js} +296 -38
  21. package/dist/{chunk-4PMLNECI.js → chunk-BAAG6ZTI.js} +98 -29
  22. package/dist/{chunk-XZZOBQAY.js → chunk-D33YTSX5.js} +2 -2
  23. package/dist/{chunk-TBYTO6BS.js → chunk-DKGBBKOF.js} +136 -80
  24. package/dist/{chunk-NIOYEGBQ.js → chunk-HURREPU2.js} +27 -13
  25. package/dist/{chunk-GW3SCCZG.js → chunk-HYXDKS4N.js} +153 -110
  26. package/dist/chunk-J6FW5TV6.js +233 -0
  27. package/dist/{chunk-PCT43HW3.js → chunk-JSXPZCET.js} +1 -1
  28. package/dist/chunk-NYNYSPK7.js +318 -0
  29. package/dist/{chunk-RJE2BNI4.js → chunk-ORMZXBKQ.js} +108 -45
  30. package/dist/{chunk-OMJJM3KM.js → chunk-OXUY2A6L.js} +287 -130
  31. package/dist/{chunk-3JZ4L5TJ.js → chunk-PK6FK2G2.js} +181 -66
  32. package/dist/{chunk-RBTPLM32.js → chunk-QE4TTDU3.js} +2 -2
  33. package/dist/{chunk-2DCGACUU.js → chunk-SXXVZMKZ.js} +251 -66
  34. package/dist/{chunk-R25EFXXC.js → chunk-TUCPL2HB.js} +3 -3
  35. package/dist/{chunk-7LN645I6.js → chunk-UZQ6ALFS.js} +3 -3
  36. package/dist/{chunk-KEISJXBU.js → chunk-VVWPJ543.js} +6 -8
  37. package/dist/{chunk-RIXRAYIU.js → chunk-XC4MEKGA.js} +3 -3
  38. package/dist/{chunk-B3WHI2QA.js → chunk-XRRZKZYX.js} +55 -31
  39. package/dist/{contracts-DBdg9J_a.d.cts → contracts-DRIuclVT.d.cts} +10 -2
  40. package/dist/{contracts-DBdg9J_a.d.ts → contracts-DRIuclVT.d.ts} +10 -2
  41. package/dist/{customElement-OB9CIsc5.d.cts → customElement-MmInOW1U.d.cts} +21 -0
  42. package/dist/{customElement-OB9CIsc5.d.ts → customElement-MmInOW1U.d.ts} +21 -0
  43. package/dist/data.cjs +213 -117
  44. package/dist/data.d.cts +47 -9
  45. package/dist/data.d.ts +47 -9
  46. package/dist/data.js +12 -9
  47. package/dist/devtools.cjs +81 -57
  48. package/dist/devtools.js +7 -8
  49. package/dist/dispose-GEIG2KOF.js +28 -0
  50. package/dist/ecosystem.cjs +309 -104
  51. package/dist/ecosystem.d.cts +19 -3
  52. package/dist/ecosystem.d.ts +19 -3
  53. package/dist/ecosystem.js +12 -12
  54. package/dist/extras.cjs +2133 -863
  55. package/dist/extras.d.cts +10 -9
  56. package/dist/extras.d.ts +10 -9
  57. package/dist/extras.js +39 -28
  58. package/dist/index.cjs +184 -72
  59. package/dist/index.d.cts +22 -5
  60. package/dist/index.d.ts +22 -5
  61. package/dist/index.js +24 -27
  62. package/dist/motion.cjs +107 -41
  63. package/dist/motion.js +5 -5
  64. package/dist/patterns.cjs +317 -39
  65. package/dist/patterns.d.cts +27 -9
  66. package/dist/patterns.d.ts +27 -9
  67. package/dist/patterns.js +8 -8
  68. package/dist/performance.cjs +308 -216
  69. package/dist/performance.d.cts +2 -2
  70. package/dist/performance.d.ts +2 -2
  71. package/dist/performance.js +8 -9
  72. package/dist/plugin-DVgSnTfK.d.cts +112 -0
  73. package/dist/plugin-DVgSnTfK.d.ts +112 -0
  74. package/dist/plugins.cjs +549 -202
  75. package/dist/plugins.d.cts +3 -3
  76. package/dist/plugins.d.ts +3 -3
  77. package/dist/plugins.js +35 -23
  78. package/dist/signal-EotCj4hS.d.cts +110 -0
  79. package/dist/signal-EotCj4hS.d.ts +110 -0
  80. package/dist/{ssr-BiPRdZ6n.d.cts → ssr-Bli9XRW5.d.cts} +5 -0
  81. package/dist/{ssr-BiPRdZ6n.d.ts → ssr-Bli9XRW5.d.ts} +5 -0
  82. package/dist/{ssr-Y7XOEPEN.js → ssr-XOTUASDO.js} +4 -5
  83. package/dist/ssr.cjs +176 -72
  84. package/dist/ssr.d.cts +9 -3
  85. package/dist/ssr.d.ts +9 -3
  86. package/dist/ssr.js +11 -12
  87. package/dist/{startup-BMpaiMhP.d.ts → startup-BLfSeL15.d.cts} +73 -22
  88. package/dist/{startup-BMpaiMhP.d.cts → startup-BLfSeL15.d.ts} +73 -22
  89. package/dist/{tagFactory-DVoDpHye.d.ts → tagFactory-DFstCLQV.d.cts} +2 -100
  90. package/dist/{tagFactory-DVoDpHye.d.cts → tagFactory-DkaNVUNV.d.ts} +2 -100
  91. package/dist/testing.cjs +2484 -2185
  92. package/dist/testing.d.cts +56 -5
  93. package/dist/testing.d.ts +56 -5
  94. package/dist/testing.js +580 -307
  95. package/dist/ui.cjs +707 -317
  96. package/dist/ui.d.cts +40 -7
  97. package/dist/ui.d.ts +40 -7
  98. package/dist/ui.js +151 -56
  99. package/dist/widgets.cjs +246 -278
  100. package/dist/widgets.js +9 -10
  101. package/package.json +1 -1
  102. package/dist/chunk-2WLZ6757.js +0 -149
  103. package/dist/chunk-CCSJMTRN.js +0 -15
  104. package/dist/chunk-QKRPLZ2V.js +0 -108
  105. package/dist/chunk-VUF4ALSW.js +0 -60
  106. package/dist/chunk-WWV3SJ3L.js +0 -131
  107. package/dist/dispose-46BOMMQJ.js +0 -19
  108. package/dist/plugin-D30wlGW5.d.cts +0 -71
  109. package/dist/plugin-D30wlGW5.d.ts +0 -71
@@ -135,42 +135,40 @@ import {
135
135
  use,
136
136
  var_,
137
137
  video
138
- } from "./chunk-PCT43HW3.js";
138
+ } from "./chunk-JSXPZCET.js";
139
139
  import {
140
140
  trustHTML
141
- } from "./chunk-NIOYEGBQ.js";
141
+ } from "./chunk-HURREPU2.js";
142
142
  import {
143
143
  watch
144
- } from "./chunk-7LN645I6.js";
144
+ } from "./chunk-UZQ6ALFS.js";
145
145
  import {
146
146
  __resetIdCounter,
147
- createId
148
- } from "./chunk-CCSJMTRN.js";
149
- import {
150
- context
151
- } from "./chunk-VUF4ALSW.js";
147
+ createId,
148
+ domBinding
149
+ } from "./chunk-3ISI6ACU.js";
152
150
  import {
153
151
  SVG_NS,
154
152
  bindChildNode,
155
153
  captureFocusWithin,
156
154
  restoreFocusWithin,
157
155
  tagFactory
158
- } from "./chunk-KEISJXBU.js";
156
+ } from "./chunk-VVWPJ543.js";
159
157
  import {
160
158
  bindAttribute,
161
159
  bindDynamic,
162
160
  setSafeAttribute
163
- } from "./chunk-ONOHFDLG.js";
161
+ } from "./chunk-47M47FOM.js";
164
162
  import {
165
163
  derived
166
- } from "./chunk-RBTPLM32.js";
164
+ } from "./chunk-QE4TTDU3.js";
167
165
  import {
168
166
  globalSingleton
169
167
  } from "./chunk-7ZHH77QA.js";
170
168
  import {
171
169
  effect,
172
170
  on
173
- } from "./chunk-RIXRAYIU.js";
171
+ } from "./chunk-XC4MEKGA.js";
174
172
  import {
175
173
  disableSSR,
176
174
  enableSSR,
@@ -179,23 +177,17 @@ import {
179
177
  isSSR,
180
178
  runInSSRContext,
181
179
  withSSR
182
- } from "./chunk-5DXA2J44.js";
180
+ } from "./chunk-7XHATCIH.js";
183
181
  import {
184
- MAX_DRAIN_TEARDOWNS,
185
- checkLeaks,
186
- dispose,
187
- registerDisposer,
188
- replaceChildrenSafely,
189
- reportDrainRunaway,
190
- unregisterDisposer
191
- } from "./chunk-QKRPLZ2V.js";
182
+ adoptThenable
183
+ } from "./chunk-5HZXGZ6T.js";
192
184
  import {
193
185
  batch,
194
186
  enqueueBatchedSignal,
195
187
  external,
196
188
  isBatching,
197
189
  signal
198
- } from "./chunk-XZZOBQAY.js";
190
+ } from "./chunk-D33YTSX5.js";
199
191
  import {
200
192
  notifySubscribers,
201
193
  reactiveBinding,
@@ -206,19 +198,26 @@ import {
206
198
  suspendTracking,
207
199
  track,
208
200
  untracked
209
- } from "./chunk-UGRX3S57.js";
201
+ } from "./chunk-5Q4R7HCL.js";
210
202
  import {
211
203
  DEV,
204
+ MAX_DRAIN_TEARDOWNS,
212
205
  __export,
206
+ checkLeaks,
213
207
  devAssert,
214
208
  devWarn,
215
209
  devWarnLazy,
210
+ dispose,
216
211
  getRuntimeErrorHandler,
217
212
  isDev,
218
213
  normalizeError,
214
+ registerDisposer,
215
+ replaceChildrenSafely,
216
+ reportDrainRunaway,
219
217
  reportError,
220
- setRuntimeErrorHandler
221
- } from "./chunk-2WLZ6757.js";
218
+ setRuntimeErrorHandler,
219
+ unregisterDisposer
220
+ } from "./chunk-NYNYSPK7.js";
222
221
 
223
222
  // index.ts
224
223
  var index_exports = {};
@@ -1663,9 +1662,14 @@ var longPress = (element, options) => {
1663
1662
  };
1664
1663
  };
1665
1664
  var copyOnClick = (element, getText) => {
1665
+ const report = (error) => reportError(error, { phase: "async", name: "copyOnClick", node: element });
1666
1666
  const handler = () => {
1667
- const text2 = typeof getText === "function" ? getText() : element.textContent ?? "";
1668
- navigator.clipboard.writeText(text2);
1667
+ try {
1668
+ const text2 = typeof getText === "function" ? getText() : element.textContent ?? "";
1669
+ Promise.resolve(navigator.clipboard.writeText(text2)).catch(report);
1670
+ } catch (error) {
1671
+ report(error);
1672
+ }
1669
1673
  };
1670
1674
  element.addEventListener("click", handler);
1671
1675
  return () => element.removeEventListener("click", handler);
@@ -1751,6 +1755,52 @@ function setGlobalErrorHandler(handler) {
1751
1755
  globalErrorHandler = handler;
1752
1756
  }
1753
1757
 
1758
+ // src/core/rendering/context.ts
1759
+ function context(defaultValue) {
1760
+ const [getValue, setValue] = signal(defaultValue);
1761
+ const warnIfSSR = (method) => {
1762
+ if (!DEV || !isSSR()) return;
1763
+ devWarn(
1764
+ `context.${method}() called during SSR. SibuJS context() is application-global \u2014 it is NOT isolated per request, so a concurrent request can observe this value. Do not use context() for request-specific SSR data; pass it explicitly or use request-scoped storage instead.`
1765
+ );
1766
+ };
1767
+ const ctx = {
1768
+ provide(value) {
1769
+ warnIfSSR("provide");
1770
+ const previous = getValue();
1771
+ setValue(value);
1772
+ return () => setValue(previous);
1773
+ },
1774
+ use() {
1775
+ return getValue;
1776
+ },
1777
+ get() {
1778
+ return getValue();
1779
+ },
1780
+ set(value) {
1781
+ warnIfSSR("set");
1782
+ setValue(value);
1783
+ },
1784
+ withContext(value, fn) {
1785
+ warnIfSSR("withContext");
1786
+ const previous = getValue();
1787
+ setValue(value);
1788
+ try {
1789
+ const result = fn();
1790
+ if (DEV && result !== null && typeof result?.then === "function") {
1791
+ devWarn(
1792
+ "context.withContext() received an async callback. Scoping is synchronous only \u2014 the previous value is restored as soon as the callback returns its promise, so anything after an `await` runs outside the scope."
1793
+ );
1794
+ }
1795
+ return result;
1796
+ } finally {
1797
+ setValue(previous);
1798
+ }
1799
+ }
1800
+ };
1801
+ return ctx;
1802
+ }
1803
+
1754
1804
  // src/core/rendering/directives.ts
1755
1805
  function show(condition, element) {
1756
1806
  const resolved = typeof element === "function" ? element() : element;
@@ -1781,9 +1831,11 @@ function when(condition, thenBranch, elseBranch) {
1781
1831
  let currentNode = null;
1782
1832
  let lastCondition;
1783
1833
  let initialized = false;
1834
+ let disposed = false;
1784
1835
  const attachedOnce = /* @__PURE__ */ new WeakSet();
1785
1836
  let currentNodeOwned = false;
1786
1837
  const update = () => {
1838
+ if (disposed) return;
1787
1839
  const show2 = condition();
1788
1840
  const parent = anchor.parentNode;
1789
1841
  if (!parent) return;
@@ -1802,10 +1854,14 @@ function when(condition, thenBranch, elseBranch) {
1802
1854
  restoreFocusWithin(focused, currentNode ? [currentNode] : [], "when");
1803
1855
  initialized = true;
1804
1856
  };
1805
- registerDisposer(anchor, reactiveBinding(update, anchor));
1857
+ const stopBinding = reactiveBinding(update, anchor);
1858
+ registerDisposer(anchor, () => {
1859
+ disposed = true;
1860
+ stopBinding();
1861
+ });
1806
1862
  if (!initialized) {
1807
1863
  queueMicrotask(() => {
1808
- if (!initialized && anchor.parentNode) update();
1864
+ if (!disposed && !initialized && anchor.parentNode) update();
1809
1865
  });
1810
1866
  }
1811
1867
  return anchor;
@@ -1815,9 +1871,11 @@ function match(value, cases, fallback) {
1815
1871
  let currentNode = null;
1816
1872
  let lastKey;
1817
1873
  let initialized = false;
1874
+ let disposed = false;
1818
1875
  const attachedOnce = /* @__PURE__ */ new WeakSet();
1819
1876
  let currentNodeOwned = false;
1820
1877
  const update = () => {
1878
+ if (disposed) return;
1821
1879
  const key = String(value());
1822
1880
  const parent = anchor.parentNode;
1823
1881
  if (!parent) return;
@@ -1836,17 +1894,24 @@ function match(value, cases, fallback) {
1836
1894
  restoreFocusWithin(focused, currentNode ? [currentNode] : [], "match");
1837
1895
  initialized = true;
1838
1896
  };
1839
- registerDisposer(anchor, reactiveBinding(update, anchor));
1897
+ const stopBinding = reactiveBinding(update, anchor);
1898
+ registerDisposer(anchor, () => {
1899
+ disposed = true;
1900
+ stopBinding();
1901
+ });
1840
1902
  if (!initialized) {
1841
1903
  queueMicrotask(() => {
1842
- if (!initialized && anchor.parentNode) update();
1904
+ if (!disposed && !initialized && anchor.parentNode) update();
1843
1905
  });
1844
1906
  }
1845
1907
  return anchor;
1846
1908
  }
1847
1909
 
1848
1910
  // src/core/rendering/dynamic.ts
1849
- var componentRegistry = /* @__PURE__ */ new Map();
1911
+ var componentRegistry = globalSingleton(
1912
+ /* @__PURE__ */ Symbol.for("sibujs.components.registry.v1"),
1913
+ () => /* @__PURE__ */ new Map()
1914
+ );
1850
1915
  function registerComponent(name, component) {
1851
1916
  componentRegistry.set(name, component);
1852
1917
  }
@@ -1858,7 +1923,7 @@ function resolveComponent(name) {
1858
1923
  if (component) {
1859
1924
  return component();
1860
1925
  }
1861
- return div({ nodes: `[Component "${name}" not found]` });
1926
+ return div(`[Component "${name}" not found]`);
1862
1927
  }
1863
1928
  function DynamicComponent(is) {
1864
1929
  const container = div({ class: "sibu-dynamic" });
@@ -2677,10 +2742,15 @@ function Portal(nodes, target) {
2677
2742
 
2678
2743
  // src/core/rendering/slots.ts
2679
2744
  function getSlot(slots, name = "default") {
2680
- return slots?.[name];
2745
+ if (slots == null || !Object.hasOwn(slots, name)) return void 0;
2746
+ const slot2 = slots[name];
2747
+ return typeof slot2 === "function" ? slot2 : void 0;
2681
2748
  }
2682
2749
 
2683
2750
  // src/core/signals/array.ts
2751
+ function nativeSplice(target, start, rest) {
2752
+ return rest.length === 0 ? target.splice(start) : target.splice(start, ...rest);
2753
+ }
2684
2754
  function array(initial = []) {
2685
2755
  const [arr, setArr] = signal([...initial]);
2686
2756
  const actions = {
@@ -2708,12 +2778,12 @@ function array(initial = []) {
2708
2778
  unshift(...items) {
2709
2779
  setArr((prev) => [...items, ...prev]);
2710
2780
  },
2711
- splice(start, deleteCount = 0, ...items) {
2781
+ splice(start, ...rest) {
2712
2782
  let removed = [];
2713
2783
  setArr((prev) => {
2714
2784
  const copy = [...prev];
2715
- removed = copy.splice(start, deleteCount, ...items);
2716
- return copy;
2785
+ removed = nativeSplice(copy, start, rest);
2786
+ return removed.length === 0 && rest.length <= 1 ? prev : copy;
2717
2787
  });
2718
2788
  return removed;
2719
2789
  },
@@ -2796,9 +2866,9 @@ function reactiveArray(initial = []) {
2796
2866
  data2.unshift(...items);
2797
2867
  notify();
2798
2868
  },
2799
- splice(start, deleteCount = 0, ...items) {
2800
- const removed = data2.splice(start, deleteCount, ...items);
2801
- if (removed.length > 0 || items.length > 0) {
2869
+ splice(start, ...rest) {
2870
+ const removed = nativeSplice(data2, start, rest);
2871
+ if (removed.length > 0 || rest.length > 1) {
2802
2872
  notify();
2803
2873
  }
2804
2874
  return removed;
@@ -3020,6 +3090,21 @@ function deepEqual(a2, b2, seen) {
3020
3090
  if (a2.length !== b2.length) return false;
3021
3091
  return a2.every((val, i2) => deepEqual(val, b2[i2], seen));
3022
3092
  }
3093
+ if (a2 instanceof Number || a2 instanceof String || a2 instanceof Boolean) {
3094
+ return Object.is(a2.valueOf(), b2.valueOf());
3095
+ }
3096
+ if (typeof URL !== "undefined" && a2 instanceof URL) {
3097
+ return a2.href === b2.href;
3098
+ }
3099
+ if (a2 instanceof Error) {
3100
+ const eb = b2;
3101
+ return a2.name === eb.name && a2.message === eb.message && deepEqual(a2.cause, eb.cause, seen) && plainKeysEqual(objA, objB, seen);
3102
+ }
3103
+ const proto = Object.getPrototypeOf(objA);
3104
+ if (proto !== Object.prototype && proto !== null) return false;
3105
+ return plainKeysEqual(objA, objB, seen);
3106
+ }
3107
+ function plainKeysEqual(objA, objB, seen) {
3023
3108
  const keysA = Object.keys(objA);
3024
3109
  const keysB = Object.keys(objB);
3025
3110
  if (keysA.length !== keysB.length) return false;
@@ -3045,15 +3130,18 @@ function ref(initial) {
3045
3130
  }
3046
3131
 
3047
3132
  // src/core/signals/store.ts
3133
+ function defineOwn(obj, key, value) {
3134
+ Object.defineProperty(obj, key, { value, writable: true, enumerable: true, configurable: true });
3135
+ }
3048
3136
  function store(initialState) {
3049
3137
  devAssert(
3050
3138
  initialState !== null && typeof initialState === "object" && !Array.isArray(initialState),
3051
3139
  "store: argument must be a plain object. For arrays, use array() instead."
3052
3140
  );
3053
- const signals = {};
3141
+ const signals = /* @__PURE__ */ Object.create(null);
3054
3142
  Object.keys(initialState).forEach((key) => {
3055
3143
  const [getter, setter] = signal(initialState[key]);
3056
- signals[key] = [getter, setter];
3144
+ defineOwn(signals, key, [getter, setter]);
3057
3145
  });
3058
3146
  const store2 = new Proxy({}, {
3059
3147
  get(target, prop) {
@@ -3072,7 +3160,7 @@ function store(initialState) {
3072
3160
  const getSnapshot = () => {
3073
3161
  const snapshot = {};
3074
3162
  Object.keys(signals).forEach((key) => {
3075
- snapshot[key] = signals[key][0]();
3163
+ defineOwn(snapshot, key, signals[key][0]());
3076
3164
  });
3077
3165
  return snapshot;
3078
3166
  };
@@ -3213,9 +3301,7 @@ function resolveTarget(root, target) {
3213
3301
  }
3214
3302
  }
3215
3303
  function bindNode(el, commit) {
3216
- if (isSSR()) return () => {
3217
- };
3218
- return reactiveBinding(commit, el);
3304
+ return domBinding(commit, el);
3219
3305
  }
3220
3306
  function readControlValue(el) {
3221
3307
  if (el instanceof HTMLInputElement) {
@@ -3672,23 +3758,27 @@ function scheduleIdle(fn) {
3672
3758
  }
3673
3759
  function transition() {
3674
3760
  const [pending, setPending] = signal(false);
3761
+ let outstanding = 0;
3675
3762
  function start(fn) {
3763
+ outstanding++;
3676
3764
  setPending(true);
3765
+ let settled = false;
3766
+ const finish = () => {
3767
+ if (settled) return;
3768
+ settled = true;
3769
+ outstanding--;
3770
+ if (outstanding === 0) setPending(false);
3771
+ };
3772
+ const fail = (error) => {
3773
+ finish();
3774
+ reportError(error, { phase: "async", name: "transition" });
3775
+ };
3677
3776
  scheduleIdle(() => {
3678
- let result;
3679
3777
  try {
3680
- result = fn();
3681
- } catch {
3682
- setPending(false);
3683
- return;
3684
- }
3685
- if (result && typeof result.then === "function") {
3686
- result.then(
3687
- () => setPending(false),
3688
- () => setPending(false)
3689
- );
3690
- } else {
3691
- setPending(false);
3778
+ const adopted = adoptThenable(fn());
3779
+ adopted ? adopted.then(finish, fail) : finish();
3780
+ } catch (error) {
3781
+ fail(error);
3692
3782
  }
3693
3783
  });
3694
3784
  }
@@ -3729,6 +3819,7 @@ export {
3729
3819
  catchError,
3730
3820
  catchErrorAsync,
3731
3821
  setGlobalErrorHandler,
3822
+ context,
3732
3823
  show,
3733
3824
  when,
3734
3825
  match,
@@ -1,26 +1,24 @@
1
1
  import {
2
2
  stripHtml
3
- } from "./chunk-IXKSNWV5.js";
3
+ } from "./chunk-2INLLLMZ.js";
4
4
  import {
5
5
  globalSingleton
6
6
  } from "./chunk-7ZHH77QA.js";
7
7
  import {
8
8
  effect
9
- } from "./chunk-RIXRAYIU.js";
10
- import {
11
- dispose
12
- } from "./chunk-QKRPLZ2V.js";
9
+ } from "./chunk-XC4MEKGA.js";
13
10
  import {
14
11
  signal
15
- } from "./chunk-XZZOBQAY.js";
12
+ } from "./chunk-D33YTSX5.js";
16
13
  import {
17
14
  forEachSubscriber,
18
15
  getSubscriberCount,
19
16
  getSubscriberDeps
20
- } from "./chunk-UGRX3S57.js";
17
+ } from "./chunk-5Q4R7HCL.js";
21
18
  import {
19
+ dispose,
22
20
  isDev
23
- } from "./chunk-2WLZ6757.js";
21
+ } from "./chunk-NYNYSPK7.js";
24
22
 
25
23
  // src/devtools/debug.ts
26
24
  var debugEnabled = false;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __require,
3
3
  devWarn
4
- } from "./chunk-2WLZ6757.js";
4
+ } from "./chunk-NYNYSPK7.js";
5
5
 
6
6
  // src/core/ssr-context.ts
7
7
  var SSR_KEY = /* @__PURE__ */ Symbol.for("sibujs.ssr.v1");
@@ -74,16 +74,18 @@ function disableSSR() {
74
74
  getSSRStore().ssr = false;
75
75
  }
76
76
  function runInSSRContext(fn) {
77
- const store = { ssr: true, suspenseIdCounter: 0, locale: void 0 };
77
+ const store = { ssr: true, suspenseIdCounter: 0, idCounter: 0, locale: void 0 };
78
78
  if (als) {
79
79
  return als.run(store, fn);
80
80
  }
81
81
  warnMissingAsyncLocalStorage();
82
82
  const prevSSR = fallbackStore.ssr;
83
83
  const prevCounter = fallbackStore.suspenseIdCounter;
84
+ const prevIdCounter = fallbackStore.idCounter;
84
85
  const prevLocale = fallbackStore.locale;
85
86
  fallbackStore.ssr = true;
86
87
  fallbackStore.suspenseIdCounter = 0;
88
+ fallbackStore.idCounter = 0;
87
89
  fallbackStore.locale = void 0;
88
90
  _shared.fallbackDepth++;
89
91
  try {
@@ -92,6 +94,7 @@ function runInSSRContext(fn) {
92
94
  _shared.fallbackDepth--;
93
95
  fallbackStore.ssr = prevSSR;
94
96
  fallbackStore.suspenseIdCounter = prevCounter;
97
+ fallbackStore.idCounter = prevIdCounter;
95
98
  fallbackStore.locale = prevLocale;
96
99
  }
97
100
  }