@siberiacancode/reactuse 0.0.68 → 0.0.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{_rollupPluginBabelHelpers-BNLoYKdA.js → _rollupPluginBabelHelpers-CVSWY18m.js} +2 -2
- package/dist/cjs/_rollupPluginBabelHelpers-CVSWY18m.js.map +1 -0
- package/dist/cjs/hooks/index.js +2 -2
- package/dist/cjs/hooks/useAsync/useAsync.js +2 -2
- package/dist/cjs/hooks/useAsync/useAsync.js.map +1 -1
- package/dist/cjs/hooks/useBattery/useBattery.js +2 -2
- package/dist/cjs/hooks/useBoolean/useBoolean.js +2 -2
- package/dist/cjs/hooks/useBoolean/useBoolean.js.map +1 -1
- package/dist/cjs/hooks/useBreakpoints/constants/breakpoints.js +1 -1
- package/dist/cjs/hooks/useBreakpoints/useBreakpoints.js +2 -2
- package/dist/cjs/hooks/useBreakpoints/useBreakpoints.js.map +1 -1
- package/dist/cjs/hooks/useBrowserLanguage/useBrowserLanguage.js +1 -1
- package/dist/cjs/hooks/useClickOutside/useClickOutside.js +2 -2
- package/dist/cjs/hooks/useClipboard/useClipboard.js +2 -2
- package/dist/cjs/hooks/useClipboard/useClipboard.js.map +1 -1
- package/dist/cjs/hooks/useCounter/useCounter.js +2 -2
- package/dist/cjs/hooks/useCounter/useCounter.js.map +1 -1
- package/dist/cjs/hooks/useCssVar/useCssVar.js +2 -2
- package/dist/cjs/hooks/useDebounceCallback/useDebounceCallback.js +1 -1
- package/dist/cjs/hooks/useDebounceValue/useDebounceValue.js +2 -2
- package/dist/cjs/hooks/useDefault/useDefault.js +2 -2
- package/dist/cjs/hooks/useDeviceMotion/useDeviceMotion.js +2 -2
- package/dist/cjs/hooks/useDeviceMotion/useDeviceMotion.js.map +1 -1
- package/dist/cjs/hooks/useDeviceOrientation/useDeviceOrientation.js +2 -2
- package/dist/cjs/hooks/useDeviceOrientation/useDeviceOrientation.js.map +1 -1
- package/dist/cjs/hooks/useDidUpdate/useDidUpdate.js +1 -1
- package/dist/cjs/hooks/useDisclosure/useDisclosure.js +2 -2
- package/dist/cjs/hooks/useDocumentEvent/useDocumentEvent.js +2 -2
- package/dist/cjs/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
- package/dist/cjs/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
- package/dist/cjs/hooks/useEvent/useEvent.js +1 -1
- package/dist/cjs/hooks/useEventListener/useEventListener.js +2 -2
- package/dist/cjs/hooks/useEyeDropper/useEyeDropper.js +2 -2
- package/dist/cjs/hooks/useEyeDropper/useEyeDropper.js.map +1 -1
- package/dist/cjs/hooks/useFavicon/useFavicon.js +2 -2
- package/dist/cjs/hooks/useField/useField.js +2 -2
- package/dist/cjs/hooks/useField/useField.js.map +1 -1
- package/dist/cjs/hooks/useFileDialog/useFileDialog.js +2 -2
- package/dist/cjs/hooks/useFileDialog/useFileDialog.js.map +1 -1
- package/dist/cjs/hooks/useFocus/useFocus.js +2 -2
- package/dist/cjs/hooks/useFocus/useFocus.js.map +1 -1
- package/dist/cjs/hooks/useFps/useFps.js +2 -2
- package/dist/cjs/hooks/useFullscreen/useFullscreen.js +2 -2
- package/dist/cjs/hooks/useFullscreen/useFullscreen.js.map +1 -1
- package/dist/cjs/hooks/useGamepad/helpers/mapGamepadToXbox360Controller.js +1 -1
- package/dist/cjs/hooks/useGamepad/useGamepad.js +2 -2
- package/dist/cjs/hooks/useGeolocation/useGeolocation.js +2 -2
- package/dist/cjs/hooks/useHash/useHash.js +2 -2
- package/dist/cjs/hooks/useHotkeys/useHotkeys.js +2 -2
- package/dist/cjs/hooks/useHotkeys/useHotkeys.js.map +1 -1
- package/dist/cjs/hooks/useHover/useHover.js +2 -2
- package/dist/cjs/hooks/useIdle/useIdle.js +2 -2
- package/dist/cjs/hooks/useIdle/useIdle.js.map +1 -1
- package/dist/cjs/hooks/useImage/useImage.js +2 -2
- package/dist/cjs/hooks/useInfiniteScroll/useInfiniteScroll.js +2 -2
- package/dist/cjs/hooks/useInfiniteScroll/useInfiniteScroll.js.map +1 -1
- package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -2
- package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.js.map +1 -1
- package/dist/cjs/hooks/useInterval/useInterval.js +2 -2
- package/dist/cjs/hooks/useInterval/useInterval.js.map +1 -1
- package/dist/cjs/hooks/useIsFirstRender/useIsFirstRender.js +1 -1
- package/dist/cjs/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +1 -1
- package/dist/cjs/hooks/useKeyPress/useKeyPress.js +2 -2
- package/dist/cjs/hooks/useKeyPress/useKeyPress.js.map +1 -1
- package/dist/cjs/hooks/useKeyPressEvent/useKeyPressEvent.js +2 -2
- package/dist/cjs/hooks/useKeyboard/useKeyboard.js +2 -2
- package/dist/cjs/hooks/useKeyboard/useKeyboard.js.map +1 -1
- package/dist/cjs/hooks/useKeysPressed/useKeysPressed.js +2 -2
- package/dist/cjs/hooks/useKeysPressed/useKeysPressed.js.map +1 -1
- package/dist/cjs/hooks/useLastChanged/useLastChanged.js +3 -0
- package/dist/cjs/hooks/useLastChanged/useLastChanged.js.map +1 -0
- package/dist/cjs/hooks/useList/useList.js +2 -2
- package/dist/cjs/hooks/useLocalStorage/useLocalStorage.js +2 -2
- package/dist/cjs/hooks/useLogger/useLogger.js +2 -2
- package/dist/cjs/hooks/useLongPress/useLongPress.js +2 -2
- package/dist/cjs/hooks/useLongPress/useLongPress.js.map +1 -1
- package/dist/cjs/hooks/useMap/useMap.js +2 -2
- package/dist/cjs/hooks/useMeasure/useMeasure.js +2 -2
- package/dist/cjs/hooks/useMediaQuery/useMediaQuery.js +1 -1
- package/dist/cjs/hooks/useMemory/useMemory.js +2 -2
- package/dist/cjs/hooks/useMount/useMount.js +1 -1
- package/dist/cjs/hooks/useMouse/useMouse.js +2 -2
- package/dist/cjs/hooks/useMutation/useMutation.js +2 -2
- package/dist/cjs/hooks/useMutationObserver/useMutationObserver.js +2 -2
- package/dist/cjs/hooks/useMutationObserver/useMutationObserver.js.map +1 -1
- package/dist/cjs/hooks/useNetwork/useNetwork.js +2 -2
- package/dist/cjs/hooks/useOffsetPagination/useOffsetPagination.js +2 -2
- package/dist/cjs/hooks/useOnline/useOnline.js +1 -1
- package/dist/cjs/hooks/useOperatingSystem/useOperatingSystem.js +1 -1
- package/dist/cjs/hooks/useOptimistic/useOptimistic.js +2 -2
- package/dist/cjs/hooks/useOrientation/useOrientation.js +2 -2
- package/dist/cjs/hooks/useOtpCredential/useOtpCredential.js +2 -2
- package/dist/cjs/hooks/usePageLeave/usePageLeave.js +2 -2
- package/dist/cjs/hooks/usePaint/helpers/Paint.js +2 -2
- package/dist/cjs/hooks/usePaint/helpers/Pointer.js +2 -2
- package/dist/cjs/hooks/usePaint/usePaint.js +2 -2
- package/dist/cjs/hooks/useParallax/useParallax.js +2 -2
- package/dist/cjs/hooks/usePermission/usePermission.js +2 -2
- package/dist/cjs/hooks/usePreferredColorScheme/usePreferredColorScheme.js +1 -1
- package/dist/cjs/hooks/usePreferredContrast/usePreferredContrast.js +1 -1
- package/dist/cjs/hooks/usePreferredDark/usePreferredDark.js +1 -1
- package/dist/cjs/hooks/usePreferredLanguages/usePreferredLanguages.js +1 -1
- package/dist/cjs/hooks/usePreferredReducedMotion/usePreferredReducedMotion.js +1 -1
- package/dist/cjs/hooks/usePrevious/usePrevious.js +1 -1
- package/dist/cjs/hooks/useQuery/useQuery.js +2 -2
- package/dist/cjs/hooks/useQueue/useQueue.js +2 -2
- package/dist/cjs/hooks/useQueue/useQueue.js.map +1 -1
- package/dist/cjs/hooks/useRaf/useRaf.js +2 -2
- package/dist/cjs/hooks/useRaf/useRaf.js.map +1 -1
- package/dist/cjs/hooks/useRafValue/useRafValue.js +2 -2
- package/dist/cjs/hooks/useRenderCount/useRenderCount.js +1 -1
- package/dist/cjs/hooks/useRenderInfo/useRenderInfo.js +1 -1
- package/dist/cjs/hooks/useRenderInfo/useRenderInfo.js.map +1 -1
- package/dist/cjs/hooks/useRerender/useRerender.js +2 -2
- package/dist/cjs/hooks/useResizeObserver/useResizeObserver.js +2 -2
- package/dist/cjs/hooks/useResizeObserver/useResizeObserver.js.map +1 -1
- package/dist/cjs/hooks/useScreenOrientation/useScreenOrientation.js +2 -2
- package/dist/cjs/hooks/useScript/useScript.js +2 -2
- package/dist/cjs/hooks/useScript/useScript.js.map +1 -1
- package/dist/cjs/hooks/useSessionStorage/useSessionStorage.js +2 -2
- package/dist/cjs/hooks/useSet/useSet.js +2 -2
- package/dist/cjs/hooks/useShare/useShare.js +2 -2
- package/dist/cjs/hooks/useStep/useStep.js +2 -2
- package/dist/cjs/hooks/useStopwatch/useStopwatch.js +2 -2
- package/dist/cjs/hooks/useStopwatch/useStopwatch.js.map +1 -1
- package/dist/cjs/hooks/useStorage/useStorage.js +2 -2
- package/dist/cjs/hooks/useStorage/useStorage.js.map +1 -1
- package/dist/cjs/hooks/useTextSelection/useTextSelection.js +2 -2
- package/dist/cjs/hooks/useTime/useTime.js +2 -2
- package/dist/cjs/hooks/useTimeout/useTimeout.js +2 -2
- package/dist/cjs/hooks/useTimer/useTimer.js +2 -2
- package/dist/cjs/hooks/useToggle/useToggle.js +2 -2
- package/dist/cjs/hooks/useToggle/useToggle.js.map +1 -1
- package/dist/cjs/hooks/useUnmount/useUnmount.js +1 -1
- package/dist/cjs/hooks/useWebSocket/useWebSocket.js +2 -2
- package/dist/cjs/hooks/useWindowEvent/useWindowEvent.js +2 -2
- package/dist/cjs/hooks/useWindowScroll/useWindowScroll.js +2 -2
- package/dist/cjs/hooks/useWindowSize/useWindowSize.js +2 -2
- package/dist/cjs/hooks/useWindowSize/useWindowSize.js.map +1 -1
- package/dist/cjs/hooks/useWizard/useWizard.js +2 -2
- package/dist/cjs/{index-Dr1FAPr5.js → index-HaChE5C4.js} +2 -2
- package/dist/cjs/{index-Dr1FAPr5.js.map → index-HaChE5C4.js.map} +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/utils/helpers/debounce.js +1 -1
- package/dist/cjs/utils/helpers/debounce.js.map +1 -1
- package/dist/cjs/utils/helpers/getElement.js +1 -1
- package/dist/cjs/utils/helpers/getRetry.js +1 -1
- package/dist/cjs/utils/helpers/index.js +1 -1
- package/dist/cjs/utils/helpers/isClient.js +1 -1
- package/dist/cjs/utils/helpers/throttle.js +1 -1
- package/dist/cjs/utils/helpers/time/getDate.js +1 -1
- package/dist/esm/{_rollupPluginBabelHelpers-CfvNaX0r.js → _rollupPluginBabelHelpers-MWjPFzDB.js} +2 -2
- package/dist/esm/_rollupPluginBabelHelpers-MWjPFzDB.js.map +1 -0
- package/dist/esm/hooks/index.js +2 -2
- package/dist/esm/hooks/useAsync/useAsync.js +2 -2
- package/dist/esm/hooks/useAsync/useAsync.js.map +1 -1
- package/dist/esm/hooks/useBattery/useBattery.js +2 -2
- package/dist/esm/hooks/useBoolean/useBoolean.js +2 -2
- package/dist/esm/hooks/useBoolean/useBoolean.js.map +1 -1
- package/dist/esm/hooks/useBreakpoints/constants/breakpoints.js +1 -1
- package/dist/esm/hooks/useBreakpoints/useBreakpoints.js +2 -2
- package/dist/esm/hooks/useBreakpoints/useBreakpoints.js.map +1 -1
- package/dist/esm/hooks/useBrowserLanguage/useBrowserLanguage.js +1 -1
- package/dist/esm/hooks/useClickOutside/useClickOutside.js +2 -2
- package/dist/esm/hooks/useClipboard/useClipboard.js +2 -2
- package/dist/esm/hooks/useClipboard/useClipboard.js.map +1 -1
- package/dist/esm/hooks/useCounter/useCounter.js +2 -2
- package/dist/esm/hooks/useCounter/useCounter.js.map +1 -1
- package/dist/esm/hooks/useCssVar/useCssVar.js +2 -2
- package/dist/esm/hooks/useDebounceCallback/useDebounceCallback.js +1 -1
- package/dist/esm/hooks/useDebounceValue/useDebounceValue.js +2 -2
- package/dist/esm/hooks/useDefault/useDefault.js +2 -2
- package/dist/esm/hooks/useDeviceMotion/useDeviceMotion.js +2 -2
- package/dist/esm/hooks/useDeviceMotion/useDeviceMotion.js.map +1 -1
- package/dist/esm/hooks/useDeviceOrientation/useDeviceOrientation.js +2 -2
- package/dist/esm/hooks/useDeviceOrientation/useDeviceOrientation.js.map +1 -1
- package/dist/esm/hooks/useDidUpdate/useDidUpdate.js +1 -1
- package/dist/esm/hooks/useDisclosure/useDisclosure.js +2 -2
- package/dist/esm/hooks/useDocumentEvent/useDocumentEvent.js +2 -2
- package/dist/esm/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
- package/dist/esm/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
- package/dist/esm/hooks/useEvent/useEvent.js +1 -1
- package/dist/esm/hooks/useEventListener/useEventListener.js +2 -2
- package/dist/esm/hooks/useEyeDropper/useEyeDropper.js +2 -2
- package/dist/esm/hooks/useEyeDropper/useEyeDropper.js.map +1 -1
- package/dist/esm/hooks/useFavicon/useFavicon.js +2 -2
- package/dist/esm/hooks/useField/useField.js +2 -2
- package/dist/esm/hooks/useField/useField.js.map +1 -1
- package/dist/esm/hooks/useFileDialog/useFileDialog.js +2 -2
- package/dist/esm/hooks/useFileDialog/useFileDialog.js.map +1 -1
- package/dist/esm/hooks/useFocus/useFocus.js +2 -2
- package/dist/esm/hooks/useFocus/useFocus.js.map +1 -1
- package/dist/esm/hooks/useFps/useFps.js +2 -2
- package/dist/esm/hooks/useFullscreen/useFullscreen.js +2 -2
- package/dist/esm/hooks/useFullscreen/useFullscreen.js.map +1 -1
- package/dist/esm/hooks/useGamepad/helpers/mapGamepadToXbox360Controller.js +1 -1
- package/dist/esm/hooks/useGamepad/useGamepad.js +2 -2
- package/dist/esm/hooks/useGeolocation/useGeolocation.js +2 -2
- package/dist/esm/hooks/useHash/useHash.js +2 -2
- package/dist/esm/hooks/useHotkeys/useHotkeys.js +2 -2
- package/dist/esm/hooks/useHotkeys/useHotkeys.js.map +1 -1
- package/dist/esm/hooks/useHover/useHover.js +2 -2
- package/dist/esm/hooks/useIdle/useIdle.js +2 -2
- package/dist/esm/hooks/useIdle/useIdle.js.map +1 -1
- package/dist/esm/hooks/useImage/useImage.js +2 -2
- package/dist/esm/hooks/useInfiniteScroll/useInfiniteScroll.js +2 -2
- package/dist/esm/hooks/useInfiniteScroll/useInfiniteScroll.js.map +1 -1
- package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -2
- package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.js.map +1 -1
- package/dist/esm/hooks/useInterval/useInterval.js +2 -2
- package/dist/esm/hooks/useInterval/useInterval.js.map +1 -1
- package/dist/esm/hooks/useIsFirstRender/useIsFirstRender.js +1 -1
- package/dist/esm/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +1 -1
- package/dist/esm/hooks/useKeyPress/useKeyPress.js +2 -2
- package/dist/esm/hooks/useKeyPress/useKeyPress.js.map +1 -1
- package/dist/esm/hooks/useKeyPressEvent/useKeyPressEvent.js +2 -2
- package/dist/esm/hooks/useKeyboard/useKeyboard.js +2 -2
- package/dist/esm/hooks/useKeyboard/useKeyboard.js.map +1 -1
- package/dist/esm/hooks/useKeysPressed/useKeysPressed.js +2 -2
- package/dist/esm/hooks/useKeysPressed/useKeysPressed.js.map +1 -1
- package/dist/esm/hooks/useLastChanged/useLastChanged.js +3 -0
- package/dist/esm/hooks/useLastChanged/useLastChanged.js.map +1 -0
- package/dist/esm/hooks/useList/useList.js +2 -2
- package/dist/esm/hooks/useLocalStorage/useLocalStorage.js +2 -2
- package/dist/esm/hooks/useLogger/useLogger.js +2 -2
- package/dist/esm/hooks/useLongPress/useLongPress.js +2 -2
- package/dist/esm/hooks/useLongPress/useLongPress.js.map +1 -1
- package/dist/esm/hooks/useMap/useMap.js +2 -2
- package/dist/esm/hooks/useMeasure/useMeasure.js +2 -2
- package/dist/esm/hooks/useMediaQuery/useMediaQuery.js +1 -1
- package/dist/esm/hooks/useMemory/useMemory.js +2 -2
- package/dist/esm/hooks/useMount/useMount.js +1 -1
- package/dist/esm/hooks/useMouse/useMouse.js +2 -2
- package/dist/esm/hooks/useMutation/useMutation.js +2 -2
- package/dist/esm/hooks/useMutationObserver/useMutationObserver.js +2 -2
- package/dist/esm/hooks/useMutationObserver/useMutationObserver.js.map +1 -1
- package/dist/esm/hooks/useNetwork/useNetwork.js +2 -2
- package/dist/esm/hooks/useOffsetPagination/useOffsetPagination.js +2 -2
- package/dist/esm/hooks/useOnline/useOnline.js +1 -1
- package/dist/esm/hooks/useOperatingSystem/useOperatingSystem.js +1 -1
- package/dist/esm/hooks/useOptimistic/useOptimistic.js +2 -2
- package/dist/esm/hooks/useOrientation/useOrientation.js +2 -2
- package/dist/esm/hooks/useOtpCredential/useOtpCredential.js +2 -2
- package/dist/esm/hooks/usePageLeave/usePageLeave.js +2 -2
- package/dist/esm/hooks/usePaint/helpers/Paint.js +2 -2
- package/dist/esm/hooks/usePaint/helpers/Pointer.js +2 -2
- package/dist/esm/hooks/usePaint/usePaint.js +2 -2
- package/dist/esm/hooks/useParallax/useParallax.js +2 -2
- package/dist/esm/hooks/usePermission/usePermission.js +2 -2
- package/dist/esm/hooks/usePreferredColorScheme/usePreferredColorScheme.js +1 -1
- package/dist/esm/hooks/usePreferredContrast/usePreferredContrast.js +1 -1
- package/dist/esm/hooks/usePreferredDark/usePreferredDark.js +1 -1
- package/dist/esm/hooks/usePreferredLanguages/usePreferredLanguages.js +1 -1
- package/dist/esm/hooks/usePreferredReducedMotion/usePreferredReducedMotion.js +1 -1
- package/dist/esm/hooks/usePrevious/usePrevious.js +1 -1
- package/dist/esm/hooks/useQuery/useQuery.js +2 -2
- package/dist/esm/hooks/useQueue/useQueue.js +2 -2
- package/dist/esm/hooks/useQueue/useQueue.js.map +1 -1
- package/dist/esm/hooks/useRaf/useRaf.js +2 -2
- package/dist/esm/hooks/useRaf/useRaf.js.map +1 -1
- package/dist/esm/hooks/useRafValue/useRafValue.js +2 -2
- package/dist/esm/hooks/useRenderCount/useRenderCount.js +1 -1
- package/dist/esm/hooks/useRenderInfo/useRenderInfo.js +1 -1
- package/dist/esm/hooks/useRenderInfo/useRenderInfo.js.map +1 -1
- package/dist/esm/hooks/useRerender/useRerender.js +2 -2
- package/dist/esm/hooks/useResizeObserver/useResizeObserver.js +2 -2
- package/dist/esm/hooks/useResizeObserver/useResizeObserver.js.map +1 -1
- package/dist/esm/hooks/useScreenOrientation/useScreenOrientation.js +2 -2
- package/dist/esm/hooks/useScript/useScript.js +2 -2
- package/dist/esm/hooks/useScript/useScript.js.map +1 -1
- package/dist/esm/hooks/useSessionStorage/useSessionStorage.js +2 -2
- package/dist/esm/hooks/useSet/useSet.js +2 -2
- package/dist/esm/hooks/useShare/useShare.js +2 -2
- package/dist/esm/hooks/useStep/useStep.js +2 -2
- package/dist/esm/hooks/useStopwatch/useStopwatch.js +2 -2
- package/dist/esm/hooks/useStopwatch/useStopwatch.js.map +1 -1
- package/dist/esm/hooks/useStorage/useStorage.js +2 -2
- package/dist/esm/hooks/useStorage/useStorage.js.map +1 -1
- package/dist/esm/hooks/useTextSelection/useTextSelection.js +2 -2
- package/dist/esm/hooks/useTime/useTime.js +2 -2
- package/dist/esm/hooks/useTimeout/useTimeout.js +2 -2
- package/dist/esm/hooks/useTimer/useTimer.js +2 -2
- package/dist/esm/hooks/useToggle/useToggle.js +2 -2
- package/dist/esm/hooks/useToggle/useToggle.js.map +1 -1
- package/dist/esm/hooks/useUnmount/useUnmount.js +1 -1
- package/dist/esm/hooks/useWebSocket/useWebSocket.js +2 -2
- package/dist/esm/hooks/useWindowEvent/useWindowEvent.js +2 -2
- package/dist/esm/hooks/useWindowScroll/useWindowScroll.js +2 -2
- package/dist/esm/hooks/useWindowSize/useWindowSize.js +2 -2
- package/dist/esm/hooks/useWindowSize/useWindowSize.js.map +1 -1
- package/dist/esm/hooks/useWizard/useWizard.js +2 -2
- package/dist/esm/{index-D19QVrSm.js → index-aT3H0Ni8.js} +2 -2
- package/dist/esm/{index-D19QVrSm.js.map → index-aT3H0Ni8.js.map} +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/utils/helpers/debounce.js +1 -1
- package/dist/esm/utils/helpers/debounce.js.map +1 -1
- package/dist/esm/utils/helpers/getElement.js +1 -1
- package/dist/esm/utils/helpers/getRetry.js +1 -1
- package/dist/esm/utils/helpers/index.js +1 -1
- package/dist/esm/utils/helpers/isClient.js +1 -1
- package/dist/esm/utils/helpers/throttle.js +1 -1
- package/dist/esm/utils/helpers/time/getDate.js +1 -1
- package/dist/index.d.ts +20 -2
- package/package.json +1 -1
- package/dist/cjs/_rollupPluginBabelHelpers-BNLoYKdA.js.map +0 -1
- package/dist/esm/_rollupPluginBabelHelpers-CfvNaX0r.js.map +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
2
|
import{useSyncExternalStore as n}from"react";var e=function(){return window.navigator.languages},r=function(){return[]},t=function(n){return window.addEventListener("languagechange",n),function(){window.removeEventListener("languagechange",n)}},a=function(){return n(t,e,r)};export{a as usePreferredLanguages};
|
|
3
3
|
//# sourceMappingURL=usePreferredLanguages.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
2
|
import{useMediaQuery as e}from"../useMediaQuery/useMediaQuery.js";import"react";var r=function(){return e("(prefers-reduced-motion: reduce)")?"reduce":"no-preference"};export{r as usePreferredReducedMotion};
|
|
3
3
|
//# sourceMappingURL=usePreferredReducedMotion.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
2
|
import{useRef as r,useEffect as t}from"react";var n=function(n){var c=r();return t((function(){c.current=n})),c.current};export{n as usePrevious};
|
|
3
3
|
//# sourceMappingURL=usePrevious.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r,a as t}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{_ as r,a as t}from"../../_rollupPluginBabelHelpers-MWjPFzDB.js";import{useRef as n,useState as e,useEffect as l}from"react";import{getRetry as o}from"../../utils/helpers/getRetry.js";import"../../utils/helpers/isClient.js";import{useDidUpdate as i}from"../useDidUpdate/useDidUpdate.js";import{useMount as u}from"../useMount/useMount.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var a=function(a,c){var s,f,v=null===(s=null==c?void 0:c.enabled)||void 0===s||s,d=n(null!=c&&c.retry?o(c.retry):0),h=e(!1),p=r(h,2),m=p[0],y=p[1],b=e(!1),D=r(b,2),I=D[0],g=D[1],j=e(!1),E=r(j,2),C=E[0],L=E[1],k=e(!(null==c||!c.initialData)),w=r(k,2),A=w[0],M=w[1],R=e(!(null==c||!c.initialData)),S=r(R,2),U=S[0],_=S[1],x=e(void 0),B=r(x,2),F=B[0],H=B[1],P=e(null==c?void 0:c.initialData),q=r(P,2),z=q[0],G=q[1],J=n(new AbortController),K=n(),N=null!==(f=null==c?void 0:c.keys)&&void 0!==f?f:[],O=function(){J.current.abort(),J.current=new AbortController,J.current.signal.onabort=function(){return _(!0)}},Q=function r(t){O(),y(!0),"refetch"===t&&L(!0),a({signal:J.current.signal,keys:N}).then((function(r){var n,e=null!=c&&c.select?null==c?void 0:c.select(r):r;null==c||null===(n=c.onSuccess)||void 0===n||n.call(c,e),G(e),M(!0),y(!1),H(void 0),g(!1),_(!1),"refetch"===t&&L(!1)})).catch((function(n){var e;if(d.current>0)return d.current-=1,r(t);null==c||null===(e=c.onError)||void 0===e||e.call(c,n),G(void 0),M(!1),y(!1),_(!1),H(n),g(!0),"refetch"===t&&L(!1),d.current=null!=c&&c.retry?o(c.retry):0})).finally((function(){if(null!=c&&c.refetchInterval){var t=setInterval((function(){clearInterval(t),r("refetch")}),null==c?void 0:c.refetchInterval);K.current=t}}))};u((function(){v&&Q("init")})),i((function(){v&&Q("refetch")}),[v].concat(t(N))),l((function(){return function(){clearInterval(K.current)}}),[v,null==c?void 0:c.refetchInterval,null==c?void 0:c.retry].concat(t(N)));var T=(null==c?void 0:c.placeholderData)instanceof Function?null==c?void 0:c.placeholderData():null==c?void 0:c.placeholderData;return{abort:O,data:null!=z?z:T,error:F,refetch:function(){return Q("refetch")},isLoading:m,isError:I,isSuccess:A,isRefetching:C,aborted:U}};export{a as useQuery};
|
|
3
3
|
//# sourceMappingURL=useQuery.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r,a as n,g as t}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{_ as r,a as n,g as t}from"../../_rollupPluginBabelHelpers-MWjPFzDB.js";import{useState as e}from"react";import{flushSync as o}from"react-dom";var u=function(){var u=e(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),a=r(u,2),i=a[0],c=a[1];return{add:function(r){return c((function(t){return[].concat(n(t),[r])}))},remove:function(){var r;return o((function(){c((function(n){var e=t(n),o=e[0],u=e.slice(1);return r=o,u}))})),r},clear:function(){return c([])},first:i[0],last:i[i.length-1],size:i.length,queue:i}};export{u as useQueue};
|
|
3
3
|
//# sourceMappingURL=useQueue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useQueue.js","sources":["../../../../src/hooks/useQueue/useQueue.ts"],"sourcesContent":["import { useState } from 'react';\nimport { flushSync } from 'react-dom';\n\n/** The use queue return type */\nexport interface UseQueueReturn<Value> {\n /** The current queue */\n queue: Value[];\n /** Add an element to the queue */\n add: (element: Value) => void;\n /** Remove an element from the queue */\n remove: () => Value;\n /** Clear the queue */\n clear: () => void;\n /** Get the first element of the queue */\n first: Value;\n /** Get the last element of the queue */\n last: Value;\n /** Get the size of the queue */\n size: number;\n}\n\n/**\n * @name useQueue\n * @description - Hook that manages a queue\n * @category Utilities\n *\n * @template Value The type of the value\n * @param {Value[]} [initialValue=[]] The initial value of the queue\n * @returns {UseQueueReturn} An object containing the current queue and functions to interact with the queue\n *\n * @example\n * const { queue, add, remove, clear, first, last, size } = useQueue([1, 2, 3]);\n */\nexport const useQueue = <Value>(initialValue: Value[] = []): UseQueueReturn<Value> => {\n const [queue, setQueue] = useState(initialValue);\n\n const add = (element: Value) => setQueue((queue) => [...queue, element]);\n const clear = () => setQueue([]);\n const remove = () => {\n let removed;\n flushSync(() => {\n setQueue(([first, ...rest]) => {\n removed = first;\n return rest;\n });\n });\n\n return removed as Value;\n };\n\n return {\n add,\n remove,\n clear,\n first: queue[0],\n last: queue[queue.length - 1],\n size: queue.length,\n queue\n };\n};\n"],"names":["useQueue","_useState","useState","arguments","length","undefined","_useState2","_slicedToArray","queue","setQueue","add","element","concat","_toConsumableArray","remove","removed","flushSync","_ref","_ref2","_toArray","first","rest","slice","clear","last","size"],"mappings":";yJAiCaA,EAAW,WAA8D,IACpFC,EAA0BC,EADyBC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,IACNG,EAAAC,EAAAN,EAAA,GAAzCO,EAAKF,EAAA,GAAEG,EAAQH,EAAA,GAgBtB,MAAO,CACLI,IAfU,SAACC,GAAc,OAAKF,GAAS,SAACD,GAAK,MAAA,GAAAI,OAAAC,EAASL,IAAOG,GAAO,GAAE,EAgBtEG,OAda,WACb,IAAIC,EAQJ,OAPAC,GAAU,WACRP,GAAS,SAAAQ,GAAsB,IAAAC,EAAAC,EAAAF,GAApBG,EAAKF,EAAA,GAAKG,EAAIH,EAAAI,MAAA,GAEvB,OADAP,EAAUK,EACHC,CACT,GACF,IAEON,GAMPQ,MAhBY,WAAH,OAASd,EAAS,GAAG,EAiB9BW,MAAOZ,EAAM,GACbgB,KAAMhB,EAAMA,EAAMJ,OAAS,GAC3BqB,KAAMjB,EAAMJ,OACZI,MAAAA,EAEJ"}
|
|
1
|
+
{"version":3,"file":"useQueue.js","sources":["../../../../src/hooks/useQueue/useQueue.ts"],"sourcesContent":["import { useState } from 'react';\r\nimport { flushSync } from 'react-dom';\r\n\r\n/** The use queue return type */\r\nexport interface UseQueueReturn<Value> {\r\n /** The current queue */\r\n queue: Value[];\r\n /** Add an element to the queue */\r\n add: (element: Value) => void;\r\n /** Remove an element from the queue */\r\n remove: () => Value;\r\n /** Clear the queue */\r\n clear: () => void;\r\n /** Get the first element of the queue */\r\n first: Value;\r\n /** Get the last element of the queue */\r\n last: Value;\r\n /** Get the size of the queue */\r\n size: number;\r\n}\r\n\r\n/**\r\n * @name useQueue\r\n * @description - Hook that manages a queue\r\n * @category Utilities\r\n *\r\n * @template Value The type of the value\r\n * @param {Value[]} [initialValue=[]] The initial value of the queue\r\n * @returns {UseQueueReturn} An object containing the current queue and functions to interact with the queue\r\n *\r\n * @example\r\n * const { queue, add, remove, clear, first, last, size } = useQueue([1, 2, 3]);\r\n */\r\nexport const useQueue = <Value>(initialValue: Value[] = []): UseQueueReturn<Value> => {\r\n const [queue, setQueue] = useState(initialValue);\r\n\r\n const add = (element: Value) => setQueue((queue) => [...queue, element]);\r\n const clear = () => setQueue([]);\r\n const remove = () => {\r\n let removed;\r\n flushSync(() => {\r\n setQueue(([first, ...rest]) => {\r\n removed = first;\r\n return rest;\r\n });\r\n });\r\n\r\n return removed as Value;\r\n };\r\n\r\n return {\r\n add,\r\n remove,\r\n clear,\r\n first: queue[0],\r\n last: queue[queue.length - 1],\r\n size: queue.length,\r\n queue\r\n };\r\n};\r\n"],"names":["useQueue","_useState","useState","arguments","length","undefined","_useState2","_slicedToArray","queue","setQueue","add","element","concat","_toConsumableArray","remove","removed","flushSync","_ref","_ref2","_toArray","first","rest","slice","clear","last","size"],"mappings":";yJAiCaA,EAAW,WAA8D,IACpFC,EAA0BC,EADyBC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,IACNG,EAAAC,EAAAN,EAAA,GAAzCO,EAAKF,EAAA,GAAEG,EAAQH,EAAA,GAgBtB,MAAO,CACLI,IAfU,SAACC,GAAc,OAAKF,GAAS,SAACD,GAAK,MAAA,GAAAI,OAAAC,EAASL,IAAOG,GAAO,GAAE,EAgBtEG,OAda,WACb,IAAIC,EAQJ,OAPAC,GAAU,WACRP,GAAS,SAAAQ,GAAsB,IAAAC,EAAAC,EAAAF,GAApBG,EAAKF,EAAA,GAAKG,EAAIH,EAAAI,MAAA,GAEvB,OADAP,EAAUK,EACHC,CACT,GACF,IAEON,GAMPQ,MAhBY,WAAH,OAASd,EAAS,GAAG,EAiB9BW,MAAOZ,EAAM,GACbgB,KAAMhB,EAAMA,EAAMJ,OAAS,GAC3BqB,KAAMjB,EAAMJ,OACZI,MAAAA,EAEJ"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-MWjPFzDB.js";import{useRef as n,useState as e,useEffect as t}from"react";var u=function(u,l){var i,a=n(null),o=n(0),c=e(!1),m=r(c,2),d=m[0],v=m[1],f=null===(i=null==l?void 0:l.enabled)||void 0===i||i,s=n(u);s.current=u;var p=function r(n){var e=n-o.current;null!=l&&l.delay&&e<(null==l?void 0:l.delay)||(o.current=n,s.current({delta:e,timestamp:n})),a.current=window.requestAnimationFrame(r)},w=function(){d||(v(!0),o.current=0,a.current=window.requestAnimationFrame(p))};function y(){a.current&&(v(!1),window.cancelAnimationFrame(a.current),a.current=null)}return t((function(){if(f)return w(),y}),[f,null==l?void 0:l.delay]),{active:d,pause:y,resume:w}};export{u as useRaf};
|
|
3
3
|
//# sourceMappingURL=useRaf.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRaf.js","sources":["../../../../src/hooks/useRaf/useRaf.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\n/* The use raf params type */\nexport interface UseRafParams {\n /** The delta between each frame in milliseconds */\n delta: number;\n /** The timestamp of the current frame in milliseconds */\n timestamp: DOMHighResTimeStamp;\n}\n\n/* The use raf type */\nexport type UseRafCallback = (params: UseRafParams) => void;\n\n/* The use raf options type */\nexport interface UseRafOptions {\n /** The delay between each frame in milliseconds */\n delay?: number;\n /** Whether the callback should be enabled */\n enabled?: boolean;\n}\n\n/* The use raf return type */\nexport interface UseRafReturn {\n /** Whether the callback is active */\n active: boolean;\n /** Function to pause the callback */\n pause: () => void;\n /** Function to resume the callback */\n resume: () => void;\n}\n\n/**\n * @name useRaf\n * @description - Hook that defines the logic for raf callback\n * @category Utilities\n *\n * @param {UseRafCallback} callback The callback to execute\n * @param {number} [options.delay] The delay between each frame in milliseconds\n * @param {boolean} [options.enabled=true] Whether the callback should be enabled\n * @returns {UseRafCallbackReturn} An object of raf callback functions\n *\n * @example\n * useRaf(() => console.log('callback'));\n */\nexport const useRaf = (callback: UseRafCallback, options?: UseRafOptions): UseRafReturn => {\n const rafIdRef = useRef<number | null>(null);\n const previousFrameTimestampRef = useRef(0);\n const [active, setActive] = useState(false);\n const enabled = options?.enabled ?? true;\n\n const internalCallbackRef = useRef(callback);\n internalCallbackRef.current = callback;\n\n const loop = (timestamp: DOMHighResTimeStamp) => {\n const delta = timestamp - previousFrameTimestampRef.current;\n\n if (options?.delay && delta < options?.delay) {\n rafIdRef.current = window.requestAnimationFrame(loop);\n return;\n }\n\n previousFrameTimestampRef.current = timestamp;\n internalCallbackRef.current({ delta, timestamp });\n rafIdRef.current = window.requestAnimationFrame(loop);\n };\n\n const resume = () => {\n if (active) return;\n setActive(true);\n previousFrameTimestampRef.current = 0;\n rafIdRef.current = window.requestAnimationFrame(loop);\n };\n\n function pause() {\n if (!rafIdRef.current) return;\n\n setActive(false);\n window.cancelAnimationFrame(rafIdRef.current);\n rafIdRef.current = null;\n }\n\n useEffect(() => {\n if (!enabled) return;\n resume();\n\n return pause;\n }, [enabled, options?.delay]);\n\n return {\n active,\n pause,\n resume\n };\n};\n"],"names":["useRaf","callback","options","_options$enabled","rafIdRef","useRef","previousFrameTimestampRef","_useState","useState","_useState2","_slicedToArray","active","setActive","enabled","internalCallbackRef","current","loop","timestamp","delta","delay","window","requestAnimationFrame","resume","pause","cancelAnimationFrame","useEffect"],"mappings":";4HA4CO,IAAMA,EAAS,SAACC,EAA0BC,GAA0C,IAAAC,EACnFC,EAAWC,EAAsB,MACjCC,EAA4BD,EAAO,GACzCE,EAA4BC,GAAS,GAAMC,EAAAC,EAAAH,EAAA,GAApCI,EAAMF,EAAA,GAAEG,EAASH,EAAA,GAClBI,EAA0BV,QAAnBA,EAAGD,aAAO,EAAPA,EAASW,eAAOV,IAAAA,GAAAA,EAE1BW,EAAsBT,EAAOJ,GACnCa,EAAoBC,QAAUd,EAE9B,IAAMe,EAAO,SAAPA,EAAQC,GACZ,IAAMC,EAAQD,EAAYX,EAA0BS,QAEhDb,SAAAA,EAASiB,OAASD,GAAQhB,eAAAA,EAASiB,SAKvCb,EAA0BS,QAAUE,EACpCH,EAAoBC,QAAQ,CAAEG,MAAAA,EAAOD,UAAAA,KALnCb,EAASW,QAAUK,OAAOC,sBAAsBL,IAS9CM,EAAS,WACTX,IACJC,GAAU,GACVN,EAA0BS,QAAU,EACpCX,EAASW,QAAUK,OAAOC,sBAAsBL,KAGlD,SAASO,IACFnB,EAASW,UAEdH,GAAU,GACVQ,OAAOI,qBAAqBpB,EAASW,SACrCX,EAASW,QAAU,KACrB,CASA,OAPAU,GAAU,WACR,GAAKZ,EAGL,OAFAS,IAEOC,CACR,GAAE,CAACV,EAASX,aAAO,EAAPA,EAASiB,QAEf,CACLR,OAAAA,EACAY,MAAAA,EACAD,OAAAA,EAEJ"}
|
|
1
|
+
{"version":3,"file":"useRaf.js","sources":["../../../../src/hooks/useRaf/useRaf.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\r\n\r\n/* The use raf params type */\r\nexport interface UseRafParams {\r\n /** The delta between each frame in milliseconds */\r\n delta: number;\r\n /** The timestamp of the current frame in milliseconds */\r\n timestamp: DOMHighResTimeStamp;\r\n}\r\n\r\n/* The use raf type */\r\nexport type UseRafCallback = (params: UseRafParams) => void;\r\n\r\n/* The use raf options type */\r\nexport interface UseRafOptions {\r\n /** The delay between each frame in milliseconds */\r\n delay?: number;\r\n /** Whether the callback should be enabled */\r\n enabled?: boolean;\r\n}\r\n\r\n/* The use raf return type */\r\nexport interface UseRafReturn {\r\n /** Whether the callback is active */\r\n active: boolean;\r\n /** Function to pause the callback */\r\n pause: () => void;\r\n /** Function to resume the callback */\r\n resume: () => void;\r\n}\r\n\r\n/**\r\n * @name useRaf\r\n * @description - Hook that defines the logic for raf callback\r\n * @category Utilities\r\n *\r\n * @param {UseRafCallback} callback The callback to execute\r\n * @param {number} [options.delay] The delay between each frame in milliseconds\r\n * @param {boolean} [options.enabled=true] Whether the callback should be enabled\r\n * @returns {UseRafCallbackReturn} An object of raf callback functions\r\n *\r\n * @example\r\n * useRaf(() => console.log('callback'));\r\n */\r\nexport const useRaf = (callback: UseRafCallback, options?: UseRafOptions): UseRafReturn => {\r\n const rafIdRef = useRef<number | null>(null);\r\n const previousFrameTimestampRef = useRef(0);\r\n const [active, setActive] = useState(false);\r\n const enabled = options?.enabled ?? true;\r\n\r\n const internalCallbackRef = useRef(callback);\r\n internalCallbackRef.current = callback;\r\n\r\n const loop = (timestamp: DOMHighResTimeStamp) => {\r\n const delta = timestamp - previousFrameTimestampRef.current;\r\n\r\n if (options?.delay && delta < options?.delay) {\r\n rafIdRef.current = window.requestAnimationFrame(loop);\r\n return;\r\n }\r\n\r\n previousFrameTimestampRef.current = timestamp;\r\n internalCallbackRef.current({ delta, timestamp });\r\n rafIdRef.current = window.requestAnimationFrame(loop);\r\n };\r\n\r\n const resume = () => {\r\n if (active) return;\r\n setActive(true);\r\n previousFrameTimestampRef.current = 0;\r\n rafIdRef.current = window.requestAnimationFrame(loop);\r\n };\r\n\r\n function pause() {\r\n if (!rafIdRef.current) return;\r\n\r\n setActive(false);\r\n window.cancelAnimationFrame(rafIdRef.current);\r\n rafIdRef.current = null;\r\n }\r\n\r\n useEffect(() => {\r\n if (!enabled) return;\r\n resume();\r\n\r\n return pause;\r\n }, [enabled, options?.delay]);\r\n\r\n return {\r\n active,\r\n pause,\r\n resume\r\n };\r\n};\r\n"],"names":["useRaf","callback","options","_options$enabled","rafIdRef","useRef","previousFrameTimestampRef","_useState","useState","_useState2","_slicedToArray","active","setActive","enabled","internalCallbackRef","current","loop","timestamp","delta","delay","window","requestAnimationFrame","resume","pause","cancelAnimationFrame","useEffect"],"mappings":";4HA4CO,IAAMA,EAAS,SAACC,EAA0BC,GAA0C,IAAAC,EACnFC,EAAWC,EAAsB,MACjCC,EAA4BD,EAAO,GACzCE,EAA4BC,GAAS,GAAMC,EAAAC,EAAAH,EAAA,GAApCI,EAAMF,EAAA,GAAEG,EAASH,EAAA,GAClBI,EAA0BV,QAAnBA,EAAGD,aAAO,EAAPA,EAASW,eAAOV,IAAAA,GAAAA,EAE1BW,EAAsBT,EAAOJ,GACnCa,EAAoBC,QAAUd,EAE9B,IAAMe,EAAO,SAAPA,EAAQC,GACZ,IAAMC,EAAQD,EAAYX,EAA0BS,QAEhDb,SAAAA,EAASiB,OAASD,GAAQhB,eAAAA,EAASiB,SAKvCb,EAA0BS,QAAUE,EACpCH,EAAoBC,QAAQ,CAAEG,MAAAA,EAAOD,UAAAA,KALnCb,EAASW,QAAUK,OAAOC,sBAAsBL,IAS9CM,EAAS,WACTX,IACJC,GAAU,GACVN,EAA0BS,QAAU,EACpCX,EAASW,QAAUK,OAAOC,sBAAsBL,KAGlD,SAASO,IACFnB,EAASW,UAEdH,GAAU,GACVQ,OAAOI,qBAAqBpB,EAASW,SACrCX,EAASW,QAAU,KACrB,CASA,OAPAU,GAAU,WACR,GAAKZ,EAGL,OAFAS,IAEOC,CACR,GAAE,CAACV,EAASX,aAAO,EAAPA,EAASiB,QAEf,CACLR,OAAAA,EACAY,MAAAA,EACAD,OAAAA,EAEJ"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-MWjPFzDB.js";import{useRef as n,useState as t}from"react";import{useUnmount as e}from"../useUnmount/useUnmount.js";var o=function(o){var u=n(0),i=t(o),m=r(i,2),a=m[0],c=m[1];return e((function(){return cancelAnimationFrame(u.current)})),[a,function(r){cancelAnimationFrame(u.current),u.current=requestAnimationFrame((function(){return c(r)}))}]};export{o as useRafValue};
|
|
3
3
|
//# sourceMappingURL=useRafValue.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
2
|
import{useRef as r,useEffect as t}from"react";var n=function(){var n=r(0);return t((function(){n.current+=1})),n.current};export{n as useRenderCount};
|
|
3
3
|
//# sourceMappingURL=useRenderCount.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
2
|
import{useRef as e}from"react";var n=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Unknown",r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=e({component:n,renders:0,timestamp:Date.now(),sinceLast:0}),c=Date.now();return t.current.renders+=1,t.current.sinceLast=t.current.timestamp?c-t.current.timestamp:0,t.current.timestamp=c,r&&(console.group("".concat(n," info, render number: ").concat(t.current.renders)),console.log("Timestamp: ".concat(t.current.timestamp)),console.log("Since last render: ".concat(t.current.sinceLast)),console.log("Renders: ".concat(t.current.renders)),console.dir(t.current),console.groupEnd()),t.current};export{n as useRenderInfo};
|
|
3
3
|
//# sourceMappingURL=useRenderInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRenderInfo.js","sources":["../../../../src/hooks/useRenderInfo/useRenderInfo.ts"],"sourcesContent":["import { useRef } from 'react';\n\nexport interface UseRenderInfoReturn {\n component: string;\n renders: number;\n timestamp: null | number;\n sinceLast: number;\n}\n\n/**\n * @name useRenderInfo\n * @description - Hook for getting information about component rerender\n * @category Lifecycle\n *\n * @param {string} [name='Unknown'] Component name\n * @param {boolean} [log=true] Toggle logging\n * @returns {UseRenderInfoReturn} An object containing rerender information\n *\n * @example\n * const rerenderInfo = useRenderInfo('Component');\n */\nexport const useRenderInfo = (name: string = 'Unknown', log: boolean = true) => {\n const renderInfoRef = useRef<UseRenderInfoReturn>({\n component: name,\n renders: 0,\n timestamp: Date.now(),\n sinceLast: 0\n });\n const now = Date.now();\n\n renderInfoRef.current.renders += 1;\n renderInfoRef.current.sinceLast = renderInfoRef.current.timestamp\n ? now - renderInfoRef.current.timestamp\n : 0;\n renderInfoRef.current.timestamp = now;\n\n if (log) {\n console.group(`${name} info, render number: ${renderInfoRef.current.renders}`);\n console.log(`Timestamp: ${renderInfoRef.current.timestamp}`);\n console.log(`Since last render: ${renderInfoRef.current.sinceLast}`);\n console.log(`Renders: ${renderInfoRef.current.renders}`);\n console.dir(renderInfoRef.current);\n console.groupEnd();\n }\n\n return renderInfoRef.current;\n};\n"],"names":["useRenderInfo","name","arguments","length","undefined","log","renderInfoRef","useRef","component","renders","timestamp","Date","now","sinceLast","current","console","group","concat","dir","groupEnd"],"mappings":";mCAqBaA,EAAgB,WAAmD,IAAlDC,EAAYC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,UAAWG,IAAYH,UAAAC,OAAA,QAAAC,IAAAF,UAAA,KAAAA,UAAA,GAC5DI,EAAgBC,EAA4B,CAChDC,UAAWP,EACXQ,QAAS,EACTC,UAAWC,KAAKC,MAChBC,UAAW,IAEPD,EAAMD,KAAKC,MAiBjB,OAfAN,EAAcQ,QAAQL,SAAW,EACjCH,EAAcQ,QAAQD,UAAYP,EAAcQ,QAAQJ,UACpDE,EAAMN,EAAcQ,QAAQJ,UAC5B,EACJJ,EAAcQ,QAAQJ,UAAYE,EAE9BP,IACFU,QAAQC,MAAKC,GAAAA,OAAIhB,EAAI,0BAAAgB,OAAyBX,EAAcQ,QAAQL,UACpEM,QAAQV,IAAG,cAAAY,OAAeX,EAAcQ,QAAQJ,YAChDK,QAAQV,IAAG,sBAAAY,OAAuBX,EAAcQ,QAAQD,YACxDE,QAAQV,IAAG,YAAAY,OAAaX,EAAcQ,QAAQL,UAC9CM,QAAQG,IAAIZ,EAAcQ,SAC1BC,QAAQI,YAGHb,EAAcQ,OACvB"}
|
|
1
|
+
{"version":3,"file":"useRenderInfo.js","sources":["../../../../src/hooks/useRenderInfo/useRenderInfo.ts"],"sourcesContent":["import { useRef } from 'react';\r\n\r\nexport interface UseRenderInfoReturn {\r\n component: string;\r\n renders: number;\r\n timestamp: null | number;\r\n sinceLast: number;\r\n}\r\n\r\n/**\r\n * @name useRenderInfo\r\n * @description - Hook for getting information about component rerender\r\n * @category Lifecycle\r\n *\r\n * @param {string} [name='Unknown'] Component name\r\n * @param {boolean} [log=true] Toggle logging\r\n * @returns {UseRenderInfoReturn} An object containing rerender information\r\n *\r\n * @example\r\n * const rerenderInfo = useRenderInfo('Component');\r\n */\r\nexport const useRenderInfo = (name: string = 'Unknown', log: boolean = true) => {\r\n const renderInfoRef = useRef<UseRenderInfoReturn>({\r\n component: name,\r\n renders: 0,\r\n timestamp: Date.now(),\r\n sinceLast: 0\r\n });\r\n const now = Date.now();\r\n\r\n renderInfoRef.current.renders += 1;\r\n renderInfoRef.current.sinceLast = renderInfoRef.current.timestamp\r\n ? now - renderInfoRef.current.timestamp\r\n : 0;\r\n renderInfoRef.current.timestamp = now;\r\n\r\n if (log) {\r\n console.group(`${name} info, render number: ${renderInfoRef.current.renders}`);\r\n console.log(`Timestamp: ${renderInfoRef.current.timestamp}`);\r\n console.log(`Since last render: ${renderInfoRef.current.sinceLast}`);\r\n console.log(`Renders: ${renderInfoRef.current.renders}`);\r\n console.dir(renderInfoRef.current);\r\n console.groupEnd();\r\n }\r\n\r\n return renderInfoRef.current;\r\n};\r\n"],"names":["useRenderInfo","name","arguments","length","undefined","log","renderInfoRef","useRef","component","renders","timestamp","Date","now","sinceLast","current","console","group","concat","dir","groupEnd"],"mappings":";mCAqBaA,EAAgB,WAAmD,IAAlDC,EAAYC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,UAAWG,IAAYH,UAAAC,OAAA,QAAAC,IAAAF,UAAA,KAAAA,UAAA,GAC5DI,EAAgBC,EAA4B,CAChDC,UAAWP,EACXQ,QAAS,EACTC,UAAWC,KAAKC,MAChBC,UAAW,IAEPD,EAAMD,KAAKC,MAiBjB,OAfAN,EAAcQ,QAAQL,SAAW,EACjCH,EAAcQ,QAAQD,UAAYP,EAAcQ,QAAQJ,UACpDE,EAAMN,EAAcQ,QAAQJ,UAC5B,EACJJ,EAAcQ,QAAQJ,UAAYE,EAE9BP,IACFU,QAAQC,MAAKC,GAAAA,OAAIhB,EAAI,0BAAAgB,OAAyBX,EAAcQ,QAAQL,UACpEM,QAAQV,IAAG,cAAAY,OAAeX,EAAcQ,QAAQJ,YAChDK,QAAQV,IAAG,sBAAAY,OAAuBX,EAAcQ,QAAQD,YACxDE,QAAQV,IAAG,YAAAY,OAAaX,EAAcQ,QAAQL,UAC9CM,QAAQG,IAAIZ,EAAcQ,SAC1BC,QAAQI,YAGHb,EAAcQ,OACvB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-MWjPFzDB.js";import{useId as t,useState as o}from"react";var n=function(){var n=t(),a=o(n),e=r(a,2),i=e[0],u=e[1];return{id:i,update:function(){return u(Math.random().toString())}}};export{n as useRerender};
|
|
3
3
|
//# sourceMappingURL=useRerender.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{c as e,_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{c as e,_ as r}from"../../_rollupPluginBabelHelpers-MWjPFzDB.js";import{useState as n,useRef as i,useEffect as t}from"react";import{getElement as o}from"../../utils/helpers/getElement.js";import"../../utils/helpers/isClient.js";var l=function(){var l,u="object"!==e(arguments.length<=0?void 0:arguments[0])||"current"in(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,v=u?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],s=null===(l=null==v?void 0:v.enabled)||void 0===l||l,c=n([]),a=r(c,2),f=a[0],d=a[1],h=n(),g=r(h,2),p=g[0],b=g[1],m=i();return m.current=null==v?void 0:v.onChange,t((function(){if(s||u||p){if(Array.isArray(u)){if(!u.length)return;var e=new ResizeObserver((function(r){var n;d(r),null===(n=m.current)||void 0===n||n.call(m,r,e)}));return u.forEach((function(r){var n=o(r);n&&e.observe(n,v)})),function(){e.disconnect()}}var r=u?o(u):p;if(r){var n=new ResizeObserver((function(e){var r;d(e),null===(r=m.current)||void 0===r||r.call(m,e,n)}));return n.observe(r,v),function(){n.disconnect()}}}}),[p,u,null==v?void 0:v.box,s]),u?{entries:f}:{ref:b,entries:f}};export{l as useResizeObserver};
|
|
3
3
|
//# sourceMappingURL=useResizeObserver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResizeObserver.js","sources":["../../../../src/hooks/useResizeObserver/useResizeObserver.ts"],"sourcesContent":["import type { RefObject } from 'react';\nimport { useEffect, useRef, useState } from 'react';\n\nimport { getElement } from '@/utils/helpers';\n\n/** The resize observer target element type */\nexport type UseResizeObserverTarget =\n | RefObject<Element | null | undefined>\n | (() => Element)\n | Element;\n\n/** The resize observer options type */\nexport interface UseResizeObserverOptions extends ResizeObserverOptions {\n enabled?: boolean;\n onChange?: (entries: ResizeObserverEntry[], observer: ResizeObserver) => void;\n}\n\n/** The resize observer return type */\nexport interface UseResizeObserverReturn {\n entries: ResizeObserverEntry[];\n}\n\nexport interface UseResizeObserver {\n <Target extends UseResizeObserverTarget | UseResizeObserverTarget[]>(\n target: Target,\n options?: UseResizeObserverOptions\n ): UseResizeObserverReturn;\n\n <Target extends UseResizeObserverTarget | UseResizeObserverTarget[]>(\n options?: UseResizeObserverOptions,\n target?: never\n ): UseResizeObserverReturn & { ref: (node: Target) => void };\n}\n\n/**\n * @name useResizeObserver\n * @description - Hook that gives you resize observer state\n * @category Browser\n *\n * @overload\n * @template Target The target element\n * @param {boolean} [options.enabled=true] The IntersectionObserver options\n * @param {boolean} [options.box] The IntersectionObserver options\n * @param {(entries: ResizeObserverEntry[], observer: ResizeObserver) => void} [options.onChange] The callback to execute when resize is detected\n * @returns {UseResizeObserverReturn & { ref: (node: Target) => void }} An object containing the resize observer state\n *\n * @example\n * const { ref, entries } = useResizeObserver();\n *\n * @overload\n * @template Target The target element\n * @param {Target} target The target element to observe\n * @param {boolean} [options.enabled=true] The IntersectionObserver options\n * @param {boolean} [options.box] The IntersectionObserver options\n * @param {(entries: ResizeObserverEntry[], observer: ResizeObserver) => void} [options.onChange] The callback to execute when resize is detected\n * @returns {UseResizeObserverReturn} An object containing the resize observer state\n *\n * @example\n * const { entries } = useResizeObserver(ref);\n */\nexport const useResizeObserver = ((...params: any[]) => {\n const target = (\n typeof params[0] === 'object' && !('current' in params[0]) ? undefined : params[0]\n ) as UseResizeObserverTarget | UseResizeObserverTarget[] | undefined;\n const options = (target ? params[1] : params[0]) as UseResizeObserverOptions | undefined;\n const enabled = options?.enabled ?? true;\n\n const [entries, setEntries] = useState<ResizeObserverEntry[]>([]);\n\n const [internalRef, setInternalRef] = useState<Element>();\n const internalOnChangeRef = useRef<UseResizeObserverOptions['onChange']>();\n internalOnChangeRef.current = options?.onChange;\n\n useEffect(() => {\n if (!enabled && !target && !internalRef) return;\n\n if (Array.isArray(target)) {\n if (!target.length) return;\n const observer = new ResizeObserver((entries) => {\n setEntries(entries);\n internalOnChangeRef.current?.(entries, observer);\n });\n\n target.forEach((target) => {\n const element = getElement(target);\n if (!element) return;\n observer.observe(element as Element, options);\n });\n\n return () => {\n observer.disconnect();\n };\n }\n\n const element = target ? getElement(target) : internalRef;\n if (!element) return;\n\n const observer = new ResizeObserver((entries) => {\n setEntries(entries);\n internalOnChangeRef.current?.(entries, observer);\n });\n observer.observe(element as Element, options);\n\n return () => {\n observer.disconnect();\n };\n }, [internalRef, target, options?.box, enabled]);\n\n if (target) return { entries };\n return {\n ref: setInternalRef,\n entries\n };\n}) as UseResizeObserver;\n"],"names":["useResizeObserver","_options$enabled","target","_typeof","arguments","length","undefined","options","enabled","_useState","useState","_useState2","_slicedToArray","entries","setEntries","_useState3","_useState4","internalRef","setInternalRef","internalOnChangeRef","useRef","current","onChange","useEffect","Array","isArray","observer","ResizeObserver","_internalOnChangeRef$","call","forEach","element","getElement","observe","disconnect","_internalOnChangeRef$2","box","ref"],"mappings":";8OA4DaA,EAAqB,WAAsB,IAAAC,EAChDC,EACiB,WAArBC,EAAAC,UAAAC,QAAA,OAAAC,EAAAF,UAAqB,KAAc,YAASA,UAAAC,eAAAC,EAAAF,UAAA,IAA0BA,UAAAC,QAAA,OAAAC,EAAAF,UACJ,QADLE,EAEzDC,EAAWL,EAAME,UAAAC,QAAAC,OAAAA,EAAAF,UAAA,GAAAA,UAAAC,eAAAC,EAAAF,UAAiE,GAClFI,EAA0BP,QAAnBA,EAAGM,aAAO,EAAPA,EAASC,eAAOP,IAAAA,GAAAA,EAEhCQ,EAA8BC,EAAgC,IAAGC,EAAAC,EAAAH,EAAA,GAA1DI,EAAOF,EAAA,GAAEG,EAAUH,EAAA,GAE1BI,EAAsCL,IAAmBM,EAAAJ,EAAAG,EAAA,GAAlDE,EAAWD,EAAA,GAAEE,EAAcF,EAAA,GAC5BG,EAAsBC,IAsC5B,OArCAD,EAAoBE,QAAUd,aAAO,EAAPA,EAASe,SAEvCC,GAAU,WACR,GAAKf,GAAYN,GAAWe,EAA5B,CAEA,GAAIO,MAAMC,QAAQvB,GAAS,CACzB,IAAKA,EAAOG,OAAQ,OACpB,IAAMqB,EAAW,IAAIC,gBAAe,SAACd,GAAY,IAAAe,EAC/Cd,EAAWD,WACXe,EAAAT,EAAoBE,eAAO,IAAAO,GAA3BA,EAAAC,KAAAV,EAA8BN,EAASa,EACzC,IAQA,OANAxB,EAAO4B,SAAQ,SAAC5B,GACd,IAAM6B,EAAUC,EAAW9B,GACtB6B,GACLL,EAASO,QAAQF,EAAoBxB,EACvC,IAEO,WACLmB,EAASQ,aAEb,CAEA,IAAMH,EAAU7B,EAAS8B,EAAW9B,GAAUe,EAC9C,GAAKc,EAAL,CAEA,IAAML,EAAW,IAAIC,gBAAe,SAACd,GAAY,IAAAsB,EAC/CrB,EAAWD,WACXsB,EAAAhB,EAAoBE,eAAO,IAAAc,GAA3BA,EAAAN,KAAAV,EAA8BN,EAASa,EACzC,IAGA,OAFAA,EAASO,QAAQF,EAAoBxB,GAE9B,WACLmB,EAASQ,aATG,CArB2B,CAgC1C,GAAE,CAACjB,EAAaf,EAAQK,aAAO,EAAPA,EAAS6B,IAAK5B,IAEnCN,EAAe,CAAEW,QAAAA,GACd,CACLwB,IAAKnB,EACLL,QAAAA,EAEJ"}
|
|
1
|
+
{"version":3,"file":"useResizeObserver.js","sources":["../../../../src/hooks/useResizeObserver/useResizeObserver.ts"],"sourcesContent":["import type { RefObject } from 'react';\r\nimport { useEffect, useRef, useState } from 'react';\r\n\r\nimport { getElement } from '@/utils/helpers';\r\n\r\n/** The resize observer target element type */\r\nexport type UseResizeObserverTarget =\r\n | RefObject<Element | null | undefined>\r\n | (() => Element)\r\n | Element;\r\n\r\n/** The resize observer options type */\r\nexport interface UseResizeObserverOptions extends ResizeObserverOptions {\r\n enabled?: boolean;\r\n onChange?: (entries: ResizeObserverEntry[], observer: ResizeObserver) => void;\r\n}\r\n\r\n/** The resize observer return type */\r\nexport interface UseResizeObserverReturn {\r\n entries: ResizeObserverEntry[];\r\n}\r\n\r\nexport interface UseResizeObserver {\r\n <Target extends UseResizeObserverTarget | UseResizeObserverTarget[]>(\r\n target: Target,\r\n options?: UseResizeObserverOptions\r\n ): UseResizeObserverReturn;\r\n\r\n <Target extends UseResizeObserverTarget | UseResizeObserverTarget[]>(\r\n options?: UseResizeObserverOptions,\r\n target?: never\r\n ): UseResizeObserverReturn & { ref: (node: Target) => void };\r\n}\r\n\r\n/**\r\n * @name useResizeObserver\r\n * @description - Hook that gives you resize observer state\r\n * @category Browser\r\n *\r\n * @overload\r\n * @template Target The target element\r\n * @param {boolean} [options.enabled=true] The IntersectionObserver options\r\n * @param {boolean} [options.box] The IntersectionObserver options\r\n * @param {(entries: ResizeObserverEntry[], observer: ResizeObserver) => void} [options.onChange] The callback to execute when resize is detected\r\n * @returns {UseResizeObserverReturn & { ref: (node: Target) => void }} An object containing the resize observer state\r\n *\r\n * @example\r\n * const { ref, entries } = useResizeObserver();\r\n *\r\n * @overload\r\n * @template Target The target element\r\n * @param {Target} target The target element to observe\r\n * @param {boolean} [options.enabled=true] The IntersectionObserver options\r\n * @param {boolean} [options.box] The IntersectionObserver options\r\n * @param {(entries: ResizeObserverEntry[], observer: ResizeObserver) => void} [options.onChange] The callback to execute when resize is detected\r\n * @returns {UseResizeObserverReturn} An object containing the resize observer state\r\n *\r\n * @example\r\n * const { entries } = useResizeObserver(ref);\r\n */\r\nexport const useResizeObserver = ((...params: any[]) => {\r\n const target = (\r\n typeof params[0] === 'object' && !('current' in params[0]) ? undefined : params[0]\r\n ) as UseResizeObserverTarget | UseResizeObserverTarget[] | undefined;\r\n const options = (target ? params[1] : params[0]) as UseResizeObserverOptions | undefined;\r\n const enabled = options?.enabled ?? true;\r\n\r\n const [entries, setEntries] = useState<ResizeObserverEntry[]>([]);\r\n\r\n const [internalRef, setInternalRef] = useState<Element>();\r\n const internalOnChangeRef = useRef<UseResizeObserverOptions['onChange']>();\r\n internalOnChangeRef.current = options?.onChange;\r\n\r\n useEffect(() => {\r\n if (!enabled && !target && !internalRef) return;\r\n\r\n if (Array.isArray(target)) {\r\n if (!target.length) return;\r\n const observer = new ResizeObserver((entries) => {\r\n setEntries(entries);\r\n internalOnChangeRef.current?.(entries, observer);\r\n });\r\n\r\n target.forEach((target) => {\r\n const element = getElement(target);\r\n if (!element) return;\r\n observer.observe(element as Element, options);\r\n });\r\n\r\n return () => {\r\n observer.disconnect();\r\n };\r\n }\r\n\r\n const element = target ? getElement(target) : internalRef;\r\n if (!element) return;\r\n\r\n const observer = new ResizeObserver((entries) => {\r\n setEntries(entries);\r\n internalOnChangeRef.current?.(entries, observer);\r\n });\r\n observer.observe(element as Element, options);\r\n\r\n return () => {\r\n observer.disconnect();\r\n };\r\n }, [internalRef, target, options?.box, enabled]);\r\n\r\n if (target) return { entries };\r\n return {\r\n ref: setInternalRef,\r\n entries\r\n };\r\n}) as UseResizeObserver;\r\n"],"names":["useResizeObserver","_options$enabled","target","_typeof","arguments","length","undefined","options","enabled","_useState","useState","_useState2","_slicedToArray","entries","setEntries","_useState3","_useState4","internalRef","setInternalRef","internalOnChangeRef","useRef","current","onChange","useEffect","Array","isArray","observer","ResizeObserver","_internalOnChangeRef$","call","forEach","element","getElement","observe","disconnect","_internalOnChangeRef$2","box","ref"],"mappings":";8OA4DaA,EAAqB,WAAsB,IAAAC,EAChDC,EACiB,WAArBC,EAAAC,UAAAC,QAAA,OAAAC,EAAAF,UAAqB,KAAc,YAASA,UAAAC,eAAAC,EAAAF,UAAA,IAA0BA,UAAAC,QAAA,OAAAC,EAAAF,UACJ,QADLE,EAEzDC,EAAWL,EAAME,UAAAC,QAAAC,OAAAA,EAAAF,UAAA,GAAAA,UAAAC,eAAAC,EAAAF,UAAiE,GAClFI,EAA0BP,QAAnBA,EAAGM,aAAO,EAAPA,EAASC,eAAOP,IAAAA,GAAAA,EAEhCQ,EAA8BC,EAAgC,IAAGC,EAAAC,EAAAH,EAAA,GAA1DI,EAAOF,EAAA,GAAEG,EAAUH,EAAA,GAE1BI,EAAsCL,IAAmBM,EAAAJ,EAAAG,EAAA,GAAlDE,EAAWD,EAAA,GAAEE,EAAcF,EAAA,GAC5BG,EAAsBC,IAsC5B,OArCAD,EAAoBE,QAAUd,aAAO,EAAPA,EAASe,SAEvCC,GAAU,WACR,GAAKf,GAAYN,GAAWe,EAA5B,CAEA,GAAIO,MAAMC,QAAQvB,GAAS,CACzB,IAAKA,EAAOG,OAAQ,OACpB,IAAMqB,EAAW,IAAIC,gBAAe,SAACd,GAAY,IAAAe,EAC/Cd,EAAWD,WACXe,EAAAT,EAAoBE,eAAO,IAAAO,GAA3BA,EAAAC,KAAAV,EAA8BN,EAASa,EACzC,IAQA,OANAxB,EAAO4B,SAAQ,SAAC5B,GACd,IAAM6B,EAAUC,EAAW9B,GACtB6B,GACLL,EAASO,QAAQF,EAAoBxB,EACvC,IAEO,WACLmB,EAASQ,aAEb,CAEA,IAAMH,EAAU7B,EAAS8B,EAAW9B,GAAUe,EAC9C,GAAKc,EAAL,CAEA,IAAML,EAAW,IAAIC,gBAAe,SAACd,GAAY,IAAAsB,EAC/CrB,EAAWD,WACXsB,EAAAhB,EAAoBE,eAAO,IAAAc,GAA3BA,EAAAN,KAAAV,EAA8BN,EAASa,EACzC,IAGA,OAFAA,EAASO,QAAQF,EAAoBxB,GAE9B,WACLmB,EAASQ,aATG,CArB2B,CAgC1C,GAAE,CAACjB,EAAaf,EAAQK,aAAO,EAAPA,EAAS6B,IAAK5B,IAEnCN,EAAe,CAAEW,QAAAA,GACd,CACLwB,IAAKnB,EACLL,QAAAA,EAEJ"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{_ as n}from"../../_rollupPluginBabelHelpers-MWjPFzDB.js";import{useState as o,useEffect as e}from"react";var i=function(){var i=window&&"screen"in window&&"orientation"in window.screen,t=i?window.screen.orientation:{},r=o((function(){var n;return{angle:null!==(n=null==t?void 0:t.angle)&&void 0!==n?n:0,orientationType:null==t?void 0:t.type}})),u=n(r,2),l=u[0],a=u[1];e((function(){if(i){var n=function(){return a({angle:t.angle,orientationType:t.type})};return window.addEventListener("orientationchange",n),function(){window.removeEventListener("orientationchange",n)}}}));return{supported:i,value:l,lock:function(n){if(i&&"function"==typeof t.lock)return t.lock(n)},unlock:function(){i&&"function"==typeof t.unlock&&t.unlock()}}};export{i as useScreenOrientation};
|
|
3
3
|
//# sourceMappingURL=useScreenOrientation.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-MWjPFzDB.js";import{useState as t,useEffect as e}from"react";var n="script-status",o=function(o){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=t((function(){var r=document.querySelector('script[src="'.concat(o,'"]')),t=null==r?void 0:r.getAttribute(n);return t||(r?"unknown":"loading")})),c=r(u,2),a=c[0],s=c[1],d=i.removeOnUnmount,v=void 0===d||d,l=i.async,m=void 0===l||l;return e((function(){var t=document.querySelector('script[src="'.concat(o,'"]')),e=null==t?void 0:t.getAttribute(n);if(e)return s(e);if(t)return s("unknown");var u=document.createElement("script");u.src=o,u.async=m;for(var c=0,a=Object.entries(i);c<a.length;c++){var d=r(a[c],2),l=d[0],f=d[1];u.setAttribute(l,String(f))}u.setAttribute(n,"loading"),document.body.appendChild(u);var p=function(){u.setAttribute(n,"ready"),s("ready")},b=function(){u.setAttribute(n,"error"),s("error")};return u.addEventListener("load",p),u.addEventListener("error",b),function(){v&&u.remove(),u.removeEventListener("load",p),u.removeEventListener("error",b)}}),[o,v]),a};export{n as SCRIPT_STATUS_ATTRIBUTE_NAME,o as useScript};
|
|
3
3
|
//# sourceMappingURL=useScript.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScript.js","sources":["../../../../src/hooks/useScript/useScript.ts"],"sourcesContent":["import type { ComponentProps } from 'react';\nimport { useEffect, useState } from 'react';\n\n/** The use script status */\nexport type UseScriptStatus = 'loading' | 'ready' | 'error' | 'unknown';\nexport const SCRIPT_STATUS_ATTRIBUTE_NAME = 'script-status';\n\n/** The use script options extends from attributes script tag */\nexport interface UseScriptOptions extends ComponentProps<'script'> {\n /** Whether to remove the script on unmount */\n removeOnUnmount?: boolean;\n}\n\n/**\n * @name useScript\n * @description - Hook that manages a script with onLoad, onError, and removeOnUnmount functionalities\n * @category Browser\n *\n * @param {string} src The source of the script\n * @param {UseScriptOptions} [options] The options of the script extends from attributes script tag\n * @param {boolean} [options.removeOnUnmount=true] Whether to remove the script on unmount\n * @param {boolean} [options.async=true] Whether to load the script asynchronously\n * @returns {UseScriptStatus} The status of the script\n *\n * @example\n * const status = useScript('https://example.com/script.js');\n */\nexport const useScript = (src: string, options: UseScriptOptions = {}) => {\n const [status, setStatus] = useState<UseScriptStatus>(() => {\n const script = document.querySelector(`script[src=\"${src}\"]`) as HTMLScriptElement;\n const scriptStatus = script?.getAttribute(SCRIPT_STATUS_ATTRIBUTE_NAME) as UseScriptStatus;\n if (scriptStatus) return scriptStatus;\n if (script) return 'unknown';\n\n return 'loading';\n });\n const { removeOnUnmount = true, async = true } = options;\n\n useEffect(() => {\n const existedScript = document.querySelector(`script[src=\"${src}\"]`) as HTMLScriptElement;\n const scriptStatus = existedScript?.getAttribute(\n SCRIPT_STATUS_ATTRIBUTE_NAME\n ) as UseScriptStatus;\n if (scriptStatus) return setStatus(scriptStatus);\n if (existedScript) return setStatus('unknown');\n\n const script = document.createElement('script');\n script.src = src;\n script.async = async;\n\n for (const [key, value] of Object.entries(options)) {\n script.setAttribute(key, String(value));\n }\n\n script.setAttribute(SCRIPT_STATUS_ATTRIBUTE_NAME, 'loading');\n document.body.appendChild(script);\n\n const onLoad = () => {\n script.setAttribute(SCRIPT_STATUS_ATTRIBUTE_NAME, 'ready');\n setStatus('ready');\n };\n\n const onError = () => {\n script.setAttribute(SCRIPT_STATUS_ATTRIBUTE_NAME, 'error');\n setStatus('error');\n };\n\n script.addEventListener('load', onLoad);\n script.addEventListener('error', onError);\n\n return () => {\n if (removeOnUnmount) script.remove();\n script.removeEventListener('load', onLoad);\n script.removeEventListener('error', onError);\n };\n }, [src, removeOnUnmount]);\n\n return status;\n};\n"],"names":["SCRIPT_STATUS_ATTRIBUTE_NAME","useScript","src","options","arguments","length","undefined","_useState","useState","script","document","querySelector","concat","scriptStatus","getAttribute","_useState2","_slicedToArray","status","setStatus","_options$removeOnUnmo","removeOnUnmount","_options$async","async","useEffect","existedScript","createElement","_i","_Object$entries","Object","entries","_Object$entries$_i","key","value","setAttribute","String","body","appendChild","onLoad","onError","addEventListener","remove","removeEventListener"],"mappings":";gHAKO,IAAMA,EAA+B,gBAsB/BC,EAAY,SAACC,GAAgD,IAAnCC,EAAyBC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,CAAA,EACjEG,EAA4BC,GAA0B,WACpD,IAAMC,EAASC,SAASC,6BAAaC,OAAgBV,EAAG,OAClDW,EAAeJ,aAAAA,EAAAA,EAAQK,aAAad,GAC1C,OAAIa,IACAJ,EAAe,UAEZ,UACT,IAAEM,EAAAC,EAAAT,EAAA,GAPKU,EAAMF,EAAA,GAAEG,EAASH,EAAA,GAQxBI,EAAiDhB,EAAzCiB,gBAAAA,OAAkB,IAAHD,GAAOA,EAAAE,EAAmBlB,EAAjBmB,MAAAA,OAAQ,IAAHD,GAAOA,EAyC5C,OAvCAE,GAAU,WACR,IAAMC,EAAgBd,SAASC,6BAAaC,OAAgBV,EAAG,OACzDW,EAAeW,aAAAA,EAAAA,EAAeV,aAClCd,GAEF,GAAIa,EAAc,OAAOK,EAAUL,GACnC,GAAIW,EAAe,OAAON,EAAU,WAEpC,IAAMT,EAASC,SAASe,cAAc,UACtChB,EAAOP,IAAMA,EACbO,EAAOa,MAAQA,EAEf,IAAA,IAAAI,EAAAC,EAAAA,EAA2BC,OAAOC,QAAQ1B,GAAQuB,EAAAC,EAAAtB,OAAAqB,IAAE,CAA/C,IAAAI,EAAAd,EAAAW,EAAAD,GAAA,GAAOK,EAAGD,EAAA,GAAEE,EAAKF,EAAA,GACpBrB,EAAOwB,aAAaF,EAAKG,OAAOF,GAClC,CAEAvB,EAAOwB,aAAajC,EAA8B,WAClDU,SAASyB,KAAKC,YAAY3B,GAE1B,IAAM4B,EAAS,WACb5B,EAAOwB,aAAajC,EAA8B,SAClDkB,EAAU,UAGNoB,EAAU,WACd7B,EAAOwB,aAAajC,EAA8B,SAClDkB,EAAU,UAMZ,OAHAT,EAAO8B,iBAAiB,OAAQF,GAChC5B,EAAO8B,iBAAiB,QAASD,GAE1B,WACDlB,GAAiBX,EAAO+B,SAC5B/B,EAAOgC,oBAAoB,OAAQJ,GACnC5B,EAAOgC,oBAAoB,QAASH,GAExC,GAAG,CAACpC,EAAKkB,IAEFH,CACT"}
|
|
1
|
+
{"version":3,"file":"useScript.js","sources":["../../../../src/hooks/useScript/useScript.ts"],"sourcesContent":["import type { ComponentProps } from 'react';\r\nimport { useEffect, useState } from 'react';\r\n\r\n/** The use script status */\r\nexport type UseScriptStatus = 'loading' | 'ready' | 'error' | 'unknown';\r\nexport const SCRIPT_STATUS_ATTRIBUTE_NAME = 'script-status';\r\n\r\n/** The use script options extends from attributes script tag */\r\nexport interface UseScriptOptions extends ComponentProps<'script'> {\r\n /** Whether to remove the script on unmount */\r\n removeOnUnmount?: boolean;\r\n}\r\n\r\n/**\r\n * @name useScript\r\n * @description - Hook that manages a script with onLoad, onError, and removeOnUnmount functionalities\r\n * @category Browser\r\n *\r\n * @param {string} src The source of the script\r\n * @param {UseScriptOptions} [options] The options of the script extends from attributes script tag\r\n * @param {boolean} [options.removeOnUnmount=true] Whether to remove the script on unmount\r\n * @param {boolean} [options.async=true] Whether to load the script asynchronously\r\n * @returns {UseScriptStatus} The status of the script\r\n *\r\n * @example\r\n * const status = useScript('https://example.com/script.js');\r\n */\r\nexport const useScript = (src: string, options: UseScriptOptions = {}) => {\r\n const [status, setStatus] = useState<UseScriptStatus>(() => {\r\n const script = document.querySelector(`script[src=\"${src}\"]`) as HTMLScriptElement;\r\n const scriptStatus = script?.getAttribute(SCRIPT_STATUS_ATTRIBUTE_NAME) as UseScriptStatus;\r\n if (scriptStatus) return scriptStatus;\r\n if (script) return 'unknown';\r\n\r\n return 'loading';\r\n });\r\n const { removeOnUnmount = true, async = true } = options;\r\n\r\n useEffect(() => {\r\n const existedScript = document.querySelector(`script[src=\"${src}\"]`) as HTMLScriptElement;\r\n const scriptStatus = existedScript?.getAttribute(\r\n SCRIPT_STATUS_ATTRIBUTE_NAME\r\n ) as UseScriptStatus;\r\n if (scriptStatus) return setStatus(scriptStatus);\r\n if (existedScript) return setStatus('unknown');\r\n\r\n const script = document.createElement('script');\r\n script.src = src;\r\n script.async = async;\r\n\r\n for (const [key, value] of Object.entries(options)) {\r\n script.setAttribute(key, String(value));\r\n }\r\n\r\n script.setAttribute(SCRIPT_STATUS_ATTRIBUTE_NAME, 'loading');\r\n document.body.appendChild(script);\r\n\r\n const onLoad = () => {\r\n script.setAttribute(SCRIPT_STATUS_ATTRIBUTE_NAME, 'ready');\r\n setStatus('ready');\r\n };\r\n\r\n const onError = () => {\r\n script.setAttribute(SCRIPT_STATUS_ATTRIBUTE_NAME, 'error');\r\n setStatus('error');\r\n };\r\n\r\n script.addEventListener('load', onLoad);\r\n script.addEventListener('error', onError);\r\n\r\n return () => {\r\n if (removeOnUnmount) script.remove();\r\n script.removeEventListener('load', onLoad);\r\n script.removeEventListener('error', onError);\r\n };\r\n }, [src, removeOnUnmount]);\r\n\r\n return status;\r\n};\r\n"],"names":["SCRIPT_STATUS_ATTRIBUTE_NAME","useScript","src","options","arguments","length","undefined","_useState","useState","script","document","querySelector","concat","scriptStatus","getAttribute","_useState2","_slicedToArray","status","setStatus","_options$removeOnUnmo","removeOnUnmount","_options$async","async","useEffect","existedScript","createElement","_i","_Object$entries","Object","entries","_Object$entries$_i","key","value","setAttribute","String","body","appendChild","onLoad","onError","addEventListener","remove","removeEventListener"],"mappings":";gHAKO,IAAMA,EAA+B,gBAsB/BC,EAAY,SAACC,GAAgD,IAAnCC,EAAyBC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,CAAA,EACjEG,EAA4BC,GAA0B,WACpD,IAAMC,EAASC,SAASC,6BAAaC,OAAgBV,EAAG,OAClDW,EAAeJ,aAAAA,EAAAA,EAAQK,aAAad,GAC1C,OAAIa,IACAJ,EAAe,UAEZ,UACT,IAAEM,EAAAC,EAAAT,EAAA,GAPKU,EAAMF,EAAA,GAAEG,EAASH,EAAA,GAQxBI,EAAiDhB,EAAzCiB,gBAAAA,OAAkB,IAAHD,GAAOA,EAAAE,EAAmBlB,EAAjBmB,MAAAA,OAAQ,IAAHD,GAAOA,EAyC5C,OAvCAE,GAAU,WACR,IAAMC,EAAgBd,SAASC,6BAAaC,OAAgBV,EAAG,OACzDW,EAAeW,aAAAA,EAAAA,EAAeV,aAClCd,GAEF,GAAIa,EAAc,OAAOK,EAAUL,GACnC,GAAIW,EAAe,OAAON,EAAU,WAEpC,IAAMT,EAASC,SAASe,cAAc,UACtChB,EAAOP,IAAMA,EACbO,EAAOa,MAAQA,EAEf,IAAA,IAAAI,EAAAC,EAAAA,EAA2BC,OAAOC,QAAQ1B,GAAQuB,EAAAC,EAAAtB,OAAAqB,IAAE,CAA/C,IAAAI,EAAAd,EAAAW,EAAAD,GAAA,GAAOK,EAAGD,EAAA,GAAEE,EAAKF,EAAA,GACpBrB,EAAOwB,aAAaF,EAAKG,OAAOF,GAClC,CAEAvB,EAAOwB,aAAajC,EAA8B,WAClDU,SAASyB,KAAKC,YAAY3B,GAE1B,IAAM4B,EAAS,WACb5B,EAAOwB,aAAajC,EAA8B,SAClDkB,EAAU,UAGNoB,EAAU,WACd7B,EAAOwB,aAAajC,EAA8B,SAClDkB,EAAU,UAMZ,OAHAT,EAAO8B,iBAAiB,OAAQF,GAChC5B,EAAO8B,iBAAiB,QAASD,GAE1B,WACDlB,GAAiBX,EAAO+B,SAC5B/B,EAAOgC,oBAAoB,OAAQJ,GACnC5B,EAAOgC,oBAAoB,QAASH,GAExC,GAAG,CAACpC,EAAKkB,IAEFH,CACT"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{b as o}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{b as o}from"../../_rollupPluginBabelHelpers-MWjPFzDB.js";import{useStorage as e}from"../useStorage/useStorage.js";import"react";import"../../utils/helpers/isClient.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var r=function(r,t,s){return e(r,o({initialValue:t,storage:window.sessionStorage},s))};export{r as useSessionStorage};
|
|
3
3
|
//# sourceMappingURL=useSessionStorage.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-MWjPFzDB.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.
|
|
2
|
-
import{d as r,e as a,b as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{d as r,e as a,b as e}from"../../_rollupPluginBabelHelpers-MWjPFzDB.js";var n=function(n){var t=navigator&&"share"in navigator,s=function(){var s=r(a().mark((function r(s){var i;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(t){r.next=2;break}return r.abrupt("return");case 2:return(i=e(e({},n),s)).files&&navigator.canShare({files:i.files})&&navigator.share(i),r.abrupt("return",navigator.share(i));case 5:case"end":return r.stop()}}),r)})));return function(r){return s.apply(this,arguments)}}();return{share:s,supported:t}};export{n as useShare};
|
|
3
3
|
//# sourceMappingURL=useShare.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{c as t,_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{c as t,_ as r}from"../../_rollupPluginBabelHelpers-MWjPFzDB.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,m=f===u;return{counts:u,currentStep:f,isFirst:p,isLast:m,next:function(){m||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
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as n,b as t}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{_ as n,b as t}from"../../_rollupPluginBabelHelpers-MWjPFzDB.js";import{useState as r,useEffect as o}from"react";import"../../utils/helpers/isClient.js";import{useEvent as e}from"../useEvent/useEvent.js";import"../../index-aT3H0Ni8.js";import"react-dom";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}},s=function(){for(var s,i,c=arguments.length,a=new Array(c),l=0;l<c;l++)a[l]=arguments[l];var f=null!==(s="number"==typeof a[0]?a[0]:null===(i=a[0])||void 0===i?void 0:i.initialTime)&&void 0!==s?s:0,d="number"==typeof a[0]?a[1]:a[0],m=r(u(f)),p=n(m,2),v=p[0],h=p[1],y=r(!(null!=d&&d.enabled)),b=n(y,2),g=b[0],j=b[1],M=e((function(){var n=v.count+1;return n%60==0?h(t(t({},v),{},{minutes:v.minutes+1,seconds:0,count:n})):n%3600==0?h(t(t({},v),{},{hours:v.hours+1,minutes:0,seconds:0,count:n})):n%86400==0?h(t(t({},v),{},{days:v.days+1,hours:0,minutes:0,seconds:0,count:n})):void h(t(t({},v),{},{seconds:v.seconds+1,count:n}))}));return o((function(){if(!g){var n=setInterval((function(){return M()}),1e3);return function(){return clearInterval(n)}}}),[g]),t(t({},v),{},{paused:g,pause:function(){return j(!0)},start:function(){return j(!1)},reset:function(){return h(u(f))},toggle:function(){return j((function(n){return!n}))}})};export{s as useStopwatch};
|
|
3
3
|
//# sourceMappingURL=useStopwatch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStopwatch.js","sources":["../../../../src/hooks/useStopwatch/useStopwatch.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { useEvent } from '@/hooks';\n\nconst getStopwatchTime = (time: number) => {\n if (!time)\n return {\n days: 0,\n hours: 0,\n minutes: 0,\n seconds: 0,\n count: 0\n };\n\n const days = Math.floor(time / 86400);\n const hours = Math.floor((time % 86400) / 3600);\n const minutes = Math.floor((time % 3600) / 60);\n const seconds = Math.floor(time % 60);\n\n return { days, hours, minutes, seconds, count: time };\n};\n\n/** The use stopwatch return type */\nexport interface UseStopwatchReturn {\n /** The paused state of the stopwatch */\n paused: boolean;\n /** The over state of the stopwatch */\n over: boolean;\n /** The day count of the stopwatch */\n days: number;\n /** The hour count of the stopwatch */\n hours: number;\n /** The minute count of the stopwatch */\n minutes: number;\n /** The second count of the stopwatch */\n seconds: number;\n /** The total count of the stopwatch */\n count: number;\n /** The function to pause the stopwatch */\n pause: () => void;\n /** The function to start the stopwatch */\n start: () => void;\n /** The function to reset the stopwatch */\n reset: () => void;\n /** The function to toggle the stopwatch */\n toggle: () => void;\n}\n\n/** The use stopwatch options */\nexport interface UseStopwatchOptions {\n /** The enabled state of the timer */\n enabled?: boolean;\n}\n\ninterface UseStopwatch {\n (initialTime?: number, options?: UseStopwatchOptions): UseStopwatchReturn;\n (options?: UseStopwatchOptions & { initialTime?: number }): UseStopwatchReturn;\n}\n/**\n * @name useStopwatch\n * @description - Hook that creates a stopwatch functionality\n * @category Time\n *\n * @overload\n * @param {number} [initialTime=0] The initial time of the timer\n * @param {boolean} [options.enabled=true] The enabled state of the timer\n * @returns {UseStopwatchReturn} An object containing the current time and functions to interact with the timer\n *\n * @example\n * const { seconds, minutes, start, pause, reset } = useStopwatch(1000, { enabled: false });\n *\n * @overload\n * @param {number} [options.initialTime=0] -The initial time of the timer\n * @param {boolean} [options.enabled=true] The enabled state of the timer\n * @returns {UseStopwatchReturn} An object containing the current time and functions to interact with the timer\n *\n * @example\n * const { seconds, minutes, start, pause, reset } = useStopwatch({ initialTime: 1000, enabled: false });\n */\nexport const useStopwatch = ((...params: any[]) => {\n const initialTime =\n (typeof params[0] === 'number'\n ? (params[0] as number | undefined)\n : (params[0] as UseStopwatchOptions & { initialTime?: number })?.initialTime) ?? 0;\n\n const options =\n typeof params[0] === 'number'\n ? (params[1] as UseStopwatchOptions | undefined)\n : (params[0] as (UseStopwatchOptions & { initialTime?: number }) | undefined);\n\n const [time, setTime] = useState(getStopwatchTime(initialTime));\n const [paused, setPaused] = useState(!options?.enabled);\n\n const onInterval = useEvent(() => {\n const updatedCount = time.count + 1;\n\n if (updatedCount % 60 === 0) {\n return setTime({\n ...time,\n minutes: time.minutes + 1,\n seconds: 0,\n count: updatedCount\n });\n }\n\n if (updatedCount % (60 * 60) === 0) {\n return setTime({\n ...time,\n hours: time.hours + 1,\n minutes: 0,\n seconds: 0,\n count: updatedCount\n });\n }\n\n if (updatedCount % (60 * 60 * 24) === 0) {\n return setTime({\n ...time,\n days: time.days + 1,\n hours: 0,\n minutes: 0,\n seconds: 0,\n count: updatedCount\n });\n }\n\n setTime({\n ...time,\n seconds: time.seconds + 1,\n count: updatedCount\n });\n });\n\n useEffect(() => {\n if (paused) return;\n const interval = setInterval(() => onInterval(), 1000);\n return () => clearInterval(interval);\n }, [paused]);\n\n return {\n ...time,\n paused,\n pause: () => setPaused(true),\n start: () => setPaused(false),\n reset: () => setTime(getStopwatchTime(initialTime)),\n toggle: () => setPaused((prevPause) => !prevPause)\n };\n}) as UseStopwatch;\n"],"names":["getStopwatchTime","time","days","Math","floor","hours","minutes","seconds","count","useStopwatch","_ref","_params$","_len","arguments","length","params","Array","_key","initialTime","options","_useState","useState","_useState2","_slicedToArray","setTime","_useState3","enabled","_useState4","paused","setPaused","onInterval","useEvent","updatedCount","_objectSpread","useEffect","interval","setInterval","clearInterval","pause","start","reset","toggle","prevPause"],"mappings":";oQAIA,IAAMA,EAAmB,SAACC,GACxB,OAAKA,EAcE,CAAEC,KALIC,KAAKC,MAAMH,EAAO,OAKhBI,MAJDF,KAAKC,MAAOH,EAAO,MAAS,MAIpBK,QAHNH,KAAKC,MAAOH,EAAO,KAAQ,IAGZM,QAFfJ,KAAKC,MAAMH,EAAO,IAEMO,MAAOP,GAbtC,CACLC,KAAM,EACNG,MAAO,EACPC,QAAS,EACTC,QAAS,EACTC,MAAO,EASb,EA2DaC,EAAgB,WAAsB,IAAA,IAAAC,EAAAC,EAAAC,EAAAC,UAAAC,OAAlBC,EAAMC,IAAAA,MAAAJ,GAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAANF,EAAME,GAAAJ,UAAAI,GACrC,IAAMC,EAG0ER,QAH/DA,EACO,iBAAdK,EAAO,GACVA,EAAO,WAAEJ,EACTI,EAAO,UAAE,IAAAJ,OAAA,EAAVA,EAA+DO,mBAAWR,IAAAA,EAAAA,EAAK,EAE/ES,EACiB,iBAAdJ,EAAO,GACTA,EAAO,GACPA,EAAO,GAEdK,EAAwBC,EAASrB,EAAiBkB,IAAaI,EAAAC,EAAAH,EAAA,GAAxDnB,EAAIqB,EAAA,GAAEE,EAAOF,EAAA,GACpBG,EAA4BJ,IAAUF,SAAAA,EAASO,UAAQC,EAAAJ,EAAAE,EAAA,GAAhDG,EAAMD,EAAA,GAAEE,EAASF,EAAA,GAElBG,EAAaC,GAAS,WAC1B,IAAMC,EAAe/B,EAAKO,MAAQ,EAElC,OAAIwB,EAAe,IAAO,EACjBR,EAAOS,EAAAA,KACThC,GAAI,GAAA,CACPK,QAASL,EAAKK,QAAU,EACxBC,QAAS,EACTC,MAAOwB,KAIPA,EAAgB,MAAa,EACxBR,EAAOS,EAAAA,KACThC,GAAI,GAAA,CACPI,MAAOJ,EAAKI,MAAQ,EACpBC,QAAS,EACTC,QAAS,EACTC,MAAOwB,KAIPA,EAAY,OAAsB,EAC7BR,EAAOS,EAAAA,KACThC,GAAI,GAAA,CACPC,KAAMD,EAAKC,KAAO,EAClBG,MAAO,EACPC,QAAS,EACTC,QAAS,EACTC,MAAOwB,UAIXR,EAAOS,EAAAA,KACFhC,GAAI,CAAA,EAAA,CACPM,QAASN,EAAKM,QAAU,EACxBC,MAAOwB,IAEX,IAQA,OANAE,GAAU,WACR,IAAIN,EAAJ,CACA,IAAMO,EAAWC,aAAY,WAAA,OAAMN,GAAY,GAAE,KACjD,OAAO,WAAA,OAAMO,cAAcF,EAAS,CAFxB,CAGd,GAAG,CAACP,IAEJK,EAAAA,EAAA,CAAA,EACKhC,GAAI,CAAA,EAAA,CACP2B,OAAAA,EACAU,MAAO,WAAA,OAAMT,GAAU,EAAK,EAC5BU,MAAO,WAAA,OAAMV,GAAU,EAAM,EAC7BW,MAAO,WAAA,OAAMhB,EAAQxB,EAAiBkB,GAAa,EACnDuB,OAAQ,WAAA,OAAMZ,GAAU,SAACa,GAAS,OAAMA,IAAU,GAEtD"}
|
|
1
|
+
{"version":3,"file":"useStopwatch.js","sources":["../../../../src/hooks/useStopwatch/useStopwatch.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\r\n\r\nimport { useEvent } from '@/hooks';\r\n\r\nconst getStopwatchTime = (time: number) => {\r\n if (!time)\r\n return {\r\n days: 0,\r\n hours: 0,\r\n minutes: 0,\r\n seconds: 0,\r\n count: 0\r\n };\r\n\r\n const days = Math.floor(time / 86400);\r\n const hours = Math.floor((time % 86400) / 3600);\r\n const minutes = Math.floor((time % 3600) / 60);\r\n const seconds = Math.floor(time % 60);\r\n\r\n return { days, hours, minutes, seconds, count: time };\r\n};\r\n\r\n/** The use stopwatch return type */\r\nexport interface UseStopwatchReturn {\r\n /** The paused state of the stopwatch */\r\n paused: boolean;\r\n /** The over state of the stopwatch */\r\n over: boolean;\r\n /** The day count of the stopwatch */\r\n days: number;\r\n /** The hour count of the stopwatch */\r\n hours: number;\r\n /** The minute count of the stopwatch */\r\n minutes: number;\r\n /** The second count of the stopwatch */\r\n seconds: number;\r\n /** The total count of the stopwatch */\r\n count: number;\r\n /** The function to pause the stopwatch */\r\n pause: () => void;\r\n /** The function to start the stopwatch */\r\n start: () => void;\r\n /** The function to reset the stopwatch */\r\n reset: () => void;\r\n /** The function to toggle the stopwatch */\r\n toggle: () => void;\r\n}\r\n\r\n/** The use stopwatch options */\r\nexport interface UseStopwatchOptions {\r\n /** The enabled state of the timer */\r\n enabled?: boolean;\r\n}\r\n\r\ninterface UseStopwatch {\r\n (initialTime?: number, options?: UseStopwatchOptions): UseStopwatchReturn;\r\n (options?: UseStopwatchOptions & { initialTime?: number }): UseStopwatchReturn;\r\n}\r\n/**\r\n * @name useStopwatch\r\n * @description - Hook that creates a stopwatch functionality\r\n * @category Time\r\n *\r\n * @overload\r\n * @param {number} [initialTime=0] The initial time of the timer\r\n * @param {boolean} [options.enabled=true] The enabled state of the timer\r\n * @returns {UseStopwatchReturn} An object containing the current time and functions to interact with the timer\r\n *\r\n * @example\r\n * const { seconds, minutes, start, pause, reset } = useStopwatch(1000, { enabled: false });\r\n *\r\n * @overload\r\n * @param {number} [options.initialTime=0] -The initial time of the timer\r\n * @param {boolean} [options.enabled=true] The enabled state of the timer\r\n * @returns {UseStopwatchReturn} An object containing the current time and functions to interact with the timer\r\n *\r\n * @example\r\n * const { seconds, minutes, start, pause, reset } = useStopwatch({ initialTime: 1000, enabled: false });\r\n */\r\nexport const useStopwatch = ((...params: any[]) => {\r\n const initialTime =\r\n (typeof params[0] === 'number'\r\n ? (params[0] as number | undefined)\r\n : (params[0] as UseStopwatchOptions & { initialTime?: number })?.initialTime) ?? 0;\r\n\r\n const options =\r\n typeof params[0] === 'number'\r\n ? (params[1] as UseStopwatchOptions | undefined)\r\n : (params[0] as (UseStopwatchOptions & { initialTime?: number }) | undefined);\r\n\r\n const [time, setTime] = useState(getStopwatchTime(initialTime));\r\n const [paused, setPaused] = useState(!options?.enabled);\r\n\r\n const onInterval = useEvent(() => {\r\n const updatedCount = time.count + 1;\r\n\r\n if (updatedCount % 60 === 0) {\r\n return setTime({\r\n ...time,\r\n minutes: time.minutes + 1,\r\n seconds: 0,\r\n count: updatedCount\r\n });\r\n }\r\n\r\n if (updatedCount % (60 * 60) === 0) {\r\n return setTime({\r\n ...time,\r\n hours: time.hours + 1,\r\n minutes: 0,\r\n seconds: 0,\r\n count: updatedCount\r\n });\r\n }\r\n\r\n if (updatedCount % (60 * 60 * 24) === 0) {\r\n return setTime({\r\n ...time,\r\n days: time.days + 1,\r\n hours: 0,\r\n minutes: 0,\r\n seconds: 0,\r\n count: updatedCount\r\n });\r\n }\r\n\r\n setTime({\r\n ...time,\r\n seconds: time.seconds + 1,\r\n count: updatedCount\r\n });\r\n });\r\n\r\n useEffect(() => {\r\n if (paused) return;\r\n const interval = setInterval(() => onInterval(), 1000);\r\n return () => clearInterval(interval);\r\n }, [paused]);\r\n\r\n return {\r\n ...time,\r\n paused,\r\n pause: () => setPaused(true),\r\n start: () => setPaused(false),\r\n reset: () => setTime(getStopwatchTime(initialTime)),\r\n toggle: () => setPaused((prevPause) => !prevPause)\r\n };\r\n}) as UseStopwatch;\r\n"],"names":["getStopwatchTime","time","days","Math","floor","hours","minutes","seconds","count","useStopwatch","_ref","_params$","_len","arguments","length","params","Array","_key","initialTime","options","_useState","useState","_useState2","_slicedToArray","setTime","_useState3","enabled","_useState4","paused","setPaused","onInterval","useEvent","updatedCount","_objectSpread","useEffect","interval","setInterval","clearInterval","pause","start","reset","toggle","prevPause"],"mappings":";oQAIA,IAAMA,EAAmB,SAACC,GACxB,OAAKA,EAcE,CAAEC,KALIC,KAAKC,MAAMH,EAAO,OAKhBI,MAJDF,KAAKC,MAAOH,EAAO,MAAS,MAIpBK,QAHNH,KAAKC,MAAOH,EAAO,KAAQ,IAGZM,QAFfJ,KAAKC,MAAMH,EAAO,IAEMO,MAAOP,GAbtC,CACLC,KAAM,EACNG,MAAO,EACPC,QAAS,EACTC,QAAS,EACTC,MAAO,EASb,EA2DaC,EAAgB,WAAsB,IAAA,IAAAC,EAAAC,EAAAC,EAAAC,UAAAC,OAAlBC,EAAMC,IAAAA,MAAAJ,GAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAANF,EAAME,GAAAJ,UAAAI,GACrC,IAAMC,EAG0ER,QAH/DA,EACO,iBAAdK,EAAO,GACVA,EAAO,WAAEJ,EACTI,EAAO,UAAE,IAAAJ,OAAA,EAAVA,EAA+DO,mBAAWR,IAAAA,EAAAA,EAAK,EAE/ES,EACiB,iBAAdJ,EAAO,GACTA,EAAO,GACPA,EAAO,GAEdK,EAAwBC,EAASrB,EAAiBkB,IAAaI,EAAAC,EAAAH,EAAA,GAAxDnB,EAAIqB,EAAA,GAAEE,EAAOF,EAAA,GACpBG,EAA4BJ,IAAUF,SAAAA,EAASO,UAAQC,EAAAJ,EAAAE,EAAA,GAAhDG,EAAMD,EAAA,GAAEE,EAASF,EAAA,GAElBG,EAAaC,GAAS,WAC1B,IAAMC,EAAe/B,EAAKO,MAAQ,EAElC,OAAIwB,EAAe,IAAO,EACjBR,EAAOS,EAAAA,KACThC,GAAI,GAAA,CACPK,QAASL,EAAKK,QAAU,EACxBC,QAAS,EACTC,MAAOwB,KAIPA,EAAgB,MAAa,EACxBR,EAAOS,EAAAA,KACThC,GAAI,GAAA,CACPI,MAAOJ,EAAKI,MAAQ,EACpBC,QAAS,EACTC,QAAS,EACTC,MAAOwB,KAIPA,EAAY,OAAsB,EAC7BR,EAAOS,EAAAA,KACThC,GAAI,GAAA,CACPC,KAAMD,EAAKC,KAAO,EAClBG,MAAO,EACPC,QAAS,EACTC,QAAS,EACTC,MAAOwB,UAIXR,EAAOS,EAAAA,KACFhC,GAAI,CAAA,EAAA,CACPM,QAASN,EAAKM,QAAU,EACxBC,MAAOwB,IAEX,IAQA,OANAE,GAAU,WACR,IAAIN,EAAJ,CACA,IAAMO,EAAWC,aAAY,WAAA,OAAMN,GAAY,GAAE,KACjD,OAAO,WAAA,OAAMO,cAAcF,EAAS,CAFxB,CAGd,GAAG,CAACP,IAEJK,EAAAA,EAAA,CAAA,EACKhC,GAAI,CAAA,EAAA,CACP2B,OAAAA,EACAU,MAAO,WAAA,OAAMT,GAAU,EAAK,EAC5BU,MAAO,WAAA,OAAMV,GAAU,EAAM,EAC7BW,MAAO,WAAA,OAAMhB,EAAQxB,EAAiBkB,GAAa,EACnDuB,OAAQ,WAAA,OAAMZ,GAAU,SAACa,GAAS,OAAMA,IAAU,GAEtD"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{c as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{c as e}from"../../_rollupPluginBabelHelpers-MWjPFzDB.js";import{useSyncExternalStore as n}from"react";import{isClient as r}from"../../utils/helpers/isClient.js";import{useIsomorphicLayoutEffect as t}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var i=function(e){return window.dispatchEvent(new StorageEvent("storage",e))},o=function(e,n,r){var t=e.getItem(n);e.setItem(n,r),i({key:n,oldValue:t,newValue:r,storageArea:e})},u=function(e,n){var r=e.getItem(n);e.removeItem(n),i({key:n,oldValue:r,newValue:null,storageArea:e})},a=function(e,n){var r=e.getItem(n);if(r)return r},l=function(e){return window.addEventListener("storage",e),function(){return window.removeEventListener("storage",e)}},s=function(){},f=function(i,f){var c,v,d="object"===e(f)?f:void 0,m=d?null==d?void 0:d.initialValue:f,g=function(e){if(null===e)return u(w,i);o(w,i,I(e))},p=function(){return u(w,i)};if(!r)return{value:m instanceof Function?m():m,set:g,remove:p};var w=null!==(c=null==d?void 0:d.storage)&&void 0!==c?c:null===(v=window)||void 0===v?void 0:v.localStorage,I=function(e){return null!=d&&d.serializer?d.serializer(e):JSON.stringify(e)},y=n(l,(function(){return a(w,i)}),s);return t((function(){void 0===a(w,i)&&void 0!==m&&o(w,i,I(m instanceof Function?m():m))}),[i]),{value:y?function(e){if(null!=d&&d.deserializer)return d.deserializer(e);if("undefined"!==e)try{return JSON.parse(e)}catch(n){return e}}(y):void 0,set:g,remove:p}};export{i as dispatchStorageEvent,f as useStorage};
|
|
3
3
|
//# sourceMappingURL=useStorage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStorage.js","sources":["../../../../src/hooks/useStorage/useStorage.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\n\nimport { isClient } from '@/utils/helpers';\n\nimport { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect';\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 serializer function to be invoked */\n serializer?: (value: Value) => string;\n /* The deserializer function to be invoked */\n deserializer?: (value: string) => Value;\n /* The storage to be used */\n storage?: Storage;\n /* The initial value of the storage */\n initialValue?: UseStorageInitialValue<Value>;\n}\n\n/* The use storage return type */\nexport interface UseStorageReturn<Value> {\n /* The value of the storage */\n value: Value;\n /* The loading state of the storage */\n set: (value: Value) => void;\n /* The error state of the storage */\n remove: () => void;\n}\n\nexport const dispatchStorageEvent = (params: Partial<StorageEvent>) =>\n window.dispatchEvent(new StorageEvent('storage', 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\nconst storageSubscribe = (callback: () => void) => {\n window.addEventListener('storage', callback);\n return () => window.removeEventListener('storage', callback);\n};\n\nconst getServerSnapshot = () => undefined;\n\n/**\n * @name useStorage\n * @description - Hook that manages storage value\n * @category Utilities\n *\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 = (typeof params === 'object' ? params : undefined) as UseStorageOptions<Value>;\n const initialValue = (options ? options?.initialValue : params) as UseStorageInitialValue<Value>;\n\n const storage = options?.storage ?? window
|
|
1
|
+
{"version":3,"file":"useStorage.js","sources":["../../../../src/hooks/useStorage/useStorage.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\r\n\r\nimport { isClient } from '@/utils/helpers';\r\n\r\nimport { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect';\r\n\r\n/* The use storage initial value type */\r\nexport type UseStorageInitialValue<Value> = Value | (() => Value);\r\n\r\n/* The use storage options type */\r\nexport interface UseStorageOptions<Value> {\r\n /* The serializer function to be invoked */\r\n serializer?: (value: Value) => string;\r\n /* The deserializer function to be invoked */\r\n deserializer?: (value: string) => Value;\r\n /* The storage to be used */\r\n storage?: Storage;\r\n /* The initial value of the storage */\r\n initialValue?: UseStorageInitialValue<Value>;\r\n}\r\n\r\n/* The use storage return type */\r\nexport interface UseStorageReturn<Value> {\r\n /* The value of the storage */\r\n value: Value;\r\n /* The loading state of the storage */\r\n set: (value: Value) => void;\r\n /* The error state of the storage */\r\n remove: () => void;\r\n}\r\n\r\nexport const dispatchStorageEvent = (params: Partial<StorageEvent>) =>\r\n window.dispatchEvent(new StorageEvent('storage', params));\r\n\r\nconst setStorageItem = (storage: Storage, key: string, value: string) => {\r\n const oldValue = storage.getItem(key);\r\n\r\n storage.setItem(key, value);\r\n dispatchStorageEvent({ key, oldValue, newValue: value, storageArea: storage });\r\n};\r\n\r\nconst removeStorageItem = (storage: Storage, key: string) => {\r\n const oldValue = storage.getItem(key);\r\n\r\n storage.removeItem(key);\r\n dispatchStorageEvent({ key, oldValue, newValue: null, storageArea: storage });\r\n};\r\n\r\nconst getStorageItem = (storage: Storage, key: string) => {\r\n const value = storage.getItem(key);\r\n if (!value) return undefined;\r\n return value;\r\n};\r\n\r\nconst storageSubscribe = (callback: () => void) => {\r\n window.addEventListener('storage', callback);\r\n return () => window.removeEventListener('storage', callback);\r\n};\r\n\r\nconst getServerSnapshot = () => undefined;\r\n\r\n/**\r\n * @name useStorage\r\n * @description - Hook that manages storage value\r\n * @category Utilities\r\n *\r\n * @param {string} key The key of the storage\r\n * @param {(value: Value) => string} [params.serializer] The serializer function\r\n * @param {(value: string) => Value} [params.deserializer] The deserializer function\r\n * @param {Storage} [params.storage] The storage\r\n * @param {UseStorageInitialValue<Value>} [params.initialValue] The initial value of the storage\r\n * @returns {UseStorageReturn<Value>} The value and the set function\r\n *\r\n * @example\r\n * const { value, set, remove } = useStorage('key', 'value');\r\n */\r\nexport const useStorage = <Value>(\r\n key: string,\r\n params?: UseStorageInitialValue<Value> | UseStorageOptions<Value>\r\n) => {\r\n const options = (typeof params === 'object' ? params : undefined) as UseStorageOptions<Value>;\r\n const initialValue = (options ? options?.initialValue : params) as UseStorageInitialValue<Value>;\r\n\r\n const set = (value: Value) => {\r\n if (value === null) return removeStorageItem(storage, key);\r\n setStorageItem(storage, key, serializer(value));\r\n };\r\n const remove = () => removeStorageItem(storage, key);\r\n\r\n\r\n if (!isClient)\r\n return {\r\n value: initialValue instanceof Function ? initialValue() : initialValue,\r\n set,\r\n remove\r\n };\r\n\r\n const storage = options?.storage ?? window?.localStorage;\r\n const serializer = (value: Value) => {\r\n if (options?.serializer) return options.serializer(value);\r\n return JSON.stringify(value);\r\n };\r\n\r\n const deserializer = (value: string) => {\r\n if (options?.deserializer) return options.deserializer(value);\r\n\r\n if (value === 'undefined') {\r\n return undefined as unknown as Value;\r\n }\r\n\r\n try {\r\n return JSON.parse(value) as Value;\r\n } catch {\r\n return value as Value;\r\n }\r\n };\r\n\r\n const getSnapshot = () => getStorageItem(storage, key);\r\n const store = useSyncExternalStore(storageSubscribe, getSnapshot, getServerSnapshot);\r\n\r\n useIsomorphicLayoutEffect(() => {\r\n const value = getStorageItem(storage, key);\r\n if (value === undefined && initialValue !== undefined) {\r\n setStorageItem(\r\n storage,\r\n key,\r\n serializer(initialValue instanceof Function ? initialValue() : initialValue)\r\n );\r\n }\r\n }, [key]);\r\n\r\n\r\n return {\r\n value: store ? deserializer(store) : undefined,\r\n set,\r\n remove\r\n };\r\n};\r\n"],"names":["dispatchStorageEvent","params","window","dispatchEvent","StorageEvent","setStorageItem","storage","key","value","oldValue","getItem","setItem","newValue","storageArea","removeStorageItem","removeItem","getStorageItem","storageSubscribe","callback","addEventListener","removeEventListener","getServerSnapshot","useStorage","_options$storage","_window","options","_typeof","undefined","initialValue","set","serializer","remove","isClient","Function","localStorage","JSON","stringify","store","useSyncExternalStore","useIsomorphicLayoutEffect","deserializer","parse","_unused"],"mappings":";kRA+BaA,EAAuB,SAACC,GAA6B,OAChEC,OAAOC,cAAc,IAAIC,aAAa,UAAWH,GAAQ,EAErDI,EAAiB,SAACC,EAAkBC,EAAaC,GACrD,IAAMC,EAAWH,EAAQI,QAAQH,GAEjCD,EAAQK,QAAQJ,EAAKC,GACrBR,EAAqB,CAAEO,IAAAA,EAAKE,SAAAA,EAAUG,SAAUJ,EAAOK,YAAaP,GACtE,EAEMQ,EAAoB,SAACR,EAAkBC,GAC3C,IAAME,EAAWH,EAAQI,QAAQH,GAEjCD,EAAQS,WAAWR,GACnBP,EAAqB,CAAEO,IAAAA,EAAKE,SAAAA,EAAUG,SAAU,KAAMC,YAAaP,GACrE,EAEMU,EAAiB,SAACV,EAAkBC,GACxC,IAAMC,EAAQF,EAAQI,QAAQH,GAC9B,GAAKC,EACL,OAAOA,CACT,EAEMS,EAAmB,SAACC,GAExB,OADAhB,OAAOiB,iBAAiB,UAAWD,GAC5B,WAAA,OAAMhB,OAAOkB,oBAAoB,UAAWF,EAAS,CAC9D,EAEMG,EAAoB,WAAe,EAiB5BC,EAAa,SACxBf,EACAN,GACG,IAAAsB,EAAAC,EACGC,EAA6B,WAAlBC,EAAOzB,GAAsBA,OAAS0B,EACjDC,EAAgBH,EAAUA,aAAO,EAAPA,EAASG,aAAe3B,EAElD4B,EAAM,SAACrB,GACX,GAAc,OAAVA,EAAgB,OAAOM,EAAkBR,EAASC,GACtDF,EAAeC,EAASC,EAAKuB,EAAWtB,KAEpCuB,EAAS,WAAH,OAASjB,EAAkBR,EAASC,EAAI,EAGpD,IAAKyB,EACH,MAAO,CACLxB,MAAOoB,aAAwBK,SAAWL,IAAiBA,EAC3DC,IAAAA,EACAE,OAAAA,GAGJ,IAAMzB,EAA0B,QAAnBiB,EAAGE,aAAO,EAAPA,EAASnB,eAAOiB,IAAAA,EAAAA,UAAAC,EAAItB,cAAM,IAAAsB,OAAA,EAANA,EAAQU,aACtCJ,EAAa,SAACtB,GAClB,OAAIiB,SAAAA,EAASK,WAAmBL,EAAQK,WAAWtB,GAC5C2B,KAAKC,UAAU5B,IAkBlB6B,EAAQC,EAAqBrB,GADf,WAAH,OAASD,EAAeV,EAASC,EAAI,GACYc,GAclE,OAZAkB,GAA0B,gBAEVZ,IADAX,EAAeV,EAASC,SACMoB,IAAjBC,GACzBvB,EACEC,EACAC,EACAuB,EAAWF,aAAwBK,SAAWL,IAAiBA,GAGrE,GAAG,CAACrB,IAGG,CACLC,MAAO6B,EA9BY,SAAC7B,GACpB,GAAIiB,SAAAA,EAASe,aAAc,OAAOf,EAAQe,aAAahC,GAEvD,GAAc,cAAVA,EAIJ,IACE,OAAO2B,KAAKM,MAAMjC,EACnB,CAAC,MAAAkC,GACA,OAAOlC,CACT,EAmBegC,CAAaH,QAASV,EACrCE,IAAAA,EACAE,OAAAA,EAEJ"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-MWjPFzDB.js";import{useState as n,useEffect as t}from"react";import{isClient as r}from"../../utils/helpers/isClient.js";import{useRerender as o}from"../useRerender/useRerender.js";var u=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)}))},i=function(){var i,l=o(),c=n(r?document.getSelection():null),a=e(c,2),s=a[0],m=a[1];t((function(){var e=function(){m(document.getSelection()),l.update()};return document.addEventListener("selectionchange",e),function(){return document.removeEventListener("selectionchange",e)}}),[]);var d=null!==(i=null==s?void 0:s.toString())&&void 0!==i?i:"",g=s?u(s):[],f=g.map((function(e){return e.getBoundingClientRect()}));return{text:d,ranges:g,rects:f,selection:s}};export{u as getRangesSelection,i as useTextSelection};
|
|
3
3
|
//# sourceMappingURL=useTextSelection.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-MWjPFzDB.js";import{useState as r}from"react";import"../../utils/helpers/isClient.js";import{getDate as t}from"../../utils/helpers/time/getDate.js";import{useInterval as s}from"../useInterval/useInterval.js";import"../useEvent/useEvent.js";var i=function(){var i=r(t()),o=e(i,2),l=o[0],n=o[1];return s((function(){return n(t())}),1e3),l};export{i as useTime};
|
|
3
3
|
//# sourceMappingURL=useTime.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-MWjPFzDB.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.
|
|
2
|
-
import{_ as t,b as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{_ as t,b as r}from"../../_rollupPluginBabelHelpers-MWjPFzDB.js";import{useState as n}from"react";import{useInterval as e}from"../useInterval/useInterval.js";import"../useEvent/useEvent.js";var o=function(t){var r=Math.ceil(t),n=Math.floor(r/86400),e=Math.floor(r%86400/3600),o=Math.floor(r%3600/60);return{seconds:Math.floor(r%60),minutes:o,hours:e,days:n}},l=function(l,a,u){var i,s=null===(i=null==u?void 0:u.autostart)||void 0===i||i,c=n(Math.ceil(l/1e3)),f=t(c,2),v=f[0],h=f[1],m=n(s),p=t(m,2),M=p[0],d=p[1];return e((function(){var t,r=v-1;null==u||null===(t=u.onTick)||void 0===t||t.call(u,v),h(r),0===r&&(d(!1),a())}),1e3,{enabled:M}),r(r({},o(v)),{},{pause:function(){return d(!1)},toggle:function(){return d(!M)},start:function(){d(!0),h(Math.ceil(l/1e3))},restart:function(t){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];h(Math.ceil(t/1e3)),d(r)},running:M})};export{o as getTimeFromSeconds,l as useTimer};
|
|
3
3
|
//# sourceMappingURL=useTimer.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-MWjPFzDB.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};
|
|
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';\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":";uGAoBaA,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';\r\nimport { useReducer } from 'react';\r\n\r\n/** The use toggle return type */\r\nexport type UseToggleReturn<Value> = readonly [Value, (value?: Value) => void];\r\n\r\n/**\r\n * @name useToggle\r\n * @description - Hook that create toggle\r\n * @category Utilities\r\n *\r\n * @template Value The type of the value\r\n * @param {Value[]} [values=[false, true]] The values to toggle\r\n *\r\n * @example\r\n * const [on, toggle] = useToggle();\r\n *\r\n * @example\r\n * const [value, toggle] = useToggle(['light', 'dark'] as const);\r\n */\r\nexport const useToggle = <Value = boolean>(values: readonly Value[] = [false, true] as any) => {\r\n const [[option], toggle] = useReducer((state: Value[], action: SetStateAction<Value>) => {\r\n const value = action instanceof Function ? action(state[0]) : action;\r\n const index = Math.abs(state.indexOf(value));\r\n return state.slice(index).concat(state.slice(0, index));\r\n }, values as Value[]);\r\n\r\n return [option, toggle as (value?: SetStateAction<Value>) => void] as const;\r\n};\r\n"],"names":["useToggle","_useReducer","useReducer","state","action","value","Function","index","Math","abs","indexOf","slice","concat","arguments","length","undefined","_useReducer2","_slicedToArray"],"mappings":";uGAoBaA,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,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
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.
|
|
2
|
-
import{_ as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{_ as n}from"../../_rollupPluginBabelHelpers-MWjPFzDB.js";import{useRef as r,useState as e,useEffect as o}from"react";import{getRetry as t}from"../../utils/helpers/getRetry.js";import"../../utils/helpers/isClient.js";import{useEvent as l}from"../useEvent/useEvent.js";var u=function(u,c){var i=r(),s=r(null!=c&&c.retry?t(c.retry):0),v=r(!1),a=e("connecting"),d=n(a,2),f=d[0],p=d[1],m=l((function(){i.current=new WebSocket("function"==typeof u?u():u,null==c?void 0:c.protocols),p("connecting");var n=i.current;n&&(n.onopen=function(){var r;p("connected"),null==c||null===(r=c.onConnected)||void 0===r||r.call(c,n)},n.onerror=function(r){var e;p("failed"),null==c||null===(e=c.onError)||void 0===e||e.call(c,r,n)},n.onmessage=function(r){var e;return null==c||null===(e=c.onMessage)||void 0===e?void 0:e.call(c,r,n)},n.onclose=function(r){var e;if(p("disconnected"),null==c||null===(e=c.onDisconnected)||void 0===e||e.call(c,r,n),!v.current)return s.current>0?(s.current-=1,m()):void(s.current=null!=c&&c.retry?t(c.retry):0)})}));o((function(){return m(),function(){i.current&&(i.current.close(),i.current=void 0)}}),[u]);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{u as useWebSocket};
|
|
3
3
|
//# sourceMappingURL=useWebSocket.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{useEventListener as e}from"../useEventListener/useEventListener.js";import"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{useEventListener as e}from"../useEventListener/useEventListener.js";import"../../_rollupPluginBabelHelpers-MWjPFzDB.js";import"react";import"../../utils/helpers/getElement.js";import"../../utils/helpers/isClient.js";import"../useEvent/useEvent.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.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-MWjPFzDB.js";import{useState as o,useEffect as e}from"react";import{isClient as n}from"../../utils/helpers/isClient.js";var i=function(r){var o=r.x,e=r.y,n=r.behavior,i={behavior:void 0===n?"smooth":n};"number"==typeof o&&(i.left=o),"number"==typeof e&&(i.top=e),window.scrollTo(i)},t=function(){var t=o({x:n?window.scrollX:Number.POSITIVE_INFINITY,y:n?window.scrollY:Number.POSITIVE_INFINITY}),l=r(t,2),s=l[0],w=l[1];return e((function(){var r=function(){return w({x:window.scrollX,y:window.scrollY})};return window.addEventListener("scroll",r),window.addEventListener("resize",r),function(){window.removeEventListener("scroll",r),window.removeEventListener("resize",r)}}),[]),{value:s,scrollTo:i}};export{i as scrollTo,t as useWindowScroll};
|
|
3
3
|
//# sourceMappingURL=useWindowScroll.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-MWjPFzDB.js";import{useState as n,useEffect as i}from"react";import{isClient as t}from"../../utils/helpers/isClient.js";var o=function(o){var r,d=null===(r=null==o?void 0:o.includeScrollbar)||void 0===r||r,l=n((function(){return t?{width:d?window.innerWidth:window.document.documentElement.clientWidth,height:d?window.innerHeight:window.document.documentElement.clientHeight}:{width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY}})),u=e(l,2),w=u[0],c=u[1];return i((function(){var e=function(){c(d?{width:window.innerWidth,height:window.innerHeight}:{width:window.document.documentElement.clientWidth,height:window.document.documentElement.clientHeight})};return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[null==o?void 0:o.includeScrollbar]),w};export{o as useWindowSize};
|
|
3
3
|
//# sourceMappingURL=useWindowSize.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWindowSize.js","sources":["../../../../src/hooks/useWindowSize/useWindowSize.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { isClient } from '@/utils/helpers';\n\n/** The use window size return type */\ninterface UseWindowSizeParams {\n /** Whether to include the scrollbar in the window size calculation */\n includeScrollbar?: boolean;\n}\n\n/** The use window size return type */\nexport interface UseWindowSizeReturn {\n /** The current window width */\n width: number;\n /** The current window height */\n height: number;\n}\n\n/**\n * @name useWindowSize\n * @description - Hook that manages a window size\n * @category Browser\n *\n * @param {number} [params.initialWidth=Number.POSITIVE_INFINITY] The initial window width\n * @param {number} [params.initialHeight=Number.POSITIVE_INFINITY] The initial window height\n * @returns {UseWindowSizeReturn} An object containing the current window width and height\n *\n * @example\n * const { width, height } = useWindowSize();\n */\nexport const useWindowSize = (params?: UseWindowSizeParams) => {\n const includeScrollbar = params?.includeScrollbar ?? true;\n const [size, setSize] = useState(() => {\n if (!isClient) {\n return {\n width: Number.POSITIVE_INFINITY,\n height: Number.POSITIVE_INFINITY\n };\n }\n\n return {\n width: includeScrollbar ? window.innerWidth : window.document.documentElement.clientWidth,\n height: includeScrollbar ? window.innerHeight : window.document.documentElement.clientHeight\n };\n });\n\n useEffect(() => {\n const onResize = () => {\n if (includeScrollbar) {\n setSize({\n width: window.innerWidth,\n height: window.innerHeight\n });\n } else {\n setSize({\n width: window.document.documentElement.clientWidth,\n height: window.document.documentElement.clientHeight\n });\n }\n };\n\n window.addEventListener('resize', onResize);\n return () => {\n window.removeEventListener('resize', onResize);\n };\n }, [params?.includeScrollbar]);\n\n return size;\n};\n"],"names":["useWindowSize","params","_params$includeScroll","includeScrollbar","_useState","useState","isClient","width","window","innerWidth","document","documentElement","clientWidth","height","innerHeight","clientHeight","Number","POSITIVE_INFINITY","_useState2","_slicedToArray","size","setSize","useEffect","onResize","addEventListener","removeEventListener"],"mappings":";+KA8BaA,EAAgB,SAACC,GAAiC,IAAAC,EACvDC,EAA2CD,QAA3BA,EAAGD,aAAM,EAANA,EAAQE,wBAAgBD,IAAAA,GAAAA,EACjDE,EAAwBC,GAAS,WAC/B,OAAKC,EAOE,CACLC,MAAOJ,EAAmBK,OAAOC,WAAaD,OAAOE,SAASC,gBAAgBC,YAC9EC,OAAQV,EAAmBK,OAAOM,YAAcN,OAAOE,SAASC,gBAAgBI,cARzE,CACLR,MAAOS,OAAOC,kBACdJ,OAAQG,OAAOC,kBAQrB,IAAEC,EAAAC,EAAAf,EAAA,GAZKgB,EAAIF,EAAA,GAAEG,EAAOH,EAAA,GAmCpB,OArBAI,GAAU,WACR,IAAMC,EAAW,WAEbF,EADElB,EACM,CACNI,MAAOC,OAAOC,WACdI,OAAQL,OAAOM,aAGT,CACNP,MAAOC,OAAOE,SAASC,gBAAgBC,YACvCC,OAAQL,OAAOE,SAASC,gBAAgBI,gBAM9C,OADAP,OAAOgB,iBAAiB,SAAUD,GAC3B,WACLf,OAAOiB,oBAAoB,SAAUF,MAEtC,CAACtB,eAAAA,EAAQE,mBAELiB,CACT"}
|
|
1
|
+
{"version":3,"file":"useWindowSize.js","sources":["../../../../src/hooks/useWindowSize/useWindowSize.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\r\n\r\nimport { isClient } from '@/utils/helpers';\r\n\r\n/** The use window size return type */\r\ninterface UseWindowSizeParams {\r\n /** Whether to include the scrollbar in the window size calculation */\r\n includeScrollbar?: boolean;\r\n}\r\n\r\n/** The use window size return type */\r\nexport interface UseWindowSizeReturn {\r\n /** The current window width */\r\n width: number;\r\n /** The current window height */\r\n height: number;\r\n}\r\n\r\n/**\r\n * @name useWindowSize\r\n * @description - Hook that manages a window size\r\n * @category Browser\r\n *\r\n * @param {number} [params.initialWidth=Number.POSITIVE_INFINITY] The initial window width\r\n * @param {number} [params.initialHeight=Number.POSITIVE_INFINITY] The initial window height\r\n * @returns {UseWindowSizeReturn} An object containing the current window width and height\r\n *\r\n * @example\r\n * const { width, height } = useWindowSize();\r\n */\r\nexport const useWindowSize = (params?: UseWindowSizeParams) => {\r\n const includeScrollbar = params?.includeScrollbar ?? true;\r\n const [size, setSize] = useState(() => {\r\n if (!isClient) {\r\n return {\r\n width: Number.POSITIVE_INFINITY,\r\n height: Number.POSITIVE_INFINITY\r\n };\r\n }\r\n\r\n return {\r\n width: includeScrollbar ? window.innerWidth : window.document.documentElement.clientWidth,\r\n height: includeScrollbar ? window.innerHeight : window.document.documentElement.clientHeight\r\n };\r\n });\r\n\r\n useEffect(() => {\r\n const onResize = () => {\r\n if (includeScrollbar) {\r\n setSize({\r\n width: window.innerWidth,\r\n height: window.innerHeight\r\n });\r\n } else {\r\n setSize({\r\n width: window.document.documentElement.clientWidth,\r\n height: window.document.documentElement.clientHeight\r\n });\r\n }\r\n };\r\n\r\n window.addEventListener('resize', onResize);\r\n return () => {\r\n window.removeEventListener('resize', onResize);\r\n };\r\n }, [params?.includeScrollbar]);\r\n\r\n return size;\r\n};\r\n"],"names":["useWindowSize","params","_params$includeScroll","includeScrollbar","_useState","useState","isClient","width","window","innerWidth","document","documentElement","clientWidth","height","innerHeight","clientHeight","Number","POSITIVE_INFINITY","_useState2","_slicedToArray","size","setSize","useEffect","onResize","addEventListener","removeEventListener"],"mappings":";+KA8BaA,EAAgB,SAACC,GAAiC,IAAAC,EACvDC,EAA2CD,QAA3BA,EAAGD,aAAM,EAANA,EAAQE,wBAAgBD,IAAAA,GAAAA,EACjDE,EAAwBC,GAAS,WAC/B,OAAKC,EAOE,CACLC,MAAOJ,EAAmBK,OAAOC,WAAaD,OAAOE,SAASC,gBAAgBC,YAC9EC,OAAQV,EAAmBK,OAAOM,YAAcN,OAAOE,SAASC,gBAAgBI,cARzE,CACLR,MAAOS,OAAOC,kBACdJ,OAAQG,OAAOC,kBAQrB,IAAEC,EAAAC,EAAAf,EAAA,GAZKgB,EAAIF,EAAA,GAAEG,EAAOH,EAAA,GAmCpB,OArBAI,GAAU,WACR,IAAMC,EAAW,WAEbF,EADElB,EACM,CACNI,MAAOC,OAAOC,WACdI,OAAQL,OAAOM,aAGT,CACNP,MAAOC,OAAOE,SAASC,gBAAgBC,YACvCC,OAAQL,OAAOE,SAASC,gBAAgBI,gBAM9C,OADAP,OAAOgB,iBAAiB,SAAUD,GAC3B,WACLf,OAAOiB,oBAAoB,SAAUF,MAEtC,CAACtB,eAAAA,EAAQE,mBAELiB,CACT"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as n,a as o}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
|
+
import{_ as n,a as o}from"../../_rollupPluginBabelHelpers-MWjPFzDB.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
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.70 */
|
|
2
2
|
const e=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],n=(()=>{if("undefined"==typeof document)return!1;const n=e[0],l={};for(const r of e){const e=r?.[1];if(e in document){for(const[e,c]of r.entries())l[n[e]]=c;return l}}return!1})(),l={change:n.fullscreenchange,error:n.fullscreenerror};let r={request:(e=document.documentElement,l)=>new Promise(((c,t)=>{const s=()=>{r.off("change",s),c()};r.on("change",s);const o=e[n.requestFullscreen](l);o instanceof Promise&&o.then(s).catch(t)})),exit:()=>new Promise(((e,l)=>{if(!r.isFullscreen)return void e();const c=()=>{r.off("change",c),e()};r.on("change",c);const t=document[n.exitFullscreen]();t instanceof Promise&&t.then(c).catch(l)})),toggle:(e,n)=>r.isFullscreen?r.exit():r.request(e,n),onchange(e){r.on("change",e)},onerror(e){r.on("error",e)},on(e,n){const r=l[e];r&&document.addEventListener(r,n,!1)},off(e,n){const r=l[e];r&&document.removeEventListener(r,n,!1)},raw:n};Object.defineProperties(r,{isFullscreen:{get:()=>Boolean(document[n.fullscreenElement])},element:{enumerable:!0,get:()=>document[n.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[n.fullscreenEnabled])}}),n||(r={isEnabled:!1});var c=r;export{c as s};
|
|
3
|
-
//# sourceMappingURL=index-
|
|
3
|
+
//# sourceMappingURL=index-aT3H0Ni8.js.map
|