@siberiacancode/reactuse 0.0.16 → 0.0.18

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 (176) hide show
  1. package/dist/cjs/{_rollupPluginBabelHelpers-CAYbWukg.js → _rollupPluginBabelHelpers-_CVoF3od.js} +2 -2
  2. package/dist/cjs/_rollupPluginBabelHelpers-_CVoF3od.js.map +1 -0
  3. package/dist/cjs/hooks/index.js +2 -2
  4. package/dist/cjs/hooks/useBattery/useBattery.js +2 -2
  5. package/dist/cjs/hooks/useBoolean/useBoolean.js +2 -2
  6. package/dist/cjs/hooks/useClickOutside/useClickOutside.js +2 -2
  7. package/dist/cjs/hooks/useClickOutside/useClickOutside.js.map +1 -1
  8. package/dist/cjs/hooks/useCopyToClipboard/useCopyToClipboard.js +2 -2
  9. package/dist/cjs/hooks/useCounter/useCounter.js +2 -2
  10. package/dist/cjs/hooks/useCounter/useCounter.js.map +1 -1
  11. package/dist/cjs/hooks/useDebouncedValue/useDebouncedValue.js +2 -2
  12. package/dist/cjs/hooks/useDefault/useDefault.js +2 -2
  13. package/dist/cjs/hooks/useDidUpdate/useDidUpdate.js +1 -1
  14. package/dist/cjs/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
  15. package/dist/cjs/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
  16. package/dist/cjs/hooks/useDocumentVisibility/useDocumentVisibility.js.map +1 -1
  17. package/dist/cjs/hooks/useEvent/useEvent.js +1 -1
  18. package/dist/cjs/hooks/useEventListener/useEventListener.js +2 -2
  19. package/dist/cjs/hooks/useEventListener/useEventListener.js.map +1 -1
  20. package/dist/cjs/hooks/useFavicon/useFavicon.js +2 -2
  21. package/dist/cjs/hooks/useFullscreen/useFullscreen.js +3 -0
  22. package/dist/cjs/hooks/useFullscreen/useFullscreen.js.map +1 -0
  23. package/dist/cjs/hooks/useHash/useHash.js +2 -2
  24. package/dist/cjs/hooks/useHash/useHash.js.map +1 -1
  25. package/dist/cjs/hooks/useHotkeys/useHotkeys.js +2 -2
  26. package/dist/cjs/hooks/useHotkeys/useHotkeys.js.map +1 -1
  27. package/dist/cjs/hooks/useHover/useHover.js +2 -2
  28. package/dist/cjs/hooks/useHover/useHover.js.map +1 -1
  29. package/dist/cjs/hooks/useIdle/useIdle.js +2 -2
  30. package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -2
  31. package/dist/cjs/hooks/useIsFirstRender/useIsFirstRender.js +1 -1
  32. package/dist/cjs/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +1 -1
  33. package/dist/cjs/hooks/useKeyPress/useKeyPress.js +2 -2
  34. package/dist/cjs/hooks/useKeyPress/useKeyPress.js.map +1 -1
  35. package/dist/cjs/hooks/useKeyPressEvent/useKeyPressEvent.js +2 -2
  36. package/dist/cjs/hooks/useKeyPressEvent/useKeyPressEvent.js.map +1 -1
  37. package/dist/cjs/hooks/useKeysPressed/useKeysPressed.js +2 -2
  38. package/dist/cjs/hooks/useKeysPressed/useKeysPressed.js.map +1 -1
  39. package/dist/cjs/hooks/useList/useList.js +3 -0
  40. package/dist/cjs/hooks/useList/useList.js.map +1 -0
  41. package/dist/cjs/hooks/useLocalStorage/useLocalStorage.js +2 -2
  42. package/dist/cjs/hooks/useLogger/useLogger.js +2 -2
  43. package/dist/cjs/hooks/useMediaQuery/useMediaQuery.js +1 -1
  44. package/dist/cjs/hooks/useMount/useMount.js +1 -1
  45. package/dist/cjs/hooks/useMouse/useMouse.js +3 -0
  46. package/dist/cjs/hooks/useMouse/useMouse.js.map +1 -0
  47. package/dist/cjs/hooks/useMutationObserver.js +1 -1
  48. package/dist/cjs/hooks/useNetwork/useNetwork.js +2 -2
  49. package/dist/cjs/hooks/useNetwork/useNetwork.js.map +1 -1
  50. package/dist/cjs/hooks/useOnline/useOnline.js +1 -1
  51. package/dist/cjs/hooks/useOperatingSystem/useOperatingSystem.js +1 -1
  52. package/dist/cjs/hooks/useOrientation/useOrientation.js +2 -2
  53. package/dist/cjs/hooks/usePageLeave/usePageLeave.js +2 -2
  54. package/dist/cjs/hooks/usePageLeave/usePageLeave.js.map +1 -1
  55. package/dist/cjs/hooks/usePreferredLanguages/usePreferredLanguages.js +2 -2
  56. package/dist/cjs/hooks/usePreferredLanguages/usePreferredLanguages.js.map +1 -1
  57. package/dist/cjs/hooks/usePrevious/usePrevious.js +1 -1
  58. package/dist/cjs/hooks/useQueue/useQueue.js +2 -2
  59. package/dist/cjs/hooks/useRenderCount/useRenderCount.js +1 -1
  60. package/dist/cjs/hooks/useRerender/useRerender.js +2 -2
  61. package/dist/cjs/hooks/useScript/useScript.js +2 -2
  62. package/dist/cjs/hooks/useSessionStorage/useSessionStorage.js +2 -2
  63. package/dist/cjs/hooks/useSet/useSet.js +2 -2
  64. package/dist/cjs/hooks/useStep/useStep.js +2 -2
  65. package/dist/cjs/hooks/useStep/useStep.js.map +1 -1
  66. package/dist/cjs/hooks/useStorage/useStorage.js +2 -2
  67. package/dist/cjs/hooks/useTextSelection/useTextSelection.js +3 -0
  68. package/dist/cjs/hooks/useTextSelection/useTextSelection.js.map +1 -0
  69. package/dist/cjs/hooks/useTimeout/useTimeout.js +2 -2
  70. package/dist/cjs/hooks/useToggle/useToggle.js +2 -2
  71. package/dist/cjs/hooks/useUnmount/useUnmount.js +1 -1
  72. package/dist/cjs/hooks/useWindowEvent/useWindowEvent.js +2 -2
  73. package/dist/cjs/hooks/useWindowEvent/useWindowEvent.js.map +1 -1
  74. package/dist/cjs/hooks/useWindowSize/useWindowSize.js +2 -2
  75. package/dist/cjs/hooks/useWindowSize/useWindowSize.js.map +1 -1
  76. package/dist/cjs/{index-CGVdzmL1.js → index-CkeDLili.js} +2 -2
  77. package/dist/cjs/{index-CGVdzmL1.js.map → index-CkeDLili.js.map} +1 -1
  78. package/dist/cjs/index-sUuDzgrc.js +3 -0
  79. package/dist/cjs/index-sUuDzgrc.js.map +1 -0
  80. package/dist/cjs/index.js +2 -2
  81. package/dist/cjs/utils/helpers/debounce.js +1 -1
  82. package/dist/cjs/utils/helpers/index.js +2 -2
  83. package/dist/cjs/utils/helpers/isClient.js +1 -1
  84. package/dist/cjs/utils/helpers/throttle.js +1 -1
  85. package/dist/esm/{_rollupPluginBabelHelpers-CQgz65cb.js → _rollupPluginBabelHelpers-I2MqA1tp.js} +2 -2
  86. package/dist/esm/_rollupPluginBabelHelpers-I2MqA1tp.js.map +1 -0
  87. package/dist/esm/hooks/index.js +2 -2
  88. package/dist/esm/hooks/useBattery/useBattery.js +2 -2
  89. package/dist/esm/hooks/useBoolean/useBoolean.js +2 -2
  90. package/dist/esm/hooks/useClickOutside/useClickOutside.js +2 -2
  91. package/dist/esm/hooks/useClickOutside/useClickOutside.js.map +1 -1
  92. package/dist/esm/hooks/useCopyToClipboard/useCopyToClipboard.js +2 -2
  93. package/dist/esm/hooks/useCounter/useCounter.js +2 -2
  94. package/dist/esm/hooks/useCounter/useCounter.js.map +1 -1
  95. package/dist/esm/hooks/useDebouncedValue/useDebouncedValue.js +2 -2
  96. package/dist/esm/hooks/useDefault/useDefault.js +2 -2
  97. package/dist/esm/hooks/useDidUpdate/useDidUpdate.js +1 -1
  98. package/dist/esm/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
  99. package/dist/esm/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
  100. package/dist/esm/hooks/useDocumentVisibility/useDocumentVisibility.js.map +1 -1
  101. package/dist/esm/hooks/useEvent/useEvent.js +1 -1
  102. package/dist/esm/hooks/useEventListener/useEventListener.js +2 -2
  103. package/dist/esm/hooks/useEventListener/useEventListener.js.map +1 -1
  104. package/dist/esm/hooks/useFavicon/useFavicon.js +2 -2
  105. package/dist/esm/hooks/useFullscreen/useFullscreen.js +3 -0
  106. package/dist/esm/hooks/useFullscreen/useFullscreen.js.map +1 -0
  107. package/dist/esm/hooks/useHash/useHash.js +2 -2
  108. package/dist/esm/hooks/useHash/useHash.js.map +1 -1
  109. package/dist/esm/hooks/useHotkeys/useHotkeys.js +2 -2
  110. package/dist/esm/hooks/useHotkeys/useHotkeys.js.map +1 -1
  111. package/dist/esm/hooks/useHover/useHover.js +2 -2
  112. package/dist/esm/hooks/useHover/useHover.js.map +1 -1
  113. package/dist/esm/hooks/useIdle/useIdle.js +2 -2
  114. package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -2
  115. package/dist/esm/hooks/useIsFirstRender/useIsFirstRender.js +1 -1
  116. package/dist/esm/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +1 -1
  117. package/dist/esm/hooks/useKeyPress/useKeyPress.js +2 -2
  118. package/dist/esm/hooks/useKeyPress/useKeyPress.js.map +1 -1
  119. package/dist/esm/hooks/useKeyPressEvent/useKeyPressEvent.js +2 -2
  120. package/dist/esm/hooks/useKeyPressEvent/useKeyPressEvent.js.map +1 -1
  121. package/dist/esm/hooks/useKeysPressed/useKeysPressed.js +2 -2
  122. package/dist/esm/hooks/useKeysPressed/useKeysPressed.js.map +1 -1
  123. package/dist/esm/hooks/useList/useList.js +3 -0
  124. package/dist/esm/hooks/useList/useList.js.map +1 -0
  125. package/dist/esm/hooks/useLocalStorage/useLocalStorage.js +2 -2
  126. package/dist/esm/hooks/useLogger/useLogger.js +2 -2
  127. package/dist/esm/hooks/useMediaQuery/useMediaQuery.js +1 -1
  128. package/dist/esm/hooks/useMount/useMount.js +1 -1
  129. package/dist/esm/hooks/useMouse/useMouse.js +3 -0
  130. package/dist/esm/hooks/useMouse/useMouse.js.map +1 -0
  131. package/dist/esm/hooks/useMutationObserver.js +1 -1
  132. package/dist/esm/hooks/useNetwork/useNetwork.js +2 -2
  133. package/dist/esm/hooks/useNetwork/useNetwork.js.map +1 -1
  134. package/dist/esm/hooks/useOnline/useOnline.js +1 -1
  135. package/dist/esm/hooks/useOperatingSystem/useOperatingSystem.js +1 -1
  136. package/dist/esm/hooks/useOrientation/useOrientation.js +2 -2
  137. package/dist/esm/hooks/usePageLeave/usePageLeave.js +2 -2
  138. package/dist/esm/hooks/usePageLeave/usePageLeave.js.map +1 -1
  139. package/dist/esm/hooks/usePreferredLanguages/usePreferredLanguages.js +2 -2
  140. package/dist/esm/hooks/usePreferredLanguages/usePreferredLanguages.js.map +1 -1
  141. package/dist/esm/hooks/usePrevious/usePrevious.js +1 -1
  142. package/dist/esm/hooks/useQueue/useQueue.js +2 -2
  143. package/dist/esm/hooks/useRenderCount/useRenderCount.js +1 -1
  144. package/dist/esm/hooks/useRerender/useRerender.js +2 -2
  145. package/dist/esm/hooks/useScript/useScript.js +2 -2
  146. package/dist/esm/hooks/useSessionStorage/useSessionStorage.js +2 -2
  147. package/dist/esm/hooks/useSet/useSet.js +2 -2
  148. package/dist/esm/hooks/useStep/useStep.js +2 -2
  149. package/dist/esm/hooks/useStep/useStep.js.map +1 -1
  150. package/dist/esm/hooks/useStorage/useStorage.js +2 -2
  151. package/dist/esm/hooks/useTextSelection/useTextSelection.js +3 -0
  152. package/dist/esm/hooks/useTextSelection/useTextSelection.js.map +1 -0
  153. package/dist/esm/hooks/useTimeout/useTimeout.js +2 -2
  154. package/dist/esm/hooks/useToggle/useToggle.js +2 -2
  155. package/dist/esm/hooks/useUnmount/useUnmount.js +1 -1
  156. package/dist/esm/hooks/useWindowEvent/useWindowEvent.js +2 -2
  157. package/dist/esm/hooks/useWindowEvent/useWindowEvent.js.map +1 -1
  158. package/dist/esm/hooks/useWindowSize/useWindowSize.js +2 -2
  159. package/dist/esm/hooks/useWindowSize/useWindowSize.js.map +1 -1
  160. package/dist/esm/index-CrKe-XWk.js +3 -0
  161. package/dist/esm/index-CrKe-XWk.js.map +1 -0
  162. package/dist/esm/{index-DsWBxb1H.js → index-Dbp67dKU.js} +2 -2
  163. package/dist/esm/{index-DsWBxb1H.js.map → index-Dbp67dKU.js.map} +1 -1
  164. package/dist/esm/index.js +2 -2
  165. package/dist/esm/utils/helpers/debounce.js +1 -1
  166. package/dist/esm/utils/helpers/index.js +2 -2
  167. package/dist/esm/utils/helpers/isClient.js +1 -1
  168. package/dist/esm/utils/helpers/throttle.js +1 -1
  169. package/dist/index.d.ts +201 -19
  170. package/package.json +4 -1
  171. package/dist/cjs/_rollupPluginBabelHelpers-CAYbWukg.js.map +0 -1
  172. package/dist/cjs/utils/helpers/isShallowEqual.js +0 -3
  173. package/dist/cjs/utils/helpers/isShallowEqual.js.map +0 -1
  174. package/dist/esm/_rollupPluginBabelHelpers-CQgz65cb.js.map +0 -1
  175. package/dist/esm/utils/helpers/isShallowEqual.js +0 -3
  176. package/dist/esm/utils/helpers/isShallowEqual.js.map +0 -1
package/dist/esm/index.js CHANGED
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.16 */
2
- export{useBattery}from"./hooks/useBattery/useBattery.js";export{useBoolean}from"./hooks/useBoolean/useBoolean.js";export{useClickOutside}from"./hooks/useClickOutside/useClickOutside.js";export{legacyCopyToClipboard,useCopyToClipboard}from"./hooks/useCopyToClipboard/useCopyToClipboard.js";export{useCounter}from"./hooks/useCounter/useCounter.js";export{useDebouncedValue}from"./hooks/useDebouncedValue/useDebouncedValue.js";export{useDefault}from"./hooks/useDefault/useDefault.js";export{useDidUpdate}from"./hooks/useDidUpdate/useDidUpdate.js";export{useDocumentTitle}from"./hooks/useDocumentTitle/useDocumentTitle.js";export{useDocumentVisibility}from"./hooks/useDocumentVisibility/useDocumentVisibility.js";export{useEvent}from"./hooks/useEvent/useEvent.js";export{useEventListener}from"./hooks/useEventListener/useEventListener.js";export{useFavicon}from"./hooks/useFavicon/useFavicon.js";export{useHash}from"./hooks/useHash/useHash.js";export{isHotkeyMatch,useHotkeys}from"./hooks/useHotkeys/useHotkeys.js";export{useHover}from"./hooks/useHover/useHover.js";export{useIdle}from"./hooks/useIdle/useIdle.js";export{useIntersectionObserver}from"./hooks/useIntersectionObserver/useIntersectionObserver.js";export{useIsFirstRender}from"./hooks/useIsFirstRender/useIsFirstRender.js";export{useIsomorphicLayoutEffect}from"./hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";export{useKeyPress}from"./hooks/useKeyPress/useKeyPress.js";export{useKeyPressEvent}from"./hooks/useKeyPressEvent/useKeyPressEvent.js";export{useKeysPressed}from"./hooks/useKeysPressed/useKeysPressed.js";export{useLocalStorage}from"./hooks/useLocalStorage/useLocalStorage.js";export{useLogger}from"./hooks/useLogger/useLogger.js";export{useMediaQuery}from"./hooks/useMediaQuery/useMediaQuery.js";export{useMount}from"./hooks/useMount/useMount.js";export{getConnection,useNetwork}from"./hooks/useNetwork/useNetwork.js";export{useOnline}from"./hooks/useOnline/useOnline.js";export{getOperatingSystem,useOperatingSystem}from"./hooks/useOperatingSystem/useOperatingSystem.js";export{useOrientation}from"./hooks/useOrientation/useOrientation.js";export{usePageLeave}from"./hooks/usePageLeave/usePageLeave.js";export{usePreferredLanguages}from"./hooks/usePreferredLanguages/usePreferredLanguages.js";export{usePrevious}from"./hooks/usePrevious/usePrevious.js";export{useQueue}from"./hooks/useQueue/useQueue.js";export{useRenderCount}from"./hooks/useRenderCount/useRenderCount.js";export{useRerender}from"./hooks/useRerender/useRerender.js";export{SCRIPT_STATUS_ATTRIBUTE_NAME,useScript}from"./hooks/useScript/useScript.js";export{useSessionStorage}from"./hooks/useSessionStorage/useSessionStorage.js";export{useSet}from"./hooks/useSet/useSet.js";export{useStep}from"./hooks/useStep/useStep.js";export{dispatchStorageEvent,useStorage}from"./hooks/useStorage/useStorage.js";export{useTimeout}from"./hooks/useTimeout/useTimeout.js";export{useToggle}from"./hooks/useToggle/useToggle.js";export{useUnmount}from"./hooks/useUnmount/useUnmount.js";export{useWindowEvent}from"./hooks/useWindowEvent/useWindowEvent.js";export{useWindowSize}from"./hooks/useWindowSize/useWindowSize.js";import"./_rollupPluginBabelHelpers-CQgz65cb.js";import"react";import"./utils/helpers/debounce.js";import"./utils/helpers/isClient.js";import"./hooks/useMutationObserver.js";import"./utils/helpers/throttle.js";import"./utils/helpers/isShallowEqual.js";import"./index-DsWBxb1H.js";
1
+ /* @license @siberiacancode/reactuse v0.0.18 */
2
+ export{useBattery}from"./hooks/useBattery/useBattery.js";export{useBoolean}from"./hooks/useBoolean/useBoolean.js";export{useClickOutside}from"./hooks/useClickOutside/useClickOutside.js";export{legacyCopyToClipboard,useCopyToClipboard}from"./hooks/useCopyToClipboard/useCopyToClipboard.js";export{useCounter}from"./hooks/useCounter/useCounter.js";export{useDebouncedValue}from"./hooks/useDebouncedValue/useDebouncedValue.js";export{useDefault}from"./hooks/useDefault/useDefault.js";export{useDidUpdate}from"./hooks/useDidUpdate/useDidUpdate.js";export{useDocumentTitle}from"./hooks/useDocumentTitle/useDocumentTitle.js";export{useDocumentVisibility}from"./hooks/useDocumentVisibility/useDocumentVisibility.js";export{useEvent}from"./hooks/useEvent/useEvent.js";export{useEventListener}from"./hooks/useEventListener/useEventListener.js";export{useFavicon}from"./hooks/useFavicon/useFavicon.js";export{useFullscreen}from"./hooks/useFullscreen/useFullscreen.js";export{useHash}from"./hooks/useHash/useHash.js";export{isHotkeyMatch,useHotkeys}from"./hooks/useHotkeys/useHotkeys.js";export{useHover}from"./hooks/useHover/useHover.js";export{useIdle}from"./hooks/useIdle/useIdle.js";export{useIntersectionObserver}from"./hooks/useIntersectionObserver/useIntersectionObserver.js";export{useIsFirstRender}from"./hooks/useIsFirstRender/useIsFirstRender.js";export{useIsomorphicLayoutEffect}from"./hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";export{useKeyPress}from"./hooks/useKeyPress/useKeyPress.js";export{useKeyPressEvent}from"./hooks/useKeyPressEvent/useKeyPressEvent.js";export{useKeysPressed}from"./hooks/useKeysPressed/useKeysPressed.js";export{useList}from"./hooks/useList/useList.js";export{useLocalStorage}from"./hooks/useLocalStorage/useLocalStorage.js";export{useLogger}from"./hooks/useLogger/useLogger.js";export{useMediaQuery}from"./hooks/useMediaQuery/useMediaQuery.js";export{useMount}from"./hooks/useMount/useMount.js";export{useMouse}from"./hooks/useMouse/useMouse.js";export{getConnection,useNetwork}from"./hooks/useNetwork/useNetwork.js";export{useOnline}from"./hooks/useOnline/useOnline.js";export{getOperatingSystem,useOperatingSystem}from"./hooks/useOperatingSystem/useOperatingSystem.js";export{useOrientation}from"./hooks/useOrientation/useOrientation.js";export{usePageLeave}from"./hooks/usePageLeave/usePageLeave.js";export{usePreferredLanguages}from"./hooks/usePreferredLanguages/usePreferredLanguages.js";export{usePrevious}from"./hooks/usePrevious/usePrevious.js";export{useQueue}from"./hooks/useQueue/useQueue.js";export{useRenderCount}from"./hooks/useRenderCount/useRenderCount.js";export{useRerender}from"./hooks/useRerender/useRerender.js";export{SCRIPT_STATUS_ATTRIBUTE_NAME,useScript}from"./hooks/useScript/useScript.js";export{useSessionStorage}from"./hooks/useSessionStorage/useSessionStorage.js";export{useSet}from"./hooks/useSet/useSet.js";export{useStep}from"./hooks/useStep/useStep.js";export{dispatchStorageEvent,useStorage}from"./hooks/useStorage/useStorage.js";export{getRangesSelection,useTextSelection}from"./hooks/useTextSelection/useTextSelection.js";export{useTimeout}from"./hooks/useTimeout/useTimeout.js";export{useToggle}from"./hooks/useToggle/useToggle.js";export{useUnmount}from"./hooks/useUnmount/useUnmount.js";export{useWindowEvent}from"./hooks/useWindowEvent/useWindowEvent.js";export{useWindowSize}from"./hooks/useWindowSize/useWindowSize.js";import"./_rollupPluginBabelHelpers-I2MqA1tp.js";import"react";import"./utils/helpers/debounce.js";import"./utils/helpers/isClient.js";import"./hooks/useMutationObserver.js";import"./index-CrKe-XWk.js";import"./utils/helpers/throttle.js";import"./index-Dbp67dKU.js";
3
3
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.16 */
1
+ /* @license @siberiacancode/reactuse v0.0.18 */
2
2
  var r=function(r,n){var t;return function(){for(var e=arguments.length,o=new Array(e),u=0;u<e;u++)o[u]=arguments[u];clearTimeout(t),t=setTimeout((function(){return r.apply(void 0,o)}),n)}};export{r as debounce};
3
3
  //# sourceMappingURL=debounce.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.16 */
2
- export{debounce}from"./debounce.js";export{isClient}from"./isClient.js";export{isShallowEqual}from"./isShallowEqual.js";export{throttle}from"./throttle.js";
1
+ /* @license @siberiacancode/reactuse v0.0.18 */
2
+ export{debounce}from"./debounce.js";export{isClient}from"./isClient.js";export{throttle}from"./throttle.js";
3
3
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.16 */
1
+ /* @license @siberiacancode/reactuse v0.0.18 */
2
2
  var n,d,e=!("undefined"==typeof window||null===(n=window)||void 0===n||!n.document||null===(d=window)||void 0===d||null===(d=d.document)||void 0===d||!d.createElement);export{e as isClient};
3
3
  //# sourceMappingURL=isClient.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.16 */
1
+ /* @license @siberiacancode/reactuse v0.0.18 */
2
2
  var n=function(n,t){var o=!1;return function(){o||(n.apply(void 0,arguments),o=!0,setTimeout((function(){o=!1}),t))}};export{n as throttle};
3
3
  //# sourceMappingURL=throttle.js.map
package/dist/index.d.ts CHANGED
@@ -58,21 +58,21 @@ type UseClickOutside = {
58
58
  * @description - Hook to handle click events outside the specified target element(s)
59
59
  *
60
60
  * @overload
61
- * @template Target The target element(s) to detect outside clicks for
61
+ * @template Target The target element(s)
62
62
  * @param {Target} target The target element(s) to detect outside clicks for
63
63
  * @param {(event: Event) => void} callback The callback to execute when a click outside the target is detected
64
64
  * @returns {void}
65
65
  *
66
+ * @example
67
+ * useClickOutside(ref, () => console.log('click outside'));
68
+ *
66
69
  * @overload
67
- * @template Target The target element(s) to detect outside clicks for
70
+ * @template Target The target element(s)
68
71
  * @param {(event: Event) => void} callback The callback to execute when a click outside the target is detected
69
72
  * @returns {UseClickOutsideReturn<Target>} A React ref to attach to the target element
70
73
  *
71
74
  * @example
72
75
  * const ref = useClickOutside<HMLDiTvElement>(() => console.log('click outside'));
73
- *
74
- * @example
75
- * useClickOutside(ref, () => console.log('click outside'));
76
76
  */
77
77
  declare const useClickOutside: UseClickOutside;
78
78
 
@@ -136,15 +136,16 @@ type UseCounter = {
136
136
  * @param {number} [options.min=Number.NEGATIVE_INFINITY] The min of count value
137
137
  * @param {number} [options.max=Number.POSITIVE_INFINITY] The max of count value
138
138
  * @returns {UseCounterReturn} An object containing the current count and functions to interact with the counter
139
-
139
+ *
140
+ * @example
141
+ * const { count, dec, inc, reset, set } = useCounter(5);
142
+ *
140
143
  * @overload
141
144
  * @param {number} [params.initialValue=0] The initial number value
142
145
  * @param {number} [params.min=Number.NEGATIVE_INFINITY] The min of count value
143
146
  * @param {number} [params.max=Number.POSITIVE_INFINITY] The max of count value
144
147
  * @returns {UseCounterReturn} An object containing the current count and functions to interact with the counter
145
148
  *
146
- * @example
147
- * const { count, dec, inc, reset, set } = useCounter(5);
148
149
  *
149
150
  * @example
150
151
  * const { count, dec, inc, reset, set } = useCounter({ initialValue: 5, min: 0, max: 10 });
@@ -263,6 +264,57 @@ declare const useFavicon: (initialHref?: string) => {
263
264
  readonly set: (favicon: string) => void;
264
265
  };
265
266
 
267
+ /** The use fullscreen target element type */
268
+ type UseFullScreenTarget = React.RefObject<Element | null> | (() => Element) | Element;
269
+ /** The use fullscreen options */
270
+ interface UseFullScreenOptions {
271
+ /** initial value */
272
+ initialValue?: boolean;
273
+ /** on enter fullscreen */
274
+ onEnter?: () => void;
275
+ /** on exit fullscreen */
276
+ onExit?: () => void;
277
+ }
278
+ /** The use click outside return type */
279
+ interface UseFullScreenReturn {
280
+ enter: () => void;
281
+ exit: () => void;
282
+ toggle: () => void;
283
+ value: boolean;
284
+ }
285
+ type UseFullScreen = {
286
+ <Target extends UseFullScreenTarget>(target: Target, options?: UseFullScreenOptions): UseFullScreenReturn;
287
+ <Target extends UseFullScreenTarget>(options?: UseFullScreenOptions, target?: never): UseFullScreenReturn & {
288
+ ref: React.RefObject<Target>;
289
+ };
290
+ };
291
+ /**
292
+ * @name useFullscreen
293
+ * @description - Hook to handle fullscreen events
294
+ *
295
+ * @overload
296
+ * @template Target The target element for fullscreen
297
+ * @param {Target} target The target element for fullscreen
298
+ * @param {boolean} [options.initialValue=false] initial value of fullscreen
299
+ * @param {() => void} [options.onEnter] on enter fullscreen
300
+ * @param {() => void} [options.onExit] on exit fullscreen
301
+ * @returns {UseFullScreenReturn} An object with the fullscreen state and methods
302
+ *
303
+ * @example
304
+ * const { enter, exit, toggle, value } = useFullscreen(ref);
305
+ *
306
+ * @overload
307
+ * @template Target The target element for fullscreen
308
+ * @param {boolean} [options.initialValue=false] initial value of fullscreen
309
+ * @param {() => void} [options.onEnter] on enter fullscreen
310
+ * @param {() => void} [options.onExit] on exit fullscreen
311
+ * @returns {UseFullScreenReturn & { ref: React.RefObject<Target> }} An object with the fullscreen state and methods
312
+ *
313
+ * @example
314
+ * const { ref, enter, exit, toggle, value } = useFullscreen();
315
+ */
316
+ declare const useFullscreen: UseFullScreen;
317
+
266
318
  /** The use hash return type */
267
319
  type UseHashReturn = [string, (value: string) => void];
268
320
  /**
@@ -276,7 +328,7 @@ type UseHashReturn = [string, (value: string) => void];
276
328
  */
277
329
  declare const useHash: () => UseHashReturn;
278
330
 
279
- /** The use keys pressed params */
331
+ /** The use hotkeys params */
280
332
  interface UseHotkeysOptions {
281
333
  /** The target to attach the event listeners to */
282
334
  target?: UseEventListenerTarget;
@@ -333,20 +385,44 @@ type UseHover = {
333
385
  * @name useHover
334
386
  * @description - Hook that defines the logic when hovering an element
335
387
  *
388
+ * @overload
389
+ * @template Target The target element
390
+ * @param {Target} target The target element to be hovered
391
+ * @param {() => void} [callback] The callback function to be invoked on mouse enter
392
+ * @returns {boolean} The state of the hover
393
+ *
336
394
  * @example
337
395
  * const hovering = useHover(ref, () => console.log('callback'));
338
396
  *
339
- * @example
340
- * const [ref, hovering] = useHover(() => console.log('callback'));
397
+ * @overload
398
+ * @template Target The target element
399
+ * @param {Target} target The target element to be hovered
400
+ * @param {() => void} [options.onEntry] The callback function to be invoked on mouse enter
401
+ * @param {() => void} [options.onLeave] The callback function to be invoked on mouse leave
402
+ * @returns {boolean} The state of the hover
341
403
  *
342
404
  * @example
343
- * const [ref, hovering] = useHover({
405
+ * const hovering = useHover(ref, {
344
406
  * onEntry: () => console.log('onEntry'),
345
407
  * onLeave: () => console.log('onLeave'),
346
408
  * });
347
409
  *
410
+ * @overload
411
+ * @template Target The target element
412
+ * @param {() => void} [callback] The callback function to be invoked on mouse enter
413
+ * @returns {UseHoverReturn<Target>} The state of the hover
414
+ *
348
415
  * @example
349
- * const hovering = useHover(ref, {
416
+ * const [ref, hovering] = useHover(() => console.log('callback'));
417
+ *
418
+ * @overload
419
+ * @template Target The target element
420
+ * @param {() => void} [options.onEntry] The callback function to be invoked on mouse enter
421
+ * @param {() => void} [options.onLeave] The callback function to be invoked on mouse leave
422
+ * @returns {UseHoverReturn<Target>} The state of the hover
423
+ *
424
+ * @example
425
+ * const [ref, hovering] = useHover({
350
426
  * onEntry: () => console.log('onEntry'),
351
427
  * onLeave: () => console.log('onLeave'),
352
428
  * });
@@ -465,6 +541,45 @@ declare const useKeysPressed: (params?: UseKeysPressedParams) => {
465
541
  code: string;
466
542
  }[];
467
543
 
544
+ /** The use list return type */
545
+ interface UseListReturn<Item> {
546
+ /** The current list of items */
547
+ value: Item[];
548
+ /** Sets the list of items */
549
+ set: (list: Item[]) => void;
550
+ /** Adds an item to the list */
551
+ push: (item: Item) => void;
552
+ /** Removes an item from the list */
553
+ removeAt: (removeAtIndex: number) => void;
554
+ /** Inserts an item at the specified index */
555
+ insertAt: (insertAtIndex: number, item: Item) => void;
556
+ /** Updates an item at the specified index */
557
+ updateAt: (updateAtIndex: number, item: Item) => void;
558
+ /** Clears the list */
559
+ clear: () => void;
560
+ }
561
+ /**
562
+ * @name useList
563
+ * @description - Hook that defines the logic when unmounting a component
564
+ *
565
+ * @template Item - The type of the item
566
+ * @param {Item[] | (() => Item[])} initialList - The initial list of items
567
+ * @returns {UseListReturn} An object containing the current list and functions to interact with the list
568
+ *
569
+ * @example
570
+ * const { value, set, push, removeAt, insertAt, updateAt, clear } = useList();
571
+ */
572
+ declare const useList: <Item>(initialList?: Item[]) => {
573
+ value: Item[];
574
+ set: (list: Item[]) => void;
575
+ push: (item: Item) => void;
576
+ removeAt: (removeAtIndex: number) => void;
577
+ insertAt: (insertAtIndex: number, item: Item) => void;
578
+ updateAt: (updateAtIndex: number, item: Item) => void;
579
+ clear: () => void;
580
+ reset: () => void;
581
+ };
582
+
468
583
  type UseStorageInitialValue<Value> = Value | (() => Value);
469
584
  interface UseStorageOptions<Value> {
470
585
  serializer?: (value: Value) => string;
@@ -529,6 +644,50 @@ declare const useMediaQuery: (query: string) => boolean;
529
644
  */
530
645
  declare const useMount: (effect: React.EffectCallback) => void;
531
646
 
647
+ /** The use mouse target element type */
648
+ type UseMouseTarget = React.RefObject<Element | null> | (() => Element) | Element;
649
+ /** The use mouse return type */
650
+ interface UseMouseReturn {
651
+ /** The current mouse x position */
652
+ x: number;
653
+ /** The current mouse y position */
654
+ y: number;
655
+ /** The current element x position */
656
+ elementX: number;
657
+ /** The current element y position */
658
+ elementY: number;
659
+ /** The current element position x */
660
+ elementPositionX: number;
661
+ /** The current element position y */
662
+ elementPositionY: number;
663
+ }
664
+ type UseMouse = {
665
+ <Target extends UseMouseTarget>(target: Target): UseMouseReturn;
666
+ <Target extends UseMouseTarget>(target?: never): UseMouseReturn & {
667
+ ref: React.RefObject<Target>;
668
+ };
669
+ };
670
+ /**
671
+ * @name useMouse
672
+ * @description - Hook that manages a mouse position
673
+ *
674
+ * @overload
675
+ * @template Target The target element
676
+ * @param {Target} target The target element to manage the mouse position for
677
+ * @returns {UseMouseReturn} An object with the current mouse position
678
+ *
679
+ * @example
680
+ * const { x, y, elementX, elementY, elementPositionX, elementPositionY } = useMouse(target);
681
+ *
682
+ * @overload
683
+ * @template Target The target element
684
+ * @returns {UseMouseReturn & { ref: React.RefObject<Target> }} An object with the current mouse position and a ref
685
+ *
686
+ * @example
687
+ * const { ref, x, y, elementX, elementY, elementPositionX, elementPositionY } = useMouse();
688
+ */
689
+ declare const useMouse: UseMouse;
690
+
532
691
  type ConnectionType = Connection['type'];
533
692
  type ConnectionEffectiveType = Connection['effectiveType'];
534
693
  /** The use network return type */
@@ -606,12 +765,12 @@ declare const useOrientation: () => UseOrientationReturn;
606
765
  * @name usePageLeave
607
766
  * @description - Hook what calls given function when mouse leaves the page
608
767
  *
609
- * @param {() => void} onPageLeave The callback function what calls then mouse leaves the page
768
+ * @param {() => void} callback The callback function what calls then mouse leaves the page
610
769
  *
611
770
  * @example
612
771
  * usePageLeave(() => console.log('on leave'))
613
772
  */
614
- declare const usePageLeave: (onPageLeave: () => void) => void;
773
+ declare const usePageLeave: (callback: () => void) => void;
615
774
 
616
775
  /**
617
776
  * @name usePreferredLanguages
@@ -780,19 +939,42 @@ interface UseStepReturn {
780
939
  * @param {number} max Maximum number of steps
781
940
  * @returns {UseStepReturn} An object contains variables and functions to change the step
782
941
  *
942
+ * @example
943
+ * const stepper = useStep(5);
944
+ *
783
945
  * @overload
784
946
  * @param {number} params.max Maximum number of steps
785
947
  * @param {number} params.initial Initial value for step
786
948
  * @returns {UseStepReturn} An object contains variables and functions to change the step
787
949
  *
788
950
  * @example
789
- * const step = useStep(5);
790
- *
791
- * @example
792
951
  * const stepper = useStep({ initial: 2, max: 5 });
793
952
  */
794
953
  declare const useStep: (params: number | UseStepParams) => UseStepReturn;
795
954
 
955
+ declare const getRangesSelection: (selection: Selection) => Range[];
956
+ /** The use text selection return type */
957
+ interface UseTextSelectionReturn {
958
+ /** The current selection text */
959
+ text: string;
960
+ /** The current selection ranges */
961
+ ranges: Range[];
962
+ /** The current selection rects */
963
+ rects: DOMRect[];
964
+ /** The current selection */
965
+ selection: Selection | null;
966
+ }
967
+ /**
968
+ * @name useTextSelection
969
+ * @description - Hook that manages the text selection
970
+ *
971
+ * @returns {UseTextSelectionReturn} An object containing the current text selection
972
+ *
973
+ * @example
974
+ * const selection = useTextSelection();
975
+ */
976
+ declare const useTextSelection: () => UseTextSelectionReturn;
977
+
796
978
  /** The use timeout return type */
797
979
  interface UseTimeoutReturn {
798
980
  /** Timeout is ready state value */
@@ -887,4 +1069,4 @@ declare const useWindowSize: (params?: UseWindowSizeParams) => {
887
1069
  height: number;
888
1070
  };
889
1071
 
890
- export { type ConnectionEffectiveType, type ConnectionType, type OperatingSystem, SCRIPT_STATUS_ATTRIBUTE_NAME, type UseClickOutside, type UseClickOutsideReturn, type UseCounter, type UseCounterOptions, type UseCounterParams, type UseCounterReturn, type UseDocumentTitleOptions, type UseDocumentTitleReturn, type UseEventListener, type UseEventListenerOptions, type UseEventListenerReturn, type UseEventListenerTarget, type UseFaviconReturn, type UseHover, type UseHoverOptions, type UseHoverReturn, type UseHoverTarget, type UseIdleReturn, type UseIntersectionObserver, type UseIntersectionObserverOptions, type UseIntersectionObserverReturn, type UseIntersectionObserverTarget, type UseKeyPressEvent, type UseKeyPressEventKey, type UseKeyPressKey, type UseKeyPressOptions, type UseNetworkReturn, type UseOrientationReturn, type UseQueueReturn, type UseScriptOptions, type UseScriptStatus, type UseStorageInitialValue, type UseStorageOptions, type UseStorageReturn, type UseToggleReturn, type UseWindowSizeReturn, dispatchStorageEvent, getConnection, getOperatingSystem, isHotkeyMatch, legacyCopyToClipboard, useBattery, useBoolean, useClickOutside, useCopyToClipboard, useCounter, useDebouncedValue, useDefault, useDidUpdate, useDocumentTitle, useDocumentVisibility, useEvent, useEventListener, useFavicon, useHash, useHotkeys, useHover, useIdle, useIntersectionObserver, useIsFirstRender, useIsomorphicLayoutEffect, useKeyPress, useKeyPressEvent, useKeysPressed, useLocalStorage, useLogger, useMediaQuery, useMount, useNetwork, useOnline, useOperatingSystem, useOrientation, usePageLeave, usePreferredLanguages, usePrevious, useQueue, useRenderCount, useRerender, useScript, useSessionStorage, useSet, useStep, useStorage, useTimeout, useToggle, useUnmount, useWindowEvent, useWindowSize };
1072
+ export { type ConnectionEffectiveType, type ConnectionType, type OperatingSystem, SCRIPT_STATUS_ATTRIBUTE_NAME, type UseClickOutside, type UseClickOutsideReturn, type UseCounter, type UseCounterOptions, type UseCounterParams, type UseCounterReturn, type UseDocumentTitleOptions, type UseDocumentTitleReturn, type UseEventListener, type UseEventListenerOptions, type UseEventListenerReturn, type UseEventListenerTarget, type UseFaviconReturn, type UseFullScreen, type UseFullScreenOptions, type UseFullScreenReturn, type UseHotkeysHotkeys, type UseHotkeysKey, type UseHotkeysOptions, type UseHover, type UseHoverOptions, type UseHoverReturn, type UseHoverTarget, type UseIdleReturn, type UseIntersectionObserver, type UseIntersectionObserverOptions, type UseIntersectionObserverReturn, type UseIntersectionObserverTarget, type UseKeyPressEvent, type UseKeyPressEventKey, type UseKeyPressKey, type UseKeyPressOptions, type UseListReturn, type UseMouse, type UseMouseReturn, type UseNetworkReturn, type UseOrientationReturn, type UseQueueReturn, type UseScriptOptions, type UseScriptStatus, type UseStorageInitialValue, type UseStorageOptions, type UseStorageReturn, type UseTextSelectionReturn, type UseToggleReturn, type UseWindowSizeReturn, dispatchStorageEvent, getConnection, getOperatingSystem, getRangesSelection, isHotkeyMatch, legacyCopyToClipboard, useBattery, useBoolean, useClickOutside, useCopyToClipboard, useCounter, useDebouncedValue, useDefault, useDidUpdate, useDocumentTitle, useDocumentVisibility, useEvent, useEventListener, useFavicon, useFullscreen, useHash, useHotkeys, useHover, useIdle, useIntersectionObserver, useIsFirstRender, useIsomorphicLayoutEffect, useKeyPress, useKeyPressEvent, useKeysPressed, useList, useLocalStorage, useLogger, useMediaQuery, useMount, useMouse, useNetwork, useOnline, useOperatingSystem, useOrientation, usePageLeave, usePreferredLanguages, usePrevious, useQueue, useRenderCount, useRerender, useScript, useSessionStorage, useSet, useStep, useStorage, useTextSelection, useTimeout, useToggle, useUnmount, useWindowEvent, useWindowSize };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siberiacancode/reactuse",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "Ultimate tool",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -51,6 +51,9 @@
51
51
  "eslint --no-error-on-unmatched-pattern --fix"
52
52
  ]
53
53
  },
54
+ "dependencies": {
55
+ "screenfull": "^6.0.2"
56
+ },
54
57
  "peerDependencies": {
55
58
  "@types/react": "^18.0.0",
56
59
  "react": "^17.0.2 || ^18.0.0"
@@ -1 +0,0 @@
1
- {"version":3,"file":"_rollupPluginBabelHelpers-CAYbWukg.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,3 +0,0 @@
1
- /* @license @siberiacancode/reactuse v0.0.16 */
2
- "use strict";exports.isShallowEqual=function(e,r){var t=Object.keys(e),n=Object.keys(r);if(t.length!==n.length)return!1;for(var l=0,s=t;l<s.length;l++){var u=s[l];if(e[u]!==r[u])return!1}return!0};
3
- //# sourceMappingURL=isShallowEqual.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isShallowEqual.js","sources":["../../../../src/utils/helpers/isShallowEqual.ts"],"sourcesContent":["export const isShallowEqual = <Obj extends Record<string, unknown>>(object1: Obj, object2: Obj) => {\n const keys1 = Object.keys(object1);\n const keys2 = Object.keys(object2);\n\n if (keys1.length !== keys2.length) {\n return false;\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (const key of keys1) {\n if (object1[key] !== object2[key]) {\n return false;\n }\n }\n\n return true;\n};\n"],"names":["object1","object2","keys1","Object","keys","keys2","length","_i","_keys","key"],"mappings":";oCAA8B,SAAsCA,EAAcC,GAChF,IAAMC,EAAQC,OAAOC,KAAKJ,GACpBK,EAAQF,OAAOC,KAAKH,GAE1B,GAAIC,EAAMI,SAAWD,EAAMC,OACzB,OAAO,EAIT,IAAA,IAAAC,EAAA,EAAAC,EAAkBN,EAAKK,EAAAC,EAAAF,OAAAC,IAAE,CAApB,IAAME,EAAGD,EAAAD,GACZ,GAAIP,EAAQS,KAASR,EAAQQ,GAC3B,OAAO,CAEX,CAEA,OAAO,CACT"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"_rollupPluginBabelHelpers-CQgz65cb.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,3 +0,0 @@
1
- /* @license @siberiacancode/reactuse v0.0.16 */
2
- var r=function(r,e){var t=Object.keys(r),n=Object.keys(e);if(t.length!==n.length)return!1;for(var a=0,f=t;a<f.length;a++){var u=f[a];if(r[u]!==e[u])return!1}return!0};export{r as isShallowEqual};
3
- //# sourceMappingURL=isShallowEqual.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isShallowEqual.js","sources":["../../../../src/utils/helpers/isShallowEqual.ts"],"sourcesContent":["export const isShallowEqual = <Obj extends Record<string, unknown>>(object1: Obj, object2: Obj) => {\n const keys1 = Object.keys(object1);\n const keys2 = Object.keys(object2);\n\n if (keys1.length !== keys2.length) {\n return false;\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (const key of keys1) {\n if (object1[key] !== object2[key]) {\n return false;\n }\n }\n\n return true;\n};\n"],"names":["isShallowEqual","object1","object2","keys1","Object","keys","keys2","length","_i","_keys","key"],"mappings":";AAAO,IAAMA,EAAiB,SAAsCC,EAAcC,GAChF,IAAMC,EAAQC,OAAOC,KAAKJ,GACpBK,EAAQF,OAAOC,KAAKH,GAE1B,GAAIC,EAAMI,SAAWD,EAAMC,OACzB,OAAO,EAIT,IAAA,IAAAC,EAAA,EAAAC,EAAkBN,EAAKK,EAAAC,EAAAF,OAAAC,IAAE,CAApB,IAAME,EAAGD,EAAAD,GACZ,GAAIP,EAAQS,KAASR,EAAQQ,GAC3B,OAAO,CAEX,CAEA,OAAO,CACT"}