@siberiacancode/reactuse 0.2.4 → 0.2.6

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.
Files changed (36) hide show
  1. package/dist/cjs/hooks/useAsync/useAsync.cjs.map +1 -1
  2. package/dist/cjs/hooks/useDropZone/useDropZone.cjs.map +1 -1
  3. package/dist/cjs/hooks/useMouse/useMouse.cjs +1 -1
  4. package/dist/cjs/hooks/useMouse/useMouse.cjs.map +1 -1
  5. package/dist/cjs/hooks/useParallax/useParallax.cjs +1 -1
  6. package/dist/cjs/hooks/useParallax/useParallax.cjs.map +1 -1
  7. package/dist/cjs/hooks/useShare/useShare.cjs.map +1 -1
  8. package/dist/cjs/hooks/useStateHistory/useStateHistory.cjs +1 -1
  9. package/dist/cjs/hooks/useStateHistory/useStateHistory.cjs.map +1 -1
  10. package/dist/cjs/hooks/useStep/useStep.cjs.map +1 -1
  11. package/dist/cjs/hooks/useStorage/useStorage.cjs +1 -1
  12. package/dist/cjs/hooks/useStorage/useStorage.cjs.map +1 -1
  13. package/dist/cjs/index.cjs +1 -1
  14. package/dist/esm/hooks/useAsync/useAsync.mjs.map +1 -1
  15. package/dist/esm/hooks/useDropZone/useDropZone.mjs.map +1 -1
  16. package/dist/esm/hooks/useMouse/useMouse.mjs +42 -27
  17. package/dist/esm/hooks/useMouse/useMouse.mjs.map +1 -1
  18. package/dist/esm/hooks/useParallax/useParallax.mjs +16 -17
  19. package/dist/esm/hooks/useParallax/useParallax.mjs.map +1 -1
  20. package/dist/esm/hooks/useShare/useShare.mjs.map +1 -1
  21. package/dist/esm/hooks/useStateHistory/useStateHistory.mjs +78 -24
  22. package/dist/esm/hooks/useStateHistory/useStateHistory.mjs.map +1 -1
  23. package/dist/esm/hooks/useStep/useStep.mjs.map +1 -1
  24. package/dist/esm/hooks/useStorage/useStorage.mjs +36 -32
  25. package/dist/esm/hooks/useStorage/useStorage.mjs.map +1 -1
  26. package/dist/esm/index.mjs +103 -102
  27. package/dist/types/hooks/useAsync/useAsync.d.ts +3 -3
  28. package/dist/types/hooks/useDropZone/useDropZone.d.ts +4 -4
  29. package/dist/types/hooks/useLocalStorage/useLocalStorage.d.ts +1 -5
  30. package/dist/types/hooks/useMouse/useMouse.d.ts +8 -5
  31. package/dist/types/hooks/useSessionStorage/useSessionStorage.d.ts +1 -5
  32. package/dist/types/hooks/useShare/useShare.d.ts +2 -0
  33. package/dist/types/hooks/useStateHistory/useStateHistory.d.ts +43 -3
  34. package/dist/types/hooks/useStep/useStep.d.ts +2 -3
  35. package/dist/types/hooks/useStorage/useStorage.d.ts +9 -5
  36. package/package.json +6 -6
@@ -6,12 +6,12 @@ import { useAsync as i } from "./hooks/useAsync/useAsync.mjs";
6
6
  import { useBattery as n } from "./hooks/useBattery/useBattery.mjs";
7
7
  import { useBluetooth as l } from "./hooks/useBluetooth/useBluetooth.mjs";
8
8
  import { useBoolean as g } from "./hooks/useBoolean/useBoolean.mjs";
9
- import { BREAKPOINTS_ANT_DESIGN as E, BREAKPOINTS_BOOTSTRAP_V5 as P, BREAKPOINTS_MANTINE as d, BREAKPOINTS_MASTER_CSS as C, BREAKPOINTS_MATERIAL_UI as R, BREAKPOINTS_PRIME_FLEX as I, BREAKPOINTS_QUASAR_V2 as O, BREAKPOINTS_SEMANTIC as k, BREAKPOINTS_TAILWIND as y, useBreakpoints as A } from "./hooks/useBreakpoints/useBreakpoints.mjs";
9
+ import { BREAKPOINTS_ANT_DESIGN as d, BREAKPOINTS_BOOTSTRAP_V5 as E, BREAKPOINTS_MANTINE as P, BREAKPOINTS_MASTER_CSS as C, BREAKPOINTS_MATERIAL_UI as R, BREAKPOINTS_PRIME_FLEX as I, BREAKPOINTS_QUASAR_V2 as O, BREAKPOINTS_SEMANTIC as y, BREAKPOINTS_TAILWIND as k, useBreakpoints as A } from "./hooks/useBreakpoints/useBreakpoints.mjs";
10
10
  import { useBrowserLanguage as D } from "./hooks/useBrowserLanguage/useBrowserLanguage.mjs";
11
11
  import { useClickOutside as _ } from "./hooks/useClickOutside/useClickOutside.mjs";
12
12
  import { useClipboard as M } from "./hooks/useClipboard/useClipboard.mjs";
13
13
  import { useConst as L } from "./hooks/useConst/useConst.mjs";
14
- import { COOKIE_EVENT as K, dispatchCookieEvent as F, getCookie as V, getCookies as U, removeCookie as w, removeCookieItem as W, setCookie as G, setCookieItem as H, useCookie as Q } from "./hooks/useCookie/useCookie.mjs";
14
+ import { COOKIE_EVENT as K, dispatchCookieEvent as F, getCookie as V, getCookies as U, removeCookie as w, removeCookieItem as W, setCookie as H, setCookieItem as G, useCookie as Q } from "./hooks/useCookie/useCookie.mjs";
15
15
  import { clearCookies as X, getParsedCookies as Z, useCookies as j } from "./hooks/useCookies/useCookies.mjs";
16
16
  import { useCopy as J } from "./hooks/useCopy/useCopy.mjs";
17
17
  import { useCounter as $ } from "./hooks/useCounter/useCounter.mjs";
@@ -24,10 +24,10 @@ import { useDeviceOrientation as ae } from "./hooks/useDeviceOrientation/useDevi
24
24
  import { useDevicePixelRatio as ce } from "./hooks/useDevicePixelRatio/useDevicePixelRatio.mjs";
25
25
  import { useDidUpdate as Se } from "./hooks/useDidUpdate/useDidUpdate.mjs";
26
26
  import { useDisclosure as Te } from "./hooks/useDisclosure/useDisclosure.mjs";
27
- import { useDisplayMedia as Pe } from "./hooks/useDisplayMedia/useDisplayMedia.mjs";
27
+ import { useDisplayMedia as Ee } from "./hooks/useDisplayMedia/useDisplayMedia.mjs";
28
28
  import { useDocumentEvent as Ce } from "./hooks/useDocumentEvent/useDocumentEvent.mjs";
29
29
  import { useDocumentTitle as Ie } from "./hooks/useDocumentTitle/useDocumentTitle.mjs";
30
- import { useDocumentVisibility as ke } from "./hooks/useDocumentVisibility/useDocumentVisibility.mjs";
30
+ import { useDocumentVisibility as ye } from "./hooks/useDocumentVisibility/useDocumentVisibility.mjs";
31
31
  import { useDoubleClick as Ae } from "./hooks/useDoubleClick/useDoubleClick.mjs";
32
32
  import { useDropZone as De } from "./hooks/useDropZone/useDropZone.mjs";
33
33
  import { useElementSize as _e } from "./hooks/useElementSize/useElementSize.mjs";
@@ -36,7 +36,7 @@ import { useEventListener as Le } from "./hooks/useEventListener/useEventListene
36
36
  import { useEventSource as Ke } from "./hooks/useEventSource/useEventSource.mjs";
37
37
  import { useEyeDropper as Ve } from "./hooks/useEyeDropper/useEyeDropper.mjs";
38
38
  import { useFavicon as we } from "./hooks/useFavicon/useFavicon.mjs";
39
- import { useField as Ge } from "./hooks/useField/useField.mjs";
39
+ import { useField as He } from "./hooks/useField/useField.mjs";
40
40
  import { useFileDialog as Qe } from "./hooks/useFileDialog/useFileDialog.mjs";
41
41
  import { useFocus as Xe } from "./hooks/useFocus/useFocus.mjs";
42
42
  import { useFps as je } from "./hooks/useFps/useFps.mjs";
@@ -53,7 +53,7 @@ import { useInfiniteScroll as To } from "./hooks/useInfiniteScroll/useInfiniteSc
53
53
  import { useIntersectionObserver as Po } from "./hooks/useIntersectionObserver/useIntersectionObserver.mjs";
54
54
  import { useInterval as Ro } from "./hooks/useInterval/useInterval.mjs";
55
55
  import { useIsFirstRender as Oo } from "./hooks/useIsFirstRender/useIsFirstRender.mjs";
56
- import { useIsomorphicLayoutEffect as yo } from "./hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs";
56
+ import { useIsomorphicLayoutEffect as ko } from "./hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs";
57
57
  import { useKeyboard as vo } from "./hooks/useKeyboard/useKeyboard.mjs";
58
58
  import { useKeyPress as ho } from "./hooks/useKeyPress/useKeyPress.mjs";
59
59
  import { useKeyPressEvent as bo } from "./hooks/useKeyPressEvent/useKeyPressEvent.mjs";
@@ -62,7 +62,7 @@ import { useLastChanged as Bo } from "./hooks/useLastChanged/useLastChanged.mjs"
62
62
  import { useLatest as Fo } from "./hooks/useLatest/useLatest.mjs";
63
63
  import { useLess as Uo } from "./hooks/useLess/useLess.mjs";
64
64
  import { useList as Wo } from "./hooks/useList/useList.mjs";
65
- import { useLocalStorage as Ho } from "./hooks/useLocalStorage/useLocalStorage.mjs";
65
+ import { useLocalStorage as Go } from "./hooks/useLocalStorage/useLocalStorage.mjs";
66
66
  import { useLockCallback as zo } from "./hooks/useLockCallback/useLockCallback.mjs";
67
67
  import { useLogger as Zo } from "./hooks/useLogger/useLogger.mjs";
68
68
  import { useLongPress as qo } from "./hooks/useLongPress/useLongPress.mjs";
@@ -76,10 +76,10 @@ import { useMutation as ir } from "./hooks/useMutation/useMutation.mjs";
76
76
  import { useMutationObserver as nr } from "./hooks/useMutationObserver/useMutationObserver.mjs";
77
77
  import { getConnection as lr, useNetwork as Sr } from "./hooks/useNetwork/useNetwork.mjs";
78
78
  import { useOffsetPagination as Tr } from "./hooks/useOffsetPagination/useOffsetPagination.mjs";
79
- import { useOnce as Pr } from "./hooks/useOnce/useOnce.mjs";
79
+ import { useOnce as Er } from "./hooks/useOnce/useOnce.mjs";
80
80
  import { useOnline as Cr } from "./hooks/useOnline/useOnline.mjs";
81
81
  import { getOperatingSystem as Ir, useOperatingSystem as Or } from "./hooks/useOperatingSystem/useOperatingSystem.mjs";
82
- import { useOptimistic as yr } from "./hooks/useOptimistic/useOptimistic.mjs";
82
+ import { useOptimistic as kr } from "./hooks/useOptimistic/useOptimistic.mjs";
83
83
  import { useOrientation as vr } from "./hooks/useOrientation/useOrientation.mjs";
84
84
  import { useOtpCredential as hr } from "./hooks/useOtpCredential/useOtpCredential.mjs";
85
85
  import { usePageLeave as br } from "./hooks/usePageLeave/usePageLeave.mjs";
@@ -87,7 +87,7 @@ import { Paint as Nr, Pointer as Lr, usePaint as Br } from "./hooks/usePaint/use
87
87
  import { useParallax as Fr } from "./hooks/useParallax/useParallax.mjs";
88
88
  import { usePerformanceObserver as Ur } from "./hooks/usePerformanceObserver/usePerformanceObserver.mjs";
89
89
  import { usePermission as Wr } from "./hooks/usePermission/usePermission.mjs";
90
- import { usePointerLock as Hr } from "./hooks/usePointerLock/usePointerLock.mjs";
90
+ import { usePointerLock as Gr } from "./hooks/usePointerLock/usePointerLock.mjs";
91
91
  import { usePostMessage as zr } from "./hooks/usePostMessage/usePostMessage.mjs";
92
92
  import { usePreferredColorScheme as Zr } from "./hooks/usePreferredColorScheme/usePreferredColorScheme.mjs";
93
93
  import { usePreferredContrast as qr } from "./hooks/usePreferredContrast/usePreferredContrast.mjs";
@@ -101,11 +101,11 @@ import { useRaf as it } from "./hooks/useRaf/useRaf.mjs";
101
101
  import { useRafValue as nt } from "./hooks/useRafValue/useRafValue.mjs";
102
102
  import { useRefState as lt } from "./hooks/useRefState/useRefState.mjs";
103
103
  import { useRenderCount as gt } from "./hooks/useRenderCount/useRenderCount.mjs";
104
- import { useRenderInfo as Et } from "./hooks/useRenderInfo/useRenderInfo.mjs";
105
- import { useRerender as dt } from "./hooks/useRerender/useRerender.mjs";
104
+ import { useRenderInfo as dt } from "./hooks/useRenderInfo/useRenderInfo.mjs";
105
+ import { useRerender as Pt } from "./hooks/useRerender/useRerender.mjs";
106
106
  import { useResizeObserver as Rt } from "./hooks/useResizeObserver/useResizeObserver.mjs";
107
107
  import { useScreenOrientation as Ot } from "./hooks/useScreenOrientation/useScreenOrientation.mjs";
108
- import { SCRIPT_STATUS_ATTRIBUTE_NAME as yt, useScript as At } from "./hooks/useScript/useScript.mjs";
108
+ import { SCRIPT_STATUS_ATTRIBUTE_NAME as kt, useScript as At } from "./hooks/useScript/useScript.mjs";
109
109
  import { useScroll as Dt } from "./hooks/useScroll/useScroll.mjs";
110
110
  import { useScrollIntoView as _t } from "./hooks/useScrollIntoView/useScrollIntoView.mjs";
111
111
  import { useScrollTo as Mt } from "./hooks/useScrollTo/useScrollTo.mjs";
@@ -113,86 +113,87 @@ import { useSessionStorage as Lt } from "./hooks/useSessionStorage/useSessionSto
113
113
  import { useSet as Kt } from "./hooks/useSet/useSet.mjs";
114
114
  import { useShare as Vt } from "./hooks/useShare/useShare.mjs";
115
115
  import { getSpeechRecognition as wt, useSpeechRecognition as Wt } from "./hooks/useSpeechRecognition/useSpeechRecognition.mjs";
116
- import { useSpeechSynthesis as Ht } from "./hooks/useSpeechSynthesis/useSpeechSynthesis.mjs";
117
- import { useStateHistory as zt } from "./hooks/useStateHistory/useStateHistory.mjs";
118
- import { useStep as Zt } from "./hooks/useStep/useStep.mjs";
119
- import { useSticky as qt } from "./hooks/useSticky/useSticky.mjs";
120
- import { useStopwatch as Yt } from "./hooks/useStopwatch/useStopwatch.mjs";
121
- import { STORAGE_EVENT as es, dispatchStorageEvent as os, useStorage as rs } from "./hooks/useStorage/useStorage.mjs";
122
- import { useTextDirection as ss } from "./hooks/useTextDirection/useTextDirection.mjs";
123
- import { getRangesSelection as ps, useTextSelection as us } from "./hooks/useTextSelection/useTextSelection.mjs";
124
- import { useThrottleCallback as xs } from "./hooks/useThrottleCallback/useThrottleCallback.mjs";
125
- import { useThrottleValue as as } from "./hooks/useThrottleValue/useThrottleValue.mjs";
126
- import { useTime as cs } from "./hooks/useTime/useTime.mjs";
127
- import { useTimeout as Ss } from "./hooks/useTimeout/useTimeout.mjs";
128
- import { getTimeFromSeconds as Ts, useTimer as Es } from "./hooks/useTimer/useTimer.mjs";
129
- import { useToggle as ds } from "./hooks/useToggle/useToggle.mjs";
130
- import { useUnmount as Rs } from "./hooks/useUnmount/useUnmount.mjs";
131
- import { createQueryString as Os, getUrlSearchParams as ks, setUrlSearchParams as ys, useUrlSearchParams as As } from "./hooks/useUrlSearchParams/useUrlSearchParams.mjs";
132
- import { useVibrate as Ds } from "./hooks/useVibrate/useVibrate.mjs";
133
- import { useWakeLock as _s } from "./hooks/useWakeLock/useWakeLock.mjs";
134
- import { useWebSocket as Ms } from "./hooks/useWebSocket/useWebSocket.mjs";
135
- import { useWindowEvent as Ls } from "./hooks/useWindowEvent/useWindowEvent.mjs";
136
- import { useWindowFocus as Ks } from "./hooks/useWindowFocus/useWindowFocus.mjs";
137
- import { scrollTo as Vs, useWindowScroll as Us } from "./hooks/useWindowScroll/useWindowScroll.mjs";
138
- import { useWindowSize as Ws } from "./hooks/useWindowSize/useWindowSize.mjs";
139
- import { useWizard as Hs } from "./hooks/useWizard/useWizard.mjs";
140
- import { copy as zs, legacyCopyToClipboard as Xs } from "./utils/helpers/copy.mjs";
141
- import { debounce as js } from "./utils/helpers/debounce.mjs";
142
- import { getDate as Js } from "./utils/helpers/getDate.mjs";
143
- import { getElement as $s, target as em, targetSymbol as om } from "./utils/helpers/getElement.mjs";
144
- import { getRetry as tm } from "./utils/helpers/getRetry.mjs";
145
- import { isTarget as mm } from "./utils/helpers/isTarget.mjs";
146
- import { throttle as um } from "./utils/helpers/throttle.mjs";
116
+ import { useSpeechSynthesis as Gt } from "./hooks/useSpeechSynthesis/useSpeechSynthesis.mjs";
117
+ import { stateHistoryReducer as zt, useStateHistory as Xt } from "./hooks/useStateHistory/useStateHistory.mjs";
118
+ import { useStep as jt } from "./hooks/useStep/useStep.mjs";
119
+ import { useSticky as Jt } from "./hooks/useSticky/useSticky.mjs";
120
+ import { useStopwatch as $t } from "./hooks/useStopwatch/useStopwatch.mjs";
121
+ import { STORAGE_EVENT as os, dispatchStorageEvent as rs, useStorage as ts } from "./hooks/useStorage/useStorage.mjs";
122
+ import { useTextDirection as ms } from "./hooks/useTextDirection/useTextDirection.mjs";
123
+ import { getRangesSelection as us, useTextSelection as fs } from "./hooks/useTextSelection/useTextSelection.mjs";
124
+ import { useThrottleCallback as is } from "./hooks/useThrottleCallback/useThrottleCallback.mjs";
125
+ import { useThrottleValue as ns } from "./hooks/useThrottleValue/useThrottleValue.mjs";
126
+ import { useTime as ls } from "./hooks/useTime/useTime.mjs";
127
+ import { useTimeout as gs } from "./hooks/useTimeout/useTimeout.mjs";
128
+ import { getTimeFromSeconds as ds, useTimer as Es } from "./hooks/useTimer/useTimer.mjs";
129
+ import { useToggle as Cs } from "./hooks/useToggle/useToggle.mjs";
130
+ import { useUnmount as Is } from "./hooks/useUnmount/useUnmount.mjs";
131
+ import { createQueryString as ys, getUrlSearchParams as ks, setUrlSearchParams as As, useUrlSearchParams as vs } from "./hooks/useUrlSearchParams/useUrlSearchParams.mjs";
132
+ import { useVibrate as hs } from "./hooks/useVibrate/useVibrate.mjs";
133
+ import { useWakeLock as bs } from "./hooks/useWakeLock/useWakeLock.mjs";
134
+ import { useWebSocket as Ns } from "./hooks/useWebSocket/useWebSocket.mjs";
135
+ import { useWindowEvent as Bs } from "./hooks/useWindowEvent/useWindowEvent.mjs";
136
+ import { useWindowFocus as Fs } from "./hooks/useWindowFocus/useWindowFocus.mjs";
137
+ import { scrollTo as Us, useWindowScroll as ws } from "./hooks/useWindowScroll/useWindowScroll.mjs";
138
+ import { useWindowSize as Hs } from "./hooks/useWindowSize/useWindowSize.mjs";
139
+ import { useWizard as Qs } from "./hooks/useWizard/useWizard.mjs";
140
+ import { copy as Xs, legacyCopyToClipboard as Zs } from "./utils/helpers/copy.mjs";
141
+ import { debounce as qs } from "./utils/helpers/debounce.mjs";
142
+ import { getDate as Ys } from "./utils/helpers/getDate.mjs";
143
+ import { getElement as em, target as om, targetSymbol as rm } from "./utils/helpers/getElement.mjs";
144
+ import { getRetry as sm } from "./utils/helpers/getRetry.mjs";
145
+ import { isTarget as pm } from "./utils/helpers/isTarget.mjs";
146
+ import { throttle as fm } from "./utils/helpers/throttle.mjs";
147
147
  export {
148
- E as BREAKPOINTS_ANT_DESIGN,
149
- P as BREAKPOINTS_BOOTSTRAP_V5,
150
- d as BREAKPOINTS_MANTINE,
148
+ d as BREAKPOINTS_ANT_DESIGN,
149
+ E as BREAKPOINTS_BOOTSTRAP_V5,
150
+ P as BREAKPOINTS_MANTINE,
151
151
  C as BREAKPOINTS_MASTER_CSS,
152
152
  R as BREAKPOINTS_MATERIAL_UI,
153
153
  I as BREAKPOINTS_PRIME_FLEX,
154
154
  O as BREAKPOINTS_QUASAR_V2,
155
- k as BREAKPOINTS_SEMANTIC,
156
- y as BREAKPOINTS_TAILWIND,
155
+ y as BREAKPOINTS_SEMANTIC,
156
+ k as BREAKPOINTS_TAILWIND,
157
157
  K as COOKIE_EVENT,
158
158
  Nr as Paint,
159
159
  Lr as Pointer,
160
- yt as SCRIPT_STATUS_ATTRIBUTE_NAME,
161
- es as STORAGE_EVENT,
160
+ kt as SCRIPT_STATUS_ATTRIBUTE_NAME,
161
+ os as STORAGE_EVENT,
162
162
  X as clearCookies,
163
- zs as copy,
163
+ Xs as copy,
164
164
  r as createContext,
165
- Os as createQueryString,
165
+ ys as createQueryString,
166
166
  s as createReactiveContext,
167
167
  p as createStore,
168
- js as debounce,
168
+ qs as debounce,
169
169
  F as dispatchCookieEvent,
170
- os as dispatchStorageEvent,
170
+ rs as dispatchStorageEvent,
171
171
  lr as getConnection,
172
172
  V as getCookie,
173
173
  U as getCookies,
174
- Js as getDate,
175
- $s as getElement,
174
+ Ys as getDate,
175
+ em as getElement,
176
176
  Ir as getOperatingSystem,
177
177
  Z as getParsedCookies,
178
- ps as getRangesSelection,
179
- tm as getRetry,
178
+ us as getRangesSelection,
179
+ sm as getRetry,
180
180
  wt as getSpeechRecognition,
181
- Ts as getTimeFromSeconds,
181
+ ds as getTimeFromSeconds,
182
182
  ks as getUrlSearchParams,
183
183
  fo as isHotkeyMatch,
184
- mm as isTarget,
185
- Xs as legacyCopyToClipboard,
184
+ pm as isTarget,
185
+ Zs as legacyCopyToClipboard,
186
186
  oo as mapGamepadToXbox360Controller,
187
187
  w as removeCookie,
188
188
  W as removeCookieItem,
189
- Vs as scrollTo,
190
- G as setCookie,
191
- H as setCookieItem,
192
- ys as setUrlSearchParams,
193
- em as target,
194
- om as targetSymbol,
195
- um as throttle,
189
+ Us as scrollTo,
190
+ H as setCookie,
191
+ G as setCookieItem,
192
+ As as setUrlSearchParams,
193
+ zt as stateHistoryReducer,
194
+ om as target,
195
+ rm as targetSymbol,
196
+ fm as throttle,
196
197
  f as useActiveElement,
197
198
  i as useAsync,
198
199
  n as useBattery,
@@ -216,10 +217,10 @@ export {
216
217
  ce as useDevicePixelRatio,
217
218
  Se as useDidUpdate,
218
219
  Te as useDisclosure,
219
- Pe as useDisplayMedia,
220
+ Ee as useDisplayMedia,
220
221
  Ce as useDocumentEvent,
221
222
  Ie as useDocumentTitle,
222
- ke as useDocumentVisibility,
223
+ ye as useDocumentVisibility,
223
224
  Ae as useDoubleClick,
224
225
  De as useDropZone,
225
226
  _e as useElementSize,
@@ -228,7 +229,7 @@ export {
228
229
  Ke as useEventSource,
229
230
  Ve as useEyeDropper,
230
231
  we as useFavicon,
231
- Ge as useField,
232
+ He as useField,
232
233
  Qe as useFileDialog,
233
234
  Xe as useFocus,
234
235
  je as useFps,
@@ -245,7 +246,7 @@ export {
245
246
  Po as useIntersectionObserver,
246
247
  Ro as useInterval,
247
248
  Oo as useIsFirstRender,
248
- yo as useIsomorphicLayoutEffect,
249
+ ko as useIsomorphicLayoutEffect,
249
250
  ho as useKeyPress,
250
251
  bo as useKeyPressEvent,
251
252
  vo as useKeyboard,
@@ -254,7 +255,7 @@ export {
254
255
  Fo as useLatest,
255
256
  Uo as useLess,
256
257
  Wo as useList,
257
- Ho as useLocalStorage,
258
+ Go as useLocalStorage,
258
259
  zo as useLockCallback,
259
260
  Zo as useLogger,
260
261
  qo as useLongPress,
@@ -268,10 +269,10 @@ export {
268
269
  nr as useMutationObserver,
269
270
  Sr as useNetwork,
270
271
  Tr as useOffsetPagination,
271
- Pr as useOnce,
272
+ Er as useOnce,
272
273
  Cr as useOnline,
273
274
  Or as useOperatingSystem,
274
- yr as useOptimistic,
275
+ kr as useOptimistic,
275
276
  vr as useOrientation,
276
277
  hr as useOtpCredential,
277
278
  br as usePageLeave,
@@ -279,7 +280,7 @@ export {
279
280
  Fr as useParallax,
280
281
  Ur as usePerformanceObserver,
281
282
  Wr as usePermission,
282
- Hr as usePointerLock,
283
+ Gr as usePointerLock,
283
284
  zr as usePostMessage,
284
285
  Zr as usePreferredColorScheme,
285
286
  qr as usePreferredContrast,
@@ -293,8 +294,8 @@ export {
293
294
  nt as useRafValue,
294
295
  lt as useRefState,
295
296
  gt as useRenderCount,
296
- Et as useRenderInfo,
297
- dt as useRerender,
297
+ dt as useRenderInfo,
298
+ Pt as useRerender,
298
299
  Rt as useResizeObserver,
299
300
  Ot as useScreenOrientation,
300
301
  At as useScript,
@@ -305,29 +306,29 @@ export {
305
306
  Kt as useSet,
306
307
  Vt as useShare,
307
308
  Wt as useSpeechRecognition,
308
- Ht as useSpeechSynthesis,
309
- zt as useStateHistory,
310
- Zt as useStep,
311
- qt as useSticky,
312
- Yt as useStopwatch,
313
- rs as useStorage,
314
- ss as useTextDirection,
315
- us as useTextSelection,
316
- xs as useThrottleCallback,
317
- as as useThrottleValue,
318
- cs as useTime,
319
- Ss as useTimeout,
309
+ Gt as useSpeechSynthesis,
310
+ Xt as useStateHistory,
311
+ jt as useStep,
312
+ Jt as useSticky,
313
+ $t as useStopwatch,
314
+ ts as useStorage,
315
+ ms as useTextDirection,
316
+ fs as useTextSelection,
317
+ is as useThrottleCallback,
318
+ ns as useThrottleValue,
319
+ ls as useTime,
320
+ gs as useTimeout,
320
321
  Es as useTimer,
321
- ds as useToggle,
322
- Rs as useUnmount,
323
- As as useUrlSearchParams,
324
- Ds as useVibrate,
325
- _s as useWakeLock,
326
- Ms as useWebSocket,
327
- Ls as useWindowEvent,
328
- Ks as useWindowFocus,
329
- Us as useWindowScroll,
330
- Ws as useWindowSize,
331
- Hs as useWizard
322
+ Cs as useToggle,
323
+ Is as useUnmount,
324
+ vs as useUrlSearchParams,
325
+ hs as useVibrate,
326
+ bs as useWakeLock,
327
+ Ns as useWebSocket,
328
+ Bs as useWindowEvent,
329
+ Fs as useWindowFocus,
330
+ ws as useWindowScroll,
331
+ Hs as useWindowSize,
332
+ Qs as useWizard
332
333
  };
333
334
  //# sourceMappingURL=index.mjs.map
@@ -10,9 +10,9 @@ export interface UseAsyncReturn<Data> {
10
10
  * @description - Hook that provides the state of an async callback
11
11
  * @category Utilities
12
12
  *
13
- * @param {() => Promise<Data>} callback - The async callback
14
- * @param {DependencyList} deps - The dependencies of the callback
15
- * @returns {UseAsyncReturn<Data>} - The state of the async callback
13
+ * @param {() => Promise<Data>} callback The async callback
14
+ * @param {DependencyList} deps The dependencies of the callback
15
+ * @returns {UseAsyncReturn<Data>} The state of the async callback
16
16
  *
17
17
  * @example
18
18
  * const { data, isLoading, isError, error } = useAsync(() => fetch('url'), [deps]);
@@ -45,7 +45,7 @@ export interface UseDropZone {
45
45
  * @param {(event: DragEvent) => void} [options.onEnter] The on enter callback function
46
46
  * @param {(event: DragEvent) => void} [options.onLeave] The on leave callback function
47
47
  * @param {(event: DragEvent) => void} [options.onOver] The on over callback function
48
- * @returns {[boolean, File[] | null]} The object with drop zone states
48
+ * @returns {UseDropZoneReturn} The object with drop zone states
49
49
  *
50
50
  * @example
51
51
  * const { overed, files } = useDropZone(ref, options);
@@ -53,7 +53,7 @@ export interface UseDropZone {
53
53
  * @overload
54
54
  * @param {Target} target The target element drop zone's
55
55
  * @param {(files: File[] | null, event: DragEvent) => void} [callback] The callback function to be invoked on drop
56
- * @returns {[boolean, File[] | null]} The object with drop zone states
56
+ * @returns {UseDropZoneReturn} The object with drop zone states
57
57
  *
58
58
  * @example
59
59
  * const { overed, files } = useDropZone(ref, () => console.log('callback'));
@@ -65,14 +65,14 @@ export interface UseDropZone {
65
65
  * @param {(event: DragEvent) => void} [options.onEnter] The on enter callback function
66
66
  * @param {(event: DragEvent) => void} [options.onLeave] The on leave callback function
67
67
  * @param {(event: DragEvent) => void} [options.onOver] The on over callback function
68
- * @returns {[StateRef<Target>, boolean, File[] | null]} The object with drop zone states and ref
68
+ * @returns {UseDropZoneReturn & { ref: StateRef<Target> }} The object with drop zone states and ref
69
69
  *
70
70
  * @example
71
71
  * const { ref, overed, files } = useDropZone(options);
72
72
  *
73
73
  * @overload
74
74
  * @param {(files: File[] | null, event: DragEvent) => void} [callback] The callback function to be invoked on drop
75
- * @returns {[StateRef<Target>, boolean, File[] | null]} The object with drop zone states and ref
75
+ * @returns {UseDropZoneReturn & { ref: StateRef<Target> }} The object with drop zone states and ref
76
76
  *
77
77
  * @example
78
78
  * const { ref, overed, files } = useDropZone(() => console.log('callback'));
@@ -14,8 +14,4 @@ import { UseStorageInitialValue, UseStorageOptions } from '../useStorage/useStor
14
14
  * @example
15
15
  * const { value, set, remove } = useLocalStorage('key', 'value');
16
16
  */
17
- export declare const useLocalStorage: <Value>(key: string, initialValue?: UseStorageInitialValue<Value>, options?: Omit<UseStorageOptions<Value>, "initialValue" | "storage">) => {
18
- value: Value | undefined;
19
- set: (value: Value) => void;
20
- remove: () => void;
21
- };
17
+ export declare const useLocalStorage: <Value>(key: string, initialValue?: UseStorageInitialValue<Value>, options?: Omit<UseStorageOptions<Value>, "initialValue" | "storage">) => import('..').UseStorageReturn<Value | undefined>;
@@ -2,8 +2,10 @@ import { HookTarget } from '../../utils/helpers';
2
2
  import { StateRef } from '../useRefState/useRefState';
3
3
  /** The use mouse return type */
4
4
  export interface UseMouseReturn {
5
- /** The current element */
6
- element?: Element;
5
+ /** The current mouse client x position */
6
+ clientX: number;
7
+ /** The current mouse client y position */
8
+ clientY: number;
7
9
  /** The current element position x */
8
10
  elementPositionX: number;
9
11
  /** The current element position y */
@@ -22,6 +24,7 @@ export interface UseMouse {
22
24
  <Target extends Element>(target?: never): UseMouseReturn & {
23
25
  ref: StateRef<Target>;
24
26
  };
27
+ (target?: Window): UseMouseReturn;
25
28
  }
26
29
  /**
27
30
  * @name useMouse
@@ -29,17 +32,17 @@ export interface UseMouse {
29
32
  * @category Sensors
30
33
  *
31
34
  * @overload
32
- * @param {HookTarget} target The target element to manage the mouse position for
35
+ * @param {HookTarget} [target=window] The target element to manage the mouse position for
33
36
  * @returns {UseMouseReturn} An object with the current mouse position
34
37
  *
35
38
  * @example
36
- * const { x, y, elementX, elementY, elementPositionX, elementPositionY } = useMouse(ref);
39
+ * const { x, y, clientX, clientY, elementX, elementY, elementPositionX, elementPositionY } = useMouse(ref);
37
40
  *
38
41
  * @overload
39
42
  * @template Target The target element
40
43
  * @returns {UseMouseReturn & { ref: StateRef<Target> }} An object with the current mouse position and a ref
41
44
  *
42
45
  * @example
43
- * const { ref, x, y, elementX, elementY, elementPositionX, elementPositionY } = useMouse();
46
+ * const { ref, x, y, clientX, clientY, elementX, elementY, elementPositionX, elementPositionY } = useMouse();
44
47
  */
45
48
  export declare const useMouse: UseMouse;
@@ -14,8 +14,4 @@ import { UseStorageInitialValue, UseStorageOptions } from '../useStorage/useStor
14
14
  * @example
15
15
  * const { value, set, remove } = useSessionStorage('key', 'value');
16
16
  */
17
- export declare const useSessionStorage: <Value>(key: string, initialValue?: UseStorageInitialValue<Value>, options?: Omit<UseStorageOptions<Value>, "initialValue" | "storage">) => {
18
- value: Value | undefined;
19
- set: (value: Value) => void;
20
- remove: () => void;
21
- };
17
+ export declare const useSessionStorage: <Value>(key: string, initialValue?: UseStorageInitialValue<Value>, options?: Omit<UseStorageOptions<Value>, "initialValue" | "storage">) => import('..').UseStorageReturn<Value | undefined>;
@@ -21,6 +21,8 @@ export interface UseShareReturn {
21
21
  * @description - Hook that utilizes the share api
22
22
  * @category Browser
23
23
  *
24
+ * @browserapi share https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share
25
+ *
24
26
  * @param {UseShareParams} [params] The use share options
25
27
  * @returns {UseShareReturn}
26
28
  *
@@ -1,5 +1,9 @@
1
1
  /** The use state history hook return type */
2
2
  interface UseStateHistoryReturn<Value> {
3
+ /** True if a redo operation can be performed */
4
+ canRedo: boolean;
5
+ /** True if an undo operation can be performed */
6
+ canUndo: boolean;
3
7
  /** All history values */
4
8
  history: Value[];
5
9
  /** Current index in history */
@@ -10,6 +14,8 @@ interface UseStateHistoryReturn<Value> {
10
14
  back: (steps?: number) => void;
11
15
  /** Go forward specified number of steps in history (default: 1) */
12
16
  forward: (steps?: number) => void;
17
+ /** Redo the last change */
18
+ redo: () => void;
13
19
  /** Reset history to initial state */
14
20
  reset: () => void;
15
21
  /** Set a new value */
@@ -17,17 +23,51 @@ interface UseStateHistoryReturn<Value> {
17
23
  /** Undo the last change */
18
24
  undo: () => void;
19
25
  }
26
+ export type StateHistoryAction<Value> = {
27
+ type: 'BACK';
28
+ payload: {
29
+ steps: number;
30
+ };
31
+ } | {
32
+ type: 'FORWARD';
33
+ payload: {
34
+ steps: number;
35
+ };
36
+ } | {
37
+ type: 'REDO';
38
+ } | {
39
+ type: 'RESET';
40
+ payload: {
41
+ initialValue: Value;
42
+ capacity: number;
43
+ };
44
+ } | {
45
+ type: 'SET';
46
+ payload: {
47
+ value: Value;
48
+ capacity: number;
49
+ };
50
+ } | {
51
+ type: 'UNDO';
52
+ };
53
+ export interface StateHistory<Value> {
54
+ currentIndex: number;
55
+ history: Value[];
56
+ redoStack: Value[][];
57
+ undoStack: Value[][];
58
+ }
59
+ export declare const stateHistoryReducer: <Value>(state: StateHistory<Value>, action: StateHistoryAction<Value>) => StateHistory<Value>;
20
60
  /**
21
61
  * @name useStateHistory
22
62
  * @description - Hook that manages state with history functionality
23
63
  * @category Utilities
24
64
  *
25
65
  * @param {Value} initialValue - The initial value to start the history with
26
- * @param {number} [maxSize=10] - Maximum number of history entries to keep
66
+ * @param {number} [capacity=10] - Maximum number of history entries and undo actions to keep
27
67
  * @returns {UseStateHistoryReturn<Value>} Object containing current value, history array and control methods
28
68
  *
29
69
  * @example
30
- * const { value, history, index, set, back, forward, reset, undo } = useStateHistory(0);
70
+ * const { value, history, index, set, back, forward, reset, undo, redo, canUndo, canRedo } = useStateHistory(0);
31
71
  */
32
- export declare const useStateHistory: <Value>(initialValue: Value, maxSize?: number) => UseStateHistoryReturn<Value>;
72
+ export declare const useStateHistory: <Value>(initialValue: Value, capacity?: number) => UseStateHistoryReturn<Value>;
33
73
  export {};
@@ -1,12 +1,12 @@
1
1
  /** The use step params type */
2
- interface UseStepParams {
2
+ export interface UseStepParams {
3
3
  /** Initial value for step */
4
4
  initial: number;
5
5
  /** Maximum value for step */
6
6
  max: number;
7
7
  }
8
8
  /** The use step return type */
9
- interface UseStepReturn {
9
+ export interface UseStepReturn {
10
10
  /** Counts of steps */
11
11
  counts: number;
12
12
  /** Current value of step */
@@ -45,4 +45,3 @@ interface UseStepReturn {
45
45
  * const stepper = useStep({ initial: 2, max: 5 });
46
46
  */
47
47
  export declare const useStep: (params: number | UseStepParams) => UseStepReturn;
48
- export {};
@@ -10,6 +10,14 @@ export interface UseStorageReturn<Value> {
10
10
  remove: () => void;
11
11
  set: (value: Value) => void;
12
12
  }
13
+ export interface UseStorage {
14
+ <Value>(key: string, options: UseStorageOptions<Value> & {
15
+ initialValue: UseStorageInitialValue<Value>;
16
+ }): UseStorageReturn<Value>;
17
+ <Value>(key: string, options?: UseStorageOptions<Value>): UseStorageReturn<Value | undefined>;
18
+ <Value>(key: string, initialValue: UseStorageInitialValue<Value>): UseStorageReturn<Value>;
19
+ <Value>(key: string): UseStorageReturn<Value | undefined>;
20
+ }
13
21
  export declare const STORAGE_EVENT = "reactuse-storage";
14
22
  export declare const dispatchStorageEvent: (params: Partial<StorageEvent>) => boolean;
15
23
  /**
@@ -33,8 +41,4 @@ export declare const dispatchStorageEvent: (params: Partial<StorageEvent>) => bo
33
41
  * @example
34
42
  * const { value, set, remove } = useStorage('key', 'value');
35
43
  */
36
- export declare const useStorage: <Value>(key: string, params?: UseStorageInitialValue<Value> | UseStorageOptions<Value>) => {
37
- value: Value | undefined;
38
- set: (value: Value) => void;
39
- remove: () => void;
40
- };
44
+ export declare const useStorage: UseStorage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siberiacancode/reactuse",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "The ultimate collection of react hooks",
5
5
  "author": {
6
6
  "name": "SIBERIA CAN CODE 🧊",
@@ -68,17 +68,17 @@
68
68
  "@testing-library/dom": "^10.4.0",
69
69
  "@testing-library/react": "^16.3.0",
70
70
  "@types/dom-speech-recognition": "^0.0.6",
71
- "@types/react": "^19.1.6",
72
- "@types/react-dom": "^19.1.5",
71
+ "@types/react": "^19.1.7",
72
+ "@types/react-dom": "^19.1.6",
73
73
  "@types/web-bluetooth": "^0.0.21",
74
- "@vitejs/plugin-react": "^4.5.1",
75
- "core-js": "^3.42.0",
74
+ "@vitejs/plugin-react": "^4.5.2",
75
+ "core-js": "^3.43.0",
76
76
  "react": "^19.1.0",
77
77
  "react-dom": "^19.1.0",
78
78
  "shx": "^0.4.0",
79
79
  "vite": "^6.3.5",
80
80
  "vite-plugin-dts": "^4.5.4",
81
- "vitest": "^3.2.1"
81
+ "vitest": "^3.2.3"
82
82
  },
83
83
  "lint-staged": {
84
84
  "*.{js,ts,tsx}": [