@siberiacancode/reactuse 0.0.109 → 0.0.111

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 (310) hide show
  1. package/dist/cjs/{_rollupPluginBabelHelpers-DLvKiCRD.js → _rollupPluginBabelHelpers-COP1ZJjT.js} +2 -2
  2. package/dist/cjs/_rollupPluginBabelHelpers-COP1ZJjT.js.map +1 -0
  3. package/dist/cjs/hooks/index.js +2 -2
  4. package/dist/cjs/hooks/useActiveElement/useActiveElement.js +2 -2
  5. package/dist/cjs/hooks/useAsync/useAsync.js +2 -2
  6. package/dist/cjs/hooks/useBattery/useBattery.js +2 -2
  7. package/dist/cjs/hooks/useBluetooth/useBluetooth.js +2 -2
  8. package/dist/cjs/hooks/useBoolean/useBoolean.js +2 -2
  9. package/dist/cjs/hooks/useBreakpoints/useBreakpoints.js +2 -2
  10. package/dist/cjs/hooks/useBrowserLanguage/useBrowserLanguage.js +1 -1
  11. package/dist/cjs/hooks/useClickOutside/useClickOutside.js +2 -2
  12. package/dist/cjs/hooks/useClipboard/useClipboard.js +2 -2
  13. package/dist/cjs/hooks/useConst/useConst.js +2 -2
  14. package/dist/cjs/hooks/useConst/useConst.js.map +1 -1
  15. package/dist/cjs/hooks/useCookie/useCookie.js +2 -2
  16. package/dist/cjs/hooks/useCookie/useCookie.js.map +1 -1
  17. package/dist/cjs/hooks/useCookies/useCookies.js +2 -2
  18. package/dist/cjs/hooks/useCopy/useCopy.js +2 -2
  19. package/dist/cjs/hooks/useCounter/useCounter.js +2 -2
  20. package/dist/cjs/hooks/useCssVar/useCssVar.js +2 -2
  21. package/dist/cjs/hooks/useDebounceCallback/useDebounceCallback.js +1 -1
  22. package/dist/cjs/hooks/useDebounceValue/useDebounceValue.js +2 -2
  23. package/dist/cjs/hooks/useDefault/useDefault.js +2 -2
  24. package/dist/cjs/hooks/useDeviceMotion/useDeviceMotion.js +2 -2
  25. package/dist/cjs/hooks/useDeviceOrientation/useDeviceOrientation.js +2 -2
  26. package/dist/cjs/hooks/useDevicePixelRatio/useDevicePixelRatio.js +2 -2
  27. package/dist/cjs/hooks/useDidUpdate/useDidUpdate.js +1 -1
  28. package/dist/cjs/hooks/useDidUpdate/useDidUpdate.js.map +1 -1
  29. package/dist/cjs/hooks/useDisclosure/useDisclosure.js +2 -2
  30. package/dist/cjs/hooks/useDisplayMedia/useDisplayMedia.js +2 -2
  31. package/dist/cjs/hooks/useDocumentEvent/useDocumentEvent.js +2 -2
  32. package/dist/cjs/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
  33. package/dist/cjs/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
  34. package/dist/cjs/hooks/useElementSize/useElementSize.js +2 -2
  35. package/dist/cjs/hooks/useEvent/useEvent.js +1 -1
  36. package/dist/cjs/hooks/useEventListener/useEventListener.js +2 -2
  37. package/dist/cjs/hooks/useEyeDropper/useEyeDropper.js +2 -2
  38. package/dist/cjs/hooks/useFavicon/useFavicon.js +2 -2
  39. package/dist/cjs/hooks/useField/useField.js +2 -2
  40. package/dist/cjs/hooks/useFileDialog/useFileDialog.js +2 -2
  41. package/dist/cjs/hooks/useFocus/useFocus.js +2 -2
  42. package/dist/cjs/hooks/useFps/useFps.js +2 -2
  43. package/dist/cjs/hooks/useFul/useFul.js +1 -1
  44. package/dist/cjs/hooks/useFullscreen/useFullscreen.js +2 -2
  45. package/dist/cjs/hooks/useGamepad/useGamepad.js +2 -2
  46. package/dist/cjs/hooks/useGeolocation/useGeolocation.js +2 -2
  47. package/dist/cjs/hooks/useHash/useHash.js +2 -2
  48. package/dist/cjs/hooks/useHotkeys/useHotkeys.js +2 -2
  49. package/dist/cjs/hooks/useHover/useHover.js +2 -2
  50. package/dist/cjs/hooks/useIdle/useIdle.js +2 -2
  51. package/dist/cjs/hooks/useImage/useImage.js +2 -2
  52. package/dist/cjs/hooks/useInfiniteScroll/useInfiniteScroll.js +2 -2
  53. package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -2
  54. package/dist/cjs/hooks/useInterval/useInterval.js +2 -2
  55. package/dist/cjs/hooks/useIsFirstRender/useIsFirstRender.js +1 -1
  56. package/dist/cjs/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +1 -1
  57. package/dist/cjs/hooks/useKeyPress/useKeyPress.js +2 -2
  58. package/dist/cjs/hooks/useKeyPressEvent/useKeyPressEvent.js +2 -2
  59. package/dist/cjs/hooks/useKeyboard/useKeyboard.js +2 -2
  60. package/dist/cjs/hooks/useKeysPressed/useKeysPressed.js +2 -2
  61. package/dist/cjs/hooks/useLastChanged/useLastChanged.js +2 -2
  62. package/dist/cjs/hooks/useLatest/useLatest.js +1 -1
  63. package/dist/cjs/hooks/useLess/useLess.js +1 -1
  64. package/dist/cjs/hooks/useList/useList.js +2 -2
  65. package/dist/cjs/hooks/useLocalStorage/useLocalStorage.js +2 -2
  66. package/dist/cjs/hooks/useLockCallback/useLockCallback.js +3 -0
  67. package/dist/cjs/hooks/useLockCallback/useLockCallback.js.map +1 -0
  68. package/dist/cjs/hooks/useLogger/useLogger.js +2 -2
  69. package/dist/cjs/hooks/useLongPress/useLongPress.js +2 -2
  70. package/dist/cjs/hooks/useMap/useMap.js +2 -2
  71. package/dist/cjs/hooks/useMeasure/useMeasure.js +2 -2
  72. package/dist/cjs/hooks/useMediaQuery/useMediaQuery.js +1 -1
  73. package/dist/cjs/hooks/useMemory/useMemory.js +2 -2
  74. package/dist/cjs/hooks/useMount/useMount.js +1 -1
  75. package/dist/cjs/hooks/useMouse/useMouse.js +2 -2
  76. package/dist/cjs/hooks/useMutation/useMutation.js +2 -2
  77. package/dist/cjs/hooks/useMutationObserver/useMutationObserver.js +2 -2
  78. package/dist/cjs/hooks/useNetwork/useNetwork.js +2 -2
  79. package/dist/cjs/hooks/useOffsetPagination/useOffsetPagination.js +2 -2
  80. package/dist/cjs/hooks/useOnce/useOnce.js +3 -0
  81. package/dist/cjs/hooks/useOnce/useOnce.js.map +1 -0
  82. package/dist/cjs/hooks/useOnline/useOnline.js +1 -1
  83. package/dist/cjs/hooks/useOperatingSystem/useOperatingSystem.js +2 -2
  84. package/dist/cjs/hooks/useOptimistic/useOptimistic.js +2 -2
  85. package/dist/cjs/hooks/useOrientation/useOrientation.js +2 -2
  86. package/dist/cjs/hooks/useOtpCredential/useOtpCredential.js +2 -2
  87. package/dist/cjs/hooks/useOtpCredential/useOtpCredential.js.map +1 -1
  88. package/dist/cjs/hooks/usePageLeave/usePageLeave.js +2 -2
  89. package/dist/cjs/hooks/usePaint/usePaint.js +2 -2
  90. package/dist/cjs/hooks/useParallax/useParallax.js +2 -2
  91. package/dist/cjs/hooks/usePerformanceObserver/usePerformanceObserver.js +2 -2
  92. package/dist/cjs/hooks/usePermission/usePermission.js +2 -2
  93. package/dist/cjs/hooks/usePointerLock/usePointerLock.js +2 -2
  94. package/dist/cjs/hooks/usePostMessage/usePostMessage.js +1 -1
  95. package/dist/cjs/hooks/usePreferredColorScheme/usePreferredColorScheme.js +1 -1
  96. package/dist/cjs/hooks/usePreferredContrast/usePreferredContrast.js +1 -1
  97. package/dist/cjs/hooks/usePreferredDark/usePreferredDark.js +1 -1
  98. package/dist/cjs/hooks/usePreferredLanguages/usePreferredLanguages.js +1 -1
  99. package/dist/cjs/hooks/usePreferredReducedMotion/usePreferredReducedMotion.js +1 -1
  100. package/dist/cjs/hooks/usePrevious/usePrevious.js +1 -1
  101. package/dist/cjs/hooks/useQuery/useQuery.js +2 -2
  102. package/dist/cjs/hooks/useQuery/useQuery.js.map +1 -1
  103. package/dist/cjs/hooks/useQueue/useQueue.js +2 -2
  104. package/dist/cjs/hooks/useRaf/useRaf.js +2 -2
  105. package/dist/cjs/hooks/useRafValue/useRafValue.js +2 -2
  106. package/dist/cjs/hooks/useRefState/useRefState.js +2 -2
  107. package/dist/cjs/hooks/useRenderCount/useRenderCount.js +1 -1
  108. package/dist/cjs/hooks/useRenderInfo/useRenderInfo.js +1 -1
  109. package/dist/cjs/hooks/useRerender/useRerender.js +1 -1
  110. package/dist/cjs/hooks/useResizeObserver/useResizeObserver.js +2 -2
  111. package/dist/cjs/hooks/useScreenOrientation/useScreenOrientation.js +2 -2
  112. package/dist/cjs/hooks/useScript/useScript.js +2 -2
  113. package/dist/cjs/hooks/useScroll/useScroll.js +2 -2
  114. package/dist/cjs/hooks/useScrollIntoView/useScrollIntoView.js +2 -2
  115. package/dist/cjs/hooks/useScrollTo/useScrollTo.js +2 -2
  116. package/dist/cjs/hooks/useSessionStorage/useSessionStorage.js +2 -2
  117. package/dist/cjs/hooks/useSessionStorage/useSessionStorage.js.map +1 -1
  118. package/dist/cjs/hooks/useSet/useSet.js +2 -2
  119. package/dist/cjs/hooks/useShare/useShare.js +2 -2
  120. package/dist/cjs/hooks/useStateHistory/useStateHistory.js +2 -2
  121. package/dist/cjs/hooks/useStep/useStep.js +2 -2
  122. package/dist/cjs/hooks/useSticky/useSticky.js +3 -0
  123. package/dist/cjs/hooks/useSticky/useSticky.js.map +1 -0
  124. package/dist/cjs/hooks/useStopwatch/useStopwatch.js +2 -2
  125. package/dist/cjs/hooks/useStorage/useStorage.js +2 -2
  126. package/dist/cjs/hooks/useStorage/useStorage.js.map +1 -1
  127. package/dist/cjs/hooks/useTextDirection/useTextDirection.js +2 -2
  128. package/dist/cjs/hooks/useTextSelection/useTextSelection.js +2 -2
  129. package/dist/cjs/hooks/useThrottleCallback/useThrottleCallback.js +1 -1
  130. package/dist/cjs/hooks/useThrottleValue/useThrottleValue.js +2 -2
  131. package/dist/cjs/hooks/useTime/useTime.js +2 -2
  132. package/dist/cjs/hooks/useTimeout/useTimeout.js +2 -2
  133. package/dist/cjs/hooks/useTimer/useTimer.js +2 -2
  134. package/dist/cjs/hooks/useTimer/useTimer.js.map +1 -1
  135. package/dist/cjs/hooks/useToggle/useToggle.js +2 -2
  136. package/dist/cjs/hooks/useToggle/useToggle.js.map +1 -1
  137. package/dist/cjs/hooks/useUnmount/useUnmount.js +1 -1
  138. package/dist/cjs/hooks/useVibrate/useVibrate.js +2 -2
  139. package/dist/cjs/hooks/useWebSocket/useWebSocket.js +2 -2
  140. package/dist/cjs/hooks/useWindowEvent/useWindowEvent.js +2 -2
  141. package/dist/cjs/hooks/useWindowFocus/useWindowFocus.js +2 -2
  142. package/dist/cjs/hooks/useWindowScroll/useWindowScroll.js +2 -2
  143. package/dist/cjs/hooks/useWindowSize/useWindowSize.js +2 -2
  144. package/dist/cjs/hooks/useWizard/useWizard.js +2 -2
  145. package/dist/cjs/index.js +2 -2
  146. package/dist/cjs/utils/helpers/copy.js +2 -2
  147. package/dist/cjs/utils/helpers/debounce.js +1 -1
  148. package/dist/cjs/utils/helpers/getDate.js +1 -1
  149. package/dist/cjs/utils/helpers/getElement.js +1 -1
  150. package/dist/cjs/utils/helpers/getRetry.js +1 -1
  151. package/dist/cjs/utils/helpers/index.js +2 -2
  152. package/dist/cjs/utils/helpers/isTarget.js +2 -2
  153. package/dist/cjs/utils/helpers/throttle.js +1 -1
  154. package/dist/esm/{_rollupPluginBabelHelpers-Cyp-U6we.js → _rollupPluginBabelHelpers-DoUxcpfK.js} +2 -2
  155. package/dist/esm/_rollupPluginBabelHelpers-DoUxcpfK.js.map +1 -0
  156. package/dist/esm/hooks/index.js +2 -2
  157. package/dist/esm/hooks/useActiveElement/useActiveElement.js +2 -2
  158. package/dist/esm/hooks/useAsync/useAsync.js +2 -2
  159. package/dist/esm/hooks/useBattery/useBattery.js +2 -2
  160. package/dist/esm/hooks/useBluetooth/useBluetooth.js +2 -2
  161. package/dist/esm/hooks/useBoolean/useBoolean.js +2 -2
  162. package/dist/esm/hooks/useBreakpoints/useBreakpoints.js +2 -2
  163. package/dist/esm/hooks/useBrowserLanguage/useBrowserLanguage.js +1 -1
  164. package/dist/esm/hooks/useClickOutside/useClickOutside.js +2 -2
  165. package/dist/esm/hooks/useClipboard/useClipboard.js +2 -2
  166. package/dist/esm/hooks/useConst/useConst.js +2 -2
  167. package/dist/esm/hooks/useConst/useConst.js.map +1 -1
  168. package/dist/esm/hooks/useCookie/useCookie.js +2 -2
  169. package/dist/esm/hooks/useCookie/useCookie.js.map +1 -1
  170. package/dist/esm/hooks/useCookies/useCookies.js +2 -2
  171. package/dist/esm/hooks/useCopy/useCopy.js +2 -2
  172. package/dist/esm/hooks/useCounter/useCounter.js +2 -2
  173. package/dist/esm/hooks/useCssVar/useCssVar.js +2 -2
  174. package/dist/esm/hooks/useDebounceCallback/useDebounceCallback.js +1 -1
  175. package/dist/esm/hooks/useDebounceValue/useDebounceValue.js +2 -2
  176. package/dist/esm/hooks/useDefault/useDefault.js +2 -2
  177. package/dist/esm/hooks/useDeviceMotion/useDeviceMotion.js +2 -2
  178. package/dist/esm/hooks/useDeviceOrientation/useDeviceOrientation.js +2 -2
  179. package/dist/esm/hooks/useDevicePixelRatio/useDevicePixelRatio.js +2 -2
  180. package/dist/esm/hooks/useDidUpdate/useDidUpdate.js +1 -1
  181. package/dist/esm/hooks/useDidUpdate/useDidUpdate.js.map +1 -1
  182. package/dist/esm/hooks/useDisclosure/useDisclosure.js +2 -2
  183. package/dist/esm/hooks/useDisplayMedia/useDisplayMedia.js +2 -2
  184. package/dist/esm/hooks/useDocumentEvent/useDocumentEvent.js +2 -2
  185. package/dist/esm/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
  186. package/dist/esm/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
  187. package/dist/esm/hooks/useElementSize/useElementSize.js +2 -2
  188. package/dist/esm/hooks/useEvent/useEvent.js +1 -1
  189. package/dist/esm/hooks/useEventListener/useEventListener.js +2 -2
  190. package/dist/esm/hooks/useEyeDropper/useEyeDropper.js +2 -2
  191. package/dist/esm/hooks/useFavicon/useFavicon.js +2 -2
  192. package/dist/esm/hooks/useField/useField.js +2 -2
  193. package/dist/esm/hooks/useFileDialog/useFileDialog.js +2 -2
  194. package/dist/esm/hooks/useFocus/useFocus.js +2 -2
  195. package/dist/esm/hooks/useFps/useFps.js +2 -2
  196. package/dist/esm/hooks/useFul/useFul.js +1 -1
  197. package/dist/esm/hooks/useFullscreen/useFullscreen.js +2 -2
  198. package/dist/esm/hooks/useGamepad/useGamepad.js +2 -2
  199. package/dist/esm/hooks/useGeolocation/useGeolocation.js +2 -2
  200. package/dist/esm/hooks/useHash/useHash.js +2 -2
  201. package/dist/esm/hooks/useHotkeys/useHotkeys.js +2 -2
  202. package/dist/esm/hooks/useHover/useHover.js +2 -2
  203. package/dist/esm/hooks/useIdle/useIdle.js +2 -2
  204. package/dist/esm/hooks/useImage/useImage.js +2 -2
  205. package/dist/esm/hooks/useInfiniteScroll/useInfiniteScroll.js +2 -2
  206. package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -2
  207. package/dist/esm/hooks/useInterval/useInterval.js +2 -2
  208. package/dist/esm/hooks/useIsFirstRender/useIsFirstRender.js +1 -1
  209. package/dist/esm/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +1 -1
  210. package/dist/esm/hooks/useKeyPress/useKeyPress.js +2 -2
  211. package/dist/esm/hooks/useKeyPressEvent/useKeyPressEvent.js +2 -2
  212. package/dist/esm/hooks/useKeyboard/useKeyboard.js +2 -2
  213. package/dist/esm/hooks/useKeysPressed/useKeysPressed.js +2 -2
  214. package/dist/esm/hooks/useLastChanged/useLastChanged.js +2 -2
  215. package/dist/esm/hooks/useLatest/useLatest.js +1 -1
  216. package/dist/esm/hooks/useLess/useLess.js +1 -1
  217. package/dist/esm/hooks/useList/useList.js +2 -2
  218. package/dist/esm/hooks/useLocalStorage/useLocalStorage.js +2 -2
  219. package/dist/esm/hooks/useLockCallback/useLockCallback.js +3 -0
  220. package/dist/esm/hooks/useLockCallback/useLockCallback.js.map +1 -0
  221. package/dist/esm/hooks/useLogger/useLogger.js +2 -2
  222. package/dist/esm/hooks/useLongPress/useLongPress.js +2 -2
  223. package/dist/esm/hooks/useMap/useMap.js +2 -2
  224. package/dist/esm/hooks/useMeasure/useMeasure.js +2 -2
  225. package/dist/esm/hooks/useMediaQuery/useMediaQuery.js +1 -1
  226. package/dist/esm/hooks/useMemory/useMemory.js +2 -2
  227. package/dist/esm/hooks/useMount/useMount.js +1 -1
  228. package/dist/esm/hooks/useMouse/useMouse.js +2 -2
  229. package/dist/esm/hooks/useMutation/useMutation.js +2 -2
  230. package/dist/esm/hooks/useMutationObserver/useMutationObserver.js +2 -2
  231. package/dist/esm/hooks/useNetwork/useNetwork.js +2 -2
  232. package/dist/esm/hooks/useOffsetPagination/useOffsetPagination.js +2 -2
  233. package/dist/esm/hooks/useOnce/useOnce.js +3 -0
  234. package/dist/esm/hooks/useOnce/useOnce.js.map +1 -0
  235. package/dist/esm/hooks/useOnline/useOnline.js +1 -1
  236. package/dist/esm/hooks/useOperatingSystem/useOperatingSystem.js +2 -2
  237. package/dist/esm/hooks/useOptimistic/useOptimistic.js +2 -2
  238. package/dist/esm/hooks/useOrientation/useOrientation.js +2 -2
  239. package/dist/esm/hooks/useOtpCredential/useOtpCredential.js +2 -2
  240. package/dist/esm/hooks/useOtpCredential/useOtpCredential.js.map +1 -1
  241. package/dist/esm/hooks/usePageLeave/usePageLeave.js +2 -2
  242. package/dist/esm/hooks/usePaint/usePaint.js +2 -2
  243. package/dist/esm/hooks/useParallax/useParallax.js +2 -2
  244. package/dist/esm/hooks/usePerformanceObserver/usePerformanceObserver.js +2 -2
  245. package/dist/esm/hooks/usePermission/usePermission.js +2 -2
  246. package/dist/esm/hooks/usePointerLock/usePointerLock.js +2 -2
  247. package/dist/esm/hooks/usePostMessage/usePostMessage.js +1 -1
  248. package/dist/esm/hooks/usePreferredColorScheme/usePreferredColorScheme.js +1 -1
  249. package/dist/esm/hooks/usePreferredContrast/usePreferredContrast.js +1 -1
  250. package/dist/esm/hooks/usePreferredDark/usePreferredDark.js +1 -1
  251. package/dist/esm/hooks/usePreferredLanguages/usePreferredLanguages.js +1 -1
  252. package/dist/esm/hooks/usePreferredReducedMotion/usePreferredReducedMotion.js +1 -1
  253. package/dist/esm/hooks/usePrevious/usePrevious.js +1 -1
  254. package/dist/esm/hooks/useQuery/useQuery.js +2 -2
  255. package/dist/esm/hooks/useQuery/useQuery.js.map +1 -1
  256. package/dist/esm/hooks/useQueue/useQueue.js +2 -2
  257. package/dist/esm/hooks/useRaf/useRaf.js +2 -2
  258. package/dist/esm/hooks/useRafValue/useRafValue.js +2 -2
  259. package/dist/esm/hooks/useRefState/useRefState.js +2 -2
  260. package/dist/esm/hooks/useRenderCount/useRenderCount.js +1 -1
  261. package/dist/esm/hooks/useRenderInfo/useRenderInfo.js +1 -1
  262. package/dist/esm/hooks/useRerender/useRerender.js +1 -1
  263. package/dist/esm/hooks/useResizeObserver/useResizeObserver.js +2 -2
  264. package/dist/esm/hooks/useScreenOrientation/useScreenOrientation.js +2 -2
  265. package/dist/esm/hooks/useScript/useScript.js +2 -2
  266. package/dist/esm/hooks/useScroll/useScroll.js +2 -2
  267. package/dist/esm/hooks/useScrollIntoView/useScrollIntoView.js +2 -2
  268. package/dist/esm/hooks/useScrollTo/useScrollTo.js +2 -2
  269. package/dist/esm/hooks/useSessionStorage/useSessionStorage.js +2 -2
  270. package/dist/esm/hooks/useSessionStorage/useSessionStorage.js.map +1 -1
  271. package/dist/esm/hooks/useSet/useSet.js +2 -2
  272. package/dist/esm/hooks/useShare/useShare.js +2 -2
  273. package/dist/esm/hooks/useStateHistory/useStateHistory.js +2 -2
  274. package/dist/esm/hooks/useStep/useStep.js +2 -2
  275. package/dist/esm/hooks/useSticky/useSticky.js +3 -0
  276. package/dist/esm/hooks/useSticky/useSticky.js.map +1 -0
  277. package/dist/esm/hooks/useStopwatch/useStopwatch.js +2 -2
  278. package/dist/esm/hooks/useStorage/useStorage.js +2 -2
  279. package/dist/esm/hooks/useStorage/useStorage.js.map +1 -1
  280. package/dist/esm/hooks/useTextDirection/useTextDirection.js +2 -2
  281. package/dist/esm/hooks/useTextSelection/useTextSelection.js +2 -2
  282. package/dist/esm/hooks/useThrottleCallback/useThrottleCallback.js +1 -1
  283. package/dist/esm/hooks/useThrottleValue/useThrottleValue.js +2 -2
  284. package/dist/esm/hooks/useTime/useTime.js +2 -2
  285. package/dist/esm/hooks/useTimeout/useTimeout.js +2 -2
  286. package/dist/esm/hooks/useTimer/useTimer.js +2 -2
  287. package/dist/esm/hooks/useTimer/useTimer.js.map +1 -1
  288. package/dist/esm/hooks/useToggle/useToggle.js +2 -2
  289. package/dist/esm/hooks/useToggle/useToggle.js.map +1 -1
  290. package/dist/esm/hooks/useUnmount/useUnmount.js +1 -1
  291. package/dist/esm/hooks/useVibrate/useVibrate.js +2 -2
  292. package/dist/esm/hooks/useWebSocket/useWebSocket.js +2 -2
  293. package/dist/esm/hooks/useWindowEvent/useWindowEvent.js +2 -2
  294. package/dist/esm/hooks/useWindowFocus/useWindowFocus.js +2 -2
  295. package/dist/esm/hooks/useWindowScroll/useWindowScroll.js +2 -2
  296. package/dist/esm/hooks/useWindowSize/useWindowSize.js +2 -2
  297. package/dist/esm/hooks/useWizard/useWizard.js +2 -2
  298. package/dist/esm/index.js +2 -2
  299. package/dist/esm/utils/helpers/copy.js +2 -2
  300. package/dist/esm/utils/helpers/debounce.js +1 -1
  301. package/dist/esm/utils/helpers/getDate.js +1 -1
  302. package/dist/esm/utils/helpers/getElement.js +1 -1
  303. package/dist/esm/utils/helpers/getRetry.js +1 -1
  304. package/dist/esm/utils/helpers/index.js +2 -2
  305. package/dist/esm/utils/helpers/isTarget.js +2 -2
  306. package/dist/esm/utils/helpers/throttle.js +1 -1
  307. package/dist/types/index.d.ts +62 -7
  308. package/package.json +91 -91
  309. package/dist/cjs/_rollupPluginBabelHelpers-DLvKiCRD.js.map +0 -1
  310. package/dist/esm/_rollupPluginBabelHelpers-Cyp-U6we.js.map +0 -1
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{b as t,_ as e}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";import{useRef as l,useState as o,useEffect as r}from"react";import{getElement as n}from"../../utils/helpers/getElement.js";import{isTarget as i}from"../../utils/helpers/isTarget.js";import{useRefState as c}from"../useRefState/useRefState.js";var u=function(){var u=i(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,v=u?"object"===t(arguments.length<=1?void 0:arguments[1])?arguments.length<=1?void 0:arguments[1]:{onScroll:arguments.length<=1?void 0:arguments[1]}:"object"===t(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:{onScroll:arguments.length<=0?void 0:arguments[0]},d=c(),s=l(v);s.current=v;var a=o(!1),f=e(a,2),m=f[0],g=f[1],h=l({x:0,y:0});return r((function(){if(u||d.state){var t=u?n(u):d.current;if(t){var e=function(t){var e;g(!1),null==v||null===(e=v.onStop)||void 0===e||e.call(v,t)},l=function(t){var e,l,o,r,n,i,c;g(!0);var u=t.target===document?t.target.documentElement:t.target,v=u.style,d=v.display,a=v.flexDirection,f="rtl"===v.direction?-1:1,m=u.scrollLeft,p=u.scrollTop;u instanceof Document&&!p&&(p=window.document.body.scrollTop);var x=null===(e=s.current)||void 0===e?void 0:e.offset,b=m*f<=(null!==(l=null==x?void 0:x.left)&&void 0!==l?l:0),y=m*f+u.clientWidth>=u.scrollWidth-(null!==(o=null==x?void 0:x.right)&&void 0!==o?o:0)-1,j=p<=(null!==(r=null==x?void 0:x.top)&&void 0!==r?r:0),E=p+u.clientHeight>=u.scrollHeight-(null!==(n=null==x?void 0:x.bottom)&&void 0!==n?n:0)-1,S="flex"===d&&"column-reverse"===a,L="flex"===d&&"column-reverse"===a,H={x:m,y:p,directions:{left:m<h.current.x,right:m>h.current.x,top:p<h.current.y,bottom:p>h.current.y},arrived:{left:L?y:b,right:L?b:y,top:S?E:j,bottom:S?j:E}};h.current={x:m,y:p},null===(i=s.current)||void 0===i||null===(c=i.onScroll)||void 0===c||c.call(i,H,t)};return t.addEventListener("scroll",l),t.addEventListener("scrollend",e),function(){t.removeEventListener("scroll",l),t.removeEventListener("scrollend",e)}}}}),[u,d.state]),u?m:{ref:d,scrolling:m}};export{u as useScroll};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{b as t,_ as e}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useRef as l,useState as o,useEffect as r}from"react";import{getElement as n}from"../../utils/helpers/getElement.js";import{isTarget as i}from"../../utils/helpers/isTarget.js";import{useRefState as c}from"../useRefState/useRefState.js";var u=function(){var u=i(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,v=u?"object"===t(arguments.length<=1?void 0:arguments[1])?arguments.length<=1?void 0:arguments[1]:{onScroll:arguments.length<=1?void 0:arguments[1]}:"object"===t(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:{onScroll:arguments.length<=0?void 0:arguments[0]},d=c(),s=l(v);s.current=v;var a=o(!1),f=e(a,2),m=f[0],g=f[1],h=l({x:0,y:0});return r((function(){if(u||d.state){var t=u?n(u):d.current;if(t){var e=function(t){var e;g(!1),null==v||null===(e=v.onStop)||void 0===e||e.call(v,t)},l=function(t){var e,l,o,r,n,i,c;g(!0);var u=t.target===document?t.target.documentElement:t.target,v=u.style,d=v.display,a=v.flexDirection,f="rtl"===v.direction?-1:1,m=u.scrollLeft,p=u.scrollTop;u instanceof Document&&!p&&(p=window.document.body.scrollTop);var x=null===(e=s.current)||void 0===e?void 0:e.offset,b=m*f<=(null!==(l=null==x?void 0:x.left)&&void 0!==l?l:0),y=m*f+u.clientWidth>=u.scrollWidth-(null!==(o=null==x?void 0:x.right)&&void 0!==o?o:0)-1,j=p<=(null!==(r=null==x?void 0:x.top)&&void 0!==r?r:0),E=p+u.clientHeight>=u.scrollHeight-(null!==(n=null==x?void 0:x.bottom)&&void 0!==n?n:0)-1,S="flex"===d&&"column-reverse"===a,L="flex"===d&&"column-reverse"===a,H={x:m,y:p,directions:{left:m<h.current.x,right:m>h.current.x,top:p<h.current.y,bottom:p>h.current.y},arrived:{left:L?y:b,right:L?b:y,top:S?E:j,bottom:S?j:E}};h.current={x:m,y:p},null===(i=s.current)||void 0===i||null===(c=i.onScroll)||void 0===c||c.call(i,H,t)};return t.addEventListener("scroll",l),t.addEventListener("scrollend",e),function(){t.removeEventListener("scroll",l),t.removeEventListener("scrollend",e)}}}}),[u,d.state]),u?m:{ref:d,scrolling:m}};export{u as useScroll};
3
3
  //# sourceMappingURL=useScroll.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{useEffect as e}from"react";import{getElement as r}from"../../utils/helpers/getElement.js";import{isTarget as i}from"../../utils/helpers/isTarget.js";import{useRefState as t}from"../useRefState/useRefState.js";import"../../_rollupPluginBabelHelpers-Cyp-U6we.js";var o=function(){var o=i(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,l=o?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],n=t(),a=null!=l?l:{},s=a.behavior,v=void 0===s?"smooth":s,u=a.block,c=void 0===u?"start":u,f=a.inline,g=void 0===f?"nearest":f,h=a.enabled,m=void 0===h||h;e((function(){if(m&&(o||n.state)){var e=o?r(o):n.current;e&&e.scrollIntoView({behavior:v,block:c,inline:g})}}),[o,n.state,m]);var b=function(e){var i=o?r(o):n.current;if(i){var t=null!=e?e:{},l=t.behavior,a=t.block,s=t.inline;i.scrollIntoView({behavior:l,block:a,inline:s})}};return o?{trigger:b}:{ref:n,trigger:b}};export{o as useScrollIntoView};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{useEffect as e}from"react";import{getElement as r}from"../../utils/helpers/getElement.js";import{isTarget as i}from"../../utils/helpers/isTarget.js";import{useRefState as t}from"../useRefState/useRefState.js";import"../../_rollupPluginBabelHelpers-DoUxcpfK.js";var o=function(){var o=i(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,l=o?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],n=t(),a=null!=l?l:{},s=a.behavior,v=void 0===s?"smooth":s,u=a.block,c=void 0===u?"start":u,f=a.inline,g=void 0===f?"nearest":f,h=a.enabled,m=void 0===h||h;e((function(){if(m&&(o||n.state)){var e=o?r(o):n.current;e&&e.scrollIntoView({behavior:v,block:c,inline:g})}}),[o,n.state,m]);var b=function(e){var i=o?r(o):n.current;if(i){var t=null!=e?e:{},l=t.behavior,a=t.block,s=t.inline;i.scrollIntoView({behavior:l,block:a,inline:s})}};return o?{trigger:b}:{ref:n,trigger:b}};export{o as useScrollIntoView};
3
3
  //# sourceMappingURL=useScrollIntoView.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{useLayoutEffect as e}from"react";import{getElement as r}from"../../utils/helpers/getElement.js";import{isTarget as t}from"../../utils/helpers/isTarget.js";import{useRefState as o}from"../useRefState/useRefState.js";import"../../_rollupPluginBabelHelpers-Cyp-U6we.js";var i=function(){var i=t(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,l=i?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],a=null!=l?l:{},n=a.x,v=a.y,s=a.behavior,u=void 0===s?"auto":s,f=a.enabled,p=void 0===f||f,g=o();e((function(){if(p&&(i||g.state)){var e=i?r(i):g.current;e&&e.scrollTo({top:v,left:n,behavior:u})}}),[i,g.state]);var h=function(e){var t=i?r(i):g.current;if(t){var o=null!=e?e:{},l=o.x,a=o.y,n=o.behavior;t.scrollTo({left:l,top:a,behavior:n})}};return i?{trigger:h}:{ref:g,trigger:h}};export{i as useScrollTo};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{useLayoutEffect as e}from"react";import{getElement as r}from"../../utils/helpers/getElement.js";import{isTarget as t}from"../../utils/helpers/isTarget.js";import{useRefState as o}from"../useRefState/useRefState.js";import"../../_rollupPluginBabelHelpers-DoUxcpfK.js";var i=function(){var i=t(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,l=i?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],a=null!=l?l:{},n=a.x,v=a.y,s=a.behavior,u=void 0===s?"auto":s,f=a.enabled,p=void 0===f||f,g=o();e((function(){if(p&&(i||g.state)){var e=i?r(i):g.current;e&&e.scrollTo({top:v,left:n,behavior:u})}}),[i,g.state]);var h=function(e){var t=i?r(i):g.current;if(t){var o=null!=e?e:{},l=o.x,a=o.y,n=o.behavior;t.scrollTo({left:l,top:a,behavior:n})}};return i?{trigger:h}:{ref:g,trigger:h}};export{i as useScrollTo};
3
3
  //# sourceMappingURL=useScrollTo.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{c as o}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";import{useStorage as e}from"../useStorage/useStorage.js";import"react";var r=function(r,t,i){return e(r,o(o({},i),{},{initialValue:t,storage:"undefined"!=typeof window?window.localStorage:void 0}))};export{r as useSessionStorage};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{c as e}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useStorage as o}from"../useStorage/useStorage.js";import"react";var r=function(r,i,t){return o(r,e(e({},t),{},{initialValue:i,storage:"undefined"!=typeof window?window.sessionStorage:void 0}))};export{r as useSessionStorage};
3
3
  //# sourceMappingURL=useSessionStorage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSessionStorage.js","sources":["../../../../src/hooks/useSessionStorage/useSessionStorage.ts"],"sourcesContent":["import type { UseStorageInitialValue, UseStorageOptions } from '../useStorage/useStorage';\n\nimport { useStorage } from '../useStorage/useStorage';\n\n/**\n * @name useSessionStorage\n * @description - Hook that manages session storage value\n * @category Browser\n *\n * @browserapi sessionStorage https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage\n *\n * @template Value The type of the value\n * @param {string} key The key of the storage\n * @param {UseStorageInitialValue<Value>} [initialValue] The initial value of the storage\n * @param {UseStorageOptions<Value>} [options] The options of the storage\n *\n * @example\n * const { value, set, remove } = useSessionStorage('key', 'value');\n */\nexport const useSessionStorage = <Value>(\n key: string,\n initialValue?: UseStorageInitialValue<Value>,\n options?: Omit<UseStorageOptions<Value>, 'initialValue' | 'storage'>\n) =>\n useStorage(key, {\n ...options,\n initialValue,\n storage: typeof window !== 'undefined' ? window.localStorage : undefined\n });\n"],"names":["useSessionStorage","key","initialValue","options","useStorage","_objectSpread","storage","window","localStorage","undefined"],"mappings":";uIAmBO,IAAMA,EAAoB,SAC/BC,EACAC,EACAC,GAAoE,OAEpEC,EAAWH,EAAGI,EAAAA,KACTF,GAAO,GAAA,CACVD,aAAAA,EACAI,QAA2B,oBAAXC,OAAyBA,OAAOC,kBAAeC,IAC/D"}
1
+ {"version":3,"file":"useSessionStorage.js","sources":["../../../../src/hooks/useSessionStorage/useSessionStorage.ts"],"sourcesContent":["import type { UseStorageInitialValue, UseStorageOptions } from '../useStorage/useStorage';\n\nimport { useStorage } from '../useStorage/useStorage';\n\n/**\n * @name useSessionStorage\n * @description - Hook that manages session storage value\n * @category Browser\n *\n * @browserapi sessionStorage https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage\n *\n * @template Value The type of the value\n * @param {string} key The key of the storage\n * @param {UseStorageInitialValue<Value>} [initialValue] The initial value of the storage\n * @param {UseStorageOptions<Value>} [options] The options of the storage\n *\n * @example\n * const { value, set, remove } = useSessionStorage('key', 'value');\n */\nexport const useSessionStorage = <Value>(\n key: string,\n initialValue?: UseStorageInitialValue<Value>,\n options?: Omit<UseStorageOptions<Value>, 'initialValue' | 'storage'>\n) =>\n useStorage(key, {\n ...options,\n initialValue,\n storage: typeof window !== 'undefined' ? window.sessionStorage : undefined\n });\n"],"names":["useSessionStorage","key","initialValue","options","useStorage","_objectSpread","storage","window","sessionStorage","undefined"],"mappings":";uIAmBO,IAAMA,EAAoB,SAC/BC,EACAC,EACAC,GAAoE,OAEpEC,EAAWH,EAAGI,EAAAA,KACTF,GAAO,GAAA,CACVD,aAAAA,EACAI,QAA2B,oBAAXC,OAAyBA,OAAOC,oBAAiBC,IACjE"}
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{_ as e}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";import{useState as n}from"react";var r=function(r){var t=n(new Set(r)),u=e(t,2),i=u[0],f=u[1];return{value:i,size:i.size,has:function(e){return i.has(e)},add:function(e){return f((function(n){return new Set(n).add(e)}))},remove:function(e){return f((function(n){if(!n.has(e))return n;var r=new Set(n);return r.delete(e),r}))},clear:function(){return f(new Set)},reset:function(){return f(new Set(r))},toggle:function(e){return f((function(n){if(!n.has(e))return new Set(n).add(e);var r=new Set(n);return r.delete(e),r}))},union:function(e){return f(i.union(e))},difference:function(e){return f(i.difference(e))},symmetricDifference:function(e){return f(i.symmetricDifference(e))},intersection:function(e){return f(i.intersection(e))}}};export{r as useSet};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{_ as e}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as n}from"react";var r=function(r){var t=n(new Set(r)),u=e(t,2),i=u[0],f=u[1];return{value:i,size:i.size,has:function(e){return i.has(e)},add:function(e){return f((function(n){return new Set(n).add(e)}))},remove:function(e){return f((function(n){if(!n.has(e))return n;var r=new Set(n);return r.delete(e),r}))},clear:function(){return f(new Set)},reset:function(){return f(new Set(r))},toggle:function(e){return f((function(n){if(!n.has(e))return new Set(n).add(e);var r=new Set(n);return r.delete(e),r}))},union:function(e){return f(i.union(e))},difference:function(e){return f(i.difference(e))},symmetricDifference:function(e){return f(i.symmetricDifference(e))},intersection:function(e){return f(i.intersection(e))}}};export{r as useSet};
3
3
  //# sourceMappingURL=useSet.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{d as r,e,c as a}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";var n=function(n){var t="undefined"!=typeof navigator&&"share"in navigator,i=function(){var i=r(e().mark((function r(i){var s;return e().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(t){r.next=2;break}return r.abrupt("return");case 2:return(s=a(a({},n),i)).files&&navigator.canShare({files:s.files})&&navigator.share(s),r.abrupt("return",navigator.share(s));case 5:case"end":return r.stop()}}),r)})));return function(r){return i.apply(this,arguments)}}();return{share:i,supported:t}};export{n as useShare};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{d as r,e,c as a}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";var n=function(n){var t="undefined"!=typeof navigator&&"share"in navigator,i=function(){var i=r(e().mark((function r(i){var s;return e().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(t){r.next=2;break}return r.abrupt("return");case 2:return(s=a(a({},n),i)).files&&navigator.canShare({files:s.files})&&navigator.share(s),r.abrupt("return",navigator.share(s));case 5:case"end":return r.stop()}}),r)})));return function(r){return i.apply(this,arguments)}}();return{share:i,supported:t}};export{n as useShare};
3
3
  //# sourceMappingURL=useShare.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{_ as r}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";import{useState as n,useRef as t}from"react";var e=function(e,u){var c=n(e),o=r(c,2),i=o[0],l=o[1],f=n([e]),a=r(f,2),s=a[0],h=a[1],v=t(0);return{history:s,value:i,set:function(r){h((function(n){var t=n.slice(0,v.current+1);return t.push(r),u&&t.length>u&&t.shift(),v.current=t.length-1,t})),l(r)},index:v.current,back:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;v.current-r<0||(v.current-=r,l(s[v.current]))},forward:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;v.current+r>=s.length||(v.current+=r,l(s[v.current]))},reset:function(){l(e),h([e]),v.current=0},undo:function(){0!==v.current&&(v.current--,l(s[v.current]),h((function(r){return r.slice(0,v.current+1)})))}}};export{e as useStateHistory};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{_ as r}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as n,useRef as t}from"react";var e=function(e,u){var c=n(e),o=r(c,2),i=o[0],l=o[1],f=n([e]),a=r(f,2),s=a[0],h=a[1],v=t(0);return{history:s,value:i,set:function(r){h((function(n){var t=n.slice(0,v.current+1);return t.push(r),u&&t.length>u&&t.shift(),v.current=t.length-1,t})),l(r)},index:v.current,back:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;v.current-r<0||(v.current-=r,l(s[v.current]))},forward:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;v.current+r>=s.length||(v.current+=r,l(s[v.current]))},reset:function(){l(e),h([e]),v.current=0},undo:function(){0!==v.current&&(v.current--,l(s[v.current]),h((function(r){return r.slice(0,v.current+1)})))}}};export{e as useStateHistory};
3
3
  //# sourceMappingURL=useStateHistory.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{b as t,_ as r}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";import{useRef as n,useState as e}from"react";var i=function(i){var u="object"===t(i)?i.max:i,o="object"===t(i)?i.initial:1,c=n(o>u||o<1?1:o),s=e(o),a=r(s,2),f=a[0],l=a[1],p=1===f,b=f===u;return{counts:u,currentStep:f,isFirst:p,isLast:b,next:function(){b||l((function(t){return t+1}))},back:function(){p||l((function(t){return t-1}))},reset:function(){return l(c.current)},set:function(t){return"first"===t?l(c.current):"last"===t||t>=u?l(u):t<=1?l(1):void l(t)}}};export{i as useStep};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{b as t,_ as r}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useRef as n,useState as e}from"react";var i=function(i){var u="object"===t(i)?i.max:i,o="object"===t(i)?i.initial:1,c=n(o>u||o<1?1:o),s=e(o),a=r(s,2),f=a[0],l=a[1],p=1===f,b=f===u;return{counts:u,currentStep:f,isFirst:p,isLast:b,next:function(){b||l((function(t){return t+1}))},back:function(){p||l((function(t){return t-1}))},reset:function(){return l(c.current)},set:function(t){return"first"===t?l(c.current):"last"===t||t>=u?l(u):t<=1?l(1):void l(t)}}};export{i as useStep};
3
3
  //# sourceMappingURL=useStep.js.map
@@ -0,0 +1,3 @@
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{_ as e}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as t,useEffect as o}from"react";import{getElement as n}from"../../utils/helpers/getElement.js";import{isTarget as r}from"../../utils/helpers/isTarget.js";import{useRefState as i}from"../useRefState/useRefState.js";var l=function(){var l,s=r(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,a=s?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],v=null!==(l=null==a?void 0:a.axis)&&void 0!==l?l:"vertical",d=i(),u=t(!1),c=e(u,2),f=c[0],g=c[1];return o((function(){if(s||d.state){var e=s?n(s):d.current;if(e){var t=null!=a&&a.root?n(a.root):document,o=e.getBoundingClientRect().top+t.scrollTop-t.getBoundingClientRect().top,r=e.getBoundingClientRect().left+t.scrollLeft-t.getBoundingClientRect().left,i=function(){if("vertical"===v){var e=t.scrollTop;g(e>=o)}if("horizontal"===v){var n=t.scrollLeft;g(n>=r)}};return t.addEventListener("scroll",i),window.addEventListener("resize",i),window.addEventListener("orientationchange",i),i(),function(){t.removeEventListener("scroll",i),window.removeEventListener("resize",i),window.removeEventListener("orientationchange",i)}}}}),[s,d.state,v,null==a?void 0:a.root]),s?f:{stuck:f,ref:d}};export{l as useSticky};
3
+ //# sourceMappingURL=useSticky.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSticky.js","sources":["../../../../src/hooks/useSticky/useSticky.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nimport type { HookTarget } from '@/utils/helpers';\n\nimport { getElement, isTarget } from '@/utils/helpers';\n\nimport type { StateRef } from '../useRefState/useRefState';\n\nimport { useRefState } from '../useRefState/useRefState';\n\n/** The use sticky return type */\nexport interface UseStickyReturn {\n stuck: boolean;\n}\n\n/** The use sticky axis type */\nexport type UseStickyAxis = 'horizontal' | 'vertical';\n\n/** The use sticky options type */\nexport interface UseStickyOptions {\n axis?: UseStickyAxis;\n root?: HookTarget;\n}\n\nexport interface UseSticky {\n (target: HookTarget, options?: UseStickyOptions): boolean;\n\n <Target extends Element>(\n options?: UseStickyOptions,\n target?: never\n ): { ref: StateRef<Target> } & UseStickyReturn;\n}\n\n/**\n * @name UseSticky\n * @description - Hook that allows you to detect that your sticky component is stuck\n * @category Browser\n *\n * @overload\n * @param {HookTarget} target The target sticky element\n * @param {UseStickyAxis} [options.axis='vertical'] The axis of motion of the sticky component\n * @param {UseStickyRoot} [options.root=document] The element that contains your sticky component\n * @returns {UseStickyReturn} The state of the sticky\n *\n * @example\n * const stuck = useSticky(ref);\n *\n * @overload\n * @param {UseStickyAxis} [options.axis='vertical'] The axis of motion of the sticky component\n * @param {UseStickyRoot} [options.root=document] The element that contains your sticky component\n * @returns {{ stickyRef: StateRef<Target> } & UseStickyReturn} The state of the sticky\n *\n * @example\n * const { stuck, ref } = useSticky();\n */\nexport const useSticky = ((...params: any[]) => {\n const target = (isTarget(params[0]) ? params[0] : undefined) as HookTarget | undefined;\n const options = (target ? params[1] : params[0]) as UseStickyOptions;\n const axis = options?.axis ?? 'vertical';\n\n const internalRef = useRefState<Element>();\n const [stuck, setStuck] = useState(false);\n\n useEffect(() => {\n if (!target && !internalRef.state) return;\n\n const element = (target ? getElement(target) : internalRef.current) as Element;\n\n if (!element) return;\n\n const root = (options?.root ? getElement(options.root) : document) as Element;\n const elementOffsetTop =\n element.getBoundingClientRect().top + root.scrollTop - root.getBoundingClientRect().top;\n const elementOffsetLeft =\n element.getBoundingClientRect().left + root.scrollLeft - root.getBoundingClientRect().left;\n\n const onSticky = () => {\n if (axis === 'vertical') {\n const scrollTop = root.scrollTop;\n setStuck(scrollTop >= elementOffsetTop);\n }\n\n if (axis === 'horizontal') {\n const scrollLeft = root.scrollLeft;\n setStuck(scrollLeft >= elementOffsetLeft);\n }\n };\n\n root.addEventListener('scroll', onSticky);\n window.addEventListener('resize', onSticky);\n window.addEventListener('orientationchange', onSticky);\n\n onSticky();\n\n return () => {\n root.removeEventListener('scroll', onSticky);\n window.removeEventListener('resize', onSticky);\n window.removeEventListener('orientationchange', onSticky);\n };\n }, [target, internalRef.state, axis, options?.root]);\n\n if (target) return stuck;\n return {\n stuck,\n ref: internalRef\n };\n}) as UseSticky;\n"],"names":["useSticky","_options$axis","target","isTarget","arguments","length","undefined","options","axis","internalRef","useRefState","_useState","useState","_useState2","_slicedToArray","stuck","setStuck","useEffect","state","element","getElement","current","root","document","elementOffsetTop","getBoundingClientRect","top","scrollTop","elementOffsetLeft","left","scrollLeft","onSticky","addEventListener","window","removeEventListener","ref"],"mappings":";0SAuDaA,EAAa,WAAsB,IAAAC,EACxCC,EAAUC,EAAQC,UAAAC,QAAAC,OAAAA,EAAAF,cAAWA,UAAAC,eAAAC,EAAAF,UAAA,QAAeE,EAC5CC,EAAWL,EAAME,UAAAC,QAAAC,OAAAA,EAAAF,UAAA,GAAAA,UAAAC,eAAAC,EAAAF,UAA6C,GAC9DI,EAAoBP,QAAhBA,EAAGM,aAAO,EAAPA,EAASC,YAAIP,IAAAA,EAAAA,EAAI,WAExBQ,EAAcC,IACpBC,EAA0BC,GAAS,GAAMC,EAAAC,EAAAH,EAAA,GAAlCI,EAAKF,EAAA,GAAEG,EAAQH,EAAA,GAwCtB,OAtCAI,GAAU,WACR,GAAKf,GAAWO,EAAYS,MAA5B,CAEA,IAAMC,EAAWjB,EAASkB,EAAWlB,GAAUO,EAAYY,QAE3D,GAAKF,EAAL,CAEA,IAAMG,EAAQf,SAAAA,EAASe,KAAOF,EAAWb,EAAQe,MAAQC,SACnDC,EACJL,EAAQM,wBAAwBC,IAAMJ,EAAKK,UAAYL,EAAKG,wBAAwBC,IAChFE,EACJT,EAAQM,wBAAwBI,KAAOP,EAAKQ,WAAaR,EAAKG,wBAAwBI,KAElFE,EAAW,WACf,GAAa,aAATvB,EAAqB,CACvB,IAAMmB,EAAYL,EAAKK,UACvBX,EAASW,GAAaH,EACxB,CAEA,GAAa,eAAThB,EAAuB,CACzB,IAAMsB,EAAaR,EAAKQ,WACxBd,EAASc,GAAcF,EACzB,CACD,EAQD,OANAN,EAAKU,iBAAiB,SAAUD,GAChCE,OAAOD,iBAAiB,SAAUD,GAClCE,OAAOD,iBAAiB,oBAAqBD,GAE7CA,IAEO,WACLT,EAAKY,oBAAoB,SAAUH,GACnCE,OAAOC,oBAAoB,SAAUH,GACrCE,OAAOC,oBAAoB,oBAAqBH,EACjD,CA9Ba,CAJqB,CAmCpC,GAAE,CAAC7B,EAAQO,EAAYS,MAAOV,EAAMD,aAAO,EAAPA,EAASe,OAE1CpB,EAAea,EACZ,CACLA,MAAAA,EACAoB,IAAK1B,EAET"}
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{_ as n,c as t}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";import{useState as r,useEffect as o}from"react";var u=function(n){return n?{days:Math.floor(n/86400),hours:Math.floor(n%86400/3600),minutes:Math.floor(n%3600/60),seconds:Math.floor(n%60),count:n}:{days:0,hours:0,minutes:0,seconds:0,count:0}},e=function(){for(var e,s,c=arguments.length,i=new Array(c),a=0;a<c;a++)i[a]=arguments[a];var l=null!==(e="number"==typeof i[0]?i[0]:null===(s=i[0])||void 0===s?void 0:s.initialTime)&&void 0!==e?e:0,f="number"==typeof i[0]?i[1]:i[0],d=r(u(l)),m=n(d,2),h=m[0],v=m[1],p=r(!(null!=f&&f.enabled)),y=n(p,2),b=y[0],g=y[1];return o((function(){if(!b){var n=setInterval((function(){v((function(n){var r=n.count+1;return t(t({},n),{},r%60==0?{minutes:n.minutes+1,seconds:0,count:r}:r%3600==0?{hours:n.hours+1,minutes:0,seconds:0,count:r}:r%86400==0?{days:n.days+1,hours:0,minutes:0,seconds:0,count:r}:{seconds:n.seconds+1,count:r})}))}),1e3);return function(){return clearInterval(n)}}}),[b]),t(t({},h),{},{paused:b,pause:function(){return g(!0)},start:function(){return g(!1)},reset:function(){return v(u(l))},toggle:function(){return g((function(n){return!n}))}})};export{e as useStopwatch};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{_ as n,c as t}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as r,useEffect as o}from"react";var u=function(n){return n?{days:Math.floor(n/86400),hours:Math.floor(n%86400/3600),minutes:Math.floor(n%3600/60),seconds:Math.floor(n%60),count:n}:{days:0,hours:0,minutes:0,seconds:0,count:0}},e=function(){for(var e,s,c=arguments.length,i=new Array(c),a=0;a<c;a++)i[a]=arguments[a];var l=null!==(e="number"==typeof i[0]?i[0]:null===(s=i[0])||void 0===s?void 0:s.initialTime)&&void 0!==e?e:0,f="number"==typeof i[0]?i[1]:i[0],d=r(u(l)),m=n(d,2),h=m[0],v=m[1],p=r(!(null!=f&&f.enabled)),y=n(p,2),b=y[0],g=y[1];return o((function(){if(!b){var n=setInterval((function(){v((function(n){var r=n.count+1;return t(t({},n),{},r%60==0?{minutes:n.minutes+1,seconds:0,count:r}:r%3600==0?{hours:n.hours+1,minutes:0,seconds:0,count:r}:r%86400==0?{days:n.days+1,hours:0,minutes:0,seconds:0,count:r}:{seconds:n.seconds+1,count:r})}))}),1e3);return function(){return clearInterval(n)}}}),[b]),t(t({},h),{},{paused:b,pause:function(){return g(!0)},start:function(){return g(!1)},reset:function(){return v(u(l))},toggle:function(){return g((function(n){return!n}))}})};export{e as useStopwatch};
3
3
  //# sourceMappingURL=useStopwatch.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{b as e,_ as n}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";import{useState as r,useEffect as i}from"react";var t="reactuse-storage",o=function(e){return window.dispatchEvent(new StorageEvent(t,e))},u=function(e,n,r){var i=e.getItem(n);e.setItem(n,r),o({key:n,oldValue:i,newValue:r,storageArea:e})},a=function(e,n){var r=e.getItem(n);if(r)return r},l=function(l,v){var d,f,s="object"===e(v)&&v&&("serializer"in v||"deserializer"in v||"initialValue"in v||"storage"in v)?v:void 0,c=s?null==s?void 0:s.initialValue:v;if("undefined"==typeof window)return{value:c instanceof Function?c():c};var g=function(e){return null!=s&&s.serializer?s.serializer(e):"string"==typeof e?e:JSON.stringify(e)},w=null!==(d=null==s?void 0:s.storage)&&void 0!==d?d:null===(f=window)||void 0===f?void 0:f.localStorage,m=function(e){if(null!=s&&s.deserializer)return s.deserializer(e);if("undefined"!==e)try{return JSON.parse(e)}catch(n){return e}},p=r((function(){var e=a(w,l);if(void 0===e&&void 0!==c){var n=c instanceof Function?c():c;return u(w,l,g(n)),n}return e?m(e):void 0})),y=n(p,2),z=y[0],V=y[1];return i((function(){var e=function(){var e=a(w,l);V(e?m(e):void 0)};return window.addEventListener(t,e),function(){return window.removeEventListener(t,e)}}),[l]),{value:z,set:function(e){return u(w,l,g(e))},remove:function(){return function(e,n){var r=e.getItem(n);e.removeItem(n),o({key:n,oldValue:r,newValue:null,storageArea:e})}(w,l)}}};export{t as STORAGE_EVENT,o as dispatchStorageEvent,l as useStorage};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{b as e,_ as n}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as r,useEffect as t}from"react";var i="reactuse-storage",o=function(e){return window.dispatchEvent(new StorageEvent(i,e))},u=function(e,n,r){var t=e.getItem(n);e.setItem(n,r),o({key:n,oldValue:t,newValue:r,storageArea:e})},a=function(e,n){var r=e.getItem(n);if(r)return r},l=function(l,f){var v,d,s="object"===e(f)&&f&&("serializer"in f||"deserializer"in f||"initialValue"in f||"storage"in f)?f:void 0,c=s?null==s?void 0:s.initialValue:f;if("undefined"==typeof window)return{value:"function"==typeof c?c():c};var g=function(e){return null!=s&&s.serializer?s.serializer(e):"string"==typeof e?e:JSON.stringify(e)},w=null!==(v=null==s?void 0:s.storage)&&void 0!==v?v:null===(d=window)||void 0===d?void 0:d.localStorage,m=function(e){if(null!=s&&s.deserializer)return s.deserializer(e);if("undefined"!==e)try{return JSON.parse(e)}catch(n){return e}},p=r((function(){var e=a(w,l);if(void 0===e&&void 0!==c){var n="function"==typeof c?c():c;return u(w,l,g(n)),n}return e?m(e):void 0})),y=n(p,2),z=y[0],V=y[1];return t((function(){var e=function(){var e=a(w,l);V(e?m(e):void 0)};return window.addEventListener(i,e),function(){return window.removeEventListener(i,e)}}),[l]),{value:z,set:function(e){return u(w,l,g(e))},remove:function(){return function(e,n){var r=e.getItem(n);e.removeItem(n),o({key:n,oldValue:r,newValue:null,storageArea:e})}(w,l)}}};export{i as STORAGE_EVENT,o as dispatchStorageEvent,l as useStorage};
3
3
  //# sourceMappingURL=useStorage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useStorage.js","sources":["../../../../src/hooks/useStorage/useStorage.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/* The use storage initial value type */\nexport type UseStorageInitialValue<Value> = (() => Value) | Value;\n\n/* The use storage options type */\nexport interface UseStorageOptions<Value> {\n /* The initial value of the storage */\n initialValue?: UseStorageInitialValue<Value>;\n /* The storage to be used */\n storage?: Storage;\n /* The deserializer function to be invoked */\n deserializer?: (value: string) => Value;\n /* The serializer function to be invoked */\n serializer?: (value: Value) => string;\n}\n\n/* The use storage return type */\nexport interface UseStorageReturn<Value> {\n /* The value of the storage */\n value: Value;\n /* The error state of the storage */\n remove: () => void;\n /* The loading state of the storage */\n set: (value: Value) => void;\n}\n\nexport const STORAGE_EVENT = 'reactuse-storage';\n\nexport const dispatchStorageEvent = (params: Partial<StorageEvent>) =>\n window.dispatchEvent(new StorageEvent(STORAGE_EVENT, params));\n\nconst setStorageItem = (storage: Storage, key: string, value: string) => {\n const oldValue = storage.getItem(key);\n\n storage.setItem(key, value);\n dispatchStorageEvent({ key, oldValue, newValue: value, storageArea: storage });\n};\n\nconst removeStorageItem = (storage: Storage, key: string) => {\n const oldValue = storage.getItem(key);\n\n storage.removeItem(key);\n dispatchStorageEvent({ key, oldValue, newValue: null, storageArea: storage });\n};\n\nconst getStorageItem = (storage: Storage, key: string) => {\n const value = storage.getItem(key);\n if (!value) return undefined;\n return value;\n};\n\n/**\n * @name useStorage\n * @description - Hook that manages storage value\n * @category Browser\n *\n * @overload\n * @param {string} key The key of the storage\n * @param {UseStorageInitialValue<Value>} [initialValue] The initial value of the storage\n * @returns {UseStorageReturn<Value>} The value and the set function\n *\n * @overload\n * @param {string} key The key of the storage\n * @param {(value: Value) => string} [params.serializer] The serializer function\n * @param {(value: string) => Value} [params.deserializer] The deserializer function\n * @param {Storage} [params.storage] The storage\n * @param {UseStorageInitialValue<Value>} [params.initialValue] The initial value of the storage\n * @returns {UseStorageReturn<Value>} The value and the set function\n *\n * @example\n * const { value, set, remove } = useStorage('key', 'value');\n */\nexport const useStorage = <Value>(\n key: string,\n params?: UseStorageInitialValue<Value> | UseStorageOptions<Value>\n) => {\n const options = (\n typeof params === 'object' &&\n params &&\n ('serializer' in params ||\n 'deserializer' in params ||\n 'initialValue' in params ||\n 'storage' in params)\n ? params\n : undefined\n ) as UseStorageOptions<Value>;\n const initialValue = (options ? options?.initialValue : params) as UseStorageInitialValue<Value>;\n\n if (typeof window === 'undefined')\n return {\n value: initialValue instanceof Function ? initialValue() : initialValue\n } as UseStorageReturn<Value>;\n\n const serializer = (value: Value) => {\n if (options?.serializer) return options.serializer(value);\n if (typeof value === 'string') return value;\n return JSON.stringify(value);\n };\n\n const storage = options?.storage ?? window?.localStorage;\n\n const set = (value: Value) => setStorageItem(storage, key, serializer(value));\n const remove = () => removeStorageItem(storage, key);\n\n const deserializer = (value: string) => {\n if (options?.deserializer) return options.deserializer(value);\n if (value === 'undefined') return undefined as unknown as Value;\n\n try {\n return JSON.parse(value) as Value;\n } catch {\n return value as Value;\n }\n };\n\n const [value, setValue] = useState<Value | undefined>(() => {\n const storageValue = getStorageItem(storage, key);\n if (storageValue === undefined && initialValue !== undefined) {\n const value = initialValue instanceof Function ? initialValue() : initialValue;\n setStorageItem(storage, key, serializer(value));\n return value;\n }\n return storageValue ? deserializer(storageValue) : undefined;\n });\n\n useEffect(() => {\n const onChange = () => {\n const storageValue = getStorageItem(storage, key);\n setValue(storageValue ? deserializer(storageValue) : undefined);\n };\n window.addEventListener(STORAGE_EVENT, onChange);\n return () => window.removeEventListener(STORAGE_EVENT, onChange);\n }, [key]);\n\n return {\n value,\n set,\n remove\n };\n};\n"],"names":["STORAGE_EVENT","dispatchStorageEvent","params","window","dispatchEvent","StorageEvent","setStorageItem","storage","key","value","oldValue","getItem","setItem","newValue","storageArea","getStorageItem","useStorage","_options$storage","_window","options","_typeof","undefined","initialValue","Function","serializer","JSON","stringify","localStorage","deserializer","parse","_unused","_useState","useState","storageValue","_useState2","_slicedToArray","setValue","useEffect","onChange","addEventListener","removeEventListener","set","remove","removeItem","removeStorageItem"],"mappings":";uHA2BO,IAAMA,EAAgB,mBAEhBC,EAAuB,SAACC,GAA6B,OAChEC,OAAOC,cAAc,IAAIC,aAAaL,EAAeE,GAAQ,EAEzDI,EAAiB,SAACC,EAAkBC,EAAaC,GACrD,IAAMC,EAAWH,EAAQI,QAAQH,GAEjCD,EAAQK,QAAQJ,EAAKC,GACrBR,EAAqB,CAAEO,IAAAA,EAAKE,SAAAA,EAAUG,SAAUJ,EAAOK,YAAaP,GACtE,EASMQ,EAAiB,SAACR,EAAkBC,GACxC,IAAMC,EAAQF,EAAQI,QAAQH,GAC9B,GAAKC,EACL,OAAOA,CACT,EAuBaO,EAAa,SACxBR,EACAN,GACG,IAAAe,EAAAC,EACGC,EACc,WAAlBC,EAAOlB,IACPA,IACC,eAAgBA,GACf,iBAAkBA,GAClB,iBAAkBA,GAClB,YAAaA,GACXA,OACAmB,EAEAC,EAAgBH,EAAUA,aAAO,EAAPA,EAASG,aAAepB,EAExD,GAAsB,oBAAXC,OACT,MAAO,CACLM,MAAOa,aAAwBC,SAAWD,IAAiBA,GAG/D,IAAME,EAAa,SAACf,GAClB,OAAIU,SAAAA,EAASK,WAAmBL,EAAQK,WAAWf,GAC9B,iBAAVA,EAA2BA,EAC/BgB,KAAKC,UAAUjB,EACvB,EAEKF,EAA0B,QAAnBU,EAAGE,aAAO,EAAPA,EAASZ,eAAOU,IAAAA,EAAAA,UAAAC,EAAIf,cAAM,IAAAe,OAAA,EAANA,EAAQS,aAKtCC,EAAe,SAACnB,GACpB,GAAIU,SAAAA,EAASS,aAAc,OAAOT,EAAQS,aAAanB,GACvD,GAAc,cAAVA,EAEJ,IACE,OAAOgB,KAAKI,MAAMpB,EACnB,CAAC,MAAAqB,GACA,OAAOrB,CACT,CACD,EAEDsB,EAA0BC,GAA4B,WACpD,IAAMC,EAAelB,EAAeR,EAASC,GAC7C,QAAqBa,IAAjBY,QAA+CZ,IAAjBC,EAA4B,CAC5D,IAAMb,EAAQa,aAAwBC,SAAWD,IAAiBA,EAElE,OADAhB,EAAeC,EAASC,EAAKgB,EAAWf,IACjCA,CACT,CACA,OAAOwB,EAAeL,EAAaK,QAAgBZ,CACrD,IAAEa,EAAAC,EAAAJ,EAAA,GARKtB,EAAKyB,EAAA,GAAEE,EAAQF,EAAA,GAmBtB,OATAG,GAAU,WACR,IAAMC,EAAW,WACf,IAAML,EAAelB,EAAeR,EAASC,GAC7C4B,EAASH,EAAeL,EAAaK,QAAgBZ,EACtD,EAED,OADAlB,OAAOoC,iBAAiBvC,EAAesC,GAChC,WAAA,OAAMnC,OAAOqC,oBAAoBxC,EAAesC,EAAS,CAClE,GAAG,CAAC9B,IAEG,CACLC,MAAAA,EACAgC,IAnCU,SAAChC,GAAY,OAAKH,EAAeC,EAASC,EAAKgB,EAAWf,GAAO,EAoC3EiC,OAnCa,WAAH,OAhEY,SAACnC,EAAkBC,GAC3C,IAAME,EAAWH,EAAQI,QAAQH,GAEjCD,EAAQoC,WAAWnC,GACnBP,EAAqB,CAAEO,IAAAA,EAAKE,SAAAA,EAAUG,SAAU,KAAMC,YAAaP,GACrE,CA2DuBqC,CAAkBrC,EAASC,EAAI,EAqCtD"}
1
+ {"version":3,"file":"useStorage.js","sources":["../../../../src/hooks/useStorage/useStorage.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/* The use storage initial value type */\nexport type UseStorageInitialValue<Value> = (() => Value) | Value;\n\n/* The use storage options type */\nexport interface UseStorageOptions<Value> {\n /* The initial value of the storage */\n initialValue?: UseStorageInitialValue<Value>;\n /* The storage to be used */\n storage?: Storage;\n /* The deserializer function to be invoked */\n deserializer?: (value: string) => Value;\n /* The serializer function to be invoked */\n serializer?: (value: Value) => string;\n}\n\n/* The use storage return type */\nexport interface UseStorageReturn<Value> {\n /* The value of the storage */\n value: Value;\n /* The error state of the storage */\n remove: () => void;\n /* The loading state of the storage */\n set: (value: Value) => void;\n}\n\nexport const STORAGE_EVENT = 'reactuse-storage';\n\nexport const dispatchStorageEvent = (params: Partial<StorageEvent>) =>\n window.dispatchEvent(new StorageEvent(STORAGE_EVENT, params));\n\nconst setStorageItem = (storage: Storage, key: string, value: string) => {\n const oldValue = storage.getItem(key);\n\n storage.setItem(key, value);\n dispatchStorageEvent({ key, oldValue, newValue: value, storageArea: storage });\n};\n\nconst removeStorageItem = (storage: Storage, key: string) => {\n const oldValue = storage.getItem(key);\n\n storage.removeItem(key);\n dispatchStorageEvent({ key, oldValue, newValue: null, storageArea: storage });\n};\n\nconst getStorageItem = (storage: Storage, key: string) => {\n const value = storage.getItem(key);\n if (!value) return undefined;\n return value;\n};\n\n/**\n * @name useStorage\n * @description - Hook that manages storage value\n * @category Browser\n *\n * @overload\n * @param {string} key The key of the storage\n * @param {UseStorageInitialValue<Value>} [initialValue] The initial value of the storage\n * @returns {UseStorageReturn<Value>} The value and the set function\n *\n * @overload\n * @param {string} key The key of the storage\n * @param {(value: Value) => string} [params.serializer] The serializer function\n * @param {(value: string) => Value} [params.deserializer] The deserializer function\n * @param {Storage} [params.storage] The storage\n * @param {UseStorageInitialValue<Value>} [params.initialValue] The initial value of the storage\n * @returns {UseStorageReturn<Value>} The value and the set function\n *\n * @example\n * const { value, set, remove } = useStorage('key', 'value');\n */\nexport const useStorage = <Value>(\n key: string,\n params?: UseStorageInitialValue<Value> | UseStorageOptions<Value>\n) => {\n const options = (\n typeof params === 'object' &&\n params &&\n ('serializer' in params ||\n 'deserializer' in params ||\n 'initialValue' in params ||\n 'storage' in params)\n ? params\n : undefined\n ) as UseStorageOptions<Value>;\n const initialValue = (options ? options?.initialValue : params) as UseStorageInitialValue<Value>;\n\n if (typeof window === 'undefined')\n return {\n value: typeof initialValue === 'function' ? (initialValue as () => Value)() : initialValue\n } as UseStorageReturn<Value>;\n\n const serializer = (value: Value) => {\n if (options?.serializer) return options.serializer(value);\n if (typeof value === 'string') return value;\n return JSON.stringify(value);\n };\n\n const storage = options?.storage ?? window?.localStorage;\n\n const set = (value: Value) => setStorageItem(storage, key, serializer(value));\n const remove = () => removeStorageItem(storage, key);\n\n const deserializer = (value: string) => {\n if (options?.deserializer) return options.deserializer(value);\n if (value === 'undefined') return undefined as unknown as Value;\n\n try {\n return JSON.parse(value) as Value;\n } catch {\n return value as Value;\n }\n };\n\n const [value, setValue] = useState<Value | undefined>(() => {\n const storageValue = getStorageItem(storage, key);\n if (storageValue === undefined && initialValue !== undefined) {\n const value =\n typeof initialValue === 'function' ? (initialValue as () => Value)() : initialValue;\n setStorageItem(storage, key, serializer(value));\n return value;\n }\n return storageValue ? deserializer(storageValue) : undefined;\n });\n\n useEffect(() => {\n const onChange = () => {\n const storageValue = getStorageItem(storage, key);\n setValue(storageValue ? deserializer(storageValue) : undefined);\n };\n window.addEventListener(STORAGE_EVENT, onChange);\n return () => window.removeEventListener(STORAGE_EVENT, onChange);\n }, [key]);\n\n return {\n value,\n set,\n remove\n };\n};\n"],"names":["STORAGE_EVENT","dispatchStorageEvent","params","window","dispatchEvent","StorageEvent","setStorageItem","storage","key","value","oldValue","getItem","setItem","newValue","storageArea","getStorageItem","useStorage","_options$storage","_window","options","_typeof","undefined","initialValue","serializer","JSON","stringify","localStorage","deserializer","parse","_unused","_useState","useState","storageValue","_useState2","_slicedToArray","setValue","useEffect","onChange","addEventListener","removeEventListener","set","remove","removeItem","removeStorageItem"],"mappings":";uHA2BO,IAAMA,EAAgB,mBAEhBC,EAAuB,SAACC,GAA6B,OAChEC,OAAOC,cAAc,IAAIC,aAAaL,EAAeE,GAAQ,EAEzDI,EAAiB,SAACC,EAAkBC,EAAaC,GACrD,IAAMC,EAAWH,EAAQI,QAAQH,GAEjCD,EAAQK,QAAQJ,EAAKC,GACrBR,EAAqB,CAAEO,IAAAA,EAAKE,SAAAA,EAAUG,SAAUJ,EAAOK,YAAaP,GACtE,EASMQ,EAAiB,SAACR,EAAkBC,GACxC,IAAMC,EAAQF,EAAQI,QAAQH,GAC9B,GAAKC,EACL,OAAOA,CACT,EAuBaO,EAAa,SACxBR,EACAN,GACG,IAAAe,EAAAC,EACGC,EACc,WAAlBC,EAAOlB,IACPA,IACC,eAAgBA,GACf,iBAAkBA,GAClB,iBAAkBA,GAClB,YAAaA,GACXA,OACAmB,EAEAC,EAAgBH,EAAUA,aAAO,EAAPA,EAASG,aAAepB,EAExD,GAAsB,oBAAXC,OACT,MAAO,CACLM,MAA+B,mBAAjBa,EAA+BA,IAAiCA,GAGlF,IAAMC,EAAa,SAACd,GAClB,OAAIU,SAAAA,EAASI,WAAmBJ,EAAQI,WAAWd,GAC9B,iBAAVA,EAA2BA,EAC/Be,KAAKC,UAAUhB,EACvB,EAEKF,EAA0B,QAAnBU,EAAGE,aAAO,EAAPA,EAASZ,eAAOU,IAAAA,EAAAA,UAAAC,EAAIf,cAAM,IAAAe,OAAA,EAANA,EAAQQ,aAKtCC,EAAe,SAAClB,GACpB,GAAIU,SAAAA,EAASQ,aAAc,OAAOR,EAAQQ,aAAalB,GACvD,GAAc,cAAVA,EAEJ,IACE,OAAOe,KAAKI,MAAMnB,EACnB,CAAC,MAAAoB,GACA,OAAOpB,CACT,CACD,EAEDqB,EAA0BC,GAA4B,WACpD,IAAMC,EAAejB,EAAeR,EAASC,GAC7C,QAAqBa,IAAjBW,QAA+CX,IAAjBC,EAA4B,CAC5D,IAAMb,EACoB,mBAAjBa,EAA+BA,IAAiCA,EAEzE,OADAhB,EAAeC,EAASC,EAAKe,EAAWd,IACjCA,CACT,CACA,OAAOuB,EAAeL,EAAaK,QAAgBX,CACrD,IAAEY,EAAAC,EAAAJ,EAAA,GATKrB,EAAKwB,EAAA,GAAEE,EAAQF,EAAA,GAoBtB,OATAG,GAAU,WACR,IAAMC,EAAW,WACf,IAAML,EAAejB,EAAeR,EAASC,GAC7C2B,EAASH,EAAeL,EAAaK,QAAgBX,EACtD,EAED,OADAlB,OAAOmC,iBAAiBtC,EAAeqC,GAChC,WAAA,OAAMlC,OAAOoC,oBAAoBvC,EAAeqC,EAAS,CAClE,GAAG,CAAC7B,IAEG,CACLC,MAAAA,EACA+B,IApCU,SAAC/B,GAAY,OAAKH,EAAeC,EAASC,EAAKe,EAAWd,GAAO,EAqC3EgC,OApCa,WAAH,OAhEY,SAAClC,EAAkBC,GAC3C,IAAME,EAAWH,EAAQI,QAAQH,GAEjCD,EAAQmC,WAAWlC,GACnBP,EAAqB,CAAEO,IAAAA,EAAKE,SAAAA,EAAUG,SAAU,KAAMC,YAAaP,GACrE,CA2DuBoC,CAAkBpC,EAASC,EAAI,EAsCtD"}
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{_ as t}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";import{useState as e}from"react";import{getElement as r}from"../../utils/helpers/getElement.js";import{isTarget as o}from"../../utils/helpers/isTarget.js";import{useIsomorphicLayoutEffect as i}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import{useRefState as u}from"../useRefState/useRefState.js";var n=function(){var n,s=o(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,l=null!==(n=s?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0])&&void 0!==n?n:"ltr",v=u(),a=function(){var t,e=s?r(s):v.current;return null!==(t=null==e?void 0:e.getAttribute("dir"))&&void 0!==t?t:l},f=e(a()),m=t(f,2),c=m[0],d=m[1],p=function(){var t=s?r(s):v.current;t&&(null==t||t.removeAttribute("dir"))},b=function(t){var e=s?r(s):v.current;e&&(d(t),e.setAttribute("dir",t))};return i((function(){if(s||v.state){var t=s?r(s):v.current;if(t){var e=a();t.setAttribute("dir",e),d(e);var o=new MutationObserver(a);return o.observe(t,{attributes:!0}),function(){o.disconnect()}}}}),[v.state,s]),s?{value:c,set:b,remove:p}:{ref:v,value:c,set:b,remove:p}};export{n as useTextDirection};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{_ as t}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as e}from"react";import{getElement as r}from"../../utils/helpers/getElement.js";import{isTarget as o}from"../../utils/helpers/isTarget.js";import{useIsomorphicLayoutEffect as i}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import{useRefState as u}from"../useRefState/useRefState.js";var n=function(){var n,s=o(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,l=null!==(n=s?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0])&&void 0!==n?n:"ltr",v=u(),a=function(){var t,e=s?r(s):v.current;return null!==(t=null==e?void 0:e.getAttribute("dir"))&&void 0!==t?t:l},f=e(a()),m=t(f,2),c=m[0],d=m[1],p=function(){var t=s?r(s):v.current;t&&(null==t||t.removeAttribute("dir"))},b=function(t){var e=s?r(s):v.current;e&&(d(t),e.setAttribute("dir",t))};return i((function(){if(s||v.state){var t=s?r(s):v.current;if(t){var e=a();t.setAttribute("dir",e),d(e);var o=new MutationObserver(a);return o.observe(t,{attributes:!0}),function(){o.disconnect()}}}}),[v.state,s]),s?{value:c,set:b,remove:p}:{ref:v,value:c,set:b,remove:p}};export{n as useTextDirection};
3
3
  //# sourceMappingURL=useTextDirection.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{_ as e}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";import{useState as n,useEffect as t}from"react";import{useRerender as r}from"../useRerender/useRerender.js";var o=function(e){var n,t=null!==(n=e.rangeCount)&&void 0!==n?n:0;return Array.from({length:t},(function(n,t){return e.getRangeAt(t)}))},u=function(){var u,i=r(),c=n("undefined"!=typeof document?document.getSelection():null),l=e(c,2),a=l[0],d=l[1];t((function(){var e=function(){d(document.getSelection()),i()};return document.addEventListener("selectionchange",e),function(){return document.removeEventListener("selectionchange",e)}}),[]);var m=null!==(u=null==a?void 0:a.toString())&&void 0!==u?u:"",f=a?o(a):[],g=f.map((function(e){return e.getBoundingClientRect()}));return{text:m,ranges:f,rects:g,selection:a}};export{o as getRangesSelection,u as useTextSelection};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{_ as e}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as n,useEffect as t}from"react";import{useRerender as r}from"../useRerender/useRerender.js";var o=function(e){var n,t=null!==(n=e.rangeCount)&&void 0!==n?n:0;return Array.from({length:t},(function(n,t){return e.getRangeAt(t)}))},u=function(){var u,i=r(),c=n("undefined"!=typeof document?document.getSelection():null),l=e(c,2),a=l[0],d=l[1];t((function(){var e=function(){d(document.getSelection()),i()};return document.addEventListener("selectionchange",e),function(){return document.removeEventListener("selectionchange",e)}}),[]);var m=null!==(u=null==a?void 0:a.toString())&&void 0!==u?u:"",f=a?o(a):[],g=f.map((function(e){return e.getBoundingClientRect()}));return{text:m,ranges:f,rects:g,selection:a}};export{o as getRangesSelection,u as useTextSelection};
3
3
  //# sourceMappingURL=useTextSelection.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
2
  import{useMemo as r}from"react";import{throttle as t}from"../../utils/helpers/throttle.js";import{useEvent as e}from"../useEvent/useEvent.js";var o=function(o,n){var u=e(o);return r((function(){return t(u,n)}),[n])};export{o as useThrottleCallback};
3
3
  //# sourceMappingURL=useThrottleCallback.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{_ as r}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";import{useRef as t,useState as e,useEffect as o}from"react";import{useThrottleCallback as l}from"../useThrottleCallback/useThrottleCallback.js";import"../../utils/helpers/throttle.js";import"../useEvent/useEvent.js";var s=function(s,u){var n=t(s),a=e(s),i=r(a,2),p=i[0],m=i[1],c=l(m,u);return o((function(){n.current!==s&&(c(s),n.current=s)}),[s]),p};export{s as useThrottleValue};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{_ as r}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useRef as t,useState as e,useEffect as o}from"react";import{useThrottleCallback as l}from"../useThrottleCallback/useThrottleCallback.js";import"../../utils/helpers/throttle.js";import"../useEvent/useEvent.js";var s=function(s,u){var n=t(s),a=e(s),i=r(a,2),p=i[0],m=i[1],c=l(m,u);return o((function(){n.current!==s&&(c(s),n.current=s)}),[s]),p};export{s as useThrottleValue};
3
3
  //# sourceMappingURL=useThrottleValue.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{_ as r}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";import{useState as e}from"react";import{getDate as t}from"../../utils/helpers/getDate.js";import{useInterval as o}from"../useInterval/useInterval.js";var l=function(){var l=e(t()),n=r(l,2),s=n[0],u=n[1];return o((function(){return u(t())}),1e3),s};export{l as useTime};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{_ as r}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as e}from"react";import{getDate as t}from"../../utils/helpers/getDate.js";import{useInterval as o}from"../useInterval/useInterval.js";var l=function(){var l=e(t()),n=r(l,2),s=n[0],u=n[1];return o((function(){return u(t())}),1e3),s};export{l as useTime};
3
3
  //# sourceMappingURL=useTime.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{_ as r}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";import{useState as e,useRef as t,useEffect as n}from"react";import{useEvent as u}from"../useEvent/useEvent.js";function o(o,c){var i=e(!1),m=r(i,2),a=m[0],f=m[1],l=t(),s=u(o);n((function(){return l.current=setTimeout((function(){s(),f(!0)}),c),function(){clearTimeout(l.current)}}),[c]);return{ready:a,clear:function(){clearTimeout(l.current),f(!0)}}}export{o as useTimeout};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{_ as r}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as e,useRef as t,useEffect as n}from"react";import{useEvent as u}from"../useEvent/useEvent.js";function o(o,c){var i=e(!1),m=r(i,2),a=m[0],f=m[1],l=t(),s=u(o);n((function(){return l.current=setTimeout((function(){s(),f(!0)}),c),function(){clearTimeout(l.current)}}),[c]);return{ready:a,clear:function(){clearTimeout(l.current),f(!0)}}}export{o as useTimeout};
3
3
  //# sourceMappingURL=useTimeout.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{b as n,_ as r,c as t}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";import{useState as o,useRef as e,useEffect as u}from"react";import{useDidUpdate as i}from"../useDidUpdate/useDidUpdate.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var l=function(n){var r=Math.ceil(n),t=Math.floor(r/86400),o=Math.floor(r%86400/3600),e=Math.floor(r%3600/60);return{seconds:Math.floor(r%60),minutes:e,hours:o,days:t}},c=function(){var c,a,f=null!==(c=arguments.length<=0?void 0:arguments[0])&&void 0!==c?c:0,v="object"===n(arguments.length<=1?void 0:arguments[1])?arguments.length<=1?void 0:arguments[1]:{onExpire:arguments.length<=1?void 0:arguments[1]},s=f>0&&(null===(a=null==v?void 0:v.immediately)||void 0===a||a),d=o(s),p=r(d,2),h=p[0],m=p[1],g=o(f),M=r(g,2),j=M[0],y=M[1],E=e(),I=e();I.current=null!=v?v:{},i((function(){if(f<=0)return m(!1),void y(0);m(!0),y(f)}),[f]),u((function(){var n,r;if(h){null===(n=I.current)||void 0===n||null===(r=n.onStart)||void 0===r||r.call(n);return E.current=setInterval((function(){var n,r;null===(n=I.current)||void 0===n||null===(r=n.onTick)||void 0===r||r.call(n,j),y((function(n){var r,t,o=n-1;0===o&&(m(!1),null===(r=I.current)||void 0===r||null===(t=r.onExpire)||void 0===t||t.call(r));return o}))}),1e3),function(){clearInterval(E.current)}}}),[h]);return t(t({},l(j)),{},{count:j,pause:function(){return m(!1)},active:h,resume:function(){j<=0||m(!0)},toggle:function(){return m(!h)},start:function(){f<=0||(m(!0),y(f))},restart:function(n){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];y(n),r&&m(!0)},clear:function(){m(!1),y(0)},increase:function(n){return y((function(r){return r+n}))},decrease:function(n){y((function(r){var t=r-n;return t<=0?(m(!1),0):t}))}})};export{l as getTimeFromSeconds,c as useTimer};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{b as n,_ as t,c as r}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as o,useRef as e,useEffect as u}from"react";import{useDidUpdate as i}from"../useDidUpdate/useDidUpdate.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var l=function(n){var t=Math.ceil(n),r=Math.floor(t/86400),o=Math.floor(t%86400/3600),e=Math.floor(t%3600/60);return{seconds:Math.floor(t%60),minutes:e,hours:o,days:r}},c=function(){var c,a,f=Math.max(null!==(c=arguments.length<=0?void 0:arguments[0])&&void 0!==c?c:0,0),v="object"===n(arguments.length<=1?void 0:arguments[1])?arguments.length<=1?void 0:arguments[1]:{onExpire:arguments.length<=1?void 0:arguments[1]},s=o(f>0&&(null===(a=null==v?void 0:v.immediately)||void 0===a||a)),d=t(s,2),h=d[0],m=d[1],p=o(f),g=t(p,2),M=g[0],j=g[1],x=e(),y=e();y.current=null!=v?v:{},i((function(){if(f<=0)return m(!1),void j(0);m(!0),j(f)}),[f]),u((function(){var n,t;if(h){null===(n=y.current)||void 0===n||null===(t=n.onStart)||void 0===t||t.call(n);return x.current=setInterval((function(){var n,t;null===(n=y.current)||void 0===n||null===(t=n.onTick)||void 0===t||t.call(n,M),j((function(n){var t,r,o=n-1;0===o&&(m(!1),null===(t=y.current)||void 0===t||null===(r=t.onExpire)||void 0===r||r.call(t));return o}))}),1e3),function(){clearInterval(x.current)}}}),[h]);return r(r({},l(M)),{},{count:M,pause:function(){return m(!1)},active:h,resume:function(){M<=0||m(!0)},toggle:function(){M<=0||m(!h)},start:function(){f<=0||(m(!0),j(f))},restart:function(n){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];j(n),t&&m(!0)},clear:function(){m(!1),j(0)},increase:function(n){return j((function(t){return t+n}))},decrease:function(n){j((function(t){var r=t-n;return r<=0?(m(!1),0):r}))}})};export{l as getTimeFromSeconds,c as useTimer};
3
3
  //# sourceMappingURL=useTimer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTimer.js","sources":["../../../../src/hooks/useTimer/useTimer.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\nimport { useDidUpdate } from '../useDidUpdate/useDidUpdate';\n\nexport const getTimeFromSeconds = (timestamp: number) => {\n const roundedTimestamp = Math.ceil(timestamp);\n const days = Math.floor(roundedTimestamp / (60 * 60 * 24));\n const hours = Math.floor((roundedTimestamp % (60 * 60 * 24)) / (60 * 60));\n const minutes = Math.floor((roundedTimestamp % (60 * 60)) / 60);\n const seconds = Math.floor(roundedTimestamp % 60);\n\n return {\n seconds,\n minutes,\n hours,\n days\n };\n};\n\n/** The use timer options type */\nexport interface UseTimerOptions {\n /** Whether the timer should start automatically */\n immediately?: boolean;\n /** The function to be executed when the timer is expired */\n onExpire?: () => void;\n /** The function to be executed when the timer is started */\n onStart?: () => void;\n /** Callback function to be executed on each tick of the timer */\n onTick?: (seconds: number) => void;\n}\n\n/** The use timer return type */\nexport interface UseTimerReturn {\n /** flag to indicate if timer is active or not */\n active: boolean;\n /** The total count of the timer */\n count: number;\n /** The day count of the timer */\n days: number;\n /** The hour count of the timer */\n hours: number;\n /** The minute count of the timer */\n minutes: number;\n /** The second count of the timer */\n seconds: number;\n /** The function to clear the timer */\n clear: () => void;\n /** The function to decrease the timer */\n decrease: (seconds: number) => void;\n /** The function to increase the timer */\n increase: (seconds: number) => void;\n /** The function to pause the timer */\n pause: () => void;\n /** The function to restart the timer */\n restart: (time: number, immediately?: boolean) => void;\n /** The function to resume the timer */\n resume: () => void;\n /** The function to start the timer */\n start: () => void;\n /** The function to toggle the timer */\n toggle: () => void;\n}\n\nexport interface UseTimer {\n (): UseTimerReturn;\n\n (seconds: number, callback: () => void): UseTimerReturn;\n\n (seconds: number, options?: UseTimerOptions): UseTimerReturn;\n}\n\n/**\n * @name useTimer\n * @description - Hook that creates a timer functionality\n * @category Time\n *\n * @overload\n * @returns {UseTimerReturn} An object containing the timer properties and functions\n *\n * @example\n * const { days, hours, minutes, seconds, toggle, pause, start, restart, resume, active, decrease, increase } = useTimer();\n *\n * @overload\n * @param {number} seconds The seconds value that define for how long the timer will be running\n * @param {() => void} callback The function to be executed once countdown timer is expired\n * @returns {UseTimerReturn} An object containing the timer properties and functions\n *\n * @example\n * const { days, hours, minutes, seconds, toggle, pause, start, restart, resume, active, decrease, increase } = useTimer(1000, () => console.log('ready'));\n *\n * @overload\n * @param {number} seconds The seconds value that define for how long the timer will be running\n * @param {boolean} [options.immediately=true] The flag to decide if timer should start automatically\n * @param {() => void} [options.onExpire] The function to be executed when the timer is expired\n * @param {(timestamp: number) => void} [options.onTick] The function to be executed on each tick of the timer\n * @returns {UseTimerReturn} An object containing the timer properties and functions\n *\n * @example\n * const { days, hours, minutes, seconds, toggle, pause, start, restart, resume, active, decrease, increase } = useTimer(1000);\n */\nexport const useTimer = ((...params: any[]) => {\n const initialSeconds = (params[0] ?? 0) as number;\n const options = (typeof params[1] === 'object' ? params[1] : { onExpire: params[1] }) as\n | UseTimerOptions\n | undefined;\n\n const immediately = initialSeconds > 0 && (options?.immediately ?? true);\n const [active, setActive] = useState(immediately);\n const [seconds, setSeconds] = useState(initialSeconds);\n\n const intervalIdRef = useRef<ReturnType<typeof setInterval>>();\n const optionsRef = useRef<UseTimerOptions>();\n optionsRef.current = options ?? {};\n\n useDidUpdate(() => {\n if (initialSeconds <= 0) {\n setActive(false);\n setSeconds(0);\n return;\n }\n\n setActive(true);\n setSeconds(initialSeconds);\n }, [initialSeconds]);\n\n useEffect(() => {\n if (!active) return;\n\n optionsRef.current?.onStart?.();\n const onInterval = () => {\n optionsRef.current?.onTick?.(seconds);\n setSeconds((prevSeconds) => {\n const updatedSeconds = prevSeconds - 1;\n if (updatedSeconds === 0) {\n setActive(false);\n optionsRef.current?.onExpire?.();\n }\n return updatedSeconds;\n });\n };\n\n intervalIdRef.current = setInterval(onInterval, 1000);\n return () => {\n clearInterval(intervalIdRef.current);\n };\n }, [active]);\n\n const pause = () => setActive(false);\n\n const resume = () => {\n if (seconds <= 0) return;\n setActive(true);\n };\n\n const toggle = () => setActive(!active);\n\n const restart = (seconds: number, immediately = true) => {\n setSeconds(seconds);\n if (immediately) setActive(true);\n };\n\n const start = () => {\n if (initialSeconds <= 0) return;\n\n setActive(true);\n setSeconds(initialSeconds);\n };\n\n const clear = () => {\n setActive(false);\n setSeconds(0);\n };\n\n const increase = (seconds: number) => setSeconds((prevSeconds) => prevSeconds + seconds);\n const decrease = (seconds: number) => {\n setSeconds((prevSeconds) => {\n const updatedSeconds = prevSeconds - seconds;\n if (updatedSeconds <= 0) {\n setActive(false);\n return 0;\n } else {\n return updatedSeconds;\n }\n });\n };\n\n return {\n ...getTimeFromSeconds(seconds),\n count: seconds,\n pause,\n active,\n resume,\n toggle,\n start,\n restart,\n clear,\n increase,\n decrease\n };\n}) as UseTimer;\n"],"names":["getTimeFromSeconds","timestamp","roundedTimestamp","Math","ceil","days","floor","hours","minutes","seconds","useTimer","_ref","_options$immediately","initialSeconds","arguments","length","undefined","options","_typeof","onExpire","immediately","_useState","useState","_useState2","_slicedToArray","active","setActive","_useState3","_useState4","setSeconds","intervalIdRef","useRef","optionsRef","current","useDidUpdate","useEffect","_optionsRef$current","_optionsRef$current$o","onStart","call","setInterval","_optionsRef$current2","_optionsRef$current2$","onTick","prevSeconds","_optionsRef$current3","_optionsRef$current3$","updatedSeconds","clearInterval","_objectSpread","count","pause","resume","toggle","start","restart","clear","increase","decrease"],"mappings":";+QAIaA,EAAqB,SAACC,GACjC,IAAMC,EAAmBC,KAAKC,KAAKH,GAC7BI,EAAOF,KAAKG,MAAMJ,EAAgB,OAClCK,EAAQJ,KAAKG,MAAOJ,EAAoB,MAAa,MACrDM,EAAUL,KAAKG,MAAOJ,EAAgB,KAAgB,IAG5D,MAAO,CACLO,QAHcN,KAAKG,MAAMJ,EAAmB,IAI5CM,QAAAA,EACAD,MAAAA,EACAF,KAAAA,EAEJ,EAmFaK,EAAY,WAAsB,IAAAC,EAAAC,EACvCC,EAAcF,QAAAA,EAAAG,UAAAC,QAAA,OAAAC,EAAAF,UAAAH,UAAAA,IAAAA,EAAAA,EAAiB,EAC/BM,EAAgC,WAArBC,EAAAJ,UAAAC,eAAAC,EAAAF,UAAqB,IAAQA,UAAAC,QAAAC,OAAAA,EAAAF,UAAe,GAAA,CAAEK,SAAQL,UAAAC,QAAAC,OAAAA,EAAAF,UAAA,IAIjEM,EAAcP,EAAiB,IAA0B,QAAzBD,EAAKK,aAAAA,EAAAA,EAASG,mBAAWR,IAAAA,GAAAA,GAC/DS,EAA4BC,EAASF,GAAYG,EAAAC,EAAAH,EAAA,GAA1CI,EAAMF,EAAA,GAAEG,EAASH,EAAA,GACxBI,EAA8BL,EAAST,GAAee,EAAAJ,EAAAG,EAAA,GAA/ClB,EAAOmB,EAAA,GAAEC,EAAUD,EAAA,GAEpBE,EAAgBC,IAChBC,EAAaD,IACnBC,EAAWC,QAAUhB,QAAAA,EAAW,CAAE,EAElCiB,GAAa,WACX,GAAIrB,GAAkB,EAGpB,OAFAa,GAAU,QACVG,EAAW,GAIbH,GAAU,GACVG,EAAWhB,EACb,GAAG,CAACA,IAEJsB,GAAU,WAAM,IAAAC,EAAAC,EACd,GAAKZ,EAAL,CAEkBW,QAAlBA,EAAAJ,EAAWC,mBAAOG,WAAAC,EAAlBD,EAAoBE,eAAO,IAAAD,GAA3BA,EAAAE,KAAAH,GAcA,OADAN,EAAcG,QAAUO,aAZL,WAAM,IAAAC,EAAAC,EACLD,QAAlBA,EAAAT,EAAWC,eAAOS,IAAAD,GAAQ,QAARC,EAAlBD,EAAoBE,cAAM,IAAAD,GAA1BA,EAAAH,KAAAE,EAA6BhC,GAC7BoB,GAAW,SAACe,GACV,IAC0BC,EAAAC,EADpBC,EAAiBH,EAAc,EACd,IAAnBG,IACFrB,GAAU,GACQmB,QAAlBA,EAAAb,EAAWC,mBAAOY,WAAAC,EAAlBD,EAAoB1B,gBAAQ,IAAA2B,GAA5BA,EAAAP,KAAAM,IAEF,OAAOE,CACT,GACD,GAE+C,KACzC,WACLC,cAAclB,EAAcG,QAC7B,CAlBY,CAmBf,GAAG,CAACR,IAyCJ,OAAAwB,EAAAA,KACKjD,EAAmBS,IAAQ,GAAA,CAC9ByC,MAAOzC,EACP0C,MA1CY,WAAH,OAASzB,GAAU,EAAM,EA2ClCD,OAAAA,EACA2B,OA1Ca,WACT3C,GAAW,GACfiB,GAAU,EACX,EAwCC2B,OAtCa,WAAH,OAAS3B,GAAWD,EAAO,EAuCrC6B,MAhCY,WACRzC,GAAkB,IAEtBa,GAAU,GACVG,EAAWhB,GACZ,EA4BC0C,QAtCc,SAAC9C,GAAwC,IAAvBW,IAAWN,UAAAC,OAAA,QAAAC,IAAAF,UAAA,KAAAA,UAAA,GAC3Ce,EAAWpB,GACPW,GAAaM,GAAU,EAC5B,EAoCC8B,MA3BY,WACZ9B,GAAU,GACVG,EAAW,EACZ,EAyBC4B,SAvBe,SAAChD,GAAe,OAAKoB,GAAW,SAACe,GAAW,OAAKA,EAAcnC,IAAQ,EAwBtFiD,SAvBe,SAACjD,GAChBoB,GAAW,SAACe,GACV,IAAMG,EAAiBH,EAAcnC,EACrC,OAAIsC,GAAkB,GACpBrB,GAAU,GACH,GAEAqB,CAEX,GACD,GAeH"}
1
+ {"version":3,"file":"useTimer.js","sources":["../../../../src/hooks/useTimer/useTimer.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\nimport { useDidUpdate } from '../useDidUpdate/useDidUpdate';\n\nexport type PositiveInteger<Value extends number> = `${Value}` extends `-${any}` | `${any}.${any}`\n ? never\n : Value;\n\nexport const getTimeFromSeconds = (timestamp: number) => {\n const roundedTimestamp = Math.ceil(timestamp);\n const days = Math.floor(roundedTimestamp / (60 * 60 * 24));\n const hours = Math.floor((roundedTimestamp % (60 * 60 * 24)) / (60 * 60));\n const minutes = Math.floor((roundedTimestamp % (60 * 60)) / 60);\n const seconds = Math.floor(roundedTimestamp % 60);\n\n return {\n seconds,\n minutes,\n hours,\n days\n };\n};\n\n/** The use timer options type */\nexport interface UseTimerOptions {\n /** Whether the timer should start automatically */\n immediately?: boolean;\n /** The function to be executed when the timer is expired */\n onExpire?: () => void;\n /** The function to be executed when the timer is started */\n onStart?: () => void;\n /** Callback function to be executed on each tick of the timer */\n onTick?: (seconds: number) => void;\n}\n\n/** The use timer return type */\nexport interface UseTimerReturn {\n /** flag to indicate if timer is active or not */\n active: boolean;\n /** The total count of the timer */\n count: number;\n /** The day count of the timer */\n days: number;\n /** The hour count of the timer */\n hours: number;\n /** The minute count of the timer */\n minutes: number;\n /** The second count of the timer */\n seconds: number;\n /** The function to clear the timer */\n clear: () => void;\n /** The function to decrease the timer */\n decrease: (seconds: PositiveInteger<number>) => void;\n /** The function to increase the timer */\n increase: (seconds: PositiveInteger<number>) => void;\n /** The function to pause the timer */\n pause: () => void;\n /** The function to restart the timer */\n restart: (time: PositiveInteger<number>, immediately?: boolean) => void;\n /** The function to resume the timer */\n resume: () => void;\n /** The function to start the timer */\n start: () => void;\n /** The function to toggle the timer */\n toggle: () => void;\n}\n\nexport interface UseTimer {\n (): UseTimerReturn;\n\n (seconds: PositiveInteger<number>, callback: () => void): UseTimerReturn;\n\n (seconds: PositiveInteger<number>, options?: UseTimerOptions): UseTimerReturn;\n}\n\n/**\n * @name useTimer\n * @description - Hook that creates a timer functionality\n * @category Time\n *\n * @overload\n * @returns {UseTimerReturn} An object containing the timer properties and functions\n *\n * @example\n * const { days, hours, minutes, seconds, toggle, pause, start, restart, resume, active, decrease, increase } = useTimer();\n *\n * @overload\n * @param {number} seconds The seconds value that define for how long the timer will be running\n * @param {() => void} callback The function to be executed once countdown timer is expired\n * @returns {UseTimerReturn} An object containing the timer properties and functions\n *\n * @example\n * const { days, hours, minutes, seconds, toggle, pause, start, restart, resume, active, decrease, increase } = useTimer(1000, () => console.log('ready'));\n *\n * @overload\n * @param {number} seconds The seconds value that define for how long the timer will be running\n * @param {boolean} [options.immediately=true] The flag to decide if timer should start automatically\n * @param {() => void} [options.onExpire] The function to be executed when the timer is expired\n * @param {(timestamp: number) => void} [options.onTick] The function to be executed on each tick of the timer\n * @returns {UseTimerReturn} An object containing the timer properties and functions\n *\n * @example\n * const { days, hours, minutes, seconds, toggle, pause, start, restart, resume, active, decrease, increase } = useTimer(1000);\n */\nexport const useTimer = ((...params: any[]) => {\n const initialSeconds = Math.max((params[0] ?? 0) as PositiveInteger<number>, 0);\n const options = (typeof params[1] === 'object' ? params[1] : { onExpire: params[1] }) as\n | UseTimerOptions\n | undefined;\n\n const [active, setActive] = useState(initialSeconds > 0 && (options?.immediately ?? true));\n const [seconds, setSeconds] = useState(initialSeconds);\n\n const intervalIdRef = useRef<ReturnType<typeof setInterval>>();\n const optionsRef = useRef<UseTimerOptions>();\n optionsRef.current = options ?? {};\n\n useDidUpdate(() => {\n if (initialSeconds <= 0) {\n setActive(false);\n setSeconds(0);\n return;\n }\n\n setActive(true);\n setSeconds(initialSeconds);\n }, [initialSeconds]);\n\n useEffect(() => {\n if (!active) return;\n\n optionsRef.current?.onStart?.();\n const onInterval = () => {\n optionsRef.current?.onTick?.(seconds);\n setSeconds((prevSeconds) => {\n const updatedSeconds = prevSeconds - 1;\n if (updatedSeconds === 0) {\n setActive(false);\n optionsRef.current?.onExpire?.();\n }\n return updatedSeconds;\n });\n };\n\n intervalIdRef.current = setInterval(onInterval, 1000);\n return () => {\n clearInterval(intervalIdRef.current);\n };\n }, [active]);\n\n const pause = () => setActive(false);\n const resume = () => {\n if (seconds <= 0) return;\n setActive(true);\n };\n\n const toggle = () => {\n if (seconds <= 0) return;\n setActive(!active);\n };\n\n const restart = (seconds: PositiveInteger<number>, immediately = true) => {\n setSeconds(seconds);\n if (immediately) setActive(true);\n };\n\n const start = () => {\n if (initialSeconds <= 0) return;\n\n setActive(true);\n setSeconds(initialSeconds);\n };\n\n const clear = () => {\n setActive(false);\n setSeconds(0);\n };\n\n const increase = (seconds: PositiveInteger<number>) =>\n setSeconds((prevSeconds) => prevSeconds + seconds);\n const decrease = (seconds: PositiveInteger<number>) => {\n setSeconds((prevSeconds) => {\n const updatedSeconds = prevSeconds - seconds;\n if (updatedSeconds <= 0) {\n setActive(false);\n return 0;\n } else {\n return updatedSeconds;\n }\n });\n };\n\n return {\n ...getTimeFromSeconds(seconds),\n count: seconds,\n pause,\n active,\n resume,\n toggle,\n start,\n restart,\n clear,\n increase,\n decrease\n };\n}) as UseTimer;\n"],"names":["getTimeFromSeconds","timestamp","roundedTimestamp","Math","ceil","days","floor","hours","minutes","seconds","useTimer","_ref","_options$immediately","initialSeconds","max","arguments","length","undefined","options","_typeof","onExpire","_useState","useState","immediately","_useState2","_slicedToArray","active","setActive","_useState3","_useState4","setSeconds","intervalIdRef","useRef","optionsRef","current","useDidUpdate","useEffect","_optionsRef$current","_optionsRef$current$o","onStart","call","setInterval","_optionsRef$current2","_optionsRef$current2$","onTick","prevSeconds","_optionsRef$current3","_optionsRef$current3$","updatedSeconds","clearInterval","_objectSpread","count","pause","resume","toggle","start","restart","clear","increase","decrease"],"mappings":";+QAQaA,EAAqB,SAACC,GACjC,IAAMC,EAAmBC,KAAKC,KAAKH,GAC7BI,EAAOF,KAAKG,MAAMJ,EAAgB,OAClCK,EAAQJ,KAAKG,MAAOJ,EAAoB,MAAa,MACrDM,EAAUL,KAAKG,MAAOJ,EAAgB,KAAgB,IAG5D,MAAO,CACLO,QAHcN,KAAKG,MAAMJ,EAAmB,IAI5CM,QAAAA,EACAD,MAAAA,EACAF,KAAAA,EAEJ,EAmFaK,EAAY,WAAsB,IAAAC,EAAAC,EACvCC,EAAiBV,KAAKW,IAAG,QAAAH,EAAAI,UAAAC,eAAAC,EAAAF,UAAA,UAAA,IAAAJ,EAAAA,EAAe,EAA+B,GACvEO,EAAgC,WAArBC,EAAAJ,UAAAC,eAAAC,EAAAF,UAAqB,IAAQA,UAAAC,QAAAC,OAAAA,EAAAF,UAAe,GAAA,CAAEK,SAAQL,UAAAC,QAAAC,OAAAA,EAAAF,UAAA,IAIvEM,EAA4BC,EAAST,EAAiB,IAA0BD,QAAzBA,EAAKM,aAAAA,EAAAA,EAASK,uBAAWX,GAAAA,IAAUY,EAAAC,EAAAJ,EAAA,GAAnFK,EAAMF,EAAA,GAAEG,EAASH,EAAA,GACxBI,EAA8BN,EAAST,GAAegB,EAAAJ,EAAAG,EAAA,GAA/CnB,EAAOoB,EAAA,GAAEC,EAAUD,EAAA,GAEpBE,EAAgBC,IAChBC,EAAaD,IACnBC,EAAWC,QAAUhB,QAAAA,EAAW,CAAE,EAElCiB,GAAa,WACX,GAAItB,GAAkB,EAGpB,OAFAc,GAAU,QACVG,EAAW,GAIbH,GAAU,GACVG,EAAWjB,EACb,GAAG,CAACA,IAEJuB,GAAU,WAAM,IAAAC,EAAAC,EACd,GAAKZ,EAAL,CAEkBW,QAAlBA,EAAAJ,EAAWC,mBAAOG,WAAAC,EAAlBD,EAAoBE,eAAO,IAAAD,GAA3BA,EAAAE,KAAAH,GAcA,OADAN,EAAcG,QAAUO,aAZL,WAAM,IAAAC,EAAAC,EACLD,QAAlBA,EAAAT,EAAWC,eAAOS,IAAAD,GAAQ,QAARC,EAAlBD,EAAoBE,cAAM,IAAAD,GAA1BA,EAAAH,KAAAE,EAA6BjC,GAC7BqB,GAAW,SAACe,GACV,IAC0BC,EAAAC,EADpBC,EAAiBH,EAAc,EACd,IAAnBG,IACFrB,GAAU,GACQmB,QAAlBA,EAAAb,EAAWC,mBAAOY,WAAAC,EAAlBD,EAAoB1B,gBAAQ,IAAA2B,GAA5BA,EAAAP,KAAAM,IAEF,OAAOE,CACT,GACD,GAE+C,KACzC,WACLC,cAAclB,EAAcG,QAC7B,CAlBY,CAmBf,GAAG,CAACR,IA4CJ,OAAAwB,EAAAA,KACKlD,EAAmBS,IAAQ,GAAA,CAC9B0C,MAAO1C,EACP2C,MA7CY,WAAH,OAASzB,GAAU,EAAM,EA8ClCD,OAAAA,EACA2B,OA9Ca,WACT5C,GAAW,GACfkB,GAAU,EACX,EA4CC2B,OA1Ca,WACT7C,GAAW,GACfkB,GAAWD,EACZ,EAwCC6B,MAjCY,WACR1C,GAAkB,IAEtBc,GAAU,GACVG,EAAWjB,GACZ,EA6BC2C,QAvCc,SAAC/C,GAAyD,IAAvBc,IAAWR,UAAAC,OAAA,QAAAC,IAAAF,UAAA,KAAAA,UAAA,GAC5De,EAAWrB,GACPc,GAAaI,GAAU,EAC5B,EAqCC8B,MA5BY,WACZ9B,GAAU,GACVG,EAAW,EACZ,EA0BC4B,SAxBe,SAACjD,GAAgC,OAChDqB,GAAW,SAACe,GAAW,OAAKA,EAAcpC,IAAQ,EAwBlDkD,SAvBe,SAAClD,GAChBqB,GAAW,SAACe,GACV,IAAMG,EAAiBH,EAAcpC,EACrC,OAAIuC,GAAkB,GACpBrB,GAAU,GACH,GAEAqB,CAEX,GACD,GAeH"}
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{_ as r}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";import{useReducer as n}from"react";var t=function(){var t=n((function(r,n){var t=n instanceof Function?n(r[0]):n,e=Math.abs(r.indexOf(t));return r.slice(e).concat(r.slice(0,e))}),arguments.length>0&&void 0!==arguments[0]?arguments[0]:[!1,!0]),e=r(t,2);return[r(e[0],1)[0],e[1]]};export{t as useToggle};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{_ as r}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useReducer as t}from"react";var e=function(){var e=t((function(r,t){var e="function"==typeof t?t(r[0]):t,n=Math.abs(r.indexOf(e));return r.slice(n).concat(r.slice(0,n))}),arguments.length>0&&void 0!==arguments[0]?arguments[0]:[!1,!0]),n=r(e,2);return[r(n[0],1)[0],n[1]]};export{e as useToggle};
3
3
  //# sourceMappingURL=useToggle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useToggle.js","sources":["../../../../src/hooks/useToggle/useToggle.ts"],"sourcesContent":["import type { SetStateAction } from 'react';\n\nimport { useReducer } from 'react';\n\n/** The use toggle return type */\nexport type UseToggleReturn<Value> = readonly [Value, (value?: Value) => void];\n\n/**\n * @name useToggle\n * @description - Hook that create toggle\n * @category Utilities\n *\n * @template Value The type of the value\n * @param {Value[]} [values=[false, true]] The values to toggle\n *\n * @example\n * const [on, toggle] = useToggle();\n *\n * @example\n * const [value, toggle] = useToggle(['light', 'dark'] as const);\n */\nexport const useToggle = <Value = boolean>(values: readonly Value[] = [false, true] as any) => {\n const [[option], toggle] = useReducer((state: Value[], action: SetStateAction<Value>) => {\n const value = action instanceof Function ? action(state[0]) : action;\n const index = Math.abs(state.indexOf(value));\n return state.slice(index).concat(state.slice(0, index));\n }, values as Value[]);\n\n return [option, toggle as (value?: SetStateAction<Value>) => void] as const;\n};\n"],"names":["useToggle","_useReducer","useReducer","state","action","value","Function","index","Math","abs","indexOf","slice","concat","arguments","length","undefined","_useReducer2","_slicedToArray"],"mappings":";uGAqBaA,EAAY,WAAsE,IAC7FC,EAA2BC,GAAW,SAACC,EAAgBC,GACrD,IAAMC,EAAQD,aAAkBE,SAAWF,EAAOD,EAAM,IAAMC,EACxDG,EAAQC,KAAKC,IAAIN,EAAMO,QAAQL,IACrC,OAAOF,EAAMQ,MAAMJ,GAAOK,OAAOT,EAAMQ,MAAM,EAAGJ,GACjD,GALgEM,UAAAC,eAAAC,IAAAF,UAAA,GAAAA,UAAG,GAAA,EAAC,GAAO,IAKvDG,EAAAC,EAAAhB,EAAA,GAErB,MAAO,CAFcgB,EAAAD,EAAA,GAAA,GAJP,GAASA,EAAA,GAOzB"}
1
+ {"version":3,"file":"useToggle.js","sources":["../../../../src/hooks/useToggle/useToggle.ts"],"sourcesContent":["import type { SetStateAction } from 'react';\n\nimport { useReducer } from 'react';\n\n/** The use toggle return type */\nexport type UseToggleReturn<Value> = readonly [Value, (value?: Value) => void];\n\n/**\n * @name useToggle\n * @description - Hook that create toggle\n * @category Utilities\n *\n * @template Value The type of the value\n * @param {Value[]} [values=[false, true]] The values to toggle\n *\n * @example\n * const [on, toggle] = useToggle();\n *\n * @example\n * const [value, toggle] = useToggle(['light', 'dark'] as const);\n */\nexport const useToggle = <Value = boolean>(values: readonly Value[] = [false, true] as any) => {\n const [[option], toggle] = useReducer((state: Value[], action: SetStateAction<Value>) => {\n const value =\n typeof action === 'function' ? (action as (prevState: Value) => Value)(state[0]) : action;\n const index = Math.abs(state.indexOf(value));\n return state.slice(index).concat(state.slice(0, index));\n }, values as Value[]);\n\n return [option, toggle as (value?: SetStateAction<Value>) => void] as const;\n};\n"],"names":["useToggle","_useReducer","useReducer","state","action","value","index","Math","abs","indexOf","slice","concat","arguments","length","undefined","_useReducer2","_slicedToArray"],"mappings":";uGAqBaA,EAAY,WAAsE,IAC7FC,EAA2BC,GAAW,SAACC,EAAgBC,GACrD,IAAMC,EACc,mBAAXD,EAAyBA,EAAuCD,EAAM,IAAMC,EAC/EE,EAAQC,KAAKC,IAAIL,EAAMM,QAAQJ,IACrC,OAAOF,EAAMO,MAAMJ,GAAOK,OAAOR,EAAMO,MAAM,EAAGJ,GACjD,GANgEM,UAAAC,eAAAC,IAAAF,UAAA,GAAAA,UAAG,GAAA,EAAC,GAAO,IAMvDG,EAAAC,EAAAf,EAAA,GAErB,MAAO,CAFce,EAAAD,EAAA,GAAA,GALP,GAASA,EAAA,GAQzB"}
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
2
  import{useRef as r,useEffect as n}from"react";var t=function(t){var c=r(t);c.current=t,n((function(){return function(){c.current()}}),[])};export{t as useUnmount};
3
3
  //# sourceMappingURL=useUnmount.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{_ as r}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";import{useRef as t,useState as n,useEffect as e}from"react";var a=function(a){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o="undefined"!=typeof navigator&&"vibrate"in navigator,u=t(),c=n(!1),v=r(c,2),l=v[0],f=v[1],g=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a;o&&navigator.vibrate(r)},p=function(){o&&(navigator.vibrate(0),f(!1),u.current&&clearInterval(u.current))},s=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i;o&&(u.current&&clearInterval(u.current),f(!0),u.current=setInterval(g,r))};return e((function(){if(o&&!(i<=0))return s(i),function(){p()}}),[i,a]),{supported:o,trigger:g,stop:p,active:l,pause:function(){o&&(f(!1),u.current&&clearInterval(u.current))},resume:s}};export{a as useVibrate};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{_ as r}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useRef as t,useState as n,useEffect as e}from"react";var a=function(a){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o="undefined"!=typeof navigator&&"vibrate"in navigator,u=t(),c=n(!1),v=r(c,2),l=v[0],f=v[1],g=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a;o&&navigator.vibrate(r)},p=function(){o&&(navigator.vibrate(0),f(!1),u.current&&clearInterval(u.current))},s=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i;o&&(u.current&&clearInterval(u.current),f(!0),u.current=setInterval(g,r))};return e((function(){if(o&&!(i<=0))return s(i),function(){p()}}),[i,a]),{supported:o,trigger:g,stop:p,active:l,pause:function(){o&&(f(!1),u.current&&clearInterval(u.current))},resume:s}};export{a as useVibrate};
3
3
  //# sourceMappingURL=useVibrate.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{_ as n}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";import{useRef as r,useState as e,useEffect as o}from"react";import{getRetry as t}from"../../utils/helpers/getRetry.js";import{useEvent as u}from"../useEvent/useEvent.js";var c=function(c,l){var i=r(),s=r(null!=l&&l.retry?t(l.retry):0),v=r(!1),a=e("connecting"),d=n(a,2),f=d[0],p=d[1],m=u((function(){i.current=new WebSocket("function"==typeof c?c():c,null==l?void 0:l.protocols),p("connecting");var n=i.current;n&&(n.onopen=function(){var r;p("connected"),null==l||null===(r=l.onConnected)||void 0===r||r.call(l,n)},n.onerror=function(r){var e;p("failed"),null==l||null===(e=l.onError)||void 0===e||e.call(l,r,n)},n.onmessage=function(r){var e;return null==l||null===(e=l.onMessage)||void 0===e?void 0:e.call(l,r,n)},n.onclose=function(r){var e;if(p("disconnected"),null==l||null===(e=l.onDisconnected)||void 0===e||e.call(l,r,n),!v.current)return s.current>0?(s.current-=1,m()):void(s.current=null!=l&&l.retry?t(l.retry):0)})}));o((function(){return m(),function(){i.current&&(i.current.close(),i.current=void 0)}}),[c]);return{client:i.current,close:function(){var n;v.current=!0,null===(n=i.current)||void 0===n||n.close()},open:function(){v.current=!1,m()},send:function(n){var r;return null===(r=i.current)||void 0===r?void 0:r.send(n)},status:f}};export{c as useWebSocket};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{_ as n}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useRef as r,useState as e,useEffect as o}from"react";import{getRetry as t}from"../../utils/helpers/getRetry.js";import{useEvent as u}from"../useEvent/useEvent.js";var c=function(c,l){var i=r(),s=r(null!=l&&l.retry?t(l.retry):0),v=r(!1),a=e("connecting"),d=n(a,2),f=d[0],p=d[1],m=u((function(){i.current=new WebSocket("function"==typeof c?c():c,null==l?void 0:l.protocols),p("connecting");var n=i.current;n&&(n.onopen=function(){var r;p("connected"),null==l||null===(r=l.onConnected)||void 0===r||r.call(l,n)},n.onerror=function(r){var e;p("failed"),null==l||null===(e=l.onError)||void 0===e||e.call(l,r,n)},n.onmessage=function(r){var e;return null==l||null===(e=l.onMessage)||void 0===e?void 0:e.call(l,r,n)},n.onclose=function(r){var e;if(p("disconnected"),null==l||null===(e=l.onDisconnected)||void 0===e||e.call(l,r,n),!v.current)return s.current>0?(s.current-=1,m()):void(s.current=null!=l&&l.retry?t(l.retry):0)})}));o((function(){return m(),function(){i.current&&(i.current.close(),i.current=void 0)}}),[c]);return{client:i.current,close:function(){var n;v.current=!0,null===(n=i.current)||void 0===n||n.close()},open:function(){v.current=!1,m()},send:function(n){var r;return null===(r=i.current)||void 0===r?void 0:r.send(n)},status:f}};export{c as useWebSocket};
3
3
  //# sourceMappingURL=useWebSocket.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{useEventListener as e}from"../useEventListener/useEventListener.js";import"react";import"../../utils/helpers/getElement.js";import"../../utils/helpers/isTarget.js";import"../../_rollupPluginBabelHelpers-Cyp-U6we.js";import"../useEvent/useEvent.js";import"../useRefState/useRefState.js";var t=function(t,r,s){return e(window,t,r,s)};export{t as useWindowEvent};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{useEventListener as e}from"../useEventListener/useEventListener.js";import"react";import"../../utils/helpers/getElement.js";import"../../utils/helpers/isTarget.js";import"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import"../useEvent/useEvent.js";import"../useRefState/useRefState.js";var t=function(t,r,s){return e(window,t,r,s)};export{t as useWindowEvent};
3
3
  //# sourceMappingURL=useWindowEvent.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{_ as n}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";import{useState as r,useEffect as e}from"react";var t=function(){var t=r(!1),o=n(t,2),i=o[0],u=o[1];return e((function(){var n=function(){return u(!0)},r=function(){return u(!1)};return window.addEventListener("focus",n),window.addEventListener("blur",r),function(){window.removeEventListener("focus",n),window.removeEventListener("blur",r)}})),i};export{t as useWindowFocus};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{_ as n}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as r,useEffect as e}from"react";var t=function(){var t=r(!1),o=n(t,2),i=o[0],u=o[1];return e((function(){var n=function(){return u(!0)},r=function(){return u(!1)};return window.addEventListener("focus",n),window.addEventListener("blur",r),function(){window.removeEventListener("focus",n),window.removeEventListener("blur",r)}})),i};export{t as useWindowFocus};
3
3
  //# sourceMappingURL=useWindowFocus.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{_ as e}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";import{useState as o,useEffect as r}from"react";var n=function(e){var o=e.x,r=e.y,n=e.behavior,i={behavior:void 0===n?"smooth":n};"number"==typeof o&&(i.left=o),"number"==typeof r&&(i.top=r),window.scrollTo(i)},i=function(){var i=o({x:"undefined"!=typeof window?window.scrollX:Number.POSITIVE_INFINITY,y:"undefined"!=typeof window?window.scrollY:Number.POSITIVE_INFINITY}),t=e(i,2),l=t[0],w=t[1];return r((function(){var e=function(){return w({x:window.scrollX,y:window.scrollY})};return window.addEventListener("scroll",e),window.addEventListener("resize",e),function(){window.removeEventListener("scroll",e),window.removeEventListener("resize",e)}}),[]),{value:l,scrollTo:n}};export{n as scrollTo,i as useWindowScroll};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{_ as e}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as o,useEffect as r}from"react";var n=function(e){var o=e.x,r=e.y,n=e.behavior,i={behavior:void 0===n?"smooth":n};"number"==typeof o&&(i.left=o),"number"==typeof r&&(i.top=r),window.scrollTo(i)},i=function(){var i=o({x:"undefined"!=typeof window?window.scrollX:Number.POSITIVE_INFINITY,y:"undefined"!=typeof window?window.scrollY:Number.POSITIVE_INFINITY}),t=e(i,2),l=t[0],w=t[1];return r((function(){var e=function(){return w({x:window.scrollX,y:window.scrollY})};return window.addEventListener("scroll",e),window.addEventListener("resize",e),function(){window.removeEventListener("scroll",e),window.removeEventListener("resize",e)}}),[]),{value:l,scrollTo:n}};export{n as scrollTo,i as useWindowScroll};
3
3
  //# sourceMappingURL=useWindowScroll.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{_ as n}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";import{useState as e,useEffect as i}from"react";var t=function(t){var o,d=null===(o=null==t?void 0:t.includeScrollbar)||void 0===o||o,r=e((function(){return"undefined"==typeof window?{width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY}:{width:d?window.innerWidth:window.document.documentElement.clientWidth,height:d?window.innerHeight:window.document.documentElement.clientHeight}})),u=n(r,2),w=u[0],l=u[1];return i((function(){var n=function(){l(d?{width:window.innerWidth,height:window.innerHeight}:{width:window.document.documentElement.clientWidth,height:window.document.documentElement.clientHeight})};return window.addEventListener("resize",n),function(){window.removeEventListener("resize",n)}}),[null==t?void 0:t.includeScrollbar]),w};export{t as useWindowSize};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{_ as n}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as e,useEffect as i}from"react";var t=function(t){var o,d=null===(o=null==t?void 0:t.includeScrollbar)||void 0===o||o,r=e((function(){return"undefined"==typeof window?{width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY}:{width:d?window.innerWidth:window.document.documentElement.clientWidth,height:d?window.innerHeight:window.document.documentElement.clientHeight}})),u=n(r,2),w=u[0],l=u[1];return i((function(){var n=function(){l(d?{width:window.innerWidth,height:window.innerHeight}:{width:window.document.documentElement.clientWidth,height:window.document.documentElement.clientHeight})};return window.addEventListener("resize",n),function(){window.removeEventListener("resize",n)}}),[null==t?void 0:t.includeScrollbar]),w};export{t as useWindowSize};
3
3
  //# sourceMappingURL=useWindowSize.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{_ as n,a as o}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";import{useState as t}from"react";var r=function(r,e){var c=null!=e?e:r[0].id,i=new Map(r.map((function(n){return[n.id,n]}))),l=t(c),a=n(l,2),u=a[0],f=a[1],s=t([c]),d=n(s,2),v=d[0],g=d[1];return{currentStepId:u,set:function(n){var t;if(null===(t=i.get(u))||void 0===t||null===(t=t.nodes)||void 0===t||!t.includes(n))throw new Error("Can't go to ".concat(n," from ").concat(u));g([].concat(o(v),[n])),f(n)},reset:function(){f(c),g([c])},back:function(){var n;if(1!==v.length){var o=v[v.length-2];if(null===(n=i.get(u))||void 0===n||null===(n=n.nodes)||void 0===n||!n.includes(o))throw new Error("Can't go to ".concat(o," from ").concat(u));g(v.slice(0,-1)),f(v[v.length-2])}},history:v}};export{r as useWizard};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{_ as n,a as o}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as t}from"react";var r=function(r,e){var c=null!=e?e:r[0].id,i=new Map(r.map((function(n){return[n.id,n]}))),l=t(c),a=n(l,2),u=a[0],f=a[1],s=t([c]),d=n(s,2),v=d[0],g=d[1];return{currentStepId:u,set:function(n){var t;if(null===(t=i.get(u))||void 0===t||null===(t=t.nodes)||void 0===t||!t.includes(n))throw new Error("Can't go to ".concat(n," from ").concat(u));g([].concat(o(v),[n])),f(n)},reset:function(){f(c),g([c])},back:function(){var n;if(1!==v.length){var o=v[v.length-2];if(null===(n=i.get(u))||void 0===n||null===(n=n.nodes)||void 0===n||!n.includes(o))throw new Error("Can't go to ".concat(o," from ").concat(u));g(v.slice(0,-1)),f(v[v.length-2])}},history:v}};export{r as useWizard};
3
3
  //# sourceMappingURL=useWizard.js.map
package/dist/esm/index.js CHANGED
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- export{useActiveElement}from"./hooks/useActiveElement/useActiveElement.js";export{useAsync}from"./hooks/useAsync/useAsync.js";export{useBattery}from"./hooks/useBattery/useBattery.js";export{useBluetooth}from"./hooks/useBluetooth/useBluetooth.js";export{useBoolean}from"./hooks/useBoolean/useBoolean.js";export{BREAKPOINTS_ANT_DESIGN,BREAKPOINTS_BOOTSTRAP_V5,BREAKPOINTS_MANTINE,BREAKPOINTS_MASTER_CSS,BREAKPOINTS_MATERIAL_UI,BREAKPOINTS_PRIME_FLEX,BREAKPOINTS_QUASAR_V2,BREAKPOINTS_SEMANTIC,BREAKPOINTS_TAILWIND,useBreakpoints}from"./hooks/useBreakpoints/useBreakpoints.js";export{useBrowserLanguage}from"./hooks/useBrowserLanguage/useBrowserLanguage.js";export{useClickOutside}from"./hooks/useClickOutside/useClickOutside.js";export{useClipboard}from"./hooks/useClipboard/useClipboard.js";export{useConst}from"./hooks/useConst/useConst.js";export{COOKIE_EVENT,dispatchCookieEvent,getCookie,getCookies,removeCookie,removeCookieItem,setCookie,setCookieItem,useCookie}from"./hooks/useCookie/useCookie.js";export{clearCookies,getParsedCookies,useCookies}from"./hooks/useCookies/useCookies.js";export{useCopy}from"./hooks/useCopy/useCopy.js";export{useCounter}from"./hooks/useCounter/useCounter.js";export{useCssVar}from"./hooks/useCssVar/useCssVar.js";export{useDebounceCallback}from"./hooks/useDebounceCallback/useDebounceCallback.js";export{useDebounceValue}from"./hooks/useDebounceValue/useDebounceValue.js";export{useDefault}from"./hooks/useDefault/useDefault.js";export{useDeviceMotion}from"./hooks/useDeviceMotion/useDeviceMotion.js";export{useDeviceOrientation}from"./hooks/useDeviceOrientation/useDeviceOrientation.js";export{useDevicePixelRatio}from"./hooks/useDevicePixelRatio/useDevicePixelRatio.js";export{useDidUpdate}from"./hooks/useDidUpdate/useDidUpdate.js";export{useDisclosure}from"./hooks/useDisclosure/useDisclosure.js";export{useDisplayMedia}from"./hooks/useDisplayMedia/useDisplayMedia.js";export{useDocumentEvent}from"./hooks/useDocumentEvent/useDocumentEvent.js";export{useDocumentTitle}from"./hooks/useDocumentTitle/useDocumentTitle.js";export{useDocumentVisibility}from"./hooks/useDocumentVisibility/useDocumentVisibility.js";export{useElementSize}from"./hooks/useElementSize/useElementSize.js";export{useEvent}from"./hooks/useEvent/useEvent.js";export{useEventListener}from"./hooks/useEventListener/useEventListener.js";export{useEyeDropper}from"./hooks/useEyeDropper/useEyeDropper.js";export{useFavicon}from"./hooks/useFavicon/useFavicon.js";export{useField}from"./hooks/useField/useField.js";export{useFileDialog}from"./hooks/useFileDialog/useFileDialog.js";export{useFocus}from"./hooks/useFocus/useFocus.js";export{useFps}from"./hooks/useFps/useFps.js";export{useFullscreen}from"./hooks/useFullscreen/useFullscreen.js";export{mapGamepadToXbox360Controller,useGamepad}from"./hooks/useGamepad/useGamepad.js";export{useGeolocation}from"./hooks/useGeolocation/useGeolocation.js";export{useHash}from"./hooks/useHash/useHash.js";export{isHotkeyMatch,useHotkeys}from"./hooks/useHotkeys/useHotkeys.js";export{useHover}from"./hooks/useHover/useHover.js";export{useIdle}from"./hooks/useIdle/useIdle.js";export{useImage}from"./hooks/useImage/useImage.js";export{useInfiniteScroll}from"./hooks/useInfiniteScroll/useInfiniteScroll.js";export{useIntersectionObserver}from"./hooks/useIntersectionObserver/useIntersectionObserver.js";export{useInterval}from"./hooks/useInterval/useInterval.js";export{useIsFirstRender}from"./hooks/useIsFirstRender/useIsFirstRender.js";export{useIsomorphicLayoutEffect}from"./hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";export{useKeyboard}from"./hooks/useKeyboard/useKeyboard.js";export{useKeyPress}from"./hooks/useKeyPress/useKeyPress.js";export{useKeyPressEvent}from"./hooks/useKeyPressEvent/useKeyPressEvent.js";export{useKeysPressed}from"./hooks/useKeysPressed/useKeysPressed.js";export{useLastChanged}from"./hooks/useLastChanged/useLastChanged.js";export{useLatest}from"./hooks/useLatest/useLatest.js";export{useLess}from"./hooks/useLess/useLess.js";export{useList}from"./hooks/useList/useList.js";export{useLocalStorage}from"./hooks/useLocalStorage/useLocalStorage.js";export{useLogger}from"./hooks/useLogger/useLogger.js";export{useLongPress}from"./hooks/useLongPress/useLongPress.js";export{useMap}from"./hooks/useMap/useMap.js";export{useMeasure}from"./hooks/useMeasure/useMeasure.js";export{useMediaQuery}from"./hooks/useMediaQuery/useMediaQuery.js";export{useMemory}from"./hooks/useMemory/useMemory.js";export{useMount}from"./hooks/useMount/useMount.js";export{useMouse}from"./hooks/useMouse/useMouse.js";export{useMutation}from"./hooks/useMutation/useMutation.js";export{useMutationObserver}from"./hooks/useMutationObserver/useMutationObserver.js";export{getConnection,useNetwork}from"./hooks/useNetwork/useNetwork.js";export{useOffsetPagination}from"./hooks/useOffsetPagination/useOffsetPagination.js";export{useOnline}from"./hooks/useOnline/useOnline.js";export{getOperatingSystem,useOperatingSystem}from"./hooks/useOperatingSystem/useOperatingSystem.js";export{useOptimistic}from"./hooks/useOptimistic/useOptimistic.js";export{useOrientation}from"./hooks/useOrientation/useOrientation.js";export{useOtpCredential}from"./hooks/useOtpCredential/useOtpCredential.js";export{usePageLeave}from"./hooks/usePageLeave/usePageLeave.js";export{Paint,Pointer,usePaint}from"./hooks/usePaint/usePaint.js";export{useParallax}from"./hooks/useParallax/useParallax.js";export{usePerformanceObserver}from"./hooks/usePerformanceObserver/usePerformanceObserver.js";export{usePermission}from"./hooks/usePermission/usePermission.js";export{usePointerLock}from"./hooks/usePointerLock/usePointerLock.js";export{usePostMessage}from"./hooks/usePostMessage/usePostMessage.js";export{usePreferredColorScheme}from"./hooks/usePreferredColorScheme/usePreferredColorScheme.js";export{usePreferredContrast}from"./hooks/usePreferredContrast/usePreferredContrast.js";export{usePreferredDark}from"./hooks/usePreferredDark/usePreferredDark.js";export{usePreferredLanguages}from"./hooks/usePreferredLanguages/usePreferredLanguages.js";export{usePreferredReducedMotion}from"./hooks/usePreferredReducedMotion/usePreferredReducedMotion.js";export{usePrevious}from"./hooks/usePrevious/usePrevious.js";export{useQuery}from"./hooks/useQuery/useQuery.js";export{useQueue}from"./hooks/useQueue/useQueue.js";export{useRaf}from"./hooks/useRaf/useRaf.js";export{useRafValue}from"./hooks/useRafValue/useRafValue.js";export{useRefState}from"./hooks/useRefState/useRefState.js";export{useRenderCount}from"./hooks/useRenderCount/useRenderCount.js";export{useRenderInfo}from"./hooks/useRenderInfo/useRenderInfo.js";export{useRerender}from"./hooks/useRerender/useRerender.js";export{useResizeObserver}from"./hooks/useResizeObserver/useResizeObserver.js";export{useScreenOrientation}from"./hooks/useScreenOrientation/useScreenOrientation.js";export{SCRIPT_STATUS_ATTRIBUTE_NAME,useScript}from"./hooks/useScript/useScript.js";export{useScroll}from"./hooks/useScroll/useScroll.js";export{useScrollIntoView}from"./hooks/useScrollIntoView/useScrollIntoView.js";export{useScrollTo}from"./hooks/useScrollTo/useScrollTo.js";export{useSessionStorage}from"./hooks/useSessionStorage/useSessionStorage.js";export{useSet}from"./hooks/useSet/useSet.js";export{useShare}from"./hooks/useShare/useShare.js";export{useStateHistory}from"./hooks/useStateHistory/useStateHistory.js";export{useStep}from"./hooks/useStep/useStep.js";export{useStopwatch}from"./hooks/useStopwatch/useStopwatch.js";export{STORAGE_EVENT,dispatchStorageEvent,useStorage}from"./hooks/useStorage/useStorage.js";export{useTextDirection}from"./hooks/useTextDirection/useTextDirection.js";export{getRangesSelection,useTextSelection}from"./hooks/useTextSelection/useTextSelection.js";export{useThrottleCallback}from"./hooks/useThrottleCallback/useThrottleCallback.js";export{useThrottleValue}from"./hooks/useThrottleValue/useThrottleValue.js";export{useTime}from"./hooks/useTime/useTime.js";export{useTimeout}from"./hooks/useTimeout/useTimeout.js";export{getTimeFromSeconds,useTimer}from"./hooks/useTimer/useTimer.js";export{useToggle}from"./hooks/useToggle/useToggle.js";export{useUnmount}from"./hooks/useUnmount/useUnmount.js";export{useVibrate}from"./hooks/useVibrate/useVibrate.js";export{useWebSocket}from"./hooks/useWebSocket/useWebSocket.js";export{useWindowEvent}from"./hooks/useWindowEvent/useWindowEvent.js";export{useWindowFocus}from"./hooks/useWindowFocus/useWindowFocus.js";export{scrollTo,useWindowScroll}from"./hooks/useWindowScroll/useWindowScroll.js";export{useWindowSize}from"./hooks/useWindowSize/useWindowSize.js";export{useWizard}from"./hooks/useWizard/useWizard.js";export{copy,legacyCopyToClipboard}from"./utils/helpers/copy.js";export{debounce}from"./utils/helpers/debounce.js";export{getDate}from"./utils/helpers/getDate.js";export{getElement,target,targetSymbol}from"./utils/helpers/getElement.js";export{getRetry}from"./utils/helpers/getRetry.js";export{isTarget}from"./utils/helpers/isTarget.js";export{throttle}from"./utils/helpers/throttle.js";import"./_rollupPluginBabelHelpers-Cyp-U6we.js";import"react";import"react-dom";
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ export{useActiveElement}from"./hooks/useActiveElement/useActiveElement.js";export{useAsync}from"./hooks/useAsync/useAsync.js";export{useBattery}from"./hooks/useBattery/useBattery.js";export{useBluetooth}from"./hooks/useBluetooth/useBluetooth.js";export{useBoolean}from"./hooks/useBoolean/useBoolean.js";export{BREAKPOINTS_ANT_DESIGN,BREAKPOINTS_BOOTSTRAP_V5,BREAKPOINTS_MANTINE,BREAKPOINTS_MASTER_CSS,BREAKPOINTS_MATERIAL_UI,BREAKPOINTS_PRIME_FLEX,BREAKPOINTS_QUASAR_V2,BREAKPOINTS_SEMANTIC,BREAKPOINTS_TAILWIND,useBreakpoints}from"./hooks/useBreakpoints/useBreakpoints.js";export{useBrowserLanguage}from"./hooks/useBrowserLanguage/useBrowserLanguage.js";export{useClickOutside}from"./hooks/useClickOutside/useClickOutside.js";export{useClipboard}from"./hooks/useClipboard/useClipboard.js";export{useConst}from"./hooks/useConst/useConst.js";export{COOKIE_EVENT,dispatchCookieEvent,getCookie,getCookies,removeCookie,removeCookieItem,setCookie,setCookieItem,useCookie}from"./hooks/useCookie/useCookie.js";export{clearCookies,getParsedCookies,useCookies}from"./hooks/useCookies/useCookies.js";export{useCopy}from"./hooks/useCopy/useCopy.js";export{useCounter}from"./hooks/useCounter/useCounter.js";export{useCssVar}from"./hooks/useCssVar/useCssVar.js";export{useDebounceCallback}from"./hooks/useDebounceCallback/useDebounceCallback.js";export{useDebounceValue}from"./hooks/useDebounceValue/useDebounceValue.js";export{useDefault}from"./hooks/useDefault/useDefault.js";export{useDeviceMotion}from"./hooks/useDeviceMotion/useDeviceMotion.js";export{useDeviceOrientation}from"./hooks/useDeviceOrientation/useDeviceOrientation.js";export{useDevicePixelRatio}from"./hooks/useDevicePixelRatio/useDevicePixelRatio.js";export{useDidUpdate}from"./hooks/useDidUpdate/useDidUpdate.js";export{useDisclosure}from"./hooks/useDisclosure/useDisclosure.js";export{useDisplayMedia}from"./hooks/useDisplayMedia/useDisplayMedia.js";export{useDocumentEvent}from"./hooks/useDocumentEvent/useDocumentEvent.js";export{useDocumentTitle}from"./hooks/useDocumentTitle/useDocumentTitle.js";export{useDocumentVisibility}from"./hooks/useDocumentVisibility/useDocumentVisibility.js";export{useElementSize}from"./hooks/useElementSize/useElementSize.js";export{useEvent}from"./hooks/useEvent/useEvent.js";export{useEventListener}from"./hooks/useEventListener/useEventListener.js";export{useEyeDropper}from"./hooks/useEyeDropper/useEyeDropper.js";export{useFavicon}from"./hooks/useFavicon/useFavicon.js";export{useField}from"./hooks/useField/useField.js";export{useFileDialog}from"./hooks/useFileDialog/useFileDialog.js";export{useFocus}from"./hooks/useFocus/useFocus.js";export{useFps}from"./hooks/useFps/useFps.js";export{useFullscreen}from"./hooks/useFullscreen/useFullscreen.js";export{mapGamepadToXbox360Controller,useGamepad}from"./hooks/useGamepad/useGamepad.js";export{useGeolocation}from"./hooks/useGeolocation/useGeolocation.js";export{useHash}from"./hooks/useHash/useHash.js";export{isHotkeyMatch,useHotkeys}from"./hooks/useHotkeys/useHotkeys.js";export{useHover}from"./hooks/useHover/useHover.js";export{useIdle}from"./hooks/useIdle/useIdle.js";export{useImage}from"./hooks/useImage/useImage.js";export{useInfiniteScroll}from"./hooks/useInfiniteScroll/useInfiniteScroll.js";export{useIntersectionObserver}from"./hooks/useIntersectionObserver/useIntersectionObserver.js";export{useInterval}from"./hooks/useInterval/useInterval.js";export{useIsFirstRender}from"./hooks/useIsFirstRender/useIsFirstRender.js";export{useIsomorphicLayoutEffect}from"./hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";export{useKeyboard}from"./hooks/useKeyboard/useKeyboard.js";export{useKeyPress}from"./hooks/useKeyPress/useKeyPress.js";export{useKeyPressEvent}from"./hooks/useKeyPressEvent/useKeyPressEvent.js";export{useKeysPressed}from"./hooks/useKeysPressed/useKeysPressed.js";export{useLastChanged}from"./hooks/useLastChanged/useLastChanged.js";export{useLatest}from"./hooks/useLatest/useLatest.js";export{useLess}from"./hooks/useLess/useLess.js";export{useList}from"./hooks/useList/useList.js";export{useLocalStorage}from"./hooks/useLocalStorage/useLocalStorage.js";export{useLockCallback}from"./hooks/useLockCallback/useLockCallback.js";export{useLogger}from"./hooks/useLogger/useLogger.js";export{useLongPress}from"./hooks/useLongPress/useLongPress.js";export{useMap}from"./hooks/useMap/useMap.js";export{useMeasure}from"./hooks/useMeasure/useMeasure.js";export{useMediaQuery}from"./hooks/useMediaQuery/useMediaQuery.js";export{useMemory}from"./hooks/useMemory/useMemory.js";export{useMount}from"./hooks/useMount/useMount.js";export{useMouse}from"./hooks/useMouse/useMouse.js";export{useMutation}from"./hooks/useMutation/useMutation.js";export{useMutationObserver}from"./hooks/useMutationObserver/useMutationObserver.js";export{getConnection,useNetwork}from"./hooks/useNetwork/useNetwork.js";export{useOffsetPagination}from"./hooks/useOffsetPagination/useOffsetPagination.js";export{useOnline}from"./hooks/useOnline/useOnline.js";export{getOperatingSystem,useOperatingSystem}from"./hooks/useOperatingSystem/useOperatingSystem.js";export{useOptimistic}from"./hooks/useOptimistic/useOptimistic.js";export{useOrientation}from"./hooks/useOrientation/useOrientation.js";export{useOtpCredential}from"./hooks/useOtpCredential/useOtpCredential.js";export{usePageLeave}from"./hooks/usePageLeave/usePageLeave.js";export{Paint,Pointer,usePaint}from"./hooks/usePaint/usePaint.js";export{useParallax}from"./hooks/useParallax/useParallax.js";export{usePerformanceObserver}from"./hooks/usePerformanceObserver/usePerformanceObserver.js";export{usePermission}from"./hooks/usePermission/usePermission.js";export{usePointerLock}from"./hooks/usePointerLock/usePointerLock.js";export{usePostMessage}from"./hooks/usePostMessage/usePostMessage.js";export{usePreferredColorScheme}from"./hooks/usePreferredColorScheme/usePreferredColorScheme.js";export{usePreferredContrast}from"./hooks/usePreferredContrast/usePreferredContrast.js";export{usePreferredDark}from"./hooks/usePreferredDark/usePreferredDark.js";export{usePreferredLanguages}from"./hooks/usePreferredLanguages/usePreferredLanguages.js";export{usePreferredReducedMotion}from"./hooks/usePreferredReducedMotion/usePreferredReducedMotion.js";export{usePrevious}from"./hooks/usePrevious/usePrevious.js";export{useQuery}from"./hooks/useQuery/useQuery.js";export{useQueue}from"./hooks/useQueue/useQueue.js";export{useRaf}from"./hooks/useRaf/useRaf.js";export{useRafValue}from"./hooks/useRafValue/useRafValue.js";export{useRefState}from"./hooks/useRefState/useRefState.js";export{useRenderCount}from"./hooks/useRenderCount/useRenderCount.js";export{useRenderInfo}from"./hooks/useRenderInfo/useRenderInfo.js";export{useRerender}from"./hooks/useRerender/useRerender.js";export{useResizeObserver}from"./hooks/useResizeObserver/useResizeObserver.js";export{useScreenOrientation}from"./hooks/useScreenOrientation/useScreenOrientation.js";export{SCRIPT_STATUS_ATTRIBUTE_NAME,useScript}from"./hooks/useScript/useScript.js";export{useScroll}from"./hooks/useScroll/useScroll.js";export{useScrollIntoView}from"./hooks/useScrollIntoView/useScrollIntoView.js";export{useScrollTo}from"./hooks/useScrollTo/useScrollTo.js";export{useSessionStorage}from"./hooks/useSessionStorage/useSessionStorage.js";export{useSet}from"./hooks/useSet/useSet.js";export{useShare}from"./hooks/useShare/useShare.js";export{useStateHistory}from"./hooks/useStateHistory/useStateHistory.js";export{useStep}from"./hooks/useStep/useStep.js";export{useSticky}from"./hooks/useSticky/useSticky.js";export{useStopwatch}from"./hooks/useStopwatch/useStopwatch.js";export{STORAGE_EVENT,dispatchStorageEvent,useStorage}from"./hooks/useStorage/useStorage.js";export{useTextDirection}from"./hooks/useTextDirection/useTextDirection.js";export{getRangesSelection,useTextSelection}from"./hooks/useTextSelection/useTextSelection.js";export{useThrottleCallback}from"./hooks/useThrottleCallback/useThrottleCallback.js";export{useThrottleValue}from"./hooks/useThrottleValue/useThrottleValue.js";export{useTime}from"./hooks/useTime/useTime.js";export{useTimeout}from"./hooks/useTimeout/useTimeout.js";export{getTimeFromSeconds,useTimer}from"./hooks/useTimer/useTimer.js";export{useToggle}from"./hooks/useToggle/useToggle.js";export{useUnmount}from"./hooks/useUnmount/useUnmount.js";export{useVibrate}from"./hooks/useVibrate/useVibrate.js";export{useWebSocket}from"./hooks/useWebSocket/useWebSocket.js";export{useWindowEvent}from"./hooks/useWindowEvent/useWindowEvent.js";export{useWindowFocus}from"./hooks/useWindowFocus/useWindowFocus.js";export{scrollTo,useWindowScroll}from"./hooks/useWindowScroll/useWindowScroll.js";export{useWindowSize}from"./hooks/useWindowSize/useWindowSize.js";export{useWizard}from"./hooks/useWizard/useWizard.js";export{copy,legacyCopyToClipboard}from"./utils/helpers/copy.js";export{debounce}from"./utils/helpers/debounce.js";export{getDate}from"./utils/helpers/getDate.js";export{getElement,target,targetSymbol}from"./utils/helpers/getElement.js";export{getRetry}from"./utils/helpers/getRetry.js";export{isTarget}from"./utils/helpers/isTarget.js";export{throttle}from"./utils/helpers/throttle.js";import"./_rollupPluginBabelHelpers-DoUxcpfK.js";import"react";import"react-dom";
3
3
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{d as e,e as r}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";var t=function(e){var r=document.createElement("textarea");r.value=e,r.readOnly=!0,r.style.fontSize="16px",document.body.appendChild(r),r.select(),document.execCommand("copy"),document.body.removeChild(r)},n=function(){var n=e(r().mark((function e(n){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.prev=1,e.next=4,navigator.clipboard.writeText(n);case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return",t(n));case 9:e.next=14;break;case 11:return e.prev=11,e.t1=e.catch(0),e.abrupt("return",t(n));case 14:case"end":return e.stop()}}),e,null,[[0,11],[1,6]])})));return function(e){return n.apply(this,arguments)}}();export{n as copy,t as legacyCopyToClipboard};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{d as e,e as r}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";var t=function(e){var r=document.createElement("textarea");r.value=e,r.readOnly=!0,r.style.fontSize="16px",document.body.appendChild(r),r.select(),document.execCommand("copy"),document.body.removeChild(r)},n=function(){var n=e(r().mark((function e(n){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.prev=1,e.next=4,navigator.clipboard.writeText(n);case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return",t(n));case 9:e.next=14;break;case 11:return e.prev=11,e.t1=e.catch(0),e.abrupt("return",t(n));case 14:case"end":return e.stop()}}),e,null,[[0,11],[1,6]])})));return function(e){return n.apply(this,arguments)}}();export{n as copy,t as legacyCopyToClipboard};
3
3
  //# sourceMappingURL=copy.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
2
  function r(r,t){var n;return function(){for(var e=this,o=arguments.length,u=new Array(o),i=0;i<o;i++)u[i]=arguments[i];clearTimeout(n),n=setTimeout((function(){return r.apply(e,u)}),t)}}export{r as debounce};
3
3
  //# sourceMappingURL=debounce.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
2
  var e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,t=e.getSeconds(),n=e.getMinutes(),r=e.getHours();return{seconds:t,minutes:n,hours:r,meridiemHours:{value:r%12==0?12:r%12,type:r>=12?"pm":"am"},day:e.getDate(),month:e.getMonth()+1,year:e.getFullYear(),timestamp:e.getTime()}};export{e as getDate};
3
3
  //# sourceMappingURL=getDate.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
2
  var e=Symbol("target"),n=function(n){return{value:n,type:e}},t=function(e){return"current"in e?e.current:"function"==typeof e.value?e.value():"string"==typeof e.value?document.querySelector(e.value):(e.value instanceof Document||e.value instanceof Window||(e.value,Element),e.value)};export{t as getElement,n as target,e as targetSymbol};
3
3
  //# sourceMappingURL=getElement.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
2
  var r=function(r){return"number"==typeof r?r:r?1:0};export{r as getRetry};
3
3
  //# sourceMappingURL=getRetry.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- export{copy,legacyCopyToClipboard}from"./copy.js";export{debounce}from"./debounce.js";export{getDate}from"./getDate.js";export{getElement,target,targetSymbol}from"./getElement.js";export{getRetry}from"./getRetry.js";export{isTarget}from"./isTarget.js";export{throttle}from"./throttle.js";import"../../_rollupPluginBabelHelpers-Cyp-U6we.js";
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ export{copy,legacyCopyToClipboard}from"./copy.js";export{debounce}from"./debounce.js";export{getDate}from"./getDate.js";export{getElement,target,targetSymbol}from"./getElement.js";export{getRetry}from"./getRetry.js";export{isTarget}from"./isTarget.js";export{throttle}from"./throttle.js";import"../../_rollupPluginBabelHelpers-DoUxcpfK.js";
3
3
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
2
- import{b as r}from"../../_rollupPluginBabelHelpers-Cyp-U6we.js";import{targetSymbol as e}from"./getElement.js";var t=function(t){return"object"===r(t)&&("current"in t||t.type===e)};export{t as isTarget};
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
+ import{b as r}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{targetSymbol as e}from"./getElement.js";var t=function(t){return"object"===r(t)&&("current"in t||t.type===e)};export{t as isTarget};
3
3
  //# sourceMappingURL=isTarget.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.109 */
1
+ /* @license @siberiacancode/reactuse v0.0.111 */
2
2
  var n=function(n,t){var e=!1,r=null,u=function(){r?(n.apply(undefined,r),r=null,setTimeout(u,t)):e=!1};return function(){for(var i=arguments.length,l=new Array(i),o=0;o<i;o++)l[o]=arguments[o];e?r=l:(n.apply(this,l),e=!0,setTimeout(u,t))}};export{n as throttle};
3
3
  //# sourceMappingURL=throttle.js.map