@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.
- package/dist/import.mjs +47 -43
- package/dist/main.js +120 -114
- package/dist/main.js.map +1 -1
- package/dist/module.js +47 -43
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +45 -0
- package/package.json +15 -15
- package/src/index.ts +45 -43
- package/dist/DOMFunctions.main.js +0 -44
- package/dist/DOMFunctions.main.js.map +0 -1
- package/dist/DOMFunctions.mjs +0 -37
- package/dist/DOMFunctions.module.js +0 -37
- package/dist/DOMFunctions.module.js.map +0 -1
- package/dist/ShadowTreeWalker.main.js +0 -200
- package/dist/ShadowTreeWalker.main.js.map +0 -1
- package/dist/ShadowTreeWalker.mjs +0 -194
- package/dist/ShadowTreeWalker.module.js +0 -194
- package/dist/ShadowTreeWalker.module.js.map +0 -1
- package/dist/animation.main.js +0 -97
- package/dist/animation.main.js.map +0 -1
- package/dist/animation.mjs +0 -91
- package/dist/animation.module.js +0 -91
- package/dist/animation.module.js.map +0 -1
- package/dist/chain.main.js +0 -26
- package/dist/chain.main.js.map +0 -1
- package/dist/chain.mjs +0 -21
- package/dist/chain.module.js +0 -21
- package/dist/chain.module.js.map +0 -1
- package/dist/constants.main.js +0 -23
- package/dist/constants.main.js.map +0 -1
- package/dist/constants.mjs +0 -17
- package/dist/constants.module.js +0 -17
- package/dist/constants.module.js.map +0 -1
- package/dist/domHelpers.main.js +0 -28
- package/dist/domHelpers.main.js.map +0 -1
- package/dist/domHelpers.mjs +0 -21
- package/dist/domHelpers.module.js +0 -21
- package/dist/domHelpers.module.js.map +0 -1
- package/dist/filterDOMProps.main.js +0 -88
- package/dist/filterDOMProps.main.js.map +0 -1
- package/dist/filterDOMProps.mjs +0 -83
- package/dist/filterDOMProps.module.js +0 -83
- package/dist/filterDOMProps.module.js.map +0 -1
- package/dist/focusWithoutScrolling.main.js +0 -72
- package/dist/focusWithoutScrolling.main.js.map +0 -1
- package/dist/focusWithoutScrolling.mjs +0 -67
- package/dist/focusWithoutScrolling.module.js +0 -67
- package/dist/focusWithoutScrolling.module.js.map +0 -1
- package/dist/getOffset.main.js +0 -24
- package/dist/getOffset.main.js.map +0 -1
- package/dist/getOffset.mjs +0 -19
- package/dist/getOffset.module.js +0 -19
- package/dist/getOffset.module.js.map +0 -1
- package/dist/getScrollParent.main.js +0 -28
- package/dist/getScrollParent.main.js.map +0 -1
- package/dist/getScrollParent.mjs +0 -23
- package/dist/getScrollParent.module.js +0 -23
- package/dist/getScrollParent.module.js.map +0 -1
- package/dist/getScrollParents.main.js +0 -30
- package/dist/getScrollParents.main.js.map +0 -1
- package/dist/getScrollParents.mjs +0 -25
- package/dist/getScrollParents.module.js +0 -25
- package/dist/getScrollParents.module.js.map +0 -1
- package/dist/inertValue.main.js +0 -19
- package/dist/inertValue.main.js.map +0 -1
- package/dist/inertValue.mjs +0 -14
- package/dist/inertValue.module.js +0 -14
- package/dist/inertValue.module.js.map +0 -1
- package/dist/isElementVisible.main.js +0 -45
- package/dist/isElementVisible.main.js.map +0 -1
- package/dist/isElementVisible.mjs +0 -40
- package/dist/isElementVisible.module.js +0 -40
- package/dist/isElementVisible.module.js.map +0 -1
- package/dist/isFocusable.main.js +0 -56
- package/dist/isFocusable.main.js.map +0 -1
- package/dist/isFocusable.mjs +0 -50
- package/dist/isFocusable.module.js +0 -50
- package/dist/isFocusable.module.js.map +0 -1
- package/dist/isScrollable.main.js +0 -26
- package/dist/isScrollable.main.js.map +0 -1
- package/dist/isScrollable.mjs +0 -21
- package/dist/isScrollable.module.js +0 -21
- package/dist/isScrollable.module.js.map +0 -1
- package/dist/isVirtualEvent.main.js +0 -41
- package/dist/isVirtualEvent.main.js.map +0 -1
- package/dist/isVirtualEvent.mjs +0 -35
- package/dist/isVirtualEvent.module.js +0 -35
- package/dist/isVirtualEvent.module.js.map +0 -1
- package/dist/keyboard.main.js +0 -42
- package/dist/keyboard.main.js.map +0 -1
- package/dist/keyboard.mjs +0 -36
- package/dist/keyboard.module.js +0 -36
- package/dist/keyboard.module.js.map +0 -1
- package/dist/mergeProps.main.js +0 -54
- package/dist/mergeProps.main.js.map +0 -1
- package/dist/mergeProps.mjs +0 -45
- package/dist/mergeProps.module.js +0 -45
- package/dist/mergeProps.module.js.map +0 -1
- package/dist/mergeRefs.main.js +0 -40
- package/dist/mergeRefs.main.js.map +0 -1
- package/dist/mergeRefs.mjs +0 -35
- package/dist/mergeRefs.module.js +0 -35
- package/dist/mergeRefs.module.js.map +0 -1
- package/dist/openLink.main.js +0 -169
- package/dist/openLink.main.js.map +0 -1
- package/dist/openLink.mjs +0 -153
- package/dist/openLink.module.js +0 -153
- package/dist/openLink.module.js.map +0 -1
- package/dist/platform.main.js +0 -73
- package/dist/platform.main.js.map +0 -1
- package/dist/platform.mjs +0 -60
- package/dist/platform.module.js +0 -60
- package/dist/platform.module.js.map +0 -1
- package/dist/runAfterTransition.main.js +0 -92
- package/dist/runAfterTransition.main.js.map +0 -1
- package/dist/runAfterTransition.mjs +0 -87
- package/dist/runAfterTransition.module.js +0 -87
- package/dist/runAfterTransition.module.js.map +0 -1
- package/dist/scrollIntoView.main.js +0 -105
- package/dist/scrollIntoView.main.js.map +0 -1
- package/dist/scrollIntoView.mjs +0 -99
- package/dist/scrollIntoView.module.js +0 -99
- package/dist/scrollIntoView.module.js.map +0 -1
- package/dist/types.d.ts +0 -286
- package/dist/types.d.ts.map +0 -1
- package/dist/useDeepMemo.main.js +0 -30
- package/dist/useDeepMemo.main.js.map +0 -1
- package/dist/useDeepMemo.mjs +0 -25
- package/dist/useDeepMemo.module.js +0 -25
- package/dist/useDeepMemo.module.js.map +0 -1
- package/dist/useDescription.main.js +0 -59
- package/dist/useDescription.main.js.map +0 -1
- package/dist/useDescription.mjs +0 -54
- package/dist/useDescription.module.js +0 -54
- package/dist/useDescription.module.js.map +0 -1
- package/dist/useDrag1D.main.js +0 -141
- package/dist/useDrag1D.main.js.map +0 -1
- package/dist/useDrag1D.mjs +0 -136
- package/dist/useDrag1D.module.js +0 -136
- package/dist/useDrag1D.module.js.map +0 -1
- package/dist/useEffectEvent.main.js +0 -45
- package/dist/useEffectEvent.main.js.map +0 -1
- package/dist/useEffectEvent.mjs +0 -36
- package/dist/useEffectEvent.module.js +0 -36
- package/dist/useEffectEvent.module.js.map +0 -1
- package/dist/useEvent.main.js +0 -41
- package/dist/useEvent.main.js.map +0 -1
- package/dist/useEvent.mjs +0 -36
- package/dist/useEvent.module.js +0 -36
- package/dist/useEvent.module.js.map +0 -1
- package/dist/useFormReset.main.js +0 -39
- package/dist/useFormReset.main.js.map +0 -1
- package/dist/useFormReset.mjs +0 -34
- package/dist/useFormReset.module.js +0 -34
- package/dist/useFormReset.module.js.map +0 -1
- package/dist/useGlobalListeners.main.js +0 -62
- package/dist/useGlobalListeners.main.js.map +0 -1
- package/dist/useGlobalListeners.mjs +0 -57
- package/dist/useGlobalListeners.module.js +0 -57
- package/dist/useGlobalListeners.module.js.map +0 -1
- package/dist/useId.main.js +0 -108
- package/dist/useId.main.js.map +0 -1
- package/dist/useId.mjs +0 -101
- package/dist/useId.module.js +0 -101
- package/dist/useId.module.js.map +0 -1
- package/dist/useLabels.main.js +0 -44
- package/dist/useLabels.main.js.map +0 -1
- package/dist/useLabels.mjs +0 -39
- package/dist/useLabels.module.js +0 -39
- package/dist/useLabels.module.js.map +0 -1
- package/dist/useLayoutEffect.main.js +0 -27
- package/dist/useLayoutEffect.main.js.map +0 -1
- package/dist/useLayoutEffect.mjs +0 -18
- package/dist/useLayoutEffect.module.js +0 -18
- package/dist/useLayoutEffect.module.js.map +0 -1
- package/dist/useLoadMore.main.js +0 -73
- package/dist/useLoadMore.main.js.map +0 -1
- package/dist/useLoadMore.mjs +0 -68
- package/dist/useLoadMore.module.js +0 -68
- package/dist/useLoadMore.module.js.map +0 -1
- package/dist/useLoadMoreSentinel.main.js +0 -58
- package/dist/useLoadMoreSentinel.main.js.map +0 -1
- package/dist/useLoadMoreSentinel.mjs +0 -53
- package/dist/useLoadMoreSentinel.module.js +0 -53
- package/dist/useLoadMoreSentinel.module.js.map +0 -1
- package/dist/useObjectRef.main.js +0 -58
- package/dist/useObjectRef.main.js.map +0 -1
- package/dist/useObjectRef.mjs +0 -53
- package/dist/useObjectRef.module.js +0 -53
- package/dist/useObjectRef.module.js.map +0 -1
- package/dist/useResizeObserver.main.js +0 -47
- package/dist/useResizeObserver.main.js.map +0 -1
- package/dist/useResizeObserver.mjs +0 -42
- package/dist/useResizeObserver.module.js +0 -42
- package/dist/useResizeObserver.module.js.map +0 -1
- package/dist/useSyncRef.main.js +0 -32
- package/dist/useSyncRef.main.js.map +0 -1
- package/dist/useSyncRef.mjs +0 -27
- package/dist/useSyncRef.module.js +0 -27
- package/dist/useSyncRef.module.js.map +0 -1
- package/dist/useUpdateEffect.main.js +0 -42
- package/dist/useUpdateEffect.main.js.map +0 -1
- package/dist/useUpdateEffect.mjs +0 -37
- package/dist/useUpdateEffect.module.js +0 -37
- package/dist/useUpdateEffect.module.js.map +0 -1
- package/dist/useUpdateLayoutEffect.main.js +0 -40
- package/dist/useUpdateLayoutEffect.main.js.map +0 -1
- package/dist/useUpdateLayoutEffect.mjs +0 -35
- package/dist/useUpdateLayoutEffect.module.js +0 -35
- package/dist/useUpdateLayoutEffect.module.js.map +0 -1
- package/dist/useValueEffect.main.js +0 -63
- package/dist/useValueEffect.main.js.map +0 -1
- package/dist/useValueEffect.mjs +0 -58
- package/dist/useValueEffect.module.js +0 -58
- package/dist/useValueEffect.module.js.map +0 -1
- package/dist/useViewportSize.main.js +0 -79
- package/dist/useViewportSize.main.js.map +0 -1
- package/dist/useViewportSize.mjs +0 -74
- package/dist/useViewportSize.module.js +0 -74
- package/dist/useViewportSize.module.js.map +0 -1
- package/src/animation.ts +0 -103
- package/src/chain.ts +0 -24
- package/src/constants.ts +0 -15
- package/src/domHelpers.ts +0 -33
- package/src/filterDOMProps.ts +0 -127
- package/src/focusWithoutScrolling.ts +0 -96
- package/src/getOffset.ts +0 -21
- package/src/getScrollParent.ts +0 -27
- package/src/getScrollParents.ts +0 -26
- package/src/inertValue.ts +0 -11
- package/src/isElementVisible.ts +0 -75
- package/src/isFocusable.ts +0 -56
- package/src/isScrollable.ts +0 -25
- package/src/isVirtualEvent.ts +0 -58
- package/src/keyboard.tsx +0 -48
- package/src/mergeProps.ts +0 -77
- package/src/mergeRefs.ts +0 -52
- package/src/openLink.tsx +0 -201
- package/src/platform.ts +0 -78
- package/src/runAfterTransition.ts +0 -121
- package/src/scrollIntoView.ts +0 -129
- package/src/shadowdom/DOMFunctions.ts +0 -71
- package/src/shadowdom/ShadowTreeWalker.ts +0 -319
- package/src/useDeepMemo.ts +0 -27
- package/src/useDescription.ts +0 -56
- package/src/useDrag1D.ts +0 -191
- package/src/useEffectEvent.ts +0 -30
- package/src/useEvent.ts +0 -37
- package/src/useFormReset.ts +0 -36
- package/src/useGlobalListeners.ts +0 -52
- package/src/useId.ts +0 -129
- package/src/useLabels.ts +0 -48
- package/src/useLayoutEffect.ts +0 -20
- package/src/useLoadMore.ts +0 -82
- package/src/useLoadMoreSentinel.ts +0 -63
- package/src/useObjectRef.ts +0 -69
- package/src/useResizeObserver.ts +0 -52
- package/src/useSyncRef.ts +0 -33
- package/src/useUpdateEffect.ts +0 -39
- package/src/useUpdateLayoutEffect.ts +0 -37
- package/src/useValueEffect.ts +0 -68
- package/src/useViewportSize.ts +0 -96
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
|
package/dist/platform.module.js
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 +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,92 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
function $parcel$export(e, n, v, s) {
|
|
3
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
$parcel$export(module.exports, "runAfterTransition", () => $e8117ebcab55be6a$export$24490316f764c430);
|
|
7
|
-
/*
|
|
8
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
9
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
10
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
11
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
14
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
15
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
|
-
* governing permissions and limitations under the License.
|
|
17
|
-
*/ // We store a global list of elements that are currently transitioning,
|
|
18
|
-
// mapped to a set of CSS properties that are transitioning for that element.
|
|
19
|
-
// This is necessary rather than a simple count of transitions because of browser
|
|
20
|
-
// bugs, e.g. Chrome sometimes fires both transitionend and transitioncancel rather
|
|
21
|
-
// than one or the other. So we need to track what's actually transitioning so that
|
|
22
|
-
// we can ignore these duplicate events.
|
|
23
|
-
let $e8117ebcab55be6a$var$transitionsByElement = new Map();
|
|
24
|
-
// A list of callbacks to call once there are no transitioning elements.
|
|
25
|
-
let $e8117ebcab55be6a$var$transitionCallbacks = new Set();
|
|
26
|
-
function $e8117ebcab55be6a$var$setupGlobalEvents() {
|
|
27
|
-
if (typeof window === 'undefined') return;
|
|
28
|
-
function isTransitionEvent(event) {
|
|
29
|
-
return 'propertyName' in event;
|
|
30
|
-
}
|
|
31
|
-
let onTransitionStart = (e)=>{
|
|
32
|
-
if (!isTransitionEvent(e) || !e.target) return;
|
|
33
|
-
// Add the transitioning property to the list for this element.
|
|
34
|
-
let transitions = $e8117ebcab55be6a$var$transitionsByElement.get(e.target);
|
|
35
|
-
if (!transitions) {
|
|
36
|
-
transitions = new Set();
|
|
37
|
-
$e8117ebcab55be6a$var$transitionsByElement.set(e.target, transitions);
|
|
38
|
-
// The transitioncancel event must be registered on the element itself, rather than as a global
|
|
39
|
-
// event. This enables us to handle when the node is deleted from the document while it is transitioning.
|
|
40
|
-
// In that case, the cancel event would have nowhere to bubble to so we need to handle it directly.
|
|
41
|
-
e.target.addEventListener('transitioncancel', onTransitionEnd, {
|
|
42
|
-
once: true
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
transitions.add(e.propertyName);
|
|
46
|
-
};
|
|
47
|
-
let onTransitionEnd = (e)=>{
|
|
48
|
-
if (!isTransitionEvent(e) || !e.target) return;
|
|
49
|
-
// Remove property from list of transitioning properties.
|
|
50
|
-
let properties = $e8117ebcab55be6a$var$transitionsByElement.get(e.target);
|
|
51
|
-
if (!properties) return;
|
|
52
|
-
properties.delete(e.propertyName);
|
|
53
|
-
// If empty, remove transitioncancel event, and remove the element from the list of transitioning elements.
|
|
54
|
-
if (properties.size === 0) {
|
|
55
|
-
e.target.removeEventListener('transitioncancel', onTransitionEnd);
|
|
56
|
-
$e8117ebcab55be6a$var$transitionsByElement.delete(e.target);
|
|
57
|
-
}
|
|
58
|
-
// If no transitioning elements, call all of the queued callbacks.
|
|
59
|
-
if ($e8117ebcab55be6a$var$transitionsByElement.size === 0) {
|
|
60
|
-
for (let cb of $e8117ebcab55be6a$var$transitionCallbacks)cb();
|
|
61
|
-
$e8117ebcab55be6a$var$transitionCallbacks.clear();
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
document.body.addEventListener('transitionrun', onTransitionStart);
|
|
65
|
-
document.body.addEventListener('transitionend', onTransitionEnd);
|
|
66
|
-
}
|
|
67
|
-
if (typeof document !== 'undefined') {
|
|
68
|
-
if (document.readyState !== 'loading') $e8117ebcab55be6a$var$setupGlobalEvents();
|
|
69
|
-
else document.addEventListener('DOMContentLoaded', $e8117ebcab55be6a$var$setupGlobalEvents);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Cleans up any elements that are no longer in the document.
|
|
73
|
-
* This is necessary because we can't rely on transitionend events to fire
|
|
74
|
-
* for elements that are removed from the document while transitioning.
|
|
75
|
-
*/ function $e8117ebcab55be6a$var$cleanupDetachedElements() {
|
|
76
|
-
for (const [eventTarget] of $e8117ebcab55be6a$var$transitionsByElement)// Similar to `eventTarget instanceof Element && !eventTarget.isConnected`, but avoids
|
|
77
|
-
// the explicit instanceof check, since it may be different in different contexts.
|
|
78
|
-
if ('isConnected' in eventTarget && !eventTarget.isConnected) $e8117ebcab55be6a$var$transitionsByElement.delete(eventTarget);
|
|
79
|
-
}
|
|
80
|
-
function $e8117ebcab55be6a$export$24490316f764c430(fn) {
|
|
81
|
-
// Wait one frame to see if an animation starts, e.g. a transition on mount.
|
|
82
|
-
requestAnimationFrame(()=>{
|
|
83
|
-
$e8117ebcab55be6a$var$cleanupDetachedElements();
|
|
84
|
-
// If no transitions are running, call the function immediately.
|
|
85
|
-
// Otherwise, add it to a list of callbacks to run at the end of the animation.
|
|
86
|
-
if ($e8117ebcab55be6a$var$transitionsByElement.size === 0) fn();
|
|
87
|
-
else $e8117ebcab55be6a$var$transitionCallbacks.add(fn);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
//# sourceMappingURL=runAfterTransition.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAED,uEAAuE;AACvE,6EAA6E;AAC7E,iFAAiF;AACjF,mFAAmF;AACnF,mFAAmF;AACnF,wCAAwC;AACxC,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,kBAAkB,MAAM,CAAC,EAAE,MAAM,EACpC;QAEF,+DAA+D;QAC/D,IAAI,cAAc,2CAAqB,GAAG,CAAC,EAAE,MAAM;QACnD,IAAI,CAAC,aAAa;YAChB,cAAc,IAAI;YAClB,2CAAqB,GAAG,CAAC,EAAE,MAAM,EAAE;YAEnC,+FAA+F;YAC/F,yGAAyG;YACzG,mGAAmG;YACnG,EAAE,MAAM,CAAC,gBAAgB,CAAC,oBAAoB,iBAAiB;gBAC7D,MAAM;YACR;QACF;QAEA,YAAY,GAAG,CAAC,EAAE,YAAY;IAChC;IAEA,IAAI,kBAAkB,CAAC;QACrB,IAAI,CAAC,kBAAkB,MAAM,CAAC,EAAE,MAAM,EACpC;QAEF,yDAAyD;QACzD,IAAI,aAAa,2CAAqB,GAAG,CAAC,EAAE,MAAM;QAClD,IAAI,CAAC,YACH;QAGF,WAAW,MAAM,CAAC,EAAE,YAAY;QAEhC,2GAA2G;QAC3G,IAAI,WAAW,IAAI,KAAK,GAAG;YACzB,EAAE,MAAM,CAAC,mBAAmB,CAAC,oBAAoB;YACjD,2CAAqB,MAAM,CAAC,EAAE,MAAM;QACtC;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.\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 if (!isTransitionEvent(e) || !e.target) {\n return;\n }\n // Add the transitioning property to the list for this element.\n let transitions = transitionsByElement.get(e.target);\n if (!transitions) {\n transitions = new Set();\n transitionsByElement.set(e.target, 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 e.target.addEventListener('transitioncancel', onTransitionEnd, {\n once: true\n });\n }\n\n transitions.add(e.propertyName);\n };\n\n let onTransitionEnd = (e: Event) => {\n if (!isTransitionEvent(e) || !e.target) {\n return;\n }\n // Remove property from list of transitioning properties.\n let properties = transitionsByElement.get(e.target);\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 e.target.removeEventListener('transitioncancel', onTransitionEnd);\n transitionsByElement.delete(e.target);\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,87 +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
|
-
*/ // We store a global list of elements that are currently transitioning,
|
|
12
|
-
// mapped to a set of CSS properties that are transitioning for that element.
|
|
13
|
-
// This is necessary rather than a simple count of transitions because of browser
|
|
14
|
-
// bugs, e.g. Chrome sometimes fires both transitionend and transitioncancel rather
|
|
15
|
-
// than one or the other. So we need to track what's actually transitioning so that
|
|
16
|
-
// we can ignore these duplicate events.
|
|
17
|
-
let $bbed8b41f857bcc0$var$transitionsByElement = new Map();
|
|
18
|
-
// A list of callbacks to call once there are no transitioning elements.
|
|
19
|
-
let $bbed8b41f857bcc0$var$transitionCallbacks = new Set();
|
|
20
|
-
function $bbed8b41f857bcc0$var$setupGlobalEvents() {
|
|
21
|
-
if (typeof window === 'undefined') return;
|
|
22
|
-
function isTransitionEvent(event) {
|
|
23
|
-
return 'propertyName' in event;
|
|
24
|
-
}
|
|
25
|
-
let onTransitionStart = (e)=>{
|
|
26
|
-
if (!isTransitionEvent(e) || !e.target) return;
|
|
27
|
-
// Add the transitioning property to the list for this element.
|
|
28
|
-
let transitions = $bbed8b41f857bcc0$var$transitionsByElement.get(e.target);
|
|
29
|
-
if (!transitions) {
|
|
30
|
-
transitions = new Set();
|
|
31
|
-
$bbed8b41f857bcc0$var$transitionsByElement.set(e.target, transitions);
|
|
32
|
-
// The transitioncancel event must be registered on the element itself, rather than as a global
|
|
33
|
-
// event. This enables us to handle when the node is deleted from the document while it is transitioning.
|
|
34
|
-
// In that case, the cancel event would have nowhere to bubble to so we need to handle it directly.
|
|
35
|
-
e.target.addEventListener('transitioncancel', onTransitionEnd, {
|
|
36
|
-
once: true
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
transitions.add(e.propertyName);
|
|
40
|
-
};
|
|
41
|
-
let onTransitionEnd = (e)=>{
|
|
42
|
-
if (!isTransitionEvent(e) || !e.target) return;
|
|
43
|
-
// Remove property from list of transitioning properties.
|
|
44
|
-
let properties = $bbed8b41f857bcc0$var$transitionsByElement.get(e.target);
|
|
45
|
-
if (!properties) return;
|
|
46
|
-
properties.delete(e.propertyName);
|
|
47
|
-
// If empty, remove transitioncancel event, and remove the element from the list of transitioning elements.
|
|
48
|
-
if (properties.size === 0) {
|
|
49
|
-
e.target.removeEventListener('transitioncancel', onTransitionEnd);
|
|
50
|
-
$bbed8b41f857bcc0$var$transitionsByElement.delete(e.target);
|
|
51
|
-
}
|
|
52
|
-
// If no transitioning elements, call all of the queued callbacks.
|
|
53
|
-
if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0) {
|
|
54
|
-
for (let cb of $bbed8b41f857bcc0$var$transitionCallbacks)cb();
|
|
55
|
-
$bbed8b41f857bcc0$var$transitionCallbacks.clear();
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
document.body.addEventListener('transitionrun', onTransitionStart);
|
|
59
|
-
document.body.addEventListener('transitionend', onTransitionEnd);
|
|
60
|
-
}
|
|
61
|
-
if (typeof document !== 'undefined') {
|
|
62
|
-
if (document.readyState !== 'loading') $bbed8b41f857bcc0$var$setupGlobalEvents();
|
|
63
|
-
else document.addEventListener('DOMContentLoaded', $bbed8b41f857bcc0$var$setupGlobalEvents);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Cleans up any elements that are no longer in the document.
|
|
67
|
-
* This is necessary because we can't rely on transitionend events to fire
|
|
68
|
-
* for elements that are removed from the document while transitioning.
|
|
69
|
-
*/ function $bbed8b41f857bcc0$var$cleanupDetachedElements() {
|
|
70
|
-
for (const [eventTarget] of $bbed8b41f857bcc0$var$transitionsByElement)// Similar to `eventTarget instanceof Element && !eventTarget.isConnected`, but avoids
|
|
71
|
-
// the explicit instanceof check, since it may be different in different contexts.
|
|
72
|
-
if ('isConnected' in eventTarget && !eventTarget.isConnected) $bbed8b41f857bcc0$var$transitionsByElement.delete(eventTarget);
|
|
73
|
-
}
|
|
74
|
-
function $bbed8b41f857bcc0$export$24490316f764c430(fn) {
|
|
75
|
-
// Wait one frame to see if an animation starts, e.g. a transition on mount.
|
|
76
|
-
requestAnimationFrame(()=>{
|
|
77
|
-
$bbed8b41f857bcc0$var$cleanupDetachedElements();
|
|
78
|
-
// If no transitions are running, call the function immediately.
|
|
79
|
-
// Otherwise, add it to a list of callbacks to run at the end of the animation.
|
|
80
|
-
if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0) fn();
|
|
81
|
-
else $bbed8b41f857bcc0$var$transitionCallbacks.add(fn);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
export {$bbed8b41f857bcc0$export$24490316f764c430 as runAfterTransition};
|
|
87
|
-
//# sourceMappingURL=runAfterTransition.module.js.map
|
|
@@ -1,87 +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
|
-
*/ // We store a global list of elements that are currently transitioning,
|
|
12
|
-
// mapped to a set of CSS properties that are transitioning for that element.
|
|
13
|
-
// This is necessary rather than a simple count of transitions because of browser
|
|
14
|
-
// bugs, e.g. Chrome sometimes fires both transitionend and transitioncancel rather
|
|
15
|
-
// than one or the other. So we need to track what's actually transitioning so that
|
|
16
|
-
// we can ignore these duplicate events.
|
|
17
|
-
let $bbed8b41f857bcc0$var$transitionsByElement = new Map();
|
|
18
|
-
// A list of callbacks to call once there are no transitioning elements.
|
|
19
|
-
let $bbed8b41f857bcc0$var$transitionCallbacks = new Set();
|
|
20
|
-
function $bbed8b41f857bcc0$var$setupGlobalEvents() {
|
|
21
|
-
if (typeof window === 'undefined') return;
|
|
22
|
-
function isTransitionEvent(event) {
|
|
23
|
-
return 'propertyName' in event;
|
|
24
|
-
}
|
|
25
|
-
let onTransitionStart = (e)=>{
|
|
26
|
-
if (!isTransitionEvent(e) || !e.target) return;
|
|
27
|
-
// Add the transitioning property to the list for this element.
|
|
28
|
-
let transitions = $bbed8b41f857bcc0$var$transitionsByElement.get(e.target);
|
|
29
|
-
if (!transitions) {
|
|
30
|
-
transitions = new Set();
|
|
31
|
-
$bbed8b41f857bcc0$var$transitionsByElement.set(e.target, transitions);
|
|
32
|
-
// The transitioncancel event must be registered on the element itself, rather than as a global
|
|
33
|
-
// event. This enables us to handle when the node is deleted from the document while it is transitioning.
|
|
34
|
-
// In that case, the cancel event would have nowhere to bubble to so we need to handle it directly.
|
|
35
|
-
e.target.addEventListener('transitioncancel', onTransitionEnd, {
|
|
36
|
-
once: true
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
transitions.add(e.propertyName);
|
|
40
|
-
};
|
|
41
|
-
let onTransitionEnd = (e)=>{
|
|
42
|
-
if (!isTransitionEvent(e) || !e.target) return;
|
|
43
|
-
// Remove property from list of transitioning properties.
|
|
44
|
-
let properties = $bbed8b41f857bcc0$var$transitionsByElement.get(e.target);
|
|
45
|
-
if (!properties) return;
|
|
46
|
-
properties.delete(e.propertyName);
|
|
47
|
-
// If empty, remove transitioncancel event, and remove the element from the list of transitioning elements.
|
|
48
|
-
if (properties.size === 0) {
|
|
49
|
-
e.target.removeEventListener('transitioncancel', onTransitionEnd);
|
|
50
|
-
$bbed8b41f857bcc0$var$transitionsByElement.delete(e.target);
|
|
51
|
-
}
|
|
52
|
-
// If no transitioning elements, call all of the queued callbacks.
|
|
53
|
-
if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0) {
|
|
54
|
-
for (let cb of $bbed8b41f857bcc0$var$transitionCallbacks)cb();
|
|
55
|
-
$bbed8b41f857bcc0$var$transitionCallbacks.clear();
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
document.body.addEventListener('transitionrun', onTransitionStart);
|
|
59
|
-
document.body.addEventListener('transitionend', onTransitionEnd);
|
|
60
|
-
}
|
|
61
|
-
if (typeof document !== 'undefined') {
|
|
62
|
-
if (document.readyState !== 'loading') $bbed8b41f857bcc0$var$setupGlobalEvents();
|
|
63
|
-
else document.addEventListener('DOMContentLoaded', $bbed8b41f857bcc0$var$setupGlobalEvents);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Cleans up any elements that are no longer in the document.
|
|
67
|
-
* This is necessary because we can't rely on transitionend events to fire
|
|
68
|
-
* for elements that are removed from the document while transitioning.
|
|
69
|
-
*/ function $bbed8b41f857bcc0$var$cleanupDetachedElements() {
|
|
70
|
-
for (const [eventTarget] of $bbed8b41f857bcc0$var$transitionsByElement)// Similar to `eventTarget instanceof Element && !eventTarget.isConnected`, but avoids
|
|
71
|
-
// the explicit instanceof check, since it may be different in different contexts.
|
|
72
|
-
if ('isConnected' in eventTarget && !eventTarget.isConnected) $bbed8b41f857bcc0$var$transitionsByElement.delete(eventTarget);
|
|
73
|
-
}
|
|
74
|
-
function $bbed8b41f857bcc0$export$24490316f764c430(fn) {
|
|
75
|
-
// Wait one frame to see if an animation starts, e.g. a transition on mount.
|
|
76
|
-
requestAnimationFrame(()=>{
|
|
77
|
-
$bbed8b41f857bcc0$var$cleanupDetachedElements();
|
|
78
|
-
// If no transitions are running, call the function immediately.
|
|
79
|
-
// Otherwise, add it to a list of callbacks to run at the end of the animation.
|
|
80
|
-
if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0) fn();
|
|
81
|
-
else $bbed8b41f857bcc0$var$transitionCallbacks.add(fn);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
export {$bbed8b41f857bcc0$export$24490316f764c430 as runAfterTransition};
|
|
87
|
-
//# sourceMappingURL=runAfterTransition.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"AAAA;;;;;;;;;;CAUC,GAED,uEAAuE;AACvE,6EAA6E;AAC7E,iFAAiF;AACjF,mFAAmF;AACnF,mFAAmF;AACnF,wCAAwC;AACxC,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,kBAAkB,MAAM,CAAC,EAAE,MAAM,EACpC;QAEF,+DAA+D;QAC/D,IAAI,cAAc,2CAAqB,GAAG,CAAC,EAAE,MAAM;QACnD,IAAI,CAAC,aAAa;YAChB,cAAc,IAAI;YAClB,2CAAqB,GAAG,CAAC,EAAE,MAAM,EAAE;YAEnC,+FAA+F;YAC/F,yGAAyG;YACzG,mGAAmG;YACnG,EAAE,MAAM,CAAC,gBAAgB,CAAC,oBAAoB,iBAAiB;gBAC7D,MAAM;YACR;QACF;QAEA,YAAY,GAAG,CAAC,EAAE,YAAY;IAChC;IAEA,IAAI,kBAAkB,CAAC;QACrB,IAAI,CAAC,kBAAkB,MAAM,CAAC,EAAE,MAAM,EACpC;QAEF,yDAAyD;QACzD,IAAI,aAAa,2CAAqB,GAAG,CAAC,EAAE,MAAM;QAClD,IAAI,CAAC,YACH;QAGF,WAAW,MAAM,CAAC,EAAE,YAAY;QAEhC,2GAA2G;QAC3G,IAAI,WAAW,IAAI,KAAK,GAAG;YACzB,EAAE,MAAM,CAAC,mBAAmB,CAAC,oBAAoB;YACjD,2CAAqB,MAAM,CAAC,EAAE,MAAM;QACtC;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.\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 if (!isTransitionEvent(e) || !e.target) {\n return;\n }\n // Add the transitioning property to the list for this element.\n let transitions = transitionsByElement.get(e.target);\n if (!transitions) {\n transitions = new Set();\n transitionsByElement.set(e.target, 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 e.target.addEventListener('transitioncancel', onTransitionEnd, {\n once: true\n });\n }\n\n transitions.add(e.propertyName);\n };\n\n let onTransitionEnd = (e: Event) => {\n if (!isTransitionEvent(e) || !e.target) {\n return;\n }\n // Remove property from list of transitioning properties.\n let properties = transitionsByElement.get(e.target);\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 e.target.removeEventListener('transitioncancel', onTransitionEnd);\n transitionsByElement.delete(e.target);\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,105 +0,0 @@
|
|
|
1
|
-
var $49f0d9486c2408aa$exports = require("./getScrollParents.main.js");
|
|
2
|
-
var $d723bea02f3e2567$exports = require("./DOMFunctions.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) {
|
|
24
|
-
let offsetX = $449412113267a1fe$var$relativeOffset(scrollView, element, 'left');
|
|
25
|
-
let offsetY = $449412113267a1fe$var$relativeOffset(scrollView, element, 'top');
|
|
26
|
-
let width = element.offsetWidth;
|
|
27
|
-
let height = element.offsetHeight;
|
|
28
|
-
let x = scrollView.scrollLeft;
|
|
29
|
-
let y = scrollView.scrollTop;
|
|
30
|
-
// Account for top/left border offsetting the scroll top/Left + scroll padding
|
|
31
|
-
let { borderTopWidth: borderTopWidth, borderLeftWidth: borderLeftWidth, scrollPaddingTop: scrollPaddingTop, scrollPaddingRight: scrollPaddingRight, scrollPaddingBottom: scrollPaddingBottom, scrollPaddingLeft: scrollPaddingLeft } = getComputedStyle(scrollView);
|
|
32
|
-
let borderAdjustedX = x + parseInt(borderLeftWidth, 10);
|
|
33
|
-
let borderAdjustedY = y + parseInt(borderTopWidth, 10);
|
|
34
|
-
// Ignore end/bottom border via clientHeight/Width instead of offsetHeight/Width
|
|
35
|
-
let maxX = borderAdjustedX + scrollView.clientWidth;
|
|
36
|
-
let maxY = borderAdjustedY + scrollView.clientHeight;
|
|
37
|
-
// Get scroll padding values as pixels - defaults to 0 if no scroll padding
|
|
38
|
-
// is used.
|
|
39
|
-
let scrollPaddingTopNumber = parseInt(scrollPaddingTop, 10) || 0;
|
|
40
|
-
let scrollPaddingBottomNumber = parseInt(scrollPaddingBottom, 10) || 0;
|
|
41
|
-
let scrollPaddingRightNumber = parseInt(scrollPaddingRight, 10) || 0;
|
|
42
|
-
let scrollPaddingLeftNumber = parseInt(scrollPaddingLeft, 10) || 0;
|
|
43
|
-
if (offsetX <= x + scrollPaddingLeftNumber) x = offsetX - parseInt(borderLeftWidth, 10) - scrollPaddingLeftNumber;
|
|
44
|
-
else if (offsetX + width > maxX - scrollPaddingRightNumber) x += offsetX + width - maxX + scrollPaddingRightNumber;
|
|
45
|
-
if (offsetY <= borderAdjustedY + scrollPaddingTopNumber) y = offsetY - parseInt(borderTopWidth, 10) - scrollPaddingTopNumber;
|
|
46
|
-
else if (offsetY + height > maxY - scrollPaddingBottomNumber) y += offsetY + height - maxY + scrollPaddingBottomNumber;
|
|
47
|
-
scrollView.scrollLeft = x;
|
|
48
|
-
scrollView.scrollTop = y;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Computes the offset left or top from child to ancestor by accumulating
|
|
52
|
-
* offsetLeft or offsetTop through intervening offsetParents.
|
|
53
|
-
*/ function $449412113267a1fe$var$relativeOffset(ancestor, child, axis) {
|
|
54
|
-
const prop = axis === 'left' ? 'offsetLeft' : 'offsetTop';
|
|
55
|
-
let sum = 0;
|
|
56
|
-
while(child.offsetParent){
|
|
57
|
-
sum += child[prop];
|
|
58
|
-
if (child.offsetParent === ancestor) break;
|
|
59
|
-
else if ((0, $d723bea02f3e2567$exports.nodeContains)(child.offsetParent, ancestor)) {
|
|
60
|
-
// If the ancestor is not `position:relative`, then we stop at
|
|
61
|
-
// _its_ offset parent, and we subtract off _its_ offset, so that
|
|
62
|
-
// we end up with the proper offset from child to ancestor.
|
|
63
|
-
sum -= ancestor[prop];
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
child = child.offsetParent;
|
|
67
|
-
}
|
|
68
|
-
return sum;
|
|
69
|
-
}
|
|
70
|
-
function $449412113267a1fe$export$c826860796309d1b(targetElement, opts) {
|
|
71
|
-
if (targetElement && (0, $d723bea02f3e2567$exports.nodeContains)(document, targetElement)) {
|
|
72
|
-
let root = document.scrollingElement || document.documentElement;
|
|
73
|
-
let isScrollPrevented = window.getComputedStyle(root).overflow === 'hidden';
|
|
74
|
-
// 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
|
|
75
|
-
if (!isScrollPrevented) {
|
|
76
|
-
var // use scrollIntoView({block: 'nearest'}) instead of .focus to check if the element is fully in view or not since .focus()
|
|
77
|
-
// 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
|
|
78
|
-
_targetElement_scrollIntoView;
|
|
79
|
-
let { left: originalLeft, top: originalTop } = targetElement.getBoundingClientRect();
|
|
80
|
-
targetElement === null || targetElement === void 0 ? void 0 : (_targetElement_scrollIntoView = targetElement.scrollIntoView) === null || _targetElement_scrollIntoView === void 0 ? void 0 : _targetElement_scrollIntoView.call(targetElement, {
|
|
81
|
-
block: 'nearest'
|
|
82
|
-
});
|
|
83
|
-
let { left: newLeft, top: newTop } = targetElement.getBoundingClientRect();
|
|
84
|
-
// Account for sub pixel differences from rounding
|
|
85
|
-
if (Math.abs(originalLeft - newLeft) > 1 || Math.abs(originalTop - newTop) > 1) {
|
|
86
|
-
var _opts_containingElement_scrollIntoView, _opts_containingElement, _targetElement_scrollIntoView1;
|
|
87
|
-
opts === null || opts === void 0 ? void 0 : (_opts_containingElement = opts.containingElement) === null || _opts_containingElement === void 0 ? void 0 : (_opts_containingElement_scrollIntoView = _opts_containingElement.scrollIntoView) === null || _opts_containingElement_scrollIntoView === void 0 ? void 0 : _opts_containingElement_scrollIntoView.call(_opts_containingElement, {
|
|
88
|
-
block: 'center',
|
|
89
|
-
inline: 'center'
|
|
90
|
-
});
|
|
91
|
-
(_targetElement_scrollIntoView1 = targetElement.scrollIntoView) === null || _targetElement_scrollIntoView1 === void 0 ? void 0 : _targetElement_scrollIntoView1.call(targetElement, {
|
|
92
|
-
block: 'nearest'
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
} else {
|
|
96
|
-
let scrollParents = (0, $49f0d9486c2408aa$exports.getScrollParents)(targetElement);
|
|
97
|
-
// 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.
|
|
98
|
-
if (!isScrollPrevented) scrollParents.push(root);
|
|
99
|
-
for (let scrollParent of scrollParents)$449412113267a1fe$export$53a0910f038337bd(scrollParent, targetElement);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
//# sourceMappingURL=scrollIntoView.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAeM,SAAS,0CAAe,UAAuB,EAAE,OAAoB;IAC1E,IAAI,UAAU,qCAAe,YAAY,SAAS;IAClD,IAAI,UAAU,qCAAe,YAAY,SAAS;IAClD,IAAI,QAAQ,QAAQ,WAAW;IAC/B,IAAI,SAAS,QAAQ,YAAY;IACjC,IAAI,IAAI,WAAW,UAAU;IAC7B,IAAI,IAAI,WAAW,SAAS;IAE5B,8EAA8E;IAC9E,IAAI,kBACF,cAAc,mBACd,eAAe,oBACf,gBAAgB,sBAChB,kBAAkB,uBAClB,mBAAmB,qBACnB,iBAAiB,EAClB,GAAG,iBAAiB;IAErB,IAAI,kBAAkB,IAAI,SAAS,iBAAiB;IACpD,IAAI,kBAAkB,IAAI,SAAS,gBAAgB;IACnD,gFAAgF;IAChF,IAAI,OAAO,kBAAkB,WAAW,WAAW;IACnD,IAAI,OAAO,kBAAkB,WAAW,YAAY;IAEpD,2EAA2E;IAC3E,WAAW;IACX,IAAI,yBAAyB,SAAS,kBAAkB,OAAO;IAC/D,IAAI,4BAA4B,SAAS,qBAAqB,OAAO;IACrE,IAAI,2BAA2B,SAAS,oBAAoB,OAAO;IACnE,IAAI,0BAA0B,SAAS,mBAAmB,OAAO;IAEjE,IAAI,WAAW,IAAI,yBACjB,IAAI,UAAU,SAAS,iBAAiB,MAAM;SACzC,IAAI,UAAU,QAAQ,OAAO,0BAClC,KAAK,UAAU,QAAQ,OAAO;IAEhC,IAAI,WAAW,kBAAkB,wBAC/B,IAAI,UAAU,SAAS,gBAAgB,MAAM;SACxC,IAAI,UAAU,SAAS,OAAO,2BACnC,KAAK,UAAU,SAAS,OAAO;IAGjC,WAAW,UAAU,GAAG;IACxB,WAAW,SAAS,GAAG;AACzB;AAEA;;;CAGC,GACD,SAAS,qCAAe,QAAqB,EAAE,KAAkB,EAAE,IAAkB;IACnF,MAAM,OAAO,SAAS,SAAS,eAAe;IAC9C,IAAI,MAAM;IACV,MAAO,MAAM,YAAY,CAAE;QACzB,OAAO,KAAK,CAAC,KAAK;QAClB,IAAI,MAAM,YAAY,KAAK,UAEzB;aACK,IAAI,CAAA,GAAA,sCAAW,EAAE,MAAM,YAAY,EAAE,WAAW;YACrD,8DAA8D;YAC9D,iEAAiE;YACjE,2DAA2D;YAC3D,OAAO,QAAQ,CAAC,KAAK;YACrB;QACF;QACA,QAAQ,MAAM,YAAY;IAC5B;IACA,OAAO;AACT;AAOO,SAAS,0CAAmB,aAA6B,EAAE,IAA6B;IAC7F,IAAI,iBAAiB,CAAA,GAAA,sCAAW,EAAE,UAAU,gBAAgB;QAC1D,IAAI,OAAO,SAAS,gBAAgB,IAAI,SAAS,eAAe;QAChE,IAAI,oBAAoB,OAAO,gBAAgB,CAAC,MAAM,QAAQ,KAAK;QACnE,4JAA4J;QAC5J,IAAI,CAAC,mBAAmB;gBAGtB,0HAA0H;YAC1H,6JAA6J;YAC7J;YAJA,IAAI,EAAC,MAAM,YAAY,EAAE,KAAK,WAAW,EAAC,GAAG,cAAc,qBAAqB;YAIhF,0BAAA,qCAAA,gCAAA,cAAe,cAAc,cAA7B,oDAAA,mCAAA,eAAgC;gBAAC,OAAO;YAAS;YACjD,IAAI,EAAC,MAAM,OAAO,EAAE,KAAK,MAAM,EAAC,GAAG,cAAc,qBAAqB;YACtE,kDAAkD;YAClD,IAAI,AAAC,KAAK,GAAG,CAAC,eAAe,WAAW,KAAO,KAAK,GAAG,CAAC,cAAc,UAAU,GAAI;oBAClF,wCAAA,yBACA;gBADA,iBAAA,4BAAA,0BAAA,KAAM,iBAAiB,cAAvB,+CAAA,yCAAA,wBAAyB,cAAc,cAAvC,6DAAA,4CAAA,yBAA0C;oBAAC,OAAO;oBAAU,QAAQ;gBAAQ;iBAC5E,iCAAA,cAAc,cAAc,cAA5B,qDAAA,oCAAA,eAA+B;oBAAC,OAAO;gBAAS;YAClD;QACF,OAAO;YACL,IAAI,gBAAgB,CAAA,GAAA,0CAAe,EAAE;YACrC,+JAA+J;YAC/J,IAAI,CAAC,mBACH,cAAc,IAAI,CAAC;YAErB,KAAK,IAAI,gBAAgB,cACvB,0CAAe,cAA6B;QAEhD;IACF;AACF","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 {nodeContains} from './shadowdom/DOMFunctions';\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): void {\n let offsetX = relativeOffset(scrollView, element, 'left');\n let offsetY = relativeOffset(scrollView, element, 'top');\n let width = element.offsetWidth;\n let height = element.offsetHeight;\n let x = scrollView.scrollLeft;\n let y = scrollView.scrollTop;\n\n // Account for top/left border offsetting the scroll top/Left + scroll padding\n let {\n borderTopWidth,\n borderLeftWidth,\n scrollPaddingTop,\n scrollPaddingRight,\n scrollPaddingBottom,\n scrollPaddingLeft\n } = getComputedStyle(scrollView);\n\n let borderAdjustedX = x + parseInt(borderLeftWidth, 10);\n let borderAdjustedY = y + parseInt(borderTopWidth, 10);\n // Ignore end/bottom border via clientHeight/Width instead of offsetHeight/Width\n let maxX = borderAdjustedX + scrollView.clientWidth;\n let maxY = borderAdjustedY + scrollView.clientHeight;\n\n // Get scroll padding values as pixels - defaults to 0 if no scroll padding\n // is used.\n let scrollPaddingTopNumber = parseInt(scrollPaddingTop, 10) || 0;\n let scrollPaddingBottomNumber = parseInt(scrollPaddingBottom, 10) || 0;\n let scrollPaddingRightNumber = parseInt(scrollPaddingRight, 10) || 0;\n let scrollPaddingLeftNumber = parseInt(scrollPaddingLeft, 10) || 0;\n\n if (offsetX <= x + scrollPaddingLeftNumber) {\n x = offsetX - parseInt(borderLeftWidth, 10) - scrollPaddingLeftNumber;\n } else if (offsetX + width > maxX - scrollPaddingRightNumber) {\n x += offsetX + width - maxX + scrollPaddingRightNumber;\n }\n if (offsetY <= borderAdjustedY + scrollPaddingTopNumber) {\n y = offsetY - parseInt(borderTopWidth, 10) - scrollPaddingTopNumber;\n } else if (offsetY + height > maxY - scrollPaddingBottomNumber) {\n y += offsetY + height - maxY + scrollPaddingBottomNumber;\n }\n\n scrollView.scrollLeft = x;\n scrollView.scrollTop = y;\n}\n\n/**\n * Computes the offset left or top from child to ancestor by accumulating\n * offsetLeft or offsetTop through intervening offsetParents.\n */\nfunction relativeOffset(ancestor: HTMLElement, child: HTMLElement, axis: 'left'|'top') {\n const prop = axis === 'left' ? 'offsetLeft' : 'offsetTop';\n let sum = 0;\n while (child.offsetParent) {\n sum += child[prop];\n if (child.offsetParent === ancestor) {\n // Stop once we have found the ancestor we are interested in.\n break;\n } else if (nodeContains(child.offsetParent, ancestor)) {\n // If the ancestor is not `position:relative`, then we stop at\n // _its_ offset parent, and we subtract off _its_ offset, so that\n // we end up with the proper offset from child to ancestor.\n sum -= ancestor[prop];\n break;\n }\n child = child.offsetParent as HTMLElement;\n }\n return sum;\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 if (targetElement && nodeContains(document, targetElement)) {\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 if (!isScrollPrevented) {\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 opts?.containingElement?.scrollIntoView?.({block: 'center', inline: 'center'});\n targetElement.scrollIntoView?.({block: 'nearest'});\n }\n } else {\n let scrollParents = getScrollParents(targetElement);\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 if (!isScrollPrevented) {\n scrollParents.push(root);\n }\n for (let scrollParent of scrollParents) {\n scrollIntoView(scrollParent as HTMLElement, targetElement as HTMLElement);\n }\n }\n }\n}\n"],"names":[],"version":3,"file":"scrollIntoView.main.js.map"}
|