@siberiacancode/reactuse 0.0.110 → 0.0.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{_rollupPluginBabelHelpers-DKsIEDlz.js → _rollupPluginBabelHelpers-COP1ZJjT.js} +2 -2
- package/dist/cjs/_rollupPluginBabelHelpers-COP1ZJjT.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/useBluetooth/useBluetooth.js +2 -2
- package/dist/cjs/hooks/useBoolean/useBoolean.js +2 -2
- package/dist/cjs/hooks/useBreakpoints/useBreakpoints.js +2 -2
- package/dist/cjs/hooks/useBrowserLanguage/useBrowserLanguage.js +1 -1
- package/dist/cjs/hooks/useClickOutside/useClickOutside.js +2 -2
- package/dist/cjs/hooks/useClipboard/useClipboard.js +2 -2
- package/dist/cjs/hooks/useConst/useConst.js +2 -2
- package/dist/cjs/hooks/useConst/useConst.js.map +1 -1
- package/dist/cjs/hooks/useCookie/useCookie.js +2 -2
- package/dist/cjs/hooks/useCookie/useCookie.js.map +1 -1
- package/dist/cjs/hooks/useCookies/useCookies.js +2 -2
- package/dist/cjs/hooks/useCopy/useCopy.js +2 -2
- package/dist/cjs/hooks/useCounter/useCounter.js +2 -2
- package/dist/cjs/hooks/useCssVar/useCssVar.js +2 -2
- package/dist/cjs/hooks/useDebounceCallback/useDebounceCallback.js +1 -1
- package/dist/cjs/hooks/useDebounceValue/useDebounceValue.js +2 -2
- package/dist/cjs/hooks/useDefault/useDefault.js +2 -2
- package/dist/cjs/hooks/useDeviceMotion/useDeviceMotion.js +2 -2
- package/dist/cjs/hooks/useDeviceOrientation/useDeviceOrientation.js +2 -2
- package/dist/cjs/hooks/useDevicePixelRatio/useDevicePixelRatio.js +2 -2
- package/dist/cjs/hooks/useDidUpdate/useDidUpdate.js +1 -1
- 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 +2 -2
- package/dist/cjs/hooks/useDocumentEvent/useDocumentEvent.js +2 -2
- package/dist/cjs/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
- package/dist/cjs/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
- package/dist/cjs/hooks/useElementSize/useElementSize.js +2 -2
- package/dist/cjs/hooks/useEvent/useEvent.js +1 -1
- package/dist/cjs/hooks/useEventListener/useEventListener.js +2 -2
- package/dist/cjs/hooks/useEyeDropper/useEyeDropper.js +2 -2
- package/dist/cjs/hooks/useFavicon/useFavicon.js +2 -2
- package/dist/cjs/hooks/useField/useField.js +2 -2
- package/dist/cjs/hooks/useFileDialog/useFileDialog.js +2 -2
- package/dist/cjs/hooks/useFocus/useFocus.js +2 -2
- package/dist/cjs/hooks/useFps/useFps.js +2 -2
- package/dist/cjs/hooks/useFul/useFul.js +1 -1
- package/dist/cjs/hooks/useFullscreen/useFullscreen.js +2 -2
- 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/useHover/useHover.js +2 -2
- package/dist/cjs/hooks/useIdle/useIdle.js +2 -2
- package/dist/cjs/hooks/useImage/useImage.js +2 -2
- package/dist/cjs/hooks/useInfiniteScroll/useInfiniteScroll.js +2 -2
- package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -2
- package/dist/cjs/hooks/useInterval/useInterval.js +2 -2
- package/dist/cjs/hooks/useIsFirstRender/useIsFirstRender.js +1 -1
- package/dist/cjs/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +1 -1
- package/dist/cjs/hooks/useKeyPress/useKeyPress.js +2 -2
- package/dist/cjs/hooks/useKeyPressEvent/useKeyPressEvent.js +2 -2
- package/dist/cjs/hooks/useKeyboard/useKeyboard.js +2 -2
- package/dist/cjs/hooks/useKeysPressed/useKeysPressed.js +2 -2
- package/dist/cjs/hooks/useLastChanged/useLastChanged.js +2 -2
- package/dist/cjs/hooks/useLatest/useLatest.js +1 -1
- package/dist/cjs/hooks/useLess/useLess.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/useLockCallback/useLockCallback.js +2 -2
- package/dist/cjs/hooks/useLogger/useLogger.js +2 -2
- package/dist/cjs/hooks/useLongPress/useLongPress.js +2 -2
- package/dist/cjs/hooks/useMap/useMap.js +2 -2
- package/dist/cjs/hooks/useMeasure/useMeasure.js +2 -2
- package/dist/cjs/hooks/useMediaQuery/useMediaQuery.js +1 -1
- package/dist/cjs/hooks/useMemory/useMemory.js +2 -2
- package/dist/cjs/hooks/useMount/useMount.js +1 -1
- package/dist/cjs/hooks/useMouse/useMouse.js +2 -2
- package/dist/cjs/hooks/useMutation/useMutation.js +2 -2
- package/dist/cjs/hooks/useMutationObserver/useMutationObserver.js +2 -2
- package/dist/cjs/hooks/useNetwork/useNetwork.js +2 -2
- package/dist/cjs/hooks/useOffsetPagination/useOffsetPagination.js +2 -2
- package/dist/cjs/hooks/useOnce/useOnce.js +3 -0
- package/dist/cjs/hooks/useOnce/useOnce.js.map +1 -0
- package/dist/cjs/hooks/useOnline/useOnline.js +1 -1
- package/dist/cjs/hooks/useOperatingSystem/useOperatingSystem.js +2 -2
- package/dist/cjs/hooks/useOptimistic/useOptimistic.js +2 -2
- package/dist/cjs/hooks/useOrientation/useOrientation.js +2 -2
- package/dist/cjs/hooks/useOtpCredential/useOtpCredential.js +2 -2
- package/dist/cjs/hooks/useOtpCredential/useOtpCredential.js.map +1 -1
- package/dist/cjs/hooks/usePageLeave/usePageLeave.js +2 -2
- package/dist/cjs/hooks/usePaint/usePaint.js +2 -2
- package/dist/cjs/hooks/useParallax/useParallax.js +2 -2
- package/dist/cjs/hooks/usePerformanceObserver/usePerformanceObserver.js +2 -2
- 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/useRafValue/useRafValue.js +2 -2
- package/dist/cjs/hooks/useRefState/useRefState.js +2 -2
- package/dist/cjs/hooks/useRenderCount/useRenderCount.js +1 -1
- package/dist/cjs/hooks/useRenderInfo/useRenderInfo.js +1 -1
- package/dist/cjs/hooks/useRerender/useRerender.js +1 -1
- package/dist/cjs/hooks/useResizeObserver/useResizeObserver.js +2 -2
- 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/useScrollIntoView/useScrollIntoView.js +2 -2
- package/dist/cjs/hooks/useScrollTo/useScrollTo.js +2 -2
- 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/useStateHistory/useStateHistory.js +2 -2
- package/dist/cjs/hooks/useStep/useStep.js +2 -2
- package/dist/cjs/hooks/useSticky/useSticky.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/useTextSelection/useTextSelection.js +2 -2
- package/dist/cjs/hooks/useThrottleCallback/useThrottleCallback.js +1 -1
- package/dist/cjs/hooks/useThrottleValue/useThrottleValue.js +2 -2
- package/dist/cjs/hooks/useTime/useTime.js +2 -2
- package/dist/cjs/hooks/useTimeout/useTimeout.js +2 -2
- package/dist/cjs/hooks/useTimer/useTimer.js +2 -2
- package/dist/cjs/hooks/useToggle/useToggle.js +2 -2
- package/dist/cjs/hooks/useToggle/useToggle.js.map +1 -1
- package/dist/cjs/hooks/useUnmount/useUnmount.js +1 -1
- package/dist/cjs/hooks/useVibrate/useVibrate.js +2 -2
- package/dist/cjs/hooks/useWebSocket/useWebSocket.js +2 -2
- package/dist/cjs/hooks/useWindowEvent/useWindowEvent.js +2 -2
- package/dist/cjs/hooks/useWindowFocus/useWindowFocus.js +2 -2
- package/dist/cjs/hooks/useWindowScroll/useWindowScroll.js +2 -2
- package/dist/cjs/hooks/useWindowSize/useWindowSize.js +2 -2
- package/dist/cjs/hooks/useWizard/useWizard.js +2 -2
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/utils/helpers/copy.js +2 -2
- package/dist/cjs/utils/helpers/debounce.js +1 -1
- package/dist/cjs/utils/helpers/getDate.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/throttle.js +1 -1
- package/dist/esm/{_rollupPluginBabelHelpers-DKjgZxmU.js → _rollupPluginBabelHelpers-DoUxcpfK.js} +2 -2
- package/dist/esm/_rollupPluginBabelHelpers-DoUxcpfK.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/useBluetooth/useBluetooth.js +2 -2
- package/dist/esm/hooks/useBoolean/useBoolean.js +2 -2
- package/dist/esm/hooks/useBreakpoints/useBreakpoints.js +2 -2
- package/dist/esm/hooks/useBrowserLanguage/useBrowserLanguage.js +1 -1
- package/dist/esm/hooks/useClickOutside/useClickOutside.js +2 -2
- package/dist/esm/hooks/useClipboard/useClipboard.js +2 -2
- package/dist/esm/hooks/useConst/useConst.js +2 -2
- package/dist/esm/hooks/useConst/useConst.js.map +1 -1
- package/dist/esm/hooks/useCookie/useCookie.js +2 -2
- package/dist/esm/hooks/useCookie/useCookie.js.map +1 -1
- package/dist/esm/hooks/useCookies/useCookies.js +2 -2
- package/dist/esm/hooks/useCopy/useCopy.js +2 -2
- package/dist/esm/hooks/useCounter/useCounter.js +2 -2
- package/dist/esm/hooks/useCssVar/useCssVar.js +2 -2
- package/dist/esm/hooks/useDebounceCallback/useDebounceCallback.js +1 -1
- package/dist/esm/hooks/useDebounceValue/useDebounceValue.js +2 -2
- package/dist/esm/hooks/useDefault/useDefault.js +2 -2
- package/dist/esm/hooks/useDeviceMotion/useDeviceMotion.js +2 -2
- package/dist/esm/hooks/useDeviceOrientation/useDeviceOrientation.js +2 -2
- package/dist/esm/hooks/useDevicePixelRatio/useDevicePixelRatio.js +2 -2
- package/dist/esm/hooks/useDidUpdate/useDidUpdate.js +1 -1
- 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 +2 -2
- package/dist/esm/hooks/useDocumentEvent/useDocumentEvent.js +2 -2
- package/dist/esm/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
- package/dist/esm/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
- package/dist/esm/hooks/useElementSize/useElementSize.js +2 -2
- package/dist/esm/hooks/useEvent/useEvent.js +1 -1
- package/dist/esm/hooks/useEventListener/useEventListener.js +2 -2
- package/dist/esm/hooks/useEyeDropper/useEyeDropper.js +2 -2
- package/dist/esm/hooks/useFavicon/useFavicon.js +2 -2
- package/dist/esm/hooks/useField/useField.js +2 -2
- package/dist/esm/hooks/useFileDialog/useFileDialog.js +2 -2
- package/dist/esm/hooks/useFocus/useFocus.js +2 -2
- package/dist/esm/hooks/useFps/useFps.js +2 -2
- package/dist/esm/hooks/useFul/useFul.js +1 -1
- package/dist/esm/hooks/useFullscreen/useFullscreen.js +2 -2
- 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/useHover/useHover.js +2 -2
- package/dist/esm/hooks/useIdle/useIdle.js +2 -2
- package/dist/esm/hooks/useImage/useImage.js +2 -2
- package/dist/esm/hooks/useInfiniteScroll/useInfiniteScroll.js +2 -2
- package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -2
- package/dist/esm/hooks/useInterval/useInterval.js +2 -2
- package/dist/esm/hooks/useIsFirstRender/useIsFirstRender.js +1 -1
- package/dist/esm/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +1 -1
- package/dist/esm/hooks/useKeyPress/useKeyPress.js +2 -2
- package/dist/esm/hooks/useKeyPressEvent/useKeyPressEvent.js +2 -2
- package/dist/esm/hooks/useKeyboard/useKeyboard.js +2 -2
- package/dist/esm/hooks/useKeysPressed/useKeysPressed.js +2 -2
- package/dist/esm/hooks/useLastChanged/useLastChanged.js +2 -2
- package/dist/esm/hooks/useLatest/useLatest.js +1 -1
- package/dist/esm/hooks/useLess/useLess.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/useLockCallback/useLockCallback.js +2 -2
- package/dist/esm/hooks/useLogger/useLogger.js +2 -2
- package/dist/esm/hooks/useLongPress/useLongPress.js +2 -2
- package/dist/esm/hooks/useMap/useMap.js +2 -2
- package/dist/esm/hooks/useMeasure/useMeasure.js +2 -2
- package/dist/esm/hooks/useMediaQuery/useMediaQuery.js +1 -1
- package/dist/esm/hooks/useMemory/useMemory.js +2 -2
- package/dist/esm/hooks/useMount/useMount.js +1 -1
- package/dist/esm/hooks/useMouse/useMouse.js +2 -2
- package/dist/esm/hooks/useMutation/useMutation.js +2 -2
- package/dist/esm/hooks/useMutationObserver/useMutationObserver.js +2 -2
- package/dist/esm/hooks/useNetwork/useNetwork.js +2 -2
- package/dist/esm/hooks/useOffsetPagination/useOffsetPagination.js +2 -2
- package/dist/esm/hooks/useOnce/useOnce.js +3 -0
- package/dist/esm/hooks/useOnce/useOnce.js.map +1 -0
- package/dist/esm/hooks/useOnline/useOnline.js +1 -1
- package/dist/esm/hooks/useOperatingSystem/useOperatingSystem.js +2 -2
- package/dist/esm/hooks/useOptimistic/useOptimistic.js +2 -2
- package/dist/esm/hooks/useOrientation/useOrientation.js +2 -2
- package/dist/esm/hooks/useOtpCredential/useOtpCredential.js +2 -2
- package/dist/esm/hooks/useOtpCredential/useOtpCredential.js.map +1 -1
- package/dist/esm/hooks/usePageLeave/usePageLeave.js +2 -2
- package/dist/esm/hooks/usePaint/usePaint.js +2 -2
- package/dist/esm/hooks/useParallax/useParallax.js +2 -2
- package/dist/esm/hooks/usePerformanceObserver/usePerformanceObserver.js +2 -2
- 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/useRafValue/useRafValue.js +2 -2
- package/dist/esm/hooks/useRefState/useRefState.js +2 -2
- package/dist/esm/hooks/useRenderCount/useRenderCount.js +1 -1
- package/dist/esm/hooks/useRenderInfo/useRenderInfo.js +1 -1
- package/dist/esm/hooks/useRerender/useRerender.js +1 -1
- package/dist/esm/hooks/useResizeObserver/useResizeObserver.js +2 -2
- 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/useScrollIntoView/useScrollIntoView.js +2 -2
- package/dist/esm/hooks/useScrollTo/useScrollTo.js +2 -2
- 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/useStateHistory/useStateHistory.js +2 -2
- package/dist/esm/hooks/useStep/useStep.js +2 -2
- package/dist/esm/hooks/useSticky/useSticky.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/useTextSelection/useTextSelection.js +2 -2
- package/dist/esm/hooks/useThrottleCallback/useThrottleCallback.js +1 -1
- package/dist/esm/hooks/useThrottleValue/useThrottleValue.js +2 -2
- package/dist/esm/hooks/useTime/useTime.js +2 -2
- package/dist/esm/hooks/useTimeout/useTimeout.js +2 -2
- package/dist/esm/hooks/useTimer/useTimer.js +2 -2
- package/dist/esm/hooks/useToggle/useToggle.js +2 -2
- package/dist/esm/hooks/useToggle/useToggle.js.map +1 -1
- package/dist/esm/hooks/useUnmount/useUnmount.js +1 -1
- package/dist/esm/hooks/useVibrate/useVibrate.js +2 -2
- package/dist/esm/hooks/useWebSocket/useWebSocket.js +2 -2
- package/dist/esm/hooks/useWindowEvent/useWindowEvent.js +2 -2
- package/dist/esm/hooks/useWindowFocus/useWindowFocus.js +2 -2
- package/dist/esm/hooks/useWindowScroll/useWindowScroll.js +2 -2
- package/dist/esm/hooks/useWindowSize/useWindowSize.js +2 -2
- package/dist/esm/hooks/useWizard/useWizard.js +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/utils/helpers/copy.js +2 -2
- package/dist/esm/utils/helpers/debounce.js +1 -1
- package/dist/esm/utils/helpers/getDate.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/throttle.js +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +8 -8
- package/dist/cjs/_rollupPluginBabelHelpers-DKsIEDlz.js.map +0 -1
- package/dist/esm/_rollupPluginBabelHelpers-DKjgZxmU.js.map +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r,d as l,c as n,e as o}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as r,d as l,c as n,e as o}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as u}from"react";var e=function(e,t){var i=u(!1),v=r(i,2),a=v[0],d=v[1],c=u(!1),s=r(c,2),y=s[0],f=s[1],p=u(!1),m=r(p,2),D=m[0],E=m[1],S=u(null),h=r(S,2),b=h[0],g=h[1],w=u(null),x=r(w,2),_=x[0],j=x[1],k=function(r,l){var o;d(!0);var u=null!==(o=null==l?void 0:l.attempt)&&void 0!==o?o:0;return e(r).then((function(r){var n;return null==l||null===(n=l.onSuccess)||void 0===n||n.call(l,r),j(r),E(!0),d(!1),g(null),f(!1),r})).catch((function(o){var e,t="function"==typeof(null==l?void 0:l.retry)?null==l?void 0:l.retry(u,o):null==l?void 0:l.retry,i="function"==typeof(null==l?void 0:l.retryDelay)?null==l?void 0:l.retryDelay(u,o):null==l?void 0:l.retryDelay;return"boolean"==typeof t&&t||t&&t>u?i?void setTimeout((function(){return k(r,n(n({},l),{},{attempt:u+1}))}),i):k(r,n(n({},l),{},{attempt:u+1})):(null==l||null===(e=l.onError)||void 0===e||e.call(l,o),j(null),E(!1),d(!1),g(o),void f(!0))}))},A=function(){var r=l(o().mark((function r(l,n){var u,e,i,v,a;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return a={retry:null!==(u=null==n?void 0:n.retry)&&void 0!==u?u:null==t?void 0:t.retry,retryDelay:null!==(e=null==n?void 0:n.retryDelay)&&void 0!==e?e:null==t?void 0:t.retryDelay,onSuccess:null!==(i=null==n?void 0:n.onSuccess)&&void 0!==i?i:null==t?void 0:t.onSuccess,onError:null!==(v=null==n?void 0:n.onError)&&void 0!==v?v:null==t?void 0:t.onError},r.abrupt("return",k(l,a));case 2:case"end":return r.stop()}}),r)})));return function(l,n){return r.apply(this,arguments)}}();return{data:_,error:b,mutate:function(r,l){var n,o,u,e,i={retry:null!==(n=null==l?void 0:l.retry)&&void 0!==n?n:null==t?void 0:t.retry,retryDelay:null!==(o=null==l?void 0:l.retryDelay)&&void 0!==o?o:null==t?void 0:t.retryDelay,onSuccess:null!==(u=null==l?void 0:l.onSuccess)&&void 0!==u?u:null==t?void 0:t.onSuccess,onError:null!==(e=null==l?void 0:l.onError)&&void 0!==e?e:null==t?void 0:t.onError};k(r,i)},mutateAsync:A,isLoading:a,isError:y,isSuccess:D}};export{e as useMutation};
|
|
3
3
|
//# sourceMappingURL=useMutation.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as r,useRef as t,useEffect as n}from"react";import{getElement as o}from"../../utils/helpers/getElement.js";import{isTarget as i}from"../../utils/helpers/isTarget.js";import{useRefState as l}from"../useRefState/useRefState.js";var u=function(){var u,s=i(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,v=s?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],a=s?arguments.length<=2?void 0:arguments[2]:arguments.length<=1?void 0:arguments[1],c=r(),d=e(c,2),f=d[0],m=d[1],p=null===(u=null==a?void 0:a.enabled)||void 0===u||u,g=l(window.document.documentElement),h=t(v);h.current=v;var b=t(a);b.current=a,n((function(){if(p||s||g.state){var e=s?o(s):g.current;if(e){var r=new MutationObserver(h.current);return m(r),r.observe(e,b.current),function(){r.disconnect()}}}}),[s,g.state]);var j=function(){return null==f?void 0:f.disconnect()};return s?{stop:j,observer:f}:{ref:g,stop:j,observer:f}};export{u as useMutationObserver};
|
|
3
3
|
//# sourceMappingURL=useMutationObserver.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as n}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as e,useEffect as i}from"react";var o=function(){var n,e,i;return(null===(n=navigator)||void 0===n?void 0:n.connection)||(null===(e=navigator)||void 0===e?void 0:e.mozConnection)||(null===(i=navigator)||void 0===i?void 0:i.webkitConnection)},t=function(){var t=e((function(){if("undefined"==typeof navigator)return{online:!1,type:void 0,effectiveType:void 0,saveData:!1,downlink:0,downlinkMax:0,rtt:0};var n=navigator.onLine,e=o();return{online:n,downlink:null==e?void 0:e.downlink,downlinkMax:null==e?void 0:e.downlinkMax,effectiveType:null==e?void 0:e.effectiveType,rtt:null==e?void 0:e.rtt,saveData:null==e?void 0:e.saveData,type:null==e?void 0:e.type}})),v=n(t,2),l=v[0],a=v[1];return i((function(){var n=function(){var n=navigator.onLine,e=o();a({online:n,downlink:null==e?void 0:e.downlink,downlinkMax:null==e?void 0:e.downlinkMax,effectiveType:null==e?void 0:e.effectiveType,rtt:null==e?void 0:e.rtt,saveData:null==e?void 0:e.saveData,type:null==e?void 0:e.type})};window.addEventListener("online",n,{passive:!0}),window.addEventListener("offline",n,{passive:!0});var e=o();return e&&e.addEventListener("change",n,{passive:!0}),function(){window.removeEventListener("online",n),window.removeEventListener("offline",n),e&&e.removeEventListener("change",n)}})),l};export{o as getConnection,t as useNetwork};
|
|
3
3
|
//# sourceMappingURL=useNetwork.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as n,useRef as a,useEffect as i}from"react";var r=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=r.total,o=void 0===t?Number.POSITIVE_INFINITY:t,g=r.pageSize,u=void 0===g?10:g,p=r.initialPage,c=void 0===p?1:p,f=r.onPageChange,v=void 0===f?function(){}:f,S=r.onPageCountChange,z=void 0===S?function(){}:S,l=r.onPageSizeChange,P=void 0===l?function(){}:l,s=n(c),d=e(s,2),h=d[0],m=d[1],C=a(v),I=a(z),x=a(P);C.current=v,I.current=z,x.current=P;var N=Math.max(1,Math.ceil(o/u)),_=1===h,b=h===N;return i((function(){I.current({page:h,pageSize:u})}),[N]),i((function(){x.current({page:h,pageSize:u})}),[u]),{page:h,set:function(e){m(e),v({page:e,pageSize:u})},currentPageSize:u,isFirstPage:_,isLastPage:b,pageCount:N,next:function(){if(b)return v({page:N,pageSize:u});m((function(e){var n=e+1;return v({page:n,pageSize:u}),n}))},prev:function(){if(_)return v({page:1,pageSize:u});m((function(e){var n=e-1;return v({page:n,pageSize:u}),n}))}}};export{r as useOffsetPagination};
|
|
3
3
|
//# sourceMappingURL=useOffsetPagination.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{useRef as r,useEffect as n}from"react";function t(t){var c=r(),u=r(!1),e=r(!1);u.current&&(e.current=!0),n((function(){if(!u.current)return u.current=!0,c.current=t(),function(){e.current&&"function"==typeof c.current&&c.current()}}),[])}export{t as useOnce};
|
|
3
|
+
//# sourceMappingURL=useOnce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOnce.js","sources":["../../../../src/hooks/useOnce/useOnce.ts"],"sourcesContent":["import type { EffectCallback } from 'react';\n\nimport { useEffect, useRef } from 'react';\n\n/**\n * @name useEffectOnce\n * @description - Hook that runs an effect only once. Please do not use it in production code!\n * @category Humor\n *\n * @warning - This hook run only once, but it will not run twice in strict mode. Please do not use it in production code!\n *\n * @param {EffectCallback} effect The effect to run\n *\n * @example\n * useOnce(() => console.log('effect once'));\n */\nexport function useOnce(effect: EffectCallback) {\n const cleanupRef = useRef<ReturnType<EffectCallback>>();\n const hasRunRef = useRef(false);\n const hasRenderedAfterRun = useRef(false);\n\n if (hasRunRef.current) {\n hasRenderedAfterRun.current = true;\n }\n\n useEffect(() => {\n if (hasRunRef.current) return;\n\n hasRunRef.current = true;\n cleanupRef.current = effect();\n\n return () => {\n if (!hasRenderedAfterRun.current) return;\n\n if (typeof cleanupRef.current === 'function') {\n cleanupRef.current();\n }\n };\n }, []);\n}\n"],"names":["useOnce","effect","cleanupRef","useRef","hasRunRef","hasRenderedAfterRun","current","useEffect"],"mappings":";8CAgBO,SAASA,EAAQC,GACtB,IAAMC,EAAaC,IACbC,EAAYD,GAAO,GACnBE,EAAsBF,GAAO,GAE/BC,EAAUE,UACZD,EAAoBC,SAAU,GAGhCC,GAAU,WACR,IAAIH,EAAUE,QAKd,OAHAF,EAAUE,SAAU,EACpBJ,EAAWI,QAAUL,IAEd,WACAI,EAAoBC,SAES,mBAAvBJ,EAAWI,SACpBJ,EAAWI,SAEd,CACF,GAAE,GACL"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
2
|
import{useSyncExternalStore as n}from"react";var e=function(){return navigator.onLine},t=function(){return!1},i=function(n){return window.addEventListener("online",n),window.addEventListener("offline",n),function(){window.removeEventListener("online",n),window.removeEventListener("offline",n)}},o=function(){return n(i,e,t)};export{o as useOnline};
|
|
3
3
|
//# sourceMappingURL=useOnline.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as i}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as i}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as n}from"react";var e=function(){if("undefined"==typeof window)return"undetermined";var i=window.navigator.userAgent;return/Macintosh|MacIntel|MacPPC|Mac68K/i.test(i)?"macos":/iPhone|iPad|iPod/i.test(i)?"ios":/Win32|Win64|Windows|WinCE/i.test(i)?"windows":/Android/i.test(i)?"android":/Linux/i.test(i)?"linux":"undetermined"},t=function(){var t=n(e());return i(t,1)[0]};export{e as getOperatingSystem,t as useOperatingSystem};
|
|
3
3
|
//# sourceMappingURL=useOperatingSystem.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as t,useRef as o}from"react";import{useDidUpdate as e}from"../useDidUpdate/useDidUpdate.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var u=function(u,n){var i=t(u),f=r(i,2),c=f[0],a=f[1],p=o(n);p.current=n;var s=t(!1),m=r(s,2),l=m[0],d=m[1];e((function(){l&&(a(u),d(!1))}),[l]);return[c,function(r,t){return a((function(t){return p.current(t,r)})),t.finally((function(){return d(!0)}))}]};export{u as useOptimistic};
|
|
3
3
|
//# sourceMappingURL=useOptimistic.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as n}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as e,useEffect as r}from"react";var t=function(){var t=e({angle:0,type:"landscape-primary"}),o=n(t,2),i=o[0],a=o[1];return r((function(){var n=function(){return a(window.screen.orientation)};return window.screen.orientation.addEventListener("change",n),function(){window.screen.orientation.removeEventListener("change",n)}}),[]),i};export{t as useOrientation};
|
|
3
3
|
//# sourceMappingURL=useOrientation.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r,d as n,e as t}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as r,d as n,e as t}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as e,useRef as o}from"react";var a=function(){for(var a,u,i=arguments.length,l=new Array(i),c=0;c<i;c++)l[c]=arguments[c];var s="function"==typeof l[0]?l[0]:null===(a=l[0])||void 0===a?void 0:a.onSuccess,p="function"==typeof l[0]?null===(u=l[0])||void 0===u?void 0:u.onError:void 0,f="undefined"!=typeof navigator&&"OTPCredential"in window,v=e(!1),d=r(v,2),b=d[0],g=d[1],w=o(new AbortController),m=function(){var r=n(t().mark((function r(){var n;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(f){r.next=2;break}return r.abrupt("return");case 2:return w.current=new AbortController,r.prev=3,r.next=6,navigator.credentials.get({otp:{transport:["sms"]},signal:w.current.signal});case 6:return n=r.sent,null==s||s(n),g(!1),r.abrupt("return",n);case 12:r.prev=12,r.t0=r.catch(3),null==p||p(r.t0);case 15:case"end":return r.stop()}}),r,null,[[3,12]])})));return function(){return r.apply(this,arguments)}}();return{supported:f,abort:function(){w.current.abort(),w.current=new AbortController,w.current.signal.onabort=function(){return g(!0)}},aborted:b,get:m}};export{a as useOtpCredential};
|
|
3
3
|
//# sourceMappingURL=useOtpCredential.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOtpCredential.js","sources":["../../../../src/hooks/useOtpCredential/useOtpCredential.ts"],"sourcesContent":["import { useRef, useState } from 'react';\n\ndeclare global {\n interface OTPOptions {\n readonly transport: string[];\n }\n\n interface CredentialRequestOptions {\n readonly otp: OTPOptions;\n }\n\n interface Credential {\n readonly code: string;\n }\n}\n\n/* The use otp credential callback type */\nexport type UseOtpCredentialCallback = (otp: Credential | null) => void;\n\n/* The use otp credential options type */\nexport interface UseOtpCredentialParams {\n /* The callback function to be invoked on error */\n onError: (error: any) => void;\n /* The callback function to be invoked on success */\n onSuccess: (credential: Credential | null) => void;\n}\n\n/* The use otp credential return type */\nexport interface UseOtpCredentialReturn {\n /* The abort function */\n abort: AbortController['abort'];\n /* The aborted state of the query */\n aborted: boolean;\n /* The supported state of the otp credential */\n supported: boolean;\n /* The get otp credential function */\n get: () => Promise<Credential | null>;\n}\n\nexport interface UseOtpCredential {\n (callback?: UseOtpCredentialCallback): UseOtpCredentialReturn;\n\n (params?: UseOtpCredentialParams): UseOtpCredentialReturn;\n}\n\n/**\n * @name useOtpCredential\n * @description - Hook that creates an otp credential\n * @category Browser\n *\n * @browserapi navigator.credentials https://developer.mozilla.org/en-US/docs/Web/API/Navigator/credentials\n *\n * @overload\n * @param {UseOtpCredentialCallback} callback The callback function to be invoked\n * @returns {UseOtpCredentialReturn}\n *\n * @example\n * useOtpCredential((credential) => console.log(credential));\n *\n * @overload\n * @param {UseOtpCredentialCallback} params.onSuccess The callback function to be invoked on success\n * @param {UseOtpCredentialCallback} params.onError The callback function to be invoked on error\n * @returns {UseOtpCredentialReturn}\n *\n * @example\n * useOtpCredential({ onSuccess: (credential) => console.log(credential), onError: (error) => console.log(error) });\n */\nexport const useOtpCredential = ((...params: any[]) => {\n const onSuccess =\n params[0]
|
|
1
|
+
{"version":3,"file":"useOtpCredential.js","sources":["../../../../src/hooks/useOtpCredential/useOtpCredential.ts"],"sourcesContent":["import { useRef, useState } from 'react';\n\ndeclare global {\n interface OTPOptions {\n readonly transport: string[];\n }\n\n interface CredentialRequestOptions {\n readonly otp: OTPOptions;\n }\n\n interface Credential {\n readonly code: string;\n }\n}\n\n/* The use otp credential callback type */\nexport type UseOtpCredentialCallback = (otp: Credential | null) => void;\n\n/* The use otp credential options type */\nexport interface UseOtpCredentialParams {\n /* The callback function to be invoked on error */\n onError: (error: any) => void;\n /* The callback function to be invoked on success */\n onSuccess: (credential: Credential | null) => void;\n}\n\n/* The use otp credential return type */\nexport interface UseOtpCredentialReturn {\n /* The abort function */\n abort: AbortController['abort'];\n /* The aborted state of the query */\n aborted: boolean;\n /* The supported state of the otp credential */\n supported: boolean;\n /* The get otp credential function */\n get: () => Promise<Credential | null>;\n}\n\nexport interface UseOtpCredential {\n (callback?: UseOtpCredentialCallback): UseOtpCredentialReturn;\n\n (params?: UseOtpCredentialParams): UseOtpCredentialReturn;\n}\n\n/**\n * @name useOtpCredential\n * @description - Hook that creates an otp credential\n * @category Browser\n *\n * @browserapi navigator.credentials https://developer.mozilla.org/en-US/docs/Web/API/Navigator/credentials\n *\n * @overload\n * @param {UseOtpCredentialCallback} callback The callback function to be invoked\n * @returns {UseOtpCredentialReturn}\n *\n * @example\n * useOtpCredential((credential) => console.log(credential));\n *\n * @overload\n * @param {UseOtpCredentialCallback} params.onSuccess The callback function to be invoked on success\n * @param {UseOtpCredentialCallback} params.onError The callback function to be invoked on error\n * @returns {UseOtpCredentialReturn}\n *\n * @example\n * useOtpCredential({ onSuccess: (credential) => console.log(credential), onError: (error) => console.log(error) });\n */\nexport const useOtpCredential = ((...params: any[]) => {\n const onSuccess =\n typeof params[0] === 'function'\n ? (params[0] as UseOtpCredentialCallback | undefined)\n : (params[0] as UseOtpCredentialParams | undefined)?.onSuccess;\n\n const onError =\n typeof params[0] === 'function'\n ? (params[0] as UseOtpCredentialParams | undefined)?.onError\n : undefined;\n\n const supported = typeof navigator !== 'undefined' && 'OTPCredential' in window;\n const [aborted, setAborted] = useState(false);\n\n const abortControllerRef = useRef<AbortController>(new AbortController());\n\n const get = async () => {\n if (!supported) return;\n\n abortControllerRef.current = new AbortController();\n try {\n const credential = await navigator.credentials.get({\n otp: { transport: ['sms'] },\n signal: abortControllerRef.current.signal\n });\n onSuccess?.(credential);\n setAborted(false);\n return credential;\n } catch (error) {\n onError?.(error);\n }\n };\n\n const abort = () => {\n abortControllerRef.current.abort();\n abortControllerRef.current = new AbortController();\n abortControllerRef.current.signal.onabort = () => setAborted(true);\n };\n\n return { supported, abort, aborted, get };\n}) as UseOtpCredential;\n"],"names":["useOtpCredential","_params$","_params$2","_len","arguments","length","params","Array","_key","onSuccess","onError","undefined","supported","navigator","window","_useState","useState","_useState2","_slicedToArray","aborted","setAborted","abortControllerRef","useRef","AbortController","get","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","credential","wrap","_context","prev","next","abrupt","current","credentials","otp","transport","signal","sent","t0","stop","apply","this","abort","onabort"],"mappings":";+HAmEaA,EAAoB,WAAsB,IAAA,IAAAC,EAAAC,EAAAC,EAAAC,UAAAC,OAAlBC,EAAMC,IAAAA,MAAAJ,GAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAANF,EAAME,GAAAJ,UAAAI,GACzC,IAAMC,EACiB,mBAAdH,EAAO,GACTA,EAAO,GACE,QADAL,EACTK,EAAO,UAAE,IAAAL,OAAA,EAAVA,EAAmDQ,UAEnDC,EACiB,mBAAdJ,EAAO,GACAJ,QADiBA,EAC1BI,EAAO,cAAEJ,SAAVA,EAAmDQ,aACnDC,EAEAC,EAAiC,oBAAdC,WAA6B,kBAAmBC,OACzEC,EAA8BC,GAAS,GAAMC,EAAAC,EAAAH,EAAA,GAAtCI,EAAOF,EAAA,GAAEG,EAAUH,EAAA,GAEpBI,EAAqBC,EAAwB,IAAIC,iBAEjDC,EAAG,WAAA,IAAAC,EAAAC,EAAAC,IAAAC,MAAG,SAAAC,IAAA,IAAAC,EAAA,OAAAH,IAAAI,MAAA,SAAAC,GAAA,cAAAA,EAAAC,KAAAD,EAAAE,MAAA,KAAA,EAAA,GACLtB,EAAS,CAAAoB,EAAAE,KAAA,EAAA,KAAA,CAAA,OAAAF,EAAAG,OAAA,UAAA,KAAA,EAEqC,OAAnDd,EAAmBe,QAAU,IAAIb,gBAAkBS,EAAAC,KAAA,EAAAD,EAAAE,KAAA,EAExBrB,UAAUwB,YAAYb,IAAI,CACjDc,IAAK,CAAEC,UAAW,CAAC,QACnBC,OAAQnB,EAAmBe,QAAQI,SACnC,KAAA,EAEgB,OALZV,EAAUE,EAAAS,KAIhBhC,SAAAA,EAAYqB,GACZV,GAAW,GAAOY,EAAAG,OAAA,SACXL,GAAU,KAAA,GAAAE,EAAAC,KAAA,GAAAD,EAAAU,GAAAV,EAAA,MAAA,GAEjBtB,SAAAA,EAAOsB,EAAAU,IAAU,KAAA,GAAA,IAAA,MAAA,OAAAV,EAAAW,OAAA,GAAAd,EAAA,KAAA,CAAA,CAAA,EAAA,UAEpB,OAAA,WAfQ,OAAAJ,EAAAmB,MAAAC,KAAAzC,UAAA,EAAA,GAuBT,MAAO,CAAEQ,UAAAA,EAAWkC,MANN,WACZzB,EAAmBe,QAAQU,QAC3BzB,EAAmBe,QAAU,IAAIb,gBACjCF,EAAmBe,QAAQI,OAAOO,QAAU,WAAA,OAAM3B,GAAW,EAAK,CACnE,EAE0BD,QAAAA,EAASK,IAAAA,EACtC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as n,useEffect as t}from"react";import{useEvent as r}from"../useEvent/useEvent.js";var o=function(o){var u=n(!1),s=e(u,2),m=s[0],i=s[1],v=r((function(){if(m)return i(!1);null==o||o(),i(!0)}));return t((function(){return document.addEventListener("mouseleave",v,{passive:!0}),document.addEventListener("mouseenter",v,{passive:!0}),function(){document.removeEventListener("mouseenter",v),document.removeEventListener("mouseleave",v)}}),[]),m};export{o as usePageLeave};
|
|
3
3
|
//# sourceMappingURL=usePageLeave.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{i as t,_ as n,j as r,g as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{i as t,_ as n,j as r,g as e}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useRef as i,useState as u,useEffect as o}from"react";import{getElement as s}from"../../utils/helpers/getElement.js";import{isTarget as a}from"../../utils/helpers/isTarget.js";import{useEvent as l}from"../useEvent/useEvent.js";import{useRefState as c}from"../useRefState/useRefState.js";var h=function(){function n(t,e){r(this,n),this.x=t,this.y=e}return t(n,[{key:"update",value:function(t){this.x=t.x,this.y=t.y}},{key:"getDifferenceTo",value:function(t){return new n(this.x-t.x,this.y-t.y)}},{key:"getDistanceTo",value:function(t){var n=this.getDifferenceTo(t);return Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2))}},{key:"getAngleTo",value:function(t){var n=this.getDifferenceTo(t);return Math.atan2(n.y,n.x)}},{key:"equalsTo",value:function(t){return this.x===t.x&&this.y===t.y}},{key:"moveByAngle",value:function(t,n){var r=t+Math.PI/2;return this.x+=Math.sin(r)*n,this.y-=Math.cos(r)*n,this}}])}(),v=function(){return t((function t(n){var i=n.x,u=n.y,o=n.radius,s=n.smooth;r(this,t),e(this,"smooth",!1),e(this,"points",[]),e(this,"lines",[]),this.smooth=s,this.pointer=new h(i,u),this.brush=new h(i,u),this.radius=o,this.points=[],this.lines=[]}),[{key:"getBrushCoordinates",value:function(){return{x:this.brush.x,y:this.brush.y}}},{key:"getPointerCoordinates",value:function(){return{x:this.pointer.x,y:this.pointer.y}}},{key:"update",value:function(t){if(this.pointer.equalsTo(t))return!1;if(this.pointer.update(t),!this.smooth)return this.brush.update(t),this.points.push(this.getBrushCoordinates()),!0;var n=this.pointer.getDistanceTo(this.brush),r=this.pointer.getAngleTo(this.brush);if(Math.round(10*(n-this.radius))/10>0){var e=r+Math.PI/2;return this.brush.update({x:this.brush.x+Math.sin(e)*(n-this.radius),y:this.brush.y-Math.cos(e)*(n-this.radius)}),this.points.push(this.getBrushCoordinates()),!0}return!1}}])}(),d=function(){var t,r,e,h,d,f,p=a(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,y=null!==(t=p?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0])&&void 0!==t?t:{},g=null!==(r=null==y?void 0:y.color)&&void 0!==r?r:"black",m=null!==(e=null==y?void 0:y.opacity)&&void 0!==e?e:1,x=null!==(h=null==y?void 0:y.radius)&&void 0!==h?h:10,w=i(new v({x:0,y:0,radius:null!==(d=null==y?void 0:y.radius)&&void 0!==d?d:10,smooth:null!==(f=null==y?void 0:y.smooth)&&void 0!==f&&f})),M=u(!1),b=n(M,2),k=b[0],E=b[1],T=c(),L=i(null),C=function(t,n,r,e){if(L.current){L.current.globalAlpha=r,L.current.strokeStyle=n,L.current.lineWidth=2*e,L.current.lineCap="round",L.current.lineJoin="round";var i=t[0],u=t[1];L.current.beginPath();for(var o=1;o<t.length;o+=1){var s={x:i.x+(u.x-i.x)/2,y:i.y+(u.y-i.y)/2};L.current.quadraticCurveTo(i.x,i.y,s.x,s.y),i=t[o],u=t[o+1]}L.current.lineTo(i.x,i.y),L.current.stroke()}},j=function(){L.current&&L.current.clearRect(0,0,L.current.canvas.width,L.current.canvas.height)},D=l((function(t){var n;if(k){null==y||null===(n=y.onMouseMove)||void 0===n||n.call(y,t,w.current);var r={x:t.offsetX,y:t.offsetY};w.current.update(r)&&L.current&&(j(),L.current.clearRect(0,0,L.current.canvas.width,L.current.canvas.height),w.current.lines.forEach((function(t){var n=t.points,r=t.color,e=t.opacity,i=t.radius;return C(n,r,e,i)})),C(w.current.points,g,m,x))}})),B=l((function(t){var n;if(L.current){var r={x:t.offsetX,y:t.offsetY};w.current.brush.update(r),w.current.points.push(r),C(w.current.points,g,m,x),null==y||null===(n=y.onMouseDown)||void 0===n||n.call(y,t,w.current),E(!0)}})),P=l((function(t){var n;L.current&&(w.current.points.length&&(w.current.lines.push({points:w.current.points,color:g,opacity:m,radius:x}),w.current.points=[]),null==y||null===(n=y.onMouseUp)||void 0===n||n.call(y,t,w.current),E(!1))})),q=function(){L.current&&(j(),w.current.lines=[],w.current.points=[])},A=function(){L.current&&(j(),w.current.lines.pop(),w.current.lines.forEach((function(t){var n=t.points,r=t.color,e=t.opacity,i=t.radius;return C(n,r,e,i)})))};return o((function(){if(p||T.state){var t=p?s(p):T.current;if(t)return L.current=t.getContext("2d"),null!=y&&y.initialLines&&(w.current.lines=y.initialLines,y.initialLines.forEach((function(t){var n=t.points,r=t.color,e=t.opacity,i=t.radius;return C(n,r,e,i)}))),t.addEventListener("mousedown",B),t.addEventListener("mousemove",D),t.addEventListener("mouseup",P),function(){t&&(t.removeEventListener("mousedown",B),t.removeEventListener("mousemove",D),t.removeEventListener("mouseup",P))}}}),[p,T.state]),p?{drawing:k,clear:q,undo:A,draw:C,lines:w.current.lines}:{ref:T,drawing:k,clear:q,undo:A,draw:C,lines:w.current.lines}};export{v as Paint,h as Pointer,d as usePaint};
|
|
3
3
|
//# sourceMappingURL=usePaint.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as t,useEffect as a}from"react";import{isTarget as r}from"../../utils/helpers/isTarget.js";import{useDeviceOrientation as i}from"../useDeviceOrientation/useDeviceOrientation.js";import{useMouse as n}from"../useMouse/useMouse.js";import{useRefState as o}from"../useRefState/useRefState.js";import{useScreenOrientation as u}from"../useScreenOrientation/useScreenOrientation.js";import"../../utils/helpers/getElement.js";var l=function(){var l=r(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,s=(arguments.length<=1?void 0:arguments[1])?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],m=o(),v=n(null!=l?l:m),c=u(),d=i(),p=null!=s?s:{},f=p.deviceOrientationRollAdjust,g=void 0===f?function(e){return e}:f,h=p.deviceOrientationTiltAdjust,b=void 0===h?function(e){return e}:h,y=p.mouseRollAdjust,j=void 0===y?function(e){return e}:y,O=p.mouseTiltAdjust,k=void 0===O?function(e){return e}:O,R=t({roll:0,tilt:0,source:"mouse"}),T=e(R,2),A=T[0],S=T[1],w=function(){return d.supported&&(d.value.alpha||d.value.gamma)?"deviceOrientation":"mouse"};return a((function(){if(v.element){var e=w(),t=function(){if("deviceOrientation"===w()){var e;switch(c.value.orientationType){case"landscape-primary":e=d.value.gamma/90;break;case"landscape-secondary":e=-d.value.gamma/90;break;case"portrait-primary":default:e=-d.value.beta/90;break;case"portrait-secondary":e=d.value.beta/90}return g(e)}if(!v.element)return 0;var t=v.y-v.elementPositionY,a=v.element.getBoundingClientRect().height;return j(-(t-a/2)/a)}(),a=function(){if("deviceOrientation"===w()){var e;switch(c.value.orientationType){case"landscape-primary":e=d.value.beta/90;break;case"landscape-secondary":e=-d.value.beta/90;break;case"portrait-primary":default:e=d.value.gamma/90;break;case"portrait-secondary":e=-d.value.gamma/90}return b(e)}if(!v.element)return 0;var t=v.x-v.elementPositionX,a=v.element.getBoundingClientRect().width;return k((t-a/2)/a)}();S({roll:t,source:e,tilt:a})}}),[c.value.angle,c.value.orientationType,d.value.gamma,d.value.beta,d.value.alpha,d.value.absolute,v.x,v.y,v.element]),l?{value:A}:{ref:m,value:A}};export{l as useParallax};
|
|
3
3
|
//# sourceMappingURL=useParallax.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as e,useRef as n,useEffect as t}from"react";var o=function(o,u){var i="undefined"!=typeof window&&"undefined"!=typeof PerformanceObserver,c=e([]),f=r(c,2),l=f[0],a=f[1],s=n(null),v=n();v.current=u;var d=function(){if(i){var r=new PerformanceObserver((function(r,e){var n;a(r.getEntries()),null===(n=v.current)||void 0===n||n.call(v,r,e)}));r.observe(o),s.current=r}},p=function(){var r;i&&(null===(r=s.current)||void 0===r||r.disconnect(),s.current=null)};return t((function(){if(i)return o.immediate&&d(),function(){p()}}),[]),{supported:i,entries:l,start:d,stop:p}};export{o as usePerformanceObserver};
|
|
3
3
|
//# sourceMappingURL=usePerformanceObserver.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e,d as r,e as t}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as e,d as r,e as t}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as n,useEffect as a}from"react";import{useEvent as o}from"../useEvent/useEvent.js";var s=function(s,u){var i,p="undefined"!=typeof navigator&&"permissions"in navigator,c=n("prompt"),v=e(c,2),m=v[0],d=v[1],f=null===(i=null==u?void 0:u.enabled)||void 0===i||i,l={name:s},g=o(r(t().mark((function e(){var r;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,navigator.permissions.query(l);case 3:return r=e.sent,d(r.state),e.abrupt("return",r.state);case 8:return e.prev=8,e.t0=e.catch(0),d("prompt"),e.abrupt("return","prompt");case 12:case"end":return e.stop()}}),e,null,[[0,8]])}))));return a((function(){if(p&&f)return g(),window.addEventListener("change",g),function(){window.removeEventListener("change",g)}}),[s,f]),{state:m,supported:p,query:g}};export{s as usePermission};
|
|
3
3
|
//# sourceMappingURL=usePermission.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as n,useEffect as t}from"react";var o=function(){var o="undefined"!=typeof document&&"pointerLockElement"in document,r=n(),c=e(r,2),i=c[0],u=c[1];t((function(){if(o){var e=function(){var e;if(o){var n=null!==(e=document.pointerLockElement)&&void 0!==e?e:i;n&&n===i&&u(document.pointerLockElement)}},n=function(){var e;if(o){var n=null!==(e=document.pointerLockElement)&&void 0!==e?e:i;if(n&&n===i){var t=document.pointerLockElement?"release":"acquire";throw new Error("Failed to ".concat(t," pointer lock."))}}};return document.addEventListener("pointerlockchange",e),document.addEventListener("pointerlockerror",n),function(){document.removeEventListener("pointerlockchange",e),document.removeEventListener("pointerlockerror",n)}}}),[]);return{supported:o,element:i,lock:function(e){return!!o&&(!(e instanceof Event)&&(e.currentTarget.requestPointerLock(),u(e.currentTarget),!0))},unlock:function(){return!!o&&(!!i&&(document.exitPointerLock(),u(void 0),!0))}}};export{o as usePointerLock};
|
|
3
3
|
//# sourceMappingURL=usePointerLock.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
2
|
import{useRef as r,useEffect as n}from"react";var e=function(e,t){var i=r(t);i.current=t,n((function(){var r=function(r){!(!Array.isArray(e)||e.includes(r.origin)&&e.includes("*"))||r.origin!==e&&"*"!==e||i.current(r.data,r)};return window.addEventListener("message",r),function(){return window.removeEventListener("message",r)}}),[]);return function(r){Array.isArray(e)?e.forEach((function(n){return window.postMessage(r,n)})):window.postMessage(r,e)}};export{e as usePostMessage};
|
|
3
3
|
//# sourceMappingURL=usePostMessage.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
2
|
import{useMediaQuery as e}from"../useMediaQuery/useMediaQuery.js";import"react";var r=function(){var r=e("(prefers-color-scheme: light)"),o=e("(prefers-color-scheme: dark)");return r?"light":o?"dark":"no-preference"};export{r as usePreferredColorScheme};
|
|
3
3
|
//# sourceMappingURL=usePreferredColorScheme.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
2
|
import{useMediaQuery as r}from"../useMediaQuery/useMediaQuery.js";import"react";var e=function(){var e=r("(prefers-contrast: more)"),s=r("(prefers-contrast: less)"),t=r("(prefers-contrast: custom)");return e?"more":s?"less":t?"custom":"no-preference"};export{e as usePreferredContrast};
|
|
3
3
|
//# sourceMappingURL=usePreferredContrast.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
2
|
import{useMediaQuery as r}from"../useMediaQuery/useMediaQuery.js";import"react";var e=function(){return r("(prefers-color-scheme: dark)")};export{e as usePreferredDark};
|
|
3
3
|
//# sourceMappingURL=usePreferredDark.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
2
|
import{useSyncExternalStore as n}from"react";var e=function(){return window.navigator.languages},r=function(){return[]},t=function(n){return window.addEventListener("languagechange",n),function(){window.removeEventListener("languagechange",n)}},a=function(){return n(t,e,r)};export{a as usePreferredLanguages};
|
|
3
3
|
//# sourceMappingURL=usePreferredLanguages.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
2
|
import{useMediaQuery as e}from"../useMediaQuery/useMediaQuery.js";import"react";var r=function(){return e("(prefers-reduced-motion: reduce)")?"reduce":"no-preference"};export{r as usePreferredReducedMotion};
|
|
3
3
|
//# sourceMappingURL=usePreferredReducedMotion.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
2
|
import{useRef as r}from"react";var t=function(t,e){var n,u=r(t),c=r();return(null!==(n=null==e?void 0:e.equality)&&void 0!==n?n:Object.is)(t,u.current)||(c.current=u.current,u.current=t),c.current};export{t as usePrevious};
|
|
3
3
|
//# sourceMappingURL=usePrevious.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r,a as t}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as r,a as t}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useRef as e,useState as n,useEffect as l}from"react";import{getRetry as i}from"../../utils/helpers/getRetry.js";import{useDidUpdate as o}from"../useDidUpdate/useDidUpdate.js";import{useMount as u}from"../useMount/useMount.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var c=function(c,a){var f,s,v=null===(f=null==a?void 0:a.enabled)||void 0===f||f,d=e(null!=a&&a.retry?i(a.retry):0),h=e(!1),p=n(!1),y=r(p,2),m=y[0],D=y[1],I=n(!1),b=r(I,2),g=b[0],j=b[1],E=n(!1),L=r(E,2),k=L[0],w=L[1],A=n(!1),C=r(A,2),M=C[0],R=C[1],S=n(!(null==a||!a.initialData)),U=r(S,2),_=U[0],x=U[1],B=n(void 0),F=r(B,2),H=F[0],P=F[1],T=n(null==a?void 0:a.initialData),q=r(T,2),z=q[0],G=q[1],J=e(new AbortController),K=e(),N=null!==(s=null==a?void 0:a.keys)&&void 0!==s?s:[],O=function(){J.current.abort(),J.current=new AbortController},Q=function(r){O(),D(!0),"init"===r&&(h.current=!0,j(!0)),"refetch"===r&&R(!0),c({signal:J.current.signal,keys:N}).then((function(t){var e,n=null!=a&&a.select?null==a?void 0:a.select(t):t;null==a||null===(e=a.onSuccess)||void 0===e||e.call(a,n),G(n),x(!0),P(void 0),w(!1),D(!1),"init"===r&&j(!1),"refetch"===r&&R(!1)})).catch((function(t){var e;if(d.current>0){d.current-=1;var n="function"==typeof(null==a?void 0:a.retryDelay)?null==a?void 0:a.retryDelay(d.current,t):null==a?void 0:a.retryDelay;return n?void setTimeout((function(){return Q(r)}),n):Q(r)}null==a||null===(e=a.onError)||void 0===e||e.call(a,t),G(void 0),x(!1),P(t),w(!0),D(!1),"init"===r&&j(!1),"refetch"===r&&R(!1),d.current=null!=a&&a.retry?i(a.retry):0})).finally((function(){if(null!=a&&a.refetchInterval){var r=setInterval((function(){clearInterval(r),Q("refetch")}),null==a?void 0:a.refetchInterval);K.current=r}}))};u((function(){v&&Q("init")})),o((function(){v&&Q(h.current?"refetch":"init")}),[v].concat(t(N))),l((function(){return function(){clearInterval(K.current)}}),[v,null==a?void 0:a.refetchInterval,null==a?void 0:a.retry].concat(t(N)));var V="function"==typeof(null==a?void 0:a.placeholderData)?(null==a?void 0:a.placeholderData.bind(a))():null==a?void 0:a.placeholderData;return{abort:O,data:null!=z?z:V,error:H,refetch:function(){return Q("refetch")},isFetching:m,isLoading:g,isError:k,isSuccess:_,isRefetching:M}};export{c as useQuery};
|
|
3
3
|
//# sourceMappingURL=useQuery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useQuery.js","sources":["../../../../src/hooks/useQuery/useQuery.ts"],"sourcesContent":["import type { DependencyList } from 'react';\n\nimport { useEffect, useRef, useState } from 'react';\n\nimport { getRetry } from '@/utils/helpers';\n\nimport { useDidUpdate } from '../useDidUpdate/useDidUpdate';\nimport { useMount } from '../useMount/useMount';\n\n/* The use query return type */\nexport interface UseQueryOptions<QueryData, Data> {\n /* The enabled state of the query */\n enabled?: boolean;\n /* The initial data for the hook */\n initialData?: (() => Data) | Data;\n /* The depends for the hook */\n keys?: DependencyList;\n /* The placeholder data for the hook */\n placeholderData?: (() => Data) | Data;\n /* The refetch interval */\n refetchInterval?: number;\n /* The retry count of requests */\n retry?: boolean | number;\n /* The retry delay of requests */\n retryDelay?: ((retry: number, error: Error) => number) | number;\n /* The callback function to be invoked on error */\n onError?: (error: Error) => void;\n /* The callback function to be invoked on success */\n onSuccess?: (data: Data) => void;\n /* The select function to be invoked */\n select?: (data: QueryData) => Data;\n}\n\ninterface UseQueryCallbackParams {\n /* The depends for the hook */\n keys: DependencyList;\n /* The abort signal */\n signal: AbortSignal;\n}\n\n/* The use query return type */\nexport interface UseQueryReturn<Data> {\n /* The abort function */\n abort: AbortController['abort'];\n /* The state of the query */\n data?: Data;\n /* The success state of the query */\n error?: Error;\n /* The error state of the query */\n isError: boolean;\n /* The fetching state of the query */\n isFetching: boolean;\n /* The loading state of the query */\n isLoading: boolean;\n /* The refetching state of the query */\n isRefetching: boolean;\n /* The success state of the query */\n isSuccess: boolean;\n /* The refetch function */\n refetch: () => void;\n}\n\n/**\n * @name useQuery\n * @description - Hook that defines the logic when query data\n * @category Utilities\n *\n * @template Data The type of the data\n * @param {() => Promise<Data>} callback The callback function to be invoked\n * @param {DependencyList} [options.keys] The dependencies for the hook\n * @param {(data: Data) => void} [options.onSuccess] The callback function to be invoked on success\n * @param {(error: Error) => void} [options.onError] The callback function to be invoked on error\n * @param {UseQueryOptionsSelect<Data>} [options.select] The select function to be invoked\n * @param {Data | (() => Data)} [options.initialData] The initial data for the hook\n * @param {Data | (() => Data)} [options.placeholderData] The placeholder data for the hook\n * @param {number} [options.refetchInterval] The refetch interval\n * @param {boolean | number} [options.retry] The retry count of requests\n * @returns {UseQueryReturn<Data>} An object with the state of the query\n *\n * @example\n * const { data, isFetching, isLoading, isError, isSuccess, error, refetch, isRefetching, abort, aborted } = useQuery(() => fetch('url'));\n */\nexport const useQuery = <QueryData, Data = QueryData>(\n callback: (params: UseQueryCallbackParams) => Promise<QueryData>,\n options?: UseQueryOptions<QueryData, Data>\n): UseQueryReturn<Data> => {\n const enabled = options?.enabled ?? true;\n const retryCountRef = useRef(options?.retry ? getRetry(options.retry) : 0);\n const alreadyRequested = useRef(false);\n\n const [isFetching, setIsFetching] = useState(false);\n const [isLoading, setIsLoading] = useState(false);\n const [isError, setIsError] = useState(false);\n const [isRefetching, setIsRefetching] = useState(false);\n const [isSuccess, setIsSuccess] = useState(!!options?.initialData);\n\n const [error, setError] = useState<Error | undefined>(undefined);\n const [data, setData] = useState<Data | undefined>(options?.initialData);\n\n const abortControllerRef = useRef<AbortController>(new AbortController());\n const intervalIdRef = useRef<ReturnType<typeof setInterval>>();\n\n const keys = options?.keys ?? [];\n\n const abort = () => {\n abortControllerRef.current.abort();\n abortControllerRef.current = new AbortController();\n };\n\n const request = (action: 'init' | 'refetch') => {\n abort();\n\n setIsFetching(true);\n if (action === 'init') {\n alreadyRequested.current = true;\n setIsLoading(true);\n }\n if (action === 'refetch') setIsRefetching(true);\n callback({ signal: abortControllerRef.current.signal, keys })\n .then((response) => {\n const data = options?.select ? options?.select(response) : response;\n options?.onSuccess?.(data as Data);\n setData(data as Data);\n setIsSuccess(true);\n setError(undefined);\n setIsError(false);\n setIsFetching(false);\n if (action === 'init') setIsLoading(false);\n if (action === 'refetch') setIsRefetching(false);\n })\n .catch((error: Error) => {\n if (retryCountRef.current > 0) {\n retryCountRef.current -= 1;\n const retryDelay =\n typeof options?.retryDelay === 'function'\n ? options?.retryDelay(retryCountRef.current, error)\n : options?.retryDelay;\n\n if (retryDelay) {\n setTimeout(() => request(action), retryDelay);\n return;\n }\n\n return request(action);\n }\n options?.onError?.(error);\n setData(undefined);\n setIsSuccess(false);\n setError(error);\n setIsError(true);\n setIsFetching(false);\n if (action === 'init') setIsLoading(false);\n if (action === 'refetch') setIsRefetching(false);\n retryCountRef.current = options?.retry ? getRetry(options.retry) : 0;\n })\n .finally(() => {\n if (options?.refetchInterval) {\n const interval = setInterval(() => {\n clearInterval(interval);\n request('refetch');\n }, options?.refetchInterval);\n intervalIdRef.current = interval;\n }\n });\n };\n\n useMount(() => {\n if (!enabled) return;\n request('init');\n });\n\n useDidUpdate(() => {\n if (!enabled) return;\n request(alreadyRequested.current ? 'refetch' : 'init');\n }, [enabled, ...keys]);\n\n useEffect(() => {\n return () => {\n clearInterval(intervalIdRef.current);\n };\n }, [enabled, options?.refetchInterval, options?.retry, ...keys]);\n\n const refetch = () => request('refetch');\n\n const placeholderData =\n options?.placeholderData instanceof Function\n ? options?.placeholderData()\n : options?.placeholderData;\n\n return {\n abort,\n data: data ?? placeholderData,\n error,\n refetch,\n isFetching,\n isLoading,\n isError,\n isSuccess,\n isRefetching\n };\n};\n"],"names":["useQuery","callback","options","_options$enabled","_options$keys","enabled","retryCountRef","useRef","retry","getRetry","alreadyRequested","_useState","useState","_useState2","_slicedToArray","isFetching","setIsFetching","_useState3","_useState4","isLoading","setIsLoading","_useState5","_useState6","isError","setIsError","_useState7","_useState8","isRefetching","setIsRefetching","_useState9","initialData","_useState10","isSuccess","setIsSuccess","_useState11","undefined","_useState12","error","setError","_useState13","_useState14","data","setData","abortControllerRef","AbortController","intervalIdRef","keys","abort","current","request","action","signal","then","response","_options$onSuccess","select","onSuccess","call","_options$onError","retryDelay","setTimeout","onError","refetchInterval","interval","setInterval","clearInterval","useMount","useDidUpdate","concat","_toConsumableArray","useEffect","placeholderData","Function","refetch"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"useQuery.js","sources":["../../../../src/hooks/useQuery/useQuery.ts"],"sourcesContent":["import type { DependencyList } from 'react';\n\nimport { useEffect, useRef, useState } from 'react';\n\nimport { getRetry } from '@/utils/helpers';\n\nimport { useDidUpdate } from '../useDidUpdate/useDidUpdate';\nimport { useMount } from '../useMount/useMount';\n\n/* The use query return type */\nexport interface UseQueryOptions<QueryData, Data> {\n /* The enabled state of the query */\n enabled?: boolean;\n /* The initial data for the hook */\n initialData?: (() => Data) | Data;\n /* The depends for the hook */\n keys?: DependencyList;\n /* The placeholder data for the hook */\n placeholderData?: (() => Data) | Data;\n /* The refetch interval */\n refetchInterval?: number;\n /* The retry count of requests */\n retry?: boolean | number;\n /* The retry delay of requests */\n retryDelay?: ((retry: number, error: Error) => number) | number;\n /* The callback function to be invoked on error */\n onError?: (error: Error) => void;\n /* The callback function to be invoked on success */\n onSuccess?: (data: Data) => void;\n /* The select function to be invoked */\n select?: (data: QueryData) => Data;\n}\n\ninterface UseQueryCallbackParams {\n /* The depends for the hook */\n keys: DependencyList;\n /* The abort signal */\n signal: AbortSignal;\n}\n\n/* The use query return type */\nexport interface UseQueryReturn<Data> {\n /* The abort function */\n abort: AbortController['abort'];\n /* The state of the query */\n data?: Data;\n /* The success state of the query */\n error?: Error;\n /* The error state of the query */\n isError: boolean;\n /* The fetching state of the query */\n isFetching: boolean;\n /* The loading state of the query */\n isLoading: boolean;\n /* The refetching state of the query */\n isRefetching: boolean;\n /* The success state of the query */\n isSuccess: boolean;\n /* The refetch function */\n refetch: () => void;\n}\n\n/**\n * @name useQuery\n * @description - Hook that defines the logic when query data\n * @category Utilities\n *\n * @template Data The type of the data\n * @param {() => Promise<Data>} callback The callback function to be invoked\n * @param {DependencyList} [options.keys] The dependencies for the hook\n * @param {(data: Data) => void} [options.onSuccess] The callback function to be invoked on success\n * @param {(error: Error) => void} [options.onError] The callback function to be invoked on error\n * @param {UseQueryOptionsSelect<Data>} [options.select] The select function to be invoked\n * @param {Data | (() => Data)} [options.initialData] The initial data for the hook\n * @param {Data | (() => Data)} [options.placeholderData] The placeholder data for the hook\n * @param {number} [options.refetchInterval] The refetch interval\n * @param {boolean | number} [options.retry] The retry count of requests\n * @returns {UseQueryReturn<Data>} An object with the state of the query\n *\n * @example\n * const { data, isFetching, isLoading, isError, isSuccess, error, refetch, isRefetching, abort, aborted } = useQuery(() => fetch('url'));\n */\nexport const useQuery = <QueryData, Data = QueryData>(\n callback: (params: UseQueryCallbackParams) => Promise<QueryData>,\n options?: UseQueryOptions<QueryData, Data>\n): UseQueryReturn<Data> => {\n const enabled = options?.enabled ?? true;\n const retryCountRef = useRef(options?.retry ? getRetry(options.retry) : 0);\n const alreadyRequested = useRef(false);\n\n const [isFetching, setIsFetching] = useState(false);\n const [isLoading, setIsLoading] = useState(false);\n const [isError, setIsError] = useState(false);\n const [isRefetching, setIsRefetching] = useState(false);\n const [isSuccess, setIsSuccess] = useState(!!options?.initialData);\n\n const [error, setError] = useState<Error | undefined>(undefined);\n const [data, setData] = useState<Data | undefined>(options?.initialData);\n\n const abortControllerRef = useRef<AbortController>(new AbortController());\n const intervalIdRef = useRef<ReturnType<typeof setInterval>>();\n\n const keys = options?.keys ?? [];\n\n const abort = () => {\n abortControllerRef.current.abort();\n abortControllerRef.current = new AbortController();\n };\n\n const request = (action: 'init' | 'refetch') => {\n abort();\n\n setIsFetching(true);\n if (action === 'init') {\n alreadyRequested.current = true;\n setIsLoading(true);\n }\n if (action === 'refetch') setIsRefetching(true);\n callback({ signal: abortControllerRef.current.signal, keys })\n .then((response) => {\n const data = options?.select ? options?.select(response) : response;\n options?.onSuccess?.(data as Data);\n setData(data as Data);\n setIsSuccess(true);\n setError(undefined);\n setIsError(false);\n setIsFetching(false);\n if (action === 'init') setIsLoading(false);\n if (action === 'refetch') setIsRefetching(false);\n })\n .catch((error: Error) => {\n if (retryCountRef.current > 0) {\n retryCountRef.current -= 1;\n const retryDelay =\n typeof options?.retryDelay === 'function'\n ? options?.retryDelay(retryCountRef.current, error)\n : options?.retryDelay;\n\n if (retryDelay) {\n setTimeout(() => request(action), retryDelay);\n return;\n }\n\n return request(action);\n }\n options?.onError?.(error);\n setData(undefined);\n setIsSuccess(false);\n setError(error);\n setIsError(true);\n setIsFetching(false);\n if (action === 'init') setIsLoading(false);\n if (action === 'refetch') setIsRefetching(false);\n retryCountRef.current = options?.retry ? getRetry(options.retry) : 0;\n })\n .finally(() => {\n if (options?.refetchInterval) {\n const interval = setInterval(() => {\n clearInterval(interval);\n request('refetch');\n }, options?.refetchInterval);\n intervalIdRef.current = interval;\n }\n });\n };\n\n useMount(() => {\n if (!enabled) return;\n request('init');\n });\n\n useDidUpdate(() => {\n if (!enabled) return;\n request(alreadyRequested.current ? 'refetch' : 'init');\n }, [enabled, ...keys]);\n\n useEffect(() => {\n return () => {\n clearInterval(intervalIdRef.current);\n };\n }, [enabled, options?.refetchInterval, options?.retry, ...keys]);\n\n const refetch = () => request('refetch');\n\n const placeholderData =\n typeof options?.placeholderData === 'function'\n ? (options?.placeholderData as () => Data)()\n : options?.placeholderData;\n\n return {\n abort,\n data: data ?? placeholderData,\n error,\n refetch,\n isFetching,\n isLoading,\n isError,\n isSuccess,\n isRefetching\n };\n};\n"],"names":["useQuery","callback","options","_options$enabled","_options$keys","enabled","retryCountRef","useRef","retry","getRetry","alreadyRequested","_useState","useState","_useState2","_slicedToArray","isFetching","setIsFetching","_useState3","_useState4","isLoading","setIsLoading","_useState5","_useState6","isError","setIsError","_useState7","_useState8","isRefetching","setIsRefetching","_useState9","initialData","_useState10","isSuccess","setIsSuccess","_useState11","undefined","_useState12","error","setError","_useState13","_useState14","data","setData","abortControllerRef","AbortController","intervalIdRef","keys","abort","current","request","action","signal","then","response","_options$onSuccess","select","onSuccess","call","_options$onError","retryDelay","setTimeout","onError","refetchInterval","interval","setInterval","clearInterval","useMount","useDidUpdate","concat","_toConsumableArray","useEffect","placeholderData","bind","refetch"],"mappings":"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"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r,f as n,a as t}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as r,f as n,a as t}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as e}from"react";import{flushSync as o}from"react-dom";var u=function(){var u=e(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),a=r(u,2),i=a[0],c=a[1];return{add:function(r){return c((function(n){return[].concat(t(n),[r])}))},remove:function(){var r;return o((function(){c((function(t){var e=n(t),o=e[0],u=e.slice(1);return r=o,u}))})),r},clear:function(){return c([])},first:i[0],last:i[i.length-1],size:i.length,queue:i}};export{u as useQueue};
|
|
3
3
|
//# sourceMappingURL=useQueue.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useRef as n,useState as e,useEffect as t}from"react";var u=function(u,l){var i,a=n(null),o=n(0),c=e(!1),m=r(c,2),d=m[0],v=m[1],f=null===(i=null==l?void 0:l.enabled)||void 0===i||i,s=n(u);s.current=u;var p=function(r){var n=r-o.current;null!=l&&l.delay&&n<(null==l?void 0:l.delay)||(o.current=r,s.current({delta:n,timestamp:r})),a.current=window.requestAnimationFrame(p)},w=function(){d||(v(!0),o.current=0,a.current=window.requestAnimationFrame(p))};function y(){a.current&&(v(!1),window.cancelAnimationFrame(a.current),a.current=null)}return t((function(){if(f)return w(),y}),[f,null==l?void 0:l.delay]),{active:d,pause:y,resume:w}};export{u as useRaf};
|
|
3
3
|
//# sourceMappingURL=useRaf.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useRef as n,useState as t}from"react";import{useUnmount as e}from"../useUnmount/useUnmount.js";var o=function(o){var u=n(0),i=t(o),m=r(i,2),a=m[0],c=m[1];return e((function(){return cancelAnimationFrame(u.current)})),[a,function(r){cancelAnimationFrame(u.current),u.current=requestAnimationFrame((function(){return c(r)}))}]};export{o as useRafValue};
|
|
3
3
|
//# sourceMappingURL=useRafValue.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as e}from"react";var n=function(n){var t=e(n),u=r(t,2),o=u[0],i=u[1],c=e((function(){return function(r,e){var n=r;function t(r){n!==r&&e(n=r)}return Object.defineProperty(t,"current",{get:function(){return n},set:function(r){n!==r&&e(n=r)},configurable:!0,enumerable:!0}),t}(n,i)})),f=r(c,1)[0];return f.state=o,f};export{n as useRefState};
|
|
3
3
|
//# sourceMappingURL=useRefState.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
2
|
import{useRef as r,useEffect as t}from"react";var n=function(){var n=r(0);return t((function(){n.current+=1})),n.current};export{n as useRenderCount};
|
|
3
3
|
//# sourceMappingURL=useRenderCount.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
2
|
import{useRef as e}from"react";var n=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Unknown",r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=e({component:n,renders:0,timestamp:Date.now(),sinceLast:0}),c=Date.now();return t.current.renders+=1,t.current.sinceLast=t.current.timestamp?c-t.current.timestamp:0,t.current.timestamp=c,r&&(console.group("".concat(n," info, render number: ").concat(t.current.renders)),console.log("Timestamp: ".concat(t.current.timestamp)),console.log("Since last render: ".concat(t.current.sinceLast)),console.log("Renders: ".concat(t.current.renders)),console.dir(t.current),console.groupEnd()),t.current};export{n as useRenderInfo};
|
|
3
3
|
//# sourceMappingURL=useRenderInfo.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as r,useRef as t,useEffect as n}from"react";import{getElement as o}from"../../utils/helpers/getElement.js";import{isTarget as i}from"../../utils/helpers/isTarget.js";import{useRefState as l}from"../useRefState/useRefState.js";var s=function(){var s,u=i(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,v=u?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],a=null===(s=null==v?void 0:v.enabled)||void 0===s||s,f=r([]),d=e(f,2),c=d[0],m=d[1],p=l(),g=t();return g.current=null==v?void 0:v.onChange,n((function(){if(a||u||p.state){var e=u?o(u):p.current;if(e){var r=new ResizeObserver((function(e){var t;m(e),null===(t=g.current)||void 0===t||t.call(g,e,r)}));return r.observe(e,v),function(){r.disconnect()}}}}),[u,p.state,null==v?void 0:v.box,a]),u?{entries:c}:{ref:p,entries:c}};export{s as useResizeObserver};
|
|
3
3
|
//# sourceMappingURL=useResizeObserver.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as n}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as e,useEffect as o}from"react";var i=function(){var i="undefined"!=typeof window&&"screen"in window&&"orientation"in window.screen,t=i?window.screen.orientation:{},r=e((function(){var n;return{angle:null!==(n=null==t?void 0:t.angle)&&void 0!==n?n:0,orientationType:null==t?void 0:t.type}})),u=n(r,2),l=u[0],a=u[1];o((function(){if(i){var n=function(){return a({angle:t.angle,orientationType:t.type})};return window.addEventListener("orientationchange",n),function(){window.removeEventListener("orientationchange",n)}}}));return{supported:i,value:l,lock:function(n){if(i&&"function"==typeof t.lock)return t.lock(n)},unlock:function(){i&&"function"==typeof t.unlock&&t.unlock()}}};export{i as useScreenOrientation};
|
|
3
3
|
//# sourceMappingURL=useScreenOrientation.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as t,useEffect as e}from"react";var n="script-status",o=function(o){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=t((function(){var r=document.querySelector('script[src="'.concat(o,'"]')),t=null==r?void 0:r.getAttribute(n);return t||(r?"unknown":"loading")})),c=r(u,2),a=c[0],s=c[1],d=i.removeOnUnmount,v=void 0===d||d,l=i.async,m=void 0===l||l;return e((function(){var t=document.querySelector('script[src="'.concat(o,'"]')),e=null==t?void 0:t.getAttribute(n);if(e)return s(e);if(t)return s("unknown");var u=document.createElement("script");u.src=o,u.async=m;for(var c=0,a=Object.entries(i);c<a.length;c++){var d=r(a[c],2),l=d[0],f=d[1];u.setAttribute(l,String(f))}u.setAttribute(n,"loading"),document.body.appendChild(u);var p=function(){u.setAttribute(n,"ready"),s("ready")},b=function(){u.setAttribute(n,"error"),s("error")};return u.addEventListener("load",p),u.addEventListener("error",b),function(){v&&u.remove(),u.removeEventListener("load",p),u.removeEventListener("error",b)}}),[o,v]),a};export{n as SCRIPT_STATUS_ATTRIBUTE_NAME,o as useScript};
|
|
3
3
|
//# sourceMappingURL=useScript.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{b as t,_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{b as t,_ as e}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useRef as l,useState as o,useEffect as r}from"react";import{getElement as n}from"../../utils/helpers/getElement.js";import{isTarget as i}from"../../utils/helpers/isTarget.js";import{useRefState as c}from"../useRefState/useRefState.js";var u=function(){var u=i(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,v=u?"object"===t(arguments.length<=1?void 0:arguments[1])?arguments.length<=1?void 0:arguments[1]:{onScroll:arguments.length<=1?void 0:arguments[1]}:"object"===t(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:{onScroll:arguments.length<=0?void 0:arguments[0]},d=c(),s=l(v);s.current=v;var a=o(!1),f=e(a,2),m=f[0],g=f[1],h=l({x:0,y:0});return r((function(){if(u||d.state){var t=u?n(u):d.current;if(t){var e=function(t){var e;g(!1),null==v||null===(e=v.onStop)||void 0===e||e.call(v,t)},l=function(t){var e,l,o,r,n,i,c;g(!0);var u=t.target===document?t.target.documentElement:t.target,v=u.style,d=v.display,a=v.flexDirection,f="rtl"===v.direction?-1:1,m=u.scrollLeft,p=u.scrollTop;u instanceof Document&&!p&&(p=window.document.body.scrollTop);var x=null===(e=s.current)||void 0===e?void 0:e.offset,b=m*f<=(null!==(l=null==x?void 0:x.left)&&void 0!==l?l:0),y=m*f+u.clientWidth>=u.scrollWidth-(null!==(o=null==x?void 0:x.right)&&void 0!==o?o:0)-1,j=p<=(null!==(r=null==x?void 0:x.top)&&void 0!==r?r:0),E=p+u.clientHeight>=u.scrollHeight-(null!==(n=null==x?void 0:x.bottom)&&void 0!==n?n:0)-1,S="flex"===d&&"column-reverse"===a,L="flex"===d&&"column-reverse"===a,H={x:m,y:p,directions:{left:m<h.current.x,right:m>h.current.x,top:p<h.current.y,bottom:p>h.current.y},arrived:{left:L?y:b,right:L?b:y,top:S?E:j,bottom:S?j:E}};h.current={x:m,y:p},null===(i=s.current)||void 0===i||null===(c=i.onScroll)||void 0===c||c.call(i,H,t)};return t.addEventListener("scroll",l),t.addEventListener("scrollend",e),function(){t.removeEventListener("scroll",l),t.removeEventListener("scrollend",e)}}}}),[u,d.state]),u?m:{ref:d,scrolling:m}};export{u as useScroll};
|
|
3
3
|
//# sourceMappingURL=useScroll.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{useEffect as e}from"react";import{getElement as r}from"../../utils/helpers/getElement.js";import{isTarget as i}from"../../utils/helpers/isTarget.js";import{useRefState as t}from"../useRefState/useRefState.js";import"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{useEffect as e}from"react";import{getElement as r}from"../../utils/helpers/getElement.js";import{isTarget as i}from"../../utils/helpers/isTarget.js";import{useRefState as t}from"../useRefState/useRefState.js";import"../../_rollupPluginBabelHelpers-DoUxcpfK.js";var o=function(){var o=i(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,l=o?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],n=t(),a=null!=l?l:{},s=a.behavior,v=void 0===s?"smooth":s,u=a.block,c=void 0===u?"start":u,f=a.inline,g=void 0===f?"nearest":f,h=a.enabled,m=void 0===h||h;e((function(){if(m&&(o||n.state)){var e=o?r(o):n.current;e&&e.scrollIntoView({behavior:v,block:c,inline:g})}}),[o,n.state,m]);var b=function(e){var i=o?r(o):n.current;if(i){var t=null!=e?e:{},l=t.behavior,a=t.block,s=t.inline;i.scrollIntoView({behavior:l,block:a,inline:s})}};return o?{trigger:b}:{ref:n,trigger:b}};export{o as useScrollIntoView};
|
|
3
3
|
//# sourceMappingURL=useScrollIntoView.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{useLayoutEffect as e}from"react";import{getElement as r}from"../../utils/helpers/getElement.js";import{isTarget as t}from"../../utils/helpers/isTarget.js";import{useRefState as o}from"../useRefState/useRefState.js";import"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{useLayoutEffect as e}from"react";import{getElement as r}from"../../utils/helpers/getElement.js";import{isTarget as t}from"../../utils/helpers/isTarget.js";import{useRefState as o}from"../useRefState/useRefState.js";import"../../_rollupPluginBabelHelpers-DoUxcpfK.js";var i=function(){var i=t(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,l=i?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],a=null!=l?l:{},n=a.x,v=a.y,s=a.behavior,u=void 0===s?"auto":s,f=a.enabled,p=void 0===f||f,g=o();e((function(){if(p&&(i||g.state)){var e=i?r(i):g.current;e&&e.scrollTo({top:v,left:n,behavior:u})}}),[i,g.state]);var h=function(e){var t=i?r(i):g.current;if(t){var o=null!=e?e:{},l=o.x,a=o.y,n=o.behavior;t.scrollTo({left:l,top:a,behavior:n})}};return i?{trigger:h}:{ref:g,trigger:h}};export{i as useScrollTo};
|
|
3
3
|
//# sourceMappingURL=useScrollTo.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{c as
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{c as e}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useStorage as o}from"../useStorage/useStorage.js";import"react";var r=function(r,i,t){return o(r,e(e({},t),{},{initialValue:i,storage:"undefined"!=typeof window?window.sessionStorage:void 0}))};export{r as useSessionStorage};
|
|
3
3
|
//# sourceMappingURL=useSessionStorage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSessionStorage.js","sources":["../../../../src/hooks/useSessionStorage/useSessionStorage.ts"],"sourcesContent":["import type { UseStorageInitialValue, UseStorageOptions } from '../useStorage/useStorage';\n\nimport { useStorage } from '../useStorage/useStorage';\n\n/**\n * @name useSessionStorage\n * @description - Hook that manages session storage value\n * @category Browser\n *\n * @browserapi sessionStorage https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage\n *\n * @template Value The type of the value\n * @param {string} key The key of the storage\n * @param {UseStorageInitialValue<Value>} [initialValue] The initial value of the storage\n * @param {UseStorageOptions<Value>} [options] The options of the storage\n *\n * @example\n * const { value, set, remove } = useSessionStorage('key', 'value');\n */\nexport const useSessionStorage = <Value>(\n key: string,\n initialValue?: UseStorageInitialValue<Value>,\n options?: Omit<UseStorageOptions<Value>, 'initialValue' | 'storage'>\n) =>\n useStorage(key, {\n ...options,\n initialValue,\n storage: typeof window !== 'undefined' ? window.
|
|
1
|
+
{"version":3,"file":"useSessionStorage.js","sources":["../../../../src/hooks/useSessionStorage/useSessionStorage.ts"],"sourcesContent":["import type { UseStorageInitialValue, UseStorageOptions } from '../useStorage/useStorage';\n\nimport { useStorage } from '../useStorage/useStorage';\n\n/**\n * @name useSessionStorage\n * @description - Hook that manages session storage value\n * @category Browser\n *\n * @browserapi sessionStorage https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage\n *\n * @template Value The type of the value\n * @param {string} key The key of the storage\n * @param {UseStorageInitialValue<Value>} [initialValue] The initial value of the storage\n * @param {UseStorageOptions<Value>} [options] The options of the storage\n *\n * @example\n * const { value, set, remove } = useSessionStorage('key', 'value');\n */\nexport const useSessionStorage = <Value>(\n key: string,\n initialValue?: UseStorageInitialValue<Value>,\n options?: Omit<UseStorageOptions<Value>, 'initialValue' | 'storage'>\n) =>\n useStorage(key, {\n ...options,\n initialValue,\n storage: typeof window !== 'undefined' ? window.sessionStorage : undefined\n });\n"],"names":["useSessionStorage","key","initialValue","options","useStorage","_objectSpread","storage","window","sessionStorage","undefined"],"mappings":";uIAmBO,IAAMA,EAAoB,SAC/BC,EACAC,EACAC,GAAoE,OAEpEC,EAAWH,EAAGI,EAAAA,KACTF,GAAO,GAAA,CACVD,aAAAA,EACAI,QAA2B,oBAAXC,OAAyBA,OAAOC,oBAAiBC,IACjE"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as n}from"react";var r=function(r){var t=n(new Set(r)),u=e(t,2),i=u[0],f=u[1];return{value:i,size:i.size,has:function(e){return i.has(e)},add:function(e){return f((function(n){return new Set(n).add(e)}))},remove:function(e){return f((function(n){if(!n.has(e))return n;var r=new Set(n);return r.delete(e),r}))},clear:function(){return f(new Set)},reset:function(){return f(new Set(r))},toggle:function(e){return f((function(n){if(!n.has(e))return new Set(n).add(e);var r=new Set(n);return r.delete(e),r}))},union:function(e){return f(i.union(e))},difference:function(e){return f(i.difference(e))},symmetricDifference:function(e){return f(i.symmetricDifference(e))},intersection:function(e){return f(i.intersection(e))}}};export{r as useSet};
|
|
3
3
|
//# sourceMappingURL=useSet.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{d as r,e,c as a}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{d as r,e,c as a}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";var n=function(n){var t="undefined"!=typeof navigator&&"share"in navigator,i=function(){var i=r(e().mark((function r(i){var s;return e().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(t){r.next=2;break}return r.abrupt("return");case 2:return(s=a(a({},n),i)).files&&navigator.canShare({files:s.files})&&navigator.share(s),r.abrupt("return",navigator.share(s));case 5:case"end":return r.stop()}}),r)})));return function(r){return i.apply(this,arguments)}}();return{share:i,supported:t}};export{n as useShare};
|
|
3
3
|
//# sourceMappingURL=useShare.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useState as n,useRef as t}from"react";var e=function(e,u){var c=n(e),o=r(c,2),i=o[0],l=o[1],f=n([e]),a=r(f,2),s=a[0],h=a[1],v=t(0);return{history:s,value:i,set:function(r){h((function(n){var t=n.slice(0,v.current+1);return t.push(r),u&&t.length>u&&t.shift(),v.current=t.length-1,t})),l(r)},index:v.current,back:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;v.current-r<0||(v.current-=r,l(s[v.current]))},forward:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;v.current+r>=s.length||(v.current+=r,l(s[v.current]))},reset:function(){l(e),h([e]),v.current=0},undo:function(){0!==v.current&&(v.current--,l(s[v.current]),h((function(r){return r.slice(0,v.current+1)})))}}};export{e as useStateHistory};
|
|
3
3
|
//# sourceMappingURL=useStateHistory.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{b as t,_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.111 */
|
|
2
|
+
import{b as t,_ as r}from"../../_rollupPluginBabelHelpers-DoUxcpfK.js";import{useRef as n,useState as e}from"react";var i=function(i){var u="object"===t(i)?i.max:i,o="object"===t(i)?i.initial:1,c=n(o>u||o<1?1:o),s=e(o),a=r(s,2),f=a[0],l=a[1],p=1===f,b=f===u;return{counts:u,currentStep:f,isFirst:p,isLast:b,next:function(){b||l((function(t){return t+1}))},back:function(){p||l((function(t){return t-1}))},reset:function(){return l(c.current)},set:function(t){return"first"===t?l(c.current):"last"===t||t>=u?l(u):t<=1?l(1):void l(t)}}};export{i as useStep};
|
|
3
3
|
//# sourceMappingURL=useStep.js.map
|