@stacksjs/composables 0.70.88 → 0.70.91

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 (333) hide show
  1. package/dist/_shared.d.ts +49 -0
  2. package/dist/_shared.js +23 -0
  3. package/dist/cloneFnJSON.d.ts +5 -0
  4. package/dist/cloneFnJSON.js +3 -0
  5. package/dist/computedAsync.d.ts +28 -0
  6. package/dist/computedAsync.js +20 -0
  7. package/dist/computedEager.d.ts +27 -0
  8. package/dist/computedEager.js +10 -0
  9. package/dist/createEventHook.d.ts +16 -0
  10. package/dist/createEventHook.js +15 -0
  11. package/dist/createFetch.d.ts +14 -0
  12. package/dist/createFetch.js +8 -0
  13. package/dist/createGlobalState.d.ts +17 -0
  14. package/dist/createGlobalState.js +10 -0
  15. package/dist/createSharedComposable.d.ts +8 -0
  16. package/dist/createSharedComposable.js +9 -0
  17. package/dist/extendRef.d.ts +9 -0
  18. package/dist/extendRef.js +6 -0
  19. package/dist/formatTimeAgo.d.ts +23 -0
  20. package/dist/formatTimeAgo.js +33 -0
  21. package/dist/index.d.ts +271 -0
  22. package/dist/index.js +210 -0
  23. package/dist/isDefined.d.ts +5 -0
  24. package/dist/isDefined.js +3 -0
  25. package/dist/makeDestructurable.d.ts +18 -0
  26. package/dist/makeDestructurable.js +16 -0
  27. package/dist/onClickOutside.d.ts +14 -0
  28. package/dist/onClickOutside.js +25 -0
  29. package/dist/onKeyStroke.d.ts +26 -0
  30. package/dist/onKeyStroke.js +31 -0
  31. package/dist/onLongPress.d.ts +14 -0
  32. package/dist/onLongPress.js +43 -0
  33. package/dist/onStartTyping.d.ts +8 -0
  34. package/dist/onStartTyping.js +23 -0
  35. package/dist/refAutoReset.d.ts +11 -0
  36. package/dist/refAutoReset.js +15 -0
  37. package/dist/refDefault.d.ts +9 -0
  38. package/dist/refDefault.js +8 -0
  39. package/dist/resolveRef.d.ts +7 -0
  40. package/dist/resolveRef.js +7 -0
  41. package/dist/ssrHandlers.d.ts +13 -0
  42. package/dist/ssrHandlers.js +8 -0
  43. package/dist/syncRef.d.ts +21 -0
  44. package/dist/syncRef.js +35 -0
  45. package/dist/tryOnMounted.d.ts +22 -0
  46. package/dist/tryOnMounted.js +22 -0
  47. package/dist/unrefElement.d.ts +6 -0
  48. package/dist/unrefElement.js +9 -0
  49. package/dist/until.d.ts +34 -0
  50. package/dist/until.js +62 -0
  51. package/dist/useActiveElement.d.ts +6 -0
  52. package/dist/useActiveElement.js +19 -0
  53. package/dist/useAnimate.d.ts +18 -0
  54. package/dist/useAnimate.js +48 -0
  55. package/dist/useArrayUtils.d.ts +42 -0
  56. package/dist/useArrayUtils.js +114 -0
  57. package/dist/useAsyncQueue.d.ts +18 -0
  58. package/dist/useAsyncQueue.js +22 -0
  59. package/dist/useAsyncState.d.ts +23 -0
  60. package/dist/useAsyncState.js +35 -0
  61. package/dist/useBase64.d.ts +12 -0
  62. package/dist/useBase64.js +45 -0
  63. package/dist/useBattery.d.ts +15 -0
  64. package/dist/useBattery.js +38 -0
  65. package/dist/useBreakpoints.d.ts +96 -0
  66. package/dist/useBreakpoints.js +97 -0
  67. package/dist/useBroadcastChannel.d.ts +14 -0
  68. package/dist/useBroadcastChannel.js +31 -0
  69. package/dist/useBrowserLocation.d.ts +18 -0
  70. package/dist/useBrowserLocation.js +64 -0
  71. package/dist/useClipboard.d.ts +17 -0
  72. package/dist/useClipboard.js +32 -0
  73. package/dist/useClipboardItems.d.ts +11 -0
  74. package/dist/useClipboardItems.js +15 -0
  75. package/dist/useCloned.d.ts +15 -0
  76. package/dist/useCloned.js +16 -0
  77. package/dist/useColorMode.d.ts +18 -0
  78. package/dist/useColorMode.js +60 -0
  79. package/dist/useConfirmDialog.d.ts +14 -0
  80. package/dist/useConfirmDialog.js +34 -0
  81. package/dist/useCounter.d.ts +20 -0
  82. package/dist/useCounter.js +28 -0
  83. package/dist/useCssVar.d.ts +10 -0
  84. package/dist/useCssVar.js +23 -0
  85. package/dist/useCycleList.d.ts +18 -0
  86. package/dist/useCycleList.js +27 -0
  87. package/dist/useDark.d.ts +11 -0
  88. package/dist/useDark.js +38 -0
  89. package/dist/useDateFormat.d.ts +10 -0
  90. package/dist/useDateFormat.js +11 -0
  91. package/dist/useDebounce.d.ts +10 -0
  92. package/dist/useDebounce.js +16 -0
  93. package/dist/useDebounceFn.d.ts +10 -0
  94. package/dist/useDebounceFn.js +18 -0
  95. package/dist/useDebouncedRef.d.ts +11 -0
  96. package/dist/useDebouncedRef.js +22 -0
  97. package/dist/useDebouncedRefHistory.d.ts +5 -0
  98. package/dist/useDebouncedRefHistory.js +36 -0
  99. package/dist/useDeviceMotion.d.ts +27 -0
  100. package/dist/useDeviceMotion.js +53 -0
  101. package/dist/useDeviceOrientation.d.ts +15 -0
  102. package/dist/useDeviceOrientation.js +23 -0
  103. package/dist/useDevicePixelRatio.d.ts +5 -0
  104. package/dist/useDevicePixelRatio.js +24 -0
  105. package/dist/useDocumentVisibility.d.ts +5 -0
  106. package/dist/useDocumentVisibility.js +16 -0
  107. package/dist/useDraggable.d.ts +23 -0
  108. package/dist/useDraggable.js +58 -0
  109. package/dist/useDropZone.d.ts +15 -0
  110. package/dist/useDropZone.js +52 -0
  111. package/dist/useElementBounding.d.ts +21 -0
  112. package/dist/useElementBounding.js +59 -0
  113. package/dist/useElementByPoint.d.ts +10 -0
  114. package/dist/useElementByPoint.js +18 -0
  115. package/dist/useElementHover.d.ts +9 -0
  116. package/dist/useElementHover.js +28 -0
  117. package/dist/useElementSize.d.ts +19 -0
  118. package/dist/useElementSize.js +34 -0
  119. package/dist/useElementVisibility.d.ts +10 -0
  120. package/dist/useElementVisibility.js +10 -0
  121. package/dist/useEventBus.d.ts +14 -0
  122. package/dist/useEventBus.js +41 -0
  123. package/dist/useEventListener.d.ts +14 -0
  124. package/dist/useEventListener.js +29 -0
  125. package/dist/useEventSource.d.ts +32 -0
  126. package/dist/useEventSource.js +72 -0
  127. package/dist/useEyeDropper.d.ts +10 -0
  128. package/dist/useEyeDropper.js +17 -0
  129. package/dist/useFavicon.d.ts +8 -0
  130. package/dist/useFavicon.js +22 -0
  131. package/dist/useFetch.d.ts +35 -0
  132. package/dist/useFetch.js +61 -0
  133. package/dist/useFileDialog.d.ts +15 -0
  134. package/dist/useFileDialog.js +24 -0
  135. package/dist/useFocus.d.ts +13 -0
  136. package/dist/useFocus.js +42 -0
  137. package/dist/useFocusWithin.d.ts +9 -0
  138. package/dist/useFocusWithin.js +29 -0
  139. package/dist/useForm.d.ts +97 -0
  140. package/dist/useForm.js +182 -0
  141. package/dist/useFps.d.ts +7 -0
  142. package/dist/useFps.js +22 -0
  143. package/dist/useFullscreen.d.ts +16 -0
  144. package/dist/useFullscreen.js +67 -0
  145. package/dist/useGeolocation.d.ts +26 -0
  146. package/dist/useGeolocation.js +55 -0
  147. package/dist/useIdle.d.ts +18 -0
  148. package/dist/useIdle.js +46 -0
  149. package/dist/useImage.d.ts +18 -0
  150. package/dist/useImage.js +32 -0
  151. package/dist/useInfiniteScroll.d.ts +11 -0
  152. package/dist/useInfiniteScroll.js +50 -0
  153. package/dist/useIntersectionObserver.d.ts +16 -0
  154. package/dist/useIntersectionObserver.js +27 -0
  155. package/dist/useInterval.d.ts +13 -0
  156. package/dist/useInterval.js +32 -0
  157. package/dist/useIntervalFn.d.ts +16 -0
  158. package/dist/useIntervalFn.js +24 -0
  159. package/dist/useKeyModifier.d.ts +6 -0
  160. package/dist/useKeyModifier.js +22 -0
  161. package/dist/useLastChanged.d.ts +11 -0
  162. package/dist/useLastChanged.js +8 -0
  163. package/dist/useLocalStorage.d.ts +17 -0
  164. package/dist/useLocalStorage.js +4 -0
  165. package/dist/useMagicKeys.d.ts +16 -0
  166. package/dist/useMagicKeys.js +81 -0
  167. package/dist/useManualRefHistory.d.ts +27 -0
  168. package/dist/useManualRefHistory.js +64 -0
  169. package/dist/useMath.d.ts +17 -0
  170. package/dist/useMath.js +52 -0
  171. package/dist/useMediaQuery.d.ts +9 -0
  172. package/dist/useMediaQuery.js +19 -0
  173. package/dist/useMemoize.d.ts +13 -0
  174. package/dist/useMemoize.js +24 -0
  175. package/dist/useMounted.d.ts +6 -0
  176. package/dist/useMounted.js +8 -0
  177. package/dist/useMouse.d.ts +19 -0
  178. package/dist/useMouse.js +67 -0
  179. package/dist/useMouseInElement.d.ts +17 -0
  180. package/dist/useMouseInElement.js +31 -0
  181. package/dist/useMousePressed.d.ts +10 -0
  182. package/dist/useMousePressed.js +31 -0
  183. package/dist/useMutationObserver.d.ts +16 -0
  184. package/dist/useMutationObserver.js +27 -0
  185. package/dist/useNavigatorLanguage.d.ts +5 -0
  186. package/dist/useNavigatorLanguage.js +17 -0
  187. package/dist/useNetwork.d.ts +18 -0
  188. package/dist/useNetwork.js +58 -0
  189. package/dist/useNow.d.ts +8 -0
  190. package/dist/useNow.js +10 -0
  191. package/dist/useObjectUrl.d.ts +8 -0
  192. package/dist/useObjectUrl.js +23 -0
  193. package/dist/useOffsetPagination.d.ts +21 -0
  194. package/dist/useOffsetPagination.js +45 -0
  195. package/dist/useOnline.d.ts +7 -0
  196. package/dist/useOnline.js +20 -0
  197. package/dist/usePageLeave.d.ts +9 -0
  198. package/dist/usePageLeave.js +27 -0
  199. package/dist/useParallax.d.ts +15 -0
  200. package/dist/useParallax.js +33 -0
  201. package/dist/useParentElement.d.ts +6 -0
  202. package/dist/useParentElement.js +8 -0
  203. package/dist/usePermission.d.ts +7 -0
  204. package/dist/usePermission.js +21 -0
  205. package/dist/usePointer.d.ts +15 -0
  206. package/dist/usePointer.js +32 -0
  207. package/dist/usePointerLock.d.ts +13 -0
  208. package/dist/usePointerLock.js +33 -0
  209. package/dist/usePointerSwipe.d.ts +20 -0
  210. package/dist/usePointerSwipe.js +52 -0
  211. package/dist/usePreferredColorScheme.d.ts +6 -0
  212. package/dist/usePreferredColorScheme.js +25 -0
  213. package/dist/usePreferredContrast.d.ts +6 -0
  214. package/dist/usePreferredContrast.js +29 -0
  215. package/dist/usePreferredLanguages.d.ts +5 -0
  216. package/dist/usePreferredLanguages.js +16 -0
  217. package/dist/usePreferredReducedMotion.d.ts +6 -0
  218. package/dist/usePreferredReducedMotion.js +18 -0
  219. package/dist/usePrevious.d.ts +9 -0
  220. package/dist/usePrevious.js +8 -0
  221. package/dist/useQuery.d.ts +106 -0
  222. package/dist/useQuery.js +265 -0
  223. package/dist/useRafFn.d.ts +19 -0
  224. package/dist/useRafFn.js +37 -0
  225. package/dist/useRefHistory.d.ts +28 -0
  226. package/dist/useRefHistory.js +72 -0
  227. package/dist/useResizeObserver.d.ts +16 -0
  228. package/dist/useResizeObserver.js +27 -0
  229. package/dist/useScreenOrientation.d.ts +13 -0
  230. package/dist/useScreenOrientation.js +27 -0
  231. package/dist/useScreenSafeArea.d.ts +12 -0
  232. package/dist/useScreenSafeArea.js +25 -0
  233. package/dist/useScriptTag.d.ts +20 -0
  234. package/dist/useScriptTag.js +52 -0
  235. package/dist/useScroll.d.ts +36 -0
  236. package/dist/useScroll.js +116 -0
  237. package/dist/useScrollLock.d.ts +10 -0
  238. package/dist/useScrollLock.js +39 -0
  239. package/dist/useSessionStorage.d.ts +17 -0
  240. package/dist/useSessionStorage.js +4 -0
  241. package/dist/useShare.d.ts +15 -0
  242. package/dist/useShare.js +11 -0
  243. package/dist/useSorted.d.ts +10 -0
  244. package/dist/useSorted.js +10 -0
  245. package/dist/useStepper.d.ts +23 -0
  246. package/dist/useStepper.js +46 -0
  247. package/dist/useStorage.d.ts +18 -0
  248. package/dist/useStorage.js +54 -0
  249. package/dist/useStyleTag.d.ts +17 -0
  250. package/dist/useStyleTag.js +39 -0
  251. package/dist/useSupported.d.ts +8 -0
  252. package/dist/useSupported.js +10 -0
  253. package/dist/useSwipe.d.ts +20 -0
  254. package/dist/useSwipe.js +58 -0
  255. package/dist/useTextDirection.d.ts +9 -0
  256. package/dist/useTextDirection.js +16 -0
  257. package/dist/useTextSelection.d.ts +10 -0
  258. package/dist/useTextSelection.js +27 -0
  259. package/dist/useTextareaAutosize.d.ts +10 -0
  260. package/dist/useTextareaAutosize.js +20 -0
  261. package/dist/useThrottle.d.ts +9 -0
  262. package/dist/useThrottle.js +23 -0
  263. package/dist/useThrottleFn.d.ts +11 -0
  264. package/dist/useThrottleFn.js +36 -0
  265. package/dist/useThrottledRef.d.ts +11 -0
  266. package/dist/useThrottledRef.js +30 -0
  267. package/dist/useThrottledRefHistory.d.ts +5 -0
  268. package/dist/useThrottledRefHistory.js +43 -0
  269. package/dist/useTimeAgo.d.ts +16 -0
  270. package/dist/useTimeAgo.js +58 -0
  271. package/dist/useTimeout.d.ts +12 -0
  272. package/dist/useTimeout.js +32 -0
  273. package/dist/useTimeoutFn.d.ts +16 -0
  274. package/dist/useTimeoutFn.js +27 -0
  275. package/dist/useTimeoutPoll.d.ts +10 -0
  276. package/dist/useTimeoutPoll.js +33 -0
  277. package/dist/useTimestamp.d.ts +15 -0
  278. package/dist/useTimestamp.js +43 -0
  279. package/dist/useTitle.d.ts +10 -0
  280. package/dist/useTitle.js +12 -0
  281. package/dist/useToNumber.d.ts +11 -0
  282. package/dist/useToNumber.js +25 -0
  283. package/dist/useToString.d.ts +6 -0
  284. package/dist/useToString.js +10 -0
  285. package/dist/useToggle.d.ts +6 -0
  286. package/dist/useToggle.js +12 -0
  287. package/dist/useTransition.d.ts +28 -0
  288. package/dist/useTransition.js +89 -0
  289. package/dist/useUrlSearchParams.d.ts +18 -0
  290. package/dist/useUrlSearchParams.js +72 -0
  291. package/dist/useVibrate.d.ts +13 -0
  292. package/dist/useVibrate.js +14 -0
  293. package/dist/useVirtualList.d.ts +23 -0
  294. package/dist/useVirtualList.js +49 -0
  295. package/dist/useWakeLock.d.ts +12 -0
  296. package/dist/useWakeLock.js +32 -0
  297. package/dist/useWebNotification.d.ts +25 -0
  298. package/dist/useWebNotification.js +39 -0
  299. package/dist/useWebSocket.d.ts +38 -0
  300. package/dist/useWebSocket.js +103 -0
  301. package/dist/useWebWorker.d.ts +18 -0
  302. package/dist/useWebWorker.js +56 -0
  303. package/dist/useWindowFocus.d.ts +5 -0
  304. package/dist/useWindowFocus.js +20 -0
  305. package/dist/useWindowScroll.d.ts +9 -0
  306. package/dist/useWindowScroll.js +17 -0
  307. package/dist/useWindowSize.d.ts +15 -0
  308. package/dist/useWindowSize.js +28 -0
  309. package/dist/watchArray.d.ts +5 -0
  310. package/dist/watchArray.js +9 -0
  311. package/dist/watchAtMost.d.ts +5 -0
  312. package/dist/watchAtMost.js +12 -0
  313. package/dist/watchDebounced.d.ts +23 -0
  314. package/dist/watchDebounced.js +20 -0
  315. package/dist/watchDeep.d.ts +7 -0
  316. package/dist/watchDeep.js +13 -0
  317. package/dist/watchIgnorable.d.ts +12 -0
  318. package/dist/watchIgnorable.js +19 -0
  319. package/dist/watchImmediate.d.ts +5 -0
  320. package/dist/watchImmediate.js +7 -0
  321. package/dist/watchOnce.d.ts +19 -0
  322. package/dist/watchOnce.js +17 -0
  323. package/dist/watchPausable.d.ts +13 -0
  324. package/dist/watchPausable.js +23 -0
  325. package/dist/watchThrottled.d.ts +23 -0
  326. package/dist/watchThrottled.js +37 -0
  327. package/dist/watchTriggerable.d.ts +5 -0
  328. package/dist/watchTriggerable.js +10 -0
  329. package/dist/watchWithFilter.d.ts +7 -0
  330. package/dist/watchWithFilter.js +6 -0
  331. package/dist/whenever.d.ts +18 -0
  332. package/dist/whenever.js +7 -0
  333. package/package.json +2 -2
package/dist/index.js ADDED
@@ -0,0 +1,210 @@
1
+ export { defaultDocument, defaultNavigator, defaultWindow, isRef, noop, toValue, unref } from "./_shared";
2
+ export { getSSRHandler, setSSRHandler, customStorageEventName } from "./ssrHandlers";
3
+ export { useStorage } from "./useStorage";
4
+ export { useLocalStorage } from "./useLocalStorage";
5
+ export { useSessionStorage } from "./useSessionStorage";
6
+ export { useDark, usePreferredDark } from "./useDark";
7
+ export { useColorMode } from "./useColorMode";
8
+ export { usePreferredColorScheme } from "./usePreferredColorScheme";
9
+ export { usePreferredContrast } from "./usePreferredContrast";
10
+ export { usePreferredReducedMotion } from "./usePreferredReducedMotion";
11
+ export { useOnline } from "./useOnline";
12
+ export { useNetwork } from "./useNetwork";
13
+ export { useToggle } from "./useToggle";
14
+ export { useFetch } from "./useFetch";
15
+ export { createFetch } from "./createFetch";
16
+ export { createQueryClient, queryClient, useMutation, useQuery } from "./useQuery";
17
+ export { useForm } from "./useForm";
18
+ export { useDateFormat } from "./useDateFormat";
19
+ export { useNow } from "./useNow";
20
+ export { useTimestamp } from "./useTimestamp";
21
+ export { useTimeAgo } from "./useTimeAgo";
22
+ export { useEventListener } from "./useEventListener";
23
+ export { useEventBus } from "./useEventBus";
24
+ export { createEventHook } from "./createEventHook";
25
+ export { useDebounceFn } from "./useDebounceFn";
26
+ export { useThrottleFn } from "./useThrottleFn";
27
+ export { useDebouncedRef } from "./useDebouncedRef";
28
+ export { useThrottledRef } from "./useThrottledRef";
29
+ export { useDebounce } from "./useDebounce";
30
+ export { useThrottle } from "./useThrottle";
31
+ export { useInterval } from "./useInterval";
32
+ export { useIntervalFn } from "./useIntervalFn";
33
+ export { useTimeout } from "./useTimeout";
34
+ export { useTimeoutFn } from "./useTimeoutFn";
35
+ export { useTimeoutPoll } from "./useTimeoutPoll";
36
+ export { useRafFn } from "./useRafFn";
37
+ export { useFps } from "./useFps";
38
+ export { useClipboard } from "./useClipboard";
39
+ export { useClipboardItems } from "./useClipboardItems";
40
+ export { useMediaQuery } from "./useMediaQuery";
41
+ export {
42
+ breakpointsAntDesign,
43
+ breakpointsBootstrap,
44
+ breakpointsBootstrapV5,
45
+ breakpointsMasterCss,
46
+ breakpointsQuasar,
47
+ breakpointsSematic,
48
+ breakpointsTailwind,
49
+ breakpointsVuetify,
50
+ useBreakpoints
51
+ } from "./useBreakpoints";
52
+ export { useTitle } from "./useTitle";
53
+ export { useFavicon } from "./useFavicon";
54
+ export { useDocumentVisibility } from "./useDocumentVisibility";
55
+ export { useTextDirection } from "./useTextDirection";
56
+ export { useTextSelection } from "./useTextSelection";
57
+ export { useUrlSearchParams } from "./useUrlSearchParams";
58
+ export { useBrowserLocation } from "./useBrowserLocation";
59
+ export { useWindowSize } from "./useWindowSize";
60
+ export { useWindowFocus } from "./useWindowFocus";
61
+ export { useWindowScroll } from "./useWindowScroll";
62
+ export { useScroll } from "./useScroll";
63
+ export { useScrollLock } from "./useScrollLock";
64
+ export { useInfiniteScroll } from "./useInfiniteScroll";
65
+ export { useFullscreen } from "./useFullscreen";
66
+ export { onClickOutside } from "./onClickOutside";
67
+ export { onKeyStroke, onKeyDown, onKeyUp } from "./onKeyStroke";
68
+ export { onLongPress } from "./onLongPress";
69
+ export { onStartTyping } from "./onStartTyping";
70
+ export { useKeyModifier } from "./useKeyModifier";
71
+ export { useMagicKeys } from "./useMagicKeys";
72
+ export {
73
+ and,
74
+ logicNot,
75
+ logicOr,
76
+ or,
77
+ useAbs,
78
+ useAverage,
79
+ useCeil,
80
+ useClamp,
81
+ useFloor,
82
+ useMax,
83
+ useMin,
84
+ usePrecision,
85
+ useRound,
86
+ useSum,
87
+ useTrunc
88
+ } from "./useMath";
89
+ export { useCounter } from "./useCounter";
90
+ export { usePrevious } from "./usePrevious";
91
+ export { useLastChanged } from "./useLastChanged";
92
+ export { useStepper } from "./useStepper";
93
+ export { useCycleList } from "./useCycleList";
94
+ export { useSorted } from "./useSorted";
95
+ export { useCloned } from "./useCloned";
96
+ export { useManualRefHistory } from "./useManualRefHistory";
97
+ export { useRefHistory } from "./useRefHistory";
98
+ export { useDebouncedRefHistory } from "./useDebouncedRefHistory";
99
+ export { useThrottledRefHistory } from "./useThrottledRefHistory";
100
+ export { useAsyncState } from "./useAsyncState";
101
+ export { useAsyncQueue } from "./useAsyncQueue";
102
+ export { whenever } from "./whenever";
103
+ export { watchOnce } from "./watchOnce";
104
+ export { watchDebounced } from "./watchDebounced";
105
+ export { watchThrottled } from "./watchThrottled";
106
+ export { watchPausable, pausableWatch } from "./watchPausable";
107
+ export { watchIgnorable, ignorableWatch } from "./watchIgnorable";
108
+ export { watchArray } from "./watchArray";
109
+ export { watchAtMost } from "./watchAtMost";
110
+ export { watchDeep } from "./watchDeep";
111
+ export { watchImmediate } from "./watchImmediate";
112
+ export { watchTriggerable } from "./watchTriggerable";
113
+ export { watchWithFilter } from "./watchWithFilter";
114
+ export { useWebSocket } from "./useWebSocket";
115
+ export { useEventSource } from "./useEventSource";
116
+ export { useBroadcastChannel } from "./useBroadcastChannel";
117
+ export { computedAsync } from "./computedAsync";
118
+ export { computedEager } from "./computedEager";
119
+ export { useIntersectionObserver } from "./useIntersectionObserver";
120
+ export { useResizeObserver } from "./useResizeObserver";
121
+ export { useMutationObserver } from "./useMutationObserver";
122
+ export { useElementSize } from "./useElementSize";
123
+ export { useElementBounding } from "./useElementBounding";
124
+ export { useElementVisibility } from "./useElementVisibility";
125
+ export { useElementHover } from "./useElementHover";
126
+ export { useElementByPoint } from "./useElementByPoint";
127
+ export { useCssVar } from "./useCssVar";
128
+ export { unrefElement } from "./unrefElement";
129
+ export { useMouse } from "./useMouse";
130
+ export { useMouseInElement } from "./useMouseInElement";
131
+ export { useMousePressed } from "./useMousePressed";
132
+ export { usePointer } from "./usePointer";
133
+ export { useSwipe } from "./useSwipe";
134
+ export { usePointerSwipe } from "./usePointerSwipe";
135
+ export { usePointerLock } from "./usePointerLock";
136
+ export { useParallax } from "./useParallax";
137
+ export { useGeolocation } from "./useGeolocation";
138
+ export { useDeviceMotion } from "./useDeviceMotion";
139
+ export { useDeviceOrientation } from "./useDeviceOrientation";
140
+ export { useDevicePixelRatio } from "./useDevicePixelRatio";
141
+ export { useBattery } from "./useBattery";
142
+ export { useFocus } from "./useFocus";
143
+ export { useFocusWithin } from "./useFocusWithin";
144
+ export { useActiveElement } from "./useActiveElement";
145
+ export { useIdle } from "./useIdle";
146
+ export { usePageLeave } from "./usePageLeave";
147
+ export { useMounted } from "./useMounted";
148
+ export { useDraggable } from "./useDraggable";
149
+ export { useDropZone } from "./useDropZone";
150
+ export { useNavigatorLanguage } from "./useNavigatorLanguage";
151
+ export { usePreferredLanguages } from "./usePreferredLanguages";
152
+ export { useScreenOrientation } from "./useScreenOrientation";
153
+ export { useScreenSafeArea } from "./useScreenSafeArea";
154
+ export { useParentElement } from "./useParentElement";
155
+ export { usePermission } from "./usePermission";
156
+ export { useShare } from "./useShare";
157
+ export { useObjectUrl } from "./useObjectUrl";
158
+ export { useImage } from "./useImage";
159
+ export { useBase64 } from "./useBase64";
160
+ export { useAnimate } from "./useAnimate";
161
+ export { useTransition, executeTransition, TransitionPresets } from "./useTransition";
162
+ export { useScriptTag } from "./useScriptTag";
163
+ export { useStyleTag } from "./useStyleTag";
164
+ export { useConfirmDialog } from "./useConfirmDialog";
165
+ export { useFileDialog } from "./useFileDialog";
166
+ export { useEyeDropper } from "./useEyeDropper";
167
+ export { useTextareaAutosize } from "./useTextareaAutosize";
168
+ export { useWebNotification } from "./useWebNotification";
169
+ export { useVibrate } from "./useVibrate";
170
+ export { useWakeLock } from "./useWakeLock";
171
+ export { useWebWorker, useWebWorkerFn } from "./useWebWorker";
172
+ export { useVirtualList } from "./useVirtualList";
173
+ export { useOffsetPagination } from "./useOffsetPagination";
174
+ export { isDefined } from "./isDefined";
175
+ export { useSupported } from "./useSupported";
176
+ export { useToNumber } from "./useToNumber";
177
+ export { useToString } from "./useToString";
178
+ export { refDefault } from "./refDefault";
179
+ export { refAutoReset, autoResetRef } from "./refAutoReset";
180
+ export { cloneFnJSON } from "./cloneFnJSON";
181
+ export { formatTimeAgo } from "./formatTimeAgo";
182
+ export { until } from "./until";
183
+ export { resolveRef } from "./resolveRef";
184
+ export { extendRef } from "./extendRef";
185
+ export { useMemoize } from "./useMemoize";
186
+ export { makeDestructurable } from "./makeDestructurable";
187
+ export { syncRef, syncRefs } from "./syncRef";
188
+ export { createGlobalState } from "./createGlobalState";
189
+ export { createSharedComposable } from "./createSharedComposable";
190
+ export { tryOnMounted, tryOnBeforeMount, tryOnUnmounted, tryOnBeforeUnmount, tryOnScopeDispose } from "./tryOnMounted";
191
+ export {
192
+ useArrayDifference,
193
+ useArrayEvery,
194
+ useArrayFilter,
195
+ useArrayFind,
196
+ useArrayFindIndex,
197
+ useArrayIncludes,
198
+ useArrayMap,
199
+ useArrayReduce,
200
+ useArraySome,
201
+ useArrayUnique
202
+ } from "./useArrayUtils";
203
+ export { computedAsync as asyncComputed } from "./computedAsync";
204
+ export { computedEager as eagerComputed } from "./computedEager";
205
+ export { useDebouncedRef as debouncedRef } from "./useDebouncedRef";
206
+ export { useDebouncedRef as refDebounced } from "./useDebouncedRef";
207
+ export { useThrottledRef as throttledRef } from "./useThrottledRef";
208
+ export { useThrottledRef as refThrottled } from "./useThrottledRef";
209
+ export { watchDebounced as debouncedWatch } from "./watchDebounced";
210
+ export { watchThrottled as throttledWatch } from "./watchThrottled";
@@ -0,0 +1,5 @@
1
+ import type { Ref } from '@stacksjs/stx';
2
+ /**
3
+ * Check if a ref value is defined (not null or undefined).
4
+ */
5
+ export declare function isDefined<T>(v: Ref<T>): v is Ref<Exclude<T, null | undefined>>;
@@ -0,0 +1,3 @@
1
+ export function isDefined(v) {
2
+ return v.value !== null && v.value !== void 0;
3
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Make an object that can be destructured as both an object and an array.
3
+ *
4
+ * @param obj - The object with named properties
5
+ * @param arr - The array with positional values
6
+ * @returns A value that supports both object and array destructuring
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const result = makeDestructurable(
11
+ * { x: 1, y: 2 } as const,
12
+ * [1, 2] as const,
13
+ * )
14
+ * const { x, y } = result // object destructuring
15
+ * const [a, b] = result // array destructuring
16
+ * ```
17
+ */
18
+ export declare function makeDestructurable<T extends Record<string, unknown>, A extends readonly unknown[],>(obj: T, arr: A): T & A;
@@ -0,0 +1,16 @@
1
+ export function makeDestructurable(obj, arr) {
2
+ const clone = { ...obj };
3
+ Object.defineProperty(clone, Symbol.iterator, {
4
+ enumerable: !1,
5
+ value() {
6
+ let index = 0;
7
+ return {
8
+ next: () => ({
9
+ value: arr[index++],
10
+ done: index > arr.length
11
+ })
12
+ };
13
+ }
14
+ });
15
+ return clone;
16
+ }
@@ -0,0 +1,14 @@
1
+ import type { MaybeRef } from './_shared';
2
+ /**
3
+ * Listen for clicks outside a target element.
4
+ * Calls the handler when a click occurs outside the target element.
5
+ *
6
+ * @param target - Element to detect clicks outside of
7
+ * @param handler - Callback when click outside is detected
8
+ * @param options - Configuration options
9
+ * @returns Cleanup function to remove the listener
10
+ */
11
+ export declare function onClickOutside(target: MaybeRef<HTMLElement | null>, handler: (event: MouseEvent) => void, options?: OnClickOutsideOptions): () => void;
12
+ export declare interface OnClickOutsideOptions {
13
+ ignore?: MaybeRef<HTMLElement | null>[]
14
+ }
@@ -0,0 +1,25 @@
1
+ import { defaultWindow, unref } from "./_shared";
2
+ export function onClickOutside(target, handler, options) {
3
+ const win = defaultWindow();
4
+ if (!win)
5
+ return () => {};
6
+ const { ignore = [] } = options ?? {};
7
+ function listener(event) {
8
+ const el = unref(target);
9
+ if (!el)
10
+ return;
11
+ const mouseEvent = event, composedPath = mouseEvent.composedPath?.() ?? [];
12
+ if (el === mouseEvent.target || composedPath.includes(el) || el.contains(mouseEvent.target))
13
+ return;
14
+ for (const ignored of ignore) {
15
+ const ignoredEl = unref(ignored);
16
+ if (ignoredEl && (ignoredEl === mouseEvent.target || composedPath.includes(ignoredEl) || ignoredEl.contains(mouseEvent.target)))
17
+ return;
18
+ }
19
+ handler(mouseEvent);
20
+ }
21
+ win.addEventListener("pointerdown", listener, { passive: !0 });
22
+ return () => {
23
+ win.removeEventListener("pointerdown", listener);
24
+ };
25
+ }
@@ -0,0 +1,26 @@
1
+ import type { MaybeRef } from './_shared';
2
+ /**
3
+ * Listen for specific key strokes.
4
+ * Calls the handler when the specified key is pressed.
5
+ *
6
+ * @param key - Key(s) to listen for, or a filter function
7
+ * @param handler - Callback when key is pressed
8
+ * @param options - Configuration options
9
+ * @returns Cleanup function to remove the listener
10
+ */
11
+ export declare function onKeyStroke(key: KeyFilter, handler: (event: KeyboardEvent) => void, options?: OnKeyStrokeOptions): () => void;
12
+ /**
13
+ * Listen for keydown events on specific keys.
14
+ * Alias for onKeyStroke with eventName: 'keydown'.
15
+ */
16
+ export declare function onKeyDown(key: KeyFilter, handler: (event: KeyboardEvent) => void, options?: Omit<OnKeyStrokeOptions, 'eventName'>): () => void;
17
+ /**
18
+ * Listen for keyup events on specific keys.
19
+ * Alias for onKeyStroke with eventName: 'keyup'.
20
+ */
21
+ export declare function onKeyUp(key: KeyFilter, handler: (event: KeyboardEvent) => void, options?: Omit<OnKeyStrokeOptions, 'eventName'>): () => void;
22
+ export declare interface OnKeyStrokeOptions {
23
+ eventName?: 'keydown' | 'keyup' | 'keypress'
24
+ target?: MaybeRef<EventTarget | null>
25
+ }
26
+ declare type KeyFilter = string | string[] | ((_event: KeyboardEvent) => boolean);
@@ -0,0 +1,31 @@
1
+ import { defaultWindow, unref } from "./_shared";
2
+ export function onKeyStroke(key, handler, options) {
3
+ const { eventName = "keydown", target } = options ?? {}, win = defaultWindow(), eventTarget = target ? unref(target) : win;
4
+ if (!eventTarget)
5
+ return () => {};
6
+ function createKeyFilter(keyDef) {
7
+ if (typeof keyDef === "function")
8
+ return keyDef;
9
+ if (typeof keyDef === "string")
10
+ return (event) => event.key === keyDef;
11
+ if (Array.isArray(keyDef))
12
+ return (event) => keyDef.includes(event.key);
13
+ return () => !0;
14
+ }
15
+ const filter = createKeyFilter(key);
16
+ function listener(event) {
17
+ const keyEvent = event;
18
+ if (filter(keyEvent))
19
+ handler(keyEvent);
20
+ }
21
+ eventTarget.addEventListener(eventName, listener);
22
+ return () => {
23
+ eventTarget.removeEventListener(eventName, listener);
24
+ };
25
+ }
26
+ export function onKeyDown(key, handler, options) {
27
+ return onKeyStroke(key, handler, { ...options, eventName: "keydown" });
28
+ }
29
+ export function onKeyUp(key, handler, options) {
30
+ return onKeyStroke(key, handler, { ...options, eventName: "keyup" });
31
+ }
@@ -0,0 +1,14 @@
1
+ import type { MaybeRef } from './_shared';
2
+ /**
3
+ * Listen for long press events on an element.
4
+ *
5
+ * @param target - The target element
6
+ * @param handler - The callback to invoke on long press
7
+ * @param options - Configuration options
8
+ * @returns A cleanup function
9
+ */
10
+ export declare function onLongPress(target: MaybeRef<HTMLElement | null | undefined>, handler: (e: PointerEvent) => void, options?: OnLongPressOptions): () => void;
11
+ export declare interface OnLongPressOptions {
12
+ delay?: number
13
+ distanceThreshold?: number
14
+ }
@@ -0,0 +1,43 @@
1
+ import { onUnmounted } from "@stacksjs/stx";
2
+ import { unref } from "./_shared";
3
+ export function onLongPress(target, handler, options = {}) {
4
+ const { delay = 500, distanceThreshold = 10 } = options;
5
+ let timer = null, startX = 0, startY = 0;
6
+ const el = unref(target);
7
+ if (!el)
8
+ return () => {};
9
+ const clear = () => {
10
+ if (timer !== null) {
11
+ clearTimeout(timer);
12
+ timer = null;
13
+ }
14
+ }, onDown = (e) => {
15
+ startX = e.clientX;
16
+ startY = e.clientY;
17
+ clear();
18
+ timer = setTimeout(() => handler(e), delay);
19
+ }, onMove = (e) => {
20
+ if (timer === null)
21
+ return;
22
+ const dx = Math.abs(e.clientX - startX), dy = Math.abs(e.clientY - startY);
23
+ if (dx > distanceThreshold || dy > distanceThreshold)
24
+ clear();
25
+ }, onUp = () => {
26
+ clear();
27
+ };
28
+ el.addEventListener("pointerdown", onDown);
29
+ el.addEventListener("pointermove", onMove);
30
+ el.addEventListener("pointerup", onUp);
31
+ el.addEventListener("pointercancel", onUp);
32
+ const cleanup = () => {
33
+ clear();
34
+ el.removeEventListener("pointerdown", onDown);
35
+ el.removeEventListener("pointermove", onMove);
36
+ el.removeEventListener("pointerup", onUp);
37
+ el.removeEventListener("pointercancel", onUp);
38
+ };
39
+ try {
40
+ onUnmounted(cleanup);
41
+ } catch {}
42
+ return cleanup;
43
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Detect when the user starts typing.
3
+ * Fires when a keydown event produces a printable character and the active element is not an input.
4
+ *
5
+ * @param callback - Called when typing starts
6
+ * @returns A cleanup function
7
+ */
8
+ export declare function onStartTyping(callback: (event: KeyboardEvent) => void): () => void;
@@ -0,0 +1,23 @@
1
+ import { onUnmounted } from "@stacksjs/stx";
2
+ export function onStartTyping(callback) {
3
+ if (typeof document > "u")
4
+ return () => {};
5
+ const handler = (e) => {
6
+ const active = document.activeElement;
7
+ if (active) {
8
+ const tag = active.tagName.toLowerCase();
9
+ if (tag === "input" || tag === "textarea" || active.isContentEditable)
10
+ return;
11
+ }
12
+ if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey)
13
+ callback(e);
14
+ };
15
+ document.addEventListener("keydown", handler);
16
+ const cleanup = () => {
17
+ document.removeEventListener("keydown", handler);
18
+ };
19
+ try {
20
+ onUnmounted(cleanup);
21
+ } catch {}
22
+ return cleanup;
23
+ }
@@ -0,0 +1,11 @@
1
+ import type { Ref } from '@stacksjs/stx';
2
+ /**
3
+ * Create a ref that automatically resets to a default value after a delay.
4
+ *
5
+ * @param defaultValue - The default value to reset to
6
+ * @param afterMs - Delay in milliseconds before resetting (default 1000)
7
+ * @returns A ref that auto-resets
8
+ */
9
+ export declare function refAutoReset<T>(defaultValue: T, afterMs?: number): Ref<T>;
10
+ /** Alias for refAutoReset */
11
+ export declare const autoResetRef: unknown;
@@ -0,0 +1,15 @@
1
+ import { ref, watch } from "@stacksjs/stx";
2
+ export function refAutoReset(defaultValue, afterMs = 1000) {
3
+ const value = ref(defaultValue);
4
+ let timer = null;
5
+ watch(value, () => {
6
+ if (timer !== null)
7
+ clearTimeout(timer);
8
+ timer = setTimeout(() => {
9
+ value.value = defaultValue;
10
+ timer = null;
11
+ }, afterMs);
12
+ });
13
+ return value;
14
+ }
15
+ export const autoResetRef = refAutoReset;
@@ -0,0 +1,9 @@
1
+ import type { Ref } from '@stacksjs/stx';
2
+ /**
3
+ * Apply a default value to a ref when it becomes null or undefined.
4
+ *
5
+ * @param source - The source ref
6
+ * @param defaultValue - The default value to use when source is null/undefined
7
+ * @returns A ref that always has a defined value
8
+ */
9
+ export declare function refDefault<T>(source: Ref<T | null | undefined>, defaultValue: T): Ref<T>;
@@ -0,0 +1,8 @@
1
+ import { ref, watch } from "@stacksjs/stx";
2
+ export function refDefault(source, defaultValue) {
3
+ const result = ref(source.value ?? defaultValue);
4
+ watch(source, (val) => {
5
+ result.value = val ?? defaultValue;
6
+ });
7
+ return result;
8
+ }
@@ -0,0 +1,7 @@
1
+ import type { MaybeRef } from './_shared';
2
+ import type { Ref } from '@stacksjs/stx';
3
+ /**
4
+ * Normalize a value/ref/getter to a ref.
5
+ * If already a ref, returns it as-is. Otherwise wraps in a new ref.
6
+ */
7
+ export declare function resolveRef<T>(value: MaybeRef<T>): Ref<T>;
@@ -0,0 +1,7 @@
1
+ import { ref } from "@stacksjs/stx";
2
+ import { isRef } from "./_shared";
3
+ export function resolveRef(value) {
4
+ if (isRef(value))
5
+ return value;
6
+ return ref(value);
7
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Get an SSR handler by key.
3
+ */
4
+ export declare function getSSRHandler(key: string): SSRHandler | undefined;
5
+ /**
6
+ * Set an SSR handler by key.
7
+ */
8
+ export declare function setSSRHandler(key: string, handler: SSRHandler): void;
9
+ /**
10
+ * Custom event name for storage events.
11
+ */
12
+ export declare const customStorageEventName: 'stx-storage';
13
+ declare type SSRHandler = (..._args: any[]) => any;
@@ -0,0 +1,8 @@
1
+ const handlers = new Map;
2
+ export function getSSRHandler(key) {
3
+ return handlers.get(key);
4
+ }
5
+ export function setSSRHandler(key, handler) {
6
+ handlers.set(key, handler);
7
+ }
8
+ export const customStorageEventName = "stx-storage";
@@ -0,0 +1,21 @@
1
+ import type { Ref } from '@stacksjs/stx';
2
+ /**
3
+ * Two-way sync between two refs.
4
+ *
5
+ * @param left - First ref
6
+ * @param right - Second ref
7
+ * @param options - Sync direction options
8
+ * @returns A stop function to cancel the sync
9
+ */
10
+ export declare function syncRef<T>(left: Ref<T>, right: Ref<T>, options?: SyncRefOptions): () => void;
11
+ /**
12
+ * Sync multiple source refs to a target ref.
13
+ *
14
+ * @param sources - Array of source refs
15
+ * @param target - Target ref that will be updated when any source changes
16
+ * @returns A stop function to cancel all watches
17
+ */
18
+ export declare function syncRefs<T>(sources: Ref<T>[], target: Ref<T>): () => void;
19
+ export declare interface SyncRefOptions {
20
+ direction?: 'ltr' | 'rtl' | 'both'
21
+ }
@@ -0,0 +1,35 @@
1
+ import { watch } from "@stacksjs/stx";
2
+ export function syncRef(left, right, options = {}) {
3
+ const { direction = "both" } = options;
4
+ let syncing = !1;
5
+ const unwatchers = [];
6
+ if (direction === "both" || direction === "ltr")
7
+ unwatchers.push(watch(left, (val) => {
8
+ if (syncing)
9
+ return;
10
+ syncing = !0;
11
+ right.value = val;
12
+ syncing = !1;
13
+ }));
14
+ if (direction === "both" || direction === "rtl")
15
+ unwatchers.push(watch(right, (val) => {
16
+ if (syncing)
17
+ return;
18
+ syncing = !0;
19
+ left.value = val;
20
+ syncing = !1;
21
+ }));
22
+ return () => {
23
+ for (const unwatch of unwatchers)
24
+ unwatch();
25
+ };
26
+ }
27
+ export function syncRefs(sources, target) {
28
+ const unwatchers = sources.map((source) => watch(source, (val) => {
29
+ target.value = val;
30
+ }));
31
+ return () => {
32
+ for (const unwatch of unwatchers)
33
+ unwatch();
34
+ };
35
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Try to execute a function when mounted (in a component context).
3
+ * If not in a component context, the function is still called.
4
+ */
5
+ export declare function tryOnMounted(fn: () => void): void;
6
+ /**
7
+ * Try to execute a function before mount.
8
+ * Runs the function immediately.
9
+ */
10
+ export declare function tryOnBeforeMount(fn: () => void): void;
11
+ /**
12
+ * Try to register an unmount callback. Fails silently outside component context.
13
+ */
14
+ export declare function tryOnUnmounted(fn: () => void): void;
15
+ /**
16
+ * Try to register a before-unmount callback.
17
+ */
18
+ export declare function tryOnBeforeUnmount(fn: () => void): void;
19
+ /**
20
+ * Try to run a function when the current scope is disposed.
21
+ */
22
+ export declare function tryOnScopeDispose(fn: () => void): void;
@@ -0,0 +1,22 @@
1
+ import { onUnmounted } from "@stacksjs/stx";
2
+ export function tryOnMounted(fn) {
3
+ fn();
4
+ }
5
+ export function tryOnBeforeMount(fn) {
6
+ fn();
7
+ }
8
+ export function tryOnUnmounted(fn) {
9
+ try {
10
+ onUnmounted(fn);
11
+ } catch {}
12
+ }
13
+ export function tryOnBeforeUnmount(fn) {
14
+ try {
15
+ onUnmounted(fn);
16
+ } catch {}
17
+ }
18
+ export function tryOnScopeDispose(fn) {
19
+ try {
20
+ onUnmounted(fn);
21
+ } catch {}
22
+ }
@@ -0,0 +1,6 @@
1
+ import type { MaybeRef } from './_shared';
2
+ /**
3
+ * Unref a value that may be a ref to an HTML element.
4
+ * Handles the case where the ref value may have an `$el` property (component instance).
5
+ */
6
+ export declare function unrefElement(elRef: MaybeRef<HTMLElement | { $el: HTMLElement } | null | undefined>): HTMLElement | null | undefined;