@react-aria/utils 3.33.1 → 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 -115
  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 -57
  10. package/dist/DOMFunctions.main.js.map +0 -1
  11. package/dist/DOMFunctions.mjs +0 -49
  12. package/dist/DOMFunctions.module.js +0 -49
  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 -31
  60. package/dist/getScrollParents.main.js.map +0 -1
  61. package/dist/getScrollParents.mjs +0 -26
  62. package/dist/getScrollParents.module.js +0 -26
  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 -29
  80. package/dist/isScrollable.main.js.map +0 -1
  81. package/dist/isScrollable.mjs +0 -24
  82. package/dist/isScrollable.module.js +0 -24
  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 -97
  115. package/dist/runAfterTransition.main.js.map +0 -1
  116. package/dist/runAfterTransition.mjs +0 -92
  117. package/dist/runAfterTransition.module.js +0 -92
  118. package/dist/runAfterTransition.module.js.map +0 -1
  119. package/dist/scrollIntoView.main.js +0 -138
  120. package/dist/scrollIntoView.main.js.map +0 -1
  121. package/dist/scrollIntoView.mjs +0 -132
  122. package/dist/scrollIntoView.module.js +0 -132
  123. package/dist/scrollIntoView.module.js.map +0 -1
  124. package/dist/types.d.ts +0 -299
  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 -84
  217. package/dist/useViewportSize.main.js.map +0 -1
  218. package/dist/useViewportSize.mjs +0 -79
  219. package/dist/useViewportSize.module.js +0 -79
  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 -27
  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 -31
  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 -124
  241. package/src/scrollIntoView.ts +0 -168
  242. package/src/shadowdom/DOMFunctions.ts +0 -100
  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 -103
package/dist/platform.mjs DELETED
@@ -1,60 +0,0 @@
1
- /*
2
- * Copyright 2020 Adobe. All rights reserved.
3
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License. You may obtain a copy
5
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- *
7
- * Unless required by applicable law or agreed to in writing, software distributed under
8
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- * OF ANY KIND, either express or implied. See the License for the specific language
10
- * governing permissions and limitations under the License.
11
- */ function $c87311424ea30a05$var$testUserAgent(re) {
12
- var _window_navigator_userAgentData;
13
- if (typeof window === 'undefined' || window.navigator == null) return false;
14
- let brands = (_window_navigator_userAgentData = window.navigator['userAgentData']) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands;
15
- return Array.isArray(brands) && brands.some((brand)=>re.test(brand.brand)) || re.test(window.navigator.userAgent);
16
- }
17
- function $c87311424ea30a05$var$testPlatform(re) {
18
- var _window_navigator_userAgentData;
19
- return typeof window !== 'undefined' && window.navigator != null ? re.test(((_window_navigator_userAgentData = window.navigator['userAgentData']) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
20
- }
21
- function $c87311424ea30a05$var$cached(fn) {
22
- if (process.env.NODE_ENV === 'test') return fn;
23
- let res = null;
24
- return ()=>{
25
- if (res == null) res = fn();
26
- return res;
27
- };
28
- }
29
- const $c87311424ea30a05$export$9ac100e40613ea10 = $c87311424ea30a05$var$cached(function() {
30
- return $c87311424ea30a05$var$testPlatform(/^Mac/i);
31
- });
32
- const $c87311424ea30a05$export$186c6964ca17d99 = $c87311424ea30a05$var$cached(function() {
33
- return $c87311424ea30a05$var$testPlatform(/^iPhone/i);
34
- });
35
- const $c87311424ea30a05$export$7bef049ce92e4224 = $c87311424ea30a05$var$cached(function() {
36
- return $c87311424ea30a05$var$testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
37
- $c87311424ea30a05$export$9ac100e40613ea10() && navigator.maxTouchPoints > 1;
38
- });
39
- const $c87311424ea30a05$export$fedb369cb70207f1 = $c87311424ea30a05$var$cached(function() {
40
- return $c87311424ea30a05$export$186c6964ca17d99() || $c87311424ea30a05$export$7bef049ce92e4224();
41
- });
42
- const $c87311424ea30a05$export$e1865c3bedcd822b = $c87311424ea30a05$var$cached(function() {
43
- return $c87311424ea30a05$export$9ac100e40613ea10() || $c87311424ea30a05$export$fedb369cb70207f1();
44
- });
45
- const $c87311424ea30a05$export$78551043582a6a98 = $c87311424ea30a05$var$cached(function() {
46
- return $c87311424ea30a05$var$testUserAgent(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e();
47
- });
48
- const $c87311424ea30a05$export$6446a186d09e379e = $c87311424ea30a05$var$cached(function() {
49
- return $c87311424ea30a05$var$testUserAgent(/Chrome/i);
50
- });
51
- const $c87311424ea30a05$export$a11b0059900ceec8 = $c87311424ea30a05$var$cached(function() {
52
- return $c87311424ea30a05$var$testUserAgent(/Android/i);
53
- });
54
- const $c87311424ea30a05$export$b7d78993b74f766d = $c87311424ea30a05$var$cached(function() {
55
- return $c87311424ea30a05$var$testUserAgent(/Firefox/i);
56
- });
57
-
58
-
59
- export {$c87311424ea30a05$export$9ac100e40613ea10 as isMac, $c87311424ea30a05$export$186c6964ca17d99 as isIPhone, $c87311424ea30a05$export$7bef049ce92e4224 as isIPad, $c87311424ea30a05$export$fedb369cb70207f1 as isIOS, $c87311424ea30a05$export$e1865c3bedcd822b as isAppleDevice, $c87311424ea30a05$export$78551043582a6a98 as isWebKit, $c87311424ea30a05$export$6446a186d09e379e as isChrome, $c87311424ea30a05$export$a11b0059900ceec8 as isAndroid, $c87311424ea30a05$export$b7d78993b74f766d as isFirefox};
60
- //# sourceMappingURL=platform.module.js.map
@@ -1,60 +0,0 @@
1
- /*
2
- * Copyright 2020 Adobe. All rights reserved.
3
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License. You may obtain a copy
5
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- *
7
- * Unless required by applicable law or agreed to in writing, software distributed under
8
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- * OF ANY KIND, either express or implied. See the License for the specific language
10
- * governing permissions and limitations under the License.
11
- */ function $c87311424ea30a05$var$testUserAgent(re) {
12
- var _window_navigator_userAgentData;
13
- if (typeof window === 'undefined' || window.navigator == null) return false;
14
- let brands = (_window_navigator_userAgentData = window.navigator['userAgentData']) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands;
15
- return Array.isArray(brands) && brands.some((brand)=>re.test(brand.brand)) || re.test(window.navigator.userAgent);
16
- }
17
- function $c87311424ea30a05$var$testPlatform(re) {
18
- var _window_navigator_userAgentData;
19
- return typeof window !== 'undefined' && window.navigator != null ? re.test(((_window_navigator_userAgentData = window.navigator['userAgentData']) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
20
- }
21
- function $c87311424ea30a05$var$cached(fn) {
22
- if (process.env.NODE_ENV === 'test') return fn;
23
- let res = null;
24
- return ()=>{
25
- if (res == null) res = fn();
26
- return res;
27
- };
28
- }
29
- const $c87311424ea30a05$export$9ac100e40613ea10 = $c87311424ea30a05$var$cached(function() {
30
- return $c87311424ea30a05$var$testPlatform(/^Mac/i);
31
- });
32
- const $c87311424ea30a05$export$186c6964ca17d99 = $c87311424ea30a05$var$cached(function() {
33
- return $c87311424ea30a05$var$testPlatform(/^iPhone/i);
34
- });
35
- const $c87311424ea30a05$export$7bef049ce92e4224 = $c87311424ea30a05$var$cached(function() {
36
- return $c87311424ea30a05$var$testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
37
- $c87311424ea30a05$export$9ac100e40613ea10() && navigator.maxTouchPoints > 1;
38
- });
39
- const $c87311424ea30a05$export$fedb369cb70207f1 = $c87311424ea30a05$var$cached(function() {
40
- return $c87311424ea30a05$export$186c6964ca17d99() || $c87311424ea30a05$export$7bef049ce92e4224();
41
- });
42
- const $c87311424ea30a05$export$e1865c3bedcd822b = $c87311424ea30a05$var$cached(function() {
43
- return $c87311424ea30a05$export$9ac100e40613ea10() || $c87311424ea30a05$export$fedb369cb70207f1();
44
- });
45
- const $c87311424ea30a05$export$78551043582a6a98 = $c87311424ea30a05$var$cached(function() {
46
- return $c87311424ea30a05$var$testUserAgent(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e();
47
- });
48
- const $c87311424ea30a05$export$6446a186d09e379e = $c87311424ea30a05$var$cached(function() {
49
- return $c87311424ea30a05$var$testUserAgent(/Chrome/i);
50
- });
51
- const $c87311424ea30a05$export$a11b0059900ceec8 = $c87311424ea30a05$var$cached(function() {
52
- return $c87311424ea30a05$var$testUserAgent(/Android/i);
53
- });
54
- const $c87311424ea30a05$export$b7d78993b74f766d = $c87311424ea30a05$var$cached(function() {
55
- return $c87311424ea30a05$var$testUserAgent(/Firefox/i);
56
- });
57
-
58
-
59
- export {$c87311424ea30a05$export$9ac100e40613ea10 as isMac, $c87311424ea30a05$export$186c6964ca17d99 as isIPhone, $c87311424ea30a05$export$7bef049ce92e4224 as isIPad, $c87311424ea30a05$export$fedb369cb70207f1 as isIOS, $c87311424ea30a05$export$e1865c3bedcd822b as isAppleDevice, $c87311424ea30a05$export$78551043582a6a98 as isWebKit, $c87311424ea30a05$export$6446a186d09e379e as isChrome, $c87311424ea30a05$export$a11b0059900ceec8 as isAndroid, $c87311424ea30a05$export$b7d78993b74f766d as isFirefox};
60
- //# sourceMappingURL=platform.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":"AAAA;;;;;;;;;;CAUC,GAED,SAAS,oCAAc,EAAU;QAIlB;IAHb,IAAI,OAAO,WAAW,eAAe,OAAO,SAAS,IAAI,MACvD,OAAO;IAET,IAAI,UAAS,kCAAA,OAAO,SAAS,CAAC,gBAAgB,cAAjC,sDAAA,gCAAmC,MAAM;IACtD,OAAO,MAAM,OAAO,CAAC,WAAW,OAAO,IAAI,CAAC,CAAC,QAA4C,GAAG,IAAI,CAAC,MAAM,KAAK,MAC1G,GAAG,IAAI,CAAC,OAAO,SAAS,CAAC,SAAS;AACtC;AAEA,SAAS,mCAAa,EAAU;QAElB;IADZ,OAAO,OAAO,WAAW,eAAe,OAAO,SAAS,IAAI,OACxD,GAAG,IAAI,CAAC,EAAA,kCAAA,OAAO,SAAS,CAAC,gBAAgB,cAAjC,sDAAA,gCAAmC,QAAQ,KAAI,OAAO,SAAS,CAAC,QAAQ,IAChF;AACN;AAEA,SAAS,6BAAO,EAAiB;IAC/B,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,QAC3B,OAAO;IAGT,IAAI,MAAsB;IAC1B,OAAO;QACL,IAAI,OAAO,MACT,MAAM;QAER,OAAO;IACT;AACF;AAEO,MAAM,4CAAuB,6BAAO;IACzC,OAAO,mCAAa;AACtB;AAEO,MAAM,2CAA0B,6BAAO;IAC5C,OAAO,mCAAa;AACtB;AAEO,MAAM,4CAAwB,6BAAO;IAC1C,OAAO,mCAAa,aAClB,yFAAyF;IACxF,+CAAW,UAAU,cAAc,GAAG;AAC3C;AAEO,MAAM,4CAAuB,6BAAO;IACzC,OAAO,8CAAc;AACvB;AAEO,MAAM,4CAA+B,6BAAO;IACjD,OAAO,+CAAW;AACpB;AAEO,MAAM,4CAA0B,6BAAO;IAC5C,OAAO,oCAAc,mBAAmB,CAAC;AAC3C;AAEO,MAAM,4CAA0B,6BAAO;IAC5C,OAAO,oCAAc;AACvB;AAEO,MAAM,4CAA2B,6BAAO;IAC7C,OAAO,oCAAc;AACvB;AAEO,MAAM,4CAA2B,6BAAO;IAC7C,OAAO,oCAAc;AACvB","sources":["packages/@react-aria/utils/src/platform.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\nfunction testUserAgent(re: RegExp) {\n if (typeof window === 'undefined' || window.navigator == null) {\n return false;\n }\n let brands = window.navigator['userAgentData']?.brands;\n return Array.isArray(brands) && brands.some((brand: {brand: string, version: string}) => re.test(brand.brand)) ||\n re.test(window.navigator.userAgent);\n}\n\nfunction testPlatform(re: RegExp) {\n return typeof window !== 'undefined' && window.navigator != null\n ? re.test(window.navigator['userAgentData']?.platform || window.navigator.platform)\n : false;\n}\n\nfunction cached(fn: () => boolean) {\n if (process.env.NODE_ENV === 'test') {\n return fn;\n }\n\n let res: boolean | null = null;\n return () => {\n if (res == null) {\n res = fn();\n }\n return res;\n };\n}\n\nexport const isMac: () => boolean = cached(function () {\n return testPlatform(/^Mac/i);\n});\n\nexport const isIPhone: () => boolean = cached(function () {\n return testPlatform(/^iPhone/i);\n});\n\nexport const isIPad: () => boolean = cached(function () {\n return testPlatform(/^iPad/i) ||\n // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.\n (isMac() && navigator.maxTouchPoints > 1);\n});\n\nexport const isIOS: () => boolean = cached(function () {\n return isIPhone() || isIPad();\n});\n\nexport const isAppleDevice: () => boolean = cached(function () {\n return isMac() || isIOS();\n});\n\nexport const isWebKit: () => boolean = cached(function () {\n return testUserAgent(/AppleWebKit/i) && !isChrome();\n});\n\nexport const isChrome: () => boolean = cached(function () {\n return testUserAgent(/Chrome/i);\n});\n\nexport const isAndroid: () => boolean = cached(function () {\n return testUserAgent(/Android/i);\n});\n\nexport const isFirefox: () => boolean = cached(function () {\n return testUserAgent(/Firefox/i);\n});\n"],"names":[],"version":3,"file":"platform.module.js.map"}
@@ -1,97 +0,0 @@
1
- var $d723bea02f3e2567$exports = require("./DOMFunctions.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, "runAfterTransition", () => $e8117ebcab55be6a$export$24490316f764c430);
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
- */ // We store a global list of elements that are currently transitioning,
20
- // mapped to a set of CSS properties that are transitioning for that element.
21
- // This is necessary rather than a simple count of transitions because of browser
22
- // bugs, e.g. Chrome sometimes fires both transitionend and transitioncancel rather
23
- // than one or the other. So we need to track what's actually transitioning so that
24
- // we can ignore these duplicate events.
25
-
26
- let $e8117ebcab55be6a$var$transitionsByElement = new Map();
27
- // A list of callbacks to call once there are no transitioning elements.
28
- let $e8117ebcab55be6a$var$transitionCallbacks = new Set();
29
- function $e8117ebcab55be6a$var$setupGlobalEvents() {
30
- if (typeof window === 'undefined') return;
31
- function isTransitionEvent(event) {
32
- return 'propertyName' in event;
33
- }
34
- let onTransitionStart = (e)=>{
35
- let eventTarget = (0, $d723bea02f3e2567$exports.getEventTarget)(e);
36
- if (!isTransitionEvent(e) || !eventTarget) return;
37
- // Add the transitioning property to the list for this element.
38
- let transitions = $e8117ebcab55be6a$var$transitionsByElement.get(eventTarget);
39
- if (!transitions) {
40
- transitions = new Set();
41
- $e8117ebcab55be6a$var$transitionsByElement.set(eventTarget, transitions);
42
- // The transitioncancel event must be registered on the element itself, rather than as a global
43
- // event. This enables us to handle when the node is deleted from the document while it is transitioning.
44
- // In that case, the cancel event would have nowhere to bubble to so we need to handle it directly.
45
- eventTarget.addEventListener('transitioncancel', onTransitionEnd, {
46
- once: true
47
- });
48
- }
49
- transitions.add(e.propertyName);
50
- };
51
- let onTransitionEnd = (e)=>{
52
- let eventTarget = (0, $d723bea02f3e2567$exports.getEventTarget)(e);
53
- if (!isTransitionEvent(e) || !eventTarget) return;
54
- // Remove property from list of transitioning properties.
55
- let properties = $e8117ebcab55be6a$var$transitionsByElement.get(eventTarget);
56
- if (!properties) return;
57
- properties.delete(e.propertyName);
58
- // If empty, remove transitioncancel event, and remove the element from the list of transitioning elements.
59
- if (properties.size === 0) {
60
- eventTarget.removeEventListener('transitioncancel', onTransitionEnd);
61
- $e8117ebcab55be6a$var$transitionsByElement.delete(eventTarget);
62
- }
63
- // If no transitioning elements, call all of the queued callbacks.
64
- if ($e8117ebcab55be6a$var$transitionsByElement.size === 0) {
65
- for (let cb of $e8117ebcab55be6a$var$transitionCallbacks)cb();
66
- $e8117ebcab55be6a$var$transitionCallbacks.clear();
67
- }
68
- };
69
- document.body.addEventListener('transitionrun', onTransitionStart);
70
- document.body.addEventListener('transitionend', onTransitionEnd);
71
- }
72
- if (typeof document !== 'undefined') {
73
- if (document.readyState !== 'loading') $e8117ebcab55be6a$var$setupGlobalEvents();
74
- else document.addEventListener('DOMContentLoaded', $e8117ebcab55be6a$var$setupGlobalEvents);
75
- }
76
- /**
77
- * Cleans up any elements that are no longer in the document.
78
- * This is necessary because we can't rely on transitionend events to fire
79
- * for elements that are removed from the document while transitioning.
80
- */ function $e8117ebcab55be6a$var$cleanupDetachedElements() {
81
- for (const [eventTarget] of $e8117ebcab55be6a$var$transitionsByElement)// Similar to `eventTarget instanceof Element && !eventTarget.isConnected`, but avoids
82
- // the explicit instanceof check, since it may be different in different contexts.
83
- if ('isConnected' in eventTarget && !eventTarget.isConnected) $e8117ebcab55be6a$var$transitionsByElement.delete(eventTarget);
84
- }
85
- function $e8117ebcab55be6a$export$24490316f764c430(fn) {
86
- // Wait one frame to see if an animation starts, e.g. a transition on mount.
87
- requestAnimationFrame(()=>{
88
- $e8117ebcab55be6a$var$cleanupDetachedElements();
89
- // If no transitions are running, call the function immediately.
90
- // Otherwise, add it to a list of callbacks to run at the end of the animation.
91
- if ($e8117ebcab55be6a$var$transitionsByElement.size === 0) fn();
92
- else $e8117ebcab55be6a$var$transitionCallbacks.add(fn);
93
- });
94
- }
95
-
96
-
97
- //# sourceMappingURL=runAfterTransition.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,uEAAuE;AACvE,6EAA6E;AAC7E,iFAAiF;AACjF,mFAAmF;AACnF,mFAAmF;AACnF,wCAAwC;;AAExC,IAAI,6CAAuB,IAAI;AAE/B,wEAAwE;AACxE,IAAI,4CAAsB,IAAI;AAE9B,SAAS;IACP,IAAI,OAAO,WAAW,aACpB;IAGF,SAAS,kBAAkB,KAAY;QACrC,OAAO,kBAAkB;IAC3B;IAEA,IAAI,oBAAoB,CAAC;QACvB,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QACjC,IAAI,CAAC,kBAAkB,MAAM,CAAC,aAC5B;QAEF,+DAA+D;QAC/D,IAAI,cAAc,2CAAqB,GAAG,CAAC;QAC3C,IAAI,CAAC,aAAa;YAChB,cAAc,IAAI;YAClB,2CAAqB,GAAG,CAAC,aAAa;YAEtC,+FAA+F;YAC/F,yGAAyG;YACzG,mGAAmG;YACnG,YAAY,gBAAgB,CAAC,oBAAoB,iBAAiB;gBAChE,MAAM;YACR;QACF;QAEA,YAAY,GAAG,CAAC,EAAE,YAAY;IAChC;IAEA,IAAI,kBAAkB,CAAC;QACrB,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QACjC,IAAI,CAAC,kBAAkB,MAAM,CAAC,aAC5B;QAEF,yDAAyD;QACzD,IAAI,aAAa,2CAAqB,GAAG,CAAC;QAC1C,IAAI,CAAC,YACH;QAGF,WAAW,MAAM,CAAC,EAAE,YAAY;QAEhC,2GAA2G;QAC3G,IAAI,WAAW,IAAI,KAAK,GAAG;YACzB,YAAY,mBAAmB,CAAC,oBAAoB;YACpD,2CAAqB,MAAM,CAAC;QAC9B;QAEA,kEAAkE;QAClE,IAAI,2CAAqB,IAAI,KAAK,GAAG;YACnC,KAAK,IAAI,MAAM,0CACb;YAGF,0CAAoB,KAAK;QAC3B;IACF;IAEA,SAAS,IAAI,CAAC,gBAAgB,CAAC,iBAAiB;IAChD,SAAS,IAAI,CAAC,gBAAgB,CAAC,iBAAiB;AAClD;AAEA,IAAI,OAAO,aAAa;IACtB,IAAI,SAAS,UAAU,KAAK,WAC1B;SAEA,SAAS,gBAAgB,CAAC,oBAAoB;;AAIlD;;;;CAIC,GACD,SAAS;IACP,KAAK,MAAM,CAAC,YAAY,IAAI,2CAC1B,sFAAsF;IACtF,kFAAkF;IAClF,IAAI,iBAAiB,eAAe,CAAC,YAAY,WAAW,EAC1D,2CAAqB,MAAM,CAAC;AAGlC;AAEO,SAAS,0CAAmB,EAAc;IAC/C,4EAA4E;IAC5E,sBAAsB;QACpB;QACA,gEAAgE;QAChE,+EAA+E;QAC/E,IAAI,2CAAqB,IAAI,KAAK,GAChC;aAEA,0CAAoB,GAAG,CAAC;IAE5B;AACF","sources":["packages/@react-aria/utils/src/runAfterTransition.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\n// We store a global list of elements that are currently transitioning,\n// mapped to a set of CSS properties that are transitioning for that element.\n// This is necessary rather than a simple count of transitions because of browser\n// bugs, e.g. Chrome sometimes fires both transitionend and transitioncancel rather\n// than one or the other. So we need to track what's actually transitioning so that\n// we can ignore these duplicate events.\nimport {getEventTarget} from './shadowdom/DOMFunctions';\nlet transitionsByElement = new Map<EventTarget, Set<string>>();\n\n// A list of callbacks to call once there are no transitioning elements.\nlet transitionCallbacks = new Set<() => void>();\n\nfunction setupGlobalEvents() {\n if (typeof window === 'undefined') {\n return;\n }\n\n function isTransitionEvent(event: Event): event is TransitionEvent {\n return 'propertyName' in event;\n }\n\n let onTransitionStart = (e: Event) => {\n let eventTarget = getEventTarget(e);\n if (!isTransitionEvent(e) || !eventTarget) {\n return;\n }\n // Add the transitioning property to the list for this element.\n let transitions = transitionsByElement.get(eventTarget);\n if (!transitions) {\n transitions = new Set();\n transitionsByElement.set(eventTarget, transitions);\n\n // The transitioncancel event must be registered on the element itself, rather than as a global\n // event. This enables us to handle when the node is deleted from the document while it is transitioning.\n // In that case, the cancel event would have nowhere to bubble to so we need to handle it directly.\n eventTarget.addEventListener('transitioncancel', onTransitionEnd, {\n once: true\n });\n }\n\n transitions.add(e.propertyName);\n };\n\n let onTransitionEnd = (e: Event) => {\n let eventTarget = getEventTarget(e);\n if (!isTransitionEvent(e) || !eventTarget) {\n return;\n }\n // Remove property from list of transitioning properties.\n let properties = transitionsByElement.get(eventTarget);\n if (!properties) {\n return;\n }\n\n properties.delete(e.propertyName);\n\n // If empty, remove transitioncancel event, and remove the element from the list of transitioning elements.\n if (properties.size === 0) {\n eventTarget.removeEventListener('transitioncancel', onTransitionEnd);\n transitionsByElement.delete(eventTarget);\n }\n\n // If no transitioning elements, call all of the queued callbacks.\n if (transitionsByElement.size === 0) {\n for (let cb of transitionCallbacks) {\n cb();\n }\n\n transitionCallbacks.clear();\n }\n };\n\n document.body.addEventListener('transitionrun', onTransitionStart);\n document.body.addEventListener('transitionend', onTransitionEnd);\n}\n\nif (typeof document !== 'undefined') {\n if (document.readyState !== 'loading') {\n setupGlobalEvents();\n } else {\n document.addEventListener('DOMContentLoaded', setupGlobalEvents);\n }\n}\n\n/**\n * Cleans up any elements that are no longer in the document.\n * This is necessary because we can't rely on transitionend events to fire\n * for elements that are removed from the document while transitioning.\n */\nfunction cleanupDetachedElements() {\n for (const [eventTarget] of transitionsByElement) {\n // Similar to `eventTarget instanceof Element && !eventTarget.isConnected`, but avoids\n // the explicit instanceof check, since it may be different in different contexts.\n if ('isConnected' in eventTarget && !eventTarget.isConnected) {\n transitionsByElement.delete(eventTarget);\n }\n }\n}\n\nexport function runAfterTransition(fn: () => void): void {\n // Wait one frame to see if an animation starts, e.g. a transition on mount.\n requestAnimationFrame(() => {\n cleanupDetachedElements();\n // If no transitions are running, call the function immediately.\n // Otherwise, add it to a list of callbacks to run at the end of the animation.\n if (transitionsByElement.size === 0) {\n fn();\n } else {\n transitionCallbacks.add(fn);\n }\n });\n}\n"],"names":[],"version":3,"file":"runAfterTransition.main.js.map"}
@@ -1,92 +0,0 @@
1
- import {getEventTarget as $d4ee10de306f2510$export$e58f029f0fbfdb29} from "./DOMFunctions.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
- */ // We store a global list of elements that are currently transitioning,
14
- // mapped to a set of CSS properties that are transitioning for that element.
15
- // This is necessary rather than a simple count of transitions because of browser
16
- // bugs, e.g. Chrome sometimes fires both transitionend and transitioncancel rather
17
- // than one or the other. So we need to track what's actually transitioning so that
18
- // we can ignore these duplicate events.
19
-
20
- let $bbed8b41f857bcc0$var$transitionsByElement = new Map();
21
- // A list of callbacks to call once there are no transitioning elements.
22
- let $bbed8b41f857bcc0$var$transitionCallbacks = new Set();
23
- function $bbed8b41f857bcc0$var$setupGlobalEvents() {
24
- if (typeof window === 'undefined') return;
25
- function isTransitionEvent(event) {
26
- return 'propertyName' in event;
27
- }
28
- let onTransitionStart = (e)=>{
29
- let eventTarget = (0, $d4ee10de306f2510$export$e58f029f0fbfdb29)(e);
30
- if (!isTransitionEvent(e) || !eventTarget) return;
31
- // Add the transitioning property to the list for this element.
32
- let transitions = $bbed8b41f857bcc0$var$transitionsByElement.get(eventTarget);
33
- if (!transitions) {
34
- transitions = new Set();
35
- $bbed8b41f857bcc0$var$transitionsByElement.set(eventTarget, transitions);
36
- // The transitioncancel event must be registered on the element itself, rather than as a global
37
- // event. This enables us to handle when the node is deleted from the document while it is transitioning.
38
- // In that case, the cancel event would have nowhere to bubble to so we need to handle it directly.
39
- eventTarget.addEventListener('transitioncancel', onTransitionEnd, {
40
- once: true
41
- });
42
- }
43
- transitions.add(e.propertyName);
44
- };
45
- let onTransitionEnd = (e)=>{
46
- let eventTarget = (0, $d4ee10de306f2510$export$e58f029f0fbfdb29)(e);
47
- if (!isTransitionEvent(e) || !eventTarget) return;
48
- // Remove property from list of transitioning properties.
49
- let properties = $bbed8b41f857bcc0$var$transitionsByElement.get(eventTarget);
50
- if (!properties) return;
51
- properties.delete(e.propertyName);
52
- // If empty, remove transitioncancel event, and remove the element from the list of transitioning elements.
53
- if (properties.size === 0) {
54
- eventTarget.removeEventListener('transitioncancel', onTransitionEnd);
55
- $bbed8b41f857bcc0$var$transitionsByElement.delete(eventTarget);
56
- }
57
- // If no transitioning elements, call all of the queued callbacks.
58
- if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0) {
59
- for (let cb of $bbed8b41f857bcc0$var$transitionCallbacks)cb();
60
- $bbed8b41f857bcc0$var$transitionCallbacks.clear();
61
- }
62
- };
63
- document.body.addEventListener('transitionrun', onTransitionStart);
64
- document.body.addEventListener('transitionend', onTransitionEnd);
65
- }
66
- if (typeof document !== 'undefined') {
67
- if (document.readyState !== 'loading') $bbed8b41f857bcc0$var$setupGlobalEvents();
68
- else document.addEventListener('DOMContentLoaded', $bbed8b41f857bcc0$var$setupGlobalEvents);
69
- }
70
- /**
71
- * Cleans up any elements that are no longer in the document.
72
- * This is necessary because we can't rely on transitionend events to fire
73
- * for elements that are removed from the document while transitioning.
74
- */ function $bbed8b41f857bcc0$var$cleanupDetachedElements() {
75
- for (const [eventTarget] of $bbed8b41f857bcc0$var$transitionsByElement)// Similar to `eventTarget instanceof Element && !eventTarget.isConnected`, but avoids
76
- // the explicit instanceof check, since it may be different in different contexts.
77
- if ('isConnected' in eventTarget && !eventTarget.isConnected) $bbed8b41f857bcc0$var$transitionsByElement.delete(eventTarget);
78
- }
79
- function $bbed8b41f857bcc0$export$24490316f764c430(fn) {
80
- // Wait one frame to see if an animation starts, e.g. a transition on mount.
81
- requestAnimationFrame(()=>{
82
- $bbed8b41f857bcc0$var$cleanupDetachedElements();
83
- // If no transitions are running, call the function immediately.
84
- // Otherwise, add it to a list of callbacks to run at the end of the animation.
85
- if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0) fn();
86
- else $bbed8b41f857bcc0$var$transitionCallbacks.add(fn);
87
- });
88
- }
89
-
90
-
91
- export {$bbed8b41f857bcc0$export$24490316f764c430 as runAfterTransition};
92
- //# sourceMappingURL=runAfterTransition.module.js.map
@@ -1,92 +0,0 @@
1
- import {getEventTarget as $d4ee10de306f2510$export$e58f029f0fbfdb29} from "./DOMFunctions.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
- */ // We store a global list of elements that are currently transitioning,
14
- // mapped to a set of CSS properties that are transitioning for that element.
15
- // This is necessary rather than a simple count of transitions because of browser
16
- // bugs, e.g. Chrome sometimes fires both transitionend and transitioncancel rather
17
- // than one or the other. So we need to track what's actually transitioning so that
18
- // we can ignore these duplicate events.
19
-
20
- let $bbed8b41f857bcc0$var$transitionsByElement = new Map();
21
- // A list of callbacks to call once there are no transitioning elements.
22
- let $bbed8b41f857bcc0$var$transitionCallbacks = new Set();
23
- function $bbed8b41f857bcc0$var$setupGlobalEvents() {
24
- if (typeof window === 'undefined') return;
25
- function isTransitionEvent(event) {
26
- return 'propertyName' in event;
27
- }
28
- let onTransitionStart = (e)=>{
29
- let eventTarget = (0, $d4ee10de306f2510$export$e58f029f0fbfdb29)(e);
30
- if (!isTransitionEvent(e) || !eventTarget) return;
31
- // Add the transitioning property to the list for this element.
32
- let transitions = $bbed8b41f857bcc0$var$transitionsByElement.get(eventTarget);
33
- if (!transitions) {
34
- transitions = new Set();
35
- $bbed8b41f857bcc0$var$transitionsByElement.set(eventTarget, transitions);
36
- // The transitioncancel event must be registered on the element itself, rather than as a global
37
- // event. This enables us to handle when the node is deleted from the document while it is transitioning.
38
- // In that case, the cancel event would have nowhere to bubble to so we need to handle it directly.
39
- eventTarget.addEventListener('transitioncancel', onTransitionEnd, {
40
- once: true
41
- });
42
- }
43
- transitions.add(e.propertyName);
44
- };
45
- let onTransitionEnd = (e)=>{
46
- let eventTarget = (0, $d4ee10de306f2510$export$e58f029f0fbfdb29)(e);
47
- if (!isTransitionEvent(e) || !eventTarget) return;
48
- // Remove property from list of transitioning properties.
49
- let properties = $bbed8b41f857bcc0$var$transitionsByElement.get(eventTarget);
50
- if (!properties) return;
51
- properties.delete(e.propertyName);
52
- // If empty, remove transitioncancel event, and remove the element from the list of transitioning elements.
53
- if (properties.size === 0) {
54
- eventTarget.removeEventListener('transitioncancel', onTransitionEnd);
55
- $bbed8b41f857bcc0$var$transitionsByElement.delete(eventTarget);
56
- }
57
- // If no transitioning elements, call all of the queued callbacks.
58
- if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0) {
59
- for (let cb of $bbed8b41f857bcc0$var$transitionCallbacks)cb();
60
- $bbed8b41f857bcc0$var$transitionCallbacks.clear();
61
- }
62
- };
63
- document.body.addEventListener('transitionrun', onTransitionStart);
64
- document.body.addEventListener('transitionend', onTransitionEnd);
65
- }
66
- if (typeof document !== 'undefined') {
67
- if (document.readyState !== 'loading') $bbed8b41f857bcc0$var$setupGlobalEvents();
68
- else document.addEventListener('DOMContentLoaded', $bbed8b41f857bcc0$var$setupGlobalEvents);
69
- }
70
- /**
71
- * Cleans up any elements that are no longer in the document.
72
- * This is necessary because we can't rely on transitionend events to fire
73
- * for elements that are removed from the document while transitioning.
74
- */ function $bbed8b41f857bcc0$var$cleanupDetachedElements() {
75
- for (const [eventTarget] of $bbed8b41f857bcc0$var$transitionsByElement)// Similar to `eventTarget instanceof Element && !eventTarget.isConnected`, but avoids
76
- // the explicit instanceof check, since it may be different in different contexts.
77
- if ('isConnected' in eventTarget && !eventTarget.isConnected) $bbed8b41f857bcc0$var$transitionsByElement.delete(eventTarget);
78
- }
79
- function $bbed8b41f857bcc0$export$24490316f764c430(fn) {
80
- // Wait one frame to see if an animation starts, e.g. a transition on mount.
81
- requestAnimationFrame(()=>{
82
- $bbed8b41f857bcc0$var$cleanupDetachedElements();
83
- // If no transitions are running, call the function immediately.
84
- // Otherwise, add it to a list of callbacks to run at the end of the animation.
85
- if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0) fn();
86
- else $bbed8b41f857bcc0$var$transitionCallbacks.add(fn);
87
- });
88
- }
89
-
90
-
91
- export {$bbed8b41f857bcc0$export$24490316f764c430 as runAfterTransition};
92
- //# sourceMappingURL=runAfterTransition.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;AAAA;;;;;;;;;;CAUC,GAED,uEAAuE;AACvE,6EAA6E;AAC7E,iFAAiF;AACjF,mFAAmF;AACnF,mFAAmF;AACnF,wCAAwC;;AAExC,IAAI,6CAAuB,IAAI;AAE/B,wEAAwE;AACxE,IAAI,4CAAsB,IAAI;AAE9B,SAAS;IACP,IAAI,OAAO,WAAW,aACpB;IAGF,SAAS,kBAAkB,KAAY;QACrC,OAAO,kBAAkB;IAC3B;IAEA,IAAI,oBAAoB,CAAC;QACvB,IAAI,cAAc,CAAA,GAAA,yCAAa,EAAE;QACjC,IAAI,CAAC,kBAAkB,MAAM,CAAC,aAC5B;QAEF,+DAA+D;QAC/D,IAAI,cAAc,2CAAqB,GAAG,CAAC;QAC3C,IAAI,CAAC,aAAa;YAChB,cAAc,IAAI;YAClB,2CAAqB,GAAG,CAAC,aAAa;YAEtC,+FAA+F;YAC/F,yGAAyG;YACzG,mGAAmG;YACnG,YAAY,gBAAgB,CAAC,oBAAoB,iBAAiB;gBAChE,MAAM;YACR;QACF;QAEA,YAAY,GAAG,CAAC,EAAE,YAAY;IAChC;IAEA,IAAI,kBAAkB,CAAC;QACrB,IAAI,cAAc,CAAA,GAAA,yCAAa,EAAE;QACjC,IAAI,CAAC,kBAAkB,MAAM,CAAC,aAC5B;QAEF,yDAAyD;QACzD,IAAI,aAAa,2CAAqB,GAAG,CAAC;QAC1C,IAAI,CAAC,YACH;QAGF,WAAW,MAAM,CAAC,EAAE,YAAY;QAEhC,2GAA2G;QAC3G,IAAI,WAAW,IAAI,KAAK,GAAG;YACzB,YAAY,mBAAmB,CAAC,oBAAoB;YACpD,2CAAqB,MAAM,CAAC;QAC9B;QAEA,kEAAkE;QAClE,IAAI,2CAAqB,IAAI,KAAK,GAAG;YACnC,KAAK,IAAI,MAAM,0CACb;YAGF,0CAAoB,KAAK;QAC3B;IACF;IAEA,SAAS,IAAI,CAAC,gBAAgB,CAAC,iBAAiB;IAChD,SAAS,IAAI,CAAC,gBAAgB,CAAC,iBAAiB;AAClD;AAEA,IAAI,OAAO,aAAa;IACtB,IAAI,SAAS,UAAU,KAAK,WAC1B;SAEA,SAAS,gBAAgB,CAAC,oBAAoB;;AAIlD;;;;CAIC,GACD,SAAS;IACP,KAAK,MAAM,CAAC,YAAY,IAAI,2CAC1B,sFAAsF;IACtF,kFAAkF;IAClF,IAAI,iBAAiB,eAAe,CAAC,YAAY,WAAW,EAC1D,2CAAqB,MAAM,CAAC;AAGlC;AAEO,SAAS,0CAAmB,EAAc;IAC/C,4EAA4E;IAC5E,sBAAsB;QACpB;QACA,gEAAgE;QAChE,+EAA+E;QAC/E,IAAI,2CAAqB,IAAI,KAAK,GAChC;aAEA,0CAAoB,GAAG,CAAC;IAE5B;AACF","sources":["packages/@react-aria/utils/src/runAfterTransition.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\n// We store a global list of elements that are currently transitioning,\n// mapped to a set of CSS properties that are transitioning for that element.\n// This is necessary rather than a simple count of transitions because of browser\n// bugs, e.g. Chrome sometimes fires both transitionend and transitioncancel rather\n// than one or the other. So we need to track what's actually transitioning so that\n// we can ignore these duplicate events.\nimport {getEventTarget} from './shadowdom/DOMFunctions';\nlet transitionsByElement = new Map<EventTarget, Set<string>>();\n\n// A list of callbacks to call once there are no transitioning elements.\nlet transitionCallbacks = new Set<() => void>();\n\nfunction setupGlobalEvents() {\n if (typeof window === 'undefined') {\n return;\n }\n\n function isTransitionEvent(event: Event): event is TransitionEvent {\n return 'propertyName' in event;\n }\n\n let onTransitionStart = (e: Event) => {\n let eventTarget = getEventTarget(e);\n if (!isTransitionEvent(e) || !eventTarget) {\n return;\n }\n // Add the transitioning property to the list for this element.\n let transitions = transitionsByElement.get(eventTarget);\n if (!transitions) {\n transitions = new Set();\n transitionsByElement.set(eventTarget, transitions);\n\n // The transitioncancel event must be registered on the element itself, rather than as a global\n // event. This enables us to handle when the node is deleted from the document while it is transitioning.\n // In that case, the cancel event would have nowhere to bubble to so we need to handle it directly.\n eventTarget.addEventListener('transitioncancel', onTransitionEnd, {\n once: true\n });\n }\n\n transitions.add(e.propertyName);\n };\n\n let onTransitionEnd = (e: Event) => {\n let eventTarget = getEventTarget(e);\n if (!isTransitionEvent(e) || !eventTarget) {\n return;\n }\n // Remove property from list of transitioning properties.\n let properties = transitionsByElement.get(eventTarget);\n if (!properties) {\n return;\n }\n\n properties.delete(e.propertyName);\n\n // If empty, remove transitioncancel event, and remove the element from the list of transitioning elements.\n if (properties.size === 0) {\n eventTarget.removeEventListener('transitioncancel', onTransitionEnd);\n transitionsByElement.delete(eventTarget);\n }\n\n // If no transitioning elements, call all of the queued callbacks.\n if (transitionsByElement.size === 0) {\n for (let cb of transitionCallbacks) {\n cb();\n }\n\n transitionCallbacks.clear();\n }\n };\n\n document.body.addEventListener('transitionrun', onTransitionStart);\n document.body.addEventListener('transitionend', onTransitionEnd);\n}\n\nif (typeof document !== 'undefined') {\n if (document.readyState !== 'loading') {\n setupGlobalEvents();\n } else {\n document.addEventListener('DOMContentLoaded', setupGlobalEvents);\n }\n}\n\n/**\n * Cleans up any elements that are no longer in the document.\n * This is necessary because we can't rely on transitionend events to fire\n * for elements that are removed from the document while transitioning.\n */\nfunction cleanupDetachedElements() {\n for (const [eventTarget] of transitionsByElement) {\n // Similar to `eventTarget instanceof Element && !eventTarget.isConnected`, but avoids\n // the explicit instanceof check, since it may be different in different contexts.\n if ('isConnected' in eventTarget && !eventTarget.isConnected) {\n transitionsByElement.delete(eventTarget);\n }\n }\n}\n\nexport function runAfterTransition(fn: () => void): void {\n // Wait one frame to see if an animation starts, e.g. a transition on mount.\n requestAnimationFrame(() => {\n cleanupDetachedElements();\n // If no transitions are running, call the function immediately.\n // Otherwise, add it to a list of callbacks to run at the end of the animation.\n if (transitionsByElement.size === 0) {\n fn();\n } else {\n transitionCallbacks.add(fn);\n }\n });\n}\n"],"names":[],"version":3,"file":"runAfterTransition.module.js.map"}
@@ -1,138 +0,0 @@
1
- var $49f0d9486c2408aa$exports = require("./getScrollParents.main.js");
2
- var $9e20cff0af27e8cc$exports = require("./platform.main.js");
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, "scrollIntoView", () => $449412113267a1fe$export$53a0910f038337bd);
10
- $parcel$export(module.exports, "scrollIntoViewport", () => $449412113267a1fe$export$c826860796309d1b);
11
- /*
12
- * Copyright 2020 Adobe. All rights reserved.
13
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14
- * you may not use this file except in compliance with the License. You may obtain a copy
15
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
16
- *
17
- * Unless required by applicable law or agreed to in writing, software distributed under
18
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
19
- * OF ANY KIND, either express or implied. See the License for the specific language
20
- * governing permissions and limitations under the License.
21
- */
22
-
23
- function $449412113267a1fe$export$53a0910f038337bd(scrollView, element, opts = {}) {
24
- let { block: block = 'nearest', inline: inline = 'nearest' } = opts;
25
- if (scrollView === element) return;
26
- let y = scrollView.scrollTop;
27
- let x = scrollView.scrollLeft;
28
- let target = element.getBoundingClientRect();
29
- let view = scrollView.getBoundingClientRect();
30
- let itemStyle = window.getComputedStyle(element);
31
- let viewStyle = window.getComputedStyle(scrollView);
32
- let root = document.scrollingElement || document.documentElement;
33
- let viewTop = scrollView === root ? 0 : view.top;
34
- let viewBottom = scrollView === root ? scrollView.clientHeight : view.bottom;
35
- let viewLeft = scrollView === root ? 0 : view.left;
36
- let viewRight = scrollView === root ? scrollView.clientWidth : view.right;
37
- let scrollMarginTop = parseInt(itemStyle.scrollMarginTop, 10) || 0;
38
- let scrollMarginBottom = parseInt(itemStyle.scrollMarginBottom, 10) || 0;
39
- let scrollMarginLeft = parseInt(itemStyle.scrollMarginLeft, 10) || 0;
40
- let scrollMarginRight = parseInt(itemStyle.scrollMarginRight, 10) || 0;
41
- let scrollPaddingTop = parseInt(viewStyle.scrollPaddingTop, 10) || 0;
42
- let scrollPaddingBottom = parseInt(viewStyle.scrollPaddingBottom, 10) || 0;
43
- let scrollPaddingLeft = parseInt(viewStyle.scrollPaddingLeft, 10) || 0;
44
- let scrollPaddingRight = parseInt(viewStyle.scrollPaddingRight, 10) || 0;
45
- let borderTopWidth = parseInt(viewStyle.borderTopWidth, 10) || 0;
46
- let borderBottomWidth = parseInt(viewStyle.borderBottomWidth, 10) || 0;
47
- let borderLeftWidth = parseInt(viewStyle.borderLeftWidth, 10) || 0;
48
- let borderRightWidth = parseInt(viewStyle.borderRightWidth, 10) || 0;
49
- let scrollAreaTop = target.top - scrollMarginTop;
50
- let scrollAreaBottom = target.bottom + scrollMarginBottom;
51
- let scrollAreaLeft = target.left - scrollMarginLeft;
52
- let scrollAreaRight = target.right + scrollMarginRight;
53
- let scrollBarOffsetX = scrollView === root ? 0 : borderLeftWidth + borderRightWidth;
54
- let scrollBarOffsetY = scrollView === root ? 0 : borderTopWidth + borderBottomWidth;
55
- let scrollBarWidth = scrollView.offsetWidth - scrollView.clientWidth - scrollBarOffsetX;
56
- let scrollBarHeight = scrollView.offsetHeight - scrollView.clientHeight - scrollBarOffsetY;
57
- let scrollPortTop = viewTop + borderTopWidth + scrollPaddingTop;
58
- let scrollPortBottom = viewBottom - borderBottomWidth - scrollPaddingBottom - scrollBarHeight;
59
- let scrollPortLeft = viewLeft + borderLeftWidth + scrollPaddingLeft;
60
- let scrollPortRight = viewRight - borderRightWidth - scrollPaddingRight;
61
- // IOS always positions the scrollbar on the right ¯\_(ツ)_/¯
62
- if (viewStyle.direction === 'rtl' && !(0, $9e20cff0af27e8cc$exports.isIOS)()) scrollPortLeft += scrollBarWidth;
63
- else scrollPortRight -= scrollBarWidth;
64
- let shouldScrollBlock = scrollAreaTop < scrollPortTop || scrollAreaBottom > scrollPortBottom;
65
- let shouldScrollInline = scrollAreaLeft < scrollPortLeft || scrollAreaRight > scrollPortRight;
66
- if (shouldScrollBlock && block === 'start') y += scrollAreaTop - scrollPortTop;
67
- else if (shouldScrollBlock && block === 'center') y += (scrollAreaTop + scrollAreaBottom) / 2 - (scrollPortTop + scrollPortBottom) / 2;
68
- else if (shouldScrollBlock && block === 'end') y += scrollAreaBottom - scrollPortBottom;
69
- else if (shouldScrollBlock && block === 'nearest') {
70
- let start = scrollAreaTop - scrollPortTop;
71
- let end = scrollAreaBottom - scrollPortBottom;
72
- y += Math.abs(start) <= Math.abs(end) ? start : end;
73
- }
74
- if (shouldScrollInline && inline === 'start') x += scrollAreaLeft - scrollPortLeft;
75
- else if (shouldScrollInline && inline === 'center') x += (scrollAreaLeft + scrollAreaRight) / 2 - (scrollPortLeft + scrollPortRight) / 2;
76
- else if (shouldScrollInline && inline === 'end') x += scrollAreaRight - scrollPortRight;
77
- else if (shouldScrollInline && inline === 'nearest') {
78
- let start = scrollAreaLeft - scrollPortLeft;
79
- let end = scrollAreaRight - scrollPortRight;
80
- x += Math.abs(start) <= Math.abs(end) ? start : end;
81
- }
82
- if (process.env.NODE_ENV === 'test') {
83
- scrollView.scrollLeft = x;
84
- scrollView.scrollTop = y;
85
- return;
86
- }
87
- scrollView.scrollTo({
88
- left: x,
89
- top: y
90
- });
91
- }
92
- function $449412113267a1fe$export$c826860796309d1b(targetElement, opts = {}) {
93
- let { containingElement: containingElement } = opts;
94
- if (targetElement && targetElement.isConnected) {
95
- let root = document.scrollingElement || document.documentElement;
96
- let isScrollPrevented = window.getComputedStyle(root).overflow === 'hidden';
97
- // If scrolling is not currently prevented then we aren't in a overlay nor is a overlay open, just use element.scrollIntoView to bring the element into view
98
- // Also ignore in chrome because of this bug: https://issues.chromium.org/issues/40074749
99
- if (!isScrollPrevented && !(0, $9e20cff0af27e8cc$exports.isChrome)()) {
100
- var // use scrollIntoView({block: 'nearest'}) instead of .focus to check if the element is fully in view or not since .focus()
101
- // won't cause a scroll if the element is already focused and doesn't behave consistently when an element is partially out of view horizontally vs vertically
102
- _targetElement_scrollIntoView;
103
- let { left: originalLeft, top: originalTop } = targetElement.getBoundingClientRect();
104
- targetElement === null || targetElement === void 0 ? void 0 : (_targetElement_scrollIntoView = targetElement.scrollIntoView) === null || _targetElement_scrollIntoView === void 0 ? void 0 : _targetElement_scrollIntoView.call(targetElement, {
105
- block: 'nearest'
106
- });
107
- let { left: newLeft, top: newTop } = targetElement.getBoundingClientRect();
108
- // Account for sub pixel differences from rounding
109
- if (Math.abs(originalLeft - newLeft) > 1 || Math.abs(originalTop - newTop) > 1) {
110
- var _containingElement_scrollIntoView, _targetElement_scrollIntoView1;
111
- containingElement === null || containingElement === void 0 ? void 0 : (_containingElement_scrollIntoView = containingElement.scrollIntoView) === null || _containingElement_scrollIntoView === void 0 ? void 0 : _containingElement_scrollIntoView.call(containingElement, {
112
- block: 'center',
113
- inline: 'center'
114
- });
115
- (_targetElement_scrollIntoView1 = targetElement.scrollIntoView) === null || _targetElement_scrollIntoView1 === void 0 ? void 0 : _targetElement_scrollIntoView1.call(targetElement, {
116
- block: 'nearest'
117
- });
118
- }
119
- } else {
120
- let { left: originalLeft, top: originalTop } = targetElement.getBoundingClientRect();
121
- // If scrolling is prevented, we don't want to scroll the body since it might move the overlay partially offscreen and the user can't scroll it back into view.
122
- let scrollParents = (0, $49f0d9486c2408aa$exports.getScrollParents)(targetElement, true);
123
- for (let scrollParent of scrollParents)$449412113267a1fe$export$53a0910f038337bd(scrollParent, targetElement);
124
- let { left: newLeft, top: newTop } = targetElement.getBoundingClientRect();
125
- // Account for sub pixel differences from rounding
126
- if (Math.abs(originalLeft - newLeft) > 1 || Math.abs(originalTop - newTop) > 1) {
127
- scrollParents = containingElement ? (0, $49f0d9486c2408aa$exports.getScrollParents)(containingElement, true) : [];
128
- for (let scrollParent of scrollParents)$449412113267a1fe$export$53a0910f038337bd(scrollParent, containingElement, {
129
- block: 'center',
130
- inline: 'center'
131
- });
132
- }
133
- }
134
- }
135
- }
136
-
137
-
138
- //# sourceMappingURL=scrollIntoView.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":"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","sources":["packages/@react-aria/utils/src/scrollIntoView.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 {getScrollParents} from './getScrollParents';\nimport {isChrome, isIOS} from './platform';\n\ninterface ScrollIntoViewOpts {\n /** The position to align items along the block axis in. */\n block?: ScrollLogicalPosition,\n /** The position to align items along the inline axis in. */\n inline?: ScrollLogicalPosition\n}\n\n\ninterface ScrollIntoViewportOpts {\n /** The optional containing element of the target to be centered in the viewport. */\n containingElement?: Element | null\n}\n\n/**\n * Scrolls `scrollView` so that `element` is visible.\n * Similar to `element.scrollIntoView({block: 'nearest'})` (not supported in Edge),\n * but doesn't affect parents above `scrollView`.\n */\nexport function scrollIntoView(scrollView: HTMLElement, element: HTMLElement, opts: ScrollIntoViewOpts = {}): void {\n let {block = 'nearest', inline = 'nearest'} = opts;\n\n if (scrollView === element) { return; }\n\n let y = scrollView.scrollTop;\n let x = scrollView.scrollLeft;\n\n let target = element.getBoundingClientRect();\n let view = scrollView.getBoundingClientRect();\n let itemStyle = window.getComputedStyle(element);\n let viewStyle = window.getComputedStyle(scrollView);\n let root = document.scrollingElement || document.documentElement;\n\n let viewTop = scrollView === root ? 0 : view.top;\n let viewBottom = scrollView === root ? scrollView.clientHeight : view.bottom;\n let viewLeft = scrollView === root ? 0 : view.left;\n let viewRight = scrollView === root ? scrollView.clientWidth : view.right;\n\n let scrollMarginTop = parseInt(itemStyle.scrollMarginTop, 10) || 0;\n let scrollMarginBottom = parseInt(itemStyle.scrollMarginBottom, 10) || 0;\n let scrollMarginLeft = parseInt(itemStyle.scrollMarginLeft, 10) || 0;\n let scrollMarginRight = parseInt(itemStyle.scrollMarginRight, 10) || 0;\n\n let scrollPaddingTop = parseInt(viewStyle.scrollPaddingTop, 10) || 0;\n let scrollPaddingBottom = parseInt(viewStyle.scrollPaddingBottom, 10) || 0;\n let scrollPaddingLeft = parseInt(viewStyle.scrollPaddingLeft, 10) || 0;\n let scrollPaddingRight = parseInt(viewStyle.scrollPaddingRight, 10) || 0;\n\n let borderTopWidth = parseInt(viewStyle.borderTopWidth, 10) || 0;\n let borderBottomWidth = parseInt(viewStyle.borderBottomWidth, 10) || 0;\n let borderLeftWidth = parseInt(viewStyle.borderLeftWidth, 10) || 0;\n let borderRightWidth = parseInt(viewStyle.borderRightWidth, 10) || 0;\n\n let scrollAreaTop = target.top - scrollMarginTop;\n let scrollAreaBottom = target.bottom + scrollMarginBottom;\n let scrollAreaLeft = target.left - scrollMarginLeft;\n let scrollAreaRight = target.right + scrollMarginRight;\n\n let scrollBarOffsetX = scrollView === root ? 0 : borderLeftWidth + borderRightWidth;\n let scrollBarOffsetY = scrollView === root ? 0 : borderTopWidth + borderBottomWidth;\n let scrollBarWidth = scrollView.offsetWidth - scrollView.clientWidth - scrollBarOffsetX;\n let scrollBarHeight = scrollView.offsetHeight - scrollView.clientHeight - scrollBarOffsetY;\n\n let scrollPortTop = viewTop + borderTopWidth + scrollPaddingTop;\n let scrollPortBottom = viewBottom - borderBottomWidth - scrollPaddingBottom - scrollBarHeight;\n let scrollPortLeft = viewLeft + borderLeftWidth + scrollPaddingLeft;\n let scrollPortRight = viewRight - borderRightWidth - scrollPaddingRight;\n\n // IOS always positions the scrollbar on the right ¯\\_(ツ)_/¯\n if (viewStyle.direction === 'rtl' && !isIOS()) {\n scrollPortLeft += scrollBarWidth;\n } else {\n scrollPortRight -= scrollBarWidth;\n }\n\n let shouldScrollBlock = scrollAreaTop < scrollPortTop || scrollAreaBottom > scrollPortBottom;\n let shouldScrollInline = scrollAreaLeft < scrollPortLeft || scrollAreaRight > scrollPortRight;\n\n if (shouldScrollBlock && block === 'start') {\n y += scrollAreaTop - scrollPortTop;\n } else if (shouldScrollBlock && block === 'center') {\n y += (scrollAreaTop + scrollAreaBottom) / 2 - (scrollPortTop + scrollPortBottom) / 2;\n } else if (shouldScrollBlock && block === 'end') {\n y += scrollAreaBottom - scrollPortBottom;\n } else if (shouldScrollBlock && block === 'nearest') {\n let start = scrollAreaTop - scrollPortTop;\n let end = scrollAreaBottom - scrollPortBottom;\n y += Math.abs(start) <= Math.abs(end) ? start : end;\n }\n\n if (shouldScrollInline && inline === 'start') {\n x += scrollAreaLeft - scrollPortLeft;\n } else if (shouldScrollInline && inline === 'center') {\n x += (scrollAreaLeft + scrollAreaRight) / 2 - (scrollPortLeft + scrollPortRight) / 2;\n } else if (shouldScrollInline && inline === 'end') {\n x += scrollAreaRight - scrollPortRight;\n } else if (shouldScrollInline && inline === 'nearest') {\n let start = scrollAreaLeft - scrollPortLeft;\n let end = scrollAreaRight - scrollPortRight;\n x += Math.abs(start) <= Math.abs(end) ? start : end;\n }\n\n if (process.env.NODE_ENV === 'test') {\n scrollView.scrollLeft = x;\n scrollView.scrollTop = y;\n return;\n }\n\n scrollView.scrollTo({left: x, top: y});\n}\n\n/**\n * Scrolls the `targetElement` so it is visible in the viewport. Accepts an optional `opts.containingElement`\n * that will be centered in the viewport prior to scrolling the targetElement into view. If scrolling is prevented on\n * the body (e.g. targetElement is in a popover), this will only scroll the scroll parents of the targetElement up to but not including the body itself.\n */\nexport function scrollIntoViewport(targetElement: Element | null, opts: ScrollIntoViewportOpts = {}): void {\n let {containingElement} = opts;\n if (targetElement && targetElement.isConnected) {\n let root = document.scrollingElement || document.documentElement;\n let isScrollPrevented = window.getComputedStyle(root).overflow === 'hidden';\n // If scrolling is not currently prevented then we aren't in a overlay nor is a overlay open, just use element.scrollIntoView to bring the element into view\n // Also ignore in chrome because of this bug: https://issues.chromium.org/issues/40074749\n if (!isScrollPrevented && !isChrome()) {\n let {left: originalLeft, top: originalTop} = targetElement.getBoundingClientRect();\n\n // use scrollIntoView({block: 'nearest'}) instead of .focus to check if the element is fully in view or not since .focus()\n // won't cause a scroll if the element is already focused and doesn't behave consistently when an element is partially out of view horizontally vs vertically\n targetElement?.scrollIntoView?.({block: 'nearest'});\n let {left: newLeft, top: newTop} = targetElement.getBoundingClientRect();\n // Account for sub pixel differences from rounding\n if ((Math.abs(originalLeft - newLeft) > 1) || (Math.abs(originalTop - newTop) > 1)) {\n containingElement?.scrollIntoView?.({block: 'center', inline: 'center'});\n targetElement.scrollIntoView?.({block: 'nearest'});\n }\n } else {\n let {left: originalLeft, top: originalTop} = targetElement.getBoundingClientRect();\n\n // If scrolling is prevented, we don't want to scroll the body since it might move the overlay partially offscreen and the user can't scroll it back into view.\n let scrollParents = getScrollParents(targetElement, true);\n for (let scrollParent of scrollParents) {\n scrollIntoView(scrollParent as HTMLElement, targetElement as HTMLElement);\n }\n let {left: newLeft, top: newTop} = targetElement.getBoundingClientRect();\n // Account for sub pixel differences from rounding\n if ((Math.abs(originalLeft - newLeft) > 1) || (Math.abs(originalTop - newTop) > 1)) {\n scrollParents = containingElement ? getScrollParents(containingElement, true) : [];\n for (let scrollParent of scrollParents) {\n scrollIntoView(scrollParent as HTMLElement, containingElement as HTMLElement, {block: 'center', inline: 'center'});\n }\n }\n }\n }\n}\n"],"names":[],"version":3,"file":"scrollIntoView.main.js.map"}