@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
@@ -1,27 +1,4 @@
1
1
  //#region src/retry-delay.ts
2
- /**
3
- * Calculate a bounded exponential-backoff delay for a one-based retry.
4
- *
5
- * The first retry is `retryAttempt = 1`. The result is always an integer from
6
- * zero through `2_147_483_647`, making it safe to pass to common host timer
7
- * APIs without implementation-specific clamping. The calculation is pure
8
- * unless jitter requires the supplied entropy source, and it performs no work
9
- * when the module is imported.
10
- *
11
- * Jitter samples uniformly from the inclusive integer range
12
- * `ceil(cappedDelay * (1 - jitterRatio))...cappedDelay`. Capping occurs before
13
- * jitter, so neither floating-point overflow nor entropy can exceed the
14
- * configured maximum.
15
- *
16
- * @param retryAttempt One-based retry number after a failed initial attempt.
17
- * @param options Backoff, cap, jitter, and entropy configuration.
18
- * @default options {}
19
- * @throws {RangeError} A tagged error when the retry number, delay options, or
20
- * entropy value is outside its documented range.
21
- * @throws {TypeError} A tagged error when `options` is not an object or
22
- * `random` is not callable.
23
- * @returns An integer delay in milliseconds.
24
- */
25
2
  function calculateRetryDelay(retryAttempt, options = {}) {
26
3
  if (!Number.isSafeInteger(retryAttempt) || retryAttempt < 1) throw new RangeError(`[VIZE_COMPOSE_RETRY_INVALID_ATTEMPT] retryAttempt must be a positive safe integer; received ${String(retryAttempt)}`);
27
4
  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}`);
package/dist/scope.mjs CHANGED
@@ -1,19 +1,5 @@
1
1
  import { getCurrentScope, onScopeDispose } from "vue";
2
2
  //#region src/scope.ts
3
- /**
4
- * Register cleanup in the active reactive scope when one exists.
5
- *
6
- * This is the shared lifecycle primitive of the package: composables hand
7
- * their teardown here so owned resources are released when the surrounding
8
- * scope stops.
9
- *
10
- * Never throws and is safe during server rendering; no browser globals are
11
- * read. When no scope is active the cleanup is not registered and disposal
12
- * ownership stays with the caller.
13
- *
14
- * @param cleanup Cleanup invoked exactly once when the scope is disposed.
15
- * @returns Whether the cleanup was registered.
16
- */
17
3
  function tryOnScopeDispose(cleanup) {
18
4
  if (!getCurrentScope()) return false;
19
5
  onScopeDispose(cleanup);
@@ -1,21 +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/screen-orientation.ts
4
- /**
5
- * Track the screen orientation.
6
- *
7
- * Server renders expose `ssrOrientation` with angle `0`. The `change`
8
- * listener follows the reactive host and is removed with the owning scope.
9
- * Lock failures (not fullscreen, unsupported) resolve `false` instead of
10
- * throwing.
11
- *
12
- * Inside a component the host is read after mounting, so hydration renders
13
- * the server fallback first and never mismatches.
14
- *
15
- * @param options Server fallback and window capability.
16
- * @default options {}
17
- * @returns Reactive orientation plus lock actions.
18
- */
19
4
  function useScreenOrientation(options = {}) {
20
5
  const fallback = options.ssrOrientation ?? "portrait-primary";
21
6
  const isSupported = ref(false);
@@ -2,20 +2,6 @@ import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { resolveElement } from "./element-target.mjs";
3
3
  import { computed, ref, watch } from "vue";
4
4
  //#region src/scroll-lock.ts
5
- /**
6
- * Lock scrolling of a single element by toggling `overflow: hidden`.
7
- *
8
- * The element's previous inline `overflow` is restored on unlock, target
9
- * change, and scope disposal. This is intentionally element-scoped: for the
10
- * document viewport (nested lock stacking, scrollbar-gap compensation,
11
- * scroll restoration) use `createScrollLock` from `@vizejs/ui/scroll-lock`.
12
- * Server renders never touch styles and report the requested initial value.
13
- *
14
- * @param target Reactive element target.
15
- * @param options Initial state and touch handling.
16
- * @default options {}
17
- * @returns Writable locked flag.
18
- */
19
5
  function useScrollLock(target, options = {}) {
20
6
  const locked = ref(options.initialValue ?? false);
21
7
  const preventTouchMove = options.preventTouchMove ?? true;
package/dist/scroll.mjs CHANGED
@@ -8,23 +8,6 @@ const defaultScheduler = {
8
8
  globalThis.clearTimeout(handle);
9
9
  }
10
10
  };
11
- /**
12
- * Track the scroll offset, edges, and direction of an element or window.
13
- *
14
- * During server rendering (or while the target is unresolved) offsets are `0`,
15
- * the top/left edges report arrived, and the bottom/right edges do not —
16
- * matching an unscrolled page, so hydration is stable. The scroll listener is
17
- * passive and removed together with the idle timer when the owning reactive
18
- * scope stops.
19
- *
20
- * Inside a component the host is read after mounting, so hydration renders
21
- * the server fallback first and never mismatches.
22
- *
23
- * @param target Reactive element, component, or window-like target.
24
- * @param options Edge offsets, idle timing, behavior, and callbacks.
25
- * @default options {}
26
- * @returns Writable offsets, activity, edges, directions, and controls.
27
- */
28
11
  function useScroll(target, options = {}) {
29
12
  const offset = options.offset ?? {};
30
13
  const idle = options.idle ?? 200;
@@ -148,16 +131,6 @@ function useScroll(target, options = {}) {
148
131
  scrollTo
149
132
  };
150
133
  }
151
- /**
152
- * Track the document scroll position.
153
- *
154
- * Equivalent to {@link useScroll} with the window as target, so it shares its
155
- * SSR-stable defaults and scope-bound cleanup.
156
- *
157
- * @param options Window capability plus every {@link useScroll} option.
158
- * @default options {}
159
- * @returns The same controls as {@link useScroll}.
160
- */
161
134
  function useWindowScroll(options = {}) {
162
135
  const { host, ...scrollOptions } = options;
163
136
  return useScroll(() => host === void 0 ? browserScrollWindow() : toValue(host), scrollOptions);
@@ -1,23 +1,9 @@
1
1
  //#region src/standard-schema.ts
2
- /**
3
- * Whether a value implements the Standard Schema v1 protocol.
4
- *
5
- * @param candidate Value to test.
6
- * @returns Whether `candidate["~standard"].validate` is callable with version 1.
7
- */
8
2
  function isStandardSchema(candidate) {
9
3
  if (typeof candidate !== "object" && typeof candidate !== "function" || candidate === null) return false;
10
4
  const props = Reflect.get(candidate, "~standard");
11
5
  return typeof props === "object" && props !== null && Reflect.get(props, "version") === 1 && typeof Reflect.get(props, "validate") === "function";
12
6
  }
13
- /**
14
- * Convert a Standard Schema issue path to a dotted path.
15
- *
16
- * `{ key }` segments are unwrapped; symbols use their description.
17
- *
18
- * @param path Issue path.
19
- * @returns Dotted path, `""` for the root.
20
- */
21
7
  function formatSchemaPath(path) {
22
8
  if (!path) return "";
23
9
  return path.map((segment) => {
@@ -25,23 +11,6 @@ function formatSchemaPath(path) {
25
11
  return typeof key === "symbol" ? key.description ?? "" : String(key);
26
12
  }).join(".");
27
13
  }
28
- /**
29
- * Validate a value with a Standard Schema and normalize the result.
30
- *
31
- * Synchronous and asynchronous schemas are handled identically. Throwing
32
- * schemas propagate their error. Pure: safe on the server.
33
- *
34
- * @example
35
- * ```ts
36
- * const result = await validateStandardSchema(zodSchema, formValues);
37
- * if (result.status === "invalid") console.log(result.issues);
38
- * ```
39
- *
40
- * @typeParam Output Schema output type.
41
- * @param schema Standard Schema v1 validator.
42
- * @param value Value to validate.
43
- * @returns The normalized result.
44
- */
45
14
  async function validateStandardSchema(schema, value) {
46
15
  const result = await schema["~standard"].validate(value);
47
16
  if (result.issues === void 0) return {
package/dist/swipe.mjs CHANGED
@@ -3,17 +3,6 @@ import { resolveElement } from "./element-target.mjs";
3
3
  import { toPointerKind } from "./pointer.mjs";
4
4
  import { computed, readonly, ref, shallowReactive, shallowReadonly, watch } from "vue";
5
5
  //#region src/swipe.ts
6
- /**
7
- * Classify a displacement into a {@link SwipeDirection}.
8
- *
9
- * Pure helper shared by the swipe composables and usable for custom gesture
10
- * recognizers.
11
- *
12
- * @param lengthX `start.x - end.x`.
13
- * @param lengthY `start.y - end.y`.
14
- * @param threshold Minimum travel before a direction is reported.
15
- * @returns The dominant axis direction, or `"none"`.
16
- */
17
6
  function swipeDirection(lengthX, lengthY, threshold) {
18
7
  if (Math.max(Math.abs(lengthX), Math.abs(lengthY)) < threshold) return "none";
19
8
  if (Math.abs(lengthX) > Math.abs(lengthY)) return lengthX > 0 ? "left" : "right";
@@ -59,19 +48,6 @@ function createGesture(threshold) {
59
48
  swiping
60
49
  };
61
50
  }
62
- /**
63
- * Detect touch swipes on an element.
64
- *
65
- * Tracks the first touch point from `touchstart` through `touchend`/
66
- * `touchcancel`. Direction is derived from the dominant axis once the travel
67
- * exceeds `threshold`. Server renders expose zeroed coordinates and
68
- * `direction: "none"`; listeners are removed with the owning scope.
69
- *
70
- * @param target Reactive element target.
71
- * @param options Threshold, passivity, and callbacks.
72
- * @default options {}
73
- * @returns Reactive gesture state and stop control.
74
- */
75
51
  function useSwipe(target, options = {}) {
76
52
  const gesture = createGesture(options.threshold ?? 50);
77
53
  const passive = options.passive ?? true;
@@ -126,18 +102,6 @@ function useSwipe(target, options = {}) {
126
102
  stop
127
103
  };
128
104
  }
129
- /**
130
- * Detect swipes from any pointer device (mouse, touch, pen).
131
- *
132
- * Captures the pointer on `pointerdown` so moves outside the element still
133
- * count, and ignores secondary pointers during a gesture. Shares the state
134
- * shape and SSR defaults of {@link useSwipe}.
135
- *
136
- * @param target Reactive element target.
137
- * @param options Threshold, device filter, selection handling, and callbacks.
138
- * @default options {}
139
- * @returns Reactive gesture state and stop control.
140
- */
141
105
  function usePointerSwipe(target, options = {}) {
142
106
  const gesture = createGesture(options.threshold ?? 50);
143
107
  const pointerTypes = options.pointerTypes ?? [
package/dist/temporal.mjs CHANGED
@@ -15,23 +15,6 @@ function shouldSchedule(options) {
15
15
  if (toValue(options.paused ?? false)) return false;
16
16
  return typeof window !== "undefined" || toValue(options.runOnServer ?? false);
17
17
  }
18
- /**
19
- * Creates a pauseable Temporal clock whose timer follows the current Vue
20
- * effect scope.
21
- *
22
- * The timer is replaced when reactive options change and is always cancelled
23
- * when the owning scope stops. Call inside an active effect scope; without
24
- * one, there is no automatic timer cleanup. During
25
- * server rendering, no timer starts unless
26
- * {@link UseTemporalNowOptions.runOnServer} is explicitly enabled.
27
- *
28
- * @param options Clock scheduling, pause, and runtime overrides.
29
- * @default options {}
30
- * @throws `RangeError` tagged `VIZE_COMPOSE_TEMPORAL_INVALID_INTERVAL` when
31
- * the resolved interval is not finite or not greater than zero, both
32
- * synchronously at creation and on invalid reactive updates.
33
- * @returns Reactive clock controls.
34
- */
35
18
  function useTemporalNow(options = {}) {
36
19
  const readNow = options.now ?? Temporal.Now.instant;
37
20
  const instant = shallowRef(readNow());
@@ -53,19 +36,6 @@ function useTemporalNow(options = {}) {
53
36
  refresh
54
37
  };
55
38
  }
56
- /**
57
- * Creates a reactive zoned date-time derived from a scoped Temporal clock.
58
- *
59
- * Changes to {@link UseTemporalZonedDateTimeOptions.timeZone} are reflected
60
- * without replacing the underlying timer. Scheduling, server rendering, and
61
- * scope-cleanup rules are shared with {@link useTemporalNow}.
62
- *
63
- * @param options Clock scheduling plus the reactive time zone.
64
- * @default options {}
65
- * @throws `RangeError` for invalid intervals (see {@link useTemporalNow}),
66
- * and on read when the reactive time zone cannot be resolved by Temporal.
67
- * @returns Computed zoned date-time in the reactive time zone.
68
- */
69
39
  function useTemporalZonedDateTime(options = {}) {
70
40
  const clock = useTemporalNow(options);
71
41
  return computed(() => {
@@ -1,21 +1,6 @@
1
1
  import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { computed, hasInjectionContext, shallowRef, toValue, watch, watchPostEffect } from "vue";
3
3
  //#region src/text-selection.ts
4
- /**
5
- * Track the document text selection.
6
- *
7
- * Re-reads the selection on every `selectionchange`. Because the platform
8
- * mutates the same `Selection` object in place, a revision counter is used to
9
- * invalidate the derived `text`, `ranges`, and `rects`. Server renders expose
10
- * an empty selection; the listener is removed with the owning scope.
11
- *
12
- * Inside a component the host is read after mounting, so hydration renders
13
- * the server fallback first and never mismatches.
14
- *
15
- * @param options Document capability.
16
- * @default options {}
17
- * @returns Reactive selection, text, ranges, and rectangles.
18
- */
19
4
  function useTextSelection(options = {}) {
20
5
  const selection = shallowRef(null);
21
6
  const revision = shallowRef(0);
@@ -3,19 +3,6 @@ import { resolveElement } from "./element-target.mjs";
3
3
  import { useResizeObserver } from "./resize-observer.mjs";
4
4
  import { ref, watch } from "vue";
5
5
  //#region src/textarea-autosize.ts
6
- /**
7
- * Grow a textarea to fit its content.
8
- *
9
- * On each input change (and when the element width changes), the style
10
- * property is reset to `auto`, and `scrollHeight` is adjusted for the element's
11
- * padding, borders and box sizing before writing the CSS height in pixels.
12
- * Nothing is measured during server rendering; markup keeps its declared `rows`.
13
- *
14
- * @param target Reactive textarea target.
15
- * @param options Bound input, style property, callback, and observer capability.
16
- * @default options {}
17
- * @returns Bound input and a manual resize trigger.
18
- */
19
6
  function useTextareaAutosize(target, options = {}) {
20
7
  const input = options.input ?? ref("");
21
8
  const styleProp = options.styleProp ?? "height";
@@ -1,25 +1,5 @@
1
1
  import { isRef, reactive, unref } from "vue";
2
2
  //#region src/to-reactive.ts
3
- /**
4
- * Reactive object view over a ref that holds an object.
5
- *
6
- * Property reads and writes go to the ref's current object, so replacing the
7
- * ref's value swaps the whole object behind a stable reactive proxy (handy
8
- * for `v-bind="state"` or destructuring-free templates). Nested refs are
9
- * unwrapped on read and written through on assignment. A non-ref object is
10
- * simply passed to `reactive`. SSR-safe and nothing to dispose.
11
- *
12
- * @example
13
- * ```ts
14
- * const state = ref({ name: "a" });
15
- * const view = toReactive(state);
16
- * state.value = { name: "b" };
17
- * view.name; // "b"
18
- * ```
19
- *
20
- * @param objectRef Ref (or plain object) holding the object.
21
- * @returns A reactive proxy following the ref.
22
- */
23
3
  function toReactive(objectRef) {
24
4
  if (!isRef(objectRef)) return reactive(objectRef);
25
5
  return reactive(new Proxy(objectRef.value, {
@@ -1,7 +1,6 @@
1
1
  import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { shallowRef, toValue, watch } from "vue";
3
3
  //#region src/transition.ts
4
- /** Named cubic Bézier easing presets (the classic easings.net set). */
5
4
  const TransitionPresets = {
6
5
  linear: [
7
6
  0,
@@ -203,12 +202,6 @@ function useTransition(source, options = {}) {
203
202
  });
204
203
  return output;
205
204
  }
206
- /**
207
- * Build an easing function from cubic Bézier control points.
208
- *
209
- * @param points `[x1, y1, x2, y2]` with `x1`/`x2` in `[0, 1]`.
210
- * @returns Easing function mapping progress to eased progress.
211
- */
212
205
  function cubicBezier(points) {
213
206
  const [x1, y1, x2, y2] = points;
214
207
  const a = (p1, p2) => 1 - 3 * p2 + 3 * p1;
package/dist/until.mjs CHANGED
@@ -9,31 +9,6 @@ const defaultScheduler = {
9
9
  function createTimeoutError(timeout) {
10
10
  return Object.assign(/* @__PURE__ */ new Error(`[VIZE_COMPOSE_UNTIL_TIMEOUT] condition not met within ${timeout}ms`), { code: "VIZE_COMPOSE_UNTIL_TIMEOUT" });
11
11
  }
12
- /**
13
- * Await a reactive source reaching a condition.
14
- *
15
- * Every matcher resolves immediately when the current value already
16
- * satisfies it (except `changed`/`changedTimes`), and otherwise watches the
17
- * source (`flush: "sync"` by default, which also works inside server-side
18
- * `setup`). Result types are narrowed by the matcher: `toBeTruthy()` strips
19
- * falsy members, `not.toBeNull()` strips `null`, `toMatch(guard)` follows the
20
- * guard. Because a timeout rejects (it never resolves with an unmatched
21
- * value), the narrowing is always sound. Watchers and timers are released
22
- * as soon as the promise settles.
23
- *
24
- * @example
25
- * ```ts
26
- * const user = await until(currentUser).not.toBeNull({ timeout: 5_000 });
27
- * const ready = await until(status).toBe("ready");
28
- * ```
29
- *
30
- * @param source Ref or getter to observe.
31
- * @throws Returned promises reject with an {@link UntilTimeoutError} on
32
- * timeout, with the abort reason when the signal aborts, and with a
33
- * `RangeError` tagged `VIZE_COMPOSE_UNTIL_INVALID_OPTION` for a negative or
34
- * non-finite timeout or change count.
35
- * @returns The fluent matcher chain.
36
- */
37
12
  function until(source) {
38
13
  const wait = (matches, options, checkInitial = true) => new Promise((resolve, reject) => {
39
14
  const { timeout, signal, scheduler = defaultScheduler } = options;
@@ -3,18 +3,6 @@ import { computed, toValue } from "vue";
3
3
  function useArrayFilter(list, predicate) {
4
4
  return computed(() => toValue(list).filter(predicate));
5
5
  }
6
- /**
7
- * Reactive `Array.prototype.map`.
8
- *
9
- * @example
10
- * ```ts
11
- * const names = useArrayMap(users, (user) => user.name);
12
- * ```
13
- *
14
- * @param list Reactive array.
15
- * @param mapper Produces the mapped item.
16
- * @returns Computed mapped copy.
17
- */
18
6
  function useArrayMap(list, mapper) {
19
7
  return computed(() => toValue(list).map(mapper));
20
8
  }
@@ -31,52 +19,12 @@ function useArrayReduce(list, reducer, ...initial) {
31
19
  return accumulator;
32
20
  });
33
21
  }
34
- /**
35
- * Reactive `Array.prototype.some`.
36
- *
37
- * @example
38
- * ```ts
39
- * const hasErrors = useArraySome(fields, (field) => field.error !== null);
40
- * ```
41
- *
42
- * @param list Reactive array.
43
- * @param predicate Condition tested per item.
44
- * @returns Computed flag.
45
- */
46
22
  function useArraySome(list, predicate) {
47
23
  return computed(() => toValue(list).some(predicate));
48
24
  }
49
- /**
50
- * Reactive `Array.prototype.every`.
51
- *
52
- * @example
53
- * ```ts
54
- * const allDone = useArrayEvery(tasks, (task) => task.done);
55
- * ```
56
- *
57
- * @param list Reactive array.
58
- * @param predicate Condition tested per item.
59
- * @returns Computed flag.
60
- */
61
25
  function useArrayEvery(list, predicate) {
62
26
  return computed(() => toValue(list).every(predicate));
63
27
  }
64
- /**
65
- * Reactive de-duplication that keeps the first occurrence of each item.
66
- *
67
- * Without `isSame`, items are compared with `SameValueZero` (like `Set`) in
68
- * linear time; with it, pairwise in quadratic time.
69
- *
70
- * @example
71
- * ```ts
72
- * const tags = useArrayUnique(allTags);
73
- * const people = useArrayUnique(rows, (left, right) => left.id === right.id);
74
- * ```
75
- *
76
- * @param list Reactive array.
77
- * @param isSame Custom equality.
78
- * @returns Computed de-duplicated copy.
79
- */
80
28
  function useArrayUnique(list, isSame) {
81
29
  return computed(() => {
82
30
  const items = toValue(list);
@@ -48,31 +48,6 @@ function normalize(barcode) {
48
48
  }))
49
49
  };
50
50
  }
51
- /**
52
- * Detect barcodes and QR codes with the Barcode Detection API.
53
- *
54
- * `detect(source)` scans once; with a `source` (typically a camera video),
55
- * detection also runs on animation frames through {@link useRafFn}, throttled
56
- * by `fpsLimit` and never overlapping. Results are normalized into plain
57
- * {@link DetectedBarcode} objects. The frame loop stops with the owning
58
- * reactive scope; outside a scope call `stop()`.
59
- *
60
- * Server rendering: nothing is constructed or scheduled, `supported` is
61
- * false and `barcodes` is empty.
62
- * Inside a component `supported` turns true only after mounting, so
63
- * hydration renders this server state first.
64
- *
65
- * @example
66
- * ```ts
67
- * const video = useTemplateRef<HTMLVideoElement>("video");
68
- * const { barcodes } = useBarcodeDetector({ source: video, formats: ["qr_code"] });
69
- * ```
70
- *
71
- * @param options Constructor host, formats, and continuous-scan policy.
72
- * @default options {}
73
- * @throws `RangeError` tagged `VIZE_COMPOSE_RAF_INVALID_FPS_LIMIT` for an invalid `fpsLimit`.
74
- * @returns Detector state and actions.
75
- */
76
51
  function useBarcodeDetector(options = {}) {
77
52
  const barcodes = shallowRef([]);
78
53
  const error = shallowRef(void 0);
@@ -13,33 +13,6 @@ function isBluetoothHost(value) {
13
13
  function availabilityOf(event) {
14
14
  return "value" in event && typeof event.value === "boolean" ? event.value : void 0;
15
15
  }
16
- /**
17
- * Connect to Bluetooth Low Energy devices with the Web Bluetooth API.
18
- *
19
- * `requestDevice()` prompts for a device, `connect()` connects its GATT
20
- * server, and `read` / `write` / `notify` address characteristics by service
21
- * and characteristic UUID. `connected` follows `gattserverdisconnected` and
22
- * `available` follows `availabilitychanged`. Failures land in `error`.
23
- * Notifications are stopped and the server disconnected when the owning
24
- * reactive scope stops; outside a scope call `disconnect()`.
25
- *
26
- * Server rendering: `supported`, `available` and `connected` are false and
27
- * nothing is queried.
28
- * Inside a component the host is resolved after mounting, so hydration
29
- * renders this server state first.
30
- *
31
- * @example
32
- * ```ts
33
- * const ble = useBluetooth({ requestOptions: { filters: [{ services: ["heart_rate"] }] } });
34
- * await ble.requestDevice();
35
- * await ble.connect();
36
- * await ble.notify("heart_rate", "heart_rate_measurement", (value) => show(value.getUint8(1)));
37
- * ```
38
- *
39
- * @param options Host and default request options.
40
- * @default options {}
41
- * @returns Bluetooth state and actions.
42
- */
43
16
  function useBluetooth(options = {}) {
44
17
  const available = ref(false);
45
18
  const device = shallowRef(void 0);
@@ -4,36 +4,6 @@ import { hasInjectionContext, readonly, ref, shallowRef, toValue, watch, watchPo
4
4
  function browserBroadcastChannelHost() {
5
5
  return typeof window !== "undefined" && typeof window.BroadcastChannel === "function" ? window : void 0;
6
6
  }
7
- /**
8
- * Exchange typed messages with other tabs, windows, and workers of the same
9
- * origin through the Broadcast Channel API.
10
- *
11
- * The channel follows the reactive `name`: changing it closes the old channel
12
- * and opens a new one. The channel closes when the owning reactive scope
13
- * stops or when `close()` is called; outside a scope the caller owns
14
- * `close()`. Incoming payloads pass the `validate` type guard before they
15
- * reach `data`, so foreign messages cannot widen the declared type.
16
- *
17
- * Server rendering: without a browser `window` no channel is opened (Node's
18
- * global `BroadcastChannel` is ignored), `supported` is `false`, and `post`
19
- * returns `false`.
20
- *
21
- * Inside a component the host is read after mounting, so hydration renders
22
- * the server fallback first and never mismatches.
23
- *
24
- * @example
25
- * ```ts
26
- * type Sync = { readonly type: "logout" };
27
- * const { data, post } = useBroadcastChannel<Sync>("auth");
28
- * post({ type: "logout" });
29
- * ```
30
- *
31
- * @typeParam Message Payload type exchanged over the channel.
32
- * @param name Reactive channel name.
33
- * @param options Host, validation, and observation hooks.
34
- * @default options {}
35
- * @returns Reactive channel state and controls.
36
- */
37
7
  function useBroadcastChannel(name, options = {}) {
38
8
  const data = shallowRef(void 0);
39
9
  const error = shallowRef(void 0);
@@ -149,30 +149,6 @@ function useAiSession(name, host, createOptions) {
149
149
  stream
150
150
  };
151
151
  }
152
- /**
153
- * Translate text on-device with Chrome's built-in `Translator` API.
154
- *
155
- * The session is created lazily by the first `translate` (or explicitly by
156
- * `create()`, which browsers require inside a user gesture when the model
157
- * must be downloaded); `downloadProgress` follows the download. Changing a
158
- * language destroys the session. The session is destroyed and a pending
159
- * creation aborted when the owning reactive scope stops; outside a scope
160
- * call `destroy()`.
161
- *
162
- * Server rendering: nothing is created, `supported` is false and `status`
163
- * is `"unsupported"`.
164
- * Inside a component `supported` turns true only after mounting, so
165
- * hydration renders this server state first.
166
- *
167
- * @example
168
- * ```ts
169
- * const translator = useTranslator({ sourceLanguage: "en", targetLanguage: "ja" });
170
- * const japanese = await translator.translate("Hello");
171
- * ```
172
- *
173
- * @param options Language pair and class override.
174
- * @returns Translator state and actions.
175
- */
176
152
  function useTranslator(options) {
177
153
  const session = useAiSession("Translator", options.host, () => ({
178
154
  sourceLanguage: toValue(options.sourceLanguage),
@@ -184,28 +160,6 @@ function useTranslator(options) {
184
160
  translateStreaming: (text) => session.stream((translator) => translator.translateStreaming(text))
185
161
  };
186
162
  }
187
- /**
188
- * Detect the language of text on-device with Chrome's built-in
189
- * `LanguageDetector` API.
190
- *
191
- * Shares the lifecycle of {@link useTranslator}: lazy creation, download
192
- * progress, destruction with the owning reactive scope.
193
- *
194
- * Server rendering: nothing is created, `supported` is false and `status`
195
- * is `"unsupported"`.
196
- * Inside a component `supported` turns true only after mounting, so
197
- * hydration renders this server state first.
198
- *
199
- * @example
200
- * ```ts
201
- * const detector = useLanguageDetector();
202
- * const [best] = await detector.detect(input.value);
203
- * ```
204
- *
205
- * @param options Expected languages and class override.
206
- * @default options {}
207
- * @returns Detector state and actions.
208
- */
209
163
  function useLanguageDetector(options = {}) {
210
164
  const session = useAiSession("LanguageDetector", options.host, () => {
211
165
  const expectedInputLanguages = toValue(options.expectedInputLanguages);
@@ -216,28 +170,6 @@ function useLanguageDetector(options = {}) {
216
170
  detect: (text) => session.run((detector) => detector.detect(text))
217
171
  };
218
172
  }
219
- /**
220
- * Summarize text on-device with Chrome's built-in `Summarizer` API.
221
- *
222
- * Shares the lifecycle of {@link useTranslator}: lazy creation, download
223
- * progress, destruction with the owning reactive scope; changing `type`,
224
- * `format`, `length` or `sharedContext` destroys the session.
225
- *
226
- * Server rendering: nothing is created, `supported` is false and `status`
227
- * is `"unsupported"`.
228
- * Inside a component `supported` turns true only after mounting, so
229
- * hydration renders this server state first.
230
- *
231
- * @example
232
- * ```ts
233
- * const summarizer = useSummarizer({ type: "tldr", length: "medium" });
234
- * for await (const chunk of summarizer.summarizeStreaming(article.value)) output.value += chunk;
235
- * ```
236
- *
237
- * @param options Summary shape and class override.
238
- * @default options {}
239
- * @returns Summarizer state and actions.
240
- */
241
173
  function useSummarizer(options = {}) {
242
174
  const session = useAiSession("Summarizer", options.host, () => {
243
175
  const base = {