@siberiacancode/reactuse 0.0.9 → 0.0.10
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-Db0KR1gW.js → _rollupPluginBabelHelpers-BvBejAnn.js} +3 -3
- package/dist/cjs/_rollupPluginBabelHelpers-BvBejAnn.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 +2 -2
- package/dist/cjs/hooks/useClickOutside/useClickOutside.js.map +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/useDocumentTitle/useDocumentTitle.js.map +1 -1
- package/dist/cjs/hooks/useDocumentVisibility/useDocumentVisibility.js +2 -2
- package/dist/cjs/hooks/useDocumentVisibility/useDocumentVisibility.js.map +1 -1
- package/dist/cjs/hooks/useEvent/useEvent.js +3 -0
- package/dist/cjs/hooks/useEvent/useEvent.js.map +1 -0
- package/dist/cjs/hooks/useEventListener/useEventListener.js +1 -1
- package/dist/cjs/hooks/useFavicon/useFavicon.js +2 -2
- package/dist/cjs/hooks/useHash/useHash.js +2 -2
- package/dist/cjs/hooks/useHotkeys/useHotkeys.js +3 -0
- package/dist/cjs/hooks/useHotkeys/useHotkeys.js.map +1 -0
- package/dist/cjs/hooks/useHover/useHover.js +2 -2
- package/dist/cjs/hooks/useHover/useHover.js.map +1 -1
- package/dist/cjs/hooks/useIdle/useIdle.js +2 -2
- package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.js +3 -0
- package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.js.map +1 -0
- 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/useKeysPressed/useKeysPressed.js +2 -2
- package/dist/cjs/hooks/useKeysPressed/useKeysPressed.js.map +1 -1
- package/dist/cjs/hooks/useLocalStorage/useLocalStorage.js +2 -2
- package/dist/cjs/hooks/useLogger/useLogger.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/useMutationObserver.js +1 -1
- package/dist/cjs/hooks/useNetwork/useNetwork.js +1 -1
- 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/usePrevious/usePrevious.js +1 -1
- package/dist/cjs/hooks/useQueue/useQueue.js +3 -0
- package/dist/cjs/hooks/useQueue/useQueue.js.map +1 -0
- 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/useScript/useScript.js.map +1 -1
- package/dist/cjs/hooks/useSessionStorage/useSessionStorage.js +2 -2
- package/dist/cjs/hooks/useSet/useSet.js +2 -2
- package/dist/cjs/hooks/useStep/useStep.js +2 -2
- package/dist/cjs/hooks/useStorage/useStorage.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/index.js +1 -1
- package/dist/cjs/utils/helpers/isClient.js +1 -1
- package/dist/cjs/utils/helpers/isShallowEqual.js +1 -1
- package/dist/cjs/utils/helpers/throttle.js +1 -1
- package/dist/esm/{_rollupPluginBabelHelpers-Cg3Jntln.js → _rollupPluginBabelHelpers-D5_r4iwW.js} +3 -3
- package/dist/esm/_rollupPluginBabelHelpers-D5_r4iwW.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 +2 -2
- package/dist/esm/hooks/useClickOutside/useClickOutside.js.map +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/useDocumentTitle/useDocumentTitle.js.map +1 -1
- package/dist/esm/hooks/useDocumentVisibility/useDocumentVisibility.js +2 -2
- package/dist/esm/hooks/useDocumentVisibility/useDocumentVisibility.js.map +1 -1
- package/dist/esm/hooks/useEvent/useEvent.js +3 -0
- package/dist/esm/hooks/useEvent/useEvent.js.map +1 -0
- package/dist/esm/hooks/useEventListener/useEventListener.js +1 -1
- package/dist/esm/hooks/useFavicon/useFavicon.js +2 -2
- package/dist/esm/hooks/useHash/useHash.js +2 -2
- package/dist/esm/hooks/useHotkeys/useHotkeys.js +3 -0
- package/dist/esm/hooks/useHotkeys/useHotkeys.js.map +1 -0
- package/dist/esm/hooks/useHover/useHover.js +2 -2
- package/dist/esm/hooks/useHover/useHover.js.map +1 -1
- package/dist/esm/hooks/useIdle/useIdle.js +2 -2
- package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.js +3 -0
- package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.js.map +1 -0
- 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/useKeysPressed/useKeysPressed.js +2 -2
- package/dist/esm/hooks/useKeysPressed/useKeysPressed.js.map +1 -1
- package/dist/esm/hooks/useLocalStorage/useLocalStorage.js +2 -2
- package/dist/esm/hooks/useLogger/useLogger.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/useMutationObserver.js +1 -1
- package/dist/esm/hooks/useNetwork/useNetwork.js +1 -1
- 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/usePrevious/usePrevious.js +1 -1
- package/dist/esm/hooks/useQueue/useQueue.js +3 -0
- package/dist/esm/hooks/useQueue/useQueue.js.map +1 -0
- 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/useScript/useScript.js.map +1 -1
- package/dist/esm/hooks/useSessionStorage/useSessionStorage.js +2 -2
- package/dist/esm/hooks/useSet/useSet.js +2 -2
- package/dist/esm/hooks/useStep/useStep.js +2 -2
- package/dist/esm/hooks/useStorage/useStorage.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/index.js +1 -1
- package/dist/esm/utils/helpers/isClient.js +1 -1
- package/dist/esm/utils/helpers/isShallowEqual.js +1 -1
- package/dist/esm/utils/helpers/throttle.js +1 -1
- package/dist/index.d.ts +96 -5
- package/package.json +2 -1
- package/dist/cjs/_rollupPluginBabelHelpers-Db0KR1gW.js.map +0 -1
- package/dist/esm/_rollupPluginBabelHelpers-Cg3Jntln.js.map +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
"use strict";var e=require("../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
"use strict";var e=require("../../_rollupPluginBabelHelpers-BvBejAnn.js"),r=require("react"),t="script-status";exports.SCRIPT_STATUS_ATTRIBUTE_NAME=t,exports.useScript=function(n){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.useState((function(){var e=document.querySelector('script[src="'.concat(n,'"]')),r=null==e?void 0:e.getAttribute(t);return r||(e?"unknown":"loading")})),u=e._slicedToArray(i,2),c=u[0],s=u[1],a=o.removeOnUnmount,d=void 0===a||a,l=o.async,v=void 0===l||l;return r.useEffect((function(){var r=document.querySelector('script[src="'.concat(n,'"]')),i=null==r?void 0:r.getAttribute(t);if(i)return s(i);if(r)return s("unknown");var u=document.createElement("script");u.src=n,u.async=v;for(var c=0,a=Object.entries(o);c<a.length;c++){var l=e._slicedToArray(a[c],2),f=l[0],p=l[1];u.setAttribute(f,String(p))}u.setAttribute(t,"loading"),document.body.appendChild(u);var A=function(){u.setAttribute(t,"ready"),s("ready")},m=function(){u.setAttribute(t,"error"),s("error")};return u.addEventListener("load",A),u.addEventListener("error",m),function(){d&&(u.remove(),u.removeEventListener("load",A),u.removeEventListener("error",m))}}),[n,d]),c};
|
|
3
3
|
//# sourceMappingURL=useScript.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScript.js","sources":["../../../../src/hooks/useScript/useScript.ts"],"sourcesContent":["import React from 'react';\n\nexport type UseScriptStatus = 'loading' | 'ready' | 'error' | 'unknown';\nexport const SCRIPT_STATUS_ATTRIBUTE_NAME = 'script-status';\n\nexport interface UseScriptOptions extends React.ComponentProps<'script'> {\n removeOnUnmount?: boolean;\n}\n\n/**\n * @name useScript\n * @description - Hook that manages a script with onLoad, onError, and removeOnUnmount functionalities\n *\n * @param {string} src The source of the script\n * @param {UseScriptOptions} [options] The options of the script extends from attributes script tag\n * @param {boolean} [options.removeOnUnmount=true] Whether to remove the script on unmount\n * @param {boolean} [options.async=true] Whether to load the script asynchronously\n * @returns {UseScriptStatus} The status of the script\n *\n * @example\n * const status = useScript('https://example.com/script.js');\n */\nexport const useScript = (src: string, options: UseScriptOptions = {}) => {\n const [status, setStatus] = React.useState<UseScriptStatus>(() => {\n const script = document.querySelector(`script[src=\"${src}\"]`) as HTMLScriptElement;\n const scriptStatus = script?.getAttribute(SCRIPT_STATUS_ATTRIBUTE_NAME) as UseScriptStatus;\n if (scriptStatus) return scriptStatus;\n if (script) return 'unknown';\n\n return 'loading';\n });\n const { removeOnUnmount = true, async = true } = options;\n\n React.useEffect(() => {\n const existedScript = document.querySelector(`script[src=\"${src}\"]`) as HTMLScriptElement;\n const scriptStatus = existedScript?.getAttribute(\n SCRIPT_STATUS_ATTRIBUTE_NAME\n ) as UseScriptStatus;\n if (scriptStatus) return setStatus(scriptStatus);\n if (existedScript) return setStatus('unknown');\n\n const script = document.createElement('script');\n script.src = src;\n script.async = async;\n\n for (const [key, value] of Object.entries(options)) {\n script.setAttribute(key, String(value));\n }\n\n script.setAttribute(SCRIPT_STATUS_ATTRIBUTE_NAME, 'loading');\n document.body.appendChild(script);\n\n const onLoad = () => {\n script.setAttribute(SCRIPT_STATUS_ATTRIBUTE_NAME, 'ready');\n setStatus('ready');\n };\n\n const onError = () => {\n script.setAttribute(SCRIPT_STATUS_ATTRIBUTE_NAME, 'error');\n setStatus('error');\n };\n\n const removeEventListeners = () => {\n script.removeEventListener('load', onLoad);\n script.removeEventListener('error', onError);\n };\n\n script.addEventListener('load', onLoad);\n script.addEventListener('error', onError);\n\n return () => {\n if (removeOnUnmount) {\n script.remove();\n removeEventListeners();\n }\n };\n }, [src, removeOnUnmount]);\n\n return status;\n};\n"],"names":["SCRIPT_STATUS_ATTRIBUTE_NAME","src","options","arguments","length","undefined","_React$useState","React","useState","script","document","querySelector","concat","scriptStatus","getAttribute","_React$useState2","_slicedToArray","status","setStatus","_options$removeOnUnmo","removeOnUnmount","_options$async","async","useEffect","existedScript","createElement","_i","_Object$entries","Object","entries","_Object$entries$_i","key","value","setAttribute","String","body","appendChild","onLoad","onError","addEventListener","remove","removeEventListener"],"mappings":";
|
|
1
|
+
{"version":3,"file":"useScript.js","sources":["../../../../src/hooks/useScript/useScript.ts"],"sourcesContent":["import React from 'react';\n\n/** The use script status */\nexport type UseScriptStatus = 'loading' | 'ready' | 'error' | 'unknown';\nexport const SCRIPT_STATUS_ATTRIBUTE_NAME = 'script-status';\n\n/** The use script options extends from attributes script tag */\nexport interface UseScriptOptions extends React.ComponentProps<'script'> {\n /** Whether to remove the script on unmount */\n removeOnUnmount?: boolean;\n}\n\n/**\n * @name useScript\n * @description - Hook that manages a script with onLoad, onError, and removeOnUnmount functionalities\n *\n * @param {string} src The source of the script\n * @param {UseScriptOptions} [options] The options of the script extends from attributes script tag\n * @param {boolean} [options.removeOnUnmount=true] Whether to remove the script on unmount\n * @param {boolean} [options.async=true] Whether to load the script asynchronously\n * @returns {UseScriptStatus} The status of the script\n *\n * @example\n * const status = useScript('https://example.com/script.js');\n */\nexport const useScript = (src: string, options: UseScriptOptions = {}) => {\n const [status, setStatus] = React.useState<UseScriptStatus>(() => {\n const script = document.querySelector(`script[src=\"${src}\"]`) as HTMLScriptElement;\n const scriptStatus = script?.getAttribute(SCRIPT_STATUS_ATTRIBUTE_NAME) as UseScriptStatus;\n if (scriptStatus) return scriptStatus;\n if (script) return 'unknown';\n\n return 'loading';\n });\n const { removeOnUnmount = true, async = true } = options;\n\n React.useEffect(() => {\n const existedScript = document.querySelector(`script[src=\"${src}\"]`) as HTMLScriptElement;\n const scriptStatus = existedScript?.getAttribute(\n SCRIPT_STATUS_ATTRIBUTE_NAME\n ) as UseScriptStatus;\n if (scriptStatus) return setStatus(scriptStatus);\n if (existedScript) return setStatus('unknown');\n\n const script = document.createElement('script');\n script.src = src;\n script.async = async;\n\n for (const [key, value] of Object.entries(options)) {\n script.setAttribute(key, String(value));\n }\n\n script.setAttribute(SCRIPT_STATUS_ATTRIBUTE_NAME, 'loading');\n document.body.appendChild(script);\n\n const onLoad = () => {\n script.setAttribute(SCRIPT_STATUS_ATTRIBUTE_NAME, 'ready');\n setStatus('ready');\n };\n\n const onError = () => {\n script.setAttribute(SCRIPT_STATUS_ATTRIBUTE_NAME, 'error');\n setStatus('error');\n };\n\n const removeEventListeners = () => {\n script.removeEventListener('load', onLoad);\n script.removeEventListener('error', onError);\n };\n\n script.addEventListener('load', onLoad);\n script.addEventListener('error', onError);\n\n return () => {\n if (removeOnUnmount) {\n script.remove();\n removeEventListeners();\n }\n };\n }, [src, removeOnUnmount]);\n\n return status;\n};\n"],"names":["SCRIPT_STATUS_ATTRIBUTE_NAME","src","options","arguments","length","undefined","_React$useState","React","useState","script","document","querySelector","concat","scriptStatus","getAttribute","_React$useState2","_slicedToArray","status","setStatus","_options$removeOnUnmo","removeOnUnmount","_options$async","async","useEffect","existedScript","createElement","_i","_Object$entries","Object","entries","_Object$entries$_i","key","value","setAttribute","String","body","appendChild","onLoad","onError","addEventListener","remove","removeEventListener"],"mappings":";6FAIaA,EAA+B,yEAqBnB,SAACC,GAAgD,IAAnCC,EAAyBC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,CAAA,EACjEG,EAA4BC,EAAMC,UAA0B,WAC1D,IAAMC,EAASC,SAASC,6BAAaC,OAAgBX,EAAG,OAClDY,EAAeJ,aAAAA,EAAAA,EAAQK,aAAad,GAC1C,OAAIa,IACAJ,EAAe,UAEZ,UACT,IAAEM,EAAAC,EAAAA,eAAAV,EAAA,GAPKW,EAAMF,EAAA,GAAEG,EAASH,EAAA,GAQxBI,EAAiDjB,EAAzCkB,gBAAAA,OAAkB,IAAHD,GAAOA,EAAAE,EAAmBnB,EAAjBoB,MAAAA,OAAQ,IAAHD,GAAOA,EA+C5C,OA7CAd,EAAMgB,WAAU,WACd,IAAMC,EAAgBd,SAASC,6BAAaC,OAAgBX,EAAG,OACzDY,EAAeW,aAAAA,EAAAA,EAAeV,aAClCd,GAEF,GAAIa,EAAc,OAAOK,EAAUL,GACnC,GAAIW,EAAe,OAAON,EAAU,WAEpC,IAAMT,EAASC,SAASe,cAAc,UACtChB,EAAOR,IAAMA,EACbQ,EAAOa,MAAQA,EAEf,IAAA,IAAAI,EAAAC,EAAAA,EAA2BC,OAAOC,QAAQ3B,GAAQwB,EAAAC,EAAAvB,OAAAsB,IAAE,CAA/C,IAAAI,EAAAd,EAAAA,eAAAW,EAAAD,GAAA,GAAOK,EAAGD,EAAA,GAAEE,EAAKF,EAAA,GACpBrB,EAAOwB,aAAaF,EAAKG,OAAOF,GAClC,CAEAvB,EAAOwB,aAAajC,EAA8B,WAClDU,SAASyB,KAAKC,YAAY3B,GAE1B,IAAM4B,EAAS,WACb5B,EAAOwB,aAAajC,EAA8B,SAClDkB,EAAU,UAGNoB,EAAU,WACd7B,EAAOwB,aAAajC,EAA8B,SAClDkB,EAAU,UAWZ,OAHAT,EAAO8B,iBAAiB,OAAQF,GAChC5B,EAAO8B,iBAAiB,QAASD,GAE1B,WACDlB,IACFX,EAAO+B,SATT/B,EAAOgC,oBAAoB,OAAQJ,GACnC5B,EAAOgC,oBAAoB,QAASH,IAYxC,GAAG,CAACrC,EAAKmB,IAEFH,CACT"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
"use strict";var e=require("../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
"use strict";var e=require("../../_rollupPluginBabelHelpers-BvBejAnn.js"),r=require("../useStorage/useStorage.js");require("react"),require("../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js"),require("../../utils/helpers/isClient.js");exports.useSessionStorage=function(s,t,u){return r.useStorage(s,e._objectSpread2({initialValue:t,storage:window.sessionStorage},u))};
|
|
3
3
|
//# sourceMappingURL=useSessionStorage.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
"use strict";var e=require("react"),r=require("../useRerender/useRerender.js");require("../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
"use strict";var e=require("react"),r=require("../useRerender/useRerender.js");require("../../_rollupPluginBabelHelpers-BvBejAnn.js");exports.useSet=function(t){var n=e.useRef(new Set(t)),u=r.useRerender();return n.current.add=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];var a=Set.prototype.add.apply(n.current,r);return u.update(),a},n.current.clear=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];Set.prototype.clear.apply(n.current,r),u.update()},n.current.delete=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];var a=Set.prototype.delete.apply(n.current,r);return u.update(),a},n.current};
|
|
3
3
|
//# sourceMappingURL=useSet.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
"use strict";var t=require("../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
"use strict";var t=require("../../_rollupPluginBabelHelpers-BvBejAnn.js"),e=require("react");exports.useStep=function(r){var n="object"===t._typeof(r)?r.max:r,u="object"===t._typeof(r)?r.initial:1,i=e.useRef(u>n||u<1?1:u),s=e.useState(u),c=t._slicedToArray(s,2),o=c[0],a=c[1],f=1===o,l=o===n;return{counts:n,currentStep:o,isFirst:f,isLast:l,next:function(){l||a((function(t){return t+1}))},back:function(){f||a((function(t){return t-1}))},reset:function(){return a(i.current)},set:function(t){return"first"===t?a(i.current):"last"===t||t>=n?a(n):t<=1?a(1):void a(t)}}};
|
|
3
3
|
//# sourceMappingURL=useStep.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
"use strict";var e=require("../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
"use strict";var e=require("../../_rollupPluginBabelHelpers-BvBejAnn.js"),t=require("react"),n=require("../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js");require("../../utils/helpers/isClient.js");var r=function(e){return window.dispatchEvent(new StorageEvent("storage",e))},i=function(e,t,n){var i=e.getItem(t);e.setItem(t,n),r({key:t,oldValue:i,newValue:n,storageArea:e})},u=function(e,t){var n=e.getItem(t);e.removeItem(t),r({key:t,oldValue:n,newValue:null,storageArea:e})},o=function(e,t,n){var r=e.getItem(t);if(r)return n(r)},a=function(e){return window.addEventListener("storage",e),function(){return window.removeEventListener("storage",e)}};exports.dispatchStorageEvent=r,exports.useStorage=function(r,s){var l,c="object"===e._typeof(s)?s:void 0,f=c?null==c?void 0:c.initialValue:s,d=null!==(l=null==c?void 0:c.storage)&&void 0!==l?l:window.localStorage,v=function(e){return null!=c&&c.serializer?c.serializer(e):JSON.stringify(e)},g=function(e){if(null!=c&&c.deserializer)return c.deserializer(e);if("undefined"!==e)try{return JSON.parse(e)}catch(t){return e}},p=t.useSyncExternalStore(a,(function(){return o(d,r,g)}),(function(){return function(e){return e instanceof Function?e():e}(f)}));n.useIsomorphicLayoutEffect((function(){(void 0===o(d,r,g)||f)&&i(d,r,v(f instanceof Function?f():f))}),[r]);return[p,function(e){if(null===e)return u(d,r);i(d,r,v(e))},function(){return u(d,r)}]};
|
|
3
3
|
//# sourceMappingURL=useStorage.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
"use strict";var e=require("../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
"use strict";var e=require("../../_rollupPluginBabelHelpers-BvBejAnn.js"),r=require("react"),u=require("../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js");require("../../utils/helpers/isClient.js"),exports.useTimeout=function(t,c){var i=r.useState(!1),s=e._slicedToArray(i,2),o=s[0],n=s[1],f=r.useRef(t),a=r.useRef();return u.useIsomorphicLayoutEffect((function(){f.current=t}),[t]),r.useEffect((function(){return a.current=setTimeout((function(){f.current(),n(!0)}),c),function(){clearTimeout(a.current)}}),[c]),{ready:o,clear:function(){clearTimeout(a.current),n(!0)}}};
|
|
3
3
|
//# sourceMappingURL=useTimeout.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
"use strict";var e=require("../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
"use strict";var e=require("../../_rollupPluginBabelHelpers-BvBejAnn.js"),r=require("react");exports.useToggle=function(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[!1,!0],n=r.useReducer((function(e,r){var i=r instanceof Function?r(e[0]):r,n=Math.abs(e.indexOf(i));return e.slice(n).concat(e.slice(0,n))}),i),c=e._slicedToArray(n,2);return[e._slicedToArray(c[0],1)[0],c[1]]};
|
|
3
3
|
//# sourceMappingURL=useToggle.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
2
|
"use strict";var e=require("react");exports.useUnmount=function(r){var t=e.useRef(r);t.current=r,e.useEffect((function(){return function(){t.current()}}),[])};
|
|
3
3
|
//# sourceMappingURL=useUnmount.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
2
|
"use strict";var e=require("../useEventListener/useEventListener.js");require("react");exports.useWindowEvent=function(r,t,n){return e.useEventListener(window,r,t,n)};
|
|
3
3
|
//# sourceMappingURL=useWindowEvent.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
"use strict";var i=require("../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
"use strict";var i=require("../../_rollupPluginBabelHelpers-BvBejAnn.js"),e=require("react"),n=require("../../utils/helpers/isClient.js"),t=require("../useEventListener/useEventListener.js");exports.useWindowSize=function(r){var s,u,l=e.useState({width:n.isClient?window.innerWidth:null!==(s=null==r?void 0:r.initialWidth)&&void 0!==s?s:Number.POSITIVE_INFINITY,height:n.isClient?window.innerHeight:null!==(u=null==r?void 0:r.initialWidth)&&void 0!==u?u:Number.POSITIVE_INFINITY}),d=i._slicedToArray(l,2),o=d[0],h=d[1];return t.useEventListener(window,"resize",(function(){h({width:window.innerWidth,height:window.innerHeight})})),o};
|
|
3
3
|
//# sourceMappingURL=useWindowSize.js.map
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
"use strict";var e=require("./hooks/useBattery/useBattery.js"),s=require("./hooks/useBoolean/useBoolean.js"),u=require("./hooks/useClickOutside/useClickOutside.js"),o=require("./hooks/useCopyToClipboard/useCopyToClipboard.js"),r=require("./hooks/useCounter/useCounter.js"),t=require("./hooks/useDebouncedValue/useDebouncedValue.js"),i=require("./hooks/useDefault/useDefault.js"),n=require("./hooks/useDidUpdate/useDidUpdate.js"),p=require("./hooks/useDocumentTitle/useDocumentTitle.js"),a=require("./hooks/useDocumentVisibility/useDocumentVisibility.js"),l=require("./hooks/useEventListener/useEventListener.js"),
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
"use strict";var e=require("./hooks/useBattery/useBattery.js"),s=require("./hooks/useBoolean/useBoolean.js"),u=require("./hooks/useClickOutside/useClickOutside.js"),o=require("./hooks/useCopyToClipboard/useCopyToClipboard.js"),r=require("./hooks/useCounter/useCounter.js"),t=require("./hooks/useDebouncedValue/useDebouncedValue.js"),i=require("./hooks/useDefault/useDefault.js"),n=require("./hooks/useDidUpdate/useDidUpdate.js"),p=require("./hooks/useDocumentTitle/useDocumentTitle.js"),a=require("./hooks/useDocumentVisibility/useDocumentVisibility.js"),l=require("./hooks/useEvent/useEvent.js"),h=require("./hooks/useEventListener/useEventListener.js"),k=require("./hooks/useFavicon/useFavicon.js"),d=require("./hooks/useHash/useHash.js"),q=require("./hooks/useHotkeys/useHotkeys.js"),c=require("./hooks/useHover/useHover.js"),j=require("./hooks/useIdle/useIdle.js"),x=require("./hooks/useIntersectionObserver/useIntersectionObserver.js"),y=require("./hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js"),S=require("./hooks/useKeyPress/useKeyPress.js"),g=require("./hooks/useKeyPressEvent/useKeyPressEvent.js"),v=require("./hooks/useKeysPressed/useKeysPressed.js"),T=require("./hooks/useLocalStorage/useLocalStorage.js"),C=require("./hooks/useLogger/useLogger.js"),E=require("./hooks/useMediaQuery/useMediaQuery.js"),m=require("./hooks/useMount/useMount.js"),O=require("./hooks/useNetwork/useNetwork.js"),b=require("./hooks/useOnline/useOnline.js"),D=require("./hooks/useOperatingSystem/useOperatingSystem.js"),P=require("./hooks/useOrientation/useOrientation.js"),I=require("./hooks/usePrevious/usePrevious.js"),L=require("./hooks/useQueue/useQueue.js"),H=require("./hooks/useRenderCount/useRenderCount.js"),w=require("./hooks/useRerender/useRerender.js"),M=require("./hooks/useScript/useScript.js"),f=require("./hooks/useSessionStorage/useSessionStorage.js"),K=require("./hooks/useSet/useSet.js"),R=require("./hooks/useStep/useStep.js"),U=require("./hooks/useStorage/useStorage.js"),B=require("./hooks/useTimeout/useTimeout.js"),Q=require("./hooks/useToggle/useToggle.js"),V=require("./hooks/useUnmount/useUnmount.js"),W=require("./hooks/useWindowEvent/useWindowEvent.js"),_=require("./hooks/useWindowSize/useWindowSize.js");require("./_rollupPluginBabelHelpers-BvBejAnn.js"),require("react"),require("./utils/helpers/debounce.js"),require("./utils/helpers/isClient.js"),require("./hooks/useMutationObserver.js"),require("./utils/helpers/throttle.js"),require("./utils/helpers/isShallowEqual.js"),exports.useBattery=e.useBattery,exports.useBoolean=s.useBoolean,exports.useClickOutside=u.useClickOutside,exports.legacyCopyToClipboard=o.legacyCopyToClipboard,exports.useCopyToClipboard=o.useCopyToClipboard,exports.useCounter=r.useCounter,exports.useDebouncedValue=t.useDebouncedValue,exports.useDefault=i.useDefault,exports.useDidUpdate=n.useDidUpdate,exports.useDocumentTitle=p.useDocumentTitle,exports.useDocumentVisibility=a.useDocumentVisibility,exports.useEvent=l.useEvent,exports.useEventListener=h.useEventListener,exports.useFavicon=k.useFavicon,exports.useHash=d.useHash,exports.isHotkeyMatch=q.isHotkeyMatch,exports.useHotkeys=q.useHotkeys,exports.useHover=c.useHover,exports.useIdle=j.useIdle,exports.useIntersectionObserver=x.useIntersectionObserver,exports.useIsomorphicLayoutEffect=y.useIsomorphicLayoutEffect,exports.useKeyPress=S.useKeyPress,exports.useKeyPressEvent=g.useKeyPressEvent,exports.useKeysPressed=v.useKeysPressed,exports.useLocalStorage=T.useLocalStorage,exports.useLogger=C.useLogger,exports.useMediaQuery=E.useMediaQuery,exports.useMount=m.useMount,exports.getConnection=O.getConnection,exports.useNetwork=O.useNetwork,exports.useOnline=b.useOnline,exports.getOperatingSystem=D.getOperatingSystem,exports.useOperatingSystem=D.useOperatingSystem,exports.useOrientation=P.useOrientation,exports.usePrevious=I.usePrevious,exports.useQueue=L.useQueue,exports.useRenderCount=H.useRenderCount,exports.useRerender=w.useRerender,exports.SCRIPT_STATUS_ATTRIBUTE_NAME=M.SCRIPT_STATUS_ATTRIBUTE_NAME,exports.useScript=M.useScript,exports.useSessionStorage=f.useSessionStorage,exports.useSet=K.useSet,exports.useStep=R.useStep,exports.dispatchStorageEvent=U.dispatchStorageEvent,exports.useStorage=U.useStorage,exports.useTimeout=B.useTimeout,exports.useToggle=Q.useToggle,exports.useUnmount=V.useUnmount,exports.useWindowEvent=W.useWindowEvent,exports.useWindowSize=_.useWindowSize;
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
2
|
"use strict";exports.debounce=function(e,r){var t;return function(){for(var n=arguments.length,o=new Array(n),u=0;u<n;u++)o[u]=arguments[u];clearTimeout(t),t=setTimeout((function(){return e.apply(void 0,o)}),r)}};
|
|
3
3
|
//# sourceMappingURL=debounce.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
2
|
"use strict";var e=require("./debounce.js"),t=require("./isClient.js"),r=require("./isShallowEqual.js"),s=require("./throttle.js");exports.debounce=e.debounce,exports.isClient=t.isClient,exports.isShallowEqual=r.isShallowEqual,exports.throttle=s.throttle;
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
2
|
"use strict";var e,n,d=!("undefined"==typeof window||null===(e=window)||void 0===e||!e.document||null===(n=window)||void 0===n||null===(n=n.document)||void 0===n||!n.createElement);exports.isClient=d;
|
|
3
3
|
//# sourceMappingURL=isClient.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
2
|
"use strict";exports.isShallowEqual=function(e,r){var t=Object.keys(e),n=Object.keys(r);if(t.length!==n.length)return!1;for(var l=0,s=t;l<s.length;l++){var u=s[l];if(e[u]!==r[u])return!1}return!0};
|
|
3
3
|
//# sourceMappingURL=isShallowEqual.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
2
|
"use strict";exports.throttle=function(t,n){var o=!1;return function(){o||(t.apply(void 0,arguments),o=!0,setTimeout((function(){o=!1}),n))}};
|
|
3
3
|
//# sourceMappingURL=throttle.js.map
|
package/dist/esm/{_rollupPluginBabelHelpers-Cg3Jntln.js → _rollupPluginBabelHelpers-D5_r4iwW.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
function t(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function r(r){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?t(Object(n),!0).forEach((function(t){c(r,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))}))}return r}function e(){e=function(){return r};var t,r={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(t){l=function(t,r,e){return t[r]=e}}function s(t,r,e,n){var o=r&&r.prototype instanceof g?r:g,a=Object.create(o.prototype),c=new N(n||[]);return i(a,"_invoke",{value:P(t,e,c)}),a}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=s;var y="suspendedStart",p="suspendedYield",v="executing",d="completed",m={};function g(){}function b(){}function w(){}var O={};l(O,c,(function(){return this}));var j=Object.getPrototypeOf,E=j&&j(j(T([])));E&&E!==n&&o.call(E,c)&&(O=E);var L=w.prototype=g.prototype=Object.create(O);function x(t){["next","throw","return"].forEach((function(r){l(t,r,(function(t){return this._invoke(r,t)}))}))}function S(t,r){function e(n,i,a,c){var u=h(t[n],t,i);if("throw"!==u.type){var f=u.arg,l=f.value;return l&&"object"==typeof l&&o.call(l,"__await")?r.resolve(l.__await).then((function(t){e("next",t,a,c)}),(function(t){e("throw",t,a,c)})):r.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return e("throw",t,a,c)}))}c(u.arg)}var n;i(this,"_invoke",{value:function(t,o){function i(){return new r((function(r,n){e(t,o,r,n)}))}return n=n?n.then(i,i):i()}})}function P(r,e,n){var o=y;return function(i,a){if(o===v)throw new Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=_(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var f=h(r,e,n);if("normal"===f.type){if(o=n.done?d:p,f.arg===m)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=d,n.method="throw",n.arg=f.arg)}}}function _(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,_(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=h(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,m;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,m):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function A(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function k(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function T(r){if(r||""===r){var e=r[c];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var n=-1,i=function e(){for(;++n<r.length;)if(o.call(r,n))return e.value=r[n],e.done=!1,e;return e.value=t,e.done=!0,e};return i.next=i}}throw new TypeError(typeof r+" is not iterable")}return b.prototype=w,i(L,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:b,configurable:!0}),b.displayName=l(w,f,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===b||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,f,"GeneratorFunction")),t.prototype=Object.create(L),t},r.awrap=function(t){return{__await:t}},x(S.prototype),l(S.prototype,u,(function(){return this})),r.AsyncIterator=S,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new S(s(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(L),l(L,f,"Generator"),l(L,c,(function(){return this})),l(L,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=T,N.prototype={constructor:N,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!r)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function n(n,o){return c.type="throw",c.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),f=o.call(a,"finallyLoc");if(u&&f){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),m},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),k(e),m}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;k(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:T(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),m}},r}function n(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:String(r)}function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function i(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function a(t){return function(){var r=this,e=arguments;return new Promise((function(n,o){var a=t.apply(r,e);function c(t){i(a,n,o,c,u,"next",t)}function u(t){i(a,n,o,c,u,"throw",t)}c(void 0)}))}}function c(t,r,e){return(r=n(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function u(t,r){return
|
|
3
|
-
//# sourceMappingURL=_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
function t(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function r(r){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?t(Object(n),!0).forEach((function(t){c(r,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))}))}return r}function e(){e=function(){return r};var t,r={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(t){l=function(t,r,e){return t[r]=e}}function s(t,r,e,n){var o=r&&r.prototype instanceof g?r:g,a=Object.create(o.prototype),c=new N(n||[]);return i(a,"_invoke",{value:P(t,e,c)}),a}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=s;var y="suspendedStart",p="suspendedYield",v="executing",d="completed",m={};function g(){}function b(){}function w(){}var O={};l(O,c,(function(){return this}));var j=Object.getPrototypeOf,E=j&&j(j(T([])));E&&E!==n&&o.call(E,c)&&(O=E);var L=w.prototype=g.prototype=Object.create(O);function x(t){["next","throw","return"].forEach((function(r){l(t,r,(function(t){return this._invoke(r,t)}))}))}function S(t,r){function e(n,i,a,c){var u=h(t[n],t,i);if("throw"!==u.type){var f=u.arg,l=f.value;return l&&"object"==typeof l&&o.call(l,"__await")?r.resolve(l.__await).then((function(t){e("next",t,a,c)}),(function(t){e("throw",t,a,c)})):r.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return e("throw",t,a,c)}))}c(u.arg)}var n;i(this,"_invoke",{value:function(t,o){function i(){return new r((function(r,n){e(t,o,r,n)}))}return n=n?n.then(i,i):i()}})}function P(r,e,n){var o=y;return function(i,a){if(o===v)throw new Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=_(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var f=h(r,e,n);if("normal"===f.type){if(o=n.done?d:p,f.arg===m)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=d,n.method="throw",n.arg=f.arg)}}}function _(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,_(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=h(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,m;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,m):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function A(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function k(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function T(r){if(r||""===r){var e=r[c];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var n=-1,i=function e(){for(;++n<r.length;)if(o.call(r,n))return e.value=r[n],e.done=!1,e;return e.value=t,e.done=!0,e};return i.next=i}}throw new TypeError(typeof r+" is not iterable")}return b.prototype=w,i(L,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:b,configurable:!0}),b.displayName=l(w,f,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===b||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,f,"GeneratorFunction")),t.prototype=Object.create(L),t},r.awrap=function(t){return{__await:t}},x(S.prototype),l(S.prototype,u,(function(){return this})),r.AsyncIterator=S,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new S(s(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(L),l(L,f,"Generator"),l(L,c,(function(){return this})),l(L,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=T,N.prototype={constructor:N,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!r)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function n(n,o){return c.type="throw",c.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),f=o.call(a,"finallyLoc");if(u&&f){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),m},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),k(e),m}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;k(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:T(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),m}},r}function n(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:String(r)}function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function i(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function a(t){return function(){var r=this,e=arguments;return new Promise((function(n,o){var a=t.apply(r,e);function c(t){i(a,n,o,c,u,"next",t)}function u(t){i(a,n,o,c,u,"throw",t)}c(void 0)}))}}function c(t,r,e){return(r=n(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function u(t,r){return s(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,c=[],u=!0,f=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=i.call(e)).done)&&(c.push(n.value),c.length!==r);u=!0);}catch(t){f=!0,o=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(f)throw o}}return c}}(t,r)||y(t,r)||v()}function f(t){return s(t)||h(t)||y(t)||v()}function l(t){return function(t){if(Array.isArray(t))return p(t)}(t)||h(t)||y(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t){if(Array.isArray(t))return t}function h(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function y(t,r){if(t){if("string"==typeof t)return p(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?p(t,r):void 0}}function p(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function v(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}export{u as _,o as a,r as b,l as c,f as d,a as e,e as f};
|
|
3
|
+
//# sourceMappingURL=_rollupPluginBabelHelpers-D5_r4iwW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_rollupPluginBabelHelpers-D5_r4iwW.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/esm/hooks/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
export{useBattery}from"./useBattery/useBattery.js";export{useBoolean}from"./useBoolean/useBoolean.js";export{useClickOutside}from"./useClickOutside/useClickOutside.js";export{legacyCopyToClipboard,useCopyToClipboard}from"./useCopyToClipboard/useCopyToClipboard.js";export{useCounter}from"./useCounter/useCounter.js";export{useDebouncedValue}from"./useDebouncedValue/useDebouncedValue.js";export{useDefault}from"./useDefault/useDefault.js";export{useDidUpdate}from"./useDidUpdate/useDidUpdate.js";export{useDocumentTitle}from"./useDocumentTitle/useDocumentTitle.js";export{useDocumentVisibility}from"./useDocumentVisibility/useDocumentVisibility.js";export{useEventListener}from"./useEventListener/useEventListener.js";export{useFavicon}from"./useFavicon/useFavicon.js";export{useHash}from"./useHash/useHash.js";export{useHover}from"./useHover/useHover.js";export{useIdle}from"./useIdle/useIdle.js";export{useIsomorphicLayoutEffect}from"./useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";export{useKeyPress}from"./useKeyPress/useKeyPress.js";export{useKeyPressEvent}from"./useKeyPressEvent/useKeyPressEvent.js";export{useKeysPressed}from"./useKeysPressed/useKeysPressed.js";export{useLocalStorage}from"./useLocalStorage/useLocalStorage.js";export{useLogger}from"./useLogger/useLogger.js";export{useMediaQuery}from"./useMediaQuery/useMediaQuery.js";export{useMount}from"./useMount/useMount.js";export{getConnection,useNetwork}from"./useNetwork/useNetwork.js";export{useOnline}from"./useOnline/useOnline.js";export{getOperatingSystem,useOperatingSystem}from"./useOperatingSystem/useOperatingSystem.js";export{useOrientation}from"./useOrientation/useOrientation.js";export{usePrevious}from"./usePrevious/usePrevious.js";export{useRenderCount}from"./useRenderCount/useRenderCount.js";export{useRerender}from"./useRerender/useRerender.js";export{SCRIPT_STATUS_ATTRIBUTE_NAME,useScript}from"./useScript/useScript.js";export{useSessionStorage}from"./useSessionStorage/useSessionStorage.js";export{useSet}from"./useSet/useSet.js";export{useStep}from"./useStep/useStep.js";export{dispatchStorageEvent,useStorage}from"./useStorage/useStorage.js";export{useTimeout}from"./useTimeout/useTimeout.js";export{useToggle}from"./useToggle/useToggle.js";export{useUnmount}from"./useUnmount/useUnmount.js";export{useWindowEvent}from"./useWindowEvent/useWindowEvent.js";export{useWindowSize}from"./useWindowSize/useWindowSize.js";import"../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
export{useBattery}from"./useBattery/useBattery.js";export{useBoolean}from"./useBoolean/useBoolean.js";export{useClickOutside}from"./useClickOutside/useClickOutside.js";export{legacyCopyToClipboard,useCopyToClipboard}from"./useCopyToClipboard/useCopyToClipboard.js";export{useCounter}from"./useCounter/useCounter.js";export{useDebouncedValue}from"./useDebouncedValue/useDebouncedValue.js";export{useDefault}from"./useDefault/useDefault.js";export{useDidUpdate}from"./useDidUpdate/useDidUpdate.js";export{useDocumentTitle}from"./useDocumentTitle/useDocumentTitle.js";export{useDocumentVisibility}from"./useDocumentVisibility/useDocumentVisibility.js";export{useEvent}from"./useEvent/useEvent.js";export{useEventListener}from"./useEventListener/useEventListener.js";export{useFavicon}from"./useFavicon/useFavicon.js";export{useHash}from"./useHash/useHash.js";export{isHotkeyMatch,useHotkeys}from"./useHotkeys/useHotkeys.js";export{useHover}from"./useHover/useHover.js";export{useIdle}from"./useIdle/useIdle.js";export{useIntersectionObserver}from"./useIntersectionObserver/useIntersectionObserver.js";export{useIsomorphicLayoutEffect}from"./useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";export{useKeyPress}from"./useKeyPress/useKeyPress.js";export{useKeyPressEvent}from"./useKeyPressEvent/useKeyPressEvent.js";export{useKeysPressed}from"./useKeysPressed/useKeysPressed.js";export{useLocalStorage}from"./useLocalStorage/useLocalStorage.js";export{useLogger}from"./useLogger/useLogger.js";export{useMediaQuery}from"./useMediaQuery/useMediaQuery.js";export{useMount}from"./useMount/useMount.js";export{getConnection,useNetwork}from"./useNetwork/useNetwork.js";export{useOnline}from"./useOnline/useOnline.js";export{getOperatingSystem,useOperatingSystem}from"./useOperatingSystem/useOperatingSystem.js";export{useOrientation}from"./useOrientation/useOrientation.js";export{usePrevious}from"./usePrevious/usePrevious.js";export{useQueue}from"./useQueue/useQueue.js";export{useRenderCount}from"./useRenderCount/useRenderCount.js";export{useRerender}from"./useRerender/useRerender.js";export{SCRIPT_STATUS_ATTRIBUTE_NAME,useScript}from"./useScript/useScript.js";export{useSessionStorage}from"./useSessionStorage/useSessionStorage.js";export{useSet}from"./useSet/useSet.js";export{useStep}from"./useStep/useStep.js";export{dispatchStorageEvent,useStorage}from"./useStorage/useStorage.js";export{useTimeout}from"./useTimeout/useTimeout.js";export{useToggle}from"./useToggle/useToggle.js";export{useUnmount}from"./useUnmount/useUnmount.js";export{useWindowEvent}from"./useWindowEvent/useWindowEvent.js";export{useWindowSize}from"./useWindowSize/useWindowSize.js";import"../_rollupPluginBabelHelpers-D5_r4iwW.js";import"react";import"../utils/helpers/debounce.js";import"../utils/helpers/isClient.js";import"./useMutationObserver.js";import"../utils/helpers/throttle.js";import"../utils/helpers/isShallowEqual.js";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e,b as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
import{_ as e,b as n}from"../../_rollupPluginBabelHelpers-D5_r4iwW.js";import i from"react";var r=function(){var r=i.useState({supported:!1,loading:!0,level:0,charging:!1,chargingTime:0,dischargingTime:0}),t=e(r,2),a=t[0],g=t[1];return i.useEffect((function(){var e;if(!(navigator&&"getBattery"in navigator&&"function"==typeof navigator.getBattery))return g(n(n({},a),{},{loading:!1}));var i=function(){var n,i,r,t;return g({supported:!0,loading:!0,level:(null===(n=e)||void 0===n?void 0:n.level)||0,charging:(null===(i=e)||void 0===i?void 0:i.charging)||!1,dischargingTime:(null===(r=e)||void 0===r?void 0:r.dischargingTime)||0,chargingTime:(null===(t=e)||void 0===t?void 0:t.chargingTime)||0})};return navigator.getBattery().then((function(n){e=n,i(),n.addEventListener("levelchange",i),n.addEventListener("chargingchange",i),n.addEventListener("chargingtimechange",i),n.addEventListener("dischargingtimechange",i)})),function(){e&&(e.removeEventListener("levelchange",i),e.removeEventListener("chargingchange",i),e.removeEventListener("chargingtimechange",i),e.removeEventListener("dischargingtimechange",i))}}),[]),a};export{r as useBattery};
|
|
3
3
|
//# sourceMappingURL=useBattery.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-D5_r4iwW.js";import t from"react";var n=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=t.useState(n),o=r(e,2),u=o[0],l=o[1];return[u,function(r){return l((function(t){return null!=r?r:!t}))}]};export{n as useBoolean};
|
|
3
3
|
//# sourceMappingURL=useBoolean.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import t from"react";import{useIsomorphicLayoutEffect as e}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var n=function(t){return"function"==typeof t?t():t instanceof Element?t:t.current},r=function(){var r=void 0===(arguments.length<=1?void 0:arguments[1])
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
import t from"react";import{useIsomorphicLayoutEffect as e}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var n=function(t){return"function"==typeof t?t():t instanceof Element?t:t.current},r=function(){var r=void 0===(arguments.length<=1?void 0:arguments[1])||arguments.length<=0?void 0:arguments[0],o=(arguments.length<=1?void 0:arguments[1])?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],u=t.useRef(null),i=t.useRef(o);if(e((function(){i.current=o}),[o]),t.useEffect((function(){var t=function(t){if(Array.isArray(r)){if(!r.length)return;r.forEach((function(e){var r=n(e);r&&!r.contains(t.target)&&i.current(t)}))}else{var e=r?n(r):u.current;e&&!e.contains(t.target)&&i.current(t)}};return document.addEventListener("mousedown",t),document.addEventListener("touchstart",t),function(){document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t)}}),[]),!r)return u};export{r as useClickOutside};
|
|
3
3
|
//# sourceMappingURL=useClickOutside.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useClickOutside.js","sources":["../../../../src/hooks/useClickOutside/useClickOutside.ts"],"sourcesContent":["import React from 'react';\n\nimport { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect';\n\n// composedPath что это такое\n\ntype UseClickOutsideTarget = React.RefObject<Element | null> | (() => Element) | Element;\n\nconst getElement = (target: UseClickOutsideTarget) => {\n if (typeof target === 'function') {\n return target();\n }\n\n if (target instanceof Element) {\n return target;\n }\n\n return target.current;\n};\n\nexport type UseClickOutsideReturn
|
|
1
|
+
{"version":3,"file":"useClickOutside.js","sources":["../../../../src/hooks/useClickOutside/useClickOutside.ts"],"sourcesContent":["import React from 'react';\n\nimport { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect';\n\n// composedPath что это такое\n\ntype UseClickOutsideTarget = React.RefObject<Element | null> | (() => Element) | Element;\n\nconst getElement = (target: UseClickOutsideTarget) => {\n if (typeof target === 'function') {\n return target();\n }\n\n if (target instanceof Element) {\n return target;\n }\n\n return target.current;\n};\n\nexport type UseClickOutsideReturn<Target extends UseClickOutsideTarget | UseClickOutsideTarget[]> =\n React.RefObject<Target>;\n\nexport type UseClickOutside = {\n <Target extends UseClickOutsideTarget | UseClickOutsideTarget[]>(\n target: Target,\n callback: (event: Event) => void\n ): void;\n\n <Target extends UseClickOutsideTarget | UseClickOutsideTarget[]>(\n callback: (event: Event) => void,\n target?: never\n ): UseClickOutsideReturn<Target>;\n};\n\nexport const useClickOutside = ((...params: any[]) => {\n const target = (typeof params[1] === 'undefined' ? undefined : params[0]) as\n | UseClickOutsideTarget\n | Array<UseClickOutsideTarget>\n | undefined;\n const callback = (params[1] ? params[1] : params[0]) as (event: Event) => void;\n\n const internalRef = React.useRef<Element>(null);\n const internalCallbackRef = React.useRef(callback);\n\n useIsomorphicLayoutEffect(() => {\n internalCallbackRef.current = callback;\n }, [callback]);\n\n React.useEffect(() => {\n const handler = (event: Event) => {\n if (Array.isArray(target)) {\n if (!target.length) return;\n\n target.forEach((target) => {\n const element = getElement(target);\n\n if (element && !element.contains(event.target as Node)) {\n internalCallbackRef.current(event);\n }\n });\n\n return;\n }\n\n const element = target ? getElement(target) : internalRef.current;\n\n if (element && !element.contains(event.target as Node)) {\n internalCallbackRef.current(event);\n }\n };\n\n document.addEventListener('mousedown', handler);\n document.addEventListener('touchstart', handler);\n\n return () => {\n document.removeEventListener('mousedown', handler);\n document.removeEventListener('touchstart', handler);\n };\n }, []);\n\n if (target) return;\n return internalRef;\n}) as UseClickOutside;\n"],"names":["getElement","target","Element","current","useClickOutside","arguments","length","undefined","callback","internalRef","React","useRef","internalCallbackRef","useIsomorphicLayoutEffect","useEffect","handler","event","Array","isArray","forEach","element","contains","document","addEventListener","removeEventListener"],"mappings":";mKAQA,IAAMA,EAAa,SAACC,GAClB,MAAsB,mBAAXA,EACFA,IAGLA,aAAkBC,QACbD,EAGFA,EAAOE,OAChB,EAiBaC,EAAmB,WAC9B,IAAMH,OAA+B,KAArBI,UAAAC,QAAA,OAAAC,EAAAF,UAAA,KAA4CA,UAAAC,QAAAC,OAATA,EAASF,UAG/C,GACPG,GAAYH,UAAAC,QAAA,OAAAC,EAAAF,UAAA,IAAAA,UAAAC,QAAAC,OAAAA,EAAAF,UAAAA,GAAAA,UAAAC,QAAAC,OAAAA,EAAAF,UAA4D,GAExEI,EAAcC,EAAMC,OAAgB,MACpCC,EAAsBF,EAAMC,OAAOH,GAsCzC,GApCAK,GAA0B,WACxBD,EAAoBT,QAAUK,CAChC,GAAG,CAACA,IAEJE,EAAMI,WAAU,WACd,IAAMC,EAAU,SAACC,GACf,GAAIC,MAAMC,QAAQjB,GAAlB,CACE,IAAKA,EAAOK,OAAQ,OAEpBL,EAAOkB,SAAQ,SAAClB,GACd,IAAMmB,EAAUpB,EAAWC,GAEvBmB,IAAYA,EAAQC,SAASL,EAAMf,SACrCW,EAAoBT,QAAQa,EAEhC,GAGF,KAZA,CAcA,IAAMI,EAAUnB,EAASD,EAAWC,GAAUQ,EAAYN,QAEtDiB,IAAYA,EAAQC,SAASL,EAAMf,SACrCW,EAAoBT,QAAQa,EAL9B,GAYF,OAHAM,SAASC,iBAAiB,YAAaR,GACvCO,SAASC,iBAAiB,aAAcR,GAEjC,WACLO,SAASE,oBAAoB,YAAaT,GAC1CO,SAASE,oBAAoB,aAAcT,GAE9C,GAAE,KAECd,EACJ,OAAOQ,CACT"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e,
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
import{_ as e,e as r,f as t}from"../../_rollupPluginBabelHelpers-D5_r4iwW.js";import a from"react";var n=function(e){var r=document.createElement("textarea");r.value=e,document.body.appendChild(r),r.select(),document.execCommand("copy"),document.body.removeChild(r)},o=function(){var o=a.useState(null),c=e(o,2),u=c[0],l=c[1],i=a.useCallback(function(){var e=r(t().mark((function e(r){var a;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,null===(a=navigator)||void 0===a||null===(a=a.clipboard)||void 0===a||!a.writeText){e.next=7;break}return e.next=4,navigator.clipboard.writeText(r);case 4:l(r),e.next=8;break;case 7:throw new Error("writeText not supported");case 8:e.next=14;break;case 10:e.prev=10,e.t0=e.catch(0),n(r),l(r);case 14:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(r){return e.apply(this,arguments)}}(),[]);return{value:u,copy:i}};export{n as legacyCopyToClipboard,o as useCopyToClipboard};
|
|
3
3
|
//# sourceMappingURL=useCopyToClipboard.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as n}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
import{_ as n}from"../../_rollupPluginBabelHelpers-D5_r4iwW.js";import t from"react";var e=function(){var e,o,i,u="number"==typeof(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:null===(e=arguments.length<=0?void 0:arguments[0])||void 0===e?void 0:e.initialValue,r="number"==typeof(arguments.length<=0?void 0:arguments[0])?null!==(o=arguments.length<=1?void 0:arguments[1])&&void 0!==o?o:{}:null!==(i=arguments.length<=0?void 0:arguments[0])&&void 0!==i?i:{},l=r.max,a=void 0===l?Number.POSITIVE_INFINITY:l,m=r.min,f=void 0===m?Number.NEGATIVE_INFINITY:m,v=t.useState(null!=u?u:0),d=n(v,2),c=d[0],h=d[1];t.useEffect((function(){}),[f,a]);return{count:c,set:function(n){h((function(t){return Math.max(f,Math.min(a,"number"==typeof n?n:n(t)))}))},inc:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;h((function(t){return"number"==typeof a&&c===a?t:Math.max(Math.min(a,t+n),f)}))},dec:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;h((function(t){return"number"==typeof f&&t===f?t:Math.min(Math.max(f,t-n),a)}))},reset:function(){var n=null!=u?u:0;return"number"==typeof a&&n>a?h(a):"number"==typeof f&&n<f?h(f):void h(n)}}};export{e as useCounter};
|
|
3
3
|
//# sourceMappingURL=useCounter.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-D5_r4iwW.js";import r from"react";import{debounce as t}from"../../utils/helpers/debounce.js";import"../../utils/helpers/isClient.js";var o=function(o,u,n){console.log("@",n);var s=r.useRef(o),i=r.useState(o),l=e(i,2),c=l[0],f=l[1],p=r.useMemo((function(){return t((function(e){return f(e)}),u)}),[u]);return r.useEffect((function(){s.current!==o&&(p(o),s.current=o)}),[o]),[c,p]};export{o as useDebouncedValue};
|
|
3
3
|
//# sourceMappingURL=useDebouncedValue.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as r}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
import{_ as r}from"../../_rollupPluginBabelHelpers-D5_r4iwW.js";import e from"react";var t=function(t,l){var o=e.useState(t),a=r(o,2),u=a[0];return[null==u?l:u,a[1]]};export{t as useDefault};
|
|
3
3
|
//# sourceMappingURL=useDefault.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
2
|
import r from"react";import{useIsomorphicLayoutEffect as t}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var o=function(o,e){var i=r.useRef(!0);t((function(){if(!i.current){var r=o();return r&&"function"==typeof r?r:void 0}i.current=!1}),e)};export{o as useDidUpdate};
|
|
3
3
|
//# sourceMappingURL=useDidUpdate.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as t}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
import{_ as t}from"../../_rollupPluginBabelHelpers-D5_r4iwW.js";import e from"react";import{useIsomorphicLayoutEffect as o}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import{useMutationObserver as n}from"../useMutationObserver.js";import"../../utils/helpers/isClient.js";function r(r,u){var i=e.useRef(document.title),c=e.useState(null!=r?r:document.title),l=t(c,2),m=l[0],s=l[1];n((function(){document&&document.title!==m&&s(document.title)}),{childList:!0},document.head.querySelector("title")),o((function(){if(null!=u&&u.restoreOnUnmount)return function(){document.title=i.current}}),[]);var f=function(t){var e=t.trim();e.length>0&&(document.title=e)};return o((function(){"string"==typeof r&&f(r)}),[r]),[m,f]}export{r as useDocumentTitle};
|
|
3
3
|
//# sourceMappingURL=useDocumentTitle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentTitle.js","sources":["../../../../src/hooks/useDocumentTitle/useDocumentTitle.ts"],"sourcesContent":["import React from 'react';\n\nimport { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect';\nimport { useMutationObserver } from '../useMutationObserver';\n\n/** The use document title options
|
|
1
|
+
{"version":3,"file":"useDocumentTitle.js","sources":["../../../../src/hooks/useDocumentTitle/useDocumentTitle.ts"],"sourcesContent":["import React from 'react';\n\nimport { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect';\nimport { useMutationObserver } from '../useMutationObserver';\n\n/** The use document title options */\nexport interface UseDocumentTitleOptions {\n /** Restore the previous title on unmount */\n restoreOnUnmount?: boolean;\n}\n\n/** The use document title return type */\nexport type UseDocumentTitleReturn = [\n /** The current title */\n title: string,\n\n /** Function to update the title */\n setTitle: (title: string) => void\n];\n\n/**\n * @name useDocumentTitle\n * @description - Hook that manages the document title and allows updating it\n *\n * @param {string} [value] The initial title. If not provided, the current document title will be used\n * @param {boolean} [options.restoreOnUnmount] Restore the previous title on unmount\n * @returns {UseDocumentTitleReturn} An array containing the current title and a function to update the title\n *\n * @example\n * const [title, setTitle] = useDocumentTitle();\n */\nexport function useDocumentTitle(\n value?: string,\n options?: UseDocumentTitleOptions\n): UseDocumentTitleReturn {\n const prevTitleRef = React.useRef(document.title);\n const [title, setTitle] = React.useState(value ?? document.title);\n\n useMutationObserver(\n () => {\n if (document && document.title !== title) {\n setTitle(document.title);\n }\n },\n { childList: true },\n document.head.querySelector('title')\n );\n\n useIsomorphicLayoutEffect(() => {\n if (options?.restoreOnUnmount) {\n return () => {\n document.title = prevTitleRef.current;\n };\n }\n }, []);\n\n const set = (value: string) => {\n const updatedValue = value.trim();\n if (updatedValue.length > 0) document.title = updatedValue;\n };\n\n useIsomorphicLayoutEffect(() => {\n if (typeof value !== 'string') return;\n set(value);\n }, [value]);\n\n return [title, set];\n}\n"],"names":["useDocumentTitle","value","options","prevTitleRef","React","useRef","document","title","_React$useState","useState","_React$useState2","_slicedToArray","setTitle","useMutationObserver","childList","head","querySelector","useIsomorphicLayoutEffect","restoreOnUnmount","current","set","updatedValue","trim","length"],"mappings":";mSA+BO,SAASA,EACdC,EACAC,GAEA,IAAMC,EAAeC,EAAMC,OAAOC,SAASC,OAC3CC,EAA0BJ,EAAMK,SAASR,QAAAA,EAASK,SAASC,OAAMG,EAAAC,EAAAH,EAAA,GAA1DD,EAAKG,EAAA,GAAEE,EAAQF,EAAA,GAEtBG,GACE,WACMP,UAAYA,SAASC,QAAUA,GACjCK,EAASN,SAASC,MAEtB,GACA,CAAEO,WAAW,GACbR,SAASS,KAAKC,cAAc,UAG9BC,GAA0B,WACxB,GAAIf,SAAAA,EAASgB,iBACX,OAAO,WACLZ,SAASC,MAAQJ,EAAagB,QAGnC,GAAE,IAEH,IAAMC,EAAM,SAACnB,GACX,IAAMoB,EAAepB,EAAMqB,OACvBD,EAAaE,OAAS,IAAGjB,SAASC,MAAQc,IAQhD,OALAJ,GAA0B,WACH,iBAAVhB,GACXmB,EAAInB,EACN,GAAG,CAACA,IAEG,CAACM,EAAOa,EACjB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import n from"react";var t=function(){return document.visibilityState},
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
import n from"react";var t=function(){return document.visibilityState},e=function(){return"hidden"},i=function(n){return document.addEventListener("visibilitychange",n),function(){document.removeEventListener("visibilitychange",n)}},r=function(){return n.useSyncExternalStore(i,t,e)};export{r as useDocumentVisibility};
|
|
3
3
|
//# sourceMappingURL=useDocumentVisibility.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentVisibility.js","sources":["../../../../src/hooks/useDocumentVisibility/useDocumentVisibility.ts"],"sourcesContent":["import React from 'react';\n\nconst getSnapshot = () => document.visibilityState;\nconst getServerSnapshot = (): DocumentVisibilityState => 'hidden';\nconst subscribe = (callback: () => void) => {\n
|
|
1
|
+
{"version":3,"file":"useDocumentVisibility.js","sources":["../../../../src/hooks/useDocumentVisibility/useDocumentVisibility.ts"],"sourcesContent":["import React from 'react';\n\nconst getSnapshot = () => document.visibilityState;\nconst getServerSnapshot = (): DocumentVisibilityState => 'hidden';\nconst subscribe = (callback: () => void) => {\n document.addEventListener('visibilitychange', callback);\n return () => {\n document.removeEventListener('visibilitychange', callback);\n };\n};\n\n/**\n * @name useDocumentVisibility\n * @description – Hook that provides the current visibility state of the document\n *\n * @returns {DocumentVisibilityState} The current visibility state of the document, which can be 'visible' or 'hidden'\n *\n * @example\n * const visibilityState = useDocumentVisibility();\n */\nexport const useDocumentVisibility = () =>\n React.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n"],"names":["getSnapshot","document","visibilityState","getServerSnapshot","subscribe","callback","addEventListener","removeEventListener","useDocumentVisibility","React","useSyncExternalStore"],"mappings":";qBAEA,IAAMA,EAAc,WAAH,OAASC,SAASC,eAAe,EAC5CC,EAAoB,WAAH,MAAkC,QAAQ,EAC3DC,EAAY,SAACC,GAEjB,OADAJ,SAASK,iBAAiB,mBAAoBD,GACvC,WACLJ,SAASM,oBAAoB,mBAAoBF,GAErD,EAWaG,EAAwB,WAAH,OAChCC,EAAMC,qBAAqBN,EAAWJ,EAAaG,EAAkB"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
import r from"react";import{useIsomorphicLayoutEffect as t}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var e=function(e){var o=r.useRef(e);return t((function(){o.current=e}),[e]),r.useCallback((function(){return o.current.apply(void 0,arguments)}),[])};export{e as useEvent};
|
|
3
|
+
//# sourceMappingURL=useEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEvent.js","sources":["../../../../src/hooks/useEvent/useEvent.ts"],"sourcesContent":["import React from 'react';\n\nimport { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect';\n\nexport const useEvent = <Params extends unknown[], Return>(\n callback: (...args: Params) => Return\n): ((...args: Params) => Return) => {\n const callbackRef = React.useRef<typeof callback>(callback);\n\n useIsomorphicLayoutEffect(() => {\n callbackRef.current = callback;\n }, [callback]);\n\n return React.useCallback((...args) => {\n const fn = callbackRef.current;\n return fn(...args);\n }, []);\n};\n"],"names":["useEvent","callback","callbackRef","React","useRef","useIsomorphicLayoutEffect","current","useCallback","apply","arguments"],"mappings":";uKAIaA,EAAW,SACtBC,GAEA,IAAMC,EAAcC,EAAMC,OAAwBH,GAMlD,OAJAI,GAA0B,WACxBH,EAAYI,QAAUL,CACxB,GAAG,CAACA,IAEGE,EAAMI,aAAY,WAEvB,OADWL,EAAYI,QACdE,WAAA,EAAAC,UACV,GAAE,GACL"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
2
|
import n from"react";var t=function(){var t=(arguments.length<=1?void 0:arguments[1])instanceof Function?null:arguments.length<=0?void 0:arguments[0],e=t?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],r=Array.isArray(e)?e:[e],o=t?arguments.length<=2?void 0:arguments[2]:arguments.length<=1?void 0:arguments[1],i=t?arguments.length<=3?void 0:arguments[3]:arguments.length<=2?void 0:arguments[2],f=n.useRef(null);if(n.useEffect((function(){var n=t?function(n){return"function"==typeof n?n():n instanceof Element||n instanceof Window||n instanceof Document?n:n.current}(t):f.current;if(n)return r.forEach((function(t){return n.addEventListener(t,o,i)})),function(){r.forEach((function(t){return n.removeEventListener(t,o,i)}))}}),[t,e,o,i]),!t)return f};export{t as useEventListener};
|
|
3
3
|
//# sourceMappingURL=useEventListener.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-D5_r4iwW.js";import t from"react";import{useDidUpdate as o}from"../useDidUpdate/useDidUpdate.js";import{useMount as n}from"../useMount/useMount.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var r=function(r,l){var u,i,c=null!==(u=null==l?void 0:l.rel)&&void 0!==u?u:"icon",a=t.useState(null!=r?r:null===(i=document.querySelector('link[rel*="'.concat(c,'"]')))||void 0===i?void 0:i.href),p=e(a,2),s=p[0],m=p[1],d=function(e){var t=document.querySelector('link[rel*="'.concat(c,'"]'))||document.createElement("link");t.rel=c,t.href=e,t.type="image/".concat(e.split(".").pop()),document.head.append(t),document.getElementsByTagName("head")[0].appendChild(t)};return n((function(){r&&d(r)})),o((function(){r&&(m(r),d(r))}),[r,null==l?void 0:l.rel]),{href:s,set:function(e){m(e),d(e)}}};export{r as useFavicon};
|
|
3
3
|
//# sourceMappingURL=useFavicon.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as o}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
import{_ as o}from"../../_rollupPluginBabelHelpers-D5_r4iwW.js";import n from"react";import{useWindowEvent as e}from"../useWindowEvent/useWindowEvent.js";import"../useEventListener/useEventListener.js";var t=function(){var t=n.useState(window?decodeURIComponent(window.location.hash.replace("#","")):""),i=o(t,2),r=i[0],a=i[1];return e("hashchange",(function(){r!==window.location.hash&&a(window.location.hash)})),[r,function(o){window.location.hash=o,a(o)}]};export{t as useHash};
|
|
3
3
|
//# sourceMappingURL=useHash.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
import{_ as e,c as o}from"../../_rollupPluginBabelHelpers-D5_r4iwW.js";import n from"react";import{useDidUpdate as t}from"../useDidUpdate/useDidUpdate.js";import{useEvent as r}from"../useEvent/useEvent.js";import{useEventListener as i}from"../useEventListener/useEventListener.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var u=function(e,o){return e.toLowerCase().split(/[+_-]/g).map((function(e){return e.trim()})).every((function(e){return o.find((function(o){return e===o.code.toLocaleLowerCase()||e===o.key.toLocaleLowerCase()||e===o.alias.toLocaleLowerCase()}))}))},l=function(l,a,s){var c,d,f,v,p=null===(c=null==s?void 0:s.enabled)||void 0===c||c,m=null===(d=null==s?void 0:s.preventDefault)||void 0===d||d,y=n.useState([]),L=e(y,2)[1],w=r((function(e){m&&e.preventDefault(),p&&L((function(n){var t,r,i,c;if(n.some((function(o){return o.code===e.code})))return n;var d=null!==(t=null!==(r=null==s||null===(i=s.aliasMap)||void 0===i?void 0:i[e.key])&&void 0!==r?r:null==s||null===(c=s.aliasMap)||void 0===c?void 0:c[e.key])&&void 0!==t?t:e.code,f=[].concat(o(n),[{key:e.key,code:e.code,alias:d}]);Array.isArray(l)?l.forEach((function(o){u(o,f)&&a(e)})):u(l,f)&&a(e);return f}))})),k=r((function(e){p&&L((function(o){return o.filter((function(o){return o.code!==e.code}))}))}));t((function(){L([])}),[p]),i(null!==(f=null==s?void 0:s.target)&&void 0!==f?f:window,"keydown",w),i(null!==(v=null==s?void 0:s.target)&&void 0!==v?v:window,"keyup",k)};export{u as isHotkeyMatch,l as useHotkeys};
|
|
3
|
+
//# sourceMappingURL=useHotkeys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHotkeys.js","sources":["../../../../src/hooks/useHotkeys/useHotkeys.ts"],"sourcesContent":["import React from 'react';\n\nimport { useDidUpdate } from '../useDidUpdate/useDidUpdate';\nimport { useEvent } from '../useEvent/useEvent';\nimport type { UseEventListenerTarget } from '../useEventListener/useEventListener';\nimport { useEventListener } from '../useEventListener/useEventListener';\n\n/** The use keys pressed params */\ninterface UseHotkeysOptions {\n /** The target to attach the event listeners to */\n target?: UseEventListenerTarget;\n\n /** Enable or disable the event listeners */\n enabled?: boolean;\n\n /** Whether to prevent the default behavior of the event */\n preventDefault?: boolean;\n\n /** Alias map for hotkeys */\n aliasMap?: Record<string, string>;\n}\n\nexport const isHotkeyMatch = (hotkey: string, keys: UseHotkeysKey[]) =>\n hotkey\n .toLowerCase()\n .split(/[+_-]/g)\n .map((key) => key.trim())\n .every((key) =>\n keys.find(\n (updatedKey) =>\n key === updatedKey.code.toLocaleLowerCase() ||\n key === updatedKey.key.toLocaleLowerCase() ||\n key === updatedKey.alias.toLocaleLowerCase()\n )\n );\n\ntype UseHotkeysHotkeys = string[] | string;\ntype UseHotkeysKey = { key: string; code: string; alias: string };\n\n/**\n * @name useHotkeys\n * @description - Hook that listens for key press events\n *\n * @param {UseHotkeysHotkeys} hotkeys The key or keys to listen for\n * @param {(event: KeyboardEvent) => void} callback The callback function to be called when the hotkey is pressed\n * @param {UseEventListenerTarget} [options.target=window] The target to attach the event listeners to\n * @param {boolean} [options.enabled=true] Enable or disable the event listeners\n * @param {boolean} [options.preventDefault=true] Whether to prevent the default behavior of the event\n * @param {Record<string, string>} [options.aliasMap] Alias map for hotkeys\n * @returns {useKeysPressedReturns} Array of strings with keys that were press\n *\n * @example\n * useHotkeys('control+a', () => console.log('hotkey pressed'));\n *\n * @example\n * useHotkeys('ControlLeft+KeyA', () => console.log('hotkey pressed'));\n */\nexport const useHotkeys = (\n hotkeys: UseHotkeysHotkeys,\n callback: (event: KeyboardEvent) => void,\n options?: UseHotkeysOptions\n) => {\n const enabled = options?.enabled ?? true;\n const preventDefault = options?.preventDefault ?? true;\n const [, setKeys] = React.useState<UseHotkeysKey[]>([]);\n\n const onKeyDown = useEvent((event: KeyboardEvent) => {\n if (preventDefault) event.preventDefault();\n\n if (!enabled) return;\n\n setKeys((prevKeys) => {\n if (prevKeys.some(({ code }) => code === event.code)) return prevKeys;\n const alias = options?.aliasMap?.[event.key] ?? options?.aliasMap?.[event.key] ?? event.code;\n const updatedKeys = [...prevKeys, { key: event.key, code: event.code, alias }];\n\n if (Array.isArray(hotkeys)) {\n hotkeys.forEach((hotkey) => {\n const isMatch = isHotkeyMatch(hotkey, updatedKeys);\n if (isMatch) callback(event);\n });\n } else {\n const isMatch = isHotkeyMatch(hotkeys, updatedKeys);\n if (isMatch) callback(event);\n }\n\n return updatedKeys;\n });\n });\n\n const onKeyUp = useEvent((event: KeyboardEvent) => {\n if (!enabled) return;\n setKeys((prevKeys) => prevKeys.filter(({ code }) => code !== event.code));\n });\n\n useDidUpdate(() => {\n setKeys([]);\n }, [enabled]);\n\n useEventListener(options?.target ?? window, 'keydown', onKeyDown);\n useEventListener(options?.target ?? window, 'keyup', onKeyUp);\n};\n"],"names":["isHotkeyMatch","hotkey","keys","toLowerCase","split","map","key","trim","every","find","updatedKey","code","toLocaleLowerCase","alias","useHotkeys","hotkeys","callback","options","_options$enabled","_options$preventDefau","_options$target","_options$target2","enabled","preventDefault","_React$useState","React","useState","setKeys","_slicedToArray","onKeyDown","useEvent","event","prevKeys","_ref2","_options$aliasMap$eve","_options$aliasMap","_options$aliasMap2","some","_ref","aliasMap","updatedKeys","concat","_toConsumableArray","Array","isArray","forEach","onKeyUp","filter","_ref3","useDidUpdate","useEventListener","target","window"],"mappings":";mYAsBO,IAAMA,EAAgB,SAACC,EAAgBC,GAAqB,OACjED,EACGE,cACAC,MAAM,UACNC,KAAI,SAACC,GAAG,OAAKA,EAAIC,MAAM,IACvBC,OAAM,SAACF,GAAG,OACTJ,EAAKO,MACH,SAACC,GAAU,OACTJ,IAAQI,EAAWC,KAAKC,qBACxBN,IAAQI,EAAWJ,IAAIM,qBACvBN,IAAQI,EAAWG,MAAMD,mBAAmB,GAC/C,GACF,EAuBQE,EAAa,SACxBC,EACAC,EACAC,GACG,IAAAC,EAAAC,EAAAC,EAAAC,EACGC,EAA0BJ,QAAnBA,EAAGD,aAAO,EAAPA,EAASK,eAAOJ,IAAAA,GAAAA,EAC1BK,EAAwCJ,QAA1BA,EAAGF,aAAO,EAAPA,EAASM,sBAAcJ,IAAAA,GAAAA,EAC9CK,EAAoBC,EAAMC,SAA0B,IAA3CC,EAA8CC,EAAAJ,EAAA,GAAvC,GAEVK,EAAYC,GAAS,SAACC,GACtBR,GAAgBQ,EAAMR,iBAErBD,GAELK,GAAQ,SAACK,GAAa,IAAAC,EAAAC,EAAAC,EAAAC,EACpB,GAAIJ,EAASK,MAAK,SAAAC,GAAO,OAAAA,EAAJ3B,OAAoBoB,EAAMpB,QAAO,OAAOqB,EAC7D,IAAMnB,EAAwE,QAAnEoB,EAAiC,QAAjCC,EAAGjB,SAAiBkB,QAAVA,EAAPlB,EAASsB,gBAATJ,IAAiBA,OAAjBA,EAAAA,EAAoBJ,EAAMzB,YAAI,IAAA4B,EAAAA,EAAIjB,SAAiB,QAAVmB,EAAPnB,EAASsB,gBAAQ,IAAAH,OAAA,EAAjBA,EAAoBL,EAAMzB,YAAI,IAAA2B,EAAAA,EAAIF,EAAMpB,KAClF6B,EAAWC,GAAAA,OAAAC,EAAOV,GAAU,CAAA,CAAE1B,IAAKyB,EAAMzB,IAAKK,KAAMoB,EAAMpB,KAAME,MAAAA,KAElE8B,MAAMC,QAAQ7B,GAChBA,EAAQ8B,SAAQ,SAAC5C,GACCD,EAAcC,EAAQuC,IACzBxB,EAASe,EACxB,IAEgB/B,EAAce,EAASyB,IAC1BxB,EAASe,GAGxB,OAAOS,CACT,GACF,IAEMM,EAAUhB,GAAS,SAACC,GACnBT,GACLK,GAAQ,SAACK,GAAQ,OAAKA,EAASe,QAAO,SAAAC,GAAO,OAAAA,EAAJrC,OAAoBoB,EAAMpB,UACrE,IAEAsC,GAAa,WACXtB,EAAQ,GACV,GAAG,CAACL,IAEJ4B,UAAgB9B,EAACH,aAAO,EAAPA,EAASkC,cAAM,IAAA/B,EAAAA,EAAIgC,OAAQ,UAAWvB,GACvDqB,UAAgB7B,EAACJ,aAAO,EAAPA,EAASkC,cAAM,IAAA9B,EAAAA,EAAI+B,OAAQ,QAASN,EACvD"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{a as n,_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
import{a as n,_ as e}from"../../_rollupPluginBabelHelpers-D5_r4iwW.js";import l from"react";import{useEventListener as t}from"../useEventListener/useEventListener.js";var o=function(){var o=(arguments.length<=0?void 0:arguments[0])instanceof Function||!("current"in(arguments.length<=0?void 0:arguments[0]))||arguments.length<=0?void 0:arguments[0],r=o?"object"===n(arguments.length<=1?void 0:arguments[1])?arguments.length<=1?void 0:arguments[1]:{onEntry:arguments.length<=1?void 0:arguments[1]}:"object"===n(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:{onEntry:arguments.length<=0?void 0:arguments[0]},i=l.useState(!1),u=e(i,2),v=u[0],a=u[1],s=l.useRef(null);return t(null!=o?o:s,"mouseenter",(function(){var n;null==r||null===(n=r.onEntry)||void 0===n||n.call(r),a(!0)})),t(null!=o?o:s,"mouseleave",(function(){var n;null==r||null===(n=r.onLeave)||void 0===n||n.call(r),a(!1)})),o?v:[s,v]};export{o as useHover};
|
|
3
3
|
//# sourceMappingURL=useHover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHover.js","sources":["../../../../src/hooks/useHover/useHover.ts"],"sourcesContent":["import React from 'react';\n\nimport { useEventListener } from '../useEventListener/useEventListener';\n\n//* The use hover options
|
|
1
|
+
{"version":3,"file":"useHover.js","sources":["../../../../src/hooks/useHover/useHover.ts"],"sourcesContent":["import React from 'react';\n\nimport { useEventListener } from '../useEventListener/useEventListener';\n\n//* The use hover options */\nexport interface UseHoverOptions {\n //* The on entry callback */\n onEntry?: () => void;\n //* The on leave callback */\n onLeave?: () => void;\n}\n\n//* The use hover target type */\nexport type UseHoverTarget = React.RefObject<Element | null> | Element;\n//* The use hover return type */\nexport type UseHoverReturn<Target extends UseHoverTarget = any> = [\n React.RefObject<Target>,\n boolean\n];\n\nexport type UseHover = {\n <Target extends UseHoverTarget>(target: Target, callback?: () => void): boolean;\n\n <Target extends UseHoverTarget>(target: Target, options?: UseHoverOptions): boolean;\n\n <Target extends UseHoverTarget>(callback?: () => void, target?: never): UseHoverReturn<Target>;\n\n <Target extends UseHoverTarget>(\n options?: UseHoverOptions,\n target?: never\n ): UseHoverReturn<Target>;\n};\n\n/**\n * @name useHover\n * @description - Hook that defines the logic when hovering an element\n *\n * @example\n * const hovering = useHover(ref, () => console.log('callback'));\n *\n * @example\n * const [ref, hovering] = useHover(() => console.log('callback'));\n *\n * @example\n * const [ref, hovering] = useHover({\n * onEntry: () => console.log('onEntry'),\n * onLeave: () => console.log('onLeave'),\n * });\n *\n * @example\n * const hovering = useHover(ref, {\n * onEntry: () => console.log('onEntry'),\n * onLeave: () => console.log('onLeave'),\n * });\n */\nexport const useHover = ((...params: any[]) => {\n const target = (\n params[0] instanceof Function || !('current' in params[0]) ? undefined : params[0]\n ) as UseHoverTarget | undefined;\n\n const options = (\n target\n ? typeof params[1] === 'object'\n ? params[1]\n : { onEntry: params[1] }\n : typeof params[0] === 'object'\n ? params[0]\n : { onEntry: params[0] }\n ) as UseHoverOptions | undefined;\n\n const [hovering, setHovering] = React.useState(false);\n const internalRef = React.useRef<Element>(null);\n\n const onMouseEnter = () => {\n options?.onEntry?.();\n setHovering(true);\n };\n const onMouseLeave = () => {\n options?.onLeave?.();\n setHovering(false);\n };\n\n useEventListener(target ?? internalRef, 'mouseenter', onMouseEnter);\n useEventListener(target ?? internalRef, 'mouseleave', onMouseLeave);\n\n if (target) return hovering;\n return [internalRef, hovering] as const;\n}) as UseHover;\n"],"names":["useHover","target","arguments","length","undefined","Function","options","_typeof","onEntry","_React$useState","React","useState","_React$useState2","_slicedToArray","hovering","setHovering","internalRef","useRef","useEventListener","_options$onEntry","call","_options$onLeave","onLeave"],"mappings":";2KAuDaA,EAAY,WACvB,IAAMC,GACJC,UAAAC,QAAA,OAAAC,EAAAF,UAAqBG,cAAAA,YAAc,YAASH,UAAAC,eAAAC,EAAAF,UAAA,MAA0BA,UAAAC,QAAA,OAATC,EAASF,UACzC,GAEzBI,EACJL,EACyB,WAArBM,EAAAL,UAAAC,QAAAC,OAAAA,EAAAF,UAAA,IAA6BA,UAAAC,QAAAC,OAAAA,EAAAF,UAE3B,GAAA,CAAEM,QAAON,UAAAC,QAAAC,OAAAA,EAAAF,UAAA,IACU,WAArBK,EAAAL,UAAAC,QAAA,OAAAC,EAAAF,cAA6BA,UAAAC,eAAAC,EAAAF,UAE3B,GAAA,CAAEM,QAAON,UAAAC,QAAAC,OAAAA,EAAAF,UAAA,IAGjBO,EAAgCC,EAAMC,UAAS,GAAMC,EAAAC,EAAAJ,EAAA,GAA9CK,EAAQF,EAAA,GAAEG,EAAWH,EAAA,GACtBI,EAAcN,EAAMO,OAAgB,MAc1C,OAHAC,EAAiBjB,QAAAA,EAAUe,EAAa,cATnB,WAAM,IAAAG,EACzBb,SAAgBa,QAATA,EAAPb,EAASE,mBAAOW,GAAhBA,EAAAC,KAAAd,GACAS,GAAY,MAQdG,EAAiBjB,QAAAA,EAAUe,EAAa,cANnB,WAAM,IAAAK,EACzBf,SAAgBe,QAATA,EAAPf,EAASgB,mBAAOD,GAAhBA,EAAAD,KAAAd,GACAS,GAAY,MAMVd,EAAea,EACZ,CAACE,EAAaF,EACvB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @siberiacancode/reactuse v0.0.
|
|
2
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-D5_r4iwW.js";import t from"react";import"../../utils/helpers/isClient.js";import{throttle as n}from"../../utils/helpers/throttle.js";var i=["mousemove","mousedown","keydown","touchstart","wheel","resize"],o=function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6e4,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=r.initialState,s=void 0!==u&&u,a=r.events,d=void 0===a?i:a,c=t.useState(s),l=e(c,2),m=l[0],v=l[1],f=t.useState(Date.now()),w=e(f,2),h=w[0],p=w[1];return t.useEffect((function(){var e,t=function(){return v(!0)},i=n((function(){v(!1),p(Date.now()),window.clearTimeout(e),e=setTimeout(t,o)}),500),r=function(){document.hidden||i()};return e=setTimeout(t,o),d.forEach((function(e){return window.addEventListener(e,i)})),document.addEventListener("visibilitychange",r),function(){d.forEach((function(e){return window.addEventListener(e,i)})),document.removeEventListener("visibilitychange",r),window.clearTimeout(e)}}),[o,d]),{idle:m,lastActive:h}};export{o as useIdle};
|
|
3
3
|
//# sourceMappingURL=useIdle.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* @license @siberiacancode/reactuse v0.0.9 */
|
|
2
|
+
import{a as n,_ as e,b as t}from"../../_rollupPluginBabelHelpers-D5_r4iwW.js";import r from"react";var o=function(){var o="object"!==n(arguments.length<=0?void 0:arguments[0])||"current"in(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,i=o?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],l=r.useState(),u=e(l,2),c=u[0],s=u[1],a=r.useRef(null),f=r.useRef();return f.current=null==i?void 0:i.onChange,r.useEffect((function(){var n,r=o?function(n){return"function"==typeof n?n():n instanceof Element?n:n.current}(o):a.current,l=new IntersectionObserver((function(n){var t,r=e(n,1)[0];s(r),null===(t=f.current)||void 0===t||t.call(f,r)}),t(t({},i),{},{root:(n=null==i?void 0:i.root,n?n instanceof Element||n instanceof Document?n:n.current:document)}));return l.observe(r),function(){l.disconnect()}}),[o,null==i?void 0:i.rootMargin,null==i?void 0:i.threshold]),o?{entry:c,inView:!(null==c||!c.isIntersecting)}:{ref:a,entry:c,inView:!(null==c||!c.isIntersecting)}};export{o as useIntersectionObserver};
|
|
3
|
+
//# sourceMappingURL=useIntersectionObserver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIntersectionObserver.js","sources":["../../../../src/hooks/useIntersectionObserver/useIntersectionObserver.ts"],"sourcesContent":["import React from 'react';\n\nexport type UseIntersectionObserverTarget =\n | React.RefObject<Element | null>\n | (() => Element)\n | Element;\n\nexport interface UseIntersectionObserverOptions extends Omit<IntersectionObserverInit, 'root'> {\n immediate?: boolean;\n onChange?: (entry: IntersectionObserverEntry) => void;\n root?: IntersectionObserverInit['root'] | React.RefObject<Element | null>;\n}\n\nconst getTargetElement = (target: UseIntersectionObserverTarget) => {\n if (typeof target === 'function') {\n return target();\n }\n\n if (target instanceof Element) {\n return target;\n }\n\n return target.current;\n};\n\nconst getRootElement = (root: UseIntersectionObserverOptions['root']) => {\n if (!root) return document;\n\n if (root instanceof Element) {\n return root;\n }\n\n if (root instanceof Document) {\n return root;\n }\n\n return root.current;\n};\n\nexport interface UseIntersectionObserverReturn {\n inView: boolean;\n entry?: IntersectionObserverEntry;\n}\n\nexport type UseIntersectionObserver = {\n <Target extends UseIntersectionObserverTarget>(\n target: Target,\n options?: UseIntersectionObserverOptions\n ): UseIntersectionObserverReturn;\n\n <Target extends UseIntersectionObserverTarget>(\n options?: UseIntersectionObserverOptions,\n target?: never\n ): UseIntersectionObserverReturn & { ref: React.RefObject<Target> };\n};\n\nexport const useIntersectionObserver = ((...params: any[]) => {\n const target = (\n typeof params[0] === 'object' && !('current' in params[0]) ? undefined : params[0]\n ) as UseIntersectionObserverTarget | undefined;\n const options = (target ? params[1] : params[0]) as UseIntersectionObserverOptions | undefined;\n\n const [entry, setEntry] = React.useState<IntersectionObserverEntry>();\n const internalRef = React.useRef<Element>(null);\n\n const onChangeRef = React.useRef<UseIntersectionObserverOptions['onChange']>();\n onChangeRef.current = options?.onChange;\n\n React.useEffect(() => {\n const element = target ? getTargetElement(target) : internalRef.current;\n const observer = new IntersectionObserver(\n ([entry]) => {\n setEntry(entry);\n onChangeRef.current?.(entry);\n },\n {\n ...options,\n root: getRootElement(options?.root)\n }\n );\n\n observer.observe(element!);\n\n return () => {\n observer.disconnect();\n };\n }, [target, options?.rootMargin, options?.threshold]);\n\n if (!target) return { ref: internalRef, entry, inView: !!entry?.isIntersecting };\n return { entry, inView: !!entry?.isIntersecting };\n}) as UseIntersectionObserver;\n"],"names":["useIntersectionObserver","target","_typeof","arguments","length","undefined","options","_React$useState","React","useState","_React$useState2","_slicedToArray","entry","setEntry","internalRef","useRef","onChangeRef","current","onChange","useEffect","root","element","Element","getTargetElement","observer","IntersectionObserver","_ref","_onChangeRef$current","call","_objectSpread","Document","document","observe","disconnect","rootMargin","threshold","inView","isIntersecting","ref"],"mappings":";mGAaA,IA2CaA,EAA2B,WACtC,IAAMC,EACiB,WAArBC,EAAAC,UAAAC,QAAA,OAAAC,EAAAF,UAAqB,KAAc,YAASA,UAAAC,eAAAC,EAAAF,UAAA,IAA0BA,UAAAC,QAAA,OAAAC,EAAAF,UAC1B,QADiBE,EAEzDC,EAAWL,EAAME,UAAAC,QAAAC,OAAAA,EAAAF,UAAA,GAAAA,UAAAC,eAAAC,EAAAF,UAAuE,GAE9FI,EAA0BC,EAAMC,WAAqCC,EAAAC,EAAAJ,EAAA,GAA9DK,EAAKF,EAAA,GAAEG,EAAQH,EAAA,GAChBI,EAAcN,EAAMO,OAAgB,MAEpCC,EAAcR,EAAMO,SAuB1B,OAtBAC,EAAYC,QAAUX,aAAO,EAAPA,EAASY,SAE/BV,EAAMW,WAAU,WACd,IA5CoBC,EA4CdC,EAAUpB,EAxDK,SAACA,GACxB,MAAsB,mBAAXA,EACFA,IAGLA,aAAkBqB,QACbrB,EAGFA,EAAOgB,OAChB,CA8C6BM,CAAiBtB,GAAUa,EAAYG,QAC1DO,EAAW,IAAIC,sBACnB,SAAAC,GAAa,IAAAC,EAAXf,EAAWD,EAAAe,EAAA,GAAN,GACLb,EAASD,GACUe,QAAnBA,EAAAX,EAAYC,eAAZU,IAAmBA,GAAnBA,EAAAC,KAAAZ,EAAsBJ,EACvB,GAAAiB,EAAAA,KAEIvB,GAAO,CAAA,EAAA,CACVc,MApDgBA,EAoDKd,aAAO,EAAPA,EAASc,KAnD/BA,EAEDA,aAAgBE,SAIhBF,aAAgBU,SAHXV,EAOFA,EAAKH,QAVMc,aAyDhB,OAFAP,EAASQ,QAAQX,GAEV,WACLG,EAASS,gBAEV,CAAChC,EAAQK,eAAAA,EAAS4B,WAAY5B,aAAO,EAAPA,EAAS6B,YAErClC,EACE,CAAEW,MAAAA,EAAOwB,SAAUxB,UAAAA,EAAOyB,iBADb,CAAEC,IAAKxB,EAAaF,MAAAA,EAAOwB,SAAUxB,UAAAA,EAAOyB,gBAElE"}
|