@spectrum-web-components/overlay 1.1.0-beta.26 → 1.1.0-beta.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -7
- package/src/Overlay.d.ts +1 -1
- package/src/Overlay.dev.js +3 -2
- package/src/Overlay.dev.js.map +2 -2
- package/src/Overlay.js +1 -1
- package/src/Overlay.js.map +2 -2
- package/src/OverlayStack.d.ts +2 -2
- package/src/OverlayStack.dev.js +8 -5
- package/src/OverlayStack.dev.js.map +2 -2
- package/src/OverlayStack.js +1 -1
- package/src/OverlayStack.js.map +3 -3
- package/test/overlay-element.test.js +2 -4
- package/test/overlay-element.test.js.map +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/overlay",
|
|
3
|
-
"version": "1.1.0-beta.
|
|
3
|
+
"version": "1.1.0-beta.27",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -160,11 +160,11 @@
|
|
|
160
160
|
"dependencies": {
|
|
161
161
|
"@floating-ui/dom": "^1.6.1",
|
|
162
162
|
"@floating-ui/utils": "^0.2.1",
|
|
163
|
-
"@spectrum-web-components/action-button": "^1.1.0-beta.
|
|
164
|
-
"@spectrum-web-components/base": "^1.1.0-beta.
|
|
165
|
-
"@spectrum-web-components/reactive-controllers": "^1.1.0-beta.
|
|
166
|
-
"@spectrum-web-components/shared": "^1.1.0-beta.
|
|
167
|
-
"@spectrum-web-components/theme": "^1.1.0-beta.
|
|
163
|
+
"@spectrum-web-components/action-button": "^1.1.0-beta.27",
|
|
164
|
+
"@spectrum-web-components/base": "^1.1.0-beta.27",
|
|
165
|
+
"@spectrum-web-components/reactive-controllers": "^1.1.0-beta.27",
|
|
166
|
+
"@spectrum-web-components/shared": "^1.1.0-beta.27",
|
|
167
|
+
"@spectrum-web-components/theme": "^1.1.0-beta.27"
|
|
168
168
|
},
|
|
169
169
|
"types": "./src/index.d.ts",
|
|
170
170
|
"customElements": "custom-elements.json",
|
|
@@ -176,5 +176,5 @@
|
|
|
176
176
|
"./stories/overlay-story-components.js",
|
|
177
177
|
"./**/*.dev.js"
|
|
178
178
|
],
|
|
179
|
-
"gitHead": "
|
|
179
|
+
"gitHead": "7cf7dfde8e21dfbb218316962588d3bb24331416"
|
|
180
180
|
}
|
package/src/Overlay.d.ts
CHANGED
|
@@ -117,7 +117,7 @@ export declare class Overlay extends OverlayFeatures {
|
|
|
117
117
|
protected handleBeforetoggle(event: Event & {
|
|
118
118
|
newState: string;
|
|
119
119
|
}): void;
|
|
120
|
-
protected handleBrowserClose(): void;
|
|
120
|
+
protected handleBrowserClose(event: Event): void;
|
|
121
121
|
manuallyKeepOpen(): void;
|
|
122
122
|
protected handleSlotchange(): void;
|
|
123
123
|
shouldPreventClose(): boolean;
|
package/src/Overlay.dev.js
CHANGED
|
@@ -320,11 +320,12 @@ const _Overlay = class _Overlay extends OverlayFeatures {
|
|
|
320
320
|
}
|
|
321
321
|
handleBeforetoggle(event) {
|
|
322
322
|
if (event.newState !== "open") {
|
|
323
|
-
this.handleBrowserClose();
|
|
323
|
+
this.handleBrowserClose(event);
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
|
-
handleBrowserClose() {
|
|
326
|
+
handleBrowserClose(event) {
|
|
327
327
|
var _a;
|
|
328
|
+
event.stopPropagation();
|
|
328
329
|
if (!((_a = this.strategy) == null ? void 0 : _a.activelyOpening)) {
|
|
329
330
|
this.open = false;
|
|
330
331
|
return;
|
package/src/Overlay.dev.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Overlay.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 {\n html,\n PropertyValues,\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 ElementResolutionController,\n elementResolverUpdatedSymbol,\n} from '@spectrum-web-components/reactive-controllers/src/ElementResolution.js';\nimport {\n ifDefined,\n StyleInfo,\n styleMap,\n} from '@spectrum-web-components/base/src/directives.js';\nimport { randomID } from '@spectrum-web-components/shared/src/random-id.js';\n\nimport type {\n OpenableElement,\n OverlayState,\n OverlayTypes,\n Placement,\n TriggerInteraction,\n} from './overlay-types.dev.js'\nimport { AbstractOverlay, nextFrame } from './AbstractOverlay.dev.js'\nimport { OverlayDialog } from './OverlayDialog.dev.js'\nimport { OverlayPopover } from './OverlayPopover.dev.js'\nimport { OverlayNoPopover } from './OverlayNoPopover.dev.js'\nimport { overlayStack } from './OverlayStack.dev.js'\nimport { VirtualTrigger } from './VirtualTrigger.dev.js'\nimport { PlacementController } from './PlacementController.dev.js'\nimport type { ClickController } from './ClickController.dev.js'\nimport type { HoverController } from './HoverController.dev.js'\nimport type { LongpressController } from './LongpressController.dev.js'\nexport { LONGPRESS_INSTRUCTIONS } from './LongpressController.dev.js'\nimport { strategies } from './strategies.dev.js'\nimport {\n removeSlottableRequest,\n SlottableRequestEvent,\n} from './slottable-request-event.dev.js'\n\nimport styles from './overlay.css.js';\n\nconst supportsPopover = 'showPopover' in document.createElement('div');\n\nlet OverlayFeatures = OverlayDialog(AbstractOverlay);\n/* c8 ignore next 2 */\nif (supportsPopover) {\n OverlayFeatures = OverlayPopover(OverlayFeatures);\n} else {\n OverlayFeatures = OverlayNoPopover(OverlayFeatures);\n}\n\n/**\n * @element sp-overlay\n *\n * @fires sp-opened - announces that an overlay has completed any entry animations\n * @fires sp-closed - announce that an overlay has compelted any exit animations\n * @fires slottable-request - requests to add or remove slottable content\n */\nexport class Overlay extends OverlayFeatures {\n static override styles = [styles];\n\n /**\n * An Overlay that is `delayed` will wait until a warm-up period of 1000ms\n * has completed before opening. Once the warmup period has completed, all\n * subsequent Overlays will open immediately. When no Overlays are opened,\n * a cooldown period of 1000ms will begin. Once the cooldown has completed,\n * the next Overlay to be opened will be subject to the warm-up period if\n * provided that option.\n */\n @property({ type: Boolean })\n override get delayed(): boolean {\n return this.elements.at(-1)?.hasAttribute('delayed') || this._delayed;\n }\n\n override set delayed(delayed: boolean) {\n this._delayed = delayed;\n }\n\n private _delayed = false;\n\n @query('.dialog')\n override dialogEl!: HTMLDialogElement & {\n showPopover(): void;\n hidePopover(): void;\n };\n\n /**\n * Whether the overlay is currently functional or not\n */\n @property({ type: Boolean })\n override get disabled(): boolean {\n return this._disabled;\n }\n\n override set disabled(disabled: boolean) {\n this._disabled = disabled;\n if (disabled) {\n this.strategy?.abort();\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 @queryAssignedElements({\n flatten: true,\n selector: ':not([slot=\"longpress-describedby-descriptor\"], slot)', // gather only elements slotted into the default slot\n })\n override elements!: OpenableElement[];\n\n public parentOverlayToForceClose?: Overlay;\n\n private get hasNonVirtualTrigger(): boolean {\n return (\n !!this.triggerElement &&\n !(this.triggerElement instanceof VirtualTrigger)\n );\n }\n\n /**\n * The `offset` property accepts either a single number, to\n * define the offset of the Overlay along the main axis from\n * the trigger, or 2-tuple, to define the offset along the\n * main axis and the cross axis. This option has no effect\n * when there is no trigger element.\n */\n @property({ type: Number })\n override offset: number | [number, number] = 0;\n\n protected override get placementController(): PlacementController {\n if (!this._placementController) {\n this._placementController = new PlacementController(this);\n }\n return this._placementController;\n }\n\n /**\n * Whether the Overlay is projected onto the \"top layer\" or not.\n */\n @property({ type: Boolean, reflect: true })\n override get open(): boolean {\n return this._open;\n }\n\n override set open(open: boolean) {\n // Don't respond when disabled.\n if (open && this.disabled) return;\n // Don't respond when state not dirty\n if (open === this.open) return;\n // Don't respond when you're in the shadow on a longpress\n // Shadow occurs when the first \"click\" would normally close the popover\n if (this.strategy?.activelyOpening && !open) return;\n this._open = open;\n if (this.open) {\n Overlay.openCount += 1;\n }\n this.requestUpdate('open', !this.open);\n if (this.open) {\n this.requestSlottable();\n }\n }\n\n private _open = false;\n\n static openCount = 1;\n\n /**\n * Instruct the Overlay where to place itself in\n * relationship to the trigger element.\n * @type {\"top\" | \"top-start\" | \"top-end\" | \"right\" | \"right-start\" | \"right-end\" | \"bottom\" | \"bottom-start\" | \"bottom-end\" | \"left\" | \"left-start\" | \"left-end\"}\n */\n @property()\n override placement?: Placement;\n\n /**\n * The state in which the last `request-slottable` event was dispatched.\n * Do not allow overlays from dispatching the same state twice in a row.\n */\n private lastRequestSlottableState = false;\n\n /**\n * Whether to pass focus to the overlay once opened, or\n * to the appropriate value based on the \"type\" of the overlay\n * when set to `\"auto\"`.\n *\n */\n @property({ attribute: 'receives-focus' })\n override receivesFocus: 'true' | 'false' | 'auto' = 'auto';\n\n @query('slot')\n slotEl!: HTMLSlotElement;\n\n @state()\n override get state(): OverlayState {\n return this._state;\n }\n\n override set state(state) {\n if (state === this.state) return;\n const oldState = this.state;\n this._state = state;\n if (this.state === 'opened' || this.state === 'closed') {\n this.strategy?.shouldCompleteOpen();\n }\n this.requestUpdate('state', oldState);\n }\n\n override _state: OverlayState = 'closed';\n\n public strategy?: ClickController | HoverController | LongpressController;\n\n @property({ type: Number, attribute: 'tip-padding' })\n tipPadding?: number;\n\n /**\n * An optional ID reference for the trigger element combined with the optional\n * interaction (click | hover | longpress) by which the overlay shold open\n * the overlay with an `@`: e.g. `trigger@click` opens the overlay when an\n * element with the ID \"trigger\" is clicked.\n */\n @property()\n trigger?: string;\n\n /**\n * An element reference for the trigger element that the overlay should relate to.\n */\n @property({ attribute: false })\n override triggerElement: HTMLElement | VirtualTrigger | null = null;\n\n /**\n * The specific interaction to listen for on the `triggerElement` to open the overlay.\n */\n @property({ attribute: false })\n triggerInteraction?: TriggerInteraction;\n\n /**\n * Configures the open/close heuristics of the Overlay.\n * @type {\"auto\" | \"hint\" | \"manual\" | \"modal\" | \"page\"}\n */\n @property()\n override type: OverlayTypes = 'auto';\n\n protected wasOpen = false;\n\n protected override get elementResolver(): ElementResolutionController {\n if (!this._elementResolver) {\n this._elementResolver = new ElementResolutionController(this);\n }\n return this._elementResolver;\n }\n\n private get usesDialog(): boolean {\n return this.type === 'modal' || this.type === 'page';\n }\n\n private get popoverValue(): 'auto' | 'manual' | undefined {\n const hasPopoverAttribute = 'popover' in this;\n if (!hasPopoverAttribute) {\n return undefined;\n }\n /* c8 ignore next 9 */\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 protected get requiresPosition(): boolean {\n // Do not position \"page\" overlays as they should block the entire 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 automatically position content, unless it is a \"hint\".\n if (!this.triggerElement || (!this.placement && this.type !== 'hint'))\n return false;\n return true;\n }\n\n protected override 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 const tipPadding = this.tipPadding;\n\n this.placementController.placeOverlay(this.dialogEl, {\n offset,\n placement,\n tipPadding,\n trigger,\n type: this.type,\n });\n }\n\n protected override async managePopoverOpen(): Promise<void> {\n super.managePopoverOpen();\n const targetOpenState = this.open;\n /* c8 ignore next 3 */\n if (this.open !== targetOpenState) {\n return;\n }\n await this.manageDelay(targetOpenState);\n if (this.open !== targetOpenState) {\n return;\n }\n await this.ensureOnDOM(targetOpenState);\n /* c8 ignore next 3 */\n if (this.open !== targetOpenState) {\n return;\n }\n const focusEl = await this.makeTransition(targetOpenState);\n if (this.open !== targetOpenState) {\n return;\n }\n await this.applyFocus(targetOpenState, focusEl);\n }\n\n protected override async applyFocus(\n targetOpenState: boolean,\n focusEl: HTMLElement | null\n ): Promise<void> {\n // Do not move focus when explicitly told not to\n // and when the Overlay is a \"hint\"\n if (this.receivesFocus === 'false' || this.type === 'hint') {\n return;\n }\n\n await nextFrame();\n await nextFrame();\n if (targetOpenState === this.open && !this.open) {\n if (\n this.hasNonVirtualTrigger &&\n this.contains((this.getRootNode() as Document).activeElement)\n ) {\n (this.triggerElement as HTMLElement).focus();\n }\n return;\n }\n focusEl?.focus();\n }\n\n protected override returnFocus(): void {\n if (this.open || this.type === 'hint') return;\n\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 (currentNode?.shadowRoot?.activeElement) {\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.receivesFocus !== 'false' &&\n !!(this.triggerElement as HTMLElement)?.focus &&\n (this.contains((this.getRootNode() as Document).activeElement) ||\n getAncestors().includes(this) ||\n // eslint-disable-next-line @spectrum-web-components/document-active-element\n document.activeElement === document.body)\n ) {\n (this.triggerElement as HTMLElement).focus();\n }\n }\n\n private closeOnFocusOut = (event: FocusEvent): void => {\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 protected async manageOpen(oldOpen: boolean): Promise<void> {\n // The `.showPopover()` and `.showModal()` events will error on content that is not connected to the DOM.\n // Prevent from entering the manage workflow in order to avoid this.\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 if (this.open && this.state !== 'opened') {\n this.state = 'opening';\n } else if (!this.open && this.state !== 'closed') {\n this.state = 'closing';\n }\n\n if (this.usesDialog) {\n this.manageDialogOpen();\n } else {\n this.managePopoverOpen();\n }\n if (this.type === 'auto') {\n const listenerRoot = this.getRootNode() as Document;\n if (this.open) {\n listenerRoot.addEventListener(\n 'focusout',\n this.closeOnFocusOut,\n { capture: true }\n );\n } else {\n listenerRoot.removeEventListener(\n 'focusout',\n this.closeOnFocusOut,\n { capture: true }\n );\n }\n }\n }\n\n protected bindEvents(): void {\n this.strategy?.abort();\n this.strategy = undefined;\n if (!this.hasNonVirtualTrigger) return;\n if (!this.triggerInteraction) return;\n this.strategy = new strategies[this.triggerInteraction](\n this.triggerElement as HTMLElement,\n {\n overlay: this,\n }\n );\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 if (!this.strategy?.activelyOpening) {\n this.open = false;\n return;\n }\n this.manuallyKeepOpen();\n }\n\n public override manuallyKeepOpen(): void {\n this.open = true;\n this.placementController.allowPlacementUpdate = true;\n this.manageOpen(false);\n }\n\n protected handleSlotchange(): void {\n if (!this.elements.length) {\n this.strategy?.releaseDescription();\n } else if (this.hasNonVirtualTrigger) {\n this.strategy?.prepareDescription(\n this.triggerElement as HTMLElement\n );\n }\n }\n\n public shouldPreventClose(): boolean {\n const shouldPreventClose = this.willPreventClose;\n this.willPreventClose = false;\n return shouldPreventClose;\n }\n\n protected override requestSlottable(): void {\n if (this.lastRequestSlottableState === this.open) {\n return;\n }\n if (!this.open) {\n document.body.offsetHeight;\n }\n /**\n * @ignore\n */\n this.dispatchEvent(\n new SlottableRequestEvent(\n 'overlay-content',\n this.open ? {} : removeSlottableRequest\n )\n );\n this.lastRequestSlottableState = this.open;\n }\n\n override willUpdate(changes: PropertyValues): void {\n if (!this.hasAttribute('id')) {\n this.setAttribute(\n 'id',\n `${this.tagName.toLowerCase()}-${randomID()}`\n );\n }\n if (changes.has('open') && (this.hasUpdated || this.open)) {\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 // Merge multiple possible calls to `bindEvents()`.\n let oldTrigger: HTMLElement | false | undefined = false;\n if (changes.has(elementResolverUpdatedSymbol)) {\n oldTrigger = this.triggerElement as HTMLElement;\n this.triggerElement = this.elementResolver.element;\n }\n if (changes.has('triggerElement')) {\n oldTrigger = changes.get('triggerElement');\n }\n if (oldTrigger !== false) {\n this.bindEvents();\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 if (\n changes.has('state') &&\n this.state === 'closed' &&\n typeof changes.get('state') !== 'undefined'\n ) {\n this.placementController.clearOverlayPosition();\n }\n }\n\n protected renderContent(): TemplateResult {\n return html`\n <slot @slotchange=${this.handleSlotchange}></slot>\n `;\n }\n\n private get dialogStyleMap(): StyleInfo {\n return {\n '--swc-overlay-open-count': Overlay.openCount.toString(),\n };\n }\n\n protected renderDialog(): TemplateResult {\n /**\n * `--swc-overlay-open-count` is applied to mimic the single stack\n * nature of the top layer in browsers that do not yet support it.\n *\n * The value should always be the full number of overlays ever opened\n * which will be added to `--swc-overlay-z-index-base` which can be\n * provided by a consuming developer but defaults to 1000 to beat as\n * much stacking as possible durring fallback delivery.\n **/\n return html`\n <dialog\n class=\"dialog\"\n part=\"dialog\"\n placement=${ifDefined(\n this.requiresPosition\n ? this.placement || 'right'\n : undefined\n )}\n style=${styleMap(this.dialogStyleMap)}\n @close=${this.handleBrowserClose}\n @cancel=${this.handleBrowserClose}\n @beforetoggle=${this.handleBeforetoggle}\n ?is-visible=${this.state !== 'closed'}\n >\n ${this.renderContent()}\n </dialog>\n `;\n }\n\n protected renderPopover(): TemplateResult {\n /**\n * `--swc-overlay-open-count` is applied to mimic the single stack\n * nature of the top layer in browsers that do not yet support it.\n *\n * The value should always be the full number of overlays ever opened\n * which will be added to `--swc-overlay-z-index-base` which can be\n * provided by a consuming developer but defaults to 1000 to beat as\n * much stacking as possible durring fallback delivery.\n **/\n return html`\n <div\n class=\"dialog\"\n part=\"dialog\"\n placement=${ifDefined(\n this.requiresPosition\n ? this.placement || 'right'\n : undefined\n )}\n popover=${ifDefined(this.popoverValue)}\n style=${styleMap(this.dialogStyleMap)}\n @beforetoggle=${this.handleBeforetoggle}\n @close=${this.handleBrowserClose}\n ?is-visible=${this.state !== 'closed'}\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.hasUpdated) {\n this.bindEvents();\n }\n }\n\n override disconnectedCallback(): void {\n this.strategy?.releaseDescription();\n this.open = false;\n super.disconnectedCallback();\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAWA;AAAA,EACI;AAAA,OAGG;AACP;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP;AAAA,EACI;AAAA,EAEA;AAAA,OACG;AACP,SAAS,gBAAgB;AASzB,SAAS,iBAAiB,iBAAiB;AAC3C,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AAC/B,SAAS,2BAA2B;AAIpC,SAAS,8BAA8B;AACvC,SAAS,kBAAkB;AAC3B;AAAA,EACI;AAAA,EACA;AAAA,OACG;AAEP,OAAO,YAAY;AAEnB,MAAM,kBAAkB,iBAAiB,SAAS,cAAc,KAAK;AAErE,IAAI,kBAAkB,cAAc,eAAe;AAEnD,IAAI,iBAAiB;AACjB,oBAAkB,eAAe,eAAe;AACpD,OAAO;AACH,oBAAkB,iBAAiB,eAAe;AACtD;AASO,MAAM,WAAN,MAAM,iBAAgB,gBAAgB;AAAA,EAAtC;AAAA;AAoBH,SAAQ,WAAW;AA6BnB,SAAQ,YAAY;AAyBpB,SAAS,SAAoC;AAmC7C,SAAQ,QAAQ;AAgBhB;AAAA;AAAA;AAAA;AAAA,SAAQ,4BAA4B;AASpC,SAAS,gBAA2C;AAoBpD,SAAS,SAAuB;AAoBhC,SAAS,iBAAsD;AAa/D,SAAS,OAAqB;AAE9B,SAAU,UAAU;AA6IpB,SAAQ,kBAAkB,CAAC,UAA4B;AAEnD,UAAI,CAAC,MAAM,eAAe;AAEtB;AAAA,MACJ;AACA,YAAM,gBAAgB,IAAI,MAAM,0BAA0B;AAAA,QACtD,SAAS;AAAA,Q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AI,KAAK,SAAS,QAAQ;AACtB,YAAM,eAAe,KAAK,YAAY;AACtC,UAAI,KAAK,MAAM;AACX,qBAAa;AAAA,UACT;AAAA,UACA,KAAK;AAAA,UACL,EAAE,SAAS,KAAK;AAAA,QACpB;AAAA,MACJ,OAAO;AACH,qBAAa;AAAA,UACT;AAAA,UACA,KAAK;AAAA,UACL,EAAE,SAAS,KAAK;AAAA,QACpB;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AAAA,EAEU,aAAmB;AA1ejC;AA2eQ,eAAK,aAAL,mBAAe;AACf,SAAK,WAAW;AAChB,QAAI,CAAC,KAAK,qBAAsB;AAChC,QAAI,CAAC,KAAK,mBAAoB;AAC9B,SAAK,WAAW,IAAI,WAAW,KAAK,kBAAkB;AAAA,MAClD,KAAK;AAAA,MACL;AAAA,QACI,SAAS;AAAA,MACb;AAAA,IACJ;AAAA,EACJ;AAAA,EAEU,mBAAmB,OAA2C;AACpE,QAAI,MAAM,aAAa,QAAQ;AAC3B,WAAK,mBAAmB;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\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 {\n html,\n PropertyValues,\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 ElementResolutionController,\n elementResolverUpdatedSymbol,\n} from '@spectrum-web-components/reactive-controllers/src/ElementResolution.js';\nimport {\n ifDefined,\n StyleInfo,\n styleMap,\n} from '@spectrum-web-components/base/src/directives.js';\nimport { randomID } from '@spectrum-web-components/shared/src/random-id.js';\n\nimport type {\n OpenableElement,\n OverlayState,\n OverlayTypes,\n Placement,\n TriggerInteraction,\n} from './overlay-types.dev.js'\nimport { AbstractOverlay, nextFrame } from './AbstractOverlay.dev.js'\nimport { OverlayDialog } from './OverlayDialog.dev.js'\nimport { OverlayPopover } from './OverlayPopover.dev.js'\nimport { OverlayNoPopover } from './OverlayNoPopover.dev.js'\nimport { overlayStack } from './OverlayStack.dev.js'\nimport { VirtualTrigger } from './VirtualTrigger.dev.js'\nimport { PlacementController } from './PlacementController.dev.js'\nimport type { ClickController } from './ClickController.dev.js'\nimport type { HoverController } from './HoverController.dev.js'\nimport type { LongpressController } from './LongpressController.dev.js'\nexport { LONGPRESS_INSTRUCTIONS } from './LongpressController.dev.js'\nimport { strategies } from './strategies.dev.js'\nimport {\n removeSlottableRequest,\n SlottableRequestEvent,\n} from './slottable-request-event.dev.js'\n\nimport styles from './overlay.css.js';\n\nconst supportsPopover = 'showPopover' in document.createElement('div');\n\nlet OverlayFeatures = OverlayDialog(AbstractOverlay);\n/* c8 ignore next 2 */\nif (supportsPopover) {\n OverlayFeatures = OverlayPopover(OverlayFeatures);\n} else {\n OverlayFeatures = OverlayNoPopover(OverlayFeatures);\n}\n\n/**\n * @element sp-overlay\n *\n * @fires sp-opened - announces that an overlay has completed any entry animations\n * @fires sp-closed - announce that an overlay has compelted any exit animations\n * @fires slottable-request - requests to add or remove slottable content\n */\nexport class Overlay extends OverlayFeatures {\n static override styles = [styles];\n\n /**\n * An Overlay that is `delayed` will wait until a warm-up period of 1000ms\n * has completed before opening. Once the warmup period has completed, all\n * subsequent Overlays will open immediately. When no Overlays are opened,\n * a cooldown period of 1000ms will begin. Once the cooldown has completed,\n * the next Overlay to be opened will be subject to the warm-up period if\n * provided that option.\n */\n @property({ type: Boolean })\n override get delayed(): boolean {\n return this.elements.at(-1)?.hasAttribute('delayed') || this._delayed;\n }\n\n override set delayed(delayed: boolean) {\n this._delayed = delayed;\n }\n\n private _delayed = false;\n\n @query('.dialog')\n override dialogEl!: HTMLDialogElement & {\n showPopover(): void;\n hidePopover(): void;\n };\n\n /**\n * Whether the overlay is currently functional or not\n */\n @property({ type: Boolean })\n override get disabled(): boolean {\n return this._disabled;\n }\n\n override set disabled(disabled: boolean) {\n this._disabled = disabled;\n if (disabled) {\n this.strategy?.abort();\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 @queryAssignedElements({\n flatten: true,\n selector: ':not([slot=\"longpress-describedby-descriptor\"], slot)', // gather only elements slotted into the default slot\n })\n override elements!: OpenableElement[];\n\n public parentOverlayToForceClose?: Overlay;\n\n private get hasNonVirtualTrigger(): boolean {\n return (\n !!this.triggerElement &&\n !(this.triggerElement instanceof VirtualTrigger)\n );\n }\n\n /**\n * The `offset` property accepts either a single number, to\n * define the offset of the Overlay along the main axis from\n * the trigger, or 2-tuple, to define the offset along the\n * main axis and the cross axis. This option has no effect\n * when there is no trigger element.\n */\n @property({ type: Number })\n override offset: number | [number, number] = 0;\n\n protected override get placementController(): PlacementController {\n if (!this._placementController) {\n this._placementController = new PlacementController(this);\n }\n return this._placementController;\n }\n\n /**\n * Whether the Overlay is projected onto the \"top layer\" or not.\n */\n @property({ type: Boolean, reflect: true })\n override get open(): boolean {\n return this._open;\n }\n\n override set open(open: boolean) {\n // Don't respond when disabled.\n if (open && this.disabled) return;\n // Don't respond when state not dirty\n if (open === this.open) return;\n // Don't respond when you're in the shadow on a longpress\n // Shadow occurs when the first \"click\" would normally close the popover\n if (this.strategy?.activelyOpening && !open) return;\n this._open = open;\n if (this.open) {\n Overlay.openCount += 1;\n }\n this.requestUpdate('open', !this.open);\n if (this.open) {\n this.requestSlottable();\n }\n }\n\n private _open = false;\n\n static openCount = 1;\n\n /**\n * Instruct the Overlay where to place itself in\n * relationship to the trigger element.\n * @type {\"top\" | \"top-start\" | \"top-end\" | \"right\" | \"right-start\" | \"right-end\" | \"bottom\" | \"bottom-start\" | \"bottom-end\" | \"left\" | \"left-start\" | \"left-end\"}\n */\n @property()\n override placement?: Placement;\n\n /**\n * The state in which the last `request-slottable` event was dispatched.\n * Do not allow overlays from dispatching the same state twice in a row.\n */\n private lastRequestSlottableState = false;\n\n /**\n * Whether to pass focus to the overlay once opened, or\n * to the appropriate value based on the \"type\" of the overlay\n * when set to `\"auto\"`.\n *\n */\n @property({ attribute: 'receives-focus' })\n override receivesFocus: 'true' | 'false' | 'auto' = 'auto';\n\n @query('slot')\n slotEl!: HTMLSlotElement;\n\n @state()\n override get state(): OverlayState {\n return this._state;\n }\n\n override set state(state) {\n if (state === this.state) return;\n const oldState = this.state;\n this._state = state;\n if (this.state === 'opened' || this.state === 'closed') {\n this.strategy?.shouldCompleteOpen();\n }\n this.requestUpdate('state', oldState);\n }\n\n override _state: OverlayState = 'closed';\n\n public strategy?: ClickController | HoverController | LongpressController;\n\n @property({ type: Number, attribute: 'tip-padding' })\n tipPadding?: number;\n\n /**\n * An optional ID reference for the trigger element combined with the optional\n * interaction (click | hover | longpress) by which the overlay shold open\n * the overlay with an `@`: e.g. `trigger@click` opens the overlay when an\n * element with the ID \"trigger\" is clicked.\n */\n @property()\n trigger?: string;\n\n /**\n * An element reference for the trigger element that the overlay should relate to.\n */\n @property({ attribute: false })\n override triggerElement: HTMLElement | VirtualTrigger | null = null;\n\n /**\n * The specific interaction to listen for on the `triggerElement` to open the overlay.\n */\n @property({ attribute: false })\n triggerInteraction?: TriggerInteraction;\n\n /**\n * Configures the open/close heuristics of the Overlay.\n * @type {\"auto\" | \"hint\" | \"manual\" | \"modal\" | \"page\"}\n */\n @property()\n override type: OverlayTypes = 'auto';\n\n protected wasOpen = false;\n\n protected override get elementResolver(): ElementResolutionController {\n if (!this._elementResolver) {\n this._elementResolver = new ElementResolutionController(this);\n }\n return this._elementResolver;\n }\n\n private get usesDialog(): boolean {\n return this.type === 'modal' || this.type === 'page';\n }\n\n private get popoverValue(): 'auto' | 'manual' | undefined {\n const hasPopoverAttribute = 'popover' in this;\n if (!hasPopoverAttribute) {\n return undefined;\n }\n /* c8 ignore next 9 */\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 protected get requiresPosition(): boolean {\n // Do not position \"page\" overlays as they should block the entire 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 automatically position content, unless it is a \"hint\".\n if (!this.triggerElement || (!this.placement && this.type !== 'hint'))\n return false;\n return true;\n }\n\n protected override 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 const tipPadding = this.tipPadding;\n\n this.placementController.placeOverlay(this.dialogEl, {\n offset,\n placement,\n tipPadding,\n trigger,\n type: this.type,\n });\n }\n\n protected override async managePopoverOpen(): Promise<void> {\n super.managePopoverOpen();\n const targetOpenState = this.open;\n /* c8 ignore next 3 */\n if (this.open !== targetOpenState) {\n return;\n }\n await this.manageDelay(targetOpenState);\n if (this.open !== targetOpenState) {\n return;\n }\n await this.ensureOnDOM(targetOpenState);\n /* c8 ignore next 3 */\n if (this.open !== targetOpenState) {\n return;\n }\n const focusEl = await this.makeTransition(targetOpenState);\n if (this.open !== targetOpenState) {\n return;\n }\n await this.applyFocus(targetOpenState, focusEl);\n }\n\n protected override async applyFocus(\n targetOpenState: boolean,\n focusEl: HTMLElement | null\n ): Promise<void> {\n // Do not move focus when explicitly told not to\n // and when the Overlay is a \"hint\"\n if (this.receivesFocus === 'false' || this.type === 'hint') {\n return;\n }\n\n await nextFrame();\n await nextFrame();\n if (targetOpenState === this.open && !this.open) {\n if (\n this.hasNonVirtualTrigger &&\n this.contains((this.getRootNode() as Document).activeElement)\n ) {\n (this.triggerElement as HTMLElement).focus();\n }\n return;\n }\n focusEl?.focus();\n }\n\n protected override returnFocus(): void {\n if (this.open || this.type === 'hint') return;\n\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 (currentNode?.shadowRoot?.activeElement) {\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.receivesFocus !== 'false' &&\n !!(this.triggerElement as HTMLElement)?.focus &&\n (this.contains((this.getRootNode() as Document).activeElement) ||\n getAncestors().includes(this) ||\n // eslint-disable-next-line @spectrum-web-components/document-active-element\n document.activeElement === document.body)\n ) {\n (this.triggerElement as HTMLElement).focus();\n }\n }\n\n private closeOnFocusOut = (event: FocusEvent): void => {\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 protected async manageOpen(oldOpen: boolean): Promise<void> {\n // The `.showPopover()` and `.showModal()` events will error on content that is not connected to the DOM.\n // Prevent from entering the manage workflow in order to avoid this.\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 if (this.open && this.state !== 'opened') {\n this.state = 'opening';\n } else if (!this.open && this.state !== 'closed') {\n this.state = 'closing';\n }\n\n if (this.usesDialog) {\n this.manageDialogOpen();\n } else {\n this.managePopoverOpen();\n }\n if (this.type === 'auto') {\n const listenerRoot = this.getRootNode() as Document;\n if (this.open) {\n listenerRoot.addEventListener(\n 'focusout',\n this.closeOnFocusOut,\n { capture: true }\n );\n } else {\n listenerRoot.removeEventListener(\n 'focusout',\n this.closeOnFocusOut,\n { capture: true }\n );\n }\n }\n }\n\n protected bindEvents(): void {\n this.strategy?.abort();\n this.strategy = undefined;\n if (!this.hasNonVirtualTrigger) return;\n if (!this.triggerInteraction) return;\n this.strategy = new strategies[this.triggerInteraction](\n this.triggerElement as HTMLElement,\n {\n overlay: this,\n }\n );\n }\n\n protected handleBeforetoggle(event: Event & { newState: string }): void {\n if (event.newState !== 'open') {\n this.handleBrowserClose(event);\n }\n }\n\n protected handleBrowserClose(event: Event): void {\n event.stopPropagation();\n if (!this.strategy?.activelyOpening) {\n this.open = false;\n return;\n }\n this.manuallyKeepOpen();\n }\n\n public override manuallyKeepOpen(): void {\n this.open = true;\n this.placementController.allowPlacementUpdate = true;\n this.manageOpen(false);\n }\n\n protected handleSlotchange(): void {\n if (!this.elements.length) {\n this.strategy?.releaseDescription();\n } else if (this.hasNonVirtualTrigger) {\n this.strategy?.prepareDescription(\n this.triggerElement as HTMLElement\n );\n }\n }\n\n public shouldPreventClose(): boolean {\n const shouldPreventClose = this.willPreventClose;\n this.willPreventClose = false;\n return shouldPreventClose;\n }\n\n protected override requestSlottable(): void {\n if (this.lastRequestSlottableState === this.open) {\n return;\n }\n if (!this.open) {\n document.body.offsetHeight;\n }\n /**\n * @ignore\n */\n this.dispatchEvent(\n new SlottableRequestEvent(\n 'overlay-content',\n this.open ? {} : removeSlottableRequest\n )\n );\n this.lastRequestSlottableState = this.open;\n }\n\n override willUpdate(changes: PropertyValues): void {\n if (!this.hasAttribute('id')) {\n this.setAttribute(\n 'id',\n `${this.tagName.toLowerCase()}-${randomID()}`\n );\n }\n if (changes.has('open') && (this.hasUpdated || this.open)) {\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 // Merge multiple possible calls to `bindEvents()`.\n let oldTrigger: HTMLElement | false | undefined = false;\n if (changes.has(elementResolverUpdatedSymbol)) {\n oldTrigger = this.triggerElement as HTMLElement;\n this.triggerElement = this.elementResolver.element;\n }\n if (changes.has('triggerElement')) {\n oldTrigger = changes.get('triggerElement');\n }\n if (oldTrigger !== false) {\n this.bindEvents();\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 if (\n changes.has('state') &&\n this.state === 'closed' &&\n typeof changes.get('state') !== 'undefined'\n ) {\n this.placementController.clearOverlayPosition();\n }\n }\n\n protected renderContent(): TemplateResult {\n return html`\n <slot @slotchange=${this.handleSlotchange}></slot>\n `;\n }\n\n private get dialogStyleMap(): StyleInfo {\n return {\n '--swc-overlay-open-count': Overlay.openCount.toString(),\n };\n }\n\n protected renderDialog(): TemplateResult {\n /**\n * `--swc-overlay-open-count` is applied to mimic the single stack\n * nature of the top layer in browsers that do not yet support it.\n *\n * The value should always be the full number of overlays ever opened\n * which will be added to `--swc-overlay-z-index-base` which can be\n * provided by a consuming developer but defaults to 1000 to beat as\n * much stacking as possible durring fallback delivery.\n **/\n return html`\n <dialog\n class=\"dialog\"\n part=\"dialog\"\n placement=${ifDefined(\n this.requiresPosition\n ? this.placement || 'right'\n : undefined\n )}\n style=${styleMap(this.dialogStyleMap)}\n @close=${this.handleBrowserClose}\n @cancel=${this.handleBrowserClose}\n @beforetoggle=${this.handleBeforetoggle}\n ?is-visible=${this.state !== 'closed'}\n >\n ${this.renderContent()}\n </dialog>\n `;\n }\n\n protected renderPopover(): TemplateResult {\n /**\n * `--swc-overlay-open-count` is applied to mimic the single stack\n * nature of the top layer in browsers that do not yet support it.\n *\n * The value should always be the full number of overlays ever opened\n * which will be added to `--swc-overlay-z-index-base` which can be\n * provided by a consuming developer but defaults to 1000 to beat as\n * much stacking as possible durring fallback delivery.\n **/\n return html`\n <div\n class=\"dialog\"\n part=\"dialog\"\n placement=${ifDefined(\n this.requiresPosition\n ? this.placement || 'right'\n : undefined\n )}\n popover=${ifDefined(this.popoverValue)}\n style=${styleMap(this.dialogStyleMap)}\n @beforetoggle=${this.handleBeforetoggle}\n @close=${this.handleBrowserClose}\n ?is-visible=${this.state !== 'closed'}\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.hasUpdated) {\n this.bindEvents();\n }\n }\n\n override disconnectedCallback(): void {\n this.strategy?.releaseDescription();\n this.open = false;\n super.disconnectedCallback();\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAWA;AAAA,EACI;AAAA,OAGG;AACP;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP;AAAA,EACI;AAAA,EAEA;AAAA,OACG;AACP,SAAS,gBAAgB;AASzB,SAAS,iBAAiB,iBAAiB;AAC3C,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAA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A+GF,YAAY;AAnGN;AAAA,EADZ,SAAS,EAAE,MAAM,QAAQ,CAAC;AAAA,GAXlB,SAYI;AAWJ;AAAA,EADR,MAAM,SAAS;AAAA,GAtBP,SAuBA;AASI;AAAA,EADZ,SAAS,EAAE,MAAM,QAAQ,CAAC;AAAA,GA/BlB,SAgCI;AAuBJ;AAAA,EAJR,sBAAsB;AAAA,IACnB,SAAS;AAAA,IACT,UAAU;AAAA;AAAA,EACd,CAAC;AAAA,GAtDQ,SAuDA;AAmBA;AAAA,EADR,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAzEjB,SA0EA;AAaI;AAAA,EADZ,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAtFjC,SAuFI;AAgCJ;AAAA,EADR,SAAS;AAAA,GAtHD,SAuHA;AAeA;AAAA,EADR,SAAS,EAAE,WAAW,iBAAiB,CAAC;AAAA,GArIhC,SAsIA;AAGT;AAAA,EADC,MAAM,MAAM;AAAA,GAxIJ,SAyIT;AAGa;AAAA,EADZ,MAAM;AAAA,GA3IE,SA4II;AAmBb;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,WAAW,cAAc,CAAC;AAAA,GA9J3C,SA+JT;AASA;AAAA,EADC,SAAS;AAAA,GAvKD,SAwKT;AAMS;AAAA,EADR,SAAS,EAAE,WAAW,MAAM,CAAC;AAAA,GA7KrB,SA8KA;AAMT;AAAA,EADC,SAAS,EAAE,WAAW,MAAM,CAAC;AAAA,GAnLrB,SAoLT;AAOS;AAAA,EADR,SAAS;AAAA,GA1LD,SA2LA;AA3LN,WAAM,UAAN;",
|
|
6
6
|
"names": ["event", "state", "_a"]
|
|
7
7
|
}
|
package/src/Overlay.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var b=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var r=(u,a,e,t)=>{for(var o=t>1?void 0:t?E(a,e):a,s=u.length-1,l;s>=0;s--)(l=u[s])&&(o=(t?l(a,e,o):l(o))||o);return t&&o&&b(a,e,o),o};import{html as d}from"@spectrum-web-components/base";import{property as n,query as g,queryAssignedElements as C,state as P}from"@spectrum-web-components/base/src/decorators.js";import{ElementResolutionController as w,elementResolverUpdatedSymbol as T}from"@spectrum-web-components/reactive-controllers/src/ElementResolution.js";import{ifDefined as c,styleMap as f}from"@spectrum-web-components/base/src/directives.js";import{randomID as S}from"@spectrum-web-components/shared/src/random-id.js";import{AbstractOverlay as R,nextFrame as v}from"./AbstractOverlay.js";import{OverlayDialog as L}from"./OverlayDialog.js";import{OverlayPopover as O}from"./OverlayPopover.js";import{OverlayNoPopover as M}from"./OverlayNoPopover.js";import{overlayStack as y}from"./OverlayStack.js";import{VirtualTrigger as H}from"./VirtualTrigger.js";import{PlacementController as $}from"./PlacementController.js";export{LONGPRESS_INSTRUCTIONS}from"./LongpressController.js";import{strategies as D}from"./strategies.js";import{removeSlottableRequest as q,SlottableRequestEvent as N}from"./slottable-request-event.js";import F from"./overlay.css.js";const B="showPopover"in document.createElement("div");let p=L(R);B?p=O(p):p=M(p);const i=class i extends p{constructor(){super(...arguments);this._delayed=!1;this._disabled=!1;this.offset=0;this._open=!1;this.lastRequestSlottableState=!1;this.receivesFocus="auto";this._state="closed";this.triggerElement=null;this.type="auto";this.wasOpen=!1;this.closeOnFocusOut=e=>{if(!e.relatedTarget)return;const t=new Event("overlay-relation-query",{bubbles:!0,composed:!0});e.relatedTarget.addEventListener(t.type,o=>{o.composedPath().includes(this)||(this.open=!1)}),e.relatedTarget.dispatchEvent(t)}}get delayed(){var e;return((e=this.elements.at(-1))==null?void 0:e.hasAttribute("delayed"))||this._delayed}set delayed(e){this._delayed=e}get disabled(){return this._disabled}set disabled(e){var t;this._disabled=e,e?((t=this.strategy)==null||t.abort(),this.wasOpen=this.open,this.open=!1):(this.bindEvents(),this.open=this.open||this.wasOpen,this.wasOpen=!1)}get hasNonVirtualTrigger(){return!!this.triggerElement&&!(this.triggerElement instanceof H)}get placementController(){return this._placementController||(this._placementController=new $(this)),this._placementController}get open(){return this._open}set open(e){var t;e&&this.disabled||e!==this.open&&((t=this.strategy)!=null&&t.activelyOpening&&!e||(this._open=e,this.open&&(i.openCount+=1),this.requestUpdate("open",!this.open),this.open&&this.requestSlottable()))}get state(){return this._state}set state(e){var o;if(e===this.state)return;const t=this.state;this._state=e,(this.state==="opened"||this.state==="closed")&&((o=this.strategy)==null||o.shouldCompleteOpen()),this.requestUpdate("state",t)}get elementResolver(){return this._elementResolver||(this._elementResolver=new w(this)),this._elementResolver}get usesDialog(){return this.type==="modal"||this.type==="page"}get popoverValue(){if("popover"in this)switch(this.type){case"modal":case"page":return;case"hint":return"manual";default:return this.type}}get requiresPosition(){return!(this.type==="page"||!this.open||!this.triggerElement||!this.placement&&this.type!=="hint")}managePosition(){if(!this.requiresPosition||!this.open)return;const e=this.offset||0,t=this.triggerElement,o=this.placement||"right",s=this.tipPadding;this.placementController.placeOverlay(this.dialogEl,{offset:e,placement:o,tipPadding:s,trigger:t,type:this.type})}async managePopoverOpen(){super.managePopoverOpen();const e=this.open;if(this.open!==e||(await this.manageDelay(e),this.open!==e)||(await this.ensureOnDOM(e),this.open!==e))return;const t=await this.makeTransition(e);this.open===e&&await this.applyFocus(e,t)}async applyFocus(e,t){if(!(this.receivesFocus==="false"||this.type==="hint")){if(await v(),await v(),e===this.open&&!this.open){this.hasNonVirtualTrigger&&this.contains(this.getRootNode().activeElement)&&this.triggerElement.focus();return}t==null||t.focus()}}returnFocus(){var t;if(this.open||this.type==="hint")return;const e=()=>{var l,m;const o=[];let s=document.activeElement;for(;(l=s==null?void 0:s.shadowRoot)!=null&&l.activeElement;)s=s.shadowRoot.activeElement;for(;s;){const h=s.assignedSlot||s.parentElement||((m=s.getRootNode())==null?void 0:m.host);h&&o.push(h),s=h}return o};this.receivesFocus!=="false"&&((t=this.triggerElement)!=null&&t.focus)&&(this.contains(this.getRootNode().activeElement)||e().includes(this)||document.activeElement===document.body)&&this.triggerElement.focus()}async manageOpen(e){if(!(!this.isConnected&&this.open)&&(this.hasUpdated||await this.updateComplete,this.open?(y.add(this),this.willPreventClose&&(document.addEventListener("pointerup",()=>{this.dialogEl.classList.toggle("not-immediately-closable",!1),this.willPreventClose=!1},{once:!0}),this.dialogEl.classList.toggle("not-immediately-closable",!0))):(e&&this.dispose(),y.remove(this)),this.open&&this.state!=="opened"?this.state="opening":!this.open&&this.state!=="closed"&&(this.state="closing"),this.usesDialog?this.manageDialogOpen():this.managePopoverOpen(),this.type==="auto")){const t=this.getRootNode();this.open?t.addEventListener("focusout",this.closeOnFocusOut,{capture:!0}):t.removeEventListener("focusout",this.closeOnFocusOut,{capture:!0})}}bindEvents(){var e;(e=this.strategy)==null||e.abort(),this.strategy=void 0,this.hasNonVirtualTrigger&&this.triggerInteraction&&(this.strategy=new D[this.triggerInteraction](this.triggerElement,{overlay:this}))}handleBeforetoggle(e){e.newState!=="open"&&this.handleBrowserClose()}handleBrowserClose(){var
|
|
1
|
+
"use strict";var b=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var r=(u,a,e,t)=>{for(var o=t>1?void 0:t?E(a,e):a,s=u.length-1,l;s>=0;s--)(l=u[s])&&(o=(t?l(a,e,o):l(o))||o);return t&&o&&b(a,e,o),o};import{html as d}from"@spectrum-web-components/base";import{property as n,query as g,queryAssignedElements as C,state as P}from"@spectrum-web-components/base/src/decorators.js";import{ElementResolutionController as w,elementResolverUpdatedSymbol as T}from"@spectrum-web-components/reactive-controllers/src/ElementResolution.js";import{ifDefined as c,styleMap as f}from"@spectrum-web-components/base/src/directives.js";import{randomID as S}from"@spectrum-web-components/shared/src/random-id.js";import{AbstractOverlay as R,nextFrame as v}from"./AbstractOverlay.js";import{OverlayDialog as L}from"./OverlayDialog.js";import{OverlayPopover as O}from"./OverlayPopover.js";import{OverlayNoPopover as M}from"./OverlayNoPopover.js";import{overlayStack as y}from"./OverlayStack.js";import{VirtualTrigger as H}from"./VirtualTrigger.js";import{PlacementController as $}from"./PlacementController.js";export{LONGPRESS_INSTRUCTIONS}from"./LongpressController.js";import{strategies as D}from"./strategies.js";import{removeSlottableRequest as q,SlottableRequestEvent as N}from"./slottable-request-event.js";import F from"./overlay.css.js";const B="showPopover"in document.createElement("div");let p=L(R);B?p=O(p):p=M(p);const i=class i extends p{constructor(){super(...arguments);this._delayed=!1;this._disabled=!1;this.offset=0;this._open=!1;this.lastRequestSlottableState=!1;this.receivesFocus="auto";this._state="closed";this.triggerElement=null;this.type="auto";this.wasOpen=!1;this.closeOnFocusOut=e=>{if(!e.relatedTarget)return;const t=new Event("overlay-relation-query",{bubbles:!0,composed:!0});e.relatedTarget.addEventListener(t.type,o=>{o.composedPath().includes(this)||(this.open=!1)}),e.relatedTarget.dispatchEvent(t)}}get delayed(){var e;return((e=this.elements.at(-1))==null?void 0:e.hasAttribute("delayed"))||this._delayed}set delayed(e){this._delayed=e}get disabled(){return this._disabled}set disabled(e){var t;this._disabled=e,e?((t=this.strategy)==null||t.abort(),this.wasOpen=this.open,this.open=!1):(this.bindEvents(),this.open=this.open||this.wasOpen,this.wasOpen=!1)}get hasNonVirtualTrigger(){return!!this.triggerElement&&!(this.triggerElement instanceof H)}get placementController(){return this._placementController||(this._placementController=new $(this)),this._placementController}get open(){return this._open}set open(e){var t;e&&this.disabled||e!==this.open&&((t=this.strategy)!=null&&t.activelyOpening&&!e||(this._open=e,this.open&&(i.openCount+=1),this.requestUpdate("open",!this.open),this.open&&this.requestSlottable()))}get state(){return this._state}set state(e){var o;if(e===this.state)return;const t=this.state;this._state=e,(this.state==="opened"||this.state==="closed")&&((o=this.strategy)==null||o.shouldCompleteOpen()),this.requestUpdate("state",t)}get elementResolver(){return this._elementResolver||(this._elementResolver=new w(this)),this._elementResolver}get usesDialog(){return this.type==="modal"||this.type==="page"}get popoverValue(){if("popover"in this)switch(this.type){case"modal":case"page":return;case"hint":return"manual";default:return this.type}}get requiresPosition(){return!(this.type==="page"||!this.open||!this.triggerElement||!this.placement&&this.type!=="hint")}managePosition(){if(!this.requiresPosition||!this.open)return;const e=this.offset||0,t=this.triggerElement,o=this.placement||"right",s=this.tipPadding;this.placementController.placeOverlay(this.dialogEl,{offset:e,placement:o,tipPadding:s,trigger:t,type:this.type})}async managePopoverOpen(){super.managePopoverOpen();const e=this.open;if(this.open!==e||(await this.manageDelay(e),this.open!==e)||(await this.ensureOnDOM(e),this.open!==e))return;const t=await this.makeTransition(e);this.open===e&&await this.applyFocus(e,t)}async applyFocus(e,t){if(!(this.receivesFocus==="false"||this.type==="hint")){if(await v(),await v(),e===this.open&&!this.open){this.hasNonVirtualTrigger&&this.contains(this.getRootNode().activeElement)&&this.triggerElement.focus();return}t==null||t.focus()}}returnFocus(){var t;if(this.open||this.type==="hint")return;const e=()=>{var l,m;const o=[];let s=document.activeElement;for(;(l=s==null?void 0:s.shadowRoot)!=null&&l.activeElement;)s=s.shadowRoot.activeElement;for(;s;){const h=s.assignedSlot||s.parentElement||((m=s.getRootNode())==null?void 0:m.host);h&&o.push(h),s=h}return o};this.receivesFocus!=="false"&&((t=this.triggerElement)!=null&&t.focus)&&(this.contains(this.getRootNode().activeElement)||e().includes(this)||document.activeElement===document.body)&&this.triggerElement.focus()}async manageOpen(e){if(!(!this.isConnected&&this.open)&&(this.hasUpdated||await this.updateComplete,this.open?(y.add(this),this.willPreventClose&&(document.addEventListener("pointerup",()=>{this.dialogEl.classList.toggle("not-immediately-closable",!1),this.willPreventClose=!1},{once:!0}),this.dialogEl.classList.toggle("not-immediately-closable",!0))):(e&&this.dispose(),y.remove(this)),this.open&&this.state!=="opened"?this.state="opening":!this.open&&this.state!=="closed"&&(this.state="closing"),this.usesDialog?this.manageDialogOpen():this.managePopoverOpen(),this.type==="auto")){const t=this.getRootNode();this.open?t.addEventListener("focusout",this.closeOnFocusOut,{capture:!0}):t.removeEventListener("focusout",this.closeOnFocusOut,{capture:!0})}}bindEvents(){var e;(e=this.strategy)==null||e.abort(),this.strategy=void 0,this.hasNonVirtualTrigger&&this.triggerInteraction&&(this.strategy=new D[this.triggerInteraction](this.triggerElement,{overlay:this}))}handleBeforetoggle(e){e.newState!=="open"&&this.handleBrowserClose(e)}handleBrowserClose(e){var t;if(e.stopPropagation(),!((t=this.strategy)!=null&&t.activelyOpening)){this.open=!1;return}this.manuallyKeepOpen()}manuallyKeepOpen(){this.open=!0,this.placementController.allowPlacementUpdate=!0,this.manageOpen(!1)}handleSlotchange(){var e,t;this.elements.length?this.hasNonVirtualTrigger&&((t=this.strategy)==null||t.prepareDescription(this.triggerElement)):(e=this.strategy)==null||e.releaseDescription()}shouldPreventClose(){const e=this.willPreventClose;return this.willPreventClose=!1,e}requestSlottable(){this.lastRequestSlottableState!==this.open&&(this.open||document.body.offsetHeight,this.dispatchEvent(new N("overlay-content",this.open?{}:q)),this.lastRequestSlottableState=this.open)}willUpdate(e){var o;if(this.hasAttribute("id")||this.setAttribute("id",`${this.tagName.toLowerCase()}-${S()}`),e.has("open")&&(this.hasUpdated||this.open)&&this.manageOpen(e.get("open")),e.has("trigger")){const[s,l]=((o=this.trigger)==null?void 0:o.split("@"))||[];this.elementResolver.selector=s?`#${s}`:"",this.triggerInteraction=l}let t=!1;e.has(T)&&(t=this.triggerElement,this.triggerElement=this.elementResolver.element),e.has("triggerElement")&&(t=e.get("triggerElement")),t!==!1&&this.bindEvents()}updated(e){super.updated(e),e.has("placement")&&(this.placement?this.dialogEl.setAttribute("actual-placement",this.placement):this.dialogEl.removeAttribute("actual-placement"),this.open&&typeof e.get("placement")!="undefined"&&this.placementController.resetOverlayPosition()),e.has("state")&&this.state==="closed"&&typeof e.get("state")!="undefined"&&this.placementController.clearOverlayPosition()}renderContent(){return d`
|
|
2
2
|
<slot @slotchange=${this.handleSlotchange}></slot>
|
|
3
3
|
`}get dialogStyleMap(){return{"--swc-overlay-open-count":i.openCount.toString()}}renderDialog(){return d`
|
|
4
4
|
<dialog
|
package/src/Overlay.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Overlay.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 {\n html,\n PropertyValues,\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 ElementResolutionController,\n elementResolverUpdatedSymbol,\n} from '@spectrum-web-components/reactive-controllers/src/ElementResolution.js';\nimport {\n ifDefined,\n StyleInfo,\n styleMap,\n} from '@spectrum-web-components/base/src/directives.js';\nimport { randomID } from '@spectrum-web-components/shared/src/random-id.js';\n\nimport type {\n OpenableElement,\n OverlayState,\n OverlayTypes,\n Placement,\n TriggerInteraction,\n} from './overlay-types.js';\nimport { AbstractOverlay, nextFrame } from './AbstractOverlay.js';\nimport { OverlayDialog } from './OverlayDialog.js';\nimport { OverlayPopover } from './OverlayPopover.js';\nimport { OverlayNoPopover } from './OverlayNoPopover.js';\nimport { overlayStack } from './OverlayStack.js';\nimport { VirtualTrigger } from './VirtualTrigger.js';\nimport { PlacementController } from './PlacementController.js';\nimport type { ClickController } from './ClickController.js';\nimport type { HoverController } from './HoverController.js';\nimport type { LongpressController } from './LongpressController.js';\nexport { LONGPRESS_INSTRUCTIONS } from './LongpressController.js';\nimport { strategies } from './strategies.js';\nimport {\n removeSlottableRequest,\n SlottableRequestEvent,\n} from './slottable-request-event.js';\n\nimport styles from './overlay.css.js';\n\nconst supportsPopover = 'showPopover' in document.createElement('div');\n\nlet OverlayFeatures = OverlayDialog(AbstractOverlay);\n/* c8 ignore next 2 */\nif (supportsPopover) {\n OverlayFeatures = OverlayPopover(OverlayFeatures);\n} else {\n OverlayFeatures = OverlayNoPopover(OverlayFeatures);\n}\n\n/**\n * @element sp-overlay\n *\n * @fires sp-opened - announces that an overlay has completed any entry animations\n * @fires sp-closed - announce that an overlay has compelted any exit animations\n * @fires slottable-request - requests to add or remove slottable content\n */\nexport class Overlay extends OverlayFeatures {\n static override styles = [styles];\n\n /**\n * An Overlay that is `delayed` will wait until a warm-up period of 1000ms\n * has completed before opening. Once the warmup period has completed, all\n * subsequent Overlays will open immediately. When no Overlays are opened,\n * a cooldown period of 1000ms will begin. Once the cooldown has completed,\n * the next Overlay to be opened will be subject to the warm-up period if\n * provided that option.\n */\n @property({ type: Boolean })\n override get delayed(): boolean {\n return this.elements.at(-1)?.hasAttribute('delayed') || this._delayed;\n }\n\n override set delayed(delayed: boolean) {\n this._delayed = delayed;\n }\n\n private _delayed = false;\n\n @query('.dialog')\n override dialogEl!: HTMLDialogElement & {\n showPopover(): void;\n hidePopover(): void;\n };\n\n /**\n * Whether the overlay is currently functional or not\n */\n @property({ type: Boolean })\n override get disabled(): boolean {\n return this._disabled;\n }\n\n override set disabled(disabled: boolean) {\n this._disabled = disabled;\n if (disabled) {\n this.strategy?.abort();\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 @queryAssignedElements({\n flatten: true,\n selector: ':not([slot=\"longpress-describedby-descriptor\"], slot)', // gather only elements slotted into the default slot\n })\n override elements!: OpenableElement[];\n\n public parentOverlayToForceClose?: Overlay;\n\n private get hasNonVirtualTrigger(): boolean {\n return (\n !!this.triggerElement &&\n !(this.triggerElement instanceof VirtualTrigger)\n );\n }\n\n /**\n * The `offset` property accepts either a single number, to\n * define the offset of the Overlay along the main axis from\n * the trigger, or 2-tuple, to define the offset along the\n * main axis and the cross axis. This option has no effect\n * when there is no trigger element.\n */\n @property({ type: Number })\n override offset: number | [number, number] = 0;\n\n protected override get placementController(): PlacementController {\n if (!this._placementController) {\n this._placementController = new PlacementController(this);\n }\n return this._placementController;\n }\n\n /**\n * Whether the Overlay is projected onto the \"top layer\" or not.\n */\n @property({ type: Boolean, reflect: true })\n override get open(): boolean {\n return this._open;\n }\n\n override set open(open: boolean) {\n // Don't respond when disabled.\n if (open && this.disabled) return;\n // Don't respond when state not dirty\n if (open === this.open) return;\n // Don't respond when you're in the shadow on a longpress\n // Shadow occurs when the first \"click\" would normally close the popover\n if (this.strategy?.activelyOpening && !open) return;\n this._open = open;\n if (this.open) {\n Overlay.openCount += 1;\n }\n this.requestUpdate('open', !this.open);\n if (this.open) {\n this.requestSlottable();\n }\n }\n\n private _open = false;\n\n static openCount = 1;\n\n /**\n * Instruct the Overlay where to place itself in\n * relationship to the trigger element.\n * @type {\"top\" | \"top-start\" | \"top-end\" | \"right\" | \"right-start\" | \"right-end\" | \"bottom\" | \"bottom-start\" | \"bottom-end\" | \"left\" | \"left-start\" | \"left-end\"}\n */\n @property()\n override placement?: Placement;\n\n /**\n * The state in which the last `request-slottable` event was dispatched.\n * Do not allow overlays from dispatching the same state twice in a row.\n */\n private lastRequestSlottableState = false;\n\n /**\n * Whether to pass focus to the overlay once opened, or\n * to the appropriate value based on the \"type\" of the overlay\n * when set to `\"auto\"`.\n *\n */\n @property({ attribute: 'receives-focus' })\n override receivesFocus: 'true' | 'false' | 'auto' = 'auto';\n\n @query('slot')\n slotEl!: HTMLSlotElement;\n\n @state()\n override get state(): OverlayState {\n return this._state;\n }\n\n override set state(state) {\n if (state === this.state) return;\n const oldState = this.state;\n this._state = state;\n if (this.state === 'opened' || this.state === 'closed') {\n this.strategy?.shouldCompleteOpen();\n }\n this.requestUpdate('state', oldState);\n }\n\n override _state: OverlayState = 'closed';\n\n public strategy?: ClickController | HoverController | LongpressController;\n\n @property({ type: Number, attribute: 'tip-padding' })\n tipPadding?: number;\n\n /**\n * An optional ID reference for the trigger element combined with the optional\n * interaction (click | hover | longpress) by which the overlay shold open\n * the overlay with an `@`: e.g. `trigger@click` opens the overlay when an\n * element with the ID \"trigger\" is clicked.\n */\n @property()\n trigger?: string;\n\n /**\n * An element reference for the trigger element that the overlay should relate to.\n */\n @property({ attribute: false })\n override triggerElement: HTMLElement | VirtualTrigger | null = null;\n\n /**\n * The specific interaction to listen for on the `triggerElement` to open the overlay.\n */\n @property({ attribute: false })\n triggerInteraction?: TriggerInteraction;\n\n /**\n * Configures the open/close heuristics of the Overlay.\n * @type {\"auto\" | \"hint\" | \"manual\" | \"modal\" | \"page\"}\n */\n @property()\n override type: OverlayTypes = 'auto';\n\n protected wasOpen = false;\n\n protected override get elementResolver(): ElementResolutionController {\n if (!this._elementResolver) {\n this._elementResolver = new ElementResolutionController(this);\n }\n return this._elementResolver;\n }\n\n private get usesDialog(): boolean {\n return this.type === 'modal' || this.type === 'page';\n }\n\n private get popoverValue(): 'auto' | 'manual' | undefined {\n const hasPopoverAttribute = 'popover' in this;\n if (!hasPopoverAttribute) {\n return undefined;\n }\n /* c8 ignore next 9 */\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 protected get requiresPosition(): boolean {\n // Do not position \"page\" overlays as they should block the entire 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 automatically position content, unless it is a \"hint\".\n if (!this.triggerElement || (!this.placement && this.type !== 'hint'))\n return false;\n return true;\n }\n\n protected override 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 const tipPadding = this.tipPadding;\n\n this.placementController.placeOverlay(this.dialogEl, {\n offset,\n placement,\n tipPadding,\n trigger,\n type: this.type,\n });\n }\n\n protected override async managePopoverOpen(): Promise<void> {\n super.managePopoverOpen();\n const targetOpenState = this.open;\n /* c8 ignore next 3 */\n if (this.open !== targetOpenState) {\n return;\n }\n await this.manageDelay(targetOpenState);\n if (this.open !== targetOpenState) {\n return;\n }\n await this.ensureOnDOM(targetOpenState);\n /* c8 ignore next 3 */\n if (this.open !== targetOpenState) {\n return;\n }\n const focusEl = await this.makeTransition(targetOpenState);\n if (this.open !== targetOpenState) {\n return;\n }\n await this.applyFocus(targetOpenState, focusEl);\n }\n\n protected override async applyFocus(\n targetOpenState: boolean,\n focusEl: HTMLElement | null\n ): Promise<void> {\n // Do not move focus when explicitly told not to\n // and when the Overlay is a \"hint\"\n if (this.receivesFocus === 'false' || this.type === 'hint') {\n return;\n }\n\n await nextFrame();\n await nextFrame();\n if (targetOpenState === this.open && !this.open) {\n if (\n this.hasNonVirtualTrigger &&\n this.contains((this.getRootNode() as Document).activeElement)\n ) {\n (this.triggerElement as HTMLElement).focus();\n }\n return;\n }\n focusEl?.focus();\n }\n\n protected override returnFocus(): void {\n if (this.open || this.type === 'hint') return;\n\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 (currentNode?.shadowRoot?.activeElement) {\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.receivesFocus !== 'false' &&\n !!(this.triggerElement as HTMLElement)?.focus &&\n (this.contains((this.getRootNode() as Document).activeElement) ||\n getAncestors().includes(this) ||\n // eslint-disable-next-line @spectrum-web-components/document-active-element\n document.activeElement === document.body)\n ) {\n (this.triggerElement as HTMLElement).focus();\n }\n }\n\n private closeOnFocusOut = (event: FocusEvent): void => {\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 protected async manageOpen(oldOpen: boolean): Promise<void> {\n // The `.showPopover()` and `.showModal()` events will error on content that is not connected to the DOM.\n // Prevent from entering the manage workflow in order to avoid this.\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 if (this.open && this.state !== 'opened') {\n this.state = 'opening';\n } else if (!this.open && this.state !== 'closed') {\n this.state = 'closing';\n }\n\n if (this.usesDialog) {\n this.manageDialogOpen();\n } else {\n this.managePopoverOpen();\n }\n if (this.type === 'auto') {\n const listenerRoot = this.getRootNode() as Document;\n if (this.open) {\n listenerRoot.addEventListener(\n 'focusout',\n this.closeOnFocusOut,\n { capture: true }\n );\n } else {\n listenerRoot.removeEventListener(\n 'focusout',\n this.closeOnFocusOut,\n { capture: true }\n );\n }\n }\n }\n\n protected bindEvents(): void {\n this.strategy?.abort();\n this.strategy = undefined;\n if (!this.hasNonVirtualTrigger) return;\n if (!this.triggerInteraction) return;\n this.strategy = new strategies[this.triggerInteraction](\n this.triggerElement as HTMLElement,\n {\n overlay: this,\n }\n );\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 if (!this.strategy?.activelyOpening) {\n this.open = false;\n return;\n }\n this.manuallyKeepOpen();\n }\n\n public override manuallyKeepOpen(): void {\n this.open = true;\n this.placementController.allowPlacementUpdate = true;\n this.manageOpen(false);\n }\n\n protected handleSlotchange(): void {\n if (!this.elements.length) {\n this.strategy?.releaseDescription();\n } else if (this.hasNonVirtualTrigger) {\n this.strategy?.prepareDescription(\n this.triggerElement as HTMLElement\n );\n }\n }\n\n public shouldPreventClose(): boolean {\n const shouldPreventClose = this.willPreventClose;\n this.willPreventClose = false;\n return shouldPreventClose;\n }\n\n protected override requestSlottable(): void {\n if (this.lastRequestSlottableState === this.open) {\n return;\n }\n if (!this.open) {\n document.body.offsetHeight;\n }\n /**\n * @ignore\n */\n this.dispatchEvent(\n new SlottableRequestEvent(\n 'overlay-content',\n this.open ? {} : removeSlottableRequest\n )\n );\n this.lastRequestSlottableState = this.open;\n }\n\n override willUpdate(changes: PropertyValues): void {\n if (!this.hasAttribute('id')) {\n this.setAttribute(\n 'id',\n `${this.tagName.toLowerCase()}-${randomID()}`\n );\n }\n if (changes.has('open') && (this.hasUpdated || this.open)) {\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 // Merge multiple possible calls to `bindEvents()`.\n let oldTrigger: HTMLElement | false | undefined = false;\n if (changes.has(elementResolverUpdatedSymbol)) {\n oldTrigger = this.triggerElement as HTMLElement;\n this.triggerElement = this.elementResolver.element;\n }\n if (changes.has('triggerElement')) {\n oldTrigger = changes.get('triggerElement');\n }\n if (oldTrigger !== false) {\n this.bindEvents();\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 if (\n changes.has('state') &&\n this.state === 'closed' &&\n typeof changes.get('state') !== 'undefined'\n ) {\n this.placementController.clearOverlayPosition();\n }\n }\n\n protected renderContent(): TemplateResult {\n return html`\n <slot @slotchange=${this.handleSlotchange}></slot>\n `;\n }\n\n private get dialogStyleMap(): StyleInfo {\n return {\n '--swc-overlay-open-count': Overlay.openCount.toString(),\n };\n }\n\n protected renderDialog(): TemplateResult {\n /**\n * `--swc-overlay-open-count` is applied to mimic the single stack\n * nature of the top layer in browsers that do not yet support it.\n *\n * The value should always be the full number of overlays ever opened\n * which will be added to `--swc-overlay-z-index-base` which can be\n * provided by a consuming developer but defaults to 1000 to beat as\n * much stacking as possible durring fallback delivery.\n **/\n return html`\n <dialog\n class=\"dialog\"\n part=\"dialog\"\n placement=${ifDefined(\n this.requiresPosition\n ? this.placement || 'right'\n : undefined\n )}\n style=${styleMap(this.dialogStyleMap)}\n @close=${this.handleBrowserClose}\n @cancel=${this.handleBrowserClose}\n @beforetoggle=${this.handleBeforetoggle}\n ?is-visible=${this.state !== 'closed'}\n >\n ${this.renderContent()}\n </dialog>\n `;\n }\n\n protected renderPopover(): TemplateResult {\n /**\n * `--swc-overlay-open-count` is applied to mimic the single stack\n * nature of the top layer in browsers that do not yet support it.\n *\n * The value should always be the full number of overlays ever opened\n * which will be added to `--swc-overlay-z-index-base` which can be\n * provided by a consuming developer but defaults to 1000 to beat as\n * much stacking as possible durring fallback delivery.\n **/\n return html`\n <div\n class=\"dialog\"\n part=\"dialog\"\n placement=${ifDefined(\n this.requiresPosition\n ? this.placement || 'right'\n : undefined\n )}\n popover=${ifDefined(this.popoverValue)}\n style=${styleMap(this.dialogStyleMap)}\n @beforetoggle=${this.handleBeforetoggle}\n @close=${this.handleBrowserClose}\n ?is-visible=${this.state !== 'closed'}\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.hasUpdated) {\n this.bindEvents();\n }\n }\n\n override disconnectedCallback(): void {\n this.strategy?.releaseDescription();\n this.open = false;\n super.disconnectedCallback();\n }\n}\n"],
|
|
5
|
-
"mappings": "qNAWA,OACI,QAAAA,MAGG,gCACP,OACI,YAAAC,EACA,SAAAC,EACA,yBAAAC,EACA,SAAAC,MACG,kDACP,OACI,+BAAAC,EACA,gCAAAC,MACG,yEACP,OACI,aAAAC,EAEA,YAAAC,MACG,kDACP,OAAS,YAAAC,MAAgB,mDASzB,OAAS,mBAAAC,EAAiB,aAAAC,MAAiB,uBAC3C,OAAS,iBAAAC,MAAqB,qBAC9B,OAAS,kBAAAC,MAAsB,sBAC/B,OAAS,oBAAAC,MAAwB,wBACjC,OAAS,gBAAAC,MAAoB,oBAC7B,OAAS,kBAAAC,MAAsB,sBAC/B,OAAS,uBAAAC,MAA2B,2BAIpC,OAAS,2BAA8B,2BACvC,OAAS,cAAAC,MAAkB,kBAC3B,OACI,0BAAAC,EACA,yBAAAC,MACG,+BAEP,OAAOC,MAAY,mBAEnB,MAAMC,EAAkB,gBAAiB,SAAS,cAAc,KAAK,EAErE,IAAIC,EAAkBX,EAAcF,CAAe,EAE/CY,EACAC,EAAkBV,EAAeU,CAAe,EAEhDA,EAAkBT,EAAiBS,CAAe,EAU/C,MAAMC,EAAN,MAAMA,UAAgBD,CAAgB,CAAtC,kCAoBH,KAAQ,SAAW,GA6BnB,KAAQ,UAAY,GAyBpB,KAAS,OAAoC,EAmC7C,KAAQ,MAAQ,GAgBhB,KAAQ,0BAA4B,GASpC,KAAS,cAA2C,OAoBpD,KAAS,OAAuB,SAoBhC,KAAS,eAAsD,KAa/D,KAAS,KAAqB,OAE9B,KAAU,QAAU,GA6IpB,KAAQ,gBAAmBE,GA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,EACA,KAAK,iBAAmB,EAC5B,EACA,CAAE,KAAM,EAAK,CACjB,EACA,KAAK,SAAS,UAAU,OACpB,2BACA,EACJ,KAGA4B,GACA,KAAK,QAAQ,EAEjB5B,EAAa,OAAO,IAAI,GAExB,KAAK,MAAQ,KAAK,QAAU,SAC5B,KAAK,MAAQ,UACN,CAAC,KAAK,MAAQ,KAAK,QAAU,WACpC,KAAK,MAAQ,WAGb,KAAK,WACL,KAAK,iBAAiB,EAEtB,KAAK,kBAAkB,EAEvB,KAAK,OAAS,QAAQ,CACtB,MAAM6B,EAAe,KAAK,YAAY,EAClC,KAAK,KACLA,EAAa,iBACT,WACA,KAAK,gBACL,CAAE,QAAS,EAAK,CACpB,EAEAA,EAAa,oBACT,WACA,KAAK,gBACL,CAAE,QAAS,EAAK,CACpB,CAER,CACJ,CAEU,YAAmB,CA1ejC,IAAAjB,GA2eQA,EAAA,KAAK,WAAL,MAAAA,EAAe,QACf,KAAK,SAAW,OACX,KAAK,sBACL,KAAK,qBACV,KAAK,SAAW,IAAIT,EAAW,KAAK,kBAAkB,EAClD,KAAK,eACL,CACI,QAAS,IACb,CACJ,EACJ,CAEU,mBAAmBO,EAA2C,CAChEA,EAAM,WAAa,QACnB,KAAK,
|
|
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 {\n html,\n PropertyValues,\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 ElementResolutionController,\n elementResolverUpdatedSymbol,\n} from '@spectrum-web-components/reactive-controllers/src/ElementResolution.js';\nimport {\n ifDefined,\n StyleInfo,\n styleMap,\n} from '@spectrum-web-components/base/src/directives.js';\nimport { randomID } from '@spectrum-web-components/shared/src/random-id.js';\n\nimport type {\n OpenableElement,\n OverlayState,\n OverlayTypes,\n Placement,\n TriggerInteraction,\n} from './overlay-types.js';\nimport { AbstractOverlay, nextFrame } from './AbstractOverlay.js';\nimport { OverlayDialog } from './OverlayDialog.js';\nimport { OverlayPopover } from './OverlayPopover.js';\nimport { OverlayNoPopover } from './OverlayNoPopover.js';\nimport { overlayStack } from './OverlayStack.js';\nimport { VirtualTrigger } from './VirtualTrigger.js';\nimport { PlacementController } from './PlacementController.js';\nimport type { ClickController } from './ClickController.js';\nimport type { HoverController } from './HoverController.js';\nimport type { LongpressController } from './LongpressController.js';\nexport { LONGPRESS_INSTRUCTIONS } from './LongpressController.js';\nimport { strategies } from './strategies.js';\nimport {\n removeSlottableRequest,\n SlottableRequestEvent,\n} from './slottable-request-event.js';\n\nimport styles from './overlay.css.js';\n\nconst supportsPopover = 'showPopover' in document.createElement('div');\n\nlet OverlayFeatures = OverlayDialog(AbstractOverlay);\n/* c8 ignore next 2 */\nif (supportsPopover) {\n OverlayFeatures = OverlayPopover(OverlayFeatures);\n} else {\n OverlayFeatures = OverlayNoPopover(OverlayFeatures);\n}\n\n/**\n * @element sp-overlay\n *\n * @fires sp-opened - announces that an overlay has completed any entry animations\n * @fires sp-closed - announce that an overlay has compelted any exit animations\n * @fires slottable-request - requests to add or remove slottable content\n */\nexport class Overlay extends OverlayFeatures {\n static override styles = [styles];\n\n /**\n * An Overlay that is `delayed` will wait until a warm-up period of 1000ms\n * has completed before opening. Once the warmup period has completed, all\n * subsequent Overlays will open immediately. When no Overlays are opened,\n * a cooldown period of 1000ms will begin. Once the cooldown has completed,\n * the next Overlay to be opened will be subject to the warm-up period if\n * provided that option.\n */\n @property({ type: Boolean })\n override get delayed(): boolean {\n return this.elements.at(-1)?.hasAttribute('delayed') || this._delayed;\n }\n\n override set delayed(delayed: boolean) {\n this._delayed = delayed;\n }\n\n private _delayed = false;\n\n @query('.dialog')\n override dialogEl!: HTMLDialogElement & {\n showPopover(): void;\n hidePopover(): void;\n };\n\n /**\n * Whether the overlay is currently functional or not\n */\n @property({ type: Boolean })\n override get disabled(): boolean {\n return this._disabled;\n }\n\n override set disabled(disabled: boolean) {\n this._disabled = disabled;\n if (disabled) {\n this.strategy?.abort();\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 @queryAssignedElements({\n flatten: true,\n selector: ':not([slot=\"longpress-describedby-descriptor\"], slot)', // gather only elements slotted into the default slot\n })\n override elements!: OpenableElement[];\n\n public parentOverlayToForceClose?: Overlay;\n\n private get hasNonVirtualTrigger(): boolean {\n return (\n !!this.triggerElement &&\n !(this.triggerElement instanceof VirtualTrigger)\n );\n }\n\n /**\n * The `offset` property accepts either a single number, to\n * define the offset of the Overlay along the main axis from\n * the trigger, or 2-tuple, to define the offset along the\n * main axis and the cross axis. This option has no effect\n * when there is no trigger element.\n */\n @property({ type: Number })\n override offset: number | [number, number] = 0;\n\n protected override get placementController(): PlacementController {\n if (!this._placementController) {\n this._placementController = new PlacementController(this);\n }\n return this._placementController;\n }\n\n /**\n * Whether the Overlay is projected onto the \"top layer\" or not.\n */\n @property({ type: Boolean, reflect: true })\n override get open(): boolean {\n return this._open;\n }\n\n override set open(open: boolean) {\n // Don't respond when disabled.\n if (open && this.disabled) return;\n // Don't respond when state not dirty\n if (open === this.open) return;\n // Don't respond when you're in the shadow on a longpress\n // Shadow occurs when the first \"click\" would normally close the popover\n if (this.strategy?.activelyOpening && !open) return;\n this._open = open;\n if (this.open) {\n Overlay.openCount += 1;\n }\n this.requestUpdate('open', !this.open);\n if (this.open) {\n this.requestSlottable();\n }\n }\n\n private _open = false;\n\n static openCount = 1;\n\n /**\n * Instruct the Overlay where to place itself in\n * relationship to the trigger element.\n * @type {\"top\" | \"top-start\" | \"top-end\" | \"right\" | \"right-start\" | \"right-end\" | \"bottom\" | \"bottom-start\" | \"bottom-end\" | \"left\" | \"left-start\" | \"left-end\"}\n */\n @property()\n override placement?: Placement;\n\n /**\n * The state in which the last `request-slottable` event was dispatched.\n * Do not allow overlays from dispatching the same state twice in a row.\n */\n private lastRequestSlottableState = false;\n\n /**\n * Whether to pass focus to the overlay once opened, or\n * to the appropriate value based on the \"type\" of the overlay\n * when set to `\"auto\"`.\n *\n */\n @property({ attribute: 'receives-focus' })\n override receivesFocus: 'true' | 'false' | 'auto' = 'auto';\n\n @query('slot')\n slotEl!: HTMLSlotElement;\n\n @state()\n override get state(): OverlayState {\n return this._state;\n }\n\n override set state(state) {\n if (state === this.state) return;\n const oldState = this.state;\n this._state = state;\n if (this.state === 'opened' || this.state === 'closed') {\n this.strategy?.shouldCompleteOpen();\n }\n this.requestUpdate('state', oldState);\n }\n\n override _state: OverlayState = 'closed';\n\n public strategy?: ClickController | HoverController | LongpressController;\n\n @property({ type: Number, attribute: 'tip-padding' })\n tipPadding?: number;\n\n /**\n * An optional ID reference for the trigger element combined with the optional\n * interaction (click | hover | longpress) by which the overlay shold open\n * the overlay with an `@`: e.g. `trigger@click` opens the overlay when an\n * element with the ID \"trigger\" is clicked.\n */\n @property()\n trigger?: string;\n\n /**\n * An element reference for the trigger element that the overlay should relate to.\n */\n @property({ attribute: false })\n override triggerElement: HTMLElement | VirtualTrigger | null = null;\n\n /**\n * The specific interaction to listen for on the `triggerElement` to open the overlay.\n */\n @property({ attribute: false })\n triggerInteraction?: TriggerInteraction;\n\n /**\n * Configures the open/close heuristics of the Overlay.\n * @type {\"auto\" | \"hint\" | \"manual\" | \"modal\" | \"page\"}\n */\n @property()\n override type: OverlayTypes = 'auto';\n\n protected wasOpen = false;\n\n protected override get elementResolver(): ElementResolutionController {\n if (!this._elementResolver) {\n this._elementResolver = new ElementResolutionController(this);\n }\n return this._elementResolver;\n }\n\n private get usesDialog(): boolean {\n return this.type === 'modal' || this.type === 'page';\n }\n\n private get popoverValue(): 'auto' | 'manual' | undefined {\n const hasPopoverAttribute = 'popover' in this;\n if (!hasPopoverAttribute) {\n return undefined;\n }\n /* c8 ignore next 9 */\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 protected get requiresPosition(): boolean {\n // Do not position \"page\" overlays as they should block the entire 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 automatically position content, unless it is a \"hint\".\n if (!this.triggerElement || (!this.placement && this.type !== 'hint'))\n return false;\n return true;\n }\n\n protected override 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 const tipPadding = this.tipPadding;\n\n this.placementController.placeOverlay(this.dialogEl, {\n offset,\n placement,\n tipPadding,\n trigger,\n type: this.type,\n });\n }\n\n protected override async managePopoverOpen(): Promise<void> {\n super.managePopoverOpen();\n const targetOpenState = this.open;\n /* c8 ignore next 3 */\n if (this.open !== targetOpenState) {\n return;\n }\n await this.manageDelay(targetOpenState);\n if (this.open !== targetOpenState) {\n return;\n }\n await this.ensureOnDOM(targetOpenState);\n /* c8 ignore next 3 */\n if (this.open !== targetOpenState) {\n return;\n }\n const focusEl = await this.makeTransition(targetOpenState);\n if (this.open !== targetOpenState) {\n return;\n }\n await this.applyFocus(targetOpenState, focusEl);\n }\n\n protected override async applyFocus(\n targetOpenState: boolean,\n focusEl: HTMLElement | null\n ): Promise<void> {\n // Do not move focus when explicitly told not to\n // and when the Overlay is a \"hint\"\n if (this.receivesFocus === 'false' || this.type === 'hint') {\n return;\n }\n\n await nextFrame();\n await nextFrame();\n if (targetOpenState === this.open && !this.open) {\n if (\n this.hasNonVirtualTrigger &&\n this.contains((this.getRootNode() as Document).activeElement)\n ) {\n (this.triggerElement as HTMLElement).focus();\n }\n return;\n }\n focusEl?.focus();\n }\n\n protected override returnFocus(): void {\n if (this.open || this.type === 'hint') return;\n\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 (currentNode?.shadowRoot?.activeElement) {\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.receivesFocus !== 'false' &&\n !!(this.triggerElement as HTMLElement)?.focus &&\n (this.contains((this.getRootNode() as Document).activeElement) ||\n getAncestors().includes(this) ||\n // eslint-disable-next-line @spectrum-web-components/document-active-element\n document.activeElement === document.body)\n ) {\n (this.triggerElement as HTMLElement).focus();\n }\n }\n\n private closeOnFocusOut = (event: FocusEvent): void => {\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 protected async manageOpen(oldOpen: boolean): Promise<void> {\n // The `.showPopover()` and `.showModal()` events will error on content that is not connected to the DOM.\n // Prevent from entering the manage workflow in order to avoid this.\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 if (this.open && this.state !== 'opened') {\n this.state = 'opening';\n } else if (!this.open && this.state !== 'closed') {\n this.state = 'closing';\n }\n\n if (this.usesDialog) {\n this.manageDialogOpen();\n } else {\n this.managePopoverOpen();\n }\n if (this.type === 'auto') {\n const listenerRoot = this.getRootNode() as Document;\n if (this.open) {\n listenerRoot.addEventListener(\n 'focusout',\n this.closeOnFocusOut,\n { capture: true }\n );\n } else {\n listenerRoot.removeEventListener(\n 'focusout',\n this.closeOnFocusOut,\n { capture: true }\n );\n }\n }\n }\n\n protected bindEvents(): void {\n this.strategy?.abort();\n this.strategy = undefined;\n if (!this.hasNonVirtualTrigger) return;\n if (!this.triggerInteraction) return;\n this.strategy = new strategies[this.triggerInteraction](\n this.triggerElement as HTMLElement,\n {\n overlay: this,\n }\n );\n }\n\n protected handleBeforetoggle(event: Event & { newState: string }): void {\n if (event.newState !== 'open') {\n this.handleBrowserClose(event);\n }\n }\n\n protected handleBrowserClose(event: Event): void {\n event.stopPropagation();\n if (!this.strategy?.activelyOpening) {\n this.open = false;\n return;\n }\n this.manuallyKeepOpen();\n }\n\n public override manuallyKeepOpen(): void {\n this.open = true;\n this.placementController.allowPlacementUpdate = true;\n this.manageOpen(false);\n }\n\n protected handleSlotchange(): void {\n if (!this.elements.length) {\n this.strategy?.releaseDescription();\n } else if (this.hasNonVirtualTrigger) {\n this.strategy?.prepareDescription(\n this.triggerElement as HTMLElement\n );\n }\n }\n\n public shouldPreventClose(): boolean {\n const shouldPreventClose = this.willPreventClose;\n this.willPreventClose = false;\n return shouldPreventClose;\n }\n\n protected override requestSlottable(): void {\n if (this.lastRequestSlottableState === this.open) {\n return;\n }\n if (!this.open) {\n document.body.offsetHeight;\n }\n /**\n * @ignore\n */\n this.dispatchEvent(\n new SlottableRequestEvent(\n 'overlay-content',\n this.open ? {} : removeSlottableRequest\n )\n );\n this.lastRequestSlottableState = this.open;\n }\n\n override willUpdate(changes: PropertyValues): void {\n if (!this.hasAttribute('id')) {\n this.setAttribute(\n 'id',\n `${this.tagName.toLowerCase()}-${randomID()}`\n );\n }\n if (changes.has('open') && (this.hasUpdated || this.open)) {\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 // Merge multiple possible calls to `bindEvents()`.\n let oldTrigger: HTMLElement | false | undefined = false;\n if (changes.has(elementResolverUpdatedSymbol)) {\n oldTrigger = this.triggerElement as HTMLElement;\n this.triggerElement = this.elementResolver.element;\n }\n if (changes.has('triggerElement')) {\n oldTrigger = changes.get('triggerElement');\n }\n if (oldTrigger !== false) {\n this.bindEvents();\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 if (\n changes.has('state') &&\n this.state === 'closed' &&\n typeof changes.get('state') !== 'undefined'\n ) {\n this.placementController.clearOverlayPosition();\n }\n }\n\n protected renderContent(): TemplateResult {\n return html`\n <slot @slotchange=${this.handleSlotchange}></slot>\n `;\n }\n\n private get dialogStyleMap(): StyleInfo {\n return {\n '--swc-overlay-open-count': Overlay.openCount.toString(),\n };\n }\n\n protected renderDialog(): TemplateResult {\n /**\n * `--swc-overlay-open-count` is applied to mimic the single stack\n * nature of the top layer in browsers that do not yet support it.\n *\n * The value should always be the full number of overlays ever opened\n * which will be added to `--swc-overlay-z-index-base` which can be\n * provided by a consuming developer but defaults to 1000 to beat as\n * much stacking as possible durring fallback delivery.\n **/\n return html`\n <dialog\n class=\"dialog\"\n part=\"dialog\"\n placement=${ifDefined(\n this.requiresPosition\n ? this.placement || 'right'\n : undefined\n )}\n style=${styleMap(this.dialogStyleMap)}\n @close=${this.handleBrowserClose}\n @cancel=${this.handleBrowserClose}\n @beforetoggle=${this.handleBeforetoggle}\n ?is-visible=${this.state !== 'closed'}\n >\n ${this.renderContent()}\n </dialog>\n `;\n }\n\n protected renderPopover(): TemplateResult {\n /**\n * `--swc-overlay-open-count` is applied to mimic the single stack\n * nature of the top layer in browsers that do not yet support it.\n *\n * The value should always be the full number of overlays ever opened\n * which will be added to `--swc-overlay-z-index-base` which can be\n * provided by a consuming developer but defaults to 1000 to beat as\n * much stacking as possible durring fallback delivery.\n **/\n return html`\n <div\n class=\"dialog\"\n part=\"dialog\"\n placement=${ifDefined(\n this.requiresPosition\n ? this.placement || 'right'\n : undefined\n )}\n popover=${ifDefined(this.popoverValue)}\n style=${styleMap(this.dialogStyleMap)}\n @beforetoggle=${this.handleBeforetoggle}\n @close=${this.handleBrowserClose}\n ?is-visible=${this.state !== 'closed'}\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.hasUpdated) {\n this.bindEvents();\n }\n }\n\n override disconnectedCallback(): void {\n this.strategy?.releaseDescription();\n this.open = false;\n super.disconnectedCallback();\n }\n}\n"],
|
|
5
|
+
"mappings": "qNAWA,OACI,QAAAA,MAGG,gCACP,OACI,YAAAC,EACA,SAAAC,EACA,yBAAAC,EACA,SAAAC,MACG,kDACP,OACI,+BAAAC,EACA,gCAAAC,MACG,yEACP,OACI,aAAAC,EAEA,YAAAC,MACG,kDACP,OAAS,YAAAC,MAAgB,mDASzB,OAAS,mBAAA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QAAS,EAAK,CAAC,GAtFjCuB,EAuFI,oBAgCJ2B,EAAA,CADRlD,EAAS,GAtHDuB,EAuHA,yBAeA2B,EAAA,CADRlD,EAAS,CAAE,UAAW,gBAAiB,CAAC,GArIhCuB,EAsIA,6BAGT2B,EAAA,CADCjD,EAAM,MAAM,GAxIJsB,EAyIT,sBAGa2B,EAAA,CADZ/C,EAAM,GA3IEoB,EA4II,qBAmBb2B,EAAA,CADClD,EAAS,CAAE,KAAM,OAAQ,UAAW,aAAc,CAAC,GA9J3CuB,EA+JT,0BASA2B,EAAA,CADClD,EAAS,GAvKDuB,EAwKT,uBAMS2B,EAAA,CADRlD,EAAS,CAAE,UAAW,EAAM,CAAC,GA7KrBuB,EA8KA,8BAMT2B,EAAA,CADClD,EAAS,CAAE,UAAW,EAAM,CAAC,GAnLrBuB,EAoLT,kCAOS2B,EAAA,CADRlD,EAAS,GA1LDuB,EA2LA,oBA3LN,WAAM,QAANA",
|
|
6
6
|
"names": ["html", "property", "query", "queryAssignedElements", "state", "ElementResolutionController", "elementResolverUpdatedSymbol", "ifDefined", "styleMap", "randomID", "AbstractOverlay", "nextFrame", "OverlayDialog", "OverlayPopover", "OverlayNoPopover", "overlayStack", "VirtualTrigger", "PlacementController", "strategies", "removeSlottableRequest", "SlottableRequestEvent", "styles", "supportsPopover", "OverlayFeatures", "_Overlay", "event", "relationEvent", "_a", "delayed", "disabled", "open", "oldState", "offset", "trigger", "placement", "tipPadding", "targetOpenState", "focusEl", "getAncestors", "_b", "ancestors", "currentNode", "ancestor", "oldOpen", "listenerRoot", "shouldPreventClose", "changes", "id", "interaction", "oldTrigger", "isDialog", "__decorateClass"]
|
|
7
7
|
}
|
package/src/OverlayStack.d.ts
CHANGED
|
@@ -31,8 +31,8 @@ declare class OverlayStack {
|
|
|
31
31
|
overlaysByTriggerElement(triggerElement: HTMLElement): Overlay[];
|
|
32
32
|
/**
|
|
33
33
|
* When overlays are added manage the open state of exisiting overlays appropriately:
|
|
34
|
-
* - 'modal': should close other overlays
|
|
35
|
-
* - 'page': should close other overlays
|
|
34
|
+
* - 'modal': should close other non-'modal' and non-'manual' overlays
|
|
35
|
+
* - 'page': should close other non-'modal' and non-'manual' overlays
|
|
36
36
|
* - 'auto': should close other 'auto' overlays and other 'hint' overlays, but not 'manual' overlays
|
|
37
37
|
* - 'manual': shouldn't close other overlays
|
|
38
38
|
* - 'hint': shouldn't close other overlays and give way to all other overlays on a trigger
|
package/src/OverlayStack.dev.js
CHANGED
|
@@ -23,6 +23,8 @@ class OverlayStack {
|
|
|
23
23
|
this.pointerdownPath = void 0;
|
|
24
24
|
if (!this.stack.length) return;
|
|
25
25
|
if (!(composedPath == null ? void 0 : composedPath.length)) return;
|
|
26
|
+
const lastOverlay = this.lastOverlay;
|
|
27
|
+
this.lastOverlay = void 0;
|
|
26
28
|
const lastIndex = this.stack.length - 1;
|
|
27
29
|
const nonAncestorOverlays = this.stack.filter((overlay, i) => {
|
|
28
30
|
const inStack = composedPath.find(
|
|
@@ -31,10 +33,11 @@ class OverlayStack {
|
|
|
31
33
|
el === overlay || // The Overlay trigger is in the stack and the Overlay is a "hint"
|
|
32
34
|
el === (overlay == null ? void 0 : overlay.triggerElement) && "hint" === (overlay == null ? void 0 : overlay.type) || // The last Overlay in the stack is not the last Overlay at `pointerdown` time and has a
|
|
33
35
|
// `triggerInteraction` of "longpress", meaning it was opened by this poitner interaction
|
|
34
|
-
i === lastIndex && overlay !==
|
|
36
|
+
i === lastIndex && overlay !== lastOverlay && overlay.triggerInteraction === "longpress"
|
|
35
37
|
)
|
|
36
38
|
);
|
|
37
|
-
return !inStack && !overlay.shouldPreventClose() && overlay.type !== "manual"
|
|
39
|
+
return !inStack && !overlay.shouldPreventClose() && overlay.type !== "manual" && // Don't close if this overlay is modal and not on top of the overlay stack.
|
|
40
|
+
!(overlay.type === "modal" && lastOverlay !== overlay);
|
|
38
41
|
});
|
|
39
42
|
nonAncestorOverlays.reverse();
|
|
40
43
|
nonAncestorOverlays.forEach((overlay) => {
|
|
@@ -96,8 +99,8 @@ class OverlayStack {
|
|
|
96
99
|
}
|
|
97
100
|
/**
|
|
98
101
|
* When overlays are added manage the open state of exisiting overlays appropriately:
|
|
99
|
-
* - 'modal': should close other overlays
|
|
100
|
-
* - 'page': should close other overlays
|
|
102
|
+
* - 'modal': should close other non-'modal' and non-'manual' overlays
|
|
103
|
+
* - 'page': should close other non-'modal' and non-'manual' overlays
|
|
101
104
|
* - 'auto': should close other 'auto' overlays and other 'hint' overlays, but not 'manual' overlays
|
|
102
105
|
* - 'manual': shouldn't close other overlays
|
|
103
106
|
* - 'hint': shouldn't close other overlays and give way to all other overlays on a trigger
|
|
@@ -123,7 +126,7 @@ class OverlayStack {
|
|
|
123
126
|
const path = event.composedPath();
|
|
124
127
|
this.stack.forEach((overlayEl) => {
|
|
125
128
|
const inPath = path.find((el) => el === overlayEl);
|
|
126
|
-
if (!inPath && overlayEl.type !== "manual") {
|
|
129
|
+
if (!inPath && overlayEl.type !== "manual" && overlayEl.type !== "modal") {
|
|
127
130
|
this.closeOverlay(overlayEl);
|
|
128
131
|
}
|
|
129
132
|
});
|
|
@@ -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 { Overlay } from './Overlay.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 pointerdownPath?: EventTarget[];\n\n private lastOverlay?: Overlay;\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('pointerdown', this.handlePointerdown);\n this.document.addEventListener('pointerup', this.handlePointerup);\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 * Cach the `pointerdownTarget` for later testing\n *\n * @param event {ClickEvent}\n */\n handlePointerdown = (event: Event): void => {\n this.pointerdownPath = event.composedPath();\n this.lastOverlay = this.stack[this.stack.length - 1];\n };\n\n /**\n * Close all overlays that are not ancestors of this click event\n *\n * @param event {ClickEvent}\n */\n handlePointerup = (): void => {\n // Test against the composed path in `pointerdown` in case the visitor moved their\n // pointer during the course of the interaction.\n // Ensure that this value is cleared even if the work in this method goes undone.\n const composedPath = this.pointerdownPath;\n this.pointerdownPath = undefined;\n if (!this.stack.length) return;\n if (!composedPath?.length) return;\n\n const lastIndex = this.stack.length - 1;\n const nonAncestorOverlays = this.stack.filter((overlay, i) => {\n const inStack = composedPath.find(\n (el) =>\n // The Overlay is in the stack\n el === overlay ||\n // The Overlay trigger is in the stack and the Overlay is a \"hint\"\n (el === overlay?.triggerElement &&\n 'hint' === overlay?.type) ||\n // The last Overlay in the stack is not the last Overlay at `pointerdown` time and has a\n // `triggerInteraction` of \"longpress\", meaning it was opened by this poitner interaction\n (i === lastIndex &&\n overlay !==
|
|
5
|
-
"mappings": ";AAaA,MAAM,kBAAkB,iBAAiB,SAAS,cAAc,KAAK;AAErE,MAAM,aAAa;AAAA,EAaf,cAAc;AAJd,SAAQ,OAAoB,SAAS;AAErC,iBAAmB,CAAC;AAyBpB;AAAA;AAAA;AAAA;AAAA;AAAA,6BAAoB,CAAC,UAAuB;AACxC,WAAK,kBAAkB,MAAM,aAAa;AAC1C,WAAK,cAAc,KAAK,MAAM,KAAK,MAAM,SAAS,CAAC;AAAA,IACvD;AAOA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAkB,MAAY;AAI1B,YAAM,eAAe,KAAK;AAC1B,WAAK,kBAAkB;AACvB,UAAI,CAAC,KAAK,MAAM,OAAQ;AACxB,UAAI,EAAC,6CAAc,QAAQ;
|
|
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 { Overlay } from './Overlay.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 pointerdownPath?: EventTarget[];\n\n private lastOverlay?: Overlay;\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('pointerdown', this.handlePointerdown);\n this.document.addEventListener('pointerup', this.handlePointerup);\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 * Cach the `pointerdownTarget` for later testing\n *\n * @param event {ClickEvent}\n */\n handlePointerdown = (event: Event): void => {\n this.pointerdownPath = event.composedPath();\n this.lastOverlay = this.stack[this.stack.length - 1];\n };\n\n /**\n * Close all overlays that are not ancestors of this click event\n *\n * @param event {ClickEvent}\n */\n handlePointerup = (): void => {\n // Test against the composed path in `pointerdown` in case the visitor moved their\n // pointer during the course of the interaction.\n // Ensure that this value is cleared even if the work in this method goes undone.\n const composedPath = this.pointerdownPath;\n this.pointerdownPath = undefined;\n if (!this.stack.length) return;\n if (!composedPath?.length) return;\n const lastOverlay = this.lastOverlay;\n this.lastOverlay = undefined;\n\n const lastIndex = this.stack.length - 1;\n const nonAncestorOverlays = this.stack.filter((overlay, i) => {\n const inStack = composedPath.find(\n (el) =>\n // The Overlay is in the stack\n el === overlay ||\n // The Overlay trigger is in the stack and the Overlay is a \"hint\"\n (el === overlay?.triggerElement &&\n 'hint' === overlay?.type) ||\n // The last Overlay in the stack is not the last Overlay at `pointerdown` time and has a\n // `triggerInteraction` of \"longpress\", meaning it was opened by this poitner interaction\n (i === lastIndex &&\n overlay !== lastOverlay &&\n overlay.triggerInteraction === 'longpress')\n );\n return (\n !inStack &&\n !overlay.shouldPreventClose() &&\n overlay.type !== 'manual' &&\n // Don't close if this overlay is modal and not on top of the overlay stack.\n !(overlay.type === 'modal' && lastOverlay !== overlay)\n );\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 (!this.stack.length) return;\n const last = this.stack[this.stack.length - 1];\n if (last?.type === 'page') {\n event.preventDefault();\n return;\n }\n if (supportsPopover) return;\n if (last?.type === 'manual') {\n // Manual Overlays should not close on \"light dismiss\".\n return;\n }\n\n if (!last) return;\n this.closeOverlay(last);\n };\n\n /**\n * Get an array of Overlays that all share the same trigger element.\n *\n * @param triggerElement {HTMLELement}\n * @returns {Overlay[]}\n */\n overlaysByTriggerElement(triggerElement: HTMLElement): Overlay[] {\n return this.stack.filter(\n (overlay) => overlay.triggerElement === triggerElement\n );\n }\n\n /**\n * When overlays are added manage the open state of exisiting overlays appropriately:\n * - 'modal': should close other non-'modal' and non-'manual' overlays\n * - 'page': should close other non-'modal' and non-'manual' overlays\n * - 'auto': should close other 'auto' overlays and other 'hint' overlays, but not 'manual' overlays\n * - 'manual': shouldn't close other overlays\n * - 'hint': shouldn't close other overlays and give way to all other overlays on a trigger\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 (\n !inPath &&\n overlayEl.type !== 'manual' &&\n overlayEl.type !== 'modal'\n ) {\n this.closeOverlay(overlayEl);\n }\n });\n },\n { once: true }\n );\n overlay.dispatchEvent(queryPathEvent);\n } else if (overlay.type === 'hint') {\n const hasPrevious = this.stack.some((overlayEl) => {\n return (\n overlayEl.type !== 'manual' &&\n overlayEl.triggerElement &&\n overlayEl.triggerElement === overlay.triggerElement\n );\n });\n if (hasPrevious) {\n overlay.open = false;\n return;\n }\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 }\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,IAAI,aAAa;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/OverlayStack.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const h="showPopover"in document.createElement("div");class c{constructor(){this.root=document.body;this.stack=[];this.handlePointerdown=t=>{this.pointerdownPath=t.composedPath(),this.lastOverlay=this.stack[this.stack.length-1]};this.handlePointerup=()=>{const t=this.pointerdownPath;if(this.pointerdownPath=void 0,!this.stack.length||!(t!=null&&t.length))return;const e=this.stack.length-1,
|
|
1
|
+
"use strict";const h="showPopover"in document.createElement("div");class c{constructor(){this.root=document.body;this.stack=[];this.handlePointerdown=t=>{this.pointerdownPath=t.composedPath(),this.lastOverlay=this.stack[this.stack.length-1]};this.handlePointerup=()=>{const t=this.pointerdownPath;if(this.pointerdownPath=void 0,!this.stack.length||!(t!=null&&t.length))return;const e=this.lastOverlay;this.lastOverlay=void 0;const s=this.stack.length-1,r=this.stack.filter((n,i)=>!t.find(a=>a===n||a===(n==null?void 0:n.triggerElement)&&(n==null?void 0:n.type)==="hint"||i===s&&n!==e&&n.triggerInteraction==="longpress")&&!n.shouldPreventClose()&&n.type!=="manual"&&!(n.type==="modal"&&e!==n));r.reverse(),r.forEach(n=>{this.closeOverlay(n);let i=n.parentOverlayToForceClose;for(;i;)this.closeOverlay(i),i=i.parentOverlayToForceClose})};this.handleBeforetoggle=t=>{const{target:e,newState:s}=t;s!=="open"&&this.closeOverlay(e)};this.handleKeydown=t=>{if(t.code!=="Escape"||!this.stack.length)return;const e=this.stack[this.stack.length-1];if((e==null?void 0:e.type)==="page"){t.preventDefault();return}h||(e==null?void 0:e.type)!=="manual"&&e&&this.closeOverlay(e)};this.bindEvents()}get document(){return this.root.ownerDocument||document}bindEvents(){this.document.addEventListener("pointerdown",this.handlePointerdown),this.document.addEventListener("pointerup",this.handlePointerup),this.document.addEventListener("keydown",this.handleKeydown)}closeOverlay(t){const e=this.stack.indexOf(t);e>-1&&this.stack.splice(e,1),t.open=!1}overlaysByTriggerElement(t){return this.stack.filter(e=>e.triggerElement===t)}add(t){if(this.stack.includes(t)){const e=this.stack.indexOf(t);e>-1&&(this.stack.splice(e,1),this.stack.push(t));return}if(t.type==="auto"||t.type==="modal"||t.type==="page"){const e="sp-overlay-query-path",s=new Event(e,{composed:!0,bubbles:!0});t.addEventListener(e,r=>{const n=r.composedPath();this.stack.forEach(i=>{!n.find(a=>a===i)&&i.type!=="manual"&&i.type!=="modal"&&this.closeOverlay(i)})},{once:!0}),t.dispatchEvent(s)}else if(t.type==="hint"){if(this.stack.some(s=>s.type!=="manual"&&s.triggerElement&&s.triggerElement===t.triggerElement)){t.open=!1;return}this.stack.forEach(s=>{s.type==="hint"&&this.closeOverlay(s)})}requestAnimationFrame(()=>{this.stack.push(t),t.addEventListener("beforetoggle",this.handleBeforetoggle,{once:!0})})}remove(t){this.closeOverlay(t)}}export const overlayStack=new c;
|
|
2
2
|
//# sourceMappingURL=OverlayStack.js.map
|
package/src/OverlayStack.js.map
CHANGED
|
@@ -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 { Overlay } from './Overlay.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 pointerdownPath?: EventTarget[];\n\n private lastOverlay?: Overlay;\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('pointerdown', this.handlePointerdown);\n this.document.addEventListener('pointerup', this.handlePointerup);\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 * Cach the `pointerdownTarget` for later testing\n *\n * @param event {ClickEvent}\n */\n handlePointerdown = (event: Event): void => {\n this.pointerdownPath = event.composedPath();\n this.lastOverlay = this.stack[this.stack.length - 1];\n };\n\n /**\n * Close all overlays that are not ancestors of this click event\n *\n * @param event {ClickEvent}\n */\n handlePointerup = (): void => {\n // Test against the composed path in `pointerdown` in case the visitor moved their\n // pointer during the course of the interaction.\n // Ensure that this value is cleared even if the work in this method goes undone.\n const composedPath = this.pointerdownPath;\n this.pointerdownPath = undefined;\n if (!this.stack.length) return;\n if (!composedPath?.length) return;\n\n const lastIndex = this.stack.length - 1;\n const nonAncestorOverlays = this.stack.filter((overlay, i) => {\n const inStack = composedPath.find(\n (el) =>\n // The Overlay is in the stack\n el === overlay ||\n // The Overlay trigger is in the stack and the Overlay is a \"hint\"\n (el === overlay?.triggerElement &&\n 'hint' === overlay?.type) ||\n // The last Overlay in the stack is not the last Overlay at `pointerdown` time and has a\n // `triggerInteraction` of \"longpress\", meaning it was opened by this poitner interaction\n (i === lastIndex &&\n overlay !==
|
|
5
|
-
"mappings": "aAaA,MAAMA,EAAkB,gBAAiB,SAAS,cAAc,KAAK,EAErE,MAAMC,CAAa,CAaf,aAAc,CAJd,KAAQ,KAAoB,SAAS,KAErC,WAAmB,CAAC,EAyBpB,uBAAqBC,GAAuB,CACxC,KAAK,gBAAkBA,EAAM,aAAa,EAC1C,KAAK,YAAc,KAAK,MAAM,KAAK,MAAM,OAAS,CAAC,CACvD,EAOA,qBAAkB,IAAY,CAI1B,MAAMC,EAAe,KAAK,gBAG1B,GAFA,KAAK,gBAAkB,OACnB,CAAC,KAAK,MAAM,QACZ,EAACA,GAAA,MAAAA,EAAc,QAAQ,
|
|
6
|
-
"names": ["supportsPopover", "OverlayStack", "event", "composedPath", "lastIndex", "nonAncestorOverlays", "overlay", "el", "parentToClose", "target", "open", "last", "overlayIndex", "triggerElement", "queryPathEventName", "queryPathEvent", "path", "overlayEl"]
|
|
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 { Overlay } from './Overlay.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 pointerdownPath?: EventTarget[];\n\n private lastOverlay?: Overlay;\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('pointerdown', this.handlePointerdown);\n this.document.addEventListener('pointerup', this.handlePointerup);\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 * Cach the `pointerdownTarget` for later testing\n *\n * @param event {ClickEvent}\n */\n handlePointerdown = (event: Event): void => {\n this.pointerdownPath = event.composedPath();\n this.lastOverlay = this.stack[this.stack.length - 1];\n };\n\n /**\n * Close all overlays that are not ancestors of this click event\n *\n * @param event {ClickEvent}\n */\n handlePointerup = (): void => {\n // Test against the composed path in `pointerdown` in case the visitor moved their\n // pointer during the course of the interaction.\n // Ensure that this value is cleared even if the work in this method goes undone.\n const composedPath = this.pointerdownPath;\n this.pointerdownPath = undefined;\n if (!this.stack.length) return;\n if (!composedPath?.length) return;\n const lastOverlay = this.lastOverlay;\n this.lastOverlay = undefined;\n\n const lastIndex = this.stack.length - 1;\n const nonAncestorOverlays = this.stack.filter((overlay, i) => {\n const inStack = composedPath.find(\n (el) =>\n // The Overlay is in the stack\n el === overlay ||\n // The Overlay trigger is in the stack and the Overlay is a \"hint\"\n (el === overlay?.triggerElement &&\n 'hint' === overlay?.type) ||\n // The last Overlay in the stack is not the last Overlay at `pointerdown` time and has a\n // `triggerInteraction` of \"longpress\", meaning it was opened by this poitner interaction\n (i === lastIndex &&\n overlay !== lastOverlay &&\n overlay.triggerInteraction === 'longpress')\n );\n return (\n !inStack &&\n !overlay.shouldPreventClose() &&\n overlay.type !== 'manual' &&\n // Don't close if this overlay is modal and not on top of the overlay stack.\n !(overlay.type === 'modal' && lastOverlay !== overlay)\n );\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 (!this.stack.length) return;\n const last = this.stack[this.stack.length - 1];\n if (last?.type === 'page') {\n event.preventDefault();\n return;\n }\n if (supportsPopover) return;\n if (last?.type === 'manual') {\n // Manual Overlays should not close on \"light dismiss\".\n return;\n }\n\n if (!last) return;\n this.closeOverlay(last);\n };\n\n /**\n * Get an array of Overlays that all share the same trigger element.\n *\n * @param triggerElement {HTMLELement}\n * @returns {Overlay[]}\n */\n overlaysByTriggerElement(triggerElement: HTMLElement): Overlay[] {\n return this.stack.filter(\n (overlay) => overlay.triggerElement === triggerElement\n );\n }\n\n /**\n * When overlays are added manage the open state of exisiting overlays appropriately:\n * - 'modal': should close other non-'modal' and non-'manual' overlays\n * - 'page': should close other non-'modal' and non-'manual' overlays\n * - 'auto': should close other 'auto' overlays and other 'hint' overlays, but not 'manual' overlays\n * - 'manual': shouldn't close other overlays\n * - 'hint': shouldn't close other overlays and give way to all other overlays on a trigger\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 (\n !inPath &&\n overlayEl.type !== 'manual' &&\n overlayEl.type !== 'modal'\n ) {\n this.closeOverlay(overlayEl);\n }\n });\n },\n { once: true }\n );\n overlay.dispatchEvent(queryPathEvent);\n } else if (overlay.type === 'hint') {\n const hasPrevious = this.stack.some((overlayEl) => {\n return (\n overlayEl.type !== 'manual' &&\n overlayEl.triggerElement &&\n overlayEl.triggerElement === overlay.triggerElement\n );\n });\n if (hasPrevious) {\n overlay.open = false;\n return;\n }\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}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A,CAAS,CAEnC,CAAC,CACL,EACA,CAAE,KAAM,EAAK,CACjB,EACAX,EAAQ,cAAcS,CAAc,CACxC,SAAWT,EAAQ,OAAS,OAAQ,CAQhC,GAPoB,KAAK,MAAM,KAAMW,GAE7BA,EAAU,OAAS,UACnBA,EAAU,gBACVA,EAAU,iBAAmBX,EAAQ,cAE5C,EACgB,CACbA,EAAQ,KAAO,GACf,MACJ,CACA,KAAK,MAAM,QAASW,GAAc,CAC1BA,EAAU,OAAS,QACnB,KAAK,aAAaA,CAAS,CAEnC,CAAC,CACL,CACA,sBAAsB,IAAM,CACxB,KAAK,MAAM,KAAKX,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,IAAIN",
|
|
6
|
+
"names": ["supportsPopover", "OverlayStack", "event", "composedPath", "lastOverlay", "lastIndex", "nonAncestorOverlays", "overlay", "el", "parentToClose", "target", "open", "last", "overlayIndex", "triggerElement", "queryPathEventName", "queryPathEvent", "path", "overlayEl"]
|
|
7
7
|
}
|
|
@@ -332,7 +332,7 @@ describe("sp-overlay", () => {
|
|
|
332
332
|
this.page.open = false;
|
|
333
333
|
await closed;
|
|
334
334
|
});
|
|
335
|
-
it('
|
|
335
|
+
it('should not close "modal" overlays when opening', async function() {
|
|
336
336
|
let opened = oneEvent(this.modal, "sp-opened");
|
|
337
337
|
this.modal.open = true;
|
|
338
338
|
await opened;
|
|
@@ -342,11 +342,9 @@ describe("sp-overlay", () => {
|
|
|
342
342
|
expect(this.auto.open).to.be.false;
|
|
343
343
|
expect(this.manual.open).to.be.false;
|
|
344
344
|
opened = oneEvent(this.page, "sp-opened");
|
|
345
|
-
const closed = oneEvent(this.modal, "sp-closed");
|
|
346
345
|
this.page.open = true;
|
|
347
346
|
await opened;
|
|
348
|
-
|
|
349
|
-
expect(this.modal.open).to.be.false;
|
|
347
|
+
expect(this.modal.open).to.be.true;
|
|
350
348
|
expect(this.page.open).to.be.true;
|
|
351
349
|
expect(this.hint.open).to.be.false;
|
|
352
350
|
expect(this.auto.open).to.be.false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["overlay-element.test.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*/\nimport {\n aTimeout,\n elementUpdated,\n expect,\n fixture,\n html,\n nextFrame,\n oneEvent,\n} from '@open-wc/testing';\nimport { Overlay } from '@spectrum-web-components/overlay/src/Overlay.js';\nimport '@spectrum-web-components/overlay/sp-overlay.js';\nimport { Tooltip } from '@spectrum-web-components/tooltip';\nimport '@spectrum-web-components/tooltip/sp-tooltip.js';\nimport '@spectrum-web-components/popover/sp-popover.js';\nimport { Theme } from '@spectrum-web-components/theme';\nimport { TemplateResult } from '@spectrum-web-components/base';\nimport '@spectrum-web-components/theme/sp-theme.js';\nimport '@spectrum-web-components/theme/src/themes.js';\nimport '@spectrum-web-components/button/sp-button.js';\n\nimport { sendMouse } from '../../../test/plugins/browser.js';\nimport { Button } from '@spectrum-web-components/button';\nimport { sendKeys } from '@web/test-runner-commands';\nimport {\n click,\n receivesFocus,\n withSlider,\n} from '../stories/overlay-element.stories.js';\nimport {\n removeSlottableRequest,\n SlottableRequestEvent,\n} from '../src/slottable-request-event.js';\nimport { stub } from 'sinon';\nimport { OverlayStateEvent } from '@spectrum-web-components/overlay/src/events.js';\nimport { Slider } from '@spectrum-web-components/slider/src/Slider.js';\n\nconst OVERLAY_TYPES = ['modal', 'page', 'hint', 'auto', 'manual'] as const;\ntype OverlayTypes = (typeof OVERLAY_TYPES)[number];\n\nasync function styledFixture<T extends Element>(\n story: TemplateResult\n): Promise<T> {\n const test = await fixture<Theme>(html`\n <sp-theme system=\"spectrum\" scale=\"medium\" color=\"light\">\n ${story}\n </sp-theme>\n `);\n return test.children[0] as T;\n}\n\ndescribe('sp-overlay', () => {\n function opensDeclaratively(overlayType: OverlayTypes): void {\n it(`as [type=\"'${overlayType}'\"]`, async () => {\n const el = await styledFixture<Overlay>(html`\n <sp-overlay open type=${overlayType}>\n <sp-tooltip>Content</sp-tooltip>\n </sp-overlay>\n `);\n const content = el.children[0] as Tooltip;\n let opened = oneEvent(el, 'sp-opened');\n await opened;\n\n expect(content.open).to.be.true;\n const closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(content.open).to.be.false;\n opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(content.open).to.be.true;\n });\n }\n\n describe('`slottable-request` event', () => {\n it('dispatched before `sp-opened`', async function () {\n let slottableRequestTime = 0;\n let openedTime = 0;\n const el = await fixture<Overlay>(html`\n <sp-overlay\n @slottable-request=${() =>\n (slottableRequestTime = performance.now())}\n @sp-opened=${() => (openedTime = performance.now())}\n >\n <sp-popover>test</sp-popover>\n </sp-overlay>\n `);\n\n await elementUpdated(el);\n\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(slottableRequestTime).to.be.lt(openedTime);\n });\n it('dispatched after `sp-closed`', async function () {\n let slottableRequestTime = 0;\n let closedTime = 0;\n const el = await fixture<Overlay>(html`\n <sp-overlay\n @sp-closed=${() => (closedTime = performance.now())}\n @slottable-request=${() =>\n (slottableRequestTime = performance.now())}\n >\n <sp-popover>test</sp-popover>\n </sp-overlay>\n `);\n\n await elementUpdated(el);\n\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n await nextFrame();\n await nextFrame();\n\n const closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n await nextFrame();\n await nextFrame();\n\n expect(\n slottableRequestTime,\n `slottable-request: ${slottableRequestTime}, sp-closed: ${closedTime}`\n ).to.be.gt(closedTime);\n });\n it('follows transition timing from lazily added children', async function () {\n let slottableRequestTime = 0;\n let openedTime = 0;\n const popover = document.createElement('sp-popover');\n popover.textContent = 'Test';\n const el = await fixture<Overlay>(html`\n <sp-overlay\n @slottable-request=${(event: SlottableRequestEvent) => {\n slottableRequestTime = performance.now();\n if (event.data !== removeSlottableRequest) {\n (event.target as HTMLElement).append(popover);\n } else {\n popover.remove();\n }\n }}\n @sp-opened=${() => (openedTime = performance.now())}\n ></sp-overlay>\n `);\n\n await elementUpdated(el);\n\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(slottableRequestTime).to.be.lte(openedTime);\n expect(openedTime - slottableRequestTime).to.be.gt(130);\n });\n\n describe('dev mode', () => {\n let consoleWarnStub!: ReturnType<typeof stub>;\n before(() => {\n window.__swc.verbose = true;\n consoleWarnStub = stub(console, 'warn');\n });\n afterEach(() => {\n consoleWarnStub.resetHistory();\n });\n after(() => {\n window.__swc.verbose = false;\n consoleWarnStub.restore();\n });\n\n it('warns that `slottable-request` events are experimental', async () => {\n const el = await fixture<Overlay>(html`\n <sp-overlay>\n <sp-popover>test</sp-popover>\n </sp-overlay>\n `);\n\n await elementUpdated(el);\n\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(consoleWarnStub.called).to.be.true;\n const spyCall = consoleWarnStub.getCall(0);\n expect(\n (spyCall.args.at(0) as string).includes(\n '`slottable-request` events are experimental'\n ),\n '`slottable-request`-centric message'\n ).to.be.true;\n expect(\n spyCall.args.at(-1),\n 'confirm `data` shape'\n ).to.deep.equal({\n data: {\n localName: 'base',\n type: 'api',\n level: 'high',\n },\n });\n });\n });\n });\n\n describe('[type=\"modal\"]', () => {\n opensDeclaratively('modal');\n describe('interaction with other non-ancestor overlays', function () {\n beforeEach(async function () {\n this.fixture = await styledFixture<Overlay>(html`\n <div>\n ${OVERLAY_TYPES.map(\n (type) => html`\n <sp-overlay type=${type}>\n <sp-tooltip>${type} Content</sp-tooltip>\n </sp-overlay>\n `\n )}\n </div>\n `);\n\n this.modal = this.fixture.querySelector(\n '[type=\"modal\"]'\n ) as Overlay;\n this.page = this.fixture.querySelector(\n '[type=\"page\"]'\n ) as Overlay;\n this.hint = this.fixture.querySelector(\n '[type=\"hint\"]'\n ) as Overlay;\n this.auto = this.fixture.querySelector(\n '[type=\"auto\"]'\n ) as Overlay;\n this.manual = this.fixture.querySelector(\n '[type=\"manual\"]'\n ) as Overlay;\n\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n afterEach(async function () {\n const closed = oneEvent(this.modal, 'sp-closed');\n this.modal.open = false;\n await closed;\n });\n it('closes \"page\" overlays when opening', async function () {\n let opened = oneEvent(this.page, 'sp-opened');\n this.page.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.true;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.modal, 'sp-opened');\n const closed = oneEvent(this.page, 'sp-closed');\n this.modal.open = true;\n await opened;\n await closed;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n it('closes \"hint\" overlays when opening', async function () {\n let opened = oneEvent(this.hint, 'sp-opened');\n this.hint.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.true;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.modal, 'sp-opened');\n const closed = oneEvent(this.hint, 'sp-closed');\n this.modal.open = true;\n await opened;\n await closed;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n it('closes \"auto\" overlays when opening', async function () {\n let opened = oneEvent(this.auto, 'sp-opened');\n this.auto.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.true;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.modal, 'sp-opened');\n const closed = oneEvent(this.auto, 'sp-closed');\n this.modal.open = true;\n await opened;\n await closed;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n it('does not close \"manual\" overlays when opening', async function () {\n let opened = oneEvent(this.manual, 'sp-opened');\n this.manual.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.true;\n\n opened = oneEvent(this.modal, 'sp-opened');\n this.modal.open = true;\n await opened;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.true;\n });\n });\n });\n describe('[type=\"page\"]', () => {\n opensDeclaratively('page');\n describe('interaction with other non-ancestor overlays', function () {\n beforeEach(async function () {\n this.fixture = await styledFixture<Overlay>(html`\n <div>\n ${OVERLAY_TYPES.map(\n (type) => html`\n <sp-overlay type=${type}>\n <sp-tooltip>${type} Content</sp-tooltip>\n </sp-overlay>\n `\n )}\n </div>\n `);\n\n this.modal = this.fixture.querySelector(\n '[type=\"modal\"]'\n ) as Overlay;\n this.page = this.fixture.querySelector(\n '[type=\"page\"]'\n ) as Overlay;\n this.hint = this.fixture.querySelector(\n '[type=\"hint\"]'\n ) as Overlay;\n this.auto = this.fixture.querySelector(\n '[type=\"auto\"]'\n ) as Overlay;\n this.manual = this.fixture.querySelector(\n '[type=\"manual\"]'\n ) as Overlay;\n\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n afterEach(async function () {\n const closed = oneEvent(this.page, 'sp-closed');\n this.page.open = false;\n await closed;\n });\n it('closes \"page\" overlays when opening', async function () {\n let opened = oneEvent(this.modal, 'sp-opened');\n this.modal.open = true;\n await opened;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.page, 'sp-opened');\n const closed = oneEvent(this.modal, 'sp-closed');\n this.page.open = true;\n await opened;\n await closed;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.true;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n it('closes \"hint\" overlays when opening', async function () {\n let opened = oneEvent(this.hint, 'sp-opened');\n this.hint.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.true;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.page, 'sp-opened');\n const closed = oneEvent(this.hint, 'sp-closed');\n this.page.open = true;\n await opened;\n await closed;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.true;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n it('closes \"auto\" overlays when opening', async function () {\n let opened = oneEvent(this.auto, 'sp-opened');\n this.auto.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.true;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.page, 'sp-opened');\n const closed = oneEvent(this.auto, 'sp-closed');\n this.page.open = true;\n await opened;\n await closed;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.true;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n it('does not close \"manual\" overlays when opening', async function () {\n let opened = oneEvent(this.manual, 'sp-opened');\n this.manual.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.true;\n\n opened = oneEvent(this.page, 'sp-opened');\n this.page.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.true;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.true;\n });\n });\n it('ignores Escape key interactions', async () => {\n const el = await styledFixture<Overlay>(html`\n <sp-overlay type=\"page\">\n <sp-popover>This is a \"page\" Overlay</sp-popover>\n </sp-overlay>\n `);\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(el.open).to.be.true;\n\n await sendKeys({\n press: 'Escape',\n });\n\n await elementUpdated(el);\n\n expect(el.open).to.be.true;\n });\n });\n\n describe('[type=\"hint\"]', () => {\n opensDeclaratively('hint');\n\n it('closes other `[type=hint]` overlays when opening', async () => {\n const test = await styledFixture<Overlay>(html`\n <div>\n ${[1, 2].map(\n (overlay) => html`\n <sp-overlay type=\"hint\" class=\"hint-${overlay}\">\n <sp-tooltip>Hint ${overlay} Content</sp-tooltip>\n </sp-overlay>\n `\n )}\n </div>\n `);\n const hint1 = test.querySelector('.hint-1') as Overlay;\n const hint2 = test.querySelector('.hint-2') as Overlay;\n\n expect(hint1.open).to.be.false;\n expect(hint2.open).to.be.false;\n\n let opened = oneEvent(hint1, 'sp-opened');\n hint1.open = true;\n await opened;\n\n expect(hint1.open).to.be.true;\n expect(hint2.open).to.be.false;\n\n opened = oneEvent(hint2, 'sp-opened');\n let closed = oneEvent(hint1, 'sp-closed');\n hint2.open = true;\n await opened;\n await closed;\n\n expect(hint1.open).to.be.false;\n expect(hint2.open).to.be.true;\n\n opened = oneEvent(hint1, 'sp-opened');\n closed = oneEvent(hint2, 'sp-closed');\n hint1.open = true;\n await opened;\n await closed;\n\n expect(hint1.open).to.be.true;\n expect(hint2.open).to.be.false;\n });\n it('stays open when pointer enters overlay from trigger element', async () => {\n const test = await styledFixture(html`\n <div>\n <sp-button id=\"test-button\">This is a button.</sp-button>\n <sp-overlay\n trigger=\"test-button@hover\"\n type=\"hint\"\n placement=\"bottom\"\n offset=\"-10\"\n >\n <sp-tooltip>Help text.</sp-tooltip>\n </sp-overlay>\n </div>\n `);\n\n const button = test.querySelector('sp-button') as Button;\n const overlay = test.querySelector(\n 'sp-overlay'\n ) as unknown as Overlay;\n const el = test.querySelector('sp-tooltip') as Tooltip;\n const buttonRect = button.getBoundingClientRect();\n const buttonPoint = [\n buttonRect.x + buttonRect.width / 2,\n buttonRect.y + buttonRect.height - 2,\n ] as [number, number];\n\n await elementUpdated(overlay);\n\n // This test is possibly weird in its over simplicity for this contexts...\n await expect(button).to.be.accessible();\n // Pointer enter the button to trigger the tooltip\n let opened = oneEvent(button, 'sp-opened');\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: buttonPoint,\n },\n ],\n });\n await elementUpdated(overlay);\n // Allow the overlay process time to get started (we're not waiting for it to finish),\n // so that the next step can happen _while_ it opens.\n await nextFrame();\n await nextFrame();\n expect(overlay.open).to.be.true;\n // Pointer leave the button to close the tooltip, but...\n // Pointer enter the tooltip to keep the tooltip open\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n buttonRect.x + buttonRect.width / 2,\n buttonRect.y + buttonRect.height - 1,\n ],\n },\n {\n type: 'move',\n position: [\n buttonRect.x + buttonRect.width / 2,\n buttonRect.y + buttonRect.height,\n ],\n },\n {\n type: 'move',\n position: [\n buttonRect.x + buttonRect.width / 2,\n buttonRect.y + buttonRect.height + 1,\n ],\n },\n ],\n });\n // Give the Overlay some time to process what just happened.\n await nextFrame();\n await nextFrame();\n expect(overlay.open).to.be.true;\n await opened;\n\n expect(el.open).to.be.true;\n await expect(button).to.be.accessible();\n\n let closed = oneEvent(button, 'sp-closed');\n // point enter the button to trigger the tooltip\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: buttonPoint,\n },\n ],\n });\n // pointer leave the button to close the tooltip\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n buttonRect.x + buttonRect.width * 2,\n buttonRect.y + buttonRect.height * 2,\n ] as [number, number],\n },\n ],\n });\n await closed;\n\n expect(el.open).to.be.false;\n\n opened = oneEvent(button, 'sp-opened');\n // pointer enter the button to trigger the tooltip\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: buttonPoint,\n },\n ],\n });\n await opened;\n await elementUpdated(el);\n closed = oneEvent(button, 'sp-closed');\n // pointer leave the button to close the tooltip\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n buttonRect.x + buttonRect.width * 2,\n buttonRect.y + buttonRect.height * 2,\n ] as [number, number],\n },\n ],\n });\n await closed;\n });\n it('stays open when pointer enters overlay from trigger element: self managed', async () => {\n const button = await styledFixture(html`\n <sp-button>\n This is a button.\n <sp-tooltip self-managed placement=\"bottom\">\n Help text.\n </sp-tooltip>\n </sp-button>\n `);\n\n const el = button.querySelector('sp-tooltip') as Tooltip;\n const buttonRect = button.getBoundingClientRect();\n const buttonPoint = [\n buttonRect.x + buttonRect.width / 2,\n buttonRect.y + buttonRect.height / 2,\n ] as [number, number];\n\n await elementUpdated(el);\n // This test is possibly weird in its over simplicity for this contexts...\n await expect(button).to.be.accessible();\n // Pointer enter the button to trigger the tooltip\n let opened = oneEvent(button, 'sp-opened');\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: buttonPoint,\n },\n ],\n });\n // It takes this many frame for the overlay content to actual be queryable.\n // We're trying to do work _before_ `sp-opened` so it's a little tricky.\n // Is it possible to do this work _after_ `sp-opened` for more stability?\n // Try futzing with the `offset` values of the `sp-overlay`?\n await nextFrame();\n await nextFrame();\n await nextFrame();\n await nextFrame();\n const tooltipRect = (\n el.shadowRoot.querySelector('#tooltip') as HTMLDivElement\n ).getBoundingClientRect();\n const tooltipPoint = [\n tooltipRect.x + tooltipRect.width / 2,\n tooltipRect.y + tooltipRect.height / 2,\n ] as [number, number];\n // Pointer leave the button to close the tooltip, but...\n // Pointer enter the tooltip to keep the tooltip open\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: tooltipPoint,\n },\n ],\n });\n await opened;\n\n expect(el.open).to.be.true;\n await expect(button).to.be.accessible();\n\n let closed = oneEvent(button, 'sp-closed');\n // point enter the button to trigger the tooltip\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: buttonPoint,\n },\n ],\n });\n // pointer leave the button to close the tooltip\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n buttonRect.x + buttonRect.width * 2,\n buttonRect.y + buttonRect.height * 2,\n ] as [number, number],\n },\n ],\n });\n await closed;\n\n expect(el.open).to.be.false;\n\n opened = oneEvent(button, 'sp-opened');\n // pointer enter the button to trigger the tooltip\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: buttonPoint,\n },\n ],\n });\n await opened;\n expect(el.open).to.be.true;\n\n closed = oneEvent(button, 'sp-closed');\n // pointer leave the button to close the tooltip\n sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n buttonRect.x + buttonRect.width * 2,\n buttonRect.y + buttonRect.height * 2,\n ] as [number, number],\n },\n ],\n });\n await closed;\n expect(el.open).to.be.false;\n });\n });\n describe('[type=\"auto\"]', () => {\n opensDeclaratively('auto');\n it('receives focus', async () => {\n const test = await fixture(html`\n <div>${receivesFocus(receivesFocus.args)}</div>\n `);\n const trigger = test.querySelector('#trigger') as Button;\n const overlay = test.querySelector('a');\n\n expect(document.activeElement === overlay).to.be.false;\n\n const opened = oneEvent(trigger, 'sp-opened');\n trigger.click();\n await opened;\n\n expect(document.activeElement === overlay).to.be.true;\n });\n it('does not close when clicking a Slider track in the Overlay', async function () {\n const test = await fixture(html`\n <div>${withSlider()}</div>\n `);\n const el = test.querySelector('sp-overlay') as Overlay;\n const button = test.querySelector('sp-button') as Button;\n const slider = el.querySelector('sp-slider') as Slider;\n const track = slider.shadowRoot.querySelector(\n '#track'\n ) as HTMLDivElement;\n\n expect(el.open).to.be.false;\n\n const opened = oneEvent(el, 'sp-opened');\n const buttonRect = button.getBoundingClientRect();\n sendMouse({\n steps: [\n {\n type: 'click',\n position: [\n buttonRect.left + buttonRect.width / 2,\n buttonRect.top + buttonRect.height / 2,\n ],\n },\n ],\n });\n await opened;\n\n expect(el.open).to.be.true;\n expect(slider.value).to.equal(5);\n\n const sliderRect = track.getBoundingClientRect();\n\n let pointerId = -1;\n slider.track.setPointerCapture = (id: number) => (pointerId = id);\n slider.track.releasePointerCapture = (id: number) =>\n (pointerId = id);\n expect(pointerId).to.equal(-1);\n track.dispatchEvent(\n new PointerEvent('pointerdown', {\n clientX: sliderRect.left + sliderRect.width - 5,\n clientY: sliderRect.top + sliderRect.height / 2,\n pointerId: 1,\n cancelable: true,\n bubbles: true,\n composed: true,\n button: 0,\n })\n );\n await elementUpdated(slider);\n\n track.dispatchEvent(\n new PointerEvent('pointerup', {\n pointerId: 1,\n cancelable: true,\n bubbles: true,\n composed: true,\n })\n );\n await elementUpdated(slider);\n\n await aTimeout(1500);\n\n expect(slider.value).to.equal(19.5);\n expect(el.open).to.be.true;\n });\n });\n describe('[type=\"manual\"]', () => {\n opensDeclaratively('manual');\n describe('interaction with other non-ancestor overlays', function () {\n beforeEach(async function () {\n this.fixture = await styledFixture<Overlay>(html`\n <div>\n ${OVERLAY_TYPES.map(\n (type) => html`\n <sp-overlay type=${type}>\n <sp-tooltip>${type} Content</sp-tooltip>\n </sp-overlay>\n `\n )}\n </div>\n `);\n\n this.modal = this.fixture.querySelector(\n '[type=\"modal\"]'\n ) as Overlay;\n this.page = this.fixture.querySelector(\n '[type=\"page\"]'\n ) as Overlay;\n this.hint = this.fixture.querySelector(\n '[type=\"hint\"]'\n ) as Overlay;\n this.auto = this.fixture.querySelector(\n '[type=\"auto\"]'\n ) as Overlay;\n this.manual = this.fixture.querySelector(\n '[type=\"manual\"]'\n ) as Overlay;\n\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n afterEach(async function () {\n const closed = oneEvent(this.manual, 'sp-closed');\n this.manual.open = false;\n await closed;\n });\n it('does not close \"modal\" overlays when opening', async function () {\n let opened = oneEvent(this.modal, 'sp-opened');\n this.modal.open = true;\n await opened;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.manual, 'sp-opened');\n this.manual.open = true;\n await opened;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.true;\n });\n it('does not close \"modal\" overlays when opening', async function () {\n let opened = oneEvent(this.page, 'sp-opened');\n this.page.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.true;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.manual, 'sp-opened');\n this.manual.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.true;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.true;\n });\n it('does not close \"hint\" overlays when opening', async function () {\n let opened = oneEvent(this.hint, 'sp-opened');\n this.hint.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.true;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.manual, 'sp-opened');\n this.manual.open = true;\n await opened;\n\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.true;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.true;\n });\n it('does not close \"auto\" overlays when opening', async function () {\n let opened = oneEvent(this.auto, 'sp-opened');\n this.auto.open = true;\n await opened;\n\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.true;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.manual, 'sp-opened');\n this.manual.open = true;\n await opened;\n\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.true;\n expect(this.manual.open).to.be.true;\n });\n });\n describe('only close when manually closed', function () {\n it('does not close when clicking away', async () => {\n const test = await fixture(html`\n <div>\n ${click({\n ...click.args,\n interaction: 'click',\n placement: 'bottom',\n type: 'manual',\n delayed: false,\n receivesFocus: 'auto',\n })}\n </div>\n `);\n const el = test.querySelector('sp-overlay') as Overlay;\n\n expect(el.open).to.be.false;\n\n const opened = oneEvent<OverlayStateEvent>(el, 'sp-opened');\n el.open = true;\n let { overlay } = await opened;\n expect(el === overlay).to.be.true;\n\n await sendMouse({\n steps: [\n {\n type: 'click',\n position: [50, 400],\n },\n ],\n });\n\n await aTimeout(200);\n\n expect(el.open).to.be.true;\n\n const closed = oneEvent<OverlayStateEvent>(el, 'sp-closed');\n el.open = false;\n ({ overlay } = await closed);\n expect(el === overlay).to.be.true;\n\n expect(el.open).to.be.false;\n });\n it('does not close when pressing `Escape`', async () => {\n const test = await fixture(html`\n <div>\n ${click({\n ...click.args,\n interaction: 'click',\n placement: 'bottom',\n type: 'manual',\n delayed: false,\n receivesFocus: 'auto',\n })}\n </div>\n `);\n const el = test.querySelector('sp-overlay') as Overlay;\n\n expect(el.open).to.be.false;\n\n const opened = oneEvent<OverlayStateEvent>(el, 'sp-opened');\n el.open = true;\n let { overlay } = await opened;\n expect(el === overlay).to.be.true;\n\n await sendKeys({\n press: 'Escape',\n });\n\n await aTimeout(200);\n\n expect(el.open).to.be.true;\n\n const closed = oneEvent<OverlayStateEvent>(el, 'sp-closed');\n el.open = false;\n ({ overlay } = await closed);\n expect(el === overlay).to.be.true;\n\n expect(el.open).to.be.false;\n });\n });\n });\n});\n"],
|
|
5
|
-
"mappings": ";AAWA;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAEP,OAAO;AAEP,OAAO;AACP,OAAO;AAGP,OAAO;AACP,OAAO;AACP,OAAO;AAEP,SAAS,iBAAiB;AAE1B,SAAS,gBAAgB;AACzB;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP;AAAA,EACI;AAAA,OAEG;AACP,SAAS,YAAY;AAIrB,MAAM,gBAAgB,CAAC,SAAS,QAAQ,QAAQ,QAAQ,QAAQ;AAGhE,eAAe,cACX,OACU;AACV,QAAM,OAAO,MAAM,QAAe;AAAA;AAAA,cAExB,KAAK;AAAA;AAAA,KAEd;AACD,SAAO,KAAK,SAAS,CAAC;AAC1B;AAEA,SAAS,cAAc,MAAM;AACzB,WAAS,mBAAmB,aAAiC;AACzD,OAAG,cAAc,WAAW,OAAO,YAAY;AAC3C,YAAM,KAAK,MAAM,cAAuB;AAAA,wCACZ,WAAW;AAAA;AAAA;AAAA,aAGtC;AACD,YAAM,UAAU,GAAG,SAAS,CAAC;AAC7B,UAAI,SAAS,SAAS,IAAI,WAAW;AACrC,YAAM;AAEN,aAAO,QAAQ,IAAI,EAAE,GAAG,GAAG;AAC3B,YAAM,SAAS,SAAS,IAAI,WAAW;AACvC,SAAG,OAAO;AACV,YAAM;AAEN,aAAO,QAA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,EAAE,QAAQ,IAAI,MAAM;AACrB,eAAO,OAAO,OAAO,EAAE,GAAG,GAAG;AAE7B,eAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AAAA,MAC1B,CAAC;AACD,SAAG,yCAAyC,YAAY;AACpD,cAAM,OAAO,MAAM,QAAQ;AAAA;AAAA,0BAEjB,MAAM;AAAA,UACJ,GAAG,MAAM;AAAA,UACT,aAAa;AAAA,UACb,WAAW;AAAA,UACX,MAAM;AAAA,UACN,SAAS;AAAA,UACT,eAAe;AAAA,QACnB,CAAC,CAAC;AAAA;AAAA,iBAET;AACD,cAAM,KAAK,KAAK,cAAc,YAAY;AAE1C,eAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AAEtB,cAAM,SAAS,SAA4B,IAAI,WAAW;AAC1D,WAAG,OAAO;AACV,YAAI,EAAE,QAAQ,IAAI,MAAM;AACxB,eAAO,OAAO,OAAO,EAAE,GAAG,GAAG;AAE7B,cAAM,SAAS;AAAA,UACX,OAAO;AAAA,QACX,CAAC;AAED,cAAM,SAAS,GAAG;AAElB,eAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AAEtB,cAAM,SAAS,SAA4B,IAAI,WAAW;AAC1D,WAAG,OAAO;AACV,SAAC,EAAE,QAAQ,IAAI,MAAM;AACrB,eAAO,OAAO,OAAO,EAAE,GAAG,GAAG;AAE7B,eAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AAAA,MAC1B,CAAC;AAAA,IACL,CAAC;AAAA,EACL,CAAC;AACL,CAAC;",
|
|
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*/\nimport {\n aTimeout,\n elementUpdated,\n expect,\n fixture,\n html,\n nextFrame,\n oneEvent,\n} from '@open-wc/testing';\nimport { Overlay } from '@spectrum-web-components/overlay/src/Overlay.js';\nimport '@spectrum-web-components/overlay/sp-overlay.js';\nimport { Tooltip } from '@spectrum-web-components/tooltip';\nimport '@spectrum-web-components/tooltip/sp-tooltip.js';\nimport '@spectrum-web-components/popover/sp-popover.js';\nimport { Theme } from '@spectrum-web-components/theme';\nimport { TemplateResult } from '@spectrum-web-components/base';\nimport '@spectrum-web-components/theme/sp-theme.js';\nimport '@spectrum-web-components/theme/src/themes.js';\nimport '@spectrum-web-components/button/sp-button.js';\n\nimport { sendMouse } from '../../../test/plugins/browser.js';\nimport { Button } from '@spectrum-web-components/button';\nimport { sendKeys } from '@web/test-runner-commands';\nimport {\n click,\n receivesFocus,\n withSlider,\n} from '../stories/overlay-element.stories.js';\nimport {\n removeSlottableRequest,\n SlottableRequestEvent,\n} from '../src/slottable-request-event.js';\nimport { stub } from 'sinon';\nimport { OverlayStateEvent } from '@spectrum-web-components/overlay/src/events.js';\nimport { Slider } from '@spectrum-web-components/slider/src/Slider.js';\n\nconst OVERLAY_TYPES = ['modal', 'page', 'hint', 'auto', 'manual'] as const;\ntype OverlayTypes = (typeof OVERLAY_TYPES)[number];\n\nasync function styledFixture<T extends Element>(\n story: TemplateResult\n): Promise<T> {\n const test = await fixture<Theme>(html`\n <sp-theme system=\"spectrum\" scale=\"medium\" color=\"light\">\n ${story}\n </sp-theme>\n `);\n return test.children[0] as T;\n}\n\ndescribe('sp-overlay', () => {\n function opensDeclaratively(overlayType: OverlayTypes): void {\n it(`as [type=\"'${overlayType}'\"]`, async () => {\n const el = await styledFixture<Overlay>(html`\n <sp-overlay open type=${overlayType}>\n <sp-tooltip>Content</sp-tooltip>\n </sp-overlay>\n `);\n const content = el.children[0] as Tooltip;\n let opened = oneEvent(el, 'sp-opened');\n await opened;\n\n expect(content.open).to.be.true;\n const closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(content.open).to.be.false;\n opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(content.open).to.be.true;\n });\n }\n\n describe('`slottable-request` event', () => {\n it('dispatched before `sp-opened`', async function () {\n let slottableRequestTime = 0;\n let openedTime = 0;\n const el = await fixture<Overlay>(html`\n <sp-overlay\n @slottable-request=${() =>\n (slottableRequestTime = performance.now())}\n @sp-opened=${() => (openedTime = performance.now())}\n >\n <sp-popover>test</sp-popover>\n </sp-overlay>\n `);\n\n await elementUpdated(el);\n\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(slottableRequestTime).to.be.lt(openedTime);\n });\n it('dispatched after `sp-closed`', async function () {\n let slottableRequestTime = 0;\n let closedTime = 0;\n const el = await fixture<Overlay>(html`\n <sp-overlay\n @sp-closed=${() => (closedTime = performance.now())}\n @slottable-request=${() =>\n (slottableRequestTime = performance.now())}\n >\n <sp-popover>test</sp-popover>\n </sp-overlay>\n `);\n\n await elementUpdated(el);\n\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n await nextFrame();\n await nextFrame();\n\n const closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n await nextFrame();\n await nextFrame();\n\n expect(\n slottableRequestTime,\n `slottable-request: ${slottableRequestTime}, sp-closed: ${closedTime}`\n ).to.be.gt(closedTime);\n });\n it('follows transition timing from lazily added children', async function () {\n let slottableRequestTime = 0;\n let openedTime = 0;\n const popover = document.createElement('sp-popover');\n popover.textContent = 'Test';\n const el = await fixture<Overlay>(html`\n <sp-overlay\n @slottable-request=${(event: SlottableRequestEvent) => {\n slottableRequestTime = performance.now();\n if (event.data !== removeSlottableRequest) {\n (event.target as HTMLElement).append(popover);\n } else {\n popover.remove();\n }\n }}\n @sp-opened=${() => (openedTime = performance.now())}\n ></sp-overlay>\n `);\n\n await elementUpdated(el);\n\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(slottableRequestTime).to.be.lte(openedTime);\n expect(openedTime - slottableRequestTime).to.be.gt(130);\n });\n\n describe('dev mode', () => {\n let consoleWarnStub!: ReturnType<typeof stub>;\n before(() => {\n window.__swc.verbose = true;\n consoleWarnStub = stub(console, 'warn');\n });\n afterEach(() => {\n consoleWarnStub.resetHistory();\n });\n after(() => {\n window.__swc.verbose = false;\n consoleWarnStub.restore();\n });\n\n it('warns that `slottable-request` events are experimental', async () => {\n const el = await fixture<Overlay>(html`\n <sp-overlay>\n <sp-popover>test</sp-popover>\n </sp-overlay>\n `);\n\n await elementUpdated(el);\n\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(consoleWarnStub.called).to.be.true;\n const spyCall = consoleWarnStub.getCall(0);\n expect(\n (spyCall.args.at(0) as string).includes(\n '`slottable-request` events are experimental'\n ),\n '`slottable-request`-centric message'\n ).to.be.true;\n expect(\n spyCall.args.at(-1),\n 'confirm `data` shape'\n ).to.deep.equal({\n data: {\n localName: 'base',\n type: 'api',\n level: 'high',\n },\n });\n });\n });\n });\n\n describe('[type=\"modal\"]', () => {\n opensDeclaratively('modal');\n describe('interaction with other non-ancestor overlays', function () {\n beforeEach(async function () {\n this.fixture = await styledFixture<Overlay>(html`\n <div>\n ${OVERLAY_TYPES.map(\n (type) => html`\n <sp-overlay type=${type}>\n <sp-tooltip>${type} Content</sp-tooltip>\n </sp-overlay>\n `\n )}\n </div>\n `);\n\n this.modal = this.fixture.querySelector(\n '[type=\"modal\"]'\n ) as Overlay;\n this.page = this.fixture.querySelector(\n '[type=\"page\"]'\n ) as Overlay;\n this.hint = this.fixture.querySelector(\n '[type=\"hint\"]'\n ) as Overlay;\n this.auto = this.fixture.querySelector(\n '[type=\"auto\"]'\n ) as Overlay;\n this.manual = this.fixture.querySelector(\n '[type=\"manual\"]'\n ) as Overlay;\n\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n afterEach(async function () {\n const closed = oneEvent(this.modal, 'sp-closed');\n this.modal.open = false;\n await closed;\n });\n it('closes \"page\" overlays when opening', async function () {\n let opened = oneEvent(this.page, 'sp-opened');\n this.page.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.true;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.modal, 'sp-opened');\n const closed = oneEvent(this.page, 'sp-closed');\n this.modal.open = true;\n await opened;\n await closed;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n it('closes \"hint\" overlays when opening', async function () {\n let opened = oneEvent(this.hint, 'sp-opened');\n this.hint.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.true;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.modal, 'sp-opened');\n const closed = oneEvent(this.hint, 'sp-closed');\n this.modal.open = true;\n await opened;\n await closed;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n it('closes \"auto\" overlays when opening', async function () {\n let opened = oneEvent(this.auto, 'sp-opened');\n this.auto.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.true;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.modal, 'sp-opened');\n const closed = oneEvent(this.auto, 'sp-closed');\n this.modal.open = true;\n await opened;\n await closed;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n it('does not close \"manual\" overlays when opening', async function () {\n let opened = oneEvent(this.manual, 'sp-opened');\n this.manual.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.true;\n\n opened = oneEvent(this.modal, 'sp-opened');\n this.modal.open = true;\n await opened;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.true;\n });\n });\n });\n describe('[type=\"page\"]', () => {\n opensDeclaratively('page');\n describe('interaction with other non-ancestor overlays', function () {\n beforeEach(async function () {\n this.fixture = await styledFixture<Overlay>(html`\n <div>\n ${OVERLAY_TYPES.map(\n (type) => html`\n <sp-overlay type=${type}>\n <sp-tooltip>${type} Content</sp-tooltip>\n </sp-overlay>\n `\n )}\n </div>\n `);\n\n this.modal = this.fixture.querySelector(\n '[type=\"modal\"]'\n ) as Overlay;\n this.page = this.fixture.querySelector(\n '[type=\"page\"]'\n ) as Overlay;\n this.hint = this.fixture.querySelector(\n '[type=\"hint\"]'\n ) as Overlay;\n this.auto = this.fixture.querySelector(\n '[type=\"auto\"]'\n ) as Overlay;\n this.manual = this.fixture.querySelector(\n '[type=\"manual\"]'\n ) as Overlay;\n\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n afterEach(async function () {\n const closed = oneEvent(this.page, 'sp-closed');\n this.page.open = false;\n await closed;\n });\n it('should not close \"modal\" overlays when opening', async function () {\n let opened = oneEvent(this.modal, 'sp-opened');\n this.modal.open = true;\n await opened;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.page, 'sp-opened');\n this.page.open = true;\n await opened;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.true;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n it('closes \"hint\" overlays when opening', async function () {\n let opened = oneEvent(this.hint, 'sp-opened');\n this.hint.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.true;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.page, 'sp-opened');\n const closed = oneEvent(this.hint, 'sp-closed');\n this.page.open = true;\n await opened;\n await closed;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.true;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n it('closes \"auto\" overlays when opening', async function () {\n let opened = oneEvent(this.auto, 'sp-opened');\n this.auto.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.true;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.page, 'sp-opened');\n const closed = oneEvent(this.auto, 'sp-closed');\n this.page.open = true;\n await opened;\n await closed;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.true;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n it('does not close \"manual\" overlays when opening', async function () {\n let opened = oneEvent(this.manual, 'sp-opened');\n this.manual.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.true;\n\n opened = oneEvent(this.page, 'sp-opened');\n this.page.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.true;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.true;\n });\n });\n it('ignores Escape key interactions', async () => {\n const el = await styledFixture<Overlay>(html`\n <sp-overlay type=\"page\">\n <sp-popover>This is a \"page\" Overlay</sp-popover>\n </sp-overlay>\n `);\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(el.open).to.be.true;\n\n await sendKeys({\n press: 'Escape',\n });\n\n await elementUpdated(el);\n\n expect(el.open).to.be.true;\n });\n });\n\n describe('[type=\"hint\"]', () => {\n opensDeclaratively('hint');\n\n it('closes other `[type=hint]` overlays when opening', async () => {\n const test = await styledFixture<Overlay>(html`\n <div>\n ${[1, 2].map(\n (overlay) => html`\n <sp-overlay type=\"hint\" class=\"hint-${overlay}\">\n <sp-tooltip>Hint ${overlay} Content</sp-tooltip>\n </sp-overlay>\n `\n )}\n </div>\n `);\n const hint1 = test.querySelector('.hint-1') as Overlay;\n const hint2 = test.querySelector('.hint-2') as Overlay;\n\n expect(hint1.open).to.be.false;\n expect(hint2.open).to.be.false;\n\n let opened = oneEvent(hint1, 'sp-opened');\n hint1.open = true;\n await opened;\n\n expect(hint1.open).to.be.true;\n expect(hint2.open).to.be.false;\n\n opened = oneEvent(hint2, 'sp-opened');\n let closed = oneEvent(hint1, 'sp-closed');\n hint2.open = true;\n await opened;\n await closed;\n\n expect(hint1.open).to.be.false;\n expect(hint2.open).to.be.true;\n\n opened = oneEvent(hint1, 'sp-opened');\n closed = oneEvent(hint2, 'sp-closed');\n hint1.open = true;\n await opened;\n await closed;\n\n expect(hint1.open).to.be.true;\n expect(hint2.open).to.be.false;\n });\n it('stays open when pointer enters overlay from trigger element', async () => {\n const test = await styledFixture(html`\n <div>\n <sp-button id=\"test-button\">This is a button.</sp-button>\n <sp-overlay\n trigger=\"test-button@hover\"\n type=\"hint\"\n placement=\"bottom\"\n offset=\"-10\"\n >\n <sp-tooltip>Help text.</sp-tooltip>\n </sp-overlay>\n </div>\n `);\n\n const button = test.querySelector('sp-button') as Button;\n const overlay = test.querySelector(\n 'sp-overlay'\n ) as unknown as Overlay;\n const el = test.querySelector('sp-tooltip') as Tooltip;\n const buttonRect = button.getBoundingClientRect();\n const buttonPoint = [\n buttonRect.x + buttonRect.width / 2,\n buttonRect.y + buttonRect.height - 2,\n ] as [number, number];\n\n await elementUpdated(overlay);\n\n // This test is possibly weird in its over simplicity for this contexts...\n await expect(button).to.be.accessible();\n // Pointer enter the button to trigger the tooltip\n let opened = oneEvent(button, 'sp-opened');\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: buttonPoint,\n },\n ],\n });\n await elementUpdated(overlay);\n // Allow the overlay process time to get started (we're not waiting for it to finish),\n // so that the next step can happen _while_ it opens.\n await nextFrame();\n await nextFrame();\n expect(overlay.open).to.be.true;\n // Pointer leave the button to close the tooltip, but...\n // Pointer enter the tooltip to keep the tooltip open\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n buttonRect.x + buttonRect.width / 2,\n buttonRect.y + buttonRect.height - 1,\n ],\n },\n {\n type: 'move',\n position: [\n buttonRect.x + buttonRect.width / 2,\n buttonRect.y + buttonRect.height,\n ],\n },\n {\n type: 'move',\n position: [\n buttonRect.x + buttonRect.width / 2,\n buttonRect.y + buttonRect.height + 1,\n ],\n },\n ],\n });\n // Give the Overlay some time to process what just happened.\n await nextFrame();\n await nextFrame();\n expect(overlay.open).to.be.true;\n await opened;\n\n expect(el.open).to.be.true;\n await expect(button).to.be.accessible();\n\n let closed = oneEvent(button, 'sp-closed');\n // point enter the button to trigger the tooltip\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: buttonPoint,\n },\n ],\n });\n // pointer leave the button to close the tooltip\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n buttonRect.x + buttonRect.width * 2,\n buttonRect.y + buttonRect.height * 2,\n ] as [number, number],\n },\n ],\n });\n await closed;\n\n expect(el.open).to.be.false;\n\n opened = oneEvent(button, 'sp-opened');\n // pointer enter the button to trigger the tooltip\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: buttonPoint,\n },\n ],\n });\n await opened;\n await elementUpdated(el);\n closed = oneEvent(button, 'sp-closed');\n // pointer leave the button to close the tooltip\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n buttonRect.x + buttonRect.width * 2,\n buttonRect.y + buttonRect.height * 2,\n ] as [number, number],\n },\n ],\n });\n await closed;\n });\n it('stays open when pointer enters overlay from trigger element: self managed', async () => {\n const button = await styledFixture(html`\n <sp-button>\n This is a button.\n <sp-tooltip self-managed placement=\"bottom\">\n Help text.\n </sp-tooltip>\n </sp-button>\n `);\n\n const el = button.querySelector('sp-tooltip') as Tooltip;\n const buttonRect = button.getBoundingClientRect();\n const buttonPoint = [\n buttonRect.x + buttonRect.width / 2,\n buttonRect.y + buttonRect.height / 2,\n ] as [number, number];\n\n await elementUpdated(el);\n // This test is possibly weird in its over simplicity for this contexts...\n await expect(button).to.be.accessible();\n // Pointer enter the button to trigger the tooltip\n let opened = oneEvent(button, 'sp-opened');\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: buttonPoint,\n },\n ],\n });\n // It takes this many frame for the overlay content to actual be queryable.\n // We're trying to do work _before_ `sp-opened` so it's a little tricky.\n // Is it possible to do this work _after_ `sp-opened` for more stability?\n // Try futzing with the `offset` values of the `sp-overlay`?\n await nextFrame();\n await nextFrame();\n await nextFrame();\n await nextFrame();\n const tooltipRect = (\n el.shadowRoot.querySelector('#tooltip') as HTMLDivElement\n ).getBoundingClientRect();\n const tooltipPoint = [\n tooltipRect.x + tooltipRect.width / 2,\n tooltipRect.y + tooltipRect.height / 2,\n ] as [number, number];\n // Pointer leave the button to close the tooltip, but...\n // Pointer enter the tooltip to keep the tooltip open\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: tooltipPoint,\n },\n ],\n });\n await opened;\n\n expect(el.open).to.be.true;\n await expect(button).to.be.accessible();\n\n let closed = oneEvent(button, 'sp-closed');\n // point enter the button to trigger the tooltip\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: buttonPoint,\n },\n ],\n });\n // pointer leave the button to close the tooltip\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n buttonRect.x + buttonRect.width * 2,\n buttonRect.y + buttonRect.height * 2,\n ] as [number, number],\n },\n ],\n });\n await closed;\n\n expect(el.open).to.be.false;\n\n opened = oneEvent(button, 'sp-opened');\n // pointer enter the button to trigger the tooltip\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: buttonPoint,\n },\n ],\n });\n await opened;\n expect(el.open).to.be.true;\n\n closed = oneEvent(button, 'sp-closed');\n // pointer leave the button to close the tooltip\n sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n buttonRect.x + buttonRect.width * 2,\n buttonRect.y + buttonRect.height * 2,\n ] as [number, number],\n },\n ],\n });\n await closed;\n expect(el.open).to.be.false;\n });\n });\n describe('[type=\"auto\"]', () => {\n opensDeclaratively('auto');\n it('receives focus', async () => {\n const test = await fixture(html`\n <div>${receivesFocus(receivesFocus.args)}</div>\n `);\n const trigger = test.querySelector('#trigger') as Button;\n const overlay = test.querySelector('a');\n\n expect(document.activeElement === overlay).to.be.false;\n\n const opened = oneEvent(trigger, 'sp-opened');\n trigger.click();\n await opened;\n\n expect(document.activeElement === overlay).to.be.true;\n });\n it('does not close when clicking a Slider track in the Overlay', async function () {\n const test = await fixture(html`\n <div>${withSlider()}</div>\n `);\n const el = test.querySelector('sp-overlay') as Overlay;\n const button = test.querySelector('sp-button') as Button;\n const slider = el.querySelector('sp-slider') as Slider;\n const track = slider.shadowRoot.querySelector(\n '#track'\n ) as HTMLDivElement;\n\n expect(el.open).to.be.false;\n\n const opened = oneEvent(el, 'sp-opened');\n const buttonRect = button.getBoundingClientRect();\n sendMouse({\n steps: [\n {\n type: 'click',\n position: [\n buttonRect.left + buttonRect.width / 2,\n buttonRect.top + buttonRect.height / 2,\n ],\n },\n ],\n });\n await opened;\n\n expect(el.open).to.be.true;\n expect(slider.value).to.equal(5);\n\n const sliderRect = track.getBoundingClientRect();\n\n let pointerId = -1;\n slider.track.setPointerCapture = (id: number) => (pointerId = id);\n slider.track.releasePointerCapture = (id: number) =>\n (pointerId = id);\n expect(pointerId).to.equal(-1);\n track.dispatchEvent(\n new PointerEvent('pointerdown', {\n clientX: sliderRect.left + sliderRect.width - 5,\n clientY: sliderRect.top + sliderRect.height / 2,\n pointerId: 1,\n cancelable: true,\n bubbles: true,\n composed: true,\n button: 0,\n })\n );\n await elementUpdated(slider);\n\n track.dispatchEvent(\n new PointerEvent('pointerup', {\n pointerId: 1,\n cancelable: true,\n bubbles: true,\n composed: true,\n })\n );\n await elementUpdated(slider);\n\n await aTimeout(1500);\n\n expect(slider.value).to.equal(19.5);\n expect(el.open).to.be.true;\n });\n });\n describe('[type=\"manual\"]', () => {\n opensDeclaratively('manual');\n describe('interaction with other non-ancestor overlays', function () {\n beforeEach(async function () {\n this.fixture = await styledFixture<Overlay>(html`\n <div>\n ${OVERLAY_TYPES.map(\n (type) => html`\n <sp-overlay type=${type}>\n <sp-tooltip>${type} Content</sp-tooltip>\n </sp-overlay>\n `\n )}\n </div>\n `);\n\n this.modal = this.fixture.querySelector(\n '[type=\"modal\"]'\n ) as Overlay;\n this.page = this.fixture.querySelector(\n '[type=\"page\"]'\n ) as Overlay;\n this.hint = this.fixture.querySelector(\n '[type=\"hint\"]'\n ) as Overlay;\n this.auto = this.fixture.querySelector(\n '[type=\"auto\"]'\n ) as Overlay;\n this.manual = this.fixture.querySelector(\n '[type=\"manual\"]'\n ) as Overlay;\n\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n afterEach(async function () {\n const closed = oneEvent(this.manual, 'sp-closed');\n this.manual.open = false;\n await closed;\n });\n it('does not close \"modal\" overlays when opening', async function () {\n let opened = oneEvent(this.modal, 'sp-opened');\n this.modal.open = true;\n await opened;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.manual, 'sp-opened');\n this.manual.open = true;\n await opened;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.true;\n });\n it('does not close \"modal\" overlays when opening', async function () {\n let opened = oneEvent(this.page, 'sp-opened');\n this.page.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.true;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.manual, 'sp-opened');\n this.manual.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.true;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.true;\n });\n it('does not close \"hint\" overlays when opening', async function () {\n let opened = oneEvent(this.hint, 'sp-opened');\n this.hint.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.true;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.manual, 'sp-opened');\n this.manual.open = true;\n await opened;\n\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.true;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.true;\n });\n it('does not close \"auto\" overlays when opening', async function () {\n let opened = oneEvent(this.auto, 'sp-opened');\n this.auto.open = true;\n await opened;\n\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.true;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.manual, 'sp-opened');\n this.manual.open = true;\n await opened;\n\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.true;\n expect(this.manual.open).to.be.true;\n });\n });\n describe('only close when manually closed', function () {\n it('does not close when clicking away', async () => {\n const test = await fixture(html`\n <div>\n ${click({\n ...click.args,\n interaction: 'click',\n placement: 'bottom',\n type: 'manual',\n delayed: false,\n receivesFocus: 'auto',\n })}\n </div>\n `);\n const el = test.querySelector('sp-overlay') as Overlay;\n\n expect(el.open).to.be.false;\n\n const opened = oneEvent<OverlayStateEvent>(el, 'sp-opened');\n el.open = true;\n let { overlay } = await opened;\n expect(el === overlay).to.be.true;\n\n await sendMouse({\n steps: [\n {\n type: 'click',\n position: [50, 400],\n },\n ],\n });\n\n await aTimeout(200);\n\n expect(el.open).to.be.true;\n\n const closed = oneEvent<OverlayStateEvent>(el, 'sp-closed');\n el.open = false;\n ({ overlay } = await closed);\n expect(el === overlay).to.be.true;\n\n expect(el.open).to.be.false;\n });\n it('does not close when pressing `Escape`', async () => {\n const test = await fixture(html`\n <div>\n ${click({\n ...click.args,\n interaction: 'click',\n placement: 'bottom',\n type: 'manual',\n delayed: false,\n receivesFocus: 'auto',\n })}\n </div>\n `);\n const el = test.querySelector('sp-overlay') as Overlay;\n\n expect(el.open).to.be.false;\n\n const opened = oneEvent<OverlayStateEvent>(el, 'sp-opened');\n el.open = true;\n let { overlay } = await opened;\n expect(el === overlay).to.be.true;\n\n await sendKeys({\n press: 'Escape',\n });\n\n await aTimeout(200);\n\n expect(el.open).to.be.true;\n\n const closed = oneEvent<OverlayStateEvent>(el, 'sp-closed');\n el.open = false;\n ({ overlay } = await closed);\n expect(el === overlay).to.be.true;\n\n expect(el.open).to.be.false;\n });\n });\n });\n});\n"],
|
|
5
|
+
"mappings": ";AAWA;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAEP,OAAO;AAEP,OAAO;AACP,OAAO;AAGP,OAAO;AACP,OAAO;AACP,OAAO;AAEP,SAAS,iBAAiB;AAE1B,SAAS,gBAAg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