sibujs 4.0.1 → 4.2.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 (80) hide show
  1. package/README.md +29 -1
  2. package/dist/browser.cjs +21 -22
  3. package/dist/browser.js +6 -6
  4. package/dist/build.cjs +363 -110
  5. package/dist/build.js +15 -15
  6. package/dist/cdn.dev.global.js +398 -0
  7. package/dist/cdn.global.js +10 -10
  8. package/dist/{chunk-AD5YSZAN.js → chunk-2LOYNGBY.js} +2 -2
  9. package/dist/{chunk-VPP2FONR.js → chunk-2WLZ6757.js} +17 -10
  10. package/dist/{chunk-UNAYBND2.js → chunk-3VTSPNC5.js} +2 -2
  11. package/dist/{chunk-TIRZCERI.js → chunk-5DXA2J44.js} +1 -1
  12. package/dist/{chunk-QD4I7ZGZ.js → chunk-6ZGI3RBE.js} +149 -33
  13. package/dist/{chunk-JYXQCELN.js → chunk-7ALC7KGE.js} +13 -7
  14. package/dist/{chunk-XDOMTQHM.js → chunk-7VEC3UD2.js} +3 -3
  15. package/dist/{chunk-PTLJ7NQX.js → chunk-BMYYZWHX.js} +3 -3
  16. package/dist/{chunk-PHB3MCK4.js → chunk-BNKV4REK.js} +7 -8
  17. package/dist/{chunk-XET2RUJF.js → chunk-FOWBJZDL.js} +7 -8
  18. package/dist/{chunk-5BVKQX2F.js → chunk-GDUNQCCW.js} +4 -4
  19. package/dist/{chunk-TVURNWDK.js → chunk-HECVW343.js} +20 -9
  20. package/dist/{chunk-PHRH66Y7.js → chunk-HJEPKZ2O.js} +7 -8
  21. package/dist/{chunk-PJDSI2K7.js → chunk-HZEBO22J.js} +125 -42
  22. package/dist/{chunk-5INI7D2L.js → chunk-IXKSNWV5.js} +74 -11
  23. package/dist/{chunk-IKVUUE7D.js → chunk-KE4KWRDY.js} +3 -3
  24. package/dist/{chunk-AW6HPJ3L.js → chunk-KKLW7YWL.js} +1 -1
  25. package/dist/{chunk-XZMCVZW6.js → chunk-NEYWS4EX.js} +6 -6
  26. package/dist/{chunk-HYCCIYNS.js → chunk-NIOYEGBQ.js} +13 -14
  27. package/dist/{chunk-YLV26GAJ.js → chunk-OUWAIXIK.js} +3 -3
  28. package/dist/{chunk-E72G5JSK.js → chunk-P3DHXBR6.js} +1 -1
  29. package/dist/{chunk-J4WZMCIW.js → chunk-QCFLDD7C.js} +5 -5
  30. package/dist/{chunk-DHDZ7IVN.js → chunk-QKRPLZ2V.js} +7 -8
  31. package/dist/{chunk-52ERIVFD.js → chunk-QL4UREZO.js} +6 -6
  32. package/dist/{chunk-TNEHT3NG.js → chunk-SF3TB4K6.js} +8 -8
  33. package/dist/{chunk-HPXTUPJD.js → chunk-XZ2N525U.js} +6 -6
  34. package/dist/{customElement-CKLoO63w.d.ts → customElement-CNZxEB9G.d.cts} +77 -0
  35. package/dist/{customElement-CKLoO63w.d.cts → customElement-CNZxEB9G.d.ts} +77 -0
  36. package/dist/data.cjs +23 -25
  37. package/dist/data.js +9 -9
  38. package/dist/devtools.cjs +26 -23
  39. package/dist/devtools.d.cts +1 -1
  40. package/dist/devtools.d.ts +1 -1
  41. package/dist/devtools.js +8 -8
  42. package/dist/{dispose-4FZ6OFXR.js → dispose-46BOMMQJ.js} +2 -2
  43. package/dist/ecosystem.cjs +230 -68
  44. package/dist/ecosystem.js +11 -11
  45. package/dist/extras.cjs +251 -87
  46. package/dist/extras.d.cts +2 -2
  47. package/dist/extras.d.ts +2 -2
  48. package/dist/extras.js +25 -25
  49. package/dist/index.cjs +358 -104
  50. package/dist/index.d.cts +287 -34
  51. package/dist/index.d.ts +287 -34
  52. package/dist/index.js +17 -15
  53. package/dist/{introspect-RjLfIFpL.d.cts → introspect-D5xF-0Es.d.cts} +7 -0
  54. package/dist/{introspect-DOZfmC-4.d.ts → introspect-rSBIxEQi.d.ts} +7 -0
  55. package/dist/motion.cjs +21 -23
  56. package/dist/motion.js +5 -5
  57. package/dist/patterns.cjs +24 -25
  58. package/dist/patterns.d.cts +8 -0
  59. package/dist/patterns.d.ts +8 -0
  60. package/dist/patterns.js +7 -7
  61. package/dist/performance.cjs +24 -28
  62. package/dist/performance.js +9 -9
  63. package/dist/plugins.cjs +268 -87
  64. package/dist/plugins.d.cts +92 -0
  65. package/dist/plugins.d.ts +92 -0
  66. package/dist/plugins.js +18 -17
  67. package/dist/{ssr-JFP5535P.js → ssr-Y7XOEPEN.js} +5 -5
  68. package/dist/ssr.cjs +241 -80
  69. package/dist/ssr.js +12 -12
  70. package/dist/testing.cjs +19 -20
  71. package/dist/testing.js +5 -5
  72. package/dist/ui.cjs +106 -44
  73. package/dist/ui.d.cts +7 -1
  74. package/dist/ui.d.ts +7 -1
  75. package/dist/ui.js +10 -10
  76. package/dist/widgets.cjs +21 -22
  77. package/dist/widgets.d.cts +8 -0
  78. package/dist/widgets.d.ts +8 -0
  79. package/dist/widgets.js +9 -9
  80. package/package.json +11 -2
package/dist/motion.cjs CHANGED
@@ -45,18 +45,12 @@ __export(motion_exports, {
45
45
  module.exports = __toCommonJS(motion_exports);
46
46
 
47
47
  // src/core/dev.ts
48
- function isDev() {
49
- return typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : (
50
- // The bare `__SIBU_DEV__` is a bundler define that only exists in
51
- // production builds; under the test runner it is always undefined, so
52
- // this branch is unreachable here.
53
- /* v8 ignore next 2 */
54
- typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
55
- );
56
- }
57
- var _isDev = isDev();
48
+ var DEV = typeof __SIBU_DEV__ !== "undefined" ? !!__SIBU_DEV__ : typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : (
49
+ // safe default: off in browser, on in test/dev Node
50
+ typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
51
+ );
58
52
  function devWarn(message) {
59
- if (_isDev) {
53
+ if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
60
54
  console.warn(`[SibuJS] ${message}`);
61
55
  }
62
56
  }
@@ -151,7 +145,6 @@ function reportError(error, context) {
151
145
 
152
146
  // src/core/rendering/dispose.ts
153
147
  var elementDisposers = /* @__PURE__ */ new WeakMap();
154
- var _isDev2 = isDev();
155
148
  var activeBindingCount = 0;
156
149
  function registerDisposer(node, teardown) {
157
150
  let disposers = elementDisposers.get(node);
@@ -160,7 +153,7 @@ function registerDisposer(node, teardown) {
160
153
  elementDisposers.set(node, disposers);
161
154
  }
162
155
  disposers.push(teardown);
163
- if (_isDev2) activeBindingCount++;
156
+ if (DEV) activeBindingCount++;
164
157
  }
165
158
 
166
159
  // src/ui/transition.ts
@@ -469,7 +462,14 @@ function reactiveBinding(commit, ownerNode) {
469
462
  subscriber._disposed = false;
470
463
  subscriber._errorPhase = "binding";
471
464
  subscriber._errorNode = ownerNode;
472
- run();
465
+ try {
466
+ run();
467
+ } catch (err) {
468
+ subscriber._disposed = true;
469
+ subscriber._errorNode = void 0;
470
+ cleanup(subscriber);
471
+ throw err;
472
+ }
473
473
  return subscriber._dispose ?? (subscriber._dispose = () => {
474
474
  subscriber._disposed = true;
475
475
  subscriber._errorNode = void 0;
@@ -700,17 +700,16 @@ function forEachSubscriber(signal2, visit) {
700
700
  }
701
701
 
702
702
  // src/reactivity/track.ts
703
- var _isDev3 = isDev();
704
- var _runtimeVersion = true ? "4.0.1" : "dev";
703
+ var _runtimeVersion = true ? "4.2.0" : "dev";
705
704
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
706
705
  function resolveReactiveApi() {
707
706
  const g = globalThis;
708
707
  const existing = g[REGISTRY_KEY];
709
708
  if (existing) {
710
- if (_isDev3 && !existing.__dupWarned) {
709
+ if (DEV && !existing.__dupWarned) {
711
710
  existing.__dupWarned = true;
712
711
  devWarn(
713
- `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']).`
712
+ `Multiple instances of the reactive runtime detected on this page (active: ${existing.version}, duplicate: ${_runtimeVersion}). Reactivity is NOT broken and no bundler configuration is required: every copy routes through the first one via a global registry, so signal writes still reach subscribers registered by any copy. This is only a SIZE issue \u2014 the duplicate copy's bytes are downloaded and parsed for nothing. If you want them back, de-duplicate sibujs in your bundler (Vite: resolve.dedupe: ['sibujs']). Mismatched VERSIONS above are worth fixing regardless, since only the first one loaded is used.`
714
713
  );
715
714
  }
716
715
  return existing;
@@ -809,7 +808,6 @@ var isBatching = API2.isBatching;
809
808
 
810
809
  // src/core/signals/signal.ts
811
810
  var _g = globalThis;
812
- var _isDev4 = isDev();
813
811
  function signal(initial, options) {
814
812
  const state2 = {
815
813
  value: initial,
@@ -822,7 +820,7 @@ function signal(initial, options) {
822
820
  _d: false,
823
821
  _validate: void 0
824
822
  };
825
- const debugName = _isDev4 ? options?.name : void 0;
823
+ const debugName = DEV ? options?.name : void 0;
826
824
  const equalsFn = options?.equals;
827
825
  if (debugName) state2.__name = debugName;
828
826
  function get() {
@@ -839,7 +837,7 @@ function signal(initial, options) {
839
837
  if (equalsFn(prev, newValue)) return;
840
838
  state2.value = newValue;
841
839
  state2.__v++;
842
- if (_isDev4) {
840
+ if (DEV) {
843
841
  const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
844
842
  if (hook) hook.emit("signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
845
843
  }
@@ -847,7 +845,7 @@ function signal(initial, options) {
847
845
  notifySubscribers2(state2);
848
846
  }
849
847
  };
850
- } else if (_isDev4) {
848
+ } else if (DEV) {
851
849
  set = (next) => {
852
850
  const prev = state2.value;
853
851
  const newValue = typeof next === "function" ? next(prev) : next;
@@ -872,7 +870,7 @@ function signal(initial, options) {
872
870
  }
873
871
  };
874
872
  }
875
- if (_isDev4) {
873
+ if (DEV) {
876
874
  const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
877
875
  if (hook) hook.emit("signal:create", { signal: state2, name: debugName, getter: get, initial });
878
876
  }
package/dist/motion.js CHANGED
@@ -20,11 +20,11 @@ import {
20
20
  stagger,
21
21
  transition,
22
22
  viewTransition
23
- } from "./chunk-UNAYBND2.js";
24
- import "./chunk-DHDZ7IVN.js";
25
- import "./chunk-TVURNWDK.js";
26
- import "./chunk-JYXQCELN.js";
27
- import "./chunk-VPP2FONR.js";
23
+ } from "./chunk-3VTSPNC5.js";
24
+ import "./chunk-QKRPLZ2V.js";
25
+ import "./chunk-HECVW343.js";
26
+ import "./chunk-7ALC7KGE.js";
27
+ import "./chunk-2WLZ6757.js";
28
28
  export {
29
29
  TransitionGroup,
30
30
  animate,
package/dist/patterns.cjs CHANGED
@@ -44,23 +44,17 @@ __export(patterns_exports, {
44
44
  module.exports = __toCommonJS(patterns_exports);
45
45
 
46
46
  // src/core/dev.ts
47
- function isDev() {
48
- return typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : (
49
- // The bare `__SIBU_DEV__` is a bundler define that only exists in
50
- // production builds; under the test runner it is always undefined, so
51
- // this branch is unreachable here.
52
- /* v8 ignore next 2 */
53
- typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
54
- );
55
- }
56
- var _isDev = isDev();
47
+ var DEV = typeof __SIBU_DEV__ !== "undefined" ? !!__SIBU_DEV__ : typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : (
48
+ // safe default: off in browser, on in test/dev Node
49
+ typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
50
+ );
57
51
  function devAssert(condition, message) {
58
- if (_isDev && !condition) {
52
+ if ((typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) && !condition) {
59
53
  throw new Error(`[SibuJS] ${message}`);
60
54
  }
61
55
  }
62
56
  function devWarn(message) {
63
- if (_isDev) {
57
+ if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
64
58
  console.warn(`[SibuJS] ${message}`);
65
59
  }
66
60
  }
@@ -371,7 +365,14 @@ function reactiveBinding(commit, ownerNode) {
371
365
  subscriber._disposed = false;
372
366
  subscriber._errorPhase = "binding";
373
367
  subscriber._errorNode = ownerNode;
374
- run();
368
+ try {
369
+ run();
370
+ } catch (err) {
371
+ subscriber._disposed = true;
372
+ subscriber._errorNode = void 0;
373
+ cleanup(subscriber);
374
+ throw err;
375
+ }
375
376
  return subscriber._dispose ?? (subscriber._dispose = () => {
376
377
  subscriber._disposed = true;
377
378
  subscriber._errorNode = void 0;
@@ -602,17 +603,16 @@ function forEachSubscriber(signal2, visit) {
602
603
  }
603
604
 
604
605
  // src/reactivity/track.ts
605
- var _isDev2 = isDev();
606
- var _runtimeVersion = true ? "4.0.1" : "dev";
606
+ var _runtimeVersion = true ? "4.2.0" : "dev";
607
607
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
608
608
  function resolveReactiveApi() {
609
609
  const g = globalThis;
610
610
  const existing = g[REGISTRY_KEY];
611
611
  if (existing) {
612
- if (_isDev2 && !existing.__dupWarned) {
612
+ if (DEV && !existing.__dupWarned) {
613
613
  existing.__dupWarned = true;
614
614
  devWarn(
615
- `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']).`
615
+ `Multiple instances of the reactive runtime detected on this page (active: ${existing.version}, duplicate: ${_runtimeVersion}). Reactivity is NOT broken and no bundler configuration is required: every copy routes through the first one via a global registry, so signal writes still reach subscribers registered by any copy. This is only a SIZE issue \u2014 the duplicate copy's bytes are downloaded and parsed for nothing. If you want them back, de-duplicate sibujs in your bundler (Vite: resolve.dedupe: ['sibujs']). Mismatched VERSIONS above are worth fixing regardless, since only the first one loaded is used.`
616
616
  );
617
617
  }
618
618
  return existing;
@@ -711,7 +711,6 @@ var isBatching = API2.isBatching;
711
711
 
712
712
  // src/core/signals/signal.ts
713
713
  var _g = globalThis;
714
- var _isDev3 = isDev();
715
714
  function signal(initial, options) {
716
715
  const state2 = {
717
716
  value: initial,
@@ -724,7 +723,7 @@ function signal(initial, options) {
724
723
  _d: false,
725
724
  _validate: void 0
726
725
  };
727
- const debugName = _isDev3 ? options?.name : void 0;
726
+ const debugName = DEV ? options?.name : void 0;
728
727
  const equalsFn = options?.equals;
729
728
  if (debugName) state2.__name = debugName;
730
729
  function get() {
@@ -741,7 +740,7 @@ function signal(initial, options) {
741
740
  if (equalsFn(prev, newValue)) return;
742
741
  state2.value = newValue;
743
742
  state2.__v++;
744
- if (_isDev3) {
743
+ if (DEV) {
745
744
  const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
746
745
  if (hook) hook.emit("signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
747
746
  }
@@ -749,7 +748,7 @@ function signal(initial, options) {
749
748
  notifySubscribers2(state2);
750
749
  }
751
750
  };
752
- } else if (_isDev3) {
751
+ } else if (DEV) {
753
752
  set = (next) => {
754
753
  const prev = state2.value;
755
754
  const newValue = typeof next === "function" ? next(prev) : next;
@@ -774,7 +773,7 @@ function signal(initial, options) {
774
773
  }
775
774
  };
776
775
  }
777
- if (_isDev3) {
776
+ if (DEV) {
778
777
  const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
779
778
  if (hook) hook.emit("signal:create", { signal: state2, name: debugName, getter: get, initial });
780
779
  }
@@ -1703,13 +1702,13 @@ var validators = {
1703
1702
  function validateProps(props, schema) {
1704
1703
  const result = { ...props };
1705
1704
  const errors = [];
1706
- const isDev2 = typeof process === "undefined" || process?.env?.NODE_ENV !== "production";
1705
+ const isDev = typeof process === "undefined" || process?.env?.NODE_ENV !== "production";
1707
1706
  for (const [key, def] of Object.entries(schema)) {
1708
1707
  const propDef = typeof def === "function" ? { type: def } : def;
1709
1708
  if (result[key] == null && propDef.default !== void 0) {
1710
1709
  result[key] = typeof propDef.default === "function" ? propDef.default() : propDef.default;
1711
1710
  }
1712
- if (!isDev2) continue;
1711
+ if (!isDev) continue;
1713
1712
  if (propDef.required && result[key] == null) {
1714
1713
  errors.push(`Prop '${key}' is required`);
1715
1714
  continue;
@@ -1724,7 +1723,7 @@ function validateProps(props, schema) {
1724
1723
  if (validResult !== true) errors.push(validResult);
1725
1724
  }
1726
1725
  }
1727
- if (errors.length > 0 && isDev2) {
1726
+ if (errors.length > 0 && isDev) {
1728
1727
  console.warn(`[SibuJS] Prop validation errors:
1729
1728
  ${errors.map((e) => ` - ${e}`).join("\n")}`);
1730
1729
  }
@@ -94,6 +94,14 @@ interface PersistOptions<T = unknown> {
94
94
  * Must be synchronous — see `encrypt` docs. */
95
95
  decrypt?: (value: string) => string;
96
96
  }
97
+ /**
98
+ * A signal mirrored into persistent storage, rehydrated on creation.
99
+ *
100
+ * @param key Storage key.
101
+ * @param initial Value used when storage holds nothing (or holds junk).
102
+ * @param options Storage backend, serializer and version/migration settings.
103
+ * @returns A `[accessor, setter]` pair with the same shape as `signal`.
104
+ */
97
105
  declare function persisted<T>(key: string, initial: T, options?: PersistOptions<T>): [() => T, (next: T | ((prev: T) => T)) => void];
98
106
 
99
107
  /**
@@ -94,6 +94,14 @@ interface PersistOptions<T = unknown> {
94
94
  * Must be synchronous — see `encrypt` docs. */
95
95
  decrypt?: (value: string) => string;
96
96
  }
97
+ /**
98
+ * A signal mirrored into persistent storage, rehydrated on creation.
99
+ *
100
+ * @param key Storage key.
101
+ * @param initial Value used when storage holds nothing (or holds junk).
102
+ * @param options Storage backend, serializer and version/migration settings.
103
+ * @returns A `[accessor, setter]` pair with the same shape as `signal`.
104
+ */
97
105
  declare function persisted<T>(key: string, initial: T, options?: PersistOptions<T>): [() => T, (next: T | ((prev: T) => T)) => void];
98
106
 
99
107
  /**
package/dist/patterns.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  optimisticList,
6
6
  persisted,
7
7
  timeline
8
- } from "./chunk-YLV26GAJ.js";
8
+ } from "./chunk-OUWAIXIK.js";
9
9
  import {
10
10
  RenderProp,
11
11
  assertType,
@@ -23,12 +23,12 @@ import {
23
23
  withWrapper
24
24
  } from "./chunk-VJE6DDYM.js";
25
25
  import "./chunk-H3SRKIYX.js";
26
- import "./chunk-AD5YSZAN.js";
27
- import "./chunk-XDOMTQHM.js";
28
- import "./chunk-TIRZCERI.js";
29
- import "./chunk-TVURNWDK.js";
30
- import "./chunk-JYXQCELN.js";
31
- import "./chunk-VPP2FONR.js";
26
+ import "./chunk-2LOYNGBY.js";
27
+ import "./chunk-7VEC3UD2.js";
28
+ import "./chunk-5DXA2J44.js";
29
+ import "./chunk-HECVW343.js";
30
+ import "./chunk-7ALC7KGE.js";
31
+ import "./chunk-2WLZ6757.js";
32
32
  export {
33
33
  RenderProp,
34
34
  assertType,
@@ -231,23 +231,17 @@ async function processInChunks(items, processor, chunkSize = 50) {
231
231
  }
232
232
 
233
233
  // src/core/dev.ts
234
- function isDev() {
235
- return typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : (
236
- // The bare `__SIBU_DEV__` is a bundler define that only exists in
237
- // production builds; under the test runner it is always undefined, so
238
- // this branch is unreachable here.
239
- /* v8 ignore next 2 */
240
- typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
241
- );
242
- }
243
- var _isDev = isDev();
234
+ var DEV = typeof __SIBU_DEV__ !== "undefined" ? !!__SIBU_DEV__ : typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : (
235
+ // safe default: off in browser, on in test/dev Node
236
+ typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
237
+ );
244
238
  function devAssert(condition, message) {
245
- if (_isDev && !condition) {
239
+ if ((typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) && !condition) {
246
240
  throw new Error(`[SibuJS] ${message}`);
247
241
  }
248
242
  }
249
243
  function devWarn(message) {
250
- if (_isDev) {
244
+ if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
251
245
  console.warn(`[SibuJS] ${message}`);
252
246
  }
253
247
  }
@@ -558,7 +552,14 @@ function reactiveBinding(commit, ownerNode) {
558
552
  subscriber._disposed = false;
559
553
  subscriber._errorPhase = "binding";
560
554
  subscriber._errorNode = ownerNode;
561
- run();
555
+ try {
556
+ run();
557
+ } catch (err) {
558
+ subscriber._disposed = true;
559
+ subscriber._errorNode = void 0;
560
+ cleanup(subscriber);
561
+ throw err;
562
+ }
562
563
  return subscriber._dispose ?? (subscriber._dispose = () => {
563
564
  subscriber._disposed = true;
564
565
  subscriber._errorNode = void 0;
@@ -789,17 +790,16 @@ function forEachSubscriber(signal2, visit) {
789
790
  }
790
791
 
791
792
  // src/reactivity/track.ts
792
- var _isDev2 = isDev();
793
- var _runtimeVersion = true ? "4.0.1" : "dev";
793
+ var _runtimeVersion = true ? "4.2.0" : "dev";
794
794
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
795
795
  function resolveReactiveApi() {
796
796
  const g = globalThis;
797
797
  const existing = g[REGISTRY_KEY];
798
798
  if (existing) {
799
- if (_isDev2 && !existing.__dupWarned) {
799
+ if (DEV && !existing.__dupWarned) {
800
800
  existing.__dupWarned = true;
801
801
  devWarn(
802
- `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']).`
802
+ `Multiple instances of the reactive runtime detected on this page (active: ${existing.version}, duplicate: ${_runtimeVersion}). Reactivity is NOT broken and no bundler configuration is required: every copy routes through the first one via a global registry, so signal writes still reach subscribers registered by any copy. This is only a SIZE issue \u2014 the duplicate copy's bytes are downloaded and parsed for nothing. If you want them back, de-duplicate sibujs in your bundler (Vite: resolve.dedupe: ['sibujs']). Mismatched VERSIONS above are worth fixing regardless, since only the first one loaded is used.`
803
803
  );
804
804
  }
805
805
  return existing;
@@ -1061,7 +1061,6 @@ var isBatching = API2.isBatching;
1061
1061
 
1062
1062
  // src/core/signals/signal.ts
1063
1063
  var _g2 = globalThis;
1064
- var _isDev3 = isDev();
1065
1064
  function signal(initial, options) {
1066
1065
  const state2 = {
1067
1066
  value: initial,
@@ -1074,7 +1073,7 @@ function signal(initial, options) {
1074
1073
  _d: false,
1075
1074
  _validate: void 0
1076
1075
  };
1077
- const debugName = _isDev3 ? options?.name : void 0;
1076
+ const debugName = DEV ? options?.name : void 0;
1078
1077
  const equalsFn = options?.equals;
1079
1078
  if (debugName) state2.__name = debugName;
1080
1079
  function get() {
@@ -1091,7 +1090,7 @@ function signal(initial, options) {
1091
1090
  if (equalsFn(prev, newValue)) return;
1092
1091
  state2.value = newValue;
1093
1092
  state2.__v++;
1094
- if (_isDev3) {
1093
+ if (DEV) {
1095
1094
  const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
1096
1095
  if (hook) hook.emit("signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
1097
1096
  }
@@ -1099,7 +1098,7 @@ function signal(initial, options) {
1099
1098
  notifySubscribers2(state2);
1100
1099
  }
1101
1100
  };
1102
- } else if (_isDev3) {
1101
+ } else if (DEV) {
1103
1102
  set = (next) => {
1104
1103
  const prev = state2.value;
1105
1104
  const newValue = typeof next === "function" ? next(prev) : next;
@@ -1124,7 +1123,7 @@ function signal(initial, options) {
1124
1123
  }
1125
1124
  };
1126
1125
  }
1127
- if (_isDev3) {
1126
+ if (DEV) {
1128
1127
  const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
1129
1128
  if (hook) hook.emit("signal:create", { signal: state2, name: debugName, getter: get, initial });
1130
1129
  }
@@ -1182,7 +1181,6 @@ function reportDrainRunaway(label, executed, remaining) {
1182
1181
  { executed, remaining }
1183
1182
  );
1184
1183
  }
1185
- var _isDev4 = isDev();
1186
1184
  var activeBindingCount = 0;
1187
1185
  function dispose(node) {
1188
1186
  const stack = [node];
@@ -1205,13 +1203,13 @@ function dispose(node) {
1205
1203
  if (!pending || pending.length === 0) break;
1206
1204
  const snapshot = pending.slice();
1207
1205
  elementDisposers.delete(current);
1208
- if (_isDev4) activeBindingCount -= snapshot.length;
1206
+ if (DEV) activeBindingCount -= snapshot.length;
1209
1207
  for (let i2 = 0; i2 < snapshot.length; i2++) {
1210
1208
  if (executed >= MAX_DRAIN_TEARDOWNS) {
1211
1209
  const rest = snapshot.slice(i2);
1212
1210
  const added = elementDisposers.get(current);
1213
1211
  elementDisposers.set(current, added ? rest.concat(added) : rest);
1214
- if (_isDev4) activeBindingCount += rest.length;
1212
+ if (DEV) activeBindingCount += rest.length;
1215
1213
  reportDrainRunaway("dispose", executed, rest.length + (added?.length ?? 0));
1216
1214
  runaway = true;
1217
1215
  break;
@@ -1267,7 +1265,6 @@ function sanitizeUrl(url) {
1267
1265
  }
1268
1266
 
1269
1267
  // src/performance/domRecycler.ts
1270
- var _isDev5 = isDev();
1271
1268
  var DOMPool = class {
1272
1269
  constructor(maxSize = 50) {
1273
1270
  this.pools = /* @__PURE__ */ new Map();
@@ -1294,7 +1291,7 @@ var DOMPool = class {
1294
1291
  * is almost certainly a bug.
1295
1292
  */
1296
1293
  release(element) {
1297
- if (_isDev5 && element.isConnected) {
1294
+ if (DEV && element.isConnected) {
1298
1295
  devWarn(
1299
1296
  "DOMPool.release() called on a still-connected element. Detach it from the DOM first (remove() / dispose())."
1300
1297
  );
@@ -1406,7 +1403,6 @@ function noSideEffect(fn) {
1406
1403
  }
1407
1404
 
1408
1405
  // src/platform/ssr.ts
1409
- var _isDev6 = isDev();
1410
1406
  function trustHTML(html) {
1411
1407
  return html;
1412
1408
  }
@@ -33,18 +33,18 @@ import {
33
33
  transitionState,
34
34
  uniqueId,
35
35
  yieldToMain
36
- } from "./chunk-PHB3MCK4.js";
36
+ } from "./chunk-BNKV4REK.js";
37
37
  import {
38
38
  trustHTML
39
- } from "./chunk-HYCCIYNS.js";
40
- import "./chunk-5INI7D2L.js";
39
+ } from "./chunk-NIOYEGBQ.js";
40
+ import "./chunk-IXKSNWV5.js";
41
41
  import "./chunk-7ZHH77QA.js";
42
- import "./chunk-XDOMTQHM.js";
43
- import "./chunk-TIRZCERI.js";
44
- import "./chunk-DHDZ7IVN.js";
45
- import "./chunk-TVURNWDK.js";
46
- import "./chunk-JYXQCELN.js";
47
- import "./chunk-VPP2FONR.js";
42
+ import "./chunk-7VEC3UD2.js";
43
+ import "./chunk-5DXA2J44.js";
44
+ import "./chunk-QKRPLZ2V.js";
45
+ import "./chunk-HECVW343.js";
46
+ import "./chunk-7ALC7KGE.js";
47
+ import "./chunk-2WLZ6757.js";
48
48
  export {
49
49
  DOMPool,
50
50
  Features,