@siberiacancode/reactuse 0.0.79 → 0.0.81
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-QPfaJzmb.js → _rollupPluginBabelHelpers-C9Oih4Du.js} +2 -2
- package/dist/cjs/_rollupPluginBabelHelpers-C9Oih4Du.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 +3 -0
- package/dist/cjs/hooks/useBluetooth/useBluetooth.js.map +1 -0
- 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/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/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/useDidUpdate/useDidUpdate.js +1 -1
- package/dist/cjs/hooks/useDisclosure/useDisclosure.js +2 -2
- package/dist/cjs/hooks/useDocumentEvent/useDocumentEvent.js +2 -2
- package/dist/cjs/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
- package/dist/cjs/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
- package/dist/cjs/hooks/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/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/useField/useField.js +2 -2
- package/dist/cjs/hooks/useField/useField.js.map +1 -1
- package/dist/cjs/hooks/useFileDialog/useFileDialog.js +2 -2
- package/dist/cjs/hooks/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/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/useGeolocation/useGeolocation.js.map +1 -1
- 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/useHover/useHover.js.map +1 -1
- 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/useList/useList.js +2 -2
- package/dist/cjs/hooks/useLocalStorage/useLocalStorage.js +2 -2
- package/dist/cjs/hooks/useLogger/useLogger.js +2 -2
- package/dist/cjs/hooks/useLongPress/useLongPress.js +2 -2
- package/dist/cjs/hooks/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/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/useOffsetPagination/useOffsetPagination.js +2 -2
- package/dist/cjs/hooks/useOnline/useOnline.js +1 -1
- package/dist/cjs/hooks/useOperatingSystem/useOperatingSystem.js +1 -1
- package/dist/cjs/hooks/useOptimistic/useOptimistic.js +2 -2
- package/dist/cjs/hooks/useOrientation/useOrientation.js +2 -2
- package/dist/cjs/hooks/useOtpCredential/useOtpCredential.js +2 -2
- package/dist/cjs/hooks/usePageLeave/usePageLeave.js +2 -2
- package/dist/cjs/hooks/usePaint/helpers/Paint.js +2 -2
- package/dist/cjs/hooks/usePaint/helpers/Pointer.js +2 -2
- package/dist/cjs/hooks/usePaint/usePaint.js +2 -2
- package/dist/cjs/hooks/useParallax/useParallax.js +2 -2
- package/dist/cjs/hooks/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/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/useRenderCount/useRenderCount.js +1 -1
- package/dist/cjs/hooks/useRenderInfo/useRenderInfo.js +1 -1
- package/dist/cjs/hooks/useRerender/useRerender.js +2 -2
- 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 +3 -0
- package/dist/cjs/hooks/useScroll/useScroll.js.map +1 -0
- package/dist/cjs/hooks/useScrollTo/useScrollTo.js +3 -0
- package/dist/cjs/hooks/useScrollTo/useScrollTo.js.map +1 -0
- package/dist/cjs/hooks/useSessionStorage/useSessionStorage.js +2 -2
- package/dist/cjs/hooks/useSet/useSet.js +2 -2
- package/dist/cjs/hooks/useShare/useShare.js +2 -2
- package/dist/cjs/hooks/useStep/useStep.js +2 -2
- package/dist/cjs/hooks/useStopwatch/useStopwatch.js +2 -2
- package/dist/cjs/hooks/useStorage/useStorage.js +2 -2
- package/dist/cjs/hooks/useTextDirection/useTextDirection.js +2 -2
- package/dist/cjs/hooks/useTextSelection/useTextSelection.js +2 -2
- package/dist/cjs/hooks/useTime/useTime.js +2 -2
- package/dist/cjs/hooks/useTimeout/useTimeout.js +2 -2
- package/dist/cjs/hooks/useTimer/useTimer.js +2 -2
- package/dist/cjs/hooks/useToggle/useToggle.js +2 -2
- package/dist/cjs/hooks/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-DZ6RcVJx.js → index-BiXFlYaY.js} +2 -2
- package/dist/cjs/{index-DZ6RcVJx.js.map → index-BiXFlYaY.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/isClient.js +1 -1
- package/dist/cjs/utils/helpers/isTarget.js +3 -0
- package/dist/cjs/utils/helpers/isTarget.js.map +1 -0
- package/dist/cjs/utils/helpers/throttle.js +1 -1
- package/dist/cjs/utils/helpers/time/getDate.js +1 -1
- package/dist/esm/{_rollupPluginBabelHelpers-CDemqZlw.js → _rollupPluginBabelHelpers-CIijGS7V.js} +2 -2
- package/dist/esm/_rollupPluginBabelHelpers-CIijGS7V.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 +3 -0
- package/dist/esm/hooks/useBluetooth/useBluetooth.js.map +1 -0
- 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/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/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/useDidUpdate/useDidUpdate.js +1 -1
- package/dist/esm/hooks/useDisclosure/useDisclosure.js +2 -2
- package/dist/esm/hooks/useDocumentEvent/useDocumentEvent.js +2 -2
- package/dist/esm/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
- package/dist/esm/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
- package/dist/esm/hooks/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/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/useField/useField.js +2 -2
- package/dist/esm/hooks/useField/useField.js.map +1 -1
- package/dist/esm/hooks/useFileDialog/useFileDialog.js +2 -2
- package/dist/esm/hooks/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/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/useGeolocation/useGeolocation.js.map +1 -1
- 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/useHover/useHover.js.map +1 -1
- 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/useList/useList.js +2 -2
- package/dist/esm/hooks/useLocalStorage/useLocalStorage.js +2 -2
- package/dist/esm/hooks/useLogger/useLogger.js +2 -2
- package/dist/esm/hooks/useLongPress/useLongPress.js +2 -2
- package/dist/esm/hooks/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/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/useOffsetPagination/useOffsetPagination.js +2 -2
- package/dist/esm/hooks/useOnline/useOnline.js +1 -1
- package/dist/esm/hooks/useOperatingSystem/useOperatingSystem.js +1 -1
- package/dist/esm/hooks/useOptimistic/useOptimistic.js +2 -2
- package/dist/esm/hooks/useOrientation/useOrientation.js +2 -2
- package/dist/esm/hooks/useOtpCredential/useOtpCredential.js +2 -2
- package/dist/esm/hooks/usePageLeave/usePageLeave.js +2 -2
- package/dist/esm/hooks/usePaint/helpers/Paint.js +2 -2
- package/dist/esm/hooks/usePaint/helpers/Pointer.js +2 -2
- package/dist/esm/hooks/usePaint/usePaint.js +2 -2
- package/dist/esm/hooks/useParallax/useParallax.js +2 -2
- package/dist/esm/hooks/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/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/useRenderCount/useRenderCount.js +1 -1
- package/dist/esm/hooks/useRenderInfo/useRenderInfo.js +1 -1
- package/dist/esm/hooks/useRerender/useRerender.js +2 -2
- 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 +3 -0
- package/dist/esm/hooks/useScroll/useScroll.js.map +1 -0
- package/dist/esm/hooks/useScrollTo/useScrollTo.js +3 -0
- package/dist/esm/hooks/useScrollTo/useScrollTo.js.map +1 -0
- package/dist/esm/hooks/useSessionStorage/useSessionStorage.js +2 -2
- package/dist/esm/hooks/useSet/useSet.js +2 -2
- package/dist/esm/hooks/useShare/useShare.js +2 -2
- package/dist/esm/hooks/useStep/useStep.js +2 -2
- package/dist/esm/hooks/useStopwatch/useStopwatch.js +2 -2
- package/dist/esm/hooks/useStorage/useStorage.js +2 -2
- package/dist/esm/hooks/useTextDirection/useTextDirection.js +2 -2
- package/dist/esm/hooks/useTextSelection/useTextSelection.js +2 -2
- package/dist/esm/hooks/useTime/useTime.js +2 -2
- package/dist/esm/hooks/useTimeout/useTimeout.js +2 -2
- package/dist/esm/hooks/useTimer/useTimer.js +2 -2
- package/dist/esm/hooks/useToggle/useToggle.js +2 -2
- package/dist/esm/hooks/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-CwUTAeUn.js → index-DJBW4urx.js} +2 -2
- package/dist/esm/{index-CwUTAeUn.js.map → index-DJBW4urx.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/isClient.js +1 -1
- package/dist/esm/utils/helpers/isTarget.js +3 -0
- package/dist/esm/utils/helpers/isTarget.js.map +1 -0
- package/dist/esm/utils/helpers/throttle.js +1 -1
- package/dist/esm/utils/helpers/time/getDate.js +1 -1
- package/dist/types/index.d.ts +165 -28
- package/package.json +108 -107
- package/dist/cjs/_rollupPluginBabelHelpers-QPfaJzmb.js.map +0 -1
- package/dist/esm/_rollupPluginBabelHelpers-CDemqZlw.js.map +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
2
|
import{useRef as r}from"react";import{useIsomorphicLayoutEffect as t}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var o=function(o,e){var i=r(!0);t((function(){if(!i.current){var r=o();return r&&"function"==typeof r?r:void 0}i.current=!1}),e)};export{o as useDidUpdate};
|
|
3
3
|
//# sourceMappingURL=useDidUpdate.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{_ as n}from"../../_rollupPluginBabelHelpers-CIijGS7V.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
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{useEventListener as e}from"../useEventListener/useEventListener.js";import"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{useEventListener as e}from"../useEventListener/useEventListener.js";import"../../_rollupPluginBabelHelpers-CIijGS7V.js";import"react";import"../../utils/helpers/getElement.js";import"../../utils/helpers/isClient.js";import"../useEvent/useEvent.js";var t=function(t,r,s){return e(document,t,r,s)};export{t as useDocumentEvent};
|
|
3
3
|
//# sourceMappingURL=useDocumentEvent.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as t}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{_ as t}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useRef as e,useState as o}from"react";import{useIsomorphicLayoutEffect as r}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import{useMutationObserver as n}from"../useMutationObserver/useMutationObserver.js";import"../../utils/helpers/isClient.js";import"../../utils/helpers/getElement.js";function i(i,u){var l=e(document.title),m=o(null!=i?i:document.title),s=t(m,2),c=s[0],f=s[1];n(document.head.querySelector("title"),(function(){document&&document.title!==c&&f(document.title)}),{childList:!0}),r((function(){if(null!=u&&u.restoreOnUnmount)return function(){document.title=l.current}}),[]);var p=function(t){var e=t.trim();e.length>0&&(document.title=e)};return r((function(){"string"==typeof i&&p(i)}),[i]),[c,p]}export{i as useDocumentTitle};
|
|
3
3
|
//# sourceMappingURL=useDocumentTitle.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
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
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useState as r,useEffect as i}from"react";import{getElement as t}from"../../utils/helpers/getElement.js";import"../../utils/helpers/isClient.js";var n=function(){for(var n=arguments.length,o=new Array(n),l=0;l<n;l++)o[l]=arguments[l];var u=o[0]&&"number"!=typeof o[0].width&&"number"!=typeof o[0].height?o[0]:void 0,s=u?o[1]:o[0],f=r(null!=s?s:{width:0,height:0}),h=e(f,2),a=h[0],p=h[1],m=r(),v=e(m,2),c=v[0],b=v[1];return i((function(){if(u||c){var r=u?t(u):c,i=new ResizeObserver((function(r){var i=e(r,1)[0].borderBoxSize[0],t=i.inlineSize,n=i.blockSize;p({width:t,height:n})}));return r&&i.observe(r),function(){i.disconnect()}}}),[c,u]),u?{value:a}:{ref:b,value:a}};export{n as useElementSize};
|
|
3
3
|
//# sourceMappingURL=useElementSize.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
2
|
import{useRef as r,useCallback as t}from"react";var n=function(n){var e=r(n);return e.current=n,t((function(){return e.current.apply(void 0,arguments)}),[])};export{n as useEvent};
|
|
3
3
|
//# sourceMappingURL=useEvent.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useState as t,useEffect as n}from"react";import{getElement as r}from"../../utils/helpers/getElement.js";import"../../utils/helpers/isClient.js";import{useEvent as i}from"../useEvent/useEvent.js";var o=function(){var o=(arguments.length<=1?void 0:arguments[1])instanceof Function||arguments.length<=0?void 0:arguments[0],l=o?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],u=Array.isArray(l)?l:[l],s=o?arguments.length<=2?void 0:arguments[2]:arguments.length<=1?void 0:arguments[1],v=o?arguments.length<=3?void 0:arguments[3]:arguments.length<=2?void 0:arguments[2],f=t(),a=e(f,2),h=a[0],c=a[1],d=i(s);if(n((function(){if(o||h){var e=function(e){return d(e)},t=o?r(o):h;return t?(u.forEach((function(n){return t.addEventListener(n,e,v)})),function(){u.forEach((function(n){return t.removeEventListener(n,e,v)}))}):void 0}}),[o,h,l,v]),!o)return c};export{o as useEventListener};
|
|
3
3
|
//# sourceMappingURL=useEventListener.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEventListener.js","sources":["../../../../src/hooks/useEventListener/useEventListener.ts"],"sourcesContent":["import type { RefObject } from 'react';\n\nimport { useEffect, useState } from 'react';\n\nimport { getElement } from '@/utils/helpers';\n\nimport { useEvent } from '../useEvent/useEvent';\n\nexport type UseEventListenerTarget =\n | (() => Element)\n | Document\n | Element\n | RefObject<Element | null | undefined>\n | Window;\n\nexport type UseEventListenerOptions = boolean | AddEventListenerOptions;\n\nexport type UseEventListenerReturn<Target extends UseEventListenerTarget> = RefObject<Target>;\n\nexport interface UseEventListener {\n <Event extends keyof WindowEventMap = keyof WindowEventMap>(\n target: Window,\n event: Event | Event[],\n listener: (this: Window, event: WindowEventMap[Event]) => void,\n options?: UseEventListenerOptions\n ): void;\n\n <Event extends keyof DocumentEventMap = keyof DocumentEventMap>(\n target: Document,\n event: Event | Event[],\n listener: (this: Document, event: DocumentEventMap[Event]) => void,\n options?: UseEventListenerOptions\n ): void;\n\n <\n Target extends UseEventListenerTarget,\n Event extends keyof HTMLElementEventMap = keyof HTMLElementEventMap\n >(\n target: Target,\n event: Event | Event[],\n listener: (this: Target, event: HTMLElementEventMap[Event]) => void,\n options?: UseEventListenerOptions\n ): void;\n\n <Target extends Element, Event extends keyof HTMLElementEventMap = keyof HTMLElementEventMap>(\n event: Event | Event[],\n listener: (this: Target, event: HTMLElementEventMap[Event]) => void,\n options?: UseEventListenerOptions,\n target?: never\n ): UseEventListenerReturn<Target>;\n\n <\n Target extends Element,\n Event extends keyof MediaQueryListEventMap = keyof MediaQueryListEventMap\n >(\n event: Event | Event[],\n listener: (this: Target, event: MediaQueryListEventMap[Event]) => void,\n options?: UseEventListenerOptions,\n target?: never\n ): UseEventListenerReturn<Target>;\n}\n\nexport const useEventListener = ((...params: any[]) => {\n const target = (params[1] instanceof Function ? undefined : params[0]) as\n | UseEventListenerTarget\n | undefined;\n const event = (target ? params[1] : params[0]) as string | string[];\n const events = Array.isArray(event) ? event : [event];\n const listener = (target ? params[2] : params[1]) as (...arg: any[]) => undefined | void;\n const options
|
|
1
|
+
{"version":3,"file":"useEventListener.js","sources":["../../../../src/hooks/useEventListener/useEventListener.ts"],"sourcesContent":["import type { RefObject } from 'react';\n\nimport { useEffect, useState } from 'react';\n\nimport { getElement } from '@/utils/helpers';\n\nimport { useEvent } from '../useEvent/useEvent';\n\nexport type UseEventListenerTarget =\n | (() => Element)\n | Document\n | Element\n | RefObject<Element | null | undefined>\n | Window;\n\nexport type UseEventListenerOptions = boolean | AddEventListenerOptions;\n\nexport type UseEventListenerReturn<Target extends UseEventListenerTarget> = RefObject<Target>;\n\nexport interface UseEventListener {\n <Event extends keyof WindowEventMap = keyof WindowEventMap>(\n target: Window,\n event: Event | Event[],\n listener: (this: Window, event: WindowEventMap[Event]) => void,\n options?: UseEventListenerOptions\n ): void;\n\n <Event extends keyof DocumentEventMap = keyof DocumentEventMap>(\n target: Document,\n event: Event | Event[],\n listener: (this: Document, event: DocumentEventMap[Event]) => void,\n options?: UseEventListenerOptions\n ): void;\n\n <\n Target extends UseEventListenerTarget,\n Event extends keyof HTMLElementEventMap = keyof HTMLElementEventMap\n >(\n target: Target,\n event: Event | Event[],\n listener: (this: Target, event: HTMLElementEventMap[Event]) => void,\n options?: UseEventListenerOptions\n ): void;\n\n <Target extends Element, Event extends keyof HTMLElementEventMap = keyof HTMLElementEventMap>(\n event: Event | Event[],\n listener: (this: Target, event: HTMLElementEventMap[Event]) => void,\n options?: UseEventListenerOptions,\n target?: never\n ): UseEventListenerReturn<Target>;\n\n <\n Target extends Element,\n Event extends keyof MediaQueryListEventMap = keyof MediaQueryListEventMap\n >(\n event: Event | Event[],\n listener: (this: Target, event: MediaQueryListEventMap[Event]) => void,\n options?: UseEventListenerOptions,\n target?: never\n ): UseEventListenerReturn<Target>;\n}\n\nexport const useEventListener = ((...params: any[]) => {\n const target = (params[1] instanceof Function ? undefined : params[0]) as\n | UseEventListenerTarget\n | undefined;\n const event = (target ? params[1] : params[0]) as string | string[];\n const events = Array.isArray(event) ? event : [event];\n const listener = (target ? params[2] : params[1]) as (...arg: any[]) => undefined | void;\n const options = (target ? params[3] : params[2]) as UseEventListenerOptions | undefined;\n\n const [internalRef, setInternalRef] = useState<Element>();\n const internalListener = useEvent(listener);\n\n useEffect(() => {\n if (!target && !internalRef) return;\n const callback = (event: Event) => internalListener(event);\n const element = target ? getElement(target) : internalRef;\n if (element) {\n events.forEach((event) => element.addEventListener(event, callback, options));\n return () => {\n events.forEach((event) => element.removeEventListener(event, callback, options));\n };\n }\n }, [target, internalRef, event, options]);\n\n if (target) return;\n return setInternalRef;\n}) as UseEventListener;\n"],"names":["useEventListener","target","arguments","length","undefined","Function","event","events","Array","isArray","listener","options","_useState","useState","_useState2","_slicedToArray","internalRef","setInternalRef","internalListener","useEvent","useEffect","callback","element","getElement","forEach","addEventListener","removeEventListener"],"mappings":";8QA8DaA,EAAoB,WAC/B,IAAMC,GAAUC,UAAAC,QAAA,OAAAC,EAAAF,UAAA,cAAqBG,UAAoBH,UAAAC,QAAAC,OAATA,EAASF,UAE5C,GACPI,EAASL,EAAMC,UAAAC,QAAAC,OAAAA,EAAAF,UAAA,GAAAA,UAAAC,eAAAC,EAAAF,UAA8C,GAC7DK,EAASC,MAAMC,QAAQH,GAASA,EAAQ,CAACA,GACzCI,EAAYT,EAAMC,UAAAC,QAAAC,OAAAA,EAAAF,UAAA,GAAAA,UAAAC,eAAAC,EAAAF,UAAgE,GAClFS,EAAWV,EAAMC,UAAAC,QAAAC,OAAAA,EAAAF,UAAA,GAAAA,UAAAC,eAAAC,EAAAF,UAAgE,GAEvFU,EAAsCC,IAAmBC,EAAAC,EAAAH,EAAA,GAAlDI,EAAWF,EAAA,GAAEG,EAAcH,EAAA,GAC5BI,EAAmBC,EAAST,GAclC,GAZAU,GAAU,WACR,GAAKnB,GAAWe,EAAhB,CACA,IAAMK,EAAW,SAACf,GAAY,OAAKY,EAAiBZ,EAAM,EACpDgB,EAAUrB,EAASsB,EAAWtB,GAAUe,EAC9C,OAAIM,GACFf,EAAOiB,SAAQ,SAAClB,GAAK,OAAKgB,EAAQG,iBAAiBnB,EAAOe,EAAUV,MAC7D,WACLJ,EAAOiB,SAAQ,SAAClB,GAAK,OAAKgB,EAAQI,oBAAoBpB,EAAOe,EAAUV,KACxE,QAJH,CAH6B,CAS9B,GAAE,CAACV,EAAQe,EAAaV,EAAOK,KAE5BV,EACJ,OAAOgB,CACT"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r,d as e,e as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{_ as r,d as e,e as n}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useState as o}from"react";var t=function(){var t="undefined"!=typeof window&&"EyeDropper"in window,p=o(arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0),a=r(p,2),i=a[0],u=a[1],s=function(){var r=e(n().mark((function r(e){var o,t;return n().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(window.EyeDropper){r.next=2;break}throw new Error("EyeDropper is not supported");case 2:return o=new window.EyeDropper,r.next=5,o.open(e);case 5:return t=r.sent,u(t.sRGBHex),r.abrupt("return",t);case 8:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}();return{supported:t,value:i,open:s}};export{t as useEyeDropper};
|
|
3
3
|
//# sourceMappingURL=useEyeDropper.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useState as o}from"react";import{useDidUpdate as t}from"../useDidUpdate/useDidUpdate.js";import{useMount as r}from"../useMount/useMount.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var n=function(n){var i,u=o(null!=n?n:null===(i=document.querySelector('link[rel*="icon"]'))||void 0===i?void 0:i.href),c=e(u,2),l=c[0],p=c[1],s=function(e){var o=document.querySelector('link[rel*="icon"]')||document.createElement("link");o.rel="icon",o.href=e,o.type="image/".concat(e.split(".").pop()),document.head.append(o)};return r((function(){n&&s(n)})),t((function(){n&&(p(n),s(n))}),[n]),{href:l,set:function(e){p(e),s(e)}}};export{n as useFavicon};
|
|
3
3
|
//# sourceMappingURL=useFavicon.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e,d as r,e as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{_ as e,d as r,e as n}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useRef as t,useState as u}from"react";import{useRerender as a}from"../useRerender/useRerender.js";var i=function(i){var l,c,o=null!==(l=null==i?void 0:i.initialValue)&&void 0!==l?l:"",v=t(),d=t(!1),f=a(),s=u(!1),p=e(s,2),m=p[0],h=p[1],g=u(null!==(c=null==i?void 0:i.initialTouched)&&void 0!==c&&c),x=e(g,2),k=x[0],b=x[1],y=u(void 0),L=e(y,2),V=L[0],w=L[1],B=function(){var e,r,n,t;return"radio"===(null===(e=v.current)||void 0===e?void 0:e.type)||"checkbox"===(null===(r=v.current)||void 0===r?void 0:r.type)?v.current.checked:null!==(n=null===(t=v.current)||void 0===t?void 0:t.value)&&void 0!==n?n:o},C=function(e){var r,n;return"radio"===(null===(r=v.current)||void 0===r?void 0:r.type)||"checkbox"===(null===(n=v.current)||void 0===n?void 0:n.type)?(v.current.checked=e,d.current?f.update():void 0):(v.current.value=e,d.current?f.update():void 0)},O=function(e){if(e.required&&!v.current.value)return w(e.required);if(e.minLength&&v.current.value.length<e.minLength.value)return w(e.minLength.message);if(e.maxLength&&v.current.value.length>e.maxLength.value)return w(e.maxLength.message);if(e.min&&Number(v.current.value)<e.min.value)return w(e.min.message);if(e.max&&Number(v.current.value)>e.max.value)return w(e.max.message);if(e.pattern&&!e.pattern.value.test(v.current.value))return w(e.pattern.message);if(e.validate){var r=e.validate(v.current.value);if("string"==typeof r)return w(r)}w(void 0)};return{register:function(e){return{ref:function(r){if(!v.current&&r){if(null!=i&&i.autoFocus&&r.focus(),v.current=r,"radio"===v.current.type)return void(v.current.defaultChecked=(null==i?void 0:i.initialValue)===r.value);if("checkbox"===v.current.type)return void(v.current.defaultChecked=!(null==i||!i.initialValue));v.current.defaultValue=String(o),e&&null!=i&&i.validateOnMount&&O(e)}},onChange:(u=r(n().mark((function r(){return n().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!d.current){r.next=2;break}return r.abrupt("return",f.update());case 2:if(v.current.value!==o&&h(!0),m&&v.current.value===o&&h(!1),!e||null==i||!i.validateOnChange){r.next=7;break}return r.next=7,O(e);case 7:e&&null!=i&&i.validateOnBlur&&w(void 0);case 8:case"end":return r.stop()}}),r)}))),function(){return u.apply(this,arguments)}),onBlur:(t=r(n().mark((function r(){return n().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!e||null==i||!i.validateOnBlur){r.next=3;break}return r.next=3,O(e);case 3:b(!0);case 4:case"end":return r.stop()}}),r)}))),function(){return t.apply(this,arguments)})};var t,u},dirty:m,touched:k,error:V,setError:w,clearError:function(){return w(void 0)},getValue:B,setValue:C,reset:function(){C(o),h(!1),b(!1),w(void 0)},watch:function(){return d.current=!0,B()},focus:function(){v.current.focus()}}};export{i as useField};
|
|
3
3
|
//# sourceMappingURL=useField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useField.js","sources":["../../../../src/hooks/useField/useField.ts"],"sourcesContent":["import { useRef, useState } from 'react';\n\nimport { useRerender } from '../useRerender/useRerender';\n\n/** The use field params type */\nexport interface UseFieldParams<Value> {\n /** The auto focus */\n autoFocus?: boolean;\n /** The initial touched */\n initialTouched?: boolean;\n /** The initial value */\n initialValue?: Value;\n /** The validate on blur */\n validateOnBlur?: boolean;\n /** The validate on mount */\n validateOnChange?: boolean;\n /** The validate on mount */\n validateOnMount?: boolean;\n}\n\n/** The use field register params type */\nexport interface UseFieldRegisterParams {\n /** The required validation */\n required?: string;\n /** The custom validation */\n validate?: (value: string) => Promise<string | true>;\n /** The min value validation */\n max?: {\n value: number;\n message: string;\n };\n /** The max length validation */\n maxLength?: {\n value: number;\n message: string;\n };\n /** The max value validation */\n min?: {\n value: number;\n message: string;\n };\n /** The min length validation */\n minLength?: {\n value: number;\n message: string;\n };\n /** The pattern validation */\n pattern?: {\n value: RegExp;\n message: string;\n };\n}\n\n/** The use field return type */\nexport interface UseFieldReturn<Value> {\n /** The dirty state */\n dirty: boolean;\n /** The error state */\n error?: string;\n /** The set error function */\n touched: boolean;\n /** The set error function */\n clearError: () => void;\n /** The focus function */\n focus: () => void;\n /** The get value function */\n getValue: () => Value;\n /** The register function */\n register: (params?: UseFieldRegisterParams) => {\n onBlur: () => void;\n onChange: () => void;\n ref: (\n node: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | null | undefined\n ) => void;\n };\n /** The reset function */\n reset: () => void;\n /** The set error function */\n setError: (error: string) => void;\n /** The set value function */\n setValue: (value: Value) => void;\n /** The watch function */\n watch: () => Value;\n}\n\n/**\n * @name useField\n * @description - Hook to manage a form field\n * @category Utilities\n *\n * @template Value The input value\n * @template Type The input value type\n * @param {Value} [params.initialValue] Initial value\n * @param {boolean} [params.initialTouched=false] Initial touched state\n * @param {boolean} [params.autoFocus=false] Auto focus\n * @param {boolean} [params.validateOnChange=false] Validate on change\n * @param {boolean} [params.validateOnBlur=false] Validate on blur\n * @param {boolean} [params.validateOnMount=false] Validate on mount\n * @returns {UseFieldReturn<Value>} An object containing input information\n *\n * @example\n * const { register, getValue, setValue, reset, dirty, error, setError, clearError, touched, focus, watch } = useField();\n */\nexport const useField = <\n Value extends boolean | string = string,\n Type = Value extends string ? string : boolean\n>(\n params?: UseFieldParams<Value>\n): UseFieldReturn<Type> => {\n const initialValue = (params?.initialValue ?? '') as Value;\n\n const inputRef = useRef<HTMLInputElement>();\n const watchingRef = useRef(false);\n const rerender = useRerender();\n\n const [dirty, setDirty] = useState(false);\n const [touched, setTouched] = useState(params?.initialTouched ?? false);\n const [error, setError] = useState<string | undefined>(undefined);\n\n const getValue = () => {\n if (inputRef.current?.type === 'radio' || inputRef.current?.type === 'checkbox')\n return inputRef.current.checked as Type;\n return (inputRef.current?.value ?? initialValue) as Type;\n };\n\n const setValue = (value: Type) => {\n if (inputRef.current?.type === 'radio' || inputRef.current?.type === 'checkbox') {\n inputRef.current.checked = value as boolean;\n if (watchingRef.current) return rerender.update();\n return;\n }\n\n inputRef.current!.value = value as string;\n if (watchingRef.current) return rerender.update();\n };\n\n const reset = () => {\n setValue(initialValue as unknown as Type);\n setDirty(false);\n setTouched(false);\n setError(undefined);\n };\n\n const focus = () => {\n inputRef.current!.focus();\n };\n\n const validate = (params: UseFieldRegisterParams) => {\n if (params.required && !inputRef.current!.value) {\n return setError(params.required);\n }\n\n if (params.minLength && inputRef.current!.value.length < params.minLength.value) {\n return setError(params.minLength.message);\n }\n\n if (params.maxLength && inputRef.current!.value.length > params.maxLength.value) {\n return setError(params.maxLength.message);\n }\n\n if (params.min && Number(inputRef.current!.value) < params.min.value) {\n return setError(params.min.message);\n }\n\n if (params.max && Number(inputRef.current!.value) > params.max.value) {\n return setError(params.max.message);\n }\n\n if (params.pattern && !params.pattern.value.test(inputRef.current!.value)) {\n return setError(params.pattern.message);\n }\n\n if (params.validate) {\n const error = params.validate(inputRef.current!.value);\n if (typeof error === 'string') return setError(error);\n }\n\n setError(undefined);\n };\n\n const register = (registerParams?: UseFieldRegisterParams) => ({\n ref: (node: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | null | undefined) => {\n if (!inputRef.current && node) {\n if (params?.autoFocus) node.focus();\n inputRef.current = node as HTMLInputElement;\n if (inputRef.current.type === 'radio') {\n inputRef.current.defaultChecked = params?.initialValue === node.value;\n return;\n }\n if (inputRef.current.type === 'checkbox') {\n inputRef.current.defaultChecked = !!params?.initialValue;\n return;\n }\n inputRef.current.defaultValue = String(initialValue);\n\n if (registerParams && params?.validateOnMount) validate(registerParams);\n }\n },\n onChange: async () => {\n if (watchingRef.current) return rerender.update();\n if (inputRef.current!.value !== initialValue) setDirty(true);\n if (dirty && inputRef.current!.value === initialValue) setDirty(false);\n if (registerParams && params?.validateOnChange) await validate(registerParams);\n if (registerParams && params?.validateOnBlur) setError(undefined);\n },\n onBlur: async () => {\n if (registerParams && params?.validateOnBlur) await validate(registerParams);\n setTouched(true);\n }\n });\n\n const watch = () => {\n watchingRef.current = true;\n return getValue();\n };\n\n const clearError = () => setError(undefined);\n\n return {\n register,\n dirty,\n touched,\n error,\n setError,\n clearError,\n getValue,\n setValue,\n reset,\n watch,\n focus\n };\n};\n"],"names":["useField","params","_params$initialValue","_params$initialTouche","initialValue","inputRef","useRef","watchingRef","rerender","useRerender","_useState","useState","_useState2","_slicedToArray","dirty","setDirty","_useState3","initialTouched","_useState4","touched","setTouched","_useState5","undefined","_useState6","error","setError","getValue","_inputRef$current","_inputRef$current2","_inputRef$current$val","_inputRef$current3","current","type","checked","value","setValue","_inputRef$current4","_inputRef$current5","update","validate","required","minLength","length","message","maxLength","min","Number","max","pattern","test","register","registerParams","ref","node","autoFocus","focus","defaultChecked","defaultValue","String","validateOnMount","onChange","_onChange","_asyncToGenerator","_regeneratorRuntime","mark","_callee","wrap","_context","prev","next","abrupt","validateOnChange","validateOnBlur","stop","apply","this","arguments","onBlur","_onBlur","_callee2","_context2","clearError","reset","watch"],"mappings":";2LAuGaA,EAAW,SAItBC,GACyB,IAAAC,EAAAC,EACnBC,EAAoCF,QAAxBA,EAAID,aAAM,EAANA,EAAQG,oBAAYF,IAAAA,EAAAA,EAAI,GAExCG,EAAWC,IACXC,EAAcD,GAAO,GACrBE,EAAWC,IAEjBC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+
{"version":3,"file":"useField.js","sources":["../../../../src/hooks/useField/useField.ts"],"sourcesContent":["import { useRef, useState } from 'react';\n\nimport { useRerender } from '../useRerender/useRerender';\n\n/** The use field params type */\nexport interface UseFieldParams<Value> {\n /** The auto focus */\n autoFocus?: boolean;\n /** The initial touched */\n initialTouched?: boolean;\n /** The initial value */\n initialValue?: Value;\n /** The validate on blur */\n validateOnBlur?: boolean;\n /** The validate on mount */\n validateOnChange?: boolean;\n /** The validate on mount */\n validateOnMount?: boolean;\n}\n\n/** The use field register params type */\nexport interface UseFieldRegisterParams {\n /** The required validation */\n required?: string;\n /** The custom validation */\n validate?: (value: string) => Promise<string | true>;\n /** The min value validation */\n max?: {\n value: number;\n message: string;\n };\n /** The max length validation */\n maxLength?: {\n value: number;\n message: string;\n };\n /** The max value validation */\n min?: {\n value: number;\n message: string;\n };\n /** The min length validation */\n minLength?: {\n value: number;\n message: string;\n };\n /** The pattern validation */\n pattern?: {\n value: RegExp;\n message: string;\n };\n}\n\n/** The use field return type */\nexport interface UseFieldReturn<Value> {\n /** The dirty state */\n dirty: boolean;\n /** The error state */\n error?: string;\n /** The set error function */\n touched: boolean;\n /** The set error function */\n clearError: () => void;\n /** The focus function */\n focus: () => void;\n /** The get value function */\n getValue: () => Value;\n /** The register function */\n register: (params?: UseFieldRegisterParams) => {\n onBlur: () => void;\n onChange: () => void;\n ref: (\n node: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | null | undefined\n ) => void;\n };\n /** The reset function */\n reset: () => void;\n /** The set error function */\n setError: (error: string) => void;\n /** The set value function */\n setValue: (value: Value) => void;\n /** The watch function */\n watch: () => Value;\n}\n\n/**\n * @name useField\n * @description - Hook to manage a form field\n * @category Utilities\n *\n * @template Value The input value\n * @template Type The input value type\n * @param {Value} [params.initialValue] Initial value\n * @param {boolean} [params.initialTouched=false] Initial touched state\n * @param {boolean} [params.autoFocus=false] Auto focus\n * @param {boolean} [params.validateOnChange=false] Validate on change\n * @param {boolean} [params.validateOnBlur=false] Validate on blur\n * @param {boolean} [params.validateOnMount=false] Validate on mount\n * @returns {UseFieldReturn<Value>} An object containing input information\n *\n * @example\n * const { register, getValue, setValue, reset, dirty, error, setError, clearError, touched, focus, watch } = useField();\n */\nexport const useField = <\n Value extends boolean | number | string = string,\n Type = Value extends string ? string : Value extends boolean ? boolean : number\n>(\n params?: UseFieldParams<Value>\n): UseFieldReturn<Type> => {\n const initialValue = (params?.initialValue ?? '') as Value;\n\n const inputRef = useRef<HTMLInputElement>();\n const watchingRef = useRef(false);\n const rerender = useRerender();\n\n const [dirty, setDirty] = useState(false);\n const [touched, setTouched] = useState(params?.initialTouched ?? false);\n const [error, setError] = useState<string | undefined>(undefined);\n\n const getValue = () => {\n if (inputRef.current?.type === 'radio' || inputRef.current?.type === 'checkbox')\n return inputRef.current.checked as Type;\n return (inputRef.current?.value ?? initialValue) as Type;\n };\n\n const setValue = (value: Type) => {\n if (inputRef.current?.type === 'radio' || inputRef.current?.type === 'checkbox') {\n inputRef.current.checked = value as boolean;\n if (watchingRef.current) return rerender.update();\n return;\n }\n\n inputRef.current!.value = value as string;\n if (watchingRef.current) return rerender.update();\n };\n\n const reset = () => {\n setValue(initialValue as unknown as Type);\n setDirty(false);\n setTouched(false);\n setError(undefined);\n };\n\n const focus = () => {\n inputRef.current!.focus();\n };\n\n const validate = (params: UseFieldRegisterParams) => {\n if (params.required && !inputRef.current!.value) {\n return setError(params.required);\n }\n\n if (params.minLength && inputRef.current!.value.length < params.minLength.value) {\n return setError(params.minLength.message);\n }\n\n if (params.maxLength && inputRef.current!.value.length > params.maxLength.value) {\n return setError(params.maxLength.message);\n }\n\n if (params.min && Number(inputRef.current!.value) < params.min.value) {\n return setError(params.min.message);\n }\n\n if (params.max && Number(inputRef.current!.value) > params.max.value) {\n return setError(params.max.message);\n }\n\n if (params.pattern && !params.pattern.value.test(inputRef.current!.value)) {\n return setError(params.pattern.message);\n }\n\n if (params.validate) {\n const error = params.validate(inputRef.current!.value);\n if (typeof error === 'string') return setError(error);\n }\n\n setError(undefined);\n };\n\n const register = (registerParams?: UseFieldRegisterParams) => ({\n ref: (node: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | null | undefined) => {\n if (!inputRef.current && node) {\n if (params?.autoFocus) node.focus();\n inputRef.current = node as HTMLInputElement;\n if (inputRef.current.type === 'radio') {\n inputRef.current.defaultChecked = params?.initialValue === node.value;\n return;\n }\n if (inputRef.current.type === 'checkbox') {\n inputRef.current.defaultChecked = !!params?.initialValue;\n return;\n }\n inputRef.current.defaultValue = String(initialValue);\n\n if (registerParams && params?.validateOnMount) validate(registerParams);\n }\n },\n onChange: async () => {\n if (watchingRef.current) return rerender.update();\n if (inputRef.current!.value !== initialValue) setDirty(true);\n if (dirty && inputRef.current!.value === initialValue) setDirty(false);\n if (registerParams && params?.validateOnChange) await validate(registerParams);\n if (registerParams && params?.validateOnBlur) setError(undefined);\n },\n onBlur: async () => {\n if (registerParams && params?.validateOnBlur) await validate(registerParams);\n setTouched(true);\n }\n });\n\n const watch = () => {\n watchingRef.current = true;\n return getValue();\n };\n\n const clearError = () => setError(undefined);\n\n return {\n register,\n dirty,\n touched,\n error,\n setError,\n clearError,\n getValue,\n setValue,\n reset,\n watch,\n focus\n };\n};\n"],"names":["useField","params","_params$initialValue","_params$initialTouche","initialValue","inputRef","useRef","watchingRef","rerender","useRerender","_useState","useState","_useState2","_slicedToArray","dirty","setDirty","_useState3","initialTouched","_useState4","touched","setTouched","_useState5","undefined","_useState6","error","setError","getValue","_inputRef$current","_inputRef$current2","_inputRef$current$val","_inputRef$current3","current","type","checked","value","setValue","_inputRef$current4","_inputRef$current5","update","validate","required","minLength","length","message","maxLength","min","Number","max","pattern","test","register","registerParams","ref","node","autoFocus","focus","defaultChecked","defaultValue","String","validateOnMount","onChange","_onChange","_asyncToGenerator","_regeneratorRuntime","mark","_callee","wrap","_context","prev","next","abrupt","validateOnChange","validateOnBlur","stop","apply","this","arguments","onBlur","_onBlur","_callee2","_context2","clearError","re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ACA+C,MA3FY,WACZ/C,EAAS/B,GACTW,GAAS,GACTK,GAAW,GACXK,OAASH,EACV,EAuFC6D,MAjBY,WAEZ,OADA5E,EAAYwB,SAAU,EACfL,GACR,EAeC6B,MAtFY,WACZlD,EAAS0B,QAASwB,OACnB,EAsFH"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as l}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{_ as l}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useState as n,useRef as u,useEffect as e}from"react";var r=!0,t="*",i=!1,o=function(){var o="function"==typeof(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,c=o?arguments.length<=0?void 0:arguments[0]:arguments.length<=1?void 0:arguments[1],v=n(null),d=l(v,2),a=d[0],p=d[1],f=u(),m=u(o);m.current=o;var s=function(){var l;p(null),null===(l=m.current)||void 0===l||l.call(m,null),f.current&&(f.current.value="")};return e((function(){var l;return f.current=((l=document.createElement("input")).type="file",l.onchange=function(l){var n,u=l.target.files;p(u),null===(n=m.current)||void 0===n||n.call(m,u)},l),function(){var l;null===(l=f.current)||void 0===l||l.remove()}}),[null==c?void 0:c.multiple,null==c?void 0:c.accept,null==c?void 0:c.capture,null==c?void 0:c.reset]),{value:a,open:function(l){var n,u,e,o,v,d,a;if(f.current){f.current.multiple=null!==(n=null!==(u=null==l?void 0:l.multiple)&&void 0!==u?u:null==c?void 0:c.multiple)&&void 0!==n?n:r,f.current.accept=null!==(e=null!==(o=null==l?void 0:l.accept)&&void 0!==o?o:null==c?void 0:c.accept)&&void 0!==e?e:t;var p=null!==(v=null==l?void 0:l.capture)&&void 0!==v?v:null==c?void 0:c.capture;p&&(f.current.capture=p),(null!==(d=null!==(a=null==l?void 0:l.reset)&&void 0!==a?a:null==c?void 0:c.reset)&&void 0!==d?d:i)&&s(),f.current.click()}},reset:s}};export{o as useFileDialog};
|
|
3
3
|
//# sourceMappingURL=useFileDialog.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useState as e,useRef as t,useEffect as n}from"react";import{getElement as i}from"../../utils/helpers/getElement.js";import"../../utils/helpers/isClient.js";import{isTarget as o}from"../../utils/helpers/isTarget.js";var u=function(){var u,l,s=o(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,v=null!==(l=(null!==(u=s?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0])&&void 0!==u?u:{}).initialValue)&&void 0!==l&&l,c=e(v),f=r(c,2),a=f[0],d=f[1],m=e(),p=r(m,2),g=p[0],h=p[1],b=t(),E=function(){var r;return null===(r=b.current)||void 0===r?void 0:r.focus()},j=function(){var r;return null===(r=b.current)||void 0===r?void 0:r.blur()};return n((function(){var r=s?i(s):g;if(r){b.current=r;var e=function(r){var e,t;(!E||null!==(e=(t=r.target).matches)&&void 0!==e&&e.call(t,":focus-visible"))&&d(!0)},t=function(){return d(!1)};return v&&r.focus(),r.addEventListener("focus",e),r.addEventListener("blur",t),function(){r.removeEventListener("focus",e),r.removeEventListener("blur",t)}}}),[g,s]),s?{focus:E,blur:j,focused:a}:{ref:h,focus:E,blur:j,focused:a}};export{u as useFocus};
|
|
3
3
|
//# sourceMappingURL=useFocus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFocus.js","sources":["../../../../src/hooks/useFocus/useFocus.ts"],"sourcesContent":["import type { RefObject } from 'react';\n\nimport { useEffect, useRef, useState } from 'react';\n\nimport { getElement } from '@/utils/helpers';\n\n/** The use focus target type */\nexport type UseFocusTarget
|
|
1
|
+
{"version":3,"file":"useFocus.js","sources":["../../../../src/hooks/useFocus/useFocus.ts"],"sourcesContent":["import type { RefObject } from 'react';\n\nimport { useEffect, useRef, useState } from 'react';\n\nimport { getElement, isTarget } from '@/utils/helpers';\n\n/** The use focus target type */\nexport type UseFocusTarget =\n | (() => Element)\n | string\n | Element\n | RefObject<Element | null | undefined>;\n\n/** The use focus options type */\nexport interface UseFocusOptions {\n /** The initial focus state of the target */\n initialValue?: boolean;\n}\n\n/** The use focus return type */\nexport interface UseFocusReturn {\n /** The boolean state value of the target */\n focused: boolean;\n /** Is the target focused */\n blur: () => void;\n /** Is the target focused */\n focus: () => void;\n}\n\nexport interface UseFocus {\n <Target extends UseFocusTarget>(\n options?: UseFocusOptions\n ): UseFocusReturn & { ref: (node: Target) => void };\n\n <Target extends UseFocusTarget>(target: Target, options?: UseFocusOptions): UseFocusReturn;\n}\n\n/**\n * @name useFocus\n * @description - Hook that allows you to focus on a specific element\n * @category Browser\n *\n * @overload\n * @template Target The target element\n * @param {Target} target The target element to focus\n * @param {boolean} [options.initialValue=false] The initial focus state of the target\n * @returns {UseFocusReturn} An object with a `focus` boolean state value\n *\n * @example\n * const { focus, blur, focused } = useFocus(ref);\n *\n * @overload\n * @param {boolean} [options.initialValue=false] The initial focus state of the target\n * @returns {UseFocusReturn} An object with a `focus` boolean state value\n *\n * @example\n * const { ref, focus, blur, focused } = useFocus();\n */\nexport const useFocus = ((...params: any[]) => {\n const target = isTarget(params[0]) ? params[0] : undefined;\n const options = ((target ? params[1] : params[0]) as UseFocusOptions) ?? {};\n const initialValue = options.initialValue ?? false;\n\n const [focused, setFocused] = useState(initialValue);\n const [internalRef, setInternalRef] = useState<Element>();\n\n const elementRef = useRef<HTMLElement>();\n\n const focus = () => elementRef.current?.focus();\n const blur = () => elementRef.current?.blur();\n\n useEffect(() => {\n const element = (target ? getElement(target) : internalRef) as HTMLElement;\n if (!element) return;\n elementRef.current = element;\n\n const onFocus = (event: Event) => {\n if (!focus || (event.target as HTMLElement).matches?.(':focus-visible')) setFocused(true);\n };\n const onBlur = () => setFocused(false);\n if (initialValue) element.focus();\n\n element.addEventListener('focus', onFocus);\n element.addEventListener('blur', onBlur);\n\n return () => {\n element.removeEventListener('focus', onFocus);\n element.removeEventListener('blur', onBlur);\n };\n }, [internalRef, target]);\n\n if (target) return { focus, blur, focused };\n return {\n ref: setInternalRef,\n focus,\n blur,\n focused\n };\n}) as UseFocus;\n"],"names":["useFocus","_ref","_options$initialValue","target","isTarget","arguments","length","undefined","initialValue","_useState","useState","_useState2","_slicedToArray","focused","setFocused","_useState3","_useState4","internalRef","setInternalRef","elementRef","useRef","focus","_elementRef$current","current","blur","_elementRef$current2","useEffect","element","getElement","onFocus","event","_matches","_ref2","matches","call","onBlur","addEventListener","removeEventListener","ref"],"mappings":";kSA0DaA,EAAY,WAAsB,IAAAC,EAAAC,EACvCC,EAASC,EAAQC,UAAAC,QAAAC,OAAAA,EAAAF,cAAWA,UAAAC,eAAAC,EAAAF,UAAA,QAAeE,EAE3CC,EAAmC,QAAvBN,GAD8BD,QAAnCA,EAAKE,EAAME,UAAAC,QAAA,OAAAC,EAAAF,UAAA,GAAAA,UAAAC,QAAA,OAAAC,EAAAF,UAAA,UAAwBJ,IAAAA,EAAAA,EAAyB,CAAE,GAC9CO,oBAAY,IAAAN,GAAAA,EAEzCO,EAA8BC,EAASF,GAAaG,EAAAC,EAAAH,EAAA,GAA7CI,EAAOF,EAAA,GAAEG,EAAUH,EAAA,GAC1BI,EAAsCL,IAAmBM,EAAAJ,EAAAG,EAAA,GAAlDE,EAAWD,EAAA,GAAEE,EAAcF,EAAA,GAE5BG,EAAaC,IAEbC,EAAQ,WAAH,IAAAC,EAAA,OAA2B,QAA3BA,EAASH,EAAWI,eAAO,IAAAD,OAAA,EAAlBA,EAAoBD,OAAO,EACzCG,EAAO,WAAH,IAAAC,EAAA,OAA2B,QAA3BA,EAASN,EAAWI,eAAO,IAAAE,OAAA,EAAlBA,EAAoBD,MAAM,EAsB7C,OApBAE,GAAU,WACR,IAAMC,EAAWxB,EAASyB,EAAWzB,GAAUc,EAC/C,GAAKU,EAAL,CACAR,EAAWI,QAAUI,EAErB,IAAME,EAAU,SAACC,GAAiB,IAAAC,EAAAC,IAC3BX,GAA8C,QAAzCU,GAAIC,EAACF,EAAM3B,QAAuB8B,eAAO,IAAAF,GAArCA,EAAAG,KAAAF,EAAwC,oBAAmBlB,GAAW,EACrF,EACKqB,EAAS,WAAH,OAASrB,GAAW,EAAM,EAMtC,OALIN,GAAcmB,EAAQN,QAE1BM,EAAQS,iBAAiB,QAASP,GAClCF,EAAQS,iBAAiB,OAAQD,GAE1B,WACLR,EAAQU,oBAAoB,QAASR,GACrCF,EAAQU,oBAAoB,OAAQF,EACrC,CAfa,CAgBhB,GAAG,CAAClB,EAAad,IAEbA,EAAe,CAAEkB,MAAAA,EAAOG,KAAAA,EAAMX,QAAAA,GAC3B,CACLyB,IAAKpB,EACLG,MAAAA,EACAG,KAAAA,EACAX,QAAAA,EAEJ"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useState as n,useEffect as e}from"react";var a=function(){var a=n(0),o=r(a,2),t=o[0],i=o[1];return e((function(){var r,n=0,e=performance.now(),a=function(){n+=1;var o=performance.now(),t=o-e;if(t>=1e3){var m=Math.round(1e3*n/t);i(m),n=0,e=o}r=requestAnimationFrame(a)};return r=requestAnimationFrame(a),function(){cancelAnimationFrame(r)}}),[]),t};export{a as useFps};
|
|
3
3
|
//# sourceMappingURL=useFps.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.81 */
|
|
2
|
+
import{_ as e,c as n}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useState as l}from"react";import{s as i}from"../../index-DJBW4urx.js";import{getElement as o}from"../../utils/helpers/getElement.js";import"../../utils/helpers/isClient.js";import{useUnmount as t}from"../useUnmount/useUnmount.js";var r=function(){var r,s=void 0===(arguments.length<=1?void 0:arguments[1])||arguments.length<=0?void 0:arguments[0],u=s?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],a=l(),f=e(a,2),c=f[0],d=f[1],m=l(null!==(r=null==u?void 0:u.initialValue)&&void 0!==r&&r),v=e(m,2),g=v[0],p=v[1],h=function(){if(i.isEnabled){var e,n;if(i.isFullscreen)null==u||null===(e=u.onEnter)||void 0===e||e.call(u);else i.off("change",h),null==u||null===(n=u.onExit)||void 0===n||n.call(u);p(i.isFullscreen)}},E=function(){var e=s?o(s):c;if(e&&i.isEnabled)try{i.request(e),i.on("change",h)}catch(e){console.error(e)}},b=function(){i.isEnabled&&i.exit()};return t((function(){i.isEnabled&&i.off("change",h)})),n(n({},!s&&{ref:d}),{},{enter:E,exit:b,toggle:function(){if(g)return b();E()},value:g})};export{r as useFullscreen};
|
|
3
3
|
//# sourceMappingURL=useFullscreen.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
2
|
var t=function(t){return{buttons:{a:t.buttons[0],b:t.buttons[1],x:t.buttons[2],y:t.buttons[3]},bumper:{left:t.buttons[4],right:t.buttons[5]},triggers:{left:t.buttons[6],right:t.buttons[7]},stick:{left:{horizontal:t.axes[0],vertical:t.axes[1],button:t.buttons[10]},right:{horizontal:t.axes[2],vertical:t.axes[3],button:t.buttons[11]}},dpad:{up:t.buttons[12],down:t.buttons[13],left:t.buttons[14],right:t.buttons[15]},back:t.buttons[8],start:t.buttons[9]}};export{t as mapGamepadToXbox360Controller};
|
|
3
3
|
//# sourceMappingURL=mapGamepadToXbox360Controller.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e,c as t,f as a,a as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{_ as e,c as t,f as a,a as n}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useState as r,useEffect as o}from"react";import{useEvent as i}from"../useEvent/useEvent.js";import{useRaf as c}from"../useRaf/useRaf.js";export{mapGamepadToXbox360Controller}from"./helpers/mapGamepadToXbox360Controller.js";var u=function(){var u="undefined"!=typeof navigator&&"getGamepads"in navigator,d=r({}),p=e(d,2),s=p[0],m=p[1],v=c((function(){}),{enabled:!!Object.keys(s).length}).active,f=function(e){var a=[],r="vibrationActuator"in e?e.vibrationActuator:null;return r&&a.push(r),e.hapticActuators&&a.push.apply(a,n(e.hapticActuators)),t(t({},e),{},{hapticActuators:a})};o((function(){if(u){var e=navigator.getGamepads();m(e.reduce((function(e,n){return t(t({},e),n&&a({},n.index,f(n)))}),{}))}}),[]);var l=i((function(e){var n=e.gamepad;m(t(t({},s),{},a({},n.index,f(n))))})),g=i((function(e){var a=e.gamepad,n=t({},s);delete n[a.index],m(n)}));return o((function(){return document.addEventListener("gamepadconnected",l),document.addEventListener("gamepaddisconnected",g),function(){document.removeEventListener("gamepadconnected",l),document.removeEventListener("gamepaddisconnected",g)}}),[]),{active:v,supported:u,gamepads:Object.values(s)}};export{u as useGamepad};
|
|
3
3
|
//# sourceMappingURL=useGamepad.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as t,c as a}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{_ as t,c as a}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useState as e,useEffect as i}from"react";var o=function(o){var l=e({loading:!0,error:null,timestamp:Date.now(),accuracy:0,latitude:Number.POSITIVE_INFINITY,longitude:Number.POSITIVE_INFINITY,altitude:null,altitudeAccuracy:null,heading:null,speed:null}),n=t(l,2),u=n[0],r=n[1];return i((function(){var t=function(t){var e=t.coords,i=t.timestamp;r(a(a({},u),{},{loading:!1,timestamp:i,latitude:e.latitude,longitude:e.longitude,altitude:e.altitude,accuracy:e.accuracy,altitudeAccuracy:e.altitudeAccuracy,heading:e.heading,speed:e.speed}))},e=function(t){r(a(a({},u),{},{loading:!1,error:t}))};navigator.geolocation.getCurrentPosition(t,e,o);var i=navigator.geolocation.watchPosition(t,e,o);return function(){navigator.geolocation.clearWatch(i)}}),[null==o?void 0:o.enableHighAccuracy,null==o?void 0:o.maximumAge,null==o?void 0:o.timeout]),u};export{o as useGeolocation};
|
|
3
3
|
//# sourceMappingURL=useGeolocation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGeolocation.js","sources":["../../../../src/hooks/useGeolocation/useGeolocation.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/** The use geolocation return type */\nexport interface UseGeolocationReturn {\n /** The accuracy of the last position update */\n accuracy: number | null;\n /** The altitude of the last position update */\n altitude: number | null;\n /** The altitude accuracy of the last position update */\n altitudeAccuracy: number | null;\n /** The error of the last position update */\n error: GeolocationPositionError | null;\n /** The heading of the last position update */\n heading: number | null;\n /** The latitude of the last position update */\n latitude: number | null;\n /** The loading state */\n loading: boolean;\n /** The longitude of the last position update */\n longitude: number | null;\n /** The speed of the last position update */\n speed: number | null;\n /** The timestamp of the last position update */\n timestamp: number | null;\n}\n\n/** The use geolocation params type */\nexport type UseGeolocationParams = PositionOptions;\n\n/**\n * @name useGeolocation\n * @description - Hook that returns the current geolocation\n * @category Browser\n *\n * @param {boolean} [params.enableHighAccuracy] Enable high accuracy\n * @param {number} [params.maximumAge] Maximum age\n * @param {number} [params.timeout] Timeout\n * @returns {UseGeolocationReturn}\n *\n * @example\n * const { loading, error, timestamp, accuracy, latitude, longitude, altitude, altitudeAccuracy, heading, speed } = useGeolocation();\n */\nexport const useGeolocation = (params?: UseGeolocationParams): UseGeolocationReturn => {\n const [value, setValue] = useState<
|
|
1
|
+
{"version":3,"file":"useGeolocation.js","sources":["../../../../src/hooks/useGeolocation/useGeolocation.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\r\n\r\n/** The use geolocation return type */\r\nexport interface UseGeolocationReturn {\r\n /** The accuracy of the last position update */\r\n accuracy: number | null;\r\n /** The altitude of the last position update */\r\n altitude: number | null;\r\n /** The altitude accuracy of the last position update */\r\n altitudeAccuracy: number | null;\r\n /** The error of the last position update */\r\n error: GeolocationPositionError | null;\r\n /** The heading of the last position update */\r\n heading: number | null;\r\n /** The latitude of the last position update */\r\n latitude: number | null;\r\n /** The loading state */\r\n loading: boolean;\r\n /** The longitude of the last position update */\r\n longitude: number | null;\r\n /** The speed of the last position update */\r\n speed: number | null;\r\n /** The timestamp of the last position update */\r\n timestamp: number | null;\r\n}\r\n\r\n/** The use geolocation params type */\r\nexport type UseGeolocationParams = PositionOptions;\r\n\r\n/**\r\n * @name useGeolocation\r\n * @description - Hook that returns the current geolocation\r\n * @category Browser\r\n *\r\n * @param {boolean} [params.enableHighAccuracy] Enable high accuracy\r\n * @param {number} [params.maximumAge] Maximum age\r\n * @param {number} [params.timeout] Timeout\r\n * @returns {UseGeolocationReturn}\r\n *\r\n * @example\r\n * const { loading, error, timestamp, accuracy, latitude, longitude, altitude, altitudeAccuracy, heading, speed } = useGeolocation();\r\n */\r\nexport const useGeolocation = (params?: UseGeolocationParams): UseGeolocationReturn => {\r\n const [value, setValue] = useState<UseGeolocationReturn>({\r\n loading: true,\r\n error: null,\r\n timestamp: Date.now(),\r\n accuracy: 0,\r\n latitude: Number.POSITIVE_INFINITY,\r\n longitude: Number.POSITIVE_INFINITY,\r\n altitude: null,\r\n altitudeAccuracy: null,\r\n heading: null,\r\n speed: null\r\n });\r\n\r\n useEffect(() => {\r\n const onEvent = ({ coords, timestamp }: GeolocationPosition) => {\r\n setValue({\r\n ...value,\r\n loading: false,\r\n timestamp,\r\n latitude: coords.latitude,\r\n longitude: coords.longitude,\r\n altitude: coords.altitude,\r\n accuracy: coords.accuracy,\r\n altitudeAccuracy: coords.altitudeAccuracy,\r\n heading: coords.heading,\r\n speed: coords.speed\r\n });\r\n };\r\n\r\n const onEventError = (error: GeolocationPositionError) => {\r\n setValue({\r\n ...value,\r\n loading: false,\r\n error\r\n });\r\n };\r\n\r\n navigator.geolocation.getCurrentPosition(onEvent, onEventError, params);\r\n const watchId = navigator.geolocation.watchPosition(onEvent, onEventError, params);\r\n\r\n return () => {\r\n navigator.geolocation.clearWatch(watchId);\r\n };\r\n }, [params?.enableHighAccuracy, params?.maximumAge, params?.timeout]);\r\n\r\n return value;\r\n};\r\n"],"names":["useGeolocation","params","_useState","useState","loading","error","timestamp","Date","now","accuracy","latitude","Number","POSITIVE_INFINITY","longitude","altitude","altitudeAccuracy","heading","speed","_useState2","_slicedToArray","value","setValue","useEffect","onEvent","_ref","coords","_objectSpread","onEventError","navigator","geolocation","getCurrentPosition","watchId","watchPosition","clearWatch","enableHighAccuracy","maximumAge","timeout"],"mappings":";2HA0CaA,EAAiB,SAACC,GAC7B,IAAAC,EAA0BC,EAA+B,CACvDC,SAAS,EACTC,MAAO,KACPC,UAAWC,KAAKC,MAChBC,SAAU,EACVC,SAAUC,OAAOC,kBACjBC,UAAWF,OAAOC,kBAClBE,SAAU,KACVC,iBAAkB,KAClBC,QAAS,KACTC,MAAO,OACPC,EAAAC,EAAAjB,EAAA,GAXKkB,EAAKF,EAAA,GAAEG,EAAQH,EAAA,GA6CtB,OAhCAI,GAAU,WACR,IAAMC,EAAU,SAAHC,GAAmD,IAA7CC,EAAMD,EAANC,OAAQnB,EAASkB,EAATlB,UACzBe,EAAQK,EAAAA,KACHN,GAAK,CAAA,EAAA,CACRhB,SAAS,EACTE,UAAAA,EACAI,SAAUe,EAAOf,SACjBG,UAAWY,EAAOZ,UAClBC,SAAUW,EAAOX,SACjBL,SAAUgB,EAAOhB,SACjBM,iBAAkBU,EAAOV,iBACzBC,QAASS,EAAOT,QAChBC,MAAOQ,EAAOR,QAEjB,EAEKU,EAAe,SAACtB,GACpBgB,EAAQK,EAAAA,KACHN,GAAK,CAAA,EAAA,CACRhB,SAAS,EACTC,MAAAA,IAEH,EAEDuB,UAAUC,YAAYC,mBAAmBP,EAASI,EAAc1B,GAChE,IAAM8B,EAAUH,UAAUC,YAAYG,cAAcT,EAASI,EAAc1B,GAE3E,OAAO,WACL2B,UAAUC,YAAYI,WAAWF,EAClC,CACF,GAAE,CAAC9B,aAAAA,EAAAA,EAAQiC,mBAAoBjC,eAAAA,EAAQkC,WAAYlC,aAAM,EAANA,EAAQmC,UAErDhB,CACT"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{_ as n}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useState as o,useEffect as e}from"react";var r=function(){return decodeURIComponent(window.location.hash.replace("#",""))},t=function(){var t=o(window?r():""),i=n(t,2),a=i[0],c=i[1];return e((function(){var n=function(){return c(r())};return window.addEventListener("hashchange",n),function(){window.removeEventListener("hashchange",n)}})),[a,function(n){window.location.hash=n,c(n)}]};export{t as useHash};
|
|
3
3
|
//# sourceMappingURL=useHash.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e,a as o}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{_ as e,a as o}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useState as n}from"react";import{useDidUpdate as t}from"../useDidUpdate/useDidUpdate.js";import{useEventListener as r}from"../useEventListener/useEventListener.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";import"../../utils/helpers/getElement.js";import"../useEvent/useEvent.js";var i=function(e,o){return e.toLowerCase().split(/[+_-]/g).map((function(e){return e.trim()})).every((function(e){return o.find((function(o){return e===o.code.toLocaleLowerCase()||e===o.key.toLocaleLowerCase()||e===o.alias.toLocaleLowerCase()}))}))},u=function(u,l,a){var s,c,d,f,v=null===(s=null==a?void 0:a.enabled)||void 0===s||s,p=null===(c=null==a?void 0:a.preventDefault)||void 0===c||c,m=n([]),y=e(m,2)[1];t((function(){y([])}),[v]),r(null!==(d=null==a?void 0:a.target)&&void 0!==d?d:window,"keydown",(function(e){p&&e.preventDefault(),v&&y((function(n){var t,r,s,c;if(n.some((function(o){return o.code===e.code})))return n;var d=null!==(t=null!==(r=null==a||null===(s=a.aliasMap)||void 0===s?void 0:s[e.key])&&void 0!==r?r:null==a||null===(c=a.aliasMap)||void 0===c?void 0:c[e.key])&&void 0!==t?t:e.code,f=[].concat(o(n),[{key:e.key,code:e.code,alias:d}]);Array.isArray(u)?u.forEach((function(o){i(o,f)&&l(e)})):i(u,f)&&l(e);return f}))})),r(null!==(f=null==a?void 0:a.target)&&void 0!==f?f:window,"keyup",(function(e){v&&y((function(o){return o.filter((function(o){return o.code!==e.code}))}))}))};export{i as isHotkeyMatch,u as useHotkeys};
|
|
3
3
|
//# sourceMappingURL=useHotkeys.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{b as e,_ as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{b as e,_ as n}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useState as t,useRef as r,useEffect as o}from"react";import{getElement as i}from"../../utils/helpers/getElement.js";import"../../utils/helpers/isClient.js";import{isTarget as l}from"../../utils/helpers/isTarget.js";var v=function(){var v=l(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,s=v?"object"===e(arguments.length<=1?void 0:arguments[1])?arguments.length<=1?void 0:arguments[1]:{onEntry:arguments.length<=1?void 0:arguments[1]}:"object"===e(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:{onEntry:arguments.length<=0?void 0:arguments[0]},u=t(!1),a=n(u,2),d=a[0],m=a[1],c=t(),f=n(c,2),g=f[0],h=f[1],p=r(s);return p.current=s,o((function(){if(v||g){var e=v?i(v):g;if(e){var n=function(e){var n,t;null===(n=p.current)||void 0===n||null===(t=n.onEntry)||void 0===t||t.call(n,e),m(!0)},t=function(e){var n,t;null===(n=p.current)||void 0===n||null===(t=n.onLeave)||void 0===t||t.call(n,e),m(!1)};return e.addEventListener("mouseenter",n),e.addEventListener("mouseleave",t),function(){e.removeEventListener("mouseenter",n),e.removeEventListener("mouseleave",t)}}}}),[v,g]),v?d:[h,d]};export{v as useHover};
|
|
3
3
|
//# sourceMappingURL=useHover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHover.js","sources":["../../../../src/hooks/useHover/useHover.ts"],"sourcesContent":["import type { RefObject } from 'react';\n\nimport { useRef, useState } from 'react';\n\nimport {
|
|
1
|
+
{"version":3,"file":"useHover.js","sources":["../../../../src/hooks/useHover/useHover.ts"],"sourcesContent":["import type { RefObject } from 'react';\n\nimport { useEffect, useRef, useState } from 'react';\n\nimport { getElement, isTarget } from '@/utils/helpers';\n\n//* The use hover target type */\nexport type UseHoverTarget = string | Element | RefObject<Element | null | undefined>;\n\n//* The use hover options type */\nexport interface UseHoverOptions {\n //* The on entry callback */\n onEntry?: (event: Event) => void;\n //* The on leave callback */\n onLeave?: (event: Event) => void;\n}\n\nexport interface UseHover {\n <Target extends UseHoverTarget>(target: Target, callback?: (event: Event) => void): boolean;\n\n <Target extends UseHoverTarget>(target: Target, options?: UseHoverOptions): boolean;\n\n <Target extends UseHoverTarget>(\n callback?: (event: Event) => void,\n target?: never\n ): [(node: Target) => void, boolean];\n\n <Target extends UseHoverTarget>(\n options?: UseHoverOptions,\n target?: never\n ): [(node: Target) => void, boolean];\n}\n\n/**\n * @name useHover\n * @description - Hook that defines the logic when hovering an element\n * @category Sensors\n *\n * @overload\n * @template Target The target element\n * @param {Target} target The target element to be hovered\n * @param {(event: Event) => void} [callback] The callback function to be invoked on mouse enter\n * @returns {boolean} The state of the hover\n *\n * @example\n * const hovering = useHover(ref, () => console.log('callback'));\n *\n * @overload\n * @template Target The target element\n * @param {Target} target The target element to be hovered\n * @param {(event: Event) => void} [options.onEntry] The callback function to be invoked on mouse enter\n * @param {(event: Event) => void} [options.onLeave] The callback function to be invoked on mouse leave\n * @returns {boolean} The state of the hover\n *\n * @example\n * const hovering = useHover(ref, options);\n *\n * @overload\n * @template Target The target element\n * @param {(event: Event) => void} [callback] The callback function to be invoked on mouse enter\n * @returns {UseHoverReturn<Target>} The state of the hover\n *\n * @example\n * const [ref, hovering] = useHover(() => console.log('callback'));\n *\n * @overload\n * @template Target The target element\n * @param {(event: Event) => void} [options.onEntry] The callback function to be invoked on mouse enter\n * @param {(event: Event) => void} [options.onLeave] The callback function to be invoked on mouse leave\n * @returns {UseHoverReturn<Target>} The state of the hover\n *\n * @example\n * const [ref, hovering] = useHover(options);\n */\nexport const useHover = ((...params: any[]) => {\n const target = (isTarget(params[0]) ? params[0] : undefined) as UseHoverTarget | undefined;\n\n const options = (\n target\n ? typeof params[1] === 'object'\n ? params[1]\n : { onEntry: params[1] }\n : typeof params[0] === 'object'\n ? params[0]\n : { onEntry: params[0] }\n ) as UseHoverOptions | undefined;\n\n const [hovering, setHovering] = useState(false);\n const [internalRef, setInternalRef] = useState<Element>();\n const internalOptionsRef = useRef(options);\n internalOptionsRef.current = options;\n\n useEffect(() => {\n if (!target && !internalRef) return;\n const element = (target ? getElement(target) : internalRef) as Element;\n\n if (!element) return;\n\n const onMouseEnter = (event: Event) => {\n internalOptionsRef.current?.onEntry?.(event);\n setHovering(true);\n };\n\n const onMouseLeave = (event: Event) => {\n internalOptionsRef.current?.onLeave?.(event);\n setHovering(false);\n };\n\n element.addEventListener('mouseenter', onMouseEnter);\n element.addEventListener('mouseleave', onMouseLeave);\n\n return () => {\n element.removeEventListener('mouseenter', onMouseEnter);\n element.removeEventListener('mouseleave', onMouseLeave);\n };\n }, [target, internalRef]);\n\n if (target) return hovering;\n return [setInternalRef, hovering] as const;\n}) as UseHover;\n"],"names":["useHover","target","isTarget","arguments","length","undefined","options","_typeof","onEntry","_useState","useState","_useState2","_slicedToArray","hovering","setHovering","_useState3","_useState4","internalRef","setInternalRef","internalOptionsRef","useRef","current","useEffect","element","getElement","onMouseEnter","event","_internalOptionsRef$c","_internalOptionsRef$c2","call","onMouseLeave","_internalOptionsRef$c3","_internalOptionsRef$c4","onLeave","addEventListener","removeEventListener"],"mappings":";ySA0EaA,EAAY,WACvB,IAAMC,EAAUC,EAAQC,UAAAC,QAAAC,OAAAA,EAAAF,cAAWA,UAAAC,eAAAC,EAAAF,UAAA,QAAeE,EAE5CC,EACJL,EACyB,WAArBM,EAAAJ,UAAAC,QAAAC,OAAAA,EAAAF,UAAA,IAA6BA,UAAAC,QAAAC,OAAAA,EAAAF,UAE3B,GAAA,CAAEK,QAAOL,UAAAC,QAAAC,OAAAA,EAAAF,UAAA,IACU,WAArBI,EAAAJ,UAAAC,QAAA,OAAAC,EAAAF,cAA6BA,UAAAC,eAAAC,EAAAF,UAE3B,GAAA,CAAEK,QAAOL,UAAAC,QAAAC,OAAAA,EAAAF,UAAA,IAGjBM,EAAgCC,GAAS,GAAMC,EAAAC,EAAAH,EAAA,GAAxCI,EAAQF,EAAA,GAAEG,EAAWH,EAAA,GAC5BI,EAAsCL,IAAmBM,EAAAJ,EAAAG,EAAA,GAAlDE,EAAWD,EAAA,GAAEE,EAAcF,EAAA,GAC5BG,EAAqBC,EAAOd,GA4BlC,OA3BAa,EAAmBE,QAAUf,EAE7BgB,GAAU,WACR,GAAKrB,GAAWgB,EAAhB,CACA,IAAMM,EAAWtB,EAASuB,EAAWvB,GAAUgB,EAE/C,GAAKM,EAAL,CAEA,IAAME,EAAe,SAACC,GAAiB,IAAAC,EAAAC,EACXD,QAA1BA,EAAAR,EAAmBE,eAAOO,IAAAD,GAAS,QAATC,EAA1BD,EAA4BnB,eAAO,IAAAoB,GAAnCA,EAAAC,KAAAF,EAAsCD,GACtCZ,GAAY,EACb,EAEKgB,EAAe,SAACJ,GAAiB,IAAAK,EAAAC,EACXD,QAA1BA,EAAAZ,EAAmBE,eAAOW,IAAAD,GAAS,QAATC,EAA1BD,EAA4BE,eAAO,IAAAD,GAAnCA,EAAAH,KAAAE,EAAsCL,GACtCZ,GAAY,EACb,EAKD,OAHAS,EAAQW,iBAAiB,aAAcT,GACvCF,EAAQW,iBAAiB,aAAcJ,GAEhC,WACLP,EAAQY,oBAAoB,aAAcV,GAC1CF,EAAQY,oBAAoB,aAAcL,EAC3C,CAlBa,CAHe,CAsB/B,GAAG,CAAC7B,EAAQgB,IAERhB,EAAeY,EACZ,CAACK,EAAgBL,EAC1B"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useState as t,useEffect as n}from"react";import"../../utils/helpers/isClient.js";import{throttle as i}from"../../utils/helpers/throttle.js";var o=["mousemove","mousedown","keydown","touchstart","wheel","resize"],r=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6e4,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=u.initialValue,l=void 0!==s&&s,a=u.events,c=void 0===a?o:a,d=t(l),m=e(d,2),v=m[0],f=m[1],h=t(Date.now()),p=e(h,2),w=p[0],E=p[1];return n((function(){var e,t=function(){return f(!0)},n=i((function(){f(!1),E(Date.now()),clearTimeout(e),e=setTimeout(t,r)}),500),o=function(){document.hidden||n()};return e=setTimeout(t,r),c.forEach((function(e){return window.addEventListener(e,n)})),document.addEventListener("visibilitychange",o),function(){c.forEach((function(e){return window.addEventListener(e,n)})),document.removeEventListener("visibilitychange",o),clearTimeout(e)}}),[r,c]),{idle:v,lastActive:w}};export{r as useIdle};
|
|
3
3
|
//# sourceMappingURL=useIdle.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{c as r,a as e,d as s,e as t}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{c as r,a as e,d as s,e as t}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useQuery as o}from"../useQuery/useQuery.js";import"react";import"../../utils/helpers/getRetry.js";import"../../utils/helpers/isClient.js";import"../useDidUpdate/useDidUpdate.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../useMount/useMount.js";var n=function(){var r=s(t().mark((function r(e){var s,o=arguments;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return s=o.length>1&&void 0!==o[1]?o[1]:{},r.abrupt("return",new Promise((function(r,t){var o=new Image,n=s.srcset,i=s.sizes,u=s.class,a=s.loading,c=s.crossorigin,p=s.referrerPolicy;o.src=e,n&&(o.srcset=n),i&&(o.sizes=i),u&&(o.className=u),a&&(o.loading=a),c&&(o.crossOrigin=c),p&&(o.referrerPolicy=p),o.onload=function(){return r(o)},o.onerror=t})));case 2:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}(),i=function(s,t){var i,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return o((function(){return n(s,t)}),r({keys:[s].concat(e(null!==(i=u.keys)&&void 0!==i?i:[]))},u))};export{i as useImage};
|
|
3
3
|
//# sourceMappingURL=useImage.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as t,d as r,e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{_ as t,d as r,e}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useState as n,useRef as i,useEffect as o}from"react";import{getElement as l}from"../../utils/helpers/getElement.js";import"../../utils/helpers/isClient.js";import{useEvent as s}from"../useEvent/useEvent.js";var c=function(){for(var c,u,a=arguments.length,f=new Array(a),p=0;p<a;p++)f[p]=arguments[p];var v=f[1]instanceof Function?f[0]:void 0,d=f[1]instanceof Function?f[1]:f[0],m=f[1]instanceof Function?f[2]:f[1],h=null!==(c=null==m?void 0:m.direction)&&void 0!==c?c:"bottom",g=null!==(u=null==m?void 0:m.distance)&&void 0!==u?u:10,b=n(!1),x=t(b,2),E=x[0],j=x[1],L=n(),k=t(L,2),w=k[0],F=k[1],H=i(d);H.current=d;var y=s(function(){var t=r(e().mark((function t(r){var n,i,o,l,s,c,u;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!E){t.next=2;break}return t.abrupt("return");case 2:if(n=r.target,i=n.clientHeight,o=n.scrollHeight,l=n.scrollTop,s=n.clientWidth,c=n.scrollWidth,u=n.scrollLeft,!({bottom:o-(l+i),top:l,right:c-(u+s),left:u}[h]<=g)){t.next=11;break}return j(!0),t.next=10,H.current(r);case 10:j(!1);case 11:case"end":return t.stop()}}),t)})));return function(r){return t.apply(this,arguments)}}());return o((function(){if(v||w){var t=v?l(v):w;if(t)return t.addEventListener("scroll",y),function(){t.removeEventListener("scroll",y)}}}),[w,v,h,g]),v?E:{ref:F,isLoading:E}};export{c as useInfiniteScroll};
|
|
3
3
|
//# sourceMappingURL=useInfiniteScroll.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{b as n,_ as e,c as o}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{b as n,_ as e,c as o}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useState as r,useRef as l,useEffect as t}from"react";import{getElement as i}from"../../utils/helpers/getElement.js";import"../../utils/helpers/isClient.js";var u=function(){var u,s="object"!==n(arguments.length<=0?void 0:arguments[0])||"current"in(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,v=s?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],d=null===(u=null==v?void 0:v.enabled)||void 0===u||u,c=r(),a=e(c,2),g=a[0],f=a[1],h=r(),m=e(h,2),p=m[0],b=m[1],j=l();return j.current=null==v?void 0:v.onChange,t((function(){if(d||s||p){var n=s?i(s):p;if(n){var r=new IntersectionObserver((function(n){var o,r=e(n,1)[0];f(r),null===(o=j.current)||void 0===o||o.call(j,r)}),o(o({},v),{},{root:null!=v&&v.root?i(null==v?void 0:v.root):document}));return r.observe(n),function(){r.disconnect()}}}}),[s,p,null==v?void 0:v.rootMargin,null==v?void 0:v.threshold,null==v?void 0:v.root,d]),s?{entry:g,inView:!(null==g||!g.isIntersecting)}:{ref:b,entry:g,inView:!(null==g||!g.isIntersecting)}};export{u as useIntersectionObserver};
|
|
3
3
|
//# sourceMappingURL=useIntersectionObserver.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{b as r,_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{b as r,_ as e}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useState as n,useRef as t,useEffect as l}from"react";import{useEvent as u}from"../useEvent/useEvent.js";var a=function(){for(var a,o,c=arguments.length,i=new Array(c),v=0;v<c;v++)i[v]=arguments[v];var f=i[0],s=null!==(a="number"==typeof i[1]?i[1]:i[1].interval)&&void 0!==a?a:1e3,m="object"===r(i[1])?i[1]:i[2],p=null===(o=null==m?void 0:m.enabled)||void 0===o||o,b=n(null==p||p),I=e(b,2),d=I[0],j=I[1],g=t(),y=u(f);l((function(){if(p)return g.current=setInterval(y,s),function(){clearInterval(g.current)}}),[p,s]);return{active:d,pause:function(){j(!1),clearInterval(g.current)},resume:function(){s<=0||(j(!0),clearInterval(g.current),g.current=setInterval(y,s))}}};export{a as useInterval};
|
|
3
3
|
//# sourceMappingURL=useInterval.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
2
|
import{useRef as r}from"react";var t=function(){var t=r(!0);return!0===t.current?(t.current=!1,!0):t.current};export{t as useIsFirstRender};
|
|
3
3
|
//# sourceMappingURL=useIsFirstRender.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
2
|
import{useLayoutEffect as r,useEffect as t}from"react";import{isClient as e}from"../../utils/helpers/isClient.js";var i=e?r:t;export{i as useIsomorphicLayoutEffect};
|
|
3
3
|
//# sourceMappingURL=useIsomorphicLayoutEffect.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useState as r}from"react";import{useEventListener as t}from"../useEventListener/useEventListener.js";import"../../utils/helpers/getElement.js";import"../../utils/helpers/isClient.js";import"../useEvent/useEvent.js";var i=function(i,n){var s,l,o=r(!1),u=e(o,2),p=u[0],a=u[1];return t(null!==(s=null==n?void 0:n.target)&&void 0!==s?s:window,"keydown",(function(e){(Array.isArray(i)?i.includes(e.key):e.key===i)&&a(!0)})),t(null!==(l=null==n?void 0:n.target)&&void 0!==l?l:window,"keyup",(function(e){(Array.isArray(i)?i.includes(e.key):e.key===i)&&a(!1)})),p};export{i as useKeyPress};
|
|
3
3
|
//# sourceMappingURL=useKeyPress.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{useEventListener as e}from"../useEventListener/useEventListener.js";import"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{useEventListener as e}from"../useEventListener/useEventListener.js";import"../../_rollupPluginBabelHelpers-CIijGS7V.js";import"react";import"../../utils/helpers/getElement.js";import"../../utils/helpers/isClient.js";import"../useEvent/useEvent.js";var t=function(){var t=Array.isArray(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:[arguments.length<=0?void 0:arguments[0]],n=(arguments.length<=1?void 0:arguments[1])instanceof Function?null:arguments.length<=1?void 0:arguments[1],i=n?arguments.length<=2?void 0:arguments[2]:arguments.length<=1?void 0:arguments[1];e(null!=n?n:window,"keydown",(function(e){t.includes(e.key)&&i(e)}),n?arguments.length<=3?void 0:arguments[3]:arguments.length<=2?void 0:arguments[2])};export{t as useKeyPressEvent};
|
|
3
3
|
//# sourceMappingURL=useKeyPressEvent.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{useEventListener as e}from"../useEventListener/useEventListener.js";import"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{useEventListener as e}from"../useEventListener/useEventListener.js";import"../../_rollupPluginBabelHelpers-CIijGS7V.js";import"react";import"../../utils/helpers/getElement.js";import"../../utils/helpers/isClient.js";import"../useEvent/useEvent.js";var l=function(l){var n,t;e(null!==(n=null==l?void 0:l.target)&&void 0!==n?n:window,"keydown",(function(e){var n;return null==l||null===(n=l.onKeyDown)||void 0===n?void 0:n.call(l,e)})),e(null!==(t=null==l?void 0:l.target)&&void 0!==t?t:window,"keyup",(function(e){var n;return null==l||null===(n=l.onKeyUp)||void 0===n?void 0:n.call(l,e)}))};export{l as useKeyboard};
|
|
3
3
|
//# sourceMappingURL=useKeyboard.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e,a as t}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{_ as e,a as t}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useState as o}from"react";import{useDidUpdate as n}from"../useDidUpdate/useDidUpdate.js";import{useEventListener as r}from"../useEventListener/useEventListener.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";import"../../utils/helpers/getElement.js";import"../useEvent/useEvent.js";var i=function(i){var u,s,l,c=null===(u=null==i?void 0:i.enabled)||void 0===u||u,d=o([]),p=e(d,2),f=p[0],m=p[1];return n((function(){m([])}),[c]),r(null!==(s=null==i?void 0:i.target)&&void 0!==s?s:window,"keydown",(function(e){c&&m((function(o){return o.some((function(t){return t.code===e.code}))?o:[].concat(t(o),[{key:e.key,code:e.code}])}))})),r(null!==(l=null==i?void 0:i.target)&&void 0!==l?l:window,"keyup",(function(e){c&&m((function(t){return t.filter((function(t){return t.code!==e.code}))}))})),f};export{i as useKeysPressed};
|
|
3
3
|
//# sourceMappingURL=useKeysPressed.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as o}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{_ as o}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useState as r}from"react";import{useDidUpdate as t}from"../useDidUpdate/useDidUpdate.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var e=function(e,i){var u,l=r(null!==(u=null==i?void 0:i.initialValue)&&void 0!==u?u:null),s=o(l,2),n=s[0],p=s[1];return t((function(){return p(Date.now())}),[e]),n};export{e as useLastChanged};
|
|
3
3
|
//# sourceMappingURL=useLastChanged.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as n,a as t}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.81 */
|
|
2
|
+
import{_ as n,a as t}from"../../_rollupPluginBabelHelpers-CIijGS7V.js";import{useState as r}from"react";var e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],u=r(e),c=n(u,2),o=c[0],i=c[1];return{value:o,set:i,push:function(n){return i((function(r){return[].concat(t(r),[n])}))},removeAt:function(n){return i((function(r){return[].concat(t(r.slice(0,n)),t(r.slice(n+1)))}))},insertAt:function(n,r){return i((function(e){return[].concat(t(e.slice(0,n)),[r],t(e.slice(n)))}))},updateAt:function(n,t){return i((function(r){return r.map((function(r,e){return e===n?t:r}))}))},clear:function(){return i([])},reset:function(){return i(e)}}};export{e as useList};
|
|
3
3
|
//# sourceMappingURL=useList.js.map
|