yummies 5.7.0 → 5.8.0

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 (393) hide show
  1. package/async.js +26 -59
  2. package/async.js.map +1 -0
  3. package/common.d.ts +1 -1
  4. package/common.d.ts.map +1 -1
  5. package/common.js +5 -13
  6. package/common.js.map +1 -0
  7. package/complex/global-config.d.ts +1 -1
  8. package/complex/global-config.d.ts.map +1 -1
  9. package/complex/index.d.ts +3 -3
  10. package/complex/index.d.ts.map +1 -1
  11. package/complex/modules-factory.d.ts +1 -1
  12. package/complex/modules-factory.d.ts.map +1 -1
  13. package/complex.js +66 -0
  14. package/complex.js.map +1 -0
  15. package/cookie.d.ts +1 -1
  16. package/cookie.d.ts.map +1 -1
  17. package/cookie.js +4 -8
  18. package/cookie.js.map +1 -0
  19. package/css.d.ts +1 -1
  20. package/css.js +2780 -49
  21. package/css.js.map +1 -0
  22. package/data.js +32 -50
  23. package/data.js.map +1 -0
  24. package/date-time.d.ts +2 -3
  25. package/date-time.d.ts.map +1 -1
  26. package/date-time.js +588 -154
  27. package/date-time.js.map +1 -0
  28. package/device.js +23 -20
  29. package/device.js.map +1 -0
  30. package/encodings.js +269 -265
  31. package/encodings.js.map +1 -0
  32. package/errors.d.ts +1 -1
  33. package/errors.d.ts.map +1 -1
  34. package/errors.js +8 -29
  35. package/errors.js.map +1 -0
  36. package/file.js +19 -23
  37. package/file.js.map +1 -0
  38. package/format/_exports.d.ts +4 -4
  39. package/format/_exports.d.ts.map +1 -1
  40. package/format/index.d.ts +1 -1
  41. package/format/index.d.ts.map +1 -1
  42. package/format/number.d.ts +1 -1
  43. package/format/number.d.ts.map +1 -1
  44. package/format/percent.d.ts +2 -2
  45. package/format/percent.d.ts.map +1 -1
  46. package/format.js +27 -0
  47. package/format.js.map +1 -0
  48. package/html.d.ts +2 -2
  49. package/html.d.ts.map +1 -1
  50. package/html.js +636 -169
  51. package/html.js.map +1 -0
  52. package/id.js +25 -70
  53. package/id.js.map +1 -0
  54. package/imports.js +22 -37
  55. package/imports.js.map +1 -0
  56. package/math.d.ts +1 -1
  57. package/math.d.ts.map +1 -1
  58. package/math.js +10 -14
  59. package/math.js.map +1 -0
  60. package/media.js +54 -96
  61. package/media.js.map +1 -0
  62. package/mobx/apply-observable.d.ts +1 -1
  63. package/mobx/apply-observable.d.ts.map +1 -1
  64. package/mobx/create-enhanced-atom.d.ts +2 -2
  65. package/mobx/create-enhanced-atom.d.ts.map +1 -1
  66. package/mobx/deep-observable-struct.d.ts +1 -1
  67. package/mobx/deep-observable-struct.d.ts.map +1 -1
  68. package/mobx/get-mobx-administration.d.ts +2 -2
  69. package/mobx/get-mobx-administration.d.ts.map +1 -1
  70. package/mobx/index.d.ts +5 -5
  71. package/mobx/index.d.ts.map +1 -1
  72. package/mobx/lazy-observe.d.ts +6 -0
  73. package/mobx/lazy-observe.d.ts.map +1 -1
  74. package/mobx.js +89 -0
  75. package/mobx.js.map +1 -0
  76. package/ms.js +12 -17
  77. package/ms.js.map +1 -0
  78. package/number.js +9 -12
  79. package/number.js.map +1 -0
  80. package/package.json +93 -92
  81. package/parser/_exports.d.ts +3 -3
  82. package/parser/_exports.d.ts.map +1 -1
  83. package/parser/index.d.ts +1 -1
  84. package/parser/index.d.ts.map +1 -1
  85. package/parser/number.d.ts +1 -1
  86. package/parser/number.d.ts.map +1 -1
  87. package/parser/percent.d.ts +2 -2
  88. package/parser/percent.d.ts.map +1 -1
  89. package/parser/string.d.ts +1 -1
  90. package/parser/string.d.ts.map +1 -1
  91. package/parser.js +15 -0
  92. package/parser.js.map +1 -0
  93. package/price.js +13 -16
  94. package/price.js.map +1 -0
  95. package/random.js +11 -13
  96. package/random.js.map +1 -0
  97. package/react/hooks/index.d.ts +21 -21
  98. package/react/hooks/index.d.ts.map +1 -1
  99. package/react/hooks/use-click-outside.d.ts +1 -1
  100. package/react/hooks/use-define-ref.d.ts +1 -1
  101. package/react/hooks/use-element-ref.d.ts +1 -1
  102. package/react/hooks/use-event.d.ts +1 -1
  103. package/react/hooks/use-event.d.ts.map +1 -1
  104. package/react/hooks/use-initial-height.d.ts +1 -1
  105. package/react/hooks/use-last-value-ref.d.ts +1 -1
  106. package/react/hooks/use-resize-observer.d.ts +1 -1
  107. package/react/hooks/use-sync-ref.d.ts +1 -1
  108. package/react/hooks/use-toggle.d.ts +1 -1
  109. package/react/hooks/use-value.d.ts +1 -1
  110. package/react/index.d.ts +1 -1
  111. package/react/index.d.ts.map +1 -1
  112. package/react.js +152 -0
  113. package/react.js.map +1 -0
  114. package/sound.js +7 -11
  115. package/sound.js.map +1 -0
  116. package/text.js +20 -46
  117. package/text.js.map +1 -0
  118. package/type-guard/_exports.d.ts +1 -1
  119. package/type-guard/_exports.d.ts.map +1 -1
  120. package/type-guard/index.d.ts +1 -1
  121. package/type-guard/index.d.ts.map +1 -1
  122. package/type-guard.js +5 -0
  123. package/type-guard.js.map +1 -0
  124. package/utility-types.d.ts.map +1 -0
  125. package/utility-types.js +2 -0
  126. package/utility-types.js.map +1 -0
  127. package/utils/types.js +2 -1
  128. package/utils/types.js.map +1 -0
  129. package/vibrate.js +6 -7
  130. package/vibrate.js.map +1 -0
  131. package/~index-C3wKHvHr.js +80 -0
  132. package/~index-C3wKHvHr.js.map +1 -0
  133. package/~number-EWff2XI6.js +25 -0
  134. package/~number-EWff2XI6.js.map +1 -0
  135. package/~number-baxVnzrJ.js +32 -0
  136. package/~number-baxVnzrJ.js.map +1 -0
  137. package/async.cjs +0 -70
  138. package/async.d.cts +0 -28
  139. package/async.d.cts.map +0 -1
  140. package/common.cjs +0 -18
  141. package/common.d.cts +0 -15
  142. package/common.d.cts.map +0 -1
  143. package/complex/counter.cjs +0 -21
  144. package/complex/counter.d.cts +0 -15
  145. package/complex/counter.d.cts.map +0 -1
  146. package/complex/counter.js +0 -17
  147. package/complex/global-config.cjs +0 -46
  148. package/complex/global-config.d.cts +0 -11
  149. package/complex/global-config.d.cts.map +0 -1
  150. package/complex/global-config.js +0 -41
  151. package/complex/index.cjs +0 -19
  152. package/complex/index.d.cts +0 -4
  153. package/complex/index.d.cts.map +0 -1
  154. package/complex/index.js +0 -3
  155. package/complex/modules-factory.cjs +0 -50
  156. package/complex/modules-factory.d.cts +0 -49
  157. package/complex/modules-factory.d.cts.map +0 -1
  158. package/complex/modules-factory.js +0 -46
  159. package/cookie.cjs +0 -13
  160. package/cookie.d.cts +0 -3
  161. package/cookie.d.cts.map +0 -1
  162. package/css.cjs +0 -64
  163. package/css.d.cts +0 -42
  164. package/css.d.cts.map +0 -1
  165. package/data.cjs +0 -58
  166. package/data.d.cts +0 -4
  167. package/data.d.cts.map +0 -1
  168. package/date-time.cjs +0 -171
  169. package/date-time.d.cts +0 -28
  170. package/date-time.d.cts.map +0 -1
  171. package/device.cjs +0 -28
  172. package/device.d.cts +0 -8
  173. package/device.d.cts.map +0 -1
  174. package/encodings.cjs +0 -270
  175. package/encodings.d.cts +0 -2
  176. package/encodings.d.cts.map +0 -1
  177. package/errors.cjs +0 -34
  178. package/errors.d.cts +0 -19
  179. package/errors.d.cts.map +0 -1
  180. package/file.cjs +0 -29
  181. package/file.d.cts +0 -3
  182. package/file.d.cts.map +0 -1
  183. package/format/_exports.cjs +0 -20
  184. package/format/_exports.d.cts +0 -5
  185. package/format/_exports.d.cts.map +0 -1
  186. package/format/_exports.js +0 -4
  187. package/format/constants.cjs +0 -6
  188. package/format/constants.d.cts +0 -4
  189. package/format/constants.d.cts.map +0 -1
  190. package/format/constants.js +0 -3
  191. package/format/index.cjs +0 -40
  192. package/format/index.d.cts +0 -3
  193. package/format/index.d.cts.map +0 -1
  194. package/format/index.js +0 -4
  195. package/format/number.cjs +0 -48
  196. package/format/number.d.cts +0 -36
  197. package/format/number.d.cts.map +0 -1
  198. package/format/number.js +0 -44
  199. package/format/percent.cjs +0 -27
  200. package/format/percent.d.cts +0 -15
  201. package/format/percent.d.cts.map +0 -1
  202. package/format/percent.js +0 -23
  203. package/format/skip-spaces.cjs +0 -8
  204. package/format/skip-spaces.d.cts +0 -5
  205. package/format/skip-spaces.d.cts.map +0 -1
  206. package/format/skip-spaces.js +0 -4
  207. package/html.cjs +0 -202
  208. package/html.d.cts +0 -44
  209. package/html.d.cts.map +0 -1
  210. package/id.cjs +0 -76
  211. package/id.d.cts +0 -63
  212. package/id.d.cts.map +0 -1
  213. package/imports.cjs +0 -45
  214. package/imports.d.cts +0 -15
  215. package/imports.d.cts.map +0 -1
  216. package/math.cjs +0 -23
  217. package/math.d.cts +0 -13
  218. package/math.d.cts.map +0 -1
  219. package/media.cjs +0 -115
  220. package/media.d.cts +0 -20
  221. package/media.d.cts.map +0 -1
  222. package/mobx/apply-observable.cjs +0 -16
  223. package/mobx/apply-observable.d.cts +0 -4
  224. package/mobx/apply-observable.d.cts.map +0 -1
  225. package/mobx/apply-observable.js +0 -12
  226. package/mobx/create-enhanced-atom.cjs +0 -16
  227. package/mobx/create-enhanced-atom.d.cts +0 -11
  228. package/mobx/create-enhanced-atom.d.cts.map +0 -1
  229. package/mobx/create-enhanced-atom.js +0 -12
  230. package/mobx/deep-observable-struct.cjs +0 -61
  231. package/mobx/deep-observable-struct.d.cts +0 -7
  232. package/mobx/deep-observable-struct.d.cts.map +0 -1
  233. package/mobx/deep-observable-struct.js +0 -57
  234. package/mobx/get-mobx-administration.cjs +0 -6
  235. package/mobx/get-mobx-administration.d.cts +0 -6
  236. package/mobx/get-mobx-administration.d.cts.map +0 -1
  237. package/mobx/get-mobx-administration.js +0 -2
  238. package/mobx/index.cjs +0 -21
  239. package/mobx/index.d.cts +0 -6
  240. package/mobx/index.d.cts.map +0 -1
  241. package/mobx/index.js +0 -5
  242. package/mobx/lazy-observe.cjs +0 -52
  243. package/mobx/lazy-observe.d.cts +0 -8
  244. package/mobx/lazy-observe.d.cts.map +0 -1
  245. package/mobx/lazy-observe.js +0 -48
  246. package/ms.cjs +0 -22
  247. package/ms.d.cts +0 -19
  248. package/ms.d.cts.map +0 -1
  249. package/number.cjs +0 -16
  250. package/number.d.cts +0 -8
  251. package/number.d.cts.map +0 -1
  252. package/parser/_exports.cjs +0 -19
  253. package/parser/_exports.d.cts +0 -4
  254. package/parser/_exports.d.cts.map +0 -1
  255. package/parser/_exports.js +0 -3
  256. package/parser/index.cjs +0 -40
  257. package/parser/index.d.cts +0 -3
  258. package/parser/index.d.cts.map +0 -1
  259. package/parser/index.js +0 -4
  260. package/parser/number.cjs +0 -48
  261. package/parser/number.d.cts +0 -21
  262. package/parser/number.d.cts.map +0 -1
  263. package/parser/number.js +0 -44
  264. package/parser/percent.cjs +0 -8
  265. package/parser/percent.d.cts +0 -4
  266. package/parser/percent.d.cts.map +0 -1
  267. package/parser/percent.js +0 -4
  268. package/parser/string.cjs +0 -18
  269. package/parser/string.d.cts +0 -7
  270. package/parser/string.d.cts.map +0 -1
  271. package/parser/string.js +0 -14
  272. package/price.cjs +0 -21
  273. package/price.d.cts +0 -6
  274. package/price.d.cts.map +0 -1
  275. package/random.cjs +0 -25
  276. package/random.d.cts +0 -9
  277. package/random.d.cts.map +0 -1
  278. package/react/hooks/index.cjs +0 -37
  279. package/react/hooks/index.d.cts +0 -22
  280. package/react/hooks/index.d.cts.map +0 -1
  281. package/react/hooks/index.js +0 -21
  282. package/react/hooks/use-abort-controller.cjs +0 -15
  283. package/react/hooks/use-abort-controller.d.cts +0 -2
  284. package/react/hooks/use-abort-controller.d.cts.map +0 -1
  285. package/react/hooks/use-abort-controller.js +0 -11
  286. package/react/hooks/use-abort-signal.cjs +0 -8
  287. package/react/hooks/use-abort-signal.d.cts +0 -2
  288. package/react/hooks/use-abort-signal.d.cts.map +0 -1
  289. package/react/hooks/use-abort-signal.js +0 -4
  290. package/react/hooks/use-click-outside.cjs +0 -17
  291. package/react/hooks/use-click-outside.d.cts +0 -9
  292. package/react/hooks/use-click-outside.d.cts.map +0 -1
  293. package/react/hooks/use-click-outside.js +0 -13
  294. package/react/hooks/use-constant.cjs +0 -19
  295. package/react/hooks/use-constant.d.cts +0 -9
  296. package/react/hooks/use-constant.d.cts.map +0 -1
  297. package/react/hooks/use-constant.js +0 -15
  298. package/react/hooks/use-define-ref.cjs +0 -19
  299. package/react/hooks/use-define-ref.d.cts +0 -10
  300. package/react/hooks/use-define-ref.d.cts.map +0 -1
  301. package/react/hooks/use-define-ref.js +0 -15
  302. package/react/hooks/use-element-ref.cjs +0 -12
  303. package/react/hooks/use-element-ref.d.cts +0 -2
  304. package/react/hooks/use-element-ref.d.cts.map +0 -1
  305. package/react/hooks/use-element-ref.js +0 -8
  306. package/react/hooks/use-event-listener.cjs +0 -17
  307. package/react/hooks/use-event-listener.d.cts +0 -8
  308. package/react/hooks/use-event-listener.d.cts.map +0 -1
  309. package/react/hooks/use-event-listener.js +0 -13
  310. package/react/hooks/use-event.cjs +0 -23
  311. package/react/hooks/use-event.d.cts +0 -3
  312. package/react/hooks/use-event.d.cts.map +0 -1
  313. package/react/hooks/use-event.js +0 -19
  314. package/react/hooks/use-flag.cjs +0 -19
  315. package/react/hooks/use-flag.d.cts +0 -8
  316. package/react/hooks/use-flag.d.cts.map +0 -1
  317. package/react/hooks/use-flag.js +0 -15
  318. package/react/hooks/use-force-update.cjs +0 -11
  319. package/react/hooks/use-force-update.d.cts +0 -2
  320. package/react/hooks/use-force-update.d.cts.map +0 -1
  321. package/react/hooks/use-force-update.js +0 -7
  322. package/react/hooks/use-initial-height.cjs +0 -15
  323. package/react/hooks/use-initial-height.d.cts +0 -5
  324. package/react/hooks/use-initial-height.d.cts.map +0 -1
  325. package/react/hooks/use-initial-height.js +0 -11
  326. package/react/hooks/use-instance.cjs +0 -31
  327. package/react/hooks/use-instance.d.cts +0 -27
  328. package/react/hooks/use-instance.d.cts.map +0 -1
  329. package/react/hooks/use-instance.js +0 -27
  330. package/react/hooks/use-intersection-observer.cjs +0 -14
  331. package/react/hooks/use-intersection-observer.d.cts +0 -2
  332. package/react/hooks/use-intersection-observer.d.cts.map +0 -1
  333. package/react/hooks/use-intersection-observer.js +0 -10
  334. package/react/hooks/use-last-defined-value.cjs +0 -12
  335. package/react/hooks/use-last-defined-value.d.cts +0 -2
  336. package/react/hooks/use-last-defined-value.d.cts.map +0 -1
  337. package/react/hooks/use-last-defined-value.js +0 -8
  338. package/react/hooks/use-last-value-ref.cjs +0 -12
  339. package/react/hooks/use-last-value-ref.d.cts +0 -2
  340. package/react/hooks/use-last-value-ref.d.cts.map +0 -1
  341. package/react/hooks/use-last-value-ref.js +0 -8
  342. package/react/hooks/use-life-cycle.cjs +0 -14
  343. package/react/hooks/use-life-cycle.d.cts +0 -5
  344. package/react/hooks/use-life-cycle.d.cts.map +0 -1
  345. package/react/hooks/use-life-cycle.js +0 -10
  346. package/react/hooks/use-resize-observer.cjs +0 -15
  347. package/react/hooks/use-resize-observer.d.cts +0 -2
  348. package/react/hooks/use-resize-observer.d.cts.map +0 -1
  349. package/react/hooks/use-resize-observer.js +0 -11
  350. package/react/hooks/use-sync-ref.cjs +0 -10
  351. package/react/hooks/use-sync-ref.d.cts +0 -2
  352. package/react/hooks/use-sync-ref.d.cts.map +0 -1
  353. package/react/hooks/use-sync-ref.js +0 -6
  354. package/react/hooks/use-toggle.cjs +0 -10
  355. package/react/hooks/use-toggle.d.cts +0 -2
  356. package/react/hooks/use-toggle.d.cts.map +0 -1
  357. package/react/hooks/use-toggle.js +0 -6
  358. package/react/hooks/use-value.cjs +0 -12
  359. package/react/hooks/use-value.d.cts +0 -5
  360. package/react/hooks/use-value.d.cts.map +0 -1
  361. package/react/hooks/use-value.js +0 -8
  362. package/react/hooks/use-visibility-state.cjs +0 -18
  363. package/react/hooks/use-visibility-state.d.cts +0 -2
  364. package/react/hooks/use-visibility-state.d.cts.map +0 -1
  365. package/react/hooks/use-visibility-state.js +0 -14
  366. package/react/index.cjs +0 -17
  367. package/react/index.d.cts +0 -2
  368. package/react/index.d.cts.map +0 -1
  369. package/react/index.js +0 -1
  370. package/sound.cjs +0 -16
  371. package/sound.d.cts +0 -7
  372. package/sound.d.cts.map +0 -1
  373. package/storage.cjs +0 -48
  374. package/storage.d.cts +0 -39
  375. package/storage.d.cts.map +0 -1
  376. package/storage.js +0 -43
  377. package/text.cjs +0 -53
  378. package/text.d.cts +0 -15
  379. package/text.d.cts.map +0 -1
  380. package/type-guard/_exports.cjs +0 -129
  381. package/type-guard/_exports.d.cts +0 -86
  382. package/type-guard/_exports.d.cts.map +0 -1
  383. package/type-guard/_exports.js +0 -125
  384. package/type-guard/index.cjs +0 -40
  385. package/type-guard/index.d.cts +0 -3
  386. package/type-guard/index.d.cts.map +0 -1
  387. package/type-guard/index.js +0 -4
  388. package/utils/types.cjs +0 -2
  389. package/utils/types.d.cts +0 -395
  390. package/utils/types.d.cts.map +0 -1
  391. package/vibrate.cjs +0 -12
  392. package/vibrate.d.cts +0 -5
  393. package/vibrate.d.cts.map +0 -1
@@ -1,4 +0,0 @@
1
- import { useAbortController } from "./use-abort-controller.js";
2
- export const useAbortSignal = () => {
3
- return useAbortController().signal;
4
- };
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useClickOutside = void 0;
4
- const use_event_listener_js_1 = require("./use-event-listener.cjs");
5
- const useClickOutside = ({ contentRef, onClick, options, }) => {
6
- (0, use_event_listener_js_1.useEventListener)({
7
- event: 'mousedown',
8
- handler: (event) => {
9
- if (contentRef.current &&
10
- !contentRef.current.contains(event.target)) {
11
- onClick();
12
- }
13
- },
14
- options,
15
- });
16
- };
17
- exports.useClickOutside = useClickOutside;
@@ -1,9 +0,0 @@
1
- import type { MutableRefObject } from 'react';
2
- type ClickOutsideInput = {
3
- contentRef: MutableRefObject<HTMLElement | null>;
4
- onClick: VoidFunction;
5
- options?: AddEventListenerOptions;
6
- };
7
- export declare const useClickOutside: ({ contentRef, onClick, options, }: ClickOutsideInput) => void;
8
- export {};
9
- //# sourceMappingURL=use-click-outside.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-click-outside.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-click-outside.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAG9C,KAAK,iBAAiB,GAAG;IACvB,UAAU,EAAE,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACjD,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,uBAAuB,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,mCAI7B,iBAAiB,SAanB,CAAC"}
@@ -1,13 +0,0 @@
1
- import { useEventListener } from "./use-event-listener.js";
2
- export const useClickOutside = ({ contentRef, onClick, options, }) => {
3
- useEventListener({
4
- event: 'mousedown',
5
- handler: (event) => {
6
- if (contentRef.current &&
7
- !contentRef.current.contains(event.target)) {
8
- onClick();
9
- }
10
- },
11
- options,
12
- });
13
- };
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useConstant = void 0;
4
- const react_1 = require("react");
5
- /**
6
- * React hook for creating a value exactly once.
7
- * useMemo doesn't give this guarantee unfortunately -
8
- * https://reactjs.org/docs/hooks-faq.html#how-to-create-expensive-objects-lazily
9
- * https://reactjs.org/docs/hooks-reference.html#usememo
10
- * @param defineValue Function which returns defined value.
11
- */
12
- const useConstant = (defineValue) => {
13
- const ref = (0, react_1.useRef)();
14
- if (!ref.current) {
15
- ref.current = { value: defineValue() };
16
- }
17
- return ref.current.value;
18
- };
19
- exports.useConstant = useConstant;
@@ -1,9 +0,0 @@
1
- /**
2
- * React hook for creating a value exactly once.
3
- * useMemo doesn't give this guarantee unfortunately -
4
- * https://reactjs.org/docs/hooks-faq.html#how-to-create-expensive-objects-lazily
5
- * https://reactjs.org/docs/hooks-reference.html#usememo
6
- * @param defineValue Function which returns defined value.
7
- */
8
- export declare const useConstant: <T>(defineValue: () => T) => T;
9
- //# sourceMappingURL=use-constant.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-constant.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-constant.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,EAAE,aAAa,MAAM,CAAC,KAAG,CAQrD,CAAC"}
@@ -1,15 +0,0 @@
1
- import { useRef } from 'react';
2
- /**
3
- * React hook for creating a value exactly once.
4
- * useMemo doesn't give this guarantee unfortunately -
5
- * https://reactjs.org/docs/hooks-faq.html#how-to-create-expensive-objects-lazily
6
- * https://reactjs.org/docs/hooks-reference.html#usememo
7
- * @param defineValue Function which returns defined value.
8
- */
9
- export const useConstant = (defineValue) => {
10
- const ref = useRef();
11
- if (!ref.current) {
12
- ref.current = { value: defineValue() };
13
- }
14
- return ref.current.value;
15
- };
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useDefineRef = void 0;
4
- const react_1 = require("react");
5
- /**
6
- * React hook for creating a value exactly once.
7
- * useMemo doesn't give this guarantee unfortunately -
8
- * https://reactjs.org/docs/hooks-faq.html#how-to-create-expensive-objects-lazily
9
- * https://reactjs.org/docs/hooks-reference.html#usememo
10
- * @param defineFn Function which returns defined value.
11
- */
12
- const useDefineRef = (defineFn) => {
13
- const ref = (0, react_1.useRef)(void 0);
14
- if (!ref.current) {
15
- ref.current = defineFn();
16
- }
17
- return ref;
18
- };
19
- exports.useDefineRef = useDefineRef;
@@ -1,10 +0,0 @@
1
- import { type MutableRefObject } from 'react';
2
- /**
3
- * React hook for creating a value exactly once.
4
- * useMemo doesn't give this guarantee unfortunately -
5
- * https://reactjs.org/docs/hooks-faq.html#how-to-create-expensive-objects-lazily
6
- * https://reactjs.org/docs/hooks-reference.html#usememo
7
- * @param defineFn Function which returns defined value.
8
- */
9
- export declare const useDefineRef: <T>(defineFn: () => T) => MutableRefObject<T>;
10
- //# sourceMappingURL=use-define-ref.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-define-ref.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-define-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAU,MAAM,OAAO,CAAC;AAEtD;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,UAAU,MAAM,CAAC,KAAG,gBAAgB,CAAC,CAAC,CAQrE,CAAC"}
@@ -1,15 +0,0 @@
1
- import { useRef } from 'react';
2
- /**
3
- * React hook for creating a value exactly once.
4
- * useMemo doesn't give this guarantee unfortunately -
5
- * https://reactjs.org/docs/hooks-faq.html#how-to-create-expensive-objects-lazily
6
- * https://reactjs.org/docs/hooks-reference.html#usememo
7
- * @param defineFn Function which returns defined value.
8
- */
9
- export const useDefineRef = (defineFn) => {
10
- const ref = useRef(void 0);
11
- if (!ref.current) {
12
- ref.current = defineFn();
13
- }
14
- return ref;
15
- };
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useElementRef = void 0;
4
- const react_1 = require("react");
5
- const useElementRef = (selector) => {
6
- const ref = (0, react_1.useRef)();
7
- (0, react_1.useLayoutEffect)(() => {
8
- ref.current = selector();
9
- }, []);
10
- return ref;
11
- };
12
- exports.useElementRef = useElementRef;
@@ -1,2 +0,0 @@
1
- export declare const useElementRef: <T extends HTMLElement>(selector: () => T) => import("react").MutableRefObject<T | undefined>;
2
- //# sourceMappingURL=use-element-ref.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-element-ref.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-element-ref.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,WAAW,EAAE,UAAU,MAAM,CAAC,oDAQrE,CAAC"}
@@ -1,8 +0,0 @@
1
- import { useLayoutEffect, useRef } from 'react';
2
- export const useElementRef = (selector) => {
3
- const ref = useRef();
4
- useLayoutEffect(() => {
5
- ref.current = selector();
6
- }, []);
7
- return ref;
8
- };
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useEventListener = void 0;
4
- /* eslint-disable @typescript-eslint/ban-ts-comment */
5
- const react_1 = require("react");
6
- const use_sync_ref_js_1 = require("./use-sync-ref.cjs");
7
- const useEventListener = ({ event, handler, options, deps = [], node = document, }) => {
8
- const handlerRef = (0, use_sync_ref_js_1.useSyncRef)(handler);
9
- (0, react_1.useEffect)(() => {
10
- const handleEvent = (e) => handlerRef.current(e);
11
- // @ts-expect-error
12
- node.addEventListener(event, handleEvent, options);
13
- // @ts-expect-error
14
- return () => node.removeEventListener(event, handleEvent, options);
15
- }, deps);
16
- };
17
- exports.useEventListener = useEventListener;
@@ -1,8 +0,0 @@
1
- export declare const useEventListener: <EventName extends keyof HTMLElementEventMap>({ event, handler, options, deps, node, }: {
2
- event: EventName;
3
- handler: (e: HTMLElementEventMap[EventName]) => void;
4
- options?: boolean | AddEventListenerOptions;
5
- deps?: unknown[];
6
- node?: HTMLElement | Document | Window;
7
- }) => void;
8
- //# sourceMappingURL=use-event-listener.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-event-listener.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-event-listener.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,GAAI,SAAS,SAAS,MAAM,mBAAmB,EAAE,0CAM3E;IACD,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,CAAC,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;IACrD,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,CAAC;IAC5C,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,IAAI,CAAC,EAAE,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;CACxC,SAYA,CAAC"}
@@ -1,13 +0,0 @@
1
- /* eslint-disable @typescript-eslint/ban-ts-comment */
2
- import { useEffect } from 'react';
3
- import { useSyncRef } from "./use-sync-ref.js";
4
- export const useEventListener = ({ event, handler, options, deps = [], node = document, }) => {
5
- const handlerRef = useSyncRef(handler);
6
- useEffect(() => {
7
- const handleEvent = (e) => handlerRef.current(e);
8
- // @ts-expect-error
9
- node.addEventListener(event, handleEvent, options);
10
- // @ts-expect-error
11
- return () => node.removeEventListener(event, handleEvent, options);
12
- }, deps);
13
- };
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useEvent = void 0;
4
- /**
5
- * A Hook to define an event handler with an always-stable function identity.
6
- *
7
- * borrowed from @gaeron
8
- * https://github.com/reactjs/rfcs/blob/useevent/text/0000-useevent.md
9
- */
10
- const react_1 = require("react");
11
- const useEvent = (handler) => {
12
- const handlerRef = (0, react_1.useRef)(handler);
13
- // In a real implementation, this would run before layout effects
14
- (0, react_1.useLayoutEffect)(() => {
15
- handlerRef.current = handler;
16
- });
17
- return (0, react_1.useCallback)((...args) => {
18
- // In a real implementation, this would throw if called during render
19
- const fn = handlerRef.current;
20
- return fn(...args);
21
- }, []);
22
- };
23
- exports.useEvent = useEvent;
@@ -1,3 +0,0 @@
1
- import type { AnyFunction } from "../../utils/types.cjs";
2
- export declare const useEvent: <H extends AnyFunction>(handler: H) => H;
3
- //# sourceMappingURL=use-event.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-event.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-event.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,8BAA6B;AAExD,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,WAAW,EAAE,SAAS,CAAC,KAAG,CAa5D,CAAC"}
@@ -1,19 +0,0 @@
1
- /**
2
- * A Hook to define an event handler with an always-stable function identity.
3
- *
4
- * borrowed from @gaeron
5
- * https://github.com/reactjs/rfcs/blob/useevent/text/0000-useevent.md
6
- */
7
- import { useCallback, useLayoutEffect, useRef } from 'react';
8
- export const useEvent = (handler) => {
9
- const handlerRef = useRef(handler);
10
- // In a real implementation, this would run before layout effects
11
- useLayoutEffect(() => {
12
- handlerRef.current = handler;
13
- });
14
- return useCallback((...args) => {
15
- // In a real implementation, this would throw if called during render
16
- const fn = handlerRef.current;
17
- return fn(...args);
18
- }, []);
19
- };
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useFlag = void 0;
4
- const react_1 = require("react");
5
- const useFlag = (defaultValue = false) => {
6
- const [enabled, setEnabled] = (0, react_1.useState)(defaultValue);
7
- const toggle = (0, react_1.useCallback)(() => setEnabled((value) => !value), []);
8
- const enable = (0, react_1.useCallback)(() => setEnabled(true), []);
9
- const disable = (0, react_1.useCallback)(() => setEnabled(false), []);
10
- const flagObjRef = (0, react_1.useRef)({
11
- enabled,
12
- toggle,
13
- enable,
14
- disable,
15
- });
16
- flagObjRef.current.enabled = enabled;
17
- return flagObjRef.current;
18
- };
19
- exports.useFlag = useFlag;
@@ -1,8 +0,0 @@
1
- export interface FlagHook {
2
- enabled: boolean;
3
- toggle: VoidFunction;
4
- enable: VoidFunction;
5
- disable: VoidFunction;
6
- }
7
- export declare const useFlag: (defaultValue?: boolean) => FlagHook;
8
- //# sourceMappingURL=use-flag.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-flag.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-flag.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,YAAY,CAAC;CACvB;AAED,eAAO,MAAM,OAAO,GAAI,sBAAoB,KAAG,QAiB9C,CAAC"}
@@ -1,15 +0,0 @@
1
- import { useCallback, useRef, useState } from 'react';
2
- export const useFlag = (defaultValue = false) => {
3
- const [enabled, setEnabled] = useState(defaultValue);
4
- const toggle = useCallback(() => setEnabled((value) => !value), []);
5
- const enable = useCallback(() => setEnabled(true), []);
6
- const disable = useCallback(() => setEnabled(false), []);
7
- const flagObjRef = useRef({
8
- enabled,
9
- toggle,
10
- enable,
11
- disable,
12
- });
13
- flagObjRef.current.enabled = enabled;
14
- return flagObjRef.current;
15
- };
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useForceUpdate = void 0;
4
- const react_1 = require("react");
5
- const useForceUpdate = () => {
6
- const [, setState] = (0, react_1.useState)(null);
7
- return (0, react_1.useCallback)(() => {
8
- setState({});
9
- }, []);
10
- };
11
- exports.useForceUpdate = useForceUpdate;
@@ -1,2 +0,0 @@
1
- export declare const useForceUpdate: () => () => void;
2
- //# sourceMappingURL=use-force-update.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-force-update.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-force-update.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,kBAM1B,CAAC"}
@@ -1,7 +0,0 @@
1
- import { useCallback, useState } from 'react';
2
- export const useForceUpdate = () => {
3
- const [, setState] = useState(null);
4
- return useCallback(() => {
5
- setState({});
6
- }, []);
7
- };
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useInitialHeight = void 0;
4
- const react_1 = require("react");
5
- const useInitialHeight = () => {
6
- const ref = (0, react_1.useRef)(null);
7
- const [initialHeight, setInitialHeight] = (0, react_1.useState)(undefined);
8
- (0, react_1.useEffect)(() => {
9
- if (ref.current && !initialHeight) {
10
- setInitialHeight(ref.current.offsetHeight);
11
- }
12
- }, [initialHeight]);
13
- return { ref, initialHeight };
14
- };
15
- exports.useInitialHeight = useInitialHeight;
@@ -1,5 +0,0 @@
1
- export declare const useInitialHeight: <T extends HTMLElement>() => {
2
- ref: import("react").MutableRefObject<T | null>;
3
- initialHeight: number | undefined;
4
- };
5
- //# sourceMappingURL=use-initial-height.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-initial-height.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-initial-height.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,WAAW;;;CAarD,CAAC"}
@@ -1,11 +0,0 @@
1
- import { useEffect, useRef, useState } from 'react';
2
- export const useInitialHeight = () => {
3
- const ref = useRef(null);
4
- const [initialHeight, setInitialHeight] = useState(undefined);
5
- useEffect(() => {
6
- if (ref.current && !initialHeight) {
7
- setInitialHeight(ref.current.offsetHeight);
8
- }
9
- }, [initialHeight]);
10
- return { ref, initialHeight };
11
- };
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useInstance = exports.createUseInstanceHook = void 0;
4
- const react_1 = require("react");
5
- const use_abort_signal_js_1 = require("./use-abort-signal.cjs");
6
- const use_constant_js_1 = require("./use-constant.cjs");
7
- const createUseInstanceHook = (extension) => (factory, config) => {
8
- const abortSignal = (0, use_abort_signal_js_1.useAbortSignal)();
9
- const instance = (0, use_constant_js_1.useConstant)(() => factory({
10
- ...extension,
11
- abortSignal,
12
- payload: config?.payload,
13
- }));
14
- (0, react_1.useLayoutEffect)(() => {
15
- config?.onUpdate?.(config.payload);
16
- }, [config?.payload]);
17
- return instance;
18
- };
19
- exports.createUseInstanceHook = createUseInstanceHook;
20
- /**
21
- * The `useInstance` hook is used to create and manage an instance of an object
22
- * that requires access to the root store and an abort signal.
23
- *
24
- * You can create YOUR OWN CUSTOM `useInstance` hook using `createUseInstanceHook` if you need
25
- * to provide some specific data
26
- *
27
- * @param factory - A factory function that takes a configuration and returns an instance.
28
- * @param config - An optional configuration containing additional input parameters and an update function.
29
- * @returns An instance created by the factory function.
30
- */
31
- exports.useInstance = (0, exports.createUseInstanceHook)();
@@ -1,27 +0,0 @@
1
- export type InstanceCreateConfig<TPayload, TExtension = {}> = TExtension & {
2
- abortSignal: AbortSignal;
3
- payload: TPayload;
4
- };
5
- export declare const createUseInstanceHook: <TExtension = {}>(extension?: TExtension) => <TInstance, TPayload>(factory: (config: InstanceCreateConfig<NoInfer<TPayload>, TExtension>) => TInstance, config?: {
6
- payload?: TPayload;
7
- onUpdate?: (payload: TPayload) => void;
8
- }) => TInstance;
9
- /**
10
- * The `useInstance` hook is used to create and manage an instance of an object
11
- * that requires access to the root store and an abort signal.
12
- *
13
- * You can create YOUR OWN CUSTOM `useInstance` hook using `createUseInstanceHook` if you need
14
- * to provide some specific data
15
- *
16
- * @param factory - A factory function that takes a configuration and returns an instance.
17
- * @param config - An optional configuration containing additional input parameters and an update function.
18
- * @returns An instance created by the factory function.
19
- */
20
- export declare const useInstance: <TInstance, TPayload>(factory: (config: {
21
- abortSignal: AbortSignal;
22
- payload: NoInfer<TPayload>;
23
- }) => TInstance, config?: {
24
- payload?: TPayload | undefined;
25
- onUpdate?: ((payload: TPayload) => void) | undefined;
26
- } | undefined) => TInstance;
27
- //# sourceMappingURL=use-instance.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-instance.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-instance.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,oBAAoB,CAAC,QAAQ,EAAE,UAAU,GAAG,EAAE,IAAI,UAAU,GAAG;IACzE,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,QAAQ,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAC/B,UAAU,GAAG,EAAE,EAAE,YAAY,UAAU,MACvC,SAAS,EAAE,QAAQ,EAClB,SAAS,CACP,MAAM,EAAE,oBAAoB,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,KACxD,SAAS,EACd,SAAS;IACP,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,IAAI,CAAC;CACxC,cAiBF,CAAC;AAEJ;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,GArCrB,SAAS,EAAE,QAAQ;iBANP,WAAW;;;;uCAYc,IAAI;2BA+BM,CAAC"}
@@ -1,27 +0,0 @@
1
- import { useLayoutEffect } from 'react';
2
- import { useAbortSignal } from "./use-abort-signal.js";
3
- import { useConstant } from "./use-constant.js";
4
- export const createUseInstanceHook = (extension) => (factory, config) => {
5
- const abortSignal = useAbortSignal();
6
- const instance = useConstant(() => factory({
7
- ...extension,
8
- abortSignal,
9
- payload: config?.payload,
10
- }));
11
- useLayoutEffect(() => {
12
- config?.onUpdate?.(config.payload);
13
- }, [config?.payload]);
14
- return instance;
15
- };
16
- /**
17
- * The `useInstance` hook is used to create and manage an instance of an object
18
- * that requires access to the root store and an abort signal.
19
- *
20
- * You can create YOUR OWN CUSTOM `useInstance` hook using `createUseInstanceHook` if you need
21
- * to provide some specific data
22
- *
23
- * @param factory - A factory function that takes a configuration and returns an instance.
24
- * @param config - An optional configuration containing additional input parameters and an update function.
25
- * @returns An instance created by the factory function.
26
- */
27
- export const useInstance = createUseInstanceHook();
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useIntersectionObserver = void 0;
4
- const react_1 = require("react");
5
- const useIntersectionObserver = (callback, options) => {
6
- const [intersectionObserver] = (0, react_1.useState)(() => new IntersectionObserver(callback, options));
7
- (0, react_1.useEffect)(() => {
8
- return () => {
9
- intersectionObserver.disconnect();
10
- };
11
- }, []);
12
- return intersectionObserver;
13
- };
14
- exports.useIntersectionObserver = useIntersectionObserver;
@@ -1,2 +0,0 @@
1
- export declare const useIntersectionObserver: (callback: IntersectionObserverCallback, options?: IntersectionObserverInit) => IntersectionObserver;
2
- //# sourceMappingURL=use-intersection-observer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-intersection-observer.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-intersection-observer.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,GAClC,UAAU,4BAA4B,EACtC,UAAU,wBAAwB,yBAanC,CAAC"}
@@ -1,10 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
- export const useIntersectionObserver = (callback, options) => {
3
- const [intersectionObserver] = useState(() => new IntersectionObserver(callback, options));
4
- useEffect(() => {
5
- return () => {
6
- intersectionObserver.disconnect();
7
- };
8
- }, []);
9
- return intersectionObserver;
10
- };
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useLastDefinedValue = void 0;
4
- const react_1 = require("react");
5
- const useLastDefinedValue = (value) => {
6
- const ref = (0, react_1.useRef)(value);
7
- if (value != null) {
8
- ref.current = value;
9
- }
10
- return ref.current;
11
- };
12
- exports.useLastDefinedValue = useLastDefinedValue;
@@ -1,2 +0,0 @@
1
- export declare const useLastDefinedValue: <T>(value: T) => T;
2
- //# sourceMappingURL=use-last-defined-value.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-last-defined-value.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-last-defined-value.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,GAAI,CAAC,EAAE,OAAO,CAAC,MAM9C,CAAC"}
@@ -1,8 +0,0 @@
1
- import { useRef } from 'react';
2
- export const useLastDefinedValue = (value) => {
3
- const ref = useRef(value);
4
- if (value != null) {
5
- ref.current = value;
6
- }
7
- return ref.current;
8
- };
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useLastValueRef = void 0;
4
- const react_1 = require("react");
5
- const useLastValueRef = (value) => {
6
- const ref = (0, react_1.useRef)(value);
7
- if (value != null) {
8
- ref.current = value;
9
- }
10
- return ref;
11
- };
12
- exports.useLastValueRef = useLastValueRef;
@@ -1,2 +0,0 @@
1
- export declare const useLastValueRef: <T>(value: T | null | undefined) => import("react").MutableRefObject<T | null | undefined>;
2
- //# sourceMappingURL=use-last-value-ref.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-last-value-ref.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-last-value-ref.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,2DAQ7D,CAAC"}
@@ -1,8 +0,0 @@
1
- import { useRef } from 'react';
2
- export const useLastValueRef = (value) => {
3
- const ref = useRef(value);
4
- if (value != null) {
5
- ref.current = value;
6
- }
7
- return ref;
8
- };
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useLifeCycle = void 0;
4
- const react_1 = require("react");
5
- const use_sync_ref_js_1 = require("./use-sync-ref.cjs");
6
- const useLifeCycle = (fn) => {
7
- const fnRef = (0, use_sync_ref_js_1.useSyncRef)(fn);
8
- (0, react_1.useEffect)(() => {
9
- const fnOperation = fnRef.current();
10
- fnOperation.mount?.();
11
- return fnOperation.unmount?.();
12
- }, []);
13
- };
14
- exports.useLifeCycle = useLifeCycle;
@@ -1,5 +0,0 @@
1
- export declare const useLifeCycle: (fn: () => {
2
- mount?: VoidFunction;
3
- unmount?: VoidFunction;
4
- }) => void;
5
- //# sourceMappingURL=use-life-cycle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-life-cycle.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-life-cycle.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,GACvB,IAAI,MAAM;IACR,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB,SASF,CAAC"}