@react-aria/utils 3.28.0 → 3.28.2
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/DOMFunctions.main.js.map +1 -1
- package/dist/DOMFunctions.module.js.map +1 -1
- package/dist/ShadowTreeWalker.main.js.map +1 -1
- package/dist/ShadowTreeWalker.module.js.map +1 -1
- package/dist/animation.main.js.map +1 -1
- package/dist/animation.module.js.map +1 -1
- package/dist/focusWithoutScrolling.main.js.map +1 -1
- package/dist/focusWithoutScrolling.module.js.map +1 -1
- package/dist/getOffset.main.js.map +1 -1
- package/dist/getOffset.module.js.map +1 -1
- package/dist/inertValue.main.js.map +1 -1
- package/dist/inertValue.module.js.map +1 -1
- package/dist/isFocusable.main.js.map +1 -1
- package/dist/isFocusable.module.js.map +1 -1
- package/dist/isVirtualEvent.main.js.map +1 -1
- package/dist/isVirtualEvent.module.js.map +1 -1
- package/dist/keyboard.main.js.map +1 -1
- package/dist/keyboard.module.js.map +1 -1
- package/dist/openLink.main.js +1 -1
- package/dist/openLink.main.js.map +1 -1
- package/dist/openLink.mjs +1 -1
- package/dist/openLink.module.js +1 -1
- package/dist/openLink.module.js.map +1 -1
- package/dist/platform.main.js +1 -0
- package/dist/platform.main.js.map +1 -1
- package/dist/platform.mjs +1 -0
- package/dist/platform.module.js +1 -0
- package/dist/platform.module.js.map +1 -1
- package/dist/runAfterTransition.main.js.map +1 -1
- package/dist/runAfterTransition.module.js.map +1 -1
- package/dist/scrollIntoView.main.js.map +1 -1
- package/dist/scrollIntoView.module.js.map +1 -1
- package/dist/types.d.ts +9 -30
- package/dist/types.d.ts.map +1 -1
- package/dist/useEvent.main.js.map +1 -1
- package/dist/useEvent.module.js.map +1 -1
- package/dist/useFormReset.main.js.map +1 -1
- package/dist/useFormReset.module.js.map +1 -1
- package/dist/useId.main.js +4 -3
- package/dist/useId.main.js.map +1 -1
- package/dist/useId.mjs +4 -3
- package/dist/useId.module.js +4 -3
- package/dist/useId.module.js.map +1 -1
- package/dist/useLoadMore.main.js.map +1 -1
- package/dist/useLoadMore.module.js.map +1 -1
- package/dist/useResizeObserver.main.js.map +1 -1
- package/dist/useResizeObserver.module.js.map +1 -1
- package/dist/useSyncRef.main.js.map +1 -1
- package/dist/useSyncRef.module.js.map +1 -1
- package/dist/useUpdateLayoutEffect.main.js.map +1 -1
- package/dist/useUpdateLayoutEffect.module.js.map +1 -1
- package/package.json +6 -6
- package/src/animation.ts +6 -6
- package/src/focusWithoutScrolling.ts +1 -1
- package/src/getOffset.ts +3 -1
- package/src/inertValue.ts +1 -1
- package/src/isFocusable.ts +2 -2
- package/src/isVirtualEvent.ts +1 -1
- package/src/keyboard.tsx +1 -1
- package/src/openLink.tsx +9 -9
- package/src/runAfterTransition.ts +1 -1
- package/src/scrollIntoView.ts +2 -2
- package/src/shadowdom/DOMFunctions.ts +5 -5
- package/src/shadowdom/ShadowTreeWalker.ts +1 -1
- package/src/useEvent.ts +1 -1
- package/src/useFormReset.ts +1 -1
- package/src/useId.ts +12 -5
- package/src/useLoadMore.ts +2 -2
- package/src/useResizeObserver.ts +1 -1
- package/src/useSyncRef.ts +1 -1
- package/src/useUpdateLayoutEffect.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;AAAA,kIAAkI;;;AAQ3H,SAAS,0CACd,IAA6B,EAC7B,SAAkC;IAElC,IAAI,CAAC,CAAA,GAAA,kCAAQ,KACX,OAAO,aAAa,OAAO,KAAK,QAAQ,CAAC,aAAa;IAGxD,IAAI,CAAC,QAAQ,CAAC,WACZ,OAAO;IAGT,IAAI,cAAqD;IAEzD,MAAO,gBAAgB,KAAM;QAC3B,IAAI,gBAAgB,MAClB,OAAO;QAGT,IAAI,AAAC,YAAgC,OAAO,KAAK,UAC/C,AAAC,YAAgC,YAAY,EAC7C,qBAAqB;QACrB,cAAc,AAAC,YAAgC,YAAY,CAAE,UAAU;aAClE,IAAI,CAAA,GAAA,sCAAW,EA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,0CAAgC,KAAQ;IACtD,IAAI,CAAA,GAAA,kCAAQ,OAAO,AAAC,MAAM,MAAM,CAAiB,UAAU,EAAE;QAC3D,IAAI,MAAM,YAAY,EACpB,OAAO,MAAM,YAAY,EAAE,CAAC,EAAE;IAElC;IACA,OAAO,MAAM,MAAM;AACrB","sources":["packages/@react-aria/utils/src/shadowdom/DOMFunctions.ts"],"sourcesContent":["// Source: https://github.com/microsoft/tabster/blob/a89fc5d7e332d48f68d03b1ca6e344489d1c3898/src/Shadowdomize/DOMFunctions.ts#L16\n\nimport {isShadowRoot} from '../domHelpers';\nimport {shadowDOM} from '@react-stately/flags';\n\n/**\n * ShadowDOM safe version of Node.contains.\n */\nexport function nodeContains(\n node: Node | null | undefined,\n otherNode: Node | null | undefined\n): boolean {\n if (!shadowDOM()) {\n return otherNode && node ? node.contains(otherNode) : false;\n }\n\n if (!node || !otherNode) {\n return false;\n }\n\n let currentNode: HTMLElement | Node | null | undefined = otherNode;\n\n while (currentNode !== null) {\n if (currentNode === node) {\n return true;\n }\n\n if ((currentNode as HTMLSlotElement).tagName === 'SLOT' &&\n (currentNode as HTMLSlotElement).assignedSlot) {\n // Element is slotted\n currentNode = (currentNode as HTMLSlotElement).assignedSlot!.parentNode;\n } else if (isShadowRoot(currentNode)) {\n // Element is in shadow root\n currentNode = currentNode.host;\n } else {\n currentNode = currentNode.parentNode;\n }\n }\n\n return false;\n}\n\n/**\n * ShadowDOM safe version of document.activeElement.\n */\nexport const getActiveElement = (doc: Document = document): Element | null => {\n if (!shadowDOM()) {\n return doc.activeElement;\n }\n let activeElement: Element | null = doc.activeElement;\n\n while (activeElement && 'shadowRoot' in activeElement &&\n activeElement.shadowRoot?.activeElement) {\n activeElement = activeElement.shadowRoot.activeElement;\n }\n\n return activeElement;\n};\n\n/**\n * ShadowDOM safe version of event.target.\n */\nexport function getEventTarget<T extends Event>(event: T): Element {\n if (shadowDOM() && (event.target as HTMLElement).shadowRoot) {\n if (event.composedPath) {\n return event.composedPath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IAAI,AAAC,YAAgC,OAAO,KAAK,UAC/C,AAAC,YAAgC,YAAY,EAC7C,qBAAqB;QACrB,cAAc,AAAC,YAAgC,YAAY,CAAE,UAAU;aAClE,IAAI,CAAA,GAAA,yCAAW,EAAE,cACtB,4BAA4B;QAC5B,cAAc,YAAY,IAAI;aAE9B,cAAc,YAAY,UAAU;IAExC;IAEA,OAAO;AACT;AAKO,MAAM,4CAAmB,CAAC,MAAgB,QAAQ;QAOvD;IANA,IAAI,CAAC,CAAA,GAAA,gBAAQ,KACX,OAAO,IAAI,aAAa;IAE1B,IAAI,gBAAgC,IAAI,aAAa;IAErD,MAAO,iBAAiB,gBAAgB,mBACxC,4BAAA,cAAc,UAAU,cAAxB,gDAAA,0BAA0B,aAAa,EACrC,gBAAgB,cAAc,UAAU,CAAC,aAAa;IAGxD,OAAO;AACT;AAKO,SAAS,0CAAgC,KAAQ;IACtD,IAAI,CAAA,GAAA,gBAAQ,OAAO,AAAC,MAAM,MAAM,CAAiB,UAAU,EAAE;QAC3D,IAAI,MAAM,YAAY,EACpB,OAAO,MAAM,YAAY,EAAE,CAAC,EAAE;IAElC;IACA,OAAO,MAAM,MAAM;AACrB","sources":["packages/@react-aria/utils/src/shadowdom/DOMFunctions.ts"],"sourcesContent":["// Source: https://github.com/microsoft/tabster/blob/a89fc5d7e332d48f68d03b1ca6e344489d1c3898/src/Shadowdomize/DOMFunctions.ts#L16\n\nimport {isShadowRoot} from '../domHelpers';\nimport {shadowDOM} from '@react-stately/flags';\n\n/**\n * ShadowDOM safe version of Node.contains.\n */\nexport function nodeContains(\n node: Node | null | undefined,\n otherNode: Node | null | undefined\n): boolean {\n if (!shadowDOM()) {\n return otherNode && node ? node.contains(otherNode) : false;\n }\n\n if (!node || !otherNode) {\n return false;\n }\n\n let currentNode: HTMLElement | Node | null | undefined = otherNode;\n\n while (currentNode !== null) {\n if (currentNode === node) {\n return true;\n }\n\n if ((currentNode as HTMLSlotElement).tagName === 'SLOT' &&\n (currentNode as HTMLSlotElement).assignedSlot) {\n // Element is slotted\n currentNode = (currentNode as HTMLSlotElement).assignedSlot!.parentNode;\n } else if (isShadowRoot(currentNode)) {\n // Element is in shadow root\n currentNode = currentNode.host;\n } else {\n currentNode = currentNode.parentNode;\n }\n }\n\n return false;\n}\n\n/**\n * ShadowDOM safe version of document.activeElement.\n */\nexport const getActiveElement = (doc: Document = document): Element | null => {\n if (!shadowDOM()) {\n return doc.activeElement;\n }\n let activeElement: Element | null = doc.activeElement;\n\n while (activeElement && 'shadowRoot' in activeElement &&\n activeElement.shadowRoot?.activeElement) {\n activeElement = activeElement.shadowRoot.activeElement;\n }\n\n return activeElement;\n};\n\n/**\n * ShadowDOM safe version of event.target.\n */\nexport function getEventTarget<T extends Event>(event: T): Element {\n if (shadowDOM() && (event.target as HTMLElement).shadowRoot) {\n if (event.composedPath) {\n return event.composedPath()[0] as Element;\n }\n }\n return event.target as Element;\n}\n"],"names":[],"version":3,"file":"DOMFunctions.module.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;AAAA,0HAA0H;;;AAKnH,MAAM;IAmEX,IAAW,cAAoB;QAC7B,OAAO,IAAI,CAAC,YAAY;IAC1B;IAEA,IAAW,YAAY,IAAU,EAAE;QACjC,IAAI,CAAC,CAAA,GAAA,sCAAW,EAAE,IAAI,CAAC,IAAI,EAAE,OAC3B,MAAM,IAAI,MACR;QAIJ,MAAM,UAAwB,EAAE;QAChC,IAAI,UAAmC;QACvC,IAAI,2BAA2B;QAE/B,IAAI,CAAC,YAAY,GAAG;QAEpB,MAAO,WAAW,YAAY,IAAI,CAAC,IAAI,CACrC,IAAI,QAAQ,QAAQ,KAAK,KAAK,sBAAsB,EAAE;YACpD,MAAM,aAAa;YAEnB,MAAM,SAAS,IAAI,CAAC,IAAI,CAAC,gBAAgB,CACvC,YACA,IAAI,CAAC,UAAU,EACf;gBAAC,YAAY,IAAI,CAAC,WAAW;YAAA;YAG/B,QAAQ,IAAI,CAAC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GM;oBAFX,IAAI,OAAO,IAAI,CAAC,MAAM,KAAK,YACzB,OAAO,IAAI,CAAC,MAAM,CAAC;yBACd,KAAI,eAAA,IAAI,CAAC,MAAM,cAAX,mCAAA,aAAa,UAAU,EAChC,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;yBACzB,IAAI,IAAI,CAAC,MAAM,KAAK,MACzB,OAAO,WAAW,aAAa;gBAEnC;YACF;YAEA,OAAO,WAAW,WAAW;QAC/B;QAjDE,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,MAAM,GAAG,mBAAA,oBAAA,SAAU;QACxB,IAAI,CAAC,UAAU,GAAG,uBAAA,wBAAA,aAAc,WAAW,QAAQ;QACnD,IAAI,CAAC,YAAY,GAAG;QAEpB,IAAI,CAAC,YAAY,CAAC,OAAO,CACvB,IAAI,gBAAgB,CAAC,MAAM,YAAY,IAAI,CAAC,WAAW;QAGzD,MAAM,aAAa,AAAC,KAAiB,UAAU;QAE/C,IAAI,YAAY;YACd,MAAM,SAAS,IAAI,CAAC,IAAI,CAAC,gBAAgB,CACvC,YACA,IAAI,CAAC,UAAU,EACf;gBAAC,YAAY,IAAI,CAAC,WAAW;YAAA;YAG/B,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC;QAC5B;IACF;AAqQF;AAKO,SAAS,0CACZ,GAAa,EACb,IAAU,EACV,UAAmB,EACnB,MAA0B;IAE5B,IAAI,CAAA,GAAA,kCAAQ,KACV,OAAO,IAAI,0CAAiB,KAAK,MAAM,YAAY;IAErD,OAAO,IAAI,gBAAgB,CAAC,MAAM,YAAY;AAChD","sources":["packages/@react-aria/utils/src/shadowdom/ShadowTreeWalker.ts"],"sourcesContent":["// https://github.com/microsoft/tabster/blob/a89fc5d7e332d48f68d03b1ca6e344489d1c3898/src/Shadowdomize/ShadowTreeWalker.ts\n\nimport {nodeContains} from './DOMFunctions';\nimport {shadowDOM} from '@react-stately/flags';\n\nexport class ShadowTreeWalker implements TreeWalker {\n public readonly filter: NodeFilter | null;\n public readonly root: Node;\n public readonly whatToShow: number;\n\n private _doc: Document;\n private _walkerStack: Array<TreeWalker> = [];\n private _currentNode: Node;\n private _currentSetFor: Set<TreeWalker> = new Set();\n\n constructor(\n doc: Document,\n root: Node,\n whatToShow?: number,\n filter?: NodeFilter | null\n ) {\n this._doc = doc;\n this.root = root;\n this.filter = filter ?? null;\n this.whatToShow = whatToShow ?? NodeFilter.SHOW_ALL;\n this._currentNode = root;\n\n this._walkerStack.unshift(\n doc.createTreeWalker(root, whatToShow, this._acceptNode)\n );\n\n const shadowRoot = (root as Element).shadowRoot;\n\n if (shadowRoot) {\n const walker = this._doc.createTreeWalker(\n shadowRoot,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n this._walkerStack.unshift(walker);\n }\n }\n\n private _acceptNode = (node: Node): number => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n const shadowRoot = (node as Element).shadowRoot;\n\n if (shadowRoot) {\n const walker = this._doc.createTreeWalker(\n shadowRoot,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n this._walkerStack.unshift(walker);\n\n return NodeFilter.FILTER_ACCEPT;\n } else {\n if (typeof this.filter === 'function') {\n return this.filter(node);\n } else if (this.filter?.acceptNode) {\n return this.filter.acceptNode(node);\n } else if (this.filter === null) {\n return NodeFilter.FILTER_ACCEPT;\n }\n }\n }\n\n return NodeFilter.FILTER_SKIP;\n };\n\n public get currentNode(): Node {\n return this._currentNode;\n }\n\n public set currentNode(node: Node) {\n if (!nodeContains(this.root, node)) {\n throw new Error(\n 'Cannot set currentNode to a node that is not contained by the root node.'\n );\n }\n\n const walkers: TreeWalker[] = [];\n let curNode: Node | null | undefined = node;\n let currentWalkerCurrentNode = node;\n\n this._currentNode = node;\n\n while (curNode && curNode !== this.root) {\n if (curNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n const shadowRoot = curNode as ShadowRoot;\n\n const walker = this._doc.createTreeWalker(\n shadowRoot,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n walkers.push(walker);\n\n walker.currentNode = currentWalkerCurrentNode;\n\n this._currentSetFor.add(walker);\n\n curNode = currentWalkerCurrentNode = shadowRoot.host;\n } else {\n curNode = curNode.parentNode;\n }\n }\n\n const walker = this._doc.createTreeWalker(\n this.root,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n walkers.push(walker);\n\n walker.currentNode = currentWalkerCurrentNode;\n\n this._currentSetFor.add(walker);\n\n this._walkerStack = walkers;\n }\n\n public get doc(): Document {\n return this._doc;\n }\n\n public firstChild(): Node | null {\n let currentNode = this.currentNode;\n let newNode = this.nextNode();\n if (!nodeContains(currentNode, newNode)) {\n this.currentNode = currentNode;\n return null;\n }\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n public lastChild(): Node | null {\n let walker = this._walkerStack[0];\n let newNode = walker.lastChild();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n public nextNode(): Node | null {\n const nextNode = this._walkerStack[0].nextNode();\n\n if (nextNode) {\n const shadowRoot = (nextNode as Element).shadowRoot;\n\n if (shadowRoot) {\n let nodeResult: number | undefined;\n\n if (typeof this.filter === 'function') {\n nodeResult = this.filter(nextNode);\n } else if (this.filter?.acceptNode) {\n nodeResult = this.filter.acceptNode(nextNode);\n }\n\n if (nodeResult === NodeFilter.FILTER_ACCEPT) {\n this.currentNode = nextNode;\n return nextNode;\n }\n\n // _acceptNode should have added new walker for this shadow,\n // go in recursively.\n let newNode = this.nextNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n if (nextNode) {\n this.currentNode = nextNode;\n }\n return nextNode;\n } else {\n if (this._walkerStack.length > 1) {\n this._walkerStack.shift();\n\n let newNode = this.nextNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n } else {\n return null;\n }\n }\n }\n\n public previousNode(): Node | null {\n const currentWalker = this._walkerStack[0];\n\n if (currentWalker.currentNode === currentWalker.root) {\n if (this._currentSetFor.has(currentWalker)) {\n this._currentSetFor.delete(currentWalker);\n\n if (this._walkerStack.length > 1) {\n this._walkerStack.shift();\n let newNode = this.previousNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n } else {\n return null;\n }\n }\n\n return null;\n }\n\n const previousNode = currentWalker.previousNode();\n\n if (previousNode) {\n const shadowRoot = (previousNode as Element).shadowRoot;\n\n if (shadowRoot) {\n let nodeResult: number | undefined;\n\n if (typeof this.filter === 'function') {\n nodeResult = this.filter(previousNode);\n } else if (this.filter?.acceptNode) {\n nodeResult = this.filter.acceptNode(previousNode);\n }\n\n if (nodeResult === NodeFilter.FILTER_ACCEPT) {\n if (previousNode) {\n this.currentNode = previousNode;\n }\n return previousNode;\n }\n\n // _acceptNode should have added new walker for this shadow,\n // go in recursively.\n let newNode = this.lastChild();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n if (previousNode) {\n this.currentNode = previousNode;\n }\n return previousNode;\n } else {\n if (this._walkerStack.length > 1) {\n this._walkerStack.shift();\n\n let newNode = this.previousNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n } else {\n return null;\n }\n }\n }\n\n /**\n * @deprecated\n */\n public nextSibling(): Node | null {\n // if (__DEV__) {\n // throw new Error(\"Method not implemented.\");\n // }\n\n return null;\n }\n\n /**\n * @deprecated\n */\n public previousSibling(): Node | null {\n // if (__DEV__) {\n // throw new Error(\"Method not implemented.\");\n // }\n\n return null;\n }\n\n /**\n * @deprecated\n */\n public parentNode(): Node | null {\n // if (__DEV__) {\n // throw new Error(\"Method not implemented.\");\n // }\n\n return null;\n }\n}\n\n/**\n * ShadowDOM safe version of document.createTreeWalker.\n */\nexport function createShadowTreeWalker(\n doc: Document,\n root: Node,\n whatToShow?: number,\n filter?: NodeFilter | null\n) {\n if (shadowDOM()) {\n return new ShadowTreeWalker(doc, root, whatToShow, filter);\n }\n return doc.createTreeWalker(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AAM,YAAY,IAAI,CAAC,WAAW;QAGzD,MAAM,aAAa,AAAC,KAAiB,UAAU;QAE/C,IAAI,YAAY;YACd,MAAM,SAAS,IAAI,CAAC,IAAI,CAAC,gBAAgB,CACvC,YACA,IAAI,CAAC,UAAU,EACf;gBAAC,YAAY,IAAI,CAAC,WAAW;YAAA;YAG/B,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC;QAC5B;IACF;AAqQF;AAKO,SAAS,0CACZ,GAAa,EACb,IAAU,EACV,UAAmB,EACnB,MAA0B;IAE5B,IAAI,CAAA,GAAA,kCAAQ,KACV,OAAO,IAAI,0CAAiB,KAAK,MAAM,YAAY;IAErD,OAAO,IAAI,gBAAgB,CAAC,MAAM,YAAY;AAChD","sources":["packages/@react-aria/utils/src/shadowdom/ShadowTreeWalker.ts"],"sourcesContent":["// https://github.com/microsoft/tabster/blob/a89fc5d7e332d48f68d03b1ca6e344489d1c3898/src/Shadowdomize/ShadowTreeWalker.ts\n\nimport {nodeContains} from './DOMFunctions';\nimport {shadowDOM} from '@react-stately/flags';\n\nexport class ShadowTreeWalker implements TreeWalker {\n public readonly filter: NodeFilter | null;\n public readonly root: Node;\n public readonly whatToShow: number;\n\n private _doc: Document;\n private _walkerStack: Array<TreeWalker> = [];\n private _currentNode: Node;\n private _currentSetFor: Set<TreeWalker> = new Set();\n\n constructor(\n doc: Document,\n root: Node,\n whatToShow?: number,\n filter?: NodeFilter | null\n ) {\n this._doc = doc;\n this.root = root;\n this.filter = filter ?? null;\n this.whatToShow = whatToShow ?? NodeFilter.SHOW_ALL;\n this._currentNode = root;\n\n this._walkerStack.unshift(\n doc.createTreeWalker(root, whatToShow, this._acceptNode)\n );\n\n const shadowRoot = (root as Element).shadowRoot;\n\n if (shadowRoot) {\n const walker = this._doc.createTreeWalker(\n shadowRoot,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n this._walkerStack.unshift(walker);\n }\n }\n\n private _acceptNode = (node: Node): number => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n const shadowRoot = (node as Element).shadowRoot;\n\n if (shadowRoot) {\n const walker = this._doc.createTreeWalker(\n shadowRoot,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n this._walkerStack.unshift(walker);\n\n return NodeFilter.FILTER_ACCEPT;\n } else {\n if (typeof this.filter === 'function') {\n return this.filter(node);\n } else if (this.filter?.acceptNode) {\n return this.filter.acceptNode(node);\n } else if (this.filter === null) {\n return NodeFilter.FILTER_ACCEPT;\n }\n }\n }\n\n return NodeFilter.FILTER_SKIP;\n };\n\n public get currentNode(): Node {\n return this._currentNode;\n }\n\n public set currentNode(node: Node) {\n if (!nodeContains(this.root, node)) {\n throw new Error(\n 'Cannot set currentNode to a node that is not contained by the root node.'\n );\n }\n\n const walkers: TreeWalker[] = [];\n let curNode: Node | null | undefined = node;\n let currentWalkerCurrentNode = node;\n\n this._currentNode = node;\n\n while (curNode && curNode !== this.root) {\n if (curNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n const shadowRoot = curNode as ShadowRoot;\n\n const walker = this._doc.createTreeWalker(\n shadowRoot,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n walkers.push(walker);\n\n walker.currentNode = currentWalkerCurrentNode;\n\n this._currentSetFor.add(walker);\n\n curNode = currentWalkerCurrentNode = shadowRoot.host;\n } else {\n curNode = curNode.parentNode;\n }\n }\n\n const walker = this._doc.createTreeWalker(\n this.root,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n walkers.push(walker);\n\n walker.currentNode = currentWalkerCurrentNode;\n\n this._currentSetFor.add(walker);\n\n this._walkerStack = walkers;\n }\n\n public get doc(): Document {\n return this._doc;\n }\n\n public firstChild(): Node | null {\n let currentNode = this.currentNode;\n let newNode = this.nextNode();\n if (!nodeContains(currentNode, newNode)) {\n this.currentNode = currentNode;\n return null;\n }\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n public lastChild(): Node | null {\n let walker = this._walkerStack[0];\n let newNode = walker.lastChild();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n public nextNode(): Node | null {\n const nextNode = this._walkerStack[0].nextNode();\n\n if (nextNode) {\n const shadowRoot = (nextNode as Element).shadowRoot;\n\n if (shadowRoot) {\n let nodeResult: number | undefined;\n\n if (typeof this.filter === 'function') {\n nodeResult = this.filter(nextNode);\n } else if (this.filter?.acceptNode) {\n nodeResult = this.filter.acceptNode(nextNode);\n }\n\n if (nodeResult === NodeFilter.FILTER_ACCEPT) {\n this.currentNode = nextNode;\n return nextNode;\n }\n\n // _acceptNode should have added new walker for this shadow,\n // go in recursively.\n let newNode = this.nextNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n if (nextNode) {\n this.currentNode = nextNode;\n }\n return nextNode;\n } else {\n if (this._walkerStack.length > 1) {\n this._walkerStack.shift();\n\n let newNode = this.nextNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n } else {\n return null;\n }\n }\n }\n\n public previousNode(): Node | null {\n const currentWalker = this._walkerStack[0];\n\n if (currentWalker.currentNode === currentWalker.root) {\n if (this._currentSetFor.has(currentWalker)) {\n this._currentSetFor.delete(currentWalker);\n\n if (this._walkerStack.length > 1) {\n this._walkerStack.shift();\n let newNode = this.previousNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n } else {\n return null;\n }\n }\n\n return null;\n }\n\n const previousNode = currentWalker.previousNode();\n\n if (previousNode) {\n const shadowRoot = (previousNode as Element).shadowRoot;\n\n if (shadowRoot) {\n let nodeResult: number | undefined;\n\n if (typeof this.filter === 'function') {\n nodeResult = this.filter(previousNode);\n } else if (this.filter?.acceptNode) {\n nodeResult = this.filter.acceptNode(previousNode);\n }\n\n if (nodeResult === NodeFilter.FILTER_ACCEPT) {\n if (previousNode) {\n this.currentNode = previousNode;\n }\n return previousNode;\n }\n\n // _acceptNode should have added new walker for this shadow,\n // go in recursively.\n let newNode = this.lastChild();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n if (previousNode) {\n this.currentNode = previousNode;\n }\n return previousNode;\n } else {\n if (this._walkerStack.length > 1) {\n this._walkerStack.shift();\n\n let newNode = this.previousNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n } else {\n return null;\n }\n }\n }\n\n /**\n * @deprecated\n */\n public nextSibling(): Node | null {\n // if (__DEV__) {\n // throw new Error(\"Method not implemented.\");\n // }\n\n return null;\n }\n\n /**\n * @deprecated\n */\n public previousSibling(): Node | null {\n // if (__DEV__) {\n // throw new Error(\"Method not implemented.\");\n // }\n\n return null;\n }\n\n /**\n * @deprecated\n */\n public parentNode(): Node | null {\n // if (__DEV__) {\n // throw new Error(\"Method not implemented.\");\n // }\n\n return null;\n }\n}\n\n/**\n * ShadowDOM safe version of document.createTreeWalker.\n */\nexport function createShadowTreeWalker(\n doc: Document,\n root: Node,\n whatToShow?: number,\n filter?: NodeFilter | null\n): TreeWalker {\n if (shadowDOM()) {\n return new ShadowTreeWalker(doc, root, whatToShow, filter);\n }\n return doc.createTreeWalker(root, whatToShow, filter);\n}\n"],"names":[],"version":3,"file":"ShadowTreeWalker.main.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;AAAA,0HAA0H;;;AAKnH,MAAM;IAmEX,IAAW,cAAoB;QAC7B,OAAO,IAAI,CAAC,YAAY;IAC1B;IAEA,IAAW,YAAY,IAAU,EAAE;QACjC,IAAI,CAAC,CAAA,GAAA,yCAAW,EAAE,IAAI,CAAC,IAAI,EAAE,OAC3B,MAAM,IAAI,MACR;QAIJ,MAAM,UAAwB,EAAE;QAChC,IAAI,UAAmC;QACvC,IAAI,2BAA2B;QAE/B,IAAI,CAAC,YAAY,GAAG;QAEpB,MAAO,WAAW,YAAY,IAAI,CAAC,IAAI,CACrC,IAAI,QAAQ,QAAQ,KAAK,KAAK,sBAAsB,EAAE;YACpD,MAAM,aAAa;YAEnB,MAAM,SAAS,IAAI,CAAC,IA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332d48f68d03b1ca6e344489d1c3898/src/Shadowdomize/ShadowTreeWalker.ts\n\nimport {nodeContains} from './DOMFunctions';\nimport {shadowDOM} from '@react-stately/flags';\n\nexport class ShadowTreeWalker implements TreeWalker {\n public readonly filter: NodeFilter | null;\n public readonly root: Node;\n public readonly whatToShow: number;\n\n private _doc: Document;\n private _walkerStack: Array<TreeWalker> = [];\n private _currentNode: Node;\n private _currentSetFor: Set<TreeWalker> = new Set();\n\n constructor(\n doc: Document,\n root: Node,\n whatToShow?: number,\n filter?: NodeFilter | null\n ) {\n this._doc = doc;\n this.root = root;\n this.filter = filter ?? null;\n this.whatToShow = whatToShow ?? NodeFilter.SHOW_ALL;\n this._currentNode = root;\n\n this._walkerStack.unshift(\n doc.createTreeWalker(root, whatToShow, this._acceptNode)\n );\n\n const shadowRoot = (root as Element).shadowRoot;\n\n if (shadowRoot) {\n const walker = this._doc.createTreeWalker(\n shadowRoot,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n this._walkerStack.unshift(walker);\n }\n }\n\n private _acceptNode = (node: Node): number => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n const shadowRoot = (node as Element).shadowRoot;\n\n if (shadowRoot) {\n const walker = this._doc.createTreeWalker(\n shadowRoot,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n this._walkerStack.unshift(walker);\n\n return NodeFilter.FILTER_ACCEPT;\n } else {\n if (typeof this.filter === 'function') {\n return this.filter(node);\n } else if (this.filter?.acceptNode) {\n return this.filter.acceptNode(node);\n } else if (this.filter === null) {\n return NodeFilter.FILTER_ACCEPT;\n }\n }\n }\n\n return NodeFilter.FILTER_SKIP;\n };\n\n public get currentNode(): Node {\n return this._currentNode;\n }\n\n public set currentNode(node: Node) {\n if (!nodeContains(this.root, node)) {\n throw new Error(\n 'Cannot set currentNode to a node that is not contained by the root node.'\n );\n }\n\n const walkers: TreeWalker[] = [];\n let curNode: Node | null | undefined = node;\n let currentWalkerCurrentNode = node;\n\n this._currentNode = node;\n\n while (curNode && curNode !== this.root) {\n if (curNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n const shadowRoot = curNode as ShadowRoot;\n\n const walker = this._doc.createTreeWalker(\n shadowRoot,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n walkers.push(walker);\n\n walker.currentNode = currentWalkerCurrentNode;\n\n this._currentSetFor.add(walker);\n\n curNode = currentWalkerCurrentNode = shadowRoot.host;\n } else {\n curNode = curNode.parentNode;\n }\n }\n\n const walker = this._doc.createTreeWalker(\n this.root,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n walkers.push(walker);\n\n walker.currentNode = currentWalkerCurrentNode;\n\n this._currentSetFor.add(walker);\n\n this._walkerStack = walkers;\n }\n\n public get doc(): Document {\n return this._doc;\n }\n\n public firstChild(): Node | null {\n let currentNode = this.currentNode;\n let newNode = this.nextNode();\n if (!nodeContains(currentNode, newNode)) {\n this.currentNode = currentNode;\n return null;\n }\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n public lastChild(): Node | null {\n let walker = this._walkerStack[0];\n let newNode = walker.lastChild();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n public nextNode(): Node | null {\n const nextNode = this._walkerStack[0].nextNode();\n\n if (nextNode) {\n const shadowRoot = (nextNode as Element).shadowRoot;\n\n if (shadowRoot) {\n let nodeResult: number | undefined;\n\n if (typeof this.filter === 'function') {\n nodeResult = this.filter(nextNode);\n } else if (this.filter?.acceptNode) {\n nodeResult = this.filter.acceptNode(nextNode);\n }\n\n if (nodeResult === NodeFilter.FILTER_ACCEPT) {\n this.currentNode = nextNode;\n return nextNode;\n }\n\n // _acceptNode should have added new walker for this shadow,\n // go in recursively.\n let newNode = this.nextNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n if (nextNode) {\n this.currentNode = nextNode;\n }\n return nextNode;\n } else {\n if (this._walkerStack.length > 1) {\n this._walkerStack.shift();\n\n let newNode = this.nextNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n } else {\n return null;\n }\n }\n }\n\n public previousNode(): Node | null {\n const currentWalker = this._walkerStack[0];\n\n if (currentWalker.currentNode === currentWalker.root) {\n if (this._currentSetFor.has(currentWalker)) {\n this._currentSetFor.delete(currentWalker);\n\n if (this._walkerStack.length > 1) {\n this._walkerStack.shift();\n let newNode = this.previousNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n } else {\n return null;\n }\n }\n\n return null;\n }\n\n const previousNode = currentWalker.previousNode();\n\n if (previousNode) {\n const shadowRoot = (previousNode as Element).shadowRoot;\n\n if (shadowRoot) {\n let nodeResult: number | undefined;\n\n if (typeof this.filter === 'function') {\n nodeResult = this.filter(previousNode);\n } else if (this.filter?.acceptNode) {\n nodeResult = this.filter.acceptNode(previousNode);\n }\n\n if (nodeResult === NodeFilter.FILTER_ACCEPT) {\n if (previousNode) {\n this.currentNode = previousNode;\n }\n return previousNode;\n }\n\n // _acceptNode should have added new walker for this shadow,\n // go in recursively.\n let newNode = this.lastChild();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n if (previousNode) {\n this.currentNode = previousNode;\n }\n return previousNode;\n } else {\n if (this._walkerStack.length > 1) {\n this._walkerStack.shift();\n\n let newNode = this.previousNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n } else {\n return null;\n }\n }\n }\n\n /**\n * @deprecated\n */\n public nextSibling(): Node | null {\n // if (__DEV__) {\n // throw new Error(\"Method not implemented.\");\n // }\n\n return null;\n }\n\n /**\n * @deprecated\n */\n public previousSibling(): Node | null {\n // if (__DEV__) {\n // throw new Error(\"Method not implemented.\");\n // }\n\n return null;\n }\n\n /**\n * @deprecated\n */\n public parentNode(): Node | null {\n // if (__DEV__) {\n // throw new Error(\"Method not implemented.\");\n // }\n\n return null;\n }\n}\n\n/**\n * ShadowDOM safe version of document.createTreeWalker.\n */\nexport function createShadowTreeWalker(\n doc: Document,\n root: Node,\n whatToShow?: number,\n filter?: NodeFilter | null\n) {\n if (shadowDOM()) {\n return new ShadowTreeWalker(doc, root, whatToShow, filter);\n }\n return doc.createTreeWalker(root, whatToShow, filter);\n}\n"],"names":[],"version":3,"file":"ShadowTreeWalker.module.js.map"}
|
|
1
|
+
{"mappings":";;;AAAA,0HAA0H;;;AAKnH,MAAM;IAmEX,IAAW,cAAoB;QAC7B,OAAO,IAAI,CAAC,YAAY;IAC1B;IAEA,IAAW,YAAY,IAAU,EAAE;QACjC,IAAI,CAAC,CAAA,GAAA,yCAAW,EAAE,IAAI,CAAC,IAAI,EAAE,OAC3B,MAAM,IAAI,MACR;QAIJ,MAAM,UAAwB,EAAE;QAChC,IAAI,UAAmC;QACvC,IAAI,2BAA2B;QAE/B,IAAI,CAAC,YAAY,GAAG;QAEpB,MAAO,WAAW,YAAY,IAAI,CAAC,IAAI,CACrC,IAAI,QAAQ,QAAQ,KAAK,KAAK,sBAAsB,EAAE;YACpD,MAAM,aAAa;YAEnB,MAAM,SAAS,IAAI,CAAC,IAAI,CAAC,gBAAgB,CACvC,YACA,IAAI,CAAC,UAAU,EACf;gBAAC,YAAY,IAAI,CAAC,WAAW;YAAA;YAG/B,QAAQ,IAAI,CAAC;YAEb,OAAO,WAAW,GAAG;YAErB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC;YAExB,UAAU,2BAA2B,WAAW,IAAI;QACtD,OACE,UAAU,QAAQ,UAAU;QAIhC,MAAM,SAAS,IAAI,CAAC,IAAI,CAAC,gBAAgB,CACvC,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,UAAU,EACf;YAAC,YAAY,IAAI,CAAC,WAAW;QAAA;QAG/B,QAAQ,IAAI,CAAC;QAEb,OAAO,WAAW,GAAG;QAErB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC;QAExB,IAAI,CAAC,YAAY,GAAG;IACtB;IAEA,IAAW,MAAgB;QACzB,OAAO,IAAI,CAAC,IAAI;IAClB;IAEO,aAA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AW,QAAQ;QACnD,IAAI,CAAC,YAAY,GAAG;QAEpB,IAAI,CAAC,YAAY,CAAC,OAAO,CACvB,IAAI,gBAAgB,CAAC,MAAM,YAAY,IAAI,CAAC,WAAW;QAGzD,MAAM,aAAa,AAAC,KAAiB,UAAU;QAE/C,IAAI,YAAY;YACd,MAAM,SAAS,IAAI,CAAC,IAAI,CAAC,gBAAgB,CACvC,YACA,IAAI,CAAC,UAAU,EACf;gBAAC,YAAY,IAAI,CAAC,WAAW;YAAA;YAG/B,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC;QAC5B;IACF;AAqQF;AAKO,SAAS,0CACZ,GAAa,EACb,IAAU,EACV,UAAmB,EACnB,MAA0B;IAE5B,IAAI,CAAA,GAAA,gBAAQ,KACV,OAAO,IAAI,0CAAiB,KAAK,MAAM,YAAY;IAErD,OAAO,IAAI,gBAAgB,CAAC,MAAM,YAAY;AAChD","sources":["packages/@react-aria/utils/src/shadowdom/ShadowTreeWalker.ts"],"sourcesContent":["// https://github.com/microsoft/tabster/blob/a89fc5d7e332d48f68d03b1ca6e344489d1c3898/src/Shadowdomize/ShadowTreeWalker.ts\n\nimport {nodeContains} from './DOMFunctions';\nimport {shadowDOM} from '@react-stately/flags';\n\nexport class ShadowTreeWalker implements TreeWalker {\n public readonly filter: NodeFilter | null;\n public readonly root: Node;\n public readonly whatToShow: number;\n\n private _doc: Document;\n private _walkerStack: Array<TreeWalker> = [];\n private _currentNode: Node;\n private _currentSetFor: Set<TreeWalker> = new Set();\n\n constructor(\n doc: Document,\n root: Node,\n whatToShow?: number,\n filter?: NodeFilter | null\n ) {\n this._doc = doc;\n this.root = root;\n this.filter = filter ?? null;\n this.whatToShow = whatToShow ?? NodeFilter.SHOW_ALL;\n this._currentNode = root;\n\n this._walkerStack.unshift(\n doc.createTreeWalker(root, whatToShow, this._acceptNode)\n );\n\n const shadowRoot = (root as Element).shadowRoot;\n\n if (shadowRoot) {\n const walker = this._doc.createTreeWalker(\n shadowRoot,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n this._walkerStack.unshift(walker);\n }\n }\n\n private _acceptNode = (node: Node): number => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n const shadowRoot = (node as Element).shadowRoot;\n\n if (shadowRoot) {\n const walker = this._doc.createTreeWalker(\n shadowRoot,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n this._walkerStack.unshift(walker);\n\n return NodeFilter.FILTER_ACCEPT;\n } else {\n if (typeof this.filter === 'function') {\n return this.filter(node);\n } else if (this.filter?.acceptNode) {\n return this.filter.acceptNode(node);\n } else if (this.filter === null) {\n return NodeFilter.FILTER_ACCEPT;\n }\n }\n }\n\n return NodeFilter.FILTER_SKIP;\n };\n\n public get currentNode(): Node {\n return this._currentNode;\n }\n\n public set currentNode(node: Node) {\n if (!nodeContains(this.root, node)) {\n throw new Error(\n 'Cannot set currentNode to a node that is not contained by the root node.'\n );\n }\n\n const walkers: TreeWalker[] = [];\n let curNode: Node | null | undefined = node;\n let currentWalkerCurrentNode = node;\n\n this._currentNode = node;\n\n while (curNode && curNode !== this.root) {\n if (curNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n const shadowRoot = curNode as ShadowRoot;\n\n const walker = this._doc.createTreeWalker(\n shadowRoot,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n walkers.push(walker);\n\n walker.currentNode = currentWalkerCurrentNode;\n\n this._currentSetFor.add(walker);\n\n curNode = currentWalkerCurrentNode = shadowRoot.host;\n } else {\n curNode = curNode.parentNode;\n }\n }\n\n const walker = this._doc.createTreeWalker(\n this.root,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n walkers.push(walker);\n\n walker.currentNode = currentWalkerCurrentNode;\n\n this._currentSetFor.add(walker);\n\n this._walkerStack = walkers;\n }\n\n public get doc(): Document {\n return this._doc;\n }\n\n public firstChild(): Node | null {\n let currentNode = this.currentNode;\n let newNode = this.nextNode();\n if (!nodeContains(currentNode, newNode)) {\n this.currentNode = currentNode;\n return null;\n }\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n public lastChild(): Node | null {\n let walker = this._walkerStack[0];\n let newNode = walker.lastChild();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n public nextNode(): Node | null {\n const nextNode = this._walkerStack[0].nextNode();\n\n if (nextNode) {\n const shadowRoot = (nextNode as Element).shadowRoot;\n\n if (shadowRoot) {\n let nodeResult: number | undefined;\n\n if (typeof this.filter === 'function') {\n nodeResult = this.filter(nextNode);\n } else if (this.filter?.acceptNode) {\n nodeResult = this.filter.acceptNode(nextNode);\n }\n\n if (nodeResult === NodeFilter.FILTER_ACCEPT) {\n this.currentNode = nextNode;\n return nextNode;\n }\n\n // _acceptNode should have added new walker for this shadow,\n // go in recursively.\n let newNode = this.nextNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n if (nextNode) {\n this.currentNode = nextNode;\n }\n return nextNode;\n } else {\n if (this._walkerStack.length > 1) {\n this._walkerStack.shift();\n\n let newNode = this.nextNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n } else {\n return null;\n }\n }\n }\n\n public previousNode(): Node | null {\n const currentWalker = this._walkerStack[0];\n\n if (currentWalker.currentNode === currentWalker.root) {\n if (this._currentSetFor.has(currentWalker)) {\n this._currentSetFor.delete(currentWalker);\n\n if (this._walkerStack.length > 1) {\n this._walkerStack.shift();\n let newNode = this.previousNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n } else {\n return null;\n }\n }\n\n return null;\n }\n\n const previousNode = currentWalker.previousNode();\n\n if (previousNode) {\n const shadowRoot = (previousNode as Element).shadowRoot;\n\n if (shadowRoot) {\n let nodeResult: number | undefined;\n\n if (typeof this.filter === 'function') {\n nodeResult = this.filter(previousNode);\n } else if (this.filter?.acceptNode) {\n nodeResult = this.filter.acceptNode(previousNode);\n }\n\n if (nodeResult === NodeFilter.FILTER_ACCEPT) {\n if (previousNode) {\n this.currentNode = previousNode;\n }\n return previousNode;\n }\n\n // _acceptNode should have added new walker for this shadow,\n // go in recursively.\n let newNode = this.lastChild();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n if (previousNode) {\n this.currentNode = previousNode;\n }\n return previousNode;\n } else {\n if (this._walkerStack.length > 1) {\n this._walkerStack.shift();\n\n let newNode = this.previousNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n } else {\n return null;\n }\n }\n }\n\n /**\n * @deprecated\n */\n public nextSibling(): Node | null {\n // if (__DEV__) {\n // throw new Error(\"Method not implemented.\");\n // }\n\n return null;\n }\n\n /**\n * @deprecated\n */\n public previousSibling(): Node | null {\n // if (__DEV__) {\n // throw new Error(\"Method not implemented.\");\n // }\n\n return null;\n }\n\n /**\n * @deprecated\n */\n public parentNode(): Node | null {\n // if (__DEV__) {\n // throw new Error(\"Method not implemented.\");\n // }\n\n return null;\n }\n}\n\n/**\n * ShadowDOM safe version of document.createTreeWalker.\n */\nexport function createShadowTreeWalker(\n doc: Document,\n root: Node,\n whatToShow?: number,\n filter?: NodeFilter | null\n): TreeWalker {\n if (shadowDOM()) {\n return new ShadowTreeWalker(doc, root, whatToShow, filter);\n }\n return doc.createTreeWalker(root, whatToShow, filter);\n}\n"],"names":[],"version":3,"file":"ShadowTreeWalker.module.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAMM,SAAS,0CAAkB,GAAkC,EAAE,UAAmB,IAAI;IAC3F,IAAI,CAAC,YAAY,YAAY,GAAG,CAAA,GAAA,qBAAO,EAAE;IACzC,IAAI,mBAAmB,cAAc;IAErC,4CAA4C;IAC5C,kIAAkI;IAClI,4IAA4I;IAC5I,EAAE;IACF,mJAAmJ;IACnJ,+FAA+F;IAC/F,CAAA,GAAA,yCAAc,EAAE;QACd,IAAI,oBAAoB,IAAI,OAAO,IAAI,mBAAmB,IAAI,OAAO,E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;KAAM;AAC3B","sources":["packages/@react-aria/utils/src/animation.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 {flushSync} from 'react-dom';\nimport {RefObject, useCallback, useState} from 'react';\nimport {useLayoutEffect} from './useLayoutEffect';\n\nexport function useEnterAnimation(ref: RefObject<HTMLElement | null>, isReady: boolean = true) {\n let [isEntering, setEntering] = useState(true);\n let isAnimationReady = isEntering && isReady;\n
|
|
1
|
+
{"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAMM,SAAS,0CAAkB,GAAkC,EAAE,UAAmB,IAAI;IAC3F,IAAI,CAAC,YAAY,YAAY,GAAG,CAAA,GAAA,qBAAO,EAAE;IACzC,IAAI,mBAAmB,cAAc;IAErC,4CAA4C;IAC5C,kIAAkI;IAClI,4IAA4I;IAC5I,EAAE;IACF,mJAAmJ;IACnJ,+FAA+F;IAC/F,CAAA,GAAA,yCAAc,EAAE;QACd,IAAI,oBAAoB,IAAI,OAAO,IAAI,mBAAmB,IAAI,OAAO,EAAE;YACrE,KAAK,IAAI,aAAa,IAAI,OAAO,CAAC,aAAa,GAC7C,IAAI,qBAAqB,eACvB,UAAU,MAAM;QAGtB;IACF,GAAG;QAAC;QAAK;KAAiB;IAE1B,mCAAa,KAAK,kBAAkB,CAAA,GAAA,wBAAU,EAAE,IAAM,YAAY,QAAQ,EAAE;IAC5E,OAAO;AACT;AAEO,SAAS,0CAAiB,GAAkC,EAAE,MAAe;IAClF,IAAI,CAAC,WAAW,aAAa,GAAG,CAAA,GAAA,qBAAO,EAAiC,SAAS,SAAS;IAE1F,OAAQ;QACN,KAAK;YACH,qDAAqD;YACrD,IAAI,CAAC,QACH,aAAa;YAEf;QACF,KAAK;QACL,KAAK;YACH,4EAA4E;YAC5E,2BAA2B;YAC3B,IAAI,QACF,aAAa;YAEf;IACJ;IAEA,IAAI,YAAY,cAAc;IAC9B,mCACE,KACA,WACA,CAAA,GAAA,wBAAU,EAAE;QACV,yEAAyE;QACzE,aAAa,CAAA,QAAS,UAAU,YAAY,WAAW;IACzD,GAAG,EAAE;IAGP,OAAO;AACT;AAEA,SAAS,mCAAa,GAAkC,EAAE,QAAiB,EAAE,KAAiB;IAC5F,CAAA,GAAA,yCAAc,EAAE;QACd,IAAI,YAAY,IAAI,OAAO,EAAE;YAC3B,IAAI,CAAE,CAAA,mBAAmB,IAAI,OAAO,AAAD,GAAI;gBACrC,QAAQ;gBACR;gBACA;YACF;YAEA,IAAI,aAAa,IAAI,OAAO,CAAC,aAAa;YAC1C,IAAI,WAAW,MAAM,KAAK,GAAG;gBAC3B;gBACA;YACF;YAEA,IAAI,WAAW;YACf,QAAQ,GAAG,CAAC,WAAW,GAAG,CAAC,CAAA,IAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;gBAChD,IAAI,CAAC,UACH,CAAA,GAAA,yBAAQ,EAAE;oBACR;gBACF;YAEJ,GAAG,KAAK,CAAC,KAAO;YAEhB,OAAO;gBACL,WAAW;YACb;QACF;IACF,GAAG;QAAC;QAAK;QAAU;KAAM;AAC3B","sources":["packages/@react-aria/utils/src/animation.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 {flushSync} from 'react-dom';\nimport {RefObject, useCallback, useState} from 'react';\nimport {useLayoutEffect} from './useLayoutEffect';\n\nexport function useEnterAnimation(ref: RefObject<HTMLElement | null>, isReady: boolean = true): boolean {\n let [isEntering, setEntering] = useState(true);\n let isAnimationReady = isEntering && isReady;\n\n // There are two cases for entry animations:\n // 1. CSS @keyframes. The `animation` property is set during the isEntering state, and it is removed after the animation finishes.\n // 2. CSS transitions. The initial styles are applied during the isEntering state, and removed immediately, causing the transition to occur.\n //\n // In the second case, cancel any transitions that were triggered prior to the isEntering = false state (when the transition is supposed to start).\n // This can happen when isReady starts as false (e.g. popovers prior to placement calculation).\n useLayoutEffect(() => {\n if (isAnimationReady && ref.current && 'getAnimations' in ref.current) {\n for (let animation of ref.current.getAnimations()) {\n if (animation instanceof CSSTransition) {\n animation.cancel();\n }\n }\n }\n }, [ref, isAnimationReady]);\n\n useAnimation(ref, isAnimationReady, useCallback(() => setEntering(false), []));\n return isAnimationReady;\n}\n\nexport function useExitAnimation(ref: RefObject<HTMLElement | null>, isOpen: boolean): boolean {\n let [exitState, setExitState] = useState<'closed' | 'open' | 'exiting'>(isOpen ? 'open' : 'closed');\n\n switch (exitState) {\n case 'open':\n // If isOpen becomes false, set the state to exiting.\n if (!isOpen) {\n setExitState('exiting');\n }\n break;\n case 'closed':\n case 'exiting':\n // If we are exiting and isOpen becomes true, the animation was interrupted.\n // Reset the state to open.\n if (isOpen) {\n setExitState('open');\n }\n break;\n }\n\n let isExiting = exitState === 'exiting';\n useAnimation(\n ref,\n isExiting,\n useCallback(() => {\n // Set the state to closed, which will cause the element to be unmounted.\n setExitState(state => state === 'exiting' ? 'closed' : state);\n }, [])\n );\n\n return isExiting;\n}\n\nfunction useAnimation(ref: RefObject<HTMLElement | null>, isActive: boolean, onEnd: () => void): void {\n useLayoutEffect(() => {\n if (isActive && ref.current) {\n if (!('getAnimations' in ref.current)) {\n // JSDOM\n onEnd();\n return;\n }\n\n let animations = ref.current.getAnimations();\n if (animations.length === 0) {\n onEnd();\n return;\n }\n\n let canceled = false;\n Promise.all(animations.map(a => a.finished)).then(() => {\n if (!canceled) {\n flushSync(() => {\n onEnd();\n });\n }\n }).catch(() => {});\n\n return () => {\n canceled = true;\n };\n }\n }, [ref, isActive, onEnd]);\n}\n"],"names":[],"version":3,"file":"animation.main.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAMM,SAAS,0CAAkB,GAAkC,EAAE,UAAmB,IAAI;IAC3F,IAAI,CAAC,YAAY,YAAY,GAAG,CAAA,GAAA,eAAO,EAAE;IACzC,IAAI,mBAAmB,cAAc;IAErC,4CAA4C;IAC5C,kIAAkI;IAClI,4IAA4I;IAC5I,EAAE;IACF,mJAAmJ;IACnJ,+FAA+F;IAC/F,CAAA,GAAA,yCAAc,EAAE;QACd,IAAI,oBAAoB,IAAI,OAAO,IAAI,mBAAmB,IAAI,OAAO,EAAE;YACrE,KAAK,IAAI,aAAa,IAAI,OAAO,CAAC,aAAa,GAC7C,IAAI,qBAAqB,eACvB,UAAU,MAAM;QAGtB;IACF,GAAG;QAAC;QAAK;KAAiB;IAE1B,mCAAa,KAAK,kBAAkB,CAAA,GAAA,kBAAU,EAAE,IAAM,YAAY,QAAQ,EAAE;IAC5E,OAAO;AACT;AAEO,SAAS,0CAAiB,GAAkC,EAAE,MAAe;IAClF,IAAI,CAAC,WAAW,aAAa,GAAG,CAAA,GAAA,eAAO,EAAiC,SAAS,SAAS;IAE1F,OAAQ;QACN,KAAK;YACH,qDAAqD;YACrD,IAAI,CAAC,QACH,aAAa;YAEf;QACF,KAAK;QACL,KAAK;YACH,4EAA4E;YAC5E,2BAA2B;YAC3B,IAAI,QACF,aAAa;YAEf;IACJ;IAEA,IAAI,YAAY,cAAc;IAC9B,mCACE,KACA,WACA,CAAA,GAAA,kBAAU,EAAE;QACV,yEAAyE;QACzE,aAAa,CAAA,QAAS,UAAU,YAAY,WAAW;IACzD,GAAG,EAAE;IAGP,OAAO;AACT;AAEA,SAAS,mCAAa,GAAkC,EAAE,QAAiB,EAAE,KAAiB;IAC5F,CAAA,GAAA,yCAAc,EAAE;QACd,IAAI,YAAY,IAAI,OAAO,EAAE;YAC3B,IAAI,CAAE,CAAA,mBAAmB,IAAI,OAAO,AAAD,GAAI;gBACrC,QAAQ;gBACR;gBACA;YACF;YAEA,IAAI,aAAa,IAAI,OAAO,CAAC,aAAa;YAC1C,IAAI,WAAW,MAAM,KAAK,GAAG;gBAC3B;gBACA;YACF;YAEA,IAAI,WAAW;YACf,QAAQ,GAAG,CAAC,WAAW,GAAG,CAAC,CAAA,IAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;gBAChD,IAAI,CAAC,UACH,CAAA,GAAA,gBAAQ,EAAE;oBACR;gBACF;YAEJ,GAAG,KAAK,CAAC,KAAO;YAEhB,OAAO;gBACL,WAAW;YACb;QACF;IACF,GAAG;QAAC;QAAK;QAAU;KAAM;AAC3B","sources":["packages/@react-aria/utils/src/animation.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 {flushSync} from 'react-dom';\nimport {RefObject, useCallback, useState} from 'react';\nimport {useLayoutEffect} from './useLayoutEffect';\n\nexport function useEnterAnimation(ref: RefObject<HTMLElement | null>, isReady: boolean = true) {\n let [isEntering, setEntering] = useState(true);\n let isAnimationReady = isEntering && isReady;\n
|
|
1
|
+
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAMM,SAAS,0CAAkB,GAAkC,EAAE,UAAmB,IAAI;IAC3F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YAEA,IAAI,WAAW;YACf,QAAQ,GAAG,CAAC,WAAW,GAAG,CAAC,CAAA,IAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;gBAChD,IAAI,CAAC,UACH,CAAA,GAAA,gBAAQ,EAAE;oBACR;gBACF;YAEJ,GAAG,KAAK,CAAC,KAAO;YAEhB,OAAO;gBACL,WAAW;YACb;QACF;IACF,GAAG;QAAC;QAAK;QAAU;KAAM;AAC3B","sources":["packages/@react-aria/utils/src/animation.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 {flushSync} from 'react-dom';\nimport {RefObject, useCallback, useState} from 'react';\nimport {useLayoutEffect} from './useLayoutEffect';\n\nexport function useEnterAnimation(ref: RefObject<HTMLElement | null>, isReady: boolean = true): boolean {\n let [isEntering, setEntering] = useState(true);\n let isAnimationReady = isEntering && isReady;\n\n // There are two cases for entry animations:\n // 1. CSS @keyframes. The `animation` property is set during the isEntering state, and it is removed after the animation finishes.\n // 2. CSS transitions. The initial styles are applied during the isEntering state, and removed immediately, causing the transition to occur.\n //\n // In the second case, cancel any transitions that were triggered prior to the isEntering = false state (when the transition is supposed to start).\n // This can happen when isReady starts as false (e.g. popovers prior to placement calculation).\n useLayoutEffect(() => {\n if (isAnimationReady && ref.current && 'getAnimations' in ref.current) {\n for (let animation of ref.current.getAnimations()) {\n if (animation instanceof CSSTransition) {\n animation.cancel();\n }\n }\n }\n }, [ref, isAnimationReady]);\n\n useAnimation(ref, isAnimationReady, useCallback(() => setEntering(false), []));\n return isAnimationReady;\n}\n\nexport function useExitAnimation(ref: RefObject<HTMLElement | null>, isOpen: boolean): boolean {\n let [exitState, setExitState] = useState<'closed' | 'open' | 'exiting'>(isOpen ? 'open' : 'closed');\n\n switch (exitState) {\n case 'open':\n // If isOpen becomes false, set the state to exiting.\n if (!isOpen) {\n setExitState('exiting');\n }\n break;\n case 'closed':\n case 'exiting':\n // If we are exiting and isOpen becomes true, the animation was interrupted.\n // Reset the state to open.\n if (isOpen) {\n setExitState('open');\n }\n break;\n }\n\n let isExiting = exitState === 'exiting';\n useAnimation(\n ref,\n isExiting,\n useCallback(() => {\n // Set the state to closed, which will cause the element to be unmounted.\n setExitState(state => state === 'exiting' ? 'closed' : state);\n }, [])\n );\n\n return isExiting;\n}\n\nfunction useAnimation(ref: RefObject<HTMLElement | null>, isActive: boolean, onEnd: () => void): void {\n useLayoutEffect(() => {\n if (isActive && ref.current) {\n if (!('getAnimations' in ref.current)) {\n // JSDOM\n onEnd();\n return;\n }\n\n let animations = ref.current.getAnimations();\n if (animations.length === 0) {\n onEnd();\n return;\n }\n\n let canceled = false;\n Promise.all(animations.map(a => a.finished)).then(() => {\n if (!canceled) {\n flushSync(() => {\n onEnd();\n });\n }\n }).catch(() => {});\n\n return () => {\n canceled = true;\n };\n }\n }, [ref, isActive, onEnd]);\n}\n"],"names":[],"version":3,"file":"animation.module.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAoBM,SAAS,0CAAsB,OAAyB;IAC7D,IAAI,+CACF,QAAQ,KAAK,CAAC;QAAC,eAAe;IAAI;SAC7B;QACL,IAAI,qBAAqB,4CAAsB;QAC/C,QAAQ,KAAK;QACb,4CAAsB;IACxB;AACF;AAEA,IAAI,oDAA8C;AAClD,SAAS;IACP,IAAI,qDAA+B,MAAM;QACvC,oDAA8B;QAC9B,IAAI;YACF,IAAI,YAAY,SAAS,aAAa,CAAC;YACvC,UAAU,KAAK,CAAC;gBACd,IAAI,iBAAgB;oBAClB,oDAA8B;oBAC9B,OAAO;gBACT;YACF;QACF,EAAE,OAAM;QACN,SAAS;QACX;IACF;IAEA,OAAO;AACT;AAEA,SAAS,4CAAsB,OAAyB;IACtD,IAAI,SAAS,QAAQ,UAAU;IAC/B,IAAI,qBAA0C,EAAE;IAChD,IAAI,uBAAuB,SAAS,gBAAgB,IAAI,SAAS,eAAe;IAEhF,MAAO,kBAAkB,eAAe,WAAW,qBAAsB;QACvE,IACE,OAAO,YAAY,GAAG,OAAO,YAAY,IACzC,OAAO,WAAW,GAAG,OAAO,WAAW,EAEvC,mBAAmB,IAAI,CAAC;YACtB,SAAS;YACT,WAAW,OAAO,SAAS;YAC3B,YAAY,OAAO,UAAU;QAC/B;QAEF,SAAS,OAAO,UAAU;IAC5B;IAEA,IAAI,gCAAgC,aAClC,mBAAmB,IAAI,CAAC;QACtB,SAAS;QACT,WAAW,qBAAqB,SAAS;QACzC,YAAY,qBAAqB,UAAU;IAC7C;IAGF,OAAO;AACT;AAEA,SAAS,4CAAsB,kBAAuC;IACpE,KAAK,IAAI,WAAC,OAAO,aAAE,SAAS,cAAE,UAAU,EAAC,IAAI,mBAAoB;QAC/D,QAAQ,SAAS,GAAG;QACpB,QAAQ,UAAU,GAAG;IACvB;AACF","sources":["packages/@react-aria/utils/src/focusWithoutScrolling.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 {FocusableElement} from '@react-types/shared';\n\n// This is a polyfill for element.focus({preventScroll: true});\n// Currently necessary for Safari and old Edge:\n// https://caniuse.com/#feat=mdn-api_htmlelement_focus_preventscroll_option\n// See https://bugs.webkit.org/show_bug.cgi?id=178583\n//\n\n// Original licensing for the following methods can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/calvellido/focus-options-polyfill\n\ninterface ScrollableElement {\n element: HTMLElement,\n scrollTop: number,\n scrollLeft: number\n}\n\nexport function focusWithoutScrolling(element: FocusableElement) {\n if (supportsPreventScroll()) {\n element.focus({preventScroll: true});\n } else {\n let scrollableElements = getScrollableElements(element);\n element.focus();\n restoreScrollPosition(scrollableElements);\n }\n}\n\nlet supportsPreventScrollCached: boolean | null = null;\nfunction supportsPreventScroll() {\n if (supportsPreventScrollCached == null) {\n supportsPreventScrollCached = false;\n try {\n let focusElem = document.createElement('div');\n focusElem.focus({\n get preventScroll() {\n supportsPreventScrollCached = true;\n return true;\n }\n });\n } catch {\n // Ignore\n }\n }\n\n return supportsPreventScrollCached;\n}\n\nfunction getScrollableElements(element: FocusableElement): ScrollableElement[] {\n let parent = element.parentNode;\n let scrollableElements: ScrollableElement[] = [];\n let rootScrollingElement = document.scrollingElement || document.documentElement;\n\n while (parent instanceof HTMLElement && parent !== rootScrollingElement) {\n if (\n parent.offsetHeight < parent.scrollHeight ||\n parent.offsetWidth < parent.scrollWidth\n ) {\n scrollableElements.push({\n element: parent,\n scrollTop: parent.scrollTop,\n scrollLeft: parent.scrollLeft\n });\n }\n parent = parent.parentNode;\n }\n\n if (rootScrollingElement instanceof HTMLElement) {\n scrollableElements.push({\n element: rootScrollingElement,\n scrollTop: rootScrollingElement.scrollTop,\n scrollLeft: rootScrollingElement.scrollLeft\n });\n }\n\n return scrollableElements;\n}\n\nfunction restoreScrollPosition(scrollableElements: ScrollableElement[]) {\n for (let {element, scrollTop, scrollLeft} of scrollableElements) {\n element.scrollTop = scrollTop;\n element.scrollLeft = scrollLeft;\n }\n}\n"],"names":[],"version":3,"file":"focusWithoutScrolling.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAoBM,SAAS,0CAAsB,OAAyB;IAC7D,IAAI,+CACF,QAAQ,KAAK,CAAC;QAAC,eAAe;IAAI;SAC7B;QACL,IAAI,qBAAqB,4CAAsB;QAC/C,QAAQ,KAAK;QACb,4CAAsB;IACxB;AACF;AAEA,IAAI,oDAA8C;AAClD,SAAS;IACP,IAAI,qDAA+B,MAAM;QACvC,oDAA8B;QAC9B,IAAI;YACF,IAAI,YAAY,SAAS,aAAa,CAAC;YACvC,UAAU,KAAK,CAAC;gBACd,IAAI,iBAAgB;oBAClB,oDAA8B;oBAC9B,OAAO;gBACT;YACF;QACF,EAAE,OAAM;QACN,SAAS;QACX;IACF;IAEA,OAAO;AACT;AAEA,SAAS,4CAAsB,OAAyB;IACtD,IAAI,SAAS,QAAQ,UAAU;IAC/B,IAAI,qBAA0C,EAAE;IAChD,IAAI,uBAAuB,SAAS,gBAAgB,IAAI,SAAS,eAAe;IAEhF,MAAO,kBAAkB,eAAe,WAAW,qBAAsB;QACvE,IACE,OAAO,YAAY,GAAG,OAAO,YAAY,IACzC,OAAO,WAAW,GAAG,OAAO,WAAW,EAEvC,mBAAmB,IAAI,CAAC;YACtB,SAAS;YACT,WAAW,OAAO,SAAS;YAC3B,YAAY,OAAO,UAAU;QAC/B;QAEF,SAAS,OAAO,UAAU;IAC5B;IAEA,IAAI,gCAAgC,aAClC,mBAAmB,IAAI,CAAC;QACtB,SAAS;QACT,WAAW,qBAAqB,SAAS;QACzC,YAAY,qBAAqB,UAAU;IAC7C;IAGF,OAAO;AACT;AAEA,SAAS,4CAAsB,kBAAuC;IACpE,KAAK,IAAI,WAAC,OAAO,aAAE,SAAS,cAAE,UAAU,EAAC,IAAI,mBAAoB;QAC/D,QAAQ,SAAS,GAAG;QACpB,QAAQ,UAAU,GAAG;IACvB;AACF","sources":["packages/@react-aria/utils/src/focusWithoutScrolling.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 {FocusableElement} from '@react-types/shared';\n\n// This is a polyfill for element.focus({preventScroll: true});\n// Currently necessary for Safari and old Edge:\n// https://caniuse.com/#feat=mdn-api_htmlelement_focus_preventscroll_option\n// See https://bugs.webkit.org/show_bug.cgi?id=178583\n//\n\n// Original licensing for the following methods can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/calvellido/focus-options-polyfill\n\ninterface ScrollableElement {\n element: HTMLElement,\n scrollTop: number,\n scrollLeft: number\n}\n\nexport function focusWithoutScrolling(element: FocusableElement): void {\n if (supportsPreventScroll()) {\n element.focus({preventScroll: true});\n } else {\n let scrollableElements = getScrollableElements(element);\n element.focus();\n restoreScrollPosition(scrollableElements);\n }\n}\n\nlet supportsPreventScrollCached: boolean | null = null;\nfunction supportsPreventScroll() {\n if (supportsPreventScrollCached == null) {\n supportsPreventScrollCached = false;\n try {\n let focusElem = document.createElement('div');\n focusElem.focus({\n get preventScroll() {\n supportsPreventScrollCached = true;\n return true;\n }\n });\n } catch {\n // Ignore\n }\n }\n\n return supportsPreventScrollCached;\n}\n\nfunction getScrollableElements(element: FocusableElement): ScrollableElement[] {\n let parent = element.parentNode;\n let scrollableElements: ScrollableElement[] = [];\n let rootScrollingElement = document.scrollingElement || document.documentElement;\n\n while (parent instanceof HTMLElement && parent !== rootScrollingElement) {\n if (\n parent.offsetHeight < parent.scrollHeight ||\n parent.offsetWidth < parent.scrollWidth\n ) {\n scrollableElements.push({\n element: parent,\n scrollTop: parent.scrollTop,\n scrollLeft: parent.scrollLeft\n });\n }\n parent = parent.parentNode;\n }\n\n if (rootScrollingElement instanceof HTMLElement) {\n scrollableElements.push({\n element: rootScrollingElement,\n scrollTop: rootScrollingElement.scrollTop,\n scrollLeft: rootScrollingElement.scrollLeft\n });\n }\n\n return scrollableElements;\n}\n\nfunction restoreScrollPosition(scrollableElements: ScrollableElement[]) {\n for (let {element, scrollTop, scrollLeft} of scrollableElements) {\n element.scrollTop = scrollTop;\n element.scrollLeft = scrollLeft;\n }\n}\n"],"names":[],"version":3,"file":"focusWithoutScrolling.main.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAAA;;;;;;;;;;CAUC,GAoBM,SAAS,0CAAsB,OAAyB;IAC7D,IAAI,+CACF,QAAQ,KAAK,CAAC;QAAC,eAAe;IAAI;SAC7B;QACL,IAAI,qBAAqB,4CAAsB;QAC/C,QAAQ,KAAK;QACb,4CAAsB;IACxB;AACF;AAEA,IAAI,oDAA8C;AAClD,SAAS;IACP,IAAI,qDAA+B,MAAM;QACvC,oDAA8B;QAC9B,IAAI;YACF,IAAI,YAAY,SAAS,aAAa,CAAC;YACvC,UAAU,KAAK,CAAC;gBACd,IAAI,iBAAgB;oBAClB,oDAA8B;oBAC9B,OAAO;gBACT;YACF;QACF,EAAE,OAAM;QACN,SAAS;QACX;IACF;IAEA,OAAO;AACT;AAEA,SAAS,4CAAsB,OAAyB;IACtD,IAAI,SAAS,QAAQ,UAAU;IAC/B,IAAI,qBAA0C,EAAE;IAChD,IAAI,uBAAuB,SAAS,gBAAgB,IAAI,SAAS,eAAe;IAEhF,MAAO,kBAAkB,eAAe,WAAW,qBAAsB;QACvE,IACE,OAAO,YAAY,GAAG,OAAO,YAAY,IACzC,OAAO,WAAW,GAAG,OAAO,WAAW,EAEvC,mBAAmB,IAAI,CAAC;YACtB,SAAS;YACT,WAAW,OAAO,SAAS;YAC3B,YAAY,OAAO,UAAU;QAC/B;QAEF,SAAS,OAAO,UAAU;IAC5B;IAEA,IAAI,gCAAgC,aAClC,mBAAmB,IAAI,CAAC;QACtB,SAAS;QACT,WAAW,qBAAqB,SAAS;QACzC,YAAY,qBAAqB,UAAU;IAC7C;IAGF,OAAO;AACT;AAEA,SAAS,4CAAsB,kBAAuC;IACpE,KAAK,IAAI,WAAC,OAAO,aAAE,SAAS,cAAE,UAAU,EAAC,IAAI,mBAAoB;QAC/D,QAAQ,SAAS,GAAG;QACpB,QAAQ,UAAU,GAAG;IACvB;AACF","sources":["packages/@react-aria/utils/src/focusWithoutScrolling.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 {FocusableElement} from '@react-types/shared';\n\n// This is a polyfill for element.focus({preventScroll: true});\n// Currently necessary for Safari and old Edge:\n// https://caniuse.com/#feat=mdn-api_htmlelement_focus_preventscroll_option\n// See https://bugs.webkit.org/show_bug.cgi?id=178583\n//\n\n// Original licensing for the following methods can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/calvellido/focus-options-polyfill\n\ninterface ScrollableElement {\n element: HTMLElement,\n scrollTop: number,\n scrollLeft: number\n}\n\nexport function focusWithoutScrolling(element: FocusableElement) {\n if (supportsPreventScroll()) {\n element.focus({preventScroll: true});\n } else {\n let scrollableElements = getScrollableElements(element);\n element.focus();\n restoreScrollPosition(scrollableElements);\n }\n}\n\nlet supportsPreventScrollCached: boolean | null = null;\nfunction supportsPreventScroll() {\n if (supportsPreventScrollCached == null) {\n supportsPreventScrollCached = false;\n try {\n let focusElem = document.createElement('div');\n focusElem.focus({\n get preventScroll() {\n supportsPreventScrollCached = true;\n return true;\n }\n });\n } catch {\n // Ignore\n }\n }\n\n return supportsPreventScrollCached;\n}\n\nfunction getScrollableElements(element: FocusableElement): ScrollableElement[] {\n let parent = element.parentNode;\n let scrollableElements: ScrollableElement[] = [];\n let rootScrollingElement = document.scrollingElement || document.documentElement;\n\n while (parent instanceof HTMLElement && parent !== rootScrollingElement) {\n if (\n parent.offsetHeight < parent.scrollHeight ||\n parent.offsetWidth < parent.scrollWidth\n ) {\n scrollableElements.push({\n element: parent,\n scrollTop: parent.scrollTop,\n scrollLeft: parent.scrollLeft\n });\n }\n parent = parent.parentNode;\n }\n\n if (rootScrollingElement instanceof HTMLElement) {\n scrollableElements.push({\n element: rootScrollingElement,\n scrollTop: rootScrollingElement.scrollTop,\n scrollLeft: rootScrollingElement.scrollLeft\n });\n }\n\n return scrollableElements;\n}\n\nfunction restoreScrollPosition(scrollableElements: ScrollableElement[]) {\n for (let {element, scrollTop, scrollLeft} of scrollableElements) {\n element.scrollTop = scrollTop;\n element.scrollLeft = scrollLeft;\n }\n}\n"],"names":[],"version":3,"file":"focusWithoutScrolling.module.js.map"}
|
|
1
|
+
{"mappings":"AAAA;;;;;;;;;;CAUC,GAoBM,SAAS,0CAAsB,OAAyB;IAC7D,IAAI,+CACF,QAAQ,KAAK,CAAC;QAAC,eAAe;IAAI;SAC7B;QACL,IAAI,qBAAqB,4CAAsB;QAC/C,QAAQ,KAAK;QACb,4CAAsB;IACxB;AACF;AAEA,IAAI,oDAA8C;AAClD,SAAS;IACP,IAAI,qDAA+B,MAAM;QACvC,oDAA8B;QAC9B,IAAI;YACF,IAAI,YAAY,SAAS,aAAa,CAAC;YACvC,UAAU,KAAK,CAAC;gBACd,IAAI,iBAAgB;oBAClB,oDAA8B;oBAC9B,OAAO;gBACT;YACF;QACF,EAAE,OAAM;QACN,SAAS;QACX;IACF;IAEA,OAAO;AACT;AAEA,SAAS,4CAAsB,OAAyB;IACtD,IAAI,SAAS,QAAQ,UAAU;IAC/B,IAAI,qBAA0C,EAAE;IAChD,IAAI,uBAAuB,SAAS,gBAAgB,IAAI,SAAS,eAAe;IAEhF,MAAO,kBAAkB,eAAe,WAAW,qBAAsB;QACvE,IACE,OAAO,YAAY,GAAG,OAAO,YAAY,IACzC,OAAO,WAAW,GAAG,OAAO,WAAW,EAEvC,mBAAmB,IAAI,CAAC;YACtB,SAAS;YACT,WAAW,OAAO,SAAS;YAC3B,YAAY,OAAO,UAAU;QAC/B;QAEF,SAAS,OAAO,UAAU;IAC5B;IAEA,IAAI,gCAAgC,aAClC,mBAAmB,IAAI,CAAC;QACtB,SAAS;QACT,WAAW,qBAAqB,SAAS;QACzC,YAAY,qBAAqB,UAAU;IAC7C;IAGF,OAAO;AACT;AAEA,SAAS,4CAAsB,kBAAuC;IACpE,KAAK,IAAI,WAAC,OAAO,aAAE,SAAS,cAAE,UAAU,EAAC,IAAI,mBAAoB;QAC/D,QAAQ,SAAS,GAAG;QACpB,QAAQ,UAAU,GAAG;IACvB;AACF","sources":["packages/@react-aria/utils/src/focusWithoutScrolling.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 {FocusableElement} from '@react-types/shared';\n\n// This is a polyfill for element.focus({preventScroll: true});\n// Currently necessary for Safari and old Edge:\n// https://caniuse.com/#feat=mdn-api_htmlelement_focus_preventscroll_option\n// See https://bugs.webkit.org/show_bug.cgi?id=178583\n//\n\n// Original licensing for the following methods can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/calvellido/focus-options-polyfill\n\ninterface ScrollableElement {\n element: HTMLElement,\n scrollTop: number,\n scrollLeft: number\n}\n\nexport function focusWithoutScrolling(element: FocusableElement): void {\n if (supportsPreventScroll()) {\n element.focus({preventScroll: true});\n } else {\n let scrollableElements = getScrollableElements(element);\n element.focus();\n restoreScrollPosition(scrollableElements);\n }\n}\n\nlet supportsPreventScrollCached: boolean | null = null;\nfunction supportsPreventScroll() {\n if (supportsPreventScrollCached == null) {\n supportsPreventScrollCached = false;\n try {\n let focusElem = document.createElement('div');\n focusElem.focus({\n get preventScroll() {\n supportsPreventScrollCached = true;\n return true;\n }\n });\n } catch {\n // Ignore\n }\n }\n\n return supportsPreventScrollCached;\n}\n\nfunction getScrollableElements(element: FocusableElement): ScrollableElement[] {\n let parent = element.parentNode;\n let scrollableElements: ScrollableElement[] = [];\n let rootScrollingElement = document.scrollingElement || document.documentElement;\n\n while (parent instanceof HTMLElement && parent !== rootScrollingElement) {\n if (\n parent.offsetHeight < parent.scrollHeight ||\n parent.offsetWidth < parent.scrollWidth\n ) {\n scrollableElements.push({\n element: parent,\n scrollTop: parent.scrollTop,\n scrollLeft: parent.scrollLeft\n });\n }\n parent = parent.parentNode;\n }\n\n if (rootScrollingElement instanceof HTMLElement) {\n scrollableElements.push({\n element: rootScrollingElement,\n scrollTop: rootScrollingElement.scrollTop,\n scrollLeft: rootScrollingElement.scrollLeft\n });\n }\n\n return scrollableElements;\n}\n\nfunction restoreScrollPosition(scrollableElements: ScrollableElement[]) {\n for (let {element, scrollTop, scrollLeft} of scrollableElements) {\n element.scrollTop = scrollTop;\n element.scrollLeft = scrollLeft;\n }\n}\n"],"names":[],"version":3,"file":"focusWithoutScrolling.module.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,
|
|
1
|
+
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAIM,SAAS,0CAAU,OAAoB,EAAE,OAAiB,EAAE,cAA2B,YAAY;IACxG,IAAI,OAAO,QAAQ,qBAAqB;IACxC,IAAI,SACF,OAAO,gBAAgB,eAAe,KAAK,KAAK,GAAG,KAAK,MAAM;IAEhE,OAAO,gBAAgB,eAAe,KAAK,IAAI,GAAG,KAAK,GAAG;AAC5D","sources":["packages/@react-aria/utils/src/getOffset.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 {Orientation} from '@react-types/shared';\n\nexport function getOffset(element: HTMLElement, reverse?: boolean, orientation: Orientation = 'horizontal'): number {\n let rect = element.getBoundingClientRect();\n if (reverse) {\n return orientation === 'horizontal' ? rect.right : rect.bottom;\n }\n return orientation === 'horizontal' ? rect.left : rect.top;\n}\n"],"names":[],"version":3,"file":"getOffset.main.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAAA;;;;;;;;;;CAUC,
|
|
1
|
+
{"mappings":"AAAA;;;;;;;;;;CAUC,GAIM,SAAS,0CAAU,OAAoB,EAAE,OAAiB,EAAE,cAA2B,YAAY;IACxG,IAAI,OAAO,QAAQ,qBAAqB;IACxC,IAAI,SACF,OAAO,gBAAgB,eAAe,KAAK,KAAK,GAAG,KAAK,MAAM;IAEhE,OAAO,gBAAgB,eAAe,KAAK,IAAI,GAAG,KAAK,GAAG;AAC5D","sources":["packages/@react-aria/utils/src/getOffset.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 {Orientation} from '@react-types/shared';\n\nexport function getOffset(element: HTMLElement, reverse?: boolean, orientation: Orientation = 'horizontal'): number {\n let rect = element.getBoundingClientRect();\n if (reverse) {\n return orientation === 'horizontal' ? rect.right : rect.bottom;\n }\n return orientation === 'horizontal' ? rect.left : rect.top;\n}\n"],"names":[],"version":3,"file":"getOffset.module.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAEO,SAAS,0CAAW,KAAe;IACxC,MAAM,SAAS,CAAA,GAAA,oBAAM,EAAE,KAAK,CAAC;IAC7B,MAAM,QAAQ,SAAS,MAAM,CAAC,EAAE,EAAE;IAClC,IAAI,SAAS,IACX,OAAO;IAET,gCAAgC;IAChC,OAAO,QAAQ,SAAS;AAC1B","sources":["packages/@react-aria/utils/src/inertValue.ts"],"sourcesContent":["import {version} from 'react';\n\nexport function inertValue(value?: boolean) {\n const pieces = version.split('.');\n const major = parseInt(pieces[0], 10);\n if (major >= 19) {\n return value;\n }\n // compatibility with React < 19\n return value ? 'true' : undefined;\n}\n"],"names":[],"version":3,"file":"inertValue.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;AAEO,SAAS,0CAAW,KAAe;IACxC,MAAM,SAAS,CAAA,GAAA,oBAAM,EAAE,KAAK,CAAC;IAC7B,MAAM,QAAQ,SAAS,MAAM,CAAC,EAAE,EAAE;IAClC,IAAI,SAAS,IACX,OAAO;IAET,gCAAgC;IAChC,OAAO,QAAQ,SAAS;AAC1B","sources":["packages/@react-aria/utils/src/inertValue.ts"],"sourcesContent":["import {version} from 'react';\n\nexport function inertValue(value?: boolean): string | boolean | undefined {\n const pieces = version.split('.');\n const major = parseInt(pieces[0], 10);\n if (major >= 19) {\n return value;\n }\n // compatibility with React < 19\n return value ? 'true' : undefined;\n}\n"],"names":[],"version":3,"file":"inertValue.main.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;AAEO,SAAS,0CAAW,KAAe;IACxC,MAAM,SAAS,CAAA,GAAA,cAAM,EAAE,KAAK,CAAC;IAC7B,MAAM,QAAQ,SAAS,MAAM,CAAC,EAAE,EAAE;IAClC,IAAI,SAAS,IACX,OAAO;IAET,gCAAgC;IAChC,OAAO,QAAQ,SAAS;AAC1B","sources":["packages/@react-aria/utils/src/inertValue.ts"],"sourcesContent":["import {version} from 'react';\n\nexport function inertValue(value?: boolean) {\n const pieces = version.split('.');\n const major = parseInt(pieces[0], 10);\n if (major >= 19) {\n return value;\n }\n // compatibility with React < 19\n return value ? 'true' : undefined;\n}\n"],"names":[],"version":3,"file":"inertValue.module.js.map"}
|
|
1
|
+
{"mappings":";;;AAEO,SAAS,0CAAW,KAAe;IACxC,MAAM,SAAS,CAAA,GAAA,cAAM,EAAE,KAAK,CAAC;IAC7B,MAAM,QAAQ,SAAS,MAAM,CAAC,EAAE,EAAE;IAClC,IAAI,SAAS,IACX,OAAO;IAET,gCAAgC;IAChC,OAAO,QAAQ,SAAS;AAC1B","sources":["packages/@react-aria/utils/src/inertValue.ts"],"sourcesContent":["import {version} from 'react';\n\nexport function inertValue(value?: boolean): string | boolean | undefined {\n const pieces = version.split('.');\n const major = parseInt(pieces[0], 10);\n if (major >= 19) {\n return value;\n }\n // compatibility with React < 19\n return value ? 'true' : undefined;\n}\n"],"names":[],"version":3,"file":"inertValue.module.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;AAAA,MAAM,0CAAoB;IACxB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAM,mDAA6B,wCAAkB,IAAI,CAAC,qBAAqB;AAE/E,wCAAkB,IAAI,CAAC;AACvB,MAAM,kDAA4B,wCAAkB,IAAI,CAAC;AAElD,SAAS,0CAAY,OAAgB;IAC1C,OAAO,QAAQ,OAAO,CAAC;AACzB;AAEO,SAAS,0CAAW,OAAgB;IACzC,OAAO,QAAQ,OAAO,CAAC;AACzB","sources":["packages/@react-aria/utils/src/isFocusable.ts"],"sourcesContent":["const focusableElements = [\n 'input:not([disabled]):not([type=hidden])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n 'button:not([disabled])',\n 'a[href]',\n 'area[href]',\n 'summary',\n 'iframe',\n 'object',\n 'embed',\n 'audio[controls]',\n 'video[controls]',\n '[contenteditable]:not([contenteditable^=\"false\"])'\n];\n\nconst FOCUSABLE_ELEMENT_SELECTOR = focusableElements.join(':not([hidden]),') + ',[tabindex]:not([disabled]):not([hidden])';\n\nfocusableElements.push('[tabindex]:not([tabindex=\"-1\"]):not([disabled])');\nconst TABBABLE_ELEMENT_SELECTOR = focusableElements.join(':not([hidden]):not([tabindex=\"-1\"]),');\n\nexport function isFocusable(element: Element) {\n return element.matches(FOCUSABLE_ELEMENT_SELECTOR);\n}\n\nexport function isTabbable(element: Element) {\n return element.matches(TABBABLE_ELEMENT_SELECTOR);\n}\n"],"names":[],"version":3,"file":"isFocusable.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;AAAA,MAAM,0CAAoB;IACxB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAM,mDAA6B,wCAAkB,IAAI,CAAC,qBAAqB;AAE/E,wCAAkB,IAAI,CAAC;AACvB,MAAM,kDAA4B,wCAAkB,IAAI,CAAC;AAElD,SAAS,0CAAY,OAAgB;IAC1C,OAAO,QAAQ,OAAO,CAAC;AACzB;AAEO,SAAS,0CAAW,OAAgB;IACzC,OAAO,QAAQ,OAAO,CAAC;AACzB","sources":["packages/@react-aria/utils/src/isFocusable.ts"],"sourcesContent":["const focusableElements = [\n 'input:not([disabled]):not([type=hidden])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n 'button:not([disabled])',\n 'a[href]',\n 'area[href]',\n 'summary',\n 'iframe',\n 'object',\n 'embed',\n 'audio[controls]',\n 'video[controls]',\n '[contenteditable]:not([contenteditable^=\"false\"])'\n];\n\nconst FOCUSABLE_ELEMENT_SELECTOR = focusableElements.join(':not([hidden]),') + ',[tabindex]:not([disabled]):not([hidden])';\n\nfocusableElements.push('[tabindex]:not([tabindex=\"-1\"]):not([disabled])');\nconst TABBABLE_ELEMENT_SELECTOR = focusableElements.join(':not([hidden]):not([tabindex=\"-1\"]),');\n\nexport function isFocusable(element: Element): boolean {\n return element.matches(FOCUSABLE_ELEMENT_SELECTOR);\n}\n\nexport function isTabbable(element: Element): boolean {\n return element.matches(TABBABLE_ELEMENT_SELECTOR);\n}\n"],"names":[],"version":3,"file":"isFocusable.main.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAAA,MAAM,0CAAoB;IACxB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAM,mDAA6B,wCAAkB,IAAI,CAAC,qBAAqB;AAE/E,wCAAkB,IAAI,CAAC;AACvB,MAAM,kDAA4B,wCAAkB,IAAI,CAAC;AAElD,SAAS,0CAAY,OAAgB;IAC1C,OAAO,QAAQ,OAAO,CAAC;AACzB;AAEO,SAAS,0CAAW,OAAgB;IACzC,OAAO,QAAQ,OAAO,CAAC;AACzB","sources":["packages/@react-aria/utils/src/isFocusable.ts"],"sourcesContent":["const focusableElements = [\n 'input:not([disabled]):not([type=hidden])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n 'button:not([disabled])',\n 'a[href]',\n 'area[href]',\n 'summary',\n 'iframe',\n 'object',\n 'embed',\n 'audio[controls]',\n 'video[controls]',\n '[contenteditable]:not([contenteditable^=\"false\"])'\n];\n\nconst FOCUSABLE_ELEMENT_SELECTOR = focusableElements.join(':not([hidden]),') + ',[tabindex]:not([disabled]):not([hidden])';\n\nfocusableElements.push('[tabindex]:not([tabindex=\"-1\"]):not([disabled])');\nconst TABBABLE_ELEMENT_SELECTOR = focusableElements.join(':not([hidden]):not([tabindex=\"-1\"]),');\n\nexport function isFocusable(element: Element) {\n return element.matches(FOCUSABLE_ELEMENT_SELECTOR);\n}\n\nexport function isTabbable(element: Element) {\n return element.matches(TABBABLE_ELEMENT_SELECTOR);\n}\n"],"names":[],"version":3,"file":"isFocusable.module.js.map"}
|
|
1
|
+
{"mappings":"AAAA,MAAM,0CAAoB;IACxB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAM,mDAA6B,wCAAkB,IAAI,CAAC,qBAAqB;AAE/E,wCAAkB,IAAI,CAAC;AACvB,MAAM,kDAA4B,wCAAkB,IAAI,CAAC;AAElD,SAAS,0CAAY,OAAgB;IAC1C,OAAO,QAAQ,OAAO,CAAC;AACzB;AAEO,SAAS,0CAAW,OAAgB;IACzC,OAAO,QAAQ,OAAO,CAAC;AACzB","sources":["packages/@react-aria/utils/src/isFocusable.ts"],"sourcesContent":["const focusableElements = [\n 'input:not([disabled]):not([type=hidden])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n 'button:not([disabled])',\n 'a[href]',\n 'area[href]',\n 'summary',\n 'iframe',\n 'object',\n 'embed',\n 'audio[controls]',\n 'video[controls]',\n '[contenteditable]:not([contenteditable^=\"false\"])'\n];\n\nconst FOCUSABLE_ELEMENT_SELECTOR = focusableElements.join(':not([hidden]),') + ',[tabindex]:not([disabled]):not([hidden])';\n\nfocusableElements.push('[tabindex]:not([tabindex=\"-1\"]):not([disabled])');\nconst TABBABLE_ELEMENT_SELECTOR = focusableElements.join(':not([hidden]):not([tabindex=\"-1\"]),');\n\nexport function isFocusable(element: Element): boolean {\n return element.matches(FOCUSABLE_ELEMENT_SELECTOR);\n}\n\nexport function isTabbable(element: Element): boolean {\n return element.matches(TABBABLE_ELEMENT_SELECTOR);\n}\n"],"names":[],"version":3,"file":"isFocusable.module.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;AAeM,SAAS,0CAAe,KAAgC;IAC7D,0BAA0B;IAC1B,IAAI,AAAC,MAAc,cAAc,KAAK,KAAK,MAAM,SAAS,EACxD,OAAO;IAGT,oIAAoI;IACpI,oIAAoI;IACpI,qCAAqC;IACrC,IAAI,CAAA,GAAA,mCAAQ,OAAO,AAAC,MAAuB,WAAW,EACpD,OAAO,MAAM,IAAI,KAAK,WAAW,MAAM,OAAO,KAAK;IAGrD,OAAO,MAAM,MAAM,KAAK,KAAK,CAAC,AAAC,MAAuB,WAAW;AACnE;AAEO,SAAS,0CAAsB,KAAmB;IACvD,yEAAyE;IACzE,uFAAuF;IACvF,kGAAkG;IAClG,mHAAmH;IACnH,oHAAoH;IACpH,8DAA8D;IAC9D,OACE,AAAC,CAAC,CAAA,GAAA,mCAAQ,OAAO,MAAM,KAAK,KAAK,KAAK,MAAM,MAAM,KAAK,KACtD,MAAM,KAAK,KAAK,KACf,MAAM,MAAM,KAAK,KACjB,MAAM,QAAQ,KAAK,KACnB,MAAM,MAAM,KAAK,KACjB,MAAM,WAAW,KAAK;AAG5B","sources":["packages/@react-aria/utils/src/isVirtualEvent.ts"],"sourcesContent":["/*\n * Copyright 2022 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 {isAndroid} from './platform';\n\n// Original licensing for the following method can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/facebook/react/blob/3c713d513195a53788b3f8bb4b70279d68b15bcc/packages/react-interactions/events/src/dom/shared/index.js#L74-L87\n\n// Keyboards, Assistive Technologies, and element.click() all produce a \"virtual\"\n// click event. This is a method of inferring such clicks. Every browser except\n// IE 11 only sets a zero value of \"detail\" for click events that are \"virtual\".\n// However, IE 11 uses a zero value for all click events. For IE 11 we rely on\n// the quirk that it produces click events that are of type PointerEvent, and\n// where only the \"virtual\" click lacks a pointerType field.\n\nexport function isVirtualClick(event: MouseEvent | PointerEvent): boolean {\n // JAWS/NVDA with Firefox.\n if ((event as any).mozInputSource === 0 && event.isTrusted) {\n return true;\n }\n\n // Android TalkBack's detail value varies depending on the event listener providing the event so we have specific logic here instead\n // If pointerType is defined, event is from a click listener. For events from mousedown listener, detail === 0 is a sufficient check\n // to detect TalkBack virtual clicks.\n if (isAndroid() && (event as PointerEvent).pointerType) {\n return event.type === 'click' && event.buttons === 1;\n }\n\n return event.detail === 0 && !(event as PointerEvent).pointerType;\n}\n\nexport function isVirtualPointerEvent(event: PointerEvent) {\n // If the pointer size is zero, then we assume it's from a screen reader.\n // Android TalkBack double tap will sometimes return a event with width and height of 1\n // and pointerType === 'mouse' so we need to check for a specific combination of event attributes.\n // Cannot use \"event.pressure === 0\" as the sole check due to Safari pointer events always returning pressure === 0\n // instead of .5, see https://bugs.webkit.org/show_bug.cgi?id=206216. event.pointerType === 'mouse' is to distingush\n // Talkback double tap from Windows Firefox touch screen press\n return (\n (!isAndroid() && event.width === 0 && event.height === 0) ||\n (event.width === 1 &&\n event.height === 1 &&\n event.pressure === 0 &&\n event.detail === 0 &&\n event.pointerType === 'mouse'\n )\n );\n}\n"],"names":[],"version":3,"file":"isVirtualEvent.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;AAeM,SAAS,0CAAe,KAAgC;IAC7D,0BAA0B;IAC1B,IAAI,AAAC,MAAc,cAAc,KAAK,KAAK,MAAM,SAAS,EACxD,OAAO;IAGT,oIAAoI;IACpI,oIAAoI;IACpI,qCAAqC;IACrC,IAAI,CAAA,GAAA,mCAAQ,OAAO,AAAC,MAAuB,WAAW,EACpD,OAAO,MAAM,IAAI,KAAK,WAAW,MAAM,OAAO,KAAK;IAGrD,OAAO,MAAM,MAAM,KAAK,KAAK,CAAC,AAAC,MAAuB,WAAW;AACnE;AAEO,SAAS,0CAAsB,KAAmB;IACvD,yEAAyE;IACzE,uFAAuF;IACvF,kGAAkG;IAClG,mHAAmH;IACnH,oHAAoH;IACpH,8DAA8D;IAC9D,OACE,AAAC,CAAC,CAAA,GAAA,mCAAQ,OAAO,MAAM,KAAK,KAAK,KAAK,MAAM,MAAM,KAAK,KACtD,MAAM,KAAK,KAAK,KACf,MAAM,MAAM,KAAK,KACjB,MAAM,QAAQ,KAAK,KACnB,MAAM,MAAM,KAAK,KACjB,MAAM,WAAW,KAAK;AAG5B","sources":["packages/@react-aria/utils/src/isVirtualEvent.ts"],"sourcesContent":["/*\n * Copyright 2022 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 {isAndroid} from './platform';\n\n// Original licensing for the following method can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/facebook/react/blob/3c713d513195a53788b3f8bb4b70279d68b15bcc/packages/react-interactions/events/src/dom/shared/index.js#L74-L87\n\n// Keyboards, Assistive Technologies, and element.click() all produce a \"virtual\"\n// click event. This is a method of inferring such clicks. Every browser except\n// IE 11 only sets a zero value of \"detail\" for click events that are \"virtual\".\n// However, IE 11 uses a zero value for all click events. For IE 11 we rely on\n// the quirk that it produces click events that are of type PointerEvent, and\n// where only the \"virtual\" click lacks a pointerType field.\n\nexport function isVirtualClick(event: MouseEvent | PointerEvent): boolean {\n // JAWS/NVDA with Firefox.\n if ((event as any).mozInputSource === 0 && event.isTrusted) {\n return true;\n }\n\n // Android TalkBack's detail value varies depending on the event listener providing the event so we have specific logic here instead\n // If pointerType is defined, event is from a click listener. For events from mousedown listener, detail === 0 is a sufficient check\n // to detect TalkBack virtual clicks.\n if (isAndroid() && (event as PointerEvent).pointerType) {\n return event.type === 'click' && event.buttons === 1;\n }\n\n return event.detail === 0 && !(event as PointerEvent).pointerType;\n}\n\nexport function isVirtualPointerEvent(event: PointerEvent): boolean {\n // If the pointer size is zero, then we assume it's from a screen reader.\n // Android TalkBack double tap will sometimes return a event with width and height of 1\n // and pointerType === 'mouse' so we need to check for a specific combination of event attributes.\n // Cannot use \"event.pressure === 0\" as the sole check due to Safari pointer events always returning pressure === 0\n // instead of .5, see https://bugs.webkit.org/show_bug.cgi?id=206216. event.pointerType === 'mouse' is to distingush\n // Talkback double tap from Windows Firefox touch screen press\n return (\n (!isAndroid() && event.width === 0 && event.height === 0) ||\n (event.width === 1 &&\n event.height === 1 &&\n event.pressure === 0 &&\n event.detail === 0 &&\n event.pointerType === 'mouse'\n )\n );\n}\n"],"names":[],"version":3,"file":"isVirtualEvent.main.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAeM,SAAS,0CAAe,KAAgC;IAC7D,0BAA0B;IAC1B,IAAI,AAAC,MAAc,cAAc,KAAK,KAAK,MAAM,SAAS,EACxD,OAAO;IAGT,oIAAoI;IACpI,oIAAoI;IACpI,qCAAqC;IACrC,IAAI,CAAA,GAAA,yCAAQ,OAAO,AAAC,MAAuB,WAAW,EACpD,OAAO,MAAM,IAAI,KAAK,WAAW,MAAM,OAAO,KAAK;IAGrD,OAAO,MAAM,MAAM,KAAK,KAAK,CAAC,AAAC,MAAuB,WAAW;AACnE;AAEO,SAAS,0CAAsB,KAAmB;IACvD,yEAAyE;IACzE,uFAAuF;IACvF,kGAAkG;IAClG,mHAAmH;IACnH,oHAAoH;IACpH,8DAA8D;IAC9D,OACE,AAAC,CAAC,CAAA,GAAA,yCAAQ,OAAO,MAAM,KAAK,KAAK,KAAK,MAAM,MAAM,KAAK,KACtD,MAAM,KAAK,KAAK,KACf,MAAM,MAAM,KAAK,KACjB,MAAM,QAAQ,KAAK,KACnB,MAAM,MAAM,KAAK,KACjB,MAAM,WAAW,KAAK;AAG5B","sources":["packages/@react-aria/utils/src/isVirtualEvent.ts"],"sourcesContent":["/*\n * Copyright 2022 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 {isAndroid} from './platform';\n\n// Original licensing for the following method can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/facebook/react/blob/3c713d513195a53788b3f8bb4b70279d68b15bcc/packages/react-interactions/events/src/dom/shared/index.js#L74-L87\n\n// Keyboards, Assistive Technologies, and element.click() all produce a \"virtual\"\n// click event. This is a method of inferring such clicks. Every browser except\n// IE 11 only sets a zero value of \"detail\" for click events that are \"virtual\".\n// However, IE 11 uses a zero value for all click events. For IE 11 we rely on\n// the quirk that it produces click events that are of type PointerEvent, and\n// where only the \"virtual\" click lacks a pointerType field.\n\nexport function isVirtualClick(event: MouseEvent | PointerEvent): boolean {\n // JAWS/NVDA with Firefox.\n if ((event as any).mozInputSource === 0 && event.isTrusted) {\n return true;\n }\n\n // Android TalkBack's detail value varies depending on the event listener providing the event so we have specific logic here instead\n // If pointerType is defined, event is from a click listener. For events from mousedown listener, detail === 0 is a sufficient check\n // to detect TalkBack virtual clicks.\n if (isAndroid() && (event as PointerEvent).pointerType) {\n return event.type === 'click' && event.buttons === 1;\n }\n\n return event.detail === 0 && !(event as PointerEvent).pointerType;\n}\n\nexport function isVirtualPointerEvent(event: PointerEvent) {\n // If the pointer size is zero, then we assume it's from a screen reader.\n // Android TalkBack double tap will sometimes return a event with width and height of 1\n // and pointerType === 'mouse' so we need to check for a specific combination of event attributes.\n // Cannot use \"event.pressure === 0\" as the sole check due to Safari pointer events always returning pressure === 0\n // instead of .5, see https://bugs.webkit.org/show_bug.cgi?id=206216. event.pointerType === 'mouse' is to distingush\n // Talkback double tap from Windows Firefox touch screen press\n return (\n (!isAndroid() && event.width === 0 && event.height === 0) ||\n (event.width === 1 &&\n event.height === 1 &&\n event.pressure === 0 &&\n event.detail === 0 &&\n event.pointerType === 'mouse'\n )\n );\n}\n"],"names":[],"version":3,"file":"isVirtualEvent.module.js.map"}
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAeM,SAAS,0CAAe,KAAgC;IAC7D,0BAA0B;IAC1B,IAAI,AAAC,MAAc,cAAc,KAAK,KAAK,MAAM,SAAS,EACxD,OAAO;IAGT,oIAAoI;IACpI,oIAAoI;IACpI,qCAAqC;IACrC,IAAI,CAAA,GAAA,yCAAQ,OAAO,AAAC,MAAuB,WAAW,EACpD,OAAO,MAAM,IAAI,KAAK,WAAW,MAAM,OAAO,KAAK;IAGrD,OAAO,MAAM,MAAM,KAAK,KAAK,CAAC,AAAC,MAAuB,WAAW;AACnE;AAEO,SAAS,0CAAsB,KAAmB;IACvD,yEAAyE;IACzE,uFAAuF;IACvF,kGAAkG;IAClG,mHAAmH;IACnH,oHAAoH;IACpH,8DAA8D;IAC9D,OACE,AAAC,CAAC,CAAA,GAAA,yCAAQ,OAAO,MAAM,KAAK,KAAK,KAAK,MAAM,MAAM,KAAK,KACtD,MAAM,KAAK,KAAK,KACf,MAAM,MAAM,KAAK,KACjB,MAAM,QAAQ,KAAK,KACnB,MAAM,MAAM,KAAK,KACjB,MAAM,WAAW,KAAK;AAG5B","sources":["packages/@react-aria/utils/src/isVirtualEvent.ts"],"sourcesContent":["/*\n * Copyright 2022 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 {isAndroid} from './platform';\n\n// Original licensing for the following method can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/facebook/react/blob/3c713d513195a53788b3f8bb4b70279d68b15bcc/packages/react-interactions/events/src/dom/shared/index.js#L74-L87\n\n// Keyboards, Assistive Technologies, and element.click() all produce a \"virtual\"\n// click event. This is a method of inferring such clicks. Every browser except\n// IE 11 only sets a zero value of \"detail\" for click events that are \"virtual\".\n// However, IE 11 uses a zero value for all click events. For IE 11 we rely on\n// the quirk that it produces click events that are of type PointerEvent, and\n// where only the \"virtual\" click lacks a pointerType field.\n\nexport function isVirtualClick(event: MouseEvent | PointerEvent): boolean {\n // JAWS/NVDA with Firefox.\n if ((event as any).mozInputSource === 0 && event.isTrusted) {\n return true;\n }\n\n // Android TalkBack's detail value varies depending on the event listener providing the event so we have specific logic here instead\n // If pointerType is defined, event is from a click listener. For events from mousedown listener, detail === 0 is a sufficient check\n // to detect TalkBack virtual clicks.\n if (isAndroid() && (event as PointerEvent).pointerType) {\n return event.type === 'click' && event.buttons === 1;\n }\n\n return event.detail === 0 && !(event as PointerEvent).pointerType;\n}\n\nexport function isVirtualPointerEvent(event: PointerEvent): boolean {\n // If the pointer size is zero, then we assume it's from a screen reader.\n // Android TalkBack double tap will sometimes return a event with width and height of 1\n // and pointerType === 'mouse' so we need to check for a specific combination of event attributes.\n // Cannot use \"event.pressure === 0\" as the sole check due to Safari pointer events always returning pressure === 0\n // instead of .5, see https://bugs.webkit.org/show_bug.cgi?id=206216. event.pointerType === 'mouse' is to distingush\n // Talkback double tap from Windows Firefox touch screen press\n return (\n (!isAndroid() && event.width === 0 && event.height === 0) ||\n (event.width === 1 &&\n event.height === 1 &&\n event.pressure === 0 &&\n event.detail === 0 &&\n event.pointerType === 'mouse'\n )\n );\n}\n"],"names":[],"version":3,"file":"isVirtualEvent.module.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAUM,SAAS,0CAAiB,CAAQ;IACvC,IAAI,CAAA,GAAA,+BAAI,KACN,OAAO,EAAE,OAAO;IAGlB,OAAO,EAAE,OAAO;AAClB","sources":["packages/@react-aria/utils/src/keyboard.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {isMac} from './platform';\n\ninterface Event {\n altKey: boolean,\n ctrlKey: boolean,\n metaKey: boolean\n}\n\nexport function isCtrlKeyPressed(e: Event) {\n if (isMac()) {\n return e.metaKey;\n }\n\n return e.ctrlKey;\n}\n"],"names":[],"version":3,"file":"keyboard.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAUM,SAAS,0CAAiB,CAAQ;IACvC,IAAI,CAAA,GAAA,+BAAI,KACN,OAAO,EAAE,OAAO;IAGlB,OAAO,EAAE,OAAO;AAClB","sources":["packages/@react-aria/utils/src/keyboard.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {isMac} from './platform';\n\ninterface Event {\n altKey: boolean,\n ctrlKey: boolean,\n metaKey: boolean\n}\n\nexport function isCtrlKeyPressed(e: Event): boolean {\n if (isMac()) {\n return e.metaKey;\n }\n\n return e.ctrlKey;\n}\n"],"names":[],"version":3,"file":"keyboard.main.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAUM,SAAS,0CAAiB,CAAQ;IACvC,IAAI,CAAA,GAAA,yCAAI,KACN,OAAO,EAAE,OAAO;IAGlB,OAAO,EAAE,OAAO;AAClB","sources":["packages/@react-aria/utils/src/keyboard.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {isMac} from './platform';\n\ninterface Event {\n altKey: boolean,\n ctrlKey: boolean,\n metaKey: boolean\n}\n\nexport function isCtrlKeyPressed(e: Event) {\n if (isMac()) {\n return e.metaKey;\n }\n\n return e.ctrlKey;\n}\n"],"names":[],"version":3,"file":"keyboard.module.js.map"}
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAUM,SAAS,0CAAiB,CAAQ;IACvC,IAAI,CAAA,GAAA,yCAAI,KACN,OAAO,EAAE,OAAO;IAGlB,OAAO,EAAE,OAAO;AAClB","sources":["packages/@react-aria/utils/src/keyboard.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {isMac} from './platform';\n\ninterface Event {\n altKey: boolean,\n ctrlKey: boolean,\n metaKey: boolean\n}\n\nexport function isCtrlKeyPressed(e: Event): boolean {\n if (isMac()) {\n return e.metaKey;\n }\n\n return e.ctrlKey;\n}\n"],"names":[],"version":3,"file":"keyboard.module.js.map"}
|
package/dist/openLink.main.js
CHANGED
|
@@ -79,7 +79,7 @@ function $4068a0fae83b6d84$export$95185d699e05d4d7(target, modifiers, setOpening
|
|
|
79
79
|
}
|
|
80
80
|
// WebKit does not support firing click events with modifier keys, but does support keyboard events.
|
|
81
81
|
// https://github.com/WebKit/WebKit/blob/c03d0ac6e6db178f90923a0a63080b5ca210d25f/Source/WebCore/html/HTMLAnchorElement.cpp#L184
|
|
82
|
-
let event = (0, $9e20cff0af27e8cc$exports.isWebKit)() && (0, $9e20cff0af27e8cc$exports.isMac)() && !(0, $9e20cff0af27e8cc$exports.isIPad)() &&
|
|
82
|
+
let event = (0, $9e20cff0af27e8cc$exports.isWebKit)() && (0, $9e20cff0af27e8cc$exports.isMac)() && !(0, $9e20cff0af27e8cc$exports.isIPad)() && process.env.NODE_ENV !== 'test' ? new KeyboardEvent('keydown', {
|
|
83
83
|
keyIdentifier: 'Enter',
|
|
84
84
|
metaKey: metaKey,
|
|
85
85
|
ctrlKey: ctrlKey,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAaD,MAAM,oDAAgB,CAAA,GAAA,0BAAY,EAAU;IAC1C,UAAU;IACV,MAAM;IACN,SAAS,CAAC,OAAS;AACrB;AAYO,SAAS,0CAAe,KAA0B;IACvD,IAAI,YAAC,QAAQ,YAAE,QAAQ,WAAE,OAAO,EAAC,GAAG;IA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A,cAAc;IAC1C,OAAO;QACL,aAAa,MAAM,IAAI,GAAG,OAAO;QACjC,eAAe,MAAM,MAAM;QAC3B,YAAY,MAAM,GAAG;QACrB,iBAAiB,MAAM,QAAQ;QAC/B,aAAa,MAAM,IAAI;QACvB,wBAAwB,MAAM,cAAc;IAC9C;AACF;AAGO,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,KAAoB;IAC/C,IAAI,SAAS;QACe;IAA5B,MAAM,OAAO,OAAO,OAAO,CAAC,CAAA,cAAA,kBAAA,4BAAA,MAAO,IAAI,cAAX,yBAAA,cAAe;IAC3C,OAAO;QACL,MAAM,CAAA,kBAAA,4BAAA,MAAO,IAAI,IAAG,OAAO;QAC3B,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 useSyntheticLinkProps(props: LinkDOMProps) {\n let router = useRouter();\n const href = router.useHref(props.href ?? '');\n return {\n 'data-href': props.href ? href : undefined,\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\n/** @deprecated - For backward compatibility. */\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 const href = router.useHref(props?.href ?? '');\n return {\n href: props?.href ? 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.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAaD,MAAM,oDAAgB,CAAA,GAAA,0BAAY,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,oBAAM,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,0DAAC,oCAAc,Q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3B,YAAY,MAAM,GAAG;QACrB,iBAAiB,MAAM,QAAQ;QAC/B,aAAa,MAAM,IAAI;QACvB,wBAAwB,MAAM,cAAc;IAC9C;AACF;AAEO,SAAS,0CAAa,KAAoB;IAC/C,IAAI,SAAS;QACe;IAA5B,MAAM,OAAO,OAAO,OAAO,CAAC,CAAA,cAAA,kBAAA,4BAAA,MAAO,IAAI,cAAX,yBAAA,cAAe;IAC3C,OAAO;QACL,MAAM,CAAA,kBAAA,4BAAA,MAAO,IAAI,IAAG,OAAO;QAC3B,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, DOMAttributes, 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): ReactNode {\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): boolean {\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): void {\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 useSyntheticLinkProps(props: LinkDOMProps): DOMAttributes<HTMLElement> {\n let router = useRouter();\n const href = router.useHref(props.href ?? '');\n return {\n 'data-href': props.href ? href : undefined,\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 } as DOMAttributes<HTMLElement>;\n}\n\n/** @deprecated - For backward compatibility. */\nexport function getSyntheticLinkProps(props: LinkDOMProps): DOMAttributes<HTMLElement> {\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 } as DOMAttributes<HTMLElement>;\n}\n\nexport function useLinkProps(props?: LinkDOMProps): LinkDOMProps {\n let router = useRouter();\n const href = router.useHref(props?.href ?? '');\n return {\n href: props?.href ? 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.main.js.map"}
|
package/dist/openLink.mjs
CHANGED
|
@@ -63,7 +63,7 @@ function $ea8dcbcb9ea1b556$export$95185d699e05d4d7(target, modifiers, setOpening
|
|
|
63
63
|
}
|
|
64
64
|
// WebKit does not support firing click events with modifier keys, but does support keyboard events.
|
|
65
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)() &&
|
|
66
|
+
let event = (0, $c87311424ea30a05$export$78551043582a6a98)() && (0, $c87311424ea30a05$export$9ac100e40613ea10)() && !(0, $c87311424ea30a05$export$7bef049ce92e4224)() && process.env.NODE_ENV !== 'test' ? new KeyboardEvent('keydown', {
|
|
67
67
|
keyIdentifier: 'Enter',
|
|
68
68
|
metaKey: metaKey,
|
|
69
69
|
ctrlKey: ctrlKey,
|
package/dist/openLink.module.js
CHANGED
|
@@ -63,7 +63,7 @@ function $ea8dcbcb9ea1b556$export$95185d699e05d4d7(target, modifiers, setOpening
|
|
|
63
63
|
}
|
|
64
64
|
// WebKit does not support firing click events with modifier keys, but does support keyboard events.
|
|
65
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)() &&
|
|
66
|
+
let event = (0, $c87311424ea30a05$export$78551043582a6a98)() && (0, $c87311424ea30a05$export$9ac100e40613ea10)() && !(0, $c87311424ea30a05$export$7bef049ce92e4224)() && process.env.NODE_ENV !== 'test' ? new KeyboardEvent('keydown', {
|
|
67
67
|
keyIdentifier: 'Enter',
|
|
68
68
|
metaKey: metaKey,
|
|
69
69
|
ctrlKey: ctrlKey,
|
|
@@ -1 +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,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AAO,OAAO,OAAO,CAAC,CAAA,cAAA,kBAAA,4BAAA,MAAO,IAAI,cAAX,yBAAA,cAAe;IAC3C,OAAO;QACL,MAAM,CAAA,kBAAA,4BAAA,MAAO,IAAI,IAAG,OAAO;QAC3B,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 useSyntheticLinkProps(props: LinkDOMProps) {\n let router = useRouter();\n const href = router.useHref(props.href ?? '');\n return {\n 'data-href': props.href ? href : undefined,\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\n/** @deprecated - For backward compatibility. */\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 const href = router.useHref(props?.href ?? '');\n return {\n href: props?.href ? 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"}
|
|
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,a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A,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, DOMAttributes, 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): ReactNode {\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): boolean {\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): void {\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 useSyntheticLinkProps(props: LinkDOMProps): DOMAttributes<HTMLElement> {\n let router = useRouter();\n const href = router.useHref(props.href ?? '');\n return {\n 'data-href': props.href ? href : undefined,\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 } as DOMAttributes<HTMLElement>;\n}\n\n/** @deprecated - For backward compatibility. */\nexport function getSyntheticLinkProps(props: LinkDOMProps): DOMAttributes<HTMLElement> {\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 } as DOMAttributes<HTMLElement>;\n}\n\nexport function useLinkProps(props?: LinkDOMProps): LinkDOMProps {\n let router = useRouter();\n const href = router.useHref(props?.href ?? '');\n return {\n href: props?.href ? 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"}
|
package/dist/platform.main.js
CHANGED
|
@@ -32,6 +32,7 @@ function $9e20cff0af27e8cc$var$testPlatform(re) {
|
|
|
32
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
33
|
}
|
|
34
34
|
function $9e20cff0af27e8cc$var$cached(fn) {
|
|
35
|
+
if (process.env.NODE_ENV === 'test') return fn;
|
|
35
36
|
let res = null;
|
|
36
37
|
return ()=>{
|
|
37
38
|
if (res == null) res = fn();
|
|
@@ -1 +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;AAEA,SAAS,6BAAO,EAAiB;
|
|
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;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,4CAAQ,6BAAO;IAC1B,OAAO,mCAAa;AACtB;AAEO,MAAM,2CAAW,6BAAO;IAC7B,OAAO,mCAAa;AACtB;AAEO,MAAM,4CAAS,6BAAO;IAC3B,OAAO,mCAAa,aAClB,yFAAyF;IACxF,+CAAW,UAAU,cAAc,GAAG;AAC3C;AAEO,MAAM,4CAAQ,6BAAO;IAC1B,OAAO,8CAAc;AACvB;AAEO,MAAM,4CAAgB,6BAAO;IAClC,OAAO,+CAAW;AACpB;AAEO,MAAM,4CAAW,6BAAO;IAC7B,OAAO,oCAAc,mBAAmB,CAAC;AAC3C;AAEO,MAAM,4CAAW,6BAAO;IAC7B,OAAO,oCAAc;AACvB;AAEO,MAAM,4CAAY,6BAAO;IAC9B,OAAO,oCAAc;AACvB;AAEO,MAAM,4CAAY,6BAAO;IAC9B,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\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 = cached(function () {\n return testPlatform(/^Mac/i);\n});\n\nexport const isIPhone = cached(function () {\n return testPlatform(/^iPhone/i);\n});\n\nexport const isIPad = 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 = cached(function () {\n return isIPhone() || isIPad();\n});\n\nexport const isAppleDevice = cached(function () {\n return isMac() || isIOS();\n});\n\nexport const isWebKit = cached(function () {\n return testUserAgent(/AppleWebKit/i) && !isChrome();\n});\n\nexport const isChrome = cached(function () {\n return testUserAgent(/Chrome/i);\n});\n\nexport const isAndroid = cached(function () {\n return testUserAgent(/Android/i);\n});\n\nexport const isFirefox = cached(function () {\n return testUserAgent(/Firefox/i);\n});\n"],"names":[],"version":3,"file":"platform.main.js.map"}
|