@spectrum-web-components/overlay 0.36.0 → 0.37.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.
- package/README.md +266 -149
- package/custom-elements.json +1678 -553
- package/package.json +49 -22
- package/sp-overlay.d.ts +6 -0
- package/sp-overlay.dev.js +5 -0
- package/{active-overlay.dev.js.map → sp-overlay.dev.js.map} +3 -3
- package/sp-overlay.js +2 -0
- package/{active-overlay.js.map → sp-overlay.js.map} +4 -4
- package/src/AbstractOverlay.d.ts +58 -0
- package/src/AbstractOverlay.dev.js +211 -0
- package/src/AbstractOverlay.dev.js.map +7 -0
- package/src/AbstractOverlay.js +2 -0
- package/src/AbstractOverlay.js.map +7 -0
- package/src/Overlay.d.ts +163 -0
- package/src/Overlay.dev.js +792 -0
- package/src/Overlay.dev.js.map +7 -0
- package/src/Overlay.js +33 -0
- package/src/Overlay.js.map +7 -0
- package/src/OverlayDialog.d.ts +4 -0
- package/src/OverlayDialog.dev.js +135 -0
- package/src/OverlayDialog.dev.js.map +7 -0
- package/src/OverlayDialog.js +2 -0
- package/src/OverlayDialog.js.map +7 -0
- package/src/OverlayNoPopover.d.ts +4 -0
- package/src/OverlayNoPopover.dev.js +109 -0
- package/src/OverlayNoPopover.dev.js.map +7 -0
- package/src/OverlayNoPopover.js +2 -0
- package/src/OverlayNoPopover.js.map +7 -0
- package/src/OverlayPopover.d.ts +4 -0
- package/src/OverlayPopover.dev.js +169 -0
- package/src/OverlayPopover.dev.js.map +7 -0
- package/src/OverlayPopover.js +2 -0
- package/src/OverlayPopover.js.map +7 -0
- package/src/OverlayStack.d.ts +43 -0
- package/src/OverlayStack.dev.js +150 -0
- package/src/OverlayStack.dev.js.map +7 -0
- package/src/OverlayStack.js +2 -0
- package/src/OverlayStack.js.map +7 -0
- package/src/OverlayTrigger.d.ts +26 -42
- package/src/OverlayTrigger.dev.js +172 -296
- package/src/OverlayTrigger.dev.js.map +3 -3
- package/src/OverlayTrigger.js +49 -25
- package/src/OverlayTrigger.js.map +3 -3
- package/src/PlacementController.d.ts +38 -0
- package/src/PlacementController.dev.js +199 -0
- package/src/PlacementController.dev.js.map +7 -0
- package/src/PlacementController.js +2 -0
- package/src/PlacementController.js.map +7 -0
- package/src/VirtualTrigger.dev.js +2 -1
- package/src/VirtualTrigger.dev.js.map +2 -2
- package/src/VirtualTrigger.js +1 -1
- package/src/VirtualTrigger.js.map +2 -2
- package/src/fullSizePlugin.d.ts +12 -0
- package/src/fullSizePlugin.dev.js +39 -0
- package/src/fullSizePlugin.dev.js.map +7 -0
- package/src/fullSizePlugin.js +2 -0
- package/src/fullSizePlugin.js.map +7 -0
- package/src/index.d.ts +2 -3
- package/src/index.dev.js +2 -3
- package/src/index.dev.js.map +2 -2
- package/src/index.js +1 -1
- package/src/index.js.map +2 -2
- package/src/loader.d.ts +1 -2
- package/src/loader.dev.js +2 -19
- package/src/loader.dev.js.map +2 -2
- package/src/loader.js +1 -1
- package/src/loader.js.map +3 -3
- package/src/overlay-timer.dev.js.map +2 -2
- package/src/overlay-timer.js.map +2 -2
- package/src/overlay-trigger.css.dev.js +1 -1
- package/src/overlay-trigger.css.dev.js.map +1 -1
- package/src/overlay-trigger.css.js +3 -3
- package/src/overlay-trigger.css.js.map +1 -1
- package/src/overlay-types.d.ts +25 -31
- package/src/overlay-types.dev.js +1 -0
- package/src/overlay-types.dev.js.map +3 -3
- package/src/overlay-types.js +1 -1
- package/src/overlay-types.js.map +3 -3
- package/src/overlay.css.dev.js +9 -0
- package/src/overlay.css.dev.js.map +7 -0
- package/src/overlay.css.js +6 -0
- package/src/overlay.css.js.map +7 -0
- package/src/topLayerOverTransforms.d.ts +2 -0
- package/src/topLayerOverTransforms.dev.js +91 -0
- package/src/topLayerOverTransforms.dev.js.map +7 -0
- package/src/topLayerOverTransforms.js +2 -0
- package/src/topLayerOverTransforms.js.map +7 -0
- package/stories/overlay-element.stories.js +476 -0
- package/stories/overlay-element.stories.js.map +7 -0
- package/stories/overlay-story-components.js +9 -8
- package/stories/overlay-story-components.js.map +2 -2
- package/stories/overlay.stories.js +824 -680
- package/stories/overlay.stories.js.map +2 -2
- package/sync/overlay-trigger.d.ts +5 -0
- package/sync/overlay-trigger.dev.js +2 -4
- package/sync/overlay-trigger.dev.js.map +2 -2
- package/sync/overlay-trigger.js +1 -1
- package/sync/overlay-trigger.js.map +3 -3
- package/test/benchmark/basic-test.js +2 -2
- package/test/benchmark/basic-test.js.map +1 -1
- package/test/index.js +414 -377
- package/test/index.js.map +3 -3
- package/test/overlay-element.test-vrt.js +5 -0
- package/test/overlay-element.test-vrt.js.map +7 -0
- package/test/overlay-element.test.js +682 -0
- package/test/overlay-element.test.js.map +7 -0
- package/test/overlay-lifecycle.test.js +36 -106
- package/test/overlay-lifecycle.test.js.map +2 -2
- package/test/overlay-trigger-click.test.js +11 -5
- package/test/overlay-trigger-click.test.js.map +2 -2
- package/test/overlay-trigger-extended.test.js +46 -36
- package/test/overlay-trigger-extended.test.js.map +2 -2
- package/test/overlay-trigger-hover-click.test.js +38 -25
- package/test/overlay-trigger-hover-click.test.js.map +2 -2
- package/test/overlay-trigger-hover.test.js +41 -35
- package/test/overlay-trigger-hover.test.js.map +2 -2
- package/test/overlay-trigger-longpress.test.js +211 -82
- package/test/overlay-trigger-longpress.test.js.map +2 -2
- package/test/overlay-trigger-sync.test.js +1 -1
- package/test/overlay-trigger-sync.test.js.map +2 -2
- package/test/overlay-trigger.test.js +1 -1
- package/test/overlay-trigger.test.js.map +2 -2
- package/test/overlay-update.test.js +5 -5
- package/test/overlay-update.test.js.map +2 -2
- package/test/overlay-v1.test.js +547 -0
- package/test/overlay-v1.test.js.map +7 -0
- package/test/overlay.test.js +385 -269
- package/test/overlay.test.js.map +3 -3
- package/active-overlay.d.ts +0 -6
- package/active-overlay.dev.js +0 -5
- package/active-overlay.js +0 -2
- package/src/ActiveOverlay.d.ts +0 -84
- package/src/ActiveOverlay.dev.js +0 -517
- package/src/ActiveOverlay.dev.js.map +0 -7
- package/src/ActiveOverlay.js +0 -16
- package/src/ActiveOverlay.js.map +0 -7
- package/src/active-overlay.css.dev.js +0 -13
- package/src/active-overlay.css.dev.js.map +0 -7
- package/src/active-overlay.css.js +0 -10
- package/src/active-overlay.css.js.map +0 -7
- package/src/overlay-stack.d.ts +0 -50
- package/src/overlay-stack.dev.js +0 -515
- package/src/overlay-stack.dev.js.map +0 -7
- package/src/overlay-stack.js +0 -34
- package/src/overlay-stack.js.map +0 -7
- package/src/overlay-utils.d.ts +0 -3
- package/src/overlay-utils.dev.js +0 -31
- package/src/overlay-utils.dev.js.map +0 -7
- package/src/overlay-utils.js +0 -2
- package/src/overlay-utils.js.map +0 -7
- package/src/overlay.d.ts +0 -59
- package/src/overlay.dev.js +0 -127
- package/src/overlay.dev.js.map +0 -7
- package/src/overlay.js +0 -2
- package/src/overlay.js.map +0 -7
- /package/src/{active-overlay.css.d.ts → overlay.css.d.ts} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";import{arrow as O,autoUpdate as w,computePosition as H,flip as y,offset as M,shift as T,size as C}from"@floating-ui/dom";import{topLayerOverTransforms as R}from"./topLayerOverTransforms.js";function p(o){if(typeof o=="undefined")return 0;const t=window.devicePixelRatio||1;return Math.round(o*t)/t}const m=8,L=100,A=o=>{var e;return(e={left:["right","bottom","top"],"left-start":["right-start","bottom","top"],"left-end":["right-end","bottom","top"],right:["left","bottom","top"],"right-start":["left-start","bottom","top"],"right-end":["left-end","bottom","top"],top:["bottom","left","right"],"top-start":["bottom-start","left","right"],"top-end":["bottom-end","left","right"],bottom:["top","left","right"],"bottom-start":["top-start","left","right"],"bottom-end":["top-end","left","right"]}[o])!=null?e:[o]};export const placementUpdatedSymbol=Symbol("placement updated");export class PlacementController{constructor(t){this.originalPlacements=new WeakMap;this.allowPlacementUpdate=!1;this.updatePlacement=()=>{if(!this.allowPlacementUpdate&&this.options.type!=="modal"&&this.cleanup){this.target.dispatchEvent(new Event("close",{bubbles:!0}));return}this.computePlacement(),this.allowPlacementUpdate=!1};this.resetOverlayPosition=()=>{!this.target||!this.options||(this.target.style.removeProperty("max-height"),this.target.style.removeProperty("height"),this.initialHeight=void 0,this.isConstrained=!1,this.host.offsetHeight,this.computePlacement())};this.host=t,this.host.addController(this)}async placeOverlay(t=this.target,e=this.options){if(this.target=t,this.options=e,!t||!e)return;const c=w(e.trigger,t,this.updatePlacement,{elementResize:!1,layoutShift:!1});this.cleanup=()=>{var r;(r=this.host.elements)==null||r.forEach(s=>{s.addEventListener("sp-closed",()=>{const a=this.originalPlacements.get(s);a&&s.setAttribute("placement",a),this.originalPlacements.delete(s)},{once:!0})}),c()}}async computePlacement(){var f,g;const{options:t,target:e}=this;await(document.fonts?document.fonts.ready:Promise.resolve());const c=t.trigger instanceof HTMLElement?y():y({padding:m,fallbackPlacements:A(t.placement)}),[r=0,s=0]=Array.isArray(t==null?void 0:t.offset)?t.offset:[t.offset,0],a=(f=this.host.elements.find(i=>i.tipElement))==null?void 0:f.tipElement,v=[M({mainAxis:r,crossAxis:s}),T({padding:m}),c,C({padding:m,apply:({availableWidth:i,availableHeight:h,rects:{floating:x}})=>{const u=Math.max(L,Math.floor(h)),l=x.height;this.initialHeight=this.isConstrained&&this.initialHeight||l,this.isConstrained=l<this.initialHeight||u<=l;const b=this.isConstrained?`${u}px`:"";Object.assign(e.style,{maxWidth:`${Math.floor(i)}px`,maxHeight:b,height:b})}}),...a?[O({element:a,padding:t.tipPadding||m})]:[],R()],{x:P,y:E,placement:n,middlewareData:d}=await H(t.trigger,e,{placement:t.placement,middleware:v,strategy:"fixed"});if(Object.assign(e.style,{top:"0px",left:"0px",translate:`${p(P)}px ${p(E)}px`}),e.setAttribute("actual-placement",n),(g=this.host.elements)==null||g.forEach(i=>{this.originalPlacements.set(i,i.getAttribute("placement")),i.setAttribute("placement",n)}),a&&d.arrow){const{x:i,y:h}=d.arrow;Object.assign(a.style,{top:n.startsWith("right")||n.startsWith("left")?"0px":"",left:n.startsWith("bottom")||n.startsWith("top")?"0px":"",translate:`${p(i)}px ${p(h)}px`})}}hostConnected(){document.addEventListener("sp-update-overlays",this.resetOverlayPosition)}hostUpdated(){var t;this.host.open||((t=this.cleanup)==null||t.call(this),this.cleanup=void 0)}hostDisconnected(){var t;(t=this.cleanup)==null||t.call(this),this.cleanup=void 0,document.removeEventListener("sp-update-overlays",this.resetOverlayPosition)}}
|
|
2
|
+
//# sourceMappingURL=PlacementController.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["PlacementController.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport type {\n ReactiveController,\n ReactiveElement,\n} from '@spectrum-web-components/base';\nimport {\n arrow,\n autoUpdate,\n computePosition,\n flip,\n offset,\n Placement,\n shift,\n size,\n} from '@floating-ui/dom';\nimport type { VirtualTrigger } from './VirtualTrigger.js';\nimport { topLayerOverTransforms } from './topLayerOverTransforms.js';\nimport type { OpenableElement } from './overlay-types.js';\nimport type { Overlay } from './Overlay.js';\n\ntype OverlayOptionsV1 = {\n abortPromise?: Promise<boolean>;\n delayed?: boolean;\n offset?: number | [number, number]; // supporting multi-axis\n placement: Placement;\n notImmediatelyClosable?: boolean; // rename or place behind other API options\n receivesFocus?: 'auto';\n root?: HTMLElement;\n tipPadding?: number;\n trigger: HTMLElement | VirtualTrigger;\n type?: 'modal' | 'page' | 'hint' | 'auto' | 'manual';\n};\n\nfunction roundByDPR(num?: number): number {\n if (typeof num === 'undefined') return 0;\n const dpr = window.devicePixelRatio || 1;\n return Math.round(num * dpr) / dpr ?? -10000;\n}\n\n// See: https://spectrum.adobe.com/page/popover/#Container-padding\nconst REQUIRED_DISTANCE_TO_EDGE = 8;\n// See: https://github.com/adobe/spectrum-web-components/issues/910\nconst MIN_OVERLAY_HEIGHT = 100;\n\nconst getFallbackPlacements = (placement: Placement): Placement[] => {\n const fallbacks: Record<Placement, Placement[]> = {\n left: ['right', 'bottom', 'top'],\n 'left-start': ['right-start', 'bottom', 'top'],\n 'left-end': ['right-end', 'bottom', 'top'],\n right: ['left', 'bottom', 'top'],\n 'right-start': ['left-start', 'bottom', 'top'],\n 'right-end': ['left-end', 'bottom', 'top'],\n top: ['bottom', 'left', 'right'],\n 'top-start': ['bottom-start', 'left', 'right'],\n 'top-end': ['bottom-end', 'left', 'right'],\n bottom: ['top', 'left', 'right'],\n 'bottom-start': ['top-start', 'left', 'right'],\n 'bottom-end': ['top-end', 'left', 'right'],\n };\n return fallbacks[placement] ?? [placement];\n};\n\nexport const placementUpdatedSymbol = Symbol('placement updated');\n\nexport class PlacementController implements ReactiveController {\n private cleanup?: () => void;\n\n initialHeight?: number;\n\n isConstrained?: boolean;\n\n private host!: ReactiveElement & { elements: OpenableElement[] };\n\n private options!: OverlayOptionsV1;\n\n private originalPlacements = new WeakMap<HTMLElement, Placement>();\n\n private target!: HTMLElement;\n\n constructor(host: ReactiveElement & { elements: OpenableElement[] }) {\n this.host = host;\n // Add the controller after the MutationObserver has been created in preparation\n // for the `hostConnected`/`hostDisconnected` callbacks to be run.\n this.host.addController(this);\n }\n\n public async placeOverlay(\n target: HTMLElement = this.target,\n options: OverlayOptionsV1 = this.options\n ): Promise<void> {\n this.target = target;\n this.options = options;\n if (!target || !options) return;\n\n const cleanup = autoUpdate(\n options.trigger,\n target,\n this.updatePlacement,\n {\n elementResize: false,\n layoutShift: false,\n }\n );\n this.cleanup = () => {\n this.host.elements?.forEach((element) => {\n element.addEventListener(\n 'sp-closed',\n () => {\n const placement = this.originalPlacements.get(element);\n if (placement) {\n element.setAttribute('placement', placement);\n }\n this.originalPlacements.delete(element);\n },\n { once: true }\n );\n });\n cleanup();\n };\n }\n\n allowPlacementUpdate = false;\n\n updatePlacement = (): void => {\n if (\n !this.allowPlacementUpdate &&\n this.options.type !== 'modal' &&\n this.cleanup\n ) {\n this.target.dispatchEvent(new Event('close', { bubbles: true }));\n return;\n }\n this.computePlacement();\n this.allowPlacementUpdate = false;\n };\n\n async computePlacement(): Promise<void> {\n const { options, target } = this;\n\n await (document.fonts ? document.fonts.ready : Promise.resolve());\n\n const flipMiddleware = !(options.trigger instanceof HTMLElement)\n ? flip({\n padding: REQUIRED_DISTANCE_TO_EDGE,\n fallbackPlacements: getFallbackPlacements(options.placement),\n })\n : flip();\n\n const [mainAxis = 0, crossAxis = 0] = Array.isArray(options?.offset)\n ? options.offset\n : [options.offset, 0];\n\n const tipElement = this.host.elements.find(\n (el) => el.tipElement\n )?.tipElement;\n\n const middleware = [\n offset({\n mainAxis,\n crossAxis,\n }),\n shift({ padding: REQUIRED_DISTANCE_TO_EDGE }),\n flipMiddleware,\n size({\n padding: REQUIRED_DISTANCE_TO_EDGE,\n apply: ({\n availableWidth,\n availableHeight,\n rects: { floating },\n }) => {\n const maxHeight = Math.max(\n MIN_OVERLAY_HEIGHT,\n Math.floor(availableHeight)\n );\n const actualHeight = floating.height;\n this.initialHeight = !this.isConstrained // && !this.virtualTrigger\n ? actualHeight\n : this.initialHeight || actualHeight;\n this.isConstrained =\n actualHeight < this.initialHeight ||\n maxHeight <= actualHeight;\n const appliedHeight = this.isConstrained\n ? `${maxHeight}px`\n : '';\n Object.assign(target.style, {\n maxWidth: `${Math.floor(availableWidth)}px`,\n maxHeight: appliedHeight,\n height: appliedHeight,\n });\n },\n }),\n ...(tipElement\n ? [\n arrow({\n element: tipElement,\n padding:\n options.tipPadding || REQUIRED_DISTANCE_TO_EDGE,\n }),\n ]\n : []),\n topLayerOverTransforms(),\n ];\n const { x, y, placement, middlewareData } = await computePosition(\n options.trigger,\n target,\n {\n placement: options.placement,\n middleware,\n strategy: 'fixed',\n }\n );\n Object.assign(target.style, {\n top: '0px',\n left: '0px',\n translate: `${roundByDPR(x)}px ${roundByDPR(y)}px`,\n });\n\n target.setAttribute('actual-placement', placement);\n this.host.elements?.forEach((element) => {\n this.originalPlacements.set(\n element,\n element.getAttribute('placement') as Placement\n );\n element.setAttribute('placement', placement);\n });\n\n if (tipElement && middlewareData.arrow) {\n const { x: arrowX, y: arrowY } = middlewareData.arrow;\n\n Object.assign(tipElement.style, {\n top:\n placement.startsWith('right') ||\n placement.startsWith('left')\n ? '0px'\n : '',\n left:\n placement.startsWith('bottom') ||\n placement.startsWith('top')\n ? '0px'\n : '',\n translate: `${roundByDPR(arrowX)}px ${roundByDPR(arrowY)}px`,\n });\n }\n }\n\n public resetOverlayPosition = (): void => {\n if (!this.target || !this.options) return;\n\n this.target.style.removeProperty('max-height');\n this.target.style.removeProperty('height');\n this.initialHeight = undefined;\n this.isConstrained = false;\n // force paint\n this.host.offsetHeight;\n this.computePlacement();\n };\n\n hostConnected(): void {\n document.addEventListener(\n 'sp-update-overlays',\n this.resetOverlayPosition\n );\n }\n\n hostUpdated(): void {\n if (!(this.host as Overlay).open) {\n this.cleanup?.();\n this.cleanup = undefined;\n }\n }\n\n hostDisconnected(): void {\n this.cleanup?.();\n this.cleanup = undefined;\n document.removeEventListener(\n 'sp-update-overlays',\n this.resetOverlayPosition\n );\n }\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["arrow", "autoUpdate", "computePosition", "flip", "offset", "shift", "size", "topLayerOverTransforms", "roundByDPR", "num", "dpr", "REQUIRED_DISTANCE_TO_EDGE", "MIN_OVERLAY_HEIGHT", "getFallbackPlacements", "placement", "_a", "host", "target", "options", "cleanup", "element", "_b", "flipMiddleware", "mainAxis", "crossAxis", "tipElement", "el", "middleware", "availableWidth", "availableHeight", "floating", "maxHeight", "actualHeight", "appliedHeight", "x", "y", "middlewareData", "arrowX", "arrowY"]
|
|
7
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import { Overlay } from "./
|
|
2
|
+
import { Overlay } from "./Overlay.dev.js";
|
|
3
3
|
export class VirtualTrigger {
|
|
4
4
|
constructor(x, y) {
|
|
5
5
|
this.x = 0;
|
|
@@ -22,6 +22,7 @@ export class VirtualTrigger {
|
|
|
22
22
|
x: this.x,
|
|
23
23
|
bottom: this.y,
|
|
24
24
|
left: this.x,
|
|
25
|
+
/* c8 ignore next 3 */
|
|
25
26
|
toJSON() {
|
|
26
27
|
return;
|
|
27
28
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["VirtualTrigger.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\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { Overlay } from './
|
|
5
|
-
"mappings": ";AAWA,SAAS,eAAe;AAEjB,aAAM,eAAe;AAAA,EAIjB,YAAY,GAAW,GAAW;AAHzC,SAAQ,IAAI;AACZ,SAAQ,IAAI;AAGR,SAAK,IAAI;AACT,SAAK,IAAI;AAAA,EACb;AAAA,EAEO,yBAAyB,GAAW,GAAiB;AACxD,SAAK,IAAI;AACT,SAAK,IAAI;AACT,YAAQ,OAAO;AAAA,EACnB;AAAA,EAEO,wBAAiC;AACpC,WAAO;AAAA,MACH,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,KAAK,KAAK;AAAA,MACV,OAAO,KAAK;AAAA,MACZ,GAAG,KAAK;AAAA,MACR,GAAG,KAAK;AAAA,MACR,QAAQ,KAAK;AAAA,MACb,MAAM,KAAK;AAAA,
|
|
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\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { Overlay } from './Overlay.dev.js'\n\nexport class VirtualTrigger {\n private x = 0;\n private y = 0;\n\n public constructor(x: number, y: number) {\n this.x = x;\n this.y = y;\n }\n\n public updateBoundingClientRect(x: number, y: number): void {\n this.x = x;\n this.y = y;\n Overlay.update();\n }\n\n public getBoundingClientRect(): DOMRect {\n return {\n width: 0,\n height: 0,\n top: this.y,\n right: this.x,\n y: this.y,\n x: this.x,\n bottom: this.y,\n left: this.x,\n /* c8 ignore next 3 */\n toJSON() {\n return;\n },\n };\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,eAAe;AAEjB,aAAM,eAAe;AAAA,EAIjB,YAAY,GAAW,GAAW;AAHzC,SAAQ,IAAI;AACZ,SAAQ,IAAI;AAGR,SAAK,IAAI;AACT,SAAK,IAAI;AAAA,EACb;AAAA,EAEO,yBAAyB,GAAW,GAAiB;AACxD,SAAK,IAAI;AACT,SAAK,IAAI;AACT,YAAQ,OAAO;AAAA,EACnB;AAAA,EAEO,wBAAiC;AACpC,WAAO;AAAA,MACH,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,KAAK,KAAK;AAAA,MACV,OAAO,KAAK;AAAA,MACZ,GAAG,KAAK;AAAA,MACR,GAAG,KAAK;AAAA,MACR,QAAQ,KAAK;AAAA,MACb,MAAM,KAAK;AAAA;AAAA,MAEX,SAAS;AACL;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/VirtualTrigger.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";import{Overlay as e}from"./
|
|
1
|
+
"use strict";import{Overlay as e}from"./Overlay.js";export class VirtualTrigger{constructor(t,i){this.x=0;this.y=0;this.x=t,this.y=i}updateBoundingClientRect(t,i){this.x=t,this.y=i,e.update()}getBoundingClientRect(){return{width:0,height:0,top:this.y,right:this.x,y:this.y,x:this.x,bottom:this.y,left:this.x,toJSON(){}}}}
|
|
2
2
|
//# sourceMappingURL=VirtualTrigger.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["VirtualTrigger.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\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { Overlay } from './
|
|
5
|
-
"mappings": "aAWA,OAAS,WAAAA,MAAe,eAEjB,aAAM,cAAe,CAIjB,YAAYC,EAAWC,EAAW,CAHzC,KAAQ,EAAI,EACZ,KAAQ,EAAI,EAGR,KAAK,EAAID,EACT,KAAK,EAAIC,CACb,CAEO,yBAAyBD,EAAWC,EAAiB,CACxD,KAAK,EAAID,EACT,KAAK,EAAIC,EACTF,EAAQ,OAAO,CACnB,CAEO,uBAAiC,CACpC,MAAO,CACH,MAAO,EACP,OAAQ,EACR,IAAK,KAAK,EACV,MAAO,KAAK,EACZ,EAAG,KAAK,EACR,EAAG,KAAK,EACR,OAAQ,KAAK,EACb,KAAM,KAAK,
|
|
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\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { Overlay } from './Overlay.js';\n\nexport class VirtualTrigger {\n private x = 0;\n private y = 0;\n\n public constructor(x: number, y: number) {\n this.x = x;\n this.y = y;\n }\n\n public updateBoundingClientRect(x: number, y: number): void {\n this.x = x;\n this.y = y;\n Overlay.update();\n }\n\n public getBoundingClientRect(): DOMRect {\n return {\n width: 0,\n height: 0,\n top: this.y,\n right: this.x,\n y: this.y,\n x: this.x,\n bottom: this.y,\n left: this.x,\n /* c8 ignore next 3 */\n toJSON() {\n return;\n },\n };\n }\n}\n"],
|
|
5
|
+
"mappings": "aAWA,OAAS,WAAAA,MAAe,eAEjB,aAAM,cAAe,CAIjB,YAAYC,EAAWC,EAAW,CAHzC,KAAQ,EAAI,EACZ,KAAQ,EAAI,EAGR,KAAK,EAAID,EACT,KAAK,EAAIC,CACb,CAEO,yBAAyBD,EAAWC,EAAiB,CACxD,KAAK,EAAID,EACT,KAAK,EAAIC,EACTF,EAAQ,OAAO,CACnB,CAEO,uBAAiC,CACpC,MAAO,CACH,MAAO,EACP,OAAQ,EACR,IAAK,KAAK,EACV,MAAO,KAAK,EACZ,EAAG,KAAK,EACR,EAAG,KAAK,EACR,OAAQ,KAAK,EACb,KAAM,KAAK,EAEX,QAAS,CAET,CACJ,CACJ,CACJ",
|
|
6
6
|
"names": ["Overlay", "x", "y"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MiddlewareArguments, MiddlewareReturn } from '@floating-ui/dom';
|
|
2
|
+
export declare const fullSize: (options?: {
|
|
3
|
+
padding: number;
|
|
4
|
+
}) => {
|
|
5
|
+
name: string;
|
|
6
|
+
fn(middlewareArguments: MiddlewareArguments): Promise<MiddlewareReturn & {
|
|
7
|
+
data: {
|
|
8
|
+
availableWidth: number;
|
|
9
|
+
availableHeight: number;
|
|
10
|
+
};
|
|
11
|
+
}>;
|
|
12
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import {
|
|
3
|
+
detectOverflow
|
|
4
|
+
} from "@floating-ui/dom";
|
|
5
|
+
export const fullSize = (options = { padding: 0 }) => ({
|
|
6
|
+
name: "fullSize",
|
|
7
|
+
async fn(middlewareArguments) {
|
|
8
|
+
var _a, _b, _c, _d;
|
|
9
|
+
const overflow = await detectOverflow(middlewareArguments, options);
|
|
10
|
+
let availableHeight = -overflow.top - overflow.bottom + middlewareArguments.rects.floating.height;
|
|
11
|
+
let availableWidth = -overflow.left - overflow.right + middlewareArguments.rects.floating.width;
|
|
12
|
+
if (middlewareArguments.placement.startsWith("bottom")) {
|
|
13
|
+
availableHeight -= middlewareArguments.rects.reference.height;
|
|
14
|
+
availableHeight -= middlewareArguments.rects.reference.y;
|
|
15
|
+
availableHeight -= ((_a = middlewareArguments.middlewareData.offset) == null ? void 0 : _a.y) || 0;
|
|
16
|
+
availableHeight += options.padding;
|
|
17
|
+
} else if (middlewareArguments.placement.startsWith("top")) {
|
|
18
|
+
availableHeight = middlewareArguments.rects.reference.y;
|
|
19
|
+
availableHeight -= ((_b = middlewareArguments.middlewareData.offset) == null ? void 0 : _b.y) || 0;
|
|
20
|
+
availableHeight += options.padding;
|
|
21
|
+
} else if (middlewareArguments.placement.startsWith("right")) {
|
|
22
|
+
availableWidth -= middlewareArguments.rects.reference.width;
|
|
23
|
+
availableWidth -= middlewareArguments.rects.reference.x;
|
|
24
|
+
availableWidth -= ((_c = middlewareArguments.middlewareData.offset) == null ? void 0 : _c.x) || 0;
|
|
25
|
+
availableWidth += options.padding;
|
|
26
|
+
} else if (middlewareArguments.placement.startsWith("left")) {
|
|
27
|
+
availableWidth = middlewareArguments.rects.reference.x;
|
|
28
|
+
availableWidth -= ((_d = middlewareArguments.middlewareData.offset) == null ? void 0 : _d.x) || 0;
|
|
29
|
+
availableWidth += options.padding;
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
data: {
|
|
33
|
+
availableWidth,
|
|
34
|
+
availableHeight
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=fullSizePlugin.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["fullSizePlugin.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport {\n detectOverflow,\n MiddlewareArguments,\n MiddlewareReturn,\n} from '@floating-ui/dom';\n\nexport const fullSize = (options: { padding: number } = { padding: 0 }) => ({\n name: 'fullSize',\n async fn(middlewareArguments: MiddlewareArguments): Promise<\n MiddlewareReturn & {\n data: { availableWidth: number; availableHeight: number };\n }\n > {\n const overflow = await detectOverflow(middlewareArguments, options);\n let availableHeight =\n -overflow.top -\n overflow.bottom +\n middlewareArguments.rects.floating.height;\n let availableWidth =\n -overflow.left -\n overflow.right +\n middlewareArguments.rects.floating.width;\n if (middlewareArguments.placement.startsWith('bottom')) {\n availableHeight -= middlewareArguments.rects.reference.height;\n availableHeight -= middlewareArguments.rects.reference.y;\n availableHeight -=\n middlewareArguments.middlewareData.offset?.y || 0;\n availableHeight += options.padding;\n } else if (middlewareArguments.placement.startsWith('top')) {\n availableHeight = middlewareArguments.rects.reference.y;\n availableHeight -=\n middlewareArguments.middlewareData.offset?.y || 0;\n availableHeight += options.padding;\n } else if (middlewareArguments.placement.startsWith('right')) {\n availableWidth -= middlewareArguments.rects.reference.width;\n availableWidth -= middlewareArguments.rects.reference.x;\n availableWidth -= middlewareArguments.middlewareData.offset?.x || 0;\n availableWidth += options.padding;\n } else if (middlewareArguments.placement.startsWith('left')) {\n availableWidth = middlewareArguments.rects.reference.x;\n availableWidth -= middlewareArguments.middlewareData.offset?.x || 0;\n availableWidth += options.padding;\n }\n return {\n data: {\n availableWidth,\n availableHeight,\n },\n };\n },\n});\n"],
|
|
5
|
+
"mappings": ";AAWA;AAAA,EACI;AAAA,OAGG;AAEA,aAAM,WAAW,CAAC,UAA+B,EAAE,SAAS,EAAE,OAAO;AAAA,EACxE,MAAM;AAAA,EACN,MAAM,GAAG,qBAIP;AAvBN;AAwBQ,UAAM,WAAW,MAAM,eAAe,qBAAqB,OAAO;AAClE,QAAI,kBACA,CAAC,SAAS,MACV,SAAS,SACT,oBAAoB,MAAM,SAAS;AACvC,QAAI,iBACA,CAAC,SAAS,OACV,SAAS,QACT,oBAAoB,MAAM,SAAS;AACvC,QAAI,oBAAoB,UAAU,WAAW,QAAQ,GAAG;AACpD,yBAAmB,oBAAoB,MAAM,UAAU;AACvD,yBAAmB,oBAAoB,MAAM,UAAU;AACvD,2BACI,yBAAoB,eAAe,WAAnC,mBAA2C,MAAK;AACpD,yBAAmB,QAAQ;AAAA,IAC/B,WAAW,oBAAoB,UAAU,WAAW,KAAK,GAAG;AACxD,wBAAkB,oBAAoB,MAAM,UAAU;AACtD,2BACI,yBAAoB,eAAe,WAAnC,mBAA2C,MAAK;AACpD,yBAAmB,QAAQ;AAAA,IAC/B,WAAW,oBAAoB,UAAU,WAAW,OAAO,GAAG;AAC1D,wBAAkB,oBAAoB,MAAM,UAAU;AACtD,wBAAkB,oBAAoB,MAAM,UAAU;AACtD,0BAAkB,yBAAoB,eAAe,WAAnC,mBAA2C,MAAK;AAClE,wBAAkB,QAAQ;AAAA,IAC9B,WAAW,oBAAoB,UAAU,WAAW,MAAM,GAAG;AACzD,uBAAiB,oBAAoB,MAAM,UAAU;AACrD,0BAAkB,yBAAoB,eAAe,WAAnC,mBAA2C,MAAK;AAClE,wBAAkB,QAAQ;AAAA,IAC9B;AACA,WAAO;AAAA,MACH,MAAM;AAAA,QACF;AAAA,QACA;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";import{detectOverflow as o}from"@floating-ui/dom";export const fullSize=(f={padding:0})=>({name:"fullSize",async fn(t){var c,l,r,h;const i=await o(t,f);let e=-i.top-i.bottom+t.rects.floating.height,a=-i.left-i.right+t.rects.floating.width;return t.placement.startsWith("bottom")?(e-=t.rects.reference.height,e-=t.rects.reference.y,e-=((c=t.middlewareData.offset)==null?void 0:c.y)||0,e+=f.padding):t.placement.startsWith("top")?(e=t.rects.reference.y,e-=((l=t.middlewareData.offset)==null?void 0:l.y)||0,e+=f.padding):t.placement.startsWith("right")?(a-=t.rects.reference.width,a-=t.rects.reference.x,a-=((r=t.middlewareData.offset)==null?void 0:r.x)||0,a+=f.padding):t.placement.startsWith("left")&&(a=t.rects.reference.x,a-=((h=t.middlewareData.offset)==null?void 0:h.x)||0,a+=f.padding),{data:{availableWidth:a,availableHeight:e}}}});
|
|
2
|
+
//# sourceMappingURL=fullSizePlugin.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["fullSizePlugin.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport {\n detectOverflow,\n MiddlewareArguments,\n MiddlewareReturn,\n} from '@floating-ui/dom';\n\nexport const fullSize = (options: { padding: number } = { padding: 0 }) => ({\n name: 'fullSize',\n async fn(middlewareArguments: MiddlewareArguments): Promise<\n MiddlewareReturn & {\n data: { availableWidth: number; availableHeight: number };\n }\n > {\n const overflow = await detectOverflow(middlewareArguments, options);\n let availableHeight =\n -overflow.top -\n overflow.bottom +\n middlewareArguments.rects.floating.height;\n let availableWidth =\n -overflow.left -\n overflow.right +\n middlewareArguments.rects.floating.width;\n if (middlewareArguments.placement.startsWith('bottom')) {\n availableHeight -= middlewareArguments.rects.reference.height;\n availableHeight -= middlewareArguments.rects.reference.y;\n availableHeight -=\n middlewareArguments.middlewareData.offset?.y || 0;\n availableHeight += options.padding;\n } else if (middlewareArguments.placement.startsWith('top')) {\n availableHeight = middlewareArguments.rects.reference.y;\n availableHeight -=\n middlewareArguments.middlewareData.offset?.y || 0;\n availableHeight += options.padding;\n } else if (middlewareArguments.placement.startsWith('right')) {\n availableWidth -= middlewareArguments.rects.reference.width;\n availableWidth -= middlewareArguments.rects.reference.x;\n availableWidth -= middlewareArguments.middlewareData.offset?.x || 0;\n availableWidth += options.padding;\n } else if (middlewareArguments.placement.startsWith('left')) {\n availableWidth = middlewareArguments.rects.reference.x;\n availableWidth -= middlewareArguments.middlewareData.offset?.x || 0;\n availableWidth += options.padding;\n }\n return {\n data: {\n availableWidth,\n availableHeight,\n },\n };\n },\n});\n"],
|
|
5
|
+
"mappings": "aAWA,OACI,kBAAAA,MAGG,mBAEA,aAAM,SAAW,CAACC,EAA+B,CAAE,QAAS,CAAE,KAAO,CACxE,KAAM,WACN,MAAM,GAAGC,EAIP,CAvBN,IAAAC,EAAAC,EAAAC,EAAAC,EAwBQ,MAAMC,EAAW,MAAMP,EAAeE,EAAqBD,CAAO,EAClE,IAAIO,EACA,CAACD,EAAS,IACVA,EAAS,OACTL,EAAoB,MAAM,SAAS,OACnCO,EACA,CAACF,EAAS,KACVA,EAAS,MACTL,EAAoB,MAAM,SAAS,MACvC,OAAIA,EAAoB,UAAU,WAAW,QAAQ,GACjDM,GAAmBN,EAAoB,MAAM,UAAU,OACvDM,GAAmBN,EAAoB,MAAM,UAAU,EACvDM,KACIL,EAAAD,EAAoB,eAAe,SAAnC,YAAAC,EAA2C,IAAK,EACpDK,GAAmBP,EAAQ,SACpBC,EAAoB,UAAU,WAAW,KAAK,GACrDM,EAAkBN,EAAoB,MAAM,UAAU,EACtDM,KACIJ,EAAAF,EAAoB,eAAe,SAAnC,YAAAE,EAA2C,IAAK,EACpDI,GAAmBP,EAAQ,SACpBC,EAAoB,UAAU,WAAW,OAAO,GACvDO,GAAkBP,EAAoB,MAAM,UAAU,MACtDO,GAAkBP,EAAoB,MAAM,UAAU,EACtDO,KAAkBJ,EAAAH,EAAoB,eAAe,SAAnC,YAAAG,EAA2C,IAAK,EAClEI,GAAkBR,EAAQ,SACnBC,EAAoB,UAAU,WAAW,MAAM,IACtDO,EAAiBP,EAAoB,MAAM,UAAU,EACrDO,KAAkBH,EAAAJ,EAAoB,eAAe,SAAnC,YAAAI,EAA2C,IAAK,EAClEG,GAAkBR,EAAQ,SAEvB,CACH,KAAM,CACF,eAAAQ,EACA,gBAAAD,CACJ,CACJ,CACJ,CACJ",
|
|
6
|
+
"names": ["detectOverflow", "options", "middlewareArguments", "_a", "_b", "_c", "_d", "overflow", "availableHeight", "availableWidth"]
|
|
7
|
+
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './Overlay.js';
|
|
2
2
|
export * from './OverlayTrigger.js';
|
|
3
3
|
export * from './overlay-types.js';
|
|
4
|
-
export * from './ActiveOverlay.js';
|
|
5
|
-
export * from './loader.js';
|
|
6
4
|
export * from './VirtualTrigger.js';
|
|
5
|
+
export * from './loader.js';
|
package/src/index.dev.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
export * from "./
|
|
2
|
+
export * from "./Overlay.dev.js";
|
|
3
3
|
export * from "./OverlayTrigger.dev.js";
|
|
4
4
|
export * from "./overlay-types.dev.js";
|
|
5
|
-
export * from "./ActiveOverlay.dev.js";
|
|
6
|
-
export * from "./loader.dev.js";
|
|
7
5
|
export * from "./VirtualTrigger.dev.js";
|
|
6
|
+
export * from "./loader.dev.js";
|
|
8
7
|
//# sourceMappingURL=index.dev.js.map
|
package/src/index.dev.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["index.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*/\nexport * from './
|
|
5
|
-
"mappings": ";AAWA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nexport * from './Overlay.dev.js'\nexport * from './OverlayTrigger.dev.js'\nexport * from './overlay-types.dev.js'\nexport * from './VirtualTrigger.dev.js'\nexport * from './loader.dev.js'\n"],
|
|
5
|
+
"mappings": ";AAWA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";export*from"./
|
|
1
|
+
"use strict";export*from"./Overlay.js";export*from"./OverlayTrigger.js";export*from"./overlay-types.js";export*from"./VirtualTrigger.js";export*from"./loader.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["index.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*/\nexport * from './
|
|
5
|
-
"mappings": "aAWA,WAAc,eACd,WAAc,sBACd,WAAc,qBACd,WAAc,
|
|
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*/\nexport * from './Overlay.js';\nexport * from './OverlayTrigger.js';\nexport * from './overlay-types.js';\nexport * from './VirtualTrigger.js';\nexport * from './loader.js';\n"],
|
|
5
|
+
"mappings": "aAWA,WAAc,eACd,WAAc,sBACd,WAAc,qBACd,WAAc,sBACd,WAAc",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/loader.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const openOverlay: (target: HTMLElement, interaction: TriggerInteractions, content: HTMLElement, options: OverlayOptions) => Promise<() => void>;
|
|
1
|
+
export declare const openOverlay: typeof import("./AbstractOverlay.js").AbstractOverlay.open;
|
package/src/loader.dev.js
CHANGED
|
@@ -1,21 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var ignoreDeprecations = window.__swc.ignoreWarningLevels.deprecation;
|
|
5
|
-
}
|
|
6
|
-
const { Overlay } = await import("@spectrum-web-components/overlay/src/overlay.js");
|
|
7
|
-
if (true) {
|
|
8
|
-
if (
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
10
|
-
// @ts-ignore
|
|
11
|
-
ignoreDeprecations && !window.__swc.ignoreWarningLevels.deprecation
|
|
12
|
-
) {
|
|
13
|
-
window.__swc.ignoreWarningLevels.deprecation = ignoreDeprecations;
|
|
14
|
-
requestAnimationFrame(() => {
|
|
15
|
-
window.__swc.ignoreWarningLevels.deprecation = false;
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return Overlay.open(target, interaction, content, options);
|
|
20
|
-
};
|
|
2
|
+
import { Overlay } from "./Overlay.dev.js";
|
|
3
|
+
export const openOverlay = Overlay.open;
|
|
21
4
|
//# sourceMappingURL=loader.dev.js.map
|
package/src/loader.dev.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["loader.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright
|
|
5
|
-
"mappings": ";
|
|
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*/\n\nimport { Overlay } from './Overlay.dev.js'\n\nexport const openOverlay = Overlay.open;\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,eAAe;AAEjB,aAAM,cAAc,QAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/loader.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";import{Overlay as o}from"./Overlay.js";export const openOverlay=o.open;
|
|
2
2
|
//# sourceMappingURL=loader.js.map
|
package/src/loader.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["loader.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["
|
|
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*/\n\nimport { Overlay } from './Overlay.js';\n\nexport const openOverlay = Overlay.open;\n"],
|
|
5
|
+
"mappings": "aAYA,OAAS,WAAAA,MAAe,eAEjB,aAAM,YAAcA,EAAQ",
|
|
6
|
+
"names": ["Overlay"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["overlay-timer.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\nconst DEFAULT_WARMUP = 1000;\nconst DEFAULT_COOLDOWN = 1000;\n\n/**\n * A timer to help with implementation of warnup/cooldown behavior as described here:\n * https://spectrum.adobe.com/page/tooltip/#Immediate-or-delayed-appearance\n */\nexport class OverlayTimer {\n private warmUpDelay = DEFAULT_WARMUP;\n private coolDownDelay = DEFAULT_COOLDOWN;\n\n private isWarm = false;\n private cooldownTimeout?: number;\n\n private component?: HTMLElement;\n private timeout = 0;\n private promise?: Promise<boolean>;\n private resolve?: (cancelled: boolean) => void;\n\n constructor(\n options: { warmUpDelay?: number; coolDownDelay?: number } = {}\n ) {\n Object.assign(this, options);\n }\n\n public async openTimer(component: HTMLElement): Promise<boolean> {\n this.cancelCooldownTimer();\n\n if (!this.component || component !== this.component) {\n if (this.component) {\n this.close(this.component);\n this.cancelCooldownTimer();\n }\n this.component = component;\n\n if (this.isWarm) {\n return false;\n }\n\n this.promise = new Promise((resolve) => {\n this.resolve = resolve;\n this.timeout = window.setTimeout(() => {\n if (this.resolve) {\n this.resolve(false);\n this.isWarm = true;\n }\n }, this.warmUpDelay);\n });\n return this.promise;\n } else if (this.promise) {\n return this.promise;\n } else {\n // This should never happen\n throw new Error('Inconsistent state');\n }\n }\n\n public close(component: HTMLElement): void {\n if (this.component && this.component === component) {\n this.resetCooldownTimer();\n if (this.timeout > 0) {\n clearTimeout(this.timeout);\n this.timeout = 0;\n }\n if (this.resolve) {\n this.resolve(true);\n delete this.resolve;\n }\n delete this.promise;\n delete this.component;\n }\n }\n\n private resetCooldownTimer(): void {\n if (this.isWarm) {\n if (this.cooldownTimeout) {\n window.clearTimeout(this.cooldownTimeout);\n }\n this.cooldownTimeout = window.setTimeout(() => {\n this.isWarm = false;\n delete this.cooldownTimeout;\n }, this.coolDownDelay);\n }\n }\n\n private cancelCooldownTimer(): void {\n if (this.cooldownTimeout) {\n window.clearTimeout(this.cooldownTimeout);\n }\n delete this.cooldownTimeout;\n }\n}\n"],
|
|
5
|
-
"mappings": ";AAYA,MAAM,iBAAiB;AACvB,MAAM,mBAAmB;AAMlB,aAAM,aAAa;AAAA,EAYtB,YACI,UAA4D,CAAC,GAC/D;AAbF,SAAQ,cAAc;AACtB,SAAQ,gBAAgB;AAExB,SAAQ,SAAS;AAIjB,SAAQ,UAAU;AAOd,WAAO,OAAO,MAAM,OAAO;AAAA,EAC/B;AAAA,EAEA,MAAa,UAAU,WAA0C;AAC7D,SAAK,oBAAoB;AAEzB,QAAI,CAAC,KAAK,aAAa,cAAc,KAAK,WAAW;AACjD,UAAI,KAAK,WAAW;AAChB,aAAK,MAAM,KAAK,SAAS;AACzB,aAAK,oBAAoB;AAAA,MAC7B;AACA,WAAK,YAAY;AAEjB,UAAI,KAAK,QAAQ;AACb,eAAO;AAAA,MACX;AAEA,WAAK,UAAU,IAAI,QAAQ,CAAC,YAAY;AACpC,aAAK,UAAU;AACf,aAAK,UAAU,OAAO,WAAW,MAAM;AACnC,cAAI,KAAK,SAAS;AACd,iBAAK,QAAQ,KAAK;AAClB,iBAAK,SAAS;AAAA,UAClB;AAAA,QACJ,GAAG,KAAK,WAAW;AAAA,MACvB,CAAC;AACD,aAAO,KAAK;AAAA,IAChB,WAAW,KAAK,SAAS;AACrB,aAAO,KAAK;AAAA,
|
|
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\nconst DEFAULT_WARMUP = 1000;\nconst DEFAULT_COOLDOWN = 1000;\n\n/**\n * A timer to help with implementation of warnup/cooldown behavior as described here:\n * https://spectrum.adobe.com/page/tooltip/#Immediate-or-delayed-appearance\n */\nexport class OverlayTimer {\n private warmUpDelay = DEFAULT_WARMUP;\n private coolDownDelay = DEFAULT_COOLDOWN;\n\n private isWarm = false;\n private cooldownTimeout?: number;\n\n private component?: HTMLElement;\n private timeout = 0;\n private promise?: Promise<boolean>;\n private resolve?: (cancelled: boolean) => void;\n\n constructor(\n options: { warmUpDelay?: number; coolDownDelay?: number } = {}\n ) {\n Object.assign(this, options);\n }\n\n public async openTimer(component: HTMLElement): Promise<boolean> {\n this.cancelCooldownTimer();\n\n if (!this.component || component !== this.component) {\n if (this.component) {\n this.close(this.component);\n this.cancelCooldownTimer();\n }\n this.component = component;\n\n if (this.isWarm) {\n return false;\n }\n\n this.promise = new Promise((resolve) => {\n this.resolve = resolve;\n this.timeout = window.setTimeout(() => {\n if (this.resolve) {\n this.resolve(false);\n this.isWarm = true;\n }\n }, this.warmUpDelay);\n });\n return this.promise;\n } else if (this.promise) {\n return this.promise;\n /* c8 ignore next 4 */\n } else {\n // This should never happen\n throw new Error('Inconsistent state');\n }\n }\n\n public close(component: HTMLElement): void {\n if (this.component && this.component === component) {\n this.resetCooldownTimer();\n if (this.timeout > 0) {\n clearTimeout(this.timeout);\n this.timeout = 0;\n }\n if (this.resolve) {\n this.resolve(true);\n delete this.resolve;\n }\n delete this.promise;\n delete this.component;\n }\n }\n\n private resetCooldownTimer(): void {\n if (this.isWarm) {\n if (this.cooldownTimeout) {\n window.clearTimeout(this.cooldownTimeout);\n }\n this.cooldownTimeout = window.setTimeout(() => {\n this.isWarm = false;\n delete this.cooldownTimeout;\n }, this.coolDownDelay);\n }\n }\n\n private cancelCooldownTimer(): void {\n if (this.cooldownTimeout) {\n window.clearTimeout(this.cooldownTimeout);\n }\n delete this.cooldownTimeout;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAYA,MAAM,iBAAiB;AACvB,MAAM,mBAAmB;AAMlB,aAAM,aAAa;AAAA,EAYtB,YACI,UAA4D,CAAC,GAC/D;AAbF,SAAQ,cAAc;AACtB,SAAQ,gBAAgB;AAExB,SAAQ,SAAS;AAIjB,SAAQ,UAAU;AAOd,WAAO,OAAO,MAAM,OAAO;AAAA,EAC/B;AAAA,EAEA,MAAa,UAAU,WAA0C;AAC7D,SAAK,oBAAoB;AAEzB,QAAI,CAAC,KAAK,aAAa,cAAc,KAAK,WAAW;AACjD,UAAI,KAAK,WAAW;AAChB,aAAK,MAAM,KAAK,SAAS;AACzB,aAAK,oBAAoB;AAAA,MAC7B;AACA,WAAK,YAAY;AAEjB,UAAI,KAAK,QAAQ;AACb,eAAO;AAAA,MACX;AAEA,WAAK,UAAU,IAAI,QAAQ,CAAC,YAAY;AACpC,aAAK,UAAU;AACf,aAAK,UAAU,OAAO,WAAW,MAAM;AACnC,cAAI,KAAK,SAAS;AACd,iBAAK,QAAQ,KAAK;AAClB,iBAAK,SAAS;AAAA,UAClB;AAAA,QACJ,GAAG,KAAK,WAAW;AAAA,MACvB,CAAC;AACD,aAAO,KAAK;AAAA,IAChB,WAAW,KAAK,SAAS;AACrB,aAAO,KAAK;AAAA,IAEhB,OAAO;AAEH,YAAM,IAAI,MAAM,oBAAoB;AAAA,IACxC;AAAA,EACJ;AAAA,EAEO,MAAM,WAA8B;AACvC,QAAI,KAAK,aAAa,KAAK,cAAc,WAAW;AAChD,WAAK,mBAAmB;AACxB,UAAI,KAAK,UAAU,GAAG;AAClB,qBAAa,KAAK,OAAO;AACzB,aAAK,UAAU;AAAA,MACnB;AACA,UAAI,KAAK,SAAS;AACd,aAAK,QAAQ,IAAI;AACjB,eAAO,KAAK;AAAA,MAChB;AACA,aAAO,KAAK;AACZ,aAAO,KAAK;AAAA,IAChB;AAAA,EACJ;AAAA,EAEQ,qBAA2B;AAC/B,QAAI,KAAK,QAAQ;AACb,UAAI,KAAK,iBAAiB;AACtB,eAAO,aAAa,KAAK,eAAe;AAAA,MAC5C;AACA,WAAK,kBAAkB,OAAO,WAAW,MAAM;AAC3C,aAAK,SAAS;AACd,eAAO,KAAK;AAAA,MAChB,GAAG,KAAK,aAAa;AAAA,IACzB;AAAA,EACJ;AAAA,EAEQ,sBAA4B;AAChC,QAAI,KAAK,iBAAiB;AACtB,aAAO,aAAa,KAAK,eAAe;AAAA,IAC5C;AACA,WAAO,KAAK;AAAA,EAChB;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/overlay-timer.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["overlay-timer.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\nconst DEFAULT_WARMUP = 1000;\nconst DEFAULT_COOLDOWN = 1000;\n\n/**\n * A timer to help with implementation of warnup/cooldown behavior as described here:\n * https://spectrum.adobe.com/page/tooltip/#Immediate-or-delayed-appearance\n */\nexport class OverlayTimer {\n private warmUpDelay = DEFAULT_WARMUP;\n private coolDownDelay = DEFAULT_COOLDOWN;\n\n private isWarm = false;\n private cooldownTimeout?: number;\n\n private component?: HTMLElement;\n private timeout = 0;\n private promise?: Promise<boolean>;\n private resolve?: (cancelled: boolean) => void;\n\n constructor(\n options: { warmUpDelay?: number; coolDownDelay?: number } = {}\n ) {\n Object.assign(this, options);\n }\n\n public async openTimer(component: HTMLElement): Promise<boolean> {\n this.cancelCooldownTimer();\n\n if (!this.component || component !== this.component) {\n if (this.component) {\n this.close(this.component);\n this.cancelCooldownTimer();\n }\n this.component = component;\n\n if (this.isWarm) {\n return false;\n }\n\n this.promise = new Promise((resolve) => {\n this.resolve = resolve;\n this.timeout = window.setTimeout(() => {\n if (this.resolve) {\n this.resolve(false);\n this.isWarm = true;\n }\n }, this.warmUpDelay);\n });\n return this.promise;\n } else if (this.promise) {\n return this.promise;\n } else {\n // This should never happen\n throw new Error('Inconsistent state');\n }\n }\n\n public close(component: HTMLElement): void {\n if (this.component && this.component === component) {\n this.resetCooldownTimer();\n if (this.timeout > 0) {\n clearTimeout(this.timeout);\n this.timeout = 0;\n }\n if (this.resolve) {\n this.resolve(true);\n delete this.resolve;\n }\n delete this.promise;\n delete this.component;\n }\n }\n\n private resetCooldownTimer(): void {\n if (this.isWarm) {\n if (this.cooldownTimeout) {\n window.clearTimeout(this.cooldownTimeout);\n }\n this.cooldownTimeout = window.setTimeout(() => {\n this.isWarm = false;\n delete this.cooldownTimeout;\n }, this.coolDownDelay);\n }\n }\n\n private cancelCooldownTimer(): void {\n if (this.cooldownTimeout) {\n window.clearTimeout(this.cooldownTimeout);\n }\n delete this.cooldownTimeout;\n }\n}\n"],
|
|
5
|
-
"mappings": "aAYA,MAAMA,EAAiB,IACjBC,EAAmB,IAMlB,aAAM,YAAa,CAYtB,YACIC,EAA4D,CAAC,EAC/D,CAbF,KAAQ,YAAc,IACtB,KAAQ,cAAgB,IAExB,KAAQ,OAAS,GAIjB,KAAQ,QAAU,EAOd,OAAO,OAAO,KAAMA,CAAO,CAC/B,CAEA,MAAa,UAAUC,EAA0C,CAG7D,GAFA,KAAK,oBAAoB,EAErB,CAAC,KAAK,WAAaA,IAAc,KAAK,UAOtC,OANI,KAAK,YACL,KAAK,MAAM,KAAK,SAAS,EACzB,KAAK,oBAAoB,GAE7B,KAAK,UAAYA,EAEb,KAAK,OACE,IAGX,KAAK,QAAU,IAAI,QAASC,GAAY,CACpC,KAAK,QAAUA,EACf,KAAK,QAAU,OAAO,WAAW,IAAM,CAC/B,KAAK,UACL,KAAK,QAAQ,EAAK,EAClB,KAAK,OAAS,GAEtB,EAAG,KAAK,WAAW,CACvB,CAAC,EACM,KAAK,SACT,GAAI,KAAK,QACZ,OAAO,KAAK,
|
|
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\nconst DEFAULT_WARMUP = 1000;\nconst DEFAULT_COOLDOWN = 1000;\n\n/**\n * A timer to help with implementation of warnup/cooldown behavior as described here:\n * https://spectrum.adobe.com/page/tooltip/#Immediate-or-delayed-appearance\n */\nexport class OverlayTimer {\n private warmUpDelay = DEFAULT_WARMUP;\n private coolDownDelay = DEFAULT_COOLDOWN;\n\n private isWarm = false;\n private cooldownTimeout?: number;\n\n private component?: HTMLElement;\n private timeout = 0;\n private promise?: Promise<boolean>;\n private resolve?: (cancelled: boolean) => void;\n\n constructor(\n options: { warmUpDelay?: number; coolDownDelay?: number } = {}\n ) {\n Object.assign(this, options);\n }\n\n public async openTimer(component: HTMLElement): Promise<boolean> {\n this.cancelCooldownTimer();\n\n if (!this.component || component !== this.component) {\n if (this.component) {\n this.close(this.component);\n this.cancelCooldownTimer();\n }\n this.component = component;\n\n if (this.isWarm) {\n return false;\n }\n\n this.promise = new Promise((resolve) => {\n this.resolve = resolve;\n this.timeout = window.setTimeout(() => {\n if (this.resolve) {\n this.resolve(false);\n this.isWarm = true;\n }\n }, this.warmUpDelay);\n });\n return this.promise;\n } else if (this.promise) {\n return this.promise;\n /* c8 ignore next 4 */\n } else {\n // This should never happen\n throw new Error('Inconsistent state');\n }\n }\n\n public close(component: HTMLElement): void {\n if (this.component && this.component === component) {\n this.resetCooldownTimer();\n if (this.timeout > 0) {\n clearTimeout(this.timeout);\n this.timeout = 0;\n }\n if (this.resolve) {\n this.resolve(true);\n delete this.resolve;\n }\n delete this.promise;\n delete this.component;\n }\n }\n\n private resetCooldownTimer(): void {\n if (this.isWarm) {\n if (this.cooldownTimeout) {\n window.clearTimeout(this.cooldownTimeout);\n }\n this.cooldownTimeout = window.setTimeout(() => {\n this.isWarm = false;\n delete this.cooldownTimeout;\n }, this.coolDownDelay);\n }\n }\n\n private cancelCooldownTimer(): void {\n if (this.cooldownTimeout) {\n window.clearTimeout(this.cooldownTimeout);\n }\n delete this.cooldownTimeout;\n }\n}\n"],
|
|
5
|
+
"mappings": "aAYA,MAAMA,EAAiB,IACjBC,EAAmB,IAMlB,aAAM,YAAa,CAYtB,YACIC,EAA4D,CAAC,EAC/D,CAbF,KAAQ,YAAc,IACtB,KAAQ,cAAgB,IAExB,KAAQ,OAAS,GAIjB,KAAQ,QAAU,EAOd,OAAO,OAAO,KAAMA,CAAO,CAC/B,CAEA,MAAa,UAAUC,EAA0C,CAG7D,GAFA,KAAK,oBAAoB,EAErB,CAAC,KAAK,WAAaA,IAAc,KAAK,UAOtC,OANI,KAAK,YACL,KAAK,MAAM,KAAK,SAAS,EACzB,KAAK,oBAAoB,GAE7B,KAAK,UAAYA,EAEb,KAAK,OACE,IAGX,KAAK,QAAU,IAAI,QAASC,GAAY,CACpC,KAAK,QAAUA,EACf,KAAK,QAAU,OAAO,WAAW,IAAM,CAC/B,KAAK,UACL,KAAK,QAAQ,EAAK,EAClB,KAAK,OAAS,GAEtB,EAAG,KAAK,WAAW,CACvB,CAAC,EACM,KAAK,SACT,GAAI,KAAK,QACZ,OAAO,KAAK,QAIZ,MAAM,IAAI,MAAM,oBAAoB,CAE5C,CAEO,MAAMD,EAA8B,CACnC,KAAK,WAAa,KAAK,YAAcA,IACrC,KAAK,mBAAmB,EACpB,KAAK,QAAU,IACf,aAAa,KAAK,OAAO,EACzB,KAAK,QAAU,GAEf,KAAK,UACL,KAAK,QAAQ,EAAI,EACjB,OAAO,KAAK,SAEhB,OAAO,KAAK,QACZ,OAAO,KAAK,UAEpB,CAEQ,oBAA2B,CAC3B,KAAK,SACD,KAAK,iBACL,OAAO,aAAa,KAAK,eAAe,EAE5C,KAAK,gBAAkB,OAAO,WAAW,IAAM,CAC3C,KAAK,OAAS,GACd,OAAO,KAAK,eAChB,EAAG,KAAK,aAAa,EAE7B,CAEQ,qBAA4B,CAC5B,KAAK,iBACL,OAAO,aAAa,KAAK,eAAe,EAE5C,OAAO,KAAK,eAChB,CACJ",
|
|
6
6
|
"names": ["DEFAULT_WARMUP", "DEFAULT_COOLDOWN", "options", "component", "resolve"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { css } from "@spectrum-web-components/base";
|
|
3
3
|
const styles = css`
|
|
4
|
-
:host([disabled]) ::slotted([slot=trigger]){pointer-events:none}
|
|
4
|
+
:host([disabled]) ::slotted([slot=trigger]){pointer-events:none}slot[name=longpress-describedby-descriptor]{display:none}
|
|
5
5
|
`;
|
|
6
6
|
export default styles;
|
|
7
7
|
//# sourceMappingURL=overlay-trigger.css.dev.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["overlay-trigger.css.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host([disabled]) ::slotted([slot=trigger]){pointer-events:none}
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host([disabled]) ::slotted([slot=trigger]){pointer-events:none}slot[name=longpress-describedby-descriptor]{display:none}\n`;\nexport default styles;"],
|
|
5
5
|
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";import{css as
|
|
2
|
-
:host([disabled]) ::slotted([slot=trigger]){pointer-events:none}
|
|
3
|
-
`;export default
|
|
1
|
+
"use strict";import{css as e}from"@spectrum-web-components/base";const s=e`
|
|
2
|
+
:host([disabled]) ::slotted([slot=trigger]){pointer-events:none}slot[name=longpress-describedby-descriptor]{display:none}
|
|
3
|
+
`;export default s;
|
|
4
4
|
//# sourceMappingURL=overlay-trigger.css.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["overlay-trigger.css.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host([disabled]) ::slotted([slot=trigger]){pointer-events:none}
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host([disabled]) ::slotted([slot=trigger]){pointer-events:none}slot[name=longpress-describedby-descriptor]{display:none}\n`;\nexport default styles;"],
|
|
5
5
|
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
|
|
6
6
|
"names": ["css", "styles"]
|
|
7
7
|
}
|
package/src/overlay-types.d.ts
CHANGED
|
@@ -1,24 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Placement as FloatingUIPlacement } from '@floating-ui/dom';
|
|
1
|
+
import type { Placement } from '@floating-ui/dom';
|
|
3
2
|
import type { VirtualTrigger } from './VirtualTrigger.js';
|
|
4
|
-
export declare type
|
|
3
|
+
export declare type Constructor<T = Record<string, unknown>> = {
|
|
4
|
+
new (...args: any[]): T;
|
|
5
|
+
prototype: T;
|
|
6
|
+
};
|
|
7
|
+
export { Placement };
|
|
8
|
+
export declare type OverlayTypes = 'auto' | 'hint' | 'manual' | 'modal' | 'page';
|
|
9
|
+
export declare type TriggerInteractions = OverlayTypes;
|
|
10
|
+
export declare type TriggerInteractionsV1 = 'click' | 'longpress' | 'hover' | 'custom' | 'replace' | 'inline' | 'modal';
|
|
5
11
|
export declare type OverlayTriggerInteractions = Extract<TriggerInteractions, 'inline' | 'modal' | 'replace'>;
|
|
6
|
-
export interface OverlayOpenDetail {
|
|
7
|
-
content: HTMLElement;
|
|
8
|
-
contentTip?: HTMLElement;
|
|
9
|
-
delayed: boolean;
|
|
10
|
-
offset: number;
|
|
11
|
-
skidding?: number;
|
|
12
|
-
placement?: Placement;
|
|
13
|
-
receivesFocus?: 'auto';
|
|
14
|
-
virtualTrigger?: VirtualTrigger;
|
|
15
|
-
trigger: HTMLElement;
|
|
16
|
-
root?: HTMLElement;
|
|
17
|
-
interaction: TriggerInteractions;
|
|
18
|
-
theme: ThemeData;
|
|
19
|
-
notImmediatelyClosable?: boolean;
|
|
20
|
-
abortPromise?: Promise<boolean>;
|
|
21
|
-
}
|
|
22
12
|
export interface OverlayOpenCloseDetail {
|
|
23
13
|
interaction: TriggerInteractions;
|
|
24
14
|
reason?: 'external-click';
|
|
@@ -26,30 +16,34 @@ export interface OverlayOpenCloseDetail {
|
|
|
26
16
|
export interface OverlayCloseReasonDetail {
|
|
27
17
|
reason?: 'external-click';
|
|
28
18
|
}
|
|
29
|
-
/**
|
|
30
|
-
* Used, via an event, to query details about how an element should be shown in
|
|
31
|
-
* an overlay
|
|
32
|
-
*/
|
|
33
|
-
export interface OverlayDisplayQueryDetail {
|
|
34
|
-
overlayRootName?: string;
|
|
35
|
-
overlayRootElement?: HTMLElement;
|
|
36
|
-
overlayContentTipElement?: HTMLElement;
|
|
37
|
-
}
|
|
38
|
-
export declare type Placement = FloatingUIPlacement | 'none';
|
|
39
19
|
export declare type OverlayOptions = {
|
|
20
|
+
delayed?: boolean;
|
|
21
|
+
notImmediatelyClosable?: boolean;
|
|
22
|
+
offset?: number | [number, number];
|
|
23
|
+
placement?: Placement;
|
|
24
|
+
receivesFocus?: 'auto' | 'true' | 'false';
|
|
25
|
+
trigger?: HTMLElement | VirtualTrigger;
|
|
26
|
+
type?: 'modal' | 'page' | 'hint' | 'auto' | 'manual';
|
|
27
|
+
};
|
|
28
|
+
export declare type OverlayOptionsV1 = {
|
|
40
29
|
root?: HTMLElement;
|
|
41
30
|
delayed?: boolean;
|
|
42
31
|
placement?: Placement;
|
|
43
32
|
offset?: number;
|
|
44
|
-
receivesFocus?: 'auto';
|
|
33
|
+
receivesFocus?: 'true' | 'false' | 'auto';
|
|
45
34
|
notImmediatelyClosable?: boolean;
|
|
46
35
|
abortPromise?: Promise<boolean>;
|
|
47
36
|
virtualTrigger?: VirtualTrigger;
|
|
48
37
|
};
|
|
49
38
|
declare global {
|
|
50
39
|
interface GlobalEventHandlersEventMap {
|
|
51
|
-
'sp-overlay-query': CustomEvent<OverlayDisplayQueryDetail>;
|
|
52
40
|
'sp-open': CustomEvent<OverlayOpenCloseDetail>;
|
|
53
41
|
'sp-close': CustomEvent<OverlayOpenCloseDetail>;
|
|
54
42
|
}
|
|
55
43
|
}
|
|
44
|
+
export declare type OpenableElement = HTMLElement & {
|
|
45
|
+
open: boolean;
|
|
46
|
+
tipElement?: HTMLElement;
|
|
47
|
+
updateComplete?: Promise<void>;
|
|
48
|
+
};
|
|
49
|
+
export declare type OverlayState = 'closed' | 'opening' | 'opened' | 'closing';
|
package/src/overlay-types.dev.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [],
|
|
4
|
-
"sourcesContent": [],
|
|
5
|
-
"mappings": "",
|
|
3
|
+
"sources": ["overlay-types.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport type { Placement } from '@floating-ui/dom';\nimport type { VirtualTrigger } from './VirtualTrigger.dev.js'\n\nexport type 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 { Placement };\n\nexport type OverlayTypes = 'auto' | 'hint' | 'manual' | 'modal' | 'page';\n\nexport type TriggerInteractions = OverlayTypes;\n\nexport type TriggerInteractionsV1 =\n | 'click'\n | 'longpress'\n | 'hover'\n | 'custom'\n | 'replace'\n | 'inline'\n | 'modal';\n\nexport type OverlayTriggerInteractions = Extract<\n TriggerInteractions,\n 'inline' | 'modal' | 'replace'\n>;\n\nexport interface OverlayOpenCloseDetail {\n interaction: TriggerInteractions;\n reason?: 'external-click';\n}\n\nexport interface OverlayCloseReasonDetail {\n reason?: 'external-click';\n}\n\nexport type OverlayOptions = {\n delayed?: boolean;\n notImmediatelyClosable?: boolean;\n offset?: number | [number, number]; // supporting multi-axis\n placement?: Placement;\n receivesFocus?: 'auto' | 'true' | 'false';\n trigger?: HTMLElement | VirtualTrigger;\n type?: 'modal' | 'page' | 'hint' | 'auto' | 'manual';\n};\n\nexport type OverlayOptionsV1 = {\n root?: HTMLElement;\n delayed?: boolean;\n placement?: Placement;\n offset?: number;\n receivesFocus?: 'true' | 'false' | 'auto';\n notImmediatelyClosable?: boolean;\n abortPromise?: Promise<boolean>;\n virtualTrigger?: VirtualTrigger;\n};\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n 'sp-open': CustomEvent<OverlayOpenCloseDetail>;\n 'sp-close': CustomEvent<OverlayOpenCloseDetail>;\n }\n}\n\nexport type OpenableElement = HTMLElement & {\n open: boolean;\n tipElement?: HTMLElement;\n updateComplete?: Promise<void>;\n};\n\nexport type OverlayState = 'closed' | 'opening' | 'opened' | 'closing';\n"],
|
|
5
|
+
"mappings": ";AAqBA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/overlay-types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";export{};
|
|
2
2
|
//# sourceMappingURL=overlay-types.js.map
|
package/src/overlay-types.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [],
|
|
4
|
-
"sourcesContent": [],
|
|
5
|
-
"mappings": "",
|
|
3
|
+
"sources": ["overlay-types.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport type { Placement } from '@floating-ui/dom';\nimport type { VirtualTrigger } from './VirtualTrigger.js';\n\nexport type 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 { Placement };\n\nexport type OverlayTypes = 'auto' | 'hint' | 'manual' | 'modal' | 'page';\n\nexport type TriggerInteractions = OverlayTypes;\n\nexport type TriggerInteractionsV1 =\n | 'click'\n | 'longpress'\n | 'hover'\n | 'custom'\n | 'replace'\n | 'inline'\n | 'modal';\n\nexport type OverlayTriggerInteractions = Extract<\n TriggerInteractions,\n 'inline' | 'modal' | 'replace'\n>;\n\nexport interface OverlayOpenCloseDetail {\n interaction: TriggerInteractions;\n reason?: 'external-click';\n}\n\nexport interface OverlayCloseReasonDetail {\n reason?: 'external-click';\n}\n\nexport type OverlayOptions = {\n delayed?: boolean;\n notImmediatelyClosable?: boolean;\n offset?: number | [number, number]; // supporting multi-axis\n placement?: Placement;\n receivesFocus?: 'auto' | 'true' | 'false';\n trigger?: HTMLElement | VirtualTrigger;\n type?: 'modal' | 'page' | 'hint' | 'auto' | 'manual';\n};\n\nexport type OverlayOptionsV1 = {\n root?: HTMLElement;\n delayed?: boolean;\n placement?: Placement;\n offset?: number;\n receivesFocus?: 'true' | 'false' | 'auto';\n notImmediatelyClosable?: boolean;\n abortPromise?: Promise<boolean>;\n virtualTrigger?: VirtualTrigger;\n};\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n 'sp-open': CustomEvent<OverlayOpenCloseDetail>;\n 'sp-close': CustomEvent<OverlayOpenCloseDetail>;\n }\n}\n\nexport type OpenableElement = HTMLElement & {\n open: boolean;\n tipElement?: HTMLElement;\n updateComplete?: Promise<void>;\n};\n\nexport type OverlayState = 'closed' | 'opening' | 'opened' | 'closing';\n"],
|
|
5
|
+
"mappings": "aAqBA",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { css } from "@spectrum-web-components/base";
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host{--swc-overlay-animation-distance:var(
|
|
5
|
+
--spectrum-picker-m-texticon-popover-offset-y,var(--spectrum-global-dimension-size-75)
|
|
6
|
+
);display:contents;pointer-events:none}.dialog{--sp-overlay-open:true;background:none;border:0;box-sizing:border-box;display:flex;height:auto;inset:auto;left:0;margin:0;max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);max-width:calc(100vw - 16px);opacity:1!important;overflow:visible;padding:0;position:fixed;top:0}.dialog:not([is-visible]){translate:-999em -999em!important}.dialog:focus{outline:none}dialog:modal{--mod-popover-filter:var(--spectrum-popover-filter)}:host(:not([open])) .dialog{--sp-overlay-open:false}.dialog::backdrop{display:none}.dialog:before{content:"";inset:-999em;pointer-events:auto!important;position:absolute}.dialog:not(.not-immediately-closable):before{display:none}.dialog>div{width:100%}::slotted(*){pointer-events:auto}::slotted(sp-popover){position:static}::slotted(sp-tooltip){--swc-tooltip-margin:0}.dialog:not([actual-placement])[placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}slot[name=longpress-describedby-descriptor]{display:none}@supports selector(:open){.dialog{opacity:0}.dialog:open{--mod-popover-filter:var(--spectrum-popover-filter);opacity:1}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{--mod-popover-filter:var(--spectrum-popover-filter);opacity:1}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:calc(var(--swc-overlay-z-index-base, 1000) + var(--swc-overlay-open-count))}}
|
|
7
|
+
`;
|
|
8
|
+
export default styles;
|
|
9
|
+
//# sourceMappingURL=overlay.css.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["overlay.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--swc-overlay-animation-distance:var(\n--spectrum-picker-m-texticon-popover-offset-y,var(--spectrum-global-dimension-size-75)\n);display:contents;pointer-events:none}.dialog{--sp-overlay-open:true;background:none;border:0;box-sizing:border-box;display:flex;height:auto;inset:auto;left:0;margin:0;max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);max-width:calc(100vw - 16px);opacity:1!important;overflow:visible;padding:0;position:fixed;top:0}.dialog:not([is-visible]){translate:-999em -999em!important}.dialog:focus{outline:none}dialog:modal{--mod-popover-filter:var(--spectrum-popover-filter)}:host(:not([open])) .dialog{--sp-overlay-open:false}.dialog::backdrop{display:none}.dialog:before{content:\"\";inset:-999em;pointer-events:auto!important;position:absolute}.dialog:not(.not-immediately-closable):before{display:none}.dialog>div{width:100%}::slotted(*){pointer-events:auto}::slotted(sp-popover){position:static}::slotted(sp-tooltip){--swc-tooltip-margin:0}.dialog:not([actual-placement])[placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}slot[name=longpress-describedby-descriptor]{display:none}@supports selector(:open){.dialog{opacity:0}.dialog:open{--mod-popover-filter:var(--spectrum-popover-filter);opacity:1}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{--mod-popover-filter:var(--spectrum-popover-filter);opacity:1}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:calc(var(--swc-overlay-z-index-base, 1000) + var(--swc-overlay-open-count))}}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAKf,eAAe;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|