sibujs 4.1.0 → 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 +24 -0
  2. package/dist/browser.cjs +13 -21
  3. package/dist/browser.js +6 -6
  4. package/dist/build.cjs +278 -104
  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-DCDS2PQ6.js → chunk-2LOYNGBY.js} +2 -2
  9. package/dist/{chunk-VPP2FONR.js → chunk-2WLZ6757.js} +17 -10
  10. package/dist/{chunk-IM7N5WR4.js → chunk-3VTSPNC5.js} +2 -2
  11. package/dist/{chunk-TIRZCERI.js → chunk-5DXA2J44.js} +1 -1
  12. package/dist/{chunk-I3VI34DP.js → chunk-6ZGI3RBE.js} +149 -33
  13. package/dist/{chunk-D3SZ4LVS.js → chunk-7ALC7KGE.js} +5 -6
  14. package/dist/{chunk-PFTDGEPZ.js → chunk-7VEC3UD2.js} +3 -3
  15. package/dist/{chunk-KSOEJGFO.js → chunk-BMYYZWHX.js} +3 -3
  16. package/dist/{chunk-LOFZHP6V.js → chunk-BNKV4REK.js} +7 -8
  17. package/dist/{chunk-5GJ5RTHA.js → chunk-FOWBJZDL.js} +7 -8
  18. package/dist/{chunk-FB7KQXZI.js → chunk-GDUNQCCW.js} +4 -4
  19. package/dist/{chunk-UFSQEO7P.js → chunk-HECVW343.js} +7 -8
  20. package/dist/{chunk-SHDVWATN.js → chunk-HJEPKZ2O.js} +7 -8
  21. package/dist/{chunk-ANGSYNPX.js → chunk-HZEBO22J.js} +57 -37
  22. package/dist/{chunk-5INI7D2L.js → chunk-IXKSNWV5.js} +74 -11
  23. package/dist/{chunk-DAKLOMKS.js → chunk-KE4KWRDY.js} +3 -3
  24. package/dist/{chunk-AW6HPJ3L.js → chunk-KKLW7YWL.js} +1 -1
  25. package/dist/{chunk-BMSN6NWQ.js → chunk-NEYWS4EX.js} +6 -6
  26. package/dist/{chunk-HYCCIYNS.js → chunk-NIOYEGBQ.js} +13 -14
  27. package/dist/{chunk-4U7KD3RY.js → chunk-OUWAIXIK.js} +3 -3
  28. package/dist/{chunk-MRAMKDHQ.js → chunk-P3DHXBR6.js} +1 -1
  29. package/dist/{chunk-FMHIQNMP.js → chunk-QCFLDD7C.js} +5 -5
  30. package/dist/{chunk-DHDZ7IVN.js → chunk-QKRPLZ2V.js} +7 -8
  31. package/dist/{chunk-4RH6D7GR.js → chunk-QL4UREZO.js} +6 -6
  32. package/dist/{chunk-XIHMS2Y6.js → chunk-SF3TB4K6.js} +8 -8
  33. package/dist/{chunk-XSZRJW76.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 +15 -24
  37. package/dist/data.js +9 -9
  38. package/dist/devtools.cjs +18 -22
  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 +222 -67
  44. package/dist/ecosystem.js +11 -11
  45. package/dist/extras.cjs +243 -86
  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 +272 -98
  50. package/dist/index.d.cts +154 -33
  51. package/dist/index.d.ts +154 -33
  52. package/dist/index.js +15 -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 +13 -22
  56. package/dist/motion.js +5 -5
  57. package/dist/patterns.cjs +16 -24
  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 +16 -27
  62. package/dist/performance.js +9 -9
  63. package/dist/plugins.cjs +260 -86
  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 +233 -79
  69. package/dist/ssr.js +12 -12
  70. package/dist/testing.cjs +11 -19
  71. package/dist/testing.js +5 -5
  72. package/dist/ui.cjs +98 -43
  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 +13 -21
  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 +5 -2
@@ -1,33 +1,33 @@
1
1
  import {
2
2
  bindAttribute,
3
3
  setSafeAttribute
4
- } from "./chunk-SHDVWATN.js";
4
+ } from "./chunk-HJEPKZ2O.js";
5
5
  import {
6
6
  derived
7
- } from "./chunk-DCDS2PQ6.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-PFTDGEPZ.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-UFSQEO7P.js";
24
+ } from "./chunk-HECVW343.js";
25
25
  import {
26
26
  track
27
- } from "./chunk-D3SZ4LVS.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-5GJ5RTHA.js";
3
+ } from "./chunk-FOWBJZDL.js";
4
4
  import {
5
5
  derived
6
- } from "./chunk-DCDS2PQ6.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-PFTDGEPZ.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-UFSQEO7P.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
  }
@@ -610,17 +604,16 @@ function forEachSubscriber(signal2, visit) {
610
604
  }
611
605
 
612
606
  // src/reactivity/track.ts
613
- var _isDev2 = isDev();
614
- var _runtimeVersion = true ? "4.1.0" : "dev";
607
+ var _runtimeVersion = true ? "4.2.0" : "dev";
615
608
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
616
609
  function resolveReactiveApi() {
617
610
  const g = globalThis;
618
611
  const existing = g[REGISTRY_KEY];
619
612
  if (existing) {
620
- if (_isDev2 && !existing.__dupWarned) {
613
+ if (DEV && !existing.__dupWarned) {
621
614
  existing.__dupWarned = true;
622
615
  devWarn(
623
- `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.`
624
617
  );
625
618
  }
626
619
  return existing;
@@ -966,7 +959,6 @@ var isBatching = API2.isBatching;
966
959
 
967
960
  // src/core/signals/signal.ts
968
961
  var _g2 = globalThis;
969
- var _isDev3 = isDev();
970
962
  function signal(initial, options) {
971
963
  const state2 = {
972
964
  value: initial,
@@ -979,7 +971,7 @@ function signal(initial, options) {
979
971
  _d: false,
980
972
  _validate: void 0
981
973
  };
982
- const debugName = _isDev3 ? options?.name : void 0;
974
+ const debugName = DEV ? options?.name : void 0;
983
975
  const equalsFn = options?.equals;
984
976
  if (debugName) state2.__name = debugName;
985
977
  function get() {
@@ -996,7 +988,7 @@ function signal(initial, options) {
996
988
  if (equalsFn(prev, newValue)) return;
997
989
  state2.value = newValue;
998
990
  state2.__v++;
999
- if (_isDev3) {
991
+ if (DEV) {
1000
992
  const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
1001
993
  if (hook) hook.emit("signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
1002
994
  }
@@ -1004,7 +996,7 @@ function signal(initial, options) {
1004
996
  notifySubscribers2(state2);
1005
997
  }
1006
998
  };
1007
- } else if (_isDev3) {
999
+ } else if (DEV) {
1008
1000
  set = (next) => {
1009
1001
  const prev = state2.value;
1010
1002
  const newValue = typeof next === "function" ? next(prev) : next;
@@ -1029,7 +1021,7 @@ function signal(initial, options) {
1029
1021
  }
1030
1022
  };
1031
1023
  }
1032
- if (_isDev3) {
1024
+ if (DEV) {
1033
1025
  const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
1034
1026
  if (hook) hook.emit("signal:create", { signal: state2, name: debugName, getter: get, initial });
1035
1027
  }
@@ -2166,11 +2158,10 @@ function syncAdapter(config) {
2166
2158
  }
2167
2159
 
2168
2160
  // src/core/rendering/context.ts
2169
- var _isDev4 = isDev();
2170
2161
  function context(defaultValue) {
2171
2162
  const [getValue, setValue] = signal(defaultValue);
2172
2163
  const warnIfSSR = (method) => {
2173
- if (!_isDev4 || !isSSR()) return;
2164
+ if (!DEV || !isSSR()) return;
2174
2165
  devWarn(
2175
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.`
2176
2167
  );
@@ -2198,7 +2189,7 @@ function context(defaultValue) {
2198
2189
  setValue(value);
2199
2190
  try {
2200
2191
  const result = fn();
2201
- if (_isDev4 && result !== null && typeof result?.then === "function") {
2192
+ if (DEV && result !== null && typeof result?.then === "function") {
2202
2193
  devWarn(
2203
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."
2204
2195
  );
package/dist/data.js CHANGED
@@ -20,16 +20,16 @@ import {
20
20
  syncAdapter,
21
21
  throttle,
22
22
  withRetry
23
- } from "./chunk-XSZRJW76.js";
24
- import "./chunk-5GJ5RTHA.js";
25
- import "./chunk-DCDS2PQ6.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-PFTDGEPZ.js";
29
- import "./chunk-TIRZCERI.js";
30
- import "./chunk-UFSQEO7P.js";
31
- import "./chunk-D3SZ4LVS.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,
package/dist/devtools.cjs CHANGED
@@ -172,23 +172,22 @@ function checkLeaks() {
172
172
  }
173
173
 
174
174
  // src/core/dev.ts
175
+ var DEV = typeof __SIBU_DEV__ !== "undefined" ? !!__SIBU_DEV__ : typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : (
176
+ // safe default: off in browser, on in test/dev Node
177
+ typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
178
+ );
175
179
  function isDev() {
176
- return typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : (
177
- // The bare `__SIBU_DEV__` is a bundler define that only exists in
178
- // production builds; under the test runner it is always undefined, so
179
- // this branch is unreachable here.
180
- /* v8 ignore next 2 */
181
- typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
182
- );
180
+ if (typeof globalThis.__SIBU_DEV__ !== "undefined") return !!globalThis.__SIBU_DEV__;
181
+ if (typeof __SIBU_DEV__ !== "undefined") return !!__SIBU_DEV__;
182
+ return typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
183
183
  }
184
- var _isDev = isDev();
185
184
  function devAssert(condition, message) {
186
- if (_isDev && !condition) {
185
+ if ((typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) && !condition) {
187
186
  throw new Error(`[SibuJS] ${message}`);
188
187
  }
189
188
  }
190
189
  function devWarn(message) {
191
- if (_isDev) {
190
+ if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
192
191
  console.warn(`[SibuJS] ${message}`);
193
192
  }
194
193
  }
@@ -737,17 +736,16 @@ function forEachSubscriber(signal2, visit) {
737
736
  }
738
737
 
739
738
  // src/reactivity/track.ts
740
- var _isDev2 = isDev();
741
- var _runtimeVersion = true ? "4.1.0" : "dev";
739
+ var _runtimeVersion = true ? "4.2.0" : "dev";
742
740
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
743
741
  function resolveReactiveApi() {
744
742
  const g = globalThis;
745
743
  const existing = g[REGISTRY_KEY];
746
744
  if (existing) {
747
- if (_isDev2 && !existing.__dupWarned) {
745
+ if (DEV && !existing.__dupWarned) {
748
746
  existing.__dupWarned = true;
749
747
  devWarn(
750
- `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']).`
748
+ `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.`
751
749
  );
752
750
  }
753
751
  return existing;
@@ -846,7 +844,6 @@ var isBatching = API2.isBatching;
846
844
 
847
845
  // src/core/signals/signal.ts
848
846
  var _g = globalThis;
849
- var _isDev3 = isDev();
850
847
  function signal(initial, options) {
851
848
  const state2 = {
852
849
  value: initial,
@@ -859,7 +856,7 @@ function signal(initial, options) {
859
856
  _d: false,
860
857
  _validate: void 0
861
858
  };
862
- const debugName = _isDev3 ? options?.name : void 0;
859
+ const debugName = DEV ? options?.name : void 0;
863
860
  const equalsFn = options?.equals;
864
861
  if (debugName) state2.__name = debugName;
865
862
  function get() {
@@ -876,7 +873,7 @@ function signal(initial, options) {
876
873
  if (equalsFn(prev, newValue)) return;
877
874
  state2.value = newValue;
878
875
  state2.__v++;
879
- if (_isDev3) {
876
+ if (DEV) {
880
877
  const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
881
878
  if (hook) hook.emit("signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
882
879
  }
@@ -884,7 +881,7 @@ function signal(initial, options) {
884
881
  notifySubscribers2(state2);
885
882
  }
886
883
  };
887
- } else if (_isDev3) {
884
+ } else if (DEV) {
888
885
  set = (next) => {
889
886
  const prev = state2.value;
890
887
  const newValue = typeof next === "function" ? next(prev) : next;
@@ -909,7 +906,7 @@ function signal(initial, options) {
909
906
  }
910
907
  };
911
908
  }
912
- if (_isDev3) {
909
+ if (DEV) {
913
910
  const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
914
911
  if (hook) hook.emit("signal:create", { signal: state2, name: debugName, getter: get, initial });
915
912
  }
@@ -1611,7 +1608,6 @@ function reportDrainRunaway(label, executed, remaining) {
1611
1608
  { executed, remaining }
1612
1609
  );
1613
1610
  }
1614
- var _isDev4 = isDev();
1615
1611
  var activeBindingCount = 0;
1616
1612
  function dispose(node) {
1617
1613
  const stack = [node];
@@ -1634,13 +1630,13 @@ function dispose(node) {
1634
1630
  if (!pending || pending.length === 0) break;
1635
1631
  const snapshot = pending.slice();
1636
1632
  elementDisposers.delete(current);
1637
- if (_isDev4) activeBindingCount -= snapshot.length;
1633
+ if (DEV) activeBindingCount -= snapshot.length;
1638
1634
  for (let i2 = 0; i2 < snapshot.length; i2++) {
1639
1635
  if (executed >= MAX_DRAIN_TEARDOWNS) {
1640
1636
  const rest = snapshot.slice(i2);
1641
1637
  const added = elementDisposers.get(current);
1642
1638
  elementDisposers.set(current, added ? rest.concat(added) : rest);
1643
- if (_isDev4) activeBindingCount += rest.length;
1639
+ if (DEV) activeBindingCount += rest.length;
1644
1640
  reportDrainRunaway("dispose", executed, rest.length + (added?.length ?? 0));
1645
1641
  runaway = true;
1646
1642
  break;
@@ -1,4 +1,4 @@
1
- export { D as DevToolsEvent, a as DevtoolsOverlayOptions, P as ProfilerResult, R as ReactiveNodeInfo, S as SibuError, c as checkLeaks, b as clearDebugValues, d as clearHMRModule, e as clearHMRState, f as clearPerformanceData, g as createDevtoolsOverlay, h as createErrorReporter, i as createHMRBoundary, j as createProfiler, k as debugLog, l as debugValue, m as devState, n as disableDebug, o as enableDebug, p as exposeHMR, q as formatError, r as getActiveDevTools, s as getDebugValues, t as getDependencies, u as getPerformanceReport, v as getSignalName, w as getSubscriberCount, x as hmrState, y as initDevTools, z as inspectSignal, A as isDebugEnabled, B as isHMRAvailable, C as measureRender, E as perfTracker, F as registerHMR, G as runCleanups, H as startMeasure, I as trackCleanup, J as walkDependencyGraph, K as withErrorTracking } from './introspect-RjLfIFpL.cjs';
1
+ export { D as DevToolsEvent, a as DevtoolsOverlayOptions, P as ProfilerResult, R as ReactiveNodeInfo, S as SibuError, c as checkLeaks, b as clearDebugValues, d as clearHMRModule, e as clearHMRState, f as clearPerformanceData, g as createDevtoolsOverlay, h as createErrorReporter, i as createHMRBoundary, j as createProfiler, k as debugLog, l as debugValue, m as devState, n as disableDebug, o as enableDebug, p as exposeHMR, q as formatError, r as getActiveDevTools, s as getDebugValues, t as getDependencies, u as getPerformanceReport, v as getSignalName, w as getSubscriberCount, x as hmrState, y as initDevTools, z as inspectSignal, A as isDebugEnabled, B as isHMRAvailable, C as measureRender, E as perfTracker, F as registerHMR, G as runCleanups, H as startMeasure, I as trackCleanup, J as walkDependencyGraph, K as withErrorTracking } from './introspect-D5xF-0Es.cjs';
2
2
  import './signal-BnWpq6WB.cjs';
3
3
 
4
4
  interface SignalNodeSnapshot {
@@ -1,4 +1,4 @@
1
- export { D as DevToolsEvent, a as DevtoolsOverlayOptions, P as ProfilerResult, R as ReactiveNodeInfo, S as SibuError, c as checkLeaks, b as clearDebugValues, d as clearHMRModule, e as clearHMRState, f as clearPerformanceData, g as createDevtoolsOverlay, h as createErrorReporter, i as createHMRBoundary, j as createProfiler, k as debugLog, l as debugValue, m as devState, n as disableDebug, o as enableDebug, p as exposeHMR, q as formatError, r as getActiveDevTools, s as getDebugValues, t as getDependencies, u as getPerformanceReport, v as getSignalName, w as getSubscriberCount, x as hmrState, y as initDevTools, z as inspectSignal, A as isDebugEnabled, B as isHMRAvailable, C as measureRender, E as perfTracker, F as registerHMR, G as runCleanups, H as startMeasure, I as trackCleanup, J as walkDependencyGraph, K as withErrorTracking } from './introspect-DOZfmC-4.js';
1
+ export { D as DevToolsEvent, a as DevtoolsOverlayOptions, P as ProfilerResult, R as ReactiveNodeInfo, S as SibuError, c as checkLeaks, b as clearDebugValues, d as clearHMRModule, e as clearHMRState, f as clearPerformanceData, g as createDevtoolsOverlay, h as createErrorReporter, i as createHMRBoundary, j as createProfiler, k as debugLog, l as debugValue, m as devState, n as disableDebug, o as enableDebug, p as exposeHMR, q as formatError, r as getActiveDevTools, s as getDebugValues, t as getDependencies, u as getPerformanceReport, v as getSignalName, w as getSubscriberCount, x as hmrState, y as initDevTools, z as inspectSignal, A as isDebugEnabled, B as isHMRAvailable, C as measureRender, E as perfTracker, F as registerHMR, G as runCleanups, H as startMeasure, I as trackCleanup, J as walkDependencyGraph, K as withErrorTracking } from './introspect-rSBIxEQi.js';
2
2
  import './signal-BnWpq6WB.js';
3
3
 
4
4
  interface SignalNodeSnapshot {
package/dist/devtools.js CHANGED
@@ -35,17 +35,17 @@ import {
35
35
  trackCleanup,
36
36
  walkDependencyGraph,
37
37
  withErrorTracking
38
- } from "./chunk-4RH6D7GR.js";
39
- import "./chunk-5INI7D2L.js";
38
+ } from "./chunk-QL4UREZO.js";
39
+ import "./chunk-IXKSNWV5.js";
40
40
  import "./chunk-7ZHH77QA.js";
41
- import "./chunk-PFTDGEPZ.js";
42
- import "./chunk-TIRZCERI.js";
43
- import "./chunk-DHDZ7IVN.js";
44
- import "./chunk-UFSQEO7P.js";
45
- import "./chunk-D3SZ4LVS.js";
41
+ import "./chunk-7VEC3UD2.js";
42
+ import "./chunk-5DXA2J44.js";
43
+ import "./chunk-QKRPLZ2V.js";
44
+ import "./chunk-HECVW343.js";
45
+ import "./chunk-7ALC7KGE.js";
46
46
  import {
47
47
  isDev
48
- } from "./chunk-VPP2FONR.js";
48
+ } from "./chunk-2WLZ6757.js";
49
49
 
50
50
  // src/devtools/signalGraph.ts
51
51
  function getHook() {
@@ -6,8 +6,8 @@ import {
6
6
  replaceChildrenSafely,
7
7
  reportDrainRunaway,
8
8
  unregisterDisposer
9
- } from "./chunk-DHDZ7IVN.js";
10
- import "./chunk-VPP2FONR.js";
9
+ } from "./chunk-QKRPLZ2V.js";
10
+ import "./chunk-2WLZ6757.js";
11
11
  export {
12
12
  MAX_DRAIN_TEARDOWNS,
13
13
  checkLeaks,