sibujs 4.3.0 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/README.md +34 -4
  2. package/dist/browser.cjs +31 -2
  3. package/dist/browser.d.cts +15 -2
  4. package/dist/browser.d.ts +15 -2
  5. package/dist/browser.js +4 -4
  6. package/dist/build.cjs +92 -13
  7. package/dist/build.js +10 -10
  8. package/dist/cdn.dev.global.js +10 -10
  9. package/dist/cdn.full.dev.global.js +400 -0
  10. package/dist/cdn.full.global.js +398 -0
  11. package/dist/cdn.global.js +10 -10
  12. package/dist/{chunk-GZYQNIPS.js → chunk-2DCGACUU.js} +16 -9
  13. package/dist/{chunk-7BPN4MXR.js → chunk-3JZ4L5TJ.js} +10 -4
  14. package/dist/{chunk-R4EF7V3K.js → chunk-4PMLNECI.js} +4 -4
  15. package/dist/{chunk-IYHM4FWD.js → chunk-7LN645I6.js} +1 -1
  16. package/dist/{chunk-RE6KLGMV.js → chunk-B3WHI2QA.js} +1 -1
  17. package/dist/{chunk-ZVYNIUOG.js → chunk-FTIR4QW2.js} +13 -3
  18. package/dist/{chunk-G7GPNB6N.js → chunk-GW3SCCZG.js} +4 -4
  19. package/dist/{chunk-XGCZ45NH.js → chunk-KEISJXBU.js} +2 -2
  20. package/dist/{chunk-UD6YE2GW.js → chunk-OMJJM3KM.js} +2 -2
  21. package/dist/{chunk-7UBG6LDP.js → chunk-ONOHFDLG.js} +9 -1
  22. package/dist/{chunk-7UK6BSAT.js → chunk-PCT43HW3.js} +1 -1
  23. package/dist/{chunk-VJE6DDYM.js → chunk-R25EFXXC.js} +40 -26
  24. package/dist/{chunk-3E5YNK2F.js → chunk-RBTPLM32.js} +46 -8
  25. package/dist/{chunk-7BJLKDBI.js → chunk-RIXRAYIU.js} +1 -1
  26. package/dist/{chunk-7GQIRV27.js → chunk-RJE2BNI4.js} +3 -3
  27. package/dist/{chunk-2LSY4WDM.js → chunk-S373NSMK.js} +18 -13
  28. package/dist/{chunk-AAHT6AKT.js → chunk-TBYTO6BS.js} +2 -2
  29. package/dist/{chunk-TSL64O5L.js → chunk-UGRX3S57.js} +31 -2
  30. package/dist/{chunk-L4B3Y3OM.js → chunk-VUF4ALSW.js} +1 -1
  31. package/dist/{chunk-USS5ENJ2.js → chunk-VZKNK2V7.js} +9 -4
  32. package/dist/{chunk-MYA5HEK5.js → chunk-XZZOBQAY.js} +1 -1
  33. package/dist/{contracts-Hg6ITAEF.d.cts → contracts-DBdg9J_a.d.cts} +25 -4
  34. package/dist/{contracts-Hg6ITAEF.d.ts → contracts-DBdg9J_a.d.ts} +25 -4
  35. package/dist/{customElement-CNZxEB9G.d.ts → customElement-OB9CIsc5.d.cts} +38 -10
  36. package/dist/{customElement-CNZxEB9G.d.cts → customElement-OB9CIsc5.d.ts} +38 -10
  37. package/dist/data.cjs +81 -9
  38. package/dist/data.js +6 -6
  39. package/dist/devtools.cjs +41 -2
  40. package/dist/devtools.js +4 -4
  41. package/dist/ecosystem.cjs +83 -9
  42. package/dist/ecosystem.d.cts +13 -5
  43. package/dist/ecosystem.d.ts +13 -5
  44. package/dist/ecosystem.js +7 -7
  45. package/dist/extras.cjs +150 -40
  46. package/dist/extras.d.cts +3 -3
  47. package/dist/extras.d.ts +3 -3
  48. package/dist/extras.js +20 -20
  49. package/dist/index.cjs +92 -13
  50. package/dist/index.d.cts +24 -151
  51. package/dist/index.d.ts +24 -151
  52. package/dist/index.js +10 -10
  53. package/dist/motion.cjs +31 -2
  54. package/dist/motion.js +3 -3
  55. package/dist/patterns.cjs +116 -36
  56. package/dist/patterns.d.cts +6 -1
  57. package/dist/patterns.d.ts +6 -1
  58. package/dist/patterns.js +6 -6
  59. package/dist/performance.cjs +31 -2
  60. package/dist/performance.js +4 -4
  61. package/dist/plugins.cjs +39 -2
  62. package/dist/plugins.js +6 -6
  63. package/dist/ssr.cjs +39 -2
  64. package/dist/ssr.js +7 -7
  65. package/dist/tagFactory-DVoDpHye.d.cts +215 -0
  66. package/dist/tagFactory-DVoDpHye.d.ts +215 -0
  67. package/dist/testing.cjs +31 -2
  68. package/dist/testing.js +2 -2
  69. package/dist/ui.cjs +128 -39
  70. package/dist/ui.d.cts +2 -2
  71. package/dist/ui.d.ts +2 -2
  72. package/dist/ui.js +7 -7
  73. package/dist/widgets.cjs +75 -9
  74. package/dist/widgets.js +6 -6
  75. package/package.json +8 -2
  76. package/dist/tagFactory-Bzupt4Pj.d.cts +0 -55
  77. package/dist/tagFactory-Bzupt4Pj.d.ts +0 -55
@@ -288,6 +288,15 @@ function untracked(fn) {
288
288
  var subscriberEpochCounter = 0;
289
289
  function retrack(effectFn, subscriber) {
290
290
  const prev = currentSubscriber;
291
+ let savedDepth = 0;
292
+ let savedSuspendSub = null;
293
+ if (trackingSuspended) {
294
+ savedDepth = suspendDepth;
295
+ savedSuspendSub = suspendSavedSub;
296
+ suspendDepth = 0;
297
+ suspendSavedSub = null;
298
+ trackingSuspended = false;
299
+ }
291
300
  currentSubscriber = subscriber;
292
301
  const sub = subscriber;
293
302
  const epoch = ++subscriberEpochCounter;
@@ -302,6 +311,11 @@ function retrack(effectFn, subscriber) {
302
311
  effectFn();
303
312
  } finally {
304
313
  currentSubscriber = prev;
314
+ if (savedDepth !== 0) {
315
+ suspendDepth = savedDepth;
316
+ suspendSavedSub = savedSuspendSub;
317
+ trackingSuspended = true;
318
+ }
305
319
  let node = sub.depsHead ?? null;
306
320
  while (node !== null) {
307
321
  const next = node.subNext;
@@ -321,11 +335,25 @@ function track(effectFn, subscriber) {
321
335
  if (!subscriber) return reactiveBinding(effectFn);
322
336
  cleanup(subscriber);
323
337
  const prev = currentSubscriber;
338
+ let savedDepth = 0;
339
+ let savedSuspendSub = null;
340
+ if (trackingSuspended) {
341
+ savedDepth = suspendDepth;
342
+ savedSuspendSub = suspendSavedSub;
343
+ suspendDepth = 0;
344
+ suspendSavedSub = null;
345
+ trackingSuspended = false;
346
+ }
324
347
  currentSubscriber = subscriber;
325
348
  try {
326
349
  effectFn();
327
350
  } finally {
328
351
  currentSubscriber = prev;
352
+ if (savedDepth !== 0) {
353
+ suspendDepth = savedDepth;
354
+ suspendSavedSub = savedSuspendSub;
355
+ trackingSuspended = true;
356
+ }
329
357
  const sub2 = subscriber;
330
358
  for (let n = sub2.depsHead ?? null; n !== null; n = n.subNext) {
331
359
  const sig = n.sig;
@@ -496,8 +524,9 @@ function propagateDirty(sub) {
496
524
  if (s._c) {
497
525
  const nSig = s._sig;
498
526
  if (nSig) {
499
- if (!nSig._d) {
527
+ if (!nSig._d || nSig._f === true) {
500
528
  nSig._d = true;
529
+ nSig._f = false;
501
530
  stack.push(nSig);
502
531
  }
503
532
  } else {
@@ -597,7 +626,7 @@ function forEachSubscriber(signal2, visit) {
597
626
  }
598
627
 
599
628
  // src/reactivity/track.ts
600
- var _runtimeVersion = true ? "4.3.0" : "dev";
629
+ var _runtimeVersion = true ? "4.5.0" : "dev";
601
630
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
602
631
  function resolveReactiveApi() {
603
632
  const g = globalThis;
@@ -1084,10 +1113,14 @@ function derived(getter, options) {
1084
1113
  const cs = {};
1085
1114
  cs._d = false;
1086
1115
  cs._init = false;
1116
+ cs._f = false;
1087
1117
  cs._g = getter;
1088
1118
  cs.__v = 0;
1119
+ let evaluating = false;
1120
+ let disposed = false;
1121
+ let pendingError;
1089
1122
  const markDirty = () => {
1090
- if (cs._d) return;
1123
+ if (cs._d || disposed) return;
1091
1124
  cs._d = true;
1092
1125
  };
1093
1126
  markDirty._c = 1;
@@ -1110,33 +1143,53 @@ function derived(getter, options) {
1110
1143
  }
1111
1144
  }, markDirty);
1112
1145
  const hook = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
1113
- let evaluating = false;
1114
1146
  const validate = () => {
1115
- if (!cs._d) return;
1147
+ if (!cs._d || disposed || pendingError !== void 0) return;
1116
1148
  const oldValue = cs._v;
1117
1149
  evaluating = true;
1118
1150
  try {
1119
1151
  retrack2(recompute, markDirty);
1120
1152
  if (!Object.is(oldValue, cs._v)) cs.__v++;
1153
+ } catch (err) {
1154
+ pendingError = { error: err };
1155
+ cs.__v++;
1156
+ if (disposed) cs._d = true;
1157
+ else cs._f = true;
1121
1158
  } finally {
1122
1159
  evaluating = false;
1160
+ if (disposed) cleanup2(markDirty);
1123
1161
  }
1124
- if (hook && !Object.is(oldValue, cs._v)) {
1162
+ if (hook && !disposed && !Object.is(oldValue, cs._v)) {
1125
1163
  hook.emit("computed:update", { signal: cs, oldValue, newValue: cs._v });
1126
1164
  }
1127
1165
  };
1128
1166
  cs._validate = validate;
1167
+ const throwPending = () => {
1168
+ const { error } = pendingError;
1169
+ pendingError = void 0;
1170
+ if (disposed) cs._d = false;
1171
+ throw error;
1172
+ };
1129
1173
  function computedGetter() {
1130
1174
  if (evaluating) {
1131
1175
  throw new Error(
1132
1176
  `[SibuJS] Circular dependency detected in derived${debugName ? ` "${debugName}"` : ""}. A derived signal cannot read itself (directly or through a chain).`
1133
1177
  );
1134
1178
  }
1135
- if (isTrackingSuspended2()) {
1136
- if (cs._d) validate();
1179
+ if (isTrackingSuspended2() || disposed) {
1180
+ if (cs._d) {
1181
+ validate();
1182
+ if (pendingError !== void 0) throwPending();
1183
+ }
1137
1184
  return cs._v;
1138
1185
  }
1139
- if (cs._d) validate();
1186
+ if (cs._d) {
1187
+ validate();
1188
+ if (pendingError !== void 0) {
1189
+ recordDependency2(cs);
1190
+ throwPending();
1191
+ }
1192
+ }
1140
1193
  recordDependency2(cs);
1141
1194
  return cs._v;
1142
1195
  }
@@ -1145,6 +1198,19 @@ function derived(getter, options) {
1145
1198
  cs.__name = debugName;
1146
1199
  }
1147
1200
  computedGetter.__signal = cs;
1201
+ computedGetter.dispose = () => {
1202
+ if (disposed) return;
1203
+ disposed = true;
1204
+ cs._d = pendingError !== void 0;
1205
+ cleanup2(markDirty);
1206
+ const h = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
1207
+ if (h) {
1208
+ try {
1209
+ h.emit("computed:destroy", { signal: cs, getter: computedGetter });
1210
+ } catch {
1211
+ }
1212
+ }
1213
+ };
1148
1214
  if (hook) hook.emit("computed:create", { signal: cs, name: debugName, getter: computedGetter });
1149
1215
  return computedGetter;
1150
1216
  }
@@ -1462,6 +1528,14 @@ function setSafeAttribute(el, name, value, options = {}) {
1462
1528
  const html = isHtmlElement(el);
1463
1529
  const idlName = html ? name.toLowerCase() : name;
1464
1530
  if (typeof value === "boolean") {
1531
+ if (name.length > 5 && name.slice(0, 5).toLowerCase() === "aria-") {
1532
+ const token = value ? "true" : "false";
1533
+ if ((ns ? el.getAttributeNS(ns, localName) : el.getAttribute(name)) !== token) {
1534
+ if (ns) el.setAttributeNS(ns, name, token);
1535
+ else el.setAttribute(name, token);
1536
+ }
1537
+ return true;
1538
+ }
1465
1539
  if (html && BOOLEAN_IDL_ATTRS.has(idlName) && idlName in el) {
1466
1540
  setProp(el, idlName, value);
1467
1541
  } else if (value) {
@@ -1,5 +1,5 @@
1
1
  import { S as SibuPlugin } from './plugin-D30wlGW5.cjs';
2
- import { T as TagProps } from './tagFactory-Bzupt4Pj.cjs';
2
+ import { D as DerivedAccessor, T as TagProps } from './tagFactory-DVoDpHye.cjs';
3
3
 
4
4
  /** MobX autorun disposer function type. */
5
5
  type MobXReactionDisposer = () => void;
@@ -67,8 +67,12 @@ interface ReduxAdapterOptions<S = unknown> {
67
67
  interface ReduxAdapterAPI<S = unknown> {
68
68
  /** Full store state as a SibuJS reactive getter */
69
69
  getState: () => S;
70
- /** Create a SibuJS reactive getter from a Redux selector */
71
- select: <R>(selector: (state: S) => R) => () => R;
70
+ /**
71
+ * Create a SibuJS reactive getter from a Redux selector. The getter is a
72
+ * `derived()` subscribed to the store state; call its `dispose()` when a
73
+ * selector is discarded before the adapter.
74
+ */
75
+ select: <R>(selector: (state: S) => R) => DerivedAccessor<R>;
72
76
  /** Dispatch an action to the Redux store */
73
77
  dispatch: ReduxStore<S>["dispatch"];
74
78
  /** Unsubscribe from the Redux store */
@@ -110,8 +114,12 @@ interface ZustandAdapterOptions<S> {
110
114
  interface ZustandAdapterAPI<S> {
111
115
  /** Full Zustand state as a SibuJS reactive getter */
112
116
  getState: () => S;
113
- /** Create a SibuJS reactive getter from a Zustand selector */
114
- select: <R>(selector: (state: S) => R) => () => R;
117
+ /**
118
+ * Create a SibuJS reactive getter from a Zustand selector. The getter is a
119
+ * `derived()` subscribed to the store state; call its `dispose()` when a
120
+ * selector is discarded before the adapter.
121
+ */
122
+ select: <R>(selector: (state: S) => R) => DerivedAccessor<R>;
115
123
  /** Set state on the Zustand store */
116
124
  setState: ZustandStore<S>["setState"];
117
125
  /** Destroy the subscription and the Zustand store */
@@ -1,5 +1,5 @@
1
1
  import { S as SibuPlugin } from './plugin-D30wlGW5.js';
2
- import { T as TagProps } from './tagFactory-Bzupt4Pj.js';
2
+ import { D as DerivedAccessor, T as TagProps } from './tagFactory-DVoDpHye.js';
3
3
 
4
4
  /** MobX autorun disposer function type. */
5
5
  type MobXReactionDisposer = () => void;
@@ -67,8 +67,12 @@ interface ReduxAdapterOptions<S = unknown> {
67
67
  interface ReduxAdapterAPI<S = unknown> {
68
68
  /** Full store state as a SibuJS reactive getter */
69
69
  getState: () => S;
70
- /** Create a SibuJS reactive getter from a Redux selector */
71
- select: <R>(selector: (state: S) => R) => () => R;
70
+ /**
71
+ * Create a SibuJS reactive getter from a Redux selector. The getter is a
72
+ * `derived()` subscribed to the store state; call its `dispose()` when a
73
+ * selector is discarded before the adapter.
74
+ */
75
+ select: <R>(selector: (state: S) => R) => DerivedAccessor<R>;
72
76
  /** Dispatch an action to the Redux store */
73
77
  dispatch: ReduxStore<S>["dispatch"];
74
78
  /** Unsubscribe from the Redux store */
@@ -110,8 +114,12 @@ interface ZustandAdapterOptions<S> {
110
114
  interface ZustandAdapterAPI<S> {
111
115
  /** Full Zustand state as a SibuJS reactive getter */
112
116
  getState: () => S;
113
- /** Create a SibuJS reactive getter from a Zustand selector */
114
- select: <R>(selector: (state: S) => R) => () => R;
117
+ /**
118
+ * Create a SibuJS reactive getter from a Zustand selector. The getter is a
119
+ * `derived()` subscribed to the store state; call its `dispose()` when a
120
+ * selector is discarded before the adapter.
121
+ */
122
+ select: <R>(selector: (state: S) => R) => DerivedAccessor<R>;
115
123
  /** Set state on the Zustand store */
116
124
  setState: ZustandStore<S>["setState"];
117
125
  /** Destroy the subscription and the Zustand store */
package/dist/ecosystem.js CHANGED
@@ -7,18 +7,18 @@ import {
7
7
  mobXAdapter,
8
8
  reduxAdapter,
9
9
  zustandAdapter
10
- } from "./chunk-R4EF7V3K.js";
10
+ } from "./chunk-4PMLNECI.js";
11
11
  import "./chunk-WWV3SJ3L.js";
12
- import "./chunk-XGCZ45NH.js";
13
- import "./chunk-7UBG6LDP.js";
14
- import "./chunk-3E5YNK2F.js";
12
+ import "./chunk-KEISJXBU.js";
13
+ import "./chunk-ONOHFDLG.js";
14
+ import "./chunk-RBTPLM32.js";
15
15
  import "./chunk-IXKSNWV5.js";
16
16
  import "./chunk-7ZHH77QA.js";
17
- import "./chunk-7BJLKDBI.js";
17
+ import "./chunk-RIXRAYIU.js";
18
18
  import "./chunk-5DXA2J44.js";
19
19
  import "./chunk-QKRPLZ2V.js";
20
- import "./chunk-MYA5HEK5.js";
21
- import "./chunk-TSL64O5L.js";
20
+ import "./chunk-XZZOBQAY.js";
21
+ import "./chunk-UGRX3S57.js";
22
22
  import "./chunk-2WLZ6757.js";
23
23
  export {
24
24
  antdAdapter,
package/dist/extras.cjs CHANGED
@@ -579,6 +579,15 @@ function untracked(fn) {
579
579
  var subscriberEpochCounter = 0;
580
580
  function retrack(effectFn, subscriber) {
581
581
  const prev = currentSubscriber;
582
+ let savedDepth = 0;
583
+ let savedSuspendSub = null;
584
+ if (trackingSuspended) {
585
+ savedDepth = suspendDepth;
586
+ savedSuspendSub = suspendSavedSub;
587
+ suspendDepth = 0;
588
+ suspendSavedSub = null;
589
+ trackingSuspended = false;
590
+ }
582
591
  currentSubscriber = subscriber;
583
592
  const sub2 = subscriber;
584
593
  const epoch = ++subscriberEpochCounter;
@@ -593,6 +602,11 @@ function retrack(effectFn, subscriber) {
593
602
  effectFn();
594
603
  } finally {
595
604
  currentSubscriber = prev;
605
+ if (savedDepth !== 0) {
606
+ suspendDepth = savedDepth;
607
+ suspendSavedSub = savedSuspendSub;
608
+ trackingSuspended = true;
609
+ }
596
610
  let node = sub2.depsHead ?? null;
597
611
  while (node !== null) {
598
612
  const next = node.subNext;
@@ -612,11 +626,25 @@ function track(effectFn, subscriber) {
612
626
  if (!subscriber) return reactiveBinding(effectFn);
613
627
  cleanup(subscriber);
614
628
  const prev = currentSubscriber;
629
+ let savedDepth = 0;
630
+ let savedSuspendSub = null;
631
+ if (trackingSuspended) {
632
+ savedDepth = suspendDepth;
633
+ savedSuspendSub = suspendSavedSub;
634
+ suspendDepth = 0;
635
+ suspendSavedSub = null;
636
+ trackingSuspended = false;
637
+ }
615
638
  currentSubscriber = subscriber;
616
639
  try {
617
640
  effectFn();
618
641
  } finally {
619
642
  currentSubscriber = prev;
643
+ if (savedDepth !== 0) {
644
+ suspendDepth = savedDepth;
645
+ suspendSavedSub = savedSuspendSub;
646
+ trackingSuspended = true;
647
+ }
620
648
  const sub3 = subscriber;
621
649
  for (let n = sub3.depsHead ?? null; n !== null; n = n.subNext) {
622
650
  const sig = n.sig;
@@ -787,8 +815,9 @@ function propagateDirty(sub2) {
787
815
  if (s2._c) {
788
816
  const nSig = s2._sig;
789
817
  if (nSig) {
790
- if (!nSig._d) {
818
+ if (!nSig._d || nSig._f === true) {
791
819
  nSig._d = true;
820
+ nSig._f = false;
792
821
  stack.push(nSig);
793
822
  }
794
823
  } else {
@@ -888,7 +917,7 @@ function forEachSubscriber(signal2, visit) {
888
917
  }
889
918
 
890
919
  // src/reactivity/track.ts
891
- var _runtimeVersion = true ? "4.3.0" : "dev";
920
+ var _runtimeVersion = true ? "4.5.0" : "dev";
892
921
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
893
922
  function resolveReactiveApi() {
894
923
  const g2 = globalThis;
@@ -952,10 +981,14 @@ function derived(getter, options) {
952
981
  const cs = {};
953
982
  cs._d = false;
954
983
  cs._init = false;
984
+ cs._f = false;
955
985
  cs._g = getter;
956
986
  cs.__v = 0;
987
+ let evaluating = false;
988
+ let disposed = false;
989
+ let pendingError;
957
990
  const markDirty = () => {
958
- if (cs._d) return;
991
+ if (cs._d || disposed) return;
959
992
  cs._d = true;
960
993
  };
961
994
  markDirty._c = 1;
@@ -978,33 +1011,53 @@ function derived(getter, options) {
978
1011
  }
979
1012
  }, markDirty);
980
1013
  const hook = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
981
- let evaluating = false;
982
1014
  const validate = () => {
983
- if (!cs._d) return;
1015
+ if (!cs._d || disposed || pendingError !== void 0) return;
984
1016
  const oldValue = cs._v;
985
1017
  evaluating = true;
986
1018
  try {
987
1019
  retrack2(recompute, markDirty);
988
1020
  if (!Object.is(oldValue, cs._v)) cs.__v++;
1021
+ } catch (err) {
1022
+ pendingError = { error: err };
1023
+ cs.__v++;
1024
+ if (disposed) cs._d = true;
1025
+ else cs._f = true;
989
1026
  } finally {
990
1027
  evaluating = false;
1028
+ if (disposed) cleanup2(markDirty);
991
1029
  }
992
- if (hook && !Object.is(oldValue, cs._v)) {
1030
+ if (hook && !disposed && !Object.is(oldValue, cs._v)) {
993
1031
  hook.emit("computed:update", { signal: cs, oldValue, newValue: cs._v });
994
1032
  }
995
1033
  };
996
1034
  cs._validate = validate;
1035
+ const throwPending = () => {
1036
+ const { error } = pendingError;
1037
+ pendingError = void 0;
1038
+ if (disposed) cs._d = false;
1039
+ throw error;
1040
+ };
997
1041
  function computedGetter() {
998
1042
  if (evaluating) {
999
1043
  throw new Error(
1000
1044
  `[SibuJS] Circular dependency detected in derived${debugName ? ` "${debugName}"` : ""}. A derived signal cannot read itself (directly or through a chain).`
1001
1045
  );
1002
1046
  }
1003
- if (isTrackingSuspended2()) {
1004
- if (cs._d) validate();
1047
+ if (isTrackingSuspended2() || disposed) {
1048
+ if (cs._d) {
1049
+ validate();
1050
+ if (pendingError !== void 0) throwPending();
1051
+ }
1005
1052
  return cs._v;
1006
1053
  }
1007
- if (cs._d) validate();
1054
+ if (cs._d) {
1055
+ validate();
1056
+ if (pendingError !== void 0) {
1057
+ recordDependency2(cs);
1058
+ throwPending();
1059
+ }
1060
+ }
1008
1061
  recordDependency2(cs);
1009
1062
  return cs._v;
1010
1063
  }
@@ -1013,6 +1066,19 @@ function derived(getter, options) {
1013
1066
  cs.__name = debugName;
1014
1067
  }
1015
1068
  computedGetter.__signal = cs;
1069
+ computedGetter.dispose = () => {
1070
+ if (disposed) return;
1071
+ disposed = true;
1072
+ cs._d = pendingError !== void 0;
1073
+ cleanup2(markDirty);
1074
+ const h = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
1075
+ if (h) {
1076
+ try {
1077
+ h.emit("computed:destroy", { signal: cs, getter: computedGetter });
1078
+ } catch {
1079
+ }
1080
+ }
1081
+ };
1016
1082
  if (hook) hook.emit("computed:create", { signal: cs, name: debugName, getter: computedGetter });
1017
1083
  return computedGetter;
1018
1084
  }
@@ -1686,6 +1752,8 @@ function query(key, fetcher, options = {}) {
1686
1752
  if (disposed) return;
1687
1753
  disposed = true;
1688
1754
  effectCleanup();
1755
+ loading.dispose();
1756
+ isStale.dispose();
1689
1757
  if (intervalTimer) clearInterval(intervalTimer);
1690
1758
  detachFromEntry();
1691
1759
  if (focusHandler && typeof globalThis.removeEventListener === "function") {
@@ -1975,6 +2043,10 @@ function infiniteQuery(key, fetcher, options) {
1975
2043
  disposed = true;
1976
2044
  abortController?.abort();
1977
2045
  effectCleanup();
2046
+ data2.dispose();
2047
+ loading.dispose();
2048
+ hasNextPage.dispose();
2049
+ hasPreviousPage.dispose();
1978
2050
  }
1979
2051
  return {
1980
2052
  data: data2,
@@ -4924,7 +4996,12 @@ function timeline(initial, maxHistory = 100) {
4924
4996
  setIndex(targetIndex);
4925
4997
  }
4926
4998
  }
4927
- return { value, set, undo, redo, canUndo, canRedo, history: history2, index, reset, jumpTo };
4999
+ function dispose2() {
5000
+ value.dispose();
5001
+ canUndo.dispose();
5002
+ canRedo.dispose();
5003
+ }
5004
+ return { value, set, undo, redo, canUndo, canRedo, history: history2, index, reset, jumpTo, dispose: dispose2 };
4928
5005
  }
4929
5006
 
4930
5007
  // src/patterns/globalStore.ts
@@ -5122,31 +5199,39 @@ var validators = {
5122
5199
  };
5123
5200
  function validateProps(props, schema) {
5124
5201
  const result = { ...props };
5125
- const errors = [];
5126
- const isDev2 = typeof process === "undefined" || process?.env?.NODE_ENV !== "production";
5127
- for (const [key, def] of Object.entries(schema)) {
5128
- const propDef = typeof def === "function" ? { type: def } : def;
5129
- if (result[key] == null && propDef.default !== void 0) {
5130
- result[key] = typeof propDef.default === "function" ? propDef.default() : propDef.default;
5131
- }
5132
- if (!isDev2) continue;
5133
- if (propDef.required && result[key] == null) {
5134
- errors.push(`Prop '${key}' is required`);
5135
- continue;
5136
- }
5137
- if (result[key] == null) continue;
5138
- if (propDef.type) {
5139
- const typeResult = propDef.type(result[key], key);
5140
- if (typeResult !== true) errors.push(typeResult);
5202
+ if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
5203
+ const errors = [];
5204
+ for (const [key, def] of Object.entries(schema)) {
5205
+ const propDef = typeof def === "function" ? { type: def } : def;
5206
+ if (result[key] == null && propDef.default !== void 0) {
5207
+ result[key] = typeof propDef.default === "function" ? propDef.default() : propDef.default;
5208
+ }
5209
+ if (propDef.required && result[key] == null) {
5210
+ errors.push(`Prop '${key}' is required`);
5211
+ continue;
5212
+ }
5213
+ if (result[key] == null) continue;
5214
+ if (propDef.type) {
5215
+ const typeResult = propDef.type(result[key], key);
5216
+ if (typeResult !== true) errors.push(typeResult);
5217
+ }
5218
+ if (propDef.validator) {
5219
+ const validResult = propDef.validator(result[key], key);
5220
+ if (validResult !== true) errors.push(validResult);
5221
+ }
5141
5222
  }
5142
- if (propDef.validator) {
5143
- const validResult = propDef.validator(result[key], key);
5144
- if (validResult !== true) errors.push(validResult);
5223
+ if (errors.length > 0) {
5224
+ devWarn(`Prop validation errors:
5225
+ ${errors.map((e) => ` - ${e}`).join("\n")}`);
5145
5226
  }
5227
+ return result;
5146
5228
  }
5147
- if (errors.length > 0 && isDev2) {
5148
- console.warn(`[SibuJS] Prop validation errors:
5149
- ${errors.map((e) => ` - ${e}`).join("\n")}`);
5229
+ for (const [key, def] of Object.entries(schema)) {
5230
+ if (typeof def === "function") continue;
5231
+ const fallback = def.default;
5232
+ if (result[key] == null && fallback !== void 0) {
5233
+ result[key] = typeof fallback === "function" ? fallback() : fallback;
5234
+ }
5150
5235
  }
5151
5236
  return result;
5152
5237
  }
@@ -5157,10 +5242,11 @@ function defineStrictComponent(config) {
5157
5242
  };
5158
5243
  }
5159
5244
  function assertType(value, validator, label2) {
5160
- if (typeof process !== "undefined" && process?.env?.NODE_ENV === "production") return;
5161
- const result = validator(value, label2 || "value");
5162
- if (result !== true) {
5163
- throw new TypeError(`[SibuJS Contract] ${result}`);
5245
+ if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
5246
+ const result = validator(value, label2 || "value");
5247
+ if (result !== true) {
5248
+ throw new TypeError(`[SibuJS Contract] ${result}`);
5249
+ }
5164
5250
  }
5165
5251
  }
5166
5252
  function createGuard(validator) {
@@ -6567,6 +6653,14 @@ function setSafeAttribute(el, name, value, options = {}) {
6567
6653
  const html2 = isHtmlElement(el);
6568
6654
  const idlName = html2 ? name.toLowerCase() : name;
6569
6655
  if (typeof value === "boolean") {
6656
+ if (name.length > 5 && name.slice(0, 5).toLowerCase() === "aria-") {
6657
+ const token = value ? "true" : "false";
6658
+ if ((ns ? el.getAttributeNS(ns, localName) : el.getAttribute(name)) !== token) {
6659
+ if (ns) el.setAttributeNS(ns, name, token);
6660
+ else el.setAttribute(name, token);
6661
+ }
6662
+ return true;
6663
+ }
6570
6664
  if (html2 && BOOLEAN_IDL_ATTRS.has(idlName) && idlName in el) {
6571
6665
  setProp(el, idlName, value);
6572
6666
  } else if (value) {
@@ -6640,13 +6734,13 @@ function bindBoolAttr(el, attr, getter) {
6640
6734
  let value;
6641
6735
  try {
6642
6736
  value = reactiveGetter();
6643
- } catch {
6737
+ } catch (err) {
6738
+ reportError(err, { phase: "binding", name: "bindBoolAttr", node: el });
6644
6739
  return;
6645
6740
  }
6646
6741
  setSafeAttribute(el, attr, Boolean(value), { label: "bindBoolAttr" });
6647
6742
  }
6648
- const teardown = track2(commit);
6649
- return teardown;
6743
+ return reactiveBinding2(commit, el);
6650
6744
  }
6651
6745
  function bindData(el, key, getter) {
6652
6746
  const dataAttr = `data-${key}`;
@@ -6910,7 +7004,13 @@ function pagination(options) {
6910
7004
  const clamped = Math.max(1, Math.min(target, totalPages()));
6911
7005
  setPage(clamped);
6912
7006
  }
6913
- return { page: currentPage, pageSize, totalPages, next, prev, goTo, startIndex, endIndex };
7007
+ function dispose2() {
7008
+ startIndex.dispose();
7009
+ endIndex.dispose();
7010
+ currentPage.dispose();
7011
+ totalPages.dispose();
7012
+ }
7013
+ return { page: currentPage, pageSize, totalPages, next, prev, goTo, startIndex, endIndex, dispose: dispose2 };
6914
7014
  }
6915
7015
 
6916
7016
  // src/ui/eventBus.ts
@@ -11089,6 +11189,16 @@ function initDevTools(config) {
11089
11189
  });
11090
11190
  emit();
11091
11191
  });
11192
+ hook.on("computed:destroy", (payload) => {
11193
+ const p2 = payload;
11194
+ for (const [id, node] of hook.nodes) {
11195
+ if (node.ref === p2.signal) {
11196
+ hook.nodes.delete(id);
11197
+ break;
11198
+ }
11199
+ }
11200
+ emit();
11201
+ });
11092
11202
  hook.on("effect:create", (payload) => {
11093
11203
  _dt.nextNodeId++;
11094
11204
  const name = inferName();
package/dist/extras.d.cts CHANGED
@@ -1,9 +1,9 @@
1
1
  export { ConflictStrategy, InfiniteQueryOptions, InfiniteQueryResult, LoaderRoute, MutationOptions, MutationResult, OfflineStore, OfflineStoreOptions, QueryOptions, QueryResult, Resource, ResourceOptions, RetryOptions, RouteLoaderFn, SyncAdapter, SyncChange, SyncConflict, SyncResult, __resetQueryCache, calculateDelay, clearQueryCache, debounce, executeLoader, getQueryData, infiniteQuery, invalidateQueries, loaderData, mutation, offlineStore, preloadRoute, previous, query, resource, setQueryData, socket, stream, syncAdapter, throttle, withRetry } from './data.cjs';
2
2
  export { AnimationFrameOptions, BoundsRect, GamepadSnapshot, ImageLoaderState, KeyboardOptions, MouseOptions, MutationObserverOptions, SpeakOptions, SwipeDirection, SwipeOptions, TextSelectionState, UrlStateOptions, animationFrame, battery, bounds, broadcast, clipboard, colorScheme, draggable, dropZone, favicon, formatCurrency, formatNumber, fullscreen, gamepad, geo, idle, imageLoader, keyboard, media, mouse, mutationObserver, network, online, permissions, pointerLock, resize, scroll, speech, svgFavicon, swipe, textSelection, title, urlState, vibrate, visibility, wakeLock, windowSize } from './browser.cjs';
3
3
  export { GlobalStore, MachineConfig, MachineReturn, Middleware, PersistOptions, Selector, StoreActionMap, TimeTravelReturn, globalStore, machine, optimistic, optimisticList, persisted, timeline } from './patterns.cjs';
4
- export { C as ComponentProps, P as PropDef, a as PropSchema, R as RenderProp, V as Validator, b as assertType, c as compose, d as createGuard, e as createSlots, f as defineComponent, g as defineSlottedComponent, h as defineStrictComponent, v as validateProps, i as validators, w as withBoundary, j as withDefaults, k as withProps, l as withWrapper } from './contracts-Hg6ITAEF.cjs';
4
+ export { C as ComponentProps, P as PropDef, a as PropSchema, R as RenderProp, V as Validator, b as assertType, c as compose, d as createGuard, e as createSlots, f as defineComponent, g as defineSlottedComponent, h as defineStrictComponent, v as validateProps, i as validators, w as withBoundary, j as withDefaults, k as withProps, l as withWrapper } from './contracts-DBdg9J_a.cjs';
5
5
  export { AnimationPreset, PresetOptions, SlideDirection, SpringOptions, TransitionGroup, TransitionGroupOptions, TransitionOptions, animate, bounceIn, bounceOut, fadeIn, fadeOut, flipIn, prefersReducedMotion, pulse, reducedMotion, scaleDown, scaleUp, sequence, shake, slideIn, slideOut, spring, springSignal, stagger, transition, viewTransition } from './motion.cjs';
6
- export { A as AttributeSource, a as AttributeValue, B as BoundFieldProps, C as CustomElementOptions, F as FieldConfig, b as FocusTrap, c as FormConfig, d as FormField, e as FormReturn, I as IntersectionResult, M as MaskOptions, T as Toast, f as ToastInstance, V as ValidatorFn, g as VirtualList, h as VirtualListProps, _ as __resetDialogStack, i as announce, j as aria, k as bindAttrs, l as bindBoolAttr, m as bindData, n as bindField, o as creditCardMask, p as custom, q as dateMask, r as defineElement, s as dialog, t as email, u as eventBus, v as focus, w as form, x as hotkey, y as infiniteScroll, z as inputMask, D as intersection, E as lazyLoad, G as matchesPattern, H as max, J as maxLength, K as min, L as minLength, N as pagination, O as phoneMask, P as removeScopedStyle, Q as required, R as scopedStyle, S as ssnMask, U as svgElement, W as timeMask, X as toast, Y as withScopedStyle, Z as zipMask } from './customElement-CNZxEB9G.cjs';
6
+ export { A as AttributeSource, a as AttributeValue, B as BoundFieldProps, C as CustomElementOptions, F as FieldConfig, b as FocusTrap, c as FormConfig, d as FormField, e as FormReturn, I as IntersectionResult, M as MaskOptions, P as PaginationResult, T as Toast, f as ToastInstance, V as ValidatorFn, g as VirtualList, h as VirtualListProps, _ as __resetDialogStack, i as announce, j as aria, k as bindAttrs, l as bindBoolAttr, m as bindData, n as bindField, o as creditCardMask, p as custom, q as dateMask, r as defineElement, s as dialog, t as email, u as eventBus, v as focus, w as form, x as hotkey, y as infiniteScroll, z as inputMask, D as intersection, E as lazyLoad, G as matchesPattern, H as max, J as maxLength, K as min, L as minLength, N as pagination, O as phoneMask, Q as removeScopedStyle, R as required, S as scopedStyle, U as ssnMask, W as svgElement, X as timeMask, Y as toast, Z as withScopedStyle, $ as zipMask } from './customElement-OB9CIsc5.cjs';
7
7
  export { ChunkConfig, DOMPool, Features, NormalizeResult, NormalizedEntities, NormalizedSchema, NormalizedState, NormalizedStoreActions, Priority, PriorityLevel, block, cloneTemplate, conditional, createChunkRegistry, deferredValue, denormalize, devOnly, flushScheduler, getDOMPool, hoistable, lazyChunk, noSideEffect, normalize, normalizedStore, pendingTasks, precompile, prefetch, preloadImage, preloadModule, preloadModules, preloadResource, processInChunks, pure, resetIdCounter, scheduleUpdate, setIdPrefix, startTransition, staticTemplate, transitionState, uniqueId, yieldToMain } from './performance.cjs';
8
8
  export { ActionFn, ActionResult, Head, ISROptions, LoadRemoteModuleOptions, LoadWasmOptions, MicroApp, MicroAppConfig, MiddlewareFn, SSGOptions, SSGResult, ScrollRestorationOptions, ServiceWorkerState, SharedScope, UseWorkerFnReturn, UseWorkerReturn, WasmConfig, WasmModuleState, WorkerPool, clearWasmCache, composeMiddleware, createAction, createISR, createMicroApp, createMiddlewareChain, createSharedScope, createWasmBridge, createWorkerPool, defineRemoteComponent, generateStaticSite, isWasmCached, loadRemoteModule, loadWasmModule, loadWasmModuleWithOptions, preloadWasm, scrollRestoration, serviceWorker, setCanonical, setStructuredData, wasm, worker, workerFn } from './ssr.cjs';
9
9
  export { H as HydrateOptions, a as HydrationMismatch, T as TrustedHTML, c as collectStream, d as deserializeState, e as escapeScriptJson, h as hydrate, b as hydrateIslands, f as hydrateProgressively, i as isDangerousMetaRefresh, g as island, r as renderToDocument, j as renderToReadableStream, k as renderToStream, l as renderToString, m as renderToSuspenseStream, n as resetSSRState, s as serializeState, o as ssrSuspense, p as suspenseSwapScript, t as trustHTML } from './ssr-BiPRdZ6n.cjs';
@@ -13,4 +13,4 @@ export { D as DevToolsEvent, a as DevtoolsOverlayOptions, P as ProfilerResult, R
13
13
  export { AccordionAriaBinding, AccordionOptions, ComboboxOptions, DatePickerOptions, FileUploadOptions, SelectOptions, SetContentOptions, TabsAriaBinding, TabsOptions, accordion, combobox, contentEditable, datePicker, fileUpload, popover, select, tabs, tooltip } from './widgets.cjs';
14
14
  export { AdaptedComponent, AdaptedComponentProps, AdapterConfig, ComponentMapping, MobXAdapterAPI, MobXAdapterOptions, MobXReactionDisposer, ReduxAdapterAPI, ReduxAdapterOptions, ReduxStore, ThemeAPI, ThemeConfig, ZustandAdapterAPI, ZustandAdapterOptions, ZustandStore, antdAdapter, chakraAdapter, componentAdapter, createTheme, materialAdapter, mobXAdapter, reduxAdapter, zustandAdapter } from './ecosystem.cjs';
15
15
  import './signal-BnWpq6WB.cjs';
16
- import './tagFactory-Bzupt4Pj.cjs';
16
+ import './tagFactory-DVoDpHye.cjs';