@siberiacancode/reactuse 0.0.43 → 0.0.44
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-BRE4VASD.js → _rollupPluginBabelHelpers-Bx9oEugz.js} +2 -2
- package/dist/cjs/_rollupPluginBabelHelpers-Bx9oEugz.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/useBrowserLanguage/useBrowserLanguage.js +1 -1
- package/dist/cjs/hooks/useClickOutside/useClickOutside.js +1 -1
- package/dist/cjs/hooks/useCopyToClipboard/useCopyToClipboard.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 +3 -0
- package/dist/cjs/hooks/useFileDialog/useFileDialog.js.map +1 -0
- package/dist/cjs/hooks/useFps/useFps.js +2 -2
- package/dist/cjs/hooks/useFullscreen/useFullscreen.js +2 -2
- package/dist/cjs/hooks/useFullscreen/useFullscreen.js.map +1 -1
- package/dist/cjs/hooks/useGeolocation/useGeolocation.js +2 -2
- package/dist/cjs/hooks/useHash/useHash.js +2 -2
- package/dist/cjs/hooks/useHotkeys/useHotkeys.js +2 -2
- package/dist/cjs/hooks/useHover/useHover.js +2 -2
- package/dist/cjs/hooks/useIdle/useIdle.js +2 -2
- package/dist/cjs/hooks/useImage/useImage.js +3 -0
- package/dist/cjs/hooks/useImage/useImage.js.map +1 -0
- 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/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 +3 -0
- package/dist/cjs/hooks/useMeasure/useMeasure.js.map +1 -0
- 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/usePreferredLanguages/usePreferredLanguages.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/useScript/useScript.js +2 -2
- 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 +3 -0
- package/dist/cjs/hooks/useStopwatch/useStopwatch.js.map +1 -0
- package/dist/cjs/hooks/useStorage/useStorage.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/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/useWindowSize/useWindowSize.js +2 -2
- package/dist/cjs/hooks/useWizard/useWizard.js +2 -2
- package/dist/cjs/index-P7gOty8T.js +3 -0
- package/dist/cjs/index-P7gOty8T.js.map +1 -0
- 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/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-q3sUYXUv.js → _rollupPluginBabelHelpers-CePHKKZk.js} +3 -3
- package/dist/esm/_rollupPluginBabelHelpers-CePHKKZk.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/useBrowserLanguage/useBrowserLanguage.js +1 -1
- package/dist/esm/hooks/useClickOutside/useClickOutside.js +1 -1
- package/dist/esm/hooks/useCopyToClipboard/useCopyToClipboard.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 +3 -0
- package/dist/esm/hooks/useFileDialog/useFileDialog.js.map +1 -0
- package/dist/esm/hooks/useFps/useFps.js +2 -2
- package/dist/esm/hooks/useFullscreen/useFullscreen.js +2 -2
- package/dist/esm/hooks/useFullscreen/useFullscreen.js.map +1 -1
- package/dist/esm/hooks/useGeolocation/useGeolocation.js +2 -2
- package/dist/esm/hooks/useHash/useHash.js +2 -2
- package/dist/esm/hooks/useHotkeys/useHotkeys.js +2 -2
- package/dist/esm/hooks/useHover/useHover.js +2 -2
- package/dist/esm/hooks/useIdle/useIdle.js +2 -2
- package/dist/esm/hooks/useImage/useImage.js +3 -0
- package/dist/esm/hooks/useImage/useImage.js.map +1 -0
- 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/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 +3 -0
- package/dist/esm/hooks/useMeasure/useMeasure.js.map +1 -0
- 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/usePreferredLanguages/usePreferredLanguages.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/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/useShare/useShare.js.map +1 -1
- package/dist/esm/hooks/useStep/useStep.js +2 -2
- package/dist/esm/hooks/useStopwatch/useStopwatch.js +3 -0
- package/dist/esm/hooks/useStopwatch/useStopwatch.js.map +1 -0
- package/dist/esm/hooks/useStorage/useStorage.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/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/useWindowSize/useWindowSize.js +2 -2
- package/dist/esm/hooks/useWizard/useWizard.js +2 -2
- package/dist/esm/index-D_PnqV6k.js +3 -0
- package/dist/esm/index-D_PnqV6k.js.map +1 -0
- 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/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 +261 -43
- package/package.json +1 -1
- package/dist/cjs/_rollupPluginBabelHelpers-BRE4VASD.js.map +0 -1
- package/dist/esm/_rollupPluginBabelHelpers-q3sUYXUv.js.map +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
2
|
+
import{c as n,_ as e,b as t}from"../../_rollupPluginBabelHelpers-CePHKKZk.js";import{useState as r,useRef as o,useEffect as i}from"react";var l=function(){var l,u="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,c=u?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],v=null===(l=null==c?void 0:c.enabled)||void 0===l||l,a=r(),d=e(a,2),s=d[0],f=d[1],g=o(null),h=o();return h.current=null==c?void 0:c.onChange,i((function(){if(v){var n=u?function(n){return"function"==typeof n?n():n instanceof Element?n:n.current}(u):g.current;if(n){var r,o=new IntersectionObserver((function(n){var t,r=e(n,1)[0];f(r),null===(t=h.current)||void 0===t||t.call(h,r)}),t(t({},c),{},{root:(r=null==c?void 0:c.root,r?r instanceof Element||r instanceof Document?r:r.current:document)}));return o.observe(n),function(){o.disconnect()}}}}),[u,null==c?void 0:c.rootMargin,null==c?void 0:c.threshold,v]),u?{entry:s,inView:!(null==s||!s.isIntersecting)}:{ref:g,entry:s,inView:!(null==s||!s.isIntersecting)}};export{l as useIntersectionObserver};
|
|
3
3
|
//# sourceMappingURL=useIntersectionObserver.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
2
|
+
import{c as e,_ as r}from"../../_rollupPluginBabelHelpers-CePHKKZk.js";import{useState as t,useRef as n,useEffect as u}from"react";import{useEvent as l}from"../useEvent/useEvent.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var o=function(){for(var o,i,a=arguments.length,c=new Array(a),s=0;s<a;s++)c[s]=arguments[s];var f=c[0],v=null!==(o="number"==typeof c[1]?c[1]:c[1].interval)&&void 0!==o?o:1e3,p="object"===e(c[1])?c[1]:c[2],m=null===(i=null==p?void 0:p.enabled)||void 0===i||i,I=t(null==m||m),j=r(I,2),b=j[0],d=j[1],h=n(),y=l(f);u((function(){if(m)return h.current=setInterval(y,v),function(){clearInterval(h.current)}}),[m,v]);return{isActive:b,pause:function(){d(!1),clearInterval(h.current)},resume:function(){v<=0||(d(!0),clearInterval(h.current),h.current=setInterval(y,v))}}};export{o as useInterval};
|
|
3
3
|
//# sourceMappingURL=useInterval.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
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.44 */
|
|
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.44 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-CePHKKZk.js";import{useState as r}from"react";import{useEventListener as t}from"../useEventListener/useEventListener.js";import"../useEvent/useEvent.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var i=function(i,o){var n,s,u=r(!1),l=e(u,2),a=l[0],p=l[1];return t(null!==(n=null==o?void 0:o.target)&&void 0!==n?n:window,"keydown",(function(e){(Array.isArray(i)?i.includes(e.key):e.key===i)&&p(!0)})),t(null!==(s=null==o?void 0:o.target)&&void 0!==s?s:window,"keyup",(function(e){(Array.isArray(i)?i.includes(e.key):e.key===i)&&p(!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.44 */
|
|
2
2
|
import{useEventListener as e}from"../useEventListener/useEventListener.js";import"react";import"../useEvent/useEvent.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.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.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
2
2
|
import{useEventListener as o}from"../useEventListener/useEventListener.js";import"react";import"../useEvent/useEvent.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var e=function(e){var n,t;o(null!==(n=null==e?void 0:e.target)&&void 0!==n?n:window,"keydown",(function(o){var n;return null==e||null===(n=e.onKeyDown)||void 0===n?void 0:n.call(e,o)})),o(null!==(t=null==e?void 0:e.target)&&void 0!==t?t:window,"keyup",(function(o){var n;return null==e||null===(n=e.onKeyUp)||void 0===n?void 0:n.call(e,o)}))};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.44 */
|
|
2
|
+
import{_ as e,a as o}from"../../_rollupPluginBabelHelpers-CePHKKZk.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,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as n,a as t}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
2
|
+
import{_ as n,a as t}from"../../_rollupPluginBabelHelpers-CePHKKZk.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:function(n){return i(n)},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{
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
2
|
+
import{b as o}from"../../_rollupPluginBabelHelpers-CePHKKZk.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,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{a as o}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
2
|
+
import{a as o}from"../../_rollupPluginBabelHelpers-CePHKKZk.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.44 */
|
|
2
|
+
import{_ as n}from"../../_rollupPluginBabelHelpers-CePHKKZk.js";import{useState as e,useRef as l}from"react";import{useEventListener as t}from"../useEventListener/useEventListener.js";import"../useEvent/useEvent.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.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],u=o?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],r=o?arguments.length<=2?void 0:arguments[2]:arguments.length<=1?void 0:arguments[1],i=e(!1),s=n(i,2),c=s[0],v=s[1],a=l(null),d=l(),h=l(!1),m=function(n){var e,l;null==r||null===(e=r.onStart)||void 0===e||e.call(r,n),h.current=!0,d.current=setTimeout((function(){u(n),v(!0)}),null!==(l=null==r?void 0:r.threshold)&&void 0!==l?l:400)},f=function(n){var e;if(c)null==r||null===(e=r.onFinish)||void 0===e||e.call(r,n);else if(h.current){var l;null==r||null===(l=r.onCancel)||void 0===l||l.call(r,n)}v(!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?c:[a,c]};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.44 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-CePHKKZk.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
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
2
|
+
import{_ as t,b as e}from"../../_rollupPluginBabelHelpers-CePHKKZk.js";import{useRef as o,useState as r}from"react";import{useIsomorphicLayoutEffect as n}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var i=function(i){var f=o(null),c=r({x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0}),u=t(c,2),s=u[0],l=u[1];return n((function(){var e=i?function(t){return"function"==typeof t?t():t instanceof Element?t:t.current}(i):f.current;if(console.log("@element",f.current),e){var o=new window.ResizeObserver((function(e){var o=t(e,1)[0];if(o){var r=o.contentRect,n=r.x,i=r.y,f=r.width,c=r.height,u=r.top,s=r.left,h=r.bottom,m=r.right;l({x:n,y:i,width:f,height:c,top:u,left:s,bottom:h,right:m})}}));return o.observe(e),function(){o.disconnect()}}}),[i]),i?s:e({ref:f},s)};export{i as useMeasure};
|
|
3
|
+
//# sourceMappingURL=useMeasure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMeasure.js","sources":["../../../../src/hooks/useMeasure/useMeasure.ts"],"sourcesContent":["import type { RefObject } from 'react';\nimport { useRef, useState } from 'react';\n\nimport { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect';\n\n/** The use measure target element type */\nexport type UseMeasureTarget = RefObject<Element | null> | (() => Element) | Element;\n\nconst getElement = (target: UseMeasureTarget) => {\n if (typeof target === 'function') {\n return target();\n }\n\n if (target instanceof Element) {\n return target;\n }\n\n return target.current;\n};\n\n/** The use measure return type */\nexport type UseMeasureReturn = Pick<\n DOMRectReadOnly,\n 'x' | 'y' | 'top' | 'left' | 'right' | 'bottom' | 'height' | 'width'\n>;\n\nexport type UseMeasureScreen = {\n <Target extends UseMeasureTarget>(target: Target): UseMeasureReturn;\n\n <Target extends UseMeasureTarget>(target?: never): UseMeasureReturn & { ref: RefObject<Target> };\n};\n\n/**\n * @name useMeasure\n * @description - Hook to measure the size and position of an element\n * @category Browser\n *\n * @overload\n * @template Target The element to measure\n * @param {Target} [target] The element to measure\n * @returns {UseMeasureReturn} The element's size and position\n *\n * @example\n * const { x, y, width, height, top, left, bottom, right } = useMeasure(ref);\n *\n * @overload\n * @template Target The element to measure\n * @returns {UseMeasureReturn & { ref: RefObject<Target> }} The element's size and position\n *\n * @example\n * const { ref, x, y, width, height, top, left, bottom, right } = useMeasure();\n */\nexport const useMeasure = (<Target extends UseMeasureTarget>(target?: Target) => {\n const internalRef = useRef<Element>(null);\n const [rect, setRect] = useState({\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n top: 0,\n left: 0,\n bottom: 0,\n right: 0\n });\n\n useIsomorphicLayoutEffect(() => {\n const element = target ? getElement(target) : internalRef.current;\n console.log('@element', internalRef.current);\n if (!element) return;\n\n const observer = new window.ResizeObserver(([entry]) => {\n if (!entry) return;\n\n const { x, y, width, height, top, left, bottom, right } = entry.contentRect;\n setRect({ x, y, width, height, top, left, bottom, right });\n });\n observer.observe(element);\n\n return () => {\n observer.disconnect();\n };\n }, [target]);\n\n if (target) return rect;\n return { ref: internalRef, ...rect };\n}) as UseMeasureScreen;\n"],"names":["useMeasure","target","internalRef","useRef","_useState","useState","x","y","width","height","top","left","bottom","right","_useState2","_slicedToArray","rect","setRect","useIsomorphicLayoutEffect","element","Element","current","getElement","console","log","observer","window","ResizeObserver","_ref","entry","_entry$contentRect","contentRect","observe","disconnect","_objectSpread","ref"],"mappings":";kQAQA,IA4CaA,EAAc,SAAkCC,GAC3D,IAAMC,EAAcC,EAAgB,MACpCC,EAAwBC,EAAS,CAC/BC,EAAG,EACHC,EAAG,EACHC,MAAO,EACPC,OAAQ,EACRC,IAAK,EACLC,KAAM,EACNC,OAAQ,EACRC,MAAO,IACPC,EAAAC,EAAAX,EAAA,GATKY,EAAIF,EAAA,GAAEG,EAAOH,EAAA,GA6BpB,OAlBAI,GAA0B,WACxB,IAAMC,EAAUlB,EA1DD,SAACA,GAClB,MAAsB,mBAAXA,EACFA,IAGLA,aAAkBmB,QACbnB,EAGFA,EAAOoB,OAChB,CAgD6BC,CAAWrB,GAAUC,EAAYmB,QAE1D,GADAE,QAAQC,IAAI,WAAYtB,EAAYmB,SAC/BF,EAAL,CAEA,IAAMM,EAAW,IAAIC,OAAOC,gBAAe,SAAAC,GAAa,IAAXC,EAAWd,EAAAa,EAAA,GAAN,GAChD,GAAKC,EAAL,CAEA,IAAAC,EAA0DD,EAAME,YAAxDzB,EAACwB,EAADxB,EAAGC,EAACuB,EAADvB,EAAGC,EAAKsB,EAALtB,MAAOC,EAAMqB,EAANrB,OAAQC,EAAGoB,EAAHpB,IAAKC,EAAImB,EAAJnB,KAAMC,EAAMkB,EAANlB,OAAQC,EAAKiB,EAALjB,MAChDI,EAAQ,CAAEX,EAAAA,EAAGC,EAAAA,EAAGC,MAAAA,EAAOC,OAAAA,EAAQC,IAAAA,EAAKC,KAAAA,EAAMC,OAAAA,EAAQC,MAAAA,GAHtC,CAId,IAGA,OAFAY,EAASO,QAAQb,GAEV,WACLM,EAASQ,aAXG,CAahB,GAAG,CAAChC,IAEAA,EAAee,EACnBkB,EAAA,CAASC,IAAKjC,GAAgBc,EAChC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
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.44 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-CePHKKZk.js";import{useState as r}from"react";import{isClient as o}from"../../utils/helpers/isClient.js";import{useInterval as t}from"../useInterval/useInterval.js";import"../useEvent/useEvent.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var s=function(){var s=!!o&&"memory"in performance,i=r({jsHeapSizeLimit:0,totalJSHeapSize:0,usedJSHeapSize:0}),m=e(i,2),p=m[0],u=m[1];return t((function(){return u(performance.memory)}),1e3,{enabled:s}),{supported:s,value:p}};export{s as useMemory};
|
|
3
3
|
//# sourceMappingURL=useMemory.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e,
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
2
|
+
import{_ as e,b as t}from"../../_rollupPluginBabelHelpers-CePHKKZk.js";import{useState as n,useRef as o}from"react";import{useIsomorphicLayoutEffect as r}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var i=function(){for(var i=arguments.length,l=new Array(i),u=0;u<i;u++)l[u]=arguments[u];var m=l[0],s=n({x:0,y:0,elementX:0,elementY:0,elementPositionX:0,elementPositionY:0}),c=e(s,2),f=c[0],a=c[1],p=o(null);return r((function(){var e=function(e){var n=m?function(e){return"function"==typeof e?e():e instanceof Element?e:e.current}(m):p.current;if(n){var o={x:e.pageX,y:e.pageY},r=n.getBoundingClientRect(),i=r.left,l=r.top,u=i+window.scrollX,s=l+window.scrollY,c=e.pageX-u,f=e.pageY-s;o.elementX=c,o.elementY=f,o.elementPositionX=u,o.elementPositionY=s,a((function(e){return t(t({},e),o)}))}};return document.addEventListener("mousemove",e),function(){document.removeEventListener("mousemove",e)}}),[]),m?f:t(t({},f),{},{ref:p})};export{i as useMouse};
|
|
3
3
|
//# sourceMappingURL=useMouse.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r,
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
2
|
+
import{_ as r,d as n,e as t}from"../../_rollupPluginBabelHelpers-CePHKKZk.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.44 */
|
|
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.44 */
|
|
2
|
+
import{_ as n}from"../../_rollupPluginBabelHelpers-CePHKKZk.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.44 */
|
|
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.44 */
|
|
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.44 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-CePHKKZk.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.44 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-CePHKKZk.js";import{useState as t,useEffect as r}from"react";import{useEvent as n}from"../useEvent/useEvent.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var o=function(o){var s=t(!1),u=e(s,2),i=u[0],m=u[1],v=n((function(){if(i)return m(!1);null==o||o(),m(!0)}));return r((function(){return document.addEventListener("mouseleave",v,{passive:!0}),document.addEventListener("mouseenter",v,{passive:!0}),function(){document.removeEventListener("mouseenter",v),document.removeEventListener("mouseleave",v)}}),[]),i};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.44 */
|
|
2
|
+
import{g as t,h as s,i}from"../../../_rollupPluginBabelHelpers-CePHKKZk.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.44 */
|
|
2
|
+
import{g as t,h as e}from"../../../_rollupPluginBabelHelpers-CePHKKZk.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{
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
2
|
+
import{c as n,_ as r}from"../../_rollupPluginBabelHelpers-CePHKKZk.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"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.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,p="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,f=p?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],h=null!==(l=null==f?void 0:f.color)&&void 0!==l?l:"black",m=null!==(s=null==f?void 0:f.opacity)&&void 0!==s?s:1,y=null!==(a=null==f?void 0:f.radius)&&void 0!==a?a:10,g=e(new i({x:0,y:0,radius:null!==(v=null==f?void 0:f.radius)&&void 0!==v?v:10,smooth:null!==(d=null==f?void 0:f.smooth)&&void 0!==d&&d})),E=t(!1),x=r(E,2),L=x[0],w=x[1],j=e(null),b=e(null),C=function(n,r,e,t){if(b.current){b.current.globalAlpha=e,b.current.strokeStyle=r,b.current.lineWidth=2*t,b.current.lineCap="round",b.current.lineJoin="round";var o=n[0],u=n[1];b.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};b.current.quadraticCurveTo(o.x,o.y,c.x,c.y),o=n[i],u=n[i+1]}b.current.lineTo(o.x,o.y),b.current.stroke()}},M=function(){b.current&&b.current.clearRect(0,0,b.current.canvas.width,b.current.canvas.height)},P=u((function(n){var r;if(L){null==f||null===(r=f.onMouseMove)||void 0===r||r.call(f,n,g.current);var e={x:n.offsetX,y:n.offsetY};g.current.update(e)&&b.current&&(M(),b.current.clearRect(0,0,b.current.canvas.width,b.current.canvas.height),g.current.lines.forEach((function(n){var r=n.points,e=n.color,t=n.opacity,o=n.radius;return C(r,e,t,o)})),C(g.current.points,h,m,y))}})),k=u((function(n){var r;if(b.current){var e={x:n.offsetX,y:n.offsetY};g.current.brush.update(e),g.current.points.push(e),C(g.current.points,h,m,y),null==f||null===(r=f.onMouseDown)||void 0===r||r.call(f,n,g.current),w(!0)}})),I=u((function(n){var r;b.current&&(g.current.points.length&&(g.current.lines.push({points:g.current.points,color:h,opacity:m,radius:y}),g.current.points=[]),null==f||null===(r=f.onMouseUp)||void 0===r||r.call(f,n,g.current),w(!1))})),R=function(){b.current&&(M(),g.current.lines=[],g.current.points=[])},T=function(){b.current&&(M(),g.current.lines.pop(),g.current.lines.forEach((function(n){var r=n.points,e=n.color,t=n.opacity,o=n.radius;return C(r,e,t,o)})))};return o((function(){var n=p?c(p):j.current;if(n)return b.current=n.getContext("2d"),null!=f&&f.initialLines&&(g.current.lines=f.initialLines,f.initialLines.forEach((function(n){var r=n.points,e=n.color,t=n.opacity,o=n.radius;return C(r,e,t,o)}))),n.addEventListener("mousedown",k),n.addEventListener("mousemove",P),n.addEventListener("mouseup",I),function(){n&&(n.removeEventListener("mousedown",k),n.removeEventListener("mousemove",P),n.removeEventListener("mouseup",I))}}),[]),p?{drawing:L,clear:R,undo:T,draw:C,lines:g.current.lines}:{ref:j,drawing:L,clear:R,undo:T,draw:C,lines:g.current.lines}};export{c as getTargetElement,l as usePaint};
|
|
3
3
|
//# sourceMappingURL=usePaint.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r,
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
2
|
+
import{_ as r,d as e,e as t}from"../../_rollupPluginBabelHelpers-CePHKKZk.js";import{useState as n,useEffect as s}from"react";import{isClient as o}from"../../utils/helpers/isClient.js";import{useEvent as a}from"../useEvent/useEvent.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var i=function(i){var u=n("prompt"),p=r(u,2),c=p[0],m=p[1],f=!!o&&(navigator&&"permissions"in navigator),v={name:i},l=a(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,m(e.state),r.abrupt("return",e.state);case 8:return r.prev=8,r.t0=r.catch(0),m("prompt"),r.abrupt("return","prompt");case 12:case"end":return r.stop()}}),r,null,[[0,8]])}))));return s((function(){if(f)return l(),window.addEventListener("change",l),function(){window.removeEventListener("change",l)}}),[i]),{state:c,supported:f,query:l}};export{i as usePermission};
|
|
3
3
|
//# sourceMappingURL=usePermission.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
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.44 */
|
|
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.44 */
|
|
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 l}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
2
|
+
import{_ as l}from"../../_rollupPluginBabelHelpers-CePHKKZk.js";import{useRef as r,useState as e,useEffect as n}from"react";import{getRetry as t}from"../../utils/helpers/getRetry.js";import"../../utils/helpers/isClient.js";var i=function(i,o){var a,u=r(null!=o&&o.retry?t(o.retry):0),c=e(!1),f=l(c,2),s=f[0],v=f[1],d=e(!1),h=l(d,2),p=h[0],m=h[1],y=e(!1),D=l(y,2),g=D[0],I=D[1],j=e(!(null==o||!o.initialData)),E=l(j,2),R=E[0],S=E[1],_=e(void 0),b=l(_,2),k=b[0],x=b[1],B=e(null==o?void 0:o.initialData),C=l(B,2),F=C[0],H=C[1],L=function l(r){v(!0),"refetch"===r&&I(!0),i().then((function(l){var e,n=null!=o&&o.select?null==o?void 0:o.select(l):l;null==o||null===(e=o.onSuccess)||void 0===e||e.call(o,n),H(n),S(!0),v(!1),x(void 0),m(!1),"refetch"===r&&I(!1)})).catch((function(e){var n;if(u.current>0)return u.current-=1,l(r);null==o||null===(n=o.onError)||void 0===n||n.call(o,e),H(void 0),S(!1),v(!1),x(e),m(!0),"refetch"===r&&I(!1),u.current=null!=o&&o.retry?t(o.retry):0})).finally((function(){if(null!=o&&o.refetchInterval)var r=setInterval((function(){l("refetch"),clearInterval(r)}),null==o?void 0:o.refetchInterval)}))};n((function(){null!=o&&o.initialData||L("init")}),null!==(a=null==o?void 0:o.keys)&&void 0!==a?a:[]);var P=(null==o?void 0:o.placeholderData)instanceof Function?null==o?void 0:o.placeholderData():null==o?void 0:o.placeholderData;return{data:null!=F?F:P,error:k,refetch:function(){return L("refetch")},isLoading:s,isError:p,isSuccess:R,isRefetching:g}};export{i 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\n/* The use query return type */\
|
|
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\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 refetch async function */\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 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 request('refetch');\n clearInterval(interval);\n }, options?.refetchInterval);\n }\n });\n };\n\n useEffect(() => {\n if (options?.initialData) return;\n request('init');\n }, 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","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","request","action","then","response","_options$onSuccess","select","onSuccess","call","_options$onError","current","onError","refetchInterval","interval","setInterval","clearInterval","useEffect","keys","placeholderData","Function","refetch"],"mappings":";+NA+DO,IAAMA,EAAW,SACtBC,EACAC,GACyB,IAAAC,EACnBC,EAAgBC,EAAOH,SAAAA,EAASI,MAAQC,EAASL,EAAQI,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,IAAWP,UAAAA,EAASqB,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,EAA2BP,aAAAA,EAAAA,EAASqB,aAAYU,EAAAtB,EAAAqB,EAAA,GAAjEE,EAAID,EAAA,GAAEE,EAAOF,EAAA,GAEdG,EAAU,SAAVA,EAAWC,GACfxB,GAAa,GACE,YAAXwB,GAAsBhB,GAAgB,GAE1CpB,IACGqC,MAAK,SAACC,GAAa,IAAAC,EACZN,EAAOhC,SAAAA,EAASuC,OAASvC,eAAAA,EAASuC,OAAOF,GAAYA,EAC3DrC,SAAkB,QAAXsC,EAAPtC,EAASwC,iBAAS,IAAAF,GAAlBA,EAAAG,KAAAzC,EAAqBgC,GACrBC,EAAQD,GACRR,GAAa,GACbb,GAAa,GACbkB,OAASH,GACTX,GAAW,GACI,YAAXoB,GAAsBhB,GAAgB,EAC5C,IAAE,OACK,SAACS,GAAiB,IAAAc,EACvB,GAAIxC,EAAcyC,QAAU,EAE1B,OADAzC,EAAcyC,SAAW,EAClBT,EAAQC,GAEjBnC,SAAgB,QAAT0C,EAAP1C,EAAS4C,eAAO,IAAAF,GAAhBA,EAAAD,KAAAzC,EAAmB4B,GACnBK,OAAQP,GACRF,GAAa,GACbb,GAAa,GACbkB,EAASD,GACTb,GAAW,GACI,YAAXoB,GAAsBhB,GAAgB,GAC1CjB,EAAcyC,QAAU3C,SAAAA,EAASI,MAAQC,EAASL,EAAQI,OAAS,KAE7D,SAAC,WACP,GAAIJ,SAAAA,EAAS6C,gBACX,IAAMC,EAAWC,aAAY,WAC3Bb,EAAQ,WACRc,cAAcF,KACb9C,eAAAA,EAAS6C,gBAEhB,KAGJI,GAAU,WACJjD,SAAAA,EAASqB,aACba,EAAQ,OACV,WAACjC,EAAED,aAAAA,EAAAA,EAASkD,YAAI,IAAAjD,EAAAA,EAAI,IAEpB,IAEMkD,GACJnD,aAAAA,EAAAA,EAASmD,2BAA2BC,SAChCpD,aAAAA,EAAAA,EAASmD,kBACTnD,aAAAA,EAAAA,EAASmD,gBAEf,MAAO,CACLnB,KAAMA,QAAAA,EAAQmB,EACdvB,MAAAA,EACAyB,QAVc,WAAH,OAASnB,EAAQ,UAAU,EAWtCxB,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.44 */
|
|
2
|
+
import{_ as r,a as n,f as t}from"../../_rollupPluginBabelHelpers-CePHKKZk.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.44 */
|
|
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.44 */
|
|
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.44 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-CePHKKZk.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{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-CePHKKZk.js";import{useState as t,useEffect as e}from"react";var n="script-status",o=function(o){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=t((function(){var r=document.querySelector('script[src="'.concat(o,'"]')),t=null==r?void 0:r.getAttribute(n);return t||(r?"unknown":"loading")})),c=r(u,2),a=c[0],s=c[1],d=i.removeOnUnmount,v=void 0===d||d,l=i.async,m=void 0===l||l;return e((function(){var t=document.querySelector('script[src="'.concat(o,'"]')),e=null==t?void 0:t.getAttribute(n);if(e)return s(e);if(t)return s("unknown");var u=document.createElement("script");u.src=o,u.async=m;for(var c=0,a=Object.entries(i);c<a.length;c++){var d=r(a[c],2),l=d[0],f=d[1];u.setAttribute(l,String(f))}u.setAttribute(n,"loading"),document.body.appendChild(u);var p=function(){u.setAttribute(n,"ready"),s("ready")},b=function(){u.setAttribute(n,"error"),s("error")};return u.addEventListener("load",p),u.addEventListener("error",b),function(){v&&(u.remove(),u.removeEventListener("load",p),u.removeEventListener("error",b))}}),[o,v]),a};export{n as SCRIPT_STATUS_ATTRIBUTE_NAME,o as useScript};
|
|
3
3
|
//# sourceMappingURL=useScript.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
2
|
+
import{b as o}from"../../_rollupPluginBabelHelpers-CePHKKZk.js";import{useStorage as e}from"../useStorage/useStorage.js";import"react";import"../../utils/helpers/isClient.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var r=function(r,t,s){return e(r,o({initialValue:t,storage:window.sessionStorage},s))};export{r as useSessionStorage};
|
|
3
3
|
//# sourceMappingURL=useSessionStorage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSessionStorage.js","sources":["../../../../src/hooks/useSessionStorage/useSessionStorage.ts"],"sourcesContent":["import type { UseStorageInitialValue, UseStorageOptions } from '../useStorage/useStorage';\nimport { useStorage } from '../useStorage/useStorage';\n\n/**\n * @name useSessionStorage\n * @description - Hook that manages session 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, setValue, removeValue] = useSessionStorage('key', 'value');\n */\nexport const useSessionStorage = <Value>(\n key: string,\n initialValue?: UseStorageInitialValue<Value>,\n options?: UseStorageOptions<Value>\n) => useStorage(key, { initialValue, storage: window.sessionStorage, ...options });\n"],"names":["useSessionStorage","key","initialValue","options","useStorage","_objectSpread","storage","window","sessionStorage"],"mappings":";
|
|
1
|
+
{"version":3,"file":"useSessionStorage.js","sources":["../../../../src/hooks/useSessionStorage/useSessionStorage.ts"],"sourcesContent":["import type { UseStorageInitialValue, UseStorageOptions } from '../useStorage/useStorage';\nimport { useStorage } from '../useStorage/useStorage';\n\n/**\n * @name useSessionStorage\n * @description - Hook that manages session 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, setValue, removeValue] = useSessionStorage('key', 'value');\n */\nexport const useSessionStorage = <Value>(\n key: string,\n initialValue?: UseStorageInitialValue<Value>,\n options?: UseStorageOptions<Value>\n) => useStorage(key, { initialValue, storage: window.sessionStorage, ...options });\n"],"names":["useSessionStorage","key","initialValue","options","useStorage","_objectSpread","storage","window","sessionStorage"],"mappings":";iPAgBO,IAAMA,EAAoB,SAC/BC,EACAC,EACAC,GAAkC,OAC/BC,EAAWH,EAAGI,EAAA,CAAIH,aAAAA,EAAcI,QAASC,OAAOC,gBAAmBL,GAAU"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-CePHKKZk.js";import{useState as n}from"react";var r=function(r){var t=n(new Set(r)),u=e(t,2),i=u[0],f=u[1];return{value:i,size:i.size,has:function(e){return i.has(e)},add:function(e){return f((function(n){return new Set(n).add(e)}))},remove:function(e){return f((function(n){if(!n.has(e))return n;var r=new Set(n);return r.delete(e),r}))},clear:function(){return f(new Set)},reset:function(){return f(new Set(r))},toggle:function(e){return f((function(n){if(!n.has(e))return new Set(n).add(e);var r=new Set(n);return r.delete(e),r}))},union:function(e){return f(i.union(e))},difference:function(e){return f(i.difference(e))},symmetricDifference:function(e){return f(i.symmetricDifference(e))},intersection:function(e){return f(i.intersection(e))}}};export{r as useSet};
|
|
3
3
|
//# sourceMappingURL=useSet.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
2
|
+
import{d as r,e,b as a}from"../../_rollupPluginBabelHelpers-CePHKKZk.js";import{isClient as t}from"../../utils/helpers/isClient.js";var n=function(n){var s=!!t&&"share"in navigator,i=function(){var t=r(e().mark((function r(t){var i;return e().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(s){r.next=2;break}return r.abrupt("return");case 2:return(i=a(a({},n),t)).files&&navigator.canShare({files:i.files})&&navigator.share(i),r.abrupt("return",navigator.share(i));case 5:case"end":return r.stop()}}),r)})));return function(r){return t.apply(this,arguments)}}();return{share:i,supported:s}};export{n as useShare};
|
|
3
3
|
//# sourceMappingURL=useShare.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useShare.js","sources":["../../../../src/hooks/useShare/useShare.ts"],"sourcesContent":["import { isClient } from '@/utils/helpers';\n\n/** The use share options type */\nexport interface UseShareParams {\n /** The title of the share */\n title?: string;\n /** The files of the share */\n files?: File[];\n /** The text of the share */\n text?: string;\n /** The url of the share */\n url?: string;\n}\n\n/** The use share return type */\nexport interface UseShareReturn {\n /** The share function */\n share: (shareParams: ShareData) => Promise<void>;\n /** The share supported status */\n supported: boolean;\n}\n\n/**\n * @name useShare\n * @description - Hook that utilizes the share api\n * @category Browser\n *\n * @param {UseShareParams} [params] The use share options\n * @returns {UseShareReturn}\n *\n * @example\n * const { share, supported } = useShare();\n */\nexport const useShare = (params?: UseShareParams) => {\n const supported = isClient ? 'share' in navigator : false;\n\n const share = async (shareParams: ShareData) => {\n if (!supported) return;\n\n const data = {\n ...params,\n ...shareParams\n };\n\n if (data.files && navigator.canShare({ files: data.files })) navigator.share(data);\n\n return navigator.share(data);\n };\n\n return { share, supported };\n};\n"],"names":["useShare","params","supported","isClient","navigator","share","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","shareParams","data","wrap","_context","prev","next","abrupt","_objectSpread","files","canShare","stop","_x","apply","this","arguments"],"mappings":";
|
|
1
|
+
{"version":3,"file":"useShare.js","sources":["../../../../src/hooks/useShare/useShare.ts"],"sourcesContent":["import { isClient } from '@/utils/helpers';\n\n/** The use share options type */\nexport interface UseShareParams {\n /** The title of the share */\n title?: string;\n /** The files of the share */\n files?: File[];\n /** The text of the share */\n text?: string;\n /** The url of the share */\n url?: string;\n}\n\n/** The use share return type */\nexport interface UseShareReturn {\n /** The share function */\n share: (shareParams: ShareData) => Promise<void>;\n /** The share supported status */\n supported: boolean;\n}\n\n/**\n * @name useShare\n * @description - Hook that utilizes the share api\n * @category Browser\n *\n * @param {UseShareParams} [params] The use share options\n * @returns {UseShareReturn}\n *\n * @example\n * const { share, supported } = useShare();\n */\nexport const useShare = (params?: UseShareParams) => {\n const supported = isClient ? 'share' in navigator : false;\n\n const share = async (shareParams: ShareData) => {\n if (!supported) return;\n\n const data = {\n ...params,\n ...shareParams\n };\n\n if (data.files && navigator.canShare({ files: data.files })) navigator.share(data);\n\n return navigator.share(data);\n };\n\n return { share, supported };\n};\n"],"names":["useShare","params","supported","isClient","navigator","share","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","shareParams","data","wrap","_context","prev","next","abrupt","_objectSpread","files","canShare","stop","_x","apply","this","arguments"],"mappings":";wIAiCaA,EAAW,SAACC,GACvB,IAAMC,IAAYC,GAAW,UAAWC,UAElCC,EAAK,WAAA,IAAAC,EAAAC,EAAAC,IAAAC,MAAG,SAAAC,EAAOC,GAAsB,IAAAC,EAAA,OAAAJ,IAAAK,MAAA,SAAAC,GAAA,cAAAA,EAAAC,KAAAD,EAAAE,MAAA,KAAA,EAAA,GACpCd,EAAS,CAAAY,EAAAE,KAAA,EAAA,KAAA,CAAA,OAAAF,EAAAG,OAAA,UAAA,KAAA,EAOqE,OAL7EL,EAAIM,EAAAA,EACLjB,CAAAA,EAAAA,GACAU,IAGIQ,OAASf,UAAUgB,SAAS,CAAED,MAAOP,EAAKO,SAAUf,UAAUC,MAAMO,GAAME,EAAAG,OAAA,SAE5Eb,UAAUC,MAAMO,IAAK,KAAA,EAAA,IAAA,MAAA,OAAAE,EAAAO,OAAA,GAAAX,EAC7B,KAAA,OAXKL,SAAKiB,GAAA,OAAAhB,EAAAiB,MAAAC,KAAAC,UAAA,EAAA,GAaX,MAAO,CAAEpB,MAAAA,EAAOH,UAAAA,EAClB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
2
|
+
import{c as t,_ as r}from"../../_rollupPluginBabelHelpers-CePHKKZk.js";import{useRef as n,useState as e}from"react";var i=function(i){var u="object"===t(i)?i.max:i,o="object"===t(i)?i.initial:1,c=n(o>u||o<1?1:o),s=e(o),a=r(s,2),f=a[0],l=a[1],p=1===f,m=f===u;return{counts:u,currentStep:f,isFirst:p,isLast:m,next:function(){m||l((function(t){return t+1}))},back:function(){p||l((function(t){return t-1}))},reset:function(){return l(c.current)},set:function(t){return"first"===t?l(c.current):"last"===t||t>=u?l(u):t<=1?l(1):void l(t)}}};export{i as useStep};
|
|
3
3
|
//# sourceMappingURL=useStep.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
2
|
+
import{_ as n,b as t}from"../../_rollupPluginBabelHelpers-CePHKKZk.js";import{useState as o,useEffect as r}from"react";import"../../utils/helpers/isClient.js";import{useEvent as e}from"../useEvent/useEvent.js";import"../../index-D_PnqV6k.js";import"react-dom";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var u=function(n){return n?{days:Math.floor(n/86400),hours:Math.floor(n%86400/3600),minutes:Math.floor(n%3600/60),seconds:Math.floor(n%60),count:n}:{days:0,hours:0,minutes:0,seconds:0,count:0}},s=function(){for(var s,i,c=arguments.length,a=new Array(c),f=0;f<c;f++)a[f]=arguments[f];var l=null!==(s="number"==typeof a[0]?a[0]:null===(i=a[0])||void 0===i?void 0:i.initialTime)&&void 0!==s?s:0,m="number"==typeof a[0]?a[1]:a[0],d=o(u(l)),p=n(d,2),h=p[0],v=p[1],y=o(!(null!=m&&m.enabled)),b=n(y,2),j=b[0],g=b[1],E=e((function(){var n=h.count+1;return n%60==0?v(t(t({},h),{},{minutes:h.minutes+1,seconds:0,count:n})):n%3600==0?v(t(t({},h),{},{hours:h.hours+1,minutes:0,seconds:0,count:n})):n%86400==0?v(t(t({},h),{},{days:h.days+1,hours:0,minutes:0,seconds:0,count:n})):void v(t(t({},h),{},{seconds:h.seconds+1,count:n}))}));return r((function(){if(!j){var n=setInterval((function(){return E()}),1e3);return function(){return clearInterval(n)}}}),[j]),t(t({},h),{},{paused:j,pause:function(){return g(!0)},start:function(){return g(!1)},reset:function(){return v(u(l))},toggle:function(){return g((function(n){return!n}))}})};export{s as useStopwatch};
|
|
3
|
+
//# sourceMappingURL=useStopwatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStopwatch.js","sources":["../../../../src/hooks/useStopwatch/useStopwatch.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { useEvent } from '@/hooks';\n\nconst getStopwatchTime = (time: number) => {\n if (!time)\n return {\n days: 0,\n hours: 0,\n minutes: 0,\n seconds: 0,\n count: 0\n };\n\n const days = Math.floor(time / 86400);\n const hours = Math.floor((time % 86400) / 3600);\n const minutes = Math.floor((time % 3600) / 60);\n const seconds = Math.floor(time % 60);\n\n return { days, hours, minutes, seconds, count: time };\n};\n\n/** The use stopwatch return type */\nexport interface UseStopwatchReturn {\n /** The paused state of the stopwatch */\n paused: boolean;\n /** The over state of the stopwatch */\n over: boolean;\n /** The day count of the stopwatch */\n days: number;\n /** The hour count of the stopwatch */\n hours: number;\n /** The minute count of the stopwatch */\n minutes: number;\n /** The second count of the stopwatch */\n seconds: number;\n /** The total count of the stopwatch */\n count: number;\n /** The function to pause the stopwatch */\n pause: () => void;\n /** The function to start the stopwatch */\n start: () => void;\n /** The function to reset the stopwatch */\n reset: () => void;\n /** The function to toggle the stopwatch */\n toggle: () => void;\n}\n\n/** The use stopwatch options */\nexport interface UseStopwatchOptions {\n /** The enabled state of the timer */\n enabled?: boolean;\n}\n\ntype UseStopwatch = {\n (initialTime?: number, options?: UseStopwatchOptions): UseStopwatchReturn;\n (options?: UseStopwatchOptions & { initialTime?: number }): UseStopwatchReturn;\n};\n/**\n * @name useStopwatch\n * @description - Hook that creates a stopwatch functionality\n *\n * @overload\n * @param {number} [initialTime=0] The initial time of the timer\n * @param {boolean} [options.enabled=true] The enabled state of the timer\n * @returns {UseStopwatchReturn} An object containing the current time and functions to interact with the timer\n *\n * @example\n * const { seconds, minutes, start, pause, reset } = useStopwatch(1000, { enabled: false });\n *\n * @overload\n * @param {number} [options.initialTime=0] -The initial time of the timer\n * @param {boolean} [options.enabled=true] The enabled state of the timer\n * @returns {UseStopwatchReturn} An object containing the current time and functions to interact with the timer\n *\n * @example\n * const { seconds, minutes, start, pause, reset } = useStopwatch({ initialTime: 1000, enabled: false });\n */\nexport const useStopwatch = ((...params: any[]) => {\n const initialTime =\n (typeof params[0] === 'number'\n ? (params[0] as number | undefined)\n : (params[0] as UseStopwatchOptions & { initialTime?: number })?.initialTime) ?? 0;\n\n const options =\n typeof params[0] === 'number'\n ? (params[1] as UseStopwatchOptions | undefined)\n : (params[0] as (UseStopwatchOptions & { initialTime?: number }) | undefined);\n\n const [time, setTime] = useState(getStopwatchTime(initialTime));\n const [paused, setPaused] = useState(!options?.enabled);\n\n const onInterval = useEvent(() => {\n const updatedCount = time.count + 1;\n\n if (updatedCount % 60 === 0) {\n return setTime({\n ...time,\n minutes: time.minutes + 1,\n seconds: 0,\n count: updatedCount\n });\n }\n\n if (updatedCount % (60 * 60) === 0) {\n return setTime({\n ...time,\n hours: time.hours + 1,\n minutes: 0,\n seconds: 0,\n count: updatedCount\n });\n }\n\n if (updatedCount % (60 * 60 * 24) === 0) {\n return setTime({\n ...time,\n days: time.days + 1,\n hours: 0,\n minutes: 0,\n seconds: 0,\n count: updatedCount\n });\n }\n\n setTime({\n ...time,\n seconds: time.seconds + 1,\n count: updatedCount\n });\n });\n\n useEffect(() => {\n if (paused) return;\n const interval = setInterval(() => onInterval(), 1000);\n return () => clearInterval(interval);\n }, [paused]);\n\n return {\n ...time,\n paused,\n pause: () => setPaused(true),\n start: () => setPaused(false),\n reset: () => setTime(getStopwatchTime(initialTime)),\n toggle: () => setPaused((prevPause) => !prevPause)\n };\n}) as UseStopwatch;\n"],"names":["getStopwatchTime","time","days","Math","floor","hours","minutes","seconds","count","useStopwatch","_ref","_params$","_len","arguments","length","params","Array","_key","initialTime","options","_useState","useState","_useState2","_slicedToArray","setTime","_useState3","enabled","_useState4","paused","setPaused","onInterval","useEvent","updatedCount","_objectSpread","useEffect","interval","setInterval","clearInterval","pause","start","reset","toggle","prevPause"],"mappings":";sUAIA,IAAMA,EAAmB,SAACC,GACxB,OAAKA,EAcE,CAAEC,KALIC,KAAKC,MAAMH,EAAO,OAKhBI,MAJDF,KAAKC,MAAOH,EAAO,MAAS,MAIpBK,QAHNH,KAAKC,MAAOH,EAAO,KAAQ,IAGZM,QAFfJ,KAAKC,MAAMH,EAAO,IAEMO,MAAOP,GAbtC,CACLC,KAAM,EACNG,MAAO,EACPC,QAAS,EACTC,QAAS,EACTC,MAAO,EASb,EA0DaC,EAAgB,WAAsB,IAAA,IAAAC,EAAAC,EAAAC,EAAAC,UAAAC,OAAlBC,EAAMC,IAAAA,MAAAJ,GAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAANF,EAAME,GAAAJ,UAAAI,GACrC,IAAMC,EAG0ER,QAH/DA,EACO,iBAAdK,EAAO,GACVA,EAAO,WAAEJ,EACTI,EAAO,UAAE,IAAAJ,OAAA,EAAVA,EAA+DO,mBAAWR,IAAAA,EAAAA,EAAK,EAE/ES,EACiB,iBAAdJ,EAAO,GACTA,EAAO,GACPA,EAAO,GAEdK,EAAwBC,EAASrB,EAAiBkB,IAAaI,EAAAC,EAAAH,EAAA,GAAxDnB,EAAIqB,EAAA,GAAEE,EAAOF,EAAA,GACpBG,EAA4BJ,IAAUF,SAAAA,EAASO,UAAQC,EAAAJ,EAAAE,EAAA,GAAhDG,EAAMD,EAAA,GAAEE,EAASF,EAAA,GAElBG,EAAaC,GAAS,WAC1B,IAAMC,EAAe/B,EAAKO,MAAQ,EAElC,OAAIwB,EAAe,IAAO,EACjBR,EAAOS,EAAAA,KACThC,GAAI,GAAA,CACPK,QAASL,EAAKK,QAAU,EACxBC,QAAS,EACTC,MAAOwB,KAIPA,EAAgB,MAAa,EACxBR,EAAOS,EAAAA,KACThC,GAAI,GAAA,CACPI,MAAOJ,EAAKI,MAAQ,EACpBC,QAAS,EACTC,QAAS,EACTC,MAAOwB,KAIPA,EAAY,OAAsB,EAC7BR,EAAOS,EAAAA,KACThC,GAAI,GAAA,CACPC,KAAMD,EAAKC,KAAO,EAClBG,MAAO,EACPC,QAAS,EACTC,QAAS,EACTC,MAAOwB,UAIXR,EAAOS,EAAAA,KACFhC,GAAI,CAAA,EAAA,CACPM,QAASN,EAAKM,QAAU,EACxBC,MAAOwB,IAEX,IAQA,OANAE,GAAU,WACR,IAAIN,EAAJ,CACA,IAAMO,EAAWC,aAAY,WAAA,OAAMN,GAAY,GAAE,KACjD,OAAO,WAAA,OAAMO,cAAcF,EAAS,CAFxB,CAGd,GAAG,CAACP,IAEJK,EAAAA,EAAA,CAAA,EACKhC,GAAI,CAAA,EAAA,CACP2B,OAAAA,EACAU,MAAO,WAAA,OAAMT,GAAU,EAAK,EAC5BU,MAAO,WAAA,OAAMV,GAAU,EAAM,EAC7BW,MAAO,WAAA,OAAMhB,EAAQxB,EAAiBkB,GAAa,EACnDuB,OAAQ,WAAA,OAAMZ,GAAU,SAACa,GAAS,OAAMA,IAAU,GAEtD"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
2
|
+
import{c as e}from"../../_rollupPluginBabelHelpers-CePHKKZk.js";import{useSyncExternalStore as n}from"react";import{isClient as t}from"../../utils/helpers/isClient.js";import{useIsomorphicLayoutEffect as r}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var i=function(e){return window.dispatchEvent(new StorageEvent("storage",e))},o=function(e,n,t){var r=e.getItem(n);e.setItem(n,t),i({key:n,oldValue:r,newValue:t,storageArea:e})},u=function(e,n){var t=e.getItem(n);e.removeItem(n),i({key:n,oldValue:t,newValue:null,storageArea:e})},a=function(e,n){var t=e.getItem(n);if(t)return t},l=function(e){return window.addEventListener("storage",e),function(){return window.removeEventListener("storage",e)}},f=function(){},s=function(i,s){var c,d="object"===e(s)?s:void 0,v=d?null==d?void 0:d.initialValue:s,m=null!==(c=null==d?void 0:d.storage)&&void 0!==c?c:window.localStorage,g=function(e){return null!=d&&d.serializer?d.serializer(e):JSON.stringify(e)},p=n(l,(function(){return a(m,i)}),f),w=function(e){if(null===e)return u(m,i);o(m,i,g(e))};r((function(){(void 0===a(m,i)||v)&&o(m,i,g(v instanceof Function?v():v))}),[i]);var I=function(){return u(m,i)};return t?[p?function(e){if(null!=d&&d.deserializer)return d.deserializer(e);if("undefined"!==e)try{return JSON.parse(e)}catch(n){return e}}(p):void 0,w,I]:[v instanceof Function?v():v,w,I]};export{i as dispatchStorageEvent,s as useStorage};
|
|
3
3
|
//# sourceMappingURL=useStorage.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-CePHKKZk.js";import{useState as n,useEffect as t}from"react";import{isClient as r}from"../../utils/helpers/isClient.js";import{useRerender as o}from"../useRerender/useRerender.js";var u=function(e){var n,t=null!==(n=e.rangeCount)&&void 0!==n?n:0;return Array.from({length:t},(function(n,t){return e.getRangeAt(t)}))},i=function(){var i,l=o(),c=n(r?document.getSelection():null),a=e(c,2),s=a[0],m=a[1];t((function(){var e=function(){m(document.getSelection()),l.update()};return document.addEventListener("selectionchange",e),function(){return document.removeEventListener("selectionchange",e)}}),[]);var d=null!==(i=null==s?void 0:s.toString())&&void 0!==i?i:"",g=s?u(s):[],f=g.map((function(e){return e.getBoundingClientRect()}));return{text:d,ranges:g,rects:f,selection:s}};export{u as getRangesSelection,i as useTextSelection};
|
|
3
3
|
//# sourceMappingURL=useTextSelection.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-CePHKKZk.js";import{useState as r}from"react";import"../../utils/helpers/isClient.js";import{getDate as t}from"../../utils/helpers/time/getDate.js";import{useInterval as o}from"../useInterval/useInterval.js";import"../useEvent/useEvent.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var s=function(){var s=r(t()),i=e(s,2),u=i[0],m=i[1];return o((function(){return m(t())}),1e3),u};export{s as useTime};
|
|
3
3
|
//# sourceMappingURL=useTime.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.44 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-CePHKKZk.js";import{useState as e,useRef as t,useEffect as o}from"react";import{useEvent as u}from"../useEvent/useEvent.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";function i(i,n){var c=e(!1),s=r(c,2),m=s[0],f=s[1],l=t(),p=u(i);o((function(){return l.current=setTimeout((function(){p(),f(!0)}),n),function(){clearTimeout(l.current)}}),[n]);return{ready:m,clear:function(){clearTimeout(l.current),f(!0)}}}export{i as useTimeout};
|
|
3
3
|
//# sourceMappingURL=useTimeout.js.map
|