elements-kit 0.0.14 → 0.0.16

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-C_4VbkvQ.mjs → element-CGVy_8TW.mjs} +12 -18
  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 +18 -25
  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 +18 -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 +57 -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 +11 -1
  111. package/dist/lib-JA05lzCN.d.mts +0 -4
  112. /package/dist/{polyfill-DR5XVnh_.d.mts → polyfill-BVNd6ogU.d.mts} +0 -0
package/dist/slot.d.mts CHANGED
@@ -1,84 +1,2 @@
1
- import { t as PrimitiveNodeType } from "./lib-JA05lzCN.mjs";
2
-
3
- //#region src/slot.d.ts
4
- /**
5
- * A lightweight slot that reserves a region in the DOM using comment markers.
6
- * Content between the markers can be replaced dynamically without wrapper elements.
7
- */
8
- declare class Slot {
9
- #private;
10
- private readonly start;
11
- private readonly end;
12
- /**
13
- * Render the slot as a DocumentFragment.
14
- * If not yet mounted, inserts the comment markers and optional default content.
15
- * If already mounted, extracts and returns the current content WITHOUT disposing
16
- * it — the caller takes ownership of the returned nodes and is responsible for
17
- * their disposal.
18
- */
19
- slot(defaultContent?: PrimitiveNodeType): DocumentFragment;
20
- /** Dispose reactive children and remove all content between the markers. */
21
- clear(): void;
22
- /**
23
- * Replace the slot's content with the given element.
24
- * No-op if the slot is not mounted or the content is identical.
25
- */
26
- set(element: Node): void;
27
- /**
28
- * Extract and return the current slot content as a DocumentFragment.
29
- * Returns `null` if the slot is not mounted.
30
- * Content is NOT disposed — the caller takes ownership and is responsible
31
- * for disposal.
32
- */
33
- get(): DocumentFragment | null;
34
- /** Returns the parent node if the slot is mounted, otherwise `null`. */
35
- parent(): ParentNode | null;
36
- /** Whether the slot's comment markers are attached to the DOM. */
37
- isMounted(): boolean;
38
- private isSame;
39
- /**
40
- * Create a callable slot instance.
41
- *
42
- * The returned value is both a function and an object:
43
- * - Call it to render the slot with optional default content.
44
- * - Access `.set()`, `.parent()`, `.isMounted()` for slot management.
45
- *
46
- * @example
47
- * ```ts
48
- * const slot = createSlot();
49
- * el.append(slot("default text")); // mount with default
50
- * slot.set(newElement); // replace content
51
- * ```
52
- */
53
- static new(): Slot & ((defaultContent?: PrimitiveNodeType) => DocumentFragment);
54
- }
55
- type SlotInstance = ReturnType<typeof Slot.new>;
56
- /** A callable slot — invoke to render, or access `.set()` / `.isMounted()` / `.parent()` for management. */
57
- /**
58
- * Symbol key for attaching a `Slots` instance to a custom element instance.
59
- * This prevent collisions with Element properties and are not meant to be treated as JSX children.
60
- */
61
- declare const $slots: unique symbol;
62
- declare const $map: unique symbol;
63
- declare const $keys: unique symbol;
64
- declare const $has: unique symbol;
65
- /**
66
- * A keyed collection of slot instances.
67
- * Slots are pre-created from the provided keys and lazily created on first access for unknown keys.
68
- */
69
- declare class Slots<K extends string> implements Iterable<[K, SlotInstance]> {
70
- readonly [$map]: Map<K, Slot & ((defaultContent?: PrimitiveNodeType) => DocumentFragment)>;
71
- private constructor();
72
- [Symbol.iterator](): MapIterator<[K, Slot & ((defaultContent?: PrimitiveNodeType) => DocumentFragment)]>;
73
- [Symbol.toStringTag](): string;
74
- [Symbol.hasInstance](instance: unknown): instance is Slots<any>;
75
- [$has](key: K): boolean;
76
- /** Check whether a slot with the given key exists. */
77
- static has<K extends string>(slots: Slots<K>, key: K): boolean;
78
- [$keys](): MapIterator<K>;
79
- /** Iterate over all registered slot keys. */
80
- static keys<K extends string>(slots: Slots<K>): MapIterator<K>;
81
- static new<K extends string>(keys: K[]): Slots<K> & { readonly [P in K]: SlotInstance };
82
- }
83
- //#endregion
84
- export { $slots, Slot, SlotInstance, Slots };
1
+ import { i as Slots, n as Slot, r as SlotInstance, t as SLOTS } from "./slot-C7GQZe-r.mjs";
2
+ export { SLOTS, Slot, SlotInstance, Slots };
package/dist/slot.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as Slot, r as Slots, t as $slots } from "./slot-Cydy7-0L.mjs";
2
- export { $slots, Slot, Slots };
1
+ import { n as Slot, r as Slots, t as SLOTS } from "./slot-Kb61AcgW.mjs";
2
+ export { SLOTS, Slot, Slots };
@@ -13311,4 +13311,4 @@ Object.defineProperty(globalThis, GLOBAL_EXPECT, {
13311
13311
  configurable: true
13312
13312
  });
13313
13313
  //#endregion
13314
- export { beforeEach as a, beforeAll as i, vi as n, describe as o, afterEach as r, it as s, globalExpect as t };
13314
+ export { beforeEach as a, test$2 as c, beforeAll as i, vi as n, describe as o, afterEach as r, it as s, globalExpect as t };
@@ -0,0 +1,11 @@
1
+ //#region src/utilities/_observe.d.ts
2
+ /**
3
+ * Internal helper for observer wrappers (Intersection/Mutation/Resize).
4
+ * Runs `attach` to start observing, registers `disconnect` with the current
5
+ * scope, and returns a `Disposable`.
6
+ */
7
+ declare function observe<O extends {
8
+ disconnect(): void;
9
+ }>(obs: O, attach: (o: O) => void): Disposable;
10
+ //#endregion
11
+ export { observe };
@@ -0,0 +1,15 @@
1
+ import { _ as onCleanup } from "../signals-J8dK_rA4.mjs";
2
+ //#region src/utilities/_observe.ts
3
+ /**
4
+ * Internal helper for observer wrappers (Intersection/Mutation/Resize).
5
+ * Runs `attach` to start observing, registers `disconnect` with the current
6
+ * scope, and returns a `Disposable`.
7
+ */
8
+ function observe(obs, attach) {
9
+ attach(obs);
10
+ const cleanup = () => obs.disconnect();
11
+ onCleanup(cleanup);
12
+ return { [Symbol.dispose]: cleanup };
13
+ }
14
+ //#endregion
15
+ export { observe };
@@ -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/active-element.d.ts
4
4
  declare const activeElement: Computed<Element | null>;
@@ -1,11 +1,15 @@
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/active-element.ts
3
5
  /**
4
6
  * Returns a read-only `Computed<Element | null>` bound to `document.activeElement`.
5
- * Reacts to `focusin` and `focusout` events on the document.
7
+ * Reacts to `focusin` and `focusout` events on the document. Outside a browser,
8
+ * always `null`.
6
9
  */
7
10
  function createActiveElement() {
8
- const [active] = sync(fromEvent(document, ["focusin", "focusout"]), () => typeof document !== "undefined" ? document.activeElement : null);
11
+ if (!isBrowser) return computed(() => null);
12
+ const [active] = sync(fromEvent(document, ["focusin", "focusout"]), () => document.activeElement);
9
13
  return active;
10
14
  }
11
15
  const activeElement = createActiveElement();
@@ -1,4 +1,4 @@
1
- import { o as describe, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
1
+ import { o as describe, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
2
2
  import { activeElement } from "./active-element.mjs";
3
3
  //#region src/utilities/active-element.test.ts
4
4
  describe("activeElement (singleton)", () => {
@@ -1,4 +1,4 @@
1
- import { n as MaybeReactive } from "../index-DUshSQ_6.mjs";
1
+ import { n as MaybeReactive } from "../index-DydGTqZU.mjs";
2
2
  import { ComputedPromise } from "./promise.mjs";
3
3
 
4
4
  //#region src/utilities/async.d.ts
@@ -1,4 +1,4 @@
1
- import { _ as signal, r as resolve, u as effect, y as untracked } from "../signals-BHmWX6ox.mjs";
1
+ import { b as untracked, d as effect, r as resolve, v as signal } from "../signals-J8dK_rA4.mjs";
2
2
  import { promise } from "./promise.mjs";
3
3
  //#region src/utilities/async.ts
4
4
  var Async = class {
@@ -1,5 +1,5 @@
1
- import { _ as signal, g as onCleanup, u as effect } 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, d as effect, v as signal } 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 { Async, async } from "./async.mjs";
4
4
  import { createInterval } from "./interval.mjs";
5
5
  //#region src/utilities/async.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/debounced.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
  import { createTimeout } from "./timeout.mjs";
3
3
  //#region src/utilities/debounced.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
- import { _ as signal, d as effectScope } from "../signals-BHmWX6ox.mjs";
2
- import { a as beforeEach, 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, v as signal } from "../signals-J8dK_rA4.mjs";
2
+ import { a as beforeEach, n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
3
3
  import { createDebounced } from "./debounced.mjs";
4
4
  //#region src/utilities/debounced.test.ts
5
5
  beforeEach(() => {
@@ -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/element-rect.d.ts
4
4
  type RectResult = {
@@ -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 { createResizeObserver } from "./resize-observer.mjs";
3
3
  //#region src/utilities/element-rect.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 { createElementRect } from "./element-rect.mjs";
4
4
  //#region src/utilities/element-rect.test.ts
5
5
  afterEach(() => {
@@ -1,4 +1,4 @@
1
- import { r as Signal } from "../index-DUshSQ_6.mjs";
1
+ import { r as Signal } from "../index-DydGTqZU.mjs";
2
2
 
3
3
  //#region src/utilities/element-scroll.d.ts
4
4
  type ElementScrollResult = {
@@ -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,6 @@
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
+ import { async } from "./async.mjs";
3
4
  import { createInterval } from "./interval.mjs";
4
5
  //#region src/utilities/interval.test.ts
5
6
  afterEach(() => {
@@ -92,6 +93,21 @@ describe("createInterval", () => {
92
93
  vi.advanceTimersByTime(500);
93
94
  globalExpect(cb).toHaveBeenCalledTimes(0);
94
95
  });
96
+ it("composes with async() — reruns on each tick", async () => {
97
+ vi.useFakeTimers();
98
+ const asyncOp = async;
99
+ let runCount = 0;
100
+ const timer = createInterval(100);
101
+ const op = asyncOp(() => {
102
+ timer.timestamp();
103
+ runCount++;
104
+ return Promise.resolve(runCount);
105
+ }).start();
106
+ await vi.advanceTimersByTimeAsync(350);
107
+ globalExpect(runCount).toBeGreaterThan(1);
108
+ timer[Symbol.dispose]();
109
+ op.stop();
110
+ });
95
111
  });
96
112
  //#endregion
97
113
  export {};
@@ -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(() => {