@siberiacancode/reactuse 0.2.28 → 0.2.30
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/README.md +71 -71
- package/dist/cjs/helpers/createContext/createContext.cjs.map +1 -1
- package/dist/cjs/helpers/createEventEmitter/createEventEmitter.cjs.map +1 -1
- package/dist/cjs/helpers/createReactiveContext/createReactiveContext.cjs.map +1 -1
- package/dist/cjs/helpers/createStore/createStore.cjs.map +1 -1
- package/dist/cjs/hooks/useActiveElement/useActiveElement.cjs.map +1 -1
- package/dist/cjs/hooks/useAsync/useAsync.cjs.map +1 -1
- package/dist/cjs/hooks/useAudio/useAudio.cjs.map +1 -1
- package/dist/cjs/hooks/useAutoScroll/useAutoScroll.cjs +1 -1
- package/dist/cjs/hooks/useAutoScroll/useAutoScroll.cjs.map +1 -1
- package/dist/cjs/hooks/useBattery/useBattery.cjs +1 -1
- package/dist/cjs/hooks/useBattery/useBattery.cjs.map +1 -1
- package/dist/cjs/hooks/useBluetooth/useBluetooth.cjs +1 -1
- package/dist/cjs/hooks/useBluetooth/useBluetooth.cjs.map +1 -1
- package/dist/cjs/hooks/useBoolean/useBoolean.cjs.map +1 -1
- package/dist/cjs/hooks/useBreakpoints/useBreakpoints.cjs.map +1 -1
- package/dist/cjs/hooks/useBroadcastChannel/useBroadcastChannel.cjs +1 -1
- package/dist/cjs/hooks/useBroadcastChannel/useBroadcastChannel.cjs.map +1 -1
- package/dist/cjs/hooks/useBrowserLanguage/useBrowserLanguage.cjs.map +1 -1
- package/dist/cjs/hooks/useClickOutside/useClickOutside.cjs.map +1 -1
- package/dist/cjs/hooks/useClipboard/useClipboard.cjs.map +1 -1
- package/dist/cjs/hooks/useConst/useConst.cjs.map +1 -1
- package/dist/cjs/hooks/useCookie/useCookie.cjs.map +1 -1
- package/dist/cjs/hooks/useCookies/useCookies.cjs.map +1 -1
- package/dist/cjs/hooks/useCopy/useCopy.cjs.map +1 -1
- package/dist/cjs/hooks/useCounter/useCounter.cjs.map +1 -1
- package/dist/cjs/hooks/useCssVar/useCssVar.cjs.map +1 -1
- package/dist/cjs/hooks/useDebounceCallback/useDebounceCallback.cjs.map +1 -1
- package/dist/cjs/hooks/useDebounceState/useDebounceState.cjs +2 -0
- package/dist/cjs/hooks/useDebounceState/useDebounceState.cjs.map +1 -0
- package/dist/cjs/hooks/useDebounceValue/useDebounceValue.cjs.map +1 -1
- package/dist/cjs/hooks/useDefault/useDefault.cjs.map +1 -1
- package/dist/cjs/hooks/useDeviceMotion/useDeviceMotion.cjs.map +1 -1
- package/dist/cjs/hooks/useDeviceOrientation/useDeviceOrientation.cjs +1 -1
- package/dist/cjs/hooks/useDeviceOrientation/useDeviceOrientation.cjs.map +1 -1
- package/dist/cjs/hooks/useDevicePixelRatio/useDevicePixelRatio.cjs +1 -1
- package/dist/cjs/hooks/useDevicePixelRatio/useDevicePixelRatio.cjs.map +1 -1
- package/dist/cjs/hooks/useDidUpdate/useDidUpdate.cjs.map +1 -1
- package/dist/cjs/hooks/useDisclosure/useDisclosure.cjs.map +1 -1
- package/dist/cjs/hooks/useDisplayMedia/useDisplayMedia.cjs.map +1 -1
- package/dist/cjs/hooks/useDocumentEvent/useDocumentEvent.cjs.map +1 -1
- package/dist/cjs/hooks/useDocumentTitle/useDocumentTitle.cjs.map +1 -1
- package/dist/cjs/hooks/useDocumentVisibility/useDocumentVisibility.cjs.map +1 -1
- package/dist/cjs/hooks/useDoubleClick/useDoubleClick.cjs.map +1 -1
- package/dist/cjs/hooks/useDropZone/useDropZone.cjs +1 -1
- package/dist/cjs/hooks/useDropZone/useDropZone.cjs.map +1 -1
- package/dist/cjs/hooks/useElementSize/useElementSize.cjs.map +1 -1
- package/dist/cjs/hooks/useEvent/useEvent.cjs.map +1 -1
- package/dist/cjs/hooks/useEventListener/useEventListener.cjs +1 -1
- package/dist/cjs/hooks/useEventListener/useEventListener.cjs.map +1 -1
- package/dist/cjs/hooks/useEventSource/useEventSource.cjs.map +1 -1
- package/dist/cjs/hooks/useEyeDropper/useEyeDropper.cjs +1 -1
- package/dist/cjs/hooks/useEyeDropper/useEyeDropper.cjs.map +1 -1
- package/dist/cjs/hooks/useFavicon/useFavicon.cjs +1 -1
- package/dist/cjs/hooks/useFavicon/useFavicon.cjs.map +1 -1
- package/dist/cjs/hooks/useField/useField.cjs.map +1 -1
- package/dist/cjs/hooks/useFileDialog/useFileDialog.cjs.map +1 -1
- package/dist/cjs/hooks/useFocus/useFocus.cjs +1 -1
- package/dist/cjs/hooks/useFocus/useFocus.cjs.map +1 -1
- package/dist/cjs/hooks/useFps/useFps.cjs.map +1 -1
- package/dist/cjs/hooks/useFul/useFul.cjs.map +1 -1
- package/dist/cjs/hooks/useFullscreen/useFullscreen.cjs.map +1 -1
- package/dist/cjs/hooks/useGamepad/useGamepad.cjs +1 -1
- package/dist/cjs/hooks/useGamepad/useGamepad.cjs.map +1 -1
- package/dist/cjs/hooks/useGeolocation/useGeolocation.cjs.map +1 -1
- package/dist/cjs/hooks/useHash/useHash.cjs.map +1 -1
- package/dist/cjs/hooks/useHotkeys/useHotkeys.cjs.map +1 -1
- package/dist/cjs/hooks/useHover/useHover.cjs +1 -1
- package/dist/cjs/hooks/useHover/useHover.cjs.map +1 -1
- package/dist/cjs/hooks/useIdle/useIdle.cjs.map +1 -1
- package/dist/cjs/hooks/useImage/useImage.cjs.map +1 -1
- package/dist/cjs/hooks/useInfiniteScroll/useInfiniteScroll.cjs.map +1 -1
- package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.cjs +1 -1
- package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.cjs.map +1 -1
- package/dist/cjs/hooks/useInterval/useInterval.cjs.map +1 -1
- package/dist/cjs/hooks/useIsFirstRender/useIsFirstRender.cjs.map +1 -1
- package/dist/cjs/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.cjs.map +1 -1
- package/dist/cjs/hooks/useKeyPress/useKeyPress.cjs.map +1 -1
- package/dist/cjs/hooks/useKeyPressEvent/useKeyPressEvent.cjs.map +1 -1
- package/dist/cjs/hooks/useKeyboard/useKeyboard.cjs.map +1 -1
- package/dist/cjs/hooks/useKeysPressed/useKeysPressed.cjs.map +1 -1
- package/dist/cjs/hooks/useLastChanged/useLastChanged.cjs.map +1 -1
- package/dist/cjs/hooks/useLatest/useLatest.cjs.map +1 -1
- package/dist/cjs/hooks/useLess/useLess.cjs.map +1 -1
- package/dist/cjs/hooks/useList/useList.cjs.map +1 -1
- package/dist/cjs/hooks/useLocalStorage/useLocalStorage.cjs.map +1 -1
- package/dist/cjs/hooks/useLockCallback/useLockCallback.cjs.map +1 -1
- package/dist/cjs/hooks/useLockScroll/useLockScroll.cjs.map +1 -1
- package/dist/cjs/hooks/useLogger/useLogger.cjs.map +1 -1
- package/dist/cjs/hooks/useLongPress/useLongPress.cjs.map +1 -1
- package/dist/cjs/hooks/useMap/useMap.cjs.map +1 -1
- package/dist/cjs/hooks/useMeasure/useMeasure.cjs.map +1 -1
- package/dist/cjs/hooks/useMediaControls/useMediaControls.cjs.map +1 -1
- package/dist/cjs/hooks/useMediaQuery/useMediaQuery.cjs.map +1 -1
- package/dist/cjs/hooks/useMemory/useMemory.cjs +1 -1
- package/dist/cjs/hooks/useMemory/useMemory.cjs.map +1 -1
- package/dist/cjs/hooks/useMergedRef/useMergedRef.cjs +2 -0
- package/dist/cjs/hooks/useMergedRef/useMergedRef.cjs.map +1 -0
- package/dist/cjs/hooks/useMount/useMount.cjs.map +1 -1
- package/dist/cjs/hooks/useMouse/useMouse.cjs.map +1 -1
- package/dist/cjs/hooks/useMutation/useMutation.cjs +1 -1
- package/dist/cjs/hooks/useMutation/useMutation.cjs.map +1 -1
- package/dist/cjs/hooks/useMutationObserver/useMutationObserver.cjs +1 -1
- package/dist/cjs/hooks/useMutationObserver/useMutationObserver.cjs.map +1 -1
- package/dist/cjs/hooks/useNetwork/useNetwork.cjs.map +1 -1
- package/dist/cjs/hooks/useOffsetPagination/useOffsetPagination.cjs +1 -1
- package/dist/cjs/hooks/useOffsetPagination/useOffsetPagination.cjs.map +1 -1
- package/dist/cjs/hooks/useOnce/useOnce.cjs.map +1 -1
- package/dist/cjs/hooks/useOnline/useOnline.cjs.map +1 -1
- package/dist/cjs/hooks/useOperatingSystem/useOperatingSystem.cjs.map +1 -1
- package/dist/cjs/hooks/useOptimistic/useOptimistic.cjs.map +1 -1
- package/dist/cjs/hooks/useOrientation/useOrientation.cjs +1 -1
- package/dist/cjs/hooks/useOrientation/useOrientation.cjs.map +1 -1
- package/dist/cjs/hooks/useOtpCredential/useOtpCredential.cjs +1 -1
- package/dist/cjs/hooks/useOtpCredential/useOtpCredential.cjs.map +1 -1
- package/dist/cjs/hooks/usePageLeave/usePageLeave.cjs.map +1 -1
- package/dist/cjs/hooks/usePaint/usePaint.cjs.map +1 -1
- package/dist/cjs/hooks/useParallax/useParallax.cjs.map +1 -1
- package/dist/cjs/hooks/usePerformanceObserver/usePerformanceObserver.cjs +1 -1
- package/dist/cjs/hooks/usePerformanceObserver/usePerformanceObserver.cjs.map +1 -1
- package/dist/cjs/hooks/usePermission/usePermission.cjs +1 -1
- package/dist/cjs/hooks/usePermission/usePermission.cjs.map +1 -1
- package/dist/cjs/hooks/usePictureInPicture/usePictureInPicture.cjs +1 -1
- package/dist/cjs/hooks/usePictureInPicture/usePictureInPicture.cjs.map +1 -1
- package/dist/cjs/hooks/usePointerLock/usePointerLock.cjs +1 -1
- package/dist/cjs/hooks/usePointerLock/usePointerLock.cjs.map +1 -1
- package/dist/cjs/hooks/usePostMessage/usePostMessage.cjs.map +1 -1
- package/dist/cjs/hooks/usePreferredColorScheme/usePreferredColorScheme.cjs.map +1 -1
- package/dist/cjs/hooks/usePreferredContrast/usePreferredContrast.cjs.map +1 -1
- package/dist/cjs/hooks/usePreferredDark/usePreferredDark.cjs.map +1 -1
- package/dist/cjs/hooks/usePreferredLanguages/usePreferredLanguages.cjs.map +1 -1
- package/dist/cjs/hooks/usePreferredReducedMotion/usePreferredReducedMotion.cjs.map +1 -1
- package/dist/cjs/hooks/usePrevious/usePrevious.cjs.map +1 -1
- package/dist/cjs/hooks/useQuery/useQuery.cjs.map +1 -1
- package/dist/cjs/hooks/useQueue/useQueue.cjs.map +1 -1
- package/dist/cjs/hooks/useRaf/useRaf.cjs.map +1 -1
- package/dist/cjs/hooks/useRafState/useRafState.cjs.map +1 -1
- package/dist/cjs/hooks/useRefState/useRefState.cjs.map +1 -1
- package/dist/cjs/hooks/useRenderCount/useRenderCount.cjs.map +1 -1
- package/dist/cjs/hooks/useRenderInfo/useRenderInfo.cjs.map +1 -1
- package/dist/cjs/hooks/useRerender/useRerender.cjs.map +1 -1
- package/dist/cjs/hooks/useResizeObserver/useResizeObserver.cjs +1 -1
- package/dist/cjs/hooks/useResizeObserver/useResizeObserver.cjs.map +1 -1
- package/dist/cjs/hooks/useRightClick/useRightClick.cjs.map +1 -1
- package/dist/cjs/hooks/useScript/useScript.cjs.map +1 -1
- package/dist/cjs/hooks/useScroll/useScroll.cjs.map +1 -1
- package/dist/cjs/hooks/useScrollIntoView/useScrollIntoView.cjs.map +1 -1
- package/dist/cjs/hooks/useScrollTo/useScrollTo.cjs.map +1 -1
- package/dist/cjs/hooks/useSessionStorage/useSessionStorage.cjs.map +1 -1
- package/dist/cjs/hooks/useSet/useSet.cjs.map +1 -1
- package/dist/cjs/hooks/useShallowEffect/useShallowEffect.cjs.map +1 -1
- package/dist/cjs/hooks/useShare/useShare.cjs +1 -1
- package/dist/cjs/hooks/useShare/useShare.cjs.map +1 -1
- package/dist/cjs/hooks/useSpeechRecognition/useSpeechRecognition.cjs.map +1 -1
- package/dist/cjs/hooks/useSpeechSynthesis/useSpeechSynthesis.cjs +1 -1
- package/dist/cjs/hooks/useSpeechSynthesis/useSpeechSynthesis.cjs.map +1 -1
- package/dist/cjs/hooks/useStateHistory/useStateHistory.cjs.map +1 -1
- package/dist/cjs/hooks/useStep/useStep.cjs.map +1 -1
- package/dist/cjs/hooks/useSticky/useSticky.cjs.map +1 -1
- package/dist/cjs/hooks/useStopwatch/useStopwatch.cjs.map +1 -1
- package/dist/cjs/hooks/useStorage/useStorage.cjs.map +1 -1
- package/dist/cjs/hooks/useTextDirection/useTextDirection.cjs +1 -1
- package/dist/cjs/hooks/useTextDirection/useTextDirection.cjs.map +1 -1
- package/dist/cjs/hooks/useTextSelection/useTextSelection.cjs.map +1 -1
- package/dist/cjs/hooks/useThrottleCallback/useThrottleCallback.cjs.map +1 -1
- package/dist/cjs/hooks/useThrottleState/useThrottleState.cjs +2 -0
- package/dist/cjs/hooks/useThrottleState/useThrottleState.cjs.map +1 -0
- package/dist/cjs/hooks/useThrottleValue/useThrottleValue.cjs.map +1 -1
- package/dist/cjs/hooks/useTime/useTime.cjs.map +1 -1
- package/dist/cjs/hooks/useTimeout/useTimeout.cjs.map +1 -1
- package/dist/cjs/hooks/useTimer/useTimer.cjs.map +1 -1
- package/dist/cjs/hooks/useToggle/useToggle.cjs.map +1 -1
- package/dist/cjs/hooks/useUnmount/useUnmount.cjs.map +1 -1
- package/dist/cjs/hooks/useUrlSearchParam/useUrlSearchParam.cjs.map +1 -1
- package/dist/cjs/hooks/useUrlSearchParams/useUrlSearchParams.cjs.map +1 -1
- package/dist/cjs/hooks/useVibrate/useVibrate.cjs +1 -1
- package/dist/cjs/hooks/useVibrate/useVibrate.cjs.map +1 -1
- package/dist/cjs/hooks/useVirtualKeyboard/useVirtualKeyboard.cjs +1 -1
- package/dist/cjs/hooks/useVirtualKeyboard/useVirtualKeyboard.cjs.map +1 -1
- package/dist/cjs/hooks/useWakeLock/useWakeLock.cjs +1 -1
- package/dist/cjs/hooks/useWakeLock/useWakeLock.cjs.map +1 -1
- package/dist/cjs/hooks/useWebSocket/useWebSocket.cjs.map +1 -1
- package/dist/cjs/hooks/useWindowEvent/useWindowEvent.cjs.map +1 -1
- package/dist/cjs/hooks/useWindowFocus/useWindowFocus.cjs.map +1 -1
- package/dist/cjs/hooks/useWindowScroll/useWindowScroll.cjs.map +1 -1
- package/dist/cjs/hooks/useWindowSize/useWindowSize.cjs.map +1 -1
- package/dist/cjs/hooks/useWizard/useWizard.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/esm/helpers/createContext/createContext.mjs.map +1 -1
- package/dist/esm/helpers/createEventEmitter/createEventEmitter.mjs.map +1 -1
- package/dist/esm/helpers/createReactiveContext/createReactiveContext.mjs.map +1 -1
- package/dist/esm/helpers/createStore/createStore.mjs.map +1 -1
- package/dist/esm/hooks/useActiveElement/useActiveElement.mjs.map +1 -1
- package/dist/esm/hooks/useAsync/useAsync.mjs.map +1 -1
- package/dist/esm/hooks/useAudio/useAudio.mjs.map +1 -1
- package/dist/esm/hooks/useAutoScroll/useAutoScroll.mjs +25 -31
- package/dist/esm/hooks/useAutoScroll/useAutoScroll.mjs.map +1 -1
- package/dist/esm/hooks/useBattery/useBattery.mjs +1 -1
- package/dist/esm/hooks/useBattery/useBattery.mjs.map +1 -1
- package/dist/esm/hooks/useBluetooth/useBluetooth.mjs +16 -18
- package/dist/esm/hooks/useBluetooth/useBluetooth.mjs.map +1 -1
- package/dist/esm/hooks/useBoolean/useBoolean.mjs.map +1 -1
- package/dist/esm/hooks/useBreakpoints/useBreakpoints.mjs.map +1 -1
- package/dist/esm/hooks/useBroadcastChannel/useBroadcastChannel.mjs +8 -8
- package/dist/esm/hooks/useBroadcastChannel/useBroadcastChannel.mjs.map +1 -1
- package/dist/esm/hooks/useBrowserLanguage/useBrowserLanguage.mjs.map +1 -1
- package/dist/esm/hooks/useClickOutside/useClickOutside.mjs.map +1 -1
- package/dist/esm/hooks/useClipboard/useClipboard.mjs.map +1 -1
- package/dist/esm/hooks/useConst/useConst.mjs.map +1 -1
- package/dist/esm/hooks/useCookie/useCookie.mjs.map +1 -1
- package/dist/esm/hooks/useCookies/useCookies.mjs.map +1 -1
- package/dist/esm/hooks/useCopy/useCopy.mjs.map +1 -1
- package/dist/esm/hooks/useCounter/useCounter.mjs.map +1 -1
- package/dist/esm/hooks/useCssVar/useCssVar.mjs.map +1 -1
- package/dist/esm/hooks/useDebounceCallback/useDebounceCallback.mjs.map +1 -1
- package/dist/esm/hooks/useDebounceState/useDebounceState.mjs +10 -0
- package/dist/esm/hooks/useDebounceState/useDebounceState.mjs.map +1 -0
- package/dist/esm/hooks/useDebounceValue/useDebounceValue.mjs.map +1 -1
- package/dist/esm/hooks/useDefault/useDefault.mjs.map +1 -1
- package/dist/esm/hooks/useDeviceMotion/useDeviceMotion.mjs.map +1 -1
- package/dist/esm/hooks/useDeviceOrientation/useDeviceOrientation.mjs +1 -1
- package/dist/esm/hooks/useDeviceOrientation/useDeviceOrientation.mjs.map +1 -1
- package/dist/esm/hooks/useDevicePixelRatio/useDevicePixelRatio.mjs +1 -1
- package/dist/esm/hooks/useDevicePixelRatio/useDevicePixelRatio.mjs.map +1 -1
- package/dist/esm/hooks/useDidUpdate/useDidUpdate.mjs.map +1 -1
- package/dist/esm/hooks/useDisclosure/useDisclosure.mjs.map +1 -1
- package/dist/esm/hooks/useDisplayMedia/useDisplayMedia.mjs.map +1 -1
- package/dist/esm/hooks/useDocumentEvent/useDocumentEvent.mjs.map +1 -1
- package/dist/esm/hooks/useDocumentTitle/useDocumentTitle.mjs.map +1 -1
- package/dist/esm/hooks/useDocumentVisibility/useDocumentVisibility.mjs.map +1 -1
- package/dist/esm/hooks/useDoubleClick/useDoubleClick.mjs.map +1 -1
- package/dist/esm/hooks/useDropZone/useDropZone.mjs +12 -12
- package/dist/esm/hooks/useDropZone/useDropZone.mjs.map +1 -1
- package/dist/esm/hooks/useElementSize/useElementSize.mjs.map +1 -1
- package/dist/esm/hooks/useEvent/useEvent.mjs.map +1 -1
- package/dist/esm/hooks/useEventListener/useEventListener.mjs +15 -15
- package/dist/esm/hooks/useEventListener/useEventListener.mjs.map +1 -1
- package/dist/esm/hooks/useEventSource/useEventSource.mjs.map +1 -1
- package/dist/esm/hooks/useEyeDropper/useEyeDropper.mjs +3 -3
- package/dist/esm/hooks/useEyeDropper/useEyeDropper.mjs.map +1 -1
- package/dist/esm/hooks/useFavicon/useFavicon.mjs +12 -15
- package/dist/esm/hooks/useFavicon/useFavicon.mjs.map +1 -1
- package/dist/esm/hooks/useField/useField.mjs.map +1 -1
- package/dist/esm/hooks/useFileDialog/useFileDialog.mjs.map +1 -1
- package/dist/esm/hooks/useFocus/useFocus.mjs +26 -22
- package/dist/esm/hooks/useFocus/useFocus.mjs.map +1 -1
- package/dist/esm/hooks/useFps/useFps.mjs.map +1 -1
- package/dist/esm/hooks/useFul/useFul.mjs.map +1 -1
- package/dist/esm/hooks/useFullscreen/useFullscreen.mjs.map +1 -1
- package/dist/esm/hooks/useGamepad/useGamepad.mjs +13 -13
- package/dist/esm/hooks/useGamepad/useGamepad.mjs.map +1 -1
- package/dist/esm/hooks/useGeolocation/useGeolocation.mjs.map +1 -1
- package/dist/esm/hooks/useHash/useHash.mjs.map +1 -1
- package/dist/esm/hooks/useHotkeys/useHotkeys.mjs.map +1 -1
- package/dist/esm/hooks/useHover/useHover.mjs +15 -15
- package/dist/esm/hooks/useHover/useHover.mjs.map +1 -1
- package/dist/esm/hooks/useIdle/useIdle.mjs.map +1 -1
- package/dist/esm/hooks/useImage/useImage.mjs.map +1 -1
- package/dist/esm/hooks/useInfiniteScroll/useInfiniteScroll.mjs.map +1 -1
- package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.mjs +19 -18
- package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.mjs.map +1 -1
- package/dist/esm/hooks/useInterval/useInterval.mjs.map +1 -1
- package/dist/esm/hooks/useIsFirstRender/useIsFirstRender.mjs.map +1 -1
- package/dist/esm/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs.map +1 -1
- package/dist/esm/hooks/useKeyPress/useKeyPress.mjs.map +1 -1
- package/dist/esm/hooks/useKeyPressEvent/useKeyPressEvent.mjs.map +1 -1
- package/dist/esm/hooks/useKeyboard/useKeyboard.mjs.map +1 -1
- package/dist/esm/hooks/useKeysPressed/useKeysPressed.mjs.map +1 -1
- package/dist/esm/hooks/useLastChanged/useLastChanged.mjs.map +1 -1
- package/dist/esm/hooks/useLatest/useLatest.mjs.map +1 -1
- package/dist/esm/hooks/useLess/useLess.mjs.map +1 -1
- package/dist/esm/hooks/useList/useList.mjs.map +1 -1
- package/dist/esm/hooks/useLocalStorage/useLocalStorage.mjs.map +1 -1
- package/dist/esm/hooks/useLockCallback/useLockCallback.mjs.map +1 -1
- package/dist/esm/hooks/useLockScroll/useLockScroll.mjs.map +1 -1
- package/dist/esm/hooks/useLogger/useLogger.mjs.map +1 -1
- package/dist/esm/hooks/useLongPress/useLongPress.mjs.map +1 -1
- package/dist/esm/hooks/useMap/useMap.mjs.map +1 -1
- package/dist/esm/hooks/useMeasure/useMeasure.mjs.map +1 -1
- package/dist/esm/hooks/useMediaControls/useMediaControls.mjs.map +1 -1
- package/dist/esm/hooks/useMediaQuery/useMediaQuery.mjs.map +1 -1
- package/dist/esm/hooks/useMemory/useMemory.mjs +4 -4
- package/dist/esm/hooks/useMemory/useMemory.mjs.map +1 -1
- package/dist/esm/hooks/useMergedRef/useMergedRef.mjs +25 -0
- package/dist/esm/hooks/useMergedRef/useMergedRef.mjs.map +1 -0
- package/dist/esm/hooks/useMount/useMount.mjs.map +1 -1
- package/dist/esm/hooks/useMouse/useMouse.mjs.map +1 -1
- package/dist/esm/hooks/useMutation/useMutation.mjs +18 -18
- package/dist/esm/hooks/useMutation/useMutation.mjs.map +1 -1
- package/dist/esm/hooks/useMutationObserver/useMutationObserver.mjs +28 -20
- package/dist/esm/hooks/useMutationObserver/useMutationObserver.mjs.map +1 -1
- package/dist/esm/hooks/useNetwork/useNetwork.mjs.map +1 -1
- package/dist/esm/hooks/useOffsetPagination/useOffsetPagination.mjs +34 -41
- package/dist/esm/hooks/useOffsetPagination/useOffsetPagination.mjs.map +1 -1
- package/dist/esm/hooks/useOnce/useOnce.mjs.map +1 -1
- package/dist/esm/hooks/useOnline/useOnline.mjs.map +1 -1
- package/dist/esm/hooks/useOperatingSystem/useOperatingSystem.mjs.map +1 -1
- package/dist/esm/hooks/useOptimistic/useOptimistic.mjs.map +1 -1
- package/dist/esm/hooks/useOrientation/useOrientation.mjs +9 -9
- package/dist/esm/hooks/useOrientation/useOrientation.mjs.map +1 -1
- package/dist/esm/hooks/useOtpCredential/useOtpCredential.mjs +3 -3
- package/dist/esm/hooks/useOtpCredential/useOtpCredential.mjs.map +1 -1
- package/dist/esm/hooks/usePageLeave/usePageLeave.mjs.map +1 -1
- package/dist/esm/hooks/usePaint/usePaint.mjs.map +1 -1
- package/dist/esm/hooks/useParallax/useParallax.mjs.map +1 -1
- package/dist/esm/hooks/usePerformanceObserver/usePerformanceObserver.mjs +11 -11
- package/dist/esm/hooks/usePerformanceObserver/usePerformanceObserver.mjs.map +1 -1
- package/dist/esm/hooks/usePermission/usePermission.mjs +4 -4
- package/dist/esm/hooks/usePermission/usePermission.mjs.map +1 -1
- package/dist/esm/hooks/usePictureInPicture/usePictureInPicture.mjs +17 -17
- package/dist/esm/hooks/usePictureInPicture/usePictureInPicture.mjs.map +1 -1
- package/dist/esm/hooks/usePointerLock/usePointerLock.mjs +3 -3
- package/dist/esm/hooks/usePointerLock/usePointerLock.mjs.map +1 -1
- package/dist/esm/hooks/usePostMessage/usePostMessage.mjs.map +1 -1
- package/dist/esm/hooks/usePreferredColorScheme/usePreferredColorScheme.mjs.map +1 -1
- package/dist/esm/hooks/usePreferredContrast/usePreferredContrast.mjs.map +1 -1
- package/dist/esm/hooks/usePreferredDark/usePreferredDark.mjs.map +1 -1
- package/dist/esm/hooks/usePreferredLanguages/usePreferredLanguages.mjs.map +1 -1
- package/dist/esm/hooks/usePreferredReducedMotion/usePreferredReducedMotion.mjs.map +1 -1
- package/dist/esm/hooks/usePrevious/usePrevious.mjs.map +1 -1
- package/dist/esm/hooks/useQuery/useQuery.mjs.map +1 -1
- package/dist/esm/hooks/useQueue/useQueue.mjs.map +1 -1
- package/dist/esm/hooks/useRaf/useRaf.mjs.map +1 -1
- package/dist/esm/hooks/useRafState/useRafState.mjs.map +1 -1
- package/dist/esm/hooks/useRefState/useRefState.mjs.map +1 -1
- package/dist/esm/hooks/useRenderCount/useRenderCount.mjs.map +1 -1
- package/dist/esm/hooks/useRenderInfo/useRenderInfo.mjs.map +1 -1
- package/dist/esm/hooks/useRerender/useRerender.mjs.map +1 -1
- package/dist/esm/hooks/useResizeObserver/useResizeObserver.mjs +17 -16
- package/dist/esm/hooks/useResizeObserver/useResizeObserver.mjs.map +1 -1
- package/dist/esm/hooks/useRightClick/useRightClick.mjs.map +1 -1
- package/dist/esm/hooks/useScript/useScript.mjs.map +1 -1
- package/dist/esm/hooks/useScroll/useScroll.mjs.map +1 -1
- package/dist/esm/hooks/useScrollIntoView/useScrollIntoView.mjs.map +1 -1
- package/dist/esm/hooks/useScrollTo/useScrollTo.mjs.map +1 -1
- package/dist/esm/hooks/useSessionStorage/useSessionStorage.mjs.map +1 -1
- package/dist/esm/hooks/useSet/useSet.mjs.map +1 -1
- package/dist/esm/hooks/useShallowEffect/useShallowEffect.mjs.map +1 -1
- package/dist/esm/hooks/useShare/useShare.mjs +1 -1
- package/dist/esm/hooks/useShare/useShare.mjs.map +1 -1
- package/dist/esm/hooks/useSpeechRecognition/useSpeechRecognition.mjs.map +1 -1
- package/dist/esm/hooks/useSpeechSynthesis/useSpeechSynthesis.mjs +11 -11
- package/dist/esm/hooks/useSpeechSynthesis/useSpeechSynthesis.mjs.map +1 -1
- package/dist/esm/hooks/useStateHistory/useStateHistory.mjs.map +1 -1
- package/dist/esm/hooks/useStep/useStep.mjs.map +1 -1
- package/dist/esm/hooks/useSticky/useSticky.mjs.map +1 -1
- package/dist/esm/hooks/useStopwatch/useStopwatch.mjs.map +1 -1
- package/dist/esm/hooks/useStorage/useStorage.mjs.map +1 -1
- package/dist/esm/hooks/useTextDirection/useTextDirection.mjs +14 -14
- package/dist/esm/hooks/useTextDirection/useTextDirection.mjs.map +1 -1
- package/dist/esm/hooks/useTextSelection/useTextSelection.mjs.map +1 -1
- package/dist/esm/hooks/useThrottleCallback/useThrottleCallback.mjs.map +1 -1
- package/dist/esm/hooks/useThrottleState/useThrottleState.mjs +10 -0
- package/dist/esm/hooks/useThrottleState/useThrottleState.mjs.map +1 -0
- package/dist/esm/hooks/useThrottleValue/useThrottleValue.mjs.map +1 -1
- package/dist/esm/hooks/useTime/useTime.mjs.map +1 -1
- package/dist/esm/hooks/useTimeout/useTimeout.mjs.map +1 -1
- package/dist/esm/hooks/useTimer/useTimer.mjs.map +1 -1
- package/dist/esm/hooks/useToggle/useToggle.mjs.map +1 -1
- package/dist/esm/hooks/useUnmount/useUnmount.mjs.map +1 -1
- package/dist/esm/hooks/useUrlSearchParam/useUrlSearchParam.mjs.map +1 -1
- package/dist/esm/hooks/useUrlSearchParams/useUrlSearchParams.mjs.map +1 -1
- package/dist/esm/hooks/useVibrate/useVibrate.mjs +12 -12
- package/dist/esm/hooks/useVibrate/useVibrate.mjs.map +1 -1
- package/dist/esm/hooks/useVirtualKeyboard/useVirtualKeyboard.mjs +7 -7
- package/dist/esm/hooks/useVirtualKeyboard/useVirtualKeyboard.mjs.map +1 -1
- package/dist/esm/hooks/useWakeLock/useWakeLock.mjs +1 -1
- package/dist/esm/hooks/useWakeLock/useWakeLock.mjs.map +1 -1
- package/dist/esm/hooks/useWebSocket/useWebSocket.mjs.map +1 -1
- package/dist/esm/hooks/useWindowEvent/useWindowEvent.mjs.map +1 -1
- package/dist/esm/hooks/useWindowFocus/useWindowFocus.mjs.map +1 -1
- package/dist/esm/hooks/useWindowScroll/useWindowScroll.mjs.map +1 -1
- package/dist/esm/hooks/useWindowSize/useWindowSize.mjs.map +1 -1
- package/dist/esm/hooks/useWizard/useWizard.mjs.map +1 -1
- package/dist/esm/index.mjs +147 -139
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/helpers/createContext/createContext.d.ts +1 -0
- package/dist/types/helpers/createEventEmitter/createEventEmitter.d.ts +1 -0
- package/dist/types/helpers/createReactiveContext/createReactiveContext.d.ts +1 -0
- package/dist/types/helpers/createStore/createStore.d.ts +1 -0
- package/dist/types/hooks/state.d.ts +1 -0
- package/dist/types/hooks/useActiveElement/useActiveElement.d.ts +1 -0
- package/dist/types/hooks/useAsync/useAsync.d.ts +1 -0
- package/dist/types/hooks/useAudio/useAudio.d.ts +2 -1
- package/dist/types/hooks/useAutoScroll/useAutoScroll.d.ts +1 -0
- package/dist/types/hooks/useBattery/useBattery.d.ts +1 -0
- package/dist/types/hooks/useBluetooth/useBluetooth.d.ts +1 -0
- package/dist/types/hooks/useBoolean/useBoolean.d.ts +2 -1
- package/dist/types/hooks/useBreakpoints/useBreakpoints.d.ts +1 -0
- package/dist/types/hooks/useBroadcastChannel/useBroadcastChannel.d.ts +1 -0
- package/dist/types/hooks/useBrowserLanguage/useBrowserLanguage.d.ts +2 -1
- package/dist/types/hooks/useClickOutside/useClickOutside.d.ts +2 -1
- package/dist/types/hooks/useClipboard/useClipboard.d.ts +2 -1
- package/dist/types/hooks/useConst/useConst.d.ts +2 -1
- package/dist/types/hooks/useCookie/useCookie.d.ts +2 -1
- package/dist/types/hooks/useCookies/useCookies.d.ts +2 -1
- package/dist/types/hooks/useCopy/useCopy.d.ts +2 -1
- package/dist/types/hooks/useCounter/useCounter.d.ts +2 -1
- package/dist/types/hooks/useCssVar/useCssVar.d.ts +2 -1
- package/dist/types/hooks/useDebounceCallback/useDebounceCallback.d.ts +1 -0
- package/dist/types/hooks/useDebounceState/useDebounceState.d.ts +15 -0
- package/dist/types/hooks/useDebounceValue/useDebounceValue.d.ts +2 -1
- package/dist/types/hooks/useDefault/useDefault.d.ts +2 -1
- package/dist/types/hooks/useDeviceMotion/useDeviceMotion.d.ts +2 -1
- package/dist/types/hooks/useDeviceOrientation/useDeviceOrientation.d.ts +1 -0
- package/dist/types/hooks/useDevicePixelRatio/useDevicePixelRatio.d.ts +1 -0
- package/dist/types/hooks/useDidUpdate/useDidUpdate.d.ts +2 -1
- package/dist/types/hooks/useDisclosure/useDisclosure.d.ts +2 -1
- package/dist/types/hooks/useDisplayMedia/useDisplayMedia.d.ts +1 -0
- package/dist/types/hooks/useDocumentEvent/useDocumentEvent.d.ts +2 -1
- package/dist/types/hooks/useDocumentTitle/useDocumentTitle.d.ts +2 -1
- package/dist/types/hooks/useDocumentVisibility/useDocumentVisibility.d.ts +2 -1
- package/dist/types/hooks/useDoubleClick/useDoubleClick.d.ts +2 -1
- package/dist/types/hooks/useDropZone/useDropZone.d.ts +2 -1
- package/dist/types/hooks/useElementSize/useElementSize.d.ts +2 -1
- package/dist/types/hooks/useEvent/useEvent.d.ts +2 -1
- package/dist/types/hooks/useEventListener/useEventListener.d.ts +5 -2
- package/dist/types/hooks/useEventSource/useEventSource.d.ts +1 -0
- package/dist/types/hooks/useEyeDropper/useEyeDropper.d.ts +1 -0
- package/dist/types/hooks/useFavicon/useFavicon.d.ts +2 -1
- package/dist/types/hooks/useField/useField.d.ts +1 -0
- package/dist/types/hooks/useFileDialog/useFileDialog.d.ts +1 -0
- package/dist/types/hooks/useFocus/useFocus.d.ts +25 -0
- package/dist/types/hooks/useFps/useFps.d.ts +1 -0
- package/dist/types/hooks/useFul/useFul.d.ts +1 -0
- package/dist/types/hooks/useFullscreen/useFullscreen.d.ts +1 -0
- package/dist/types/hooks/useGamepad/useGamepad.d.ts +1 -0
- package/dist/types/hooks/useGeolocation/useGeolocation.d.ts +1 -0
- package/dist/types/hooks/useHash/useHash.d.ts +1 -0
- package/dist/types/hooks/useHotkeys/useHotkeys.d.ts +1 -0
- package/dist/types/hooks/useHover/useHover.d.ts +3 -0
- package/dist/types/hooks/useIdle/useIdle.d.ts +1 -0
- package/dist/types/hooks/useImage/useImage.d.ts +1 -0
- package/dist/types/hooks/useInfiniteScroll/useInfiniteScroll.d.ts +1 -0
- package/dist/types/hooks/useIntersectionObserver/useIntersectionObserver.d.ts +15 -6
- package/dist/types/hooks/useInterval/useInterval.d.ts +1 -0
- package/dist/types/hooks/useIsFirstRender/useIsFirstRender.d.ts +1 -0
- package/dist/types/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +1 -0
- package/dist/types/hooks/useKeyPress/useKeyPress.d.ts +1 -0
- package/dist/types/hooks/useKeyPressEvent/useKeyPressEvent.d.ts +1 -0
- package/dist/types/hooks/useKeyboard/useKeyboard.d.ts +1 -0
- package/dist/types/hooks/useKeysPressed/useKeysPressed.d.ts +1 -2
- package/dist/types/hooks/useLastChanged/useLastChanged.d.ts +1 -0
- package/dist/types/hooks/useLatest/useLatest.d.ts +1 -0
- package/dist/types/hooks/useLess/useLess.d.ts +1 -0
- package/dist/types/hooks/useList/useList.d.ts +1 -0
- package/dist/types/hooks/useLocalStorage/useLocalStorage.d.ts +1 -0
- package/dist/types/hooks/useLockCallback/useLockCallback.d.ts +1 -0
- package/dist/types/hooks/useLockScroll/useLockScroll.d.ts +1 -1
- package/dist/types/hooks/useLogger/useLogger.d.ts +1 -0
- package/dist/types/hooks/useLongPress/useLongPress.d.ts +1 -0
- package/dist/types/hooks/useMap/useMap.d.ts +1 -0
- package/dist/types/hooks/useMeasure/useMeasure.d.ts +1 -0
- package/dist/types/hooks/useMediaControls/useMediaControls.d.ts +1 -0
- package/dist/types/hooks/useMediaQuery/useMediaQuery.d.ts +1 -0
- package/dist/types/hooks/useMemory/useMemory.d.ts +1 -0
- package/dist/types/hooks/useMergedRef/useMergedRef.d.ts +17 -0
- package/dist/types/hooks/useMount/useMount.d.ts +1 -0
- package/dist/types/hooks/useMouse/useMouse.d.ts +1 -0
- package/dist/types/hooks/useMutation/useMutation.d.ts +1 -0
- package/dist/types/hooks/useMutationObserver/useMutationObserver.d.ts +43 -26
- package/dist/types/hooks/useNetwork/useNetwork.d.ts +1 -0
- package/dist/types/hooks/useObject/useObject.d.ts +35 -0
- package/dist/types/hooks/useOffsetPagination/useOffsetPagination.d.ts +12 -24
- package/dist/types/hooks/useOnce/useOnce.d.ts +1 -0
- package/dist/types/hooks/useOnline/useOnline.d.ts +1 -0
- package/dist/types/hooks/useOperatingSystem/useOperatingSystem.d.ts +1 -0
- package/dist/types/hooks/useOptimistic/useOptimistic.d.ts +1 -0
- package/dist/types/hooks/useOrientation/useOrientation.d.ts +2 -1
- package/dist/types/hooks/useOtpCredential/useOtpCredential.d.ts +1 -0
- package/dist/types/hooks/usePageLeave/usePageLeave.d.ts +1 -0
- package/dist/types/hooks/usePaint/usePaint.d.ts +1 -0
- package/dist/types/hooks/useParallax/useParallax.d.ts +1 -0
- package/dist/types/hooks/usePerformanceObserver/usePerformanceObserver.d.ts +1 -0
- package/dist/types/hooks/usePermission/usePermission.d.ts +1 -0
- package/dist/types/hooks/usePictureInPicture/usePictureInPicture.d.ts +1 -0
- package/dist/types/hooks/usePointerLock/usePointerLock.d.ts +1 -0
- package/dist/types/hooks/usePostMessage/usePostMessage.d.ts +1 -0
- package/dist/types/hooks/usePreferredColorScheme/usePreferredColorScheme.d.ts +1 -0
- package/dist/types/hooks/usePreferredContrast/usePreferredContrast.d.ts +1 -0
- package/dist/types/hooks/usePreferredDark/usePreferredDark.d.ts +1 -0
- package/dist/types/hooks/usePreferredLanguages/usePreferredLanguages.d.ts +1 -0
- package/dist/types/hooks/usePreferredReducedMotion/usePreferredReducedMotion.d.ts +1 -0
- package/dist/types/hooks/usePrevious/usePrevious.d.ts +1 -0
- package/dist/types/hooks/useQuery/useQuery.d.ts +1 -0
- package/dist/types/hooks/useQueue/useQueue.d.ts +1 -0
- package/dist/types/hooks/useRaf/useRaf.d.ts +1 -0
- package/dist/types/hooks/useRafState/useRafState.d.ts +3 -0
- package/dist/types/hooks/useRefState/useRefState.d.ts +1 -0
- package/dist/types/hooks/useRenderCount/useRenderCount.d.ts +1 -0
- package/dist/types/hooks/useRenderInfo/useRenderInfo.d.ts +1 -0
- package/dist/types/hooks/useRerender/useRerender.d.ts +1 -0
- package/dist/types/hooks/useResizeObserver/useResizeObserver.d.ts +55 -31
- package/dist/types/hooks/useRightClick/useRightClick.d.ts +1 -0
- package/dist/types/hooks/useScript/useScript.d.ts +1 -0
- package/dist/types/hooks/useScroll/useScroll.d.ts +1 -0
- package/dist/types/hooks/useScrollIntoView/useScrollIntoView.d.ts +1 -0
- package/dist/types/hooks/useScrollTo/useScrollTo.d.ts +1 -0
- package/dist/types/hooks/useSessionStorage/useSessionStorage.d.ts +1 -0
- package/dist/types/hooks/useSet/useSet.d.ts +1 -0
- package/dist/types/hooks/useShallowEffect/useShallowEffect.d.ts +1 -0
- package/dist/types/hooks/useShare/useShare.d.ts +1 -0
- package/dist/types/hooks/useSpeechRecognition/useSpeechRecognition.d.ts +1 -0
- package/dist/types/hooks/useSpeechSynthesis/useSpeechSynthesis.d.ts +1 -0
- package/dist/types/hooks/useStateHistory/useStateHistory.d.ts +1 -0
- package/dist/types/hooks/useStep/useStep.d.ts +1 -0
- package/dist/types/hooks/useSticky/useSticky.d.ts +1 -0
- package/dist/types/hooks/useStopwatch/useStopwatch.d.ts +1 -0
- package/dist/types/hooks/useStorage/useStorage.d.ts +1 -0
- package/dist/types/hooks/useTextDirection/useTextDirection.d.ts +1 -0
- package/dist/types/hooks/useTextSelection/useTextSelection.d.ts +1 -0
- package/dist/types/hooks/useThrottleCallback/useThrottleCallback.d.ts +1 -0
- package/dist/types/hooks/useThrottleState/useThrottleState.d.ts +15 -0
- package/dist/types/hooks/useThrottleValue/useThrottleValue.d.ts +1 -0
- package/dist/types/hooks/useTime/useTime.d.ts +1 -0
- package/dist/types/hooks/useTimeout/useTimeout.d.ts +1 -0
- package/dist/types/hooks/useTimer/useTimer.d.ts +1 -0
- package/dist/types/hooks/useToggle/useToggle.d.ts +1 -0
- package/dist/types/hooks/useUnmount/useUnmount.d.ts +1 -0
- package/dist/types/hooks/useUrlSearchParam/useUrlSearchParam.d.ts +1 -0
- package/dist/types/hooks/useUrlSearchParams/useUrlSearchParams.d.ts +1 -0
- package/dist/types/hooks/useVibrate/useVibrate.d.ts +1 -0
- package/dist/types/hooks/useVirtualKeyboard/useVirtualKeyboard.d.ts +1 -0
- package/dist/types/hooks/useWakeLock/useWakeLock.d.ts +1 -0
- package/dist/types/hooks/useWebSocket/useWebSocket.d.ts +17 -0
- package/dist/types/hooks/useWindowEvent/useWindowEvent.d.ts +1 -0
- package/dist/types/hooks/useWindowFocus/useWindowFocus.d.ts +1 -0
- package/dist/types/hooks/useWindowScroll/useWindowScroll.d.ts +1 -0
- package/dist/types/hooks/useWindowSize/useWindowSize.d.ts +1 -0
- package/dist/types/hooks/useWizard/useWizard.d.ts +1 -0
- package/dist/types/hooks/utilities.d.ts +2 -0
- package/package.json +89 -89
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWebSocket.mjs","sources":["../../../../src/hooks/useWebSocket/useWebSocket.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\nimport { getRetry } from '@/utils/helpers';\n\nimport { useEvent } from '../useEvent/useEvent';\n\nexport type UseWebSocketUrl = (() => string) | string;\n\nexport interface UseWebSocketOptions {\n protocols?: Array<'soap' | 'wasm'>;\n retry?: boolean | number;\n onConnected?: (webSocket: WebSocket) => void;\n onDisconnected?: (event: CloseEvent, webSocket: WebSocket) => void;\n onError?: (event: Event, webSocket: WebSocket) => void;\n onMessage?: (event: MessageEvent, webSocket: WebSocket) => void;\n}\n\nexport type UseWebSocketStatus = 'connected' | 'connecting' | 'disconnected' | 'failed';\n\nexport interface UseWebSocketReturn {\n client?: WebSocket;\n close: WebSocket['close'];\n send: WebSocket['send'];\n status: UseWebSocketStatus;\n open: () => void;\n}\n\n/**\n * @name useWebSocket\n * @description - Hook that connects to a WebSocket server and handles incoming and outgoing messages\n * @category Browser\n *\n * @param {UseWebSocketUrl} url The URL of the WebSocket server\n * @param {(webSocket: WebSocket) => void} [options.onConnected] The callback function that is called when the WebSocket connection is established\n * @param {(event: CloseEvent, webSocket: WebSocket) => void} [options.onDisconnected] The callback function that is called when the WebSocket connection is closed\n * @param {(event: Event, webSocket: WebSocket) => void} [options.onError] The callback function that is called when an error occurs\n * @param {(event: MessageEvent, webSocket: WebSocket) => void} [options.onMessage] The callback function that is called when a message is received\n * @param {boolean | number} [options.retry] The number of times to retry the connection\n * @param {Array<'soap' | 'wasm'>} [options.protocols] The list of protocols to use\n * @returns {UseWebSocketReturn} An object with the status, close, send, open, and ws properties\n *\n * @example\n * const { status, close, send, open, client } = useWebSocket('url');\n */\nexport const useWebSocket = (\n url: UseWebSocketUrl,\n options?: UseWebSocketOptions\n): UseWebSocketReturn => {\n const webSocketRef = useRef<WebSocket>(undefined);\n const retryCountRef = useRef(options?.retry ? getRetry(options.retry) : 0);\n const explicityCloseRef = useRef(false);\n\n const [status, setStatus] = useState<UseWebSocketStatus>('connecting');\n\n const send = (data: string | ArrayBufferLike | ArrayBufferView | Blob) =>\n webSocketRef.current?.send(data);\n\n const close = () => {\n explicityCloseRef.current = true;\n webSocketRef.current?.close();\n };\n\n const init = useEvent(() => {\n webSocketRef.current = new WebSocket(\n typeof url === 'function' ? url() : url,\n options?.protocols\n );\n setStatus('connecting');\n\n const webSocket = webSocketRef.current;\n if (!webSocket) return;\n\n webSocket.onopen = () => {\n setStatus('connected');\n options?.onConnected?.(webSocket);\n };\n\n webSocket.onerror = (event) => {\n setStatus('failed');\n options?.onError?.(event, webSocket);\n };\n\n webSocket.onmessage = (event) => options?.onMessage?.(event, webSocket);\n\n webSocket.onclose = (event) => {\n setStatus('disconnected');\n options?.onDisconnected?.(event, webSocket);\n if (explicityCloseRef.current) return;\n\n if (retryCountRef.current > 0) {\n retryCountRef.current -= 1;\n return init();\n }\n retryCountRef.current = options?.retry ? getRetry(options.retry) : 0;\n };\n });\n\n useEffect(() => {\n init();\n\n return () => {\n if (!webSocketRef.current) return;\n webSocketRef.current.close();\n webSocketRef.current = undefined;\n };\n }, [url]);\n\n const open = () => {\n explicityCloseRef.current = false;\n init();\n };\n\n return { client: webSocketRef.current, close, open, send, status };\n};\n"],"names":["useWebSocket","url","options","webSocketRef","useRef","retryCountRef","getRetry","explicityCloseRef","status","setStatus","useState","send","data","close","init","useEvent","webSocket","event","useEffect","open"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"useWebSocket.mjs","sources":["../../../../src/hooks/useWebSocket/useWebSocket.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\nimport { getRetry } from '@/utils/helpers';\n\nimport { useEvent } from '../useEvent/useEvent';\n\n/** The use web socket url type */\nexport type UseWebSocketUrl = (() => string) | string;\n\n/** The use web socket options type */\nexport interface UseWebSocketOptions {\n /** The list of protocols to use */\n protocols?: Array<'soap' | 'wasm'>;\n /** The number of times to retry the connection */\n retry?: boolean | number;\n /** The callback function that is called when the WebSocket connection is established */\n onConnected?: (webSocket: WebSocket) => void;\n /** The callback function that is called when the WebSocket connection is closed */\n onDisconnected?: (event: CloseEvent, webSocket: WebSocket) => void;\n /** The callback function that is called when an error occurs */\n onError?: (event: Event, webSocket: WebSocket) => void;\n /** The callback function that is called when a message is received */\n onMessage?: (event: MessageEvent, webSocket: WebSocket) => void;\n}\n\nexport type UseWebSocketStatus = 'connected' | 'connecting' | 'disconnected' | 'failed';\n\n/** The use web socket return type */\nexport interface UseWebSocketReturn {\n /** The WebSocket client */\n client?: WebSocket;\n /** The close function */\n close: WebSocket['close'];\n /** The send function */\n send: WebSocket['send'];\n /** The status of the WebSocket connection */\n status: UseWebSocketStatus;\n /** The open function */\n open: () => void;\n}\n\n/**\n * @name useWebSocket\n * @description - Hook that connects to a WebSocket server and handles incoming and outgoing messages\n * @category Browser\n * @usage medium\n *\n * @browserapi WebSocket https://developer.mozilla.org/en-US/docs/Web/API/WebSocket\n *\n * @param {UseWebSocketUrl} url The URL of the WebSocket server\n * @param {(webSocket: WebSocket) => void} [options.onConnected] The callback function that is called when the WebSocket connection is established\n * @param {(event: CloseEvent, webSocket: WebSocket) => void} [options.onDisconnected] The callback function that is called when the WebSocket connection is closed\n * @param {(event: Event, webSocket: WebSocket) => void} [options.onError] The callback function that is called when an error occurs\n * @param {(event: MessageEvent, webSocket: WebSocket) => void} [options.onMessage] The callback function that is called when a message is received\n * @param {boolean | number} [options.retry] The number of times to retry the connection\n * @param {Array<'soap' | 'wasm'>} [options.protocols] The list of protocols to use\n * @returns {UseWebSocketReturn} An object with the status, close, send, open, and ws properties\n *\n * @example\n * const { status, close, send, open, client } = useWebSocket('url');\n */\nexport const useWebSocket = (\n url: UseWebSocketUrl,\n options?: UseWebSocketOptions\n): UseWebSocketReturn => {\n const webSocketRef = useRef<WebSocket>(undefined);\n const retryCountRef = useRef(options?.retry ? getRetry(options.retry) : 0);\n const explicityCloseRef = useRef(false);\n\n const [status, setStatus] = useState<UseWebSocketStatus>('connecting');\n\n const send = (data: string | ArrayBufferLike | ArrayBufferView | Blob) =>\n webSocketRef.current?.send(data);\n\n const close = () => {\n explicityCloseRef.current = true;\n webSocketRef.current?.close();\n };\n\n const init = useEvent(() => {\n webSocketRef.current = new WebSocket(\n typeof url === 'function' ? url() : url,\n options?.protocols\n );\n setStatus('connecting');\n\n const webSocket = webSocketRef.current;\n if (!webSocket) return;\n\n webSocket.onopen = () => {\n setStatus('connected');\n options?.onConnected?.(webSocket);\n };\n\n webSocket.onerror = (event) => {\n setStatus('failed');\n options?.onError?.(event, webSocket);\n };\n\n webSocket.onmessage = (event) => options?.onMessage?.(event, webSocket);\n\n webSocket.onclose = (event) => {\n setStatus('disconnected');\n options?.onDisconnected?.(event, webSocket);\n if (explicityCloseRef.current) return;\n\n if (retryCountRef.current > 0) {\n retryCountRef.current -= 1;\n return init();\n }\n retryCountRef.current = options?.retry ? getRetry(options.retry) : 0;\n };\n });\n\n useEffect(() => {\n init();\n\n return () => {\n if (!webSocketRef.current) return;\n webSocketRef.current.close();\n webSocketRef.current = undefined;\n };\n }, [url]);\n\n const open = () => {\n explicityCloseRef.current = false;\n init();\n };\n\n return { client: webSocketRef.current, close, open, send, status };\n};\n"],"names":["useWebSocket","url","options","webSocketRef","useRef","retryCountRef","getRetry","explicityCloseRef","status","setStatus","useState","send","data","close","init","useEvent","webSocket","event","useEffect","open"],"mappings":";;;AA6DO,MAAMA,IAAe,CAC1BC,GACAC,MACuB;AACvB,QAAMC,IAAeC,EAAkB,MAAS,GAC1CC,IAAgBD,EAAOF,GAAS,QAAQI,EAASJ,EAAQ,KAAK,IAAI,CAAC,GACnEK,IAAoBH,EAAO,EAAK,GAEhC,CAACI,GAAQC,CAAS,IAAIC,EAA6B,YAAY,GAE/DC,IAAO,CAACC,MACZT,EAAa,SAAS,KAAKS,CAAI,GAE3BC,IAAQ,MAAM;AAClB,IAAAN,EAAkB,UAAU,IAC5BJ,EAAa,SAAS,MAAA;AAAA,EAAM,GAGxBW,IAAOC,EAAS,MAAM;AAC1B,IAAAZ,EAAa,UAAU,IAAI;AAAA,MACzB,OAAOF,KAAQ,aAAaA,EAAA,IAAQA;AAAA,MACpCC,GAAS;AAAA,IAAA,GAEXO,EAAU,YAAY;AAEtB,UAAMO,IAAYb,EAAa;AAC/B,IAAKa,MAELA,EAAU,SAAS,MAAM;AACvB,MAAAP,EAAU,WAAW,GACrBP,GAAS,cAAcc,CAAS;AAAA,IAAA,GAGlCA,EAAU,UAAU,CAACC,MAAU;AAC7B,MAAAR,EAAU,QAAQ,GAClBP,GAAS,UAAUe,GAAOD,CAAS;AAAA,IAAA,GAGrCA,EAAU,YAAY,CAACC,MAAUf,GAAS,YAAYe,GAAOD,CAAS,GAEtEA,EAAU,UAAU,CAACC,MAAU;AAG7B,UAFAR,EAAU,cAAc,GACxBP,GAAS,iBAAiBe,GAAOD,CAAS,GACtC,CAAAT,EAAkB,SAEtB;AAAA,YAAIF,EAAc,UAAU;AAC1B,iBAAAA,EAAc,WAAW,GAClBS,EAAA;AAET,QAAAT,EAAc,UAAUH,GAAS,QAAQI,EAASJ,EAAQ,KAAK,IAAI;AAAA;AAAA,IAAA;AAAA,EACrE,CACD;AAED,EAAAgB,EAAU,OACRJ,EAAA,GAEO,MAAM;AACX,IAAKX,EAAa,YAClBA,EAAa,QAAQ,MAAA,GACrBA,EAAa,UAAU;AAAA,EAAA,IAExB,CAACF,CAAG,CAAC;AAER,QAAMkB,IAAO,MAAM;AACjB,IAAAZ,EAAkB,UAAU,IAC5BO,EAAA;AAAA,EAAK;AAGP,SAAO,EAAE,QAAQX,EAAa,SAAS,OAAAU,GAAO,MAAAM,GAAM,MAAAR,GAAM,QAAAH,EAAA;AAC5D;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWindowEvent.mjs","sources":["../../../../src/hooks/useWindowEvent/useWindowEvent.ts"],"sourcesContent":["import { target } from '@/utils/helpers';\n\nimport type { UseEventListenerOptions } from '../useEventListener/useEventListener';\n\nimport { useEventListener } from '../useEventListener/useEventListener';\n\n/**\n * @name useWindowEvent\n * @description - Hook attaches an event listener to the window object for the specified event\n * @category Sensors\n *\n * @template Event Key of window event map.\n * @param {Event} event The event to listen for.\n * @param {(event: WindowEventMap[Event]) => void} listener The callback function to be executed when the event is triggered\n * @param {UseEventListenerOptions} [options] The options for the event listener\n * @returns {void}\n *\n * @example\n * useWindowEvent('click', () => console.log('clicked'));\n */\nexport const useWindowEvent = <Event extends keyof WindowEventMap>(\n event: Event,\n listener: (this: Window, event: WindowEventMap[Event]) => any,\n options?: UseEventListenerOptions\n) => useEventListener(target(window), event, listener, options);\n"],"names":["useWindowEvent","event","listener","options","useEventListener","target"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useWindowEvent.mjs","sources":["../../../../src/hooks/useWindowEvent/useWindowEvent.ts"],"sourcesContent":["import { target } from '@/utils/helpers';\n\nimport type { UseEventListenerOptions } from '../useEventListener/useEventListener';\n\nimport { useEventListener } from '../useEventListener/useEventListener';\n\n/**\n * @name useWindowEvent\n * @description - Hook attaches an event listener to the window object for the specified event\n * @category Sensors\n * @usage low\n *\n * @template Event Key of window event map.\n * @param {Event} event The event to listen for.\n * @param {(event: WindowEventMap[Event]) => void} listener The callback function to be executed when the event is triggered\n * @param {UseEventListenerOptions} [options] The options for the event listener\n * @returns {void}\n *\n * @example\n * useWindowEvent('click', () => console.log('clicked'));\n */\nexport const useWindowEvent = <Event extends keyof WindowEventMap>(\n event: Event,\n listener: (this: Window, event: WindowEventMap[Event]) => any,\n options?: UseEventListenerOptions\n) => useEventListener(target(window), event, listener, options);\n"],"names":["useWindowEvent","event","listener","options","useEventListener","target"],"mappings":";;AAqBO,MAAMA,IAAiB,CAC5BC,GACAC,GACAC,MACGC,EAAiBC,EAAO,MAAM,GAAGJ,GAAOC,GAAUC,CAAO;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWindowFocus.mjs","sources":["../../../../src/hooks/useWindowFocus/useWindowFocus.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/**\n * @name useWindowFocus\n * @description - Hook that provides the current focus state of the window\n * @category Elements\n *\n * @returns {boolean} The current focus state of the window\n *\n * @example\n * const focused = useWindowFocus();\n *\n * @see {@link https://siberiacancode.github.io/reactuse/functions/hooks/useWindowFocus.html}\n */\nexport const useWindowFocus = () => {\n const [focused, setFocused] = useState(false);\n\n useEffect(() => {\n const onFocus = () => setFocused(true);\n const onBlur = () => setFocused(false);\n\n window.addEventListener('focus', onFocus);\n window.addEventListener('blur', onBlur);\n\n return () => {\n window.removeEventListener('focus', onFocus);\n window.removeEventListener('blur', onBlur);\n };\n });\n\n return focused;\n};\n"],"names":["useWindowFocus","focused","setFocused","useState","useEffect","onFocus","onBlur"],"mappings":";
|
|
1
|
+
{"version":3,"file":"useWindowFocus.mjs","sources":["../../../../src/hooks/useWindowFocus/useWindowFocus.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/**\n * @name useWindowFocus\n * @description - Hook that provides the current focus state of the window\n * @category Elements\n * @usage low\n *\n * @returns {boolean} The current focus state of the window\n *\n * @example\n * const focused = useWindowFocus();\n *\n * @see {@link https://siberiacancode.github.io/reactuse/functions/hooks/useWindowFocus.html}\n */\nexport const useWindowFocus = () => {\n const [focused, setFocused] = useState(false);\n\n useEffect(() => {\n const onFocus = () => setFocused(true);\n const onBlur = () => setFocused(false);\n\n window.addEventListener('focus', onFocus);\n window.addEventListener('blur', onBlur);\n\n return () => {\n window.removeEventListener('focus', onFocus);\n window.removeEventListener('blur', onBlur);\n };\n });\n\n return focused;\n};\n"],"names":["useWindowFocus","focused","setFocused","useState","useEffect","onFocus","onBlur"],"mappings":";AAeO,MAAMA,IAAiB,MAAM;AAClC,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAS,EAAK;AAE5C,SAAAC,EAAU,MAAM;AACd,UAAMC,IAAU,MAAMH,EAAW,EAAI,GAC/BI,IAAS,MAAMJ,EAAW,EAAK;AAErC,kBAAO,iBAAiB,SAASG,CAAO,GACxC,OAAO,iBAAiB,QAAQC,CAAM,GAE/B,MAAM;AACX,aAAO,oBAAoB,SAASD,CAAO,GAC3C,OAAO,oBAAoB,QAAQC,CAAM;AAAA,IAAA;AAAA,EAC3C,CACD,GAEML;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWindowScroll.mjs","sources":["../../../../src/hooks/useWindowScroll/useWindowScroll.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nexport interface ScrollPosition {\n x: number;\n y: number;\n}\n\nexport const scrollTo = ({\n x,\n y,\n behavior = 'smooth'\n}: Partial<ScrollPosition & ScrollOptions>) => {\n const scrollOptions: ScrollToOptions = { behavior };\n if (typeof x === 'number') scrollOptions.left = x;\n if (typeof y === 'number') scrollOptions.top = y;\n window.scrollTo(scrollOptions);\n};\n\n/**\n * @name useWindowScroll\n * @description - Hook that manages the window scroll position\n * @category Sensors\n *\n * @returns {UseWindowScrollReturn} An object containing the current window scroll position\n *\n * @example\n * const { value, scrollTo } = useWindowScroll();\n */\nexport const useWindowScroll = () => {\n const [value, setValue] = useState<ScrollPosition>({\n x: typeof window !== 'undefined' ? window.scrollX : Number.POSITIVE_INFINITY,\n y: typeof window !== 'undefined' ? window.scrollY : Number.POSITIVE_INFINITY\n });\n\n useEffect(() => {\n const onChange = () => setValue({ x: window.scrollX, y: window.scrollY });\n window.addEventListener('scroll', onChange);\n window.addEventListener('resize', onChange);\n return () => {\n window.removeEventListener('scroll', onChange);\n window.removeEventListener('resize', onChange);\n };\n }, []);\n\n return { value, scrollTo };\n};\n"],"names":["scrollTo","x","y","behavior","scrollOptions","useWindowScroll","value","setValue","useState","useEffect","onChange"],"mappings":";AAOO,MAAMA,IAAW,CAAC;AAAA,EACvB,GAAAC;AAAA,EACA,GAAAC;AAAA,EACA,UAAAC,IAAW;AACb,MAA+C;AAC7C,QAAMC,IAAiC,EAAE,UAAAD,EAAA;AACzC,EAAI,OAAOF,KAAM,aAAUG,EAAc,OAAOH,IAC5C,OAAOC,KAAM,aAAUE,EAAc,MAAMF,IAC/C,OAAO,SAASE,CAAa;AAC/B,
|
|
1
|
+
{"version":3,"file":"useWindowScroll.mjs","sources":["../../../../src/hooks/useWindowScroll/useWindowScroll.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nexport interface ScrollPosition {\n x: number;\n y: number;\n}\n\nexport const scrollTo = ({\n x,\n y,\n behavior = 'smooth'\n}: Partial<ScrollPosition & ScrollOptions>) => {\n const scrollOptions: ScrollToOptions = { behavior };\n if (typeof x === 'number') scrollOptions.left = x;\n if (typeof y === 'number') scrollOptions.top = y;\n window.scrollTo(scrollOptions);\n};\n\n/**\n * @name useWindowScroll\n * @description - Hook that manages the window scroll position\n * @category Sensors\n * @usage low\n *\n * @returns {UseWindowScrollReturn} An object containing the current window scroll position\n *\n * @example\n * const { value, scrollTo } = useWindowScroll();\n */\nexport const useWindowScroll = () => {\n const [value, setValue] = useState<ScrollPosition>({\n x: typeof window !== 'undefined' ? window.scrollX : Number.POSITIVE_INFINITY,\n y: typeof window !== 'undefined' ? window.scrollY : Number.POSITIVE_INFINITY\n });\n\n useEffect(() => {\n const onChange = () => setValue({ x: window.scrollX, y: window.scrollY });\n window.addEventListener('scroll', onChange);\n window.addEventListener('resize', onChange);\n return () => {\n window.removeEventListener('scroll', onChange);\n window.removeEventListener('resize', onChange);\n };\n }, []);\n\n return { value, scrollTo };\n};\n"],"names":["scrollTo","x","y","behavior","scrollOptions","useWindowScroll","value","setValue","useState","useEffect","onChange"],"mappings":";AAOO,MAAMA,IAAW,CAAC;AAAA,EACvB,GAAAC;AAAA,EACA,GAAAC;AAAA,EACA,UAAAC,IAAW;AACb,MAA+C;AAC7C,QAAMC,IAAiC,EAAE,UAAAD,EAAA;AACzC,EAAI,OAAOF,KAAM,aAAUG,EAAc,OAAOH,IAC5C,OAAOC,KAAM,aAAUE,EAAc,MAAMF,IAC/C,OAAO,SAASE,CAAa;AAC/B,GAaaC,IAAkB,MAAM;AACnC,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAyB;AAAA,IACjD,GAAG,OAAO,SAAW,MAAc,OAAO,UAAU,OAAO;AAAA,IAC3D,GAAG,OAAO,SAAW,MAAc,OAAO,UAAU,OAAO;AAAA,EAAA,CAC5D;AAED,SAAAC,EAAU,MAAM;AACd,UAAMC,IAAW,MAAMH,EAAS,EAAE,GAAG,OAAO,SAAS,GAAG,OAAO,SAAS;AACxE,kBAAO,iBAAiB,UAAUG,CAAQ,GAC1C,OAAO,iBAAiB,UAAUA,CAAQ,GACnC,MAAM;AACX,aAAO,oBAAoB,UAAUA,CAAQ,GAC7C,OAAO,oBAAoB,UAAUA,CAAQ;AAAA,IAAA;AAAA,EAC/C,GACC,EAAE,GAEE,EAAE,OAAAJ,GAAO,UAAAN,EAAA;AAClB;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWindowSize.mjs","sources":["../../../../src/hooks/useWindowSize/useWindowSize.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/** The use window size return type */\ninterface UseWindowSizeParams {\n /** Whether to include the scrollbar in the window size calculation */\n includeScrollbar?: boolean;\n}\n\n/** The use window size return type */\nexport interface UseWindowSizeReturn {\n /** The current window height */\n height: number;\n /** The current window width */\n width: number;\n}\n\n/**\n * @name useWindowSize\n * @description - Hook that manages a window size\n * @category Elements\n *\n * @param {number} [params.initialWidth=Number.POSITIVE_INFINITY] The initial window width\n * @param {number} [params.initialHeight=Number.POSITIVE_INFINITY] The initial window height\n * @returns {UseWindowSizeReturn} An object containing the current window width and height\n *\n * @example\n * const { width, height } = useWindowSize();\n */\nexport const useWindowSize = (params?: UseWindowSizeParams) => {\n const includeScrollbar = params?.includeScrollbar ?? true;\n const [size, setSize] = useState(() => {\n if (typeof window === 'undefined') {\n return {\n width: Number.POSITIVE_INFINITY,\n height: Number.POSITIVE_INFINITY\n };\n }\n\n return {\n width: includeScrollbar ? window.innerWidth : window.document.documentElement.clientWidth,\n height: includeScrollbar ? window.innerHeight : window.document.documentElement.clientHeight\n };\n });\n\n useEffect(() => {\n const onResize = () => {\n if (includeScrollbar) {\n setSize({\n width: window.innerWidth,\n height: window.innerHeight\n });\n } else {\n setSize({\n width: window.document.documentElement.clientWidth,\n height: window.document.documentElement.clientHeight\n });\n }\n };\n\n window.addEventListener('resize', onResize);\n return () => {\n window.removeEventListener('resize', onResize);\n };\n }, [params?.includeScrollbar]);\n\n return size;\n};\n"],"names":["useWindowSize","params","includeScrollbar","size","setSize","useState","useEffect","onResize"],"mappings":";
|
|
1
|
+
{"version":3,"file":"useWindowSize.mjs","sources":["../../../../src/hooks/useWindowSize/useWindowSize.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/** The use window size return type */\ninterface UseWindowSizeParams {\n /** Whether to include the scrollbar in the window size calculation */\n includeScrollbar?: boolean;\n}\n\n/** The use window size return type */\nexport interface UseWindowSizeReturn {\n /** The current window height */\n height: number;\n /** The current window width */\n width: number;\n}\n\n/**\n * @name useWindowSize\n * @description - Hook that manages a window size\n * @category Elements\n * @usage low\n *\n * @param {number} [params.initialWidth=Number.POSITIVE_INFINITY] The initial window width\n * @param {number} [params.initialHeight=Number.POSITIVE_INFINITY] The initial window height\n * @returns {UseWindowSizeReturn} An object containing the current window width and height\n *\n * @example\n * const { width, height } = useWindowSize();\n */\nexport const useWindowSize = (params?: UseWindowSizeParams) => {\n const includeScrollbar = params?.includeScrollbar ?? true;\n const [size, setSize] = useState(() => {\n if (typeof window === 'undefined') {\n return {\n width: Number.POSITIVE_INFINITY,\n height: Number.POSITIVE_INFINITY\n };\n }\n\n return {\n width: includeScrollbar ? window.innerWidth : window.document.documentElement.clientWidth,\n height: includeScrollbar ? window.innerHeight : window.document.documentElement.clientHeight\n };\n });\n\n useEffect(() => {\n const onResize = () => {\n if (includeScrollbar) {\n setSize({\n width: window.innerWidth,\n height: window.innerHeight\n });\n } else {\n setSize({\n width: window.document.documentElement.clientWidth,\n height: window.document.documentElement.clientHeight\n });\n }\n };\n\n window.addEventListener('resize', onResize);\n return () => {\n window.removeEventListener('resize', onResize);\n };\n }, [params?.includeScrollbar]);\n\n return size;\n};\n"],"names":["useWindowSize","params","includeScrollbar","size","setSize","useState","useEffect","onResize"],"mappings":";AA6BO,MAAMA,IAAgB,CAACC,MAAiC;AAC7D,QAAMC,IAAmBD,GAAQ,oBAAoB,IAC/C,CAACE,GAAMC,CAAO,IAAIC,EAAS,MAC3B,OAAO,SAAW,MACb;AAAA,IACL,OAAO,OAAO;AAAA,IACd,QAAQ,OAAO;AAAA,EAAA,IAIZ;AAAA,IACL,OAAOH,IAAmB,OAAO,aAAa,OAAO,SAAS,gBAAgB;AAAA,IAC9E,QAAQA,IAAmB,OAAO,cAAc,OAAO,SAAS,gBAAgB;AAAA,EAAA,CAEnF;AAED,SAAAI,EAAU,MAAM;AACd,UAAMC,IAAW,MAAM;AACrB,MACEH,EADEF,IACM;AAAA,QACN,OAAO,OAAO;AAAA,QACd,QAAQ,OAAO;AAAA,MAAA,IAGT;AAAA,QACN,OAAO,OAAO,SAAS,gBAAgB;AAAA,QACvC,QAAQ,OAAO,SAAS,gBAAgB;AAAA,MAAA,CAJzC;AAAA,IAMH;AAGF,kBAAO,iBAAiB,UAAUK,CAAQ,GACnC,MAAM;AACX,aAAO,oBAAoB,UAAUA,CAAQ;AAAA,IAAA;AAAA,EAC/C,GACC,CAACN,GAAQ,gBAAgB,CAAC,GAEtBE;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWizard.mjs","sources":["../../../../src/hooks/useWizard/useWizard.ts"],"sourcesContent":["import { useState } from 'react';\n\nexport interface WizardItem<WizardStepId> {\n id: WizardStepId;\n nodes?: WizardStepId[];\n}\n\n/**\n * @name useWizard\n * @description - Hook that manages a wizard\n * @category State\n *\n * @param {WizardItem<WizardStepId>[]} map The map of the wizard\n * @param {WizardStepId} [initialStepId] The initial step id\n * @returns {UseWizardReturn<WizardStepId>} An object containing the current step id and functions to interact with the wizard\n *\n * @example\n * const { currentStepId, set, reset, back, next, history } = useWizard([\n * { id: 'step1', nodes: ['step2', 'step3'] },\n * { id: 'step2', nodes: ['step3'] },\n * { id: 'step3', nodes: [] },\n * ])\n */\nexport const useWizard = <WizardStepId extends string>(\n map: WizardItem<WizardStepId>[],\n initialStepId?: WizardStepId\n) => {\n const initialId = initialStepId ?? map[0].id;\n const wizardMap = new Map(map.map((wizardItem) => [wizardItem.id, wizardItem]));\n const [currentStepId, setCurrentStepId] = useState(initialId);\n const [history, setHistory] = useState<WizardStepId[]>([initialId]);\n\n const set = (id: WizardStepId) => {\n if (!wizardMap.get(currentStepId)?.nodes?.includes(id))\n throw new Error(`Can't go to ${id} from ${currentStepId}`);\n\n setHistory([...history, id]);\n setCurrentStepId(id);\n };\n\n const back = () => {\n if (history.length === 1) return;\n\n const previousStepId = history[history.length - 2];\n if (!wizardMap.get(currentStepId)?.nodes?.includes(previousStepId))\n throw new Error(`Can't go to ${previousStepId} from ${currentStepId}`);\n\n setHistory(history.slice(0, -1));\n setCurrentStepId(history[history.length - 2]);\n };\n\n const reset = () => {\n setCurrentStepId(initialId);\n setHistory([initialId]);\n };\n\n return { currentStepId, set, reset, back, history };\n};\n"],"names":["useWizard","map","initialStepId","initialId","wizardMap","wizardItem","currentStepId","setCurrentStepId","useState","history","setHistory","id","previousStepId"],"mappings":";
|
|
1
|
+
{"version":3,"file":"useWizard.mjs","sources":["../../../../src/hooks/useWizard/useWizard.ts"],"sourcesContent":["import { useState } from 'react';\n\nexport interface WizardItem<WizardStepId> {\n id: WizardStepId;\n nodes?: WizardStepId[];\n}\n\n/**\n * @name useWizard\n * @description - Hook that manages a wizard\n * @category State\n * @usage medium\n *\n * @param {WizardItem<WizardStepId>[]} map The map of the wizard\n * @param {WizardStepId} [initialStepId] The initial step id\n * @returns {UseWizardReturn<WizardStepId>} An object containing the current step id and functions to interact with the wizard\n *\n * @example\n * const { currentStepId, set, reset, back, next, history } = useWizard([\n * { id: 'step1', nodes: ['step2', 'step3'] },\n * { id: 'step2', nodes: ['step3'] },\n * { id: 'step3', nodes: [] },\n * ])\n */\nexport const useWizard = <WizardStepId extends string>(\n map: WizardItem<WizardStepId>[],\n initialStepId?: WizardStepId\n) => {\n const initialId = initialStepId ?? map[0].id;\n const wizardMap = new Map(map.map((wizardItem) => [wizardItem.id, wizardItem]));\n const [currentStepId, setCurrentStepId] = useState(initialId);\n const [history, setHistory] = useState<WizardStepId[]>([initialId]);\n\n const set = (id: WizardStepId) => {\n if (!wizardMap.get(currentStepId)?.nodes?.includes(id))\n throw new Error(`Can't go to ${id} from ${currentStepId}`);\n\n setHistory([...history, id]);\n setCurrentStepId(id);\n };\n\n const back = () => {\n if (history.length === 1) return;\n\n const previousStepId = history[history.length - 2];\n if (!wizardMap.get(currentStepId)?.nodes?.includes(previousStepId))\n throw new Error(`Can't go to ${previousStepId} from ${currentStepId}`);\n\n setHistory(history.slice(0, -1));\n setCurrentStepId(history[history.length - 2]);\n };\n\n const reset = () => {\n setCurrentStepId(initialId);\n setHistory([initialId]);\n };\n\n return { currentStepId, set, reset, back, history };\n};\n"],"names":["useWizard","map","initialStepId","initialId","wizardMap","wizardItem","currentStepId","setCurrentStepId","useState","history","setHistory","id","previousStepId"],"mappings":";AAwBO,MAAMA,IAAY,CACvBC,GACAC,MACG;AACH,QAAMC,IAAYD,KAAiBD,EAAI,CAAC,EAAE,IACpCG,IAAY,IAAI,IAAIH,EAAI,IAAI,CAACI,MAAe,CAACA,EAAW,IAAIA,CAAU,CAAC,CAAC,GACxE,CAACC,GAAeC,CAAgB,IAAIC,EAASL,CAAS,GACtD,CAACM,GAASC,CAAU,IAAIF,EAAyB,CAACL,CAAS,CAAC;AA0BlE,SAAO,EAAE,eAAAG,GAAe,KAxBZ,CAACK,MAAqB;AAChC,QAAI,CAACP,EAAU,IAAIE,CAAa,GAAG,OAAO,SAASK,CAAE;AACnD,YAAM,IAAI,MAAM,eAAeA,CAAE,SAASL,CAAa,EAAE;AAE3D,IAAAI,EAAW,CAAC,GAAGD,GAASE,CAAE,CAAC,GAC3BJ,EAAiBI,CAAE;AAAA,EAAA,GAmBQ,OALf,MAAM;AAClB,IAAAJ,EAAiBJ,CAAS,GAC1BO,EAAW,CAACP,CAAS,CAAC;AAAA,EAAA,GAGY,MAhBvB,MAAM;AACjB,QAAIM,EAAQ,WAAW,EAAG;AAE1B,UAAMG,IAAiBH,EAAQA,EAAQ,SAAS,CAAC;AACjD,QAAI,CAACL,EAAU,IAAIE,CAAa,GAAG,OAAO,SAASM,CAAc;AAC/D,YAAM,IAAI,MAAM,eAAeA,CAAc,SAASN,CAAa,EAAE;AAEvE,IAAAI,EAAWD,EAAQ,MAAM,GAAG,EAAE,CAAC,GAC/BF,EAAiBE,EAAQA,EAAQ,SAAS,CAAC,CAAC;AAAA,EAAA,GAQJ,SAAAA,EAAA;AAC5C;"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -6,14 +6,14 @@ import { useAsync as a } from "./hooks/useAsync/useAsync.mjs";
|
|
|
6
6
|
import { useLockCallback as n } from "./hooks/useLockCallback/useLockCallback.mjs";
|
|
7
7
|
import { useMutation as l } from "./hooks/useMutation/useMutation.mjs";
|
|
8
8
|
import { useOptimistic as E } from "./hooks/useOptimistic/useOptimistic.mjs";
|
|
9
|
-
import { useQuery as
|
|
10
|
-
import { useAudio as
|
|
11
|
-
import { useBattery as
|
|
9
|
+
import { useQuery as g } from "./hooks/useQuery/useQuery.mjs";
|
|
10
|
+
import { useAudio as R } from "./hooks/useAudio/useAudio.mjs";
|
|
11
|
+
import { useBattery as C } from "./hooks/useBattery/useBattery.mjs";
|
|
12
12
|
import { useBluetooth as A } from "./hooks/useBluetooth/useBluetooth.mjs";
|
|
13
13
|
import { useBroadcastChannel as O } from "./hooks/useBroadcastChannel/useBroadcastChannel.mjs";
|
|
14
|
-
import { useClipboard as
|
|
14
|
+
import { useClipboard as h } from "./hooks/useClipboard/useClipboard.mjs";
|
|
15
15
|
import { useCopy as _ } from "./hooks/useCopy/useCopy.mjs";
|
|
16
|
-
import { useCssVar as
|
|
16
|
+
import { useCssVar as M } from "./hooks/useCssVar/useCssVar.mjs";
|
|
17
17
|
import { useDisplayMedia as b } from "./hooks/useDisplayMedia/useDisplayMedia.mjs";
|
|
18
18
|
import { useDocumentTitle as B } from "./hooks/useDocumentTitle/useDocumentTitle.mjs";
|
|
19
19
|
import { useEventSource as F } from "./hooks/useEventSource/useEventSource.mjs";
|
|
@@ -32,13 +32,13 @@ import { usePermission as ie } from "./hooks/usePermission/usePermission.mjs";
|
|
|
32
32
|
import { usePictureInPicture as ce } from "./hooks/usePictureInPicture/usePictureInPicture.mjs";
|
|
33
33
|
import { usePointerLock as Se } from "./hooks/usePointerLock/usePointerLock.mjs";
|
|
34
34
|
import { usePostMessage as Te } from "./hooks/usePostMessage/usePostMessage.mjs";
|
|
35
|
-
import { useRaf as
|
|
36
|
-
import { useShare as
|
|
35
|
+
import { useRaf as de } from "./hooks/useRaf/useRaf.mjs";
|
|
36
|
+
import { useShare as Pe } from "./hooks/useShare/useShare.mjs";
|
|
37
37
|
import { getSpeechRecognition as Ie, useSpeechRecognition as Ae } from "./hooks/useSpeechRecognition/useSpeechRecognition.mjs";
|
|
38
38
|
import { useSpeechSynthesis as Oe } from "./hooks/useSpeechSynthesis/useSpeechSynthesis.mjs";
|
|
39
|
-
import { useVibrate as
|
|
39
|
+
import { useVibrate as he } from "./hooks/useVibrate/useVibrate.mjs";
|
|
40
40
|
import { useVirtualKeyboard as _e } from "./hooks/useVirtualKeyboard/useVirtualKeyboard.mjs";
|
|
41
|
-
import { useWakeLock as
|
|
41
|
+
import { useWakeLock as Me } from "./hooks/useWakeLock/useWakeLock.mjs";
|
|
42
42
|
import { useWebSocket as be } from "./hooks/useWebSocket/useWebSocket.mjs";
|
|
43
43
|
import { useLogger as Be } from "./hooks/useLogger/useLogger.mjs";
|
|
44
44
|
import { useRenderCount as Fe } from "./hooks/useRenderCount/useRenderCount.mjs";
|
|
@@ -57,13 +57,13 @@ import { useLongPress as xo } from "./hooks/useLongPress/useLongPress.mjs";
|
|
|
57
57
|
import { Paint as io, Pointer as no, usePaint as co } from "./hooks/usePaint/usePaint.mjs";
|
|
58
58
|
import { useRightClick as So } from "./hooks/useRightClick/useRightClick.mjs";
|
|
59
59
|
import { SCRIPT_STATUS_ATTRIBUTE_NAME as To, useScript as go } from "./hooks/useScript/useScript.mjs";
|
|
60
|
-
import { useSticky as
|
|
60
|
+
import { useSticky as Po } from "./hooks/useSticky/useSticky.mjs";
|
|
61
61
|
import { useTextDirection as Io } from "./hooks/useTextDirection/useTextDirection.mjs";
|
|
62
62
|
import { useFul as yo } from "./hooks/useFul/useFul.mjs";
|
|
63
63
|
import { useLess as ko } from "./hooks/useLess/useLess.mjs";
|
|
64
|
-
import { useOnce as
|
|
64
|
+
import { useOnce as vo } from "./hooks/useOnce/useOnce.mjs";
|
|
65
65
|
import { useDidUpdate as Do } from "./hooks/useDidUpdate/useDidUpdate.mjs";
|
|
66
|
-
import { useIsFirstRender as
|
|
66
|
+
import { useIsFirstRender as Lo } from "./hooks/useIsFirstRender/useIsFirstRender.mjs";
|
|
67
67
|
import { useIsomorphicLayoutEffect as No } from "./hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs";
|
|
68
68
|
import { useMount as Ko } from "./hooks/useMount/useMount.mjs";
|
|
69
69
|
import { deepEqual as Uo, useShallowEffect as Vo } from "./hooks/useShallowEffect/useShallowEffect.mjs";
|
|
@@ -77,14 +77,14 @@ import { useDocumentVisibility as xr } from "./hooks/useDocumentVisibility/useDo
|
|
|
77
77
|
import { useElementSize as ir } from "./hooks/useElementSize/useElementSize.mjs";
|
|
78
78
|
import { useEventListener as cr } from "./hooks/useEventListener/useEventListener.mjs";
|
|
79
79
|
import { isHotkeyMatch as Sr, useHotkeys as Er } from "./hooks/useHotkeys/useHotkeys.mjs";
|
|
80
|
-
import { useIdle as
|
|
81
|
-
import { useInfiniteScroll as
|
|
82
|
-
import { useIntersectionObserver as
|
|
80
|
+
import { useIdle as gr } from "./hooks/useIdle/useIdle.mjs";
|
|
81
|
+
import { useInfiniteScroll as Rr } from "./hooks/useInfiniteScroll/useInfiniteScroll.mjs";
|
|
82
|
+
import { useIntersectionObserver as Cr } from "./hooks/useIntersectionObserver/useIntersectionObserver.mjs";
|
|
83
83
|
import { useKeyboard as Ar } from "./hooks/useKeyboard/useKeyboard.mjs";
|
|
84
84
|
import { useKeyPress as Or } from "./hooks/useKeyPress/useKeyPress.mjs";
|
|
85
|
-
import { useKeyPressEvent as
|
|
85
|
+
import { useKeyPressEvent as hr } from "./hooks/useKeyPressEvent/useKeyPressEvent.mjs";
|
|
86
86
|
import { useKeysPressed as _r } from "./hooks/useKeysPressed/useKeysPressed.mjs";
|
|
87
|
-
import { useLockScroll as
|
|
87
|
+
import { useLockScroll as Mr } from "./hooks/useLockScroll/useLockScroll.mjs";
|
|
88
88
|
import { useMeasure as br } from "./hooks/useMeasure/useMeasure.mjs";
|
|
89
89
|
import { useMediaQuery as Br } from "./hooks/useMediaQuery/useMediaQuery.mjs";
|
|
90
90
|
import { useMouse as Fr } from "./hooks/useMouse/useMouse.mjs";
|
|
@@ -103,57 +103,60 @@ import { useWindowFocus as xt } from "./hooks/useWindowFocus/useWindowFocus.mjs"
|
|
|
103
103
|
import { scrollTo as it, useWindowScroll as nt } from "./hooks/useWindowScroll/useWindowScroll.mjs";
|
|
104
104
|
import { useWindowSize as lt } from "./hooks/useWindowSize/useWindowSize.mjs";
|
|
105
105
|
import { useBoolean as Et } from "./hooks/useBoolean/useBoolean.mjs";
|
|
106
|
-
import { COOKIE_EVENT as
|
|
107
|
-
import { clearCookies as
|
|
106
|
+
import { COOKIE_EVENT as gt, dispatchCookieEvent as dt, getCookie as Rt, getCookies as Pt, removeCookie as Ct, removeCookieItem as It, setCookie as At, setCookieItem as yt, useCookie as Ot } from "./hooks/useCookie/useCookie.mjs";
|
|
107
|
+
import { clearCookies as ht, useCookies as vt } from "./hooks/useCookies/useCookies.mjs";
|
|
108
108
|
import { useCounter as Dt } from "./hooks/useCounter/useCounter.mjs";
|
|
109
|
-
import { useDefault as
|
|
109
|
+
import { useDefault as Lt } from "./hooks/useDefault/useDefault.mjs";
|
|
110
110
|
import { useDisclosure as Nt } from "./hooks/useDisclosure/useDisclosure.mjs";
|
|
111
111
|
import { useField as Kt } from "./hooks/useField/useField.mjs";
|
|
112
112
|
import { useHash as Ut } from "./hooks/useHash/useHash.mjs";
|
|
113
113
|
import { useList as wt } from "./hooks/useList/useList.mjs";
|
|
114
114
|
import { useLocalStorage as Wt } from "./hooks/useLocalStorage/useLocalStorage.mjs";
|
|
115
115
|
import { useMap as Qt } from "./hooks/useMap/useMap.mjs";
|
|
116
|
-
import {
|
|
117
|
-
import {
|
|
118
|
-
import {
|
|
119
|
-
import {
|
|
120
|
-
import {
|
|
121
|
-
import {
|
|
122
|
-
import {
|
|
123
|
-
import {
|
|
124
|
-
import {
|
|
125
|
-
import {
|
|
126
|
-
import {
|
|
127
|
-
import {
|
|
128
|
-
import {
|
|
129
|
-
import {
|
|
130
|
-
import {
|
|
131
|
-
import {
|
|
132
|
-
import {
|
|
133
|
-
import {
|
|
134
|
-
import {
|
|
135
|
-
import {
|
|
136
|
-
import {
|
|
137
|
-
import {
|
|
138
|
-
import {
|
|
139
|
-
import {
|
|
140
|
-
import {
|
|
141
|
-
import {
|
|
142
|
-
import {
|
|
143
|
-
import {
|
|
144
|
-
import {
|
|
145
|
-
import {
|
|
146
|
-
import {
|
|
147
|
-
import {
|
|
148
|
-
import {
|
|
149
|
-
import {
|
|
150
|
-
import {
|
|
151
|
-
import {
|
|
152
|
-
import {
|
|
153
|
-
import {
|
|
154
|
-
import {
|
|
155
|
-
import {
|
|
156
|
-
import {
|
|
116
|
+
import { assignRef as Xt, mergeRefs as qt, useMergedRef as Zt } from "./hooks/useMergedRef/useMergedRef.mjs";
|
|
117
|
+
import { useOffsetPagination as Jt } from "./hooks/useOffsetPagination/useOffsetPagination.mjs";
|
|
118
|
+
import { useQueue as $t } from "./hooks/useQueue/useQueue.mjs";
|
|
119
|
+
import { useRafState as os } from "./hooks/useRafState/useRafState.mjs";
|
|
120
|
+
import { useRefState as ts } from "./hooks/useRefState/useRefState.mjs";
|
|
121
|
+
import { useSessionStorage as ms } from "./hooks/useSessionStorage/useSessionStorage.mjs";
|
|
122
|
+
import { useSet as ps } from "./hooks/useSet/useSet.mjs";
|
|
123
|
+
import { stateHistoryReducer as xs, useStateHistory as as } from "./hooks/useStateHistory/useStateHistory.mjs";
|
|
124
|
+
import { useStep as ns } from "./hooks/useStep/useStep.mjs";
|
|
125
|
+
import { STORAGE_EVENT as ls, dispatchStorageEvent as Ss, useStorage as Es } from "./hooks/useStorage/useStorage.mjs";
|
|
126
|
+
import { useToggle as gs } from "./hooks/useToggle/useToggle.mjs";
|
|
127
|
+
import { URL_SEARCH_PARAMS_EVENT as Rs, createQueryString as Ps, dispatchUrlSearchParamsEvent as Cs, getUrlSearchParams as Is, useUrlSearchParam as As } from "./hooks/useUrlSearchParam/useUrlSearchParam.mjs";
|
|
128
|
+
import { useUrlSearchParams as Os } from "./hooks/useUrlSearchParams/useUrlSearchParams.mjs";
|
|
129
|
+
import { useWizard as hs } from "./hooks/useWizard/useWizard.mjs";
|
|
130
|
+
import { useInterval as _s } from "./hooks/useInterval/useInterval.mjs";
|
|
131
|
+
import { useStopwatch as Ms } from "./hooks/useStopwatch/useStopwatch.mjs";
|
|
132
|
+
import { useTime as bs } from "./hooks/useTime/useTime.mjs";
|
|
133
|
+
import { useTimeout as Bs } from "./hooks/useTimeout/useTimeout.mjs";
|
|
134
|
+
import { getTimeFromSeconds as Fs, useTimer as Us } from "./hooks/useTimer/useTimer.mjs";
|
|
135
|
+
import { useBrowserLanguage as ws } from "./hooks/useBrowserLanguage/useBrowserLanguage.mjs";
|
|
136
|
+
import { getOperatingSystem as Ws, useOperatingSystem as Gs } from "./hooks/useOperatingSystem/useOperatingSystem.mjs";
|
|
137
|
+
import { usePreferredColorScheme as zs } from "./hooks/usePreferredColorScheme/usePreferredColorScheme.mjs";
|
|
138
|
+
import { usePreferredContrast as qs } from "./hooks/usePreferredContrast/usePreferredContrast.mjs";
|
|
139
|
+
import { usePreferredDark as js } from "./hooks/usePreferredDark/usePreferredDark.mjs";
|
|
140
|
+
import { usePreferredLanguages as Ys } from "./hooks/usePreferredLanguages/usePreferredLanguages.mjs";
|
|
141
|
+
import { usePreferredReducedMotion as em } from "./hooks/usePreferredReducedMotion/usePreferredReducedMotion.mjs";
|
|
142
|
+
import { useConst as rm } from "./hooks/useConst/useConst.mjs";
|
|
143
|
+
import { useDebounceCallback as sm } from "./hooks/useDebounceCallback/useDebounceCallback.mjs";
|
|
144
|
+
import { useDebounceState as um } from "./hooks/useDebounceState/useDebounceState.mjs";
|
|
145
|
+
import { useDebounceValue as fm } from "./hooks/useDebounceValue/useDebounceValue.mjs";
|
|
146
|
+
import { useEvent as am } from "./hooks/useEvent/useEvent.mjs";
|
|
147
|
+
import { useLastChanged as nm } from "./hooks/useLastChanged/useLastChanged.mjs";
|
|
148
|
+
import { useLatest as lm } from "./hooks/useLatest/useLatest.mjs";
|
|
149
|
+
import { usePrevious as Em } from "./hooks/usePrevious/usePrevious.mjs";
|
|
150
|
+
import { useThrottleCallback as gm } from "./hooks/useThrottleCallback/useThrottleCallback.mjs";
|
|
151
|
+
import { useThrottleState as Rm } from "./hooks/useThrottleState/useThrottleState.mjs";
|
|
152
|
+
import { useThrottleValue as Cm } from "./hooks/useThrottleValue/useThrottleValue.mjs";
|
|
153
|
+
import { copy as Am, legacyCopyToClipboard as ym } from "./utils/helpers/copy.mjs";
|
|
154
|
+
import { debounce as km } from "./utils/helpers/debounce.mjs";
|
|
155
|
+
import { getDate as vm } from "./utils/helpers/getDate.mjs";
|
|
156
|
+
import { getElement as Dm, target as Mm, targetSymbol as Lm } from "./utils/helpers/getElement.mjs";
|
|
157
|
+
import { getRetry as Nm } from "./utils/helpers/getRetry.mjs";
|
|
158
|
+
import { isTarget as Km } from "./utils/helpers/isTarget.mjs";
|
|
159
|
+
import { throttle as Um } from "./utils/helpers/throttle.mjs";
|
|
157
160
|
export {
|
|
158
161
|
Go as BREAKPOINTS_ANT_DESIGN,
|
|
159
162
|
Qo as BREAKPOINTS_BOOTSTRAP_V5,
|
|
@@ -164,71 +167,74 @@ export {
|
|
|
164
167
|
jo as BREAKPOINTS_QUASAR_V2,
|
|
165
168
|
Jo as BREAKPOINTS_SEMANTIC,
|
|
166
169
|
Yo as BREAKPOINTS_TAILWIND,
|
|
167
|
-
|
|
170
|
+
gt as COOKIE_EVENT,
|
|
168
171
|
je as DEFAULT_THRESHOLD_TIME,
|
|
169
172
|
io as Paint,
|
|
170
173
|
no as Pointer,
|
|
171
174
|
To as SCRIPT_STATUS_ATTRIBUTE_NAME,
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
175
|
+
ls as STORAGE_EVENT,
|
|
176
|
+
Rs as URL_SEARCH_PARAMS_EVENT,
|
|
177
|
+
Xt as assignRef,
|
|
178
|
+
ht as clearCookies,
|
|
179
|
+
Am as copy,
|
|
176
180
|
r as createContext,
|
|
177
181
|
s as createEventEmitter,
|
|
178
|
-
|
|
182
|
+
Ps as createQueryString,
|
|
179
183
|
u as createReactiveContext,
|
|
180
184
|
f as createStore,
|
|
181
|
-
|
|
185
|
+
km as debounce,
|
|
182
186
|
Uo as deepEqual,
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
187
|
+
dt as dispatchCookieEvent,
|
|
188
|
+
Ss as dispatchStorageEvent,
|
|
189
|
+
Cs as dispatchUrlSearchParamsEvent,
|
|
186
190
|
se as getConnection,
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
191
|
+
Rt as getCookie,
|
|
192
|
+
Pt as getCookies,
|
|
193
|
+
vm as getDate,
|
|
194
|
+
Dm as getElement,
|
|
195
|
+
Ws as getOperatingSystem,
|
|
192
196
|
st as getRangesSelection,
|
|
193
|
-
|
|
197
|
+
Nm as getRetry,
|
|
194
198
|
Ie as getSpeechRecognition,
|
|
195
|
-
|
|
196
|
-
|
|
199
|
+
Fs as getTimeFromSeconds,
|
|
200
|
+
Is as getUrlSearchParams,
|
|
197
201
|
Sr as isHotkeyMatch,
|
|
198
|
-
|
|
199
|
-
|
|
202
|
+
Km as isTarget,
|
|
203
|
+
ym as legacyCopyToClipboard,
|
|
200
204
|
q as mapGamepadToXbox360Controller,
|
|
201
|
-
|
|
205
|
+
qt as mergeRefs,
|
|
206
|
+
Ct as removeCookie,
|
|
202
207
|
It as removeCookieItem,
|
|
203
208
|
it as scrollTo,
|
|
204
209
|
At as setCookie,
|
|
205
210
|
yt as setCookieItem,
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
211
|
+
xs as stateHistoryReducer,
|
|
212
|
+
Mm as target,
|
|
213
|
+
Lm as targetSymbol,
|
|
214
|
+
Um as throttle,
|
|
210
215
|
$ as timeRangeToArray,
|
|
211
216
|
Ge as useActiveElement,
|
|
212
217
|
a as useAsync,
|
|
213
|
-
|
|
218
|
+
R as useAudio,
|
|
214
219
|
ze as useAutoScroll,
|
|
215
|
-
|
|
220
|
+
C as useBattery,
|
|
216
221
|
A as useBluetooth,
|
|
217
222
|
Et as useBoolean,
|
|
218
223
|
$o as useBreakpoints,
|
|
219
224
|
O as useBroadcastChannel,
|
|
220
|
-
|
|
225
|
+
ws as useBrowserLanguage,
|
|
221
226
|
qe as useClickOutside,
|
|
222
|
-
|
|
223
|
-
|
|
227
|
+
h as useClipboard,
|
|
228
|
+
rm as useConst,
|
|
224
229
|
Ot as useCookie,
|
|
225
|
-
|
|
230
|
+
vt as useCookies,
|
|
226
231
|
_ as useCopy,
|
|
227
232
|
Dt as useCounter,
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
233
|
+
M as useCssVar,
|
|
234
|
+
sm as useDebounceCallback,
|
|
235
|
+
um as useDebounceState,
|
|
236
|
+
fm as useDebounceValue,
|
|
237
|
+
Lt as useDefault,
|
|
232
238
|
or as useDeviceMotion,
|
|
233
239
|
tr as useDeviceOrientation,
|
|
234
240
|
mr as useDevicePixelRatio,
|
|
@@ -241,7 +247,7 @@ export {
|
|
|
241
247
|
Je as useDoubleClick,
|
|
242
248
|
$e as useDropZone,
|
|
243
249
|
ir as useElementSize,
|
|
244
|
-
|
|
250
|
+
am as useEvent,
|
|
245
251
|
cr as useEventListener,
|
|
246
252
|
F as useEventSource,
|
|
247
253
|
V as useEyeDropper,
|
|
@@ -257,24 +263,24 @@ export {
|
|
|
257
263
|
Ut as useHash,
|
|
258
264
|
Er as useHotkeys,
|
|
259
265
|
mo as useHover,
|
|
260
|
-
|
|
266
|
+
gr as useIdle,
|
|
261
267
|
po as useImage,
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
268
|
+
Rr as useInfiniteScroll,
|
|
269
|
+
Cr as useIntersectionObserver,
|
|
270
|
+
_s as useInterval,
|
|
271
|
+
Lo as useIsFirstRender,
|
|
266
272
|
No as useIsomorphicLayoutEffect,
|
|
267
273
|
Or as useKeyPress,
|
|
268
|
-
|
|
274
|
+
hr as useKeyPressEvent,
|
|
269
275
|
Ar as useKeyboard,
|
|
270
276
|
_r as useKeysPressed,
|
|
271
|
-
|
|
272
|
-
|
|
277
|
+
nm as useLastChanged,
|
|
278
|
+
lm as useLatest,
|
|
273
279
|
ko as useLess,
|
|
274
280
|
wt as useList,
|
|
275
281
|
Wt as useLocalStorage,
|
|
276
282
|
n as useLockCallback,
|
|
277
|
-
|
|
283
|
+
Mr as useLockScroll,
|
|
278
284
|
Be as useLogger,
|
|
279
285
|
xo as useLongPress,
|
|
280
286
|
Qt as useMap,
|
|
@@ -282,15 +288,16 @@ export {
|
|
|
282
288
|
ee as useMediaControls,
|
|
283
289
|
Br as useMediaQuery,
|
|
284
290
|
re as useMemory,
|
|
291
|
+
Zt as useMergedRef,
|
|
285
292
|
Ko as useMount,
|
|
286
293
|
Fr as useMouse,
|
|
287
294
|
l as useMutation,
|
|
288
295
|
Vr as useMutationObserver,
|
|
289
296
|
me as useNetwork,
|
|
290
|
-
|
|
291
|
-
|
|
297
|
+
Jt as useOffsetPagination,
|
|
298
|
+
vo as useOnce,
|
|
292
299
|
pe as useOnline,
|
|
293
|
-
|
|
300
|
+
Gs as useOperatingSystem,
|
|
294
301
|
E as useOptimistic,
|
|
295
302
|
Hr as useOrientation,
|
|
296
303
|
xe as useOtpCredential,
|
|
@@ -302,17 +309,17 @@ export {
|
|
|
302
309
|
ce as usePictureInPicture,
|
|
303
310
|
Se as usePointerLock,
|
|
304
311
|
Te as usePostMessage,
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
312
|
+
zs as usePreferredColorScheme,
|
|
313
|
+
qs as usePreferredContrast,
|
|
314
|
+
js as usePreferredDark,
|
|
315
|
+
Ys as usePreferredLanguages,
|
|
316
|
+
em as usePreferredReducedMotion,
|
|
317
|
+
Em as usePrevious,
|
|
318
|
+
g as useQuery,
|
|
319
|
+
$t as useQueue,
|
|
320
|
+
de as useRaf,
|
|
321
|
+
os as useRafState,
|
|
322
|
+
ts as useRefState,
|
|
316
323
|
Fe as useRenderCount,
|
|
317
324
|
Ve as useRenderInfo,
|
|
318
325
|
He as useRerender,
|
|
@@ -322,36 +329,37 @@ export {
|
|
|
322
329
|
Yr as useScroll,
|
|
323
330
|
et as useScrollIntoView,
|
|
324
331
|
rt as useScrollTo,
|
|
325
|
-
|
|
326
|
-
|
|
332
|
+
ms as useSessionStorage,
|
|
333
|
+
ps as useSet,
|
|
327
334
|
Vo as useShallowEffect,
|
|
328
|
-
|
|
335
|
+
Pe as useShare,
|
|
329
336
|
Ae as useSpeechRecognition,
|
|
330
337
|
Oe as useSpeechSynthesis,
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
338
|
+
as as useStateHistory,
|
|
339
|
+
ns as useStep,
|
|
340
|
+
Po as useSticky,
|
|
341
|
+
Ms as useStopwatch,
|
|
342
|
+
Es as useStorage,
|
|
336
343
|
Io as useTextDirection,
|
|
337
344
|
mt as useTextSelection,
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
345
|
+
gm as useThrottleCallback,
|
|
346
|
+
Rm as useThrottleState,
|
|
347
|
+
Cm as useThrottleValue,
|
|
348
|
+
bs as useTime,
|
|
349
|
+
Bs as useTimeout,
|
|
350
|
+
Us as useTimer,
|
|
351
|
+
gs as useToggle,
|
|
344
352
|
Ho as useUnmount,
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
353
|
+
As as useUrlSearchParam,
|
|
354
|
+
Os as useUrlSearchParams,
|
|
355
|
+
he as useVibrate,
|
|
348
356
|
_e as useVirtualKeyboard,
|
|
349
|
-
|
|
357
|
+
Me as useWakeLock,
|
|
350
358
|
be as useWebSocket,
|
|
351
359
|
pt as useWindowEvent,
|
|
352
360
|
xt as useWindowFocus,
|
|
353
361
|
nt as useWindowScroll,
|
|
354
362
|
lt as useWindowSize,
|
|
355
|
-
|
|
363
|
+
hs as useWizard
|
|
356
364
|
};
|
|
357
365
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -36,6 +36,7 @@ export interface CreateContextReturn<Value> {
|
|
|
36
36
|
* @name createContext
|
|
37
37
|
* @description - Creates a typed context with additional utilities
|
|
38
38
|
* @category Helpers
|
|
39
|
+
* @usage high
|
|
39
40
|
*
|
|
40
41
|
* @template Value - The type of value that will be stored in the context
|
|
41
42
|
* @param {Value | undefined} [defaultValue] - Default value for the context
|
|
@@ -26,6 +26,7 @@ interface ReactiveContextValue<Value> {
|
|
|
26
26
|
* @name createReactiveContext
|
|
27
27
|
* @description - Creates a typed context selector with optimized updates for state selection
|
|
28
28
|
* @category Helpers
|
|
29
|
+
* @usage low
|
|
29
30
|
*
|
|
30
31
|
* @warning - For complex interfaces, we strongly recommend using state management solutions outside of React like createStore, reatom, effector, or zustand instead of context
|
|
31
32
|
*
|
|
@@ -11,6 +11,7 @@ export interface StoreApi<Value> {
|
|
|
11
11
|
* @name createStore
|
|
12
12
|
* @description - Creates a store with state management capabilities
|
|
13
13
|
* @category Helpers
|
|
14
|
+
* @usage medium
|
|
14
15
|
*
|
|
15
16
|
* @template Value - The type of the store state
|
|
16
17
|
* @param {StateCreator<Value>} createState - Function that initializes the store state
|
|
@@ -9,6 +9,7 @@ export * from './useHash/useHash';
|
|
|
9
9
|
export * from './useList/useList';
|
|
10
10
|
export * from './useLocalStorage/useLocalStorage';
|
|
11
11
|
export * from './useMap/useMap';
|
|
12
|
+
export * from './useMergedRef/useMergedRef';
|
|
12
13
|
export * from './useOffsetPagination/useOffsetPagination';
|
|
13
14
|
export * from './useQuery/useQuery';
|
|
14
15
|
export * from './useQueue/useQueue';
|
|
@@ -12,6 +12,7 @@ export interface UseActiveElement {
|
|
|
12
12
|
* @name useActiveElement
|
|
13
13
|
* @description - Hook that returns the active element
|
|
14
14
|
* @category Elements
|
|
15
|
+
* @usage low
|
|
15
16
|
*
|
|
16
17
|
* @overload
|
|
17
18
|
* @param {HookTarget} [target=window] The target element to observe active element changes
|
|
@@ -9,6 +9,7 @@ export interface UseAsyncReturn<Data> {
|
|
|
9
9
|
* @name useAsync
|
|
10
10
|
* @description - Hook that provides the state of an async callback
|
|
11
11
|
* @category Async
|
|
12
|
+
* @usage medium
|
|
12
13
|
*
|
|
13
14
|
* @param {() => Promise<Data>} callback The async callback
|
|
14
15
|
* @param {DependencyList} [deps=[]] The dependencies of the callback
|