@siberiacancode/reactuse 0.0.21 → 0.0.23
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-BZYFJ5Fo.js → _rollupPluginBabelHelpers-OXydtwwP.js} +2 -2
- package/dist/cjs/_rollupPluginBabelHelpers-OXydtwwP.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/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/useDebouncedValue/useDebouncedValue.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/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/useFavicon/useFavicon.js +2 -2
- package/dist/cjs/hooks/useFullscreen/useFullscreen.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/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/useMediaQuery/useMediaQuery.js +1 -1
- 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 +1 -1
- package/dist/cjs/hooks/usePreferredColorScheme/usePreferredColorScheme.js +3 -0
- package/dist/cjs/hooks/usePreferredColorScheme/usePreferredColorScheme.js.map +1 -0
- 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/useQueue/useQueue.js +2 -2
- package/dist/cjs/hooks/useRenderCount/useRenderCount.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/useSet/useSet.js.map +1 -1
- package/dist/cjs/hooks/useStep/useStep.js +2 -2
- package/dist/cjs/hooks/useStorage/useStorage.js +2 -2
- package/dist/cjs/hooks/useTextSelection/useTextSelection.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/useWindowEvent/useWindowEvent.js +1 -1
- package/dist/cjs/hooks/useWindowSize/useWindowSize.js +2 -2
- 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/esm/{_rollupPluginBabelHelpers-CuOqjRnD.js → _rollupPluginBabelHelpers-Ca7xtMt2.js} +2 -2
- package/dist/esm/_rollupPluginBabelHelpers-Ca7xtMt2.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/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/useDebouncedValue/useDebouncedValue.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/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/useFavicon/useFavicon.js +2 -2
- package/dist/esm/hooks/useFullscreen/useFullscreen.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/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/useMediaQuery/useMediaQuery.js +1 -1
- 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 +1 -1
- package/dist/esm/hooks/usePreferredColorScheme/usePreferredColorScheme.js +3 -0
- package/dist/esm/hooks/usePreferredColorScheme/usePreferredColorScheme.js.map +1 -0
- 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/useQueue/useQueue.js +2 -2
- package/dist/esm/hooks/useRenderCount/useRenderCount.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/useSet/useSet.js +2 -2
- package/dist/esm/hooks/useSet/useSet.js.map +1 -1
- package/dist/esm/hooks/useStep/useStep.js +2 -2
- package/dist/esm/hooks/useStorage/useStorage.js +2 -2
- package/dist/esm/hooks/useTextSelection/useTextSelection.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/useWindowEvent/useWindowEvent.js +1 -1
- package/dist/esm/hooks/useWindowSize/useWindowSize.js +2 -2
- 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/index.d.ts +55 -4
- package/package.json +2 -1
- package/dist/cjs/_rollupPluginBabelHelpers-BZYFJ5Fo.js.map +0 -1
- package/dist/esm/_rollupPluginBabelHelpers-CuOqjRnD.js.map +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r,e as t,f as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.23 */
|
|
2
|
+
import{_ as r,e as t,f as e}from"../../_rollupPluginBabelHelpers-Ca7xtMt2.js";import n from"react";import{getRetry as u}from"../../utils/helpers/getRetry.js";import"../../utils/helpers/isClient.js";var l=function(l,s){var a=n.useRef(null!=s&&s.retry?u(s.retry):0),o=n.useState(!1),i=r(o,2),c=i[0],f=i[1],p=n.useState(!1),m=r(p,2),v=m[0],y=m[1],S=n.useState(!1),h=r(S,2),d=h[0],g=h[1],j=n.useState(null),b=r(j,2),w=b[0],x=b[1],E=n.useState(null),R=r(E,2),_=R[0],k=R[1],A=function r(t){return f(!0),l(t).then((function(r){var t;return null==s||null===(t=s.onSuccess)||void 0===t||t.call(s,r),k(r),g(!0),f(!1),x(null),y(!1),r})).catch((function(e){var n;if(a.current>0)return a.current-=1,r(t);null==s||null===(n=s.onError)||void 0===n||n.call(s,e),k(null),g(!1),f(!1),x(e),y(!0),a.current=null!=s&&s.retry?u(s.retry):0}))},B=function(){var r=t(e().mark((function r(t){return e().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",A(t));case 1:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}();return{data:_,error:w,mutate:function(r){A(r)},mutateAsync:B,isLoading:c,isError:v,isSuccess:d}};export{l as useMutation};
|
|
3
3
|
//# sourceMappingURL=useMutation.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.23 */
|
|
2
2
|
import r from"react";function e(e,n,t){var u=r.useRef(),c=r.useRef(null);return r.useEffect((function(){var r="function"==typeof t?t():t;return(r||c.current)&&(u.current=new MutationObserver(e),u.current.observe(r||c.current,n)),function(){var r;null===(r=u.current)||void 0===r||r.disconnect()}}),[e,n]),c}export{e 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.23 */
|
|
2
|
+
import{_ as n}from"../../_rollupPluginBabelHelpers-Ca7xtMt2.js";import e from"react";import{isClient as i}from"../../utils/helpers/isClient.js";var o=function(){var n,e,i;return(null===(n=navigator)||void 0===n?void 0:n.connection)||(null===(e=navigator)||void 0===e?void 0:e.mozConnection)||(null===(i=navigator)||void 0===i?void 0:i.webkitConnection)},t=function(){var t=e.useState((function(){if(!i)return{online:!1,type:void 0,effectiveType:void 0,saveData:!1,downlink:0,downlinkMax:0,rtt:0};var n=navigator.onLine,e=o();return{online:n,downlink:null==e?void 0:e.downlink,downlinkMax:null==e?void 0:e.downlinkMax,effectiveType:null==e?void 0:e.effectiveType,rtt:null==e?void 0:e.rtt,saveData:null==e?void 0:e.saveData,type:null==e?void 0:e.type}})),l=n(t,2),v=l[0],a=l[1];return e.useEffect((function(){var n=function(){var n=navigator.onLine,e=o();a({online:n,downlink:null==e?void 0:e.downlink,downlinkMax:null==e?void 0:e.downlinkMax,effectiveType:null==e?void 0:e.effectiveType,rtt:null==e?void 0:e.rtt,saveData:null==e?void 0:e.saveData,type:null==e?void 0:e.type})};window.addEventListener("online",n,{passive:!0}),window.addEventListener("offline",n,{passive:!0});var e=o();return e&&e.addEventListener("change",n,{passive:!0}),function(){window.removeEventListener("online",n),window.removeEventListener("offline",n),e&&e.removeEventListener("change",n)}})),v};export{o as getConnection,t as useNetwork};
|
|
3
3
|
//# sourceMappingURL=useNetwork.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.23 */
|
|
2
2
|
import n from"react";var e=function(){return navigator.onLine},t=function(){return!1},r=function(n){return window.addEventListener("online",n),window.addEventListener("offline",n),function(){window.removeEventListener("online",n),window.removeEventListener("offline",n)}},o=function(){return n.useSyncExternalStore(r,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.23 */
|
|
2
2
|
import 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"},e=function(){return n.useRef(i()).current};export{i as getOperatingSystem,e 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.23 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-Ca7xtMt2.js";import n from"react";import{useIsomorphicLayoutEffect as r}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var t=function(){var t=n.useState({angle:0,type:"landscape-primary"}),o=e(t,2),i=o[0],a=o[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{t as useOrientation};
|
|
3
3
|
//# sourceMappingURL=useOrientation.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.23 */
|
|
2
2
|
import"react";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";import{useEventListener as e}from"../useEventListener/useEventListener.js";import"screenfull";import"react-dom";import"../useEvent/useEvent.js";var t=function(t){return e(document,"mouseleave",t)};export{t as usePageLeave};
|
|
3
3
|
//# sourceMappingURL=usePageLeave.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.23 */
|
|
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
|
+
//# sourceMappingURL=usePreferredColorScheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePreferredColorScheme.js","sources":["../../../../src/hooks/usePreferredColorScheme/usePreferredColorScheme.ts"],"sourcesContent":["import { useMediaQuery } from '../useMediaQuery/useMediaQuery';\n\n/** The use preferred color scheme return type */\nexport type UsePreferredColorSchemeReturn = 'dark' | 'light' | 'no-preference';\n\n/**\n * @name usePreferredColorScheme\n * @description - Hook that returns user preferred color scheme\n *\n * @returns {UsePreferredColorSchemeReturn} String of preferred color scheme\n *\n * @example\n * const colorScheme = usePreferredColorScheme();\n */\nexport const usePreferredColorScheme = (): UsePreferredColorSchemeReturn => {\n const isLight = useMediaQuery('(prefers-color-scheme: light)');\n const isDark = useMediaQuery('(prefers-color-scheme: dark)');\n\n if (isLight) return 'light';\n if (isDark) return 'dark';\n return 'no-preference';\n};\n"],"names":["usePreferredColorScheme","isLight","useMediaQuery","isDark"],"mappings":";oFAcaA,EAA0B,WACrC,IAAMC,EAAUC,EAAc,iCACxBC,EAASD,EAAc,gCAE7B,OAAID,EAAgB,QAChBE,EAAe,OACZ,eACT"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.23 */
|
|
2
2
|
import n from"react";var e=function(){return window.navigator.languages},r=function(){return["en"]},t=function(n){return window.addEventListener("languagechange",n),function(){window.removeEventListener("languagechange",n)}},a=function(){return n.useSyncExternalStore(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.23 */
|
|
2
2
|
import r from"react";var e=function(e){var t=r.useRef();return r.useEffect((function(){t.current=e})),t.current};export{e as usePrevious};
|
|
3
3
|
//# sourceMappingURL=usePrevious.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.23 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-Ca7xtMt2.js";import t from"react";import{getRetry as l}from"../../utils/helpers/getRetry.js";import"../../utils/helpers/isClient.js";var r=function(r,n){var i,u=t.useRef(null!=n&&n.retry?l(n.retry):0),a=t.useState(!1),o=e(a,2),c=o[0],s=o[1],f=t.useState(!1),d=e(f,2),v=d[0],h=d[1],p=t.useState(!1),S=e(p,2),m=S[0],y=S[1],D=t.useState(!(null==n||!n.initialData)),g=e(D,2),j=g[0],E=g[1],R=t.useState(void 0),_=e(R,2),b=_[0],k=_[1],x=t.useState(null==n?void 0:n.initialData),B=e(x,2),C=B[0],F=B[1],H=function e(t){s(!0),"refetch"===t&&y(!0),r().then((function(e){var l,r=null!=n&&n.select?null==n?void 0:n.select(e):e;null==n||null===(l=n.onSuccess)||void 0===l||l.call(n,r),F(r),E(!0),s(!1),k(void 0),h(!1),"refetch"===t&&y(!1)})).catch((function(r){var i;if(u.current>0)return u.current-=1,e(t);null==n||null===(i=n.onError)||void 0===i||i.call(n,r),F(void 0),E(!1),s(!1),k(r),h(!0),"refetch"===t&&y(!1),u.current=null!=n&&n.retry?l(n.retry):0}))};t.useEffect((function(){null!=n&&n.initialData||H("init")}),null!==(i=null==n?void 0:n.keys)&&void 0!==i?i:[]);var L=(null==n?void 0:n.placeholderData)instanceof Function?null==n?void 0:n.placeholderData():null==n?void 0:n.placeholderData;return{data:null!=C?C:L,error:b,refetch:function(){return H("refetch")},isLoading:c,isError:v,isSuccess:j,isRefetching:m}};export{r as useQuery};
|
|
3
3
|
//# sourceMappingURL=useQuery.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r,c as t,d as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.23 */
|
|
2
|
+
import{_ as r,c as t,d as n}from"../../_rollupPluginBabelHelpers-Ca7xtMt2.js";import e from"react";import{flushSync as o}from"react-dom";var u=function(){var u=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],a=e.useState(u),i=r(a,2),c=i[0],f=i[1];return{add:function(r){return f((function(n){return[].concat(t(n),[r])}))},remove:function(){var r;return o((function(){f((function(t){var e=n(t),o=e[0],u=e.slice(1);return r=o,u}))})),r},clear:function(){return f([])},first:c[0],last:c[c.length-1],size:c.length,queue:c}};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.23 */
|
|
2
2
|
import r from"react";var e=function(){var e=r.useRef(0);return r.useEffect((function(){e.current+=1})),e.current};export{e as useRenderCount};
|
|
3
3
|
//# sourceMappingURL=useRenderCount.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.23 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-Ca7xtMt2.js";import t from"react";var e=function(){var e=t.useId(),o=t.useState(e),a=r(o,2),n=a[0],u=a[1];return{id:n,update:function(){return u(Math.random().toString())}}};export{e as useRerender};
|
|
3
3
|
//# sourceMappingURL=useRerender.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.23 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-Ca7xtMt2.js";import t from"react";var r="script-status",n=function(n){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.useState((function(){var e=document.querySelector('script[src="'.concat(n,'"]')),t=null==e?void 0:e.getAttribute(r);return t||(e?"unknown":"loading")})),u=e(i,2),c=u[0],a=u[1],s=o.removeOnUnmount,d=void 0===s||s,v=o.async,l=void 0===v||v;return t.useEffect((function(){var t=document.querySelector('script[src="'.concat(n,'"]')),i=null==t?void 0:t.getAttribute(r);if(i)return a(i);if(t)return a("unknown");var u=document.createElement("script");u.src=n,u.async=l;for(var c=0,s=Object.entries(o);c<s.length;c++){var v=e(s[c],2),m=v[0],f=v[1];u.setAttribute(m,String(f))}u.setAttribute(r,"loading"),document.body.appendChild(u);var p=function(){u.setAttribute(r,"ready"),a("ready")},b=function(){u.setAttribute(r,"error"),a("error")};return u.addEventListener("load",p),u.addEventListener("error",b),function(){d&&(u.remove(),u.removeEventListener("load",p),u.removeEventListener("error",b))}}),[n,d]),c};export{r as SCRIPT_STATUS_ATTRIBUTE_NAME,n as useScript};
|
|
3
3
|
//# sourceMappingURL=useScript.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.23 */
|
|
2
|
+
import{b as o}from"../../_rollupPluginBabelHelpers-Ca7xtMt2.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,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.23 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-Ca7xtMt2.js";import n from"react";var r=function(r){var t=n.useState(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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSet.js","sources":["../../../../src/hooks/useSet/useSet.ts"],"sourcesContent":["import React from 'react';\n\
|
|
1
|
+
{"version":3,"file":"useSet.js","sources":["../../../../src/hooks/useSet/useSet.ts"],"sourcesContent":["import React from 'react';\n\ndeclare global {\n interface Set<T> {\n union(other: Set<T>): Set<T>;\n difference(other: Set<T>): Set<T>;\n symmetricDifference(other: Set<T>): Set<T>;\n intersection(other: Set<T>): Set<T>;\n isDisjointFrom(other: Set<T>): boolean;\n isSubsetOf(other: Set<T>): boolean;\n isSupersetOf(other: Set<T>): boolean;\n }\n}\n\n/** The use set return type */\ninterface UseSetReturn<Value> {\n /** The current set */\n value: Set<Value>;\n /** The size of the set */\n size: number;\n /** Function to check if a value exists in the set */\n has: (value: Value) => boolean;\n /** Function to add a value to the set */\n add: (value: Value) => void;\n /** Function to remove a value from the set */\n remove: (value: Value) => void;\n /** Function to clear the set */\n clear: () => void;\n /** Function to toggle a value in the set */\n reset: () => void;\n /** Function to toggle a value in the set */\n toggle: (value: Value) => void;\n /** Function to get the union of two sets */\n union: (other: Set<Value>) => void;\n /** Function to get the difference of two sets */\n intersection: (other: Set<Value>) => void;\n /** Function to get the symmetric difference of two sets */\n difference: (other: Set<Value>) => void;\n /** Function to get the symmetric difference of two sets */\n symmetricDifference: (other: Set<Value>) => void;\n}\n\n/**\n * @name useSet\n * @description - Hook that manages a set structure\n *\n * @template Value The type of the value\n * @param {Value[]} [values] The initial array of the set\n * @returns {UseSetReturn} An object containing the current set and functions to interact with the set\n *\n * @example\n * const { value, add, remove, clear, reset, toggle, union, intersection, difference, symmetricDifference, size, has } = useSet([1, 2, 3]);\n */\nexport const useSet = <Value>(values?: Value[]): UseSetReturn<Value> => {\n const [set, setSet] = React.useState(new Set(values));\n\n const add = (value: Value) => setSet((prevSet) => new Set(prevSet).add(value));\n const remove = (value: Value) =>\n setSet((prevSet) => {\n if (!prevSet.has(value)) return prevSet;\n const newSet = new Set(prevSet);\n newSet.delete(value);\n return newSet;\n });\n const clear = () => setSet(new Set());\n const reset = () => setSet(new Set(values));\n const toggle = (value: Value) =>\n setSet((prevSet) => {\n if (!prevSet.has(value)) return new Set(prevSet).add(value);\n const newSet = new Set(prevSet);\n newSet.delete(value);\n return newSet;\n });\n const union = (other: Set<Value>) => setSet(set.union(other));\n const difference = (other: Set<Value>) => setSet(set.difference(other));\n const symmetricDifference = (other: Set<Value>) => setSet(set.symmetricDifference(other));\n const intersection = (other: Set<Value>) => setSet(set.intersection(other));\n const has = (value: Value) => set.has(value);\n\n return {\n value: set,\n size: set.size,\n has,\n add,\n remove,\n clear,\n reset,\n toggle,\n union,\n difference,\n symmetricDifference,\n intersection\n };\n};\n"],"names":["useSet","values","_React$useState","React","useState","Set","_React$useState2","_slicedToArray","set","setSet","value","size","has","add","prevSet","remove","newSet","clear","reset","toggle","union","other","difference","symmetricDifference","intersection"],"mappings":";yFAqDaA,EAAS,SAAQC,GAC5B,IAAAC,EAAsBC,EAAMC,SAAS,IAAIC,IAAIJ,IAAQK,EAAAC,EAAAL,EAAA,GAA9CM,EAAGF,EAAA,GAAEG,EAAMH,EAAA,GAyBlB,MAAO,CACLI,MAAOF,EACPG,KAAMH,EAAIG,KACVC,IALU,SAACF,GAAY,OAAKF,EAAII,IAAIF,EAAM,EAM1CG,IA3BU,SAACH,GAAY,OAAKD,GAAO,SAACK,GAAO,OAAK,IAAIT,IAAIS,GAASD,IAAIH,KAAO,EA4B5EK,OA3Ba,SAACL,GAAY,OAC1BD,GAAO,SAACK,GACN,IAAKA,EAAQF,IAAIF,GAAQ,OAAOI,EAChC,IAAME,EAAS,IAAIX,IAAIS,GAEvB,OADAE,EAAM,OAAQN,GACPM,CACT,GAAE,EAsBFC,MArBY,WAAH,OAASR,EAAO,IAAIJ,IAAM,EAsBnCa,MArBY,WAAH,OAAST,EAAO,IAAIJ,IAAIJ,GAAQ,EAsBzCkB,OArBa,SAACT,GAAY,OAC1BD,GAAO,SAACK,GACN,IAAKA,EAAQF,IAAIF,GAAQ,OAAO,IAAIL,IAAIS,GAASD,IAAIH,GACrD,IAAMM,EAAS,IAAIX,IAAIS,GAEvB,OADAE,EAAM,OAAQN,GACPM,CACT,GAAE,EAgBFI,MAfY,SAACC,GAAiB,OAAKZ,EAAOD,EAAIY,MAAMC,GAAO,EAgB3DC,WAfiB,SAACD,GAAiB,OAAKZ,EAAOD,EAAIc,WAAWD,GAAO,EAgBrEE,oBAf0B,SAACF,GAAiB,OAAKZ,EAAOD,EAAIe,oBAAoBF,GAAO,EAgBvFG,aAfmB,SAACH,GAAiB,OAAKZ,EAAOD,EAAIgB,aAAaH,GAAO,EAiB7E"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{a as t,_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.23 */
|
|
2
|
+
import{a as t,_ as r}from"../../_rollupPluginBabelHelpers-Ca7xtMt2.js";import n from"react";var e=function(e){var u="object"===t(e)?e.max:e,i="object"===t(e)?e.initial:1,o=n.useRef(i>u||i<1?1:i),c=n.useState(i),s=r(c,2),a=s[0],f=s[1],l=1===a,p=a===u;return{counts:u,currentStep:a,isFirst:l,isLast:p,next:function(){p||f((function(t){return t+1}))},back:function(){l||f((function(t){return t-1}))},reset:function(){return f(o.current)},set:function(t){return"first"===t?f(o.current):"last"===t||t>=u?f(u):t<=1?f(1):void f(t)}}};export{e as useStep};
|
|
3
3
|
//# sourceMappingURL=useStep.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{a as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.23 */
|
|
2
|
+
import{a as e}from"../../_rollupPluginBabelHelpers-Ca7xtMt2.js";import 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)}},s=function(){},f=function(i,f){var c,d="object"===e(f)?f:void 0,v=d?null==d?void 0:d.initialValue:f,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.useSyncExternalStore(l,(function(){return a(m,i)}),s),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 y=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,y]:[v instanceof Function?v():v,w,y]};export{i as dispatchStorageEvent,f 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.23 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-Ca7xtMt2.js";import n from"react";import{isClient as t}from"../../utils/helpers/isClient.js";import{useRerender as r}from"../useRerender/useRerender.js";var o=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)}))},u=function(){var u,i=r(),l=n.useState(t?document.getSelection():null),c=e(l,2),s=c[0],a=c[1];n.useEffect((function(){var e=function(){a(document.getSelection()),i.update()};return document.addEventListener("selectionchange",e),function(){return document.removeEventListener("selectionchange",e)}}),[]);var m=null!==(u=null==s?void 0:s.toString())&&void 0!==u?u:"",f=s?o(s):[],d=f.map((function(e){return e.getBoundingClientRect()}));return{text:m,ranges:f,rects:d,selection:s}};export{o as getRangesSelection,u 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.23 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-Ca7xtMt2.js";import t from"react";import{useEvent as r}from"../useEvent/useEvent.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";function u(u,o){var i=t.useState(!1),n=e(i,2),s=n[0],c=n[1],f=t.useRef(),m=r(u);t.useEffect((function(){return f.current=setTimeout((function(){m(),c(!0)}),o),function(){clearTimeout(f.current)}}),[o]);return{ready:s,clear:function(){clearTimeout(f.current),c(!0)}}}export{u as useTimeout};
|
|
3
3
|
//# sourceMappingURL=useTimeout.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.23 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-Ca7xtMt2.js";import e from"react";var n=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[!1,!0],t=e.useReducer((function(r,e){var n=e instanceof Function?e(r[0]):e,t=Math.abs(r.indexOf(n));return r.slice(t).concat(r.slice(0,t))}),n),o=r(t,2);return[r(o[0],1)[0],o[1]]};export{n as useToggle};
|
|
3
3
|
//# sourceMappingURL=useToggle.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.23 */
|
|
2
2
|
import r from"react";var t=function(t){var e=r.useRef(t);e.current=t,r.useEffect((function(){return function(){e.current()}}),[])};export{t as useUnmount};
|
|
3
3
|
//# sourceMappingURL=useUnmount.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.23 */
|
|
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(t,s,r){return e(window,t,s,r)};export{t as useWindowEvent};
|
|
3
3
|
//# sourceMappingURL=useWindowEvent.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as i}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.23 */
|
|
2
|
+
import{_ as i}from"../../_rollupPluginBabelHelpers-Ca7xtMt2.js";import e from"react";import{isClient as n}from"../../utils/helpers/isClient.js";var t=function(t){var r,o,d=e.useState({width:n?window.innerWidth:null!==(r=null==t?void 0:t.initialWidth)&&void 0!==r?r:Number.POSITIVE_INFINITY,height:n?window.innerHeight:null!==(o=null==t?void 0:t.initialWidth)&&void 0!==o?o:Number.POSITIVE_INFINITY}),l=i(d,2),u=l[0],w=l[1];return e.useEffect((function(){var i=function(){w({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",i),function(){window.removeEventListener("resize",i)}}),[]),u};export{t as useWindowSize};
|
|
3
3
|
//# sourceMappingURL=useWindowSize.js.map
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
export{useBattery}from"./hooks/useBattery/useBattery.js";export{useBoolean}from"./hooks/useBoolean/useBoolean.js";export{useClickOutside}from"./hooks/useClickOutside/useClickOutside.js";export{legacyCopyToClipboard,useCopyToClipboard}from"./hooks/useCopyToClipboard/useCopyToClipboard.js";export{useCounter}from"./hooks/useCounter/useCounter.js";export{useDebouncedValue}from"./hooks/useDebouncedValue/useDebouncedValue.js";export{useDefault}from"./hooks/useDefault/useDefault.js";export{useDidUpdate}from"./hooks/useDidUpdate/useDidUpdate.js";export{useDocumentTitle}from"./hooks/useDocumentTitle/useDocumentTitle.js";export{useDocumentVisibility}from"./hooks/useDocumentVisibility/useDocumentVisibility.js";export{useEvent}from"./hooks/useEvent/useEvent.js";export{useEventListener}from"./hooks/useEventListener/useEventListener.js";export{useFavicon}from"./hooks/useFavicon/useFavicon.js";export{useFullscreen}from"./hooks/useFullscreen/useFullscreen.js";export{useHash}from"./hooks/useHash/useHash.js";export{isHotkeyMatch,useHotkeys}from"./hooks/useHotkeys/useHotkeys.js";export{useHover}from"./hooks/useHover/useHover.js";export{useIdle}from"./hooks/useIdle/useIdle.js";export{useIntersectionObserver}from"./hooks/useIntersectionObserver/useIntersectionObserver.js";export{useInterval}from"./hooks/useInterval/useInterval.js";export{useIsFirstRender}from"./hooks/useIsFirstRender/useIsFirstRender.js";export{useIsomorphicLayoutEffect}from"./hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";export{useKeyboard}from"./hooks/useKeyboard/useKeyboard.js";export{useKeyPress}from"./hooks/useKeyPress/useKeyPress.js";export{useKeyPressEvent}from"./hooks/useKeyPressEvent/useKeyPressEvent.js";export{useKeysPressed}from"./hooks/useKeysPressed/useKeysPressed.js";export{useList}from"./hooks/useList/useList.js";export{useLocalStorage}from"./hooks/useLocalStorage/useLocalStorage.js";export{useLogger}from"./hooks/useLogger/useLogger.js";export{useLongPress}from"./hooks/useLongPress/useLongPress.js";export{useMediaQuery}from"./hooks/useMediaQuery/useMediaQuery.js";export{useMount}from"./hooks/useMount/useMount.js";export{useMouse}from"./hooks/useMouse/useMouse.js";export{useMutation}from"./hooks/useMutation/useMutation.js";export{getConnection,useNetwork}from"./hooks/useNetwork/useNetwork.js";export{useOnline}from"./hooks/useOnline/useOnline.js";export{getOperatingSystem,useOperatingSystem}from"./hooks/useOperatingSystem/useOperatingSystem.js";export{useOrientation}from"./hooks/useOrientation/useOrientation.js";export{usePageLeave}from"./hooks/usePageLeave/usePageLeave.js";export{usePreferredLanguages}from"./hooks/usePreferredLanguages/usePreferredLanguages.js";export{usePrevious}from"./hooks/usePrevious/usePrevious.js";export{useQuery}from"./hooks/useQuery/useQuery.js";export{useQueue}from"./hooks/useQueue/useQueue.js";export{useRenderCount}from"./hooks/useRenderCount/useRenderCount.js";export{useRerender}from"./hooks/useRerender/useRerender.js";export{SCRIPT_STATUS_ATTRIBUTE_NAME,useScript}from"./hooks/useScript/useScript.js";export{useSessionStorage}from"./hooks/useSessionStorage/useSessionStorage.js";export{useSet}from"./hooks/useSet/useSet.js";export{useStep}from"./hooks/useStep/useStep.js";export{dispatchStorageEvent,useStorage}from"./hooks/useStorage/useStorage.js";export{getRangesSelection,useTextSelection}from"./hooks/useTextSelection/useTextSelection.js";export{useTimeout}from"./hooks/useTimeout/useTimeout.js";export{useToggle}from"./hooks/useToggle/useToggle.js";export{useUnmount}from"./hooks/useUnmount/useUnmount.js";export{useWindowEvent}from"./hooks/useWindowEvent/useWindowEvent.js";export{useWindowSize}from"./hooks/useWindowSize/useWindowSize.js";export{debounce}from"./utils/helpers/debounce.js";export{getRetry}from"./utils/helpers/getRetry.js";export{isClient}from"./utils/helpers/isClient.js";export{throttle}from"./utils/helpers/throttle.js";import"./_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.23 */
|
|
2
|
+
export{useBattery}from"./hooks/useBattery/useBattery.js";export{useBoolean}from"./hooks/useBoolean/useBoolean.js";export{useClickOutside}from"./hooks/useClickOutside/useClickOutside.js";export{legacyCopyToClipboard,useCopyToClipboard}from"./hooks/useCopyToClipboard/useCopyToClipboard.js";export{useCounter}from"./hooks/useCounter/useCounter.js";export{useDebouncedValue}from"./hooks/useDebouncedValue/useDebouncedValue.js";export{useDefault}from"./hooks/useDefault/useDefault.js";export{useDidUpdate}from"./hooks/useDidUpdate/useDidUpdate.js";export{useDocumentTitle}from"./hooks/useDocumentTitle/useDocumentTitle.js";export{useDocumentVisibility}from"./hooks/useDocumentVisibility/useDocumentVisibility.js";export{useEvent}from"./hooks/useEvent/useEvent.js";export{useEventListener}from"./hooks/useEventListener/useEventListener.js";export{useFavicon}from"./hooks/useFavicon/useFavicon.js";export{useFullscreen}from"./hooks/useFullscreen/useFullscreen.js";export{useHash}from"./hooks/useHash/useHash.js";export{isHotkeyMatch,useHotkeys}from"./hooks/useHotkeys/useHotkeys.js";export{useHover}from"./hooks/useHover/useHover.js";export{useIdle}from"./hooks/useIdle/useIdle.js";export{useIntersectionObserver}from"./hooks/useIntersectionObserver/useIntersectionObserver.js";export{useInterval}from"./hooks/useInterval/useInterval.js";export{useIsFirstRender}from"./hooks/useIsFirstRender/useIsFirstRender.js";export{useIsomorphicLayoutEffect}from"./hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";export{useKeyboard}from"./hooks/useKeyboard/useKeyboard.js";export{useKeyPress}from"./hooks/useKeyPress/useKeyPress.js";export{useKeyPressEvent}from"./hooks/useKeyPressEvent/useKeyPressEvent.js";export{useKeysPressed}from"./hooks/useKeysPressed/useKeysPressed.js";export{useList}from"./hooks/useList/useList.js";export{useLocalStorage}from"./hooks/useLocalStorage/useLocalStorage.js";export{useLogger}from"./hooks/useLogger/useLogger.js";export{useLongPress}from"./hooks/useLongPress/useLongPress.js";export{useMediaQuery}from"./hooks/useMediaQuery/useMediaQuery.js";export{useMount}from"./hooks/useMount/useMount.js";export{useMouse}from"./hooks/useMouse/useMouse.js";export{useMutation}from"./hooks/useMutation/useMutation.js";export{getConnection,useNetwork}from"./hooks/useNetwork/useNetwork.js";export{useOnline}from"./hooks/useOnline/useOnline.js";export{getOperatingSystem,useOperatingSystem}from"./hooks/useOperatingSystem/useOperatingSystem.js";export{useOrientation}from"./hooks/useOrientation/useOrientation.js";export{usePageLeave}from"./hooks/usePageLeave/usePageLeave.js";export{usePreferredColorScheme}from"./hooks/usePreferredColorScheme/usePreferredColorScheme.js";export{usePreferredLanguages}from"./hooks/usePreferredLanguages/usePreferredLanguages.js";export{usePrevious}from"./hooks/usePrevious/usePrevious.js";export{useQuery}from"./hooks/useQuery/useQuery.js";export{useQueue}from"./hooks/useQueue/useQueue.js";export{useRenderCount}from"./hooks/useRenderCount/useRenderCount.js";export{useRerender}from"./hooks/useRerender/useRerender.js";export{SCRIPT_STATUS_ATTRIBUTE_NAME,useScript}from"./hooks/useScript/useScript.js";export{useSessionStorage}from"./hooks/useSessionStorage/useSessionStorage.js";export{useSet}from"./hooks/useSet/useSet.js";export{useStep}from"./hooks/useStep/useStep.js";export{dispatchStorageEvent,useStorage}from"./hooks/useStorage/useStorage.js";export{getRangesSelection,useTextSelection}from"./hooks/useTextSelection/useTextSelection.js";export{useTimeout}from"./hooks/useTimeout/useTimeout.js";export{useToggle}from"./hooks/useToggle/useToggle.js";export{useUnmount}from"./hooks/useUnmount/useUnmount.js";export{useWindowEvent}from"./hooks/useWindowEvent/useWindowEvent.js";export{useWindowSize}from"./hooks/useWindowSize/useWindowSize.js";export{debounce}from"./utils/helpers/debounce.js";export{getRetry}from"./utils/helpers/getRetry.js";export{isClient}from"./utils/helpers/isClient.js";export{throttle}from"./utils/helpers/throttle.js";import"./_rollupPluginBabelHelpers-Ca7xtMt2.js";import"react";import"./hooks/useMutationObserver.js";import"screenfull";import"react-dom";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.23 */
|
|
2
2
|
var r=function(r,n){var t;return function(){for(var e=arguments.length,o=new Array(e),u=0;u<e;u++)o[u]=arguments[u];clearTimeout(t),t=setTimeout((function(){return r.apply(void 0,o)}),n)}};export{r as debounce};
|
|
3
3
|
//# sourceMappingURL=debounce.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.23 */
|
|
2
2
|
export{debounce}from"./debounce.js";export{getRetry}from"./getRetry.js";export{isClient}from"./isClient.js";export{throttle}from"./throttle.js";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.23 */
|
|
2
2
|
var n,d,e=!("undefined"==typeof window||null===(n=window)||void 0===n||!n.document||null===(d=window)||void 0===d||null===(d=d.document)||void 0===d||!d.createElement);export{e as isClient};
|
|
3
3
|
//# sourceMappingURL=isClient.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.23 */
|
|
2
2
|
var n=function(n,t){var o=!1;return function(){o||(n.apply(void 0,arguments),o=!0,setTimeout((function(){o=!1}),t))}};export{n as throttle};
|
|
3
3
|
//# sourceMappingURL=throttle.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -912,6 +912,19 @@ declare const useOrientation: () => UseOrientationReturn;
|
|
|
912
912
|
*/
|
|
913
913
|
declare const usePageLeave: (callback: () => void) => void;
|
|
914
914
|
|
|
915
|
+
/** The use preferred color scheme return type */
|
|
916
|
+
type UsePreferredColorSchemeReturn = 'dark' | 'light' | 'no-preference';
|
|
917
|
+
/**
|
|
918
|
+
* @name usePreferredColorScheme
|
|
919
|
+
* @description - Hook that returns user preferred color scheme
|
|
920
|
+
*
|
|
921
|
+
* @returns {UsePreferredColorSchemeReturn} String of preferred color scheme
|
|
922
|
+
*
|
|
923
|
+
* @example
|
|
924
|
+
* const colorScheme = usePreferredColorScheme();
|
|
925
|
+
*/
|
|
926
|
+
declare const usePreferredColorScheme: () => UsePreferredColorSchemeReturn;
|
|
927
|
+
|
|
915
928
|
/**
|
|
916
929
|
* @name usePreferredLanguages
|
|
917
930
|
* @description Hook that returns a browser preferred languages from navigator
|
|
@@ -1070,18 +1083,56 @@ declare const useScript: (src: string, options?: UseScriptOptions) => UseScriptS
|
|
|
1070
1083
|
*/
|
|
1071
1084
|
declare const useSessionStorage: <Value>(key: string, initialValue?: UseStorageInitialValue<Value>, options?: UseStorageOptions<Value>) => readonly [Value | undefined, (value: Value) => void, () => void];
|
|
1072
1085
|
|
|
1086
|
+
declare global {
|
|
1087
|
+
interface Set<T> {
|
|
1088
|
+
union(other: Set<T>): Set<T>;
|
|
1089
|
+
difference(other: Set<T>): Set<T>;
|
|
1090
|
+
symmetricDifference(other: Set<T>): Set<T>;
|
|
1091
|
+
intersection(other: Set<T>): Set<T>;
|
|
1092
|
+
isDisjointFrom(other: Set<T>): boolean;
|
|
1093
|
+
isSubsetOf(other: Set<T>): boolean;
|
|
1094
|
+
isSupersetOf(other: Set<T>): boolean;
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
/** The use set return type */
|
|
1098
|
+
interface UseSetReturn<Value> {
|
|
1099
|
+
/** The current set */
|
|
1100
|
+
value: Set<Value>;
|
|
1101
|
+
/** The size of the set */
|
|
1102
|
+
size: number;
|
|
1103
|
+
/** Function to check if a value exists in the set */
|
|
1104
|
+
has: (value: Value) => boolean;
|
|
1105
|
+
/** Function to add a value to the set */
|
|
1106
|
+
add: (value: Value) => void;
|
|
1107
|
+
/** Function to remove a value from the set */
|
|
1108
|
+
remove: (value: Value) => void;
|
|
1109
|
+
/** Function to clear the set */
|
|
1110
|
+
clear: () => void;
|
|
1111
|
+
/** Function to toggle a value in the set */
|
|
1112
|
+
reset: () => void;
|
|
1113
|
+
/** Function to toggle a value in the set */
|
|
1114
|
+
toggle: (value: Value) => void;
|
|
1115
|
+
/** Function to get the union of two sets */
|
|
1116
|
+
union: (other: Set<Value>) => void;
|
|
1117
|
+
/** Function to get the difference of two sets */
|
|
1118
|
+
intersection: (other: Set<Value>) => void;
|
|
1119
|
+
/** Function to get the symmetric difference of two sets */
|
|
1120
|
+
difference: (other: Set<Value>) => void;
|
|
1121
|
+
/** Function to get the symmetric difference of two sets */
|
|
1122
|
+
symmetricDifference: (other: Set<Value>) => void;
|
|
1123
|
+
}
|
|
1073
1124
|
/**
|
|
1074
1125
|
* @name useSet
|
|
1075
1126
|
* @description - Hook that manages a set structure
|
|
1076
1127
|
*
|
|
1077
1128
|
* @template Value The type of the value
|
|
1078
1129
|
* @param {Value[]} [values] The initial array of the set
|
|
1079
|
-
* @returns {
|
|
1130
|
+
* @returns {UseSetReturn} An object containing the current set and functions to interact with the set
|
|
1080
1131
|
*
|
|
1081
1132
|
* @example
|
|
1082
|
-
* const
|
|
1133
|
+
* const { value, add, remove, clear, reset, toggle, union, intersection, difference, symmetricDifference, size, has } = useSet([1, 2, 3]);
|
|
1083
1134
|
*/
|
|
1084
|
-
declare const useSet: <Value>(values?: Value[]) =>
|
|
1135
|
+
declare const useSet: <Value>(values?: Value[]) => UseSetReturn<Value>;
|
|
1085
1136
|
|
|
1086
1137
|
/** The use step params */
|
|
1087
1138
|
interface UseStepParams {
|
|
@@ -1255,4 +1306,4 @@ declare const isClient: boolean;
|
|
|
1255
1306
|
|
|
1256
1307
|
declare const throttle: <Params extends any[]>(callback: (...args: Params) => void, delay: number) => ((...args: Params) => void);
|
|
1257
1308
|
|
|
1258
|
-
export { type ConnectionEffectiveType, type ConnectionType, type OperatingSystem, SCRIPT_STATUS_ATTRIBUTE_NAME, type UseClickOutside, type UseClickOutsideReturn, type UseCounter, type UseCounterOptions, type UseCounterParams, type UseCounterReturn, type UseDocumentTitleOptions, type UseDocumentTitleReturn, type UseEventListener, type UseEventListenerOptions, type UseEventListenerReturn, type UseEventListenerTarget, type UseFaviconReturn, type UseFullScreen, type UseFullScreenOptions, type UseFullScreenReturn, type UseHotkeysHotkeys, type UseHotkeysKey, type UseHotkeysOptions, type UseHover, type UseHoverOptions, type UseHoverReturn, type UseHoverTarget, type UseIdleReturn, type UseIntersectionObserver, type UseIntersectionObserverOptions, type UseIntersectionObserverReturn, type UseIntersectionObserverTarget, type UseIntervalOptions, type UseIntervalReturn, type UseKeyPressEvent, type UseKeyPressEventKey, type UseKeyPressKey, type UseKeyPressOptions, type UseKeyboardParams, type UseListReturn, type UseLongPress, type UseLongPressReturn, type UseLongPressTarget, type UseMouse, type UseMouseReturn, type UseNetworkReturn, type UseOrientationReturn, type UseQueueReturn, type UseScriptOptions, type UseScriptStatus, type UseStorageInitialValue, type UseStorageOptions, type UseStorageReturn, type UseTextSelectionReturn, type UseToggleReturn, type UseWindowSizeReturn, debounce, dispatchStorageEvent, getConnection, getOperatingSystem, getRangesSelection, getRetry, isClient, isHotkeyMatch, legacyCopyToClipboard, throttle, useBattery, useBoolean, useClickOutside, useCopyToClipboard, useCounter, useDebouncedValue, useDefault, useDidUpdate, useDocumentTitle, useDocumentVisibility, useEvent, useEventListener, useFavicon, useFullscreen, useHash, useHotkeys, useHover, useIdle, useIntersectionObserver, useInterval, useIsFirstRender, useIsomorphicLayoutEffect, useKeyPress, useKeyPressEvent, useKeyboard, useKeysPressed, useList, useLocalStorage, useLogger, useLongPress, useMediaQuery, useMount, useMouse, useMutation, useNetwork, useOnline, useOperatingSystem, useOrientation, usePageLeave, usePreferredLanguages, usePrevious, useQuery, useQueue, useRenderCount, useRerender, useScript, useSessionStorage, useSet, useStep, useStorage, useTextSelection, useTimeout, useToggle, useUnmount, useWindowEvent, useWindowSize };
|
|
1309
|
+
export { type ConnectionEffectiveType, type ConnectionType, type OperatingSystem, SCRIPT_STATUS_ATTRIBUTE_NAME, type UseClickOutside, type UseClickOutsideReturn, type UseCounter, type UseCounterOptions, type UseCounterParams, type UseCounterReturn, type UseDocumentTitleOptions, type UseDocumentTitleReturn, type UseEventListener, type UseEventListenerOptions, type UseEventListenerReturn, type UseEventListenerTarget, type UseFaviconReturn, type UseFullScreen, type UseFullScreenOptions, type UseFullScreenReturn, type UseHotkeysHotkeys, type UseHotkeysKey, type UseHotkeysOptions, type UseHover, type UseHoverOptions, type UseHoverReturn, type UseHoverTarget, type UseIdleReturn, type UseIntersectionObserver, type UseIntersectionObserverOptions, type UseIntersectionObserverReturn, type UseIntersectionObserverTarget, type UseIntervalOptions, type UseIntervalReturn, type UseKeyPressEvent, type UseKeyPressEventKey, type UseKeyPressKey, type UseKeyPressOptions, type UseKeyboardParams, type UseListReturn, type UseLongPress, type UseLongPressReturn, type UseLongPressTarget, type UseMouse, type UseMouseReturn, type UseNetworkReturn, type UseOrientationReturn, type UsePreferredColorSchemeReturn, type UseQueueReturn, type UseScriptOptions, type UseScriptStatus, type UseStorageInitialValue, type UseStorageOptions, type UseStorageReturn, type UseTextSelectionReturn, type UseToggleReturn, type UseWindowSizeReturn, debounce, dispatchStorageEvent, getConnection, getOperatingSystem, getRangesSelection, getRetry, isClient, isHotkeyMatch, legacyCopyToClipboard, throttle, useBattery, useBoolean, useClickOutside, useCopyToClipboard, useCounter, useDebouncedValue, useDefault, useDidUpdate, useDocumentTitle, useDocumentVisibility, useEvent, useEventListener, useFavicon, useFullscreen, useHash, useHotkeys, useHover, useIdle, useIntersectionObserver, useInterval, useIsFirstRender, useIsomorphicLayoutEffect, useKeyPress, useKeyPressEvent, useKeyboard, useKeysPressed, useList, useLocalStorage, useLogger, useLongPress, useMediaQuery, useMount, useMouse, useMutation, useNetwork, useOnline, useOperatingSystem, useOrientation, usePageLeave, usePreferredColorScheme, usePreferredLanguages, usePrevious, useQuery, useQueue, useRenderCount, useRerender, useScript, useSessionStorage, useSet, useStep, useStorage, useTextSelection, useTimeout, useToggle, useUnmount, useWindowEvent, useWindowSize };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@siberiacancode/reactuse",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"description": "Ultimate tool",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"@types/react": "^18.3.2",
|
|
75
75
|
"@types/react-dom": "^18.3.0",
|
|
76
76
|
"comment-parser": "^1.4.1",
|
|
77
|
+
"core-js": "^3.37.1",
|
|
77
78
|
"doctrine": "^3.0.0",
|
|
78
79
|
"eslint": "^8.56.0",
|
|
79
80
|
"husky": "^9.0.11",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_rollupPluginBabelHelpers-BZYFJ5Fo.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_rollupPluginBabelHelpers-CuOqjRnD.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|