@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,22 +1,4 @@
1
1
  //#region src/abort-signal.ts
2
- /**
3
- * Create a signal that aborts when the first input signal aborts.
4
- *
5
- * The standard `AbortSignal.any()` implementation is used when available.
6
- * Older runtimes receive an equivalent listener-based implementation that
7
- * removes every retained listener as soon as the result aborts. The first
8
- * already-aborted input wins in iteration order, and its exact reason is
9
- * forwarded. An empty iterable returns a fresh signal that never aborts.
10
- *
11
- * This function reads runtime constructors only when called and is safe to
12
- * import during server rendering. Materializing the iterable happens before
13
- * listeners are attached, so an iterable that throws cannot leak a partial
14
- * subscription. If a non-standard signal throws while registering, listeners
15
- * already attached to earlier inputs are released before the error propagates.
16
- *
17
- * @param signals Abort signals to compose; consumed exactly once.
18
- * @returns A new first-abort-wins signal.
19
- */
20
2
  function anyAbortSignal(signals) {
21
3
  const inputs = [...signals];
22
4
  const nativeAny = conformantNativeAbortSignalAny();
@@ -54,7 +36,6 @@ function anyAbortSignal(signals) {
54
36
  }
55
37
  let probedNativeAny;
56
38
  let cachedNativeAny;
57
- /** Resolve the current native implementation only after its first-reason contract passes. */
58
39
  function conformantNativeAbortSignalAny() {
59
40
  let candidate;
60
41
  try {
@@ -67,11 +48,6 @@ function conformantNativeAbortSignalAny() {
67
48
  cachedNativeAny = typeof candidate === "function" && nativeAnyReasonIsStable(candidate) ? candidate : void 0;
68
49
  return cachedNativeAny;
69
50
  }
70
- /**
71
- * Detect runtimes whose combined reason changes when an earlier array member
72
- * aborts after the winner. The probe deliberately does not read the reason
73
- * until both inputs abort, catching lazy native implementations as well.
74
- */
75
51
  function nativeAnyReasonIsStable(candidate) {
76
52
  try {
77
53
  const late = new AbortController();
@@ -85,29 +61,6 @@ function nativeAnyReasonIsStable(candidate) {
85
61
  return false;
86
62
  }
87
63
  }
88
- /**
89
- * Create a signal that aborts after a portable, non-negative delay.
90
- *
91
- * The native `AbortSignal.timeout()` implementation is used when available
92
- * and neither a custom scheduler nor a custom reason is supplied. Older
93
- * runtimes use the same owned-timer path as injected schedulers. Parent
94
- * cancellation is composed with first-reason-wins semantics. Compatibility
95
- * scheduling owns exactly one timer and removes its parent listener whenever
96
- * either source aborts. A zero delay remains asynchronous.
97
- *
98
- * The delay must be an integer from `0` through `2_147_483_647`; this common
99
- * signed 32-bit timer ceiling avoids host-specific clamping. The function
100
- * accesses timers and abort constructors only when called and is safe to
101
- * import during server rendering.
102
- *
103
- * @param delayMs Delay in milliseconds.
104
- * @param options Parent signal, timeout reason, and scheduler.
105
- * @default options {}
106
- * @throws {RangeError} Tagged `VIZE_COMPOSE_ABORT_TIMEOUT_INVALID_DELAY` when
107
- * the delay is fractional, negative, non-finite, or exceeds the portable
108
- * timer ceiling.
109
- * @returns A new timeout or parent-cancelled signal.
110
- */
111
64
  function timeoutAbortSignal(delayMs, options = {}) {
112
65
  assertPortableTimeout(delayMs);
113
66
  const parent = options.signal;
@@ -166,21 +119,6 @@ function timeoutAbortSignal(delayMs, options = {}) {
166
119
  }
167
120
  return controller.signal;
168
121
  }
169
- /**
170
- * Create a timeout signal from an absolute Unix-epoch deadline.
171
- *
172
- * Fractional positive differences are rounded up so cancellation never occurs
173
- * before the requested deadline. Past deadlines become an asynchronous
174
- * zero-delay timeout. `Date` and numeric deadlines are both accepted.
175
- *
176
- * @param deadline Absolute deadline as a `Date` or Unix epoch milliseconds.
177
- * @param options Clock, parent signal, timeout reason, and scheduler.
178
- * @default options {}
179
- * @throws {RangeError} Tagged `VIZE_COMPOSE_ABORT_DEADLINE_INVALID` when the
180
- * deadline, current clock value, or their positive difference is non-finite
181
- * or cannot fit the portable timeout range.
182
- * @returns A new deadline or parent-cancelled signal.
183
- */
184
122
  function deadlineAbortSignal(deadline, options = {}) {
185
123
  const deadlineMs = deadline instanceof Date ? deadline.getTime() : deadline;
186
124
  const nowMs = (options.now ?? Date.now)();
@@ -1,17 +1,6 @@
1
1
  import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { hasInjectionContext, onMounted, shallowRef, toValue, watch } from "vue";
3
3
  //#region src/active-element.ts
4
- /**
5
- * Track the focused element of a document.
6
- *
7
- * Listens for capturing `focus`/`blur` events on the document, so focus
8
- * changes anywhere (including inside shadow trees) update the ref.
9
- * Server renders expose `null`. Listeners are removed with the owning scope.
10
- *
11
- * @param options Shadow-DOM traversal and document capability.
12
- * @default options {}
13
- * @returns Readonly shallow ref of the active element.
14
- */
15
4
  function useActiveElement(options = {}) {
16
5
  const deep = options.deep ?? true;
17
6
  const active = shallowRef(null);
package/dist/animate.mjs CHANGED
@@ -2,21 +2,6 @@ import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { resolveElement } from "./element-target.mjs";
3
3
  import { computed, readonly, ref, shallowRef, toValue, watch } from "vue";
4
4
  //#region src/animate.ts
5
- /**
6
- * Drive the Web Animations API reactively with typed keyframes.
7
- *
8
- * Keyframe property names are checked against `CSSStyleDeclaration`, so typos
9
- * are compile errors. Changing keyframes updates the running effect in place.
10
- * Playback state is synced after every control call, on `finish`/`cancel`/
11
- * `remove`, and every animation frame while running. The animation is
12
- * cancelled when the owning reactive scope stops. Nothing runs during server
13
- * rendering (`playState` is `"idle"`).
14
- *
15
- * @param target Reactive element target.
16
- * @param keyframes Reactive typed keyframes (`null` to pause creation).
17
- * @param options Duration in milliseconds, or timing plus lifecycle options.
18
- * @returns Reactive playback state and controls.
19
- */
20
5
  function useAnimate(target, keyframes, options) {
21
6
  const { immediate = true, commitStyles = false, persist = false, onReady, onError, frameHost, ...timing } = typeof options === "number" ? { duration: options } : options;
22
7
  const animation = shallowRef(null);
@@ -135,10 +120,6 @@ function useAnimate(target, keyframes, options) {
135
120
  cancel: control(cancelAnimation)
136
121
  };
137
122
  }
138
- /** Observe the current promises before cancellation, including after replay.
139
- * Cancellation rejects both promises with AbortError; handling that expected
140
- * lifecycle result leaves the original promises available to their consumers.
141
- */
142
123
  function cancelAnimation(animation) {
143
124
  animation.finished.catch(() => void 0);
144
125
  animation.ready.catch(() => void 0);
@@ -1,23 +1,6 @@
1
1
  import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { computed, shallowRef } from "vue";
3
3
  //#region src/async-resource.ts
4
- /**
5
- * Create a scoped, abortable asynchronous resource with latest-result-wins
6
- * state. Every execution returns a discriminated result, so cancellation,
7
- * supersession, loader failure, and successful `undefined` data stay distinct.
8
- *
9
- * When created inside an active reactive scope (and `scope` is enabled), the
10
- * active execution is aborted when that scope stops; outside a scope,
11
- * cancellation ownership stays with the caller. The execute promise never
12
- * rejects — synchronous and asynchronous loader failures both settle into
13
- * the `"error"` result. Safe during server rendering: no browser globals are
14
- * read and abort reasons use the runtime-native `DOMException`.
15
- *
16
- * @param loader Asynchronous loader receiving the abort context first.
17
- * @param options Data retention, supersession, and scope behavior.
18
- * @default options {}
19
- * @returns Reactive state and controls for the loader.
20
- */
21
4
  function useAsyncResource(loader, options = {}) {
22
5
  const data = shallowRef(options.initialData);
23
6
  const error = shallowRef(void 0);
package/dist/battery.mjs CHANGED
@@ -7,19 +7,6 @@ const batteryEvents = [
7
7
  "dischargingtimechange",
8
8
  "levelchange"
9
9
  ];
10
- /**
11
- * Track the device battery with the Battery Status API.
12
- *
13
- * Server renders (and unsupported browsers) expose a full, charging battery
14
- * (`level: 1`, `charging: true`, times `0`/`Infinity`), which is the
15
- * least alarming deterministic default. Late resolutions after the host
16
- * changed or the scope stopped are ignored, and listeners are removed with
17
- * the owning reactive scope.
18
- *
19
- * @param options Navigator capability.
20
- * @default options {}
21
- * @returns Reactive battery state.
22
- */
23
10
  function useBattery(options = {}) {
24
11
  const isSupported = ref(false);
25
12
  const isReady = ref(false);
@@ -1,7 +1,6 @@
1
1
  import { useMediaQuery } from "./media-query.mjs";
2
2
  import { computed } from "vue";
3
3
  //#region src/breakpoints.ts
4
- /** Tailwind CSS default breakpoints. */
5
4
  const breakpointsTailwind = {
6
5
  sm: 640,
7
6
  md: 768,
@@ -9,7 +8,6 @@ const breakpointsTailwind = {
9
8
  xl: 1280,
10
9
  "2xl": 1536
11
10
  };
12
- /** Bootstrap 5 default breakpoints. */
13
11
  const breakpointsBootstrapV5 = {
14
12
  xs: 0,
15
13
  sm: 576,
@@ -18,20 +16,6 @@ const breakpointsBootstrapV5 = {
18
16
  xl: 1200,
19
17
  xxl: 1400
20
18
  };
21
- /**
22
- * Reactive, typed breakpoint helpers built on media queries.
23
- *
24
- * Breakpoint names are inferred from the map, so typos are compile errors.
25
- * `greater` and `smaller` use fractional offsets (`width > 767.98px`) so
26
- * adjacent breakpoints never overlap. With `ssrWidth`, the server evaluates
27
- * each query arithmetically for deterministic, hydration-stable output.
28
- * Subscriptions are released with the owning reactive scope.
29
- *
30
- * @param breakpoints Named breakpoint map, e.g. {@link breakpointsTailwind}.
31
- * @param options SSR width, font size, and media capability.
32
- * @default options {}
33
- * @returns Per-breakpoint refs plus comparison helpers.
34
- */
35
19
  function useBreakpoints(breakpoints, options = {}) {
36
20
  const rootFontSize = options.rootFontSize ?? 16;
37
21
  const isName = (key) => Object.hasOwn(breakpoints, key);
@@ -74,14 +58,6 @@ function useBreakpoints(breakpoints, options = {}) {
74
58
  active: computed(() => current.value.at(-1) ?? null)
75
59
  };
76
60
  }
77
- /**
78
- * Convert a {@link BreakpointValue} to CSS pixels.
79
- *
80
- * @param value Number of pixels or a `px`/`rem`/`em` length.
81
- * @param rootFontSize Pixels per `rem`/`em`.
82
- * @default rootFontSize 16
83
- * @returns Width in CSS pixels.
84
- */
85
61
  function toPixels(value, rootFontSize = 16) {
86
62
  if (typeof value === "number") return value;
87
63
  const amount = Number.parseFloat(value);
@@ -15,21 +15,9 @@ function unavailableCapability(reason, details) {
15
15
  details
16
16
  };
17
17
  }
18
- /**
19
- * Narrow a capability result to its available branch.
20
- *
21
- * @param result Capability discovery or negotiation result.
22
- * @returns Whether `result.value` is ready for use.
23
- */
24
18
  function isCapabilityAvailable(result) {
25
19
  return result.available;
26
20
  }
27
- /**
28
- * Narrow a capability result to its unavailable branch.
29
- *
30
- * @param result Capability discovery or negotiation result.
31
- * @returns Whether the capability has a typed unavailability reason.
32
- */
33
21
  function isCapabilityUnavailable(result) {
34
22
  return !result.available;
35
23
  }
@@ -1,5 +1,4 @@
1
1
  //#region src/catalog-entries.ts
2
- /** Canonical runtime target ordering used by the catalog. */
3
2
  const allTargets = [
4
3
  "web",
5
4
  "server",
@@ -8,7 +7,6 @@ const allTargets = [
8
7
  "desktop",
9
8
  "terminal"
10
9
  ];
11
- /** Aggregate entry policy, including intentionally isolated subpaths. */
12
10
  const rootEntry = {
13
11
  subpath: ".",
14
12
  source: "src/index.ts",
@@ -202,7 +200,6 @@ const rootEntry = {
202
200
  ],
203
201
  isolatedEntries: ["./resolver", "./temporal"]
204
202
  };
205
- /** Independently importable entries in package export-map order. */
206
203
  const entries = [
207
204
  {
208
205
  subpath: "./abort-signal",
@@ -1757,17 +1754,6 @@ const reactiveTargets = allTargets;
1757
1754
  const browserTargets = ["web", "desktop"];
1758
1755
  //#endregion
1759
1756
  //#region src/catalog.ts
1760
- /**
1761
- * Complete, serializable catalog of the package's public runtime surface.
1762
- *
1763
- * This value is the source of truth for export-map conformance and compressed
1764
- * size gates. It intentionally contains data only: importing the module reads
1765
- * no host globals, creates no subscriptions, and starts no work. Utilities
1766
- * remain marked experimental while the package is pre-1.0. Source-copy
1767
- * installation goes through `vize lib pull`, which copies entries from the
1768
- * versioned `registry/registry.json` shipped in this package's tarball and
1769
- * records per-file provenance in `vize-lib.lock.json`.
1770
- */
1771
1757
  const COMPOSABLE_CATALOG = {
1772
1758
  schemaVersion: 1,
1773
1759
  catalogStability: "stable",
package/dist/catalog.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as COMPOSABLE_CATALOG } from "./catalog-BRX-Wg8B.mjs";
1
+ import { t as COMPOSABLE_CATALOG } from "./catalog-CcpCnLjb.mjs";
2
2
  export { COMPOSABLE_CATALOG };
@@ -3,19 +3,6 @@ import { resolveElement } from "./element-target.mjs";
3
3
  import { useMediaQuery } from "./media-query.mjs";
4
4
  import { computed, hasInjectionContext, onMounted, shallowRef, watch } from "vue";
5
5
  //#region src/color-mode.ts
6
- /**
7
- * Reactive color mode with persistence and DOM application.
8
- *
9
- * The stored mode is read synchronously during setup through the injected
10
- * storage, so a cookie adapter yields identical server and client renders.
11
- * On the client the resolved mode is written to the target's class list (or
12
- * attribute) after each change, optionally with transitions suppressed.
13
- * Nothing touches the DOM during server rendering.
14
- *
15
- * @param options Modes, target, persistence, SSR fallback, and capabilities.
16
- * @default options {}
17
- * @returns Writable mode plus system and resolved state.
18
- */
19
6
  function useColorMode(options = {}) {
20
7
  const modes = {
21
8
  light: "light",
@@ -82,16 +69,6 @@ function useColorMode(options = {}) {
82
69
  stored: computed(() => storedValue.value)
83
70
  };
84
71
  }
85
- /**
86
- * Boolean dark-mode switch built on {@link useColorMode}.
87
- *
88
- * Setting the ref to the current system preference stores `"auto"`, so the
89
- * page keeps following the system until the user picks the opposite mode.
90
- *
91
- * @param options Dark/light values plus {@link useColorMode} options.
92
- * @default options {}
93
- * @returns Writable dark flag.
94
- */
95
72
  function useDark(options = {}) {
96
73
  const { valueDark = "dark", valueLight = "", ...rest } = options;
97
74
  const colorMode = useColorMode({
@@ -1,27 +1,5 @@
1
1
  import { customRef, watch } from "vue";
2
2
  //#region src/computed-with-control.ts
3
- /**
4
- * Computed value whose dependencies are declared explicitly.
5
- *
6
- * Only changes of `source` (or a manual {@link ComputedWithControl.trigger})
7
- * invalidate the cache; reactive reads inside `getter` do not. Useful when
8
- * the getter reads non-reactive data or should ignore some reactive reads.
9
- * The getter receives the previous value and runs lazily on the next read.
10
- * Pure derived state: SSR-safe; the invalidation watcher follows the owning
11
- * reactive scope.
12
- *
13
- * @example
14
- * ```ts
15
- * const snapshot = computedWithControl(version, () => expensiveRead(store));
16
- * snapshot.trigger(); // force a refresh
17
- * ```
18
- *
19
- * @param source Ref, getter, reactive object, or tuple of those.
20
- * @param getter Produces the value from the previous one.
21
- * @param options Depth of the source watch.
22
- * @default options {}
23
- * @returns The controlled computed ref.
24
- */
25
3
  function computedWithControl(source, getter, options = {}) {
26
4
  let dirty = true;
27
5
  let cached;
@@ -1,33 +1,6 @@
1
1
  import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { hasInjectionContext } from "vue";
3
3
  //#region src/create-event-hook.ts
4
- /**
5
- * Create a small, strongly typed event emitter.
6
- *
7
- * The payload is a tuple type, so events can carry several named arguments
8
- * (`createEventHook<[id: string, value: number]>()`) and `trigger` checks
9
- * them. Listeners registered inside an effect scope unsubscribe themselves
10
- * when it stops. Synchronous listener errors propagate from `trigger`;
11
- * async rejections reject the returned promise.
12
- *
13
- * SSR: Vue does not dispose component scopes after a server render, so a
14
- * listener that a server `setup` adds to a module-level hook would never be
15
- * removed and would pile up once per request. By default such registrations
16
- * are therefore skipped (with a one-time development warning); see
17
- * {@link CreateEventHookOptions.serverListeners}. Hooks created inside a
18
- * component, and every registration in the browser, behave normally.
19
- *
20
- * @example
21
- * ```ts
22
- * const saved = createEventHook<[id: string]>();
23
- * saved.on((id) => toast(`Saved ${id}`));
24
- * await saved.trigger("doc-1");
25
- * ```
26
- *
27
- * @param options Server-side registration policy.
28
- * @default options {}
29
- * @returns The event hook.
30
- */
31
4
  function createEventHook(options = {}) {
32
5
  const listeners = /* @__PURE__ */ new Set();
33
6
  const shared = !hasInjectionContext();
@@ -1,28 +1,5 @@
1
1
  import { effectScope } from "vue";
2
2
  //#region src/create-global-state.ts
3
- /**
4
- * Lift a state factory into application-wide state shared by every caller.
5
- *
6
- * The factory runs once, lazily on the first call, inside a detached effect
7
- * scope so its watchers and computeds outlive any component; every later
8
- * call returns the same state. On the server every call runs the factory
9
- * afresh in the caller's scope unless `shareOnServer` is set, so request
10
- * state never leaks; keep per-request state in
11
- * `provide`/`createInjectionState` instead.
12
- *
13
- * @example
14
- * ```ts
15
- * const useCommandPalette = createGlobalState(() => ({ open: shallowRef(false) }));
16
- * useCommandPalette().open.value = true;
17
- * ```
18
- *
19
- * @param factory Creates the state; may use any composable.
20
- * @param options Server sharing policy.
21
- * @default options {}
22
- * @throws `Error` tagged `VIZE_COMPOSE_GLOBAL_STATE_INACTIVE_SCOPE` if the
23
- * private scope cannot run (never expected in practice).
24
- * @returns Accessor returning the shared state.
25
- */
26
3
  function createGlobalState(factory, options = {}) {
27
4
  let created;
28
5
  return () => {
@@ -1,29 +1,6 @@
1
1
  import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { effectScope } from "vue";
3
3
  //#region src/create-shared-composable.ts
4
- /**
5
- * Share one instance of a composable between all simultaneously mounted
6
- * callers, reference-counted by their effect scopes.
7
- *
8
- * The first caller creates the instance inside a detached scope using its
9
- * arguments (later callers' arguments are ignored while it lives). When the
10
- * last subscribing scope stops, the instance's scope is stopped and the next
11
- * call starts fresh. Calls outside any effect scope subscribe permanently.
12
- * On the server every call gets its own instance unless `shareOnServer` is
13
- * set, so request state never leaks.
14
- *
15
- * @example
16
- * ```ts
17
- * const useSharedMouse = createSharedComposable(useMouse);
18
- * ```
19
- *
20
- * @param composable Composable to share.
21
- * @param options Server sharing policy.
22
- * @default options {}
23
- * @throws `Error` tagged `VIZE_COMPOSE_SHARED_COMPOSABLE_INACTIVE_SCOPE` if
24
- * the private scope cannot run (never expected in practice).
25
- * @returns A composable with the same signature that shares its result.
26
- */
27
4
  function createSharedComposable(composable, options = {}) {
28
5
  let subscribers = 0;
29
6
  let shared;
@@ -2,17 +2,6 @@ import { tryOnScopeDispose } from "./scope.mjs";
2
2
  import { requestMotionPermission } from "./device-orientation.mjs";
3
3
  import { hasInjectionContext, onMounted, readonly, ref, shallowRef, toValue, watch } from "vue";
4
4
  //#region src/device-motion.ts
5
- /**
6
- * Track device acceleration and rotation rate.
7
- *
8
- * Readings are copied into plain snapshots. Server renders expose `null`
9
- * readings and `isSupported: false`; the listener is removed with the owning
10
- * reactive scope. Shares the permission model of `useDeviceOrientation`.
11
- *
12
- * @param options Window capability.
13
- * @default options {}
14
- * @returns Reactive readings, support/permission state, and a permission action.
15
- */
16
5
  function useDeviceMotion(options = {}) {
17
6
  const isSupported = ref(false);
18
7
  const acceleration = shallowRef(null);
@@ -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/device-orientation.ts
4
- /**
5
- * Track device orientation angles.
6
- *
7
- * Server renders expose `null` angles and `isSupported: false`. The listener
8
- * follows the reactive host and is removed with the owning reactive scope.
9
- * On platforms with a permission prompt, `permission` starts as `"prompt"`
10
- * and readings arrive only after `requestPermission` resolves `"granted"`.
11
- *
12
- * @param options Frame selection and window capability.
13
- * @default options {}
14
- * @returns Reactive angles, support/permission state, and a permission action.
15
- */
16
4
  function useDeviceOrientation(options = {}) {
17
5
  const isSupported = ref(false);
18
6
  const isAbsolute = ref(false);
@@ -55,17 +43,6 @@ function useDeviceOrientation(options = {}) {
55
43
  }
56
44
  };
57
45
  }
58
- /**
59
- * Request motion/orientation sensor permission from an event constructor.
60
- *
61
- * Normalizes the platform result to {@link MotionPermissionState}. Missing
62
- * constructors resolve `"denied"`; constructors without a prompt resolve
63
- * `"granted"`; unknown results resolve `"prompt"`. Rejections (for example
64
- * when not called from a user gesture) resolve `"denied"` instead of throwing.
65
- *
66
- * @param constructor `DeviceOrientationEvent` or `DeviceMotionEvent`.
67
- * @returns The normalized permission state.
68
- */
69
46
  async function requestMotionPermission(constructor) {
70
47
  if (!constructor) return "denied";
71
48
  if (typeof constructor.requestPermission !== "function") return "granted";
@@ -1,17 +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/device-pixel-ratio.ts
4
- /**
5
- * Track `window.devicePixelRatio` (zoom and moving between displays).
6
- *
7
- * Subscribes to a `(resolution: <ratio>dppx)` media query and re-subscribes
8
- * with the new ratio after each change, which is the only change signal the
9
- * platform offers. Server renders expose `ssrPixelRatio`.
10
- *
11
- * @param options Server fallback and window capability.
12
- * @default options {}
13
- * @returns Reactive ratio and support flag.
14
- */
15
4
  function useDevicePixelRatio(options = {}) {
16
5
  const fallback = options.ssrPixelRatio ?? 1;
17
6
  const pixelRatio = ref(fallback);
@@ -1,38 +1,13 @@
1
1
  import { tryOnScopeDispose } from "./scope.mjs";
2
2
  //#region src/disposal-scope.ts
3
- /** Stable error code reported when one or more owned cleanups fail. */
4
3
  const DISPOSAL_ERROR_CODE = "VIZE_COMPOSE_DISPOSAL_FAILED";
5
- /** Aggregate failure produced after every owned cleanup has been attempted. */
6
4
  var DisposalError = class extends AggregateError {
7
- /** Stable machine-readable error code. */
8
5
  code = DISPOSAL_ERROR_CODE;
9
- /**
10
- * Create an aggregate disposal failure.
11
- *
12
- * Nested {@link DisposalError} instances are flattened by the scope before
13
- * construction, so `errors` contains the original cleanup failures in
14
- * execution order.
15
- *
16
- * @param errors Cleanup failures in deterministic execution order.
17
- */
18
6
  constructor(errors) {
19
7
  super(errors, `[${DISPOSAL_ERROR_CODE}] ${String(errors.length)} cleanup operation(s) failed.`);
20
8
  this.name = "DisposalError";
21
9
  }
22
10
  };
23
- /**
24
- * Create an explicit, deterministic cleanup owner.
25
- *
26
- * The owner is runtime-neutral and performs no browser-global access. By
27
- * default it joins an active Vue reactive scope; when no scope exists, or
28
- * `scope` is disabled, the caller must invoke `dispose()`. Cleanups are
29
- * synchronous by contract so disposal completes before the owner releases
30
- * its records.
31
- *
32
- * @param options Reactive-scope ownership behavior.
33
- * @default options {}
34
- * @returns A disposal owner with child-lifetime support.
35
- */
36
11
  function createDisposalScope(options = {}) {
37
12
  const owner = createOwner();
38
13
  if (options.scope ?? true) tryOnScopeDispose(owner.dispose);
@@ -1,19 +1,5 @@
1
1
  import { computed, hasInjectionContext, onMounted, readonly, ref, shallowRef, toValue, watchEffect } from "vue";
2
2
  //#region src/document-visibility.ts
3
- /**
4
- * Observe document visibility without touching browser globals during module evaluation.
5
- *
6
- * The composable is safe during server rendering: when no host resolves, it exposes
7
- * `ssrState` and marks `supported` false. During hydration or tests, passing a
8
- * host attaches exactly one `visibilitychange` listener and removes it when the
9
- * reactive host changes or the owning scope stops. Unsupported or future
10
- * visibility states normalize to `"hidden"` so consumers fail closed instead of
11
- * accidentally treating a prerendered or unloaded page as visible.
12
- *
13
- * @param options Runtime capability, server fallback, and watcher timing.
14
- * @default options {}
15
- * @returns Reactive visibility state plus derived booleans.
16
- */
17
3
  function useDocumentVisibility(options = {}) {
18
4
  const fallback = options.ssrState ?? "visible";
19
5
  const state = ref(fallback);
@@ -3,20 +3,6 @@ import { isElementNode, resolveElement } from "./element-target.mjs";
3
3
  import { toPointerKind } from "./pointer.mjs";
4
4
  import { computed, readonly, ref, toValue, watch } from "vue";
5
5
  //#region src/draggable.ts
6
- /**
7
- * Make an element draggable with Pointer Events.
8
- *
9
- * `pointerdown` on the handle records the offset between the pointer and the
10
- * element; moves are tracked on the owner document (so fast drags that leave
11
- * the element keep working) and constrained by `axis` and `bounds`. `x`/`y`
12
- * are writable for programmatic placement. Server renders expose
13
- * `initialValue`; listeners are removed with the owning reactive scope.
14
- *
15
- * @param target Reactive element being dragged.
16
- * @param options Handle, axis, bounds, device filter, and lifecycle callbacks.
17
- * @default options {}
18
- * @returns Writable position, drag flag, inline style, and stop control.
19
- */
20
6
  function useDraggable(target, options = {}) {
21
7
  const initial = options.initialValue ?? {
22
8
  x: 0,
@@ -14,20 +14,6 @@ const boundingKeys = [
14
14
  "width",
15
15
  "height"
16
16
  ];
17
- /**
18
- * Track an element's `getBoundingClientRect()` reactively.
19
- *
20
- * Measures when the target resolves, when it resizes (via `ResizeObserver`),
21
- * and — unless disabled — when the window resizes or anything scrolls. Every
22
- * value is `0` during server rendering and before the first measurement, so
23
- * the initial render is hydration-stable. Listeners and the observer are
24
- * released with the owning reactive scope.
25
- *
26
- * @param target Reactive element target.
27
- * @param options Reset, listener, capability, and timing options.
28
- * @default options {}
29
- * @returns One readonly ref per geometry field plus `update`/`stop`.
30
- */
31
17
  function useElementBounding(target, options = {}) {
32
18
  const { reset = true, windowResize = true, windowScroll = true } = options;
33
19
  const flush = options.flush ?? "post";
@@ -1,16 +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/element-by-point.ts
4
- /**
5
- * Track the element(s) under a client coordinate.
6
- *
7
- * Re-queries whenever `x`/`y` change and, with `poll`, on every animation
8
- * frame until the owning scope stops. Server renders expose `null` and an
9
- * empty list.
10
- *
11
- * @param options Coordinates, polling, and capabilities.
12
- * @returns Reactive topmost element, element stack, and a manual update.
13
- */
14
4
  function useElementByPoint(options) {
15
5
  const isSupported = ref(false);
16
6
  const element = shallowRef(null);