@siberiacancode/reactuse 0.0.23 → 0.0.25
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-OXydtwwP.js → _rollupPluginBabelHelpers-CelQL84P.js} +2 -2
- package/dist/cjs/_rollupPluginBabelHelpers-CelQL84P.js.map +1 -0
- package/dist/cjs/hooks/index.js +2 -2
- package/dist/cjs/hooks/useBattery/useBattery.js +2 -2
- package/dist/cjs/hooks/useBoolean/useBoolean.js +2 -2
- package/dist/cjs/hooks/useBrowserLanguage/useBrowserLanguage.js +3 -0
- package/dist/cjs/hooks/useBrowserLanguage/useBrowserLanguage.js.map +1 -0
- package/dist/cjs/hooks/useClickOutside/useClickOutside.js +1 -1
- package/dist/cjs/hooks/useCopyToClipboard/useCopyToClipboard.js +2 -2
- package/dist/cjs/hooks/useCounter/useCounter.js +2 -2
- package/dist/cjs/hooks/useCounter/useCounter.js.map +1 -1
- package/dist/cjs/hooks/useDebouncedValue/useDebouncedValue.js +2 -2
- package/dist/cjs/hooks/useDefault/useDefault.js +2 -2
- package/dist/cjs/hooks/useDidUpdate/useDidUpdate.js +1 -1
- package/dist/cjs/hooks/useDidUpdate/useDidUpdate.js.map +1 -1
- package/dist/cjs/hooks/useDocumentEvent/useDocumentEvent.js +3 -0
- package/dist/cjs/hooks/useDocumentEvent/useDocumentEvent.js.map +1 -0
- package/dist/cjs/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
- package/dist/cjs/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
- package/dist/cjs/hooks/useEvent/useEvent.js +1 -1
- package/dist/cjs/hooks/useEventListener/useEventListener.js +1 -1
- package/dist/cjs/hooks/useEyeDropper/useEyeDropper.js +3 -0
- package/dist/cjs/hooks/useEyeDropper/useEyeDropper.js.map +1 -0
- package/dist/cjs/hooks/useFavicon/useFavicon.js +2 -2
- package/dist/cjs/hooks/useFps/useFps.js +3 -0
- package/dist/cjs/hooks/useFps/useFps.js.map +1 -0
- package/dist/cjs/hooks/useFullscreen/useFullscreen.js +2 -2
- package/dist/cjs/hooks/useHash/useHash.js +2 -2
- package/dist/cjs/hooks/useHotkeys/useHotkeys.js +2 -2
- package/dist/cjs/hooks/useHover/useHover.js +2 -2
- package/dist/cjs/hooks/useIdle/useIdle.js +2 -2
- package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -2
- package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.js.map +1 -1
- package/dist/cjs/hooks/useInterval/useInterval.js +2 -2
- package/dist/cjs/hooks/useInterval/useInterval.js.map +1 -1
- package/dist/cjs/hooks/useIsFirstRender/useIsFirstRender.js +1 -1
- package/dist/cjs/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +1 -1
- package/dist/cjs/hooks/useKeyPress/useKeyPress.js +2 -2
- package/dist/cjs/hooks/useKeyPressEvent/useKeyPressEvent.js +1 -1
- package/dist/cjs/hooks/useKeyboard/useKeyboard.js +1 -1
- package/dist/cjs/hooks/useKeysPressed/useKeysPressed.js +2 -2
- package/dist/cjs/hooks/useList/useList.js +2 -2
- package/dist/cjs/hooks/useLocalStorage/useLocalStorage.js +2 -2
- package/dist/cjs/hooks/useLogger/useLogger.js +2 -2
- package/dist/cjs/hooks/useLongPress/useLongPress.js +2 -2
- package/dist/cjs/hooks/useLongPress/useLongPress.js.map +1 -1
- package/dist/cjs/hooks/useMediaQuery/useMediaQuery.js +1 -1
- package/dist/cjs/hooks/useMount/useMount.js +1 -1
- package/dist/cjs/hooks/useMouse/useMouse.js +2 -2
- package/dist/cjs/hooks/useMouse/useMouse.js.map +1 -1
- package/dist/cjs/hooks/useMutation/useMutation.js +2 -2
- package/dist/cjs/hooks/useMutationObserver.js +1 -1
- package/dist/cjs/hooks/useNetwork/useNetwork.js +2 -2
- package/dist/cjs/hooks/useOnline/useOnline.js +1 -1
- package/dist/cjs/hooks/useOperatingSystem/useOperatingSystem.js +1 -1
- package/dist/cjs/hooks/useOrientation/useOrientation.js +2 -2
- package/dist/cjs/hooks/usePageLeave/usePageLeave.js +1 -1
- package/dist/cjs/hooks/usePaint/usePaint.js +3 -0
- package/dist/cjs/hooks/usePaint/usePaint.js.map +1 -0
- package/dist/cjs/hooks/usePreferredColorScheme/usePreferredColorScheme.js +1 -1
- package/dist/cjs/hooks/usePreferredLanguages/usePreferredLanguages.js +2 -2
- package/dist/cjs/hooks/usePreferredLanguages/usePreferredLanguages.js.map +1 -1
- package/dist/cjs/hooks/usePrevious/usePrevious.js +1 -1
- package/dist/cjs/hooks/useQuery/useQuery.js +2 -2
- package/dist/cjs/hooks/useQueue/useQueue.js +2 -2
- package/dist/cjs/hooks/useRenderCount/useRenderCount.js +1 -1
- package/dist/cjs/hooks/useRerender/useRerender.js +2 -2
- package/dist/cjs/hooks/useScript/useScript.js +2 -2
- package/dist/cjs/hooks/useSessionStorage/useSessionStorage.js +2 -2
- package/dist/cjs/hooks/useSet/useSet.js +2 -2
- package/dist/cjs/hooks/useStep/useStep.js +2 -2
- package/dist/cjs/hooks/useStorage/useStorage.js +2 -2
- package/dist/cjs/hooks/useTextSelection/useTextSelection.js +2 -2
- package/dist/cjs/hooks/useTime/useTime.js +3 -0
- package/dist/cjs/hooks/useTime/useTime.js.map +1 -0
- package/dist/cjs/hooks/useTimeout/useTimeout.js +2 -2
- package/dist/cjs/hooks/useTimeout/useTimeout.js.map +1 -1
- package/dist/cjs/hooks/useToggle/useToggle.js +2 -2
- package/dist/cjs/hooks/useUnmount/useUnmount.js +1 -1
- package/dist/cjs/hooks/useWindowEvent/useWindowEvent.js +1 -1
- package/dist/cjs/hooks/useWindowSize/useWindowSize.js +2 -2
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/utils/helpers/debounce.js +1 -1
- package/dist/cjs/utils/helpers/getRetry.js +1 -1
- package/dist/cjs/utils/helpers/index.js +2 -2
- package/dist/cjs/utils/helpers/isClient.js +1 -1
- package/dist/cjs/utils/helpers/throttle.js +1 -1
- package/dist/cjs/utils/helpers/time/getDate.js +3 -0
- package/dist/cjs/utils/helpers/time/getDate.js.map +1 -0
- package/dist/esm/{_rollupPluginBabelHelpers-Ca7xtMt2.js → _rollupPluginBabelHelpers-DICH7_UH.js} +2 -2
- package/dist/esm/_rollupPluginBabelHelpers-DICH7_UH.js.map +1 -0
- package/dist/esm/hooks/index.js +2 -2
- package/dist/esm/hooks/useBattery/useBattery.js +2 -2
- package/dist/esm/hooks/useBoolean/useBoolean.js +2 -2
- package/dist/esm/hooks/useBrowserLanguage/useBrowserLanguage.js +3 -0
- package/dist/esm/hooks/useBrowserLanguage/useBrowserLanguage.js.map +1 -0
- package/dist/esm/hooks/useClickOutside/useClickOutside.js +1 -1
- package/dist/esm/hooks/useCopyToClipboard/useCopyToClipboard.js +2 -2
- package/dist/esm/hooks/useCounter/useCounter.js +2 -2
- package/dist/esm/hooks/useCounter/useCounter.js.map +1 -1
- package/dist/esm/hooks/useDebouncedValue/useDebouncedValue.js +2 -2
- package/dist/esm/hooks/useDefault/useDefault.js +2 -2
- package/dist/esm/hooks/useDidUpdate/useDidUpdate.js +1 -1
- package/dist/esm/hooks/useDidUpdate/useDidUpdate.js.map +1 -1
- package/dist/esm/hooks/useDocumentEvent/useDocumentEvent.js +3 -0
- package/dist/esm/hooks/useDocumentEvent/useDocumentEvent.js.map +1 -0
- package/dist/esm/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
- package/dist/esm/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
- package/dist/esm/hooks/useEvent/useEvent.js +1 -1
- package/dist/esm/hooks/useEventListener/useEventListener.js +1 -1
- package/dist/esm/hooks/useEyeDropper/useEyeDropper.js +3 -0
- package/dist/esm/hooks/useEyeDropper/useEyeDropper.js.map +1 -0
- package/dist/esm/hooks/useFavicon/useFavicon.js +2 -2
- package/dist/esm/hooks/useFps/useFps.js +3 -0
- package/dist/esm/hooks/useFps/useFps.js.map +1 -0
- package/dist/esm/hooks/useFullscreen/useFullscreen.js +2 -2
- package/dist/esm/hooks/useHash/useHash.js +2 -2
- package/dist/esm/hooks/useHotkeys/useHotkeys.js +2 -2
- package/dist/esm/hooks/useHover/useHover.js +2 -2
- package/dist/esm/hooks/useIdle/useIdle.js +2 -2
- package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -2
- package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.js.map +1 -1
- package/dist/esm/hooks/useInterval/useInterval.js +2 -2
- package/dist/esm/hooks/useInterval/useInterval.js.map +1 -1
- package/dist/esm/hooks/useIsFirstRender/useIsFirstRender.js +1 -1
- package/dist/esm/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +1 -1
- package/dist/esm/hooks/useKeyPress/useKeyPress.js +2 -2
- package/dist/esm/hooks/useKeyPressEvent/useKeyPressEvent.js +1 -1
- package/dist/esm/hooks/useKeyboard/useKeyboard.js +1 -1
- package/dist/esm/hooks/useKeysPressed/useKeysPressed.js +2 -2
- package/dist/esm/hooks/useList/useList.js +2 -2
- package/dist/esm/hooks/useLocalStorage/useLocalStorage.js +2 -2
- package/dist/esm/hooks/useLogger/useLogger.js +2 -2
- package/dist/esm/hooks/useLongPress/useLongPress.js +2 -2
- package/dist/esm/hooks/useLongPress/useLongPress.js.map +1 -1
- package/dist/esm/hooks/useMediaQuery/useMediaQuery.js +1 -1
- package/dist/esm/hooks/useMount/useMount.js +1 -1
- package/dist/esm/hooks/useMouse/useMouse.js +2 -2
- package/dist/esm/hooks/useMouse/useMouse.js.map +1 -1
- package/dist/esm/hooks/useMutation/useMutation.js +2 -2
- package/dist/esm/hooks/useMutationObserver.js +1 -1
- package/dist/esm/hooks/useNetwork/useNetwork.js +2 -2
- package/dist/esm/hooks/useOnline/useOnline.js +1 -1
- package/dist/esm/hooks/useOperatingSystem/useOperatingSystem.js +1 -1
- package/dist/esm/hooks/useOrientation/useOrientation.js +2 -2
- package/dist/esm/hooks/usePageLeave/usePageLeave.js +1 -1
- package/dist/esm/hooks/usePaint/usePaint.js +3 -0
- package/dist/esm/hooks/usePaint/usePaint.js.map +1 -0
- package/dist/esm/hooks/usePreferredColorScheme/usePreferredColorScheme.js +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 +1 -1
- package/dist/esm/hooks/useQuery/useQuery.js +2 -2
- package/dist/esm/hooks/useQueue/useQueue.js +2 -2
- package/dist/esm/hooks/useRenderCount/useRenderCount.js +1 -1
- package/dist/esm/hooks/useRerender/useRerender.js +2 -2
- package/dist/esm/hooks/useScript/useScript.js +2 -2
- package/dist/esm/hooks/useSessionStorage/useSessionStorage.js +2 -2
- package/dist/esm/hooks/useSet/useSet.js +2 -2
- package/dist/esm/hooks/useStep/useStep.js +2 -2
- package/dist/esm/hooks/useStorage/useStorage.js +2 -2
- package/dist/esm/hooks/useTextSelection/useTextSelection.js +2 -2
- package/dist/esm/hooks/useTime/useTime.js +3 -0
- package/dist/esm/hooks/useTime/useTime.js.map +1 -0
- package/dist/esm/hooks/useTimeout/useTimeout.js +2 -2
- package/dist/esm/hooks/useTimeout/useTimeout.js.map +1 -1
- package/dist/esm/hooks/useToggle/useToggle.js +2 -2
- package/dist/esm/hooks/useUnmount/useUnmount.js +1 -1
- package/dist/esm/hooks/useWindowEvent/useWindowEvent.js +1 -1
- package/dist/esm/hooks/useWindowSize/useWindowSize.js +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/utils/helpers/debounce.js +1 -1
- package/dist/esm/utils/helpers/getRetry.js +1 -1
- package/dist/esm/utils/helpers/index.js +2 -2
- package/dist/esm/utils/helpers/isClient.js +1 -1
- package/dist/esm/utils/helpers/throttle.js +1 -1
- package/dist/esm/utils/helpers/time/getDate.js +3 -0
- package/dist/esm/utils/helpers/time/getDate.js.map +1 -0
- package/dist/index.d.ts +157 -21
- package/package.json +1 -1
- package/dist/cjs/_rollupPluginBabelHelpers-OXydtwwP.js.map +0 -1
- package/dist/esm/_rollupPluginBabelHelpers-Ca7xtMt2.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -45,6 +45,17 @@ type UseBooleanReturn = [
|
|
|
45
45
|
*/
|
|
46
46
|
declare const useBoolean: (initialValue?: boolean) => UseBooleanReturn;
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* @name useBrowserLanguage
|
|
50
|
+
* @description - Hook that returns the current browser language
|
|
51
|
+
*
|
|
52
|
+
* @returns {string} The current browser language
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* const browserLanguage = useBrowserLanguage();
|
|
56
|
+
*/
|
|
57
|
+
declare const useBrowserLanguage: () => string;
|
|
58
|
+
|
|
48
59
|
/** The use click outside target element type */
|
|
49
60
|
type UseClickOutsideTarget = React.RefObject<Element | null> | (() => Element) | Element;
|
|
50
61
|
/** The use click outside return type */
|
|
@@ -95,7 +106,7 @@ interface UseCopyToClipboardReturn {
|
|
|
95
106
|
*/
|
|
96
107
|
declare const useCopyToClipboard: () => UseCopyToClipboardReturn;
|
|
97
108
|
|
|
98
|
-
/** The use counter options
|
|
109
|
+
/** The use counter options */
|
|
99
110
|
interface UseCounterOptions {
|
|
100
111
|
/** The min of count value */
|
|
101
112
|
min?: number;
|
|
@@ -136,16 +147,15 @@ type UseCounter = {
|
|
|
136
147
|
* @param {number} [options.min=Number.NEGATIVE_INFINITY] The min of count value
|
|
137
148
|
* @param {number} [options.max=Number.POSITIVE_INFINITY] The max of count value
|
|
138
149
|
* @returns {UseCounterReturn} An object containing the current count and functions to interact with the counter
|
|
139
|
-
|
|
140
|
-
* @example
|
|
141
|
-
* const { count, dec, inc, reset, set } = useCounter(5);
|
|
142
|
-
*
|
|
150
|
+
|
|
143
151
|
* @overload
|
|
144
152
|
* @param {number} [params.initialValue=0] The initial number value
|
|
145
153
|
* @param {number} [params.min=Number.NEGATIVE_INFINITY] The min of count value
|
|
146
154
|
* @param {number} [params.max=Number.POSITIVE_INFINITY] The max of count value
|
|
147
155
|
* @returns {UseCounterReturn} An object containing the current count and functions to interact with the counter
|
|
148
156
|
*
|
|
157
|
+
* @example
|
|
158
|
+
* const { count, dec, inc, reset, set } = useCounter(5);
|
|
149
159
|
*
|
|
150
160
|
* @example
|
|
151
161
|
* const { count, dec, inc, reset, set } = useCounter({ initialValue: 5, min: 0, max: 10 });
|
|
@@ -179,12 +189,37 @@ declare const useDefault: <Value>(initialValue: Value | (() => Value), defaultVa
|
|
|
179
189
|
* @param {React.DependencyList} [deps] The dependencies list for the effect
|
|
180
190
|
*
|
|
181
191
|
* @example
|
|
182
|
-
* useDidUpdate(() =>
|
|
183
|
-
* console.log('Won't be called when mounted');
|
|
184
|
-
* }, [deps]);
|
|
192
|
+
* useDidUpdate(() => console.log('Won't be called when mounted'), [deps]);
|
|
185
193
|
*/
|
|
186
194
|
declare const useDidUpdate: (effect: React.EffectCallback, deps?: React.DependencyList) => void;
|
|
187
195
|
|
|
196
|
+
type UseEventListenerTarget = React.RefObject<Element | null> | (() => Element) | Element | Window | Document;
|
|
197
|
+
type UseEventListenerOptions = boolean | AddEventListenerOptions;
|
|
198
|
+
type UseEventListenerReturn<Target extends UseEventListenerTarget> = React.RefObject<Target>;
|
|
199
|
+
type UseEventListener = {
|
|
200
|
+
<Event extends keyof WindowEventMap = keyof WindowEventMap>(target: Window, event: Event | Event[], listener: (this: Window, event: WindowEventMap[Event]) => void, options?: UseEventListenerOptions): void;
|
|
201
|
+
<Event extends keyof DocumentEventMap = keyof DocumentEventMap>(target: Document, event: Event | Event[], listener: (this: Document, event: DocumentEventMap[Event]) => void, options?: UseEventListenerOptions): void;
|
|
202
|
+
<Target extends UseEventListenerTarget, Event extends keyof HTMLElementEventMap = keyof HTMLElementEventMap>(target: Target, event: Event | Event[], listener: (this: Target, event: HTMLElementEventMap[Event]) => void, options?: UseEventListenerOptions): void;
|
|
203
|
+
<Target extends Element, Event extends keyof HTMLElementEventMap = keyof HTMLElementEventMap>(event: Event | Event[], listener: (this: Target, event: HTMLElementEventMap[Event]) => void, options?: UseEventListenerOptions, target?: never): UseEventListenerReturn<Target>;
|
|
204
|
+
<Target extends Element, Event extends keyof MediaQueryListEventMap = keyof MediaQueryListEventMap>(event: Event | Event[], listener: (this: Target, event: MediaQueryListEventMap[Event]) => void, options?: UseEventListenerOptions, target?: never): UseEventListenerReturn<Target>;
|
|
205
|
+
};
|
|
206
|
+
declare const useEventListener: UseEventListener;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* @name useDocumentEvent
|
|
210
|
+
* @description - Hook attaches an event listener to the document object for the specified event
|
|
211
|
+
*
|
|
212
|
+
* @template Event Key of document event map.
|
|
213
|
+
* @param {Event} event The event to listen for.
|
|
214
|
+
* @param {(event: DocumentEventMap[Event]) => void} listener The callback function to be executed when the event is triggered
|
|
215
|
+
* @param {UseEventListenerOptions} [options] The options for the event listener
|
|
216
|
+
* @returns {void}
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* useDocumentEvent('click', () => console.log('clicked'));
|
|
220
|
+
*/
|
|
221
|
+
declare const useDocumentEvent: <Event extends keyof DocumentEventMap>(event: Event, listener: (this: Document, event: DocumentEventMap[Event]) => any, options?: UseEventListenerOptions) => void;
|
|
222
|
+
|
|
188
223
|
/** The use document title options type */
|
|
189
224
|
interface UseDocumentTitleOptions {
|
|
190
225
|
/** Restore the previous title on unmount */
|
|
@@ -235,17 +270,23 @@ declare const useDocumentVisibility: () => DocumentVisibilityState;
|
|
|
235
270
|
*/
|
|
236
271
|
declare const useEvent: <Params extends unknown[], Return>(callback: (...args: Params) => Return) => ((...args: Params) => Return);
|
|
237
272
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
273
|
+
/** The color selection return type */
|
|
274
|
+
interface UseEyeDropperReturn {
|
|
275
|
+
supported: boolean;
|
|
276
|
+
value?: string;
|
|
277
|
+
open: (colorSelectionOptions?: ColorSelectionOptions) => Promise<ColorSelectionResult>;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* @name useEyeDropper
|
|
281
|
+
* @description - Hook that gives you access to the eye dropper
|
|
282
|
+
*
|
|
283
|
+
* @param {string} [initialValue=undefined] The initial value for the eye dropper
|
|
284
|
+
* @returns {UseEyeDropperReturn} An object containing the supported status, the value and the open method
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* const { supported, value, open } = useEyeDropper();
|
|
288
|
+
*/
|
|
289
|
+
declare const useEyeDropper: (initialValue?: string | undefined) => UseEyeDropperReturn;
|
|
249
290
|
|
|
250
291
|
/** The use favicon return type */
|
|
251
292
|
type UseFaviconReturn = [string, React.Dispatch<React.SetStateAction<string>>];
|
|
@@ -264,6 +305,17 @@ declare const useFavicon: (initialHref?: string) => {
|
|
|
264
305
|
readonly set: (favicon: string) => void;
|
|
265
306
|
};
|
|
266
307
|
|
|
308
|
+
/**
|
|
309
|
+
* @name useFps
|
|
310
|
+
* @description - Hook that measures frames per second
|
|
311
|
+
*
|
|
312
|
+
* @returns {number} A number which determines frames per second
|
|
313
|
+
*
|
|
314
|
+
* @example
|
|
315
|
+
* const fps = useFps();
|
|
316
|
+
*/
|
|
317
|
+
declare const useFps: () => number;
|
|
318
|
+
|
|
267
319
|
/** The use fullscreen target element type */
|
|
268
320
|
type UseFullScreenTarget = React.RefObject<Element | null> | (() => Element) | Element;
|
|
269
321
|
/** The use fullscreen options type */
|
|
@@ -912,6 +964,52 @@ declare const useOrientation: () => UseOrientationReturn;
|
|
|
912
964
|
*/
|
|
913
965
|
declare const usePageLeave: (callback: () => void) => void;
|
|
914
966
|
|
|
967
|
+
interface UsePaintPencil {
|
|
968
|
+
/** Pencil color */
|
|
969
|
+
color?: string;
|
|
970
|
+
/** Pencil width */
|
|
971
|
+
width?: number;
|
|
972
|
+
/** Pencil opacity */
|
|
973
|
+
opacity?: number;
|
|
974
|
+
}
|
|
975
|
+
type UsePaintOptions = UsePaintPencil;
|
|
976
|
+
/** The use paint return type */
|
|
977
|
+
interface UsePaintReturn {
|
|
978
|
+
pencil: UsePaintPencil & {
|
|
979
|
+
set: React.Dispatch<React.SetStateAction<UsePaintPencil>>;
|
|
980
|
+
};
|
|
981
|
+
drawing: boolean;
|
|
982
|
+
}
|
|
983
|
+
type UsePaintTarget = React.RefObject<HTMLCanvasElement> | (() => HTMLCanvasElement) | HTMLCanvasElement;
|
|
984
|
+
declare const getTargetElement: (target: UsePaintTarget) => HTMLCanvasElement | null;
|
|
985
|
+
type UsePaint = {
|
|
986
|
+
<Target extends UsePaintTarget>(target: Target, options?: UsePaintOptions): UsePaintReturn;
|
|
987
|
+
(options?: UsePaintOptions, target?: never): UsePaintReturn & {
|
|
988
|
+
ref: React.RefObject<HTMLCanvasElement>;
|
|
989
|
+
};
|
|
990
|
+
};
|
|
991
|
+
/**
|
|
992
|
+
* @name usePaint
|
|
993
|
+
* @description - Hook that allows you to draw in a specific area
|
|
994
|
+
*
|
|
995
|
+
* @overload
|
|
996
|
+
* @template Target The target element
|
|
997
|
+
* @param {Target} target The target element to be painted
|
|
998
|
+
* @param {UsePaintOptions} [options] The options to be used
|
|
999
|
+
* @returns {UsePaintReturn} An object containing the current pencil options and functions to interact with the paint
|
|
1000
|
+
*
|
|
1001
|
+
* @example
|
|
1002
|
+
* const { pencil, drawing } = usePaint(canvasRef);
|
|
1003
|
+
*
|
|
1004
|
+
* @overload
|
|
1005
|
+
* @param {UsePaintOptions} [options] The options to be used
|
|
1006
|
+
* @returns {UsePaintReturn & { ref: React.RefObject<HTMLCanvasElement> }} An object containing the current pencil options and functions to interact with the paint
|
|
1007
|
+
*
|
|
1008
|
+
* @example
|
|
1009
|
+
* const { ref, pencil, drawing } = usePaint();
|
|
1010
|
+
*/
|
|
1011
|
+
declare const usePaint: UsePaint;
|
|
1012
|
+
|
|
915
1013
|
/** The use preferred color scheme return type */
|
|
916
1014
|
type UsePreferredColorSchemeReturn = 'dark' | 'light' | 'no-preference';
|
|
917
1015
|
/**
|
|
@@ -1204,6 +1302,30 @@ interface UseTextSelectionReturn {
|
|
|
1204
1302
|
*/
|
|
1205
1303
|
declare const useTextSelection: () => UseTextSelectionReturn;
|
|
1206
1304
|
|
|
1305
|
+
interface UseTimeReturn {
|
|
1306
|
+
seconds: number;
|
|
1307
|
+
minutes: number;
|
|
1308
|
+
hours: number;
|
|
1309
|
+
meridiemHours: {
|
|
1310
|
+
value: number;
|
|
1311
|
+
type: string;
|
|
1312
|
+
};
|
|
1313
|
+
day: number;
|
|
1314
|
+
month: number;
|
|
1315
|
+
year: number;
|
|
1316
|
+
timestamp: number;
|
|
1317
|
+
}
|
|
1318
|
+
/**
|
|
1319
|
+
* @name useTime
|
|
1320
|
+
* @description - Hook that gives you current time in different values
|
|
1321
|
+
*
|
|
1322
|
+
* @returns {UseTimeReturn} An object containing the current time
|
|
1323
|
+
*
|
|
1324
|
+
* @example
|
|
1325
|
+
* const { seconds, minutes, hours, meridiemHours, day, month, year, timestamp } = useTime();
|
|
1326
|
+
*/
|
|
1327
|
+
declare const useTime: () => UseTimeReturn;
|
|
1328
|
+
|
|
1207
1329
|
/** The use timeout return type */
|
|
1208
1330
|
interface UseTimeoutReturn {
|
|
1209
1331
|
/** Timeout is ready state value */
|
|
@@ -1213,7 +1335,7 @@ interface UseTimeoutReturn {
|
|
|
1213
1335
|
}
|
|
1214
1336
|
/**
|
|
1215
1337
|
* @name useTimeout
|
|
1216
|
-
* @description Hook that executes a callback function after a specified delay
|
|
1338
|
+
* @description - Hook that executes a callback function after a specified delay
|
|
1217
1339
|
*
|
|
1218
1340
|
* @param {() => void} callback The function to be executed after the timeout
|
|
1219
1341
|
* @param {number} delay The delay in milliseconds before the timeout executes the callback function
|
|
@@ -1306,4 +1428,18 @@ declare const isClient: boolean;
|
|
|
1306
1428
|
|
|
1307
1429
|
declare const throttle: <Params extends any[]>(callback: (...args: Params) => void, delay: number) => ((...args: Params) => void);
|
|
1308
1430
|
|
|
1309
|
-
|
|
1431
|
+
declare const getDate: (now?: Date) => {
|
|
1432
|
+
seconds: number;
|
|
1433
|
+
minutes: number;
|
|
1434
|
+
hours: number;
|
|
1435
|
+
meridiemHours: {
|
|
1436
|
+
value: number;
|
|
1437
|
+
type: string;
|
|
1438
|
+
};
|
|
1439
|
+
day: number;
|
|
1440
|
+
month: number;
|
|
1441
|
+
year: number;
|
|
1442
|
+
timestamp: number;
|
|
1443
|
+
};
|
|
1444
|
+
|
|
1445
|
+
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 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, useRerender, useScript, useSessionStorage, useSet, useStep, useStorage, useTextSelection, useTime, useTimeout, useToggle, useUnmount, useWindowEvent, useWindowSize };
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_rollupPluginBabelHelpers-OXydtwwP.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_rollupPluginBabelHelpers-Ca7xtMt2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|