@oneplatformdev/hooks 0.1.0-11 → 0.1.0-110

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 (223) hide show
  1. package/CHANGELOG.md +419 -0
  2. package/index.d.ts +37 -0
  3. package/index.d.ts.map +1 -0
  4. package/package.json +13 -21
  5. package/useBoolean/index.d.ts +2 -0
  6. package/useBoolean/index.d.ts.map +1 -0
  7. package/useBoolean/index.js +4 -0
  8. package/useBoolean/useBoolean.d.ts +29 -0
  9. package/useBoolean/useBoolean.d.ts.map +1 -0
  10. package/useBoolean/useBoolean.js +16 -0
  11. package/useClickAnyWhere/index.d.ts +2 -0
  12. package/useClickAnyWhere/index.d.ts.map +1 -0
  13. package/useClickAnyWhere/index.js +4 -0
  14. package/useClickAnyWhere/useClickAnyWhere.d.ts +17 -0
  15. package/useClickAnyWhere/useClickAnyWhere.d.ts.map +1 -0
  16. package/useClickAnyWhere/useClickAnyWhere.js +9 -0
  17. package/useCopyToClipboard/index.d.ts +2 -0
  18. package/useCopyToClipboard/index.d.ts.map +1 -0
  19. package/useCopyToClipboard/index.js +4 -0
  20. package/useCopyToClipboard/useCopyToClipboard.d.ts +34 -0
  21. package/useCopyToClipboard/useCopyToClipboard.d.ts.map +1 -0
  22. package/useCopyToClipboard/useCopyToClipboard.js +16 -0
  23. package/useCountdown/index.d.ts +2 -0
  24. package/useCountdown/index.d.ts.map +1 -0
  25. package/useCountdown/index.js +4 -0
  26. package/useCountdown/useCountdown.d.ts +47 -0
  27. package/useCountdown/useCountdown.d.ts.map +1 -0
  28. package/useCountdown/useCountdown.js +33 -0
  29. package/useCounter/index.d.ts +2 -0
  30. package/useCounter/index.d.ts.map +1 -0
  31. package/useCounter/index.js +4 -0
  32. package/useCounter/useCounter.d.ts +28 -0
  33. package/useCounter/useCounter.d.ts.map +1 -0
  34. package/useCounter/useCounter.js +20 -0
  35. package/useDarkMode/index.d.ts +2 -0
  36. package/useDarkMode/index.d.ts.map +1 -0
  37. package/useDarkMode/index.js +4 -0
  38. package/useDarkMode/useDarkMode.d.ts +46 -0
  39. package/useDarkMode/useDarkMode.d.ts.map +1 -0
  40. package/useDarkMode/useDarkMode.js +38 -0
  41. package/useDebounceCallback/index.d.ts +3 -0
  42. package/useDebounceCallback/index.d.ts.map +1 -0
  43. package/useDebounceCallback/index.js +5 -0
  44. package/useDebounceCallback/useDebounceCallback.d.ts +62 -0
  45. package/useDebounceCallback/useDebounceCallback.d.ts.map +1 -0
  46. package/useDebounceCallback/useDebounceCallback.js +21 -0
  47. package/useDebounceValue/index.d.ts +2 -0
  48. package/useDebounceValue/index.d.ts.map +1 -0
  49. package/useDebounceValue/index.js +4 -0
  50. package/useDebounceValue/useDebounceValue.d.ts +40 -0
  51. package/useDebounceValue/useDebounceValue.d.ts.map +1 -0
  52. package/useDebounceValue/useDebounceValue.js +13 -0
  53. package/useDocumentTitle/index.d.ts +2 -0
  54. package/useDocumentTitle/index.d.ts.map +1 -0
  55. package/useDocumentTitle/index.js +4 -0
  56. package/useDocumentTitle/useDocumentTitle.d.ts +19 -0
  57. package/useDocumentTitle/useDocumentTitle.d.ts.map +1 -0
  58. package/useDocumentTitle/useDocumentTitle.js +16 -0
  59. package/useEventCallback/index.d.ts +2 -0
  60. package/useEventCallback/index.d.ts.map +1 -0
  61. package/useEventCallback/index.js +4 -0
  62. package/useEventCallback/useEventCallback.d.ts +18 -0
  63. package/useEventCallback/useEventCallback.d.ts.map +1 -0
  64. package/useEventCallback/useEventCallback.js +13 -0
  65. package/useEventListener/index.d.ts +2 -0
  66. package/useEventListener/index.d.ts.map +1 -0
  67. package/useEventListener/index.js +4 -0
  68. package/useEventListener/useEventListener.d.ts +9 -0
  69. package/useEventListener/useEventListener.d.ts.map +1 -0
  70. package/useEventListener/useEventListener.js +20 -0
  71. package/useHover/index.d.ts +2 -0
  72. package/useHover/index.d.ts.map +1 -0
  73. package/useHover/index.js +4 -0
  74. package/useHover/useHover.d.ts +17 -0
  75. package/useHover/useHover.d.ts.map +1 -0
  76. package/useHover/useHover.js +13 -0
  77. package/useIntersectionObserver/index.d.ts +2 -0
  78. package/useIntersectionObserver/index.d.ts.map +1 -0
  79. package/useIntersectionObserver/index.js +4 -0
  80. package/useIntersectionObserver/useIntersectionObserver.d.ts +72 -0
  81. package/useIntersectionObserver/useIntersectionObserver.d.ts.map +1 -0
  82. package/useIntersectionObserver/useIntersectionObserver.js +53 -0
  83. package/useInterval/index.d.ts +2 -0
  84. package/useInterval/index.d.ts.map +1 -0
  85. package/useInterval/index.js +4 -0
  86. package/useInterval/useInterval.d.ts +16 -0
  87. package/useInterval/useInterval.d.ts.map +1 -0
  88. package/useInterval/useInterval.js +20 -0
  89. package/useIsClient/index.d.ts +2 -0
  90. package/useIsClient/index.d.ts.map +1 -0
  91. package/useIsClient/index.js +4 -0
  92. package/useIsClient/useIsClient.d.ts +13 -0
  93. package/useIsClient/useIsClient.d.ts.map +1 -0
  94. package/useIsClient/useIsClient.js +10 -0
  95. package/useIsMobile/index.d.ts +3 -0
  96. package/useIsMobile/index.d.ts.map +1 -0
  97. package/useIsMobile/index.js +4 -0
  98. package/useIsMobile/types.d.ts +4 -0
  99. package/useIsMobile/types.d.ts.map +1 -0
  100. package/useIsMobile/types.js +1 -0
  101. package/useIsMobile/useIsMobile.d.ts +3 -0
  102. package/useIsMobile/useIsMobile.d.ts.map +1 -0
  103. package/useIsMobile/useIsMobile.js +16 -0
  104. package/useIsMounted/index.d.ts +2 -0
  105. package/useIsMounted/index.d.ts.map +1 -0
  106. package/useIsMounted/index.js +4 -0
  107. package/useIsMounted/useIsMounted.d.ts +2 -0
  108. package/useIsMounted/useIsMounted.d.ts.map +1 -0
  109. package/useIsMounted/useIsMounted.js +10 -0
  110. package/useIsomorphicLayoutEffect/index.d.ts +2 -0
  111. package/useIsomorphicLayoutEffect/index.d.ts.map +1 -0
  112. package/useIsomorphicLayoutEffect/index.js +4 -0
  113. package/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +16 -0
  114. package/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts.map +1 -0
  115. package/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +5 -0
  116. package/useLocalStorage/index.d.ts +2 -0
  117. package/useLocalStorage/index.d.ts.map +1 -0
  118. package/useLocalStorage/index.js +4 -0
  119. package/useLocalStorage/useLocalStorage.d.ts +39 -0
  120. package/useLocalStorage/useLocalStorage.d.ts.map +1 -0
  121. package/useLocalStorage/useLocalStorage.js +65 -0
  122. package/useLockBody/index.d.ts +2 -0
  123. package/useLockBody/index.d.ts.map +1 -0
  124. package/useLockBody/index.js +4 -0
  125. package/useLockBody/useLockBody.d.ts +2 -0
  126. package/useLockBody/useLockBody.d.ts.map +1 -0
  127. package/useLockBody/useLockBody.js +12 -0
  128. package/useMap/index.d.ts +2 -0
  129. package/useMap/index.d.ts.map +1 -0
  130. package/useMap/index.js +4 -0
  131. package/useMap/useMap.d.ts +48 -0
  132. package/useMap/useMap.d.ts.map +1 -0
  133. package/useMap/useMap.js +27 -0
  134. package/useMediaQuery/index.d.ts +2 -0
  135. package/useMediaQuery/index.d.ts.map +1 -0
  136. package/useMediaQuery/index.js +4 -0
  137. package/useMediaQuery/useMediaQuery.d.ts +29 -0
  138. package/useMediaQuery/useMediaQuery.d.ts.map +1 -0
  139. package/useMediaQuery/useMediaQuery.js +21 -0
  140. package/useOnClickOutside/index.d.ts +2 -0
  141. package/useOnClickOutside/index.d.ts.map +1 -0
  142. package/useOnClickOutside/index.js +4 -0
  143. package/useOnClickOutside/useOnClickOutside.d.ts +24 -0
  144. package/useOnClickOutside/useOnClickOutside.d.ts.map +1 -0
  145. package/useOnClickOutside/useOnClickOutside.js +17 -0
  146. package/useQueryString/index.d.ts +2 -0
  147. package/useQueryString/index.d.ts.map +1 -0
  148. package/useQueryString/index.js +4 -0
  149. package/useQueryString/useQueryString.d.ts +10 -0
  150. package/useQueryString/useQueryString.d.ts.map +1 -0
  151. package/useQueryString/useQueryString.js +10 -0
  152. package/useReadLocalStorage/index.d.ts +2 -0
  153. package/useReadLocalStorage/index.d.ts.map +1 -0
  154. package/useReadLocalStorage/index.js +4 -0
  155. package/useReadLocalStorage/useReadLocalStorage.d.ts +14 -0
  156. package/useReadLocalStorage/useReadLocalStorage.d.ts.map +1 -0
  157. package/useReadLocalStorage/useReadLocalStorage.js +48 -0
  158. package/useResizeObserver/index.d.ts +2 -0
  159. package/useResizeObserver/index.d.ts.map +1 -0
  160. package/useResizeObserver/index.js +4 -0
  161. package/useResizeObserver/useResizeObserver.d.ts +44 -0
  162. package/useResizeObserver/useResizeObserver.d.ts.map +1 -0
  163. package/useResizeObserver/useResizeObserver.js +31 -0
  164. package/useScreen/index.d.ts +2 -0
  165. package/useScreen/index.d.ts.map +1 -0
  166. package/useScreen/index.js +4 -0
  167. package/useScreen/useScreen.d.ts +20 -0
  168. package/useScreen/useScreen.d.ts.map +1 -0
  169. package/useScreen/useScreen.js +48 -0
  170. package/useScript/index.d.ts +2 -0
  171. package/useScript/index.d.ts.map +1 -0
  172. package/useScript/index.js +4 -0
  173. package/useScript/useScript.d.ts +24 -0
  174. package/useScript/useScript.d.ts.map +1 -0
  175. package/useScript/useScript.js +45 -0
  176. package/useScrollLock/index.d.ts +2 -0
  177. package/useScrollLock/index.d.ts.map +1 -0
  178. package/useScrollLock/index.js +4 -0
  179. package/useScrollLock/useScrollLock.d.ts +54 -0
  180. package/useScrollLock/useScrollLock.d.ts.map +1 -0
  181. package/useScrollLock/useScrollLock.js +26 -0
  182. package/useSessionStorage/index.d.ts +2 -0
  183. package/useSessionStorage/index.d.ts.map +1 -0
  184. package/useSessionStorage/index.js +4 -0
  185. package/useSessionStorage/useSessionStorage.d.ts +39 -0
  186. package/useSessionStorage/useSessionStorage.d.ts.map +1 -0
  187. package/useSessionStorage/useSessionStorage.js +65 -0
  188. package/useStep/index.d.ts +2 -0
  189. package/useStep/index.d.ts.map +1 -0
  190. package/useStep/index.js +4 -0
  191. package/useStep/useStep.d.ts +31 -0
  192. package/useStep/useStep.d.ts.map +1 -0
  193. package/useStep/useStep.js +34 -0
  194. package/useTernaryDarkMode/index.d.ts +2 -0
  195. package/useTernaryDarkMode/index.d.ts.map +1 -0
  196. package/useTernaryDarkMode/index.js +4 -0
  197. package/useTernaryDarkMode/useTernaryDarkMode.d.ts +46 -0
  198. package/useTernaryDarkMode/useTernaryDarkMode.d.ts.map +1 -0
  199. package/useTernaryDarkMode/useTernaryDarkMode.js +27 -0
  200. package/useTimeout/index.d.ts +2 -0
  201. package/useTimeout/index.d.ts.map +1 -0
  202. package/useTimeout/index.js +4 -0
  203. package/useTimeout/useTimeout.d.ts +17 -0
  204. package/useTimeout/useTimeout.d.ts.map +1 -0
  205. package/useTimeout/useTimeout.js +20 -0
  206. package/useToggle/index.d.ts +2 -0
  207. package/useToggle/index.d.ts.map +1 -0
  208. package/useToggle/index.js +4 -0
  209. package/useToggle/useToggle.d.ts +18 -0
  210. package/useToggle/useToggle.d.ts.map +1 -0
  211. package/useToggle/useToggle.js +10 -0
  212. package/useUnmount/index.d.ts +2 -0
  213. package/useUnmount/index.d.ts.map +1 -0
  214. package/useUnmount/index.js +4 -0
  215. package/useUnmount/useUnmount.d.ts +14 -0
  216. package/useUnmount/useUnmount.d.ts.map +1 -0
  217. package/useUnmount/useUnmount.js +13 -0
  218. package/useWindowSize/index.d.ts +2 -0
  219. package/useWindowSize/index.d.ts.map +1 -0
  220. package/useWindowSize/index.js +4 -0
  221. package/useWindowSize/useWindowSize.d.ts +30 -0
  222. package/useWindowSize/useWindowSize.d.ts.map +1 -0
  223. package/useWindowSize/useWindowSize.js +31 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCopyToClipboard.d.ts","sourceRoot":"","sources":["../../src/useCopyToClipboard/useCopyToClipboard.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,KAAK,WAAW,GAAG,MAAM,GAAG,IAAI,CAAA;AAEhC;;;;GAIG;AACH,KAAK,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;AAEhD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAsB1D"}
@@ -0,0 +1,16 @@
1
+ import { useState as n, useCallback as l } from "react";
2
+ function c() {
3
+ const [e, r] = n(null), t = l(async (o) => {
4
+ if (!navigator?.clipboard)
5
+ return console.warn("Clipboard not supported"), !1;
6
+ try {
7
+ return await navigator.clipboard.writeText(o), r(o), !0;
8
+ } catch (a) {
9
+ return console.warn("Copy failed", a), r(null), !1;
10
+ }
11
+ }, []);
12
+ return [e, t];
13
+ }
14
+ export {
15
+ c as useCopyToClipboard
16
+ };
@@ -0,0 +1,2 @@
1
+ export * from './useCountdown';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useCountdown/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { useCountdown as n } from "./useCountdown.js";
2
+ export {
3
+ n as useCountdown
4
+ };
@@ -0,0 +1,47 @@
1
+ /** The countdown's options. */
2
+ type CountdownOptions = {
3
+ /** The countdown's starting number, initial value of the returned number. */
4
+ countStart: number;
5
+ /**
6
+ * The countdown's interval, in milliseconds.
7
+ * @default 1000
8
+ */
9
+ intervalMs?: number;
10
+ /**
11
+ * True if the countdown is increment.
12
+ * @default false
13
+ */
14
+ isIncrement?: boolean;
15
+ /**
16
+ * The countdown's stopping number. Pass `-Infinity` to decrease forever.
17
+ * @default 0
18
+ */
19
+ countStop?: number;
20
+ };
21
+ /** The countdown's controllers. */
22
+ type CountdownControllers = {
23
+ /** Start the countdown. */
24
+ startCountdown: () => void;
25
+ /** Stop the countdown. */
26
+ stopCountdown: () => void;
27
+ /** Reset the countdown. */
28
+ resetCountdown: () => void;
29
+ };
30
+ /**
31
+ * Custom hook that manages countdown.
32
+ * @param {CountdownOptions} countdownOptions - The countdown's options.
33
+ * @returns {[number, CountdownControllers]} An array containing the countdown's count and its controllers.
34
+ * @public
35
+ * @see [Documentation](https://usehooks-ts.com/react-hook/use-countdown)
36
+ * @example
37
+ * ```tsx
38
+ * const [counter, { start, stop, reset }] = useCountdown({
39
+ * countStart: 10,
40
+ * intervalMs: 1000,
41
+ * isIncrement: false,
42
+ * });
43
+ * ```
44
+ */
45
+ export declare function useCountdown({ countStart, countStop, intervalMs, isIncrement, }: CountdownOptions): [number, CountdownControllers];
46
+ export {};
47
+ //# sourceMappingURL=useCountdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCountdown.d.ts","sourceRoot":"","sources":["../../src/useCountdown/useCountdown.ts"],"names":[],"mappings":"AAMA,+BAA+B;AAC/B,KAAK,gBAAgB,GAAG;IACtB,6EAA6E;IAC7E,UAAU,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IAErB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,mCAAmC;AACnC,KAAK,oBAAoB,GAAG;IAC1B,2BAA2B;IAC3B,cAAc,EAAE,MAAM,IAAI,CAAA;IAC1B,0BAA0B;IAC1B,aAAa,EAAE,MAAM,IAAI,CAAA;IACzB,2BAA2B;IAC3B,cAAc,EAAE,MAAM,IAAI,CAAA;CAC3B,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,EAC3B,UAAU,EACV,SAAa,EACb,UAAiB,EACjB,WAAmB,GACpB,EAAE,gBAAgB,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CA0CnD"}
@@ -0,0 +1,33 @@
1
+ import { useCallback as l } from "react";
2
+ import { useBoolean as d } from "../useBoolean/useBoolean.js";
3
+ import { useCounter as w } from "../useCounter/useCounter.js";
4
+ import { useInterval as p } from "../useInterval/useInterval.js";
5
+ function x({
6
+ countStart: a,
7
+ countStop: n = 0,
8
+ intervalMs: c = 1e3,
9
+ isIncrement: t = !1
10
+ }) {
11
+ const {
12
+ count: o,
13
+ increment: r,
14
+ decrement: s,
15
+ reset: u
16
+ } = w(a), {
17
+ value: f,
18
+ setTrue: i,
19
+ setFalse: e
20
+ } = d(!1), m = l(() => {
21
+ e(), u();
22
+ }, [e, u]), C = l(() => {
23
+ if (o === n) {
24
+ e();
25
+ return;
26
+ }
27
+ t ? r() : s();
28
+ }, [o, n, s, r, t, e]);
29
+ return p(C, f ? c : null), [o, { startCountdown: i, stopCountdown: e, resetCountdown: m }];
30
+ }
31
+ export {
32
+ x as useCountdown
33
+ };
@@ -0,0 +1,2 @@
1
+ export * from './useCounter';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useCounter/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { useCounter as r } from "./useCounter.js";
2
+ export {
3
+ r as useCounter
4
+ };
@@ -0,0 +1,28 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ /** The hook return type. */
3
+ type UseCounterReturn = {
4
+ /** The current count value. */
5
+ count: number;
6
+ /** Function to increment the counter by 1. */
7
+ increment: () => void;
8
+ /** Function to decrement the counter by 1. */
9
+ decrement: () => void;
10
+ /** Function to reset the counter to its initial value. */
11
+ reset: () => void;
12
+ /** Function to set a specific value to the counter. */
13
+ setCount: Dispatch<SetStateAction<number>>;
14
+ };
15
+ /**
16
+ * Custom hook that manages a counter with increment, decrement, reset, and setCount functionalities.
17
+ * @param {number} [initialValue] - The initial value for the counter.
18
+ * @returns {UseCounterReturn} An object containing the current count and functions to interact with the counter.
19
+ * @public
20
+ * @see [Documentation](https://usehooks-ts.com/react-hook/use-counter)
21
+ * @example
22
+ * ```tsx
23
+ * const { count, increment, decrement, reset, setCount } = useCounter(5);
24
+ * ```
25
+ */
26
+ export declare function useCounter(initialValue?: number): UseCounterReturn;
27
+ export {};
28
+ //# sourceMappingURL=useCounter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCounter.d.ts","sourceRoot":"","sources":["../../src/useCounter/useCounter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAErD,4BAA4B;AAC5B,KAAK,gBAAgB,GAAG;IACtB,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,8CAA8C;IAC9C,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,8CAA8C;IAC9C,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,0DAA0D;IAC1D,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,uDAAuD;IACvD,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAA;CAC3C,CAAA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAsBlE"}
@@ -0,0 +1,20 @@
1
+ import { useState as m, useCallback as o } from "react";
2
+ function f(e) {
3
+ const [c, t] = m(e ?? 0), r = o(() => {
4
+ t((n) => n + 1);
5
+ }, []), s = o(() => {
6
+ t((n) => n - 1);
7
+ }, []), u = o(() => {
8
+ t(e ?? 0);
9
+ }, [e]);
10
+ return {
11
+ count: c,
12
+ increment: r,
13
+ decrement: s,
14
+ reset: u,
15
+ setCount: t
16
+ };
17
+ }
18
+ export {
19
+ f as useCounter
20
+ };
@@ -0,0 +1,2 @@
1
+ export * from './useDarkMode';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useDarkMode/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { useDarkMode as r } from "./useDarkMode.js";
2
+ export {
3
+ r as useDarkMode
4
+ };
@@ -0,0 +1,46 @@
1
+ /** The hook options. */
2
+ type DarkModeOptions = {
3
+ /**
4
+ * The initial value of the dark mode.
5
+ * @default false
6
+ */
7
+ defaultValue?: boolean;
8
+ /**
9
+ * The key to use in the local storage.
10
+ * @default 'usehooks-ts-dark-mode'
11
+ */
12
+ localStorageKey?: string;
13
+ /**
14
+ * If `true` (default), the hook will initialize reading `localStorage`.
15
+ * In SSR, you should set it to `false`, returning the `defaultValue` or `false` initially.
16
+ * @default true
17
+ */
18
+ initializeWithValue?: boolean;
19
+ };
20
+ /** The hook return type. */
21
+ type DarkModeReturn = {
22
+ /** The current state of the dark mode. */
23
+ isDarkMode: boolean;
24
+ /** Function to toggle the dark mode. */
25
+ toggle: () => void;
26
+ /** Function to enable the dark mode. */
27
+ enable: () => void;
28
+ /** Function to disable the dark mode. */
29
+ disable: () => void;
30
+ /** Function to set a specific value to the dark mode. */
31
+ set: (value: boolean) => void;
32
+ };
33
+ /**
34
+ * Custom hook that returns the current state of the dark mode.
35
+ * @param {?DarkModeOptions} [options] - The initial value of the dark mode, default `false`.
36
+ * @returns {DarkModeReturn} An object containing the dark mode's state and its controllers.
37
+ * @public
38
+ * @see [Documentation](https://usehooks-ts.com/react-hook/use-dark-mode)
39
+ * @example
40
+ * ```tsx
41
+ * const { isDarkMode, toggle, enable, disable, set } = useDarkMode({ defaultValue: true });
42
+ * ```
43
+ */
44
+ export declare function useDarkMode(options?: DarkModeOptions): DarkModeReturn;
45
+ export {};
46
+ //# sourceMappingURL=useDarkMode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDarkMode.d.ts","sourceRoot":"","sources":["../../src/useDarkMode/useDarkMode.ts"],"names":[],"mappings":"AAOA,wBAAwB;AACxB,KAAK,eAAe,GAAG;IACrB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC9B,CAAA;AAED,4BAA4B;AAC5B,KAAK,cAAc,GAAG;IACpB,0CAA0C;IAC1C,UAAU,EAAE,OAAO,CAAA;IACnB,wCAAwC;IACxC,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,wCAAwC;IACxC,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,yCAAyC;IACzC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,yDAAyD;IACzD,GAAG,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CAC9B,CAAA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,eAAoB,GAAG,cAAc,CAuCzE"}
@@ -0,0 +1,38 @@
1
+ import { useIsomorphicLayoutEffect as l } from "../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";
2
+ import { useLocalStorage as c } from "../useLocalStorage/useLocalStorage.js";
3
+ import { useMediaQuery as f } from "../useMediaQuery/useMediaQuery.js";
4
+ const n = "(prefers-color-scheme: dark)", d = "usehooks-ts-dark-mode";
5
+ function E(i = {}) {
6
+ const {
7
+ defaultValue: t,
8
+ localStorageKey: u = d,
9
+ initializeWithValue: s = !0
10
+ } = i, o = f(n, {
11
+ initializeWithValue: s,
12
+ defaultValue: t
13
+ }), [a, e] = c(
14
+ u,
15
+ t ?? o ?? !1,
16
+ { initializeWithValue: s }
17
+ );
18
+ return l(() => {
19
+ o !== a && e(o);
20
+ }, [o]), {
21
+ isDarkMode: a,
22
+ toggle: () => {
23
+ e((r) => !r);
24
+ },
25
+ enable: () => {
26
+ e(!0);
27
+ },
28
+ disable: () => {
29
+ e(!1);
30
+ },
31
+ set: (r) => {
32
+ e(r);
33
+ }
34
+ };
35
+ }
36
+ export {
37
+ E as useDarkMode
38
+ };
@@ -0,0 +1,3 @@
1
+ export * from './useDebounceCallback';
2
+ export { useDebounceCallback as default } from './useDebounceCallback';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useDebounceCallback/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,OAAO,EAAC,mBAAmB,IAAI,OAAO,EAAE,MAAM,uBAAuB,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { useDebounceCallback as l, useDebounceCallback as u } from "./useDebounceCallback.js";
2
+ export {
3
+ l as default,
4
+ u as useDebounceCallback
5
+ };
@@ -0,0 +1,62 @@
1
+ /** Configuration options for controlling the behavior of the debounced function. */
2
+ type DebounceOptions = {
3
+ /**
4
+ * Determines whether the function should be invoked on the leading edge of the timeout.
5
+ * @default false
6
+ */
7
+ leading?: boolean;
8
+ /**
9
+ * Determines whether the function should be invoked on the trailing edge of the timeout.
10
+ * @default false
11
+ */
12
+ trailing?: boolean;
13
+ /**
14
+ * The maximum time the specified function is allowed to be delayed before it is invoked.
15
+ */
16
+ maxWait?: number;
17
+ };
18
+ /** Functions to manage a debounced callback. */
19
+ type ControlFunctions = {
20
+ /** Cancels pending function invocations. */
21
+ cancel: () => void;
22
+ /** Immediately invokes pending function invocations. */
23
+ flush: () => void;
24
+ /**
25
+ * Checks if there are any pending function invocations.
26
+ * @returns `true` if there are pending invocations, otherwise `false`.
27
+ */
28
+ isPending: () => boolean;
29
+ };
30
+ /**
31
+ * Represents the state and control functions of a debounced callback.
32
+ * Subsequent calls to the debounced function return the result of the last invocation.
33
+ * Note: If there are no previous invocations, the result will be undefined.
34
+ * Ensure proper handling in your code.
35
+ */
36
+ export type DebouncedState<T extends (...args: any) => ReturnType<T>> = ((...args: Parameters<T>) => ReturnType<T> | undefined) & ControlFunctions;
37
+ /**
38
+ * Custom hook that creates a debounced version of a callback function.
39
+ * @template T - Type of the original callback function.
40
+ * @param {T} func - The callback function to be debounced.
41
+ * @param {number} delay - The delay in milliseconds before the callback is invoked (default is `500` milliseconds).
42
+ * @param {DebounceOptions} [options] - Options to control the behavior of the debounced function.
43
+ * @returns {DebouncedState<T>} A debounced version of the original callback along with control functions.
44
+ * @public
45
+ * @see [Documentation](https://usehooks-ts.com/react-hook/use-debounce-callback)
46
+ * @example
47
+ * ```tsx
48
+ * const debouncedCallback = useDebounceCallback(
49
+ * (searchTerm) => {
50
+ * // Perform search after user stops typing for 500 milliseconds
51
+ * searchApi(searchTerm);
52
+ * },
53
+ * 500
54
+ * );
55
+ *
56
+ * // Later in the component
57
+ * debouncedCallback('react hooks'); // Will invoke the callback after 500 milliseconds of inactivity.
58
+ * ```
59
+ */
60
+ export declare function useDebounceCallback<T extends (...args: any) => ReturnType<T>>(func: T, delay?: number, options?: DebounceOptions): DebouncedState<T>;
61
+ export {};
62
+ //# sourceMappingURL=useDebounceCallback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDebounceCallback.d.ts","sourceRoot":"","sources":["../../src/useDebounceCallback/useDebounceCallback.ts"],"names":[],"mappings":"AAMA,oFAAoF;AACpF,KAAK,eAAe,GAAG;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,gDAAgD;AAChD,KAAK,gBAAgB,GAAG;IACtB,4CAA4C;IAC5C,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,wDAAwD;IACxD,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB;;;OAGG;IACH,SAAS,EAAE,MAAM,OAAO,CAAA;CACzB,CAAA;AAED;;;;;GAKG;AAEH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CACvE,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KACnB,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,GAC7B,gBAAgB,CAAA;AAElB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,UAAU,CAAC,CAAC,CAAC,EAC3E,IAAI,EAAE,CAAC,EACP,KAAK,SAAM,EACX,OAAO,CAAC,EAAE,eAAe,GACxB,cAAc,CAAC,CAAC,CAAC,CAqCnB"}
@@ -0,0 +1,21 @@
1
+ import { useRef as f, useMemo as b, useEffect as d } from "react";
2
+ import o from "lodash.debounce";
3
+ import { useUnmount as l } from "../useUnmount/useUnmount.js";
4
+ function F(e, n = 500, r) {
5
+ const u = f(null);
6
+ l(() => {
7
+ u.current && u.current.cancel();
8
+ });
9
+ const s = b(() => {
10
+ const t = o(e, n, r), c = (...m) => t(...m);
11
+ return c.cancel = () => {
12
+ t.cancel();
13
+ }, c.isPending = () => !!u.current, c.flush = () => t.flush(), c;
14
+ }, [e, n, r]);
15
+ return d(() => {
16
+ u.current = o(e, n, r);
17
+ }, [e, n, r]), s;
18
+ }
19
+ export {
20
+ F as useDebounceCallback
21
+ };
@@ -0,0 +1,2 @@
1
+ export * from './useDebounceValue';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useDebounceValue/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { useDebounceValue as u } from "./useDebounceValue.js";
2
+ export {
3
+ u as useDebounceValue
4
+ };
@@ -0,0 +1,40 @@
1
+ import { DebouncedState } from '../useDebounceCallback';
2
+ /**
3
+ * Hook options.
4
+ * @template T - The type of the value.
5
+ */
6
+ type UseDebounceValueOptions<T> = {
7
+ /**
8
+ * Determines whether the function should be invoked on the leading edge of the timeout.
9
+ * @default false
10
+ */
11
+ leading?: boolean;
12
+ /**
13
+ * Determines whether the function should be invoked on the trailing edge of the timeout.
14
+ * @default false
15
+ */
16
+ trailing?: boolean;
17
+ /**
18
+ * The maximum time the specified function is allowed to be delayed before it is invoked.
19
+ */
20
+ maxWait?: number;
21
+ /** A function to determine if the value has changed. Defaults to a function that checks if the value is strictly equal to the previous value. */
22
+ equalityFn?: (left: T, right: T) => boolean;
23
+ };
24
+ /**
25
+ * Custom hook that returns a debounced version of the provided value, along with a function to update it.
26
+ * @template T - The type of the value.
27
+ * @param {T | (() => T)} initialValue - The value to be debounced.
28
+ * @param {number} delay - The delay in milliseconds before the value is updated (default is 500ms).
29
+ * @param {object} [options] - Optional configurations for the debouncing behavior.
30
+ * @returns {[T, DebouncedState<(value: T) => void>]} An array containing the debounced value and the function to update it.
31
+ * @public
32
+ * @see [Documentation](https://usehooks-ts.com/react-hook/use-debounce-value)
33
+ * @example
34
+ * ```tsx
35
+ * const [debouncedValue, updateDebouncedValue] = useDebounceValue(inputValue, 500, { leading: true });
36
+ * ```
37
+ */
38
+ export declare function useDebounceValue<T>(initialValue: T | (() => T), delay: number, options?: UseDebounceValueOptions<T>): [T, DebouncedState<(value: T) => void>];
39
+ export {};
40
+ //# sourceMappingURL=useDebounceValue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDebounceValue.d.ts","sourceRoot":"","sources":["../../src/useDebounceValue/useDebounceValue.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAG5D;;;GAGG;AACH,KAAK,uBAAuB,CAAC,CAAC,IAAI;IAChC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iJAAiJ;IACjJ,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,OAAO,CAAA;CAC5C,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,YAAY,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAC3B,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,uBAAuB,CAAC,CAAC,CAAC,GACnC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,CAAC,CAoBzC"}
@@ -0,0 +1,13 @@
1
+ import { useState as d, useRef as l } from "react";
2
+ import { useDebounceCallback as p } from "../useDebounceCallback/useDebounceCallback.js";
3
+ function V(u, c, n) {
4
+ const r = n?.equalityFn ?? ((f, b) => f === b), e = u instanceof Function ? u() : u, [s, a] = d(e), o = l(e), t = p(
5
+ a,
6
+ c,
7
+ n
8
+ );
9
+ return r(o.current, e) || (t(e), o.current = e), [s, t];
10
+ }
11
+ export {
12
+ V as useDebounceValue
13
+ };
@@ -0,0 +1,2 @@
1
+ export * from './useDocumentTitle';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useDocumentTitle/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { useDocumentTitle as t } from "./useDocumentTitle.js";
2
+ export {
3
+ t as useDocumentTitle
4
+ };
@@ -0,0 +1,19 @@
1
+ /** Hook options. */
2
+ type UseDocumentTitleOptions = {
3
+ /** Whether to keep the title after unmounting the component (default is `true`). */
4
+ preserveTitleOnUnmount?: boolean;
5
+ };
6
+ /**
7
+ * Custom hook that sets the document title.
8
+ * @param {string} title - The title to set.
9
+ * @param {?UseDocumentTitleOptions} [options] - The options.
10
+ * @public
11
+ * @see [Documentation](https://usehooks-ts.com/react-hook/use-document-title)
12
+ * @example
13
+ * ```tsx
14
+ * useDocumentTitle('My new title');
15
+ * ```
16
+ */
17
+ export declare function useDocumentTitle(title: string, options?: UseDocumentTitleOptions): void;
18
+ export {};
19
+ //# sourceMappingURL=useDocumentTitle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDocumentTitle.d.ts","sourceRoot":"","sources":["../../src/useDocumentTitle/useDocumentTitle.ts"],"names":[],"mappings":"AAKA,oBAAoB;AACpB,KAAK,uBAAuB,GAAG;IAC7B,oFAAoF;IACpF,sBAAsB,CAAC,EAAE,OAAO,CAAA;CACjC,CAAA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,uBAA4B,GACpC,IAAI,CAiBN"}
@@ -0,0 +1,16 @@
1
+ import { useRef as r } from "react";
2
+ import { useIsomorphicLayoutEffect as o } from "../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";
3
+ import { useUnmount as i } from "../useUnmount/useUnmount.js";
4
+ function l(e, n = {}) {
5
+ const { preserveTitleOnUnmount: u = !0 } = n, t = r(null);
6
+ o(() => {
7
+ t.current = window.document.title;
8
+ }, []), o(() => {
9
+ window.document.title = e;
10
+ }, [e]), i(() => {
11
+ !u && t.current && (window.document.title = t.current);
12
+ });
13
+ }
14
+ export {
15
+ l as useDocumentTitle
16
+ };
@@ -0,0 +1,2 @@
1
+ export * from './useEventCallback';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useEventCallback/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { useEventCallback as l } from "./useEventCallback.js";
2
+ export {
3
+ l as useEventCallback
4
+ };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Custom hook that creates a memoized event callback.
3
+ * @template Args - An array of argument types for the event callback.
4
+ * @template R - The return type of the event callback.
5
+ * @param {(...args: Args) => R} fn - The callback function.
6
+ * @returns {(...args: Args) => R} A memoized event callback function.
7
+ * @public
8
+ * @see [Documentation](https://usehooks-ts.com/react-hook/use-event-callback)
9
+ * @example
10
+ * ```tsx
11
+ * const handleClick = useEventCallback((event) => {
12
+ * // Handle the event here
13
+ * });
14
+ * ```
15
+ */
16
+ export declare function useEventCallback<Args extends unknown[], R>(fn: (...args: Args) => R): (...args: Args) => R;
17
+ export declare function useEventCallback<Args extends unknown[], R>(fn: ((...args: Args) => R) | undefined): ((...args: Args) => R) | undefined;
18
+ //# sourceMappingURL=useEventCallback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useEventCallback.d.ts","sourceRoot":"","sources":["../../src/useEventCallback/useEventCallback.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,CAAC,EACxD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,CAAC,GACvB,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,CAAC,CAAA;AACvB,wBAAgB,gBAAgB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,CAAC,EACxD,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,CAAC,CAAC,GAAG,SAAS,GACrC,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,CAAC,CAAC,GAAG,SAAS,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { useRef as t, useCallback as o } from "react";
2
+ import { useIsomorphicLayoutEffect as a } from "../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";
3
+ function l(e) {
4
+ const r = t(() => {
5
+ throw new Error("Cannot call an event handler while rendering.");
6
+ });
7
+ return a(() => {
8
+ r.current = e;
9
+ }, [e]), o((...n) => r.current?.(...n), [r]);
10
+ }
11
+ export {
12
+ l as useEventCallback
13
+ };
@@ -0,0 +1,2 @@
1
+ export * from './useEventListener';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useEventListener/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { useEventListener as t } from "./useEventListener.js";
2
+ export {
3
+ t as useEventListener
4
+ };
@@ -0,0 +1,9 @@
1
+ import { RefObject } from 'react';
2
+ declare function useEventListener<K extends keyof MediaQueryListEventMap>(eventName: K, handler: (event: MediaQueryListEventMap[K]) => void, element: RefObject<MediaQueryList>, options?: boolean | AddEventListenerOptions): void;
3
+ declare function useEventListener<K extends keyof WindowEventMap>(eventName: K, handler: (event: WindowEventMap[K]) => void, element?: undefined, options?: boolean | AddEventListenerOptions): void;
4
+ declare function useEventListener<K extends keyof HTMLElementEventMap & keyof SVGElementEventMap, T extends Element = K extends keyof HTMLElementEventMap ? HTMLDivElement : SVGElement>(eventName: K, handler: ((event: HTMLElementEventMap[K]) => void) | ((event: SVGElementEventMap[K]) => void), element: RefObject<Document | undefined | null>, options?: boolean | AddEventListenerOptions): void;
5
+ declare function useEventListener<K extends keyof WindowEventMap>(eventName: K, handler: (event: WindowEventMap[K]) => void, element: RefObject<Window | undefined | null>, options?: boolean | AddEventListenerOptions): void;
6
+ declare function useEventListener<K extends keyof DocumentEventMap>(eventName: K, handler: (event: DocumentEventMap[K]) => void, element: RefObject<Document | undefined | null>, options?: boolean | AddEventListenerOptions): void;
7
+ declare function useEventListener<K extends keyof HTMLElementEventMap>(eventName: K, handler: (event: HTMLElementEventMap[K]) => void, element: RefObject<HTMLElement | undefined | null>, options?: boolean | AddEventListenerOptions): void;
8
+ export { useEventListener };
9
+ //# sourceMappingURL=useEventListener.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useEventListener.d.ts","sourceRoot":"","sources":["../../src/useEventListener/useEventListener.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKtC,iBAAS,gBAAgB,CAAC,CAAC,SAAS,MAAM,sBAAsB,EAC9D,SAAS,EAAE,CAAC,EACZ,OAAO,EAAE,CAAC,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC,KAAK,IAAI,EACnD,OAAO,EAAE,SAAS,CAAC,cAAc,CAAC,EAClC,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI,CAAA;AAGP,iBAAS,gBAAgB,CAAC,CAAC,SAAS,MAAM,cAAc,EACtD,SAAS,EAAE,CAAC,EACZ,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,IAAI,EAC3C,OAAO,CAAC,EAAE,SAAS,EACnB,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI,CAAA;AAGP,iBAAS,gBAAgB,CACvB,CAAC,SAAS,MAAM,mBAAmB,GAAG,MAAM,kBAAkB,EAC9D,CAAC,SAAS,OAAO,GAAG,CAAC,SAAS,MAAM,mBAAmB,GACnD,cAAc,GACd,UAAU,EAEd,SAAS,EAAE,CAAC,EACZ,OAAO,EACH,CAAC,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,GACzC,CAAC,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,EAC5C,OAAO,EAAE,SAAS,CAAC,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC,EAC/C,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI,CAAA;AAGP,iBAAS,gBAAgB,CAAC,CAAC,SAAS,MAAM,cAAc,EACtD,SAAS,EAAE,CAAC,EACZ,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,IAAI,EAC3C,OAAO,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,EAC7C,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI,CAAC;AACR,iBAAS,gBAAgB,CAAC,CAAC,SAAS,MAAM,gBAAgB,EACxD,SAAS,EAAE,CAAC,EACZ,OAAO,EAAE,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,IAAI,EAC7C,OAAO,EAAE,SAAS,CAAC,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC,EAC/C,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI,CAAA;AACP,iBAAS,gBAAgB,CAAC,CAAC,SAAS,MAAM,mBAAmB,EAC3D,SAAS,EAAE,CAAC,EACZ,OAAO,EAAE,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,IAAI,EAChD,OAAO,EAAE,SAAS,CAAC,WAAW,GAAG,SAAS,GAAG,IAAI,CAAC,EAClD,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI,CAAC;AA6ER,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
@@ -0,0 +1,20 @@
1
+ import { useRef as f, useEffect as i } from "react";
2
+ import { useIsomorphicLayoutEffect as E } from "../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";
3
+ function m(r, t, s, n) {
4
+ const u = f(t);
5
+ E(() => {
6
+ u.current = t;
7
+ }, [t]), i(() => {
8
+ const e = s?.current ?? window;
9
+ if (!(e && e.addEventListener)) return;
10
+ const c = (o) => {
11
+ u.current(o);
12
+ };
13
+ return e.addEventListener(r, c, n), () => {
14
+ e.removeEventListener(r, c, n);
15
+ };
16
+ }, [r, s, n]);
17
+ }
18
+ export {
19
+ m as useEventListener
20
+ };
@@ -0,0 +1,2 @@
1
+ export * from './useHover';
2
+ //# sourceMappingURL=index.d.ts.map