@spectrum-web-components/overlay 0.42.2 → 0.42.3
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/custom-elements.json +285 -114
- package/package.json +15 -7
- package/src/AbstractOverlay.d.ts +2 -30
- package/src/AbstractOverlay.dev.js +0 -37
- package/src/AbstractOverlay.dev.js.map +2 -2
- package/src/AbstractOverlay.js +1 -1
- package/src/AbstractOverlay.js.map +3 -3
- package/src/ClickController.dev.js +2 -2
- package/src/ClickController.dev.js.map +2 -2
- package/src/ClickController.js +1 -1
- package/src/ClickController.js.map +2 -2
- package/src/HoverController.d.ts +1 -0
- package/src/HoverController.dev.js +24 -14
- package/src/HoverController.dev.js.map +2 -2
- package/src/HoverController.js +1 -1
- package/src/HoverController.js.map +2 -2
- package/src/InteractionController.d.ts +17 -3
- package/src/InteractionController.dev.js +48 -5
- package/src/InteractionController.dev.js.map +2 -2
- package/src/InteractionController.js +1 -1
- package/src/InteractionController.js.map +3 -3
- package/src/LongpressController.dev.js +10 -6
- package/src/LongpressController.dev.js.map +2 -2
- package/src/LongpressController.js +1 -1
- package/src/LongpressController.js.map +3 -3
- package/src/Overlay.d.ts +3 -8
- package/src/Overlay.dev.js +7 -12
- package/src/Overlay.dev.js.map +2 -2
- package/src/Overlay.js +2 -2
- package/src/Overlay.js.map +3 -3
- package/src/OverlayDialog.dev.js +2 -3
- 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 +5 -3
- 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 +5 -3
- package/src/OverlayPopover.dev.js.map +2 -2
- package/src/OverlayPopover.js +1 -1
- package/src/OverlayPopover.js.map +3 -3
- package/src/OverlayTrigger.d.ts +1 -1
- package/src/OverlayTrigger.dev.js.map +1 -1
- package/src/OverlayTrigger.js.map +1 -1
- package/src/PlacementController.d.ts +1 -1
- package/src/events.d.ts +23 -0
- package/src/events.dev.js +39 -0
- package/src/events.dev.js.map +7 -0
- package/src/events.js +2 -0
- package/src/events.js.map +7 -0
- package/src/overlay-events.js +1 -1
- package/src/overlay-trigger-directive.d.ts +5 -6
- package/src/overlay-trigger-directive.dev.js +11 -9
- package/src/overlay-trigger-directive.dev.js.map +2 -2
- package/src/overlay-trigger-directive.js +1 -1
- package/src/overlay-trigger-directive.js.map +3 -3
- package/src/overlay-types.d.ts +10 -10
- package/src/slottable-request-directive.dev.js +2 -1
- package/src/slottable-request-directive.dev.js.map +2 -2
- package/src/slottable-request-directive.js +1 -1
- package/src/slottable-request-directive.js.map +2 -2
- package/src/slottable-request-event.js +1 -1
- package/src/strategies.d.ts +8 -0
- package/src/strategies.dev.js +10 -0
- package/src/strategies.dev.js.map +7 -0
- package/src/strategies.js +2 -0
- package/src/strategies.js.map +7 -0
- package/stories/overlay.stories.js +2 -2
- package/stories/overlay.stories.js.map +2 -2
- package/test/index.js +10 -10
- package/test/index.js.map +2 -2
- package/test/overlay-element.test.js.map +2 -2
- package/test/overlay-memory.test.js +10 -0
- package/test/overlay-memory.test.js.map +7 -0
- package/test/overlay-update.test.js +1 -0
- package/test/overlay-update.test.js.map +2 -2
- package/test/overlay-v1.test.js +2 -1
- package/test/overlay-v1.test.js.map +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["overlay-trigger-directive.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport {\n ElementPart,\n nothing,\n render,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { directive } from 'lit/async-directive.js';\nimport {
|
|
5
|
-
"mappings": "aAWA,OAEI,WAAAA,EACA,UAAAC,MAEG,gCACP,OAAS,aAAAC,MAAiB,yBAC1B,OAAS,
|
|
6
|
-
"names": ["nothing", "render", "directive", "
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport {\n ElementPart,\n nothing,\n render,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { directive } from 'lit/async-directive.js';\nimport { strategies } from './strategies.js';\nimport type { OverlayOptions, TriggerInteraction } from './overlay-types.js';\nimport type { ClickController } from './ClickController.js';\nimport type { HoverController } from './HoverController.js';\nimport type { LongpressController } from './LongpressController.js';\nimport {\n removeSlottableRequest,\n type SlottableRequestEvent,\n} from './slottable-request-event.js';\nimport { SlottableRequestDirective } from './slottable-request-directive.js';\nimport { AbstractOverlay } from './AbstractOverlay.js';\n\nexport type InsertionOptions = {\n el: HTMLElement | (() => HTMLElement);\n where: InsertPosition;\n};\n\nexport type OverlayTriggerOptions = {\n open?: boolean;\n triggerInteraction: TriggerInteraction;\n overlayOptions: OverlayOptions;\n insertionOptions?: InsertionOptions;\n};\n\nexport class OverlayTriggerDirective extends SlottableRequestDirective {\n private overlay!: AbstractOverlay;\n private strategy!: ClickController | HoverController | LongpressController;\n\n protected defaultOptions: OverlayTriggerOptions = {\n triggerInteraction: 'click',\n overlayOptions: {\n type: 'auto',\n offset: 0,\n },\n };\n protected options: OverlayOptions = {\n ...this.defaultOptions.overlayOptions,\n };\n protected insertionOptions?: InsertionOptions;\n\n /* c8 ignore next 9 */\n override render(\n _template: () => TemplateResult,\n _options?: Partial<OverlayTriggerOptions>\n ): unknown {\n // render function here just defines the interface to the update call later\n // we don't have anything to render since this is intended to be an ElementPart directive\n // so will be used on an element and is not itself rendered\n return nothing;\n }\n\n override update(\n part: ElementPart,\n [template, options]: Parameters<this['render']>\n ): void {\n this.options = {\n ...this.defaultOptions.overlayOptions,\n ...options?.overlayOptions,\n };\n this.insertionOptions = options?.insertionOptions;\n this.template = template;\n let newTarget = false;\n const triggerInteraction = (options?.triggerInteraction ||\n this.defaultOptions.triggerInteraction) as TriggerInteraction;\n const newStrategy =\n (this.strategy?.type as unknown as TriggerInteraction) !==\n triggerInteraction;\n if (this.target !== part.element) {\n this.target = part.element as HTMLElement;\n newTarget = true;\n }\n if (newTarget || newStrategy) {\n this.strategy?.abort();\n this.strategy = new strategies[\n triggerInteraction as TriggerInteraction\n ](this.target, {\n isPersistent: true,\n handleOverlayReady: (overlay: AbstractOverlay) => {\n this.listenerHost = this.overlay = overlay;\n this.init();\n },\n });\n }\n this.strategy.open = options?.open ?? false;\n }\n\n override handleSlottableRequest(event: SlottableRequestEvent): void {\n /* c8 ignore next 1 */\n if (event.target !== event.currentTarget) return;\n\n const willRemoveSlottable = event.data === removeSlottableRequest;\n render(willRemoveSlottable ? undefined : this.template(), this.overlay);\n\n if (willRemoveSlottable) {\n this.overlay.remove();\n } else {\n AbstractOverlay.applyOptions(this.overlay, {\n ...this.options,\n trigger: this.target,\n });\n const insertionEl =\n typeof this.insertionOptions?.el === 'function'\n ? this.insertionOptions.el()\n : this.insertionOptions?.el || this.target;\n const { where = 'afterend' } = this.insertionOptions || {};\n insertionEl.insertAdjacentElement(where, this.overlay);\n }\n }\n}\n\nexport const trigger = directive(OverlayTriggerDirective);\n"],
|
|
5
|
+
"mappings": "aAWA,OAEI,WAAAA,EACA,UAAAC,MAEG,gCACP,OAAS,aAAAC,MAAiB,yBAC1B,OAAS,cAAAC,MAAkB,kBAK3B,OACI,0BAAAC,MAEG,+BACP,OAAS,6BAAAC,MAAiC,mCAC1C,OAAS,mBAAAC,MAAuB,uBAczB,aAAM,gCAAgCD,CAA0B,CAAhE,kCAIH,KAAU,eAAwC,CAC9C,mBAAoB,QACpB,eAAgB,CACZ,KAAM,OACN,OAAQ,CACZ,CACJ,EACA,KAAU,QAA0B,CAChC,GAAG,KAAK,eAAe,cAC3B,EAIS,OACLE,EACAC,EACO,CAIP,OAAOR,CACX,CAES,OACLS,EACA,CAACC,EAAUC,CAAO,EACd,CAxEZ,IAAAC,EAAAC,EAAAC,EAyEQ,KAAK,QAAU,CACX,GAAG,KAAK,eAAe,eACvB,GAAGH,GAAA,YAAAA,EAAS,cAChB,EACA,KAAK,iBAAmBA,GAAA,YAAAA,EAAS,iBACjC,KAAK,SAAWD,EAChB,IAAIK,EAAY,GAChB,MAAMC,GAAsBL,GAAA,YAAAA,EAAS,qBACjC,KAAK,eAAe,mBAClBM,IACDL,EAAA,KAAK,WAAL,YAAAA,EAAe,QAChBI,EACA,KAAK,SAAWP,EAAK,UACrB,KAAK,OAASA,EAAK,QACnBM,EAAY,KAEZA,GAAaE,MACbJ,EAAA,KAAK,WAAL,MAAAA,EAAe,QACf,KAAK,SAAW,IAAIV,EAChBa,CACJ,EAAE,KAAK,OAAQ,CACX,aAAc,GACd,mBAAqBE,GAA6B,CAC9C,KAAK,aAAe,KAAK,QAAUA,EACnC,KAAK,KAAK,CACd,CACJ,CAAC,GAEL,KAAK,SAAS,MAAOJ,EAAAH,GAAA,YAAAA,EAAS,OAAT,KAAAG,EAAiB,EAC1C,CAES,uBAAuBK,EAAoC,CAxGxE,IAAAP,EAAAC,EA0GQ,GAAIM,EAAM,SAAWA,EAAM,cAAe,OAE1C,MAAMC,EAAsBD,EAAM,OAASf,EAG3C,GAFAH,EAAOmB,EAAsB,OAAY,KAAK,SAAS,EAAG,KAAK,OAAO,EAElEA,EACA,KAAK,QAAQ,OAAO,MACjB,CACHd,EAAgB,aAAa,KAAK,QAAS,CACvC,GAAG,KAAK,QACR,QAAS,KAAK,MAClB,CAAC,EACD,MAAMe,EACF,QAAOT,EAAA,KAAK,mBAAL,YAAAA,EAAuB,KAAO,WAC/B,KAAK,iBAAiB,GAAG,IACzBC,EAAA,KAAK,mBAAL,YAAAA,EAAuB,KAAM,KAAK,OACtC,CAAE,MAAAS,EAAQ,UAAW,EAAI,KAAK,kBAAoB,CAAC,EACzDD,EAAY,sBAAsBC,EAAO,KAAK,OAAO,CACzD,CACJ,CACJ,CAEO,aAAM,QAAUpB,EAAU,uBAAuB",
|
|
6
|
+
"names": ["nothing", "render", "directive", "strategies", "removeSlottableRequest", "SlottableRequestDirective", "AbstractOverlay", "_template", "_options", "part", "template", "options", "_a", "_b", "_c", "newTarget", "triggerInteraction", "newStrategy", "overlay", "event", "willRemoveSlottable", "insertionEl", "where"]
|
|
7
7
|
}
|
package/src/overlay-types.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { Placement } from '@floating-ui/dom';
|
|
2
2
|
import type { VirtualTrigger } from './VirtualTrigger.js';
|
|
3
|
-
export
|
|
3
|
+
export type Constructor<T = Record<string, unknown>> = {
|
|
4
4
|
new (...args: any[]): T;
|
|
5
5
|
prototype: T;
|
|
6
6
|
};
|
|
7
7
|
export { Placement };
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
8
|
+
export type OverlayTypes = 'auto' | 'hint' | 'manual' | 'modal' | 'page';
|
|
9
|
+
export type TriggerInteraction = 'click' | 'longpress' | 'hover';
|
|
10
|
+
export type TriggerInteractions = OverlayTypes;
|
|
11
|
+
export type TriggerInteractionsV1 = 'click' | 'longpress' | 'hover' | 'custom' | 'replace' | 'inline' | 'modal';
|
|
12
|
+
export type OverlayTriggerInteractions = Extract<TriggerInteractions, 'inline' | 'modal' | 'replace'>;
|
|
13
13
|
export interface OverlayOpenCloseDetail {
|
|
14
14
|
interaction: TriggerInteractions;
|
|
15
15
|
reason?: 'external-click';
|
|
@@ -17,7 +17,7 @@ export interface OverlayOpenCloseDetail {
|
|
|
17
17
|
export interface OverlayCloseReasonDetail {
|
|
18
18
|
reason?: 'external-click';
|
|
19
19
|
}
|
|
20
|
-
export
|
|
20
|
+
export type OverlayOptions = {
|
|
21
21
|
delayed?: boolean;
|
|
22
22
|
notImmediatelyClosable?: boolean;
|
|
23
23
|
offset?: number | [number, number];
|
|
@@ -26,7 +26,7 @@ export declare type OverlayOptions = {
|
|
|
26
26
|
trigger?: HTMLElement | VirtualTrigger;
|
|
27
27
|
type?: 'modal' | 'page' | 'hint' | 'auto' | 'manual';
|
|
28
28
|
};
|
|
29
|
-
export
|
|
29
|
+
export type OverlayOptionsV1 = {
|
|
30
30
|
root?: HTMLElement;
|
|
31
31
|
delayed?: boolean;
|
|
32
32
|
placement?: Placement;
|
|
@@ -42,9 +42,9 @@ declare global {
|
|
|
42
42
|
'sp-closed': CustomEvent<OverlayOpenCloseDetail>;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
export
|
|
45
|
+
export type OpenableElement = HTMLElement & {
|
|
46
46
|
open: boolean;
|
|
47
47
|
tipElement?: HTMLElement;
|
|
48
48
|
updateComplete?: Promise<void>;
|
|
49
49
|
};
|
|
50
|
-
export
|
|
50
|
+
export type OverlayState = 'closed' | 'opening' | 'opened' | 'closing';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["slottable-request-directive.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport {\n ElementPart,\n nothing,\n render,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { AsyncDirective, directive } from 'lit/async-directive.js';\nimport {\n removeSlottableRequest,\n SlottableRequestEvent,\n} from './slottable-request-event.dev.js'\n\nexport class SlottableRequestDirective extends AsyncDirective {\n protected template!: () => TemplateResult;\n protected target!: HTMLElement;\n private renderBefore: HTMLElement | undefined;\n protected listenerHost!: HTMLElement;\n protected listeners!: AbortController;\n\n /* c8 ignore next 9 */\n render(_template: () => TemplateResult): unknown {\n // render function here just defines the interface to the update call later\n // we don't have anything to render since this is intended to be an ElementPart directive\n // so will be used on an element and is not itself rendered\n return nothing;\n }\n\n override update(\n part: ElementPart,\n [template]: Parameters<this['render']>\n ): void {\n this.template = template;\n if (this.target !== part.element) {\n this.target = part.element as HTMLElement;\n this.renderBefore = this.target.children[0] as HTMLElement;\n }\n this.listenerHost = this.target;\n this.init();\n }\n\n handleSlottableRequest(event: SlottableRequestEvent): void {\n /* c8 ignore next 1 */\n if (event.target !== event.currentTarget) return;\n\n const willRemoveSlottable = event.data === removeSlottableRequest;\n\n render(willRemoveSlottable ? undefined : this.template(), this.target, {\n renderBefore: this.renderBefore,\n });\n }\n\n init(): void {\n this.listeners?.abort();\n this.listeners = new AbortController();\n const { signal } = this.listeners;\n this.listenerHost.addEventListener(\n 'slottable-request',\n (event: Event) =>\n this.handleSlottableRequest(event as SlottableRequestEvent),\n { signal }\n );\n\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n undefined,\n `\u26A0\uFE0F WARNING \u26A0\uFE0F : The Overlay Trigger Directive is experimental and there is no guarantees behind its usage in an application!! Its API and presence within the library could be changed at anytime. See \"sp-overlay\" or \"Overlay.open()\" for a stable API for overlaying content on your application.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/overlay',\n {\n level: 'high',\n type: 'api',\n }\n );\n }\n }\n\n override disconnected(): void {\n this.listeners
|
|
5
|
-
"mappings": ";AAWA;AAAA,EAEI;AAAA,EACA;AAAA,OAEG;AACP,SAAS,gBAAgB,iBAAiB;AAC1C;AAAA,EACI;AAAA,OAEG;AAEA,aAAM,kCAAkC,eAAe;AAAA;AAAA,EAQ1D,OAAO,WAA0C;AAI7C,WAAO;AAAA,EACX;AAAA,EAES,OACL,MACA,CAAC,QAAQ,GACL;AACJ,SAAK,WAAW;AAChB,QAAI,KAAK,WAAW,KAAK,SAAS;AAC9B,WAAK,SAAS,KAAK;AACnB,WAAK,eAAe,KAAK,OAAO,SAAS,CAAC;AAAA,IAC9C;AACA,SAAK,eAAe,KAAK;AACzB,SAAK,KAAK;AAAA,EACd;AAAA,EAEA,uBAAuB,OAAoC;AAEvD,QAAI,MAAM,WAAW,MAAM;AAAe;AAE1C,UAAM,sBAAsB,MAAM,SAAS;AAE3C,WAAO,sBAAsB,SAAY,KAAK,SAAS,GAAG,KAAK,QAAQ;AAAA,MACnE,cAAc,KAAK;AAAA,IACvB,CAAC;AAAA,EACL;AAAA,EAEA,OAAa;AA9DjB;AA+DQ,eAAK,cAAL,mBAAgB;AAChB,SAAK,YAAY,IAAI,gBAAgB;AACrC,UAAM,EAAE,OAAO,IAAI,KAAK;AACxB,SAAK,aAAa;AAAA,MACd;AAAA,MACA,CAAC,UACG,KAAK,uBAAuB,KAA8B;AAAA,MAC9D,EAAE,OAAO;AAAA,IACb;AAEA,QAAI,MAAoB;AACpB,aAAO,MAAM;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,UACI,OAAO;AAAA,UACP,MAAM;AAAA,QACV;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AAAA,EAES,eAAqB;
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport {\n ElementPart,\n nothing,\n render,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { AsyncDirective, directive } from 'lit/async-directive.js';\nimport {\n removeSlottableRequest,\n SlottableRequestEvent,\n} from './slottable-request-event.dev.js'\n\nexport class SlottableRequestDirective extends AsyncDirective {\n protected template!: () => TemplateResult;\n protected target!: HTMLElement;\n private renderBefore: HTMLElement | undefined;\n protected listenerHost!: HTMLElement;\n protected listeners!: AbortController;\n\n /* c8 ignore next 9 */\n render(_template: () => TemplateResult): unknown {\n // render function here just defines the interface to the update call later\n // we don't have anything to render since this is intended to be an ElementPart directive\n // so will be used on an element and is not itself rendered\n return nothing;\n }\n\n override update(\n part: ElementPart,\n [template]: Parameters<this['render']>\n ): void {\n this.template = template;\n if (this.target !== part.element) {\n this.target = part.element as HTMLElement;\n this.renderBefore = this.target.children[0] as HTMLElement;\n }\n this.listenerHost = this.target;\n this.init();\n }\n\n handleSlottableRequest(event: SlottableRequestEvent): void {\n /* c8 ignore next 1 */\n if (event.target !== event.currentTarget) return;\n\n const willRemoveSlottable = event.data === removeSlottableRequest;\n\n render(willRemoveSlottable ? undefined : this.template(), this.target, {\n renderBefore: this.renderBefore,\n });\n }\n\n init(): void {\n this.listeners?.abort();\n this.listeners = new AbortController();\n const { signal } = this.listeners;\n this.listenerHost.addEventListener(\n 'slottable-request',\n (event: Event) =>\n this.handleSlottableRequest(event as SlottableRequestEvent),\n { signal }\n );\n\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n undefined,\n `\u26A0\uFE0F WARNING \u26A0\uFE0F : The Overlay Trigger Directive is experimental and there is no guarantees behind its usage in an application!! Its API and presence within the library could be changed at anytime. See \"sp-overlay\" or \"Overlay.open()\" for a stable API for overlaying content on your application.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/overlay',\n {\n level: 'high',\n type: 'api',\n }\n );\n }\n }\n\n override disconnected(): void {\n this.listeners?.abort();\n }\n\n /* c8 ignore next 3 */\n override reconnected(): void {\n this.init();\n }\n}\n\nexport const slottableRequest = directive(SlottableRequestDirective);\n"],
|
|
5
|
+
"mappings": ";AAWA;AAAA,EAEI;AAAA,EACA;AAAA,OAEG;AACP,SAAS,gBAAgB,iBAAiB;AAC1C;AAAA,EACI;AAAA,OAEG;AAEA,aAAM,kCAAkC,eAAe;AAAA;AAAA,EAQ1D,OAAO,WAA0C;AAI7C,WAAO;AAAA,EACX;AAAA,EAES,OACL,MACA,CAAC,QAAQ,GACL;AACJ,SAAK,WAAW;AAChB,QAAI,KAAK,WAAW,KAAK,SAAS;AAC9B,WAAK,SAAS,KAAK;AACnB,WAAK,eAAe,KAAK,OAAO,SAAS,CAAC;AAAA,IAC9C;AACA,SAAK,eAAe,KAAK;AACzB,SAAK,KAAK;AAAA,EACd;AAAA,EAEA,uBAAuB,OAAoC;AAEvD,QAAI,MAAM,WAAW,MAAM;AAAe;AAE1C,UAAM,sBAAsB,MAAM,SAAS;AAE3C,WAAO,sBAAsB,SAAY,KAAK,SAAS,GAAG,KAAK,QAAQ;AAAA,MACnE,cAAc,KAAK;AAAA,IACvB,CAAC;AAAA,EACL;AAAA,EAEA,OAAa;AA9DjB;AA+DQ,eAAK,cAAL,mBAAgB;AAChB,SAAK,YAAY,IAAI,gBAAgB;AACrC,UAAM,EAAE,OAAO,IAAI,KAAK;AACxB,SAAK,aAAa;AAAA,MACd;AAAA,MACA,CAAC,UACG,KAAK,uBAAuB,KAA8B;AAAA,MAC9D,EAAE,OAAO;AAAA,IACb;AAEA,QAAI,MAAoB;AACpB,aAAO,MAAM;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,UACI,OAAO;AAAA,UACP,MAAM;AAAA,QACV;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AAAA,EAES,eAAqB;AAtFlC;AAuFQ,eAAK,cAAL,mBAAgB;AAAA,EACpB;AAAA;AAAA,EAGS,cAAoB;AACzB,SAAK,KAAK;AAAA,EACd;AACJ;AAEO,aAAM,mBAAmB,UAAU,yBAAyB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";import{nothing as n,render as i}from"@spectrum-web-components/base";import{AsyncDirective as s,directive as o}from"lit/async-directive.js";import{removeSlottableRequest as l}from"./slottable-request-event.js";export class SlottableRequestDirective extends s{render(e){return n}update(e,[t]){this.template=t,this.target!==e.element&&(this.target=e.element,this.renderBefore=this.target.children[0]),this.listenerHost=this.target,this.init()}handleSlottableRequest(e){if(e.target!==e.currentTarget)return;const t=e.data===l;i(t?void 0:this.template(),this.target,{renderBefore:this.renderBefore})}init(){var t;(t=this.listeners)==null||t.abort(),this.listeners=new AbortController;const{signal:e}=this.listeners;this.listenerHost.addEventListener("slottable-request",r=>this.handleSlottableRequest(r),{signal:e})}disconnected(){this.listeners.abort()}reconnected(){this.init()}}export const slottableRequest=o(SlottableRequestDirective);
|
|
1
|
+
"use strict";import{nothing as n,render as i}from"@spectrum-web-components/base";import{AsyncDirective as s,directive as o}from"lit/async-directive.js";import{removeSlottableRequest as l}from"./slottable-request-event.js";export class SlottableRequestDirective extends s{render(e){return n}update(e,[t]){this.template=t,this.target!==e.element&&(this.target=e.element,this.renderBefore=this.target.children[0]),this.listenerHost=this.target,this.init()}handleSlottableRequest(e){if(e.target!==e.currentTarget)return;const t=e.data===l;i(t?void 0:this.template(),this.target,{renderBefore:this.renderBefore})}init(){var t;(t=this.listeners)==null||t.abort(),this.listeners=new AbortController;const{signal:e}=this.listeners;this.listenerHost.addEventListener("slottable-request",r=>this.handleSlottableRequest(r),{signal:e})}disconnected(){var e;(e=this.listeners)==null||e.abort()}reconnected(){this.init()}}export const slottableRequest=o(SlottableRequestDirective);
|
|
2
2
|
//# sourceMappingURL=slottable-request-directive.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["slottable-request-directive.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport {\n ElementPart,\n nothing,\n render,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { AsyncDirective, directive } from 'lit/async-directive.js';\nimport {\n removeSlottableRequest,\n SlottableRequestEvent,\n} from './slottable-request-event.js';\n\nexport class SlottableRequestDirective extends AsyncDirective {\n protected template!: () => TemplateResult;\n protected target!: HTMLElement;\n private renderBefore: HTMLElement | undefined;\n protected listenerHost!: HTMLElement;\n protected listeners!: AbortController;\n\n /* c8 ignore next 9 */\n render(_template: () => TemplateResult): unknown {\n // render function here just defines the interface to the update call later\n // we don't have anything to render since this is intended to be an ElementPart directive\n // so will be used on an element and is not itself rendered\n return nothing;\n }\n\n override update(\n part: ElementPart,\n [template]: Parameters<this['render']>\n ): void {\n this.template = template;\n if (this.target !== part.element) {\n this.target = part.element as HTMLElement;\n this.renderBefore = this.target.children[0] as HTMLElement;\n }\n this.listenerHost = this.target;\n this.init();\n }\n\n handleSlottableRequest(event: SlottableRequestEvent): void {\n /* c8 ignore next 1 */\n if (event.target !== event.currentTarget) return;\n\n const willRemoveSlottable = event.data === removeSlottableRequest;\n\n render(willRemoveSlottable ? undefined : this.template(), this.target, {\n renderBefore: this.renderBefore,\n });\n }\n\n init(): void {\n this.listeners?.abort();\n this.listeners = new AbortController();\n const { signal } = this.listeners;\n this.listenerHost.addEventListener(\n 'slottable-request',\n (event: Event) =>\n this.handleSlottableRequest(event as SlottableRequestEvent),\n { signal }\n );\n\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n undefined,\n `\u26A0\uFE0F WARNING \u26A0\uFE0F : The Overlay Trigger Directive is experimental and there is no guarantees behind its usage in an application!! Its API and presence within the library could be changed at anytime. See \"sp-overlay\" or \"Overlay.open()\" for a stable API for overlaying content on your application.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/overlay',\n {\n level: 'high',\n type: 'api',\n }\n );\n }\n }\n\n override disconnected(): void {\n this.listeners
|
|
5
|
-
"mappings": "aAWA,OAEI,WAAAA,EACA,UAAAC,MAEG,gCACP,OAAS,kBAAAC,EAAgB,aAAAC,MAAiB,yBAC1C,OACI,0BAAAC,MAEG,+BAEA,aAAM,kCAAkCF,CAAe,CAQ1D,OAAOG,EAA0C,CAI7C,OAAOL,CACX,CAES,OACLM,EACA,CAACC,CAAQ,EACL,CACJ,KAAK,SAAWA,EACZ,KAAK,SAAWD,EAAK,UACrB,KAAK,OAASA,EAAK,QACnB,KAAK,aAAe,KAAK,OAAO,SAAS,CAAC,GAE9C,KAAK,aAAe,KAAK,OACzB,KAAK,KAAK,CACd,CAEA,uBAAuBE,EAAoC,CAEvD,GAAIA,EAAM,SAAWA,EAAM,cAAe,OAE1C,MAAMC,EAAsBD,EAAM,OAASJ,EAE3CH,EAAOQ,EAAsB,OAAY,KAAK,SAAS,EAAG,KAAK,OAAQ,CACnE,aAAc,KAAK,YACvB,CAAC,CACL,CAEA,MAAa,CA9DjB,IAAAC,GA+DQA,EAAA,KAAK,YAAL,MAAAA,EAAgB,QAChB,KAAK,UAAY,IAAI,gBACrB,KAAM,CAAE,OAAAC,CAAO,EAAI,KAAK,UACxB,KAAK,aAAa,iBACd,oBACCH,GACG,KAAK,uBAAuBA,CAA8B,EAC9D,CAAE,OAAAG,CAAO,CACb,CAaJ,CAES,cAAqB,
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport {\n ElementPart,\n nothing,\n render,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { AsyncDirective, directive } from 'lit/async-directive.js';\nimport {\n removeSlottableRequest,\n SlottableRequestEvent,\n} from './slottable-request-event.js';\n\nexport class SlottableRequestDirective extends AsyncDirective {\n protected template!: () => TemplateResult;\n protected target!: HTMLElement;\n private renderBefore: HTMLElement | undefined;\n protected listenerHost!: HTMLElement;\n protected listeners!: AbortController;\n\n /* c8 ignore next 9 */\n render(_template: () => TemplateResult): unknown {\n // render function here just defines the interface to the update call later\n // we don't have anything to render since this is intended to be an ElementPart directive\n // so will be used on an element and is not itself rendered\n return nothing;\n }\n\n override update(\n part: ElementPart,\n [template]: Parameters<this['render']>\n ): void {\n this.template = template;\n if (this.target !== part.element) {\n this.target = part.element as HTMLElement;\n this.renderBefore = this.target.children[0] as HTMLElement;\n }\n this.listenerHost = this.target;\n this.init();\n }\n\n handleSlottableRequest(event: SlottableRequestEvent): void {\n /* c8 ignore next 1 */\n if (event.target !== event.currentTarget) return;\n\n const willRemoveSlottable = event.data === removeSlottableRequest;\n\n render(willRemoveSlottable ? undefined : this.template(), this.target, {\n renderBefore: this.renderBefore,\n });\n }\n\n init(): void {\n this.listeners?.abort();\n this.listeners = new AbortController();\n const { signal } = this.listeners;\n this.listenerHost.addEventListener(\n 'slottable-request',\n (event: Event) =>\n this.handleSlottableRequest(event as SlottableRequestEvent),\n { signal }\n );\n\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n undefined,\n `\u26A0\uFE0F WARNING \u26A0\uFE0F : The Overlay Trigger Directive is experimental and there is no guarantees behind its usage in an application!! Its API and presence within the library could be changed at anytime. See \"sp-overlay\" or \"Overlay.open()\" for a stable API for overlaying content on your application.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/overlay',\n {\n level: 'high',\n type: 'api',\n }\n );\n }\n }\n\n override disconnected(): void {\n this.listeners?.abort();\n }\n\n /* c8 ignore next 3 */\n override reconnected(): void {\n this.init();\n }\n}\n\nexport const slottableRequest = directive(SlottableRequestDirective);\n"],
|
|
5
|
+
"mappings": "aAWA,OAEI,WAAAA,EACA,UAAAC,MAEG,gCACP,OAAS,kBAAAC,EAAgB,aAAAC,MAAiB,yBAC1C,OACI,0BAAAC,MAEG,+BAEA,aAAM,kCAAkCF,CAAe,CAQ1D,OAAOG,EAA0C,CAI7C,OAAOL,CACX,CAES,OACLM,EACA,CAACC,CAAQ,EACL,CACJ,KAAK,SAAWA,EACZ,KAAK,SAAWD,EAAK,UACrB,KAAK,OAASA,EAAK,QACnB,KAAK,aAAe,KAAK,OAAO,SAAS,CAAC,GAE9C,KAAK,aAAe,KAAK,OACzB,KAAK,KAAK,CACd,CAEA,uBAAuBE,EAAoC,CAEvD,GAAIA,EAAM,SAAWA,EAAM,cAAe,OAE1C,MAAMC,EAAsBD,EAAM,OAASJ,EAE3CH,EAAOQ,EAAsB,OAAY,KAAK,SAAS,EAAG,KAAK,OAAQ,CACnE,aAAc,KAAK,YACvB,CAAC,CACL,CAEA,MAAa,CA9DjB,IAAAC,GA+DQA,EAAA,KAAK,YAAL,MAAAA,EAAgB,QAChB,KAAK,UAAY,IAAI,gBACrB,KAAM,CAAE,OAAAC,CAAO,EAAI,KAAK,UACxB,KAAK,aAAa,iBACd,oBACCH,GACG,KAAK,uBAAuBA,CAA8B,EAC9D,CAAE,OAAAG,CAAO,CACb,CAaJ,CAES,cAAqB,CAtFlC,IAAAD,GAuFQA,EAAA,KAAK,YAAL,MAAAA,EAAgB,OACpB,CAGS,aAAoB,CACzB,KAAK,KAAK,CACd,CACJ,CAEO,aAAM,iBAAmBP,EAAU,yBAAyB",
|
|
6
6
|
"names": ["nothing", "render", "AsyncDirective", "directive", "removeSlottableRequest", "_template", "part", "template", "event", "willRemoveSlottable", "_a", "signal"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";export class SlottableRequestEvent extends Event{constructor(e,n,t){super("slottable-request",{bubbles:!1,cancelable:!0,composed:!1})
|
|
1
|
+
"use strict";export class SlottableRequestEvent extends Event{constructor(e,n,t){super("slottable-request",{bubbles:!1,cancelable:!0,composed:!1}),this.name=e,this.data=n,this.slotName=t!==void 0?`${e}.${t}`:e}}export const removeSlottableRequest=Symbol("remove-slottable-request");
|
|
2
2
|
//# sourceMappingURL=slottable-request-event.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ClickController } from './ClickController.js';
|
|
2
|
+
import { HoverController } from './HoverController.js';
|
|
3
|
+
import { LongpressController } from './LongpressController.js';
|
|
4
|
+
export declare const strategies: {
|
|
5
|
+
click: typeof ClickController;
|
|
6
|
+
longpress: typeof LongpressController;
|
|
7
|
+
hover: typeof HoverController;
|
|
8
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { ClickController } from "./ClickController.dev.js";
|
|
3
|
+
import { HoverController } from "./HoverController.dev.js";
|
|
4
|
+
import { LongpressController } from "./LongpressController.dev.js";
|
|
5
|
+
export const strategies = {
|
|
6
|
+
click: ClickController,
|
|
7
|
+
longpress: LongpressController,
|
|
8
|
+
hover: HoverController
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=strategies.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["strategies.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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 { ClickController } from './ClickController.dev.js'\nimport { HoverController } from './HoverController.dev.js'\nimport { LongpressController } from './LongpressController.dev.js'\n\nexport const strategies = {\n click: ClickController,\n longpress: LongpressController,\n hover: HoverController,\n};\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAChC,SAAS,2BAA2B;AAE7B,aAAM,aAAa;AAAA,EACtB,OAAO;AAAA,EACP,WAAW;AAAA,EACX,OAAO;AACX;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";import{ClickController as o}from"./ClickController.js";import{HoverController as r}from"./HoverController.js";import{LongpressController as e}from"./LongpressController.js";export const strategies={click:o,longpress:e,hover:r};
|
|
2
|
+
//# sourceMappingURL=strategies.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["strategies.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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 { ClickController } from './ClickController.js';\nimport { HoverController } from './HoverController.js';\nimport { LongpressController } from './LongpressController.js';\n\nexport const strategies = {\n click: ClickController,\n longpress: LongpressController,\n hover: HoverController,\n};\n"],
|
|
5
|
+
"mappings": "aAYA,OAAS,mBAAAA,MAAuB,uBAChC,OAAS,mBAAAC,MAAuB,uBAChC,OAAS,uBAAAC,MAA2B,2BAE7B,aAAM,WAAa,CACtB,MAAOF,EACP,UAAWE,EACX,MAAOD,CACX",
|
|
6
|
+
"names": ["ClickController", "HoverController", "LongpressController"]
|
|
7
|
+
}
|
|
@@ -560,13 +560,13 @@ export const deepNesting = () => {
|
|
|
560
560
|
${storyStyles}
|
|
561
561
|
<sp-theme
|
|
562
562
|
color=${outter}
|
|
563
|
-
|
|
563
|
+
system=${window.__swc_hack_knobs__.defaultSystemVariant}
|
|
564
564
|
scale=${window.__swc_hack_knobs__.defaultScale}
|
|
565
565
|
dir=${window.__swc_hack_knobs__.defaultDirection}
|
|
566
566
|
>
|
|
567
567
|
<sp-theme
|
|
568
568
|
color=${color}
|
|
569
|
-
|
|
569
|
+
system=${window.__swc_hack_knobs__.defaultSystemVariant}
|
|
570
570
|
scale=${window.__swc_hack_knobs__.defaultScale}
|
|
571
571
|
dir=${window.__swc_hack_knobs__.defaultDirection}
|
|
572
572
|
>
|