@spectrum-web-components/overlay 0.39.3 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -617,10 +617,18 @@
617
617
  "type": {
618
618
  "text": "boolean"
619
619
  },
620
- "default": "false",
621
620
  "description": "An Overlay that is `delayed` will wait until a warm-up period of 1000ms\nhas completed before opening. Once the warmup period has completed, all\nsubsequent Overlays will open immediately. When no Overlays are opened,\na cooldown period of 1000ms will begin. Once the cooldown has completed,\nthe next Overlay to be opened will be subject to the warm-up period if\nprovided that option.",
622
621
  "attribute": "delayed"
623
622
  },
623
+ {
624
+ "kind": "field",
625
+ "name": "_delayed",
626
+ "type": {
627
+ "text": "boolean"
628
+ },
629
+ "privacy": "private",
630
+ "default": "false"
631
+ },
624
632
  {
625
633
  "kind": "field",
626
634
  "name": "dialogEl",
@@ -1291,7 +1299,6 @@
1291
1299
  "type": {
1292
1300
  "text": "boolean"
1293
1301
  },
1294
- "default": "false",
1295
1302
  "description": "An Overlay that is `delayed` will wait until a warm-up period of 1000ms\nhas completed before opening. Once the warmup period has completed, all\nsubsequent Overlays will open immediately. When no Overlays are opened,\na cooldown period of 1000ms will begin. Once the cooldown has completed,\nthe next Overlay to be opened will be subject to the warm-up period if\nprovided that option.",
1296
1303
  "fieldName": "delayed"
1297
1304
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/overlay",
3
- "version": "0.39.3",
3
+ "version": "0.40.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -126,13 +126,13 @@
126
126
  "lit-html"
127
127
  ],
128
128
  "dependencies": {
129
- "@floating-ui/dom": "^1.5.1",
130
- "@floating-ui/utils": "^0.1.1",
131
- "@spectrum-web-components/action-button": "^0.39.3",
132
- "@spectrum-web-components/base": "^0.39.3",
133
- "@spectrum-web-components/reactive-controllers": "^0.39.3",
134
- "@spectrum-web-components/shared": "^0.39.3",
135
- "@spectrum-web-components/theme": "^0.39.3"
129
+ "@floating-ui/dom": "^1.5.3",
130
+ "@floating-ui/utils": "^0.1.6",
131
+ "@spectrum-web-components/action-button": "^0.40.0",
132
+ "@spectrum-web-components/base": "^0.40.0",
133
+ "@spectrum-web-components/reactive-controllers": "^0.40.0",
134
+ "@spectrum-web-components/shared": "^0.40.0",
135
+ "@spectrum-web-components/theme": "^0.40.0"
136
136
  },
137
137
  "types": "./src/index.d.ts",
138
138
  "customElements": "custom-elements.json",
@@ -144,5 +144,5 @@
144
144
  "./stories/overlay-story-components.js",
145
145
  "./**/*.dev.js"
146
146
  ],
147
- "gitHead": "d7840b3a9b99db4de62c44e3fb91b69dec7319af"
147
+ "gitHead": "24d5569a839da94892ecfd125428779587ffb1f5"
148
148
  }
@@ -33,7 +33,8 @@ export declare function forcePaint(): void;
33
33
  */
34
34
  export declare class AbstractOverlay extends SpectrumElement {
35
35
  protected applyFocus(_targetOpenState: boolean, _focusEl: HTMLElement | null): Promise<void>;
36
- delayed: boolean;
36
+ get delayed(): boolean;
37
+ set delayed(_delayed: boolean);
37
38
  dialogEl: HTMLDialogElement & {
38
39
  showPopover(): void;
39
40
  hidePopover(): void;
@@ -99,6 +99,12 @@ export class AbstractOverlay extends SpectrumElement {
99
99
  async applyFocus(_targetOpenState, _focusEl) {
100
100
  return;
101
101
  }
102
+ get delayed() {
103
+ return false;
104
+ }
105
+ set delayed(_delayed) {
106
+ return;
107
+ }
102
108
  async ensureOnDOM(_targetOpenState) {
103
109
  return;
104
110
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["AbstractOverlay.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 { SpectrumElement } from '@spectrum-web-components/base';\nimport { reparentChildren } from '@spectrum-web-components/shared/src/reparent-children.js';\n\nimport type {\n OpenableElement,\n OverlayOptions,\n OverlayOptionsV1,\n OverlayState,\n OverlayTypes,\n Placement,\n TriggerInteractionsV1,\n} from './overlay-types.dev.js'\nimport type { Overlay } from './Overlay.dev.js'\nimport type { VirtualTrigger } from './VirtualTrigger.dev.js'\nimport { OverlayTimer } from './overlay-timer.dev.js'\nimport { PlacementController } from './PlacementController.dev.js'\n\nexport const overlayTimer = new OverlayTimer();\n\nexport const noop = (): void => {\n return;\n};\n\nexport class BeforetoggleClosedEvent extends Event {\n currentState = 'open';\n newState = 'closed';\n constructor() {\n super('beforetoggle', {\n bubbles: false,\n composed: false,\n });\n }\n}\n\nexport class BeforetoggleOpenEvent extends Event {\n currentState = 'closed';\n newState = 'open';\n constructor() {\n super('beforetoggle', {\n bubbles: false,\n composed: false,\n });\n }\n}\n\n/**\n * Apply a \"transitionend\" listener to an element that may not transition but\n * guarantee the callback will be fired either way.\n *\n * @param el {HTMLElement} - Target of the \"transition\" listeners.\n * @param action {Function} - Method to trigger the \"transition\".\n * @param cb {Function} - Callback to trigger when the \"transition\" has ended.\n */\nexport const guaranteedAllTransitionend = (\n el: HTMLElement,\n action: () => void,\n cb: () => void\n): void => {\n const abortController = new AbortController();\n const runningTransitions = new Map<string, number>();\n const cleanup = (): void => {\n abortController.abort();\n cb();\n };\n let guarantee2: number;\n let guarantee3: number;\n // WebKit fires `transitionrun` a little earlier, the multiple guarantees here\n // allow WebKit to be caught, but doesn't remove the animation listener until\n // after it would have fired in Chromium.\n const guarantee1 = requestAnimationFrame(() => {\n guarantee2 = requestAnimationFrame(() => {\n guarantee3 = requestAnimationFrame(() => {\n cleanup();\n });\n });\n });\n const handleTransitionend = (event: TransitionEvent): void => {\n if (event.target !== el) {\n return;\n }\n runningTransitions.set(\n event.propertyName,\n (runningTransitions.get(event.propertyName) as number) - 1\n );\n if (!runningTransitions.get(event.propertyName)) {\n runningTransitions.delete(event.propertyName);\n }\n if (runningTransitions.size === 0) {\n cleanup();\n }\n };\n const handleTransitionrun = (event: TransitionEvent): void => {\n if (event.target !== el) {\n return;\n }\n if (!runningTransitions.has(event.propertyName)) {\n runningTransitions.set(event.propertyName, 0);\n }\n runningTransitions.set(\n event.propertyName,\n (runningTransitions.get(event.propertyName) as number) + 1\n );\n cancelAnimationFrame(guarantee1);\n cancelAnimationFrame(guarantee2);\n cancelAnimationFrame(guarantee3);\n };\n el.addEventListener('transitionrun', handleTransitionrun, {\n signal: abortController.signal,\n });\n el.addEventListener('transitionend', handleTransitionend, {\n signal: abortController.signal,\n });\n el.addEventListener('transitioncancel', handleTransitionend, {\n signal: abortController.signal,\n });\n action();\n};\n\nexport function nextFrame(): Promise<void> {\n return new Promise((res) => requestAnimationFrame(() => res()));\n}\n\nexport function forcePaint(): void {\n // force the browser to paint\n document.body.offsetHeight;\n}\n\n/**\n * Abstract Overlay base class so that property tyings and imperative API\n * interfaces can be held separate from the actual class definition.\n */\nexport class AbstractOverlay extends SpectrumElement {\n protected async applyFocus(\n _targetOpenState: boolean,\n _focusEl: HTMLElement | null\n ): Promise<void> {\n return;\n }\n delayed!: boolean;\n dialogEl!: HTMLDialogElement & {\n showPopover(): void;\n hidePopover(): void;\n };\n dispose = noop;\n protected async ensureOnDOM(_targetOpenState: boolean): Promise<void> {\n return;\n }\n elements!: OpenableElement[];\n protected async makeTransition(\n _targetOpenState: boolean\n ): Promise<HTMLElement | null> {\n return null;\n }\n protected async manageDelay(_targetOpenState: boolean): Promise<void> {\n return;\n }\n protected async manageDialogOpen(): Promise<void> {\n return;\n }\n protected async managePopoverOpen(): Promise<void> {\n return;\n }\n protected managePosition(): void {\n return;\n }\n protected offset: number | [number, number] = 6;\n get open(): boolean {\n return false;\n }\n set open(_open: boolean) {\n return;\n }\n placement?: Placement;\n protected placementController!: PlacementController;\n receivesFocus!: 'true' | 'false' | 'auto';\n get state(): OverlayState {\n return 'closed';\n }\n set state(_state: OverlayState) {\n return;\n }\n protected _state!: OverlayState;\n triggerElement!: HTMLElement | VirtualTrigger | null;\n type!: OverlayTypes;\n willPreventClose = false;\n\n public manuallyKeepOpen(): void {\n return;\n }\n\n public static update(): void {\n const overlayUpdateEvent = new CustomEvent('sp-update-overlays', {\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n document.dispatchEvent(overlayUpdateEvent);\n }\n\n /**\n * Overloaded imperative API entry point that allows for both the pre-0.37.0\n * argument signature as well as the post-0.37.0 signature. This allows for\n * consumers to continue to leverage it as they had been in previous releases\n * while also surfacing the more feature-rich API that has been made available.\n */\n public static async open(\n trigger: HTMLElement,\n interaction: TriggerInteractionsV1,\n content: HTMLElement,\n optionsV1: OverlayOptionsV1\n ): Promise<() => void>;\n public static async open(\n content: HTMLElement,\n options?: OverlayOptions\n ): Promise<Overlay>;\n public static async open(\n triggerOrContent: HTMLElement,\n interactionOrOptions:\n | TriggerInteractionsV1\n | OverlayOptions\n | undefined,\n content?: HTMLElement,\n optionsV1?: OverlayOptionsV1\n ): Promise<Overlay | (() => void)> {\n await import('@spectrum-web-components/overlay/sp-overlay.js');\n const v2 = arguments.length === 2;\n const overlayContent = content || triggerOrContent;\n // Use the `this` from the `static` method context rather than a\n // specific imported constructor to prevent opening a circular dependency.\n const overlay = new this() as Overlay;\n let restored = false;\n overlay.dispose = () => {\n overlay.addEventListener('sp-closed', () => {\n if (!restored) {\n restoreContent();\n restored = true;\n }\n requestAnimationFrame(() => {\n overlay.remove();\n });\n });\n overlay.open = false;\n overlay.dispose = noop;\n };\n /**\n * Since content must exist in an <sp-overlay>, we need a way to get it there.\n * The best & most-direct way is to declaratively use an <sp-overlay> element,\n * but for imperative users, we'll reparent content into an overlay that we've created for them.\n **/\n const restoreContent = reparentChildren([overlayContent], overlay, {\n position: 'beforeend',\n prepareCallback: (el) => {\n // Ensure that content to be overlaid is no longer targetted to a specific `slot`.\n // This allow for it to be visible in the overlaid context.\n const slot = el.slot;\n el.removeAttribute('slot');\n return () => {\n el.slot = slot;\n };\n },\n });\n\n const v1 = !v2 && overlayContent && optionsV1;\n if (v1) {\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n overlay,\n `You are interacting with an ${overlay.localName} element via a deprecated imperative API. This API will be removed in a future version of the SWC library. Consider leveraging an ${overlay.localName} directly.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/overlay/',\n { level: 'deprecation' }\n );\n }\n const trigger = triggerOrContent;\n const interaction = interactionOrOptions;\n const options = optionsV1;\n overlay.delayed =\n options.delayed || overlayContent.hasAttribute('delayed');\n overlay.receivesFocus = options.receivesFocus ?? 'auto';\n overlay.triggerElement = options.virtualTrigger || trigger;\n overlay.type =\n interaction === 'modal'\n ? 'modal'\n : interaction === 'hover'\n ? 'hint'\n : 'auto';\n overlay.offset = options.offset ?? 6;\n overlay.placement = options.placement;\n overlay.willPreventClose = !!options.notImmediatelyClosable;\n trigger.insertAdjacentElement('afterend', overlay);\n await overlay.updateComplete;\n overlay.open = true;\n return overlay.dispose;\n }\n\n const options = interactionOrOptions as OverlayOptions;\n overlay.append(overlayContent);\n overlay.delayed =\n options.delayed || overlayContent.hasAttribute('delayed');\n overlay.receivesFocus = options.receivesFocus ?? 'auto';\n overlay.triggerElement = options.trigger || null;\n overlay.type = options.type || 'modal';\n overlay.offset = options.offset ?? 6;\n overlay.placement = options.placement;\n overlay.willPreventClose = !!options.notImmediatelyClosable;\n overlay.updateComplete.then(() => {\n // Do we want to \"open\" this path, or leave that to the consumer?\n overlay.open = true;\n });\n return overlay;\n }\n}\n"],
5
- "mappings": ";AAWA,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AAajC,SAAS,oBAAoB;AAGtB,aAAM,eAAe,IAAI,aAAa;AAEtC,aAAM,OAAO,MAAY;AAC5B;AACJ;AAEO,aAAM,gCAAgC,MAAM;AAAA,EA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ACV,UACA,gBAAgB,UAChB,SACA;AACV,cAAQ,UAAS,KAAAA,SAAQ,WAAR,YAAkB;AACnC,cAAQ,YAAYA,SAAQ;AAC5B,cAAQ,mBAAmB,CAAC,CAACA,SAAQ;AACrC,cAAQ,sBAAsB,YAAY,OAAO;AACjD,YAAM,QAAQ;AACd,cAAQ,OAAO;AACf,aAAO,QAAQ;AAAA,IACnB;AAEA,UAAM,UAAU;AAChB,YAAQ,OAAO,cAAc;AAC7B,YAAQ,UACJ,QAAQ,WAAW,eAAe,aAAa,SAAS;AAC5D,YAAQ,iBAAgB,aAAQ,kBAAR,YAAyB;AACjD,YAAQ,iBAAiB,QAAQ,WAAW;AAC5C,YAAQ,OAAO,QAAQ,QAAQ;AAC/B,YAAQ,UAAS,aAAQ,WAAR,YAAkB;AACnC,YAAQ,YAAY,QAAQ;AAC5B,YAAQ,mBAAmB,CAAC,CAAC,QAAQ;AACrC,YAAQ,eAAe,KAAK,MAAM;AAE9B,cAAQ,OAAO;AAAA,IACnB,CAAC;AACD,WAAO;AAAA,EACX;AACJ;",
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 { SpectrumElement } from '@spectrum-web-components/base';\nimport { reparentChildren } from '@spectrum-web-components/shared/src/reparent-children.js';\n\nimport type {\n OpenableElement,\n OverlayOptions,\n OverlayOptionsV1,\n OverlayState,\n OverlayTypes,\n Placement,\n TriggerInteractionsV1,\n} from './overlay-types.dev.js'\nimport type { Overlay } from './Overlay.dev.js'\nimport type { VirtualTrigger } from './VirtualTrigger.dev.js'\nimport { OverlayTimer } from './overlay-timer.dev.js'\nimport { PlacementController } from './PlacementController.dev.js'\n\nexport const overlayTimer = new OverlayTimer();\n\nexport const noop = (): void => {\n return;\n};\n\nexport class BeforetoggleClosedEvent extends Event {\n currentState = 'open';\n newState = 'closed';\n constructor() {\n super('beforetoggle', {\n bubbles: false,\n composed: false,\n });\n }\n}\n\nexport class BeforetoggleOpenEvent extends Event {\n currentState = 'closed';\n newState = 'open';\n constructor() {\n super('beforetoggle', {\n bubbles: false,\n composed: false,\n });\n }\n}\n\n/**\n * Apply a \"transitionend\" listener to an element that may not transition but\n * guarantee the callback will be fired either way.\n *\n * @param el {HTMLElement} - Target of the \"transition\" listeners.\n * @param action {Function} - Method to trigger the \"transition\".\n * @param cb {Function} - Callback to trigger when the \"transition\" has ended.\n */\nexport const guaranteedAllTransitionend = (\n el: HTMLElement,\n action: () => void,\n cb: () => void\n): void => {\n const abortController = new AbortController();\n const runningTransitions = new Map<string, number>();\n const cleanup = (): void => {\n abortController.abort();\n cb();\n };\n let guarantee2: number;\n let guarantee3: number;\n // WebKit fires `transitionrun` a little earlier, the multiple guarantees here\n // allow WebKit to be caught, but doesn't remove the animation listener until\n // after it would have fired in Chromium.\n const guarantee1 = requestAnimationFrame(() => {\n guarantee2 = requestAnimationFrame(() => {\n guarantee3 = requestAnimationFrame(() => {\n cleanup();\n });\n });\n });\n const handleTransitionend = (event: TransitionEvent): void => {\n if (event.target !== el) {\n return;\n }\n runningTransitions.set(\n event.propertyName,\n (runningTransitions.get(event.propertyName) as number) - 1\n );\n if (!runningTransitions.get(event.propertyName)) {\n runningTransitions.delete(event.propertyName);\n }\n if (runningTransitions.size === 0) {\n cleanup();\n }\n };\n const handleTransitionrun = (event: TransitionEvent): void => {\n if (event.target !== el) {\n return;\n }\n if (!runningTransitions.has(event.propertyName)) {\n runningTransitions.set(event.propertyName, 0);\n }\n runningTransitions.set(\n event.propertyName,\n (runningTransitions.get(event.propertyName) as number) + 1\n );\n cancelAnimationFrame(guarantee1);\n cancelAnimationFrame(guarantee2);\n cancelAnimationFrame(guarantee3);\n };\n el.addEventListener('transitionrun', handleTransitionrun, {\n signal: abortController.signal,\n });\n el.addEventListener('transitionend', handleTransitionend, {\n signal: abortController.signal,\n });\n el.addEventListener('transitioncancel', handleTransitionend, {\n signal: abortController.signal,\n });\n action();\n};\n\nexport function nextFrame(): Promise<void> {\n return new Promise((res) => requestAnimationFrame(() => res()));\n}\n\nexport function forcePaint(): void {\n // force the browser to paint\n document.body.offsetHeight;\n}\n\n/**\n * Abstract Overlay base class so that property tyings and imperative API\n * interfaces can be held separate from the actual class definition.\n */\nexport class AbstractOverlay extends SpectrumElement {\n protected async applyFocus(\n _targetOpenState: boolean,\n _focusEl: HTMLElement | null\n ): Promise<void> {\n return;\n }\n get delayed(): boolean {\n return false;\n }\n set delayed(_delayed: boolean) {\n return;\n }\n dialogEl!: HTMLDialogElement & {\n showPopover(): void;\n hidePopover(): void;\n };\n dispose = noop;\n protected async ensureOnDOM(_targetOpenState: boolean): Promise<void> {\n return;\n }\n elements!: OpenableElement[];\n protected async makeTransition(\n _targetOpenState: boolean\n ): Promise<HTMLElement | null> {\n return null;\n }\n protected async manageDelay(_targetOpenState: boolean): Promise<void> {\n return;\n }\n protected async manageDialogOpen(): Promise<void> {\n return;\n }\n protected async managePopoverOpen(): Promise<void> {\n return;\n }\n protected managePosition(): void {\n return;\n }\n protected offset: number | [number, number] = 6;\n get open(): boolean {\n return false;\n }\n set open(_open: boolean) {\n return;\n }\n placement?: Placement;\n protected placementController!: PlacementController;\n receivesFocus!: 'true' | 'false' | 'auto';\n get state(): OverlayState {\n return 'closed';\n }\n set state(_state: OverlayState) {\n return;\n }\n protected _state!: OverlayState;\n triggerElement!: HTMLElement | VirtualTrigger | null;\n type!: OverlayTypes;\n willPreventClose = false;\n\n public manuallyKeepOpen(): void {\n return;\n }\n\n public static update(): void {\n const overlayUpdateEvent = new CustomEvent('sp-update-overlays', {\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n document.dispatchEvent(overlayUpdateEvent);\n }\n\n /**\n * Overloaded imperative API entry point that allows for both the pre-0.37.0\n * argument signature as well as the post-0.37.0 signature. This allows for\n * consumers to continue to leverage it as they had been in previous releases\n * while also surfacing the more feature-rich API that has been made available.\n */\n public static async open(\n trigger: HTMLElement,\n interaction: TriggerInteractionsV1,\n content: HTMLElement,\n optionsV1: OverlayOptionsV1\n ): Promise<() => void>;\n public static async open(\n content: HTMLElement,\n options?: OverlayOptions\n ): Promise<Overlay>;\n public static async open(\n triggerOrContent: HTMLElement,\n interactionOrOptions:\n | TriggerInteractionsV1\n | OverlayOptions\n | undefined,\n content?: HTMLElement,\n optionsV1?: OverlayOptionsV1\n ): Promise<Overlay | (() => void)> {\n await import('@spectrum-web-components/overlay/sp-overlay.js');\n const v2 = arguments.length === 2;\n const overlayContent = content || triggerOrContent;\n // Use the `this` from the `static` method context rather than a\n // specific imported constructor to prevent opening a circular dependency.\n const overlay = new this() as Overlay;\n let restored = false;\n overlay.dispose = () => {\n overlay.addEventListener('sp-closed', () => {\n if (!restored) {\n restoreContent();\n restored = true;\n }\n requestAnimationFrame(() => {\n overlay.remove();\n });\n });\n overlay.open = false;\n overlay.dispose = noop;\n };\n /**\n * Since content must exist in an <sp-overlay>, we need a way to get it there.\n * The best & most-direct way is to declaratively use an <sp-overlay> element,\n * but for imperative users, we'll reparent content into an overlay that we've created for them.\n **/\n const restoreContent = reparentChildren([overlayContent], overlay, {\n position: 'beforeend',\n prepareCallback: (el) => {\n // Ensure that content to be overlaid is no longer targetted to a specific `slot`.\n // This allow for it to be visible in the overlaid context.\n const slot = el.slot;\n el.removeAttribute('slot');\n return () => {\n el.slot = slot;\n };\n },\n });\n\n const v1 = !v2 && overlayContent && optionsV1;\n if (v1) {\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n overlay,\n `You are interacting with an ${overlay.localName} element via a deprecated imperative API. This API will be removed in a future version of the SWC library. Consider leveraging an ${overlay.localName} directly.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/overlay/',\n { level: 'deprecation' }\n );\n }\n const trigger = triggerOrContent;\n const interaction = interactionOrOptions;\n const options = optionsV1;\n overlay.delayed =\n options.delayed || overlayContent.hasAttribute('delayed');\n overlay.receivesFocus = options.receivesFocus ?? 'auto';\n overlay.triggerElement = options.virtualTrigger || trigger;\n overlay.type =\n interaction === 'modal'\n ? 'modal'\n : interaction === 'hover'\n ? 'hint'\n : 'auto';\n overlay.offset = options.offset ?? 6;\n overlay.placement = options.placement;\n overlay.willPreventClose = !!options.notImmediatelyClosable;\n trigger.insertAdjacentElement('afterend', overlay);\n await overlay.updateComplete;\n overlay.open = true;\n return overlay.dispose;\n }\n\n const options = interactionOrOptions as OverlayOptions;\n overlay.append(overlayContent);\n overlay.delayed =\n options.delayed || overlayContent.hasAttribute('delayed');\n overlay.receivesFocus = options.receivesFocus ?? 'auto';\n overlay.triggerElement = options.trigger || null;\n overlay.type = options.type || 'modal';\n overlay.offset = options.offset ?? 6;\n overlay.placement = options.placement;\n overlay.willPreventClose = !!options.notImmediatelyClosable;\n overlay.updateComplete.then(() => {\n // Do we want to \"open\" this path, or leave that to the consumer?\n overlay.open = true;\n });\n return overlay;\n }\n}\n"],
5
+ "mappings": ";AAWA,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AAajC,SAAS,oBAAoB;AAGtB,aAAM,eAAe,IAAI,aAAa;AAEtC,aAAM,OAAO,MAAY;AAC5B;AACJ;AAEO,aAAM,gCAAgC,MAAM;AAAA,EAG/C,cAAc;AACV,UAAM,gBAAgB;AAAA,MAClB,SAAS;AAAA,MACT,UAAU;AAAA,IACd,CAAC;AANL,wBAAe;AACf,oBAAW;AAAA,EAMX;AACJ;AAEO,aAAM,8BAA8B,MAAM;AAAA,EAG7C,cAAc;AACV,UAAM,gBAAgB;AAAA,MAClB,SAAS;AAAA,MACT,UAAU;AAAA,IACd,CAAC;AANL,wBAAe;AACf,oBAAW;AAAA,EAMX;AACJ;AAUO,aAAM,6BAA6B,CACtC,IACA,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AACf,aAAO,QAAQ;AAAA,IACnB;AAEA,UAAM,UAAU;AAChB,YAAQ,OAAO,cAAc;AAC7B,YAAQ,UACJ,QAAQ,WAAW,eAAe,aAAa,SAAS;AAC5D,YAAQ,iBAAgB,aAAQ,kBAAR,YAAyB;AACjD,YAAQ,iBAAiB,QAAQ,WAAW;AAC5C,YAAQ,OAAO,QAAQ,QAAQ;AAC/B,YAAQ,UAAS,aAAQ,WAAR,YAAkB;AACnC,YAAQ,YAAY,QAAQ;AAC5B,YAAQ,mBAAmB,CAAC,CAAC,QAAQ;AACrC,YAAQ,eAAe,KAAK,MAAM;AAE9B,cAAQ,OAAO;AAAA,IACnB,CAAC;AACD,WAAO;AAAA,EACX;AACJ;",
6
6
  "names": ["options"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";import{SpectrumElement as E}from"@spectrum-web-components/base";import{reparentChildren as T}from"@spectrum-web-components/shared/src/reparent-children.js";import{OverlayTimer as P}from"./overlay-timer.js";export const overlayTimer=new P,noop=()=>{};export class BeforetoggleClosedEvent extends Event{constructor(){super("beforetoggle",{bubbles:!1,composed:!1});this.currentState="open";this.newState="closed"}}export class BeforetoggleOpenEvent extends Event{constructor(){super("beforetoggle",{bubbles:!1,composed:!1});this.currentState="closed";this.newState="open"}}export const guaranteedAllTransitionend=(o,d,t)=>{const a=new AbortController,n=new Map,c=()=>{a.abort(),t()};let u,s;const e=requestAnimationFrame(()=>{u=requestAnimationFrame(()=>{s=requestAnimationFrame(()=>{c()})})}),m=r=>{r.target===o&&(n.set(r.propertyName,n.get(r.propertyName)-1),n.get(r.propertyName)||n.delete(r.propertyName),n.size===0&&c())},y=r=>{r.target===o&&(n.has(r.propertyName)||n.set(r.propertyName,0),n.set(r.propertyName,n.get(r.propertyName)+1),cancelAnimationFrame(e),cancelAnimationFrame(u),cancelAnimationFrame(s))};o.addEventListener("transitionrun",y,{signal:a.signal}),o.addEventListener("transitionend",m,{signal:a.signal}),o.addEventListener("transitioncancel",m,{signal:a.signal}),d()};export function nextFrame(){return new Promise(o=>requestAnimationFrame(()=>o()))}export function forcePaint(){document.body.offsetHeight}export class AbstractOverlay extends E{constructor(){super(...arguments);this.dispose=noop;this.offset=6;this.willPreventClose=!1}async applyFocus(t,a){}async ensureOnDOM(t){}async makeTransition(t){return null}async manageDelay(t){}async manageDialogOpen(){}async managePopoverOpen(){}managePosition(){}get open(){return!1}set open(t){}get state(){return"closed"}set state(t){}manuallyKeepOpen(){}static update(){const t=new CustomEvent("sp-update-overlays",{bubbles:!0,composed:!0,cancelable:!0});document.dispatchEvent(t)}static async open(t,a,n,c){var g,b,f,O;await import("@spectrum-web-components/overlay/sp-overlay.js");const u=arguments.length===2,s=n||t,e=new this;let m=!1;e.dispose=()=>{e.addEventListener("sp-closed",()=>{m||(y(),m=!0),requestAnimationFrame(()=>{e.remove()})}),e.open=!1,e.dispose=noop};const y=T([s],e,{position:"beforeend",prepareCallback:l=>{const v=l.slot;return l.removeAttribute("slot"),()=>{l.slot=v}}});if(!u&&s&&c){const l=t,v=a,p=c;return e.delayed=p.delayed||s.hasAttribute("delayed"),e.receivesFocus=(g=p.receivesFocus)!=null?g:"auto",e.triggerElement=p.virtualTrigger||l,e.type=v==="modal"?"modal":v==="hover"?"hint":"auto",e.offset=(b=p.offset)!=null?b:6,e.placement=p.placement,e.willPreventClose=!!p.notImmediatelyClosable,l.insertAdjacentElement("afterend",e),await e.updateComplete,e.open=!0,e.dispose}const i=a;return e.append(s),e.delayed=i.delayed||s.hasAttribute("delayed"),e.receivesFocus=(f=i.receivesFocus)!=null?f:"auto",e.triggerElement=i.trigger||null,e.type=i.type||"modal",e.offset=(O=i.offset)!=null?O:6,e.placement=i.placement,e.willPreventClose=!!i.notImmediatelyClosable,e.updateComplete.then(()=>{e.open=!0}),e}}
1
+ "use strict";import{SpectrumElement as E}from"@spectrum-web-components/base";import{reparentChildren as T}from"@spectrum-web-components/shared/src/reparent-children.js";import{OverlayTimer as P}from"./overlay-timer.js";export const overlayTimer=new P,noop=()=>{};export class BeforetoggleClosedEvent extends Event{constructor(){super("beforetoggle",{bubbles:!1,composed:!1});this.currentState="open";this.newState="closed"}}export class BeforetoggleOpenEvent extends Event{constructor(){super("beforetoggle",{bubbles:!1,composed:!1});this.currentState="closed";this.newState="open"}}export const guaranteedAllTransitionend=(o,d,t)=>{const a=new AbortController,n=new Map,c=()=>{a.abort(),t()};let u,s;const e=requestAnimationFrame(()=>{u=requestAnimationFrame(()=>{s=requestAnimationFrame(()=>{c()})})}),m=r=>{r.target===o&&(n.set(r.propertyName,n.get(r.propertyName)-1),n.get(r.propertyName)||n.delete(r.propertyName),n.size===0&&c())},y=r=>{r.target===o&&(n.has(r.propertyName)||n.set(r.propertyName,0),n.set(r.propertyName,n.get(r.propertyName)+1),cancelAnimationFrame(e),cancelAnimationFrame(u),cancelAnimationFrame(s))};o.addEventListener("transitionrun",y,{signal:a.signal}),o.addEventListener("transitionend",m,{signal:a.signal}),o.addEventListener("transitioncancel",m,{signal:a.signal}),d()};export function nextFrame(){return new Promise(o=>requestAnimationFrame(()=>o()))}export function forcePaint(){document.body.offsetHeight}export class AbstractOverlay extends E{constructor(){super(...arguments);this.dispose=noop;this.offset=6;this.willPreventClose=!1}async applyFocus(t,a){}get delayed(){return!1}set delayed(t){}async ensureOnDOM(t){}async makeTransition(t){return null}async manageDelay(t){}async manageDialogOpen(){}async managePopoverOpen(){}managePosition(){}get open(){return!1}set open(t){}get state(){return"closed"}set state(t){}manuallyKeepOpen(){}static update(){const t=new CustomEvent("sp-update-overlays",{bubbles:!0,composed:!0,cancelable:!0});document.dispatchEvent(t)}static async open(t,a,n,c){var g,b,f,O;await import("@spectrum-web-components/overlay/sp-overlay.js");const u=arguments.length===2,s=n||t,e=new this;let m=!1;e.dispose=()=>{e.addEventListener("sp-closed",()=>{m||(y(),m=!0),requestAnimationFrame(()=>{e.remove()})}),e.open=!1,e.dispose=noop};const y=T([s],e,{position:"beforeend",prepareCallback:i=>{const v=i.slot;return i.removeAttribute("slot"),()=>{i.slot=v}}});if(!u&&s&&c){const i=t,v=a,p=c;return e.delayed=p.delayed||s.hasAttribute("delayed"),e.receivesFocus=(g=p.receivesFocus)!=null?g:"auto",e.triggerElement=p.virtualTrigger||i,e.type=v==="modal"?"modal":v==="hover"?"hint":"auto",e.offset=(b=p.offset)!=null?b:6,e.placement=p.placement,e.willPreventClose=!!p.notImmediatelyClosable,i.insertAdjacentElement("afterend",e),await e.updateComplete,e.open=!0,e.dispose}const l=a;return e.append(s),e.delayed=l.delayed||s.hasAttribute("delayed"),e.receivesFocus=(f=l.receivesFocus)!=null?f:"auto",e.triggerElement=l.trigger||null,e.type=l.type||"modal",e.offset=(O=l.offset)!=null?O:6,e.placement=l.placement,e.willPreventClose=!!l.notImmediatelyClosable,e.updateComplete.then(()=>{e.open=!0}),e}}
2
2
  //# sourceMappingURL=AbstractOverlay.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["AbstractOverlay.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 { SpectrumElement } from '@spectrum-web-components/base';\nimport { reparentChildren } from '@spectrum-web-components/shared/src/reparent-children.js';\n\nimport type {\n OpenableElement,\n OverlayOptions,\n OverlayOptionsV1,\n OverlayState,\n OverlayTypes,\n Placement,\n TriggerInteractionsV1,\n} from './overlay-types.js';\nimport type { Overlay } from './Overlay.js';\nimport type { VirtualTrigger } from './VirtualTrigger.js';\nimport { OverlayTimer } from './overlay-timer.js';\nimport { PlacementController } from './PlacementController.js';\n\nexport const overlayTimer = new OverlayTimer();\n\nexport const noop = (): void => {\n return;\n};\n\nexport class BeforetoggleClosedEvent extends Event {\n currentState = 'open';\n newState = 'closed';\n constructor() {\n super('beforetoggle', {\n bubbles: false,\n composed: false,\n });\n }\n}\n\nexport class BeforetoggleOpenEvent extends Event {\n currentState = 'closed';\n newState = 'open';\n constructor() {\n super('beforetoggle', {\n bubbles: false,\n composed: false,\n });\n }\n}\n\n/**\n * Apply a \"transitionend\" listener to an element that may not transition but\n * guarantee the callback will be fired either way.\n *\n * @param el {HTMLElement} - Target of the \"transition\" listeners.\n * @param action {Function} - Method to trigger the \"transition\".\n * @param cb {Function} - Callback to trigger when the \"transition\" has ended.\n */\nexport const guaranteedAllTransitionend = (\n el: HTMLElement,\n action: () => void,\n cb: () => void\n): void => {\n const abortController = new AbortController();\n const runningTransitions = new Map<string, number>();\n const cleanup = (): void => {\n abortController.abort();\n cb();\n };\n let guarantee2: number;\n let guarantee3: number;\n // WebKit fires `transitionrun` a little earlier, the multiple guarantees here\n // allow WebKit to be caught, but doesn't remove the animation listener until\n // after it would have fired in Chromium.\n const guarantee1 = requestAnimationFrame(() => {\n guarantee2 = requestAnimationFrame(() => {\n guarantee3 = requestAnimationFrame(() => {\n cleanup();\n });\n });\n });\n const handleTransitionend = (event: TransitionEvent): void => {\n if (event.target !== el) {\n return;\n }\n runningTransitions.set(\n event.propertyName,\n (runningTransitions.get(event.propertyName) as number) - 1\n );\n if (!runningTransitions.get(event.propertyName)) {\n runningTransitions.delete(event.propertyName);\n }\n if (runningTransitions.size === 0) {\n cleanup();\n }\n };\n const handleTransitionrun = (event: TransitionEvent): void => {\n if (event.target !== el) {\n return;\n }\n if (!runningTransitions.has(event.propertyName)) {\n runningTransitions.set(event.propertyName, 0);\n }\n runningTransitions.set(\n event.propertyName,\n (runningTransitions.get(event.propertyName) as number) + 1\n );\n cancelAnimationFrame(guarantee1);\n cancelAnimationFrame(guarantee2);\n cancelAnimationFrame(guarantee3);\n };\n el.addEventListener('transitionrun', handleTransitionrun, {\n signal: abortController.signal,\n });\n el.addEventListener('transitionend', handleTransitionend, {\n signal: abortController.signal,\n });\n el.addEventListener('transitioncancel', handleTransitionend, {\n signal: abortController.signal,\n });\n action();\n};\n\nexport function nextFrame(): Promise<void> {\n return new Promise((res) => requestAnimationFrame(() => res()));\n}\n\nexport function forcePaint(): void {\n // force the browser to paint\n document.body.offsetHeight;\n}\n\n/**\n * Abstract Overlay base class so that property tyings and imperative API\n * interfaces can be held separate from the actual class definition.\n */\nexport class AbstractOverlay extends SpectrumElement {\n protected async applyFocus(\n _targetOpenState: boolean,\n _focusEl: HTMLElement | null\n ): Promise<void> {\n return;\n }\n delayed!: boolean;\n dialogEl!: HTMLDialogElement & {\n showPopover(): void;\n hidePopover(): void;\n };\n dispose = noop;\n protected async ensureOnDOM(_targetOpenState: boolean): Promise<void> {\n return;\n }\n elements!: OpenableElement[];\n protected async makeTransition(\n _targetOpenState: boolean\n ): Promise<HTMLElement | null> {\n return null;\n }\n protected async manageDelay(_targetOpenState: boolean): Promise<void> {\n return;\n }\n protected async manageDialogOpen(): Promise<void> {\n return;\n }\n protected async managePopoverOpen(): Promise<void> {\n return;\n }\n protected managePosition(): void {\n return;\n }\n protected offset: number | [number, number] = 6;\n get open(): boolean {\n return false;\n }\n set open(_open: boolean) {\n return;\n }\n placement?: Placement;\n protected placementController!: PlacementController;\n receivesFocus!: 'true' | 'false' | 'auto';\n get state(): OverlayState {\n return 'closed';\n }\n set state(_state: OverlayState) {\n return;\n }\n protected _state!: OverlayState;\n triggerElement!: HTMLElement | VirtualTrigger | null;\n type!: OverlayTypes;\n willPreventClose = false;\n\n public manuallyKeepOpen(): void {\n return;\n }\n\n public static update(): void {\n const overlayUpdateEvent = new CustomEvent('sp-update-overlays', {\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n document.dispatchEvent(overlayUpdateEvent);\n }\n\n /**\n * Overloaded imperative API entry point that allows for both the pre-0.37.0\n * argument signature as well as the post-0.37.0 signature. This allows for\n * consumers to continue to leverage it as they had been in previous releases\n * while also surfacing the more feature-rich API that has been made available.\n */\n public static async open(\n trigger: HTMLElement,\n interaction: TriggerInteractionsV1,\n content: HTMLElement,\n optionsV1: OverlayOptionsV1\n ): Promise<() => void>;\n public static async open(\n content: HTMLElement,\n options?: OverlayOptions\n ): Promise<Overlay>;\n public static async open(\n triggerOrContent: HTMLElement,\n interactionOrOptions:\n | TriggerInteractionsV1\n | OverlayOptions\n | undefined,\n content?: HTMLElement,\n optionsV1?: OverlayOptionsV1\n ): Promise<Overlay | (() => void)> {\n await import('@spectrum-web-components/overlay/sp-overlay.js');\n const v2 = arguments.length === 2;\n const overlayContent = content || triggerOrContent;\n // Use the `this` from the `static` method context rather than a\n // specific imported constructor to prevent opening a circular dependency.\n const overlay = new this() as Overlay;\n let restored = false;\n overlay.dispose = () => {\n overlay.addEventListener('sp-closed', () => {\n if (!restored) {\n restoreContent();\n restored = true;\n }\n requestAnimationFrame(() => {\n overlay.remove();\n });\n });\n overlay.open = false;\n overlay.dispose = noop;\n };\n /**\n * Since content must exist in an <sp-overlay>, we need a way to get it there.\n * The best & most-direct way is to declaratively use an <sp-overlay> element,\n * but for imperative users, we'll reparent content into an overlay that we've created for them.\n **/\n const restoreContent = reparentChildren([overlayContent], overlay, {\n position: 'beforeend',\n prepareCallback: (el) => {\n // Ensure that content to be overlaid is no longer targetted to a specific `slot`.\n // This allow for it to be visible in the overlaid context.\n const slot = el.slot;\n el.removeAttribute('slot');\n return () => {\n el.slot = slot;\n };\n },\n });\n\n const v1 = !v2 && overlayContent && optionsV1;\n if (v1) {\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n overlay,\n `You are interacting with an ${overlay.localName} element via a deprecated imperative API. This API will be removed in a future version of the SWC library. Consider leveraging an ${overlay.localName} directly.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/overlay/',\n { level: 'deprecation' }\n );\n }\n const trigger = triggerOrContent;\n const interaction = interactionOrOptions;\n const options = optionsV1;\n overlay.delayed =\n options.delayed || overlayContent.hasAttribute('delayed');\n overlay.receivesFocus = options.receivesFocus ?? 'auto';\n overlay.triggerElement = options.virtualTrigger || trigger;\n overlay.type =\n interaction === 'modal'\n ? 'modal'\n : interaction === 'hover'\n ? 'hint'\n : 'auto';\n overlay.offset = options.offset ?? 6;\n overlay.placement = options.placement;\n overlay.willPreventClose = !!options.notImmediatelyClosable;\n trigger.insertAdjacentElement('afterend', overlay);\n await overlay.updateComplete;\n overlay.open = true;\n return overlay.dispose;\n }\n\n const options = interactionOrOptions as OverlayOptions;\n overlay.append(overlayContent);\n overlay.delayed =\n options.delayed || overlayContent.hasAttribute('delayed');\n overlay.receivesFocus = options.receivesFocus ?? 'auto';\n overlay.triggerElement = options.trigger || null;\n overlay.type = options.type || 'modal';\n overlay.offset = options.offset ?? 6;\n overlay.placement = options.placement;\n overlay.willPreventClose = !!options.notImmediatelyClosable;\n overlay.updateComplete.then(() => {\n // Do we want to \"open\" this path, or leave that to the consumer?\n overlay.open = true;\n });\n return overlay;\n }\n}\n"],
5
- "mappings": "aAWA,OAAS,mBAAAA,MAAuB,gCAChC,OAAS,oBAAAC,MAAwB,2DAajC,OAAS,gBAAAC,MAAoB,qBAGtB,aAAM,aAAe,IAAIA,EAEnB,KAAO,IAAY,CAEhC,EAEO,aAAM,gCAAgC,KAAM,CAG/C,aAAc,CACV,MAAM,eAAgB,CAClB,QAAS,GACT,SAAU,EACd,CAAC,EANL,kBAAe,OACf,cAAW,QAMX,CACJ,CAEO,aAAM,8BAA8B,KAAM,CAG7C,aAAc,CACV,MAAM,eAAgB,CAClB,QAAS,GACT,SAAU,EACd,CAAC,EANL,kBAAe,SACf,cAAW,MAMX,CACJ,CAUO,aAAM,2BAA6B,CACtCC,EACAC,EACAC,IACO,CACP,MAAMC,EAAkB,IAAI,gBACtBC,EAAqB,IAAI,IACzBC,EAAU,IAAY,CACxBF,EAAgB,MAAM,EACtBD,EAAG,CACP,EACA,IAAII,EACAC,EAIJ,MAAMC,EAAa,sBAAsB,IAA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IAAgB,QACV,QACAA,IAAgB,QAChB,OACA,OACVL,EAAQ,QAASL,EAAAW,EAAQ,SAAR,KAAAX,EAAkB,EACnCK,EAAQ,UAAYM,EAAQ,UAC5BN,EAAQ,iBAAmB,CAAC,CAACM,EAAQ,uBACrCF,EAAQ,sBAAsB,WAAYJ,CAAO,EACjD,MAAMA,EAAQ,eACdA,EAAQ,KAAO,GACRA,EAAQ,OACnB,CAEA,MAAMM,EAAUf,EAChB,OAAAS,EAAQ,OAAOD,CAAc,EAC7BC,EAAQ,QACJM,EAAQ,SAAWP,EAAe,aAAa,SAAS,EAC5DC,EAAQ,eAAgBJ,EAAAU,EAAQ,gBAAR,KAAAV,EAAyB,OACjDI,EAAQ,eAAiBM,EAAQ,SAAW,KAC5CN,EAAQ,KAAOM,EAAQ,MAAQ,QAC/BN,EAAQ,QAASH,EAAAS,EAAQ,SAAR,KAAAT,EAAkB,EACnCG,EAAQ,UAAYM,EAAQ,UAC5BN,EAAQ,iBAAmB,CAAC,CAACM,EAAQ,uBACrCN,EAAQ,eAAe,KAAK,IAAM,CAE9BA,EAAQ,KAAO,EACnB,CAAC,EACMA,CACX,CACJ",
6
- "names": ["SpectrumElement", "reparentChildren", "OverlayTimer", "el", "action", "cb", "abortController", "runningTransitions", "cleanup", "guarantee2", "guarantee3", "guarantee1", "handleTransitionend", "event", "handleTransitionrun", "res", "_targetOpenState", "_focusEl", "_open", "_state", "overlayUpdateEvent", "triggerOrContent", "interactionOrOptions", "content", "optionsV1", "_a", "_b", "_c", "_d", "v2", "overlayContent", "overlay", "restored", "restoreContent", "slot", "trigger", "interaction", "options"]
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 { SpectrumElement } from '@spectrum-web-components/base';\nimport { reparentChildren } from '@spectrum-web-components/shared/src/reparent-children.js';\n\nimport type {\n OpenableElement,\n OverlayOptions,\n OverlayOptionsV1,\n OverlayState,\n OverlayTypes,\n Placement,\n TriggerInteractionsV1,\n} from './overlay-types.js';\nimport type { Overlay } from './Overlay.js';\nimport type { VirtualTrigger } from './VirtualTrigger.js';\nimport { OverlayTimer } from './overlay-timer.js';\nimport { PlacementController } from './PlacementController.js';\n\nexport const overlayTimer = new OverlayTimer();\n\nexport const noop = (): void => {\n return;\n};\n\nexport class BeforetoggleClosedEvent extends Event {\n currentState = 'open';\n newState = 'closed';\n constructor() {\n super('beforetoggle', {\n bubbles: false,\n composed: false,\n });\n }\n}\n\nexport class BeforetoggleOpenEvent extends Event {\n currentState = 'closed';\n newState = 'open';\n constructor() {\n super('beforetoggle', {\n bubbles: false,\n composed: false,\n });\n }\n}\n\n/**\n * Apply a \"transitionend\" listener to an element that may not transition but\n * guarantee the callback will be fired either way.\n *\n * @param el {HTMLElement} - Target of the \"transition\" listeners.\n * @param action {Function} - Method to trigger the \"transition\".\n * @param cb {Function} - Callback to trigger when the \"transition\" has ended.\n */\nexport const guaranteedAllTransitionend = (\n el: HTMLElement,\n action: () => void,\n cb: () => void\n): void => {\n const abortController = new AbortController();\n const runningTransitions = new Map<string, number>();\n const cleanup = (): void => {\n abortController.abort();\n cb();\n };\n let guarantee2: number;\n let guarantee3: number;\n // WebKit fires `transitionrun` a little earlier, the multiple guarantees here\n // allow WebKit to be caught, but doesn't remove the animation listener until\n // after it would have fired in Chromium.\n const guarantee1 = requestAnimationFrame(() => {\n guarantee2 = requestAnimationFrame(() => {\n guarantee3 = requestAnimationFrame(() => {\n cleanup();\n });\n });\n });\n const handleTransitionend = (event: TransitionEvent): void => {\n if (event.target !== el) {\n return;\n }\n runningTransitions.set(\n event.propertyName,\n (runningTransitions.get(event.propertyName) as number) - 1\n );\n if (!runningTransitions.get(event.propertyName)) {\n runningTransitions.delete(event.propertyName);\n }\n if (runningTransitions.size === 0) {\n cleanup();\n }\n };\n const handleTransitionrun = (event: TransitionEvent): void => {\n if (event.target !== el) {\n return;\n }\n if (!runningTransitions.has(event.propertyName)) {\n runningTransitions.set(event.propertyName, 0);\n }\n runningTransitions.set(\n event.propertyName,\n (runningTransitions.get(event.propertyName) as number) + 1\n );\n cancelAnimationFrame(guarantee1);\n cancelAnimationFrame(guarantee2);\n cancelAnimationFrame(guarantee3);\n };\n el.addEventListener('transitionrun', handleTransitionrun, {\n signal: abortController.signal,\n });\n el.addEventListener('transitionend', handleTransitionend, {\n signal: abortController.signal,\n });\n el.addEventListener('transitioncancel', handleTransitionend, {\n signal: abortController.signal,\n });\n action();\n};\n\nexport function nextFrame(): Promise<void> {\n return new Promise((res) => requestAnimationFrame(() => res()));\n}\n\nexport function forcePaint(): void {\n // force the browser to paint\n document.body.offsetHeight;\n}\n\n/**\n * Abstract Overlay base class so that property tyings and imperative API\n * interfaces can be held separate from the actual class definition.\n */\nexport class AbstractOverlay extends SpectrumElement {\n protected async applyFocus(\n _targetOpenState: boolean,\n _focusEl: HTMLElement | null\n ): Promise<void> {\n return;\n }\n get delayed(): boolean {\n return false;\n }\n set delayed(_delayed: boolean) {\n return;\n }\n dialogEl!: HTMLDialogElement & {\n showPopover(): void;\n hidePopover(): void;\n };\n dispose = noop;\n protected async ensureOnDOM(_targetOpenState: boolean): Promise<void> {\n return;\n }\n elements!: OpenableElement[];\n protected async makeTransition(\n _targetOpenState: boolean\n ): Promise<HTMLElement | null> {\n return null;\n }\n protected async manageDelay(_targetOpenState: boolean): Promise<void> {\n return;\n }\n protected async manageDialogOpen(): Promise<void> {\n return;\n }\n protected async managePopoverOpen(): Promise<void> {\n return;\n }\n protected managePosition(): void {\n return;\n }\n protected offset: number | [number, number] = 6;\n get open(): boolean {\n return false;\n }\n set open(_open: boolean) {\n return;\n }\n placement?: Placement;\n protected placementController!: PlacementController;\n receivesFocus!: 'true' | 'false' | 'auto';\n get state(): OverlayState {\n return 'closed';\n }\n set state(_state: OverlayState) {\n return;\n }\n protected _state!: OverlayState;\n triggerElement!: HTMLElement | VirtualTrigger | null;\n type!: OverlayTypes;\n willPreventClose = false;\n\n public manuallyKeepOpen(): void {\n return;\n }\n\n public static update(): void {\n const overlayUpdateEvent = new CustomEvent('sp-update-overlays', {\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n document.dispatchEvent(overlayUpdateEvent);\n }\n\n /**\n * Overloaded imperative API entry point that allows for both the pre-0.37.0\n * argument signature as well as the post-0.37.0 signature. This allows for\n * consumers to continue to leverage it as they had been in previous releases\n * while also surfacing the more feature-rich API that has been made available.\n */\n public static async open(\n trigger: HTMLElement,\n interaction: TriggerInteractionsV1,\n content: HTMLElement,\n optionsV1: OverlayOptionsV1\n ): Promise<() => void>;\n public static async open(\n content: HTMLElement,\n options?: OverlayOptions\n ): Promise<Overlay>;\n public static async open(\n triggerOrContent: HTMLElement,\n interactionOrOptions:\n | TriggerInteractionsV1\n | OverlayOptions\n | undefined,\n content?: HTMLElement,\n optionsV1?: OverlayOptionsV1\n ): Promise<Overlay | (() => void)> {\n await import('@spectrum-web-components/overlay/sp-overlay.js');\n const v2 = arguments.length === 2;\n const overlayContent = content || triggerOrContent;\n // Use the `this` from the `static` method context rather than a\n // specific imported constructor to prevent opening a circular dependency.\n const overlay = new this() as Overlay;\n let restored = false;\n overlay.dispose = () => {\n overlay.addEventListener('sp-closed', () => {\n if (!restored) {\n restoreContent();\n restored = true;\n }\n requestAnimationFrame(() => {\n overlay.remove();\n });\n });\n overlay.open = false;\n overlay.dispose = noop;\n };\n /**\n * Since content must exist in an <sp-overlay>, we need a way to get it there.\n * The best & most-direct way is to declaratively use an <sp-overlay> element,\n * but for imperative users, we'll reparent content into an overlay that we've created for them.\n **/\n const restoreContent = reparentChildren([overlayContent], overlay, {\n position: 'beforeend',\n prepareCallback: (el) => {\n // Ensure that content to be overlaid is no longer targetted to a specific `slot`.\n // This allow for it to be visible in the overlaid context.\n const slot = el.slot;\n el.removeAttribute('slot');\n return () => {\n el.slot = slot;\n };\n },\n });\n\n const v1 = !v2 && overlayContent && optionsV1;\n if (v1) {\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n overlay,\n `You are interacting with an ${overlay.localName} element via a deprecated imperative API. This API will be removed in a future version of the SWC library. Consider leveraging an ${overlay.localName} directly.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/overlay/',\n { level: 'deprecation' }\n );\n }\n const trigger = triggerOrContent;\n const interaction = interactionOrOptions;\n const options = optionsV1;\n overlay.delayed =\n options.delayed || overlayContent.hasAttribute('delayed');\n overlay.receivesFocus = options.receivesFocus ?? 'auto';\n overlay.triggerElement = options.virtualTrigger || trigger;\n overlay.type =\n interaction === 'modal'\n ? 'modal'\n : interaction === 'hover'\n ? 'hint'\n : 'auto';\n overlay.offset = options.offset ?? 6;\n overlay.placement = options.placement;\n overlay.willPreventClose = !!options.notImmediatelyClosable;\n trigger.insertAdjacentElement('afterend', overlay);\n await overlay.updateComplete;\n overlay.open = true;\n return overlay.dispose;\n }\n\n const options = interactionOrOptions as OverlayOptions;\n overlay.append(overlayContent);\n overlay.delayed =\n options.delayed || overlayContent.hasAttribute('delayed');\n overlay.receivesFocus = options.receivesFocus ?? 'auto';\n overlay.triggerElement = options.trigger || null;\n overlay.type = options.type || 'modal';\n overlay.offset = options.offset ?? 6;\n overlay.placement = options.placement;\n overlay.willPreventClose = !!options.notImmediatelyClosable;\n overlay.updateComplete.then(() => {\n // Do we want to \"open\" this path, or leave that to the consumer?\n overlay.open = true;\n });\n return overlay;\n }\n}\n"],
5
+ "mappings": "aAWA,OAAS,mBAAAA,MAAuB,gCAChC,OAAS,oBAAAC,MAAwB,2DAajC,OAAS,gBAAAC,MAAoB,qBAGtB,aAAM,aAAe,IAAIA,EAEnB,KAAO,IAAY,CAEhC,EAEO,aAAM,gCAAgC,KA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Element", "reparentChildren", "OverlayTimer", "el", "action", "cb", "abortController", "runningTransitions", "cleanup", "guarantee2", "guarantee3", "guarantee1", "handleTransitionend", "event", "handleTransitionrun", "res", "_targetOpenState", "_focusEl", "_delayed", "_open", "_state", "overlayUpdateEvent", "triggerOrContent", "interactionOrOptions", "content", "optionsV1", "_a", "_b", "_c", "_d", "v2", "overlayContent", "overlay", "restored", "restoreContent", "slot", "trigger", "interaction", "options"]
7
7
  }
package/src/Overlay.d.ts CHANGED
@@ -26,7 +26,9 @@ export declare class Overlay extends OverlayFeatures {
26
26
  * the next Overlay to be opened will be subject to the warm-up period if
27
27
  * provided that option.
28
28
  */
29
- delayed: boolean;
29
+ get delayed(): boolean;
30
+ set delayed(delayed: boolean);
31
+ private _delayed;
30
32
  dialogEl: HTMLDialogElement & {
31
33
  showPopover(): void;
32
34
  hidePopover(): void;
@@ -58,7 +58,7 @@ if (supportsPopover) {
58
58
  const _Overlay = class _Overlay extends OverlayFeatures {
59
59
  constructor() {
60
60
  super(...arguments);
61
- this.delayed = false;
61
+ this._delayed = false;
62
62
  this._disabled = false;
63
63
  this.longpressState = "null";
64
64
  this.offset = 6;
@@ -218,6 +218,13 @@ const _Overlay = class _Overlay extends OverlayFeatures {
218
218
  this.longpressState = this.longpressState === "potential" ? "opening" : "pressed";
219
219
  };
220
220
  }
221
+ get delayed() {
222
+ var _a;
223
+ return ((_a = this.elements.at(-1)) == null ? void 0 : _a.hasAttribute("delayed")) || this._delayed;
224
+ }
225
+ set delayed(delayed) {
226
+ this._delayed = delayed;
227
+ }
221
228
  get disabled() {
222
229
  return this._disabled;
223
230
  }
@@ -529,7 +536,14 @@ const _Overlay = class _Overlay extends OverlayFeatures {
529
536
  const messageType = isIOS() || isAndroid() ? "touch" : "keyboard";
530
537
  longpressDescription.textContent = LONGPRESS_INSTRUCTIONS[messageType];
531
538
  longpressDescription.slot = "longpress-describedby-descriptor";
532
- trigger.insertAdjacentElement("afterend", longpressDescription);
539
+ const triggerParent = trigger.getRootNode();
540
+ const overlayParent = this.getRootNode();
541
+ if (triggerParent === overlayParent) {
542
+ this.append(longpressDescription);
543
+ } else {
544
+ longpressDescription.hidden = !("host" in triggerParent);
545
+ trigger.insertAdjacentElement("afterend", longpressDescription);
546
+ }
533
547
  const releaseLongpressDescribedby = conditionAttributeWithId(
534
548
  trigger,
535
549
  "aria-describedby",
@@ -745,7 +759,7 @@ _Overlay.styles = [styles];
745
759
  _Overlay.openCount = 1;
746
760
  __decorateClass([
747
761
  property({ type: Boolean })
748
- ], _Overlay.prototype, "delayed", 2);
762
+ ], _Overlay.prototype, "delayed", 1);
749
763
  __decorateClass([
750
764
  query(".dialog")
751
765
  ], _Overlay.prototype, "dialogEl", 2);
@@ -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 isAndroid,\n isIOS,\n} from '@spectrum-web-components/shared/src/platform.js';\nimport {\n ElementResolutionController,\n elementResolverUpdatedSymbol,\n} from '@spectrum-web-components/reactive-controllers/src/ElementResolution.js';\nimport { conditionAttributeWithId } from '@spectrum-web-components/base/src/condition-attribute-with-id.js';\nimport {\n ifDefined,\n StyleInfo,\n styleMap,\n} from '@spectrum-web-components/base/src/directives.js';\n\nimport type {\n OpenableElement,\n OverlayState,\n OverlayTypes,\n Placement,\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 { noop } from './AbstractOverlay.dev.js'\nimport { VirtualTrigger } from './VirtualTrigger.dev.js'\nimport { PlacementController } from './PlacementController.dev.js'\n\nimport styles from './overlay.css.js';\n\nconst LONGPRESS_DURATION = 300;\nconst HOVER_DELAY = 300;\n\ntype LongpressEvent = {\n source: 'pointer' | 'keyboard';\n};\n\nexport const LONGPRESS_INSTRUCTIONS = {\n touch: 'Double tap and long press for additional options',\n keyboard: 'Press Space or Alt+Down Arrow for additional options',\n mouse: 'Click and hold for additional options',\n};\n\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 */\nexport class Overlay extends OverlayFeatures {\n static override styles = [styles];\n\n abortController!: AbortController;\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 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 get disabled(): boolean {\n return this._disabled;\n }\n\n set disabled(disabled: boolean) {\n this._disabled = disabled;\n if (disabled) {\n if (this.hasNonVirtualTrigger) {\n this.unbindEvents();\n }\n this.wasOpen = this.open;\n this.open = false;\n } else {\n this.bindEvents();\n this.open = this.open || this.wasOpen;\n this.wasOpen = false;\n }\n }\n\n private _disabled = false;\n\n @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 protected longpressState: 'null' | 'potential' | 'opening' | 'pressed' =\n 'null';\n\n private longressTimeout!: ReturnType<typeof setTimeout>;\n private hoverTimeout?: ReturnType<typeof setTimeout>;\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] = 6;\n\n protected override placementController = new PlacementController(this);\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 (\n (this.longpressState === 'opening' ||\n this.longpressState === 'pressed') &&\n !open\n )\n return;\n this._open = open;\n if (this.open) {\n Overlay.openCount += 1;\n }\n this.requestUpdate('open', !this.open);\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 * 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 private releaseAriaDescribedby = noop;\n private releaseLongpressDescribedby = noop;\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 // When triggered by the pointer, the last of `opened`\n // or `pointerup` should move the `longpressState` to\n // `null` so that the earlier event can void the \"light\n // dismiss\" and keep the Overlay open.\n this.longpressState =\n this.longpressState === 'pressed'\n ? 'null'\n : this.longpressState;\n }\n this.requestUpdate('state', oldState);\n }\n\n override _state: OverlayState = 'closed';\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?: 'click' | 'longpress' | 'hover';\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 private elementResolver = new ElementResolutionController(this);\n\n private get usesDialog(): boolean {\n return this.type === 'modal' || this.type === 'page';\n }\n\n private get popoverValue(): 'auto' | 'manual' | undefined {\n 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 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 if (!this.open && this.type !== 'hint') {\n // If the focus remains inside of the overlay or\n // a slotted descendent of the overlay you need to return\n // focus back to the trigger.\n const getAncestors = (): HTMLElement[] => {\n const ancestors: HTMLElement[] = [];\n // eslint-disable-next-line @spectrum-web-components/document-active-element\n let currentNode = document.activeElement;\n while (\n currentNode?.shadowRoot &&\n currentNode.shadowRoot.activeElement\n ) {\n currentNode = currentNode.shadowRoot.activeElement;\n }\n while (currentNode) {\n const ancestor =\n currentNode.assignedSlot ||\n currentNode.parentElement ||\n (currentNode.getRootNode() as ShadowRoot)?.host;\n if (ancestor) {\n ancestors.push(ancestor as HTMLElement);\n }\n currentNode = ancestor;\n }\n return ancestors;\n };\n if (\n (this.triggerElement as HTMLElement)?.focus &&\n (this.contains(\n (this.getRootNode() as Document).activeElement\n ) ||\n getAncestors().includes(this))\n ) {\n (this.triggerElement as HTMLElement).focus();\n }\n }\n }\n\n protected unbindEvents(): void {\n this.abortController?.abort();\n }\n\n protected bindEvents(): void {\n if (!this.hasNonVirtualTrigger) return;\n this.abortController = new AbortController();\n const nextTriggerElement = this.triggerElement as HTMLElement;\n switch (this.triggerInteraction) {\n case 'click':\n this.bindClickEvents(nextTriggerElement);\n return;\n case 'longpress':\n this.bindLongpressEvents(nextTriggerElement);\n return;\n case 'hover':\n this.bindHoverEvents(nextTriggerElement);\n return;\n }\n }\n\n protected bindClickEvents(triggerElement: HTMLElement): void {\n const options = { signal: this.abortController.signal };\n triggerElement.addEventListener('click', this.handleClick, options);\n triggerElement.addEventListener(\n 'pointerdown',\n this.handlePointerdownForClick,\n options\n );\n }\n\n protected bindLongpressEvents(triggerElement: HTMLElement): void {\n const options = { signal: this.abortController.signal };\n triggerElement.addEventListener(\n 'longpress',\n this.handleLongpress,\n options\n );\n triggerElement.addEventListener(\n 'pointerdown',\n this.handlePointerdown,\n options\n );\n this.prepareLongpressDescription(triggerElement);\n if (\n (triggerElement as HTMLElement & { holdAffordance: boolean })\n .holdAffordance\n ) {\n // Only bind keyboard events when the trigger element isn't doing it for us.\n return;\n }\n triggerElement.addEventListener('keydown', this.handleKeydown, options);\n triggerElement.addEventListener('keyup', this.handleKeyup, options);\n }\n\n protected bindHoverEvents(triggerElement: HTMLElement): void {\n const options = { signal: this.abortController.signal };\n triggerElement.addEventListener('focusin', this.handleFocusin, options);\n triggerElement.addEventListener(\n 'focusout',\n this.handleFocusout,\n options\n );\n triggerElement.addEventListener(\n 'pointerenter',\n this.handlePointerenter,\n options\n );\n triggerElement.addEventListener(\n 'pointerleave',\n this.handlePointerleave,\n options\n );\n this.addEventListener(\n 'pointerenter',\n this.handleOverlayPointerenter,\n options\n );\n this.addEventListener(\n 'pointerleave',\n this.handleOverlayPointerleave,\n options\n );\n }\n\n protected manageTriggerElement(triggerElement: HTMLElement | null): void {\n if (triggerElement) {\n this.unbindEvents();\n this.releaseAriaDescribedby();\n }\n const missingOrVirtual =\n !this.triggerElement ||\n this.triggerElement instanceof VirtualTrigger;\n if (missingOrVirtual) {\n return;\n }\n this.bindEvents();\n if (this.receivesFocus === 'true') return;\n\n this.prepareAriaDescribedby();\n }\n\n private elementIds: string[] = [];\n\n private prepareLongpressDescription(trigger: HTMLElement): void {\n if (\n // only \"longpress\" relationships are described this way\n this.triggerInteraction !== 'longpress' ||\n // do not reapply until target it recycled\n this.releaseLongpressDescribedby !== noop ||\n // require \"longpress content\" to apply relationship\n !this.elements.length\n ) {\n return;\n }\n\n const longpressDescription = document.createElement('div');\n longpressDescription.id = `longpress-describedby-descriptor-${crypto\n .randomUUID()\n .slice(0, 8)}`;\n const messageType = isIOS() || isAndroid() ? 'touch' : 'keyboard';\n longpressDescription.textContent = LONGPRESS_INSTRUCTIONS[messageType];\n longpressDescription.slot = 'longpress-describedby-descriptor';\n trigger.insertAdjacentElement('afterend', longpressDescription);\n\n const releaseLongpressDescribedby = conditionAttributeWithId(\n trigger,\n 'aria-describedby',\n [longpressDescription.id]\n );\n this.releaseLongpressDescribedby = () => {\n releaseLongpressDescribedby();\n longpressDescription.remove();\n this.releaseLongpressDescribedby = noop;\n };\n }\n\n private prepareAriaDescribedby(): void {\n if (\n // only \"hover\" relationships establed described by content\n this.triggerInteraction !== 'hover' ||\n // do not reapply until target is recycled\n this.releaseAriaDescribedby !== noop ||\n // require \"hover content\" to apply relationship\n !this.elements.length ||\n // Virtual triggers can have no aria content\n !this.hasNonVirtualTrigger\n ) {\n return;\n }\n\n const trigger = this.triggerElement as HTMLElement;\n const triggerRoot = trigger.getRootNode();\n const contentRoot = this.elements[0].getRootNode();\n const overlayRoot = this.getRootNode();\n if (triggerRoot == overlayRoot) {\n const releaseAriaDescribedby = conditionAttributeWithId(\n trigger,\n 'aria-describedby',\n [this.id]\n );\n this.releaseAriaDescribedby = () => {\n releaseAriaDescribedby();\n this.releaseAriaDescribedby = noop;\n };\n } else if (triggerRoot === contentRoot) {\n this.elementIds = this.elements.map((el) => el.id);\n const appliedIds = this.elements.map((el) => {\n if (!el.id) {\n el.id = `${this.tagName.toLowerCase()}-helper-${crypto\n .randomUUID()\n .slice(0, 8)}`;\n }\n return el.id;\n });\n const releaseAriaDescribedby = conditionAttributeWithId(\n trigger,\n 'aria-describedby',\n appliedIds\n );\n this.releaseAriaDescribedby = () => {\n releaseAriaDescribedby();\n this.elements.map((el, index) => {\n el.id = this.elementIds[index];\n });\n this.releaseAriaDescribedby = noop;\n };\n }\n }\n\n private handlePointerdown = (event: PointerEvent): void => {\n if (!this.triggerElement) return;\n if (event.button !== 0) return;\n const triggerElement = this.triggerElement as HTMLElement;\n this.longpressState = 'potential';\n document.addEventListener('pointerup', this.handlePointerup);\n document.addEventListener('pointercancel', this.handlePointerup);\n if (\n (triggerElement as HTMLElement & { holdAffordance: boolean })\n .holdAffordance\n ) {\n // Only dispatch longpress event if the trigger element isn't doing it for us.\n return;\n }\n this.longressTimeout = setTimeout(() => {\n if (!triggerElement) return;\n triggerElement.dispatchEvent(\n new CustomEvent<LongpressEvent>('longpress', {\n bubbles: true,\n composed: true,\n detail: {\n source: 'pointer',\n },\n })\n );\n }, LONGPRESS_DURATION);\n };\n\n private handlePointerup = (): void => {\n clearTimeout(this.longressTimeout);\n if (!this.triggerElement) return;\n // When triggered by the pointer, the last of `opened`\n // or `pointerup` should move the `longpressState` to\n // `null` so that the earlier event can void the \"light\n // dismiss\" and keep the Overlay open.\n this.longpressState = this.state === 'opening' ? 'pressed' : 'null';\n document.removeEventListener('pointerup', this.handlePointerup);\n document.removeEventListener('pointercancel', this.handlePointerup);\n };\n\n /**\n * @private\n */\n protected handleKeydown = (event: KeyboardEvent): void => {\n const { code, altKey } = event;\n if (code === 'Space' || (altKey && code === 'ArrowDown')) {\n if (code === 'ArrowDown') {\n event.stopPropagation();\n event.stopImmediatePropagation();\n }\n }\n };\n\n protected handleKeyup = (event: KeyboardEvent): void => {\n const { code, altKey } = event;\n if (code === 'Space' || (altKey && code === 'ArrowDown')) {\n if (!this.triggerElement || !this.hasNonVirtualTrigger) {\n return;\n }\n event.stopPropagation();\n (this.triggerElement as HTMLElement).dispatchEvent(\n new CustomEvent<LongpressEvent>('longpress', {\n bubbles: true,\n composed: true,\n detail: {\n source: 'keyboard',\n },\n })\n );\n setTimeout(() => {\n this.longpressState = 'null';\n });\n }\n };\n\n /**\n * An overlay with a `click` interaction should not close on click `triggerElement`.\n * When a click is initiated (`pointerdown`), apply `preventNextToggle` when the\n * overlay is `open` to prevent from toggling the overlay when the click event\n * propagates later in the interaction.\n */\n private preventNextToggle = false;\n\n protected handlePointerdownForClick = (): void => {\n this.preventNextToggle = this.open;\n };\n\n protected handleClick = (): void => {\n if (\n this.longpressState === 'opening' ||\n this.longpressState === 'pressed'\n ) {\n return;\n }\n if (!this.preventNextToggle) {\n this.open = !this.open;\n }\n this.preventNextToggle = false;\n };\n\n private focusedin = false;\n\n protected handleFocusin = (): void => {\n this.open = true;\n this.focusedin = true;\n };\n\n protected handleFocusout = (): void => {\n this.focusedin = false;\n if (this.pointerentered) return;\n this.open = false;\n };\n\n private pointerentered = false;\n\n protected handlePointerenter = (): void => {\n if (this.hoverTimeout) {\n clearTimeout(this.hoverTimeout);\n delete this.hoverTimeout;\n }\n if (this.disabled) return;\n this.open = true;\n this.pointerentered = true;\n };\n\n // set a timeout once the pointer enters and the overlay is shown\n // give the user time to enter the overlay\n\n protected handleOverlayPointerenter = (): void => {\n if (this.hoverTimeout) {\n clearTimeout(this.hoverTimeout);\n delete this.hoverTimeout;\n }\n };\n\n protected handlePointerleave = (): void => {\n this.doPointerleave();\n };\n\n protected handleOverlayPointerleave = (): void => {\n this.doPointerleave();\n };\n\n protected doPointerleave(): void {\n this.pointerentered = false;\n const triggerElement = this.triggerElement as HTMLElement;\n if (this.focusedin && triggerElement.matches(':focus-visible')) return;\n\n this.hoverTimeout = setTimeout(() => {\n this.open = false;\n }, HOVER_DELAY);\n }\n\n protected handleLongpress = (): void => {\n this.open = true;\n this.longpressState =\n this.longpressState === 'potential' ? 'opening' : 'pressed';\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 (\n this.longpressState !== 'opening' &&\n this.longpressState !== 'pressed'\n ) {\n this.open = false;\n return;\n }\n this.manuallyKeepOpen();\n }\n\n public override manuallyKeepOpen(): void {\n super.manuallyKeepOpen();\n this.open = true;\n this.placementController.allowPlacementUpdate = true;\n this.manageOpen(false);\n }\n\n protected handleSlotchange(): void {\n if (this.triggerElement) {\n this.prepareAriaDescribedby();\n }\n if (!this.elements.length) {\n this.releaseLongpressDescribedby();\n } else if (this.hasNonVirtualTrigger) {\n this.prepareLongpressDescription(\n this.triggerElement as HTMLElement\n );\n }\n }\n\n public shouldPreventClose(): boolean {\n const shouldPreventClose = this.willPreventClose;\n this.willPreventClose = false;\n return shouldPreventClose;\n }\n\n override willUpdate(changes: PropertyValues): void {\n if (!this.hasAttribute('id')) {\n this.setAttribute(\n 'id',\n `${this.tagName.toLowerCase()}-${crypto\n .randomUUID()\n .slice(0, 8)}`\n );\n }\n if (\n changes.has('open') &&\n (typeof changes.get('open') !== 'undefined' || this.open)\n ) {\n this.manageOpen(changes.get('open'));\n }\n if (changes.has('trigger')) {\n const [id, interaction] = this.trigger?.split('@') || [];\n this.elementResolver.selector = id ? `#${id}` : '';\n this.triggerInteraction = interaction as\n | 'click'\n | 'longpress'\n | 'hover'\n | undefined;\n }\n const oldTrigger = this.triggerElement as HTMLElement;\n if (changes.has(elementResolverUpdatedSymbol)) {\n this.triggerElement = this.elementResolver.element;\n this.manageTriggerElement(oldTrigger);\n }\n if (changes.has('triggerElement')) {\n this.manageTriggerElement(changes.get('triggerElement'));\n }\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (changes.has('placement')) {\n if (this.placement) {\n this.dialogEl.setAttribute('actual-placement', this.placement);\n } else {\n this.dialogEl.removeAttribute('actual-placement');\n }\n if (this.open && typeof changes.get('placement') !== 'undefined') {\n this.placementController.resetOverlayPosition();\n }\n }\n }\n\n protected renderContent(): TemplateResult {\n return html`\n <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.hasNonVirtualTrigger) {\n this.bindEvents();\n }\n }\n\n override disconnectedCallback(): void {\n if (this.hasNonVirtualTrigger) {\n this.unbindEvents();\n }\n this.releaseAriaDescribedby();\n this.releaseLongpressDescribedby();\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,EACA;AAAA,OACG;AACP,SAAS,gCAAgC;AACzC;AAAA,EACI;AAAA,EAEA;AAAA,OACG;AAQP,SAAS,iBAAiB,iBAAiB;AAC3C,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAC7B,SAAS,YAAY;AACrB,SAAS,sBAAsB;AAC/B,SAAS,2BAA2B;AAEpC,OAAO,YAAY;AAEnB,MAAM,qBAAqB;AAC3B,MAAM,cAAc;AAMb,aAAM,yBAAyB;AAAA,EAClC,OAAO;AAAA,EACP,UAAU;AAAA,EACV,OAAO;AACX;AAEA,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;AAQO,MAAM,WAAN,MAAM,iBAAgB,gBAAgB;AAAA,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;AAAA,EACd,CAAC;AAAA,GAlDQ,SAmDA;AAyBA;AAAA,EADR,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GA3EjB,SA4EA;AAQI;AAAA,EADZ,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAnFjC,SAoFI;AAkCJ;AAAA,EADR,SAAS;AAAA,GArHD,SAsHA;AASA;AAAA,EADR,SAAS,EAAE,WAAW,iBAAiB,CAAC;AAAA,GA9HhC,SA+HA;AAMT;AAAA,EADC,MAAM,MAAM;AAAA,GApIJ,SAqIT;AAGa;AAAA,EADZ,MAAM;AAAA,GAvIE,SAwII;AAwBb;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,WAAW,cAAc,CAAC;AAAA,GA/J3C,SAgKT;AASA;AAAA,EADC,SAAS;AAAA,GAxKD,SAyKT;AAMS;AAAA,EADR,SAAS,EAAE,WAAW,MAAM,CAAC;AAAA,GA9KrB,SA+KA;AAMT;AAAA,EADC,SAAS,EAAE,WAAW,MAAM,CAAC;AAAA,GApLrB,SAqLT;AAOS;AAAA,EADR,SAAS;AAAA,GA3LD,SA4LA;AA5LN,WAAM,UAAN;",
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 isAndroid,\n isIOS,\n} from '@spectrum-web-components/shared/src/platform.js';\nimport {\n ElementResolutionController,\n elementResolverUpdatedSymbol,\n} from '@spectrum-web-components/reactive-controllers/src/ElementResolution.js';\nimport { conditionAttributeWithId } from '@spectrum-web-components/base/src/condition-attribute-with-id.js';\nimport {\n ifDefined,\n StyleInfo,\n styleMap,\n} from '@spectrum-web-components/base/src/directives.js';\n\nimport type {\n OpenableElement,\n OverlayState,\n OverlayTypes,\n Placement,\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 { noop } from './AbstractOverlay.dev.js'\nimport { VirtualTrigger } from './VirtualTrigger.dev.js'\nimport { PlacementController } from './PlacementController.dev.js'\n\nimport styles from './overlay.css.js';\n\nconst LONGPRESS_DURATION = 300;\nconst HOVER_DELAY = 300;\n\ntype LongpressEvent = {\n source: 'pointer' | 'keyboard';\n};\n\nexport const LONGPRESS_INSTRUCTIONS = {\n touch: 'Double tap and long press for additional options',\n keyboard: 'Press Space or Alt+Down Arrow for additional options',\n mouse: 'Click and hold for additional options',\n};\n\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 */\nexport class Overlay extends OverlayFeatures {\n static override styles = [styles];\n\n abortController!: AbortController;\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 get disabled(): boolean {\n return this._disabled;\n }\n\n set disabled(disabled: boolean) {\n this._disabled = disabled;\n if (disabled) {\n if (this.hasNonVirtualTrigger) {\n this.unbindEvents();\n }\n this.wasOpen = this.open;\n this.open = false;\n } else {\n this.bindEvents();\n this.open = this.open || this.wasOpen;\n this.wasOpen = false;\n }\n }\n\n private _disabled = false;\n\n @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 protected longpressState: 'null' | 'potential' | 'opening' | 'pressed' =\n 'null';\n\n private longressTimeout!: ReturnType<typeof setTimeout>;\n private hoverTimeout?: ReturnType<typeof setTimeout>;\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] = 6;\n\n protected override placementController = new PlacementController(this);\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 (\n (this.longpressState === 'opening' ||\n this.longpressState === 'pressed') &&\n !open\n )\n return;\n this._open = open;\n if (this.open) {\n Overlay.openCount += 1;\n }\n this.requestUpdate('open', !this.open);\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 * 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 private releaseAriaDescribedby = noop;\n private releaseLongpressDescribedby = noop;\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 // When triggered by the pointer, the last of `opened`\n // or `pointerup` should move the `longpressState` to\n // `null` so that the earlier event can void the \"light\n // dismiss\" and keep the Overlay open.\n this.longpressState =\n this.longpressState === 'pressed'\n ? 'null'\n : this.longpressState;\n }\n this.requestUpdate('state', oldState);\n }\n\n override _state: OverlayState = 'closed';\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?: 'click' | 'longpress' | 'hover';\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 private elementResolver = new ElementResolutionController(this);\n\n private get usesDialog(): boolean {\n return this.type === 'modal' || this.type === 'page';\n }\n\n private get popoverValue(): 'auto' | 'manual' | undefined {\n 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 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 if (!this.open && this.type !== 'hint') {\n // If the focus remains inside of the overlay or\n // a slotted descendent of the overlay you need to return\n // focus back to the trigger.\n const getAncestors = (): HTMLElement[] => {\n const ancestors: HTMLElement[] = [];\n // eslint-disable-next-line @spectrum-web-components/document-active-element\n let currentNode = document.activeElement;\n while (\n currentNode?.shadowRoot &&\n currentNode.shadowRoot.activeElement\n ) {\n currentNode = currentNode.shadowRoot.activeElement;\n }\n while (currentNode) {\n const ancestor =\n currentNode.assignedSlot ||\n currentNode.parentElement ||\n (currentNode.getRootNode() as ShadowRoot)?.host;\n if (ancestor) {\n ancestors.push(ancestor as HTMLElement);\n }\n currentNode = ancestor;\n }\n return ancestors;\n };\n if (\n (this.triggerElement as HTMLElement)?.focus &&\n (this.contains(\n (this.getRootNode() as Document).activeElement\n ) ||\n getAncestors().includes(this))\n ) {\n (this.triggerElement as HTMLElement).focus();\n }\n }\n }\n\n protected unbindEvents(): void {\n this.abortController?.abort();\n }\n\n protected bindEvents(): void {\n if (!this.hasNonVirtualTrigger) return;\n this.abortController = new AbortController();\n const nextTriggerElement = this.triggerElement as HTMLElement;\n switch (this.triggerInteraction) {\n case 'click':\n this.bindClickEvents(nextTriggerElement);\n return;\n case 'longpress':\n this.bindLongpressEvents(nextTriggerElement);\n return;\n case 'hover':\n this.bindHoverEvents(nextTriggerElement);\n return;\n }\n }\n\n protected bindClickEvents(triggerElement: HTMLElement): void {\n const options = { signal: this.abortController.signal };\n triggerElement.addEventListener('click', this.handleClick, options);\n triggerElement.addEventListener(\n 'pointerdown',\n this.handlePointerdownForClick,\n options\n );\n }\n\n protected bindLongpressEvents(triggerElement: HTMLElement): void {\n const options = { signal: this.abortController.signal };\n triggerElement.addEventListener(\n 'longpress',\n this.handleLongpress,\n options\n );\n triggerElement.addEventListener(\n 'pointerdown',\n this.handlePointerdown,\n options\n );\n this.prepareLongpressDescription(triggerElement);\n if (\n (triggerElement as HTMLElement & { holdAffordance: boolean })\n .holdAffordance\n ) {\n // Only bind keyboard events when the trigger element isn't doing it for us.\n return;\n }\n triggerElement.addEventListener('keydown', this.handleKeydown, options);\n triggerElement.addEventListener('keyup', this.handleKeyup, options);\n }\n\n protected bindHoverEvents(triggerElement: HTMLElement): void {\n const options = { signal: this.abortController.signal };\n triggerElement.addEventListener('focusin', this.handleFocusin, options);\n triggerElement.addEventListener(\n 'focusout',\n this.handleFocusout,\n options\n );\n triggerElement.addEventListener(\n 'pointerenter',\n this.handlePointerenter,\n options\n );\n triggerElement.addEventListener(\n 'pointerleave',\n this.handlePointerleave,\n options\n );\n this.addEventListener(\n 'pointerenter',\n this.handleOverlayPointerenter,\n options\n );\n this.addEventListener(\n 'pointerleave',\n this.handleOverlayPointerleave,\n options\n );\n }\n\n protected manageTriggerElement(triggerElement: HTMLElement | null): void {\n if (triggerElement) {\n this.unbindEvents();\n this.releaseAriaDescribedby();\n }\n const missingOrVirtual =\n !this.triggerElement ||\n this.triggerElement instanceof VirtualTrigger;\n if (missingOrVirtual) {\n return;\n }\n this.bindEvents();\n if (this.receivesFocus === 'true') return;\n\n this.prepareAriaDescribedby();\n }\n\n private elementIds: string[] = [];\n\n private prepareLongpressDescription(trigger: HTMLElement): void {\n if (\n // only \"longpress\" relationships are described this way\n this.triggerInteraction !== 'longpress' ||\n // do not reapply until target it recycled\n this.releaseLongpressDescribedby !== noop ||\n // require \"longpress content\" to apply relationship\n !this.elements.length\n ) {\n return;\n }\n\n const longpressDescription = document.createElement('div');\n longpressDescription.id = `longpress-describedby-descriptor-${crypto\n .randomUUID()\n .slice(0, 8)}`;\n const messageType = isIOS() || isAndroid() ? 'touch' : 'keyboard';\n longpressDescription.textContent = LONGPRESS_INSTRUCTIONS[messageType];\n longpressDescription.slot = 'longpress-describedby-descriptor';\n const triggerParent = trigger.getRootNode() as HTMLElement;\n const overlayParent = this.getRootNode() as HTMLElement;\n // Manage the placement of the helper element in an accessible place with\n // the lowest chance of negatively affecting the layout of the page.\n if (triggerParent === overlayParent) {\n // Trigger and Overlay in same DOM tree...\n // Append helper element to Overlay.\n this.append(longpressDescription);\n } else {\n // If Trigger in <body>, hide helper\n longpressDescription.hidden = !('host' in triggerParent);\n // Trigger and Overlay in different DOM tree, Trigger in shadow tree...\n // Insert helper element after Trigger.\n trigger.insertAdjacentElement('afterend', longpressDescription);\n }\n\n const releaseLongpressDescribedby = conditionAttributeWithId(\n trigger,\n 'aria-describedby',\n [longpressDescription.id]\n );\n this.releaseLongpressDescribedby = () => {\n releaseLongpressDescribedby();\n longpressDescription.remove();\n this.releaseLongpressDescribedby = noop;\n };\n }\n\n private prepareAriaDescribedby(): void {\n if (\n // only \"hover\" relationships establed described by content\n this.triggerInteraction !== 'hover' ||\n // do not reapply until target is recycled\n this.releaseAriaDescribedby !== noop ||\n // require \"hover content\" to apply relationship\n !this.elements.length ||\n // Virtual triggers can have no aria content\n !this.hasNonVirtualTrigger\n ) {\n return;\n }\n\n const trigger = this.triggerElement as HTMLElement;\n const triggerRoot = trigger.getRootNode();\n const contentRoot = this.elements[0].getRootNode();\n const overlayRoot = this.getRootNode();\n if (triggerRoot == overlayRoot) {\n const releaseAriaDescribedby = conditionAttributeWithId(\n trigger,\n 'aria-describedby',\n [this.id]\n );\n this.releaseAriaDescribedby = () => {\n releaseAriaDescribedby();\n this.releaseAriaDescribedby = noop;\n };\n } else if (triggerRoot === contentRoot) {\n this.elementIds = this.elements.map((el) => el.id);\n const appliedIds = this.elements.map((el) => {\n if (!el.id) {\n el.id = `${this.tagName.toLowerCase()}-helper-${crypto\n .randomUUID()\n .slice(0, 8)}`;\n }\n return el.id;\n });\n const releaseAriaDescribedby = conditionAttributeWithId(\n trigger,\n 'aria-describedby',\n appliedIds\n );\n this.releaseAriaDescribedby = () => {\n releaseAriaDescribedby();\n this.elements.map((el, index) => {\n el.id = this.elementIds[index];\n });\n this.releaseAriaDescribedby = noop;\n };\n }\n }\n\n private handlePointerdown = (event: PointerEvent): void => {\n if (!this.triggerElement) return;\n if (event.button !== 0) return;\n const triggerElement = this.triggerElement as HTMLElement;\n this.longpressState = 'potential';\n document.addEventListener('pointerup', this.handlePointerup);\n document.addEventListener('pointercancel', this.handlePointerup);\n if (\n (triggerElement as HTMLElement & { holdAffordance: boolean })\n .holdAffordance\n ) {\n // Only dispatch longpress event if the trigger element isn't doing it for us.\n return;\n }\n this.longressTimeout = setTimeout(() => {\n if (!triggerElement) return;\n triggerElement.dispatchEvent(\n new CustomEvent<LongpressEvent>('longpress', {\n bubbles: true,\n composed: true,\n detail: {\n source: 'pointer',\n },\n })\n );\n }, LONGPRESS_DURATION);\n };\n\n private handlePointerup = (): void => {\n clearTimeout(this.longressTimeout);\n if (!this.triggerElement) return;\n // When triggered by the pointer, the last of `opened`\n // or `pointerup` should move the `longpressState` to\n // `null` so that the earlier event can void the \"light\n // dismiss\" and keep the Overlay open.\n this.longpressState = this.state === 'opening' ? 'pressed' : 'null';\n document.removeEventListener('pointerup', this.handlePointerup);\n document.removeEventListener('pointercancel', this.handlePointerup);\n };\n\n /**\n * @private\n */\n protected handleKeydown = (event: KeyboardEvent): void => {\n const { code, altKey } = event;\n if (code === 'Space' || (altKey && code === 'ArrowDown')) {\n if (code === 'ArrowDown') {\n event.stopPropagation();\n event.stopImmediatePropagation();\n }\n }\n };\n\n protected handleKeyup = (event: KeyboardEvent): void => {\n const { code, altKey } = event;\n if (code === 'Space' || (altKey && code === 'ArrowDown')) {\n if (!this.triggerElement || !this.hasNonVirtualTrigger) {\n return;\n }\n event.stopPropagation();\n (this.triggerElement as HTMLElement).dispatchEvent(\n new CustomEvent<LongpressEvent>('longpress', {\n bubbles: true,\n composed: true,\n detail: {\n source: 'keyboard',\n },\n })\n );\n setTimeout(() => {\n this.longpressState = 'null';\n });\n }\n };\n\n /**\n * An overlay with a `click` interaction should not close on click `triggerElement`.\n * When a click is initiated (`pointerdown`), apply `preventNextToggle` when the\n * overlay is `open` to prevent from toggling the overlay when the click event\n * propagates later in the interaction.\n */\n private preventNextToggle = false;\n\n protected handlePointerdownForClick = (): void => {\n this.preventNextToggle = this.open;\n };\n\n protected handleClick = (): void => {\n if (\n this.longpressState === 'opening' ||\n this.longpressState === 'pressed'\n ) {\n return;\n }\n if (!this.preventNextToggle) {\n this.open = !this.open;\n }\n this.preventNextToggle = false;\n };\n\n private focusedin = false;\n\n protected handleFocusin = (): void => {\n this.open = true;\n this.focusedin = true;\n };\n\n protected handleFocusout = (): void => {\n this.focusedin = false;\n if (this.pointerentered) return;\n this.open = false;\n };\n\n private pointerentered = false;\n\n protected handlePointerenter = (): void => {\n if (this.hoverTimeout) {\n clearTimeout(this.hoverTimeout);\n delete this.hoverTimeout;\n }\n if (this.disabled) return;\n this.open = true;\n this.pointerentered = true;\n };\n\n // set a timeout once the pointer enters and the overlay is shown\n // give the user time to enter the overlay\n\n protected handleOverlayPointerenter = (): void => {\n if (this.hoverTimeout) {\n clearTimeout(this.hoverTimeout);\n delete this.hoverTimeout;\n }\n };\n\n protected handlePointerleave = (): void => {\n this.doPointerleave();\n };\n\n protected handleOverlayPointerleave = (): void => {\n this.doPointerleave();\n };\n\n protected doPointerleave(): void {\n this.pointerentered = false;\n const triggerElement = this.triggerElement as HTMLElement;\n if (this.focusedin && triggerElement.matches(':focus-visible')) return;\n\n this.hoverTimeout = setTimeout(() => {\n this.open = false;\n }, HOVER_DELAY);\n }\n\n protected handleLongpress = (): void => {\n this.open = true;\n this.longpressState =\n this.longpressState === 'potential' ? 'opening' : 'pressed';\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 (\n this.longpressState !== 'opening' &&\n this.longpressState !== 'pressed'\n ) {\n this.open = false;\n return;\n }\n this.manuallyKeepOpen();\n }\n\n public override manuallyKeepOpen(): void {\n super.manuallyKeepOpen();\n this.open = true;\n this.placementController.allowPlacementUpdate = true;\n this.manageOpen(false);\n }\n\n protected handleSlotchange(): void {\n if (this.triggerElement) {\n this.prepareAriaDescribedby();\n }\n if (!this.elements.length) {\n this.releaseLongpressDescribedby();\n } else if (this.hasNonVirtualTrigger) {\n this.prepareLongpressDescription(\n this.triggerElement as HTMLElement\n );\n }\n }\n\n public shouldPreventClose(): boolean {\n const shouldPreventClose = this.willPreventClose;\n this.willPreventClose = false;\n return shouldPreventClose;\n }\n\n override willUpdate(changes: PropertyValues): void {\n if (!this.hasAttribute('id')) {\n this.setAttribute(\n 'id',\n `${this.tagName.toLowerCase()}-${crypto\n .randomUUID()\n .slice(0, 8)}`\n );\n }\n if (\n changes.has('open') &&\n (typeof changes.get('open') !== 'undefined' || this.open)\n ) {\n this.manageOpen(changes.get('open'));\n }\n if (changes.has('trigger')) {\n const [id, interaction] = this.trigger?.split('@') || [];\n this.elementResolver.selector = id ? `#${id}` : '';\n this.triggerInteraction = interaction as\n | 'click'\n | 'longpress'\n | 'hover'\n | undefined;\n }\n const oldTrigger = this.triggerElement as HTMLElement;\n if (changes.has(elementResolverUpdatedSymbol)) {\n this.triggerElement = this.elementResolver.element;\n this.manageTriggerElement(oldTrigger);\n }\n if (changes.has('triggerElement')) {\n this.manageTriggerElement(changes.get('triggerElement'));\n }\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (changes.has('placement')) {\n if (this.placement) {\n this.dialogEl.setAttribute('actual-placement', this.placement);\n } else {\n this.dialogEl.removeAttribute('actual-placement');\n }\n if (this.open && typeof changes.get('placement') !== 'undefined') {\n this.placementController.resetOverlayPosition();\n }\n }\n }\n\n protected renderContent(): TemplateResult {\n return html`\n <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.hasNonVirtualTrigger) {\n this.bindEvents();\n }\n }\n\n override disconnectedCallback(): void {\n if (this.hasNonVirtualTrigger) {\n this.unbindEvents();\n }\n this.releaseAriaDescribedby();\n this.releaseLongpressDescribedby();\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;A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