@siberiacancode/reactuse 0.0.53 → 0.0.54
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-D4KMnNuQ.js → _rollupPluginBabelHelpers-s0b9uPmg.js} +2 -2
- package/dist/cjs/_rollupPluginBabelHelpers-s0b9uPmg.js.map +1 -0
- package/dist/cjs/hooks/index.js +2 -2
- package/dist/cjs/hooks/useBattery/useBattery.js +2 -2
- package/dist/cjs/hooks/useBoolean/useBoolean.js +2 -2
- package/dist/cjs/hooks/useBreakpoints/constants/breakpoints.js +1 -1
- package/dist/cjs/hooks/useBreakpoints/useBreakpoints.js +2 -2
- package/dist/cjs/hooks/useBrowserLanguage/useBrowserLanguage.js +1 -1
- package/dist/cjs/hooks/useClickOutside/useClickOutside.js +2 -2
- package/dist/cjs/hooks/useClipboard/useClipboard.js +2 -2
- package/dist/cjs/hooks/useCounter/useCounter.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/useDidUpdate/useDidUpdate.js +1 -1
- package/dist/cjs/hooks/useDisclosure/useDisclosure.js +2 -2
- package/dist/cjs/hooks/useDocumentEvent/useDocumentEvent.js +1 -1
- package/dist/cjs/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
- package/dist/cjs/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
- package/dist/cjs/hooks/useEvent/useEvent.js +1 -1
- package/dist/cjs/hooks/useEventListener/useEventListener.js +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/useFileDialog/useFileDialog.js +2 -2
- package/dist/cjs/hooks/useFps/useFps.js +2 -2
- package/dist/cjs/hooks/useFullscreen/useFullscreen.js +2 -2
- package/dist/cjs/hooks/useGeolocation/useGeolocation.js +2 -2
- package/dist/cjs/hooks/useHash/useHash.js +2 -2
- package/dist/cjs/hooks/useHotkeys/useHotkeys.js +2 -2
- package/dist/cjs/hooks/useHotkeys/useHotkeys.js.map +1 -1
- package/dist/cjs/hooks/useHover/useHover.js +2 -2
- package/dist/cjs/hooks/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 +1 -1
- package/dist/cjs/hooks/useKeyboard/useKeyboard.js +1 -1
- package/dist/cjs/hooks/useKeysPressed/useKeysPressed.js +2 -2
- package/dist/cjs/hooks/useKeysPressed/useKeysPressed.js.map +1 -1
- package/dist/cjs/hooks/useList/useList.js +2 -2
- package/dist/cjs/hooks/useLocalStorage/useLocalStorage.js +2 -2
- package/dist/cjs/hooks/useLocalStorage/useLocalStorage.js.map +1 -1
- package/dist/cjs/hooks/useLogger/useLogger.js +2 -2
- package/dist/cjs/hooks/useLongPress/useLongPress.js +2 -2
- package/dist/cjs/hooks/useMap/useMap.js +2 -2
- package/dist/cjs/hooks/useMeasure/useMeasure.js +2 -2
- package/dist/cjs/hooks/useMediaQuery/useMediaQuery.js +1 -1
- package/dist/cjs/hooks/useMemory/useMemory.js +2 -2
- package/dist/cjs/hooks/useMount/useMount.js +1 -1
- package/dist/cjs/hooks/useMouse/useMouse.js +2 -2
- package/dist/cjs/hooks/useMutation/useMutation.js +2 -2
- package/dist/cjs/hooks/useMutationObserver.js +1 -1
- package/dist/cjs/hooks/useNetwork/useNetwork.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/useOrientation/useOrientation.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/usePermission/usePermission.js +2 -2
- package/dist/cjs/hooks/usePreferredColorScheme/usePreferredColorScheme.js +1 -1
- package/dist/cjs/hooks/usePreferredContrast/usePreferredContrast.js +1 -1
- package/dist/cjs/hooks/usePreferredDark/usePreferredDark.js +1 -1
- package/dist/cjs/hooks/usePreferredLanguages/usePreferredLanguages.js +1 -1
- package/dist/cjs/hooks/usePreferredReducedMotion/usePreferredReducedMotion.js +1 -1
- package/dist/cjs/hooks/usePrevious/usePrevious.js +1 -1
- package/dist/cjs/hooks/useQuery/useQuery.js +2 -2
- package/dist/cjs/hooks/useQuery/useQuery.js.map +1 -1
- package/dist/cjs/hooks/useQueue/useQueue.js +2 -2
- package/dist/cjs/hooks/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/useScript/useScript.js +2 -2
- package/dist/cjs/hooks/useSessionStorage/useSessionStorage.js +2 -2
- package/dist/cjs/hooks/useSessionStorage/useSessionStorage.js.map +1 -1
- package/dist/cjs/hooks/useSet/useSet.js +2 -2
- package/dist/cjs/hooks/useShare/useShare.js +2 -2
- package/dist/cjs/hooks/useStep/useStep.js +2 -2
- package/dist/cjs/hooks/useStopwatch/useStopwatch.js +2 -2
- package/dist/cjs/hooks/useStopwatch/useStopwatch.js.map +1 -1
- package/dist/cjs/hooks/useStorage/useStorage.js +2 -2
- package/dist/cjs/hooks/useStorage/useStorage.js.map +1 -1
- 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/useToggle/useToggle.js +2 -2
- package/dist/cjs/hooks/useUnmount/useUnmount.js +1 -1
- package/dist/cjs/hooks/useWebSocket/useWebSocket.js +2 -2
- package/dist/cjs/hooks/useWindowEvent/useWindowEvent.js +1 -1
- 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-DWXq2in2.js → index-fy8Yvkbz.js} +2 -2
- package/dist/cjs/{index-DWXq2in2.js.map → index-fy8Yvkbz.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/getRetry.js +1 -1
- package/dist/cjs/utils/helpers/index.js +1 -1
- package/dist/cjs/utils/helpers/isClient.js +1 -1
- package/dist/cjs/utils/helpers/isPermissionAllowed.js +1 -1
- package/dist/cjs/utils/helpers/throttle.js +1 -1
- package/dist/cjs/utils/helpers/time/getDate.js +1 -1
- package/dist/cjs/utils/types/index.js +1 -1
- package/dist/esm/{_rollupPluginBabelHelpers-CIuCCT6y.js → _rollupPluginBabelHelpers-0IYrm-Ud.js} +2 -2
- package/dist/esm/_rollupPluginBabelHelpers-0IYrm-Ud.js.map +1 -0
- package/dist/esm/hooks/index.js +2 -2
- package/dist/esm/hooks/useBattery/useBattery.js +2 -2
- package/dist/esm/hooks/useBoolean/useBoolean.js +2 -2
- package/dist/esm/hooks/useBreakpoints/constants/breakpoints.js +1 -1
- package/dist/esm/hooks/useBreakpoints/useBreakpoints.js +2 -2
- package/dist/esm/hooks/useBrowserLanguage/useBrowserLanguage.js +1 -1
- package/dist/esm/hooks/useClickOutside/useClickOutside.js +2 -2
- package/dist/esm/hooks/useClipboard/useClipboard.js +2 -2
- package/dist/esm/hooks/useCounter/useCounter.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/useDidUpdate/useDidUpdate.js +1 -1
- package/dist/esm/hooks/useDisclosure/useDisclosure.js +2 -2
- package/dist/esm/hooks/useDocumentEvent/useDocumentEvent.js +1 -1
- package/dist/esm/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
- package/dist/esm/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
- package/dist/esm/hooks/useEvent/useEvent.js +1 -1
- package/dist/esm/hooks/useEventListener/useEventListener.js +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/useFileDialog/useFileDialog.js +2 -2
- package/dist/esm/hooks/useFps/useFps.js +2 -2
- package/dist/esm/hooks/useFullscreen/useFullscreen.js +2 -2
- package/dist/esm/hooks/useGeolocation/useGeolocation.js +2 -2
- package/dist/esm/hooks/useHash/useHash.js +2 -2
- package/dist/esm/hooks/useHotkeys/useHotkeys.js +2 -2
- package/dist/esm/hooks/useHotkeys/useHotkeys.js.map +1 -1
- package/dist/esm/hooks/useHover/useHover.js +2 -2
- package/dist/esm/hooks/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 +1 -1
- package/dist/esm/hooks/useKeyboard/useKeyboard.js +1 -1
- package/dist/esm/hooks/useKeysPressed/useKeysPressed.js +2 -2
- package/dist/esm/hooks/useKeysPressed/useKeysPressed.js.map +1 -1
- package/dist/esm/hooks/useList/useList.js +2 -2
- package/dist/esm/hooks/useLocalStorage/useLocalStorage.js +2 -2
- package/dist/esm/hooks/useLocalStorage/useLocalStorage.js.map +1 -1
- package/dist/esm/hooks/useLogger/useLogger.js +2 -2
- package/dist/esm/hooks/useLongPress/useLongPress.js +2 -2
- package/dist/esm/hooks/useMap/useMap.js +2 -2
- package/dist/esm/hooks/useMeasure/useMeasure.js +2 -2
- package/dist/esm/hooks/useMediaQuery/useMediaQuery.js +1 -1
- package/dist/esm/hooks/useMemory/useMemory.js +2 -2
- package/dist/esm/hooks/useMount/useMount.js +1 -1
- package/dist/esm/hooks/useMouse/useMouse.js +2 -2
- package/dist/esm/hooks/useMutation/useMutation.js +2 -2
- package/dist/esm/hooks/useMutationObserver.js +1 -1
- package/dist/esm/hooks/useNetwork/useNetwork.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/useOrientation/useOrientation.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/usePermission/usePermission.js +2 -2
- package/dist/esm/hooks/usePreferredColorScheme/usePreferredColorScheme.js +1 -1
- package/dist/esm/hooks/usePreferredContrast/usePreferredContrast.js +1 -1
- package/dist/esm/hooks/usePreferredDark/usePreferredDark.js +1 -1
- package/dist/esm/hooks/usePreferredLanguages/usePreferredLanguages.js +1 -1
- package/dist/esm/hooks/usePreferredReducedMotion/usePreferredReducedMotion.js +1 -1
- package/dist/esm/hooks/usePrevious/usePrevious.js +1 -1
- package/dist/esm/hooks/useQuery/useQuery.js +2 -2
- package/dist/esm/hooks/useQuery/useQuery.js.map +1 -1
- package/dist/esm/hooks/useQueue/useQueue.js +2 -2
- package/dist/esm/hooks/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/useScript/useScript.js +2 -2
- package/dist/esm/hooks/useSessionStorage/useSessionStorage.js +2 -2
- package/dist/esm/hooks/useSessionStorage/useSessionStorage.js.map +1 -1
- package/dist/esm/hooks/useSet/useSet.js +2 -2
- package/dist/esm/hooks/useShare/useShare.js +2 -2
- package/dist/esm/hooks/useStep/useStep.js +2 -2
- package/dist/esm/hooks/useStopwatch/useStopwatch.js +2 -2
- package/dist/esm/hooks/useStopwatch/useStopwatch.js.map +1 -1
- package/dist/esm/hooks/useStorage/useStorage.js +2 -2
- package/dist/esm/hooks/useStorage/useStorage.js.map +1 -1
- 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/useToggle/useToggle.js +2 -2
- package/dist/esm/hooks/useUnmount/useUnmount.js +1 -1
- package/dist/esm/hooks/useWebSocket/useWebSocket.js +2 -2
- package/dist/esm/hooks/useWindowEvent/useWindowEvent.js +1 -1
- 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-ngJHDSj5.js → index-B9lnRo2n.js} +2 -2
- package/dist/esm/{index-ngJHDSj5.js.map → index-B9lnRo2n.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/getRetry.js +1 -1
- package/dist/esm/utils/helpers/index.js +1 -1
- package/dist/esm/utils/helpers/isClient.js +1 -1
- package/dist/esm/utils/helpers/isPermissionAllowed.js +1 -1
- package/dist/esm/utils/helpers/throttle.js +1 -1
- package/dist/esm/utils/helpers/time/getDate.js +1 -1
- package/dist/esm/utils/types/index.js +1 -1
- package/dist/index.d.ts +34 -5
- package/package.json +1 -1
- package/dist/cjs/_rollupPluginBabelHelpers-D4KMnNuQ.js.map +0 -1
- package/dist/esm/_rollupPluginBabelHelpers-CIuCCT6y.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHotkeys.js","sources":["../../../../src/hooks/useHotkeys/useHotkeys.ts"],"sourcesContent":["import { useState } from 'react';\n\nimport { useDidUpdate } from '../useDidUpdate/useDidUpdate';\nimport type { UseEventListenerTarget } from '../useEventListener/useEventListener';\nimport { useEventListener } from '../useEventListener/useEventListener';\n\n/** The use hotkeys params */\nexport interface UseHotkeysOptions {\n /** The target to attach the event listeners to */\n target?: UseEventListenerTarget;\n
|
|
1
|
+
{"version":3,"file":"useHotkeys.js","sources":["../../../../src/hooks/useHotkeys/useHotkeys.ts"],"sourcesContent":["import { useState } from 'react';\n\nimport { useDidUpdate } from '../useDidUpdate/useDidUpdate';\nimport type { UseEventListenerTarget } from '../useEventListener/useEventListener';\nimport { useEventListener } from '../useEventListener/useEventListener';\n\n/** The use hotkeys params */\nexport interface UseHotkeysOptions {\n /** The target to attach the event listeners to */\n target?: UseEventListenerTarget;\n /** Enable or disable the event listeners */\n enabled?: boolean;\n /** Whether to prevent the default behavior of the event */\n preventDefault?: boolean;\n /** Alias map for hotkeys */\n aliasMap?: Record<string, string>;\n}\n\nexport const isHotkeyMatch = (hotkey: string, keys: UseHotkeysKey[]) =>\n hotkey\n .toLowerCase()\n .split(/[+_-]/g)\n .map((key) => key.trim())\n .every((key) =>\n keys.find(\n (updatedKey) =>\n key === updatedKey.code.toLocaleLowerCase() ||\n key === updatedKey.key.toLocaleLowerCase() ||\n key === updatedKey.alias.toLocaleLowerCase()\n )\n );\n\nexport type UseHotkeysHotkeys = string[] | string;\nexport type UseHotkeysKey = { key: string; code: string; alias: string };\n\n/**\n * @name useHotkeys\n * @description - Hook that listens for hotkeys\n * @category Sensors\n *\n * @param {UseHotkeysHotkeys} hotkeys The key or keys to listen for\n * @param {(event: KeyboardEvent) => void} callback The callback function to be called when the hotkey is pressed\n * @param {UseEventListenerTarget} [options.target=window] The target to attach the event listeners to\n * @param {boolean} [options.enabled=true] Enable or disable the event listeners\n * @param {boolean} [options.preventDefault=true] Whether to prevent the default behavior of the event\n * @param {Record<string, string>} [options.aliasMap] Alias map for hotkeys\n * @returns {useKeysPressedReturns} Array of strings with keys that were press\n *\n * @example\n * useHotkeys('control+a', () => console.log('hotkey pressed'));\n *\n * @example\n * useHotkeys('ControlLeft+KeyA', () => console.log('hotkey pressed'));\n */\nexport const useHotkeys = (\n hotkeys: UseHotkeysHotkeys,\n callback: (event: KeyboardEvent) => void,\n options?: UseHotkeysOptions\n) => {\n const enabled = options?.enabled ?? true;\n const preventDefault = options?.preventDefault ?? true;\n const [, setKeys] = useState<UseHotkeysKey[]>([]);\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (preventDefault) event.preventDefault();\n\n if (!enabled) return;\n\n setKeys((prevKeys) => {\n if (prevKeys.some(({ code }) => code === event.code)) return prevKeys;\n const alias = options?.aliasMap?.[event.key] ?? options?.aliasMap?.[event.key] ?? event.code;\n const updatedKeys = [...prevKeys, { key: event.key, code: event.code, alias }];\n\n if (Array.isArray(hotkeys)) {\n hotkeys.forEach((hotkey) => {\n const isMatch = isHotkeyMatch(hotkey, updatedKeys);\n if (isMatch) callback(event);\n });\n } else {\n const isMatch = isHotkeyMatch(hotkeys, updatedKeys);\n if (isMatch) callback(event);\n }\n\n return updatedKeys;\n });\n };\n\n const onKeyUp = (event: KeyboardEvent) => {\n if (!enabled) return;\n setKeys((prevKeys) => prevKeys.filter(({ code }) => code !== event.code));\n };\n\n useDidUpdate(() => {\n setKeys([]);\n }, [enabled]);\n\n useEventListener(options?.target ?? window, 'keydown', onKeyDown);\n useEventListener(options?.target ?? window, 'keyup', onKeyUp);\n};\n"],"names":["isHotkeyMatch","hotkey","keys","toLowerCase","split","map","key","trim","every","find","updatedKey","code","toLocaleLowerCase","alias","useHotkeys","hotkeys","callback","options","_options$enabled","_options$preventDefau","_options$target","_options$target2","enabled","preventDefault","_useState","useState","setKeys","_slicedToArray","useDidUpdate","useEventListener","target","window","event","prevKeys","_ref2","_options$aliasMap$eve","_options$aliasMap","_options$aliasMap2","some","_ref","aliasMap","updatedKeys","concat","_toConsumableArray","Array","isArray","forEach","filter","_ref3"],"mappings":";4XAkBO,IAAMA,EAAgB,SAACC,EAAgBC,GAAqB,OACjED,EACGE,cACAC,MAAM,UACNC,KAAI,SAACC,GAAG,OAAKA,EAAIC,MAAM,IACvBC,OAAM,SAACF,GAAG,OACTJ,EAAKO,MACH,SAACC,GAAU,OACTJ,IAAQI,EAAWC,KAAKC,qBACxBN,IAAQI,EAAWJ,IAAIM,qBACvBN,IAAQI,EAAWG,MAAMD,mBAAmB,GAC/C,GACF,EAwBQE,EAAa,SACxBC,EACAC,EACAC,GACG,IAAAC,EAAAC,EAAAC,EAAAC,EACGC,EAA0BJ,QAAnBA,EAAGD,aAAO,EAAPA,EAASK,eAAOJ,IAAAA,GAAAA,EAC1BK,EAAwCJ,QAA1BA,EAAGF,aAAO,EAAPA,EAASM,sBAAcJ,IAAAA,GAAAA,EAC9CK,EAAoBC,EAA0B,IAArCC,EAAwCC,EAAAH,EAAA,GAAjC,GA+BhBI,GAAa,WACXF,EAAQ,GACV,GAAG,CAACJ,IAEJO,UAAgBT,EAACH,aAAO,EAAPA,EAASa,cAAM,IAAAV,EAAAA,EAAIW,OAAQ,WAjC1B,SAACC,GACbT,GAAgBS,EAAMT,iBAErBD,GAELI,GAAQ,SAACO,GAAa,IAAAC,EAAAC,EAAAC,EAAAC,EACpB,GAAIJ,EAASK,MAAK,SAAAC,GAAO,OAAAA,EAAJ5B,OAAoBqB,EAAMrB,QAAO,OAAOsB,EAC7D,IAAMpB,EAAwE,QAAnEqB,EAAiC,QAAjCC,EAAGlB,SAAiBmB,QAAVA,EAAPnB,EAASuB,gBAATJ,IAAiBA,OAAjBA,EAAAA,EAAoBJ,EAAM1B,YAAI,IAAA6B,EAAAA,EAAIlB,SAAiB,QAAVoB,EAAPpB,EAASuB,gBAAQ,IAAAH,OAAA,EAAjBA,EAAoBL,EAAM1B,YAAI,IAAA4B,EAAAA,EAAIF,EAAMrB,KAClF8B,EAAWC,GAAAA,OAAAC,EAAOV,GAAU,CAAA,CAAE3B,IAAK0B,EAAM1B,IAAKK,KAAMqB,EAAMrB,KAAME,MAAAA,KAElE+B,MAAMC,QAAQ9B,GAChBA,EAAQ+B,SAAQ,SAAC7C,GACCD,EAAcC,EAAQwC,IACzBzB,EAASgB,EACxB,IAEgBhC,EAAce,EAAS0B,IAC1BzB,EAASgB,GAGxB,OAAOS,CACT,OAaFZ,UAAgBR,EAACJ,aAAO,EAAPA,EAASa,cAAM,IAAAT,EAAAA,EAAIU,OAAQ,SAV5B,SAACC,GACVV,GACLI,GAAQ,SAACO,GAAQ,OAAKA,EAASc,QAAO,SAAAC,GAAO,OAAAA,EAAJrC,OAAoBqB,EAAMrB,aASvE"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{c as n,_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{c as n,_ as e}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{useState as t,useRef as o}from"react";import{useEventListener as l}from"../useEventListener/useEventListener.js";import"../useEvent/useEvent.js";var i=function(){var i=(arguments.length<=0?void 0:arguments[0])instanceof Function||!("current"in(arguments.length<=0?void 0:arguments[0])||(arguments.length<=0?void 0:arguments[0])instanceof Element)||arguments.length<=0?void 0:arguments[0],r=i?"object"===n(arguments.length<=1?void 0:arguments[1])?arguments.length<=1?void 0:arguments[1]:{onEntry:arguments.length<=1?void 0:arguments[1]}:"object"===n(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:{onEntry:arguments.length<=0?void 0:arguments[0]},v=t(!1),u=e(v,2),s=u[0],a=u[1],c=o();return l(null!=i?i:c,"mouseenter",(function(){var n;null==r||null===(n=r.onEntry)||void 0===n||n.call(r),a(!0)})),l(null!=i?i:c,"mouseleave",(function(){var n;null==r||null===(n=r.onLeave)||void 0===n||n.call(r),a(!1)})),i?s:[c,s]};export{i as useHover};
|
|
3
3
|
//# sourceMappingURL=useHover.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.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{b as r,a as e,d as s,e as t}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{b as r,a as e,d as s,e as t}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.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 r,d as e,e as t}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{_ as r,d as e,e as t}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{useState as n,useRef as o,useEffect as i}from"react";import{useEvent as u}from"../useEvent/useEvent.js";import{useRerender as c}from"../useRerender/useRerender.js";var a=function(){for(var a,s,l,f,v=c(),d=arguments.length,p=new Array(d),m=0;m<d;m++)p[m]=arguments[m];var h=p[1]instanceof Function?p[0]:void 0,g=p[1]instanceof Function?p[1]:p[0],b=null!==(a=null===(s=p[2])||void 0===s?void 0:s.direction)&&void 0!==a?a:"bottom",x=null!==(l=null===(f=p[2])||void 0===f?void 0:f.distance)&&void 0!==l?l:10,E=n(!1),L=r(E,2),j=L[0],k=L[1],w=o(),y=o(g);y.current=g;var H=u(function(){var r=e(t().mark((function r(e){var n,o,i,u,c,a,s;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!j){r.next=2;break}return r.abrupt("return");case 2:if(n=e.target,o=n.clientHeight,i=n.scrollHeight,u=n.scrollTop,c=n.clientWidth,a=n.scrollWidth,s=n.scrollLeft,!({bottom:i-(u+o),top:u,right:a-(s+c),left:s}[b]<=x)){r.next=11;break}return k(!0),r.next=10,y.current(e);case 10:k(!1);case 11:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}());return i((function(){var r=h?function(r){return"function"==typeof r?r():r instanceof Element?r:r.current}(h):w.current;if(r)return r.addEventListener("scroll",H),function(){r.removeEventListener("scroll",H)}}),[w.current,h,b,x]),h?j:{ref:function(r){w.current||(w.current=r,v.update())},isLoading:j}};export{a as useInfiniteScroll};
|
|
3
3
|
//# sourceMappingURL=useInfiniteScroll.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{c as n,_ as e,b as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{c as n,_ as e,b as r}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{useState as t,useRef as o,useEffect as i}from"react";import{useRerender as u}from"../useRerender/useRerender.js";var l=function(){var l,c=u(),d="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=d?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],s=null===(l=null==v?void 0:v.enabled)||void 0===l||l,a=t(),f=e(a,2),g=f[0],m=f[1],h=o(),p=o();return p.current=null==v?void 0:v.onChange,i((function(){if(s&&h.current){var n=d?function(n){return"function"==typeof n?n():n instanceof Element?n:n.current}(d):h.current;if(n){var t,o=new IntersectionObserver((function(n){var r,t=e(n,1)[0];m(t),null===(r=p.current)||void 0===r||r.call(p,t)}),r(r({},v),{},{root:(t=null==v?void 0:v.root,t?t instanceof Element||t instanceof Document?t:t.current:document)}));return o.observe(n),function(){o.disconnect()}}}}),[h.current,d,null==v?void 0:v.rootMargin,null==v?void 0:v.threshold,null==v?void 0:v.root,s]),d?{entry:g,inView:!(null==g||!g.isIntersecting)}:{ref:function(n){h.current||(h.current=n,c.update())},entry:g,inView:!(null==g||!g.isIntersecting)}};export{l as useIntersectionObserver};
|
|
3
3
|
//# sourceMappingURL=useIntersectionObserver.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{c as r,_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{c as r,_ as e}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.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 s=i[0],f=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,I=n(null==p||p),b=e(I,2),d=b[0],j=b[1],g=t(),y=u(s);l((function(){if(p)return g.current=setInterval(y,f),function(){clearInterval(g.current)}}),[p,f]);return{isActive:d,pause:function(){j(!1),clearInterval(g.current)},resume:function(){f<=0||(j(!0),clearInterval(g.current),g.current=setInterval(y,f))}}};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.54 */
|
|
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.54 */
|
|
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.54 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{useState as r}from"react";import{useEventListener as n}from"../useEventListener/useEventListener.js";import"../useEvent/useEvent.js";var i=function(i,t){var o,u,l=r(!1),s=e(l,2),a=s[0],v=s[1];return n(null!==(o=null==t?void 0:t.target)&&void 0!==o?o:window,"keydown",(function(e){(Array.isArray(i)?i.includes(e.key):e.key===i)&&v(!0)})),n(null!==(u=null==t?void 0:t.target)&&void 0!==u?u:window,"keyup",(function(e){(Array.isArray(i)?i.includes(e.key):e.key===i)&&v(!1)})),a};export{i as useKeyPress};
|
|
3
3
|
//# sourceMappingURL=useKeyPress.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
2
|
import{useEventListener as n}from"../useEventListener/useEventListener.js";import"react";import"../useEvent/useEvent.js";var e=function(){var e=Array.isArray(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:[arguments.length<=0?void 0:arguments[0]],t=(arguments.length<=1?void 0:arguments[1])instanceof Function?null:arguments.length<=1?void 0:arguments[1],i=t?arguments.length<=2?void 0:arguments[2]:arguments.length<=1?void 0:arguments[1];n(null!=t?t:window,"keydown",(function(n){e.includes(n.key)&&i(n)}),t?arguments.length<=3?void 0:arguments[3]:arguments.length<=2?void 0:arguments[2])};export{e as useKeyPressEvent};
|
|
3
3
|
//# sourceMappingURL=useKeyPressEvent.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
2
|
import{useEventListener as n}from"../useEventListener/useEventListener.js";import"react";import"../useEvent/useEvent.js";var e=function(e){var o,l;n(null!==(o=null==e?void 0:e.target)&&void 0!==o?o:window,"keydown",(function(n){var o;return null==e||null===(o=e.onKeyDown)||void 0===o?void 0:o.call(e,n)})),n(null!==(l=null==e?void 0:e.target)&&void 0!==l?l:window,"keyup",(function(n){var o;return null==e||null===(o=e.onKeyUp)||void 0===o?void 0:o.call(e,n)}))};export{e as useKeyboard};
|
|
3
3
|
//# sourceMappingURL=useKeyboard.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.54 */
|
|
2
|
+
import{_ as e,a as o}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{useState as t}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"../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=t([]),f=e(d,2),p=f[0],a=f[1];return n((function(){a([])}),[c]),r(null!==(s=null==i?void 0:i.target)&&void 0!==s?s:window,"keydown",(function(e){c&&a((function(t){return t.some((function(o){return o.code===e.code}))?t:[].concat(o(t),[{key:e.key,code:e.code}])}))})),r(null!==(l=null==i?void 0:i.target)&&void 0!==l?l:window,"keyup",(function(e){c&&a((function(o){return o.filter((function(o){return o.code!==e.code}))}))})),p};export{i as useKeysPressed};
|
|
3
3
|
//# sourceMappingURL=useKeysPressed.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useKeysPressed.js","sources":["../../../../src/hooks/useKeysPressed/useKeysPressed.ts"],"sourcesContent":["import { useState } from 'react';\n\nimport { useDidUpdate } from '../useDidUpdate/useDidUpdate';\nimport type { UseEventListenerTarget } from '../useEventListener/useEventListener';\nimport { useEventListener } from '../useEventListener/useEventListener';\n\n/** The use keys pressed params */\ninterface UseKeysPressedParams {\n /** The target to attach the event listeners to */\n target?: UseEventListenerTarget;\n
|
|
1
|
+
{"version":3,"file":"useKeysPressed.js","sources":["../../../../src/hooks/useKeysPressed/useKeysPressed.ts"],"sourcesContent":["import { useState } from 'react';\n\nimport { useDidUpdate } from '../useDidUpdate/useDidUpdate';\nimport type { UseEventListenerTarget } from '../useEventListener/useEventListener';\nimport { useEventListener } from '../useEventListener/useEventListener';\n\n/** The use keys pressed params */\ninterface UseKeysPressedParams {\n /** The target to attach the event listeners to */\n target?: UseEventListenerTarget;\n /** Enable or disable the event listeners */\n enabled?: boolean;\n}\n\n/**\n * @name useKeysPressed\n * @description - Hook for get keys that were pressed\n * @category Sensors\n *\n * @param {UseEventListenerTarget} [params.target=window] The target to attach the event listeners to\n * @param {boolean} [params.enabled=bollean] Enable or disable the event listeners\n * @returns {useKeysPressedReturns} Array of strings with keys that were press\n *\n * @example\n * const pressedKeys = useKeysPressed();\n */\nexport const useKeysPressed = (params?: UseKeysPressedParams) => {\n const enabled = params?.enabled ?? true;\n const [keys, setKeys] = useState<{ key: string; code: string }[]>([]);\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (!enabled) return;\n setKeys((prevKeys) => {\n if (prevKeys.some(({ code }) => code === event.code)) return prevKeys;\n return [...prevKeys, { key: event.key, code: event.code }];\n });\n };\n\n const onKeyUp = (event: KeyboardEvent) => {\n if (!enabled) return;\n setKeys((prevKeys) => prevKeys.filter(({ code }) => code !== event.code));\n };\n\n useDidUpdate(() => {\n setKeys([]);\n }, [enabled]);\n\n useEventListener(params?.target ?? window, 'keydown', onKeyDown);\n useEventListener(params?.target ?? window, 'keyup', onKeyUp);\n\n return keys;\n};\n"],"names":["useKeysPressed","params","_params$enabled","_params$target","_params$target2","enabled","_useState","useState","_useState2","_slicedToArray","keys","setKeys","useDidUpdate","useEventListener","target","window","event","prevKeys","some","_ref","code","concat","_toConsumableArray","key","filter","_ref2"],"mappings":";gYA0BaA,EAAiB,SAACC,GAAkC,IAAAC,EAAAC,EAAAC,EACzDC,EAAyBH,QAAlBA,EAAGD,aAAM,EAANA,EAAQI,eAAOH,IAAAA,GAAAA,EAC/BI,EAAwBC,EAA0C,IAAGC,EAAAC,EAAAH,EAAA,GAA9DI,EAAIF,EAAA,GAAEG,EAAOH,EAAA,GAsBpB,OAPAI,GAAa,WACXD,EAAQ,GACV,GAAG,CAACN,IAEJQ,UAAgBV,EAACF,aAAM,EAANA,EAAQa,cAAM,IAAAX,EAAAA,EAAIY,OAAQ,WAjBzB,SAACC,GACZX,GACLM,GAAQ,SAACM,GACP,OAAIA,EAASC,MAAK,SAAAC,GAAO,OAAAA,EAAJC,OAAoBJ,EAAMI,QAAcH,EAC7D,GAAAI,OAAAC,EAAWL,GAAU,CAAA,CAAEM,IAAKP,EAAMO,IAAKH,KAAMJ,EAAMI,OACrD,OAaFP,UAAgBT,EAACH,aAAM,EAANA,EAAQa,cAAM,IAAAV,EAAAA,EAAIW,OAAQ,SAV3B,SAACC,GACVX,GACLM,GAAQ,SAACM,GAAQ,OAAKA,EAASO,QAAO,SAAAC,GAAO,OAAAA,EAAJL,OAAoBJ,EAAMI,cAU9DV,CACT"}
|
|
@@ -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.54 */
|
|
2
|
+
import{_ as n,a as t}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.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
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{b as o}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{b as o}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{useStorage as r}from"../useStorage/useStorage.js";import"react";import"../../utils/helpers/isClient.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var e=function(e,t,i){return r(e,o({initialValue:t,storage:window.localStorage},i))};export{e as useLocalStorage};
|
|
3
3
|
//# sourceMappingURL=useLocalStorage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocalStorage.js","sources":["../../../../src/hooks/useLocalStorage/useLocalStorage.ts"],"sourcesContent":["import type { UseStorageInitialValue, UseStorageOptions } from '../useStorage/useStorage';\nimport { useStorage } from '../useStorage/useStorage';\n\n/**\n * @name useLocalStorage\n * @description - Hook that manages local storage value\n * @category Browser\n *\n * @template Value The type of the value\n * @param {string} key The key of the storage\n * @param {UseStorageInitialValue<Value>} [initialValue] The initial value of the storage\n * @param {UseStorageOptions<Value>} [options] The options of the storage\n *\n * @example\n * const
|
|
1
|
+
{"version":3,"file":"useLocalStorage.js","sources":["../../../../src/hooks/useLocalStorage/useLocalStorage.ts"],"sourcesContent":["import type { UseStorageInitialValue, UseStorageOptions } from '../useStorage/useStorage';\nimport { useStorage } from '../useStorage/useStorage';\n\n/**\n * @name useLocalStorage\n * @description - Hook that manages local storage value\n * @category Browser\n *\n * @template Value The type of the value\n * @param {string} key The key of the storage\n * @param {UseStorageInitialValue<Value>} [initialValue] The initial value of the storage\n * @param {UseStorageOptions<Value>} [options] The options of the storage\n *\n * @example\n * const { value, set, remove } = useLocalStorage('key', 'value');\n */\nexport const useLocalStorage = <Value>(\n key: string,\n initialValue?: UseStorageInitialValue<Value>,\n options?: UseStorageOptions<Value>\n) => useStorage(key, { initialValue, storage: window.localStorage, ...options });\n"],"names":["useLocalStorage","key","initialValue","options","useStorage","_objectSpread","storage","window","localStorage"],"mappings":";iPAgBO,IAAMA,EAAkB,SAC7BC,EACAC,EACAC,GAAkC,OAC/BC,EAAWH,EAAGI,EAAA,CAAIH,aAAAA,EAAcI,QAASC,OAAOC,cAAiBL,GAAU"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{a as o}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{a as o}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{useEffect as t}from"react";import{useDidUpdate as e}from"../useDidUpdate/useDidUpdate.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var n=function(n,c){t((function(){var t;return(t=console).log.apply(t,["".concat(n," mounted")].concat(o(c))),function(){return console.log("".concat(n," unmounted"))}}),[]),e((function(){var t;(t=console).log.apply(t,["".concat(n," updated")].concat(o(c)))}),c)};export{n as useLogger};
|
|
3
3
|
//# sourceMappingURL=useLogger.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{_ as n}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{useState as l,useRef as e}from"react";import{useEventListener as t}from"../useEventListener/useEventListener.js";import"../useEvent/useEvent.js";var o=function(){var o=(arguments.length<=0?void 0:arguments[0])instanceof Function||!("current"in(arguments.length<=0?void 0:arguments[0]))||arguments.length<=0?void 0:arguments[0],r=o?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],u=o?arguments.length<=2?void 0:arguments[2]:arguments.length<=1?void 0:arguments[1],i=l(!1),c=n(i,2),v=c[0],s=c[1],a=e(),d=e(),h=e(!1),m=function(n){var l,e;null==u||null===(l=u.onStart)||void 0===l||l.call(u,n),h.current=!0,d.current=setTimeout((function(){r(n),s(!0)}),null!==(e=null==u?void 0:u.threshold)&&void 0!==e?e:400)},f=function(n){var l;if(v)null==u||null===(l=u.onFinish)||void 0===l||l.call(u,n);else if(h.current){var e;null==u||null===(e=u.onCancel)||void 0===e||e.call(u,n)}s(!1),h.current=!1,d.current&&clearTimeout(d.current)};return t(null!=o?o:a,"mousedown",m),t(null!=o?o:a,"touchstart",m),t(null!=o?o:a,"mouseup",f),t(null!=o?o:a,"touchend",f),o?v:[a,v]};export{o as useLongPress};
|
|
3
3
|
//# sourceMappingURL=useLongPress.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{useState as r}from"react";var n=function(n){var t=r(new Map(n)),u=e(t,2),a=u[0],o=u[1];return{value:a,size:a.size,set:function(e,r){return o((function(n){return new Map(n).set(e,r)}))},has:function(e){return a.has(e)},remove:function(e){return o((function(r){if(!r.has(e))return r;var n=new Map(r);return n.delete(e),n}))},clear:function(){return o(new Map)},reset:function(){return o(new Map(n))}}};export{n as useMap};
|
|
3
3
|
//# sourceMappingURL=useMap.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e,b as t}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{_ as e,b as t}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{useRef as r,useState as o}from"react";import{useResizeObserver as i}from"../useResizeObserver/useResizeObserver.js";import"../useRerender/useRerender.js";var s=function(s){var h=r(),n=o({x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0}),f=e(n,2),l=f[0],m=f[1];return i(null!=s?s:h,{onChange:function(t){var r=e(t,1)[0];if(r){var o=r.contentRect,i=o.x,s=o.y,h=o.width,n=o.height,f=o.top,l=o.left,p=o.bottom,u=o.right;m({x:i,y:s,width:h,height:n,top:f,left:l,bottom:p,right:u})}}}),s?l:t({ref:h},l)};export{s as useMeasure};
|
|
3
3
|
//# sourceMappingURL=useMeasure.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
2
|
import{useCallback as n,useSyncExternalStore as e}from"react";var t=function(){return!1},r=function(r){var a=n((function(n){var e=window.matchMedia(r);return e.addEventListener("change",n),function(){e.removeEventListener("change",n)}}),[r]);return e(a,(function(){return window.matchMedia(r).matches}),t)};export{r as useMediaQuery};
|
|
3
3
|
//# sourceMappingURL=useMediaQuery.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{useState as r}from"react";import{useInterval as o}from"../useInterval/useInterval.js";import"../useEvent/useEvent.js";var t=function(){var t=performance&&"memory"in performance,a=r({jsHeapSizeLimit:0,totalJSHeapSize:0,usedJSHeapSize:0}),n=e(a,2),m=n[0],p=n[1];return o((function(){return p(performance.memory)}),1e3,{enabled:t}),{supported:t,value:m}};export{t as useMemory};
|
|
3
3
|
//# sourceMappingURL=useMemory.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e,b as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{_ as e,b as n}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{useState as t,useRef as r,useEffect as o}from"react";import{useRerender as i}from"../useRerender/useRerender.js";var u=function(){for(var u=i(),m=arguments.length,c=new Array(m),l=0;l<m;l++)c[l]=arguments[l];var a=c[0],f=t({x:0,y:0,elementX:0,elementY:0,elementPositionX:0,elementPositionY:0}),s=e(f,2),p=s[0],v=s[1],d=r();return o((function(){if(a||d.current){var e=function(e){var t=a?function(e){return"function"==typeof e?e():e instanceof Element?e:e.current}(a):d.current;if(t){var r={x:e.pageX,y:e.pageY},o=t.getBoundingClientRect(),i=o.left,u=o.top,m=i+window.scrollX,c=u+window.scrollY,l=e.pageX-m,f=e.pageY-c;r.elementX=l,r.elementY=f,r.elementPositionX=m,r.elementPositionY=c,v((function(e){return n(n({},e),r)}))}};return document.addEventListener("mousemove",e),function(){document.removeEventListener("mousemove",e)}}}),[d.current,a]),a?p:n({ref:function(e){d.current||(d.current=e,u.update())}},p)};export{u as useMouse};
|
|
3
3
|
//# sourceMappingURL=useMouse.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r,d as n,e as t}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{_ as r,d as n,e as t}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{useRef as e,useState as u}from"react";import{getRetry as l}from"../../utils/helpers/getRetry.js";import"../../utils/helpers/isClient.js";var o=function(o,i){var c=e(null!=i&&i.retry?l(i.retry):0),s=u(!1),a=r(s,2),p=a[0],f=a[1],m=u(!1),v=r(m,2),y=v[0],d=v[1],h=u(!1),g=r(h,2),j=g[0],b=g[1],w=u(null),x=r(w,2),E=x[0],S=x[1],_=u(null),k=r(_,2),A=k[0],B=k[1],C=function r(n){return f(!0),o(n).then((function(r){var n;return null==i||null===(n=i.onSuccess)||void 0===n||n.call(i,r),B(r),b(!0),f(!1),S(null),d(!1),r})).catch((function(t){var e;if(c.current>0)return c.current-=1,r(n);null==i||null===(e=i.onError)||void 0===e||e.call(i,t),B(null),b(!1),f(!1),S(t),d(!0),c.current=null!=i&&i.retry?l(i.retry):0}))},H=function(){var r=n(t().mark((function r(n){return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",C(n));case 1:case"end":return r.stop()}}),r)})));return function(n){return r.apply(this,arguments)}}();return{data:A,error:E,mutate:function(r){C(r)},mutateAsync:H,isLoading:p,isError:y,isSuccess:j}};export{o as useMutation};
|
|
3
3
|
//# sourceMappingURL=useMutation.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
2
|
import{useRef as r,useEffect as n}from"react";function t(t,e,u){var c=r(),o=r(null);return n((function(){var r="function"==typeof u?u():u;return(r||o.current)&&(c.current=new MutationObserver(t),c.current.observe(r||o.current,e)),function(){var r;null===(r=c.current)||void 0===r||r.disconnect()}}),[t,e]),o}export{t as useMutationObserver};
|
|
3
3
|
//# sourceMappingURL=useMutationObserver.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{_ as n}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{useState as e,useEffect as i}from"react";import{isClient as o}from"../../utils/helpers/isClient.js";var t=function(){var n,e,i;return(null===(n=navigator)||void 0===n?void 0:n.connection)||(null===(e=navigator)||void 0===e?void 0:e.mozConnection)||(null===(i=navigator)||void 0===i?void 0:i.webkitConnection)},l=function(){var l=e((function(){if(!o)return{online:!1,type:void 0,effectiveType:void 0,saveData:!1,downlink:0,downlinkMax:0,rtt:0};var n=navigator.onLine,e=t();return{online:n,downlink:null==e?void 0:e.downlink,downlinkMax:null==e?void 0:e.downlinkMax,effectiveType:null==e?void 0:e.effectiveType,rtt:null==e?void 0:e.rtt,saveData:null==e?void 0:e.saveData,type:null==e?void 0:e.type}})),v=n(l,2),a=v[0],r=v[1];return i((function(){var n=function(){var n=navigator.onLine,e=t();r({online:n,downlink:null==e?void 0:e.downlink,downlinkMax:null==e?void 0:e.downlinkMax,effectiveType:null==e?void 0:e.effectiveType,rtt:null==e?void 0:e.rtt,saveData:null==e?void 0:e.saveData,type:null==e?void 0:e.type})};window.addEventListener("online",n,{passive:!0}),window.addEventListener("offline",n,{passive:!0});var e=t();return e&&e.addEventListener("change",n,{passive:!0}),function(){window.removeEventListener("online",n),window.removeEventListener("offline",n),e&&e.removeEventListener("change",n)}})),a};export{t as getConnection,l as useNetwork};
|
|
3
3
|
//# sourceMappingURL=useNetwork.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
2
|
import{useSyncExternalStore as n}from"react";var e=function(){return navigator.onLine},t=function(){return!1},i=function(n){return window.addEventListener("online",n),window.addEventListener("offline",n),function(){window.removeEventListener("online",n),window.removeEventListener("offline",n)}},o=function(){return n(i,e,t)};export{o as useOnline};
|
|
3
3
|
//# sourceMappingURL=useOnline.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
2
|
import{useRef as n}from"react";var i=function(){if("undefined"==typeof window)return"undetermined";var n=window.navigator.userAgent;return/(Macintosh)|(MacIntel)|(MacPPC)|(Mac68K)/i.test(n)?"macos":/(iPhone)|(iPad)|(iPod)/i.test(n)?"ios":/(Win32)|(Win64)|(Windows)|(WinCE)/i.test(n)?"windows":/Android/i.test(n)?"android":/Linux/i.test(n)?"linux":"undetermined"},t=function(){return n(i()).current};export{i as getOperatingSystem,t as useOperatingSystem};
|
|
3
3
|
//# sourceMappingURL=useOperatingSystem.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{useState as n}from"react";import{useIsomorphicLayoutEffect as r}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var o=function(){var o=n({angle:0,type:"landscape-primary"}),t=e(o,2),i=t[0],a=t[1];return r((function(){var e,n=function(){var e=window.screen.orientation,n=e.angle,r=e.type;a({angle:n,type:r})};return null===(e=window.screen.orientation)||void 0===e||e.addEventListener("change",n),function(){var e;return null===(e=window.screen.orientation)||void 0===e?void 0:e.removeEventListener("change",n)}}),[]),i};export{o as useOrientation};
|
|
3
3
|
//# sourceMappingURL=useOrientation.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{useState as n,useEffect as t}from"react";import{useEvent as r}from"../useEvent/useEvent.js";var o=function(o){var u=n(!1),s=e(u,2),m=s[0],i=s[1],v=r((function(){if(m)return i(!1);null==o||o(),i(!0)}));return t((function(){return document.addEventListener("mouseleave",v,{passive:!0}),document.addEventListener("mouseenter",v,{passive:!0}),function(){document.removeEventListener("mouseenter",v),document.removeEventListener("mouseleave",v)}}),[]),m};export{o as usePageLeave};
|
|
3
3
|
//# sourceMappingURL=usePageLeave.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{g as t,h as s,i}from"../../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{g as t,h as s,i}from"../../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{Pointer as r}from"./Pointer.js";var h=function(){return t((function t(h){var e=h.x,o=h.y,n=h.radius,u=h.smooth;s(this,t),i(this,"smooth",!1),i(this,"points",[]),i(this,"lines",[]),this.smooth=u,this.pointer=new r(e,o),this.brush=new r(e,o),this.radius=n,this.points=[],this.lines=[]}),[{key:"getBrushCoordinates",value:function(){return{x:this.brush.x,y:this.brush.y}}},{key:"getPointerCoordinates",value:function(){return{x:this.pointer.x,y:this.pointer.y}}},{key:"update",value:function(t){if(this.pointer.equalsTo(t))return!1;if(this.pointer.update(t),!this.smooth)return this.brush.update(t),this.points.push(this.getBrushCoordinates()),!0;var s=this.pointer.getDistanceTo(this.brush),i=this.pointer.getAngleTo(this.brush);if(Math.round(10*(s-this.radius))/10>0){var r=i+Math.PI/2;return this.brush.update({x:this.brush.x+Math.sin(r)*(s-this.radius),y:this.brush.y-Math.cos(r)*(s-this.radius)}),this.points.push(this.getBrushCoordinates()),!0}return!1}}])}();export{h as Paint};
|
|
3
3
|
//# sourceMappingURL=Paint.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{g as t,h as e}from"../../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{g as t,h as e}from"../../../_rollupPluginBabelHelpers-0IYrm-Ud.js";var n=function(){function n(t,i){e(this,n),this.x=t,this.y=i}return t(n,[{key:"update",value:function(t){this.x=t.x,this.y=t.y}},{key:"getDifferenceTo",value:function(t){return new n(this.x-t.x,this.y-t.y)}},{key:"getDistanceTo",value:function(t){var e=this.getDifferenceTo(t);return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}},{key:"getAngleTo",value:function(t){var e=this.getDifferenceTo(t);return Math.atan2(e.y,e.x)}},{key:"equalsTo",value:function(t){return this.x===t.x&&this.y===t.y}},{key:"moveByAngle",value:function(t,e){var n=t+Math.PI/2;return this.x+=Math.sin(n)*e,this.y-=Math.cos(n)*e,this}}])}();export{n as Pointer};
|
|
3
3
|
//# sourceMappingURL=Pointer.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{c as n,_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{c as n,_ as r}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{useRef as e,useState as t,useEffect as o}from"react";import{useEvent as u}from"../useEvent/useEvent.js";import{Paint as i}from"./helpers/Paint.js";import"./helpers/Pointer.js";var c=function(n){return"function"==typeof n?n():n instanceof Element?n:n.current},l=function(){var l,s,a,v,d,f="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,p=f?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],h=null!==(l=null==p?void 0:p.color)&&void 0!==l?l:"black",m=null!==(s=null==p?void 0:p.opacity)&&void 0!==s?s:1,y=null!==(a=null==p?void 0:p.radius)&&void 0!==a?a:10,g=e(new i({x:0,y:0,radius:null!==(v=null==p?void 0:p.radius)&&void 0!==v?v:10,smooth:null!==(d=null==p?void 0:p.smooth)&&void 0!==d&&d})),x=t(!1),E=r(x,2),w=E[0],L=E[1],b=e(null),j=e(null),M=function(n,r,e,t){if(j.current){j.current.globalAlpha=e,j.current.strokeStyle=r,j.current.lineWidth=2*t,j.current.lineCap="round",j.current.lineJoin="round";var o=n[0],u=n[1];j.current.beginPath();for(var i=1;i<n.length;i+=1){var c={x:o.x+(u.x-o.x)/2,y:o.y+(u.y-o.y)/2};j.current.quadraticCurveTo(o.x,o.y,c.x,c.y),o=n[i],u=n[i+1]}j.current.lineTo(o.x,o.y),j.current.stroke()}},P=function(){j.current&&j.current.clearRect(0,0,j.current.canvas.width,j.current.canvas.height)},k=u((function(n){var r;if(w){null==p||null===(r=p.onMouseMove)||void 0===r||r.call(p,n,g.current);var e={x:n.offsetX,y:n.offsetY};g.current.update(e)&&j.current&&(P(),j.current.clearRect(0,0,j.current.canvas.width,j.current.canvas.height),g.current.lines.forEach((function(n){var r=n.points,e=n.color,t=n.opacity,o=n.radius;return M(r,e,t,o)})),M(g.current.points,h,m,y))}})),C=u((function(n){var r;if(j.current){var e={x:n.offsetX,y:n.offsetY};g.current.brush.update(e),g.current.points.push(e),M(g.current.points,h,m,y),null==p||null===(r=p.onMouseDown)||void 0===r||r.call(p,n,g.current),L(!0)}})),R=u((function(n){var r;j.current&&(g.current.points.length&&(g.current.lines.push({points:g.current.points,color:h,opacity:m,radius:y}),g.current.points=[]),null==p||null===(r=p.onMouseUp)||void 0===r||r.call(p,n,g.current),L(!1))})),T=function(){j.current&&(P(),g.current.lines=[],g.current.points=[])},X=function(){j.current&&(P(),g.current.lines.pop(),g.current.lines.forEach((function(n){var r=n.points,e=n.color,t=n.opacity,o=n.radius;return M(r,e,t,o)})))};return o((function(){var n=f?c(f):b.current;if(n)return j.current=n.getContext("2d"),null!=p&&p.initialLines&&(g.current.lines=p.initialLines,p.initialLines.forEach((function(n){var r=n.points,e=n.color,t=n.opacity,o=n.radius;return M(r,e,t,o)}))),n.addEventListener("mousedown",C),n.addEventListener("mousemove",k),n.addEventListener("mouseup",R),function(){n&&(n.removeEventListener("mousedown",C),n.removeEventListener("mousemove",k),n.removeEventListener("mouseup",R))}}),[]),f?{drawing:w,clear:T,undo:X,draw:M,lines:g.current.lines}:{ref:b,drawing:w,clear:T,undo:X,draw:M,lines:g.current.lines}};export{c as getElement,l as usePaint};
|
|
3
3
|
//# sourceMappingURL=usePaint.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r,d as e,e as t}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{_ as r,d as e,e as t}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{useState as n,useEffect as a}from"react";import{useEvent as s}from"../useEvent/useEvent.js";var o=function(o){var u=n("prompt"),i=r(u,2),p=i[0],c=i[1],m=navigator&&"permissions"in navigator,v={name:o},f=s(e(t().mark((function r(){var e;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,navigator.permissions.query(v);case 3:return e=r.sent,c(e.state),r.abrupt("return",e.state);case 8:return r.prev=8,r.t0=r.catch(0),c("prompt"),r.abrupt("return","prompt");case 12:case"end":return r.stop()}}),r,null,[[0,8]])}))));return a((function(){if(m)return f(),window.addEventListener("change",f),function(){window.removeEventListener("change",f)}}),[o]),{state:p,supported:m,query:f}};export{o as usePermission};
|
|
3
3
|
//# sourceMappingURL=usePermission.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
2
|
import{useMediaQuery as e}from"../useMediaQuery/useMediaQuery.js";import"react";var r=function(){var r=e("(prefers-color-scheme: light)"),o=e("(prefers-color-scheme: dark)");return r?"light":o?"dark":"no-preference"};export{r as usePreferredColorScheme};
|
|
3
3
|
//# sourceMappingURL=usePreferredColorScheme.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
2
|
import{useMediaQuery as r}from"../useMediaQuery/useMediaQuery.js";import"react";var e=function(){var e=r("(prefers-contrast: more)"),s=r("(prefers-contrast: less)"),t=r("(prefers-contrast: custom)");return e?"more":s?"less":t?"custom":"no-preference"};export{e as usePreferredContrast};
|
|
3
3
|
//# sourceMappingURL=usePreferredContrast.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
2
|
import{useMediaQuery as r}from"../useMediaQuery/useMediaQuery.js";import"react";var e=function(){return r("(prefers-color-scheme: dark)")};export{e as usePreferredDark};
|
|
3
3
|
//# sourceMappingURL=usePreferredDark.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
2
|
import{useSyncExternalStore as n}from"react";var e=function(){return window.navigator.languages},r=function(){return[]},t=function(n){return window.addEventListener("languagechange",n),function(){window.removeEventListener("languagechange",n)}},a=function(){return n(t,e,r)};export{a as usePreferredLanguages};
|
|
3
3
|
//# sourceMappingURL=usePreferredLanguages.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
2
|
import{useMediaQuery as e}from"../useMediaQuery/useMediaQuery.js";import"react";var r=function(){return e("(prefers-reduced-motion: reduce)")?"reduce":"no-preference"};export{r as usePreferredReducedMotion};
|
|
3
3
|
//# sourceMappingURL=usePreferredReducedMotion.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
2
|
import{useRef as r,useEffect as t}from"react";var n=function(n){var c=r();return t((function(){c.current=n})),c.current};export{n as usePrevious};
|
|
3
3
|
//# sourceMappingURL=usePrevious.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e,a as
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{_ as e,a as l}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{useRef as r,useState as t,useEffect as n}from"react";import{getRetry as i}from"../../utils/helpers/getRetry.js";import"../../utils/helpers/isClient.js";import{useDidUpdate as u}from"../useDidUpdate/useDidUpdate.js";import{useMount as o}from"../useMount/useMount.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var a=function(a,c){var f,s,v,d=null===(f=null==c?void 0:c.enabled)||void 0===f||f,h=r(null!=c&&c.retry?i(c.retry):0),p=t(!1),m=e(p,2),y=m[0],I=m[1],D=t(!1),j=e(D,2),g=j[0],E=j[1],L=t(!1),b=e(L,2),k=b[0],M=b[1],R=t(!(null==c||!c.initialData)),S=e(R,2),U=S[0],_=S[1],x=t(void 0),B=e(x,2),C=B[0],F=B[1],H=t(null==c?void 0:c.initialData),P=e(H,2),q=P[0],w=P[1],z=r(),A=function e(l){I(!0),"refetch"===l&&M(!0),a().then((function(e){var r,t=null!=c&&c.select?null==c?void 0:c.select(e):e;null==c||null===(r=c.onSuccess)||void 0===r||r.call(c,t),w(t),_(!0),I(!1),F(void 0),E(!1),"refetch"===l&&M(!1)})).catch((function(r){var t;if(h.current>0)return h.current-=1,e(l);null==c||null===(t=c.onError)||void 0===t||t.call(c,r),w(void 0),_(!1),I(!1),F(r),E(!0),"refetch"===l&&M(!1),h.current=null!=c&&c.retry?i(c.retry):0})).finally((function(){if(null!=c&&c.refetchInterval){var l=setInterval((function(){clearInterval(l),e("refetch")}),null==c?void 0:c.refetchInterval);z.current=l}}))};n((function(){if(null!=c&&c.refetchInterval)return function(){null!=c&&c.refetchInterval&&clearInterval(z.current)}}),[null==c?void 0:c.refetchInterval,null==c?void 0:c.retry].concat(l(null!==(s=null==c?void 0:c.keys)&&void 0!==s?s:[]))),o((function(){null!=c&&c.initialData||!d||A("init")})),u((function(){return A("refetch")}),null!==(v=null==c?void 0:c.keys)&&void 0!==v?v:[]);var G=(null==c?void 0:c.placeholderData)instanceof Function?null==c?void 0:c.placeholderData():null==c?void 0:c.placeholderData;return{data:null!=q?q:G,error:C,refetch:function(){return A("refetch")},isLoading:y,isError:g,isSuccess:U,isRefetching:k}};export{a as useQuery};
|
|
3
3
|
//# sourceMappingURL=useQuery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useQuery.js","sources":["../../../../src/hooks/useQuery/useQuery.ts"],"sourcesContent":["import type { DependencyList } from 'react';\nimport { useEffect, useRef, useState } from 'react';\n\nimport { getRetry } from '@/utils/helpers';\n\nimport { useDidUpdate } from '../useDidUpdate/useDidUpdate';\nimport { useMount } from '../useMount/useMount';\n\n/* The use query return type */\nexport interface UseQueryOptions<QueryData, Data> {\n /* The depends for the hook */\n keys?: DependencyList;\n /* The callback function to be invoked on success */\n onSuccess?: (data: Data) => void;\n /* The callback function to be invoked on error */\n onError?: (error: Error) => void;\n /* The select function to be invoked */\n select?: (data: QueryData) => Data;\n /* The initial data for the hook */\n initialData?: Data | (() => Data);\n /* The placeholder data for the hook */\n placeholderData?: Data | (() => Data);\n /* The retry count of requests */\n retry?: boolean | number;\n /* The refetch interval */\n refetchInterval?: number;\n}\n\n/* The use query return type */\nexport interface UseQueryReturn<Data> {\n /* The state of the query */\n data?: Data;\n /* The loading state of the query */\n isLoading: boolean;\n /* The error state of the query */\n isError: boolean;\n /* The success state of the query */\n isSuccess: boolean;\n /* The success state of the query */\n error?: Error;\n /* The refetch function */\n refetch: () => void;\n /* The refetching state of the query */\n isRefetching: boolean;\n}\n\n/**\n * @name useQuery\n * @description - Hook that defines the logic when query data\n * @category Utilities\n *\n * @template Data The type of the data\n * @param {() => Promise<Data>} callback The callback function to be invoked\n * @param {DependencyList} [options.keys] The dependencies for the hook\n * @param {(data: Data) => void} [options.onSuccess] The callback function to be invoked on success\n * @param {(error: Error) => void} [options.onError] The callback function to be invoked on error\n * @param {UseQueryOptionsSelect<Data>} [options.select] The select function to be invoked\n * @param {Data | (() => Data)} [options.initialData] The initial data for the hook\n * @param {Data | (() => Data)} [options.placeholderData] The placeholder data for the hook\n * @param {number} [options.refetchInterval] The refetch interval\n * @param {boolean | number} [options.retry] The retry count of requests\n * @returns {UseQueryReturn<Data>} An object with the state of the query\n *\n * @example\n * const { data, isLoading, isError, isSuccess, error, refetch, isRefetching } = useQuery(() => fetch('https://example.com/data'));\n */\nexport const useQuery = <QueryData, Data = QueryData>(\n callback: () => Promise<QueryData>,\n options?: UseQueryOptions<QueryData, Data>\n): UseQueryReturn<Data> => {\n const retryCountRef = useRef(options?.retry ? getRetry(options.retry) : 0);\n\n const [isLoading, setIsLoading] = useState(false);\n const [isError, setIsError] = useState(false);\n const [isRefetching, setIsRefetching] = useState(false);\n const [isSuccess, setIsSuccess] = useState(!!options?.initialData);\n\n const [error, setError] = useState<Error | undefined>(undefined);\n const [data, setData] = useState<Data | undefined>(options?.initialData);\n\n const intervalIdRef = useRef<ReturnType<typeof setInterval>>();\n\n const request = (action: 'init' | 'refetch') => {\n setIsLoading(true);\n if (action === 'refetch') setIsRefetching(true);\n\n callback()\n .then((response) => {\n const data = options?.select ? options?.select(response) : response;\n options?.onSuccess?.(data as Data);\n setData(data as Data);\n setIsSuccess(true);\n setIsLoading(false);\n setError(undefined);\n setIsError(false);\n if (action === 'refetch') setIsRefetching(false);\n })\n .catch((error: Error) => {\n if (retryCountRef.current > 0) {\n retryCountRef.current -= 1;\n return request(action);\n }\n options?.onError?.(error);\n setData(undefined);\n setIsSuccess(false);\n setIsLoading(false);\n setError(error);\n setIsError(true);\n if (action === 'refetch') setIsRefetching(false);\n retryCountRef.current = options?.retry ? getRetry(options.retry) : 0;\n })\n .finally(() => {\n if (options?.refetchInterval) {\n const interval = setInterval(() => {\n clearInterval(interval);\n request('refetch');\n }, options?.refetchInterval);\n intervalIdRef.current = interval;\n }\n });\n };\n\n useEffect(() => {\n if (!options?.refetchInterval) return;\n\n return () => {\n if (options?.refetchInterval) {\n clearInterval(intervalIdRef.current);\n }\n };\n }, [options?.refetchInterval, options?.retry, ...(options?.keys ?? [])]);\n\n useMount(() => {\n if (options?.initialData) return;\n request('init');\n });\n\n useDidUpdate(() => request('refetch'), options?.keys ?? []);\n\n const refetch = () => request('refetch');\n\n const placeholderData =\n options?.placeholderData instanceof Function\n ? options?.placeholderData()\n : options?.placeholderData;\n\n return {\n data: data ?? placeholderData,\n error,\n refetch,\n isLoading,\n isError,\n isSuccess,\n isRefetching\n };\n};\n"],"names":["useQuery","callback","options","_options$keys","_options$keys2","retryCountRef","useRef","retry","getRetry","_useState","useState","_useState2","_slicedToArray","isLoading","setIsLoading","_useState3","_useState4","isError","setIsError","_useState5","_useState6","isRefetching","setIsRefetching","_useState7","initialData","_useState8","isSuccess","setIsSuccess","_useState9","undefined","_useState10","error","setError","_useState11","_useState12","data","setData","intervalIdRef","request","action","then","response","_options$onSuccess","select","onSuccess","call","_options$onError","current","onError","refetchInterval","interval","setInterval","clearInterval","useEffect","concat","_toConsumableArray","keys","useMount","useDidUpdate","placeholderData","Function","refetch"],"mappings":";
|
|
1
|
+
{"version":3,"file":"useQuery.js","sources":["../../../../src/hooks/useQuery/useQuery.ts"],"sourcesContent":["import type { DependencyList } from 'react';\nimport { useEffect, useRef, useState } from 'react';\n\nimport { getRetry } from '@/utils/helpers';\n\nimport { useDidUpdate } from '../useDidUpdate/useDidUpdate';\nimport { useMount } from '../useMount/useMount';\n\n/* The use query return type */\nexport interface UseQueryOptions<QueryData, Data> {\n /* The depends for the hook */\n keys?: DependencyList;\n /* The callback function to be invoked on success */\n onSuccess?: (data: Data) => void;\n /* The callback function to be invoked on error */\n onError?: (error: Error) => void;\n /* The select function to be invoked */\n select?: (data: QueryData) => Data;\n /* The initial data for the hook */\n initialData?: Data | (() => Data);\n /* The placeholder data for the hook */\n placeholderData?: Data | (() => Data);\n /* The retry count of requests */\n retry?: boolean | number;\n /* The refetch interval */\n refetchInterval?: number;\n /* The enabled state of the query */\n enabled?: boolean;\n}\n\n/* The use query return type */\nexport interface UseQueryReturn<Data> {\n /* The state of the query */\n data?: Data;\n /* The loading state of the query */\n isLoading: boolean;\n /* The error state of the query */\n isError: boolean;\n /* The success state of the query */\n isSuccess: boolean;\n /* The success state of the query */\n error?: Error;\n /* The refetch function */\n refetch: () => void;\n /* The refetching state of the query */\n isRefetching: boolean;\n}\n\n/**\n * @name useQuery\n * @description - Hook that defines the logic when query data\n * @category Utilities\n *\n * @template Data The type of the data\n * @param {() => Promise<Data>} callback The callback function to be invoked\n * @param {DependencyList} [options.keys] The dependencies for the hook\n * @param {(data: Data) => void} [options.onSuccess] The callback function to be invoked on success\n * @param {(error: Error) => void} [options.onError] The callback function to be invoked on error\n * @param {UseQueryOptionsSelect<Data>} [options.select] The select function to be invoked\n * @param {Data | (() => Data)} [options.initialData] The initial data for the hook\n * @param {Data | (() => Data)} [options.placeholderData] The placeholder data for the hook\n * @param {number} [options.refetchInterval] The refetch interval\n * @param {boolean | number} [options.retry] The retry count of requests\n * @returns {UseQueryReturn<Data>} An object with the state of the query\n *\n * @example\n * const { data, isLoading, isError, isSuccess, error, refetch, isRefetching } = useQuery(() => fetch('https://example.com/data'));\n */\nexport const useQuery = <QueryData, Data = QueryData>(\n callback: () => Promise<QueryData>,\n options?: UseQueryOptions<QueryData, Data>\n): UseQueryReturn<Data> => {\n const enabled = options?.enabled ?? true;\n const retryCountRef = useRef(options?.retry ? getRetry(options.retry) : 0);\n\n const [isLoading, setIsLoading] = useState(false);\n const [isError, setIsError] = useState(false);\n const [isRefetching, setIsRefetching] = useState(false);\n const [isSuccess, setIsSuccess] = useState(!!options?.initialData);\n\n const [error, setError] = useState<Error | undefined>(undefined);\n const [data, setData] = useState<Data | undefined>(options?.initialData);\n\n const intervalIdRef = useRef<ReturnType<typeof setInterval>>();\n\n const request = (action: 'init' | 'refetch') => {\n setIsLoading(true);\n if (action === 'refetch') setIsRefetching(true);\n\n callback()\n .then((response) => {\n const data = options?.select ? options?.select(response) : response;\n options?.onSuccess?.(data as Data);\n setData(data as Data);\n setIsSuccess(true);\n setIsLoading(false);\n setError(undefined);\n setIsError(false);\n if (action === 'refetch') setIsRefetching(false);\n })\n .catch((error: Error) => {\n if (retryCountRef.current > 0) {\n retryCountRef.current -= 1;\n return request(action);\n }\n options?.onError?.(error);\n setData(undefined);\n setIsSuccess(false);\n setIsLoading(false);\n setError(error);\n setIsError(true);\n if (action === 'refetch') setIsRefetching(false);\n retryCountRef.current = options?.retry ? getRetry(options.retry) : 0;\n })\n .finally(() => {\n if (options?.refetchInterval) {\n const interval = setInterval(() => {\n clearInterval(interval);\n request('refetch');\n }, options?.refetchInterval);\n intervalIdRef.current = interval;\n }\n });\n };\n\n useEffect(() => {\n if (!options?.refetchInterval) return;\n\n return () => {\n if (options?.refetchInterval) {\n clearInterval(intervalIdRef.current);\n }\n };\n }, [options?.refetchInterval, options?.retry, ...(options?.keys ?? [])]);\n\n useMount(() => {\n if (options?.initialData || !enabled) return;\n request('init');\n });\n\n useDidUpdate(() => request('refetch'), options?.keys ?? []);\n\n const refetch = () => request('refetch');\n\n const placeholderData =\n options?.placeholderData instanceof Function\n ? options?.placeholderData()\n : options?.placeholderData;\n\n return {\n data: data ?? placeholderData,\n error,\n refetch,\n isLoading,\n isError,\n isSuccess,\n isRefetching\n };\n};\n"],"names":["useQuery","callback","options","_options$enabled","_options$keys","_options$keys2","enabled","retryCountRef","useRef","retry","getRetry","_useState","useState","_useState2","_slicedToArray","isLoading","setIsLoading","_useState3","_useState4","isError","setIsError","_useState5","_useState6","isRefetching","setIsRefetching","_useState7","initialData","_useState8","isSuccess","setIsSuccess","_useState9","undefined","_useState10","error","setError","_useState11","_useState12","data","setData","intervalIdRef","request","action","then","response","_options$onSuccess","select","onSuccess","call","_options$onError","current","onError","refetchInterval","interval","setInterval","clearInterval","useEffect","concat","_toConsumableArray","keys","useMount","useDidUpdate","placeholderData","Function","refetch"],"mappings":";0ZAoEO,IAAMA,EAAW,SACtBC,EACAC,GACyB,IAAAC,EAAAC,EAAAC,EACnBC,EAA0BH,QAAnBA,EAAGD,aAAO,EAAPA,EAASI,eAAOH,IAAAA,GAAAA,EAC1BI,EAAgBC,EAAON,SAAAA,EAASO,MAAQC,EAASR,EAAQO,OAAS,GAExEE,EAAkCC,GAAS,GAAMC,EAAAC,EAAAH,EAAA,GAA1CI,EAASF,EAAA,GAAEG,EAAYH,EAAA,GAC9BI,EAA8BL,GAAS,GAAMM,EAAAJ,EAAAG,EAAA,GAAtCE,EAAOD,EAAA,GAAEE,EAAUF,EAAA,GAC1BG,EAAwCT,GAAS,GAAMU,EAAAR,EAAAO,EAAA,GAAhDE,EAAYD,EAAA,GAAEE,EAAeF,EAAA,GACpCG,EAAkCb,IAAWV,UAAAA,EAASwB,cAAYC,EAAAb,EAAAW,EAAA,GAA3DG,EAASD,EAAA,GAAEE,EAAYF,EAAA,GAE9BG,EAA0BlB,OAA4BmB,GAAUC,EAAAlB,EAAAgB,EAAA,GAAzDG,EAAKD,EAAA,GAAEE,EAAQF,EAAA,GACtBG,EAAwBvB,EAA2BV,aAAAA,EAAAA,EAASwB,aAAYU,EAAAtB,EAAAqB,EAAA,GAAjEE,EAAID,EAAA,GAAEE,EAAOF,EAAA,GAEdG,EAAgB/B,IAEhBgC,EAAU,SAAVA,EAAWC,GACfzB,GAAa,GACE,YAAXyB,GAAsBjB,GAAgB,GAE1CvB,IACGyC,MAAK,SAACC,GAAa,IAAAC,EACZP,EAAOnC,SAAAA,EAAS2C,OAAS3C,eAAAA,EAAS2C,OAAOF,GAAYA,EAC3DzC,SAAkB,QAAX0C,EAAP1C,EAAS4C,iBAAS,IAAAF,GAAlBA,EAAAG,KAAA7C,EAAqBmC,GACrBC,EAAQD,GACRR,GAAa,GACbb,GAAa,GACbkB,OAASH,GACTX,GAAW,GACI,YAAXqB,GAAsBjB,GAAgB,EAC5C,IAAE,OACK,SAACS,GAAiB,IAAAe,EACvB,GAAIzC,EAAc0C,QAAU,EAE1B,OADA1C,EAAc0C,SAAW,EAClBT,EAAQC,GAEjBvC,SAAgB,QAAT8C,EAAP9C,EAASgD,eAAO,IAAAF,GAAhBA,EAAAD,KAAA7C,EAAmB+B,GACnBK,OAAQP,GACRF,GAAa,GACbb,GAAa,GACbkB,EAASD,GACTb,GAAW,GACI,YAAXqB,GAAsBjB,GAAgB,GAC1CjB,EAAc0C,QAAU/C,SAAAA,EAASO,MAAQC,EAASR,EAAQO,OAAS,KAE7D,SAAC,WACP,GAAIP,SAAAA,EAASiD,gBAAiB,CAC5B,IAAMC,EAAWC,aAAY,WAC3BC,cAAcF,GACdZ,EAAQ,aACPtC,eAAAA,EAASiD,iBACZZ,EAAcU,QAAUG,CAC1B,CACF,KAGJG,GAAU,WACR,GAAKrD,SAAAA,EAASiD,gBAEd,OAAO,WACDjD,SAAAA,EAASiD,iBACXG,cAAcf,EAAcU,SAGlC,IAAI/C,aAAO,EAAPA,EAASiD,gBAAiBjD,aAAO,EAAPA,EAASO,OAAK+C,OAAAC,UAAArD,EAAMF,aAAAA,EAAAA,EAASwD,YAAI,IAAAtD,EAAAA,EAAI,MAEnEuD,GAAS,WACHzD,SAAAA,EAASwB,cAAgBpB,GAC7BkC,EAAQ,OACV,IAEAoB,GAAa,WAAA,OAAMpB,EAAQ,UAAU,WAAAnC,EAAEH,aAAAA,EAAAA,EAASwD,YAAI,IAAArD,EAAAA,EAAI,IAExD,IAEMwD,GACJ3D,aAAAA,EAAAA,EAAS2D,2BAA2BC,SAChC5D,aAAAA,EAAAA,EAAS2D,kBACT3D,aAAAA,EAAAA,EAAS2D,gBAEf,MAAO,CACLxB,KAAMA,QAAAA,EAAQwB,EACd5B,MAAAA,EACA8B,QAVc,WAAH,OAASvB,EAAQ,UAAU,EAWtCzB,UAAAA,EACAI,QAAAA,EACAS,UAAAA,EACAL,aAAAA,EAEJ"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r,a as n,f as t}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{_ as r,a as n,f as t}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{useState as e}from"react";import{flushSync as o}from"react-dom";var u=function(){var u=e(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),a=r(u,2),i=a[0],c=a[1];return{add:function(r){return c((function(t){return[].concat(n(t),[r])}))},remove:function(){var r;return o((function(){c((function(n){var e=t(n),o=e[0],u=e.slice(1);return r=o,u}))})),r},clear:function(){return c([])},first:i[0],last:i[i.length-1],size:i.length,queue:i}};export{u as useQueue};
|
|
3
3
|
//# sourceMappingURL=useQueue.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
2
|
import{useRef as r,useEffect as t}from"react";var n=function(){var n=r(0);return t((function(){n.current+=1})),n.current};export{n as useRenderCount};
|
|
3
3
|
//# sourceMappingURL=useRenderCount.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
2
|
import{useRef as e}from"react";var n=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Unknown",r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=e({component:n,renders:0,timestamp:Date.now(),sinceLast:0}),c=Date.now();return t.current.renders+=1,t.current.sinceLast=t.current.timestamp?c-t.current.timestamp:0,t.current.timestamp=c,r&&(console.group("".concat(n," info, render number: ").concat(t.current.renders)),console.log("Timestamp: ".concat(t.current.timestamp)),console.log("Since last render: ".concat(t.current.sinceLast)),console.log("Renders: ".concat(t.current.renders)),console.dir(t.current),console.groupEnd()),t.current};export{n as useRenderInfo};
|
|
3
3
|
//# sourceMappingURL=useRenderInfo.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{useId as t,useState as o}from"react";var n=function(){var n=t(),a=o(n),e=r(a,2),i=e[0],u=e[1];return{id:i,update:function(){return u(Math.random().toString())}}};export{n as useRerender};
|
|
3
3
|
//# sourceMappingURL=useRerender.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{c as n,_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.54 */
|
|
2
|
+
import{c as n,_ as r}from"../../_rollupPluginBabelHelpers-0IYrm-Ud.js";import{useState as e,useRef as t,useEffect as o}from"react";import{useRerender as i}from"../useRerender/useRerender.js";var u=function(n){return"function"==typeof n?n():n instanceof Element?n:n.current},c=function(){var c,l=i(),v="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,a=v?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],f=null===(c=null==a?void 0:a.enabled)||void 0===c||c,s=e([]),d=r(s,2),b=d[0],g=d[1],h=t(),p=t();return p.current=null==a?void 0:a.onChange,o((function(){if(f){if(Array.isArray(v)){if(!v.length)return;var n=new ResizeObserver((function(r){var e;g(r),null===(e=p.current)||void 0===e||e.call(p,r,n)}));return v.forEach((function(r){var e=u(r);e&&n.observe(e,a)})),function(){n.disconnect()}}var r=v?u(v):h.current;if(r){var e=new ResizeObserver((function(n){var r;g(n),null===(r=p.current)||void 0===r||r.call(p,n,e)}));return e.observe(r,a),function(){e.disconnect()}}}}),[h.current,v,null==a?void 0:a.box,f]),v?{entries:b}:{ref:function(n){h.current||(h.current=n,l.update())},entries:b}};export{c as useResizeObserver};
|
|
3
3
|
//# sourceMappingURL=useResizeObserver.js.map
|