@siberiacancode/reactuse 0.0.22 → 0.0.24
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-DDnjpXz_.js → _rollupPluginBabelHelpers-Dp-teDDf.js} +2 -2
- package/dist/cjs/_rollupPluginBabelHelpers-Dp-teDDf.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 +3 -0
- package/dist/cjs/hooks/useBrowserLanguage/useBrowserLanguage.js.map +1 -0
- 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/useCounter/useCounter.js.map +1 -1
- 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/useFps/useFps.js +3 -0
- package/dist/cjs/hooks/useFps/useFps.js.map +1 -0
- 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/useIntersectionObserver/useIntersectionObserver.js.map +1 -1
- package/dist/cjs/hooks/useInterval/useInterval.js +2 -2
- package/dist/cjs/hooks/useInterval/useInterval.js.map +1 -1
- 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/useLongPress/useLongPress.js.map +1 -1
- 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/useMouse/useMouse.js.map +1 -1
- 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/usePaint/usePaint.js +3 -0
- package/dist/cjs/hooks/usePaint/usePaint.js.map +1 -0
- 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 +2 -2
- package/dist/cjs/hooks/usePreferredLanguages/usePreferredLanguages.js.map +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/useTime/useTime.js +3 -0
- package/dist/cjs/hooks/useTime/useTime.js.map +1 -0
- package/dist/cjs/hooks/useTimeout/useTimeout.js +2 -2
- package/dist/cjs/hooks/useTimeout/useTimeout.js.map +1 -1
- 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 +2 -2
- 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 +3 -0
- package/dist/cjs/utils/helpers/time/getDate.js.map +1 -0
- package/dist/esm/{_rollupPluginBabelHelpers-pWwLtxdH.js → _rollupPluginBabelHelpers-BK7XeaSH.js} +2 -2
- package/dist/esm/_rollupPluginBabelHelpers-BK7XeaSH.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 +3 -0
- package/dist/esm/hooks/useBrowserLanguage/useBrowserLanguage.js.map +1 -0
- 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/useCounter/useCounter.js.map +1 -1
- 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/useFps/useFps.js +3 -0
- package/dist/esm/hooks/useFps/useFps.js.map +1 -0
- 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/useIntersectionObserver/useIntersectionObserver.js.map +1 -1
- package/dist/esm/hooks/useInterval/useInterval.js +2 -2
- package/dist/esm/hooks/useInterval/useInterval.js.map +1 -1
- 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/useLongPress/useLongPress.js.map +1 -1
- 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/useMouse/useMouse.js.map +1 -1
- 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/usePaint/usePaint.js +3 -0
- package/dist/esm/hooks/usePaint/usePaint.js.map +1 -0
- 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 +2 -2
- package/dist/esm/hooks/usePreferredLanguages/usePreferredLanguages.js.map +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/useTime/useTime.js +3 -0
- package/dist/esm/hooks/useTime/useTime.js.map +1 -0
- package/dist/esm/hooks/useTimeout/useTimeout.js +2 -2
- package/dist/esm/hooks/useTimeout/useTimeout.js.map +1 -1
- 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 +2 -2
- 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 +3 -0
- package/dist/esm/utils/helpers/time/getDate.js.map +1 -0
- package/dist/index.d.ts +126 -8
- package/package.json +1 -1
- package/dist/cjs/_rollupPluginBabelHelpers-DDnjpXz_.js.map +0 -1
- package/dist/esm/_rollupPluginBabelHelpers-pWwLtxdH.js.map +0 -1
|
@@ -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.
|
|
2
|
-
import n from"react";var e=function(){return window.navigator.languages},r=function(){return[
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.24 */
|
|
2
|
+
import 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.useSyncExternalStore(t,e,r)};export{a as usePreferredLanguages};
|
|
3
3
|
//# sourceMappingURL=usePreferredLanguages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePreferredLanguages.js","sources":["../../../../src/hooks/usePreferredLanguages/usePreferredLanguages.ts"],"sourcesContent":["import React from 'react';\n\nconst getSnapshot = () => window.navigator.languages;\nconst getServerSnapshot = () => [
|
|
1
|
+
{"version":3,"file":"usePreferredLanguages.js","sources":["../../../../src/hooks/usePreferredLanguages/usePreferredLanguages.ts"],"sourcesContent":["import React from 'react';\n\nconst getSnapshot = () => window.navigator.languages;\nconst getServerSnapshot = () => [] as const;\nconst subscribe = (callback: () => void) => {\n window.addEventListener('languagechange', callback);\n return () => {\n window.removeEventListener('languagechange', callback);\n };\n};\n\n/**\n * @name usePreferredLanguages\n * @description Hook that returns a browser preferred languages from navigator\n *\n * @returns {readonly string[]} An array of strings representing the user's preferred languages\n *\n * @example\n * const languages = usePreferredLanguages();\n */\nexport const usePreferredLanguages = () =>\n React.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n"],"names":["getSnapshot","window","navigator","languages","getServerSnapshot","subscribe","callback","addEventListener","removeEventListener","usePreferredLanguages","React","useSyncExternalStore"],"mappings":";qBAEA,IAAMA,EAAc,WAAH,OAASC,OAAOC,UAAUC,SAAS,EAC9CC,EAAoB,WAAH,MAAS,EAAE,EAC5BC,EAAY,SAACC,GAEjB,OADAL,OAAOM,iBAAiB,iBAAkBD,GACnC,WACLL,OAAOO,oBAAoB,iBAAkBF,GAEjD,EAWaG,EAAwB,WAAH,OAChCC,EAAMC,qBAAqBN,EAAWL,EAAaI,EAAkB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.24 */
|
|
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.24 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-BK7XeaSH.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.24 */
|
|
2
|
+
import{_ as r,c as t,d as n}from"../../_rollupPluginBabelHelpers-BK7XeaSH.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.24 */
|
|
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.24 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-BK7XeaSH.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.24 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-BK7XeaSH.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.24 */
|
|
2
|
+
import{b as o}from"../../_rollupPluginBabelHelpers-BK7XeaSH.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{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.24 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-BK7XeaSH.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\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
|
|
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.24 */
|
|
2
|
+
import{a as t,_ as r}from"../../_rollupPluginBabelHelpers-BK7XeaSH.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.24 */
|
|
2
|
+
import{a as e}from"../../_rollupPluginBabelHelpers-BK7XeaSH.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.24 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-BK7XeaSH.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
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.24 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-BK7XeaSH.js";import t from"react";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";import{getDate as r}from"../../utils/helpers/time/getDate.js";import"screenfull";import{useInterval as o}from"../useInterval/useInterval.js";import"react-dom";import"../useEvent/useEvent.js";var s=function(){var s=t.useState(r()),i=e(s,2),u=i[0],m=i[1];return o((function(){return m(r())}),1e3),u};export{s as useTime};
|
|
3
|
+
//# sourceMappingURL=useTime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTime.js","sources":["../../../../src/hooks/useTime/useTime.ts"],"sourcesContent":["import React from 'react';\n\nimport { useInterval } from '@/hooks';\nimport { getDate } from '@/utils/helpers';\n\nexport interface UseTimeReturn {\n seconds: number;\n minutes: number;\n hours: number;\n meridiemHours: { value: number; type: string };\n day: number;\n month: number;\n year: number;\n timestamp: number;\n}\n\n/**\n * @name useTime\n * @description - Hook that gives you current time in different values\n *\n * @returns {UseTimeReturn} An object containing the current time\n *\n * @example\n * const { seconds, minutes, hours, meridiemHours, day, month, year, timestamp } = useTime();\n */\n\nexport const useTime = (): UseTimeReturn => {\n const [time, setTime] = React.useState(getDate());\n useInterval(() => setTime(getDate()), 1000);\n return time;\n};\n"],"names":["useTime","_React$useState","React","useState","getDate","_React$useState2","_slicedToArray","time","setTime","useInterval"],"mappings":";kYA0BaA,EAAU,WACrB,IAAAC,EAAwBC,EAAMC,SAASC,KAAUC,EAAAC,EAAAL,EAAA,GAA1CM,EAAIF,EAAA,GAAEG,EAAOH,EAAA,GAEpB,OADAI,GAAY,WAAA,OAAMD,EAAQJ,IAAU,GAAE,KAC/BG,CACT"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.24 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-BK7XeaSH.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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTimeout.js","sources":["../../../../src/hooks/useTimeout/useTimeout.ts"],"sourcesContent":["import React from 'react';\n\nimport { useEvent } from '../useEvent/useEvent';\n\n/** The use timeout return type */\ninterface UseTimeoutReturn {\n /** Timeout is ready state value */\n ready: boolean;\n /** Function to clear timeout */\n clear: () => void;\n}\n\n/**\n * @name useTimeout\n * @description Hook that executes a callback function after a specified delay\n *\n * @param {() => void} callback The function to be executed after the timeout\n * @param {number} delay The delay in milliseconds before the timeout executes the callback function\n * @returns {UseTimeoutReturn} An object with a `ready` boolean state value and a `clear` function to clear timeout\n *\n * @example\n * const { clear, ready } = useTimeout(() => {}, 5000);\n */\nexport function useTimeout(callback: () => void, delay: number): UseTimeoutReturn {\n const [ready, setReady] = React.useState(false);\n\n const timeoutIdRef = React.useRef<ReturnType<typeof setTimeout>>();\n const internalCallback = useEvent(callback);\n\n React.useEffect(() => {\n timeoutIdRef.current = setTimeout(() => {\n internalCallback();\n setReady(true);\n }, delay);\n\n return () => {\n clearTimeout(timeoutIdRef.current);\n };\n }, [delay]);\n\n const clear = () => {\n clearTimeout(timeoutIdRef.current);\n setReady(true);\n };\n\n return { ready, clear };\n}\n"],"names":["useTimeout","callback","delay","_React$useState","React","useState","_React$useState2","_slicedToArray","ready","setReady","timeoutIdRef","useRef","internalCallback","useEvent","useEffect","current","setTimeout","clearTimeout","clear"],"mappings":";kPAuBO,SAASA,EAAWC,EAAsBC,GAC/C,IAAAC,EAA0BC,EAAMC,UAAS,GAAMC,EAAAC,EAAAJ,EAAA,GAAxCK,EAAKF,EAAA,GAAEG,EAAQH,EAAA,GAEhBI,EAAeN,EAAMO,SACrBC,EAAmBC,EAASZ,GAElCG,EAAMU,WAAU,WAMd,OALAJ,EAAaK,QAAUC,YAAW,WAChCJ,IACAH,GAAS,EACV,GAAEP,GAEI,WACLe,aAAaP,EAAaK,SAE9B,GAAG,CAACb,IAOJ,MAAO,CAAEM,MAAAA,EAAOU,MALF,WACZD,aAAaP,EAAaK,SAC1BN,GAAS,IAIb"}
|
|
1
|
+
{"version":3,"file":"useTimeout.js","sources":["../../../../src/hooks/useTimeout/useTimeout.ts"],"sourcesContent":["import React from 'react';\n\nimport { useEvent } from '../useEvent/useEvent';\n\n/** The use timeout return type */\ninterface UseTimeoutReturn {\n /** Timeout is ready state value */\n ready: boolean;\n /** Function to clear timeout */\n clear: () => void;\n}\n\n/**\n * @name useTimeout\n * @description - Hook that executes a callback function after a specified delay\n *\n * @param {() => void} callback The function to be executed after the timeout\n * @param {number} delay The delay in milliseconds before the timeout executes the callback function\n * @returns {UseTimeoutReturn} An object with a `ready` boolean state value and a `clear` function to clear timeout\n *\n * @example\n * const { clear, ready } = useTimeout(() => {}, 5000);\n */\nexport function useTimeout(callback: () => void, delay: number): UseTimeoutReturn {\n const [ready, setReady] = React.useState(false);\n\n const timeoutIdRef = React.useRef<ReturnType<typeof setTimeout>>();\n const internalCallback = useEvent(callback);\n\n React.useEffect(() => {\n timeoutIdRef.current = setTimeout(() => {\n internalCallback();\n setReady(true);\n }, delay);\n\n return () => {\n clearTimeout(timeoutIdRef.current);\n };\n }, [delay]);\n\n const clear = () => {\n clearTimeout(timeoutIdRef.current);\n setReady(true);\n };\n\n return { ready, clear };\n}\n"],"names":["useTimeout","callback","delay","_React$useState","React","useState","_React$useState2","_slicedToArray","ready","setReady","timeoutIdRef","useRef","internalCallback","useEvent","useEffect","current","setTimeout","clearTimeout","clear"],"mappings":";kPAuBO,SAASA,EAAWC,EAAsBC,GAC/C,IAAAC,EAA0BC,EAAMC,UAAS,GAAMC,EAAAC,EAAAJ,EAAA,GAAxCK,EAAKF,EAAA,GAAEG,EAAQH,EAAA,GAEhBI,EAAeN,EAAMO,SACrBC,EAAmBC,EAASZ,GAElCG,EAAMU,WAAU,WAMd,OALAJ,EAAaK,QAAUC,YAAW,WAChCJ,IACAH,GAAS,EACV,GAAEP,GAEI,WACLe,aAAaP,EAAaK,SAE9B,GAAG,CAACb,IAOJ,MAAO,CAAEM,MAAAA,EAAOU,MALF,WACZD,aAAaP,EAAaK,SAC1BN,GAAS,IAIb"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.24 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-BK7XeaSH.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.24 */
|
|
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.24 */
|
|
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.24 */
|
|
2
|
+
import{_ as i}from"../../_rollupPluginBabelHelpers-BK7XeaSH.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.24 */
|
|
2
|
+
export{useBattery}from"./hooks/useBattery/useBattery.js";export{useBoolean}from"./hooks/useBoolean/useBoolean.js";export{useBrowserLanguage}from"./hooks/useBrowserLanguage/useBrowserLanguage.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{useFps}from"./hooks/useFps/useFps.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{getTargetElement,usePaint}from"./hooks/usePaint/usePaint.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{useTime}from"./hooks/useTime/useTime.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";export{getDate}from"./utils/helpers/time/getDate.js";import"./_rollupPluginBabelHelpers-BK7XeaSH.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.24 */
|
|
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.
|
|
2
|
-
export{debounce}from"./debounce.js";export{getRetry}from"./getRetry.js";export{isClient}from"./isClient.js";export{throttle}from"./throttle.js";
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.24 */
|
|
2
|
+
export{debounce}from"./debounce.js";export{getRetry}from"./getRetry.js";export{isClient}from"./isClient.js";export{throttle}from"./throttle.js";export{getDate}from"./time/getDate.js";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.24 */
|
|
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.24 */
|
|
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
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.24 */
|
|
2
|
+
var e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,t=e.getSeconds(),n=e.getMinutes(),r=e.getHours();return{seconds:t,minutes:n,hours:r,meridiemHours:{value:r%12==0?12:r%12,type:r>=12?"pm":"am"},day:e.getDate(),month:e.getMonth(),year:e.getFullYear(),timestamp:e.getTime()}};export{e as getDate};
|
|
3
|
+
//# sourceMappingURL=getDate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDate.js","sources":["../../../../../src/utils/helpers/time/getDate.ts"],"sourcesContent":["export const getDate = (now: Date = new Date()) => {\n const seconds = now.getSeconds();\n const minutes = now.getMinutes();\n const hours = now.getHours();\n const meridiemHours = hours % 12 === 0 ? 12 : hours % 12;\n const meridiemType = hours >= 12 ? 'pm' : 'am';\n const day = now.getDate();\n const month = now.getMonth();\n const year = now.getFullYear();\n const timestamp = now.getTime();\n\n return {\n seconds,\n minutes,\n hours,\n meridiemHours: { value: meridiemHours, type: meridiemType },\n day,\n month,\n year,\n timestamp\n };\n};\n"],"names":["getDate","now","arguments","length","undefined","Date","seconds","getSeconds","minutes","getMinutes","hours","getHours","meridiemHours","value","type","day","month","getMonth","year","getFullYear","timestamp","getTime"],"mappings":";IAAaA,EAAU,WAA4B,IAA3BC,EAASC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAA,GAAG,IAAIG,KAChCC,EAAUL,EAAIM,aACdC,EAAUP,EAAIQ,aACdC,EAAQT,EAAIU,WAQlB,MAAO,CACLL,QAAAA,EACAE,QAAAA,EACAE,MAAAA,EACAE,cAAe,CAAEC,MAXGH,EAAQ,IAAO,EAAI,GAAKA,EAAQ,GAWbI,KAVpBJ,GAAS,GAAK,KAAO,MAWxCK,IAVUd,EAAID,UAWdgB,MAVYf,EAAIgB,WAWhBC,KAVWjB,EAAIkB,cAWfC,UAVgBnB,EAAIoB,UAYxB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -45,6 +45,17 @@ type UseBooleanReturn = [
|
|
|
45
45
|
*/
|
|
46
46
|
declare const useBoolean: (initialValue?: boolean) => UseBooleanReturn;
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* @name useBrowserLanguage
|
|
50
|
+
* @description - Hook that returns the current browser language
|
|
51
|
+
*
|
|
52
|
+
* @returns {string} The current browser language
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* const browserLanguage = useBrowserLanguage();
|
|
56
|
+
*/
|
|
57
|
+
declare const useBrowserLanguage: () => string;
|
|
58
|
+
|
|
48
59
|
/** The use click outside target element type */
|
|
49
60
|
type UseClickOutsideTarget = React.RefObject<Element | null> | (() => Element) | Element;
|
|
50
61
|
/** The use click outside return type */
|
|
@@ -95,7 +106,7 @@ interface UseCopyToClipboardReturn {
|
|
|
95
106
|
*/
|
|
96
107
|
declare const useCopyToClipboard: () => UseCopyToClipboardReturn;
|
|
97
108
|
|
|
98
|
-
/** The use counter options
|
|
109
|
+
/** The use counter options */
|
|
99
110
|
interface UseCounterOptions {
|
|
100
111
|
/** The min of count value */
|
|
101
112
|
min?: number;
|
|
@@ -136,16 +147,15 @@ type UseCounter = {
|
|
|
136
147
|
* @param {number} [options.min=Number.NEGATIVE_INFINITY] The min of count value
|
|
137
148
|
* @param {number} [options.max=Number.POSITIVE_INFINITY] The max of count value
|
|
138
149
|
* @returns {UseCounterReturn} An object containing the current count and functions to interact with the counter
|
|
139
|
-
|
|
140
|
-
* @example
|
|
141
|
-
* const { count, dec, inc, reset, set } = useCounter(5);
|
|
142
|
-
*
|
|
150
|
+
|
|
143
151
|
* @overload
|
|
144
152
|
* @param {number} [params.initialValue=0] The initial number value
|
|
145
153
|
* @param {number} [params.min=Number.NEGATIVE_INFINITY] The min of count value
|
|
146
154
|
* @param {number} [params.max=Number.POSITIVE_INFINITY] The max of count value
|
|
147
155
|
* @returns {UseCounterReturn} An object containing the current count and functions to interact with the counter
|
|
148
156
|
*
|
|
157
|
+
* @example
|
|
158
|
+
* const { count, dec, inc, reset, set } = useCounter(5);
|
|
149
159
|
*
|
|
150
160
|
* @example
|
|
151
161
|
* const { count, dec, inc, reset, set } = useCounter({ initialValue: 5, min: 0, max: 10 });
|
|
@@ -264,6 +274,17 @@ declare const useFavicon: (initialHref?: string) => {
|
|
|
264
274
|
readonly set: (favicon: string) => void;
|
|
265
275
|
};
|
|
266
276
|
|
|
277
|
+
/**
|
|
278
|
+
* @name useFps
|
|
279
|
+
* @description - Hook that measures frames per second
|
|
280
|
+
*
|
|
281
|
+
* @returns {number} A number which determines frames per second
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* const fps = useFps();
|
|
285
|
+
*/
|
|
286
|
+
declare const useFps: () => number;
|
|
287
|
+
|
|
267
288
|
/** The use fullscreen target element type */
|
|
268
289
|
type UseFullScreenTarget = React.RefObject<Element | null> | (() => Element) | Element;
|
|
269
290
|
/** The use fullscreen options type */
|
|
@@ -912,6 +933,65 @@ declare const useOrientation: () => UseOrientationReturn;
|
|
|
912
933
|
*/
|
|
913
934
|
declare const usePageLeave: (callback: () => void) => void;
|
|
914
935
|
|
|
936
|
+
interface UsePaintPencil {
|
|
937
|
+
/** Pencil color */
|
|
938
|
+
color?: string;
|
|
939
|
+
/** Pencil width */
|
|
940
|
+
width?: number;
|
|
941
|
+
/** Pencil opacity */
|
|
942
|
+
opacity?: number;
|
|
943
|
+
}
|
|
944
|
+
type UsePaintOptions = UsePaintPencil;
|
|
945
|
+
/** The use paint return type */
|
|
946
|
+
interface UsePaintReturn {
|
|
947
|
+
pencil: UsePaintPencil & {
|
|
948
|
+
set: React.Dispatch<React.SetStateAction<UsePaintPencil>>;
|
|
949
|
+
};
|
|
950
|
+
drawing: boolean;
|
|
951
|
+
}
|
|
952
|
+
type UsePaintTarget = React.RefObject<HTMLCanvasElement> | (() => HTMLCanvasElement) | HTMLCanvasElement;
|
|
953
|
+
declare const getTargetElement: (target: UsePaintTarget) => HTMLCanvasElement | null;
|
|
954
|
+
type UsePaint = {
|
|
955
|
+
<Target extends UsePaintTarget>(target: Target, options?: UsePaintOptions): UsePaintReturn;
|
|
956
|
+
(options?: UsePaintOptions, target?: never): UsePaintReturn & {
|
|
957
|
+
ref: React.RefObject<HTMLCanvasElement>;
|
|
958
|
+
};
|
|
959
|
+
};
|
|
960
|
+
/**
|
|
961
|
+
* @name usePaint
|
|
962
|
+
* @description - Hook that allows you to draw in a specific area
|
|
963
|
+
*
|
|
964
|
+
* @overload
|
|
965
|
+
* @template Target The target element
|
|
966
|
+
* @param {Target} target The target element to be painted
|
|
967
|
+
* @param {UsePaintOptions} [options] The options to be used
|
|
968
|
+
* @returns {UsePaintReturn} An object containing the current pencil options and functions to interact with the paint
|
|
969
|
+
*
|
|
970
|
+
* @example
|
|
971
|
+
* const { pencil, drawing } = usePaint(canvasRef);
|
|
972
|
+
*
|
|
973
|
+
* @overload
|
|
974
|
+
* @param {UsePaintOptions} [options] The options to be used
|
|
975
|
+
* @returns {UsePaintReturn & { ref: React.RefObject<HTMLCanvasElement> }} An object containing the current pencil options and functions to interact with the paint
|
|
976
|
+
*
|
|
977
|
+
* @example
|
|
978
|
+
* const { ref, pencil, drawing } = usePaint();
|
|
979
|
+
*/
|
|
980
|
+
declare const usePaint: UsePaint;
|
|
981
|
+
|
|
982
|
+
/** The use preferred color scheme return type */
|
|
983
|
+
type UsePreferredColorSchemeReturn = 'dark' | 'light' | 'no-preference';
|
|
984
|
+
/**
|
|
985
|
+
* @name usePreferredColorScheme
|
|
986
|
+
* @description - Hook that returns user preferred color scheme
|
|
987
|
+
*
|
|
988
|
+
* @returns {UsePreferredColorSchemeReturn} String of preferred color scheme
|
|
989
|
+
*
|
|
990
|
+
* @example
|
|
991
|
+
* const colorScheme = usePreferredColorScheme();
|
|
992
|
+
*/
|
|
993
|
+
declare const usePreferredColorScheme: () => UsePreferredColorSchemeReturn;
|
|
994
|
+
|
|
915
995
|
/**
|
|
916
996
|
* @name usePreferredLanguages
|
|
917
997
|
* @description Hook that returns a browser preferred languages from navigator
|
|
@@ -1117,7 +1197,7 @@ interface UseSetReturn<Value> {
|
|
|
1117
1197
|
* @returns {UseSetReturn} An object containing the current set and functions to interact with the set
|
|
1118
1198
|
*
|
|
1119
1199
|
* @example
|
|
1120
|
-
* const
|
|
1200
|
+
* const { value, add, remove, clear, reset, toggle, union, intersection, difference, symmetricDifference, size, has } = useSet([1, 2, 3]);
|
|
1121
1201
|
*/
|
|
1122
1202
|
declare const useSet: <Value>(values?: Value[]) => UseSetReturn<Value>;
|
|
1123
1203
|
|
|
@@ -1191,6 +1271,30 @@ interface UseTextSelectionReturn {
|
|
|
1191
1271
|
*/
|
|
1192
1272
|
declare const useTextSelection: () => UseTextSelectionReturn;
|
|
1193
1273
|
|
|
1274
|
+
interface UseTimeReturn {
|
|
1275
|
+
seconds: number;
|
|
1276
|
+
minutes: number;
|
|
1277
|
+
hours: number;
|
|
1278
|
+
meridiemHours: {
|
|
1279
|
+
value: number;
|
|
1280
|
+
type: string;
|
|
1281
|
+
};
|
|
1282
|
+
day: number;
|
|
1283
|
+
month: number;
|
|
1284
|
+
year: number;
|
|
1285
|
+
timestamp: number;
|
|
1286
|
+
}
|
|
1287
|
+
/**
|
|
1288
|
+
* @name useTime
|
|
1289
|
+
* @description - Hook that gives you current time in different values
|
|
1290
|
+
*
|
|
1291
|
+
* @returns {UseTimeReturn} An object containing the current time
|
|
1292
|
+
*
|
|
1293
|
+
* @example
|
|
1294
|
+
* const { seconds, minutes, hours, meridiemHours, day, month, year, timestamp } = useTime();
|
|
1295
|
+
*/
|
|
1296
|
+
declare const useTime: () => UseTimeReturn;
|
|
1297
|
+
|
|
1194
1298
|
/** The use timeout return type */
|
|
1195
1299
|
interface UseTimeoutReturn {
|
|
1196
1300
|
/** Timeout is ready state value */
|
|
@@ -1200,7 +1304,7 @@ interface UseTimeoutReturn {
|
|
|
1200
1304
|
}
|
|
1201
1305
|
/**
|
|
1202
1306
|
* @name useTimeout
|
|
1203
|
-
* @description Hook that executes a callback function after a specified delay
|
|
1307
|
+
* @description - Hook that executes a callback function after a specified delay
|
|
1204
1308
|
*
|
|
1205
1309
|
* @param {() => void} callback The function to be executed after the timeout
|
|
1206
1310
|
* @param {number} delay The delay in milliseconds before the timeout executes the callback function
|
|
@@ -1293,4 +1397,18 @@ declare const isClient: boolean;
|
|
|
1293
1397
|
|
|
1294
1398
|
declare const throttle: <Params extends any[]>(callback: (...args: Params) => void, delay: number) => ((...args: Params) => void);
|
|
1295
1399
|
|
|
1296
|
-
|
|
1400
|
+
declare const getDate: (now?: Date) => {
|
|
1401
|
+
seconds: number;
|
|
1402
|
+
minutes: number;
|
|
1403
|
+
hours: number;
|
|
1404
|
+
meridiemHours: {
|
|
1405
|
+
value: number;
|
|
1406
|
+
type: string;
|
|
1407
|
+
};
|
|
1408
|
+
day: number;
|
|
1409
|
+
month: number;
|
|
1410
|
+
year: number;
|
|
1411
|
+
timestamp: number;
|
|
1412
|
+
};
|
|
1413
|
+
|
|
1414
|
+
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 UsePaint, type UsePaintOptions, type UsePaintPencil, type UsePaintReturn, type UsePaintTarget, type UsePreferredColorSchemeReturn, type UseQueueReturn, type UseScriptOptions, type UseScriptStatus, type UseStorageInitialValue, type UseStorageOptions, type UseStorageReturn, type UseTextSelectionReturn, type UseTimeReturn, type UseToggleReturn, type UseWindowSizeReturn, debounce, dispatchStorageEvent, getConnection, getDate, getOperatingSystem, getRangesSelection, getRetry, getTargetElement, isClient, isHotkeyMatch, legacyCopyToClipboard, throttle, useBattery, useBoolean, useBrowserLanguage, useClickOutside, useCopyToClipboard, useCounter, useDebouncedValue, useDefault, useDidUpdate, useDocumentTitle, useDocumentVisibility, useEvent, useEventListener, useFavicon, useFps, 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, usePaint, usePreferredColorScheme, usePreferredLanguages, usePrevious, useQuery, useQueue, useRenderCount, useRerender, useScript, useSessionStorage, useSet, useStep, useStorage, useTextSelection, useTime, useTimeout, useToggle, useUnmount, useWindowEvent, useWindowSize };
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_rollupPluginBabelHelpers-DDnjpXz_.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_rollupPluginBabelHelpers-pWwLtxdH.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|