@vizejs/composable 0.426.3 → 0.427.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.
- package/dist/abort-signal.d.mts +1 -1
- package/dist/active-element.d.mts +37 -0
- package/dist/active-element.mjs +56 -0
- package/dist/animate.d.mts +114 -0
- package/dist/animate.mjs +157 -0
- package/dist/battery.d.mts +61 -0
- package/dist/battery.mjs +90 -0
- package/dist/breakpoints.d.mts +82 -0
- package/dist/breakpoints.mjs +91 -0
- package/dist/catalog-BeTXFKxF.d.mts +4188 -0
- package/dist/catalog-r4Z5nptX.mjs +5144 -0
- package/dist/catalog.d.mts +1 -1
- package/dist/catalog.mjs +1 -1
- package/dist/color-mode.d.mts +131 -0
- package/dist/color-mode.mjs +133 -0
- package/dist/computed-async.d.mts +63 -0
- package/dist/computed-async.mjs +43 -0
- package/dist/computed-with-control.d.mts +44 -0
- package/dist/computed-with-control.mjs +54 -0
- package/dist/create-event-hook.d.mts +77 -0
- package/dist/create-event-hook.mjs +66 -0
- package/dist/create-global-state.d.mts +24 -0
- package/dist/create-global-state.mjs +34 -0
- package/dist/create-injection-state.d.mts +51 -0
- package/dist/create-injection-state.mjs +19 -0
- package/dist/create-shared-composable.d.mts +38 -0
- package/dist/create-shared-composable.mjs +54 -0
- package/dist/device-motion.d.mts +71 -0
- package/dist/device-motion.mjs +75 -0
- package/dist/device-orientation.d.mts +82 -0
- package/dist/device-orientation.mjs +86 -0
- package/dist/device-pixel-ratio.d.mts +45 -0
- package/dist/device-pixel-ratio.mjs +50 -0
- package/dist/document-visibility.mjs +6 -2
- package/dist/draggable.d.mts +121 -0
- package/dist/draggable.mjs +153 -0
- package/dist/element-bounding.d.mts +87 -0
- package/dist/element-bounding.mjs +95 -0
- package/dist/element-by-point.d.mts +70 -0
- package/dist/element-by-point.mjs +69 -0
- package/dist/element-hover.d.mts +42 -0
- package/dist/element-hover.mjs +70 -0
- package/dist/element-ref.d.mts +34 -0
- package/dist/element-ref.mjs +23 -0
- package/dist/element-target-Crpxl4D9.d.mts +60 -0
- package/dist/element-target.d.mts +2 -0
- package/dist/element-target.mjs +58 -0
- package/dist/event-listener.mjs +7 -3
- package/dist/focus.d.mts +69 -0
- package/dist/focus.mjs +124 -0
- package/dist/fps.d.mts +59 -0
- package/dist/fps.mjs +64 -0
- package/dist/geolocation.d.mts +98 -0
- package/dist/geolocation.mjs +86 -0
- package/dist/i18n.d.mts +237 -0
- package/dist/i18n.mjs +215 -0
- package/dist/icu-message.d.mts +235 -0
- package/dist/icu-message.mjs +343 -0
- package/dist/idle.d.mts +79 -0
- package/dist/idle.mjs +90 -0
- package/dist/index.d.mts +172 -6
- package/dist/index.mjs +173 -7
- package/dist/infinite-scroll.d.mts +56 -0
- package/dist/infinite-scroll.mjs +72 -0
- package/dist/intersection-observer.d.mts +122 -0
- package/dist/intersection-observer.mjs +117 -0
- package/dist/magic-keys.d.mts +121 -0
- package/dist/magic-keys.mjs +163 -0
- package/dist/math.d.mts +96 -0
- package/dist/math.mjs +84 -0
- package/dist/media-query.d.mts +3 -1
- package/dist/media-query.mjs +5 -3
- package/dist/mouse-in-element.d.mts +49 -0
- package/dist/mouse-in-element.mjs +66 -0
- package/dist/mouse.d.mts +77 -0
- package/dist/mouse.mjs +100 -0
- package/dist/mutation-observer.d.mts +98 -0
- package/dist/mutation-observer.mjs +69 -0
- package/dist/network.d.mts +96 -0
- package/dist/network.mjs +117 -0
- package/dist/on-click-outside.d.mts +69 -0
- package/dist/on-click-outside.mjs +115 -0
- package/dist/on-key-stroke.d.mts +71 -0
- package/dist/on-key-stroke.mjs +79 -0
- package/dist/on-long-press.d.mts +82 -0
- package/dist/on-long-press.mjs +105 -0
- package/dist/on-start-typing.d.mts +44 -0
- package/dist/on-start-typing.mjs +61 -0
- package/dist/page-leave.d.mts +26 -0
- package/dist/page-leave.mjs +40 -0
- package/dist/parent-element.d.mts +16 -0
- package/dist/parent-element.mjs +27 -0
- package/dist/pinch.d.mts +73 -0
- package/dist/pinch.mjs +138 -0
- package/dist/pointer-lock.d.mts +79 -0
- package/dist/pointer-lock.mjs +126 -0
- package/dist/pointer.d.mts +78 -0
- package/dist/pointer.mjs +95 -0
- package/dist/preferences.d.mts +55 -0
- package/dist/preferences.mjs +63 -0
- package/dist/preferred-languages.d.mts +43 -0
- package/dist/preferred-languages.mjs +44 -0
- package/dist/reactify.d.mts +28 -0
- package/dist/reactify.mjs +7 -0
- package/dist/ref-auto-reset.d.mts +47 -0
- package/dist/ref-auto-reset.mjs +70 -0
- package/dist/ref-debounced.d.mts +29 -0
- package/dist/ref-debounced.mjs +29 -0
- package/dist/ref-default.d.mts +27 -0
- package/dist/ref-default.mjs +33 -0
- package/dist/resize-observer.d.mts +96 -0
- package/dist/resize-observer.mjs +111 -0
- package/dist/resolver.d.mts +124 -0
- package/dist/resolver.mjs +138 -0
- package/dist/retry-async.d.mts +2 -2
- package/dist/retry-delay-DYsdq4SE.d.mts +73 -0
- package/dist/retry-delay.d.mts +1 -72
- package/dist/screen-orientation.d.mts +77 -0
- package/dist/screen-orientation.mjs +74 -0
- package/dist/scroll-lock.d.mts +37 -0
- package/dist/scroll-lock.mjs +50 -0
- package/dist/scroll.d.mts +158 -0
- package/dist/scroll.mjs +172 -0
- package/dist/standard-schema-DmNgFVK5.d.mts +107 -0
- package/dist/standard-schema.d.mts +2 -0
- package/dist/standard-schema.mjs +60 -0
- package/dist/swipe.d.mts +125 -0
- package/dist/swipe.mjs +225 -0
- package/dist/sync-ref.d.mts +80 -0
- package/dist/sync-ref.mjs +43 -0
- package/dist/text-selection.d.mts +46 -0
- package/dist/text-selection.mjs +62 -0
- package/dist/textarea-autosize.d.mts +58 -0
- package/dist/textarea-autosize.mjs +54 -0
- package/dist/timeout-scheduler-CI8RVLZs.d.mts +18 -0
- package/dist/timeout-scheduler.d.mts +1 -17
- package/dist/to-reactive.d.mts +26 -0
- package/dist/to-reactive.mjs +46 -0
- package/dist/transition.d.mts +125 -0
- package/dist/transition.mjs +266 -0
- package/dist/until.d.mts +177 -0
- package/dist/until.mjs +111 -0
- package/dist/use-array.d.mts +112 -0
- package/dist/use-array.mjs +90 -0
- package/dist/use-async-queue.d.mts +109 -0
- package/dist/use-async-queue.mjs +96 -0
- package/dist/use-async-state.d.mts +86 -0
- package/dist/use-async-state.mjs +41 -0
- package/dist/use-barcode-detector.d.mts +159 -0
- package/dist/use-barcode-detector.mjs +143 -0
- package/dist/use-bluetooth.d.mts +164 -0
- package/dist/use-bluetooth.mjs +183 -0
- package/dist/use-broadcast-channel.d.mts +115 -0
- package/dist/use-broadcast-channel.mjs +121 -0
- package/dist/use-builtin-ai.d.mts +342 -0
- package/dist/use-builtin-ai.mjs +261 -0
- package/dist/use-clipboard.d.mts +169 -0
- package/dist/use-clipboard.mjs +226 -0
- package/dist/use-compression-stream.d.mts +173 -0
- package/dist/use-compression-stream.mjs +166 -0
- package/dist/use-confirm-dialog.d.mts +70 -0
- package/dist/use-confirm-dialog.mjs +57 -0
- package/dist/use-contact-picker.d.mts +117 -0
- package/dist/use-contact-picker.mjs +103 -0
- package/dist/use-cookie.d.mts +196 -0
- package/dist/use-cookie.mjs +259 -0
- package/dist/use-countdown.d.mts +85 -0
- package/dist/use-countdown.mjs +74 -0
- package/dist/use-css-var.d.mts +96 -0
- package/dist/use-css-var.mjs +104 -0
- package/dist/use-cycle-list.d.mts +76 -0
- package/dist/use-cycle-list.mjs +39 -0
- package/dist/use-date-format.d.mts +103 -0
- package/dist/use-date-format.mjs +147 -0
- package/dist/use-date-time-format.d.mts +75 -0
- package/dist/use-date-time-format.mjs +53 -0
- package/dist/use-debounced.d.mts +1 -1
- package/dist/use-display-media.d.mts +62 -0
- package/dist/use-display-media.mjs +46 -0
- package/dist/use-display-names.d.mts +75 -0
- package/dist/use-display-names.mjs +52 -0
- package/dist/use-document-title.d.mts +88 -0
- package/dist/use-document-title.mjs +100 -0
- package/dist/use-drop-zone.d.mts +128 -0
- package/dist/use-drop-zone.mjs +154 -0
- package/dist/use-event-source.d.mts +184 -0
- package/dist/use-event-source.mjs +226 -0
- package/dist/use-eye-dropper.d.mts +79 -0
- package/dist/use-eye-dropper.mjs +68 -0
- package/dist/use-favicon.d.mts +78 -0
- package/dist/use-favicon.mjs +68 -0
- package/dist/use-fetch.d.mts +230 -0
- package/dist/use-fetch.mjs +263 -0
- package/dist/use-field.d.mts +107 -0
- package/dist/use-field.mjs +117 -0
- package/dist/use-file-dialog.d.mts +139 -0
- package/dist/use-file-dialog.mjs +101 -0
- package/dist/use-file-system-access.d.mts +184 -0
- package/dist/use-file-system-access.mjs +151 -0
- package/dist/use-form-field-props.d.mts +235 -0
- package/dist/use-form-field-props.mjs +164 -0
- package/dist/use-form.d.mts +324 -0
- package/dist/use-form.mjs +482 -0
- package/dist/use-fullscreen.d.mts +104 -0
- package/dist/use-fullscreen.mjs +95 -0
- package/dist/use-gamepad.d.mts +242 -0
- package/dist/use-gamepad.mjs +218 -0
- package/dist/use-hid.d.mts +160 -0
- package/dist/use-hid.mjs +156 -0
- package/dist/use-id-generator.d.mts +44 -0
- package/dist/use-id-generator.mjs +38 -0
- package/dist/use-image.d.mts +125 -0
- package/dist/use-image.mjs +109 -0
- package/dist/use-indexed-db.d.mts +207 -0
- package/dist/use-indexed-db.mjs +251 -0
- package/dist/use-interval-BA55gTHT.d.mts +140 -0
- package/dist/use-interval.d.mts +2 -0
- package/dist/use-interval.mjs +100 -0
- package/dist/use-list-format.d.mts +60 -0
- package/dist/use-list-format.mjs +40 -0
- package/dist/use-machine.d.mts +90 -0
- package/dist/use-machine.mjs +78 -0
- package/dist/use-map.d.mts +90 -0
- package/dist/use-map.mjs +70 -0
- package/dist/use-media-controls.d.mts +198 -0
- package/dist/use-media-controls.mjs +264 -0
- package/dist/use-memoize.d.mts +73 -0
- package/dist/use-memoize.mjs +28 -0
- package/dist/use-mounted.d.mts +24 -0
- package/dist/use-mounted.mjs +29 -0
- package/dist/use-navigation-api.d.mts +360 -0
- package/dist/use-navigation-api.mjs +231 -0
- package/dist/use-notification.d.mts +139 -0
- package/dist/use-notification.mjs +131 -0
- package/dist/use-now.d.mts +137 -0
- package/dist/use-now.mjs +44 -0
- package/dist/use-number-format.d.mts +73 -0
- package/dist/use-number-format.mjs +58 -0
- package/dist/use-object-url.d.mts +47 -0
- package/dist/use-object-url.mjs +54 -0
- package/dist/use-offset-pagination.d.mts +91 -0
- package/dist/use-offset-pagination.mjs +80 -0
- package/dist/use-payment-request.d.mts +239 -0
- package/dist/use-payment-request.mjs +206 -0
- package/dist/use-performance-observer.d.mts +285 -0
- package/dist/use-performance-observer.mjs +132 -0
- package/dist/use-permission.d.mts +99 -0
- package/dist/use-permission.mjs +92 -0
- package/dist/use-plural-rules.d.mts +79 -0
- package/dist/use-plural-rules.mjs +59 -0
- package/dist/use-push-subscription.d.mts +154 -0
- package/dist/use-push-subscription.mjs +146 -0
- package/dist/use-queue.d.mts +89 -0
- package/dist/use-queue.mjs +116 -0
- package/dist/use-raf-fn.d.mts +87 -0
- package/dist/use-raf-fn.mjs +99 -0
- package/dist/use-relative-time-format.d.mts +111 -0
- package/dist/use-relative-time-format.mjs +119 -0
- package/dist/use-request-idle-callback.d.mts +122 -0
- package/dist/use-request-idle-callback.mjs +147 -0
- package/dist/use-route-query.d.mts +149 -0
- package/dist/use-route-query.mjs +86 -0
- package/dist/use-scheduler-post-task.d.mts +156 -0
- package/dist/use-scheduler-post-task.mjs +182 -0
- package/dist/use-screen-details.d.mts +205 -0
- package/dist/use-screen-details.mjs +188 -0
- package/dist/use-script-tag.d.mts +162 -0
- package/dist/use-script-tag.mjs +171 -0
- package/dist/use-segmenter.d.mts +78 -0
- package/dist/use-segmenter.mjs +66 -0
- package/dist/use-selection.d.mts +125 -0
- package/dist/use-selection.mjs +77 -0
- package/dist/use-serial.d.mts +165 -0
- package/dist/use-serial.mjs +205 -0
- package/dist/use-service-worker.d.mts +177 -0
- package/dist/use-service-worker.mjs +178 -0
- package/dist/use-set.d.mts +96 -0
- package/dist/use-set.mjs +74 -0
- package/dist/use-share.d.mts +92 -0
- package/dist/use-share.mjs +99 -0
- package/dist/use-sorted-locale.d.mts +62 -0
- package/dist/use-sorted-locale.mjs +52 -0
- package/dist/use-sorted.d.mts +29 -0
- package/dist/use-sorted.mjs +14 -0
- package/dist/use-speech-recognition.d.mts +150 -0
- package/dist/use-speech-recognition.mjs +168 -0
- package/dist/use-speech-synthesis.d.mts +148 -0
- package/dist/use-speech-synthesis.mjs +152 -0
- package/dist/use-stack.d.mts +83 -0
- package/dist/use-stack.mjs +93 -0
- package/dist/use-stepper.d.mts +79 -0
- package/dist/use-stepper.mjs +52 -0
- package/dist/use-storage-estimate.d.mts +151 -0
- package/dist/use-storage-estimate.mjs +170 -0
- package/dist/use-storage.d.mts +214 -0
- package/dist/use-storage.mjs +415 -0
- package/dist/use-style-tag.d.mts +102 -0
- package/dist/use-style-tag.mjs +91 -0
- package/dist/use-supported.d.mts +23 -0
- package/dist/use-supported.mjs +26 -0
- package/dist/use-throttled.d.mts +1 -1
- package/dist/use-time-ago.d.mts +163 -0
- package/dist/use-time-ago.mjs +95 -0
- package/dist/use-timeout.d.mts +122 -0
- package/dist/use-timeout.mjs +65 -0
- package/dist/use-url-hash.d.mts +88 -0
- package/dist/use-url-hash.mjs +145 -0
- package/dist/use-url-search-params.d.mts +223 -0
- package/dist/use-url-search-params.mjs +295 -0
- package/dist/use-usb.d.mts +212 -0
- package/dist/use-usb.mjs +137 -0
- package/dist/use-user-activation.d.mts +83 -0
- package/dist/use-user-activation.mjs +113 -0
- package/dist/use-user-media.d.mts +194 -0
- package/dist/use-user-media.mjs +214 -0
- package/dist/use-v-model.d.mts +113 -0
- package/dist/use-v-model.mjs +40 -0
- package/dist/use-vibrate.d.mts +81 -0
- package/dist/use-vibrate.mjs +90 -0
- package/dist/use-view-transition.d.mts +106 -0
- package/dist/use-view-transition.mjs +101 -0
- package/dist/use-visual-viewport.d.mts +105 -0
- package/dist/use-visual-viewport.mjs +104 -0
- package/dist/use-wake-lock.d.mts +96 -0
- package/dist/use-wake-lock.mjs +106 -0
- package/dist/use-web-authn.d.mts +404 -0
- package/dist/use-web-authn.mjs +323 -0
- package/dist/use-web-locks.d.mts +180 -0
- package/dist/use-web-locks.mjs +136 -0
- package/dist/use-web-midi.d.mts +148 -0
- package/dist/use-web-midi.mjs +140 -0
- package/dist/use-web-vitals.d.mts +142 -0
- package/dist/use-web-vitals.mjs +248 -0
- package/dist/use-websocket.d.mts +218 -0
- package/dist/use-websocket.mjs +257 -0
- package/dist/use-worker-fn.d.mts +119 -0
- package/dist/use-worker-fn.mjs +162 -0
- package/dist/virtual-list.d.mts +105 -0
- package/dist/virtual-list.mjs +128 -0
- package/dist/watch-debounced.d.mts +84 -0
- package/dist/watch-debounced.mjs +84 -0
- package/dist/watch-ignorable.d.mts +47 -0
- package/dist/watch-ignorable.mjs +61 -0
- package/dist/watch-once.d.mts +29 -0
- package/dist/watch-once.mjs +10 -0
- package/dist/watch-pausable.d.mts +51 -0
- package/dist/watch-pausable.mjs +23 -0
- package/dist/watch-source.d.mts +29 -0
- package/dist/watch-source.mjs +1 -0
- package/dist/watch-throttled.d.mts +70 -0
- package/dist/watch-throttled.mjs +94 -0
- package/dist/whenever.d.mts +39 -0
- package/dist/whenever.mjs +41 -0
- package/dist/window-size.d.mts +87 -0
- package/dist/window-size.mjs +65 -0
- package/package.json +846 -5
- package/registry/files/abort-signal.ts +292 -0
- package/registry/files/active-element.ts +93 -0
- package/registry/files/animate.ts +322 -0
- package/registry/files/async-resource.ts +190 -0
- package/registry/files/battery.ts +166 -0
- package/registry/files/breakpoints.ts +166 -0
- package/registry/files/capability.ts +171 -0
- package/registry/files/color-mode.ts +274 -0
- package/registry/files/computed-async.ts +123 -0
- package/registry/files/computed-with-control.ts +80 -0
- package/registry/files/create-event-hook.ts +139 -0
- package/registry/files/create-global-state.ts +34 -0
- package/registry/files/create-injection-state.ts +75 -0
- package/registry/files/create-shared-composable.ts +74 -0
- package/registry/files/device-motion.ts +152 -0
- package/registry/files/device-orientation.ts +168 -0
- package/registry/files/device-pixel-ratio.ts +100 -0
- package/registry/files/disposal-scope.ts +201 -0
- package/registry/files/document-visibility.ts +152 -0
- package/registry/files/draggable.ts +273 -0
- package/registry/files/element-bounding.ts +175 -0
- package/registry/files/element-by-point.ts +149 -0
- package/registry/files/element-hover.ts +104 -0
- package/registry/files/element-ref.ts +58 -0
- package/registry/files/element-target.ts +99 -0
- package/registry/files/event-listener.ts +188 -0
- package/registry/files/focus.ts +181 -0
- package/registry/files/fps.ts +133 -0
- package/registry/files/geolocation.ts +214 -0
- package/registry/files/i18n.ts +524 -0
- package/registry/files/icu-message.ts +701 -0
- package/registry/files/idle.ts +176 -0
- package/registry/files/infinite-scroll.ts +135 -0
- package/registry/files/intersection-observer.ts +261 -0
- package/registry/files/locale.ts +148 -0
- package/registry/files/magic-keys.ts +298 -0
- package/registry/files/math.ts +175 -0
- package/registry/files/media-query.ts +102 -0
- package/registry/files/mouse-in-element.ts +107 -0
- package/registry/files/mouse.ts +167 -0
- package/registry/files/mutation-observer.ts +183 -0
- package/registry/files/network.ts +229 -0
- package/registry/files/on-click-outside.ts +178 -0
- package/registry/files/on-key-stroke.ts +135 -0
- package/registry/files/on-long-press.ts +188 -0
- package/registry/files/on-start-typing.ts +88 -0
- package/registry/files/page-leave.ts +57 -0
- package/registry/files/parent-element.ts +29 -0
- package/registry/files/pinch.ts +187 -0
- package/registry/files/pointer-lock.ts +232 -0
- package/registry/files/pointer.ts +153 -0
- package/registry/files/preferences.ts +98 -0
- package/registry/files/preferred-languages.ts +88 -0
- package/registry/files/reactify.ts +39 -0
- package/registry/files/ref-auto-reset.ts +102 -0
- package/registry/files/ref-debounced.ts +34 -0
- package/registry/files/ref-default.ts +35 -0
- package/registry/files/resize-observer.ts +220 -0
- package/registry/files/retry-async.ts +261 -0
- package/registry/files/retry-delay.ts +132 -0
- package/registry/files/scope.ts +21 -0
- package/registry/files/screen-orientation.ts +165 -0
- package/registry/files/scroll-lock.ts +80 -0
- package/registry/files/scroll.ts +338 -0
- package/registry/files/standard-schema.ts +163 -0
- package/registry/files/swipe.ts +321 -0
- package/registry/files/sync-ref.ts +166 -0
- package/registry/files/temporal.ts +182 -0
- package/registry/files/text-selection.ts +110 -0
- package/registry/files/textarea-autosize.ts +114 -0
- package/registry/files/timeout-scheduler.ts +16 -0
- package/registry/files/to-reactive.ts +44 -0
- package/registry/files/transition.ts +271 -0
- package/registry/files/until.ts +352 -0
- package/registry/files/use-array.ts +201 -0
- package/registry/files/use-async-queue.ts +278 -0
- package/registry/files/use-async-state.ts +139 -0
- package/registry/files/use-barcode-detector.ts +321 -0
- package/registry/files/use-bluetooth.ts +409 -0
- package/registry/files/use-broadcast-channel.ts +250 -0
- package/registry/files/use-builtin-ai.ts +674 -0
- package/registry/files/use-clipboard.ts +425 -0
- package/registry/files/use-compression-stream.ts +364 -0
- package/registry/files/use-confirm-dialog.ts +137 -0
- package/registry/files/use-contact-picker.ts +246 -0
- package/registry/files/use-cookie.ts +500 -0
- package/registry/files/use-countdown.ts +161 -0
- package/registry/files/use-counter.ts +147 -0
- package/registry/files/use-css-var.ts +191 -0
- package/registry/files/use-cycle-list.ts +136 -0
- package/registry/files/use-date-format.ts +281 -0
- package/registry/files/use-date-time-format.ts +113 -0
- package/registry/files/use-debounced.ts +163 -0
- package/registry/files/use-display-media.ts +89 -0
- package/registry/files/use-display-names.ts +122 -0
- package/registry/files/use-document-title.ts +196 -0
- package/registry/files/use-drop-zone.ts +287 -0
- package/registry/files/use-event-source.ts +470 -0
- package/registry/files/use-eye-dropper.ts +134 -0
- package/registry/files/use-favicon.ts +140 -0
- package/registry/files/use-fetch.ts +578 -0
- package/registry/files/use-field.ts +247 -0
- package/registry/files/use-file-dialog.ts +257 -0
- package/registry/files/use-file-system-access.ts +383 -0
- package/registry/files/use-form-field-props.ts +381 -0
- package/registry/files/use-form.ts +980 -0
- package/registry/files/use-fullscreen.ts +214 -0
- package/registry/files/use-gamepad.ts +463 -0
- package/registry/files/use-hid.ts +359 -0
- package/registry/files/use-history.ts +231 -0
- package/registry/files/use-id-generator.ts +61 -0
- package/registry/files/use-image.ts +253 -0
- package/registry/files/use-indexed-db.ts +508 -0
- package/registry/files/use-interval.ts +253 -0
- package/registry/files/use-list-format.ts +85 -0
- package/registry/files/use-machine.ts +171 -0
- package/registry/files/use-map.ts +145 -0
- package/registry/files/use-media-controls.ts +545 -0
- package/registry/files/use-memoize.ts +118 -0
- package/registry/files/use-mounted.ts +30 -0
- package/registry/files/use-navigation-api.ts +641 -0
- package/registry/files/use-notification.ts +285 -0
- package/registry/files/use-now.ts +194 -0
- package/registry/files/use-number-format.ts +120 -0
- package/registry/files/use-object-url.ts +87 -0
- package/registry/files/use-offset-pagination.ts +168 -0
- package/registry/files/use-payment-request.ts +465 -0
- package/registry/files/use-performance-observer.ts +469 -0
- package/registry/files/use-permission.ts +220 -0
- package/registry/files/use-plural-rules.ts +134 -0
- package/registry/files/use-previous.ts +62 -0
- package/registry/files/use-push-subscription.ts +352 -0
- package/registry/files/use-queue.ts +197 -0
- package/registry/files/use-raf-fn.ts +176 -0
- package/registry/files/use-relative-time-format.ts +201 -0
- package/registry/files/use-request-idle-callback.ts +278 -0
- package/registry/files/use-route-query.ts +300 -0
- package/registry/files/use-scheduler-post-task.ts +397 -0
- package/registry/files/use-screen-details.ts +393 -0
- package/registry/files/use-script-tag.ts +341 -0
- package/registry/files/use-segmenter.ts +147 -0
- package/registry/files/use-selection.ts +233 -0
- package/registry/files/use-serial.ts +404 -0
- package/registry/files/use-service-worker.ts +413 -0
- package/registry/files/use-set.ts +154 -0
- package/registry/files/use-share.ts +168 -0
- package/registry/files/use-sorted-locale.ts +130 -0
- package/registry/files/use-sorted.ts +49 -0
- package/registry/files/use-speech-recognition.ts +357 -0
- package/registry/files/use-speech-synthesis.ts +333 -0
- package/registry/files/use-stack.ts +164 -0
- package/registry/files/use-stepper.ts +166 -0
- package/registry/files/use-storage-estimate.ts +352 -0
- package/registry/files/use-storage.ts +635 -0
- package/registry/files/use-style-tag.ts +200 -0
- package/registry/files/use-supported.ts +26 -0
- package/registry/files/use-throttled.ts +215 -0
- package/registry/files/use-time-ago.ts +276 -0
- package/registry/files/use-timeout.ts +218 -0
- package/registry/files/use-toggle.ts +54 -0
- package/registry/files/use-url-hash.ts +280 -0
- package/registry/files/use-url-search-params.ts +497 -0
- package/registry/files/use-usb.ts +395 -0
- package/registry/files/use-user-activation.ts +215 -0
- package/registry/files/use-user-media.ts +422 -0
- package/registry/files/use-v-model.ts +210 -0
- package/registry/files/use-vibrate.ts +174 -0
- package/registry/files/use-view-transition.ts +229 -0
- package/registry/files/use-visual-viewport.ts +228 -0
- package/registry/files/use-wake-lock.ts +206 -0
- package/registry/files/use-web-authn.ts +793 -0
- package/registry/files/use-web-locks.ts +363 -0
- package/registry/files/use-web-midi.ts +306 -0
- package/registry/files/use-web-vitals.ts +409 -0
- package/registry/files/use-websocket.ts +553 -0
- package/registry/files/use-worker-fn.ts +306 -0
- package/registry/files/virtual-list.ts +230 -0
- package/registry/files/watch-debounced.ts +206 -0
- package/registry/files/watch-ignorable.ts +128 -0
- package/registry/files/watch-once.ts +46 -0
- package/registry/files/watch-pausable.ts +93 -0
- package/registry/files/watch-source.ts +51 -0
- package/registry/files/watch-throttled.ts +201 -0
- package/registry/files/whenever.ts +70 -0
- package/registry/files/window-size.ts +151 -0
- package/registry/registry.json +5792 -0
- package/dist/catalog-D2AL3xYl.d.mts +0 -523
- package/dist/catalog-D5SYCsgW.mjs +0 -549
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { Ref } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/use-v-model.d.ts
|
|
4
|
+
/** Emit function able to send `event` with a value of type `Value`. */
|
|
5
|
+
type VModelEmit<Event extends string, Value> = (event: Event, value: Value) => void;
|
|
6
|
+
/** Options for {@link useVModel}. */
|
|
7
|
+
interface UseVModelOptions<Value, Event extends string = string, Default extends Exclude<Value, undefined> | undefined = Exclude<Value, undefined>> {
|
|
8
|
+
/**
|
|
9
|
+
* Keep a local copy that works even when the parent does not bind
|
|
10
|
+
* `v-model`: writes update the copy and emit, prop changes overwrite it.
|
|
11
|
+
*
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
readonly passive?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Event name to emit.
|
|
17
|
+
*
|
|
18
|
+
* @default `update:${key}`
|
|
19
|
+
*/
|
|
20
|
+
readonly eventName?: Event;
|
|
21
|
+
/**
|
|
22
|
+
* In passive mode, store the local copy deeply reactive and also emit on
|
|
23
|
+
* nested mutations of it.
|
|
24
|
+
*
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
readonly deep?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Value read while the prop is `undefined`.
|
|
30
|
+
*
|
|
31
|
+
* @default undefined
|
|
32
|
+
*/
|
|
33
|
+
readonly defaultValue?: Default;
|
|
34
|
+
/**
|
|
35
|
+
* In passive mode, copy prop values before storing them locally so local
|
|
36
|
+
* mutations never touch the parent's object: `true` uses
|
|
37
|
+
* `structuredClone` on the raw (unproxied) value, a function is used as
|
|
38
|
+
* the cloner.
|
|
39
|
+
*
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
readonly clone?: boolean | ((value: Value) => Value);
|
|
43
|
+
/**
|
|
44
|
+
* Veto emitting a value.
|
|
45
|
+
*
|
|
46
|
+
* @default undefined (always emit)
|
|
47
|
+
*/
|
|
48
|
+
readonly shouldEmit?: (value: Value) => boolean;
|
|
49
|
+
}
|
|
50
|
+
/** Model value type: `undefined` is removed when a default is configured. */
|
|
51
|
+
type VModelValue<Value, Default> = [Default] extends [undefined] ? Value : Exclude<Value, undefined>;
|
|
52
|
+
/**
|
|
53
|
+
* Two-way binding helper for a component prop.
|
|
54
|
+
*
|
|
55
|
+
* Reads the prop and emits `update:<key>` (or `eventName`) on write, typed
|
|
56
|
+
* end to end: the key must be a prop, the emitted value has the prop's type,
|
|
57
|
+
* and `emit` must accept that exact event (a `defineEmits` result with the
|
|
58
|
+
* matching overload qualifies). With `passive: true` a local ref mirrors the
|
|
59
|
+
* prop so the component also works uncontrolled. Relies only on the props
|
|
60
|
+
* and emit you pass (no component internals), so it is SSR- and
|
|
61
|
+
* Vapor-friendly; the passive watchers follow the owning scope.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* const props = defineProps<{ modelValue: string }>();
|
|
66
|
+
* const emit = defineEmits<{ "update:modelValue": [value: string] }>();
|
|
67
|
+
* const model = useVModel(props, "modelValue", emit);
|
|
68
|
+
* model.value = "next"; // emits update:modelValue
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @param props Component props object.
|
|
72
|
+
* @param key Prop to bind.
|
|
73
|
+
* @param emit Component emit function.
|
|
74
|
+
* @param options Passive mode, event name, default, clone, and emit guard.
|
|
75
|
+
* @default options {}
|
|
76
|
+
* @returns A writable ref over the prop.
|
|
77
|
+
*/
|
|
78
|
+
declare function useVModel<Props extends object, Key extends keyof Props & string, Event extends string = `update:${Key}`, Default extends Exclude<Props[Key], undefined> | undefined = undefined>(props: Props, key: Key, emit: VModelEmit<NoInfer<Event>, NoInfer<Props[Key]>>, options?: UseVModelOptions<Props[Key], Event, Default>): Ref<VModelValue<Props[Key], Default>>;
|
|
79
|
+
/** Options for {@link useVModels}. */
|
|
80
|
+
interface UseVModelsOptions<Key extends string> extends Omit<UseVModelOptions<unknown>, "eventName" | "defaultValue" | "shouldEmit" | "clone"> {
|
|
81
|
+
/**
|
|
82
|
+
* Props to bind. Defaults to every prop, which then requires an
|
|
83
|
+
* `update:<prop>` emit for each of them.
|
|
84
|
+
*
|
|
85
|
+
* @default all prop keys
|
|
86
|
+
*/
|
|
87
|
+
readonly keys?: readonly Key[];
|
|
88
|
+
}
|
|
89
|
+
/** Turn a union into the intersection of its members. */
|
|
90
|
+
type UnionToIntersection<Union> = (Union extends unknown ? (value: Union) => void : never) extends ((value: infer Intersection) => void) ? Intersection : never;
|
|
91
|
+
/** Emit overloads required by {@link useVModels} for the bound keys. */
|
|
92
|
+
type VModelsEmit<Props, Key extends keyof Props & string> = UnionToIntersection<{ [Name in Key]: VModelEmit<`update:${Name}`, Props[Name]> }[Key]>;
|
|
93
|
+
/**
|
|
94
|
+
* {@link useVModel} for several props at once.
|
|
95
|
+
*
|
|
96
|
+
* Returns one writable ref per bound prop, each emitting its own
|
|
97
|
+
* `update:<prop>` event. `emit` must declare an update event for every bound
|
|
98
|
+
* key; restrict the set with `keys`.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* const { open, value } = useVModels(props, emit, { keys: ["open", "value"] });
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @param props Component props object.
|
|
106
|
+
* @param emit Component emit function.
|
|
107
|
+
* @param options Passive mode, depth, and the keys to bind.
|
|
108
|
+
* @default options {}
|
|
109
|
+
* @returns One writable ref per bound prop.
|
|
110
|
+
*/
|
|
111
|
+
declare function useVModels<Props extends object, const Key extends keyof Props & string = keyof Props & string>(props: Props, emit: NoInfer<VModelsEmit<Props, Key>>, options?: UseVModelsOptions<Key>): { readonly [Name in Key]: Ref<Props[Name]> };
|
|
112
|
+
//#endregion
|
|
113
|
+
export { UseVModelOptions, UseVModelsOptions, VModelEmit, VModelValue, VModelsEmit, useVModel, useVModels };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { computed, ref, shallowRef, toRaw, watch } from "vue";
|
|
2
|
+
//#region src/use-v-model.ts
|
|
3
|
+
function useVModel(props, key, emit, options = {}) {
|
|
4
|
+
const event = options.eventName ?? `update:${key}`;
|
|
5
|
+
const read = () => props[key] ?? options.defaultValue;
|
|
6
|
+
const send = (value) => {
|
|
7
|
+
if (options.shouldEmit?.(value) ?? true) emit(event, value);
|
|
8
|
+
};
|
|
9
|
+
if (!(options.passive ?? false)) return computed({
|
|
10
|
+
get: read,
|
|
11
|
+
set: send
|
|
12
|
+
});
|
|
13
|
+
const clone = options.clone === true ? (value) => structuredClone(toRaw(value)) : typeof options.clone === "function" ? options.clone : (value) => value;
|
|
14
|
+
const deep = options.deep ?? false;
|
|
15
|
+
const local = deep ? ref(clone(read())) : shallowRef(clone(read()));
|
|
16
|
+
let fromProp = false;
|
|
17
|
+
watch(read, (value) => {
|
|
18
|
+
fromProp = true;
|
|
19
|
+
local.value = clone(value);
|
|
20
|
+
fromProp = false;
|
|
21
|
+
});
|
|
22
|
+
watch(local, (value) => {
|
|
23
|
+
if (!fromProp && (deep || value !== props[key])) send(value);
|
|
24
|
+
}, {
|
|
25
|
+
deep,
|
|
26
|
+
flush: "sync"
|
|
27
|
+
});
|
|
28
|
+
return local;
|
|
29
|
+
}
|
|
30
|
+
function useVModels(props, emit, options = {}) {
|
|
31
|
+
const keys = options.keys ?? Object.keys(props);
|
|
32
|
+
const models = {};
|
|
33
|
+
for (const key of keys) models[key] = useVModel(props, key, emit, {
|
|
34
|
+
...options.passive === void 0 ? {} : { passive: options.passive },
|
|
35
|
+
...options.deep === void 0 ? {} : { deep: options.deep }
|
|
36
|
+
});
|
|
37
|
+
return models;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { useVModel, useVModels };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { t as TimeoutScheduler } from "./timeout-scheduler-CI8RVLZs.mjs";
|
|
2
|
+
import { ComputedRef, MaybeRefOrGetter, Ref } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/use-vibrate.d.ts
|
|
5
|
+
/** A single duration or an alternating vibrate/pause pattern in milliseconds. */
|
|
6
|
+
type VibrationPattern = number | readonly number[];
|
|
7
|
+
/** Minimal Vibration API (`navigator`). */
|
|
8
|
+
interface VibrationHost {
|
|
9
|
+
/** Start (or with `0`/`[]`, cancel) a vibration. Returns whether it was accepted. */
|
|
10
|
+
vibrate(pattern: VibrationPattern): boolean;
|
|
11
|
+
}
|
|
12
|
+
/** Options for {@link useVibrate}. */
|
|
13
|
+
interface UseVibrateOptions {
|
|
14
|
+
/**
|
|
15
|
+
* Default pattern used by `vibrate()`.
|
|
16
|
+
*
|
|
17
|
+
* @default []
|
|
18
|
+
*/
|
|
19
|
+
readonly pattern?: MaybeRefOrGetter<VibrationPattern>;
|
|
20
|
+
/**
|
|
21
|
+
* Repeat the pattern every `interval` milliseconds until `stop`; `0`
|
|
22
|
+
* vibrates once.
|
|
23
|
+
*
|
|
24
|
+
* @default 0
|
|
25
|
+
*/
|
|
26
|
+
readonly interval?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Vibration capability for alternate runtimes and tests.
|
|
29
|
+
*
|
|
30
|
+
* @default window.navigator when it implements `vibrate`
|
|
31
|
+
*/
|
|
32
|
+
readonly host?: MaybeRefOrGetter<VibrationHost | null | undefined>;
|
|
33
|
+
/**
|
|
34
|
+
* Timer host used for repetition.
|
|
35
|
+
*
|
|
36
|
+
* @default globalThis timer functions
|
|
37
|
+
*/
|
|
38
|
+
readonly scheduler?: TimeoutScheduler;
|
|
39
|
+
}
|
|
40
|
+
/** Reactive state and actions returned by {@link useVibrate}. */
|
|
41
|
+
interface VibrateControls {
|
|
42
|
+
/** Whether the Vibration API is available. */
|
|
43
|
+
readonly supported: ComputedRef<boolean>;
|
|
44
|
+
/** Whether a (possibly repeating) vibration started by this composable is active. */
|
|
45
|
+
readonly vibrating: Readonly<Ref<boolean>>;
|
|
46
|
+
/**
|
|
47
|
+
* Vibrate with `pattern` or the default pattern.
|
|
48
|
+
*
|
|
49
|
+
* @param pattern Pattern overriding the default.
|
|
50
|
+
* @returns Whether the platform accepted the pattern.
|
|
51
|
+
* @throws {RangeError} `[VIZE_COMPOSE_VIBRATE_INVALID_PATTERN]` for negative,
|
|
52
|
+
* fractional, or non-finite durations.
|
|
53
|
+
*/
|
|
54
|
+
readonly vibrate: (pattern?: VibrationPattern) => boolean;
|
|
55
|
+
/** Cancel the vibration and any repetition. */
|
|
56
|
+
readonly stop: () => void;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Drive the Vibration API with validated, optionally repeating patterns.
|
|
60
|
+
*
|
|
61
|
+
* Patterns alternate vibration and pause durations. With `interval > 0`
|
|
62
|
+
* the pattern repeats until `stop` is called or the owning reactive scope
|
|
63
|
+
* stops, which also cancels an ongoing vibration.
|
|
64
|
+
*
|
|
65
|
+
* Server rendering: nothing vibrates and no timer starts; `supported` is false.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* const { vibrate, stop } = useVibrate({ pattern: [200, 100, 200] });
|
|
70
|
+
* vibrate();
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @param options Default pattern, repetition, and capability.
|
|
74
|
+
* @default options {}
|
|
75
|
+
* @returns Vibration state and actions.
|
|
76
|
+
* @throws {RangeError} `[VIZE_COMPOSE_VIBRATE_INVALID_INTERVAL]` for a negative
|
|
77
|
+
* or non-finite interval.
|
|
78
|
+
*/
|
|
79
|
+
declare function useVibrate(options?: UseVibrateOptions): VibrateControls;
|
|
80
|
+
//#endregion
|
|
81
|
+
export { UseVibrateOptions, VibrateControls, VibrationHost, VibrationPattern, useVibrate };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { tryOnScopeDispose } from "./scope.mjs";
|
|
2
|
+
import { computed, readonly, ref, toValue } from "vue";
|
|
3
|
+
//#region src/use-vibrate.ts
|
|
4
|
+
const defaultScheduler = {
|
|
5
|
+
setTimeout: (callback, delayMs) => globalThis.setTimeout(callback, delayMs),
|
|
6
|
+
clearTimeout: (handle) => {
|
|
7
|
+
globalThis.clearTimeout(handle);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
function browserVibrationHost() {
|
|
11
|
+
if (typeof window === "undefined") return void 0;
|
|
12
|
+
const { navigator } = window;
|
|
13
|
+
return typeof navigator.vibrate === "function" ? navigator : void 0;
|
|
14
|
+
}
|
|
15
|
+
function validatePattern(pattern) {
|
|
16
|
+
const durations = typeof pattern === "number" ? [pattern] : pattern;
|
|
17
|
+
for (const duration of durations) if (!Number.isSafeInteger(duration) || duration < 0) throw new RangeError(`[VIZE_COMPOSE_VIBRATE_INVALID_PATTERN] vibration durations must be non-negative integers; received ${String(duration)}`);
|
|
18
|
+
return durations;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Drive the Vibration API with validated, optionally repeating patterns.
|
|
22
|
+
*
|
|
23
|
+
* Patterns alternate vibration and pause durations. With `interval > 0`
|
|
24
|
+
* the pattern repeats until `stop` is called or the owning reactive scope
|
|
25
|
+
* stops, which also cancels an ongoing vibration.
|
|
26
|
+
*
|
|
27
|
+
* Server rendering: nothing vibrates and no timer starts; `supported` is false.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const { vibrate, stop } = useVibrate({ pattern: [200, 100, 200] });
|
|
32
|
+
* vibrate();
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @param options Default pattern, repetition, and capability.
|
|
36
|
+
* @default options {}
|
|
37
|
+
* @returns Vibration state and actions.
|
|
38
|
+
* @throws {RangeError} `[VIZE_COMPOSE_VIBRATE_INVALID_INTERVAL]` for a negative
|
|
39
|
+
* or non-finite interval.
|
|
40
|
+
*/
|
|
41
|
+
function useVibrate(options = {}) {
|
|
42
|
+
const interval = options.interval ?? 0;
|
|
43
|
+
if (!Number.isFinite(interval) || interval < 0) throw new RangeError(`[VIZE_COMPOSE_VIBRATE_INVALID_INTERVAL] interval must be a non-negative finite number; received ${String(interval)}`);
|
|
44
|
+
const scheduler = options.scheduler ?? defaultScheduler;
|
|
45
|
+
const vibrating = ref(false);
|
|
46
|
+
let handle;
|
|
47
|
+
let scheduled = false;
|
|
48
|
+
const resolveHost = () => options.host === void 0 ? browserVibrationHost() : toValue(options.host) ?? void 0;
|
|
49
|
+
const clearRepeat = () => {
|
|
50
|
+
if (scheduled) scheduler.clearTimeout(handle);
|
|
51
|
+
scheduled = false;
|
|
52
|
+
};
|
|
53
|
+
const stop = () => {
|
|
54
|
+
clearRepeat();
|
|
55
|
+
if (vibrating.value) resolveHost()?.vibrate(0);
|
|
56
|
+
vibrating.value = false;
|
|
57
|
+
};
|
|
58
|
+
const vibrate = (pattern) => {
|
|
59
|
+
const durations = validatePattern(pattern ?? toValue(options.pattern) ?? []);
|
|
60
|
+
const host = resolveHost();
|
|
61
|
+
clearRepeat();
|
|
62
|
+
if (!host) return false;
|
|
63
|
+
const accepted = host.vibrate(durations);
|
|
64
|
+
const total = durations.reduce((sum, duration) => sum + duration, 0);
|
|
65
|
+
vibrating.value = accepted && total > 0;
|
|
66
|
+
if (vibrating.value && interval > 0) {
|
|
67
|
+
const repeat = () => {
|
|
68
|
+
scheduled = false;
|
|
69
|
+
if (!vibrating.value) return;
|
|
70
|
+
vibrating.value = host.vibrate(durations);
|
|
71
|
+
if (vibrating.value) {
|
|
72
|
+
scheduled = true;
|
|
73
|
+
handle = scheduler.setTimeout(repeat, interval);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
scheduled = true;
|
|
77
|
+
handle = scheduler.setTimeout(repeat, interval);
|
|
78
|
+
}
|
|
79
|
+
return accepted;
|
|
80
|
+
};
|
|
81
|
+
tryOnScopeDispose(stop);
|
|
82
|
+
return {
|
|
83
|
+
supported: computed(() => resolveHost() !== void 0),
|
|
84
|
+
vibrating: readonly(vibrating),
|
|
85
|
+
vibrate,
|
|
86
|
+
stop
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
export { useVibrate };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { ComputedRef, MaybeRefOrGetter, ShallowRef } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/use-view-transition.d.ts
|
|
4
|
+
/** Minimal `ViewTransition`. */
|
|
5
|
+
interface ViewTransitionLike {
|
|
6
|
+
/** Settles when the transition animation finished (or was skipped). */
|
|
7
|
+
readonly finished: Promise<void>;
|
|
8
|
+
/** Resolves when the animation is about to start; rejects when skipped. */
|
|
9
|
+
readonly ready: Promise<void>;
|
|
10
|
+
/** Settles when the update callback settled. */
|
|
11
|
+
readonly updateCallbackDone: Promise<void>;
|
|
12
|
+
/** Skip the animation; the update still runs. */
|
|
13
|
+
skipTransition(): void;
|
|
14
|
+
}
|
|
15
|
+
/** Argument accepted by `document.startViewTransition`. */
|
|
16
|
+
type StartViewTransitionArgument = (() => unknown) | {
|
|
17
|
+
/** DOM update callback. */readonly update?: () => unknown; /** Active transition types (`:active-view-transition-type()`). */
|
|
18
|
+
readonly types?: string[];
|
|
19
|
+
};
|
|
20
|
+
/** Minimal document consumed by {@link useViewTransition}. */
|
|
21
|
+
interface ViewTransitionDocumentHost {
|
|
22
|
+
/** Start a same-document view transition. */
|
|
23
|
+
startViewTransition(update?: StartViewTransitionArgument): ViewTransitionLike;
|
|
24
|
+
}
|
|
25
|
+
/** Options for {@link useViewTransition}. */
|
|
26
|
+
interface UseViewTransitionOptions {
|
|
27
|
+
/**
|
|
28
|
+
* Document for alternate runtimes and tests.
|
|
29
|
+
*
|
|
30
|
+
* @default window.document when it implements startViewTransition
|
|
31
|
+
*/
|
|
32
|
+
readonly document?: MaybeRefOrGetter<ViewTransitionDocumentHost | null | undefined>;
|
|
33
|
+
/**
|
|
34
|
+
* Run updates without a transition while reduced motion is preferred.
|
|
35
|
+
*
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
readonly respectReducedMotion?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Whether reduced motion is preferred.
|
|
41
|
+
*
|
|
42
|
+
* @default useReducedMotion() === "reduce"
|
|
43
|
+
*/
|
|
44
|
+
readonly reducedMotion?: MaybeRefOrGetter<boolean>;
|
|
45
|
+
}
|
|
46
|
+
/** Per-call options of {@link ViewTransitionControls.start}. */
|
|
47
|
+
interface ViewTransitionStartOptions {
|
|
48
|
+
/**
|
|
49
|
+
* Transition types. Runtimes without typed transitions fall back to an
|
|
50
|
+
* untyped transition.
|
|
51
|
+
*
|
|
52
|
+
* @default []
|
|
53
|
+
*/
|
|
54
|
+
readonly types?: readonly string[];
|
|
55
|
+
}
|
|
56
|
+
/** Reactive state and actions returned by {@link useViewTransition}. */
|
|
57
|
+
interface ViewTransitionControls {
|
|
58
|
+
/** Whether `document.startViewTransition` is available. */
|
|
59
|
+
readonly supported: ComputedRef<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* The running transition (the host object itself, not a readonly proxy, so
|
|
62
|
+
* native methods keep working), cleared once it finished.
|
|
63
|
+
*/
|
|
64
|
+
readonly transition: ComputedRef<ViewTransitionLike | null>;
|
|
65
|
+
/** Whether a transition started by this composable is running. */
|
|
66
|
+
readonly isTransitioning: Readonly<ShallowRef<boolean>>;
|
|
67
|
+
/**
|
|
68
|
+
* Run `update` inside a view transition, or directly when unsupported or
|
|
69
|
+
* reduced motion is preferred.
|
|
70
|
+
*
|
|
71
|
+
* @param update DOM update; may return a value or a promise.
|
|
72
|
+
* @param options Transition types.
|
|
73
|
+
* @default options {}
|
|
74
|
+
* @returns Resolves with the update result once the DOM was updated (the
|
|
75
|
+
* animation may still run; await `transition.value?.finished` for it);
|
|
76
|
+
* rejects with the update error.
|
|
77
|
+
*/
|
|
78
|
+
readonly start: <Result>(update: () => Result | PromiseLike<Result>, options?: ViewTransitionStartOptions) => Promise<Result>;
|
|
79
|
+
/** Skip the running transition's animation. */
|
|
80
|
+
readonly skip: () => void;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Animate DOM updates with the View Transition API.
|
|
84
|
+
*
|
|
85
|
+
* Starting a new transition skips the running one (browser behavior). The
|
|
86
|
+
* running transition is skipped when the owning reactive scope stops.
|
|
87
|
+
*
|
|
88
|
+
* Server rendering: `start` runs the update directly; `supported` and
|
|
89
|
+
* `isTransitioning` are false.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* const { start } = useViewTransition();
|
|
94
|
+
* await start(async () => {
|
|
95
|
+
* page.value = next;
|
|
96
|
+
* await nextTick();
|
|
97
|
+
* }, { types: ["forward"] });
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* @param options Document host and reduced-motion policy.
|
|
101
|
+
* @default options {}
|
|
102
|
+
* @returns Transition state and actions.
|
|
103
|
+
*/
|
|
104
|
+
declare function useViewTransition(options?: UseViewTransitionOptions): ViewTransitionControls;
|
|
105
|
+
//#endregion
|
|
106
|
+
export { StartViewTransitionArgument, UseViewTransitionOptions, ViewTransitionControls, ViewTransitionDocumentHost, ViewTransitionLike, ViewTransitionStartOptions, useViewTransition };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { tryOnScopeDispose } from "./scope.mjs";
|
|
2
|
+
import { useReducedMotion } from "./media-query.mjs";
|
|
3
|
+
import { computed, hasInjectionContext, readonly, shallowRef, toValue, watchPostEffect } from "vue";
|
|
4
|
+
//#region src/use-view-transition.ts
|
|
5
|
+
function browserDocument() {
|
|
6
|
+
return typeof window !== "undefined" && typeof window.document.startViewTransition === "function" ? window.document : void 0;
|
|
7
|
+
}
|
|
8
|
+
function ignore() {}
|
|
9
|
+
/**
|
|
10
|
+
* Animate DOM updates with the View Transition API.
|
|
11
|
+
*
|
|
12
|
+
* Starting a new transition skips the running one (browser behavior). The
|
|
13
|
+
* running transition is skipped when the owning reactive scope stops.
|
|
14
|
+
*
|
|
15
|
+
* Server rendering: `start` runs the update directly; `supported` and
|
|
16
|
+
* `isTransitioning` are false.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const { start } = useViewTransition();
|
|
21
|
+
* await start(async () => {
|
|
22
|
+
* page.value = next;
|
|
23
|
+
* await nextTick();
|
|
24
|
+
* }, { types: ["forward"] });
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @param options Document host and reduced-motion policy.
|
|
28
|
+
* @default options {}
|
|
29
|
+
* @returns Transition state and actions.
|
|
30
|
+
*/
|
|
31
|
+
function useViewTransition(options = {}) {
|
|
32
|
+
const transition = shallowRef(null);
|
|
33
|
+
const isTransitioning = shallowRef(false);
|
|
34
|
+
const respect = options.respectReducedMotion ?? true;
|
|
35
|
+
const preference = respect && options.reducedMotion === void 0 ? useReducedMotion() : void 0;
|
|
36
|
+
const hydrated = shallowRef(!hasInjectionContext());
|
|
37
|
+
if (!hydrated.value) watchPostEffect(() => {
|
|
38
|
+
hydrated.value = true;
|
|
39
|
+
});
|
|
40
|
+
const resolveDocument = () => !hydrated.value ? void 0 : options.document === void 0 ? browserDocument() : toValue(options.document) ?? void 0;
|
|
41
|
+
const prefersReducedMotion = () => {
|
|
42
|
+
if (!respect) return false;
|
|
43
|
+
return preference ? preference.value === "reduce" : toValue(options.reducedMotion) === true;
|
|
44
|
+
};
|
|
45
|
+
const begin = (host, run, types) => {
|
|
46
|
+
if (types.length === 0) return host.startViewTransition(run);
|
|
47
|
+
try {
|
|
48
|
+
return host.startViewTransition({
|
|
49
|
+
update: run,
|
|
50
|
+
types: [...types]
|
|
51
|
+
});
|
|
52
|
+
} catch {
|
|
53
|
+
return host.startViewTransition(run);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const start = async (update, startOptions = {}) => {
|
|
57
|
+
const host = resolveDocument();
|
|
58
|
+
if (!host || prefersReducedMotion()) return update();
|
|
59
|
+
let run = async () => void 0;
|
|
60
|
+
const outcome = new Promise((resolve, reject) => {
|
|
61
|
+
run = async () => {
|
|
62
|
+
try {
|
|
63
|
+
resolve(await update());
|
|
64
|
+
} catch (cause) {
|
|
65
|
+
reject(cause);
|
|
66
|
+
throw cause;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
let current;
|
|
71
|
+
try {
|
|
72
|
+
current = begin(host, run, startOptions.types ?? []);
|
|
73
|
+
} catch {
|
|
74
|
+
return update();
|
|
75
|
+
}
|
|
76
|
+
transition.value = current;
|
|
77
|
+
isTransitioning.value = true;
|
|
78
|
+
const clear = () => {
|
|
79
|
+
if (transition.value !== current) return;
|
|
80
|
+
transition.value = null;
|
|
81
|
+
isTransitioning.value = false;
|
|
82
|
+
};
|
|
83
|
+
current.ready.catch(ignore);
|
|
84
|
+
current.updateCallbackDone.catch(ignore);
|
|
85
|
+
current.finished.then(clear, clear);
|
|
86
|
+
return outcome;
|
|
87
|
+
};
|
|
88
|
+
const skip = () => {
|
|
89
|
+
transition.value?.skipTransition();
|
|
90
|
+
};
|
|
91
|
+
tryOnScopeDispose(skip);
|
|
92
|
+
return {
|
|
93
|
+
supported: computed(() => resolveDocument() !== void 0),
|
|
94
|
+
transition: computed(() => transition.value),
|
|
95
|
+
isTransitioning: readonly(isTransitioning),
|
|
96
|
+
start,
|
|
97
|
+
skip
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
export { useViewTransition };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { ComputedRef, MaybeRefOrGetter, Ref } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/use-visual-viewport.d.ts
|
|
4
|
+
/** Structural `VisualViewport` observed by {@link useVisualViewport}. */
|
|
5
|
+
interface VisualViewportHost extends EventTarget {
|
|
6
|
+
/** Visible width in CSS pixels. */
|
|
7
|
+
readonly width: number;
|
|
8
|
+
/** Visible height in CSS pixels (shrinks when an on-screen keyboard overlays the page). */
|
|
9
|
+
readonly height: number;
|
|
10
|
+
/** Offset of the visual viewport from the layout viewport's top edge. */
|
|
11
|
+
readonly offsetTop: number;
|
|
12
|
+
/** Offset of the visual viewport from the layout viewport's left edge. */
|
|
13
|
+
readonly offsetLeft: number;
|
|
14
|
+
/** Pinch-zoom scale factor. */
|
|
15
|
+
readonly scale: number;
|
|
16
|
+
}
|
|
17
|
+
/** Structural VirtualKeyboard API (`navigator.virtualKeyboard`). */
|
|
18
|
+
interface VirtualKeyboardHost extends EventTarget {
|
|
19
|
+
/** Whether the keyboard overlays content instead of resizing the viewport. */
|
|
20
|
+
overlaysContent: boolean;
|
|
21
|
+
/** Keyboard rectangle in CSS pixels. */
|
|
22
|
+
readonly boundingRect: {
|
|
23
|
+
readonly height: number;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** Window-like capability read by {@link useVisualViewport}. */
|
|
27
|
+
interface VisualViewportWindowHost {
|
|
28
|
+
/** Layout viewport height. */
|
|
29
|
+
readonly innerHeight: number;
|
|
30
|
+
/** Visual viewport, when the engine supports it. */
|
|
31
|
+
readonly visualViewport?: VisualViewportHost | null;
|
|
32
|
+
/** Navigator that may expose the VirtualKeyboard API as `virtualKeyboard`. */
|
|
33
|
+
readonly navigator?: object;
|
|
34
|
+
}
|
|
35
|
+
/** Options for {@link useVisualViewport}. */
|
|
36
|
+
interface UseVisualViewportOptions {
|
|
37
|
+
/**
|
|
38
|
+
* Minimum occluded height (CSS px) reported as an open keyboard, filtering
|
|
39
|
+
* browser toolbars that collapse while scrolling.
|
|
40
|
+
*
|
|
41
|
+
* @default 120
|
|
42
|
+
*/
|
|
43
|
+
readonly keyboardThreshold?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Opt in to `navigator.virtualKeyboard.overlaysContent = true` (Chromium) so
|
|
46
|
+
* the keyboard height comes from the VirtualKeyboard API and the layout
|
|
47
|
+
* viewport no longer resizes. The previous value is restored on cleanup.
|
|
48
|
+
*
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
readonly overlaysContent?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Reactive window capability for alternate runtimes and tests.
|
|
54
|
+
*
|
|
55
|
+
* @default globalThis.window when available
|
|
56
|
+
*/
|
|
57
|
+
readonly host?: MaybeRefOrGetter<VisualViewportWindowHost | null | undefined>;
|
|
58
|
+
}
|
|
59
|
+
/** Reactive viewport geometry returned by {@link useVisualViewport}. */
|
|
60
|
+
interface VisualViewportControls {
|
|
61
|
+
/** Visual viewport width (0 on the server). */
|
|
62
|
+
readonly width: Readonly<Ref<number>>;
|
|
63
|
+
/** Visual viewport height (0 on the server). */
|
|
64
|
+
readonly height: Readonly<Ref<number>>;
|
|
65
|
+
/** Visual viewport top offset within the layout viewport. */
|
|
66
|
+
readonly offsetTop: Readonly<Ref<number>>;
|
|
67
|
+
/** Visual viewport left offset within the layout viewport. */
|
|
68
|
+
readonly offsetLeft: Readonly<Ref<number>>;
|
|
69
|
+
/** Pinch-zoom scale (1 on the server). */
|
|
70
|
+
readonly scale: Readonly<Ref<number>>;
|
|
71
|
+
/** Height of the bottom area hidden by an on-screen keyboard, in CSS px. */
|
|
72
|
+
readonly keyboardHeight: Readonly<Ref<number>>;
|
|
73
|
+
/** Whether `keyboardHeight` exceeds `keyboardThreshold`. */
|
|
74
|
+
readonly keyboardOpen: ComputedRef<boolean>;
|
|
75
|
+
/** Whether a VisualViewport (or VirtualKeyboard) capability is attached. */
|
|
76
|
+
readonly isSupported: Readonly<Ref<boolean>>;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Track the visual viewport and on-screen keyboard.
|
|
80
|
+
*
|
|
81
|
+
* On mobile browsers the visual viewport shrinks (or scrolls) when a virtual
|
|
82
|
+
* keyboard opens while the layout viewport stays put; `keyboardHeight` is the
|
|
83
|
+
* occluded bottom area (`innerHeight - height - offsetTop`), or the
|
|
84
|
+
* VirtualKeyboard API rectangle when `overlaysContent` is enabled. Pin
|
|
85
|
+
* toolbars above the keyboard with `bottom: calc(var(--kb, 0px))` bound to it.
|
|
86
|
+
*
|
|
87
|
+
* Server rendering reports zeros (scale 1) and attaches nothing; inside a
|
|
88
|
+
* component the host attaches after mount, so hydration renders the same
|
|
89
|
+
* zeros first. Listeners
|
|
90
|
+
* (`resize`, `scroll`, `geometrychange`) are passive and removed with the
|
|
91
|
+
* owning reactive scope.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* const { keyboardHeight, keyboardOpen } = useVisualViewport();
|
|
96
|
+
* const toolbarStyle = computed(() => ({ bottom: `${keyboardHeight.value}px` }));
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* @param options Keyboard threshold, VirtualKeyboard opt-in, and capability.
|
|
100
|
+
* @default options {}
|
|
101
|
+
* @returns Reactive viewport geometry and keyboard state.
|
|
102
|
+
*/
|
|
103
|
+
declare function useVisualViewport(options?: UseVisualViewportOptions): VisualViewportControls;
|
|
104
|
+
//#endregion
|
|
105
|
+
export { UseVisualViewportOptions, VirtualKeyboardHost, VisualViewportControls, VisualViewportHost, VisualViewportWindowHost, useVisualViewport };
|