sibujs 3.3.1 → 3.3.3

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 (78) hide show
  1. package/dist/browser.cjs +41 -18
  2. package/dist/browser.js +5 -5
  3. package/dist/build.cjs +57 -22
  4. package/dist/build.js +14 -14
  5. package/dist/cdn.global.js +7 -7
  6. package/dist/{chunk-MHBCEJQO.js → chunk-23VT3KZB.js} +2 -2
  7. package/dist/{chunk-WL7BIR6O.js → chunk-25LY5SRH.js} +31 -24
  8. package/dist/{chunk-37BUKSLH.js → chunk-5K6RVA2S.js} +1 -1
  9. package/dist/{chunk-AMIKDMLP.js → chunk-5Y34FWED.js} +17 -6
  10. package/dist/chunk-7ZHH77QA.js +9 -0
  11. package/dist/chunk-CCSJMTRN.js +15 -0
  12. package/dist/{chunk-R3QEDXFS.js → chunk-EX77FXTT.js} +1 -1
  13. package/dist/{chunk-WW6DAGGR.js → chunk-F3HO2MP7.js} +1 -1
  14. package/dist/{chunk-ZUVLC7TM.js → chunk-F7HW2NI5.js} +2 -4
  15. package/dist/{chunk-ULLTNDRA.js → chunk-IEYFHN5V.js} +72 -25
  16. package/dist/{chunk-Z37APKBV.js → chunk-IQN5W7GE.js} +73 -16
  17. package/dist/{chunk-WZG2SZOT.js → chunk-IWFE4AHO.js} +1 -1
  18. package/dist/{chunk-IKLYI3RF.js → chunk-MYXEBADX.js} +53 -23
  19. package/dist/{chunk-6LTFHJQG.js → chunk-QCQQ2N5H.js} +41 -20
  20. package/dist/{chunk-VOVVTOEA.js → chunk-QTOOBABV.js} +22 -5
  21. package/dist/{chunk-LU2MQXQQ.js → chunk-RZKGMHH4.js} +6 -6
  22. package/dist/{chunk-GOJMFRBL.js → chunk-S3NFJO6L.js} +20 -14
  23. package/dist/{chunk-NHKQKKZU.js → chunk-SBPUXWCE.js} +1 -1
  24. package/dist/{chunk-SLMFA3ZZ.js → chunk-TBDTU7UO.js} +2 -2
  25. package/dist/{chunk-4UUMSLSL.js → chunk-TVCCXPU2.js} +5 -5
  26. package/dist/{chunk-TEFZT5PJ.js → chunk-UOMYIAG6.js} +1 -1
  27. package/dist/{chunk-XH2RTYEQ.js → chunk-WFUUT6TG.js} +15 -8
  28. package/dist/{chunk-M5KBNOSJ.js → chunk-WTFMV2RU.js} +70 -59
  29. package/dist/{chunk-3JHCYHWN.js → chunk-WWV3SJ3L.js} +19 -13
  30. package/dist/{chunk-RYMOSG5B.js → chunk-Y35NQNLG.js} +90 -60
  31. package/dist/{chunk-F7FXQ3QS.js → chunk-ZXCZWMZT.js} +1 -1
  32. package/dist/data.cjs +36 -16
  33. package/dist/data.js +8 -7
  34. package/dist/devtools.cjs +91 -35
  35. package/dist/devtools.d.cts +12 -5
  36. package/dist/devtools.d.ts +12 -5
  37. package/dist/devtools.js +7 -6
  38. package/dist/ecosystem.cjs +31 -16
  39. package/dist/ecosystem.js +11 -10
  40. package/dist/extras.cjs +485 -280
  41. package/dist/extras.d.cts +1 -1
  42. package/dist/extras.d.ts +1 -1
  43. package/dist/extras.js +28 -24
  44. package/dist/index.cjs +59 -22
  45. package/dist/index.d.cts +24 -8
  46. package/dist/index.d.ts +24 -8
  47. package/dist/index.js +25 -21
  48. package/dist/motion.cjs +223 -204
  49. package/dist/motion.d.cts +8 -1
  50. package/dist/motion.d.ts +8 -1
  51. package/dist/motion.js +6 -3
  52. package/dist/patterns.cjs +33 -20
  53. package/dist/patterns.d.cts +4 -1
  54. package/dist/patterns.d.ts +4 -1
  55. package/dist/patterns.js +6 -6
  56. package/dist/performance.cjs +90 -70
  57. package/dist/performance.js +8 -7
  58. package/dist/plugins.cjs +207 -144
  59. package/dist/plugins.d.cts +2 -1
  60. package/dist/plugins.d.ts +2 -1
  61. package/dist/plugins.js +178 -124
  62. package/dist/{ssr-6D67RAVB.js → ssr-2PPULEK2.js} +2 -2
  63. package/dist/ssr.cjs +132 -105
  64. package/dist/ssr.d.cts +8 -1
  65. package/dist/ssr.d.ts +8 -1
  66. package/dist/ssr.js +11 -10
  67. package/dist/testing.cjs +38 -18
  68. package/dist/testing.js +19 -8
  69. package/dist/ui.cjs +337 -294
  70. package/dist/ui.d.cts +0 -20
  71. package/dist/ui.d.ts +0 -20
  72. package/dist/ui.js +30 -24
  73. package/dist/widgets.cjs +95 -27
  74. package/dist/widgets.d.cts +6 -1
  75. package/dist/widgets.d.ts +6 -1
  76. package/dist/widgets.js +8 -7
  77. package/package.json +1 -1
  78. package/dist/chunk-YT6HQ6AM.js +0 -14
package/dist/browser.cjs CHANGED
@@ -497,7 +497,7 @@ function forEachSubscriber(signal2, visit) {
497
497
 
498
498
  // src/reactivity/track.ts
499
499
  var _isDev3 = isDev();
500
- var _runtimeVersion = typeof __SIBU_VERSION__ !== "undefined" ? __SIBU_VERSION__ : "dev";
500
+ var _runtimeVersion = true ? "3.3.3" : "dev";
501
501
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
502
502
  function resolveReactiveApi() {
503
503
  const g = globalThis;
@@ -693,23 +693,29 @@ function media(query) {
693
693
  }
694
694
 
695
695
  // src/core/ssr-context.ts
696
- var als = null;
697
- try {
698
- if (typeof process !== "undefined" && process.versions && process.versions.node) {
699
- let mod = null;
700
- const getBuiltin = process.getBuiltinModule;
701
- if (typeof getBuiltin === "function") {
702
- mod = getBuiltin("node:async_hooks");
703
- } else {
704
- const req = Function("return typeof require==='function'?require:null")();
705
- if (req) mod = req("node:async_hooks");
696
+ var SSR_KEY = /* @__PURE__ */ Symbol.for("sibujs.ssr.v1");
697
+ function detectSSRShared() {
698
+ let detected = null;
699
+ try {
700
+ if (typeof process !== "undefined" && process.versions && process.versions.node) {
701
+ let mod = null;
702
+ const getBuiltin = process.getBuiltinModule;
703
+ if (typeof getBuiltin === "function") {
704
+ mod = getBuiltin("node:async_hooks");
705
+ } else {
706
+ const req = Function("return typeof require==='function'?require:null")();
707
+ if (req) mod = req("node:async_hooks");
708
+ }
709
+ if (mod) detected = new mod.AsyncLocalStorage();
706
710
  }
707
- if (mod) als = new mod.AsyncLocalStorage();
711
+ } catch {
712
+ detected = null;
708
713
  }
709
- } catch {
710
- als = null;
714
+ return { als: detected, fallbackStore: { ssr: false, suspenseIdCounter: 0 } };
711
715
  }
712
- var fallbackStore = { ssr: false, suspenseIdCounter: 0 };
716
+ var _shared = globalThis[SSR_KEY] ?? (globalThis[SSR_KEY] = detectSSRShared());
717
+ var als = _shared.als;
718
+ var fallbackStore = _shared.fallbackStore;
713
719
  function getSSRStore() {
714
720
  if (als) {
715
721
  const s = als.getStore();
@@ -1007,7 +1013,7 @@ function battery() {
1007
1013
  let disposed = false;
1008
1014
  if (typeof navigator !== "undefined" && "getBattery" in navigator) {
1009
1015
  setSupported(true);
1010
- navigator.getBattery().then((bm) => {
1016
+ const batteryPromise = navigator.getBattery().then((bm) => {
1011
1017
  if (disposed) return;
1012
1018
  battery2 = bm;
1013
1019
  batch(() => {
@@ -1025,6 +1031,9 @@ function battery() {
1025
1031
  bm.addEventListener("chargingtimechange", onChargingTimeChange);
1026
1032
  bm.addEventListener("dischargingtimechange", onDischargingTimeChange);
1027
1033
  });
1034
+ batteryPromise.catch(() => {
1035
+ if (!disposed) setSupported(false);
1036
+ });
1028
1037
  }
1029
1038
  function dispose() {
1030
1039
  disposed = true;
@@ -1582,9 +1591,17 @@ function wakeLock() {
1582
1591
  }
1583
1592
  const api = navigator.wakeLock;
1584
1593
  let sentinel = null;
1594
+ let disposed = false;
1585
1595
  async function request() {
1596
+ if (disposed) return;
1586
1597
  try {
1587
- sentinel = await api.request("screen");
1598
+ const s = await api.request("screen");
1599
+ if (disposed) {
1600
+ s.release().catch(() => {
1601
+ });
1602
+ return;
1603
+ }
1604
+ sentinel = s;
1588
1605
  setActive(true);
1589
1606
  sentinel.addEventListener("release", () => {
1590
1607
  setActive(false);
@@ -1611,6 +1628,7 @@ function wakeLock() {
1611
1628
  };
1612
1629
  document.addEventListener("visibilitychange", onVisibility);
1613
1630
  function dispose() {
1631
+ disposed = true;
1614
1632
  document.removeEventListener("visibilitychange", onVisibility);
1615
1633
  release().catch((err) => {
1616
1634
  if (typeof console !== "undefined") {
@@ -1642,6 +1660,7 @@ function animationFrame(options = {}) {
1642
1660
  let id = null;
1643
1661
  let prev = -1;
1644
1662
  let start = -1;
1663
+ let disposed = false;
1645
1664
  const minFrameMs = options.fpsLimit ? 1e3 / options.fpsLimit : 0;
1646
1665
  const step = (now) => {
1647
1666
  if (start < 0) start = now;
@@ -1655,7 +1674,7 @@ function animationFrame(options = {}) {
1655
1674
  id = requestAnimationFrame(step);
1656
1675
  };
1657
1676
  function resume() {
1658
- if (id !== null) return;
1677
+ if (disposed || id !== null) return;
1659
1678
  setRunning(true);
1660
1679
  id = requestAnimationFrame(step);
1661
1680
  }
@@ -1669,6 +1688,7 @@ function animationFrame(options = {}) {
1669
1688
  start = -1;
1670
1689
  }
1671
1690
  function dispose() {
1691
+ disposed = true;
1672
1692
  pause();
1673
1693
  }
1674
1694
  if (options.immediate !== false) resume();
@@ -1727,7 +1747,9 @@ function bounds(target) {
1727
1747
  }
1728
1748
  };
1729
1749
  }
1750
+ let disposed = false;
1730
1751
  function refresh() {
1752
+ if (disposed) return;
1731
1753
  setRect(readRect(target));
1732
1754
  }
1733
1755
  refresh();
@@ -1739,6 +1761,7 @@ function bounds(target) {
1739
1761
  const onScroll = () => refresh();
1740
1762
  window.addEventListener("scroll", onScroll, { passive: true, capture: true });
1741
1763
  function dispose() {
1764
+ disposed = true;
1742
1765
  resizeObserver?.disconnect();
1743
1766
  window.removeEventListener("scroll", onScroll, { capture: true });
1744
1767
  }
package/dist/browser.js CHANGED
@@ -35,12 +35,12 @@ import {
35
35
  visibility,
36
36
  wakeLock,
37
37
  windowSize
38
- } from "./chunk-VOVVTOEA.js";
38
+ } from "./chunk-QTOOBABV.js";
39
39
  import "./chunk-H3SRKIYX.js";
40
- import "./chunk-MHBCEJQO.js";
41
- import "./chunk-GOJMFRBL.js";
42
- import "./chunk-WZG2SZOT.js";
43
- import "./chunk-TEFZT5PJ.js";
40
+ import "./chunk-23VT3KZB.js";
41
+ import "./chunk-S3NFJO6L.js";
42
+ import "./chunk-IWFE4AHO.js";
43
+ import "./chunk-UOMYIAG6.js";
44
44
  import "./chunk-COY6PUD2.js";
45
45
  export {
46
46
  animationFrame,
package/dist/build.cjs CHANGED
@@ -1136,6 +1136,7 @@ __export(index_exports, {
1136
1136
  footer: () => footer,
1137
1137
  form: () => form,
1138
1138
  g: () => g,
1139
+ getAction: () => getAction,
1139
1140
  getRequestScopedCache: () => getRequestScopedCache,
1140
1141
  getSSRStore: () => getSSRStore,
1141
1142
  getSlot: () => getSlot,
@@ -1204,6 +1205,7 @@ __export(index_exports, {
1204
1205
  reactiveArray: () => reactiveArray,
1205
1206
  rect: () => rect,
1206
1207
  ref: () => ref,
1208
+ registerAction: () => registerAction,
1207
1209
  registerComponent: () => registerComponent,
1208
1210
  registerDisposer: () => registerDisposer,
1209
1211
  resolveComponent: () => resolveComponent,
@@ -1791,7 +1793,7 @@ function forEachSubscriber(signal2, visit) {
1791
1793
 
1792
1794
  // src/reactivity/track.ts
1793
1795
  var _isDev3 = isDev();
1794
- var _runtimeVersion = typeof __SIBU_VERSION__ !== "undefined" ? __SIBU_VERSION__ : "dev";
1796
+ var _runtimeVersion = true ? "3.3.3" : "dev";
1795
1797
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
1796
1798
  function resolveReactiveApi() {
1797
1799
  const g2 = globalThis;
@@ -3365,7 +3367,21 @@ function KeepAlive(activeKey, cases, options) {
3365
3367
  }
3366
3368
 
3367
3369
  // src/core/rendering/action.ts
3368
- function action(element, actionFn, param2) {
3370
+ var ACTIONS_KEY = /* @__PURE__ */ Symbol.for("sibujs.actions.v1");
3371
+ var _actions = globalThis[ACTIONS_KEY] ?? (globalThis[ACTIONS_KEY] = /* @__PURE__ */ new Map());
3372
+ function registerAction(name, fn) {
3373
+ _actions.set(name, fn);
3374
+ }
3375
+ function getAction(name) {
3376
+ return _actions.get(name);
3377
+ }
3378
+ function action(element, action2, param2) {
3379
+ const actionFn = typeof action2 === "string" ? getAction(action2) : action2;
3380
+ if (!actionFn) {
3381
+ throw new Error(
3382
+ `[SibuJS] No action registered under the name "${action2}". Register it with registerAction() before applying it by name.`
3383
+ );
3384
+ }
3369
3385
  const cleanup3 = actionFn(element, param2);
3370
3386
  if (typeof cleanup3 === "function") {
3371
3387
  registerDisposer(element, cleanup3);
@@ -3442,6 +3458,11 @@ var trapFocus = (element) => {
3442
3458
  element.addEventListener("keydown", handler);
3443
3459
  return () => element.removeEventListener("keydown", handler);
3444
3460
  };
3461
+ registerAction("clickOutside", clickOutside);
3462
+ registerAction("longPress", longPress);
3463
+ registerAction("copyOnClick", copyOnClick);
3464
+ registerAction("autoResize", autoResize);
3465
+ registerAction("trapFocus", trapFocus);
3445
3466
 
3446
3467
  // src/core/rendering/catch.ts
3447
3468
  var globalErrorHandler = null;
@@ -3490,13 +3511,14 @@ function setGlobalErrorHandler(handler) {
3490
3511
  }
3491
3512
 
3492
3513
  // src/core/rendering/createId.ts
3493
- var idCounter = 0;
3514
+ var COUNTER_KEY = /* @__PURE__ */ Symbol.for("sibujs.createId.v1");
3515
+ var _counter = globalThis[COUNTER_KEY] ?? (globalThis[COUNTER_KEY] = { n: 0 });
3494
3516
  function createId(prefix = "sibu") {
3495
- idCounter++;
3496
- return `${prefix}-${idCounter}`;
3517
+ _counter.n++;
3518
+ return `${prefix}-${_counter.n}`;
3497
3519
  }
3498
3520
  function __resetIdCounter() {
3499
- idCounter = 0;
3521
+ _counter.n = 0;
3500
3522
  }
3501
3523
 
3502
3524
  // src/reactivity/batch.ts
@@ -3620,23 +3642,29 @@ function signal(initial, options) {
3620
3642
  }
3621
3643
 
3622
3644
  // src/core/ssr-context.ts
3623
- var als = null;
3624
- try {
3625
- if (typeof process !== "undefined" && process.versions && process.versions.node) {
3626
- let mod = null;
3627
- const getBuiltin = process.getBuiltinModule;
3628
- if (typeof getBuiltin === "function") {
3629
- mod = getBuiltin("node:async_hooks");
3630
- } else {
3631
- const req = Function("return typeof require==='function'?require:null")();
3632
- if (req) mod = req("node:async_hooks");
3645
+ var SSR_KEY = /* @__PURE__ */ Symbol.for("sibujs.ssr.v1");
3646
+ function detectSSRShared() {
3647
+ let detected = null;
3648
+ try {
3649
+ if (typeof process !== "undefined" && process.versions && process.versions.node) {
3650
+ let mod = null;
3651
+ const getBuiltin = process.getBuiltinModule;
3652
+ if (typeof getBuiltin === "function") {
3653
+ mod = getBuiltin("node:async_hooks");
3654
+ } else {
3655
+ const req = Function("return typeof require==='function'?require:null")();
3656
+ if (req) mod = req("node:async_hooks");
3657
+ }
3658
+ if (mod) detected = new mod.AsyncLocalStorage();
3633
3659
  }
3634
- if (mod) als = new mod.AsyncLocalStorage();
3660
+ } catch {
3661
+ detected = null;
3635
3662
  }
3636
- } catch {
3637
- als = null;
3663
+ return { als: detected, fallbackStore: { ssr: false, suspenseIdCounter: 0 } };
3638
3664
  }
3639
- var fallbackStore = { ssr: false, suspenseIdCounter: 0 };
3665
+ var _shared = globalThis[SSR_KEY] ?? (globalThis[SSR_KEY] = detectSSRShared());
3666
+ var als = _shared.als;
3667
+ var fallbackStore = _shared.fallbackStore;
3640
3668
  function getSSRStore() {
3641
3669
  if (als) {
3642
3670
  const s2 = als.getStore();
@@ -4860,7 +4888,6 @@ function trustHTML(html3) {
4860
4888
  var DEFAULT_MAX_SSR_BYTES = 1024 * 1024;
4861
4889
 
4862
4890
  // src/components/ErrorDisplay.ts
4863
- var _isDev12 = isDev();
4864
4891
  var STYLES = `
4865
4892
  .sibu-error-display {
4866
4893
  border: 1px solid var(--sibu-err-border, #e5484d);
@@ -5171,7 +5198,7 @@ function ErrorDisplay(props) {
5171
5198
  injectStyles();
5172
5199
  const severity = props.severity ?? "error";
5173
5200
  const normalized = normalizeError(props.error);
5174
- const showDetails = props.alwaysShowDetails ?? _isDev12;
5201
+ const showDetails = props.alwaysShowDetails ?? isDev();
5175
5202
  const headline = props.title ?? normalized.message;
5176
5203
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace("T", " ").slice(0, 19);
5177
5204
  const [copyLabel, setCopyLabel] = signal("Copy");
@@ -5658,6 +5685,11 @@ function Loading(props = {}) {
5658
5685
  if (variant === "dots") {
5659
5686
  return div({
5660
5687
  class: `sibu-loading${sizeClass}`,
5688
+ role: "status",
5689
+ "aria-live": "polite",
5690
+ // When there's no visible text, give the live region an accessible name
5691
+ // so it isn't announced as an empty status.
5692
+ "aria-label": text2 ? void 0 : "Loading",
5661
5693
  nodes: [
5662
5694
  div({
5663
5695
  class: "sibu-loading-dots",
@@ -5673,6 +5705,9 @@ function Loading(props = {}) {
5673
5705
  }
5674
5706
  return div({
5675
5707
  class: `sibu-loading${sizeClass}`,
5708
+ role: "status",
5709
+ "aria-live": "polite",
5710
+ "aria-label": text2 ? void 0 : "Loading",
5676
5711
  nodes: [
5677
5712
  div({ class: "sibu-loading-spinner" }),
5678
5713
  text2 ? span({ class: "sibu-loading-text", nodes: text2 }) : null
package/dist/build.js CHANGED
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  index_exports
3
- } from "./chunk-IKLYI3RF.js";
4
- import "./chunk-YT6HQ6AM.js";
5
- import "./chunk-37BUKSLH.js";
6
- import "./chunk-SLMFA3ZZ.js";
7
- import "./chunk-R3QEDXFS.js";
8
- import "./chunk-F7FXQ3QS.js";
9
- import "./chunk-LU2MQXQQ.js";
10
- import "./chunk-NHKQKKZU.js";
11
- import "./chunk-WW6DAGGR.js";
12
- import "./chunk-5VGSK6D2.js";
3
+ } from "./chunk-MYXEBADX.js";
4
+ import "./chunk-5K6RVA2S.js";
5
+ import "./chunk-TBDTU7UO.js";
6
+ import "./chunk-CCSJMTRN.js";
7
+ import "./chunk-EX77FXTT.js";
8
+ import "./chunk-ZXCZWMZT.js";
9
+ import "./chunk-RZKGMHH4.js";
10
+ import "./chunk-SBPUXWCE.js";
11
+ import "./chunk-F3HO2MP7.js";
13
12
  import "./chunk-L3GAGWCC.js";
14
- import "./chunk-MHBCEJQO.js";
15
- import "./chunk-GOJMFRBL.js";
16
- import "./chunk-WZG2SZOT.js";
17
- import "./chunk-TEFZT5PJ.js";
13
+ import "./chunk-23VT3KZB.js";
14
+ import "./chunk-S3NFJO6L.js";
15
+ import "./chunk-5VGSK6D2.js";
16
+ import "./chunk-IWFE4AHO.js";
17
+ import "./chunk-UOMYIAG6.js";
18
18
  import "./chunk-COY6PUD2.js";
19
19
 
20
20
  // src/build/compileTemplates.ts