sibujs 4.5.0 → 4.7.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 (116) hide show
  1. package/README.md +1 -1
  2. package/dist/browser.cjs +326 -133
  3. package/dist/browser.d.cts +46 -14
  4. package/dist/browser.d.ts +46 -14
  5. package/dist/browser.js +8 -6
  6. package/dist/build.cjs +2094 -1033
  7. package/dist/build.d.cts +133 -44
  8. package/dist/build.d.ts +133 -44
  9. package/dist/build.js +1372 -574
  10. package/dist/cdn.dev.global.js +10 -10
  11. package/dist/cdn.full.dev.global.js +11 -11
  12. package/dist/cdn.full.global.js +10 -10
  13. package/dist/cdn.global.js +10 -10
  14. package/dist/{chunk-2DCGACUU.js → chunk-2BPG2XDA.js} +251 -66
  15. package/dist/{chunk-IXKSNWV5.js → chunk-2INLLLMZ.js} +1 -1
  16. package/dist/{chunk-4PMLNECI.js → chunk-3QWBSL5R.js} +98 -29
  17. package/dist/{chunk-KKLW7YWL.js → chunk-4AWA2PVD.js} +275 -144
  18. package/dist/chunk-5HZXGZ6T.js +24 -0
  19. package/dist/{chunk-PCT43HW3.js → chunk-7LUJQAOJ.js} +1 -1
  20. package/dist/{chunk-5DXA2J44.js → chunk-7XHATCIH.js} +5 -2
  21. package/dist/chunk-BC2SECJD.js +44 -0
  22. package/dist/{chunk-TBYTO6BS.js → chunk-BSY63EM6.js} +136 -80
  23. package/dist/{chunk-FTIR4QW2.js → chunk-DKXRACVN.js} +6 -8
  24. package/dist/{chunk-ONOHFDLG.js → chunk-FNJXNGYZ.js} +3 -3
  25. package/dist/{chunk-XZZOBQAY.js → chunk-FQRUXCEE.js} +6 -5
  26. package/dist/{chunk-NIOYEGBQ.js → chunk-HURREPU2.js} +27 -13
  27. package/dist/chunk-J6FW5TV6.js +233 -0
  28. package/dist/{chunk-UGRX3S57.js → chunk-JWKYU5GV.js} +22 -4
  29. package/dist/chunk-NYNYSPK7.js +318 -0
  30. package/dist/{chunk-RBTPLM32.js → chunk-RUSSKG6G.js} +13 -12
  31. package/dist/{chunk-7LN645I6.js → chunk-SLM3IA34.js} +3 -3
  32. package/dist/{chunk-R25EFXXC.js → chunk-TUCPL2HB.js} +3 -3
  33. package/dist/{chunk-B3WHI2QA.js → chunk-UNWRJRKC.js} +55 -31
  34. package/dist/{chunk-KEISJXBU.js → chunk-UOL2ECCS.js} +44 -17
  35. package/dist/{chunk-RJE2BNI4.js → chunk-VZSG24LS.js} +108 -45
  36. package/dist/{chunk-RIXRAYIU.js → chunk-WEQ3DMVL.js} +10 -4
  37. package/dist/{chunk-3JZ4L5TJ.js → chunk-WOLJZUFQ.js} +354 -90
  38. package/dist/{chunk-S373NSMK.js → chunk-XYV3EDB7.js} +283 -123
  39. package/dist/{chunk-VZKNK2V7.js → chunk-XZR4PXRE.js} +296 -38
  40. package/dist/{chunk-GW3SCCZG.js → chunk-Z3OHK6QT.js} +153 -110
  41. package/dist/{chunk-OMJJM3KM.js → chunk-ZVL7TY4K.js} +287 -130
  42. package/dist/{contracts-DBdg9J_a.d.ts → contracts-CLqzJnOV.d.ts} +36 -17
  43. package/dist/{contracts-DBdg9J_a.d.cts → contracts-CTOJXu-x.d.cts} +36 -17
  44. package/dist/{customElement-OB9CIsc5.d.cts → customElement-MmInOW1U.d.cts} +21 -0
  45. package/dist/{customElement-OB9CIsc5.d.ts → customElement-MmInOW1U.d.ts} +21 -0
  46. package/dist/data.cjs +410 -155
  47. package/dist/data.d.cts +166 -12
  48. package/dist/data.d.ts +166 -12
  49. package/dist/data.js +12 -9
  50. package/dist/devtools.cjs +98 -61
  51. package/dist/devtools.js +7 -8
  52. package/dist/dispose-GEIG2KOF.js +28 -0
  53. package/dist/ecosystem.cjs +372 -126
  54. package/dist/ecosystem.d.cts +20 -3
  55. package/dist/ecosystem.d.ts +20 -3
  56. package/dist/ecosystem.js +12 -12
  57. package/dist/extras.cjs +2366 -909
  58. package/dist/extras.d.cts +11 -9
  59. package/dist/extras.d.ts +11 -9
  60. package/dist/extras.js +39 -28
  61. package/dist/index.cjs +421 -158
  62. package/dist/index.d.cts +213 -171
  63. package/dist/index.d.ts +213 -171
  64. package/dist/index.js +24 -27
  65. package/dist/motion.cjs +118 -44
  66. package/dist/motion.js +5 -5
  67. package/dist/patterns.cjs +344 -53
  68. package/dist/patterns.d.cts +28 -9
  69. package/dist/patterns.d.ts +28 -9
  70. package/dist/patterns.js +8 -8
  71. package/dist/performance.cjs +325 -220
  72. package/dist/performance.d.cts +2 -2
  73. package/dist/performance.d.ts +2 -2
  74. package/dist/performance.js +8 -9
  75. package/dist/plugin-DVgSnTfK.d.cts +112 -0
  76. package/dist/plugin-DVgSnTfK.d.ts +112 -0
  77. package/dist/plugins.cjs +664 -233
  78. package/dist/plugins.d.cts +127 -14
  79. package/dist/plugins.d.ts +127 -14
  80. package/dist/plugins.js +96 -42
  81. package/dist/signal-EotCj4hS.d.cts +110 -0
  82. package/dist/signal-EotCj4hS.d.ts +110 -0
  83. package/dist/{ssr-BiPRdZ6n.d.cts → ssr-Bli9XRW5.d.cts} +5 -0
  84. package/dist/{ssr-BiPRdZ6n.d.ts → ssr-Bli9XRW5.d.ts} +5 -0
  85. package/dist/{ssr-Y7XOEPEN.js → ssr-XOTUASDO.js} +4 -5
  86. package/dist/ssr.cjs +229 -84
  87. package/dist/ssr.d.cts +9 -3
  88. package/dist/ssr.d.ts +9 -3
  89. package/dist/ssr.js +11 -12
  90. package/dist/{startup-BMpaiMhP.d.ts → startup-BLfSeL15.d.cts} +73 -22
  91. package/dist/{startup-BMpaiMhP.d.cts → startup-BLfSeL15.d.ts} +73 -22
  92. package/dist/tagFactory-8qL9LCIx.d.cts +156 -0
  93. package/dist/tagFactory-BL2fymez.d.ts +156 -0
  94. package/dist/testing.cjs +2503 -2191
  95. package/dist/testing.d.cts +56 -5
  96. package/dist/testing.d.ts +56 -5
  97. package/dist/testing.js +580 -307
  98. package/dist/types-CJFViL6Q.d.cts +26 -0
  99. package/dist/types-CJFViL6Q.d.ts +26 -0
  100. package/dist/ui.cjs +732 -329
  101. package/dist/ui.d.cts +41 -7
  102. package/dist/ui.d.ts +41 -7
  103. package/dist/ui.js +151 -56
  104. package/dist/widgets.cjs +267 -291
  105. package/dist/widgets.js +9 -10
  106. package/package.json +4 -2
  107. package/dist/chunk-2WLZ6757.js +0 -149
  108. package/dist/chunk-CCSJMTRN.js +0 -15
  109. package/dist/chunk-QKRPLZ2V.js +0 -108
  110. package/dist/chunk-VUF4ALSW.js +0 -60
  111. package/dist/chunk-WWV3SJ3L.js +0 -131
  112. package/dist/dispose-46BOMMQJ.js +0 -19
  113. package/dist/plugin-D30wlGW5.d.cts +0 -71
  114. package/dist/plugin-D30wlGW5.d.ts +0 -71
  115. package/dist/tagFactory-DVoDpHye.d.cts +0 -215
  116. package/dist/tagFactory-DVoDpHye.d.ts +0 -215
package/dist/devtools.cjs CHANGED
@@ -280,6 +280,79 @@ function reportError(error, context) {
280
280
  });
281
281
  }
282
282
 
283
+ // src/core/rendering/dispose.ts
284
+ var elementDisposers = /* @__PURE__ */ new WeakMap();
285
+ var MAX_DRAIN_TEARDOWNS = 1e4;
286
+ function reportDrainRunaway(label, executed, remaining) {
287
+ if (typeof console === "undefined") return;
288
+ console.error(
289
+ `[SibuJS ${label}] runaway cleanup: stopped after running ${executed} teardowns with ${remaining} still queued. Cleanup production did not stabilize before the teardown safety ceiling was reached \u2014 the remaining work was NOT run.`,
290
+ { executed, remaining }
291
+ );
292
+ }
293
+ var activeBindingCount = 0;
294
+ function resolveCapture(capture) {
295
+ let frame = capture;
296
+ while (frame?.closed) frame = frame.forwardTo;
297
+ return frame ?? null;
298
+ }
299
+ var registrationCaptures = [];
300
+ function currentDisposerCapture() {
301
+ return resolveCapture(registrationCaptures[registrationCaptures.length - 1]);
302
+ }
303
+ function beginDisposerCapture(capture) {
304
+ if (capture === null && registrationCaptures.length === 0) return false;
305
+ registrationCaptures.push(resolveCapture(capture));
306
+ return true;
307
+ }
308
+ function endDisposerCapture() {
309
+ registrationCaptures.pop();
310
+ }
311
+ function dispose(node) {
312
+ const stack = [node];
313
+ const order = [];
314
+ while (stack.length > 0) {
315
+ const current = stack.pop();
316
+ order.push(current);
317
+ const children = Array.from(current.childNodes);
318
+ for (let i = 0; i < children.length; i++) {
319
+ stack.push(children[i]);
320
+ }
321
+ }
322
+ for (let i = order.length - 1; i >= 0; i--) {
323
+ disposeNodeOwn(order[i]);
324
+ }
325
+ }
326
+ function disposeNodeOwn(node) {
327
+ if (!elementDisposers.has(node)) return;
328
+ let executed = 0;
329
+ let runaway = false;
330
+ while (!runaway) {
331
+ const pending = elementDisposers.get(node);
332
+ if (!pending || pending.length === 0) break;
333
+ const snapshot = pending.slice();
334
+ elementDisposers.delete(node);
335
+ if (DEV) activeBindingCount -= snapshot.length;
336
+ for (let i = 0; i < snapshot.length; i++) {
337
+ if (executed >= MAX_DRAIN_TEARDOWNS) {
338
+ const rest = snapshot.slice(i);
339
+ const added = elementDisposers.get(node);
340
+ elementDisposers.set(node, added ? rest.concat(added) : rest);
341
+ if (DEV) activeBindingCount += rest.length;
342
+ reportDrainRunaway("dispose", executed, rest.length + (added?.length ?? 0));
343
+ runaway = true;
344
+ break;
345
+ }
346
+ executed++;
347
+ try {
348
+ snapshot[i]();
349
+ } catch (err) {
350
+ reportError(err, { phase: "cleanup", name: "disposer" });
351
+ }
352
+ }
353
+ }
354
+ }
355
+
283
356
  // src/reactivity/track-core.ts
284
357
  var POOL_MAX = 4096;
285
358
  var nodePool = [];
@@ -438,6 +511,7 @@ function retrack(effectFn, subscriber) {
438
511
  }
439
512
  currentSubscriber = subscriber;
440
513
  const sub = subscriber;
514
+ if (sub._cap === void 0) sub._cap = currentDisposerCapture();
441
515
  const epoch = ++subscriberEpochCounter;
442
516
  sub._epoch = epoch;
443
517
  sub._structDirty = false;
@@ -629,7 +703,12 @@ function drainQueue() {
629
703
  quarantined.add(sub);
630
704
  continue;
631
705
  }
632
- safeInvoke(sub);
706
+ const pushed = beginDisposerCapture(sub._cap ?? null);
707
+ try {
708
+ safeInvoke(sub);
709
+ } finally {
710
+ if (pushed) endDisposerCapture();
711
+ }
633
712
  }
634
713
  }
635
714
  function drainNotificationQueue() {
@@ -765,7 +844,7 @@ function forEachSubscriber(signal2, visit) {
765
844
  }
766
845
 
767
846
  // src/reactivity/track.ts
768
- var _runtimeVersion = true ? "4.5.0" : "dev";
847
+ var _runtimeVersion = true ? "4.7.0" : "dev";
769
848
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
770
849
  function resolveReactiveApi() {
771
850
  const g = globalThis;
@@ -871,6 +950,14 @@ var batch = API2.batch;
871
950
  var enqueueBatchedSignal = API2.enqueueBatchedSignal;
872
951
  var isBatching = API2.isBatching;
873
952
 
953
+ // src/core/devtoolsHook.ts
954
+ function emitDevtools(hook, event, payload) {
955
+ try {
956
+ hook.emit(event, payload);
957
+ } catch {
958
+ }
959
+ }
960
+
874
961
  // src/core/signals/signal.ts
875
962
  var _g = globalThis;
876
963
  function signal(initial, options) {
@@ -904,7 +991,7 @@ function signal(initial, options) {
904
991
  state2.__v++;
905
992
  if (DEV) {
906
993
  const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
907
- if (hook) hook.emit("signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
994
+ if (hook) emitDevtools(hook, "signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
908
995
  }
909
996
  if (!enqueueBatchedSignal(state2)) {
910
997
  notifySubscribers2(state2);
@@ -918,7 +1005,7 @@ function signal(initial, options) {
918
1005
  state2.value = newValue;
919
1006
  state2.__v++;
920
1007
  const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
921
- if (hook) hook.emit("signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
1008
+ if (hook) emitDevtools(hook, "signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
922
1009
  if (!enqueueBatchedSignal(state2)) {
923
1010
  notifySubscribers2(state2);
924
1011
  }
@@ -937,7 +1024,7 @@ function signal(initial, options) {
937
1024
  }
938
1025
  if (DEV) {
939
1026
  const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
940
- if (hook) hook.emit("signal:create", { signal: state2, name: debugName, getter: get, initial });
1027
+ if (hook) emitDevtools(hook, "signal:create", { signal: state2, name: debugName, getter: get, initial });
941
1028
  }
942
1029
  return [get, set];
943
1030
  }
@@ -1637,61 +1724,6 @@ function devState(name, initial) {
1637
1724
  return [get, trackedSet];
1638
1725
  }
1639
1726
 
1640
- // src/core/rendering/dispose.ts
1641
- var elementDisposers = /* @__PURE__ */ new WeakMap();
1642
- var MAX_DRAIN_TEARDOWNS = 1e4;
1643
- function reportDrainRunaway(label, executed, remaining) {
1644
- if (typeof console === "undefined") return;
1645
- console.error(
1646
- `[SibuJS ${label}] runaway cleanup: stopped after running ${executed} teardowns with ${remaining} still queued. Cleanup production did not stabilize before the teardown safety ceiling was reached \u2014 the remaining work was NOT run.`,
1647
- { executed, remaining }
1648
- );
1649
- }
1650
- var activeBindingCount = 0;
1651
- function dispose(node) {
1652
- const stack = [node];
1653
- const order = [];
1654
- while (stack.length > 0) {
1655
- const current = stack.pop();
1656
- order.push(current);
1657
- const children = Array.from(current.childNodes);
1658
- for (let i = 0; i < children.length; i++) {
1659
- stack.push(children[i]);
1660
- }
1661
- }
1662
- for (let i = order.length - 1; i >= 0; i--) {
1663
- const current = order[i];
1664
- if (elementDisposers.has(current)) {
1665
- let executed = 0;
1666
- let runaway = false;
1667
- while (!runaway) {
1668
- const pending = elementDisposers.get(current);
1669
- if (!pending || pending.length === 0) break;
1670
- const snapshot = pending.slice();
1671
- elementDisposers.delete(current);
1672
- if (DEV) activeBindingCount -= snapshot.length;
1673
- for (let i2 = 0; i2 < snapshot.length; i2++) {
1674
- if (executed >= MAX_DRAIN_TEARDOWNS) {
1675
- const rest = snapshot.slice(i2);
1676
- const added = elementDisposers.get(current);
1677
- elementDisposers.set(current, added ? rest.concat(added) : rest);
1678
- if (DEV) activeBindingCount += rest.length;
1679
- reportDrainRunaway("dispose", executed, rest.length + (added?.length ?? 0));
1680
- runaway = true;
1681
- break;
1682
- }
1683
- executed++;
1684
- try {
1685
- snapshot[i2]();
1686
- } catch (err) {
1687
- reportError(err, { phase: "cleanup", name: "disposer" });
1688
- }
1689
- }
1690
- }
1691
- }
1692
- }
1693
- }
1694
-
1695
1727
  // src/devtools/hmr.ts
1696
1728
  var HMR_STORE_MAX_SIZE = 200;
1697
1729
  var hmrStateStore = /* @__PURE__ */ new Map();
@@ -2140,12 +2172,17 @@ function effect(effectFn, options) {
2140
2172
  try {
2141
2173
  retrack2(ctx.bodyFn, ctx.subscriber);
2142
2174
  if (ctx.rerunPending) drainReruns(ctx);
2175
+ } catch (err) {
2176
+ ctx.disposed = true;
2177
+ if (ctx.userCleanups.length > 0) flushUserCleanups(ctx);
2178
+ cleanup2(ctx.subscriber);
2179
+ throw err;
2143
2180
  } finally {
2144
2181
  ctx.running = false;
2145
2182
  ctx.rerunPending = false;
2146
2183
  }
2147
2184
  const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
2148
- if (hook) hook.emit("effect:create", { effectFn });
2185
+ if (hook) emitDevtools(hook, "effect:create", { effectFn });
2149
2186
  return () => disposeEffect(ctx);
2150
2187
  }
2151
2188
 
package/dist/devtools.js CHANGED
@@ -35,17 +35,16 @@ import {
35
35
  trackCleanup,
36
36
  walkDependencyGraph,
37
37
  withErrorTracking
38
- } from "./chunk-FTIR4QW2.js";
39
- import "./chunk-IXKSNWV5.js";
38
+ } from "./chunk-DKXRACVN.js";
39
+ import "./chunk-2INLLLMZ.js";
40
40
  import "./chunk-7ZHH77QA.js";
41
- import "./chunk-RIXRAYIU.js";
42
- import "./chunk-5DXA2J44.js";
43
- import "./chunk-QKRPLZ2V.js";
44
- import "./chunk-XZZOBQAY.js";
45
- import "./chunk-UGRX3S57.js";
41
+ import "./chunk-WEQ3DMVL.js";
42
+ import "./chunk-7XHATCIH.js";
43
+ import "./chunk-FQRUXCEE.js";
44
+ import "./chunk-JWKYU5GV.js";
46
45
  import {
47
46
  isDev
48
- } from "./chunk-2WLZ6757.js";
47
+ } from "./chunk-NYNYSPK7.js";
49
48
 
50
49
  // src/devtools/signalGraph.ts
51
50
  function getHook() {
@@ -0,0 +1,28 @@
1
+ import {
2
+ MAX_DRAIN_TEARDOWNS,
3
+ beginDisposerCapture,
4
+ checkLeaks,
5
+ currentDisposerCapture,
6
+ dispose,
7
+ disposeNodeOwn,
8
+ endDisposerCapture,
9
+ registerDisposer,
10
+ replaceChildrenSafely,
11
+ reportDrainRunaway,
12
+ unregisterDisposer,
13
+ withDisposerRollback
14
+ } from "./chunk-NYNYSPK7.js";
15
+ export {
16
+ MAX_DRAIN_TEARDOWNS,
17
+ beginDisposerCapture,
18
+ checkLeaks,
19
+ currentDisposerCapture,
20
+ dispose,
21
+ disposeNodeOwn,
22
+ endDisposerCapture,
23
+ registerDisposer,
24
+ replaceChildrenSafely,
25
+ reportDrainRunaway,
26
+ unregisterDisposer,
27
+ withDisposerRollback
28
+ };