@siberiacancode/reactuse 0.0.28 → 0.0.31
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-CntznmQ7.js → _rollupPluginBabelHelpers-XknWBRG7.js} +2 -2
- package/dist/cjs/_rollupPluginBabelHelpers-XknWBRG7.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/useBattery/useBattery.js.map +1 -1
- package/dist/cjs/hooks/useBoolean/useBoolean.js +2 -2
- package/dist/cjs/hooks/useBoolean/useBoolean.js.map +1 -1
- package/dist/cjs/hooks/useBrowserLanguage/useBrowserLanguage.js +1 -1
- package/dist/cjs/hooks/useClickOutside/useClickOutside.js +1 -1
- package/dist/cjs/hooks/useClickOutside/useClickOutside.js.map +1 -1
- package/dist/cjs/hooks/useCopyToClipboard/useCopyToClipboard.js +2 -2
- package/dist/cjs/hooks/useCopyToClipboard/useCopyToClipboard.js.map +1 -1
- package/dist/cjs/hooks/useCounter/useCounter.js +2 -2
- package/dist/cjs/hooks/useCounter/useCounter.js.map +1 -1
- package/dist/cjs/hooks/useDebouncedValue/useDebouncedValue.js +2 -2
- package/dist/cjs/hooks/useDebouncedValue/useDebouncedValue.js.map +1 -1
- package/dist/cjs/hooks/useDefault/useDefault.js +2 -2
- package/dist/cjs/hooks/useDefault/useDefault.js.map +1 -1
- package/dist/cjs/hooks/useDidUpdate/useDidUpdate.js +1 -1
- package/dist/cjs/hooks/useDidUpdate/useDidUpdate.js.map +1 -1
- package/dist/cjs/hooks/useDocumentEvent/useDocumentEvent.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 +1 -1
- package/dist/cjs/hooks/useDocumentVisibility/useDocumentVisibility.js.map +1 -1
- package/dist/cjs/hooks/useEvent/useEvent.js +1 -1
- package/dist/cjs/hooks/useEvent/useEvent.js.map +1 -1
- package/dist/cjs/hooks/useEventListener/useEventListener.js +1 -1
- package/dist/cjs/hooks/useEventListener/useEventListener.js.map +1 -1
- package/dist/cjs/hooks/useEyeDropper/useEyeDropper.js +2 -2
- package/dist/cjs/hooks/useEyeDropper/useEyeDropper.js.map +1 -1
- package/dist/cjs/hooks/useFavicon/useFavicon.js +2 -2
- package/dist/cjs/hooks/useFavicon/useFavicon.js.map +1 -1
- package/dist/cjs/hooks/useField/useField.js +3 -0
- package/dist/cjs/hooks/useField/useField.js.map +1 -0
- package/dist/cjs/hooks/useFps/useFps.js +2 -2
- package/dist/cjs/hooks/useFps/useFps.js.map +1 -1
- package/dist/cjs/hooks/useFullscreen/useFullscreen.js +2 -2
- package/dist/cjs/hooks/useFullscreen/useFullscreen.js.map +1 -1
- package/dist/cjs/hooks/useHash/useHash.js +2 -2
- package/dist/cjs/hooks/useHash/useHash.js.map +1 -1
- package/dist/cjs/hooks/useHotkeys/useHotkeys.js +2 -2
- package/dist/cjs/hooks/useHotkeys/useHotkeys.js.map +1 -1
- package/dist/cjs/hooks/useHover/useHover.js +2 -2
- package/dist/cjs/hooks/useHover/useHover.js.map +1 -1
- package/dist/cjs/hooks/useIdle/useIdle.js +2 -2
- package/dist/cjs/hooks/useIdle/useIdle.js.map +1 -1
- package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -2
- package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.js.map +1 -1
- package/dist/cjs/hooks/useInterval/useInterval.js +2 -2
- package/dist/cjs/hooks/useInterval/useInterval.js.map +1 -1
- package/dist/cjs/hooks/useIsFirstRender/useIsFirstRender.js +1 -1
- package/dist/cjs/hooks/useIsFirstRender/useIsFirstRender.js.map +1 -1
- package/dist/cjs/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +1 -1
- package/dist/cjs/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js.map +1 -1
- package/dist/cjs/hooks/useKeyPress/useKeyPress.js +2 -2
- package/dist/cjs/hooks/useKeyPress/useKeyPress.js.map +1 -1
- package/dist/cjs/hooks/useKeyPressEvent/useKeyPressEvent.js +1 -1
- package/dist/cjs/hooks/useKeyboard/useKeyboard.js +1 -1
- package/dist/cjs/hooks/useKeysPressed/useKeysPressed.js +2 -2
- package/dist/cjs/hooks/useKeysPressed/useKeysPressed.js.map +1 -1
- package/dist/cjs/hooks/useList/useList.js +2 -2
- package/dist/cjs/hooks/useList/useList.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/useLogger/useLogger.js.map +1 -1
- package/dist/cjs/hooks/useLongPress/useLongPress.js +2 -2
- package/dist/cjs/hooks/useLongPress/useLongPress.js.map +1 -1
- package/dist/cjs/hooks/useMediaQuery/useMediaQuery.js +1 -1
- package/dist/cjs/hooks/useMediaQuery/useMediaQuery.js.map +1 -1
- package/dist/cjs/hooks/useMount/useMount.js +1 -1
- package/dist/cjs/hooks/useMount/useMount.js.map +1 -1
- package/dist/cjs/hooks/useMouse/useMouse.js +2 -2
- package/dist/cjs/hooks/useMouse/useMouse.js.map +1 -1
- package/dist/cjs/hooks/useMutation/useMutation.js +2 -2
- package/dist/cjs/hooks/useMutation/useMutation.js.map +1 -1
- package/dist/cjs/hooks/useMutationObserver.js +1 -1
- package/dist/cjs/hooks/useMutationObserver.js.map +1 -1
- package/dist/cjs/hooks/useNetwork/useNetwork.js +2 -2
- package/dist/cjs/hooks/useNetwork/useNetwork.js.map +1 -1
- package/dist/cjs/hooks/useOnline/useOnline.js +1 -1
- package/dist/cjs/hooks/useOnline/useOnline.js.map +1 -1
- package/dist/cjs/hooks/useOperatingSystem/useOperatingSystem.js +1 -1
- package/dist/cjs/hooks/useOperatingSystem/useOperatingSystem.js.map +1 -1
- package/dist/cjs/hooks/useOrientation/useOrientation.js +2 -2
- package/dist/cjs/hooks/useOrientation/useOrientation.js.map +1 -1
- package/dist/cjs/hooks/usePageLeave/usePageLeave.js +2 -2
- package/dist/cjs/hooks/usePageLeave/usePageLeave.js.map +1 -1
- package/dist/cjs/hooks/usePaint/usePaint.js +2 -2
- package/dist/cjs/hooks/usePaint/usePaint.js.map +1 -1
- package/dist/cjs/hooks/usePreferredColorScheme/usePreferredColorScheme.js +1 -1
- package/dist/cjs/hooks/usePreferredLanguages/usePreferredLanguages.js +1 -1
- package/dist/cjs/hooks/usePreferredLanguages/usePreferredLanguages.js.map +1 -1
- package/dist/cjs/hooks/usePrevious/usePrevious.js +1 -1
- package/dist/cjs/hooks/usePrevious/usePrevious.js.map +1 -1
- package/dist/cjs/hooks/useQRCode/useQRCode.js +2 -2
- package/dist/cjs/hooks/useQRCode/useQRCode.js.map +1 -1
- package/dist/cjs/hooks/useQuery/useQuery.js +2 -2
- package/dist/cjs/hooks/useQuery/useQuery.js.map +1 -1
- package/dist/cjs/hooks/useQueue/useQueue.js +2 -2
- package/dist/cjs/hooks/useQueue/useQueue.js.map +1 -1
- package/dist/cjs/hooks/useRenderCount/useRenderCount.js +1 -1
- package/dist/cjs/hooks/useRenderCount/useRenderCount.js.map +1 -1
- package/dist/cjs/hooks/useRenderInfo/useRenderInfo.js +1 -1
- package/dist/cjs/hooks/useRenderInfo/useRenderInfo.js.map +1 -1
- package/dist/cjs/hooks/useRerender/useRerender.js +2 -2
- package/dist/cjs/hooks/useRerender/useRerender.js.map +1 -1
- 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/useSet/useSet.js.map +1 -1
- package/dist/cjs/hooks/useStep/useStep.js +2 -2
- package/dist/cjs/hooks/useStep/useStep.js.map +1 -1
- package/dist/cjs/hooks/useStorage/useStorage.js +2 -2
- package/dist/cjs/hooks/useStorage/useStorage.js.map +1 -1
- package/dist/cjs/hooks/useTextSelection/useTextSelection.js +2 -2
- package/dist/cjs/hooks/useTextSelection/useTextSelection.js.map +1 -1
- package/dist/cjs/hooks/useTime/useTime.js +2 -2
- package/dist/cjs/hooks/useTime/useTime.js.map +1 -1
- package/dist/cjs/hooks/useTimeout/useTimeout.js +2 -2
- package/dist/cjs/hooks/useTimeout/useTimeout.js.map +1 -1
- package/dist/cjs/hooks/useToggle/useToggle.js +2 -2
- package/dist/cjs/hooks/useToggle/useToggle.js.map +1 -1
- package/dist/cjs/hooks/useUnmount/useUnmount.js +1 -1
- package/dist/cjs/hooks/useUnmount/useUnmount.js.map +1 -1
- package/dist/cjs/hooks/useWebSocket/useWebSocket.js +2 -2
- package/dist/cjs/hooks/useWebSocket/useWebSocket.js.map +1 -1
- package/dist/cjs/hooks/useWindowEvent/useWindowEvent.js +1 -1
- package/dist/cjs/hooks/useWindowSize/useWindowSize.js +2 -2
- package/dist/cjs/hooks/useWindowSize/useWindowSize.js.map +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/utils/helpers/debounce.js +1 -1
- package/dist/cjs/utils/helpers/getRetry.js +1 -1
- package/dist/cjs/utils/helpers/index.js +1 -1
- package/dist/cjs/utils/helpers/isClient.js +1 -1
- package/dist/cjs/utils/helpers/throttle.js +1 -1
- package/dist/cjs/utils/helpers/time/getDate.js +1 -1
- package/dist/esm/{_rollupPluginBabelHelpers-DsV9C8-q.js → _rollupPluginBabelHelpers-DmI4-Pc6.js} +2 -2
- package/dist/esm/_rollupPluginBabelHelpers-DmI4-Pc6.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/useBattery/useBattery.js.map +1 -1
- package/dist/esm/hooks/useBoolean/useBoolean.js +2 -2
- package/dist/esm/hooks/useBoolean/useBoolean.js.map +1 -1
- package/dist/esm/hooks/useBrowserLanguage/useBrowserLanguage.js +1 -1
- 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/useCopyToClipboard/useCopyToClipboard.js.map +1 -1
- package/dist/esm/hooks/useCounter/useCounter.js +2 -2
- package/dist/esm/hooks/useCounter/useCounter.js.map +1 -1
- package/dist/esm/hooks/useDebouncedValue/useDebouncedValue.js +2 -2
- package/dist/esm/hooks/useDebouncedValue/useDebouncedValue.js.map +1 -1
- package/dist/esm/hooks/useDefault/useDefault.js +2 -2
- package/dist/esm/hooks/useDefault/useDefault.js.map +1 -1
- package/dist/esm/hooks/useDidUpdate/useDidUpdate.js +2 -2
- package/dist/esm/hooks/useDidUpdate/useDidUpdate.js.map +1 -1
- package/dist/esm/hooks/useDocumentEvent/useDocumentEvent.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 +2 -2
- package/dist/esm/hooks/useEvent/useEvent.js.map +1 -1
- package/dist/esm/hooks/useEventListener/useEventListener.js +2 -2
- package/dist/esm/hooks/useEventListener/useEventListener.js.map +1 -1
- package/dist/esm/hooks/useEyeDropper/useEyeDropper.js +2 -2
- package/dist/esm/hooks/useEyeDropper/useEyeDropper.js.map +1 -1
- package/dist/esm/hooks/useFavicon/useFavicon.js +2 -2
- package/dist/esm/hooks/useFavicon/useFavicon.js.map +1 -1
- package/dist/esm/hooks/useField/useField.js +3 -0
- package/dist/esm/hooks/useField/useField.js.map +1 -0
- package/dist/esm/hooks/useFps/useFps.js +2 -2
- package/dist/esm/hooks/useFps/useFps.js.map +1 -1
- package/dist/esm/hooks/useFullscreen/useFullscreen.js +2 -2
- package/dist/esm/hooks/useFullscreen/useFullscreen.js.map +1 -1
- package/dist/esm/hooks/useHash/useHash.js +2 -2
- package/dist/esm/hooks/useHash/useHash.js.map +1 -1
- package/dist/esm/hooks/useHotkeys/useHotkeys.js +2 -2
- package/dist/esm/hooks/useHotkeys/useHotkeys.js.map +1 -1
- package/dist/esm/hooks/useHover/useHover.js +2 -2
- package/dist/esm/hooks/useHover/useHover.js.map +1 -1
- package/dist/esm/hooks/useIdle/useIdle.js +2 -2
- package/dist/esm/hooks/useIdle/useIdle.js.map +1 -1
- package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -2
- package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.js.map +1 -1
- package/dist/esm/hooks/useInterval/useInterval.js +2 -2
- package/dist/esm/hooks/useInterval/useInterval.js.map +1 -1
- package/dist/esm/hooks/useIsFirstRender/useIsFirstRender.js +2 -2
- package/dist/esm/hooks/useIsFirstRender/useIsFirstRender.js.map +1 -1
- package/dist/esm/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +2 -2
- package/dist/esm/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js.map +1 -1
- package/dist/esm/hooks/useKeyPress/useKeyPress.js +2 -2
- package/dist/esm/hooks/useKeyPress/useKeyPress.js.map +1 -1
- package/dist/esm/hooks/useKeyPressEvent/useKeyPressEvent.js +1 -1
- package/dist/esm/hooks/useKeyboard/useKeyboard.js +1 -1
- package/dist/esm/hooks/useKeysPressed/useKeysPressed.js +2 -2
- package/dist/esm/hooks/useKeysPressed/useKeysPressed.js.map +1 -1
- package/dist/esm/hooks/useList/useList.js +2 -2
- package/dist/esm/hooks/useList/useList.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/useLogger/useLogger.js.map +1 -1
- package/dist/esm/hooks/useLongPress/useLongPress.js +2 -2
- package/dist/esm/hooks/useLongPress/useLongPress.js.map +1 -1
- package/dist/esm/hooks/useMediaQuery/useMediaQuery.js +2 -2
- package/dist/esm/hooks/useMediaQuery/useMediaQuery.js.map +1 -1
- package/dist/esm/hooks/useMount/useMount.js +2 -2
- package/dist/esm/hooks/useMount/useMount.js.map +1 -1
- package/dist/esm/hooks/useMouse/useMouse.js +2 -2
- package/dist/esm/hooks/useMouse/useMouse.js.map +1 -1
- package/dist/esm/hooks/useMutation/useMutation.js +2 -2
- package/dist/esm/hooks/useMutation/useMutation.js.map +1 -1
- package/dist/esm/hooks/useMutationObserver.js +2 -2
- package/dist/esm/hooks/useMutationObserver.js.map +1 -1
- package/dist/esm/hooks/useNetwork/useNetwork.js +2 -2
- package/dist/esm/hooks/useNetwork/useNetwork.js.map +1 -1
- package/dist/esm/hooks/useOnline/useOnline.js +2 -2
- package/dist/esm/hooks/useOnline/useOnline.js.map +1 -1
- package/dist/esm/hooks/useOperatingSystem/useOperatingSystem.js +2 -2
- package/dist/esm/hooks/useOperatingSystem/useOperatingSystem.js.map +1 -1
- package/dist/esm/hooks/useOrientation/useOrientation.js +2 -2
- package/dist/esm/hooks/useOrientation/useOrientation.js.map +1 -1
- package/dist/esm/hooks/usePageLeave/usePageLeave.js +2 -2
- package/dist/esm/hooks/usePageLeave/usePageLeave.js.map +1 -1
- package/dist/esm/hooks/usePaint/usePaint.js +2 -2
- package/dist/esm/hooks/usePaint/usePaint.js.map +1 -1
- package/dist/esm/hooks/usePreferredColorScheme/usePreferredColorScheme.js +1 -1
- package/dist/esm/hooks/usePreferredLanguages/usePreferredLanguages.js +2 -2
- package/dist/esm/hooks/usePreferredLanguages/usePreferredLanguages.js.map +1 -1
- package/dist/esm/hooks/usePrevious/usePrevious.js +2 -2
- package/dist/esm/hooks/usePrevious/usePrevious.js.map +1 -1
- package/dist/esm/hooks/useQRCode/useQRCode.js +2 -2
- package/dist/esm/hooks/useQRCode/useQRCode.js.map +1 -1
- package/dist/esm/hooks/useQuery/useQuery.js +2 -2
- package/dist/esm/hooks/useQuery/useQuery.js.map +1 -1
- package/dist/esm/hooks/useQueue/useQueue.js +2 -2
- package/dist/esm/hooks/useQueue/useQueue.js.map +1 -1
- package/dist/esm/hooks/useRenderCount/useRenderCount.js +2 -2
- package/dist/esm/hooks/useRenderCount/useRenderCount.js.map +1 -1
- package/dist/esm/hooks/useRenderInfo/useRenderInfo.js +2 -2
- package/dist/esm/hooks/useRenderInfo/useRenderInfo.js.map +1 -1
- package/dist/esm/hooks/useRerender/useRerender.js +2 -2
- package/dist/esm/hooks/useRerender/useRerender.js.map +1 -1
- 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/useSet/useSet.js.map +1 -1
- package/dist/esm/hooks/useStep/useStep.js +2 -2
- package/dist/esm/hooks/useStep/useStep.js.map +1 -1
- package/dist/esm/hooks/useStorage/useStorage.js +2 -2
- package/dist/esm/hooks/useStorage/useStorage.js.map +1 -1
- package/dist/esm/hooks/useTextSelection/useTextSelection.js +2 -2
- package/dist/esm/hooks/useTextSelection/useTextSelection.js.map +1 -1
- package/dist/esm/hooks/useTime/useTime.js +2 -2
- package/dist/esm/hooks/useTime/useTime.js.map +1 -1
- package/dist/esm/hooks/useTimeout/useTimeout.js +2 -2
- package/dist/esm/hooks/useTimeout/useTimeout.js.map +1 -1
- package/dist/esm/hooks/useToggle/useToggle.js +2 -2
- package/dist/esm/hooks/useToggle/useToggle.js.map +1 -1
- package/dist/esm/hooks/useUnmount/useUnmount.js +2 -2
- package/dist/esm/hooks/useUnmount/useUnmount.js.map +1 -1
- package/dist/esm/hooks/useWebSocket/useWebSocket.js +2 -2
- package/dist/esm/hooks/useWebSocket/useWebSocket.js.map +1 -1
- package/dist/esm/hooks/useWindowEvent/useWindowEvent.js +1 -1
- package/dist/esm/hooks/useWindowSize/useWindowSize.js +2 -2
- package/dist/esm/hooks/useWindowSize/useWindowSize.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/utils/helpers/debounce.js +1 -1
- package/dist/esm/utils/helpers/getRetry.js +1 -1
- package/dist/esm/utils/helpers/index.js +1 -1
- package/dist/esm/utils/helpers/isClient.js +1 -1
- package/dist/esm/utils/helpers/throttle.js +1 -1
- package/dist/esm/utils/helpers/time/getDate.js +1 -1
- package/dist/index.d.ts +186 -39
- package/package.json +1 -1
- package/dist/cjs/_rollupPluginBabelHelpers-CntznmQ7.js.map +0 -1
- package/dist/esm/_rollupPluginBabelHelpers-DsV9C8-q.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { RefObject, Dispatch, SetStateAction, EffectCallback, DependencyList, useEffect, ComponentProps } from 'react';
|
|
3
|
+
import QRCode from 'qrcode';
|
|
2
4
|
|
|
3
5
|
/** State for hook use battery */
|
|
4
6
|
interface UseBatteryStateReturn {
|
|
@@ -57,9 +59,9 @@ declare const useBoolean: (initialValue?: boolean) => UseBooleanReturn;
|
|
|
57
59
|
declare const useBrowserLanguage: () => string;
|
|
58
60
|
|
|
59
61
|
/** The use click outside target element type */
|
|
60
|
-
type UseClickOutsideTarget =
|
|
62
|
+
type UseClickOutsideTarget = RefObject<Element | null> | (() => Element) | Element;
|
|
61
63
|
/** The use click outside return type */
|
|
62
|
-
type UseClickOutsideReturn<Target extends UseClickOutsideTarget | UseClickOutsideTarget[]> =
|
|
64
|
+
type UseClickOutsideReturn<Target extends UseClickOutsideTarget | UseClickOutsideTarget[]> = RefObject<Target>;
|
|
63
65
|
type UseClickOutside = {
|
|
64
66
|
<Target extends UseClickOutsideTarget | UseClickOutsideTarget[]>(target: Target, callback: (event: Event) => void): void;
|
|
65
67
|
<Target extends UseClickOutsideTarget | UseClickOutsideTarget[]>(callback: (event: Event) => void, target?: never): UseClickOutsideReturn<Target>;
|
|
@@ -126,7 +128,7 @@ interface UseCounterReturn {
|
|
|
126
128
|
/** The current count value */
|
|
127
129
|
count: number;
|
|
128
130
|
/** Function to set a specific value to the counter */
|
|
129
|
-
set:
|
|
131
|
+
set: Dispatch<SetStateAction<number>>;
|
|
130
132
|
/** Function to reset the counter to its initial value. */
|
|
131
133
|
reset: () => void;
|
|
132
134
|
/** Function to increment the counter */
|
|
@@ -179,23 +181,23 @@ declare const useDebouncedValue: <Value>(value: Value, delay: number, options?:
|
|
|
179
181
|
* @example
|
|
180
182
|
* const [value, setValue] = useDefault(initialValue, defaultValue);
|
|
181
183
|
*/
|
|
182
|
-
declare const useDefault: <Value>(initialValue: Value | (() => Value), defaultValue: Value) => readonly [Value,
|
|
184
|
+
declare const useDefault: <Value>(initialValue: Value | (() => Value), defaultValue: Value) => readonly [Value, react.Dispatch<react.SetStateAction<Value | null | undefined>>];
|
|
183
185
|
|
|
184
186
|
/**
|
|
185
187
|
* @name useDidUpdate
|
|
186
188
|
* @description – Hook that behaves like useEffect, but skips the effect on the initial render
|
|
187
189
|
*
|
|
188
|
-
* @param {
|
|
189
|
-
* @param {
|
|
190
|
+
* @param {EffectCallback} effect The effect callback
|
|
191
|
+
* @param {DependencyList} [deps] The dependencies list for the effect
|
|
190
192
|
*
|
|
191
193
|
* @example
|
|
192
194
|
* useDidUpdate(() => console.log('Won't be called when mounted'), [deps]);
|
|
193
195
|
*/
|
|
194
|
-
declare const useDidUpdate: (effect:
|
|
196
|
+
declare const useDidUpdate: (effect: EffectCallback, deps?: DependencyList) => void;
|
|
195
197
|
|
|
196
|
-
type UseEventListenerTarget =
|
|
198
|
+
type UseEventListenerTarget = RefObject<Element | null> | (() => Element) | Element | Window | Document;
|
|
197
199
|
type UseEventListenerOptions = boolean | AddEventListenerOptions;
|
|
198
|
-
type UseEventListenerReturn<Target extends UseEventListenerTarget> =
|
|
200
|
+
type UseEventListenerReturn<Target extends UseEventListenerTarget> = RefObject<Target>;
|
|
199
201
|
type UseEventListener = {
|
|
200
202
|
<Event extends keyof WindowEventMap = keyof WindowEventMap>(target: Window, event: Event | Event[], listener: (this: Window, event: WindowEventMap[Event]) => void, options?: UseEventListenerOptions): void;
|
|
201
203
|
<Event extends keyof DocumentEventMap = keyof DocumentEventMap>(target: Document, event: Event | Event[], listener: (this: Document, event: DocumentEventMap[Event]) => void, options?: UseEventListenerOptions): void;
|
|
@@ -289,7 +291,7 @@ interface UseEyeDropperReturn {
|
|
|
289
291
|
declare const useEyeDropper: (initialValue?: string | undefined) => UseEyeDropperReturn;
|
|
290
292
|
|
|
291
293
|
/** The use favicon return type */
|
|
292
|
-
type UseFaviconReturn = [string,
|
|
294
|
+
type UseFaviconReturn = [string, Dispatch<SetStateAction<string>>];
|
|
293
295
|
/**
|
|
294
296
|
* @name useFavicon
|
|
295
297
|
* @description - Hook that manages the favicon
|
|
@@ -305,6 +307,101 @@ declare const useFavicon: (initialHref?: string) => {
|
|
|
305
307
|
readonly set: (favicon: string) => void;
|
|
306
308
|
};
|
|
307
309
|
|
|
310
|
+
/** The use field params */
|
|
311
|
+
interface UseFieldParams<Value> {
|
|
312
|
+
/** The initial value */
|
|
313
|
+
initialValue?: Value;
|
|
314
|
+
/** The initial touched */
|
|
315
|
+
initialTouched?: boolean;
|
|
316
|
+
/** The auto focus */
|
|
317
|
+
autoFocus?: boolean;
|
|
318
|
+
/** The validate on mount */
|
|
319
|
+
validateOnChange?: boolean;
|
|
320
|
+
/** The validate on blur */
|
|
321
|
+
validateOnBlur?: boolean;
|
|
322
|
+
/** The validate on mount */
|
|
323
|
+
validateOnMount?: boolean;
|
|
324
|
+
}
|
|
325
|
+
/** The use field register params */
|
|
326
|
+
interface UseFieldRegisterParams {
|
|
327
|
+
/** The required validation */
|
|
328
|
+
required?: string;
|
|
329
|
+
/** The min value validation */
|
|
330
|
+
max?: {
|
|
331
|
+
value: number;
|
|
332
|
+
message: string;
|
|
333
|
+
};
|
|
334
|
+
/** The max value validation */
|
|
335
|
+
min?: {
|
|
336
|
+
value: number;
|
|
337
|
+
message: string;
|
|
338
|
+
};
|
|
339
|
+
/** The max length validation */
|
|
340
|
+
maxLength?: {
|
|
341
|
+
value: number;
|
|
342
|
+
message: string;
|
|
343
|
+
};
|
|
344
|
+
/** The min length validation */
|
|
345
|
+
minLength?: {
|
|
346
|
+
value: number;
|
|
347
|
+
message: string;
|
|
348
|
+
};
|
|
349
|
+
/** The pattern validation */
|
|
350
|
+
pattern?: {
|
|
351
|
+
value: RegExp;
|
|
352
|
+
message: string;
|
|
353
|
+
};
|
|
354
|
+
/** The custom validation */
|
|
355
|
+
validate?: (value: string) => Promise<string | true>;
|
|
356
|
+
}
|
|
357
|
+
/** The use field return type */
|
|
358
|
+
interface UseFieldReturn<Value> {
|
|
359
|
+
/** The register function */
|
|
360
|
+
register: (params?: UseFieldRegisterParams) => {
|
|
361
|
+
onBlur: () => void;
|
|
362
|
+
onChange: () => void;
|
|
363
|
+
ref: (node: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | null) => void;
|
|
364
|
+
};
|
|
365
|
+
/** The get value function */
|
|
366
|
+
getValue: () => Value;
|
|
367
|
+
/** The set value function */
|
|
368
|
+
setValue: (value: Value) => void;
|
|
369
|
+
/** The dirty state */
|
|
370
|
+
dirty: boolean;
|
|
371
|
+
/** The error state */
|
|
372
|
+
error?: string;
|
|
373
|
+
/** The set error function */
|
|
374
|
+
touched: boolean;
|
|
375
|
+
/** The focus function */
|
|
376
|
+
focus: () => void;
|
|
377
|
+
/** The watch function */
|
|
378
|
+
watch: () => Value;
|
|
379
|
+
/** The reset function */
|
|
380
|
+
reset: () => void;
|
|
381
|
+
/** The set error function */
|
|
382
|
+
setError: (error: string) => void;
|
|
383
|
+
/** The set error function */
|
|
384
|
+
clearError: () => void;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* @name UseField
|
|
388
|
+
* @description - Hook to manage a form field
|
|
389
|
+
*
|
|
390
|
+
* @template Value The input value
|
|
391
|
+
* @template Type The input value type
|
|
392
|
+
* @param {Value} [params.initialValue] Initial value
|
|
393
|
+
* @param {boolean} [params.initialTouched=false] Initial touched state
|
|
394
|
+
* @param {boolean} [params.autoFocus=false] Auto focus
|
|
395
|
+
* @param {boolean} [params.validateOnChange=false] Validate on change
|
|
396
|
+
* @param {boolean} [params.validateOnBlur=false] Validate on blur
|
|
397
|
+
* @param {boolean} [params.validateOnMount=false] Validate on mount
|
|
398
|
+
* @returns {UseFieldReturn<Value>} An object containing input information
|
|
399
|
+
*
|
|
400
|
+
* @example
|
|
401
|
+
* const { register, getValue, setValue, reset, dirty, error, setError, clearError, touched, focus, watch } = useField();
|
|
402
|
+
*/
|
|
403
|
+
declare const useField: <Value extends string | boolean = string, Type = Value extends string ? string : boolean>(params?: UseFieldParams<Value>) => UseFieldReturn<Type>;
|
|
404
|
+
|
|
308
405
|
/**
|
|
309
406
|
* @name useFps
|
|
310
407
|
* @description - Hook that measures frames per second
|
|
@@ -317,7 +414,7 @@ declare const useFavicon: (initialHref?: string) => {
|
|
|
317
414
|
declare const useFps: () => number;
|
|
318
415
|
|
|
319
416
|
/** The use fullscreen target element type */
|
|
320
|
-
type UseFullScreenTarget =
|
|
417
|
+
type UseFullScreenTarget = RefObject<Element | null> | (() => Element) | Element;
|
|
321
418
|
/** The use fullscreen options type */
|
|
322
419
|
interface UseFullScreenOptions {
|
|
323
420
|
/** initial value */
|
|
@@ -337,7 +434,7 @@ interface UseFullScreenReturn {
|
|
|
337
434
|
type UseFullScreen = {
|
|
338
435
|
<Target extends UseFullScreenTarget>(target: Target, options?: UseFullScreenOptions): UseFullScreenReturn;
|
|
339
436
|
<Target extends UseFullScreenTarget>(options?: UseFullScreenOptions, target?: never): UseFullScreenReturn & {
|
|
340
|
-
ref:
|
|
437
|
+
ref: RefObject<Target>;
|
|
341
438
|
};
|
|
342
439
|
};
|
|
343
440
|
/**
|
|
@@ -360,7 +457,7 @@ type UseFullScreen = {
|
|
|
360
457
|
* @param {boolean} [options.initialValue=false] initial value of fullscreen
|
|
361
458
|
* @param {() => void} [options.onEnter] on enter fullscreen
|
|
362
459
|
* @param {() => void} [options.onExit] on exit fullscreen
|
|
363
|
-
* @returns {UseFullScreenReturn & { ref:
|
|
460
|
+
* @returns {UseFullScreenReturn & { ref: RefObject<Target> }} An object with the fullscreen state and methods
|
|
364
461
|
*
|
|
365
462
|
* @example
|
|
366
463
|
* const { ref, enter, exit, toggle, value } = useFullscreen();
|
|
@@ -422,8 +519,8 @@ interface UseHoverOptions {
|
|
|
422
519
|
onEntry?: () => void;
|
|
423
520
|
onLeave?: () => void;
|
|
424
521
|
}
|
|
425
|
-
type UseHoverTarget =
|
|
426
|
-
type UseHoverReturn<Target extends UseHoverTarget> = [
|
|
522
|
+
type UseHoverTarget = RefObject<Element | null> | Element;
|
|
523
|
+
type UseHoverReturn<Target extends UseHoverTarget> = [RefObject<Target>, boolean];
|
|
427
524
|
type UseHover = {
|
|
428
525
|
<Target extends UseHoverTarget>(target: Target, callback?: () => void): boolean;
|
|
429
526
|
<Target extends UseHoverTarget>(target: Target, options?: UseHoverOptions): boolean;
|
|
@@ -500,11 +597,11 @@ interface UseIdleReturn {
|
|
|
500
597
|
*/
|
|
501
598
|
declare const useIdle: (milliseconds?: number, { initialValue, events }?: UseIdleOptions) => UseIdleReturn;
|
|
502
599
|
|
|
503
|
-
type UseIntersectionObserverTarget =
|
|
600
|
+
type UseIntersectionObserverTarget = RefObject<Element | null> | (() => Element) | Element;
|
|
504
601
|
interface UseIntersectionObserverOptions extends Omit<IntersectionObserverInit, 'root'> {
|
|
505
602
|
enabled?: boolean;
|
|
506
603
|
onChange?: (entry: IntersectionObserverEntry) => void;
|
|
507
|
-
root?: IntersectionObserverInit['root'] |
|
|
604
|
+
root?: IntersectionObserverInit['root'] | RefObject<Element | null>;
|
|
508
605
|
}
|
|
509
606
|
interface UseIntersectionObserverReturn {
|
|
510
607
|
inView: boolean;
|
|
@@ -513,7 +610,7 @@ interface UseIntersectionObserverReturn {
|
|
|
513
610
|
type UseIntersectionObserver = {
|
|
514
611
|
<Target extends UseIntersectionObserverTarget>(target: Target, options?: UseIntersectionObserverOptions): UseIntersectionObserverReturn;
|
|
515
612
|
<Target extends UseIntersectionObserverTarget>(options?: UseIntersectionObserverOptions, target?: never): UseIntersectionObserverReturn & {
|
|
516
|
-
ref:
|
|
613
|
+
ref: RefObject<Target>;
|
|
517
614
|
};
|
|
518
615
|
};
|
|
519
616
|
declare const useIntersectionObserver: UseIntersectionObserver;
|
|
@@ -579,7 +676,7 @@ declare const useIsFirstRender: () => boolean;
|
|
|
579
676
|
* @example
|
|
580
677
|
* useIsomorphicLayoutEffect(() => console.log('effect'), [])
|
|
581
678
|
*/
|
|
582
|
-
declare const useIsomorphicLayoutEffect: typeof
|
|
679
|
+
declare const useIsomorphicLayoutEffect: typeof useEffect;
|
|
583
680
|
|
|
584
681
|
/** The use key press options type */
|
|
585
682
|
type UseKeyboardParams = {
|
|
@@ -735,17 +832,14 @@ declare const useLocalStorage: <Value>(key: string, initialValue?: UseStorageIni
|
|
|
735
832
|
*/
|
|
736
833
|
declare const useLogger: (name: string, params: unknown[]) => void;
|
|
737
834
|
|
|
738
|
-
type UseLongPressTarget =
|
|
835
|
+
type UseLongPressTarget = RefObject<Element | null> | (() => Element) | Element;
|
|
739
836
|
interface UseLongPressOptions {
|
|
740
837
|
threshold?: number;
|
|
741
838
|
onStart?: (event: Event) => void;
|
|
742
839
|
onFinish?: (event: Event) => void;
|
|
743
840
|
onCancel?: (event: Event) => void;
|
|
744
841
|
}
|
|
745
|
-
type UseLongPressReturn<Target extends UseLongPressTarget> = [
|
|
746
|
-
React.RefObject<Target>,
|
|
747
|
-
boolean
|
|
748
|
-
];
|
|
842
|
+
type UseLongPressReturn<Target extends UseLongPressTarget> = [RefObject<Target>, boolean];
|
|
749
843
|
type UseLongPress = {
|
|
750
844
|
<Target extends UseLongPressTarget>(target: Target, callback: (event: Event) => void, options?: UseLongPressOptions): boolean;
|
|
751
845
|
<Target extends UseLongPressTarget>(callback: (event: Event) => void, options?: UseLongPressOptions, target?: never): UseLongPressReturn<Target>;
|
|
@@ -798,15 +892,15 @@ declare const useMediaQuery: (query: string) => boolean;
|
|
|
798
892
|
* @name useMount
|
|
799
893
|
* @description - Hook that executes a callback when the component mounts
|
|
800
894
|
*
|
|
801
|
-
* @param {
|
|
895
|
+
* @param {EffectCallback} effect The callback to execute
|
|
802
896
|
*
|
|
803
897
|
* @example
|
|
804
898
|
* useMount(() => console.log('This effect runs on the initial render'));
|
|
805
899
|
*/
|
|
806
|
-
declare const useMount: (effect:
|
|
900
|
+
declare const useMount: (effect: EffectCallback) => void;
|
|
807
901
|
|
|
808
902
|
/** The use mouse target element type */
|
|
809
|
-
type UseMouseTarget =
|
|
903
|
+
type UseMouseTarget = RefObject<Element | null> | (() => Element) | Element;
|
|
810
904
|
/** The use mouse return type */
|
|
811
905
|
interface UseMouseReturn {
|
|
812
906
|
/** The current mouse x position */
|
|
@@ -825,7 +919,7 @@ interface UseMouseReturn {
|
|
|
825
919
|
type UseMouse = {
|
|
826
920
|
<Target extends UseMouseTarget>(target: Target): UseMouseReturn;
|
|
827
921
|
<Target extends UseMouseTarget>(target?: never): UseMouseReturn & {
|
|
828
|
-
ref:
|
|
922
|
+
ref: RefObject<Target>;
|
|
829
923
|
};
|
|
830
924
|
};
|
|
831
925
|
/**
|
|
@@ -842,7 +936,7 @@ type UseMouse = {
|
|
|
842
936
|
*
|
|
843
937
|
* @overload
|
|
844
938
|
* @template Target The target element
|
|
845
|
-
* @returns {UseMouseReturn & { ref:
|
|
939
|
+
* @returns {UseMouseReturn & { ref: RefObject<Target> }} An object with the current mouse position and a ref
|
|
846
940
|
*
|
|
847
941
|
* @example
|
|
848
942
|
* const { ref, x, y, elementX, elementY, elementPositionX, elementPositionY } = useMouse();
|
|
@@ -922,6 +1016,7 @@ declare const useNetwork: () => UseNetworkReturn;
|
|
|
922
1016
|
*/
|
|
923
1017
|
declare const useOnline: () => boolean;
|
|
924
1018
|
|
|
1019
|
+
/** The operating system type */
|
|
925
1020
|
type OperatingSystem = 'undetermined' | 'macos' | 'ios' | 'windows' | 'android' | 'linux';
|
|
926
1021
|
declare const getOperatingSystem: () => OperatingSystem;
|
|
927
1022
|
/**
|
|
@@ -977,16 +1072,16 @@ type UsePaintOptions = UsePaintPencil;
|
|
|
977
1072
|
/** The use paint return type */
|
|
978
1073
|
interface UsePaintReturn {
|
|
979
1074
|
pencil: UsePaintPencil & {
|
|
980
|
-
set:
|
|
1075
|
+
set: Dispatch<SetStateAction<UsePaintPencil>>;
|
|
981
1076
|
};
|
|
982
1077
|
drawing: boolean;
|
|
983
1078
|
}
|
|
984
|
-
type UsePaintTarget =
|
|
1079
|
+
type UsePaintTarget = RefObject<HTMLCanvasElement> | (() => HTMLCanvasElement) | HTMLCanvasElement;
|
|
985
1080
|
declare const getTargetElement: (target: UsePaintTarget) => HTMLCanvasElement | null;
|
|
986
1081
|
type UsePaint = {
|
|
987
1082
|
<Target extends UsePaintTarget>(target: Target, options?: UsePaintOptions): UsePaintReturn;
|
|
988
1083
|
(options?: UsePaintOptions, target?: never): UsePaintReturn & {
|
|
989
|
-
ref:
|
|
1084
|
+
ref: RefObject<HTMLCanvasElement>;
|
|
990
1085
|
};
|
|
991
1086
|
};
|
|
992
1087
|
/**
|
|
@@ -1004,7 +1099,7 @@ type UsePaint = {
|
|
|
1004
1099
|
*
|
|
1005
1100
|
* @overload
|
|
1006
1101
|
* @param {UsePaintOptions} [options] The options to be used
|
|
1007
|
-
* @returns {UsePaintReturn & { ref:
|
|
1102
|
+
* @returns {UsePaintReturn & { ref: RefObject<HTMLCanvasElement> }} An object containing the current pencil options and functions to interact with the paint
|
|
1008
1103
|
*
|
|
1009
1104
|
* @example
|
|
1010
1105
|
* const { ref, pencil, drawing } = usePaint();
|
|
@@ -1048,8 +1143,25 @@ declare const usePreferredLanguages: () => readonly string[];
|
|
|
1048
1143
|
*/
|
|
1049
1144
|
declare const usePrevious: <Value>(value: Value) => Value | undefined;
|
|
1050
1145
|
|
|
1146
|
+
/**
|
|
1147
|
+
* @name useQRCode
|
|
1148
|
+
* @description - Hook that generates a QR code
|
|
1149
|
+
*
|
|
1150
|
+
* @param {string} text The text to be encoded in the QR code
|
|
1151
|
+
* @param {QRCode.QRCodeToDataURLOptions} [options] The options of the QR code
|
|
1152
|
+
* @returns {UseQrCodeReturn} An object with the QR code value and a setter
|
|
1153
|
+
*
|
|
1154
|
+
* @example
|
|
1155
|
+
* const { value, set } = useQRCode('url');
|
|
1156
|
+
*/
|
|
1157
|
+
declare const useQRCode: (text?: string, options?: QRCode.QRCodeToDataURLOptions) => {
|
|
1158
|
+
value: string | undefined;
|
|
1159
|
+
set: (value: string) => Promise<void>;
|
|
1160
|
+
isLoading: boolean;
|
|
1161
|
+
};
|
|
1162
|
+
|
|
1051
1163
|
interface UseQueryOptions<QueryData, Data> {
|
|
1052
|
-
keys?:
|
|
1164
|
+
keys?: DependencyList;
|
|
1053
1165
|
onSuccess?: (data: Data) => void;
|
|
1054
1166
|
onError?: (error: Error) => void;
|
|
1055
1167
|
select?: (data: QueryData) => Data;
|
|
@@ -1072,7 +1184,7 @@ interface UseQueryReturn<Data> {
|
|
|
1072
1184
|
*
|
|
1073
1185
|
* @template Data - The type of the data
|
|
1074
1186
|
* @param {() => Promise<Data>} callback - The callback function to be invoked
|
|
1075
|
-
* @param {
|
|
1187
|
+
* @param {DependencyList} [options.keys] - The dependencies for the hook
|
|
1076
1188
|
* @param {(data: Data) => void} [options.onSuccess] - The callback function to be invoked on success
|
|
1077
1189
|
* @param {(error: Error) => void} [options.onError] - The callback function to be invoked on error
|
|
1078
1190
|
* @param {UseQueryOptionsSelect<Data>} [options.select] - The select function to be invoked
|
|
@@ -1168,7 +1280,7 @@ declare const useRerender: () => UseRerenderReturns;
|
|
|
1168
1280
|
type UseScriptStatus = 'loading' | 'ready' | 'error' | 'unknown';
|
|
1169
1281
|
declare const SCRIPT_STATUS_ATTRIBUTE_NAME = "script-status";
|
|
1170
1282
|
/** The use script options extends from attributes script tag */
|
|
1171
|
-
interface UseScriptOptions extends
|
|
1283
|
+
interface UseScriptOptions extends ComponentProps<'script'> {
|
|
1172
1284
|
/** Whether to remove the script on unmount */
|
|
1173
1285
|
removeOnUnmount?: boolean;
|
|
1174
1286
|
}
|
|
@@ -1381,7 +1493,7 @@ type UseToggleReturn<Value> = readonly [Value, (value?: Value) => void];
|
|
|
1381
1493
|
* @example
|
|
1382
1494
|
* const [value, toggle] = useToggle(['light', 'dark'] as const);
|
|
1383
1495
|
*/
|
|
1384
|
-
declare const useToggle: <Value = boolean>(values?: readonly Value[]) => readonly [Value, (value?:
|
|
1496
|
+
declare const useToggle: <Value = boolean>(values?: readonly Value[]) => readonly [Value, (value?: SetStateAction<Value>) => void];
|
|
1385
1497
|
|
|
1386
1498
|
/**
|
|
1387
1499
|
* @name useUnmount
|
|
@@ -1395,6 +1507,41 @@ declare const useToggle: <Value = boolean>(values?: readonly Value[]) => readonl
|
|
|
1395
1507
|
*/
|
|
1396
1508
|
declare const useUnmount: (callback: () => void) => void;
|
|
1397
1509
|
|
|
1510
|
+
type UseWebSocketUrl = string | (() => string);
|
|
1511
|
+
interface UseWebSocketOptions {
|
|
1512
|
+
onConnected?: (webSocket: WebSocket) => void;
|
|
1513
|
+
onDisconnected?: (event: CloseEvent, webSocket: WebSocket) => void;
|
|
1514
|
+
onError?: (event: Event, webSocket: WebSocket) => void;
|
|
1515
|
+
onMessage?: (event: MessageEvent, webSocket: WebSocket) => void;
|
|
1516
|
+
retry?: boolean | number;
|
|
1517
|
+
protocols?: Array<'soap' | 'wasm'>;
|
|
1518
|
+
}
|
|
1519
|
+
type UseWebSocketStatus = 'connecting' | 'failed' | 'connected' | 'disconnected';
|
|
1520
|
+
interface UseWebSocketReturn {
|
|
1521
|
+
status: UseWebSocketStatus;
|
|
1522
|
+
close: WebSocket['close'];
|
|
1523
|
+
send: WebSocket['send'];
|
|
1524
|
+
open: () => void;
|
|
1525
|
+
client?: WebSocket;
|
|
1526
|
+
}
|
|
1527
|
+
/**
|
|
1528
|
+
* @name useWebSocket
|
|
1529
|
+
* @description - Hook that connects to a WebSocket server and handles incoming and outgoing messages
|
|
1530
|
+
*
|
|
1531
|
+
* @param {UseWebSocketUrl} url The URL of the WebSocket server
|
|
1532
|
+
* @param {(webSocket: WebSocket) => void} [options.onConnected] The callback function that is called when the WebSocket connection is established
|
|
1533
|
+
* @param {(event: CloseEvent, webSocket: WebSocket) => void} [options.onDisconnected] The callback function that is called when the WebSocket connection is closed
|
|
1534
|
+
* @param {(event: Event, webSocket: WebSocket) => void} [options.onError] The callback function that is called when an error occurs
|
|
1535
|
+
* @param {(event: MessageEvent, webSocket: WebSocket) => void} [options.onMessage] The callback function that is called when a message is received
|
|
1536
|
+
* @param {boolean | number} [options.retry] The number of times to retry the connection
|
|
1537
|
+
* @param {Array<'soap' | 'wasm'>} [options.protocols] The list of protocols to use
|
|
1538
|
+
* @returns {UseWebSocketReturn} An object with the status, close, send, open, and ws properties
|
|
1539
|
+
*
|
|
1540
|
+
* @example
|
|
1541
|
+
* const { status, close, send, open, client } = useWebSocket('url');
|
|
1542
|
+
*/
|
|
1543
|
+
declare const useWebSocket: (url: UseWebSocketUrl, options?: UseWebSocketOptions) => UseWebSocketReturn;
|
|
1544
|
+
|
|
1398
1545
|
/**
|
|
1399
1546
|
* @name useWindowEvent
|
|
1400
1547
|
* @description - Hook attaches an event listener to the window object for the specified event
|
|
@@ -1462,4 +1609,4 @@ declare const getDate: (now?: Date) => {
|
|
|
1462
1609
|
timestamp: number;
|
|
1463
1610
|
};
|
|
1464
1611
|
|
|
1465
|
-
export { type ConnectionEffectiveType, type ConnectionType, type OperatingSystem, SCRIPT_STATUS_ATTRIBUTE_NAME, type UseClickOutside, type UseClickOutsideReturn, type UseCounter, type UseCounterOptions, type UseCounterParams, type UseCounterReturn, type UseDocumentTitleOptions, type UseDocumentTitleReturn, type UseEventListener, type UseEventListenerOptions, type UseEventListenerReturn, type UseEventListenerTarget, type UseEyeDropperReturn, type UseFaviconReturn, type UseFullScreen, type UseFullScreenOptions, type UseFullScreenReturn, type UseHotkeysHotkeys, type UseHotkeysKey, type UseHotkeysOptions, type UseHover, type UseHoverOptions, type UseHoverReturn, type UseHoverTarget, type UseIdleReturn, type UseIntersectionObserver, type UseIntersectionObserverOptions, type UseIntersectionObserverReturn, type UseIntersectionObserverTarget, type UseIntervalOptions, type UseIntervalReturn, type UseKeyPressEvent, type UseKeyPressEventKey, type UseKeyPressKey, type UseKeyPressOptions, type UseKeyboardParams, type UseListReturn, type UseLongPress, type UseLongPressReturn, type UseLongPressTarget, type UseMouse, type UseMouseReturn, type UseNetworkReturn, type UseOrientationReturn, type UsePaint, type UsePaintOptions, type UsePaintPencil, type UsePaintReturn, type UsePaintTarget, type UsePreferredColorSchemeReturn, type UseQueueReturn, type UseRenderInfoReturn, type UseScriptOptions, type UseScriptStatus, type UseStorageInitialValue, type UseStorageOptions, type UseStorageReturn, type UseTextSelectionReturn, type UseTimeReturn, type UseToggleReturn, type UseWindowSizeReturn, debounce, dispatchStorageEvent, getConnection, getDate, getOperatingSystem, getRangesSelection, getRetry, getTargetElement, isClient, isHotkeyMatch, legacyCopyToClipboard, throttle, useBattery, useBoolean, useBrowserLanguage, useClickOutside, useCopyToClipboard, useCounter, useDebouncedValue, useDefault, useDidUpdate, useDocumentEvent, useDocumentTitle, useDocumentVisibility, useEvent, useEventListener, useEyeDropper, useFavicon, useFps, useFullscreen, useHash, useHotkeys, useHover, useIdle, useIntersectionObserver, useInterval, useIsFirstRender, useIsomorphicLayoutEffect, useKeyPress, useKeyPressEvent, useKeyboard, useKeysPressed, useList, useLocalStorage, useLogger, useLongPress, useMediaQuery, useMount, useMouse, useMutation, useNetwork, useOnline, useOperatingSystem, useOrientation, usePageLeave, usePaint, usePreferredColorScheme, usePreferredLanguages, usePrevious, useQuery, useQueue, useRenderCount, useRenderInfo, useRerender, useScript, useSessionStorage, useSet, useStep, useStorage, useTextSelection, useTime, useTimeout, useToggle, useUnmount, useWindowEvent, useWindowSize };
|
|
1612
|
+
export { type ConnectionEffectiveType, type ConnectionType, type OperatingSystem, SCRIPT_STATUS_ATTRIBUTE_NAME, type UseClickOutside, type UseClickOutsideReturn, type UseCounter, type UseCounterOptions, type UseCounterParams, type UseCounterReturn, type UseDocumentTitleOptions, type UseDocumentTitleReturn, type UseEventListener, type UseEventListenerOptions, type UseEventListenerReturn, type UseEventListenerTarget, type UseEyeDropperReturn, type UseFaviconReturn, type UseFieldParams, type UseFieldRegisterParams, type UseFieldReturn, type UseFullScreen, type UseFullScreenOptions, type UseFullScreenReturn, type UseHotkeysHotkeys, type UseHotkeysKey, type UseHotkeysOptions, type UseHover, type UseHoverOptions, type UseHoverReturn, type UseHoverTarget, type UseIdleReturn, type UseIntersectionObserver, type UseIntersectionObserverOptions, type UseIntersectionObserverReturn, type UseIntersectionObserverTarget, type UseIntervalOptions, type UseIntervalReturn, type UseKeyPressEvent, type UseKeyPressEventKey, type UseKeyPressKey, type UseKeyPressOptions, type UseKeyboardParams, type UseListReturn, type UseLongPress, type UseLongPressReturn, type UseLongPressTarget, type UseMouse, type UseMouseReturn, type UseNetworkReturn, type UseOrientationReturn, type UsePaint, type UsePaintOptions, type UsePaintPencil, type UsePaintReturn, type UsePaintTarget, type UsePreferredColorSchemeReturn, type UseQueueReturn, type UseRenderInfoReturn, type UseScriptOptions, type UseScriptStatus, type UseStorageInitialValue, type UseStorageOptions, type UseStorageReturn, type UseTextSelectionReturn, type UseTimeReturn, type UseToggleReturn, type UseWebSocketOptions, type UseWebSocketReturn, type UseWebSocketStatus, type UseWebSocketUrl, type UseWindowSizeReturn, debounce, dispatchStorageEvent, getConnection, getDate, getOperatingSystem, getRangesSelection, getRetry, getTargetElement, isClient, isHotkeyMatch, legacyCopyToClipboard, throttle, useBattery, useBoolean, useBrowserLanguage, useClickOutside, useCopyToClipboard, useCounter, useDebouncedValue, useDefault, useDidUpdate, useDocumentEvent, useDocumentTitle, useDocumentVisibility, useEvent, useEventListener, useEyeDropper, useFavicon, useField, useFps, useFullscreen, useHash, useHotkeys, useHover, useIdle, useIntersectionObserver, useInterval, useIsFirstRender, useIsomorphicLayoutEffect, useKeyPress, useKeyPressEvent, useKeyboard, useKeysPressed, useList, useLocalStorage, useLogger, useLongPress, useMediaQuery, useMount, useMouse, useMutation, useNetwork, useOnline, useOperatingSystem, useOrientation, usePageLeave, usePaint, usePreferredColorScheme, usePreferredLanguages, usePrevious, useQRCode, useQuery, useQueue, useRenderCount, useRenderInfo, useRerender, useScript, useSessionStorage, useSet, useStep, useStorage, useTextSelection, useTime, useTimeout, useToggle, useUnmount, useWebSocket, useWindowEvent, useWindowSize };
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_rollupPluginBabelHelpers-CntznmQ7.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_rollupPluginBabelHelpers-DsV9C8-q.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|