@siberiacancode/reactuse 0.0.90 → 0.0.93
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 +1 -1
- package/dist/cjs/{_rollupPluginBabelHelpers-BsWog5nG.js → _rollupPluginBabelHelpers-CuUcoGqg.js} +3 -3
- package/dist/cjs/_rollupPluginBabelHelpers-CuUcoGqg.js.map +1 -0
- package/dist/cjs/hooks/index.js +2 -2
- package/dist/cjs/hooks/useActiveElement/useActiveElement.js +2 -2
- package/dist/cjs/hooks/useAsync/useAsync.js +2 -2
- package/dist/cjs/hooks/useBattery/useBattery.js +2 -2
- package/dist/cjs/hooks/useBattery/useBattery.js.map +1 -1
- package/dist/cjs/hooks/useBluetooth/useBluetooth.js +2 -2
- package/dist/cjs/hooks/useBoolean/useBoolean.js +2 -2
- package/dist/cjs/hooks/useBreakpoints/constants/breakpoints.js +1 -1
- package/dist/cjs/hooks/useBreakpoints/useBreakpoints.js +2 -2
- package/dist/cjs/hooks/useBreakpoints/useBreakpoints.js.map +1 -1
- package/dist/cjs/hooks/useBrowserLanguage/useBrowserLanguage.js +1 -1
- package/dist/cjs/hooks/useClickOutside/useClickOutside.js +2 -2
- package/dist/cjs/hooks/useClickOutside/useClickOutside.js.map +1 -1
- package/dist/cjs/hooks/useClipboard/useClipboard.js +2 -2
- package/dist/cjs/hooks/useConst/useConst.js +1 -1
- package/dist/cjs/hooks/useCounter/useCounter.js +2 -2
- package/dist/cjs/hooks/useCssVar/useCssVar.js +2 -2
- package/dist/cjs/hooks/useCssVar/useCssVar.js.map +1 -1
- package/dist/cjs/hooks/useDebounceCallback/useDebounceCallback.js +2 -2
- package/dist/cjs/hooks/useDebounceCallback/useDebounceCallback.js.map +1 -1
- package/dist/cjs/hooks/useDebounceValue/useDebounceValue.js +2 -2
- package/dist/cjs/hooks/useDebounceValue/useDebounceValue.js.map +1 -1
- package/dist/cjs/hooks/useDefault/useDefault.js +2 -2
- package/dist/cjs/hooks/useDeviceMotion/useDeviceMotion.js +2 -2
- package/dist/cjs/hooks/useDeviceMotion/useDeviceMotion.js.map +1 -1
- package/dist/cjs/hooks/useDeviceOrientation/useDeviceOrientation.js +2 -2
- package/dist/cjs/hooks/useDevicePixelRatio/useDevicePixelRatio.js +2 -2
- package/dist/cjs/hooks/useDevicePixelRatio/useDevicePixelRatio.js.map +1 -1
- package/dist/cjs/hooks/useDidUpdate/useDidUpdate.js +2 -2
- package/dist/cjs/hooks/useDidUpdate/useDidUpdate.js.map +1 -1
- package/dist/cjs/hooks/useDisclosure/useDisclosure.js +2 -2
- package/dist/cjs/hooks/useDisplayMedia/useDisplayMedia.js +3 -0
- package/dist/cjs/hooks/useDisplayMedia/useDisplayMedia.js.map +1 -0
- package/dist/cjs/hooks/useDocumentEvent/useDocumentEvent.js +2 -2
- package/dist/cjs/hooks/useDocumentEvent/useDocumentEvent.js.map +1 -1
- package/dist/cjs/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
- package/dist/cjs/hooks/useDocumentTitle/useDocumentTitle.js.map +1 -1
- package/dist/cjs/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
- package/dist/cjs/hooks/useElementSize/useElementSize.js +2 -2
- package/dist/cjs/hooks/useElementSize/useElementSize.js.map +1 -1
- package/dist/cjs/hooks/useEvent/useEvent.js +1 -1
- package/dist/cjs/hooks/useEventListener/useEventListener.js +2 -2
- package/dist/cjs/hooks/useEventListener/useEventListener.js.map +1 -1
- package/dist/cjs/hooks/useEyeDropper/useEyeDropper.js +2 -2
- package/dist/cjs/hooks/useFavicon/useFavicon.js +2 -2
- package/dist/cjs/hooks/useFavicon/useFavicon.js.map +1 -1
- package/dist/cjs/hooks/useField/useField.js +2 -2
- package/dist/cjs/hooks/useFileDialog/useFileDialog.js +2 -2
- package/dist/cjs/hooks/useFileDialog/useFileDialog.js.map +1 -1
- package/dist/cjs/hooks/useFocus/useFocus.js +2 -2
- package/dist/cjs/hooks/useFocus/useFocus.js.map +1 -1
- package/dist/cjs/hooks/useFps/useFps.js +2 -2
- package/dist/cjs/hooks/useFullscreen/useFullscreen.js +2 -2
- package/dist/cjs/hooks/useFullscreen/useFullscreen.js.map +1 -1
- package/dist/cjs/hooks/useGamepad/helpers/mapGamepadToXbox360Controller.js +1 -1
- package/dist/cjs/hooks/useGamepad/useGamepad.js +2 -2
- package/dist/cjs/hooks/useGeolocation/useGeolocation.js +2 -2
- package/dist/cjs/hooks/useHash/useHash.js +2 -2
- package/dist/cjs/hooks/useHotkeys/useHotkeys.js +2 -2
- package/dist/cjs/hooks/useHotkeys/useHotkeys.js.map +1 -1
- package/dist/cjs/hooks/useHover/useHover.js +2 -2
- package/dist/cjs/hooks/useHover/useHover.js.map +1 -1
- package/dist/cjs/hooks/useIdle/useIdle.js +2 -2
- package/dist/cjs/hooks/useIdle/useIdle.js.map +1 -1
- package/dist/cjs/hooks/useImage/useImage.js +2 -2
- package/dist/cjs/hooks/useImage/useImage.js.map +1 -1
- package/dist/cjs/hooks/useInfiniteScroll/useInfiniteScroll.js +2 -2
- package/dist/cjs/hooks/useInfiniteScroll/useInfiniteScroll.js.map +1 -1
- package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -2
- package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.js.map +1 -1
- package/dist/cjs/hooks/useInterval/useInterval.js +2 -2
- package/dist/cjs/hooks/useInterval/useInterval.js.map +1 -1
- package/dist/cjs/hooks/useIsFirstRender/useIsFirstRender.js +1 -1
- package/dist/cjs/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +2 -2
- package/dist/cjs/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js.map +1 -1
- package/dist/cjs/hooks/useKeyPress/useKeyPress.js +2 -2
- package/dist/cjs/hooks/useKeyPress/useKeyPress.js.map +1 -1
- package/dist/cjs/hooks/useKeyPressEvent/useKeyPressEvent.js +2 -2
- package/dist/cjs/hooks/useKeyPressEvent/useKeyPressEvent.js.map +1 -1
- package/dist/cjs/hooks/useKeyboard/useKeyboard.js +2 -2
- package/dist/cjs/hooks/useKeyboard/useKeyboard.js.map +1 -1
- package/dist/cjs/hooks/useKeysPressed/useKeysPressed.js +2 -2
- package/dist/cjs/hooks/useKeysPressed/useKeysPressed.js.map +1 -1
- package/dist/cjs/hooks/useLastChanged/useLastChanged.js +2 -2
- package/dist/cjs/hooks/useLastChanged/useLastChanged.js.map +1 -1
- package/dist/cjs/hooks/useLatest/useLatest.js +1 -1
- package/dist/cjs/hooks/useList/useList.js +2 -2
- package/dist/cjs/hooks/useLocalStorage/useLocalStorage.js +2 -2
- package/dist/cjs/hooks/useLocalStorage/useLocalStorage.js.map +1 -1
- package/dist/cjs/hooks/useLogger/useLogger.js +2 -2
- package/dist/cjs/hooks/useLogger/useLogger.js.map +1 -1
- package/dist/cjs/hooks/useLongPress/useLongPress.js +2 -2
- package/dist/cjs/hooks/useLongPress/useLongPress.js.map +1 -1
- package/dist/cjs/hooks/useMap/useMap.js +2 -2
- package/dist/cjs/hooks/useMeasure/useMeasure.js +2 -2
- package/dist/cjs/hooks/useMeasure/useMeasure.js.map +1 -1
- package/dist/cjs/hooks/useMediaQuery/useMediaQuery.js +1 -1
- package/dist/cjs/hooks/useMemory/useMemory.js +2 -2
- package/dist/cjs/hooks/useMount/useMount.js +1 -1
- package/dist/cjs/hooks/useMouse/useMouse.js +2 -2
- package/dist/cjs/hooks/useMouse/useMouse.js.map +1 -1
- package/dist/cjs/hooks/useMutation/useMutation.js +2 -2
- package/dist/cjs/hooks/useMutationObserver/useMutationObserver.js +2 -2
- package/dist/cjs/hooks/useMutationObserver/useMutationObserver.js.map +1 -1
- package/dist/cjs/hooks/useNetwork/useNetwork.js +2 -2
- package/dist/cjs/hooks/useNetwork/useNetwork.js.map +1 -1
- package/dist/cjs/hooks/useOffsetPagination/useOffsetPagination.js +2 -2
- package/dist/cjs/hooks/useOnline/useOnline.js +1 -1
- package/dist/cjs/hooks/useOperatingSystem/useOperatingSystem.js +1 -1
- package/dist/cjs/hooks/useOptimistic/useOptimistic.js +2 -2
- package/dist/cjs/hooks/useOptimistic/useOptimistic.js.map +1 -1
- package/dist/cjs/hooks/useOrientation/useOrientation.js +2 -2
- package/dist/cjs/hooks/useOrientation/useOrientation.js.map +1 -1
- package/dist/cjs/hooks/useOtpCredential/useOtpCredential.js +2 -2
- package/dist/cjs/hooks/usePageLeave/usePageLeave.js +2 -2
- package/dist/cjs/hooks/usePaint/helpers/Paint.js +2 -2
- package/dist/cjs/hooks/usePaint/helpers/Pointer.js +2 -2
- package/dist/cjs/hooks/usePaint/usePaint.js +2 -2
- package/dist/cjs/hooks/usePaint/usePaint.js.map +1 -1
- package/dist/cjs/hooks/useParallax/useParallax.js +2 -2
- package/dist/cjs/hooks/useParallax/useParallax.js.map +1 -1
- package/dist/cjs/hooks/usePermission/usePermission.js +2 -2
- package/dist/cjs/hooks/usePointerLock/usePointerLock.js +2 -2
- package/dist/cjs/hooks/usePostMessage/usePostMessage.js +1 -1
- package/dist/cjs/hooks/usePreferredColorScheme/usePreferredColorScheme.js +1 -1
- package/dist/cjs/hooks/usePreferredContrast/usePreferredContrast.js +1 -1
- package/dist/cjs/hooks/usePreferredDark/usePreferredDark.js +1 -1
- package/dist/cjs/hooks/usePreferredLanguages/usePreferredLanguages.js +1 -1
- package/dist/cjs/hooks/usePreferredReducedMotion/usePreferredReducedMotion.js +1 -1
- package/dist/cjs/hooks/usePrevious/usePrevious.js +1 -1
- package/dist/cjs/hooks/useQuery/useQuery.js +2 -2
- package/dist/cjs/hooks/useQuery/useQuery.js.map +1 -1
- package/dist/cjs/hooks/useQueue/useQueue.js +2 -2
- package/dist/cjs/hooks/useRaf/useRaf.js +2 -2
- package/dist/cjs/hooks/useRaf/useRaf.js.map +1 -1
- package/dist/cjs/hooks/useRafValue/useRafValue.js +2 -2
- package/dist/cjs/hooks/useRefState/useRefState.js +2 -2
- package/dist/cjs/hooks/useRefState/useRefState.js.map +1 -1
- package/dist/cjs/hooks/useRenderCount/useRenderCount.js +1 -1
- package/dist/cjs/hooks/useRenderInfo/useRenderInfo.js +1 -1
- package/dist/cjs/hooks/useRerender/useRerender.js +1 -1
- package/dist/cjs/hooks/useResizeObserver/useResizeObserver.js +2 -2
- package/dist/cjs/hooks/useResizeObserver/useResizeObserver.js.map +1 -1
- package/dist/cjs/hooks/useScreenOrientation/useScreenOrientation.js +2 -2
- package/dist/cjs/hooks/useScript/useScript.js +2 -2
- package/dist/cjs/hooks/useScroll/useScroll.js +2 -2
- package/dist/cjs/hooks/useScroll/useScroll.js.map +1 -1
- package/dist/cjs/hooks/useScrollIntoView/useScrollIntoView.js +3 -0
- package/dist/cjs/hooks/useScrollIntoView/useScrollIntoView.js.map +1 -0
- package/dist/cjs/hooks/useScrollTo/useScrollTo.js +2 -2
- package/dist/cjs/hooks/useScrollTo/useScrollTo.js.map +1 -1
- package/dist/cjs/hooks/useSessionStorage/useSessionStorage.js +2 -2
- package/dist/cjs/hooks/useSessionStorage/useSessionStorage.js.map +1 -1
- package/dist/cjs/hooks/useSet/useSet.js +2 -2
- package/dist/cjs/hooks/useShare/useShare.js +2 -2
- package/dist/cjs/hooks/useShare/useShare.js.map +1 -1
- package/dist/cjs/hooks/useStateHistory/useStateHistory.js +3 -0
- package/dist/cjs/hooks/useStateHistory/useStateHistory.js.map +1 -0
- package/dist/cjs/hooks/useStep/useStep.js +2 -2
- package/dist/cjs/hooks/useStopwatch/useStopwatch.js +2 -2
- package/dist/cjs/hooks/useStorage/useStorage.js +2 -2
- package/dist/cjs/hooks/useStorage/useStorage.js.map +1 -1
- package/dist/cjs/hooks/useTextDirection/useTextDirection.js +2 -2
- package/dist/cjs/hooks/useTextDirection/useTextDirection.js.map +1 -1
- package/dist/cjs/hooks/useTextSelection/useTextSelection.js +2 -2
- package/dist/cjs/hooks/useTextSelection/useTextSelection.js.map +1 -1
- package/dist/cjs/hooks/useThrottleCallback/useThrottleCallback.js +2 -2
- package/dist/cjs/hooks/useThrottleCallback/useThrottleCallback.js.map +1 -1
- package/dist/cjs/hooks/useThrottleValue/useThrottleValue.js +2 -2
- package/dist/cjs/hooks/useThrottleValue/useThrottleValue.js.map +1 -1
- package/dist/cjs/hooks/useTime/useTime.js +2 -2
- package/dist/cjs/hooks/useTime/useTime.js.map +1 -1
- package/dist/cjs/hooks/useTimeout/useTimeout.js +2 -2
- package/dist/cjs/hooks/useTimer/useTimer.js +2 -2
- package/dist/cjs/hooks/useToggle/useToggle.js +2 -2
- package/dist/cjs/hooks/useUnmount/useUnmount.js +1 -1
- package/dist/cjs/hooks/useVibrate/useVibrate.js +2 -2
- package/dist/cjs/hooks/useWebSocket/useWebSocket.js +2 -2
- package/dist/cjs/hooks/useWebSocket/useWebSocket.js.map +1 -1
- package/dist/cjs/hooks/useWindowEvent/useWindowEvent.js +2 -2
- package/dist/cjs/hooks/useWindowEvent/useWindowEvent.js.map +1 -1
- package/dist/cjs/hooks/useWindowFocus/useWindowFocus.js +2 -2
- package/dist/cjs/hooks/useWindowScroll/useWindowScroll.js +2 -2
- package/dist/cjs/hooks/useWindowScroll/useWindowScroll.js.map +1 -1
- package/dist/cjs/hooks/useWindowSize/useWindowSize.js +2 -2
- package/dist/cjs/hooks/useWindowSize/useWindowSize.js.map +1 -1
- package/dist/cjs/hooks/useWizard/useWizard.js +2 -2
- package/dist/cjs/hooks/useWizard/useWizard.js.map +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/utils/helpers/debounce.js +1 -1
- package/dist/cjs/utils/helpers/getElement.js +1 -1
- package/dist/cjs/utils/helpers/getRetry.js +1 -1
- package/dist/cjs/utils/helpers/index.js +2 -2
- package/dist/cjs/utils/helpers/isTarget.js +2 -2
- package/dist/cjs/utils/helpers/isTarget.js.map +1 -1
- package/dist/cjs/utils/helpers/throttle.js +1 -1
- package/dist/cjs/utils/helpers/throttle.js.map +1 -1
- package/dist/cjs/utils/helpers/time/getDate.js +1 -1
- package/dist/esm/{_rollupPluginBabelHelpers-CNZ3s-mD.js → _rollupPluginBabelHelpers-BQehtgCo.js} +3 -3
- package/dist/esm/_rollupPluginBabelHelpers-BQehtgCo.js.map +1 -0
- package/dist/esm/hooks/index.js +2 -2
- package/dist/esm/hooks/useActiveElement/useActiveElement.js +2 -2
- package/dist/esm/hooks/useAsync/useAsync.js +2 -2
- package/dist/esm/hooks/useBattery/useBattery.js +2 -2
- package/dist/esm/hooks/useBattery/useBattery.js.map +1 -1
- package/dist/esm/hooks/useBluetooth/useBluetooth.js +2 -2
- package/dist/esm/hooks/useBoolean/useBoolean.js +2 -2
- package/dist/esm/hooks/useBreakpoints/constants/breakpoints.js +1 -1
- package/dist/esm/hooks/useBreakpoints/useBreakpoints.js +2 -2
- package/dist/esm/hooks/useBreakpoints/useBreakpoints.js.map +1 -1
- package/dist/esm/hooks/useBrowserLanguage/useBrowserLanguage.js +1 -1
- package/dist/esm/hooks/useClickOutside/useClickOutside.js +2 -2
- package/dist/esm/hooks/useClickOutside/useClickOutside.js.map +1 -1
- package/dist/esm/hooks/useClipboard/useClipboard.js +2 -2
- package/dist/esm/hooks/useConst/useConst.js +1 -1
- package/dist/esm/hooks/useCounter/useCounter.js +2 -2
- package/dist/esm/hooks/useCssVar/useCssVar.js +2 -2
- package/dist/esm/hooks/useCssVar/useCssVar.js.map +1 -1
- package/dist/esm/hooks/useDebounceCallback/useDebounceCallback.js +2 -2
- package/dist/esm/hooks/useDebounceCallback/useDebounceCallback.js.map +1 -1
- package/dist/esm/hooks/useDebounceValue/useDebounceValue.js +2 -2
- package/dist/esm/hooks/useDebounceValue/useDebounceValue.js.map +1 -1
- package/dist/esm/hooks/useDefault/useDefault.js +2 -2
- package/dist/esm/hooks/useDeviceMotion/useDeviceMotion.js +2 -2
- package/dist/esm/hooks/useDeviceMotion/useDeviceMotion.js.map +1 -1
- package/dist/esm/hooks/useDeviceOrientation/useDeviceOrientation.js +2 -2
- package/dist/esm/hooks/useDevicePixelRatio/useDevicePixelRatio.js +2 -2
- package/dist/esm/hooks/useDevicePixelRatio/useDevicePixelRatio.js.map +1 -1
- package/dist/esm/hooks/useDidUpdate/useDidUpdate.js +2 -2
- package/dist/esm/hooks/useDidUpdate/useDidUpdate.js.map +1 -1
- package/dist/esm/hooks/useDisclosure/useDisclosure.js +2 -2
- package/dist/esm/hooks/useDisplayMedia/useDisplayMedia.js +3 -0
- package/dist/esm/hooks/useDisplayMedia/useDisplayMedia.js.map +1 -0
- package/dist/esm/hooks/useDocumentEvent/useDocumentEvent.js +2 -2
- package/dist/esm/hooks/useDocumentEvent/useDocumentEvent.js.map +1 -1
- package/dist/esm/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
- package/dist/esm/hooks/useDocumentTitle/useDocumentTitle.js.map +1 -1
- package/dist/esm/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
- package/dist/esm/hooks/useElementSize/useElementSize.js +2 -2
- package/dist/esm/hooks/useElementSize/useElementSize.js.map +1 -1
- package/dist/esm/hooks/useEvent/useEvent.js +1 -1
- package/dist/esm/hooks/useEventListener/useEventListener.js +2 -2
- package/dist/esm/hooks/useEventListener/useEventListener.js.map +1 -1
- package/dist/esm/hooks/useEyeDropper/useEyeDropper.js +2 -2
- package/dist/esm/hooks/useFavicon/useFavicon.js +2 -2
- package/dist/esm/hooks/useFavicon/useFavicon.js.map +1 -1
- package/dist/esm/hooks/useField/useField.js +2 -2
- package/dist/esm/hooks/useFileDialog/useFileDialog.js +2 -2
- package/dist/esm/hooks/useFileDialog/useFileDialog.js.map +1 -1
- package/dist/esm/hooks/useFocus/useFocus.js +2 -2
- package/dist/esm/hooks/useFocus/useFocus.js.map +1 -1
- package/dist/esm/hooks/useFps/useFps.js +2 -2
- package/dist/esm/hooks/useFullscreen/useFullscreen.js +2 -2
- package/dist/esm/hooks/useFullscreen/useFullscreen.js.map +1 -1
- package/dist/esm/hooks/useGamepad/helpers/mapGamepadToXbox360Controller.js +1 -1
- package/dist/esm/hooks/useGamepad/useGamepad.js +2 -2
- package/dist/esm/hooks/useGeolocation/useGeolocation.js +2 -2
- package/dist/esm/hooks/useHash/useHash.js +2 -2
- package/dist/esm/hooks/useHotkeys/useHotkeys.js +2 -2
- package/dist/esm/hooks/useHotkeys/useHotkeys.js.map +1 -1
- package/dist/esm/hooks/useHover/useHover.js +2 -2
- package/dist/esm/hooks/useHover/useHover.js.map +1 -1
- package/dist/esm/hooks/useIdle/useIdle.js +2 -2
- package/dist/esm/hooks/useIdle/useIdle.js.map +1 -1
- package/dist/esm/hooks/useImage/useImage.js +2 -2
- package/dist/esm/hooks/useImage/useImage.js.map +1 -1
- package/dist/esm/hooks/useInfiniteScroll/useInfiniteScroll.js +2 -2
- package/dist/esm/hooks/useInfiniteScroll/useInfiniteScroll.js.map +1 -1
- package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -2
- package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.js.map +1 -1
- package/dist/esm/hooks/useInterval/useInterval.js +2 -2
- package/dist/esm/hooks/useInterval/useInterval.js.map +1 -1
- package/dist/esm/hooks/useIsFirstRender/useIsFirstRender.js +1 -1
- package/dist/esm/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +2 -2
- package/dist/esm/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js.map +1 -1
- package/dist/esm/hooks/useKeyPress/useKeyPress.js +2 -2
- package/dist/esm/hooks/useKeyPress/useKeyPress.js.map +1 -1
- package/dist/esm/hooks/useKeyPressEvent/useKeyPressEvent.js +2 -2
- package/dist/esm/hooks/useKeyPressEvent/useKeyPressEvent.js.map +1 -1
- package/dist/esm/hooks/useKeyboard/useKeyboard.js +2 -2
- package/dist/esm/hooks/useKeyboard/useKeyboard.js.map +1 -1
- package/dist/esm/hooks/useKeysPressed/useKeysPressed.js +2 -2
- package/dist/esm/hooks/useKeysPressed/useKeysPressed.js.map +1 -1
- package/dist/esm/hooks/useLastChanged/useLastChanged.js +2 -2
- package/dist/esm/hooks/useLastChanged/useLastChanged.js.map +1 -1
- package/dist/esm/hooks/useLatest/useLatest.js +1 -1
- package/dist/esm/hooks/useList/useList.js +2 -2
- package/dist/esm/hooks/useLocalStorage/useLocalStorage.js +2 -2
- package/dist/esm/hooks/useLocalStorage/useLocalStorage.js.map +1 -1
- package/dist/esm/hooks/useLogger/useLogger.js +2 -2
- package/dist/esm/hooks/useLogger/useLogger.js.map +1 -1
- package/dist/esm/hooks/useLongPress/useLongPress.js +2 -2
- package/dist/esm/hooks/useLongPress/useLongPress.js.map +1 -1
- package/dist/esm/hooks/useMap/useMap.js +2 -2
- package/dist/esm/hooks/useMeasure/useMeasure.js +2 -2
- package/dist/esm/hooks/useMeasure/useMeasure.js.map +1 -1
- package/dist/esm/hooks/useMediaQuery/useMediaQuery.js +1 -1
- package/dist/esm/hooks/useMemory/useMemory.js +2 -2
- package/dist/esm/hooks/useMount/useMount.js +1 -1
- package/dist/esm/hooks/useMouse/useMouse.js +2 -2
- package/dist/esm/hooks/useMouse/useMouse.js.map +1 -1
- package/dist/esm/hooks/useMutation/useMutation.js +2 -2
- package/dist/esm/hooks/useMutationObserver/useMutationObserver.js +2 -2
- package/dist/esm/hooks/useMutationObserver/useMutationObserver.js.map +1 -1
- package/dist/esm/hooks/useNetwork/useNetwork.js +2 -2
- package/dist/esm/hooks/useNetwork/useNetwork.js.map +1 -1
- package/dist/esm/hooks/useOffsetPagination/useOffsetPagination.js +2 -2
- package/dist/esm/hooks/useOnline/useOnline.js +1 -1
- package/dist/esm/hooks/useOperatingSystem/useOperatingSystem.js +1 -1
- package/dist/esm/hooks/useOptimistic/useOptimistic.js +2 -2
- package/dist/esm/hooks/useOptimistic/useOptimistic.js.map +1 -1
- package/dist/esm/hooks/useOrientation/useOrientation.js +2 -2
- package/dist/esm/hooks/useOrientation/useOrientation.js.map +1 -1
- package/dist/esm/hooks/useOtpCredential/useOtpCredential.js +2 -2
- package/dist/esm/hooks/usePageLeave/usePageLeave.js +2 -2
- package/dist/esm/hooks/usePaint/helpers/Paint.js +2 -2
- package/dist/esm/hooks/usePaint/helpers/Pointer.js +2 -2
- package/dist/esm/hooks/usePaint/usePaint.js +2 -2
- package/dist/esm/hooks/usePaint/usePaint.js.map +1 -1
- package/dist/esm/hooks/useParallax/useParallax.js +2 -2
- package/dist/esm/hooks/useParallax/useParallax.js.map +1 -1
- package/dist/esm/hooks/usePermission/usePermission.js +2 -2
- package/dist/esm/hooks/usePointerLock/usePointerLock.js +2 -2
- package/dist/esm/hooks/usePostMessage/usePostMessage.js +1 -1
- package/dist/esm/hooks/usePreferredColorScheme/usePreferredColorScheme.js +1 -1
- package/dist/esm/hooks/usePreferredContrast/usePreferredContrast.js +1 -1
- package/dist/esm/hooks/usePreferredDark/usePreferredDark.js +1 -1
- package/dist/esm/hooks/usePreferredLanguages/usePreferredLanguages.js +1 -1
- package/dist/esm/hooks/usePreferredReducedMotion/usePreferredReducedMotion.js +1 -1
- package/dist/esm/hooks/usePrevious/usePrevious.js +1 -1
- package/dist/esm/hooks/useQuery/useQuery.js +2 -2
- package/dist/esm/hooks/useQuery/useQuery.js.map +1 -1
- package/dist/esm/hooks/useQueue/useQueue.js +2 -2
- package/dist/esm/hooks/useRaf/useRaf.js +2 -2
- package/dist/esm/hooks/useRaf/useRaf.js.map +1 -1
- package/dist/esm/hooks/useRafValue/useRafValue.js +2 -2
- package/dist/esm/hooks/useRefState/useRefState.js +2 -2
- package/dist/esm/hooks/useRefState/useRefState.js.map +1 -1
- package/dist/esm/hooks/useRenderCount/useRenderCount.js +1 -1
- package/dist/esm/hooks/useRenderInfo/useRenderInfo.js +1 -1
- package/dist/esm/hooks/useRerender/useRerender.js +1 -1
- package/dist/esm/hooks/useResizeObserver/useResizeObserver.js +2 -2
- package/dist/esm/hooks/useResizeObserver/useResizeObserver.js.map +1 -1
- package/dist/esm/hooks/useScreenOrientation/useScreenOrientation.js +2 -2
- package/dist/esm/hooks/useScript/useScript.js +2 -2
- package/dist/esm/hooks/useScroll/useScroll.js +2 -2
- package/dist/esm/hooks/useScroll/useScroll.js.map +1 -1
- package/dist/esm/hooks/useScrollIntoView/useScrollIntoView.js +3 -0
- package/dist/esm/hooks/useScrollIntoView/useScrollIntoView.js.map +1 -0
- package/dist/esm/hooks/useScrollTo/useScrollTo.js +2 -2
- package/dist/esm/hooks/useScrollTo/useScrollTo.js.map +1 -1
- package/dist/esm/hooks/useSessionStorage/useSessionStorage.js +2 -2
- package/dist/esm/hooks/useSessionStorage/useSessionStorage.js.map +1 -1
- package/dist/esm/hooks/useSet/useSet.js +2 -2
- package/dist/esm/hooks/useShare/useShare.js +2 -2
- package/dist/esm/hooks/useShare/useShare.js.map +1 -1
- package/dist/esm/hooks/useStateHistory/useStateHistory.js +3 -0
- package/dist/esm/hooks/useStateHistory/useStateHistory.js.map +1 -0
- package/dist/esm/hooks/useStep/useStep.js +2 -2
- package/dist/esm/hooks/useStopwatch/useStopwatch.js +2 -2
- package/dist/esm/hooks/useStorage/useStorage.js +2 -2
- package/dist/esm/hooks/useStorage/useStorage.js.map +1 -1
- package/dist/esm/hooks/useTextDirection/useTextDirection.js +2 -2
- package/dist/esm/hooks/useTextDirection/useTextDirection.js.map +1 -1
- package/dist/esm/hooks/useTextSelection/useTextSelection.js +2 -2
- package/dist/esm/hooks/useTextSelection/useTextSelection.js.map +1 -1
- package/dist/esm/hooks/useThrottleCallback/useThrottleCallback.js +2 -2
- package/dist/esm/hooks/useThrottleCallback/useThrottleCallback.js.map +1 -1
- package/dist/esm/hooks/useThrottleValue/useThrottleValue.js +2 -2
- package/dist/esm/hooks/useThrottleValue/useThrottleValue.js.map +1 -1
- package/dist/esm/hooks/useTime/useTime.js +2 -2
- package/dist/esm/hooks/useTime/useTime.js.map +1 -1
- package/dist/esm/hooks/useTimeout/useTimeout.js +2 -2
- package/dist/esm/hooks/useTimer/useTimer.js +2 -2
- package/dist/esm/hooks/useToggle/useToggle.js +2 -2
- package/dist/esm/hooks/useUnmount/useUnmount.js +1 -1
- package/dist/esm/hooks/useVibrate/useVibrate.js +2 -2
- package/dist/esm/hooks/useWebSocket/useWebSocket.js +2 -2
- package/dist/esm/hooks/useWebSocket/useWebSocket.js.map +1 -1
- package/dist/esm/hooks/useWindowEvent/useWindowEvent.js +2 -2
- package/dist/esm/hooks/useWindowEvent/useWindowEvent.js.map +1 -1
- package/dist/esm/hooks/useWindowFocus/useWindowFocus.js +2 -2
- package/dist/esm/hooks/useWindowScroll/useWindowScroll.js +2 -2
- package/dist/esm/hooks/useWindowScroll/useWindowScroll.js.map +1 -1
- package/dist/esm/hooks/useWindowSize/useWindowSize.js +2 -2
- package/dist/esm/hooks/useWindowSize/useWindowSize.js.map +1 -1
- package/dist/esm/hooks/useWizard/useWizard.js +2 -2
- package/dist/esm/hooks/useWizard/useWizard.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/utils/helpers/debounce.js +1 -1
- package/dist/esm/utils/helpers/getElement.js +1 -1
- package/dist/esm/utils/helpers/getRetry.js +1 -1
- package/dist/esm/utils/helpers/index.js +2 -2
- package/dist/esm/utils/helpers/isTarget.js +2 -2
- package/dist/esm/utils/helpers/isTarget.js.map +1 -1
- package/dist/esm/utils/helpers/throttle.js +1 -1
- package/dist/esm/utils/helpers/throttle.js.map +1 -1
- package/dist/esm/utils/helpers/time/getDate.js +1 -1
- package/dist/types/index.d.ts +192 -30
- package/package.json +89 -114
- package/LICENSE +0 -21
- package/dist/cjs/_rollupPluginBabelHelpers-BsWog5nG.js.map +0 -1
- package/dist/cjs/utils/helpers/isClient.js +0 -3
- package/dist/cjs/utils/helpers/isClient.js.map +0 -1
- package/dist/esm/_rollupPluginBabelHelpers-CNZ3s-mD.js.map +0 -1
- package/dist/esm/utils/helpers/isClient.js +0 -3
- package/dist/esm/utils/helpers/isClient.js.map +0 -1
package/dist/esm/hooks/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
export{useActiveElement}from"./useActiveElement/useActiveElement.js";export{useAsync}from"./useAsync/useAsync.js";export{useBattery}from"./useBattery/useBattery.js";export{useBluetooth}from"./useBluetooth/useBluetooth.js";export{useBoolean}from"./useBoolean/useBoolean.js";export{useBreakpoints}from"./useBreakpoints/useBreakpoints.js";export{useBrowserLanguage}from"./useBrowserLanguage/useBrowserLanguage.js";export{useClickOutside}from"./useClickOutside/useClickOutside.js";export{isPermissionAllowed,legacyCopyToClipboard,useClipboard}from"./useClipboard/useClipboard.js";export{useConst}from"./useConst/useConst.js";export{useCounter}from"./useCounter/useCounter.js";export{useCssVar}from"./useCssVar/useCssVar.js";export{useDebounceCallback}from"./useDebounceCallback/useDebounceCallback.js";export{useDebounceValue}from"./useDebounceValue/useDebounceValue.js";export{useDefault}from"./useDefault/useDefault.js";export{useDeviceMotion}from"./useDeviceMotion/useDeviceMotion.js";export{useDeviceOrientation}from"./useDeviceOrientation/useDeviceOrientation.js";export{useDevicePixelRatio}from"./useDevicePixelRatio/useDevicePixelRatio.js";export{useDidUpdate}from"./useDidUpdate/useDidUpdate.js";export{useDisclosure}from"./useDisclosure/useDisclosure.js";export{useDocumentEvent}from"./useDocumentEvent/useDocumentEvent.js";export{useDocumentTitle}from"./useDocumentTitle/useDocumentTitle.js";export{useDocumentVisibility}from"./useDocumentVisibility/useDocumentVisibility.js";export{useElementSize}from"./useElementSize/useElementSize.js";export{useEvent}from"./useEvent/useEvent.js";export{useEventListener}from"./useEventListener/useEventListener.js";export{useEyeDropper}from"./useEyeDropper/useEyeDropper.js";export{useFavicon}from"./useFavicon/useFavicon.js";export{useField}from"./useField/useField.js";export{useFileDialog}from"./useFileDialog/useFileDialog.js";export{useFocus}from"./useFocus/useFocus.js";export{useFps}from"./useFps/useFps.js";export{useFullscreen}from"./useFullscreen/useFullscreen.js";export{useGamepad}from"./useGamepad/useGamepad.js";export{useGeolocation}from"./useGeolocation/useGeolocation.js";export{useHash}from"./useHash/useHash.js";export{isHotkeyMatch,useHotkeys}from"./useHotkeys/useHotkeys.js";export{useHover}from"./useHover/useHover.js";export{useIdle}from"./useIdle/useIdle.js";export{useImage}from"./useImage/useImage.js";export{useInfiniteScroll}from"./useInfiniteScroll/useInfiniteScroll.js";export{useIntersectionObserver}from"./useIntersectionObserver/useIntersectionObserver.js";export{useInterval}from"./useInterval/useInterval.js";export{useIsFirstRender}from"./useIsFirstRender/useIsFirstRender.js";export{useIsomorphicLayoutEffect}from"./useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";export{useKeyboard}from"./useKeyboard/useKeyboard.js";export{useKeyPress}from"./useKeyPress/useKeyPress.js";export{useKeyPressEvent}from"./useKeyPressEvent/useKeyPressEvent.js";export{useKeysPressed}from"./useKeysPressed/useKeysPressed.js";export{useLastChanged}from"./useLastChanged/useLastChanged.js";export{useLatest}from"./useLatest/useLatest.js";export{useList}from"./useList/useList.js";export{useLocalStorage}from"./useLocalStorage/useLocalStorage.js";export{useLogger}from"./useLogger/useLogger.js";export{useLongPress}from"./useLongPress/useLongPress.js";export{useMap}from"./useMap/useMap.js";export{useMeasure}from"./useMeasure/useMeasure.js";export{useMediaQuery}from"./useMediaQuery/useMediaQuery.js";export{useMemory}from"./useMemory/useMemory.js";export{useMount}from"./useMount/useMount.js";export{useMouse}from"./useMouse/useMouse.js";export{useMutation}from"./useMutation/useMutation.js";export{useMutationObserver}from"./useMutationObserver/useMutationObserver.js";export{getConnection,useNetwork}from"./useNetwork/useNetwork.js";export{useOffsetPagination}from"./useOffsetPagination/useOffsetPagination.js";export{useOnline}from"./useOnline/useOnline.js";export{getOperatingSystem,useOperatingSystem}from"./useOperatingSystem/useOperatingSystem.js";export{useOptimistic}from"./useOptimistic/useOptimistic.js";export{useOrientation}from"./useOrientation/useOrientation.js";export{useOtpCredential}from"./useOtpCredential/useOtpCredential.js";export{usePageLeave}from"./usePageLeave/usePageLeave.js";export{usePaint}from"./usePaint/usePaint.js";export{useParallax}from"./useParallax/useParallax.js";export{usePermission}from"./usePermission/usePermission.js";export{usePointerLock}from"./usePointerLock/usePointerLock.js";export{usePostMessage}from"./usePostMessage/usePostMessage.js";export{usePreferredColorScheme}from"./usePreferredColorScheme/usePreferredColorScheme.js";export{usePreferredContrast}from"./usePreferredContrast/usePreferredContrast.js";export{usePreferredDark}from"./usePreferredDark/usePreferredDark.js";export{usePreferredLanguages}from"./usePreferredLanguages/usePreferredLanguages.js";export{usePreferredReducedMotion}from"./usePreferredReducedMotion/usePreferredReducedMotion.js";export{usePrevious}from"./usePrevious/usePrevious.js";export{useQuery}from"./useQuery/useQuery.js";export{useQueue}from"./useQueue/useQueue.js";export{useRaf}from"./useRaf/useRaf.js";export{useRafValue}from"./useRafValue/useRafValue.js";export{useRefState}from"./useRefState/useRefState.js";export{useRenderCount}from"./useRenderCount/useRenderCount.js";export{useRenderInfo}from"./useRenderInfo/useRenderInfo.js";export{useRerender}from"./useRerender/useRerender.js";export{useResizeObserver}from"./useResizeObserver/useResizeObserver.js";export{useScreenOrientation}from"./useScreenOrientation/useScreenOrientation.js";export{SCRIPT_STATUS_ATTRIBUTE_NAME,useScript}from"./useScript/useScript.js";export{useScroll}from"./useScroll/useScroll.js";export{useScrollTo}from"./useScrollTo/useScrollTo.js";export{useSessionStorage}from"./useSessionStorage/useSessionStorage.js";export{useSet}from"./useSet/useSet.js";export{useShare}from"./useShare/useShare.js";export{useStep}from"./useStep/useStep.js";export{useStopwatch}from"./useStopwatch/useStopwatch.js";export{dispatchStorageEvent,useStorage}from"./useStorage/useStorage.js";export{useTextDirection}from"./useTextDirection/useTextDirection.js";export{getRangesSelection,useTextSelection}from"./useTextSelection/useTextSelection.js";export{useThrottleCallback}from"./useThrottleCallback/useThrottleCallback.js";export{useThrottleValue}from"./useThrottleValue/useThrottleValue.js";export{useTime}from"./useTime/useTime.js";export{useTimeout}from"./useTimeout/useTimeout.js";export{getTimeFromSeconds,useTimer}from"./useTimer/useTimer.js";export{useToggle}from"./useToggle/useToggle.js";export{useUnmount}from"./useUnmount/useUnmount.js";export{useVibrate}from"./useVibrate/useVibrate.js";export{useWebSocket}from"./useWebSocket/useWebSocket.js";export{useWindowEvent}from"./useWindowEvent/useWindowEvent.js";export{useWindowFocus}from"./useWindowFocus/useWindowFocus.js";export{scrollTo,useWindowScroll}from"./useWindowScroll/useWindowScroll.js";export{useWindowSize}from"./useWindowSize/useWindowSize.js";export{useWizard}from"./useWizard/useWizard.js";export{BREAKPOINTS_ANT_DESIGN,BREAKPOINTS_BOOTSTRAP_V5,BREAKPOINTS_MANTINE,BREAKPOINTS_MASTER_CSS,BREAKPOINTS_MATERIAL_UI,BREAKPOINTS_PRIME_FLEX,BREAKPOINTS_QUASAR_V2,BREAKPOINTS_SEMANTIC,BREAKPOINTS_TAILWIND}from"./useBreakpoints/constants/breakpoints.js";export{mapGamepadToXbox360Controller}from"./useGamepad/helpers/mapGamepadToXbox360Controller.js";import"../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
|
+
export{useActiveElement}from"./useActiveElement/useActiveElement.js";export{useAsync}from"./useAsync/useAsync.js";export{useBattery}from"./useBattery/useBattery.js";export{useBluetooth}from"./useBluetooth/useBluetooth.js";export{useBoolean}from"./useBoolean/useBoolean.js";export{useBreakpoints}from"./useBreakpoints/useBreakpoints.js";export{useBrowserLanguage}from"./useBrowserLanguage/useBrowserLanguage.js";export{useClickOutside}from"./useClickOutside/useClickOutside.js";export{isPermissionAllowed,legacyCopyToClipboard,useClipboard}from"./useClipboard/useClipboard.js";export{useConst}from"./useConst/useConst.js";export{useCounter}from"./useCounter/useCounter.js";export{useCssVar}from"./useCssVar/useCssVar.js";export{useDebounceCallback}from"./useDebounceCallback/useDebounceCallback.js";export{useDebounceValue}from"./useDebounceValue/useDebounceValue.js";export{useDefault}from"./useDefault/useDefault.js";export{useDeviceMotion}from"./useDeviceMotion/useDeviceMotion.js";export{useDeviceOrientation}from"./useDeviceOrientation/useDeviceOrientation.js";export{useDevicePixelRatio}from"./useDevicePixelRatio/useDevicePixelRatio.js";export{useDidUpdate}from"./useDidUpdate/useDidUpdate.js";export{useDisclosure}from"./useDisclosure/useDisclosure.js";export{useDisplayMedia}from"./useDisplayMedia/useDisplayMedia.js";export{useDocumentEvent}from"./useDocumentEvent/useDocumentEvent.js";export{useDocumentTitle}from"./useDocumentTitle/useDocumentTitle.js";export{useDocumentVisibility}from"./useDocumentVisibility/useDocumentVisibility.js";export{useElementSize}from"./useElementSize/useElementSize.js";export{useEvent}from"./useEvent/useEvent.js";export{useEventListener}from"./useEventListener/useEventListener.js";export{useEyeDropper}from"./useEyeDropper/useEyeDropper.js";export{useFavicon}from"./useFavicon/useFavicon.js";export{useField}from"./useField/useField.js";export{useFileDialog}from"./useFileDialog/useFileDialog.js";export{useFocus}from"./useFocus/useFocus.js";export{useFps}from"./useFps/useFps.js";export{useFullscreen}from"./useFullscreen/useFullscreen.js";export{useGamepad}from"./useGamepad/useGamepad.js";export{useGeolocation}from"./useGeolocation/useGeolocation.js";export{useHash}from"./useHash/useHash.js";export{isHotkeyMatch,useHotkeys}from"./useHotkeys/useHotkeys.js";export{useHover}from"./useHover/useHover.js";export{useIdle}from"./useIdle/useIdle.js";export{useImage}from"./useImage/useImage.js";export{useInfiniteScroll}from"./useInfiniteScroll/useInfiniteScroll.js";export{useIntersectionObserver}from"./useIntersectionObserver/useIntersectionObserver.js";export{useInterval}from"./useInterval/useInterval.js";export{useIsFirstRender}from"./useIsFirstRender/useIsFirstRender.js";export{useIsomorphicLayoutEffect}from"./useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";export{useKeyboard}from"./useKeyboard/useKeyboard.js";export{useKeyPress}from"./useKeyPress/useKeyPress.js";export{useKeyPressEvent}from"./useKeyPressEvent/useKeyPressEvent.js";export{useKeysPressed}from"./useKeysPressed/useKeysPressed.js";export{useLastChanged}from"./useLastChanged/useLastChanged.js";export{useLatest}from"./useLatest/useLatest.js";export{useList}from"./useList/useList.js";export{useLocalStorage}from"./useLocalStorage/useLocalStorage.js";export{useLogger}from"./useLogger/useLogger.js";export{useLongPress}from"./useLongPress/useLongPress.js";export{useMap}from"./useMap/useMap.js";export{useMeasure}from"./useMeasure/useMeasure.js";export{useMediaQuery}from"./useMediaQuery/useMediaQuery.js";export{useMemory}from"./useMemory/useMemory.js";export{useMount}from"./useMount/useMount.js";export{useMouse}from"./useMouse/useMouse.js";export{useMutation}from"./useMutation/useMutation.js";export{useMutationObserver}from"./useMutationObserver/useMutationObserver.js";export{getConnection,useNetwork}from"./useNetwork/useNetwork.js";export{useOffsetPagination}from"./useOffsetPagination/useOffsetPagination.js";export{useOnline}from"./useOnline/useOnline.js";export{getOperatingSystem,useOperatingSystem}from"./useOperatingSystem/useOperatingSystem.js";export{useOptimistic}from"./useOptimistic/useOptimistic.js";export{useOrientation}from"./useOrientation/useOrientation.js";export{useOtpCredential}from"./useOtpCredential/useOtpCredential.js";export{usePageLeave}from"./usePageLeave/usePageLeave.js";export{usePaint}from"./usePaint/usePaint.js";export{useParallax}from"./useParallax/useParallax.js";export{usePermission}from"./usePermission/usePermission.js";export{usePointerLock}from"./usePointerLock/usePointerLock.js";export{usePostMessage}from"./usePostMessage/usePostMessage.js";export{usePreferredColorScheme}from"./usePreferredColorScheme/usePreferredColorScheme.js";export{usePreferredContrast}from"./usePreferredContrast/usePreferredContrast.js";export{usePreferredDark}from"./usePreferredDark/usePreferredDark.js";export{usePreferredLanguages}from"./usePreferredLanguages/usePreferredLanguages.js";export{usePreferredReducedMotion}from"./usePreferredReducedMotion/usePreferredReducedMotion.js";export{usePrevious}from"./usePrevious/usePrevious.js";export{useQuery}from"./useQuery/useQuery.js";export{useQueue}from"./useQueue/useQueue.js";export{useRaf}from"./useRaf/useRaf.js";export{useRafValue}from"./useRafValue/useRafValue.js";export{useRefState}from"./useRefState/useRefState.js";export{useRenderCount}from"./useRenderCount/useRenderCount.js";export{useRenderInfo}from"./useRenderInfo/useRenderInfo.js";export{useRerender}from"./useRerender/useRerender.js";export{useResizeObserver}from"./useResizeObserver/useResizeObserver.js";export{useScreenOrientation}from"./useScreenOrientation/useScreenOrientation.js";export{SCRIPT_STATUS_ATTRIBUTE_NAME,useScript}from"./useScript/useScript.js";export{useScroll}from"./useScroll/useScroll.js";export{useScrollIntoView}from"./useScrollIntoView/useScrollIntoView.js";export{useScrollTo}from"./useScrollTo/useScrollTo.js";export{useSessionStorage}from"./useSessionStorage/useSessionStorage.js";export{useSet}from"./useSet/useSet.js";export{useShare}from"./useShare/useShare.js";export{useStateHistory}from"./useStateHistory/useStateHistory.js";export{useStep}from"./useStep/useStep.js";export{useStopwatch}from"./useStopwatch/useStopwatch.js";export{dispatchStorageEvent,useStorage}from"./useStorage/useStorage.js";export{useTextDirection}from"./useTextDirection/useTextDirection.js";export{getRangesSelection,useTextSelection}from"./useTextSelection/useTextSelection.js";export{useThrottleCallback}from"./useThrottleCallback/useThrottleCallback.js";export{useThrottleValue}from"./useThrottleValue/useThrottleValue.js";export{useTime}from"./useTime/useTime.js";export{useTimeout}from"./useTimeout/useTimeout.js";export{getTimeFromSeconds,useTimer}from"./useTimer/useTimer.js";export{useToggle}from"./useToggle/useToggle.js";export{useUnmount}from"./useUnmount/useUnmount.js";export{useVibrate}from"./useVibrate/useVibrate.js";export{useWebSocket}from"./useWebSocket/useWebSocket.js";export{useWindowEvent}from"./useWindowEvent/useWindowEvent.js";export{useWindowFocus}from"./useWindowFocus/useWindowFocus.js";export{scrollTo,useWindowScroll}from"./useWindowScroll/useWindowScroll.js";export{useWindowSize}from"./useWindowSize/useWindowSize.js";export{useWizard}from"./useWizard/useWizard.js";export{BREAKPOINTS_ANT_DESIGN,BREAKPOINTS_BOOTSTRAP_V5,BREAKPOINTS_MANTINE,BREAKPOINTS_MASTER_CSS,BREAKPOINTS_MATERIAL_UI,BREAKPOINTS_PRIME_FLEX,BREAKPOINTS_QUASAR_V2,BREAKPOINTS_SEMANTIC,BREAKPOINTS_TAILWIND}from"./useBreakpoints/constants/breakpoints.js";export{mapGamepadToXbox360Controller}from"./useGamepad/helpers/mapGamepadToXbox360Controller.js";import"../_rollupPluginBabelHelpers-BQehtgCo.js";import"react";import"../utils/helpers/getElement.js";import"../utils/helpers/isTarget.js";import"../utils/helpers/debounce.js";import"../utils/helpers/throttle.js";import"./usePaint/helpers/Paint.js";import"./usePaint/helpers/Pointer.js";import"../utils/helpers/getRetry.js";import"react-dom";import"../utils/helpers/time/getDate.js";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
|
+
import{_ as n}from"../../_rollupPluginBabelHelpers-BQehtgCo.js";import{useState as e,useEffect as r}from"react";var t=function(){var t=e(null),o=n(t,2),i=o[0],u=o[1];return r((function(){var n=function(){var n;return u(null===(n=document)||void 0===n?void 0:n.activeElement)};return window.addEventListener("focus",n,!0),window.addEventListener("blur",n,!0),function(){window.removeEventListener("focus",n,!0),window.removeEventListener("blur",n,!0)}})),r((function(){var n=new MutationObserver((function(n){n.filter((function(n){return n.removedNodes.length})).map((function(n){return Array.from(n.removedNodes)})).flat().forEach((function(n){u((function(e){return n===e?document.activeElement:e}))}))}));return n.observe(document,{childList:!0,subtree:!0}),function(){n.disconnect()}}),[]),i};export{t as useActiveElement};
|
|
3
3
|
//# sourceMappingURL=useActiveElement.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-BQehtgCo.js";import{useState as o,useEffect as i}from"react";var n=function(n,t){var a=o(!0),c=r(a,2),e=c[0],f=c[1],u=o(!1),l=r(u,2),d=l[0],p=l[1],s=o(void 0),v=r(s,2),m=v[0],g=v[1],h=o(void 0),_=r(h,2),b=_[0],j=_[1];return i((function(){f(!0),n().then((function(r){j(r),g(void 0),p(!1)})).catch((function(r){g(r),p(!0)})).finally((function(){f(!1)}))}),t),{data:b,isLoading:e,isError:d,error:m}};export{n as useAsync};
|
|
3
3
|
//# sourceMappingURL=useAsync.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e,c as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
|
+
import{_ as e,c as n}from"../../_rollupPluginBabelHelpers-BQehtgCo.js";import{useState as i,useEffect as r}from"react";var t=function(){var t="undefined"!=typeof navigator&&"getBattery"in navigator&&"function"==typeof navigator.getBattery,a=i({loading:!0,level:0,charging:!1,chargingTime:0,dischargingTime:0}),g=e(a,2),o=g[0],v=g[1];return r((function(){if(!t)return v(n(n({},o),{},{loading:!1}));var e,i=function(){var n,i,r,t,a,g,o,l;return v({loading:!1,level:null!==(n=null===(i=e)||void 0===i?void 0:i.level)&&void 0!==n?n:0,charging:null!==(r=null===(t=e)||void 0===t?void 0:t.charging)&&void 0!==r&&r,dischargingTime:null!==(a=null===(g=e)||void 0===g?void 0:g.dischargingTime)&&void 0!==a?a:0,chargingTime:null!==(o=null===(l=e)||void 0===l?void 0:l.chargingTime)&&void 0!==o?o:0})};return navigator.getBattery().then((function(n){e=n,i(),e.addEventListener("levelchange",i),e.addEventListener("chargingchange",i),e.addEventListener("chargingtimechange",i),e.addEventListener("dischargingtimechange",i)})),function(){e&&(e.removeEventListener("levelchange",i),e.removeEventListener("chargingchange",i),e.removeEventListener("chargingtimechange",i),e.removeEventListener("dischargingtimechange",i))}}),[]),{supported:t,value:o}};export{t as useBattery};
|
|
3
3
|
//# sourceMappingURL=useBattery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBattery.js","sources":["../../../../src/hooks/useBattery/useBattery.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nexport interface BatteryManager extends EventTarget {\n charging: boolean;\n chargingTime: number;\n dischargingTime: number;\n level: number;\n}\n\ndeclare global {\n interface Navigator {\n readonly getBattery: () => Promise<BatteryManager>;\n }\n}\n\n/** The use battery value type */\nexport interface UseBatteryValue {\n /** Is charging battery? */\n charging: boolean;\n /** Time until the battery is fully charged */\n chargingTime: number;\n /** Time until the battery is completely discharged */\n dischargingTime: number;\n /** Battery charge level from 0 to 1 */\n level: number;\n /** Is battery information loading? */\n loading: boolean;\n}\n\n/** The use battery return type */\nexport interface UseBatteryStateReturn {\n /** Whether the battery api is supported*/\n supported: boolean;\n /** The use battery value type */\n value: UseBatteryValue;\n}\n\n/**\n * @name useBattery\n * @description - Hook for getting information about battery status\n * @category Browser\n *\n * @returns {UseBatteryStateReturn} Object containing battery information & Battery API support\n *\n * @example\n * const { supported, loading, charging, chargingTime, dischargingTime, level } = useBattery();\n */\nexport const useBattery = (): UseBatteryStateReturn => {\n const supported =\n typeof navigator !== 'undefined' &&\n 'getBattery' in navigator &&\n typeof navigator.getBattery === 'function';\n const [value, setValue] = useState<UseBatteryValue>({\n loading: true,\n level: 0,\n charging: false,\n chargingTime: 0,\n dischargingTime: 0\n });\n\n useEffect(() => {\n if (!supported) return setValue({ ...value, loading: false });\n\n let battery: BatteryManager | null;\n\n const onChange = () =>\n setValue({\n loading: false,\n level: battery?.level ?? 0,\n charging: battery?.charging ?? false,\n dischargingTime: battery?.dischargingTime ?? 0,\n chargingTime: battery?.chargingTime ?? 0\n });\n\n navigator.getBattery().then((batteryManager) => {\n battery = batteryManager;\n onChange();\n\n
|
|
1
|
+
{"version":3,"file":"useBattery.js","sources":["../../../../src/hooks/useBattery/useBattery.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nexport interface BatteryManager extends EventTarget {\n charging: boolean;\n chargingTime: number;\n dischargingTime: number;\n level: number;\n}\n\ndeclare global {\n interface Navigator {\n readonly getBattery: () => Promise<BatteryManager>;\n }\n}\n\n/** The use battery value type */\nexport interface UseBatteryValue {\n /** Is charging battery? */\n charging: boolean;\n /** Time until the battery is fully charged */\n chargingTime: number;\n /** Time until the battery is completely discharged */\n dischargingTime: number;\n /** Battery charge level from 0 to 1 */\n level: number;\n /** Is battery information loading? */\n loading: boolean;\n}\n\n/** The use battery return type */\nexport interface UseBatteryStateReturn {\n /** Whether the battery api is supported*/\n supported: boolean;\n /** The use battery value type */\n value: UseBatteryValue;\n}\n\n/**\n * @name useBattery\n * @description - Hook for getting information about battery status\n * @category Browser\n *\n * @returns {UseBatteryStateReturn} Object containing battery information & Battery API support\n *\n * @example\n * const { supported, loading, charging, chargingTime, dischargingTime, level } = useBattery();\n */\nexport const useBattery = (): UseBatteryStateReturn => {\n const supported =\n typeof navigator !== 'undefined' &&\n 'getBattery' in navigator &&\n typeof navigator.getBattery === 'function';\n const [value, setValue] = useState<UseBatteryValue>({\n loading: true,\n level: 0,\n charging: false,\n chargingTime: 0,\n dischargingTime: 0\n });\n\n useEffect(() => {\n if (!supported) return setValue({ ...value, loading: false });\n\n let battery: BatteryManager | null;\n\n const onChange = () =>\n setValue({\n loading: false,\n level: battery?.level ?? 0,\n charging: battery?.charging ?? false,\n dischargingTime: battery?.dischargingTime ?? 0,\n chargingTime: battery?.chargingTime ?? 0\n });\n\n navigator.getBattery().then((batteryManager) => {\n battery = batteryManager;\n onChange();\n\n battery.addEventListener('levelchange', onChange);\n battery.addEventListener('chargingchange', onChange);\n battery.addEventListener('chargingtimechange', onChange);\n battery.addEventListener('dischargingtimechange', onChange);\n });\n\n return () => {\n if (!battery) return;\n battery.removeEventListener('levelchange', onChange);\n battery.removeEventListener('chargingchange', onChange);\n battery.removeEventListener('chargingtimechange', onChange);\n battery.removeEventListener('dischargingtimechange', onChange);\n };\n }, []);\n\n return { supported, value };\n};\n"],"names":["useBattery","supported","navigator","getBattery","_useState","useState","loading","level","charging","chargingTime","dischargingTime","_useState2","_slicedToArray","value","setValue","useEffect","_objectSpread","battery","onChange","_battery$level","_battery","_battery$charging","_battery2","_battery$dischargingT","_battery3","_battery$chargingTime","_battery4","then","batteryManager","addEventListener","removeEventListener"],"mappings":";2HA+CaA,EAAa,WACxB,IAAMC,EACiB,oBAAdC,WACP,eAAgBA,WACgB,mBAAzBA,UAAUC,WACnBC,EAA0BC,EAA0B,CAClDC,SAAS,EACTC,MAAO,EACPC,UAAU,EACVC,aAAc,EACdC,gBAAiB,IACjBC,EAAAC,EAAAR,EAAA,GANKS,EAAKF,EAAA,GAAEG,EAAQH,EAAA,GAyCtB,OAjCAI,GAAU,WACR,IAAKd,EAAW,OAAOa,EAAQE,EAAAA,EAAA,CAAA,EAAMH,GAAK,GAAA,CAAEP,SAAS,KAErD,IAAIW,EAEEC,EAAW,WAAH,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAA,OACZZ,EAAS,CACPR,SAAS,EACTC,MAAqB,QAAhBY,EAASC,QAATA,EAAEH,SAAAG,IAAOA,OAAPA,EAAAA,EAASb,aAAKY,IAAAA,EAAAA,EAAI,EACzBX,SAA2B,QAAnBa,EAASC,QAATA,EAAEL,SAAAK,IAAOA,OAAPA,EAAAA,EAASd,gBAAQa,IAAAA,GAAAA,EAC3BX,gBAAyC,QAA1Ba,EAASC,QAATA,EAAEP,SAAAO,IAAOA,OAAPA,EAAAA,EAASd,uBAAea,IAAAA,EAAAA,EAAI,EAC7Cd,aAAmC,QAAvBgB,EAASC,QAATA,EAAET,SAAAS,IAAOA,OAAPA,EAAAA,EAASjB,oBAAY,IAAAgB,EAAAA,EAAI,GACvC,EAYJ,OAVAvB,UAAUC,aAAawB,MAAK,SAACC,GAC3BX,EAAUW,EACVV,IAEAD,EAAQY,iBAAiB,cAAeX,GACxCD,EAAQY,iBAAiB,iBAAkBX,GAC3CD,EAAQY,iBAAiB,qBAAsBX,GAC/CD,EAAQY,iBAAiB,wBAAyBX,EACpD,IAEO,WACAD,IACLA,EAAQa,oBAAoB,cAAeZ,GAC3CD,EAAQa,oBAAoB,iBAAkBZ,GAC9CD,EAAQa,oBAAoB,qBAAsBZ,GAClDD,EAAQa,oBAAoB,wBAAyBZ,GACtD,CACF,GAAE,IAEI,CAAEjB,UAAAA,EAAWY,MAAAA,EACtB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e,d as t,e as r,c as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
|
+
import{_ as e,d as t,e as r,c as n}from"../../_rollupPluginBabelHelpers-BQehtgCo.js";import{useState as a,useEffect as c}from"react";var i=function(i){var o="undefined"!=typeof navigator&&"bluetooth"in navigator,s=null!=i?i:{},u=s.acceptAllDevices,v=void 0!==u&&u,p=s.filters,f=s.optionalServices,l=a(!1),d=e(l,2),g=d[0],b=d[1],m=a(void 0),x=e(m,2),h=x[0],D=x[1],k=a(void 0),w=e(k,2),y=w[0],A=w[1],q=function(){var e=t(r().mark((function e(){var t;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,navigator.bluetooth.requestDevice(n({acceptAllDevices:v,optionalServices:f},p&&{filters:p,acceptAllDevices:!1}));case 4:t=e.sent,D(t);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return c((function(){if(h&&h.gatt){var e=function(){var e=t(r().mark((function e(){var t;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(h.gatt){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,h.gatt.connect();case 4:t=e.sent,A(t),b(t.connected);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),n=function(){A(void 0),D(void 0),b(!1)};return h.addEventListener("gattserverdisconnected",n),e(),function(){var e;h.removeEventListener("gattserverdisconnected",n),null===(e=h.gatt)||void 0===e||e.disconnect()}}}),[h]),{supported:o,connected:g,device:h,requestDevice:q,server:y}};export{i as useBluetooth};
|
|
3
3
|
//# sourceMappingURL=useBluetooth.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-BQehtgCo.js";import{useState as n}from"react";var t=function(){var t=n(arguments.length>0&&void 0!==arguments[0]&&arguments[0]),o=r(t,2),e=o[0],u=o[1];return[e,function(r){return u((function(n){return null!=r?r:!n}))}]};export{t as useBoolean};
|
|
3
3
|
//# sourceMappingURL=useBoolean.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
2
|
var l={xs:0,sm:600,md:900,lg:1200,xl:1536},x={xs:576,sm:768,md:992,lg:1200,xl:1408},m={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},s={xs:0,sm:576,md:768,lg:992,xl:1200,xxl:1400},d={xs:480,sm:576,md:768,lg:992,xl:1200,xxl:1600},g={xs:0,sm:600,md:1024,lg:1440,xl:1920},o={mobileS:320,mobileM:375,mobileL:425,tablet:768,laptop:1024,laptopL:1440,desktop4K:2560},e={"3xs":360,"2xs":480,xs:600,sm:768,md:1024,lg:1280,xl:1440,"2xl":1600,"3xl":1920,"4xl":2560},p={sm:576,md:768,lg:992,xl:1200};export{d as BREAKPOINTS_ANT_DESIGN,s as BREAKPOINTS_BOOTSTRAP_V5,x as BREAKPOINTS_MANTINE,e as BREAKPOINTS_MASTER_CSS,l as BREAKPOINTS_MATERIAL_UI,p as BREAKPOINTS_PRIME_FLEX,g as BREAKPOINTS_QUASAR_V2,o as BREAKPOINTS_SEMANTIC,m as BREAKPOINTS_TAILWIND};
|
|
3
3
|
//# sourceMappingURL=breakpoints.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{c as r,_ as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
|
+
import{c as r,_ as n}from"../../_rollupPluginBabelHelpers-BQehtgCo.js";import{useEffect as e}from"react";import{useRerender as t}from"../useRerender/useRerender.js";export{BREAKPOINTS_ANT_DESIGN,BREAKPOINTS_BOOTSTRAP_V5,BREAKPOINTS_MANTINE,BREAKPOINTS_MASTER_CSS,BREAKPOINTS_MATERIAL_UI,BREAKPOINTS_PRIME_FLEX,BREAKPOINTS_QUASAR_V2,BREAKPOINTS_SEMANTIC,BREAKPOINTS_TAILWIND}from"./constants/breakpoints.js";var i=function(r){return window.matchMedia(r).matches},o=function(o){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"mobile-first",a=t(),c=function(r,n){return"".concat(n?Number(o[r])+n:o[r],"px")};e((function(){var r=function(){return a()};return window.addEventListener("resize",r),function(){window.removeEventListener("resize",r)}}),[]);var s=function(r){return i("(min-width: ".concat(c(r),")"))},m=function(r){return i("(max-width: ".concat(c(r),")"))},f=function(){return Object.keys(o).map((function(r){return[r,s(r)]})).filter((function(r){return n(r,2)[1]})).map((function(r){return n(r,1)[0]}))},l=function(r){return i("(min-width: ".concat(c(r,.1),")"))},E=function(r){return i("(max-width: ".concat(c(r,-.1),")"))},A=function(r,n){return i("(min-width: ".concat(c(r),") and (max-width: ").concat(c(n,-.1),")"))},d=Object.keys(o).reduce((function(r,n){var e="mobile-first"===u?s(n):m(n);return r[n]=e,r}),{});return r({current:f,greaterOrEqual:s,smallerOrEqual:m,active:function(){var r=f();return r.length?r.at(-1):void 0},greater:l,smaller:E,between:A,isGreater:l,isGreaterOrEqual:s,isSmaller:E,isSmallerOrEqual:m,isInBetween:A},d)};export{o as useBreakpoints};
|
|
3
3
|
//# sourceMappingURL=useBreakpoints.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBreakpoints.js","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) => 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 checks if the current breakpoint is greater than to the given breakpoint */\n isGreater: (breakpoint: Breakpoint) => boolean;\n /** The function that checks if the current breakpoint is greater than or equal to the given breakpoint */\n isGreaterOrEqual: (breakpoint: Breakpoint) => boolean;\n /** The function that checks if the current breakpoint is smaller than to the given breakpoint */\n isSmaller: (breakpoint: Breakpoint) => boolean;\n /** The function that checks if the current breakpoint is smaller than or equal to the given breakpoint */\n isSmallerOrEqual: (breakpoint: Breakpoint) => boolean;\n /** The function that checks if the current breakpoint is between to the given breakpoints */\n isInBetween: (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 *\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 { greaterOrEqual, smallerOrEqual, current } = 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 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 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 isGreater: greater,\n isGreaterOrEqual: greaterOrEqual,\n isSmaller: smaller,\n isSmallerOrEqual: smallerOrEqual,\n isInBetween: between,\n ...breakpointsKeys\n };\n};\n\nexport * from './constants/breakpoints';\n"],"names":["match","query","window","matchMedia","matches","useBreakpoints","breakpoints","strategy","arguments","length","undefined","rerender","useRerender","getValue","breakpoint","delta","concat","Number","useEffect","onResize","addEventListener","removeEventListener","greaterOrEqual","smallerOrEqual","current","Object","keys","map","filter","_ref","_slicedToArray","_ref3","greater","smaller","between","a","b","breakpointsKeys","reduce","acc","value","_objectSpread","active","at","isGreater","isGreaterOrEqual","isSmaller","isSmallerOrEqual","isInBetween"],"mappings":";uZAUA,IAAMA,EAAQ,SAACC,GAAa,OAAKC,OAAOC,WAAWF,GAAOG,OAAO,EA2CpDC,EAAiB,SAC5BC,GAEqC,IADrCC,EAAgCC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,eAE7BG,EAAWC,IAEXC,EAAW,SAACC,EAAwBC,GACxC,MAAWC,GAAAA,OAAPD,EAAiBE,OAAOX,EAAYQ,IAAeC,EAC7CT,EAAYQ,GADsC,KAE7D,EAEDI,GAAU,WACR,IAAMC,EAAW,WAAH,OAASR,GAAU,EAEjC,OADAT,OAAOkB,iBAAiB,SAAUD,GAC3B,WACLjB,OAAOmB,oBAAoB,SAAUF,EACtC,CACF,GAAE,IAEH,IAAMG,EAAiB,SAACR,GAAsB,OAAKd,iBAAKgB,OAAgBH,EAASC,GAAW,KAAI,EAC1FS,EAAiB,SAACT,GAAsB,OAAKd,iBAAKgB,OAAgBH,EAASC,GAAW,KAAI,EAC1FU,EAAU,WAAH,OACXC,OAAOC,KAAKpB,GACTqB,KAAI,SAACb,GAAU,MAAK,CAACA,EAAYQ,EAAeR,GAA0B,IAC1Ec,QAAO,SAAAC,GAAS,OAATC,EAAAD,EAAA,GAAS,EAAW,IAC3BF,KAAI,SAAAI,GAAY,OAAZD,EAAAC,EAAA,GAAY,KAAiC,EAMhDC,EAAU,SAAClB,GAAsB,OAAKd,EAAKgB,eAAAA,OAAgBH,EAASC,EAAY,IAAI,KAAI,EACxFmB,EAAU,SAACnB,GAAsB,OAAKd,EAAK,eAAAgB,OAAgBH,EAASC,
|
|
1
|
+
{"version":3,"file":"useBreakpoints.js","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) => 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 checks if the current breakpoint is greater than to the given breakpoint */\n isGreater: (breakpoint: Breakpoint) => boolean;\n /** The function that checks if the current breakpoint is greater than or equal to the given breakpoint */\n isGreaterOrEqual: (breakpoint: Breakpoint) => boolean;\n /** The function that checks if the current breakpoint is smaller than to the given breakpoint */\n isSmaller: (breakpoint: Breakpoint) => boolean;\n /** The function that checks if the current breakpoint is smaller than or equal to the given breakpoint */\n isSmallerOrEqual: (breakpoint: Breakpoint) => boolean;\n /** The function that checks if the current breakpoint is between to the given breakpoints */\n isInBetween: (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 *\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 { greaterOrEqual, smallerOrEqual, current } = 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 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 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 isGreater: greater,\n isGreaterOrEqual: greaterOrEqual,\n isSmaller: smaller,\n isSmallerOrEqual: smallerOrEqual,\n isInBetween: between,\n ...breakpointsKeys\n };\n};\n\nexport * from './constants/breakpoints';\n"],"names":["match","query","window","matchMedia","matches","useBreakpoints","breakpoints","strategy","arguments","length","undefined","rerender","useRerender","getValue","breakpoint","delta","concat","Number","useEffect","onResize","addEventListener","removeEventListener","greaterOrEqual","smallerOrEqual","current","Object","keys","map","filter","_ref","_slicedToArray","_ref3","greater","smaller","between","a","b","breakpointsKeys","reduce","acc","value","_objectSpread","active","at","isGreater","isGreaterOrEqual","isSmaller","isSmallerOrEqual","isInBetween"],"mappings":";uZAUA,IAAMA,EAAQ,SAACC,GAAa,OAAKC,OAAOC,WAAWF,GAAOG,OAAO,EA2CpDC,EAAiB,SAC5BC,GAEqC,IADrCC,EAAgCC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,eAE7BG,EAAWC,IAEXC,EAAW,SAACC,EAAwBC,GACxC,MAAWC,GAAAA,OAAPD,EAAiBE,OAAOX,EAAYQ,IAAeC,EAC7CT,EAAYQ,GADsC,KAE7D,EAEDI,GAAU,WACR,IAAMC,EAAW,WAAH,OAASR,GAAU,EAEjC,OADAT,OAAOkB,iBAAiB,SAAUD,GAC3B,WACLjB,OAAOmB,oBAAoB,SAAUF,EACtC,CACF,GAAE,IAEH,IAAMG,EAAiB,SAACR,GAAsB,OAAKd,iBAAKgB,OAAgBH,EAASC,GAAW,KAAI,EAC1FS,EAAiB,SAACT,GAAsB,OAAKd,iBAAKgB,OAAgBH,EAASC,GAAW,KAAI,EAC1FU,EAAU,WAAH,OACXC,OAAOC,KAAKpB,GACTqB,KAAI,SAACb,GAAU,MAAK,CAACA,EAAYQ,EAAeR,GAA0B,IAC1Ec,QAAO,SAAAC,GAAS,OAATC,EAAAD,EAAA,GAAS,EAAW,IAC3BF,KAAI,SAAAI,GAAY,OAAZD,EAAAC,EAAA,GAAY,KAAiC,EAMhDC,EAAU,SAAClB,GAAsB,OAAKd,EAAKgB,eAAAA,OAAgBH,EAASC,EAAY,IAAI,KAAI,EACxFmB,EAAU,SAACnB,GAAsB,OAAKd,EAAK,eAAAgB,OAAgBH,EAASC,GAAgB,IAAC,KAAI,EACzFoB,EAAU,SAACC,EAAeC,GAAa,OAC3CpC,EAAKgB,eAAAA,OAAgBH,EAASsB,GAAE,sBAAAnB,OAAqBH,EAASuB,GAAG,SAAS,EAEtEC,EAAmBZ,OAAOC,KAAKpB,GAA8BgC,QACjE,SAACC,EAAKzB,GACJ,IAAM0B,EACS,iBAAbjC,EAA8Be,EAAeR,GAAcS,EAAeT,GAE5E,OADAyB,EAAIzB,GAAc0B,EACXD,CACR,GACD,IAGF,OAAAE,EAAA,CACEjB,QAAAA,EACAF,eAAAA,EACAC,eAAAA,EACAmB,OAxBa,WACb,IAAMpC,EAAckB,IACpB,OAAQlB,EAAYG,OAASH,EAAYqC,IAAG,QAAMjC,CACnD,EAsBCsB,QAAAA,EACAC,QAAAA,EACAC,QAAAA,EACAU,UAAWZ,EACXa,iBAAkBvB,EAClBwB,UAAWb,EACXc,iBAAkBxB,EAClByB,YAAad,GACVG,EAEP"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
2
|
import{useSyncExternalStore as n}from"react";var e=function(){return navigator.language},r=function(){return"undetermined"},t=function(n){return window.addEventListener("languagechange",n),function(){return window.removeEventListener("languagechange",n)}},u=function(){return n(t,e,r)};export{u as useBrowserLanguage};
|
|
3
3
|
//# sourceMappingURL=useBrowserLanguage.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{useRef as
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
|
+
import{useRef as t,useEffect as e}from"react";import{getElement as r}from"../../utils/helpers/getElement.js";import{isTarget as n}from"../../utils/helpers/isTarget.js";import{useRefState as i}from"../useRefState/useRefState.js";import"../../_rollupPluginBabelHelpers-BQehtgCo.js";var o=function(){var o=n(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,l=(arguments.length<=1?void 0:arguments[1])?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],s=i(),u=t(l);if(u.current=l,e((function(){if(o||s.state){var t=function(t){var e=o?r(o):s.current;e&&!e.contains(t.target)&&u.current(t)};return document.addEventListener("click",t),function(){document.removeEventListener("click",t)}}}),[o,s.state]),!o)return s};export{o as useClickOutside};
|
|
3
3
|
//# sourceMappingURL=useClickOutside.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useClickOutside.js","sources":["../../../../src/hooks/useClickOutside/useClickOutside.ts"],"sourcesContent":["import type { RefObject } from 'react';\n\nimport { useEffect, useRef } from 'react';\n\nimport { getElement, isTarget } from '@/utils/helpers';\n\nimport type { StateRef } from '../useRefState/useRefState';\n\nimport { useRefState } from '../useRefState/useRefState';\n\n/** The use click outside target element type */\nexport type UseClickOutsideTarget = string | Element | RefObject<Element | null | undefined>;\n\nexport interface UseClickOutside {\n <Target extends UseClickOutsideTarget>(target: Target, callback: (event: Event) => void): void;\n\n <Target extends UseClickOutsideTarget>(\n callback: (event: Event) => void,\n target?: never\n ): StateRef<Target>;\n}\n\n/**\n * @name useClickOutside\n * @description - Hook to handle click events outside the specified target element(s)\n * @category Sensors\n *\n * @overload\n * @template Target The target element(s)\n * @param {Target} 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 {(node: Target) => void} A React ref to attach to the target element\n *\n * @example\n * const ref = useClickOutside<HTMLDivElement>(() => console.log('click outside'));\n */\nexport const useClickOutside = ((...params: any[]) => {\n const target = (isTarget(params[0]) ? params[0] : undefined) as UseClickOutsideTarget | 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.
|
|
1
|
+
{"version":3,"file":"useClickOutside.js","sources":["../../../../src/hooks/useClickOutside/useClickOutside.ts"],"sourcesContent":["import type { RefObject } from 'react';\n\nimport { useEffect, useRef } from 'react';\n\nimport { getElement, isTarget } from '@/utils/helpers';\n\nimport type { StateRef } from '../useRefState/useRefState';\n\nimport { useRefState } from '../useRefState/useRefState';\n\n/** The use click outside target element type */\nexport type UseClickOutsideTarget = string | Element | RefObject<Element | null | undefined>;\n\nexport interface UseClickOutside {\n <Target extends UseClickOutsideTarget>(target: Target, callback: (event: Event) => void): void;\n\n <Target extends UseClickOutsideTarget>(\n callback: (event: Event) => void,\n target?: never\n ): StateRef<Target>;\n}\n\n/**\n * @name useClickOutside\n * @description - Hook to handle click events outside the specified target element(s)\n * @category Sensors\n *\n * @overload\n * @template Target The target element(s)\n * @param {Target} 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 {(node: Target) => void} A React ref to attach to the target element\n *\n * @example\n * const ref = useClickOutside<HTMLDivElement>(() => console.log('click outside'));\n */\nexport const useClickOutside = ((...params: any[]) => {\n const target = (isTarget(params[0]) ? params[0] : undefined) as UseClickOutsideTarget | 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 const onClick = (event: Event) => {\n const element = (target ? getElement(target) : internalRef.current) as Element;\n\n if (element && !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, internalRef.state]);\n\n if (target) return;\n return internalRef;\n}) as UseClickOutside;\n"],"names":["useClickOutside","target","isTarget","arguments","length","undefined","callback","internalRef","useRefState","internalCallbackRef","useRef","current","useEffect","state","onClick","event","element","getElement","contains","document","addEventListener","removeEventListener"],"mappings":";4RA4CaA,EAAmB,WAC9B,IAAMC,EAAUC,EAAQC,UAAAC,QAAAC,OAAAA,EAAAF,cAAWA,UAAAC,eAAAC,EAAAF,UAAA,QAAeE,EAC5CC,GAAYH,UAAAC,QAAA,OAAAC,EAAAF,UAAA,IAAAA,UAAAC,QAAAC,OAAAA,EAAAF,UAAAA,GAAAA,UAAAC,QAAAC,OAAAA,EAAAF,UAA4D,GAExEI,EAAcC,IACdC,EAAsBC,EAAOJ,GAoBnC,GAnBAG,EAAoBE,QAAUL,EAE9BM,GAAU,WACR,GAAKX,GAAWM,EAAYM,MAA5B,CACA,IAAMC,EAAU,SAACC,GACf,IAAMC,EAAWf,EAASgB,EAAWhB,GAAUM,EAAYI,QAEvDK,IAAYA,EAAQE,SAASH,EAAMd,SACrCQ,EAAoBE,QAAQI,EAE/B,EAID,OAFAI,SAASC,iBAAiB,QAASN,GAE5B,WACLK,SAASE,oBAAoB,QAASP,EACvC,CAbkC,CAcpC,GAAE,CAACb,EAAQM,EAAYM,SAEpBZ,EACJ,OAAOM,CACT"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e,d as n,e as t}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
|
+
import{_ as e,d as n,e as t}from"../../_rollupPluginBabelHelpers-BQehtgCo.js";import{useState as r,useEffect as o,useCallback as a}from"react";import{usePermission as i}from"../usePermission/usePermission.js";import"../useEvent/useEvent.js";var c=function(e){return"granted"===e||"prompt"===e},u=function(e){var n=document.createElement("textarea");n.value=e,n.readOnly=!0,n.style.fontSize="16px",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)},l=function(l){var d,s="undefined"!=typeof navigator&&"clipboard"in navigator,v=r(null),p=e(v,2),m=p[0],f=p[1],x=i("clipboard-read"),b=i("clipboard-write"),y=null!==(d=null==l?void 0:l.enabled)&&void 0!==d&&d,g=function(){var e=n(t().mark((function e(){var n,r,o,a,i,u,l;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!s||!c(x.state)){e.next=8;break}return e.next=4,navigator.clipboard.readText();case 4:a=e.sent,f(a),e.next=9;break;case 8:f(null!==(n=null===(r=document)||void 0===r||null===(o=r.getSelection)||void 0===o||null===(o=o.call(r))||void 0===o?void 0:o.toString())&&void 0!==n?n:"");case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(0),f(null!==(i=null===(u=document)||void 0===u||null===(l=u.getSelection)||void 0===l||null===(l=l.call(u))||void 0===l?void 0:l.toString())&&void 0!==i?i:"");case 14:case"end":return e.stop()}}),e,null,[[0,11]])})));return function(){return e.apply(this,arguments)}}();o((function(){if(y)return document.addEventListener("copy",g),document.addEventListener("cut",g),function(){document.removeEventListener("copy",g),document.removeEventListener("cut",g)}}),[y]);var h=a(function(){var e=n(t().mark((function e(n){return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!s&&!c(b.state)){e.next=6;break}return e.next=4,navigator.clipboard.writeText(n);case 4:e.next=7;break;case 6:u(n);case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(0),u(n);case 12:f(n);case 13:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(n){return e.apply(this,arguments)}}(),[]);return{supported:s,value:m,copy:h}};export{c as isPermissionAllowed,u as legacyCopyToClipboard,l as useClipboard};
|
|
3
3
|
//# sourceMappingURL=useClipboard.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
|
+
import{_ as n}from"../../_rollupPluginBabelHelpers-BQehtgCo.js";import{useState as r}from"react";var e=function(){for(var e,t,o,u=arguments.length,i=new Array(u),a=0;a<u;a++)i[a]=arguments[a];var l="number"==typeof i[0]?i[0]:null===(e=i[0])||void 0===e?void 0:e.initialValue,m="number"==typeof i[0]?null!==(t=i[1])&&void 0!==t?t:{}:null!==(o=i[0])&&void 0!==o?o:{},f=m.max,v=void 0===f?Number.POSITIVE_INFINITY:f,p=m.min,c=void 0===p?Number.NEGATIVE_INFINITY:p,b=r(null!=l?l:0),d=n(b,2),h=d[0],I=d[1];return{value:h,set:function(n){I((function(r){return Math.max(c,Math.min(v,"number"==typeof n?n:n(r)))}))},inc:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;I((function(r){return"number"==typeof v&&r===v?r:Math.max(Math.min(v,r+n),c)}))},dec:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;I((function(r){return"number"==typeof c&&r===c?r:Math.min(Math.max(c,r-n),v)}))},reset:function(){var n=null!=l?l:0;return"number"==typeof v&&n>v?I(v):"number"==typeof c&&n<c?I(c):void I(n)}}};export{e as useCounter};
|
|
3
3
|
//# sourceMappingURL=useCounter.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{b as e,_ as t}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
|
+
import{b as e,_ as t}from"../../_rollupPluginBabelHelpers-BQehtgCo.js";import{useState as r,useEffect as o}from"react";import{getElement as n}from"../../utils/helpers/getElement.js";import{useRefState as i}from"../useRefState/useRefState.js";var l=function(){var l="object"===e(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,u=l?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],s=l?arguments.length<=2?void 0:arguments[2]:arguments.length<=1?void 0:arguments[1],v=r(null!=s?s:""),a=t(v,2),d=a[0],f=a[1],c=i(window.document.documentElement),m=function(e){var t=l?n(l):c.current;if(t&&t.style){if(!e)return t.style.removeProperty(u),void f(e);t.style.setProperty(u,e),f(e)}};return o((function(){s&&m(s)}),[]),o((function(){if(l||c.state){var e=l?n(l):c.current;if(e){var t=new MutationObserver((function(){var t,r=null===(t=window.getComputedStyle(e).getPropertyValue(u))||void 0===t?void 0:t.trim();f(null!=r?r:s)}));return t.observe(e,{attributeFilter:["style","class"]}),function(){t.disconnect()}}}}),[l,c.state]),{value:d,set:m}};export{l as useCssVar};
|
|
3
3
|
//# sourceMappingURL=useCssVar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCssVar.js","sources":["../../../../src/hooks/useCssVar/useCssVar.ts"],"sourcesContent":["import type { RefObject } from 'react';\n\nimport { useEffect, useState } from 'react';\n\nimport { getElement } from '@/utils/helpers';\n\nimport { useRefState } from '../useRefState/useRefState';\n\n/** The css variable target element type */\nexport type UseCssVarTarget =\n | (() => Element)\n | Element\n | RefObject<Element | null | undefined>\n | undefined;\n\n/** The css variable return type */\nexport interface UseCssVarReturn {\n /** The value of the CSS variable */\n value: string;\n /** Set the value of the CSS variable */\n set: (value: string) => void;\n}\n\nexport interface UseCssVar {\n (key: string, initialValue?: string): UseCssVarReturn;\n\n <Target extends UseCssVarTarget>(\n target: Target,\n key: string,\n initialValue?: string\n ): UseCssVarReturn;\n}\n\n/**\n * @name useCssVar\n * @description - Hook that returns the value of a CSS variable\n * @category Utilities\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} The object containing the value of the CSS variable\n *\n * @example\n * const { ref, value, set } = useCssVar('color', 'red');\n *\n * @overload\n * @template Target The target element\n * @param {Target} 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 } = useCssVar(ref, 'color', 'red');\n */\nexport const useCssVar = ((...params: any[]) => {\n const target = (typeof params[0] === 'object' ? params[0] : undefined) as\n | UseCssVarTarget\n | 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<Element>(window.document.documentElement);\n\n const set = (value: string) => {\n const element = (target ? getElement(target) : internalRef.current) as HTMLElement;\n if (!element) return;\n\n if (element.style) {\n if (!value) {\n element.style.removeProperty(key);\n setValue(value);\n return;\n }\n\n element.style.setProperty(key, value);\n setValue(value);\n }\n };\n\n useEffect(() => {\n if (initialValue) set(initialValue);\n }, []);\n\n useEffect(() => {\n if (!target && !internalRef) return;\n\n const element = (target ? getElement(target) : internalRef.current) as Element;\n if (!element) return;\n\n const
|
|
1
|
+
{"version":3,"file":"useCssVar.js","sources":["../../../../src/hooks/useCssVar/useCssVar.ts"],"sourcesContent":["import type { RefObject } from 'react';\n\nimport { useEffect, useState } from 'react';\n\nimport { getElement } from '@/utils/helpers';\n\nimport { useRefState } from '../useRefState/useRefState';\n\n/** The css variable target element type */\nexport type UseCssVarTarget =\n | (() => Element)\n | Element\n | RefObject<Element | null | undefined>\n | undefined;\n\n/** The css variable return type */\nexport interface UseCssVarReturn {\n /** The value of the CSS variable */\n value: string;\n /** Set the value of the CSS variable */\n set: (value: string) => void;\n}\n\nexport interface UseCssVar {\n (key: string, initialValue?: string): UseCssVarReturn;\n\n <Target extends UseCssVarTarget>(\n target: Target,\n key: string,\n initialValue?: string\n ): UseCssVarReturn;\n}\n\n/**\n * @name useCssVar\n * @description - Hook that returns the value of a CSS variable\n * @category Utilities\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} The object containing the value of the CSS variable\n *\n * @example\n * const { ref, value, set } = useCssVar('color', 'red');\n *\n * @overload\n * @template Target The target element\n * @param {Target} 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 } = useCssVar(ref, 'color', 'red');\n */\nexport const useCssVar = ((...params: any[]) => {\n const target = (typeof params[0] === 'object' ? params[0] : undefined) as\n | UseCssVarTarget\n | 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<Element>(window.document.documentElement);\n\n const set = (value: string) => {\n const element = (target ? getElement(target) : internalRef.current) as HTMLElement;\n if (!element) return;\n\n if (element.style) {\n if (!value) {\n element.style.removeProperty(key);\n setValue(value);\n return;\n }\n\n element.style.setProperty(key, value);\n setValue(value);\n }\n };\n\n useEffect(() => {\n if (initialValue) set(initialValue);\n }, []);\n\n useEffect(() => {\n if (!target && !internalRef.state) return;\n\n const element = (target ? getElement(target) : internalRef.current) as Element;\n if (!element) return;\n\n const onChange = () => {\n const value = window\n .getComputedStyle(element as Element)\n .getPropertyValue(key)\n ?.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, internalRef.state]);\n\n return {\n value,\n set\n };\n}) as UseCssVar;\n"],"names":["useCssVar","target","_typeof","arguments","length","undefined","key","initialValue","_useState","useState","_useState2","_slicedToArray","value","setValue","internalRef","useRefState","window","document","documentElement","set","element","getElement","current","style","removeProperty","setProperty","useEffect","state","observer","MutationObserver","_window$getComputedSt","getComputedStyle","getPropertyValue","trim","observe","attributeFilter","disconnect"],"mappings":";sPAwDaA,EAAa,WACxB,IAAMC,EAA+B,WAArBC,EAAAC,UAAAC,QAAAC,OAAAA,EAAAF,cAA6BA,UAAAC,eAAAC,EAAAF,UAAA,QAAeE,EAGtDC,EAAOL,EAAME,UAAAC,QAAAC,OAAAA,EAAAF,UAAA,GAAAA,UAAAC,eAAAC,EAAAF,UAAmC,GAChDI,EAAgBN,EAAME,UAAAC,QAAAC,OAAAA,EAAAF,UAAA,GAAAA,UAAAC,eAAAC,EAAAF,UAA+C,GAE3EK,EAA0BC,EAASF,QAAAA,EAAgB,IAAGG,EAAAC,EAAAH,EAAA,GAA/CI,EAAKF,EAAA,GAAEG,EAAQH,EAAA,GAChBI,EAAcC,EAAqBC,OAAOC,SAASC,iBAEnDC,EAAM,SAACP,GACX,IAAMQ,EAAWnB,EAASoB,EAAWpB,GAAUa,EAAYQ,QAC3D,GAAKF,GAEDA,EAAQG,MAAO,CACjB,IAAKX,EAGH,OAFAQ,EAAQG,MAAMC,eAAelB,QAC7BO,EAASD,GAIXQ,EAAQG,MAAME,YAAYnB,EAAKM,GAC/BC,EAASD,EACX,CACD,EA8BD,OA5BAc,GAAU,WACJnB,GAAcY,EAAIZ,EACvB,GAAE,IAEHmB,GAAU,WACR,GAAKzB,GAAWa,EAAYa,MAA5B,CAEA,IAAMP,EAAWnB,EAASoB,EAAWpB,GAAUa,EAAYQ,QAC3D,GAAKF,EAAL,CAEA,IASMQ,EAAW,IAAIC,kBATJ,WAAM,IAAAC,EACflB,EAEkBkB,QAFbA,EAAGd,OACXe,iBAAiBX,GACjBY,iBAAiB1B,cAAIwB,SAFVA,EAGVG,OAEJpB,EAASD,QAAAA,EAASL,EACnB,IAMD,OAFAqB,EAASM,QAAQd,EAAS,CAAEe,gBAAiB,CAAC,QAAS,WAEhD,WACLP,EAASQ,YACV,CAjBa,CAHqB,CAqBpC,GAAE,CAACnC,EAAQa,EAAYa,QAEjB,CACLf,MAAAA,EACAO,IAAAA,EAEJ"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{useMemo as r}from"react";import{debounce as e}from"../../utils/helpers/debounce.js";import
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
|
+
import{useMemo as r}from"react";import{debounce as e}from"../../utils/helpers/debounce.js";import{useEvent as t}from"../useEvent/useEvent.js";var o=function(o,n){var u=t(o);return r((function(){return e(u,n)}),[n])};export{o as useDebounceCallback};
|
|
3
3
|
//# sourceMappingURL=useDebounceCallback.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDebounceCallback.js","sources":["../../../../src/hooks/useDebounceCallback/useDebounceCallback.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport { debounce } from '@/utils/helpers';\n\nimport { useEvent } from '../useEvent/useEvent';\n\n/**\n * @name useDebounceCallback\n * @description - Hook that creates a debounced callback and returns a stable reference of it\n * @category Utilities\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) => {\n const internalCallback = useEvent(callback);\n const debounced = useMemo(() => debounce(internalCallback, delay), [delay]);\n\n return debounced;\n};\n"],"names":["useDebounceCallback","callback","delay","internalCallback","useEvent","useMemo","debounce"],"mappings":";
|
|
1
|
+
{"version":3,"file":"useDebounceCallback.js","sources":["../../../../src/hooks/useDebounceCallback/useDebounceCallback.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport { debounce } from '@/utils/helpers';\n\nimport { useEvent } from '../useEvent/useEvent';\n\n/**\n * @name useDebounceCallback\n * @description - Hook that creates a debounced callback and returns a stable reference of it\n * @category Utilities\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) => {\n const internalCallback = useEvent(callback);\n const debounced = useMemo(() => debounce(internalCallback, delay), [delay]);\n\n return debounced;\n};\n"],"names":["useDebounceCallback","callback","delay","internalCallback","useEvent","useMemo","debounce"],"mappings":";8IAoBO,IAAMA,EAAsB,SACjCC,EACAC,GAEA,IAAMC,EAAmBC,EAASH,GAGlC,OAFkBI,GAAQ,WAAA,OAAMC,EAASH,EAAkBD,KAAQ,CAACA,GAGtE"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-BQehtgCo.js";import{useRef as r,useState as o,useEffect as t}from"react";import{useDebounceCallback as u}from"../useDebounceCallback/useDebounceCallback.js";import"../../utils/helpers/debounce.js";import"../useEvent/useEvent.js";var n=function(n,s){var l=r(n),c=o(n),a=e(c,2),i=a[0],p=a[1],m=u(p,s);return t((function(){l.current!==n&&(m(n),l.current=n)}),[n]),i};export{n as useDebounceValue};
|
|
3
3
|
//# sourceMappingURL=useDebounceValue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDebounceValue.js","sources":["../../../../src/hooks/useDebounceValue/useDebounceValue.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\nimport { useDebounceCallback } from '../useDebounceCallback/useDebounceCallback';\n\n/**\n * @name useDebounceValue\n * @description - Hook that creates a debounced value and returns a stable reference of it\n * @category Utilities\n *\n * @template Value The type of the value\n * @param {Value} value The value to be debounced\n * @param {number} delay The delay in milliseconds\n * @returns {Value} The debounced value\n *\n * @example\n * const debouncedValue = useDebounceValue(value, 500);\n */\nexport const useDebounceValue = <Value>(value: Value, delay: number) => {\n const previousValueRef = useRef(value);\n const [debouncedValue, setDebounceValue] = useState(value);\n\n const debouncedSetState = useDebounceCallback(setDebounceValue, delay);\n\n useEffect(() => {\n if (previousValueRef.current === value) return;\n debouncedSetState(value);\n previousValueRef.current = value;\n }, [value]);\n\n return debouncedValue;\n};\n"],"names":["useDebounceValue","value","delay","previousValueRef","useRef","_useState","useState","_useState2","_slicedToArray","debouncedValue","setDebounceValue","debouncedSetState","useDebounceCallback","useEffect","current"],"mappings":";
|
|
1
|
+
{"version":3,"file":"useDebounceValue.js","sources":["../../../../src/hooks/useDebounceValue/useDebounceValue.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\nimport { useDebounceCallback } from '../useDebounceCallback/useDebounceCallback';\n\n/**\n * @name useDebounceValue\n * @description - Hook that creates a debounced value and returns a stable reference of it\n * @category Utilities\n *\n * @template Value The type of the value\n * @param {Value} value The value to be debounced\n * @param {number} delay The delay in milliseconds\n * @returns {Value} The debounced value\n *\n * @example\n * const debouncedValue = useDebounceValue(value, 500);\n */\nexport const useDebounceValue = <Value>(value: Value, delay: number) => {\n const previousValueRef = useRef(value);\n const [debouncedValue, setDebounceValue] = useState(value);\n\n const debouncedSetState = useDebounceCallback(setDebounceValue, delay);\n\n useEffect(() => {\n if (previousValueRef.current === value) return;\n debouncedSetState(value);\n previousValueRef.current = value;\n }, [value]);\n\n return debouncedValue;\n};\n"],"names":["useDebounceValue","value","delay","previousValueRef","useRef","_useState","useState","_useState2","_slicedToArray","debouncedValue","setDebounceValue","debouncedSetState","useDebounceCallback","useEffect","current"],"mappings":";wRAiBO,IAAMA,EAAmB,SAAQC,EAAcC,GACpD,IAAMC,EAAmBC,EAAOH,GAChCI,EAA2CC,EAASL,GAAMM,EAAAC,EAAAH,EAAA,GAAnDI,EAAcF,EAAA,GAAEG,EAAgBH,EAAA,GAEjCI,EAAoBC,EAAoBF,EAAkBR,GAQhE,OANAW,GAAU,WACJV,EAAiBW,UAAYb,IACjCU,EAAkBV,GAClBE,EAAiBW,QAAUb,EAC7B,GAAG,CAACA,IAEGQ,CACT"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-BQehtgCo.js";import{useState as l}from"react";var o=function(o,e){var t=l(o),a=r(t,2),n=a[0];return[null==n?e:n,a[1]]};export{o as useDefault};
|
|
3
3
|
//# sourceMappingURL=useDefault.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as l,c as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
|
+
import{_ as l,c as n}from"../../_rollupPluginBabelHelpers-BQehtgCo.js";import{useState as a,useRef as e,useEffect as t}from"react";import{throttle as i}from"../../utils/helpers/throttle.js";var r=function(r){var o,c,u=null===(o=null==r?void 0:r.enabled)||void 0===o||o,v=null!==(c=null==r?void 0:r.delay)&&void 0!==c?c:1e3,d=a({interval:0,rotationRate:{alpha:null,beta:null,gamma:null},acceleration:{x:null,y:null,z:null},accelerationIncludingGravity:{x:null,y:null,z:null}}),m=l(d,2),s=m[0],f=m[1],p=e(null==r?void 0:r.callback);return p.current=null==r?void 0:r.callback,t((function(){if(u){var l=i((function(l){var a;null===(a=p.current)||void 0===a||a.call(p,l),f({interval:l.interval,rotationRate:n(n({},s.rotationRate),l.rotationRate),acceleration:n(n({},s.acceleration),l.acceleration),accelerationIncludingGravity:n(n({},s.accelerationIncludingGravity),l.accelerationIncludingGravity)})}),v);return window.addEventListener("devicemotion",l),function(){window.removeEventListener("devicemotion",l)}}}),[v,u]),s};export{r as useDeviceMotion};
|
|
3
3
|
//# sourceMappingURL=useDeviceMotion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDeviceMotion.js","sources":["../../../../src/hooks/useDeviceMotion/useDeviceMotion.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\nimport { throttle } from '@/utils/helpers';\n\nexport interface UseDeviceMotionReturn {\n acceleration: DeviceMotionEventAcceleration;\n accelerationIncludingGravity: DeviceMotionEventAcceleration;\n interval: DeviceMotionEvent['interval'];\n rotationRate: DeviceMotionEventRotationRate;\n}\n\nexport interface UseDeviceMotionParams {\n /** The delay in milliseconds */\n delay?: number;\n /** Whether to enable the hook */\n enabled?: boolean;\n /** The callback function to be invoked */\n callback?: (event: DeviceMotionEvent) => void;\n}\n\n/**\n * @name useDeviceMotion\n * @description - Hook that work with device motion\n * @category Utilities\n *\n * @param {number} [delay=1000] The delay in milliseconds\n * @param {(event: DeviceMotionEvent) => void} [callback] The callback function to be invoked\n * @param {boolean} [enabled=true] Whether to enable the hook\n * @returns {UseDeviceMotionReturn} The device motion data and interval\n *\n * @example\n * const { interval, rotationRate, acceleration, accelerationIncludingGravity } = useDeviceMotion();\n */\nexport const useDeviceMotion = (params?: UseDeviceMotionParams) => {\n const enabled = params?.enabled ?? true;\n const delay = params?.delay ?? 1000;\n const [value, setValue] = useState<UseDeviceMotionReturn>({\n interval: 0,\n rotationRate: { alpha: null, beta: null, gamma: null },\n acceleration: { x: null, y: null, z: null },\n accelerationIncludingGravity: { x: null, y: null, z: null }\n });\n const internalCallbackRef = useRef(params?.callback);\n internalCallbackRef.current = params?.callback;\n\n useEffect(() => {\n if (!enabled) return;\n\n const onDeviceMotion = throttle<[DeviceMotionEvent]>((event) => {\n internalCallbackRef.current?.(event);\n setValue({\n interval: event.interval,\n rotationRate: {\n ...value.rotationRate,\n ...event.rotationRate\n },\n acceleration: {\n ...value.acceleration,\n ...event.acceleration\n },\n accelerationIncludingGravity: {\n ...value.accelerationIncludingGravity,\n ...event.accelerationIncludingGravity\n }\n });\n }, delay);\n\n window.addEventListener('devicemotion', onDeviceMotion);\n\n return () => {\n window.removeEventListener('devicemotion', onDeviceMotion);\n };\n }, [delay, enabled]);\n\n return value;\n};\n"],"names":["useDeviceMotion","params","_params$enabled","_params$delay","enabled","delay","_useState","useState","interval","rotationRate","alpha","beta","gamma","acceleration","x","y","z","accelerationIncludingGravity","_useState2","_slicedToArray","value","setValue","internalCallbackRef","useRef","callback","current","useEffect","onDeviceMotion","throttle","event","_internalCallbackRef$","call","_objectSpread","window","addEventListener","removeEventListener"],"mappings":";
|
|
1
|
+
{"version":3,"file":"useDeviceMotion.js","sources":["../../../../src/hooks/useDeviceMotion/useDeviceMotion.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\nimport { throttle } from '@/utils/helpers';\n\nexport interface UseDeviceMotionReturn {\n acceleration: DeviceMotionEventAcceleration;\n accelerationIncludingGravity: DeviceMotionEventAcceleration;\n interval: DeviceMotionEvent['interval'];\n rotationRate: DeviceMotionEventRotationRate;\n}\n\nexport interface UseDeviceMotionParams {\n /** The delay in milliseconds */\n delay?: number;\n /** Whether to enable the hook */\n enabled?: boolean;\n /** The callback function to be invoked */\n callback?: (event: DeviceMotionEvent) => void;\n}\n\n/**\n * @name useDeviceMotion\n * @description - Hook that work with device motion\n * @category Utilities\n *\n * @param {number} [delay=1000] The delay in milliseconds\n * @param {(event: DeviceMotionEvent) => void} [callback] The callback function to be invoked\n * @param {boolean} [enabled=true] Whether to enable the hook\n * @returns {UseDeviceMotionReturn} The device motion data and interval\n *\n * @example\n * const { interval, rotationRate, acceleration, accelerationIncludingGravity } = useDeviceMotion();\n */\nexport const useDeviceMotion = (params?: UseDeviceMotionParams) => {\n const enabled = params?.enabled ?? true;\n const delay = params?.delay ?? 1000;\n const [value, setValue] = useState<UseDeviceMotionReturn>({\n interval: 0,\n rotationRate: { alpha: null, beta: null, gamma: null },\n acceleration: { x: null, y: null, z: null },\n accelerationIncludingGravity: { x: null, y: null, z: null }\n });\n const internalCallbackRef = useRef(params?.callback);\n internalCallbackRef.current = params?.callback;\n\n useEffect(() => {\n if (!enabled) return;\n\n const onDeviceMotion = throttle<[DeviceMotionEvent]>((event) => {\n internalCallbackRef.current?.(event);\n setValue({\n interval: event.interval,\n rotationRate: {\n ...value.rotationRate,\n ...event.rotationRate\n },\n acceleration: {\n ...value.acceleration,\n ...event.acceleration\n },\n accelerationIncludingGravity: {\n ...value.accelerationIncludingGravity,\n ...event.accelerationIncludingGravity\n }\n });\n }, delay);\n\n window.addEventListener('devicemotion', onDeviceMotion);\n\n return () => {\n window.removeEventListener('devicemotion', onDeviceMotion);\n };\n }, [delay, enabled]);\n\n return value;\n};\n"],"names":["useDeviceMotion","params","_params$enabled","_params$delay","enabled","delay","_useState","useState","interval","rotationRate","alpha","beta","gamma","acceleration","x","y","z","accelerationIncludingGravity","_useState2","_slicedToArray","value","setValue","internalCallbackRef","useRef","callback","current","useEffect","onDeviceMotion","throttle","event","_internalCallbackRef$","call","_objectSpread","window","addEventListener","removeEventListener"],"mappings":";kMAiCaA,EAAkB,SAACC,GAAmC,IAAAC,EAAAC,EAC3DC,EAAyBF,QAAlBA,EAAGD,aAAM,EAANA,EAAQG,eAAOF,IAAAA,GAAAA,EACzBG,EAAqBF,QAAhBA,EAAGF,aAAM,EAANA,EAAQI,aAAKF,IAAAA,EAAAA,EAAI,IAC/BG,EAA0BC,EAAgC,CACxDC,SAAU,EACVC,aAAc,CAAEC,MAAO,KAAMC,KAAM,KAAMC,MAAO,MAChDC,aAAc,CAAEC,EAAG,KAAMC,EAAG,KAAMC,EAAG,MACrCC,6BAA8B,CAAEH,EAAG,KAAMC,EAAG,KAAMC,EAAG,QACrDE,EAAAC,EAAAb,EAAA,GALKc,EAAKF,EAAA,GAAEG,EAAQH,EAAA,GAMhBI,EAAsBC,EAAOtB,aAAAA,EAAAA,EAAQuB,UAgC3C,OA/BAF,EAAoBG,QAAUxB,aAAM,EAANA,EAAQuB,SAEtCE,GAAU,WACR,GAAKtB,EAAL,CAEA,IAAMuB,EAAiBC,GAA8B,SAACC,GAAU,IAAAC,EACnCA,QAA3BA,EAAAR,EAAoBG,eAApBK,IAA2BA,GAA3BA,EAAAC,KAAAT,EAA8BO,GAC9BR,EAAS,CACPb,SAAUqB,EAAMrB,SAChBC,aAAYuB,EAAAA,EACPZ,CAAAA,EAAAA,EAAMX,cACNoB,EAAMpB,cAEXI,aAAYmB,EAAAA,EACPZ,CAAAA,EAAAA,EAAMP,cACNgB,EAAMhB,cAEXI,6BAA4Be,EAAAA,EAAA,CAAA,EACvBZ,EAAMH,8BACNY,EAAMZ,+BAGd,GAAEZ,GAIH,OAFA4B,OAAOC,iBAAiB,eAAgBP,GAEjC,WACLM,OAAOE,oBAAoB,eAAgBR,EAC5C,CAzBa,CA0BhB,GAAG,CAACtB,EAAOD,IAEJgB,CACT"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-BQehtgCo.js";import{useState as n,useEffect as t}from"react";var a=function(){var a="undefined"!=typeof window&&"DeviceOrientationEvent"in window,i=n({alpha:null,beta:null,gamma:null,absolute:!1}),o=e(i,2),r=o[0],l=o[1];return t((function(){if(a){var e=function(e){return l({alpha:e.alpha,beta:e.beta,gamma:e.gamma,absolute:e.absolute})};return window.addEventListener("deviceorientation",e),function(){window.removeEventListener("deviceorientation",e)}}}),[]),{supported:a,value:r}};export{a as useDeviceOrientation};
|
|
3
3
|
//# sourceMappingURL=useDeviceOrientation.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-BQehtgCo.js";import{useState as i,useEffect as n}from"react";var o=function(){var o,t="undefined"!=typeof window&&"function"==typeof window.matchMedia&&"number"==typeof window.devicePixelRatio,r=i(null!==(o=window.devicePixelRatio)&&void 0!==o?o:1),d=e(r,2),a=d[0],c=d[1];return n((function(){if(t){var e=function(){return c(window.devicePixelRatio)},i=window.matchMedia("(resolution: ".concat(window.devicePixelRatio,"dppx)"));return i.addEventListener("change",e),function(){i.removeEventListener("change",e)}}}),[a]),{supported:t,ratio:a}};export{o as useDevicePixelRatio};
|
|
3
3
|
//# sourceMappingURL=useDevicePixelRatio.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDevicePixelRatio.js","sources":["../../../../src/hooks/useDevicePixelRatio/useDevicePixelRatio.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/** The use device pixel ratio return type */\nexport interface UseDevicePixelRatioReturn {\n /** The ratio of the resolution in physical pixels to the resolution in CSS pixels */\n ratio: number;\n /** Whether the device pixel ratio is supported*/\n supported: boolean;\n}\n\n/**\n * @name useDevicePixelRatio\n * @description - Hook that returns the ratio of the resolution in physical pixels to the resolution in CSS pixels for the current display device\n * @category Utilities\n *\n * @returns {UseDevicePixelRatioReturn} The ratio and supported flag\n *\n * @example\n * const { supported, ratio } = useDevicePixelRatio();\n */\nexport const useDevicePixelRatio = (): UseDevicePixelRatioReturn => {\n const supported =\n typeof window !== 'undefined' &&\n typeof window.matchMedia === 'function' &&\n typeof window.devicePixelRatio === 'number';\n\n const [ratio, setRatio] = useState<number>(window.devicePixelRatio ?? 1);\n\n useEffect(() => {\n if (!supported) return;\n\n const
|
|
1
|
+
{"version":3,"file":"useDevicePixelRatio.js","sources":["../../../../src/hooks/useDevicePixelRatio/useDevicePixelRatio.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/** The use device pixel ratio return type */\nexport interface UseDevicePixelRatioReturn {\n /** The ratio of the resolution in physical pixels to the resolution in CSS pixels */\n ratio: number;\n /** Whether the device pixel ratio is supported*/\n supported: boolean;\n}\n\n/**\n * @name useDevicePixelRatio\n * @description - Hook that returns the ratio of the resolution in physical pixels to the resolution in CSS pixels for the current display device\n * @category Utilities\n *\n * @returns {UseDevicePixelRatioReturn} The ratio and supported flag\n *\n * @example\n * const { supported, ratio } = useDevicePixelRatio();\n */\nexport const useDevicePixelRatio = (): UseDevicePixelRatioReturn => {\n const supported =\n typeof window !== 'undefined' &&\n typeof window.matchMedia === 'function' &&\n typeof window.devicePixelRatio === 'number';\n\n const [ratio, setRatio] = useState<number>(window.devicePixelRatio ?? 1);\n\n useEffect(() => {\n if (!supported) return;\n\n const onChange = () => setRatio(window.devicePixelRatio);\n\n const media = window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);\n media.addEventListener('change', onChange);\n return () => {\n media.removeEventListener('change', onChange);\n };\n }, [ratio]);\n\n return { supported, ratio };\n};\n"],"names":["useDevicePixelRatio","_window$devicePixelRa","supported","window","matchMedia","devicePixelRatio","_useState","useState","_useState2","_slicedToArray","ratio","setRatio","useEffect","onChange","media","concat","addEventListener","removeEventListener"],"mappings":";oHAoBaA,EAAsB,WAAiC,IAAAC,EAC5DC,EACc,oBAAXC,QACsB,mBAAtBA,OAAOC,YACqB,iBAA5BD,OAAOE,iBAEhBC,EAA0BC,UAAQN,EAASE,OAAOE,wBAAgB,IAAAJ,EAAAA,EAAI,GAAEO,EAAAC,EAAAH,EAAA,GAAjEI,EAAKF,EAAA,GAAEG,EAAQH,EAAA,GActB,OAZAI,GAAU,WACR,GAAKV,EAAL,CAEA,IAAMW,EAAW,WAAH,OAASF,EAASR,OAAOE,iBAAiB,EAElDS,EAAQX,OAAOC,WAAU,gBAAAW,OAAiBZ,OAAOE,iBAAgB,UAEvE,OADAS,EAAME,iBAAiB,SAAUH,GAC1B,WACLC,EAAMG,oBAAoB,SAAUJ,EACrC,CARe,CASlB,GAAG,CAACH,IAEG,CAAER,UAAAA,EAAWQ,MAAAA,EACtB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{useRef as r}from"react";import{useIsomorphicLayoutEffect as
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
|
+
import{useRef as r}from"react";import{useIsomorphicLayoutEffect as o}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var t=function(t,f){var c=r(!0);o((function(){if(!c.current){var r=t();return r&&"function"==typeof r?r:void 0}c.current=!1}),f)};export{t as useDidUpdate};
|
|
3
3
|
//# sourceMappingURL=useDidUpdate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDidUpdate.js","sources":["../../../../src/hooks/useDidUpdate/useDidUpdate.ts"],"sourcesContent":["import type { DependencyList, EffectCallback } from 'react';\n\nimport { useRef } from 'react';\n\nimport { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect';\n\n/**\n * @name useDidUpdate\n * @description – Hook that behaves like useEffect, but skips the effect on the initial render\n * @category Lifecycle\n *\n * @param {EffectCallback} effect The effect callback\n * @param {DependencyList} [deps] The dependencies list for the effect\n *\n * @example\n * useDidUpdate(() => console.log('Won't be called when mounted'), [deps]);\n */\nexport const useDidUpdate = (effect: EffectCallback, deps?: DependencyList) => {\n const initialRender = useRef(true);\n\n useIsomorphicLayoutEffect(() => {\n if (initialRender.current) {\n initialRender.current = false;\n return;\n }\n\n const effectReturns = effect();\n if (effectReturns && typeof effectReturns === 'function') {\n return effectReturns;\n }\n }, deps);\n};\n"],"names":["useDidUpdate","effect","deps","initialRender","useRef","useIsomorphicLayoutEffect","current","effectReturns"],"mappings":";
|
|
1
|
+
{"version":3,"file":"useDidUpdate.js","sources":["../../../../src/hooks/useDidUpdate/useDidUpdate.ts"],"sourcesContent":["import type { DependencyList, EffectCallback } from 'react';\n\nimport { useRef } from 'react';\n\nimport { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect';\n\n/**\n * @name useDidUpdate\n * @description – Hook that behaves like useEffect, but skips the effect on the initial render\n * @category Lifecycle\n *\n * @param {EffectCallback} effect The effect callback\n * @param {DependencyList} [deps] The dependencies list for the effect\n *\n * @example\n * useDidUpdate(() => console.log('Won't be called when mounted'), [deps]);\n */\nexport const useDidUpdate = (effect: EffectCallback, deps?: DependencyList) => {\n const initialRender = useRef(true);\n\n useIsomorphicLayoutEffect(() => {\n if (initialRender.current) {\n initialRender.current = false;\n return;\n }\n\n const effectReturns = effect();\n if (effectReturns && typeof effectReturns === 'function') {\n return effectReturns;\n }\n }, deps);\n};\n"],"names":["useDidUpdate","effect","deps","initialRender","useRef","useIsomorphicLayoutEffect","current","effectReturns"],"mappings":";qIAiBO,IAAMA,EAAe,SAACC,EAAwBC,GACnD,IAAMC,EAAgBC,GAAO,GAE7BC,GAA0B,WACxB,IAAIF,EAAcG,QAAlB,CAKA,IAAMC,EAAgBN,IACtB,OAAIM,GAA0C,mBAAlBA,EACnBA,OADT,CAHA,CAFEJ,EAAcG,SAAU,CAQ3B,GAAEJ,EACL"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
|
+
import{_ as n}from"../../_rollupPluginBabelHelpers-BQehtgCo.js";import{useState as r}from"react";var o=function(){var o=arguments.length>1?arguments[1]:void 0,l=r(arguments.length>0&&void 0!==arguments[0]&&arguments[0]),e=n(l,2),t=e[0],u=e[1],i=function(){return u((function(n){var r;return n||(null==o||null===(r=o.onOpen)||void 0===r||r.call(o),!0)}))},c=function(){return u((function(n){var r;return n?(null==o||null===(r=o.onClose)||void 0===r||r.call(o),!1):n}))};return{opened:t,open:i,close:c,toggle:function(){return t?c():i()}}};export{o as useDisclosure};
|
|
3
3
|
//# sourceMappingURL=useDisclosure.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
|
+
import{_ as e,d as r,e as t}from"../../_rollupPluginBabelHelpers-BQehtgCo.js";import{useState as n,useRef as i,useEffect as a}from"react";import{getElement as u}from"../../utils/helpers/getElement.js";import{isTarget as o}from"../../utils/helpers/isTarget.js";import{useRefState as s}from"../useRefState/useRefState.js";var c=function(){var c,l="undefined"!=typeof navigator&&"mediaDevices"in navigator&&!!navigator.mediaDevices&&"getDisplayMedia"in navigator.mediaDevices,d=o(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,p=(arguments.length<=1?void 0:arguments[1])?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],f=null!==(c=null==p?void 0:p.enabled)&&void 0!==c&&c,v=n(!1),g=e(v,2),m=g[0],h=g[1],b=i(null),j=s(),D=function(){if(b.current&&l){var e=d?u(d):j.current;e&&(h(!1),e.srcObject=null,b.current.getTracks().forEach((function(e){return e.stop()})),b.current=null)}},k=function(){var e=r(t().mark((function e(){var r,n;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(l){e.next=2;break}return e.abrupt("return");case 2:if(r=d?u(d):j.current){e.next=5;break}return e.abrupt("return");case 5:return e.next=7,navigator.mediaDevices.getDisplayMedia({video:null==p?void 0:p.video,audio:null==p?void 0:p.audio});case 7:return n=e.sent,h(!0),b.current=n,r.srcObject=n,n.getTracks().forEach((function(e){return e.onended=D})),e.abrupt("return",n);case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return a((function(){if(l&&f&&((d||j.state)&&(d?u(d):j.current)))return k(),function(){D()}}),[d,j.state]),d?{stream:b.current,sharing:m,supported:l,start:k,stop:D}:{stream:b.current,sharing:m,supported:l,start:k,stop:D,ref:j}};export{c as useDisplayMedia};
|
|
3
|
+
//# sourceMappingURL=useDisplayMedia.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDisplayMedia.js","sources":["../../../../src/hooks/useDisplayMedia/useDisplayMedia.ts"],"sourcesContent":["import type { RefObject } from 'react';\n\nimport { useEffect, useRef, useState } from 'react';\n\nimport { getElement, isTarget } from '@/utils/helpers';\n\nimport type { StateRef } from '../useRefState/useRefState';\n\nimport { useRefState } from '../useRefState/useRefState';\n\n/** The use display media return type */\nexport interface UseDisplayMediaReturn {\n /** Whether screen sharing is currently active */\n sharing: boolean;\n /** The media stream object */\n stream: MediaStream | null;\n /** Whether the display media API is supported */\n supported: boolean;\n /** Start screen sharing */\n start: () => Promise<void>;\n /** Stop screen sharing */\n stop: () => void;\n}\n\n/** The use display media options type */\nexport interface UseDisplayMediaOptions {\n /** Whether to enable audio sharing */\n audio?: boolean | MediaTrackConstraints;\n /** Whether to start immediately */\n enabled?: boolean;\n /** Whether to enable video sharing */\n video?: boolean | MediaTrackConstraints;\n}\n\n/** The use display media target type */\nexport type UseDisplayMediaTarget =\n | string\n | HTMLVideoElement\n | RefObject<HTMLVideoElement | null | undefined>;\n\nexport interface UseDisplayMediaOverload {\n <Target extends UseDisplayMediaTarget>(\n target: Target,\n options?: UseDisplayMediaOptions\n ): UseDisplayMediaReturn;\n\n <Target extends UseDisplayMediaTarget = HTMLVideoElement>(\n options?: UseDisplayMediaOptions,\n target?: Target\n ): { ref: StateRef<Target> } & UseDisplayMediaReturn;\n}\n\n/**\n * @name useDisplayMedia\n * @description - Hook that provides screen sharing functionality using the Display Media API\n * @category Browser\n *\n * @overload\n * @template Target The target video element\n * @param {Target} target The target video element to display the media stream\n * @param {boolean | MediaTrackConstraints} [options.audio] Whether to enable audio sharing\n * @param {boolean} [options.enabled=false] Whether to start immediately\n * @param {boolean | MediaTrackConstraints} [options.video] Whether to enable video sharing\n * @returns {UseDisplayMediaReturn} Object containing stream, sharing status and control methods\n *\n * @example\n * const { stream, sharing, start, stop } = useDisplayMedia(ref);\n *\n * @overload\n * @template Target The target video element\n * @param {boolean | MediaTrackConstraints} [options.audio] Whether to enable audio sharing\n * @param {boolean} [options.enabled=false] Whether to start immediately\n * @param {boolean | MediaTrackConstraints} [options.video] Whether to enable video sharing\n * @returns {UseDisplayMediaReturn & { ref: StateRef<HTMLVideoElement> }} Object containing stream, sharing status, control methods and ref\n *\n * @example\n * const { ref, stream, sharing, start, stop } = useDisplayMedia<HTMLVideoElement>();\n */\nexport const useDisplayMedia = ((...params: any[]) => {\n const supported =\n typeof navigator !== 'undefined' &&\n 'mediaDevices' in navigator &&\n !!navigator.mediaDevices &&\n 'getDisplayMedia' in navigator.mediaDevices;\n const target = (isTarget(params[0]) ? params[0] : undefined) as UseDisplayMediaTarget | undefined;\n const options = (params[1] ? params[1] : params[0]) as UseDisplayMediaOptions | undefined;\n const enabled = options?.enabled ?? false;\n\n const [sharing, setSharing] = useState(false);\n\n const streamRef = useRef<MediaStream | null>(null);\n const internalRef = useRefState<Element>();\n\n const stop = () => {\n if (!streamRef.current || !supported) return;\n\n const element = (target ? getElement(target) : internalRef.current) as HTMLVideoElement;\n if (!element) return;\n\n setSharing(false);\n element.srcObject = null;\n streamRef.current.getTracks().forEach((track) => track.stop());\n streamRef.current = null;\n };\n\n const start = async () => {\n if (!supported) return;\n\n const element = (target ? getElement(target) : internalRef.current) as HTMLVideoElement;\n if (!element) return;\n\n const displayMedia = await navigator.mediaDevices.getDisplayMedia({\n video: options?.video,\n audio: options?.audio\n });\n\n setSharing(true);\n streamRef.current = displayMedia;\n element.srcObject = displayMedia;\n\n displayMedia.getTracks().forEach((track) => (track.onended = stop));\n return displayMedia;\n };\n\n useEffect(() => {\n if (!supported || !enabled) return;\n if (!target && !internalRef.state) return;\n\n const element = (target ? getElement(target) : internalRef.current) as HTMLVideoElement;\n if (!element) return;\n\n start();\n\n return () => {\n stop();\n };\n }, [target, internalRef.state]);\n\n if (target)\n return {\n stream: streamRef.current,\n sharing,\n supported,\n start,\n stop\n };\n\n return {\n stream: streamRef.current,\n sharing,\n supported,\n start,\n stop,\n ref: internalRef\n };\n}) as UseDisplayMediaOverload;\n"],"names":["useDisplayMedia","_options$enabled","supported","navigator","mediaDevices","target","isTarget","arguments","length","undefined","options","enabled","_useState","useState","_useState2","_slicedToArray","sharing","setSharing","streamRef","useRef","internalRef","useRefState","stop","current","element","getElement","srcObject","getTracks","forEach","track","start","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","displayMedia","wrap","_context","prev","next","abrupt","getDisplayMedia","video","audio","sent","onended","apply","this","useEffect","state","stream","ref"],"mappings":";oUA8EaA,EAAmB,WAAsB,IAAAC,EAC9CC,EACiB,oBAAdC,WACP,iBAAkBA,aAChBA,UAAUC,cACZ,oBAAqBD,UAAUC,aAC3BC,EAAUC,EAAQC,UAAAC,QAAAC,OAAAA,EAAAF,cAAWA,UAAAC,eAAAC,EAAAF,UAAA,QAAeE,EAC5CC,GAAWH,UAAAC,QAAA,OAAAC,EAAAF,UAAA,IAAAA,UAAAC,QAAAC,OAAAA,EAAAF,UAAAA,GAAAA,UAAAC,QAAAC,OAAAA,EAAAF,UAAwE,GACnFI,EAA0BV,QAAnBA,EAAGS,aAAO,EAAPA,EAASC,eAAOV,IAAAA,GAAAA,EAEhCW,EAA8BC,GAAS,GAAMC,EAAAC,EAAAH,EAAA,GAAtCI,EAAOF,EAAA,GAAEG,EAAUH,EAAA,GAEpBI,EAAYC,EAA2B,MACvCC,EAAcC,IAEdC,EAAO,WACX,GAAKJ,EAAUK,SAAYrB,EAA3B,CAEA,IAAMsB,EAAWnB,EAASoB,EAAWpB,GAAUe,EAAYG,QACtDC,IAELP,GAAW,GACXO,EAAQE,UAAY,KACpBR,EAAUK,QAAQI,YAAYC,SAAQ,SAACC,GAAK,OAAKA,EAAMP,UACvDJ,EAAUK,QAAU,KARkB,CASvC,EAEKO,EAAK,WAAA,IAAAC,EAAAC,EAAAC,IAAAC,MAAG,SAAAC,IAAA,IAAAX,EAAAY,EAAA,OAAAH,IAAAI,MAAA,SAAAC,GAAA,cAAAA,EAAAC,KAAAD,EAAAE,MAAA,KAAA,EAAA,GACPtC,EAAS,CAAAoC,EAAAE,KAAA,EAAA,KAAA,CAAA,OAAAF,EAAAG,OAAA,UAAA,KAAA,EAEoD,GAA5DjB,EAAWnB,EAASoB,EAAWpB,GAAUe,EAAYG,QAC/C,CAAAe,EAAAE,KAAA,EAAA,KAAA,CAAA,OAAAF,EAAAG,OAAA,UAAA,KAAA,EAAA,OAAAH,EAAAE,KAAA,EAEerC,UAAUC,aAAasC,gBAAgB,CAChEC,MAAOjC,aAAAA,EAAAA,EAASiC,MAChBC,MAAOlC,aAAO,EAAPA,EAASkC,QAChB,KAAA,EAMkE,OAT9DR,EAAYE,EAAAO,KAKlB5B,GAAW,GACXC,EAAUK,QAAUa,EACpBZ,EAAQE,UAAYU,EAEpBA,EAAaT,YAAYC,SAAQ,SAACC,GAAK,OAAMA,EAAMiB,QAAUxB,CAAI,IAAGgB,EAAAG,OAAA,SAC7DL,GAAY,KAAA,GAAA,IAAA,MAAA,OAAAE,EAAAhB,OAAA,GAAAa,OACpB,OAAA,WAjBU,OAAAJ,EAAAgB,MAAAC,KAAAzC,UAAA,EAAA,GAiCX,OAdA0C,GAAU,WACR,GAAK/C,GAAcS,KACdN,GAAWe,EAAY8B,SAEX7C,EAASoB,EAAWpB,GAAUe,EAAYG,UAK3D,OAFAO,IAEO,WACLR,GACD,CACF,GAAE,CAACjB,EAAQe,EAAY8B,QAEpB7C,EACK,CACL8C,OAAQjC,EAAUK,QAClBP,QAAAA,EACAd,UAAAA,EACA4B,MAAAA,EACAR,KAAAA,GAGG,CACL6B,OAAQjC,EAAUK,QAClBP,QAAAA,EACAd,UAAAA,EACA4B,MAAAA,EACAR,KAAAA,EACA8B,IAAKhC,EAET"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{useEventListener as e}from"../useEventListener/useEventListener.js";import"react";import"../../utils/helpers/getElement.js";import"
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
|
+
import{useEventListener as e}from"../useEventListener/useEventListener.js";import"react";import"../../utils/helpers/getElement.js";import"../useEvent/useEvent.js";import"../useRefState/useRefState.js";import"../../_rollupPluginBabelHelpers-BQehtgCo.js";var t=function(t,r,s){return e(document,t,r,s)};export{t as useDocumentEvent};
|
|
3
3
|
//# sourceMappingURL=useDocumentEvent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentEvent.js","sources":["../../../../src/hooks/useDocumentEvent/useDocumentEvent.ts"],"sourcesContent":["import type { UseEventListenerOptions } from '../useEventListener/useEventListener';\n\nimport { useEventListener } from '../useEventListener/useEventListener';\n\n/**\n * @name useDocumentEvent\n * @description - Hook attaches an event listener to the document object for the specified event\n * @category Browser\n *\n * @template Event Key of document event map.\n * @param {Event} event The event to listen for.\n * @param {(event: DocumentEventMap[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 * useDocumentEvent('click', () => console.log('clicked'));\n */\nexport const useDocumentEvent = <Event extends keyof DocumentEventMap>(\n event: Event,\n listener: (this: Document, event: DocumentEventMap[Event]) => any,\n options?: UseEventListenerOptions\n) => useEventListener(document, event, listener, options);\n"],"names":["useDocumentEvent","event","listener","options","useEventListener","document"],"mappings":";
|
|
1
|
+
{"version":3,"file":"useDocumentEvent.js","sources":["../../../../src/hooks/useDocumentEvent/useDocumentEvent.ts"],"sourcesContent":["import type { UseEventListenerOptions } from '../useEventListener/useEventListener';\n\nimport { useEventListener } from '../useEventListener/useEventListener';\n\n/**\n * @name useDocumentEvent\n * @description - Hook attaches an event listener to the document object for the specified event\n * @category Browser\n *\n * @template Event Key of document event map.\n * @param {Event} event The event to listen for.\n * @param {(event: DocumentEventMap[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 * useDocumentEvent('click', () => console.log('clicked'));\n */\nexport const useDocumentEvent = <Event extends keyof DocumentEventMap>(\n event: Event,\n listener: (this: Document, event: DocumentEventMap[Event]) => any,\n options?: UseEventListenerOptions\n) => useEventListener(document, event, listener, options);\n"],"names":["useDocumentEvent","event","listener","options","useEventListener","document"],"mappings":";6PAkBO,IAAMA,EAAmB,SAC9BC,EACAC,EACAC,GAAiC,OAC9BC,EAAiBC,SAAUJ,EAAOC,EAAUC,EAAQ"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as t}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
|
+
import{_ as t}from"../../_rollupPluginBabelHelpers-BQehtgCo.js";import{useRef as e,useState as n,useEffect as o}from"react";import{useIsomorphicLayoutEffect as r}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";function u(u,i){var c=e(document.title),l=n(null!=u?u:document.title),f=t(l,2),m=f[0],s=f[1],d=function(t){var e=t.trim();e.length>0&&(document.title=e)};return r((function(){"string"==typeof u&&d(u)}),[u]),r((function(){var t=new MutationObserver((function(){s((function(t){return document&&document.title!==t?document.title:t}))}));return t.observe(document.head.querySelector("title"),{childList:!0}),function(){t.disconnect()}}),[]),o((function(){if(null!=i&&i.restoreOnUnmount)return function(){document.title=c.current}}),[]),[m,d]}export{u as useDocumentTitle};
|
|
3
3
|
//# sourceMappingURL=useDocumentTitle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentTitle.js","sources":["../../../../src/hooks/useDocumentTitle/useDocumentTitle.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\nimport { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect';\n\n/** The use document title options type */\nexport interface UseDocumentTitleOptions {\n /** Restore the previous title on unmount */\n restoreOnUnmount?: boolean;\n}\n\n/** The use document title return type */\nexport type UseDocumentTitleReturn = [\n /** The current title */\n title: string,\n\n /** Function to update the title */\n setTitle: (title: string) => void\n];\n\n/**\n * @name useDocumentTitle\n * @description - Hook that manages the document title and allows updating it\n * @category Browser\n *\n * @param {string} [value] The initial title. If not provided, the current document title will be used\n * @param {boolean} [options.restoreOnUnmount] Restore the previous title on unmount\n * @returns {UseDocumentTitleReturn} An array containing the current title and a function to update the title\n *\n * @example\n * const [title, setTitle] = useDocumentTitle();\n */\nexport function useDocumentTitle(\n value?: string,\n options?: UseDocumentTitleOptions\n): UseDocumentTitleReturn {\n const prevTitleRef = useRef(document.title);\n const [title, setTitle] = useState(value ?? document.title);\n\n const set = (value: string) => {\n const updatedValue = value.trim();\n if (updatedValue.length > 0) document.title = updatedValue;\n };\n\n useIsomorphicLayoutEffect(() => {\n if (typeof value !== 'string') return;\n set(value);\n }, [value]);\n\n useIsomorphicLayoutEffect(() => {\n const observer = new MutationObserver(() => {\n setTitle((prevTitle) => {\n if (document && document.title !== prevTitle) {\n return document.title;\n }\n return prevTitle;\n });\n });\n\n observer.observe(document.head.querySelector('title')!, { childList: true });\n\n return () => {\n observer.disconnect();\n };\n }, []);\n\n useEffect(() => {\n if (options?.restoreOnUnmount) {\n return () => {\n document.title = prevTitleRef.current;\n };\n }\n }, []);\n\n return [title, set];\n}\n"],"names":["useDocumentTitle","value","options","prevTitleRef","useRef","document","title","_useState","useState","_useState2","_slicedToArray","setTitle","set","updatedValue","trim","length","useIsomorphicLayoutEffect","observer","MutationObserver","prevTitle","observe","head","querySelector","childList","disconnect","useEffect","restoreOnUnmount","current"],"mappings":";
|
|
1
|
+
{"version":3,"file":"useDocumentTitle.js","sources":["../../../../src/hooks/useDocumentTitle/useDocumentTitle.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\nimport { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect';\n\n/** The use document title options type */\nexport interface UseDocumentTitleOptions {\n /** Restore the previous title on unmount */\n restoreOnUnmount?: boolean;\n}\n\n/** The use document title return type */\nexport type UseDocumentTitleReturn = [\n /** The current title */\n title: string,\n\n /** Function to update the title */\n setTitle: (title: string) => void\n];\n\n/**\n * @name useDocumentTitle\n * @description - Hook that manages the document title and allows updating it\n * @category Browser\n *\n * @param {string} [value] The initial title. If not provided, the current document title will be used\n * @param {boolean} [options.restoreOnUnmount] Restore the previous title on unmount\n * @returns {UseDocumentTitleReturn} An array containing the current title and a function to update the title\n *\n * @example\n * const [title, setTitle] = useDocumentTitle();\n */\nexport function useDocumentTitle(\n value?: string,\n options?: UseDocumentTitleOptions\n): UseDocumentTitleReturn {\n const prevTitleRef = useRef(document.title);\n const [title, setTitle] = useState(value ?? document.title);\n\n const set = (value: string) => {\n const updatedValue = value.trim();\n if (updatedValue.length > 0) document.title = updatedValue;\n };\n\n useIsomorphicLayoutEffect(() => {\n if (typeof value !== 'string') return;\n set(value);\n }, [value]);\n\n useIsomorphicLayoutEffect(() => {\n const observer = new MutationObserver(() => {\n setTitle((prevTitle) => {\n if (document && document.title !== prevTitle) {\n return document.title;\n }\n return prevTitle;\n });\n });\n\n observer.observe(document.head.querySelector('title')!, { childList: true });\n\n return () => {\n observer.disconnect();\n };\n }, []);\n\n useEffect(() => {\n if (options?.restoreOnUnmount) {\n return () => {\n document.title = prevTitleRef.current;\n };\n }\n }, []);\n\n return [title, set];\n}\n"],"names":["useDocumentTitle","value","options","prevTitleRef","useRef","document","title","_useState","useState","_useState2","_slicedToArray","setTitle","set","updatedValue","trim","length","useIsomorphicLayoutEffect","observer","MutationObserver","prevTitle","observe","head","querySelector","childList","disconnect","useEffect","restoreOnUnmount","current"],"mappings":";kOA+BO,SAASA,EACdC,EACAC,GAEA,IAAMC,EAAeC,EAAOC,SAASC,OACrCC,EAA0BC,EAASP,QAAAA,EAASI,SAASC,OAAMG,EAAAC,EAAAH,EAAA,GAApDD,EAAKG,EAAA,GAAEE,EAAQF,EAAA,GAEhBG,EAAM,SAACX,GACX,IAAMY,EAAeZ,EAAMa,OACvBD,EAAaE,OAAS,IAAGV,SAASC,MAAQO,EAC/C,EAgCD,OA9BAG,GAA0B,WACH,iBAAVf,GACXW,EAAIX,EACN,GAAG,CAACA,IAEJe,GAA0B,WACxB,IAAMC,EAAW,IAAIC,kBAAiB,WACpCP,GAAS,SAACQ,GACR,OAAId,UAAYA,SAASC,QAAUa,EAC1Bd,SAASC,MAEXa,CACT,GACF,IAIA,OAFAF,EAASG,QAAQf,SAASgB,KAAKC,cAAc,SAAW,CAAEC,WAAW,IAE9D,WACLN,EAASO,YACV,CACF,GAAE,IAEHC,GAAU,WACR,GAAIvB,SAAAA,EAASwB,iBACX,OAAO,WACLrB,SAASC,MAAQH,EAAawB,OAC/B,CAEJ,GAAE,IAEI,CAACrB,EAAOM,EACjB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.93 */
|
|
2
2
|
import{useSyncExternalStore as n}from"react";var t=function(){return document.visibilityState},e=function(){return"hidden"},i=function(n){return document.addEventListener("visibilitychange",n),function(){document.removeEventListener("visibilitychange",n)}},r=function(){return n(i,t,e)};export{r as useDocumentVisibility};
|
|
3
3
|
//# sourceMappingURL=useDocumentVisibility.js.map
|