@stryke/hooks 0.4.35 → 0.4.36

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 (283) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/_virtual/rolldown_runtime.cjs +1 -0
  3. package/dist/env/src/runtime-checks.cjs +1 -0
  4. package/dist/env/src/runtime-checks.mjs +2 -0
  5. package/dist/env/src/runtime-checks.mjs.map +1 -0
  6. package/dist/helpers/src/debounce.cjs +1 -0
  7. package/dist/helpers/src/debounce.d.cts +7 -0
  8. package/dist/helpers/src/debounce.d.cts.map +1 -0
  9. package/dist/helpers/src/debounce.d.mts +7 -0
  10. package/dist/helpers/src/debounce.d.mts.map +1 -0
  11. package/dist/helpers/src/debounce.mjs +2 -0
  12. package/dist/helpers/src/debounce.mjs.map +1 -0
  13. package/dist/helpers/src/throttle.cjs +1 -0
  14. package/dist/helpers/src/throttle.mjs +2 -0
  15. package/dist/helpers/src/throttle.mjs.map +1 -0
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.d.cts +17 -17
  18. package/dist/index.d.mts +17 -17
  19. package/dist/index.mjs +1 -1
  20. package/dist/type-checks/src/get-object-tag.cjs +1 -0
  21. package/dist/type-checks/src/get-object-tag.mjs +2 -0
  22. package/dist/type-checks/src/get-object-tag.mjs.map +1 -0
  23. package/dist/type-checks/src/is-equal.cjs +1 -0
  24. package/dist/type-checks/src/is-equal.mjs +2 -0
  25. package/dist/type-checks/src/is-equal.mjs.map +1 -0
  26. package/dist/type-checks/src/is-function.cjs +1 -0
  27. package/dist/type-checks/src/is-function.mjs +2 -0
  28. package/dist/type-checks/src/is-function.mjs.map +1 -0
  29. package/dist/types/src/base.cjs +1 -0
  30. package/dist/types/src/base.d.cts +35 -0
  31. package/dist/types/src/base.d.cts.map +1 -0
  32. package/dist/types/src/base.d.mts +35 -0
  33. package/dist/types/src/base.d.mts.map +1 -0
  34. package/dist/types/src/base.mjs +2 -0
  35. package/dist/types/src/base.mjs.map +1 -0
  36. package/dist/{navigator-DUOlrD-4.d.mts → types/src/navigator.d.cts} +2 -2
  37. package/dist/types/src/navigator.d.cts.map +1 -0
  38. package/dist/{navigator-CY6InfsZ.d.cts → types/src/navigator.d.mts} +2 -2
  39. package/dist/types/src/navigator.d.mts.map +1 -0
  40. package/dist/use-battery.cjs +1 -1
  41. package/dist/use-battery.d.cts +11 -2
  42. package/dist/use-battery.d.cts.map +1 -0
  43. package/dist/use-battery.d.mts +11 -2
  44. package/dist/use-battery.d.mts.map +1 -0
  45. package/dist/use-battery.mjs +2 -1
  46. package/dist/use-battery.mjs.map +1 -0
  47. package/dist/use-callback-ref.cjs +1 -1
  48. package/dist/use-callback-ref.d.cts +9 -2
  49. package/dist/use-callback-ref.d.cts.map +1 -0
  50. package/dist/use-callback-ref.d.mts +9 -2
  51. package/dist/use-callback-ref.d.mts.map +1 -0
  52. package/dist/use-callback-ref.mjs +2 -1
  53. package/dist/use-callback-ref.mjs.map +1 -0
  54. package/dist/use-callback-stable.cjs +1 -1
  55. package/dist/use-callback-stable.d.cts +25 -2
  56. package/dist/use-callback-stable.d.cts.map +1 -0
  57. package/dist/use-callback-stable.d.mts +25 -2
  58. package/dist/use-callback-stable.d.mts.map +1 -0
  59. package/dist/use-callback-stable.mjs +2 -1
  60. package/dist/use-callback-stable.mjs.map +1 -0
  61. package/dist/use-click-away.cjs +1 -1
  62. package/dist/use-click-away.d.cts +14 -2
  63. package/dist/use-click-away.d.cts.map +1 -0
  64. package/dist/use-click-away.d.mts +14 -2
  65. package/dist/use-click-away.d.mts.map +1 -0
  66. package/dist/use-click-away.mjs +2 -1
  67. package/dist/use-click-away.mjs.map +1 -0
  68. package/dist/use-compose-refs.cjs +1 -1
  69. package/dist/use-compose-refs.d.cts +31 -2
  70. package/dist/use-compose-refs.d.cts.map +1 -0
  71. package/dist/use-compose-refs.d.mts +31 -2
  72. package/dist/use-compose-refs.d.mts.map +1 -0
  73. package/dist/use-compose-refs.mjs +2 -1
  74. package/dist/use-compose-refs.mjs.map +1 -0
  75. package/dist/use-copy-to-clipboard.cjs +1 -1
  76. package/dist/use-copy-to-clipboard.d.cts +10 -2
  77. package/dist/use-copy-to-clipboard.d.cts.map +1 -0
  78. package/dist/use-copy-to-clipboard.d.mts +10 -2
  79. package/dist/use-copy-to-clipboard.d.mts.map +1 -0
  80. package/dist/use-copy-to-clipboard.mjs +2 -1
  81. package/dist/use-copy-to-clipboard.mjs.map +1 -0
  82. package/dist/use-debounce.cjs +1 -1
  83. package/dist/use-debounce.d.cts +14 -2
  84. package/dist/use-debounce.d.cts.map +1 -0
  85. package/dist/use-debounce.d.mts +14 -2
  86. package/dist/use-debounce.d.mts.map +1 -0
  87. package/dist/use-debounce.mjs +2 -1
  88. package/dist/use-debounce.mjs.map +1 -0
  89. package/dist/use-did-finish-ssr.cjs +1 -1
  90. package/dist/use-did-finish-ssr.d.cts +10 -2
  91. package/dist/use-did-finish-ssr.d.cts.map +1 -0
  92. package/dist/use-did-finish-ssr.d.mts +10 -2
  93. package/dist/use-did-finish-ssr.d.mts.map +1 -0
  94. package/dist/use-did-finish-ssr.mjs +2 -1
  95. package/dist/use-did-finish-ssr.mjs.map +1 -0
  96. package/dist/use-escape-keydown.cjs +1 -1
  97. package/dist/use-escape-keydown.d.cts +8 -2
  98. package/dist/use-escape-keydown.d.cts.map +1 -0
  99. package/dist/use-escape-keydown.d.mts +8 -2
  100. package/dist/use-escape-keydown.d.mts.map +1 -0
  101. package/dist/use-escape-keydown.mjs +2 -1
  102. package/dist/use-escape-keydown.mjs.map +1 -0
  103. package/dist/use-event.cjs +1 -1
  104. package/dist/use-event.d.cts +12 -2
  105. package/dist/use-event.d.cts.map +1 -0
  106. package/dist/use-event.d.mts +12 -2
  107. package/dist/use-event.d.mts.map +1 -0
  108. package/dist/use-event.mjs +2 -1
  109. package/dist/use-event.mjs.map +1 -0
  110. package/dist/use-hover.cjs +1 -1
  111. package/dist/use-hover.d.cts +10 -2
  112. package/dist/use-hover.d.cts.map +1 -0
  113. package/dist/use-hover.d.mts +10 -2
  114. package/dist/use-hover.d.mts.map +1 -0
  115. package/dist/use-hover.mjs +2 -1
  116. package/dist/use-hover.mjs.map +1 -0
  117. package/dist/use-idle.cjs +1 -1
  118. package/dist/use-idle.d.cts +11 -2
  119. package/dist/use-idle.d.cts.map +1 -0
  120. package/dist/use-idle.d.mts +11 -2
  121. package/dist/use-idle.d.mts.map +1 -0
  122. package/dist/use-idle.mjs +2 -1
  123. package/dist/use-idle.mjs.map +1 -0
  124. package/dist/use-isomorphic-layout-effect.cjs +1 -1
  125. package/dist/use-isomorphic-layout-effect.d.cts +13 -2
  126. package/dist/use-isomorphic-layout-effect.d.cts.map +1 -0
  127. package/dist/use-isomorphic-layout-effect.d.mts +13 -2
  128. package/dist/use-isomorphic-layout-effect.d.mts.map +1 -0
  129. package/dist/use-isomorphic-layout-effect.mjs +2 -1
  130. package/dist/use-isomorphic-layout-effect.mjs.map +1 -0
  131. package/dist/use-keyboard-visible.cjs +1 -1
  132. package/dist/use-keyboard-visible.d.cts +5 -2
  133. package/dist/use-keyboard-visible.d.cts.map +1 -0
  134. package/dist/use-keyboard-visible.d.mts +5 -2
  135. package/dist/use-keyboard-visible.d.mts.map +1 -0
  136. package/dist/use-keyboard-visible.mjs +2 -1
  137. package/dist/use-keyboard-visible.mjs.map +1 -0
  138. package/dist/use-memo-stable.cjs +1 -1
  139. package/dist/use-memo-stable.d.cts +19 -2
  140. package/dist/use-memo-stable.d.cts.map +1 -0
  141. package/dist/use-memo-stable.d.mts +19 -2
  142. package/dist/use-memo-stable.d.mts.map +1 -0
  143. package/dist/use-memo-stable.mjs +2 -1
  144. package/dist/use-memo-stable.mjs.map +1 -0
  145. package/dist/use-network-state.cjs +1 -1
  146. package/dist/use-network-state.d.cts +20 -2
  147. package/dist/use-network-state.d.cts.map +1 -0
  148. package/dist/use-network-state.d.mts +20 -2
  149. package/dist/use-network-state.d.mts.map +1 -0
  150. package/dist/use-network-state.mjs +2 -1
  151. package/dist/use-network-state.mjs.map +1 -0
  152. package/dist/use-previous.cjs +1 -1
  153. package/dist/use-previous.d.cts +5 -2
  154. package/dist/use-previous.d.cts.map +1 -0
  155. package/dist/use-previous.d.mts +5 -2
  156. package/dist/use-previous.d.mts.map +1 -0
  157. package/dist/use-previous.mjs +2 -1
  158. package/dist/use-previous.mjs.map +1 -0
  159. package/package.json +7 -7
  160. package/dist/is-function-BhD7GXOO.cjs +0 -1
  161. package/dist/is-function-md4Ym3I0.mjs +0 -2
  162. package/dist/is-function-md4Ym3I0.mjs.map +0 -1
  163. package/dist/navigator-CY6InfsZ.d.cts.map +0 -1
  164. package/dist/navigator-DUOlrD-4.d.mts.map +0 -1
  165. package/dist/use-battery-BkRIfbJz.d.mts +0 -11
  166. package/dist/use-battery-BkRIfbJz.d.mts.map +0 -1
  167. package/dist/use-battery-DZZDx003.cjs +0 -1
  168. package/dist/use-battery-DaA7I4_x.mjs +0 -2
  169. package/dist/use-battery-DaA7I4_x.mjs.map +0 -1
  170. package/dist/use-battery-DpuF7GMz.d.cts +0 -11
  171. package/dist/use-battery-DpuF7GMz.d.cts.map +0 -1
  172. package/dist/use-callback-ref-B-95d49K.d.mts +0 -9
  173. package/dist/use-callback-ref-B-95d49K.d.mts.map +0 -1
  174. package/dist/use-callback-ref-CloM-Kqk.cjs +0 -1
  175. package/dist/use-callback-ref-ctiFnQn4.d.cts +0 -9
  176. package/dist/use-callback-ref-ctiFnQn4.d.cts.map +0 -1
  177. package/dist/use-callback-ref-otlhGzUu.mjs +0 -2
  178. package/dist/use-callback-ref-otlhGzUu.mjs.map +0 -1
  179. package/dist/use-callback-stable-C3QZzhdC.mjs +0 -2
  180. package/dist/use-callback-stable-C3QZzhdC.mjs.map +0 -1
  181. package/dist/use-callback-stable-C5X8ySnU.d.mts +0 -55
  182. package/dist/use-callback-stable-C5X8ySnU.d.mts.map +0 -1
  183. package/dist/use-callback-stable-CvXmYtWT.cjs +0 -1
  184. package/dist/use-callback-stable-D_wCU4yv.d.cts +0 -55
  185. package/dist/use-callback-stable-D_wCU4yv.d.cts.map +0 -1
  186. package/dist/use-click-away-Bpl7sh5j.cjs +0 -1
  187. package/dist/use-click-away-D-DKaD9B.mjs +0 -2
  188. package/dist/use-click-away-D-DKaD9B.mjs.map +0 -1
  189. package/dist/use-click-away-DG8ULjSN.d.cts +0 -14
  190. package/dist/use-click-away-DG8ULjSN.d.cts.map +0 -1
  191. package/dist/use-click-away-kc61inYs.d.mts +0 -14
  192. package/dist/use-click-away-kc61inYs.d.mts.map +0 -1
  193. package/dist/use-compose-refs-BUwJN8zY.cjs +0 -1
  194. package/dist/use-compose-refs-BysZtFy1.mjs +0 -2
  195. package/dist/use-compose-refs-BysZtFy1.mjs.map +0 -1
  196. package/dist/use-compose-refs-D1nHM35F.d.cts +0 -31
  197. package/dist/use-compose-refs-D1nHM35F.d.cts.map +0 -1
  198. package/dist/use-compose-refs-Dy3epP6l.d.mts +0 -31
  199. package/dist/use-compose-refs-Dy3epP6l.d.mts.map +0 -1
  200. package/dist/use-copy-to-clipboard-Cls03hBs.mjs +0 -2
  201. package/dist/use-copy-to-clipboard-Cls03hBs.mjs.map +0 -1
  202. package/dist/use-copy-to-clipboard-D3QmuRQ2.d.mts +0 -10
  203. package/dist/use-copy-to-clipboard-D3QmuRQ2.d.mts.map +0 -1
  204. package/dist/use-copy-to-clipboard-DFTtZkv7.cjs +0 -1
  205. package/dist/use-copy-to-clipboard-DzccpceW.d.cts +0 -10
  206. package/dist/use-copy-to-clipboard-DzccpceW.d.cts.map +0 -1
  207. package/dist/use-debounce-B07BBb1-.d.mts +0 -17
  208. package/dist/use-debounce-B07BBb1-.d.mts.map +0 -1
  209. package/dist/use-debounce-Bh6vyN-1.d.cts +0 -17
  210. package/dist/use-debounce-Bh6vyN-1.d.cts.map +0 -1
  211. package/dist/use-debounce-Cto2Ny5z.mjs +0 -2
  212. package/dist/use-debounce-Cto2Ny5z.mjs.map +0 -1
  213. package/dist/use-debounce-DWeScEkQ.cjs +0 -1
  214. package/dist/use-did-finish-ssr-B6M_wlP4.mjs +0 -2
  215. package/dist/use-did-finish-ssr-B6M_wlP4.mjs.map +0 -1
  216. package/dist/use-did-finish-ssr-BbXffDj5.cjs +0 -1
  217. package/dist/use-did-finish-ssr-CBz5xeHc.d.mts +0 -10
  218. package/dist/use-did-finish-ssr-CBz5xeHc.d.mts.map +0 -1
  219. package/dist/use-did-finish-ssr-D3CpAwOz.d.cts +0 -10
  220. package/dist/use-did-finish-ssr-D3CpAwOz.d.cts.map +0 -1
  221. package/dist/use-escape-keydown-BsJYLp1N.d.cts +0 -8
  222. package/dist/use-escape-keydown-BsJYLp1N.d.cts.map +0 -1
  223. package/dist/use-escape-keydown-CFy25Wk6.mjs +0 -2
  224. package/dist/use-escape-keydown-CFy25Wk6.mjs.map +0 -1
  225. package/dist/use-escape-keydown-DgPvPpzz.d.mts +0 -8
  226. package/dist/use-escape-keydown-DgPvPpzz.d.mts.map +0 -1
  227. package/dist/use-escape-keydown-ITaT9SqI.cjs +0 -1
  228. package/dist/use-event-CBTGhPhg.mjs +0 -2
  229. package/dist/use-event-CBTGhPhg.mjs.map +0 -1
  230. package/dist/use-event-DG39UVbo.cjs +0 -1
  231. package/dist/use-event-DHFCg8sl.d.cts +0 -12
  232. package/dist/use-event-DHFCg8sl.d.cts.map +0 -1
  233. package/dist/use-event-DQyUWk4T.d.mts +0 -12
  234. package/dist/use-event-DQyUWk4T.d.mts.map +0 -1
  235. package/dist/use-hover-CPJ3UcMM.d.mts +0 -10
  236. package/dist/use-hover-CPJ3UcMM.d.mts.map +0 -1
  237. package/dist/use-hover-DCP1g7QG.mjs +0 -2
  238. package/dist/use-hover-DCP1g7QG.mjs.map +0 -1
  239. package/dist/use-hover-DeFTY9RX.d.cts +0 -10
  240. package/dist/use-hover-DeFTY9RX.d.cts.map +0 -1
  241. package/dist/use-hover-SNRrnUoI.cjs +0 -1
  242. package/dist/use-idle-Car_0ThE.d.cts +0 -11
  243. package/dist/use-idle-Car_0ThE.d.cts.map +0 -1
  244. package/dist/use-idle-CrCoMyLz.cjs +0 -1
  245. package/dist/use-idle-DrgoS1jh.mjs +0 -2
  246. package/dist/use-idle-DrgoS1jh.mjs.map +0 -1
  247. package/dist/use-idle-DwhHMDDp.d.mts +0 -11
  248. package/dist/use-idle-DwhHMDDp.d.mts.map +0 -1
  249. package/dist/use-isomorphic-layout-effect-Br2hUBEM.cjs +0 -1
  250. package/dist/use-isomorphic-layout-effect-CwRlvm9E.d.cts +0 -13
  251. package/dist/use-isomorphic-layout-effect-CwRlvm9E.d.cts.map +0 -1
  252. package/dist/use-isomorphic-layout-effect-D7uazny2.mjs +0 -2
  253. package/dist/use-isomorphic-layout-effect-D7uazny2.mjs.map +0 -1
  254. package/dist/use-isomorphic-layout-effect-IWX2e-IS.d.mts +0 -13
  255. package/dist/use-isomorphic-layout-effect-IWX2e-IS.d.mts.map +0 -1
  256. package/dist/use-keyboard-visible-83MQ2ogF.mjs +0 -2
  257. package/dist/use-keyboard-visible-83MQ2ogF.mjs.map +0 -1
  258. package/dist/use-keyboard-visible-BHYBoMGb.cjs +0 -1
  259. package/dist/use-keyboard-visible-BPIMSGQ1.d.cts +0 -5
  260. package/dist/use-keyboard-visible-BPIMSGQ1.d.cts.map +0 -1
  261. package/dist/use-keyboard-visible-iH9veUTt.d.mts +0 -5
  262. package/dist/use-keyboard-visible-iH9veUTt.d.mts.map +0 -1
  263. package/dist/use-memo-stable-Aqx3eZTS.d.mts +0 -19
  264. package/dist/use-memo-stable-Aqx3eZTS.d.mts.map +0 -1
  265. package/dist/use-memo-stable-DKI3Fj07.mjs +0 -2
  266. package/dist/use-memo-stable-DKI3Fj07.mjs.map +0 -1
  267. package/dist/use-memo-stable-DKW_L41q.cjs +0 -1
  268. package/dist/use-memo-stable-i9UN2iWi.d.cts +0 -19
  269. package/dist/use-memo-stable-i9UN2iWi.d.cts.map +0 -1
  270. package/dist/use-network-state-Bce55hBv.cjs +0 -1
  271. package/dist/use-network-state-CtGu_gfo.mjs +0 -2
  272. package/dist/use-network-state-CtGu_gfo.mjs.map +0 -1
  273. package/dist/use-network-state-DPhNT5_N.d.mts +0 -20
  274. package/dist/use-network-state-DPhNT5_N.d.mts.map +0 -1
  275. package/dist/use-network-state-DQegmILl.d.cts +0 -20
  276. package/dist/use-network-state-DQegmILl.d.cts.map +0 -1
  277. package/dist/use-previous-BNZSuZUn.cjs +0 -1
  278. package/dist/use-previous-BvOs-yn-.d.cts +0 -5
  279. package/dist/use-previous-BvOs-yn-.d.cts.map +0 -1
  280. package/dist/use-previous-ChmuSO8b.d.mts +0 -5
  281. package/dist/use-previous-ChmuSO8b.d.mts.map +0 -1
  282. package/dist/use-previous-vtWmTmEN.mjs +0 -2
  283. package/dist/use-previous-vtWmTmEN.mjs.map +0 -1
@@ -1,2 +1,13 @@
1
- import { t as useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect-CwRlvm9E.cjs";
2
- export { useIsomorphicLayoutEffect };
1
+ import { useEffect } from "react";
2
+
3
+ //#region src/use-isomorphic-layout-effect.d.ts
4
+
5
+ /**
6
+ * The function checks if the code is running on the server-side
7
+ *
8
+ * @returns An indicator specifying if the code is running on the server-side
9
+ */
10
+ declare const useIsomorphicLayoutEffect: typeof useEffect;
11
+ //#endregion
12
+ export { useIsomorphicLayoutEffect };
13
+ //# sourceMappingURL=use-isomorphic-layout-effect.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-isomorphic-layout-effect.d.cts","names":[],"sources":["../src/use-isomorphic-layout-effect.ts"],"sourcesContent":[],"mappings":";;;;;;AA0BA;;;cAAa,kCAAyB"}
@@ -1,2 +1,13 @@
1
- import { t as useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect-IWX2e-IS.mjs";
2
- export { useIsomorphicLayoutEffect };
1
+ import { useEffect } from "react";
2
+
3
+ //#region src/use-isomorphic-layout-effect.d.ts
4
+
5
+ /**
6
+ * The function checks if the code is running on the server-side
7
+ *
8
+ * @returns An indicator specifying if the code is running on the server-side
9
+ */
10
+ declare const useIsomorphicLayoutEffect: typeof useEffect;
11
+ //#endregion
12
+ export { useIsomorphicLayoutEffect };
13
+ //# sourceMappingURL=use-isomorphic-layout-effect.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-isomorphic-layout-effect.d.mts","names":[],"sources":["../src/use-isomorphic-layout-effect.ts"],"sourcesContent":[],"mappings":";;;;;;AA0BA;;;cAAa,kCAAyB"}
@@ -1 +1,2 @@
1
- import{t as e}from"./use-isomorphic-layout-effect-D7uazny2.mjs";export{e as useIsomorphicLayoutEffect};
1
+ import{isRuntimeServer as e}from"./env/src/runtime-checks.mjs";import{useEffect as t,useLayoutEffect as n}from"react";const r=e?t:n;export{r as useIsomorphicLayoutEffect};
2
+ //# sourceMappingURL=use-isomorphic-layout-effect.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-isomorphic-layout-effect.mjs","names":[],"sources":["../src/use-isomorphic-layout-effect.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isRuntimeServer } from \"@stryke/env/runtime-checks\";\nimport { useEffect, useLayoutEffect } from \"react\";\n\n/**\n * The function checks if the code is running on the server-side\n *\n * @returns An indicator specifying if the code is running on the server-side\n */\nexport const useIsomorphicLayoutEffect = isRuntimeServer\n ? useEffect\n : useLayoutEffect;\n"],"mappings":"sHA0BA,MAAa,EAA4B,EACrC,EACA"}
@@ -1 +1 @@
1
- const e=require(`./use-keyboard-visible-BHYBoMGb.cjs`);exports.useKeyboardVisible=e.t;
1
+ const e=require(`./_virtual/rolldown_runtime.cjs`);let t=require(`react`),n=require(`react-native`);const r=()=>{let[e,r]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{let e=n.Keyboard.addListener(`keyboardDidShow`,()=>{r(!0)}),t=n.Keyboard.addListener(`keyboardDidHide`,()=>{r(!1)});return()=>{t.remove(),e.remove()}},[]),e};exports.useKeyboardVisible=r;
@@ -1,2 +1,5 @@
1
- import { t as useKeyboardVisible } from "./use-keyboard-visible-BPIMSGQ1.cjs";
2
- export { useKeyboardVisible };
1
+ //#region src/use-keyboard-visible.d.ts
2
+ declare const useKeyboardVisible: () => boolean;
3
+ //#endregion
4
+ export { useKeyboardVisible };
5
+ //# sourceMappingURL=use-keyboard-visible.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-keyboard-visible.d.cts","names":[],"sources":["../src/use-keyboard-visible.ts"],"sourcesContent":[],"mappings":";cAqBa"}
@@ -1,2 +1,5 @@
1
- import { t as useKeyboardVisible } from "./use-keyboard-visible-iH9veUTt.mjs";
2
- export { useKeyboardVisible };
1
+ //#region src/use-keyboard-visible.d.ts
2
+ declare const useKeyboardVisible: () => boolean;
3
+ //#endregion
4
+ export { useKeyboardVisible };
5
+ //# sourceMappingURL=use-keyboard-visible.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-keyboard-visible.d.mts","names":[],"sources":["../src/use-keyboard-visible.ts"],"sourcesContent":[],"mappings":";cAqBa"}
@@ -1 +1,2 @@
1
- import{t as e}from"./use-keyboard-visible-83MQ2ogF.mjs";export{e as useKeyboardVisible};
1
+ import{useEffect as e,useState as t}from"react";import{Keyboard as n}from"react-native";const r=()=>{let[r,i]=t(!1);return e(()=>{let e=n.addListener(`keyboardDidShow`,()=>{i(!0)}),t=n.addListener(`keyboardDidHide`,()=>{i(!1)});return()=>{t.remove(),e.remove()}},[]),r};export{r as useKeyboardVisible};
2
+ //# sourceMappingURL=use-keyboard-visible.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-keyboard-visible.mjs","names":[],"sources":["../src/use-keyboard-visible.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { useEffect, useState } from \"react\";\nimport { Keyboard } from \"react-native\";\n\nexport const useKeyboardVisible = () => {\n const [isKeyboardVisible, setKeyboardVisible] = useState(false);\n\n useEffect(() => {\n const keyboardDidShowListener = Keyboard.addListener(\n \"keyboardDidShow\",\n () => {\n setKeyboardVisible(true);\n }\n );\n const keyboardDidHideListener = Keyboard.addListener(\n \"keyboardDidHide\",\n () => {\n setKeyboardVisible(false);\n }\n );\n\n return () => {\n keyboardDidHideListener.remove();\n keyboardDidShowListener.remove();\n };\n }, []);\n\n return isKeyboardVisible;\n};\n"],"mappings":"wFAqBA,MAAa,MAA2B,CACtC,GAAM,CAAC,EAAmB,GAAsB,EAAS,GAAM,CAsB/D,OApBA,MAAgB,CACd,IAAM,EAA0B,EAAS,YACvC,sBACM,CACJ,EAAmB,GAAK,EAE3B,CACK,EAA0B,EAAS,YACvC,sBACM,CACJ,EAAmB,GAAM,EAE5B,CAED,UAAa,CACX,EAAwB,QAAQ,CAChC,EAAwB,QAAQ,GAEjC,EAAE,CAAC,CAEC"}
@@ -1 +1 @@
1
- const e=require(`./use-memo-stable-DKW_L41q.cjs`);exports.useMemoStable=e.t;
1
+ const e=require(`./_virtual/rolldown_runtime.cjs`);let t=require(`react`);const n=(e,t)=>{if(e.length!==t.length)return!1;for(let[n,r]of e.entries())if(r!==t[n])return!1;return!0};function r(e,r){let i=(0,t.useState)(()=>({inputs:r,result:e()}))[0],a=(0,t.useRef)(!0),o=(0,t.useRef)(i),s=a.current||!!(r&&o.current.inputs&&n(r,o.current.inputs)),c=(0,t.useMemo)(()=>s?o.current:{inputs:r,result:e()},[r,e,s]);return(0,t.useEffect)(()=>{a.current=!1,o.current=c},[c]),c.result}exports.useMemoStable=r;
@@ -1,2 +1,19 @@
1
- import { t as useMemoStable } from "./use-memo-stable-i9UN2iWi.cjs";
2
- export { useMemoStable };
1
+ //#region src/use-memo-stable.d.ts
2
+ /**
3
+ * `useMemo` and `useCallback` cache the most recent result. However, this cache can be destroyed by React when it wants to.
4
+ *
5
+ * `useMemoStable` and `useCallbackStable` are concurrent mode safe alternatives to `useMemo` and `useCallback` that do provide semantic guarantee. What this means is that you will always get the same reference for a memoized value so long as there is no input change.
6
+ *
7
+ * Using `useMemoStable` and `useCallbackStable` will consume more memory than useMemo and `useCallback` in order to provide a stable cache. React can release the cache of `useMemo` and `useCallback`, but `useMemoStable` will not release the cache until it is garbage collected.
8
+ *
9
+ * @remarks
10
+ * You may rely on useMemo as a performance optimization, not as a semantic guarantee. In the future, React may choose to “forget” some previously memoized values and recalculate them on next render, e.g. to free memory for offscreen components. Write your code so that it still works without `useMemo` — and then add it to optimize performance.
11
+ *
12
+ * @param getResult - The function used to generate the result
13
+ * @param inputs - The inputs to watch for changes
14
+ * @returns The memoized result
15
+ */
16
+ declare function useMemoStable<TResult>(getResult: () => TResult, inputs?: any[]): TResult;
17
+ //#endregion
18
+ export { useMemoStable };
19
+ //# sourceMappingURL=use-memo-stable.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-memo-stable.d.cts","names":[],"sources":["../src/use-memo-stable.ts"],"sourcesContent":[],"mappings":";;AAgEA;;;;;;;;;;;;;iBAAgB,wCACG,0BAEhB"}
@@ -1,2 +1,19 @@
1
- import { t as useMemoStable } from "./use-memo-stable-Aqx3eZTS.mjs";
2
- export { useMemoStable };
1
+ //#region src/use-memo-stable.d.ts
2
+ /**
3
+ * `useMemo` and `useCallback` cache the most recent result. However, this cache can be destroyed by React when it wants to.
4
+ *
5
+ * `useMemoStable` and `useCallbackStable` are concurrent mode safe alternatives to `useMemo` and `useCallback` that do provide semantic guarantee. What this means is that you will always get the same reference for a memoized value so long as there is no input change.
6
+ *
7
+ * Using `useMemoStable` and `useCallbackStable` will consume more memory than useMemo and `useCallback` in order to provide a stable cache. React can release the cache of `useMemo` and `useCallback`, but `useMemoStable` will not release the cache until it is garbage collected.
8
+ *
9
+ * @remarks
10
+ * You may rely on useMemo as a performance optimization, not as a semantic guarantee. In the future, React may choose to “forget” some previously memoized values and recalculate them on next render, e.g. to free memory for offscreen components. Write your code so that it still works without `useMemo` — and then add it to optimize performance.
11
+ *
12
+ * @param getResult - The function used to generate the result
13
+ * @param inputs - The inputs to watch for changes
14
+ * @returns The memoized result
15
+ */
16
+ declare function useMemoStable<TResult>(getResult: () => TResult, inputs?: any[]): TResult;
17
+ //#endregion
18
+ export { useMemoStable };
19
+ //# sourceMappingURL=use-memo-stable.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-memo-stable.d.mts","names":[],"sources":["../src/use-memo-stable.ts"],"sourcesContent":[],"mappings":";;AAgEA;;;;;;;;;;;;;iBAAgB,wCACG,0BAEhB"}
@@ -1 +1,2 @@
1
- import{t as e}from"./use-memo-stable-DKI3Fj07.mjs";export{e as useMemoStable};
1
+ import{useEffect as e,useMemo as t,useRef as n,useState as r}from"react";const i=(e,t)=>{if(e.length!==t.length)return!1;for(let[n,r]of e.entries())if(r!==t[n])return!1;return!0};function a(a,o){let s=r(()=>({inputs:o,result:a()}))[0],c=n(!0),l=n(s),u=c.current||!!(o&&l.current.inputs&&i(o,l.current.inputs)),d=t(()=>u?l.current:{inputs:o,result:a()},[o,a,u]);return e(()=>{c.current=!1,l.current=d},[d]),d.result}export{a as useMemoStable};
2
+ //# sourceMappingURL=use-memo-stable.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-memo-stable.mjs","names":["initial: Cache<TResult>","useCache: boolean","cache: Cache<TResult>"],"sources":["../src/use-memo-stable.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { useEffect, useMemo, useRef, useState } from \"react\";\n\n/* eslint-disable @cspell/spellchecker */\n\n/**\n\n * Forked from use-memo-one by Alex Reardon\n */\n\ninterface Cache<TData> {\n inputs?: any[];\n result: TData;\n}\n\nconst areInputsEqual = (newInputs: any[], lastInputs: any[]) => {\n // no checks needed if the inputs length has changed\n if (newInputs.length !== lastInputs.length) {\n return false;\n }\n // Using for loop for speed. It generally performs better than array.every\n // https://github.com/alexreardon/memoize-one/pull/59\n\n for (const [i, newInput] of newInputs.entries()) {\n // using shallow equality check\n if (newInput !== lastInputs[i]) {\n return false;\n }\n }\n\n return true;\n};\n\n/**\n * `useMemo` and `useCallback` cache the most recent result. However, this cache can be destroyed by React when it wants to.\n *\n * `useMemoStable` and `useCallbackStable` are concurrent mode safe alternatives to `useMemo` and `useCallback` that do provide semantic guarantee. What this means is that you will always get the same reference for a memoized value so long as there is no input change.\n *\n * Using `useMemoStable` and `useCallbackStable` will consume more memory than useMemo and `useCallback` in order to provide a stable cache. React can release the cache of `useMemo` and `useCallback`, but `useMemoStable` will not release the cache until it is garbage collected.\n *\n * @remarks\n * You may rely on useMemo as a performance optimization, not as a semantic guarantee. In the future, React may choose to “forget” some previously memoized values and recalculate them on next render, e.g. to free memory for offscreen components. Write your code so that it still works without `useMemo` — and then add it to optimize performance.\n *\n * @param getResult - The function used to generate the result\n * @param inputs - The inputs to watch for changes\n * @returns The memoized result\n */\nexport function useMemoStable<TResult>(\n getResult: () => TResult,\n inputs?: any[]\n): TResult {\n // using useState to generate initial value as it is lazy\n const initial: Cache<TResult> = useState(() => ({\n inputs,\n result: getResult()\n }))[0];\n const isFirstRun = useRef<boolean>(true);\n const committed = useRef<Cache<TResult>>(initial);\n\n // persist any uncommitted changes after they have been committed\n const useCache: boolean =\n isFirstRun.current ||\n Boolean(\n inputs &&\n committed.current.inputs &&\n areInputsEqual(inputs, committed.current.inputs)\n );\n\n // create a new cache if required\n const cache: Cache<TResult> = useMemo(\n () =>\n useCache\n ? committed.current\n : {\n inputs,\n result: getResult()\n },\n [inputs, getResult, useCache]\n );\n\n // commit the cache\n useEffect(() => {\n isFirstRun.current = false;\n committed.current = cache;\n }, [cache]);\n\n return cache.result;\n}\n"],"mappings":"yEAgCA,MAAM,GAAkB,EAAkB,IAAsB,CAE9D,GAAI,EAAU,SAAW,EAAW,OAClC,MAAO,GAKT,IAAK,GAAM,CAAC,EAAG,KAAa,EAAU,SAAS,CAE7C,GAAI,IAAa,EAAW,GAC1B,MAAO,GAIX,MAAO,IAiBT,SAAgB,EACd,EACA,EACS,CAET,IAAMA,EAA0B,OAAgB,CAC9C,SACA,OAAQ,GAAW,CACpB,EAAE,CAAC,GACE,EAAa,EAAgB,GAAK,CAClC,EAAY,EAAuB,EAAQ,CAG3CC,EACJ,EAAW,SACX,GACE,GACA,EAAU,QAAQ,QAClB,EAAe,EAAQ,EAAU,QAAQ,OAAO,EAI9CC,EAAwB,MAE1B,EACI,EAAU,QACV,CACE,SACA,OAAQ,GAAW,CACpB,CACP,CAAC,EAAQ,EAAW,EAAS,CAC9B,CAQD,OALA,MAAgB,CACd,EAAW,QAAU,GACrB,EAAU,QAAU,GACnB,CAAC,EAAM,CAAC,CAEJ,EAAM"}
@@ -1 +1 @@
1
- const e=require(`./use-network-state-Bce55hBv.cjs`);exports.useNetworkState=e.t,exports.useNetworkStateSubscribe=e.n;
1
+ const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./type-checks/src/is-equal.cjs`);let n=require(`react`);const r=()=>navigator.connection||navigator.mozConnection||navigator.webkitConnection,i=e=>{addEventListener(`online`,e,{passive:!0}),addEventListener(`offline`,e,{passive:!0});let t=r();return t&&t.addEventListener(`change`,e,{passive:!0}),()=>{removeEventListener(`online`,e),removeEventListener(`offline`,e),t&&t.removeEventListener(`change`,e)}},a=()=>{throw Error(`useNetworkState is a client-only hook`)};function o(){let e=(0,n.useRef)({});return(0,n.useSyncExternalStore)(i,()=>{let n=navigator.onLine,i=r(),a={online:n,downlink:i?.downlink,downlinkMax:i?.downlinkMax,effectiveType:i?.effectiveType,rtt:i?.rtt,saveData:i?.saveData,type:i?.type};return t.isEqual(e.current,a)?e.current:(e.current=a,a)},a)}exports.useNetworkState=o,exports.useNetworkStateSubscribe=i;
@@ -1,2 +1,20 @@
1
- import { n as useNetworkStateSubscribe, t as useNetworkState } from "./use-network-state-DQegmILl.cjs";
2
- export { useNetworkState, useNetworkStateSubscribe };
1
+ import { NetworkState } from "./types/src/navigator.cjs";
2
+
3
+ //#region src/use-network-state.d.ts
4
+
5
+ /**
6
+ * Subscribes to network state changes.
7
+ *
8
+ * @param callback - The callback function to call when the network state changes
9
+ * @returns A function to unsubscribe from the network state changes
10
+ */
11
+ declare const useNetworkStateSubscribe: (callback: (event: Event) => any) => () => void;
12
+ /**
13
+ * A hook that returns the network state.
14
+ *
15
+ * @returns The network state
16
+ */
17
+ declare function useNetworkState(): NetworkState;
18
+ //#endregion
19
+ export { useNetworkState, useNetworkStateSubscribe };
20
+ //# sourceMappingURL=use-network-state.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-network-state.d.cts","names":[],"sources":["../src/use-network-state.ts"],"sourcesContent":[],"mappings":";;;;;;AAsCA;AA6BA;;;cA7Ba,6CAA8C;;;;;;iBA6B3C,eAAA,CAAA,GAAe"}
@@ -1,2 +1,20 @@
1
- import { n as useNetworkStateSubscribe, t as useNetworkState } from "./use-network-state-DPhNT5_N.mjs";
2
- export { useNetworkState, useNetworkStateSubscribe };
1
+ import { NetworkState } from "./types/src/navigator.mjs";
2
+
3
+ //#region src/use-network-state.d.ts
4
+
5
+ /**
6
+ * Subscribes to network state changes.
7
+ *
8
+ * @param callback - The callback function to call when the network state changes
9
+ * @returns A function to unsubscribe from the network state changes
10
+ */
11
+ declare const useNetworkStateSubscribe: (callback: (event: Event) => any) => () => void;
12
+ /**
13
+ * A hook that returns the network state.
14
+ *
15
+ * @returns The network state
16
+ */
17
+ declare function useNetworkState(): NetworkState;
18
+ //#endregion
19
+ export { useNetworkState, useNetworkStateSubscribe };
20
+ //# sourceMappingURL=use-network-state.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-network-state.d.mts","names":[],"sources":["../src/use-network-state.ts"],"sourcesContent":[],"mappings":";;;;;;AAsCA;AA6BA;;;cA7Ba,6CAA8C;;;;;;iBA6B3C,eAAA,CAAA,GAAe"}
@@ -1 +1,2 @@
1
- import{n as e,t}from"./use-network-state-CtGu_gfo.mjs";export{t as useNetworkState,e as useNetworkStateSubscribe};
1
+ import{isEqual as e}from"./type-checks/src/is-equal.mjs";import{useRef as t,useSyncExternalStore as n}from"react";const r=()=>navigator.connection||navigator.mozConnection||navigator.webkitConnection,i=e=>{addEventListener(`online`,e,{passive:!0}),addEventListener(`offline`,e,{passive:!0});let t=r();return t&&t.addEventListener(`change`,e,{passive:!0}),()=>{removeEventListener(`online`,e),removeEventListener(`offline`,e),t&&t.removeEventListener(`change`,e)}},a=()=>{throw Error(`useNetworkState is a client-only hook`)};function o(){let o=t({});return n(i,()=>{let t=navigator.onLine,n=r(),i={online:t,downlink:n?.downlink,downlinkMax:n?.downlinkMax,effectiveType:n?.effectiveType,rtt:n?.rtt,saveData:n?.saveData,type:n?.type};return e(o.current,i)?o.current:(o.current=i,i)},a)}export{o as useNetworkState,i as useNetworkStateSubscribe};
2
+ //# sourceMappingURL=use-network-state.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-network-state.mjs","names":[],"sources":["../src/use-network-state.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isEqual } from \"@stryke/type-checks/is-equal\";\nimport type { NetworkInformation, NetworkState } from \"@stryke/types/navigator\";\nimport { useRef, useSyncExternalStore } from \"react\";\n\nconst getConnection = (): NetworkInformation | undefined => {\n const connectionKey = \"connection\" as keyof typeof navigator;\n const mozConnectionKey = \"mozConnection\" as keyof typeof navigator;\n const webkitConnectionKey = \"webkitConnection\" as keyof typeof navigator;\n\n return (navigator[connectionKey] ||\n navigator[mozConnectionKey] ||\n navigator[webkitConnectionKey]) as NetworkInformation;\n};\n\n/**\n * Subscribes to network state changes.\n *\n * @param callback - The callback function to call when the network state changes\n * @returns A function to unsubscribe from the network state changes\n */\nexport const useNetworkStateSubscribe = (callback: (event: Event) => any) => {\n addEventListener(\"online\", callback, { passive: true });\n addEventListener(\"offline\", callback, { passive: true });\n\n const connection = getConnection();\n\n if (connection) {\n connection.addEventListener(\"change\", callback, { passive: true });\n }\n\n return () => {\n removeEventListener(\"online\", callback);\n removeEventListener(\"offline\", callback);\n\n if (connection) {\n connection.removeEventListener(\"change\", callback);\n }\n };\n};\n\nconst getNetworkStateServerSnapshot = () => {\n throw new Error(\"useNetworkState is a client-only hook\");\n};\n\n/**\n * A hook that returns the network state.\n *\n * @returns The network state\n */\nexport function useNetworkState() {\n // eslint-disable-next-line ts/no-empty-object-type\n const cache = useRef<NetworkState | {}>({});\n\n const getSnapshot = (): NetworkState => {\n const online = navigator.onLine;\n const connection = getConnection();\n\n const nextState = {\n online,\n downlink: connection?.downlink,\n downlinkMax: connection?.downlinkMax,\n effectiveType: connection?.effectiveType,\n rtt: connection?.rtt,\n saveData: connection?.saveData,\n type: connection?.type\n } as NetworkState;\n\n if (isEqual(cache.current, nextState)) {\n return cache.current as NetworkState;\n }\n cache.current = nextState;\n return nextState;\n };\n\n return useSyncExternalStore(\n useNetworkStateSubscribe,\n getSnapshot,\n getNetworkStateServerSnapshot\n );\n}\n"],"mappings":"kHAsBA,MAAM,MAKI,UAJc,YAKpB,UAJuB,eAKvB,UAJ0B,iBAajB,EAA4B,GAAoC,CAC3E,iBAAiB,SAAU,EAAU,CAAE,QAAS,GAAM,CAAC,CACvD,iBAAiB,UAAW,EAAU,CAAE,QAAS,GAAM,CAAC,CAExD,IAAM,EAAa,GAAe,CAMlC,OAJI,GACF,EAAW,iBAAiB,SAAU,EAAU,CAAE,QAAS,GAAM,CAAC,KAGvD,CACX,oBAAoB,SAAU,EAAS,CACvC,oBAAoB,UAAW,EAAS,CAEpC,GACF,EAAW,oBAAoB,SAAU,EAAS,GAKlD,MAAsC,CAC1C,MAAU,MAAM,wCAAwC,EAQ1D,SAAgB,GAAkB,CAEhC,IAAM,EAAQ,EAA0B,EAAE,CAAC,CAuB3C,OAAO,EACL,MAtBsC,CACtC,IAAM,EAAS,UAAU,OACnB,EAAa,GAAe,CAE5B,EAAY,CAChB,SACA,SAAU,GAAY,SACtB,YAAa,GAAY,YACzB,cAAe,GAAY,cAC3B,IAAK,GAAY,IACjB,SAAU,GAAY,SACtB,KAAM,GAAY,KACnB,CAMD,OAJI,EAAQ,EAAM,QAAS,EAAU,CAC5B,EAAM,SAEf,EAAM,QAAU,EACT,IAMP,EACD"}
@@ -1 +1 @@
1
- const e=require(`./use-previous-BNZSuZUn.cjs`);exports.usePrevious=e.t;
1
+ const e=require(`./_virtual/rolldown_runtime.cjs`);let t=require(`react`);function n(e){let n=(0,t.useRef)({value:e,previous:e});return(0,t.useMemo)(()=>(n.current.value!==e&&(n.current.previous=n.current.value,n.current.value=e),n.current.previous),[e])}exports.usePrevious=n;
@@ -1,2 +1,5 @@
1
- import { t as usePrevious } from "./use-previous-BvOs-yn-.cjs";
2
- export { usePrevious };
1
+ //#region src/use-previous.d.ts
2
+ declare function usePrevious<T>(value: T): T;
3
+ //#endregion
4
+ export { usePrevious };
5
+ //# sourceMappingURL=use-previous.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-previous.d.cts","names":[],"sources":["../src/use-previous.ts"],"sourcesContent":[],"mappings":";iBAoBgB,sBAAsB,IAAC"}
@@ -1,2 +1,5 @@
1
- import { t as usePrevious } from "./use-previous-ChmuSO8b.mjs";
2
- export { usePrevious };
1
+ //#region src/use-previous.d.ts
2
+ declare function usePrevious<T>(value: T): T;
3
+ //#endregion
4
+ export { usePrevious };
5
+ //# sourceMappingURL=use-previous.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-previous.d.mts","names":[],"sources":["../src/use-previous.ts"],"sourcesContent":[],"mappings":";iBAoBgB,sBAAsB,IAAC"}
@@ -1 +1,2 @@
1
- import{t as e}from"./use-previous-vtWmTmEN.mjs";export{e as usePrevious};
1
+ import{useMemo as e,useRef as t}from"react";function n(n){let r=t({value:n,previous:n});return e(()=>(r.current.value!==n&&(r.current.previous=r.current.value,r.current.value=n),r.current.previous),[n])}export{n as usePrevious};
2
+ //# sourceMappingURL=use-previous.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-previous.mjs","names":[],"sources":["../src/use-previous.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { useMemo, useRef } from \"react\";\n\nexport function usePrevious<T>(value: T) {\n const ref = useRef({\n value,\n previous: value\n });\n\n // We compare values before making an update to ensure that\n // a change has been made. This ensures the previous value is\n // persisted correctly between renders.\n return useMemo(() => {\n if (ref.current.value !== value) {\n ref.current.previous = ref.current.value;\n ref.current.value = value;\n }\n return ref.current.previous;\n }, [value]);\n}\n"],"mappings":"4CAoBA,SAAgB,EAAe,EAAU,CACvC,IAAM,EAAM,EAAO,CACjB,QACA,SAAU,EACX,CAAC,CAKF,OAAO,OACD,EAAI,QAAQ,QAAU,IACxB,EAAI,QAAQ,SAAW,EAAI,QAAQ,MACnC,EAAI,QAAQ,MAAQ,GAEf,EAAI,QAAQ,UAClB,CAAC,EAAM,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/hooks",
3
- "version": "0.4.35",
3
+ "version": "0.4.36",
4
4
  "type": "module",
5
5
  "description": "A package containing shared hooks that can be used in any React UI project",
6
6
  "repository": {
@@ -85,8 +85,8 @@
85
85
  },
86
86
  "types": "./dist/index.d.cts",
87
87
  "peerDependencies": {
88
- "react": "^19.2.1",
89
- "react-dom": "^19.2.1",
88
+ "react": "^19.2.3",
89
+ "react-dom": "^19.2.3",
90
90
  "react-native": "^0.77.3"
91
91
  },
92
92
  "peerDependenciesMeta": {
@@ -95,16 +95,16 @@
95
95
  "react-native": { "optional": true }
96
96
  },
97
97
  "dependencies": {
98
- "react": "^19.2.1",
99
- "react-dom": "^19.2.1",
98
+ "react": "^19.2.3",
99
+ "react-dom": "^19.2.3",
100
100
  "react-native": "^0.77.3"
101
101
  },
102
102
  "devDependencies": {
103
103
  "@types/react": "^19.2.7",
104
104
  "@types/react-dom": "^19.2.3",
105
105
  "@types/react-native": "0.72.8",
106
- "tsdown": "^0.17.1"
106
+ "tsdown": "^0.17.2"
107
107
  },
108
108
  "publishConfig": { "access": "public" },
109
- "gitHead": "fd38508c876b697a52a0e27df1478b41ae011583"
109
+ "gitHead": "8f2e484743eb3ce54929e99096ca2ea188b4730e"
110
110
  }
@@ -1 +0,0 @@
1
- const e=e=>e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e);function t(t){return e(t)===`[object Function]`}function n(t){return e(t)===`[object AsyncFunction]`}const r=e=>{try{return e instanceof Function||typeof e==`function`||!!(e?.constructor&&e?.call&&e?.apply)||t(e)||n(e)}catch{return!1}};Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return r}});
@@ -1,2 +0,0 @@
1
- const e=e=>e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e);function t(t){return e(t)===`[object Function]`}function n(t){return e(t)===`[object AsyncFunction]`}const r=e=>{try{return e instanceof Function||typeof e==`function`||!!(e?.constructor&&e?.call&&e?.apply)||t(e)||n(e)}catch{return!1}};export{r as t};
2
- //# sourceMappingURL=is-function-md4Ym3I0.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-function-md4Ym3I0.mjs","names":[],"sources":["../../type-checks/src/get-object-tag.ts","../../type-checks/src/is-function.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Gets the `toStringTag` of `obj`.\n *\n * @param value - The obj to query.\n * @returns Returns the `toStringTag`.\n */\nexport const getObjectTag = (value: unknown): string => {\n if (value == null) {\n return value === undefined ? \"[object Undefined]\" : \"[object Null]\";\n }\n return Object.prototype.toString.call(value);\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { AnyFunction } from \"@stryke/types/base\";\nimport { getObjectTag } from \"./get-object-tag\";\n\nexport function isSyncFunction(value?: any): value is AnyFunction {\n return getObjectTag(value) === \"[object Function]\";\n}\n\nexport function isAsyncFunction(value?: any): value is AnyFunction {\n return getObjectTag(value) === \"[object AsyncFunction]\";\n}\n\n/**\n * Check if the provided value's type is `Function`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Function`\n */\nexport const isFunction = (value: unknown): value is AnyFunction => {\n try {\n return (\n value instanceof Function ||\n typeof value === \"function\" ||\n Boolean(\n value?.constructor && (value as any)?.call && (value as any)?.apply\n ) ||\n isSyncFunction(value) ||\n isAsyncFunction(value)\n );\n } catch {\n return false;\n }\n};\n"],"mappings":"AAwBA,MAAa,EAAgB,GACvB,GAAS,KACJ,IAAU,IAAA,GAAY,qBAAuB,gBAE/C,OAAO,UAAU,SAAS,KAAK,EAAM,CCP9C,SAAgB,EAAe,EAAmC,CAChE,OAAO,EAAa,EAAM,GAAK,oBAGjC,SAAgB,EAAgB,EAAmC,CACjE,OAAO,EAAa,EAAM,GAAK,yBASjC,MAAa,EAAc,GAAyC,CAClE,GAAI,CACF,OACE,aAAiB,UACjB,OAAO,GAAU,YACjB,GACE,GAAO,aAAgB,GAAe,MAAS,GAAe,QAEhE,EAAe,EAAM,EACrB,EAAgB,EAAM,MAElB,CACN,MAAO"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"navigator-CY6InfsZ.d.cts","names":[],"sources":["../../types/src/navigator.ts"],"sourcesContent":[],"mappings":";AAoBiB,UAAA,cAAA,CAAc;EAWd,SAAA,EAAA,OAAY;;;;;;;;;UAAZ,YAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"navigator-DUOlrD-4.d.mts","names":[],"sources":["../../types/src/navigator.ts"],"sourcesContent":[],"mappings":";AAoBiB,UAAA,cAAA,CAAc;EAWd,SAAA,EAAA,OAAY;;;;;;;;;UAAZ,YAAA"}
@@ -1,11 +0,0 @@
1
- import { t as BatteryManager } from "./navigator-DUOlrD-4.mjs";
2
-
3
- //#region src/use-battery.d.ts
4
-
5
- /**
6
- * Listens for updates to the mobile/desktop battery status
7
- */
8
- declare function useBattery(): Omit<BatteryManager, "addEventListener" | "removeEventListener">;
9
- //#endregion
10
- export { useBattery as t };
11
- //# sourceMappingURL=use-battery-BkRIfbJz.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-battery-BkRIfbJz.d.mts","names":[],"sources":["../src/use-battery.ts"],"sourcesContent":[],"mappings":";;;;;;AAkCA;iBAAgB,UAAA,CAAA,GAAU,KAAA"}
@@ -1 +0,0 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require(`./is-function-BhD7GXOO.cjs`);let l=require(`react`);l=s(l);const u={supported:!0,loading:!0,level:null,charging:null,chargingTime:null,dischargingTime:null};function d(){let[e,t]=l.default.useState(u),n=navigator.getBattery;return(0,l.useEffect)(()=>{if(!c.t(n)){t(e=>({...e,supported:!1,loading:!1}));return}let e=null,r=()=>{t({...u,supported:!0,loading:!1,...e})};return n().then(t=>{e=t,r(),t?.addEventListener(`levelchange`,r),t?.addEventListener(`chargingchange`,r),t?.addEventListener(`chargingtimechange`,r),t?.addEventListener(`dischargingtimechange`,r)}),()=>{e&&(e.removeEventListener(`levelchange`,r),e.removeEventListener(`chargingchange`,r),e.removeEventListener(`chargingtimechange`,r),e.removeEventListener(`dischargingtimechange`,r))}},[n]),e}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return d}});
@@ -1,2 +0,0 @@
1
- import{t as e}from"./is-function-md4Ym3I0.mjs";import t,{useEffect as n}from"react";const r={supported:!0,loading:!0,level:null,charging:null,chargingTime:null,dischargingTime:null};function i(){let[i,a]=t.useState(r),o=navigator.getBattery;return n(()=>{if(!e(o)){a(e=>({...e,supported:!1,loading:!1}));return}let t=null,n=()=>{a({...r,supported:!0,loading:!1,...t})};return o().then(e=>{t=e,n(),e?.addEventListener(`levelchange`,n),e?.addEventListener(`chargingchange`,n),e?.addEventListener(`chargingtimechange`,n),e?.addEventListener(`dischargingtimechange`,n)}),()=>{t&&(t.removeEventListener(`levelchange`,n),t.removeEventListener(`chargingchange`,n),t.removeEventListener(`chargingtimechange`,n),t.removeEventListener(`dischargingtimechange`,n))}},[o]),i}export{i as t};
2
- //# sourceMappingURL=use-battery-DaA7I4_x.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-battery-DaA7I4_x.mjs","names":[],"sources":["../src/use-battery.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport type { BatteryManager } from \"@stryke/types/navigator\";\nimport React, { useEffect } from \"react\";\n\nconst defaultBatteryManagerState = {\n supported: true,\n loading: true,\n level: null,\n charging: null,\n chargingTime: null,\n dischargingTime: null\n};\n\n/**\n * Listens for updates to the mobile/desktop battery status\n */\nexport function useBattery() {\n const [state, setState] = React.useState<\n Omit<BatteryManager, \"addEventListener\" | \"removeEventListener\">\n >(defaultBatteryManagerState);\n\n const key = \"getBattery\" as keyof typeof navigator;\n const getBattery = navigator[key] as () => Promise<BatteryManager>;\n\n useEffect(() => {\n if (!isFunction(getBattery)) {\n setState(s => ({\n ...s,\n supported: false,\n loading: false\n }));\n return;\n }\n\n let battery = null as BatteryManager | null;\n\n const handleChange = () => {\n setState({\n ...defaultBatteryManagerState,\n supported: true,\n loading: false,\n ...battery\n });\n };\n\n void getBattery().then(b => {\n battery = b;\n handleChange();\n\n b?.addEventListener(\"levelchange\", handleChange);\n b?.addEventListener(\"chargingchange\", handleChange);\n b?.addEventListener(\"chargingtimechange\", handleChange);\n b?.addEventListener(\"dischargingtimechange\", handleChange);\n });\n\n return () => {\n if (battery) {\n battery.removeEventListener(\"levelchange\", handleChange);\n battery.removeEventListener(\"chargingchange\", handleChange);\n battery.removeEventListener(\"chargingtimechange\", handleChange);\n battery.removeEventListener(\"dischargingtimechange\", handleChange);\n }\n };\n }, [getBattery]);\n\n return state;\n}\n"],"mappings":"oFAsBA,MAAM,EAA6B,CACjC,UAAW,GACX,QAAS,GACT,MAAO,KACP,SAAU,KACV,aAAc,KACd,gBAAiB,KAClB,CAKD,SAAgB,GAAa,CAC3B,GAAM,CAAC,EAAO,GAAY,EAAM,SAE9B,EAA2B,CAGvB,EAAa,UADP,WA4CZ,OAzCA,MAAgB,CACd,GAAI,CAAC,EAAW,EAAW,CAAE,CAC3B,EAAS,IAAM,CACb,GAAG,EACH,UAAW,GACX,QAAS,GACV,EAAE,CACH,OAGF,IAAI,EAAU,KAER,MAAqB,CACzB,EAAS,CACP,GAAG,EACH,UAAW,GACX,QAAS,GACT,GAAG,EACJ,CAAC,EAaJ,OAVK,GAAY,CAAC,KAAK,GAAK,CAC1B,EAAU,EACV,GAAc,CAEd,GAAG,iBAAiB,cAAe,EAAa,CAChD,GAAG,iBAAiB,iBAAkB,EAAa,CACnD,GAAG,iBAAiB,qBAAsB,EAAa,CACvD,GAAG,iBAAiB,wBAAyB,EAAa,EAC1D,KAEW,CACP,IACF,EAAQ,oBAAoB,cAAe,EAAa,CACxD,EAAQ,oBAAoB,iBAAkB,EAAa,CAC3D,EAAQ,oBAAoB,qBAAsB,EAAa,CAC/D,EAAQ,oBAAoB,wBAAyB,EAAa,IAGrE,CAAC,EAAW,CAAC,CAET"}
@@ -1,11 +0,0 @@
1
- import { t as BatteryManager } from "./navigator-CY6InfsZ.cjs";
2
-
3
- //#region src/use-battery.d.ts
4
-
5
- /**
6
- * Listens for updates to the mobile/desktop battery status
7
- */
8
- declare function useBattery(): Omit<BatteryManager, "addEventListener" | "removeEventListener">;
9
- //#endregion
10
- export { useBattery as t };
11
- //# sourceMappingURL=use-battery-DpuF7GMz.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-battery-DpuF7GMz.d.cts","names":[],"sources":["../src/use-battery.ts"],"sourcesContent":[],"mappings":";;;;;;AAkCA;iBAAgB,UAAA,CAAA,GAAU,KAAA"}
@@ -1,9 +0,0 @@
1
- //#region src/use-callback-ref.d.ts
2
- /**
3
- * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
4
- * prop or avoid re-executing effects when passed as a dependency
5
- */
6
- declare function useCallbackRef<T extends (...args: any[]) => any>(callback: T | undefined): T;
7
- //#endregion
8
- export { useCallbackRef as t };
9
- //# sourceMappingURL=use-callback-ref-B-95d49K.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-callback-ref-B-95d49K.d.mts","names":[],"sources":["../src/use-callback-ref.ts"],"sourcesContent":[],"mappings":";;AAwBA;;;iBAAgB,4DACJ,gBACT"}
@@ -1 +0,0 @@
1
- const e=require(`./use-battery-DZZDx003.cjs`);let t=require(`react`);function n(e){let n=(0,t.useRef)(e);return(0,t.useEffect)(()=>{n.current=e}),(0,t.useMemo)(()=>((...e)=>n.current?.(...e)),[])}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return n}});
@@ -1,9 +0,0 @@
1
- //#region src/use-callback-ref.d.ts
2
- /**
3
- * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
4
- * prop or avoid re-executing effects when passed as a dependency
5
- */
6
- declare function useCallbackRef<T extends (...args: any[]) => any>(callback: T | undefined): T;
7
- //#endregion
8
- export { useCallbackRef as t };
9
- //# sourceMappingURL=use-callback-ref-ctiFnQn4.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-callback-ref-ctiFnQn4.d.cts","names":[],"sources":["../src/use-callback-ref.ts"],"sourcesContent":[],"mappings":";;AAwBA;;;iBAAgB,4DACJ,gBACT"}
@@ -1,2 +0,0 @@
1
- import{useEffect as e,useMemo as t,useRef as n}from"react";function r(r){let i=n(r);return e(()=>{i.current=r}),t(()=>((...e)=>i.current?.(...e)),[])}export{r as t};
2
- //# sourceMappingURL=use-callback-ref-otlhGzUu.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-callback-ref-otlhGzUu.mjs","names":[],"sources":["../src/use-callback-ref.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { useEffect, useMemo, useRef } from \"react\";\n\n/**\n * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a\n * prop or avoid re-executing effects when passed as a dependency\n */\nexport function useCallbackRef<T extends (...args: any[]) => any>(\n callback: T | undefined\n): T {\n const callbackRef = useRef(callback);\n\n useEffect(() => {\n callbackRef.current = callback;\n });\n\n // https://github.com/facebook/react/issues/19240\n return useMemo(() => ((...args) => callbackRef.current?.(...args)) as T, []);\n}\n"],"mappings":"2DAwBA,SAAgB,EACd,EACG,CACH,IAAM,EAAc,EAAO,EAAS,CAOpC,OALA,MAAgB,CACd,EAAY,QAAU,GACtB,CAGK,QAAgB,GAAG,IAAS,EAAY,UAAU,GAAG,EAAK,EAAQ,EAAE,CAAC"}
@@ -1,2 +0,0 @@
1
- import{t as e}from"./use-memo-stable-DKI3Fj07.mjs";function t(t,n){return e(()=>t,n)}export{t};
2
- //# sourceMappingURL=use-callback-stable-C3QZzhdC.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-callback-stable-C3QZzhdC.mjs","names":[],"sources":["../src/use-callback-stable.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { AnyFunction } from \"@stryke/types/base\";\nimport { useMemoStable } from \"./use-memo-stable\";\n\n/**\n * Forked from use-memo-one by Alex Reardon\n */\n\n/**\n * `useMemo` and `useCallback` cache the most recent result. However, this cache can be destroyed by React when it wants to.\n *\n * `useMemoStable` and `useCallbackStable` are concurrent mode safe alternatives to `useMemo` and `useCallback` that do provide semantic guarantee. What this means is that you will always get the same reference for a memoized value so long as there is no input change.\n *\n * Using `useMemoStable` and `useCallbackStable` will consume more memory than useMemo and `useCallback` in order to provide a stable cache. React can release the cache of `useMemo` and `useCallback`, but `useMemoStable` will not release the cache until it is garbage collected.\n *\n * @remarks\n * You may rely on useMemo as a performance optimization, not as a semantic guarantee. In the future, React may choose to “forget” some previously memoized values and recalculate them on next render, e.g. to free memory for offscreen components. Write your code so that it still works without `useMemo` — and then add it to optimize performance.\n *\n * @param callback - The callback function to memoize\n * @param inputs - The inputs to watch for changes\n * @returns The memoized callback function\n */\nexport function useCallbackStable<TCallback extends AnyFunction = AnyFunction>(\n callback: TCallback,\n inputs?: any[]\n): TCallback {\n return useMemoStable(() => callback, inputs);\n}\n"],"mappings":"mDAuCA,SAAgB,EACd,EACA,EACW,CACX,OAAO,MAAoB,EAAU,EAAO"}
@@ -1,55 +0,0 @@
1
- //#region ../types/src/base.d.ts
2
-
3
- /**
4
- * A [[List]]
5
- *
6
- * @example
7
- * ```ts
8
- * type list0 = [1, 2, 3]
9
- * type list1 = number[]
10
- * ```
11
- *
12
- * @param A - its type
13
- * @returns [[List]]
14
- */
15
- type List<A = any> = ReadonlyArray<A>;
16
- /**
17
- * Alias to create a [[Function]]
18
- *
19
- * @example
20
- * ```ts
21
- * import { FunctionLike } from '@stryke/types'
22
- *
23
- * type test0 = FunctionLike<[string, number], boolean>
24
- * /// (args_0: string, args_1: number) => boolean
25
- * ```
26
- *
27
- * @param P - parameters
28
- * @param R - return type
29
- * @returns [[Function]]
30
- */
31
- type FunctionLike<P extends List = any, R$1 = any> = (...args: P) => R$1;
32
- type AnyFunction = FunctionLike<any, any>;
33
- //#endregion
34
- //#region src/use-callback-stable.d.ts
35
- /**
36
- * Forked from use-memo-one by Alex Reardon
37
- */
38
- /**
39
- * `useMemo` and `useCallback` cache the most recent result. However, this cache can be destroyed by React when it wants to.
40
- *
41
- * `useMemoStable` and `useCallbackStable` are concurrent mode safe alternatives to `useMemo` and `useCallback` that do provide semantic guarantee. What this means is that you will always get the same reference for a memoized value so long as there is no input change.
42
- *
43
- * Using `useMemoStable` and `useCallbackStable` will consume more memory than useMemo and `useCallback` in order to provide a stable cache. React can release the cache of `useMemo` and `useCallback`, but `useMemoStable` will not release the cache until it is garbage collected.
44
- *
45
- * @remarks
46
- * You may rely on useMemo as a performance optimization, not as a semantic guarantee. In the future, React may choose to “forget” some previously memoized values and recalculate them on next render, e.g. to free memory for offscreen components. Write your code so that it still works without `useMemo` — and then add it to optimize performance.
47
- *
48
- * @param callback - The callback function to memoize
49
- * @param inputs - The inputs to watch for changes
50
- * @returns The memoized callback function
51
- */
52
- declare function useCallbackStable<TCallback extends AnyFunction = AnyFunction>(callback: TCallback, inputs?: any[]): TCallback;
53
- //#endregion
54
- export { useCallbackStable as t };
55
- //# sourceMappingURL=use-callback-stable-C5X8ySnU.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-callback-stable-C5X8ySnU.d.mts","names":[],"sources":["../../types/src/base.ts","../src/use-callback-stable.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;KAmEY,gBAAgB,cAAc;;;;;;;;;;;;;;;;KAiB9B,uBAAuB,mCAAiC,MAAM;KAE9D,WAAA,GAAc;;;AAnB1B;AAiBA;;;;;AAEA;;;;AC/CA;;;;;;;iBAAgB,oCAAoC,cAAc,uBACtD,4BAET"}
@@ -1 +0,0 @@
1
- const e=require(`./use-memo-stable-DKW_L41q.cjs`);function t(t,n){return e.t(()=>t,n)}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
@@ -1,55 +0,0 @@
1
- //#region ../types/src/base.d.ts
2
-
3
- /**
4
- * A [[List]]
5
- *
6
- * @example
7
- * ```ts
8
- * type list0 = [1, 2, 3]
9
- * type list1 = number[]
10
- * ```
11
- *
12
- * @param A - its type
13
- * @returns [[List]]
14
- */
15
- type List<A = any> = ReadonlyArray<A>;
16
- /**
17
- * Alias to create a [[Function]]
18
- *
19
- * @example
20
- * ```ts
21
- * import { FunctionLike } from '@stryke/types'
22
- *
23
- * type test0 = FunctionLike<[string, number], boolean>
24
- * /// (args_0: string, args_1: number) => boolean
25
- * ```
26
- *
27
- * @param P - parameters
28
- * @param R - return type
29
- * @returns [[Function]]
30
- */
31
- type FunctionLike<P extends List = any, R$1 = any> = (...args: P) => R$1;
32
- type AnyFunction = FunctionLike<any, any>;
33
- //#endregion
34
- //#region src/use-callback-stable.d.ts
35
- /**
36
- * Forked from use-memo-one by Alex Reardon
37
- */
38
- /**
39
- * `useMemo` and `useCallback` cache the most recent result. However, this cache can be destroyed by React when it wants to.
40
- *
41
- * `useMemoStable` and `useCallbackStable` are concurrent mode safe alternatives to `useMemo` and `useCallback` that do provide semantic guarantee. What this means is that you will always get the same reference for a memoized value so long as there is no input change.
42
- *
43
- * Using `useMemoStable` and `useCallbackStable` will consume more memory than useMemo and `useCallback` in order to provide a stable cache. React can release the cache of `useMemo` and `useCallback`, but `useMemoStable` will not release the cache until it is garbage collected.
44
- *
45
- * @remarks
46
- * You may rely on useMemo as a performance optimization, not as a semantic guarantee. In the future, React may choose to “forget” some previously memoized values and recalculate them on next render, e.g. to free memory for offscreen components. Write your code so that it still works without `useMemo` — and then add it to optimize performance.
47
- *
48
- * @param callback - The callback function to memoize
49
- * @param inputs - The inputs to watch for changes
50
- * @returns The memoized callback function
51
- */
52
- declare function useCallbackStable<TCallback extends AnyFunction = AnyFunction>(callback: TCallback, inputs?: any[]): TCallback;
53
- //#endregion
54
- export { useCallbackStable as t };
55
- //# sourceMappingURL=use-callback-stable-D_wCU4yv.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-callback-stable-D_wCU4yv.d.cts","names":[],"sources":["../../types/src/base.ts","../src/use-callback-stable.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;KAmEY,gBAAgB,cAAc;;;;;;;;;;;;;;;;KAiB9B,uBAAuB,mCAAiC,MAAM;KAE9D,WAAA,GAAc;;;AAnB1B;AAiBA;;;;;AAEA;;;;AC/CA;;;;;;;iBAAgB,oCAAoC,cAAc,uBACtD,4BAET"}