@spectrum-web-components/overlay 0.19.2-overlay.33 → 0.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/custom-elements.json +1212 -0
  2. package/package.json +6 -57
  3. package/src/OverlayTrigger.d.ts +31 -18
  4. package/src/OverlayTrigger.dev.js +245 -137
  5. package/src/OverlayTrigger.dev.js.map +3 -3
  6. package/src/OverlayTrigger.js +22 -54
  7. package/src/OverlayTrigger.js.map +3 -3
  8. package/src/overlay-trigger.css.dev.js +1 -1
  9. package/src/overlay-trigger.css.dev.js.map +1 -1
  10. package/src/overlay-trigger.css.js +1 -1
  11. package/src/overlay-trigger.css.js.map +1 -1
  12. package/stories/overlay-story-components.js +2 -1
  13. package/stories/overlay-story-components.js.map +2 -2
  14. package/stories/overlay.stories.js +637 -652
  15. package/stories/overlay.stories.js.map +2 -2
  16. package/sync/overlay-trigger.d.ts +0 -4
  17. package/sync/overlay-trigger.dev.js +3 -1
  18. package/sync/overlay-trigger.dev.js.map +2 -2
  19. package/sync/overlay-trigger.js +1 -1
  20. package/sync/overlay-trigger.js.map +3 -3
  21. package/test/index.js +3 -3
  22. package/test/index.js.map +2 -2
  23. package/test/overlay-lifecycle.test.js +61 -15
  24. package/test/overlay-lifecycle.test.js.map +2 -2
  25. package/test/overlay-trigger-click.test.js +2 -3
  26. package/test/overlay-trigger-click.test.js.map +2 -2
  27. package/test/overlay-trigger-extended.test.js +1 -1
  28. package/test/overlay-trigger-extended.test.js.map +2 -2
  29. package/test/overlay-trigger-hover-click.test.js +1 -1
  30. package/test/overlay-trigger-hover-click.test.js.map +2 -2
  31. package/test/overlay-trigger-hover.test.js +2 -2
  32. package/test/overlay-trigger-hover.test.js.map +2 -2
  33. package/test/overlay-trigger-longpress.test.js +1 -1
  34. package/test/overlay-trigger-longpress.test.js.map +2 -2
  35. package/test/overlay-update.test.js +4 -4
  36. package/test/overlay-update.test.js.map +2 -2
  37. package/test/overlay.test.js +3 -3
  38. package/test/overlay.test.js.map +2 -2
  39. package/sp-overlay.d.ts +0 -11
  40. package/sp-overlay.dev.js +0 -14
  41. package/sp-overlay.dev.js.map +0 -7
  42. package/sp-overlay.js +0 -2
  43. package/sp-overlay.js.map +0 -7
  44. package/src/OverlayBase.d.ts +0 -91
  45. package/src/OverlayBase.dev.js +0 -521
  46. package/src/OverlayBase.dev.js.map +0 -7
  47. package/src/OverlayBase.js +0 -16
  48. package/src/OverlayBase.js.map +0 -7
  49. package/src/OverlayDialog.d.ts +0 -8
  50. package/src/OverlayDialog.dev.js +0 -43
  51. package/src/OverlayDialog.dev.js.map +0 -7
  52. package/src/OverlayDialog.js +0 -2
  53. package/src/OverlayDialog.js.map +0 -7
  54. package/src/OverlayElement.d.ts +0 -66
  55. package/src/OverlayElement.dev.js +0 -371
  56. package/src/OverlayElement.dev.js.map +0 -7
  57. package/src/OverlayElement.js +0 -9
  58. package/src/OverlayElement.js.map +0 -7
  59. package/src/OverlayNoPopover.d.ts +0 -8
  60. package/src/OverlayNoPopover.dev.js +0 -63
  61. package/src/OverlayNoPopover.dev.js.map +0 -7
  62. package/src/OverlayNoPopover.js +0 -2
  63. package/src/OverlayNoPopover.js.map +0 -7
  64. package/src/OverlayPopover.d.ts +0 -8
  65. package/src/OverlayPopover.dev.js +0 -37
  66. package/src/OverlayPopover.dev.js.map +0 -7
  67. package/src/OverlayPopover.js +0 -2
  68. package/src/OverlayPopover.js.map +0 -7
  69. package/src/OverlayStack.d.ts +0 -24
  70. package/src/OverlayStack.dev.js +0 -113
  71. package/src/OverlayStack.dev.js.map +0 -7
  72. package/src/OverlayStack.js +0 -2
  73. package/src/OverlayStack.js.map +0 -7
  74. package/src/PlacementController.d.ts +0 -35
  75. package/src/PlacementController.dev.js +0 -172
  76. package/src/PlacementController.dev.js.map +0 -7
  77. package/src/PlacementController.js +0 -2
  78. package/src/PlacementController.js.map +0 -7
  79. package/src/fullSizePlugin.d.ts +0 -12
  80. package/src/fullSizePlugin.dev.js +0 -39
  81. package/src/fullSizePlugin.dev.js.map +0 -7
  82. package/src/fullSizePlugin.js +0 -2
  83. package/src/fullSizePlugin.js.map +0 -7
  84. package/src/overlay-base.css.d.ts +0 -2
  85. package/src/overlay-base.css.dev.js +0 -9
  86. package/src/overlay-base.css.dev.js.map +0 -7
  87. package/src/overlay-base.css.js +0 -6
  88. package/src/overlay-base.css.js.map +0 -7
  89. package/src/overlay-element.css.d.ts +0 -2
  90. package/src/overlay-element.css.dev.js +0 -7
  91. package/src/overlay-element.css.dev.js.map +0 -7
  92. package/src/overlay-element.css.js +0 -4
  93. package/src/overlay-element.css.js.map +0 -7
  94. package/src/placement.d.ts +0 -21
  95. package/src/placement.dev.js +0 -111
  96. package/src/placement.dev.js.map +0 -7
  97. package/src/placement.js +0 -2
  98. package/src/placement.js.map +0 -7
  99. package/src/sizePlugin.d.ts +0 -12
  100. package/src/sizePlugin.dev.js +0 -18
  101. package/src/sizePlugin.dev.js.map +0 -7
  102. package/src/sizePlugin.js +0 -2
  103. package/src/sizePlugin.js.map +0 -7
  104. package/src/topLayerOverTransforms.d.ts +0 -22
  105. package/src/topLayerOverTransforms.dev.js +0 -161
  106. package/src/topLayerOverTransforms.dev.js.map +0 -7
  107. package/src/topLayerOverTransforms.js +0 -2
  108. package/src/topLayerOverTransforms.js.map +0 -7
  109. package/stories/overlay-element.stories.js +0 -216
  110. package/stories/overlay-element.stories.js.map +0 -7
  111. package/test/overlay-element.test-vrt.js +0 -5
  112. package/test/overlay-element.test-vrt.js.map +0 -7
  113. package/test/overlay-element.test.js +0 -739
  114. package/test/overlay-element.test.js.map +0 -7
@@ -1,9 +0,0 @@
1
- "use strict";var m=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var n=(d,a,e,t)=>{for(var i=t>1?void 0:t?g(a,e):a,r=d.length-1,s;r>=0;r--)(s=d[r])&&(i=(t?s(a,e,i):s(i))||i);return t&&i&&m(a,e,i),i};import{html as v,SpectrumElement as f}from"@spectrum-web-components/base";import{property as o,query as p,queryAssignedElements as E,state as h}from"@spectrum-web-components/base/src/decorators.js";import{ifDefined as P,styleMap as L}from"@spectrum-web-components/base/src/directives.js";import{ElementResolutionController as y,elementResolverUpdatedSymbol as b}from"@spectrum-web-components/reactive-controllers/src/ElementResolution.js";import{conditionAttributeWithId as w}from"@spectrum-web-components/base/src/condition-attribute-with-id.js";import k from"./overlay-element.css.js";import{updateOverlayPosition as C}from"./placement.js";export const supportTopLayer=CSS.supports("selector(:open)");const T=300;let u;export const LONGPRESS_INSTRUCTIONS={touch:"Double tap and long press for additional options",keyboard:"Press Space or Alt+Down Arrow for additional options",mouse:"Click and hold for additional options"};const l=class extends f{constructor(){super(...arguments);this.delayed=!1;this.id="";this.longpressed=!1;this.offset=6;this.open=!1;this.receivesFocus="auto";this.triggerElement=null;this.type="hint";this.elementResolver=new y(this);this.releaseAriaDescribedby=()=>{};this.handlePointerdown=e=>{!this.triggerElement||e.button===0&&(this.longpressed=!1,this.triggerElement.addEventListener("pointerup",this.handlePointerup),this.triggerElement.addEventListener("pointercancel",this.handlePointerup),u=setTimeout(()=>{!this.triggerElement||this.triggerElement.dispatchEvent(new CustomEvent("longpress",{bubbles:!0,composed:!0,detail:{source:"pointer"}}))},T))};this.handlePointerup=()=>{clearTimeout(u),this.triggerElement&&(this.longpressed&&(this.open=!0),this.longpressed=!1,this.triggerElement.removeEventListener("pointerup",this.handlePointerup),this.triggerElement.removeEventListener("pointercancel",this.handlePointerup))};this.handleKeydown=e=>{const{code:t,altKey:i}=e;(t==="Space"||i&&t==="ArrowDown")&&t==="ArrowDown"&&(e.stopPropagation(),e.stopImmediatePropagation())};this.handleKeyup=e=>{const{code:t,altKey:i}=e;(t==="Space"||i&&t==="ArrowDown")&&(e.stopPropagation(),this.dispatchEvent(new CustomEvent("longpress",{bubbles:!0,composed:!0,detail:{source:"keyboard"}})))};this.handleClick=()=>{var e;this.open=!0,(e=this.triggerElement)==null||e.removeEventListener("click",this.handleClick)};this.focusedin=!1;this.handleFocusin=()=>{this.open=!0,this.focusedin=!0};this.handleFocusout=()=>{this.focusedin=!1,!this.pointerentered&&(this.open=!1)};this.pointerentered=!1;this.handlePointerenter=()=>{this.open=!0,this.pointerentered=!0};this.handlePointerleave=()=>{var e;this.pointerentered=!1,!(this.focusedin&&((e=this.triggerElement)==null?void 0:e.matches(":focus-visible")))&&(this.open=!1)};this.handleLongpress=()=>{this.open=!0,this.longpressed=!0}}get usesDialog(){return this.type==="modal"||this.type==="page"}get popoverValue(){switch(this.type){case"modal":case"page":return;case"hint":return"manual";default:return this.type}}manageChildren(e){this.elements.forEach(t=>{typeof t.open!="undefined"&&(t.open=e)})}manageDialogOpen(){}managePopoverOpen(){const e=(t=()=>{})=>{var i;(i=this.elements[0])==null||i.addEventListener("transitionend",t,{once:!0}),this.manageChildren(!1)};supportTopLayer?this.open?this.dialogEl.matches(":open")||this.dialogEl.showPopover():this.dialogEl.matches(":open")?e(()=>{this.open||this.dialogEl.hidePopover()}):e():this.open||e()}get requiresPosition(){return console.log(this.type,this.open,this.triggerElement,this.placement),!(this.type==="page"||!this.open||!this.triggerElement||!this.placement&&this.type!=="hint")}managePosition(){var s;if(!this.requiresPosition)return;const e=this.offset||0,t=this.triggerElement,i=this.placement||"right",r=(s=this.elements.find(c=>c.tipElement))==null?void 0:s.tipElement;C(this.dialogEl,{offset:e,placement:i,trigger:t,type:this.type},{elements:this.elements,tipElement:r})}async manageOpen(){this.hasUpdated||await this.updateComplete,this.usesDialog?this.manageDialogOpen():this.managePopoverOpen(),this.open&&(l.openCount+=1,this.manageChildren(this.open),this.managePosition())}manageTriggerElement(e){if(e&&(e.removeEventListener("click",this.handleClick),e.removeEventListener("focusin",this.handleFocusin),e.removeEventListener("focusout",this.handleFocusout),e.removeEventListener("pointerenter",this.handlePointerenter),e.removeEventListener("pointerleave",this.handlePointerleave),e.addEventListener("pointerdown",this.handlePointerdown),e.addEventListener("keydown",this.handleKeydown),e.addEventListener("keyup",this.handleKeyup),e.addEventListener("longpress",this.handleLongpress),this.releaseAriaDescribedby()),!!this.triggerElement)switch(this.triggerInteraction){case"click":this.triggerElement.addEventListener("click",this.handleClick);return;case"longpress":this.triggerElement.addEventListener("pointerdown",this.handlePointerdown),this.triggerElement.addEventListener("keydown",this.handleKeydown),this.triggerElement.addEventListener("keyup",this.handleKeyup),this.triggerElement.addEventListener("longpress",this.handleLongpress);return;case"hover":if(this.triggerElement.addEventListener("focusin",this.handleFocusin),this.triggerElement.addEventListener("focusout",this.handleFocusout),this.triggerElement.addEventListener("pointerenter",this.handlePointerenter),this.triggerElement.addEventListener("pointerleave",this.handlePointerleave),this.receivesFocus==="true")return;const t=w(this.triggerElement,"aria-describedby",[this.id]);this.releaseAriaDescribedby=()=>{t(),this.releaseAriaDescribedby=()=>{}};return}}handlePopoverhide(){this.open=!1,this.dispatchEvent(new Event("popoverhide")),this.triggerInteraction==="click"&&requestAnimationFrame(()=>{var e;(e=this.triggerElement)==null||e.addEventListener("click",this.handleClick)})}handlePopovershow(){this.dispatchEvent(new Event("popovershow"))}willUpdate(e){var t;if(this.hasAttribute("id")||this.setAttribute("id",`${this.tagName.toLowerCase()}-${crypto.randomUUID().slice(0,8)}`),e.has("open")&&(typeof e.get("open")!="undefined"||this.open)&&this.manageOpen(),e.has("trigger")){const[i,r]=((t=this.trigger)==null?void 0:t.split("@"))||[];this.elementResolver.selector=i?`#${i}`:"",this.triggerInteraction=r}e.has(b)&&(this.triggerElement=this.elementResolver.element,this.manageTriggerElement(e.get("triggerElement")))}render(){return v`
2
- <dialog
3
- @popoverhide=${this.handlePopoverhide}
4
- @popovershow=${this.handlePopovershow}
5
- popover=${P(this.popoverValue)}
6
- style=${L({"--swc-overlay-z-index":l.openCount.toString()})}
7
- ><slot></slot></dialog>
8
- `}};export let Overlay=l;Overlay.styles=[k],Overlay.openCount=1,n([o({type:Boolean})],Overlay.prototype,"delayed",2),n([p("dialog")],Overlay.prototype,"dialogEl",2),n([E({flatten:!0})],Overlay.prototype,"elements",2),n([o({type:String})],Overlay.prototype,"id",2),n([o()],Overlay.prototype,"offset",2),n([o({type:Boolean})],Overlay.prototype,"open",2),n([o()],Overlay.prototype,"placement",2),n([o({attribute:"receives-focus"})],Overlay.prototype,"receivesFocus",2),n([p("slot")],Overlay.prototype,"slotEl",2),n([o()],Overlay.prototype,"trigger",2),n([h()],Overlay.prototype,"triggerElement",2),n([h()],Overlay.prototype,"triggerInteraction",2),n([o()],Overlay.prototype,"type",2);
9
- //# sourceMappingURL=OverlayElement.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["OverlayElement.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { Placement } from '@floating-ui/dom';\nimport { html, PropertyValues, SpectrumElement } from '@spectrum-web-components/base';\nimport { property, query, queryAssignedElements, state } from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined, styleMap } from '@spectrum-web-components/base/src/directives.js';\nimport { ElementResolutionController, elementResolverUpdatedSymbol } from '@spectrum-web-components/reactive-controllers/src/ElementResolution.js';\nimport {\n conditionAttributeWithId,\n} from '@spectrum-web-components/base/src/condition-attribute-with-id.js';\n\nimport styles from './overlay-element.css.js';\nimport { updateOverlayPosition } from './placement.js';\nimport { VirtualTrigger } from './VirtualTrigger.js';\n\nexport const supportTopLayer = CSS.supports('selector(:open)');\nconst LONGPRESS_DURATION = 300;\nlet LONGPRESS_TIMEOUT: ReturnType<typeof setTimeout>;\n\nexport type LongpressEvent = {\n source: 'pointer' | 'keyboard';\n};\n\nexport const LONGPRESS_INSTRUCTIONS = {\n touch: 'Double tap and long press for additional options',\n keyboard: 'Press Space or Alt+Down Arrow for additional options',\n mouse: 'Click and hold for additional options',\n};\n\ntype OpenableElement = HTMLElement & {\n open: boolean;\n tipElement?: HTMLElement;\n updateComplete?: Promise<void>;\n};\n\nexport class Overlay extends SpectrumElement {\n static override styles = [styles];\n @property({type: Boolean})\n delayed = false;\n\n @query('dialog')\n dialogEl!: HTMLDialogElement & { \n showPopover(): void;\n hidePopover(): void;\n };\n\n @queryAssignedElements({ flatten: true })\n elements!: OpenableElement[];\n\n @property({ type: String })\n public override id = '';\n\n protected longpressed = false;\n\n @property()\n offset: number | [ number, number ] = 6;\n\n @property({type: Boolean})\n open = false;\n\n static openCount = 1;\n\n @property()\n placement?: Placement;\n\n @property({ attribute: 'receives-focus' })\n receivesFocus: 'true' | 'false' | 'auto' = 'auto';\n\n @query('slot')\n slotEl!: HTMLSlotElement;\n\n @property()\n trigger?: string;\n\n @state()\n triggerElement: HTMLElement | VirtualTrigger | null = null;\n\n @state()\n triggerInteraction?: 'click' | 'longpress' | 'hover';\n\n @property()\n type: 'auto' | 'hint' | 'manual' | 'modal' | 'page' = 'hint';\n\n private elementResolver = new ElementResolutionController(this);\n\n private get usesDialog(): boolean {\n return this.type === 'modal' || this.type === 'page';\n }\n\n private get popoverValue(): 'auto' | 'manual' | undefined {\n switch (this.type) {\n case 'modal':\n case 'page':\n return undefined;\n case 'hint':\n return 'manual';\n default:\n return this.type;\n }\n }\n\n protected manageChildren(open: boolean): void {\n this.elements.forEach(el => {\n if (typeof el.open !== 'undefined') {\n el.open = open;\n }\n });\n }\n\n protected manageDialogOpen(): void {\n\n }\n\n protected managePopoverOpen(): void {\n const doClose = (cb = () => { return; }): void => {\n this.elements[0]?.addEventListener('transitionend', cb, {\n once: true\n });\n this.manageChildren(false);\n }\n if (supportTopLayer) {\n if (this.open) {\n if (!this.dialogEl.matches(':open')) {\n this.dialogEl.showPopover();\n }\n } else {\n if (this.dialogEl.matches(':open')) {\n doClose(() => {\n if (!this.open) {\n this.dialogEl.hidePopover();\n }\n });\n } else {\n doClose();\n }\n }\n } else {\n if (this.open) {\n\n } else {\n doClose();\n }\n }\n }\n\n protected get requiresPosition(): boolean {\n console.log(this.type, this.open, this.triggerElement, this.placement);\n if (this.type === 'page' || !this.open) return false;\n if (!this.triggerElement || (!this.placement && this.type !== 'hint')) return false;\n return true;\n }\n\n protected managePosition(): void {\n if (!this.requiresPosition) 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 tipElement = this.elements.find(\n (el) => el.tipElement\n )?.tipElement;\n\n updateOverlayPosition(\n this.dialogEl,\n {\n // delayed?: boolean,\n offset,\n placement,\n // notImmediatelyClosable?: boolean, // rename or place behind other API options\n // receivesFocus?: 'auto';\n // root?: HTMLElement;\n trigger,\n type: this.type,\n },\n {\n elements: this.elements,\n tipElement,\n }\n );\n }\n\n protected async manageOpen(): Promise<void> {\n if (!this.hasUpdated) {\n await this.updateComplete;\n }\n if (this.usesDialog) {\n this.manageDialogOpen();\n } else {\n this.managePopoverOpen();\n }\n if (this.open) {\n Overlay.openCount += 1;\n this.manageChildren(this.open);\n this.managePosition();\n }\n }\n\n private releaseAriaDescribedby = () => { return; };\n\n protected manageTriggerElement(triggerElement: HTMLElement | null): void {\n if (triggerElement) {\n triggerElement.removeEventListener('click', this.handleClick);\n triggerElement.removeEventListener('focusin', this.handleFocusin);\n triggerElement.removeEventListener('focusout', this.handleFocusout);\n triggerElement.removeEventListener('pointerenter', this.handlePointerenter);\n triggerElement.removeEventListener('pointerleave', this.handlePointerleave);\n triggerElement.addEventListener('pointerdown', this.handlePointerdown);\n triggerElement.addEventListener('keydown', this.handleKeydown);\n triggerElement.addEventListener('keyup', this.handleKeyup);\n triggerElement.addEventListener('longpress', this.handleLongpress);\n this.releaseAriaDescribedby();\n }\n if (!this.triggerElement) return;\n switch (this.triggerInteraction) {\n case 'click':\n this.triggerElement.addEventListener('click', this.handleClick);\n return;\n case 'longpress':\n this.triggerElement.addEventListener('pointerdown', this.handlePointerdown);\n this.triggerElement.addEventListener('keydown', this.handleKeydown);\n this.triggerElement.addEventListener('keyup', this.handleKeyup);\n this.triggerElement.addEventListener('longpress', this.handleLongpress);\n return;\n case 'hover':\n this.triggerElement.addEventListener('focusin', this.handleFocusin);\n this.triggerElement.addEventListener('focusout', this.handleFocusout);\n this.triggerElement.addEventListener('pointerenter', this.handlePointerenter);\n this.triggerElement.addEventListener('pointerleave', this.handlePointerleave);\n if (this.receivesFocus === 'true') return;\n\n const releaseAriaDescribedby = conditionAttributeWithId(this.triggerElement, 'aria-describedby', [\n this.id,\n ]);\n this.releaseAriaDescribedby = () => {\n releaseAriaDescribedby();\n this.releaseAriaDescribedby = () => { return; };\n }\n return;\n }\n }\n\n private handlePointerdown = (event: PointerEvent): void => {\n if (!this.triggerElement) return;\n if (event.button !== 0) return;\n this.longpressed = false;\n this.triggerElement.addEventListener('pointerup', this.handlePointerup);\n this.triggerElement.addEventListener('pointercancel', this.handlePointerup);\n LONGPRESS_TIMEOUT = setTimeout(() => {\n if (!this.triggerElement) return;\n this.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(LONGPRESS_TIMEOUT);\n if (!this.triggerElement) return;\n if (this.longpressed) {\n this.open = true;\n }\n this.longpressed = false;\n this.triggerElement.removeEventListener('pointerup', this.handlePointerup);\n this.triggerElement.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 event.stopPropagation();\n this.dispatchEvent(\n new CustomEvent<LongpressEvent>('longpress', {\n bubbles: true,\n composed: true,\n detail: {\n source: 'keyboard',\n },\n })\n );\n }\n }\n\n protected handleClick = (): void => {\n this.open = true;\n this.triggerElement?.removeEventListener('click', this.handleClick);\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 this.open = true;\n this.pointerentered = true;\n }\n\n protected handlePointerleave = (): void => {\n this.pointerentered = false;\n if (this.focusedin && this.triggerElement?.matches(':focus-visible')) return;\n this.open = false;\n }\n\n protected handleLongpress = (): void => {\n this.open = true;\n this.longpressed = true;\n }\n\n protected handlePopoverhide(): void {\n this.open = false;\n this.dispatchEvent(new Event('popoverhide'));\n if (this.triggerInteraction === 'click') {\n requestAnimationFrame(() => {\n this.triggerElement?.addEventListener('click', this.handleClick);\n });\n }\n }\n\n protected handlePopovershow(): void {\n this.dispatchEvent(new Event('popovershow'));\n }\n\n override willUpdate(changes: PropertyValues): void {\n if (!this.hasAttribute('id')) {\n this.setAttribute(\n 'id',\n `${this.tagName.toLowerCase()}-${crypto.randomUUID().slice(0,8)}`\n );\n }\n if (changes.has('open') && (typeof changes.get('open') !== 'undefined' || this.open)) {\n this.manageOpen();\n }\n if (changes.has('trigger')) {\n const [id, interaction] = this.trigger?.split('@') || [];\n this.elementResolver.selector = id ? `#${id}` : '';\n this.triggerInteraction = interaction as \"click\" | \"longpress\" | \"hover\" | undefined;\n }\n if (changes.has(elementResolverUpdatedSymbol)) {\n this.triggerElement = this.elementResolver.element;\n this.manageTriggerElement(changes.get('triggerElement'));\n }\n }\n\n override render() {\n return html`\n <dialog\n @popoverhide=${this.handlePopoverhide}\n @popovershow=${this.handlePopovershow}\n popover=${ifDef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,GALN,QAMT,wBAMA8B,EAAA,CADC7B,EAAsB,CAAE,QAAS,EAAK,CAAC,GAX/B,QAYT,wBAGgB6B,EAAA,CADf/B,EAAS,CAAE,KAAM,MAAO,CAAC,GAdjB,QAeO,kBAKhB+B,EAAA,CADC/B,EAAS,GAnBD,QAoBT,sBAGA+B,EAAA,CADC/B,EAAS,CAAC,KAAM,OAAO,CAAC,GAtBhB,QAuBT,oBAKA+B,EAAA,CADC/B,EAAS,GA3BD,QA4BT,yBAGA+B,EAAA,CADC/B,EAAS,CAAE,UAAW,gBAAiB,CAAC,GA9BhC,QA+BT,6BAGA+B,EAAA,CADC9B,EAAM,MAAM,GAjCJ,QAkCT,sBAGA8B,EAAA,CADC/B,EAAS,GApCD,QAqCT,uBAGA+B,EAAA,CADC5B,EAAM,GAvCE,QAwCT,8BAGA4B,EAAA,CADC5B,EAAM,GA1CE,QA2CT,kCAGA4B,EAAA,CADC/B,EAAS,GA7CD,QA8CT",
6
- "names": ["html", "SpectrumElement", "property", "query", "queryAssignedElements", "state", "ifDefined", "styleMap", "ElementResolutionController", "elementResolverUpdatedSymbol", "conditionAttributeWithId", "styles", "updateOverlayPosition", "LONGPRESS_DURATION", "LONGPRESS_TIMEOUT", "_Overlay", "event", "code", "altKey", "_a", "open", "el", "doClose", "cb", "offset", "trigger", "placement", "tipElement", "triggerElement", "releaseAriaDescribedby", "changes", "id", "interaction", "__decorateClass"]
7
- }
@@ -1,8 +0,0 @@
1
- import { ReactiveElement } from 'lit';
2
- import { OverlayBase } from './OverlayBase.js';
3
- declare type Constructor<T = Record<string, unknown>> = {
4
- new (...args: any[]): T;
5
- prototype: T;
6
- };
7
- export declare function OverlayNoPopover<T extends Constructor<OverlayBase>>(constructor: T): T & Constructor<ReactiveElement>;
8
- export {};
@@ -1,63 +0,0 @@
1
- "use strict";
2
- import {
3
- firstFocusableIn,
4
- firstFocusableSlottedIn
5
- } from "@spectrum-web-components/shared/src/first-focusable-in.js";
6
- import {
7
- BeforetoggleClosedEvent,
8
- BeforetoggleOpenEvent
9
- } from "./OverlayBase.dev.js";
10
- export function OverlayNoPopover(constructor) {
11
- class OverlayWithNoPopover extends constructor {
12
- async managePopoverOpen() {
13
- const doClose = (cb = () => {
14
- return;
15
- }) => {
16
- var _a;
17
- (_a = this.elements[0]) == null ? void 0 : _a.addEventListener("transitionend", cb, {
18
- once: true
19
- });
20
- this.manageChildren(false);
21
- this.dispatchEvent(new BeforetoggleClosedEvent());
22
- };
23
- if (this.open) {
24
- await this.managePosition();
25
- requestAnimationFrame(() => {
26
- requestAnimationFrame(async () => {
27
- let focusEl = null;
28
- this.elements.forEach(
29
- (element) => {
30
- if (typeof element.open !== "undefined") {
31
- element.open = true;
32
- }
33
- if (!focusEl) {
34
- focusEl = firstFocusableIn(element);
35
- }
36
- if (!focusEl) {
37
- const childSlots = element.querySelectorAll("slot");
38
- childSlots.forEach((slot) => {
39
- if (!focusEl) {
40
- focusEl = firstFocusableSlottedIn(slot);
41
- }
42
- });
43
- }
44
- }
45
- );
46
- requestAnimationFrame(() => {
47
- requestAnimationFrame(() => {
48
- this.manageChildren(true);
49
- if (focusEl)
50
- focusEl.focus();
51
- this.dispatchEvent(new BeforetoggleOpenEvent());
52
- });
53
- });
54
- });
55
- });
56
- } else {
57
- doClose();
58
- }
59
- }
60
- }
61
- return OverlayWithNoPopover;
62
- }
63
- //# sourceMappingURL=OverlayNoPopover.dev.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["OverlayNoPopover.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport {\n firstFocusableIn,\n firstFocusableSlottedIn,\n} from '@spectrum-web-components/shared/src/first-focusable-in.js';\nimport { ReactiveElement } from 'lit';\nimport {\n BeforetoggleClosedEvent,\n BeforetoggleOpenEvent,\n OpenableElement,\n OverlayBase,\n} from './OverlayBase.dev.js'\n\ntype Constructor<T = Record<string, unknown>> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n prototype: T;\n};\n\nexport function OverlayNoPopover<T extends Constructor<OverlayBase>>(\n constructor: T\n): T & Constructor<ReactiveElement> {\n class OverlayWithNoPopover extends constructor {\n protected override async managePopoverOpen(): Promise<void> {\n const doClose = (\n cb = () => {\n return;\n }\n ): void => {\n this.elements[0]?.addEventListener('transitionend', cb, {\n once: true,\n });\n this.manageChildren(false);\n this.dispatchEvent(new BeforetoggleClosedEvent());\n };\n if (this.open) {\n await this.managePosition();\n // we can acquire overlay position\n requestAnimationFrame(() => {\n requestAnimationFrame(async () => {\n let focusEl = null as HTMLElement | null;\n this.elements.forEach(\n (element: OpenableElement): void => {\n if (typeof element.open !== 'undefined') {\n element.open = true;\n }\n if (!focusEl) {\n focusEl = firstFocusableIn(element);\n }\n if (!focusEl) {\n const childSlots =\n element.querySelectorAll('slot');\n childSlots.forEach((slot) => {\n if (!focusEl) {\n focusEl =\n firstFocusableSlottedIn(slot);\n }\n });\n }\n }\n );\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n this.manageChildren(true);\n if (focusEl) focusEl.focus();\n this.dispatchEvent(new BeforetoggleOpenEvent());\n });\n });\n });\n });\n } else {\n doClose();\n }\n }\n }\n return OverlayWithNoPopover;\n}\n"],
5
- "mappings": ";AAWA;AAAA,EACI;AAAA,EACA;AAAA,OACG;AAEP;AAAA,EACI;AAAA,EACA;AAAA,OAGG;AAQA,gBAAS,iBACZ,aACgC;AAChC,QAAM,6BAA6B,YAAY;AAAA,IAC3C,MAAyB,oBAAmC;AACxD,YAAM,UAAU,CACZ,KAAK,MAAM;AACP;AAAA,MACJ,MACO;AAtCvB;AAuCgB,mBAAK,SAAS,CAAC,MAAf,mBAAkB,iBAAiB,iBAAiB,IAAI;AAAA,UACpD,MAAM;AAAA,QACV;AACA,aAAK,eAAe,KAAK;AACzB,aAAK,cAAc,IAAI,wBAAwB,CAAC;AAAA,MACpD;AACA,UAAI,KAAK,MAAM;AACX,cAAM,KAAK,eAAe;AAE1B,8BAAsB,MAAM;AACxB,gCAAsB,YAAY;AAC9B,gBAAI,UAAU;AACd,iBAAK,SAAS;AAAA,cACV,CAAC,YAAmC;AAChC,oBAAI,OAAO,QAAQ,SAAS,aAAa;AACrC,0BAAQ,OAAO;AAAA,gBACnB;AACA,oBAAI,CAAC,SAAS;AACV,4BAAU,iBAAiB,OAAO;AAAA,gBACtC;AACA,oBAAI,CAAC,SAAS;AACV,wBAAM,aACF,QAAQ,iBAAiB,MAAM;AACnC,6BAAW,QAAQ,CAAC,SAAS;AACzB,wBAAI,CAAC,SAAS;AACV,gCACI,wBAAwB,IAAI;AAAA,oBACpC;AAAA,kBACJ,CAAC;AAAA,gBACL;AAAA,cACJ;AAAA,YACJ;AACA,kCAAsB,MAAM;AACxB,oCAAsB,MAAM;AACxB,qBAAK,eAAe,IAAI;AACxB,oBAAI;AAAS,0BAAQ,MAAM;AAC3B,qBAAK,cAAc,IAAI,sBAAsB,CAAC;AAAA,cAClD,CAAC;AAAA,YACL,CAAC;AAAA,UACL,CAAC;AAAA,QACL,CAAC;AAAA,MACL,OAAO;AACH,gBAAQ;AAAA,MACZ;AAAA,IACJ;AAAA,EACJ;AACA,SAAO;AACX;",
6
- "names": []
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";import{firstFocusableIn as s,firstFocusableSlottedIn as a}from"@spectrum-web-components/shared/src/first-focusable-in.js";import{BeforetoggleClosedEvent as l,BeforetoggleOpenEvent as c}from"./OverlayBase.js";export function OverlayNoPopover(o){class n extends o{async managePopoverOpen(){const r=(e=()=>{})=>{var t;(t=this.elements[0])==null||t.addEventListener("transitionend",e,{once:!0}),this.manageChildren(!1),this.dispatchEvent(new l)};this.open?(await this.managePosition(),requestAnimationFrame(()=>{requestAnimationFrame(async()=>{let e=null;this.elements.forEach(t=>{typeof t.open!="undefined"&&(t.open=!0),e||(e=s(t)),e||t.querySelectorAll("slot").forEach(i=>{e||(e=a(i))})}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.manageChildren(!0),e&&e.focus(),this.dispatchEvent(new c)})})})})):r()}}return n}
2
- //# sourceMappingURL=OverlayNoPopover.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["OverlayNoPopover.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport {\n firstFocusableIn,\n firstFocusableSlottedIn,\n} from '@spectrum-web-components/shared/src/first-focusable-in.js';\nimport { ReactiveElement } from 'lit';\nimport {\n BeforetoggleClosedEvent,\n BeforetoggleOpenEvent,\n OpenableElement,\n OverlayBase,\n} from './OverlayBase.js';\n\ntype Constructor<T = Record<string, unknown>> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n prototype: T;\n};\n\nexport function OverlayNoPopover<T extends Constructor<OverlayBase>>(\n constructor: T\n): T & Constructor<ReactiveElement> {\n class OverlayWithNoPopover extends constructor {\n protected override async managePopoverOpen(): Promise<void> {\n const doClose = (\n cb = () => {\n return;\n }\n ): void => {\n this.elements[0]?.addEventListener('transitionend', cb, {\n once: true,\n });\n this.manageChildren(false);\n this.dispatchEvent(new BeforetoggleClosedEvent());\n };\n if (this.open) {\n await this.managePosition();\n // we can acquire overlay position\n requestAnimationFrame(() => {\n requestAnimationFrame(async () => {\n let focusEl = null as HTMLElement | null;\n this.elements.forEach(\n (element: OpenableElement): void => {\n if (typeof element.open !== 'undefined') {\n element.open = true;\n }\n if (!focusEl) {\n focusEl = firstFocusableIn(element);\n }\n if (!focusEl) {\n const childSlots =\n element.querySelectorAll('slot');\n childSlots.forEach((slot) => {\n if (!focusEl) {\n focusEl =\n firstFocusableSlottedIn(slot);\n }\n });\n }\n }\n );\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n this.manageChildren(true);\n if (focusEl) focusEl.focus();\n this.dispatchEvent(new BeforetoggleOpenEvent());\n });\n });\n });\n });\n } else {\n doClose();\n }\n }\n }\n return OverlayWithNoPopover;\n}\n"],
5
- "mappings": "aAWA,OACI,oBAAAA,EACA,2BAAAC,MACG,4DAEP,OACI,2BAAAC,EACA,yBAAAC,MAGG,mBAQA,gBAAS,iBACZC,EACgC,CAChC,MAAMC,UAA6BD,CAAY,CAC3C,MAAyB,mBAAmC,CACxD,MAAME,EAAU,CACZC,EAAK,IAAM,CAEX,IACO,CAtCvB,IAAAC,GAuCgBA,EAAA,KAAK,SAAS,CAAC,IAAf,MAAAA,EAAkB,iBAAiB,gBAAiBD,EAAI,CACpD,KAAM,EACV,GACA,KAAK,eAAe,EAAK,EACzB,KAAK,cAAc,IAAIL,CAAyB,CACpD,EACI,KAAK,MACL,MAAM,KAAK,eAAe,EAE1B,sBAAsB,IAAM,CACxB,sBAAsB,SAAY,CAC9B,IAAIO,EAAU,KACd,KAAK,SAAS,QACTC,GAAmC,CAC5B,OAAOA,EAAQ,MAAS,cACxBA,EAAQ,KAAO,IAEdD,IACDA,EAAUT,EAAiBU,CAAO,GAEjCD,GAEGC,EAAQ,iBAAiB,MAAM,EACxB,QAASC,GAAS,CACpBF,IACDA,EACIR,EAAwBU,CAAI,EAExC,CAAC,CAET,CACJ,EACA,sBAAsB,IAAM,CACxB,sBAAsB,IAAM,CACxB,KAAK,eAAe,EAAI,EACpBF,GAASA,EAAQ,MAAM,EAC3B,KAAK,cAAc,IAAIN,CAAuB,CAClD,CAAC,CACL,CAAC,CACL,CAAC,CACL,CAAC,GAEDG,EAAQ,CAEhB,CACJ,CACA,OAAOD,CACX",
6
- "names": ["firstFocusableIn", "firstFocusableSlottedIn", "BeforetoggleClosedEvent", "BeforetoggleOpenEvent", "constructor", "OverlayWithNoPopover", "doClose", "cb", "_a", "focusEl", "element", "slot"]
7
- }
@@ -1,8 +0,0 @@
1
- import { ReactiveElement } from 'lit';
2
- import { OverlayBase } from './OverlayBase.js';
3
- declare type Constructor<T = Record<string, unknown>> = {
4
- new (...args: any[]): T;
5
- prototype: T;
6
- };
7
- export declare function OverlayPopover<T extends Constructor<OverlayBase>>(constructor: T): T & Constructor<ReactiveElement>;
8
- export {};
@@ -1,37 +0,0 @@
1
- "use strict";
2
- export function OverlayPopover(constructor) {
3
- class OverlayWithPopover extends constructor {
4
- async managePopoverOpen() {
5
- const doClose = (cb = () => {
6
- return;
7
- }) => {
8
- var _a;
9
- (_a = this.elements[0]) == null ? void 0 : _a.addEventListener("transitionend", cb, {
10
- once: true
11
- });
12
- this.manageChildren(false);
13
- };
14
- if (this.open) {
15
- await this.managePosition();
16
- if (!this.dialogEl.matches(":open")) {
17
- this.manageChildren(true);
18
- requestAnimationFrame(() => {
19
- this.dialogEl.showPopover();
20
- });
21
- }
22
- } else {
23
- if (this.dialogEl.matches(":open")) {
24
- doClose(() => {
25
- if (!this.open) {
26
- this.dialogEl.hidePopover();
27
- }
28
- });
29
- } else {
30
- doClose();
31
- }
32
- }
33
- }
34
- }
35
- return OverlayWithPopover;
36
- }
37
- //# sourceMappingURL=OverlayPopover.dev.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["OverlayPopover.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 { ReactiveElement } from 'lit';\nimport { OverlayBase } from './OverlayBase.dev.js'\n\ntype Constructor<T = Record<string, unknown>> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n prototype: T;\n};\n\nexport function OverlayPopover<T extends Constructor<OverlayBase>>(\n constructor: T\n): T & Constructor<ReactiveElement> {\n class OverlayWithPopover extends constructor {\n protected override async managePopoverOpen(): Promise<void> {\n const doClose = (\n cb = () => {\n return;\n }\n ): void => {\n this.elements[0]?.addEventListener('transitionend', cb, {\n once: true,\n });\n this.manageChildren(false);\n };\n if (this.open) {\n await this.managePosition();\n if (!this.dialogEl.matches(':open')) {\n this.manageChildren(true);\n requestAnimationFrame(() => {\n // Ensure that child content is fully \"on the DOM\" before showing the modal.\n // This allow for that content to be available to the focus algorithm of that process.\n this.dialogEl.showPopover();\n });\n }\n } else {\n if (this.dialogEl.matches(':open')) {\n doClose(() => {\n if (!this.open) {\n this.dialogEl.hidePopover();\n }\n });\n } else {\n doClose();\n }\n }\n }\n }\n return OverlayWithPopover;\n}\n"],
5
- "mappings": ";AAoBO,gBAAS,eACZ,aACgC;AAChC,QAAM,2BAA2B,YAAY;AAAA,IACzC,MAAyB,oBAAmC;AACxD,YAAM,UAAU,CACZ,KAAK,MAAM;AACP;AAAA,MACJ,MACO;AA7BvB;AA8BgB,mBAAK,SAAS,CAAC,MAAf,mBAAkB,iBAAiB,iBAAiB,IAAI;AAAA,UACpD,MAAM;AAAA,QACV;AACA,aAAK,eAAe,KAAK;AAAA,MAC7B;AACA,UAAI,KAAK,MAAM;AACX,cAAM,KAAK,eAAe;AAC1B,YAAI,CAAC,KAAK,SAAS,QAAQ,OAAO,GAAG;AACjC,eAAK,eAAe,IAAI;AACxB,gCAAsB,MAAM;AAGxB,iBAAK,SAAS,YAAY;AAAA,UAC9B,CAAC;AAAA,QACL;AAAA,MACJ,OAAO;AACH,YAAI,KAAK,SAAS,QAAQ,OAAO,GAAG;AAChC,kBAAQ,MAAM;AACV,gBAAI,CAAC,KAAK,MAAM;AACZ,mBAAK,SAAS,YAAY;AAAA,YAC9B;AAAA,UACJ,CAAC;AAAA,QACL,OAAO;AACH,kBAAQ;AAAA,QACZ;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACA,SAAO;AACX;",
6
- "names": []
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";export function OverlayPopover(o){class i extends o{async managePopoverOpen(){const e=(n=()=>{})=>{var t;(t=this.elements[0])==null||t.addEventListener("transitionend",n,{once:!0}),this.manageChildren(!1)};this.open?(await this.managePosition(),this.dialogEl.matches(":open")||(this.manageChildren(!0),requestAnimationFrame(()=>{this.dialogEl.showPopover()}))):this.dialogEl.matches(":open")?e(()=>{this.open||this.dialogEl.hidePopover()}):e()}}return i}
2
- //# sourceMappingURL=OverlayPopover.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["OverlayPopover.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 { ReactiveElement } from 'lit';\nimport { OverlayBase } from './OverlayBase.js';\n\ntype Constructor<T = Record<string, unknown>> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n prototype: T;\n};\n\nexport function OverlayPopover<T extends Constructor<OverlayBase>>(\n constructor: T\n): T & Constructor<ReactiveElement> {\n class OverlayWithPopover extends constructor {\n protected override async managePopoverOpen(): Promise<void> {\n const doClose = (\n cb = () => {\n return;\n }\n ): void => {\n this.elements[0]?.addEventListener('transitionend', cb, {\n once: true,\n });\n this.manageChildren(false);\n };\n if (this.open) {\n await this.managePosition();\n if (!this.dialogEl.matches(':open')) {\n this.manageChildren(true);\n requestAnimationFrame(() => {\n // Ensure that child content is fully \"on the DOM\" before showing the modal.\n // This allow for that content to be available to the focus algorithm of that process.\n this.dialogEl.showPopover();\n });\n }\n } else {\n if (this.dialogEl.matches(':open')) {\n doClose(() => {\n if (!this.open) {\n this.dialogEl.hidePopover();\n }\n });\n } else {\n doClose();\n }\n }\n }\n }\n return OverlayWithPopover;\n}\n"],
5
- "mappings": "aAoBO,gBAAS,eACZA,EACgC,CAChC,MAAMC,UAA2BD,CAAY,CACzC,MAAyB,mBAAmC,CACxD,MAAME,EAAU,CACZC,EAAK,IAAM,CAEX,IACO,CA7BvB,IAAAC,GA8BgBA,EAAA,KAAK,SAAS,CAAC,IAAf,MAAAA,EAAkB,iBAAiB,gBAAiBD,EAAI,CACpD,KAAM,EACV,GACA,KAAK,eAAe,EAAK,CAC7B,EACI,KAAK,MACL,MAAM,KAAK,eAAe,EACrB,KAAK,SAAS,QAAQ,OAAO,IAC9B,KAAK,eAAe,EAAI,EACxB,sBAAsB,IAAM,CAGxB,KAAK,SAAS,YAAY,CAC9B,CAAC,IAGD,KAAK,SAAS,QAAQ,OAAO,EAC7BD,EAAQ,IAAM,CACL,KAAK,MACN,KAAK,SAAS,YAAY,CAElC,CAAC,EAEDA,EAAQ,CAGpB,CACJ,CACA,OAAOD,CACX",
6
- "names": ["constructor", "OverlayWithPopover", "doClose", "cb", "_a"]
7
- }
@@ -1,24 +0,0 @@
1
- import { OverlayBase } from './OverlayBase.js';
2
- declare class OverlayStack {
3
- private get document();
4
- private root;
5
- stack: OverlayBase[];
6
- constructor();
7
- bindEvents(): void;
8
- private closeOverlay;
9
- handleClick: (event: Event) => void;
10
- handleBeforetoggle: (event: Event) => void;
11
- private handleKeydown;
12
- /**
13
- * When overlays are added manage the open state of exisiting overlays appropriately:
14
- * - 'modal': should close other overlays
15
- * - 'page': should close other overlays
16
- * - 'hint': shouldn't close other overlays
17
- * - 'auto': should close other 'auto' overlays and other 'hint' overlays, but not 'manual' overlays
18
- * - 'manual': shouldn't close other overlays
19
- */
20
- add(overlay: OverlayBase): void;
21
- remove(overlay: OverlayBase): void;
22
- }
23
- export declare const overlayStack: OverlayStack;
24
- export {};
@@ -1,113 +0,0 @@
1
- "use strict";
2
- class OverlayStack {
3
- constructor() {
4
- this.root = document.body;
5
- this.stack = [];
6
- this.handleClick = (event) => {
7
- if (!this.stack.length)
8
- return;
9
- const overlay = this.stack.at(-1);
10
- if (!overlay)
11
- return;
12
- const composedPath = event.composedPath();
13
- const shouldClose = !composedPath.find(
14
- (el) => el === overlay || el === overlay.triggerElement
15
- );
16
- if (!shouldClose)
17
- return;
18
- this.closeOverlay(overlay);
19
- let parentToClose = overlay.parentOverlayToForceClose;
20
- while (parentToClose) {
21
- this.closeOverlay(parentToClose);
22
- parentToClose = parentToClose.parentOverlayToForceClose;
23
- }
24
- };
25
- this.handleBeforetoggle = (event) => {
26
- const { target, newState: open } = event;
27
- if (open === "open")
28
- return;
29
- this.closeOverlay(target);
30
- };
31
- this.handleKeydown = (event) => {
32
- if (event.code !== "Escape")
33
- return;
34
- if (!this.stack.length)
35
- return;
36
- const last = this.stack.at(-1);
37
- if (!last)
38
- return;
39
- this.closeOverlay(last);
40
- };
41
- this.bindEvents();
42
- }
43
- get document() {
44
- return this.root.ownerDocument || document;
45
- }
46
- bindEvents() {
47
- this.document.addEventListener("pointerup", this.handleClick);
48
- this.document.addEventListener("keydown", this.handleKeydown);
49
- }
50
- closeOverlay(overlay) {
51
- const overlayIndex = this.stack.indexOf(overlay);
52
- if (overlayIndex > -1) {
53
- this.stack.splice(overlayIndex, 1);
54
- }
55
- overlay.open = false;
56
- }
57
- /**
58
- * When overlays are added manage the open state of exisiting overlays appropriately:
59
- * - 'modal': should close other overlays
60
- * - 'page': should close other overlays
61
- * - 'hint': shouldn't close other overlays
62
- * - 'auto': should close other 'auto' overlays and other 'hint' overlays, but not 'manual' overlays
63
- * - 'manual': shouldn't close other overlays
64
- */
65
- add(overlay) {
66
- if (this.stack.includes(overlay)) {
67
- const overlayIndex = this.stack.indexOf(overlay);
68
- if (overlayIndex > -1) {
69
- this.stack.splice(overlayIndex, 1);
70
- this.stack.push(overlay);
71
- }
72
- return;
73
- }
74
- if (overlay.type === "auto" || overlay.type === "modal" || overlay.type === "page") {
75
- const queryPathEventName = "sp-overlay-query-path";
76
- const queryPathEvent = new Event(queryPathEventName, {
77
- composed: true,
78
- bubbles: true
79
- });
80
- overlay.addEventListener(
81
- queryPathEventName,
82
- (event) => {
83
- const path = event.composedPath();
84
- this.stack.forEach((overlayEl) => {
85
- const inPath = path.find((el) => el === overlayEl);
86
- if (!inPath && overlayEl.type !== "manual") {
87
- this.closeOverlay(overlayEl);
88
- }
89
- });
90
- },
91
- { once: true }
92
- );
93
- overlay.dispatchEvent(queryPathEvent);
94
- } else if (overlay.type === "hint") {
95
- this.stack.forEach((overlayEl) => {
96
- if (overlayEl.type === "hint") {
97
- this.closeOverlay(overlayEl);
98
- }
99
- });
100
- }
101
- requestAnimationFrame(() => {
102
- this.stack.push(overlay);
103
- overlay.addEventListener("beforetoggle", this.handleBeforetoggle, {
104
- once: true
105
- });
106
- });
107
- }
108
- remove(overlay) {
109
- this.closeOverlay(overlay);
110
- }
111
- }
112
- export const overlayStack = new OverlayStack();
113
- //# sourceMappingURL=OverlayStack.dev.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["OverlayStack.ts"],
4
- "sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { OverlayBase } from './OverlayBase.dev.js'\n\nclass OverlayStack {\n private get document(): Document {\n return this.root.ownerDocument /* c8 ignore next */ || document;\n }\n\n private root: HTMLElement = document.body;\n\n stack: OverlayBase[] = [];\n\n constructor() {\n this.bindEvents();\n }\n\n bindEvents(): void {\n this.document.addEventListener('pointerup', this.handleClick);\n this.document.addEventListener('keydown', this.handleKeydown);\n }\n\n private closeOverlay(overlay: OverlayBase): void {\n const overlayIndex = this.stack.indexOf(overlay);\n if (overlayIndex > -1) {\n this.stack.splice(overlayIndex, 1);\n }\n overlay.open = false;\n }\n\n handleClick = (event: Event): void => {\n if (!this.stack.length) return;\n\n const overlay = this.stack.at(-1);\n if (!overlay) return;\n\n const composedPath = event.composedPath();\n const shouldClose = !composedPath.find(\n (el) => el === overlay || el === overlay.triggerElement\n );\n if (!shouldClose) return;\n\n this.closeOverlay(overlay);\n let parentToClose = overlay.parentOverlayToForceClose;\n while (parentToClose) {\n this.closeOverlay(parentToClose);\n parentToClose = parentToClose.parentOverlayToForceClose;\n }\n };\n\n handleBeforetoggle = (event: Event): void => {\n const { target, newState: open } = event as Event & {\n newState: string;\n };\n if (open === 'open') return;\n this.closeOverlay(target as OverlayBase);\n };\n\n private handleKeydown = (event: KeyboardEvent): void => {\n if (event.code !== 'Escape') return;\n if (!this.stack.length) return;\n\n const last = this.stack.at(-1);\n if (!last) return;\n this.closeOverlay(last);\n };\n\n /**\n * When overlays are added manage the open state of exisiting overlays appropriately:\n * - 'modal': should close other overlays\n * - 'page': should close other overlays\n * - 'hint': shouldn't close other overlays\n * - 'auto': should close other 'auto' overlays and other 'hint' overlays, but not 'manual' overlays\n * - 'manual': shouldn't close other overlays\n */\n add(overlay: OverlayBase): void {\n if (this.stack.includes(overlay)) {\n const overlayIndex = this.stack.indexOf(overlay);\n if (overlayIndex > -1) {\n this.stack.splice(overlayIndex, 1);\n this.stack.push(overlay);\n }\n return;\n }\n if (\n overlay.type === 'auto' ||\n overlay.type === 'modal' ||\n overlay.type === 'page'\n ) {\n // manage closing open overlays\n const queryPathEventName = 'sp-overlay-query-path';\n const queryPathEvent = new Event(queryPathEventName, {\n composed: true,\n bubbles: true,\n });\n overlay.addEventListener(\n queryPathEventName,\n (event: Event) => {\n const path = event.composedPath();\n this.stack.forEach((overlayEl) => {\n const inPath = path.find((el) => el === overlayEl);\n if (!inPath && overlayEl.type !== 'manual') {\n this.closeOverlay(overlayEl);\n }\n });\n },\n { once: true }\n );\n overlay.dispatchEvent(queryPathEvent);\n } else if (overlay.type === 'hint') {\n this.stack.forEach((overlayEl) => {\n if (overlayEl.type === 'hint') {\n this.closeOverlay(overlayEl);\n }\n });\n }\n requestAnimationFrame(() => {\n this.stack.push(overlay);\n overlay.addEventListener('beforetoggle', this.handleBeforetoggle, {\n once: true,\n });\n });\n }\n\n remove(overlay: OverlayBase): void {\n this.closeOverlay(overlay);\n }\n}\n\nexport const overlayStack = new OverlayStack();\n"],
5
- "mappings": ";AAaA,MAAM,aAAa;AAAA,EASf,cAAc;AAJd,SAAQ,OAAoB,SAAS;AAErC,iBAAuB,CAAC;AAmBxB,uBAAc,CAAC,UAAuB;AAClC,UAAI,CAAC,KAAK,MAAM;AAAQ;AAExB,YAAM,UAAU,KAAK,MAAM,GAAG,EAAE;AAChC,UAAI,CAAC;AAAS;AAEd,YAAM,eAAe,MAAM,aAAa;AACxC,YAAM,cAAc,CAAC,aAAa;AAAA,QAC9B,CAAC,OAAO,OAAO,WAAW,OAAO,QAAQ;AAAA,MAC7C;AACA,UAAI,CAAC;AAAa;AAElB,WAAK,aAAa,OAAO;AACzB,UAAI,gBAAgB,QAAQ;AAC5B,aAAO,eAAe;AAClB,aAAK,aA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A,QACV,SAAS;AAAA,MACb,CAAC;AACD,cAAQ;AAAA,QACJ;AAAA,QACA,CAAC,UAAiB;AACd,gBAAM,OAAO,MAAM,aAAa;AAChC,eAAK,MAAM,QAAQ,CAAC,cAAc;AAC9B,kBAAM,SAAS,KAAK,KAAK,CAAC,OAAO,OAAO,SAAS;AACjD,gBAAI,CAAC,UAAU,UAAU,SAAS,UAAU;AACxC,mBAAK,aAAa,SAAS;AAAA,YAC/B;AAAA,UACJ,CAAC;AAAA,QACL;AAAA,QACA,EAAE,MAAM,KAAK;AAAA,MACjB;AACA,cAAQ,cAAc,cAAc;AAAA,IACxC,WAAW,QAAQ,SAAS,QAAQ;AAChC,WAAK,MAAM,QAAQ,CAAC,cAAc;AAC9B,YAAI,UAAU,SAAS,QAAQ;AAC3B,eAAK,aAAa,SAAS;AAAA,QAC/B;AAAA,MACJ,CAAC;AAAA,IACL;AACA,0BAAsB,MAAM;AACxB,WAAK,MAAM,KAAK,OAAO;AACvB,cAAQ,iBAAiB,gBAAgB,KAAK,oBAAoB;AAAA,QAC9D,MAAM;AAAA,MACV,CAAC;AAAA,IACL,CAAC;AAAA,EACL;AAAA,EAEA,OAAO,SAA4B;AAC/B,SAAK,aAAa,OAAO;AAAA,EAC7B;AACJ;AAEO,aAAM,eAAe,IAAI,aAAa;",
6
- "names": []
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";class r{constructor(){this.root=document.body;this.stack=[];this.handleClick=e=>{if(!this.stack.length)return;const t=this.stack.at(-1);if(!t||!!e.composedPath().find(n=>n===t||n===t.triggerElement))return;this.closeOverlay(t);let s=t.parentOverlayToForceClose;for(;s;)this.closeOverlay(s),s=s.parentOverlayToForceClose};this.handleBeforetoggle=e=>{const{target:t,newState:a}=e;a!=="open"&&this.closeOverlay(t)};this.handleKeydown=e=>{if(e.code!=="Escape"||!this.stack.length)return;const t=this.stack.at(-1);t&&this.closeOverlay(t)};this.bindEvents()}get document(){return this.root.ownerDocument||document}bindEvents(){this.document.addEventListener("pointerup",this.handleClick),this.document.addEventListener("keydown",this.handleKeydown)}closeOverlay(e){const t=this.stack.indexOf(e);t>-1&&this.stack.splice(t,1),e.open=!1}add(e){if(this.stack.includes(e)){const t=this.stack.indexOf(e);t>-1&&(this.stack.splice(t,1),this.stack.push(e));return}if(e.type==="auto"||e.type==="modal"||e.type==="page"){const t="sp-overlay-query-path",a=new Event(t,{composed:!0,bubbles:!0});e.addEventListener(t,o=>{const s=o.composedPath();this.stack.forEach(n=>{!s.find(i=>i===n)&&n.type!=="manual"&&this.closeOverlay(n)})},{once:!0}),e.dispatchEvent(a)}else e.type==="hint"&&this.stack.forEach(t=>{t.type==="hint"&&this.closeOverlay(t)});requestAnimationFrame(()=>{this.stack.push(e),e.addEventListener("beforetoggle",this.handleBeforetoggle,{once:!0})})}remove(e){this.closeOverlay(e)}}export const overlayStack=new r;
2
- //# sourceMappingURL=OverlayStack.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["OverlayStack.ts"],
4
- "sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { OverlayBase } from './OverlayBase.js';\n\nclass OverlayStack {\n private get document(): Document {\n return this.root.ownerDocument /* c8 ignore next */ || document;\n }\n\n private root: HTMLElement = document.body;\n\n stack: OverlayBase[] = [];\n\n constructor() {\n this.bindEvents();\n }\n\n bindEvents(): void {\n this.document.addEventListener('pointerup', this.handleClick);\n this.document.addEventListener('keydown', this.handleKeydown);\n }\n\n private closeOverlay(overlay: OverlayBase): void {\n const overlayIndex = this.stack.indexOf(overlay);\n if (overlayIndex > -1) {\n this.stack.splice(overlayIndex, 1);\n }\n overlay.open = false;\n }\n\n handleClick = (event: Event): void => {\n if (!this.stack.length) return;\n\n const overlay = this.stack.at(-1);\n if (!overlay) return;\n\n const composedPath = event.composedPath();\n const shouldClose = !composedPath.find(\n (el) => el === overlay || el === overlay.triggerElement\n );\n if (!shouldClose) return;\n\n this.closeOverlay(overlay);\n let parentToClose = overlay.parentOverlayToForceClose;\n while (parentToClose) {\n this.closeOverlay(parentToClose);\n parentToClose = parentToClose.parentOverlayToForceClose;\n }\n };\n\n handleBeforetoggle = (event: Event): void => {\n const { target, newState: open } = event as Event & {\n newState: string;\n };\n if (open === 'open') return;\n this.closeOverlay(target as OverlayBase);\n };\n\n private handleKeydown = (event: KeyboardEvent): void => {\n if (event.code !== 'Escape') return;\n if (!this.stack.length) return;\n\n const last = this.stack.at(-1);\n if (!last) return;\n this.closeOverlay(last);\n };\n\n /**\n * When overlays are added manage the open state of exisiting overlays appropriately:\n * - 'modal': should close other overlays\n * - 'page': should close other overlays\n * - 'hint': shouldn't close other overlays\n * - 'auto': should close other 'auto' overlays and other 'hint' overlays, but not 'manual' overlays\n * - 'manual': shouldn't close other overlays\n */\n add(overlay: OverlayBase): void {\n if (this.stack.includes(overlay)) {\n const overlayIndex = this.stack.indexOf(overlay);\n if (overlayIndex > -1) {\n this.stack.splice(overlayIndex, 1);\n this.stack.push(overlay);\n }\n return;\n }\n if (\n overlay.type === 'auto' ||\n overlay.type === 'modal' ||\n overlay.type === 'page'\n ) {\n // manage closing open overlays\n const queryPathEventName = 'sp-overlay-query-path';\n const queryPathEvent = new Event(queryPathEventName, {\n composed: true,\n bubbles: true,\n });\n overlay.addEventListener(\n queryPathEventName,\n (event: Event) => {\n const path = event.composedPath();\n this.stack.forEach((overlayEl) => {\n const inPath = path.find((el) => el === overlayEl);\n if (!inPath && overlayEl.type !== 'manual') {\n this.closeOverlay(overlayEl);\n }\n });\n },\n { once: true }\n );\n overlay.dispatchEvent(queryPathEvent);\n } else if (overlay.type === 'hint') {\n this.stack.forEach((overlayEl) => {\n if (overlayEl.type === 'hint') {\n this.closeOverlay(overlayEl);\n }\n });\n }\n requestAnimationFrame(() => {\n this.stack.push(overlay);\n overlay.addEventListener('beforetoggle', this.handleBeforetoggle, {\n once: true,\n });\n });\n }\n\n remove(overlay: OverlayBase): void {\n this.closeOverlay(overlay);\n }\n}\n\nexport const overlayStack = new OverlayStack();\n"],
5
- "mappings": "aAaA,MAAMA,CAAa,CASf,aAAc,CAJd,KAAQ,KAAoB,SAAS,KAErC,WAAuB,CAAC,EAmBxB,iBAAeC,GAAuB,CAClC,GAAI,CAAC,KAAK,MAAM,OAAQ,OAExB,MAAMC,EAAU,KAAK,MAAM,GAAG,EAAE,EAOhC,GANI,CAACA,GAMD,CAHgB,CADCD,EAAM,aAAa,EACN,KAC7BE,GAAOA,IAAOD,GAAWC,IAAOD,EAAQ,cAC7C,EACkB,OAElB,KAAK,aAAaA,CAAO,EACzB,IAAIE,EAAgBF,EAAQ,0BAC5B,KAAOE,GACH,KAAK,aAAaA,CAAa,EAC/BA,EAAgBA,EAAc,yBAEtC,EAEA,wBAAsBH,GAAuB,CACzC,KAAM,CAAE,OAAAI,EAAQ,SAAUC,CAAK,EAAIL,EAG/BK,IAAS,QACb,KAAK,aAAaD,CAAqB,CAC3C,EAEA,KAAQ,cAAiBJ,GAA+B,CAEpD,GADIA,EAAM,OAAS,UACf,CAAC,KAAK,MAAM,OAAQ,OAExB,MAAMM,EAAO,KAAK,MAAM,GAAG,EAAE,EACxBA,GACL,KAAK,aAAaA,CAAI,CAC1B,EAnDI,KAAK,WAAW,CACpB,CAVA,IAAY,UAAqB,CAC7B,OAAO,KAAK,KAAK,eAAsC,QAC3D,CAUA,YAAmB,CACf,KAAK,SAAS,iBAAiB,YAAa,KAAK,WAAW,EAC5D,KAAK,SAAS,iBAAiB,UAAW,KAAK,aAAa,CAChE,CAEQ,aAAaL,EAA4B,CAC7C,MAAMM,EAAe,KAAK,MAAM,QAAQN,CAAO,EAC3CM,EAAe,IACf,KAAK,MAAM,OAAOA,EAAc,CAAC,EAErCN,EAAQ,KAAO,EACnB,CA+CA,IAAIA,EAA4B,CAC5B,GAAI,KAAK,MAAM,SAASA,CAAO,EAAG,CAC9B,MAAMM,EAAe,KAAK,MAAM,QAAQN,CAAO,EAC3CM,EAAe,KACf,KAAK,MAAM,OAAOA,EAAc,CAAC,EACjC,KAAK,MAAM,KAAKN,CAAO,GAE3B,MACJ,CACA,GACIA,EAAQ,OAAS,QACjBA,EAAQ,OAAS,SACjBA,EAAQ,OAAS,OACnB,CAEE,MAAMO,EAAqB,wBACrBC,EAAiB,IAAI,MAAMD,EAAoB,CACjD,SAAU,GACV,QAAS,EACb,CAAC,EACDP,EAAQ,iBACJO,EACCR,GAAiB,CACd,MAAMU,EAAOV,EAAM,aAAa,EAChC,KAAK,MAAM,QAASW,GAAc,CAE1B,CADWD,EAAK,KAAMR,GAAOA,IAAOS,CAAS,GAClCA,EAAU,OAAS,UAC9B,KAAK,aAAaA,CAAS,CAEnC,CAAC,CACL,EACA,CAAE,KAAM,EAAK,CACjB,EACAV,EAAQ,cAAcQ,CAAc,CACxC,MAAWR,EAAQ,OAAS,QACxB,KAAK,MAAM,QAASU,GAAc,CAC1BA,EAAU,OAAS,QACnB,KAAK,aAAaA,CAAS,CAEnC,CAAC,EAEL,sBAAsB,IAAM,CACxB,KAAK,MAAM,KAAKV,CAAO,EACvBA,EAAQ,iBAAiB,eAAgB,KAAK,mBAAoB,CAC9D,KAAM,EACV,CAAC,CACL,CAAC,CACL,CAEA,OAAOA,EAA4B,CAC/B,KAAK,aAAaA,CAAO,CAC7B,CACJ,CAEO,aAAM,aAAe,IAAIF",
6
- "names": ["OverlayStack", "event", "overlay", "el", "parentToClose", "target", "open", "last", "overlayIndex", "queryPathEventName", "queryPathEvent", "path", "overlayEl"]
7
- }
@@ -1,35 +0,0 @@
1
- import type { ReactiveController, ReactiveElement } from 'lit';
2
- import { Placement } from '@floating-ui/dom';
3
- import type { VirtualTrigger } from './VirtualTrigger.js';
4
- import type { OpenableElement } from './OverlayBase.js';
5
- declare type OverlayOptions = {
6
- abortPromise?: Promise<boolean>;
7
- delayed?: boolean;
8
- offset?: number | [number, number];
9
- placement: Placement;
10
- notImmediatelyClosable?: boolean;
11
- receivesFocus?: 'auto';
12
- root?: HTMLElement;
13
- trigger: HTMLElement | VirtualTrigger;
14
- type?: 'modal' | 'page' | 'hint' | 'auto' | 'manual';
15
- };
16
- export declare const placementUpdatedSymbol: unique symbol;
17
- export declare class PlacementController implements ReactiveController {
18
- private cleanup?;
19
- initialHeight?: number;
20
- isConstrained?: boolean;
21
- private host;
22
- private options;
23
- private target;
24
- constructor(host: ReactiveElement & {
25
- elements: OpenableElement[];
26
- });
27
- placeOverlay(target?: HTMLElement, options?: OverlayOptions): Promise<void>;
28
- updatePlacement: () => void;
29
- computePlacement(): Promise<void>;
30
- resetOverlayPosition: () => void;
31
- hostConnected(): void;
32
- hostUpdated(): void;
33
- hostDisconnected(): void;
34
- }
35
- export {};