@vizejs/composable 0.810.0 → 0.812.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 (166) hide show
  1. package/dist/abort-signal.mjs +0 -62
  2. package/dist/active-element.mjs +0 -11
  3. package/dist/animate.mjs +0 -19
  4. package/dist/async-resource.mjs +0 -17
  5. package/dist/battery.mjs +0 -13
  6. package/dist/breakpoints.mjs +0 -24
  7. package/dist/capability.mjs +0 -12
  8. package/dist/{catalog-BRX-Wg8B.mjs → catalog-CcpCnLjb.mjs} +0 -14
  9. package/dist/catalog.mjs +1 -1
  10. package/dist/color-mode.mjs +0 -23
  11. package/dist/computed-with-control.mjs +0 -22
  12. package/dist/create-event-hook.mjs +0 -27
  13. package/dist/create-global-state.mjs +0 -23
  14. package/dist/create-shared-composable.mjs +0 -23
  15. package/dist/device-motion.mjs +0 -11
  16. package/dist/device-orientation.mjs +0 -23
  17. package/dist/device-pixel-ratio.mjs +0 -11
  18. package/dist/disposal-scope.mjs +0 -25
  19. package/dist/document-visibility.mjs +0 -14
  20. package/dist/draggable.mjs +0 -14
  21. package/dist/element-bounding.mjs +0 -14
  22. package/dist/element-by-point.mjs +0 -10
  23. package/dist/element-hover.mjs +0 -13
  24. package/dist/element-target.mjs +0 -30
  25. package/dist/focus.mjs +0 -23
  26. package/dist/fps.mjs +0 -12
  27. package/dist/geolocation.mjs +0 -14
  28. package/dist/i18n.mjs +0 -86
  29. package/dist/icu-message.mjs +0 -58
  30. package/dist/idle.mjs +0 -16
  31. package/dist/index.mjs +2 -2
  32. package/dist/infinite-scroll.mjs +0 -16
  33. package/dist/intersection-observer.mjs +0 -27
  34. package/dist/locale.mjs +0 -20
  35. package/dist/magic-keys.mjs +0 -35
  36. package/dist/math.mjs +0 -37
  37. package/dist/media-query.mjs +0 -29
  38. package/dist/mouse-in-element.mjs +0 -12
  39. package/dist/mouse.mjs +0 -12
  40. package/dist/mutation-observer.mjs +0 -15
  41. package/dist/network.mjs +0 -24
  42. package/dist/on-click-outside.mjs +0 -16
  43. package/dist/on-key-stroke.mjs +0 -33
  44. package/dist/on-long-press.mjs +0 -14
  45. package/dist/on-start-typing.mjs +0 -23
  46. package/dist/page-leave.mjs +0 -11
  47. package/dist/parent-element.mjs +0 -9
  48. package/dist/pinch.mjs +0 -14
  49. package/dist/pointer-lock.mjs +0 -23
  50. package/dist/pointer.mjs +0 -18
  51. package/dist/preferences.mjs +0 -31
  52. package/dist/preferred-languages.mjs +0 -13
  53. package/dist/ref-auto-reset.mjs +0 -24
  54. package/dist/ref-debounced.mjs +0 -22
  55. package/dist/ref-default.mjs +0 -21
  56. package/dist/resize-observer.mjs +0 -31
  57. package/dist/resolver.mjs +1 -58
  58. package/dist/retry-async.mjs +0 -25
  59. package/dist/retry-delay.mjs +0 -23
  60. package/dist/scope.mjs +0 -14
  61. package/dist/screen-orientation.mjs +0 -15
  62. package/dist/scroll-lock.mjs +0 -14
  63. package/dist/scroll.mjs +0 -27
  64. package/dist/standard-schema.mjs +0 -31
  65. package/dist/swipe.mjs +0 -36
  66. package/dist/temporal.mjs +0 -30
  67. package/dist/text-selection.mjs +0 -15
  68. package/dist/textarea-autosize.mjs +0 -13
  69. package/dist/to-reactive.mjs +0 -20
  70. package/dist/transition.mjs +0 -7
  71. package/dist/until.mjs +0 -25
  72. package/dist/use-array.mjs +0 -52
  73. package/dist/use-barcode-detector.mjs +0 -25
  74. package/dist/use-bluetooth.mjs +0 -27
  75. package/dist/use-broadcast-channel.mjs +0 -30
  76. package/dist/use-builtin-ai.mjs +0 -68
  77. package/dist/use-clipboard.mjs +0 -27
  78. package/dist/use-compression-stream.mjs +0 -78
  79. package/dist/use-contact-picker.mjs +0 -22
  80. package/dist/use-cookie.mjs +0 -63
  81. package/dist/use-countdown.mjs +0 -22
  82. package/dist/use-counter.mjs +0 -29
  83. package/dist/use-css-var.mjs +0 -28
  84. package/dist/use-date-format.mjs +0 -48
  85. package/dist/use-date-time-format.mjs +0 -22
  86. package/dist/use-debounced.mjs +0 -39
  87. package/dist/use-display-media.mjs +0 -22
  88. package/dist/use-display-names.mjs +0 -19
  89. package/dist/use-document-title.mjs +0 -25
  90. package/dist/use-drop-zone.mjs +0 -36
  91. package/dist/use-event-source.mjs +0 -25
  92. package/dist/use-eye-dropper.mjs +0 -19
  93. package/dist/use-favicon.mjs +0 -23
  94. package/dist/use-fetch.mjs +0 -27
  95. package/dist/use-field.mjs +0 -27
  96. package/dist/use-file-dialog.mjs +0 -21
  97. package/dist/{use-form-A4j_h14D.mjs → use-form-BZqwMs6k.mjs} +0 -68
  98. package/dist/use-form-field-props.mjs +0 -57
  99. package/dist/use-form.mjs +1 -1
  100. package/dist/use-fullscreen.mjs +0 -23
  101. package/dist/use-gamepad.mjs +0 -50
  102. package/dist/use-hid.mjs +0 -25
  103. package/dist/use-history.mjs +0 -43
  104. package/dist/use-id-generator.mjs +0 -21
  105. package/dist/use-image.mjs +0 -22
  106. package/dist/use-indexed-db.mjs +0 -39
  107. package/dist/use-interval.mjs +0 -28
  108. package/dist/use-list-format.mjs +0 -18
  109. package/dist/use-machine.mjs +0 -34
  110. package/dist/use-map.mjs +0 -28
  111. package/dist/use-media-controls.mjs +0 -28
  112. package/dist/use-mounted.mjs +0 -18
  113. package/dist/use-navigation-api.mjs +0 -27
  114. package/dist/use-notification.mjs +0 -24
  115. package/dist/use-number-format.mjs +0 -23
  116. package/dist/use-object-url.mjs +0 -22
  117. package/dist/use-offset-pagination.mjs +0 -18
  118. package/dist/use-payment-request.mjs +0 -25
  119. package/dist/use-performance-observer.mjs +0 -27
  120. package/dist/use-permission.mjs +0 -26
  121. package/dist/use-plural-rules.mjs +0 -21
  122. package/dist/use-push-subscription.mjs +0 -28
  123. package/dist/use-queue.mjs +0 -29
  124. package/dist/use-raf-fn.mjs +0 -23
  125. package/dist/use-relative-time-format.mjs +0 -35
  126. package/dist/use-request-idle-callback.mjs +0 -42
  127. package/dist/use-route-query.mjs +0 -17
  128. package/dist/use-scheduler-post-task.mjs +0 -27
  129. package/dist/use-screen-details.mjs +0 -42
  130. package/dist/use-script-tag.mjs +0 -28
  131. package/dist/use-segmenter.mjs +0 -20
  132. package/dist/use-serial.mjs +0 -24
  133. package/dist/use-service-worker.mjs +0 -27
  134. package/dist/use-set.mjs +0 -23
  135. package/dist/use-share.mjs +0 -23
  136. package/dist/use-sorted-locale.mjs +0 -20
  137. package/dist/use-speech-recognition.mjs +0 -24
  138. package/dist/use-speech-synthesis.mjs +0 -26
  139. package/dist/use-stack.mjs +0 -27
  140. package/dist/use-storage-estimate.mjs +0 -41
  141. package/dist/use-storage.mjs +0 -68
  142. package/dist/use-style-tag.mjs +0 -22
  143. package/dist/use-supported.mjs +0 -17
  144. package/dist/use-throttled.mjs +0 -46
  145. package/dist/use-time-ago.mjs +0 -22
  146. package/dist/use-toggle.mjs +0 -19
  147. package/dist/use-url-hash.mjs +0 -28
  148. package/dist/use-url-search-params.mjs +0 -99
  149. package/dist/use-usb.mjs +0 -23
  150. package/dist/use-user-activation.mjs +0 -22
  151. package/dist/use-user-media.mjs +0 -50
  152. package/dist/use-vibrate.mjs +0 -21
  153. package/dist/use-view-transition.mjs +0 -22
  154. package/dist/use-visual-viewport.mjs +0 -25
  155. package/dist/use-wake-lock.mjs +0 -21
  156. package/dist/use-web-authn.mjs +0 -61
  157. package/dist/use-web-locks.mjs +0 -25
  158. package/dist/use-web-midi.mjs +0 -22
  159. package/dist/use-web-vitals.mjs +0 -41
  160. package/dist/use-websocket.mjs +0 -27
  161. package/dist/use-worker-fn.mjs +0 -37
  162. package/dist/virtual-list.mjs +0 -14
  163. package/dist/whenever.mjs +0 -21
  164. package/dist/window-size.mjs +0 -12
  165. package/package.json +2 -2
  166. package/registry/registry.json +1 -1
@@ -2,21 +2,6 @@ import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { resolveElements } from "./element-target.mjs";
3
3
  import { hasInjectionContext, onMounted, readonly, ref, shallowRef, toValue, watch } from "vue";
4
4
  //#region src/mutation-observer.ts
5
- /**
6
- * Observe DOM mutations of reactive elements.
7
- *
8
- * The observer is recreated when the resolved targets or host change and is
9
- * disconnected when the owning reactive scope stops. At least one of
10
- * `attributes`, `childList`, or `characterData` must be enabled (directly or
11
- * implicitly), mirroring the platform contract. No work happens during
12
- * server rendering.
13
- *
14
- * @param targets Reactive element target or list of targets.
15
- * @param callback Native `MutationObserver` callback.
16
- * @param options Observation filter, capability, and timing.
17
- * @default options {}
18
- * @returns Support flag, record draining, and stop control.
19
- */
20
5
  function useMutationObserver(targets, callback, options = {}) {
21
6
  const isSupported = ref(false);
22
7
  const mounted = shallowRef(!hasInjectionContext());
package/dist/network.mjs CHANGED
@@ -1,20 +1,6 @@
1
1
  import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { hasInjectionContext, readonly, ref, shallowRef, toValue, watch, watchPostEffect } from "vue";
3
3
  //#region src/network.ts
4
- /**
5
- * Track connectivity and connection quality.
6
- *
7
- * Listens for `online`/`offline` on the window and `change` on
8
- * `navigator.connection` where available. Unknown or future enum values
9
- * normalize to `null` so the public unions stay closed. Server renders
10
- * report `ssrOnline` with every quality metric `null`. Inside a component
11
- * the connection is read after mounting, so hydration renders the server
12
- * values first. Listeners are removed with the owning reactive scope.
13
- *
14
- * @param options Server fallback and window capability.
15
- * @default options {}
16
- * @returns Reactive connectivity and connection metrics.
17
- */
18
4
  function useNetwork(options = {}) {
19
5
  const ssrOnline = options.ssrOnline ?? true;
20
6
  const isSupported = ref(false);
@@ -81,16 +67,6 @@ function useNetwork(options = {}) {
81
67
  type: readonly(type)
82
68
  };
83
69
  }
84
- /**
85
- * Track whether the browser reports being online.
86
- *
87
- * Shorthand for `useNetwork(options).isOnline` with the same SSR fallback
88
- * and cleanup semantics.
89
- *
90
- * @param options Server fallback and window capability.
91
- * @default options {}
92
- * @returns Readonly online flag.
93
- */
94
70
  function useOnline(options = {}) {
95
71
  return useNetwork(options).isOnline;
96
72
  }
@@ -8,22 +8,6 @@ const defaultScheduler = {
8
8
  globalThis.clearTimeout(handle);
9
9
  }
10
10
  };
11
- /**
12
- * Call a handler when the user clicks (or focuses an iframe) outside an element.
13
- *
14
- * A click counts as outside only when its `pointerdown` also started outside
15
- * the target, so drags that begin inside (e.g. text selection) and end
16
- * outside are ignored. Event paths (`composedPath()`) make shadow-DOM targets
17
- * work. The host is resolved once, when called. Nothing is registered
18
- * during server rendering; listeners are removed with the owning scope or by
19
- * the returned stop function.
20
- *
21
- * @param target Reactive element target.
22
- * @param handler Called with the outside `PointerEvent`/`MouseEvent` or `FocusEvent`.
23
- * @param options Ignore list, phase, iframe detection, and capabilities.
24
- * @default options {}
25
- * @returns Stop function.
26
- */
27
11
  function onClickOutside(target, handler, options = {}) {
28
12
  const host = options.host === void 0 ? browserClickHost() : toValue(options.host);
29
13
  if (!host) return () => void 0;
@@ -2,21 +2,6 @@ import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { normalizeKeyName } from "./magic-keys.mjs";
3
3
  import { toValue, watch } from "vue";
4
4
  //#region src/on-key-stroke.ts
5
- /**
6
- * Run a handler when matching keys are pressed.
7
- *
8
- * `key` accepts a name, a list of names (normalized like combos, so `"esc"`
9
- * matches `Escape` and `"a"` matches `KeyA`), a predicate, or `true` for every
10
- * key. The listener follows the reactive target and is removed with the
11
- * owning scope or the returned stop function; nothing is registered during
12
- * server rendering.
13
- *
14
- * @param key Key filter, or `true` for any key.
15
- * @param handler Called with the matching `KeyboardEvent`.
16
- * @param options Event name, target, passivity, and dedupe.
17
- * @default options {}
18
- * @returns Stop function.
19
- */
20
5
  function onKeyStroke(key, handler, options = {}) {
21
6
  const eventName = options.eventName ?? "keydown";
22
7
  const names = key === true || typeof key === "function" ? void 0 : new Set((typeof key === "string" ? [key] : key).map((name) => normalizeKeyName(name)));
@@ -39,30 +24,12 @@ function onKeyStroke(key, handler, options = {}) {
39
24
  tryOnScopeDispose(dispose);
40
25
  return dispose;
41
26
  }
42
- /**
43
- * {@link onKeyStroke} for `keydown`.
44
- *
45
- * @param key Key filter, or `true` for any key.
46
- * @param handler Called with the matching `KeyboardEvent`.
47
- * @param options Target, passivity, and dedupe.
48
- * @default options {}
49
- * @returns Stop function.
50
- */
51
27
  function onKeyDown(key, handler, options = {}) {
52
28
  return onKeyStroke(key, handler, {
53
29
  ...options,
54
30
  eventName: "keydown"
55
31
  });
56
32
  }
57
- /**
58
- * {@link onKeyStroke} for `keyup`.
59
- *
60
- * @param key Key filter, or `true` for any key.
61
- * @param handler Called with the matching `KeyboardEvent`.
62
- * @param options Target, passivity, and dedupe.
63
- * @default options {}
64
- * @returns Stop function.
65
- */
66
33
  function onKeyUp(key, handler, options = {}) {
67
34
  return onKeyStroke(key, handler, {
68
35
  ...options,
@@ -8,20 +8,6 @@ const defaultScheduler = {
8
8
  globalThis.clearTimeout(handle);
9
9
  }
10
10
  };
11
- /**
12
- * Call a handler when an element is pressed and held.
13
- *
14
- * Uses Pointer Events, so mouse, touch, and pen behave alike. Moving more than
15
- * `distanceThreshold` or releasing early cancels the press. Nothing is
16
- * registered during server rendering; listeners and the timer are released
17
- * with the owning scope or the returned stop function.
18
- *
19
- * @param target Reactive element target.
20
- * @param handler Called with the initiating `pointerdown` event.
21
- * @param options Delay, threshold, modifiers, and callbacks.
22
- * @default options {}
23
- * @returns Stop function.
24
- */
25
11
  function onLongPress(target, handler, options = {}) {
26
12
  const { delay = 500, distanceThreshold = 10, modifiers = {}, now = Date.now, scheduler = defaultScheduler } = options;
27
13
  let handle;
@@ -1,33 +1,10 @@
1
1
  import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { toValue, watch } from "vue";
3
3
  //#region src/on-start-typing.ts
4
- /**
5
- * Whether a keyboard event would type a printable character.
6
- *
7
- * Single-character keys (letters, digits, punctuation; not space) without
8
- * `ctrl`/`meta`/`alt` qualify.
9
- *
10
- * @param event Keyboard event.
11
- * @returns Whether the event starts typing.
12
- */
13
4
  function isTypingKeystroke(event) {
14
5
  if (event.ctrlKey || event.metaKey || event.altKey) return false;
15
6
  return event.key.length === 1 && event.key !== " ";
16
7
  }
17
- /**
18
- * Call a handler when the user starts typing while no editable element has
19
- * focus — typically to focus a search field.
20
- *
21
- * Editable means `input`, `textarea`, `select`, or any element with
22
- * `isContentEditable`, and elements with `role="textbox"`/`"searchbox"`/`"combobox"`.
23
- * Nothing is registered during server rendering; the listener is removed with
24
- * the owning scope or the returned stop function.
25
- *
26
- * @param handler Called with the initiating `keydown` event.
27
- * @param options Document capability.
28
- * @default options {}
29
- * @returns Stop function.
30
- */
31
8
  function onStartTyping(handler, options = {}) {
32
9
  const stop = watch(() => options.host === void 0 ? browserTypingHost() : toValue(options.host), (host, _previous, onCleanup) => {
33
10
  if (!host) return;
@@ -1,17 +1,6 @@
1
1
  import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { readonly, ref, toValue, watch } from "vue";
3
3
  //#region src/page-leave.ts
4
- /**
5
- * Detect when the mouse leaves the page (for exit-intent UI).
6
- *
7
- * A `mouseout` without a `relatedTarget` means the pointer left the
8
- * document; any `mouseover` means it came back. Server renders report
9
- * `false`; listeners are removed with the owning reactive scope.
10
- *
11
- * @param options Window capability.
12
- * @default options {}
13
- * @returns Readonly ref that is `true` while the pointer is outside the page.
14
- */
15
4
  function usePageLeave(options = {}) {
16
5
  const left = ref(false);
17
6
  const onOut = (event) => {
@@ -2,15 +2,6 @@ import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { isElementNode, resolveElement } from "./element-target.mjs";
3
3
  import { shallowRef, watch } from "vue";
4
4
  //#region src/parent-element.ts
5
- /**
6
- * Track the parent element of a reactive element target.
7
- *
8
- * Re-reads `parentElement` whenever the target resolves or changes (after
9
- * the DOM update). Server renders expose `null`.
10
- *
11
- * @param target Reactive element target.
12
- * @returns Readonly shallow ref of the parent element.
13
- */
14
5
  function useParentElement(target) {
15
6
  const parent = shallowRef(null);
16
7
  const stop = watch(() => resolveElement(target), (element) => {
package/dist/pinch.mjs CHANGED
@@ -2,20 +2,6 @@ import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { resolveElement } from "./element-target.mjs";
3
3
  import { readonly, ref, shallowReactive, shallowReadonly, watch } from "vue";
4
4
  //#region src/pinch.ts
5
- /**
6
- * Recognize two-pointer pinch/rotate gestures on an element.
7
- *
8
- * Tracks active pointers with Pointer Events (touch, pen, or mouse chords).
9
- * The first two pointers define the gesture; additional pointers are
10
- * ignored. Pair it with `touch-action: none` on the element so the browser
11
- * does not claim the gesture for zooming. Server renders expose scale `1`,
12
- * rotation `0`, and `isPinching: false`.
13
- *
14
- * @param target Reactive element target.
15
- * @param options Gesture lifecycle callbacks.
16
- * @default options {}
17
- * @returns Reactive gesture state plus reset/stop controls.
18
- */
19
5
  function usePinch(target, options = {}) {
20
6
  const isPinching = ref(false);
21
7
  const scale = ref(1);
@@ -2,37 +2,14 @@ import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { resolveElement } from "./element-target.mjs";
3
3
  import { hasInjectionContext, readonly, ref, shallowRef, toValue, watch, watchPostEffect } from "vue";
4
4
  //#region src/pointer-lock.ts
5
- /** Error thrown when pointer lock cannot be acquired or released. */
6
5
  var PointerLockError = class extends Error {
7
- /** Machine-readable failure code. */
8
6
  code;
9
- /**
10
- * @param code Machine-readable failure code.
11
- * @param message Human-readable explanation.
12
- */
13
7
  constructor(code, message) {
14
8
  super(message);
15
9
  this.name = "PointerLockError";
16
10
  this.code = code;
17
11
  }
18
12
  };
19
- /**
20
- * Reactive wrapper around the Pointer Lock API.
21
- *
22
- * Tracks `pointerlockchange` on the document and exposes promise-based lock
23
- * and unlock actions that settle on the platform confirmation events.
24
- * Rejections are {@link PointerLockError}s with stable codes. Nothing runs
25
- * during server rendering; listeners are removed with the owning scope.
26
- *
27
- * Inside a component the host is read after mounting, so hydration renders
28
- * the server fallback first and never mismatches.
29
- *
30
- * @param target Default reactive element to lock.
31
- * @param options Movement mode and document capability.
32
- * @default target undefined
33
- * @default options {}
34
- * @returns Support flag, lock state, and actions.
35
- */
36
13
  function usePointerLock(target, options = {}) {
37
14
  const isSupported = ref(false);
38
15
  const element = shallowRef(null);
package/dist/pointer.mjs CHANGED
@@ -1,18 +1,6 @@
1
1
  import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { readonly, ref, shallowReactive, shallowReadonly, toValue, watch } from "vue";
3
3
  //#region src/pointer.ts
4
- /**
5
- * Track the latest pointer (mouse, touch, or pen) state.
6
- *
7
- * Listens passively for `pointerdown`, `pointermove`, `pointerup`, and
8
- * `pointerleave` on the reactive target and filters by device kind.
9
- * Listeners are removed with the owning reactive scope; server renders expose
10
- * the initial snapshot.
11
- *
12
- * @param options Device filter, target, and initial snapshot.
13
- * @default options {}
14
- * @returns Reactive snapshot and inside flag.
15
- */
16
4
  function usePointer(options = {}) {
17
5
  const pointerTypes = options.pointerTypes ?? [
18
6
  "mouse",
@@ -76,12 +64,6 @@ function usePointer(options = {}) {
76
64
  isInside: readonly(isInside)
77
65
  };
78
66
  }
79
- /**
80
- * Narrow a platform `pointerType` string to the closed {@link PointerKind} union.
81
- *
82
- * @param value Raw `PointerEvent.pointerType`.
83
- * @returns The matching kind, or `null` for unknown/future device kinds.
84
- */
85
67
  function toPointerKind(value) {
86
68
  return value === "mouse" || value === "touch" || value === "pen" ? value : null;
87
69
  }
@@ -1,26 +1,9 @@
1
1
  import { useMediaQuery } from "./media-query.mjs";
2
2
  import { computed } from "vue";
3
3
  //#region src/preferences.ts
4
- /**
5
- * Whether the user prefers a dark color scheme.
6
- *
7
- * Shares {@link useMediaQuery} semantics: `ssrValue` (default `false`) during
8
- * server rendering and subscription cleanup with the owning scope.
9
- *
10
- * @param options Runtime capability and server fallback.
11
- * @default options {}
12
- * @returns Readonly ref for `(prefers-color-scheme: dark)`.
13
- */
14
4
  function usePreferredDark(options = {}) {
15
5
  return useMediaQuery("(prefers-color-scheme: dark)", options);
16
6
  }
17
- /**
18
- * Reactive color scheme preference.
19
- *
20
- * @param options Runtime capability and server fallback.
21
- * @default options {}
22
- * @returns Computed closed preference.
23
- */
24
7
  function usePreferredColorScheme(options = {}) {
25
8
  const fallback = options.ssrPreference ?? "no-preference";
26
9
  const query = (value) => useMediaQuery(`(prefers-color-scheme: ${value})`, withSsr(options, fallback === value));
@@ -28,13 +11,6 @@ function usePreferredColorScheme(options = {}) {
28
11
  const light = query("light");
29
12
  return computed(() => dark.value ? "dark" : light.value ? "light" : "no-preference");
30
13
  }
31
- /**
32
- * Reactive contrast preference.
33
- *
34
- * @param options Runtime capability and server fallback.
35
- * @default options {}
36
- * @returns Computed closed preference.
37
- */
38
14
  function usePreferredContrast(options = {}) {
39
15
  const fallback = options.ssrPreference ?? "no-preference";
40
16
  const query = (value) => useMediaQuery(`(prefers-contrast: ${value})`, withSsr(options, fallback === value));
@@ -43,13 +19,6 @@ function usePreferredContrast(options = {}) {
43
19
  const custom = query("custom");
44
20
  return computed(() => more.value ? "more" : less.value ? "less" : custom.value ? "custom" : "no-preference");
45
21
  }
46
- /**
47
- * Whether the user prefers reduced transparency.
48
- *
49
- * @param options Runtime capability and server fallback.
50
- * @default options {}
51
- * @returns Readonly ref for `(prefers-reduced-transparency: reduce)`.
52
- */
53
22
  function usePreferredReducedTransparency(options = {}) {
54
23
  return useMediaQuery("(prefers-reduced-transparency: reduce)", options);
55
24
  }
@@ -1,19 +1,6 @@
1
1
  import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { hasInjectionContext, readonly, shallowRef, toValue, watch, watchPostEffect } from "vue";
3
3
  //#region src/preferred-languages.ts
4
- /**
5
- * Track the user's preferred languages (`navigator.languages`).
6
- *
7
- * Updates on `languagechange`. The default host is gated on `window`, so
8
- * Node's own `navigator` never leaks the server locale into the render;
9
- * server renders expose `ssrLanguages`. Inside a component the languages are
10
- * read after mounting, so hydration renders `ssrLanguages` first. The
11
- * listener is removed with the owning reactive scope.
12
- *
13
- * @param options Server fallback and window capability.
14
- * @default options {}
15
- * @returns Readonly ref of BCP 47 language tags, most preferred first.
16
- */
17
4
  function usePreferredLanguages(options = {}) {
18
5
  const fallback = options.ssrLanguages ?? ["en"];
19
6
  const languages = shallowRef(fallback);
@@ -11,30 +11,6 @@ function resolveResetMs(value) {
11
11
  if (!Number.isFinite(value) || value < 0) throw new RangeError(`[VIZE_COMPOSE_REF_AUTO_RESET_INVALID_DELAY] afterMs must be finite and at least zero; received ${String(value)}`);
12
12
  return Math.trunc(value);
13
13
  }
14
- /**
15
- * Writable ref that falls back to a default value `afterMs` milliseconds
16
- * after each write.
17
- *
18
- * Typical for transient UI state such as "Copied!" labels. Every write
19
- * restarts the timer; the default (itself possibly reactive) is read when the
20
- * reset happens, and the ref reads the current default until the first write.
21
- * The pending reset is cancelled when the owning reactive scope stops.
22
- * Without a browser `window` (and without `runOnServer`) no timer starts.
23
- *
24
- * @example
25
- * ```ts
26
- * const message = refAutoReset("", 2_000);
27
- * message.value = "Copied!"; // back to "" after two seconds
28
- * ```
29
- *
30
- * @param defaultValue Reactive value restored after the delay.
31
- * @param afterMs Reactive delay in milliseconds, finite and at least zero.
32
- * @param options Server and scheduler policy.
33
- * @default options {}
34
- * @throws `RangeError` tagged `VIZE_COMPOSE_REF_AUTO_RESET_INVALID_DELAY` for
35
- * invalid delays, synchronously at creation and on every write.
36
- * @returns A writable ref.
37
- */
38
14
  function refAutoReset(defaultValue, afterMs, options = {}) {
39
15
  const scheduler = options.scheduler ?? defaultScheduler;
40
16
  resolveResetMs(toValue(afterMs));
@@ -1,27 +1,5 @@
1
1
  import { useDebounced } from "./use-debounced.mjs";
2
2
  //#region src/ref-debounced.ts
3
- /**
4
- * Readonly ref that follows `source` after it stayed quiet for `waitMs`.
5
- *
6
- * Shorthand for `useDebounced(source, waitMs, options).debounced` when the
7
- * pending flag and cancel/flush controls are not needed. Inherits every rule
8
- * of {@link useDebounced}: synchronous mirroring on the server, reactive
9
- * wait, and scope-bound cleanup.
10
- *
11
- * @example
12
- * ```ts
13
- * const query = ref("");
14
- * const debouncedQuery = refDebounced(query, 300);
15
- * ```
16
- *
17
- * @param source Reactive source.
18
- * @param waitMs Reactive quiet period in milliseconds.
19
- * @param options Server and scheduler policy.
20
- * @default options {}
21
- * @throws `RangeError` tagged `VIZE_COMPOSE_DEBOUNCE_INVALID_WAIT` for invalid
22
- * waits (see {@link useDebounced}).
23
- * @returns The debounced readonly ref.
24
- */
25
3
  function refDebounced(source, waitMs, options = {}) {
26
4
  return useDebounced(source, waitMs, options).debounced;
27
5
  }
@@ -1,26 +1,5 @@
1
1
  import { computed, toValue } from "vue";
2
2
  //#region src/ref-default.ts
3
- /**
4
- * View a nullable ref through a default value.
5
- *
6
- * Reads return the source value, or the (possibly reactive) default while the
7
- * source holds `null` or `undefined`, so the read type drops those members.
8
- * Writes go straight to the source and accept its full type, including
9
- * `null`/`undefined` to fall back to the default again. Pure derived state:
10
- * SSR-safe and nothing to dispose.
11
- *
12
- * @example
13
- * ```ts
14
- * const raw = ref<string | undefined>();
15
- * const name = refDefault(raw, "Anonymous");
16
- * name.value; // "Anonymous"
17
- * name.value = "Ada"; // raw.value === "Ada"
18
- * ```
19
- *
20
- * @param source Writable nullable ref.
21
- * @param defaultValue Reactive fallback.
22
- * @returns A writable computed ref whose reads never yield `null`/`undefined`.
23
- */
24
3
  function refDefault(source, defaultValue) {
25
4
  return computed({
26
5
  get: () => source.value ?? toValue(defaultValue),
@@ -2,24 +2,6 @@ import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { resolveElement, resolveElements } from "./element-target.mjs";
3
3
  import { computed, hasInjectionContext, readonly, ref, shallowRef, toValue, watch, watchPostEffect } from "vue";
4
4
  //#region src/resize-observer.ts
5
- /**
6
- * Observe size changes of one or more reactive elements.
7
- *
8
- * A single observer is (re)created whenever the resolved targets, the box
9
- * option, or the host change; unresolved targets are skipped. The observer is
10
- * disconnected when the owning reactive scope stops or `stop` is called.
11
- * During server rendering no host resolves, `isSupported` stays `false`, and
12
- * the callback never runs.
13
- *
14
- * Inside a component the host is read after mounting, so hydration renders
15
- * the server fallback first and never mismatches.
16
- *
17
- * @param targets Reactive element target or list of targets.
18
- * @param callback Native `ResizeObserver` callback.
19
- * @param options Box model, runtime capability, and watcher timing.
20
- * @default options {}
21
- * @returns Support flag and stop control.
22
- */
23
5
  function useResizeObserver(targets, callback, options = {}) {
24
6
  const isSupported = ref(false);
25
7
  const hydrated = shallowRef(!hasInjectionContext());
@@ -48,19 +30,6 @@ function useResizeObserver(targets, callback, options = {}) {
48
30
  stop
49
31
  };
50
32
  }
51
- /**
52
- * Track the rendered size of a reactive element.
53
- *
54
- * Reads the requested box from `contentBoxSize`/`borderBoxSize` (summing
55
- * fragments) and falls back to `contentRect` for older engines. When the
56
- * target unmounts the size resets to the initial value so stale geometry never
57
- * leaks into the next render. Server renders expose `initialSize`.
58
- *
59
- * @param target Reactive element target.
60
- * @param options Initial size, box model, capability, and watcher timing.
61
- * @default options {}
62
- * @returns Reactive width/height plus observer controls.
63
- */
64
33
  function useElementSize(target, options = {}) {
65
34
  const initial = options.initialSize ?? {
66
35
  width: 0,
package/dist/resolver.mjs CHANGED
@@ -1,22 +1,9 @@
1
- import { t as COMPOSABLE_CATALOG } from "./catalog-BRX-Wg8B.mjs";
1
+ import { t as COMPOSABLE_CATALOG } from "./catalog-CcpCnLjb.mjs";
2
2
  import { readFileSync } from "node:fs";
3
3
  import path from "node:path";
4
4
  //#region src/resolver.ts
5
- /**
6
- * Build-time auto-import resolver for `@vizejs/composable`, driven by the
7
- * package catalog so every new entry is picked up automatically.
8
- *
9
- * Every export resolves to its own subpath (`@vizejs/composable/use-toggle`),
10
- * so auto-imported code tree-shakes exactly like hand-written imports; this
11
- * module runs in Node (Vite/Nuxt config) and never ships to the browser.
12
- * With `source: "local"`, entries pulled by `vize lib pull` (recorded in
13
- * `vize-lib.lock.json`) resolve to the local copies.
14
- */
15
- /** Package that owns the resolvable exports. */
16
5
  const VIZE_COMPOSABLE_PACKAGE = "@vizejs/composable";
17
- /** Subpaths that are tooling, not auto-importable runtime code. */
18
6
  const NON_IMPORTABLE_SUBPATHS = new Set(["./catalog", "./resolver"]);
19
- /** Export name -> owning entry, first catalog entry wins. */
20
7
  function catalogExports() {
21
8
  const exports = /* @__PURE__ */ new Map();
22
9
  for (const entry of COMPOSABLE_CATALOG.entries) {
@@ -31,13 +18,6 @@ function catalogExports() {
31
18
  function isLockfile(value) {
32
19
  return typeof value === "object" && value !== null && "items" in value && Array.isArray(value.items) && value.items.every((item) => typeof item === "object" && item !== null && "name" in item && "kind" in item && "dir" in item && typeof item.name === "string" && typeof item.kind === "string" && typeof item.dir === "string");
33
20
  }
34
- /**
35
- * Read and validate `vize-lib.lock.json`.
36
- *
37
- * @param file Absolute lockfile path.
38
- * @returns The parsed lockfile.
39
- * @throws {Error} `[VIZE_COMPOSE_RESOLVER_LOCKFILE]` when missing or malformed.
40
- */
41
21
  function readComposableLockfile(file) {
42
22
  let parsed;
43
23
  try {
@@ -64,13 +44,6 @@ function createLocator(options) {
64
44
  return path.resolve(root, dir, item.source).split(path.sep).join("/");
65
45
  };
66
46
  }
67
- /**
68
- * Every auto-importable export the options allow, with its direct subpath import.
69
- *
70
- * @param options Filters and source mode.
71
- * @default options {}
72
- * @returns Imports in catalog order.
73
- */
74
47
  function listVizeComposableImports(options = {}) {
75
48
  const locate = createLocator(options);
76
49
  const names = options.names === void 0 ? void 0 : new Set(options.names);
@@ -85,45 +58,15 @@ function listVizeComposableImports(options = {}) {
85
58
  }
86
59
  return imports;
87
60
  }
88
- /**
89
- * `unplugin-auto-import` resolver for every `@vizejs/composable` export.
90
- *
91
- * Server/SSR: build-time only; reads the lockfile once in `local` mode.
92
- *
93
- * @example
94
- * ```ts
95
- * AutoImport({ resolvers: [VizeComposableResolver()] });
96
- * // useToggle() -> import { useToggle } from "@vizejs/composable/use-toggle"
97
- * ```
98
- *
99
- * @param options Filters and source mode.
100
- * @default options {}
101
- * @returns A name -> import resolver function.
102
- */
103
61
  function VizeComposableResolver(options = {}) {
104
62
  const allowed = new Map(listVizeComposableImports(options).map((item) => [item.name, item]));
105
63
  return (name) => allowed.get(name);
106
64
  }
107
- /**
108
- * `unplugin-auto-import` `imports` preset: `{ "@vizejs/composable/use-toggle": ["useToggle"] }`.
109
- *
110
- * @param options Filters and source mode.
111
- * @default options {}
112
- * @returns Export names grouped by module.
113
- */
114
65
  function vizeComposableImports(options = {}) {
115
66
  const grouped = {};
116
67
  for (const { name, from } of listVizeComposableImports(options)) (grouped[from] ??= []).push(name);
117
68
  return grouped;
118
69
  }
119
- /**
120
- * Global declarations for auto-imported composables, for setups without a
121
- * generator (Nuxt and `unplugin-auto-import` emit their own).
122
- *
123
- * @param options Filters and source mode.
124
- * @default options {}
125
- * @returns A `.d.ts` module declaring each export as a global.
126
- */
127
70
  function createVizeComposableDeclarations(options = {}) {
128
71
  return [
129
72
  "// Generated by @vizejs/composable/resolver. Do not edit.",
@@ -1,31 +1,6 @@
1
1
  import { timeoutAbortSignal } from "./abort-signal.mjs";
2
2
  import { calculateRetryDelay } from "./retry-delay.mjs";
3
3
  //#region src/retry-async.ts
4
- /**
5
- * Execute an operation with bounded, abortable retries and deterministic delay policy.
6
- *
7
- * Synchronous throws and asynchronous rejections follow the same path. A
8
- * successful value is returned unchanged. Exhaustion rejects with the final
9
- * operation error, a negative retry decision rejects with the error that was
10
- * evaluated, and cancellation rejects with the signal's exact reason. These
11
- * values are deliberately not wrapped.
12
- *
13
- * Cancellation races every asynchronous stage, so callers are not forced to
14
- * wait for an operation or hook that ignores its signal. Late settlements are
15
- * still observed internally and cannot become unhandled rejections. Backoff
16
- * options and entropy are evaluated lazily only after a failure is approved
17
- * for retry.
18
- *
19
- * @typeParam Value Value produced by the operation.
20
- * @param operation Work to invoke with a one-based attempt and shared signal.
21
- * @param options Retry count, cancellation, policy, hooks, and delay options.
22
- * @default options {}
23
- * @throws {RangeError} A tagged error when `maximumRetries` or inherited delay
24
- * options are outside their documented ranges.
25
- * @throws {TypeError} A tagged error when `options` is not an object, a
26
- * callback is not callable, or a retry decision does not resolve to a boolean.
27
- * @returns The first successful operation value.
28
- */
29
4
  async function retryAsync(operation, options = {}) {
30
5
  if (typeof operation !== "function") throw new TypeError(`[VIZE_COMPOSE_RETRY_INVALID_OPERATION] operation must be a function; received ${typeof operation}`);
31
6
  if (options === null || typeof options !== "object") throw new TypeError(`[VIZE_COMPOSE_RETRY_INVALID_OPTIONS] options must be an object; received ${options === null ? "null" : typeof options}`);