@spectrum-web-components/overlay 0.33.3-overlay.61 → 0.33.3-overlay.65

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": ["OverlayBase.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 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 { Placement } from '@floating-ui/dom';\nimport {\n html,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n queryAssignedElements,\n state,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport {\n isAndroid,\n isIOS,\n} from '@spectrum-web-components/shared/src/platform.js';\nimport { conditionAttributeWithId } from '@spectrum-web-components/base/src/condition-attribute-with-id.js';\nimport {\n ElementResolutionController,\n elementResolverUpdatedSymbol,\n} from '@spectrum-web-components/reactive-controllers/src/ElementResolution.js';\nimport { VirtualTrigger } from './VirtualTrigger.js';\nimport {\n ifDefined,\n styleMap,\n} from '@spectrum-web-components/base/src/directives.js';\nimport styles from './overlay-base.css.js';\nimport { overlayStack } from './OverlayStack.js';\nimport { PlacementController } from './PlacementController.js';\nimport { OverlayTypes } from './overlay-types.js';\nimport { OverlayTimer } from './overlay-timer.js';\n\nexport const overlayTimer = new OverlayTimer();\n\nexport type OpenableElement = HTMLElement & {\n open: boolean;\n tipElement?: HTMLElement;\n updateComplete?: Promise<void>;\n};\n\nconst LONGPRESS_DURATION = 300;\n\nexport type LongpressEvent = {\n source: 'pointer' | 'keyboard';\n};\n\nexport const LONGPRESS_INSTRUCTIONS = {\n touch: 'Double tap and long press for additional options',\n keyboard: 'Press Space or Alt+Down Arrow for additional options',\n mouse: 'Click and hold for additional options',\n};\n\nexport class BeforetoggleClosedEvent extends Event {\n currentState = 'open';\n newState = 'closed';\n constructor() {\n super('beforetoggle', {\n bubbles: false,\n composed: false,\n });\n }\n}\n\nexport class BeforetoggleOpenEvent extends Event {\n currentState = 'closed';\n newState = 'open';\n constructor() {\n super('beforetoggle', {\n bubbles: false,\n composed: false,\n });\n }\n}\n\nexport const noop = (): void => {\n return;\n};\n\n/**\n * Apply a \"transitionend\" listener to an element that may not transition but\n * guarantee the callback will be fired either way.\n *\n * @param el {HTMLElement} - Target of the \"transition\" listeners.\n * @param action {Function} - Method to trigger the \"transition\".\n * @param cb {Function} - Callback to trigger when the \"transition\" has ended.\n */\nexport const guaranteedTransitionend = (\n el: HTMLElement,\n action: () => void,\n cb: () => void\n): void => {\n const cleanup = (): void => {\n el.removeEventListener('transitionrun', handleTransitionrun);\n el.removeEventListener('transitionend', handleTransitionend);\n cb();\n };\n let guarantee2: number;\n let guarantee3: number;\n // WebKit fires `transitionrun` a little earlier, so the inner/outer relationship\n // here allows WebKit to be caught, but doesn't remove the animation listener until\n // after it would have fired in Chromium.\n const guarantee1 = requestAnimationFrame(() => {\n guarantee2 = requestAnimationFrame(() => {\n guarantee3 = requestAnimationFrame(() => {\n cleanup();\n });\n });\n });\n const handleTransitionend = (event: TransitionEvent): void => {\n if (event.propertyName === 'visibility') {\n // Ignore \"visibility\" transitions because they often happen before/after a\n // larger transition and don't represent the overall transition duration.\n return;\n }\n cleanup();\n };\n const handleTransitionrun = (event: TransitionEvent): void => {\n if (event.propertyName === 'visibility') {\n // Ignore \"visibility\" transitions because they often happen before/after a\n // larger transition and don't represent the overall transition duration.\n return;\n }\n cancelAnimationFrame(guarantee1);\n cancelAnimationFrame(guarantee2);\n cancelAnimationFrame(guarantee3);\n el.removeEventListener('transitionrun', handleTransitionrun);\n el.addEventListener('transitionend', handleTransitionend);\n };\n el.addEventListener('transitionrun', handleTransitionrun);\n action();\n};\n\nexport class OverlayBase extends SpectrumElement {\n static override styles = [styles];\n\n @property({ type: Boolean })\n delayed = false;\n\n @query('.dialog')\n dialogEl!: HTMLDialogElement & {\n showPopover(): void;\n hidePopover(): void;\n };\n\n @property({ type: Boolean })\n get disabled(): boolean {\n return this._disabled;\n }\n\n set disabled(disabled: boolean) {\n this._disabled = disabled;\n if (disabled) {\n if (this.hasNonVirtualTrigger) {\n this.unbindEvents(this.triggerElement as HTMLElement);\n }\n this.wasOpen = this.open;\n this.open = false;\n } else {\n this.bindEvents();\n this.open = this.open || this.wasOpen;\n this.wasOpen = false;\n }\n }\n\n private _disabled = false;\n\n protected dispose = noop;\n\n @queryAssignedElements({\n selector: ':not([slot=\"longpress-describedby-descriptor\"])',\n flatten: true,\n })\n elements!: OpenableElement[];\n\n public parentOverlayToForceClose?: OverlayBase;\n\n private get hasNonVirtualTrigger(): boolean {\n return (\n !!this.triggerElement &&\n !(this.triggerElement instanceof VirtualTrigger)\n );\n }\n\n protected longpressed = false;\n\n private longressTimeout!: ReturnType<typeof setTimeout>;\n\n @property()\n offset: number | [number, number] = 6;\n\n public placementController = new PlacementController(this);\n\n @property({ type: Boolean, reflect: true })\n get open(): boolean {\n return this._open;\n }\n\n set open(open: boolean) {\n if (open && this.disabled) return;\n if (open === this.open) return;\n this._open = open;\n this.requestUpdate('open', !this.open);\n }\n\n private _open = false;\n\n static openCount = 1;\n\n @property()\n placement?: Placement;\n\n @property({ attribute: 'receives-focus' })\n receivesFocus: 'true' | 'false' | 'auto' = 'auto';\n\n private releaseAriaDescribedby = noop;\n private releaseLongpressDescribedby = noop;\n\n @query('slot')\n slotEl!: HTMLSlotElement;\n\n @property()\n trigger?: string;\n\n @state()\n triggerElement: HTMLElement | VirtualTrigger | null = null;\n\n @state()\n triggerInteraction?: 'click' | 'longpress' | 'hover';\n\n @property()\n type: OverlayTypes = 'hint';\n\n protected wasOpen = false;\n\n private elementResolver = new ElementResolutionController(this);\n\n private get usesDialog(): boolean {\n return this.type === 'modal' || this.type === 'page';\n }\n\n private get popoverValue(): 'auto' | 'manual' | undefined {\n switch (this.type) {\n case 'modal':\n case 'page':\n return undefined;\n case 'hint':\n return 'manual';\n default:\n return this.type;\n }\n }\n\n /* c8 ignore next 12 */\n protected async manageDialogOpen(): Promise<void> {\n console.warn(\n 'Implement the `manageDialogOpen` method in a class extension.'\n );\n }\n\n protected async managePopoverOpen(): Promise<void> {\n console.warn(\n 'Implement the `managePopoverOpen` method in a class extension.'\n );\n }\n\n protected get requiresPosition(): boolean {\n // Do no position \"page\" overlays as they should block the entrie UI.\n if (this.type === 'page' || !this.open) return false;\n // Do not position content without a trigger element, what would you position it in relation to?\n // Do not automaticallyu position contnent, unless it is a \"hint\".\n if (!this.triggerElement || (!this.placement && this.type !== 'hint'))\n return false;\n return true;\n }\n\n protected managePosition(): void {\n if (!this.requiresPosition || !this.open) return;\n\n const offset = this.offset || 0;\n const trigger = this.triggerElement as HTMLElement;\n const placement = (this.placement as Placement) || 'right';\n\n this.placementController.placeOverlay(this.dialogEl, {\n // delayed?: boolean,\n offset,\n placement,\n // notImmediatelyClosable?: boolean, // rename or place behind other API options\n // receivesFocus?: 'auto';\n // root?: HTMLElement;\n trigger,\n type: this.type,\n });\n }\n\n protected async manageOpen(oldOpen: boolean): Promise<void> {\n if (!this.isConnected && this.open) return;\n\n if (!this.hasUpdated) {\n await this.updateComplete;\n }\n\n if (this.open) {\n overlayStack.add(this);\n } else {\n if (oldOpen) {\n this.dispose();\n }\n overlayStack.remove(this);\n }\n\n if (this.usesDialog) {\n this.manageDialogOpen();\n } else {\n this.managePopoverOpen();\n }\n if (this.open) {\n OverlayBase.openCount += 1;\n } else {\n // If the focus remains inside of the overlay or\n // a slotted descendent of the overlay you need to return\n // focus back to the trigger.\n const getAncestors = (): HTMLElement[] => {\n const ancestors: HTMLElement[] = [];\n // eslint-disable-next-line @spectrum-web-components/document-active-element\n let currentNode = document.activeElement;\n while (\n currentNode?.shadowRoot &&\n currentNode.shadowRoot.activeElement\n ) {\n currentNode = currentNode.shadowRoot.activeElement;\n }\n while (currentNode) {\n const ancestor =\n currentNode.assignedSlot ||\n currentNode.parentElement ||\n (currentNode.getRootNode() as ShadowRoot)?.host;\n if (ancestor) {\n ancestors.push(ancestor as HTMLElement);\n }\n currentNode = ancestor;\n }\n return ancestors;\n };\n if (\n (this.triggerElement as HTMLElement)?.focus &&\n (this.contains(\n (this.getRootNode() as Document).activeElement\n ) ||\n !!getAncestors().find((el) => el === this))\n ) {\n (this.triggerElement as HTMLElement).focus();\n }\n }\n }\n\n protected unbindEvents(triggerElement: HTMLElement): void {\n triggerElement.removeEventListener('click', this.handleClick);\n triggerElement.removeEventListener(\n 'pointerdown',\n this.handlePointerdownForClick\n );\n triggerElement.removeEventListener('focusin', this.handleFocusin);\n triggerElement.removeEventListener('focusout', this.handleFocusout);\n triggerElement.removeEventListener(\n 'pointerenter',\n this.handlePointerenter\n );\n triggerElement.removeEventListener(\n 'pointerleave',\n this.handlePointerleave\n );\n this.removeEventListener(\n 'pointerleave',\n this.handleOverlayPointerleave\n );\n triggerElement.addEventListener('pointerdown', this.handlePointerdown);\n triggerElement.removeEventListener('keydown', this.handleKeydown);\n triggerElement.removeEventListener('keyup', this.handleKeyup);\n triggerElement.removeEventListener('longpress', this.handleLongpress);\n }\n\n protected bindEvents(): void {\n const nextTriggerElement = this.triggerElement as HTMLElement;\n if (!nextTriggerElement) return;\n switch (this.triggerInteraction) {\n case 'click':\n this.bindClickEvents(nextTriggerElement);\n return;\n case 'longpress':\n this.bindLongpressEvents(nextTriggerElement);\n return;\n case 'hover':\n this.bindHoverEvents(nextTriggerElement);\n return;\n }\n }\n\n protected bindClickEvents(triggerElement: HTMLElement): void {\n triggerElement.addEventListener('click', this.handleClick);\n triggerElement.addEventListener(\n 'pointerdown',\n this.handlePointerdownForClick\n );\n }\n\n protected bindLongpressEvents(triggerElement: HTMLElement): void {\n triggerElement.addEventListener('pointerdown', this.handlePointerdown);\n triggerElement.addEventListener('keydown', this.handleKeydown);\n triggerElement.addEventListener('keyup', this.handleKeyup);\n triggerElement.addEventListener('longpress', this.handleLongpress);\n\n this.prepareLongpressDescription(triggerElement);\n }\n\n protected bindHoverEvents(triggerElement: HTMLElement): void {\n triggerElement.addEventListener('focusin', this.handleFocusin);\n triggerElement.addEventListener('focusout', this.handleFocusout);\n triggerElement.addEventListener(\n 'pointerenter',\n this.handlePointerenter\n );\n triggerElement.addEventListener(\n 'pointerleave',\n this.handlePointerleave\n );\n this.addEventListener('pointerleave', this.handleOverlayPointerleave);\n if (this.receivesFocus === 'true') return;\n\n this.prepareAriaDescribedby(triggerElement);\n }\n\n protected manageTriggerElement(triggerElement: HTMLElement | null): void {\n if (triggerElement) {\n this.unbindEvents(triggerElement);\n this.releaseAriaDescribedby();\n }\n if (\n !this.triggerElement ||\n !!(this.triggerElement as VirtualTrigger).updateBoundingClientRect\n ) {\n return;\n }\n this.bindEvents();\n }\n\n private elementIds: string[] = [];\n\n private prepareLongpressDescription(trigger: HTMLElement): void {\n if (\n // only \"longpress\" relationships are described this way\n this.triggerInteraction !== 'longpress' ||\n // do not reapply until target it recycled\n this.releaseLongpressDescribedby !== noop ||\n // require \"longpress content\" to apply relationship\n !this.elements.length\n ) {\n return;\n }\n\n const longpressDescription = document.createElement('div');\n longpressDescription.id = `longpress-describedby-descriptor-${crypto\n .randomUUID()\n .slice(0, 8)}`;\n const messageType = isIOS() || isAndroid() ? 'touch' : 'keyboard';\n longpressDescription.textContent = LONGPRESS_INSTRUCTIONS[messageType];\n longpressDescription.slot = 'longpress-describedby-descriptor';\n trigger.insertAdjacentElement('afterend', longpressDescription);\n\n const releaseLongpressDescribedby = conditionAttributeWithId(\n trigger,\n 'aria-describedby',\n [longpressDescription.id]\n );\n this.releaseLongpressDescribedby = () => {\n releaseLongpressDescribedby();\n longpressDescription.remove();\n this.releaseLongpressDescribedby = noop;\n };\n }\n\n private prepareAriaDescribedby(trigger: HTMLElement): void {\n if (\n // only \"hover\" relationships establed described by content\n this.triggerInteraction !== 'hover' ||\n // do not reapply until target is recycled\n this.releaseAriaDescribedby !== noop ||\n // require \"hover content\" to apply relationship\n !this.elements.length\n ) {\n return;\n }\n\n const triggerRoot = trigger.getRootNode();\n const contentRoot = this.elements[0].getRootNode();\n const overlayRoot = this.getRootNode();\n if (triggerRoot == overlayRoot) {\n const releaseAriaDescribedby = conditionAttributeWithId(\n trigger,\n 'aria-describedby',\n [this.id]\n );\n this.releaseAriaDescribedby = () => {\n releaseAriaDescribedby();\n this.releaseAriaDescribedby = noop;\n };\n } else if (triggerRoot === contentRoot) {\n this.elementIds = this.elements.map((el) => el.id);\n const appliedIds = this.elements.map((el) => {\n if (!el.id) {\n el.id = `${this.tagName.toLowerCase()}-helper-${crypto\n .randomUUID()\n .slice(0, 8)}`;\n }\n return el.id;\n });\n const releaseAriaDescribedby = conditionAttributeWithId(\n trigger,\n 'aria-describedby',\n appliedIds\n );\n this.releaseAriaDescribedby = () => {\n releaseAriaDescribedby();\n this.elements.map((el, index) => {\n el.id = this.elementIds[index];\n });\n this.releaseAriaDescribedby = noop;\n };\n }\n }\n\n private handlePointerdown = (event: PointerEvent): void => {\n if (!this.triggerElement) return;\n if (event.button !== 0) return;\n const triggerElement = this.triggerElement as HTMLElement;\n this.longpressed = false;\n triggerElement.addEventListener('pointerup', this.handlePointerup);\n triggerElement.addEventListener('pointercancel', this.handlePointerup);\n this.longressTimeout = setTimeout(() => {\n if (!triggerElement) return;\n triggerElement.dispatchEvent(\n new CustomEvent<LongpressEvent>('longpress', {\n bubbles: true,\n composed: true,\n detail: {\n source: 'pointer',\n },\n })\n );\n }, LONGPRESS_DURATION);\n };\n\n private handlePointerup = (): void => {\n clearTimeout(this.longressTimeout);\n if (!this.triggerElement) return;\n if (this.longpressed) {\n this.open = true;\n }\n setTimeout(() => {\n this.longpressed = false;\n });\n const triggerElement = this.triggerElement as HTMLElement;\n triggerElement.removeEventListener('pointerup', this.handlePointerup);\n triggerElement.removeEventListener(\n 'pointercancel',\n this.handlePointerup\n );\n };\n\n /**\n * @private\n */\n protected handleKeydown = (event: KeyboardEvent): void => {\n const { code, altKey } = event;\n if (code === 'Space' || (altKey && code === 'ArrowDown')) {\n if (code === 'ArrowDown') {\n event.stopPropagation();\n event.stopImmediatePropagation();\n }\n }\n };\n\n protected handleKeyup = (event: KeyboardEvent): void => {\n const { code, altKey } = event;\n if (code === 'Space' || (altKey && code === 'ArrowDown')) {\n event.stopPropagation();\n this.dispatchEvent(\n new CustomEvent<LongpressEvent>('longpress', {\n bubbles: true,\n composed: true,\n detail: {\n source: 'keyboard',\n },\n })\n );\n }\n };\n\n private preventNextToggle = false;\n\n protected handlePointerdownForClick = (): void => {\n this.preventNextToggle = this.open;\n };\n\n protected handleClick = (): void => {\n if (this.longpressed) return;\n if (!this.preventNextToggle) {\n this.open = !this.open;\n }\n this.preventNextToggle = false;\n };\n\n private focusedin = false;\n\n protected handleFocusin = (): void => {\n this.open = true;\n this.focusedin = true;\n };\n\n protected handleFocusout = (): void => {\n this.focusedin = false;\n if (this.pointerentered) return;\n this.open = false;\n };\n\n private pointerentered = false;\n\n protected handlePointerenter = (): void => {\n if (this.disabled) return;\n this.open = true;\n this.pointerentered = true;\n };\n\n protected handlePointerleave = (event: PointerEvent): void => {\n if (\n this === event.relatedTarget ||\n this.contains(event.relatedTarget as Node) ||\n [...this.children].find((child) => {\n if (child.localName !== 'slot') {\n return false;\n }\n return (child as HTMLSlotElement)\n .assignedElements({ flatten: true })\n .find((el) => {\n return (\n el === event.relatedTarget ||\n el.contains(event.relatedTarget as Node)\n );\n });\n })\n ) {\n return;\n }\n this.doPointerleave();\n };\n\n protected handleOverlayPointerleave = (event: PointerEvent): void => {\n if (\n this.triggerElement === event.relatedTarget ||\n (this.hasNonVirtualTrigger &&\n (this.triggerElement as HTMLElement).contains(\n event.relatedTarget as Node\n ))\n ) {\n return;\n }\n this.doPointerleave();\n };\n\n protected doPointerleave(): void {\n this.pointerentered = false;\n const triggerElement = this.triggerElement as HTMLElement;\n if (this.focusedin && triggerElement.matches(':focus-visible')) return;\n this.open = false;\n }\n\n protected handleLongpress = (): void => {\n this.open = true;\n this.longpressed = true;\n };\n\n protected handleBeforetoggle(event: Event & { newState: string }): void {\n if (event.newState !== 'open') {\n this.handleBrowserClose();\n }\n }\n\n protected handleBrowserClose(): void {\n this.open = false;\n }\n\n protected handleSlotchange(): void {\n if (this.triggerElement) {\n this.prepareAriaDescribedby(this.triggerElement as HTMLElement);\n }\n if (!this.elements.length) {\n this.releaseLongpressDescribedby();\n } else if (this.hasNonVirtualTrigger) {\n this.prepareLongpressDescription(\n this.triggerElement as HTMLElement\n );\n }\n }\n\n public willPreventClose = false;\n\n public shouldPreventClose(): boolean {\n const shouldPreventClose = this.willPreventClose;\n this.willPreventClose = false;\n return shouldPreventClose;\n }\n\n override willUpdate(changes: PropertyValues): void {\n if (!this.hasUpdated) {\n this.addEventListener('focusout', (event: FocusEvent) => {\n // Only \"auto\" popovers should close on any sort of focusout\n if (this.type !== 'auto') {\n return;\n }\n // If you don't know where the focus went, we can't do anyting here.\n if (!event.relatedTarget) {\n // this.open = false;\n return;\n }\n const relationEvent = new Event('overlay-relation-query', {\n bubbles: true,\n composed: true,\n });\n event.relatedTarget.addEventListener(\n relationEvent.type,\n (event: Event) => {\n if (!event.composedPath().includes(this)) {\n this.open = false;\n }\n }\n );\n event.relatedTarget.dispatchEvent(relationEvent);\n });\n }\n if (!this.hasAttribute('id')) {\n this.setAttribute(\n 'id',\n `${this.tagName.toLowerCase()}-${crypto\n .randomUUID()\n .slice(0, 8)}`\n );\n }\n if (\n changes.has('open') &&\n (typeof changes.get('open') !== 'undefined' || this.open)\n ) {\n this.manageOpen(changes.get('open'));\n }\n if (changes.has('trigger')) {\n const [id, interaction] = this.trigger?.split('@') || [];\n this.elementResolver.selector = id ? `#${id}` : '';\n this.triggerInteraction = interaction as\n | 'click'\n | 'longpress'\n | 'hover'\n | undefined;\n }\n const oldTrigger = this.triggerElement as HTMLElement;\n if (changes.has(elementResolverUpdatedSymbol)) {\n this.triggerElement = this.elementResolver.element;\n this.manageTriggerElement(oldTrigger);\n }\n if (changes.has('triggerElement')) {\n this.manageTriggerElement(changes.get('triggerElement'));\n }\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (changes.has('placement')) {\n if (this.placement) {\n this.dialogEl.setAttribute('actual-placement', this.placement);\n } else {\n this.dialogEl.removeAttribute('actual-placement');\n }\n if (this.open && typeof changes.get('placement') !== 'undefined') {\n this.placementController.resetOverlayPosition();\n }\n }\n }\n\n protected renderContent(): TemplateResult {\n return html`\n <div part=\"content\">\n <slot @slotchange=${this.handleSlotchange}></slot>\n </div>\n `;\n }\n\n protected renderDialog(): TemplateResult {\n return html`\n <dialog\n class=\"dialog\"\n part=\"dialog\"\n @close=${this.handleBrowserClose}\n @cancel=${this.handleBrowserClose}\n @beforetoggle=${this.handleBeforetoggle}\n style=${styleMap({\n '--swc-overlay-z-index': (\n 1000 + OverlayBase.openCount\n ).toString(),\n })}\n >\n ${this.renderContent()}\n </dialog>\n `;\n }\n\n protected renderPopover(): TemplateResult {\n const hasPopoverAttribute = 'popover' in this;\n const popoverValue = hasPopoverAttribute\n ? this.popoverValue\n : undefined;\n return html`\n <div\n class=\"dialog\"\n part=\"dialog\"\n popover=${ifDefined(popoverValue)}\n @beforetoggle=${this.handleBeforetoggle}\n @close=${this.handleBrowserClose}\n style=${styleMap({\n '--swc-overlay-z-index': (\n 1000 + OverlayBase.openCount\n ).toString(),\n })}\n >\n ${this.renderContent()}\n </div>\n `;\n }\n\n public override render(): TemplateResult {\n const isDialog = this.type === 'modal' || this.type === 'page';\n return html`\n ${isDialog ? this.renderDialog() : this.renderPopover()}\n <slot name=\"longpress-describedby-descriptor\"></slot>\n `;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('close', () => {\n this.open = false;\n });\n if (this.hasNonVirtualTrigger) {\n this.bindEvents();\n }\n }\n\n override disconnectedCallback(): void {\n if (this.hasNonVirtualTrigger) {\n this.unbindEvents(this.triggerElement as HTMLElement);\n }\n this.open = false;\n super.disconnectedCallback();\n }\n}\n"],
5
- "mappings": "qNAaA,OACI,QAAAA,EAEA,mBAAAC,MAEG,gCACP,OACI,YAAAC,EACA,SAAAC,EACA,yBAAAC,EACA,SAAAC,MACG,kDACP,OACI,aAAAC,EACA,SAAAC,MACG,kDACP,OAAS,4BAAAC,MAAgC,mEACzC,OACI,+BAAAC,EACA,gCAAAC,MACG,yEACP,OAAS,kBAAAC,MAAsB,sBAC/B,OACI,aAAAC,EACA,YAAAC,MACG,kDACP,OAAOC,MAAY,wBACnB,OAAS,gBAAAC,MAAoB,oBAC7B,OAAS,uBAAAC,MAA2B,2BAEpC,OAAS,gBAAAC,MAAoB,qBAEtB,aAAM,aAAe,IAAIA,EAQhC,MAAMC,EAAqB,IAMpB,aAAM,uBAAyB,CAClC,MAAO,mDACP,SAAU,uDACV,MAAO,uCACX,EAEO,aAAM,gCAAgC,KAAM,CAG/C,aAAc,CACV,MAAM,eAAgB,CAClB,QAAS,GACT,SAAU,EACd,CAAC,EANL,kBAAe,OACf,cAAW,QAMX,CACJ,CAEO,aAAM,8BAA8B,KAAM,CAG7C,aAAc,CACV,MAAM,eAAgB,CAClB,QAAS,GACT,SAAU,EACd,CAAC,EANL,kBAAe,SACf,cAAW,MAMX,CACJ,CAEO,aAAM,KAAO,IAAY,CAEhC,EAUa,wBAA0B,CACnCC,EACAC,EACAC,IACO,CACP,MAAMC,EAAU,IAAY,CACxBH,EAAG,oBAAoB,gBAAiBI,CAAmB,EAC3DJ,EAAG,oBAAoB,gBAAiBK,CAAmB,EAC3DH,EAAG,CACP,EACA,IAAII,EACAC,EAIJ,MAAMC,EAAa,sBAAsB,IAAM,CAC3CF,EAAa,sBAAsB,IAAM,CACrCC,EAAa,sBAAsB,IAAM,CACrCJ,EAAQ,CACZ,CAAC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. 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 { Placement } from '@floating-ui/dom';\nimport {\n html,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n queryAssignedElements,\n state,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport {\n isAndroid,\n isIOS,\n} from '@spectrum-web-components/shared/src/platform.js';\nimport { conditionAttributeWithId } from '@spectrum-web-components/base/src/condition-attribute-with-id.js';\nimport {\n ElementResolutionController,\n elementResolverUpdatedSymbol,\n} from '@spectrum-web-components/reactive-controllers/src/ElementResolution.js';\nimport { VirtualTrigger } from './VirtualTrigger.js';\nimport {\n ifDefined,\n styleMap,\n} from '@spectrum-web-components/base/src/directives.js';\nimport styles from './overlay-base.css.js';\nimport { overlayStack } from './OverlayStack.js';\nimport { PlacementController } from './PlacementController.js';\nimport { OverlayTypes } from './overlay-types.js';\nimport { OverlayTimer } from './overlay-timer.js';\n\nexport const overlayTimer = new OverlayTimer();\n\nexport type OpenableElement = HTMLElement & {\n open: boolean;\n tipElement?: HTMLElement;\n updateComplete?: Promise<void>;\n};\n\nconst LONGPRESS_DURATION = 300;\n\nexport type LongpressEvent = {\n source: 'pointer' | 'keyboard';\n};\n\nexport const LONGPRESS_INSTRUCTIONS = {\n touch: 'Double tap and long press for additional options',\n keyboard: 'Press Space or Alt+Down Arrow for additional options',\n mouse: 'Click and hold for additional options',\n};\n\nexport class BeforetoggleClosedEvent extends Event {\n currentState = 'open';\n newState = 'closed';\n constructor() {\n super('beforetoggle', {\n bubbles: false,\n composed: false,\n });\n }\n}\n\nexport class BeforetoggleOpenEvent extends Event {\n currentState = 'closed';\n newState = 'open';\n constructor() {\n super('beforetoggle', {\n bubbles: false,\n composed: false,\n });\n }\n}\n\nexport const noop = (): void => {\n return;\n};\n\n/**\n * Apply a \"transitionend\" listener to an element that may not transition but\n * guarantee the callback will be fired either way.\n *\n * @param el {HTMLElement} - Target of the \"transition\" listeners.\n * @param action {Function} - Method to trigger the \"transition\".\n * @param cb {Function} - Callback to trigger when the \"transition\" has ended.\n */\nexport const guaranteedTransitionend = (\n el: HTMLElement,\n action: () => void,\n cb: () => void\n): void => {\n const cleanup = (): void => {\n el.removeEventListener('transitionrun', handleTransitionrun);\n el.removeEventListener('transitionend', handleTransitionend);\n cb();\n };\n let guarantee2: number;\n let guarantee3: number;\n // WebKit fires `transitionrun` a little earlier, so the inner/outer relationship\n // here allows WebKit to be caught, but doesn't remove the animation listener until\n // after it would have fired in Chromium.\n const guarantee1 = requestAnimationFrame(() => {\n guarantee2 = requestAnimationFrame(() => {\n guarantee3 = requestAnimationFrame(() => {\n cleanup();\n });\n });\n });\n const handleTransitionend = (event: TransitionEvent): void => {\n if (event.propertyName === 'visibility') {\n // Ignore \"visibility\" transitions because they often happen before/after a\n // larger transition and don't represent the overall transition duration.\n return;\n }\n cleanup();\n };\n const handleTransitionrun = (event: TransitionEvent): void => {\n if (event.propertyName === 'visibility') {\n // Ignore \"visibility\" transitions because they often happen before/after a\n // larger transition and don't represent the overall transition duration.\n return;\n }\n cancelAnimationFrame(guarantee1);\n cancelAnimationFrame(guarantee2);\n cancelAnimationFrame(guarantee3);\n el.removeEventListener('transitionrun', handleTransitionrun);\n el.addEventListener('transitionend', handleTransitionend);\n };\n el.addEventListener('transitionrun', handleTransitionrun);\n action();\n};\n\nexport class OverlayBase extends SpectrumElement {\n static override styles = [styles];\n\n @property({ type: Boolean })\n delayed = false;\n\n @query('.dialog')\n dialogEl!: HTMLDialogElement & {\n showPopover(): void;\n hidePopover(): void;\n };\n\n @property({ type: Boolean })\n get disabled(): boolean {\n return this._disabled;\n }\n\n set disabled(disabled: boolean) {\n this._disabled = disabled;\n if (disabled) {\n if (this.hasNonVirtualTrigger) {\n this.unbindEvents(this.triggerElement as HTMLElement);\n }\n this.wasOpen = this.open;\n this.open = false;\n } else {\n this.bindEvents();\n this.open = this.open || this.wasOpen;\n this.wasOpen = false;\n }\n }\n\n private _disabled = false;\n\n protected dispose = noop;\n\n @queryAssignedElements({\n selector: ':not([slot=\"longpress-describedby-descriptor\"])',\n flatten: true,\n })\n elements!: OpenableElement[];\n\n public parentOverlayToForceClose?: OverlayBase;\n\n private get hasNonVirtualTrigger(): boolean {\n return (\n !!this.triggerElement &&\n !(this.triggerElement instanceof VirtualTrigger)\n );\n }\n\n protected longpressed = false;\n\n private longressTimeout!: ReturnType<typeof setTimeout>;\n\n @property()\n offset: number | [number, number] = 6;\n\n public placementController = new PlacementController(this);\n\n @property({ type: Boolean, reflect: true })\n get open(): boolean {\n return this._open;\n }\n\n set open(open: boolean) {\n if (open && this.disabled) return;\n if (open === this.open) return;\n this._open = open;\n this.requestUpdate('open', !this.open);\n }\n\n private _open = false;\n\n static openCount = 1;\n\n @property()\n placement?: Placement;\n\n @property({ attribute: 'receives-focus' })\n receivesFocus: 'true' | 'false' | 'auto' = 'auto';\n\n private releaseAriaDescribedby = noop;\n private releaseLongpressDescribedby = noop;\n\n @query('slot')\n slotEl!: HTMLSlotElement;\n\n @property()\n trigger?: string;\n\n @state()\n triggerElement: HTMLElement | VirtualTrigger | null = null;\n\n @state()\n triggerInteraction?: 'click' | 'longpress' | 'hover';\n\n @property()\n type: OverlayTypes = 'hint';\n\n protected wasOpen = false;\n\n private elementResolver = new ElementResolutionController(this);\n\n private get usesDialog(): boolean {\n return this.type === 'modal' || this.type === 'page';\n }\n\n private get popoverValue(): 'auto' | 'manual' | undefined {\n switch (this.type) {\n case 'modal':\n case 'page':\n return undefined;\n case 'hint':\n return 'manual';\n default:\n return this.type;\n }\n }\n\n /* c8 ignore next 12 */\n protected async manageDialogOpen(): Promise<void> {\n console.warn(\n 'Implement the `manageDialogOpen` method in a class extension.'\n );\n }\n\n protected async managePopoverOpen(): Promise<void> {\n console.warn(\n 'Implement the `managePopoverOpen` method in a class extension.'\n );\n }\n\n protected get requiresPosition(): boolean {\n // Do no position \"page\" overlays as they should block the entrie UI.\n if (this.type === 'page' || !this.open) return false;\n // Do not position content without a trigger element, what would you position it in relation to?\n // Do not automaticallyu position contnent, unless it is a \"hint\".\n if (!this.triggerElement || (!this.placement && this.type !== 'hint'))\n return false;\n return true;\n }\n\n protected managePosition(): void {\n if (!this.requiresPosition || !this.open) return;\n\n const offset = this.offset || 0;\n const trigger = this.triggerElement as HTMLElement;\n const placement = (this.placement as Placement) || 'right';\n\n this.placementController.placeOverlay(this.dialogEl, {\n // delayed?: boolean,\n offset,\n placement,\n // notImmediatelyClosable?: boolean, // rename or place behind other API options\n // receivesFocus?: 'auto';\n // root?: HTMLElement;\n trigger,\n type: this.type,\n });\n }\n\n protected async manageOpen(oldOpen: boolean): Promise<void> {\n if (!this.isConnected && this.open) return;\n\n if (!this.hasUpdated) {\n await this.updateComplete;\n }\n\n if (this.open) {\n overlayStack.add(this);\n if (this.willPreventClose) {\n document.addEventListener(\n 'pointerup',\n () => {\n this.dialogEl.classList.toggle(\n 'not-immediately-closable',\n false\n );\n this.willPreventClose = false;\n },\n { once: true }\n );\n this.dialogEl.classList.toggle(\n 'not-immediately-closable',\n true\n );\n }\n } else {\n if (oldOpen) {\n this.dispose();\n }\n overlayStack.remove(this);\n }\n\n if (this.usesDialog) {\n this.manageDialogOpen();\n } else {\n this.managePopoverOpen();\n }\n if (this.open) {\n OverlayBase.openCount += 1;\n } else {\n // If the focus remains inside of the overlay or\n // a slotted descendent of the overlay you need to return\n // focus back to the trigger.\n const getAncestors = (): HTMLElement[] => {\n const ancestors: HTMLElement[] = [];\n // eslint-disable-next-line @spectrum-web-components/document-active-element\n let currentNode = document.activeElement;\n while (\n currentNode?.shadowRoot &&\n currentNode.shadowRoot.activeElement\n ) {\n currentNode = currentNode.shadowRoot.activeElement;\n }\n while (currentNode) {\n const ancestor =\n currentNode.assignedSlot ||\n currentNode.parentElement ||\n (currentNode.getRootNode() as ShadowRoot)?.host;\n if (ancestor) {\n ancestors.push(ancestor as HTMLElement);\n }\n currentNode = ancestor;\n }\n return ancestors;\n };\n if (\n (this.triggerElement as HTMLElement)?.focus &&\n (this.contains(\n (this.getRootNode() as Document).activeElement\n ) ||\n !!getAncestors().find((el) => el === this))\n ) {\n (this.triggerElement as HTMLElement).focus();\n }\n }\n }\n\n protected unbindEvents(triggerElement: HTMLElement): void {\n triggerElement.removeEventListener('click', this.handleClick);\n triggerElement.removeEventListener(\n 'pointerdown',\n this.handlePointerdownForClick\n );\n triggerElement.removeEventListener('focusin', this.handleFocusin);\n triggerElement.removeEventListener('focusout', this.handleFocusout);\n triggerElement.removeEventListener(\n 'pointerenter',\n this.handlePointerenter\n );\n triggerElement.removeEventListener(\n 'pointerleave',\n this.handlePointerleave\n );\n this.removeEventListener(\n 'pointerleave',\n this.handleOverlayPointerleave\n );\n triggerElement.addEventListener('pointerdown', this.handlePointerdown);\n triggerElement.removeEventListener('keydown', this.handleKeydown);\n triggerElement.removeEventListener('keyup', this.handleKeyup);\n triggerElement.removeEventListener('longpress', this.handleLongpress);\n }\n\n protected bindEvents(): void {\n const nextTriggerElement = this.triggerElement as HTMLElement;\n if (!nextTriggerElement) return;\n switch (this.triggerInteraction) {\n case 'click':\n this.bindClickEvents(nextTriggerElement);\n return;\n case 'longpress':\n this.bindLongpressEvents(nextTriggerElement);\n return;\n case 'hover':\n this.bindHoverEvents(nextTriggerElement);\n return;\n }\n }\n\n protected bindClickEvents(triggerElement: HTMLElement): void {\n triggerElement.addEventListener('click', this.handleClick);\n triggerElement.addEventListener(\n 'pointerdown',\n this.handlePointerdownForClick\n );\n }\n\n protected bindLongpressEvents(triggerElement: HTMLElement): void {\n triggerElement.addEventListener('pointerdown', this.handlePointerdown);\n triggerElement.addEventListener('keydown', this.handleKeydown);\n triggerElement.addEventListener('keyup', this.handleKeyup);\n triggerElement.addEventListener('longpress', this.handleLongpress);\n\n this.prepareLongpressDescription(triggerElement);\n }\n\n protected bindHoverEvents(triggerElement: HTMLElement): void {\n triggerElement.addEventListener('focusin', this.handleFocusin);\n triggerElement.addEventListener('focusout', this.handleFocusout);\n triggerElement.addEventListener(\n 'pointerenter',\n this.handlePointerenter\n );\n triggerElement.addEventListener(\n 'pointerleave',\n this.handlePointerleave\n );\n this.addEventListener('pointerleave', this.handleOverlayPointerleave);\n if (this.receivesFocus === 'true') return;\n\n this.prepareAriaDescribedby(triggerElement);\n }\n\n protected manageTriggerElement(triggerElement: HTMLElement | null): void {\n if (triggerElement) {\n this.unbindEvents(triggerElement);\n this.releaseAriaDescribedby();\n }\n if (\n !this.triggerElement ||\n !!(this.triggerElement as VirtualTrigger).updateBoundingClientRect\n ) {\n return;\n }\n this.bindEvents();\n }\n\n private elementIds: string[] = [];\n\n private prepareLongpressDescription(trigger: HTMLElement): void {\n if (\n // only \"longpress\" relationships are described this way\n this.triggerInteraction !== 'longpress' ||\n // do not reapply until target it recycled\n this.releaseLongpressDescribedby !== noop ||\n // require \"longpress content\" to apply relationship\n !this.elements.length\n ) {\n return;\n }\n\n const longpressDescription = document.createElement('div');\n longpressDescription.id = `longpress-describedby-descriptor-${crypto\n .randomUUID()\n .slice(0, 8)}`;\n const messageType = isIOS() || isAndroid() ? 'touch' : 'keyboard';\n longpressDescription.textContent = LONGPRESS_INSTRUCTIONS[messageType];\n longpressDescription.slot = 'longpress-describedby-descriptor';\n trigger.insertAdjacentElement('afterend', longpressDescription);\n\n const releaseLongpressDescribedby = conditionAttributeWithId(\n trigger,\n 'aria-describedby',\n [longpressDescription.id]\n );\n this.releaseLongpressDescribedby = () => {\n releaseLongpressDescribedby();\n longpressDescription.remove();\n this.releaseLongpressDescribedby = noop;\n };\n }\n\n private prepareAriaDescribedby(trigger: HTMLElement): void {\n if (\n // only \"hover\" relationships establed described by content\n this.triggerInteraction !== 'hover' ||\n // do not reapply until target is recycled\n this.releaseAriaDescribedby !== noop ||\n // require \"hover content\" to apply relationship\n !this.elements.length\n ) {\n return;\n }\n\n const triggerRoot = trigger.getRootNode();\n const contentRoot = this.elements[0].getRootNode();\n const overlayRoot = this.getRootNode();\n if (triggerRoot == overlayRoot) {\n const releaseAriaDescribedby = conditionAttributeWithId(\n trigger,\n 'aria-describedby',\n [this.id]\n );\n this.releaseAriaDescribedby = () => {\n releaseAriaDescribedby();\n this.releaseAriaDescribedby = noop;\n };\n } else if (triggerRoot === contentRoot) {\n this.elementIds = this.elements.map((el) => el.id);\n const appliedIds = this.elements.map((el) => {\n if (!el.id) {\n el.id = `${this.tagName.toLowerCase()}-helper-${crypto\n .randomUUID()\n .slice(0, 8)}`;\n }\n return el.id;\n });\n const releaseAriaDescribedby = conditionAttributeWithId(\n trigger,\n 'aria-describedby',\n appliedIds\n );\n this.releaseAriaDescribedby = () => {\n releaseAriaDescribedby();\n this.elements.map((el, index) => {\n el.id = this.elementIds[index];\n });\n this.releaseAriaDescribedby = noop;\n };\n }\n }\n\n private handlePointerdown = (event: PointerEvent): void => {\n if (!this.triggerElement) return;\n if (event.button !== 0) return;\n const triggerElement = this.triggerElement as HTMLElement;\n this.longpressed = false;\n triggerElement.addEventListener('pointerup', this.handlePointerup);\n triggerElement.addEventListener('pointercancel', this.handlePointerup);\n this.longressTimeout = setTimeout(() => {\n if (!triggerElement) return;\n triggerElement.dispatchEvent(\n new CustomEvent<LongpressEvent>('longpress', {\n bubbles: true,\n composed: true,\n detail: {\n source: 'pointer',\n },\n })\n );\n }, LONGPRESS_DURATION);\n };\n\n private handlePointerup = (): void => {\n clearTimeout(this.longressTimeout);\n if (!this.triggerElement) return;\n if (this.longpressed) {\n this.open = true;\n }\n setTimeout(() => {\n this.longpressed = false;\n });\n const triggerElement = this.triggerElement as HTMLElement;\n triggerElement.removeEventListener('pointerup', this.handlePointerup);\n triggerElement.removeEventListener(\n 'pointercancel',\n this.handlePointerup\n );\n };\n\n /**\n * @private\n */\n protected handleKeydown = (event: KeyboardEvent): void => {\n const { code, altKey } = event;\n if (code === 'Space' || (altKey && code === 'ArrowDown')) {\n if (code === 'ArrowDown') {\n event.stopPropagation();\n event.stopImmediatePropagation();\n }\n }\n };\n\n protected handleKeyup = (event: KeyboardEvent): void => {\n const { code, altKey } = event;\n if (code === 'Space' || (altKey && code === 'ArrowDown')) {\n event.stopPropagation();\n this.dispatchEvent(\n new CustomEvent<LongpressEvent>('longpress', {\n bubbles: true,\n composed: true,\n detail: {\n source: 'keyboard',\n },\n })\n );\n }\n };\n\n private preventNextToggle = false;\n\n protected handlePointerdownForClick = (): void => {\n this.preventNextToggle = this.open;\n };\n\n protected handleClick = (): void => {\n if (this.longpressed) return;\n if (!this.preventNextToggle) {\n this.open = !this.open;\n }\n this.preventNextToggle = false;\n };\n\n private focusedin = false;\n\n protected handleFocusin = (): void => {\n this.open = true;\n this.focusedin = true;\n };\n\n protected handleFocusout = (): void => {\n this.focusedin = false;\n if (this.pointerentered) return;\n this.open = false;\n };\n\n private pointerentered = false;\n\n protected handlePointerenter = (): void => {\n if (this.disabled) return;\n this.open = true;\n this.pointerentered = true;\n };\n\n protected handlePointerleave = (event: PointerEvent): void => {\n if (\n this === event.relatedTarget ||\n this.contains(event.relatedTarget as Node) ||\n [...this.children].find((child) => {\n if (child.localName !== 'slot') {\n return false;\n }\n return (child as HTMLSlotElement)\n .assignedElements({ flatten: true })\n .find((el) => {\n return (\n el === event.relatedTarget ||\n el.contains(event.relatedTarget as Node)\n );\n });\n })\n ) {\n return;\n }\n this.doPointerleave();\n };\n\n protected handleOverlayPointerleave = (event: PointerEvent): void => {\n if (\n this.triggerElement === event.relatedTarget ||\n (this.hasNonVirtualTrigger &&\n (this.triggerElement as HTMLElement).contains(\n event.relatedTarget as Node\n ))\n ) {\n return;\n }\n this.doPointerleave();\n };\n\n protected doPointerleave(): void {\n this.pointerentered = false;\n const triggerElement = this.triggerElement as HTMLElement;\n if (this.focusedin && triggerElement.matches(':focus-visible')) return;\n this.open = false;\n }\n\n protected handleLongpress = (): void => {\n this.open = true;\n this.longpressed = true;\n };\n\n protected handleBeforetoggle(event: Event & { newState: string }): void {\n if (event.newState !== 'open') {\n this.handleBrowserClose();\n }\n }\n\n protected handleBrowserClose(): void {\n this.open = false;\n }\n\n protected handleSlotchange(): void {\n if (this.triggerElement) {\n this.prepareAriaDescribedby(this.triggerElement as HTMLElement);\n }\n if (!this.elements.length) {\n this.releaseLongpressDescribedby();\n } else if (this.hasNonVirtualTrigger) {\n this.prepareLongpressDescription(\n this.triggerElement as HTMLElement\n );\n }\n }\n\n public willPreventClose = false;\n\n public shouldPreventClose(): boolean {\n const shouldPreventClose = this.willPreventClose;\n this.willPreventClose = false;\n return shouldPreventClose;\n }\n\n override willUpdate(changes: PropertyValues): void {\n if (!this.hasUpdated) {\n this.addEventListener('focusout', (event: FocusEvent) => {\n // Only \"auto\" popovers should close on any sort of focusout\n if (this.type !== 'auto') {\n return;\n }\n // If you don't know where the focus went, we can't do anyting here.\n if (!event.relatedTarget) {\n // this.open = false;\n return;\n }\n const relationEvent = new Event('overlay-relation-query', {\n bubbles: true,\n composed: true,\n });\n event.relatedTarget.addEventListener(\n relationEvent.type,\n (event: Event) => {\n if (!event.composedPath().includes(this)) {\n this.open = false;\n }\n }\n );\n event.relatedTarget.dispatchEvent(relationEvent);\n });\n }\n if (!this.hasAttribute('id')) {\n this.setAttribute(\n 'id',\n `${this.tagName.toLowerCase()}-${crypto\n .randomUUID()\n .slice(0, 8)}`\n );\n }\n if (\n changes.has('open') &&\n (typeof changes.get('open') !== 'undefined' || this.open)\n ) {\n this.manageOpen(changes.get('open'));\n }\n if (changes.has('trigger')) {\n const [id, interaction] = this.trigger?.split('@') || [];\n this.elementResolver.selector = id ? `#${id}` : '';\n this.triggerInteraction = interaction as\n | 'click'\n | 'longpress'\n | 'hover'\n | undefined;\n }\n const oldTrigger = this.triggerElement as HTMLElement;\n if (changes.has(elementResolverUpdatedSymbol)) {\n this.triggerElement = this.elementResolver.element;\n this.manageTriggerElement(oldTrigger);\n }\n if (changes.has('triggerElement')) {\n this.manageTriggerElement(changes.get('triggerElement'));\n }\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (changes.has('placement')) {\n if (this.placement) {\n this.dialogEl.setAttribute('actual-placement', this.placement);\n } else {\n this.dialogEl.removeAttribute('actual-placement');\n }\n if (this.open && typeof changes.get('placement') !== 'undefined') {\n this.placementController.resetOverlayPosition();\n }\n }\n }\n\n protected renderContent(): TemplateResult {\n return html`\n <div part=\"content\">\n <slot @slotchange=${this.handleSlotchange}></slot>\n </div>\n `;\n }\n\n protected renderDialog(): TemplateResult {\n return html`\n <dialog\n class=\"dialog\"\n part=\"dialog\"\n @close=${this.handleBrowserClose}\n @cancel=${this.handleBrowserClose}\n @beforetoggle=${this.handleBeforetoggle}\n style=${styleMap({\n '--swc-overlay-z-index': (\n 1000 + OverlayBase.openCount\n ).toString(),\n })}\n >\n ${this.renderContent()}\n </dialog>\n `;\n }\n\n protected renderPopover(): TemplateResult {\n const hasPopoverAttribute = 'popover' in this;\n const popoverValue = hasPopoverAttribute\n ? this.popoverValue\n : undefined;\n return html`\n <div\n class=\"dialog\"\n part=\"dialog\"\n popover=${ifDefined(popoverValue)}\n @beforetoggle=${this.handleBeforetoggle}\n @close=${this.handleBrowserClose}\n style=${styleMap({\n '--swc-overlay-z-index': (\n 1000 + OverlayBase.openCount\n ).toString(),\n })}\n >\n ${this.renderContent()}\n </div>\n `;\n }\n\n public override render(): TemplateResult {\n const isDialog = this.type === 'modal' || this.type === 'page';\n return html`\n ${isDialog ? this.renderDialog() : this.renderPopover()}\n <slot name=\"longpress-describedby-descriptor\"></slot>\n `;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('close', () => {\n this.open = false;\n });\n if (this.hasNonVirtualTrigger) {\n this.bindEvents();\n }\n }\n\n override disconnectedCallback(): void {\n if (this.hasNonVirtualTrigger) {\n this.unbindEvents(this.triggerElement as HTMLElement);\n }\n this.open = false;\n super.disconnectedCallback();\n }\n}\n"],
5
+ "mappings": "qNAaA,OACI,QAAAA,EAEA,mBAAAC,MAEG,gCACP,OACI,YAAAC,EACA,SAAAC,EACA,yBAAAC,EACA,SAAAC,MACG,kDACP,OACI,aAAAC,EACA,SAAAC,MACG,kDACP,OAAS,4BAAAC,MAAgC,mEACzC,OACI,+BAAAC,EACA,gCAAAC,MACG,yEACP,OAAS,kBAAAC,MAAsB,sBAC/B,OACI,aAAAC,EACA,YAAAC,MACG,kDACP,OAAOC,MAAY,wBACnB,OAAS,gBAAAC,MAAoB,oBAC7B,OAAS,uBAAAC,MAA2B,2BAEpC,OAAS,gBAAAC,MAAoB,qBAEtB,aAAM,aAAe,IAAIA,EAQhC,MAAMC,EAAqB,IAMpB,aAAM,uBAAyB,CAClC,MAAO,mDACP,SAAU,uDACV,MAAO,uCACX,EAEO,aAAM,gCAAgC,KAAM,CAG/C,aAAc,CACV,MAAM,eAAgB,CAClB,QAAS,GACT,SAAU,EACd,CAAC,EANL,kBAAe,OACf,cAAW,QAMX,CACJ,CAEO,aAAM,8BAA8B,KAAM,CAG7C,aAAc,CACV,MAAM,eAAgB,CAClB,QAAS,GACT,SAAU,EACd,CAAC,EANL,kBAAe,SACf,cAAW,MAMX,CACJ,CAEO,aAAM,KAAO,IAAY,CAEhC,EAUa,wBAA0B,CACnCC,EACAC,EACAC,IACO,CACP,MAAMC,EAAU,IAAY,CACxBH,EAAG,oBAAoB,gBAAiBI,CAAmB,EAC3DJ,EAAG,oBAAoB,gBAAiBK,CAAmB,EAC3DH,EAAG,CACP,EACA,IAAII,EACAC,EAIJ,MAAMC,EAAa,sBAAsB,IAAM,CAC3CF,EAAa,sBAAsB,IAAM,CACrCC,EAAa,sBAAsB,IAAM,CACrCJ,EAAQ,CACZ,CAAC,CACL,CAAC,CACL,CAAC,EACKE,EAAuBI,GAAiC,CACtDA,EAAM,eAAiB,cA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,CADC1D,EAAM,GA9FE,YA+FT,kCAGA0D,EAAA,CADC7D,EAAS,GAjGD,YAkGT",
6
6
  "names": ["html", "SpectrumElement", "property", "query", "queryAssignedElements", "state", "isAndroid", "isIOS", "conditionAttributeWithId", "ElementResolutionController", "elementResolverUpdatedSymbol", "VirtualTrigger", "ifDefined", "styleMap", "styles", "overlayStack", "PlacementController", "OverlayTimer", "LONGPRESS_DURATION", "el", "action", "cb", "cleanup", "handleTransitionrun", "handleTransitionend", "guarantee2", "guarantee3", "guarantee1", "event", "_OverlayBase", "triggerElement", "code", "altKey", "child", "disabled", "open", "offset", "trigger", "placement", "oldOpen", "_a", "getAncestors", "ancestors", "currentNode", "ancestor", "nextTriggerElement", "longpressDescription", "messageType", "releaseLongpressDescribedby", "triggerRoot", "contentRoot", "overlayRoot", "releaseAriaDescribedby", "appliedIds", "index", "shouldPreventClose", "changes", "relationEvent", "id", "interaction", "oldTrigger", "popoverValue", "isDialog", "__decorateClass"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["OverlayStack.ts"],
4
- "sourcesContent": ["/*\nCopyright 2023 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\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 { OverlayBase as Overlay } from './OverlayBase.dev.js'\n\nconst supportsPopover = 'showPopover' in document.createElement('div');\n\nclass OverlayStack {\n private get document(): Document {\n return this.root.ownerDocument /* c8 ignore next */ || document;\n }\n\n private root: HTMLElement = document.body;\n\n stack: Overlay[] = [];\n\n constructor() {\n this.bindEvents();\n }\n\n bindEvents(): void {\n this.document.addEventListener('pointerup', this.handleClick);\n this.document.addEventListener('keydown', this.handleKeydown);\n }\n\n private closeOverlay(overlay: Overlay): void {\n const overlayIndex = this.stack.indexOf(overlay);\n if (overlayIndex > -1) {\n this.stack.splice(overlayIndex, 1);\n }\n overlay.open = false;\n }\n\n /**\n * Close all overlays that are not ancestors of this click event\n *\n * @param event {ClickEvent}\n */\n handleClick = (event: Event): void => {\n if (!this.stack.length) return;\n\n const composedPath = event.composedPath();\n const nonAncestorOverlays = this.stack.filter((overlay) => {\n const inStack = composedPath.find(\n (el) => el === overlay || el === overlay?.triggerElement\n );\n return !inStack && !overlay.shouldPreventClose();\n }) as Overlay[];\n nonAncestorOverlays.reverse();\n nonAncestorOverlays.forEach((overlay) => {\n this.closeOverlay(overlay);\n let parentToClose = overlay.parentOverlayToForceClose;\n while (parentToClose) {\n this.closeOverlay(parentToClose);\n parentToClose = parentToClose.parentOverlayToForceClose;\n }\n });\n\n // let reverseIndex = -1;\n // let overlay = this.stack.at(reverseIndex);\n // if (overlay?.shouldPreventClose()) return;\n\n // let shouldClose;\n // while (overlay && !shouldClose) {\n // shouldClose =\n // overlay.shouldPreventClose() ||\n // !composedPath.find(\n // (el) => el === overlay || el === overlay?.triggerElement\n // );\n // if (!shouldClose) {\n // reverseIndex -= 1;\n // overlay = this.stack.at(reverseIndex);\n // }\n // }\n // if (!shouldClose || !overlay) {\n // return;\n // }\n\n // this.closeOverlay(overlay);\n // let parentToClose = overlay.parentOverlayToForceClose;\n // while (parentToClose) {\n // this.closeOverlay(parentToClose);\n // parentToClose = parentToClose.parentOverlayToForceClose;\n // }\n };\n\n handleBeforetoggle = (event: Event): void => {\n const { target, newState: open } = event as Event & {\n newState: string;\n };\n if (open === 'open') return;\n this.closeOverlay(target as Overlay);\n };\n\n private handleKeydown = (event: KeyboardEvent): void => {\n if (event.code !== 'Escape') return;\n if (supportsPopover) return;\n if (!this.stack.length) return;\n\n const last = this.stack.at(-1);\n if (!last) return;\n this.closeOverlay(last);\n };\n\n /**\n * When overlays are added manage the open state of exisiting overlays appropriately:\n * - 'modal': should close other overlays\n * - 'page': should close other overlays\n * - 'hint': shouldn't close other overlays\n * - 'auto': should close other 'auto' overlays and other 'hint' overlays, but not 'manual' overlays\n * - 'manual': shouldn't close other overlays\n */\n add(overlay: Overlay): void {\n if (this.stack.includes(overlay)) {\n const overlayIndex = this.stack.indexOf(overlay);\n if (overlayIndex > -1) {\n this.stack.splice(overlayIndex, 1);\n this.stack.push(overlay);\n }\n return;\n }\n if (\n overlay.type === 'auto' ||\n overlay.type === 'modal' ||\n overlay.type === 'page'\n ) {\n // manage closing open overlays\n const queryPathEventName = 'sp-overlay-query-path';\n const queryPathEvent = new Event(queryPathEventName, {\n composed: true,\n bubbles: true,\n });\n overlay.addEventListener(\n queryPathEventName,\n (event: Event) => {\n const path = event.composedPath();\n this.stack.forEach((overlayEl) => {\n const inPath = path.find((el) => el === overlayEl);\n if (!inPath && overlayEl.type !== 'manual') {\n this.closeOverlay(overlayEl);\n }\n });\n },\n { once: true }\n );\n overlay.dispatchEvent(queryPathEvent);\n } else if (overlay.type === 'hint') {\n this.stack.forEach((overlayEl) => {\n if (overlayEl.type === 'hint') {\n this.closeOverlay(overlayEl);\n }\n });\n }\n requestAnimationFrame(() => {\n this.stack.push(overlay);\n overlay.addEventListener('beforetoggle', this.handleBeforetoggle, {\n once: true,\n });\n });\n }\n\n remove(overlay: Overlay): void {\n this.closeOverlay(overlay);\n }\n}\n\nexport const overlayStack = new OverlayStack();\n"],
5
- "mappings": ";AAaA,MAAM,kBAAkB,iBAAiB,SAAS,cAAc,KAAK;AAErE,MAAM,aAAa;AAAA,EASf,cAAc;AAJd,SAAQ,OAAoB,SAAS;AAErC,iBAAmB,CAAC;AAwBpB;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAc,CAAC,UAAuB;AAClC,UAAI,CAAC,KAAK,MAAM;AAAQ;AAExB,YAAM,eAAe,MAAM,aAAa;AACxC,YAAM,sBAAsB,KAAK,MAAM,OAAO,CAAC,YAAY;AACvD,cAAM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B,YAAM,eAAe,KAAK,MAAM,QAAQ,OAAO;AAC/C,UAAI,eAAe,IAAI;AACnB,aAAK,MAAM,OAAO,cAAc,CAAC;AACjC,aAAK,MAAM,KAAK,OAAO;AAAA,MAC3B;AACA;AAAA,IACJ;AACA,QACI,QAAQ,SAAS,UACjB,QAAQ,SAAS,WACjB,QAAQ,SAAS,QACnB;AAEE,YAAM,qBAAqB;AAC3B,YAAM,iBAAiB,IAAI,MAAM,oBAAoB;AAAA,QACjD,UAAU;AAAA,QACV,SAAS;AAAA,MACb,CAAC;AACD,cAAQ;AAAA,QACJ;AAAA,QACA,CAAC,UAAiB;AACd,gBAAM,OAAO,MAAM,aAAa;AAChC,eAAK,MAAM,QAAQ,CAAC,cAAc;AAC9B,kBAAM,SAAS,KAAK,KAAK,CAAC,OAAO,OAAO,SAAS;AACjD,gBAAI,CAAC,UAAU,UAAU,SAAS,UAAU;AACxC,mBAAK,aAAa,SAAS;AAAA,YAC/B;AAAA,UACJ,CAAC;AAAA,QACL;AAAA,QACA,EAAE,MAAM,KAAK;AAAA,MACjB;AACA,cAAQ,cAAc,cAAc;AAAA,IACxC,WAAW,QAAQ,SAAS,QAAQ;AAChC,WAAK,MAAM,QAAQ,CAAC,cAAc;AAC9B,YAAI,UAAU,SAAS,QAAQ;AAC3B,eAAK,aAAa,SAAS;AAAA,QAC/B;AAAA,MACJ,CAAC;AAAA,IACL;AACA,0BAAsB,MAAM;AACxB,WAAK,MAAM,KAAK,OAAO;AACvB,cAAQ,iBAAiB,gBAAgB,KAAK,oBAAoB;AAAA,QAC9D,MAAM;AAAA,MACV,CAAC;AAAA,IACL,CAAC;AAAA,EACL;AAAA,EAEA,OAAO,SAAwB;AAC3B,SAAK,aAAa,OAAO;AAAA,EAC7B;AACJ;AAEO,aAAM,eAAe,IAAI,aAAa;",
4
+ "sourcesContent": ["/*\nCopyright 2023 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\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 { OverlayBase as Overlay } from './OverlayBase.dev.js'\n\nconst supportsPopover = 'showPopover' in document.createElement('div');\n\nclass OverlayStack {\n private get document(): Document {\n return this.root.ownerDocument /* c8 ignore next */ || document;\n }\n\n private root: HTMLElement = document.body;\n\n stack: Overlay[] = [];\n\n constructor() {\n this.bindEvents();\n }\n\n bindEvents(): void {\n this.document.addEventListener('pointerup', this.handleClick);\n this.document.addEventListener('keydown', this.handleKeydown);\n }\n\n private closeOverlay(overlay: Overlay): void {\n const overlayIndex = this.stack.indexOf(overlay);\n if (overlayIndex > -1) {\n this.stack.splice(overlayIndex, 1);\n }\n overlay.open = false;\n }\n\n /**\n * Close all overlays that are not ancestors of this click event\n *\n * @param event {ClickEvent}\n */\n handleClick = (event: Event): void => {\n if (!this.stack.length) return;\n\n const composedPath = event.composedPath();\n const nonAncestorOverlays = this.stack.filter((overlay) => {\n const inStack = composedPath.find(\n (el) => el === overlay || el === overlay?.triggerElement\n );\n return !inStack && !overlay.shouldPreventClose();\n }) as Overlay[];\n nonAncestorOverlays.reverse();\n nonAncestorOverlays.forEach((overlay) => {\n this.closeOverlay(overlay);\n let parentToClose = overlay.parentOverlayToForceClose;\n while (parentToClose) {\n this.closeOverlay(parentToClose);\n parentToClose = parentToClose.parentOverlayToForceClose;\n }\n });\n };\n\n handleBeforetoggle = (event: Event): void => {\n const { target, newState: open } = event as Event & {\n newState: string;\n };\n if (open === 'open') return;\n this.closeOverlay(target as Overlay);\n };\n\n private handleKeydown = (event: KeyboardEvent): void => {\n if (event.code !== 'Escape') return;\n if (supportsPopover) return;\n if (!this.stack.length) return;\n\n const last = this.stack.at(-1);\n if (!last) return;\n this.closeOverlay(last);\n };\n\n /**\n * When overlays are added manage the open state of exisiting overlays appropriately:\n * - 'modal': should close other overlays\n * - 'page': should close other overlays\n * - 'hint': shouldn't close other overlays\n * - 'auto': should close other 'auto' overlays and other 'hint' overlays, but not 'manual' overlays\n * - 'manual': shouldn't close other overlays\n */\n add(overlay: Overlay): void {\n if (this.stack.includes(overlay)) {\n const overlayIndex = this.stack.indexOf(overlay);\n if (overlayIndex > -1) {\n this.stack.splice(overlayIndex, 1);\n this.stack.push(overlay);\n }\n return;\n }\n if (\n overlay.type === 'auto' ||\n overlay.type === 'modal' ||\n overlay.type === 'page'\n ) {\n // manage closing open overlays\n const queryPathEventName = 'sp-overlay-query-path';\n const queryPathEvent = new Event(queryPathEventName, {\n composed: true,\n bubbles: true,\n });\n overlay.addEventListener(\n queryPathEventName,\n (event: Event) => {\n const path = event.composedPath();\n this.stack.forEach((overlayEl) => {\n const inPath = path.find((el) => el === overlayEl);\n if (!inPath && overlayEl.type !== 'manual') {\n this.closeOverlay(overlayEl);\n }\n });\n },\n { once: true }\n );\n overlay.dispatchEvent(queryPathEvent);\n } else if (overlay.type === 'hint') {\n this.stack.forEach((overlayEl) => {\n if (overlayEl.type === 'hint') {\n this.closeOverlay(overlayEl);\n }\n });\n }\n requestAnimationFrame(() => {\n this.stack.push(overlay);\n overlay.addEventListener('beforetoggle', this.handleBeforetoggle, {\n once: true,\n });\n });\n }\n\n remove(overlay: Overlay): void {\n this.closeOverlay(overlay);\n }\n}\n\nexport const overlayStack = new OverlayStack();\n"],
5
+ "mappings": ";AAaA,MAAM,kBAAkB,iBAAiB,SAAS,cAAc,KAAK;AAErE,MAAM,aAAa;AAAA,EASf,cAAc;AAJd,SAAQ,OAAoB,SAAS;AAErC,iBAAmB,CAAC;AAwBpB;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAc,CAAC,UAAuB;AAClC,UAAI,CAAC,KAAK,MAAM;AAAQ;AAExB,YAAM,eAAe,MAAM,aAAa;AACxC,YAAM,sBAAsB,KAAK,MA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["OverlayStack.ts"],
4
- "sourcesContent": ["/*\nCopyright 2023 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\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 { OverlayBase as Overlay } from './OverlayBase.js';\n\nconst supportsPopover = 'showPopover' in document.createElement('div');\n\nclass OverlayStack {\n private get document(): Document {\n return this.root.ownerDocument /* c8 ignore next */ || document;\n }\n\n private root: HTMLElement = document.body;\n\n stack: Overlay[] = [];\n\n constructor() {\n this.bindEvents();\n }\n\n bindEvents(): void {\n this.document.addEventListener('pointerup', this.handleClick);\n this.document.addEventListener('keydown', this.handleKeydown);\n }\n\n private closeOverlay(overlay: Overlay): void {\n const overlayIndex = this.stack.indexOf(overlay);\n if (overlayIndex > -1) {\n this.stack.splice(overlayIndex, 1);\n }\n overlay.open = false;\n }\n\n /**\n * Close all overlays that are not ancestors of this click event\n *\n * @param event {ClickEvent}\n */\n handleClick = (event: Event): void => {\n if (!this.stack.length) return;\n\n const composedPath = event.composedPath();\n const nonAncestorOverlays = this.stack.filter((overlay) => {\n const inStack = composedPath.find(\n (el) => el === overlay || el === overlay?.triggerElement\n );\n return !inStack && !overlay.shouldPreventClose();\n }) as Overlay[];\n nonAncestorOverlays.reverse();\n nonAncestorOverlays.forEach((overlay) => {\n this.closeOverlay(overlay);\n let parentToClose = overlay.parentOverlayToForceClose;\n while (parentToClose) {\n this.closeOverlay(parentToClose);\n parentToClose = parentToClose.parentOverlayToForceClose;\n }\n });\n\n // let reverseIndex = -1;\n // let overlay = this.stack.at(reverseIndex);\n // if (overlay?.shouldPreventClose()) return;\n\n // let shouldClose;\n // while (overlay && !shouldClose) {\n // shouldClose =\n // overlay.shouldPreventClose() ||\n // !composedPath.find(\n // (el) => el === overlay || el === overlay?.triggerElement\n // );\n // if (!shouldClose) {\n // reverseIndex -= 1;\n // overlay = this.stack.at(reverseIndex);\n // }\n // }\n // if (!shouldClose || !overlay) {\n // return;\n // }\n\n // this.closeOverlay(overlay);\n // let parentToClose = overlay.parentOverlayToForceClose;\n // while (parentToClose) {\n // this.closeOverlay(parentToClose);\n // parentToClose = parentToClose.parentOverlayToForceClose;\n // }\n };\n\n handleBeforetoggle = (event: Event): void => {\n const { target, newState: open } = event as Event & {\n newState: string;\n };\n if (open === 'open') return;\n this.closeOverlay(target as Overlay);\n };\n\n private handleKeydown = (event: KeyboardEvent): void => {\n if (event.code !== 'Escape') return;\n if (supportsPopover) return;\n if (!this.stack.length) return;\n\n const last = this.stack.at(-1);\n if (!last) return;\n this.closeOverlay(last);\n };\n\n /**\n * When overlays are added manage the open state of exisiting overlays appropriately:\n * - 'modal': should close other overlays\n * - 'page': should close other overlays\n * - 'hint': shouldn't close other overlays\n * - 'auto': should close other 'auto' overlays and other 'hint' overlays, but not 'manual' overlays\n * - 'manual': shouldn't close other overlays\n */\n add(overlay: Overlay): void {\n if (this.stack.includes(overlay)) {\n const overlayIndex = this.stack.indexOf(overlay);\n if (overlayIndex > -1) {\n this.stack.splice(overlayIndex, 1);\n this.stack.push(overlay);\n }\n return;\n }\n if (\n overlay.type === 'auto' ||\n overlay.type === 'modal' ||\n overlay.type === 'page'\n ) {\n // manage closing open overlays\n const queryPathEventName = 'sp-overlay-query-path';\n const queryPathEvent = new Event(queryPathEventName, {\n composed: true,\n bubbles: true,\n });\n overlay.addEventListener(\n queryPathEventName,\n (event: Event) => {\n const path = event.composedPath();\n this.stack.forEach((overlayEl) => {\n const inPath = path.find((el) => el === overlayEl);\n if (!inPath && overlayEl.type !== 'manual') {\n this.closeOverlay(overlayEl);\n }\n });\n },\n { once: true }\n );\n overlay.dispatchEvent(queryPathEvent);\n } else if (overlay.type === 'hint') {\n this.stack.forEach((overlayEl) => {\n if (overlayEl.type === 'hint') {\n this.closeOverlay(overlayEl);\n }\n });\n }\n requestAnimationFrame(() => {\n this.stack.push(overlay);\n overlay.addEventListener('beforetoggle', this.handleBeforetoggle, {\n once: true,\n });\n });\n }\n\n remove(overlay: Overlay): void {\n this.closeOverlay(overlay);\n }\n}\n\nexport const overlayStack = new OverlayStack();\n"],
5
- "mappings": "aAaA,MAAMA,EAAkB,gBAAiB,SAAS,cAAc,KAAK,EAErE,MAAMC,CAAa,CASf,aAAc,CAJd,KAAQ,KAAoB,SAAS,KAErC,WAAmB,CAAC,EAwBpB,iBAAeC,GAAuB,CAClC,GAAI,CAAC,KAAK,MAAM,OAAQ,OAExB,MAAMC,EAAeD,EAAM,aAAa,EAClCE,EAAsB,KAAK,MAAM,OAAQC,GAIpC,CAHSF,EAAa,KACxBG,GAAOA,IAAOD,GAAWC,KAAOD,GAAA,YAAAA,EAAS,eAC9C,GACmB,CAACA,EAAQ,mBAAmB,CAClD,EACDD,EAAoB,QAAQ,EAC5BA,EAAoB,QAASC,GAAY,CACrC,KAAK,aAAaA,CAAO,EACzB,IAAIE,EAAgBF,EAAQ,0BAC5B,KAAOE,GACH,KAAK,aAAaA,CAAa,EAC/BA,EAAgBA,EAAc,yBAEtC,CAAC,CA4BL,EAEA,wBAAsBL,GAAuB,CACzC,KAAM,CAAE,OAAAM,EAAQ,SAAUC,CAAK,EAAIP,EAG/BO,IAAS,QACb,KAAK,aAAaD,CAAiB,CACvC,EAEA,KAAQ,cAAiBN,GAA+B,CAGpD,GAFIA,EAAM,OAAS,UACfF,GACA,CAAC,KAAK,MAAM,OAAQ,OAExB,MAAMU,EAAO,KAAK,MAAM,GAAG,EAAE,EACxBA,GACL,KAAK,aAAaA,CAAI,CAC1B,EArFI,KAAK,WAAW,CACpB,CAVA,IAAY,UAAqB,CAC7B,OAAO,KAAK,KAAK,eAAsC,QAC3D,CAUA,YAAmB,CACf,KAAK,SAAS,iBAAiB,YAAa,KAAK,WAAW,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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\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 { OverlayBase as Overlay } from './OverlayBase.js';\n\nconst supportsPopover = 'showPopover' in document.createElement('div');\n\nclass OverlayStack {\n private get document(): Document {\n return this.root.ownerDocument /* c8 ignore next */ || document;\n }\n\n private root: HTMLElement = document.body;\n\n stack: Overlay[] = [];\n\n constructor() {\n this.bindEvents();\n }\n\n bindEvents(): void {\n this.document.addEventListener('pointerup', this.handleClick);\n this.document.addEventListener('keydown', this.handleKeydown);\n }\n\n private closeOverlay(overlay: Overlay): void {\n const overlayIndex = this.stack.indexOf(overlay);\n if (overlayIndex > -1) {\n this.stack.splice(overlayIndex, 1);\n }\n overlay.open = false;\n }\n\n /**\n * Close all overlays that are not ancestors of this click event\n *\n * @param event {ClickEvent}\n */\n handleClick = (event: Event): void => {\n if (!this.stack.length) return;\n\n const composedPath = event.composedPath();\n const nonAncestorOverlays = this.stack.filter((overlay) => {\n const inStack = composedPath.find(\n (el) => el === overlay || el === overlay?.triggerElement\n );\n return !inStack && !overlay.shouldPreventClose();\n }) as Overlay[];\n nonAncestorOverlays.reverse();\n nonAncestorOverlays.forEach((overlay) => {\n this.closeOverlay(overlay);\n let parentToClose = overlay.parentOverlayToForceClose;\n while (parentToClose) {\n this.closeOverlay(parentToClose);\n parentToClose = parentToClose.parentOverlayToForceClose;\n }\n });\n };\n\n handleBeforetoggle = (event: Event): void => {\n const { target, newState: open } = event as Event & {\n newState: string;\n };\n if (open === 'open') return;\n this.closeOverlay(target as Overlay);\n };\n\n private handleKeydown = (event: KeyboardEvent): void => {\n if (event.code !== 'Escape') return;\n if (supportsPopover) return;\n if (!this.stack.length) return;\n\n const last = this.stack.at(-1);\n if (!last) return;\n this.closeOverlay(last);\n };\n\n /**\n * When overlays are added manage the open state of exisiting overlays appropriately:\n * - 'modal': should close other overlays\n * - 'page': should close other overlays\n * - 'hint': shouldn't close other overlays\n * - 'auto': should close other 'auto' overlays and other 'hint' overlays, but not 'manual' overlays\n * - 'manual': shouldn't close other overlays\n */\n add(overlay: Overlay): void {\n if (this.stack.includes(overlay)) {\n const overlayIndex = this.stack.indexOf(overlay);\n if (overlayIndex > -1) {\n this.stack.splice(overlayIndex, 1);\n this.stack.push(overlay);\n }\n return;\n }\n if (\n overlay.type === 'auto' ||\n overlay.type === 'modal' ||\n overlay.type === 'page'\n ) {\n // manage closing open overlays\n const queryPathEventName = 'sp-overlay-query-path';\n const queryPathEvent = new Event(queryPathEventName, {\n composed: true,\n bubbles: true,\n });\n overlay.addEventListener(\n queryPathEventName,\n (event: Event) => {\n const path = event.composedPath();\n this.stack.forEach((overlayEl) => {\n const inPath = path.find((el) => el === overlayEl);\n if (!inPath && overlayEl.type !== 'manual') {\n this.closeOverlay(overlayEl);\n }\n });\n },\n { once: true }\n );\n overlay.dispatchEvent(queryPathEvent);\n } else if (overlay.type === 'hint') {\n this.stack.forEach((overlayEl) => {\n if (overlayEl.type === 'hint') {\n this.closeOverlay(overlayEl);\n }\n });\n }\n requestAnimationFrame(() => {\n this.stack.push(overlay);\n overlay.addEventListener('beforetoggle', this.handleBeforetoggle, {\n once: true,\n });\n });\n }\n\n remove(overlay: Overlay): void {\n this.closeOverlay(overlay);\n }\n}\n\nexport const overlayStack = new OverlayStack();\n"],
5
+ "mappings": "aAaA,MAAMA,EAAkB,gBAAiB,SAAS,cAAc,KAAK,EAErE,MAAMC,CAAa,CASf,aAAc,CAJd,KAAQ,KAAoB,SAAS,KAErC,WAAmB,CAAC,EAwBpB,iBAAeC,GAAuB,CAClC,GAAI,CAAC,KAAK,MAAM,OAAQ,OAExB,MAAMC,EAAeD,EAAM,aAAa,EAClCE,EAAsB,KAAK,MAAM,OAAQC,GAIpC,CA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AI,MAAMD,EAAoB,CACjD,SAAU,GACV,QAAS,EACb,CAAC,EACDP,EAAQ,iBACJO,EACCV,GAAiB,CACd,MAAMY,EAAOZ,EAAM,aAAa,EAChC,KAAK,MAAM,QAASa,GAAc,CAE1B,CADWD,EAAK,KAAMR,GAAOA,IAAOS,CAAS,GAClCA,EAAU,OAAS,UAC9B,KAAK,aAAaA,CAAS,CAEnC,CAAC,CACL,EACA,CAAE,KAAM,EAAK,CACjB,EACAV,EAAQ,cAAcQ,CAAc,OAC7BR,EAAQ,OAAS,QACxB,KAAK,MAAM,QAASU,GAAc,CAC1BA,EAAU,OAAS,QACnB,KAAK,aAAaA,CAAS,CAEnC,CAAC,EAEL,sBAAsB,IAAM,CACxB,KAAK,MAAM,KAAKV,CAAO,EACvBA,EAAQ,iBAAiB,eAAgB,KAAK,mBAAoB,CAC9D,KAAM,EACV,CAAC,CACL,CAAC,CACL,CAEA,OAAOA,EAAwB,CAC3B,KAAK,aAAaA,CAAO,CAC7B,CACJ,CAEO,aAAM,aAAe,IAAIJ",
6
6
  "names": ["supportsPopover", "OverlayStack", "event", "composedPath", "nonAncestorOverlays", "overlay", "el", "parentToClose", "target", "open", "last", "overlayIndex", "queryPathEventName", "queryPathEvent", "path", "overlayEl"]
7
7
  }
@@ -3,7 +3,7 @@ import { css } from "@spectrum-web-components/base";
3
3
  const styles = css`
4
4
  :host{--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;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}:host(:not([open])) .dialog{--sp-overlay-open:false;left:0;top:0;transform:translate(-999em,-999em)}.dialog:focus{outline:none}.dialog::backdrop{display:none}.dialog>div{width:100%}::slotted(*){pointer-events:auto}::slotted(sp-popover){position:static}.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}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{opacity:1}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:var(--swc-overlay-z-index)}}
6
+ );display:contents;pointer-events:none}.dialog{--sp-overlay-open:true;background:none;border:0;box-sizing:border-box;display:flex;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}:host(:not([open])) .dialog{--sp-overlay-open:false;left:0;top:0;transform:translate(-999em,-999em)}.dialog:focus{outline:none}.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}::slotted(sp-popover){position:static}.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}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{opacity:1}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:var(--swc-overlay-z-index)}}
7
7
  `;
8
8
  export default styles;
9
9
  //# sourceMappingURL=overlay-base.css.dev.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["overlay-base.css.ts"],
4
- "sourcesContent": ["/*\nCopyright 2023 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;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}:host(:not([open])) .dialog{--sp-overlay-open:false;left:0;top:0;transform:translate(-999em,-999em)}.dialog:focus{outline:none}.dialog::backdrop{display:none}.dialog>div{width:100%}::slotted(*){pointer-events:auto}::slotted(sp-popover){position:static}.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}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{opacity:1}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:var(--swc-overlay-z-index)}}\n`;\nexport default styles;"],
4
+ "sourcesContent": ["/*\nCopyright 2023 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;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}:host(:not([open])) .dialog{--sp-overlay-open:false;left:0;top:0;transform:translate(-999em,-999em)}.dialog:focus{outline:none}.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}::slotted(sp-popover){position:static}.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}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{opacity:1}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:var(--swc-overlay-z-index)}}\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 o}from"@spectrum-web-components/base";const a=o`
2
2
  :host{--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;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}:host(:not([open])) .dialog{--sp-overlay-open:false;left:0;top:0;transform:translate(-999em,-999em)}.dialog:focus{outline:none}.dialog::backdrop{display:none}.dialog>div{width:100%}::slotted(*){pointer-events:auto}::slotted(sp-popover){position:static}.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}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{opacity:1}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:var(--swc-overlay-z-index)}}
4
+ );display:contents;pointer-events:none}.dialog{--sp-overlay-open:true;background:none;border:0;box-sizing:border-box;display:flex;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}:host(:not([open])) .dialog{--sp-overlay-open:false;left:0;top:0;transform:translate(-999em,-999em)}.dialog:focus{outline:none}.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}::slotted(sp-popover){position:static}.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}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{opacity:1}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:var(--swc-overlay-z-index)}}
5
5
  `;export default a;
6
6
  //# sourceMappingURL=overlay-base.css.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["overlay-base.css.ts"],
4
- "sourcesContent": ["/*\nCopyright 2023 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;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}:host(:not([open])) .dialog{--sp-overlay-open:false;left:0;top:0;transform:translate(-999em,-999em)}.dialog:focus{outline:none}.dialog::backdrop{display:none}.dialog>div{width:100%}::slotted(*){pointer-events:auto}::slotted(sp-popover){position:static}.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}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{opacity:1}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:var(--swc-overlay-z-index)}}\n`;\nexport default styles;"],
4
+ "sourcesContent": ["/*\nCopyright 2023 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;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}:host(:not([open])) .dialog{--sp-overlay-open:false;left:0;top:0;transform:translate(-999em,-999em)}.dialog:focus{outline:none}.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}::slotted(sp-popover){position:static}.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}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{opacity:1}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:var(--swc-overlay-z-index)}}\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
  }
@@ -1113,7 +1113,7 @@ class StartEndContextmenu extends HTMLElement {
1113
1113
  }
1114
1114
  }
1115
1115
  customElements.define("start-end-contextmenu", StartEndContextmenu);
1116
- export const virtualElement = (args) => {
1116
+ export const virtualElementV1 = (args) => {
1117
1117
  const contextMenuTemplate = (kind = "") => html`
1118
1118
  <sp-popover
1119
1119
  style="width:300px;"
@@ -1154,9 +1154,73 @@ export const virtualElement = (args) => {
1154
1154
  placement: args.placement,
1155
1155
  receivesFocus: "auto",
1156
1156
  virtualTrigger,
1157
- offset: -10,
1157
+ offset: 0,
1158
+ notImmediatelyClosable: true
1159
+ });
1160
+ };
1161
+ return html`
1162
+ <style>
1163
+ .app-root {
1164
+ position: absolute;
1165
+ inset: 0;
1166
+ }
1167
+ </style>
1168
+ <start-end-contextmenu
1169
+ class="app-root"
1170
+ @contextmenu=${{
1171
+ capture: true,
1172
+ handleEvent: handleContextmenu
1173
+ }}
1174
+ ></start-end-contextmenu>
1175
+ `;
1176
+ };
1177
+ virtualElementV1.args = {
1178
+ placement: "right-start"
1179
+ };
1180
+ export const virtualElement = (args) => {
1181
+ const contextMenuTemplate = (kind = "") => html`
1182
+ <sp-popover
1183
+ style="width:300px;"
1184
+ @click=${(event) => {
1185
+ var _a;
1186
+ if (event.target.localName === "sp-menu-item") {
1187
+ (_a = event.target) == null ? void 0 : _a.dispatchEvent(
1188
+ new Event("close", { bubbles: true })
1189
+ );
1190
+ }
1191
+ }}
1192
+ >
1193
+ <sp-menu>
1194
+ <sp-menu-group>
1195
+ <span slot="header">Menu source: ${kind}</span>
1196
+ <sp-menu-item>Deselect</sp-menu-item>
1197
+ <sp-menu-item>Select inverse</sp-menu-item>
1198
+ <sp-menu-item>Feather...</sp-menu-item>
1199
+ <sp-menu-item>Select and mask...</sp-menu-item>
1200
+ <sp-menu-divider></sp-menu-divider>
1201
+ <sp-menu-item>Save selection</sp-menu-item>
1202
+ <sp-menu-item disabled>Make work path</sp-menu-item>
1203
+ </sp-menu-group>
1204
+ </sp-menu>
1205
+ </sp-popover>
1206
+ `;
1207
+ const handleContextmenu = async (event) => {
1208
+ event.preventDefault();
1209
+ event.stopPropagation();
1210
+ const source = event.composedPath()[0];
1211
+ const { id } = source;
1212
+ const trigger = event.target;
1213
+ const virtualTrigger = new VirtualTrigger(event.clientX, event.clientY);
1214
+ const fragment = document.createDocumentFragment();
1215
+ render(contextMenuTemplate(id), fragment);
1216
+ const popover = fragment.querySelector("sp-popover");
1217
+ const overlay = await openOverlay(popover, {
1218
+ trigger: virtualTrigger,
1219
+ placement: args.placement,
1220
+ offset: 0,
1158
1221
  notImmediatelyClosable: true
1159
1222
  });
1223
+ trigger.insertAdjacentElement("afterend", overlay);
1160
1224
  };
1161
1225
  return html`
1162
1226
  <style>