@spectrum-web-components/overlay 0.37.0 → 0.39.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 +12 -1
- package/custom-elements.json +29 -12
- package/package.json +7 -7
- package/src/AbstractOverlay.d.ts +15 -2
- package/src/AbstractOverlay.dev.js +4 -2
- package/src/AbstractOverlay.dev.js.map +2 -2
- package/src/AbstractOverlay.js +1 -1
- package/src/AbstractOverlay.js.map +3 -3
- package/src/Overlay.d.ts +0 -1
- package/src/Overlay.dev.js +1 -2
- package/src/Overlay.dev.js.map +2 -2
- package/src/Overlay.js +1 -1
- package/src/Overlay.js.map +2 -2
- package/src/OverlayDialog.dev.js +4 -0
- package/src/OverlayDialog.dev.js.map +2 -2
- package/src/OverlayDialog.js +1 -1
- package/src/OverlayDialog.js.map +3 -3
- package/src/OverlayNoPopover.dev.js +4 -0
- package/src/OverlayNoPopover.dev.js.map +2 -2
- package/src/OverlayNoPopover.js +1 -1
- package/src/OverlayNoPopover.js.map +3 -3
- package/src/OverlayPopover.dev.js +38 -12
- package/src/OverlayPopover.dev.js.map +2 -2
- package/src/OverlayPopover.js +1 -1
- package/src/OverlayPopover.js.map +3 -3
- package/src/VirtualTrigger.dev.js +2 -2
- package/src/VirtualTrigger.dev.js.map +2 -2
- package/src/VirtualTrigger.js +1 -1
- package/src/VirtualTrigger.js.map +3 -3
- package/src/loader.d.ts +4 -1
- package/src/loader.dev.js +8 -1
- package/src/loader.dev.js.map +2 -2
- package/src/loader.js +1 -1
- package/src/loader.js.map +3 -3
- package/src/topLayerOverTransforms.dev.js +6 -1
- package/src/topLayerOverTransforms.dev.js.map +2 -2
- package/src/topLayerOverTransforms.js +1 -1
- package/src/topLayerOverTransforms.js.map +3 -3
- package/stories/overlay-element.stories.js +66 -0
- package/stories/overlay-element.stories.js.map +3 -3
- package/test/overlay-element.test.js +13 -0
- package/test/overlay-element.test.js.map +2 -2
- package/test/overlay-lifecycle.test.js +18 -7
- package/test/overlay-lifecycle.test.js.map +2 -2
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ By leveraging the `trigger` attribute to pass an ID reference to another element
|
|
|
31
31
|
|
|
32
32
|
```html
|
|
33
33
|
<sp-button id="trigger">Overlay Trigger</sp-button>
|
|
34
|
-
<sp-overlay trigger="trigger@click">
|
|
34
|
+
<sp-overlay trigger="trigger@click" placement="bottom">
|
|
35
35
|
<sp-popover>
|
|
36
36
|
<sp-dialog>
|
|
37
37
|
<h2 slot="heading">Clicking opens this popover...</h2>
|
|
@@ -315,3 +315,14 @@ Here, again, working with your content needs (whether or not you want to leverag
|
|
|
315
315
|
}
|
|
316
316
|
</style>
|
|
317
317
|
```
|
|
318
|
+
|
|
319
|
+
### Non-overflowing, relative containers with z-index in Safari
|
|
320
|
+
|
|
321
|
+
Under very specific conditions, [WebKit will incorrectly clip fixed-position content](https://bugs.webkit.org/show_bug.cgi?id=160953).
|
|
322
|
+
WebKit clips `position: fixed` elements within containers that have all of:
|
|
323
|
+
|
|
324
|
+
1. `position: relative`
|
|
325
|
+
2. `overflow: clip` or `overflow: hidden`
|
|
326
|
+
3. `z-index` greater than zero
|
|
327
|
+
|
|
328
|
+
If you notice overlay clipping _only_ in Safari, this is likely the culprit. The solution is to break up the conditions into separate elements to avoid triggering WebKit's bug. For example, leaving relative positioning and z-index on the outermost container while creating an inner container that enforces the overflow rules.
|
package/custom-elements.json
CHANGED
|
@@ -188,7 +188,7 @@
|
|
|
188
188
|
},
|
|
189
189
|
{
|
|
190
190
|
"kind": "class",
|
|
191
|
-
"description": "",
|
|
191
|
+
"description": "Abstract Overlay base class so that property tyings and imperative API\ninterfaces can be held separate from the actual class definition.",
|
|
192
192
|
"name": "AbstractOverlay",
|
|
193
193
|
"members": [
|
|
194
194
|
{
|
|
@@ -325,6 +325,15 @@
|
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
},
|
|
328
|
+
{
|
|
329
|
+
"kind": "field",
|
|
330
|
+
"name": "offset",
|
|
331
|
+
"type": {
|
|
332
|
+
"text": "number | [number, number]"
|
|
333
|
+
},
|
|
334
|
+
"privacy": "protected",
|
|
335
|
+
"default": "6"
|
|
336
|
+
},
|
|
328
337
|
{
|
|
329
338
|
"kind": "field",
|
|
330
339
|
"name": "open",
|
|
@@ -332,6 +341,13 @@
|
|
|
332
341
|
"text": "boolean"
|
|
333
342
|
}
|
|
334
343
|
},
|
|
344
|
+
{
|
|
345
|
+
"kind": "field",
|
|
346
|
+
"name": "placement",
|
|
347
|
+
"type": {
|
|
348
|
+
"text": "Placement | undefined"
|
|
349
|
+
}
|
|
350
|
+
},
|
|
335
351
|
{
|
|
336
352
|
"kind": "field",
|
|
337
353
|
"name": "placementController",
|
|
@@ -376,6 +392,14 @@
|
|
|
376
392
|
"text": "OverlayTypes"
|
|
377
393
|
}
|
|
378
394
|
},
|
|
395
|
+
{
|
|
396
|
+
"kind": "field",
|
|
397
|
+
"name": "willPreventClose",
|
|
398
|
+
"type": {
|
|
399
|
+
"text": "boolean"
|
|
400
|
+
},
|
|
401
|
+
"default": "false"
|
|
402
|
+
},
|
|
379
403
|
{
|
|
380
404
|
"kind": "method",
|
|
381
405
|
"name": "manuallyKeepOpen",
|
|
@@ -421,7 +445,8 @@
|
|
|
421
445
|
"text": "OverlayOptionsV1"
|
|
422
446
|
}
|
|
423
447
|
}
|
|
424
|
-
]
|
|
448
|
+
],
|
|
449
|
+
"description": "Overloaded imperative API entry point that allows for both the pre-0.37.0\nargument signature as well as the post-0.37.0 signature. This allows for\nconsumers to continue to leverage it as they had been in previous releases\nwhile also surfacing the more feature-rich API that has been made available."
|
|
425
450
|
},
|
|
426
451
|
{
|
|
427
452
|
"kind": "method",
|
|
@@ -1187,15 +1212,6 @@
|
|
|
1187
1212
|
}
|
|
1188
1213
|
}
|
|
1189
1214
|
},
|
|
1190
|
-
{
|
|
1191
|
-
"kind": "field",
|
|
1192
|
-
"name": "willPreventClose",
|
|
1193
|
-
"type": {
|
|
1194
|
-
"text": "boolean"
|
|
1195
|
-
},
|
|
1196
|
-
"privacy": "public",
|
|
1197
|
-
"default": "false"
|
|
1198
|
-
},
|
|
1199
1215
|
{
|
|
1200
1216
|
"kind": "method",
|
|
1201
1217
|
"name": "shouldPreventClose",
|
|
@@ -1607,7 +1623,8 @@
|
|
|
1607
1623
|
"text": "boolean"
|
|
1608
1624
|
}
|
|
1609
1625
|
}
|
|
1610
|
-
]
|
|
1626
|
+
],
|
|
1627
|
+
"description": "A popover should be hidden _after_ it is no longer on top-layer because\nthe position metrics will have changed from when it was originally positioned."
|
|
1611
1628
|
},
|
|
1612
1629
|
{
|
|
1613
1630
|
"kind": "method",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/overlay",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -128,11 +128,11 @@
|
|
|
128
128
|
"dependencies": {
|
|
129
129
|
"@floating-ui/dom": "^1.5.1",
|
|
130
130
|
"@floating-ui/utils": "^0.1.1",
|
|
131
|
-
"@spectrum-web-components/action-button": "^0.
|
|
132
|
-
"@spectrum-web-components/base": "^0.
|
|
133
|
-
"@spectrum-web-components/reactive-controllers": "^0.
|
|
134
|
-
"@spectrum-web-components/shared": "^0.
|
|
135
|
-
"@spectrum-web-components/theme": "^0.
|
|
131
|
+
"@spectrum-web-components/action-button": "^0.39.0",
|
|
132
|
+
"@spectrum-web-components/base": "^0.39.0",
|
|
133
|
+
"@spectrum-web-components/reactive-controllers": "^0.39.0",
|
|
134
|
+
"@spectrum-web-components/shared": "^0.39.0",
|
|
135
|
+
"@spectrum-web-components/theme": "^0.39.0"
|
|
136
136
|
},
|
|
137
137
|
"types": "./src/index.d.ts",
|
|
138
138
|
"customElements": "custom-elements.json",
|
|
@@ -144,5 +144,5 @@
|
|
|
144
144
|
"./stories/overlay-story-components.js",
|
|
145
145
|
"./**/*.dev.js"
|
|
146
146
|
],
|
|
147
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "2acc8390ef0ac6cc940958d4da705c9859155c0d"
|
|
148
148
|
}
|
package/src/AbstractOverlay.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SpectrumElement } from '@spectrum-web-components/base';
|
|
2
|
-
import type { OpenableElement, OverlayOptions, OverlayOptionsV1, OverlayState, OverlayTypes, TriggerInteractionsV1 } from './overlay-types.js';
|
|
3
|
-
import { Overlay } from './Overlay.js';
|
|
2
|
+
import type { OpenableElement, OverlayOptions, OverlayOptionsV1, OverlayState, OverlayTypes, Placement, TriggerInteractionsV1 } from './overlay-types.js';
|
|
3
|
+
import type { Overlay } from './Overlay.js';
|
|
4
4
|
import type { VirtualTrigger } from './VirtualTrigger.js';
|
|
5
5
|
import { OverlayTimer } from './overlay-timer.js';
|
|
6
6
|
import { PlacementController } from './PlacementController.js';
|
|
@@ -27,6 +27,10 @@ export declare class BeforetoggleOpenEvent extends Event {
|
|
|
27
27
|
export declare const guaranteedAllTransitionend: (el: HTMLElement, action: () => void, cb: () => void) => void;
|
|
28
28
|
export declare function nextFrame(): Promise<void>;
|
|
29
29
|
export declare function forcePaint(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Abstract Overlay base class so that property tyings and imperative API
|
|
32
|
+
* interfaces can be held separate from the actual class definition.
|
|
33
|
+
*/
|
|
30
34
|
export declare class AbstractOverlay extends SpectrumElement {
|
|
31
35
|
protected applyFocus(_targetOpenState: boolean, _focusEl: HTMLElement | null): Promise<void>;
|
|
32
36
|
delayed: boolean;
|
|
@@ -42,8 +46,10 @@ export declare class AbstractOverlay extends SpectrumElement {
|
|
|
42
46
|
protected manageDialogOpen(): Promise<void>;
|
|
43
47
|
protected managePopoverOpen(): Promise<void>;
|
|
44
48
|
protected managePosition(): void;
|
|
49
|
+
protected offset: number | [number, number];
|
|
45
50
|
get open(): boolean;
|
|
46
51
|
set open(_open: boolean);
|
|
52
|
+
placement?: Placement;
|
|
47
53
|
protected placementController: PlacementController;
|
|
48
54
|
receivesFocus: 'true' | 'false' | 'auto';
|
|
49
55
|
get state(): OverlayState;
|
|
@@ -51,8 +57,15 @@ export declare class AbstractOverlay extends SpectrumElement {
|
|
|
51
57
|
protected _state: OverlayState;
|
|
52
58
|
triggerElement: HTMLElement | VirtualTrigger | null;
|
|
53
59
|
type: OverlayTypes;
|
|
60
|
+
willPreventClose: boolean;
|
|
54
61
|
manuallyKeepOpen(): void;
|
|
55
62
|
static update(): void;
|
|
63
|
+
/**
|
|
64
|
+
* Overloaded imperative API entry point that allows for both the pre-0.37.0
|
|
65
|
+
* argument signature as well as the post-0.37.0 signature. This allows for
|
|
66
|
+
* consumers to continue to leverage it as they had been in previous releases
|
|
67
|
+
* while also surfacing the more feature-rich API that has been made available.
|
|
68
|
+
*/
|
|
56
69
|
static open(trigger: HTMLElement, interaction: TriggerInteractionsV1, content: HTMLElement, optionsV1: OverlayOptionsV1): Promise<() => void>;
|
|
57
70
|
static open(content: HTMLElement, options?: OverlayOptions): Promise<Overlay>;
|
|
58
71
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { SpectrumElement } from "@spectrum-web-components/base";
|
|
3
3
|
import { reparentChildren } from "@spectrum-web-components/shared/src/reparent-children.js";
|
|
4
|
-
import { Overlay } from "./Overlay.dev.js";
|
|
5
4
|
import { OverlayTimer } from "./overlay-timer.dev.js";
|
|
6
5
|
export const overlayTimer = new OverlayTimer();
|
|
7
6
|
export const noop = () => {
|
|
@@ -94,6 +93,8 @@ export class AbstractOverlay extends SpectrumElement {
|
|
|
94
93
|
constructor() {
|
|
95
94
|
super(...arguments);
|
|
96
95
|
this.dispose = noop;
|
|
96
|
+
this.offset = 6;
|
|
97
|
+
this.willPreventClose = false;
|
|
97
98
|
}
|
|
98
99
|
async applyFocus(_targetOpenState, _focusEl) {
|
|
99
100
|
return;
|
|
@@ -141,9 +142,10 @@ export class AbstractOverlay extends SpectrumElement {
|
|
|
141
142
|
}
|
|
142
143
|
static async open(triggerOrContent, interactionOrOptions, content, optionsV1) {
|
|
143
144
|
var _a, _b, _c, _d;
|
|
145
|
+
await import("@spectrum-web-components/overlay/sp-overlay.js");
|
|
144
146
|
const v2 = arguments.length === 2;
|
|
145
147
|
const overlayContent = content || triggerOrContent;
|
|
146
|
-
const overlay = new
|
|
148
|
+
const overlay = new this();
|
|
147
149
|
let restored = false;
|
|
148
150
|
overlay.dispose = () => {
|
|
149
151
|
overlay.addEventListener("sp-closed", () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["AbstractOverlay.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { SpectrumElement } from '@spectrum-web-components/base';\nimport { reparentChildren } from '@spectrum-web-components/shared/src/reparent-children.js';\n\nimport type {\n OpenableElement,\n OverlayOptions,\n OverlayOptionsV1,\n OverlayState,\n OverlayTypes,\n TriggerInteractionsV1,\n} from './overlay-types.dev.js'\nimport { Overlay } from './Overlay.dev.js'\nimport type { VirtualTrigger } from './VirtualTrigger.dev.js'\nimport { OverlayTimer } from './overlay-timer.dev.js'\nimport { PlacementController } from './PlacementController.dev.js'\n\nexport const overlayTimer = new OverlayTimer();\n\nexport const noop = (): void => {\n return;\n};\n\nexport class BeforetoggleClosedEvent extends Event {\n currentState = 'open';\n newState = 'closed';\n constructor() {\n super('beforetoggle', {\n bubbles: false,\n composed: false,\n });\n }\n}\n\nexport class BeforetoggleOpenEvent extends Event {\n currentState = 'closed';\n newState = 'open';\n constructor() {\n super('beforetoggle', {\n bubbles: false,\n composed: false,\n });\n }\n}\n\n/**\n * Apply a \"transitionend\" listener to an element that may not transition but\n * guarantee the callback will be fired either way.\n *\n * @param el {HTMLElement} - Target of the \"transition\" listeners.\n * @param action {Function} - Method to trigger the \"transition\".\n * @param cb {Function} - Callback to trigger when the \"transition\" has ended.\n */\nexport const guaranteedAllTransitionend = (\n el: HTMLElement,\n action: () => void,\n cb: () => void\n): void => {\n const abortController = new AbortController();\n const runningTransitions = new Map<string, number>();\n const cleanup = (): void => {\n abortController.abort();\n cb();\n };\n let guarantee2: number;\n let guarantee3: number;\n // WebKit fires `transitionrun` a little earlier, the multiple guarantees here\n // allow WebKit to be caught, but doesn't remove the animation listener until\n // after it would have fired in Chromium.\n const guarantee1 = requestAnimationFrame(() => {\n guarantee2 = requestAnimationFrame(() => {\n guarantee3 = requestAnimationFrame(() => {\n cleanup();\n });\n });\n });\n const handleTransitionend = (event: TransitionEvent): void => {\n if (event.target !== el) {\n return;\n }\n runningTransitions.set(\n event.propertyName,\n (runningTransitions.get(event.propertyName) as number) - 1\n );\n if (!runningTransitions.get(event.propertyName)) {\n runningTransitions.delete(event.propertyName);\n }\n if (runningTransitions.size === 0) {\n cleanup();\n }\n };\n const handleTransitionrun = (event: TransitionEvent): void => {\n if (event.target !== el) {\n return;\n }\n if (!runningTransitions.has(event.propertyName)) {\n runningTransitions.set(event.propertyName, 0);\n }\n runningTransitions.set(\n event.propertyName,\n (runningTransitions.get(event.propertyName) as number) + 1\n );\n cancelAnimationFrame(guarantee1);\n cancelAnimationFrame(guarantee2);\n cancelAnimationFrame(guarantee3);\n };\n el.addEventListener('transitionrun', handleTransitionrun, {\n signal: abortController.signal,\n });\n el.addEventListener('transitionend', handleTransitionend, {\n signal: abortController.signal,\n });\n el.addEventListener('transitioncancel', handleTransitionend, {\n signal: abortController.signal,\n });\n action();\n};\n\nexport function nextFrame(): Promise<void> {\n return new Promise((res) => requestAnimationFrame(() => res()));\n}\n\nexport function forcePaint(): void {\n // force the browser to paint\n document.body.offsetHeight;\n}\n\nexport class AbstractOverlay extends SpectrumElement {\n protected async applyFocus(\n _targetOpenState: boolean,\n _focusEl: HTMLElement | null\n ): Promise<void> {\n return;\n }\n delayed!: boolean;\n dialogEl!: HTMLDialogElement & {\n showPopover(): void;\n hidePopover(): void;\n };\n dispose = noop;\n protected async ensureOnDOM(_targetOpenState: boolean): Promise<void> {\n return;\n }\n elements!: OpenableElement[];\n protected async makeTransition(\n _targetOpenState: boolean\n ): Promise<HTMLElement | null> {\n return null;\n }\n protected async manageDelay(_targetOpenState: boolean): Promise<void> {\n return;\n }\n protected async manageDialogOpen(): Promise<void> {\n return;\n }\n protected async managePopoverOpen(): Promise<void> {\n return;\n }\n protected managePosition(): void {\n return;\n }\n get open(): boolean {\n return false;\n }\n set open(_open: boolean) {\n return;\n }\n protected placementController!: PlacementController;\n receivesFocus!: 'true' | 'false' | 'auto';\n get state(): OverlayState {\n return 'closed';\n }\n set state(_state: OverlayState) {\n return;\n }\n protected _state!: OverlayState;\n triggerElement!: HTMLElement | VirtualTrigger | null;\n type!: OverlayTypes;\n\n public manuallyKeepOpen(): void {\n return;\n }\n\n public static update(): void {\n const overlayUpdateEvent = new CustomEvent('sp-update-overlays', {\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n document.dispatchEvent(overlayUpdateEvent);\n }\n\n public static async open(\n trigger: HTMLElement,\n interaction: TriggerInteractionsV1,\n content: HTMLElement,\n optionsV1: OverlayOptionsV1\n ): Promise<() => void>;\n public static async open(\n content: HTMLElement,\n options?: OverlayOptions\n ): Promise<Overlay>;\n public static async open(\n triggerOrContent: HTMLElement,\n interactionOrOptions:\n | TriggerInteractionsV1\n | OverlayOptions\n | undefined,\n content?: HTMLElement,\n optionsV1?: OverlayOptionsV1\n ): Promise<Overlay | (() => void)> {\n const v2 = arguments.length === 2;\n const overlayContent = content || triggerOrContent;\n const overlay = new Overlay();\n let restored = false;\n overlay.dispose = () => {\n overlay.addEventListener('sp-closed', () => {\n if (!restored) {\n restoreContent();\n restored = true;\n }\n requestAnimationFrame(() => {\n overlay.remove();\n });\n });\n overlay.open = false;\n overlay.dispose = noop;\n };\n /**\n * Since content must exist in an <sp-overlay>, we need a way to get it there.\n * The best & most-direct way is to declaratively use an <sp-overlay> element,\n * but for imperative users, we'll reparent content into an overlay that we've created for them.\n **/\n const restoreContent = reparentChildren([overlayContent], overlay, {\n position: 'beforeend',\n prepareCallback: (el) => {\n // Ensure that content to be overlaid is no longer targetted to a specific `slot`.\n // This allow for it to be visible in the overlaid context.\n const slot = el.slot;\n el.removeAttribute('slot');\n return () => {\n el.slot = slot;\n };\n },\n });\n\n const v1 = !v2 && overlayContent && optionsV1;\n if (v1) {\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n overlay,\n `You are interacting with an ${overlay.localName} element via a deprecated imperative API. This API will be removed in a future version of the SWC library. Consider leveraging an ${overlay.localName} directly.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/overlay/',\n { level: 'deprecation' }\n );\n }\n const trigger = triggerOrContent;\n const interaction = interactionOrOptions;\n const options = optionsV1;\n overlay.delayed =\n options.delayed || overlayContent.hasAttribute('delayed');\n overlay.receivesFocus = options.receivesFocus ?? 'auto';\n overlay.triggerElement = options.virtualTrigger || trigger;\n overlay.type =\n interaction === 'modal'\n ? 'modal'\n : interaction === 'hover'\n ? 'hint'\n : 'auto';\n overlay.offset = options.offset ?? 6;\n overlay.placement = options.placement;\n overlay.willPreventClose = !!options.notImmediatelyClosable;\n trigger.insertAdjacentElement('afterend', overlay);\n await overlay.updateComplete;\n overlay.open = true;\n return overlay.dispose;\n }\n\n const options = interactionOrOptions as OverlayOptions;\n overlay.append(overlayContent);\n overlay.delayed =\n options.delayed || overlayContent.hasAttribute('delayed');\n overlay.receivesFocus = options.receivesFocus ?? 'auto';\n overlay.triggerElement = options.trigger || null;\n overlay.type = options.type || 'modal';\n overlay.offset = options.offset ?? 6;\n overlay.placement = options.placement;\n overlay.willPreventClose = !!options.notImmediatelyClosable;\n overlay.updateComplete.then(() => {\n // Do we want to \"open\" this path, or leave that to the consumer?\n overlay.open = true;\n });\n return overlay;\n }\n}\n"],
|
|
5
|
-
"mappings": ";AAWA,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { SpectrumElement } from '@spectrum-web-components/base';\nimport { reparentChildren } from '@spectrum-web-components/shared/src/reparent-children.js';\n\nimport type {\n OpenableElement,\n OverlayOptions,\n OverlayOptionsV1,\n OverlayState,\n OverlayTypes,\n Placement,\n TriggerInteractionsV1,\n} from './overlay-types.dev.js'\nimport type { Overlay } from './Overlay.dev.js'\nimport type { VirtualTrigger } from './VirtualTrigger.dev.js'\nimport { OverlayTimer } from './overlay-timer.dev.js'\nimport { PlacementController } from './PlacementController.dev.js'\n\nexport const overlayTimer = new OverlayTimer();\n\nexport const noop = (): void => {\n return;\n};\n\nexport class BeforetoggleClosedEvent extends Event {\n currentState = 'open';\n newState = 'closed';\n constructor() {\n super('beforetoggle', {\n bubbles: false,\n composed: false,\n });\n }\n}\n\nexport class BeforetoggleOpenEvent extends Event {\n currentState = 'closed';\n newState = 'open';\n constructor() {\n super('beforetoggle', {\n bubbles: false,\n composed: false,\n });\n }\n}\n\n/**\n * Apply a \"transitionend\" listener to an element that may not transition but\n * guarantee the callback will be fired either way.\n *\n * @param el {HTMLElement} - Target of the \"transition\" listeners.\n * @param action {Function} - Method to trigger the \"transition\".\n * @param cb {Function} - Callback to trigger when the \"transition\" has ended.\n */\nexport const guaranteedAllTransitionend = (\n el: HTMLElement,\n action: () => void,\n cb: () => void\n): void => {\n const abortController = new AbortController();\n const runningTransitions = new Map<string, number>();\n const cleanup = (): void => {\n abortController.abort();\n cb();\n };\n let guarantee2: number;\n let guarantee3: number;\n // WebKit fires `transitionrun` a little earlier, the multiple guarantees here\n // allow WebKit to be caught, but doesn't remove the animation listener until\n // after it would have fired in Chromium.\n const guarantee1 = requestAnimationFrame(() => {\n guarantee2 = requestAnimationFrame(() => {\n guarantee3 = requestAnimationFrame(() => {\n cleanup();\n });\n });\n });\n const handleTransitionend = (event: TransitionEvent): void => {\n if (event.target !== el) {\n return;\n }\n runningTransitions.set(\n event.propertyName,\n (runningTransitions.get(event.propertyName) as number) - 1\n );\n if (!runningTransitions.get(event.propertyName)) {\n runningTransitions.delete(event.propertyName);\n }\n if (runningTransitions.size === 0) {\n cleanup();\n }\n };\n const handleTransitionrun = (event: TransitionEvent): void => {\n if (event.target !== el) {\n return;\n }\n if (!runningTransitions.has(event.propertyName)) {\n runningTransitions.set(event.propertyName, 0);\n }\n runningTransitions.set(\n event.propertyName,\n (runningTransitions.get(event.propertyName) as number) + 1\n );\n cancelAnimationFrame(guarantee1);\n cancelAnimationFrame(guarantee2);\n cancelAnimationFrame(guarantee3);\n };\n el.addEventListener('transitionrun', handleTransitionrun, {\n signal: abortController.signal,\n });\n el.addEventListener('transitionend', handleTransitionend, {\n signal: abortController.signal,\n });\n el.addEventListener('transitioncancel', handleTransitionend, {\n signal: abortController.signal,\n });\n action();\n};\n\nexport function nextFrame(): Promise<void> {\n return new Promise((res) => requestAnimationFrame(() => res()));\n}\n\nexport function forcePaint(): void {\n // force the browser to paint\n document.body.offsetHeight;\n}\n\n/**\n * Abstract Overlay base class so that property tyings and imperative API\n * interfaces can be held separate from the actual class definition.\n */\nexport class AbstractOverlay extends SpectrumElement {\n protected async applyFocus(\n _targetOpenState: boolean,\n _focusEl: HTMLElement | null\n ): Promise<void> {\n return;\n }\n delayed!: boolean;\n dialogEl!: HTMLDialogElement & {\n showPopover(): void;\n hidePopover(): void;\n };\n dispose = noop;\n protected async ensureOnDOM(_targetOpenState: boolean): Promise<void> {\n return;\n }\n elements!: OpenableElement[];\n protected async makeTransition(\n _targetOpenState: boolean\n ): Promise<HTMLElement | null> {\n return null;\n }\n protected async manageDelay(_targetOpenState: boolean): Promise<void> {\n return;\n }\n protected async manageDialogOpen(): Promise<void> {\n return;\n }\n protected async managePopoverOpen(): Promise<void> {\n return;\n }\n protected managePosition(): void {\n return;\n }\n protected offset: number | [number, number] = 6;\n get open(): boolean {\n return false;\n }\n set open(_open: boolean) {\n return;\n }\n placement?: Placement;\n protected placementController!: PlacementController;\n receivesFocus!: 'true' | 'false' | 'auto';\n get state(): OverlayState {\n return 'closed';\n }\n set state(_state: OverlayState) {\n return;\n }\n protected _state!: OverlayState;\n triggerElement!: HTMLElement | VirtualTrigger | null;\n type!: OverlayTypes;\n willPreventClose = false;\n\n public manuallyKeepOpen(): void {\n return;\n }\n\n public static update(): void {\n const overlayUpdateEvent = new CustomEvent('sp-update-overlays', {\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n document.dispatchEvent(overlayUpdateEvent);\n }\n\n /**\n * Overloaded imperative API entry point that allows for both the pre-0.37.0\n * argument signature as well as the post-0.37.0 signature. This allows for\n * consumers to continue to leverage it as they had been in previous releases\n * while also surfacing the more feature-rich API that has been made available.\n */\n public static async open(\n trigger: HTMLElement,\n interaction: TriggerInteractionsV1,\n content: HTMLElement,\n optionsV1: OverlayOptionsV1\n ): Promise<() => void>;\n public static async open(\n content: HTMLElement,\n options?: OverlayOptions\n ): Promise<Overlay>;\n public static async open(\n triggerOrContent: HTMLElement,\n interactionOrOptions:\n | TriggerInteractionsV1\n | OverlayOptions\n | undefined,\n content?: HTMLElement,\n optionsV1?: OverlayOptionsV1\n ): Promise<Overlay | (() => void)> {\n await import('@spectrum-web-components/overlay/sp-overlay.js');\n const v2 = arguments.length === 2;\n const overlayContent = content || triggerOrContent;\n // Use the `this` from the `static` method context rather than a\n // specific imported constructor to prevent opening a circular dependency.\n const overlay = new this() as Overlay;\n let restored = false;\n overlay.dispose = () => {\n overlay.addEventListener('sp-closed', () => {\n if (!restored) {\n restoreContent();\n restored = true;\n }\n requestAnimationFrame(() => {\n overlay.remove();\n });\n });\n overlay.open = false;\n overlay.dispose = noop;\n };\n /**\n * Since content must exist in an <sp-overlay>, we need a way to get it there.\n * The best & most-direct way is to declaratively use an <sp-overlay> element,\n * but for imperative users, we'll reparent content into an overlay that we've created for them.\n **/\n const restoreContent = reparentChildren([overlayContent], overlay, {\n position: 'beforeend',\n prepareCallback: (el) => {\n // Ensure that content to be overlaid is no longer targetted to a specific `slot`.\n // This allow for it to be visible in the overlaid context.\n const slot = el.slot;\n el.removeAttribute('slot');\n return () => {\n el.slot = slot;\n };\n },\n });\n\n const v1 = !v2 && overlayContent && optionsV1;\n if (v1) {\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n overlay,\n `You are interacting with an ${overlay.localName} element via a deprecated imperative API. This API will be removed in a future version of the SWC library. Consider leveraging an ${overlay.localName} directly.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/overlay/',\n { level: 'deprecation' }\n );\n }\n const trigger = triggerOrContent;\n const interaction = interactionOrOptions;\n const options = optionsV1;\n overlay.delayed =\n options.delayed || overlayContent.hasAttribute('delayed');\n overlay.receivesFocus = options.receivesFocus ?? 'auto';\n overlay.triggerElement = options.virtualTrigger || trigger;\n overlay.type =\n interaction === 'modal'\n ? 'modal'\n : interaction === 'hover'\n ? 'hint'\n : 'auto';\n overlay.offset = options.offset ?? 6;\n overlay.placement = options.placement;\n overlay.willPreventClose = !!options.notImmediatelyClosable;\n trigger.insertAdjacentElement('afterend', overlay);\n await overlay.updateComplete;\n overlay.open = true;\n return overlay.dispose;\n }\n\n const options = interactionOrOptions as OverlayOptions;\n overlay.append(overlayContent);\n overlay.delayed =\n options.delayed || overlayContent.hasAttribute('delayed');\n overlay.receivesFocus = options.receivesFocus ?? 'auto';\n overlay.triggerElement = options.trigger || null;\n overlay.type = options.type || 'modal';\n overlay.offset = options.offset ?? 6;\n overlay.placement = options.placement;\n overlay.willPreventClose = !!options.notImmediatelyClosable;\n overlay.updateComplete.then(() => {\n // Do we want to \"open\" this path, or leave that to the consumer?\n overlay.open = true;\n });\n return overlay;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AAajC,SAAS,oBAAoB;AAGtB,aAAM,eAAe,IAAI,aAAa;AAEtC,aAAM,OAAO,MAAY;AAC5B;AACJ;AAEO,aAAM,gCAAgC,MAAM;AAAA,EAG/C,cAAc;AACV,UAAM,gBAAgB;AAAA,MAClB,SAAS;AAAA,MACT,UAAU;AAAA,IACd,CAAC;AANL,wBAAe;AACf,oBAAW;AAAA,EAMX;AACJ;AAEO,aAAM,8BAA8B,MAAM;AAAA,EAG7C,cAAc;AACV,UAAM,gBAAgB;AAAA,MAClB,SAAS;AAAA,MACT,UAAU;AAAA,IACd,CAAC;AANL,wBAAe;AACf,oBAAW;AAAA,EAMX;AACJ;AAUO,aAAM,6BAA6B,CACtC,IACA,QACA,OACO;AACP,QAAM,kBAAkB,IAAI,gBAAgB;AAC5C,QAAM,qBAAqB,oBAAI,IAAoB;AACnD,QAAM,UAAU,MAAY;AACxB,oBAAgB,MAAM;AACtB,OAAG;AAAA,EACP;AACA,MAAI;AACJ,MAAI;AAIJ,QAAM,aAAa,sBAAsB,MAAM;AAC3C,iBAAa,sBAAsB,MAAM;AACrC,mBAAa,sBAAsB,MAAM;AACrC,gBAAQ;AAAA,MACZ,CAAC;AAAA,IACL,CAAC;AAAA,EACL,CAAC;AACD,QAAM,sBAAsB,CAAC,UAAiC;AAC1D,QAAI,MAAM,WAAW,IAAI;AACrB;AAAA,IACJ;AACA,uBAAmB;AAAA,MACf,MAAM;A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
|
1
|
-
"use strict";import{SpectrumElement as E}from"@spectrum-web-components/base";import{reparentChildren as T}from"@spectrum-web-components/shared/src/reparent-children.js";import{
|
|
1
|
+
"use strict";import{SpectrumElement as E}from"@spectrum-web-components/base";import{reparentChildren as T}from"@spectrum-web-components/shared/src/reparent-children.js";import{OverlayTimer as P}from"./overlay-timer.js";export const overlayTimer=new P,noop=()=>{};export class BeforetoggleClosedEvent extends Event{constructor(){super("beforetoggle",{bubbles:!1,composed:!1});this.currentState="open";this.newState="closed"}}export class BeforetoggleOpenEvent extends Event{constructor(){super("beforetoggle",{bubbles:!1,composed:!1});this.currentState="closed";this.newState="open"}}export const guaranteedAllTransitionend=(o,d,t)=>{const a=new AbortController,n=new Map,c=()=>{a.abort(),t()};let u,s;const e=requestAnimationFrame(()=>{u=requestAnimationFrame(()=>{s=requestAnimationFrame(()=>{c()})})}),m=r=>{r.target===o&&(n.set(r.propertyName,n.get(r.propertyName)-1),n.get(r.propertyName)||n.delete(r.propertyName),n.size===0&&c())},y=r=>{r.target===o&&(n.has(r.propertyName)||n.set(r.propertyName,0),n.set(r.propertyName,n.get(r.propertyName)+1),cancelAnimationFrame(e),cancelAnimationFrame(u),cancelAnimationFrame(s))};o.addEventListener("transitionrun",y,{signal:a.signal}),o.addEventListener("transitionend",m,{signal:a.signal}),o.addEventListener("transitioncancel",m,{signal:a.signal}),d()};export function nextFrame(){return new Promise(o=>requestAnimationFrame(()=>o()))}export function forcePaint(){document.body.offsetHeight}export class AbstractOverlay extends E{constructor(){super(...arguments);this.dispose=noop;this.offset=6;this.willPreventClose=!1}async applyFocus(t,a){}async ensureOnDOM(t){}async makeTransition(t){return null}async manageDelay(t){}async manageDialogOpen(){}async managePopoverOpen(){}managePosition(){}get open(){return!1}set open(t){}get state(){return"closed"}set state(t){}manuallyKeepOpen(){}static update(){const t=new CustomEvent("sp-update-overlays",{bubbles:!0,composed:!0,cancelable:!0});document.dispatchEvent(t)}static async open(t,a,n,c){var g,b,f,O;await import("@spectrum-web-components/overlay/sp-overlay.js");const u=arguments.length===2,s=n||t,e=new this;let m=!1;e.dispose=()=>{e.addEventListener("sp-closed",()=>{m||(y(),m=!0),requestAnimationFrame(()=>{e.remove()})}),e.open=!1,e.dispose=noop};const y=T([s],e,{position:"beforeend",prepareCallback:l=>{const v=l.slot;return l.removeAttribute("slot"),()=>{l.slot=v}}});if(!u&&s&&c){const l=t,v=a,p=c;return e.delayed=p.delayed||s.hasAttribute("delayed"),e.receivesFocus=(g=p.receivesFocus)!=null?g:"auto",e.triggerElement=p.virtualTrigger||l,e.type=v==="modal"?"modal":v==="hover"?"hint":"auto",e.offset=(b=p.offset)!=null?b:6,e.placement=p.placement,e.willPreventClose=!!p.notImmediatelyClosable,l.insertAdjacentElement("afterend",e),await e.updateComplete,e.open=!0,e.dispose}const i=a;return e.append(s),e.delayed=i.delayed||s.hasAttribute("delayed"),e.receivesFocus=(f=i.receivesFocus)!=null?f:"auto",e.triggerElement=i.trigger||null,e.type=i.type||"modal",e.offset=(O=i.offset)!=null?O:6,e.placement=i.placement,e.willPreventClose=!!i.notImmediatelyClosable,e.updateComplete.then(()=>{e.open=!0}),e}}
|
|
2
2
|
//# sourceMappingURL=AbstractOverlay.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["AbstractOverlay.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { SpectrumElement } from '@spectrum-web-components/base';\nimport { reparentChildren } from '@spectrum-web-components/shared/src/reparent-children.js';\n\nimport type {\n OpenableElement,\n OverlayOptions,\n OverlayOptionsV1,\n OverlayState,\n OverlayTypes,\n TriggerInteractionsV1,\n} from './overlay-types.js';\nimport { Overlay } from './Overlay.js';\nimport type { VirtualTrigger } from './VirtualTrigger.js';\nimport { OverlayTimer } from './overlay-timer.js';\nimport { PlacementController } from './PlacementController.js';\n\nexport const overlayTimer = new OverlayTimer();\n\nexport const noop = (): void => {\n return;\n};\n\nexport class BeforetoggleClosedEvent extends Event {\n currentState = 'open';\n newState = 'closed';\n constructor() {\n super('beforetoggle', {\n bubbles: false,\n composed: false,\n });\n }\n}\n\nexport class BeforetoggleOpenEvent extends Event {\n currentState = 'closed';\n newState = 'open';\n constructor() {\n super('beforetoggle', {\n bubbles: false,\n composed: false,\n });\n }\n}\n\n/**\n * Apply a \"transitionend\" listener to an element that may not transition but\n * guarantee the callback will be fired either way.\n *\n * @param el {HTMLElement} - Target of the \"transition\" listeners.\n * @param action {Function} - Method to trigger the \"transition\".\n * @param cb {Function} - Callback to trigger when the \"transition\" has ended.\n */\nexport const guaranteedAllTransitionend = (\n el: HTMLElement,\n action: () => void,\n cb: () => void\n): void => {\n const abortController = new AbortController();\n const runningTransitions = new Map<string, number>();\n const cleanup = (): void => {\n abortController.abort();\n cb();\n };\n let guarantee2: number;\n let guarantee3: number;\n // WebKit fires `transitionrun` a little earlier, the multiple guarantees here\n // allow WebKit to be caught, but doesn't remove the animation listener until\n // after it would have fired in Chromium.\n const guarantee1 = requestAnimationFrame(() => {\n guarantee2 = requestAnimationFrame(() => {\n guarantee3 = requestAnimationFrame(() => {\n cleanup();\n });\n });\n });\n const handleTransitionend = (event: TransitionEvent): void => {\n if (event.target !== el) {\n return;\n }\n runningTransitions.set(\n event.propertyName,\n (runningTransitions.get(event.propertyName) as number) - 1\n );\n if (!runningTransitions.get(event.propertyName)) {\n runningTransitions.delete(event.propertyName);\n }\n if (runningTransitions.size === 0) {\n cleanup();\n }\n };\n const handleTransitionrun = (event: TransitionEvent): void => {\n if (event.target !== el) {\n return;\n }\n if (!runningTransitions.has(event.propertyName)) {\n runningTransitions.set(event.propertyName, 0);\n }\n runningTransitions.set(\n event.propertyName,\n (runningTransitions.get(event.propertyName) as number) + 1\n );\n cancelAnimationFrame(guarantee1);\n cancelAnimationFrame(guarantee2);\n cancelAnimationFrame(guarantee3);\n };\n el.addEventListener('transitionrun', handleTransitionrun, {\n signal: abortController.signal,\n });\n el.addEventListener('transitionend', handleTransitionend, {\n signal: abortController.signal,\n });\n el.addEventListener('transitioncancel', handleTransitionend, {\n signal: abortController.signal,\n });\n action();\n};\n\nexport function nextFrame(): Promise<void> {\n return new Promise((res) => requestAnimationFrame(() => res()));\n}\n\nexport function forcePaint(): void {\n // force the browser to paint\n document.body.offsetHeight;\n}\n\nexport class AbstractOverlay extends SpectrumElement {\n protected async applyFocus(\n _targetOpenState: boolean,\n _focusEl: HTMLElement | null\n ): Promise<void> {\n return;\n }\n delayed!: boolean;\n dialogEl!: HTMLDialogElement & {\n showPopover(): void;\n hidePopover(): void;\n };\n dispose = noop;\n protected async ensureOnDOM(_targetOpenState: boolean): Promise<void> {\n return;\n }\n elements!: OpenableElement[];\n protected async makeTransition(\n _targetOpenState: boolean\n ): Promise<HTMLElement | null> {\n return null;\n }\n protected async manageDelay(_targetOpenState: boolean): Promise<void> {\n return;\n }\n protected async manageDialogOpen(): Promise<void> {\n return;\n }\n protected async managePopoverOpen(): Promise<void> {\n return;\n }\n protected managePosition(): void {\n return;\n }\n get open(): boolean {\n return false;\n }\n set open(_open: boolean) {\n return;\n }\n protected placementController!: PlacementController;\n receivesFocus!: 'true' | 'false' | 'auto';\n get state(): OverlayState {\n return 'closed';\n }\n set state(_state: OverlayState) {\n return;\n }\n protected _state!: OverlayState;\n triggerElement!: HTMLElement | VirtualTrigger | null;\n type!: OverlayTypes;\n\n public manuallyKeepOpen(): void {\n return;\n }\n\n public static update(): void {\n const overlayUpdateEvent = new CustomEvent('sp-update-overlays', {\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n document.dispatchEvent(overlayUpdateEvent);\n }\n\n public static async open(\n trigger: HTMLElement,\n interaction: TriggerInteractionsV1,\n content: HTMLElement,\n optionsV1: OverlayOptionsV1\n ): Promise<() => void>;\n public static async open(\n content: HTMLElement,\n options?: OverlayOptions\n ): Promise<Overlay>;\n public static async open(\n triggerOrContent: HTMLElement,\n interactionOrOptions:\n | TriggerInteractionsV1\n | OverlayOptions\n | undefined,\n content?: HTMLElement,\n optionsV1?: OverlayOptionsV1\n ): Promise<Overlay | (() => void)> {\n const v2 = arguments.length === 2;\n const overlayContent = content || triggerOrContent;\n const overlay = new Overlay();\n let restored = false;\n overlay.dispose = () => {\n overlay.addEventListener('sp-closed', () => {\n if (!restored) {\n restoreContent();\n restored = true;\n }\n requestAnimationFrame(() => {\n overlay.remove();\n });\n });\n overlay.open = false;\n overlay.dispose = noop;\n };\n /**\n * Since content must exist in an <sp-overlay>, we need a way to get it there.\n * The best & most-direct way is to declaratively use an <sp-overlay> element,\n * but for imperative users, we'll reparent content into an overlay that we've created for them.\n **/\n const restoreContent = reparentChildren([overlayContent], overlay, {\n position: 'beforeend',\n prepareCallback: (el) => {\n // Ensure that content to be overlaid is no longer targetted to a specific `slot`.\n // This allow for it to be visible in the overlaid context.\n const slot = el.slot;\n el.removeAttribute('slot');\n return () => {\n el.slot = slot;\n };\n },\n });\n\n const v1 = !v2 && overlayContent && optionsV1;\n if (v1) {\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n overlay,\n `You are interacting with an ${overlay.localName} element via a deprecated imperative API. This API will be removed in a future version of the SWC library. Consider leveraging an ${overlay.localName} directly.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/overlay/',\n { level: 'deprecation' }\n );\n }\n const trigger = triggerOrContent;\n const interaction = interactionOrOptions;\n const options = optionsV1;\n overlay.delayed =\n options.delayed || overlayContent.hasAttribute('delayed');\n overlay.receivesFocus = options.receivesFocus ?? 'auto';\n overlay.triggerElement = options.virtualTrigger || trigger;\n overlay.type =\n interaction === 'modal'\n ? 'modal'\n : interaction === 'hover'\n ? 'hint'\n : 'auto';\n overlay.offset = options.offset ?? 6;\n overlay.placement = options.placement;\n overlay.willPreventClose = !!options.notImmediatelyClosable;\n trigger.insertAdjacentElement('afterend', overlay);\n await overlay.updateComplete;\n overlay.open = true;\n return overlay.dispose;\n }\n\n const options = interactionOrOptions as OverlayOptions;\n overlay.append(overlayContent);\n overlay.delayed =\n options.delayed || overlayContent.hasAttribute('delayed');\n overlay.receivesFocus = options.receivesFocus ?? 'auto';\n overlay.triggerElement = options.trigger || null;\n overlay.type = options.type || 'modal';\n overlay.offset = options.offset ?? 6;\n overlay.placement = options.placement;\n overlay.willPreventClose = !!options.notImmediatelyClosable;\n overlay.updateComplete.then(() => {\n // Do we want to \"open\" this path, or leave that to the consumer?\n overlay.open = true;\n });\n return overlay;\n }\n}\n"],
|
|
5
|
-
"mappings": "aAWA,OAAS,mBAAAA,MAAuB,gCAChC,OAAS,oBAAAC,MAAwB,
|
|
6
|
-
"names": ["SpectrumElement", "reparentChildren", "
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { SpectrumElement } from '@spectrum-web-components/base';\nimport { reparentChildren } from '@spectrum-web-components/shared/src/reparent-children.js';\n\nimport type {\n OpenableElement,\n OverlayOptions,\n OverlayOptionsV1,\n OverlayState,\n OverlayTypes,\n Placement,\n TriggerInteractionsV1,\n} from './overlay-types.js';\nimport type { Overlay } from './Overlay.js';\nimport type { VirtualTrigger } from './VirtualTrigger.js';\nimport { OverlayTimer } from './overlay-timer.js';\nimport { PlacementController } from './PlacementController.js';\n\nexport const overlayTimer = new OverlayTimer();\n\nexport const noop = (): void => {\n return;\n};\n\nexport class BeforetoggleClosedEvent extends Event {\n currentState = 'open';\n newState = 'closed';\n constructor() {\n super('beforetoggle', {\n bubbles: false,\n composed: false,\n });\n }\n}\n\nexport class BeforetoggleOpenEvent extends Event {\n currentState = 'closed';\n newState = 'open';\n constructor() {\n super('beforetoggle', {\n bubbles: false,\n composed: false,\n });\n }\n}\n\n/**\n * Apply a \"transitionend\" listener to an element that may not transition but\n * guarantee the callback will be fired either way.\n *\n * @param el {HTMLElement} - Target of the \"transition\" listeners.\n * @param action {Function} - Method to trigger the \"transition\".\n * @param cb {Function} - Callback to trigger when the \"transition\" has ended.\n */\nexport const guaranteedAllTransitionend = (\n el: HTMLElement,\n action: () => void,\n cb: () => void\n): void => {\n const abortController = new AbortController();\n const runningTransitions = new Map<string, number>();\n const cleanup = (): void => {\n abortController.abort();\n cb();\n };\n let guarantee2: number;\n let guarantee3: number;\n // WebKit fires `transitionrun` a little earlier, the multiple guarantees here\n // allow WebKit to be caught, but doesn't remove the animation listener until\n // after it would have fired in Chromium.\n const guarantee1 = requestAnimationFrame(() => {\n guarantee2 = requestAnimationFrame(() => {\n guarantee3 = requestAnimationFrame(() => {\n cleanup();\n });\n });\n });\n const handleTransitionend = (event: TransitionEvent): void => {\n if (event.target !== el) {\n return;\n }\n runningTransitions.set(\n event.propertyName,\n (runningTransitions.get(event.propertyName) as number) - 1\n );\n if (!runningTransitions.get(event.propertyName)) {\n runningTransitions.delete(event.propertyName);\n }\n if (runningTransitions.size === 0) {\n cleanup();\n }\n };\n const handleTransitionrun = (event: TransitionEvent): void => {\n if (event.target !== el) {\n return;\n }\n if (!runningTransitions.has(event.propertyName)) {\n runningTransitions.set(event.propertyName, 0);\n }\n runningTransitions.set(\n event.propertyName,\n (runningTransitions.get(event.propertyName) as number) + 1\n );\n cancelAnimationFrame(guarantee1);\n cancelAnimationFrame(guarantee2);\n cancelAnimationFrame(guarantee3);\n };\n el.addEventListener('transitionrun', handleTransitionrun, {\n signal: abortController.signal,\n });\n el.addEventListener('transitionend', handleTransitionend, {\n signal: abortController.signal,\n });\n el.addEventListener('transitioncancel', handleTransitionend, {\n signal: abortController.signal,\n });\n action();\n};\n\nexport function nextFrame(): Promise<void> {\n return new Promise((res) => requestAnimationFrame(() => res()));\n}\n\nexport function forcePaint(): void {\n // force the browser to paint\n document.body.offsetHeight;\n}\n\n/**\n * Abstract Overlay base class so that property tyings and imperative API\n * interfaces can be held separate from the actual class definition.\n */\nexport class AbstractOverlay extends SpectrumElement {\n protected async applyFocus(\n _targetOpenState: boolean,\n _focusEl: HTMLElement | null\n ): Promise<void> {\n return;\n }\n delayed!: boolean;\n dialogEl!: HTMLDialogElement & {\n showPopover(): void;\n hidePopover(): void;\n };\n dispose = noop;\n protected async ensureOnDOM(_targetOpenState: boolean): Promise<void> {\n return;\n }\n elements!: OpenableElement[];\n protected async makeTransition(\n _targetOpenState: boolean\n ): Promise<HTMLElement | null> {\n return null;\n }\n protected async manageDelay(_targetOpenState: boolean): Promise<void> {\n return;\n }\n protected async manageDialogOpen(): Promise<void> {\n return;\n }\n protected async managePopoverOpen(): Promise<void> {\n return;\n }\n protected managePosition(): void {\n return;\n }\n protected offset: number | [number, number] = 6;\n get open(): boolean {\n return false;\n }\n set open(_open: boolean) {\n return;\n }\n placement?: Placement;\n protected placementController!: PlacementController;\n receivesFocus!: 'true' | 'false' | 'auto';\n get state(): OverlayState {\n return 'closed';\n }\n set state(_state: OverlayState) {\n return;\n }\n protected _state!: OverlayState;\n triggerElement!: HTMLElement | VirtualTrigger | null;\n type!: OverlayTypes;\n willPreventClose = false;\n\n public manuallyKeepOpen(): void {\n return;\n }\n\n public static update(): void {\n const overlayUpdateEvent = new CustomEvent('sp-update-overlays', {\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n document.dispatchEvent(overlayUpdateEvent);\n }\n\n /**\n * Overloaded imperative API entry point that allows for both the pre-0.37.0\n * argument signature as well as the post-0.37.0 signature. This allows for\n * consumers to continue to leverage it as they had been in previous releases\n * while also surfacing the more feature-rich API that has been made available.\n */\n public static async open(\n trigger: HTMLElement,\n interaction: TriggerInteractionsV1,\n content: HTMLElement,\n optionsV1: OverlayOptionsV1\n ): Promise<() => void>;\n public static async open(\n content: HTMLElement,\n options?: OverlayOptions\n ): Promise<Overlay>;\n public static async open(\n triggerOrContent: HTMLElement,\n interactionOrOptions:\n | TriggerInteractionsV1\n | OverlayOptions\n | undefined,\n content?: HTMLElement,\n optionsV1?: OverlayOptionsV1\n ): Promise<Overlay | (() => void)> {\n await import('@spectrum-web-components/overlay/sp-overlay.js');\n const v2 = arguments.length === 2;\n const overlayContent = content || triggerOrContent;\n // Use the `this` from the `static` method context rather than a\n // specific imported constructor to prevent opening a circular dependency.\n const overlay = new this() as Overlay;\n let restored = false;\n overlay.dispose = () => {\n overlay.addEventListener('sp-closed', () => {\n if (!restored) {\n restoreContent();\n restored = true;\n }\n requestAnimationFrame(() => {\n overlay.remove();\n });\n });\n overlay.open = false;\n overlay.dispose = noop;\n };\n /**\n * Since content must exist in an <sp-overlay>, we need a way to get it there.\n * The best & most-direct way is to declaratively use an <sp-overlay> element,\n * but for imperative users, we'll reparent content into an overlay that we've created for them.\n **/\n const restoreContent = reparentChildren([overlayContent], overlay, {\n position: 'beforeend',\n prepareCallback: (el) => {\n // Ensure that content to be overlaid is no longer targetted to a specific `slot`.\n // This allow for it to be visible in the overlaid context.\n const slot = el.slot;\n el.removeAttribute('slot');\n return () => {\n el.slot = slot;\n };\n },\n });\n\n const v1 = !v2 && overlayContent && optionsV1;\n if (v1) {\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n overlay,\n `You are interacting with an ${overlay.localName} element via a deprecated imperative API. This API will be removed in a future version of the SWC library. Consider leveraging an ${overlay.localName} directly.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/overlay/',\n { level: 'deprecation' }\n );\n }\n const trigger = triggerOrContent;\n const interaction = interactionOrOptions;\n const options = optionsV1;\n overlay.delayed =\n options.delayed || overlayContent.hasAttribute('delayed');\n overlay.receivesFocus = options.receivesFocus ?? 'auto';\n overlay.triggerElement = options.virtualTrigger || trigger;\n overlay.type =\n interaction === 'modal'\n ? 'modal'\n : interaction === 'hover'\n ? 'hint'\n : 'auto';\n overlay.offset = options.offset ?? 6;\n overlay.placement = options.placement;\n overlay.willPreventClose = !!options.notImmediatelyClosable;\n trigger.insertAdjacentElement('afterend', overlay);\n await overlay.updateComplete;\n overlay.open = true;\n return overlay.dispose;\n }\n\n const options = interactionOrOptions as OverlayOptions;\n overlay.append(overlayContent);\n overlay.delayed =\n options.delayed || overlayContent.hasAttribute('delayed');\n overlay.receivesFocus = options.receivesFocus ?? 'auto';\n overlay.triggerElement = options.trigger || null;\n overlay.type = options.type || 'modal';\n overlay.offset = options.offset ?? 6;\n overlay.placement = options.placement;\n overlay.willPreventClose = !!options.notImmediatelyClosable;\n overlay.updateComplete.then(() => {\n // Do we want to \"open\" this path, or leave that to the consumer?\n overlay.open = true;\n });\n return overlay;\n }\n}\n"],
|
|
5
|
+
"mappings": "aAWA,OAAS,mBAAAA,MAAuB,gCAChC,OAAS,oBAAAC,MAAwB,2DAajC,OAAS,gBAAAC,MAAoB,qBAGtB,aAAM,aAAe,IAAIA,EAEnB,KAAO,IAAY,CAEhC,EAEO,aAAM,gCAAgC,KAAM,CAG/C,aAAc,CACV,MAAM,eAAgB,CAClB,QAAS,GACT,SAAU,EACd,CAAC,EANL,kBAAe,OACf,cAAW,QAMX,CACJ,CAEO,aAAM,8BAA8B,KAAM,CAG7C,aAAc,CACV,MAAM,eAAgB,CAClB,QAAS,GACT,SAAU,EACd,CAAC,EANL,kBAAe,SACf,cAAW,MAMX,CACJ,CAUO,aAAM,2BAA6B,CACtCC,EACAC,EACAC,IACO,CACP,MAAMC,EAAkB,IAAI,gBACtBC,EAAqB,IAAI,IACzBC,EAAU,IAAY,CACxBF,EAAgB,MAAM,EACtB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,OACjDM,EAAQ,eAAiBM,EAAQ,gBAAkBF,EACnDJ,EAAQ,KACJK,IAAgB,QACV,QACAA,IAAgB,QAChB,OACA,OACVL,EAAQ,QAASL,EAAAW,EAAQ,SAAR,KAAAX,EAAkB,EACnCK,EAAQ,UAAYM,EAAQ,UAC5BN,EAAQ,iBAAmB,CAAC,CAACM,EAAQ,uBACrCF,EAAQ,sBAAsB,WAAYJ,CAAO,EACjD,MAAMA,EAAQ,eACdA,EAAQ,KAAO,GACRA,EAAQ,OACnB,CAEA,MAAMM,EAAUf,EAChB,OAAAS,EAAQ,OAAOD,CAAc,EAC7BC,EAAQ,QACJM,EAAQ,SAAWP,EAAe,aAAa,SAAS,EAC5DC,EAAQ,eAAgBJ,EAAAU,EAAQ,gBAAR,KAAAV,EAAyB,OACjDI,EAAQ,eAAiBM,EAAQ,SAAW,KAC5CN,EAAQ,KAAOM,EAAQ,MAAQ,QAC/BN,EAAQ,QAASH,EAAAS,EAAQ,SAAR,KAAAT,EAAkB,EACnCG,EAAQ,UAAYM,EAAQ,UAC5BN,EAAQ,iBAAmB,CAAC,CAACM,EAAQ,uBACrCN,EAAQ,eAAe,KAAK,IAAM,CAE9BA,EAAQ,KAAO,EACnB,CAAC,EACMA,CACX,CACJ",
|
|
6
|
+
"names": ["SpectrumElement", "reparentChildren", "OverlayTimer", "el", "action", "cb", "abortController", "runningTransitions", "cleanup", "guarantee2", "guarantee3", "guarantee1", "handleTransitionend", "event", "handleTransitionrun", "res", "_targetOpenState", "_focusEl", "_open", "_state", "overlayUpdateEvent", "triggerOrContent", "interactionOrOptions", "content", "optionsV1", "_a", "_b", "_c", "_d", "v2", "overlayContent", "overlay", "restored", "restoreContent", "slot", "trigger", "interaction", "options"]
|
|
7
7
|
}
|
package/src/Overlay.d.ts
CHANGED
|
@@ -148,7 +148,6 @@ export declare class Overlay extends OverlayFeatures {
|
|
|
148
148
|
protected handleBrowserClose(): void;
|
|
149
149
|
manuallyKeepOpen(): void;
|
|
150
150
|
protected handleSlotchange(): void;
|
|
151
|
-
willPreventClose: boolean;
|
|
152
151
|
shouldPreventClose(): boolean;
|
|
153
152
|
willUpdate(changes: PropertyValues): void;
|
|
154
153
|
protected updated(changes: PropertyValues): void;
|
package/src/Overlay.dev.js
CHANGED
|
@@ -219,7 +219,6 @@ const _Overlay = class _Overlay extends OverlayFeatures {
|
|
|
219
219
|
this.open = true;
|
|
220
220
|
this.longpressState = this.longpressState === "potential" ? "opening" : "pressed";
|
|
221
221
|
};
|
|
222
|
-
this.willPreventClose = false;
|
|
223
222
|
}
|
|
224
223
|
get disabled() {
|
|
225
224
|
return this._disabled;
|
|
@@ -402,7 +401,7 @@ const _Overlay = class _Overlay extends OverlayFeatures {
|
|
|
402
401
|
);
|
|
403
402
|
}
|
|
404
403
|
}
|
|
405
|
-
if (!this.open) {
|
|
404
|
+
if (!this.open && this.type !== "hint") {
|
|
406
405
|
const getAncestors = () => {
|
|
407
406
|
var _a2;
|
|
408
407
|
const ancestors = [];
|