sibujs 4.2.0 → 4.4.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 (69) hide show
  1. package/README.md +23 -4
  2. package/dist/browser.cjs +1 -1
  3. package/dist/browser.js +4 -4
  4. package/dist/build.cjs +30 -8
  5. package/dist/build.js +10 -10
  6. package/dist/cdn.dev.global.js +10 -10
  7. package/dist/cdn.full.dev.global.js +400 -0
  8. package/dist/cdn.full.global.js +398 -0
  9. package/dist/cdn.global.js +10 -10
  10. package/dist/{chunk-P3DHXBR6.js → chunk-36S2YPP4.js} +1 -1
  11. package/dist/{chunk-7ALC7KGE.js → chunk-3BTTCZ5J.js} +1 -1
  12. package/dist/{chunk-QL4UREZO.js → chunk-4Z3SPQ67.js} +3 -3
  13. package/dist/{chunk-XZ2N525U.js → chunk-6GSIXTWX.js} +4 -4
  14. package/dist/{chunk-7VEC3UD2.js → chunk-7GIHSAWB.js} +1 -1
  15. package/dist/{chunk-FOWBJZDL.js → chunk-7NBDXVHS.js} +1 -1
  16. package/dist/{chunk-HZEBO22J.js → chunk-ADM46X22.js} +38 -16
  17. package/dist/{chunk-QCFLDD7C.js → chunk-HFCOH2GN.js} +4 -4
  18. package/dist/{chunk-NEYWS4EX.js → chunk-HQSEH5F6.js} +3 -3
  19. package/dist/{chunk-OUWAIXIK.js → chunk-LQFGQNMV.js} +3 -3
  20. package/dist/{chunk-KE4KWRDY.js → chunk-LYVUX7NT.js} +2 -2
  21. package/dist/{chunk-BNKV4REK.js → chunk-M2F7TZHH.js} +2 -2
  22. package/dist/{chunk-HECVW343.js → chunk-NVNJH22U.js} +1 -1
  23. package/dist/{chunk-6ZGI3RBE.js → chunk-PNIRUQ4C.js} +2 -2
  24. package/dist/{chunk-VJE6DDYM.js → chunk-R25EFXXC.js} +40 -26
  25. package/dist/{chunk-BMYYZWHX.js → chunk-RR7M3FHM.js} +1 -1
  26. package/dist/{chunk-3VTSPNC5.js → chunk-SKPTERHP.js} +1 -1
  27. package/dist/{chunk-GDUNQCCW.js → chunk-UCALUKB5.js} +4 -4
  28. package/dist/{chunk-HJEPKZ2O.js → chunk-VCTAEPSB.js} +1 -1
  29. package/dist/{chunk-2LOYNGBY.js → chunk-W2EQ7X2L.js} +1 -1
  30. package/dist/{chunk-SF3TB4K6.js → chunk-XLO7SLIX.js} +5 -5
  31. package/dist/{contracts-Hg6ITAEF.d.cts → contracts-DBdg9J_a.d.cts} +25 -4
  32. package/dist/{contracts-Hg6ITAEF.d.ts → contracts-DBdg9J_a.d.ts} +25 -4
  33. package/dist/data.cjs +1 -1
  34. package/dist/data.js +6 -6
  35. package/dist/devtools.cjs +1 -1
  36. package/dist/devtools.js +4 -4
  37. package/dist/ecosystem.cjs +1 -1
  38. package/dist/ecosystem.js +7 -7
  39. package/dist/extras.cjs +36 -27
  40. package/dist/extras.d.cts +1 -1
  41. package/dist/extras.d.ts +1 -1
  42. package/dist/extras.js +20 -20
  43. package/dist/index.cjs +30 -8
  44. package/dist/index.d.cts +36 -4
  45. package/dist/index.d.ts +36 -4
  46. package/dist/index.js +10 -10
  47. package/dist/motion.cjs +1 -1
  48. package/dist/motion.js +3 -3
  49. package/dist/patterns.cjs +36 -27
  50. package/dist/patterns.d.cts +1 -1
  51. package/dist/patterns.d.ts +1 -1
  52. package/dist/patterns.js +6 -6
  53. package/dist/performance.cjs +1 -1
  54. package/dist/performance.js +4 -4
  55. package/dist/plugins.cjs +4 -3
  56. package/dist/plugins.d.cts +10 -2
  57. package/dist/plugins.d.ts +10 -2
  58. package/dist/plugins.js +9 -8
  59. package/dist/ssr.cjs +1 -1
  60. package/dist/ssr.js +7 -7
  61. package/dist/testing.cjs +1 -1
  62. package/dist/testing.js +2 -2
  63. package/dist/ui.cjs +36 -27
  64. package/dist/ui.d.cts +1 -1
  65. package/dist/ui.d.ts +1 -1
  66. package/dist/ui.js +7 -7
  67. package/dist/widgets.cjs +1 -1
  68. package/dist/widgets.js +6 -6
  69. package/package.json +7 -1
package/README.md CHANGED
@@ -226,10 +226,29 @@ Either way, the API is on `window.Sibu`:
226
226
  Develop against `cdn.dev.global.js` and swap the one line to ship. The runtime
227
227
  behaviour is identical; only the warnings differ.
228
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.
229
+ ### Patterns on the CDN
230
+
231
+ A `<script>` tag resolves no specifiers, so a no-build page cannot reach
232
+ `sibujs/patterns` — `machine` and its siblings were simply unavailable. They
233
+ ship in a second bundle, which is a superset of the one above:
234
+
235
+ ```html
236
+ <script src="https://unpkg.com/sibujs@latest/dist/cdn.full.global.js"></script>
237
+ <script>
238
+ const { signal, machine } = window.Sibu; // Sibu.patterns is also there
239
+ </script>
240
+ ```
241
+
242
+ Load **one or the other**, never both. It is a separate file rather than a
243
+ merge so the default bundle keeps its byte budget: patterns costs ~13% gzip,
244
+ and most pages never call any of it. `cdn.full.dev.global.js` is the
245
+ development counterpart, and both are reachable as `sibujs/cdn-full` and
246
+ `sibujs/cdn-full-dev`.
247
+
248
+ A bundled app needs neither file — import from `"sibujs"` and let your
249
+ bundler define `__SIBU_DEV__` per build (the Vite and webpack plugins in
250
+ `sibujs/build` do this for you). The two CDN files exist because a `<script>`
251
+ tag has no bundler to make that choice.
233
252
 
234
253
  ---
235
254
 
package/dist/browser.cjs CHANGED
@@ -619,7 +619,7 @@ function forEachSubscriber(signal2, visit) {
619
619
  }
620
620
 
621
621
  // src/reactivity/track.ts
622
- var _runtimeVersion = true ? "4.2.0" : "dev";
622
+ var _runtimeVersion = true ? "4.4.0" : "dev";
623
623
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
624
624
  function resolveReactiveApi() {
625
625
  const g = globalThis;
package/dist/browser.js CHANGED
@@ -35,14 +35,14 @@ import {
35
35
  visibility,
36
36
  wakeLock,
37
37
  windowSize
38
- } from "./chunk-KE4KWRDY.js";
38
+ } from "./chunk-LYVUX7NT.js";
39
39
  import "./chunk-H3SRKIYX.js";
40
40
  import "./chunk-52XFPGSN.js";
41
41
  import "./chunk-7ZHH77QA.js";
42
- import "./chunk-7VEC3UD2.js";
42
+ import "./chunk-7GIHSAWB.js";
43
43
  import "./chunk-5DXA2J44.js";
44
- import "./chunk-HECVW343.js";
45
- import "./chunk-7ALC7KGE.js";
44
+ import "./chunk-NVNJH22U.js";
45
+ import "./chunk-3BTTCZ5J.js";
46
46
  import "./chunk-2WLZ6757.js";
47
47
  export {
48
48
  animationFrame,
package/dist/build.cjs CHANGED
@@ -2246,7 +2246,7 @@ function forEachSubscriber(signal2, visit) {
2246
2246
  }
2247
2247
 
2248
2248
  // src/reactivity/track.ts
2249
- var _runtimeVersion = true ? "4.2.0" : "dev";
2249
+ var _runtimeVersion = true ? "4.4.0" : "dev";
2250
2250
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
2251
2251
  function resolveReactiveApi() {
2252
2252
  const g2 = globalThis;
@@ -6292,7 +6292,16 @@ function enhance(target, setup) {
6292
6292
  const teardowns = [];
6293
6293
  const owner = /* @__PURE__ */ Symbol("sibujs.enhance");
6294
6294
  let disposed = false;
6295
- const bind = (target_, fn) => {
6295
+ let closed = false;
6296
+ const isClosed = (method) => {
6297
+ if (!closed) return false;
6298
+ devWarnLazy(
6299
+ () => `enhance: ctx.${method}() was called after this enhancement was rolled back or disposed, so it was ignored. The setup is still running past the point where its transaction ended \u2014 usually an async setup continuing after an await, or a callback it queued before it threw. Registrations made now would belong to nothing: the root carries no enhancement marker and the disposer has already run, so nothing could ever release them.`
6300
+ );
6301
+ return true;
6302
+ };
6303
+ const bind = (method, target_, fn) => {
6304
+ if (isClosed(method)) return;
6296
6305
  const el = resolveTarget(root, target_);
6297
6306
  if (!el) {
6298
6307
  if (typeof console !== "undefined") {
@@ -6314,14 +6323,14 @@ function enhance(target, setup) {
6314
6323
  }
6315
6324
  },
6316
6325
  on: (t, event, handler, options) => {
6317
- bind(t, (el) => {
6326
+ bind("on", t, (el) => {
6318
6327
  const wrapped = (e) => handler(e, el);
6319
6328
  el.addEventListener(event, wrapped, options);
6320
6329
  teardowns.push(() => el.removeEventListener(event, wrapped, options));
6321
6330
  });
6322
6331
  },
6323
6332
  text: (t, value) => {
6324
- bind(t, (el) => {
6333
+ bind("text", t, (el) => {
6325
6334
  teardowns.push(
6326
6335
  bindNode(el, () => {
6327
6336
  const v = value();
@@ -6332,7 +6341,7 @@ function enhance(target, setup) {
6332
6341
  });
6333
6342
  },
6334
6343
  attr: (t, name, value) => {
6335
- bind(t, (el) => {
6344
+ bind("attr", t, (el) => {
6336
6345
  teardowns.push(
6337
6346
  bindNode(el, () => {
6338
6347
  const v = value();
@@ -6343,7 +6352,7 @@ function enhance(target, setup) {
6343
6352
  });
6344
6353
  },
6345
6354
  classed: (t, name, on2) => {
6346
- bind(t, (el) => {
6355
+ bind("classed", t, (el) => {
6347
6356
  teardowns.push(
6348
6357
  bindNode(el, () => {
6349
6358
  el.classList.toggle(name, Boolean(on2()));
@@ -6352,7 +6361,7 @@ function enhance(target, setup) {
6352
6361
  });
6353
6362
  },
6354
6363
  show: (t, when2) => {
6355
- bind(t, (el) => {
6364
+ bind("show", t, (el) => {
6356
6365
  const prevHidden = el.hidden;
6357
6366
  teardowns.push(
6358
6367
  bindNode(el, () => {
@@ -6365,7 +6374,7 @@ function enhance(target, setup) {
6365
6374
  });
6366
6375
  },
6367
6376
  model: (t, state2, options) => {
6368
- bind(t, (el) => {
6377
+ bind("model", t, (el) => {
6369
6378
  const control = el;
6370
6379
  const [get, set] = state2;
6371
6380
  const evt = options?.event ?? (control instanceof HTMLSelectElement || control instanceof HTMLInputElement && (control.type === "checkbox" || control.type === "radio") ? "change" : "input");
@@ -6380,6 +6389,7 @@ function enhance(target, setup) {
6380
6389
  });
6381
6390
  },
6382
6391
  each: (target_, describe2) => {
6392
+ if (isClosed("each")) return;
6383
6393
  devAssert(typeof describe2 === "function", "ctx.each: second argument must be a function.");
6384
6394
  const elements = typeof target_ === "string" ? ctx.refs(target_) : Array.from(target_);
6385
6395
  for (let i2 = 0; i2 < elements.length; i2++) {
@@ -6390,14 +6400,25 @@ function enhance(target, setup) {
6390
6400
  }
6391
6401
  },
6392
6402
  cleanup: (fn) => {
6403
+ if (isClosed("cleanup")) return;
6393
6404
  teardowns.push(fn);
6394
6405
  }
6395
6406
  };
6396
6407
  let extra;
6397
6408
  try {
6398
6409
  extra = setup(ctx);
6410
+ const returned = extra;
6411
+ if (returned && typeof returned.then === "function") {
6412
+ returned.then(void 0, (reason) => {
6413
+ devWarnLazy(() => `enhance: the promise returned by the setup also rejected: ${String(reason)}`);
6414
+ });
6415
+ throw new Error(
6416
+ (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) ? "[SibuJS enhance] the setup returned a promise, so its work did not complete inside the enhancement transaction. If it is a lazy import, register it as lazyIsland(() => import(\u2026)): an unwrapped loader is called as a setup, so its module is fetched but the setup it resolves to is discarded. If it is an async setup, make it synchronous \u2014 this enhancement has been rolled back, and ctx registrations made after this point are ignored." : "[SibuJS enhance] setup returned a promise"
6417
+ );
6418
+ }
6399
6419
  } catch (err) {
6400
6420
  drainTeardowns(teardowns, "enhance");
6421
+ closed = true;
6401
6422
  throw err;
6402
6423
  }
6403
6424
  if (typeof extra === "function") teardowns.push(extra);
@@ -6410,6 +6431,7 @@ function enhance(target, setup) {
6410
6431
  }
6411
6432
  unregisterDisposer(root, dispose2);
6412
6433
  drainTeardowns(teardowns, "enhance");
6434
+ closed = true;
6413
6435
  };
6414
6436
  registerDisposer(root, dispose2);
6415
6437
  enhancementOwner.set(root, owner);
package/dist/build.js CHANGED
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  index_exports
3
- } from "./chunk-HZEBO22J.js";
4
- import "./chunk-P3DHXBR6.js";
3
+ } from "./chunk-ADM46X22.js";
4
+ import "./chunk-36S2YPP4.js";
5
5
  import "./chunk-NIOYEGBQ.js";
6
- import "./chunk-BMYYZWHX.js";
6
+ import "./chunk-RR7M3FHM.js";
7
7
  import "./chunk-CCSJMTRN.js";
8
- import "./chunk-FOWBJZDL.js";
9
- import "./chunk-6ZGI3RBE.js";
10
- import "./chunk-HJEPKZ2O.js";
11
- import "./chunk-2LOYNGBY.js";
8
+ import "./chunk-7NBDXVHS.js";
9
+ import "./chunk-PNIRUQ4C.js";
10
+ import "./chunk-VCTAEPSB.js";
11
+ import "./chunk-W2EQ7X2L.js";
12
12
  import "./chunk-IXKSNWV5.js";
13
13
  import "./chunk-7ZHH77QA.js";
14
- import "./chunk-7VEC3UD2.js";
14
+ import "./chunk-7GIHSAWB.js";
15
15
  import "./chunk-5DXA2J44.js";
16
16
  import "./chunk-QKRPLZ2V.js";
17
- import "./chunk-HECVW343.js";
18
- import "./chunk-7ALC7KGE.js";
17
+ import "./chunk-NVNJH22U.js";
18
+ import "./chunk-3BTTCZ5J.js";
19
19
  import "./chunk-2WLZ6757.js";
20
20
 
21
21
  // src/build/compileTemplates.ts