@contember/react-utils 2.1.0-alpha.30 → 2.1.0-alpha.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +8 -8
  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 -3
  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
@@ -1,25 +0,0 @@
1
- function noopLog(...parameters) {
2
- }
3
- function noopLogged(message, value) {
4
- return value;
5
- }
6
- const noopScopedConsole = Object.freeze({
7
- log: noopLog,
8
- logged: noopLogged,
9
- warn: noopLog,
10
- warned: noopLogged,
11
- error: noopLog,
12
- errored: noopLogged,
13
- trace: noopLog,
14
- traced: noopLogged
15
- });
16
- function isNoopScopedConsole(value) {
17
- return value === noopScopedConsole;
18
- }
19
- export {
20
- isNoopScopedConsole,
21
- noopLog,
22
- noopLogged,
23
- noopScopedConsole
24
- };
25
- //# sourceMappingURL=Constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Constants.js","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;"}
@@ -1,72 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxDevRuntime = require("react/jsx-dev-runtime");
4
- const React = require("react");
5
- const Constants = require("./Constants.cjs");
6
- function createPrefixedConsole(message, prefixedConsole) {
7
- return {
8
- error: function error(...parameters) {
9
- (prefixedConsole ?? console).error(message, ...parameters);
10
- },
11
- errored: function errored(message2, value) {
12
- (prefixedConsole ?? console).error(message2, value);
13
- return value;
14
- },
15
- log: function log(...parameters) {
16
- (prefixedConsole ?? console).log(message, ...parameters);
17
- },
18
- logged: function logged(message2, value) {
19
- (prefixedConsole ?? console).log(message2, value);
20
- return value;
21
- },
22
- trace: function trace(...parameters) {
23
- (prefixedConsole ?? console).trace(message, ...parameters);
24
- },
25
- traced: function traced(message2, value) {
26
- (prefixedConsole ?? console).trace(message2, value);
27
- return value;
28
- },
29
- warn: function warn(...parameters) {
30
- (prefixedConsole ?? console).warn(message, ...parameters);
31
- },
32
- warned: function warned(message2, value) {
33
- (prefixedConsole ?? console).warn(message2, value);
34
- return value;
35
- }
36
- };
37
- }
38
- const ScopedConsoleContext = React.createContext(null);
39
- ScopedConsoleContext.displayName = "ScopedConsoleContext";
40
- function parentScopedConsoleOrNone(parentConsole) {
41
- return Constants.isNoopScopedConsole(parentConsole) ? void 0 : parentConsole;
42
- }
43
- const useScopedConsoleRef = (prefix, override) => {
44
- if (prefix.length === 0) {
45
- throw new Error("Prefix must be non-empty string");
46
- }
47
- const parentConsole = parentScopedConsoleOrNone(React.useContext(ScopedConsoleContext));
48
- const scopedConsole = React.useMemo(() => {
49
- if (override !== false && (parentConsole || override)) {
50
- return createPrefixedConsole(prefix, parentConsole);
51
- } else {
52
- return Constants.noopScopedConsole;
53
- }
54
- }, [override, parentConsole, prefix]);
55
- const ref = React.useRef(scopedConsole);
56
- ref.current = scopedConsole;
57
- return ref;
58
- };
59
- const DebugChildren = React.memo(({ active = true, children, id }) => {
60
- const parentScopedConsole = parentScopedConsoleOrNone(React.useContext(ScopedConsoleContext));
61
- const console2 = active && id ? createPrefixedConsole(id, parentScopedConsole) : Constants.noopScopedConsole;
62
- return /* @__PURE__ */ jsxDevRuntime.jsxDEV(ScopedConsoleContext.Provider, { value: active ? console2 : Constants.noopScopedConsole, children }, void 0, false, {
63
- fileName: "/home/runner/work/contember/contember/packages/react-utils/src/debug-context/Context.tsx",
64
- lineNumber: 77,
65
- columnNumber: 3
66
- }, void 0);
67
- });
68
- DebugChildren.displayName = "DebugChildren";
69
- exports.DebugChildren = DebugChildren;
70
- exports.ScopedConsoleContext = ScopedConsoleContext;
71
- exports.useScopedConsoleRef = useScopedConsoleRef;
72
- //# sourceMappingURL=Context.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Context.cjs","sources":["../../../../../packages/react-utils/src/debug-context/Context.tsx"],"sourcesContent":["import { ReactNode, createContext, memo, useContext, useMemo, useRef } from 'react'\nimport { isNoopScopedConsole, noopScopedConsole } from './Constants'\nimport { ScopedConsoleContextType } from './Types'\n\nfunction createPrefixedConsole(message: string, prefixedConsole?: ScopedConsoleContextType): ScopedConsoleContextType {\n\treturn {\n\t\terror: function error(...parameters: any[]) {\n\t\t\t(prefixedConsole ?? console).error(message, ...parameters)\n\t\t},\n\t\terrored: function errored<T>(message: string, value: T): T {\n\t\t\t(prefixedConsole ?? console).error(message, value)\n\t\t\treturn value\n\t\t},\n\t\tlog: function log(...parameters: any[]) {\n\t\t\t(prefixedConsole ?? console).log(message, ...parameters)\n\t\t},\n\t\tlogged: function logged<T>(message: string, value: T): T {\n\t\t\t(prefixedConsole ?? console).log(message, value)\n\t\t\treturn value\n\t\t},\n\t\ttrace: function trace(...parameters: any[]) {\n\t\t\t(prefixedConsole ?? console).trace(message, ...parameters)\n\t\t},\n\t\ttraced: function traced<T>(message: string, value: T): T {\n\t\t\t(prefixedConsole ?? console).trace(message, value)\n\t\t\treturn value\n\t\t},\n\t\twarn: function warn(...parameters: any[]) {\n\t\t\t(prefixedConsole ?? console).warn(message, ...parameters)\n\t\t},\n\t\twarned: function warned<T>(message: string, value: T): T {\n\t\t\t(prefixedConsole ?? console).warn(message, value)\n\t\t\treturn value\n\t\t},\n\t}\n}\n\nexport const ScopedConsoleContext = createContext<ScopedConsoleContextType>(null!)\nScopedConsoleContext.displayName = 'ScopedConsoleContext'\n\nfunction parentScopedConsoleOrNone(parentConsole: ScopedConsoleContextType): ScopedConsoleContextType | undefined {\n\treturn isNoopScopedConsole(parentConsole) ? undefined : parentConsole\n}\n\nexport const useScopedConsoleRef = (prefix: string, override?: boolean) => {\n\tif (prefix.length === 0) {\n\t\tthrow new Error('Prefix must be non-empty string')\n\t}\n\tconst parentConsole = parentScopedConsoleOrNone(useContext(ScopedConsoleContext))\n\n\tconst scopedConsole = useMemo(() => {\n\t\tif (override !== false && (parentConsole || override)) {\n\t\t\treturn createPrefixedConsole(prefix, parentConsole)\n\t\t} else {\n\t\t\treturn noopScopedConsole\n\t\t}\n\t}, [override, parentConsole, prefix])\n\n\tconst ref = useRef(scopedConsole)\n\tref.current = scopedConsole\n\n\treturn ref\n}\n\nexport type DebugChildrenProps =\n\t| { active?: true; children: ReactNode; id: string }\n\t| { active?: false; children: ReactNode; id?: string }\n\nexport const DebugChildren = memo<DebugChildrenProps>(({ active = true, children, id }) => {\n\tconst parentScopedConsole = parentScopedConsoleOrNone(useContext(ScopedConsoleContext))\n\n\tconst console = active && id\n\t\t? createPrefixedConsole(id, parentScopedConsole)\n\t\t: noopScopedConsole\n\n\treturn (\n\t\t<ScopedConsoleContext.Provider value={active ? console : noopScopedConsole}>\n\t\t\t{children}\n\t\t</ScopedConsoleContext.Provider>\n\t)\n})\nDebugChildren.displayName = 'DebugChildren'\n"],"names":["message","createContext","isNoopScopedConsole","useContext","useMemo","noopScopedConsole","useRef","memo","console","jsxDEV","this"],"mappings":";;;;;AAIA,SAAS,sBAAsB,SAAiB,iBAAsE;AAC9G,SAAA;AAAA,IACN,OAAO,SAAS,SAAS,YAAmB;AAC3C,OAAC,mBAAmB,SAAS,MAAM,SAAS,GAAG,UAAU;AAAA,IAC1D;AAAA,IACA,SAAS,SAAS,QAAWA,UAAiB,OAAa;AAC1D,OAAC,mBAAmB,SAAS,MAAMA,UAAS,KAAK;AAC1C,aAAA;AAAA,IACR;AAAA,IACA,KAAK,SAAS,OAAO,YAAmB;AACvC,OAAC,mBAAmB,SAAS,IAAI,SAAS,GAAG,UAAU;AAAA,IACxD;AAAA,IACA,QAAQ,SAAS,OAAUA,UAAiB,OAAa;AACxD,OAAC,mBAAmB,SAAS,IAAIA,UAAS,KAAK;AACxC,aAAA;AAAA,IACR;AAAA,IACA,OAAO,SAAS,SAAS,YAAmB;AAC3C,OAAC,mBAAmB,SAAS,MAAM,SAAS,GAAG,UAAU;AAAA,IAC1D;AAAA,IACA,QAAQ,SAAS,OAAUA,UAAiB,OAAa;AACxD,OAAC,mBAAmB,SAAS,MAAMA,UAAS,KAAK;AAC1C,aAAA;AAAA,IACR;AAAA,IACA,MAAM,SAAS,QAAQ,YAAmB;AACzC,OAAC,mBAAmB,SAAS,KAAK,SAAS,GAAG,UAAU;AAAA,IACzD;AAAA,IACA,QAAQ,SAAS,OAAUA,UAAiB,OAAa;AACxD,OAAC,mBAAmB,SAAS,KAAKA,UAAS,KAAK;AACzC,aAAA;AAAA,IAAA;AAAA,EAET;AACD;AAEa,MAAA,uBAAuBC,oBAAwC,IAAK;AACjF,qBAAqB,cAAc;AAEnC,SAAS,0BAA0B,eAA+E;AAC1G,SAAAC,8BAAoB,aAAa,IAAI,SAAY;AACzD;AAEa,MAAA,sBAAsB,CAAC,QAAgB,aAAuB;AACtE,MAAA,OAAO,WAAW,GAAG;AAClB,UAAA,IAAI,MAAM,iCAAiC;AAAA,EAAA;AAElD,QAAM,gBAAgB,0BAA0BC,MAAW,WAAA,oBAAoB,CAAC;AAE1E,QAAA,gBAAgBC,MAAAA,QAAQ,MAAM;AAC/B,QAAA,aAAa,UAAU,iBAAiB,WAAW;AAC/C,aAAA,sBAAsB,QAAQ,aAAa;AAAA,IAAA,OAC5C;AACC,aAAAC,UAAA;AAAA,IAAA;AAAA,EAEN,GAAA,CAAC,UAAU,eAAe,MAAM,CAAC;AAE9B,QAAA,MAAMC,aAAO,aAAa;AAChC,MAAI,UAAU;AAEP,SAAA;AACR;AAMa,MAAA,gBAAgBC,WAAyB,CAAC,EAAE,SAAS,MAAM,UAAU,SAAS;AAC1F,QAAM,sBAAsB,0BAA0BJ,MAAW,WAAA,oBAAoB,CAAC;AAEtF,QAAMK,WAAU,UAAU,KACvB,sBAAsB,IAAI,mBAAmB,IAC7CH,UAAA;AAGF,SAAAI,qCAAC,qBAAqB,UAArB,EAA8B,OAAO,SAASD,WAAUH,6BACvD,SADF,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAEA,GAAAK,MAAA;AAEF,CAAC;AACD,cAAc,cAAc;;;;"}
@@ -1,72 +0,0 @@
1
- import { jsxDEV } from "react/jsx-dev-runtime";
2
- import { createContext, useContext, useMemo, useRef, memo } from "react";
3
- import { noopScopedConsole, isNoopScopedConsole } from "./Constants.js";
4
- function createPrefixedConsole(message, prefixedConsole) {
5
- return {
6
- error: function error(...parameters) {
7
- (prefixedConsole ?? console).error(message, ...parameters);
8
- },
9
- errored: function errored(message2, value) {
10
- (prefixedConsole ?? console).error(message2, value);
11
- return value;
12
- },
13
- log: function log(...parameters) {
14
- (prefixedConsole ?? console).log(message, ...parameters);
15
- },
16
- logged: function logged(message2, value) {
17
- (prefixedConsole ?? console).log(message2, value);
18
- return value;
19
- },
20
- trace: function trace(...parameters) {
21
- (prefixedConsole ?? console).trace(message, ...parameters);
22
- },
23
- traced: function traced(message2, value) {
24
- (prefixedConsole ?? console).trace(message2, value);
25
- return value;
26
- },
27
- warn: function warn(...parameters) {
28
- (prefixedConsole ?? console).warn(message, ...parameters);
29
- },
30
- warned: function warned(message2, value) {
31
- (prefixedConsole ?? console).warn(message2, value);
32
- return value;
33
- }
34
- };
35
- }
36
- const ScopedConsoleContext = createContext(null);
37
- ScopedConsoleContext.displayName = "ScopedConsoleContext";
38
- function parentScopedConsoleOrNone(parentConsole) {
39
- return isNoopScopedConsole(parentConsole) ? void 0 : parentConsole;
40
- }
41
- const useScopedConsoleRef = (prefix, override) => {
42
- if (prefix.length === 0) {
43
- throw new Error("Prefix must be non-empty string");
44
- }
45
- const parentConsole = parentScopedConsoleOrNone(useContext(ScopedConsoleContext));
46
- const scopedConsole = useMemo(() => {
47
- if (override !== false && (parentConsole || override)) {
48
- return createPrefixedConsole(prefix, parentConsole);
49
- } else {
50
- return noopScopedConsole;
51
- }
52
- }, [override, parentConsole, prefix]);
53
- const ref = useRef(scopedConsole);
54
- ref.current = scopedConsole;
55
- return ref;
56
- };
57
- const DebugChildren = memo(({ active = true, children, id }) => {
58
- const parentScopedConsole = parentScopedConsoleOrNone(useContext(ScopedConsoleContext));
59
- const console2 = active && id ? createPrefixedConsole(id, parentScopedConsole) : noopScopedConsole;
60
- return /* @__PURE__ */ jsxDEV(ScopedConsoleContext.Provider, { value: active ? console2 : noopScopedConsole, children }, void 0, false, {
61
- fileName: "/home/runner/work/contember/contember/packages/react-utils/src/debug-context/Context.tsx",
62
- lineNumber: 77,
63
- columnNumber: 3
64
- }, void 0);
65
- });
66
- DebugChildren.displayName = "DebugChildren";
67
- export {
68
- DebugChildren,
69
- ScopedConsoleContext,
70
- useScopedConsoleRef
71
- };
72
- //# sourceMappingURL=Context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Context.js","sources":["../../../../../packages/react-utils/src/debug-context/Context.tsx"],"sourcesContent":["import { ReactNode, createContext, memo, useContext, useMemo, useRef } from 'react'\nimport { isNoopScopedConsole, noopScopedConsole } from './Constants'\nimport { ScopedConsoleContextType } from './Types'\n\nfunction createPrefixedConsole(message: string, prefixedConsole?: ScopedConsoleContextType): ScopedConsoleContextType {\n\treturn {\n\t\terror: function error(...parameters: any[]) {\n\t\t\t(prefixedConsole ?? console).error(message, ...parameters)\n\t\t},\n\t\terrored: function errored<T>(message: string, value: T): T {\n\t\t\t(prefixedConsole ?? console).error(message, value)\n\t\t\treturn value\n\t\t},\n\t\tlog: function log(...parameters: any[]) {\n\t\t\t(prefixedConsole ?? console).log(message, ...parameters)\n\t\t},\n\t\tlogged: function logged<T>(message: string, value: T): T {\n\t\t\t(prefixedConsole ?? console).log(message, value)\n\t\t\treturn value\n\t\t},\n\t\ttrace: function trace(...parameters: any[]) {\n\t\t\t(prefixedConsole ?? console).trace(message, ...parameters)\n\t\t},\n\t\ttraced: function traced<T>(message: string, value: T): T {\n\t\t\t(prefixedConsole ?? console).trace(message, value)\n\t\t\treturn value\n\t\t},\n\t\twarn: function warn(...parameters: any[]) {\n\t\t\t(prefixedConsole ?? console).warn(message, ...parameters)\n\t\t},\n\t\twarned: function warned<T>(message: string, value: T): T {\n\t\t\t(prefixedConsole ?? console).warn(message, value)\n\t\t\treturn value\n\t\t},\n\t}\n}\n\nexport const ScopedConsoleContext = createContext<ScopedConsoleContextType>(null!)\nScopedConsoleContext.displayName = 'ScopedConsoleContext'\n\nfunction parentScopedConsoleOrNone(parentConsole: ScopedConsoleContextType): ScopedConsoleContextType | undefined {\n\treturn isNoopScopedConsole(parentConsole) ? undefined : parentConsole\n}\n\nexport const useScopedConsoleRef = (prefix: string, override?: boolean) => {\n\tif (prefix.length === 0) {\n\t\tthrow new Error('Prefix must be non-empty string')\n\t}\n\tconst parentConsole = parentScopedConsoleOrNone(useContext(ScopedConsoleContext))\n\n\tconst scopedConsole = useMemo(() => {\n\t\tif (override !== false && (parentConsole || override)) {\n\t\t\treturn createPrefixedConsole(prefix, parentConsole)\n\t\t} else {\n\t\t\treturn noopScopedConsole\n\t\t}\n\t}, [override, parentConsole, prefix])\n\n\tconst ref = useRef(scopedConsole)\n\tref.current = scopedConsole\n\n\treturn ref\n}\n\nexport type DebugChildrenProps =\n\t| { active?: true; children: ReactNode; id: string }\n\t| { active?: false; children: ReactNode; id?: string }\n\nexport const DebugChildren = memo<DebugChildrenProps>(({ active = true, children, id }) => {\n\tconst parentScopedConsole = parentScopedConsoleOrNone(useContext(ScopedConsoleContext))\n\n\tconst console = active && id\n\t\t? createPrefixedConsole(id, parentScopedConsole)\n\t\t: noopScopedConsole\n\n\treturn (\n\t\t<ScopedConsoleContext.Provider value={active ? console : noopScopedConsole}>\n\t\t\t{children}\n\t\t</ScopedConsoleContext.Provider>\n\t)\n})\nDebugChildren.displayName = 'DebugChildren'\n"],"names":["message","console","this"],"mappings":";;;AAIA,SAAS,sBAAsB,SAAiB,iBAAsE;AAC9G,SAAA;AAAA,IACN,OAAO,SAAS,SAAS,YAAmB;AAC3C,OAAC,mBAAmB,SAAS,MAAM,SAAS,GAAG,UAAU;AAAA,IAC1D;AAAA,IACA,SAAS,SAAS,QAAWA,UAAiB,OAAa;AAC1D,OAAC,mBAAmB,SAAS,MAAMA,UAAS,KAAK;AAC1C,aAAA;AAAA,IACR;AAAA,IACA,KAAK,SAAS,OAAO,YAAmB;AACvC,OAAC,mBAAmB,SAAS,IAAI,SAAS,GAAG,UAAU;AAAA,IACxD;AAAA,IACA,QAAQ,SAAS,OAAUA,UAAiB,OAAa;AACxD,OAAC,mBAAmB,SAAS,IAAIA,UAAS,KAAK;AACxC,aAAA;AAAA,IACR;AAAA,IACA,OAAO,SAAS,SAAS,YAAmB;AAC3C,OAAC,mBAAmB,SAAS,MAAM,SAAS,GAAG,UAAU;AAAA,IAC1D;AAAA,IACA,QAAQ,SAAS,OAAUA,UAAiB,OAAa;AACxD,OAAC,mBAAmB,SAAS,MAAMA,UAAS,KAAK;AAC1C,aAAA;AAAA,IACR;AAAA,IACA,MAAM,SAAS,QAAQ,YAAmB;AACzC,OAAC,mBAAmB,SAAS,KAAK,SAAS,GAAG,UAAU;AAAA,IACzD;AAAA,IACA,QAAQ,SAAS,OAAUA,UAAiB,OAAa;AACxD,OAAC,mBAAmB,SAAS,KAAKA,UAAS,KAAK;AACzC,aAAA;AAAA,IAAA;AAAA,EAET;AACD;AAEa,MAAA,uBAAuB,cAAwC,IAAK;AACjF,qBAAqB,cAAc;AAEnC,SAAS,0BAA0B,eAA+E;AAC1G,SAAA,oBAAoB,aAAa,IAAI,SAAY;AACzD;AAEa,MAAA,sBAAsB,CAAC,QAAgB,aAAuB;AACtE,MAAA,OAAO,WAAW,GAAG;AAClB,UAAA,IAAI,MAAM,iCAAiC;AAAA,EAAA;AAElD,QAAM,gBAAgB,0BAA0B,WAAW,oBAAoB,CAAC;AAE1E,QAAA,gBAAgB,QAAQ,MAAM;AAC/B,QAAA,aAAa,UAAU,iBAAiB,WAAW;AAC/C,aAAA,sBAAsB,QAAQ,aAAa;AAAA,IAAA,OAC5C;AACC,aAAA;AAAA,IAAA;AAAA,EAEN,GAAA,CAAC,UAAU,eAAe,MAAM,CAAC;AAE9B,QAAA,MAAM,OAAO,aAAa;AAChC,MAAI,UAAU;AAEP,SAAA;AACR;AAMa,MAAA,gBAAgB,KAAyB,CAAC,EAAE,SAAS,MAAM,UAAU,SAAS;AAC1F,QAAM,sBAAsB,0BAA0B,WAAW,oBAAoB,CAAC;AAEtF,QAAMC,WAAU,UAAU,KACvB,sBAAsB,IAAI,mBAAmB,IAC7C;AAGF,SAAA,uBAAC,qBAAqB,UAArB,EAA8B,OAAO,SAASA,WAAU,mBACvD,SADF,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAEA,GAAAC,MAAA;AAEF,CAAC;AACD,cAAc,cAAc;"}
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- function unwrapRefValue(value) {
4
- if (value && typeof value === "object" && "current" in value) {
5
- return value.current;
6
- } else {
7
- return value;
8
- }
9
- }
10
- exports.unwrapRefValue = unwrapRefValue;
11
- //# sourceMappingURL=unwrapRefValue.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unwrapRefValue.cjs","sources":["../../../../../packages/react-utils/src/hooks/unwrapRefValue.ts"],"sourcesContent":["import { RefObject } from 'react'\n\nexport type RefObjectOrElement<T> = T | RefObject<T>\n\n/**\n * Unwraps a ref object or returns the value if it is not a ref object.\n * @param value - Value to unwrap\n * @returns Unwrapped value\n */\nexport function unwrapRefValue<T>(value: RefObjectOrElement<T>): T | null {\n\tif (value && typeof value === 'object' && 'current' in value) {\n\t\treturn value.current\n\t} else {\n\t\treturn value\n\t}\n}\n"],"names":[],"mappings":";;AASO,SAAS,eAAkB,OAAwC;AACzE,MAAI,SAAS,OAAO,UAAU,YAAY,aAAa,OAAO;AAC7D,WAAO,MAAM;AAAA,EAAA,OACP;AACC,WAAA;AAAA,EAAA;AAET;;"}
@@ -1,11 +0,0 @@
1
- function unwrapRefValue(value) {
2
- if (value && typeof value === "object" && "current" in value) {
3
- return value.current;
4
- } else {
5
- return value;
6
- }
7
- }
8
- export {
9
- unwrapRefValue
10
- };
11
- //# sourceMappingURL=unwrapRefValue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unwrapRefValue.js","sources":["../../../../../packages/react-utils/src/hooks/unwrapRefValue.ts"],"sourcesContent":["import { RefObject } from 'react'\n\nexport type RefObjectOrElement<T> = T | RefObject<T>\n\n/**\n * Unwraps a ref object or returns the value if it is not a ref object.\n * @param value - Value to unwrap\n * @returns Unwrapped value\n */\nexport function unwrapRefValue<T>(value: RefObjectOrElement<T>): T | null {\n\tif (value && typeof value === 'object' && 'current' in value) {\n\t\treturn value.current\n\t} else {\n\t\treturn value\n\t}\n}\n"],"names":[],"mappings":"AASO,SAAS,eAAkB,OAAwC;AACzE,MAAI,SAAS,OAAO,UAAU,YAAY,aAAa,OAAO;AAC7D,WAAO,MAAM;AAAA,EAAA,OACP;AACC,WAAA;AAAA,EAAA;AAET;"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const React = require("react");
4
- const useAbortController = () => {
5
- const lastAbortControllerRef = React.useRef(void 0);
6
- React.useEffect(() => () => {
7
- lastAbortControllerRef.current?.abort();
8
- }, []);
9
- return React.useCallback(() => {
10
- lastAbortControllerRef.current?.abort();
11
- const newController = new AbortController();
12
- lastAbortControllerRef.current = newController;
13
- return newController.signal;
14
- }, []);
15
- };
16
- exports.useAbortController = useAbortController;
17
- //# sourceMappingURL=useAbortController.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useAbortController.cjs","sources":["../../../../../packages/react-utils/src/hooks/useAbortController.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react'\n\nexport const useAbortController = () => {\n\tconst lastAbortControllerRef = useRef<AbortController | undefined>(undefined)\n\tuseEffect(() => () => {\n\t\tlastAbortControllerRef.current?.abort()\n\t}, [])\n\treturn useCallback((): AbortSignal => {\n\t\tlastAbortControllerRef.current?.abort()\n\n\t\tconst newController = new AbortController()\n\t\tlastAbortControllerRef.current = newController\n\t\treturn newController.signal\n\t}, [])\n}\n"],"names":["useRef","useEffect","useCallback"],"mappings":";;;AAEO,MAAM,qBAAqB,MAAM;AACjC,QAAA,yBAAyBA,aAAoC,MAAS;AAC5EC,QAAAA,UAAU,MAAM,MAAM;AACrB,2BAAuB,SAAS,MAAM;AAAA,EACvC,GAAG,EAAE;AACL,SAAOC,kBAAY,MAAmB;AACrC,2BAAuB,SAAS,MAAM;AAEhC,UAAA,gBAAgB,IAAI,gBAAgB;AAC1C,2BAAuB,UAAU;AACjC,WAAO,cAAc;AAAA,EACtB,GAAG,EAAE;AACN;;"}
@@ -1,17 +0,0 @@
1
- import { useRef, useEffect, useCallback } from "react";
2
- const useAbortController = () => {
3
- const lastAbortControllerRef = useRef(void 0);
4
- useEffect(() => () => {
5
- lastAbortControllerRef.current?.abort();
6
- }, []);
7
- return useCallback(() => {
8
- lastAbortControllerRef.current?.abort();
9
- const newController = new AbortController();
10
- lastAbortControllerRef.current = newController;
11
- return newController.signal;
12
- }, []);
13
- };
14
- export {
15
- useAbortController
16
- };
17
- //# sourceMappingURL=useAbortController.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useAbortController.js","sources":["../../../../../packages/react-utils/src/hooks/useAbortController.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react'\n\nexport const useAbortController = () => {\n\tconst lastAbortControllerRef = useRef<AbortController | undefined>(undefined)\n\tuseEffect(() => () => {\n\t\tlastAbortControllerRef.current?.abort()\n\t}, [])\n\treturn useCallback((): AbortSignal => {\n\t\tlastAbortControllerRef.current?.abort()\n\n\t\tconst newController = new AbortController()\n\t\tlastAbortControllerRef.current = newController\n\t\treturn newController.signal\n\t}, [])\n}\n"],"names":[],"mappings":";AAEO,MAAM,qBAAqB,MAAM;AACjC,QAAA,yBAAyB,OAAoC,MAAS;AAC5E,YAAU,MAAM,MAAM;AACrB,2BAAuB,SAAS,MAAM;AAAA,EACvC,GAAG,EAAE;AACL,SAAO,YAAY,MAAmB;AACrC,2BAAuB,SAAS,MAAM;AAEhC,UAAA,gBAAgB,IAAI,gBAAgB;AAC1C,2BAAuB,UAAU;AACjC,WAAO,cAAc;AAAA,EACtB,GAAG,EAAE;AACN;"}
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const React = require("react");
4
- const useConstantLengthInvariant = require("./useConstantLengthInvariant.cjs");
5
- const useArrayMapMemo = (items, map) => {
6
- useConstantLengthInvariant.useConstantLengthInvariant(items);
7
- const mapped = React.useMemo(() => items.map(map), [map, ...items]);
8
- return React.useMemo(() => mapped, mapped);
9
- };
10
- exports.useArrayMapMemo = useArrayMapMemo;
11
- //# sourceMappingURL=useArrayMapMemo.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useArrayMapMemo.cjs","sources":["../../../../../packages/react-utils/src/hooks/useArrayMapMemo.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport { useConstantLengthInvariant } from './useConstantLengthInvariant'\n\n/**\n * ⚠️ ONLY USE THIS IF YOU *REALLY* KNOW WHAT YOU'RE DOING! ⚠️\n * ⚠ HERE BE DRAGONS THAT KNOW WHERE YOU LIVE! ⚠\n *\n * This is a bit of React naughtiness that allows us to memoize outputs of Array.prototype.map() based on the contents\n * of the original array, and not its referential equality. That way, if we create a new array with identical items,\n * we get an array that is referentially equal to the previous one.\n */\nexport const useArrayMapMemo = <Item, OutputItem>(\n\titems: Item[],\n\tmap: (value: Item, index: number, array: Item[]) => OutputItem,\n): OutputItem[] => {\n\tuseConstantLengthInvariant(items)\n\n\t// This is tricky. We don't want to exclude the map function from the dependency list because if it changes but the\n\t// items array remains the same, we still want to re-compute the new array. However, if that yields the same array,\n\t// in the sense that the items are identical, albeit computed via a different map function, we still want to\n\t// preserve the referential equality of the original. Hence the second memo.\n\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tconst mapped = useMemo(() => items.map(map), [map, ...items])\n\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\treturn useMemo(() => mapped, mapped) // This is deliberately not `[mapped]`\n}\n"],"names":["useConstantLengthInvariant","useMemo"],"mappings":";;;;AAWa,MAAA,kBAAkB,CAC9B,OACA,QACkB;AAClBA,6BAAAA,2BAA2B,KAAK;AAQ1B,QAAA,SAASC,cAAQ,MAAM,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;AAGrD,SAAAA,MAAA,QAAQ,MAAM,QAAQ,MAAM;AACpC;;"}
@@ -1,11 +0,0 @@
1
- import { useMemo } from "react";
2
- import { useConstantLengthInvariant } from "./useConstantLengthInvariant.js";
3
- const useArrayMapMemo = (items, map) => {
4
- useConstantLengthInvariant(items);
5
- const mapped = useMemo(() => items.map(map), [map, ...items]);
6
- return useMemo(() => mapped, mapped);
7
- };
8
- export {
9
- useArrayMapMemo
10
- };
11
- //# sourceMappingURL=useArrayMapMemo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useArrayMapMemo.js","sources":["../../../../../packages/react-utils/src/hooks/useArrayMapMemo.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport { useConstantLengthInvariant } from './useConstantLengthInvariant'\n\n/**\n * ⚠️ ONLY USE THIS IF YOU *REALLY* KNOW WHAT YOU'RE DOING! ⚠️\n * ⚠ HERE BE DRAGONS THAT KNOW WHERE YOU LIVE! ⚠\n *\n * This is a bit of React naughtiness that allows us to memoize outputs of Array.prototype.map() based on the contents\n * of the original array, and not its referential equality. That way, if we create a new array with identical items,\n * we get an array that is referentially equal to the previous one.\n */\nexport const useArrayMapMemo = <Item, OutputItem>(\n\titems: Item[],\n\tmap: (value: Item, index: number, array: Item[]) => OutputItem,\n): OutputItem[] => {\n\tuseConstantLengthInvariant(items)\n\n\t// This is tricky. We don't want to exclude the map function from the dependency list because if it changes but the\n\t// items array remains the same, we still want to re-compute the new array. However, if that yields the same array,\n\t// in the sense that the items are identical, albeit computed via a different map function, we still want to\n\t// preserve the referential equality of the original. Hence the second memo.\n\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tconst mapped = useMemo(() => items.map(map), [map, ...items])\n\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\treturn useMemo(() => mapped, mapped) // This is deliberately not `[mapped]`\n}\n"],"names":[],"mappings":";;AAWa,MAAA,kBAAkB,CAC9B,OACA,QACkB;AAClB,6BAA2B,KAAK;AAQ1B,QAAA,SAAS,QAAQ,MAAM,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;AAGrD,SAAA,QAAQ,MAAM,QAAQ,MAAM;AACpC;"}
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const React = require("react");
4
- const unwrapRefValue = require("./unwrapRefValue.cjs");
5
- const useOnElementResize = require("./useOnElementResize.cjs");
6
- function px(value) {
7
- return typeof value === "number" && !(isNaN(value) || value === Infinity || value === -Infinity) ? value + "px" : "";
8
- }
9
- const useAutoHeightTextArea = (textAreaRef, value, minRows, maxRows) => {
10
- const measure = React.useCallback(async (ref, minRows2, maxRows2) => {
11
- if (ref) {
12
- const rowsAttribute = ref.rows;
13
- ref.style.height = "";
14
- ref.style.minHeight = "";
15
- ref.style.maxHeight = "";
16
- if (minRows2 !== maxRows2) {
17
- const height = ref.scrollHeight - ref.clientHeight + ref.offsetHeight;
18
- let minHeight;
19
- let maxHeight;
20
- ref.rows = minRows2;
21
- minHeight = await ref.getBoundingClientRect().height;
22
- if (maxRows2 === Infinity) {
23
- maxHeight = Infinity;
24
- } else {
25
- ref.rows = maxRows2;
26
- maxHeight = await ref.getBoundingClientRect().height;
27
- }
28
- ref.style.height = px(height);
29
- ref.style.minHeight = px(minHeight);
30
- ref.style.maxHeight = px(maxHeight);
31
- }
32
- ref.rows = rowsAttribute;
33
- }
34
- }, []);
35
- useOnElementResize.useOnElementResize(textAreaRef, () => {
36
- measure(unwrapRefValue.unwrapRefValue(textAreaRef), minRows, maxRows);
37
- });
38
- React.useLayoutEffect(() => {
39
- measure(unwrapRefValue.unwrapRefValue(textAreaRef), minRows, maxRows);
40
- }, [maxRows, measure, minRows, textAreaRef, value]);
41
- };
42
- exports.useAutoHeightTextArea = useAutoHeightTextArea;
43
- //# sourceMappingURL=useAutoHeightTextArea.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useAutoHeightTextArea.cjs","sources":["../../../../../packages/react-utils/src/hooks/useAutoHeightTextArea.ts"],"sourcesContent":["import { useCallback, useLayoutEffect } from 'react'\nimport { RefObjectOrElement, unwrapRefValue } from './unwrapRefValue'\nimport { useOnElementResize } from './useOnElementResize'\n\nfunction px<V extends number | false | null | undefined>(value?: V): string {\n\treturn typeof value === 'number' && !(isNaN(value) || value === Infinity || value === -Infinity) ? value + 'px' : ''\n}\n\nexport const useAutoHeightTextArea = (\n\ttextAreaRef: RefObjectOrElement<HTMLTextAreaElement>,\n\tvalue: string,\n\tminRows: number,\n\tmaxRows: number,\n) => {\n\tconst measure = useCallback(async (ref: HTMLTextAreaElement | null, minRows: number, maxRows: number) => {\n\t\tif (ref) {\n\t\t\tconst rowsAttribute = ref.rows\n\n\t\t\tref.style.height = ''\n\t\t\tref.style.minHeight = ''\n\t\t\tref.style.maxHeight = ''\n\n\t\t\tif (minRows !== maxRows) {\n\t\t\t\tconst height = ref.scrollHeight - ref.clientHeight + ref.offsetHeight\n\t\t\t\tlet minHeight: number\n\t\t\t\tlet maxHeight: number\n\n\t\t\t\tref.rows = minRows\n\t\t\t\tminHeight = await ref.getBoundingClientRect().height\n\n\t\t\t\tif (maxRows === Infinity) {\n\t\t\t\t\tmaxHeight = Infinity\n\t\t\t\t} else {\n\t\t\t\t\tref.rows = maxRows\n\t\t\t\t\tmaxHeight = await ref.getBoundingClientRect().height\n\t\t\t\t}\n\n\t\t\t\tref.style.height = px(height)\n\t\t\t\tref.style.minHeight = px(minHeight)\n\t\t\t\tref.style.maxHeight = px(maxHeight)\n\t\t\t}\n\n\t\t\tref.rows = rowsAttribute\n\t\t}\n\t}, [])\n\n\tuseOnElementResize(textAreaRef, () => {\n\t\tmeasure(unwrapRefValue(textAreaRef), minRows, maxRows)\n\t})\n\n\tuseLayoutEffect(() => {\n\t\tmeasure(unwrapRefValue(textAreaRef), minRows, maxRows)\n\t}, [maxRows, measure, minRows, textAreaRef, value])\n}\n"],"names":["useCallback","minRows","maxRows","useOnElementResize","unwrapRefValue","useLayoutEffect"],"mappings":";;;;;AAIA,SAAS,GAAgD,OAAmB;AAC3E,SAAO,OAAO,UAAU,YAAY,EAAE,MAAM,KAAK,KAAK,UAAU,YAAY,UAAU,aAAa,QAAQ,OAAO;AACnH;AAEO,MAAM,wBAAwB,CACpC,aACA,OACA,SACA,YACI;AACJ,QAAM,UAAUA,MAAA,YAAY,OAAO,KAAiCC,UAAiBC,aAAoB;AACxG,QAAI,KAAK;AACR,YAAM,gBAAgB,IAAI;AAE1B,UAAI,MAAM,SAAS;AACnB,UAAI,MAAM,YAAY;AACtB,UAAI,MAAM,YAAY;AAEtB,UAAID,aAAYC,UAAS;AACxB,cAAM,SAAS,IAAI,eAAe,IAAI,eAAe,IAAI;AACrD,YAAA;AACA,YAAA;AAEJ,YAAI,OAAOD;AACC,oBAAA,MAAM,IAAI,sBAAA,EAAwB;AAE9C,YAAIC,aAAY,UAAU;AACb,sBAAA;AAAA,QAAA,OACN;AACN,cAAI,OAAOA;AACC,sBAAA,MAAM,IAAI,sBAAA,EAAwB;AAAA,QAAA;AAG3C,YAAA,MAAM,SAAS,GAAG,MAAM;AACxB,YAAA,MAAM,YAAY,GAAG,SAAS;AAC9B,YAAA,MAAM,YAAY,GAAG,SAAS;AAAA,MAAA;AAGnC,UAAI,OAAO;AAAA,IAAA;AAAA,EAEb,GAAG,EAAE;AAELC,qBAAA,mBAAmB,aAAa,MAAM;AACrC,YAAQC,eAAAA,eAAe,WAAW,GAAG,SAAS,OAAO;AAAA,EAAA,CACrD;AAEDC,QAAAA,gBAAgB,MAAM;AACrB,YAAQD,eAAAA,eAAe,WAAW,GAAG,SAAS,OAAO;AAAA,EAAA,GACnD,CAAC,SAAS,SAAS,SAAS,aAAa,KAAK,CAAC;AACnD;;"}
@@ -1,43 +0,0 @@
1
- import { useCallback, useLayoutEffect } from "react";
2
- import { unwrapRefValue } from "./unwrapRefValue.js";
3
- import { useOnElementResize } from "./useOnElementResize.js";
4
- function px(value) {
5
- return typeof value === "number" && !(isNaN(value) || value === Infinity || value === -Infinity) ? value + "px" : "";
6
- }
7
- const useAutoHeightTextArea = (textAreaRef, value, minRows, maxRows) => {
8
- const measure = useCallback(async (ref, minRows2, maxRows2) => {
9
- if (ref) {
10
- const rowsAttribute = ref.rows;
11
- ref.style.height = "";
12
- ref.style.minHeight = "";
13
- ref.style.maxHeight = "";
14
- if (minRows2 !== maxRows2) {
15
- const height = ref.scrollHeight - ref.clientHeight + ref.offsetHeight;
16
- let minHeight;
17
- let maxHeight;
18
- ref.rows = minRows2;
19
- minHeight = await ref.getBoundingClientRect().height;
20
- if (maxRows2 === Infinity) {
21
- maxHeight = Infinity;
22
- } else {
23
- ref.rows = maxRows2;
24
- maxHeight = await ref.getBoundingClientRect().height;
25
- }
26
- ref.style.height = px(height);
27
- ref.style.minHeight = px(minHeight);
28
- ref.style.maxHeight = px(maxHeight);
29
- }
30
- ref.rows = rowsAttribute;
31
- }
32
- }, []);
33
- useOnElementResize(textAreaRef, () => {
34
- measure(unwrapRefValue(textAreaRef), minRows, maxRows);
35
- });
36
- useLayoutEffect(() => {
37
- measure(unwrapRefValue(textAreaRef), minRows, maxRows);
38
- }, [maxRows, measure, minRows, textAreaRef, value]);
39
- };
40
- export {
41
- useAutoHeightTextArea
42
- };
43
- //# sourceMappingURL=useAutoHeightTextArea.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useAutoHeightTextArea.js","sources":["../../../../../packages/react-utils/src/hooks/useAutoHeightTextArea.ts"],"sourcesContent":["import { useCallback, useLayoutEffect } from 'react'\nimport { RefObjectOrElement, unwrapRefValue } from './unwrapRefValue'\nimport { useOnElementResize } from './useOnElementResize'\n\nfunction px<V extends number | false | null | undefined>(value?: V): string {\n\treturn typeof value === 'number' && !(isNaN(value) || value === Infinity || value === -Infinity) ? value + 'px' : ''\n}\n\nexport const useAutoHeightTextArea = (\n\ttextAreaRef: RefObjectOrElement<HTMLTextAreaElement>,\n\tvalue: string,\n\tminRows: number,\n\tmaxRows: number,\n) => {\n\tconst measure = useCallback(async (ref: HTMLTextAreaElement | null, minRows: number, maxRows: number) => {\n\t\tif (ref) {\n\t\t\tconst rowsAttribute = ref.rows\n\n\t\t\tref.style.height = ''\n\t\t\tref.style.minHeight = ''\n\t\t\tref.style.maxHeight = ''\n\n\t\t\tif (minRows !== maxRows) {\n\t\t\t\tconst height = ref.scrollHeight - ref.clientHeight + ref.offsetHeight\n\t\t\t\tlet minHeight: number\n\t\t\t\tlet maxHeight: number\n\n\t\t\t\tref.rows = minRows\n\t\t\t\tminHeight = await ref.getBoundingClientRect().height\n\n\t\t\t\tif (maxRows === Infinity) {\n\t\t\t\t\tmaxHeight = Infinity\n\t\t\t\t} else {\n\t\t\t\t\tref.rows = maxRows\n\t\t\t\t\tmaxHeight = await ref.getBoundingClientRect().height\n\t\t\t\t}\n\n\t\t\t\tref.style.height = px(height)\n\t\t\t\tref.style.minHeight = px(minHeight)\n\t\t\t\tref.style.maxHeight = px(maxHeight)\n\t\t\t}\n\n\t\t\tref.rows = rowsAttribute\n\t\t}\n\t}, [])\n\n\tuseOnElementResize(textAreaRef, () => {\n\t\tmeasure(unwrapRefValue(textAreaRef), minRows, maxRows)\n\t})\n\n\tuseLayoutEffect(() => {\n\t\tmeasure(unwrapRefValue(textAreaRef), minRows, maxRows)\n\t}, [maxRows, measure, minRows, textAreaRef, value])\n}\n"],"names":["minRows","maxRows"],"mappings":";;;AAIA,SAAS,GAAgD,OAAmB;AAC3E,SAAO,OAAO,UAAU,YAAY,EAAE,MAAM,KAAK,KAAK,UAAU,YAAY,UAAU,aAAa,QAAQ,OAAO;AACnH;AAEO,MAAM,wBAAwB,CACpC,aACA,OACA,SACA,YACI;AACJ,QAAM,UAAU,YAAY,OAAO,KAAiCA,UAAiBC,aAAoB;AACxG,QAAI,KAAK;AACR,YAAM,gBAAgB,IAAI;AAE1B,UAAI,MAAM,SAAS;AACnB,UAAI,MAAM,YAAY;AACtB,UAAI,MAAM,YAAY;AAEtB,UAAID,aAAYC,UAAS;AACxB,cAAM,SAAS,IAAI,eAAe,IAAI,eAAe,IAAI;AACrD,YAAA;AACA,YAAA;AAEJ,YAAI,OAAOD;AACC,oBAAA,MAAM,IAAI,sBAAA,EAAwB;AAE9C,YAAIC,aAAY,UAAU;AACb,sBAAA;AAAA,QAAA,OACN;AACN,cAAI,OAAOA;AACC,sBAAA,MAAM,IAAI,sBAAA,EAAwB;AAAA,QAAA;AAG3C,YAAA,MAAM,SAAS,GAAG,MAAM;AACxB,YAAA,MAAM,YAAY,GAAG,SAAS;AAC9B,YAAA,MAAM,YAAY,GAAG,SAAS;AAAA,MAAA;AAGnC,UAAI,OAAO;AAAA,IAAA;AAAA,EAEb,GAAG,EAAE;AAEL,qBAAmB,aAAa,MAAM;AACrC,YAAQ,eAAe,WAAW,GAAG,SAAS,OAAO;AAAA,EAAA,CACrD;AAED,kBAAgB,MAAM;AACrB,YAAQ,eAAe,WAAW,GAAG,SAAS,OAAO;AAAA,EAAA,GACnD,CAAC,SAAS,SAAS,SAAS,aAAa,KAAK,CAAC;AACnD;"}
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const React = require("react");
4
- const MULTIPLE_SPACES_REG_EXP = / +/g;
5
- function normalize(text) {
6
- return text.replace(MULTIPLE_SPACES_REG_EXP, " ").trim();
7
- }
8
- function getChildrenAsLabel(node) {
9
- if (typeof node === "string" || typeof node === "number") {
10
- return String(node);
11
- } else if (node === null || node === void 0 || typeof node === "boolean") {
12
- return void 0;
13
- } else if (Array.isArray(node)) {
14
- return normalize(node.map(getChildrenAsLabel).join(""));
15
- } else {
16
- let label = [];
17
- React.Children.map(node, (child) => {
18
- if (child === null || child === void 0 || typeof child === "boolean") ;
19
- else if (typeof child === "string") {
20
- label.push(child);
21
- } else if (typeof child === "number") {
22
- label.push(child);
23
- } else if (Array.isArray(child)) {
24
- const childLabel = getChildrenAsLabel(child);
25
- if (childLabel) {
26
- label.push(childLabel);
27
- }
28
- } else {
29
- if ("props" in child && "children" in child.props) {
30
- const childLabel = getChildrenAsLabel(child.props.children);
31
- if (childLabel) {
32
- label.push(childLabel);
33
- }
34
- } else if ("children" in child) {
35
- const childLabel = getChildrenAsLabel(child.children);
36
- if (childLabel) {
37
- label.push(childLabel);
38
- }
39
- } else {
40
- console.warn("Unsupported child:", child);
41
- }
42
- }
43
- });
44
- return label.length > 0 ? label.join("") : void 0;
45
- }
46
- }
47
- function useChildrenAsLabel(node) {
48
- return React.useMemo(() => getChildrenAsLabel(node), [node]);
49
- }
50
- exports.getChildrenAsLabel = getChildrenAsLabel;
51
- exports.useChildrenAsLabel = useChildrenAsLabel;
52
- //# sourceMappingURL=useChildrenAsLabel.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useChildrenAsLabel.cjs","sources":["../../../../../packages/react-utils/src/hooks/useChildrenAsLabel.ts"],"sourcesContent":["import { Children, ReactNode, useMemo } from 'react'\n\nconst MULTIPLE_SPACES_REG_EXP = / +/g\n\nfunction normalize(text: string): string {\n\treturn text.replace(MULTIPLE_SPACES_REG_EXP, ' ').trim()\n}\n\n/**\n * Walks through the children and returns a string representation of the text content.\n *\n * @param node - The children to walk through.\n * @returns String representation of the text content or undefined if there is no text content.\n *\n */\nexport function getChildrenAsLabel(node: ReactNode): string | undefined {\n\tif (typeof node === 'string' || typeof node === 'number') {\n\t\treturn String(node)\n\t} else if (node === null || node === undefined || typeof node === 'boolean') {\n\t\treturn undefined\n\t} else if (Array.isArray(node)) {\n\t\treturn normalize(node.map(getChildrenAsLabel).join(''))\n\t} else {\n\t\tlet label: (string | number)[] = []\n\n\t\tChildren.map(node, child => {\n\t\t\tif (child === null || child === undefined || typeof child === 'boolean') {\n\t\t\t} else if (typeof child === 'string') {\n\t\t\t\tlabel.push(child)\n\t\t\t} else if (typeof child === 'number') {\n\t\t\t\tlabel.push(child)\n\t\t\t} else if (Array.isArray(child)) {\n\t\t\t\tconst childLabel = getChildrenAsLabel(child)\n\n\t\t\t\tif (childLabel) {\n\t\t\t\t\tlabel.push(childLabel)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// ReactElement | JSXElementConstructor | ReactPortal\n\t\t\t\tif ('props' in child && 'children' in child.props) {\n\t\t\t\t\tconst childLabel = getChildrenAsLabel(child.props.children)\n\n\t\t\t\t\tif (childLabel) {\n\t\t\t\t\t\tlabel.push(childLabel)\n\t\t\t\t\t}\n\t\t\t\t} else if ('children' in child) {\n\t\t\t\t\t// ReactPortal\n\t\t\t\t\tconst childLabel = getChildrenAsLabel(child.children)\n\n\t\t\t\t\tif (childLabel) {\n\t\t\t\t\t\tlabel.push(childLabel)\n\t\t\t\t\t}\n\t\t\t\t} else if (import.meta.env.DEV) {\n\t\t\t\t\tconsole.warn('Unsupported child:', child)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\n\t\treturn label.length > 0 ? label.join('') : undefined\n\t}\n}\n\n/**\n * Walks through the children and returns a string representation of the text content.\n *\n * @param node - The children to walk through.\n * @returns String representation of the text content or undefined if there is no text content.\n *\n */\nexport function useChildrenAsLabel(node: ReactNode): string | undefined {\n\treturn useMemo(() => getChildrenAsLabel(node), [node])\n}\n"],"names":["Children","useMemo"],"mappings":";;;AAEA,MAAM,0BAA0B;AAEhC,SAAS,UAAU,MAAsB;AACxC,SAAO,KAAK,QAAQ,yBAAyB,GAAG,EAAE,KAAK;AACxD;AASO,SAAS,mBAAmB,MAAqC;AACvE,MAAI,OAAO,SAAS,YAAY,OAAO,SAAS,UAAU;AACzD,WAAO,OAAO,IAAI;AAAA,EAAA,WACR,SAAS,QAAQ,SAAS,UAAa,OAAO,SAAS,WAAW;AACrE,WAAA;AAAA,EACG,WAAA,MAAM,QAAQ,IAAI,GAAG;AAC/B,WAAO,UAAU,KAAK,IAAI,kBAAkB,EAAE,KAAK,EAAE,CAAC;AAAA,EAAA,OAChD;AACN,QAAI,QAA6B,CAAC;AAEzBA,UAAAA,SAAA,IAAI,MAAM,CAAS,UAAA;AAC3B,UAAI,UAAU,QAAQ,UAAU,UAAa,OAAO,UAAU,UAAW;AAAA,eAC9D,OAAO,UAAU,UAAU;AACrC,cAAM,KAAK,KAAK;AAAA,MAAA,WACN,OAAO,UAAU,UAAU;AACrC,cAAM,KAAK,KAAK;AAAA,MACN,WAAA,MAAM,QAAQ,KAAK,GAAG;AAC1B,cAAA,aAAa,mBAAmB,KAAK;AAE3C,YAAI,YAAY;AACf,gBAAM,KAAK,UAAU;AAAA,QAAA;AAAA,MACtB,OACM;AAEN,YAAI,WAAW,SAAS,cAAc,MAAM,OAAO;AAClD,gBAAM,aAAa,mBAAmB,MAAM,MAAM,QAAQ;AAE1D,cAAI,YAAY;AACf,kBAAM,KAAK,UAAU;AAAA,UAAA;AAAA,QACtB,WACU,cAAc,OAAO;AAEzB,gBAAA,aAAa,mBAAmB,MAAM,QAAQ;AAEpD,cAAI,YAAY;AACf,kBAAM,KAAK,UAAU;AAAA,UAAA;AAAA,QACtB,OAC+B;AACvB,kBAAA,KAAK,sBAAsB,KAAK;AAAA,QAAA;AAAA,MACzC;AAAA,IACD,CACA;AAED,WAAO,MAAM,SAAS,IAAI,MAAM,KAAK,EAAE,IAAI;AAAA,EAAA;AAE7C;AASO,SAAS,mBAAmB,MAAqC;AACvE,SAAOC,MAAAA,QAAQ,MAAM,mBAAmB,IAAI,GAAG,CAAC,IAAI,CAAC;AACtD;;;"}
@@ -1,52 +0,0 @@
1
- import { Children, useMemo } from "react";
2
- const MULTIPLE_SPACES_REG_EXP = / +/g;
3
- function normalize(text) {
4
- return text.replace(MULTIPLE_SPACES_REG_EXP, " ").trim();
5
- }
6
- function getChildrenAsLabel(node) {
7
- if (typeof node === "string" || typeof node === "number") {
8
- return String(node);
9
- } else if (node === null || node === void 0 || typeof node === "boolean") {
10
- return void 0;
11
- } else if (Array.isArray(node)) {
12
- return normalize(node.map(getChildrenAsLabel).join(""));
13
- } else {
14
- let label = [];
15
- Children.map(node, (child) => {
16
- if (child === null || child === void 0 || typeof child === "boolean") ;
17
- else if (typeof child === "string") {
18
- label.push(child);
19
- } else if (typeof child === "number") {
20
- label.push(child);
21
- } else if (Array.isArray(child)) {
22
- const childLabel = getChildrenAsLabel(child);
23
- if (childLabel) {
24
- label.push(childLabel);
25
- }
26
- } else {
27
- if ("props" in child && "children" in child.props) {
28
- const childLabel = getChildrenAsLabel(child.props.children);
29
- if (childLabel) {
30
- label.push(childLabel);
31
- }
32
- } else if ("children" in child) {
33
- const childLabel = getChildrenAsLabel(child.children);
34
- if (childLabel) {
35
- label.push(childLabel);
36
- }
37
- } else {
38
- console.warn("Unsupported child:", child);
39
- }
40
- }
41
- });
42
- return label.length > 0 ? label.join("") : void 0;
43
- }
44
- }
45
- function useChildrenAsLabel(node) {
46
- return useMemo(() => getChildrenAsLabel(node), [node]);
47
- }
48
- export {
49
- getChildrenAsLabel,
50
- useChildrenAsLabel
51
- };
52
- //# sourceMappingURL=useChildrenAsLabel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useChildrenAsLabel.js","sources":["../../../../../packages/react-utils/src/hooks/useChildrenAsLabel.ts"],"sourcesContent":["import { Children, ReactNode, useMemo } from 'react'\n\nconst MULTIPLE_SPACES_REG_EXP = / +/g\n\nfunction normalize(text: string): string {\n\treturn text.replace(MULTIPLE_SPACES_REG_EXP, ' ').trim()\n}\n\n/**\n * Walks through the children and returns a string representation of the text content.\n *\n * @param node - The children to walk through.\n * @returns String representation of the text content or undefined if there is no text content.\n *\n */\nexport function getChildrenAsLabel(node: ReactNode): string | undefined {\n\tif (typeof node === 'string' || typeof node === 'number') {\n\t\treturn String(node)\n\t} else if (node === null || node === undefined || typeof node === 'boolean') {\n\t\treturn undefined\n\t} else if (Array.isArray(node)) {\n\t\treturn normalize(node.map(getChildrenAsLabel).join(''))\n\t} else {\n\t\tlet label: (string | number)[] = []\n\n\t\tChildren.map(node, child => {\n\t\t\tif (child === null || child === undefined || typeof child === 'boolean') {\n\t\t\t} else if (typeof child === 'string') {\n\t\t\t\tlabel.push(child)\n\t\t\t} else if (typeof child === 'number') {\n\t\t\t\tlabel.push(child)\n\t\t\t} else if (Array.isArray(child)) {\n\t\t\t\tconst childLabel = getChildrenAsLabel(child)\n\n\t\t\t\tif (childLabel) {\n\t\t\t\t\tlabel.push(childLabel)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// ReactElement | JSXElementConstructor | ReactPortal\n\t\t\t\tif ('props' in child && 'children' in child.props) {\n\t\t\t\t\tconst childLabel = getChildrenAsLabel(child.props.children)\n\n\t\t\t\t\tif (childLabel) {\n\t\t\t\t\t\tlabel.push(childLabel)\n\t\t\t\t\t}\n\t\t\t\t} else if ('children' in child) {\n\t\t\t\t\t// ReactPortal\n\t\t\t\t\tconst childLabel = getChildrenAsLabel(child.children)\n\n\t\t\t\t\tif (childLabel) {\n\t\t\t\t\t\tlabel.push(childLabel)\n\t\t\t\t\t}\n\t\t\t\t} else if (import.meta.env.DEV) {\n\t\t\t\t\tconsole.warn('Unsupported child:', child)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\n\t\treturn label.length > 0 ? label.join('') : undefined\n\t}\n}\n\n/**\n * Walks through the children and returns a string representation of the text content.\n *\n * @param node - The children to walk through.\n * @returns String representation of the text content or undefined if there is no text content.\n *\n */\nexport function useChildrenAsLabel(node: ReactNode): string | undefined {\n\treturn useMemo(() => getChildrenAsLabel(node), [node])\n}\n"],"names":[],"mappings":";AAEA,MAAM,0BAA0B;AAEhC,SAAS,UAAU,MAAsB;AACxC,SAAO,KAAK,QAAQ,yBAAyB,GAAG,EAAE,KAAK;AACxD;AASO,SAAS,mBAAmB,MAAqC;AACvE,MAAI,OAAO,SAAS,YAAY,OAAO,SAAS,UAAU;AACzD,WAAO,OAAO,IAAI;AAAA,EAAA,WACR,SAAS,QAAQ,SAAS,UAAa,OAAO,SAAS,WAAW;AACrE,WAAA;AAAA,EACG,WAAA,MAAM,QAAQ,IAAI,GAAG;AAC/B,WAAO,UAAU,KAAK,IAAI,kBAAkB,EAAE,KAAK,EAAE,CAAC;AAAA,EAAA,OAChD;AACN,QAAI,QAA6B,CAAC;AAEzB,aAAA,IAAI,MAAM,CAAS,UAAA;AAC3B,UAAI,UAAU,QAAQ,UAAU,UAAa,OAAO,UAAU,UAAW;AAAA,eAC9D,OAAO,UAAU,UAAU;AACrC,cAAM,KAAK,KAAK;AAAA,MAAA,WACN,OAAO,UAAU,UAAU;AACrC,cAAM,KAAK,KAAK;AAAA,MACN,WAAA,MAAM,QAAQ,KAAK,GAAG;AAC1B,cAAA,aAAa,mBAAmB,KAAK;AAE3C,YAAI,YAAY;AACf,gBAAM,KAAK,UAAU;AAAA,QAAA;AAAA,MACtB,OACM;AAEN,YAAI,WAAW,SAAS,cAAc,MAAM,OAAO;AAClD,gBAAM,aAAa,mBAAmB,MAAM,MAAM,QAAQ;AAE1D,cAAI,YAAY;AACf,kBAAM,KAAK,UAAU;AAAA,UAAA;AAAA,QACtB,WACU,cAAc,OAAO;AAEzB,gBAAA,aAAa,mBAAmB,MAAM,QAAQ;AAEpD,cAAI,YAAY;AACf,kBAAM,KAAK,UAAU;AAAA,UAAA;AAAA,QACtB,OAC+B;AACvB,kBAAA,KAAK,sBAAsB,KAAK;AAAA,QAAA;AAAA,MACzC;AAAA,IACD,CACA;AAED,WAAO,MAAM,SAAS,IAAI,MAAM,KAAK,EAAE,IAAI;AAAA,EAAA;AAE7C;AASO,SAAS,mBAAmB,MAAqC;AACvE,SAAO,QAAQ,MAAM,mBAAmB,IAAI,GAAG,CAAC,IAAI,CAAC;AACtD;"}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const React = require("react");
4
- function setRef(ref, instance) {
5
- if (ref) {
6
- if (typeof ref === "function") {
7
- ref(instance);
8
- } else if (instance) {
9
- ref.current = instance;
10
- }
11
- }
12
- }
13
- function useComposeRef(...refs) {
14
- const initialRefs = React.useRef(refs);
15
- const composeRef = React.useMemo(() => {
16
- function composedRefCallback(instance) {
17
- initialRefs.current.forEach((ref) => setRef(ref, instance));
18
- setCurrent(instance);
19
- }
20
- function setCurrent(instance) {
21
- if (instance) {
22
- composedRefCallback.current = instance;
23
- }
24
- }
25
- composedRefCallback.current = null;
26
- return composedRefCallback;
27
- }, []);
28
- return composeRef;
29
- }
30
- exports.useComposeRef = useComposeRef;
31
- //# sourceMappingURL=useComposeRef.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useComposeRef.cjs","sources":["../../../../../packages/react-utils/src/hooks/useComposeRef.ts"],"sourcesContent":["import { MutableRefObject, RefCallback, useMemo, useRef } from 'react'\n\nexport type MaybeRef<T> = ((instance: T | null) => void) | MutableRefObject<T | null> | null | undefined\nexport type ComposedRefCallback<T> = RefCallback<T> & { current: T | null }\n\nfunction setRef<T>(ref: MaybeRef<T>, instance: T | null): void {\n\tif (ref) {\n\t\tif (typeof ref === 'function') {\n\t\t\tref(instance)\n\t\t} else if (instance) {\n\t\t\tref.current = instance\n\t\t}\n\t}\n}\n\n/**\n * Fills any number of refs with an instance\n *\n * Useful when you need to use outer ref and inner in the same time, e.g. passing element\n * back to forwardedRef an also using the same value within the component locally.\n *\n * @param refs - Rest parameter of refs to fill with instance\n * @returns Returns a function similar to a RefCallback\n */\nexport function useComposeRef<T>(...refs: MaybeRef<T>[]): ComposedRefCallback<T> {\n\tconst initialRefs = useRef(refs)\n\n\tconst composeRef: ComposedRefCallback<T> = useMemo(() => {\n\t\tfunction composedRefCallback(instance: T | null) {\n\t\t\tinitialRefs.current.forEach(ref => setRef(ref, instance))\n\t\t\tsetCurrent(instance)\n\t\t}\n\n\t\tfunction setCurrent(instance: T | null) {\n\t\t\tif (instance) {\n\t\t\t\tcomposedRefCallback.current = instance\n\t\t\t}\n\t\t}\n\n\t\tcomposedRefCallback.current = null as T | null\n\n\t\treturn composedRefCallback\n\t}, [])\n\n\treturn composeRef\n}\n"],"names":["useRef","useMemo"],"mappings":";;;AAKA,SAAS,OAAU,KAAkB,UAA0B;AAC9D,MAAI,KAAK;AACJ,QAAA,OAAO,QAAQ,YAAY;AAC9B,UAAI,QAAQ;AAAA,eACF,UAAU;AACpB,UAAI,UAAU;AAAA,IAAA;AAAA,EACf;AAEF;AAWO,SAAS,iBAAoB,MAA6C;AAC1E,QAAA,cAAcA,aAAO,IAAI;AAEzB,QAAA,aAAqCC,MAAAA,QAAQ,MAAM;AACxD,aAAS,oBAAoB,UAAoB;AAChD,kBAAY,QAAQ,QAAQ,CAAA,QAAO,OAAO,KAAK,QAAQ,CAAC;AACxD,iBAAW,QAAQ;AAAA,IAAA;AAGpB,aAAS,WAAW,UAAoB;AACvC,UAAI,UAAU;AACb,4BAAoB,UAAU;AAAA,MAAA;AAAA,IAC/B;AAGD,wBAAoB,UAAU;AAEvB,WAAA;AAAA,EACR,GAAG,EAAE;AAEE,SAAA;AACR;;"}
@@ -1,31 +0,0 @@
1
- import { useRef, useMemo } from "react";
2
- function setRef(ref, instance) {
3
- if (ref) {
4
- if (typeof ref === "function") {
5
- ref(instance);
6
- } else if (instance) {
7
- ref.current = instance;
8
- }
9
- }
10
- }
11
- function useComposeRef(...refs) {
12
- const initialRefs = useRef(refs);
13
- const composeRef = useMemo(() => {
14
- function composedRefCallback(instance) {
15
- initialRefs.current.forEach((ref) => setRef(ref, instance));
16
- setCurrent(instance);
17
- }
18
- function setCurrent(instance) {
19
- if (instance) {
20
- composedRefCallback.current = instance;
21
- }
22
- }
23
- composedRefCallback.current = null;
24
- return composedRefCallback;
25
- }, []);
26
- return composeRef;
27
- }
28
- export {
29
- useComposeRef
30
- };
31
- //# sourceMappingURL=useComposeRef.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useComposeRef.js","sources":["../../../../../packages/react-utils/src/hooks/useComposeRef.ts"],"sourcesContent":["import { MutableRefObject, RefCallback, useMemo, useRef } from 'react'\n\nexport type MaybeRef<T> = ((instance: T | null) => void) | MutableRefObject<T | null> | null | undefined\nexport type ComposedRefCallback<T> = RefCallback<T> & { current: T | null }\n\nfunction setRef<T>(ref: MaybeRef<T>, instance: T | null): void {\n\tif (ref) {\n\t\tif (typeof ref === 'function') {\n\t\t\tref(instance)\n\t\t} else if (instance) {\n\t\t\tref.current = instance\n\t\t}\n\t}\n}\n\n/**\n * Fills any number of refs with an instance\n *\n * Useful when you need to use outer ref and inner in the same time, e.g. passing element\n * back to forwardedRef an also using the same value within the component locally.\n *\n * @param refs - Rest parameter of refs to fill with instance\n * @returns Returns a function similar to a RefCallback\n */\nexport function useComposeRef<T>(...refs: MaybeRef<T>[]): ComposedRefCallback<T> {\n\tconst initialRefs = useRef(refs)\n\n\tconst composeRef: ComposedRefCallback<T> = useMemo(() => {\n\t\tfunction composedRefCallback(instance: T | null) {\n\t\t\tinitialRefs.current.forEach(ref => setRef(ref, instance))\n\t\t\tsetCurrent(instance)\n\t\t}\n\n\t\tfunction setCurrent(instance: T | null) {\n\t\t\tif (instance) {\n\t\t\t\tcomposedRefCallback.current = instance\n\t\t\t}\n\t\t}\n\n\t\tcomposedRefCallback.current = null as T | null\n\n\t\treturn composedRefCallback\n\t}, [])\n\n\treturn composeRef\n}\n"],"names":[],"mappings":";AAKA,SAAS,OAAU,KAAkB,UAA0B;AAC9D,MAAI,KAAK;AACJ,QAAA,OAAO,QAAQ,YAAY;AAC9B,UAAI,QAAQ;AAAA,eACF,UAAU;AACpB,UAAI,UAAU;AAAA,IAAA;AAAA,EACf;AAEF;AAWO,SAAS,iBAAoB,MAA6C;AAC1E,QAAA,cAAc,OAAO,IAAI;AAEzB,QAAA,aAAqC,QAAQ,MAAM;AACxD,aAAS,oBAAoB,UAAoB;AAChD,kBAAY,QAAQ,QAAQ,CAAA,QAAO,OAAO,KAAK,QAAQ,CAAC;AACxD,iBAAW,QAAQ;AAAA,IAAA;AAGpB,aAAS,WAAW,UAAoB;AACvC,UAAI,UAAU;AACb,4BAAoB,UAAU;AAAA,MAAA;AAAA,IAC/B;AAGD,wBAAoB,UAAU;AAEvB,WAAA;AAAA,EACR,GAAG,EAAE;AAEE,SAAA;AACR;"}