@oneplatformdev/hooks 0.1.0-9 → 0.1.0-91

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 (334) hide show
  1. package/CHANGELOG.md +320 -0
  2. package/package.json +14 -19
  3. package/{dist/useEventListener → useEventListener}/useEventListener.d.ts +4 -2
  4. package/{dist/useEventListener → useEventListener}/useEventListener.d.ts.map +1 -1
  5. package/{dist/useHover → useHover}/useHover.d.ts +1 -1
  6. package/{dist/useHover → useHover}/useHover.d.ts.map +1 -1
  7. package/{dist/useOnClickOutside → useOnClickOutside}/useOnClickOutside.d.ts +1 -1
  8. package/{dist/useOnClickOutside → useOnClickOutside}/useOnClickOutside.d.ts.map +1 -1
  9. package/{dist/useResizeObserver → useResizeObserver}/useResizeObserver.d.ts +1 -1
  10. package/{dist/useResizeObserver → useResizeObserver}/useResizeObserver.d.ts.map +1 -1
  11. package/.babelrc +0 -12
  12. package/dist/CHANGELOG.md +0 -19
  13. package/dist/LICENSE +0 -21
  14. package/dist/README.md +0 -7
  15. package/dist/package.json +0 -68
  16. package/node_modules/@types/lodash.debounce/LICENSE +0 -21
  17. package/node_modules/@types/lodash.debounce/README.md +0 -23
  18. package/node_modules/@types/lodash.debounce/index.d.ts +0 -4
  19. package/node_modules/@types/lodash.debounce/package.json +0 -32
  20. package/node_modules/@types/react/LICENSE +0 -21
  21. package/node_modules/@types/react/README.md +0 -15
  22. package/node_modules/@types/react/canary.d.ts +0 -35
  23. package/node_modules/@types/react/compiler-runtime.d.ts +0 -4
  24. package/node_modules/@types/react/experimental.d.ts +0 -125
  25. package/node_modules/@types/react/global.d.ts +0 -160
  26. package/node_modules/@types/react/index.d.ts +0 -4206
  27. package/node_modules/@types/react/jsx-dev-runtime.d.ts +0 -45
  28. package/node_modules/@types/react/jsx-runtime.d.ts +0 -36
  29. package/node_modules/@types/react/package.json +0 -210
  30. package/node_modules/@types/react/ts5.0/canary.d.ts +0 -35
  31. package/node_modules/@types/react/ts5.0/experimental.d.ts +0 -125
  32. package/node_modules/@types/react/ts5.0/global.d.ts +0 -160
  33. package/node_modules/@types/react/ts5.0/index.d.ts +0 -4193
  34. package/node_modules/@types/react/ts5.0/jsx-dev-runtime.d.ts +0 -44
  35. package/node_modules/@types/react/ts5.0/jsx-runtime.d.ts +0 -35
  36. package/node_modules/@types/react/ts5.0/v18/global.d.ts +0 -160
  37. package/node_modules/@types/react/ts5.0/v18/index.d.ts +0 -4543
  38. package/node_modules/@types/react/ts5.0/v18/jsx-dev-runtime.d.ts +0 -45
  39. package/node_modules/@types/react/ts5.0/v18/jsx-runtime.d.ts +0 -36
  40. package/node_modules/@types/react/ts5.0/v18/ts5.0/global.d.ts +0 -160
  41. package/node_modules/@types/react/ts5.0/v18/ts5.0/index.d.ts +0 -4530
  42. package/node_modules/@types/react/ts5.0/v18/ts5.0/jsx-dev-runtime.d.ts +0 -44
  43. package/node_modules/@types/react/ts5.0/v18/ts5.0/jsx-runtime.d.ts +0 -35
  44. package/src/index.ts +0 -36
  45. package/src/useBoolean/index.ts +0 -1
  46. package/src/useBoolean/useBoolean.ts +0 -50
  47. package/src/useClickAnyWhere/index.ts +0 -1
  48. package/src/useClickAnyWhere/useClickAnyWhere.ts +0 -22
  49. package/src/useCopyToClipboard/index.ts +0 -1
  50. package/src/useCopyToClipboard/useCopyToClipboard.ts +0 -58
  51. package/src/useCountdown/index.ts +0 -1
  52. package/src/useCountdown/useCountdown.ts +0 -102
  53. package/src/useCounter/index.ts +0 -1
  54. package/src/useCounter/useCounter.ts +0 -52
  55. package/src/useDarkMode/index.ts +0 -1
  56. package/src/useDarkMode/useDarkMode.ts +0 -92
  57. package/src/useDebounceCallback/index.ts +0 -2
  58. package/src/useDebounceCallback/useDebounceCallback.ts +0 -115
  59. package/src/useDebounceValue/index.ts +0 -1
  60. package/src/useDebounceValue/useDebounceValue.ts +0 -67
  61. package/src/useDocumentTitle/index.ts +0 -1
  62. package/src/useDocumentTitle/useDocumentTitle.ts +0 -43
  63. package/src/useEventCallback/index.ts +0 -1
  64. package/src/useEventCallback/useEventCallback.ts +0 -40
  65. package/src/useEventListener/index.ts +0 -1
  66. package/src/useEventListener/useEventListener.ts +0 -121
  67. package/src/useHover/index.ts +0 -1
  68. package/src/useHover/useHover.ts +0 -37
  69. package/src/useIntersectionObserver/index.ts +0 -1
  70. package/src/useIntersectionObserver/useIntersectionObserver.ts +0 -186
  71. package/src/useInterval/index.ts +0 -1
  72. package/src/useInterval/useInterval.ts +0 -43
  73. package/src/useIsClient/index.ts +0 -1
  74. package/src/useIsClient/useIsClient.ts +0 -22
  75. package/src/useIsMobile/index.ts +0 -2
  76. package/src/useIsMobile/types.ts +0 -3
  77. package/src/useIsMobile/useIsMobile.tsx +0 -23
  78. package/src/useIsMounted/index.ts +0 -1
  79. package/src/useIsMounted/useIsMounted.ts +0 -15
  80. package/src/useIsomorphicLayoutEffect/index.ts +0 -1
  81. package/src/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.ts +0 -17
  82. package/src/useLocalStorage/index.ts +0 -1
  83. package/src/useLocalStorage/useLocalStorage.ts +0 -191
  84. package/src/useLockBody/index.ts +0 -1
  85. package/src/useLockBody/useLockBody.tsx +0 -12
  86. package/src/useMap/index.ts +0 -1
  87. package/src/useMap/useMap.ts +0 -83
  88. package/src/useMediaQuery/index.ts +0 -1
  89. package/src/useMediaQuery/useMediaQuery.ts +0 -83
  90. package/src/useOnClickOutside/index.ts +0 -1
  91. package/src/useOnClickOutside/useOnClickOutside.ts +0 -61
  92. package/src/useQueryString/index.ts +0 -1
  93. package/src/useQueryString/useQueryString.ts +0 -26
  94. package/src/useReadLocalStorage/index.ts +0 -1
  95. package/src/useReadLocalStorage/useReadLocalStorage.ts +0 -122
  96. package/src/useResizeObserver/index.ts +0 -1
  97. package/src/useResizeObserver/useResizeObserver.ts +0 -131
  98. package/src/useScreen/index.ts +0 -1
  99. package/src/useScreen/useScreen.ts +0 -106
  100. package/src/useScript/index.ts +0 -1
  101. package/src/useScript/useScript.ts +0 -142
  102. package/src/useScrollLock/index.ts +0 -1
  103. package/src/useScrollLock/useScrollLock.ts +0 -141
  104. package/src/useSessionStorage/index.ts +0 -1
  105. package/src/useSessionStorage/useSessionStorage.ts +0 -191
  106. package/src/useStep/index.ts +0 -1
  107. package/src/useStep/useStep.ts +0 -83
  108. package/src/useTernaryDarkMode/index.ts +0 -1
  109. package/src/useTernaryDarkMode/useTernaryDarkMode.ts +0 -81
  110. package/src/useTimeout/index.ts +0 -1
  111. package/src/useTimeout/useTimeout.ts +0 -44
  112. package/src/useToggle/index.ts +0 -1
  113. package/src/useToggle/useToggle.ts +0 -30
  114. package/src/useUnmount/index.ts +0 -1
  115. package/src/useUnmount/useUnmount.ts +0 -26
  116. package/src/useWindowSize/index.ts +0 -1
  117. package/src/useWindowSize/useWindowSize.ts +0 -100
  118. package/tsconfig.json +0 -10
  119. package/tsconfig.lib.json +0 -33
  120. package/vite.config.ts +0 -62
  121. /package/{dist/index.d.ts → index.d.ts} +0 -0
  122. /package/{dist/index.d.ts.map → index.d.ts.map} +0 -0
  123. /package/{dist/index.js → index.js} +0 -0
  124. /package/{dist/useBoolean → useBoolean}/index.d.ts +0 -0
  125. /package/{dist/useBoolean → useBoolean}/index.d.ts.map +0 -0
  126. /package/{dist/useBoolean → useBoolean}/index.js +0 -0
  127. /package/{dist/useBoolean → useBoolean}/useBoolean.d.ts +0 -0
  128. /package/{dist/useBoolean → useBoolean}/useBoolean.d.ts.map +0 -0
  129. /package/{dist/useBoolean → useBoolean}/useBoolean.js +0 -0
  130. /package/{dist/useClickAnyWhere → useClickAnyWhere}/index.d.ts +0 -0
  131. /package/{dist/useClickAnyWhere → useClickAnyWhere}/index.d.ts.map +0 -0
  132. /package/{dist/useClickAnyWhere → useClickAnyWhere}/index.js +0 -0
  133. /package/{dist/useClickAnyWhere → useClickAnyWhere}/useClickAnyWhere.d.ts +0 -0
  134. /package/{dist/useClickAnyWhere → useClickAnyWhere}/useClickAnyWhere.d.ts.map +0 -0
  135. /package/{dist/useClickAnyWhere → useClickAnyWhere}/useClickAnyWhere.js +0 -0
  136. /package/{dist/useCopyToClipboard → useCopyToClipboard}/index.d.ts +0 -0
  137. /package/{dist/useCopyToClipboard → useCopyToClipboard}/index.d.ts.map +0 -0
  138. /package/{dist/useCopyToClipboard → useCopyToClipboard}/index.js +0 -0
  139. /package/{dist/useCopyToClipboard → useCopyToClipboard}/useCopyToClipboard.d.ts +0 -0
  140. /package/{dist/useCopyToClipboard → useCopyToClipboard}/useCopyToClipboard.d.ts.map +0 -0
  141. /package/{dist/useCopyToClipboard → useCopyToClipboard}/useCopyToClipboard.js +0 -0
  142. /package/{dist/useCountdown → useCountdown}/index.d.ts +0 -0
  143. /package/{dist/useCountdown → useCountdown}/index.d.ts.map +0 -0
  144. /package/{dist/useCountdown → useCountdown}/index.js +0 -0
  145. /package/{dist/useCountdown → useCountdown}/useCountdown.d.ts +0 -0
  146. /package/{dist/useCountdown → useCountdown}/useCountdown.d.ts.map +0 -0
  147. /package/{dist/useCountdown → useCountdown}/useCountdown.js +0 -0
  148. /package/{dist/useCounter → useCounter}/index.d.ts +0 -0
  149. /package/{dist/useCounter → useCounter}/index.d.ts.map +0 -0
  150. /package/{dist/useCounter → useCounter}/index.js +0 -0
  151. /package/{dist/useCounter → useCounter}/useCounter.d.ts +0 -0
  152. /package/{dist/useCounter → useCounter}/useCounter.d.ts.map +0 -0
  153. /package/{dist/useCounter → useCounter}/useCounter.js +0 -0
  154. /package/{dist/useDarkMode → useDarkMode}/index.d.ts +0 -0
  155. /package/{dist/useDarkMode → useDarkMode}/index.d.ts.map +0 -0
  156. /package/{dist/useDarkMode → useDarkMode}/index.js +0 -0
  157. /package/{dist/useDarkMode → useDarkMode}/useDarkMode.d.ts +0 -0
  158. /package/{dist/useDarkMode → useDarkMode}/useDarkMode.d.ts.map +0 -0
  159. /package/{dist/useDarkMode → useDarkMode}/useDarkMode.js +0 -0
  160. /package/{dist/useDebounceCallback → useDebounceCallback}/index.d.ts +0 -0
  161. /package/{dist/useDebounceCallback → useDebounceCallback}/index.d.ts.map +0 -0
  162. /package/{dist/useDebounceCallback → useDebounceCallback}/index.js +0 -0
  163. /package/{dist/useDebounceCallback → useDebounceCallback}/useDebounceCallback.d.ts +0 -0
  164. /package/{dist/useDebounceCallback → useDebounceCallback}/useDebounceCallback.d.ts.map +0 -0
  165. /package/{dist/useDebounceCallback → useDebounceCallback}/useDebounceCallback.js +0 -0
  166. /package/{dist/useDebounceValue → useDebounceValue}/index.d.ts +0 -0
  167. /package/{dist/useDebounceValue → useDebounceValue}/index.d.ts.map +0 -0
  168. /package/{dist/useDebounceValue → useDebounceValue}/index.js +0 -0
  169. /package/{dist/useDebounceValue → useDebounceValue}/useDebounceValue.d.ts +0 -0
  170. /package/{dist/useDebounceValue → useDebounceValue}/useDebounceValue.d.ts.map +0 -0
  171. /package/{dist/useDebounceValue → useDebounceValue}/useDebounceValue.js +0 -0
  172. /package/{dist/useDocumentTitle → useDocumentTitle}/index.d.ts +0 -0
  173. /package/{dist/useDocumentTitle → useDocumentTitle}/index.d.ts.map +0 -0
  174. /package/{dist/useDocumentTitle → useDocumentTitle}/index.js +0 -0
  175. /package/{dist/useDocumentTitle → useDocumentTitle}/useDocumentTitle.d.ts +0 -0
  176. /package/{dist/useDocumentTitle → useDocumentTitle}/useDocumentTitle.d.ts.map +0 -0
  177. /package/{dist/useDocumentTitle → useDocumentTitle}/useDocumentTitle.js +0 -0
  178. /package/{dist/useEventCallback → useEventCallback}/index.d.ts +0 -0
  179. /package/{dist/useEventCallback → useEventCallback}/index.d.ts.map +0 -0
  180. /package/{dist/useEventCallback → useEventCallback}/index.js +0 -0
  181. /package/{dist/useEventCallback → useEventCallback}/useEventCallback.d.ts +0 -0
  182. /package/{dist/useEventCallback → useEventCallback}/useEventCallback.d.ts.map +0 -0
  183. /package/{dist/useEventCallback → useEventCallback}/useEventCallback.js +0 -0
  184. /package/{dist/useEventListener → useEventListener}/index.d.ts +0 -0
  185. /package/{dist/useEventListener → useEventListener}/index.d.ts.map +0 -0
  186. /package/{dist/useEventListener → useEventListener}/index.js +0 -0
  187. /package/{dist/useEventListener → useEventListener}/useEventListener.js +0 -0
  188. /package/{dist/useHover → useHover}/index.d.ts +0 -0
  189. /package/{dist/useHover → useHover}/index.d.ts.map +0 -0
  190. /package/{dist/useHover → useHover}/index.js +0 -0
  191. /package/{dist/useHover → useHover}/useHover.js +0 -0
  192. /package/{dist/useIntersectionObserver → useIntersectionObserver}/index.d.ts +0 -0
  193. /package/{dist/useIntersectionObserver → useIntersectionObserver}/index.d.ts.map +0 -0
  194. /package/{dist/useIntersectionObserver → useIntersectionObserver}/index.js +0 -0
  195. /package/{dist/useIntersectionObserver → useIntersectionObserver}/useIntersectionObserver.d.ts +0 -0
  196. /package/{dist/useIntersectionObserver → useIntersectionObserver}/useIntersectionObserver.d.ts.map +0 -0
  197. /package/{dist/useIntersectionObserver → useIntersectionObserver}/useIntersectionObserver.js +0 -0
  198. /package/{dist/useInterval → useInterval}/index.d.ts +0 -0
  199. /package/{dist/useInterval → useInterval}/index.d.ts.map +0 -0
  200. /package/{dist/useInterval → useInterval}/index.js +0 -0
  201. /package/{dist/useInterval → useInterval}/useInterval.d.ts +0 -0
  202. /package/{dist/useInterval → useInterval}/useInterval.d.ts.map +0 -0
  203. /package/{dist/useInterval → useInterval}/useInterval.js +0 -0
  204. /package/{dist/useIsClient → useIsClient}/index.d.ts +0 -0
  205. /package/{dist/useIsClient → useIsClient}/index.d.ts.map +0 -0
  206. /package/{dist/useIsClient → useIsClient}/index.js +0 -0
  207. /package/{dist/useIsClient → useIsClient}/useIsClient.d.ts +0 -0
  208. /package/{dist/useIsClient → useIsClient}/useIsClient.d.ts.map +0 -0
  209. /package/{dist/useIsClient → useIsClient}/useIsClient.js +0 -0
  210. /package/{dist/useIsMobile → useIsMobile}/index.d.ts +0 -0
  211. /package/{dist/useIsMobile → useIsMobile}/index.d.ts.map +0 -0
  212. /package/{dist/useIsMobile → useIsMobile}/index.js +0 -0
  213. /package/{dist/useIsMobile → useIsMobile}/types.d.ts +0 -0
  214. /package/{dist/useIsMobile → useIsMobile}/types.d.ts.map +0 -0
  215. /package/{dist/useIsMobile → useIsMobile}/types.js +0 -0
  216. /package/{dist/useIsMobile → useIsMobile}/useIsMobile.d.ts +0 -0
  217. /package/{dist/useIsMobile → useIsMobile}/useIsMobile.d.ts.map +0 -0
  218. /package/{dist/useIsMobile → useIsMobile}/useIsMobile.js +0 -0
  219. /package/{dist/useIsMounted → useIsMounted}/index.d.ts +0 -0
  220. /package/{dist/useIsMounted → useIsMounted}/index.d.ts.map +0 -0
  221. /package/{dist/useIsMounted → useIsMounted}/index.js +0 -0
  222. /package/{dist/useIsMounted → useIsMounted}/useIsMounted.d.ts +0 -0
  223. /package/{dist/useIsMounted → useIsMounted}/useIsMounted.d.ts.map +0 -0
  224. /package/{dist/useIsMounted → useIsMounted}/useIsMounted.js +0 -0
  225. /package/{dist/useIsomorphicLayoutEffect → useIsomorphicLayoutEffect}/index.d.ts +0 -0
  226. /package/{dist/useIsomorphicLayoutEffect → useIsomorphicLayoutEffect}/index.d.ts.map +0 -0
  227. /package/{dist/useIsomorphicLayoutEffect → useIsomorphicLayoutEffect}/index.js +0 -0
  228. /package/{dist/useIsomorphicLayoutEffect → useIsomorphicLayoutEffect}/useIsomorphicLayoutEffect.d.ts +0 -0
  229. /package/{dist/useIsomorphicLayoutEffect → useIsomorphicLayoutEffect}/useIsomorphicLayoutEffect.d.ts.map +0 -0
  230. /package/{dist/useIsomorphicLayoutEffect → useIsomorphicLayoutEffect}/useIsomorphicLayoutEffect.js +0 -0
  231. /package/{dist/useLocalStorage → useLocalStorage}/index.d.ts +0 -0
  232. /package/{dist/useLocalStorage → useLocalStorage}/index.d.ts.map +0 -0
  233. /package/{dist/useLocalStorage → useLocalStorage}/index.js +0 -0
  234. /package/{dist/useLocalStorage → useLocalStorage}/useLocalStorage.d.ts +0 -0
  235. /package/{dist/useLocalStorage → useLocalStorage}/useLocalStorage.d.ts.map +0 -0
  236. /package/{dist/useLocalStorage → useLocalStorage}/useLocalStorage.js +0 -0
  237. /package/{dist/useLockBody → useLockBody}/index.d.ts +0 -0
  238. /package/{dist/useLockBody → useLockBody}/index.d.ts.map +0 -0
  239. /package/{dist/useLockBody → useLockBody}/index.js +0 -0
  240. /package/{dist/useLockBody → useLockBody}/useLockBody.d.ts +0 -0
  241. /package/{dist/useLockBody → useLockBody}/useLockBody.d.ts.map +0 -0
  242. /package/{dist/useLockBody → useLockBody}/useLockBody.js +0 -0
  243. /package/{dist/useMap → useMap}/index.d.ts +0 -0
  244. /package/{dist/useMap → useMap}/index.d.ts.map +0 -0
  245. /package/{dist/useMap → useMap}/index.js +0 -0
  246. /package/{dist/useMap → useMap}/useMap.d.ts +0 -0
  247. /package/{dist/useMap → useMap}/useMap.d.ts.map +0 -0
  248. /package/{dist/useMap → useMap}/useMap.js +0 -0
  249. /package/{dist/useMediaQuery → useMediaQuery}/index.d.ts +0 -0
  250. /package/{dist/useMediaQuery → useMediaQuery}/index.d.ts.map +0 -0
  251. /package/{dist/useMediaQuery → useMediaQuery}/index.js +0 -0
  252. /package/{dist/useMediaQuery → useMediaQuery}/useMediaQuery.d.ts +0 -0
  253. /package/{dist/useMediaQuery → useMediaQuery}/useMediaQuery.d.ts.map +0 -0
  254. /package/{dist/useMediaQuery → useMediaQuery}/useMediaQuery.js +0 -0
  255. /package/{dist/useOnClickOutside → useOnClickOutside}/index.d.ts +0 -0
  256. /package/{dist/useOnClickOutside → useOnClickOutside}/index.d.ts.map +0 -0
  257. /package/{dist/useOnClickOutside → useOnClickOutside}/index.js +0 -0
  258. /package/{dist/useOnClickOutside → useOnClickOutside}/useOnClickOutside.js +0 -0
  259. /package/{dist/useQueryString → useQueryString}/index.d.ts +0 -0
  260. /package/{dist/useQueryString → useQueryString}/index.d.ts.map +0 -0
  261. /package/{dist/useQueryString → useQueryString}/index.js +0 -0
  262. /package/{dist/useQueryString → useQueryString}/useQueryString.d.ts +0 -0
  263. /package/{dist/useQueryString → useQueryString}/useQueryString.d.ts.map +0 -0
  264. /package/{dist/useQueryString → useQueryString}/useQueryString.js +0 -0
  265. /package/{dist/useReadLocalStorage → useReadLocalStorage}/index.d.ts +0 -0
  266. /package/{dist/useReadLocalStorage → useReadLocalStorage}/index.d.ts.map +0 -0
  267. /package/{dist/useReadLocalStorage → useReadLocalStorage}/index.js +0 -0
  268. /package/{dist/useReadLocalStorage → useReadLocalStorage}/useReadLocalStorage.d.ts +0 -0
  269. /package/{dist/useReadLocalStorage → useReadLocalStorage}/useReadLocalStorage.d.ts.map +0 -0
  270. /package/{dist/useReadLocalStorage → useReadLocalStorage}/useReadLocalStorage.js +0 -0
  271. /package/{dist/useResizeObserver → useResizeObserver}/index.d.ts +0 -0
  272. /package/{dist/useResizeObserver → useResizeObserver}/index.d.ts.map +0 -0
  273. /package/{dist/useResizeObserver → useResizeObserver}/index.js +0 -0
  274. /package/{dist/useResizeObserver → useResizeObserver}/useResizeObserver.js +0 -0
  275. /package/{dist/useScreen → useScreen}/index.d.ts +0 -0
  276. /package/{dist/useScreen → useScreen}/index.d.ts.map +0 -0
  277. /package/{dist/useScreen → useScreen}/index.js +0 -0
  278. /package/{dist/useScreen → useScreen}/useScreen.d.ts +0 -0
  279. /package/{dist/useScreen → useScreen}/useScreen.d.ts.map +0 -0
  280. /package/{dist/useScreen → useScreen}/useScreen.js +0 -0
  281. /package/{dist/useScript → useScript}/index.d.ts +0 -0
  282. /package/{dist/useScript → useScript}/index.d.ts.map +0 -0
  283. /package/{dist/useScript → useScript}/index.js +0 -0
  284. /package/{dist/useScript → useScript}/useScript.d.ts +0 -0
  285. /package/{dist/useScript → useScript}/useScript.d.ts.map +0 -0
  286. /package/{dist/useScript → useScript}/useScript.js +0 -0
  287. /package/{dist/useScrollLock → useScrollLock}/index.d.ts +0 -0
  288. /package/{dist/useScrollLock → useScrollLock}/index.d.ts.map +0 -0
  289. /package/{dist/useScrollLock → useScrollLock}/index.js +0 -0
  290. /package/{dist/useScrollLock → useScrollLock}/useScrollLock.d.ts +0 -0
  291. /package/{dist/useScrollLock → useScrollLock}/useScrollLock.d.ts.map +0 -0
  292. /package/{dist/useScrollLock → useScrollLock}/useScrollLock.js +0 -0
  293. /package/{dist/useSessionStorage → useSessionStorage}/index.d.ts +0 -0
  294. /package/{dist/useSessionStorage → useSessionStorage}/index.d.ts.map +0 -0
  295. /package/{dist/useSessionStorage → useSessionStorage}/index.js +0 -0
  296. /package/{dist/useSessionStorage → useSessionStorage}/useSessionStorage.d.ts +0 -0
  297. /package/{dist/useSessionStorage → useSessionStorage}/useSessionStorage.d.ts.map +0 -0
  298. /package/{dist/useSessionStorage → useSessionStorage}/useSessionStorage.js +0 -0
  299. /package/{dist/useStep → useStep}/index.d.ts +0 -0
  300. /package/{dist/useStep → useStep}/index.d.ts.map +0 -0
  301. /package/{dist/useStep → useStep}/index.js +0 -0
  302. /package/{dist/useStep → useStep}/useStep.d.ts +0 -0
  303. /package/{dist/useStep → useStep}/useStep.d.ts.map +0 -0
  304. /package/{dist/useStep → useStep}/useStep.js +0 -0
  305. /package/{dist/useTernaryDarkMode → useTernaryDarkMode}/index.d.ts +0 -0
  306. /package/{dist/useTernaryDarkMode → useTernaryDarkMode}/index.d.ts.map +0 -0
  307. /package/{dist/useTernaryDarkMode → useTernaryDarkMode}/index.js +0 -0
  308. /package/{dist/useTernaryDarkMode → useTernaryDarkMode}/useTernaryDarkMode.d.ts +0 -0
  309. /package/{dist/useTernaryDarkMode → useTernaryDarkMode}/useTernaryDarkMode.d.ts.map +0 -0
  310. /package/{dist/useTernaryDarkMode → useTernaryDarkMode}/useTernaryDarkMode.js +0 -0
  311. /package/{dist/useTimeout → useTimeout}/index.d.ts +0 -0
  312. /package/{dist/useTimeout → useTimeout}/index.d.ts.map +0 -0
  313. /package/{dist/useTimeout → useTimeout}/index.js +0 -0
  314. /package/{dist/useTimeout → useTimeout}/useTimeout.d.ts +0 -0
  315. /package/{dist/useTimeout → useTimeout}/useTimeout.d.ts.map +0 -0
  316. /package/{dist/useTimeout → useTimeout}/useTimeout.js +0 -0
  317. /package/{dist/useToggle → useToggle}/index.d.ts +0 -0
  318. /package/{dist/useToggle → useToggle}/index.d.ts.map +0 -0
  319. /package/{dist/useToggle → useToggle}/index.js +0 -0
  320. /package/{dist/useToggle → useToggle}/useToggle.d.ts +0 -0
  321. /package/{dist/useToggle → useToggle}/useToggle.d.ts.map +0 -0
  322. /package/{dist/useToggle → useToggle}/useToggle.js +0 -0
  323. /package/{dist/useUnmount → useUnmount}/index.d.ts +0 -0
  324. /package/{dist/useUnmount → useUnmount}/index.d.ts.map +0 -0
  325. /package/{dist/useUnmount → useUnmount}/index.js +0 -0
  326. /package/{dist/useUnmount → useUnmount}/useUnmount.d.ts +0 -0
  327. /package/{dist/useUnmount → useUnmount}/useUnmount.d.ts.map +0 -0
  328. /package/{dist/useUnmount → useUnmount}/useUnmount.js +0 -0
  329. /package/{dist/useWindowSize → useWindowSize}/index.d.ts +0 -0
  330. /package/{dist/useWindowSize → useWindowSize}/index.d.ts.map +0 -0
  331. /package/{dist/useWindowSize → useWindowSize}/index.js +0 -0
  332. /package/{dist/useWindowSize → useWindowSize}/useWindowSize.d.ts +0 -0
  333. /package/{dist/useWindowSize → useWindowSize}/useWindowSize.d.ts.map +0 -0
  334. /package/{dist/useWindowSize → useWindowSize}/useWindowSize.js +0 -0
@@ -1,191 +0,0 @@
1
- import { useCallback, useEffect, useState } from 'react'
2
-
3
- import type { Dispatch, SetStateAction } from 'react'
4
-
5
- import { useEventCallback } from '../useEventCallback'
6
- import { useEventListener } from '../useEventListener'
7
-
8
- declare global {
9
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
10
- interface WindowEventMap {
11
- 'session-storage': CustomEvent
12
- }
13
- }
14
-
15
- /**
16
- * Represents the options for customizing the behavior of serialization and deserialization.
17
- * @template T - The type of the state to be stored in session storage.
18
- */
19
- type UseSessionStorageOptions<T> = {
20
- /** A function to serialize the value before storing it. */
21
- serializer?: (value: T) => string
22
- /** A function to deserialize the stored value. */
23
- deserializer?: (value: string) => T
24
- /**
25
- * If `true` (default), the hook will initialize reading the session storage. In SSR, you should set it to `false`, returning the initial value initially.
26
- * @default true
27
- */
28
- initializeWithValue?: boolean
29
- }
30
-
31
- const IS_SERVER = typeof window === 'undefined'
32
-
33
- /**
34
- * Custom hook that uses the [`sessionStorage API`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) to persist state across page reloads.
35
- * @template T - The type of the state to be stored in session storage.
36
- * @param {string} key - The key under which the value will be stored in session storage.
37
- * @param {T | (() => T)} initialValue - The initial value of the state or a function that returns the initial value.
38
- * @param {?UseSessionStorageOptions<T>} [options] - Options for customizing the behavior of serialization and deserialization (optional).
39
- * @returns {[T, Dispatch<SetStateAction<T>>, () => void]} A tuple containing the stored value, a function to set the value and a function to remove the key from storage.
40
- * @public
41
- * @see [Documentation](https://usehooks-ts.com/react-hook/use-session-storage)
42
- * @example
43
- * ```tsx
44
- * const [count, setCount, removeCount] = useSessionStorage('count', 0);
45
- * // Access the `count` value, the `setCount` function to update it and `removeCount` function to remove the key from storage.
46
- * ```
47
- */
48
- export function useSessionStorage<T>(
49
- key: string,
50
- initialValue: T | (() => T),
51
- options: UseSessionStorageOptions<T> = {},
52
- ): [T, Dispatch<SetStateAction<T>>, () => void] {
53
- const { initializeWithValue = true } = options
54
-
55
- const serializer = useCallback<(value: T) => string>(
56
- value => {
57
- if (options.serializer) {
58
- return options.serializer(value)
59
- }
60
-
61
- return JSON.stringify(value)
62
- },
63
- [options],
64
- )
65
-
66
- const deserializer = useCallback<(value: string) => T>(
67
- value => {
68
- if (options.deserializer) {
69
- return options.deserializer(value)
70
- }
71
- // Support 'undefined' as a value
72
- if (value === 'undefined') {
73
- return undefined as unknown as T
74
- }
75
-
76
- const defaultValue =
77
- initialValue instanceof Function ? initialValue() : initialValue
78
-
79
- let parsed: unknown
80
- try {
81
- parsed = JSON.parse(value)
82
- } catch (error) {
83
- console.error('Error parsing JSON:', error)
84
- return defaultValue // Return initialValue if parsing fails
85
- }
86
-
87
- return parsed as T
88
- },
89
- [options, initialValue],
90
- )
91
-
92
- // Get from session storage then
93
- // parse stored json or return initialValue
94
- const readValue = useCallback((): T => {
95
- const initialValueToUse =
96
- initialValue instanceof Function ? initialValue() : initialValue
97
-
98
- // Prevent build error "window is undefined" but keep working
99
- if (IS_SERVER) {
100
- return initialValueToUse
101
- }
102
-
103
- try {
104
- const raw = window.sessionStorage.getItem(key)
105
- return raw ? deserializer(raw) : initialValueToUse
106
- } catch (error) {
107
- console.warn(`Error reading sessionStorage key “${key}”:`, error)
108
- return initialValueToUse
109
- }
110
- }, [initialValue, key, deserializer])
111
-
112
- const [storedValue, setStoredValue] = useState(() => {
113
- if (initializeWithValue) {
114
- return readValue()
115
- }
116
-
117
- return initialValue instanceof Function ? initialValue() : initialValue
118
- })
119
-
120
- // Return a wrapped version of useState's setter function that ...
121
- // ... persists the new value to sessionStorage.
122
- const setValue: Dispatch<SetStateAction<T>> = useEventCallback(value => {
123
- // Prevent build error "window is undefined" but keeps working
124
- if (IS_SERVER) {
125
- console.warn(
126
- `Tried setting sessionStorage key “${key}” even though environment is not a client`,
127
- )
128
- }
129
-
130
- try {
131
- // Allow value to be a function so we have the same API as useState
132
- const newValue = value instanceof Function ? value(readValue()) : value
133
-
134
- // Save to session storage
135
- window.sessionStorage.setItem(key, serializer(newValue))
136
-
137
- // Save state
138
- setStoredValue(newValue)
139
-
140
- // We dispatch a custom event so every similar useSessionStorage hook is notified
141
- window.dispatchEvent(new StorageEvent('session-storage', { key }))
142
- } catch (error) {
143
- console.warn(`Error setting sessionStorage key “${key}”:`, error)
144
- }
145
- })
146
-
147
- const removeValue = useEventCallback(() => {
148
- // Prevent build error "window is undefined" but keeps working
149
- if (IS_SERVER) {
150
- console.warn(
151
- `Tried removing sessionStorage key “${key}” even though environment is not a client`,
152
- )
153
- }
154
-
155
- const defaultValue =
156
- initialValue instanceof Function ? initialValue() : initialValue
157
-
158
- // Remove the key from session storage
159
- window.sessionStorage.removeItem(key)
160
-
161
- // Save state with default value
162
- setStoredValue(defaultValue)
163
-
164
- // We dispatch a custom event so every similar useSessionStorage hook is notified
165
- window.dispatchEvent(new StorageEvent('session-storage', { key }))
166
- })
167
-
168
- useEffect(() => {
169
- setStoredValue(readValue())
170
- // eslint-disable-next-line react-hooks/exhaustive-deps
171
- }, [key])
172
-
173
- const handleStorageChange = useCallback(
174
- (event: StorageEvent | CustomEvent) => {
175
- if ((event as StorageEvent).key && (event as StorageEvent).key !== key) {
176
- return
177
- }
178
- setStoredValue(readValue())
179
- },
180
- [key, readValue],
181
- )
182
-
183
- // this only works for other documents, not the current one
184
- useEventListener('storage', handleStorageChange)
185
-
186
- // this is a custom event, triggered in writeValueToSessionStorage
187
- // See: useSessionStorage()
188
- useEventListener('session-storage', handleStorageChange)
189
-
190
- return [storedValue, setValue, removeValue]
191
- }
@@ -1 +0,0 @@
1
- export * from './useStep'
@@ -1,83 +0,0 @@
1
- import { useCallback, useState } from 'react'
2
-
3
- import type { Dispatch, SetStateAction } from 'react'
4
-
5
- /** Represents the second element of the output of the `useStep` hook. */
6
- type UseStepActions = {
7
- /** Go to the next step in the process. */
8
- goToNextStep: () => void
9
- /** Go to the previous step in the process. */
10
- goToPrevStep: () => void
11
- /** Reset the step to the initial step. */
12
- reset: () => void
13
- /** Check if the next step is available. */
14
- canGoToNextStep: boolean
15
- /** Check if the previous step is available. */
16
- canGoToPrevStep: boolean
17
- /** Set the current step to a specific value. */
18
- setStep: Dispatch<SetStateAction<number>>
19
- }
20
-
21
- type SetStepCallbackType = (step: number | ((step: number) => number)) => void
22
-
23
- /**
24
- * Custom hook that manages and navigates between steps in a multi-step process.
25
- * @param {number} maxStep - The maximum step in the process.
26
- * @returns {[number, UseStepActions]} An tuple containing the current step and helper functions for navigating steps.
27
- * @public
28
- * @see [Documentation](https://usehooks-ts.com/react-hook/use-step)
29
- * @example
30
- * ```tsx
31
- * const [currentStep, { goToNextStep, goToPrevStep, reset, canGoToNextStep, canGoToPrevStep, setStep }] = useStep(3);
32
- * // Access and use the current step and provided helper functions.
33
- * ```
34
- */
35
- export function useStep(maxStep: number): [number, UseStepActions] {
36
- const [currentStep, setCurrentStep] = useState(1)
37
-
38
- const canGoToNextStep = currentStep + 1 <= maxStep
39
- const canGoToPrevStep = currentStep - 1 > 0
40
-
41
- const setStep = useCallback<SetStepCallbackType>(
42
- step => {
43
- // Allow value to be a function so we have the same API as useState
44
- const newStep = step instanceof Function ? step(currentStep) : step
45
-
46
- if (newStep >= 1 && newStep <= maxStep) {
47
- setCurrentStep(newStep)
48
- return
49
- }
50
-
51
- throw new Error('Step not valid')
52
- },
53
- [maxStep, currentStep],
54
- )
55
-
56
- const goToNextStep = useCallback(() => {
57
- if (canGoToNextStep) {
58
- setCurrentStep(step => step + 1)
59
- }
60
- }, [canGoToNextStep])
61
-
62
- const goToPrevStep = useCallback(() => {
63
- if (canGoToPrevStep) {
64
- setCurrentStep(step => step - 1)
65
- }
66
- }, [canGoToPrevStep])
67
-
68
- const reset = useCallback(() => {
69
- setCurrentStep(1)
70
- }, [])
71
-
72
- return [
73
- currentStep,
74
- {
75
- goToNextStep,
76
- goToPrevStep,
77
- canGoToNextStep,
78
- canGoToPrevStep,
79
- setStep,
80
- reset,
81
- },
82
- ]
83
- }
@@ -1 +0,0 @@
1
- export * from './useTernaryDarkMode'
@@ -1,81 +0,0 @@
1
- import type { Dispatch, SetStateAction } from 'react'
2
-
3
- import { useLocalStorage } from '../useLocalStorage'
4
- import { useMediaQuery } from '../useMediaQuery'
5
-
6
- const COLOR_SCHEME_QUERY = '(prefers-color-scheme: dark)'
7
- const LOCAL_STORAGE_KEY = 'usehooks-ts-ternary-dark-mode'
8
-
9
- /** Ternary dark mode options. */
10
- export type TernaryDarkMode = 'system' | 'dark' | 'light'
11
-
12
- /** Options for the `useTernaryDarkMode` hook. */
13
- export type TernaryDarkModeOptions = {
14
- /**
15
- * The default value for the dark mode.
16
- * @default 'system'
17
- */
18
- defaultValue?: TernaryDarkMode
19
- /**
20
- * The key for storing dark mode preference in local storage.
21
- * @default 'usehooks-ts-ternary-dark-mode'
22
- */
23
- localStorageKey?: string
24
- /**
25
- * If `true` (default), the hook will initialize reading `localStorage`. In SSR, you should set it to `false`, returning default values initially.
26
- * @default true
27
- */
28
- initializeWithValue?: boolean
29
- }
30
-
31
- /** Represents the return type of the `useTernaryDarkMode` hook. */
32
- export type TernaryDarkModeReturn = {
33
- /** The current state of the dark mode. */
34
- isDarkMode: boolean
35
- /** The current state of the dark mode. */
36
- ternaryDarkMode: TernaryDarkMode
37
- /** A function to set the dark mode state. */
38
- setTernaryDarkMode: Dispatch<SetStateAction<TernaryDarkMode>>
39
- /** A function to toggle the dark mode state. */
40
- toggleTernaryDarkMode: () => void
41
- }
42
-
43
- /**
44
- * Custom hook that manages ternary (system, dark, light) dark mode with local storage support.
45
- * @param {?TernaryDarkModeOptions | string} [options] - Options or the local storage key for the hook.
46
- * @returns {TernaryDarkModeReturn} An object containing the dark mode state and helper functions.
47
- * @public
48
- * @see [Documentation](https://usehooks-ts.com/react-hook/use-ternary-dark-mode)
49
- * @example
50
- * ```tsx
51
- * const { isDarkMode, ternaryDarkMode, setTernaryDarkMode, toggleTernaryDarkMode } = useTernaryDarkMode({ defaultValue: 'dark' });
52
- * // Access and use the dark mode state and provided helper functions.
53
- * ```
54
- */
55
- export function useTernaryDarkMode({
56
- defaultValue = 'system',
57
- localStorageKey = LOCAL_STORAGE_KEY,
58
- initializeWithValue = true,
59
- }: TernaryDarkModeOptions = {}): TernaryDarkModeReturn {
60
- const isDarkOS = useMediaQuery(COLOR_SCHEME_QUERY, { initializeWithValue })
61
- const [mode, setMode] = useLocalStorage(localStorageKey, defaultValue, {
62
- initializeWithValue,
63
- })
64
-
65
- const isDarkMode = mode === 'dark' || (mode === 'system' && isDarkOS)
66
-
67
- const toggleTernaryDarkMode = () => {
68
- const modes: TernaryDarkMode[] = ['light', 'system', 'dark']
69
- setMode((prevMode): TernaryDarkMode => {
70
- const nextIndex = (modes.indexOf(prevMode) + 1) % modes.length
71
- return modes[nextIndex]
72
- })
73
- }
74
-
75
- return {
76
- isDarkMode,
77
- ternaryDarkMode: mode,
78
- setTernaryDarkMode: setMode,
79
- toggleTernaryDarkMode,
80
- }
81
- }
@@ -1 +0,0 @@
1
- export * from './useTimeout'
@@ -1,44 +0,0 @@
1
- import { useEffect, useRef } from 'react'
2
-
3
- import { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect'
4
-
5
- /**
6
- * Custom hook that handles timeouts in React components using the [`setTimeout API`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout).
7
- * @param {() => void} callback - The function to be executed when the timeout elapses.
8
- * @param {number | null} delay - The duration (in milliseconds) for the timeout. Set to `null` to clear the timeout.
9
- * @returns {void} This hook does not return anything.
10
- * @public
11
- * @see [Documentation](https://usehooks-ts.com/react-hook/use-timeout)
12
- * @example
13
- * ```tsx
14
- * // Usage of useTimeout hook
15
- * useTimeout(() => {
16
- * // Code to be executed after the specified delay
17
- * }, 1000); // Set a timeout of 1000 milliseconds (1 second)
18
- * ```
19
- */
20
- export function useTimeout(callback: () => void, delay: number | null): void {
21
- const savedCallback = useRef(callback)
22
-
23
- // Remember the latest callback if it changes.
24
- useIsomorphicLayoutEffect(() => {
25
- savedCallback.current = callback
26
- }, [callback])
27
-
28
- // Set up the timeout.
29
- useEffect(() => {
30
- // Don't schedule if no delay is specified.
31
- // Note: 0 is a valid value for delay.
32
- if (!delay && delay !== 0) {
33
- return
34
- }
35
-
36
- const id = setTimeout(() => {
37
- savedCallback.current()
38
- }, delay)
39
-
40
- return () => {
41
- clearTimeout(id)
42
- }
43
- }, [delay])
44
- }
@@ -1 +0,0 @@
1
- export * from './useToggle'
@@ -1,30 +0,0 @@
1
- import { useCallback, useState } from 'react'
2
-
3
- import type { Dispatch, SetStateAction } from 'react'
4
-
5
- /**
6
- * Custom hook that manages a boolean toggle state in React components.
7
- * @param {boolean} [defaultValue] - The initial value for the toggle state.
8
- * @returns {[boolean, () => void, Dispatch<SetStateAction<boolean>>]} A tuple containing the current state,
9
- * a function to toggle the state, and a function to set the state explicitly.
10
- * @public
11
- * @see [Documentation](https://usehooks-ts.com/react-hook/use-toggle)
12
- * @example
13
- * ```tsx
14
- * const [isToggled, toggle, setToggle] = useToggle(); // Initial value is false
15
- * // OR
16
- * const [isToggled, toggle, setToggle] = useToggle(true); // Initial value is true
17
- * // Use isToggled in your component, toggle to switch the state, setToggle to set the state explicitly.
18
- * ```
19
- */
20
- export function useToggle(
21
- defaultValue?: boolean,
22
- ): [boolean, () => void, Dispatch<SetStateAction<boolean>>] {
23
- const [value, setValue] = useState(!!defaultValue)
24
-
25
- const toggle = useCallback(() => {
26
- setValue(x => !x)
27
- }, [])
28
-
29
- return [value, toggle, setValue]
30
- }
@@ -1 +0,0 @@
1
- export * from './useUnmount'
@@ -1,26 +0,0 @@
1
- import { useEffect, useRef } from 'react'
2
-
3
- /**
4
- * Custom hook that runs a cleanup function when the component is unmounted.
5
- * @param {() => void} func - The cleanup function to be executed on unmount.
6
- * @public
7
- * @see [Documentation](https://usehooks-ts.com/react-hook/use-unmount)
8
- * @example
9
- * ```tsx
10
- * useUnmount(() => {
11
- * // Cleanup logic here
12
- * });
13
- * ```
14
- */
15
- export function useUnmount(func: () => void) {
16
- const funcRef = useRef(func)
17
-
18
- funcRef.current = func
19
-
20
- useEffect(
21
- () => () => {
22
- funcRef.current()
23
- },
24
- [],
25
- )
26
- }
@@ -1 +0,0 @@
1
- export * from './useWindowSize'
@@ -1,100 +0,0 @@
1
- import { useState } from 'react'
2
-
3
- import { useDebounceCallback } from '../useDebounceCallback'
4
- import { useEventListener } from '../useEventListener'
5
- import { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect'
6
-
7
- /**
8
- * Represent the dimension of the window.
9
- * @template T - The type of the dimension (number or undefined).
10
- */
11
- type WindowSize<T extends number | undefined = number | undefined> = {
12
- /** The width of the window. */
13
- width: T
14
- /** The height of the window. */
15
- height: T
16
- }
17
-
18
- /**
19
- * Hook options.
20
- * @template InitializeWithValue - If `true` (default), the hook will initialize reading the window size. In SSR, you should set it to `false`, returning `undefined` initially.
21
- */
22
- type UseWindowSizeOptions<InitializeWithValue extends boolean | undefined> = {
23
- /**
24
- * If `true` (default), the hook will initialize reading the window size. In SSR, you should set it to `false`, returning `undefined` initially.
25
- * @default true
26
- */
27
- initializeWithValue: InitializeWithValue
28
- /**
29
- * The delay in milliseconds before the state is updated (disabled by default for retro-compatibility).
30
- * @default undefined
31
- */
32
- debounceDelay?: number
33
- }
34
-
35
- const IS_SERVER = typeof window === 'undefined'
36
-
37
- // SSR version of useWindowSize.
38
- export function useWindowSize(options: UseWindowSizeOptions<false>): WindowSize
39
- // CSR version of useWindowSize.
40
- export function useWindowSize(
41
- options?: Partial<UseWindowSizeOptions<true>>,
42
- ): WindowSize<number>
43
- /**
44
- * Custom hook that tracks the size of the window.
45
- * @param {?UseWindowSizeOptions} [options] - The options for customizing the behavior of the hook (optional).
46
- * @returns {object} An object containing the width and height of the window.
47
- * @public
48
- * @see [Documentation](https://usehooks-ts.com/react-hook/use-window-size)
49
- * @example
50
- * ```tsx
51
- * const { width = 0, height = 0 } = useWindowSize();
52
- * console.log(`Window size: ${width} x ${height}`);
53
- * ```
54
- */
55
- export function useWindowSize(
56
- options: Partial<UseWindowSizeOptions<boolean>> = {},
57
- ): WindowSize | WindowSize<number> {
58
- let { initializeWithValue = true } = options
59
- if (IS_SERVER) {
60
- initializeWithValue = false
61
- }
62
-
63
- const [windowSize, setWindowSize] = useState<WindowSize>(() => {
64
- if (initializeWithValue) {
65
- return {
66
- width: window.innerWidth,
67
- height: window.innerHeight,
68
- }
69
- }
70
- return {
71
- width: undefined,
72
- height: undefined,
73
- }
74
- })
75
-
76
- const debouncedSetWindowSize = useDebounceCallback(
77
- setWindowSize,
78
- options.debounceDelay,
79
- )
80
-
81
- function handleSize() {
82
- const setSize = options.debounceDelay
83
- ? debouncedSetWindowSize
84
- : setWindowSize
85
-
86
- setSize({
87
- width: window.innerWidth,
88
- height: window.innerHeight,
89
- })
90
- }
91
-
92
- useEventListener('resize', handleSize)
93
-
94
- // Set size at the first client-side load
95
- useIsomorphicLayoutEffect(() => {
96
- handleSize()
97
- }, [])
98
-
99
- return windowSize
100
- }
package/tsconfig.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "files": [],
3
- "include": [],
4
- "references": [
5
- {
6
- "path": "./tsconfig.lib.json"
7
- }
8
- ],
9
- "extends": "../../tsconfig.base.json"
10
- }
package/tsconfig.lib.json DELETED
@@ -1,33 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- "types": [
6
- "node",
7
- "@nx/react/typings/cssmodule.d.ts",
8
- "@nx/react/typings/image.d.ts",
9
- "vite/client"
10
- ],
11
- "rootDir": "src",
12
- "jsx": "react-jsx",
13
- "tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo"
14
- },
15
- "exclude": [
16
- "out-tsc",
17
- "dist",
18
- "**/*.spec.ts",
19
- "**/*.test.ts",
20
- "**/*.spec.tsx",
21
- "**/*.test.tsx",
22
- "**/*.spec.js",
23
- "**/*.test.js",
24
- "**/*.spec.jsx",
25
- "**/*.test.jsx"
26
- ],
27
- "include": [
28
- "src/**/*.js",
29
- "src/**/*.jsx",
30
- "src/**/*.ts",
31
- "src/**/*.tsx"
32
- ]
33
- }
package/vite.config.ts DELETED
@@ -1,62 +0,0 @@
1
- /// <reference types='vitest' />
2
- import { defineConfig } from 'vite';
3
- import react from '@vitejs/plugin-react';
4
- import dts from 'vite-plugin-dts';
5
- import * as path from 'path';
6
- import { globSync } from 'glob';
7
- import { viteStaticCopy } from 'vite-plugin-static-copy';
8
- import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
9
- import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
10
-
11
- export default defineConfig(() => ({
12
- root: __dirname,
13
- cacheDir: '../../node_modules/.vite/packages/hooks',
14
- plugins: [
15
- react(),
16
- nxViteTsPaths(),
17
- nxCopyAssetsPlugin(['*.md', 'LICENSE', 'package.json']),
18
- dts({
19
- entryRoot: 'src',
20
- tsconfigPath: path.join(__dirname, 'tsconfig.lib.json')
21
- })
22
- ],
23
- build: {
24
- outDir: './dist',
25
- emptyOutDir: true,
26
- reportCompressedSize: true,
27
- commonjsOptions: {
28
- transformMixedEsModules: true,
29
- },
30
- sourcemap: false,
31
- target: 'es2022',
32
- lib: {
33
- name: '@oneplatformdev/hooks',
34
- formats: [ 'es' as const ],
35
- entry: {
36
- index: path.resolve(__dirname, 'src/index.ts'),
37
- ...Object.fromEntries(
38
- globSync('src/**/*.{ts,tsx}').map((filename) => {
39
- return [
40
- path.relative(
41
- 'src',
42
- filename.slice(0, filename.length - path.extname(filename).length)
43
- ),
44
- path.resolve(__dirname, filename),
45
- ]
46
- })
47
- )
48
- }
49
- },
50
- rollupOptions: {
51
- external: [ 'react', 'react-dom', 'react/jsx-runtime', "lodash.debounce" ],
52
- output: {
53
- preserveModules: true,
54
- preserveModulesRoot: 'src',
55
- globals: {
56
- react: 'React',
57
- 'react-dom': 'ReactDOM',
58
- }
59
- }
60
- }
61
- },
62
- }));
File without changes
File without changes