elements-kit 0.0.15 → 0.0.17

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 (112) hide show
  1. package/README.md +138 -31
  2. package/dist/attributes-Dtn68R1u.d.mts +94 -0
  3. package/dist/attributes.d.mts +1 -93
  4. package/dist/custom-elements.d.mts +74 -0
  5. package/dist/custom-elements.mjs +100 -0
  6. package/dist/define-CjbTZ3VG.d.mts +23 -0
  7. package/dist/{element-ChF24-2z.mjs → element-CGVy_8TW.mjs} +11 -12
  8. package/dist/for.d.mts +45 -0
  9. package/dist/for.mjs +136 -0
  10. package/dist/{index-DUshSQ_6.d.mts → index-DydGTqZU.d.mts} +60 -10
  11. package/dist/index.d.mts +1 -36
  12. package/dist/index.mjs +1 -144
  13. package/dist/infer-BfzRJoCn.d.mts +203 -0
  14. package/dist/integrations/react.d.mts +1 -1
  15. package/dist/integrations/react.mjs +1 -1
  16. package/dist/jsx-runtime/index.d.mts +11 -20
  17. package/dist/jsx-runtime/index.mjs +2 -2
  18. package/dist/signals/index.d.mts +2 -2
  19. package/dist/signals/index.mjs +2 -2
  20. package/dist/{signals-BHmWX6ox.mjs → signals-J8dK_rA4.mjs} +57 -17
  21. package/dist/slot-C7GQZe-r.d.mts +104 -0
  22. package/dist/{slot-Cydy7-0L.mjs → slot-Kb61AcgW.mjs} +21 -2
  23. package/dist/slot.d.mts +2 -84
  24. package/dist/slot.mjs +2 -2
  25. package/dist/{test.BmQO5GaM-ANkhHvbr.mjs → test.BmQO5GaM-DfGStnii.mjs} +1 -1
  26. package/dist/utilities/_observe.d.mts +11 -0
  27. package/dist/utilities/_observe.mjs +15 -0
  28. package/dist/utilities/active-element.d.mts +1 -1
  29. package/dist/utilities/active-element.mjs +6 -2
  30. package/dist/utilities/active-element.test.mjs +1 -1
  31. package/dist/utilities/async.d.mts +1 -1
  32. package/dist/utilities/async.mjs +1 -1
  33. package/dist/utilities/async.test.mjs +2 -2
  34. package/dist/utilities/debounced.d.mts +1 -1
  35. package/dist/utilities/debounced.mjs +1 -1
  36. package/dist/utilities/debounced.test.mjs +2 -2
  37. package/dist/utilities/element-rect.d.mts +1 -1
  38. package/dist/utilities/element-rect.mjs +1 -1
  39. package/dist/utilities/element-rect.test.mjs +2 -2
  40. package/dist/utilities/element-scroll.d.mts +1 -1
  41. package/dist/utilities/element-scroll.mjs +7 -34
  42. package/dist/utilities/element-scroll.test.mjs +2 -2
  43. package/dist/utilities/environment.d.mts +5 -0
  44. package/dist/utilities/environment.mjs +5 -0
  45. package/dist/utilities/event-driven.d.mts +1 -1
  46. package/dist/utilities/event-driven.mjs +2 -2
  47. package/dist/utilities/event-listener.d.mts +1 -1
  48. package/dist/utilities/event-listener.mjs +1 -1
  49. package/dist/utilities/event-listener.test.mjs +2 -2
  50. package/dist/utilities/focus-within.d.mts +1 -1
  51. package/dist/utilities/focus-within.mjs +1 -1
  52. package/dist/utilities/focus-within.test.mjs +2 -2
  53. package/dist/utilities/hover.d.mts +1 -1
  54. package/dist/utilities/hover.mjs +1 -1
  55. package/dist/utilities/hover.test.mjs +2 -2
  56. package/dist/utilities/intersection-observer.mjs +4 -6
  57. package/dist/utilities/intersection-observer.test.mjs +2 -2
  58. package/dist/utilities/interval.d.mts +1 -1
  59. package/dist/utilities/interval.mjs +1 -1
  60. package/dist/utilities/interval.test.mjs +2 -2
  61. package/dist/utilities/location.d.mts +2 -14
  62. package/dist/utilities/location.mjs +12 -3
  63. package/dist/utilities/location.test.mjs +5 -5
  64. package/dist/utilities/long-press.mjs +1 -1
  65. package/dist/utilities/long-press.test.mjs +2 -2
  66. package/dist/utilities/media-devices.d.mts +1 -1
  67. package/dist/utilities/media-devices.mjs +1 -1
  68. package/dist/utilities/media-devices.test.mjs +2 -2
  69. package/dist/utilities/media-player.d.mts +1 -1
  70. package/dist/utilities/media-player.test.mjs +2 -2
  71. package/dist/utilities/media-query.d.mts +2 -3
  72. package/dist/utilities/media-query.mjs +3 -3
  73. package/dist/utilities/mutation-observer.mjs +4 -7
  74. package/dist/utilities/mutation-observer.test.mjs +2 -2
  75. package/dist/utilities/network.d.mts +2 -2
  76. package/dist/utilities/network.mjs +5 -3
  77. package/dist/utilities/network.test.mjs +1 -1
  78. package/dist/utilities/on-click-outside.test.mjs +2 -2
  79. package/dist/utilities/orientation.d.mts +1 -1
  80. package/dist/utilities/orientation.mjs +9 -1
  81. package/dist/utilities/previous.d.mts +1 -1
  82. package/dist/utilities/previous.mjs +1 -1
  83. package/dist/utilities/previous.test.mjs +2 -2
  84. package/dist/utilities/promise.d.mts +1 -1
  85. package/dist/utilities/promise.mjs +1 -1
  86. package/dist/utilities/promise.test.mjs +2 -2
  87. package/dist/utilities/resize-observer.mjs +4 -6
  88. package/dist/utilities/retry.mjs +1 -1
  89. package/dist/utilities/retry.test.mjs +2 -2
  90. package/dist/utilities/routing.d.mts +1 -1
  91. package/dist/utilities/routing.mjs +1 -1
  92. package/dist/utilities/routing.test.mjs +1 -1
  93. package/dist/utilities/search-params.d.mts +1 -1
  94. package/dist/utilities/search-params.test.mjs +2 -2
  95. package/dist/utilities/ssr.test.d.mts +1 -0
  96. package/dist/utilities/ssr.test.mjs +64 -0
  97. package/dist/utilities/storage.d.mts +1 -1
  98. package/dist/utilities/storage.test.mjs +2 -2
  99. package/dist/utilities/throttled.d.mts +1 -1
  100. package/dist/utilities/throttled.mjs +1 -1
  101. package/dist/utilities/throttled.test.mjs +2 -2
  102. package/dist/utilities/timeout.d.mts +1 -1
  103. package/dist/utilities/timeout.mjs +1 -1
  104. package/dist/utilities/timeout.test.mjs +2 -2
  105. package/dist/utilities/window-focus.d.mts +2 -2
  106. package/dist/utilities/window-focus.mjs +5 -3
  107. package/dist/utilities/window-size.d.mts +1 -1
  108. package/dist/utilities/window-size.mjs +10 -5
  109. package/dist/utilities/window-size.test.mjs +1 -1
  110. package/package.json +20 -10
  111. package/dist/lib-JA05lzCN.d.mts +0 -4
  112. /package/dist/{polyfill-DR5XVnh_.d.mts → polyfill-BVNd6ogU.d.mts} +0 -0
@@ -1,5 +1,4 @@
1
- import { _ as signal, g as onCleanup, u as effect } from "../signals-BHmWX6ox.mjs";
2
- import { on } from "./event-listener.mjs";
1
+ import { fromEvent, sync } from "./event-driven.mjs";
3
2
  //#region src/utilities/element-scroll.ts
4
3
  /**
5
4
  * Returns writable signals for an element's scroll position.
@@ -9,43 +8,17 @@ import { on } from "./event-listener.mjs";
9
8
  */
10
9
  function createElementScroll(target) {
11
10
  const el = target;
12
- const x = signal(el?.scrollLeft ?? 0);
13
- const y = signal(el?.scrollTop ?? 0);
14
- let skipEvent = false;
15
- const handler = () => {
16
- if (skipEvent) {
17
- skipEvent = false;
18
- return;
19
- }
20
- if (!el) return;
21
- x(el.scrollLeft);
22
- y(el.scrollTop);
23
- };
24
- const cleanup = el ? on(el, "scroll", handler, { passive: true }) : () => {};
25
- const stopX = effect(() => {
26
- const val = x();
27
- if (el && el.scrollLeft !== val) {
28
- skipEvent = true;
29
- el.scrollLeft = val;
30
- }
11
+ const scroll = fromEvent(el, "scroll");
12
+ const [x] = sync(scroll, () => el.scrollLeft, (v) => {
13
+ el.scrollLeft = v;
31
14
  });
32
- const stopY = effect(() => {
33
- const val = y();
34
- if (el && el.scrollTop !== val) {
35
- skipEvent = true;
36
- el.scrollTop = val;
37
- }
15
+ const [y] = sync(scroll, () => el.scrollTop, (v) => {
16
+ el.scrollTop = v;
38
17
  });
39
- const dispose = () => {
40
- cleanup();
41
- stopX();
42
- stopY();
43
- };
44
- onCleanup(dispose);
45
18
  return {
46
19
  x,
47
20
  y,
48
- [Symbol.dispose]: dispose
21
+ [Symbol.dispose]: () => {}
49
22
  };
50
23
  }
51
24
  //#endregion
@@ -1,5 +1,5 @@
1
- import { d as effectScope } from "../signals-BHmWX6ox.mjs";
2
- import { o as describe, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
1
+ import { f as effectScope } from "../signals-J8dK_rA4.mjs";
2
+ import { o as describe, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
3
3
  import { createElementScroll } from "./element-scroll.mjs";
4
4
  //#region src/utilities/element-scroll.test.ts
5
5
  describe("createElementScroll", () => {
@@ -0,0 +1,5 @@
1
+ //#region src/utilities/environment.d.ts
2
+ declare const isBrowser: boolean;
3
+ declare const noopDisposable: Disposable;
4
+ //#endregion
5
+ export { isBrowser, noopDisposable };
@@ -0,0 +1,5 @@
1
+ //#region src/utilities/environment.ts
2
+ const isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
3
+ const noopDisposable = { [Symbol.dispose]() {} };
4
+ //#endregion
5
+ export { isBrowser, noopDisposable };
@@ -1,4 +1,4 @@
1
- import { r as Signal, t as Computed } from "../index-DUshSQ_6.mjs";
1
+ import { r as Signal, t as Computed } from "../index-DydGTqZU.mjs";
2
2
 
3
3
  //#region src/utilities/event-driven.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { _ as signal, g as onCleanup, l as computed, s as $signal, v as trigger } from "../signals-BHmWX6ox.mjs";
1
+ import { _ as onCleanup, c as SIGNAL, u as computed, v as signal, y as trigger } from "../signals-J8dK_rA4.mjs";
2
2
  //#region src/utilities/event-driven.ts
3
3
  /**
4
4
  * Returns a `Subscribe` for one or more DOM events on a target.
@@ -31,7 +31,7 @@ function sync(subscribe, getter, setter) {
31
31
  setter(v);
32
32
  return v;
33
33
  }
34
- Object.defineProperty(proxy, $signal, { value: true });
34
+ Object.defineProperty(proxy, SIGNAL, { value: true });
35
35
  return proxy;
36
36
  };
37
37
  return [factory(), cleanup];
@@ -1,4 +1,4 @@
1
- import { t as Computed } from "../index-DUshSQ_6.mjs";
1
+ import { t as Computed } from "../index-DydGTqZU.mjs";
2
2
 
3
3
  //#region src/utilities/event-listener.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { g as onCleanup, u as effect } from "../signals-BHmWX6ox.mjs";
1
+ import { _ as onCleanup, d as effect } from "../signals-J8dK_rA4.mjs";
2
2
  //#region src/utilities/event-listener.ts
3
3
  function on(target, type, handler, options) {
4
4
  const add = (t) => options !== void 0 ? t.addEventListener(type, handler, options) : t.addEventListener(type, handler);
@@ -1,6 +1,6 @@
1
- import { _ as signal, d as effectScope, u as effect } from "../signals-BHmWX6ox.mjs";
2
- import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
1
+ import { d as effect, f as effectScope, v as signal } from "../signals-J8dK_rA4.mjs";
3
2
  import { on } from "./event-listener.mjs";
3
+ import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
4
4
  //#region src/utilities/event-listener.test.ts
5
5
  afterEach(() => {
6
6
  document.body.innerHTML = "";
@@ -1,4 +1,4 @@
1
- import { t as Computed } from "../index-DUshSQ_6.mjs";
1
+ import { t as Computed } from "../index-DydGTqZU.mjs";
2
2
 
3
3
  //#region src/utilities/focus-within.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { _ as signal } from "../signals-BHmWX6ox.mjs";
1
+ import { v as signal } from "../signals-J8dK_rA4.mjs";
2
2
  import { on } from "./event-listener.mjs";
3
3
  //#region src/utilities/focus-within.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
- import { d as effectScope } from "../signals-BHmWX6ox.mjs";
2
- import { o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
1
+ import { f as effectScope } from "../signals-J8dK_rA4.mjs";
2
+ import { o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
3
3
  import { createFocusWithin } from "./focus-within.mjs";
4
4
  //#region src/utilities/focus-within.test.ts
5
5
  afterEach(() => {
@@ -1,4 +1,4 @@
1
- import { t as Computed } from "../index-DUshSQ_6.mjs";
1
+ import { t as Computed } from "../index-DydGTqZU.mjs";
2
2
 
3
3
  //#region src/utilities/hover.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { _ as signal } from "../signals-BHmWX6ox.mjs";
1
+ import { v as signal } from "../signals-J8dK_rA4.mjs";
2
2
  import { on } from "./event-listener.mjs";
3
3
  //#region src/utilities/hover.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
- import { d as effectScope } from "../signals-BHmWX6ox.mjs";
2
- import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
1
+ import { f as effectScope } from "../signals-J8dK_rA4.mjs";
2
+ import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
3
3
  import { createHover } from "./hover.mjs";
4
4
  //#region src/utilities/hover.test.ts
5
5
  afterEach(() => {
@@ -1,15 +1,13 @@
1
- import { g as onCleanup } from "../signals-BHmWX6ox.mjs";
1
+ import { observe } from "./_observe.mjs";
2
2
  //#region src/utilities/intersection-observer.ts
3
3
  /**
4
4
  * Raw `IntersectionObserver` wrapper with automatic cleanup.
5
5
  * Use `createIsInViewport` for the common boolean case.
6
6
  */
7
7
  function createIntersectionObserver(target, callback, options) {
8
- const observer = new IntersectionObserver(callback, options);
9
- if (target) observer.observe(target);
10
- const cleanup = () => observer.disconnect();
11
- onCleanup(cleanup);
12
- return { [Symbol.dispose]: cleanup };
8
+ return observe(new IntersectionObserver(callback, options), (o) => {
9
+ if (target) o.observe(target);
10
+ });
13
11
  }
14
12
  //#endregion
15
13
  export { createIntersectionObserver };
@@ -1,5 +1,5 @@
1
- import { d as effectScope } from "../signals-BHmWX6ox.mjs";
2
- import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
1
+ import { f as effectScope } from "../signals-J8dK_rA4.mjs";
2
+ import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
3
3
  import { createIntersectionObserver } from "./intersection-observer.mjs";
4
4
  //#region src/utilities/intersection-observer.test.ts
5
5
  afterEach(() => {
@@ -1,4 +1,4 @@
1
- import { t as Computed } from "../index-DUshSQ_6.mjs";
1
+ import { t as Computed } from "../index-DydGTqZU.mjs";
2
2
 
3
3
  //#region src/utilities/interval.d.ts
4
4
  type IntervalResult = {
@@ -1,4 +1,4 @@
1
- import { _ as signal, g as onCleanup } from "../signals-BHmWX6ox.mjs";
1
+ import { _ as onCleanup, v as signal } from "../signals-J8dK_rA4.mjs";
2
2
  //#region src/utilities/interval.ts
3
3
  function createInterval(arg1, arg2) {
4
4
  const [callback, delay] = resolveArgs(arg1, arg2);
@@ -1,5 +1,5 @@
1
- import { d as effectScope } from "../signals-BHmWX6ox.mjs";
2
- import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
1
+ import { f as effectScope } from "../signals-J8dK_rA4.mjs";
2
+ import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
3
3
  import { async } from "./async.mjs";
4
4
  import { createInterval } from "./interval.mjs";
5
5
  //#region src/utilities/interval.test.ts
@@ -1,4 +1,4 @@
1
- import { t as Computed } from "../index-DUshSQ_6.mjs";
1
+ import { t as Computed } from "../index-DydGTqZU.mjs";
2
2
 
3
3
  //#region src/utilities/location.d.ts
4
4
  type LocationResult = {
@@ -7,18 +7,6 @@ type LocationResult = {
7
7
  pathname: Computed<string>;
8
8
  search: Computed<string>;
9
9
  };
10
- /**
11
- * Returns reactive signals for the four commonly used `location` properties:
12
- * `hash`, `href`, `pathname`, and `search`.
13
- *
14
- * All four share a single event listener set, so creating one `LocationResult`
15
- * is cheaper than creating four separate signals.
16
- *
17
- * **Custom events note:** `pushstate` and `replacestate` are not native DOM
18
- * events — they must be dispatched by your router or by patching `history`.
19
- * Back/forward navigation via `popstate` always works without any setup.
20
- */
21
- declare function createLocation(): LocationResult;
22
10
  declare const currentLocation: LocationResult;
23
11
  //#endregion
24
- export { createLocation, currentLocation };
12
+ export { currentLocation };
@@ -1,5 +1,6 @@
1
- import { _ as signal, g as onCleanup, l as computed, v as trigger } from "../signals-BHmWX6ox.mjs";
1
+ import { _ as onCleanup, u as computed, v as signal, y as trigger } from "../signals-J8dK_rA4.mjs";
2
2
  import { fromEvent } from "./event-driven.mjs";
3
+ import { isBrowser } from "./environment.mjs";
3
4
  //#region src/utilities/location.ts
4
5
  const EVENTS = [
5
6
  "popstate",
@@ -7,7 +8,7 @@ const EVENTS = [
7
8
  "replacestate",
8
9
  "hashchange"
9
10
  ];
10
- const read = (prop) => typeof location !== "undefined" ? String(location[prop]) : "";
11
+ const read = (prop) => isBrowser ? String(location[prop]) : "";
11
12
  /**
12
13
  * Returns reactive signals for the four commonly used `location` properties:
13
14
  * `hash`, `href`, `pathname`, and `search`.
@@ -18,8 +19,16 @@ const read = (prop) => typeof location !== "undefined" ? String(location[prop])
18
19
  * **Custom events note:** `pushstate` and `replacestate` are not native DOM
19
20
  * events — they must be dispatched by your router or by patching `history`.
20
21
  * Back/forward navigation via `popstate` always works without any setup.
22
+ *
23
+ * Outside a browser, every signal reads the empty string.
21
24
  */
22
25
  function createLocation() {
26
+ if (!isBrowser) return {
27
+ hash: computed(() => ""),
28
+ href: computed(() => ""),
29
+ pathname: computed(() => ""),
30
+ search: computed(() => "")
31
+ };
23
32
  const tick = signal(void 0);
24
33
  onCleanup(fromEvent(window, EVENTS)(() => trigger(tick)));
25
34
  const hash = computed(() => {
@@ -51,4 +60,4 @@ function createLocation() {
51
60
  }
52
61
  const currentLocation = createLocation();
53
62
  //#endregion
54
- export { createLocation, currentLocation };
63
+ export { currentLocation };
@@ -1,5 +1,5 @@
1
- import { o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
2
- import { createLocation, currentLocation } from "./location.mjs";
1
+ import { o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
2
+ import { currentLocation } from "./location.mjs";
3
3
  //#region src/utilities/location.test.ts
4
4
  afterEach(() => {
5
5
  location.hash = "";
@@ -39,16 +39,16 @@ describe("currentLocation (singleton)", () => {
39
39
  globalExpect(currentLocation.href()).toMatch(/#baz$/);
40
40
  });
41
41
  });
42
- describe("createLocation (factory)", () => {
42
+ describe("currentLocation (singleton)", () => {
43
43
  it("returns independent location signals", () => {
44
- const loc = createLocation();
44
+ const loc = currentLocation;
45
45
  globalExpect(typeof loc.hash()).toBe("string");
46
46
  globalExpect(typeof loc.href()).toBe("string");
47
47
  globalExpect(typeof loc.pathname()).toBe("string");
48
48
  globalExpect(typeof loc.search()).toBe("string");
49
49
  });
50
50
  it("all four properties update from a single event", () => {
51
- const loc = createLocation();
51
+ const loc = currentLocation;
52
52
  history.replaceState(null, "", "/factory-test?q=1#section");
53
53
  window.dispatchEvent(new PopStateEvent("popstate"));
54
54
  globalExpect(loc.pathname()).toBe("/factory-test");
@@ -1,5 +1,5 @@
1
- import { createTimeout } from "./timeout.mjs";
2
1
  import { on } from "./event-listener.mjs";
2
+ import { createTimeout } from "./timeout.mjs";
3
3
  //#region src/utilities/long-press.ts
4
4
  /**
5
5
  * Fires `handler` when a pointer is held over `target` for at least `delay`
@@ -1,5 +1,5 @@
1
- import { d as effectScope } from "../signals-BHmWX6ox.mjs";
2
- import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
1
+ import { f as effectScope } from "../signals-J8dK_rA4.mjs";
2
+ import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
3
3
  import { createLongPress } from "./long-press.mjs";
4
4
  //#region src/utilities/long-press.test.ts
5
5
  afterEach(() => {
@@ -1,4 +1,4 @@
1
- import { t as Computed } from "../index-DUshSQ_6.mjs";
1
+ import { t as Computed } from "../index-DydGTqZU.mjs";
2
2
 
3
3
  //#region src/utilities/media-devices.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { _ as signal } from "../signals-BHmWX6ox.mjs";
1
+ import { v as signal } from "../signals-J8dK_rA4.mjs";
2
2
  import { on } from "./event-listener.mjs";
3
3
  //#region src/utilities/media-devices.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
- import { d as effectScope } from "../signals-BHmWX6ox.mjs";
2
- import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
1
+ import { f as effectScope } from "../signals-J8dK_rA4.mjs";
2
+ import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
3
3
  import { createMediaDevices } from "./media-devices.mjs";
4
4
  //#region src/utilities/media-devices.test.ts
5
5
  afterEach(() => {
@@ -1,4 +1,4 @@
1
- import { r as Signal, t as Computed } from "../index-DUshSQ_6.mjs";
1
+ import { r as Signal, t as Computed } from "../index-DydGTqZU.mjs";
2
2
 
3
3
  //#region src/utilities/media-player.d.ts
4
4
  type MediaPlayerResult<T extends HTMLMediaElement> = {
@@ -1,5 +1,5 @@
1
- import { d as effectScope } from "../signals-BHmWX6ox.mjs";
2
- import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
1
+ import { f as effectScope } from "../signals-J8dK_rA4.mjs";
2
+ import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
3
3
  import { createMediaPlayer } from "./media-player.mjs";
4
4
  //#region src/utilities/media-player.test.ts
5
5
  afterEach(() => {
@@ -1,7 +1,6 @@
1
- import { t as Computed } from "../index-DUshSQ_6.mjs";
1
+ import { t as Computed } from "../index-DydGTqZU.mjs";
2
2
 
3
3
  //#region src/utilities/media-query.d.ts
4
- declare const isBrowser: boolean;
5
4
  /**
6
5
  * Creates a signal that tracks a CSS media query.
7
6
  *
@@ -11,4 +10,4 @@ declare const isBrowser: boolean;
11
10
  */
12
11
  declare function createMediaQuery(query: string, defaultState?: boolean): Computed<boolean>;
13
12
  //#endregion
14
- export { createMediaQuery, isBrowser };
13
+ export { createMediaQuery };
@@ -1,7 +1,7 @@
1
- import { _ as signal } from "../signals-BHmWX6ox.mjs";
1
+ import { v as signal } from "../signals-J8dK_rA4.mjs";
2
2
  import { fromEvent, sync } from "./event-driven.mjs";
3
+ import { isBrowser } from "./environment.mjs";
3
4
  //#region src/utilities/media-query.ts
4
- const isBrowser = typeof window !== "undefined";
5
5
  /**
6
6
  * Creates a signal that tracks a CSS media query.
7
7
  *
@@ -16,4 +16,4 @@ function createMediaQuery(query, defaultState) {
16
16
  return state;
17
17
  }
18
18
  //#endregion
19
- export { createMediaQuery, isBrowser };
19
+ export { createMediaQuery };
@@ -1,16 +1,13 @@
1
- import { g as onCleanup } from "../signals-BHmWX6ox.mjs";
1
+ import { observe } from "./_observe.mjs";
2
2
  //#region src/utilities/mutation-observer.ts
3
3
  /**
4
4
  * Watches `target` for DOM mutations and calls `callback` with each batch of
5
5
  * `MutationRecord`s.
6
6
  */
7
7
  function createMutationObserver(target, options, callback) {
8
- const observer = new MutationObserver((records) => callback(records));
9
- const el = target;
10
- if (el) observer.observe(el, options);
11
- const cleanup = () => observer.disconnect();
12
- onCleanup(cleanup);
13
- return { [Symbol.dispose]: cleanup };
8
+ return observe(new MutationObserver((records) => callback(records)), (o) => {
9
+ if (target) o.observe(target, options);
10
+ });
14
11
  }
15
12
  //#endregion
16
13
  export { createMutationObserver };
@@ -1,5 +1,5 @@
1
- import { d as effectScope } from "../signals-BHmWX6ox.mjs";
2
- import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
1
+ import { f as effectScope } from "../signals-J8dK_rA4.mjs";
2
+ import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
3
3
  import { createMutationObserver } from "./mutation-observer.mjs";
4
4
  //#region src/utilities/mutation-observer.test.ts
5
5
  afterEach(() => {
@@ -1,9 +1,9 @@
1
- import { t as Computed } from "../index-DUshSQ_6.mjs";
1
+ import { t as Computed } from "../index-DydGTqZU.mjs";
2
2
 
3
3
  //#region src/utilities/network.d.ts
4
4
  /**
5
5
  * Singleton `Computed<boolean>` — `true` when `navigator.onLine` is true.
6
- * Reacts to `online` / `offline` window events.
6
+ * Reacts to `online` / `offline` window events. Outside a browser, always `true`.
7
7
  */
8
8
  declare const online: Computed<boolean>;
9
9
  //#endregion
@@ -1,8 +1,10 @@
1
- import { _ as signal } from "../signals-BHmWX6ox.mjs";
1
+ import { v as signal } from "../signals-J8dK_rA4.mjs";
2
2
  import { on } from "./event-listener.mjs";
3
+ import { isBrowser } from "./environment.mjs";
3
4
  //#region src/utilities/network.ts
4
5
  function createOnline() {
5
- const value = signal(typeof navigator !== "undefined" ? navigator.onLine : true);
6
+ if (!isBrowser) return signal(true);
7
+ const value = signal(navigator.onLine);
6
8
  const update = () => value(navigator.onLine);
7
9
  on(window, "online", update);
8
10
  on(window, "offline", update);
@@ -10,7 +12,7 @@ function createOnline() {
10
12
  }
11
13
  /**
12
14
  * Singleton `Computed<boolean>` — `true` when `navigator.onLine` is true.
13
- * Reacts to `online` / `offline` window events.
15
+ * Reacts to `online` / `offline` window events. Outside a browser, always `true`.
14
16
  */
15
17
  const online = createOnline();
16
18
  //#endregion
@@ -1,4 +1,4 @@
1
- import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
1
+ import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
2
2
  import { online } from "./network.mjs";
3
3
  //#region src/utilities/network.test.ts
4
4
  afterEach(() => {
@@ -1,5 +1,5 @@
1
- import { d as effectScope } from "../signals-BHmWX6ox.mjs";
2
- import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
1
+ import { f as effectScope } from "../signals-J8dK_rA4.mjs";
2
+ import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
3
3
  import { onClickOutside } from "./on-click-outside.mjs";
4
4
  //#region src/utilities/on-click-outside.test.ts
5
5
  afterEach(() => {
@@ -1,4 +1,4 @@
1
- import { t as Computed } from "../index-DUshSQ_6.mjs";
1
+ import { t as Computed } from "../index-DydGTqZU.mjs";
2
2
 
3
3
  //#region src/utilities/orientation.d.ts
4
4
  type OrientationResult = {
@@ -1,9 +1,17 @@
1
+ import { u as computed } from "../signals-J8dK_rA4.mjs";
1
2
  import { fromEvent, sync } from "./event-driven.mjs";
3
+ import { isBrowser } from "./environment.mjs";
2
4
  //#region src/utilities/orientation.ts
3
5
  /**
4
- * Returns reactive signals for the screen orientation.
6
+ * Returns reactive signals for the screen orientation. Outside a browser,
7
+ * returns `{ angle: 0, type: "portrait-primary" }` and a no-op disposer.
5
8
  */
6
9
  function createOrientation() {
10
+ if (!isBrowser) return {
11
+ angle: computed(() => 0),
12
+ type: computed(() => "portrait-primary"),
13
+ [Symbol.dispose]() {}
14
+ };
7
15
  const subscribe = fromEvent(screen.orientation, "change");
8
16
  const [angle, stopAngle] = sync(subscribe, () => screen.orientation?.angle ?? 0);
9
17
  const [type, stopType] = sync(subscribe, () => screen.orientation?.type ?? "portrait-primary");
@@ -1,4 +1,4 @@
1
- import { t as Computed } from "../index-DUshSQ_6.mjs";
1
+ import { t as Computed } from "../index-DydGTqZU.mjs";
2
2
 
3
3
  //#region src/utilities/previous.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { _ as signal, u as effect } from "../signals-BHmWX6ox.mjs";
1
+ import { d as effect, v as signal } from "../signals-J8dK_rA4.mjs";
2
2
  //#region src/utilities/previous.ts
3
3
  /**
4
4
  * Returns a `Computed` that always holds the *previous* value of `source`.
@@ -1,5 +1,5 @@
1
- import { _ as signal, d as effectScope } from "../signals-BHmWX6ox.mjs";
2
- import { o as describe, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
1
+ import { f as effectScope, v as signal } from "../signals-J8dK_rA4.mjs";
2
+ import { o as describe, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
3
3
  import { createPrevious } from "./previous.mjs";
4
4
  //#region src/utilities/previous.test.ts
5
5
  describe("createPrevious", () => {
@@ -1,4 +1,4 @@
1
- import { t as Computed } from "../index-DUshSQ_6.mjs";
1
+ import { t as Computed } from "../index-DydGTqZU.mjs";
2
2
 
3
3
  //#region src/utilities/promise.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { _ as signal, c as batch, l as computed } from "../signals-BHmWX6ox.mjs";
1
+ import { l as batch, u as computed, v as signal } from "../signals-J8dK_rA4.mjs";
2
2
  //#region src/utilities/promise.ts
3
3
  /**
4
4
  * A `Promise` subclass that exposes its state as reactive signals.
@@ -1,5 +1,5 @@
1
- import { u as effect } from "../signals-BHmWX6ox.mjs";
2
- import { o as describe, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
1
+ import { d as effect } from "../signals-J8dK_rA4.mjs";
2
+ import { o as describe, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
3
3
  import { ReactivePromise, promise } from "./promise.mjs";
4
4
  //#region src/utilities/promise.test.ts
5
5
  describe("ReactivePromise", () => {
@@ -1,15 +1,13 @@
1
- import { g as onCleanup } from "../signals-BHmWX6ox.mjs";
1
+ import { observe } from "./_observe.mjs";
2
2
  //#region src/utilities/resize-observer.ts
3
3
  /**
4
4
  * Raw `ResizeObserver` wrapper with automatic cleanup.
5
5
  * Use `createElementRect` for the common case.
6
6
  */
7
7
  function createResizeObserver(target, callback) {
8
- const observer = new ResizeObserver(callback);
9
- if (target) observer.observe(target);
10
- const cleanup = () => observer.disconnect();
11
- onCleanup(cleanup);
12
- return { [Symbol.dispose]: cleanup };
8
+ return observe(new ResizeObserver(callback), (o) => {
9
+ if (target) o.observe(target);
10
+ });
13
11
  }
14
12
  //#endregion
15
13
  export { createResizeObserver };
@@ -1,4 +1,4 @@
1
- import { u as effect, y as untracked } from "../signals-BHmWX6ox.mjs";
1
+ import { b as untracked, d as effect } from "../signals-J8dK_rA4.mjs";
2
2
  //#region src/utilities/retry.ts
3
3
  /**
4
4
  * Wraps `fn` to retry up to `attempts` times on failure.
@@ -1,5 +1,5 @@
1
- import { g as onCleanup } from "../signals-BHmWX6ox.mjs";
2
- import { n as vi, o as describe, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
1
+ import { _ as onCleanup } from "../signals-J8dK_rA4.mjs";
2
+ import { n as vi, o as describe, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
3
3
  import { retry } from "./retry.mjs";
4
4
  //#region src/utilities/retry.test.ts
5
5
  describe("retry", () => {
@@ -1,4 +1,4 @@
1
- import { t as Computed } from "../index-DUshSQ_6.mjs";
1
+ import { t as Computed } from "../index-DydGTqZU.mjs";
2
2
 
3
3
  //#region src/utilities/routing.d.ts
4
4
  declare function patchHistory(): void;