@contember/react-utils 2.1.0-alpha.3 → 2.1.0-alpha.35

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 (395) hide show
  1. package/package.json +11 -3
  2. package/src/debug-context/Constants.ts +1 -1
  3. package/src/debug-context/Context.tsx +13 -13
  4. package/src/hooks/unwrapRefValue.ts +1 -1
  5. package/src/hooks/useArrayMapMemo.ts +2 -2
  6. package/src/hooks/useAutoHeightTextArea.ts +1 -0
  7. package/src/hooks/useChildrenAsLabel.ts +7 -8
  8. package/src/hooks/useConstantLengthInvariant.ts +1 -3
  9. package/src/hooks/useConstantValueInvariant.ts +0 -1
  10. package/src/hooks/useDebounceCallback.ts +1 -1
  11. package/src/hooks/useExpectSameValueReference.ts +9 -6
  12. package/src/hooks/useOnElementMouseEnterDelayedCallback.ts +1 -1
  13. package/src/hooks/useOnElementResize.ts +2 -1
  14. package/src/hooks/useOnWindowResize.ts +3 -1
  15. package/src/hooks/useStoredState.ts +5 -3
  16. package/src/referentiallyStable/useReferentiallyStableCallback.ts +9 -5
  17. package/tests/hooks/useChildrenAsLabel.test.tsx +1 -0
  18. package/tests/hooks/useId.test.ts +1 -1
  19. package/dist/development/index.cjs +0 -86
  20. package/dist/development/index.cjs.map +0 -1
  21. package/dist/development/index.js +0 -86
  22. package/dist/development/index.js.map +0 -1
  23. package/dist/development/src/context/createContext.cjs +0 -10
  24. package/dist/development/src/context/createContext.cjs.map +0 -1
  25. package/dist/development/src/context/createContext.js +0 -10
  26. package/dist/development/src/context/createContext.js.map +0 -1
  27. package/dist/development/src/context/createRequiredContext.cjs +0 -18
  28. package/dist/development/src/context/createRequiredContext.cjs.map +0 -1
  29. package/dist/development/src/context/createRequiredContext.js +0 -18
  30. package/dist/development/src/context/createRequiredContext.js.map +0 -1
  31. package/dist/development/src/debug-context/Constants.cjs +0 -25
  32. package/dist/development/src/debug-context/Constants.cjs.map +0 -1
  33. package/dist/development/src/debug-context/Constants.js +0 -25
  34. package/dist/development/src/debug-context/Constants.js.map +0 -1
  35. package/dist/development/src/debug-context/Context.cjs +0 -72
  36. package/dist/development/src/debug-context/Context.cjs.map +0 -1
  37. package/dist/development/src/debug-context/Context.js +0 -72
  38. package/dist/development/src/debug-context/Context.js.map +0 -1
  39. package/dist/development/src/hooks/unwrapRefValue.cjs +0 -11
  40. package/dist/development/src/hooks/unwrapRefValue.cjs.map +0 -1
  41. package/dist/development/src/hooks/unwrapRefValue.js +0 -11
  42. package/dist/development/src/hooks/unwrapRefValue.js.map +0 -1
  43. package/dist/development/src/hooks/useAbortController.cjs +0 -17
  44. package/dist/development/src/hooks/useAbortController.cjs.map +0 -1
  45. package/dist/development/src/hooks/useAbortController.js +0 -17
  46. package/dist/development/src/hooks/useAbortController.js.map +0 -1
  47. package/dist/development/src/hooks/useArrayMapMemo.cjs +0 -11
  48. package/dist/development/src/hooks/useArrayMapMemo.cjs.map +0 -1
  49. package/dist/development/src/hooks/useArrayMapMemo.js +0 -11
  50. package/dist/development/src/hooks/useArrayMapMemo.js.map +0 -1
  51. package/dist/development/src/hooks/useAutoHeightTextArea.cjs +0 -43
  52. package/dist/development/src/hooks/useAutoHeightTextArea.cjs.map +0 -1
  53. package/dist/development/src/hooks/useAutoHeightTextArea.js +0 -43
  54. package/dist/development/src/hooks/useAutoHeightTextArea.js.map +0 -1
  55. package/dist/development/src/hooks/useChildrenAsLabel.cjs +0 -52
  56. package/dist/development/src/hooks/useChildrenAsLabel.cjs.map +0 -1
  57. package/dist/development/src/hooks/useChildrenAsLabel.js +0 -52
  58. package/dist/development/src/hooks/useChildrenAsLabel.js.map +0 -1
  59. package/dist/development/src/hooks/useComposeRef.cjs +0 -31
  60. package/dist/development/src/hooks/useComposeRef.cjs.map +0 -1
  61. package/dist/development/src/hooks/useComposeRef.js +0 -31
  62. package/dist/development/src/hooks/useComposeRef.js.map +0 -1
  63. package/dist/development/src/hooks/useConstantLengthInvariant.cjs +0 -15
  64. package/dist/development/src/hooks/useConstantLengthInvariant.cjs.map +0 -1
  65. package/dist/development/src/hooks/useConstantLengthInvariant.js +0 -15
  66. package/dist/development/src/hooks/useConstantLengthInvariant.js.map +0 -1
  67. package/dist/development/src/hooks/useConstantValueInvariant.cjs +0 -15
  68. package/dist/development/src/hooks/useConstantValueInvariant.cjs.map +0 -1
  69. package/dist/development/src/hooks/useConstantValueInvariant.js +0 -15
  70. package/dist/development/src/hooks/useConstantValueInvariant.js.map +0 -1
  71. package/dist/development/src/hooks/useDebounce.cjs +0 -15
  72. package/dist/development/src/hooks/useDebounce.cjs.map +0 -1
  73. package/dist/development/src/hooks/useDebounce.js +0 -15
  74. package/dist/development/src/hooks/useDebounce.js.map +0 -1
  75. package/dist/development/src/hooks/useDebounceCallback.cjs +0 -19
  76. package/dist/development/src/hooks/useDebounceCallback.cjs.map +0 -1
  77. package/dist/development/src/hooks/useDebounceCallback.js +0 -19
  78. package/dist/development/src/hooks/useDebounceCallback.js.map +0 -1
  79. package/dist/development/src/hooks/useDocumentTitle.cjs +0 -22
  80. package/dist/development/src/hooks/useDocumentTitle.cjs.map +0 -1
  81. package/dist/development/src/hooks/useDocumentTitle.js +0 -22
  82. package/dist/development/src/hooks/useDocumentTitle.js.map +0 -1
  83. package/dist/development/src/hooks/useExpectSameValueReference.cjs +0 -24
  84. package/dist/development/src/hooks/useExpectSameValueReference.cjs.map +0 -1
  85. package/dist/development/src/hooks/useExpectSameValueReference.js +0 -24
  86. package/dist/development/src/hooks/useExpectSameValueReference.js.map +0 -1
  87. package/dist/development/src/hooks/useForceRender.cjs +0 -9
  88. package/dist/development/src/hooks/useForceRender.cjs.map +0 -1
  89. package/dist/development/src/hooks/useForceRender.js +0 -9
  90. package/dist/development/src/hooks/useForceRender.js.map +0 -1
  91. package/dist/development/src/hooks/useId.cjs +0 -13
  92. package/dist/development/src/hooks/useId.cjs.map +0 -1
  93. package/dist/development/src/hooks/useId.js +0 -13
  94. package/dist/development/src/hooks/useId.js.map +0 -1
  95. package/dist/development/src/hooks/useIsMounted.cjs +0 -18
  96. package/dist/development/src/hooks/useIsMounted.cjs.map +0 -1
  97. package/dist/development/src/hooks/useIsMounted.js +0 -18
  98. package/dist/development/src/hooks/useIsMounted.js.map +0 -1
  99. package/dist/development/src/hooks/useObjectMemo.cjs +0 -27
  100. package/dist/development/src/hooks/useObjectMemo.cjs.map +0 -1
  101. package/dist/development/src/hooks/useObjectMemo.js +0 -27
  102. package/dist/development/src/hooks/useObjectMemo.js.map +0 -1
  103. package/dist/development/src/hooks/useOnElementClickOutsideCallback.cjs +0 -20
  104. package/dist/development/src/hooks/useOnElementClickOutsideCallback.cjs.map +0 -1
  105. package/dist/development/src/hooks/useOnElementClickOutsideCallback.js +0 -20
  106. package/dist/development/src/hooks/useOnElementClickOutsideCallback.js.map +0 -1
  107. package/dist/development/src/hooks/useOnElementMouseEnterDelayedCallback.cjs +0 -33
  108. package/dist/development/src/hooks/useOnElementMouseEnterDelayedCallback.cjs.map +0 -1
  109. package/dist/development/src/hooks/useOnElementMouseEnterDelayedCallback.js +0 -33
  110. package/dist/development/src/hooks/useOnElementMouseEnterDelayedCallback.js.map +0 -1
  111. package/dist/development/src/hooks/useOnElementResize.cjs +0 -42
  112. package/dist/development/src/hooks/useOnElementResize.cjs.map +0 -1
  113. package/dist/development/src/hooks/useOnElementResize.js +0 -42
  114. package/dist/development/src/hooks/useOnElementResize.js.map +0 -1
  115. package/dist/development/src/hooks/useOnWindowResize.cjs +0 -36
  116. package/dist/development/src/hooks/useOnWindowResize.cjs.map +0 -1
  117. package/dist/development/src/hooks/useOnWindowResize.js +0 -36
  118. package/dist/development/src/hooks/useOnWindowResize.js.map +0 -1
  119. package/dist/development/src/hooks/usePreviousValue.cjs +0 -12
  120. package/dist/development/src/hooks/usePreviousValue.cjs.map +0 -1
  121. package/dist/development/src/hooks/usePreviousValue.js +0 -12
  122. package/dist/development/src/hooks/usePreviousValue.js.map +0 -1
  123. package/dist/development/src/hooks/useStoredState.cjs +0 -100
  124. package/dist/development/src/hooks/useStoredState.cjs.map +0 -1
  125. package/dist/development/src/hooks/useStoredState.js +0 -100
  126. package/dist/development/src/hooks/useStoredState.js.map +0 -1
  127. package/dist/development/src/hooks/useUpdatedRef.cjs +0 -10
  128. package/dist/development/src/hooks/useUpdatedRef.cjs.map +0 -1
  129. package/dist/development/src/hooks/useUpdatedRef.js +0 -10
  130. package/dist/development/src/hooks/useUpdatedRef.js.map +0 -1
  131. package/dist/development/src/hooks/useWindowSize.cjs +0 -20
  132. package/dist/development/src/hooks/useWindowSize.cjs.map +0 -1
  133. package/dist/development/src/hooks/useWindowSize.js +0 -20
  134. package/dist/development/src/hooks/useWindowSize.js.map +0 -1
  135. package/dist/development/src/referentiallyStable/emptyArray.cjs +0 -5
  136. package/dist/development/src/referentiallyStable/emptyArray.cjs.map +0 -1
  137. package/dist/development/src/referentiallyStable/emptyArray.js +0 -5
  138. package/dist/development/src/referentiallyStable/emptyArray.js.map +0 -1
  139. package/dist/development/src/referentiallyStable/emptyObject.cjs +0 -5
  140. package/dist/development/src/referentiallyStable/emptyObject.cjs.map +0 -1
  141. package/dist/development/src/referentiallyStable/emptyObject.js +0 -5
  142. package/dist/development/src/referentiallyStable/emptyObject.js.map +0 -1
  143. package/dist/development/src/referentiallyStable/identityFunction.cjs +0 -5
  144. package/dist/development/src/referentiallyStable/identityFunction.cjs.map +0 -1
  145. package/dist/development/src/referentiallyStable/identityFunction.js +0 -5
  146. package/dist/development/src/referentiallyStable/identityFunction.js.map +0 -1
  147. package/dist/development/src/referentiallyStable/noop.cjs +0 -5
  148. package/dist/development/src/referentiallyStable/noop.cjs.map +0 -1
  149. package/dist/development/src/referentiallyStable/noop.js +0 -5
  150. package/dist/development/src/referentiallyStable/noop.js.map +0 -1
  151. package/dist/development/src/referentiallyStable/returnFalse.cjs +0 -5
  152. package/dist/development/src/referentiallyStable/returnFalse.cjs.map +0 -1
  153. package/dist/development/src/referentiallyStable/returnFalse.js +0 -5
  154. package/dist/development/src/referentiallyStable/returnFalse.js.map +0 -1
  155. package/dist/development/src/referentiallyStable/returnTrue.cjs +0 -5
  156. package/dist/development/src/referentiallyStable/returnTrue.cjs.map +0 -1
  157. package/dist/development/src/referentiallyStable/returnTrue.js +0 -5
  158. package/dist/development/src/referentiallyStable/returnTrue.js.map +0 -1
  159. package/dist/development/src/referentiallyStable/useReferentiallyStableCallback.cjs +0 -12
  160. package/dist/development/src/referentiallyStable/useReferentiallyStableCallback.cjs.map +0 -1
  161. package/dist/development/src/referentiallyStable/useReferentiallyStableCallback.js +0 -12
  162. package/dist/development/src/referentiallyStable/useReferentiallyStableCallback.js.map +0 -1
  163. package/dist/production/index.cjs +0 -86
  164. package/dist/production/index.cjs.map +0 -1
  165. package/dist/production/index.js +0 -86
  166. package/dist/production/index.js.map +0 -1
  167. package/dist/production/src/context/createContext.cjs +0 -10
  168. package/dist/production/src/context/createContext.cjs.map +0 -1
  169. package/dist/production/src/context/createContext.js +0 -10
  170. package/dist/production/src/context/createContext.js.map +0 -1
  171. package/dist/production/src/context/createRequiredContext.cjs +0 -18
  172. package/dist/production/src/context/createRequiredContext.cjs.map +0 -1
  173. package/dist/production/src/context/createRequiredContext.js +0 -18
  174. package/dist/production/src/context/createRequiredContext.js.map +0 -1
  175. package/dist/production/src/debug-context/Constants.cjs +0 -25
  176. package/dist/production/src/debug-context/Constants.cjs.map +0 -1
  177. package/dist/production/src/debug-context/Constants.js +0 -25
  178. package/dist/production/src/debug-context/Constants.js.map +0 -1
  179. package/dist/production/src/debug-context/Context.cjs +0 -68
  180. package/dist/production/src/debug-context/Context.cjs.map +0 -1
  181. package/dist/production/src/debug-context/Context.js +0 -68
  182. package/dist/production/src/debug-context/Context.js.map +0 -1
  183. package/dist/production/src/hooks/unwrapRefValue.cjs +0 -11
  184. package/dist/production/src/hooks/unwrapRefValue.cjs.map +0 -1
  185. package/dist/production/src/hooks/unwrapRefValue.js +0 -11
  186. package/dist/production/src/hooks/unwrapRefValue.js.map +0 -1
  187. package/dist/production/src/hooks/useAbortController.cjs +0 -17
  188. package/dist/production/src/hooks/useAbortController.cjs.map +0 -1
  189. package/dist/production/src/hooks/useAbortController.js +0 -17
  190. package/dist/production/src/hooks/useAbortController.js.map +0 -1
  191. package/dist/production/src/hooks/useArrayMapMemo.cjs +0 -9
  192. package/dist/production/src/hooks/useArrayMapMemo.cjs.map +0 -1
  193. package/dist/production/src/hooks/useArrayMapMemo.js +0 -9
  194. package/dist/production/src/hooks/useArrayMapMemo.js.map +0 -1
  195. package/dist/production/src/hooks/useAutoHeightTextArea.cjs +0 -43
  196. package/dist/production/src/hooks/useAutoHeightTextArea.cjs.map +0 -1
  197. package/dist/production/src/hooks/useAutoHeightTextArea.js +0 -43
  198. package/dist/production/src/hooks/useAutoHeightTextArea.js.map +0 -1
  199. package/dist/production/src/hooks/useChildrenAsLabel.cjs +0 -50
  200. package/dist/production/src/hooks/useChildrenAsLabel.cjs.map +0 -1
  201. package/dist/production/src/hooks/useChildrenAsLabel.js +0 -50
  202. package/dist/production/src/hooks/useChildrenAsLabel.js.map +0 -1
  203. package/dist/production/src/hooks/useComposeRef.cjs +0 -31
  204. package/dist/production/src/hooks/useComposeRef.cjs.map +0 -1
  205. package/dist/production/src/hooks/useComposeRef.js +0 -31
  206. package/dist/production/src/hooks/useComposeRef.js.map +0 -1
  207. package/dist/production/src/hooks/useConstantLengthInvariant.cjs +0 -6
  208. package/dist/production/src/hooks/useConstantLengthInvariant.cjs.map +0 -1
  209. package/dist/production/src/hooks/useConstantLengthInvariant.js +0 -6
  210. package/dist/production/src/hooks/useConstantLengthInvariant.js.map +0 -1
  211. package/dist/production/src/hooks/useConstantValueInvariant.cjs +0 -6
  212. package/dist/production/src/hooks/useConstantValueInvariant.cjs.map +0 -1
  213. package/dist/production/src/hooks/useConstantValueInvariant.js +0 -6
  214. package/dist/production/src/hooks/useConstantValueInvariant.js.map +0 -1
  215. package/dist/production/src/hooks/useDebounce.cjs +0 -15
  216. package/dist/production/src/hooks/useDebounce.cjs.map +0 -1
  217. package/dist/production/src/hooks/useDebounce.js +0 -15
  218. package/dist/production/src/hooks/useDebounce.js.map +0 -1
  219. package/dist/production/src/hooks/useDebounceCallback.cjs +0 -19
  220. package/dist/production/src/hooks/useDebounceCallback.cjs.map +0 -1
  221. package/dist/production/src/hooks/useDebounceCallback.js +0 -19
  222. package/dist/production/src/hooks/useDebounceCallback.js.map +0 -1
  223. package/dist/production/src/hooks/useDocumentTitle.cjs +0 -22
  224. package/dist/production/src/hooks/useDocumentTitle.cjs.map +0 -1
  225. package/dist/production/src/hooks/useDocumentTitle.js +0 -22
  226. package/dist/production/src/hooks/useDocumentTitle.js.map +0 -1
  227. package/dist/production/src/hooks/useExpectSameValueReference.cjs +0 -15
  228. package/dist/production/src/hooks/useExpectSameValueReference.cjs.map +0 -1
  229. package/dist/production/src/hooks/useExpectSameValueReference.js +0 -15
  230. package/dist/production/src/hooks/useExpectSameValueReference.js.map +0 -1
  231. package/dist/production/src/hooks/useForceRender.cjs +0 -9
  232. package/dist/production/src/hooks/useForceRender.cjs.map +0 -1
  233. package/dist/production/src/hooks/useForceRender.js +0 -9
  234. package/dist/production/src/hooks/useForceRender.js.map +0 -1
  235. package/dist/production/src/hooks/useId.cjs +0 -13
  236. package/dist/production/src/hooks/useId.cjs.map +0 -1
  237. package/dist/production/src/hooks/useId.js +0 -13
  238. package/dist/production/src/hooks/useId.js.map +0 -1
  239. package/dist/production/src/hooks/useIsMounted.cjs +0 -18
  240. package/dist/production/src/hooks/useIsMounted.cjs.map +0 -1
  241. package/dist/production/src/hooks/useIsMounted.js +0 -18
  242. package/dist/production/src/hooks/useIsMounted.js.map +0 -1
  243. package/dist/production/src/hooks/useObjectMemo.cjs +0 -27
  244. package/dist/production/src/hooks/useObjectMemo.cjs.map +0 -1
  245. package/dist/production/src/hooks/useObjectMemo.js +0 -27
  246. package/dist/production/src/hooks/useObjectMemo.js.map +0 -1
  247. package/dist/production/src/hooks/useOnElementClickOutsideCallback.cjs +0 -20
  248. package/dist/production/src/hooks/useOnElementClickOutsideCallback.cjs.map +0 -1
  249. package/dist/production/src/hooks/useOnElementClickOutsideCallback.js +0 -20
  250. package/dist/production/src/hooks/useOnElementClickOutsideCallback.js.map +0 -1
  251. package/dist/production/src/hooks/useOnElementMouseEnterDelayedCallback.cjs +0 -33
  252. package/dist/production/src/hooks/useOnElementMouseEnterDelayedCallback.cjs.map +0 -1
  253. package/dist/production/src/hooks/useOnElementMouseEnterDelayedCallback.js +0 -33
  254. package/dist/production/src/hooks/useOnElementMouseEnterDelayedCallback.js.map +0 -1
  255. package/dist/production/src/hooks/useOnElementResize.cjs +0 -42
  256. package/dist/production/src/hooks/useOnElementResize.cjs.map +0 -1
  257. package/dist/production/src/hooks/useOnElementResize.js +0 -42
  258. package/dist/production/src/hooks/useOnElementResize.js.map +0 -1
  259. package/dist/production/src/hooks/useOnWindowResize.cjs +0 -36
  260. package/dist/production/src/hooks/useOnWindowResize.cjs.map +0 -1
  261. package/dist/production/src/hooks/useOnWindowResize.js +0 -36
  262. package/dist/production/src/hooks/useOnWindowResize.js.map +0 -1
  263. package/dist/production/src/hooks/usePreviousValue.cjs +0 -12
  264. package/dist/production/src/hooks/usePreviousValue.cjs.map +0 -1
  265. package/dist/production/src/hooks/usePreviousValue.js +0 -12
  266. package/dist/production/src/hooks/usePreviousValue.js.map +0 -1
  267. package/dist/production/src/hooks/useStoredState.cjs +0 -100
  268. package/dist/production/src/hooks/useStoredState.cjs.map +0 -1
  269. package/dist/production/src/hooks/useStoredState.js +0 -100
  270. package/dist/production/src/hooks/useStoredState.js.map +0 -1
  271. package/dist/production/src/hooks/useUpdatedRef.cjs +0 -10
  272. package/dist/production/src/hooks/useUpdatedRef.cjs.map +0 -1
  273. package/dist/production/src/hooks/useUpdatedRef.js +0 -10
  274. package/dist/production/src/hooks/useUpdatedRef.js.map +0 -1
  275. package/dist/production/src/hooks/useWindowSize.cjs +0 -20
  276. package/dist/production/src/hooks/useWindowSize.cjs.map +0 -1
  277. package/dist/production/src/hooks/useWindowSize.js +0 -20
  278. package/dist/production/src/hooks/useWindowSize.js.map +0 -1
  279. package/dist/production/src/referentiallyStable/emptyArray.cjs +0 -5
  280. package/dist/production/src/referentiallyStable/emptyArray.cjs.map +0 -1
  281. package/dist/production/src/referentiallyStable/emptyArray.js +0 -5
  282. package/dist/production/src/referentiallyStable/emptyArray.js.map +0 -1
  283. package/dist/production/src/referentiallyStable/emptyObject.cjs +0 -5
  284. package/dist/production/src/referentiallyStable/emptyObject.cjs.map +0 -1
  285. package/dist/production/src/referentiallyStable/emptyObject.js +0 -5
  286. package/dist/production/src/referentiallyStable/emptyObject.js.map +0 -1
  287. package/dist/production/src/referentiallyStable/identityFunction.cjs +0 -5
  288. package/dist/production/src/referentiallyStable/identityFunction.cjs.map +0 -1
  289. package/dist/production/src/referentiallyStable/identityFunction.js +0 -5
  290. package/dist/production/src/referentiallyStable/identityFunction.js.map +0 -1
  291. package/dist/production/src/referentiallyStable/noop.cjs +0 -5
  292. package/dist/production/src/referentiallyStable/noop.cjs.map +0 -1
  293. package/dist/production/src/referentiallyStable/noop.js +0 -5
  294. package/dist/production/src/referentiallyStable/noop.js.map +0 -1
  295. package/dist/production/src/referentiallyStable/returnFalse.cjs +0 -5
  296. package/dist/production/src/referentiallyStable/returnFalse.cjs.map +0 -1
  297. package/dist/production/src/referentiallyStable/returnFalse.js +0 -5
  298. package/dist/production/src/referentiallyStable/returnFalse.js.map +0 -1
  299. package/dist/production/src/referentiallyStable/returnTrue.cjs +0 -5
  300. package/dist/production/src/referentiallyStable/returnTrue.cjs.map +0 -1
  301. package/dist/production/src/referentiallyStable/returnTrue.js +0 -5
  302. package/dist/production/src/referentiallyStable/returnTrue.js.map +0 -1
  303. package/dist/production/src/referentiallyStable/useReferentiallyStableCallback.cjs +0 -12
  304. package/dist/production/src/referentiallyStable/useReferentiallyStableCallback.cjs.map +0 -1
  305. package/dist/production/src/referentiallyStable/useReferentiallyStableCallback.js +0 -12
  306. package/dist/production/src/referentiallyStable/useReferentiallyStableCallback.js.map +0 -1
  307. package/dist/types/context/createContext.d.ts +0 -3
  308. package/dist/types/context/createContext.d.ts.map +0 -1
  309. package/dist/types/context/createRequiredContext.d.ts +0 -3
  310. package/dist/types/context/createRequiredContext.d.ts.map +0 -1
  311. package/dist/types/context/index.d.ts +0 -3
  312. package/dist/types/context/index.d.ts.map +0 -1
  313. package/dist/types/debug-context/Constants.d.ts +0 -6
  314. package/dist/types/debug-context/Constants.d.ts.map +0 -1
  315. package/dist/types/debug-context/Context.d.ts +0 -15
  316. package/dist/types/debug-context/Context.d.ts.map +0 -1
  317. package/dist/types/debug-context/Types.d.ts +0 -13
  318. package/dist/types/debug-context/Types.d.ts.map +0 -1
  319. package/dist/types/debug-context/index.d.ts +0 -4
  320. package/dist/types/debug-context/index.d.ts.map +0 -1
  321. package/dist/types/hooks/index.d.ts +0 -25
  322. package/dist/types/hooks/index.d.ts.map +0 -1
  323. package/dist/types/hooks/unwrapRefValue.d.ts +0 -9
  324. package/dist/types/hooks/unwrapRefValue.d.ts.map +0 -1
  325. package/dist/types/hooks/useAbortController.d.ts +0 -2
  326. package/dist/types/hooks/useAbortController.d.ts.map +0 -1
  327. package/dist/types/hooks/useArrayMapMemo.d.ts +0 -10
  328. package/dist/types/hooks/useArrayMapMemo.d.ts.map +0 -1
  329. package/dist/types/hooks/useAutoHeightTextArea.d.ts +0 -3
  330. package/dist/types/hooks/useAutoHeightTextArea.d.ts.map +0 -1
  331. package/dist/types/hooks/useChildrenAsLabel.d.ts +0 -18
  332. package/dist/types/hooks/useChildrenAsLabel.d.ts.map +0 -1
  333. package/dist/types/hooks/useComposeRef.d.ts +0 -16
  334. package/dist/types/hooks/useComposeRef.d.ts.map +0 -1
  335. package/dist/types/hooks/useConstantLengthInvariant.d.ts +0 -2
  336. package/dist/types/hooks/useConstantLengthInvariant.d.ts.map +0 -1
  337. package/dist/types/hooks/useConstantValueInvariant.d.ts +0 -2
  338. package/dist/types/hooks/useConstantValueInvariant.d.ts.map +0 -1
  339. package/dist/types/hooks/useDebounce.d.ts +0 -2
  340. package/dist/types/hooks/useDebounce.d.ts.map +0 -1
  341. package/dist/types/hooks/useDebounceCallback.d.ts +0 -2
  342. package/dist/types/hooks/useDebounceCallback.d.ts.map +0 -1
  343. package/dist/types/hooks/useDocumentTitle.d.ts +0 -2
  344. package/dist/types/hooks/useDocumentTitle.d.ts.map +0 -1
  345. package/dist/types/hooks/useExpectSameValueReference.d.ts +0 -24
  346. package/dist/types/hooks/useExpectSameValueReference.d.ts.map +0 -1
  347. package/dist/types/hooks/useForceRender.d.ts +0 -2
  348. package/dist/types/hooks/useForceRender.d.ts.map +0 -1
  349. package/dist/types/hooks/useId.d.ts +0 -10
  350. package/dist/types/hooks/useId.d.ts.map +0 -1
  351. package/dist/types/hooks/useIsMounted.d.ts +0 -2
  352. package/dist/types/hooks/useIsMounted.d.ts.map +0 -1
  353. package/dist/types/hooks/useObjectMemo.d.ts +0 -2
  354. package/dist/types/hooks/useObjectMemo.d.ts.map +0 -1
  355. package/dist/types/hooks/useOnElementClickOutsideCallback.d.ts +0 -3
  356. package/dist/types/hooks/useOnElementClickOutsideCallback.d.ts.map +0 -1
  357. package/dist/types/hooks/useOnElementMouseEnterDelayedCallback.d.ts +0 -14
  358. package/dist/types/hooks/useOnElementMouseEnterDelayedCallback.d.ts.map +0 -1
  359. package/dist/types/hooks/useOnElementResize.d.ts +0 -3
  360. package/dist/types/hooks/useOnElementResize.d.ts.map +0 -1
  361. package/dist/types/hooks/useOnWindowResize.d.ts +0 -2
  362. package/dist/types/hooks/useOnWindowResize.d.ts.map +0 -1
  363. package/dist/types/hooks/usePreviousValue.d.ts +0 -2
  364. package/dist/types/hooks/usePreviousValue.d.ts.map +0 -1
  365. package/dist/types/hooks/useStoredState.d.ts +0 -18
  366. package/dist/types/hooks/useStoredState.d.ts.map +0 -1
  367. package/dist/types/hooks/useUpdatedRef.d.ts +0 -8
  368. package/dist/types/hooks/useUpdatedRef.d.ts.map +0 -1
  369. package/dist/types/hooks/useWindowSize.d.ts +0 -5
  370. package/dist/types/hooks/useWindowSize.d.ts.map +0 -1
  371. package/dist/types/index.d.ts +0 -6
  372. package/dist/types/index.d.ts.map +0 -1
  373. package/dist/types/referentiallyStable/emptyArray.d.ts +0 -2
  374. package/dist/types/referentiallyStable/emptyArray.d.ts.map +0 -1
  375. package/dist/types/referentiallyStable/emptyObject.d.ts +0 -2
  376. package/dist/types/referentiallyStable/emptyObject.d.ts.map +0 -1
  377. package/dist/types/referentiallyStable/identityFunction.d.ts +0 -2
  378. package/dist/types/referentiallyStable/identityFunction.d.ts.map +0 -1
  379. package/dist/types/referentiallyStable/index.d.ts +0 -8
  380. package/dist/types/referentiallyStable/index.d.ts.map +0 -1
  381. package/dist/types/referentiallyStable/noop.d.ts +0 -2
  382. package/dist/types/referentiallyStable/noop.d.ts.map +0 -1
  383. package/dist/types/referentiallyStable/returnFalse.d.ts +0 -2
  384. package/dist/types/referentiallyStable/returnFalse.d.ts.map +0 -1
  385. package/dist/types/referentiallyStable/returnTrue.d.ts +0 -2
  386. package/dist/types/referentiallyStable/returnTrue.d.ts.map +0 -1
  387. package/dist/types/referentiallyStable/useReferentiallyStableCallback.d.ts +0 -2
  388. package/dist/types/referentiallyStable/useReferentiallyStableCallback.d.ts.map +0 -1
  389. package/dist/types/tsconfig.tsbuildinfo +0 -1
  390. package/dist/types/types/PropsWithRequiredChildren.d.ts +0 -5
  391. package/dist/types/types/PropsWithRequiredChildren.d.ts.map +0 -1
  392. package/dist/types/types/Serializable.d.ts +0 -4
  393. package/dist/types/types/Serializable.d.ts.map +0 -1
  394. package/dist/types/types/index.d.ts +0 -3
  395. package/dist/types/types/index.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@contember/react-utils",
3
3
  "license": "Apache-2.0",
4
- "version": "2.1.0-alpha.3",
4
+ "version": "2.1.0-alpha.35",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "main": "./dist/production/index.js",
@@ -29,9 +29,17 @@
29
29
  "ae:test": "api-extractor run"
30
30
  },
31
31
  "peerDependencies": {
32
- "react": "^18 || ^19"
32
+ "react": "catalog:"
33
+ },
34
+ "devDependencies": {
35
+ "@testing-library/react": "catalog:"
33
36
  },
34
37
  "dependencies": {
35
- "fast-deep-equal": "^3.1.3"
38
+ "fast-deep-equal": "catalog:"
39
+ },
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "git+https://github.com/contember/contember.git",
43
+ "directory": "packages/react-utils"
36
44
  }
37
45
  }
@@ -1,6 +1,6 @@
1
1
  import type { ScopedConsoleContextType } from './Types'
2
2
 
3
- export function noopLog(...parameters: any[]) { }
3
+ export function noopLog(...parameters: any[]) {}
4
4
 
5
5
  export function noopLogged<T>(message: string, value: T): T {
6
6
  return value
@@ -1,35 +1,35 @@
1
- import { ReactNode, createContext, memo, useContext, useMemo, useRef } from 'react'
1
+ import { createContext, memo, ReactNode, useContext, useMemo, useRef } from 'react'
2
2
  import { isNoopScopedConsole, noopScopedConsole } from './Constants'
3
3
  import { ScopedConsoleContextType } from './Types'
4
4
 
5
5
  function createPrefixedConsole(message: string, prefixedConsole?: ScopedConsoleContextType): ScopedConsoleContextType {
6
6
  return {
7
7
  error: function error(...parameters: any[]) {
8
- (prefixedConsole ?? console).error(message, ...parameters)
8
+ ;(prefixedConsole ?? console).error(message, ...parameters)
9
9
  },
10
- errored: function errored<T>(message: string, value: T): T {
11
- (prefixedConsole ?? console).error(message, value)
10
+ errored: function errored<T,>(message: string, value: T): T {
11
+ ;(prefixedConsole ?? console).error(message, value)
12
12
  return value
13
13
  },
14
14
  log: function log(...parameters: any[]) {
15
- (prefixedConsole ?? console).log(message, ...parameters)
15
+ ;(prefixedConsole ?? console).log(message, ...parameters)
16
16
  },
17
- logged: function logged<T>(message: string, value: T): T {
18
- (prefixedConsole ?? console).log(message, value)
17
+ logged: function logged<T,>(message: string, value: T): T {
18
+ ;(prefixedConsole ?? console).log(message, value)
19
19
  return value
20
20
  },
21
21
  trace: function trace(...parameters: any[]) {
22
- (prefixedConsole ?? console).trace(message, ...parameters)
22
+ ;(prefixedConsole ?? console).trace(message, ...parameters)
23
23
  },
24
- traced: function traced<T>(message: string, value: T): T {
25
- (prefixedConsole ?? console).trace(message, value)
24
+ traced: function traced<T,>(message: string, value: T): T {
25
+ ;(prefixedConsole ?? console).trace(message, value)
26
26
  return value
27
27
  },
28
28
  warn: function warn(...parameters: any[]) {
29
- (prefixedConsole ?? console).warn(message, ...parameters)
29
+ ;(prefixedConsole ?? console).warn(message, ...parameters)
30
30
  },
31
- warned: function warned<T>(message: string, value: T): T {
32
- (prefixedConsole ?? console).warn(message, value)
31
+ warned: function warned<T,>(message: string, value: T): T {
32
+ ;(prefixedConsole ?? console).warn(message, value)
33
33
  return value
34
34
  },
35
35
  }
@@ -1,6 +1,6 @@
1
1
  import { RefObject } from 'react'
2
2
 
3
- export type RefObjectOrElement<T> = T | RefObject<T>
3
+ export type RefObjectOrElement<T> = T | RefObject<T | null>
4
4
 
5
5
  /**
6
6
  * Unwraps a ref object or returns the value if it is not a ref object.
@@ -20,9 +20,9 @@ export const useArrayMapMemo = <Item, OutputItem>(
20
20
  // in the sense that the items are identical, albeit computed via a different map function, we still want to
21
21
  // preserve the referential equality of the original. Hence the second memo.
22
22
 
23
- // eslint-disable-next-line react-hooks/exhaustive-deps
23
+ // biome-ignore lint/correctness/useExhaustiveDependencies: intentional
24
24
  const mapped = useMemo(() => items.map(map), [map, ...items])
25
25
 
26
- // eslint-disable-next-line react-hooks/exhaustive-deps
26
+ // biome-ignore lint/correctness/useExhaustiveDependencies: intentional
27
27
  return useMemo(() => mapped, mapped) // This is deliberately not `[mapped]`
28
28
  }
@@ -48,6 +48,7 @@ export const useAutoHeightTextArea = (
48
48
  measure(unwrapRefValue(textAreaRef), minRows, maxRows)
49
49
  })
50
50
 
51
+ // biome-ignore lint/correctness/useExhaustiveDependencies: intentional
51
52
  useLayoutEffect(() => {
52
53
  measure(unwrapRefValue(textAreaRef), minRows, maxRows)
53
54
  }, [maxRows, measure, minRows, textAreaRef, value])
@@ -11,7 +11,6 @@ function normalize(text: string): string {
11
11
  *
12
12
  * @param node - The children to walk through.
13
13
  * @returns String representation of the text content or undefined if there is no text content.
14
- *
15
14
  */
16
15
  export function getChildrenAsLabel(node: ReactNode): string | undefined {
17
16
  if (typeof node === 'string' || typeof node === 'number') {
@@ -27,18 +26,19 @@ export function getChildrenAsLabel(node: ReactNode): string | undefined {
27
26
  if (child === null || child === undefined || typeof child === 'boolean') {
28
27
  } else if (typeof child === 'string') {
29
28
  label.push(child)
30
- } else if (typeof child === 'number') {
31
- label.push(child)
29
+ } else if (typeof child === 'number' || typeof child === 'bigint') {
30
+ label.push(String(child))
32
31
  } else if (Array.isArray(child)) {
33
32
  const childLabel = getChildrenAsLabel(child)
34
33
 
35
34
  if (childLabel) {
36
35
  label.push(childLabel)
37
36
  }
38
- } else {
39
- // ReactElement | JSXElementConstructor | ReactPortal
40
- if ('props' in child && 'children' in child.props) {
41
- const childLabel = getChildrenAsLabel(child.props.children)
37
+ } else if (typeof child === 'object') {
38
+ // ReactElement | ReactPortal | Iterable
39
+ const props = 'props' in child ? child.props as Record<string, unknown> : null
40
+ if (props && 'children' in props) {
41
+ const childLabel = getChildrenAsLabel(props.children as ReactNode)
42
42
 
43
43
  if (childLabel) {
44
44
  label.push(childLabel)
@@ -65,7 +65,6 @@ export function getChildrenAsLabel(node: ReactNode): string | undefined {
65
65
  *
66
66
  * @param node - The children to walk through.
67
67
  * @returns String representation of the text content or undefined if there is no text content.
68
- *
69
68
  */
70
69
  export function useChildrenAsLabel(node: ReactNode): string | undefined {
71
70
  return useMemo(() => getChildrenAsLabel(node), [node])
@@ -3,12 +3,10 @@ import { usePreviousValue } from './usePreviousValue'
3
3
  // This entire hook should get optimized away for prod
4
4
  export const useConstantLengthInvariant = <Item>(items: Item[], message?: string) => {
5
5
  if (import.meta.env.DEV) {
6
- // eslint-disable-next-line react-hooks/rules-of-hooks
7
6
  const previous = usePreviousValue(items)
8
7
  if (previous.length !== items.length) {
9
8
  throw new Error(
10
- `Invariant violation: ${message || 'Changing the length of an array whose length must remain constant between renders.'
11
- }`,
9
+ `Invariant violation: ${message || 'Changing the length of an array whose length must remain constant between renders.'}`,
12
10
  )
13
11
  }
14
12
  }
@@ -3,7 +3,6 @@ import { usePreviousValue } from './usePreviousValue'
3
3
  // This entire hook should get optimized away for prod
4
4
  export const useConstantValueInvariant = <Value>(value: Value, message?: string) => {
5
5
  if (import.meta.env.DEV) {
6
- // eslint-disable-next-line react-hooks/rules-of-hooks
7
6
  const previous = usePreviousValue(value)
8
7
  if (previous !== value) {
9
8
  throw new Error(
@@ -1,7 +1,7 @@
1
1
  import { useCallback, useEffect, useRef } from 'react'
2
2
 
3
3
  export const useDebounceCallback = (cb: () => any, debounceMs: number) => {
4
- const timerRef = useRef<ReturnType<typeof setTimeout>>()
4
+ const timerRef = useRef<ReturnType<typeof setTimeout>>(undefined)
5
5
  const cbRef = useRef(cb)
6
6
  cbRef.current = cb
7
7
 
@@ -26,20 +26,23 @@ import { useRef } from 'react'
26
26
  export function useExpectSameValueReference<T>(next: T, shouldThrow: boolean = false) {
27
27
  const previous = useRef(next)
28
28
 
29
- if (next !== previous.current
29
+ if (
30
+ next !== previous.current
30
31
  && typeof next === 'object'
31
32
  && typeof previous.current === 'object'
32
33
  && deepEqual(next, previous.current)
33
34
  ) {
34
35
  if (import.meta.env.DEV) {
35
36
  console.error(
36
- 'Previous and next values do not match in reference although match in value. ' +
37
- 'Try declaring constants outside of the component scope. ' +
38
- 'Otherwise try to memoize callbacks with useCallback, ' +
39
- 'useReferentiallyStableCallback useEvent, useRef or useMemo.', {
37
+ 'Previous and next values do not match in reference although match in value. '
38
+ + 'Try declaring constants outside of the component scope. '
39
+ + 'Otherwise try to memoize callbacks with useCallback, '
40
+ + 'useReferentiallyStableCallback useEvent, useRef or useMemo.',
41
+ {
40
42
  previous: previous.current,
41
43
  next,
42
- })
44
+ },
45
+ )
43
46
  }
44
47
 
45
48
  if (shouldThrow) {
@@ -21,7 +21,7 @@ export function useOnElementMouseEnterDelayedCallback(
21
21
  const refValue = unwrapRefValue(refOrElement)
22
22
 
23
23
  if (refValue) {
24
- let timeoutID: ReturnType<typeof setTimeout> | undefined = undefined
24
+ let timeoutID: ReturnType<typeof setTimeout> | undefined
25
25
 
26
26
  function handleMouseEnter(event: MouseEvent) {
27
27
  clearTimeout(timeoutID)
@@ -11,7 +11,8 @@ export function useOnElementResize(
11
11
  const scopedConsoleRef = useScopedConsoleRef('useOnElementResize')
12
12
 
13
13
  const { box = 'border-box' } = options
14
- const callbackRef = useRef(callback); callbackRef.current = callback
14
+ const callbackRef = useRef(callback)
15
+ callbackRef.current = callback
15
16
  const lastTimeStamp = useRef<number>(0)
16
17
 
17
18
  useLayoutEffect(() => {
@@ -7,9 +7,11 @@ export function useOnWindowResize(
7
7
  ) {
8
8
  const scopedConsoleRef = useScopedConsoleRef('useOnWindowResize')
9
9
 
10
- const callbackRef = useRef(callback); callbackRef.current = callback
10
+ const callbackRef = useRef(callback)
11
+ callbackRef.current = callback
11
12
  const lastTimeStamp = useRef<number>(0)
12
13
 
14
+ // biome-ignore lint/correctness/useExhaustiveDependencies: intentional
13
15
  useLayoutEffect(() => {
14
16
  let timeoutID: ReturnType<typeof setTimeout>
15
17
 
@@ -12,7 +12,6 @@ export interface StateStorage {
12
12
  setItem(key: StateStorageKey, value: Serializable): void
13
13
  }
14
14
 
15
-
16
15
  export const urlStateStorage: StateStorage = {
17
16
  getItem(key) {
18
17
  const searchParams = new URLSearchParams(window.location.search)
@@ -58,7 +57,11 @@ const builtInStorages = {
58
57
 
59
58
  export type StateStorageOrName = StateStorage | 'url' | 'session' | 'local' | 'null'
60
59
 
61
- export const useStoredState = <V extends Serializable>(storageOrName: StateStorageOrName | StateStorageOrName[], key: StateStorageKey, initializeValue: ValueInitializer<V>): [V, SetState<V>] => {
60
+ export const useStoredState = <V extends Serializable>(
61
+ storageOrName: StateStorageOrName | StateStorageOrName[],
62
+ key: StateStorageKey,
63
+ initializeValue: ValueInitializer<V>,
64
+ ): [V, SetState<V>] => {
62
65
  const storage = useMemo(() => {
63
66
  return getStateStorage(storageOrName)
64
67
  }, [storageOrName])
@@ -94,7 +97,6 @@ export const getStateStorage = (storageOrName: StateStorageOrName | StateStorage
94
97
  return typeof storageOrName === 'string' ? builtInStorages[storageOrName] : storageOrName
95
98
  }
96
99
 
97
-
98
100
  const createFallbackStorage = (storageTypes: StateStorage[]): StateStorage => {
99
101
  return {
100
102
  getItem(key) {
@@ -1,11 +1,15 @@
1
1
  import { useCallback, useRef } from 'react'
2
2
 
3
+ export type NoConstructor<T extends Function> = T extends new(...args: unknown[]) => unknown ? never
4
+ : T
3
5
  // TODO: Should be possible to remove when React.useEvent() lands
4
- export const useReferentiallyStableCallback = <T extends (...args: any[]) => any>(callback: T): T => {
6
+ export const useReferentiallyStableCallback = <T extends Function>(callback: NoConstructor<T>): T => {
5
7
  const ref = useRef(callback)
6
8
  ref.current = callback
7
- // eslint-disable-next-line react-hooks/exhaustive-deps
8
- return useCallback<T>(((...args: any[]) => {
9
- return ref.current(...args)
10
- }) as T, [])
9
+ return useCallback<T>(
10
+ ((...args: any[]) => {
11
+ return ref.current(...args)
12
+ }) as unknown as T,
13
+ [],
14
+ )
11
15
  }
@@ -1,3 +1,4 @@
1
+ // dprint-ignore-file
1
2
  import { createPortal } from 'react-dom'
2
3
  import { describe, expect, it } from 'bun:test'
3
4
  import { getChildrenAsLabel } from '../../src'
@@ -1,4 +1,4 @@
1
- import { renderHook } from '@testing-library/react-hooks'
1
+ import { renderHook } from '@testing-library/react'
2
2
  import { describe, expect, test } from 'bun:test'
3
3
  import { useId } from '../../src'
4
4
 
@@ -1,86 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const createRequiredContext = require("./src/context/createRequiredContext.cjs");
4
- const createContext = require("./src/context/createContext.cjs");
5
- const Constants = require("./src/debug-context/Constants.cjs");
6
- const Context = require("./src/debug-context/Context.cjs");
7
- const unwrapRefValue = require("./src/hooks/unwrapRefValue.cjs");
8
- const useAbortController = require("./src/hooks/useAbortController.cjs");
9
- const useArrayMapMemo = require("./src/hooks/useArrayMapMemo.cjs");
10
- const useAutoHeightTextArea = require("./src/hooks/useAutoHeightTextArea.cjs");
11
- const useChildrenAsLabel = require("./src/hooks/useChildrenAsLabel.cjs");
12
- const useComposeRef = require("./src/hooks/useComposeRef.cjs");
13
- const useConstantLengthInvariant = require("./src/hooks/useConstantLengthInvariant.cjs");
14
- const useConstantValueInvariant = require("./src/hooks/useConstantValueInvariant.cjs");
15
- const useDebounce = require("./src/hooks/useDebounce.cjs");
16
- const useDebounceCallback = require("./src/hooks/useDebounceCallback.cjs");
17
- const useDocumentTitle = require("./src/hooks/useDocumentTitle.cjs");
18
- const useExpectSameValueReference = require("./src/hooks/useExpectSameValueReference.cjs");
19
- const useForceRender = require("./src/hooks/useForceRender.cjs");
20
- const useId = require("./src/hooks/useId.cjs");
21
- const useIsMounted = require("./src/hooks/useIsMounted.cjs");
22
- const useObjectMemo = require("./src/hooks/useObjectMemo.cjs");
23
- const useOnElementClickOutsideCallback = require("./src/hooks/useOnElementClickOutsideCallback.cjs");
24
- const useOnElementMouseEnterDelayedCallback = require("./src/hooks/useOnElementMouseEnterDelayedCallback.cjs");
25
- const useOnElementResize = require("./src/hooks/useOnElementResize.cjs");
26
- const useOnWindowResize = require("./src/hooks/useOnWindowResize.cjs");
27
- const usePreviousValue = require("./src/hooks/usePreviousValue.cjs");
28
- const useStoredState = require("./src/hooks/useStoredState.cjs");
29
- const useUpdatedRef = require("./src/hooks/useUpdatedRef.cjs");
30
- const useWindowSize = require("./src/hooks/useWindowSize.cjs");
31
- const emptyArray = require("./src/referentiallyStable/emptyArray.cjs");
32
- const emptyObject = require("./src/referentiallyStable/emptyObject.cjs");
33
- const identityFunction = require("./src/referentiallyStable/identityFunction.cjs");
34
- const noop = require("./src/referentiallyStable/noop.cjs");
35
- const returnFalse = require("./src/referentiallyStable/returnFalse.cjs");
36
- const returnTrue = require("./src/referentiallyStable/returnTrue.cjs");
37
- const useReferentiallyStableCallback = require("./src/referentiallyStable/useReferentiallyStableCallback.cjs");
38
- exports.createRequiredContext = createRequiredContext.createRequiredContext;
39
- exports.createContext = createContext.createContext;
40
- exports.isNoopScopedConsole = Constants.isNoopScopedConsole;
41
- exports.noopLog = Constants.noopLog;
42
- exports.noopLogged = Constants.noopLogged;
43
- exports.noopScopedConsole = Constants.noopScopedConsole;
44
- exports.DebugChildren = Context.DebugChildren;
45
- exports.ScopedConsoleContext = Context.ScopedConsoleContext;
46
- exports.useScopedConsoleRef = Context.useScopedConsoleRef;
47
- exports.unwrapRefValue = unwrapRefValue.unwrapRefValue;
48
- exports.useAbortController = useAbortController.useAbortController;
49
- exports.useArrayMapMemo = useArrayMapMemo.useArrayMapMemo;
50
- exports.useAutoHeightTextArea = useAutoHeightTextArea.useAutoHeightTextArea;
51
- exports.getChildrenAsLabel = useChildrenAsLabel.getChildrenAsLabel;
52
- exports.useChildrenAsLabel = useChildrenAsLabel.useChildrenAsLabel;
53
- exports.useComposeRef = useComposeRef.useComposeRef;
54
- exports.useConstantLengthInvariant = useConstantLengthInvariant.useConstantLengthInvariant;
55
- exports.useConstantValueInvariant = useConstantValueInvariant.useConstantValueInvariant;
56
- exports.useDebounce = useDebounce.useDebounce;
57
- exports.useDebounceCallback = useDebounceCallback.useDebounceCallback;
58
- exports.useDocumentTitle = useDocumentTitle.useDocumentTitle;
59
- exports.useExpectSameValueReference = useExpectSameValueReference.useExpectSameValueReference;
60
- exports.useForceRender = useForceRender.useForceRender;
61
- exports.useId = useId.useId;
62
- exports.useIsMounted = useIsMounted.useIsMounted;
63
- exports.useObjectMemo = useObjectMemo.useObjectMemo;
64
- exports.useOnElementClickOutsideCallback = useOnElementClickOutsideCallback.useOnElementClickOutsideCallback;
65
- exports.useOnElementMouseEnterDelayedCallback = useOnElementMouseEnterDelayedCallback.useOnElementMouseEnterDelayedCallback;
66
- exports.useOnElementResize = useOnElementResize.useOnElementResize;
67
- exports.useOnWindowResize = useOnWindowResize.useOnWindowResize;
68
- exports.usePreviousValue = usePreviousValue.usePreviousValue;
69
- exports.getStateStorage = useStoredState.getStateStorage;
70
- exports.localStateStorage = useStoredState.localStateStorage;
71
- exports.nullStorage = useStoredState.nullStorage;
72
- exports.sessionStateStorage = useStoredState.sessionStateStorage;
73
- exports.urlStateStorage = useStoredState.urlStateStorage;
74
- exports.useLocalStorageState = useStoredState.useLocalStorageState;
75
- exports.useSessionStorageState = useStoredState.useSessionStorageState;
76
- exports.useStoredState = useStoredState.useStoredState;
77
- exports.useUpdatedRef = useUpdatedRef.useUpdatedRef;
78
- exports.useWindowSize = useWindowSize.useWindowSize;
79
- exports.emptyArray = emptyArray.emptyArray;
80
- exports.emptyObject = emptyObject.emptyObject;
81
- exports.identityFunction = identityFunction.identityFunction;
82
- exports.noop = noop.noop;
83
- exports.returnFalse = returnFalse.returnFalse;
84
- exports.returnTrue = returnTrue.returnTrue;
85
- exports.useReferentiallyStableCallback = useReferentiallyStableCallback.useReferentiallyStableCallback;
86
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,86 +0,0 @@
1
- import { createRequiredContext } from "./src/context/createRequiredContext.js";
2
- import { createContext } from "./src/context/createContext.js";
3
- import { isNoopScopedConsole, noopLog, noopLogged, noopScopedConsole } from "./src/debug-context/Constants.js";
4
- import { DebugChildren, ScopedConsoleContext, useScopedConsoleRef } from "./src/debug-context/Context.js";
5
- import { unwrapRefValue } from "./src/hooks/unwrapRefValue.js";
6
- import { useAbortController } from "./src/hooks/useAbortController.js";
7
- import { useArrayMapMemo } from "./src/hooks/useArrayMapMemo.js";
8
- import { useAutoHeightTextArea } from "./src/hooks/useAutoHeightTextArea.js";
9
- import { getChildrenAsLabel, useChildrenAsLabel } from "./src/hooks/useChildrenAsLabel.js";
10
- import { useComposeRef } from "./src/hooks/useComposeRef.js";
11
- import { useConstantLengthInvariant } from "./src/hooks/useConstantLengthInvariant.js";
12
- import { useConstantValueInvariant } from "./src/hooks/useConstantValueInvariant.js";
13
- import { useDebounce } from "./src/hooks/useDebounce.js";
14
- import { useDebounceCallback } from "./src/hooks/useDebounceCallback.js";
15
- import { useDocumentTitle } from "./src/hooks/useDocumentTitle.js";
16
- import { useExpectSameValueReference } from "./src/hooks/useExpectSameValueReference.js";
17
- import { useForceRender } from "./src/hooks/useForceRender.js";
18
- import { useId } from "./src/hooks/useId.js";
19
- import { useIsMounted } from "./src/hooks/useIsMounted.js";
20
- import { useObjectMemo } from "./src/hooks/useObjectMemo.js";
21
- import { useOnElementClickOutsideCallback } from "./src/hooks/useOnElementClickOutsideCallback.js";
22
- import { useOnElementMouseEnterDelayedCallback } from "./src/hooks/useOnElementMouseEnterDelayedCallback.js";
23
- import { useOnElementResize } from "./src/hooks/useOnElementResize.js";
24
- import { useOnWindowResize } from "./src/hooks/useOnWindowResize.js";
25
- import { usePreviousValue } from "./src/hooks/usePreviousValue.js";
26
- import { getStateStorage, localStateStorage, nullStorage, sessionStateStorage, urlStateStorage, useLocalStorageState, useSessionStorageState, useStoredState } from "./src/hooks/useStoredState.js";
27
- import { useUpdatedRef } from "./src/hooks/useUpdatedRef.js";
28
- import { useWindowSize } from "./src/hooks/useWindowSize.js";
29
- import { emptyArray } from "./src/referentiallyStable/emptyArray.js";
30
- import { emptyObject } from "./src/referentiallyStable/emptyObject.js";
31
- import { identityFunction } from "./src/referentiallyStable/identityFunction.js";
32
- import { noop } from "./src/referentiallyStable/noop.js";
33
- import { returnFalse } from "./src/referentiallyStable/returnFalse.js";
34
- import { returnTrue } from "./src/referentiallyStable/returnTrue.js";
35
- import { useReferentiallyStableCallback } from "./src/referentiallyStable/useReferentiallyStableCallback.js";
36
- export {
37
- DebugChildren,
38
- ScopedConsoleContext,
39
- createContext,
40
- createRequiredContext,
41
- emptyArray,
42
- emptyObject,
43
- getChildrenAsLabel,
44
- getStateStorage,
45
- identityFunction,
46
- isNoopScopedConsole,
47
- localStateStorage,
48
- noop,
49
- noopLog,
50
- noopLogged,
51
- noopScopedConsole,
52
- nullStorage,
53
- returnFalse,
54
- returnTrue,
55
- sessionStateStorage,
56
- unwrapRefValue,
57
- urlStateStorage,
58
- useAbortController,
59
- useArrayMapMemo,
60
- useAutoHeightTextArea,
61
- useChildrenAsLabel,
62
- useComposeRef,
63
- useConstantLengthInvariant,
64
- useConstantValueInvariant,
65
- useDebounce,
66
- useDebounceCallback,
67
- useDocumentTitle,
68
- useExpectSameValueReference,
69
- useForceRender,
70
- useId,
71
- useIsMounted,
72
- useLocalStorageState,
73
- useObjectMemo,
74
- useOnElementClickOutsideCallback,
75
- useOnElementMouseEnterDelayedCallback,
76
- useOnElementResize,
77
- useOnWindowResize,
78
- usePreviousValue,
79
- useReferentiallyStableCallback,
80
- useScopedConsoleRef,
81
- useSessionStorageState,
82
- useStoredState,
83
- useUpdatedRef,
84
- useWindowSize
85
- };
86
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const React = require("react");
4
- function createContext(name, initialValue) {
5
- const OptionalContext = React.createContext(initialValue);
6
- OptionalContext.displayName = name;
7
- return [OptionalContext, () => React.useContext(OptionalContext), OptionalContext.Provider];
8
- }
9
- exports.createContext = createContext;
10
- //# sourceMappingURL=createContext.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createContext.cjs","sources":["../../../../../packages/react-utils/src/context/createContext.ts"],"sourcesContent":["import type { Context, Provider } from 'react'\nimport { createContext as baseCreateContext, useContext } from 'react'\n\nexport function createContext<T>(name: string, initialValue: T): [Context<T>, () => T, Provider<T>] {\n\tconst OptionalContext = baseCreateContext<T>(initialValue)\n\tOptionalContext.displayName = name\n\n\treturn [OptionalContext, () => useContext(OptionalContext), OptionalContext.Provider]\n}\n"],"names":["baseCreateContext","useContext"],"mappings":";;;AAGgB,SAAA,cAAiB,MAAc,cAAqD;AAC7F,QAAA,kBAAkBA,oBAAqB,YAAY;AACzD,kBAAgB,cAAc;AAE9B,SAAO,CAAC,iBAAiB,MAAMC,MAAAA,WAAW,eAAe,GAAG,gBAAgB,QAAQ;AACrF;;"}
@@ -1,10 +0,0 @@
1
- import { createContext as createContext$1, useContext } from "react";
2
- function createContext(name, initialValue) {
3
- const OptionalContext = createContext$1(initialValue);
4
- OptionalContext.displayName = name;
5
- return [OptionalContext, () => useContext(OptionalContext), OptionalContext.Provider];
6
- }
7
- export {
8
- createContext
9
- };
10
- //# sourceMappingURL=createContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createContext.js","sources":["../../../../../packages/react-utils/src/context/createContext.ts"],"sourcesContent":["import type { Context, Provider } from 'react'\nimport { createContext as baseCreateContext, useContext } from 'react'\n\nexport function createContext<T>(name: string, initialValue: T): [Context<T>, () => T, Provider<T>] {\n\tconst OptionalContext = baseCreateContext<T>(initialValue)\n\tOptionalContext.displayName = name\n\n\treturn [OptionalContext, () => useContext(OptionalContext), OptionalContext.Provider]\n}\n"],"names":["baseCreateContext"],"mappings":";AAGgB,SAAA,cAAiB,MAAc,cAAqD;AAC7F,QAAA,kBAAkBA,gBAAqB,YAAY;AACzD,kBAAgB,cAAc;AAE9B,SAAO,CAAC,iBAAiB,MAAM,WAAW,eAAe,GAAG,gBAAgB,QAAQ;AACrF;"}
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const React = require("react");
4
- const EmptyContextSymbol = Symbol("EmptyContextSymbol");
5
- function createRequiredContext(displayName) {
6
- const RequiredContext = React.createContext(EmptyContextSymbol);
7
- RequiredContext.displayName = displayName;
8
- const useRequiredContext = () => {
9
- const context = React.useContext(RequiredContext);
10
- if (context === EmptyContextSymbol) {
11
- throw new Error(`use${displayName} must be used within a ${displayName} provider`);
12
- }
13
- return context;
14
- };
15
- return [RequiredContext, useRequiredContext, RequiredContext.Provider];
16
- }
17
- exports.createRequiredContext = createRequiredContext;
18
- //# sourceMappingURL=createRequiredContext.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createRequiredContext.cjs","sources":["../../../../../packages/react-utils/src/context/createRequiredContext.ts"],"sourcesContent":["import type { Context, Provider } from 'react'\nimport { createContext, useContext } from 'react'\n\nconst EmptyContextSymbol = Symbol('EmptyContextSymbol')\n\nexport function createRequiredContext<T>(displayName: string): [Context<T>, () => T, Provider<T>] {\n\tconst RequiredContext = createContext<T>(EmptyContextSymbol as T)\n\tRequiredContext.displayName = displayName\n\n\tconst useRequiredContext = (): T => {\n\t\tconst context = useContext(RequiredContext)\n\n\t\tif (context === EmptyContextSymbol) {\n\t\t\tthrow new Error(`use${displayName} must be used within a ${displayName} provider`)\n\t\t}\n\n\t\treturn context\n\t}\n\n\treturn [RequiredContext, useRequiredContext, RequiredContext.Provider]\n}\n"],"names":["createContext","useContext"],"mappings":";;;AAGA,MAAM,qBAAqB,OAAO,oBAAoB;AAE/C,SAAS,sBAAyB,aAAyD;AAC3F,QAAA,kBAAkBA,oBAAiB,kBAAuB;AAChE,kBAAgB,cAAc;AAE9B,QAAM,qBAAqB,MAAS;AAC7B,UAAA,UAAUC,iBAAW,eAAe;AAE1C,QAAI,YAAY,oBAAoB;AACnC,YAAM,IAAI,MAAM,MAAM,WAAW,0BAA0B,WAAW,WAAW;AAAA,IAAA;AAG3E,WAAA;AAAA,EACR;AAEA,SAAO,CAAC,iBAAiB,oBAAoB,gBAAgB,QAAQ;AACtE;;"}
@@ -1,18 +0,0 @@
1
- import { createContext, useContext } from "react";
2
- const EmptyContextSymbol = Symbol("EmptyContextSymbol");
3
- function createRequiredContext(displayName) {
4
- const RequiredContext = createContext(EmptyContextSymbol);
5
- RequiredContext.displayName = displayName;
6
- const useRequiredContext = () => {
7
- const context = useContext(RequiredContext);
8
- if (context === EmptyContextSymbol) {
9
- throw new Error(`use${displayName} must be used within a ${displayName} provider`);
10
- }
11
- return context;
12
- };
13
- return [RequiredContext, useRequiredContext, RequiredContext.Provider];
14
- }
15
- export {
16
- createRequiredContext
17
- };
18
- //# sourceMappingURL=createRequiredContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createRequiredContext.js","sources":["../../../../../packages/react-utils/src/context/createRequiredContext.ts"],"sourcesContent":["import type { Context, Provider } from 'react'\nimport { createContext, useContext } from 'react'\n\nconst EmptyContextSymbol = Symbol('EmptyContextSymbol')\n\nexport function createRequiredContext<T>(displayName: string): [Context<T>, () => T, Provider<T>] {\n\tconst RequiredContext = createContext<T>(EmptyContextSymbol as T)\n\tRequiredContext.displayName = displayName\n\n\tconst useRequiredContext = (): T => {\n\t\tconst context = useContext(RequiredContext)\n\n\t\tif (context === EmptyContextSymbol) {\n\t\t\tthrow new Error(`use${displayName} must be used within a ${displayName} provider`)\n\t\t}\n\n\t\treturn context\n\t}\n\n\treturn [RequiredContext, useRequiredContext, RequiredContext.Provider]\n}\n"],"names":[],"mappings":";AAGA,MAAM,qBAAqB,OAAO,oBAAoB;AAE/C,SAAS,sBAAyB,aAAyD;AAC3F,QAAA,kBAAkB,cAAiB,kBAAuB;AAChE,kBAAgB,cAAc;AAE9B,QAAM,qBAAqB,MAAS;AAC7B,UAAA,UAAU,WAAW,eAAe;AAE1C,QAAI,YAAY,oBAAoB;AACnC,YAAM,IAAI,MAAM,MAAM,WAAW,0BAA0B,WAAW,WAAW;AAAA,IAAA;AAG3E,WAAA;AAAA,EACR;AAEA,SAAO,CAAC,iBAAiB,oBAAoB,gBAAgB,QAAQ;AACtE;"}
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- function noopLog(...parameters) {
4
- }
5
- function noopLogged(message, value) {
6
- return value;
7
- }
8
- const noopScopedConsole = Object.freeze({
9
- log: noopLog,
10
- logged: noopLogged,
11
- warn: noopLog,
12
- warned: noopLogged,
13
- error: noopLog,
14
- errored: noopLogged,
15
- trace: noopLog,
16
- traced: noopLogged
17
- });
18
- function isNoopScopedConsole(value) {
19
- return value === noopScopedConsole;
20
- }
21
- exports.isNoopScopedConsole = isNoopScopedConsole;
22
- exports.noopLog = noopLog;
23
- exports.noopLogged = noopLogged;
24
- exports.noopScopedConsole = noopScopedConsole;
25
- //# sourceMappingURL=Constants.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Constants.cjs","sources":["../../../../../packages/react-utils/src/debug-context/Constants.ts"],"sourcesContent":["import type { ScopedConsoleContextType } from './Types'\n\nexport function noopLog(...parameters: any[]) { }\n\nexport function noopLogged<T>(message: string, value: T): T {\n\treturn value\n}\n\nexport const noopScopedConsole: ScopedConsoleContextType = Object.freeze({\n\tlog: noopLog,\n\tlogged: noopLogged,\n\twarn: noopLog,\n\twarned: noopLogged,\n\terror: noopLog,\n\terrored: noopLogged,\n\ttrace: noopLog,\n\ttraced: noopLogged,\n})\n\nexport function isNoopScopedConsole(value: unknown): boolean {\n\treturn value === noopScopedConsole\n}\n"],"names":[],"mappings":";;AAEO,SAAS,WAAW,YAAmB;AAAE;AAEhC,SAAA,WAAc,SAAiB,OAAa;AACpD,SAAA;AACR;AAEa,MAAA,oBAA8C,OAAO,OAAO;AAAA,EACxE,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AACT,CAAC;AAEM,SAAS,oBAAoB,OAAyB;AAC5D,SAAO,UAAU;AAClB;;;;;"}