@contember/react-utils 1.3.0-rc.3 → 2.0.0-alpha.10

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 (657) hide show
  1. package/api-extractor.json +3 -0
  2. package/dist/development/index.cjs +35 -72
  3. package/dist/development/index.cjs.map +1 -1
  4. package/dist/development/index.js +35 -72
  5. package/dist/development/index.js.map +1 -1
  6. package/dist/development/{context → src/context}/createContext.cjs +3 -3
  7. package/dist/development/src/context/createContext.cjs.map +1 -0
  8. package/dist/development/src/context/createContext.js.map +1 -0
  9. package/dist/{production → development/src}/context/createRequiredContext.cjs +3 -3
  10. package/dist/development/src/context/createRequiredContext.cjs.map +1 -0
  11. package/dist/development/src/context/createRequiredContext.js.map +1 -0
  12. package/dist/development/src/debug-context/Constants.cjs.map +1 -0
  13. package/dist/development/src/debug-context/Constants.js.map +1 -0
  14. package/dist/development/{debug-context → src/debug-context}/Context.cjs +8 -8
  15. package/dist/development/src/debug-context/Context.cjs.map +1 -0
  16. package/dist/development/{debug-context → src/debug-context}/Context.js +1 -1
  17. package/dist/development/src/debug-context/Context.js.map +1 -0
  18. package/dist/development/src/hooks/unwrapRefValue.cjs.map +1 -0
  19. package/dist/development/src/hooks/unwrapRefValue.js.map +1 -0
  20. package/dist/development/{hooks → src/hooks}/useAbortController.cjs +4 -4
  21. package/dist/development/src/hooks/useAbortController.cjs.map +1 -0
  22. package/dist/development/src/hooks/useAbortController.js.map +1 -0
  23. package/dist/development/{hooks → src/hooks}/useArrayMapMemo.cjs +3 -3
  24. package/dist/development/src/hooks/useArrayMapMemo.cjs.map +1 -0
  25. package/dist/development/src/hooks/useArrayMapMemo.js.map +1 -0
  26. package/dist/development/{hooks → src/hooks}/useAutoHeightTextArea.cjs +3 -3
  27. package/dist/development/src/hooks/useAutoHeightTextArea.cjs.map +1 -0
  28. package/dist/development/src/hooks/useAutoHeightTextArea.js.map +1 -0
  29. package/dist/development/{hooks → src/hooks}/useChildrenAsLabel.cjs +4 -5
  30. package/dist/development/src/hooks/useChildrenAsLabel.cjs.map +1 -0
  31. package/dist/development/{hooks → src/hooks}/useChildrenAsLabel.js +1 -2
  32. package/dist/development/src/hooks/useChildrenAsLabel.js.map +1 -0
  33. package/dist/development/{hooks → src/hooks}/useComposeRef.cjs +3 -3
  34. package/dist/development/src/hooks/useComposeRef.cjs.map +1 -0
  35. package/dist/development/src/hooks/useComposeRef.js.map +1 -0
  36. package/dist/development/src/hooks/useConstantLengthInvariant.cjs.map +1 -0
  37. package/dist/development/src/hooks/useConstantLengthInvariant.js.map +1 -0
  38. package/dist/development/src/hooks/useConstantValueInvariant.cjs.map +1 -0
  39. package/dist/development/src/hooks/useConstantValueInvariant.js.map +1 -0
  40. package/dist/development/{hooks → src/hooks}/useDebounce.cjs +3 -3
  41. package/dist/development/src/hooks/useDebounce.cjs.map +1 -0
  42. package/dist/development/src/hooks/useDebounce.js.map +1 -0
  43. package/dist/development/{hooks → src/hooks}/useDebounceCallback.cjs +5 -5
  44. package/dist/development/src/hooks/useDebounceCallback.cjs.map +1 -0
  45. package/dist/development/src/hooks/useDebounceCallback.js.map +1 -0
  46. package/dist/development/{hooks → src/hooks}/useDocumentTitle.cjs +3 -3
  47. package/dist/development/src/hooks/useDocumentTitle.cjs.map +1 -0
  48. package/dist/development/src/hooks/useDocumentTitle.js.map +1 -0
  49. package/dist/development/{hooks → src/hooks}/useExpectSameValueReference.cjs +4 -4
  50. package/dist/development/src/hooks/useExpectSameValueReference.cjs.map +1 -0
  51. package/dist/development/{hooks → src/hooks}/useExpectSameValueReference.js +2 -2
  52. package/dist/development/src/hooks/useExpectSameValueReference.js.map +1 -0
  53. package/dist/development/{hooks → src/hooks}/useForceRender.cjs +2 -2
  54. package/dist/development/src/hooks/useForceRender.cjs.map +1 -0
  55. package/dist/development/src/hooks/useForceRender.js.map +1 -0
  56. package/dist/{production → development/src}/hooks/useId.cjs +2 -2
  57. package/dist/development/src/hooks/useId.cjs.map +1 -0
  58. package/dist/development/src/hooks/useId.js.map +1 -0
  59. package/dist/development/{hooks → src/hooks}/useIsMounted.cjs +3 -3
  60. package/dist/development/src/hooks/useIsMounted.cjs.map +1 -0
  61. package/dist/development/src/hooks/useIsMounted.js.map +1 -0
  62. package/dist/{production → development/src}/hooks/useObjectMemo.cjs +2 -2
  63. package/dist/development/src/hooks/useObjectMemo.cjs.map +1 -0
  64. package/dist/development/src/hooks/useObjectMemo.js.map +1 -0
  65. package/dist/{production → development/src}/hooks/useOnElementClickOutsideCallback.cjs +2 -2
  66. package/dist/development/src/hooks/useOnElementClickOutsideCallback.cjs.map +1 -0
  67. package/dist/development/src/hooks/useOnElementClickOutsideCallback.js.map +1 -0
  68. package/dist/development/{hooks → src/hooks}/useOnElementMouseEnterDelayedCallback.cjs +2 -2
  69. package/dist/development/src/hooks/useOnElementMouseEnterDelayedCallback.cjs.map +1 -0
  70. package/dist/development/src/hooks/useOnElementMouseEnterDelayedCallback.js.map +1 -0
  71. package/dist/{production → development/src}/hooks/useOnElementResize.cjs +5 -5
  72. package/dist/development/src/hooks/useOnElementResize.cjs.map +1 -0
  73. package/dist/development/{hooks → src/hooks}/useOnElementResize.js +1 -1
  74. package/dist/development/src/hooks/useOnElementResize.js.map +1 -0
  75. package/dist/{production → development/src}/hooks/useOnWindowResize.cjs +5 -5
  76. package/dist/development/src/hooks/useOnWindowResize.cjs.map +1 -0
  77. package/dist/development/{hooks → src/hooks}/useOnWindowResize.js +1 -1
  78. package/dist/development/src/hooks/useOnWindowResize.js.map +1 -0
  79. package/dist/development/{hooks → src/hooks}/usePreviousValue.cjs +3 -3
  80. package/dist/development/src/hooks/usePreviousValue.cjs.map +1 -0
  81. package/dist/development/src/hooks/usePreviousValue.js.map +1 -0
  82. package/dist/{production → development/src}/hooks/useStoredState.cjs +4 -4
  83. package/dist/development/src/hooks/useStoredState.cjs.map +1 -0
  84. package/dist/development/src/hooks/useStoredState.js.map +1 -0
  85. package/dist/development/{hooks → src/hooks}/useUpdatedRef.cjs +2 -2
  86. package/dist/development/src/hooks/useUpdatedRef.cjs.map +1 -0
  87. package/dist/development/src/hooks/useUpdatedRef.js.map +1 -0
  88. package/dist/development/{hooks → src/hooks}/useWindowSize.cjs +4 -4
  89. package/dist/development/src/hooks/useWindowSize.cjs.map +1 -0
  90. package/dist/development/src/hooks/useWindowSize.js.map +1 -0
  91. package/dist/development/src/referentiallyStable/emptyArray.cjs.map +1 -0
  92. package/dist/development/src/referentiallyStable/emptyArray.js.map +1 -0
  93. package/dist/development/src/referentiallyStable/emptyObject.cjs.map +1 -0
  94. package/dist/development/src/referentiallyStable/emptyObject.js.map +1 -0
  95. package/dist/development/src/referentiallyStable/identityFunction.cjs.map +1 -0
  96. package/dist/development/src/referentiallyStable/identityFunction.js.map +1 -0
  97. package/dist/development/src/referentiallyStable/noop.cjs.map +1 -0
  98. package/dist/development/src/referentiallyStable/noop.js.map +1 -0
  99. package/dist/development/src/referentiallyStable/returnFalse.cjs.map +1 -0
  100. package/dist/development/src/referentiallyStable/returnFalse.js.map +1 -0
  101. package/dist/development/src/referentiallyStable/returnTrue.cjs.map +1 -0
  102. package/dist/development/src/referentiallyStable/returnTrue.js.map +1 -0
  103. package/dist/{production → development/src}/referentiallyStable/useReferentiallyStableCallback.cjs +3 -3
  104. package/dist/development/src/referentiallyStable/useReferentiallyStableCallback.cjs.map +1 -0
  105. package/dist/development/src/referentiallyStable/useReferentiallyStableCallback.js.map +1 -0
  106. package/dist/production/index.cjs +35 -72
  107. package/dist/production/index.cjs.map +1 -1
  108. package/dist/production/index.js +35 -72
  109. package/dist/production/index.js.map +1 -1
  110. package/dist/production/{context → src/context}/createContext.cjs +3 -3
  111. package/dist/production/src/context/createContext.cjs.map +1 -0
  112. package/dist/production/src/context/createContext.js.map +1 -0
  113. package/dist/{development → production/src}/context/createRequiredContext.cjs +3 -3
  114. package/dist/production/src/context/createRequiredContext.cjs.map +1 -0
  115. package/dist/production/src/context/createRequiredContext.js.map +1 -0
  116. package/dist/production/src/debug-context/Constants.cjs.map +1 -0
  117. package/dist/production/src/debug-context/Constants.js.map +1 -0
  118. package/dist/production/{debug-context → src/debug-context}/Context.cjs +7 -7
  119. package/dist/production/src/debug-context/Context.cjs.map +1 -0
  120. package/dist/production/src/debug-context/Context.js.map +1 -0
  121. package/dist/production/src/hooks/unwrapRefValue.cjs.map +1 -0
  122. package/dist/production/src/hooks/unwrapRefValue.js.map +1 -0
  123. package/dist/production/{hooks → src/hooks}/useAbortController.cjs +4 -4
  124. package/dist/production/src/hooks/useAbortController.cjs.map +1 -0
  125. package/dist/production/src/hooks/useAbortController.js.map +1 -0
  126. package/dist/production/{hooks → src/hooks}/useArrayMapMemo.cjs +3 -3
  127. package/dist/production/src/hooks/useArrayMapMemo.cjs.map +1 -0
  128. package/dist/production/src/hooks/useArrayMapMemo.js.map +1 -0
  129. package/dist/production/{hooks → src/hooks}/useAutoHeightTextArea.cjs +3 -3
  130. package/dist/production/src/hooks/useAutoHeightTextArea.cjs.map +1 -0
  131. package/dist/production/src/hooks/useAutoHeightTextArea.js.map +1 -0
  132. package/dist/production/{hooks → src/hooks}/useChildrenAsLabel.cjs +5 -7
  133. package/dist/production/src/hooks/useChildrenAsLabel.cjs.map +1 -0
  134. package/dist/production/{hooks → src/hooks}/useChildrenAsLabel.js +2 -4
  135. package/dist/production/src/hooks/useChildrenAsLabel.js.map +1 -0
  136. package/dist/production/{hooks → src/hooks}/useComposeRef.cjs +3 -3
  137. package/dist/production/src/hooks/useComposeRef.cjs.map +1 -0
  138. package/dist/production/src/hooks/useComposeRef.js.map +1 -0
  139. package/dist/production/src/hooks/useConstantLengthInvariant.cjs.map +1 -0
  140. package/dist/production/src/hooks/useConstantLengthInvariant.js.map +1 -0
  141. package/dist/production/src/hooks/useConstantValueInvariant.cjs.map +1 -0
  142. package/dist/production/src/hooks/useConstantValueInvariant.js.map +1 -0
  143. package/dist/production/{hooks → src/hooks}/useDebounce.cjs +3 -3
  144. package/dist/production/src/hooks/useDebounce.cjs.map +1 -0
  145. package/dist/production/src/hooks/useDebounce.js.map +1 -0
  146. package/dist/production/{hooks → src/hooks}/useDebounceCallback.cjs +5 -5
  147. package/dist/production/src/hooks/useDebounceCallback.cjs.map +1 -0
  148. package/dist/production/src/hooks/useDebounceCallback.js.map +1 -0
  149. package/dist/production/{hooks → src/hooks}/useDocumentTitle.cjs +3 -3
  150. package/dist/production/src/hooks/useDocumentTitle.cjs.map +1 -0
  151. package/dist/production/src/hooks/useDocumentTitle.js.map +1 -0
  152. package/dist/production/{hooks → src/hooks}/useExpectSameValueReference.cjs +4 -4
  153. package/dist/production/src/hooks/useExpectSameValueReference.cjs.map +1 -0
  154. package/dist/production/{hooks → src/hooks}/useExpectSameValueReference.js +2 -2
  155. package/dist/production/src/hooks/useExpectSameValueReference.js.map +1 -0
  156. package/dist/production/{hooks → src/hooks}/useForceRender.cjs +2 -2
  157. package/dist/production/src/hooks/useForceRender.cjs.map +1 -0
  158. package/dist/production/src/hooks/useForceRender.js.map +1 -0
  159. package/dist/{development → production/src}/hooks/useId.cjs +2 -2
  160. package/dist/production/src/hooks/useId.cjs.map +1 -0
  161. package/dist/production/src/hooks/useId.js.map +1 -0
  162. package/dist/production/{hooks → src/hooks}/useIsMounted.cjs +3 -3
  163. package/dist/production/src/hooks/useIsMounted.cjs.map +1 -0
  164. package/dist/production/src/hooks/useIsMounted.js.map +1 -0
  165. package/dist/{development → production/src}/hooks/useObjectMemo.cjs +2 -2
  166. package/dist/production/src/hooks/useObjectMemo.cjs.map +1 -0
  167. package/dist/production/src/hooks/useObjectMemo.js.map +1 -0
  168. package/dist/{development → production/src}/hooks/useOnElementClickOutsideCallback.cjs +2 -2
  169. package/dist/production/src/hooks/useOnElementClickOutsideCallback.cjs.map +1 -0
  170. package/dist/production/src/hooks/useOnElementClickOutsideCallback.js.map +1 -0
  171. package/dist/production/{hooks → src/hooks}/useOnElementMouseEnterDelayedCallback.cjs +2 -2
  172. package/dist/production/src/hooks/useOnElementMouseEnterDelayedCallback.cjs.map +1 -0
  173. package/dist/production/src/hooks/useOnElementMouseEnterDelayedCallback.js.map +1 -0
  174. package/dist/{development → production/src}/hooks/useOnElementResize.cjs +5 -5
  175. package/dist/production/src/hooks/useOnElementResize.cjs.map +1 -0
  176. package/dist/production/{hooks → src/hooks}/useOnElementResize.js +1 -1
  177. package/dist/production/src/hooks/useOnElementResize.js.map +1 -0
  178. package/dist/{development → production/src}/hooks/useOnWindowResize.cjs +5 -5
  179. package/dist/production/src/hooks/useOnWindowResize.cjs.map +1 -0
  180. package/dist/production/{hooks → src/hooks}/useOnWindowResize.js +1 -1
  181. package/dist/production/src/hooks/useOnWindowResize.js.map +1 -0
  182. package/dist/production/{hooks → src/hooks}/usePreviousValue.cjs +3 -3
  183. package/dist/production/src/hooks/usePreviousValue.cjs.map +1 -0
  184. package/dist/production/src/hooks/usePreviousValue.js.map +1 -0
  185. package/dist/{development → production/src}/hooks/useStoredState.cjs +4 -4
  186. package/dist/production/src/hooks/useStoredState.cjs.map +1 -0
  187. package/dist/production/src/hooks/useStoredState.js.map +1 -0
  188. package/dist/production/{hooks → src/hooks}/useUpdatedRef.cjs +2 -2
  189. package/dist/production/src/hooks/useUpdatedRef.cjs.map +1 -0
  190. package/dist/production/src/hooks/useUpdatedRef.js.map +1 -0
  191. package/dist/production/{hooks → src/hooks}/useWindowSize.cjs +4 -4
  192. package/dist/production/src/hooks/useWindowSize.cjs.map +1 -0
  193. package/dist/production/src/hooks/useWindowSize.js.map +1 -0
  194. package/dist/production/src/referentiallyStable/emptyArray.cjs.map +1 -0
  195. package/dist/production/src/referentiallyStable/emptyArray.js.map +1 -0
  196. package/dist/production/src/referentiallyStable/emptyObject.cjs.map +1 -0
  197. package/dist/production/src/referentiallyStable/emptyObject.js.map +1 -0
  198. package/dist/production/src/referentiallyStable/identityFunction.cjs.map +1 -0
  199. package/dist/production/src/referentiallyStable/identityFunction.js.map +1 -0
  200. package/dist/production/src/referentiallyStable/noop.cjs.map +1 -0
  201. package/dist/production/src/referentiallyStable/noop.js.map +1 -0
  202. package/dist/production/src/referentiallyStable/returnFalse.cjs.map +1 -0
  203. package/dist/production/src/referentiallyStable/returnFalse.js.map +1 -0
  204. package/dist/production/src/referentiallyStable/returnTrue.cjs.map +1 -0
  205. package/dist/production/src/referentiallyStable/returnTrue.js.map +1 -0
  206. package/dist/{development → production/src}/referentiallyStable/useReferentiallyStableCallback.cjs +3 -3
  207. package/dist/production/src/referentiallyStable/useReferentiallyStableCallback.cjs.map +1 -0
  208. package/dist/production/src/referentiallyStable/useReferentiallyStableCallback.js.map +1 -0
  209. package/dist/types/debug-context/Types.d.ts.map +1 -1
  210. package/dist/types/hooks/index.d.ts +0 -10
  211. package/dist/types/hooks/index.d.ts.map +1 -1
  212. package/dist/types/hooks/useArrayMapMemo.d.ts.map +1 -1
  213. package/dist/types/hooks/useAutoHeightTextArea.d.ts.map +1 -1
  214. package/dist/types/hooks/useComposeRef.d.ts.map +1 -1
  215. package/dist/types/hooks/useConstantLengthInvariant.d.ts.map +1 -1
  216. package/dist/types/hooks/useConstantValueInvariant.d.ts.map +1 -1
  217. package/dist/types/hooks/useDebounce.d.ts.map +1 -1
  218. package/dist/types/hooks/useObjectMemo.d.ts.map +1 -1
  219. package/dist/types/hooks/usePreviousValue.d.ts.map +1 -1
  220. package/dist/types/hooks/useStoredState.d.ts.map +1 -1
  221. package/dist/types/index.d.ts +0 -1
  222. package/dist/types/index.d.ts.map +1 -1
  223. package/dist/types/referentiallyStable/emptyArray.d.ts.map +1 -1
  224. package/dist/types/referentiallyStable/identityFunction.d.ts.map +1 -1
  225. package/dist/types/referentiallyStable/useReferentiallyStableCallback.d.ts.map +1 -1
  226. package/dist/types/tsconfig.tsbuildinfo +1 -1
  227. package/dist/types/types/PropsWithRequiredChildren.d.ts.map +1 -1
  228. package/package.json +5 -13
  229. package/src/context/createContext.ts +3 -3
  230. package/src/context/createRequiredContext.ts +10 -10
  231. package/src/debug-context/Types.ts +8 -8
  232. package/src/hooks/index.ts +0 -10
  233. package/src/hooks/useComposeRef.ts +1 -1
  234. package/src/hooks/useExpectSameValueReference.ts +3 -3
  235. package/src/hooks/useOnElementResize.ts +1 -1
  236. package/src/hooks/useOnWindowResize.ts +1 -1
  237. package/src/hooks/useStoredState.ts +2 -2
  238. package/src/hooks/useWindowSize.ts +12 -12
  239. package/src/index.ts +0 -1
  240. package/src/tsconfig.json +5 -2
  241. package/src/types/PropsWithRequiredChildren.ts +1 -1
  242. package/tests/hooks/useChildrenAsLabel.test.tsx +96 -0
  243. package/tests/hooks/useId.test.ts +13 -0
  244. package/tests/tsconfig.json +10 -0
  245. package/tsconfig.json +8 -0
  246. package/tsdoc.json +6 -0
  247. package/dist/development/context/createContext.cjs.map +0 -1
  248. package/dist/development/context/createContext.js.map +0 -1
  249. package/dist/development/context/createRequiredContext.cjs.map +0 -1
  250. package/dist/development/context/createRequiredContext.js.map +0 -1
  251. package/dist/development/debug-context/Constants.cjs.map +0 -1
  252. package/dist/development/debug-context/Constants.js.map +0 -1
  253. package/dist/development/debug-context/Context.cjs.map +0 -1
  254. package/dist/development/debug-context/Context.js.map +0 -1
  255. package/dist/development/hooks/unwrapRefValue.cjs.map +0 -1
  256. package/dist/development/hooks/unwrapRefValue.js.map +0 -1
  257. package/dist/development/hooks/useAbortController.cjs.map +0 -1
  258. package/dist/development/hooks/useAbortController.js.map +0 -1
  259. package/dist/development/hooks/useAddClassNameDuringResize.cjs +0 -32
  260. package/dist/development/hooks/useAddClassNameDuringResize.cjs.map +0 -1
  261. package/dist/development/hooks/useAddClassNameDuringResize.js +0 -32
  262. package/dist/development/hooks/useAddClassNameDuringResize.js.map +0 -1
  263. package/dist/development/hooks/useArrayMapMemo.cjs.map +0 -1
  264. package/dist/development/hooks/useArrayMapMemo.js.map +0 -1
  265. package/dist/development/hooks/useAutoHeightTextArea.cjs.map +0 -1
  266. package/dist/development/hooks/useAutoHeightTextArea.js.map +0 -1
  267. package/dist/development/hooks/useChildrenAsLabel.cjs.map +0 -1
  268. package/dist/development/hooks/useChildrenAsLabel.js.map +0 -1
  269. package/dist/development/hooks/useCloseOnClickOutside.cjs +0 -25
  270. package/dist/development/hooks/useCloseOnClickOutside.cjs.map +0 -1
  271. package/dist/development/hooks/useCloseOnClickOutside.js +0 -25
  272. package/dist/development/hooks/useCloseOnClickOutside.js.map +0 -1
  273. package/dist/development/hooks/useCloseOnEscape.cjs +0 -20
  274. package/dist/development/hooks/useCloseOnEscape.cjs.map +0 -1
  275. package/dist/development/hooks/useCloseOnEscape.js +0 -20
  276. package/dist/development/hooks/useCloseOnEscape.js.map +0 -1
  277. package/dist/development/hooks/useComposeRef.cjs.map +0 -1
  278. package/dist/development/hooks/useComposeRef.js.map +0 -1
  279. package/dist/development/hooks/useConstantLengthInvariant.cjs.map +0 -1
  280. package/dist/development/hooks/useConstantLengthInvariant.js.map +0 -1
  281. package/dist/development/hooks/useConstantValueInvariant.cjs.map +0 -1
  282. package/dist/development/hooks/useConstantValueInvariant.js.map +0 -1
  283. package/dist/development/hooks/useContainerWidth.cjs +0 -14
  284. package/dist/development/hooks/useContainerWidth.cjs.map +0 -1
  285. package/dist/development/hooks/useContainerWidth.js +0 -14
  286. package/dist/development/hooks/useContainerWidth.js.map +0 -1
  287. package/dist/development/hooks/useDebounce.cjs.map +0 -1
  288. package/dist/development/hooks/useDebounce.js.map +0 -1
  289. package/dist/development/hooks/useDebounceCallback.cjs.map +0 -1
  290. package/dist/development/hooks/useDebounceCallback.js.map +0 -1
  291. package/dist/development/hooks/useDocumentTitle.cjs.map +0 -1
  292. package/dist/development/hooks/useDocumentTitle.js.map +0 -1
  293. package/dist/development/hooks/useElementSize.cjs +0 -37
  294. package/dist/development/hooks/useElementSize.cjs.map +0 -1
  295. package/dist/development/hooks/useElementSize.js +0 -37
  296. package/dist/development/hooks/useElementSize.js.map +0 -1
  297. package/dist/development/hooks/useElementTopOffset.cjs +0 -29
  298. package/dist/development/hooks/useElementTopOffset.cjs.map +0 -1
  299. package/dist/development/hooks/useElementTopOffset.js +0 -29
  300. package/dist/development/hooks/useElementTopOffset.js.map +0 -1
  301. package/dist/development/hooks/useEventHandler.cjs +0 -19
  302. package/dist/development/hooks/useEventHandler.cjs.map +0 -1
  303. package/dist/development/hooks/useEventHandler.js +0 -19
  304. package/dist/development/hooks/useEventHandler.js.map +0 -1
  305. package/dist/development/hooks/useExpectSameValueReference.cjs.map +0 -1
  306. package/dist/development/hooks/useExpectSameValueReference.js.map +0 -1
  307. package/dist/development/hooks/useForceRender.cjs.map +0 -1
  308. package/dist/development/hooks/useForceRender.js.map +0 -1
  309. package/dist/development/hooks/useId.cjs.map +0 -1
  310. package/dist/development/hooks/useId.js.map +0 -1
  311. package/dist/development/hooks/useIsMounted.cjs.map +0 -1
  312. package/dist/development/hooks/useIsMounted.js.map +0 -1
  313. package/dist/development/hooks/useObjectMemo.cjs.map +0 -1
  314. package/dist/development/hooks/useObjectMemo.js.map +0 -1
  315. package/dist/development/hooks/useOnElementClickOutsideCallback.cjs.map +0 -1
  316. package/dist/development/hooks/useOnElementClickOutsideCallback.js.map +0 -1
  317. package/dist/development/hooks/useOnElementMouseEnterDelayedCallback.cjs.map +0 -1
  318. package/dist/development/hooks/useOnElementMouseEnterDelayedCallback.js.map +0 -1
  319. package/dist/development/hooks/useOnElementMutation.cjs +0 -35
  320. package/dist/development/hooks/useOnElementMutation.cjs.map +0 -1
  321. package/dist/development/hooks/useOnElementMutation.js +0 -35
  322. package/dist/development/hooks/useOnElementMutation.js.map +0 -1
  323. package/dist/development/hooks/useOnElementResize.cjs.map +0 -1
  324. package/dist/development/hooks/useOnElementResize.js.map +0 -1
  325. package/dist/development/hooks/useOnScrollWithin.cjs +0 -52
  326. package/dist/development/hooks/useOnScrollWithin.cjs.map +0 -1
  327. package/dist/development/hooks/useOnScrollWithin.js +0 -52
  328. package/dist/development/hooks/useOnScrollWithin.js.map +0 -1
  329. package/dist/development/hooks/useOnWindowResize.cjs.map +0 -1
  330. package/dist/development/hooks/useOnWindowResize.js.map +0 -1
  331. package/dist/development/hooks/usePreviousValue.cjs.map +0 -1
  332. package/dist/development/hooks/usePreviousValue.js.map +0 -1
  333. package/dist/development/hooks/useScrollOffsets.cjs +0 -67
  334. package/dist/development/hooks/useScrollOffsets.cjs.map +0 -1
  335. package/dist/development/hooks/useScrollOffsets.js +0 -67
  336. package/dist/development/hooks/useScrollOffsets.js.map +0 -1
  337. package/dist/development/hooks/useStoredState.cjs.map +0 -1
  338. package/dist/development/hooks/useStoredState.js.map +0 -1
  339. package/dist/development/hooks/useUpdatedRef.cjs.map +0 -1
  340. package/dist/development/hooks/useUpdatedRef.js.map +0 -1
  341. package/dist/development/hooks/useWindowSize.cjs.map +0 -1
  342. package/dist/development/hooks/useWindowSize.js.map +0 -1
  343. package/dist/development/referentiallyStable/emptyArray.cjs.map +0 -1
  344. package/dist/development/referentiallyStable/emptyArray.js.map +0 -1
  345. package/dist/development/referentiallyStable/emptyObject.cjs.map +0 -1
  346. package/dist/development/referentiallyStable/emptyObject.js.map +0 -1
  347. package/dist/development/referentiallyStable/identityFunction.cjs.map +0 -1
  348. package/dist/development/referentiallyStable/identityFunction.js.map +0 -1
  349. package/dist/development/referentiallyStable/noop.cjs.map +0 -1
  350. package/dist/development/referentiallyStable/noop.js.map +0 -1
  351. package/dist/development/referentiallyStable/returnFalse.cjs.map +0 -1
  352. package/dist/development/referentiallyStable/returnFalse.js.map +0 -1
  353. package/dist/development/referentiallyStable/returnTrue.cjs.map +0 -1
  354. package/dist/development/referentiallyStable/returnTrue.js.map +0 -1
  355. package/dist/development/referentiallyStable/useReferentiallyStableCallback.cjs.map +0 -1
  356. package/dist/development/referentiallyStable/useReferentiallyStableCallback.js.map +0 -1
  357. package/dist/development/theming/ColorSchemeProvider.cjs +0 -16
  358. package/dist/development/theming/ColorSchemeProvider.cjs.map +0 -1
  359. package/dist/development/theming/ColorSchemeProvider.js +0 -16
  360. package/dist/development/theming/ColorSchemeProvider.js.map +0 -1
  361. package/dist/development/theming/GlobalClassNamePrefixContext.cjs +0 -6
  362. package/dist/development/theming/GlobalClassNamePrefixContext.cjs.map +0 -1
  363. package/dist/development/theming/GlobalClassNamePrefixContext.js +0 -6
  364. package/dist/development/theming/GlobalClassNamePrefixContext.js.map +0 -1
  365. package/dist/development/theming/contexts.cjs +0 -12
  366. package/dist/development/theming/contexts.cjs.map +0 -1
  367. package/dist/development/theming/contexts.js +0 -12
  368. package/dist/development/theming/contexts.js.map +0 -1
  369. package/dist/development/theming/useClassName.cjs +0 -17
  370. package/dist/development/theming/useClassName.cjs.map +0 -1
  371. package/dist/development/theming/useClassName.js +0 -17
  372. package/dist/development/theming/useClassName.js.map +0 -1
  373. package/dist/development/theming/useClassNameFactory.cjs +0 -22
  374. package/dist/development/theming/useClassNameFactory.cjs.map +0 -1
  375. package/dist/development/theming/useClassNameFactory.js +0 -22
  376. package/dist/development/theming/useClassNameFactory.js.map +0 -1
  377. package/dist/development/theming/useThemedClassName.cjs +0 -17
  378. package/dist/development/theming/useThemedClassName.cjs.map +0 -1
  379. package/dist/development/theming/useThemedClassName.js +0 -17
  380. package/dist/development/theming/useThemedClassName.js.map +0 -1
  381. package/dist/development/theming/useThemedClassNameFactory.cjs +0 -29
  382. package/dist/development/theming/useThemedClassNameFactory.cjs.map +0 -1
  383. package/dist/development/theming/useThemedClassNameFactory.js +0 -29
  384. package/dist/development/theming/useThemedClassNameFactory.js.map +0 -1
  385. package/dist/production/context/createContext.cjs.map +0 -1
  386. package/dist/production/context/createContext.js.map +0 -1
  387. package/dist/production/context/createRequiredContext.cjs.map +0 -1
  388. package/dist/production/context/createRequiredContext.js.map +0 -1
  389. package/dist/production/debug-context/Constants.cjs.map +0 -1
  390. package/dist/production/debug-context/Constants.js.map +0 -1
  391. package/dist/production/debug-context/Context.cjs.map +0 -1
  392. package/dist/production/debug-context/Context.js.map +0 -1
  393. package/dist/production/hooks/unwrapRefValue.cjs.map +0 -1
  394. package/dist/production/hooks/unwrapRefValue.js.map +0 -1
  395. package/dist/production/hooks/useAbortController.cjs.map +0 -1
  396. package/dist/production/hooks/useAbortController.js.map +0 -1
  397. package/dist/production/hooks/useAddClassNameDuringResize.cjs +0 -32
  398. package/dist/production/hooks/useAddClassNameDuringResize.cjs.map +0 -1
  399. package/dist/production/hooks/useAddClassNameDuringResize.js +0 -32
  400. package/dist/production/hooks/useAddClassNameDuringResize.js.map +0 -1
  401. package/dist/production/hooks/useArrayMapMemo.cjs.map +0 -1
  402. package/dist/production/hooks/useArrayMapMemo.js.map +0 -1
  403. package/dist/production/hooks/useAutoHeightTextArea.cjs.map +0 -1
  404. package/dist/production/hooks/useAutoHeightTextArea.js.map +0 -1
  405. package/dist/production/hooks/useChildrenAsLabel.cjs.map +0 -1
  406. package/dist/production/hooks/useChildrenAsLabel.js.map +0 -1
  407. package/dist/production/hooks/useCloseOnClickOutside.cjs +0 -25
  408. package/dist/production/hooks/useCloseOnClickOutside.cjs.map +0 -1
  409. package/dist/production/hooks/useCloseOnClickOutside.js +0 -25
  410. package/dist/production/hooks/useCloseOnClickOutside.js.map +0 -1
  411. package/dist/production/hooks/useCloseOnEscape.cjs +0 -20
  412. package/dist/production/hooks/useCloseOnEscape.cjs.map +0 -1
  413. package/dist/production/hooks/useCloseOnEscape.js +0 -20
  414. package/dist/production/hooks/useCloseOnEscape.js.map +0 -1
  415. package/dist/production/hooks/useComposeRef.cjs.map +0 -1
  416. package/dist/production/hooks/useComposeRef.js.map +0 -1
  417. package/dist/production/hooks/useConstantLengthInvariant.cjs.map +0 -1
  418. package/dist/production/hooks/useConstantLengthInvariant.js.map +0 -1
  419. package/dist/production/hooks/useConstantValueInvariant.cjs.map +0 -1
  420. package/dist/production/hooks/useConstantValueInvariant.js.map +0 -1
  421. package/dist/production/hooks/useContainerWidth.cjs +0 -14
  422. package/dist/production/hooks/useContainerWidth.cjs.map +0 -1
  423. package/dist/production/hooks/useContainerWidth.js +0 -14
  424. package/dist/production/hooks/useContainerWidth.js.map +0 -1
  425. package/dist/production/hooks/useDebounce.cjs.map +0 -1
  426. package/dist/production/hooks/useDebounce.js.map +0 -1
  427. package/dist/production/hooks/useDebounceCallback.cjs.map +0 -1
  428. package/dist/production/hooks/useDebounceCallback.js.map +0 -1
  429. package/dist/production/hooks/useDocumentTitle.cjs.map +0 -1
  430. package/dist/production/hooks/useDocumentTitle.js.map +0 -1
  431. package/dist/production/hooks/useElementSize.cjs +0 -37
  432. package/dist/production/hooks/useElementSize.cjs.map +0 -1
  433. package/dist/production/hooks/useElementSize.js +0 -37
  434. package/dist/production/hooks/useElementSize.js.map +0 -1
  435. package/dist/production/hooks/useElementTopOffset.cjs +0 -29
  436. package/dist/production/hooks/useElementTopOffset.cjs.map +0 -1
  437. package/dist/production/hooks/useElementTopOffset.js +0 -29
  438. package/dist/production/hooks/useElementTopOffset.js.map +0 -1
  439. package/dist/production/hooks/useEventHandler.cjs +0 -19
  440. package/dist/production/hooks/useEventHandler.cjs.map +0 -1
  441. package/dist/production/hooks/useEventHandler.js +0 -19
  442. package/dist/production/hooks/useEventHandler.js.map +0 -1
  443. package/dist/production/hooks/useExpectSameValueReference.cjs.map +0 -1
  444. package/dist/production/hooks/useExpectSameValueReference.js.map +0 -1
  445. package/dist/production/hooks/useForceRender.cjs.map +0 -1
  446. package/dist/production/hooks/useForceRender.js.map +0 -1
  447. package/dist/production/hooks/useId.cjs.map +0 -1
  448. package/dist/production/hooks/useId.js.map +0 -1
  449. package/dist/production/hooks/useIsMounted.cjs.map +0 -1
  450. package/dist/production/hooks/useIsMounted.js.map +0 -1
  451. package/dist/production/hooks/useObjectMemo.cjs.map +0 -1
  452. package/dist/production/hooks/useObjectMemo.js.map +0 -1
  453. package/dist/production/hooks/useOnElementClickOutsideCallback.cjs.map +0 -1
  454. package/dist/production/hooks/useOnElementClickOutsideCallback.js.map +0 -1
  455. package/dist/production/hooks/useOnElementMouseEnterDelayedCallback.cjs.map +0 -1
  456. package/dist/production/hooks/useOnElementMouseEnterDelayedCallback.js.map +0 -1
  457. package/dist/production/hooks/useOnElementMutation.cjs +0 -35
  458. package/dist/production/hooks/useOnElementMutation.cjs.map +0 -1
  459. package/dist/production/hooks/useOnElementMutation.js +0 -35
  460. package/dist/production/hooks/useOnElementMutation.js.map +0 -1
  461. package/dist/production/hooks/useOnElementResize.cjs.map +0 -1
  462. package/dist/production/hooks/useOnElementResize.js.map +0 -1
  463. package/dist/production/hooks/useOnScrollWithin.cjs +0 -52
  464. package/dist/production/hooks/useOnScrollWithin.cjs.map +0 -1
  465. package/dist/production/hooks/useOnScrollWithin.js +0 -52
  466. package/dist/production/hooks/useOnScrollWithin.js.map +0 -1
  467. package/dist/production/hooks/useOnWindowResize.cjs.map +0 -1
  468. package/dist/production/hooks/useOnWindowResize.js.map +0 -1
  469. package/dist/production/hooks/usePreviousValue.cjs.map +0 -1
  470. package/dist/production/hooks/usePreviousValue.js.map +0 -1
  471. package/dist/production/hooks/useScrollOffsets.cjs +0 -67
  472. package/dist/production/hooks/useScrollOffsets.cjs.map +0 -1
  473. package/dist/production/hooks/useScrollOffsets.js +0 -67
  474. package/dist/production/hooks/useScrollOffsets.js.map +0 -1
  475. package/dist/production/hooks/useStoredState.cjs.map +0 -1
  476. package/dist/production/hooks/useStoredState.js.map +0 -1
  477. package/dist/production/hooks/useUpdatedRef.cjs.map +0 -1
  478. package/dist/production/hooks/useUpdatedRef.js.map +0 -1
  479. package/dist/production/hooks/useWindowSize.cjs.map +0 -1
  480. package/dist/production/hooks/useWindowSize.js.map +0 -1
  481. package/dist/production/referentiallyStable/emptyArray.cjs.map +0 -1
  482. package/dist/production/referentiallyStable/emptyArray.js.map +0 -1
  483. package/dist/production/referentiallyStable/emptyObject.cjs.map +0 -1
  484. package/dist/production/referentiallyStable/emptyObject.js.map +0 -1
  485. package/dist/production/referentiallyStable/identityFunction.cjs.map +0 -1
  486. package/dist/production/referentiallyStable/identityFunction.js.map +0 -1
  487. package/dist/production/referentiallyStable/noop.cjs.map +0 -1
  488. package/dist/production/referentiallyStable/noop.js.map +0 -1
  489. package/dist/production/referentiallyStable/returnFalse.cjs.map +0 -1
  490. package/dist/production/referentiallyStable/returnFalse.js.map +0 -1
  491. package/dist/production/referentiallyStable/returnTrue.cjs.map +0 -1
  492. package/dist/production/referentiallyStable/returnTrue.js.map +0 -1
  493. package/dist/production/referentiallyStable/useReferentiallyStableCallback.cjs.map +0 -1
  494. package/dist/production/referentiallyStable/useReferentiallyStableCallback.js.map +0 -1
  495. package/dist/production/theming/ColorSchemeProvider.cjs +0 -12
  496. package/dist/production/theming/ColorSchemeProvider.cjs.map +0 -1
  497. package/dist/production/theming/ColorSchemeProvider.js +0 -12
  498. package/dist/production/theming/ColorSchemeProvider.js.map +0 -1
  499. package/dist/production/theming/GlobalClassNamePrefixContext.cjs +0 -6
  500. package/dist/production/theming/GlobalClassNamePrefixContext.cjs.map +0 -1
  501. package/dist/production/theming/GlobalClassNamePrefixContext.js +0 -6
  502. package/dist/production/theming/GlobalClassNamePrefixContext.js.map +0 -1
  503. package/dist/production/theming/contexts.cjs +0 -12
  504. package/dist/production/theming/contexts.cjs.map +0 -1
  505. package/dist/production/theming/contexts.js +0 -12
  506. package/dist/production/theming/contexts.js.map +0 -1
  507. package/dist/production/theming/useClassName.cjs +0 -17
  508. package/dist/production/theming/useClassName.cjs.map +0 -1
  509. package/dist/production/theming/useClassName.js +0 -17
  510. package/dist/production/theming/useClassName.js.map +0 -1
  511. package/dist/production/theming/useClassNameFactory.cjs +0 -22
  512. package/dist/production/theming/useClassNameFactory.cjs.map +0 -1
  513. package/dist/production/theming/useClassNameFactory.js +0 -22
  514. package/dist/production/theming/useClassNameFactory.js.map +0 -1
  515. package/dist/production/theming/useThemedClassName.cjs +0 -17
  516. package/dist/production/theming/useThemedClassName.cjs.map +0 -1
  517. package/dist/production/theming/useThemedClassName.js +0 -17
  518. package/dist/production/theming/useThemedClassName.js.map +0 -1
  519. package/dist/production/theming/useThemedClassNameFactory.cjs +0 -29
  520. package/dist/production/theming/useThemedClassNameFactory.cjs.map +0 -1
  521. package/dist/production/theming/useThemedClassNameFactory.js +0 -29
  522. package/dist/production/theming/useThemedClassNameFactory.js.map +0 -1
  523. package/dist/types/hooks/useAddClassNameDuringResize.d.ts +0 -13
  524. package/dist/types/hooks/useAddClassNameDuringResize.d.ts.map +0 -1
  525. package/dist/types/hooks/useCloseOnClickOutside.d.ts +0 -7
  526. package/dist/types/hooks/useCloseOnClickOutside.d.ts.map +0 -1
  527. package/dist/types/hooks/useCloseOnEscape.d.ts +0 -5
  528. package/dist/types/hooks/useCloseOnEscape.d.ts.map +0 -1
  529. package/dist/types/hooks/useContainerWidth.d.ts +0 -4
  530. package/dist/types/hooks/useContainerWidth.d.ts.map +0 -1
  531. package/dist/types/hooks/useElementSize.d.ts +0 -16
  532. package/dist/types/hooks/useElementSize.d.ts.map +0 -1
  533. package/dist/types/hooks/useElementTopOffset.d.ts +0 -3
  534. package/dist/types/hooks/useElementTopOffset.d.ts.map +0 -1
  535. package/dist/types/hooks/useEventHandler.d.ts +0 -10
  536. package/dist/types/hooks/useEventHandler.d.ts.map +0 -1
  537. package/dist/types/hooks/useOnElementMutation.d.ts +0 -3
  538. package/dist/types/hooks/useOnElementMutation.d.ts.map +0 -1
  539. package/dist/types/hooks/useOnScrollWithin.d.ts +0 -10
  540. package/dist/types/hooks/useOnScrollWithin.d.ts.map +0 -1
  541. package/dist/types/hooks/useScrollOffsets.d.ts +0 -14
  542. package/dist/types/hooks/useScrollOffsets.d.ts.map +0 -1
  543. package/dist/types/theming/ColorSchemeProvider.d.ts +0 -6
  544. package/dist/types/theming/ColorSchemeProvider.d.ts.map +0 -1
  545. package/dist/types/theming/GlobalClassNamePrefixContext.d.ts +0 -2
  546. package/dist/types/theming/GlobalClassNamePrefixContext.d.ts.map +0 -1
  547. package/dist/types/theming/contexts.d.ts +0 -12
  548. package/dist/types/theming/contexts.d.ts.map +0 -1
  549. package/dist/types/theming/index.d.ts +0 -8
  550. package/dist/types/theming/index.d.ts.map +0 -1
  551. package/dist/types/theming/useClassName.d.ts +0 -11
  552. package/dist/types/theming/useClassName.d.ts.map +0 -1
  553. package/dist/types/theming/useClassNameFactory.d.ts +0 -17
  554. package/dist/types/theming/useClassNameFactory.d.ts.map +0 -1
  555. package/dist/types/theming/useThemedClassName.d.ts +0 -39
  556. package/dist/types/theming/useThemedClassName.d.ts.map +0 -1
  557. package/dist/types/theming/useThemedClassNameFactory.d.ts +0 -3
  558. package/dist/types/theming/useThemedClassNameFactory.d.ts.map +0 -1
  559. package/src/hooks/useAddClassNameDuringResize.ts +0 -56
  560. package/src/hooks/useCloseOnClickOutside.ts +0 -27
  561. package/src/hooks/useCloseOnEscape.ts +0 -18
  562. package/src/hooks/useContainerWidth.ts +0 -13
  563. package/src/hooks/useElementSize.ts +0 -56
  564. package/src/hooks/useElementTopOffset.ts +0 -35
  565. package/src/hooks/useEventHandler.ts +0 -24
  566. package/src/hooks/useOnElementMutation.ts +0 -42
  567. package/src/hooks/useOnScrollWithin.ts +0 -68
  568. package/src/hooks/useScrollOffsets.ts +0 -87
  569. package/src/theming/ColorSchemeProvider.tsx +0 -16
  570. package/src/theming/GlobalClassNamePrefixContext.ts +0 -3
  571. package/src/theming/contexts.ts +0 -18
  572. package/src/theming/index.ts +0 -7
  573. package/src/theming/useClassName.ts +0 -28
  574. package/src/theming/useClassNameFactory.ts +0 -50
  575. package/src/theming/useThemedClassName.ts +0 -54
  576. package/src/theming/useThemedClassNameFactory.ts +0 -44
  577. /package/dist/development/{context → src/context}/createContext.js +0 -0
  578. /package/dist/development/{context → src/context}/createRequiredContext.js +0 -0
  579. /package/dist/development/{debug-context → src/debug-context}/Constants.cjs +0 -0
  580. /package/dist/development/{debug-context → src/debug-context}/Constants.js +0 -0
  581. /package/dist/development/{hooks → src/hooks}/unwrapRefValue.cjs +0 -0
  582. /package/dist/development/{hooks → src/hooks}/unwrapRefValue.js +0 -0
  583. /package/dist/development/{hooks → src/hooks}/useAbortController.js +0 -0
  584. /package/dist/development/{hooks → src/hooks}/useArrayMapMemo.js +0 -0
  585. /package/dist/development/{hooks → src/hooks}/useAutoHeightTextArea.js +0 -0
  586. /package/dist/development/{hooks → src/hooks}/useComposeRef.js +0 -0
  587. /package/dist/development/{hooks → src/hooks}/useConstantLengthInvariant.cjs +0 -0
  588. /package/dist/development/{hooks → src/hooks}/useConstantLengthInvariant.js +0 -0
  589. /package/dist/development/{hooks → src/hooks}/useConstantValueInvariant.cjs +0 -0
  590. /package/dist/development/{hooks → src/hooks}/useConstantValueInvariant.js +0 -0
  591. /package/dist/development/{hooks → src/hooks}/useDebounce.js +0 -0
  592. /package/dist/development/{hooks → src/hooks}/useDebounceCallback.js +0 -0
  593. /package/dist/development/{hooks → src/hooks}/useDocumentTitle.js +0 -0
  594. /package/dist/development/{hooks → src/hooks}/useForceRender.js +0 -0
  595. /package/dist/development/{hooks → src/hooks}/useId.js +0 -0
  596. /package/dist/development/{hooks → src/hooks}/useIsMounted.js +0 -0
  597. /package/dist/development/{hooks → src/hooks}/useObjectMemo.js +0 -0
  598. /package/dist/development/{hooks → src/hooks}/useOnElementClickOutsideCallback.js +0 -0
  599. /package/dist/development/{hooks → src/hooks}/useOnElementMouseEnterDelayedCallback.js +0 -0
  600. /package/dist/development/{hooks → src/hooks}/usePreviousValue.js +0 -0
  601. /package/dist/development/{hooks → src/hooks}/useStoredState.js +0 -0
  602. /package/dist/development/{hooks → src/hooks}/useUpdatedRef.js +0 -0
  603. /package/dist/development/{hooks → src/hooks}/useWindowSize.js +0 -0
  604. /package/dist/development/{referentiallyStable → src/referentiallyStable}/emptyArray.cjs +0 -0
  605. /package/dist/development/{referentiallyStable → src/referentiallyStable}/emptyArray.js +0 -0
  606. /package/dist/development/{referentiallyStable → src/referentiallyStable}/emptyObject.cjs +0 -0
  607. /package/dist/development/{referentiallyStable → src/referentiallyStable}/emptyObject.js +0 -0
  608. /package/dist/development/{referentiallyStable → src/referentiallyStable}/identityFunction.cjs +0 -0
  609. /package/dist/development/{referentiallyStable → src/referentiallyStable}/identityFunction.js +0 -0
  610. /package/dist/development/{referentiallyStable → src/referentiallyStable}/noop.cjs +0 -0
  611. /package/dist/development/{referentiallyStable → src/referentiallyStable}/noop.js +0 -0
  612. /package/dist/development/{referentiallyStable → src/referentiallyStable}/returnFalse.cjs +0 -0
  613. /package/dist/development/{referentiallyStable → src/referentiallyStable}/returnFalse.js +0 -0
  614. /package/dist/development/{referentiallyStable → src/referentiallyStable}/returnTrue.cjs +0 -0
  615. /package/dist/development/{referentiallyStable → src/referentiallyStable}/returnTrue.js +0 -0
  616. /package/dist/development/{referentiallyStable → src/referentiallyStable}/useReferentiallyStableCallback.js +0 -0
  617. /package/dist/production/{context → src/context}/createContext.js +0 -0
  618. /package/dist/production/{context → src/context}/createRequiredContext.js +0 -0
  619. /package/dist/production/{debug-context → src/debug-context}/Constants.cjs +0 -0
  620. /package/dist/production/{debug-context → src/debug-context}/Constants.js +0 -0
  621. /package/dist/production/{debug-context → src/debug-context}/Context.js +0 -0
  622. /package/dist/production/{hooks → src/hooks}/unwrapRefValue.cjs +0 -0
  623. /package/dist/production/{hooks → src/hooks}/unwrapRefValue.js +0 -0
  624. /package/dist/production/{hooks → src/hooks}/useAbortController.js +0 -0
  625. /package/dist/production/{hooks → src/hooks}/useArrayMapMemo.js +0 -0
  626. /package/dist/production/{hooks → src/hooks}/useAutoHeightTextArea.js +0 -0
  627. /package/dist/production/{hooks → src/hooks}/useComposeRef.js +0 -0
  628. /package/dist/production/{hooks → src/hooks}/useConstantLengthInvariant.cjs +0 -0
  629. /package/dist/production/{hooks → src/hooks}/useConstantLengthInvariant.js +0 -0
  630. /package/dist/production/{hooks → src/hooks}/useConstantValueInvariant.cjs +0 -0
  631. /package/dist/production/{hooks → src/hooks}/useConstantValueInvariant.js +0 -0
  632. /package/dist/production/{hooks → src/hooks}/useDebounce.js +0 -0
  633. /package/dist/production/{hooks → src/hooks}/useDebounceCallback.js +0 -0
  634. /package/dist/production/{hooks → src/hooks}/useDocumentTitle.js +0 -0
  635. /package/dist/production/{hooks → src/hooks}/useForceRender.js +0 -0
  636. /package/dist/production/{hooks → src/hooks}/useId.js +0 -0
  637. /package/dist/production/{hooks → src/hooks}/useIsMounted.js +0 -0
  638. /package/dist/production/{hooks → src/hooks}/useObjectMemo.js +0 -0
  639. /package/dist/production/{hooks → src/hooks}/useOnElementClickOutsideCallback.js +0 -0
  640. /package/dist/production/{hooks → src/hooks}/useOnElementMouseEnterDelayedCallback.js +0 -0
  641. /package/dist/production/{hooks → src/hooks}/usePreviousValue.js +0 -0
  642. /package/dist/production/{hooks → src/hooks}/useStoredState.js +0 -0
  643. /package/dist/production/{hooks → src/hooks}/useUpdatedRef.js +0 -0
  644. /package/dist/production/{hooks → src/hooks}/useWindowSize.js +0 -0
  645. /package/dist/production/{referentiallyStable → src/referentiallyStable}/emptyArray.cjs +0 -0
  646. /package/dist/production/{referentiallyStable → src/referentiallyStable}/emptyArray.js +0 -0
  647. /package/dist/production/{referentiallyStable → src/referentiallyStable}/emptyObject.cjs +0 -0
  648. /package/dist/production/{referentiallyStable → src/referentiallyStable}/emptyObject.js +0 -0
  649. /package/dist/production/{referentiallyStable → src/referentiallyStable}/identityFunction.cjs +0 -0
  650. /package/dist/production/{referentiallyStable → src/referentiallyStable}/identityFunction.js +0 -0
  651. /package/dist/production/{referentiallyStable → src/referentiallyStable}/noop.cjs +0 -0
  652. /package/dist/production/{referentiallyStable → src/referentiallyStable}/noop.js +0 -0
  653. /package/dist/production/{referentiallyStable → src/referentiallyStable}/returnFalse.cjs +0 -0
  654. /package/dist/production/{referentiallyStable → src/referentiallyStable}/returnFalse.js +0 -0
  655. /package/dist/production/{referentiallyStable → src/referentiallyStable}/returnTrue.cjs +0 -0
  656. /package/dist/production/{referentiallyStable → src/referentiallyStable}/returnTrue.js +0 -0
  657. /package/dist/production/{referentiallyStable → src/referentiallyStable}/useReferentiallyStableCallback.js +0 -0
@@ -1,35 +0,0 @@
1
- import deepEqual from "fast-deep-equal/es6/index.js";
2
- import { useRef, useState, useEffect, useLayoutEffect } from "react";
3
- import { unwrapRefValue } from "./unwrapRefValue.js";
4
- import { useScopedConsoleRef } from "../debug-context/Context.js";
5
- function useOnElementMutation(refOrElement, callback, options = { attributes: true, childList: true, subtree: true }) {
6
- const scopedConsoleRef = useScopedConsoleRef("useOnElementMutation");
7
- const callbackRef = useRef(callback);
8
- callbackRef.current = callback;
9
- const optionsRef = useRef(options);
10
- optionsRef.current = options;
11
- const [optionsState, setOptionsState] = useState(options);
12
- useEffect(() => {
13
- if (!deepEqual(optionsRef.current, options)) {
14
- setOptionsState(options);
15
- }
16
- }, [options]);
17
- useLayoutEffect(() => {
18
- const element = unwrapRefValue(refOrElement);
19
- if (element) {
20
- let handler = function(mutations, observer2) {
21
- scopedConsoleRef.current.logged("element.mutations", mutations);
22
- callbackRef.current(mutations, observer2);
23
- };
24
- const observer = new MutationObserver(handler);
25
- observer.observe(element, optionsState);
26
- return () => {
27
- observer.disconnect();
28
- };
29
- }
30
- }, [optionsState, refOrElement, scopedConsoleRef]);
31
- }
32
- export {
33
- useOnElementMutation
34
- };
35
- //# sourceMappingURL=useOnElementMutation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useOnElementMutation.js","sources":["../../../src/hooks/useOnElementMutation.ts"],"sourcesContent":["import deepEqual from 'fast-deep-equal/es6/index.js'\nimport { useEffect, useLayoutEffect, useRef, useState } from 'react'\nimport { useScopedConsoleRef } from '../debug-context'\nimport { RefObjectOrElement, unwrapRefValue } from './unwrapRefValue'\n\nexport function useOnElementMutation(\n\trefOrElement: RefObjectOrElement<HTMLElement | undefined>,\n\tcallback: MutationCallback,\n\toptions: MutationObserverInit = { attributes: true, childList: true, subtree: true },\n) {\n\tconst scopedConsoleRef = useScopedConsoleRef('useOnElementMutation')\n\n\tconst callbackRef = useRef(callback); callbackRef.current = callback\n\tconst optionsRef = useRef<MutationObserverInit>(options); optionsRef.current = options\n\n\tconst [optionsState, setOptionsState] = useState<MutationObserverInit>(options)\n\n\tuseEffect(() => {\n\t\tif (!deepEqual(optionsRef.current, options)) {\n\t\t\tsetOptionsState(options)\n\t\t}\n\t}, [options])\n\n\tuseLayoutEffect(() => {\n\t\tconst element = unwrapRefValue(refOrElement)\n\n\t\tif (element) {\n\t\t\tfunction handler(mutations: MutationRecord[], observer: MutationObserver) {\n\t\t\t\tscopedConsoleRef.current.logged('element.mutations', mutations)\n\t\t\t\tcallbackRef.current(mutations, observer)\n\t\t\t}\n\n\t\t\tconst observer = new MutationObserver(handler)\n\n\t\t\tobserver.observe(element, optionsState)\n\n\t\t\treturn () => {\n\t\t\t\tobserver.disconnect()\n\t\t\t}\n\t\t}\n\t}, [optionsState, refOrElement, scopedConsoleRef])\n}\n"],"names":["observer"],"mappings":";;;;AAKgB,SAAA,qBACf,cACA,UACA,UAAgC,EAAE,YAAY,MAAM,WAAW,MAAM,SAAS,KAAA,GAC7E;AACK,QAAA,mBAAmB,oBAAoB,sBAAsB;AAE7D,QAAA,cAAc,OAAO,QAAQ;AAAG,cAAY,UAAU;AACtD,QAAA,aAAa,OAA6B,OAAO;AAAG,aAAW,UAAU;AAE/E,QAAM,CAAC,cAAc,eAAe,IAAI,SAA+B,OAAO;AAE9E,YAAU,MAAM;AACf,QAAI,CAAC,UAAU,WAAW,SAAS,OAAO,GAAG;AAC5C,sBAAgB,OAAO;AAAA,IACxB;AAAA,EAAA,GACE,CAAC,OAAO,CAAC;AAEZ,kBAAgB,MAAM;AACf,UAAA,UAAU,eAAe,YAAY;AAE3C,QAAI,SAAS;AACH,UAAA,UAAT,SAAiB,WAA6BA,WAA4B;AACxD,yBAAA,QAAQ,OAAO,qBAAqB,SAAS;AAClD,oBAAA,QAAQ,WAAWA,SAAQ;AAAA,MAAA;AAGlC,YAAA,WAAW,IAAI,iBAAiB,OAAO;AAEpC,eAAA,QAAQ,SAAS,YAAY;AAEtC,aAAO,MAAM;AACZ,iBAAS,WAAW;AAAA,MAAA;AAAA,IAEtB;AAAA,EACE,GAAA,CAAC,cAAc,cAAc,gBAAgB,CAAC;AAClD;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useOnElementResize.cjs","sources":["../../../src/hooks/useOnElementResize.ts"],"sourcesContent":["import { useLayoutEffect, useRef } from 'react'\nimport { useScopedConsoleRef } from '../debug-context'\nimport { RefObjectOrElement, unwrapRefValue } from './unwrapRefValue'\n\nexport function useOnElementResize(\n\trefOrElement: RefObjectOrElement<HTMLElement | null> | null,\n\tcallback: (entries: ResizeObserverEntry) => void,\n\toptions: ResizeObserverOptions = {},\n\ttimeout: number = 300,\n): void {\n\tconst scopedConsoleRef = useScopedConsoleRef('useOnElementResize')\n\n\tconst { box = 'border-box' } = options\n\tconst callbackRef = useRef(callback); callbackRef.current = callback\n\tconst lastTimeStamp = useRef<number>(0)\n\n\tuseLayoutEffect(() => {\n\t\tconst element = unwrapRefValue(refOrElement)\n\t\tif (!element) {\n\t\t\treturn\n\t\t}\n\t\tif (!(element instanceof HTMLElement)) {\n\t\t\tthrow new Error('Exhaustive error: Expecting element to be instance of HTMLElement')\n\t\t}\n\n\t\tlet timeoutID: number | undefined = undefined\n\n\t\tfunction debouncedOnChange([entry]: ResizeObserverEntry[]) {\n\t\t\tconst timeStamp = Date.now()\n\t\t\tconst delta = timeStamp - lastTimeStamp.current\n\n\t\t\tclearTimeout(timeoutID)\n\t\t\tconst timeoutFinal = delta > timeout ? 0 : timeout\n\n\t\t\ttimeoutID = setTimeout(() => {\n\t\t\t\tconst message = timeoutFinal > 0 ? 'element.resize:debounced' : 'element.resize:immediate'\n\t\t\t\tscopedConsoleRef.current.warned(message, null)\n\t\t\t\tcallbackRef.current(entry)\n\t\t\t\tlastTimeStamp.current = timeStamp\n\t\t\t}, timeoutFinal)\n\t\t}\n\n\t\tconst resizeObserver = new ResizeObserver(debouncedOnChange)\n\n\t\tresizeObserver.observe(element, { box })\n\n\t\treturn () => {\n\t\t\tclearTimeout(timeoutID)\n\t\t\tresizeObserver.unobserve(element)\n\t\t}\n\t}, [box, refOrElement, scopedConsoleRef, timeout])\n}\n"],"names":["useScopedConsoleRef","useRef","useLayoutEffect","unwrapRefValue"],"mappings":";;;;;AAIO,SAAS,mBACf,cACA,UACA,UAAiC,CAAC,GAClC,UAAkB,KACX;AACD,QAAA,mBAAmBA,4BAAoB,oBAAoB;AAE3D,QAAA,EAAE,MAAM,aAAiB,IAAA;AACzB,QAAA,cAAcC,aAAO,QAAQ;AAAG,cAAY,UAAU;AACtD,QAAA,gBAAgBA,aAAe,CAAC;AAEtCC,QAAAA,gBAAgB,MAAM;AACf,UAAA,UAAUC,8BAAe,YAAY;AAC3C,QAAI,CAAC,SAAS;AACb;AAAA,IACD;AACI,QAAA,EAAE,mBAAmB,cAAc;AAChC,YAAA,IAAI,MAAM,mEAAmE;AAAA,IACpF;AAEA,QAAI,YAAgC;AAE3B,aAAA,kBAAkB,CAAC,KAAK,GAA0B;AACpD,YAAA,YAAY,KAAK;AACjB,YAAA,QAAQ,YAAY,cAAc;AAExC,mBAAa,SAAS;AAChB,YAAA,eAAe,QAAQ,UAAU,IAAI;AAE3C,kBAAY,WAAW,MAAM;AACtB,cAAA,UAAU,eAAe,IAAI,6BAA6B;AAC/C,yBAAA,QAAQ,OAAO,SAAS,IAAI;AAC7C,oBAAY,QAAQ,KAAK;AACzB,sBAAc,UAAU;AAAA,SACtB,YAAY;AAAA,IAChB;AAEM,UAAA,iBAAiB,IAAI,eAAe,iBAAiB;AAE3D,mBAAe,QAAQ,SAAS,EAAE,IAAK,CAAA;AAEvC,WAAO,MAAM;AACZ,mBAAa,SAAS;AACtB,qBAAe,UAAU,OAAO;AAAA,IAAA;AAAA,KAE/B,CAAC,KAAK,cAAc,kBAAkB,OAAO,CAAC;AAClD;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useOnElementResize.js","sources":["../../../src/hooks/useOnElementResize.ts"],"sourcesContent":["import { useLayoutEffect, useRef } from 'react'\nimport { useScopedConsoleRef } from '../debug-context'\nimport { RefObjectOrElement, unwrapRefValue } from './unwrapRefValue'\n\nexport function useOnElementResize(\n\trefOrElement: RefObjectOrElement<HTMLElement | null> | null,\n\tcallback: (entries: ResizeObserverEntry) => void,\n\toptions: ResizeObserverOptions = {},\n\ttimeout: number = 300,\n): void {\n\tconst scopedConsoleRef = useScopedConsoleRef('useOnElementResize')\n\n\tconst { box = 'border-box' } = options\n\tconst callbackRef = useRef(callback); callbackRef.current = callback\n\tconst lastTimeStamp = useRef<number>(0)\n\n\tuseLayoutEffect(() => {\n\t\tconst element = unwrapRefValue(refOrElement)\n\t\tif (!element) {\n\t\t\treturn\n\t\t}\n\t\tif (!(element instanceof HTMLElement)) {\n\t\t\tthrow new Error('Exhaustive error: Expecting element to be instance of HTMLElement')\n\t\t}\n\n\t\tlet timeoutID: number | undefined = undefined\n\n\t\tfunction debouncedOnChange([entry]: ResizeObserverEntry[]) {\n\t\t\tconst timeStamp = Date.now()\n\t\t\tconst delta = timeStamp - lastTimeStamp.current\n\n\t\t\tclearTimeout(timeoutID)\n\t\t\tconst timeoutFinal = delta > timeout ? 0 : timeout\n\n\t\t\ttimeoutID = setTimeout(() => {\n\t\t\t\tconst message = timeoutFinal > 0 ? 'element.resize:debounced' : 'element.resize:immediate'\n\t\t\t\tscopedConsoleRef.current.warned(message, null)\n\t\t\t\tcallbackRef.current(entry)\n\t\t\t\tlastTimeStamp.current = timeStamp\n\t\t\t}, timeoutFinal)\n\t\t}\n\n\t\tconst resizeObserver = new ResizeObserver(debouncedOnChange)\n\n\t\tresizeObserver.observe(element, { box })\n\n\t\treturn () => {\n\t\t\tclearTimeout(timeoutID)\n\t\t\tresizeObserver.unobserve(element)\n\t\t}\n\t}, [box, refOrElement, scopedConsoleRef, timeout])\n}\n"],"names":[],"mappings":";;;AAIO,SAAS,mBACf,cACA,UACA,UAAiC,CAAC,GAClC,UAAkB,KACX;AACD,QAAA,mBAAmB,oBAAoB,oBAAoB;AAE3D,QAAA,EAAE,MAAM,aAAiB,IAAA;AACzB,QAAA,cAAc,OAAO,QAAQ;AAAG,cAAY,UAAU;AACtD,QAAA,gBAAgB,OAAe,CAAC;AAEtC,kBAAgB,MAAM;AACf,UAAA,UAAU,eAAe,YAAY;AAC3C,QAAI,CAAC,SAAS;AACb;AAAA,IACD;AACI,QAAA,EAAE,mBAAmB,cAAc;AAChC,YAAA,IAAI,MAAM,mEAAmE;AAAA,IACpF;AAEA,QAAI,YAAgC;AAE3B,aAAA,kBAAkB,CAAC,KAAK,GAA0B;AACpD,YAAA,YAAY,KAAK;AACjB,YAAA,QAAQ,YAAY,cAAc;AAExC,mBAAa,SAAS;AAChB,YAAA,eAAe,QAAQ,UAAU,IAAI;AAE3C,kBAAY,WAAW,MAAM;AACtB,cAAA,UAAU,eAAe,IAAI,6BAA6B;AAC/C,yBAAA,QAAQ,OAAO,SAAS,IAAI;AAC7C,oBAAY,QAAQ,KAAK;AACzB,sBAAc,UAAU;AAAA,SACtB,YAAY;AAAA,IAChB;AAEM,UAAA,iBAAiB,IAAI,eAAe,iBAAiB;AAE3D,mBAAe,QAAQ,SAAS,EAAE,IAAK,CAAA;AAEvC,WAAO,MAAM;AACZ,mBAAa,SAAS;AACtB,qBAAe,UAAU,OAAO;AAAA,IAAA;AAAA,KAE/B,CAAC,KAAK,cAAc,kBAAkB,OAAO,CAAC;AAClD;"}
@@ -1,52 +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 Context = require("../debug-context/Context.cjs");
6
- function useOnScrollWithin(refOrElement, callback, interval = 1e3 / 60) {
7
- const scopedConsoleRef = Context.useScopedConsoleRef("useOnScrollWithin");
8
- const callbackRef = react.useRef(callback);
9
- callbackRef.current = callback;
10
- const lastTimeStamp = react.useRef(0);
11
- react.useLayoutEffect(() => {
12
- const element = unwrapRefValue.unwrapRefValue(refOrElement);
13
- let timeoutID = void 0;
14
- if (element) {
15
- let debouncedHandler = function(event) {
16
- clearTimeout(timeoutID);
17
- const delta = event.timeStamp - lastTimeStamp.current;
18
- scopedConsoleRef.current.logged("event:element.scroll:delta", delta);
19
- if (delta > interval) {
20
- scopedConsoleRef.current.warned("event:element.scroll:immediately", event);
21
- callbackRef.current(event);
22
- lastTimeStamp.current = event.timeStamp;
23
- } else {
24
- timeoutID = setTimeout(() => {
25
- scopedConsoleRef.current.warned("event:element.scroll:debounced", event);
26
- lastTimeStamp.current = event.timeStamp;
27
- callbackRef.current(event);
28
- }, interval);
29
- }
30
- };
31
- if (element instanceof HTMLElement) {
32
- if (element instanceof HTMLBodyElement || element instanceof HTMLHtmlElement) {
33
- window.addEventListener("scroll", debouncedHandler, { capture: true, passive: true });
34
- window.addEventListener("resize", debouncedHandler);
35
- return () => {
36
- window.removeEventListener("scroll", debouncedHandler);
37
- window.removeEventListener("resize", debouncedHandler);
38
- };
39
- } else {
40
- element.addEventListener("scroll", debouncedHandler, { passive: true, capture: true });
41
- return () => {
42
- element.removeEventListener("scroll", debouncedHandler);
43
- };
44
- }
45
- } else {
46
- throw new Error("Exhaustive error: Expecting element to be instance of HTMLElement");
47
- }
48
- }
49
- }, [interval, refOrElement, scopedConsoleRef]);
50
- }
51
- exports.useOnScrollWithin = useOnScrollWithin;
52
- //# sourceMappingURL=useOnScrollWithin.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useOnScrollWithin.cjs","sources":["../../../src/hooks/useOnScrollWithin.ts"],"sourcesContent":["import { useLayoutEffect, useRef } from 'react'\nimport { useScopedConsoleRef } from '../debug-context'\nimport { RefObjectOrElement, unwrapRefValue } from './unwrapRefValue'\n\n/**\n * Invokes callback on scroll event within the scroll container\n *\n * @param refOrElement - Scroll container\n * @param callback - Callback that is invoked on scroll event\n * @param interval - Specifies how often should scroll event invoke callback\n */\nexport function useOnScrollWithin(\n\trefOrElement: RefObjectOrElement<HTMLElement | null> | null,\n\tcallback: (event: Event) => void,\n\tinterval: number = 1000 / 60,\n) {\n\tconst scopedConsoleRef = useScopedConsoleRef('useOnScrollWithin')\n\n\tconst callbackRef = useRef(callback); callbackRef.current = callback\n\tconst lastTimeStamp = useRef<number>(0)\n\n\tuseLayoutEffect(() => {\n\t\tconst element = unwrapRefValue(refOrElement)\n\n\t\tlet timeoutID: number | undefined = undefined\n\n\t\tif (element) {\n\t\t\tfunction debouncedHandler(event: Event) {\n\t\t\t\tclearTimeout(timeoutID)\n\n\t\t\t\tconst delta = event.timeStamp - lastTimeStamp.current\n\t\t\t\tscopedConsoleRef.current.logged('event:element.scroll:delta', delta)\n\n\t\t\t\tif (delta > interval) {\n\t\t\t\t\tscopedConsoleRef.current.warned('event:element.scroll:immediately', event)\n\t\t\t\t\tcallbackRef.current(event)\n\t\t\t\t\tlastTimeStamp.current = event.timeStamp\n\t\t\t\t} else {\n\t\t\t\t\ttimeoutID = setTimeout(() => {\n\t\t\t\t\t\tscopedConsoleRef.current.warned('event:element.scroll:debounced', event)\n\t\t\t\t\t\tlastTimeStamp.current = event.timeStamp\n\t\t\t\t\t\tcallbackRef.current(event)\n\t\t\t\t\t}, interval)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (element instanceof HTMLElement) {\n\t\t\t\tif (element instanceof HTMLBodyElement || element instanceof HTMLHtmlElement) {\n\t\t\t\t\twindow.addEventListener('scroll', debouncedHandler, { capture: true, passive: true })\n\t\t\t\t\twindow.addEventListener('resize', debouncedHandler)\n\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\twindow.removeEventListener('scroll', debouncedHandler)\n\t\t\t\t\t\twindow.removeEventListener('resize', debouncedHandler)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\telement.addEventListener('scroll', debouncedHandler, { passive: true, capture: true })\n\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\telement.removeEventListener('scroll', debouncedHandler)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow new Error('Exhaustive error: Expecting element to be instance of HTMLElement')\n\t\t\t}\n\t\t}\n\t}, [interval, refOrElement, scopedConsoleRef])\n}\n"],"names":["useScopedConsoleRef","useRef","useLayoutEffect","unwrapRefValue"],"mappings":";;;;;AAWO,SAAS,kBACf,cACA,UACA,WAAmB,MAAO,IACzB;AACK,QAAA,mBAAmBA,4BAAoB,mBAAmB;AAE1D,QAAA,cAAcC,aAAO,QAAQ;AAAG,cAAY,UAAU;AACtD,QAAA,gBAAgBA,aAAe,CAAC;AAEtCC,QAAAA,gBAAgB,MAAM;AACf,UAAA,UAAUC,8BAAe,YAAY;AAE3C,QAAI,YAAgC;AAEpC,QAAI,SAAS;AACH,UAAA,mBAAT,SAA0B,OAAc;AACvC,qBAAa,SAAS;AAEhB,cAAA,QAAQ,MAAM,YAAY,cAAc;AAC7B,yBAAA,QAAQ,OAAO,8BAA8B,KAAK;AAEnE,YAAI,QAAQ,UAAU;AACJ,2BAAA,QAAQ,OAAO,oCAAoC,KAAK;AACzE,sBAAY,QAAQ,KAAK;AACzB,wBAAc,UAAU,MAAM;AAAA,QAAA,OACxB;AACN,sBAAY,WAAW,MAAM;AACX,6BAAA,QAAQ,OAAO,kCAAkC,KAAK;AACvE,0BAAc,UAAU,MAAM;AAC9B,wBAAY,QAAQ,KAAK;AAAA,aACvB,QAAQ;AAAA,QACZ;AAAA,MAAA;AAGD,UAAI,mBAAmB,aAAa;AAC/B,YAAA,mBAAmB,mBAAmB,mBAAmB,iBAAiB;AACtE,iBAAA,iBAAiB,UAAU,kBAAkB,EAAE,SAAS,MAAM,SAAS,MAAM;AAC7E,iBAAA,iBAAiB,UAAU,gBAAgB;AAElD,iBAAO,MAAM;AACL,mBAAA,oBAAoB,UAAU,gBAAgB;AAC9C,mBAAA,oBAAoB,UAAU,gBAAgB;AAAA,UAAA;AAAA,QACtD,OACM;AACE,kBAAA,iBAAiB,UAAU,kBAAkB,EAAE,SAAS,MAAM,SAAS,MAAM;AAErF,iBAAO,MAAM;AACJ,oBAAA,oBAAoB,UAAU,gBAAgB;AAAA,UAAA;AAAA,QAExD;AAAA,MAAA,OACM;AACA,cAAA,IAAI,MAAM,mEAAmE;AAAA,MACpF;AAAA,IACD;AAAA,EACE,GAAA,CAAC,UAAU,cAAc,gBAAgB,CAAC;AAC9C;;"}
@@ -1,52 +0,0 @@
1
- import { useRef, useLayoutEffect } from "react";
2
- import { unwrapRefValue } from "./unwrapRefValue.js";
3
- import { useScopedConsoleRef } from "../debug-context/Context.js";
4
- function useOnScrollWithin(refOrElement, callback, interval = 1e3 / 60) {
5
- const scopedConsoleRef = useScopedConsoleRef("useOnScrollWithin");
6
- const callbackRef = useRef(callback);
7
- callbackRef.current = callback;
8
- const lastTimeStamp = useRef(0);
9
- useLayoutEffect(() => {
10
- const element = unwrapRefValue(refOrElement);
11
- let timeoutID = void 0;
12
- if (element) {
13
- let debouncedHandler = function(event) {
14
- clearTimeout(timeoutID);
15
- const delta = event.timeStamp - lastTimeStamp.current;
16
- scopedConsoleRef.current.logged("event:element.scroll:delta", delta);
17
- if (delta > interval) {
18
- scopedConsoleRef.current.warned("event:element.scroll:immediately", event);
19
- callbackRef.current(event);
20
- lastTimeStamp.current = event.timeStamp;
21
- } else {
22
- timeoutID = setTimeout(() => {
23
- scopedConsoleRef.current.warned("event:element.scroll:debounced", event);
24
- lastTimeStamp.current = event.timeStamp;
25
- callbackRef.current(event);
26
- }, interval);
27
- }
28
- };
29
- if (element instanceof HTMLElement) {
30
- if (element instanceof HTMLBodyElement || element instanceof HTMLHtmlElement) {
31
- window.addEventListener("scroll", debouncedHandler, { capture: true, passive: true });
32
- window.addEventListener("resize", debouncedHandler);
33
- return () => {
34
- window.removeEventListener("scroll", debouncedHandler);
35
- window.removeEventListener("resize", debouncedHandler);
36
- };
37
- } else {
38
- element.addEventListener("scroll", debouncedHandler, { passive: true, capture: true });
39
- return () => {
40
- element.removeEventListener("scroll", debouncedHandler);
41
- };
42
- }
43
- } else {
44
- throw new Error("Exhaustive error: Expecting element to be instance of HTMLElement");
45
- }
46
- }
47
- }, [interval, refOrElement, scopedConsoleRef]);
48
- }
49
- export {
50
- useOnScrollWithin
51
- };
52
- //# sourceMappingURL=useOnScrollWithin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useOnScrollWithin.js","sources":["../../../src/hooks/useOnScrollWithin.ts"],"sourcesContent":["import { useLayoutEffect, useRef } from 'react'\nimport { useScopedConsoleRef } from '../debug-context'\nimport { RefObjectOrElement, unwrapRefValue } from './unwrapRefValue'\n\n/**\n * Invokes callback on scroll event within the scroll container\n *\n * @param refOrElement - Scroll container\n * @param callback - Callback that is invoked on scroll event\n * @param interval - Specifies how often should scroll event invoke callback\n */\nexport function useOnScrollWithin(\n\trefOrElement: RefObjectOrElement<HTMLElement | null> | null,\n\tcallback: (event: Event) => void,\n\tinterval: number = 1000 / 60,\n) {\n\tconst scopedConsoleRef = useScopedConsoleRef('useOnScrollWithin')\n\n\tconst callbackRef = useRef(callback); callbackRef.current = callback\n\tconst lastTimeStamp = useRef<number>(0)\n\n\tuseLayoutEffect(() => {\n\t\tconst element = unwrapRefValue(refOrElement)\n\n\t\tlet timeoutID: number | undefined = undefined\n\n\t\tif (element) {\n\t\t\tfunction debouncedHandler(event: Event) {\n\t\t\t\tclearTimeout(timeoutID)\n\n\t\t\t\tconst delta = event.timeStamp - lastTimeStamp.current\n\t\t\t\tscopedConsoleRef.current.logged('event:element.scroll:delta', delta)\n\n\t\t\t\tif (delta > interval) {\n\t\t\t\t\tscopedConsoleRef.current.warned('event:element.scroll:immediately', event)\n\t\t\t\t\tcallbackRef.current(event)\n\t\t\t\t\tlastTimeStamp.current = event.timeStamp\n\t\t\t\t} else {\n\t\t\t\t\ttimeoutID = setTimeout(() => {\n\t\t\t\t\t\tscopedConsoleRef.current.warned('event:element.scroll:debounced', event)\n\t\t\t\t\t\tlastTimeStamp.current = event.timeStamp\n\t\t\t\t\t\tcallbackRef.current(event)\n\t\t\t\t\t}, interval)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (element instanceof HTMLElement) {\n\t\t\t\tif (element instanceof HTMLBodyElement || element instanceof HTMLHtmlElement) {\n\t\t\t\t\twindow.addEventListener('scroll', debouncedHandler, { capture: true, passive: true })\n\t\t\t\t\twindow.addEventListener('resize', debouncedHandler)\n\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\twindow.removeEventListener('scroll', debouncedHandler)\n\t\t\t\t\t\twindow.removeEventListener('resize', debouncedHandler)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\telement.addEventListener('scroll', debouncedHandler, { passive: true, capture: true })\n\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\telement.removeEventListener('scroll', debouncedHandler)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow new Error('Exhaustive error: Expecting element to be instance of HTMLElement')\n\t\t\t}\n\t\t}\n\t}, [interval, refOrElement, scopedConsoleRef])\n}\n"],"names":[],"mappings":";;;AAWO,SAAS,kBACf,cACA,UACA,WAAmB,MAAO,IACzB;AACK,QAAA,mBAAmB,oBAAoB,mBAAmB;AAE1D,QAAA,cAAc,OAAO,QAAQ;AAAG,cAAY,UAAU;AACtD,QAAA,gBAAgB,OAAe,CAAC;AAEtC,kBAAgB,MAAM;AACf,UAAA,UAAU,eAAe,YAAY;AAE3C,QAAI,YAAgC;AAEpC,QAAI,SAAS;AACH,UAAA,mBAAT,SAA0B,OAAc;AACvC,qBAAa,SAAS;AAEhB,cAAA,QAAQ,MAAM,YAAY,cAAc;AAC7B,yBAAA,QAAQ,OAAO,8BAA8B,KAAK;AAEnE,YAAI,QAAQ,UAAU;AACJ,2BAAA,QAAQ,OAAO,oCAAoC,KAAK;AACzE,sBAAY,QAAQ,KAAK;AACzB,wBAAc,UAAU,MAAM;AAAA,QAAA,OACxB;AACN,sBAAY,WAAW,MAAM;AACX,6BAAA,QAAQ,OAAO,kCAAkC,KAAK;AACvE,0BAAc,UAAU,MAAM;AAC9B,wBAAY,QAAQ,KAAK;AAAA,aACvB,QAAQ;AAAA,QACZ;AAAA,MAAA;AAGD,UAAI,mBAAmB,aAAa;AAC/B,YAAA,mBAAmB,mBAAmB,mBAAmB,iBAAiB;AACtE,iBAAA,iBAAiB,UAAU,kBAAkB,EAAE,SAAS,MAAM,SAAS,MAAM;AAC7E,iBAAA,iBAAiB,UAAU,gBAAgB;AAElD,iBAAO,MAAM;AACL,mBAAA,oBAAoB,UAAU,gBAAgB;AAC9C,mBAAA,oBAAoB,UAAU,gBAAgB;AAAA,UAAA;AAAA,QACtD,OACM;AACE,kBAAA,iBAAiB,UAAU,kBAAkB,EAAE,SAAS,MAAM,SAAS,MAAM;AAErF,iBAAO,MAAM;AACJ,oBAAA,oBAAoB,UAAU,gBAAgB;AAAA,UAAA;AAAA,QAExD;AAAA,MAAA,OACM;AACA,cAAA,IAAI,MAAM,mEAAmE;AAAA,MACpF;AAAA,IACD;AAAA,EACE,GAAA,CAAC,UAAU,cAAc,gBAAgB,CAAC;AAC9C;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useOnWindowResize.cjs","sources":["../../../src/hooks/useOnWindowResize.ts"],"sourcesContent":["import { useLayoutEffect, useRef } from 'react'\nimport { useScopedConsoleRef } from '../debug-context'\n\nexport function useOnWindowResize(\n\tcallback: (event: Event) => void,\n\tinterval: number = 300,\n) {\n\tconst scopedConsoleRef = useScopedConsoleRef('useOnWindowResize')\n\n\tconst callbackRef = useRef(callback); callbackRef.current = callback\n\tconst lastTimeStamp = useRef<number>(0)\n\n\tuseLayoutEffect(() => {\n\t\tlet timeoutID: number | undefined = undefined\n\n\t\tfunction debouncedHandler(event: Event) {\n\t\t\tclearTimeout(timeoutID)\n\n\t\t\tconst delta = event.timeStamp - lastTimeStamp.current\n\t\t\tscopedConsoleRef.current.logged('window.resize:delta', delta)\n\n\t\t\tif (delta > interval) {\n\t\t\t\tscopedConsoleRef.current.warned('event:window.resize:immediately', null)\n\t\t\t\tcallbackRef.current(event)\n\t\t\t\tlastTimeStamp.current = event.timeStamp\n\t\t\t} else {\n\t\t\t\ttimeoutID = setTimeout(() => {\n\t\t\t\t\tscopedConsoleRef.current.warned('event:window.resize:debounced', null)\n\t\t\t\t\tlastTimeStamp.current = event.timeStamp\n\t\t\t\t\tcallbackRef.current(event)\n\t\t\t\t}, interval)\n\t\t\t}\n\t\t}\n\n\t\twindow.addEventListener('resize', debouncedHandler)\n\n\t\treturn () => {\n\t\t\tclearTimeout(timeoutID)\n\t\t\twindow.removeEventListener('resize', debouncedHandler)\n\t\t}\n\t}, [callbackRef, interval, scopedConsoleRef])\n}\n"],"names":["useScopedConsoleRef","useRef","useLayoutEffect"],"mappings":";;;;AAGgB,SAAA,kBACf,UACA,WAAmB,KAClB;AACK,QAAA,mBAAmBA,4BAAoB,mBAAmB;AAE1D,QAAA,cAAcC,aAAO,QAAQ;AAAG,cAAY,UAAU;AACtD,QAAA,gBAAgBA,aAAe,CAAC;AAEtCC,QAAAA,gBAAgB,MAAM;AACrB,QAAI,YAAgC;AAEpC,aAAS,iBAAiB,OAAc;AACvC,mBAAa,SAAS;AAEhB,YAAA,QAAQ,MAAM,YAAY,cAAc;AAC7B,uBAAA,QAAQ,OAAO,uBAAuB,KAAK;AAE5D,UAAI,QAAQ,UAAU;AACJ,yBAAA,QAAQ,OAAO,mCAAmC,IAAI;AACvE,oBAAY,QAAQ,KAAK;AACzB,sBAAc,UAAU,MAAM;AAAA,MAAA,OACxB;AACN,oBAAY,WAAW,MAAM;AACX,2BAAA,QAAQ,OAAO,iCAAiC,IAAI;AACrE,wBAAc,UAAU,MAAM;AAC9B,sBAAY,QAAQ,KAAK;AAAA,WACvB,QAAQ;AAAA,MACZ;AAAA,IACD;AAEO,WAAA,iBAAiB,UAAU,gBAAgB;AAElD,WAAO,MAAM;AACZ,mBAAa,SAAS;AACf,aAAA,oBAAoB,UAAU,gBAAgB;AAAA,IAAA;AAAA,EAEpD,GAAA,CAAC,aAAa,UAAU,gBAAgB,CAAC;AAC7C;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useOnWindowResize.js","sources":["../../../src/hooks/useOnWindowResize.ts"],"sourcesContent":["import { useLayoutEffect, useRef } from 'react'\nimport { useScopedConsoleRef } from '../debug-context'\n\nexport function useOnWindowResize(\n\tcallback: (event: Event) => void,\n\tinterval: number = 300,\n) {\n\tconst scopedConsoleRef = useScopedConsoleRef('useOnWindowResize')\n\n\tconst callbackRef = useRef(callback); callbackRef.current = callback\n\tconst lastTimeStamp = useRef<number>(0)\n\n\tuseLayoutEffect(() => {\n\t\tlet timeoutID: number | undefined = undefined\n\n\t\tfunction debouncedHandler(event: Event) {\n\t\t\tclearTimeout(timeoutID)\n\n\t\t\tconst delta = event.timeStamp - lastTimeStamp.current\n\t\t\tscopedConsoleRef.current.logged('window.resize:delta', delta)\n\n\t\t\tif (delta > interval) {\n\t\t\t\tscopedConsoleRef.current.warned('event:window.resize:immediately', null)\n\t\t\t\tcallbackRef.current(event)\n\t\t\t\tlastTimeStamp.current = event.timeStamp\n\t\t\t} else {\n\t\t\t\ttimeoutID = setTimeout(() => {\n\t\t\t\t\tscopedConsoleRef.current.warned('event:window.resize:debounced', null)\n\t\t\t\t\tlastTimeStamp.current = event.timeStamp\n\t\t\t\t\tcallbackRef.current(event)\n\t\t\t\t}, interval)\n\t\t\t}\n\t\t}\n\n\t\twindow.addEventListener('resize', debouncedHandler)\n\n\t\treturn () => {\n\t\t\tclearTimeout(timeoutID)\n\t\t\twindow.removeEventListener('resize', debouncedHandler)\n\t\t}\n\t}, [callbackRef, interval, scopedConsoleRef])\n}\n"],"names":[],"mappings":";;AAGgB,SAAA,kBACf,UACA,WAAmB,KAClB;AACK,QAAA,mBAAmB,oBAAoB,mBAAmB;AAE1D,QAAA,cAAc,OAAO,QAAQ;AAAG,cAAY,UAAU;AACtD,QAAA,gBAAgB,OAAe,CAAC;AAEtC,kBAAgB,MAAM;AACrB,QAAI,YAAgC;AAEpC,aAAS,iBAAiB,OAAc;AACvC,mBAAa,SAAS;AAEhB,YAAA,QAAQ,MAAM,YAAY,cAAc;AAC7B,uBAAA,QAAQ,OAAO,uBAAuB,KAAK;AAE5D,UAAI,QAAQ,UAAU;AACJ,yBAAA,QAAQ,OAAO,mCAAmC,IAAI;AACvE,oBAAY,QAAQ,KAAK;AACzB,sBAAc,UAAU,MAAM;AAAA,MAAA,OACxB;AACN,oBAAY,WAAW,MAAM;AACX,2BAAA,QAAQ,OAAO,iCAAiC,IAAI;AACrE,wBAAc,UAAU,MAAM;AAC9B,sBAAY,QAAQ,KAAK;AAAA,WACvB,QAAQ;AAAA,MACZ;AAAA,IACD;AAEO,WAAA,iBAAiB,UAAU,gBAAgB;AAElD,WAAO,MAAM;AACZ,mBAAa,SAAS;AACf,aAAA,oBAAoB,UAAU,gBAAgB;AAAA,IAAA;AAAA,EAEpD,GAAA,CAAC,aAAa,UAAU,gBAAgB,CAAC;AAC7C;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePreviousValue.cjs","sources":["../../../src/hooks/usePreviousValue.ts"],"sourcesContent":["import { useEffect, useRef } from 'react'\n\nexport const usePreviousValue = <Value>(value: Value) => {\n\tconst ref = useRef<Value>(value)\n\tuseEffect(() => {\n\t\tref.current = value\n\t})\n\treturn ref.current\n}\n"],"names":["useRef","useEffect"],"mappings":";;;AAEa,MAAA,mBAAmB,CAAQ,UAAiB;AAClD,QAAA,MAAMA,aAAc,KAAK;AAC/BC,QAAAA,UAAU,MAAM;AACf,QAAI,UAAU;AAAA,EAAA,CACd;AACD,SAAO,IAAI;AACZ;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePreviousValue.js","sources":["../../../src/hooks/usePreviousValue.ts"],"sourcesContent":["import { useEffect, useRef } from 'react'\n\nexport const usePreviousValue = <Value>(value: Value) => {\n\tconst ref = useRef<Value>(value)\n\tuseEffect(() => {\n\t\tref.current = value\n\t})\n\treturn ref.current\n}\n"],"names":[],"mappings":";AAEa,MAAA,mBAAmB,CAAQ,UAAiB;AAClD,QAAA,MAAM,OAAc,KAAK;AAC/B,YAAU,MAAM;AACf,QAAI,UAAU;AAAA,EAAA,CACd;AACD,SAAO,IAAI;AACZ;"}
@@ -1,67 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const utilities = require("@contember/utilities");
4
- const react = require("react");
5
- const unwrapRefValue = require("./unwrapRefValue.cjs");
6
- const useOnScrollWithin = require("./useOnScrollWithin.cjs");
7
- const useOnWindowResize = require("./useOnWindowResize.cjs");
8
- const Context = require("../debug-context/Context.cjs");
9
- const useReferentiallyStableCallback = require("../referentiallyStable/useReferentiallyStableCallback.cjs");
10
- function useScrollOffsets(refOrElement, interval = 1e3 / 60) {
11
- const { logged } = Context.useScopedConsoleRef("useScrollOffsets").current;
12
- const [top, setTop] = react.useState(0);
13
- const [bottom, setBottom] = react.useState(0);
14
- const [left, setLeft] = react.useState(0);
15
- const [right, setRight] = react.useState(0);
16
- const updateScrollOffsetsState = useReferentiallyStableCallback.useReferentiallyStableCallback((offsets) => {
17
- logged("Update the offsets:", {
18
- previous: { bottom, left, right, top },
19
- next: offsets
20
- });
21
- if (offsets.bottom !== bottom)
22
- setBottom(offsets.bottom);
23
- if (offsets.left !== left)
24
- setLeft(offsets.left);
25
- if (offsets.right !== right)
26
- setRight(offsets.right);
27
- if (offsets.top !== top)
28
- setTop(offsets.top);
29
- });
30
- const handler = useReferentiallyStableCallback.useReferentiallyStableCallback(() => {
31
- const maybeScrollContent = unwrapRefValue.unwrapRefValue(refOrElement) ?? document;
32
- if (maybeScrollContent) {
33
- getElementScrollOffsets(maybeScrollContent).then(updateScrollOffsetsState);
34
- }
35
- });
36
- useOnScrollWithin.useOnScrollWithin(refOrElement, handler, interval);
37
- useOnWindowResize.useOnWindowResize(handler);
38
- react.useLayoutEffect(handler, [handler]);
39
- return react.useMemo(() => ({ bottom, left, right, top }), [bottom, left, right, top]);
40
- }
41
- function isIntrinsicScrollElement(element) {
42
- return element instanceof HTMLBodyElement || element instanceof HTMLHtmlElement || element instanceof DocumentType || element instanceof Document || element instanceof HTMLDocument;
43
- }
44
- function getIntrinsicScrollContainer(element) {
45
- const html = document.body.parentElement;
46
- utilities.assert("HTML element exists", html, (value) => value instanceof HTMLElement);
47
- if (isIntrinsicScrollElement(element)) {
48
- return html;
49
- } else {
50
- return element;
51
- }
52
- }
53
- async function getElementScrollOffsets(element) {
54
- const isIntrinsicScrolling = isIntrinsicScrollElement(element);
55
- const scrollContainer = getIntrinsicScrollContainer(element);
56
- const { scrollLeft, scrollTop, scrollHeight, scrollWidth } = scrollContainer;
57
- const { height: scrollContainerHeight, width: scrollContainerWidth } = await utilities.getElementDimensions(scrollContainer);
58
- const height = isIntrinsicScrolling ? window.innerHeight : scrollContainerHeight;
59
- const width = isIntrinsicScrolling ? window.innerWidth : scrollContainerWidth;
60
- const left = Math.round(scrollLeft);
61
- const top = Math.round(scrollTop);
62
- const right = Math.round(scrollWidth - width - left);
63
- const bottom = Math.round(scrollHeight - height - top);
64
- return { bottom, left, right, top };
65
- }
66
- exports.useScrollOffsets = useScrollOffsets;
67
- //# sourceMappingURL=useScrollOffsets.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useScrollOffsets.cjs","sources":["../../../src/hooks/useScrollOffsets.ts"],"sourcesContent":["import { assert, getElementDimensions } from '@contember/utilities'\nimport { useLayoutEffect, useMemo, useState } from 'react'\nimport { useScopedConsoleRef } from '../debug-context'\nimport { useReferentiallyStableCallback } from '../referentiallyStable'\nimport { RefObjectOrElement, unwrapRefValue } from './unwrapRefValue'\nimport { useOnScrollWithin } from './useOnScrollWithin'\nimport { useOnWindowResize } from './useOnWindowResize'\n\nexport type Offsets = {\n\tbottom: number;\n\tleft: number;\n\tright: number;\n\ttop: number;\n}\n\nexport function useScrollOffsets(refOrElement: RefObjectOrElement<HTMLElement | null> | null, interval: number = 1000 / 60) {\n\tconst { logged } = useScopedConsoleRef('useScrollOffsets').current\n\n\tconst [top, setTop] = useState(0)\n\tconst [bottom, setBottom] = useState(0)\n\tconst [left, setLeft] = useState(0)\n\tconst [right, setRight] = useState(0)\n\n\tconst updateScrollOffsetsState = useReferentiallyStableCallback((offsets: Offsets) => {\n\t\tlogged('Update the offsets:', {\n\t\t\tprevious: { bottom, left, right, top },\n\t\t\tnext: offsets,\n\t\t})\n\n\t\tif (offsets.bottom !== bottom) setBottom(offsets.bottom)\n\t\tif (offsets.left !== left) setLeft(offsets.left)\n\t\tif (offsets.right !== right) setRight(offsets.right)\n\t\tif (offsets.top !== top) setTop(offsets.top)\n\t})\n\n\tconst handler = useReferentiallyStableCallback(() => {\n\t\tconst maybeScrollContent = unwrapRefValue(refOrElement) ?? document\n\n\t\tif (maybeScrollContent) {\n\t\t\tgetElementScrollOffsets(maybeScrollContent).then(updateScrollOffsetsState)\n\t\t}\n\t})\n\n\tuseOnScrollWithin(refOrElement, handler, interval)\n\tuseOnWindowResize(handler)\n\tuseLayoutEffect(handler, [handler])\n\n\treturn useMemo(() => ({ bottom, left, right, top }), [bottom, left, right, top])\n}\n\nfunction isIntrinsicScrollElement(element: unknown): element is Document {\n\treturn element instanceof HTMLBodyElement\n\t\t|| element instanceof HTMLHtmlElement\n\t\t|| element instanceof DocumentType\n\t\t|| element instanceof Document\n\t\t|| element instanceof HTMLDocument\n}\n\nfunction getIntrinsicScrollContainer(element: HTMLElement | Document): HTMLElement {\n\tconst html = document.body.parentElement\n\tassert('HTML element exists', html, (value): value is HTMLElement => value instanceof HTMLElement)\n\n\tif (isIntrinsicScrollElement(element)) {\n\t\treturn html\n\t} else {\n\t\treturn element\n\t}\n}\n\nasync function getElementScrollOffsets(element: HTMLElement | Document): Promise<Offsets> {\n\tconst isIntrinsicScrolling = isIntrinsicScrollElement(element)\n\tconst scrollContainer = getIntrinsicScrollContainer(element)\n\n\tconst { scrollLeft, scrollTop, scrollHeight, scrollWidth } = scrollContainer\n\tconst { height: scrollContainerHeight, width: scrollContainerWidth } = await getElementDimensions(scrollContainer)\n\n\tconst height = isIntrinsicScrolling ? window.innerHeight : scrollContainerHeight\n\tconst width = isIntrinsicScrolling ? window.innerWidth : scrollContainerWidth\n\n\tconst left = Math.round(scrollLeft)\n\tconst top = Math.round(scrollTop)\n\n\tconst right = Math.round(scrollWidth - width - left)\n\tconst bottom = Math.round(scrollHeight - height - top)\n\n\treturn { bottom, left, right, top }\n}\n"],"names":["useScopedConsoleRef","useState","useReferentiallyStableCallback","unwrapRefValue","useOnScrollWithin","useOnWindowResize","useLayoutEffect","useMemo","assert","getElementDimensions"],"mappings":";;;;;;;;;AAeO,SAAS,iBAAiB,cAA6D,WAAmB,MAAO,IAAI;AAC3H,QAAM,EAAE,OAAW,IAAAA,QAAA,oBAAoB,kBAAkB,EAAE;AAE3D,QAAM,CAAC,KAAK,MAAM,IAAIC,eAAS,CAAC;AAChC,QAAM,CAAC,QAAQ,SAAS,IAAIA,eAAS,CAAC;AACtC,QAAM,CAAC,MAAM,OAAO,IAAIA,eAAS,CAAC;AAClC,QAAM,CAAC,OAAO,QAAQ,IAAIA,eAAS,CAAC;AAE9B,QAAA,2BAA2BC,8DAA+B,CAAC,YAAqB;AACrF,WAAO,uBAAuB;AAAA,MAC7B,UAAU,EAAE,QAAQ,MAAM,OAAO,IAAI;AAAA,MACrC,MAAM;AAAA,IAAA,CACN;AAED,QAAI,QAAQ,WAAW;AAAQ,gBAAU,QAAQ,MAAM;AACvD,QAAI,QAAQ,SAAS;AAAM,cAAQ,QAAQ,IAAI;AAC/C,QAAI,QAAQ,UAAU;AAAO,eAAS,QAAQ,KAAK;AACnD,QAAI,QAAQ,QAAQ;AAAK,aAAO,QAAQ,GAAG;AAAA,EAAA,CAC3C;AAEK,QAAA,UAAUA,+BAAAA,+BAA+B,MAAM;AAC9C,UAAA,qBAAqBC,eAAAA,eAAe,YAAY,KAAK;AAE3D,QAAI,oBAAoB;AACC,8BAAA,kBAAkB,EAAE,KAAK,wBAAwB;AAAA,IAC1E;AAAA,EAAA,CACA;AAEiBC,oBAAAA,kBAAA,cAAc,SAAS,QAAQ;AACjDC,oBAAA,kBAAkB,OAAO;AACTC,QAAAA,gBAAA,SAAS,CAAC,OAAO,CAAC;AAElC,SAAOC,MAAQ,QAAA,OAAO,EAAE,QAAQ,MAAM,OAAO,QAAQ,CAAC,QAAQ,MAAM,OAAO,GAAG,CAAC;AAChF;AAEA,SAAS,yBAAyB,SAAuC;AACjE,SAAA,mBAAmB,mBACtB,mBAAmB,mBACnB,mBAAmB,gBACnB,mBAAmB,YACnB,mBAAmB;AACxB;AAEA,SAAS,4BAA4B,SAA8C;AAC5E,QAAA,OAAO,SAAS,KAAK;AAC3BC,YAAA,OAAO,uBAAuB,MAAM,CAAC,UAAgC,iBAAiB,WAAW;AAE7F,MAAA,yBAAyB,OAAO,GAAG;AAC/B,WAAA;AAAA,EAAA,OACD;AACC,WAAA;AAAA,EACR;AACD;AAEA,eAAe,wBAAwB,SAAmD;AACnF,QAAA,uBAAuB,yBAAyB,OAAO;AACvD,QAAA,kBAAkB,4BAA4B,OAAO;AAE3D,QAAM,EAAE,YAAY,WAAW,cAAc,gBAAgB;AACvD,QAAA,EAAE,QAAQ,uBAAuB,OAAO,yBAAyB,MAAMC,UAAAA,qBAAqB,eAAe;AAE3G,QAAA,SAAS,uBAAuB,OAAO,cAAc;AACrD,QAAA,QAAQ,uBAAuB,OAAO,aAAa;AAEnD,QAAA,OAAO,KAAK,MAAM,UAAU;AAC5B,QAAA,MAAM,KAAK,MAAM,SAAS;AAEhC,QAAM,QAAQ,KAAK,MAAM,cAAc,QAAQ,IAAI;AACnD,QAAM,SAAS,KAAK,MAAM,eAAe,SAAS,GAAG;AAErD,SAAO,EAAE,QAAQ,MAAM,OAAO,IAAI;AACnC;;"}
@@ -1,67 +0,0 @@
1
- import { getElementDimensions, assert } from "@contember/utilities";
2
- import { useState, useLayoutEffect, useMemo } from "react";
3
- import { unwrapRefValue } from "./unwrapRefValue.js";
4
- import { useOnScrollWithin } from "./useOnScrollWithin.js";
5
- import { useOnWindowResize } from "./useOnWindowResize.js";
6
- import { useScopedConsoleRef } from "../debug-context/Context.js";
7
- import { useReferentiallyStableCallback } from "../referentiallyStable/useReferentiallyStableCallback.js";
8
- function useScrollOffsets(refOrElement, interval = 1e3 / 60) {
9
- const { logged } = useScopedConsoleRef("useScrollOffsets").current;
10
- const [top, setTop] = useState(0);
11
- const [bottom, setBottom] = useState(0);
12
- const [left, setLeft] = useState(0);
13
- const [right, setRight] = useState(0);
14
- const updateScrollOffsetsState = useReferentiallyStableCallback((offsets) => {
15
- logged("Update the offsets:", {
16
- previous: { bottom, left, right, top },
17
- next: offsets
18
- });
19
- if (offsets.bottom !== bottom)
20
- setBottom(offsets.bottom);
21
- if (offsets.left !== left)
22
- setLeft(offsets.left);
23
- if (offsets.right !== right)
24
- setRight(offsets.right);
25
- if (offsets.top !== top)
26
- setTop(offsets.top);
27
- });
28
- const handler = useReferentiallyStableCallback(() => {
29
- const maybeScrollContent = unwrapRefValue(refOrElement) ?? document;
30
- if (maybeScrollContent) {
31
- getElementScrollOffsets(maybeScrollContent).then(updateScrollOffsetsState);
32
- }
33
- });
34
- useOnScrollWithin(refOrElement, handler, interval);
35
- useOnWindowResize(handler);
36
- useLayoutEffect(handler, [handler]);
37
- return useMemo(() => ({ bottom, left, right, top }), [bottom, left, right, top]);
38
- }
39
- function isIntrinsicScrollElement(element) {
40
- return element instanceof HTMLBodyElement || element instanceof HTMLHtmlElement || element instanceof DocumentType || element instanceof Document || element instanceof HTMLDocument;
41
- }
42
- function getIntrinsicScrollContainer(element) {
43
- const html = document.body.parentElement;
44
- assert("HTML element exists", html, (value) => value instanceof HTMLElement);
45
- if (isIntrinsicScrollElement(element)) {
46
- return html;
47
- } else {
48
- return element;
49
- }
50
- }
51
- async function getElementScrollOffsets(element) {
52
- const isIntrinsicScrolling = isIntrinsicScrollElement(element);
53
- const scrollContainer = getIntrinsicScrollContainer(element);
54
- const { scrollLeft, scrollTop, scrollHeight, scrollWidth } = scrollContainer;
55
- const { height: scrollContainerHeight, width: scrollContainerWidth } = await getElementDimensions(scrollContainer);
56
- const height = isIntrinsicScrolling ? window.innerHeight : scrollContainerHeight;
57
- const width = isIntrinsicScrolling ? window.innerWidth : scrollContainerWidth;
58
- const left = Math.round(scrollLeft);
59
- const top = Math.round(scrollTop);
60
- const right = Math.round(scrollWidth - width - left);
61
- const bottom = Math.round(scrollHeight - height - top);
62
- return { bottom, left, right, top };
63
- }
64
- export {
65
- useScrollOffsets
66
- };
67
- //# sourceMappingURL=useScrollOffsets.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useScrollOffsets.js","sources":["../../../src/hooks/useScrollOffsets.ts"],"sourcesContent":["import { assert, getElementDimensions } from '@contember/utilities'\nimport { useLayoutEffect, useMemo, useState } from 'react'\nimport { useScopedConsoleRef } from '../debug-context'\nimport { useReferentiallyStableCallback } from '../referentiallyStable'\nimport { RefObjectOrElement, unwrapRefValue } from './unwrapRefValue'\nimport { useOnScrollWithin } from './useOnScrollWithin'\nimport { useOnWindowResize } from './useOnWindowResize'\n\nexport type Offsets = {\n\tbottom: number;\n\tleft: number;\n\tright: number;\n\ttop: number;\n}\n\nexport function useScrollOffsets(refOrElement: RefObjectOrElement<HTMLElement | null> | null, interval: number = 1000 / 60) {\n\tconst { logged } = useScopedConsoleRef('useScrollOffsets').current\n\n\tconst [top, setTop] = useState(0)\n\tconst [bottom, setBottom] = useState(0)\n\tconst [left, setLeft] = useState(0)\n\tconst [right, setRight] = useState(0)\n\n\tconst updateScrollOffsetsState = useReferentiallyStableCallback((offsets: Offsets) => {\n\t\tlogged('Update the offsets:', {\n\t\t\tprevious: { bottom, left, right, top },\n\t\t\tnext: offsets,\n\t\t})\n\n\t\tif (offsets.bottom !== bottom) setBottom(offsets.bottom)\n\t\tif (offsets.left !== left) setLeft(offsets.left)\n\t\tif (offsets.right !== right) setRight(offsets.right)\n\t\tif (offsets.top !== top) setTop(offsets.top)\n\t})\n\n\tconst handler = useReferentiallyStableCallback(() => {\n\t\tconst maybeScrollContent = unwrapRefValue(refOrElement) ?? document\n\n\t\tif (maybeScrollContent) {\n\t\t\tgetElementScrollOffsets(maybeScrollContent).then(updateScrollOffsetsState)\n\t\t}\n\t})\n\n\tuseOnScrollWithin(refOrElement, handler, interval)\n\tuseOnWindowResize(handler)\n\tuseLayoutEffect(handler, [handler])\n\n\treturn useMemo(() => ({ bottom, left, right, top }), [bottom, left, right, top])\n}\n\nfunction isIntrinsicScrollElement(element: unknown): element is Document {\n\treturn element instanceof HTMLBodyElement\n\t\t|| element instanceof HTMLHtmlElement\n\t\t|| element instanceof DocumentType\n\t\t|| element instanceof Document\n\t\t|| element instanceof HTMLDocument\n}\n\nfunction getIntrinsicScrollContainer(element: HTMLElement | Document): HTMLElement {\n\tconst html = document.body.parentElement\n\tassert('HTML element exists', html, (value): value is HTMLElement => value instanceof HTMLElement)\n\n\tif (isIntrinsicScrollElement(element)) {\n\t\treturn html\n\t} else {\n\t\treturn element\n\t}\n}\n\nasync function getElementScrollOffsets(element: HTMLElement | Document): Promise<Offsets> {\n\tconst isIntrinsicScrolling = isIntrinsicScrollElement(element)\n\tconst scrollContainer = getIntrinsicScrollContainer(element)\n\n\tconst { scrollLeft, scrollTop, scrollHeight, scrollWidth } = scrollContainer\n\tconst { height: scrollContainerHeight, width: scrollContainerWidth } = await getElementDimensions(scrollContainer)\n\n\tconst height = isIntrinsicScrolling ? window.innerHeight : scrollContainerHeight\n\tconst width = isIntrinsicScrolling ? window.innerWidth : scrollContainerWidth\n\n\tconst left = Math.round(scrollLeft)\n\tconst top = Math.round(scrollTop)\n\n\tconst right = Math.round(scrollWidth - width - left)\n\tconst bottom = Math.round(scrollHeight - height - top)\n\n\treturn { bottom, left, right, top }\n}\n"],"names":[],"mappings":";;;;;;;AAeO,SAAS,iBAAiB,cAA6D,WAAmB,MAAO,IAAI;AAC3H,QAAM,EAAE,OAAW,IAAA,oBAAoB,kBAAkB,EAAE;AAE3D,QAAM,CAAC,KAAK,MAAM,IAAI,SAAS,CAAC;AAChC,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,CAAC;AACtC,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,CAAC;AAClC,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,CAAC;AAE9B,QAAA,2BAA2B,+BAA+B,CAAC,YAAqB;AACrF,WAAO,uBAAuB;AAAA,MAC7B,UAAU,EAAE,QAAQ,MAAM,OAAO,IAAI;AAAA,MACrC,MAAM;AAAA,IAAA,CACN;AAED,QAAI,QAAQ,WAAW;AAAQ,gBAAU,QAAQ,MAAM;AACvD,QAAI,QAAQ,SAAS;AAAM,cAAQ,QAAQ,IAAI;AAC/C,QAAI,QAAQ,UAAU;AAAO,eAAS,QAAQ,KAAK;AACnD,QAAI,QAAQ,QAAQ;AAAK,aAAO,QAAQ,GAAG;AAAA,EAAA,CAC3C;AAEK,QAAA,UAAU,+BAA+B,MAAM;AAC9C,UAAA,qBAAqB,eAAe,YAAY,KAAK;AAE3D,QAAI,oBAAoB;AACC,8BAAA,kBAAkB,EAAE,KAAK,wBAAwB;AAAA,IAC1E;AAAA,EAAA,CACA;AAEiB,oBAAA,cAAc,SAAS,QAAQ;AACjD,oBAAkB,OAAO;AACT,kBAAA,SAAS,CAAC,OAAO,CAAC;AAElC,SAAO,QAAQ,OAAO,EAAE,QAAQ,MAAM,OAAO,QAAQ,CAAC,QAAQ,MAAM,OAAO,GAAG,CAAC;AAChF;AAEA,SAAS,yBAAyB,SAAuC;AACjE,SAAA,mBAAmB,mBACtB,mBAAmB,mBACnB,mBAAmB,gBACnB,mBAAmB,YACnB,mBAAmB;AACxB;AAEA,SAAS,4BAA4B,SAA8C;AAC5E,QAAA,OAAO,SAAS,KAAK;AAC3B,SAAO,uBAAuB,MAAM,CAAC,UAAgC,iBAAiB,WAAW;AAE7F,MAAA,yBAAyB,OAAO,GAAG;AAC/B,WAAA;AAAA,EAAA,OACD;AACC,WAAA;AAAA,EACR;AACD;AAEA,eAAe,wBAAwB,SAAmD;AACnF,QAAA,uBAAuB,yBAAyB,OAAO;AACvD,QAAA,kBAAkB,4BAA4B,OAAO;AAE3D,QAAM,EAAE,YAAY,WAAW,cAAc,gBAAgB;AACvD,QAAA,EAAE,QAAQ,uBAAuB,OAAO,yBAAyB,MAAM,qBAAqB,eAAe;AAE3G,QAAA,SAAS,uBAAuB,OAAO,cAAc;AACrD,QAAA,QAAQ,uBAAuB,OAAO,aAAa;AAEnD,QAAA,OAAO,KAAK,MAAM,UAAU;AAC5B,QAAA,MAAM,KAAK,MAAM,SAAS;AAEhC,QAAM,QAAQ,KAAK,MAAM,cAAc,QAAQ,IAAI;AACnD,QAAM,SAAS,KAAK,MAAM,eAAe,SAAS,GAAG;AAErD,SAAO,EAAE,QAAQ,MAAM,OAAO,IAAI;AACnC;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useStoredState.cjs","sources":["../../../src/hooks/useStoredState.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react'\nimport { Serializable } from '../types'\n\nexport type SetState<V extends Serializable> = (value: V | ((current: V) => V)) => void;\nexport type StateStorageKey = [uniquePrefix: string, key: string]\n\nexport type ValueInitializer<V extends Serializable> = (storedValue: V | undefined) => V;\n\nexport interface StateStorage {\n\tgetItem(key: StateStorageKey): Serializable\n\n\tsetItem(key: StateStorageKey, value: Serializable): void\n}\n\n\nexport const urlStateStorage: StateStorage = {\n\tgetItem(key) {\n\t\tconst searchParams = new URLSearchParams(window.location.search)\n\t\tconst value = searchParams.get(key[1])\n\t\treturn value !== null && value !== undefined ? JSON.parse(value) : null\n\t},\n\tsetItem(key, value) {\n\t\tconst searchParams = new URLSearchParams(window.location.search)\n\t\tsearchParams.set(key[1], JSON.stringify(value))\n\t\tconst newUrl = `${window.location.pathname}?${searchParams.toString()}`\n\t\twindow.history.replaceState({}, '', newUrl)\n\t},\n}\n\nconst createStateStorageFromNativeStorage = (getStorage: () => Storage): StateStorage => {\n\treturn {\n\t\tgetItem(key) {\n\t\t\tconst value = getStorage().getItem(key.join('-'))\n\t\t\treturn value !== null ? JSON.parse(value) : null\n\t\t},\n\t\tsetItem(key, value) {\n\t\t\tgetStorage().setItem(key.join('-'), JSON.stringify(value))\n\t\t},\n\t}\n}\n\nexport const sessionStateStorage = createStateStorageFromNativeStorage(() => sessionStorage)\nexport const localStateStorage = createStateStorageFromNativeStorage(() => localStorage)\nexport const nullStorage: StateStorage = {\n\tgetItem() {\n\t\treturn null\n\t},\n\tsetItem() {\n\t},\n}\n\nconst builtInStorages = {\n\turl: urlStateStorage,\n\tsession: sessionStateStorage,\n\tlocal: localStateStorage,\n\tnull: nullStorage,\n}\n\nexport type StateStorageOrName = StateStorage | 'url' | 'session' | 'local' | 'null'\n\nexport const useStoredState = <V extends Serializable>(storageOrName: StateStorageOrName | StateStorageOrName[], key: StateStorageKey, initializeValue: ValueInitializer<V>): [V, SetState<V>] => {\n\tconst storage = useMemo(() => {\n\t\treturn getStateStorage(storageOrName)\n\t}, [storageOrName])\n\n\tconst [value, setValue] = useState<V>(() => {\n\t\tconst value = storage.getItem(key)\n\t\treturn initializeValue(value as V)\n\t})\n\treturn [\n\t\tvalue,\n\t\tuseCallback(value => {\n\t\t\tsetValue(current => {\n\t\t\t\tconst newValue = typeof value === 'function' ? (value as (current: V) => V)(current) : value\n\t\t\t\tstorage.setItem(key, newValue)\n\t\t\t\treturn newValue\n\t\t\t})\n\t\t}, [key, storage]),\n\t]\n}\n\nexport const useSessionStorageState = <V extends Serializable>(key: StateStorageKey, initializeValue: ValueInitializer<V>): [V, SetState<V>] => {\n\treturn useStoredState<V>(sessionStateStorage, key, initializeValue)\n}\n\nexport const useLocalStorageState = <V extends Serializable>(key: StateStorageKey, initializeValue: ValueInitializer<V>): [V, SetState<V>] => {\n\treturn useStoredState<V>(localStateStorage, key, initializeValue)\n}\n\nexport const getStateStorage = (storageOrName: StateStorageOrName | StateStorageOrName[]) => {\n\tif (Array.isArray(storageOrName)) {\n\t\treturn createFallbackStorage(storageOrName.map(it => typeof it === 'string' ? builtInStorages[it] : it))\n\t}\n\treturn typeof storageOrName === 'string' ? builtInStorages[storageOrName] : storageOrName\n}\n\n\nconst createFallbackStorage = (storageTypes: StateStorage[]): StateStorage => {\n\treturn {\n\t\tgetItem(key) {\n\t\t\tfor (const storage of storageTypes) {\n\t\t\t\tconst value = storage.getItem(key)\n\t\t\t\tif (value !== null) {\n\t\t\t\t\treturn value\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\t\tsetItem(key, value) {\n\t\t\tfor (const storage of storageTypes) {\n\t\t\t\tstorage.setItem(key, value)\n\t\t\t}\n\t\t},\n\t}\n}\n"],"names":["useMemo","useState","value","useCallback"],"mappings":";;;AAeO,MAAM,kBAAgC;AAAA,EAC5C,QAAQ,KAAK;AACZ,UAAM,eAAe,IAAI,gBAAgB,OAAO,SAAS,MAAM;AAC/D,UAAM,QAAQ,aAAa,IAAI,IAAI,CAAC,CAAC;AACrC,WAAO,UAAU,QAAQ,UAAU,SAAY,KAAK,MAAM,KAAK,IAAI;AAAA,EACpE;AAAA,EACA,QAAQ,KAAK,OAAO;AACnB,UAAM,eAAe,IAAI,gBAAgB,OAAO,SAAS,MAAM;AAC/D,iBAAa,IAAI,IAAI,CAAC,GAAG,KAAK,UAAU,KAAK,CAAC;AACxC,UAAA,SAAS,GAAG,OAAO,SAAS,QAAQ,IAAI,aAAa,SAAU,CAAA;AACrE,WAAO,QAAQ,aAAa,CAAC,GAAG,IAAI,MAAM;AAAA,EAC3C;AACD;AAEA,MAAM,sCAAsC,CAAC,eAA4C;AACjF,SAAA;AAAA,IACN,QAAQ,KAAK;AACZ,YAAM,QAAQ,aAAa,QAAQ,IAAI,KAAK,GAAG,CAAC;AAChD,aAAO,UAAU,OAAO,KAAK,MAAM,KAAK,IAAI;AAAA,IAC7C;AAAA,IACA,QAAQ,KAAK,OAAO;AACR,iBAAA,EAAE,QAAQ,IAAI,KAAK,GAAG,GAAG,KAAK,UAAU,KAAK,CAAC;AAAA,IAC1D;AAAA,EAAA;AAEF;AAEa,MAAA,sBAAsB,oCAAoC,MAAM,cAAc;AAC9E,MAAA,oBAAoB,oCAAoC,MAAM,YAAY;AAChF,MAAM,cAA4B;AAAA,EACxC,UAAU;AACF,WAAA;AAAA,EACR;AAAA,EACA,UAAU;AAAA,EACV;AACD;AAEA,MAAM,kBAAkB;AAAA,EACvB,KAAK;AAAA,EACL,SAAS;AAAA,EACT,OAAO;AAAA,EACP,MAAM;AACP;AAIO,MAAM,iBAAiB,CAAyB,eAA0D,KAAsB,oBAA2D;AAC3L,QAAA,UAAUA,MAAAA,QAAQ,MAAM;AAC7B,WAAO,gBAAgB,aAAa;AAAA,EAAA,GAClC,CAAC,aAAa,CAAC;AAElB,QAAM,CAAC,OAAO,QAAQ,IAAIC,eAAY,MAAM;AACrCC,UAAAA,SAAQ,QAAQ,QAAQ,GAAG;AACjC,WAAO,gBAAgBA,MAAU;AAAA,EAAA,CACjC;AACM,SAAA;AAAA,IACN;AAAA,IACAC,MAAA,YAAY,CAAAD,WAAS;AACpB,eAAS,CAAW,YAAA;AACnB,cAAM,WAAW,OAAOA,WAAU,aAAcA,OAA4B,OAAO,IAAIA;AAC/E,gBAAA,QAAQ,KAAK,QAAQ;AACtB,eAAA;AAAA,MAAA,CACP;AAAA,IAAA,GACC,CAAC,KAAK,OAAO,CAAC;AAAA,EAAA;AAEnB;AAEa,MAAA,yBAAyB,CAAyB,KAAsB,oBAA2D;AACxI,SAAA,eAAkB,qBAAqB,KAAK,eAAe;AACnE;AAEa,MAAA,uBAAuB,CAAyB,KAAsB,oBAA2D;AACtI,SAAA,eAAkB,mBAAmB,KAAK,eAAe;AACjE;AAEa,MAAA,kBAAkB,CAAC,kBAA6D;AACxF,MAAA,MAAM,QAAQ,aAAa,GAAG;AAC1B,WAAA,sBAAsB,cAAc,IAAI,CAAM,OAAA,OAAO,OAAO,WAAW,gBAAgB,EAAE,IAAI,EAAE,CAAC;AAAA,EACxG;AACA,SAAO,OAAO,kBAAkB,WAAW,gBAAgB,aAAa,IAAI;AAC7E;AAGA,MAAM,wBAAwB,CAAC,iBAA+C;AACtE,SAAA;AAAA,IACN,QAAQ,KAAK;AACZ,iBAAW,WAAW,cAAc;AAC7B,cAAA,QAAQ,QAAQ,QAAQ,GAAG;AACjC,YAAI,UAAU,MAAM;AACZ,iBAAA;AAAA,QACR;AAAA,MACD;AACO,aAAA;AAAA,IACR;AAAA,IACA,QAAQ,KAAK,OAAO;AACnB,iBAAW,WAAW,cAAc;AAC3B,gBAAA,QAAQ,KAAK,KAAK;AAAA,MAC3B;AAAA,IACD;AAAA,EAAA;AAEF;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useStoredState.js","sources":["../../../src/hooks/useStoredState.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react'\nimport { Serializable } from '../types'\n\nexport type SetState<V extends Serializable> = (value: V | ((current: V) => V)) => void;\nexport type StateStorageKey = [uniquePrefix: string, key: string]\n\nexport type ValueInitializer<V extends Serializable> = (storedValue: V | undefined) => V;\n\nexport interface StateStorage {\n\tgetItem(key: StateStorageKey): Serializable\n\n\tsetItem(key: StateStorageKey, value: Serializable): void\n}\n\n\nexport const urlStateStorage: StateStorage = {\n\tgetItem(key) {\n\t\tconst searchParams = new URLSearchParams(window.location.search)\n\t\tconst value = searchParams.get(key[1])\n\t\treturn value !== null && value !== undefined ? JSON.parse(value) : null\n\t},\n\tsetItem(key, value) {\n\t\tconst searchParams = new URLSearchParams(window.location.search)\n\t\tsearchParams.set(key[1], JSON.stringify(value))\n\t\tconst newUrl = `${window.location.pathname}?${searchParams.toString()}`\n\t\twindow.history.replaceState({}, '', newUrl)\n\t},\n}\n\nconst createStateStorageFromNativeStorage = (getStorage: () => Storage): StateStorage => {\n\treturn {\n\t\tgetItem(key) {\n\t\t\tconst value = getStorage().getItem(key.join('-'))\n\t\t\treturn value !== null ? JSON.parse(value) : null\n\t\t},\n\t\tsetItem(key, value) {\n\t\t\tgetStorage().setItem(key.join('-'), JSON.stringify(value))\n\t\t},\n\t}\n}\n\nexport const sessionStateStorage = createStateStorageFromNativeStorage(() => sessionStorage)\nexport const localStateStorage = createStateStorageFromNativeStorage(() => localStorage)\nexport const nullStorage: StateStorage = {\n\tgetItem() {\n\t\treturn null\n\t},\n\tsetItem() {\n\t},\n}\n\nconst builtInStorages = {\n\turl: urlStateStorage,\n\tsession: sessionStateStorage,\n\tlocal: localStateStorage,\n\tnull: nullStorage,\n}\n\nexport type StateStorageOrName = StateStorage | 'url' | 'session' | 'local' | 'null'\n\nexport const useStoredState = <V extends Serializable>(storageOrName: StateStorageOrName | StateStorageOrName[], key: StateStorageKey, initializeValue: ValueInitializer<V>): [V, SetState<V>] => {\n\tconst storage = useMemo(() => {\n\t\treturn getStateStorage(storageOrName)\n\t}, [storageOrName])\n\n\tconst [value, setValue] = useState<V>(() => {\n\t\tconst value = storage.getItem(key)\n\t\treturn initializeValue(value as V)\n\t})\n\treturn [\n\t\tvalue,\n\t\tuseCallback(value => {\n\t\t\tsetValue(current => {\n\t\t\t\tconst newValue = typeof value === 'function' ? (value as (current: V) => V)(current) : value\n\t\t\t\tstorage.setItem(key, newValue)\n\t\t\t\treturn newValue\n\t\t\t})\n\t\t}, [key, storage]),\n\t]\n}\n\nexport const useSessionStorageState = <V extends Serializable>(key: StateStorageKey, initializeValue: ValueInitializer<V>): [V, SetState<V>] => {\n\treturn useStoredState<V>(sessionStateStorage, key, initializeValue)\n}\n\nexport const useLocalStorageState = <V extends Serializable>(key: StateStorageKey, initializeValue: ValueInitializer<V>): [V, SetState<V>] => {\n\treturn useStoredState<V>(localStateStorage, key, initializeValue)\n}\n\nexport const getStateStorage = (storageOrName: StateStorageOrName | StateStorageOrName[]) => {\n\tif (Array.isArray(storageOrName)) {\n\t\treturn createFallbackStorage(storageOrName.map(it => typeof it === 'string' ? builtInStorages[it] : it))\n\t}\n\treturn typeof storageOrName === 'string' ? builtInStorages[storageOrName] : storageOrName\n}\n\n\nconst createFallbackStorage = (storageTypes: StateStorage[]): StateStorage => {\n\treturn {\n\t\tgetItem(key) {\n\t\t\tfor (const storage of storageTypes) {\n\t\t\t\tconst value = storage.getItem(key)\n\t\t\t\tif (value !== null) {\n\t\t\t\t\treturn value\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\t\tsetItem(key, value) {\n\t\t\tfor (const storage of storageTypes) {\n\t\t\t\tstorage.setItem(key, value)\n\t\t\t}\n\t\t},\n\t}\n}\n"],"names":["value"],"mappings":";AAeO,MAAM,kBAAgC;AAAA,EAC5C,QAAQ,KAAK;AACZ,UAAM,eAAe,IAAI,gBAAgB,OAAO,SAAS,MAAM;AAC/D,UAAM,QAAQ,aAAa,IAAI,IAAI,CAAC,CAAC;AACrC,WAAO,UAAU,QAAQ,UAAU,SAAY,KAAK,MAAM,KAAK,IAAI;AAAA,EACpE;AAAA,EACA,QAAQ,KAAK,OAAO;AACnB,UAAM,eAAe,IAAI,gBAAgB,OAAO,SAAS,MAAM;AAC/D,iBAAa,IAAI,IAAI,CAAC,GAAG,KAAK,UAAU,KAAK,CAAC;AACxC,UAAA,SAAS,GAAG,OAAO,SAAS,QAAQ,IAAI,aAAa,SAAU,CAAA;AACrE,WAAO,QAAQ,aAAa,CAAC,GAAG,IAAI,MAAM;AAAA,EAC3C;AACD;AAEA,MAAM,sCAAsC,CAAC,eAA4C;AACjF,SAAA;AAAA,IACN,QAAQ,KAAK;AACZ,YAAM,QAAQ,aAAa,QAAQ,IAAI,KAAK,GAAG,CAAC;AAChD,aAAO,UAAU,OAAO,KAAK,MAAM,KAAK,IAAI;AAAA,IAC7C;AAAA,IACA,QAAQ,KAAK,OAAO;AACR,iBAAA,EAAE,QAAQ,IAAI,KAAK,GAAG,GAAG,KAAK,UAAU,KAAK,CAAC;AAAA,IAC1D;AAAA,EAAA;AAEF;AAEa,MAAA,sBAAsB,oCAAoC,MAAM,cAAc;AAC9E,MAAA,oBAAoB,oCAAoC,MAAM,YAAY;AAChF,MAAM,cAA4B;AAAA,EACxC,UAAU;AACF,WAAA;AAAA,EACR;AAAA,EACA,UAAU;AAAA,EACV;AACD;AAEA,MAAM,kBAAkB;AAAA,EACvB,KAAK;AAAA,EACL,SAAS;AAAA,EACT,OAAO;AAAA,EACP,MAAM;AACP;AAIO,MAAM,iBAAiB,CAAyB,eAA0D,KAAsB,oBAA2D;AAC3L,QAAA,UAAU,QAAQ,MAAM;AAC7B,WAAO,gBAAgB,aAAa;AAAA,EAAA,GAClC,CAAC,aAAa,CAAC;AAElB,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAY,MAAM;AACrCA,UAAAA,SAAQ,QAAQ,QAAQ,GAAG;AACjC,WAAO,gBAAgBA,MAAU;AAAA,EAAA,CACjC;AACM,SAAA;AAAA,IACN;AAAA,IACA,YAAY,CAAAA,WAAS;AACpB,eAAS,CAAW,YAAA;AACnB,cAAM,WAAW,OAAOA,WAAU,aAAcA,OAA4B,OAAO,IAAIA;AAC/E,gBAAA,QAAQ,KAAK,QAAQ;AACtB,eAAA;AAAA,MAAA,CACP;AAAA,IAAA,GACC,CAAC,KAAK,OAAO,CAAC;AAAA,EAAA;AAEnB;AAEa,MAAA,yBAAyB,CAAyB,KAAsB,oBAA2D;AACxI,SAAA,eAAkB,qBAAqB,KAAK,eAAe;AACnE;AAEa,MAAA,uBAAuB,CAAyB,KAAsB,oBAA2D;AACtI,SAAA,eAAkB,mBAAmB,KAAK,eAAe;AACjE;AAEa,MAAA,kBAAkB,CAAC,kBAA6D;AACxF,MAAA,MAAM,QAAQ,aAAa,GAAG;AAC1B,WAAA,sBAAsB,cAAc,IAAI,CAAM,OAAA,OAAO,OAAO,WAAW,gBAAgB,EAAE,IAAI,EAAE,CAAC;AAAA,EACxG;AACA,SAAO,OAAO,kBAAkB,WAAW,gBAAgB,aAAa,IAAI;AAC7E;AAGA,MAAM,wBAAwB,CAAC,iBAA+C;AACtE,SAAA;AAAA,IACN,QAAQ,KAAK;AACZ,iBAAW,WAAW,cAAc;AAC7B,cAAA,QAAQ,QAAQ,QAAQ,GAAG;AACjC,YAAI,UAAU,MAAM;AACZ,iBAAA;AAAA,QACR;AAAA,MACD;AACO,aAAA;AAAA,IACR;AAAA,IACA,QAAQ,KAAK,OAAO;AACnB,iBAAW,WAAW,cAAc;AAC3B,gBAAA,QAAQ,KAAK,KAAK;AAAA,MAC3B;AAAA,IACD;AAAA,EAAA;AAEF;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useUpdatedRef.cjs","sources":["../../../src/hooks/useUpdatedRef.ts"],"sourcesContent":["import { useRef } from 'react'\n\n/**\n * Returns a stable mutable object with value that is updated upon each call\n *\n * @param value - Value that could update after initial call\n * @returns Mutable ref object with updated value\n */\nexport function useUpdatedRef<T>(value: T) {\n\tconst ref = useRef(value)\n\tref.current = value\n\n\treturn ref\n}\n"],"names":["useRef"],"mappings":";;;AAQO,SAAS,cAAiB,OAAU;AACpC,QAAA,MAAMA,aAAO,KAAK;AACxB,MAAI,UAAU;AAEP,SAAA;AACR;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useUpdatedRef.js","sources":["../../../src/hooks/useUpdatedRef.ts"],"sourcesContent":["import { useRef } from 'react'\n\n/**\n * Returns a stable mutable object with value that is updated upon each call\n *\n * @param value - Value that could update after initial call\n * @returns Mutable ref object with updated value\n */\nexport function useUpdatedRef<T>(value: T) {\n\tconst ref = useRef(value)\n\tref.current = value\n\n\treturn ref\n}\n"],"names":[],"mappings":";AAQO,SAAS,cAAiB,OAAU;AACpC,QAAA,MAAM,OAAO,KAAK;AACxB,MAAI,UAAU;AAEP,SAAA;AACR;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useWindowSize.cjs","sources":["../../../src/hooks/useWindowSize.ts"],"sourcesContent":["import { useMemo, useState } from 'react'\nimport { useOnWindowResize } from './useOnWindowResize'\n\nexport function useWindowSize() {\n const [width, setWidth] = useState(window.innerWidth)\n const [height, setHeight] = useState(window.innerHeight)\n\n useOnWindowResize(() => {\n const { innerHeight, innerWidth } = window\n if (innerHeight !== height) {\n setHeight(innerHeight)\n }\n\n if (innerWidth !== width) {\n setWidth(innerWidth)\n }\n })\n\n return useMemo(() => ({ height, width }), [height, width])\n}\n"],"names":["useState","useOnWindowResize","useMemo"],"mappings":";;;;AAGO,SAAS,gBAAgB;AAC9B,QAAM,CAAC,OAAO,QAAQ,IAAIA,MAAAA,SAAS,OAAO,UAAU;AACpD,QAAM,CAAC,QAAQ,SAAS,IAAIA,MAAAA,SAAS,OAAO,WAAW;AAEvDC,oBAAAA,kBAAkB,MAAM;AAChB,UAAA,EAAE,aAAa,WAAe,IAAA;AACpC,QAAI,gBAAgB,QAAQ;AAC1B,gBAAU,WAAW;AAAA,IACvB;AAEA,QAAI,eAAe,OAAO;AACxB,eAAS,UAAU;AAAA,IACrB;AAAA,EAAA,CACD;AAEM,SAAAC,MAAA,QAAQ,OAAO,EAAE,QAAQ,MAAU,IAAA,CAAC,QAAQ,KAAK,CAAC;AAC3D;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useWindowSize.js","sources":["../../../src/hooks/useWindowSize.ts"],"sourcesContent":["import { useMemo, useState } from 'react'\nimport { useOnWindowResize } from './useOnWindowResize'\n\nexport function useWindowSize() {\n const [width, setWidth] = useState(window.innerWidth)\n const [height, setHeight] = useState(window.innerHeight)\n\n useOnWindowResize(() => {\n const { innerHeight, innerWidth } = window\n if (innerHeight !== height) {\n setHeight(innerHeight)\n }\n\n if (innerWidth !== width) {\n setWidth(innerWidth)\n }\n })\n\n return useMemo(() => ({ height, width }), [height, width])\n}\n"],"names":[],"mappings":";;AAGO,SAAS,gBAAgB;AAC9B,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,OAAO,UAAU;AACpD,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,OAAO,WAAW;AAEvD,oBAAkB,MAAM;AAChB,UAAA,EAAE,aAAa,WAAe,IAAA;AACpC,QAAI,gBAAgB,QAAQ;AAC1B,gBAAU,WAAW;AAAA,IACvB;AAEA,QAAI,eAAe,OAAO;AACxB,eAAS,UAAU;AAAA,IACrB;AAAA,EAAA,CACD;AAEM,SAAA,QAAQ,OAAO,EAAE,QAAQ,MAAU,IAAA,CAAC,QAAQ,KAAK,CAAC;AAC3D;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"emptyArray.cjs","sources":["../../../src/referentiallyStable/emptyArray.ts"],"sourcesContent":["export const emptyArray = Object.freeze<any>([]) as any[]\n"],"names":[],"mappings":";;AAAO,MAAM,aAAa,OAAO,OAAY,CAAE,CAAA;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"emptyArray.js","sources":["../../../src/referentiallyStable/emptyArray.ts"],"sourcesContent":["export const emptyArray = Object.freeze<any>([]) as any[]\n"],"names":[],"mappings":"AAAO,MAAM,aAAa,OAAO,OAAY,CAAE,CAAA;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"emptyObject.cjs","sources":["../../../src/referentiallyStable/emptyObject.ts"],"sourcesContent":["export const emptyObject = Object.freeze({})\n"],"names":[],"mappings":";;AAAO,MAAM,cAAc,OAAO,OAAO,CAAE,CAAA;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"emptyObject.js","sources":["../../../src/referentiallyStable/emptyObject.ts"],"sourcesContent":["export const emptyObject = Object.freeze({})\n"],"names":[],"mappings":"AAAO,MAAM,cAAc,OAAO,OAAO,CAAE,CAAA;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"identityFunction.cjs","sources":["../../../src/referentiallyStable/identityFunction.ts"],"sourcesContent":["export const identityFunction = <Value>(value: Value) => value\n"],"names":[],"mappings":";;AAAa,MAAA,mBAAmB,CAAQ,UAAiB;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"identityFunction.js","sources":["../../../src/referentiallyStable/identityFunction.ts"],"sourcesContent":["export const identityFunction = <Value>(value: Value) => value\n"],"names":[],"mappings":"AAAa,MAAA,mBAAmB,CAAQ,UAAiB;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"noop.cjs","sources":["../../../src/referentiallyStable/noop.ts"],"sourcesContent":["export const noop = () => undefined\n"],"names":[],"mappings":";;AAAO,MAAM,OAAO,MAAM;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"noop.js","sources":["../../../src/referentiallyStable/noop.ts"],"sourcesContent":["export const noop = () => undefined\n"],"names":[],"mappings":"AAAO,MAAM,OAAO,MAAM;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"returnFalse.cjs","sources":["../../../src/referentiallyStable/returnFalse.ts"],"sourcesContent":["export const returnFalse = () => false\n"],"names":[],"mappings":";;AAAO,MAAM,cAAc,MAAM;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"returnFalse.js","sources":["../../../src/referentiallyStable/returnFalse.ts"],"sourcesContent":["export const returnFalse = () => false\n"],"names":[],"mappings":"AAAO,MAAM,cAAc,MAAM;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"returnTrue.cjs","sources":["../../../src/referentiallyStable/returnTrue.ts"],"sourcesContent":["export const returnTrue = () => true\n"],"names":[],"mappings":";;AAAO,MAAM,aAAa,MAAM;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"returnTrue.js","sources":["../../../src/referentiallyStable/returnTrue.ts"],"sourcesContent":["export const returnTrue = () => true\n"],"names":[],"mappings":"AAAO,MAAM,aAAa,MAAM;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useReferentiallyStableCallback.cjs","sources":["../../../src/referentiallyStable/useReferentiallyStableCallback.ts"],"sourcesContent":["import { useCallback, useRef } from 'react'\n\n// TODO: Should be possible to remove when React.useEvent() lands\nexport const useReferentiallyStableCallback = <T extends (...args: any[]) => any>(callback: T): T => {\n\tconst ref = useRef(callback)\n\tref.current = callback\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\treturn useCallback<T>(((...args: any[]) => {\n\t\treturn ref.current(...args)\n\t}) as T, [])\n}\n"],"names":["useRef","useCallback"],"mappings":";;;AAGa,MAAA,iCAAiC,CAAoC,aAAmB;AAC9F,QAAA,MAAMA,aAAO,QAAQ;AAC3B,MAAI,UAAU;AAEP,SAAAC,MAAA,YAAgB,IAAI,SAAgB;AACnC,WAAA,IAAI,QAAQ,GAAG,IAAI;AAAA,EAC3B,GAAS,CAAE,CAAA;AACZ;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useReferentiallyStableCallback.js","sources":["../../../src/referentiallyStable/useReferentiallyStableCallback.ts"],"sourcesContent":["import { useCallback, useRef } from 'react'\n\n// TODO: Should be possible to remove when React.useEvent() lands\nexport const useReferentiallyStableCallback = <T extends (...args: any[]) => any>(callback: T): T => {\n\tconst ref = useRef(callback)\n\tref.current = callback\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\treturn useCallback<T>(((...args: any[]) => {\n\t\treturn ref.current(...args)\n\t}) as T, [])\n}\n"],"names":[],"mappings":";AAGa,MAAA,iCAAiC,CAAoC,aAAmB;AAC9F,QAAA,MAAM,OAAO,QAAQ;AAC3B,MAAI,UAAU;AAEP,SAAA,YAAgB,IAAI,SAAgB;AACnC,WAAA,IAAI,QAAQ,GAAG,IAAI;AAAA,EAC3B,GAAS,CAAE,CAAA;AACZ;"}
@@ -1,16 +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 contexts = require("./contexts.cjs");
6
- const ColorSchemeProvider = react.memo(({ children, scheme }) => {
7
- const inheritedColorScheme = contexts.useColorScheme();
8
- return /* @__PURE__ */ jsxDevRuntime.jsxDEV(contexts.ColorSchemeContext.Provider, { value: scheme ?? inheritedColorScheme, children }, void 0, false, {
9
- fileName: "/__w/interface/interface/packages/react-utils/src/theming/ColorSchemeProvider.tsx",
10
- lineNumber: 13,
11
- columnNumber: 3
12
- }, void 0);
13
- });
14
- ColorSchemeProvider.displayName = "Interface.ColorSchemeProvider";
15
- exports.ColorSchemeProvider = ColorSchemeProvider;
16
- //# sourceMappingURL=ColorSchemeProvider.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ColorSchemeProvider.cjs","sources":["../../../src/theming/ColorSchemeProvider.tsx"],"sourcesContent":["import { memo } from 'react'\nimport { ColorSchemeContext, useColorScheme } from './contexts'\n\nexport type ColorSchemeProviderProps = {\n\tchildren: React.ReactNode\n\tscheme?: string\n}\n\nexport const ColorSchemeProvider = memo(({ children, scheme }: ColorSchemeProviderProps) => {\n\tconst inheritedColorScheme = useColorScheme()\n\n\treturn (\n\t\t<ColorSchemeContext.Provider value={scheme ?? inheritedColorScheme}>{children}</ColorSchemeContext.Provider>\n\t)\n})\nColorSchemeProvider.displayName = 'Interface.ColorSchemeProvider'\n"],"names":["memo","useColorScheme","ColorSchemeContext","this"],"mappings":";;;;;AAQO,MAAM,sBAAsBA,MAAAA,KAAK,CAAC,EAAE,UAAU,aAAuC;AAC3F,QAAM,uBAAuBC,SAAAA;AAE7B,8CACEC,SAAAA,mBAAmB,UAAnB,EAA4B,OAAO,UAAU,sBAAuB,SAArE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAA8E,GAAAC,MAAA;AAEhF,CAAC;AACD,oBAAoB,cAAc;;"}
@@ -1,16 +0,0 @@
1
- import { jsxDEV } from "react/jsx-dev-runtime";
2
- import { memo } from "react";
3
- import { useColorScheme, ColorSchemeContext } from "./contexts.js";
4
- const ColorSchemeProvider = memo(({ children, scheme }) => {
5
- const inheritedColorScheme = useColorScheme();
6
- return /* @__PURE__ */ jsxDEV(ColorSchemeContext.Provider, { value: scheme ?? inheritedColorScheme, children }, void 0, false, {
7
- fileName: "/__w/interface/interface/packages/react-utils/src/theming/ColorSchemeProvider.tsx",
8
- lineNumber: 13,
9
- columnNumber: 3
10
- }, void 0);
11
- });
12
- ColorSchemeProvider.displayName = "Interface.ColorSchemeProvider";
13
- export {
14
- ColorSchemeProvider
15
- };
16
- //# sourceMappingURL=ColorSchemeProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ColorSchemeProvider.js","sources":["../../../src/theming/ColorSchemeProvider.tsx"],"sourcesContent":["import { memo } from 'react'\nimport { ColorSchemeContext, useColorScheme } from './contexts'\n\nexport type ColorSchemeProviderProps = {\n\tchildren: React.ReactNode\n\tscheme?: string\n}\n\nexport const ColorSchemeProvider = memo(({ children, scheme }: ColorSchemeProviderProps) => {\n\tconst inheritedColorScheme = useColorScheme()\n\n\treturn (\n\t\t<ColorSchemeContext.Provider value={scheme ?? inheritedColorScheme}>{children}</ColorSchemeContext.Provider>\n\t)\n})\nColorSchemeProvider.displayName = 'Interface.ColorSchemeProvider'\n"],"names":["this"],"mappings":";;;AAQO,MAAM,sBAAsB,KAAK,CAAC,EAAE,UAAU,aAAuC;AAC3F,QAAM,uBAAuB;AAE7B,gCACE,mBAAmB,UAAnB,EAA4B,OAAO,UAAU,sBAAuB,SAArE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAA8E,GAAAA,MAAA;AAEhF,CAAC;AACD,oBAAoB,cAAc;"}
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const react = require("react");
4
- const GlobalClassNamePrefixContext = react.createContext("cui-");
5
- exports.GlobalClassNamePrefixContext = GlobalClassNamePrefixContext;
6
- //# sourceMappingURL=GlobalClassNamePrefixContext.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GlobalClassNamePrefixContext.cjs","sources":["../../../src/theming/GlobalClassNamePrefixContext.ts"],"sourcesContent":["import { createContext } from 'react'\n\nexport const GlobalClassNamePrefixContext = createContext<string>('cui-')\n"],"names":["createContext"],"mappings":";;;AAEa,MAAA,+BAA+BA,oBAAsB,MAAM;;"}
@@ -1,6 +0,0 @@
1
- import { createContext } from "react";
2
- const GlobalClassNamePrefixContext = createContext("cui-");
3
- export {
4
- GlobalClassNamePrefixContext
5
- };
6
- //# sourceMappingURL=GlobalClassNamePrefixContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GlobalClassNamePrefixContext.js","sources":["../../../src/theming/GlobalClassNamePrefixContext.ts"],"sourcesContent":["import { createContext } from 'react'\n\nexport const GlobalClassNamePrefixContext = createContext<string>('cui-')\n"],"names":[],"mappings":";AAEa,MAAA,+BAA+B,cAAsB,MAAM;"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const createContext = require("../context/createContext.cjs");
4
- const DEFAULT_COLOR_SCHEME = "system";
5
- const [ColorSchemeContext, useColorScheme] = createContext.createContext(
6
- "Interface.ColorScheme",
7
- DEFAULT_COLOR_SCHEME
8
- );
9
- exports.ColorSchemeContext = ColorSchemeContext;
10
- exports.DEFAULT_COLOR_SCHEME = DEFAULT_COLOR_SCHEME;
11
- exports.useColorScheme = useColorScheme;
12
- //# sourceMappingURL=contexts.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contexts.cjs","sources":["../../../src/theming/contexts.ts"],"sourcesContent":["import { createContext } from '../context'\n\nexport const DEFAULT_COLOR_SCHEME = 'system'\n\n\n/**\n * @group UI\n *\n * @description\n * Provides the current color scheme, possible values are `'light'`, `'dark'` or `'system'`.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\n *\n */\nexport const [ColorSchemeContext, useColorScheme] = createContext<string>(\n\t'Interface.ColorScheme',\n\tDEFAULT_COLOR_SCHEME,\n)\n"],"names":["createContext"],"mappings":";;;AAEO,MAAM,uBAAuB;AAYvB,MAAA,CAAC,oBAAoB,cAAc,IAAIA,cAAA;AAAA,EACnD;AAAA,EACA;AACD;;;;"}
@@ -1,12 +0,0 @@
1
- import { createContext } from "../context/createContext.js";
2
- const DEFAULT_COLOR_SCHEME = "system";
3
- const [ColorSchemeContext, useColorScheme] = createContext(
4
- "Interface.ColorScheme",
5
- DEFAULT_COLOR_SCHEME
6
- );
7
- export {
8
- ColorSchemeContext,
9
- DEFAULT_COLOR_SCHEME,
10
- useColorScheme
11
- };
12
- //# sourceMappingURL=contexts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contexts.js","sources":["../../../src/theming/contexts.ts"],"sourcesContent":["import { createContext } from '../context'\n\nexport const DEFAULT_COLOR_SCHEME = 'system'\n\n\n/**\n * @group UI\n *\n * @description\n * Provides the current color scheme, possible values are `'light'`, `'dark'` or `'system'`.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\n *\n */\nexport const [ColorSchemeContext, useColorScheme] = createContext<string>(\n\t'Interface.ColorScheme',\n\tDEFAULT_COLOR_SCHEME,\n)\n"],"names":[],"mappings":";AAEO,MAAM,uBAAuB;AAYvB,MAAA,CAAC,oBAAoB,cAAc,IAAI;AAAA,EACnD;AAAA,EACA;AACD;"}