@vueuse/skills 14.2.0 → 15.0.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 (267) hide show
  1. package/package.json +7 -4
  2. package/skills/vueuse-functions/SKILL.md +0 -417
  3. package/skills/vueuse-functions/references/computedAsync.md +0 -195
  4. package/skills/vueuse-functions/references/computedEager.md +0 -62
  5. package/skills/vueuse-functions/references/computedInject.md +0 -137
  6. package/skills/vueuse-functions/references/computedWithControl.md +0 -98
  7. package/skills/vueuse-functions/references/createEventHook.md +0 -86
  8. package/skills/vueuse-functions/references/createGenericProjection.md +0 -25
  9. package/skills/vueuse-functions/references/createGlobalState.md +0 -95
  10. package/skills/vueuse-functions/references/createInjectionState.md +0 -215
  11. package/skills/vueuse-functions/references/createProjection.md +0 -31
  12. package/skills/vueuse-functions/references/createRef.md +0 -54
  13. package/skills/vueuse-functions/references/createReusableTemplate.md +0 -356
  14. package/skills/vueuse-functions/references/createSharedComposable.md +0 -42
  15. package/skills/vueuse-functions/references/createTemplatePromise.md +0 -306
  16. package/skills/vueuse-functions/references/createUnrefFn.md +0 -51
  17. package/skills/vueuse-functions/references/extendRef.md +0 -76
  18. package/skills/vueuse-functions/references/from.md +0 -80
  19. package/skills/vueuse-functions/references/get.md +0 -30
  20. package/skills/vueuse-functions/references/injectLocal.md +0 -35
  21. package/skills/vueuse-functions/references/isDefined.md +0 -31
  22. package/skills/vueuse-functions/references/logicAnd.md +0 -40
  23. package/skills/vueuse-functions/references/logicNot.md +0 -36
  24. package/skills/vueuse-functions/references/logicOr.md +0 -40
  25. package/skills/vueuse-functions/references/makeDestructurable.md +0 -41
  26. package/skills/vueuse-functions/references/onClickOutside.md +0 -221
  27. package/skills/vueuse-functions/references/onElementRemoval.md +0 -88
  28. package/skills/vueuse-functions/references/onKeyStroke.md +0 -211
  29. package/skills/vueuse-functions/references/onLongPress.md +0 -227
  30. package/skills/vueuse-functions/references/onStartTyping.md +0 -53
  31. package/skills/vueuse-functions/references/provideLocal.md +0 -37
  32. package/skills/vueuse-functions/references/reactify.md +0 -144
  33. package/skills/vueuse-functions/references/reactifyObject.md +0 -62
  34. package/skills/vueuse-functions/references/reactiveComputed.md +0 -34
  35. package/skills/vueuse-functions/references/reactiveOmit.md +0 -86
  36. package/skills/vueuse-functions/references/reactivePick.md +0 -106
  37. package/skills/vueuse-functions/references/refAutoReset.md +0 -46
  38. package/skills/vueuse-functions/references/refDebounced.md +0 -81
  39. package/skills/vueuse-functions/references/refDefault.md +0 -36
  40. package/skills/vueuse-functions/references/refManualReset.md +0 -44
  41. package/skills/vueuse-functions/references/refThrottled.md +0 -99
  42. package/skills/vueuse-functions/references/refWithControl.md +0 -146
  43. package/skills/vueuse-functions/references/set.md +0 -30
  44. package/skills/vueuse-functions/references/syncRef.md +0 -195
  45. package/skills/vueuse-functions/references/syncRefs.md +0 -128
  46. package/skills/vueuse-functions/references/templateRef.md +0 -86
  47. package/skills/vueuse-functions/references/toObserver.md +0 -38
  48. package/skills/vueuse-functions/references/toReactive.md +0 -41
  49. package/skills/vueuse-functions/references/toRef.md +0 -75
  50. package/skills/vueuse-functions/references/toRefs.md +0 -81
  51. package/skills/vueuse-functions/references/tryOnBeforeMount.md +0 -34
  52. package/skills/vueuse-functions/references/tryOnBeforeUnmount.md +0 -32
  53. package/skills/vueuse-functions/references/tryOnMounted.md +0 -34
  54. package/skills/vueuse-functions/references/tryOnScopeDispose.md +0 -31
  55. package/skills/vueuse-functions/references/tryOnUnmounted.md +0 -32
  56. package/skills/vueuse-functions/references/unrefElement.md +0 -54
  57. package/skills/vueuse-functions/references/until.md +0 -161
  58. package/skills/vueuse-functions/references/useAbs.md +0 -31
  59. package/skills/vueuse-functions/references/useActiveElement.md +0 -85
  60. package/skills/vueuse-functions/references/useAnimate.md +0 -181
  61. package/skills/vueuse-functions/references/useArrayDifference.md +0 -84
  62. package/skills/vueuse-functions/references/useArrayEvery.md +0 -59
  63. package/skills/vueuse-functions/references/useArrayFilter.md +0 -63
  64. package/skills/vueuse-functions/references/useArrayFind.md +0 -50
  65. package/skills/vueuse-functions/references/useArrayFindIndex.md +0 -59
  66. package/skills/vueuse-functions/references/useArrayFindLast.md +0 -52
  67. package/skills/vueuse-functions/references/useArrayIncludes.md +0 -63
  68. package/skills/vueuse-functions/references/useArrayJoin.md +0 -74
  69. package/skills/vueuse-functions/references/useArrayMap.md +0 -59
  70. package/skills/vueuse-functions/references/useArrayReduce.md +0 -81
  71. package/skills/vueuse-functions/references/useArraySome.md +0 -59
  72. package/skills/vueuse-functions/references/useArrayUnique.md +0 -76
  73. package/skills/vueuse-functions/references/useAsyncQueue.md +0 -136
  74. package/skills/vueuse-functions/references/useAsyncState.md +0 -185
  75. package/skills/vueuse-functions/references/useAsyncValidator.md +0 -70
  76. package/skills/vueuse-functions/references/useAuth.md +0 -123
  77. package/skills/vueuse-functions/references/useAverage.md +0 -36
  78. package/skills/vueuse-functions/references/useAxios.md +0 -322
  79. package/skills/vueuse-functions/references/useBase64.md +0 -136
  80. package/skills/vueuse-functions/references/useBattery.md +0 -78
  81. package/skills/vueuse-functions/references/useBluetooth.md +0 -175
  82. package/skills/vueuse-functions/references/useBreakpoints.md +0 -172
  83. package/skills/vueuse-functions/references/useBroadcastChannel.md +0 -74
  84. package/skills/vueuse-functions/references/useBrowserLocation.md +0 -83
  85. package/skills/vueuse-functions/references/useCached.md +0 -52
  86. package/skills/vueuse-functions/references/useCeil.md +0 -31
  87. package/skills/vueuse-functions/references/useChangeCase.md +0 -79
  88. package/skills/vueuse-functions/references/useClamp.md +0 -85
  89. package/skills/vueuse-functions/references/useClipboard.md +0 -123
  90. package/skills/vueuse-functions/references/useClipboardItems.md +0 -94
  91. package/skills/vueuse-functions/references/useCloned.md +0 -91
  92. package/skills/vueuse-functions/references/useColorMode.md +0 -172
  93. package/skills/vueuse-functions/references/useConfirmDialog.md +0 -159
  94. package/skills/vueuse-functions/references/useCookies.md +0 -162
  95. package/skills/vueuse-functions/references/useCountdown.md +0 -105
  96. package/skills/vueuse-functions/references/useCounter.md +0 -86
  97. package/skills/vueuse-functions/references/useCssSupports.md +0 -35
  98. package/skills/vueuse-functions/references/useCssVar.md +0 -50
  99. package/skills/vueuse-functions/references/useCurrentElement.md +0 -61
  100. package/skills/vueuse-functions/references/useCycleList.md +0 -75
  101. package/skills/vueuse-functions/references/useDark.md +0 -144
  102. package/skills/vueuse-functions/references/useDateFormat.md +0 -145
  103. package/skills/vueuse-functions/references/useDebounceFn.md +0 -100
  104. package/skills/vueuse-functions/references/useDebouncedRefHistory.md +0 -40
  105. package/skills/vueuse-functions/references/useDeviceMotion.md +0 -86
  106. package/skills/vueuse-functions/references/useDeviceOrientation.md +0 -62
  107. package/skills/vueuse-functions/references/useDevicePixelRatio.md +0 -44
  108. package/skills/vueuse-functions/references/useDevicesList.md +0 -90
  109. package/skills/vueuse-functions/references/useDisplayMedia.md +0 -71
  110. package/skills/vueuse-functions/references/useDocumentVisibility.md +0 -45
  111. package/skills/vueuse-functions/references/useDraggable.md +0 -317
  112. package/skills/vueuse-functions/references/useDrauu.md +0 -65
  113. package/skills/vueuse-functions/references/useDropZone.md +0 -83
  114. package/skills/vueuse-functions/references/useElementBounding.md +0 -131
  115. package/skills/vueuse-functions/references/useElementByPoint.md +0 -48
  116. package/skills/vueuse-functions/references/useElementHover.md +0 -79
  117. package/skills/vueuse-functions/references/useElementSize.md +0 -78
  118. package/skills/vueuse-functions/references/useElementVisibility.md +0 -123
  119. package/skills/vueuse-functions/references/useEventBus.md +0 -101
  120. package/skills/vueuse-functions/references/useEventListener.md +0 -226
  121. package/skills/vueuse-functions/references/useEventSource.md +0 -204
  122. package/skills/vueuse-functions/references/useExtractedObservable.md +0 -198
  123. package/skills/vueuse-functions/references/useEyeDropper.md +0 -71
  124. package/skills/vueuse-functions/references/useFavicon.md +0 -67
  125. package/skills/vueuse-functions/references/useFetch.md +0 -546
  126. package/skills/vueuse-functions/references/useFileDialog.md +0 -91
  127. package/skills/vueuse-functions/references/useFileSystemAccess.md +0 -162
  128. package/skills/vueuse-functions/references/useFirestore.md +0 -129
  129. package/skills/vueuse-functions/references/useFloor.md +0 -31
  130. package/skills/vueuse-functions/references/useFocus.md +0 -99
  131. package/skills/vueuse-functions/references/useFocusTrap.md +0 -245
  132. package/skills/vueuse-functions/references/useFocusWithin.md +0 -57
  133. package/skills/vueuse-functions/references/useFps.md +0 -28
  134. package/skills/vueuse-functions/references/useFullscreen.md +0 -75
  135. package/skills/vueuse-functions/references/useFuse.md +0 -107
  136. package/skills/vueuse-functions/references/useGamepad.md +0 -222
  137. package/skills/vueuse-functions/references/useGeolocation.md +0 -85
  138. package/skills/vueuse-functions/references/useIDBKeyval.md +0 -93
  139. package/skills/vueuse-functions/references/useIdle.md +0 -88
  140. package/skills/vueuse-functions/references/useImage.md +0 -86
  141. package/skills/vueuse-functions/references/useInfiniteScroll.md +0 -157
  142. package/skills/vueuse-functions/references/useIntersectionObserver.md +0 -118
  143. package/skills/vueuse-functions/references/useInterval.md +0 -112
  144. package/skills/vueuse-functions/references/useIntervalFn.md +0 -50
  145. package/skills/vueuse-functions/references/useIpcRenderer.md +0 -144
  146. package/skills/vueuse-functions/references/useIpcRendererInvoke.md +0 -58
  147. package/skills/vueuse-functions/references/useIpcRendererOn.md +0 -52
  148. package/skills/vueuse-functions/references/useJwt.md +0 -57
  149. package/skills/vueuse-functions/references/useKeyModifier.md +0 -87
  150. package/skills/vueuse-functions/references/useLastChanged.md +0 -63
  151. package/skills/vueuse-functions/references/useLocalStorage.md +0 -41
  152. package/skills/vueuse-functions/references/useMagicKeys.md +0 -245
  153. package/skills/vueuse-functions/references/useManualRefHistory.md +0 -204
  154. package/skills/vueuse-functions/references/useMath.md +0 -47
  155. package/skills/vueuse-functions/references/useMax.md +0 -36
  156. package/skills/vueuse-functions/references/useMediaControls.md +0 -571
  157. package/skills/vueuse-functions/references/useMediaQuery.md +0 -53
  158. package/skills/vueuse-functions/references/useMemoize.md +0 -175
  159. package/skills/vueuse-functions/references/useMemory.md +0 -71
  160. package/skills/vueuse-functions/references/useMin.md +0 -36
  161. package/skills/vueuse-functions/references/useMounted.md +0 -38
  162. package/skills/vueuse-functions/references/useMouse.md +0 -113
  163. package/skills/vueuse-functions/references/useMouseInElement.md +0 -123
  164. package/skills/vueuse-functions/references/useMousePressed.md +0 -112
  165. package/skills/vueuse-functions/references/useMutationObserver.md +0 -61
  166. package/skills/vueuse-functions/references/useNProgress.md +0 -78
  167. package/skills/vueuse-functions/references/useNavigatorLanguage.md +0 -57
  168. package/skills/vueuse-functions/references/useNetwork.md +0 -106
  169. package/skills/vueuse-functions/references/useNow.md +0 -79
  170. package/skills/vueuse-functions/references/useObjectUrl.md +0 -55
  171. package/skills/vueuse-functions/references/useObservable.md +0 -91
  172. package/skills/vueuse-functions/references/useOffsetPagination.md +0 -199
  173. package/skills/vueuse-functions/references/useOnline.md +0 -41
  174. package/skills/vueuse-functions/references/usePageLeave.md +0 -42
  175. package/skills/vueuse-functions/references/useParallax.md +0 -58
  176. package/skills/vueuse-functions/references/useParentElement.md +0 -54
  177. package/skills/vueuse-functions/references/usePerformanceObserver.md +0 -48
  178. package/skills/vueuse-functions/references/usePermission.md +0 -79
  179. package/skills/vueuse-functions/references/usePointer.md +0 -89
  180. package/skills/vueuse-functions/references/usePointerLock.md +0 -60
  181. package/skills/vueuse-functions/references/usePointerSwipe.md +0 -80
  182. package/skills/vueuse-functions/references/usePrecision.md +0 -49
  183. package/skills/vueuse-functions/references/usePreferredColorScheme.md +0 -42
  184. package/skills/vueuse-functions/references/usePreferredContrast.md +0 -42
  185. package/skills/vueuse-functions/references/usePreferredDark.md +0 -41
  186. package/skills/vueuse-functions/references/usePreferredLanguages.md +0 -41
  187. package/skills/vueuse-functions/references/usePreferredReducedMotion.md +0 -42
  188. package/skills/vueuse-functions/references/usePreferredReducedTransparency.md +0 -42
  189. package/skills/vueuse-functions/references/usePrevious.md +0 -40
  190. package/skills/vueuse-functions/references/useProjection.md +0 -38
  191. package/skills/vueuse-functions/references/useQRCode.md +0 -53
  192. package/skills/vueuse-functions/references/useRTDB.md +0 -83
  193. package/skills/vueuse-functions/references/useRafFn.md +0 -68
  194. package/skills/vueuse-functions/references/useRefHistory.md +0 -285
  195. package/skills/vueuse-functions/references/useResizeObserver.md +0 -109
  196. package/skills/vueuse-functions/references/useRound.md +0 -31
  197. package/skills/vueuse-functions/references/useRouteHash.md +0 -27
  198. package/skills/vueuse-functions/references/useRouteParams.md +0 -38
  199. package/skills/vueuse-functions/references/useRouteQuery.md +0 -79
  200. package/skills/vueuse-functions/references/useSSRWidth.md +0 -47
  201. package/skills/vueuse-functions/references/useScreenOrientation.md +0 -96
  202. package/skills/vueuse-functions/references/useScreenSafeArea.md +0 -60
  203. package/skills/vueuse-functions/references/useScriptTag.md +0 -116
  204. package/skills/vueuse-functions/references/useScroll.md +0 -238
  205. package/skills/vueuse-functions/references/useScrollLock.md +0 -66
  206. package/skills/vueuse-functions/references/useSessionStorage.md +0 -41
  207. package/skills/vueuse-functions/references/useShare.md +0 -68
  208. package/skills/vueuse-functions/references/useSortable.md +0 -235
  209. package/skills/vueuse-functions/references/useSorted.md +0 -90
  210. package/skills/vueuse-functions/references/useSpeechRecognition.md +0 -94
  211. package/skills/vueuse-functions/references/useSpeechSynthesis.md +0 -105
  212. package/skills/vueuse-functions/references/useStepper.md +0 -137
  213. package/skills/vueuse-functions/references/useStorage.md +0 -278
  214. package/skills/vueuse-functions/references/useStorageAsync.md +0 -136
  215. package/skills/vueuse-functions/references/useStyleTag.md +0 -131
  216. package/skills/vueuse-functions/references/useSubject.md +0 -77
  217. package/skills/vueuse-functions/references/useSubscription.md +0 -33
  218. package/skills/vueuse-functions/references/useSum.md +0 -36
  219. package/skills/vueuse-functions/references/useSupported.md +0 -29
  220. package/skills/vueuse-functions/references/useSwipe.md +0 -75
  221. package/skills/vueuse-functions/references/useTemplateRefsList.md +0 -37
  222. package/skills/vueuse-functions/references/useTextDirection.md +0 -75
  223. package/skills/vueuse-functions/references/useTextSelection.md +0 -40
  224. package/skills/vueuse-functions/references/useTextareaAutosize.md +0 -97
  225. package/skills/vueuse-functions/references/useThrottleFn.md +0 -57
  226. package/skills/vueuse-functions/references/useThrottledRefHistory.md +0 -47
  227. package/skills/vueuse-functions/references/useTimeAgo.md +0 -154
  228. package/skills/vueuse-functions/references/useTimeAgoIntl.md +0 -117
  229. package/skills/vueuse-functions/references/useTimeout.md +0 -113
  230. package/skills/vueuse-functions/references/useTimeoutFn.md +0 -51
  231. package/skills/vueuse-functions/references/useTimeoutPoll.md +0 -47
  232. package/skills/vueuse-functions/references/useTimestamp.md +0 -89
  233. package/skills/vueuse-functions/references/useTitle.md +0 -113
  234. package/skills/vueuse-functions/references/useToNumber.md +0 -54
  235. package/skills/vueuse-functions/references/useToString.md +0 -34
  236. package/skills/vueuse-functions/references/useToggle.md +0 -103
  237. package/skills/vueuse-functions/references/useTransition.md +0 -265
  238. package/skills/vueuse-functions/references/useTrunc.md +0 -33
  239. package/skills/vueuse-functions/references/useUrlSearchParams.md +0 -121
  240. package/skills/vueuse-functions/references/useUserMedia.md +0 -1138
  241. package/skills/vueuse-functions/references/useVModel.md +0 -182
  242. package/skills/vueuse-functions/references/useVModels.md +0 -67
  243. package/skills/vueuse-functions/references/useVibrate.md +0 -87
  244. package/skills/vueuse-functions/references/useVirtualList.md +0 -182
  245. package/skills/vueuse-functions/references/useWakeLock.md +0 -50
  246. package/skills/vueuse-functions/references/useWebNotification.md +0 -176
  247. package/skills/vueuse-functions/references/useWebSocket.md +0 -299
  248. package/skills/vueuse-functions/references/useWebWorker.md +0 -60
  249. package/skills/vueuse-functions/references/useWebWorkerFn.md +0 -102
  250. package/skills/vueuse-functions/references/useWindowFocus.md +0 -46
  251. package/skills/vueuse-functions/references/useWindowScroll.md +0 -61
  252. package/skills/vueuse-functions/references/useWindowSize.md +0 -76
  253. package/skills/vueuse-functions/references/useZoomFactor.md +0 -53
  254. package/skills/vueuse-functions/references/useZoomLevel.md +0 -53
  255. package/skills/vueuse-functions/references/watchArray.md +0 -53
  256. package/skills/vueuse-functions/references/watchAtMost.md +0 -55
  257. package/skills/vueuse-functions/references/watchDebounced.md +0 -101
  258. package/skills/vueuse-functions/references/watchDeep.md +0 -54
  259. package/skills/vueuse-functions/references/watchExtractedObservable.md +0 -192
  260. package/skills/vueuse-functions/references/watchIgnorable.md +0 -120
  261. package/skills/vueuse-functions/references/watchImmediate.md +0 -44
  262. package/skills/vueuse-functions/references/watchOnce.md +0 -41
  263. package/skills/vueuse-functions/references/watchPausable.md +0 -86
  264. package/skills/vueuse-functions/references/watchThrottled.md +0 -108
  265. package/skills/vueuse-functions/references/watchTriggerable.md +0 -98
  266. package/skills/vueuse-functions/references/watchWithFilter.md +0 -54
  267. package/skills/vueuse-functions/references/whenever.md +0 -100
@@ -1,100 +0,0 @@
1
- ---
2
- category: Utilities
3
- related: useThrottleFn
4
- ---
5
-
6
- # useDebounceFn
7
-
8
- Debounce execution of a function.
9
-
10
- > Debounce is an overloaded waiter: if you keep asking, your requests will be ignored until you stop and give them some time to think about your latest inquiry.
11
-
12
- ## Usage
13
-
14
- ```ts
15
- import { useDebounceFn, useEventListener } from '@vueuse/core'
16
-
17
- const debouncedFn = useDebounceFn(() => {
18
- // do something
19
- }, 1000)
20
-
21
- useEventListener(window, 'resize', debouncedFn)
22
- ```
23
-
24
- You can also pass a 3rd parameter to this, with a maximum wait time, similar to [lodash debounce](https://lodash.com/docs/4.17.15#debounce)
25
-
26
- ```ts
27
- import { useDebounceFn, useEventListener } from '@vueuse/core'
28
-
29
- // If no invokation after 5000ms due to repeated input,
30
- // the function will be called anyway.
31
- const debouncedFn = useDebounceFn(() => {
32
- // do something
33
- }, 1000, { maxWait: 5000 })
34
-
35
- useEventListener(window, 'resize', debouncedFn)
36
- ```
37
-
38
- Optionally, you can get the return value of the function using promise operations.
39
-
40
- ```ts
41
- import { useDebounceFn } from '@vueuse/core'
42
-
43
- const debouncedRequest = useDebounceFn(() => 'response', 1000)
44
-
45
- debouncedRequest().then((value) => {
46
- console.log(value) // 'response'
47
- })
48
-
49
- // or use async/await
50
- async function doRequest() {
51
- const value = await debouncedRequest()
52
- console.log(value) // 'response'
53
- }
54
- ```
55
-
56
- Since unhandled rejection error is quite annoying when developer doesn't need the return value, the promise will **NOT** be rejected if the function is canceled **by default**. You need to specify the option `rejectOnCancel: true` to capture the rejection.
57
-
58
- ```ts
59
- import { useDebounceFn } from '@vueuse/core'
60
-
61
- const debouncedRequest = useDebounceFn(() => 'response', 1000, { rejectOnCancel: true })
62
-
63
- debouncedRequest()
64
- .then((value) => {
65
- // do something
66
- })
67
- .catch(() => {
68
- // do something when canceled
69
- })
70
-
71
- // calling it again will cancel the previous request and gets rejected
72
- setTimeout(debouncedRequest, 500)
73
- ```
74
-
75
- ## Recommended Reading
76
-
77
- - [**Debounce vs Throttle**: Definitive Visual Guide](https://kettanaito.com/blog/debounce-vs-throttle)
78
-
79
- ## Type Declarations
80
-
81
- ```ts
82
- export type UseDebounceFnReturn<T extends FunctionArgs> = PromisifyFn<T>
83
- /**
84
- * Debounce execution of a function.
85
- *
86
- * @see https://vueuse.org/useDebounceFn
87
- * @param fn A function to be executed after delay milliseconds debounced.
88
- * @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
89
- * @param options Options
90
- *
91
- * @return A new, debounce, function.
92
- *
93
- * @__NO_SIDE_EFFECTS__
94
- */
95
- export declare function useDebounceFn<T extends FunctionArgs>(
96
- fn: T,
97
- ms?: MaybeRefOrGetter<number>,
98
- options?: DebounceFilterOptions,
99
- ): UseDebounceFnReturn<T>
100
- ```
@@ -1,40 +0,0 @@
1
- ---
2
- category: State
3
- related:
4
- - useRefHistory
5
- - useThrottledRefHistory
6
- ---
7
-
8
- # useDebouncedRefHistory
9
-
10
- Shorthand for `useRefHistory` with debounced filter.
11
-
12
- ## Usage
13
-
14
- This function takes a snapshot of your counter after 1000ms when the value of it starts to change.
15
-
16
- ```ts
17
- import { useDebouncedRefHistory } from '@vueuse/core'
18
- import { shallowRef } from 'vue'
19
-
20
- const counter = shallowRef(0)
21
- const { history, undo, redo } = useDebouncedRefHistory(counter, { deep: true, debounce: 1000 })
22
- ```
23
-
24
- ## Type Declarations
25
-
26
- ```ts
27
- /**
28
- * Shorthand for [useRefHistory](https://vueuse.org/useRefHistory) with debounce filter.
29
- *
30
- * @see https://vueuse.org/useDebouncedRefHistory
31
- * @param source
32
- * @param options
33
- */
34
- export declare function useDebouncedRefHistory<Raw, Serialized = Raw>(
35
- source: Ref<Raw>,
36
- options?: Omit<UseRefHistoryOptions<Raw, Serialized>, 'eventFilter'> & {
37
- debounce?: MaybeRefOrGetter<number>
38
- },
39
- ): UseRefHistoryReturn<Raw, Serialized>
40
- ```
@@ -1,86 +0,0 @@
1
- ---
2
- category: Sensors
3
- ---
4
-
5
- # useDeviceMotion
6
-
7
- Reactive [DeviceMotionEvent](https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent). Provide web developers with information about the speed of changes for the device's position and orientation.
8
-
9
- ## Usage
10
-
11
- ```ts
12
- import { useDeviceMotion } from '@vueuse/core'
13
-
14
- const {
15
- acceleration,
16
- accelerationIncludingGravity,
17
- rotationRate,
18
- interval,
19
- } = useDeviceMotion()
20
- ```
21
-
22
- > Note: For iOS, you need to use `trigger` and bind it with user interaction.
23
- > After permission granted, the API will run automatically
24
-
25
- | State | Type | Description |
26
- | ---------------------------- | --------------- | -------------------------------------------------------------------------------------------------------------------- |
27
- | acceleration | `object` | An object giving the acceleration of the device on the three axis X, Y and Z. |
28
- | accelerationIncludingGravity | `object` | An object giving the acceleration of the device on the three axis X, Y and Z with the effect of gravity. |
29
- | rotationRate | `object` | An object giving the rate of change of the device's orientation on the three orientation axis alpha, beta and gamma. |
30
- | interval | `Number` | A number representing the interval of time, in milliseconds, at which data is obtained from the device.. |
31
- | ensurePermissions | `boolean` | Indicates whether the platform requires permission to use the API |
32
- | permissionGranted | `boolean` | Indicates whether the user has granted permission. The default is always false |
33
- | trigger | `Promise<void>` | An async function to request user permission. The API runs automatically once permission is granted |
34
-
35
- You can find [more information about the state on the MDN](https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent#instance_properties).
36
-
37
- ## Component Usage
38
-
39
- ```vue
40
- <template>
41
- <UseDeviceMotion v-slot="{ acceleration }">
42
- Acceleration: {{ acceleration }}
43
- </UseDeviceMotion>
44
- </template>
45
- ```
46
-
47
- ## Type Declarations
48
-
49
- ```ts
50
- export interface DeviceMotionOptions
51
- extends ConfigurableWindow, ConfigurableEventFilter {
52
- /**
53
- * Request for permissions immediately if it's not granted,
54
- * otherwise label and deviceIds could be empty
55
- *
56
- * @default false
57
- */
58
- requestPermissions?: boolean
59
- }
60
- /**
61
- * Reactive DeviceMotionEvent.
62
- *
63
- * @see https://vueuse.org/useDeviceMotion
64
- * @param options
65
- */
66
- export declare function useDeviceMotion(options?: DeviceMotionOptions): {
67
- acceleration: Ref<
68
- DeviceMotionEventAcceleration | null,
69
- DeviceMotionEventAcceleration | null
70
- >
71
- accelerationIncludingGravity: Ref<
72
- DeviceMotionEventAcceleration | null,
73
- DeviceMotionEventAcceleration | null
74
- >
75
- rotationRate: Ref<
76
- DeviceMotionEventRotationRate | null,
77
- DeviceMotionEventRotationRate | null
78
- >
79
- interval: ShallowRef<number, number>
80
- isSupported: ComputedRef<boolean>
81
- requirePermissions: ComputedRef<boolean>
82
- ensurePermissions: () => Promise<void>
83
- permissionGranted: ShallowRef<boolean, boolean>
84
- }
85
- export type UseDeviceMotionReturn = ReturnType<typeof useDeviceMotion>
86
- ```
@@ -1,62 +0,0 @@
1
- ---
2
- category: Sensors
3
- ---
4
-
5
- # useDeviceOrientation
6
-
7
- Reactive [DeviceOrientationEvent](https://developer.mozilla.org/en-US/docs/Web/API/DeviceOrientationEvent). Provide web developers with information from the physical orientation of the device running the web page.
8
-
9
- ## Usage
10
-
11
- ```ts
12
- import { useDeviceOrientation } from '@vueuse/core'
13
-
14
- const {
15
- isAbsolute,
16
- alpha,
17
- beta,
18
- gamma,
19
- } = useDeviceOrientation()
20
- ```
21
-
22
- | State | Type | Description |
23
- | ---------- | --------- | -------------------------------------------------------------------------------------------------------------------------- |
24
- | isAbsolute | `boolean` | A boolean that indicates whether or not the device is providing orientation data absolutely. |
25
- | alpha | `number` | A number representing the motion of the device around the z axis, express in degrees with values ranging from 0 to 360. |
26
- | beta | `number` | A number representing the motion of the device around the x axis, express in degrees with values ranging from -180 to 180. |
27
- | gamma | `number` | A number representing the motion of the device around the y axis, express in degrees with values ranging from -90 to 90. |
28
-
29
- You can find [more information about the state on the MDN](https://developer.mozilla.org/en-US/docs/Web/API/DeviceOrientationEvent#instance_properties).
30
-
31
- ## Component Usage
32
-
33
- ```vue
34
- <template>
35
- <UseDeviceOrientation v-slot="{ alpha, beta, gamma }">
36
- Alpha: {{ alpha }}
37
- Beta: {{ beta }}
38
- Gamma: {{ gamma }}
39
- </UseDeviceOrientation>
40
- </template>
41
- ```
42
-
43
- ## Type Declarations
44
-
45
- ```ts
46
- /**
47
- * Reactive DeviceOrientationEvent.
48
- *
49
- * @see https://vueuse.org/useDeviceOrientation
50
- * @param options
51
- *
52
- * @__NO_SIDE_EFFECTS__
53
- */
54
- export declare function useDeviceOrientation(options?: ConfigurableWindow): {
55
- isSupported: ComputedRef<boolean>
56
- isAbsolute: ShallowRef<boolean, boolean>
57
- alpha: Ref<number | null, number | null>
58
- beta: Ref<number | null, number | null>
59
- gamma: Ref<number | null, number | null>
60
- }
61
- export type UseDeviceOrientationReturn = ReturnType<typeof useDeviceOrientation>
62
- ```
@@ -1,44 +0,0 @@
1
- ---
2
- category: Sensors
3
- ---
4
-
5
- # useDevicePixelRatio
6
-
7
- Reactively track [`window.devicePixelRatio`](https://developer.mozilla.org/docs/Web/API/Window/devicePixelRatio)
8
-
9
- > NOTE: there is no event listener for `window.devicePixelRatio` change. So this function uses [`Testing media queries programmatically (window.matchMedia)`](https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Testing_media_queries) applying the same mechanism as described in [this example](https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio#monitoring_screen_resolution_or_zoom_level_changes).
10
-
11
- ## Usage
12
-
13
- ```ts
14
- import { useDevicePixelRatio } from '@vueuse/core'
15
-
16
- const { pixelRatio } = useDevicePixelRatio()
17
- ```
18
-
19
- ## Component Usage
20
-
21
- ```vue
22
- <template>
23
- <UseDevicePixelRatio v-slot="{ pixelRatio }">
24
- Pixel Ratio: {{ pixelRatio }}
25
- </UseDevicePixelRatio>
26
- </template>
27
- ```
28
-
29
- ## Type Declarations
30
-
31
- ```ts
32
- /**
33
- * Reactively track `window.devicePixelRatio`.
34
- *
35
- * @see https://vueuse.org/useDevicePixelRatio
36
- *
37
- * @__NO_SIDE_EFFECTS__
38
- */
39
- export declare function useDevicePixelRatio(options?: ConfigurableWindow): {
40
- pixelRatio: Readonly<Ref<number, number>>
41
- stop: WatchStopHandle
42
- }
43
- export type UseDevicePixelRatioReturn = ReturnType<typeof useDevicePixelRatio>
44
- ```
@@ -1,90 +0,0 @@
1
- ---
2
- category: Sensors
3
- ---
4
-
5
- # useDevicesList
6
-
7
- Reactive [enumerateDevices](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices) listing available input/output devices.
8
-
9
- ## Usage
10
-
11
- ```ts
12
- import { useDevicesList } from '@vueuse/core'
13
-
14
- const {
15
- devices,
16
- videoInputs: cameras,
17
- audioInputs: microphones,
18
- audioOutputs: speakers,
19
- } = useDevicesList()
20
- ```
21
-
22
- ## Requesting Permissions
23
-
24
- To request permissions, use the `ensurePermissions` method.
25
-
26
- ```ts
27
- import { useDevicesList } from '@vueuse/core'
28
- // ---cut---
29
- const {
30
- ensurePermissions,
31
- permissionGranted,
32
- } = useDevicesList()
33
-
34
- await ensurePermissions()
35
- console.log(permissionsGranted.value)
36
- ```
37
-
38
- # Component
39
-
40
- ```vue
41
- <template>
42
- <UseDevicesList v-slot="{ videoInputs, audioInputs, audioOutputs }">
43
- Cameras: {{ videoInputs }}
44
- Microphones: {{ audioInputs }}
45
- Speakers: {{ audioOutputs }}
46
- </UseDevicesList>
47
- </template>
48
- ```
49
-
50
- ## Type Declarations
51
-
52
- ```ts
53
- export interface UseDevicesListOptions extends ConfigurableNavigator {
54
- onUpdated?: (devices: MediaDeviceInfo[]) => void
55
- /**
56
- * Request for permissions immediately if it's not granted,
57
- * otherwise label and deviceIds could be empty
58
- *
59
- * @default false
60
- */
61
- requestPermissions?: boolean
62
- /**
63
- * Request for types of media permissions
64
- *
65
- * @default { audio: true, video: true }
66
- */
67
- constraints?: MediaStreamConstraints
68
- }
69
- export interface UseDevicesListReturn {
70
- /**
71
- * All devices
72
- */
73
- devices: Ref<MediaDeviceInfo[]>
74
- videoInputs: ComputedRef<MediaDeviceInfo[]>
75
- audioInputs: ComputedRef<MediaDeviceInfo[]>
76
- audioOutputs: ComputedRef<MediaDeviceInfo[]>
77
- permissionGranted: ShallowRef<boolean>
78
- ensurePermissions: () => Promise<boolean>
79
- isSupported: ComputedRef<boolean>
80
- }
81
- /**
82
- * Reactive `enumerateDevices` listing available input/output devices
83
- *
84
- * @see https://vueuse.org/useDevicesList
85
- * @param options
86
- */
87
- export declare function useDevicesList(
88
- options?: UseDevicesListOptions,
89
- ): UseDevicesListReturn
90
- ```
@@ -1,71 +0,0 @@
1
- ---
2
- category: Sensors
3
- related: useUserMedia
4
- ---
5
-
6
- # useDisplayMedia
7
-
8
- Reactive [`mediaDevices.getDisplayMedia`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia) streaming.
9
-
10
- ## Usage
11
-
12
- ```vue
13
- <script setup lang="ts">
14
- import { useDisplayMedia } from '@vueuse/core'
15
- import { useTemplateRef } from 'vue'
16
-
17
- const { stream, start } = useDisplayMedia()
18
-
19
- // start streaming
20
- start()
21
-
22
- const videoRef = useTemplateRef('video')
23
- watchEffect(() => {
24
- // preview on a video element
25
- videoRef.value.srcObject = stream.value
26
- })
27
- </script>
28
-
29
- <template>
30
- <video ref="video" />
31
- </template>
32
- ```
33
-
34
- ## Type Declarations
35
-
36
- ```ts
37
- export interface UseDisplayMediaOptions extends ConfigurableNavigator {
38
- /**
39
- * If the stream is enabled
40
- * @default false
41
- */
42
- enabled?: MaybeRef<boolean>
43
- /**
44
- * If the stream video media constraints
45
- */
46
- video?: boolean | MediaTrackConstraints | undefined
47
- /**
48
- * If the stream audio media constraints
49
- */
50
- audio?: boolean | MediaTrackConstraints | undefined
51
- }
52
- /**
53
- * Reactive `mediaDevices.getDisplayMedia` streaming
54
- *
55
- * @see https://vueuse.org/useDisplayMedia
56
- * @param options
57
- */
58
- export declare function useDisplayMedia(options?: UseDisplayMediaOptions): {
59
- isSupported: ComputedRef<boolean>
60
- stream: ShallowRef<MediaStream | undefined, MediaStream | undefined>
61
- start: () => Promise<MediaStream | undefined>
62
- stop: () => void
63
- enabled:
64
- | Ref<boolean, boolean>
65
- | ShallowRef<boolean, boolean>
66
- | WritableComputedRef<boolean, boolean>
67
- | ShallowRef<true, true>
68
- | ShallowRef<false, false>
69
- }
70
- export type UseDisplayMediaReturn = ReturnType<typeof useDisplayMedia>
71
- ```
@@ -1,45 +0,0 @@
1
- ---
2
- category: Elements
3
- ---
4
-
5
- # useDocumentVisibility
6
-
7
- Reactively track [`document.visibilityState`](https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState)
8
-
9
- ## Usage
10
-
11
- ```vue
12
- <script setup lang="ts">
13
- import { useDocumentVisibility } from '@vueuse/core'
14
-
15
- const visibility = useDocumentVisibility()
16
- </script>
17
- ```
18
-
19
- ## Component Usage
20
-
21
- ```vue
22
- <template>
23
- <UseDocumentVisibility v-slot="{ visibility }">
24
- Document Visibility: {{ visibility }}
25
- </UseDocumentVisibility>
26
- </template>
27
- ```
28
-
29
- ## Type Declarations
30
-
31
- ```ts
32
- /**
33
- * Reactively track `document.visibilityState`.
34
- *
35
- * @see https://vueuse.org/useDocumentVisibility
36
- *
37
- * @__NO_SIDE_EFFECTS__
38
- */
39
- export declare function useDocumentVisibility(
40
- options?: ConfigurableDocument,
41
- ): ShallowRef<DocumentVisibilityState, DocumentVisibilityState>
42
- export type UseDocumentVisibilityReturn = ReturnType<
43
- typeof useDocumentVisibility
44
- >
45
- ```