@contember/react-utils 2.1.0-alpha.37 → 2.1.0-alpha.39

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 (378) hide show
  1. package/dist/development/index.cjs +86 -0
  2. package/dist/development/index.cjs.map +1 -0
  3. package/dist/development/index.js +86 -0
  4. package/dist/development/index.js.map +1 -0
  5. package/dist/development/src/context/createContext.cjs +10 -0
  6. package/dist/development/src/context/createContext.cjs.map +1 -0
  7. package/dist/development/src/context/createContext.js +10 -0
  8. package/dist/development/src/context/createContext.js.map +1 -0
  9. package/dist/development/src/context/createRequiredContext.cjs +18 -0
  10. package/dist/development/src/context/createRequiredContext.cjs.map +1 -0
  11. package/dist/development/src/context/createRequiredContext.js +18 -0
  12. package/dist/development/src/context/createRequiredContext.js.map +1 -0
  13. package/dist/development/src/debug-context/Constants.cjs +25 -0
  14. package/dist/development/src/debug-context/Constants.cjs.map +1 -0
  15. package/dist/development/src/debug-context/Constants.js +25 -0
  16. package/dist/development/src/debug-context/Constants.js.map +1 -0
  17. package/dist/development/src/debug-context/Context.cjs +72 -0
  18. package/dist/development/src/debug-context/Context.cjs.map +1 -0
  19. package/dist/development/src/debug-context/Context.js +72 -0
  20. package/dist/development/src/debug-context/Context.js.map +1 -0
  21. package/dist/development/src/hooks/unwrapRefValue.cjs +11 -0
  22. package/dist/development/src/hooks/unwrapRefValue.cjs.map +1 -0
  23. package/dist/development/src/hooks/unwrapRefValue.js +11 -0
  24. package/dist/development/src/hooks/unwrapRefValue.js.map +1 -0
  25. package/dist/development/src/hooks/useAbortController.cjs +17 -0
  26. package/dist/development/src/hooks/useAbortController.cjs.map +1 -0
  27. package/dist/development/src/hooks/useAbortController.js +17 -0
  28. package/dist/development/src/hooks/useAbortController.js.map +1 -0
  29. package/dist/development/src/hooks/useArrayMapMemo.cjs +11 -0
  30. package/dist/development/src/hooks/useArrayMapMemo.cjs.map +1 -0
  31. package/dist/development/src/hooks/useArrayMapMemo.js +11 -0
  32. package/dist/development/src/hooks/useArrayMapMemo.js.map +1 -0
  33. package/dist/development/src/hooks/useAutoHeightTextArea.cjs +43 -0
  34. package/dist/development/src/hooks/useAutoHeightTextArea.cjs.map +1 -0
  35. package/dist/development/src/hooks/useAutoHeightTextArea.js +43 -0
  36. package/dist/development/src/hooks/useAutoHeightTextArea.js.map +1 -0
  37. package/dist/development/src/hooks/useChildrenAsLabel.cjs +53 -0
  38. package/dist/development/src/hooks/useChildrenAsLabel.cjs.map +1 -0
  39. package/dist/development/src/hooks/useChildrenAsLabel.js +53 -0
  40. package/dist/development/src/hooks/useChildrenAsLabel.js.map +1 -0
  41. package/dist/development/src/hooks/useComposeRef.cjs +31 -0
  42. package/dist/development/src/hooks/useComposeRef.cjs.map +1 -0
  43. package/dist/development/src/hooks/useComposeRef.js +31 -0
  44. package/dist/development/src/hooks/useComposeRef.js.map +1 -0
  45. package/dist/development/src/hooks/useConstantLengthInvariant.cjs +15 -0
  46. package/dist/development/src/hooks/useConstantLengthInvariant.cjs.map +1 -0
  47. package/dist/development/src/hooks/useConstantLengthInvariant.js +15 -0
  48. package/dist/development/src/hooks/useConstantLengthInvariant.js.map +1 -0
  49. package/dist/development/src/hooks/useConstantValueInvariant.cjs +15 -0
  50. package/dist/development/src/hooks/useConstantValueInvariant.cjs.map +1 -0
  51. package/dist/development/src/hooks/useConstantValueInvariant.js +15 -0
  52. package/dist/development/src/hooks/useConstantValueInvariant.js.map +1 -0
  53. package/dist/development/src/hooks/useDebounce.cjs +15 -0
  54. package/dist/development/src/hooks/useDebounce.cjs.map +1 -0
  55. package/dist/development/src/hooks/useDebounce.js +15 -0
  56. package/dist/development/src/hooks/useDebounce.js.map +1 -0
  57. package/dist/development/src/hooks/useDebounceCallback.cjs +19 -0
  58. package/dist/development/src/hooks/useDebounceCallback.cjs.map +1 -0
  59. package/dist/development/src/hooks/useDebounceCallback.js +19 -0
  60. package/dist/development/src/hooks/useDebounceCallback.js.map +1 -0
  61. package/dist/development/src/hooks/useDocumentTitle.cjs +22 -0
  62. package/dist/development/src/hooks/useDocumentTitle.cjs.map +1 -0
  63. package/dist/development/src/hooks/useDocumentTitle.js +22 -0
  64. package/dist/development/src/hooks/useDocumentTitle.js.map +1 -0
  65. package/dist/development/src/hooks/useExpectSameValueReference.cjs +24 -0
  66. package/dist/development/src/hooks/useExpectSameValueReference.cjs.map +1 -0
  67. package/dist/development/src/hooks/useExpectSameValueReference.js +24 -0
  68. package/dist/development/src/hooks/useExpectSameValueReference.js.map +1 -0
  69. package/dist/development/src/hooks/useForceRender.cjs +9 -0
  70. package/dist/development/src/hooks/useForceRender.cjs.map +1 -0
  71. package/dist/development/src/hooks/useForceRender.js +9 -0
  72. package/dist/development/src/hooks/useForceRender.js.map +1 -0
  73. package/dist/development/src/hooks/useId.cjs +13 -0
  74. package/dist/development/src/hooks/useId.cjs.map +1 -0
  75. package/dist/development/src/hooks/useId.js +13 -0
  76. package/dist/development/src/hooks/useId.js.map +1 -0
  77. package/dist/development/src/hooks/useIsMounted.cjs +18 -0
  78. package/dist/development/src/hooks/useIsMounted.cjs.map +1 -0
  79. package/dist/development/src/hooks/useIsMounted.js +18 -0
  80. package/dist/development/src/hooks/useIsMounted.js.map +1 -0
  81. package/dist/development/src/hooks/useObjectMemo.cjs +27 -0
  82. package/dist/development/src/hooks/useObjectMemo.cjs.map +1 -0
  83. package/dist/development/src/hooks/useObjectMemo.js +27 -0
  84. package/dist/development/src/hooks/useObjectMemo.js.map +1 -0
  85. package/dist/development/src/hooks/useOnElementClickOutsideCallback.cjs +20 -0
  86. package/dist/development/src/hooks/useOnElementClickOutsideCallback.cjs.map +1 -0
  87. package/dist/development/src/hooks/useOnElementClickOutsideCallback.js +20 -0
  88. package/dist/development/src/hooks/useOnElementClickOutsideCallback.js.map +1 -0
  89. package/dist/development/src/hooks/useOnElementMouseEnterDelayedCallback.cjs +33 -0
  90. package/dist/development/src/hooks/useOnElementMouseEnterDelayedCallback.cjs.map +1 -0
  91. package/dist/development/src/hooks/useOnElementMouseEnterDelayedCallback.js +33 -0
  92. package/dist/development/src/hooks/useOnElementMouseEnterDelayedCallback.js.map +1 -0
  93. package/dist/development/src/hooks/useOnElementResize.cjs +42 -0
  94. package/dist/development/src/hooks/useOnElementResize.cjs.map +1 -0
  95. package/dist/development/src/hooks/useOnElementResize.js +42 -0
  96. package/dist/development/src/hooks/useOnElementResize.js.map +1 -0
  97. package/dist/development/src/hooks/useOnWindowResize.cjs +36 -0
  98. package/dist/development/src/hooks/useOnWindowResize.cjs.map +1 -0
  99. package/dist/development/src/hooks/useOnWindowResize.js +36 -0
  100. package/dist/development/src/hooks/useOnWindowResize.js.map +1 -0
  101. package/dist/development/src/hooks/usePreviousValue.cjs +12 -0
  102. package/dist/development/src/hooks/usePreviousValue.cjs.map +1 -0
  103. package/dist/development/src/hooks/usePreviousValue.js +12 -0
  104. package/dist/development/src/hooks/usePreviousValue.js.map +1 -0
  105. package/dist/development/src/hooks/useStoredState.cjs +100 -0
  106. package/dist/development/src/hooks/useStoredState.cjs.map +1 -0
  107. package/dist/development/src/hooks/useStoredState.js +100 -0
  108. package/dist/development/src/hooks/useStoredState.js.map +1 -0
  109. package/dist/development/src/hooks/useUpdatedRef.cjs +10 -0
  110. package/dist/development/src/hooks/useUpdatedRef.cjs.map +1 -0
  111. package/dist/development/src/hooks/useUpdatedRef.js +10 -0
  112. package/dist/development/src/hooks/useUpdatedRef.js.map +1 -0
  113. package/dist/development/src/hooks/useWindowSize.cjs +20 -0
  114. package/dist/development/src/hooks/useWindowSize.cjs.map +1 -0
  115. package/dist/development/src/hooks/useWindowSize.js +20 -0
  116. package/dist/development/src/hooks/useWindowSize.js.map +1 -0
  117. package/dist/development/src/referentiallyStable/emptyArray.cjs +5 -0
  118. package/dist/development/src/referentiallyStable/emptyArray.cjs.map +1 -0
  119. package/dist/development/src/referentiallyStable/emptyArray.js +5 -0
  120. package/dist/development/src/referentiallyStable/emptyArray.js.map +1 -0
  121. package/dist/development/src/referentiallyStable/emptyObject.cjs +5 -0
  122. package/dist/development/src/referentiallyStable/emptyObject.cjs.map +1 -0
  123. package/dist/development/src/referentiallyStable/emptyObject.js +5 -0
  124. package/dist/development/src/referentiallyStable/emptyObject.js.map +1 -0
  125. package/dist/development/src/referentiallyStable/identityFunction.cjs +5 -0
  126. package/dist/development/src/referentiallyStable/identityFunction.cjs.map +1 -0
  127. package/dist/development/src/referentiallyStable/identityFunction.js +5 -0
  128. package/dist/development/src/referentiallyStable/identityFunction.js.map +1 -0
  129. package/dist/development/src/referentiallyStable/noop.cjs +5 -0
  130. package/dist/development/src/referentiallyStable/noop.cjs.map +1 -0
  131. package/dist/development/src/referentiallyStable/noop.js +5 -0
  132. package/dist/development/src/referentiallyStable/noop.js.map +1 -0
  133. package/dist/development/src/referentiallyStable/returnFalse.cjs +5 -0
  134. package/dist/development/src/referentiallyStable/returnFalse.cjs.map +1 -0
  135. package/dist/development/src/referentiallyStable/returnFalse.js +5 -0
  136. package/dist/development/src/referentiallyStable/returnFalse.js.map +1 -0
  137. package/dist/development/src/referentiallyStable/returnTrue.cjs +5 -0
  138. package/dist/development/src/referentiallyStable/returnTrue.cjs.map +1 -0
  139. package/dist/development/src/referentiallyStable/returnTrue.js +5 -0
  140. package/dist/development/src/referentiallyStable/returnTrue.js.map +1 -0
  141. package/dist/development/src/referentiallyStable/useReferentiallyStableCallback.cjs +15 -0
  142. package/dist/development/src/referentiallyStable/useReferentiallyStableCallback.cjs.map +1 -0
  143. package/dist/development/src/referentiallyStable/useReferentiallyStableCallback.js +15 -0
  144. package/dist/development/src/referentiallyStable/useReferentiallyStableCallback.js.map +1 -0
  145. package/dist/production/index.cjs +86 -0
  146. package/dist/production/index.cjs.map +1 -0
  147. package/dist/production/index.js +86 -0
  148. package/dist/production/index.js.map +1 -0
  149. package/dist/production/src/context/createContext.cjs +10 -0
  150. package/dist/production/src/context/createContext.cjs.map +1 -0
  151. package/dist/production/src/context/createContext.js +10 -0
  152. package/dist/production/src/context/createContext.js.map +1 -0
  153. package/dist/production/src/context/createRequiredContext.cjs +18 -0
  154. package/dist/production/src/context/createRequiredContext.cjs.map +1 -0
  155. package/dist/production/src/context/createRequiredContext.js +18 -0
  156. package/dist/production/src/context/createRequiredContext.js.map +1 -0
  157. package/dist/production/src/debug-context/Constants.cjs +25 -0
  158. package/dist/production/src/debug-context/Constants.cjs.map +1 -0
  159. package/dist/production/src/debug-context/Constants.js +25 -0
  160. package/dist/production/src/debug-context/Constants.js.map +1 -0
  161. package/dist/production/src/debug-context/Context.cjs +68 -0
  162. package/dist/production/src/debug-context/Context.cjs.map +1 -0
  163. package/dist/production/src/debug-context/Context.js +68 -0
  164. package/dist/production/src/debug-context/Context.js.map +1 -0
  165. package/dist/production/src/hooks/unwrapRefValue.cjs +11 -0
  166. package/dist/production/src/hooks/unwrapRefValue.cjs.map +1 -0
  167. package/dist/production/src/hooks/unwrapRefValue.js +11 -0
  168. package/dist/production/src/hooks/unwrapRefValue.js.map +1 -0
  169. package/dist/production/src/hooks/useAbortController.cjs +17 -0
  170. package/dist/production/src/hooks/useAbortController.cjs.map +1 -0
  171. package/dist/production/src/hooks/useAbortController.js +17 -0
  172. package/dist/production/src/hooks/useAbortController.js.map +1 -0
  173. package/dist/production/src/hooks/useArrayMapMemo.cjs +9 -0
  174. package/dist/production/src/hooks/useArrayMapMemo.cjs.map +1 -0
  175. package/dist/production/src/hooks/useArrayMapMemo.js +9 -0
  176. package/dist/production/src/hooks/useArrayMapMemo.js.map +1 -0
  177. package/dist/production/src/hooks/useAutoHeightTextArea.cjs +43 -0
  178. package/dist/production/src/hooks/useAutoHeightTextArea.cjs.map +1 -0
  179. package/dist/production/src/hooks/useAutoHeightTextArea.js +43 -0
  180. package/dist/production/src/hooks/useAutoHeightTextArea.js.map +1 -0
  181. package/dist/production/src/hooks/useChildrenAsLabel.cjs +51 -0
  182. package/dist/production/src/hooks/useChildrenAsLabel.cjs.map +1 -0
  183. package/dist/production/src/hooks/useChildrenAsLabel.js +51 -0
  184. package/dist/production/src/hooks/useChildrenAsLabel.js.map +1 -0
  185. package/dist/production/src/hooks/useComposeRef.cjs +31 -0
  186. package/dist/production/src/hooks/useComposeRef.cjs.map +1 -0
  187. package/dist/production/src/hooks/useComposeRef.js +31 -0
  188. package/dist/production/src/hooks/useComposeRef.js.map +1 -0
  189. package/dist/production/src/hooks/useConstantLengthInvariant.cjs +6 -0
  190. package/dist/production/src/hooks/useConstantLengthInvariant.cjs.map +1 -0
  191. package/dist/production/src/hooks/useConstantLengthInvariant.js +6 -0
  192. package/dist/production/src/hooks/useConstantLengthInvariant.js.map +1 -0
  193. package/dist/production/src/hooks/useConstantValueInvariant.cjs +6 -0
  194. package/dist/production/src/hooks/useConstantValueInvariant.cjs.map +1 -0
  195. package/dist/production/src/hooks/useConstantValueInvariant.js +6 -0
  196. package/dist/production/src/hooks/useConstantValueInvariant.js.map +1 -0
  197. package/dist/production/src/hooks/useDebounce.cjs +15 -0
  198. package/dist/production/src/hooks/useDebounce.cjs.map +1 -0
  199. package/dist/production/src/hooks/useDebounce.js +15 -0
  200. package/dist/production/src/hooks/useDebounce.js.map +1 -0
  201. package/dist/production/src/hooks/useDebounceCallback.cjs +19 -0
  202. package/dist/production/src/hooks/useDebounceCallback.cjs.map +1 -0
  203. package/dist/production/src/hooks/useDebounceCallback.js +19 -0
  204. package/dist/production/src/hooks/useDebounceCallback.js.map +1 -0
  205. package/dist/production/src/hooks/useDocumentTitle.cjs +22 -0
  206. package/dist/production/src/hooks/useDocumentTitle.cjs.map +1 -0
  207. package/dist/production/src/hooks/useDocumentTitle.js +22 -0
  208. package/dist/production/src/hooks/useDocumentTitle.js.map +1 -0
  209. package/dist/production/src/hooks/useExpectSameValueReference.cjs +15 -0
  210. package/dist/production/src/hooks/useExpectSameValueReference.cjs.map +1 -0
  211. package/dist/production/src/hooks/useExpectSameValueReference.js +15 -0
  212. package/dist/production/src/hooks/useExpectSameValueReference.js.map +1 -0
  213. package/dist/production/src/hooks/useForceRender.cjs +9 -0
  214. package/dist/production/src/hooks/useForceRender.cjs.map +1 -0
  215. package/dist/production/src/hooks/useForceRender.js +9 -0
  216. package/dist/production/src/hooks/useForceRender.js.map +1 -0
  217. package/dist/production/src/hooks/useId.cjs +13 -0
  218. package/dist/production/src/hooks/useId.cjs.map +1 -0
  219. package/dist/production/src/hooks/useId.js +13 -0
  220. package/dist/production/src/hooks/useId.js.map +1 -0
  221. package/dist/production/src/hooks/useIsMounted.cjs +18 -0
  222. package/dist/production/src/hooks/useIsMounted.cjs.map +1 -0
  223. package/dist/production/src/hooks/useIsMounted.js +18 -0
  224. package/dist/production/src/hooks/useIsMounted.js.map +1 -0
  225. package/dist/production/src/hooks/useObjectMemo.cjs +27 -0
  226. package/dist/production/src/hooks/useObjectMemo.cjs.map +1 -0
  227. package/dist/production/src/hooks/useObjectMemo.js +27 -0
  228. package/dist/production/src/hooks/useObjectMemo.js.map +1 -0
  229. package/dist/production/src/hooks/useOnElementClickOutsideCallback.cjs +20 -0
  230. package/dist/production/src/hooks/useOnElementClickOutsideCallback.cjs.map +1 -0
  231. package/dist/production/src/hooks/useOnElementClickOutsideCallback.js +20 -0
  232. package/dist/production/src/hooks/useOnElementClickOutsideCallback.js.map +1 -0
  233. package/dist/production/src/hooks/useOnElementMouseEnterDelayedCallback.cjs +33 -0
  234. package/dist/production/src/hooks/useOnElementMouseEnterDelayedCallback.cjs.map +1 -0
  235. package/dist/production/src/hooks/useOnElementMouseEnterDelayedCallback.js +33 -0
  236. package/dist/production/src/hooks/useOnElementMouseEnterDelayedCallback.js.map +1 -0
  237. package/dist/production/src/hooks/useOnElementResize.cjs +42 -0
  238. package/dist/production/src/hooks/useOnElementResize.cjs.map +1 -0
  239. package/dist/production/src/hooks/useOnElementResize.js +42 -0
  240. package/dist/production/src/hooks/useOnElementResize.js.map +1 -0
  241. package/dist/production/src/hooks/useOnWindowResize.cjs +36 -0
  242. package/dist/production/src/hooks/useOnWindowResize.cjs.map +1 -0
  243. package/dist/production/src/hooks/useOnWindowResize.js +36 -0
  244. package/dist/production/src/hooks/useOnWindowResize.js.map +1 -0
  245. package/dist/production/src/hooks/usePreviousValue.cjs +12 -0
  246. package/dist/production/src/hooks/usePreviousValue.cjs.map +1 -0
  247. package/dist/production/src/hooks/usePreviousValue.js +12 -0
  248. package/dist/production/src/hooks/usePreviousValue.js.map +1 -0
  249. package/dist/production/src/hooks/useStoredState.cjs +100 -0
  250. package/dist/production/src/hooks/useStoredState.cjs.map +1 -0
  251. package/dist/production/src/hooks/useStoredState.js +100 -0
  252. package/dist/production/src/hooks/useStoredState.js.map +1 -0
  253. package/dist/production/src/hooks/useUpdatedRef.cjs +10 -0
  254. package/dist/production/src/hooks/useUpdatedRef.cjs.map +1 -0
  255. package/dist/production/src/hooks/useUpdatedRef.js +10 -0
  256. package/dist/production/src/hooks/useUpdatedRef.js.map +1 -0
  257. package/dist/production/src/hooks/useWindowSize.cjs +20 -0
  258. package/dist/production/src/hooks/useWindowSize.cjs.map +1 -0
  259. package/dist/production/src/hooks/useWindowSize.js +20 -0
  260. package/dist/production/src/hooks/useWindowSize.js.map +1 -0
  261. package/dist/production/src/referentiallyStable/emptyArray.cjs +5 -0
  262. package/dist/production/src/referentiallyStable/emptyArray.cjs.map +1 -0
  263. package/dist/production/src/referentiallyStable/emptyArray.js +5 -0
  264. package/dist/production/src/referentiallyStable/emptyArray.js.map +1 -0
  265. package/dist/production/src/referentiallyStable/emptyObject.cjs +5 -0
  266. package/dist/production/src/referentiallyStable/emptyObject.cjs.map +1 -0
  267. package/dist/production/src/referentiallyStable/emptyObject.js +5 -0
  268. package/dist/production/src/referentiallyStable/emptyObject.js.map +1 -0
  269. package/dist/production/src/referentiallyStable/identityFunction.cjs +5 -0
  270. package/dist/production/src/referentiallyStable/identityFunction.cjs.map +1 -0
  271. package/dist/production/src/referentiallyStable/identityFunction.js +5 -0
  272. package/dist/production/src/referentiallyStable/identityFunction.js.map +1 -0
  273. package/dist/production/src/referentiallyStable/noop.cjs +5 -0
  274. package/dist/production/src/referentiallyStable/noop.cjs.map +1 -0
  275. package/dist/production/src/referentiallyStable/noop.js +5 -0
  276. package/dist/production/src/referentiallyStable/noop.js.map +1 -0
  277. package/dist/production/src/referentiallyStable/returnFalse.cjs +5 -0
  278. package/dist/production/src/referentiallyStable/returnFalse.cjs.map +1 -0
  279. package/dist/production/src/referentiallyStable/returnFalse.js +5 -0
  280. package/dist/production/src/referentiallyStable/returnFalse.js.map +1 -0
  281. package/dist/production/src/referentiallyStable/returnTrue.cjs +5 -0
  282. package/dist/production/src/referentiallyStable/returnTrue.cjs.map +1 -0
  283. package/dist/production/src/referentiallyStable/returnTrue.js +5 -0
  284. package/dist/production/src/referentiallyStable/returnTrue.js.map +1 -0
  285. package/dist/production/src/referentiallyStable/useReferentiallyStableCallback.cjs +15 -0
  286. package/dist/production/src/referentiallyStable/useReferentiallyStableCallback.cjs.map +1 -0
  287. package/dist/production/src/referentiallyStable/useReferentiallyStableCallback.js +15 -0
  288. package/dist/production/src/referentiallyStable/useReferentiallyStableCallback.js.map +1 -0
  289. package/dist/types/context/createContext.d.ts +3 -0
  290. package/dist/types/context/createContext.d.ts.map +1 -0
  291. package/dist/types/context/createRequiredContext.d.ts +3 -0
  292. package/dist/types/context/createRequiredContext.d.ts.map +1 -0
  293. package/dist/types/context/index.d.ts +3 -0
  294. package/dist/types/context/index.d.ts.map +1 -0
  295. package/dist/types/debug-context/Constants.d.ts +6 -0
  296. package/dist/types/debug-context/Constants.d.ts.map +1 -0
  297. package/dist/types/debug-context/Context.d.ts +15 -0
  298. package/dist/types/debug-context/Context.d.ts.map +1 -0
  299. package/dist/types/debug-context/Types.d.ts +13 -0
  300. package/dist/types/debug-context/Types.d.ts.map +1 -0
  301. package/dist/types/debug-context/index.d.ts +4 -0
  302. package/dist/types/debug-context/index.d.ts.map +1 -0
  303. package/dist/types/hooks/index.d.ts +25 -0
  304. package/dist/types/hooks/index.d.ts.map +1 -0
  305. package/dist/types/hooks/unwrapRefValue.d.ts +9 -0
  306. package/dist/types/hooks/unwrapRefValue.d.ts.map +1 -0
  307. package/dist/types/hooks/useAbortController.d.ts +2 -0
  308. package/dist/types/hooks/useAbortController.d.ts.map +1 -0
  309. package/dist/types/hooks/useArrayMapMemo.d.ts +10 -0
  310. package/dist/types/hooks/useArrayMapMemo.d.ts.map +1 -0
  311. package/dist/types/hooks/useAutoHeightTextArea.d.ts +3 -0
  312. package/dist/types/hooks/useAutoHeightTextArea.d.ts.map +1 -0
  313. package/dist/types/hooks/useChildrenAsLabel.d.ts +16 -0
  314. package/dist/types/hooks/useChildrenAsLabel.d.ts.map +1 -0
  315. package/dist/types/hooks/useComposeRef.d.ts +16 -0
  316. package/dist/types/hooks/useComposeRef.d.ts.map +1 -0
  317. package/dist/types/hooks/useConstantLengthInvariant.d.ts +2 -0
  318. package/dist/types/hooks/useConstantLengthInvariant.d.ts.map +1 -0
  319. package/dist/types/hooks/useConstantValueInvariant.d.ts +2 -0
  320. package/dist/types/hooks/useConstantValueInvariant.d.ts.map +1 -0
  321. package/dist/types/hooks/useDebounce.d.ts +2 -0
  322. package/dist/types/hooks/useDebounce.d.ts.map +1 -0
  323. package/dist/types/hooks/useDebounceCallback.d.ts +2 -0
  324. package/dist/types/hooks/useDebounceCallback.d.ts.map +1 -0
  325. package/dist/types/hooks/useDocumentTitle.d.ts +2 -0
  326. package/dist/types/hooks/useDocumentTitle.d.ts.map +1 -0
  327. package/dist/types/hooks/useExpectSameValueReference.d.ts +24 -0
  328. package/dist/types/hooks/useExpectSameValueReference.d.ts.map +1 -0
  329. package/dist/types/hooks/useForceRender.d.ts +2 -0
  330. package/dist/types/hooks/useForceRender.d.ts.map +1 -0
  331. package/dist/types/hooks/useId.d.ts +10 -0
  332. package/dist/types/hooks/useId.d.ts.map +1 -0
  333. package/dist/types/hooks/useIsMounted.d.ts +2 -0
  334. package/dist/types/hooks/useIsMounted.d.ts.map +1 -0
  335. package/dist/types/hooks/useObjectMemo.d.ts +2 -0
  336. package/dist/types/hooks/useObjectMemo.d.ts.map +1 -0
  337. package/dist/types/hooks/useOnElementClickOutsideCallback.d.ts +3 -0
  338. package/dist/types/hooks/useOnElementClickOutsideCallback.d.ts.map +1 -0
  339. package/dist/types/hooks/useOnElementMouseEnterDelayedCallback.d.ts +14 -0
  340. package/dist/types/hooks/useOnElementMouseEnterDelayedCallback.d.ts.map +1 -0
  341. package/dist/types/hooks/useOnElementResize.d.ts +3 -0
  342. package/dist/types/hooks/useOnElementResize.d.ts.map +1 -0
  343. package/dist/types/hooks/useOnWindowResize.d.ts +2 -0
  344. package/dist/types/hooks/useOnWindowResize.d.ts.map +1 -0
  345. package/dist/types/hooks/usePreviousValue.d.ts +2 -0
  346. package/dist/types/hooks/usePreviousValue.d.ts.map +1 -0
  347. package/dist/types/hooks/useStoredState.d.ts +18 -0
  348. package/dist/types/hooks/useStoredState.d.ts.map +1 -0
  349. package/dist/types/hooks/useUpdatedRef.d.ts +8 -0
  350. package/dist/types/hooks/useUpdatedRef.d.ts.map +1 -0
  351. package/dist/types/hooks/useWindowSize.d.ts +5 -0
  352. package/dist/types/hooks/useWindowSize.d.ts.map +1 -0
  353. package/dist/types/index.d.ts +6 -0
  354. package/dist/types/index.d.ts.map +1 -0
  355. package/dist/types/referentiallyStable/emptyArray.d.ts +2 -0
  356. package/dist/types/referentiallyStable/emptyArray.d.ts.map +1 -0
  357. package/dist/types/referentiallyStable/emptyObject.d.ts +2 -0
  358. package/dist/types/referentiallyStable/emptyObject.d.ts.map +1 -0
  359. package/dist/types/referentiallyStable/identityFunction.d.ts +2 -0
  360. package/dist/types/referentiallyStable/identityFunction.d.ts.map +1 -0
  361. package/dist/types/referentiallyStable/index.d.ts +8 -0
  362. package/dist/types/referentiallyStable/index.d.ts.map +1 -0
  363. package/dist/types/referentiallyStable/noop.d.ts +2 -0
  364. package/dist/types/referentiallyStable/noop.d.ts.map +1 -0
  365. package/dist/types/referentiallyStable/returnFalse.d.ts +2 -0
  366. package/dist/types/referentiallyStable/returnFalse.d.ts.map +1 -0
  367. package/dist/types/referentiallyStable/returnTrue.d.ts +2 -0
  368. package/dist/types/referentiallyStable/returnTrue.d.ts.map +1 -0
  369. package/dist/types/referentiallyStable/useReferentiallyStableCallback.d.ts +3 -0
  370. package/dist/types/referentiallyStable/useReferentiallyStableCallback.d.ts.map +1 -0
  371. package/dist/types/tsconfig.tsbuildinfo +1 -0
  372. package/dist/types/types/PropsWithRequiredChildren.d.ts +5 -0
  373. package/dist/types/types/PropsWithRequiredChildren.d.ts.map +1 -0
  374. package/dist/types/types/Serializable.d.ts +4 -0
  375. package/dist/types/types/Serializable.d.ts.map +1 -0
  376. package/dist/types/types/index.d.ts +3 -0
  377. package/dist/types/types/index.d.ts.map +1 -0
  378. package/package.json +4 -4
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const React = require("react");
4
+ const urlStateStorage = {
5
+ getItem(key) {
6
+ const searchParams = new URLSearchParams(window.location.search);
7
+ const value = searchParams.get(key[1]);
8
+ return value !== null && value !== void 0 ? JSON.parse(value) : null;
9
+ },
10
+ setItem(key, value) {
11
+ const searchParams = new URLSearchParams(window.location.search);
12
+ searchParams.set(key[1], JSON.stringify(value));
13
+ const newUrl = `${window.location.pathname}?${searchParams.toString()}`;
14
+ window.history.replaceState({}, "", newUrl);
15
+ }
16
+ };
17
+ const createStateStorageFromNativeStorage = (getStorage) => {
18
+ return {
19
+ getItem(key) {
20
+ const value = getStorage().getItem(key.join("-"));
21
+ return value !== null ? JSON.parse(value) : null;
22
+ },
23
+ setItem(key, value) {
24
+ getStorage().setItem(key.join("-"), JSON.stringify(value));
25
+ }
26
+ };
27
+ };
28
+ const sessionStateStorage = createStateStorageFromNativeStorage(() => sessionStorage);
29
+ const localStateStorage = createStateStorageFromNativeStorage(() => localStorage);
30
+ const nullStorage = {
31
+ getItem() {
32
+ return null;
33
+ },
34
+ setItem() {
35
+ }
36
+ };
37
+ const builtInStorages = {
38
+ url: urlStateStorage,
39
+ session: sessionStateStorage,
40
+ local: localStateStorage,
41
+ null: nullStorage
42
+ };
43
+ const useStoredState = (storageOrName, key, initializeValue) => {
44
+ const storage = React.useMemo(() => {
45
+ return getStateStorage(storageOrName);
46
+ }, [storageOrName]);
47
+ const [value, setValue] = React.useState(() => {
48
+ const value2 = storage.getItem(key);
49
+ return initializeValue(value2);
50
+ });
51
+ return [
52
+ value,
53
+ React.useCallback((value2) => {
54
+ setValue((current) => {
55
+ const newValue = typeof value2 === "function" ? value2(current) : value2;
56
+ storage.setItem(key, newValue);
57
+ return newValue;
58
+ });
59
+ }, [key, storage])
60
+ ];
61
+ };
62
+ const useSessionStorageState = (key, initializeValue) => {
63
+ return useStoredState(sessionStateStorage, key, initializeValue);
64
+ };
65
+ const useLocalStorageState = (key, initializeValue) => {
66
+ return useStoredState(localStateStorage, key, initializeValue);
67
+ };
68
+ const getStateStorage = (storageOrName) => {
69
+ if (Array.isArray(storageOrName)) {
70
+ return createFallbackStorage(storageOrName.map((it) => typeof it === "string" ? builtInStorages[it] : it));
71
+ }
72
+ return typeof storageOrName === "string" ? builtInStorages[storageOrName] : storageOrName;
73
+ };
74
+ const createFallbackStorage = (storageTypes) => {
75
+ return {
76
+ getItem(key) {
77
+ for (const storage of storageTypes) {
78
+ const value = storage.getItem(key);
79
+ if (value !== null) {
80
+ return value;
81
+ }
82
+ }
83
+ return null;
84
+ },
85
+ setItem(key, value) {
86
+ for (const storage of storageTypes) {
87
+ storage.setItem(key, value);
88
+ }
89
+ }
90
+ };
91
+ };
92
+ exports.getStateStorage = getStateStorage;
93
+ exports.localStateStorage = localStateStorage;
94
+ exports.nullStorage = nullStorage;
95
+ exports.sessionStateStorage = sessionStateStorage;
96
+ exports.urlStateStorage = urlStateStorage;
97
+ exports.useLocalStorageState = useLocalStorageState;
98
+ exports.useSessionStorageState = useSessionStorageState;
99
+ exports.useStoredState = useStoredState;
100
+ //# sourceMappingURL=useStoredState.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStoredState.cjs","sources":["../../../../../packages/react-utils/src/hooks/useStoredState.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react'\nimport { Serializable } from '../types'\n\nexport type SetState<V extends Serializable> = (value: V | ((current: V) => V)) => void\nexport type StateStorageKey = [uniquePrefix: string, key: string]\n\nexport type ValueInitializer<V extends Serializable> = (storedValue: V | undefined) => V\n\nexport interface StateStorage {\n\tgetItem(key: StateStorageKey): Serializable\n\n\tsetItem(key: StateStorageKey, value: Serializable): void\n}\n\nexport const urlStateStorage: StateStorage = {\n\tgetItem(key) {\n\t\tconst searchParams = new URLSearchParams(window.location.search)\n\t\tconst value = searchParams.get(key[1])\n\t\treturn value !== null && value !== undefined ? JSON.parse(value) : null\n\t},\n\tsetItem(key, value) {\n\t\tconst searchParams = new URLSearchParams(window.location.search)\n\t\tsearchParams.set(key[1], JSON.stringify(value))\n\t\tconst newUrl = `${window.location.pathname}?${searchParams.toString()}`\n\t\twindow.history.replaceState({}, '', newUrl)\n\t},\n}\n\nconst createStateStorageFromNativeStorage = (getStorage: () => Storage): StateStorage => {\n\treturn {\n\t\tgetItem(key) {\n\t\t\tconst value = getStorage().getItem(key.join('-'))\n\t\t\treturn value !== null ? JSON.parse(value) : null\n\t\t},\n\t\tsetItem(key, value) {\n\t\t\tgetStorage().setItem(key.join('-'), JSON.stringify(value))\n\t\t},\n\t}\n}\n\nexport const sessionStateStorage = createStateStorageFromNativeStorage(() => sessionStorage)\nexport const localStateStorage = createStateStorageFromNativeStorage(() => localStorage)\nexport const nullStorage: StateStorage = {\n\tgetItem() {\n\t\treturn null\n\t},\n\tsetItem() {\n\t},\n}\n\nconst builtInStorages = {\n\turl: urlStateStorage,\n\tsession: sessionStateStorage,\n\tlocal: localStateStorage,\n\tnull: nullStorage,\n}\n\nexport type StateStorageOrName = StateStorage | 'url' | 'session' | 'local' | 'null'\n\nexport const useStoredState = <V extends Serializable>(\n\tstorageOrName: StateStorageOrName | StateStorageOrName[],\n\tkey: StateStorageKey,\n\tinitializeValue: ValueInitializer<V>,\n): [V, SetState<V>] => {\n\tconst storage = useMemo(() => {\n\t\treturn getStateStorage(storageOrName)\n\t}, [storageOrName])\n\n\tconst [value, setValue] = useState<V>(() => {\n\t\tconst value = storage.getItem(key)\n\t\treturn initializeValue(value as V)\n\t})\n\treturn [\n\t\tvalue,\n\t\tuseCallback(value => {\n\t\t\tsetValue(current => {\n\t\t\t\tconst newValue = typeof value === 'function' ? (value as (current: V) => V)(current) : value\n\t\t\t\tstorage.setItem(key, newValue)\n\t\t\t\treturn newValue\n\t\t\t})\n\t\t}, [key, storage]),\n\t]\n}\n\nexport const useSessionStorageState = <V extends Serializable>(key: StateStorageKey, initializeValue: ValueInitializer<V>): [V, SetState<V>] => {\n\treturn useStoredState<V>(sessionStateStorage, key, initializeValue)\n}\n\nexport const useLocalStorageState = <V extends Serializable>(key: StateStorageKey, initializeValue: ValueInitializer<V>): [V, SetState<V>] => {\n\treturn useStoredState<V>(localStateStorage, key, initializeValue)\n}\n\nexport const getStateStorage = (storageOrName: StateStorageOrName | StateStorageOrName[]) => {\n\tif (Array.isArray(storageOrName)) {\n\t\treturn createFallbackStorage(storageOrName.map(it => typeof it === 'string' ? builtInStorages[it] : it))\n\t}\n\treturn typeof storageOrName === 'string' ? builtInStorages[storageOrName] : storageOrName\n}\n\nconst createFallbackStorage = (storageTypes: StateStorage[]): StateStorage => {\n\treturn {\n\t\tgetItem(key) {\n\t\t\tfor (const storage of storageTypes) {\n\t\t\t\tconst value = storage.getItem(key)\n\t\t\t\tif (value !== null) {\n\t\t\t\t\treturn value\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\t\tsetItem(key, value) {\n\t\t\tfor (const storage of storageTypes) {\n\t\t\t\tstorage.setItem(key, value)\n\t\t\t}\n\t\t},\n\t}\n}\n"],"names":["useMemo","useState","value","useCallback"],"mappings":"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"}
@@ -0,0 +1,100 @@
1
+ import { useMemo, useState, useCallback } from "react";
2
+ const urlStateStorage = {
3
+ getItem(key) {
4
+ const searchParams = new URLSearchParams(window.location.search);
5
+ const value = searchParams.get(key[1]);
6
+ return value !== null && value !== void 0 ? JSON.parse(value) : null;
7
+ },
8
+ setItem(key, value) {
9
+ const searchParams = new URLSearchParams(window.location.search);
10
+ searchParams.set(key[1], JSON.stringify(value));
11
+ const newUrl = `${window.location.pathname}?${searchParams.toString()}`;
12
+ window.history.replaceState({}, "", newUrl);
13
+ }
14
+ };
15
+ const createStateStorageFromNativeStorage = (getStorage) => {
16
+ return {
17
+ getItem(key) {
18
+ const value = getStorage().getItem(key.join("-"));
19
+ return value !== null ? JSON.parse(value) : null;
20
+ },
21
+ setItem(key, value) {
22
+ getStorage().setItem(key.join("-"), JSON.stringify(value));
23
+ }
24
+ };
25
+ };
26
+ const sessionStateStorage = createStateStorageFromNativeStorage(() => sessionStorage);
27
+ const localStateStorage = createStateStorageFromNativeStorage(() => localStorage);
28
+ const nullStorage = {
29
+ getItem() {
30
+ return null;
31
+ },
32
+ setItem() {
33
+ }
34
+ };
35
+ const builtInStorages = {
36
+ url: urlStateStorage,
37
+ session: sessionStateStorage,
38
+ local: localStateStorage,
39
+ null: nullStorage
40
+ };
41
+ const useStoredState = (storageOrName, key, initializeValue) => {
42
+ const storage = useMemo(() => {
43
+ return getStateStorage(storageOrName);
44
+ }, [storageOrName]);
45
+ const [value, setValue] = useState(() => {
46
+ const value2 = storage.getItem(key);
47
+ return initializeValue(value2);
48
+ });
49
+ return [
50
+ value,
51
+ useCallback((value2) => {
52
+ setValue((current) => {
53
+ const newValue = typeof value2 === "function" ? value2(current) : value2;
54
+ storage.setItem(key, newValue);
55
+ return newValue;
56
+ });
57
+ }, [key, storage])
58
+ ];
59
+ };
60
+ const useSessionStorageState = (key, initializeValue) => {
61
+ return useStoredState(sessionStateStorage, key, initializeValue);
62
+ };
63
+ const useLocalStorageState = (key, initializeValue) => {
64
+ return useStoredState(localStateStorage, key, initializeValue);
65
+ };
66
+ const getStateStorage = (storageOrName) => {
67
+ if (Array.isArray(storageOrName)) {
68
+ return createFallbackStorage(storageOrName.map((it) => typeof it === "string" ? builtInStorages[it] : it));
69
+ }
70
+ return typeof storageOrName === "string" ? builtInStorages[storageOrName] : storageOrName;
71
+ };
72
+ const createFallbackStorage = (storageTypes) => {
73
+ return {
74
+ getItem(key) {
75
+ for (const storage of storageTypes) {
76
+ const value = storage.getItem(key);
77
+ if (value !== null) {
78
+ return value;
79
+ }
80
+ }
81
+ return null;
82
+ },
83
+ setItem(key, value) {
84
+ for (const storage of storageTypes) {
85
+ storage.setItem(key, value);
86
+ }
87
+ }
88
+ };
89
+ };
90
+ export {
91
+ getStateStorage,
92
+ localStateStorage,
93
+ nullStorage,
94
+ sessionStateStorage,
95
+ urlStateStorage,
96
+ useLocalStorageState,
97
+ useSessionStorageState,
98
+ useStoredState
99
+ };
100
+ //# sourceMappingURL=useStoredState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStoredState.js","sources":["../../../../../packages/react-utils/src/hooks/useStoredState.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react'\nimport { Serializable } from '../types'\n\nexport type SetState<V extends Serializable> = (value: V | ((current: V) => V)) => void\nexport type StateStorageKey = [uniquePrefix: string, key: string]\n\nexport type ValueInitializer<V extends Serializable> = (storedValue: V | undefined) => V\n\nexport interface StateStorage {\n\tgetItem(key: StateStorageKey): Serializable\n\n\tsetItem(key: StateStorageKey, value: Serializable): void\n}\n\nexport const urlStateStorage: StateStorage = {\n\tgetItem(key) {\n\t\tconst searchParams = new URLSearchParams(window.location.search)\n\t\tconst value = searchParams.get(key[1])\n\t\treturn value !== null && value !== undefined ? JSON.parse(value) : null\n\t},\n\tsetItem(key, value) {\n\t\tconst searchParams = new URLSearchParams(window.location.search)\n\t\tsearchParams.set(key[1], JSON.stringify(value))\n\t\tconst newUrl = `${window.location.pathname}?${searchParams.toString()}`\n\t\twindow.history.replaceState({}, '', newUrl)\n\t},\n}\n\nconst createStateStorageFromNativeStorage = (getStorage: () => Storage): StateStorage => {\n\treturn {\n\t\tgetItem(key) {\n\t\t\tconst value = getStorage().getItem(key.join('-'))\n\t\t\treturn value !== null ? JSON.parse(value) : null\n\t\t},\n\t\tsetItem(key, value) {\n\t\t\tgetStorage().setItem(key.join('-'), JSON.stringify(value))\n\t\t},\n\t}\n}\n\nexport const sessionStateStorage = createStateStorageFromNativeStorage(() => sessionStorage)\nexport const localStateStorage = createStateStorageFromNativeStorage(() => localStorage)\nexport const nullStorage: StateStorage = {\n\tgetItem() {\n\t\treturn null\n\t},\n\tsetItem() {\n\t},\n}\n\nconst builtInStorages = {\n\turl: urlStateStorage,\n\tsession: sessionStateStorage,\n\tlocal: localStateStorage,\n\tnull: nullStorage,\n}\n\nexport type StateStorageOrName = StateStorage | 'url' | 'session' | 'local' | 'null'\n\nexport const useStoredState = <V extends Serializable>(\n\tstorageOrName: StateStorageOrName | StateStorageOrName[],\n\tkey: StateStorageKey,\n\tinitializeValue: ValueInitializer<V>,\n): [V, SetState<V>] => {\n\tconst storage = useMemo(() => {\n\t\treturn getStateStorage(storageOrName)\n\t}, [storageOrName])\n\n\tconst [value, setValue] = useState<V>(() => {\n\t\tconst value = storage.getItem(key)\n\t\treturn initializeValue(value as V)\n\t})\n\treturn [\n\t\tvalue,\n\t\tuseCallback(value => {\n\t\t\tsetValue(current => {\n\t\t\t\tconst newValue = typeof value === 'function' ? (value as (current: V) => V)(current) : value\n\t\t\t\tstorage.setItem(key, newValue)\n\t\t\t\treturn newValue\n\t\t\t})\n\t\t}, [key, storage]),\n\t]\n}\n\nexport const useSessionStorageState = <V extends Serializable>(key: StateStorageKey, initializeValue: ValueInitializer<V>): [V, SetState<V>] => {\n\treturn useStoredState<V>(sessionStateStorage, key, initializeValue)\n}\n\nexport const useLocalStorageState = <V extends Serializable>(key: StateStorageKey, initializeValue: ValueInitializer<V>): [V, SetState<V>] => {\n\treturn useStoredState<V>(localStateStorage, key, initializeValue)\n}\n\nexport const getStateStorage = (storageOrName: StateStorageOrName | StateStorageOrName[]) => {\n\tif (Array.isArray(storageOrName)) {\n\t\treturn createFallbackStorage(storageOrName.map(it => typeof it === 'string' ? builtInStorages[it] : it))\n\t}\n\treturn typeof storageOrName === 'string' ? builtInStorages[storageOrName] : storageOrName\n}\n\nconst createFallbackStorage = (storageTypes: StateStorage[]): StateStorage => {\n\treturn {\n\t\tgetItem(key) {\n\t\t\tfor (const storage of storageTypes) {\n\t\t\t\tconst value = storage.getItem(key)\n\t\t\t\tif (value !== null) {\n\t\t\t\t\treturn value\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\t\tsetItem(key, value) {\n\t\t\tfor (const storage of storageTypes) {\n\t\t\t\tstorage.setItem(key, value)\n\t\t\t}\n\t\t},\n\t}\n}\n"],"names":["value"],"mappings":"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"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const React = require("react");
4
+ function useUpdatedRef(value) {
5
+ const ref = React.useRef(value);
6
+ ref.current = value;
7
+ return ref;
8
+ }
9
+ exports.useUpdatedRef = useUpdatedRef;
10
+ //# sourceMappingURL=useUpdatedRef.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUpdatedRef.cjs","sources":["../../../../../packages/react-utils/src/hooks/useUpdatedRef.ts"],"sourcesContent":["import { useRef } from 'react'\n\n/**\n * Returns a stable mutable object with value that is updated upon each call\n *\n * @param value - Value that could update after initial call\n * @returns Mutable ref object with updated value\n */\nexport function useUpdatedRef<T>(value: T) {\n\tconst ref = useRef(value)\n\tref.current = value\n\n\treturn ref\n}\n"],"names":["useRef"],"mappings":";;;AAQO,SAAS,cAAiB,OAAU;AAC1C,QAAM,MAAMA,MAAAA,OAAO,KAAK;AACxB,MAAI,UAAU;AAEd,SAAO;AACR;;"}
@@ -0,0 +1,10 @@
1
+ import { useRef } from "react";
2
+ function useUpdatedRef(value) {
3
+ const ref = useRef(value);
4
+ ref.current = value;
5
+ return ref;
6
+ }
7
+ export {
8
+ useUpdatedRef
9
+ };
10
+ //# sourceMappingURL=useUpdatedRef.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUpdatedRef.js","sources":["../../../../../packages/react-utils/src/hooks/useUpdatedRef.ts"],"sourcesContent":["import { useRef } from 'react'\n\n/**\n * Returns a stable mutable object with value that is updated upon each call\n *\n * @param value - Value that could update after initial call\n * @returns Mutable ref object with updated value\n */\nexport function useUpdatedRef<T>(value: T) {\n\tconst ref = useRef(value)\n\tref.current = value\n\n\treturn ref\n}\n"],"names":[],"mappings":";AAQO,SAAS,cAAiB,OAAU;AAC1C,QAAM,MAAM,OAAO,KAAK;AACxB,MAAI,UAAU;AAEd,SAAO;AACR;"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const React = require("react");
4
+ const useOnWindowResize = require("./useOnWindowResize.cjs");
5
+ function useWindowSize() {
6
+ const [width, setWidth] = React.useState(window.innerWidth);
7
+ const [height, setHeight] = React.useState(window.innerHeight);
8
+ useOnWindowResize.useOnWindowResize(() => {
9
+ const { innerHeight, innerWidth } = window;
10
+ if (innerHeight !== height) {
11
+ setHeight(innerHeight);
12
+ }
13
+ if (innerWidth !== width) {
14
+ setWidth(innerWidth);
15
+ }
16
+ });
17
+ return React.useMemo(() => ({ height, width }), [height, width]);
18
+ }
19
+ exports.useWindowSize = useWindowSize;
20
+ //# sourceMappingURL=useWindowSize.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWindowSize.cjs","sources":["../../../../../packages/react-utils/src/hooks/useWindowSize.ts"],"sourcesContent":["import { useMemo, useState } from 'react'\nimport { useOnWindowResize } from './useOnWindowResize'\n\nexport function useWindowSize() {\n\tconst [width, setWidth] = useState(window.innerWidth)\n\tconst [height, setHeight] = useState(window.innerHeight)\n\n\tuseOnWindowResize(() => {\n\t\tconst { innerHeight, innerWidth } = window\n\t\tif (innerHeight !== height) {\n\t\t\tsetHeight(innerHeight)\n\t\t}\n\n\t\tif (innerWidth !== width) {\n\t\t\tsetWidth(innerWidth)\n\t\t}\n\t})\n\n\treturn useMemo(() => ({ height, width }), [height, width])\n}\n"],"names":["useState","useOnWindowResize","useMemo"],"mappings":";;;;AAGO,SAAS,gBAAgB;AAC/B,QAAM,CAAC,OAAO,QAAQ,IAAIA,MAAAA,SAAS,OAAO,UAAU;AACpD,QAAM,CAAC,QAAQ,SAAS,IAAIA,MAAAA,SAAS,OAAO,WAAW;AAEvDC,oBAAAA,kBAAkB,MAAM;AACvB,UAAM,EAAE,aAAa,WAAA,IAAe;AACpC,QAAI,gBAAgB,QAAQ;AAC3B,gBAAU,WAAW;AAAA,IACtB;AAEA,QAAI,eAAe,OAAO;AACzB,eAAS,UAAU;AAAA,IACpB;AAAA,EACD,CAAC;AAED,SAAOC,MAAAA,QAAQ,OAAO,EAAE,QAAQ,UAAU,CAAC,QAAQ,KAAK,CAAC;AAC1D;;"}
@@ -0,0 +1,20 @@
1
+ import { useState, useMemo } from "react";
2
+ import { useOnWindowResize } from "./useOnWindowResize.js";
3
+ function useWindowSize() {
4
+ const [width, setWidth] = useState(window.innerWidth);
5
+ const [height, setHeight] = useState(window.innerHeight);
6
+ useOnWindowResize(() => {
7
+ const { innerHeight, innerWidth } = window;
8
+ if (innerHeight !== height) {
9
+ setHeight(innerHeight);
10
+ }
11
+ if (innerWidth !== width) {
12
+ setWidth(innerWidth);
13
+ }
14
+ });
15
+ return useMemo(() => ({ height, width }), [height, width]);
16
+ }
17
+ export {
18
+ useWindowSize
19
+ };
20
+ //# sourceMappingURL=useWindowSize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWindowSize.js","sources":["../../../../../packages/react-utils/src/hooks/useWindowSize.ts"],"sourcesContent":["import { useMemo, useState } from 'react'\nimport { useOnWindowResize } from './useOnWindowResize'\n\nexport function useWindowSize() {\n\tconst [width, setWidth] = useState(window.innerWidth)\n\tconst [height, setHeight] = useState(window.innerHeight)\n\n\tuseOnWindowResize(() => {\n\t\tconst { innerHeight, innerWidth } = window\n\t\tif (innerHeight !== height) {\n\t\t\tsetHeight(innerHeight)\n\t\t}\n\n\t\tif (innerWidth !== width) {\n\t\t\tsetWidth(innerWidth)\n\t\t}\n\t})\n\n\treturn useMemo(() => ({ height, width }), [height, width])\n}\n"],"names":[],"mappings":";;AAGO,SAAS,gBAAgB;AAC/B,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,OAAO,UAAU;AACpD,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,OAAO,WAAW;AAEvD,oBAAkB,MAAM;AACvB,UAAM,EAAE,aAAa,WAAA,IAAe;AACpC,QAAI,gBAAgB,QAAQ;AAC3B,gBAAU,WAAW;AAAA,IACtB;AAEA,QAAI,eAAe,OAAO;AACzB,eAAS,UAAU;AAAA,IACpB;AAAA,EACD,CAAC;AAED,SAAO,QAAQ,OAAO,EAAE,QAAQ,UAAU,CAAC,QAAQ,KAAK,CAAC;AAC1D;"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const emptyArray = Object.freeze([]);
4
+ exports.emptyArray = emptyArray;
5
+ //# sourceMappingURL=emptyArray.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emptyArray.cjs","sources":["../../../../../packages/react-utils/src/referentiallyStable/emptyArray.ts"],"sourcesContent":["export const emptyArray = Object.freeze<any>([]) as any[]\n"],"names":[],"mappings":";;AAAO,MAAM,aAAa,OAAO,OAAY,CAAA,CAAE;;"}
@@ -0,0 +1,5 @@
1
+ const emptyArray = Object.freeze([]);
2
+ export {
3
+ emptyArray
4
+ };
5
+ //# sourceMappingURL=emptyArray.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emptyArray.js","sources":["../../../../../packages/react-utils/src/referentiallyStable/emptyArray.ts"],"sourcesContent":["export const emptyArray = Object.freeze<any>([]) as any[]\n"],"names":[],"mappings":"AAAO,MAAM,aAAa,OAAO,OAAY,CAAA,CAAE;"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const emptyObject = Object.freeze({});
4
+ exports.emptyObject = emptyObject;
5
+ //# sourceMappingURL=emptyObject.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emptyObject.cjs","sources":["../../../../../packages/react-utils/src/referentiallyStable/emptyObject.ts"],"sourcesContent":["export const emptyObject = Object.freeze({})\n"],"names":[],"mappings":";;AAAO,MAAM,cAAc,OAAO,OAAO,CAAA,CAAE;;"}
@@ -0,0 +1,5 @@
1
+ const emptyObject = Object.freeze({});
2
+ export {
3
+ emptyObject
4
+ };
5
+ //# sourceMappingURL=emptyObject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emptyObject.js","sources":["../../../../../packages/react-utils/src/referentiallyStable/emptyObject.ts"],"sourcesContent":["export const emptyObject = Object.freeze({})\n"],"names":[],"mappings":"AAAO,MAAM,cAAc,OAAO,OAAO,CAAA,CAAE;"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const identityFunction = (value) => value;
4
+ exports.identityFunction = identityFunction;
5
+ //# sourceMappingURL=identityFunction.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identityFunction.cjs","sources":["../../../../../packages/react-utils/src/referentiallyStable/identityFunction.ts"],"sourcesContent":["export const identityFunction = <Value>(value: Value) => value\n"],"names":[],"mappings":";;AAAO,MAAM,mBAAmB,CAAQ,UAAiB;;"}
@@ -0,0 +1,5 @@
1
+ const identityFunction = (value) => value;
2
+ export {
3
+ identityFunction
4
+ };
5
+ //# sourceMappingURL=identityFunction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identityFunction.js","sources":["../../../../../packages/react-utils/src/referentiallyStable/identityFunction.ts"],"sourcesContent":["export const identityFunction = <Value>(value: Value) => value\n"],"names":[],"mappings":"AAAO,MAAM,mBAAmB,CAAQ,UAAiB;"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const noop = () => void 0;
4
+ exports.noop = noop;
5
+ //# sourceMappingURL=noop.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noop.cjs","sources":["../../../../../packages/react-utils/src/referentiallyStable/noop.ts"],"sourcesContent":["export const noop = () => undefined\n"],"names":[],"mappings":";;AAAO,MAAM,OAAO,MAAM;;"}
@@ -0,0 +1,5 @@
1
+ const noop = () => void 0;
2
+ export {
3
+ noop
4
+ };
5
+ //# sourceMappingURL=noop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noop.js","sources":["../../../../../packages/react-utils/src/referentiallyStable/noop.ts"],"sourcesContent":["export const noop = () => undefined\n"],"names":[],"mappings":"AAAO,MAAM,OAAO,MAAM;"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const returnFalse = () => false;
4
+ exports.returnFalse = returnFalse;
5
+ //# sourceMappingURL=returnFalse.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"returnFalse.cjs","sources":["../../../../../packages/react-utils/src/referentiallyStable/returnFalse.ts"],"sourcesContent":["export const returnFalse = () => false\n"],"names":[],"mappings":";;AAAO,MAAM,cAAc,MAAM;;"}
@@ -0,0 +1,5 @@
1
+ const returnFalse = () => false;
2
+ export {
3
+ returnFalse
4
+ };
5
+ //# sourceMappingURL=returnFalse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"returnFalse.js","sources":["../../../../../packages/react-utils/src/referentiallyStable/returnFalse.ts"],"sourcesContent":["export const returnFalse = () => false\n"],"names":[],"mappings":"AAAO,MAAM,cAAc,MAAM;"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const returnTrue = () => true;
4
+ exports.returnTrue = returnTrue;
5
+ //# sourceMappingURL=returnTrue.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"returnTrue.cjs","sources":["../../../../../packages/react-utils/src/referentiallyStable/returnTrue.ts"],"sourcesContent":["export const returnTrue = () => true\n"],"names":[],"mappings":";;AAAO,MAAM,aAAa,MAAM;;"}
@@ -0,0 +1,5 @@
1
+ const returnTrue = () => true;
2
+ export {
3
+ returnTrue
4
+ };
5
+ //# sourceMappingURL=returnTrue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"returnTrue.js","sources":["../../../../../packages/react-utils/src/referentiallyStable/returnTrue.ts"],"sourcesContent":["export const returnTrue = () => true\n"],"names":[],"mappings":"AAAO,MAAM,aAAa,MAAM;"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const React = require("react");
4
+ const useReferentiallyStableCallback = (callback) => {
5
+ const ref = React.useRef(callback);
6
+ ref.current = callback;
7
+ return React.useCallback(
8
+ ((...args) => {
9
+ return ref.current(...args);
10
+ }),
11
+ []
12
+ );
13
+ };
14
+ exports.useReferentiallyStableCallback = useReferentiallyStableCallback;
15
+ //# sourceMappingURL=useReferentiallyStableCallback.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReferentiallyStableCallback.cjs","sources":["../../../../../packages/react-utils/src/referentiallyStable/useReferentiallyStableCallback.ts"],"sourcesContent":["import { useCallback, useRef } from 'react'\n\nexport type NoConstructor<T extends Function> = T extends new(...args: unknown[]) => unknown ? never\n\t: T\n// TODO: Should be possible to remove when React.useEvent() lands\nexport const useReferentiallyStableCallback = <T extends Function>(callback: NoConstructor<T>): T => {\n\tconst ref = useRef(callback)\n\tref.current = callback\n\treturn useCallback<T>(\n\t\t((...args: any[]) => {\n\t\t\treturn ref.current(...args)\n\t\t}) as unknown as T,\n\t\t[],\n\t)\n}\n"],"names":["useRef","useCallback"],"mappings":";;;AAKO,MAAM,iCAAiC,CAAqB,aAAkC;AACpG,QAAM,MAAMA,MAAAA,OAAO,QAAQ;AAC3B,MAAI,UAAU;AACd,SAAOC,MAAAA;AAAAA,KACL,IAAI,SAAgB;AACpB,aAAO,IAAI,QAAQ,GAAG,IAAI;AAAA,IAC3B;AAAA,IACA,CAAA;AAAA,EAAC;AAEH;;"}
@@ -0,0 +1,15 @@
1
+ import { useRef, useCallback } from "react";
2
+ const useReferentiallyStableCallback = (callback) => {
3
+ const ref = useRef(callback);
4
+ ref.current = callback;
5
+ return useCallback(
6
+ ((...args) => {
7
+ return ref.current(...args);
8
+ }),
9
+ []
10
+ );
11
+ };
12
+ export {
13
+ useReferentiallyStableCallback
14
+ };
15
+ //# sourceMappingURL=useReferentiallyStableCallback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReferentiallyStableCallback.js","sources":["../../../../../packages/react-utils/src/referentiallyStable/useReferentiallyStableCallback.ts"],"sourcesContent":["import { useCallback, useRef } from 'react'\n\nexport type NoConstructor<T extends Function> = T extends new(...args: unknown[]) => unknown ? never\n\t: T\n// TODO: Should be possible to remove when React.useEvent() lands\nexport const useReferentiallyStableCallback = <T extends Function>(callback: NoConstructor<T>): T => {\n\tconst ref = useRef(callback)\n\tref.current = callback\n\treturn useCallback<T>(\n\t\t((...args: any[]) => {\n\t\t\treturn ref.current(...args)\n\t\t}) as unknown as T,\n\t\t[],\n\t)\n}\n"],"names":[],"mappings":";AAKO,MAAM,iCAAiC,CAAqB,aAAkC;AACpG,QAAM,MAAM,OAAO,QAAQ;AAC3B,MAAI,UAAU;AACd,SAAO;AAAA,KACL,IAAI,SAAgB;AACpB,aAAO,IAAI,QAAQ,GAAG,IAAI;AAAA,IAC3B;AAAA,IACA,CAAA;AAAA,EAAC;AAEH;"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const Context = require("./src/debug-context/Context.cjs");
4
+ const createContext = require("./src/context/createContext.cjs");
5
+ const createRequiredContext = require("./src/context/createRequiredContext.cjs");
6
+ const emptyArray = require("./src/referentiallyStable/emptyArray.cjs");
7
+ const emptyObject = require("./src/referentiallyStable/emptyObject.cjs");
8
+ const useChildrenAsLabel = require("./src/hooks/useChildrenAsLabel.cjs");
9
+ const useStoredState = require("./src/hooks/useStoredState.cjs");
10
+ const identityFunction = require("./src/referentiallyStable/identityFunction.cjs");
11
+ const Constants = require("./src/debug-context/Constants.cjs");
12
+ const noop = require("./src/referentiallyStable/noop.cjs");
13
+ const returnFalse = require("./src/referentiallyStable/returnFalse.cjs");
14
+ const returnTrue = require("./src/referentiallyStable/returnTrue.cjs");
15
+ const unwrapRefValue = require("./src/hooks/unwrapRefValue.cjs");
16
+ const useAbortController = require("./src/hooks/useAbortController.cjs");
17
+ const useArrayMapMemo = require("./src/hooks/useArrayMapMemo.cjs");
18
+ const useAutoHeightTextArea = require("./src/hooks/useAutoHeightTextArea.cjs");
19
+ const useComposeRef = require("./src/hooks/useComposeRef.cjs");
20
+ const useConstantLengthInvariant = require("./src/hooks/useConstantLengthInvariant.cjs");
21
+ const useConstantValueInvariant = require("./src/hooks/useConstantValueInvariant.cjs");
22
+ const useDebounce = require("./src/hooks/useDebounce.cjs");
23
+ const useDebounceCallback = require("./src/hooks/useDebounceCallback.cjs");
24
+ const useDocumentTitle = require("./src/hooks/useDocumentTitle.cjs");
25
+ const useExpectSameValueReference = require("./src/hooks/useExpectSameValueReference.cjs");
26
+ const useForceRender = require("./src/hooks/useForceRender.cjs");
27
+ const useId = require("./src/hooks/useId.cjs");
28
+ const useIsMounted = require("./src/hooks/useIsMounted.cjs");
29
+ const useObjectMemo = require("./src/hooks/useObjectMemo.cjs");
30
+ const useOnElementClickOutsideCallback = require("./src/hooks/useOnElementClickOutsideCallback.cjs");
31
+ const useOnElementMouseEnterDelayedCallback = require("./src/hooks/useOnElementMouseEnterDelayedCallback.cjs");
32
+ const useOnElementResize = require("./src/hooks/useOnElementResize.cjs");
33
+ const useOnWindowResize = require("./src/hooks/useOnWindowResize.cjs");
34
+ const usePreviousValue = require("./src/hooks/usePreviousValue.cjs");
35
+ const useReferentiallyStableCallback = require("./src/referentiallyStable/useReferentiallyStableCallback.cjs");
36
+ const useUpdatedRef = require("./src/hooks/useUpdatedRef.cjs");
37
+ const useWindowSize = require("./src/hooks/useWindowSize.cjs");
38
+ exports.DebugChildren = Context.DebugChildren;
39
+ exports.ScopedConsoleContext = Context.ScopedConsoleContext;
40
+ exports.useScopedConsoleRef = Context.useScopedConsoleRef;
41
+ exports.createContext = createContext.createContext;
42
+ exports.createRequiredContext = createRequiredContext.createRequiredContext;
43
+ exports.emptyArray = emptyArray.emptyArray;
44
+ exports.emptyObject = emptyObject.emptyObject;
45
+ exports.getChildrenAsLabel = useChildrenAsLabel.getChildrenAsLabel;
46
+ exports.useChildrenAsLabel = useChildrenAsLabel.useChildrenAsLabel;
47
+ exports.getStateStorage = useStoredState.getStateStorage;
48
+ exports.localStateStorage = useStoredState.localStateStorage;
49
+ exports.nullStorage = useStoredState.nullStorage;
50
+ exports.sessionStateStorage = useStoredState.sessionStateStorage;
51
+ exports.urlStateStorage = useStoredState.urlStateStorage;
52
+ exports.useLocalStorageState = useStoredState.useLocalStorageState;
53
+ exports.useSessionStorageState = useStoredState.useSessionStorageState;
54
+ exports.useStoredState = useStoredState.useStoredState;
55
+ exports.identityFunction = identityFunction.identityFunction;
56
+ exports.isNoopScopedConsole = Constants.isNoopScopedConsole;
57
+ exports.noopLog = Constants.noopLog;
58
+ exports.noopLogged = Constants.noopLogged;
59
+ exports.noopScopedConsole = Constants.noopScopedConsole;
60
+ exports.noop = noop.noop;
61
+ exports.returnFalse = returnFalse.returnFalse;
62
+ exports.returnTrue = returnTrue.returnTrue;
63
+ exports.unwrapRefValue = unwrapRefValue.unwrapRefValue;
64
+ exports.useAbortController = useAbortController.useAbortController;
65
+ exports.useArrayMapMemo = useArrayMapMemo.useArrayMapMemo;
66
+ exports.useAutoHeightTextArea = useAutoHeightTextArea.useAutoHeightTextArea;
67
+ exports.useComposeRef = useComposeRef.useComposeRef;
68
+ exports.useConstantLengthInvariant = useConstantLengthInvariant.useConstantLengthInvariant;
69
+ exports.useConstantValueInvariant = useConstantValueInvariant.useConstantValueInvariant;
70
+ exports.useDebounce = useDebounce.useDebounce;
71
+ exports.useDebounceCallback = useDebounceCallback.useDebounceCallback;
72
+ exports.useDocumentTitle = useDocumentTitle.useDocumentTitle;
73
+ exports.useExpectSameValueReference = useExpectSameValueReference.useExpectSameValueReference;
74
+ exports.useForceRender = useForceRender.useForceRender;
75
+ exports.useId = useId.useId;
76
+ exports.useIsMounted = useIsMounted.useIsMounted;
77
+ exports.useObjectMemo = useObjectMemo.useObjectMemo;
78
+ exports.useOnElementClickOutsideCallback = useOnElementClickOutsideCallback.useOnElementClickOutsideCallback;
79
+ exports.useOnElementMouseEnterDelayedCallback = useOnElementMouseEnterDelayedCallback.useOnElementMouseEnterDelayedCallback;
80
+ exports.useOnElementResize = useOnElementResize.useOnElementResize;
81
+ exports.useOnWindowResize = useOnWindowResize.useOnWindowResize;
82
+ exports.usePreviousValue = usePreviousValue.usePreviousValue;
83
+ exports.useReferentiallyStableCallback = useReferentiallyStableCallback.useReferentiallyStableCallback;
84
+ exports.useUpdatedRef = useUpdatedRef.useUpdatedRef;
85
+ exports.useWindowSize = useWindowSize.useWindowSize;
86
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}