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
@@ -1,22 +1,22 @@
1
1
  import {
2
2
  watch
3
- } from "./chunk-PTLJ7NQX.js";
3
+ } from "./chunk-BMYYZWHX.js";
4
4
  import {
5
5
  createId
6
6
  } from "./chunk-CCSJMTRN.js";
7
7
  import {
8
8
  derived
9
- } from "./chunk-AD5YSZAN.js";
9
+ } from "./chunk-2LOYNGBY.js";
10
10
  import {
11
11
  stripHtml
12
- } from "./chunk-5INI7D2L.js";
12
+ } from "./chunk-IXKSNWV5.js";
13
13
  import {
14
14
  effect
15
- } from "./chunk-XDOMTQHM.js";
15
+ } from "./chunk-7VEC3UD2.js";
16
16
  import {
17
17
  batch,
18
18
  signal
19
- } from "./chunk-TVURNWDK.js";
19
+ } from "./chunk-HECVW343.js";
20
20
 
21
21
  // src/widgets/Combobox.ts
22
22
  var boundComboboxes = /* @__PURE__ */ new WeakMap();
@@ -1,8 +1,8 @@
1
1
  import {
2
+ DEV,
2
3
  devWarn,
3
- isDev,
4
4
  reportError
5
- } from "./chunk-VPP2FONR.js";
5
+ } from "./chunk-2WLZ6757.js";
6
6
 
7
7
  // src/core/rendering/dispose.ts
8
8
  var elementDisposers = /* @__PURE__ */ new WeakMap();
@@ -14,7 +14,6 @@ function reportDrainRunaway(label, executed, remaining) {
14
14
  { executed, remaining }
15
15
  );
16
16
  }
17
- var _isDev = isDev();
18
17
  var activeBindingCount = 0;
19
18
  function registerDisposer(node, teardown) {
20
19
  let disposers = elementDisposers.get(node);
@@ -23,7 +22,7 @@ function registerDisposer(node, teardown) {
23
22
  elementDisposers.set(node, disposers);
24
23
  }
25
24
  disposers.push(teardown);
26
- if (_isDev) activeBindingCount++;
25
+ if (DEV) activeBindingCount++;
27
26
  }
28
27
  function unregisterDisposer(node, teardown) {
29
28
  const disposers = elementDisposers.get(node);
@@ -31,7 +30,7 @@ function unregisterDisposer(node, teardown) {
31
30
  const index = disposers.indexOf(teardown);
32
31
  if (index === -1) return;
33
32
  disposers.splice(index, 1);
34
- if (_isDev) activeBindingCount--;
33
+ if (DEV) activeBindingCount--;
35
34
  if (disposers.length === 0) elementDisposers.delete(node);
36
35
  }
37
36
  function dispose(node) {
@@ -55,13 +54,13 @@ function dispose(node) {
55
54
  if (!pending || pending.length === 0) break;
56
55
  const snapshot = pending.slice();
57
56
  elementDisposers.delete(current);
58
- if (_isDev) activeBindingCount -= snapshot.length;
57
+ if (DEV) activeBindingCount -= snapshot.length;
59
58
  for (let i2 = 0; i2 < snapshot.length; i2++) {
60
59
  if (executed >= MAX_DRAIN_TEARDOWNS) {
61
60
  const rest = snapshot.slice(i2);
62
61
  const added = elementDisposers.get(current);
63
62
  elementDisposers.set(current, added ? rest.concat(added) : rest);
64
- if (_isDev) activeBindingCount += rest.length;
63
+ if (DEV) activeBindingCount += rest.length;
65
64
  reportDrainRunaway("dispose", executed, rest.length + (added?.length ?? 0));
66
65
  runaway = true;
67
66
  break;
@@ -89,7 +88,7 @@ function replaceChildrenSafely(parent, ...next) {
89
88
  parent.replaceChildren(...next);
90
89
  }
91
90
  function checkLeaks(warnThreshold = 0) {
92
- if (!_isDev) return 0;
91
+ if (!DEV) return 0;
93
92
  if (warnThreshold > 0 && activeBindingCount > warnThreshold) {
94
93
  devWarn(
95
94
  `checkLeaks: ${activeBindingCount} active DOM bindings detected. Expected \u2264${warnThreshold}. This may indicate a component was removed from the DOM without calling dispose().`
@@ -1,26 +1,26 @@
1
1
  import {
2
2
  stripHtml
3
- } from "./chunk-5INI7D2L.js";
3
+ } from "./chunk-IXKSNWV5.js";
4
4
  import {
5
5
  globalSingleton
6
6
  } from "./chunk-7ZHH77QA.js";
7
7
  import {
8
8
  effect
9
- } from "./chunk-XDOMTQHM.js";
9
+ } from "./chunk-7VEC3UD2.js";
10
10
  import {
11
11
  dispose
12
- } from "./chunk-DHDZ7IVN.js";
12
+ } from "./chunk-QKRPLZ2V.js";
13
13
  import {
14
14
  signal
15
- } from "./chunk-TVURNWDK.js";
15
+ } from "./chunk-HECVW343.js";
16
16
  import {
17
17
  forEachSubscriber,
18
18
  getSubscriberCount,
19
19
  getSubscriberDeps
20
- } from "./chunk-JYXQCELN.js";
20
+ } from "./chunk-7ALC7KGE.js";
21
21
  import {
22
22
  isDev
23
- } from "./chunk-VPP2FONR.js";
23
+ } from "./chunk-2WLZ6757.js";
24
24
 
25
25
  // src/devtools/debug.ts
26
26
  var debugEnabled = false;
@@ -1,33 +1,33 @@
1
1
  import {
2
2
  bindAttribute,
3
3
  setSafeAttribute
4
- } from "./chunk-PHRH66Y7.js";
4
+ } from "./chunk-HJEPKZ2O.js";
5
5
  import {
6
6
  derived
7
- } from "./chunk-AD5YSZAN.js";
7
+ } from "./chunk-2LOYNGBY.js";
8
8
  import {
9
9
  isEventHandlerAttr
10
- } from "./chunk-5INI7D2L.js";
10
+ } from "./chunk-IXKSNWV5.js";
11
11
  import {
12
12
  globalSingleton
13
13
  } from "./chunk-7ZHH77QA.js";
14
14
  import {
15
15
  effect
16
- } from "./chunk-XDOMTQHM.js";
16
+ } from "./chunk-7VEC3UD2.js";
17
17
  import {
18
18
  dispose,
19
19
  registerDisposer,
20
20
  replaceChildrenSafely
21
- } from "./chunk-DHDZ7IVN.js";
21
+ } from "./chunk-QKRPLZ2V.js";
22
22
  import {
23
23
  signal
24
- } from "./chunk-TVURNWDK.js";
24
+ } from "./chunk-HECVW343.js";
25
25
  import {
26
26
  track
27
- } from "./chunk-JYXQCELN.js";
27
+ } from "./chunk-7ALC7KGE.js";
28
28
  import {
29
29
  reportError
30
- } from "./chunk-VPP2FONR.js";
30
+ } from "./chunk-2WLZ6757.js";
31
31
 
32
32
  // src/ui/form.ts
33
33
  function required(message = "This field is required") {
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  context
3
- } from "./chunk-XET2RUJF.js";
3
+ } from "./chunk-FOWBJZDL.js";
4
4
  import {
5
5
  derived
6
- } from "./chunk-AD5YSZAN.js";
6
+ } from "./chunk-2LOYNGBY.js";
7
7
  import {
8
8
  sanitizeUrl
9
- } from "./chunk-5INI7D2L.js";
9
+ } from "./chunk-IXKSNWV5.js";
10
10
  import {
11
11
  globalSingleton
12
12
  } from "./chunk-7ZHH77QA.js";
13
13
  import {
14
14
  effect
15
- } from "./chunk-XDOMTQHM.js";
15
+ } from "./chunk-7VEC3UD2.js";
16
16
  import {
17
17
  getRequestScopedCache
18
- } from "./chunk-TIRZCERI.js";
18
+ } from "./chunk-5DXA2J44.js";
19
19
  import {
20
20
  batch,
21
21
  signal
22
- } from "./chunk-TVURNWDK.js";
22
+ } from "./chunk-HECVW343.js";
23
23
 
24
24
  // src/data/abort.ts
25
25
  function isAbortError(error) {
@@ -29,13 +29,69 @@ interface FormReturn<T extends object> {
29
29
  reset: () => void;
30
30
  setError: (field: keyof T, message: string) => void;
31
31
  }
32
+ /**
33
+ * Require a non-empty value. Rejects `null`, `undefined`, `""` and `[]`.
34
+ *
35
+ * @param message Overrides the default message.
36
+ * @returns A validator returning the message on failure, `null` on success.
37
+ */
32
38
  declare function required(message?: string): ValidatorFn<unknown>;
39
+ /**
40
+ * Require a minimum string length. An empty value passes — pair with
41
+ * {@link required} when the field is mandatory.
42
+ *
43
+ * @param min Minimum number of characters.
44
+ * @param message Overrides the default message.
45
+ * @returns A validator returning the message on failure, `null` on success.
46
+ */
33
47
  declare function minLength(min: number, message?: string): ValidatorFn<string>;
48
+ /**
49
+ * Require a maximum string length. An empty value passes.
50
+ *
51
+ * @param max Maximum number of characters.
52
+ * @param message Overrides the default message.
53
+ * @returns A validator returning the message on failure, `null` on success.
54
+ */
34
55
  declare function maxLength(max: number, message?: string): ValidatorFn<string>;
56
+ /**
57
+ * Require the value to match a regular expression. An empty value passes.
58
+ *
59
+ * @param regex Pattern the value must satisfy.
60
+ * @param message Message used on failure.
61
+ * @returns A validator returning the message on failure, `null` on success.
62
+ */
35
63
  declare function matchesPattern(regex: RegExp, message?: string): ValidatorFn<string>;
64
+ /**
65
+ * Require a syntactically plausible email address. Deliberately permissive —
66
+ * the only authoritative check is sending mail to it. An empty value passes.
67
+ *
68
+ * @param message Message used on failure.
69
+ * @returns A validator returning the message on failure, `null` on success.
70
+ */
36
71
  declare function email(message?: string): ValidatorFn<string>;
72
+ /**
73
+ * Require a numeric value to be at least `minVal`. `null`/`undefined` passes.
74
+ *
75
+ * @param minVal Inclusive lower bound.
76
+ * @param message Overrides the default message.
77
+ * @returns A validator returning the message on failure, `null` on success.
78
+ */
37
79
  declare function min(minVal: number, message?: string): ValidatorFn<number>;
80
+ /**
81
+ * Require a numeric value to be at most `maxVal`. `null`/`undefined` passes.
82
+ *
83
+ * @param maxVal Inclusive upper bound.
84
+ * @param message Overrides the default message.
85
+ * @returns A validator returning the message on failure, `null` on success.
86
+ */
38
87
  declare function max(maxVal: number, message?: string): ValidatorFn<number>;
88
+ /**
89
+ * Build a validator from an arbitrary predicate.
90
+ *
91
+ * @param fn Returns `true` when the value is acceptable.
92
+ * @param message Message used when `fn` returns `false`.
93
+ * @returns A validator returning the message on failure, `null` on success.
94
+ */
39
95
  declare function custom<T>(fn: (value: T) => boolean, message: string): ValidatorFn<T>;
40
96
  /**
41
97
  * Props returned by bindField, ready to spread into an input tag factory.
@@ -180,6 +236,13 @@ declare function hotkey(combo: string, handler: (e: KeyboardEvent) => void, opti
180
236
  meta?: boolean;
181
237
  preventDefault?: boolean;
182
238
  }): () => void;
239
+ /**
240
+ * Announce a message to screen readers through a shared live region.
241
+ *
242
+ * @param message Text to announce.
243
+ * @param priority `"polite"` waits for a pause; `"assertive"` interrupts.
244
+ * @returns Nothing. A no-op without a DOM, so it is safe under SSR.
245
+ */
183
246
  declare function announce(message: string, priority?: "polite" | "assertive"): void;
184
247
 
185
248
  /**
@@ -266,6 +329,12 @@ declare function bindData(el: HTMLElement, key: string, getter: AttributeValue |
266
329
  * @internal
267
330
  */
268
331
  declare function __resetDialogStack(): void;
332
+ /**
333
+ * Dialog open/close state with focus trapping and scroll locking wired in.
334
+ *
335
+ * @returns A handle exposing `open`, `close`, `toggle` and the reactive
336
+ * `isOpen` accessor.
337
+ */
269
338
  declare function dialog(): {
270
339
  open: () => void;
271
340
  close: () => void;
@@ -296,6 +365,14 @@ interface ToastInstance {
296
365
  dismiss: (id: string) => void;
297
366
  dismissAll: () => void;
298
367
  }
368
+ /**
369
+ * Create a toast queue.
370
+ *
371
+ * @param options `duration` in ms before auto-dismiss; `maxToasts` caps how
372
+ * many are shown at once.
373
+ * @returns A {@link ToastInstance} with `info`, `success`, `warning`, `error`,
374
+ * plus the reactive list to render.
375
+ */
299
376
  declare function toast(options?: {
300
377
  duration?: number;
301
378
  maxToasts?: number;
@@ -29,13 +29,69 @@ interface FormReturn<T extends object> {
29
29
  reset: () => void;
30
30
  setError: (field: keyof T, message: string) => void;
31
31
  }
32
+ /**
33
+ * Require a non-empty value. Rejects `null`, `undefined`, `""` and `[]`.
34
+ *
35
+ * @param message Overrides the default message.
36
+ * @returns A validator returning the message on failure, `null` on success.
37
+ */
32
38
  declare function required(message?: string): ValidatorFn<unknown>;
39
+ /**
40
+ * Require a minimum string length. An empty value passes — pair with
41
+ * {@link required} when the field is mandatory.
42
+ *
43
+ * @param min Minimum number of characters.
44
+ * @param message Overrides the default message.
45
+ * @returns A validator returning the message on failure, `null` on success.
46
+ */
33
47
  declare function minLength(min: number, message?: string): ValidatorFn<string>;
48
+ /**
49
+ * Require a maximum string length. An empty value passes.
50
+ *
51
+ * @param max Maximum number of characters.
52
+ * @param message Overrides the default message.
53
+ * @returns A validator returning the message on failure, `null` on success.
54
+ */
34
55
  declare function maxLength(max: number, message?: string): ValidatorFn<string>;
56
+ /**
57
+ * Require the value to match a regular expression. An empty value passes.
58
+ *
59
+ * @param regex Pattern the value must satisfy.
60
+ * @param message Message used on failure.
61
+ * @returns A validator returning the message on failure, `null` on success.
62
+ */
35
63
  declare function matchesPattern(regex: RegExp, message?: string): ValidatorFn<string>;
64
+ /**
65
+ * Require a syntactically plausible email address. Deliberately permissive —
66
+ * the only authoritative check is sending mail to it. An empty value passes.
67
+ *
68
+ * @param message Message used on failure.
69
+ * @returns A validator returning the message on failure, `null` on success.
70
+ */
36
71
  declare function email(message?: string): ValidatorFn<string>;
72
+ /**
73
+ * Require a numeric value to be at least `minVal`. `null`/`undefined` passes.
74
+ *
75
+ * @param minVal Inclusive lower bound.
76
+ * @param message Overrides the default message.
77
+ * @returns A validator returning the message on failure, `null` on success.
78
+ */
37
79
  declare function min(minVal: number, message?: string): ValidatorFn<number>;
80
+ /**
81
+ * Require a numeric value to be at most `maxVal`. `null`/`undefined` passes.
82
+ *
83
+ * @param maxVal Inclusive upper bound.
84
+ * @param message Overrides the default message.
85
+ * @returns A validator returning the message on failure, `null` on success.
86
+ */
38
87
  declare function max(maxVal: number, message?: string): ValidatorFn<number>;
88
+ /**
89
+ * Build a validator from an arbitrary predicate.
90
+ *
91
+ * @param fn Returns `true` when the value is acceptable.
92
+ * @param message Message used when `fn` returns `false`.
93
+ * @returns A validator returning the message on failure, `null` on success.
94
+ */
39
95
  declare function custom<T>(fn: (value: T) => boolean, message: string): ValidatorFn<T>;
40
96
  /**
41
97
  * Props returned by bindField, ready to spread into an input tag factory.
@@ -180,6 +236,13 @@ declare function hotkey(combo: string, handler: (e: KeyboardEvent) => void, opti
180
236
  meta?: boolean;
181
237
  preventDefault?: boolean;
182
238
  }): () => void;
239
+ /**
240
+ * Announce a message to screen readers through a shared live region.
241
+ *
242
+ * @param message Text to announce.
243
+ * @param priority `"polite"` waits for a pause; `"assertive"` interrupts.
244
+ * @returns Nothing. A no-op without a DOM, so it is safe under SSR.
245
+ */
183
246
  declare function announce(message: string, priority?: "polite" | "assertive"): void;
184
247
 
185
248
  /**
@@ -266,6 +329,12 @@ declare function bindData(el: HTMLElement, key: string, getter: AttributeValue |
266
329
  * @internal
267
330
  */
268
331
  declare function __resetDialogStack(): void;
332
+ /**
333
+ * Dialog open/close state with focus trapping and scroll locking wired in.
334
+ *
335
+ * @returns A handle exposing `open`, `close`, `toggle` and the reactive
336
+ * `isOpen` accessor.
337
+ */
269
338
  declare function dialog(): {
270
339
  open: () => void;
271
340
  close: () => void;
@@ -296,6 +365,14 @@ interface ToastInstance {
296
365
  dismiss: (id: string) => void;
297
366
  dismissAll: () => void;
298
367
  }
368
+ /**
369
+ * Create a toast queue.
370
+ *
371
+ * @param options `duration` in ms before auto-dismiss; `maxToasts` caps how
372
+ * many are shown at once.
373
+ * @returns A {@link ToastInstance} with `info`, `success`, `warning`, `error`,
374
+ * plus the reactive list to render.
375
+ */
299
376
  declare function toast(options?: {
300
377
  duration?: number;
301
378
  maxToasts?: number;
package/dist/data.cjs CHANGED
@@ -45,23 +45,17 @@ __export(data_exports, {
45
45
  module.exports = __toCommonJS(data_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 devAssert(condition, message) {
59
- if (_isDev && !condition) {
53
+ if ((typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) && !condition) {
60
54
  throw new Error(`[SibuJS] ${message}`);
61
55
  }
62
56
  }
63
57
  function devWarn(message) {
64
- if (_isDev) {
58
+ if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
65
59
  console.warn(`[SibuJS] ${message}`);
66
60
  }
67
61
  }
@@ -372,7 +366,14 @@ function reactiveBinding(commit, ownerNode) {
372
366
  subscriber._disposed = false;
373
367
  subscriber._errorPhase = "binding";
374
368
  subscriber._errorNode = ownerNode;
375
- run();
369
+ try {
370
+ run();
371
+ } catch (err) {
372
+ subscriber._disposed = true;
373
+ subscriber._errorNode = void 0;
374
+ cleanup(subscriber);
375
+ throw err;
376
+ }
376
377
  return subscriber._dispose ?? (subscriber._dispose = () => {
377
378
  subscriber._disposed = true;
378
379
  subscriber._errorNode = void 0;
@@ -603,17 +604,16 @@ function forEachSubscriber(signal2, visit) {
603
604
  }
604
605
 
605
606
  // src/reactivity/track.ts
606
- var _isDev2 = isDev();
607
- var _runtimeVersion = true ? "4.0.1" : "dev";
607
+ var _runtimeVersion = true ? "4.2.0" : "dev";
608
608
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
609
609
  function resolveReactiveApi() {
610
610
  const g = globalThis;
611
611
  const existing = g[REGISTRY_KEY];
612
612
  if (existing) {
613
- if (_isDev2 && !existing.__dupWarned) {
613
+ if (DEV && !existing.__dupWarned) {
614
614
  existing.__dupWarned = true;
615
615
  devWarn(
616
- `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']).`
616
+ `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.`
617
617
  );
618
618
  }
619
619
  return existing;
@@ -959,7 +959,6 @@ var isBatching = API2.isBatching;
959
959
 
960
960
  // src/core/signals/signal.ts
961
961
  var _g2 = globalThis;
962
- var _isDev3 = isDev();
963
962
  function signal(initial, options) {
964
963
  const state2 = {
965
964
  value: initial,
@@ -972,7 +971,7 @@ function signal(initial, options) {
972
971
  _d: false,
973
972
  _validate: void 0
974
973
  };
975
- const debugName = _isDev3 ? options?.name : void 0;
974
+ const debugName = DEV ? options?.name : void 0;
976
975
  const equalsFn = options?.equals;
977
976
  if (debugName) state2.__name = debugName;
978
977
  function get() {
@@ -989,7 +988,7 @@ function signal(initial, options) {
989
988
  if (equalsFn(prev, newValue)) return;
990
989
  state2.value = newValue;
991
990
  state2.__v++;
992
- if (_isDev3) {
991
+ if (DEV) {
993
992
  const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
994
993
  if (hook) hook.emit("signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
995
994
  }
@@ -997,7 +996,7 @@ function signal(initial, options) {
997
996
  notifySubscribers2(state2);
998
997
  }
999
998
  };
1000
- } else if (_isDev3) {
999
+ } else if (DEV) {
1001
1000
  set = (next) => {
1002
1001
  const prev = state2.value;
1003
1002
  const newValue = typeof next === "function" ? next(prev) : next;
@@ -1022,7 +1021,7 @@ function signal(initial, options) {
1022
1021
  }
1023
1022
  };
1024
1023
  }
1025
- if (_isDev3) {
1024
+ if (DEV) {
1026
1025
  const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
1027
1026
  if (hook) hook.emit("signal:create", { signal: state2, name: debugName, getter: get, initial });
1028
1027
  }
@@ -2159,11 +2158,10 @@ function syncAdapter(config) {
2159
2158
  }
2160
2159
 
2161
2160
  // src/core/rendering/context.ts
2162
- var _isDev4 = isDev();
2163
2161
  function context(defaultValue) {
2164
2162
  const [getValue, setValue] = signal(defaultValue);
2165
2163
  const warnIfSSR = (method) => {
2166
- if (!_isDev4 || !isSSR()) return;
2164
+ if (!DEV || !isSSR()) return;
2167
2165
  devWarn(
2168
2166
  `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.`
2169
2167
  );
@@ -2191,7 +2189,7 @@ function context(defaultValue) {
2191
2189
  setValue(value);
2192
2190
  try {
2193
2191
  const result = fn();
2194
- if (_isDev4 && result !== null && typeof result?.then === "function") {
2192
+ if (DEV && result !== null && typeof result?.then === "function") {
2195
2193
  devWarn(
2196
2194
  "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."
2197
2195
  );
package/dist/data.js CHANGED
@@ -20,16 +20,16 @@ import {
20
20
  syncAdapter,
21
21
  throttle,
22
22
  withRetry
23
- } from "./chunk-HPXTUPJD.js";
24
- import "./chunk-XET2RUJF.js";
25
- import "./chunk-AD5YSZAN.js";
26
- import "./chunk-5INI7D2L.js";
23
+ } from "./chunk-XZ2N525U.js";
24
+ import "./chunk-FOWBJZDL.js";
25
+ import "./chunk-2LOYNGBY.js";
26
+ import "./chunk-IXKSNWV5.js";
27
27
  import "./chunk-7ZHH77QA.js";
28
- import "./chunk-XDOMTQHM.js";
29
- import "./chunk-TIRZCERI.js";
30
- import "./chunk-TVURNWDK.js";
31
- import "./chunk-JYXQCELN.js";
32
- import "./chunk-VPP2FONR.js";
28
+ import "./chunk-7VEC3UD2.js";
29
+ import "./chunk-5DXA2J44.js";
30
+ import "./chunk-HECVW343.js";
31
+ import "./chunk-7ALC7KGE.js";
32
+ import "./chunk-2WLZ6757.js";
33
33
  export {
34
34
  __resetQueryCache,
35
35
  calculateDelay,