sibujs 4.8.0 → 4.9.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 (66) hide show
  1. package/dist/browser.cjs +4 -3
  2. package/dist/browser.d.cts +3 -2
  3. package/dist/browser.d.ts +3 -2
  4. package/dist/browser.js +4 -4
  5. package/dist/build.cjs +27 -19
  6. package/dist/build.js +10 -10
  7. package/dist/cdn.dev.global.js +12 -12
  8. package/dist/cdn.full.dev.global.js +13 -13
  9. package/dist/cdn.full.global.js +12 -12
  10. package/dist/cdn.global.js +12 -12
  11. package/dist/{chunk-GSGNX35Q.js → chunk-2K3Z3XO4.js} +4 -4
  12. package/dist/{chunk-UCNP3HVM.js → chunk-562UVHMM.js} +24 -11
  13. package/dist/{chunk-VWT3VXPL.js → chunk-5MLWTIQE.js} +2 -2
  14. package/dist/{chunk-4WMSTZ7J.js → chunk-7OV5Q2UU.js} +4 -4
  15. package/dist/{chunk-CZPRSWSS.js → chunk-CDBKFGXN.js} +1 -1
  16. package/dist/{chunk-QGMSESDD.js → chunk-CF2KCWRE.js} +2 -2
  17. package/dist/{chunk-C5PEWEGH.js → chunk-DRMLIF6M.js} +2 -2
  18. package/dist/{chunk-C7AA2CZX.js → chunk-FHCZMHHE.js} +1 -1
  19. package/dist/{chunk-J3YQ457H.js → chunk-FNOK662L.js} +35 -27
  20. package/dist/{chunk-TQQUN4WR.js → chunk-G2WHYEL7.js} +1 -1
  21. package/dist/{chunk-44MTL7ED.js → chunk-K6K5ACO6.js} +3 -3
  22. package/dist/{chunk-JUTFX2RM.js → chunk-KG25XMGP.js} +30 -10
  23. package/dist/{chunk-O6TRVMJI.js → chunk-MPWDSTYK.js} +1 -1
  24. package/dist/{chunk-LI4W3U6C.js → chunk-NQMKWBKU.js} +1 -1
  25. package/dist/{chunk-Q5J2LVKH.js → chunk-QBKCK6MJ.js} +1 -1
  26. package/dist/{chunk-V3LHZSU5.js → chunk-SBTZEYNI.js} +1 -1
  27. package/dist/{chunk-DSID757X.js → chunk-SYHGGDNW.js} +1 -1
  28. package/dist/{chunk-RGLPEBDE.js → chunk-TV464N2M.js} +3 -3
  29. package/dist/{chunk-KJ3UKABJ.js → chunk-X7NRHFZR.js} +1 -1
  30. package/dist/{chunk-ZVLHNEEL.js → chunk-XJVTQUIV.js} +6 -6
  31. package/dist/{chunk-EGUQLBHE.js → chunk-YW6HQKGO.js} +5 -4
  32. package/dist/data.cjs +21 -8
  33. package/dist/data.d.cts +23 -4
  34. package/dist/data.d.ts +23 -4
  35. package/dist/data.js +5 -5
  36. package/dist/devtools.cjs +1 -1
  37. package/dist/devtools.js +4 -4
  38. package/dist/ecosystem.cjs +1 -1
  39. package/dist/ecosystem.js +7 -7
  40. package/dist/extras.cjs +54 -20
  41. package/dist/extras.js +20 -20
  42. package/dist/index.cjs +27 -19
  43. package/dist/index.d.cts +6 -0
  44. package/dist/index.d.ts +6 -0
  45. package/dist/index.js +10 -10
  46. package/dist/motion.cjs +1 -1
  47. package/dist/motion.js +3 -3
  48. package/dist/patterns.cjs +1 -1
  49. package/dist/patterns.js +5 -5
  50. package/dist/performance.cjs +1 -1
  51. package/dist/performance.js +4 -4
  52. package/dist/plugins.cjs +16 -12
  53. package/dist/plugins.d.cts +6 -0
  54. package/dist/plugins.d.ts +6 -0
  55. package/dist/plugins.js +20 -16
  56. package/dist/ssr.cjs +28 -8
  57. package/dist/ssr.d.cts +4 -0
  58. package/dist/ssr.d.ts +4 -0
  59. package/dist/ssr.js +7 -7
  60. package/dist/testing.cjs +1 -1
  61. package/dist/testing.js +2 -2
  62. package/dist/ui.cjs +2 -2
  63. package/dist/ui.js +7 -7
  64. package/dist/widgets.cjs +1 -1
  65. package/dist/widgets.js +6 -6
  66. package/package.json +1 -1
package/dist/browser.cjs CHANGED
@@ -674,7 +674,7 @@ function forEachSubscriber(signal2, visit) {
674
674
  }
675
675
 
676
676
  // src/reactivity/track.ts
677
- var _runtimeVersion = true ? "4.8.0" : "dev";
677
+ var _runtimeVersion = true ? "4.9.0" : "dev";
678
678
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
679
679
  function resolveReactiveApi() {
680
680
  const g = globalThis;
@@ -2264,6 +2264,7 @@ function keyboard(options = {}) {
2264
2264
  };
2265
2265
  }
2266
2266
  const target = options.target ?? window;
2267
+ const view = options.target?.ownerDocument?.defaultView ?? window;
2267
2268
  const filter = options.keys ? new Set(options.keys) : null;
2268
2269
  const onDown = (e) => {
2269
2270
  if (filter && !filter.has(e.key)) return;
@@ -2286,14 +2287,14 @@ function keyboard(options = {}) {
2286
2287
  const onBlur = () => setPressed(/* @__PURE__ */ new Set());
2287
2288
  target.addEventListener("keydown", onDown);
2288
2289
  target.addEventListener("keyup", onUp);
2289
- window.addEventListener("blur", onBlur);
2290
+ view.addEventListener("blur", onBlur);
2290
2291
  function isPressed(key) {
2291
2292
  return pressed().has(key);
2292
2293
  }
2293
2294
  function dispose() {
2294
2295
  target.removeEventListener("keydown", onDown);
2295
2296
  target.removeEventListener("keyup", onUp);
2296
- window.removeEventListener("blur", onBlur);
2297
+ view.removeEventListener("blur", onBlur);
2297
2298
  }
2298
2299
  return { pressed, isPressed, dispose };
2299
2300
  }
@@ -642,8 +642,9 @@ interface KeyboardOptions {
642
642
  * `KeyboardEvent.key`). On every key event the signal is replaced with a
643
643
  * new Set instance so reactive subscribers see the change.
644
644
  *
645
- * Also listens to `window.blur` to clear stuck keys if the window loses
646
- * focus mid-press — otherwise held modifiers can "ghost" forever.
645
+ * Also listens to `blur` on the target's window (the global `window`, or the
646
+ * window of the document a `target` element belongs to) to clear stuck keys
647
+ * if it loses focus mid-press — otherwise held modifiers can "ghost" forever.
647
648
  *
648
649
  * @example
649
650
  * ```ts
package/dist/browser.d.ts CHANGED
@@ -642,8 +642,9 @@ interface KeyboardOptions {
642
642
  * `KeyboardEvent.key`). On every key event the signal is replaced with a
643
643
  * new Set instance so reactive subscribers see the change.
644
644
  *
645
- * Also listens to `window.blur` to clear stuck keys if the window loses
646
- * focus mid-press — otherwise held modifiers can "ghost" forever.
645
+ * Also listens to `blur` on the target's window (the global `window`, or the
646
+ * window of the document a `target` element belongs to) to clear stuck keys
647
+ * if it loses focus mid-press — otherwise held modifiers can "ghost" forever.
647
648
  *
648
649
  * @example
649
650
  * ```ts
package/dist/browser.js CHANGED
@@ -36,15 +36,15 @@ import {
36
36
  visibility,
37
37
  wakeLock,
38
38
  windowSize
39
- } from "./chunk-EGUQLBHE.js";
39
+ } from "./chunk-YW6HQKGO.js";
40
40
  import "./chunk-52XFPGSN.js";
41
41
  import "./chunk-62BDYGAG.js";
42
42
  import "./chunk-7ZHH77QA.js";
43
- import "./chunk-V3LHZSU5.js";
43
+ import "./chunk-SBTZEYNI.js";
44
44
  import "./chunk-EXXSN3BW.js";
45
45
  import "./chunk-7XHATCIH.js";
46
- import "./chunk-DSID757X.js";
47
- import "./chunk-TQQUN4WR.js";
46
+ import "./chunk-SYHGGDNW.js";
47
+ import "./chunk-G2WHYEL7.js";
48
48
  import "./chunk-NYNYSPK7.js";
49
49
  export {
50
50
  __resetSpeechCoordinator,
package/dist/build.cjs CHANGED
@@ -3548,7 +3548,7 @@ function forEachSubscriber(signal2, visit) {
3548
3548
  }
3549
3549
 
3550
3550
  // src/reactivity/track.ts
3551
- var _runtimeVersion = true ? "4.8.0" : "dev";
3551
+ var _runtimeVersion = true ? "4.9.0" : "dev";
3552
3552
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
3553
3553
  function resolveReactiveApi() {
3554
3554
  const g2 = globalThis;
@@ -5817,37 +5817,44 @@ function action(element, action2, param2) {
5817
5817
  }
5818
5818
  }
5819
5819
  var clickOutside = (element, callback) => {
5820
+ const doc = element.ownerDocument;
5820
5821
  const handler = (e) => {
5821
- if (!element.contains(e.target)) {
5822
- callback();
5823
- }
5822
+ const target = e.target;
5823
+ if (!(typeof target?.nodeType === "number" && element.contains(target))) callback();
5824
5824
  };
5825
- document.addEventListener("pointerdown", handler, true);
5826
- return () => document.removeEventListener("pointerdown", handler, true);
5825
+ doc.addEventListener("pointerdown", handler, true);
5826
+ return () => doc.removeEventListener("pointerdown", handler, true);
5827
5827
  };
5828
+ var PRESS_END_EVENTS = ["pointerup", "pointerleave", "pointercancel"];
5828
5829
  var longPress = (element, options) => {
5829
5830
  const duration = options.duration ?? 500;
5830
5831
  let timer = null;
5831
- const start = () => {
5832
- timer = setTimeout(() => {
5833
- options.callback();
5834
- timer = null;
5835
- }, duration);
5836
- };
5832
+ let owner;
5837
5833
  const cancel = () => {
5838
5834
  if (timer !== null) {
5839
5835
  clearTimeout(timer);
5840
5836
  timer = null;
5841
5837
  }
5842
5838
  };
5839
+ const start = (e) => {
5840
+ const id = e.pointerId;
5841
+ if (timer !== null && id !== owner) return;
5842
+ cancel();
5843
+ owner = id;
5844
+ timer = setTimeout(() => {
5845
+ timer = null;
5846
+ options.callback();
5847
+ }, duration);
5848
+ };
5849
+ const end = (e) => {
5850
+ if (timer !== null && e.pointerId === owner) cancel();
5851
+ };
5843
5852
  element.addEventListener("pointerdown", start);
5844
- element.addEventListener("pointerup", cancel);
5845
- element.addEventListener("pointerleave", cancel);
5853
+ for (const type of PRESS_END_EVENTS) element.addEventListener(type, end);
5846
5854
  return () => {
5847
5855
  cancel();
5848
5856
  element.removeEventListener("pointerdown", start);
5849
- element.removeEventListener("pointerup", cancel);
5850
- element.removeEventListener("pointerleave", cancel);
5857
+ for (const type of PRESS_END_EVENTS) element.removeEventListener(type, end);
5851
5858
  };
5852
5859
  };
5853
5860
  var copyOnClick = (element, getText) => {
@@ -5881,10 +5888,11 @@ var trapFocus = (element) => {
5881
5888
  if (elements.length === 0) return;
5882
5889
  const first = elements[0];
5883
5890
  const last = elements[elements.length - 1];
5884
- if (e.shiftKey && document.activeElement === first) {
5891
+ const active = element.ownerDocument.activeElement;
5892
+ if (e.shiftKey && active === first) {
5885
5893
  e.preventDefault();
5886
5894
  last.focus();
5887
- } else if (!e.shiftKey && document.activeElement === last) {
5895
+ } else if (!e.shiftKey && active === last) {
5888
5896
  e.preventDefault();
5889
5897
  first.focus();
5890
5898
  }
@@ -6885,7 +6893,7 @@ function KeepAlive(activeKey, cases, options) {
6885
6893
  return;
6886
6894
  }
6887
6895
  node = factory();
6888
- if (node instanceof DocumentFragment) {
6896
+ if (node.nodeType === 11) {
6889
6897
  const wrapper = document.createElement("div");
6890
6898
  wrapper.style.display = "contents";
6891
6899
  wrapper.appendChild(node);
package/dist/build.js CHANGED
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  index_exports
3
- } from "./chunk-J3YQ457H.js";
4
- import "./chunk-Q5J2LVKH.js";
3
+ } from "./chunk-FNOK662L.js";
4
+ import "./chunk-QBKCK6MJ.js";
5
5
  import "./chunk-FC6KCJSA.js";
6
- import "./chunk-CZPRSWSS.js";
7
- import "./chunk-C7AA2CZX.js";
6
+ import "./chunk-CDBKFGXN.js";
7
+ import "./chunk-FHCZMHHE.js";
8
8
  import "./chunk-62BDYGAG.js";
9
- import "./chunk-VWT3VXPL.js";
10
- import "./chunk-O6TRVMJI.js";
9
+ import "./chunk-5MLWTIQE.js";
10
+ import "./chunk-MPWDSTYK.js";
11
11
  import "./chunk-3ACAAQIN.js";
12
- import "./chunk-KJ3UKABJ.js";
12
+ import "./chunk-X7NRHFZR.js";
13
13
  import "./chunk-7ZHH77QA.js";
14
- import "./chunk-V3LHZSU5.js";
14
+ import "./chunk-SBTZEYNI.js";
15
15
  import {
16
16
  isEventHandlerAttr,
17
17
  isHtmlContentAttribute,
@@ -19,8 +19,8 @@ import {
19
19
  } from "./chunk-EXXSN3BW.js";
20
20
  import "./chunk-7XHATCIH.js";
21
21
  import "./chunk-5HZXGZ6T.js";
22
- import "./chunk-DSID757X.js";
23
- import "./chunk-TQQUN4WR.js";
22
+ import "./chunk-SYHGGDNW.js";
23
+ import "./chunk-G2WHYEL7.js";
24
24
  import "./chunk-NYNYSPK7.js";
25
25
 
26
26
  // src/build/sourceEdit.ts