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
package/README.md CHANGED
@@ -200,13 +200,37 @@ Utilities for testing components and reactivity.
200
200
  ### `sibujs/cdn` — Script-tag bundle
201
201
  Self-registering IIFE build exposing `window.Sibu`, for use without a bundler.
202
202
 
203
+ There are two builds. Load **exactly one** — they both define `window.Sibu`, so
204
+ loading both leaves whichever came last in charge.
205
+
206
+ Development, with every diagnostic live:
207
+
208
+ ```html
209
+ <script src="https://unpkg.com/sibujs@latest/dist/cdn.dev.global.js"></script>
210
+ ```
211
+
212
+ Production, with diagnostics compiled out rather than merely disabled:
213
+
203
214
  ```html
204
215
  <script src="https://unpkg.com/sibujs@latest/dist/cdn.global.js"></script>
216
+ ```
217
+
218
+ Either way, the API is on `window.Sibu`:
219
+
220
+ ```html
205
221
  <script>
206
222
  const { signal, effect, div, mount } = window.Sibu;
207
223
  </script>
208
224
  ```
209
225
 
226
+ Develop against `cdn.dev.global.js` and swap the one line to ship. The runtime
227
+ behaviour is identical; only the warnings differ.
228
+
229
+ A bundled app needs neither file — import from `"sibujs"` and let your bundler
230
+ define `__SIBU_DEV__` per build (the Vite and webpack plugins in `sibujs/build`
231
+ do this for you). The two CDN files exist because a `<script>` tag has no
232
+ bundler to make that choice.
233
+
210
234
  ---
211
235
 
212
236
  ## Ecosystem
package/dist/browser.cjs CHANGED
@@ -60,23 +60,17 @@ __export(browser_exports, {
60
60
  module.exports = __toCommonJS(browser_exports);
61
61
 
62
62
  // src/core/dev.ts
63
- function isDev() {
64
- return typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : (
65
- // The bare `__SIBU_DEV__` is a bundler define that only exists in
66
- // production builds; under the test runner it is always undefined, so
67
- // this branch is unreachable here.
68
- /* v8 ignore next 2 */
69
- typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
70
- );
71
- }
72
- var _isDev = isDev();
63
+ var DEV = typeof __SIBU_DEV__ !== "undefined" ? !!__SIBU_DEV__ : typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : (
64
+ // safe default: off in browser, on in test/dev Node
65
+ typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
66
+ );
73
67
  function devAssert(condition, message) {
74
- if (_isDev && !condition) {
68
+ if ((typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) && !condition) {
75
69
  throw new Error(`[SibuJS] ${message}`);
76
70
  }
77
71
  }
78
72
  function devWarn(message) {
79
- if (_isDev) {
73
+ if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
80
74
  console.warn(`[SibuJS] ${message}`);
81
75
  }
82
76
  }
@@ -625,17 +619,16 @@ function forEachSubscriber(signal2, visit) {
625
619
  }
626
620
 
627
621
  // src/reactivity/track.ts
628
- var _isDev2 = isDev();
629
- var _runtimeVersion = true ? "4.1.0" : "dev";
622
+ var _runtimeVersion = true ? "4.2.0" : "dev";
630
623
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
631
624
  function resolveReactiveApi() {
632
625
  const g = globalThis;
633
626
  const existing = g[REGISTRY_KEY];
634
627
  if (existing) {
635
- if (_isDev2 && !existing.__dupWarned) {
628
+ if (DEV && !existing.__dupWarned) {
636
629
  existing.__dupWarned = true;
637
630
  devWarn(
638
- `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']).`
631
+ `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.`
639
632
  );
640
633
  }
641
634
  return existing;
@@ -734,7 +727,6 @@ var isBatching = API2.isBatching;
734
727
 
735
728
  // src/core/signals/signal.ts
736
729
  var _g = globalThis;
737
- var _isDev3 = isDev();
738
730
  function signal(initial, options) {
739
731
  const state2 = {
740
732
  value: initial,
@@ -747,7 +739,7 @@ function signal(initial, options) {
747
739
  _d: false,
748
740
  _validate: void 0
749
741
  };
750
- const debugName = _isDev3 ? options?.name : void 0;
742
+ const debugName = DEV ? options?.name : void 0;
751
743
  const equalsFn = options?.equals;
752
744
  if (debugName) state2.__name = debugName;
753
745
  function get() {
@@ -764,7 +756,7 @@ function signal(initial, options) {
764
756
  if (equalsFn(prev, newValue)) return;
765
757
  state2.value = newValue;
766
758
  state2.__v++;
767
- if (_isDev3) {
759
+ if (DEV) {
768
760
  const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
769
761
  if (hook) hook.emit("signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
770
762
  }
@@ -772,7 +764,7 @@ function signal(initial, options) {
772
764
  notifySubscribers2(state2);
773
765
  }
774
766
  };
775
- } else if (_isDev3) {
767
+ } else if (DEV) {
776
768
  set = (next) => {
777
769
  const prev = state2.value;
778
770
  const newValue = typeof next === "function" ? next(prev) : next;
@@ -797,7 +789,7 @@ function signal(initial, options) {
797
789
  }
798
790
  };
799
791
  }
800
- if (_isDev3) {
792
+ if (DEV) {
801
793
  const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
802
794
  if (hook) hook.emit("signal:create", { signal: state2, name: debugName, getter: get, initial });
803
795
  }
package/dist/browser.js CHANGED
@@ -35,15 +35,15 @@ import {
35
35
  visibility,
36
36
  wakeLock,
37
37
  windowSize
38
- } from "./chunk-DAKLOMKS.js";
38
+ } from "./chunk-KE4KWRDY.js";
39
39
  import "./chunk-H3SRKIYX.js";
40
40
  import "./chunk-52XFPGSN.js";
41
41
  import "./chunk-7ZHH77QA.js";
42
- import "./chunk-PFTDGEPZ.js";
43
- import "./chunk-TIRZCERI.js";
44
- import "./chunk-UFSQEO7P.js";
45
- import "./chunk-D3SZ4LVS.js";
46
- import "./chunk-VPP2FONR.js";
42
+ import "./chunk-7VEC3UD2.js";
43
+ import "./chunk-5DXA2J44.js";
44
+ import "./chunk-HECVW343.js";
45
+ import "./chunk-7ALC7KGE.js";
46
+ import "./chunk-2WLZ6757.js";
47
47
  export {
48
48
  animationFrame,
49
49
  battery,