@vizejs/composable 0.810.0 → 0.811.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
@@ -8,19 +8,6 @@ const defaultScheduler = {
8
8
  globalThis.clearTimeout(handle);
9
9
  }
10
10
  };
11
- /**
12
- * Track whether the pointer hovers an element.
13
- *
14
- * Uses `pointerenter`/`pointerleave` (which ignore descendants) with optional
15
- * enter/leave delays; a pending delay is cancelled by the opposite event.
16
- * Server renders report `false`; listeners and timers are released with the
17
- * owning reactive scope.
18
- *
19
- * @param target Reactive element target.
20
- * @param options Enter/leave delays and timer scheduler.
21
- * @default options {}
22
- * @returns Readonly hover flag.
23
- */
24
11
  function useElementHover(target, options = {}) {
25
12
  const { delayEnter = 0, delayLeave = 0, scheduler = defaultScheduler } = options;
26
13
  const hovered = ref(false);
@@ -1,29 +1,8 @@
1
1
  import { toValue } from "vue";
2
2
  //#region src/element-target.ts
3
- /**
4
- * Whether a value is a DOM element node.
5
- *
6
- * Uses the `nodeType` contract instead of `instanceof Element`, so the check
7
- * reads no browser globals and works across realms (iframes, happy-dom,
8
- * jsdom).
9
- *
10
- * @param value Candidate value.
11
- * @returns Whether `value` is an element node.
12
- */
13
3
  function isElementNode(value) {
14
4
  return typeof value === "object" && value !== null && "nodeType" in value && value.nodeType === 1 && "getBoundingClientRect" in value;
15
5
  }
16
- /**
17
- * Resolve a reactive element target to its concrete element.
18
- *
19
- * Reads the reactive source once (tracking it when called inside an effect).
20
- * Component instances resolve to their root element; fragment or text roots
21
- * resolve to `null`. Never throws and reads no browser globals, so it is safe
22
- * during server rendering, where it always returns `null`.
23
- *
24
- * @param target Reactive element target.
25
- * @returns The resolved element, or `null` while unresolved.
26
- */
27
6
  function resolveElement(target) {
28
7
  return elementFromValue(toValue(target));
29
8
  }
@@ -35,15 +14,6 @@ function elementFromValue(value) {
35
14
  }
36
15
  return null;
37
16
  }
38
- /**
39
- * Resolve a reactive list (or single) element target to its concrete elements.
40
- *
41
- * Unresolved entries are dropped and duplicates are removed while keeping the
42
- * first-seen order, so observers never register the same node twice.
43
- *
44
- * @param targets Reactive element target or target list.
45
- * @returns The resolved, de-duplicated elements.
46
- */
47
17
  function resolveElements(targets) {
48
18
  const value = toValue(targets);
49
19
  const items = Array.isArray(value) ? value : [value];
package/dist/focus.mjs CHANGED
@@ -2,19 +2,6 @@ import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { resolveElement } from "./element-target.mjs";
3
3
  import { computed, readonly, ref, watch } from "vue";
4
4
  //#region src/focus.ts
5
- /**
6
- * Track and control focus of a single element.
7
- *
8
- * Listens for `focus`/`blur` on the resolved element and re-syncs when the
9
- * target changes. Assigning `focused` calls `focus()`/`blur()`. Server renders
10
- * always report `false`; `initialValue` is applied only after the element
11
- * resolves on the client, so hydration output is unaffected.
12
- *
13
- * @param target Reactive element target.
14
- * @param options Initial focus, focus-visible filtering, and scroll behavior.
15
- * @default options {}
16
- * @returns Writable focus ref and stop control.
17
- */
18
5
  function useFocus(target, options = {}) {
19
6
  const inner = ref(false);
20
7
  const element = computed(() => {
@@ -64,16 +51,6 @@ function useFocus(target, options = {}) {
64
51
  stop
65
52
  };
66
53
  }
67
- /**
68
- * Track whether focus is inside an element (the `:focus-within` state).
69
- *
70
- * Uses bubbling `focusin`/`focusout` and checks the `relatedTarget` so moving
71
- * focus between descendants never flickers to `false`. Server renders report
72
- * `false`.
73
- *
74
- * @param target Reactive element target.
75
- * @returns Readonly focus-within ref and stop control.
76
- */
77
54
  function useFocusWithin(target) {
78
55
  const focused = ref(false);
79
56
  const stopWatch = watch(() => resolveElement(target), (el, _previous, onCleanup) => {
package/dist/fps.mjs CHANGED
@@ -1,18 +1,6 @@
1
1
  import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { hasInjectionContext, onMounted, readonly, ref, shallowRef, toValue, watch } from "vue";
3
3
  //#region src/fps.ts
4
- /**
5
- * Measure the rendering frame rate with `requestAnimationFrame`.
6
- *
7
- * Uses the frame timestamps passed to the callback (no extra clock) and
8
- * publishes a rounded average every `every` frames. No frames are requested
9
- * during server rendering (`fps` stays `0`), and the pending frame is
10
- * cancelled when paused or when the owning reactive scope stops.
11
- *
12
- * @param options Averaging window, start mode, and frame capability.
13
- * @default options {}
14
- * @returns Reactive frame rate plus pause/resume controls.
15
- */
16
4
  function useFps(options = {}) {
17
5
  const every = Math.max(1, Math.floor(options.every ?? 10));
18
6
  const fps = ref(0);
@@ -4,20 +4,6 @@ import { computed, hasInjectionContext, onMounted, readonly, ref, shallowRef, to
4
4
  //#region src/geolocation.ts
5
5
  const PERMISSION_DENIED = 1;
6
6
  const POSITION_UNAVAILABLE = 2;
7
- /**
8
- * Watch the device position with the Geolocation API.
9
- *
10
- * The watch follows the reactive host and is cleared when paused or when the
11
- * owning reactive scope stops. Coordinates are copied into a plain snapshot
12
- * so they are serializable. The `capability` result reports
13
- * `"unsupported"`, `"permission-denied"`, `"unavailable"`, or `"not-ready"`
14
- * (before the first fix) as data instead of throwing. Server renders expose
15
- * `null` coordinates.
16
- *
17
- * @param options Accuracy, caching, start mode, and navigator capability.
18
- * @default options {}
19
- * @returns Reactive position, error, capability, and controls.
20
- */
21
7
  function useGeolocation(options = {}) {
22
8
  const isSupported = ref(false);
23
9
  const coords = shallowRef(null);
package/dist/i18n.mjs CHANGED
@@ -2,48 +2,10 @@ import { createMessageFormatter } from "./icu-message.mjs";
2
2
  import { useLocale } from "./locale.mjs";
3
3
  import { computed, inject, shallowReactive, shallowRef } from "vue";
4
4
  //#region src/i18n.ts
5
- /**
6
- * Declare typed message catalogs for several locales.
7
- *
8
- * The literal messages are preserved, so {@link MessageParamsFor} knows the
9
- * ICU parameters of every key. The compiler rejects catalogs whose locales
10
- * do not share the same keys (`__missingTranslations`) or whose
11
- * translations need incompatible parameter types (`__incompatibleParams`).
12
- * Returns the catalogs unchanged; the function exists for inference and
13
- * validation only.
14
- *
15
- * @example
16
- * ```ts
17
- * const messages = defineMessages({
18
- * en: { cart: "{count, plural, one {# item} other {# items}}" },
19
- * ja: { cart: "{count, plural, other {# 個}}" },
20
- * });
21
- * ```
22
- *
23
- * @param catalogs Messages keyed by locale, then by (nested) key.
24
- * @throws `TypeError` tagged `VIZE_COMPOSE_I18N_INVALID_KEY` when a key
25
- * contains a dot (dots separate nested keys).
26
- * @returns The same catalogs.
27
- */
28
5
  function defineMessages(catalogs) {
29
6
  for (const tree of Object.values(catalogs)) assertKeys(tree, "");
30
7
  return catalogs;
31
8
  }
32
- /**
33
- * Declare one additional locale (typically a lazily loaded module) against
34
- * the catalogs produced by {@link defineMessages}.
35
- *
36
- * The keys must match exactly, and every translation may only use
37
- * parameters the schema declares, with compatible types.
38
- *
39
- * @example
40
- * ```ts
41
- * // fr.ts
42
- * export default defineLocale<typeof messages>()({ cart: "{count, plural, one {# article} other {# articles}}" });
43
- * ```
44
- *
45
- * @returns A function that validates and returns the locale catalog.
46
- */
47
9
  function defineLocale() {
48
10
  return (catalog) => {
49
11
  assertKeys(catalog, "");
@@ -67,40 +29,6 @@ function readMessage(tree, key) {
67
29
  function unwrapModule(loaded) {
68
30
  return typeof loaded === "object" && loaded !== null && "default" in loaded ? loaded.default : loaded;
69
31
  }
70
- /**
71
- * Define the typed i18n setup of an application.
72
- *
73
- * The definition holds only static configuration (catalogs, loaders,
74
- * formats) and an injection key; it has no mutable module state. Call
75
- * `create()` per request on the server and once on the client, install the
76
- * instance with `app.use(instance)`, and read it in components with
77
- * `definition.use()` (or {@link useI18n}). Locale changes are reactive
78
- * through `setLocale`, which loads lazy locales first; `Intl` formatting
79
- * follows the locale through the existing `useLocale` composable.
80
- *
81
- * Hydration: locale detection is never automatic. Resolve the locale per
82
- * request, pass it to `create({ locale })` on both sides, and await
83
- * `instance.ready` before rendering or mounting when it is lazy.
84
- * `date`/`time` arguments use a fixed time zone (UTC unless configured).
85
- *
86
- * @example
87
- * ```ts
88
- * export const appI18n = defineI18n({
89
- * messages,
90
- * loaders: { fr: () => import("./locales/fr.ts") },
91
- * });
92
- * // per request / client entry
93
- * const i18n = appI18n.create({ locale: "fr" });
94
- * await i18n.ready;
95
- * app.use(i18n);
96
- * // component
97
- * const { t } = appI18n.use();
98
- * t("cart", { count: 2 });
99
- * ```
100
- *
101
- * @param options Catalogs, fallback, loaders, formats, and missing-key hook.
102
- * @returns The i18n definition.
103
- */
104
32
  function defineI18n(options) {
105
33
  const key = Symbol("vize-i18n");
106
34
  const eager = Object.keys(options.messages);
@@ -194,20 +122,6 @@ function defineI18n(options) {
194
122
  use
195
123
  };
196
124
  }
197
- /**
198
- * Inject the i18n instance of a definition. Equivalent to
199
- * `definition.use()`; must run inside `setup` (or `app.runWithContext`).
200
- *
201
- * @example
202
- * ```ts
203
- * const { t, setLocale } = useI18n(appI18n);
204
- * ```
205
- *
206
- * @param definition Result of {@link defineI18n}.
207
- * @throws `Error` tagged `VIZE_COMPOSE_I18N_NOT_PROVIDED` when no instance
208
- * was provided.
209
- * @returns The typed instance.
210
- */
211
125
  function useI18n(definition) {
212
126
  return definition.use();
213
127
  }
@@ -11,24 +11,6 @@ const quoteStarters = new Set([
11
11
  "#",
12
12
  "|"
13
13
  ]);
14
- /**
15
- * Parse an ICU MessageFormat string into an AST.
16
- *
17
- * Supports simple arguments, `number`/`date`/`time` with an optional style,
18
- * `plural` and `selectordinal` (with `offset:` and `=N` cases), `select`,
19
- * nesting, `#` inside plural cases, and apostrophe quoting (`''` is a
20
- * literal apostrophe; `'{…}'` is literal text). Pure and deterministic.
21
- *
22
- * @example
23
- * ```ts
24
- * parseMessage("{n, plural, one {# item} other {# items}}");
25
- * ```
26
- *
27
- * @param message ICU message source.
28
- * @throws {@link MessageSyntaxError} tagged `VIZE_COMPOSE_ICU_SYNTAX` for
29
- * malformed messages, including a plural or select without an `other` case.
30
- * @returns The parsed nodes.
31
- */
32
14
  function parseMessage(message) {
33
15
  let position = 0;
34
16
  const skipSpace = () => {
@@ -199,30 +181,11 @@ function dateTimeOptions(kind, style, named) {
199
181
  const value = resolved === "short" || resolved === "long" || resolved === "full" ? resolved : "medium";
200
182
  return kind === "date" ? { dateStyle: value } : { timeStyle: value };
201
183
  }
202
- /** Stringify an argument value; plain objects use JSON rather than `[object Object]`. */
203
184
  function stringify(value) {
204
185
  if (typeof value === "string") return value;
205
186
  if (typeof value === "bigint" || typeof value === "boolean" || typeof value === "symbol") return value.toString();
206
187
  return typeof value === "function" ? "[function]" : JSON.stringify(value);
207
188
  }
208
- /**
209
- * Create a caching formatter for one locale.
210
- *
211
- * Parsed messages and `Intl` formatters are cached inside the returned
212
- * object only (no module state), so one formatter per request or per
213
- * i18n instance keeps server rendering isolated.
214
- *
215
- * @example
216
- * ```ts
217
- * const formatter = createMessageFormatter("en");
218
- * formatter.format("{n, plural, one {# file} other {# files}}", { n: 3 }); // "3 files"
219
- * ```
220
- *
221
- * @param locale BCP 47 locale.
222
- * @param options Time zone and named formats.
223
- * @default options {}
224
- * @returns The formatter.
225
- */
226
189
  function createMessageFormatter(locale, options = {}) {
227
190
  const timeZone = options.timeZone ?? "UTC";
228
191
  const numberFormats = options.numberFormats ?? {};
@@ -315,27 +278,6 @@ function createMessageFormatter(locale, options = {}) {
315
278
  }
316
279
  };
317
280
  }
318
- /**
319
- * Format one ICU message with typed parameters.
320
- *
321
- * Parameters are checked against the message literal at compile time via
322
- * {@link MessageParams}. For repeated formatting prefer
323
- * {@link createMessageFormatter}, which caches parsing and `Intl` objects.
324
- * Deterministic: `date`/`time` arguments use `timeZone` (UTC by default).
325
- *
326
- * @example
327
- * ```ts
328
- * formatMessage("en", "Hello {name}!", { name: "Ada" }); // "Hello Ada!"
329
- * ```
330
- *
331
- * @param locale BCP 47 locale.
332
- * @param message ICU message.
333
- * @param params Values for the message's arguments.
334
- * @param options Time zone and named formats.
335
- * @default options {}
336
- * @throws {@link MessageSyntaxError} for malformed messages.
337
- * @returns The formatted string.
338
- */
339
281
  function formatMessage(locale, message, params, options = {}) {
340
282
  return createMessageFormatter(locale, options).format(message, params);
341
283
  }
package/dist/idle.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { hasInjectionContext, onMounted, readonly, ref, shallowRef, toValue, watch } from "vue";
3
3
  //#region src/idle.ts
4
- /** Default activity events. */
5
4
  const DEFAULT_IDLE_EVENTS = [
6
5
  "mousemove",
7
6
  "mousedown",
@@ -16,21 +15,6 @@ const defaultScheduler = {
16
15
  globalThis.clearTimeout(handle);
17
16
  }
18
17
  };
19
- /**
20
- * Detect user inactivity.
21
- *
22
- * Any configured activity event resets a single timer; when it fires, `idle`
23
- * becomes `true` until the next activity. No timer runs during server
24
- * rendering (`idle` is `initialState`, `lastActive` is `null`), so the
25
- * output is hydration-stable. Listeners and the timer are released with the
26
- * owning reactive scope.
27
- *
28
- * @param timeout Inactivity window in milliseconds.
29
- * @param options Activity events, clock, scheduler, and window capability.
30
- * @default timeout 60000
31
- * @default options {}
32
- * @returns Reactive idle flag, last activity time, and a reset action.
33
- */
34
18
  function useIdle(timeout = 6e4, options = {}) {
35
19
  const { events = DEFAULT_IDLE_EVENTS, listenForVisibilityChange = true, initialState = false, now = Date.now, scheduler = defaultScheduler } = options;
36
20
  const idle = ref(initialState);
package/dist/index.mjs CHANGED
@@ -17,7 +17,7 @@ import { useBattery } from "./battery.mjs";
17
17
  import { useMediaQuery, useReducedMotion } from "./media-query.mjs";
18
18
  import { breakpointsBootstrapV5, breakpointsTailwind, toPixels, useBreakpoints } from "./breakpoints.mjs";
19
19
  import { availableCapability, isCapabilityAvailable, isCapabilityUnavailable, unavailableCapability } from "./capability.mjs";
20
- import { t as COMPOSABLE_CATALOG } from "./catalog-BRX-Wg8B.mjs";
20
+ import { t as COMPOSABLE_CATALOG } from "./catalog-CcpCnLjb.mjs";
21
21
  import { useColorMode, useDark } from "./color-mode.mjs";
22
22
  import { requestMotionPermission, useDeviceOrientation } from "./device-orientation.mjs";
23
23
  import { useDeviceMotion } from "./device-motion.mjs";
@@ -107,7 +107,7 @@ import { useFetch } from "./use-fetch.mjs";
107
107
  import { useField } from "./use-field.mjs";
108
108
  import { useFileDialog } from "./use-file-dialog.mjs";
109
109
  import { useFileSystemAccess } from "./use-file-system-access.mjs";
110
- import { t as useForm } from "./use-form-A4j_h14D.mjs";
110
+ import { t as useForm } from "./use-form-BZqwMs6k.mjs";
111
111
  import { formFieldId, toFormFieldErrors, useFormErrorSummaryFields, useFormFieldProps } from "./use-form-field-props.mjs";
112
112
  import { useFullscreen } from "./use-fullscreen.mjs";
113
113
  import { mapGamepad, snapshotGamepad, standardGamepadAxes, standardGamepadButtons, useGamepad } from "./use-gamepad.mjs";
@@ -2,22 +2,6 @@ import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { useScroll } from "./scroll.mjs";
3
3
  import { nextTick, readonly, ref, toValue, watch } from "vue";
4
4
  //#region src/infinite-scroll.ts
5
- /**
6
- * Load more content when a scroll container reaches an edge.
7
- *
8
- * Built on `useScroll`: when the configured edge is within `distance`,
9
- * `onLoadMore` runs; concurrent calls are prevented, and after each load the
10
- * edge is re-measured so short pages keep loading until the container
11
- * overflows or `canLoadMore` returns `false`. Loader errors propagate to the
12
- * returned promise of the internal run but never leave `isLoading` stuck.
13
- * No loading happens during server rendering.
14
- *
15
- * @param target Reactive scroll container (element, component, or window).
16
- * @param onLoadMore Loader invoked at the edge.
17
- * @param options Edge, distance, gating, and {@link useScroll} options.
18
- * @default options {}
19
- * @returns Loading flag and a manual re-check.
20
- */
21
5
  function useInfiniteScroll(target, onLoadMore, options = {}) {
22
6
  const { distance = 0, direction = "bottom", canLoadMore = true, ...scrollOptions } = options;
23
7
  const isLoading = ref(false);
@@ -2,21 +2,6 @@ import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { resolveElement, resolveElements } from "./element-target.mjs";
3
3
  import { hasInjectionContext, onMounted, readonly, ref, shallowRef, toValue, watch } from "vue";
4
4
  //#region src/intersection-observer.ts
5
- /**
6
- * Observe the intersection of reactive elements with a root.
7
- *
8
- * One observer is created per combination of resolved targets, root,
9
- * margin, and threshold; changing any of them disconnects the previous
10
- * observer first. During server rendering `isSupported` is `false` and the
11
- * callback never runs. The observer is disconnected when the owning scope
12
- * stops.
13
- *
14
- * @param targets Reactive element target or list of targets.
15
- * @param callback Native `IntersectionObserver` callback.
16
- * @param options Root, margin, thresholds, capability, and timing.
17
- * @default options {}
18
- * @returns Support/activity flags and pause/resume/stop controls.
19
- */
20
5
  function useIntersectionObserver(targets, callback, options = {}) {
21
6
  const isSupported = ref(false);
22
7
  const isActive = ref(options.immediate ?? true);
@@ -75,18 +60,6 @@ function useIntersectionObserver(targets, callback, options = {}) {
75
60
  stop
76
61
  };
77
62
  }
78
- /**
79
- * Track whether an element is visible inside the viewport (or a root).
80
- *
81
- * Uses the latest intersection entry, so rapid enter/leave sequences settle
82
- * on the final state. With `once`, the observer disconnects after the first
83
- * visible entry and `isVisible` stays `true`.
84
- *
85
- * @param target Reactive element target.
86
- * @param options Initial value, one-shot mode, and observer options.
87
- * @default options {}
88
- * @returns Reactive visibility plus controls.
89
- */
90
63
  function useElementVisibility(target, options = {}) {
91
64
  const isVisible = ref(options.initialValue ?? false);
92
65
  const controls = useIntersectionObserver(target, (entries) => {
package/dist/locale.mjs CHANGED
@@ -1,26 +1,6 @@
1
1
  import { computed, toValue } from "vue";
2
2
  //#region src/locale.ts
3
3
  const FORMATTER_CACHE_LIMIT = 32;
4
- /**
5
- * Create reactive locale metadata and platform-native formatter factories.
6
- *
7
- * Equivalent formatter options reuse instances. The bounded cache follows the
8
- * active locale automatically and prevents repeated constructor overhead in
9
- * reactive render paths.
10
- *
11
- * Detection is lazy and guarded: the default detector reads
12
- * `navigator.language` behind a `typeof` check at call time, so importing and
13
- * calling this during server rendering is safe, and runtimes without a
14
- * `navigator` resolve to the fallback locale. The composable owns no timers
15
- * or listeners, so no scope cleanup is required.
16
- *
17
- * @param source Reactive locale source. Empty values defer to the detector.
18
- * @param options Detection and fallback behavior.
19
- * @default options {}
20
- * @throws `RangeError` on first read of the reactive values when the winning
21
- * candidate is not a structurally valid locale identifier.
22
- * @returns Reactive locale metadata and cached formatter factories.
23
- */
24
4
  function useLocale(source, options = {}) {
25
5
  const locale = computed(() => {
26
6
  const candidate = (source === void 0 ? void 0 : toValue(source)) ?? (options.detect ?? detectBrowserLocale)() ?? options.fallback ?? "en";
@@ -1,7 +1,6 @@
1
1
  import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { computed, reactive, readonly, ref, toValue, watch } from "vue";
3
3
  //#region src/magic-keys.ts
4
- /** Default aliases resolved before matching combos. */
5
4
  const DEFAULT_KEY_ALIASES = {
6
5
  ctrl: "control",
7
6
  command: "meta",
@@ -21,32 +20,10 @@ const modifierNames = new Set([
21
20
  "alt",
22
21
  "meta"
23
22
  ]);
24
- /**
25
- * Normalize a key name the way combos are matched.
26
- *
27
- * @param name Raw `KeyboardEvent.key`/`code` or combo segment.
28
- * @param aliases Alias table (keys lowercased).
29
- * @default aliases DEFAULT_KEY_ALIASES
30
- * @returns Lowercase, alias-resolved name.
31
- */
32
23
  function normalizeKeyName(name, aliases = DEFAULT_KEY_ALIASES) {
33
24
  const lower = name.toLowerCase();
34
25
  return (aliases[lower] ?? lower).toLowerCase();
35
26
  }
36
- /**
37
- * Track pressed keys and expose reactive key combos.
38
- *
39
- * Both `event.key` and `event.code` are recorded (lowercased), so `"a"` and
40
- * `"keya"` both match. Because some platforms (notably macOS with `meta`)
41
- * swallow `keyup` for other keys while a modifier is held, releasing a
42
- * modifier clears every non-modifier key; losing window focus clears
43
- * everything. Nothing is pressed during server rendering, and listeners are
44
- * removed with the owning reactive scope.
45
- *
46
- * @param options Target, passivity, aliases, and event hook.
47
- * @default options {}
48
- * @returns Pressed set, lazily created combo refs, and controls.
49
- */
50
27
  function useMagicKeys(options = {}) {
51
28
  const aliases = { ...DEFAULT_KEY_ALIASES };
52
29
  for (const [alias, key] of Object.entries(options.aliasMap ?? {})) aliases[alias.toLowerCase()] = key.toLowerCase();
@@ -105,18 +82,6 @@ function useMagicKeys(options = {}) {
105
82
  reset
106
83
  };
107
84
  }
108
- /**
109
- * Track whether any key matching a filter is held down.
110
- *
111
- * String filters are normalized like combos (`"esc"` matches `Escape`) and
112
- * compared against both `event.key` and `event.code`. The state resets on
113
- * window blur and during server rendering is always `false`.
114
- *
115
- * @param filter Key name(s) or predicate.
116
- * @param options Target and passivity.
117
- * @default options {}
118
- * @returns Readonly ref that is `true` while a matching key is held.
119
- */
120
85
  function useKeyPressed(filter, options = {}) {
121
86
  const held = /* @__PURE__ */ new Set();
122
87
  const pressed = ref(false);
package/dist/math.mjs CHANGED
@@ -19,29 +19,10 @@ function useClamp(value, min, max) {
19
19
  }
20
20
  });
21
21
  }
22
- /** Multiply by `10 ** places` exactly, by editing the decimal exponent. */
23
22
  function shiftExponent(value, places) {
24
23
  const [mantissa, exponent = "0"] = String(value).split("e");
25
24
  return Number(`${mantissa}e${Number(exponent) + places}`);
26
25
  }
27
- /**
28
- * Reactive rounding with decimal precision.
29
- *
30
- * Uses exponent shifting instead of multiplying by powers of ten, so values
31
- * such as `1.005` round to `1.01` at two decimals. Pure derived state.
32
- *
33
- * @example
34
- * ```ts
35
- * const price = useRound(rawPrice, { precision: 2 });
36
- * ```
37
- *
38
- * @param value Reactive number.
39
- * @param options Precision and method.
40
- * @default options {}
41
- * @throws `RangeError` tagged `VIZE_COMPOSE_MATH_INVALID_PRECISION` on read
42
- * when the precision is not an integer.
43
- * @returns Computed rounded number.
44
- */
45
26
  function useRound(value, options = {}) {
46
27
  return computed(() => {
47
28
  const precision = toValue(options.precision ?? 0);
@@ -52,24 +33,6 @@ function useRound(value, options = {}) {
52
33
  return shiftExponent(round(shiftExponent(number, precision)), -precision);
53
34
  });
54
35
  }
55
- /**
56
- * Linearly map a value from one domain to another.
57
- *
58
- * Domains are reactive tuples and may be reversed (`[100, 0]`). A degenerate
59
- * source domain maps everything to the target start. Pure derived state.
60
- *
61
- * @example
62
- * ```ts
63
- * const percent = useProjection(scrollY, () => [0, maxScroll.value], [0, 100], { clamp: true });
64
- * ```
65
- *
66
- * @param value Reactive number in the source domain.
67
- * @param from Reactive source domain.
68
- * @param to Reactive target domain.
69
- * @param options Clamping.
70
- * @default options {}
71
- * @returns Computed projected number.
72
- */
73
36
  function useProjection(value, from, to, options = {}) {
74
37
  return computed(() => {
75
38
  const [fromStart, fromEnd] = toValue(from);
@@ -1,23 +1,5 @@
1
1
  import { computed, hasInjectionContext, readonly, ref, toValue, watchEffect } from "vue";
2
2
  //#region src/media-query.ts
3
- /**
4
- * Evaluate a reactive media query without requiring browser globals.
5
- *
6
- * During server rendering (or whenever no capability host resolves) the ref
7
- * holds the configured server value and no subscription is created. Inside a
8
- * component the first match is read after mounting, so hydration renders the
9
- * server value first and never mismatches. The
10
- * change subscription follows the reactive query and host: each
11
- * re-evaluation removes the previous listener, and the final listener is
12
- * removed when the owning reactive scope stops. Call inside an active scope
13
- * so the subscription is released. A host whose matcher throws propagates
14
- * the error to the active effect run; the browser default never throws.
15
- *
16
- * @param query Reactive media-query source.
17
- * @param options Runtime capability and server-rendered fallback.
18
- * @default options {}
19
- * @returns Readonly ref that is `true` while the query matches.
20
- */
21
3
  function useMediaQuery(query, options = {}) {
22
4
  const matches = ref(options.ssrValue ?? false);
23
5
  watchEffect((onCleanup) => {
@@ -36,17 +18,6 @@ function useMediaQuery(query, options = {}) {
36
18
  }, { flush: hasInjectionContext() ? "post" : "pre" });
37
19
  return readonly(matches);
38
20
  }
39
- /**
40
- * Return the reactive user motion preference.
41
- *
42
- * Shares {@link useMediaQuery} semantics: during server rendering the
43
- * preference is `"no-preference"` unless `ssrValue` is `true`, and the
44
- * underlying subscription is removed when the owning reactive scope stops.
45
- *
46
- * @param options Runtime capability and server-rendered fallback.
47
- * @default options {}
48
- * @returns Computed preference for `(prefers-reduced-motion: reduce)`.
49
- */
50
21
  function useReducedMotion(options = {}) {
51
22
  const reduced = useMediaQuery("(prefers-reduced-motion: reduce)", options);
52
23
  return computed(() => reduced.value ? "reduce" : "no-preference");
@@ -3,18 +3,6 @@ import { resolveElement } from "./element-target.mjs";
3
3
  import { useMouse } from "./mouse.mjs";
4
4
  import { computed, readonly, ref, watch } from "vue";
5
5
  //#region src/mouse-in-element.ts
6
- /**
7
- * Track the pointer position relative to an element.
8
- *
9
- * Built on {@link useMouse} in client coordinates: every move re-reads the
10
- * element rectangle, so transforms and scrolling are reflected. Server
11
- * renders report zero geometry and `isOutside: true`.
12
- *
13
- * @param target Reactive element target.
14
- * @param options Outside handling plus {@link useMouse} options.
15
- * @default options {}
16
- * @returns Pointer, element-relative, and geometry refs.
17
- */
18
6
  function useMouseInElement(target, options = {}) {
19
7
  const handleOutside = options.handleOutside ?? true;
20
8
  const mouse = useMouse({
package/dist/mouse.mjs CHANGED
@@ -1,18 +1,6 @@
1
1
  import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { readonly, ref, toValue, watch } from "vue";
3
3
  //#region src/mouse.ts
4
- /**
5
- * Track the mouse (and optionally touch) position.
6
- *
7
- * Listens passively for `mousemove`, `dragover`, and touch events on the
8
- * target; listeners follow the reactive target and are removed with the
9
- * owning reactive scope. Server renders expose `initialValue` with a `null`
10
- * source type.
11
- *
12
- * @param options Coordinate space, target, touch handling, and initial value.
13
- * @default options {}
14
- * @returns Reactive coordinates and input source.
15
- */
16
4
  function useMouse(options = {}) {
17
5
  const { touch = true, resetOnTouchEnds = false } = options;
18
6
  const initial = options.initialValue ?? {