react-simplikit 0.0.50 → 0.0.52

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 (279) hide show
  1. package/dist/components/ImpressionArea/ImpressionArea.cjs +57 -0
  2. package/{esm/components/ImpressionArea/index.d.ts → dist/components/ImpressionArea/ImpressionArea.d.cts} +9 -8
  3. package/dist/components/ImpressionArea/ImpressionArea.d.mts +48 -0
  4. package/dist/components/ImpressionArea/ImpressionArea.mjs +57 -0
  5. package/dist/components/ImpressionArea/index.d.cts +2 -46
  6. package/dist/components/ImpressionArea/index.d.mts +3 -0
  7. package/dist/components/Separated/Separated.cjs +38 -0
  8. package/{esm/components/Separated/index.d.ts → dist/components/Separated/Separated.d.cts} +7 -7
  9. package/dist/components/Separated/Separated.d.mts +38 -0
  10. package/dist/components/Separated/Separated.mjs +38 -0
  11. package/dist/components/Separated/index.d.cts +2 -37
  12. package/dist/components/Separated/index.d.mts +3 -0
  13. package/dist/components/SwitchCase/SwitchCase.cjs +40 -0
  14. package/{esm/components/SwitchCase/index.d.ts → dist/components/SwitchCase/SwitchCase.d.cts} +7 -8
  15. package/dist/components/SwitchCase/SwitchCase.d.mts +45 -0
  16. package/dist/components/SwitchCase/SwitchCase.mjs +40 -0
  17. package/dist/components/SwitchCase/index.d.cts +2 -45
  18. package/dist/components/SwitchCase/index.d.mts +3 -0
  19. package/dist/hooks/useAsyncEffect/index.d.cts +2 -24
  20. package/dist/hooks/useAsyncEffect/index.d.mts +3 -0
  21. package/dist/hooks/useAsyncEffect/useAsyncEffect.cjs +39 -0
  22. package/{esm/hooks/useAsyncEffect/index.d.ts → dist/hooks/useAsyncEffect/useAsyncEffect.d.cts} +4 -3
  23. package/dist/hooks/useAsyncEffect/useAsyncEffect.d.mts +26 -0
  24. package/dist/hooks/useAsyncEffect/useAsyncEffect.mjs +39 -0
  25. package/dist/hooks/useBooleanState/useBooleanState.cjs +36 -0
  26. package/dist/hooks/useBooleanState/{index.d.cts → useBooleanState.d.cts} +4 -2
  27. package/{esm/hooks/useBooleanState/index.d.ts → dist/hooks/useBooleanState/useBooleanState.d.mts} +4 -2
  28. package/dist/hooks/useBooleanState/useBooleanState.mjs +36 -0
  29. package/dist/hooks/useCallbackOncePerRender/index.d.cts +2 -39
  30. package/dist/hooks/useCallbackOncePerRender/index.d.mts +3 -0
  31. package/dist/hooks/useCallbackOncePerRender/useCallbackOncePerRender.cjs +52 -0
  32. package/{esm/hooks/useCallbackOncePerRender/index.d.ts → dist/hooks/useCallbackOncePerRender/useCallbackOncePerRender.d.cts} +4 -3
  33. package/dist/hooks/useCallbackOncePerRender/useCallbackOncePerRender.d.mts +41 -0
  34. package/dist/hooks/useCallbackOncePerRender/useCallbackOncePerRender.mjs +52 -0
  35. package/dist/hooks/useConditionalEffect/index.d.cts +2 -42
  36. package/dist/hooks/useConditionalEffect/index.d.mts +3 -0
  37. package/dist/hooks/useConditionalEffect/useConditionalEffect.cjs +57 -0
  38. package/{esm/hooks/useConditionalEffect/index.d.ts → dist/hooks/useConditionalEffect/useConditionalEffect.d.cts} +4 -3
  39. package/dist/hooks/useConditionalEffect/useConditionalEffect.d.mts +44 -0
  40. package/dist/hooks/useConditionalEffect/useConditionalEffect.mjs +57 -0
  41. package/dist/hooks/useControlledState/index.d.cts +2 -50
  42. package/dist/hooks/useControlledState/index.d.mts +3 -0
  43. package/dist/hooks/useControlledState/useControlledState.cjs +60 -0
  44. package/{esm/hooks/useControlledState/index.d.ts → dist/hooks/useControlledState/useControlledState.d.cts} +11 -10
  45. package/dist/hooks/useControlledState/useControlledState.d.mts +52 -0
  46. package/dist/hooks/useControlledState/useControlledState.mjs +60 -0
  47. package/dist/hooks/useCounter/useCounter.cjs +75 -0
  48. package/{esm/hooks/useCounter/index.d.ts → dist/hooks/useCounter/useCounter.d.cts} +12 -10
  49. package/dist/hooks/useCounter/{index.d.cts → useCounter.d.mts} +12 -10
  50. package/dist/hooks/useCounter/useCounter.mjs +75 -0
  51. package/dist/hooks/useDebounce/debounce.cjs +49 -0
  52. package/dist/hooks/useDebounce/debounce.d.cts +8 -0
  53. package/dist/hooks/useDebounce/debounce.d.mts +8 -0
  54. package/dist/hooks/useDebounce/debounce.mjs +49 -0
  55. package/dist/hooks/useDebounce/useDebounce.cjs +66 -0
  56. package/{esm/hooks/useDebounce/index.d.ts → dist/hooks/useDebounce/useDebounce.d.cts} +6 -8
  57. package/dist/hooks/useDebounce/{index.d.cts → useDebounce.d.mts} +6 -8
  58. package/dist/hooks/useDebounce/useDebounce.mjs +66 -0
  59. package/dist/hooks/useDebouncedCallback/useDebouncedCallback.cjs +62 -0
  60. package/{esm/hooks/useDebouncedCallback/index.d.ts → dist/hooks/useDebouncedCallback/useDebouncedCallback.d.cts} +9 -7
  61. package/dist/hooks/useDebouncedCallback/{index.d.cts → useDebouncedCallback.d.mts} +9 -7
  62. package/dist/hooks/useDebouncedCallback/useDebouncedCallback.mjs +62 -0
  63. package/dist/hooks/useDoubleClick/index.d.cts +2 -45
  64. package/dist/hooks/useDoubleClick/index.d.mts +3 -0
  65. package/dist/hooks/useDoubleClick/useDoubleClick.cjs +64 -0
  66. package/{esm/hooks/useDoubleClick/index.d.ts → dist/hooks/useDoubleClick/useDoubleClick.d.cts} +8 -7
  67. package/dist/hooks/useDoubleClick/useDoubleClick.d.mts +47 -0
  68. package/dist/hooks/useDoubleClick/useDoubleClick.mjs +64 -0
  69. package/dist/hooks/useGeolocation/useGeolocation.cjs +210 -0
  70. package/{esm/hooks/useGeolocation/index.d.ts → dist/hooks/useGeolocation/useGeolocation.d.cts} +26 -24
  71. package/dist/hooks/useGeolocation/{index.d.cts → useGeolocation.d.mts} +26 -24
  72. package/dist/hooks/useGeolocation/useGeolocation.mjs +209 -0
  73. package/dist/hooks/useImpressionRef/useImpressionRef.cjs +67 -0
  74. package/{esm/hooks/useImpressionRef/index.d.ts → dist/hooks/useImpressionRef/useImpressionRef.d.cts} +10 -8
  75. package/dist/hooks/useImpressionRef/{index.d.cts → useImpressionRef.d.mts} +10 -8
  76. package/dist/hooks/useImpressionRef/useImpressionRef.mjs +67 -0
  77. package/dist/hooks/useInputState/index.d.cts +2 -22
  78. package/dist/hooks/useInputState/index.d.mts +3 -0
  79. package/dist/hooks/useInputState/useInputState.cjs +32 -0
  80. package/{esm/hooks/useInputState/index.d.ts → dist/hooks/useInputState/useInputState.d.cts} +4 -3
  81. package/dist/hooks/useInputState/useInputState.d.mts +24 -0
  82. package/dist/hooks/useInputState/useInputState.mjs +32 -0
  83. package/dist/hooks/useIntersectionObserver/useIntersectionObserver.cjs +58 -0
  84. package/dist/hooks/useIntersectionObserver/{index.d.cts → useIntersectionObserver.d.cts} +4 -2
  85. package/{esm/hooks/useIntersectionObserver/index.d.ts → dist/hooks/useIntersectionObserver/useIntersectionObserver.d.mts} +4 -2
  86. package/dist/hooks/useIntersectionObserver/useIntersectionObserver.mjs +58 -0
  87. package/dist/hooks/useInterval/useInterval.cjs +65 -0
  88. package/dist/hooks/useInterval/{index.d.cts → useInterval.d.cts} +7 -5
  89. package/{esm/hooks/useInterval/index.d.ts → dist/hooks/useInterval/useInterval.d.mts} +7 -5
  90. package/dist/hooks/useInterval/useInterval.mjs +65 -0
  91. package/dist/hooks/useIsClient/useIsClient.cjs +49 -0
  92. package/dist/hooks/useIsClient/{index.d.cts → useIsClient.d.cts} +4 -2
  93. package/{esm/hooks/useIsClient/index.d.ts → dist/hooks/useIsClient/useIsClient.d.mts} +4 -2
  94. package/dist/hooks/useIsClient/useIsClient.mjs +49 -0
  95. package/dist/hooks/useIsomorphicLayoutEffect/index.d.cts +2 -24
  96. package/dist/hooks/useIsomorphicLayoutEffect/index.d.mts +3 -0
  97. package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.cjs +25 -0
  98. package/{esm/hooks/useIsomorphicLayoutEffect/index.d.ts → dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.cts} +4 -3
  99. package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.mts +26 -0
  100. package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs +25 -0
  101. package/dist/hooks/useList/useList.cjs +94 -0
  102. package/{esm/hooks/useList/index.d.ts → dist/hooks/useList/useList.d.cts} +10 -8
  103. package/dist/hooks/useList/{index.d.cts → useList.d.mts} +10 -8
  104. package/dist/hooks/useList/useList.mjs +94 -0
  105. package/dist/hooks/useLoading/useLoading.cjs +61 -0
  106. package/dist/hooks/useLoading/{index.d.cts → useLoading.d.cts} +4 -2
  107. package/{esm/hooks/useLoading/index.d.ts → dist/hooks/useLoading/useLoading.d.mts} +4 -2
  108. package/dist/hooks/useLoading/useLoading.mjs +61 -0
  109. package/dist/hooks/useLongPress/index.d.cts +2 -73
  110. package/dist/hooks/useLongPress/index.d.mts +3 -0
  111. package/dist/hooks/useLongPress/useLongPress.cjs +133 -0
  112. package/{esm/hooks/useLongPress/index.d.ts → dist/hooks/useLongPress/useLongPress.d.cts} +18 -17
  113. package/dist/hooks/useLongPress/useLongPress.d.mts +75 -0
  114. package/dist/hooks/useLongPress/useLongPress.mjs +133 -0
  115. package/dist/hooks/useMap/useMap.cjs +64 -0
  116. package/dist/hooks/useMap/{index.d.cts → useMap.d.cts} +12 -10
  117. package/{esm/hooks/useMap/index.d.ts → dist/hooks/useMap/useMap.d.mts} +12 -10
  118. package/dist/hooks/useMap/useMap.mjs +64 -0
  119. package/dist/hooks/useOutsideClickEffect/useOutsideClickEffect.cjs +51 -0
  120. package/{esm/hooks/useOutsideClickEffect/index.d.ts → dist/hooks/useOutsideClickEffect/useOutsideClickEffect.d.cts} +4 -2
  121. package/dist/hooks/useOutsideClickEffect/{index.d.cts → useOutsideClickEffect.d.mts} +4 -2
  122. package/dist/hooks/useOutsideClickEffect/useOutsideClickEffect.mjs +51 -0
  123. package/dist/hooks/usePreservedCallback/usePreservedCallback.cjs +41 -0
  124. package/dist/hooks/usePreservedCallback/{index.d.cts → usePreservedCallback.d.cts} +4 -2
  125. package/{esm/hooks/usePreservedCallback/index.d.ts → dist/hooks/usePreservedCallback/usePreservedCallback.d.mts} +4 -2
  126. package/dist/hooks/usePreservedCallback/usePreservedCallback.mjs +41 -0
  127. package/dist/hooks/usePreservedReference/usePreservedReference.cjs +55 -0
  128. package/dist/hooks/usePreservedReference/{index.d.cts → usePreservedReference.d.cts} +4 -2
  129. package/{esm/hooks/usePreservedReference/index.d.ts → dist/hooks/usePreservedReference/usePreservedReference.d.mts} +4 -2
  130. package/dist/hooks/usePreservedReference/usePreservedReference.mjs +55 -0
  131. package/dist/hooks/usePrevious/usePrevious.cjs +38 -0
  132. package/{esm/hooks/usePrevious/index.d.ts → dist/hooks/usePrevious/usePrevious.d.cts} +4 -2
  133. package/dist/hooks/usePrevious/{index.d.cts → usePrevious.d.mts} +4 -2
  134. package/dist/hooks/usePrevious/usePrevious.mjs +38 -0
  135. package/dist/hooks/useRefEffect/index.d.cts +2 -30
  136. package/dist/hooks/useRefEffect/index.d.mts +3 -0
  137. package/dist/hooks/useRefEffect/useRefEffect.cjs +42 -0
  138. package/{esm/hooks/useRefEffect/index.d.ts → dist/hooks/useRefEffect/useRefEffect.d.cts} +4 -3
  139. package/dist/hooks/useRefEffect/useRefEffect.d.mts +32 -0
  140. package/dist/hooks/useRefEffect/useRefEffect.mjs +42 -0
  141. package/dist/hooks/useSet/useSet.cjs +79 -0
  142. package/dist/hooks/useSet/{index.d.cts → useSet.d.cts} +9 -7
  143. package/{esm/hooks/useSet/index.d.ts → dist/hooks/useSet/useSet.d.mts} +9 -7
  144. package/dist/hooks/useSet/useSet.mjs +79 -0
  145. package/dist/hooks/useStorageState/index.d.cts +2 -60
  146. package/dist/hooks/useStorageState/index.d.mts +3 -0
  147. package/dist/hooks/useStorageState/storage.cjs +85 -0
  148. package/dist/hooks/useStorageState/storage.d.cts +10 -0
  149. package/dist/hooks/useStorageState/storage.d.mts +10 -0
  150. package/dist/hooks/useStorageState/storage.mjs +80 -0
  151. package/dist/hooks/useStorageState/useStorageState.cjs +81 -0
  152. package/{esm/hooks/useStorageState/index.d.ts → dist/hooks/useStorageState/useStorageState.d.cts} +10 -15
  153. package/dist/hooks/useStorageState/useStorageState.d.mts +56 -0
  154. package/dist/hooks/useStorageState/useStorageState.mjs +81 -0
  155. package/dist/hooks/useThrottle/throttle.cjs +19 -0
  156. package/dist/hooks/useThrottle/throttle.d.cts +19 -0
  157. package/dist/hooks/useThrottle/throttle.d.mts +19 -0
  158. package/dist/hooks/useThrottle/throttle.mjs +19 -0
  159. package/dist/hooks/useThrottle/useThrottle.cjs +49 -0
  160. package/dist/hooks/useThrottle/{index.d.cts → useThrottle.d.cts} +6 -19
  161. package/{esm/hooks/useThrottle/index.d.ts → dist/hooks/useThrottle/useThrottle.d.mts} +6 -19
  162. package/dist/hooks/useThrottle/useThrottle.mjs +49 -0
  163. package/dist/hooks/useThrottledCallback/useThrottledCallback.cjs +57 -0
  164. package/{esm/hooks/useThrottledCallback/index.d.ts → dist/hooks/useThrottledCallback/useThrottledCallback.d.cts} +8 -6
  165. package/dist/hooks/useThrottledCallback/{index.d.cts → useThrottledCallback.d.mts} +8 -6
  166. package/dist/hooks/useThrottledCallback/useThrottledCallback.mjs +57 -0
  167. package/dist/hooks/useTimeout/useTimeout.cjs +40 -0
  168. package/dist/hooks/useTimeout/{index.d.cts → useTimeout.d.cts} +4 -2
  169. package/{esm/hooks/useTimeout/index.d.ts → dist/hooks/useTimeout/useTimeout.d.mts} +4 -2
  170. package/dist/hooks/useTimeout/useTimeout.mjs +40 -0
  171. package/dist/hooks/useToggle/useToggle.cjs +34 -0
  172. package/dist/hooks/useToggle/{index.d.cts → useToggle.d.cts} +4 -4
  173. package/{esm/hooks/useToggle/index.d.ts → dist/hooks/useToggle/useToggle.d.mts} +4 -4
  174. package/dist/hooks/useToggle/useToggle.mjs +34 -0
  175. package/dist/hooks/useVisibilityEvent/useVisibilityEvent.cjs +42 -0
  176. package/{esm/hooks/useVisibilityEvent/index.d.ts → dist/hooks/useVisibilityEvent/useVisibilityEvent.d.cts} +5 -3
  177. package/dist/hooks/useVisibilityEvent/{index.d.cts → useVisibilityEvent.d.mts} +5 -3
  178. package/dist/hooks/useVisibilityEvent/useVisibilityEvent.mjs +42 -0
  179. package/dist/index.cjs +77 -1382
  180. package/dist/index.d.cts +56 -40
  181. package/dist/index.d.mts +56 -0
  182. package/dist/index.mjs +40 -0
  183. package/dist/utils/buildContext/buildContext.cjs +50 -0
  184. package/{esm/utils/buildContext/index.d.ts → dist/utils/buildContext/buildContext.d.cts} +7 -7
  185. package/dist/utils/buildContext/buildContext.d.mts +38 -0
  186. package/dist/utils/buildContext/buildContext.mjs +50 -0
  187. package/dist/utils/buildContext/index.d.cts +2 -37
  188. package/dist/utils/buildContext/index.d.mts +3 -0
  189. package/dist/utils/mergeProps/index.d.cts +2 -25
  190. package/dist/utils/mergeProps/index.d.mts +3 -0
  191. package/dist/utils/mergeProps/mergeProps.cjs +53 -0
  192. package/{esm/utils/mergeProps/index.d.ts → dist/utils/mergeProps/mergeProps.d.cts} +7 -8
  193. package/dist/utils/mergeProps/mergeProps.d.mts +25 -0
  194. package/dist/utils/mergeProps/mergeProps.mjs +53 -0
  195. package/dist/utils/mergeRefs/index.d.cts +2 -38
  196. package/dist/utils/mergeRefs/index.d.mts +3 -0
  197. package/dist/utils/mergeRefs/mergeRefs.cjs +50 -0
  198. package/{esm/utils/mergeRefs/index.d.ts → dist/utils/mergeRefs/mergeRefs.d.cts} +4 -3
  199. package/dist/utils/mergeRefs/mergeRefs.d.mts +40 -0
  200. package/dist/utils/mergeRefs/mergeRefs.mjs +50 -0
  201. package/package.json +9 -11
  202. package/dist/components/ImpressionArea/index.cjs +0 -295
  203. package/dist/components/Separated/index.cjs +0 -41
  204. package/dist/components/SwitchCase/index.cjs +0 -36
  205. package/dist/hooks/useAsyncEffect/index.cjs +0 -44
  206. package/dist/hooks/useBooleanState/index.cjs +0 -46
  207. package/dist/hooks/useCallbackOncePerRender/index.cjs +0 -63
  208. package/dist/hooks/useConditionalEffect/index.cjs +0 -51
  209. package/dist/hooks/useControlledState/index.cjs +0 -57
  210. package/dist/hooks/useCounter/index.cjs +0 -70
  211. package/dist/hooks/useDebounce/index.cjs +0 -130
  212. package/dist/hooks/useDebouncedCallback/index.cjs +0 -148
  213. package/dist/hooks/useDoubleClick/index.cjs +0 -79
  214. package/dist/hooks/useGeolocation/index.cjs +0 -154
  215. package/dist/hooks/useImpressionRef/index.cjs +0 -258
  216. package/dist/hooks/useInputState/index.cjs +0 -46
  217. package/dist/hooks/useIntersectionObserver/index.cjs +0 -95
  218. package/dist/hooks/useInterval/index.cjs +0 -74
  219. package/dist/hooks/useIsClient/index.cjs +0 -40
  220. package/dist/hooks/useIsomorphicLayoutEffect/index.cjs +0 -35
  221. package/dist/hooks/useList/index.cjs +0 -104
  222. package/dist/hooks/useLoading/index.cjs +0 -65
  223. package/dist/hooks/useLongPress/index.cjs +0 -127
  224. package/dist/hooks/useMap/index.cjs +0 -78
  225. package/dist/hooks/useOutsideClickEffect/index.cjs +0 -74
  226. package/dist/hooks/usePreservedCallback/index.cjs +0 -45
  227. package/dist/hooks/usePreservedReference/index.cjs +0 -45
  228. package/dist/hooks/usePrevious/index.cjs +0 -48
  229. package/dist/hooks/useRefEffect/index.cjs +0 -72
  230. package/dist/hooks/useSet/index.cjs +0 -105
  231. package/dist/hooks/useStorageState/index.cjs +0 -196
  232. package/dist/hooks/useThrottle/index.cjs +0 -151
  233. package/dist/hooks/useThrottledCallback/index.cjs +0 -172
  234. package/dist/hooks/useTimeout/index.cjs +0 -57
  235. package/dist/hooks/useToggle/index.cjs +0 -37
  236. package/dist/hooks/useVisibilityEvent/index.cjs +0 -47
  237. package/dist/utils/buildContext/index.cjs +0 -56
  238. package/dist/utils/mergeProps/index.cjs +0 -71
  239. package/dist/utils/mergeRefs/index.cjs +0 -46
  240. package/esm/components/ImpressionArea/index.js +0 -269
  241. package/esm/components/Separated/index.js +0 -15
  242. package/esm/components/SwitchCase/index.js +0 -10
  243. package/esm/hooks/useAsyncEffect/index.js +0 -18
  244. package/esm/hooks/useBooleanState/index.js +0 -20
  245. package/esm/hooks/useCallbackOncePerRender/index.js +0 -37
  246. package/esm/hooks/useConditionalEffect/index.js +0 -25
  247. package/esm/hooks/useControlledState/index.js +0 -31
  248. package/esm/hooks/useCounter/index.js +0 -44
  249. package/esm/hooks/useDebounce/index.js +0 -104
  250. package/esm/hooks/useDebouncedCallback/index.js +0 -122
  251. package/esm/hooks/useDoubleClick/index.js +0 -53
  252. package/esm/hooks/useGeolocation/index.js +0 -128
  253. package/esm/hooks/useImpressionRef/index.js +0 -232
  254. package/esm/hooks/useInputState/index.js +0 -20
  255. package/esm/hooks/useIntersectionObserver/index.js +0 -69
  256. package/esm/hooks/useInterval/index.js +0 -48
  257. package/esm/hooks/useIsClient/index.js +0 -14
  258. package/esm/hooks/useIsomorphicLayoutEffect/index.js +0 -9
  259. package/esm/hooks/useList/index.js +0 -78
  260. package/esm/hooks/useLoading/index.js +0 -39
  261. package/esm/hooks/useLongPress/index.js +0 -101
  262. package/esm/hooks/useMap/index.js +0 -52
  263. package/esm/hooks/useOutsideClickEffect/index.js +0 -48
  264. package/esm/hooks/usePreservedCallback/index.js +0 -19
  265. package/esm/hooks/usePreservedReference/index.js +0 -19
  266. package/esm/hooks/usePrevious/index.js +0 -22
  267. package/esm/hooks/useRefEffect/index.js +0 -46
  268. package/esm/hooks/useSet/index.js +0 -79
  269. package/esm/hooks/useStorageState/index.js +0 -170
  270. package/esm/hooks/useThrottle/index.js +0 -125
  271. package/esm/hooks/useThrottledCallback/index.js +0 -146
  272. package/esm/hooks/useTimeout/index.js +0 -31
  273. package/esm/hooks/useToggle/index.js +0 -11
  274. package/esm/hooks/useVisibilityEvent/index.js +0 -21
  275. package/esm/index.d.ts +0 -40
  276. package/esm/index.js +0 -1320
  277. package/esm/utils/buildContext/index.js +0 -30
  278. package/esm/utils/mergeProps/index.js +0 -45
  279. package/esm/utils/mergeRefs/index.js +0 -20
package/dist/index.cjs CHANGED
@@ -1,1383 +1,78 @@
1
1
  "use client";
2
- "use strict";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/index.ts
22
- var index_exports = {};
23
- __export(index_exports, {
24
- ImpressionArea: () => ImpressionArea,
25
- Separated: () => Separated,
26
- SwitchCase: () => SwitchCase,
27
- buildContext: () => buildContext,
28
- mergeProps: () => mergeProps,
29
- mergeRefs: () => mergeRefs,
30
- useAsyncEffect: () => useAsyncEffect,
31
- useBooleanState: () => useBooleanState,
32
- useCallbackOncePerRender: () => useCallbackOncePerRender,
33
- useConditionalEffect: () => useConditionalEffect,
34
- useControlledState: () => useControlledState,
35
- useCounter: () => useCounter,
36
- useDebounce: () => useDebounce,
37
- useDebouncedCallback: () => useDebouncedCallback,
38
- useDoubleClick: () => useDoubleClick,
39
- useGeolocation: () => useGeolocation,
40
- useImpressionRef: () => useImpressionRef,
41
- useInputState: () => useInputState,
42
- useIntersectionObserver: () => useIntersectionObserver,
43
- useInterval: () => useInterval,
44
- useIsClient: () => useIsClient,
45
- useIsomorphicLayoutEffect: () => useIsomorphicLayoutEffect,
46
- useList: () => useList,
47
- useLoading: () => useLoading,
48
- useLongPress: () => useLongPress,
49
- useMap: () => useMap,
50
- useOutsideClickEffect: () => useOutsideClickEffect,
51
- usePreservedCallback: () => usePreservedCallback,
52
- usePreservedReference: () => usePreservedReference,
53
- usePrevious: () => usePrevious,
54
- useRefEffect: () => useRefEffect,
55
- useSet: () => useSet,
56
- useStorageState: () => useStorageState,
57
- useThrottle: () => useThrottle,
58
- useThrottledCallback: () => useThrottledCallback,
59
- useTimeout: () => useTimeout,
60
- useToggle: () => useToggle,
61
- useVisibilityEvent: () => useVisibilityEvent
62
- });
63
- module.exports = __toCommonJS(index_exports);
64
-
65
- // src/components/ImpressionArea/ImpressionArea.tsx
66
- var import_react7 = require("react");
67
-
68
- // src/hooks/useImpressionRef/useImpressionRef.ts
69
- var import_react6 = require("react");
70
-
71
- // src/hooks/useDebouncedCallback/useDebouncedCallback.ts
72
- var import_react2 = require("react");
73
-
74
- // src/hooks/useDebounce/debounce.ts
75
- function debounce(func, debounceMs, { edges = ["leading", "trailing"] } = {}) {
76
- let pendingThis = void 0;
77
- let pendingArgs = null;
78
- const leading = edges != null && edges.includes("leading");
79
- const trailing = edges == null || edges.includes("trailing");
80
- const invoke = () => {
81
- if (pendingArgs !== null) {
82
- func.apply(pendingThis, pendingArgs);
83
- pendingThis = void 0;
84
- pendingArgs = null;
85
- }
86
- };
87
- const onTimerEnd = () => {
88
- if (trailing) {
89
- invoke();
90
- }
91
- cancel();
92
- };
93
- let timeoutId = null;
94
- const schedule = () => {
95
- if (timeoutId != null) {
96
- clearTimeout(timeoutId);
97
- }
98
- timeoutId = setTimeout(() => {
99
- timeoutId = null;
100
- onTimerEnd();
101
- }, debounceMs);
102
- };
103
- const cancelTimer = () => {
104
- if (timeoutId !== null) {
105
- clearTimeout(timeoutId);
106
- timeoutId = null;
107
- }
108
- };
109
- const cancel = () => {
110
- cancelTimer();
111
- pendingThis = void 0;
112
- pendingArgs = null;
113
- };
114
- const debounced = function(...args) {
115
- pendingThis = this;
116
- pendingArgs = args;
117
- const isFirstCall = timeoutId == null;
118
- schedule();
119
- if (leading && isFirstCall) {
120
- invoke();
121
- }
122
- };
123
- debounced.cancel = cancel;
124
- return debounced;
125
- }
126
-
127
- // src/hooks/usePreservedCallback/usePreservedCallback.ts
128
- var import_react = require("react");
129
- function usePreservedCallback(callback) {
130
- const callbackRef = (0, import_react.useRef)(callback);
131
- (0, import_react.useEffect)(
132
- function syncCallbackRef() {
133
- callbackRef.current = callback;
134
- },
135
- [callback]
136
- );
137
- return (0, import_react.useCallback)((...args) => {
138
- return callbackRef.current(...args);
139
- }, []);
140
- }
141
-
142
- // src/hooks/useDebouncedCallback/useDebouncedCallback.ts
143
- function useDebouncedCallback({
144
- onChange,
145
- timeThreshold,
146
- leading = false,
147
- trailing = true
148
- }) {
149
- const handleChange = usePreservedCallback(onChange);
150
- const ref = (0, import_react2.useRef)({ value: false, clearPreviousDebounce: () => {
151
- } });
152
- (0, import_react2.useEffect)(function clearDebouncedOnUnmount() {
153
- const current = ref.current;
154
- return () => {
155
- current.clearPreviousDebounce();
156
- };
157
- }, []);
158
- const edges = (0, import_react2.useMemo)(() => {
159
- const _edges = [];
160
- if (leading) {
161
- _edges.push("leading");
162
- }
163
- if (trailing) {
164
- _edges.push("trailing");
165
- }
166
- return _edges;
167
- }, [leading, trailing]);
168
- return (0, import_react2.useCallback)(
169
- (nextValue) => {
170
- if (nextValue === ref.current.value) {
171
- return;
172
- }
173
- const debounced = debounce(
174
- () => {
175
- handleChange(nextValue);
176
- ref.current.value = nextValue;
177
- },
178
- timeThreshold,
179
- { edges }
180
- );
181
- ref.current.clearPreviousDebounce();
182
- debounced();
183
- ref.current.clearPreviousDebounce = debounced.cancel;
184
- },
185
- [handleChange, timeThreshold, edges]
186
- );
187
- }
188
-
189
- // src/hooks/useIntersectionObserver/useIntersectionObserver.ts
190
- var import_react4 = require("react");
191
-
192
- // src/hooks/useRefEffect/useRefEffect.ts
193
- var import_react3 = require("react");
194
- function useRefEffect(callback, deps) {
195
- const preservedCallback = usePreservedCallback(callback);
196
- const cleanupCallbackRef = (0, import_react3.useRef)(() => {
197
- });
198
- const effect = (0, import_react3.useCallback)(
199
- (element) => {
200
- cleanupCallbackRef.current();
201
- cleanupCallbackRef.current = () => {
202
- };
203
- if (element == null) {
204
- return;
205
- }
206
- const cleanup = preservedCallback(element);
207
- if (typeof cleanup === "function") {
208
- cleanupCallbackRef.current = cleanup;
209
- }
210
- },
211
- // eslint-disable-next-line react-hooks/exhaustive-deps
212
- [preservedCallback, ...deps]
213
- );
214
- return effect;
215
- }
216
-
217
- // src/hooks/useIntersectionObserver/useIntersectionObserver.ts
218
- function useIntersectionObserver(callback, options) {
219
- const preservedCallback = usePreservedCallback(callback);
220
- const observer = (0, import_react4.useMemo)(() => {
221
- if (typeof IntersectionObserver === "undefined") {
222
- return;
223
- }
224
- return new IntersectionObserver(([entry]) => {
225
- preservedCallback(entry);
226
- }, options);
227
- }, [preservedCallback, options]);
228
- return useRefEffect(
229
- (element) => {
230
- observer?.observe(element);
231
- return () => {
232
- observer?.unobserve(element);
233
- };
234
- },
235
- [preservedCallback, options]
236
- );
237
- }
238
-
239
- // src/hooks/useVisibilityEvent/useVisibilityEvent.ts
240
- var import_react5 = require("react");
241
- function useVisibilityEvent(callback, options = {}) {
242
- const handleVisibilityChange = (0, import_react5.useCallback)(() => {
243
- callback(document.visibilityState);
244
- }, [callback]);
245
- (0, import_react5.useEffect)(() => {
246
- if (options?.immediate ?? false) {
247
- handleVisibilityChange();
248
- }
249
- document.addEventListener("visibilitychange", handleVisibilityChange);
250
- return () => {
251
- document.removeEventListener("visibilitychange", handleVisibilityChange);
252
- };
253
- }, [handleVisibilityChange, options?.immediate]);
254
- }
255
-
256
- // src/hooks/useImpressionRef/useImpressionRef.ts
257
- function useImpressionRef({
258
- onImpressionStart = () => {
259
- },
260
- onImpressionEnd = () => {
261
- },
262
- rootMargin,
263
- areaThreshold = 0,
264
- timeThreshold = 0
265
- }) {
266
- const impressionStartHandler = usePreservedCallback(onImpressionStart);
267
- const impressionEndHandler = usePreservedCallback(onImpressionEnd);
268
- const isIntersectingRef = (0, import_react6.useRef)(false);
269
- const impressionEventHandler = useDebouncedCallback({
270
- timeThreshold,
271
- onChange: (impressed) => {
272
- (impressed ? impressionStartHandler : impressionEndHandler)();
273
- },
274
- leading: true
275
- });
276
- useVisibilityEvent((documentVisible) => {
277
- if (!isIntersectingRef.current) {
278
- return;
279
- }
280
- impressionEventHandler(documentVisible === "visible");
281
- });
282
- return useIntersectionObserver(
283
- (entry) => {
284
- if (document.visibilityState === "hidden") {
285
- return;
286
- }
287
- const currentRatio = entry.intersectionRatio;
288
- const isIntersecting = areaThreshold === 0 ? entry.isIntersecting : currentRatio >= areaThreshold;
289
- isIntersectingRef.current = isIntersecting;
290
- impressionEventHandler(isIntersecting);
291
- },
292
- { rootMargin, threshold: areaThreshold }
293
- );
294
- }
295
-
296
- // src/utils/mergeRefs/mergeRefs.ts
297
- function mergeRefs(...refs) {
298
- return (value) => {
299
- for (const ref of refs) {
300
- if (ref == null) {
301
- continue;
302
- }
303
- if (typeof ref === "function") {
304
- ref(value);
305
- continue;
306
- }
307
- ref.current = value;
308
- }
309
- };
310
- }
311
-
312
- // src/components/ImpressionArea/ImpressionArea.tsx
313
- var import_jsx_runtime = require("react/jsx-runtime");
314
- var ImpressionArea = (0, import_react7.forwardRef)(ImpressionAreaImpl);
315
- function ImpressionAreaImpl({ as, rootMargin, areaThreshold, timeThreshold, onImpressionStart, onImpressionEnd, ...props }, ref) {
316
- const Component = as ?? "div";
317
- const impressionRef = useImpressionRef({
318
- onImpressionStart,
319
- onImpressionEnd,
320
- areaThreshold,
321
- timeThreshold,
322
- rootMargin
323
- });
324
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ref: mergeRefs(ref, impressionRef), ...props });
325
- }
326
- Object.assign(ImpressionArea, {
327
- displayName: "ImpressionArea"
328
- });
329
-
330
- // src/components/Separated/Separated.tsx
331
- var import_react8 = require("react");
332
- var import_jsx_runtime2 = require("react/jsx-runtime");
333
- function Separated({ children, by: separator }) {
334
- const childrenArray = import_react8.Children.toArray(children).filter(import_react8.isValidElement);
335
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: childrenArray.map((child, i, { length }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react8.Fragment, { children: [
336
- child,
337
- i + 1 !== length && separator
338
- ] }, child.key ?? i)) });
339
- }
340
-
341
- // src/components/SwitchCase/SwitchCase.tsx
342
- function SwitchCase({ value, caseBy, defaultComponent = () => null }) {
343
- const stringifiedValue = String(value);
344
- return (caseBy[stringifiedValue] ?? defaultComponent)();
345
- }
346
-
347
- // src/hooks/useAsyncEffect/useAsyncEffect.ts
348
- var import_react9 = require("react");
349
- function useAsyncEffect(effect, deps) {
350
- (0, import_react9.useEffect)(() => {
351
- let cleanup;
352
- effect().then((result) => {
353
- cleanup = result;
354
- });
355
- return () => {
356
- cleanup?.();
357
- };
358
- }, deps);
359
- }
360
-
361
- // src/hooks/useBooleanState/useBooleanState.ts
362
- var import_react10 = require("react");
363
- function useBooleanState(defaultValue = false) {
364
- const [bool, setBool] = (0, import_react10.useState)(defaultValue);
365
- const setTrue = (0, import_react10.useCallback)(() => {
366
- setBool(true);
367
- }, []);
368
- const setFalse = (0, import_react10.useCallback)(() => {
369
- setBool(false);
370
- }, []);
371
- const toggle2 = (0, import_react10.useCallback)(() => {
372
- setBool((prevBool) => !prevBool);
373
- }, []);
374
- return [bool, setTrue, setFalse, toggle2];
375
- }
376
-
377
- // src/hooks/useCallbackOncePerRender/useCallbackOncePerRender.ts
378
- var import_react11 = require("react");
379
- function useCallbackOncePerRender(callback, deps) {
380
- const hasFired = (0, import_react11.useRef)(false);
381
- (0, import_react11.useEffect)(() => {
382
- hasFired.current = false;
383
- }, deps);
384
- return usePreservedCallback((...args) => {
385
- if (hasFired.current) {
386
- return;
387
- }
388
- callback(...args);
389
- hasFired.current = true;
390
- });
391
- }
392
-
393
- // src/hooks/useConditionalEffect/useConditionalEffect.ts
394
- var import_react12 = require("react");
395
- function useConditionalEffect(effect, deps, condition) {
396
- const prevDepsRef = (0, import_react12.useRef)(void 0);
397
- const memoizedCondition = (0, import_react12.useCallback)(condition, deps);
398
- if (deps.length === 0) {
399
- console.warn(
400
- "useConditionalEffect received an empty dependency array. This may indicate missing dependencies and could lead to unexpected behavior."
401
- );
402
- }
403
- const shouldRun = memoizedCondition(prevDepsRef.current, deps);
404
- (0, import_react12.useEffect)(() => {
405
- if (shouldRun) {
406
- const cleanup = effect();
407
- prevDepsRef.current = deps;
408
- return cleanup;
409
- }
410
- prevDepsRef.current = deps;
411
- }, deps);
412
- }
413
-
414
- // src/hooks/useControlledState/useControlledState.ts
415
- var import_react13 = require("react");
416
- function useControlledState({
417
- value: valueProp,
418
- defaultValue,
419
- onChange,
420
- equalityFn = Object.is
421
- }) {
422
- const [uncontrolledState, setUncontrolledState] = (0, import_react13.useState)(defaultValue);
423
- const controlled = valueProp !== void 0;
424
- const value = controlled ? valueProp : uncontrolledState;
425
- const setValue = (0, import_react13.useCallback)(
426
- (next) => {
427
- const nextValue = isSetStateAction(next) ? next(value) : next;
428
- if (equalityFn(value, nextValue) === true) return;
429
- if (controlled === false) setUncontrolledState(nextValue);
430
- if (controlled === true && nextValue === void 0) setUncontrolledState(nextValue);
431
- onChange?.(nextValue);
432
- },
433
- [controlled, onChange, equalityFn, value]
434
- );
435
- return [value, setValue];
436
- }
437
- function isSetStateAction(next) {
438
- return typeof next === "function";
439
- }
440
-
441
- // src/hooks/useCounter/useCounter.ts
442
- var import_react14 = require("react");
443
- var validateValue = (value, { min, max }) => {
444
- if (min !== void 0 && value < min) {
445
- return min;
446
- }
447
- if (max !== void 0 && value > max) {
448
- return max;
449
- }
450
- return value;
451
- };
452
- function useCounter(initialValue = 0, { min, max, step = 1 } = {}) {
453
- const [count, setCountState] = (0, import_react14.useState)(() => validateValue(initialValue, { min, max }));
454
- const setCount = (0, import_react14.useCallback)(
455
- (value) => {
456
- setCountState((prev) => {
457
- const nextValue = typeof value === "function" ? value(prev) : value;
458
- return validateValue(nextValue, { min, max });
459
- });
460
- },
461
- [min, max]
462
- );
463
- const increment = (0, import_react14.useCallback)(() => {
464
- setCount((prev) => prev + step);
465
- }, [setCount, step]);
466
- const decrement = (0, import_react14.useCallback)(() => {
467
- setCount((prev) => prev - step);
468
- }, [setCount, step]);
469
- const reset = (0, import_react14.useCallback)(() => {
470
- setCount(initialValue);
471
- }, [setCount, initialValue]);
472
- return {
473
- count,
474
- increment,
475
- decrement,
476
- reset,
477
- setCount
478
- };
479
- }
480
-
481
- // src/hooks/useDebounce/useDebounce.ts
482
- var import_react15 = require("react");
483
- var import_react16 = require("react");
484
- function useDebounce(callback, wait, options = {}) {
485
- const preservedCallback = usePreservedCallback(callback);
486
- const { leading = false, trailing = true } = options;
487
- const edges = (0, import_react16.useMemo)(() => {
488
- const _edges = [];
489
- if (leading) {
490
- _edges.push("leading");
491
- }
492
- if (trailing) {
493
- _edges.push("trailing");
494
- }
495
- return _edges;
496
- }, [leading, trailing]);
497
- const debounced = (0, import_react16.useMemo)(() => {
498
- return debounce(preservedCallback, wait, { edges });
499
- }, [preservedCallback, wait, edges]);
500
- (0, import_react15.useEffect)(
501
- function cancelDebouncedOnUnmount() {
502
- return () => {
503
- debounced.cancel();
504
- };
505
- },
506
- [debounced]
507
- );
508
- return debounced;
509
- }
510
-
511
- // src/hooks/useDoubleClick/useDoubleClick.ts
512
- var import_react17 = require("react");
513
- function useDoubleClick({
514
- delay = 250,
515
- click,
516
- doubleClick
517
- }) {
518
- const clickTimeout = (0, import_react17.useRef)(null);
519
- const clearClickTimeout = usePreservedCallback(() => {
520
- if (clickTimeout.current != null) {
521
- window.clearTimeout(clickTimeout.current);
522
- clickTimeout.current = null;
523
- }
524
- });
525
- (0, import_react17.useEffect)(() => () => clearClickTimeout(), [clearClickTimeout]);
526
- const handleEvent = (0, import_react17.useCallback)(
527
- (event) => {
528
- clearClickTimeout();
529
- if (click && event.detail === 1) {
530
- clickTimeout.current = window.setTimeout(() => {
531
- click(event);
532
- }, delay);
533
- }
534
- if (event.detail === 2) {
535
- doubleClick(event);
536
- }
537
- },
538
- [click, doubleClick, delay, clearClickTimeout]
539
- );
540
- return handleEvent;
541
- }
542
-
543
- // src/hooks/useGeolocation/useGeolocation.ts
544
- var import_react18 = require("react");
545
- var CustomGeoLocationError = class extends Error {
546
- code;
547
- constructor({ code, message }) {
548
- super(message);
549
- this.name = "CustomGeoLocationError";
550
- this.code = code;
551
- }
552
- };
553
- var GeolocationMountBehavior = {
554
- GET: "get",
555
- WATCH: "watch"
556
- };
557
- function useGeolocation(options) {
558
- const [state, setState] = (0, import_react18.useState)({
559
- loading: !!options?.mountBehavior,
560
- error: null,
561
- data: null
562
- });
563
- const [isTracking, setIsTracking] = (0, import_react18.useState)(false);
564
- const watchIdRef = (0, import_react18.useRef)(null);
565
- const checkGeolocationSupport = (0, import_react18.useCallback)(() => {
566
- if (typeof window === "undefined" || navigator.geolocation === void 0) {
567
- setState((prev) => ({
568
- ...prev,
569
- loading: false,
570
- error: new CustomGeoLocationError({
571
- code: 0,
572
- message: "Geolocation is not supported by this environment."
573
- })
574
- }));
575
- return false;
576
- }
577
- return true;
578
- }, []);
579
- const handleSuccess = (0, import_react18.useCallback)((position) => {
580
- const { coords } = position;
581
- setState((prev) => ({
582
- ...prev,
583
- loading: false,
584
- error: null,
585
- data: {
586
- latitude: coords.latitude,
587
- longitude: coords.longitude,
588
- accuracy: coords.accuracy,
589
- altitude: coords.altitude,
590
- altitudeAccuracy: coords.altitudeAccuracy,
591
- heading: coords.heading,
592
- speed: coords.speed,
593
- timestamp: position.timestamp
594
- }
595
- }));
596
- }, []);
597
- const handleError = (0, import_react18.useCallback)((error) => {
598
- const { code, message } = error;
599
- setState((prev) => ({
600
- ...prev,
601
- loading: false,
602
- error: new CustomGeoLocationError({ code, message })
603
- }));
604
- }, []);
605
- const getGeolocationOptions = (0, import_react18.useCallback)(
606
- () => ({
607
- enableHighAccuracy: options?.enableHighAccuracy,
608
- maximumAge: options?.maximumAge,
609
- timeout: options?.timeout
610
- }),
611
- [options?.enableHighAccuracy, options?.maximumAge, options?.timeout]
612
- );
613
- const getCurrentPosition = (0, import_react18.useCallback)(() => {
614
- if (!checkGeolocationSupport()) {
615
- return;
616
- }
617
- setState((prev) => ({ ...prev, loading: true }));
618
- navigator.geolocation.getCurrentPosition(handleSuccess, handleError, getGeolocationOptions());
619
- }, [handleSuccess, handleError, getGeolocationOptions, checkGeolocationSupport]);
620
- const startTracking = (0, import_react18.useCallback)(() => {
621
- if (!checkGeolocationSupport()) {
622
- return;
623
- }
624
- if (watchIdRef.current !== null) {
625
- navigator.geolocation.clearWatch(watchIdRef.current);
626
- }
627
- setState((prev) => ({ ...prev, loading: true }));
628
- watchIdRef.current = navigator.geolocation.watchPosition(
629
- (position) => {
630
- setIsTracking(true);
631
- handleSuccess(position);
632
- },
633
- handleError,
634
- getGeolocationOptions()
635
- );
636
- }, [handleSuccess, handleError, getGeolocationOptions, checkGeolocationSupport]);
637
- const stopTracking = (0, import_react18.useCallback)(() => {
638
- if (watchIdRef.current === null) {
639
- return;
640
- }
641
- navigator.geolocation.clearWatch(watchIdRef.current);
642
- watchIdRef.current = null;
643
- setIsTracking(false);
644
- }, []);
645
- (0, import_react18.useEffect)(() => {
646
- if (options?.mountBehavior === GeolocationMountBehavior.WATCH) {
647
- startTracking();
648
- } else if (options?.mountBehavior === GeolocationMountBehavior.GET) {
649
- getCurrentPosition();
650
- }
651
- return () => {
652
- if (watchIdRef.current !== null) {
653
- navigator.geolocation.clearWatch(watchIdRef.current);
654
- watchIdRef.current = null;
655
- }
656
- };
657
- }, [options?.mountBehavior, getCurrentPosition, startTracking]);
658
- return {
659
- ...state,
660
- getCurrentPosition,
661
- startTracking,
662
- stopTracking,
663
- isTracking
664
- };
665
- }
666
-
667
- // src/hooks/useInputState/useInputState.ts
668
- var import_react19 = require("react");
669
- function useInputState(initialValue = "", transformValue = echo) {
670
- const [value, setValue] = (0, import_react19.useState)(initialValue);
671
- const handleValueChange = (0, import_react19.useCallback)(
672
- ({ target: { value: value2 } }) => {
673
- setValue(transformValue(value2));
674
- },
675
- [transformValue]
676
- );
677
- return [value, handleValueChange];
678
- }
679
- function echo(v) {
680
- return v;
681
- }
682
-
683
- // src/hooks/useInterval/useInterval.ts
684
- var import_react20 = require("react");
685
- function useInterval(callback, options) {
686
- const delay = typeof options === "number" ? options : options.delay;
687
- const immediate = typeof options === "number" ? false : options.immediate;
688
- const enabled = typeof options === "number" ? true : options.enabled ?? true;
689
- const preservedCallback = usePreservedCallback(callback);
690
- (0, import_react20.useEffect)(
691
- function runImmediateCallback() {
692
- if (immediate === true && enabled) {
693
- preservedCallback();
694
- }
695
- },
696
- [immediate, preservedCallback, enabled]
697
- );
698
- (0, import_react20.useEffect)(
699
- function startInterval() {
700
- if (!enabled) {
701
- return;
702
- }
703
- const id = setInterval(preservedCallback, delay);
704
- return () => clearInterval(id);
705
- },
706
- [delay, preservedCallback, enabled]
707
- );
708
- }
709
-
710
- // src/hooks/useIsClient/useIsClient.ts
711
- var import_react21 = require("react");
712
- function useIsClient() {
713
- const [isClient, setIsClient] = (0, import_react21.useState)(false);
714
- (0, import_react21.useEffect)(function syncClientState() {
715
- setIsClient(true);
716
- }, []);
717
- return isClient;
718
- }
719
-
720
- // src/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.ts
721
- var import_react22 = require("react");
722
- var isServer = typeof window === "undefined";
723
- var useIsomorphicLayoutEffect = isServer ? import_react22.useEffect : import_react22.useLayoutEffect;
724
-
725
- // src/hooks/useList/useList.ts
726
- var import_react24 = require("react");
727
-
728
- // src/hooks/usePreservedReference/usePreservedReference.ts
729
- var import_react23 = require("react");
730
- function usePreservedReference(value, areValuesEqual = areDeeplyEqual) {
731
- const ref = (0, import_react23.useRef)(value);
732
- return (0, import_react23.useMemo)(() => {
733
- if (!areValuesEqual(ref.current, value)) {
734
- ref.current = value;
735
- }
736
- return ref.current;
737
- }, [areValuesEqual, value]);
738
- }
739
- function areDeeplyEqual(x, y) {
740
- return JSON.stringify(x) === JSON.stringify(y);
741
- }
742
-
743
- // src/hooks/useList/useList.ts
744
- function useList(initialState = []) {
745
- const [list, setList] = (0, import_react24.useState)(initialState);
746
- const preservedInitialState = usePreservedReference(initialState);
747
- const push = usePreservedCallback((value) => {
748
- setList((prev) => [...prev, value]);
749
- });
750
- const insertAt = usePreservedCallback((index, value) => {
751
- setList((prev) => {
752
- const next = [...prev];
753
- next.splice(index, 0, value);
754
- return next;
755
- });
756
- });
757
- const updateAt = usePreservedCallback((index, value) => {
758
- setList((prev) => {
759
- const next = [...prev];
760
- next[index] = value;
761
- return next;
762
- });
763
- });
764
- const removeAt = usePreservedCallback((index) => {
765
- setList((prev) => {
766
- const next = [...prev];
767
- next.splice(index, 1);
768
- return next;
769
- });
770
- });
771
- const setAll = usePreservedCallback((values) => {
772
- setList(values);
773
- });
774
- const reset = usePreservedCallback(() => {
775
- setList(preservedInitialState);
776
- });
777
- const actions = (0, import_react24.useMemo)(
778
- () => ({ push, insertAt, updateAt, removeAt, setAll, reset }),
779
- [push, insertAt, updateAt, removeAt, setAll, reset]
780
- );
781
- return [list, actions];
782
- }
783
-
784
- // src/hooks/useLoading/useLoading.ts
785
- var import_react25 = require("react");
786
- function useLoading() {
787
- const [loading, setLoading] = (0, import_react25.useState)(false);
788
- const ref = useIsMountedRef();
789
- const startTransition = (0, import_react25.useCallback)(
790
- async (promise) => {
791
- try {
792
- setLoading(true);
793
- const data = await promise;
794
- return data;
795
- } finally {
796
- if (ref.isMounted) {
797
- setLoading(false);
798
- }
799
- }
800
- },
801
- [ref.isMounted]
802
- );
803
- return (0, import_react25.useMemo)(() => [loading, startTransition], [loading, startTransition]);
804
- }
805
- function useIsMountedRef() {
806
- const ref = (0, import_react25.useRef)({ isMounted: true }).current;
807
- (0, import_react25.useEffect)(
808
- function trackMountedState() {
809
- ref.isMounted = true;
810
- return () => {
811
- ref.isMounted = false;
812
- };
813
- },
814
- [ref]
815
- );
816
- return ref;
817
- }
818
-
819
- // src/hooks/useLongPress/useLongPress.ts
820
- var import_react26 = require("react");
821
- function useLongPress(onLongPress, { delay = 500, moveThreshold, onClick, onLongPressEnd } = {}) {
822
- const timeoutRef = (0, import_react26.useRef)(null);
823
- const isLongPressActiveRef = (0, import_react26.useRef)(false);
824
- const initialPositionRef = (0, import_react26.useRef)({ x: 0, y: 0 });
825
- const preservedOnLongPress = usePreservedCallback(onLongPress);
826
- const preservedOnClick = usePreservedCallback(onClick || (() => {
827
- }));
828
- const preservedOnLongPressEnd = usePreservedCallback(onLongPressEnd || (() => {
829
- }));
830
- const hasThreshold = moveThreshold?.x !== void 0 || moveThreshold?.y !== void 0;
831
- const getClientPosition = (0, import_react26.useCallback)((event) => {
832
- if ("touches" in event.nativeEvent) {
833
- const touch = event.nativeEvent.touches[0];
834
- return { x: touch.clientX, y: touch.clientY };
835
- }
836
- return {
837
- x: event.nativeEvent.clientX,
838
- y: event.nativeEvent.clientY
839
- };
840
- }, []);
841
- const isMovedBeyondThreshold = (0, import_react26.useCallback)(
842
- (event) => {
843
- const { x, y } = getClientPosition(event);
844
- const deltaX = Math.abs(x - initialPositionRef.current.x);
845
- const deltaY = Math.abs(y - initialPositionRef.current.y);
846
- return moveThreshold?.x !== void 0 && deltaX > moveThreshold.x || moveThreshold?.y !== void 0 && deltaY > moveThreshold.y;
847
- },
848
- [getClientPosition, moveThreshold]
849
- );
850
- const cancelLongPress = (0, import_react26.useCallback)(() => {
851
- if (timeoutRef.current !== null) {
852
- window.clearTimeout(timeoutRef.current);
853
- timeoutRef.current = null;
854
- }
855
- }, []);
856
- const handlePressStart = (0, import_react26.useCallback)(
857
- (event) => {
858
- cancelLongPress();
859
- const position = getClientPosition(event);
860
- initialPositionRef.current = position;
861
- isLongPressActiveRef.current = false;
862
- timeoutRef.current = window.setTimeout(() => {
863
- isLongPressActiveRef.current = true;
864
- preservedOnLongPress(event);
865
- }, delay);
866
- },
867
- [cancelLongPress, delay, getClientPosition, preservedOnLongPress]
868
- );
869
- const handlePressEnd = (0, import_react26.useCallback)(
870
- (event) => {
871
- if (isLongPressActiveRef.current) {
872
- preservedOnLongPressEnd(event);
873
- } else if (timeoutRef.current !== null) {
874
- preservedOnClick(event);
875
- }
876
- cancelLongPress();
877
- isLongPressActiveRef.current = false;
878
- },
879
- [cancelLongPress, preservedOnClick, preservedOnLongPressEnd]
880
- );
881
- const handlePressMove = (0, import_react26.useCallback)(
882
- (event) => {
883
- if (timeoutRef.current !== null && isMovedBeyondThreshold(event)) {
884
- cancelLongPress();
885
- }
886
- },
887
- [cancelLongPress, isMovedBeyondThreshold]
888
- );
889
- return {
890
- onMouseDown: handlePressStart,
891
- onMouseUp: handlePressEnd,
892
- onMouseLeave: cancelLongPress,
893
- onTouchStart: handlePressStart,
894
- onTouchEnd: handlePressEnd,
895
- ...hasThreshold ? { onTouchMove: handlePressMove, onMouseMove: handlePressMove } : {}
896
- };
897
- }
898
-
899
- // src/hooks/useMap/useMap.ts
900
- var import_react27 = require("react");
901
- function useMap(initialState = /* @__PURE__ */ new Map()) {
902
- const [map, setMap] = (0, import_react27.useState)(() => new Map(initialState));
903
- const preservedInitialState = usePreservedReference(initialState);
904
- const set = (0, import_react27.useCallback)((key, value) => {
905
- setMap((prev) => {
906
- const nextMap = new Map(prev);
907
- nextMap.set(key, value);
908
- return nextMap;
909
- });
910
- }, []);
911
- const setAll = (0, import_react27.useCallback)((entries) => {
912
- setMap(() => new Map(entries));
913
- }, []);
914
- const remove = (0, import_react27.useCallback)((key) => {
915
- setMap((prev) => {
916
- const nextMap = new Map(prev);
917
- nextMap.delete(key);
918
- return nextMap;
919
- });
920
- }, []);
921
- const reset = (0, import_react27.useCallback)(() => {
922
- setMap(() => new Map(preservedInitialState));
923
- }, [preservedInitialState]);
924
- const actions = (0, import_react27.useMemo)(() => {
925
- return { set, setAll, remove, reset };
926
- }, [set, setAll, remove, reset]);
927
- return [map, actions];
928
- }
929
-
930
- // src/hooks/useOutsideClickEffect/useOutsideClickEffect.ts
931
- var import_react28 = require("react");
932
- function useOutsideClickEffect(container, callback) {
933
- const containers = (0, import_react28.useRef)([]);
934
- const handleDocumentClick = usePreservedCallback(({ target }) => {
935
- if (target === null) {
936
- return;
937
- }
938
- if (containers.current.length === 0) {
939
- return;
940
- }
941
- if (containers.current.some((x) => x.contains(target))) {
942
- return;
943
- }
944
- callback();
945
- });
946
- (0, import_react28.useEffect)(() => {
947
- containers.current = [container].flat(1).filter((item) => item != null);
948
- }, [container]);
949
- (0, import_react28.useEffect)(() => {
950
- document.addEventListener("click", handleDocumentClick);
951
- return () => {
952
- document.removeEventListener("click", handleDocumentClick);
953
- };
954
- }, [handleDocumentClick]);
955
- }
956
-
957
- // src/hooks/usePrevious/usePrevious.ts
958
- var import_react29 = require("react");
959
- var strictEquals = (prev, next) => prev === next;
960
- function usePrevious(state, compare = strictEquals) {
961
- const prevRef = (0, import_react29.useRef)(state);
962
- const currentRef = (0, import_react29.useRef)(state);
963
- const isFirstRender = (0, import_react29.useRef)(true);
964
- if (isFirstRender.current) {
965
- isFirstRender.current = false;
966
- return prevRef.current;
967
- }
968
- if (!compare(currentRef.current, state)) {
969
- prevRef.current = currentRef.current;
970
- currentRef.current = state;
971
- }
972
- return prevRef.current;
973
- }
974
-
975
- // src/hooks/useSet/useSet.ts
976
- var import_react30 = require("react");
977
- function useSet(initialState = /* @__PURE__ */ new Set()) {
978
- const [set, setSet] = (0, import_react30.useState)(() => new Set(initialState));
979
- const preservedInitialState = usePreservedReference(initialState);
980
- const add = usePreservedCallback((value) => {
981
- setSet((prev) => {
982
- const nextSet = new Set(prev);
983
- nextSet.add(value);
984
- return nextSet;
985
- });
986
- });
987
- const remove = usePreservedCallback((value) => {
988
- setSet((prev) => {
989
- const nextSet = new Set(prev);
990
- nextSet.delete(value);
991
- return nextSet;
992
- });
993
- });
994
- const toggle2 = usePreservedCallback((value) => {
995
- setSet((prev) => {
996
- const nextSet = new Set(prev);
997
- if (nextSet.has(value)) {
998
- nextSet.delete(value);
999
- } else {
1000
- nextSet.add(value);
1001
- }
1002
- return nextSet;
1003
- });
1004
- });
1005
- const setAll = usePreservedCallback((values) => {
1006
- setSet(() => new Set(values));
1007
- });
1008
- const reset = usePreservedCallback(() => {
1009
- setSet(() => new Set(preservedInitialState));
1010
- });
1011
- const actions = (0, import_react30.useMemo)(
1012
- () => ({ add, remove, toggle: toggle2, setAll, reset }),
1013
- [add, remove, toggle2, setAll, reset]
1014
- );
1015
- return [set, actions];
1016
- }
1017
-
1018
- // src/hooks/useStorageState/useStorageState.ts
1019
- var import_react31 = require("react");
1020
-
1021
- // src/hooks/useStorageState/storage.ts
1022
- var MemoStorage = class {
1023
- storage = /* @__PURE__ */ new Map();
1024
- get(key) {
1025
- return this.storage.get(key) ?? null;
1026
- }
1027
- set(key, value) {
1028
- this.storage.set(key, value);
1029
- }
1030
- remove(key) {
1031
- this.storage.delete(key);
1032
- }
1033
- clear() {
1034
- this.storage.clear();
1035
- }
1036
- };
1037
- var LocalStorage = class {
1038
- static canUse() {
1039
- const TEST_KEY = generateTestKey();
1040
- try {
1041
- localStorage.setItem(TEST_KEY, "test");
1042
- localStorage.removeItem(TEST_KEY);
1043
- return true;
1044
- } catch {
1045
- return false;
1046
- }
1047
- }
1048
- get(key) {
1049
- return localStorage.getItem(key);
1050
- }
1051
- set(key, value) {
1052
- localStorage.setItem(key, value);
1053
- }
1054
- remove(key) {
1055
- localStorage.removeItem(key);
1056
- }
1057
- clear() {
1058
- localStorage.clear();
1059
- }
1060
- };
1061
- var SessionStorage = class {
1062
- static canUse() {
1063
- const TEST_KEY = generateTestKey();
1064
- try {
1065
- sessionStorage.setItem(TEST_KEY, "test");
1066
- sessionStorage.removeItem(TEST_KEY);
1067
- return true;
1068
- } catch {
1069
- return false;
1070
- }
1071
- }
1072
- get(key) {
1073
- return sessionStorage.getItem(key);
1074
- }
1075
- set(key, value) {
1076
- sessionStorage.setItem(key, value);
1077
- }
1078
- remove(key) {
1079
- sessionStorage.removeItem(key);
1080
- }
1081
- clear() {
1082
- sessionStorage.clear();
1083
- }
1084
- };
1085
- function generateTestKey() {
1086
- return new Array(4).fill(null).map(() => Math.random().toString(36).slice(2)).join("");
1087
- }
1088
- function generateStorage() {
1089
- if (LocalStorage.canUse()) {
1090
- return new LocalStorage();
1091
- }
1092
- return new MemoStorage();
1093
- }
1094
- function generateSessionStorage() {
1095
- if (SessionStorage.canUse()) {
1096
- return new SessionStorage();
1097
- }
1098
- return new MemoStorage();
1099
- }
1100
- var safeLocalStorage = generateStorage();
1101
- var safeSessionStorage = generateSessionStorage();
1102
-
1103
- // src/hooks/useStorageState/useStorageState.ts
1104
- var listeners = /* @__PURE__ */ new Set();
1105
- var emitListeners = () => {
1106
- listeners.forEach((listener) => listener());
1107
- };
1108
- function isPlainObject(value) {
1109
- if (typeof value !== "object") {
1110
- return false;
1111
- }
1112
- const proto = Object.getPrototypeOf(value);
1113
- const hasObjectPrototype = proto === Object.prototype;
1114
- if (!hasObjectPrototype) {
1115
- return false;
1116
- }
1117
- return Object.prototype.toString.call(value) === "[object Object]";
1118
- }
1119
- var ensureSerializable = (value) => {
1120
- if (value[0] != null && !["string", "number", "boolean"].includes(typeof value[0]) && !(isPlainObject(value[0]) || Array.isArray(value[0]))) {
1121
- throw new Error("Received a non-serializable value");
1122
- }
1123
- return value;
1124
- };
1125
- function useStorageState(key, {
1126
- storage = safeLocalStorage,
1127
- defaultValue,
1128
- ...options
1129
- } = {}) {
1130
- const serializedDefaultValue = defaultValue;
1131
- const cache = (0, import_react31.useRef)({
1132
- data: null,
1133
- parsed: serializedDefaultValue
1134
- });
1135
- const getSnapshot = (0, import_react31.useCallback)(() => {
1136
- const deserializer = "deserializer" in options ? options.deserializer : JSON.parse;
1137
- const data = storage.get(key);
1138
- if (data !== cache.current.data) {
1139
- try {
1140
- cache.current.parsed = data != null ? deserializer(data) : defaultValue;
1141
- } catch {
1142
- cache.current.parsed = serializedDefaultValue;
1143
- }
1144
- cache.current.data = data;
1145
- }
1146
- return cache.current.parsed;
1147
- }, [defaultValue, key, storage]);
1148
- const storageState = (0, import_react31.useSyncExternalStore)(
1149
- (onStoreChange) => {
1150
- listeners.add(onStoreChange);
1151
- const handler = (event) => {
1152
- if (event.key === key) {
1153
- onStoreChange();
1154
- }
1155
- };
1156
- window.addEventListener("storage", handler);
1157
- return () => {
1158
- listeners.delete(onStoreChange);
1159
- window.removeEventListener("storage", handler);
1160
- };
1161
- },
1162
- () => getSnapshot(),
1163
- () => serializedDefaultValue
1164
- );
1165
- const setStorageState = (0, import_react31.useCallback)(
1166
- (value) => {
1167
- const serializer = "serializer" in options ? options.serializer : JSON.stringify;
1168
- const nextValue = typeof value === "function" ? value(getSnapshot()) : value;
1169
- if (nextValue == null) {
1170
- storage.remove(key);
1171
- } else {
1172
- storage.set(key, serializer(nextValue));
1173
- }
1174
- emitListeners();
1175
- },
1176
- [getSnapshot, key, storage]
1177
- );
1178
- const refreshStorageState = (0, import_react31.useCallback)(() => {
1179
- setStorageState(getSnapshot());
1180
- }, [storage, getSnapshot, setStorageState]);
1181
- return ensureSerializable([storageState, setStorageState, refreshStorageState]);
1182
- }
1183
-
1184
- // src/hooks/useThrottle/useThrottle.ts
1185
- var import_react32 = require("react");
1186
-
1187
- // src/hooks/useThrottle/throttle.ts
1188
- function throttle(func, throttleMs, { edges = ["leading", "trailing"] } = {}) {
1189
- let pendingAt = null;
1190
- const debounced = debounce(func, throttleMs, { edges });
1191
- const throttled = function(...args) {
1192
- if (pendingAt == null) {
1193
- pendingAt = Date.now();
1194
- } else {
1195
- if (Date.now() - pendingAt >= throttleMs) {
1196
- pendingAt = Date.now();
1197
- debounced.cancel();
1198
- }
1199
- }
1200
- debounced(...args);
1201
- };
1202
- throttled.cancel = debounced.cancel;
1203
- return throttled;
1204
- }
1205
-
1206
- // src/hooks/useThrottle/useThrottle.ts
1207
- function useThrottle(callback, wait, options) {
1208
- const preservedCallback = usePreservedCallback(callback);
1209
- const preservedOptions = usePreservedReference(options ?? {});
1210
- const throttledCallback = (0, import_react32.useMemo)(
1211
- () => throttle(preservedCallback, wait, preservedOptions),
1212
- [preservedOptions, preservedCallback, wait]
1213
- );
1214
- (0, import_react32.useEffect)(() => {
1215
- return () => {
1216
- throttledCallback.cancel();
1217
- };
1218
- }, [throttledCallback]);
1219
- return throttledCallback;
1220
- }
1221
-
1222
- // src/hooks/useThrottledCallback/useThrottledCallback.ts
1223
- var import_react33 = require("react");
1224
- function useThrottledCallback({
1225
- onChange,
1226
- timeThreshold,
1227
- edges = ["leading", "trailing"]
1228
- }) {
1229
- const handleChange = usePreservedCallback(onChange);
1230
- const ref = (0, import_react33.useRef)({ value: false, clearPreviousThrottle: () => {
1231
- } });
1232
- (0, import_react33.useEffect)(function cleanupThrottleOnUnmount() {
1233
- const current = ref.current;
1234
- return () => {
1235
- current.clearPreviousThrottle();
1236
- };
1237
- }, []);
1238
- const preservedEdges = usePreservedReference(edges);
1239
- return (0, import_react33.useCallback)(
1240
- (nextValue) => {
1241
- if (nextValue === ref.current.value) {
1242
- return;
1243
- }
1244
- const throttled = throttle(
1245
- () => {
1246
- handleChange(nextValue);
1247
- ref.current.value = nextValue;
1248
- },
1249
- timeThreshold,
1250
- { edges: preservedEdges }
1251
- );
1252
- ref.current.clearPreviousThrottle();
1253
- throttled();
1254
- ref.current.clearPreviousThrottle = throttled.cancel;
1255
- },
1256
- [handleChange, timeThreshold, preservedEdges]
1257
- );
1258
- }
1259
-
1260
- // src/hooks/useTimeout/useTimeout.ts
1261
- var import_react34 = require("react");
1262
- function useTimeout(callback, delay = 0) {
1263
- const preservedCallback = usePreservedCallback(callback);
1264
- (0, import_react34.useEffect)(() => {
1265
- const timeoutId = setTimeout(preservedCallback, delay);
1266
- return () => clearTimeout(timeoutId);
1267
- }, [delay, preservedCallback]);
1268
- }
1269
-
1270
- // src/hooks/useToggle/useToggle.ts
1271
- var import_react35 = require("react");
1272
- function useToggle(initialValue = false) {
1273
- return (0, import_react35.useReducer)(toggle, initialValue);
1274
- }
1275
- var toggle = (state) => !state;
1276
-
1277
- // src/utils/buildContext/buildContext.tsx
1278
- var import_react36 = require("react");
1279
- var import_jsx_runtime3 = require("react/jsx-runtime");
1280
- function buildContext(contextName, defaultContextValues) {
1281
- const Context = (0, import_react36.createContext)(defaultContextValues ?? void 0);
1282
- function Provider({ children, ...contextValues }) {
1283
- const value = (0, import_react36.useMemo)(
1284
- () => Object.keys(contextValues).length > 0 ? contextValues : null,
1285
- // eslint-disable-next-line react-hooks/exhaustive-deps
1286
- [...Object.values(contextValues)]
1287
- );
1288
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Context.Provider, { value, children });
1289
- }
1290
- function useInnerContext() {
1291
- const context = (0, import_react36.useContext)(Context);
1292
- if (context != null) {
1293
- return context;
1294
- }
1295
- if (defaultContextValues != null) {
1296
- return defaultContextValues;
1297
- }
1298
- throw new Error(`\`${contextName}Context\` must be used within \`${contextName}Provider\``);
1299
- }
1300
- return [Provider, useInnerContext];
1301
- }
1302
-
1303
- // src/utils/mergeProps/mergeProps.ts
1304
- function mergeProps(...props) {
1305
- return props.reduce(pushProp, {});
1306
- }
1307
- function pushProp(prev, curr) {
1308
- for (const key in curr) {
1309
- if (curr[key] === void 0) continue;
1310
- switch (key) {
1311
- case "className": {
1312
- prev[key] = [prev[key], curr[key]].join(" ").trim();
1313
- break;
1314
- }
1315
- case "style": {
1316
- prev[key] = mergeStyle(prev[key], curr[key]);
1317
- break;
1318
- }
1319
- default: {
1320
- const mergedFunction = mergeFunction(prev[key], curr[key]);
1321
- if (mergedFunction) {
1322
- prev[key] = mergedFunction;
1323
- } else if (curr[key] !== void 0) {
1324
- prev[key] = curr[key];
1325
- }
1326
- }
1327
- }
1328
- }
1329
- return prev;
1330
- }
1331
- function mergeStyle(a, b) {
1332
- if (a == null) return b;
1333
- return { ...a, ...b };
1334
- }
1335
- function mergeFunction(a, b) {
1336
- if (typeof a === "function" && typeof b === "function") {
1337
- return (...args) => {
1338
- a(...args);
1339
- b(...args);
1340
- };
1341
- }
1342
- }
1343
- // Annotate the CommonJS export names for ESM import in node:
1344
- 0 && (module.exports = {
1345
- ImpressionArea,
1346
- Separated,
1347
- SwitchCase,
1348
- buildContext,
1349
- mergeProps,
1350
- mergeRefs,
1351
- useAsyncEffect,
1352
- useBooleanState,
1353
- useCallbackOncePerRender,
1354
- useConditionalEffect,
1355
- useControlledState,
1356
- useCounter,
1357
- useDebounce,
1358
- useDebouncedCallback,
1359
- useDoubleClick,
1360
- useGeolocation,
1361
- useImpressionRef,
1362
- useInputState,
1363
- useIntersectionObserver,
1364
- useInterval,
1365
- useIsClient,
1366
- useIsomorphicLayoutEffect,
1367
- useList,
1368
- useLoading,
1369
- useLongPress,
1370
- useMap,
1371
- useOutsideClickEffect,
1372
- usePreservedCallback,
1373
- usePreservedReference,
1374
- usePrevious,
1375
- useRefEffect,
1376
- useSet,
1377
- useStorageState,
1378
- useThrottle,
1379
- useThrottledCallback,
1380
- useTimeout,
1381
- useToggle,
1382
- useVisibilityEvent
1383
- });
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const require_usePreservedCallback = require("./hooks/usePreservedCallback/usePreservedCallback.cjs");
4
+ const require_useDebouncedCallback = require("./hooks/useDebouncedCallback/useDebouncedCallback.cjs");
5
+ const require_useRefEffect = require("./hooks/useRefEffect/useRefEffect.cjs");
6
+ const require_useIntersectionObserver = require("./hooks/useIntersectionObserver/useIntersectionObserver.cjs");
7
+ const require_useVisibilityEvent = require("./hooks/useVisibilityEvent/useVisibilityEvent.cjs");
8
+ const require_useImpressionRef = require("./hooks/useImpressionRef/useImpressionRef.cjs");
9
+ const require_mergeRefs = require("./utils/mergeRefs/mergeRefs.cjs");
10
+ const require_ImpressionArea = require("./components/ImpressionArea/ImpressionArea.cjs");
11
+ const require_Separated = require("./components/Separated/Separated.cjs");
12
+ const require_SwitchCase = require("./components/SwitchCase/SwitchCase.cjs");
13
+ const require_useAsyncEffect = require("./hooks/useAsyncEffect/useAsyncEffect.cjs");
14
+ const require_useBooleanState = require("./hooks/useBooleanState/useBooleanState.cjs");
15
+ const require_useCallbackOncePerRender = require("./hooks/useCallbackOncePerRender/useCallbackOncePerRender.cjs");
16
+ const require_useConditionalEffect = require("./hooks/useConditionalEffect/useConditionalEffect.cjs");
17
+ const require_useControlledState = require("./hooks/useControlledState/useControlledState.cjs");
18
+ const require_useCounter = require("./hooks/useCounter/useCounter.cjs");
19
+ const require_useDebounce = require("./hooks/useDebounce/useDebounce.cjs");
20
+ const require_useDoubleClick = require("./hooks/useDoubleClick/useDoubleClick.cjs");
21
+ const require_useGeolocation = require("./hooks/useGeolocation/useGeolocation.cjs");
22
+ const require_useInputState = require("./hooks/useInputState/useInputState.cjs");
23
+ const require_useInterval = require("./hooks/useInterval/useInterval.cjs");
24
+ const require_useIsClient = require("./hooks/useIsClient/useIsClient.cjs");
25
+ const require_useIsomorphicLayoutEffect = require("./hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.cjs");
26
+ const require_usePreservedReference = require("./hooks/usePreservedReference/usePreservedReference.cjs");
27
+ const require_useList = require("./hooks/useList/useList.cjs");
28
+ const require_useLoading = require("./hooks/useLoading/useLoading.cjs");
29
+ const require_useLongPress = require("./hooks/useLongPress/useLongPress.cjs");
30
+ const require_useMap = require("./hooks/useMap/useMap.cjs");
31
+ const require_useOutsideClickEffect = require("./hooks/useOutsideClickEffect/useOutsideClickEffect.cjs");
32
+ const require_usePrevious = require("./hooks/usePrevious/usePrevious.cjs");
33
+ const require_useSet = require("./hooks/useSet/useSet.cjs");
34
+ const require_useStorageState = require("./hooks/useStorageState/useStorageState.cjs");
35
+ const require_useThrottle = require("./hooks/useThrottle/useThrottle.cjs");
36
+ const require_useThrottledCallback = require("./hooks/useThrottledCallback/useThrottledCallback.cjs");
37
+ const require_useTimeout = require("./hooks/useTimeout/useTimeout.cjs");
38
+ const require_useToggle = require("./hooks/useToggle/useToggle.cjs");
39
+ const require_buildContext = require("./utils/buildContext/buildContext.cjs");
40
+ const require_mergeProps = require("./utils/mergeProps/mergeProps.cjs");
41
+ exports.ImpressionArea = require_ImpressionArea.ImpressionArea;
42
+ exports.Separated = require_Separated.Separated;
43
+ exports.SwitchCase = require_SwitchCase.SwitchCase;
44
+ exports.buildContext = require_buildContext.buildContext;
45
+ exports.mergeProps = require_mergeProps.mergeProps;
46
+ exports.mergeRefs = require_mergeRefs.mergeRefs;
47
+ exports.useAsyncEffect = require_useAsyncEffect.useAsyncEffect;
48
+ exports.useBooleanState = require_useBooleanState.useBooleanState;
49
+ exports.useCallbackOncePerRender = require_useCallbackOncePerRender.useCallbackOncePerRender;
50
+ exports.useConditionalEffect = require_useConditionalEffect.useConditionalEffect;
51
+ exports.useControlledState = require_useControlledState.useControlledState;
52
+ exports.useCounter = require_useCounter.useCounter;
53
+ exports.useDebounce = require_useDebounce.useDebounce;
54
+ exports.useDebouncedCallback = require_useDebouncedCallback.useDebouncedCallback;
55
+ exports.useDoubleClick = require_useDoubleClick.useDoubleClick;
56
+ exports.useGeolocation = require_useGeolocation.useGeolocation;
57
+ exports.useImpressionRef = require_useImpressionRef.useImpressionRef;
58
+ exports.useInputState = require_useInputState.useInputState;
59
+ exports.useIntersectionObserver = require_useIntersectionObserver.useIntersectionObserver;
60
+ exports.useInterval = require_useInterval.useInterval;
61
+ exports.useIsClient = require_useIsClient.useIsClient;
62
+ exports.useIsomorphicLayoutEffect = require_useIsomorphicLayoutEffect.useIsomorphicLayoutEffect;
63
+ exports.useList = require_useList.useList;
64
+ exports.useLoading = require_useLoading.useLoading;
65
+ exports.useLongPress = require_useLongPress.useLongPress;
66
+ exports.useMap = require_useMap.useMap;
67
+ exports.useOutsideClickEffect = require_useOutsideClickEffect.useOutsideClickEffect;
68
+ exports.usePreservedCallback = require_usePreservedCallback.usePreservedCallback;
69
+ exports.usePreservedReference = require_usePreservedReference.usePreservedReference;
70
+ exports.usePrevious = require_usePrevious.usePrevious;
71
+ exports.useRefEffect = require_useRefEffect.useRefEffect;
72
+ exports.useSet = require_useSet.useSet;
73
+ exports.useStorageState = require_useStorageState.useStorageState;
74
+ exports.useThrottle = require_useThrottle.useThrottle;
75
+ exports.useThrottledCallback = require_useThrottledCallback.useThrottledCallback;
76
+ exports.useTimeout = require_useTimeout.useTimeout;
77
+ exports.useToggle = require_useToggle.useToggle;
78
+ exports.useVisibilityEvent = require_useVisibilityEvent.useVisibilityEvent;