@vizejs/composable 0.809.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 (173) 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.d.mts +2 -2
  32. package/dist/index.mjs +2 -2
  33. package/dist/infinite-scroll.mjs +0 -16
  34. package/dist/intersection-observer.mjs +0 -27
  35. package/dist/locale.mjs +0 -20
  36. package/dist/magic-keys.mjs +0 -35
  37. package/dist/math.mjs +0 -37
  38. package/dist/media-query.mjs +0 -29
  39. package/dist/mouse-in-element.mjs +0 -12
  40. package/dist/mouse.mjs +0 -12
  41. package/dist/mutation-observer.mjs +0 -15
  42. package/dist/network.mjs +0 -24
  43. package/dist/on-click-outside.mjs +0 -16
  44. package/dist/on-key-stroke.mjs +0 -33
  45. package/dist/on-long-press.mjs +0 -14
  46. package/dist/on-start-typing.mjs +0 -23
  47. package/dist/page-leave.mjs +0 -11
  48. package/dist/parent-element.mjs +0 -9
  49. package/dist/pinch.mjs +0 -14
  50. package/dist/pointer-lock.mjs +0 -23
  51. package/dist/pointer.mjs +0 -18
  52. package/dist/preferences.mjs +0 -31
  53. package/dist/preferred-languages.mjs +0 -13
  54. package/dist/ref-auto-reset.mjs +0 -24
  55. package/dist/ref-debounced.mjs +0 -22
  56. package/dist/ref-default.mjs +0 -21
  57. package/dist/resize-observer.mjs +0 -31
  58. package/dist/resolver.mjs +1 -58
  59. package/dist/retry-async.mjs +0 -25
  60. package/dist/retry-delay.mjs +0 -23
  61. package/dist/scope.mjs +0 -14
  62. package/dist/screen-orientation.mjs +0 -15
  63. package/dist/scroll-lock.mjs +0 -14
  64. package/dist/scroll.mjs +0 -27
  65. package/dist/standard-schema.mjs +0 -31
  66. package/dist/swipe.mjs +0 -36
  67. package/dist/temporal.mjs +0 -30
  68. package/dist/text-selection.mjs +0 -15
  69. package/dist/textarea-autosize.mjs +0 -13
  70. package/dist/to-reactive.mjs +0 -20
  71. package/dist/transition.mjs +0 -7
  72. package/dist/until.mjs +0 -25
  73. package/dist/use-array.mjs +0 -52
  74. package/dist/use-barcode-detector.mjs +0 -25
  75. package/dist/use-bluetooth.mjs +0 -27
  76. package/dist/use-broadcast-channel.mjs +0 -30
  77. package/dist/use-builtin-ai.mjs +0 -68
  78. package/dist/use-clipboard.mjs +0 -27
  79. package/dist/use-compression-stream.mjs +0 -78
  80. package/dist/use-contact-picker.mjs +0 -22
  81. package/dist/use-cookie.mjs +0 -63
  82. package/dist/use-countdown.mjs +0 -22
  83. package/dist/use-counter.mjs +0 -29
  84. package/dist/use-css-var.mjs +0 -28
  85. package/dist/use-date-format.mjs +0 -48
  86. package/dist/use-date-time-format.mjs +0 -22
  87. package/dist/use-debounced.mjs +0 -39
  88. package/dist/use-display-media.mjs +0 -22
  89. package/dist/use-display-names.mjs +0 -19
  90. package/dist/use-document-title.mjs +0 -25
  91. package/dist/use-drop-zone.mjs +0 -36
  92. package/dist/use-event-source.mjs +0 -25
  93. package/dist/use-eye-dropper.mjs +0 -19
  94. package/dist/use-favicon.mjs +0 -23
  95. package/dist/use-fetch.mjs +0 -27
  96. package/dist/use-field.mjs +0 -27
  97. package/dist/use-file-dialog.mjs +0 -21
  98. package/dist/{use-form-C2JXZ0i7.mjs → use-form-BZqwMs6k.mjs} +143 -70
  99. package/dist/use-form-field-props.mjs +0 -57
  100. package/dist/use-form.d.mts +123 -18
  101. package/dist/use-form.mjs +1 -1
  102. package/dist/use-fullscreen.mjs +0 -23
  103. package/dist/use-gamepad.mjs +0 -50
  104. package/dist/use-hid.mjs +0 -25
  105. package/dist/use-history.mjs +0 -43
  106. package/dist/use-id-generator.mjs +0 -21
  107. package/dist/use-image.mjs +0 -22
  108. package/dist/use-indexed-db.mjs +0 -39
  109. package/dist/use-interval.mjs +0 -28
  110. package/dist/use-list-format.mjs +0 -18
  111. package/dist/use-machine.mjs +0 -34
  112. package/dist/use-map.mjs +0 -28
  113. package/dist/use-media-controls.mjs +0 -28
  114. package/dist/use-mounted.mjs +0 -18
  115. package/dist/use-navigation-api.mjs +0 -27
  116. package/dist/use-notification.mjs +0 -24
  117. package/dist/use-number-format.mjs +0 -23
  118. package/dist/use-object-url.mjs +0 -22
  119. package/dist/use-offset-pagination.mjs +0 -18
  120. package/dist/use-payment-request.mjs +0 -25
  121. package/dist/use-performance-observer.mjs +0 -27
  122. package/dist/use-permission.mjs +0 -26
  123. package/dist/use-plural-rules.mjs +0 -21
  124. package/dist/use-push-subscription.mjs +0 -28
  125. package/dist/use-queue.mjs +0 -29
  126. package/dist/use-raf-fn.mjs +0 -23
  127. package/dist/use-relative-time-format.mjs +0 -35
  128. package/dist/use-request-idle-callback.mjs +0 -42
  129. package/dist/use-route-query.mjs +0 -17
  130. package/dist/use-scheduler-post-task.mjs +0 -27
  131. package/dist/use-screen-details.mjs +0 -42
  132. package/dist/use-script-tag.mjs +0 -28
  133. package/dist/use-segmenter.mjs +0 -20
  134. package/dist/use-serial.mjs +0 -24
  135. package/dist/use-service-worker.mjs +0 -27
  136. package/dist/use-set.mjs +0 -23
  137. package/dist/use-share.mjs +0 -23
  138. package/dist/use-sorted-locale.mjs +0 -20
  139. package/dist/use-speech-recognition.mjs +0 -24
  140. package/dist/use-speech-synthesis.mjs +0 -26
  141. package/dist/use-stack.mjs +0 -27
  142. package/dist/use-storage-estimate.mjs +0 -41
  143. package/dist/use-storage.mjs +0 -68
  144. package/dist/use-style-tag.mjs +0 -22
  145. package/dist/use-supported.mjs +0 -17
  146. package/dist/use-throttled.mjs +0 -46
  147. package/dist/use-time-ago.mjs +0 -22
  148. package/dist/use-toggle.mjs +0 -19
  149. package/dist/use-url-hash.mjs +0 -28
  150. package/dist/use-url-search-params.mjs +0 -99
  151. package/dist/use-usb.mjs +0 -23
  152. package/dist/use-user-activation.mjs +0 -22
  153. package/dist/use-user-media.mjs +0 -50
  154. package/dist/use-vibrate.mjs +0 -21
  155. package/dist/use-view-transition.mjs +0 -22
  156. package/dist/use-visual-viewport.mjs +0 -25
  157. package/dist/use-wake-lock.mjs +0 -21
  158. package/dist/use-web-authn.mjs +0 -61
  159. package/dist/use-web-locks.mjs +0 -25
  160. package/dist/use-web-midi.mjs +0 -22
  161. package/dist/use-web-vitals.mjs +0 -41
  162. package/dist/use-websocket.mjs +0 -27
  163. package/dist/use-worker-fn.mjs +0 -37
  164. package/dist/virtual-list.mjs +0 -14
  165. package/dist/whenever.mjs +0 -21
  166. package/dist/window-size.mjs +0 -12
  167. package/package.json +2 -2
  168. package/registry/files/form-control-types.ts +260 -0
  169. package/registry/files/form-dirty.ts +131 -0
  170. package/registry/files/form-options.ts +156 -0
  171. package/registry/files/form-path-types.ts +135 -0
  172. package/registry/files/use-form.ts +102 -449
  173. package/registry/registry.json +28 -4
@@ -7,28 +7,6 @@ function browserLanguage() {
7
7
  function isValidDate(value) {
8
8
  return !Number.isNaN(value instanceof Date ? value.getTime() : value);
9
9
  }
10
- /**
11
- * Format dates and times reactively with `Intl.DateTimeFormat`.
12
- *
13
- * The formatter follows the reactive options (including `locale`) and is
14
- * cached per locale and option set through {@link useLocale}. For
15
- * hydration-stable output pass both `locale` and `timeZone`: otherwise the
16
- * server uses `"en"` and its own zone. Invalid options surface as the
17
- * platform's `RangeError` on first read; invalid dates render as `""`.
18
- * No listeners or timers are created — combine with a clock composable for
19
- * live-updating output.
20
- *
21
- * @example
22
- * ```ts
23
- * const { formatted } = useDateTimeFormat(date, { locale: "en-GB", dateStyle: "long", timeZone: "UTC" });
24
- * ```
25
- *
26
- * @param value Reactive date; `null`/`undefined` format as `""`.
27
- * @param options Reactive locale and `Intl.DateTimeFormat` options.
28
- * @default value undefined
29
- * @default options {}
30
- * @returns Reactive formatted output and formatter helpers.
31
- */
32
10
  function useDateTimeFormat(value, options = {}) {
33
11
  const localeControls = useLocale(() => toValue(options).locale, { detect: browserLanguage });
34
12
  const formatter = computed(() => {
@@ -7,45 +7,6 @@ const defaultScheduler = {
7
7
  globalThis.clearTimeout(handle);
8
8
  }
9
9
  };
10
- /**
11
- * Create a readonly debounced view of a reactive source.
12
- *
13
- * The view starts at the current source value. Each source change (observed
14
- * with `flush: "sync"`, so every synchronous write counts) restarts a
15
- * single-shot timer of `waitMs` milliseconds; when it fires, the view takes
16
- * the source value current at that moment. `waitMs` is reactive and is read
17
- * when a timer is scheduled; changing it does not restart an already-pending
18
- * timer. A wait of `0` still defers to the next scheduler tick.
19
- *
20
- * Server rendering is explicit: without a browser `window` (and with
21
- * {@link UseDebouncedOptions.runOnServer} disabled) no timer ever starts and
22
- * the view mirrors the source synchronously, so server-rendered output shows
23
- * current values and nothing leaks. `pending` stays `false` and the controls
24
- * report `false` in that mode.
25
- *
26
- * Cleanup rule: the watcher and any pending timer are released when the
27
- * owning reactive scope stops; call inside an active scope. Outside one, the
28
- * watcher lives as long as the source and `cancel()` only clears the pending
29
- * timer.
30
- *
31
- * @example
32
- * ```ts
33
- * const query = shallowRef("");
34
- * const { debounced, flush } = useDebounced(query, 300);
35
- * query.value = "vize"; // debounced.value still "" for 300ms
36
- * flush(); // debounced.value === "vize" immediately
37
- * ```
38
- *
39
- * @param source Reactive source to debounce.
40
- * @param waitMs Reactive delay in milliseconds; must be finite and at least
41
- * zero. Fractions are truncated.
42
- * @param options Runtime scheduling overrides.
43
- * @default options {}
44
- * @throws `RangeError` tagged `VIZE_COMPOSE_DEBOUNCE_INVALID_WAIT` when the
45
- * resolved wait is not finite or is negative, both synchronously at creation
46
- * (even in mirror mode) and again for every scheduled delay.
47
- * @returns Readonly debounced view, pending flag, and cancel/flush controls.
48
- */
49
10
  function useDebounced(source, waitMs, options = {}) {
50
11
  const scheduler = options.scheduler ?? defaultScheduler;
51
12
  const debounced = shallowRef(toValue(source));
@@ -6,28 +6,6 @@ function browserDisplayMediaHost() {
6
6
  const devices = window.navigator.mediaDevices;
7
7
  return devices && typeof devices.getDisplayMedia === "function" ? devices : void 0;
8
8
  }
9
- /**
10
- * Capture a screen, window, or tab with `getDisplayMedia`.
11
- *
12
- * Shares the stream lifecycle of `useMediaStream` (from `use-user-media`):
13
- * classified failures (`"permission-denied"` when the user dismisses the
14
- * picker), latest-wins requests, and automatic return to `"idle"` when the
15
- * user ends sharing from the browser UI (every track `ended`). Tracks are
16
- * stopped when the owning reactive scope stops.
17
- *
18
- * Server rendering: nothing is captured; `status` is `"idle"` and
19
- * `supported` is false.
20
- *
21
- * @example
22
- * ```ts
23
- * const screen = useDisplayMedia({ audio: true });
24
- * const share = () => screen.start();
25
- * ```
26
- *
27
- * @param options Capture constraints, activation, and capability.
28
- * @default options {}
29
- * @returns Stream state and actions.
30
- */
31
9
  function useDisplayMedia(options = {}) {
32
10
  const resolveHost = () => options.host === void 0 ? browserDisplayMediaHost() : toValue(options.host) ?? void 0;
33
11
  return useMediaStream({
@@ -4,25 +4,6 @@ import { computed, toValue } from "vue";
4
4
  function browserLanguage() {
5
5
  return typeof window === "undefined" ? void 0 : window.navigator.language;
6
6
  }
7
- /**
8
- * Localized names of languages, regions, scripts, currencies, calendars, and
9
- * date-time fields (`Intl.DisplayNames`): `"JP"` → "Japan", `"ja"` → "日本語"
10
- * in Japanese, `"EUR"` → "Euro".
11
- *
12
- * Malformed codes yield `undefined` rather than the platform `RangeError`,
13
- * so user-entered codes never crash rendering; invalid *options* still
14
- * throw on first read. Derived state only: no listeners or timers, and
15
- * deterministic during server rendering when the locale is explicit.
16
- *
17
- * @example
18
- * ```ts
19
- * const { name } = useDisplayNames(regionCode, { type: "region", locale: "en" });
20
- * ```
21
- *
22
- * @param code Reactive code to name.
23
- * @param options Reactive kind, locale, and display options.
24
- * @returns Reactive name and a naming helper.
25
- */
26
7
  function useDisplayNames(code, options) {
27
8
  const localeControls = useLocale(() => toValue(options).locale, { detect: browserLanguage });
28
9
  const displayNames = computed(() => {
@@ -27,31 +27,6 @@ function browserTitleHost() {
27
27
  function formatTitle(template, title) {
28
28
  return typeof template === "function" ? template(title) : template.replaceAll("%s", title);
29
29
  }
30
- /**
31
- * Bind the document title to reactive state.
32
- *
33
- * Accepts a writable ref (used as-is), a getter (followed), a plain
34
- * string, or nothing (an owned ref seeded from the current title). Every
35
- * non-nullish title is passed through `template` before it is written.
36
- * With `observe`, external title changes flow back into `title`.
37
- *
38
- * Server rendering: the document is never touched and `title` keeps the
39
- * value it was given (or `undefined`). Head management for server-rendered
40
- * markup (`<title>` in the HTML) is the job of the application's head
41
- * manager; this composable only updates the live document on the client.
42
- * Watchers and the observer are released with the owning reactive scope,
43
- * which also applies `restoreOnDispose`.
44
- *
45
- * @example
46
- * ```ts
47
- * const { title } = useDocumentTitle(() => route.meta.title, { template: "%s | Vize" });
48
- * ```
49
- *
50
- * @param title Reactive title source.
51
- * @param options Template, restore policy, observation, and capability.
52
- * @default options {}
53
- * @returns The title ref and support flag.
54
- */
55
30
  function useDocumentTitle(title, options = {}) {
56
31
  const template = options.template ?? "%s";
57
32
  const resolveHost = () => options.host === void 0 ? browserTitleHost() : toValue(options.host) ?? void 0;
@@ -9,18 +9,6 @@ function matchesPattern(pattern, file) {
9
9
  if (normalized.endsWith("/*")) return type.startsWith(normalized.slice(0, -1));
10
10
  return type === normalized;
11
11
  }
12
- /**
13
- * Test a file against `accept`-attribute style patterns.
14
- *
15
- * Supports exact MIME types, wildcard subtypes (`"image/*"`), extensions
16
- * (`".png"`, case-insensitive), and `"*"`. An empty pattern list accepts
17
- * everything. An empty `name` (the file is still being dragged) makes
18
- * extension patterns match provisionally.
19
- *
20
- * @param accept Patterns to test.
21
- * @param file File name and MIME type.
22
- * @returns Whether any pattern matches.
23
- */
24
12
  function matchesAccept(accept, file) {
25
13
  return accept.length === 0 || accept.some((pattern) => matchesPattern(pattern, file));
26
14
  }
@@ -43,30 +31,6 @@ function draggedTypes(transfer) {
43
31
  }
44
32
  return types;
45
33
  }
46
- /**
47
- * Headless drop-zone logic for any element.
48
- *
49
- * Tracks whether a drag is over the target (a nesting counter keeps
50
- * `dragleave` from child elements from flickering the state), decides
51
- * acceptance from the dragged MIME types while dragging, and filters the
52
- * dropped files by `accept` (including extension patterns) and `multiple`.
53
- * Rejected drags show the `"none"` drop effect. Rendering is entirely up to
54
- * the caller. Listeners follow the reactive target and are removed when the
55
- * owning reactive scope stops.
56
- *
57
- * Server rendering: no listener is attached; all state is empty/false.
58
- *
59
- * @example
60
- * ```ts
61
- * const zone = useTemplateRef<HTMLElement>("zone");
62
- * const { isOverDropZone, files } = useDropZone(zone, { accept: ["image/*"] });
63
- * ```
64
- *
65
- * @param target Reactive drop target.
66
- * @param options Acceptance rules and lifecycle callbacks.
67
- * @default options {}
68
- * @returns Drag and drop state.
69
- */
70
34
  function useDropZone(target, options = {}) {
71
35
  const isOverDropZone = ref(false);
72
36
  const accepted = ref(false);
@@ -20,31 +20,6 @@ function defaultScheduler() {
20
20
  function eventData(value) {
21
21
  return value;
22
22
  }
23
- /**
24
- * Reactive Server-Sent Events stream with typed, per-event decoding.
25
- *
26
- * Every subscribed event is decoded by its parser (raw text by default) and
27
- * exposed as a discriminated `message`, plus `data`/`event`/`lastEventId`
28
- * shortcuts and typed `on()` handlers. Transient drops use the browser's
29
- * native reconnection; `autoReconnect` additionally reopens streams the
30
- * browser closed for good. The stream and timers are released when the
31
- * owning reactive scope stops (the caller owns `close()` outside a scope).
32
- * Server rendering never connects and reports `"closed"`.
33
- *
34
- * @example
35
- * ```ts
36
- * const feed = useEventSource<{ price: number; notice: string }>("/stream", {
37
- * events: ["price", "notice"],
38
- * parse: { price: (raw) => Number(raw) },
39
- * });
40
- * feed.on("price", (price) => chart.push(price));
41
- * ```
42
- *
43
- * @param url Reactive URL; changing it reconnects.
44
- * @param options Events, decoders, host, and reconnection options.
45
- * @default options {}
46
- * @returns Reactive state and controls.
47
- */
48
23
  function useEventSource(url, ...[options]) {
49
24
  const settings = options ?? {};
50
25
  const status = shallowRef("closed");
@@ -11,25 +11,6 @@ function browserEyeDropper() {
11
11
  function isAbort(error) {
12
12
  return typeof error === "object" && error !== null && "name" in error && error.name === "AbortError";
13
13
  }
14
- /**
15
- * Pick a color from anywhere on screen with the EyeDropper API.
16
- *
17
- * `open` resolves to a discriminated {@link EyeDropperResult}; dismissing
18
- * the picker (Escape) or aborting via `signal` yields `"cancelled"`.
19
- * The composable holds no resources beyond an open picker, which the
20
- * caller controls through `signal`.
21
- *
22
- * Server rendering: `supported` is false and `sRGBHex` is `initialValue`.
23
- *
24
- * @example
25
- * ```ts
26
- * const { open, sRGBHex, supported } = useEyeDropper();
27
- * ```
28
- *
29
- * @param options Capability and initial color.
30
- * @default options {}
31
- * @returns Picker state and the open action.
32
- */
33
14
  function useEyeDropper(options = {}) {
34
15
  const sRGBHex = ref(options.initialValue ?? "");
35
16
  const picking = ref(false);
@@ -14,29 +14,6 @@ function browserFaviconHost() {
14
14
  }
15
15
  };
16
16
  }
17
- /**
18
- * Bind the page favicon to reactive state.
19
- *
20
- * Every `<link>` whose `rel` contains `rel` (`icon`, `shortcut icon`,
21
- * `apple-touch-icon`, …) gets `baseUrl + icon` as its `href`; when none
22
- * exists, one `<link rel="icon">` is created. Accepts a writable ref (used
23
- * as-is), a getter (followed), a plain string, or nothing (an owned ref).
24
- *
25
- * Server rendering: this is a client-only side effect. The document is
26
- * never touched on the server, and `icon` keeps its given value; emit the
27
- * initial `<link rel="icon">` through the application's head manager.
28
- * Watchers are released with the owning reactive scope; the last icon stays.
29
- *
30
- * @example
31
- * ```ts
32
- * const { icon } = useFavicon(() => (unread.value ? "/unread.svg" : "/icon.svg"));
33
- * ```
34
- *
35
- * @param icon Reactive icon source.
36
- * @param options Base URL, relation, and capability.
37
- * @default options {}
38
- * @returns The icon ref and support flag.
39
- */
40
17
  function useFavicon(icon, options = {}) {
41
18
  const baseUrl = options.baseUrl ?? "";
42
19
  const rel = options.rel ?? "icon";
@@ -30,33 +30,6 @@ function assertTimeout(timeoutMs) {
30
30
  if (timeoutMs === void 0) return;
31
31
  if (!Number.isFinite(timeoutMs) || timeoutMs < 0) throw new RangeError(`[VIZE_COMPOSE_FETCH_INVALID_TIMEOUT] timeoutMs must be a finite non-negative number; received ${String(timeoutMs)}`);
32
32
  }
33
- /**
34
- * Reactive, abortable, retrying `fetch` with typed decoding and interceptors.
35
- *
36
- * Latest wins: starting an execution aborts the pending one, which then
37
- * settles as `"superseded"` without touching state. The pending request is
38
- * aborted when the owning reactive scope stops; outside a scope the caller
39
- * owns `abort()`. Automatic execution (initial and on reactive URL/`init`
40
- * changes) only happens in a browser or with an explicit `fetch`, so server
41
- * rendering performs no I/O unless you `await execute()` in
42
- * `onServerPrefetch`; state then holds `initialData` and status `"idle"`.
43
- *
44
- * @example
45
- * ```ts
46
- * const id = ref(1);
47
- * const { data, error } = useFetch(() => `/api/users/${id.value}`, {
48
- * validate: isUser,
49
- * retry: 2,
50
- * timeoutMs: 5_000,
51
- * });
52
- * ```
53
- *
54
- * @param url Reactive URL; `null`/`undefined` keeps the resource idle.
55
- * @param options Decoding, retry, timeout, and interceptor options.
56
- * @default options {}
57
- * @throws {RangeError} `[VIZE_COMPOSE_FETCH_INVALID_TIMEOUT]` for an invalid timeout.
58
- * @returns Reactive state and controls.
59
- */
60
33
  function useFetch(url, options = {}) {
61
34
  assertTimeout(options.timeoutMs);
62
35
  const data = shallowRef(options.initialData);
@@ -15,33 +15,6 @@ function sameValue(left, right) {
15
15
  const rightKeys = Object.keys(right);
16
16
  return leftKeys.length === rightKeys.length && leftKeys.every((key) => sameValue(Reflect.get(left, key), Reflect.get(right, key)));
17
17
  }
18
- /**
19
- * A standalone validated field, independent of any form.
20
- *
21
- * Rules may be plain (a)synchronous validators or Standard Schema v1
22
- * validators (anything with a `~standard` property). A newer validation
23
- * aborts older ones through their `signal`, and stale results are ignored.
24
- * With `validateOn: "change"` validation runs after each value change,
25
- * never during setup, so server-rendered markup matches the first client
26
- * render. For multi-field state use `useForm`.
27
- *
28
- * Server rendering: pure state; nothing validates during setup. Pending
29
- * validations are aborted when the owning scope stops.
30
- *
31
- * @example
32
- * ```ts
33
- * const email = useField("", {
34
- * name: "email",
35
- * rules: [(value) => (value.includes("@") ? undefined : "Invalid email")],
36
- * });
37
- * ```
38
- *
39
- * @typeParam Value Field value, inferred from `initialValue`.
40
- * @param initialValue Initial value, or a factory returning it.
41
- * @param options Rules, trigger, and name.
42
- * @default options {}
43
- * @returns Field state and actions.
44
- */
45
18
  function useField(initialValue, options = {}) {
46
19
  const createInitial = () => initialValue instanceof Function ? initialValue() : structuredClone(toRaw(initialValue));
47
20
  let initial = createInitial();
@@ -4,27 +4,6 @@ import { shallowRef, toValue } from "vue";
4
4
  function browserFileDialogHost() {
5
5
  return typeof window === "undefined" ? void 0 : window.document;
6
6
  }
7
- /**
8
- * Open the native file picker without rendering an input.
9
- *
10
- * A detached `<input type="file">` is created lazily on the first `open`
11
- * (never during setup or server rendering), configured from reactive
12
- * options plus per-call overrides, and observed for `change` and `cancel`.
13
- * The selection is exposed as a readonly `File[]`. Listeners are removed
14
- * when the owning reactive scope stops.
15
- *
16
- * Server rendering: `files` is `initialFiles` and `open` returns false.
17
- *
18
- * @example
19
- * ```ts
20
- * const { files, open, onChange } = useFileDialog({ accept: "image/*" });
21
- * onChange((selection) => upload(selection));
22
- * ```
23
- *
24
- * @param options Dialog settings, initial selection, and capability.
25
- * @default options {}
26
- * @returns Selection state and dialog actions.
27
- */
28
7
  function useFileDialog(options = {}) {
29
8
  const files = shallowRef(options.initialFiles ?? null);
30
9
  const changeHandlers = /* @__PURE__ */ new Set();