@react-aria/utils 3.23.2 → 3.24.1
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/chain.main.js +26 -0
- package/dist/chain.main.js.map +1 -0
- package/dist/chain.mjs +21 -0
- package/dist/chain.module.js +21 -0
- package/dist/chain.module.js.map +1 -0
- package/dist/domHelpers.main.js +19 -0
- package/dist/domHelpers.main.js.map +1 -0
- package/dist/domHelpers.mjs +13 -0
- package/dist/domHelpers.module.js +13 -0
- package/dist/domHelpers.module.js.map +1 -0
- package/dist/filterDOMProps.main.js +45 -0
- package/dist/filterDOMProps.main.js.map +1 -0
- package/dist/filterDOMProps.mjs +40 -0
- package/dist/filterDOMProps.module.js +40 -0
- package/dist/filterDOMProps.module.js.map +1 -0
- package/dist/focusWithoutScrolling.main.js +72 -0
- package/dist/focusWithoutScrolling.main.js.map +1 -0
- package/dist/focusWithoutScrolling.mjs +67 -0
- package/dist/focusWithoutScrolling.module.js +67 -0
- package/dist/focusWithoutScrolling.module.js.map +1 -0
- package/dist/getOffset.main.js +24 -0
- package/dist/getOffset.main.js.map +1 -0
- package/dist/getOffset.mjs +19 -0
- package/dist/getOffset.module.js +19 -0
- package/dist/getOffset.module.js.map +1 -0
- package/dist/getScrollParent.main.js +28 -0
- package/dist/getScrollParent.main.js.map +1 -0
- package/dist/getScrollParent.mjs +23 -0
- package/dist/getScrollParent.module.js +23 -0
- package/dist/getScrollParent.module.js.map +1 -0
- package/dist/getScrollParents.main.js +30 -0
- package/dist/getScrollParents.main.js.map +1 -0
- package/dist/getScrollParents.mjs +25 -0
- package/dist/getScrollParents.module.js +25 -0
- package/dist/getScrollParents.module.js.map +1 -0
- package/dist/import.mjs +32 -1232
- package/dist/isScrollable.main.js +25 -0
- package/dist/isScrollable.main.js.map +1 -0
- package/dist/isScrollable.mjs +20 -0
- package/dist/isScrollable.module.js +20 -0
- package/dist/isScrollable.module.js.map +1 -0
- package/dist/isVirtualEvent.main.js +41 -0
- package/dist/isVirtualEvent.main.js.map +1 -0
- package/dist/isVirtualEvent.mjs +35 -0
- package/dist/isVirtualEvent.module.js +35 -0
- package/dist/isVirtualEvent.module.js.map +1 -0
- package/dist/main.js +80 -1282
- package/dist/main.js.map +1 -1
- package/dist/mergeProps.main.js +51 -0
- package/dist/mergeProps.main.js.map +1 -0
- package/dist/mergeProps.mjs +42 -0
- package/dist/mergeProps.module.js +42 -0
- package/dist/mergeProps.module.js.map +1 -0
- package/dist/mergeRefs.main.js +28 -0
- package/dist/mergeRefs.main.js.map +1 -0
- package/dist/mergeRefs.mjs +23 -0
- package/dist/mergeRefs.module.js +23 -0
- package/dist/mergeRefs.module.js.map +1 -0
- package/dist/module.js +32 -1232
- package/dist/module.js.map +1 -1
- package/dist/openLink.main.js +143 -0
- package/dist/openLink.main.js.map +1 -0
- package/dist/openLink.mjs +129 -0
- package/dist/openLink.module.js +129 -0
- package/dist/openLink.module.js.map +1 -0
- package/dist/platform.main.js +64 -0
- package/dist/platform.main.js.map +1 -0
- package/dist/platform.mjs +51 -0
- package/dist/platform.module.js +51 -0
- package/dist/platform.module.js.map +1 -0
- package/dist/runAfterTransition.main.js +82 -0
- package/dist/runAfterTransition.main.js.map +1 -0
- package/dist/runAfterTransition.mjs +77 -0
- package/dist/runAfterTransition.module.js +77 -0
- package/dist/runAfterTransition.module.js.map +1 -0
- package/dist/scrollIntoView.main.js +96 -0
- package/dist/scrollIntoView.main.js.map +1 -0
- package/dist/scrollIntoView.mjs +90 -0
- package/dist/scrollIntoView.module.js +90 -0
- package/dist/scrollIntoView.module.js.map +1 -0
- package/dist/types.d.ts +17 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/useDeepMemo.main.js +30 -0
- package/dist/useDeepMemo.main.js.map +1 -0
- package/dist/useDeepMemo.mjs +25 -0
- package/dist/useDeepMemo.module.js +25 -0
- package/dist/useDeepMemo.module.js.map +1 -0
- package/dist/useDescription.main.js +59 -0
- package/dist/useDescription.main.js.map +1 -0
- package/dist/useDescription.mjs +54 -0
- package/dist/useDescription.module.js +54 -0
- package/dist/useDescription.module.js.map +1 -0
- package/dist/useDrag1D.main.js +139 -0
- package/dist/useDrag1D.main.js.map +1 -0
- package/dist/useDrag1D.mjs +134 -0
- package/dist/useDrag1D.module.js +134 -0
- package/dist/useDrag1D.module.js.map +1 -0
- package/dist/useEffectEvent.main.js +37 -0
- package/dist/useEffectEvent.main.js.map +1 -0
- package/dist/useEffectEvent.mjs +32 -0
- package/dist/useEffectEvent.module.js +32 -0
- package/dist/useEffectEvent.module.js.map +1 -0
- package/dist/useEvent.main.js +42 -0
- package/dist/useEvent.main.js.map +1 -0
- package/dist/useEvent.mjs +37 -0
- package/dist/useEvent.module.js +37 -0
- package/dist/useEvent.module.js.map +1 -0
- package/dist/useFormReset.main.js +41 -0
- package/dist/useFormReset.main.js.map +1 -0
- package/dist/useFormReset.mjs +36 -0
- package/dist/useFormReset.module.js +36 -0
- package/dist/useFormReset.module.js.map +1 -0
- package/dist/useGlobalListeners.main.js +63 -0
- package/dist/useGlobalListeners.main.js.map +1 -0
- package/dist/useGlobalListeners.mjs +58 -0
- package/dist/useGlobalListeners.module.js +58 -0
- package/dist/useGlobalListeners.module.js.map +1 -0
- package/dist/useId.main.js +93 -0
- package/dist/useId.main.js.map +1 -0
- package/dist/useId.mjs +86 -0
- package/dist/useId.module.js +86 -0
- package/dist/useId.module.js.map +1 -0
- package/dist/useLabels.main.js +44 -0
- package/dist/useLabels.main.js.map +1 -0
- package/dist/useLabels.mjs +39 -0
- package/dist/useLabels.module.js +39 -0
- package/dist/useLabels.module.js.map +1 -0
- package/dist/useLayoutEffect.main.js +27 -0
- package/dist/useLayoutEffect.main.js.map +1 -0
- package/dist/useLayoutEffect.mjs +18 -0
- package/dist/useLayoutEffect.module.js +18 -0
- package/dist/useLayoutEffect.module.js.map +1 -0
- package/dist/useObjectRef.main.js +37 -0
- package/dist/useObjectRef.main.js.map +1 -0
- package/dist/useObjectRef.mjs +32 -0
- package/dist/useObjectRef.module.js +32 -0
- package/dist/useObjectRef.module.js.map +1 -0
- package/dist/useResizeObserver.main.js +40 -0
- package/dist/useResizeObserver.main.js.map +1 -0
- package/dist/useResizeObserver.mjs +35 -0
- package/dist/useResizeObserver.module.js +35 -0
- package/dist/useResizeObserver.module.js.map +1 -0
- package/dist/useSyncRef.main.js +32 -0
- package/dist/useSyncRef.main.js.map +1 -0
- package/dist/useSyncRef.mjs +27 -0
- package/dist/useSyncRef.module.js +27 -0
- package/dist/useSyncRef.module.js.map +1 -0
- package/dist/useUpdateEffect.main.js +38 -0
- package/dist/useUpdateEffect.main.js.map +1 -0
- package/dist/useUpdateEffect.mjs +33 -0
- package/dist/useUpdateEffect.module.js +33 -0
- package/dist/useUpdateEffect.module.js.map +1 -0
- package/dist/useValueEffect.main.js +58 -0
- package/dist/useValueEffect.main.js.map +1 -0
- package/dist/useValueEffect.mjs +53 -0
- package/dist/useValueEffect.module.js +53 -0
- package/dist/useValueEffect.module.js.map +1 -0
- package/dist/useViewportSize.main.js +56 -0
- package/dist/useViewportSize.main.js.map +1 -0
- package/dist/useViewportSize.mjs +51 -0
- package/dist/useViewportSize.module.js +51 -0
- package/dist/useViewportSize.module.js.map +1 -0
- package/package.json +5 -5
- package/src/filterDOMProps.ts +1 -0
- package/src/getScrollParent.ts +2 -10
- package/src/getScrollParents.ts +26 -0
- package/src/index.ts +4 -2
- package/src/isScrollable.ts +22 -0
- package/src/mergeRefs.ts +2 -2
- package/src/openLink.tsx +25 -9
- package/src/scrollIntoView.ts +3 -5
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import {focusWithoutScrolling as $7215afc6de606d6b$export$de79e2c695e052f3} from "./focusWithoutScrolling.module.js";
|
|
2
|
+
import {isMac as $c87311424ea30a05$export$9ac100e40613ea10, isWebKit as $c87311424ea30a05$export$78551043582a6a98, isFirefox as $c87311424ea30a05$export$b7d78993b74f766d, isIPad as $c87311424ea30a05$export$7bef049ce92e4224} from "./platform.module.js";
|
|
3
|
+
import $g3jFn$react, {createContext as $g3jFn$createContext, useMemo as $g3jFn$useMemo, useContext as $g3jFn$useContext} from "react";
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright 2023 Adobe. All rights reserved.
|
|
7
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
* governing permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const $ea8dcbcb9ea1b556$var$RouterContext = /*#__PURE__*/ (0, $g3jFn$createContext)({
|
|
19
|
+
isNative: true,
|
|
20
|
+
open: $ea8dcbcb9ea1b556$var$openSyntheticLink,
|
|
21
|
+
useHref: (href)=>href
|
|
22
|
+
});
|
|
23
|
+
function $ea8dcbcb9ea1b556$export$323e4fc2fa4753fb(props) {
|
|
24
|
+
let { children: children, navigate: navigate, useHref: useHref } = props;
|
|
25
|
+
let ctx = (0, $g3jFn$useMemo)(()=>({
|
|
26
|
+
isNative: false,
|
|
27
|
+
open: (target, modifiers, href, routerOptions)=>{
|
|
28
|
+
$ea8dcbcb9ea1b556$var$getSyntheticLink(target, (link)=>{
|
|
29
|
+
if ($ea8dcbcb9ea1b556$export$efa8c9099e530235(link, modifiers)) navigate(href, routerOptions);
|
|
30
|
+
else $ea8dcbcb9ea1b556$export$95185d699e05d4d7(link, modifiers);
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
useHref: useHref || ((href)=>href)
|
|
34
|
+
}), [
|
|
35
|
+
navigate,
|
|
36
|
+
useHref
|
|
37
|
+
]);
|
|
38
|
+
return /*#__PURE__*/ (0, $g3jFn$react).createElement($ea8dcbcb9ea1b556$var$RouterContext.Provider, {
|
|
39
|
+
value: ctx
|
|
40
|
+
}, children);
|
|
41
|
+
}
|
|
42
|
+
function $ea8dcbcb9ea1b556$export$9a302a45f65d0572() {
|
|
43
|
+
return (0, $g3jFn$useContext)($ea8dcbcb9ea1b556$var$RouterContext);
|
|
44
|
+
}
|
|
45
|
+
function $ea8dcbcb9ea1b556$export$efa8c9099e530235(link, modifiers) {
|
|
46
|
+
// Use getAttribute here instead of link.target. Firefox will default link.target to "_parent" when inside an iframe.
|
|
47
|
+
let target = link.getAttribute('target');
|
|
48
|
+
return (!target || target === '_self') && link.origin === location.origin && !link.hasAttribute('download') && !modifiers.metaKey && // open in new tab (mac)
|
|
49
|
+
!modifiers.ctrlKey && // open in new tab (windows)
|
|
50
|
+
!modifiers.altKey && // download
|
|
51
|
+
!modifiers.shiftKey;
|
|
52
|
+
}
|
|
53
|
+
function $ea8dcbcb9ea1b556$export$95185d699e05d4d7(target, modifiers, setOpening = true) {
|
|
54
|
+
var _window_event_type, _window_event;
|
|
55
|
+
let { metaKey: metaKey, ctrlKey: ctrlKey, altKey: altKey, shiftKey: shiftKey } = modifiers;
|
|
56
|
+
// Firefox does not recognize keyboard events as a user action by default, and the popup blocker
|
|
57
|
+
// will prevent links with target="_blank" from opening. However, it does allow the event if the
|
|
58
|
+
// Command/Control key is held, which opens the link in a background tab. This seems like the best we can do.
|
|
59
|
+
// See https://bugzilla.mozilla.org/show_bug.cgi?id=257870 and https://bugzilla.mozilla.org/show_bug.cgi?id=746640.
|
|
60
|
+
if ((0, $c87311424ea30a05$export$b7d78993b74f766d)() && ((_window_event = window.event) === null || _window_event === void 0 ? void 0 : (_window_event_type = _window_event.type) === null || _window_event_type === void 0 ? void 0 : _window_event_type.startsWith('key')) && target.target === '_blank') {
|
|
61
|
+
if ((0, $c87311424ea30a05$export$9ac100e40613ea10)()) metaKey = true;
|
|
62
|
+
else ctrlKey = true;
|
|
63
|
+
}
|
|
64
|
+
// WebKit does not support firing click events with modifier keys, but does support keyboard events.
|
|
65
|
+
// https://github.com/WebKit/WebKit/blob/c03d0ac6e6db178f90923a0a63080b5ca210d25f/Source/WebCore/html/HTMLAnchorElement.cpp#L184
|
|
66
|
+
let event = (0, $c87311424ea30a05$export$78551043582a6a98)() && (0, $c87311424ea30a05$export$9ac100e40613ea10)() && !(0, $c87311424ea30a05$export$7bef049ce92e4224)() && true ? new KeyboardEvent('keydown', {
|
|
67
|
+
keyIdentifier: 'Enter',
|
|
68
|
+
metaKey: metaKey,
|
|
69
|
+
ctrlKey: ctrlKey,
|
|
70
|
+
altKey: altKey,
|
|
71
|
+
shiftKey: shiftKey
|
|
72
|
+
}) : new MouseEvent('click', {
|
|
73
|
+
metaKey: metaKey,
|
|
74
|
+
ctrlKey: ctrlKey,
|
|
75
|
+
altKey: altKey,
|
|
76
|
+
shiftKey: shiftKey,
|
|
77
|
+
bubbles: true,
|
|
78
|
+
cancelable: true
|
|
79
|
+
});
|
|
80
|
+
$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = setOpening;
|
|
81
|
+
(0, $7215afc6de606d6b$export$de79e2c695e052f3)(target);
|
|
82
|
+
target.dispatchEvent(event);
|
|
83
|
+
$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = false;
|
|
84
|
+
}
|
|
85
|
+
// https://github.com/parcel-bundler/parcel/issues/8724
|
|
86
|
+
$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = false;
|
|
87
|
+
function $ea8dcbcb9ea1b556$var$getSyntheticLink(target, open) {
|
|
88
|
+
if (target instanceof HTMLAnchorElement) open(target);
|
|
89
|
+
else if (target.hasAttribute('data-href')) {
|
|
90
|
+
let link = document.createElement('a');
|
|
91
|
+
link.href = target.getAttribute('data-href');
|
|
92
|
+
if (target.hasAttribute('data-target')) link.target = target.getAttribute('data-target');
|
|
93
|
+
if (target.hasAttribute('data-rel')) link.rel = target.getAttribute('data-rel');
|
|
94
|
+
if (target.hasAttribute('data-download')) link.download = target.getAttribute('data-download');
|
|
95
|
+
if (target.hasAttribute('data-ping')) link.ping = target.getAttribute('data-ping');
|
|
96
|
+
if (target.hasAttribute('data-referrer-policy')) link.referrerPolicy = target.getAttribute('data-referrer-policy');
|
|
97
|
+
target.appendChild(link);
|
|
98
|
+
open(link);
|
|
99
|
+
target.removeChild(link);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function $ea8dcbcb9ea1b556$var$openSyntheticLink(target, modifiers) {
|
|
103
|
+
$ea8dcbcb9ea1b556$var$getSyntheticLink(target, (link)=>$ea8dcbcb9ea1b556$export$95185d699e05d4d7(link, modifiers));
|
|
104
|
+
}
|
|
105
|
+
function $ea8dcbcb9ea1b556$export$51437d503373d223(props) {
|
|
106
|
+
return {
|
|
107
|
+
'data-href': props.href,
|
|
108
|
+
'data-target': props.target,
|
|
109
|
+
'data-rel': props.rel,
|
|
110
|
+
'data-download': props.download,
|
|
111
|
+
'data-ping': props.ping,
|
|
112
|
+
'data-referrer-policy': props.referrerPolicy
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function $ea8dcbcb9ea1b556$export$7e924b3091a3bd18(props) {
|
|
116
|
+
let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572();
|
|
117
|
+
return {
|
|
118
|
+
href: (props === null || props === void 0 ? void 0 : props.href) ? router.useHref(props === null || props === void 0 ? void 0 : props.href) : undefined,
|
|
119
|
+
target: props === null || props === void 0 ? void 0 : props.target,
|
|
120
|
+
rel: props === null || props === void 0 ? void 0 : props.rel,
|
|
121
|
+
download: props === null || props === void 0 ? void 0 : props.download,
|
|
122
|
+
ping: props === null || props === void 0 ? void 0 : props.ping,
|
|
123
|
+
referrerPolicy: props === null || props === void 0 ? void 0 : props.referrerPolicy
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
export {$ea8dcbcb9ea1b556$export$323e4fc2fa4753fb as RouterProvider, $ea8dcbcb9ea1b556$export$efa8c9099e530235 as shouldClientNavigate, $ea8dcbcb9ea1b556$export$95185d699e05d4d7 as openLink, $ea8dcbcb9ea1b556$export$9a302a45f65d0572 as useRouter, $ea8dcbcb9ea1b556$export$51437d503373d223 as getSyntheticLinkProps, $ea8dcbcb9ea1b556$export$7e924b3091a3bd18 as useLinkProps};
|
|
129
|
+
//# sourceMappingURL=openLink.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAaD,MAAM,oDAAgB,CAAA,GAAA,oBAAY,EAAU;IAC1C,UAAU;IACV,MAAM;IACN,SAAS,CAAC,OAAS;AACrB;AAYO,SAAS,0CAAe,KAA0B;IACvD,IAAI,YAAC,QAAQ,YAAE,QAAQ,WAAE,OAAO,EAAC,GAAG;IAEpC,IAAI,MAAM,CAAA,GAAA,cAAM,EAAE,IAAO,CAAA;YACvB,UAAU;YACV,MAAM,CAAC,QAAiB,WAAsB,MAAY;gBACxD,uCAAiB,QAAQ,CAAA;oBACvB,IAAI,0CAAqB,MAAM,YAC7B,SAAS,MAAM;yBAEf,0CAAS,MAAM;gBAEnB;YACF;YACA,SAAS,WAAY,CAAA,CAAC,OAAS,IAAG;QACpC,CAAA,GAAI;QAAC;QAAU;KAAQ;IAEvB,qBACE,gCAAC,oCAAc,QAAQ;QAAC,OAAO;OAC5B;AAGP;AAEO,SAAS;IACd,OAAO,CAAA,GAAA,iBAAS,EAAE;AACpB;AASO,SAAS,0CAAqB,IAAuB,EAAE,SAAoB;IAChF,qHAAqH;IACrH,IAAI,SAAS,KAAK,YAAY,CAAC;IAC/B,OACE,AAAC,CAAA,CAAC,UAAU,WAAW,OAAM,KAC7B,KAAK,MAAM,KAAK,SAAS,MAAM,IAC/B,CAAC,KAAK,YAAY,CAAC,eACnB,CAAC,UAAU,OAAO,IAAI,wBAAwB;IAC9C,CAAC,UAAU,OAAO,IAAI,4BAA4B;IAClD,CAAC,UAAU,MAAM,IAAI,WAAW;IAChC,CAAC,UAAU,QAAQ;AAEvB;AAEO,SAAS,0CAAS,MAAyB,EAAE,SAAoB,EAAE,aAAa,IAAI;QAOtE,oBAAA;IANnB,IAAI,WAAC,OAAO,WAAE,OAAO,UAAE,MAAM,YAAE,QAAQ,EAAC,GAAG;IAE3C,gGAAgG;IAChG,gGAAgG;IAChG,6GAA6G;IAC7G,mHAAmH;IACnH,IAAI,CAAA,GAAA,yCAAQ,SAAO,gBAAA,OAAO,KAAK,cAAZ,qCAAA,qBAAA,cAAc,IAAI,cAAlB,yCAAA,mBAAoB,UAAU,CAAC,WAAU,OAAO,MAAM,KAAK;QAC5E,IAAI,CAAA,GAAA,yCAAI,KACN,UAAU;aAEV,UAAU;;IAId,oGAAoG;IACpG,gIAAgI;IAChI,IAAI,QAAQ,CAAA,GAAA,yCAAO,OAAO,CAAA,GAAA,yCAAI,OAAO,CAAC,CAAA,GAAA,yCAAK,OAAO,OAE9C,IAAI,cAAc,WAAW;QAAC,eAAe;iBAAS;iBAAS;gBAAS;kBAAQ;IAAQ,KACxF,IAAI,WAAW,SAAS;iBAAC;iBAAS;gBAAS;kBAAQ;QAAU,SAAS;QAAM,YAAY;IAAI;IAC/F,0CAAiB,SAAS,GAAG;IAC9B,CAAA,GAAA,yCAAoB,EAAE;IACtB,OAAO,aAAa,CAAC;IACpB,0CAAiB,SAAS,GAAG;AAChC;AACA,uDAAuD;AACtD,0CAAiB,SAAS,GAAG;AAE9B,SAAS,uCAAiB,MAAe,EAAE,IAAuC;IAChF,IAAI,kBAAkB,mBACpB,KAAK;SACA,IAAI,OAAO,YAAY,CAAC,cAAc;QAC3C,IAAI,OAAO,SAAS,aAAa,CAAC;QAClC,KAAK,IAAI,GAAG,OAAO,YAAY,CAAC;QAChC,IAAI,OAAO,YAAY,CAAC,gBACtB,KAAK,MAAM,GAAG,OAAO,YAAY,CAAC;QAEpC,IAAI,OAAO,YAAY,CAAC,aACtB,KAAK,GAAG,GAAG,OAAO,YAAY,CAAC;QAEjC,IAAI,OAAO,YAAY,CAAC,kBACtB,KAAK,QAAQ,GAAG,OAAO,YAAY,CAAC;QAEtC,IAAI,OAAO,YAAY,CAAC,cACtB,KAAK,IAAI,GAAG,OAAO,YAAY,CAAC;QAElC,IAAI,OAAO,YAAY,CAAC,yBACtB,KAAK,cAAc,GAAG,OAAO,YAAY,CAAC;QAE5C,OAAO,WAAW,CAAC;QACnB,KAAK;QACL,OAAO,WAAW,CAAC;IACrB;AACF;AAEA,SAAS,wCAAkB,MAAe,EAAE,SAAoB;IAC9D,uCAAiB,QAAQ,CAAA,OAAQ,0CAAS,MAAM;AAClD;AAEO,SAAS,0CAAsB,KAAmB;IACvD,OAAO;QACL,aAAa,MAAM,IAAI;QACvB,eAAe,MAAM,MAAM;QAC3B,YAAY,MAAM,GAAG;QACrB,iBAAiB,MAAM,QAAQ;QAC/B,aAAa,MAAM,IAAI;QACvB,wBAAwB,MAAM,cAAc;IAC9C;AACF;AAEO,SAAS,0CAAa,KAAmB;IAC9C,IAAI,SAAS;IACb,OAAO;QACL,MAAM,CAAA,kBAAA,4BAAA,MAAO,IAAI,IAAG,OAAO,OAAO,CAAC,kBAAA,4BAAA,MAAO,IAAI,IAAI;QAClD,MAAM,EAAE,kBAAA,4BAAA,MAAO,MAAM;QACrB,GAAG,EAAE,kBAAA,4BAAA,MAAO,GAAG;QACf,QAAQ,EAAE,kBAAA,4BAAA,MAAO,QAAQ;QACzB,IAAI,EAAE,kBAAA,4BAAA,MAAO,IAAI;QACjB,cAAc,EAAE,kBAAA,4BAAA,MAAO,cAAc;IACvC;AACF","sources":["packages/@react-aria/utils/src/openLink.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 {focusWithoutScrolling, isMac, isWebKit} from './index';\nimport {Href, LinkDOMProps, RouterOptions} from '@react-types/shared';\nimport {isFirefox, isIPad} from './platform';\nimport React, {createContext, ReactNode, useContext, useMemo} from 'react';\n\ninterface Router {\n isNative: boolean,\n open: (target: Element, modifiers: Modifiers, href: Href, routerOptions: RouterOptions | undefined) => void,\n useHref: (href: Href) => string\n}\n\nconst RouterContext = createContext<Router>({\n isNative: true,\n open: openSyntheticLink,\n useHref: (href) => href\n});\n\ninterface RouterProviderProps {\n navigate: (path: Href, routerOptions: RouterOptions | undefined) => void,\n useHref?: (href: Href) => string,\n children: ReactNode\n}\n\n/**\n * A RouterProvider accepts a `navigate` function from a framework or client side router,\n * and provides it to all nested React Aria links to enable client side navigation.\n */\nexport function RouterProvider(props: RouterProviderProps) {\n let {children, navigate, useHref} = props;\n\n let ctx = useMemo(() => ({\n isNative: false,\n open: (target: Element, modifiers: Modifiers, href: Href, routerOptions: RouterOptions | undefined) => {\n getSyntheticLink(target, link => {\n if (shouldClientNavigate(link, modifiers)) {\n navigate(href, routerOptions);\n } else {\n openLink(link, modifiers);\n }\n });\n },\n useHref: useHref || ((href) => href)\n }), [navigate, useHref]);\n\n return (\n <RouterContext.Provider value={ctx}>\n {children}\n </RouterContext.Provider>\n );\n}\n\nexport function useRouter(): Router {\n return useContext(RouterContext);\n}\n\ninterface Modifiers {\n metaKey?: boolean,\n ctrlKey?: boolean,\n altKey?: boolean,\n shiftKey?: boolean\n}\n\nexport function shouldClientNavigate(link: HTMLAnchorElement, modifiers: Modifiers) {\n // Use getAttribute here instead of link.target. Firefox will default link.target to \"_parent\" when inside an iframe.\n let target = link.getAttribute('target');\n return (\n (!target || target === '_self') &&\n link.origin === location.origin &&\n !link.hasAttribute('download') &&\n !modifiers.metaKey && // open in new tab (mac)\n !modifiers.ctrlKey && // open in new tab (windows)\n !modifiers.altKey && // download\n !modifiers.shiftKey\n );\n}\n\nexport function openLink(target: HTMLAnchorElement, modifiers: Modifiers, setOpening = true) {\n let {metaKey, ctrlKey, altKey, shiftKey} = modifiers;\n\n // Firefox does not recognize keyboard events as a user action by default, and the popup blocker\n // will prevent links with target=\"_blank\" from opening. However, it does allow the event if the\n // Command/Control key is held, which opens the link in a background tab. This seems like the best we can do.\n // See https://bugzilla.mozilla.org/show_bug.cgi?id=257870 and https://bugzilla.mozilla.org/show_bug.cgi?id=746640.\n if (isFirefox() && window.event?.type?.startsWith('key') && target.target === '_blank') {\n if (isMac()) {\n metaKey = true;\n } else {\n ctrlKey = true;\n }\n }\n\n // WebKit does not support firing click events with modifier keys, but does support keyboard events.\n // https://github.com/WebKit/WebKit/blob/c03d0ac6e6db178f90923a0a63080b5ca210d25f/Source/WebCore/html/HTMLAnchorElement.cpp#L184\n let event = isWebKit() && isMac() && !isIPad() && process.env.NODE_ENV !== 'test'\n // @ts-ignore - keyIdentifier is a non-standard property, but it's what webkit expects\n ? new KeyboardEvent('keydown', {keyIdentifier: 'Enter', metaKey, ctrlKey, altKey, shiftKey})\n : new MouseEvent('click', {metaKey, ctrlKey, altKey, shiftKey, bubbles: true, cancelable: true});\n (openLink as any).isOpening = setOpening;\n focusWithoutScrolling(target);\n target.dispatchEvent(event);\n (openLink as any).isOpening = false;\n}\n// https://github.com/parcel-bundler/parcel/issues/8724\n(openLink as any).isOpening = false;\n\nfunction getSyntheticLink(target: Element, open: (link: HTMLAnchorElement) => void) {\n if (target instanceof HTMLAnchorElement) {\n open(target);\n } else if (target.hasAttribute('data-href')) {\n let link = document.createElement('a');\n link.href = target.getAttribute('data-href')!;\n if (target.hasAttribute('data-target')) {\n link.target = target.getAttribute('data-target')!;\n }\n if (target.hasAttribute('data-rel')) {\n link.rel = target.getAttribute('data-rel')!;\n }\n if (target.hasAttribute('data-download')) {\n link.download = target.getAttribute('data-download')!;\n }\n if (target.hasAttribute('data-ping')) {\n link.ping = target.getAttribute('data-ping')!;\n }\n if (target.hasAttribute('data-referrer-policy')) {\n link.referrerPolicy = target.getAttribute('data-referrer-policy')!;\n }\n target.appendChild(link);\n open(link);\n target.removeChild(link);\n }\n}\n\nfunction openSyntheticLink(target: Element, modifiers: Modifiers) {\n getSyntheticLink(target, link => openLink(link, modifiers));\n}\n\nexport function getSyntheticLinkProps(props: LinkDOMProps) {\n return {\n 'data-href': props.href,\n 'data-target': props.target,\n 'data-rel': props.rel,\n 'data-download': props.download,\n 'data-ping': props.ping,\n 'data-referrer-policy': props.referrerPolicy\n };\n}\n\nexport function useLinkProps(props: LinkDOMProps) {\n let router = useRouter();\n return {\n href: props?.href ? router.useHref(props?.href) : undefined,\n target: props?.target,\n rel: props?.rel,\n download: props?.download,\n ping: props?.ping,\n referrerPolicy: props?.referrerPolicy\n };\n}\n"],"names":[],"version":3,"file":"openLink.module.js.map"}
|
|
@@ -0,0 +1,64 @@
|
|
|
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, "isMac", () => $9e20cff0af27e8cc$export$9ac100e40613ea10);
|
|
7
|
+
$parcel$export(module.exports, "isIPhone", () => $9e20cff0af27e8cc$export$186c6964ca17d99);
|
|
8
|
+
$parcel$export(module.exports, "isIPad", () => $9e20cff0af27e8cc$export$7bef049ce92e4224);
|
|
9
|
+
$parcel$export(module.exports, "isIOS", () => $9e20cff0af27e8cc$export$fedb369cb70207f1);
|
|
10
|
+
$parcel$export(module.exports, "isAppleDevice", () => $9e20cff0af27e8cc$export$e1865c3bedcd822b);
|
|
11
|
+
$parcel$export(module.exports, "isWebKit", () => $9e20cff0af27e8cc$export$78551043582a6a98);
|
|
12
|
+
$parcel$export(module.exports, "isChrome", () => $9e20cff0af27e8cc$export$6446a186d09e379e);
|
|
13
|
+
$parcel$export(module.exports, "isAndroid", () => $9e20cff0af27e8cc$export$a11b0059900ceec8);
|
|
14
|
+
$parcel$export(module.exports, "isFirefox", () => $9e20cff0af27e8cc$export$b7d78993b74f766d);
|
|
15
|
+
/*
|
|
16
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
17
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
18
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
19
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
20
|
+
*
|
|
21
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
22
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
23
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
24
|
+
* governing permissions and limitations under the License.
|
|
25
|
+
*/ function $9e20cff0af27e8cc$var$testUserAgent(re) {
|
|
26
|
+
var _window_navigator_userAgentData;
|
|
27
|
+
if (typeof window === 'undefined' || window.navigator == null) return false;
|
|
28
|
+
return ((_window_navigator_userAgentData = window.navigator['userAgentData']) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands.some((brand)=>re.test(brand.brand))) || re.test(window.navigator.userAgent);
|
|
29
|
+
}
|
|
30
|
+
function $9e20cff0af27e8cc$var$testPlatform(re) {
|
|
31
|
+
var _window_navigator_userAgentData;
|
|
32
|
+
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;
|
|
33
|
+
}
|
|
34
|
+
function $9e20cff0af27e8cc$export$9ac100e40613ea10() {
|
|
35
|
+
return $9e20cff0af27e8cc$var$testPlatform(/^Mac/i);
|
|
36
|
+
}
|
|
37
|
+
function $9e20cff0af27e8cc$export$186c6964ca17d99() {
|
|
38
|
+
return $9e20cff0af27e8cc$var$testPlatform(/^iPhone/i);
|
|
39
|
+
}
|
|
40
|
+
function $9e20cff0af27e8cc$export$7bef049ce92e4224() {
|
|
41
|
+
return $9e20cff0af27e8cc$var$testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
42
|
+
$9e20cff0af27e8cc$export$9ac100e40613ea10() && navigator.maxTouchPoints > 1;
|
|
43
|
+
}
|
|
44
|
+
function $9e20cff0af27e8cc$export$fedb369cb70207f1() {
|
|
45
|
+
return $9e20cff0af27e8cc$export$186c6964ca17d99() || $9e20cff0af27e8cc$export$7bef049ce92e4224();
|
|
46
|
+
}
|
|
47
|
+
function $9e20cff0af27e8cc$export$e1865c3bedcd822b() {
|
|
48
|
+
return $9e20cff0af27e8cc$export$9ac100e40613ea10() || $9e20cff0af27e8cc$export$fedb369cb70207f1();
|
|
49
|
+
}
|
|
50
|
+
function $9e20cff0af27e8cc$export$78551043582a6a98() {
|
|
51
|
+
return $9e20cff0af27e8cc$var$testUserAgent(/AppleWebKit/i) && !$9e20cff0af27e8cc$export$6446a186d09e379e();
|
|
52
|
+
}
|
|
53
|
+
function $9e20cff0af27e8cc$export$6446a186d09e379e() {
|
|
54
|
+
return $9e20cff0af27e8cc$var$testUserAgent(/Chrome/i);
|
|
55
|
+
}
|
|
56
|
+
function $9e20cff0af27e8cc$export$a11b0059900ceec8() {
|
|
57
|
+
return $9e20cff0af27e8cc$var$testUserAgent(/Android/i);
|
|
58
|
+
}
|
|
59
|
+
function $9e20cff0af27e8cc$export$b7d78993b74f766d() {
|
|
60
|
+
return $9e20cff0af27e8cc$var$testUserAgent(/Firefox/i);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=platform.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,SAAS,oCAAc,EAAU;QAK7B;IAJF,IAAI,OAAO,WAAW,eAAe,OAAO,SAAS,IAAI,MACvD,OAAO;IAET,OAAO,EACL,kCAAA,OAAO,SAAS,CAAC,gBAAgB,cAAjC,sDAAA,gCAAmC,MAAM,CAAC,IAAI,CAAC,CAAC,QAA4C,GAAG,IAAI,CAAC,MAAM,KAAK,OAEjH,GAAG,IAAI,CAAC,OAAO,SAAS,CAAC,SAAS;AACpC;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;AAEO,SAAS;IACd,OAAO,mCAAa;AACtB;AAEO,SAAS;IACd,OAAO,mCAAa;AACtB;AAEO,SAAS;IACd,OAAO,mCAAa,aAClB,yFAAyF;IACxF,+CAAW,UAAU,cAAc,GAAG;AAC3C;AAEO,SAAS;IACd,OAAO,8CAAc;AACvB;AAEO,SAAS;IACd,OAAO,+CAAW;AACpB;AAEO,SAAS;IACd,OAAO,oCAAc,mBAAmB,CAAC;AAC3C;AAEO,SAAS;IACd,OAAO,oCAAc;AACvB;AAEO,SAAS;IACd,OAAO,oCAAc;AACvB;AAEO,SAAS;IACd,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 return (\n window.navigator['userAgentData']?.brands.some((brand: {brand: string, version: string}) => re.test(brand.brand))\n ) ||\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\nexport function isMac() {\n return testPlatform(/^Mac/i);\n}\n\nexport function isIPhone() {\n return testPlatform(/^iPhone/i);\n}\n\nexport function isIPad() {\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 function isIOS() {\n return isIPhone() || isIPad();\n}\n\nexport function isAppleDevice() {\n return isMac() || isIOS();\n}\n\nexport function isWebKit() {\n return testUserAgent(/AppleWebKit/i) && !isChrome();\n}\n\nexport function isChrome() {\n return testUserAgent(/Chrome/i);\n}\n\nexport function isAndroid() {\n return testUserAgent(/Android/i);\n}\n\nexport function isFirefox() {\n return testUserAgent(/Firefox/i);\n}\n"],"names":[],"version":3,"file":"platform.main.js.map"}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
return ((_window_navigator_userAgentData = window.navigator['userAgentData']) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands.some((brand)=>re.test(brand.brand))) || re.test(window.navigator.userAgent);
|
|
15
|
+
}
|
|
16
|
+
function $c87311424ea30a05$var$testPlatform(re) {
|
|
17
|
+
var _window_navigator_userAgentData;
|
|
18
|
+
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;
|
|
19
|
+
}
|
|
20
|
+
function $c87311424ea30a05$export$9ac100e40613ea10() {
|
|
21
|
+
return $c87311424ea30a05$var$testPlatform(/^Mac/i);
|
|
22
|
+
}
|
|
23
|
+
function $c87311424ea30a05$export$186c6964ca17d99() {
|
|
24
|
+
return $c87311424ea30a05$var$testPlatform(/^iPhone/i);
|
|
25
|
+
}
|
|
26
|
+
function $c87311424ea30a05$export$7bef049ce92e4224() {
|
|
27
|
+
return $c87311424ea30a05$var$testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
28
|
+
$c87311424ea30a05$export$9ac100e40613ea10() && navigator.maxTouchPoints > 1;
|
|
29
|
+
}
|
|
30
|
+
function $c87311424ea30a05$export$fedb369cb70207f1() {
|
|
31
|
+
return $c87311424ea30a05$export$186c6964ca17d99() || $c87311424ea30a05$export$7bef049ce92e4224();
|
|
32
|
+
}
|
|
33
|
+
function $c87311424ea30a05$export$e1865c3bedcd822b() {
|
|
34
|
+
return $c87311424ea30a05$export$9ac100e40613ea10() || $c87311424ea30a05$export$fedb369cb70207f1();
|
|
35
|
+
}
|
|
36
|
+
function $c87311424ea30a05$export$78551043582a6a98() {
|
|
37
|
+
return $c87311424ea30a05$var$testUserAgent(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e();
|
|
38
|
+
}
|
|
39
|
+
function $c87311424ea30a05$export$6446a186d09e379e() {
|
|
40
|
+
return $c87311424ea30a05$var$testUserAgent(/Chrome/i);
|
|
41
|
+
}
|
|
42
|
+
function $c87311424ea30a05$export$a11b0059900ceec8() {
|
|
43
|
+
return $c87311424ea30a05$var$testUserAgent(/Android/i);
|
|
44
|
+
}
|
|
45
|
+
function $c87311424ea30a05$export$b7d78993b74f766d() {
|
|
46
|
+
return $c87311424ea30a05$var$testUserAgent(/Firefox/i);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
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};
|
|
51
|
+
//# sourceMappingURL=platform.module.js.map
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
return ((_window_navigator_userAgentData = window.navigator['userAgentData']) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands.some((brand)=>re.test(brand.brand))) || re.test(window.navigator.userAgent);
|
|
15
|
+
}
|
|
16
|
+
function $c87311424ea30a05$var$testPlatform(re) {
|
|
17
|
+
var _window_navigator_userAgentData;
|
|
18
|
+
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;
|
|
19
|
+
}
|
|
20
|
+
function $c87311424ea30a05$export$9ac100e40613ea10() {
|
|
21
|
+
return $c87311424ea30a05$var$testPlatform(/^Mac/i);
|
|
22
|
+
}
|
|
23
|
+
function $c87311424ea30a05$export$186c6964ca17d99() {
|
|
24
|
+
return $c87311424ea30a05$var$testPlatform(/^iPhone/i);
|
|
25
|
+
}
|
|
26
|
+
function $c87311424ea30a05$export$7bef049ce92e4224() {
|
|
27
|
+
return $c87311424ea30a05$var$testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
28
|
+
$c87311424ea30a05$export$9ac100e40613ea10() && navigator.maxTouchPoints > 1;
|
|
29
|
+
}
|
|
30
|
+
function $c87311424ea30a05$export$fedb369cb70207f1() {
|
|
31
|
+
return $c87311424ea30a05$export$186c6964ca17d99() || $c87311424ea30a05$export$7bef049ce92e4224();
|
|
32
|
+
}
|
|
33
|
+
function $c87311424ea30a05$export$e1865c3bedcd822b() {
|
|
34
|
+
return $c87311424ea30a05$export$9ac100e40613ea10() || $c87311424ea30a05$export$fedb369cb70207f1();
|
|
35
|
+
}
|
|
36
|
+
function $c87311424ea30a05$export$78551043582a6a98() {
|
|
37
|
+
return $c87311424ea30a05$var$testUserAgent(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e();
|
|
38
|
+
}
|
|
39
|
+
function $c87311424ea30a05$export$6446a186d09e379e() {
|
|
40
|
+
return $c87311424ea30a05$var$testUserAgent(/Chrome/i);
|
|
41
|
+
}
|
|
42
|
+
function $c87311424ea30a05$export$a11b0059900ceec8() {
|
|
43
|
+
return $c87311424ea30a05$var$testUserAgent(/Android/i);
|
|
44
|
+
}
|
|
45
|
+
function $c87311424ea30a05$export$b7d78993b74f766d() {
|
|
46
|
+
return $c87311424ea30a05$var$testUserAgent(/Firefox/i);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
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};
|
|
51
|
+
//# sourceMappingURL=platform.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA;;;;;;;;;;CAUC,GAED,SAAS,oCAAc,EAAU;QAK7B;IAJF,IAAI,OAAO,WAAW,eAAe,OAAO,SAAS,IAAI,MACvD,OAAO;IAET,OAAO,EACL,kCAAA,OAAO,SAAS,CAAC,gBAAgB,cAAjC,sDAAA,gCAAmC,MAAM,CAAC,IAAI,CAAC,CAAC,QAA4C,GAAG,IAAI,CAAC,MAAM,KAAK,OAEjH,GAAG,IAAI,CAAC,OAAO,SAAS,CAAC,SAAS;AACpC;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;AAEO,SAAS;IACd,OAAO,mCAAa;AACtB;AAEO,SAAS;IACd,OAAO,mCAAa;AACtB;AAEO,SAAS;IACd,OAAO,mCAAa,aAClB,yFAAyF;IACxF,+CAAW,UAAU,cAAc,GAAG;AAC3C;AAEO,SAAS;IACd,OAAO,8CAAc;AACvB;AAEO,SAAS;IACd,OAAO,+CAAW;AACpB;AAEO,SAAS;IACd,OAAO,oCAAc,mBAAmB,CAAC;AAC3C;AAEO,SAAS;IACd,OAAO,oCAAc;AACvB;AAEO,SAAS;IACd,OAAO,oCAAc;AACvB;AAEO,SAAS;IACd,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 return (\n window.navigator['userAgentData']?.brands.some((brand: {brand: string, version: string}) => re.test(brand.brand))\n ) ||\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\nexport function isMac() {\n return testPlatform(/^Mac/i);\n}\n\nexport function isIPhone() {\n return testPlatform(/^iPhone/i);\n}\n\nexport function isIPad() {\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 function isIOS() {\n return isIPhone() || isIPad();\n}\n\nexport function isAppleDevice() {\n return isMac() || isIOS();\n}\n\nexport function isWebKit() {\n return testUserAgent(/AppleWebKit/i) && !isChrome();\n}\n\nexport function isChrome() {\n return testUserAgent(/Chrome/i);\n}\n\nexport function isAndroid() {\n return testUserAgent(/Android/i);\n}\n\nexport function isFirefox() {\n return testUserAgent(/Firefox/i);\n}\n"],"names":[],"version":3,"file":"platform.module.js.map"}
|
|
@@ -0,0 +1,82 @@
|
|
|
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
|
+
function $e8117ebcab55be6a$export$24490316f764c430(fn) {
|
|
72
|
+
// Wait one frame to see if an animation starts, e.g. a transition on mount.
|
|
73
|
+
requestAnimationFrame(()=>{
|
|
74
|
+
// If no transitions are running, call the function immediately.
|
|
75
|
+
// Otherwise, add it to a list of callbacks to run at the end of the animation.
|
|
76
|
+
if ($e8117ebcab55be6a$var$transitionsByElement.size === 0) fn();
|
|
77
|
+
else $e8117ebcab55be6a$var$transitionCallbacks.add(fn);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=runAfterTransition.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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;;AAI3C,SAAS,0CAAmB,EAAc;IAC/C,4EAA4E;IAC5E,sBAAsB;QACpB,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\nexport function runAfterTransition(fn: () => void) {\n // Wait one frame to see if an animation starts, e.g. a transition on mount.\n requestAnimationFrame(() => {\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"}
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
function $bbed8b41f857bcc0$export$24490316f764c430(fn) {
|
|
66
|
+
// Wait one frame to see if an animation starts, e.g. a transition on mount.
|
|
67
|
+
requestAnimationFrame(()=>{
|
|
68
|
+
// If no transitions are running, call the function immediately.
|
|
69
|
+
// Otherwise, add it to a list of callbacks to run at the end of the animation.
|
|
70
|
+
if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0) fn();
|
|
71
|
+
else $bbed8b41f857bcc0$var$transitionCallbacks.add(fn);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
export {$bbed8b41f857bcc0$export$24490316f764c430 as runAfterTransition};
|
|
77
|
+
//# sourceMappingURL=runAfterTransition.module.js.map
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
function $bbed8b41f857bcc0$export$24490316f764c430(fn) {
|
|
66
|
+
// Wait one frame to see if an animation starts, e.g. a transition on mount.
|
|
67
|
+
requestAnimationFrame(()=>{
|
|
68
|
+
// If no transitions are running, call the function immediately.
|
|
69
|
+
// Otherwise, add it to a list of callbacks to run at the end of the animation.
|
|
70
|
+
if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0) fn();
|
|
71
|
+
else $bbed8b41f857bcc0$var$transitionCallbacks.add(fn);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
export {$bbed8b41f857bcc0$export$24490316f764c430 as runAfterTransition};
|
|
77
|
+
//# sourceMappingURL=runAfterTransition.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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;;AAI3C,SAAS,0CAAmB,EAAc;IAC/C,4EAA4E;IAC5E,sBAAsB;QACpB,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\nexport function runAfterTransition(fn: () => void) {\n // Wait one frame to see if an animation starts, e.g. a transition on mount.\n requestAnimationFrame(() => {\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"}
|