@spectrum-web-components/overlay 0.40.4 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["PlacementController.ts"],
4
- "sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport type {\n ReactiveController,\n ReactiveElement,\n} from '@spectrum-web-components/base';\nimport {\n arrow,\n autoUpdate,\n computePosition,\n flip,\n offset,\n Placement,\n shift,\n size,\n} from '@floating-ui/dom';\nimport type { VirtualTrigger } from './VirtualTrigger.js';\nimport { topLayerOverTransforms } from './topLayerOverTransforms.js';\nimport type { OpenableElement } from './overlay-types.js';\nimport type { Overlay } from './Overlay.js';\n\ntype OverlayOptionsV1 = {\n abortPromise?: Promise<boolean>;\n delayed?: boolean;\n offset?: number | [number, number]; // supporting multi-axis\n placement: Placement;\n notImmediatelyClosable?: boolean; // rename or place behind other API options\n receivesFocus?: 'auto';\n root?: HTMLElement;\n tipPadding?: number;\n trigger: HTMLElement | VirtualTrigger;\n type?: 'modal' | 'page' | 'hint' | 'auto' | 'manual';\n};\n\nfunction roundByDPR(num?: number): number {\n if (typeof num === 'undefined') return 0;\n const dpr = window.devicePixelRatio || 1;\n return Math.round(num * dpr) / dpr ?? -10000;\n}\n\n// See: https://spectrum.adobe.com/page/popover/#Container-padding\nconst REQUIRED_DISTANCE_TO_EDGE = 8;\n// See: https://github.com/adobe/spectrum-web-components/issues/910\nconst MIN_OVERLAY_HEIGHT = 100;\n\nconst getFallbackPlacements = (placement: Placement): Placement[] => {\n const fallbacks: Record<Placement, Placement[]> = {\n left: ['right', 'bottom', 'top'],\n 'left-start': ['right-start', 'bottom', 'top'],\n 'left-end': ['right-end', 'bottom', 'top'],\n right: ['left', 'bottom', 'top'],\n 'right-start': ['left-start', 'bottom', 'top'],\n 'right-end': ['left-end', 'bottom', 'top'],\n top: ['bottom', 'left', 'right'],\n 'top-start': ['bottom-start', 'left', 'right'],\n 'top-end': ['bottom-end', 'left', 'right'],\n bottom: ['top', 'left', 'right'],\n 'bottom-start': ['top-start', 'left', 'right'],\n 'bottom-end': ['top-end', 'left', 'right'],\n };\n return fallbacks[placement] ?? [placement];\n};\n\nexport const placementUpdatedSymbol = Symbol('placement updated');\n\nexport class PlacementController implements ReactiveController {\n private cleanup?: () => void;\n\n initialHeight?: number;\n\n isConstrained?: boolean;\n\n private host!: ReactiveElement & { elements: OpenableElement[] };\n\n private options!: OverlayOptionsV1;\n\n private originalPlacements = new WeakMap<HTMLElement, Placement>();\n\n private target!: HTMLElement;\n\n constructor(host: ReactiveElement & { elements: OpenableElement[] }) {\n this.host = host;\n // Add the controller after the MutationObserver has been created in preparation\n // for the `hostConnected`/`hostDisconnected` callbacks to be run.\n this.host.addController(this);\n }\n\n public async placeOverlay(\n target: HTMLElement = this.target,\n options: OverlayOptionsV1 = this.options\n ): Promise<void> {\n this.target = target;\n this.options = options;\n if (!target || !options) return;\n\n const cleanupAncestorResize = autoUpdate(\n options.trigger,\n target,\n this.closeForAncestorUpdate,\n {\n ancestorResize: false,\n elementResize: false,\n layoutShift: false,\n }\n );\n const cleanupElementResize = autoUpdate(\n options.trigger,\n target,\n this.updatePlacement,\n {\n ancestorScroll: false,\n }\n );\n this.cleanup = () => {\n this.host.elements?.forEach((element) => {\n element.addEventListener(\n 'sp-closed',\n () => {\n const placement = this.originalPlacements.get(element);\n if (placement) {\n element.setAttribute('placement', placement);\n }\n this.originalPlacements.delete(element);\n },\n { once: true }\n );\n });\n cleanupAncestorResize();\n cleanupElementResize();\n };\n }\n\n allowPlacementUpdate = false;\n\n closeForAncestorUpdate = (): void => {\n if (\n !this.allowPlacementUpdate &&\n this.options.type !== 'modal' &&\n this.cleanup\n ) {\n this.target.dispatchEvent(new Event('close', { bubbles: true }));\n }\n this.allowPlacementUpdate = false;\n };\n\n updatePlacement = (): void => {\n this.computePlacement();\n };\n\n async computePlacement(): Promise<void> {\n const { options, target } = this;\n\n await (document.fonts ? document.fonts.ready : Promise.resolve());\n\n const flipMiddleware = !(options.trigger instanceof HTMLElement)\n ? flip({\n padding: REQUIRED_DISTANCE_TO_EDGE,\n fallbackPlacements: getFallbackPlacements(options.placement),\n })\n : flip();\n\n const [mainAxis = 0, crossAxis = 0] = Array.isArray(options?.offset)\n ? options.offset\n : [options.offset, 0];\n\n const tipElement = this.host.elements.find(\n (el) => el.tipElement\n )?.tipElement;\n\n const middleware = [\n offset({\n mainAxis,\n crossAxis,\n }),\n shift({ padding: REQUIRED_DISTANCE_TO_EDGE }),\n flipMiddleware,\n size({\n padding: REQUIRED_DISTANCE_TO_EDGE,\n apply: ({\n availableWidth,\n availableHeight,\n rects: { floating },\n }) => {\n const maxHeight = Math.max(\n MIN_OVERLAY_HEIGHT,\n Math.floor(availableHeight)\n );\n const actualHeight = floating.height;\n this.initialHeight = !this.isConstrained // && !this.virtualTrigger\n ? actualHeight\n : this.initialHeight || actualHeight;\n this.isConstrained =\n actualHeight < this.initialHeight ||\n maxHeight <= actualHeight;\n const appliedHeight = this.isConstrained\n ? `${maxHeight}px`\n : '';\n Object.assign(target.style, {\n maxWidth: `${Math.floor(availableWidth)}px`,\n maxHeight: appliedHeight,\n });\n },\n }),\n ...(tipElement\n ? [\n arrow({\n element: tipElement,\n padding:\n options.tipPadding || REQUIRED_DISTANCE_TO_EDGE,\n }),\n ]\n : []),\n topLayerOverTransforms(),\n ];\n const { x, y, placement, middlewareData } = await computePosition(\n options.trigger,\n target,\n {\n placement: options.placement,\n middleware,\n strategy: 'fixed',\n }\n );\n Object.assign(target.style, {\n top: '0px',\n left: '0px',\n translate: `${roundByDPR(x)}px ${roundByDPR(y)}px`,\n });\n\n target.setAttribute('actual-placement', placement);\n this.host.elements?.forEach((element) => {\n if (!this.originalPlacements.has(element)) {\n this.originalPlacements.set(\n element,\n element.getAttribute('placement') as Placement\n );\n }\n element.setAttribute('placement', placement);\n });\n\n if (tipElement && middlewareData.arrow) {\n const { x: arrowX, y: arrowY } = middlewareData.arrow;\n\n Object.assign(tipElement.style, {\n top:\n placement.startsWith('right') ||\n placement.startsWith('left')\n ? '0px'\n : '',\n left:\n placement.startsWith('bottom') ||\n placement.startsWith('top')\n ? '0px'\n : '',\n translate: `${roundByDPR(arrowX)}px ${roundByDPR(arrowY)}px`,\n });\n }\n }\n\n public clearOverlayPosition(): void {\n if (!this.target) {\n return;\n }\n this.target.style.removeProperty('max-height');\n this.target.style.removeProperty('max-width');\n this.initialHeight = undefined;\n this.isConstrained = false;\n }\n\n public resetOverlayPosition = (): void => {\n if (!this.target || !this.options) return;\n this.clearOverlayPosition();\n\n // force paint\n this.host.offsetHeight;\n this.computePlacement();\n };\n\n hostConnected(): void {\n document.addEventListener(\n 'sp-update-overlays',\n this.resetOverlayPosition\n );\n }\n\n hostUpdated(): void {\n if (!(this.host as Overlay).open) {\n this.cleanup?.();\n this.cleanup = undefined;\n }\n }\n\n hostDisconnected(): void {\n this.cleanup?.();\n this.cleanup = undefined;\n document.removeEventListener(\n 'sp-update-overlays',\n this.resetOverlayPosition\n );\n }\n}\n"],
5
- "mappings": "aAgBA,OACI,SAAAA,EACA,cAAAC,EACA,mBAAAC,EACA,QAAAC,EACA,UAAAC,EAEA,SAAAC,EACA,QAAAC,MACG,mBAEP,OAAS,0BAAAC,MAA8B,8BAiBvC,SAASC,EAAWC,EAAsB,CACtC,GAAI,OAAOA,GAAQ,YAAa,MAAO,GACvC,MAAMC,EAAM,OAAO,kBAAoB,EACvC,OAAO,KAAK,MAAMD,EAAMC,CAAG,EAAIA,CACn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AW,MAAM,EACrB,MACA,GACV,KACIA,EAAU,WAAW,QAAQ,GAC7BA,EAAU,WAAW,KAAK,EACpB,MACA,GACV,UAAW,GAAGN,EAAW8B,CAAM,CAAC,MAAM9B,EAAW+B,CAAM,CAAC,IAC5D,CAAC,CACL,CACJ,CAEO,sBAA6B,CAC3B,KAAK,SAGV,KAAK,OAAO,MAAM,eAAe,YAAY,EAC7C,KAAK,OAAO,MAAM,eAAe,WAAW,EAC5C,KAAK,cAAgB,OACrB,KAAK,cAAgB,GACzB,CAWA,eAAsB,CAClB,SAAS,iBACL,qBACA,KAAK,oBACT,CACJ,CAEA,aAAoB,CAvSxB,IAAAxB,EAwSc,KAAK,KAAiB,QACxBA,EAAA,KAAK,UAAL,MAAAA,EAAA,WACA,KAAK,QAAU,OAEvB,CAEA,kBAAyB,CA9S7B,IAAAA,GA+SQA,EAAA,KAAK,UAAL,MAAAA,EAAA,WACA,KAAK,QAAU,OACf,SAAS,oBACL,qBACA,KAAK,oBACT,CACJ,CACJ",
6
- "names": ["arrow", "autoUpdate", "computePosition", "flip", "offset", "shift", "size", "topLayerOverTransforms", "roundByDPR", "num", "dpr", "REQUIRED_DISTANCE_TO_EDGE", "MIN_OVERLAY_HEIGHT", "getFallbackPlacements", "placement", "_a", "host", "target", "options", "cleanupAncestorResize", "cleanupElementResize", "element", "_b", "flipMiddleware", "mainAxis", "crossAxis", "tipElement", "el", "middleware", "availableWidth", "availableHeight", "floating", "maxHeight", "actualHeight", "appliedHeight", "x", "y", "middlewareData", "arrowX", "arrowY"]
4
+ "sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport type {\n ReactiveController,\n ReactiveElement,\n} from '@spectrum-web-components/base';\nimport {\n arrow,\n autoUpdate,\n computePosition,\n flip,\n offset,\n Placement,\n shift,\n size,\n} from '@floating-ui/dom';\nimport type { VirtualTrigger } from './VirtualTrigger.js';\nimport type { OpenableElement } from './overlay-types.js';\nimport type { Overlay } from './Overlay.js';\n\ntype OverlayOptionsV1 = {\n abortPromise?: Promise<boolean>;\n delayed?: boolean;\n offset?: number | [number, number]; // supporting multi-axis\n placement: Placement;\n notImmediatelyClosable?: boolean; // rename or place behind other API options\n receivesFocus?: 'auto';\n root?: HTMLElement;\n tipPadding?: number;\n trigger: HTMLElement | VirtualTrigger;\n type?: 'modal' | 'page' | 'hint' | 'auto' | 'manual';\n};\n\nfunction roundByDPR(num?: number): number {\n if (typeof num === 'undefined') return 0;\n const dpr = window.devicePixelRatio || 1;\n return Math.round(num * dpr) / dpr ?? -10000;\n}\n\n// See: https://spectrum.adobe.com/page/popover/#Container-padding\nconst REQUIRED_DISTANCE_TO_EDGE = 8;\n// See: https://github.com/adobe/spectrum-web-components/issues/910\nconst MIN_OVERLAY_HEIGHT = 100;\n\nconst getFallbackPlacements = (placement: Placement): Placement[] => {\n const fallbacks: Record<Placement, Placement[]> = {\n left: ['right', 'bottom', 'top'],\n 'left-start': ['right-start', 'bottom', 'top'],\n 'left-end': ['right-end', 'bottom', 'top'],\n right: ['left', 'bottom', 'top'],\n 'right-start': ['left-start', 'bottom', 'top'],\n 'right-end': ['left-end', 'bottom', 'top'],\n top: ['bottom', 'left', 'right'],\n 'top-start': ['bottom-start', 'left', 'right'],\n 'top-end': ['bottom-end', 'left', 'right'],\n bottom: ['top', 'left', 'right'],\n 'bottom-start': ['top-start', 'left', 'right'],\n 'bottom-end': ['top-end', 'left', 'right'],\n };\n return fallbacks[placement] ?? [placement];\n};\n\nexport const placementUpdatedSymbol = Symbol('placement updated');\n\nexport class PlacementController implements ReactiveController {\n private cleanup?: () => void;\n\n initialHeight?: number;\n\n isConstrained?: boolean;\n\n private host!: ReactiveElement & { elements: OpenableElement[] };\n\n private options!: OverlayOptionsV1;\n\n private originalPlacements = new WeakMap<HTMLElement, Placement>();\n\n private target!: HTMLElement;\n\n constructor(host: ReactiveElement & { elements: OpenableElement[] }) {\n this.host = host;\n // Add the controller after the MutationObserver has been created in preparation\n // for the `hostConnected`/`hostDisconnected` callbacks to be run.\n this.host.addController(this);\n }\n\n public async placeOverlay(\n target: HTMLElement = this.target,\n options: OverlayOptionsV1 = this.options\n ): Promise<void> {\n this.target = target;\n this.options = options;\n if (!target || !options) return;\n\n const cleanupAncestorResize = autoUpdate(\n options.trigger,\n target,\n this.closeForAncestorUpdate,\n {\n ancestorResize: false,\n elementResize: false,\n layoutShift: false,\n }\n );\n const cleanupElementResize = autoUpdate(\n options.trigger,\n target,\n this.updatePlacement,\n {\n ancestorScroll: false,\n }\n );\n this.cleanup = () => {\n this.host.elements?.forEach((element) => {\n element.addEventListener(\n 'sp-closed',\n () => {\n const placement = this.originalPlacements.get(element);\n if (placement) {\n element.setAttribute('placement', placement);\n }\n this.originalPlacements.delete(element);\n },\n { once: true }\n );\n });\n cleanupAncestorResize();\n cleanupElementResize();\n };\n }\n\n allowPlacementUpdate = false;\n\n closeForAncestorUpdate = (): void => {\n if (\n !this.allowPlacementUpdate &&\n this.options.type !== 'modal' &&\n this.cleanup\n ) {\n this.target.dispatchEvent(new Event('close', { bubbles: true }));\n }\n this.allowPlacementUpdate = false;\n };\n\n updatePlacement = (): void => {\n this.computePlacement();\n };\n\n async computePlacement(): Promise<void> {\n const { options, target } = this;\n\n await (document.fonts ? document.fonts.ready : Promise.resolve());\n\n const flipMiddleware = !(options.trigger instanceof HTMLElement)\n ? flip({\n padding: REQUIRED_DISTANCE_TO_EDGE,\n fallbackPlacements: getFallbackPlacements(options.placement),\n })\n : flip();\n\n const [mainAxis = 0, crossAxis = 0] = Array.isArray(options?.offset)\n ? options.offset\n : [options.offset, 0];\n\n const tipElement = this.host.elements.find(\n (el) => el.tipElement\n )?.tipElement;\n\n const middleware = [\n offset({\n mainAxis,\n crossAxis,\n }),\n shift({ padding: REQUIRED_DISTANCE_TO_EDGE }),\n flipMiddleware,\n size({\n padding: REQUIRED_DISTANCE_TO_EDGE,\n apply: ({\n availableWidth,\n availableHeight,\n rects: { floating },\n }) => {\n const maxHeight = Math.max(\n MIN_OVERLAY_HEIGHT,\n Math.floor(availableHeight)\n );\n const actualHeight = floating.height;\n this.initialHeight = !this.isConstrained // && !this.virtualTrigger\n ? actualHeight\n : this.initialHeight || actualHeight;\n this.isConstrained =\n actualHeight < this.initialHeight ||\n maxHeight <= actualHeight;\n const appliedHeight = this.isConstrained\n ? `${maxHeight}px`\n : '';\n Object.assign(target.style, {\n maxWidth: `${Math.floor(availableWidth)}px`,\n maxHeight: appliedHeight,\n });\n },\n }),\n ...(tipElement\n ? [\n arrow({\n element: tipElement,\n padding:\n options.tipPadding || REQUIRED_DISTANCE_TO_EDGE,\n }),\n ]\n : []),\n ];\n const { x, y, placement, middlewareData } = await computePosition(\n options.trigger,\n target,\n {\n placement: options.placement,\n middleware,\n strategy: 'fixed',\n }\n );\n Object.assign(target.style, {\n top: '0px',\n left: '0px',\n translate: `${roundByDPR(x)}px ${roundByDPR(y)}px`,\n });\n\n target.setAttribute('actual-placement', placement);\n this.host.elements?.forEach((element) => {\n if (!this.originalPlacements.has(element)) {\n this.originalPlacements.set(\n element,\n element.getAttribute('placement') as Placement\n );\n }\n element.setAttribute('placement', placement);\n });\n\n if (tipElement && middlewareData.arrow) {\n const { x: arrowX, y: arrowY } = middlewareData.arrow;\n\n Object.assign(tipElement.style, {\n top:\n placement.startsWith('right') ||\n placement.startsWith('left')\n ? '0px'\n : '',\n left:\n placement.startsWith('bottom') ||\n placement.startsWith('top')\n ? '0px'\n : '',\n translate: `${roundByDPR(arrowX)}px ${roundByDPR(arrowY)}px`,\n });\n }\n }\n\n public clearOverlayPosition(): void {\n if (!this.target) {\n return;\n }\n this.target.style.removeProperty('max-height');\n this.target.style.removeProperty('max-width');\n this.initialHeight = undefined;\n this.isConstrained = false;\n }\n\n public resetOverlayPosition = (): void => {\n if (!this.target || !this.options) return;\n this.clearOverlayPosition();\n\n // force paint\n this.host.offsetHeight;\n this.computePlacement();\n };\n\n hostConnected(): void {\n document.addEventListener(\n 'sp-update-overlays',\n this.resetOverlayPosition\n );\n }\n\n hostUpdated(): void {\n if (!(this.host as Overlay).open) {\n this.cleanup?.();\n this.cleanup = undefined;\n }\n }\n\n hostDisconnected(): void {\n this.cleanup?.();\n this.cleanup = undefined;\n document.removeEventListener(\n 'sp-update-overlays',\n this.resetOverlayPosition\n );\n }\n}\n"],
5
+ "mappings": "aAgBA,OACI,SAAAA,EACA,cAAAC,EACA,mBAAAC,EACA,QAAAC,EACA,UAAAC,EAEA,SAAAC,EACA,QAAAC,MACG,mBAkBP,SAASC,EAAWC,EAAsB,CACtC,GAAI,OAAOA,GAAQ,YAAa,MAAO,GACvC,MAAMC,EAAM,OAAO,kBAAoB,EACvC,OAAO,KAAK,MAAMD,EAAMC,CAAG,EAAIA,CACnC,CAGA,MAAMC,EAA4B,EAE5BC,EAAqB,IAErBC,EAAyBC,GAAsC,CAtDrE,IAAAC,EAqEI,OAAOA,EAd2C,CAC9C,KAAM,CAAC,QAAS,SAAU,KAAK,EAC/B,aAAc,CAAC,cAAe,SAAU,KAAK,EAC7C,WAAY,CAAC,YAAa,SAAU,KAAK,EACzC,MAAO,CAAC,OAAQ,SAAU,KAAK,EAC/B,cAAe,CAAC,aAAc,SAAU,KAAK,EAC7C,YAAa,CAAC,WAAY,SAAU,KAAK,EACzC,IAAK,CAAC,SAAU,OAAQ,OAAO,EAC/B,YAAa,CAAC,eAAgB,OAAQ,OAAO,EAC7C,UAAW,CAAC,aAAc,OAAQ,OAAO,EACzC,OAAQ,CAAC,MAAO,OAAQ,OAAO,EAC/B,eAAgB,CAAC,YAAa,OAAQ,OAAO,EAC7C,aAAc,CAAC,UAAW,O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,WACA,KAAK,QAAU,OACf,SAAS,oBACL,qBACA,KAAK,oBACT,CACJ,CACJ",
6
+ "names": ["arrow", "autoUpdate", "computePosition", "flip", "offset", "shift", "size", "roundByDPR", "num", "dpr", "REQUIRED_DISTANCE_TO_EDGE", "MIN_OVERLAY_HEIGHT", "getFallbackPlacements", "placement", "_a", "host", "target", "options", "cleanupAncestorResize", "cleanupElementResize", "element", "_b", "flipMiddleware", "mainAxis", "crossAxis", "tipElement", "el", "middleware", "availableWidth", "availableHeight", "floating", "maxHeight", "actualHeight", "appliedHeight", "x", "y", "middlewareData", "arrowX", "arrowY"]
7
7
  }
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  import { css } from "@spectrum-web-components/base";
3
3
  const styles = css`
4
- :host{--swc-overlay-animation-distance:var(
4
+ :host{display:contents;pointer-events:none;--swc-overlay-animation-distance:var(
5
5
  --spectrum-picker-m-texticon-popover-offset-y,var(--spectrum-global-dimension-size-75)
6
- );display:contents;pointer-events:none}.dialog{--sp-overlay-open:true;background:none;border:0;box-sizing:border-box;display:flex;height:auto;inset:auto;left:0;margin:0;max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);max-width:calc(100vw - 16px);opacity:1!important;overflow:visible;padding:0;position:fixed;top:0}.dialog:not([is-visible]){display:none}.dialog:focus{outline:none}dialog:modal{--mod-popover-filter:var(--spectrum-popover-filter)}:host(:not([open])) .dialog{--sp-overlay-open:false}.dialog::backdrop{display:none}.dialog:before{content:"";inset:-999em;pointer-events:auto!important;position:absolute}.dialog:not(.not-immediately-closable):before{display:none}.dialog>div{width:100%}::slotted(*){pointer-events:auto;visibility:visible!important}::slotted(sp-popover){position:static}.dialog:not([actual-placement])[placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}slot[name=longpress-describedby-descriptor]{display:none}@supports selector(:open){.dialog{opacity:0}.dialog:open{--mod-popover-filter:var(--spectrum-popover-filter);opacity:1}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{--mod-popover-filter:var(--spectrum-popover-filter);opacity:1}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:calc(var(--swc-overlay-z-index-base, 1000) + var(--swc-overlay-open-count))}}
6
+ )}.dialog{background:none;border:0;box-sizing:border-box;display:flex;height:auto;inset:auto;left:0;margin:0;max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);max-width:calc(100vw - 16px);opacity:1!important;overflow:visible;padding:0;position:fixed;top:0;--sp-overlay-open:true}.dialog:not([is-visible]){display:none}.dialog:focus{outline:none}dialog:modal{--mod-popover-filter:var(--spectrum-popover-filter)}:host(:not([open])) .dialog{--sp-overlay-open:false}.dialog::backdrop{display:none}.dialog:before{content:"";inset:-999em;pointer-events:auto!important;position:absolute}.dialog:not(.not-immediately-closable):before{display:none}.dialog>div{width:100%}::slotted(*){pointer-events:auto;visibility:visible!important}::slotted(sp-popover){position:static}.dialog:not([actual-placement])[placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}slot[name=longpress-describedby-descriptor]{display:none}@supports selector(:open){.dialog{opacity:0}.dialog:open{opacity:1;--mod-popover-filter:var(--spectrum-popover-filter)}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{opacity:1;--mod-popover-filter:var(--spectrum-popover-filter)}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:calc(var(--swc-overlay-z-index-base, 1000) + var(--swc-overlay-open-count))}}
7
7
  `;
8
8
  export default styles;
9
9
  //# sourceMappingURL=overlay.css.dev.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["overlay.css.ts"],
4
- "sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--swc-overlay-animation-distance:var(\n--spectrum-picker-m-texticon-popover-offset-y,var(--spectrum-global-dimension-size-75)\n);display:contents;pointer-events:none}.dialog{--sp-overlay-open:true;background:none;border:0;box-sizing:border-box;display:flex;height:auto;inset:auto;left:0;margin:0;max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);max-width:calc(100vw - 16px);opacity:1!important;overflow:visible;padding:0;position:fixed;top:0}.dialog:not([is-visible]){display:none}.dialog:focus{outline:none}dialog:modal{--mod-popover-filter:var(--spectrum-popover-filter)}:host(:not([open])) .dialog{--sp-overlay-open:false}.dialog::backdrop{display:none}.dialog:before{content:\"\";inset:-999em;pointer-events:auto!important;position:absolute}.dialog:not(.not-immediately-closable):before{display:none}.dialog>div{width:100%}::slotted(*){pointer-events:auto;visibility:visible!important}::slotted(sp-popover){position:static}.dialog:not([actual-placement])[placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}slot[name=longpress-describedby-descriptor]{display:none}@supports selector(:open){.dialog{opacity:0}.dialog:open{--mod-popover-filter:var(--spectrum-popover-filter);opacity:1}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{--mod-popover-filter:var(--spectrum-popover-filter);opacity:1}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:calc(var(--swc-overlay-z-index-base, 1000) + var(--swc-overlay-open-count))}}\n`;\nexport default styles;"],
4
+ "sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{display:contents;pointer-events:none;--swc-overlay-animation-distance:var(\n--spectrum-picker-m-texticon-popover-offset-y,var(--spectrum-global-dimension-size-75)\n)}.dialog{background:none;border:0;box-sizing:border-box;display:flex;height:auto;inset:auto;left:0;margin:0;max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);max-width:calc(100vw - 16px);opacity:1!important;overflow:visible;padding:0;position:fixed;top:0;--sp-overlay-open:true}.dialog:not([is-visible]){display:none}.dialog:focus{outline:none}dialog:modal{--mod-popover-filter:var(--spectrum-popover-filter)}:host(:not([open])) .dialog{--sp-overlay-open:false}.dialog::backdrop{display:none}.dialog:before{content:\"\";inset:-999em;pointer-events:auto!important;position:absolute}.dialog:not(.not-immediately-closable):before{display:none}.dialog>div{width:100%}::slotted(*){pointer-events:auto;visibility:visible!important}::slotted(sp-popover){position:static}.dialog:not([actual-placement])[placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}slot[name=longpress-describedby-descriptor]{display:none}@supports selector(:open){.dialog{opacity:0}.dialog:open{opacity:1;--mod-popover-filter:var(--spectrum-popover-filter)}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{opacity:1;--mod-popover-filter:var(--spectrum-popover-filter)}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:calc(var(--swc-overlay-z-index-base, 1000) + var(--swc-overlay-open-count))}}\n`;\nexport default styles;"],
5
5
  "mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAKf,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";import{css as a}from"@spectrum-web-components/base";const o=a`
2
- :host{--swc-overlay-animation-distance:var(
2
+ :host{display:contents;pointer-events:none;--swc-overlay-animation-distance:var(
3
3
  --spectrum-picker-m-texticon-popover-offset-y,var(--spectrum-global-dimension-size-75)
4
- );display:contents;pointer-events:none}.dialog{--sp-overlay-open:true;background:none;border:0;box-sizing:border-box;display:flex;height:auto;inset:auto;left:0;margin:0;max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);max-width:calc(100vw - 16px);opacity:1!important;overflow:visible;padding:0;position:fixed;top:0}.dialog:not([is-visible]){display:none}.dialog:focus{outline:none}dialog:modal{--mod-popover-filter:var(--spectrum-popover-filter)}:host(:not([open])) .dialog{--sp-overlay-open:false}.dialog::backdrop{display:none}.dialog:before{content:"";inset:-999em;pointer-events:auto!important;position:absolute}.dialog:not(.not-immediately-closable):before{display:none}.dialog>div{width:100%}::slotted(*){pointer-events:auto;visibility:visible!important}::slotted(sp-popover){position:static}.dialog:not([actual-placement])[placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}slot[name=longpress-describedby-descriptor]{display:none}@supports selector(:open){.dialog{opacity:0}.dialog:open{--mod-popover-filter:var(--spectrum-popover-filter);opacity:1}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{--mod-popover-filter:var(--spectrum-popover-filter);opacity:1}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:calc(var(--swc-overlay-z-index-base, 1000) + var(--swc-overlay-open-count))}}
4
+ )}.dialog{background:none;border:0;box-sizing:border-box;display:flex;height:auto;inset:auto;left:0;margin:0;max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);max-width:calc(100vw - 16px);opacity:1!important;overflow:visible;padding:0;position:fixed;top:0;--sp-overlay-open:true}.dialog:not([is-visible]){display:none}.dialog:focus{outline:none}dialog:modal{--mod-popover-filter:var(--spectrum-popover-filter)}:host(:not([open])) .dialog{--sp-overlay-open:false}.dialog::backdrop{display:none}.dialog:before{content:"";inset:-999em;pointer-events:auto!important;position:absolute}.dialog:not(.not-immediately-closable):before{display:none}.dialog>div{width:100%}::slotted(*){pointer-events:auto;visibility:visible!important}::slotted(sp-popover){position:static}.dialog:not([actual-placement])[placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}slot[name=longpress-describedby-descriptor]{display:none}@supports selector(:open){.dialog{opacity:0}.dialog:open{opacity:1;--mod-popover-filter:var(--spectrum-popover-filter)}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{opacity:1;--mod-popover-filter:var(--spectrum-popover-filter)}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:calc(var(--swc-overlay-z-index-base, 1000) + var(--swc-overlay-open-count))}}
5
5
  `;export default o;
6
6
  //# sourceMappingURL=overlay.css.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["overlay.css.ts"],
4
- "sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--swc-overlay-animation-distance:var(\n--spectrum-picker-m-texticon-popover-offset-y,var(--spectrum-global-dimension-size-75)\n);display:contents;pointer-events:none}.dialog{--sp-overlay-open:true;background:none;border:0;box-sizing:border-box;display:flex;height:auto;inset:auto;left:0;margin:0;max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);max-width:calc(100vw - 16px);opacity:1!important;overflow:visible;padding:0;position:fixed;top:0}.dialog:not([is-visible]){display:none}.dialog:focus{outline:none}dialog:modal{--mod-popover-filter:var(--spectrum-popover-filter)}:host(:not([open])) .dialog{--sp-overlay-open:false}.dialog::backdrop{display:none}.dialog:before{content:\"\";inset:-999em;pointer-events:auto!important;position:absolute}.dialog:not(.not-immediately-closable):before{display:none}.dialog>div{width:100%}::slotted(*){pointer-events:auto;visibility:visible!important}::slotted(sp-popover){position:static}.dialog:not([actual-placement])[placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}slot[name=longpress-describedby-descriptor]{display:none}@supports selector(:open){.dialog{opacity:0}.dialog:open{--mod-popover-filter:var(--spectrum-popover-filter);opacity:1}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{--mod-popover-filter:var(--spectrum-popover-filter);opacity:1}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:calc(var(--swc-overlay-z-index-base, 1000) + var(--swc-overlay-open-count))}}\n`;\nexport default styles;"],
4
+ "sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{display:contents;pointer-events:none;--swc-overlay-animation-distance:var(\n--spectrum-picker-m-texticon-popover-offset-y,var(--spectrum-global-dimension-size-75)\n)}.dialog{background:none;border:0;box-sizing:border-box;display:flex;height:auto;inset:auto;left:0;margin:0;max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);max-width:calc(100vw - 16px);opacity:1!important;overflow:visible;padding:0;position:fixed;top:0;--sp-overlay-open:true}.dialog:not([is-visible]){display:none}.dialog:focus{outline:none}dialog:modal{--mod-popover-filter:var(--spectrum-popover-filter)}:host(:not([open])) .dialog{--sp-overlay-open:false}.dialog::backdrop{display:none}.dialog:before{content:\"\";inset:-999em;pointer-events:auto!important;position:absolute}.dialog:not(.not-immediately-closable):before{display:none}.dialog>div{width:100%}::slotted(*){pointer-events:auto;visibility:visible!important}::slotted(sp-popover){position:static}.dialog:not([actual-placement])[placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}slot[name=longpress-describedby-descriptor]{display:none}@supports selector(:open){.dialog{opacity:0}.dialog:open{opacity:1;--mod-popover-filter:var(--spectrum-popover-filter)}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{opacity:1;--mod-popover-filter:var(--spectrum-popover-filter)}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:calc(var(--swc-overlay-z-index-base, 1000) + var(--swc-overlay-open-count))}}\n`;\nexport default styles;"],
5
5
  "mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA;AAAA;AAAA,EAKf,eAAeC",
6
6
  "names": ["css", "styles"]
7
7
  }
@@ -1,2 +0,0 @@
1
- import type { Middleware } from '@floating-ui/dom';
2
- export declare const topLayerOverTransforms: () => Middleware;
@@ -1,115 +0,0 @@
1
- "use strict";
2
- import {
3
- getContainingBlock,
4
- getWindow,
5
- isContainingBlock
6
- } from "@floating-ui/utils/dom";
7
- import { VirtualTrigger } from "./VirtualTrigger.dev.js";
8
- export const topLayerOverTransforms = () => ({
9
- name: "topLayer",
10
- async fn(middlewareArguments) {
11
- const {
12
- x,
13
- y,
14
- elements: { reference, floating }
15
- } = middlewareArguments;
16
- let onTopLayer = false;
17
- let topLayerIsFloating = false;
18
- let withinReference = false;
19
- const diffCoords = {
20
- x: 0,
21
- y: 0
22
- };
23
- try {
24
- onTopLayer = onTopLayer || floating.matches(":popover-open");
25
- } catch (error) {
26
- }
27
- try {
28
- onTopLayer = onTopLayer || floating.matches(":open");
29
- } catch (error) {
30
- }
31
- try {
32
- onTopLayer = onTopLayer || floating.matches(":modal");
33
- } catch (error) {
34
- }
35
- topLayerIsFloating = onTopLayer;
36
- const dialogAncestorQueryEvent = new Event("floating-ui-dialog-test", {
37
- composed: true,
38
- bubbles: true
39
- });
40
- floating.addEventListener(
41
- "floating-ui-dialog-test",
42
- (event) => {
43
- event.composedPath().forEach((el) => {
44
- withinReference = withinReference || el === reference;
45
- if (el === floating || el.localName !== "dialog")
46
- return;
47
- try {
48
- onTopLayer = onTopLayer || el.matches(":modal");
49
- } catch (error) {
50
- }
51
- });
52
- },
53
- { once: true }
54
- );
55
- floating.dispatchEvent(dialogAncestorQueryEvent);
56
- let overTransforms = false;
57
- if (!(reference instanceof VirtualTrigger)) {
58
- const root = withinReference ? reference : floating;
59
- const containingBlock = isContainingBlock(root) ? root : getContainingBlock(root);
60
- let css = {};
61
- if (containingBlock !== null && getWindow(containingBlock) !== containingBlock) {
62
- css = getComputedStyle(containingBlock);
63
- overTransforms = // the `transform` property
64
- css.transform !== "none" || // the `translate` property
65
- css.translate !== "none" || // the `containerType` property
66
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
67
- // @ts-ignore
68
- (css.containerType ? (
69
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
70
- // @ts-ignore
71
- css.containerType !== "normal"
72
- ) : false) || // the `backdropFilter` property
73
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
74
- // @ts-ignore
75
- (css.backdropFilter ? (
76
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
77
- // @ts-ignore
78
- css.backdropFilter !== "none"
79
- ) : false) || // the `filter` property for anything other than "none"
80
- (css.filter ? css.filter !== "none" : false) || // the `transform` property "will-change"
81
- css.willChange.search("transform") > -1 || // the `transform` property "will-change"
82
- css.willChange.search("translate") > -1 || // a value of "paint", "layout", "strict", or "content" for `contain`
83
- ["paint", "layout", "strict", "content"].some(
84
- (value) => (css.contain || "").includes(value)
85
- );
86
- }
87
- if (onTopLayer && overTransforms && containingBlock) {
88
- const rect = containingBlock.getBoundingClientRect();
89
- const { marginInlineStart = "0", marginBlockStart = "0" } = css;
90
- diffCoords.x = rect.x + parseFloat(marginInlineStart);
91
- diffCoords.y = rect.y + parseFloat(marginBlockStart);
92
- }
93
- }
94
- if (onTopLayer && topLayerIsFloating) {
95
- return {
96
- x: x + diffCoords.x,
97
- y: y + diffCoords.y,
98
- data: diffCoords
99
- };
100
- }
101
- if (onTopLayer) {
102
- return {
103
- x,
104
- y,
105
- data: diffCoords
106
- };
107
- }
108
- return {
109
- x: x - diffCoords.x,
110
- y: y - diffCoords.y,
111
- data: diffCoords
112
- };
113
- }
114
- });
115
- //# sourceMappingURL=topLayerOverTransforms.dev.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["topLayerOverTransforms.ts"],
4
- "sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport type { Middleware, MiddlewareState } from '@floating-ui/dom';\nimport {\n getContainingBlock,\n getWindow,\n isContainingBlock,\n} from '@floating-ui/utils/dom';\nimport { VirtualTrigger } from './VirtualTrigger.dev.js'\n\nexport const topLayerOverTransforms = (): Middleware => ({\n name: 'topLayer',\n async fn(middlewareArguments: MiddlewareState) {\n const {\n x,\n y,\n elements: { reference, floating },\n } = middlewareArguments;\n let onTopLayer = false;\n let topLayerIsFloating = false;\n let withinReference = false;\n const diffCoords = {\n x: 0,\n y: 0,\n };\n try {\n onTopLayer = onTopLayer || floating.matches(':popover-open');\n // eslint-disable-next-line no-empty\n } catch (error) {}\n try {\n onTopLayer = onTopLayer || floating.matches(':open');\n // eslint-disable-next-line no-empty\n } catch (error) {}\n try {\n onTopLayer = onTopLayer || floating.matches(':modal');\n // eslint-disable-next-line no-empty\n /* c8 ignore next 3 */\n } catch (error) {}\n topLayerIsFloating = onTopLayer;\n const dialogAncestorQueryEvent = new Event('floating-ui-dialog-test', {\n composed: true,\n bubbles: true,\n });\n floating.addEventListener(\n 'floating-ui-dialog-test',\n (event: Event) => {\n (event.composedPath() as unknown as Element[]).forEach((el) => {\n withinReference = withinReference || el === reference;\n if (el === floating || el.localName !== 'dialog') return;\n try {\n onTopLayer = onTopLayer || el.matches(':modal');\n // eslint-disable-next-line no-empty\n /* c8 ignore next */\n } catch (error) {}\n });\n },\n { once: true }\n );\n floating.dispatchEvent(dialogAncestorQueryEvent);\n let overTransforms = false;\n if (!(reference instanceof VirtualTrigger)) {\n const root = (withinReference ? reference : floating) as Element;\n const containingBlock = isContainingBlock(root)\n ? root\n : getContainingBlock(root);\n let css: CSSStyleDeclaration | Record<string, string> = {};\n if (\n containingBlock !== null &&\n getWindow(containingBlock) !==\n (containingBlock as unknown as Window)\n ) {\n css = getComputedStyle(containingBlock);\n // The overlay is \"over transforms\" when the containing block uses specific CSS...\n overTransforms =\n // the `transform` property\n css.transform !== 'none' ||\n // the `translate` property\n css.translate !== 'none' ||\n // the `containerType` property\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n (css.containerType\n ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n css.containerType !== 'normal'\n : false) ||\n // the `backdropFilter` property\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n (css.backdropFilter\n ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n css.backdropFilter !== 'none'\n : false) ||\n // the `filter` property for anything other than \"none\"\n (css.filter ? css.filter !== 'none' : false) ||\n // the `transform` property \"will-change\"\n css.willChange.search('transform') > -1 ||\n // the `transform` property \"will-change\"\n css.willChange.search('translate') > -1 ||\n // a value of \"paint\", \"layout\", \"strict\", or \"content\" for `contain`\n ['paint', 'layout', 'strict', 'content'].some((value) =>\n (css.contain || '').includes(value)\n );\n }\n\n if (onTopLayer && overTransforms && containingBlock) {\n const rect = containingBlock.getBoundingClientRect();\n // Margins are not included in the bounding client rect and need to be handled separately.\n const { marginInlineStart = '0', marginBlockStart = '0' } = css;\n diffCoords.x = rect.x + parseFloat(marginInlineStart);\n diffCoords.y = rect.y + parseFloat(marginBlockStart);\n }\n }\n\n if (onTopLayer && topLayerIsFloating) {\n return {\n x: x + diffCoords.x,\n y: y + diffCoords.y,\n data: diffCoords,\n };\n }\n\n if (onTopLayer) {\n return {\n x,\n y,\n data: diffCoords,\n };\n }\n\n return {\n x: x - diffCoords.x,\n y: y - diffCoords.y,\n data: diffCoords,\n };\n },\n});\n"],
5
- "mappings": ";AAYA;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,sBAAsB;AAExB,aAAM,yBAAyB,OAAmB;AAAA,EACrD,MAAM;AAAA,EACN,MAAM,GAAG,qBAAsC;AAC3C,UAAM;AAAA,MACF;AAAA,MACA;AAAA,MACA,UAAU,EAAE,WAAW,SAAS;AAAA,IACpC,IAAI;AACJ,QAAI,aAAa;AACjB,QAAI,qBAAqB;AACzB,QAAI,kBAAkB;AACtB,UAAM,aAAa;AAAA,MACf,GAAG;AAAA,MACH,GAAG;AAAA,IACP;AACA,QAAI;AACA,mBAAa,cAAc,SAAS,QAAQ,eAAe;AAAA,IAE/D,SAAS,OAAO;AAAA,IAAC;AACjB,QAAI;AACA,mBAAa,cAAc,SAAS,QAAQ,OAAO;AAAA,IAEvD,SAAS,OAAO;AAAA,IAAC;AACjB,QAAI;AACA,mBAAa,cAAc,SAAS,QAAQ,QAAQ;AAAA,IAGxD,SAAS,OAAO;AAAA,IAAC;AACjB,yBAAqB;AACrB,UAAM,2BAA2B,IAAI,MAAM,2BAA2B;AAAA,MAClE,UAAU;AAAA,MACV,SAAS;AAAA,IACb,CAAC;AACD,aAAS;AAAA,MACL;AAAA,MACA,CAAC,UAAiB;AACd,QAAC,MAAM,aAAa,EAA2B,QAAQ,CAAC,OAAO;AAC3D,4BAAkB,mBAAmB,OAAO;AAC5C,cAAI,OAAO,YAAY,GAAG,cAAc;AAAU;AAClD,cAAI;AACA,yBAAa,cAAc,GAAG,QAAQ,QAAQ;AAAA,UAGlD,SAAS,OAAO;AAAA,UAAC;AAAA,QACrB,CAAC;AAAA,MACL;AAAA,MACA,EAAE,MAAM,KAAK;AAAA,IACjB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;AAAA,MACH,GAAG,IAAI,WAAW;AAAA,MAClB,GAAG,IAAI,WAAW;AAAA,MAClB,MAAM;AAAA,IACV;AAAA,EACJ;AACJ;",
6
- "names": []
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";import{getContainingBlock as h,getWindow as w,isContainingBlock as x}from"@floating-ui/utils/dom";import{VirtualTrigger as k}from"./VirtualTrigger.js";export const topLayerOverTransforms=()=>({name:"topLayer",async fn(g){const{x:l,y:s,elements:{reference:c,floating:o}}=g;let t=!1,f=!1,d=!1;const a={x:0,y:0};try{t=t||o.matches(":popover-open")}catch(r){}try{t=t||o.matches(":open")}catch(r){}try{t=t||o.matches(":modal")}catch(r){}f=t;const p=new Event("floating-ui-dialog-test",{composed:!0,bubbles:!0});o.addEventListener("floating-ui-dialog-test",r=>{r.composedPath().forEach(n=>{if(d=d||n===c,!(n===o||n.localName!=="dialog"))try{t=t||n.matches(":modal")}catch(e){}})},{once:!0}),o.dispatchEvent(p);let m=!1;if(!(c instanceof k)){const r=d?c:o,n=x(r)?r:h(r);let e={};if(n!==null&&w(n)!==n&&(e=getComputedStyle(n),m=e.transform!=="none"||e.translate!=="none"||(e.containerType?e.containerType!=="normal":!1)||(e.backdropFilter?e.backdropFilter!=="none":!1)||(e.filter?e.filter!=="none":!1)||e.willChange.search("transform")>-1||e.willChange.search("translate")>-1||["paint","layout","strict","content"].some(i=>(e.contain||"").includes(i))),t&&m&&n){const i=n.getBoundingClientRect(),{marginInlineStart:y="0",marginBlockStart:u="0"}=e;a.x=i.x+parseFloat(y),a.y=i.y+parseFloat(u)}}return t&&f?{x:l+a.x,y:s+a.y,data:a}:t?{x:l,y:s,data:a}:{x:l-a.x,y:s-a.y,data:a}}});
2
- //# sourceMappingURL=topLayerOverTransforms.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["topLayerOverTransforms.ts"],
4
- "sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport type { Middleware, MiddlewareState } from '@floating-ui/dom';\nimport {\n getContainingBlock,\n getWindow,\n isContainingBlock,\n} from '@floating-ui/utils/dom';\nimport { VirtualTrigger } from './VirtualTrigger.js';\n\nexport const topLayerOverTransforms = (): Middleware => ({\n name: 'topLayer',\n async fn(middlewareArguments: MiddlewareState) {\n const {\n x,\n y,\n elements: { reference, floating },\n } = middlewareArguments;\n let onTopLayer = false;\n let topLayerIsFloating = false;\n let withinReference = false;\n const diffCoords = {\n x: 0,\n y: 0,\n };\n try {\n onTopLayer = onTopLayer || floating.matches(':popover-open');\n // eslint-disable-next-line no-empty\n } catch (error) {}\n try {\n onTopLayer = onTopLayer || floating.matches(':open');\n // eslint-disable-next-line no-empty\n } catch (error) {}\n try {\n onTopLayer = onTopLayer || floating.matches(':modal');\n // eslint-disable-next-line no-empty\n /* c8 ignore next 3 */\n } catch (error) {}\n topLayerIsFloating = onTopLayer;\n const dialogAncestorQueryEvent = new Event('floating-ui-dialog-test', {\n composed: true,\n bubbles: true,\n });\n floating.addEventListener(\n 'floating-ui-dialog-test',\n (event: Event) => {\n (event.composedPath() as unknown as Element[]).forEach((el) => {\n withinReference = withinReference || el === reference;\n if (el === floating || el.localName !== 'dialog') return;\n try {\n onTopLayer = onTopLayer || el.matches(':modal');\n // eslint-disable-next-line no-empty\n /* c8 ignore next */\n } catch (error) {}\n });\n },\n { once: true }\n );\n floating.dispatchEvent(dialogAncestorQueryEvent);\n let overTransforms = false;\n if (!(reference instanceof VirtualTrigger)) {\n const root = (withinReference ? reference : floating) as Element;\n const containingBlock = isContainingBlock(root)\n ? root\n : getContainingBlock(root);\n let css: CSSStyleDeclaration | Record<string, string> = {};\n if (\n containingBlock !== null &&\n getWindow(containingBlock) !==\n (containingBlock as unknown as Window)\n ) {\n css = getComputedStyle(containingBlock);\n // The overlay is \"over transforms\" when the containing block uses specific CSS...\n overTransforms =\n // the `transform` property\n css.transform !== 'none' ||\n // the `translate` property\n css.translate !== 'none' ||\n // the `containerType` property\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n (css.containerType\n ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n css.containerType !== 'normal'\n : false) ||\n // the `backdropFilter` property\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n (css.backdropFilter\n ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n css.backdropFilter !== 'none'\n : false) ||\n // the `filter` property for anything other than \"none\"\n (css.filter ? css.filter !== 'none' : false) ||\n // the `transform` property \"will-change\"\n css.willChange.search('transform') > -1 ||\n // the `transform` property \"will-change\"\n css.willChange.search('translate') > -1 ||\n // a value of \"paint\", \"layout\", \"strict\", or \"content\" for `contain`\n ['paint', 'layout', 'strict', 'content'].some((value) =>\n (css.contain || '').includes(value)\n );\n }\n\n if (onTopLayer && overTransforms && containingBlock) {\n const rect = containingBlock.getBoundingClientRect();\n // Margins are not included in the bounding client rect and need to be handled separately.\n const { marginInlineStart = '0', marginBlockStart = '0' } = css;\n diffCoords.x = rect.x + parseFloat(marginInlineStart);\n diffCoords.y = rect.y + parseFloat(marginBlockStart);\n }\n }\n\n if (onTopLayer && topLayerIsFloating) {\n return {\n x: x + diffCoords.x,\n y: y + diffCoords.y,\n data: diffCoords,\n };\n }\n\n if (onTopLayer) {\n return {\n x,\n y,\n data: diffCoords,\n };\n }\n\n return {\n x: x - diffCoords.x,\n y: y - diffCoords.y,\n data: diffCoords,\n };\n },\n});\n"],
5
- "mappings": "aAYA,OACI,sBAAAA,EACA,aAAAC,EACA,qBAAAC,MACG,yBACP,OA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AI,gBAAkB,SACtB,MAILA,EAAI,eAGCA,EAAI,iBAAmB,OACvB,MAELA,EAAI,OAASA,EAAI,SAAW,OAAS,KAEtCA,EAAI,WAAW,OAAO,WAAW,EAAI,IAErCA,EAAI,WAAW,OAAO,WAAW,EAAI,IAErC,CAAC,QAAS,SAAU,SAAU,SAAS,EAAE,KAAMC,IAC1CD,EAAI,SAAW,IAAI,SAASC,CAAK,CACtC,GAGJZ,GAAcQ,GAAkBE,EAAiB,CACjD,MAAMG,EAAOH,EAAgB,sBAAsB,EAE7C,CAAE,kBAAAI,EAAoB,IAAK,iBAAAC,EAAmB,GAAI,EAAIJ,EAC5DR,EAAW,EAAIU,EAAK,EAAI,WAAWC,CAAiB,EACpDX,EAAW,EAAIU,EAAK,EAAI,WAAWE,CAAgB,CACvD,CACJ,CAEA,OAAIf,GAAcC,EACP,CACH,EAAGL,EAAIO,EAAW,EAClB,EAAGN,EAAIM,EAAW,EAClB,KAAMA,CACV,EAGAH,EACO,CACH,EAAAJ,EACA,EAAAC,EACA,KAAMM,CACV,EAGG,CACH,EAAGP,EAAIO,EAAW,EAClB,EAAGN,EAAIM,EAAW,EAClB,KAAMA,CACV,CACJ,CACJ",
6
- "names": ["getContainingBlock", "getWindow", "isContainingBlock", "VirtualTrigger", "middlewareArguments", "x", "y", "reference", "floating", "onTopLayer", "topLayerIsFloating", "withinReference", "diffCoords", "error", "dialogAncestorQueryEvent", "event", "el", "overTransforms", "root", "containingBlock", "css", "value", "rect", "marginInlineStart", "marginBlockStart"]
7
- }