sibujs 4.1.0 → 4.3.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 +307 -111
  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-ANGSYNPX.js → chunk-2LSY4WDM.js} +86 -44
  9. package/dist/{chunk-VPP2FONR.js → chunk-2WLZ6757.js} +17 -10
  10. package/dist/{chunk-DCDS2PQ6.js → chunk-3E5YNK2F.js} +2 -2
  11. package/dist/{chunk-TIRZCERI.js → chunk-5DXA2J44.js} +1 -1
  12. package/dist/{chunk-PFTDGEPZ.js → chunk-7BJLKDBI.js} +3 -3
  13. package/dist/{chunk-XSZRJW76.js → chunk-7BPN4MXR.js} +6 -6
  14. package/dist/{chunk-BMSN6NWQ.js → chunk-7GQIRV27.js} +6 -6
  15. package/dist/{chunk-SHDVWATN.js → chunk-7UBG6LDP.js} +7 -8
  16. package/dist/{chunk-MRAMKDHQ.js → chunk-7UK6BSAT.js} +1 -1
  17. package/dist/{chunk-LOFZHP6V.js → chunk-AAHT6AKT.js} +7 -8
  18. package/dist/{chunk-FMHIQNMP.js → chunk-G7GPNB6N.js} +5 -5
  19. package/dist/{chunk-XIHMS2Y6.js → chunk-GZYQNIPS.js} +8 -8
  20. package/dist/{chunk-5INI7D2L.js → chunk-IXKSNWV5.js} +74 -11
  21. package/dist/{chunk-KSOEJGFO.js → chunk-IYHM4FWD.js} +3 -3
  22. package/dist/{chunk-AW6HPJ3L.js → chunk-KKLW7YWL.js} +1 -1
  23. package/dist/{chunk-5GJ5RTHA.js → chunk-L4B3Y3OM.js} +7 -8
  24. package/dist/{chunk-UFSQEO7P.js → chunk-MYA5HEK5.js} +7 -8
  25. package/dist/{chunk-HYCCIYNS.js → chunk-NIOYEGBQ.js} +13 -14
  26. package/dist/{chunk-DHDZ7IVN.js → chunk-QKRPLZ2V.js} +7 -8
  27. package/dist/{chunk-FB7KQXZI.js → chunk-R4EF7V3K.js} +4 -4
  28. package/dist/{chunk-IM7N5WR4.js → chunk-RE6KLGMV.js} +2 -2
  29. package/dist/{chunk-D3SZ4LVS.js → chunk-TSL64O5L.js} +5 -6
  30. package/dist/{chunk-DAKLOMKS.js → chunk-UD6YE2GW.js} +3 -3
  31. package/dist/{chunk-4U7KD3RY.js → chunk-USS5ENJ2.js} +3 -3
  32. package/dist/{chunk-I3VI34DP.js → chunk-XGCZ45NH.js} +149 -33
  33. package/dist/{chunk-4RH6D7GR.js → chunk-ZVYNIUOG.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 +301 -105
  50. package/dist/index.d.cts +190 -37
  51. package/dist/index.d.ts +190 -37
  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 +263 -88
  64. package/dist/plugins.d.cts +102 -2
  65. package/dist/plugins.d.ts +102 -2
  66. package/dist/plugins.js +21 -19
  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
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-7BPN4MXR.js";
24
+ import "./chunk-L4B3Y3OM.js";
25
+ import "./chunk-3E5YNK2F.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-7BJLKDBI.js";
29
+ import "./chunk-5DXA2J44.js";
30
+ import "./chunk-MYA5HEK5.js";
31
+ import "./chunk-TSL64O5L.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.3.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-ZVYNIUOG.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-7BJLKDBI.js";
42
+ import "./chunk-5DXA2J44.js";
43
+ import "./chunk-QKRPLZ2V.js";
44
+ import "./chunk-MYA5HEK5.js";
45
+ import "./chunk-TSL64O5L.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,