@react-aria/utils 3.33.0 → 3.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/dist/import.mjs +47 -43
  2. package/dist/main.js +120 -114
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +47 -43
  5. package/dist/module.js.map +1 -1
  6. package/dist/types/src/index.d.ts +45 -0
  7. package/package.json +15 -15
  8. package/src/index.ts +45 -43
  9. package/dist/DOMFunctions.main.js +0 -44
  10. package/dist/DOMFunctions.main.js.map +0 -1
  11. package/dist/DOMFunctions.mjs +0 -37
  12. package/dist/DOMFunctions.module.js +0 -37
  13. package/dist/DOMFunctions.module.js.map +0 -1
  14. package/dist/ShadowTreeWalker.main.js +0 -200
  15. package/dist/ShadowTreeWalker.main.js.map +0 -1
  16. package/dist/ShadowTreeWalker.mjs +0 -194
  17. package/dist/ShadowTreeWalker.module.js +0 -194
  18. package/dist/ShadowTreeWalker.module.js.map +0 -1
  19. package/dist/animation.main.js +0 -97
  20. package/dist/animation.main.js.map +0 -1
  21. package/dist/animation.mjs +0 -91
  22. package/dist/animation.module.js +0 -91
  23. package/dist/animation.module.js.map +0 -1
  24. package/dist/chain.main.js +0 -26
  25. package/dist/chain.main.js.map +0 -1
  26. package/dist/chain.mjs +0 -21
  27. package/dist/chain.module.js +0 -21
  28. package/dist/chain.module.js.map +0 -1
  29. package/dist/constants.main.js +0 -23
  30. package/dist/constants.main.js.map +0 -1
  31. package/dist/constants.mjs +0 -17
  32. package/dist/constants.module.js +0 -17
  33. package/dist/constants.module.js.map +0 -1
  34. package/dist/domHelpers.main.js +0 -28
  35. package/dist/domHelpers.main.js.map +0 -1
  36. package/dist/domHelpers.mjs +0 -21
  37. package/dist/domHelpers.module.js +0 -21
  38. package/dist/domHelpers.module.js.map +0 -1
  39. package/dist/filterDOMProps.main.js +0 -88
  40. package/dist/filterDOMProps.main.js.map +0 -1
  41. package/dist/filterDOMProps.mjs +0 -83
  42. package/dist/filterDOMProps.module.js +0 -83
  43. package/dist/filterDOMProps.module.js.map +0 -1
  44. package/dist/focusWithoutScrolling.main.js +0 -72
  45. package/dist/focusWithoutScrolling.main.js.map +0 -1
  46. package/dist/focusWithoutScrolling.mjs +0 -67
  47. package/dist/focusWithoutScrolling.module.js +0 -67
  48. package/dist/focusWithoutScrolling.module.js.map +0 -1
  49. package/dist/getOffset.main.js +0 -24
  50. package/dist/getOffset.main.js.map +0 -1
  51. package/dist/getOffset.mjs +0 -19
  52. package/dist/getOffset.module.js +0 -19
  53. package/dist/getOffset.module.js.map +0 -1
  54. package/dist/getScrollParent.main.js +0 -28
  55. package/dist/getScrollParent.main.js.map +0 -1
  56. package/dist/getScrollParent.mjs +0 -23
  57. package/dist/getScrollParent.module.js +0 -23
  58. package/dist/getScrollParent.module.js.map +0 -1
  59. package/dist/getScrollParents.main.js +0 -30
  60. package/dist/getScrollParents.main.js.map +0 -1
  61. package/dist/getScrollParents.mjs +0 -25
  62. package/dist/getScrollParents.module.js +0 -25
  63. package/dist/getScrollParents.module.js.map +0 -1
  64. package/dist/inertValue.main.js +0 -19
  65. package/dist/inertValue.main.js.map +0 -1
  66. package/dist/inertValue.mjs +0 -14
  67. package/dist/inertValue.module.js +0 -14
  68. package/dist/inertValue.module.js.map +0 -1
  69. package/dist/isElementVisible.main.js +0 -45
  70. package/dist/isElementVisible.main.js.map +0 -1
  71. package/dist/isElementVisible.mjs +0 -40
  72. package/dist/isElementVisible.module.js +0 -40
  73. package/dist/isElementVisible.module.js.map +0 -1
  74. package/dist/isFocusable.main.js +0 -56
  75. package/dist/isFocusable.main.js.map +0 -1
  76. package/dist/isFocusable.mjs +0 -50
  77. package/dist/isFocusable.module.js +0 -50
  78. package/dist/isFocusable.module.js.map +0 -1
  79. package/dist/isScrollable.main.js +0 -26
  80. package/dist/isScrollable.main.js.map +0 -1
  81. package/dist/isScrollable.mjs +0 -21
  82. package/dist/isScrollable.module.js +0 -21
  83. package/dist/isScrollable.module.js.map +0 -1
  84. package/dist/isVirtualEvent.main.js +0 -41
  85. package/dist/isVirtualEvent.main.js.map +0 -1
  86. package/dist/isVirtualEvent.mjs +0 -35
  87. package/dist/isVirtualEvent.module.js +0 -35
  88. package/dist/isVirtualEvent.module.js.map +0 -1
  89. package/dist/keyboard.main.js +0 -42
  90. package/dist/keyboard.main.js.map +0 -1
  91. package/dist/keyboard.mjs +0 -36
  92. package/dist/keyboard.module.js +0 -36
  93. package/dist/keyboard.module.js.map +0 -1
  94. package/dist/mergeProps.main.js +0 -54
  95. package/dist/mergeProps.main.js.map +0 -1
  96. package/dist/mergeProps.mjs +0 -45
  97. package/dist/mergeProps.module.js +0 -45
  98. package/dist/mergeProps.module.js.map +0 -1
  99. package/dist/mergeRefs.main.js +0 -40
  100. package/dist/mergeRefs.main.js.map +0 -1
  101. package/dist/mergeRefs.mjs +0 -35
  102. package/dist/mergeRefs.module.js +0 -35
  103. package/dist/mergeRefs.module.js.map +0 -1
  104. package/dist/openLink.main.js +0 -169
  105. package/dist/openLink.main.js.map +0 -1
  106. package/dist/openLink.mjs +0 -153
  107. package/dist/openLink.module.js +0 -153
  108. package/dist/openLink.module.js.map +0 -1
  109. package/dist/platform.main.js +0 -73
  110. package/dist/platform.main.js.map +0 -1
  111. package/dist/platform.mjs +0 -60
  112. package/dist/platform.module.js +0 -60
  113. package/dist/platform.module.js.map +0 -1
  114. package/dist/runAfterTransition.main.js +0 -92
  115. package/dist/runAfterTransition.main.js.map +0 -1
  116. package/dist/runAfterTransition.mjs +0 -87
  117. package/dist/runAfterTransition.module.js +0 -87
  118. package/dist/runAfterTransition.module.js.map +0 -1
  119. package/dist/scrollIntoView.main.js +0 -105
  120. package/dist/scrollIntoView.main.js.map +0 -1
  121. package/dist/scrollIntoView.mjs +0 -99
  122. package/dist/scrollIntoView.module.js +0 -99
  123. package/dist/scrollIntoView.module.js.map +0 -1
  124. package/dist/types.d.ts +0 -286
  125. package/dist/types.d.ts.map +0 -1
  126. package/dist/useDeepMemo.main.js +0 -30
  127. package/dist/useDeepMemo.main.js.map +0 -1
  128. package/dist/useDeepMemo.mjs +0 -25
  129. package/dist/useDeepMemo.module.js +0 -25
  130. package/dist/useDeepMemo.module.js.map +0 -1
  131. package/dist/useDescription.main.js +0 -59
  132. package/dist/useDescription.main.js.map +0 -1
  133. package/dist/useDescription.mjs +0 -54
  134. package/dist/useDescription.module.js +0 -54
  135. package/dist/useDescription.module.js.map +0 -1
  136. package/dist/useDrag1D.main.js +0 -141
  137. package/dist/useDrag1D.main.js.map +0 -1
  138. package/dist/useDrag1D.mjs +0 -136
  139. package/dist/useDrag1D.module.js +0 -136
  140. package/dist/useDrag1D.module.js.map +0 -1
  141. package/dist/useEffectEvent.main.js +0 -45
  142. package/dist/useEffectEvent.main.js.map +0 -1
  143. package/dist/useEffectEvent.mjs +0 -36
  144. package/dist/useEffectEvent.module.js +0 -36
  145. package/dist/useEffectEvent.module.js.map +0 -1
  146. package/dist/useEvent.main.js +0 -41
  147. package/dist/useEvent.main.js.map +0 -1
  148. package/dist/useEvent.mjs +0 -36
  149. package/dist/useEvent.module.js +0 -36
  150. package/dist/useEvent.module.js.map +0 -1
  151. package/dist/useFormReset.main.js +0 -39
  152. package/dist/useFormReset.main.js.map +0 -1
  153. package/dist/useFormReset.mjs +0 -34
  154. package/dist/useFormReset.module.js +0 -34
  155. package/dist/useFormReset.module.js.map +0 -1
  156. package/dist/useGlobalListeners.main.js +0 -62
  157. package/dist/useGlobalListeners.main.js.map +0 -1
  158. package/dist/useGlobalListeners.mjs +0 -57
  159. package/dist/useGlobalListeners.module.js +0 -57
  160. package/dist/useGlobalListeners.module.js.map +0 -1
  161. package/dist/useId.main.js +0 -108
  162. package/dist/useId.main.js.map +0 -1
  163. package/dist/useId.mjs +0 -101
  164. package/dist/useId.module.js +0 -101
  165. package/dist/useId.module.js.map +0 -1
  166. package/dist/useLabels.main.js +0 -44
  167. package/dist/useLabels.main.js.map +0 -1
  168. package/dist/useLabels.mjs +0 -39
  169. package/dist/useLabels.module.js +0 -39
  170. package/dist/useLabels.module.js.map +0 -1
  171. package/dist/useLayoutEffect.main.js +0 -27
  172. package/dist/useLayoutEffect.main.js.map +0 -1
  173. package/dist/useLayoutEffect.mjs +0 -18
  174. package/dist/useLayoutEffect.module.js +0 -18
  175. package/dist/useLayoutEffect.module.js.map +0 -1
  176. package/dist/useLoadMore.main.js +0 -73
  177. package/dist/useLoadMore.main.js.map +0 -1
  178. package/dist/useLoadMore.mjs +0 -68
  179. package/dist/useLoadMore.module.js +0 -68
  180. package/dist/useLoadMore.module.js.map +0 -1
  181. package/dist/useLoadMoreSentinel.main.js +0 -58
  182. package/dist/useLoadMoreSentinel.main.js.map +0 -1
  183. package/dist/useLoadMoreSentinel.mjs +0 -53
  184. package/dist/useLoadMoreSentinel.module.js +0 -53
  185. package/dist/useLoadMoreSentinel.module.js.map +0 -1
  186. package/dist/useObjectRef.main.js +0 -58
  187. package/dist/useObjectRef.main.js.map +0 -1
  188. package/dist/useObjectRef.mjs +0 -53
  189. package/dist/useObjectRef.module.js +0 -53
  190. package/dist/useObjectRef.module.js.map +0 -1
  191. package/dist/useResizeObserver.main.js +0 -47
  192. package/dist/useResizeObserver.main.js.map +0 -1
  193. package/dist/useResizeObserver.mjs +0 -42
  194. package/dist/useResizeObserver.module.js +0 -42
  195. package/dist/useResizeObserver.module.js.map +0 -1
  196. package/dist/useSyncRef.main.js +0 -32
  197. package/dist/useSyncRef.main.js.map +0 -1
  198. package/dist/useSyncRef.mjs +0 -27
  199. package/dist/useSyncRef.module.js +0 -27
  200. package/dist/useSyncRef.module.js.map +0 -1
  201. package/dist/useUpdateEffect.main.js +0 -42
  202. package/dist/useUpdateEffect.main.js.map +0 -1
  203. package/dist/useUpdateEffect.mjs +0 -37
  204. package/dist/useUpdateEffect.module.js +0 -37
  205. package/dist/useUpdateEffect.module.js.map +0 -1
  206. package/dist/useUpdateLayoutEffect.main.js +0 -40
  207. package/dist/useUpdateLayoutEffect.main.js.map +0 -1
  208. package/dist/useUpdateLayoutEffect.mjs +0 -35
  209. package/dist/useUpdateLayoutEffect.module.js +0 -35
  210. package/dist/useUpdateLayoutEffect.module.js.map +0 -1
  211. package/dist/useValueEffect.main.js +0 -63
  212. package/dist/useValueEffect.main.js.map +0 -1
  213. package/dist/useValueEffect.mjs +0 -58
  214. package/dist/useValueEffect.module.js +0 -58
  215. package/dist/useValueEffect.module.js.map +0 -1
  216. package/dist/useViewportSize.main.js +0 -79
  217. package/dist/useViewportSize.main.js.map +0 -1
  218. package/dist/useViewportSize.mjs +0 -74
  219. package/dist/useViewportSize.module.js +0 -74
  220. package/dist/useViewportSize.module.js.map +0 -1
  221. package/src/animation.ts +0 -103
  222. package/src/chain.ts +0 -24
  223. package/src/constants.ts +0 -15
  224. package/src/domHelpers.ts +0 -33
  225. package/src/filterDOMProps.ts +0 -127
  226. package/src/focusWithoutScrolling.ts +0 -96
  227. package/src/getOffset.ts +0 -21
  228. package/src/getScrollParent.ts +0 -27
  229. package/src/getScrollParents.ts +0 -26
  230. package/src/inertValue.ts +0 -11
  231. package/src/isElementVisible.ts +0 -75
  232. package/src/isFocusable.ts +0 -56
  233. package/src/isScrollable.ts +0 -25
  234. package/src/isVirtualEvent.ts +0 -58
  235. package/src/keyboard.tsx +0 -48
  236. package/src/mergeProps.ts +0 -77
  237. package/src/mergeRefs.ts +0 -52
  238. package/src/openLink.tsx +0 -201
  239. package/src/platform.ts +0 -78
  240. package/src/runAfterTransition.ts +0 -121
  241. package/src/scrollIntoView.ts +0 -129
  242. package/src/shadowdom/DOMFunctions.ts +0 -71
  243. package/src/shadowdom/ShadowTreeWalker.ts +0 -319
  244. package/src/useDeepMemo.ts +0 -27
  245. package/src/useDescription.ts +0 -56
  246. package/src/useDrag1D.ts +0 -191
  247. package/src/useEffectEvent.ts +0 -30
  248. package/src/useEvent.ts +0 -37
  249. package/src/useFormReset.ts +0 -36
  250. package/src/useGlobalListeners.ts +0 -52
  251. package/src/useId.ts +0 -129
  252. package/src/useLabels.ts +0 -48
  253. package/src/useLayoutEffect.ts +0 -20
  254. package/src/useLoadMore.ts +0 -82
  255. package/src/useLoadMoreSentinel.ts +0 -63
  256. package/src/useObjectRef.ts +0 -69
  257. package/src/useResizeObserver.ts +0 -52
  258. package/src/useSyncRef.ts +0 -33
  259. package/src/useUpdateEffect.ts +0 -39
  260. package/src/useUpdateLayoutEffect.ts +0 -37
  261. package/src/useValueEffect.ts +0 -68
  262. package/src/useViewportSize.ts +0 -96
@@ -1,42 +0,0 @@
1
- import {useEffectEvent as $8ae05eaa5c114e9c$export$7f54fc3180508a52} from "./useEffectEvent.module.js";
2
- import {useEffect as $Vsl8o$useEffect} from "react";
3
-
4
-
5
-
6
- function $9daab02d461809db$var$hasResizeObserver() {
7
- return typeof window.ResizeObserver !== 'undefined';
8
- }
9
- function $9daab02d461809db$export$683480f191c0e3ea(options) {
10
- // Only call onResize from inside the effect, otherwise we'll void our assumption that
11
- // useEffectEvents are safe to pass in.
12
- const { ref: ref, box: box, onResize: onResize } = options;
13
- let onResizeEvent = (0, $8ae05eaa5c114e9c$export$7f54fc3180508a52)(onResize);
14
- (0, $Vsl8o$useEffect)(()=>{
15
- let element = ref === null || ref === void 0 ? void 0 : ref.current;
16
- if (!element) return;
17
- if (!$9daab02d461809db$var$hasResizeObserver()) {
18
- window.addEventListener('resize', onResizeEvent, false);
19
- return ()=>{
20
- window.removeEventListener('resize', onResizeEvent, false);
21
- };
22
- } else {
23
- const resizeObserverInstance = new window.ResizeObserver((entries)=>{
24
- if (!entries.length) return;
25
- onResizeEvent();
26
- });
27
- resizeObserverInstance.observe(element, {
28
- box: box
29
- });
30
- return ()=>{
31
- if (element) resizeObserverInstance.unobserve(element);
32
- };
33
- }
34
- }, [
35
- ref,
36
- box
37
- ]);
38
- }
39
-
40
-
41
- export {$9daab02d461809db$export$683480f191c0e3ea as useResizeObserver};
42
- //# sourceMappingURL=useResizeObserver.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;AAKA,SAAS;IACP,OAAO,OAAO,OAAO,cAAc,KAAK;AAC1C;AAQO,SAAS,0CAAqC,OAAwC;IAC3F,sFAAsF;IACtF,uCAAuC;IACvC,MAAM,OAAC,GAAG,OAAE,GAAG,YAAE,QAAQ,EAAC,GAAG;IAC7B,IAAI,gBAAgB,CAAA,GAAA,yCAAa,EAAE;IAEnC,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,UAAU,gBAAA,0BAAA,IAAK,OAAO;QAC1B,IAAI,CAAC,SACH;QAGF,IAAI,CAAC,2CAAqB;YACxB,OAAO,gBAAgB,CAAC,UAAU,eAAe;YACjD,OAAO;gBACL,OAAO,mBAAmB,CAAC,UAAU,eAAe;YACtD;QACF,OAAO;YAEL,MAAM,yBAAyB,IAAI,OAAO,cAAc,CAAC,CAAC;gBACxD,IAAI,CAAC,QAAQ,MAAM,EACjB;gBAGF;YACF;YACA,uBAAuB,OAAO,CAAC,SAAS;qBAAC;YAAG;YAE5C,OAAO;gBACL,IAAI,SACF,uBAAuB,SAAS,CAAC;YAErC;QACF;IAEF,GAAG;QAAC;QAAK;KAAI;AACf","sources":["packages/@react-aria/utils/src/useResizeObserver.ts"],"sourcesContent":["\nimport {RefObject} from '@react-types/shared';\nimport {useEffect} from 'react';\nimport {useEffectEvent} from './useEffectEvent';\n\nfunction hasResizeObserver() {\n return typeof window.ResizeObserver !== 'undefined';\n}\n\ntype useResizeObserverOptionsType<T> = {\n ref: RefObject<T | undefined | null> | undefined,\n box?: ResizeObserverBoxOptions,\n onResize: () => void\n}\n\nexport function useResizeObserver<T extends Element>(options: useResizeObserverOptionsType<T>): void {\n // Only call onResize from inside the effect, otherwise we'll void our assumption that\n // useEffectEvents are safe to pass in.\n const {ref, box, onResize} = options;\n let onResizeEvent = useEffectEvent(onResize);\n\n useEffect(() => {\n let element = ref?.current;\n if (!element) {\n return;\n }\n\n if (!hasResizeObserver()) {\n window.addEventListener('resize', onResizeEvent, false);\n return () => {\n window.removeEventListener('resize', onResizeEvent, false);\n };\n } else {\n\n const resizeObserverInstance = new window.ResizeObserver((entries) => {\n if (!entries.length) {\n return;\n }\n\n onResizeEvent();\n });\n resizeObserverInstance.observe(element, {box});\n\n return () => {\n if (element) {\n resizeObserverInstance.unobserve(element);\n }\n };\n }\n\n }, [ref, box]);\n}\n"],"names":[],"version":3,"file":"useResizeObserver.module.js.map"}
@@ -1,32 +0,0 @@
1
- var $78605a5d7424e31b$exports = require("./useLayoutEffect.main.js");
2
-
3
-
4
- function $parcel$export(e, n, v, s) {
5
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
6
- }
7
-
8
- $parcel$export(module.exports, "useSyncRef", () => $6fc733991a9f977c$export$4debdb1a3f0fa79e);
9
- /*
10
- * Copyright 2020 Adobe. All rights reserved.
11
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
12
- * you may not use this file except in compliance with the License. You may obtain a copy
13
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
14
- *
15
- * Unless required by applicable law or agreed to in writing, software distributed under
16
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
17
- * OF ANY KIND, either express or implied. See the License for the specific language
18
- * governing permissions and limitations under the License.
19
- */
20
- function $6fc733991a9f977c$export$4debdb1a3f0fa79e(context, ref) {
21
- (0, $78605a5d7424e31b$exports.useLayoutEffect)(()=>{
22
- if (context && context.ref && ref) {
23
- context.ref.current = ref.current;
24
- return ()=>{
25
- if (context.ref) context.ref.current = null;
26
- };
27
- }
28
- });
29
- }
30
-
31
-
32
- //# sourceMappingURL=useSyncRef.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAWM,SAAS,0CAAc,OAAgC,EAAE,GAAyB;IACvF,CAAA,GAAA,yCAAc,EAAE;QACd,IAAI,WAAW,QAAQ,GAAG,IAAI,KAAK;YACjC,QAAQ,GAAG,CAAC,OAAO,GAAG,IAAI,OAAO;YACjC,OAAO;gBACL,IAAI,QAAQ,GAAG,EACb,QAAQ,GAAG,CAAC,OAAO,GAAG;YAE1B;QACF;IACF;AACF","sources":["packages/@react-aria/utils/src/useSyncRef.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {MutableRefObject} from 'react';\nimport {RefObject} from '@react-types/shared';\nimport {useLayoutEffect} from './';\n\ninterface ContextValue<T> {\n ref?: MutableRefObject<T | null>\n}\n\n// Syncs ref from context with ref passed to hook\nexport function useSyncRef<T>(context?: ContextValue<T> | null, ref?: RefObject<T | null>): void {\n useLayoutEffect(() => {\n if (context && context.ref && ref) {\n context.ref.current = ref.current;\n return () => {\n if (context.ref) {\n context.ref.current = null;\n }\n };\n }\n });\n}\n"],"names":[],"version":3,"file":"useSyncRef.main.js.map"}
@@ -1,27 +0,0 @@
1
- import {useLayoutEffect as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c} from "./useLayoutEffect.mjs";
2
-
3
- /*
4
- * Copyright 2020 Adobe. All rights reserved.
5
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License. You may obtain a copy
7
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software distributed under
10
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
- * OF ANY KIND, either express or implied. See the License for the specific language
12
- * governing permissions and limitations under the License.
13
- */
14
- function $e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, ref) {
15
- (0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
16
- if (context && context.ref && ref) {
17
- context.ref.current = ref.current;
18
- return ()=>{
19
- if (context.ref) context.ref.current = null;
20
- };
21
- }
22
- });
23
- }
24
-
25
-
26
- export {$e7801be82b4b2a53$export$4debdb1a3f0fa79e as useSyncRef};
27
- //# sourceMappingURL=useSyncRef.module.js.map
@@ -1,27 +0,0 @@
1
- import {useLayoutEffect as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c} from "./useLayoutEffect.module.js";
2
-
3
- /*
4
- * Copyright 2020 Adobe. All rights reserved.
5
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License. You may obtain a copy
7
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software distributed under
10
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
- * OF ANY KIND, either express or implied. See the License for the specific language
12
- * governing permissions and limitations under the License.
13
- */
14
- function $e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, ref) {
15
- (0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
16
- if (context && context.ref && ref) {
17
- context.ref.current = ref.current;
18
- return ()=>{
19
- if (context.ref) context.ref.current = null;
20
- };
21
- }
22
- });
23
- }
24
-
25
-
26
- export {$e7801be82b4b2a53$export$4debdb1a3f0fa79e as useSyncRef};
27
- //# sourceMappingURL=useSyncRef.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;AAAA;;;;;;;;;;CAUC;AAWM,SAAS,0CAAc,OAAgC,EAAE,GAAyB;IACvF,CAAA,GAAA,yCAAc,EAAE;QACd,IAAI,WAAW,QAAQ,GAAG,IAAI,KAAK;YACjC,QAAQ,GAAG,CAAC,OAAO,GAAG,IAAI,OAAO;YACjC,OAAO;gBACL,IAAI,QAAQ,GAAG,EACb,QAAQ,GAAG,CAAC,OAAO,GAAG;YAE1B;QACF;IACF;AACF","sources":["packages/@react-aria/utils/src/useSyncRef.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {MutableRefObject} from 'react';\nimport {RefObject} from '@react-types/shared';\nimport {useLayoutEffect} from './';\n\ninterface ContextValue<T> {\n ref?: MutableRefObject<T | null>\n}\n\n// Syncs ref from context with ref passed to hook\nexport function useSyncRef<T>(context?: ContextValue<T> | null, ref?: RefObject<T | null>): void {\n useLayoutEffect(() => {\n if (context && context.ref && ref) {\n context.ref.current = ref.current;\n return () => {\n if (context.ref) {\n context.ref.current = null;\n }\n };\n }\n });\n}\n"],"names":[],"version":3,"file":"useSyncRef.module.js.map"}
@@ -1,42 +0,0 @@
1
- var $1254e5bb94ac8761$exports = require("./useEffectEvent.main.js");
2
- var $cagC1$react = require("react");
3
-
4
-
5
- function $parcel$export(e, n, v, s) {
6
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
- }
8
-
9
- $parcel$export(module.exports, "useUpdateEffect", () => $29293a6f5c75b37e$export$496315a1608d9602);
10
- /*
11
- * Copyright 2020 Adobe. All rights reserved.
12
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13
- * you may not use this file except in compliance with the License. You may obtain a copy
14
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
15
- *
16
- * Unless required by applicable law or agreed to in writing, software distributed under
17
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
18
- * OF ANY KIND, either express or implied. See the License for the specific language
19
- * governing permissions and limitations under the License.
20
- */
21
-
22
- function $29293a6f5c75b37e$export$496315a1608d9602(cb, dependencies) {
23
- const isInitialMount = (0, $cagC1$react.useRef)(true);
24
- const lastDeps = (0, $cagC1$react.useRef)(null);
25
- let cbEvent = (0, $1254e5bb94ac8761$exports.useEffectEvent)(cb);
26
- (0, $cagC1$react.useEffect)(()=>{
27
- isInitialMount.current = true;
28
- return ()=>{
29
- isInitialMount.current = false;
30
- };
31
- }, []);
32
- (0, $cagC1$react.useEffect)(()=>{
33
- let prevDeps = lastDeps.current;
34
- if (isInitialMount.current) isInitialMount.current = false;
35
- else if (!prevDeps || dependencies.some((dep, i)=>!Object.is(dep, prevDeps[i]))) cbEvent();
36
- lastDeps.current = dependencies;
37
- // eslint-disable-next-line react-hooks/exhaustive-deps
38
- }, dependencies);
39
- }
40
-
41
-
42
- //# sourceMappingURL=useUpdateEffect.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAMM,SAAS,0CAAgB,EAAkB,EAAE,YAAmB;IACrE,MAAM,iBAAiB,CAAA,GAAA,mBAAK,EAAE;IAC9B,MAAM,WAAW,CAAA,GAAA,mBAAK,EAAgB;IACtC,IAAI,UAAU,CAAA,GAAA,wCAAa,EAAE;IAE7B,CAAA,GAAA,sBAAQ,EAAE;QACR,eAAe,OAAO,GAAG;QACzB,OAAO;YACL,eAAe,OAAO,GAAG;QAC3B;IACF,GAAG,EAAE;IAEL,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,WAAW,SAAS,OAAO;QAC/B,IAAI,eAAe,OAAO,EACxB,eAAe,OAAO,GAAG;aACpB,IAAI,CAAC,YAAY,aAAa,IAAI,CAAC,CAAC,KAAK,IAAM,CAAC,OAAO,EAAE,CAAC,KAAK,QAAQ,CAAC,EAAE,IAC/E;QAEF,SAAS,OAAO,GAAG;IACrB,uDAAuD;IACvD,GAAG;AACL","sources":["packages/@react-aria/utils/src/useUpdateEffect.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {EffectCallback, useEffect, useRef} from 'react';\nimport {useEffectEvent} from './useEffectEvent';\n\n// Like useEffect, but only called for updates after the initial render.\nexport function useUpdateEffect(cb: EffectCallback, dependencies: any[]): void {\n const isInitialMount = useRef(true);\n const lastDeps = useRef<any[] | null>(null);\n let cbEvent = useEffectEvent(cb);\n\n useEffect(() => {\n isInitialMount.current = true;\n return () => {\n isInitialMount.current = false;\n };\n }, []);\n\n useEffect(() => {\n let prevDeps = lastDeps.current;\n if (isInitialMount.current) {\n isInitialMount.current = false;\n } else if (!prevDeps || dependencies.some((dep, i) => !Object.is(dep, prevDeps[i]))) {\n cbEvent();\n }\n lastDeps.current = dependencies;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies);\n}\n"],"names":[],"version":3,"file":"useUpdateEffect.main.js.map"}
@@ -1,37 +0,0 @@
1
- import {useEffectEvent as $8ae05eaa5c114e9c$export$7f54fc3180508a52} from "./useEffectEvent.mjs";
2
- import {useRef as $9vW05$useRef, useEffect as $9vW05$useEffect} from "react";
3
-
4
- /*
5
- * Copyright 2020 Adobe. All rights reserved.
6
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License. You may obtain a copy
8
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software distributed under
11
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
- * OF ANY KIND, either express or implied. See the License for the specific language
13
- * governing permissions and limitations under the License.
14
- */
15
-
16
- function $4f58c5f72bcf79f7$export$496315a1608d9602(cb, dependencies) {
17
- const isInitialMount = (0, $9vW05$useRef)(true);
18
- const lastDeps = (0, $9vW05$useRef)(null);
19
- let cbEvent = (0, $8ae05eaa5c114e9c$export$7f54fc3180508a52)(cb);
20
- (0, $9vW05$useEffect)(()=>{
21
- isInitialMount.current = true;
22
- return ()=>{
23
- isInitialMount.current = false;
24
- };
25
- }, []);
26
- (0, $9vW05$useEffect)(()=>{
27
- let prevDeps = lastDeps.current;
28
- if (isInitialMount.current) isInitialMount.current = false;
29
- else if (!prevDeps || dependencies.some((dep, i)=>!Object.is(dep, prevDeps[i]))) cbEvent();
30
- lastDeps.current = dependencies;
31
- // eslint-disable-next-line react-hooks/exhaustive-deps
32
- }, dependencies);
33
- }
34
-
35
-
36
- export {$4f58c5f72bcf79f7$export$496315a1608d9602 as useUpdateEffect};
37
- //# sourceMappingURL=useUpdateEffect.module.js.map
@@ -1,37 +0,0 @@
1
- import {useEffectEvent as $8ae05eaa5c114e9c$export$7f54fc3180508a52} from "./useEffectEvent.module.js";
2
- import {useRef as $9vW05$useRef, useEffect as $9vW05$useEffect} from "react";
3
-
4
- /*
5
- * Copyright 2020 Adobe. All rights reserved.
6
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License. You may obtain a copy
8
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software distributed under
11
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
- * OF ANY KIND, either express or implied. See the License for the specific language
13
- * governing permissions and limitations under the License.
14
- */
15
-
16
- function $4f58c5f72bcf79f7$export$496315a1608d9602(cb, dependencies) {
17
- const isInitialMount = (0, $9vW05$useRef)(true);
18
- const lastDeps = (0, $9vW05$useRef)(null);
19
- let cbEvent = (0, $8ae05eaa5c114e9c$export$7f54fc3180508a52)(cb);
20
- (0, $9vW05$useEffect)(()=>{
21
- isInitialMount.current = true;
22
- return ()=>{
23
- isInitialMount.current = false;
24
- };
25
- }, []);
26
- (0, $9vW05$useEffect)(()=>{
27
- let prevDeps = lastDeps.current;
28
- if (isInitialMount.current) isInitialMount.current = false;
29
- else if (!prevDeps || dependencies.some((dep, i)=>!Object.is(dep, prevDeps[i]))) cbEvent();
30
- lastDeps.current = dependencies;
31
- // eslint-disable-next-line react-hooks/exhaustive-deps
32
- }, dependencies);
33
- }
34
-
35
-
36
- export {$4f58c5f72bcf79f7$export$496315a1608d9602 as useUpdateEffect};
37
- //# sourceMappingURL=useUpdateEffect.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAMM,SAAS,0CAAgB,EAAkB,EAAE,YAAmB;IACrE,MAAM,iBAAiB,CAAA,GAAA,aAAK,EAAE;IAC9B,MAAM,WAAW,CAAA,GAAA,aAAK,EAAgB;IACtC,IAAI,UAAU,CAAA,GAAA,yCAAa,EAAE;IAE7B,CAAA,GAAA,gBAAQ,EAAE;QACR,eAAe,OAAO,GAAG;QACzB,OAAO;YACL,eAAe,OAAO,GAAG;QAC3B;IACF,GAAG,EAAE;IAEL,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,WAAW,SAAS,OAAO;QAC/B,IAAI,eAAe,OAAO,EACxB,eAAe,OAAO,GAAG;aACpB,IAAI,CAAC,YAAY,aAAa,IAAI,CAAC,CAAC,KAAK,IAAM,CAAC,OAAO,EAAE,CAAC,KAAK,QAAQ,CAAC,EAAE,IAC/E;QAEF,SAAS,OAAO,GAAG;IACrB,uDAAuD;IACvD,GAAG;AACL","sources":["packages/@react-aria/utils/src/useUpdateEffect.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {EffectCallback, useEffect, useRef} from 'react';\nimport {useEffectEvent} from './useEffectEvent';\n\n// Like useEffect, but only called for updates after the initial render.\nexport function useUpdateEffect(cb: EffectCallback, dependencies: any[]): void {\n const isInitialMount = useRef(true);\n const lastDeps = useRef<any[] | null>(null);\n let cbEvent = useEffectEvent(cb);\n\n useEffect(() => {\n isInitialMount.current = true;\n return () => {\n isInitialMount.current = false;\n };\n }, []);\n\n useEffect(() => {\n let prevDeps = lastDeps.current;\n if (isInitialMount.current) {\n isInitialMount.current = false;\n } else if (!prevDeps || dependencies.some((dep, i) => !Object.is(dep, prevDeps[i]))) {\n cbEvent();\n }\n lastDeps.current = dependencies;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies);\n}\n"],"names":[],"version":3,"file":"useUpdateEffect.module.js.map"}
@@ -1,40 +0,0 @@
1
- var $78605a5d7424e31b$exports = require("./useLayoutEffect.main.js");
2
- var $ah9Dz$react = require("react");
3
-
4
-
5
- function $parcel$export(e, n, v, s) {
6
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
- }
8
-
9
- $parcel$export(module.exports, "useUpdateLayoutEffect", () => $0fa310503218f75f$export$72ef708ab07251f1);
10
- /*
11
- * Copyright 2024 Adobe. All rights reserved.
12
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13
- * you may not use this file except in compliance with the License. You may obtain a copy
14
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
15
- *
16
- * Unless required by applicable law or agreed to in writing, software distributed under
17
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
18
- * OF ANY KIND, either express or implied. See the License for the specific language
19
- * governing permissions and limitations under the License.
20
- */
21
-
22
- function $0fa310503218f75f$export$72ef708ab07251f1(effect, dependencies) {
23
- const isInitialMount = (0, $ah9Dz$react.useRef)(true);
24
- const lastDeps = (0, $ah9Dz$react.useRef)(null);
25
- (0, $78605a5d7424e31b$exports.useLayoutEffect)(()=>{
26
- isInitialMount.current = true;
27
- return ()=>{
28
- isInitialMount.current = false;
29
- };
30
- }, []);
31
- (0, $78605a5d7424e31b$exports.useLayoutEffect)(()=>{
32
- if (isInitialMount.current) isInitialMount.current = false;
33
- else if (!lastDeps.current || dependencies.some((dep, i)=>!Object.is(dep, lastDeps[i]))) effect();
34
- lastDeps.current = dependencies;
35
- // eslint-disable-next-line react-hooks/exhaustive-deps
36
- }, dependencies);
37
- }
38
-
39
-
40
- //# sourceMappingURL=useUpdateLayoutEffect.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAMM,SAAS,0CAAsB,MAAsB,EAAE,YAAmB;IAC/E,MAAM,iBAAiB,CAAA,GAAA,mBAAK,EAAE;IAC9B,MAAM,WAAW,CAAA,GAAA,mBAAK,EAAgB;IAEtC,CAAA,GAAA,yCAAc,EAAE;QACd,eAAe,OAAO,GAAG;QACzB,OAAO;YACL,eAAe,OAAO,GAAG;QAC3B;IACF,GAAG,EAAE;IAEL,CAAA,GAAA,yCAAc,EAAE;QACd,IAAI,eAAe,OAAO,EACxB,eAAe,OAAO,GAAG;aACpB,IAAI,CAAC,SAAS,OAAO,IAAI,aAAa,IAAI,CAAC,CAAC,KAAK,IAAM,CAAC,OAAO,EAAE,CAAC,KAAK,QAAQ,CAAC,EAAE,IACvF;QAEF,SAAS,OAAO,GAAG;IACnB,uDAAuD;IACzD,GAAG;AACL","sources":["packages/@react-aria/utils/src/useUpdateLayoutEffect.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {EffectCallback, useRef} from 'react';\nimport {useLayoutEffect} from './useLayoutEffect';\n\n// Like useLayoutEffect, but only called for updates after the initial render.\nexport function useUpdateLayoutEffect(effect: EffectCallback, dependencies: any[]): void {\n const isInitialMount = useRef(true);\n const lastDeps = useRef<any[] | null>(null);\n\n useLayoutEffect(() => {\n isInitialMount.current = true;\n return () => {\n isInitialMount.current = false;\n };\n }, []);\n\n useLayoutEffect(() => {\n if (isInitialMount.current) {\n isInitialMount.current = false;\n } else if (!lastDeps.current || dependencies.some((dep, i) => !Object.is(dep, lastDeps[i]))) {\n effect();\n }\n lastDeps.current = dependencies;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies);\n}\n"],"names":[],"version":3,"file":"useUpdateLayoutEffect.main.js.map"}
@@ -1,35 +0,0 @@
1
- import {useLayoutEffect as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c} from "./useLayoutEffect.mjs";
2
- import {useRef as $azsE2$useRef} from "react";
3
-
4
- /*
5
- * Copyright 2024 Adobe. All rights reserved.
6
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License. You may obtain a copy
8
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software distributed under
11
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
- * OF ANY KIND, either express or implied. See the License for the specific language
13
- * governing permissions and limitations under the License.
14
- */
15
-
16
- function $ca9b37712f007381$export$72ef708ab07251f1(effect, dependencies) {
17
- const isInitialMount = (0, $azsE2$useRef)(true);
18
- const lastDeps = (0, $azsE2$useRef)(null);
19
- (0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
20
- isInitialMount.current = true;
21
- return ()=>{
22
- isInitialMount.current = false;
23
- };
24
- }, []);
25
- (0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
26
- if (isInitialMount.current) isInitialMount.current = false;
27
- else if (!lastDeps.current || dependencies.some((dep, i)=>!Object.is(dep, lastDeps[i]))) effect();
28
- lastDeps.current = dependencies;
29
- // eslint-disable-next-line react-hooks/exhaustive-deps
30
- }, dependencies);
31
- }
32
-
33
-
34
- export {$ca9b37712f007381$export$72ef708ab07251f1 as useUpdateLayoutEffect};
35
- //# sourceMappingURL=useUpdateLayoutEffect.module.js.map
@@ -1,35 +0,0 @@
1
- import {useLayoutEffect as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c} from "./useLayoutEffect.module.js";
2
- import {useRef as $azsE2$useRef} from "react";
3
-
4
- /*
5
- * Copyright 2024 Adobe. All rights reserved.
6
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License. You may obtain a copy
8
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software distributed under
11
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
- * OF ANY KIND, either express or implied. See the License for the specific language
13
- * governing permissions and limitations under the License.
14
- */
15
-
16
- function $ca9b37712f007381$export$72ef708ab07251f1(effect, dependencies) {
17
- const isInitialMount = (0, $azsE2$useRef)(true);
18
- const lastDeps = (0, $azsE2$useRef)(null);
19
- (0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
20
- isInitialMount.current = true;
21
- return ()=>{
22
- isInitialMount.current = false;
23
- };
24
- }, []);
25
- (0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
26
- if (isInitialMount.current) isInitialMount.current = false;
27
- else if (!lastDeps.current || dependencies.some((dep, i)=>!Object.is(dep, lastDeps[i]))) effect();
28
- lastDeps.current = dependencies;
29
- // eslint-disable-next-line react-hooks/exhaustive-deps
30
- }, dependencies);
31
- }
32
-
33
-
34
- export {$ca9b37712f007381$export$72ef708ab07251f1 as useUpdateLayoutEffect};
35
- //# sourceMappingURL=useUpdateLayoutEffect.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAMM,SAAS,0CAAsB,MAAsB,EAAE,YAAmB;IAC/E,MAAM,iBAAiB,CAAA,GAAA,aAAK,EAAE;IAC9B,MAAM,WAAW,CAAA,GAAA,aAAK,EAAgB;IAEtC,CAAA,GAAA,yCAAc,EAAE;QACd,eAAe,OAAO,GAAG;QACzB,OAAO;YACL,eAAe,OAAO,GAAG;QAC3B;IACF,GAAG,EAAE;IAEL,CAAA,GAAA,yCAAc,EAAE;QACd,IAAI,eAAe,OAAO,EACxB,eAAe,OAAO,GAAG;aACpB,IAAI,CAAC,SAAS,OAAO,IAAI,aAAa,IAAI,CAAC,CAAC,KAAK,IAAM,CAAC,OAAO,EAAE,CAAC,KAAK,QAAQ,CAAC,EAAE,IACvF;QAEF,SAAS,OAAO,GAAG;IACnB,uDAAuD;IACzD,GAAG;AACL","sources":["packages/@react-aria/utils/src/useUpdateLayoutEffect.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {EffectCallback, useRef} from 'react';\nimport {useLayoutEffect} from './useLayoutEffect';\n\n// Like useLayoutEffect, but only called for updates after the initial render.\nexport function useUpdateLayoutEffect(effect: EffectCallback, dependencies: any[]): void {\n const isInitialMount = useRef(true);\n const lastDeps = useRef<any[] | null>(null);\n\n useLayoutEffect(() => {\n isInitialMount.current = true;\n return () => {\n isInitialMount.current = false;\n };\n }, []);\n\n useLayoutEffect(() => {\n if (isInitialMount.current) {\n isInitialMount.current = false;\n } else if (!lastDeps.current || dependencies.some((dep, i) => !Object.is(dep, lastDeps[i]))) {\n effect();\n }\n lastDeps.current = dependencies;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies);\n}\n"],"names":[],"version":3,"file":"useUpdateLayoutEffect.module.js.map"}
@@ -1,63 +0,0 @@
1
- var $78605a5d7424e31b$exports = require("./useLayoutEffect.main.js");
2
- var $fymK9$react = require("react");
3
-
4
-
5
- function $parcel$export(e, n, v, s) {
6
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
- }
8
-
9
- $parcel$export(module.exports, "useValueEffect", () => $19a2307bfabafaf1$export$14d238f342723f25);
10
- /*
11
- * Copyright 2020 Adobe. All rights reserved.
12
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13
- * you may not use this file except in compliance with the License. You may obtain a copy
14
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
15
- *
16
- * Unless required by applicable law or agreed to in writing, software distributed under
17
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
18
- * OF ANY KIND, either express or implied. See the License for the specific language
19
- * governing permissions and limitations under the License.
20
- */
21
-
22
- function $19a2307bfabafaf1$export$14d238f342723f25(defaultValue) {
23
- let [value, setValue] = (0, $fymK9$react.useState)(defaultValue);
24
- // Keep an up to date copy of value in a ref so we can access the current value in the generator.
25
- // This allows us to maintain a stable queue function.
26
- let currValue = (0, $fymK9$react.useRef)(value);
27
- let effect = (0, $fymK9$react.useRef)(null);
28
- // Store the function in a ref so we can always access the current version
29
- // which has the proper `value` in scope.
30
- let nextRef = (0, $fymK9$react.useRef)(()=>{
31
- if (!effect.current) return;
32
- // Run the generator to the next yield.
33
- let newValue = effect.current.next();
34
- // If the generator is done, reset the effect.
35
- if (newValue.done) {
36
- effect.current = null;
37
- return;
38
- }
39
- // If the value is the same as the current value,
40
- // then continue to the next yield. Otherwise,
41
- // set the value in state and wait for the next layout effect.
42
- if (currValue.current === newValue.value) nextRef.current();
43
- else setValue(newValue.value);
44
- });
45
- (0, $78605a5d7424e31b$exports.useLayoutEffect)(()=>{
46
- currValue.current = value;
47
- // If there is an effect currently running, continue to the next yield.
48
- if (effect.current) nextRef.current();
49
- });
50
- let queue = (0, $fymK9$react.useCallback)((fn)=>{
51
- effect.current = fn(currValue.current);
52
- nextRef.current();
53
- }, [
54
- nextRef
55
- ]);
56
- return [
57
- value,
58
- queue
59
- ];
60
- }
61
-
62
-
63
- //# sourceMappingURL=useValueEffect.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAWM,SAAS,0CAAkB,YAA2B;IAC3D,IAAI,CAAC,OAAO,SAAS,GAAG,CAAA,GAAA,qBAAO,EAAE;IACjC,iGAAiG;IACjG,sDAAsD;IACtD,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAE;IACvB,IAAI,SAAyC,CAAA,GAAA,mBAAK,EAAuB;IAEzE,0EAA0E;IAC1E,yCAAyC;IACzC,IAAI,UAAU,CAAA,GAAA,mBAAK,EAAE;QACnB,IAAI,CAAC,OAAO,OAAO,EACjB;QAEF,uCAAuC;QACvC,IAAI,WAAW,OAAO,OAAO,CAAC,IAAI;QAElC,8CAA8C;QAC9C,IAAI,SAAS,IAAI,EAAE;YACjB,OAAO,OAAO,GAAG;YACjB;QACF;QAEA,iDAAiD;QACjD,8CAA8C;QAC9C,8DAA8D;QAC9D,IAAI,UAAU,OAAO,KAAK,SAAS,KAAK,EACtC,QAAQ,OAAO;aAEf,SAAS,SAAS,KAAK;IAE3B;IAEA,CAAA,GAAA,yCAAc,EAAE;QACd,UAAU,OAAO,GAAG;QACpB,uEAAuE;QACvE,IAAI,OAAO,OAAO,EAChB,QAAQ,OAAO;IAEnB;IAEA,IAAI,QAAQ,CAAA,GAAA,wBAAU,EAAE,CAAA;QACtB,OAAO,OAAO,GAAG,GAAG,UAAU,OAAO;QACrC,QAAQ,OAAO;IACjB,GAAG;QAAC;KAAQ;IAEZ,OAAO;QAAC;QAAO;KAAM;AACvB","sources":["packages/@react-aria/utils/src/useValueEffect.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Dispatch, RefObject, useCallback, useRef, useState} from 'react';\nimport {useLayoutEffect} from './';\n\ntype SetValueAction<S> = (prev: S) => Generator<any, void, unknown>;\n\n// This hook works like `useState`, but when setting the value, you pass a generator function\n// that can yield multiple values. Each yielded value updates the state and waits for the next\n// layout effect, then continues the generator. This allows sequential updates to state to be\n// written linearly.\nexport function useValueEffect<S>(defaultValue: S | (() => S)): [S, Dispatch<SetValueAction<S>>] {\n let [value, setValue] = useState(defaultValue);\n // Keep an up to date copy of value in a ref so we can access the current value in the generator.\n // This allows us to maintain a stable queue function.\n let currValue = useRef(value);\n let effect: RefObject<Generator<S> | null> = useRef<Generator<S> | null>(null);\n\n // Store the function in a ref so we can always access the current version\n // which has the proper `value` in scope.\n let nextRef = useRef(() => {\n if (!effect.current) {\n return;\n }\n // Run the generator to the next yield.\n let newValue = effect.current.next();\n\n // If the generator is done, reset the effect.\n if (newValue.done) {\n effect.current = null;\n return;\n }\n\n // If the value is the same as the current value,\n // then continue to the next yield. Otherwise,\n // set the value in state and wait for the next layout effect.\n if (currValue.current === newValue.value) {\n nextRef.current();\n } else {\n setValue(newValue.value);\n }\n });\n\n useLayoutEffect(() => {\n currValue.current = value;\n // If there is an effect currently running, continue to the next yield.\n if (effect.current) {\n nextRef.current();\n }\n });\n\n let queue = useCallback(fn => {\n effect.current = fn(currValue.current);\n nextRef.current();\n }, [nextRef]);\n\n return [value, queue];\n}\n"],"names":[],"version":3,"file":"useValueEffect.main.js.map"}
@@ -1,58 +0,0 @@
1
- import {useLayoutEffect as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c} from "./useLayoutEffect.mjs";
2
- import {useState as $fCAlL$useState, useRef as $fCAlL$useRef, useCallback as $fCAlL$useCallback} from "react";
3
-
4
- /*
5
- * Copyright 2020 Adobe. All rights reserved.
6
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License. You may obtain a copy
8
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software distributed under
11
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
- * OF ANY KIND, either express or implied. See the License for the specific language
13
- * governing permissions and limitations under the License.
14
- */
15
-
16
- function $1dbecbe27a04f9af$export$14d238f342723f25(defaultValue) {
17
- let [value, setValue] = (0, $fCAlL$useState)(defaultValue);
18
- // Keep an up to date copy of value in a ref so we can access the current value in the generator.
19
- // This allows us to maintain a stable queue function.
20
- let currValue = (0, $fCAlL$useRef)(value);
21
- let effect = (0, $fCAlL$useRef)(null);
22
- // Store the function in a ref so we can always access the current version
23
- // which has the proper `value` in scope.
24
- let nextRef = (0, $fCAlL$useRef)(()=>{
25
- if (!effect.current) return;
26
- // Run the generator to the next yield.
27
- let newValue = effect.current.next();
28
- // If the generator is done, reset the effect.
29
- if (newValue.done) {
30
- effect.current = null;
31
- return;
32
- }
33
- // If the value is the same as the current value,
34
- // then continue to the next yield. Otherwise,
35
- // set the value in state and wait for the next layout effect.
36
- if (currValue.current === newValue.value) nextRef.current();
37
- else setValue(newValue.value);
38
- });
39
- (0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
40
- currValue.current = value;
41
- // If there is an effect currently running, continue to the next yield.
42
- if (effect.current) nextRef.current();
43
- });
44
- let queue = (0, $fCAlL$useCallback)((fn)=>{
45
- effect.current = fn(currValue.current);
46
- nextRef.current();
47
- }, [
48
- nextRef
49
- ]);
50
- return [
51
- value,
52
- queue
53
- ];
54
- }
55
-
56
-
57
- export {$1dbecbe27a04f9af$export$14d238f342723f25 as useValueEffect};
58
- //# sourceMappingURL=useValueEffect.module.js.map
@@ -1,58 +0,0 @@
1
- import {useLayoutEffect as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c} from "./useLayoutEffect.module.js";
2
- import {useState as $fCAlL$useState, useRef as $fCAlL$useRef, useCallback as $fCAlL$useCallback} from "react";
3
-
4
- /*
5
- * Copyright 2020 Adobe. All rights reserved.
6
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License. You may obtain a copy
8
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software distributed under
11
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
- * OF ANY KIND, either express or implied. See the License for the specific language
13
- * governing permissions and limitations under the License.
14
- */
15
-
16
- function $1dbecbe27a04f9af$export$14d238f342723f25(defaultValue) {
17
- let [value, setValue] = (0, $fCAlL$useState)(defaultValue);
18
- // Keep an up to date copy of value in a ref so we can access the current value in the generator.
19
- // This allows us to maintain a stable queue function.
20
- let currValue = (0, $fCAlL$useRef)(value);
21
- let effect = (0, $fCAlL$useRef)(null);
22
- // Store the function in a ref so we can always access the current version
23
- // which has the proper `value` in scope.
24
- let nextRef = (0, $fCAlL$useRef)(()=>{
25
- if (!effect.current) return;
26
- // Run the generator to the next yield.
27
- let newValue = effect.current.next();
28
- // If the generator is done, reset the effect.
29
- if (newValue.done) {
30
- effect.current = null;
31
- return;
32
- }
33
- // If the value is the same as the current value,
34
- // then continue to the next yield. Otherwise,
35
- // set the value in state and wait for the next layout effect.
36
- if (currValue.current === newValue.value) nextRef.current();
37
- else setValue(newValue.value);
38
- });
39
- (0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
40
- currValue.current = value;
41
- // If there is an effect currently running, continue to the next yield.
42
- if (effect.current) nextRef.current();
43
- });
44
- let queue = (0, $fCAlL$useCallback)((fn)=>{
45
- effect.current = fn(currValue.current);
46
- nextRef.current();
47
- }, [
48
- nextRef
49
- ]);
50
- return [
51
- value,
52
- queue
53
- ];
54
- }
55
-
56
-
57
- export {$1dbecbe27a04f9af$export$14d238f342723f25 as useValueEffect};
58
- //# sourceMappingURL=useValueEffect.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAWM,SAAS,0CAAkB,YAA2B;IAC3D,IAAI,CAAC,OAAO,SAAS,GAAG,CAAA,GAAA,eAAO,EAAE;IACjC,iGAAiG;IACjG,sDAAsD;IACtD,IAAI,YAAY,CAAA,GAAA,aAAK,EAAE;IACvB,IAAI,SAAyC,CAAA,GAAA,aAAK,EAAuB;IAEzE,0EAA0E;IAC1E,yCAAyC;IACzC,IAAI,UAAU,CAAA,GAAA,aAAK,EAAE;QACnB,IAAI,CAAC,OAAO,OAAO,EACjB;QAEF,uCAAuC;QACvC,IAAI,WAAW,OAAO,OAAO,CAAC,IAAI;QAElC,8CAA8C;QAC9C,IAAI,SAAS,IAAI,EAAE;YACjB,OAAO,OAAO,GAAG;YACjB;QACF;QAEA,iDAAiD;QACjD,8CAA8C;QAC9C,8DAA8D;QAC9D,IAAI,UAAU,OAAO,KAAK,SAAS,KAAK,EACtC,QAAQ,OAAO;aAEf,SAAS,SAAS,KAAK;IAE3B;IAEA,CAAA,GAAA,yCAAc,EAAE;QACd,UAAU,OAAO,GAAG;QACpB,uEAAuE;QACvE,IAAI,OAAO,OAAO,EAChB,QAAQ,OAAO;IAEnB;IAEA,IAAI,QAAQ,CAAA,GAAA,kBAAU,EAAE,CAAA;QACtB,OAAO,OAAO,GAAG,GAAG,UAAU,OAAO;QACrC,QAAQ,OAAO;IACjB,GAAG;QAAC;KAAQ;IAEZ,OAAO;QAAC;QAAO;KAAM;AACvB","sources":["packages/@react-aria/utils/src/useValueEffect.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Dispatch, RefObject, useCallback, useRef, useState} from 'react';\nimport {useLayoutEffect} from './';\n\ntype SetValueAction<S> = (prev: S) => Generator<any, void, unknown>;\n\n// This hook works like `useState`, but when setting the value, you pass a generator function\n// that can yield multiple values. Each yielded value updates the state and waits for the next\n// layout effect, then continues the generator. This allows sequential updates to state to be\n// written linearly.\nexport function useValueEffect<S>(defaultValue: S | (() => S)): [S, Dispatch<SetValueAction<S>>] {\n let [value, setValue] = useState(defaultValue);\n // Keep an up to date copy of value in a ref so we can access the current value in the generator.\n // This allows us to maintain a stable queue function.\n let currValue = useRef(value);\n let effect: RefObject<Generator<S> | null> = useRef<Generator<S> | null>(null);\n\n // Store the function in a ref so we can always access the current version\n // which has the proper `value` in scope.\n let nextRef = useRef(() => {\n if (!effect.current) {\n return;\n }\n // Run the generator to the next yield.\n let newValue = effect.current.next();\n\n // If the generator is done, reset the effect.\n if (newValue.done) {\n effect.current = null;\n return;\n }\n\n // If the value is the same as the current value,\n // then continue to the next yield. Otherwise,\n // set the value in state and wait for the next layout effect.\n if (currValue.current === newValue.value) {\n nextRef.current();\n } else {\n setValue(newValue.value);\n }\n });\n\n useLayoutEffect(() => {\n currValue.current = value;\n // If there is an effect currently running, continue to the next yield.\n if (effect.current) {\n nextRef.current();\n }\n });\n\n let queue = useCallback(fn => {\n effect.current = fn(currValue.current);\n nextRef.current();\n }, [nextRef]);\n\n return [value, queue];\n}\n"],"names":[],"version":3,"file":"useValueEffect.module.js.map"}