@siberiacancode/reactuse 0.3.15 → 0.3.17
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/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/cjs/helpers/createContext/createContext.cjs +2 -2
- package/dist/cjs/helpers/createContext/createContext.cjs.map +1 -1
- package/dist/cjs/helpers/createContextHook/createContextHook.cjs +2 -2
- package/dist/cjs/helpers/createContextHook/createContextHook.cjs.map +1 -1
- package/dist/cjs/helpers/createEventEmitter/createEventEmitter.cjs +2 -2
- package/dist/cjs/helpers/createEventEmitter/createEventEmitter.cjs.map +1 -1
- package/dist/cjs/helpers/createReactiveContext/createReactiveContext.cjs +2 -2
- package/dist/cjs/helpers/createReactiveContext/createReactiveContext.cjs.map +1 -1
- package/dist/cjs/helpers/createSharedHook/createSharedHook.cjs +2 -2
- package/dist/cjs/helpers/createSharedHook/createSharedHook.cjs.map +1 -1
- package/dist/cjs/helpers/createStore/createStore.cjs +2 -2
- package/dist/cjs/helpers/createStore/createStore.cjs.map +1 -1
- package/dist/cjs/helpers/makeDestructurable/makeDestructurable.cjs +2 -0
- package/dist/cjs/helpers/makeDestructurable/makeDestructurable.cjs.map +1 -0
- package/dist/cjs/hooks/useActiveElement/useActiveElement.cjs +2 -2
- package/dist/cjs/hooks/useActiveElement/useActiveElement.cjs.map +1 -1
- package/dist/cjs/hooks/useAsync/useAsync.cjs +2 -2
- package/dist/cjs/hooks/useAsync/useAsync.cjs.map +1 -1
- package/dist/cjs/hooks/useAsyncEffect/useAsyncEffect.cjs +2 -2
- package/dist/cjs/hooks/useAsyncEffect/useAsyncEffect.cjs.map +1 -1
- package/dist/cjs/hooks/useAudio/useAudio.cjs +2 -2
- package/dist/cjs/hooks/useAudio/useAudio.cjs.map +1 -1
- package/dist/cjs/hooks/useAutoScroll/useAutoScroll.cjs +2 -2
- package/dist/cjs/hooks/useAutoScroll/useAutoScroll.cjs.map +1 -1
- package/dist/cjs/hooks/useBatchedCallback/useBatchedCallback.cjs +2 -2
- package/dist/cjs/hooks/useBatchedCallback/useBatchedCallback.cjs.map +1 -1
- package/dist/cjs/hooks/useBattery/useBattery.cjs +2 -2
- package/dist/cjs/hooks/useBattery/useBattery.cjs.map +1 -1
- package/dist/cjs/hooks/useBluetooth/useBluetooth.cjs +2 -2
- package/dist/cjs/hooks/useBluetooth/useBluetooth.cjs.map +1 -1
- package/dist/cjs/hooks/useBoolean/useBoolean.cjs +2 -2
- package/dist/cjs/hooks/useBoolean/useBoolean.cjs.map +1 -1
- package/dist/cjs/hooks/useBreakpoints/useBreakpoints.cjs +2 -2
- package/dist/cjs/hooks/useBreakpoints/useBreakpoints.cjs.map +1 -1
- package/dist/cjs/hooks/useBroadcastChannel/useBroadcastChannel.cjs +2 -2
- package/dist/cjs/hooks/useBroadcastChannel/useBroadcastChannel.cjs.map +1 -1
- package/dist/cjs/hooks/useBrowserLanguage/useBrowserLanguage.cjs +2 -2
- package/dist/cjs/hooks/useBrowserLanguage/useBrowserLanguage.cjs.map +1 -1
- package/dist/cjs/hooks/useClickOutside/useClickOutside.cjs +2 -2
- package/dist/cjs/hooks/useClickOutside/useClickOutside.cjs.map +1 -1
- package/dist/cjs/hooks/useClipboard/useClipboard.cjs +2 -2
- package/dist/cjs/hooks/useClipboard/useClipboard.cjs.map +1 -1
- package/dist/cjs/hooks/useConst/useConst.cjs +2 -2
- package/dist/cjs/hooks/useConst/useConst.cjs.map +1 -1
- package/dist/cjs/hooks/useControllableState/useControllableState.cjs +2 -2
- package/dist/cjs/hooks/useControllableState/useControllableState.cjs.map +1 -1
- package/dist/cjs/hooks/useCookie/useCookie.cjs +2 -2
- package/dist/cjs/hooks/useCookie/useCookie.cjs.map +1 -1
- package/dist/cjs/hooks/useCookies/useCookies.cjs +2 -2
- package/dist/cjs/hooks/useCookies/useCookies.cjs.map +1 -1
- package/dist/cjs/hooks/useCopy/useCopy.cjs +2 -2
- package/dist/cjs/hooks/useCopy/useCopy.cjs.map +1 -1
- package/dist/cjs/hooks/useCounter/useCounter.cjs +2 -2
- package/dist/cjs/hooks/useCounter/useCounter.cjs.map +1 -1
- package/dist/cjs/hooks/useCssVar/useCssVar.cjs +2 -2
- package/dist/cjs/hooks/useCssVar/useCssVar.cjs.map +1 -1
- package/dist/cjs/hooks/useDebounceCallback/useDebounceCallback.cjs +2 -2
- package/dist/cjs/hooks/useDebounceCallback/useDebounceCallback.cjs.map +1 -1
- package/dist/cjs/hooks/useDebounceEffect/useDebounceEffect.cjs +2 -2
- package/dist/cjs/hooks/useDebounceEffect/useDebounceEffect.cjs.map +1 -1
- package/dist/cjs/hooks/useDebounceState/useDebounceState.cjs +2 -2
- package/dist/cjs/hooks/useDebounceState/useDebounceState.cjs.map +1 -1
- package/dist/cjs/hooks/useDebounceValue/useDebounceValue.cjs +2 -2
- package/dist/cjs/hooks/useDebounceValue/useDebounceValue.cjs.map +1 -1
- package/dist/cjs/hooks/useDefault/useDefault.cjs +2 -2
- package/dist/cjs/hooks/useDefault/useDefault.cjs.map +1 -1
- package/dist/cjs/hooks/useDeviceMotion/useDeviceMotion.cjs +2 -2
- package/dist/cjs/hooks/useDeviceMotion/useDeviceMotion.cjs.map +1 -1
- package/dist/cjs/hooks/useDeviceOrientation/useDeviceOrientation.cjs +2 -2
- package/dist/cjs/hooks/useDeviceOrientation/useDeviceOrientation.cjs.map +1 -1
- package/dist/cjs/hooks/useDevicePixelRatio/useDevicePixelRatio.cjs +2 -2
- package/dist/cjs/hooks/useDevicePixelRatio/useDevicePixelRatio.cjs.map +1 -1
- package/dist/cjs/hooks/useDidUpdate/useDidUpdate.cjs +2 -2
- package/dist/cjs/hooks/useDidUpdate/useDidUpdate.cjs.map +1 -1
- package/dist/cjs/hooks/useDisclosure/useDisclosure.cjs +2 -2
- package/dist/cjs/hooks/useDisclosure/useDisclosure.cjs.map +1 -1
- package/dist/cjs/hooks/useDisplayMedia/useDisplayMedia.cjs +2 -2
- package/dist/cjs/hooks/useDisplayMedia/useDisplayMedia.cjs.map +1 -1
- package/dist/cjs/hooks/useDocumentEvent/useDocumentEvent.cjs +2 -2
- package/dist/cjs/hooks/useDocumentEvent/useDocumentEvent.cjs.map +1 -1
- package/dist/cjs/hooks/useDocumentTitle/useDocumentTitle.cjs +2 -2
- package/dist/cjs/hooks/useDocumentTitle/useDocumentTitle.cjs.map +1 -1
- package/dist/cjs/hooks/useDocumentVisibility/useDocumentVisibility.cjs +2 -2
- package/dist/cjs/hooks/useDocumentVisibility/useDocumentVisibility.cjs.map +1 -1
- package/dist/cjs/hooks/useDoubleClick/useDoubleClick.cjs +2 -2
- package/dist/cjs/hooks/useDoubleClick/useDoubleClick.cjs.map +1 -1
- package/dist/cjs/hooks/useDropZone/useDropZone.cjs +2 -2
- package/dist/cjs/hooks/useDropZone/useDropZone.cjs.map +1 -1
- package/dist/cjs/hooks/useEvent/useEvent.cjs +2 -2
- package/dist/cjs/hooks/useEvent/useEvent.cjs.map +1 -1
- package/dist/cjs/hooks/useEventListener/useEventListener.cjs +2 -2
- package/dist/cjs/hooks/useEventListener/useEventListener.cjs.map +1 -1
- package/dist/cjs/hooks/useEventSource/useEventSource.cjs +2 -2
- package/dist/cjs/hooks/useEventSource/useEventSource.cjs.map +1 -1
- package/dist/cjs/hooks/useEyeDropper/useEyeDropper.cjs +2 -2
- package/dist/cjs/hooks/useEyeDropper/useEyeDropper.cjs.map +1 -1
- package/dist/cjs/hooks/useFavicon/useFavicon.cjs +2 -2
- package/dist/cjs/hooks/useFavicon/useFavicon.cjs.map +1 -1
- package/dist/cjs/hooks/useField/useField.cjs +2 -2
- package/dist/cjs/hooks/useField/useField.cjs.map +1 -1
- package/dist/cjs/hooks/useFileDialog/useFileDialog.cjs +2 -2
- package/dist/cjs/hooks/useFileDialog/useFileDialog.cjs.map +1 -1
- package/dist/cjs/hooks/useFileSystemAccess/useFileSystemAccess.cjs +2 -0
- package/dist/cjs/hooks/useFileSystemAccess/useFileSystemAccess.cjs.map +1 -0
- package/dist/cjs/hooks/useFocus/useFocus.cjs +2 -2
- package/dist/cjs/hooks/useFocus/useFocus.cjs.map +1 -1
- package/dist/cjs/hooks/useFocusTrap/useFocusTrap.cjs +2 -2
- package/dist/cjs/hooks/useFocusTrap/useFocusTrap.cjs.map +1 -1
- package/dist/cjs/hooks/useFps/useFps.cjs +2 -2
- package/dist/cjs/hooks/useFps/useFps.cjs.map +1 -1
- package/dist/cjs/hooks/useFul/useFul.cjs +2 -2
- package/dist/cjs/hooks/useFul/useFul.cjs.map +1 -1
- package/dist/cjs/hooks/useFullscreen/useFullscreen.cjs +2 -2
- package/dist/cjs/hooks/useFullscreen/useFullscreen.cjs.map +1 -1
- package/dist/cjs/hooks/useGamepad/useGamepad.cjs +2 -2
- package/dist/cjs/hooks/useGamepad/useGamepad.cjs.map +1 -1
- package/dist/cjs/hooks/useGeolocation/useGeolocation.cjs +2 -2
- package/dist/cjs/hooks/useGeolocation/useGeolocation.cjs.map +1 -1
- package/dist/cjs/hooks/useHash/useHash.cjs +2 -2
- package/dist/cjs/hooks/useHash/useHash.cjs.map +1 -1
- package/dist/cjs/hooks/useHotkeys/useHotkeys.cjs +2 -2
- package/dist/cjs/hooks/useHotkeys/useHotkeys.cjs.map +1 -1
- package/dist/cjs/hooks/useHover/useHover.cjs +2 -2
- package/dist/cjs/hooks/useHover/useHover.cjs.map +1 -1
- package/dist/cjs/hooks/useIdle/useIdle.cjs +2 -2
- package/dist/cjs/hooks/useIdle/useIdle.cjs.map +1 -1
- package/dist/cjs/hooks/useImage/useImage.cjs +2 -2
- package/dist/cjs/hooks/useImage/useImage.cjs.map +1 -1
- package/dist/cjs/hooks/useInfiniteScroll/useInfiniteScroll.cjs +2 -2
- package/dist/cjs/hooks/useInfiniteScroll/useInfiniteScroll.cjs.map +1 -1
- package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.cjs +2 -2
- package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.cjs.map +1 -1
- package/dist/cjs/hooks/useInterval/useInterval.cjs +2 -2
- package/dist/cjs/hooks/useInterval/useInterval.cjs.map +1 -1
- package/dist/cjs/hooks/useIsFirstRender/useIsFirstRender.cjs +2 -2
- package/dist/cjs/hooks/useIsFirstRender/useIsFirstRender.cjs.map +1 -1
- package/dist/cjs/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.cjs +2 -2
- package/dist/cjs/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.cjs.map +1 -1
- package/dist/cjs/hooks/useKeyPress/useKeyPress.cjs +2 -2
- package/dist/cjs/hooks/useKeyPress/useKeyPress.cjs.map +1 -1
- package/dist/cjs/hooks/useKeyPressEvent/useKeyPressEvent.cjs +2 -2
- package/dist/cjs/hooks/useKeyPressEvent/useKeyPressEvent.cjs.map +1 -1
- package/dist/cjs/hooks/useKeyboard/useKeyboard.cjs +2 -2
- package/dist/cjs/hooks/useKeyboard/useKeyboard.cjs.map +1 -1
- package/dist/cjs/hooks/useKeysPressed/useKeysPressed.cjs +2 -2
- package/dist/cjs/hooks/useKeysPressed/useKeysPressed.cjs.map +1 -1
- package/dist/cjs/hooks/useLastChanged/useLastChanged.cjs +2 -2
- package/dist/cjs/hooks/useLastChanged/useLastChanged.cjs.map +1 -1
- package/dist/cjs/hooks/useLatest/useLatest.cjs +2 -2
- package/dist/cjs/hooks/useLatest/useLatest.cjs.map +1 -1
- package/dist/cjs/hooks/useLess/useLess.cjs +2 -2
- package/dist/cjs/hooks/useLess/useLess.cjs.map +1 -1
- package/dist/cjs/hooks/useList/useList.cjs +2 -2
- package/dist/cjs/hooks/useList/useList.cjs.map +1 -1
- package/dist/cjs/hooks/useLocalStorage/useLocalStorage.cjs +2 -2
- package/dist/cjs/hooks/useLocalStorage/useLocalStorage.cjs.map +1 -1
- package/dist/cjs/hooks/useLockCallback/useLockCallback.cjs +2 -2
- package/dist/cjs/hooks/useLockCallback/useLockCallback.cjs.map +1 -1
- package/dist/cjs/hooks/useLockScroll/useLockScroll.cjs +2 -2
- package/dist/cjs/hooks/useLockScroll/useLockScroll.cjs.map +1 -1
- package/dist/cjs/hooks/useLogger/useLogger.cjs +2 -2
- package/dist/cjs/hooks/useLogger/useLogger.cjs.map +1 -1
- package/dist/cjs/hooks/useLongPress/useLongPress.cjs +2 -2
- package/dist/cjs/hooks/useLongPress/useLongPress.cjs.map +1 -1
- package/dist/cjs/hooks/useMap/useMap.cjs +2 -2
- package/dist/cjs/hooks/useMap/useMap.cjs.map +1 -1
- package/dist/cjs/hooks/useMeasure/useMeasure.cjs +2 -2
- package/dist/cjs/hooks/useMeasure/useMeasure.cjs.map +1 -1
- package/dist/cjs/hooks/useMediaControls/useMediaControls.cjs +2 -2
- package/dist/cjs/hooks/useMediaControls/useMediaControls.cjs.map +1 -1
- package/dist/cjs/hooks/useMediaQuery/useMediaQuery.cjs +2 -2
- package/dist/cjs/hooks/useMediaQuery/useMediaQuery.cjs.map +1 -1
- package/dist/cjs/hooks/useMemory/useMemory.cjs +2 -2
- package/dist/cjs/hooks/useMemory/useMemory.cjs.map +1 -1
- package/dist/cjs/hooks/useMergedRef/useMergedRef.cjs +2 -2
- package/dist/cjs/hooks/useMergedRef/useMergedRef.cjs.map +1 -1
- package/dist/cjs/hooks/useMount/useMount.cjs +2 -2
- package/dist/cjs/hooks/useMount/useMount.cjs.map +1 -1
- package/dist/cjs/hooks/useMouse/useMouse.cjs +2 -2
- package/dist/cjs/hooks/useMouse/useMouse.cjs.map +1 -1
- package/dist/cjs/hooks/useMutation/useMutation.cjs +2 -2
- package/dist/cjs/hooks/useMutation/useMutation.cjs.map +1 -1
- package/dist/cjs/hooks/useMutationObserver/useMutationObserver.cjs +2 -2
- package/dist/cjs/hooks/useMutationObserver/useMutationObserver.cjs.map +1 -1
- package/dist/cjs/hooks/useNetwork/useNetwork.cjs +2 -2
- package/dist/cjs/hooks/useNetwork/useNetwork.cjs.map +1 -1
- package/dist/cjs/hooks/useObjectUrl/useObjectUrl.cjs +2 -0
- package/dist/cjs/hooks/useObjectUrl/useObjectUrl.cjs.map +1 -0
- package/dist/cjs/hooks/useOffsetPagination/useOffsetPagination.cjs +2 -2
- package/dist/cjs/hooks/useOffsetPagination/useOffsetPagination.cjs.map +1 -1
- package/dist/cjs/hooks/useOnce/useOnce.cjs +2 -2
- package/dist/cjs/hooks/useOnce/useOnce.cjs.map +1 -1
- package/dist/cjs/hooks/useOnline/useOnline.cjs +2 -2
- package/dist/cjs/hooks/useOnline/useOnline.cjs.map +1 -1
- package/dist/cjs/hooks/useOperatingSystem/useOperatingSystem.cjs +2 -2
- package/dist/cjs/hooks/useOperatingSystem/useOperatingSystem.cjs.map +1 -1
- package/dist/cjs/hooks/useOptimistic/useOptimistic.cjs +2 -2
- package/dist/cjs/hooks/useOptimistic/useOptimistic.cjs.map +1 -1
- package/dist/cjs/hooks/useOrientation/useOrientation.cjs +2 -2
- package/dist/cjs/hooks/useOrientation/useOrientation.cjs.map +1 -1
- package/dist/cjs/hooks/useOtpCredential/useOtpCredential.cjs +2 -2
- package/dist/cjs/hooks/useOtpCredential/useOtpCredential.cjs.map +1 -1
- package/dist/cjs/hooks/usePageLeave/usePageLeave.cjs +2 -2
- package/dist/cjs/hooks/usePageLeave/usePageLeave.cjs.map +1 -1
- package/dist/cjs/hooks/usePaint/usePaint.cjs +2 -2
- package/dist/cjs/hooks/usePaint/usePaint.cjs.map +1 -1
- package/dist/cjs/hooks/useParallax/useParallax.cjs +2 -2
- package/dist/cjs/hooks/useParallax/useParallax.cjs.map +1 -1
- package/dist/cjs/hooks/usePerformanceObserver/usePerformanceObserver.cjs +2 -2
- package/dist/cjs/hooks/usePerformanceObserver/usePerformanceObserver.cjs.map +1 -1
- package/dist/cjs/hooks/usePermission/usePermission.cjs +2 -2
- package/dist/cjs/hooks/usePermission/usePermission.cjs.map +1 -1
- package/dist/cjs/hooks/usePictureInPicture/usePictureInPicture.cjs +2 -2
- package/dist/cjs/hooks/usePictureInPicture/usePictureInPicture.cjs.map +1 -1
- package/dist/cjs/hooks/usePointerLock/usePointerLock.cjs +2 -2
- package/dist/cjs/hooks/usePointerLock/usePointerLock.cjs.map +1 -1
- package/dist/cjs/hooks/usePostMessage/usePostMessage.cjs +2 -2
- package/dist/cjs/hooks/usePostMessage/usePostMessage.cjs.map +1 -1
- package/dist/cjs/hooks/usePreferredColorScheme/usePreferredColorScheme.cjs +2 -2
- package/dist/cjs/hooks/usePreferredColorScheme/usePreferredColorScheme.cjs.map +1 -1
- package/dist/cjs/hooks/usePreferredContrast/usePreferredContrast.cjs +2 -2
- package/dist/cjs/hooks/usePreferredContrast/usePreferredContrast.cjs.map +1 -1
- package/dist/cjs/hooks/usePreferredDark/usePreferredDark.cjs +2 -2
- package/dist/cjs/hooks/usePreferredDark/usePreferredDark.cjs.map +1 -1
- package/dist/cjs/hooks/usePreferredLanguages/usePreferredLanguages.cjs +2 -2
- package/dist/cjs/hooks/usePreferredLanguages/usePreferredLanguages.cjs.map +1 -1
- package/dist/cjs/hooks/usePreferredReducedMotion/usePreferredReducedMotion.cjs +2 -2
- package/dist/cjs/hooks/usePreferredReducedMotion/usePreferredReducedMotion.cjs.map +1 -1
- package/dist/cjs/hooks/usePrevious/usePrevious.cjs +2 -2
- package/dist/cjs/hooks/usePrevious/usePrevious.cjs.map +1 -1
- package/dist/cjs/hooks/useProgress/useProgress.cjs +2 -2
- package/dist/cjs/hooks/useProgress/useProgress.cjs.map +1 -1
- package/dist/cjs/hooks/useQuery/useQuery.cjs +2 -2
- package/dist/cjs/hooks/useQuery/useQuery.cjs.map +1 -1
- package/dist/cjs/hooks/useQueue/useQueue.cjs +2 -2
- package/dist/cjs/hooks/useQueue/useQueue.cjs.map +1 -1
- package/dist/cjs/hooks/useRaf/useRaf.cjs +2 -2
- package/dist/cjs/hooks/useRaf/useRaf.cjs.map +1 -1
- package/dist/cjs/hooks/useRafState/useRafState.cjs +2 -2
- package/dist/cjs/hooks/useRafState/useRafState.cjs.map +1 -1
- package/dist/cjs/hooks/useRefState/useRefState.cjs +2 -2
- package/dist/cjs/hooks/useRefState/useRefState.cjs.map +1 -1
- package/dist/cjs/hooks/useRenderCount/useRenderCount.cjs +2 -2
- package/dist/cjs/hooks/useRenderCount/useRenderCount.cjs.map +1 -1
- package/dist/cjs/hooks/useRenderInfo/useRenderInfo.cjs +2 -2
- package/dist/cjs/hooks/useRenderInfo/useRenderInfo.cjs.map +1 -1
- package/dist/cjs/hooks/useRerender/useRerender.cjs +2 -2
- package/dist/cjs/hooks/useRerender/useRerender.cjs.map +1 -1
- package/dist/cjs/hooks/useResizeObserver/useResizeObserver.cjs +2 -2
- package/dist/cjs/hooks/useResizeObserver/useResizeObserver.cjs.map +1 -1
- package/dist/cjs/hooks/useRightClick/useRightClick.cjs +2 -2
- package/dist/cjs/hooks/useRightClick/useRightClick.cjs.map +1 -1
- package/dist/cjs/hooks/useScript/useScript.cjs +2 -2
- package/dist/cjs/hooks/useScript/useScript.cjs.map +1 -1
- package/dist/cjs/hooks/useScroll/useScroll.cjs +2 -2
- package/dist/cjs/hooks/useScroll/useScroll.cjs.map +1 -1
- package/dist/cjs/hooks/useScrollIntoView/useScrollIntoView.cjs +2 -2
- package/dist/cjs/hooks/useScrollIntoView/useScrollIntoView.cjs.map +1 -1
- package/dist/cjs/hooks/useScrollTo/useScrollTo.cjs +2 -2
- package/dist/cjs/hooks/useScrollTo/useScrollTo.cjs.map +1 -1
- package/dist/cjs/hooks/useSessionStorage/useSessionStorage.cjs +2 -2
- package/dist/cjs/hooks/useSessionStorage/useSessionStorage.cjs.map +1 -1
- package/dist/cjs/hooks/useSet/useSet.cjs +2 -2
- package/dist/cjs/hooks/useSet/useSet.cjs.map +1 -1
- package/dist/cjs/hooks/useShallowEffect/useShallowEffect.cjs +2 -2
- package/dist/cjs/hooks/useShallowEffect/useShallowEffect.cjs.map +1 -1
- package/dist/cjs/hooks/useShare/useShare.cjs +2 -2
- package/dist/cjs/hooks/useShare/useShare.cjs.map +1 -1
- package/dist/cjs/hooks/useSize/useSize.cjs +2 -2
- package/dist/cjs/hooks/useSize/useSize.cjs.map +1 -1
- package/dist/cjs/hooks/useSpeechRecognition/useSpeechRecognition.cjs +2 -2
- package/dist/cjs/hooks/useSpeechRecognition/useSpeechRecognition.cjs.map +1 -1
- package/dist/cjs/hooks/useSpeechSynthesis/useSpeechSynthesis.cjs +2 -2
- package/dist/cjs/hooks/useSpeechSynthesis/useSpeechSynthesis.cjs.map +1 -1
- package/dist/cjs/hooks/useStateHistory/useStateHistory.cjs +2 -2
- package/dist/cjs/hooks/useStateHistory/useStateHistory.cjs.map +1 -1
- package/dist/cjs/hooks/useStep/useStep.cjs +2 -2
- package/dist/cjs/hooks/useStep/useStep.cjs.map +1 -1
- package/dist/cjs/hooks/useSticky/useSticky.cjs +2 -2
- package/dist/cjs/hooks/useSticky/useSticky.cjs.map +1 -1
- package/dist/cjs/hooks/useStopwatch/useStopwatch.cjs +2 -2
- package/dist/cjs/hooks/useStopwatch/useStopwatch.cjs.map +1 -1
- package/dist/cjs/hooks/useStorage/useStorage.cjs +2 -2
- package/dist/cjs/hooks/useStorage/useStorage.cjs.map +1 -1
- package/dist/cjs/hooks/useTextDirection/useTextDirection.cjs +2 -2
- package/dist/cjs/hooks/useTextDirection/useTextDirection.cjs.map +1 -1
- package/dist/cjs/hooks/useTextSelection/useTextSelection.cjs +2 -2
- package/dist/cjs/hooks/useTextSelection/useTextSelection.cjs.map +1 -1
- package/dist/cjs/hooks/useTextareaAutosize/useTextareaAutosize.cjs +2 -2
- package/dist/cjs/hooks/useTextareaAutosize/useTextareaAutosize.cjs.map +1 -1
- package/dist/cjs/hooks/useThrottleCallback/useThrottleCallback.cjs +2 -2
- package/dist/cjs/hooks/useThrottleCallback/useThrottleCallback.cjs.map +1 -1
- package/dist/cjs/hooks/useThrottleEffect/useThrottleEffect.cjs +2 -2
- package/dist/cjs/hooks/useThrottleEffect/useThrottleEffect.cjs.map +1 -1
- package/dist/cjs/hooks/useThrottleState/useThrottleState.cjs +2 -2
- package/dist/cjs/hooks/useThrottleState/useThrottleState.cjs.map +1 -1
- package/dist/cjs/hooks/useThrottleValue/useThrottleValue.cjs +2 -2
- package/dist/cjs/hooks/useThrottleValue/useThrottleValue.cjs.map +1 -1
- package/dist/cjs/hooks/useTime/useTime.cjs +2 -2
- package/dist/cjs/hooks/useTime/useTime.cjs.map +1 -1
- package/dist/cjs/hooks/useTimeout/useTimeout.cjs +2 -2
- package/dist/cjs/hooks/useTimeout/useTimeout.cjs.map +1 -1
- package/dist/cjs/hooks/useTimer/useTimer.cjs +2 -2
- package/dist/cjs/hooks/useTimer/useTimer.cjs.map +1 -1
- package/dist/cjs/hooks/useToggle/useToggle.cjs +2 -2
- package/dist/cjs/hooks/useToggle/useToggle.cjs.map +1 -1
- package/dist/cjs/hooks/useUnmount/useUnmount.cjs +2 -2
- package/dist/cjs/hooks/useUnmount/useUnmount.cjs.map +1 -1
- package/dist/cjs/hooks/useUrlSearchParam/useUrlSearchParam.cjs +2 -2
- package/dist/cjs/hooks/useUrlSearchParam/useUrlSearchParam.cjs.map +1 -1
- package/dist/cjs/hooks/useUrlSearchParams/useUrlSearchParams.cjs +2 -2
- package/dist/cjs/hooks/useUrlSearchParams/useUrlSearchParams.cjs.map +1 -1
- package/dist/cjs/hooks/useVibrate/useVibrate.cjs +2 -2
- package/dist/cjs/hooks/useVibrate/useVibrate.cjs.map +1 -1
- package/dist/cjs/hooks/useVirtualKeyboard/useVirtualKeyboard.cjs +2 -2
- package/dist/cjs/hooks/useVirtualKeyboard/useVirtualKeyboard.cjs.map +1 -1
- package/dist/cjs/hooks/useVisibility/useVisibility.cjs +2 -2
- package/dist/cjs/hooks/useVisibility/useVisibility.cjs.map +1 -1
- package/dist/cjs/hooks/useWakeLock/useWakeLock.cjs +2 -2
- package/dist/cjs/hooks/useWakeLock/useWakeLock.cjs.map +1 -1
- package/dist/cjs/hooks/useWebSocket/useWebSocket.cjs +2 -2
- package/dist/cjs/hooks/useWebSocket/useWebSocket.cjs.map +1 -1
- package/dist/cjs/hooks/useWindowEvent/useWindowEvent.cjs +2 -2
- package/dist/cjs/hooks/useWindowEvent/useWindowEvent.cjs.map +1 -1
- package/dist/cjs/hooks/useWindowFocus/useWindowFocus.cjs +2 -2
- package/dist/cjs/hooks/useWindowFocus/useWindowFocus.cjs.map +1 -1
- package/dist/cjs/hooks/useWindowScroll/useWindowScroll.cjs +2 -2
- package/dist/cjs/hooks/useWindowScroll/useWindowScroll.cjs.map +1 -1
- package/dist/cjs/hooks/useWindowSize/useWindowSize.cjs +2 -2
- package/dist/cjs/hooks/useWindowSize/useWindowSize.cjs.map +1 -1
- package/dist/cjs/hooks/useWizard/useWizard.cjs +2 -2
- package/dist/cjs/hooks/useWizard/useWizard.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -2
- package/dist/cjs/utils/helpers/copy.cjs +2 -2
- package/dist/cjs/utils/helpers/copy.cjs.map +1 -1
- package/dist/cjs/utils/helpers/debounce.cjs +2 -2
- package/dist/cjs/utils/helpers/debounce.cjs.map +1 -1
- package/dist/cjs/utils/helpers/getDate.cjs +2 -2
- package/dist/cjs/utils/helpers/getDate.cjs.map +1 -1
- package/dist/cjs/utils/helpers/getRetry.cjs +2 -2
- package/dist/cjs/utils/helpers/getRetry.cjs.map +1 -1
- package/dist/cjs/utils/helpers/isTarget.cjs +2 -2
- package/dist/cjs/utils/helpers/isTarget.cjs.map +1 -1
- package/dist/cjs/utils/helpers/throttle.cjs +2 -2
- package/dist/cjs/utils/helpers/throttle.cjs.map +1 -1
- package/dist/esm/helpers/createContext/createContext.mjs +32 -33
- package/dist/esm/helpers/createContext/createContext.mjs.map +1 -1
- package/dist/esm/helpers/createContextHook/createContextHook.mjs +19 -12
- package/dist/esm/helpers/createContextHook/createContextHook.mjs.map +1 -1
- package/dist/esm/helpers/createEventEmitter/createEventEmitter.mjs +34 -33
- package/dist/esm/helpers/createEventEmitter/createEventEmitter.mjs.map +1 -1
- package/dist/esm/helpers/createReactiveContext/createReactiveContext.mjs +53 -53
- package/dist/esm/helpers/createReactiveContext/createReactiveContext.mjs.map +1 -1
- package/dist/esm/helpers/createSharedHook/createSharedHook.mjs +36 -41
- package/dist/esm/helpers/createSharedHook/createSharedHook.mjs.map +1 -1
- package/dist/esm/helpers/createStore/createStore.mjs +25 -29
- package/dist/esm/helpers/createStore/createStore.mjs.map +1 -1
- package/dist/esm/helpers/makeDestructurable/makeDestructurable.mjs +21 -0
- package/dist/esm/helpers/makeDestructurable/makeDestructurable.mjs.map +1 -0
- package/dist/esm/hooks/useActiveElement/useActiveElement.mjs +28 -27
- package/dist/esm/hooks/useActiveElement/useActiveElement.mjs.map +1 -1
- package/dist/esm/hooks/useAsync/useAsync.mjs +22 -21
- package/dist/esm/hooks/useAsync/useAsync.mjs.map +1 -1
- package/dist/esm/hooks/useAsyncEffect/useAsyncEffect.mjs +10 -9
- package/dist/esm/hooks/useAsyncEffect/useAsyncEffect.mjs.map +1 -1
- package/dist/esm/hooks/useAudio/useAudio.mjs +55 -55
- package/dist/esm/hooks/useAudio/useAudio.mjs.map +1 -1
- package/dist/esm/hooks/useAutoScroll/useAutoScroll.mjs +43 -40
- package/dist/esm/hooks/useAutoScroll/useAutoScroll.mjs.map +1 -1
- package/dist/esm/hooks/useBatchedCallback/useBatchedCallback.mjs +20 -19
- package/dist/esm/hooks/useBatchedCallback/useBatchedCallback.mjs.map +1 -1
- package/dist/esm/hooks/useBattery/useBattery.mjs +32 -29
- package/dist/esm/hooks/useBattery/useBattery.mjs.map +1 -1
- package/dist/esm/hooks/useBluetooth/useBluetooth.mjs +35 -33
- package/dist/esm/hooks/useBluetooth/useBluetooth.mjs.map +1 -1
- package/dist/esm/hooks/useBoolean/useBoolean.mjs +9 -8
- package/dist/esm/hooks/useBoolean/useBoolean.mjs.map +1 -1
- package/dist/esm/hooks/useBreakpoints/useBreakpoints.mjs +90 -104
- package/dist/esm/hooks/useBreakpoints/useBreakpoints.mjs.map +1 -1
- package/dist/esm/hooks/useBroadcastChannel/useBroadcastChannel.mjs +30 -31
- package/dist/esm/hooks/useBroadcastChannel/useBroadcastChannel.mjs.map +1 -1
- package/dist/esm/hooks/useBrowserLanguage/useBrowserLanguage.mjs +7 -6
- package/dist/esm/hooks/useBrowserLanguage/useBrowserLanguage.mjs.map +1 -1
- package/dist/esm/hooks/useClickOutside/useClickOutside.mjs +21 -21
- package/dist/esm/hooks/useClickOutside/useClickOutside.mjs.map +1 -1
- package/dist/esm/hooks/useClipboard/useClipboard.mjs +25 -23
- package/dist/esm/hooks/useClipboard/useClipboard.mjs.map +1 -1
- package/dist/esm/hooks/useConst/useConst.mjs +7 -6
- package/dist/esm/hooks/useConst/useConst.mjs.map +1 -1
- package/dist/esm/hooks/useControllableState/useControllableState.mjs +18 -16
- package/dist/esm/hooks/useControllableState/useControllableState.mjs.map +1 -1
- package/dist/esm/hooks/useCookie/useCookie.mjs +53 -56
- package/dist/esm/hooks/useCookie/useCookie.mjs.map +1 -1
- package/dist/esm/hooks/useCookies/useCookies.mjs +38 -37
- package/dist/esm/hooks/useCookies/useCookies.mjs.map +1 -1
- package/dist/esm/hooks/useCopy/useCopy.mjs +15 -10
- package/dist/esm/hooks/useCopy/useCopy.mjs.map +1 -1
- package/dist/esm/hooks/useCounter/useCounter.mjs +26 -22
- package/dist/esm/hooks/useCounter/useCounter.mjs.map +1 -1
- package/dist/esm/hooks/useCssVar/useCssVar.mjs +42 -32
- package/dist/esm/hooks/useCssVar/useCssVar.mjs.map +1 -1
- package/dist/esm/hooks/useDebounceCallback/useDebounceCallback.mjs +18 -17
- package/dist/esm/hooks/useDebounceCallback/useDebounceCallback.mjs.map +1 -1
- package/dist/esm/hooks/useDebounceEffect/useDebounceEffect.mjs +19 -18
- package/dist/esm/hooks/useDebounceEffect/useDebounceEffect.mjs.map +1 -1
- package/dist/esm/hooks/useDebounceState/useDebounceState.mjs +10 -9
- package/dist/esm/hooks/useDebounceState/useDebounceState.mjs.map +1 -1
- package/dist/esm/hooks/useDebounceValue/useDebounceValue.mjs +12 -11
- package/dist/esm/hooks/useDebounceValue/useDebounceValue.mjs.map +1 -1
- package/dist/esm/hooks/useDefault/useDefault.mjs +9 -8
- package/dist/esm/hooks/useDefault/useDefault.mjs.map +1 -1
- package/dist/esm/hooks/useDeviceMotion/useDeviceMotion.mjs +49 -36
- package/dist/esm/hooks/useDeviceMotion/useDeviceMotion.mjs.map +1 -1
- package/dist/esm/hooks/useDeviceOrientation/useDeviceOrientation.mjs +28 -27
- package/dist/esm/hooks/useDeviceOrientation/useDeviceOrientation.mjs.map +1 -1
- package/dist/esm/hooks/useDevicePixelRatio/useDevicePixelRatio.mjs +18 -14
- package/dist/esm/hooks/useDevicePixelRatio/useDevicePixelRatio.mjs.map +1 -1
- package/dist/esm/hooks/useDidUpdate/useDidUpdate.mjs +15 -18
- package/dist/esm/hooks/useDidUpdate/useDidUpdate.mjs.map +1 -1
- package/dist/esm/hooks/useDisclosure/useDisclosure.mjs +14 -8
- package/dist/esm/hooks/useDisclosure/useDisclosure.mjs.map +1 -1
- package/dist/esm/hooks/useDisplayMedia/useDisplayMedia.mjs +39 -39
- package/dist/esm/hooks/useDisplayMedia/useDisplayMedia.mjs.map +1 -1
- package/dist/esm/hooks/useDocumentEvent/useDocumentEvent.mjs +8 -7
- package/dist/esm/hooks/useDocumentEvent/useDocumentEvent.mjs.map +1 -1
- package/dist/esm/hooks/useDocumentTitle/useDocumentTitle.mjs +28 -27
- package/dist/esm/hooks/useDocumentTitle/useDocumentTitle.mjs.map +1 -1
- package/dist/esm/hooks/useDocumentVisibility/useDocumentVisibility.mjs +9 -8
- package/dist/esm/hooks/useDocumentVisibility/useDocumentVisibility.mjs.map +1 -1
- package/dist/esm/hooks/useDoubleClick/useDoubleClick.mjs +25 -28
- package/dist/esm/hooks/useDoubleClick/useDoubleClick.mjs.map +1 -1
- package/dist/esm/hooks/useDropZone/useDropZone.mjs +55 -47
- package/dist/esm/hooks/useDropZone/useDropZone.mjs.map +1 -1
- package/dist/esm/hooks/useEvent/useEvent.mjs +12 -11
- package/dist/esm/hooks/useEvent/useEvent.mjs.map +1 -1
- package/dist/esm/hooks/useEventListener/useEventListener.mjs +24 -19
- package/dist/esm/hooks/useEventListener/useEventListener.mjs.map +1 -1
- package/dist/esm/hooks/useEventSource/useEventSource.mjs +44 -49
- package/dist/esm/hooks/useEventSource/useEventSource.mjs.map +1 -1
- package/dist/esm/hooks/useEyeDropper/useEyeDropper.mjs +17 -16
- package/dist/esm/hooks/useEyeDropper/useEyeDropper.mjs.map +1 -1
- package/dist/esm/hooks/useFavicon/useFavicon.mjs +20 -18
- package/dist/esm/hooks/useFavicon/useFavicon.mjs.map +1 -1
- package/dist/esm/hooks/useField/useField.mjs +61 -67
- package/dist/esm/hooks/useField/useField.mjs.map +1 -1
- package/dist/esm/hooks/useFileDialog/useFileDialog.mjs +34 -32
- package/dist/esm/hooks/useFileDialog/useFileDialog.mjs.map +1 -1
- package/dist/esm/hooks/useFileSystemAccess/useFileSystemAccess.mjs +59 -0
- package/dist/esm/hooks/useFileSystemAccess/useFileSystemAccess.mjs.map +1 -0
- package/dist/esm/hooks/useFocus/useFocus.mjs +43 -34
- package/dist/esm/hooks/useFocus/useFocus.mjs.map +1 -1
- package/dist/esm/hooks/useFocusTrap/useFocusTrap.mjs +51 -36
- package/dist/esm/hooks/useFocusTrap/useFocusTrap.mjs.map +1 -1
- package/dist/esm/hooks/useFps/useFps.mjs +18 -22
- package/dist/esm/hooks/useFps/useFps.mjs.map +1 -1
- package/dist/esm/hooks/useFul/useFul.mjs +8 -7
- package/dist/esm/hooks/useFul/useFul.mjs.map +1 -1
- package/dist/esm/hooks/useFullscreen/useFullscreen.mjs +39 -42
- package/dist/esm/hooks/useFullscreen/useFullscreen.mjs.map +1 -1
- package/dist/esm/hooks/useGamepad/useGamepad.mjs +76 -83
- package/dist/esm/hooks/useGamepad/useGamepad.mjs.map +1 -1
- package/dist/esm/hooks/useGeolocation/useGeolocation.mjs +50 -45
- package/dist/esm/hooks/useGeolocation/useGeolocation.mjs.map +1 -1
- package/dist/esm/hooks/useHash/useHash.mjs +24 -26
- package/dist/esm/hooks/useHash/useHash.mjs.map +1 -1
- package/dist/esm/hooks/useHotkeys/useHotkeys.mjs +35 -37
- package/dist/esm/hooks/useHotkeys/useHotkeys.mjs.map +1 -1
- package/dist/esm/hooks/useHover/useHover.mjs +30 -25
- package/dist/esm/hooks/useHover/useHover.mjs.map +1 -1
- package/dist/esm/hooks/useIdle/useIdle.mjs +29 -26
- package/dist/esm/hooks/useIdle/useIdle.mjs.map +1 -1
- package/dist/esm/hooks/useImage/useImage.mjs +24 -26
- package/dist/esm/hooks/useImage/useImage.mjs.map +1 -1
- package/dist/esm/hooks/useInfiniteScroll/useInfiniteScroll.mjs +38 -32
- package/dist/esm/hooks/useInfiniteScroll/useInfiniteScroll.mjs.map +1 -1
- package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.mjs +38 -37
- package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.mjs.map +1 -1
- package/dist/esm/hooks/useInterval/useInterval.mjs +20 -20
- package/dist/esm/hooks/useInterval/useInterval.mjs.map +1 -1
- package/dist/esm/hooks/useIsFirstRender/useIsFirstRender.mjs +8 -7
- package/dist/esm/hooks/useIsFirstRender/useIsFirstRender.mjs.map +1 -1
- package/dist/esm/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs +7 -6
- package/dist/esm/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs.map +1 -1
- package/dist/esm/hooks/useKeyPress/useKeyPress.mjs +30 -26
- package/dist/esm/hooks/useKeyPress/useKeyPress.mjs.map +1 -1
- package/dist/esm/hooks/useKeyPressEvent/useKeyPressEvent.mjs +33 -35
- package/dist/esm/hooks/useKeyPressEvent/useKeyPressEvent.mjs.map +1 -1
- package/dist/esm/hooks/useKeyboard/useKeyboard.mjs +16 -19
- package/dist/esm/hooks/useKeyboard/useKeyboard.mjs.map +1 -1
- package/dist/esm/hooks/useKeysPressed/useKeysPressed.mjs +36 -25
- package/dist/esm/hooks/useKeysPressed/useKeysPressed.mjs.map +1 -1
- package/dist/esm/hooks/useLastChanged/useLastChanged.mjs +10 -9
- package/dist/esm/hooks/useLastChanged/useLastChanged.mjs.map +1 -1
- package/dist/esm/hooks/useLatest/useLatest.mjs +14 -16
- package/dist/esm/hooks/useLatest/useLatest.mjs.map +1 -1
- package/dist/esm/hooks/useLess/useLess.mjs +9 -8
- package/dist/esm/hooks/useLess/useLess.mjs.map +1 -1
- package/dist/esm/hooks/useList/useList.mjs +22 -22
- package/dist/esm/hooks/useList/useList.mjs.map +1 -1
- package/dist/esm/hooks/useLocalStorage/useLocalStorage.mjs +10 -9
- package/dist/esm/hooks/useLocalStorage/useLocalStorage.mjs.map +1 -1
- package/dist/esm/hooks/useLockCallback/useLockCallback.mjs +18 -17
- package/dist/esm/hooks/useLockCallback/useLockCallback.mjs.map +1 -1
- package/dist/esm/hooks/useLockScroll/useLockScroll.mjs +44 -39
- package/dist/esm/hooks/useLockScroll/useLockScroll.mjs.map +1 -1
- package/dist/esm/hooks/useLogger/useLogger.mjs +10 -9
- package/dist/esm/hooks/useLogger/useLogger.mjs.map +1 -1
- package/dist/esm/hooks/useLongPress/useLongPress.mjs +30 -26
- package/dist/esm/hooks/useLongPress/useLongPress.mjs.map +1 -1
- package/dist/esm/hooks/useMap/useMap.mjs +21 -20
- package/dist/esm/hooks/useMap/useMap.mjs.map +1 -1
- package/dist/esm/hooks/useMeasure/useMeasure.mjs +45 -32
- package/dist/esm/hooks/useMeasure/useMeasure.mjs.map +1 -1
- package/dist/esm/hooks/useMediaControls/useMediaControls.mjs +67 -68
- package/dist/esm/hooks/useMediaControls/useMediaControls.mjs.map +1 -1
- package/dist/esm/hooks/useMediaQuery/useMediaQuery.mjs +12 -17
- package/dist/esm/hooks/useMediaQuery/useMediaQuery.mjs.map +1 -1
- package/dist/esm/hooks/useMemory/useMemory.mjs +20 -18
- package/dist/esm/hooks/useMemory/useMemory.mjs.map +1 -1
- package/dist/esm/hooks/useMergedRef/useMergedRef.mjs +23 -25
- package/dist/esm/hooks/useMergedRef/useMergedRef.mjs.map +1 -1
- package/dist/esm/hooks/useMount/useMount.mjs +7 -6
- package/dist/esm/hooks/useMount/useMount.mjs.map +1 -1
- package/dist/esm/hooks/useMouse/useMouse.mjs +61 -58
- package/dist/esm/hooks/useMouse/useMouse.mjs.map +1 -1
- package/dist/esm/hooks/useMutation/useMutation.mjs +63 -60
- package/dist/esm/hooks/useMutation/useMutation.mjs.map +1 -1
- package/dist/esm/hooks/useMutationObserver/useMutationObserver.mjs +35 -34
- package/dist/esm/hooks/useMutationObserver/useMutationObserver.mjs.map +1 -1
- package/dist/esm/hooks/useNetwork/useNetwork.mjs +47 -48
- package/dist/esm/hooks/useNetwork/useNetwork.mjs.map +1 -1
- package/dist/esm/hooks/useObjectUrl/useObjectUrl.mjs +20 -0
- package/dist/esm/hooks/useObjectUrl/useObjectUrl.mjs.map +1 -0
- package/dist/esm/hooks/useOffsetPagination/useOffsetPagination.mjs +50 -40
- package/dist/esm/hooks/useOffsetPagination/useOffsetPagination.mjs.map +1 -1
- package/dist/esm/hooks/useOnce/useOnce.mjs +13 -13
- package/dist/esm/hooks/useOnce/useOnce.mjs.map +1 -1
- package/dist/esm/hooks/useOnline/useOnline.mjs +9 -8
- package/dist/esm/hooks/useOnline/useOnline.mjs.map +1 -1
- package/dist/esm/hooks/useOperatingSystem/useOperatingSystem.mjs +12 -12
- package/dist/esm/hooks/useOperatingSystem/useOperatingSystem.mjs.map +1 -1
- package/dist/esm/hooks/useOptimistic/useOptimistic.mjs +14 -13
- package/dist/esm/hooks/useOptimistic/useOptimistic.mjs.map +1 -1
- package/dist/esm/hooks/useOrientation/useOrientation.mjs +30 -29
- package/dist/esm/hooks/useOrientation/useOrientation.mjs.map +1 -1
- package/dist/esm/hooks/useOtpCredential/useOtpCredential.mjs +28 -25
- package/dist/esm/hooks/useOtpCredential/useOtpCredential.mjs.map +1 -1
- package/dist/esm/hooks/usePageLeave/usePageLeave.mjs +15 -14
- package/dist/esm/hooks/usePageLeave/usePageLeave.mjs.map +1 -1
- package/dist/esm/hooks/usePaint/usePaint.mjs +139 -151
- package/dist/esm/hooks/usePaint/usePaint.mjs.map +1 -1
- package/dist/esm/hooks/useParallax/useParallax.mjs +90 -96
- package/dist/esm/hooks/useParallax/useParallax.mjs.map +1 -1
- package/dist/esm/hooks/usePerformanceObserver/usePerformanceObserver.mjs +29 -23
- package/dist/esm/hooks/usePerformanceObserver/usePerformanceObserver.mjs.map +1 -1
- package/dist/esm/hooks/usePermission/usePermission.mjs +25 -27
- package/dist/esm/hooks/usePermission/usePermission.mjs.map +1 -1
- package/dist/esm/hooks/usePictureInPicture/usePictureInPicture.mjs +42 -38
- package/dist/esm/hooks/usePictureInPicture/usePictureInPicture.mjs.map +1 -1
- package/dist/esm/hooks/usePointerLock/usePointerLock.mjs +31 -30
- package/dist/esm/hooks/usePointerLock/usePointerLock.mjs.map +1 -1
- package/dist/esm/hooks/usePostMessage/usePostMessage.mjs +22 -23
- package/dist/esm/hooks/usePostMessage/usePostMessage.mjs.map +1 -1
- package/dist/esm/hooks/usePreferredColorScheme/usePreferredColorScheme.mjs +8 -7
- package/dist/esm/hooks/usePreferredColorScheme/usePreferredColorScheme.mjs.map +1 -1
- package/dist/esm/hooks/usePreferredContrast/usePreferredContrast.mjs +8 -7
- package/dist/esm/hooks/usePreferredContrast/usePreferredContrast.mjs.map +1 -1
- package/dist/esm/hooks/usePreferredDark/usePreferredDark.mjs +6 -5
- package/dist/esm/hooks/usePreferredDark/usePreferredDark.mjs.map +1 -1
- package/dist/esm/hooks/usePreferredLanguages/usePreferredLanguages.mjs +9 -8
- package/dist/esm/hooks/usePreferredLanguages/usePreferredLanguages.mjs.map +1 -1
- package/dist/esm/hooks/usePreferredReducedMotion/usePreferredReducedMotion.mjs +6 -5
- package/dist/esm/hooks/usePreferredReducedMotion/usePreferredReducedMotion.mjs.map +1 -1
- package/dist/esm/hooks/usePrevious/usePrevious.mjs +9 -8
- package/dist/esm/hooks/usePrevious/usePrevious.mjs.map +1 -1
- package/dist/esm/hooks/useProgress/useProgress.mjs +28 -24
- package/dist/esm/hooks/useProgress/useProgress.mjs.map +1 -1
- package/dist/esm/hooks/useQuery/useQuery.mjs +61 -52
- package/dist/esm/hooks/useQuery/useQuery.mjs.map +1 -1
- package/dist/esm/hooks/useQueue/useQueue.mjs +23 -22
- package/dist/esm/hooks/useQueue/useQueue.mjs.map +1 -1
- package/dist/esm/hooks/useRaf/useRaf.mjs +32 -29
- package/dist/esm/hooks/useRaf/useRaf.mjs.map +1 -1
- package/dist/esm/hooks/useRafState/useRafState.mjs +12 -11
- package/dist/esm/hooks/useRafState/useRafState.mjs.map +1 -1
- package/dist/esm/hooks/useRefState/useRefState.mjs +24 -24
- package/dist/esm/hooks/useRefState/useRefState.mjs.map +1 -1
- package/dist/esm/hooks/useRenderCount/useRenderCount.mjs +11 -10
- package/dist/esm/hooks/useRenderCount/useRenderCount.mjs.map +1 -1
- package/dist/esm/hooks/useRenderInfo/useRenderInfo.mjs +14 -13
- package/dist/esm/hooks/useRenderInfo/useRenderInfo.mjs.map +1 -1
- package/dist/esm/hooks/useRerender/useRerender.mjs +6 -5
- package/dist/esm/hooks/useRerender/useRerender.mjs.map +1 -1
- package/dist/esm/hooks/useResizeObserver/useResizeObserver.mjs +33 -24
- package/dist/esm/hooks/useResizeObserver/useResizeObserver.mjs.map +1 -1
- package/dist/esm/hooks/useRightClick/useRightClick.mjs +37 -34
- package/dist/esm/hooks/useRightClick/useRightClick.mjs.map +1 -1
- package/dist/esm/hooks/useScript/useScript.mjs +28 -31
- package/dist/esm/hooks/useScript/useScript.mjs.map +1 -1
- package/dist/esm/hooks/useScroll/useScroll.mjs +95 -81
- package/dist/esm/hooks/useScroll/useScroll.mjs.map +1 -1
- package/dist/esm/hooks/useScrollIntoView/useScrollIntoView.mjs +33 -34
- package/dist/esm/hooks/useScrollIntoView/useScrollIntoView.mjs.map +1 -1
- package/dist/esm/hooks/useScrollTo/useScrollTo.mjs +33 -21
- package/dist/esm/hooks/useScrollTo/useScrollTo.mjs.map +1 -1
- package/dist/esm/hooks/useSessionStorage/useSessionStorage.mjs +10 -9
- package/dist/esm/hooks/useSessionStorage/useSessionStorage.mjs.map +1 -1
- package/dist/esm/hooks/useSet/useSet.mjs +30 -29
- package/dist/esm/hooks/useSet/useSet.mjs.map +1 -1
- package/dist/esm/hooks/useShallowEffect/useShallowEffect.mjs +20 -22
- package/dist/esm/hooks/useShallowEffect/useShallowEffect.mjs.map +1 -1
- package/dist/esm/hooks/useShare/useShare.mjs +18 -14
- package/dist/esm/hooks/useShare/useShare.mjs.map +1 -1
- package/dist/esm/hooks/useSize/useSize.mjs +40 -30
- package/dist/esm/hooks/useSize/useSize.mjs.map +1 -1
- package/dist/esm/hooks/useSpeechRecognition/useSpeechRecognition.mjs +34 -44
- package/dist/esm/hooks/useSpeechRecognition/useSpeechRecognition.mjs.map +1 -1
- package/dist/esm/hooks/useSpeechSynthesis/useSpeechSynthesis.mjs +65 -64
- package/dist/esm/hooks/useSpeechSynthesis/useSpeechSynthesis.mjs.map +1 -1
- package/dist/esm/hooks/useStateHistory/useStateHistory.mjs +96 -84
- package/dist/esm/hooks/useStateHistory/useStateHistory.mjs.map +1 -1
- package/dist/esm/hooks/useStep/useStep.mjs +27 -28
- package/dist/esm/hooks/useStep/useStep.mjs.map +1 -1
- package/dist/esm/hooks/useSticky/useSticky.mjs +36 -30
- package/dist/esm/hooks/useSticky/useSticky.mjs.map +1 -1
- package/dist/esm/hooks/useStopwatch/useStopwatch.mjs +59 -57
- package/dist/esm/hooks/useStopwatch/useStopwatch.mjs.map +1 -1
- package/dist/esm/hooks/useStorage/useStorage.mjs +61 -62
- package/dist/esm/hooks/useStorage/useStorage.mjs.map +1 -1
- package/dist/esm/hooks/useTextDirection/useTextDirection.mjs +35 -30
- package/dist/esm/hooks/useTextDirection/useTextDirection.mjs.map +1 -1
- package/dist/esm/hooks/useTextSelection/useTextSelection.mjs +25 -27
- package/dist/esm/hooks/useTextSelection/useTextSelection.mjs.map +1 -1
- package/dist/esm/hooks/useTextareaAutosize/useTextareaAutosize.mjs +53 -52
- package/dist/esm/hooks/useTextareaAutosize/useTextareaAutosize.mjs.map +1 -1
- package/dist/esm/hooks/useThrottleCallback/useThrottleCallback.mjs +18 -17
- package/dist/esm/hooks/useThrottleCallback/useThrottleCallback.mjs.map +1 -1
- package/dist/esm/hooks/useThrottleEffect/useThrottleEffect.mjs +21 -21
- package/dist/esm/hooks/useThrottleEffect/useThrottleEffect.mjs.map +1 -1
- package/dist/esm/hooks/useThrottleState/useThrottleState.mjs +10 -9
- package/dist/esm/hooks/useThrottleState/useThrottleState.mjs.map +1 -1
- package/dist/esm/hooks/useThrottleValue/useThrottleValue.mjs +12 -11
- package/dist/esm/hooks/useThrottleValue/useThrottleValue.mjs.map +1 -1
- package/dist/esm/hooks/useTime/useTime.mjs +14 -13
- package/dist/esm/hooks/useTime/useTime.mjs.map +1 -1
- package/dist/esm/hooks/useTimeout/useTimeout.mjs +19 -15
- package/dist/esm/hooks/useTimeout/useTimeout.mjs.map +1 -1
- package/dist/esm/hooks/useTimer/useTimer.mjs +61 -66
- package/dist/esm/hooks/useTimer/useTimer.mjs.map +1 -1
- package/dist/esm/hooks/useToggle/useToggle.mjs +12 -11
- package/dist/esm/hooks/useToggle/useToggle.mjs.map +1 -1
- package/dist/esm/hooks/useUnmount/useUnmount.mjs +11 -13
- package/dist/esm/hooks/useUnmount/useUnmount.mjs.map +1 -1
- package/dist/esm/hooks/useUrlSearchParam/useUrlSearchParam.mjs +66 -76
- package/dist/esm/hooks/useUrlSearchParam/useUrlSearchParam.mjs.map +1 -1
- package/dist/esm/hooks/useUrlSearchParams/useUrlSearchParams.mjs +50 -60
- package/dist/esm/hooks/useUrlSearchParams/useUrlSearchParams.mjs.map +1 -1
- package/dist/esm/hooks/useVibrate/useVibrate.mjs +28 -21
- package/dist/esm/hooks/useVibrate/useVibrate.mjs.map +1 -1
- package/dist/esm/hooks/useVirtualKeyboard/useVirtualKeyboard.mjs +30 -29
- package/dist/esm/hooks/useVirtualKeyboard/useVirtualKeyboard.mjs.map +1 -1
- package/dist/esm/hooks/useVisibility/useVisibility.mjs +41 -39
- package/dist/esm/hooks/useVisibility/useVisibility.mjs.map +1 -1
- package/dist/esm/hooks/useWakeLock/useWakeLock.mjs +28 -23
- package/dist/esm/hooks/useWakeLock/useWakeLock.mjs.map +1 -1
- package/dist/esm/hooks/useWebSocket/useWebSocket.mjs +38 -35
- package/dist/esm/hooks/useWebSocket/useWebSocket.mjs.map +1 -1
- package/dist/esm/hooks/useWindowEvent/useWindowEvent.mjs +7 -6
- package/dist/esm/hooks/useWindowEvent/useWindowEvent.mjs.map +1 -1
- package/dist/esm/hooks/useWindowFocus/useWindowFocus.mjs +14 -13
- package/dist/esm/hooks/useWindowFocus/useWindowFocus.mjs.map +1 -1
- package/dist/esm/hooks/useWindowScroll/useWindowScroll.mjs +29 -21
- package/dist/esm/hooks/useWindowScroll/useWindowScroll.mjs.map +1 -1
- package/dist/esm/hooks/useWindowSize/useWindowSize.mjs +24 -23
- package/dist/esm/hooks/useWindowSize/useWindowSize.mjs.map +1 -1
- package/dist/esm/hooks/useWizard/useWizard.mjs +25 -20
- package/dist/esm/hooks/useWizard/useWizard.mjs.map +1 -1
- package/dist/esm/index.mjs +173 -394
- package/dist/esm/utils/helpers/copy.mjs +18 -18
- package/dist/esm/utils/helpers/copy.mjs.map +1 -1
- package/dist/esm/utils/helpers/debounce.mjs +10 -10
- package/dist/esm/utils/helpers/debounce.mjs.map +1 -1
- package/dist/esm/utils/helpers/getDate.mjs +20 -16
- package/dist/esm/utils/helpers/getDate.mjs.map +1 -1
- package/dist/esm/utils/helpers/getRetry.mjs +6 -5
- package/dist/esm/utils/helpers/getRetry.mjs.map +1 -1
- package/dist/esm/utils/helpers/isTarget.mjs +10 -19
- package/dist/esm/utils/helpers/isTarget.mjs.map +1 -1
- package/dist/esm/utils/helpers/throttle.mjs +20 -20
- package/dist/esm/utils/helpers/throttle.mjs.map +1 -1
- package/dist/types/helpers/index.d.ts +1 -0
- package/dist/types/helpers/makeDestructurable/makeDestructurable.d.ts +16 -0
- package/dist/types/hooks/browser.d.ts +2 -0
- package/dist/types/hooks/useEventListener/useEventListener.d.ts +0 -22
- package/dist/types/hooks/useField/useField.d.ts +2 -2
- package/dist/types/hooks/useFileSystemAccess/useFileSystemAccess.d.ts +116 -0
- package/dist/types/hooks/useKeyboard/useKeyboard.d.ts +4 -2
- package/dist/types/hooks/useObjectUrl/useObjectUrl.d.ts +24 -0
- package/dist/types/hooks/usePerformanceObserver/usePerformanceObserver.d.ts +1 -0
- package/dist/types/hooks/useScrollIntoView/useScrollIntoView.d.ts +1 -1
- package/dist/types/hooks/useWebSocket/useWebSocket.d.ts +1 -0
- package/package.json +5 -5
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBluetooth.cjs","sources":["../../../../src/hooks/useBluetooth/useBluetooth.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/** The use bluetooth return type */\nexport interface UseBluetoothReturn {\n /** Indicates if bluetooth device is currently connected */\n connected: boolean;\n /** Describe connected bluetooth device */\n device?: BluetoothDevice;\n /** The GATT server for connected bluetooth device */\n server?: BluetoothRemoteGATTServer;\n /** Whether the bluetooth is supported*/\n supported: boolean;\n /** Function to request bluetooth device from the user */\n requestDevice: () => Promise<void>;\n}\n\n/** The use bluetooth options type */\nexport interface UseBluetoothOptions {\n /** The options to request all bluetooth devices */\n acceptAllDevices?: boolean;\n /** Array of filters to apply when scanning bluetooth devices */\n filters?: BluetoothLEScanFilter[];\n /** Array of optional services that the application can use */\n optionalServices?: BluetoothServiceUUID[];\n}\n\n/**\n * @name useBluetooth\n * @description - Hook for getting information about bluetooth\n * @category Browser\n * @usage low\n *\n * @browserapi navigator.bluetooth https://developer.mozilla.org/en-US/docs/Web/API/Navigator/bluetooth\n *\n * @param {boolean} [options.acceptAllDevices=false] The options to request all Bluetooth devices\n * @param {Array<BluetoothLEScanFilter>} [options.filters] Array of filters to apply when scanning Bluetooth devices\n * @param {Array<BluetoothServiceUUID>} [options.optionalServices] Array of optional services that the application can use\n * @returns {UseBluetoothReturn} Object containing battery information & Battery API support\n *\n * @example\n * const { supported, connected, device, requestDevice, server } = useBluetooth(options);\n */\nexport const useBluetooth = (options?: UseBluetoothOptions): UseBluetoothReturn => {\n const supported =\n typeof navigator !== 'undefined' && 'bluetooth' in navigator && !!navigator.bluetooth;\n const { acceptAllDevices = false, filters, optionalServices } = options ?? {};\n\n const [connected, setIsConnected] = useState(false);\n const [device, setDevice] = useState<BluetoothDevice | undefined>(undefined);\n const [server, setServer] = useState<BluetoothRemoteGATTServer | undefined>(undefined);\n\n const requestDevice = async () => {\n if (!supported) return;\n\n const selectedDevice = await navigator.bluetooth.requestDevice({\n acceptAllDevices,\n optionalServices,\n ...(filters && { filters, acceptAllDevices: false })\n });\n\n setDevice(selectedDevice);\n };\n\n useEffect(() => {\n if (!device?.gatt) return;\n\n const connectToBluetoothGATTServer = async () => {\n const gattServer = await device.gatt!.connect();\n setServer(gattServer);\n setIsConnected(gattServer.connected);\n };\n\n const reset = () => {\n setServer(undefined);\n setDevice(undefined);\n setIsConnected(false);\n };\n\n device.addEventListener('gattserverdisconnected', reset);\n connectToBluetoothGATTServer();\n\n return () => {\n device.removeEventListener('gattserverdisconnected', reset);\n device.gatt?.disconnect();\n };\n }, [device]);\n\n return {\n supported,\n connected,\n device,\n requestDevice,\n server\n };\n};\n"],"
|
|
1
|
+
{"version":3,"file":"useBluetooth.cjs","names":[],"sources":["../../../../src/hooks/useBluetooth/useBluetooth.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/** The use bluetooth return type */\nexport interface UseBluetoothReturn {\n /** Indicates if bluetooth device is currently connected */\n connected: boolean;\n /** Describe connected bluetooth device */\n device?: BluetoothDevice;\n /** The GATT server for connected bluetooth device */\n server?: BluetoothRemoteGATTServer;\n /** Whether the bluetooth is supported*/\n supported: boolean;\n /** Function to request bluetooth device from the user */\n requestDevice: () => Promise<void>;\n}\n\n/** The use bluetooth options type */\nexport interface UseBluetoothOptions {\n /** The options to request all bluetooth devices */\n acceptAllDevices?: boolean;\n /** Array of filters to apply when scanning bluetooth devices */\n filters?: BluetoothLEScanFilter[];\n /** Array of optional services that the application can use */\n optionalServices?: BluetoothServiceUUID[];\n}\n\n/**\n * @name useBluetooth\n * @description - Hook for getting information about bluetooth\n * @category Browser\n * @usage low\n *\n * @browserapi navigator.bluetooth https://developer.mozilla.org/en-US/docs/Web/API/Navigator/bluetooth\n *\n * @param {boolean} [options.acceptAllDevices=false] The options to request all Bluetooth devices\n * @param {Array<BluetoothLEScanFilter>} [options.filters] Array of filters to apply when scanning Bluetooth devices\n * @param {Array<BluetoothServiceUUID>} [options.optionalServices] Array of optional services that the application can use\n * @returns {UseBluetoothReturn} Object containing battery information & Battery API support\n *\n * @example\n * const { supported, connected, device, requestDevice, server } = useBluetooth(options);\n */\nexport const useBluetooth = (options?: UseBluetoothOptions): UseBluetoothReturn => {\n const supported =\n typeof navigator !== 'undefined' && 'bluetooth' in navigator && !!navigator.bluetooth;\n const { acceptAllDevices = false, filters, optionalServices } = options ?? {};\n\n const [connected, setIsConnected] = useState(false);\n const [device, setDevice] = useState<BluetoothDevice | undefined>(undefined);\n const [server, setServer] = useState<BluetoothRemoteGATTServer | undefined>(undefined);\n\n const requestDevice = async () => {\n if (!supported) return;\n\n const selectedDevice = await navigator.bluetooth.requestDevice({\n acceptAllDevices,\n optionalServices,\n ...(filters && { filters, acceptAllDevices: false })\n });\n\n setDevice(selectedDevice);\n };\n\n useEffect(() => {\n if (!device?.gatt) return;\n\n const connectToBluetoothGATTServer = async () => {\n const gattServer = await device.gatt!.connect();\n setServer(gattServer);\n setIsConnected(gattServer.connected);\n };\n\n const reset = () => {\n setServer(undefined);\n setDevice(undefined);\n setIsConnected(false);\n };\n\n device.addEventListener('gattserverdisconnected', reset);\n connectToBluetoothGATTServer();\n\n return () => {\n device.removeEventListener('gattserverdisconnected', reset);\n device.gatt?.disconnect();\n };\n }, [device]);\n\n return {\n supported,\n connected,\n device,\n requestDevice,\n server\n };\n};\n"],"mappings":"uEA0CA,IAAa,EAAgB,GAAsD,CACjF,IAAM,EACJ,OAAO,UAAc,KAAe,cAAe,WAAa,CAAC,CAAC,UAAU,UACxE,CAAE,mBAAmB,GAAO,UAAS,oBAAqB,GAAW,EAAE,CAEvE,CAAC,EAAW,IAAA,EAAA,EAAA,UAA2B,GAAM,CAC7C,CAAC,EAAQ,IAAA,EAAA,EAAA,UAAmD,IAAA,GAAU,CACtE,CAAC,EAAQ,IAAA,EAAA,EAAA,UAA6D,IAAA,GAAU,CAsCtF,OAxBA,EAAA,EAAA,eAAgB,CACd,GAAI,CAAC,GAAQ,KAAM,OAEnB,IAAM,EAA+B,SAAY,CAC/C,IAAM,EAAa,MAAM,EAAO,KAAM,SAAS,CAC/C,EAAU,EAAW,CACrB,EAAe,EAAW,UAAU,EAGhC,MAAc,CAClB,EAAU,IAAA,GAAU,CACpB,EAAU,IAAA,GAAU,CACpB,EAAe,GAAM,EAMvB,OAHA,EAAO,iBAAiB,yBAA0B,EAAM,CACxD,GAA8B,KAEjB,CACX,EAAO,oBAAoB,yBAA0B,EAAM,CAC3D,EAAO,MAAM,YAAY,GAE1B,CAAC,EAAO,CAAC,CAEL,CACL,YACA,YACA,SACA,cAxCoB,SAAY,CAC3B,GAQL,EANuB,MAAM,UAAU,UAAU,cAAc,CAC7D,mBACA,mBACA,GAAI,GAAW,CAAE,UAAS,iBAAkB,GAAO,CACpD,CAAC,CAEuB,EAgCzB,SACD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=useBoolean.cjs.map
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`react`);var t=(t=!1)=>{let[n,r]=(0,e.useState)(t);return[n,e=>r(t=>e??!t)]};exports.useBoolean=t;
|
|
2
|
+
//# sourceMappingURL=useBoolean.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBoolean.cjs","sources":["../../../../src/hooks/useBoolean/useBoolean.ts"],"sourcesContent":["import { useState } from 'react';\n\n/** The use boolean return type */\nexport type UseBooleanReturn = [\n /** The current boolean state value */\n value: boolean,\n /** Function to toggle the boolean state */\n toggle: (value?: boolean) => void\n];\n\n/**\n * @name useBoolean\n * @description - Hook provides opportunity to manage boolean state\n * @category State\n * @usage necessary\n\n * @param {boolean} [initialValue=false] The initial boolean value\n * @returns {UseBooleanReturn} An object containing the boolean state value and utility functions to manipulate the state\n *\n * @example\n * const [on, toggle] = useBoolean()\n */\nexport const useBoolean = (initialValue = false): UseBooleanReturn => {\n const [value, setValue] = useState(initialValue);\n const toggle = (value?: boolean) => setValue((prevValue) => value ?? !prevValue);\n\n return [value, toggle];\n};\n"],"
|
|
1
|
+
{"version":3,"file":"useBoolean.cjs","names":[],"sources":["../../../../src/hooks/useBoolean/useBoolean.ts"],"sourcesContent":["import { useState } from 'react';\n\n/** The use boolean return type */\nexport type UseBooleanReturn = [\n /** The current boolean state value */\n value: boolean,\n /** Function to toggle the boolean state */\n toggle: (value?: boolean) => void\n];\n\n/**\n * @name useBoolean\n * @description - Hook provides opportunity to manage boolean state\n * @category State\n * @usage necessary\n\n * @param {boolean} [initialValue=false] The initial boolean value\n * @returns {UseBooleanReturn} An object containing the boolean state value and utility functions to manipulate the state\n *\n * @example\n * const [on, toggle] = useBoolean()\n */\nexport const useBoolean = (initialValue = false): UseBooleanReturn => {\n const [value, setValue] = useState(initialValue);\n const toggle = (value?: boolean) => setValue((prevValue) => value ?? !prevValue);\n\n return [value, toggle];\n};\n"],"mappings":"uEAsBA,IAAa,GAAc,EAAe,KAA4B,CACpE,GAAM,CAAC,EAAO,IAAA,EAAA,EAAA,UAAqB,EAAa,CAGhD,MAAO,CAAC,EAFQ,GAAoB,EAAU,GAAc,GAAS,CAAC,EAAU,CAE1D"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=useBreakpoints.cjs.map
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../useRerender/useRerender.cjs`);let t=require(`react`);var n=e=>typeof window<`u`&&window.matchMedia(e).matches,r=(r,i=`mobile-first`)=>{let a=e.useRerender(),o=(e,t)=>t?`${Number(r[e])+t}px`:`${r[e]}px`;(0,t.useEffect)(()=>{let e=a;return window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},[]);let s=e=>n(`(min-width: ${o(e)})`),c=e=>n(`(max-width: ${o(e)})`),l=()=>Object.keys(r).map(e=>[e,s(e)]).filter(([,e])=>e).map(([e])=>e);return{current:l,greaterOrEqual:s,smallerOrEqual:c,active:()=>{let e=l();return e.length?e.at(-1):void 0},greater:e=>n(`(min-width: ${o(e,.1)})`),smaller:e=>n(`(max-width: ${o(e,-.1)})`),between:(e,t)=>n(`(min-width: ${o(e)}) and (max-width: ${o(t,-.1)})`),...Object.keys(r).reduce((e,t)=>(e[t]=i===`mobile-first`?s(t):c(t),e),{})}},i={xs:0,sm:600,md:900,lg:1200,xl:1536},a={xs:576,sm:768,md:992,lg:1200,xl:1408},o={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},s={xs:0,sm:576,md:768,lg:992,xl:1200,xxl:1400},c={xs:480,sm:576,md:768,lg:992,xl:1200,xxl:1600},l={xs:0,sm:600,md:1024,lg:1440,xl:1920},u={mobileS:320,mobileM:375,mobileL:425,tablet:768,laptop:1024,laptopL:1440,desktop4K:2560},d={"3xs":360,"2xs":480,xs:600,sm:768,md:1024,lg:1280,xl:1440,"2xl":1600,"3xl":1920,"4xl":2560},f={sm:576,md:768,lg:992,xl:1200};exports.BREAKPOINTS_ANT_DESIGN=c,exports.BREAKPOINTS_BOOTSTRAP_V5=s,exports.BREAKPOINTS_MANTINE=a,exports.BREAKPOINTS_MASTER_CSS=d,exports.BREAKPOINTS_MATERIAL_UI=i,exports.BREAKPOINTS_PRIME_FLEX=f,exports.BREAKPOINTS_QUASAR_V2=l,exports.BREAKPOINTS_SEMANTIC=u,exports.BREAKPOINTS_TAILWIND=o,exports.useBreakpoints=r;
|
|
2
|
+
//# sourceMappingURL=useBreakpoints.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBreakpoints.cjs","sources":["../../../../src/hooks/useBreakpoints/useBreakpoints.ts"],"sourcesContent":["import { useEffect } from 'react';\n\nimport { useRerender } from '../useRerender/useRerender';\n\n/** The breakpoints type */\nexport type Breakpoints<Breakpoint extends string = string> = Record<Breakpoint, number>;\n\n/** The use breakpoints strategy */\nexport type UseBreakpointsStrategy = 'desktop-first' | 'mobile-first';\n\nconst match = (query: string) => typeof window !== 'undefined' && window.matchMedia(query).matches;\n\n/** The use breakpoints return type */\nexport type UseBreakpointsReturn<Breakpoint extends string = string> = {\n /** The function that checks if the current breakpoint is greater than to the given breakpoint */\n greater: (breakpoint: Breakpoint) => boolean;\n /** The function that checks if the current breakpoint is greater than or equal to the given breakpoint */\n greaterOrEqual: (breakpoint: Breakpoint) => boolean;\n /** The function that checks if the current breakpoint is smaller than to the given breakpoint */\n smaller: (breakpoint: Breakpoint) => boolean;\n /** The function that checks if the current breakpoint is smaller than or equal to the given breakpoint */\n smallerOrEqual: (breakpoint: Breakpoint) => boolean;\n /** The function that checks if the current breakpoint is between to the given breakpoints */\n between: (a: Breakpoint, b: Breakpoint) => boolean;\n /** The function that returns the current breakpoints */\n current: () => Breakpoint[];\n /** The function that returns the current active breakpoint */\n active: () => Breakpoint;\n} & Record<Breakpoint, boolean>;\n\n/**\n * @name useBreakpoints\n * @description - Hook that manages breakpoints\n * @category Browser\n * @usage medium\n *\n * @template {string} Breakpoint The name of the breakpoint\n * @param {Breakpoints<Breakpoint>} breakpoints The breakpoints to use\n * @param {UseBreakpointsStrategy} [strategy=min-width] The strategy to use for matching\n * @returns {UseBreakpointsReturn<Breakpoint>} An object containing the current breakpoint\n *\n * @example\n * const { greater, smaller, between, current, active, ...breakpoints } = useBreakpoints({ mobile: 0, tablet: 640, laptop: 1024, desktop: 1280 });\n */\nexport const useBreakpoints = <Breakpoint extends string>(\n breakpoints: Breakpoints<Breakpoint>,\n strategy: UseBreakpointsStrategy = 'mobile-first'\n): UseBreakpointsReturn<Breakpoint> => {\n const rerender = useRerender();\n\n const getValue = (breakpoint: Breakpoint, delta?: number) => {\n if (delta) return `${Number(breakpoints[breakpoint]) + delta}px`;\n return `${breakpoints[breakpoint]}px`;\n };\n\n useEffect(() => {\n const onResize = rerender;\n window.addEventListener('resize', onResize);\n return () => {\n window.removeEventListener('resize', onResize);\n };\n }, []);\n\n const greaterOrEqual = (breakpoint: Breakpoint) => match(`(min-width: ${getValue(breakpoint)})`);\n const smallerOrEqual = (breakpoint: Breakpoint) => match(`(max-width: ${getValue(breakpoint)})`);\n\n const current = () =>\n Object.keys(breakpoints)\n .map((breakpoint) => [breakpoint, greaterOrEqual(breakpoint as Breakpoint)])\n .filter(([, value]) => value)\n .map(([breakpoint]) => breakpoint) as Breakpoint[];\n\n const active = () => {\n const breakpoints = current();\n return (breakpoints.length ? breakpoints.at(-1) : undefined) as Breakpoint;\n };\n\n const greater = (breakpoint: Breakpoint) => match(`(min-width: ${getValue(breakpoint, 0.1)})`);\n const smaller = (breakpoint: Breakpoint) => match(`(max-width: ${getValue(breakpoint, -0.1)})`);\n const between = (a: Breakpoint, b: Breakpoint) =>\n match(`(min-width: ${getValue(a)}) and (max-width: ${getValue(b, -0.1)})`);\n\n const breakpointsKeys = (Object.keys(breakpoints) as Breakpoint[]).reduce(\n (acc, breakpoint) => {\n const value =\n strategy === 'mobile-first' ? greaterOrEqual(breakpoint) : smallerOrEqual(breakpoint);\n acc[breakpoint] = value;\n return acc;\n },\n {} as Record<Breakpoint, boolean>\n );\n\n return {\n current,\n greaterOrEqual,\n smallerOrEqual,\n active,\n greater,\n smaller,\n between,\n ...breakpointsKeys\n };\n};\n\n/** Breakpoints from Material UI */\nexport const BREAKPOINTS_MATERIAL_UI = {\n xs: 0,\n sm: 600,\n md: 900,\n lg: 1200,\n xl: 1536\n};\n\n/** Breakpoints from Mantine */\nexport const BREAKPOINTS_MANTINE = {\n xs: 576,\n sm: 768,\n md: 992,\n lg: 1200,\n xl: 1408\n};\n\n/** Breakpoints from Tailwind */\nexport const BREAKPOINTS_TAILWIND = {\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n '2xl': 1536\n};\n\n/** Breakpoints from Bootstrap V5 */\nexport const BREAKPOINTS_BOOTSTRAP_V5 = {\n xs: 0,\n sm: 576,\n md: 768,\n lg: 992,\n xl: 1200,\n xxl: 1400\n};\n\n/** Breakpoints from Ant Design */\nexport const BREAKPOINTS_ANT_DESIGN = {\n xs: 480,\n sm: 576,\n md: 768,\n lg: 992,\n xl: 1200,\n xxl: 1600\n};\n\n/** Breakpoints from Quasar V2 */\nexport const BREAKPOINTS_QUASAR_V2 = {\n xs: 0,\n sm: 600,\n md: 1024,\n lg: 1440,\n xl: 1920\n};\n\n/** Sematic Breakpoints */\nexport const BREAKPOINTS_SEMANTIC = {\n mobileS: 320,\n mobileM: 375,\n mobileL: 425,\n tablet: 768,\n laptop: 1024,\n laptopL: 1440,\n desktop4K: 2560\n};\n\n/** Breakpoints from Master CSS */\nexport const BREAKPOINTS_MASTER_CSS = {\n '3xs': 360,\n '2xs': 480,\n xs: 600,\n sm: 768,\n md: 1024,\n lg: 1280,\n xl: 1440,\n '2xl': 1600,\n '3xl': 1920,\n '4xl': 2560\n};\n\n/** Breakpoints from PrimeFlex */\nexport const BREAKPOINTS_PRIME_FLEX = {\n sm: 576,\n md: 768,\n lg: 992,\n xl: 1200\n};\n"],"
|
|
1
|
+
{"version":3,"file":"useBreakpoints.cjs","names":[],"sources":["../../../../src/hooks/useBreakpoints/useBreakpoints.ts"],"sourcesContent":["import { useEffect } from 'react';\n\nimport { useRerender } from '../useRerender/useRerender';\n\n/** The breakpoints type */\nexport type Breakpoints<Breakpoint extends string = string> = Record<Breakpoint, number>;\n\n/** The use breakpoints strategy */\nexport type UseBreakpointsStrategy = 'desktop-first' | 'mobile-first';\n\nconst match = (query: string) => typeof window !== 'undefined' && window.matchMedia(query).matches;\n\n/** The use breakpoints return type */\nexport type UseBreakpointsReturn<Breakpoint extends string = string> = {\n /** The function that checks if the current breakpoint is greater than to the given breakpoint */\n greater: (breakpoint: Breakpoint) => boolean;\n /** The function that checks if the current breakpoint is greater than or equal to the given breakpoint */\n greaterOrEqual: (breakpoint: Breakpoint) => boolean;\n /** The function that checks if the current breakpoint is smaller than to the given breakpoint */\n smaller: (breakpoint: Breakpoint) => boolean;\n /** The function that checks if the current breakpoint is smaller than or equal to the given breakpoint */\n smallerOrEqual: (breakpoint: Breakpoint) => boolean;\n /** The function that checks if the current breakpoint is between to the given breakpoints */\n between: (a: Breakpoint, b: Breakpoint) => boolean;\n /** The function that returns the current breakpoints */\n current: () => Breakpoint[];\n /** The function that returns the current active breakpoint */\n active: () => Breakpoint;\n} & Record<Breakpoint, boolean>;\n\n/**\n * @name useBreakpoints\n * @description - Hook that manages breakpoints\n * @category Browser\n * @usage medium\n *\n * @template {string} Breakpoint The name of the breakpoint\n * @param {Breakpoints<Breakpoint>} breakpoints The breakpoints to use\n * @param {UseBreakpointsStrategy} [strategy=min-width] The strategy to use for matching\n * @returns {UseBreakpointsReturn<Breakpoint>} An object containing the current breakpoint\n *\n * @example\n * const { greater, smaller, between, current, active, ...breakpoints } = useBreakpoints({ mobile: 0, tablet: 640, laptop: 1024, desktop: 1280 });\n */\nexport const useBreakpoints = <Breakpoint extends string>(\n breakpoints: Breakpoints<Breakpoint>,\n strategy: UseBreakpointsStrategy = 'mobile-first'\n): UseBreakpointsReturn<Breakpoint> => {\n const rerender = useRerender();\n\n const getValue = (breakpoint: Breakpoint, delta?: number) => {\n if (delta) return `${Number(breakpoints[breakpoint]) + delta}px`;\n return `${breakpoints[breakpoint]}px`;\n };\n\n useEffect(() => {\n const onResize = rerender;\n window.addEventListener('resize', onResize);\n return () => {\n window.removeEventListener('resize', onResize);\n };\n }, []);\n\n const greaterOrEqual = (breakpoint: Breakpoint) => match(`(min-width: ${getValue(breakpoint)})`);\n const smallerOrEqual = (breakpoint: Breakpoint) => match(`(max-width: ${getValue(breakpoint)})`);\n\n const current = () =>\n Object.keys(breakpoints)\n .map((breakpoint) => [breakpoint, greaterOrEqual(breakpoint as Breakpoint)])\n .filter(([, value]) => value)\n .map(([breakpoint]) => breakpoint) as Breakpoint[];\n\n const active = () => {\n const breakpoints = current();\n return (breakpoints.length ? breakpoints.at(-1) : undefined) as Breakpoint;\n };\n\n const greater = (breakpoint: Breakpoint) => match(`(min-width: ${getValue(breakpoint, 0.1)})`);\n const smaller = (breakpoint: Breakpoint) => match(`(max-width: ${getValue(breakpoint, -0.1)})`);\n const between = (a: Breakpoint, b: Breakpoint) =>\n match(`(min-width: ${getValue(a)}) and (max-width: ${getValue(b, -0.1)})`);\n\n const breakpointsKeys = (Object.keys(breakpoints) as Breakpoint[]).reduce(\n (acc, breakpoint) => {\n const value =\n strategy === 'mobile-first' ? greaterOrEqual(breakpoint) : smallerOrEqual(breakpoint);\n acc[breakpoint] = value;\n return acc;\n },\n {} as Record<Breakpoint, boolean>\n );\n\n return {\n current,\n greaterOrEqual,\n smallerOrEqual,\n active,\n greater,\n smaller,\n between,\n ...breakpointsKeys\n };\n};\n\n/** Breakpoints from Material UI */\nexport const BREAKPOINTS_MATERIAL_UI = {\n xs: 0,\n sm: 600,\n md: 900,\n lg: 1200,\n xl: 1536\n};\n\n/** Breakpoints from Mantine */\nexport const BREAKPOINTS_MANTINE = {\n xs: 576,\n sm: 768,\n md: 992,\n lg: 1200,\n xl: 1408\n};\n\n/** Breakpoints from Tailwind */\nexport const BREAKPOINTS_TAILWIND = {\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n '2xl': 1536\n};\n\n/** Breakpoints from Bootstrap V5 */\nexport const BREAKPOINTS_BOOTSTRAP_V5 = {\n xs: 0,\n sm: 576,\n md: 768,\n lg: 992,\n xl: 1200,\n xxl: 1400\n};\n\n/** Breakpoints from Ant Design */\nexport const BREAKPOINTS_ANT_DESIGN = {\n xs: 480,\n sm: 576,\n md: 768,\n lg: 992,\n xl: 1200,\n xxl: 1600\n};\n\n/** Breakpoints from Quasar V2 */\nexport const BREAKPOINTS_QUASAR_V2 = {\n xs: 0,\n sm: 600,\n md: 1024,\n lg: 1440,\n xl: 1920\n};\n\n/** Sematic Breakpoints */\nexport const BREAKPOINTS_SEMANTIC = {\n mobileS: 320,\n mobileM: 375,\n mobileL: 425,\n tablet: 768,\n laptop: 1024,\n laptopL: 1440,\n desktop4K: 2560\n};\n\n/** Breakpoints from Master CSS */\nexport const BREAKPOINTS_MASTER_CSS = {\n '3xs': 360,\n '2xs': 480,\n xs: 600,\n sm: 768,\n md: 1024,\n lg: 1280,\n xl: 1440,\n '2xl': 1600,\n '3xl': 1920,\n '4xl': 2560\n};\n\n/** Breakpoints from PrimeFlex */\nexport const BREAKPOINTS_PRIME_FLEX = {\n sm: 576,\n md: 768,\n lg: 992,\n xl: 1200\n};\n"],"mappings":"yHAUA,IAAM,EAAS,GAAkB,OAAO,OAAW,KAAe,OAAO,WAAW,EAAM,CAAC,QAkC9E,GACX,EACA,EAAmC,iBACE,CACrC,IAAM,EAAW,EAAA,aAAa,CAExB,GAAY,EAAwB,IACpC,EAAc,GAAG,OAAO,EAAY,GAAY,CAAG,EAAM,IACtD,GAAG,EAAY,GAAY,KAGpC,EAAA,EAAA,eAAgB,CACd,IAAM,EAAW,EAEjB,OADA,OAAO,iBAAiB,SAAU,EAAS,KAC9B,CACX,OAAO,oBAAoB,SAAU,EAAS,GAE/C,EAAE,CAAC,CAEN,IAAM,EAAkB,GAA2B,EAAM,eAAe,EAAS,EAAW,CAAC,GAAG,CAC1F,EAAkB,GAA2B,EAAM,eAAe,EAAS,EAAW,CAAC,GAAG,CAE1F,MACJ,OAAO,KAAK,EAAY,CACrB,IAAK,GAAe,CAAC,EAAY,EAAe,EAAyB,CAAC,CAAC,CAC3E,QAAQ,EAAG,KAAW,EAAM,CAC5B,KAAK,CAAC,KAAgB,EAAW,CAsBtC,MAAO,CACL,UACA,iBACA,iBACA,WAxBmB,CACnB,IAAM,EAAc,GAAS,CAC7B,OAAQ,EAAY,OAAS,EAAY,GAAG,GAAG,CAAG,IAAA,IAuBlD,QApBe,GAA2B,EAAM,eAAe,EAAS,EAAY,GAAI,CAAC,GAAG,CAqB5F,QApBe,GAA2B,EAAM,eAAe,EAAS,EAAY,IAAK,CAAC,GAAG,CAqB7F,SApBe,EAAe,IAC9B,EAAM,eAAe,EAAS,EAAE,CAAC,oBAAoB,EAAS,EAAG,IAAK,CAAC,GAAG,CAoB1E,GAlBuB,OAAO,KAAK,EAAY,CAAkB,QAChE,EAAK,KAGJ,EAAI,GADF,IAAa,eAAiB,EAAe,EAAW,CAAG,EAAe,EAAW,CAEhF,GAET,EAAE,CACH,CAWA,EAIU,EAA0B,CACrC,GAAI,EACJ,GAAI,IACJ,GAAI,IACJ,GAAI,KACJ,GAAI,KACL,CAGY,EAAsB,CACjC,GAAI,IACJ,GAAI,IACJ,GAAI,IACJ,GAAI,KACJ,GAAI,KACL,CAGY,EAAuB,CAClC,GAAI,IACJ,GAAI,IACJ,GAAI,KACJ,GAAI,KACJ,MAAO,KACR,CAGY,EAA2B,CACtC,GAAI,EACJ,GAAI,IACJ,GAAI,IACJ,GAAI,IACJ,GAAI,KACJ,IAAK,KACN,CAGY,EAAyB,CACpC,GAAI,IACJ,GAAI,IACJ,GAAI,IACJ,GAAI,IACJ,GAAI,KACJ,IAAK,KACN,CAGY,EAAwB,CACnC,GAAI,EACJ,GAAI,IACJ,GAAI,KACJ,GAAI,KACJ,GAAI,KACL,CAGY,EAAuB,CAClC,QAAS,IACT,QAAS,IACT,QAAS,IACT,OAAQ,IACR,OAAQ,KACR,QAAS,KACT,UAAW,KACZ,CAGY,EAAyB,CACpC,MAAO,IACP,MAAO,IACP,GAAI,IACJ,GAAI,IACJ,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,MAAO,KACP,MAAO,KACP,MAAO,KACR,CAGY,EAAyB,CACpC,GAAI,IACJ,GAAI,IACJ,GAAI,IACJ,GAAI,KACL"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=useBroadcastChannel.cjs.map
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`react`);var t=(t,n)=>{let r=typeof window<`u`&&`BroadcastChannel`in window&&!!window.BroadcastChannel,[i,a]=(0,e.useState)(!1),[o,s]=(0,e.useState)(),[c,l]=(0,e.useState)(),u=(0,e.useRef)(void 0);return(0,e.useEffect)(()=>{if(!r)return;u.current=new BroadcastChannel(t);let e=e=>{s(e.data),n?.(e.data)},i=e=>l(e),o=()=>a(!0);return u.current.addEventListener(`message`,e),u.current.addEventListener(`messageerror`,i),u.current.addEventListener(`close`,o),()=>{u.current&&(u.current.removeEventListener(`message`,e),u.current.removeEventListener(`messageerror`,i),u.current.removeEventListener(`close`,o),u.current.close())}},[t]),{supported:r,channel:u.current,data:o,post:e=>{console.log(`post`,e,u.current),u.current&&u.current.postMessage(e)},close:()=>{u.current&&(u.current.close(),a(!0))},error:c,closed:i}};exports.useBroadcastChannel=t;
|
|
2
|
+
//# sourceMappingURL=useBroadcastChannel.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBroadcastChannel.cjs","sources":["../../../../src/hooks/useBroadcastChannel/useBroadcastChannel.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\n/** The use broadcast channel return type */\nexport interface UseBroadcastChannelReturn<Data = unknown> {\n /** The underlying BroadcastChannel instance if supported, undefined otherwise */\n channel?: BroadcastChannel;\n /** Whether the channel has been closed */\n closed: boolean;\n /** The most recently received data from other contexts */\n data?: Data;\n /** Error object if any error occurred during channel operations */\n error?: Event;\n /** Whether the BroadcastChannel API is supported in the current environment */\n supported: boolean;\n /** Function to close the channel and clean up resources */\n close: () => void;\n /** Function to send data to other contexts through the channel */\n post: (data: Data) => void;\n}\n\n/**\n * @name useBroadcastChannel\n * @description Hook that provides cross-tab/window communication\n * @category Browser\n * @usage low\n *\n * @browserapi BroadcastChannel https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel\n *\n * @param {string} name The name of the channel\n * @param {Function} callback A callback function that will be called when a message is received\n * @returns {UseBroadcastChannelReturn} An object containing the channel state and controls\n *\n * @example\n * const { supported, data, post, error } = useBroadcastChannel('channel');\n */\nexport const useBroadcastChannel = <Data = unknown>(\n name: string,\n callback?: (data: Data) => void\n): UseBroadcastChannelReturn<Data> => {\n const supported =\n typeof window !== 'undefined' && 'BroadcastChannel' in window && !!window.BroadcastChannel;\n\n const [closed, setClosed] = useState(false);\n const [data, setData] = useState<Data>();\n const [error, setError] = useState<MessageEvent>();\n const channelRef = useRef<BroadcastChannel>(undefined);\n\n useEffect(() => {\n if (!supported) return;\n\n channelRef.current = new BroadcastChannel(name);\n\n const onMessage = (event: MessageEvent) => {\n setData(event.data);\n callback?.(event.data);\n };\n const onMessageError = (event: MessageEvent) => setError(event);\n const onClose = () => setClosed(true);\n\n channelRef.current.addEventListener('message', onMessage);\n channelRef.current.addEventListener('messageerror', onMessageError);\n channelRef.current.addEventListener('close', onClose);\n\n return () => {\n if (channelRef.current) {\n channelRef.current.removeEventListener('message', onMessage);\n channelRef.current.removeEventListener('messageerror', onMessageError);\n channelRef.current.removeEventListener('close', onClose);\n channelRef.current.close();\n }\n };\n }, [name]);\n\n const post = (data: Data) => {\n console.log('post', data, channelRef.current);\n if (!channelRef.current) return;\n channelRef.current.postMessage(data);\n };\n\n const close = () => {\n if (!channelRef.current) return;\n channelRef.current.close();\n setClosed(true);\n };\n\n return {\n supported,\n channel: channelRef.current,\n data,\n post,\n close,\n error,\n closed\n };\n};\n"],"
|
|
1
|
+
{"version":3,"file":"useBroadcastChannel.cjs","names":[],"sources":["../../../../src/hooks/useBroadcastChannel/useBroadcastChannel.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\n/** The use broadcast channel return type */\nexport interface UseBroadcastChannelReturn<Data = unknown> {\n /** The underlying BroadcastChannel instance if supported, undefined otherwise */\n channel?: BroadcastChannel;\n /** Whether the channel has been closed */\n closed: boolean;\n /** The most recently received data from other contexts */\n data?: Data;\n /** Error object if any error occurred during channel operations */\n error?: Event;\n /** Whether the BroadcastChannel API is supported in the current environment */\n supported: boolean;\n /** Function to close the channel and clean up resources */\n close: () => void;\n /** Function to send data to other contexts through the channel */\n post: (data: Data) => void;\n}\n\n/**\n * @name useBroadcastChannel\n * @description Hook that provides cross-tab/window communication\n * @category Browser\n * @usage low\n *\n * @browserapi BroadcastChannel https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel\n *\n * @param {string} name The name of the channel\n * @param {Function} callback A callback function that will be called when a message is received\n * @returns {UseBroadcastChannelReturn} An object containing the channel state and controls\n *\n * @example\n * const { supported, data, post, error } = useBroadcastChannel('channel');\n */\nexport const useBroadcastChannel = <Data = unknown>(\n name: string,\n callback?: (data: Data) => void\n): UseBroadcastChannelReturn<Data> => {\n const supported =\n typeof window !== 'undefined' && 'BroadcastChannel' in window && !!window.BroadcastChannel;\n\n const [closed, setClosed] = useState(false);\n const [data, setData] = useState<Data>();\n const [error, setError] = useState<MessageEvent>();\n const channelRef = useRef<BroadcastChannel>(undefined);\n\n useEffect(() => {\n if (!supported) return;\n\n channelRef.current = new BroadcastChannel(name);\n\n const onMessage = (event: MessageEvent) => {\n setData(event.data);\n callback?.(event.data);\n };\n const onMessageError = (event: MessageEvent) => setError(event);\n const onClose = () => setClosed(true);\n\n channelRef.current.addEventListener('message', onMessage);\n channelRef.current.addEventListener('messageerror', onMessageError);\n channelRef.current.addEventListener('close', onClose);\n\n return () => {\n if (channelRef.current) {\n channelRef.current.removeEventListener('message', onMessage);\n channelRef.current.removeEventListener('messageerror', onMessageError);\n channelRef.current.removeEventListener('close', onClose);\n channelRef.current.close();\n }\n };\n }, [name]);\n\n const post = (data: Data) => {\n console.log('post', data, channelRef.current);\n if (!channelRef.current) return;\n channelRef.current.postMessage(data);\n };\n\n const close = () => {\n if (!channelRef.current) return;\n channelRef.current.close();\n setClosed(true);\n };\n\n return {\n supported,\n channel: channelRef.current,\n data,\n post,\n close,\n error,\n closed\n };\n};\n"],"mappings":"uEAmCA,IAAa,GACX,EACA,IACoC,CACpC,IAAM,EACJ,OAAO,OAAW,KAAe,qBAAsB,QAAU,CAAC,CAAC,OAAO,iBAEtE,CAAC,EAAQ,IAAA,EAAA,EAAA,UAAsB,GAAM,CACrC,CAAC,EAAM,IAAA,EAAA,EAAA,WAA2B,CAClC,CAAC,EAAO,IAAA,EAAA,EAAA,WAAoC,CAC5C,GAAA,EAAA,EAAA,QAAsC,IAAA,GAAU,CAwCtD,OAtCA,EAAA,EAAA,eAAgB,CACd,GAAI,CAAC,EAAW,OAEhB,EAAW,QAAU,IAAI,iBAAiB,EAAK,CAE/C,IAAM,EAAa,GAAwB,CACzC,EAAQ,EAAM,KAAK,CACnB,IAAW,EAAM,KAAK,EAElB,EAAkB,GAAwB,EAAS,EAAM,CACzD,MAAgB,EAAU,GAAK,CAMrC,OAJA,EAAW,QAAQ,iBAAiB,UAAW,EAAU,CACzD,EAAW,QAAQ,iBAAiB,eAAgB,EAAe,CACnE,EAAW,QAAQ,iBAAiB,QAAS,EAAQ,KAExC,CACP,EAAW,UACb,EAAW,QAAQ,oBAAoB,UAAW,EAAU,CAC5D,EAAW,QAAQ,oBAAoB,eAAgB,EAAe,CACtE,EAAW,QAAQ,oBAAoB,QAAS,EAAQ,CACxD,EAAW,QAAQ,OAAO,IAG7B,CAAC,EAAK,CAAC,CAcH,CACL,YACA,QAAS,EAAW,QACpB,OACA,KAhBY,GAAe,CAC3B,QAAQ,IAAI,OAAQ,EAAM,EAAW,QAAQ,CACxC,EAAW,SAChB,EAAW,QAAQ,YAAY,EAAK,EAcpC,UAXkB,CACb,EAAW,UAChB,EAAW,QAAQ,OAAO,CAC1B,EAAU,GAAK,GASf,QACA,SACD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=useBrowserLanguage.cjs.map
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`react`);var t=()=>navigator.language,n=()=>`undetermined`,r=e=>(window.addEventListener(`languagechange`,e),()=>window.removeEventListener(`languagechange`,e)),i=()=>(0,e.useSyncExternalStore)(r,t,n);exports.useBrowserLanguage=i;
|
|
2
|
+
//# sourceMappingURL=useBrowserLanguage.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBrowserLanguage.cjs","sources":["../../../../src/hooks/useBrowserLanguage/useBrowserLanguage.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\n\nconst getSnapshot = () => navigator.language;\nconst getServerSnapshot = () => 'undetermined';\nconst subscribe = (callback: () => void) => {\n window.addEventListener('languagechange', callback);\n return () => window.removeEventListener('languagechange', callback);\n};\n\n/**\n * @name useBrowserLanguage\n * @description - Hook that returns the current browser language\n * @category User\n * @usage medium\n\n * @browserapi navigator.language https://developer.mozilla.org/en-US/docs/Web/API/Navigator/language\n *\n * @returns {string} The current browser language\n *\n * @example\n * const browserLanguage = useBrowserLanguage();\n */\nexport const useBrowserLanguage = () =>\n useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n"],"
|
|
1
|
+
{"version":3,"file":"useBrowserLanguage.cjs","names":[],"sources":["../../../../src/hooks/useBrowserLanguage/useBrowserLanguage.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\n\nconst getSnapshot = () => navigator.language;\nconst getServerSnapshot = () => 'undetermined';\nconst subscribe = (callback: () => void) => {\n window.addEventListener('languagechange', callback);\n return () => window.removeEventListener('languagechange', callback);\n};\n\n/**\n * @name useBrowserLanguage\n * @description - Hook that returns the current browser language\n * @category User\n * @usage medium\n\n * @browserapi navigator.language https://developer.mozilla.org/en-US/docs/Web/API/Navigator/language\n *\n * @returns {string} The current browser language\n *\n * @example\n * const browserLanguage = useBrowserLanguage();\n */\nexport const useBrowserLanguage = () =>\n useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n"],"mappings":"uEAEA,IAAM,MAAoB,UAAU,SAC9B,MAA0B,eAC1B,EAAa,IACjB,OAAO,iBAAiB,iBAAkB,EAAS,KACtC,OAAO,oBAAoB,iBAAkB,EAAS,EAgBxD,OAAA,EAAA,EAAA,sBACU,EAAW,EAAa,EAAkB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=useClickOutside.cjs.map
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils/helpers/isTarget.cjs`),t=require(`../useRefState/useRefState.cjs`);let n=require(`react`);var r=((...r)=>{let i=e.isTarget(r[0])?r[0]:void 0,a=r[1]?r[1]:r[0],o=t.useRefState(),s=(0,n.useRef)(a);if(s.current=a,(0,n.useEffect)(()=>{if(!i&&!o.state)return;let t=i?e.isTarget.getElement(i):o.current;if(!t)return;let n=e=>{t.contains(e.target)||s.current(e)};return document.addEventListener(`click`,n),()=>{document.removeEventListener(`click`,n)}},[i&&e.isTarget.getRawElement(i),o.state]),!i)return{ref:o}});exports.useClickOutside=r;
|
|
2
|
+
//# sourceMappingURL=useClickOutside.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useClickOutside.cjs","sources":["../../../../src/hooks/useClickOutside/useClickOutside.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\nimport type { HookTarget } from '@/utils/helpers';\n\nimport { isTarget } from '@/utils/helpers';\n\nimport type { StateRef } from '../useRefState/useRefState';\n\nimport { useRefState } from '../useRefState/useRefState';\n\nexport interface UseClickOutside {\n (target: HookTarget, callback: (event: Event) => void): void;\n\n <Target extends Element>(\n callback: (event: Event) => void,\n target?: never\n ): {\n ref: StateRef<Target>;\n };\n}\n\n/**\n * @name useClickOutside\n * @description - Hook to handle click events outside the specified target element(s)\n * @category Elements \n * @usage necessary\n\n * @overload\n * @param {HookTarget} target The target element(s) to detect outside clicks for\n * @param {(event: Event) => void} callback The callback to execute when a click outside the target is detected\n * @returns {void}\n *\n * @example\n * useClickOutside(ref, () => console.log('click outside'));\n *\n * @overload\n * @template Target The target element(s)\n * @param {(event: Event) => void} callback The callback to execute when a click outside the target is detected\n * @returns {{ ref: StateRef<Target> }} A ref to attach to the target element\n *\n * @example\n * const { ref } = useClickOutside<HTMLDivElement>(() => console.log('click outside'));\n *\n * @see {@link https://siberiacancode.github.io/reactuse/functions/hooks/useClickOutside.html}\n */\nexport const useClickOutside = ((...params: any[]) => {\n const target = (isTarget(params[0]) ? params[0] : undefined) as HookTarget | undefined;\n const callback = (params[1] ? params[1] : params[0]) as (event: Event) => void;\n\n const internalRef = useRefState<Element>();\n const internalCallbackRef = useRef(callback);\n internalCallbackRef.current = callback;\n\n useEffect(() => {\n if (!target && !internalRef.state) return;\n\n const element = (target ? isTarget.getElement(target) : internalRef.current) as Element;\n\n if (!element) return;\n\n const onClick = (event: Event) => {\n if (!element.contains(event.target as Node)) {\n internalCallbackRef.current(event);\n }\n };\n\n document.addEventListener('click', onClick);\n\n return () => {\n document.removeEventListener('click', onClick);\n };\n }, [target && isTarget.getRawElement(target), internalRef.state]);\n if (target) return;\n return { ref: internalRef };\n}) as UseClickOutside;\n"],"
|
|
1
|
+
{"version":3,"file":"useClickOutside.cjs","names":[],"sources":["../../../../src/hooks/useClickOutside/useClickOutside.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\nimport type { HookTarget } from '@/utils/helpers';\n\nimport { isTarget } from '@/utils/helpers';\n\nimport type { StateRef } from '../useRefState/useRefState';\n\nimport { useRefState } from '../useRefState/useRefState';\n\nexport interface UseClickOutside {\n (target: HookTarget, callback: (event: Event) => void): void;\n\n <Target extends Element>(\n callback: (event: Event) => void,\n target?: never\n ): {\n ref: StateRef<Target>;\n };\n}\n\n/**\n * @name useClickOutside\n * @description - Hook to handle click events outside the specified target element(s)\n * @category Elements \n * @usage necessary\n\n * @overload\n * @param {HookTarget} target The target element(s) to detect outside clicks for\n * @param {(event: Event) => void} callback The callback to execute when a click outside the target is detected\n * @returns {void}\n *\n * @example\n * useClickOutside(ref, () => console.log('click outside'));\n *\n * @overload\n * @template Target The target element(s)\n * @param {(event: Event) => void} callback The callback to execute when a click outside the target is detected\n * @returns {{ ref: StateRef<Target> }} A ref to attach to the target element\n *\n * @example\n * const { ref } = useClickOutside<HTMLDivElement>(() => console.log('click outside'));\n *\n * @see {@link https://siberiacancode.github.io/reactuse/functions/hooks/useClickOutside.html}\n */\nexport const useClickOutside = ((...params: any[]) => {\n const target = (isTarget(params[0]) ? params[0] : undefined) as HookTarget | undefined;\n const callback = (params[1] ? params[1] : params[0]) as (event: Event) => void;\n\n const internalRef = useRefState<Element>();\n const internalCallbackRef = useRef(callback);\n internalCallbackRef.current = callback;\n\n useEffect(() => {\n if (!target && !internalRef.state) return;\n\n const element = (target ? isTarget.getElement(target) : internalRef.current) as Element;\n\n if (!element) return;\n\n const onClick = (event: Event) => {\n if (!element.contains(event.target as Node)) {\n internalCallbackRef.current(event);\n }\n };\n\n document.addEventListener('click', onClick);\n\n return () => {\n document.removeEventListener('click', onClick);\n };\n }, [target && isTarget.getRawElement(target), internalRef.state]);\n if (target) return;\n return { ref: internalRef };\n}) as UseClickOutside;\n"],"mappings":"uKA6CA,IAAa,IAAoB,GAAG,IAAkB,CACpD,IAAM,EAAU,EAAA,SAAS,EAAO,GAAG,CAAG,EAAO,GAAK,IAAA,GAC5C,EAAY,EAAO,GAAK,EAAO,GAAK,EAAO,GAE3C,EAAc,EAAA,aAAsB,CACpC,GAAA,EAAA,EAAA,QAA6B,EAAS,CAC5C,KAAoB,QAAU,GAE9B,EAAA,EAAA,eAAgB,CACd,GAAI,CAAC,GAAU,CAAC,EAAY,MAAO,OAEnC,IAAM,EAAW,EAAS,EAAA,SAAS,WAAW,EAAO,CAAG,EAAY,QAEpE,GAAI,CAAC,EAAS,OAEd,IAAM,EAAW,GAAiB,CAC3B,EAAQ,SAAS,EAAM,OAAe,EACzC,EAAoB,QAAQ,EAAM,EAMtC,OAFA,SAAS,iBAAiB,QAAS,EAAQ,KAE9B,CACX,SAAS,oBAAoB,QAAS,EAAQ,GAE/C,CAAC,GAAU,EAAA,SAAS,cAAc,EAAO,CAAE,EAAY,MAAM,CAAC,CAC7D,GACJ,MAAO,CAAE,IAAK,EAAa"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=useClipboard.cjs.map
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils/helpers/copy.cjs`);let t=require(`react`);var n=n=>{let[r,i]=(0,t.useState)(null),a=n?.enabled??!1,o=async()=>{try{i(await navigator.clipboard.readText())}catch{i(document.getSelection?.()?.toString()??``)}};return(0,t.useEffect)(()=>{if(a)return document.addEventListener(`copy`,o),document.addEventListener(`cut`,o),()=>{document.removeEventListener(`copy`,o),document.removeEventListener(`cut`,o)}},[a]),{value:r,copy:async t=>{e.copy(t),i(t)}}};exports.useClipboard=n;
|
|
2
|
+
//# sourceMappingURL=useClipboard.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useClipboard.cjs","sources":["../../../../src/hooks/useClipboard/useClipboard.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { copy } from '@/utils/helpers';\n\n/** The use copy to clipboard return type */\nexport interface UseCopyToClipboardReturn {\n /** The copied value */\n value: string | null;\n /** Function to copy to clipboard */\n copy: (value: string) => Promise<void>;\n}\n\n/** The use copy to clipboard params type */\nexport interface UseCopyToClipboardParams {\n /** Whether the copy to clipboard is enabled */\n enabled: boolean;\n}\n\n/**\n * @name useClipboard\n * @description - Hook that manages a copy to clipboard\n * @category Browser\n * @usage medium\n\n * @browserapi navigator.clipboard https://developer.mozilla.org/en-US/docs/Web/API/Navigator/clipboard\n *\n * @param {boolean} [params.enabled=false] Whether the copy to clipboard is enabled\n * @returns {UseCopyToClipboardReturn} An object containing the boolean state value and utility functions to manipulate the state\n *\n * @example\n * const { value, copy } = useClipboard();\n */\nexport const useClipboard = (params?: UseCopyToClipboardParams): UseCopyToClipboardReturn => {\n const [value, setValue] = useState<string | null>(null);\n const enabled = params?.enabled ?? false;\n\n const set = async () => {\n try {\n const value = await navigator.clipboard.readText();\n setValue(value);\n } catch {\n setValue(document.getSelection?.()?.toString() ?? '');\n }\n };\n\n useEffect(() => {\n if (!enabled) return;\n\n document.addEventListener('copy', set);\n document.addEventListener('cut', set);\n return () => {\n document.removeEventListener('copy', set);\n document.removeEventListener('cut', set);\n };\n }, [enabled]);\n\n const copyToClipboard = async (value: string) => {\n copy(value);\n setValue(value);\n };\n\n return { value, copy: copyToClipboard };\n};\n"],"
|
|
1
|
+
{"version":3,"file":"useClipboard.cjs","names":[],"sources":["../../../../src/hooks/useClipboard/useClipboard.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { copy } from '@/utils/helpers';\n\n/** The use copy to clipboard return type */\nexport interface UseCopyToClipboardReturn {\n /** The copied value */\n value: string | null;\n /** Function to copy to clipboard */\n copy: (value: string) => Promise<void>;\n}\n\n/** The use copy to clipboard params type */\nexport interface UseCopyToClipboardParams {\n /** Whether the copy to clipboard is enabled */\n enabled: boolean;\n}\n\n/**\n * @name useClipboard\n * @description - Hook that manages a copy to clipboard\n * @category Browser\n * @usage medium\n\n * @browserapi navigator.clipboard https://developer.mozilla.org/en-US/docs/Web/API/Navigator/clipboard\n *\n * @param {boolean} [params.enabled=false] Whether the copy to clipboard is enabled\n * @returns {UseCopyToClipboardReturn} An object containing the boolean state value and utility functions to manipulate the state\n *\n * @example\n * const { value, copy } = useClipboard();\n */\nexport const useClipboard = (params?: UseCopyToClipboardParams): UseCopyToClipboardReturn => {\n const [value, setValue] = useState<string | null>(null);\n const enabled = params?.enabled ?? false;\n\n const set = async () => {\n try {\n const value = await navigator.clipboard.readText();\n setValue(value);\n } catch {\n setValue(document.getSelection?.()?.toString() ?? '');\n }\n };\n\n useEffect(() => {\n if (!enabled) return;\n\n document.addEventListener('copy', set);\n document.addEventListener('cut', set);\n return () => {\n document.removeEventListener('copy', set);\n document.removeEventListener('cut', set);\n };\n }, [enabled]);\n\n const copyToClipboard = async (value: string) => {\n copy(value);\n setValue(value);\n };\n\n return { value, copy: copyToClipboard };\n};\n"],"mappings":"uHAgCA,IAAa,EAAgB,GAAgE,CAC3F,GAAM,CAAC,EAAO,IAAA,EAAA,EAAA,UAAoC,KAAK,CACjD,EAAU,GAAQ,SAAW,GAE7B,EAAM,SAAY,CACtB,GAAI,CAEF,EADc,MAAM,UAAU,UAAU,UAAU,CACnC,MACT,CACN,EAAS,SAAS,gBAAgB,EAAE,UAAU,EAAI,GAAG,GAoBzD,OAhBA,EAAA,EAAA,eAAgB,CACT,KAIL,OAFA,SAAS,iBAAiB,OAAQ,EAAI,CACtC,SAAS,iBAAiB,MAAO,EAAI,KACxB,CACX,SAAS,oBAAoB,OAAQ,EAAI,CACzC,SAAS,oBAAoB,MAAO,EAAI,GAEzC,CAAC,EAAQ,CAAC,CAON,CAAE,QAAO,KALQ,KAAO,IAAkB,CAC/C,EAAA,KAAK,EAAM,CACX,EAAS,EAAM,EAGsB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=useConst.cjs.map
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`react`);var t=t=>(0,e.useRef)(typeof t==`function`?t():t).current;exports.useConst=t;
|
|
2
|
+
//# sourceMappingURL=useConst.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConst.cjs","sources":["../../../../src/hooks/useConst/useConst.ts"],"sourcesContent":["import { useRef } from 'react';\n\n/**\n * @name useConst\n * @description - Hook that returns the constant value\n * @category Utilities\n * @usage high\n\n * @template Value The type of the value\n * @param {(() => Value) | Value} initialValue The initial value of the constant\n * @returns {Value} The constant value\n *\n * @example\n * const value = useConst('value');\n */\nexport const useConst = <Value>(initialValue: (() => Value) | Value) =>\n useRef<Value>(typeof initialValue === 'function' ? (initialValue as () => Value)() : initialValue)\n .current;\n"],"
|
|
1
|
+
{"version":3,"file":"useConst.cjs","names":[],"sources":["../../../../src/hooks/useConst/useConst.ts"],"sourcesContent":["import { useRef } from 'react';\n\n/**\n * @name useConst\n * @description - Hook that returns the constant value\n * @category Utilities\n * @usage high\n\n * @template Value The type of the value\n * @param {(() => Value) | Value} initialValue The initial value of the constant\n * @returns {Value} The constant value\n *\n * @example\n * const value = useConst('value');\n */\nexport const useConst = <Value>(initialValue: (() => Value) | Value) =>\n useRef<Value>(typeof initialValue === 'function' ? (initialValue as () => Value)() : initialValue)\n .current;\n"],"mappings":"uEAeA,IAAa,EAAmB,IAAA,EAAA,EAAA,QAChB,OAAO,GAAiB,WAAc,GAA8B,CAAG,EAAa,CAC/F"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=useControllableState.cjs.map
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`react`);function t(t){let{value:n,initialValue:r,onChange:i}=t,a=n!==void 0,[o,s]=(0,e.useState)(r),c=(0,e.useRef)(i);c.current=i;let l=a?n:o;return[l,(0,e.useCallback)(e=>{let t=typeof e==`function`?e(l):e;a||s(t),c.current?.(t)},[l,a]),a]}exports.useControllableState=t;
|
|
2
|
+
//# sourceMappingURL=useControllableState.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useControllableState.cjs","sources":["../../../../src/hooks/useControllableState/useControllableState.ts"],"sourcesContent":["import { useCallback, useRef, useState } from 'react';\n\n/** The use controllable state options type */\nexport interface UseControllableStateOptions<Value> {\n /** The initial value for uncontrolled state */\n initialValue?: Value;\n /** The controlled value */\n value?: Value;\n /** The onChange callback */\n onChange?: (value: Value) => void;\n}\n\n/** The use controllable state return type */\nexport type UseControllableStateReturn<Value> = [\n /** Current value */\n value: Value,\n /** Setter function that works with both controlled and uncontrolled state */\n setValue: (nextValue: ((prevValue: Value) => Value) | Value) => void,\n /** Whether the state is controlled */\n isControlled: boolean\n];\n\n/**\n * @name useControllableState\n * @description - Hook that manages both controlled and uncontrolled state patterns\n * @category State\n * @usage medium\n *\n * @template Value The type of the state value\n * @param {Value} [options.value] The controlled value. When provided, the component becomes controlled\n * @param {Value} [options.initialValue] The initial value for uncontrolled state\n * @param {(value: Value) => void} [options.onChange] The callback function called when the state changes\n * @returns {UseControllableStateReturn<Value>} A tuple containing the current value, setter function, and controlled flag\n *\n * @example\n * const [value, setValue, isControlled] = useControllableState({ initialValue: 'initial' });\n */\nexport function useControllableState<Value>(\n options: UseControllableStateOptions<Value>\n): UseControllableStateReturn<Value> {\n const { value, initialValue, onChange } = options;\n const isControlled = value !== undefined;\n\n const [internalState, setInternalState] = useState<Value>(initialValue as Value);\n\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n\n const currentValue = isControlled ? value : internalState;\n\n const setValue = useCallback(\n (nextValue: ((prevValue: Value) => Value) | Value) => {\n const resolvedValue =\n typeof nextValue === 'function'\n ? (nextValue as (prevValue: Value) => Value)(currentValue)\n : nextValue;\n\n if (!isControlled) setInternalState(resolvedValue);\n\n onChangeRef.current?.(resolvedValue);\n },\n [currentValue, isControlled]\n );\n\n return [currentValue, setValue, isControlled];\n}\n"],"
|
|
1
|
+
{"version":3,"file":"useControllableState.cjs","names":[],"sources":["../../../../src/hooks/useControllableState/useControllableState.ts"],"sourcesContent":["import { useCallback, useRef, useState } from 'react';\n\n/** The use controllable state options type */\nexport interface UseControllableStateOptions<Value> {\n /** The initial value for uncontrolled state */\n initialValue?: Value;\n /** The controlled value */\n value?: Value;\n /** The onChange callback */\n onChange?: (value: Value) => void;\n}\n\n/** The use controllable state return type */\nexport type UseControllableStateReturn<Value> = [\n /** Current value */\n value: Value,\n /** Setter function that works with both controlled and uncontrolled state */\n setValue: (nextValue: ((prevValue: Value) => Value) | Value) => void,\n /** Whether the state is controlled */\n isControlled: boolean\n];\n\n/**\n * @name useControllableState\n * @description - Hook that manages both controlled and uncontrolled state patterns\n * @category State\n * @usage medium\n *\n * @template Value The type of the state value\n * @param {Value} [options.value] The controlled value. When provided, the component becomes controlled\n * @param {Value} [options.initialValue] The initial value for uncontrolled state\n * @param {(value: Value) => void} [options.onChange] The callback function called when the state changes\n * @returns {UseControllableStateReturn<Value>} A tuple containing the current value, setter function, and controlled flag\n *\n * @example\n * const [value, setValue, isControlled] = useControllableState({ initialValue: 'initial' });\n */\nexport function useControllableState<Value>(\n options: UseControllableStateOptions<Value>\n): UseControllableStateReturn<Value> {\n const { value, initialValue, onChange } = options;\n const isControlled = value !== undefined;\n\n const [internalState, setInternalState] = useState<Value>(initialValue as Value);\n\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n\n const currentValue = isControlled ? value : internalState;\n\n const setValue = useCallback(\n (nextValue: ((prevValue: Value) => Value) | Value) => {\n const resolvedValue =\n typeof nextValue === 'function'\n ? (nextValue as (prevValue: Value) => Value)(currentValue)\n : nextValue;\n\n if (!isControlled) setInternalState(resolvedValue);\n\n onChangeRef.current?.(resolvedValue);\n },\n [currentValue, isControlled]\n );\n\n return [currentValue, setValue, isControlled];\n}\n"],"mappings":"uEAqCA,SAAgB,EACd,EACmC,CACnC,GAAM,CAAE,QAAO,eAAc,YAAa,EACpC,EAAe,IAAU,IAAA,GAEzB,CAAC,EAAe,IAAA,EAAA,EAAA,UAAoC,EAAsB,CAE1E,GAAA,EAAA,EAAA,QAAqB,EAAS,CACpC,EAAY,QAAU,EAEtB,IAAM,EAAe,EAAe,EAAQ,EAgB5C,MAAO,CAAC,oBAbL,GAAqD,CACpD,IAAM,EACJ,OAAO,GAAc,WAChB,EAA0C,EAAa,CACxD,EAED,GAAc,EAAiB,EAAc,CAElD,EAAY,UAAU,EAAc,EAEtC,CAAC,EAAc,EAAa,CAC7B,CAE+B,EAAa"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=useCookie.cjs.map
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`react`);var t=()=>Object.fromEntries(document.cookie.split(`; `).map(e=>{let[t,...n]=e.split(`=`);return[t,decodeURIComponent(n.join(`=`))]})),n=(e,t={})=>{document.cookie=`${encodeURIComponent(e)}=; expires=Thu, 01 Jan 1970 00:00:00 GMT${t.path?`; path=${t.path}`:``}${t.domain?`; domain=${t.domain}`:``}${t.maxAge?`; max-age=0`:``}${t.expires?`; expires=Thu, 01 Jan 1970 00:00:00 GMT`:``}${t.secure?`; secure`:``}${t.sameSite?`; samesite=${t.sameSite}`:``}`},r=(e,t,n={})=>{let r=[`${encodeURIComponent(e)}=${encodeURIComponent(t)}`];n.path&&r.push(`path=${n.path}`),n.domain&&r.push(`domain=${n.domain}`),typeof n.maxAge==`number`&&r.push(`max-age=${n.maxAge}`),n.expires&&r.push(`expires=${n.expires.toUTCString()}`),n.secure&&r.push(`secure`),n.httpOnly&&r.push(`httpOnly`),n.sameSite&&r.push(`samesite=${n.sameSite}`),document.cookie=r.join(`; `)},i=`reactuse-cookie`,a=()=>window.dispatchEvent(new Event(i)),o=(e,t,n)=>{r(e,t,n),a()},s=(e,t)=>{n(e,t),a()},c=e=>t()[e],l=((t,n)=>{let r=typeof n==`object`&&n&&(`serializer`in n||`deserializer`in n||`initialValue`in n)?n:void 0,a=r?r?.initialValue:n;if(typeof document>`u`)return{value:typeof a==`function`?a():a};let l=e=>r?.serializer?r.serializer(e):typeof e==`string`?e:JSON.stringify(e),u=e=>{if(r?.deserializer)return r.deserializer(e);if(e!==`undefined`)try{return JSON.parse(e)}catch{return e}},[d,f]=(0,e.useState)(()=>{let e=c(t);if(e===void 0&&a!==void 0){let e=typeof a==`function`?a():a;return o(t,l(e),r),e}return e?u(e):void 0});return(0,e.useEffect)(()=>{let e=()=>{let e=c(t);f(e?u(e):void 0)};return window.addEventListener(i,e),()=>window.removeEventListener(i,e)},[t]),{value:d,set:(e,n)=>o(t,l(e),{...r,...n}),remove:e=>s(t,{...r,...e})}});exports.COOKIE_EVENT=i,exports.dispatchCookieEvent=a,exports.getCookie=c,exports.getCookies=t,exports.removeCookie=n,exports.removeCookieItem=s,exports.setCookie=r,exports.setCookieItem=o,exports.useCookie=l;
|
|
2
|
+
//# sourceMappingURL=useCookie.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCookie.cjs","sources":["../../../../src/hooks/useCookie/useCookie.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nexport const getCookies = () =>\n Object.fromEntries(\n document.cookie.split('; ').map((cookie) => {\n const [key, ...value] = cookie.split('=');\n const decodedValue = decodeURIComponent(value.join('='));\n return [key, decodedValue];\n })\n );\n\nexport interface RemoveCookieParams {\n domain?: string;\n expires?: Date;\n maxAge?: number;\n path?: string;\n sameSite?: 'Lax' | 'None' | 'Strict';\n secure?: boolean;\n}\n\nexport const removeCookie = (key: string, options: RemoveCookieParams = {}) => {\n document.cookie = `${encodeURIComponent(key)}=; expires=Thu, 01 Jan 1970 00:00:00 GMT${\n options.path ? `; path=${options.path}` : ''\n }${options.domain ? `; domain=${options.domain}` : ''}${\n options.maxAge ? `; max-age=0` : ''\n }${options.expires ? `; expires=Thu, 01 Jan 1970 00:00:00 GMT` : ''}${\n options.secure ? `; secure` : ''\n }${options.sameSite ? `; samesite=${options.sameSite}` : ''}`;\n};\n\nexport interface SetCookieParams {\n domain?: string;\n expires?: Date;\n httpOnly?: boolean;\n maxAge?: number;\n path?: string;\n sameSite?: 'Lax' | 'None' | 'Strict';\n secure?: boolean;\n}\n\nexport const setCookie = (key: string, value: string, options: SetCookieParams = {}) => {\n const cookie = [`${encodeURIComponent(key)}=${encodeURIComponent(value)}`];\n\n if (options.path) cookie.push(`path=${options.path}`);\n if (options.domain) cookie.push(`domain=${options.domain}`);\n if (typeof options.maxAge === 'number') cookie.push(`max-age=${options.maxAge}`);\n if (options.expires) cookie.push(`expires=${options.expires.toUTCString()}`);\n if (options.secure) cookie.push(`secure`);\n if (options.httpOnly) cookie.push(`httpOnly`);\n if (options.sameSite) cookie.push(`samesite=${options.sameSite}`);\n\n document.cookie = cookie.join('; ');\n};\n\n/* The use cookie initial value type */\nexport type UseCookieInitialValue<Value> = (() => Value) | Value;\n\n/* The use cookie options type */\nexport interface UseCookieOptions<Value> {\n /* The domain of the cookie */\n domain?: string;\n /* The expiration date of the cookie */\n expires?: Date;\n /* Whether the cookie is httpOnly */\n httpOnly?: boolean;\n /* The initial value of the storage */\n initialValue?: UseCookieInitialValue<Value>;\n /* The maximum age of the cookie */\n maxAge?: number;\n /* The path of the cookie */\n path?: string;\n /* The sameSite of the cookie */\n sameSite?: 'Lax' | 'None' | 'Strict';\n /* Whether the cookie is secure */\n secure?: boolean;\n /* The deserializer function to be invoked */\n deserializer?: (value: string) => Value;\n /* The serializer function to be invoked */\n serializer?: (value: Value) => string;\n}\n\n/* The use cookie return type */\nexport interface UseCookieReturn<Value> {\n /* The value of the cookie */\n value: Value;\n /* The remove function */\n remove: (options?: RemoveCookieParams) => void;\n /* The set function */\n set: (value: Value, options?: SetCookieParams) => void;\n}\n\nexport const COOKIE_EVENT = 'reactuse-cookie';\n\nexport const dispatchCookieEvent = () => window.dispatchEvent(new Event(COOKIE_EVENT));\n\nexport const setCookieItem = (key: string, value: string, options?: SetCookieParams) => {\n setCookie(key, value, options);\n dispatchCookieEvent();\n};\n\nexport const removeCookieItem = (key: string, options?: RemoveCookieParams) => {\n removeCookie(key, options);\n dispatchCookieEvent();\n};\n\nexport const getCookie = (key: string): string | undefined => {\n const cookies = getCookies();\n return cookies[key];\n};\n\nexport interface UseCookie {\n <Value>(\n key: string,\n options: UseCookieOptions<Value> & {\n initialValue: UseCookieInitialValue<Value>;\n }\n ): UseCookieReturn<Value>;\n\n <Value>(key: string, options?: UseCookieOptions<Value>): UseCookieReturn<Value | undefined>;\n\n <Value>(key: string, initialValue: UseCookieInitialValue<Value>): UseCookieReturn<Value>;\n\n <Value>(key: string): UseCookieReturn<Value | undefined>;\n}\n\n/**\n * @name useCookie\n * @description - Hook that manages cookie value\n * @category State\n * @usage medium\n\n * @overload\n * @template Value The type of the cookie value\n * @param {string} key The key of the cookie\n * @param {UseCookieInitialValue<Value>} [initialValue] The initial value of the cookie\n * @returns {UseCookieReturn<Value>} The value and the set function\n *\n * @overload\n * @template Value The type of the cookie value\n * @param {string} key The key of the cookie\n * @param {UseCookieOptions<Value>} options The options object\n * @param {UseCookieInitialValue<Value>} [options.initialValue] The initial value of the cookie\n * @param {(value: string) => Value} [options.deserializer] The deserializer function to be invoked\n * @param {(value: Value) => string} [options.serializer] The serializer function to be invoked\n * @returns {UseCookieReturn<Value | undefined>} The value and the set function\n *\n * @example\n * const { value, set, remove } = useCookie('key', 'value');\n */\nexport const useCookie = (<Value>(key: string, params?: any) => {\n const options = (\n typeof params === 'object' &&\n params &&\n ('serializer' in params || 'deserializer' in params || 'initialValue' in params)\n ? params\n : undefined\n ) as UseCookieOptions<Value>;\n const initialValue = (options ? options?.initialValue : params) as UseCookieInitialValue<Value>;\n\n if (typeof document === 'undefined')\n return {\n value: typeof initialValue === 'function' ? (initialValue as () => Value)() : initialValue\n } as UseCookieReturn<Value>;\n\n const serializer = (value: Value) => {\n if (options?.serializer) return options.serializer(value);\n if (typeof value === 'string') return value;\n return JSON.stringify(value);\n };\n\n const deserializer = (value: string) => {\n if (options?.deserializer) return options.deserializer(value);\n if (value === 'undefined') return undefined as unknown as Value;\n\n try {\n return JSON.parse(value) as Value;\n } catch {\n return value as Value;\n }\n };\n\n const [value, setValue] = useState<Value | undefined>(() => {\n const cookieValue = getCookie(key);\n if (cookieValue === undefined && initialValue !== undefined) {\n const value =\n typeof initialValue === 'function' ? (initialValue as () => Value)() : initialValue;\n setCookieItem(key, serializer(value), options);\n return value;\n }\n return cookieValue ? deserializer(cookieValue) : undefined;\n });\n\n useEffect(() => {\n const onChange = () => {\n const cookieValue = getCookie(key);\n setValue(cookieValue ? deserializer(cookieValue) : undefined);\n };\n window.addEventListener(COOKIE_EVENT, onChange);\n return () => window.removeEventListener(COOKIE_EVENT, onChange);\n }, [key]);\n\n const set = (value: Value, params?: SetCookieParams) =>\n setCookieItem(key, serializer(value), { ...options, ...params });\n const remove = (params?: RemoveCookieParams) => removeCookieItem(key, { ...options, ...params });\n\n return { value, set, remove };\n}) as UseCookie;\n"],"names":["getCookies","cookie","key","value","decodedValue","removeCookie","options","setCookie","COOKIE_EVENT","dispatchCookieEvent","setCookieItem","removeCookieItem","getCookie","useCookie","params","initialValue","serializer","deserializer","setValue","useState","cookieValue","useEffect","onChange"],"mappings":"yGAEaA,EAAa,IACxB,OAAO,YACL,SAAS,OAAO,MAAM,IAAI,EAAE,IAAKC,GAAW,CAC1C,KAAM,CAACC,EAAK,GAAGC,CAAK,EAAIF,EAAO,MAAM,GAAG,EAClCG,EAAe,mBAAmBD,EAAM,KAAK,GAAG,CAAC,EACvD,MAAO,CAACD,EAAKE,CAAY,CAAA,CAC1B,CACH,EAWWC,EAAe,CAACH,EAAaI,EAA8B,KAAO,CAC7E,SAAS,OAAS,GAAG,mBAAmBJ,CAAG,CAAC,2CAC1CI,EAAQ,KAAO,UAAUA,EAAQ,IAAI,GAAK,EAC5C,GAAGA,EAAQ,OAAS,YAAYA,EAAQ,MAAM,GAAK,EAAE,GACnDA,EAAQ,OAAS,cAAgB,EACnC,GAAGA,EAAQ,QAAU,0CAA4C,EAAE,GACjEA,EAAQ,OAAS,WAAa,EAChC,GAAGA,EAAQ,SAAW,cAAcA,EAAQ,QAAQ,GAAK,EAAE,EAC7D,EAYaC,EAAY,CAACL,EAAaC,EAAeG,EAA2B,CAAA,IAAO,CACtF,MAAML,EAAS,CAAC,GAAG,mBAAmBC,CAAG,CAAC,IAAI,mBAAmBC,CAAK,CAAC,EAAE,EAErEG,EAAQ,MAAML,EAAO,KAAK,QAAQK,EAAQ,IAAI,EAAE,EAChDA,EAAQ,QAAQL,EAAO,KAAK,UAAUK,EAAQ,MAAM,EAAE,EACtD,OAAOA,EAAQ,QAAW,YAAiB,KAAK,WAAWA,EAAQ,MAAM,EAAE,EAC3EA,EAAQ,SAASL,EAAO,KAAK,WAAWK,EAAQ,QAAQ,YAAA,CAAa,EAAE,EACvEA,EAAQ,QAAQL,EAAO,KAAK,QAAQ,EACpCK,EAAQ,UAAUL,EAAO,KAAK,UAAU,EACxCK,EAAQ,UAAUL,EAAO,KAAK,YAAYK,EAAQ,QAAQ,EAAE,EAEhE,SAAS,OAASL,EAAO,KAAK,IAAI,CACpC,EAuCaO,EAAe,kBAEfC,EAAsB,IAAM,OAAO,cAAc,IAAI,MAAMD,CAAY,CAAC,EAExEE,EAAgB,CAACR,EAAaC,EAAeG,IAA8B,CACtFC,EAAUL,EAAKC,EAAOG,CAAO,EAC7BG,EAAA,CACF,EAEaE,EAAmB,CAACT,EAAaI,IAAiC,CAC7ED,EAAaH,EAAKI,CAAO,EACzBG,EAAA,CACF,EAEaG,EAAaV,GACRF,EAAA,EACDE,CAAG,EA0CPW,GAAa,CAAQX,EAAaY,IAAiB,CAC9D,MAAMR,EACJ,OAAOQ,GAAW,UAClBA,IACC,eAAgBA,GAAU,iBAAkBA,GAAU,iBAAkBA,GACrEA,EACA,OAEAC,EAAgBT,EAAUA,GAAS,aAAeQ,EAExD,GAAI,OAAO,SAAa,IACtB,MAAO,CACL,MAAO,OAAOC,GAAiB,WAAcA,IAAiCA,CAAA,EAGlF,MAAMC,EAAcb,GACdG,GAAS,WAAmBA,EAAQ,WAAWH,CAAK,EACpD,OAAOA,GAAU,SAAiBA,EAC/B,KAAK,UAAUA,CAAK,EAGvBc,EAAgBd,GAAkB,CACtC,GAAIG,GAAS,aAAc,OAAOA,EAAQ,aAAaH,CAAK,EAC5D,GAAIA,IAAU,YAEd,GAAI,CACF,OAAO,KAAK,MAAMA,CAAK,CAAA,MACjB,CACN,OAAOA,CAAA,CACT,EAGI,CAACA,EAAOe,CAAQ,EAAIC,EAAAA,SAA4B,IAAM,CAC1D,MAAMC,EAAcR,EAAUV,CAAG,EACjC,GAAIkB,IAAgB,QAAaL,IAAiB,OAAW,CAC3D,MAAMZ,EACJ,OAAOY,GAAiB,WAAcA,IAAiCA,EACzE,OAAAL,EAAcR,EAAKc,EAAWb,CAAK,EAAGG,CAAO,EACtCH,CAAA,CAET,OAAOiB,EAAcH,EAAaG,CAAW,EAAI,MAAA,CAClD,EAEDC,OAAAA,EAAAA,UAAU,IAAM,CACd,MAAMC,EAAW,IAAM,CACrB,MAAMF,EAAcR,EAAUV,CAAG,EACjCgB,EAASE,EAAcH,EAAaG,CAAW,EAAI,MAAS,CAAA,EAE9D,cAAO,iBAAiBZ,EAAcc,CAAQ,EACvC,IAAM,OAAO,oBAAoBd,EAAcc,CAAQ,CAAA,EAC7D,CAACpB,CAAG,CAAC,EAMD,CAAE,MAAAC,EAAO,IAJJ,CAACA,EAAcW,IACzBJ,EAAcR,EAAKc,EAAWb,CAAK,EAAG,CAAE,GAAGG,EAAS,GAAGQ,EAAQ,EAG5C,OAFLA,GAAgCH,EAAiBT,EAAK,CAAE,GAAGI,EAAS,GAAGQ,EAAQ,CAE1E,CACvB"}
|
|
1
|
+
{"version":3,"file":"useCookie.cjs","names":[],"sources":["../../../../src/hooks/useCookie/useCookie.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nexport const getCookies = () =>\n Object.fromEntries(\n document.cookie.split('; ').map((cookie) => {\n const [key, ...value] = cookie.split('=');\n const decodedValue = decodeURIComponent(value.join('='));\n return [key, decodedValue];\n })\n );\n\nexport interface RemoveCookieParams {\n domain?: string;\n expires?: Date;\n maxAge?: number;\n path?: string;\n sameSite?: 'Lax' | 'None' | 'Strict';\n secure?: boolean;\n}\n\nexport const removeCookie = (key: string, options: RemoveCookieParams = {}) => {\n document.cookie = `${encodeURIComponent(key)}=; expires=Thu, 01 Jan 1970 00:00:00 GMT${\n options.path ? `; path=${options.path}` : ''\n }${options.domain ? `; domain=${options.domain}` : ''}${\n options.maxAge ? `; max-age=0` : ''\n }${options.expires ? `; expires=Thu, 01 Jan 1970 00:00:00 GMT` : ''}${\n options.secure ? `; secure` : ''\n }${options.sameSite ? `; samesite=${options.sameSite}` : ''}`;\n};\n\nexport interface SetCookieParams {\n domain?: string;\n expires?: Date;\n httpOnly?: boolean;\n maxAge?: number;\n path?: string;\n sameSite?: 'Lax' | 'None' | 'Strict';\n secure?: boolean;\n}\n\nexport const setCookie = (key: string, value: string, options: SetCookieParams = {}) => {\n const cookie = [`${encodeURIComponent(key)}=${encodeURIComponent(value)}`];\n\n if (options.path) cookie.push(`path=${options.path}`);\n if (options.domain) cookie.push(`domain=${options.domain}`);\n if (typeof options.maxAge === 'number') cookie.push(`max-age=${options.maxAge}`);\n if (options.expires) cookie.push(`expires=${options.expires.toUTCString()}`);\n if (options.secure) cookie.push(`secure`);\n if (options.httpOnly) cookie.push(`httpOnly`);\n if (options.sameSite) cookie.push(`samesite=${options.sameSite}`);\n\n document.cookie = cookie.join('; ');\n};\n\n/* The use cookie initial value type */\nexport type UseCookieInitialValue<Value> = (() => Value) | Value;\n\n/* The use cookie options type */\nexport interface UseCookieOptions<Value> {\n /* The domain of the cookie */\n domain?: string;\n /* The expiration date of the cookie */\n expires?: Date;\n /* Whether the cookie is httpOnly */\n httpOnly?: boolean;\n /* The initial value of the storage */\n initialValue?: UseCookieInitialValue<Value>;\n /* The maximum age of the cookie */\n maxAge?: number;\n /* The path of the cookie */\n path?: string;\n /* The sameSite of the cookie */\n sameSite?: 'Lax' | 'None' | 'Strict';\n /* Whether the cookie is secure */\n secure?: boolean;\n /* The deserializer function to be invoked */\n deserializer?: (value: string) => Value;\n /* The serializer function to be invoked */\n serializer?: (value: Value) => string;\n}\n\n/* The use cookie return type */\nexport interface UseCookieReturn<Value> {\n /* The value of the cookie */\n value: Value;\n /* The remove function */\n remove: (options?: RemoveCookieParams) => void;\n /* The set function */\n set: (value: Value, options?: SetCookieParams) => void;\n}\n\nexport const COOKIE_EVENT = 'reactuse-cookie';\n\nexport const dispatchCookieEvent = () => window.dispatchEvent(new Event(COOKIE_EVENT));\n\nexport const setCookieItem = (key: string, value: string, options?: SetCookieParams) => {\n setCookie(key, value, options);\n dispatchCookieEvent();\n};\n\nexport const removeCookieItem = (key: string, options?: RemoveCookieParams) => {\n removeCookie(key, options);\n dispatchCookieEvent();\n};\n\nexport const getCookie = (key: string): string | undefined => {\n const cookies = getCookies();\n return cookies[key];\n};\n\nexport interface UseCookie {\n <Value>(\n key: string,\n options: UseCookieOptions<Value> & {\n initialValue: UseCookieInitialValue<Value>;\n }\n ): UseCookieReturn<Value>;\n\n <Value>(key: string, options?: UseCookieOptions<Value>): UseCookieReturn<Value | undefined>;\n\n <Value>(key: string, initialValue: UseCookieInitialValue<Value>): UseCookieReturn<Value>;\n\n <Value>(key: string): UseCookieReturn<Value | undefined>;\n}\n\n/**\n * @name useCookie\n * @description - Hook that manages cookie value\n * @category State\n * @usage medium\n\n * @overload\n * @template Value The type of the cookie value\n * @param {string} key The key of the cookie\n * @param {UseCookieInitialValue<Value>} [initialValue] The initial value of the cookie\n * @returns {UseCookieReturn<Value>} The value and the set function\n *\n * @overload\n * @template Value The type of the cookie value\n * @param {string} key The key of the cookie\n * @param {UseCookieOptions<Value>} options The options object\n * @param {UseCookieInitialValue<Value>} [options.initialValue] The initial value of the cookie\n * @param {(value: string) => Value} [options.deserializer] The deserializer function to be invoked\n * @param {(value: Value) => string} [options.serializer] The serializer function to be invoked\n * @returns {UseCookieReturn<Value | undefined>} The value and the set function\n *\n * @example\n * const { value, set, remove } = useCookie('key', 'value');\n */\nexport const useCookie = (<Value>(key: string, params?: any) => {\n const options = (\n typeof params === 'object' &&\n params &&\n ('serializer' in params || 'deserializer' in params || 'initialValue' in params)\n ? params\n : undefined\n ) as UseCookieOptions<Value>;\n const initialValue = (options ? options?.initialValue : params) as UseCookieInitialValue<Value>;\n\n if (typeof document === 'undefined')\n return {\n value: typeof initialValue === 'function' ? (initialValue as () => Value)() : initialValue\n } as UseCookieReturn<Value>;\n\n const serializer = (value: Value) => {\n if (options?.serializer) return options.serializer(value);\n if (typeof value === 'string') return value;\n return JSON.stringify(value);\n };\n\n const deserializer = (value: string) => {\n if (options?.deserializer) return options.deserializer(value);\n if (value === 'undefined') return undefined as unknown as Value;\n\n try {\n return JSON.parse(value) as Value;\n } catch {\n return value as Value;\n }\n };\n\n const [value, setValue] = useState<Value | undefined>(() => {\n const cookieValue = getCookie(key);\n if (cookieValue === undefined && initialValue !== undefined) {\n const value =\n typeof initialValue === 'function' ? (initialValue as () => Value)() : initialValue;\n setCookieItem(key, serializer(value), options);\n return value;\n }\n return cookieValue ? deserializer(cookieValue) : undefined;\n });\n\n useEffect(() => {\n const onChange = () => {\n const cookieValue = getCookie(key);\n setValue(cookieValue ? deserializer(cookieValue) : undefined);\n };\n window.addEventListener(COOKIE_EVENT, onChange);\n return () => window.removeEventListener(COOKIE_EVENT, onChange);\n }, [key]);\n\n const set = (value: Value, params?: SetCookieParams) =>\n setCookieItem(key, serializer(value), { ...options, ...params });\n const remove = (params?: RemoveCookieParams) => removeCookieItem(key, { ...options, ...params });\n\n return { value, set, remove };\n}) as UseCookie;\n"],"mappings":"uEAEA,IAAa,MACX,OAAO,YACL,SAAS,OAAO,MAAM,KAAK,CAAC,IAAK,GAAW,CAC1C,GAAM,CAAC,EAAK,GAAG,GAAS,EAAO,MAAM,IAAI,CAEzC,MAAO,CAAC,EADa,mBAAmB,EAAM,KAAK,IAAI,CAAC,CAC9B,EAC1B,CACH,CAWU,GAAgB,EAAa,EAA8B,EAAE,GAAK,CAC7E,SAAS,OAAS,GAAG,mBAAmB,EAAI,CAAC,0CAC3C,EAAQ,KAAO,UAAU,EAAQ,OAAS,KACzC,EAAQ,OAAS,YAAY,EAAQ,SAAW,KACjD,EAAQ,OAAS,cAAgB,KAChC,EAAQ,QAAU,0CAA4C,KAC/D,EAAQ,OAAS,WAAa,KAC7B,EAAQ,SAAW,cAAc,EAAQ,WAAa,MAa9C,GAAa,EAAa,EAAe,EAA2B,EAAE,GAAK,CACtF,IAAM,EAAS,CAAC,GAAG,mBAAmB,EAAI,CAAC,GAAG,mBAAmB,EAAM,GAAG,CAEtE,EAAQ,MAAM,EAAO,KAAK,QAAQ,EAAQ,OAAO,CACjD,EAAQ,QAAQ,EAAO,KAAK,UAAU,EAAQ,SAAS,CACvD,OAAO,EAAQ,QAAW,UAAU,EAAO,KAAK,WAAW,EAAQ,SAAS,CAC5E,EAAQ,SAAS,EAAO,KAAK,WAAW,EAAQ,QAAQ,aAAa,GAAG,CACxE,EAAQ,QAAQ,EAAO,KAAK,SAAS,CACrC,EAAQ,UAAU,EAAO,KAAK,WAAW,CACzC,EAAQ,UAAU,EAAO,KAAK,YAAY,EAAQ,WAAW,CAEjE,SAAS,OAAS,EAAO,KAAK,KAAK,EAwCxB,EAAe,kBAEf,MAA4B,OAAO,cAAc,IAAI,MAAM,EAAa,CAAC,CAEzE,GAAiB,EAAa,EAAe,IAA8B,CACtF,EAAU,EAAK,EAAO,EAAQ,CAC9B,GAAqB,EAGV,GAAoB,EAAa,IAAiC,CAC7E,EAAa,EAAK,EAAQ,CAC1B,GAAqB,EAGV,EAAa,GACR,GAAY,CACb,GA0CJ,IAAqB,EAAa,IAAiB,CAC9D,IAAM,EACJ,OAAO,GAAW,UAClB,IACC,eAAgB,GAAU,iBAAkB,GAAU,iBAAkB,GACrE,EACA,IAAA,GAEA,EAAgB,EAAU,GAAS,aAAe,EAExD,GAAI,OAAO,SAAa,IACtB,MAAO,CACL,MAAO,OAAO,GAAiB,WAAc,GAA8B,CAAG,EAC/E,CAEH,IAAM,EAAc,GACd,GAAS,WAAmB,EAAQ,WAAW,EAAM,CACrD,OAAO,GAAU,SAAiB,EAC/B,KAAK,UAAU,EAAM,CAGxB,EAAgB,GAAkB,CACtC,GAAI,GAAS,aAAc,OAAO,EAAQ,aAAa,EAAM,CACzD,OAAU,YAEd,GAAI,CACF,OAAO,KAAK,MAAM,EAAM,MAClB,CACN,OAAO,IAIL,CAAC,EAAO,IAAA,EAAA,EAAA,cAA8C,CAC1D,IAAM,EAAc,EAAU,EAAI,CAClC,GAAI,IAAgB,IAAA,IAAa,IAAiB,IAAA,GAAW,CAC3D,IAAM,EACJ,OAAO,GAAiB,WAAc,GAA8B,CAAG,EAEzE,OADA,EAAc,EAAK,EAAW,EAAM,CAAE,EAAQ,CACvC,EAET,OAAO,EAAc,EAAa,EAAY,CAAG,IAAA,IACjD,CAeF,OAbA,EAAA,EAAA,eAAgB,CACd,IAAM,MAAiB,CACrB,IAAM,EAAc,EAAU,EAAI,CAClC,EAAS,EAAc,EAAa,EAAY,CAAG,IAAA,GAAU,EAG/D,OADA,OAAO,iBAAiB,EAAc,EAAS,KAClC,OAAO,oBAAoB,EAAc,EAAS,EAC9D,CAAC,EAAI,CAAC,CAMF,CAAE,QAAO,KAJH,EAAc,IACzB,EAAc,EAAK,EAAW,EAAM,CAAE,CAAE,GAAG,EAAS,GAAG,EAAQ,CAAC,CAG7C,OAFL,GAAgC,EAAiB,EAAK,CAAE,GAAG,EAAS,GAAG,EAAQ,CAAC,CAEnE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=useCookies.cjs.map
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../useCookie/useCookie.cjs`);let t=require(`react`);var n=()=>{document.cookie.split(`; `).forEach(t=>{let[n]=t.split(`=`);e.removeCookie(n)})},r=()=>{n(),e.dispatchCookieEvent()},i=n=>{let i=e=>n?.serializer?n.serializer(e):typeof e==`string`?e:JSON.stringify(e),a=e=>{if(n?.deserializer)return n.deserializer(e);if(e!==`undefined`)try{return JSON.parse(e)}catch{return e}},o=()=>document.cookie?Object.fromEntries(document.cookie.split(`; `).map(e=>{let[t,...n]=e.split(`=`);return!t||!n.length?[]:[t,a(decodeURIComponent(n.join(`=`)))]}).filter(e=>e.length)):{},[s,c]=(0,t.useState)(()=>typeof window>`u`?{}:o());return(0,t.useEffect)(()=>{let t=()=>c(o());return window.addEventListener(e.COOKIE_EVENT,t),()=>{window.removeEventListener(e.COOKIE_EVENT,t)}},[]),{value:s,set:(t,n,r)=>e.setCookieItem(t,i(n),r),remove:(t,n)=>e.removeCookieItem(t,n),getAll:()=>o(),clear:()=>r()}};exports.clearCookies=n,exports.useCookies=i;
|
|
2
|
+
//# sourceMappingURL=useCookies.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCookies.cjs","sources":["../../../../src/hooks/useCookies/useCookies.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nimport type { RemoveCookieParams, SetCookieParams } from '../useCookie/useCookie';\n\nimport {\n COOKIE_EVENT,\n dispatchCookieEvent,\n removeCookie,\n removeCookieItem,\n setCookieItem\n} from '../useCookie/useCookie';\n\n/** The cookies params type */\nexport type CookieParams = Record<string, any>;\n\n/* The use cookies options type */\nexport interface UseCookiesOptions<Value> {\n /* The deserializer function to be invoked */\n deserializer?: (value: string) => Value[keyof Value];\n /* The serializer function to be invoked */\n serializer?: (value: Value[keyof Value]) => string;\n}\n\nexport const clearCookies = () => {\n document.cookie.split('; ').forEach((cookie) => {\n const [name] = cookie.split('=');\n removeCookie(name);\n });\n};\n\nconst clearCookieItems = () => {\n clearCookies();\n dispatchCookieEvent();\n};\n\n/**\n * @name useCookies\n * @description - Hook that manages cookie values\n * @category State\n * @usage medium\n\n * @overload\n * @template {object} Value The type of the cookie values\n * @returns {UseCookieReturn<Value>} The value and the set function\n *\n * @example\n * const { value, set, remove, getAll, clear } = useCookies();\n */\nexport const useCookies = <Value extends CookieParams>(options?: UseCookiesOptions<Value>) => {\n const serializer = (value: Value[keyof Value]) => {\n if (options?.serializer) return options.serializer(value);\n if (typeof value === 'string') return value;\n return JSON.stringify(value);\n };\n\n const deserializer = (value: string) => {\n if (options?.deserializer) return options.deserializer(value);\n if (value === 'undefined') return undefined as unknown as Value[keyof Value];\n\n try {\n return JSON.parse(value) as Value;\n } catch {\n return value as Value[keyof Value];\n }\n };\n\n const getParsedCookies = () => {\n if (!document.cookie) return {};\n\n return Object.fromEntries(\n document.cookie\n .split('; ')\n .map((cookie) => {\n const [key, ...value] = cookie.split('=');\n if (!key || !value.length) return [];\n const decodedValue = decodeURIComponent(value.join('='));\n return [key, deserializer(decodedValue)];\n })\n .filter((entry) => entry.length)\n );\n };\n\n const [value, setValue] = useState(() => {\n if (typeof window === 'undefined') return {} as Value;\n return getParsedCookies() as Value;\n });\n\n useEffect(() => {\n const onChange = () => setValue(getParsedCookies() as Value);\n\n window.addEventListener(COOKIE_EVENT, onChange);\n return () => {\n window.removeEventListener(COOKIE_EVENT, onChange);\n };\n }, []);\n\n const set = <Key extends keyof Value>(key: Key, value: Value[Key], options?: SetCookieParams) =>\n setCookieItem(key as string, serializer(value), options);\n\n const remove = <Key extends keyof Value>(key: Key, options?: RemoveCookieParams) =>\n removeCookieItem(key as string, options);\n const getAll = () => getParsedCookies();\n const clear = () => clearCookieItems();\n\n return { value, set, remove, getAll, clear };\n};\n"],"
|
|
1
|
+
{"version":3,"file":"useCookies.cjs","names":[],"sources":["../../../../src/hooks/useCookies/useCookies.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nimport type { RemoveCookieParams, SetCookieParams } from '../useCookie/useCookie';\n\nimport {\n COOKIE_EVENT,\n dispatchCookieEvent,\n removeCookie,\n removeCookieItem,\n setCookieItem\n} from '../useCookie/useCookie';\n\n/** The cookies params type */\nexport type CookieParams = Record<string, any>;\n\n/* The use cookies options type */\nexport interface UseCookiesOptions<Value> {\n /* The deserializer function to be invoked */\n deserializer?: (value: string) => Value[keyof Value];\n /* The serializer function to be invoked */\n serializer?: (value: Value[keyof Value]) => string;\n}\n\nexport const clearCookies = () => {\n document.cookie.split('; ').forEach((cookie) => {\n const [name] = cookie.split('=');\n removeCookie(name);\n });\n};\n\nconst clearCookieItems = () => {\n clearCookies();\n dispatchCookieEvent();\n};\n\n/**\n * @name useCookies\n * @description - Hook that manages cookie values\n * @category State\n * @usage medium\n\n * @overload\n * @template {object} Value The type of the cookie values\n * @returns {UseCookieReturn<Value>} The value and the set function\n *\n * @example\n * const { value, set, remove, getAll, clear } = useCookies();\n */\nexport const useCookies = <Value extends CookieParams>(options?: UseCookiesOptions<Value>) => {\n const serializer = (value: Value[keyof Value]) => {\n if (options?.serializer) return options.serializer(value);\n if (typeof value === 'string') return value;\n return JSON.stringify(value);\n };\n\n const deserializer = (value: string) => {\n if (options?.deserializer) return options.deserializer(value);\n if (value === 'undefined') return undefined as unknown as Value[keyof Value];\n\n try {\n return JSON.parse(value) as Value;\n } catch {\n return value as Value[keyof Value];\n }\n };\n\n const getParsedCookies = () => {\n if (!document.cookie) return {};\n\n return Object.fromEntries(\n document.cookie\n .split('; ')\n .map((cookie) => {\n const [key, ...value] = cookie.split('=');\n if (!key || !value.length) return [];\n const decodedValue = decodeURIComponent(value.join('='));\n return [key, deserializer(decodedValue)];\n })\n .filter((entry) => entry.length)\n );\n };\n\n const [value, setValue] = useState(() => {\n if (typeof window === 'undefined') return {} as Value;\n return getParsedCookies() as Value;\n });\n\n useEffect(() => {\n const onChange = () => setValue(getParsedCookies() as Value);\n\n window.addEventListener(COOKIE_EVENT, onChange);\n return () => {\n window.removeEventListener(COOKIE_EVENT, onChange);\n };\n }, []);\n\n const set = <Key extends keyof Value>(key: Key, value: Value[Key], options?: SetCookieParams) =>\n setCookieItem(key as string, serializer(value), options);\n\n const remove = <Key extends keyof Value>(key: Key, options?: RemoveCookieParams) =>\n removeCookieItem(key as string, options);\n const getAll = () => getParsedCookies();\n const clear = () => clearCookieItems();\n\n return { value, set, remove, getAll, clear };\n};\n"],"mappings":"qHAuBA,IAAa,MAAqB,CAChC,SAAS,OAAO,MAAM,KAAK,CAAC,QAAS,GAAW,CAC9C,GAAM,CAAC,GAAQ,EAAO,MAAM,IAAI,CAChC,EAAA,aAAa,EAAK,EAClB,EAGE,MAAyB,CAC7B,GAAc,CACd,EAAA,qBAAqB,EAgBV,EAA0C,GAAuC,CAC5F,IAAM,EAAc,GACd,GAAS,WAAmB,EAAQ,WAAW,EAAM,CACrD,OAAO,GAAU,SAAiB,EAC/B,KAAK,UAAU,EAAM,CAGxB,EAAgB,GAAkB,CACtC,GAAI,GAAS,aAAc,OAAO,EAAQ,aAAa,EAAM,CACzD,OAAU,YAEd,GAAI,CACF,OAAO,KAAK,MAAM,EAAM,MAClB,CACN,OAAO,IAIL,MACC,SAAS,OAEP,OAAO,YACZ,SAAS,OACN,MAAM,KAAK,CACX,IAAK,GAAW,CACf,GAAM,CAAC,EAAK,GAAG,GAAS,EAAO,MAAM,IAAI,CAGzC,MAFI,CAAC,GAAO,CAAC,EAAM,OAAe,EAAE,CAE7B,CAAC,EAAK,EADQ,mBAAmB,EAAM,KAAK,IAAI,CAAC,CACjB,CAAC,EACxC,CACD,OAAQ,GAAU,EAAM,OAAO,CACnC,CAZ4B,EAAE,CAe3B,CAAC,EAAO,IAAA,EAAA,EAAA,cACR,OAAO,OAAW,IAAoB,EAAE,CACrC,GAAkB,CACzB,CAmBF,OAjBA,EAAA,EAAA,eAAgB,CACd,IAAM,MAAiB,EAAS,GAAkB,CAAU,CAG5D,OADA,OAAO,iBAAiB,EAAA,aAAc,EAAS,KAClC,CACX,OAAO,oBAAoB,EAAA,aAAc,EAAS,GAEnD,EAAE,CAAC,CAUC,CAAE,QAAO,KARsB,EAAU,EAAmB,IACjE,EAAA,cAAc,EAAe,EAAW,EAAM,CAAE,EAAQ,CAOrC,QALoB,EAAU,IACjD,EAAA,iBAAiB,EAAe,EAAQ,CAIb,WAHR,GAAkB,CAGF,UAFjB,GAAkB,CAEM"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=useCopy.cjs.map
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils/helpers/copy.cjs`);let t=require(`react`);var n=(n=1e3)=>{let[r,i]=(0,t.useState)(),[a,o]=(0,t.useState)(!1);return{value:r,copied:a,copy:async t=>{await e.copy(t),i(t),o(!0),setTimeout(()=>o(!1),n)}}};exports.useCopy=n;
|
|
2
|
+
//# sourceMappingURL=useCopy.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCopy.cjs","sources":["../../../../src/hooks/useCopy/useCopy.ts"],"sourcesContent":["import { useState } from 'react';\n\nimport { copy } from '@/utils/helpers';\n\n/** The use copy return type */\nexport interface UseCopyReturn {\n /** Whether copy is in progress */\n copied: boolean;\n /** The copied value */\n value?: string;\n /** Function to copy text */\n copy: (value: string) => Promise<void>;\n}\n\n/** The use copy params type */\nexport interface UseCopyParams {\n /** Reset delay in milliseconds */\n resetDelay?: number;\n}\n\n/**\n * @name useCopy\n * @description - Hook that manages copying text with status reset\n * @category Browser\n * @usage medium\n\n * @browserapi navigator.clipboard https://developer.mozilla.org/en-US/docs/Web/API/Navigator/clipboard\n *\n * @param {number} [delay=1000] Delay in ms before resetting copied status\n * @returns {UseCopyReturn} An object containing the copied value, status and copy function\n *\n * @example\n * const { copied, value, copy } = useCopy();\n */\nexport const useCopy = (delay: number = 1000): UseCopyReturn => {\n const [value, setValue] = useState<string | undefined>();\n const [copied, setCopied] = useState(false);\n\n const copyToClipboard = async (text: string) => {\n await copy(text);\n setValue(text);\n setCopied(true);\n setTimeout(() => setCopied(false), delay);\n };\n\n return { value, copied, copy: copyToClipboard };\n};\n"],"
|
|
1
|
+
{"version":3,"file":"useCopy.cjs","names":[],"sources":["../../../../src/hooks/useCopy/useCopy.ts"],"sourcesContent":["import { useState } from 'react';\n\nimport { copy } from '@/utils/helpers';\n\n/** The use copy return type */\nexport interface UseCopyReturn {\n /** Whether copy is in progress */\n copied: boolean;\n /** The copied value */\n value?: string;\n /** Function to copy text */\n copy: (value: string) => Promise<void>;\n}\n\n/** The use copy params type */\nexport interface UseCopyParams {\n /** Reset delay in milliseconds */\n resetDelay?: number;\n}\n\n/**\n * @name useCopy\n * @description - Hook that manages copying text with status reset\n * @category Browser\n * @usage medium\n\n * @browserapi navigator.clipboard https://developer.mozilla.org/en-US/docs/Web/API/Navigator/clipboard\n *\n * @param {number} [delay=1000] Delay in ms before resetting copied status\n * @returns {UseCopyReturn} An object containing the copied value, status and copy function\n *\n * @example\n * const { copied, value, copy } = useCopy();\n */\nexport const useCopy = (delay: number = 1000): UseCopyReturn => {\n const [value, setValue] = useState<string | undefined>();\n const [copied, setCopied] = useState(false);\n\n const copyToClipboard = async (text: string) => {\n await copy(text);\n setValue(text);\n setCopied(true);\n setTimeout(() => setCopied(false), delay);\n };\n\n return { value, copied, copy: copyToClipboard };\n};\n"],"mappings":"uHAkCA,IAAa,GAAW,EAAgB,MAAwB,CAC9D,GAAM,CAAC,EAAO,IAAA,EAAA,EAAA,WAA0C,CAClD,CAAC,EAAQ,IAAA,EAAA,EAAA,UAAsB,GAAM,CAS3C,MAAO,CAAE,QAAO,SAAQ,KAPA,KAAO,IAAiB,CAC9C,MAAM,EAAA,KAAK,EAAK,CAChB,EAAS,EAAK,CACd,EAAU,GAAK,CACf,eAAiB,EAAU,GAAM,CAAE,EAAM,EAGI"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=useCounter.cjs.map
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`react`);var t=((...t)=>{let n=typeof t[0]==`number`?t[0]:t[0]?.initialValue,{max:r=1/0,min:i=-1/0}=typeof t[0]==`number`?t[1]??{}:t[0]??{},[a,o]=(0,e.useState)(n??0);return{value:a,set:e=>{o(t=>Math.max(i,Math.min(r,typeof e==`number`?e:e(t))))},inc:(e=1)=>{o(t=>typeof r==`number`&&t===r?t:Math.max(Math.min(r,t+e),i))},dec:(e=1)=>{o(t=>typeof i==`number`&&t===i?t:Math.min(Math.max(i,t-e),r))},reset:()=>{let e=n??0;if(typeof r==`number`&&e>r)return o(r);if(typeof i==`number`&&e<i)return o(i);o(e)}}});exports.useCounter=t;
|
|
2
|
+
//# sourceMappingURL=useCounter.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCounter.cjs","sources":["../../../../src/hooks/useCounter/useCounter.ts"],"sourcesContent":["import type { Dispatch, SetStateAction } from 'react';\n\nimport { useState } from 'react';\n\n/** The use counter options */\nexport interface UseCounterOptions {\n /** The max of count value */\n max?: number;\n /** The min of count value */\n min?: number;\n}\n\n/** The use counter return type */\nexport interface UseCounterReturn {\n /** Function to set a specific value to the counter */\n set: Dispatch<SetStateAction<number>>;\n /** The current count value */\n value: number;\n /** Function to decrement the counter */\n dec: (value?: number) => void;\n /** Function to increment the counter */\n inc: (value?: number) => void;\n /** Function to reset the counter to its initial value. */\n reset: () => void;\n}\n\nexport interface UseCounter {\n (initialValue?: number, options?: UseCounterOptions): UseCounterReturn;\n\n (options: UseCounterOptions & { initialValue?: number }, initialValue?: never): UseCounterReturn;\n}\n\n/**\n * @name useCounter\n * @description - Hook that manages a counter\n * @category State\n * @usage low\n\n * @overload\n * @param {number} [initialValue=0] The initial number value\n * @param {number} [options.min=Number.NEGATIVE_INFINITY] The min of count value\n * @param {number} [options.max=Number.POSITIVE_INFINITY] The max of count value\n * @returns {UseCounterReturn} An object containing the current count and functions to interact with the counter\n\n * @overload\n * @param {number} [params.initialValue=0] The initial number value\n * @param {number} [params.min=Number.NEGATIVE_INFINITY] The min of count value\n * @param {number} [params.max=Number.POSITIVE_INFINITY] The max of count value\n * @returns {UseCounterReturn} An object containing the current count and functions to interact with the counter\n *\n * @example\n * const { count, dec, inc, reset, set } = useCounter(5);\n *\n * @example\n * const { count, dec, inc, reset, set } = useCounter({ initialValue: 5, min: 0, max: 10 });\n */\nexport const useCounter = ((...params: any[]) => {\n const initialValue =\n typeof params[0] === 'number'\n ? params[0]\n : (params[0] as UseCounterOptions & { initialValue?: number })?.initialValue;\n const { max = Number.POSITIVE_INFINITY, min = Number.NEGATIVE_INFINITY } =\n typeof params[0] === 'number'\n ? ((params[1] ?? {}) as UseCounterOptions)\n : ((params[0] ?? {}) as UseCounterOptions & { initialValue?: number });\n\n const [value, setValue] = useState(initialValue ?? 0);\n\n const inc = (value: number = 1) => {\n setValue((prevValue) => {\n if (typeof max === 'number' && prevValue === max) return prevValue;\n return Math.max(Math.min(max, prevValue + value), min);\n });\n };\n\n const dec = (value: number = 1) => {\n setValue((prevValue) => {\n if (typeof min === 'number' && prevValue === min) return prevValue;\n return Math.min(Math.max(min, prevValue - value), max);\n });\n };\n\n const reset = () => {\n const value = initialValue ?? 0;\n if (typeof max === 'number' && value > max) return setValue(max);\n if (typeof min === 'number' && value < min) return setValue(min);\n setValue(value);\n };\n\n const set = (value: SetStateAction<number>) => {\n setValue((prevValue) => {\n const updatedCount = Math.max(\n min,\n Math.min(max, typeof value === 'number' ? value : value(prevValue))\n );\n\n return updatedCount;\n });\n };\n\n return { value, set, inc, dec, reset };\n}) as UseCounter;\n"],"
|
|
1
|
+
{"version":3,"file":"useCounter.cjs","names":[],"sources":["../../../../src/hooks/useCounter/useCounter.ts"],"sourcesContent":["import type { Dispatch, SetStateAction } from 'react';\n\nimport { useState } from 'react';\n\n/** The use counter options */\nexport interface UseCounterOptions {\n /** The max of count value */\n max?: number;\n /** The min of count value */\n min?: number;\n}\n\n/** The use counter return type */\nexport interface UseCounterReturn {\n /** Function to set a specific value to the counter */\n set: Dispatch<SetStateAction<number>>;\n /** The current count value */\n value: number;\n /** Function to decrement the counter */\n dec: (value?: number) => void;\n /** Function to increment the counter */\n inc: (value?: number) => void;\n /** Function to reset the counter to its initial value. */\n reset: () => void;\n}\n\nexport interface UseCounter {\n (initialValue?: number, options?: UseCounterOptions): UseCounterReturn;\n\n (options: UseCounterOptions & { initialValue?: number }, initialValue?: never): UseCounterReturn;\n}\n\n/**\n * @name useCounter\n * @description - Hook that manages a counter\n * @category State\n * @usage low\n\n * @overload\n * @param {number} [initialValue=0] The initial number value\n * @param {number} [options.min=Number.NEGATIVE_INFINITY] The min of count value\n * @param {number} [options.max=Number.POSITIVE_INFINITY] The max of count value\n * @returns {UseCounterReturn} An object containing the current count and functions to interact with the counter\n\n * @overload\n * @param {number} [params.initialValue=0] The initial number value\n * @param {number} [params.min=Number.NEGATIVE_INFINITY] The min of count value\n * @param {number} [params.max=Number.POSITIVE_INFINITY] The max of count value\n * @returns {UseCounterReturn} An object containing the current count and functions to interact with the counter\n *\n * @example\n * const { count, dec, inc, reset, set } = useCounter(5);\n *\n * @example\n * const { count, dec, inc, reset, set } = useCounter({ initialValue: 5, min: 0, max: 10 });\n */\nexport const useCounter = ((...params: any[]) => {\n const initialValue =\n typeof params[0] === 'number'\n ? params[0]\n : (params[0] as UseCounterOptions & { initialValue?: number })?.initialValue;\n const { max = Number.POSITIVE_INFINITY, min = Number.NEGATIVE_INFINITY } =\n typeof params[0] === 'number'\n ? ((params[1] ?? {}) as UseCounterOptions)\n : ((params[0] ?? {}) as UseCounterOptions & { initialValue?: number });\n\n const [value, setValue] = useState(initialValue ?? 0);\n\n const inc = (value: number = 1) => {\n setValue((prevValue) => {\n if (typeof max === 'number' && prevValue === max) return prevValue;\n return Math.max(Math.min(max, prevValue + value), min);\n });\n };\n\n const dec = (value: number = 1) => {\n setValue((prevValue) => {\n if (typeof min === 'number' && prevValue === min) return prevValue;\n return Math.min(Math.max(min, prevValue - value), max);\n });\n };\n\n const reset = () => {\n const value = initialValue ?? 0;\n if (typeof max === 'number' && value > max) return setValue(max);\n if (typeof min === 'number' && value < min) return setValue(min);\n setValue(value);\n };\n\n const set = (value: SetStateAction<number>) => {\n setValue((prevValue) => {\n const updatedCount = Math.max(\n min,\n Math.min(max, typeof value === 'number' ? value : value(prevValue))\n );\n\n return updatedCount;\n });\n };\n\n return { value, set, inc, dec, reset };\n}) as UseCounter;\n"],"mappings":"uEAwDA,IAAa,IAAe,GAAG,IAAkB,CAC/C,IAAM,EACJ,OAAO,EAAO,IAAO,SACjB,EAAO,GACN,EAAO,IAAsD,aAC9D,CAAE,MAAM,IAA0B,MAAM,MAC5C,OAAO,EAAO,IAAO,SACf,EAAO,IAAM,EAAE,CACf,EAAO,IAAM,EAAE,CAEjB,CAAC,EAAO,IAAA,EAAA,EAAA,UAAqB,GAAgB,EAAE,CAkCrD,MAAO,CAAE,QAAO,IAXH,GAAkC,CAC7C,EAAU,GACa,KAAK,IACxB,EACA,KAAK,IAAI,EAAK,OAAO,GAAU,SAAW,EAAQ,EAAM,EAAU,CAAC,CACpE,CAGD,EAGiB,KAhCR,EAAgB,IAAM,CACjC,EAAU,GACJ,OAAO,GAAQ,UAAY,IAAc,EAAY,EAClD,KAAK,IAAI,KAAK,IAAI,EAAK,EAAY,EAAM,CAAE,EAAI,CACtD,EA4BsB,KAzBb,EAAgB,IAAM,CACjC,EAAU,GACJ,OAAO,GAAQ,UAAY,IAAc,EAAY,EAClD,KAAK,IAAI,KAAK,IAAI,EAAK,EAAY,EAAM,CAAE,EAAI,CACtD,EAqB2B,UAlBX,CAClB,IAAM,EAAQ,GAAgB,EAC9B,GAAI,OAAO,GAAQ,UAAY,EAAQ,EAAK,OAAO,EAAS,EAAI,CAChE,GAAI,OAAO,GAAQ,UAAY,EAAQ,EAAK,OAAO,EAAS,EAAI,CAChE,EAAS,EAAM,EAcqB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=useCssVar.cjs.map
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils/helpers/isTarget.cjs`),t=require(`../useRefState/useRefState.cjs`);let n=require(`react`);var r=((...r)=>{let i=e.isTarget(r[0])?r[0]:void 0,a=i?r[1]:r[0],o=i?r[2]:r[1],[s,c]=(0,n.useState)(o??``),l=t.useRefState(),u=(0,n.useRef)(null),d=e=>{if(!u.current)return;let t=u.current;t.style&&(t.style.setProperty(a,e),c(e))},f=()=>{if(!u.current)return;let e=u.current;e.style&&(e.style.removeProperty(a),c(``))};return(0,n.useEffect)(()=>{if(!o)return;let t=(i?e.isTarget.getElement(i):l.current)??window.document.documentElement;t.style&&(t.style.setProperty(a,o),c(o))},[]),(0,n.useEffect)(()=>{let t=(i?e.isTarget.getElement(i):l.current)??window.document.documentElement;u.current=t;let n=new MutationObserver(()=>{let e=window.getComputedStyle(t).getPropertyValue(a)?.trim();c(e??o)});return n.observe(t,{attributeFilter:[`style`,`class`]}),()=>{n.disconnect()}},[i&&e.isTarget.getRawElement(i),l.state]),i?{value:s,set:d,remove:f}:{ref:l,value:s,set:d,remove:f}});exports.useCssVar=r;
|
|
2
|
+
//# sourceMappingURL=useCssVar.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCssVar.cjs","sources":["../../../../src/hooks/useCssVar/useCssVar.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\nimport type { HookTarget } from '@/utils/helpers';\n\nimport { isTarget } from '@/utils/helpers';\n\nimport type { StateRef } from '../useRefState/useRefState';\n\nimport { useRefState } from '../useRefState/useRefState';\n\n/** The css variable return type */\nexport interface UseCssVarReturn {\n /** The value of the CSS variable */\n value: string;\n /** Remove the value of the CSS variable */\n remove: () => void;\n /** Set the value of the CSS variable */\n set: (value: string) => void;\n}\n\nexport interface UseCssVar {\n <Target extends HTMLElement>(\n key: string,\n initialValue?: string\n ): UseCssVarReturn & {\n ref: StateRef<Target>;\n };\n\n (target: HookTarget, key: string, initialValue?: string): UseCssVarReturn;\n}\n\n/**\n * @name useCssVar\n * @description - Hook that returns the value of a css variable\n * @category Browser\n * @usage low\n\n * @overload\n * @param {string} key The CSS variable key\n * @param {string} initialValue The initial value of the CSS variable\n * @returns {UseCssVarReturn & { ref: StateRef<Element> }} The object containing the value of the CSS variable and ref\n *\n * @example\n * const { ref, value, set, remove } = useCssVar('--color', 'red');\n *\n * @overload\n * @param {HookTarget} target The target element\n * @param {string} key The CSS variable key\n * @param {string} initialValue The initial value of the CSS variable\n * @returns {UseCssVarReturn} The object containing the value of the CSS variable\n *\n * @example\n * const { value, set, remove } = useCssVar(ref, '--color', 'red');\n */\nexport const useCssVar = ((...params: any[]) => {\n const target = (isTarget(params[0]) ? params[0] : undefined) as HookTarget | undefined;\n const key = (target ? params[1] : params[0]) as string;\n const initialValue = (target ? params[2] : params[1]) as string | undefined;\n\n const [value, setValue] = useState(initialValue ?? '');\n const internalRef = useRefState<HTMLElement>();\n const elementRef = useRef<HTMLElement>(null);\n\n const set = (value: string) => {\n if (!elementRef.current) return;\n const element = elementRef.current;\n\n if (!element.style) return;\n element.style.setProperty(key, value);\n setValue(value);\n };\n\n const remove = () => {\n if (!elementRef.current) return;\n const element = elementRef.current;\n if (!element.style) return;\n\n element.style.removeProperty(key);\n setValue('');\n };\n\n useEffect(() => {\n if (!initialValue) return;\n\n const element =\n ((target ? isTarget.getElement(target) : internalRef.current) as HTMLElement) ??\n window.document.documentElement;\n\n if (!element.style) return;\n element.style.setProperty(key, initialValue);\n setValue(initialValue);\n }, []);\n\n useEffect(() => {\n const element =\n ((target ? isTarget.getElement(target) : internalRef.current) as HTMLElement) ??\n window.document.documentElement;\n\n elementRef.current = element;\n\n const onChange = () => {\n const value = window.getComputedStyle(element).getPropertyValue(key)?.trim();\n\n setValue(value ?? initialValue);\n };\n\n const observer = new MutationObserver(onChange);\n\n observer.observe(element, { attributeFilter: ['style', 'class'] });\n\n return () => {\n observer.disconnect();\n };\n }, [target && isTarget.getRawElement(target), internalRef.state]);\n\n if (target) return { value, set, remove };\n return { ref: internalRef, value, set, remove };\n}) as UseCssVar;\n"],"
|
|
1
|
+
{"version":3,"file":"useCssVar.cjs","names":[],"sources":["../../../../src/hooks/useCssVar/useCssVar.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\nimport type { HookTarget } from '@/utils/helpers';\n\nimport { isTarget } from '@/utils/helpers';\n\nimport type { StateRef } from '../useRefState/useRefState';\n\nimport { useRefState } from '../useRefState/useRefState';\n\n/** The css variable return type */\nexport interface UseCssVarReturn {\n /** The value of the CSS variable */\n value: string;\n /** Remove the value of the CSS variable */\n remove: () => void;\n /** Set the value of the CSS variable */\n set: (value: string) => void;\n}\n\nexport interface UseCssVar {\n <Target extends HTMLElement>(\n key: string,\n initialValue?: string\n ): UseCssVarReturn & {\n ref: StateRef<Target>;\n };\n\n (target: HookTarget, key: string, initialValue?: string): UseCssVarReturn;\n}\n\n/**\n * @name useCssVar\n * @description - Hook that returns the value of a css variable\n * @category Browser\n * @usage low\n\n * @overload\n * @param {string} key The CSS variable key\n * @param {string} initialValue The initial value of the CSS variable\n * @returns {UseCssVarReturn & { ref: StateRef<Element> }} The object containing the value of the CSS variable and ref\n *\n * @example\n * const { ref, value, set, remove } = useCssVar('--color', 'red');\n *\n * @overload\n * @param {HookTarget} target The target element\n * @param {string} key The CSS variable key\n * @param {string} initialValue The initial value of the CSS variable\n * @returns {UseCssVarReturn} The object containing the value of the CSS variable\n *\n * @example\n * const { value, set, remove } = useCssVar(ref, '--color', 'red');\n */\nexport const useCssVar = ((...params: any[]) => {\n const target = (isTarget(params[0]) ? params[0] : undefined) as HookTarget | undefined;\n const key = (target ? params[1] : params[0]) as string;\n const initialValue = (target ? params[2] : params[1]) as string | undefined;\n\n const [value, setValue] = useState(initialValue ?? '');\n const internalRef = useRefState<HTMLElement>();\n const elementRef = useRef<HTMLElement>(null);\n\n const set = (value: string) => {\n if (!elementRef.current) return;\n const element = elementRef.current;\n\n if (!element.style) return;\n element.style.setProperty(key, value);\n setValue(value);\n };\n\n const remove = () => {\n if (!elementRef.current) return;\n const element = elementRef.current;\n if (!element.style) return;\n\n element.style.removeProperty(key);\n setValue('');\n };\n\n useEffect(() => {\n if (!initialValue) return;\n\n const element =\n ((target ? isTarget.getElement(target) : internalRef.current) as HTMLElement) ??\n window.document.documentElement;\n\n if (!element.style) return;\n element.style.setProperty(key, initialValue);\n setValue(initialValue);\n }, []);\n\n useEffect(() => {\n const element =\n ((target ? isTarget.getElement(target) : internalRef.current) as HTMLElement) ??\n window.document.documentElement;\n\n elementRef.current = element;\n\n const onChange = () => {\n const value = window.getComputedStyle(element).getPropertyValue(key)?.trim();\n\n setValue(value ?? initialValue);\n };\n\n const observer = new MutationObserver(onChange);\n\n observer.observe(element, { attributeFilter: ['style', 'class'] });\n\n return () => {\n observer.disconnect();\n };\n }, [target && isTarget.getRawElement(target), internalRef.state]);\n\n if (target) return { value, set, remove };\n return { ref: internalRef, value, set, remove };\n}) as UseCssVar;\n"],"mappings":"uKAsDA,IAAa,IAAc,GAAG,IAAkB,CAC9C,IAAM,EAAU,EAAA,SAAS,EAAO,GAAG,CAAG,EAAO,GAAK,IAAA,GAC5C,EAAO,EAAS,EAAO,GAAK,EAAO,GACnC,EAAgB,EAAS,EAAO,GAAK,EAAO,GAE5C,CAAC,EAAO,IAAA,EAAA,EAAA,UAAqB,GAAgB,GAAG,CAChD,EAAc,EAAA,aAA0B,CACxC,GAAA,EAAA,EAAA,QAAiC,KAAK,CAEtC,EAAO,GAAkB,CAC7B,GAAI,CAAC,EAAW,QAAS,OACzB,IAAM,EAAU,EAAW,QAEtB,EAAQ,QACb,EAAQ,MAAM,YAAY,EAAK,EAAM,CACrC,EAAS,EAAM,GAGX,MAAe,CACnB,GAAI,CAAC,EAAW,QAAS,OACzB,IAAM,EAAU,EAAW,QACtB,EAAQ,QAEb,EAAQ,MAAM,eAAe,EAAI,CACjC,EAAS,GAAG,GAsCd,OAnCA,EAAA,EAAA,eAAgB,CACd,GAAI,CAAC,EAAc,OAEnB,IAAM,GACF,EAAS,EAAA,SAAS,WAAW,EAAO,CAAG,EAAY,UACrD,OAAO,SAAS,gBAEb,EAAQ,QACb,EAAQ,MAAM,YAAY,EAAK,EAAa,CAC5C,EAAS,EAAa,GACrB,EAAE,CAAC,EAEN,EAAA,EAAA,eAAgB,CACd,IAAM,GACF,EAAS,EAAA,SAAS,WAAW,EAAO,CAAG,EAAY,UACrD,OAAO,SAAS,gBAElB,EAAW,QAAU,EAQrB,IAAM,EAAW,IAAI,qBANE,CACrB,IAAM,EAAQ,OAAO,iBAAiB,EAAQ,CAAC,iBAAiB,EAAI,EAAE,MAAM,CAE5E,EAAS,GAAS,EAAa,EAGc,CAI/C,OAFA,EAAS,QAAQ,EAAS,CAAE,gBAAiB,CAAC,QAAS,QAAQ,CAAE,CAAC,KAErD,CACX,EAAS,YAAY,GAEtB,CAAC,GAAU,EAAA,SAAS,cAAc,EAAO,CAAE,EAAY,MAAM,CAAC,CAE7D,EAAe,CAAE,QAAO,MAAK,SAAQ,CAClC,CAAE,IAAK,EAAa,QAAO,MAAK,SAAQ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=useDebounceCallback.cjs.map
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`react`);var t=(t,n)=>{let r=(0,e.useRef)(t),i=(0,e.useRef)(null),a=(0,e.useRef)(n);return r.current=t,a.current=n,(0,e.useMemo)(()=>{let e=()=>{i.current&&=(clearTimeout(i.current),null)},t=function(...t){e(),i.current=setTimeout(()=>{r.current.apply(this,t)},a.current)};return t.cancel=e,t},[])};exports.useDebounceCallback=t;
|
|
2
|
+
//# sourceMappingURL=useDebounceCallback.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDebounceCallback.cjs","sources":["../../../../src/hooks/useDebounceCallback/useDebounceCallback.ts"],"sourcesContent":["import { useMemo, useRef } from 'react';\n\nexport type DebouncedCallback<Params extends unknown[]> = ((...args: Params) => void) & {\n cancel: () => void;\n};\n\n/**\n * @name useDebounceCallback\n * @description - Hook that creates a debounced callback\n * @category Utilities\n * @usage high\n *\n * @template Params The type of the params\n * @template Return The type of the return\n * @param {(...args: Params) => Return} callback The callback function\n * @param {number} delay The delay in milliseconds\n * @returns {(...args: Params) => Return} The callback with debounce\n *\n * @example\n * const debouncedCallback = useDebounceCallback(() => console.log('callback'), 500);\n */\nexport const useDebounceCallback = <Params extends unknown[], Return>(\n callback: (...args: Params) => Return,\n delay: number\n): DebouncedCallback<Params> => {\n const internalCallbackRef = useRef(callback);\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const delayRef = useRef(delay);\n\n internalCallbackRef.current = callback;\n delayRef.current = delay;\n\n const debounced = useMemo(() => {\n const cancel = () => {\n if (!timerRef.current) return;\n clearTimeout(timerRef.current);\n timerRef.current = null;\n };\n\n const debouncedCallback = function (this: any, ...args: Params) {\n cancel();\n timerRef.current = setTimeout(() => {\n internalCallbackRef.current.apply(this, args);\n }, delayRef.current);\n };\n\n debouncedCallback.cancel = cancel;\n\n return debouncedCallback;\n }, []);\n\n return debounced;\n};\n"],"
|
|
1
|
+
{"version":3,"file":"useDebounceCallback.cjs","names":[],"sources":["../../../../src/hooks/useDebounceCallback/useDebounceCallback.ts"],"sourcesContent":["import { useMemo, useRef } from 'react';\n\nexport type DebouncedCallback<Params extends unknown[]> = ((...args: Params) => void) & {\n cancel: () => void;\n};\n\n/**\n * @name useDebounceCallback\n * @description - Hook that creates a debounced callback\n * @category Utilities\n * @usage high\n *\n * @template Params The type of the params\n * @template Return The type of the return\n * @param {(...args: Params) => Return} callback The callback function\n * @param {number} delay The delay in milliseconds\n * @returns {(...args: Params) => Return} The callback with debounce\n *\n * @example\n * const debouncedCallback = useDebounceCallback(() => console.log('callback'), 500);\n */\nexport const useDebounceCallback = <Params extends unknown[], Return>(\n callback: (...args: Params) => Return,\n delay: number\n): DebouncedCallback<Params> => {\n const internalCallbackRef = useRef(callback);\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const delayRef = useRef(delay);\n\n internalCallbackRef.current = callback;\n delayRef.current = delay;\n\n const debounced = useMemo(() => {\n const cancel = () => {\n if (!timerRef.current) return;\n clearTimeout(timerRef.current);\n timerRef.current = null;\n };\n\n const debouncedCallback = function (this: any, ...args: Params) {\n cancel();\n timerRef.current = setTimeout(() => {\n internalCallbackRef.current.apply(this, args);\n }, delayRef.current);\n };\n\n debouncedCallback.cancel = cancel;\n\n return debouncedCallback;\n }, []);\n\n return debounced;\n};\n"],"mappings":"uEAqBA,IAAa,GACX,EACA,IAC8B,CAC9B,IAAM,GAAA,EAAA,EAAA,QAA6B,EAAS,CACtC,GAAA,EAAA,EAAA,QAAwD,KAAK,CAC7D,GAAA,EAAA,EAAA,QAAkB,EAAM,CAwB9B,MAtBA,GAAoB,QAAU,EAC9B,EAAS,QAAU,GAqBnB,EAAA,EAAA,aAnBgC,CAC9B,IAAM,MAAe,CACd,AAEL,EAAS,WADT,aAAa,EAAS,QAAQ,CACX,OAGf,EAAoB,SAAqB,GAAG,EAAc,CAC9D,GAAQ,CACR,EAAS,QAAU,eAAiB,CAClC,EAAoB,QAAQ,MAAM,KAAM,EAAK,EAC5C,EAAS,QAAQ,EAKtB,MAFA,GAAkB,OAAS,EAEpB,GACN,EAAE,CAAC"}
|