@spectrum-web-components/base 0.36.0 → 0.38.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/base",
3
- "version": "0.36.0",
3
+ "version": "0.38.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -107,5 +107,5 @@
107
107
  "sideEffects": [
108
108
  "./**/*.dev.js"
109
109
  ],
110
- "gitHead": "a532ff8a410abeefb54d9638a2316ae82570566e"
110
+ "gitHead": "9a099b7543672f2fd4030833ab813b16c2cad62e"
111
111
  }
package/src/Base.dev.js CHANGED
@@ -23,7 +23,25 @@ export function SpectrumMixin(constructor) {
23
23
  return this.dir === "ltr";
24
24
  }
25
25
  hasVisibleFocusInTree() {
26
- const activeElement = this.getRootNode().activeElement;
26
+ const getAncestors = (root = document) => {
27
+ var _a2;
28
+ let currentNode = root.activeElement;
29
+ while ((currentNode == null ? void 0 : currentNode.shadowRoot) && currentNode.shadowRoot.activeElement) {
30
+ currentNode = currentNode.shadowRoot.activeElement;
31
+ }
32
+ const ancestors = currentNode ? [currentNode] : [];
33
+ while (currentNode) {
34
+ const ancestor = currentNode.assignedSlot || currentNode.parentElement || ((_a2 = currentNode.getRootNode()) == null ? void 0 : _a2.host);
35
+ if (ancestor) {
36
+ ancestors.push(ancestor);
37
+ }
38
+ currentNode = ancestor;
39
+ }
40
+ return ancestors;
41
+ };
42
+ const activeElement = getAncestors(
43
+ this.getRootNode()
44
+ )[0];
27
45
  if (!activeElement) {
28
46
  return false;
29
47
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["Base.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { LitElement, ReactiveElement } from 'lit';\ntype ThemeRoot = HTMLElement & {\n startManagingContentDirection: (el: HTMLElement) => void;\n stopManagingContentDirection: (el: HTMLElement) => void;\n};\n\ntype Constructor<T = Record<string, unknown>> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n prototype: T;\n};\n\nexport interface SpectrumInterface {\n shadowRoot: ShadowRoot;\n isLTR: boolean;\n hasVisibleFocusInTree(): boolean;\n dir: 'ltr' | 'rtl';\n}\n\nconst observedForElements: Set<HTMLElement> = new Set();\n\nconst updateRTL = (): void => {\n const dir =\n document.documentElement.dir === 'rtl'\n ? document.documentElement.dir\n : 'ltr';\n observedForElements.forEach((el) => {\n el.setAttribute('dir', dir);\n });\n};\n\nconst rtlObserver = new MutationObserver(updateRTL);\n\nrtlObserver.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['dir'],\n});\n\ntype ContentDirectionManager = HTMLElement & {\n startManagingContentDirection?(): void;\n};\n\nconst canManageContentDirection = (el: ContentDirectionManager): boolean =>\n typeof el.startManagingContentDirection !== 'undefined' ||\n el.tagName === 'SP-THEME';\n\nexport function SpectrumMixin<T extends Constructor<ReactiveElement>>(\n constructor: T\n): T & Constructor<SpectrumInterface> {\n class SpectrumMixinElement extends constructor {\n /**\n * @private\n */\n public override shadowRoot!: ShadowRoot;\n private _dirParent?: HTMLElement;\n\n /**\n * @private\n */\n public override dir!: 'ltr' | 'rtl';\n\n /**\n * @private\n */\n public get isLTR(): boolean {\n return this.dir === 'ltr';\n }\n\n public hasVisibleFocusInTree(): boolean {\n const activeElement = (this.getRootNode() as Document)\n .activeElement as HTMLElement;\n if (!activeElement) {\n return false;\n }\n // Browsers without support for the `:focus-visible`\n // selector will throw on the following test (Safari, older things).\n // Some won't throw, but will be focusing item rather than the menu and\n // will rely on the polyfill to know whether focus is \"visible\" or not.\n try {\n return (\n activeElement.matches(':focus-visible') ||\n activeElement.matches('.focus-visible')\n );\n /* c8 ignore next 3 */\n } catch (error) {\n return activeElement.matches('.focus-visible');\n }\n }\n\n public override connectedCallback(): void {\n if (!this.hasAttribute('dir')) {\n let dirParent = ((this as HTMLElement).assignedSlot ||\n this.parentNode) as HTMLElement;\n while (\n dirParent !== document.documentElement &&\n !canManageContentDirection(\n dirParent as ContentDirectionManager\n )\n ) {\n dirParent = ((dirParent as HTMLElement).assignedSlot || // step into the shadow DOM of the parent of a slotted node\n dirParent.parentNode || // DOM Element detected\n (dirParent as unknown as ShadowRoot)\n .host) as HTMLElement;\n }\n this.dir =\n dirParent.dir === 'rtl' ? dirParent.dir : this.dir || 'ltr';\n if (dirParent === document.documentElement) {\n observedForElements.add(this);\n } else {\n const { localName } = dirParent;\n if (\n localName.search('-') > -1 &&\n !customElements.get(localName)\n ) {\n customElements.whenDefined(localName).then(() => {\n (\n dirParent as ThemeRoot\n ).startManagingContentDirection(this);\n });\n } else {\n (dirParent as ThemeRoot).startManagingContentDirection(\n this\n );\n }\n }\n this._dirParent = dirParent as HTMLElement;\n }\n super.connectedCallback();\n }\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this._dirParent) {\n if (this._dirParent === document.documentElement) {\n observedForElements.delete(this);\n } else {\n (this._dirParent as ThemeRoot).stopManagingContentDirection(\n this\n );\n }\n this.removeAttribute('dir');\n }\n }\n }\n return SpectrumMixinElement;\n}\n\nexport class SpectrumElement extends SpectrumMixin(LitElement) {}\n\nif (window.__swc.DEBUG) {\n const ignoreWarningTypes = {\n default: false,\n accessibility: false,\n api: false,\n };\n const ignoreWarningLevels = {\n default: false,\n low: false,\n medium: false,\n high: false,\n deprecation: false,\n };\n window.__swc = {\n ...window.__swc,\n ignoreWarningLocalNames: {\n ...(window.__swc?.ignoreWarningLocalNames || {}),\n },\n ignoreWarningTypes: {\n ...ignoreWarningTypes,\n ...(window.__swc?.ignoreWarningTypes || {}),\n },\n ignoreWarningLevels: {\n ...ignoreWarningLevels,\n ...(window.__swc?.ignoreWarningLevels || {}),\n },\n issuedWarnings: new Set(),\n warn: (\n element,\n message,\n url,\n { type = 'api', level = 'default', issues } = {}\n ): void => {\n const { localName = 'base' } = element || {};\n const id = `${localName}:${type}:${level}` as BrandedSWCWarningID;\n if (!window.__swc.verbose && window.__swc.issuedWarnings.has(id))\n return;\n /* c8 ignore next 3 */\n if (window.__swc.ignoreWarningLocalNames[localName]) return;\n if (window.__swc.ignoreWarningTypes[type]) return;\n if (window.__swc.ignoreWarningLevels[level]) return;\n window.__swc.issuedWarnings.add(id);\n let listedIssues = '';\n if (issues && issues.length) {\n issues.unshift('');\n listedIssues = issues.join('\\n - ') + '\\n';\n }\n const intro = level === 'deprecation' ? 'DEPRECATION NOTICE: ' : '';\n const inspectElement = element\n ? '\\nInspect this issue in the follow element:'\n : '';\n const displayURL = (element ? '\\n\\n' : '\\n') + url + '\\n';\n const messages: unknown[] = [];\n messages.push(\n intro + message + '\\n' + listedIssues + inspectElement\n );\n if (element) {\n messages.push(element);\n }\n messages.push(displayURL, {\n data: {\n localName,\n type,\n level,\n },\n });\n console.warn(...messages);\n },\n };\n\n window.__swc.warn(\n undefined,\n 'Spectrum Web Components is in dev mode. Not recommended for production!',\n 'https://opensource.adobe.com/spectrum-web-components/dev-mode/',\n { type: 'default' }\n );\n}\n"],
5
- "mappings": ";AAAA;AAYA,SAAS,kBAAmC;AAmB5C,MAAM,sBAAwC,oBAAI,IAAI;AAEtD,MAAM,YAAY,MAAY;AAC1B,QAAM,MACF,SAAS,gBAAgB,QAAQ,QAC3B,SAAS,gBAAgB,MACzB;AACV,sBAAoB,QAAQ,CAAC,OAAO;AAChC,OAAG,aAAa,OAAO,GAAG;AAAA,EAC9B,CAAC;AACL;AAEA,MAAM,cAAc,IAAI,iBAAiB,SAAS;AAElD,YAA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,OAAO,MAAM,wBAAwB,SAAS;AAAG;AACrD,UAAI,OAAO,MAAM,mBAAmB,IAAI;AAAG;AAC3C,UAAI,OAAO,MAAM,oBAAoB,KAAK;AAAG;AAC7C,aAAO,MAAM,eAAe,IAAI,EAAE;AAClC,UAAI,eAAe;AACnB,UAAI,UAAU,OAAO,QAAQ;AACzB,eAAO,QAAQ,EAAE;AACjB,uBAAe,OAAO,KAAK,UAAU,IAAI;AAAA,MAC7C;AACA,YAAM,QAAQ,UAAU,gBAAgB,yBAAyB;AACjE,YAAM,iBAAiB,UACjB,gDACA;AACN,YAAM,cAAc,UAAU,SAAS,QAAQ,MAAM;AACrD,YAAM,WAAsB,CAAC;AAC7B,eAAS;AAAA,QACL,QAAQ,UAAU,OAAO,eAAe;AAAA,MAC5C;AACA,UAAI,SAAS;AACT,iBAAS,KAAK,OAAO;AAAA,MACzB;AACA,eAAS,KAAK,YAAY;AAAA,QACtB,MAAM;AAAA,UACF;AAAA,UACA;AAAA,UACA;AAAA,QACJ;AAAA,MACJ,CAAC;AACD,cAAQ,KAAK,GAAG,QAAQ;AAAA,IAC5B;AAAA,EACJ;AAEA,SAAO,MAAM;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA,EAAE,MAAM,UAAU;AAAA,EACtB;AACJ;",
6
- "names": []
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { LitElement, ReactiveElement } from 'lit';\ntype ThemeRoot = HTMLElement & {\n startManagingContentDirection: (el: HTMLElement) => void;\n stopManagingContentDirection: (el: HTMLElement) => void;\n};\n\ntype Constructor<T = Record<string, unknown>> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n prototype: T;\n};\n\nexport interface SpectrumInterface {\n shadowRoot: ShadowRoot;\n isLTR: boolean;\n hasVisibleFocusInTree(): boolean;\n dir: 'ltr' | 'rtl';\n}\n\nconst observedForElements: Set<HTMLElement> = new Set();\n\nconst updateRTL = (): void => {\n const dir =\n document.documentElement.dir === 'rtl'\n ? document.documentElement.dir\n : 'ltr';\n observedForElements.forEach((el) => {\n el.setAttribute('dir', dir);\n });\n};\n\nconst rtlObserver = new MutationObserver(updateRTL);\n\nrtlObserver.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['dir'],\n});\n\ntype ContentDirectionManager = HTMLElement & {\n startManagingContentDirection?(): void;\n};\n\nconst canManageContentDirection = (el: ContentDirectionManager): boolean =>\n typeof el.startManagingContentDirection !== 'undefined' ||\n el.tagName === 'SP-THEME';\n\nexport function SpectrumMixin<T extends Constructor<ReactiveElement>>(\n constructor: T\n): T & Constructor<SpectrumInterface> {\n class SpectrumMixinElement extends constructor {\n /**\n * @private\n */\n public override shadowRoot!: ShadowRoot;\n private _dirParent?: HTMLElement;\n\n /**\n * @private\n */\n public override dir!: 'ltr' | 'rtl';\n\n /**\n * @private\n */\n public get isLTR(): boolean {\n return this.dir === 'ltr';\n }\n\n public hasVisibleFocusInTree(): boolean {\n const getAncestors = (root: Document = document): HTMLElement[] => {\n // eslint-disable-next-line @spectrum-web-components/document-active-element\n let currentNode = root.activeElement as HTMLElement;\n while (\n currentNode?.shadowRoot &&\n currentNode.shadowRoot.activeElement\n ) {\n currentNode = currentNode.shadowRoot\n .activeElement as HTMLElement;\n }\n const ancestors: HTMLElement[] = currentNode\n ? [currentNode]\n : [];\n while (currentNode) {\n const ancestor =\n currentNode.assignedSlot ||\n currentNode.parentElement ||\n (currentNode.getRootNode() as ShadowRoot)?.host;\n if (ancestor) {\n ancestors.push(ancestor as HTMLElement);\n }\n currentNode = ancestor as HTMLElement;\n }\n return ancestors;\n };\n const activeElement = getAncestors(\n this.getRootNode() as Document\n )[0];\n if (!activeElement) {\n return false;\n }\n // Browsers without support for the `:focus-visible`\n // selector will throw on the following test (Safari, older things).\n // Some won't throw, but will be focusing item rather than the menu and\n // will rely on the polyfill to know whether focus is \"visible\" or not.\n try {\n return (\n activeElement.matches(':focus-visible') ||\n activeElement.matches('.focus-visible')\n );\n /* c8 ignore next 3 */\n } catch (error) {\n return activeElement.matches('.focus-visible');\n }\n }\n\n public override connectedCallback(): void {\n if (!this.hasAttribute('dir')) {\n let dirParent = ((this as HTMLElement).assignedSlot ||\n this.parentNode) as HTMLElement;\n while (\n dirParent !== document.documentElement &&\n !canManageContentDirection(\n dirParent as ContentDirectionManager\n )\n ) {\n dirParent = ((dirParent as HTMLElement).assignedSlot || // step into the shadow DOM of the parent of a slotted node\n dirParent.parentNode || // DOM Element detected\n (dirParent as unknown as ShadowRoot)\n .host) as HTMLElement;\n }\n this.dir =\n dirParent.dir === 'rtl' ? dirParent.dir : this.dir || 'ltr';\n if (dirParent === document.documentElement) {\n observedForElements.add(this);\n } else {\n const { localName } = dirParent;\n if (\n localName.search('-') > -1 &&\n !customElements.get(localName)\n ) {\n customElements.whenDefined(localName).then(() => {\n (\n dirParent as ThemeRoot\n ).startManagingContentDirection(this);\n });\n } else {\n (dirParent as ThemeRoot).startManagingContentDirection(\n this\n );\n }\n }\n this._dirParent = dirParent as HTMLElement;\n }\n super.connectedCallback();\n }\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this._dirParent) {\n if (this._dirParent === document.documentElement) {\n observedForElements.delete(this);\n } else {\n (this._dirParent as ThemeRoot).stopManagingContentDirection(\n this\n );\n }\n this.removeAttribute('dir');\n }\n }\n }\n return SpectrumMixinElement;\n}\n\nexport class SpectrumElement extends SpectrumMixin(LitElement) {}\n\nif (window.__swc.DEBUG) {\n const ignoreWarningTypes = {\n default: false,\n accessibility: false,\n api: false,\n };\n const ignoreWarningLevels = {\n default: false,\n low: false,\n medium: false,\n high: false,\n deprecation: false,\n };\n window.__swc = {\n ...window.__swc,\n ignoreWarningLocalNames: {\n ...(window.__swc?.ignoreWarningLocalNames || {}),\n },\n ignoreWarningTypes: {\n ...ignoreWarningTypes,\n ...(window.__swc?.ignoreWarningTypes || {}),\n },\n ignoreWarningLevels: {\n ...ignoreWarningLevels,\n ...(window.__swc?.ignoreWarningLevels || {}),\n },\n issuedWarnings: new Set(),\n warn: (\n element,\n message,\n url,\n { type = 'api', level = 'default', issues } = {}\n ): void => {\n const { localName = 'base' } = element || {};\n const id = `${localName}:${type}:${level}` as BrandedSWCWarningID;\n if (!window.__swc.verbose && window.__swc.issuedWarnings.has(id))\n return;\n /* c8 ignore next 3 */\n if (window.__swc.ignoreWarningLocalNames[localName]) return;\n if (window.__swc.ignoreWarningTypes[type]) return;\n if (window.__swc.ignoreWarningLevels[level]) return;\n window.__swc.issuedWarnings.add(id);\n let listedIssues = '';\n if (issues && issues.length) {\n issues.unshift('');\n listedIssues = issues.join('\\n - ') + '\\n';\n }\n const intro = level === 'deprecation' ? 'DEPRECATION NOTICE: ' : '';\n const inspectElement = element\n ? '\\nInspect this issue in the follow element:'\n : '';\n const displayURL = (element ? '\\n\\n' : '\\n') + url + '\\n';\n const messages: unknown[] = [];\n messages.push(\n intro + message + '\\n' + listedIssues + inspectElement\n );\n if (element) {\n messages.push(element);\n }\n messages.push(displayURL, {\n data: {\n localName,\n type,\n level,\n },\n });\n console.warn(...messages);\n },\n };\n\n window.__swc.warn(\n undefined,\n 'Spectrum Web Components is in dev mode. Not recommended for production!',\n 'https://opensource.adobe.com/spectrum-web-components/dev-mode/',\n { type: 'default' }\n );\n}\n"],
5
+ "mappings": ";AAAA;AAYA,SAAS,kBAAmC;AAmB5C,MAAM,sBAAwC,oBAAI,IAAI;AAEtD,MAAM,YAAY,MAAY;AAC1B,QAAM,MACF,SAAS,gBAAgB,QAAQ,QAC3B,SAAS,gBAAgB,MACzB;AACV,sBAA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AAG,QAAQ;AAAA,IAC5B;AAAA,EACJ;AAEA,SAAO,MAAM;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA,EAAE,MAAM,UAAU;AAAA,EACtB;AACJ;",
6
+ "names": ["_a"]
7
7
  }
package/src/Base.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";import{LitElement as a}from"lit";const i=new Set,l=()=>{const n=document.documentElement.dir==="rtl"?document.documentElement.dir:"ltr";i.forEach(s=>{s.setAttribute("dir",n)})},c=new MutationObserver(l);c.observe(document.documentElement,{attributes:!0,attributeFilter:["dir"]});const d=n=>typeof n.startManagingContentDirection!="undefined"||n.tagName==="SP-THEME";export function SpectrumMixin(n){class s extends n{get isLTR(){return this.dir==="ltr"}hasVisibleFocusInTree(){const e=this.getRootNode().activeElement;if(!e)return!1;try{return e.matches(":focus-visible")||e.matches(".focus-visible")}catch(t){return e.matches(".focus-visible")}}connectedCallback(){if(!this.hasAttribute("dir")){let e=this.assignedSlot||this.parentNode;for(;e!==document.documentElement&&!d(e);)e=e.assignedSlot||e.parentNode||e.host;if(this.dir=e.dir==="rtl"?e.dir:this.dir||"ltr",e===document.documentElement)i.add(this);else{const{localName:t}=e;t.search("-")>-1&&!customElements.get(t)?customElements.whenDefined(t).then(()=>{e.startManagingContentDirection(this)}):e.startManagingContentDirection(this)}this._dirParent=e}super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._dirParent&&(this._dirParent===document.documentElement?i.delete(this):this._dirParent.stopManagingContentDirection(this),this.removeAttribute("dir"))}}return s}export class SpectrumElement extends SpectrumMixin(a){}
1
+ "use strict";import{LitElement as u}from"lit";const c=new Set,g=()=>{const s=document.documentElement.dir==="rtl"?document.documentElement.dir:"ltr";c.forEach(o=>{o.setAttribute("dir",s)})},w=new MutationObserver(g);w.observe(document.documentElement,{attributes:!0,attributeFilter:["dir"]});const p=s=>typeof s.startManagingContentDirection!="undefined"||s.tagName==="SP-THEME";export function SpectrumMixin(s){class o extends s{get isLTR(){return this.dir==="ltr"}hasVisibleFocusInTree(){const n=((r=document)=>{var l;let t=r.activeElement;for(;t!=null&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;const a=t?[t]:[];for(;t;){const i=t.assignedSlot||t.parentElement||((l=t.getRootNode())==null?void 0:l.host);i&&a.push(i),t=i}return a})(this.getRootNode())[0];if(!n)return!1;try{return n.matches(":focus-visible")||n.matches(".focus-visible")}catch(r){return n.matches(".focus-visible")}}connectedCallback(){if(!this.hasAttribute("dir")){let e=this.assignedSlot||this.parentNode;for(;e!==document.documentElement&&!p(e);)e=e.assignedSlot||e.parentNode||e.host;if(this.dir=e.dir==="rtl"?e.dir:this.dir||"ltr",e===document.documentElement)c.add(this);else{const{localName:n}=e;n.search("-")>-1&&!customElements.get(n)?customElements.whenDefined(n).then(()=>{e.startManagingContentDirection(this)}):e.startManagingContentDirection(this)}this._dirParent=e}super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._dirParent&&(this._dirParent===document.documentElement?c.delete(this):this._dirParent.stopManagingContentDirection(this),this.removeAttribute("dir"))}}return o}export class SpectrumElement extends SpectrumMixin(u){}
2
2
  //# sourceMappingURL=Base.js.map
package/src/Base.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["Base.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { LitElement, ReactiveElement } from 'lit';\ntype ThemeRoot = HTMLElement & {\n startManagingContentDirection: (el: HTMLElement) => void;\n stopManagingContentDirection: (el: HTMLElement) => void;\n};\n\ntype Constructor<T = Record<string, unknown>> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n prototype: T;\n};\n\nexport interface SpectrumInterface {\n shadowRoot: ShadowRoot;\n isLTR: boolean;\n hasVisibleFocusInTree(): boolean;\n dir: 'ltr' | 'rtl';\n}\n\nconst observedForElements: Set<HTMLElement> = new Set();\n\nconst updateRTL = (): void => {\n const dir =\n document.documentElement.dir === 'rtl'\n ? document.documentElement.dir\n : 'ltr';\n observedForElements.forEach((el) => {\n el.setAttribute('dir', dir);\n });\n};\n\nconst rtlObserver = new MutationObserver(updateRTL);\n\nrtlObserver.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['dir'],\n});\n\ntype ContentDirectionManager = HTMLElement & {\n startManagingContentDirection?(): void;\n};\n\nconst canManageContentDirection = (el: ContentDirectionManager): boolean =>\n typeof el.startManagingContentDirection !== 'undefined' ||\n el.tagName === 'SP-THEME';\n\nexport function SpectrumMixin<T extends Constructor<ReactiveElement>>(\n constructor: T\n): T & Constructor<SpectrumInterface> {\n class SpectrumMixinElement extends constructor {\n /**\n * @private\n */\n public override shadowRoot!: ShadowRoot;\n private _dirParent?: HTMLElement;\n\n /**\n * @private\n */\n public override dir!: 'ltr' | 'rtl';\n\n /**\n * @private\n */\n public get isLTR(): boolean {\n return this.dir === 'ltr';\n }\n\n public hasVisibleFocusInTree(): boolean {\n const activeElement = (this.getRootNode() as Document)\n .activeElement as HTMLElement;\n if (!activeElement) {\n return false;\n }\n // Browsers without support for the `:focus-visible`\n // selector will throw on the following test (Safari, older things).\n // Some won't throw, but will be focusing item rather than the menu and\n // will rely on the polyfill to know whether focus is \"visible\" or not.\n try {\n return (\n activeElement.matches(':focus-visible') ||\n activeElement.matches('.focus-visible')\n );\n /* c8 ignore next 3 */\n } catch (error) {\n return activeElement.matches('.focus-visible');\n }\n }\n\n public override connectedCallback(): void {\n if (!this.hasAttribute('dir')) {\n let dirParent = ((this as HTMLElement).assignedSlot ||\n this.parentNode) as HTMLElement;\n while (\n dirParent !== document.documentElement &&\n !canManageContentDirection(\n dirParent as ContentDirectionManager\n )\n ) {\n dirParent = ((dirParent as HTMLElement).assignedSlot || // step into the shadow DOM of the parent of a slotted node\n dirParent.parentNode || // DOM Element detected\n (dirParent as unknown as ShadowRoot)\n .host) as HTMLElement;\n }\n this.dir =\n dirParent.dir === 'rtl' ? dirParent.dir : this.dir || 'ltr';\n if (dirParent === document.documentElement) {\n observedForElements.add(this);\n } else {\n const { localName } = dirParent;\n if (\n localName.search('-') > -1 &&\n !customElements.get(localName)\n ) {\n customElements.whenDefined(localName).then(() => {\n (\n dirParent as ThemeRoot\n ).startManagingContentDirection(this);\n });\n } else {\n (dirParent as ThemeRoot).startManagingContentDirection(\n this\n );\n }\n }\n this._dirParent = dirParent as HTMLElement;\n }\n super.connectedCallback();\n }\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this._dirParent) {\n if (this._dirParent === document.documentElement) {\n observedForElements.delete(this);\n } else {\n (this._dirParent as ThemeRoot).stopManagingContentDirection(\n this\n );\n }\n this.removeAttribute('dir');\n }\n }\n }\n return SpectrumMixinElement;\n}\n\nexport class SpectrumElement extends SpectrumMixin(LitElement) {}\n\nif (window.__swc.DEBUG) {\n const ignoreWarningTypes = {\n default: false,\n accessibility: false,\n api: false,\n };\n const ignoreWarningLevels = {\n default: false,\n low: false,\n medium: false,\n high: false,\n deprecation: false,\n };\n window.__swc = {\n ...window.__swc,\n ignoreWarningLocalNames: {\n ...(window.__swc?.ignoreWarningLocalNames || {}),\n },\n ignoreWarningTypes: {\n ...ignoreWarningTypes,\n ...(window.__swc?.ignoreWarningTypes || {}),\n },\n ignoreWarningLevels: {\n ...ignoreWarningLevels,\n ...(window.__swc?.ignoreWarningLevels || {}),\n },\n issuedWarnings: new Set(),\n warn: (\n element,\n message,\n url,\n { type = 'api', level = 'default', issues } = {}\n ): void => {\n const { localName = 'base' } = element || {};\n const id = `${localName}:${type}:${level}` as BrandedSWCWarningID;\n if (!window.__swc.verbose && window.__swc.issuedWarnings.has(id))\n return;\n /* c8 ignore next 3 */\n if (window.__swc.ignoreWarningLocalNames[localName]) return;\n if (window.__swc.ignoreWarningTypes[type]) return;\n if (window.__swc.ignoreWarningLevels[level]) return;\n window.__swc.issuedWarnings.add(id);\n let listedIssues = '';\n if (issues && issues.length) {\n issues.unshift('');\n listedIssues = issues.join('\\n - ') + '\\n';\n }\n const intro = level === 'deprecation' ? 'DEPRECATION NOTICE: ' : '';\n const inspectElement = element\n ? '\\nInspect this issue in the follow element:'\n : '';\n const displayURL = (element ? '\\n\\n' : '\\n') + url + '\\n';\n const messages: unknown[] = [];\n messages.push(\n intro + message + '\\n' + listedIssues + inspectElement\n );\n if (element) {\n messages.push(element);\n }\n messages.push(displayURL, {\n data: {\n localName,\n type,\n level,\n },\n });\n console.warn(...messages);\n },\n };\n\n window.__swc.warn(\n undefined,\n 'Spectrum Web Components is in dev mode. Not recommended for production!',\n 'https://opensource.adobe.com/spectrum-web-components/dev-mode/',\n { type: 'default' }\n );\n}\n"],
5
- "mappings": "aAYA,OAAS,cAAAA,MAAmC,MAmB5C,MAAMC,EAAwC,IAAI,IAE5CC,EAAY,IAAY,CAC1B,MAAMC,EACF,SAAS,gBAAgB,MAAQ,MAC3B,SAAS,gBAAgB,IACzB,MACVF,EAAoB,QAASG,GAAO,CAChCA,EAAG,aAAa,MAAOD,CAAG,CAC9B,CAAC,CACL,EAEME,EAAc,IAAI,iBAAiBH,CAAS,EAElDG,EAAY,QAAQ,SAAS,gBAAiB,CAC1C,WAAY,GACZ,gBAAiB,CAAC,KAAK,CAC3B,CAAC,EAMD,MAAMC,EAA6BF,GAC/B,OAAOA,EAAG,+BAAkC,aAC5CA,EAAG,UAAY,WAEZ,gBAAS,cACZG,EACkC,CAClC,MAAMC,UAA6BD,CAAY,CAe3C,IAAW,OAAiB,CACxB,OAAO,KAAK,MAAQ,KACxB,CAEO,uBAAiC,CACpC,MAAME,EAAiB,KAAK,YAAY,EACnC,cACL,GAAI,CAACA,EACD,MAAO,GAMX,GAAI,CACA,OACIA,EAAc,QAAQ,gBAAgB,GACtCA,EAAc,QAAQ,gBAAgB,CAG9C,OAASC,EAAO,CACZ,OAAOD,EAAc,QAAQ,gBAAgB,CACjD,CACJ,CAEgB,mBAA0B,CACtC,GAAI,CAAC,KAAK,aAAa,KAAK,EAAG,CAC3B,IAAIE,EAAc,KAAqB,cACnC,KAAK,WACT,KACIA,IAAc,SAAS,iBACvB,CAACL,EACGK,CACJ,GAEAA,EAAcA,EAA0B,cACpCA,EAAU,YACTA,EACI,KAIb,GAFA,KAAK,IACDA,EAAU,MAAQ,MAAQA,EAAU,IAAM,KAAK,KAAO,MACtDA,IAAc,SAAS,gBACvBV,EAAoB,IAAI,IAAI,MACzB,CACH,KAAM,CAAE,UAAAW,CAAU,EAAID,EAElBC,EAAU,OAAO,GAAG,EAAI,IACxB,CAAC,eAAe,IAAIA,CAAS,EAE7B,eAAe,YAAYA,CAAS,EAAE,KAAK,IAAM,CAEzCD,EACF,8BAA8B,IAAI,CACxC,CAAC,EAEAA,EAAwB,8BACrB,IACJ,CAER,CACA,KAAK,WAAaA,CACtB,CACA,MAAM,kBAAkB,CAC5B,CAEgB,sBAA6B,CACzC,MAAM,qBAAqB,EACvB,KAAK,aACD,KAAK,aAAe,SAAS,gBAC7BV,EAAoB,OAAO,IAAI,EAE9B,KAAK,WAAyB,6BAC3B,IACJ,EAEJ,KAAK,gBAAgB,KAAK,EAElC,CACJ,CACA,OAAOO,CACX,CAEO,aAAM,wBAAwB,cAAcR,CAAU,CAAE,CAAC",
6
- "names": ["LitElement", "observedForElements", "updateRTL", "dir", "el", "rtlObserver", "canManageContentDirection", "constructor", "SpectrumMixinElement", "activeElement", "error", "dirParent", "localName"]
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { LitElement, ReactiveElement } from 'lit';\ntype ThemeRoot = HTMLElement & {\n startManagingContentDirection: (el: HTMLElement) => void;\n stopManagingContentDirection: (el: HTMLElement) => void;\n};\n\ntype Constructor<T = Record<string, unknown>> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n prototype: T;\n};\n\nexport interface SpectrumInterface {\n shadowRoot: ShadowRoot;\n isLTR: boolean;\n hasVisibleFocusInTree(): boolean;\n dir: 'ltr' | 'rtl';\n}\n\nconst observedForElements: Set<HTMLElement> = new Set();\n\nconst updateRTL = (): void => {\n const dir =\n document.documentElement.dir === 'rtl'\n ? document.documentElement.dir\n : 'ltr';\n observedForElements.forEach((el) => {\n el.setAttribute('dir', dir);\n });\n};\n\nconst rtlObserver = new MutationObserver(updateRTL);\n\nrtlObserver.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['dir'],\n});\n\ntype ContentDirectionManager = HTMLElement & {\n startManagingContentDirection?(): void;\n};\n\nconst canManageContentDirection = (el: ContentDirectionManager): boolean =>\n typeof el.startManagingContentDirection !== 'undefined' ||\n el.tagName === 'SP-THEME';\n\nexport function SpectrumMixin<T extends Constructor<ReactiveElement>>(\n constructor: T\n): T & Constructor<SpectrumInterface> {\n class SpectrumMixinElement extends constructor {\n /**\n * @private\n */\n public override shadowRoot!: ShadowRoot;\n private _dirParent?: HTMLElement;\n\n /**\n * @private\n */\n public override dir!: 'ltr' | 'rtl';\n\n /**\n * @private\n */\n public get isLTR(): boolean {\n return this.dir === 'ltr';\n }\n\n public hasVisibleFocusInTree(): boolean {\n const getAncestors = (root: Document = document): HTMLElement[] => {\n // eslint-disable-next-line @spectrum-web-components/document-active-element\n let currentNode = root.activeElement as HTMLElement;\n while (\n currentNode?.shadowRoot &&\n currentNode.shadowRoot.activeElement\n ) {\n currentNode = currentNode.shadowRoot\n .activeElement as HTMLElement;\n }\n const ancestors: HTMLElement[] = currentNode\n ? [currentNode]\n : [];\n while (currentNode) {\n const ancestor =\n currentNode.assignedSlot ||\n currentNode.parentElement ||\n (currentNode.getRootNode() as ShadowRoot)?.host;\n if (ancestor) {\n ancestors.push(ancestor as HTMLElement);\n }\n currentNode = ancestor as HTMLElement;\n }\n return ancestors;\n };\n const activeElement = getAncestors(\n this.getRootNode() as Document\n )[0];\n if (!activeElement) {\n return false;\n }\n // Browsers without support for the `:focus-visible`\n // selector will throw on the following test (Safari, older things).\n // Some won't throw, but will be focusing item rather than the menu and\n // will rely on the polyfill to know whether focus is \"visible\" or not.\n try {\n return (\n activeElement.matches(':focus-visible') ||\n activeElement.matches('.focus-visible')\n );\n /* c8 ignore next 3 */\n } catch (error) {\n return activeElement.matches('.focus-visible');\n }\n }\n\n public override connectedCallback(): void {\n if (!this.hasAttribute('dir')) {\n let dirParent = ((this as HTMLElement).assignedSlot ||\n this.parentNode) as HTMLElement;\n while (\n dirParent !== document.documentElement &&\n !canManageContentDirection(\n dirParent as ContentDirectionManager\n )\n ) {\n dirParent = ((dirParent as HTMLElement).assignedSlot || // step into the shadow DOM of the parent of a slotted node\n dirParent.parentNode || // DOM Element detected\n (dirParent as unknown as ShadowRoot)\n .host) as HTMLElement;\n }\n this.dir =\n dirParent.dir === 'rtl' ? dirParent.dir : this.dir || 'ltr';\n if (dirParent === document.documentElement) {\n observedForElements.add(this);\n } else {\n const { localName } = dirParent;\n if (\n localName.search('-') > -1 &&\n !customElements.get(localName)\n ) {\n customElements.whenDefined(localName).then(() => {\n (\n dirParent as ThemeRoot\n ).startManagingContentDirection(this);\n });\n } else {\n (dirParent as ThemeRoot).startManagingContentDirection(\n this\n );\n }\n }\n this._dirParent = dirParent as HTMLElement;\n }\n super.connectedCallback();\n }\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this._dirParent) {\n if (this._dirParent === document.documentElement) {\n observedForElements.delete(this);\n } else {\n (this._dirParent as ThemeRoot).stopManagingContentDirection(\n this\n );\n }\n this.removeAttribute('dir');\n }\n }\n }\n return SpectrumMixinElement;\n}\n\nexport class SpectrumElement extends SpectrumMixin(LitElement) {}\n\nif (window.__swc.DEBUG) {\n const ignoreWarningTypes = {\n default: false,\n accessibility: false,\n api: false,\n };\n const ignoreWarningLevels = {\n default: false,\n low: false,\n medium: false,\n high: false,\n deprecation: false,\n };\n window.__swc = {\n ...window.__swc,\n ignoreWarningLocalNames: {\n ...(window.__swc?.ignoreWarningLocalNames || {}),\n },\n ignoreWarningTypes: {\n ...ignoreWarningTypes,\n ...(window.__swc?.ignoreWarningTypes || {}),\n },\n ignoreWarningLevels: {\n ...ignoreWarningLevels,\n ...(window.__swc?.ignoreWarningLevels || {}),\n },\n issuedWarnings: new Set(),\n warn: (\n element,\n message,\n url,\n { type = 'api', level = 'default', issues } = {}\n ): void => {\n const { localName = 'base' } = element || {};\n const id = `${localName}:${type}:${level}` as BrandedSWCWarningID;\n if (!window.__swc.verbose && window.__swc.issuedWarnings.has(id))\n return;\n /* c8 ignore next 3 */\n if (window.__swc.ignoreWarningLocalNames[localName]) return;\n if (window.__swc.ignoreWarningTypes[type]) return;\n if (window.__swc.ignoreWarningLevels[level]) return;\n window.__swc.issuedWarnings.add(id);\n let listedIssues = '';\n if (issues && issues.length) {\n issues.unshift('');\n listedIssues = issues.join('\\n - ') + '\\n';\n }\n const intro = level === 'deprecation' ? 'DEPRECATION NOTICE: ' : '';\n const inspectElement = element\n ? '\\nInspect this issue in the follow element:'\n : '';\n const displayURL = (element ? '\\n\\n' : '\\n') + url + '\\n';\n const messages: unknown[] = [];\n messages.push(\n intro + message + '\\n' + listedIssues + inspectElement\n );\n if (element) {\n messages.push(element);\n }\n messages.push(displayURL, {\n data: {\n localName,\n type,\n level,\n },\n });\n console.warn(...messages);\n },\n };\n\n window.__swc.warn(\n undefined,\n 'Spectrum Web Components is in dev mode. Not recommended for production!',\n 'https://opensource.adobe.com/spectrum-web-components/dev-mode/',\n { type: 'default' }\n );\n}\n"],
5
+ "mappings": "aAYA,OAAS,cAAAA,MAAmC,MAmB5C,MAAMC,EAAwC,IAAI,IAE5CC,EAAY,IAAY,CAC1B,MAAMC,EACF,SAAS,gBAAgB,MAAQ,MAC3B,SAAS,gBAAgB,IACzB,MACVF,EAAoB,QAASG,GAAO,CAChCA,EAAG,aAAa,MAAOD,CAAG,CAC9B,CAAC,CACL,EAEME,EAAc,IAAI,iBAAiBH,CAAS,EAElDG,EAAY,QAAQ,SAAS,gBAAiB,CAC1C,WAAY,GACZ,gBAAiB,CAAC,KAAK,CAC3B,CAAC,EAMD,MAAMC,EAA6BF,GAC/B,OAAOA,EAAG,+BAAkC,aAC5CA,EAAG,UAAY,WAEZ,gBAAS,cACZG,EACkC,CAClC,MAAMC,UAA6BD,CAAY,CAe3C,IAAW,OAAiB,CACxB,OAAO,KAAK,MAAQ,KACxB,CAEO,uBAAiC,CA0BpC,MAAME,GAzBe,CAACC,EAAiB,WAA4B,CAjF/E,IAAAC,EAmFgB,IAAIC,EAAcF,EAAK,cACvB,KACIE,GAAA,MAAAA,EAAa,YACbA,EAAY,WAAW,eAEvBA,EAAcA,EAAY,WACrB,cAET,MAAMC,EAA2BD,EAC3B,CAACA,CAAW,EACZ,CAAC,EACP,KAAOA,GAAa,CAChB,MAAME,EACFF,EAAY,cACZA,EAAY,iBACXD,EAAAC,EAAY,YAAY,IAAxB,YAAAD,EAA0C,MAC3CG,GACAD,EAAU,KAAKC,CAAuB,EAE1CF,EAAcE,CAClB,CACA,OAAOD,CACX,GAEI,KAAK,YAAY,CACrB,EAAE,CAAC,EACH,GAAI,CAACJ,EACD,MAAO,GAMX,GAAI,CACA,OACIA,EAAc,QAAQ,gBAAgB,GACtCA,EAAc,QAAQ,gBAAgB,CAG9C,OAASM,EAAO,CACZ,OAAON,EAAc,QAAQ,gBAAgB,CACjD,CACJ,CAEgB,mBAA0B,CACtC,GAAI,CAAC,KAAK,aAAa,KAAK,EAAG,CAC3B,IAAIO,EAAc,KAAqB,cACnC,KAAK,WACT,KACIA,IAAc,SAAS,iBACvB,CAACV,EACGU,CACJ,GAEAA,EAAcA,EAA0B,cACpCA,EAAU,YACTA,EACI,KAIb,GAFA,KAAK,IACDA,EAAU,MAAQ,MAAQA,EAAU,IAAM,KAAK,KAAO,MACtDA,IAAc,SAAS,gBACvBf,EAAoB,IAAI,IAAI,MACzB,CACH,KAAM,CAAE,UAAAgB,CAAU,EAAID,EAElBC,EAAU,OAAO,GAAG,EAAI,IACxB,CAAC,eAAe,IAAIA,CAAS,EAE7B,eAAe,YAAYA,CAAS,EAAE,KAAK,IAAM,CAEzCD,EACF,8BAA8B,IAAI,CACxC,CAAC,EAEAA,EAAwB,8BACrB,IACJ,CAER,CACA,KAAK,WAAaA,CACtB,CACA,MAAM,kBAAkB,CAC5B,CAEgB,sBAA6B,CACzC,MAAM,qBAAqB,EACvB,KAAK,aACD,KAAK,aAAe,SAAS,gBAC7Bf,EAAoB,OAAO,IAAI,EAE9B,KAAK,WAAyB,6BAC3B,IACJ,EAEJ,KAAK,gBAAgB,KAAK,EAElC,CACJ,CACA,OAAOO,CACX,CAEO,aAAM,wBAAwB,cAAcR,CAAU,CAAE,CAAC",
6
+ "names": ["LitElement", "observedForElements", "updateRTL", "dir", "el", "rtlObserver", "canManageContentDirection", "constructor", "SpectrumMixinElement", "activeElement", "root", "_a", "currentNode", "ancestors", "ancestor", "error", "dirParent", "localName"]
7
7
  }
@@ -45,7 +45,7 @@ const elements = {
45
45
  "sp-menu-item": () => import("@spectrum-web-components/menu/sp-menu-item.js"),
46
46
  "sp-menu": () => import("@spectrum-web-components/menu/sp-menu.js"),
47
47
  "overlay-trigger": () => import("@spectrum-web-components/overlay/overlay-trigger.js"),
48
- "active-overlay": () => import("@spectrum-web-components/overlay/active-overlay.js"),
48
+ "sp-overlay": () => import("@spectrum-web-components/overlay/sp-overlay.js"),
49
49
  "sp-picker": () => import("@spectrum-web-components/picker/sp-picker.js"),
50
50
  "sp-picker-button": () => import("@spectrum-web-components/picker-button/sp-picker-button.js"),
51
51
  "sp-popover": () => import("@spectrum-web-components/popover/sp-popover.js"),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["define-element.test.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { expect } from '@open-wc/testing';\nimport { stub } from 'sinon';\nimport {\n isFirefox,\n isWebKit,\n} from '@spectrum-web-components/shared/src/platform.js';\n\n// for window.__swc\nimport '@spectrum-web-components/base';\n\n// mostly alphabetical,\n// but reordered to put dependents above dependencies,\n// in order to avoid transitive dependency conflicts (eg card -> asset)\nconst elements = {\n 'sp-accordion-item': () =>\n import('@spectrum-web-components/accordion/sp-accordion-item.js'),\n 'sp-accordion': () =>\n import('@spectrum-web-components/accordion/sp-accordion.js'),\n 'sp-action-bar': () =>\n import('@spectrum-web-components/action-bar/sp-action-bar.js'),\n 'sp-action-menu': () =>\n import('@spectrum-web-components/action-menu/sp-action-menu.js'),\n 'sp-action-button': () =>\n import('@spectrum-web-components/action-button/sp-action-button.js'),\n 'sp-action-group': () =>\n import('@spectrum-web-components/action-group/sp-action-group.js'),\n 'sp-card': () => import('@spectrum-web-components/card/sp-card.js'),\n 'sp-asset': () => import('@spectrum-web-components/asset/sp-asset.js'),\n 'sp-avatar': () => import('@spectrum-web-components/avatar/sp-avatar.js'),\n 'sp-badge': () => import('@spectrum-web-components/badge/sp-badge.js'),\n 'sp-banner': () => import('@spectrum-web-components/banner/sp-banner.js'),\n 'sp-dialog-wrapper': () =>\n import('@spectrum-web-components/dialog/sp-dialog-wrapper.js'),\n 'sp-dialog': () => import('@spectrum-web-components/dialog/sp-dialog.js'),\n 'sp-dialog-base': () =>\n import('@spectrum-web-components/dialog/sp-dialog-base.js'),\n 'sp-button': () => import('@spectrum-web-components/button/sp-button.js'),\n 'sp-button-group': () =>\n import('@spectrum-web-components/button-group/sp-button-group.js'),\n 'sp-checkbox': () =>\n import('@spectrum-web-components/checkbox/sp-checkbox.js'),\n 'sp-coachmark': () =>\n import('@spectrum-web-components/coachmark/sp-coachmark.js'),\n 'sp-color-area': () =>\n import('@spectrum-web-components/color-area/sp-color-area.js'),\n 'sp-color-handle': () =>\n import('@spectrum-web-components/color-handle/sp-color-handle.js'),\n 'sp-color-loupe': () =>\n import('@spectrum-web-components/color-loupe/sp-color-loupe.js'),\n 'sp-color-slider': () =>\n import('@spectrum-web-components/color-slider/sp-color-slider.js'),\n 'sp-color-wheel': () =>\n import('@spectrum-web-components/color-wheel/sp-color-wheel.js'),\n 'sp-divider': () =>\n import('@spectrum-web-components/divider/sp-divider.js'),\n 'sp-dropzone': () =>\n import('@spectrum-web-components/dropzone/sp-dropzone.js'),\n 'sp-meter': () => import('@spectrum-web-components/meter/sp-meter.js'),\n 'sp-field-group': () =>\n import('@spectrum-web-components/field-group/sp-field-group.js'),\n 'sp-field-label': () =>\n import('@spectrum-web-components/field-label/sp-field-label.js'),\n 'sp-help-text': () =>\n import('@spectrum-web-components/help-text/sp-help-text.js'),\n 'sp-icon': () => import('@spectrum-web-components/icon/sp-icon.js'),\n 'sp-icons-medium': () =>\n import('@spectrum-web-components/icons/sp-icons-medium.js'),\n 'sp-icons-large': () =>\n import('@spectrum-web-components/icons/sp-icons-large.js'),\n 'sp-illustrated-message': () =>\n import(\n '@spectrum-web-components/illustrated-message/sp-illustrated-message.js'\n ),\n 'sp-link': () => import('@spectrum-web-components/link/sp-link.js'),\n 'sp-menu-group': () =>\n import('@spectrum-web-components/menu/sp-menu-group.js'),\n 'sp-menu-item': () =>\n import('@spectrum-web-components/menu/sp-menu-item.js'),\n 'sp-menu': () => import('@spectrum-web-components/menu/sp-menu.js'),\n 'overlay-trigger': () =>\n import('@spectrum-web-components/overlay/overlay-trigger.js'),\n 'active-overlay': () =>\n import('@spectrum-web-components/overlay/active-overlay.js'),\n 'sp-picker': () => import('@spectrum-web-components/picker/sp-picker.js'),\n 'sp-picker-button': () =>\n import('@spectrum-web-components/picker-button/sp-picker-button.js'),\n 'sp-popover': () =>\n import('@spectrum-web-components/popover/sp-popover.js'),\n 'sp-progress-bar': () =>\n import('@spectrum-web-components/progress-bar/sp-progress-bar.js'),\n 'sp-progress-circle': () =>\n import(\n '@spectrum-web-components/progress-circle/sp-progress-circle.js'\n ),\n 'sp-quick-actions': () =>\n import('@spectrum-web-components/quick-actions/sp-quick-actions.js'),\n 'sp-radio-group': () =>\n import('@spectrum-web-components/radio/sp-radio-group.js'),\n 'sp-radio': () => import('@spectrum-web-components/radio/sp-radio.js'),\n 'sp-search': () => import('@spectrum-web-components/search/sp-search.js'),\n 'sp-sidenav-item': () =>\n import('@spectrum-web-components/sidenav/sp-sidenav-item.js'),\n 'sp-sidenav': () =>\n import('@spectrum-web-components/sidenav/sp-sidenav.js'),\n 'sp-slider': () => import('@spectrum-web-components/slider/sp-slider.js'),\n 'sp-slider-handle': () =>\n import('@spectrum-web-components/slider/sp-slider-handle.js'),\n 'sp-split-button': () =>\n import('@spectrum-web-components/split-button/sp-split-button.js'),\n 'sp-split-view': () =>\n import('@spectrum-web-components/split-view/sp-split-view.js'),\n 'sp-status-light': () =>\n import('@spectrum-web-components/status-light/sp-status-light.js'),\n 'sp-swatch-group': () =>\n import('@spectrum-web-components/swatch/sp-swatch-group.js'),\n 'sp-swatch': () => import('@spectrum-web-components/swatch/sp-swatch.js'),\n 'sp-switch': () => import('@spectrum-web-components/switch/sp-switch.js'),\n 'sp-table': () => import('@spectrum-web-components/table/sp-table.js'),\n 'sp-table-body': () =>\n import('@spectrum-web-components/table/sp-table-body.js'),\n 'sp-table-cell': () =>\n import('@spectrum-web-components/table/sp-table-cell.js'),\n 'sp-table-head': () =>\n import('@spectrum-web-components/table/sp-table-head.js'),\n 'sp-table-checkbox-cell': () =>\n import('@spectrum-web-components/table/sp-table-checkbox-cell.js'),\n 'sp-table-head-cell': () =>\n import('@spectrum-web-components/table/sp-table-head-cell.js'),\n 'sp-table-row': () =>\n import('@spectrum-web-components/table/sp-table-row.js'),\n 'sp-tab': () => import('@spectrum-web-components/tabs/sp-tab.js'),\n 'sp-tabs': () => import('@spectrum-web-components/tabs/sp-tabs.js'),\n 'sp-tabs-overflow': () =>\n import('@spectrum-web-components/tabs/sp-tabs-overflow.js'),\n 'sp-tag': () => import('@spectrum-web-components/tags/sp-tag.js'),\n 'sp-tags': () => import('@spectrum-web-components/tags/sp-tags.js'),\n 'sp-textfield': () =>\n import('@spectrum-web-components/textfield/sp-textfield.js'),\n 'sp-thumbnail': () =>\n import('@spectrum-web-components/thumbnail/sp-thumbnail.js'),\n 'sp-toast': () => import('@spectrum-web-components/toast/sp-toast.js'),\n 'sp-tooltip': () =>\n import('@spectrum-web-components/tooltip/sp-tooltip.js'),\n 'sp-top-nav': () =>\n import('@spectrum-web-components/top-nav/sp-top-nav.js'),\n 'sp-tray': () => import('@spectrum-web-components/tray/sp-tray.js'),\n 'sp-underlay': () =>\n import('@spectrum-web-components/underlay/sp-underlay.js'),\n};\n\nconst browser: 'webkit' | 'firefox' | 'chromium' = isWebKit()\n ? 'webkit'\n : isFirefox()\n ? 'firefox'\n : 'chromium';\n\ndescribe('define-element', function () {\n // registrations are globally-unique, so retries will always fail\n this.retries(0);\n\n beforeEach(function () {\n window.__swc.verbose = true;\n this.warn = stub(console, 'warn');\n });\n\n afterEach(function () {\n this.warn.resetHistory();\n window.__swc.verbose = false;\n this.warn.restore();\n });\n\n Object.entries(elements).forEach(([name, register]) =>\n it(`'${name}' warns on redefinition`, async function () {\n // classes already-defined via transitive dependencies can't be tested this way\n if (customElements.get(name)) {\n this.skip();\n }\n const error = {\n webkit: 'Cannot define multiple custom elements with the same tag name',\n firefox: `'${name}' has already been defined`,\n chromium: `\"${name}\" has already been used with this registry`,\n }[browser];\n let caughtError: Error | undefined;\n\n customElements.define(name, class extends HTMLElement {});\n try {\n await register();\n } catch (error) {\n caughtError = error as Error;\n }\n\n expect(caughtError?.message ?? '').to.include(error);\n expect(this.warn.called, 'should call console.warn()').to.be.true;\n const spyCall = this.warn.getCall(0);\n expect(\n (spyCall.args.at(0) as string).includes('redefine'),\n 'message should warn about redefining an element'\n ).to.be.true;\n })\n );\n});\n"],
5
- "mappings": ";AAYA,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB;AAAA,EACI;AAAA,EACA;AAAA,OACG;AAGP,OAAO;AAKP,MAAM,WAAW;AAAA,EACb,qBAAqB,MACjB,OAAO,yDAAyD;AAAA,EACpE,gBAAgB,MACZ,OAAO,oDAAoD;AAAA,EAC/D,iBAAiB,MACb,OAAO,sDAAsD;AAAA,EACjE,kBAAkB,MACd,OAAO,wDAAwD;AAAA,EACnE,oBAAoB,MAChB,OAAO,4DAA4D;AAAA,EACvE,mBAAmB,MACf,OAAO,0DAA0D;AAAA,EACrE,WAAW,MAAM,OAAO,0CAA0C;AAAA,EAClE,YAAY,MAAM,OAAO,4CAA4C;AAAA,EACrE,aAAa,MAAM,OAAO,8CAA8C;AAAA,EACxE,YAAY,MAAM,OAAO,4CAA4C;AAAA,EACrE,aAAa,MAAM,OAAO,8CAA8C;AAAA,EACxE,qBAAqB,MACjB,OAAO,sDAAsD;AAAA,EACjE,aAAa,MAAM,OAAO,8CAA8C;AAAA,EACxE,kBAAkB,MACd,OAAO,mDAAmD;AAAA,EAC9D,aAAa,MAAM,OAAO,8CAA8C;AAAA,EACxE,mBAAmB,MACf,OAAO,0DAA0D;AAAA,EACrE,eAAe,MACX,OAAO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kBAAkB,WAAY;AAEnC,OAAK,QAAQ,CAAC;AAEd,aAAW,WAAY;AACnB,WAAO,MAAM,UAAU;AACvB,SAAK,OAAO,KAAK,SAAS,MAAM;AAAA,EACpC,CAAC;AAED,YAAU,WAAY;AAClB,SAAK,KAAK,aAAa;AACvB,WAAO,MAAM,UAAU;AACvB,SAAK,KAAK,QAAQ;AAAA,EACtB,CAAC;AAED,SAAO,QAAQ,QAAQ,EAAE;AAAA,IAAQ,CAAC,CAAC,MAAM,QAAQ,MAC7C,GAAG,IAAI,IAAI,2BAA2B,iBAAkB;AAxLhE;AA0LY,UAAI,eAAe,IAAI,IAAI,GAAG;AAC1B,aAAK,KAAK;AAAA,MACd;AACA,YAAM,QAAQ;AAAA,QACV,QAAQ;AAAA,QACR,SAAS,IAAI,IAAI;AAAA,QACjB,UAAU,IAAI,IAAI;AAAA,MACtB,EAAE,OAAO;AACT,UAAI;AAEJ,qBAAe,OAAO,MAAM,cAAc,YAAY;AAAA,MAAC,CAAC;AACxD,UAAI;AACA,cAAM,SAAS;AAAA,MACnB,SAASA,QAAO;AACZ,sBAAcA;AAAA,MAClB;AAEA,cAAO,gDAAa,YAAb,YAAwB,EAAE,EAAE,GAAG,QAAQ,KAAK;AACnD,aAAO,KAAK,KAAK,QAAQ,4BAA4B,EAAE,GAAG,GAAG;AAC7D,YAAM,UAAU,KAAK,KAAK,QAAQ,CAAC;AACnC;AAAA,QACK,QAAQ,KAAK,GAAG,CAAC,EAAa,SAAS,UAAU;AAAA,QAClD;AAAA,MACJ,EAAE,GAAG,GAAG;AAAA,IACZ,CAAC;AAAA,EACL;AACJ,CAAC;",
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { expect } from '@open-wc/testing';\nimport { stub } from 'sinon';\nimport {\n isFirefox,\n isWebKit,\n} from '@spectrum-web-components/shared/src/platform.js';\n\n// for window.__swc\nimport '@spectrum-web-components/base';\n\n// mostly alphabetical,\n// but reordered to put dependents above dependencies,\n// in order to avoid transitive dependency conflicts (eg card -> asset)\nconst elements = {\n 'sp-accordion-item': () =>\n import('@spectrum-web-components/accordion/sp-accordion-item.js'),\n 'sp-accordion': () =>\n import('@spectrum-web-components/accordion/sp-accordion.js'),\n 'sp-action-bar': () =>\n import('@spectrum-web-components/action-bar/sp-action-bar.js'),\n 'sp-action-menu': () =>\n import('@spectrum-web-components/action-menu/sp-action-menu.js'),\n 'sp-action-button': () =>\n import('@spectrum-web-components/action-button/sp-action-button.js'),\n 'sp-action-group': () =>\n import('@spectrum-web-components/action-group/sp-action-group.js'),\n 'sp-card': () => import('@spectrum-web-components/card/sp-card.js'),\n 'sp-asset': () => import('@spectrum-web-components/asset/sp-asset.js'),\n 'sp-avatar': () => import('@spectrum-web-components/avatar/sp-avatar.js'),\n 'sp-badge': () => import('@spectrum-web-components/badge/sp-badge.js'),\n 'sp-banner': () => import('@spectrum-web-components/banner/sp-banner.js'),\n 'sp-dialog-wrapper': () =>\n import('@spectrum-web-components/dialog/sp-dialog-wrapper.js'),\n 'sp-dialog': () => import('@spectrum-web-components/dialog/sp-dialog.js'),\n 'sp-dialog-base': () =>\n import('@spectrum-web-components/dialog/sp-dialog-base.js'),\n 'sp-button': () => import('@spectrum-web-components/button/sp-button.js'),\n 'sp-button-group': () =>\n import('@spectrum-web-components/button-group/sp-button-group.js'),\n 'sp-checkbox': () =>\n import('@spectrum-web-components/checkbox/sp-checkbox.js'),\n 'sp-coachmark': () =>\n import('@spectrum-web-components/coachmark/sp-coachmark.js'),\n 'sp-color-area': () =>\n import('@spectrum-web-components/color-area/sp-color-area.js'),\n 'sp-color-handle': () =>\n import('@spectrum-web-components/color-handle/sp-color-handle.js'),\n 'sp-color-loupe': () =>\n import('@spectrum-web-components/color-loupe/sp-color-loupe.js'),\n 'sp-color-slider': () =>\n import('@spectrum-web-components/color-slider/sp-color-slider.js'),\n 'sp-color-wheel': () =>\n import('@spectrum-web-components/color-wheel/sp-color-wheel.js'),\n 'sp-divider': () =>\n import('@spectrum-web-components/divider/sp-divider.js'),\n 'sp-dropzone': () =>\n import('@spectrum-web-components/dropzone/sp-dropzone.js'),\n 'sp-meter': () => import('@spectrum-web-components/meter/sp-meter.js'),\n 'sp-field-group': () =>\n import('@spectrum-web-components/field-group/sp-field-group.js'),\n 'sp-field-label': () =>\n import('@spectrum-web-components/field-label/sp-field-label.js'),\n 'sp-help-text': () =>\n import('@spectrum-web-components/help-text/sp-help-text.js'),\n 'sp-icon': () => import('@spectrum-web-components/icon/sp-icon.js'),\n 'sp-icons-medium': () =>\n import('@spectrum-web-components/icons/sp-icons-medium.js'),\n 'sp-icons-large': () =>\n import('@spectrum-web-components/icons/sp-icons-large.js'),\n 'sp-illustrated-message': () =>\n import(\n '@spectrum-web-components/illustrated-message/sp-illustrated-message.js'\n ),\n 'sp-link': () => import('@spectrum-web-components/link/sp-link.js'),\n 'sp-menu-group': () =>\n import('@spectrum-web-components/menu/sp-menu-group.js'),\n 'sp-menu-item': () =>\n import('@spectrum-web-components/menu/sp-menu-item.js'),\n 'sp-menu': () => import('@spectrum-web-components/menu/sp-menu.js'),\n 'overlay-trigger': () =>\n import('@spectrum-web-components/overlay/overlay-trigger.js'),\n 'sp-overlay': () =>\n import('@spectrum-web-components/overlay/sp-overlay.js'),\n 'sp-picker': () => import('@spectrum-web-components/picker/sp-picker.js'),\n 'sp-picker-button': () =>\n import('@spectrum-web-components/picker-button/sp-picker-button.js'),\n 'sp-popover': () =>\n import('@spectrum-web-components/popover/sp-popover.js'),\n 'sp-progress-bar': () =>\n import('@spectrum-web-components/progress-bar/sp-progress-bar.js'),\n 'sp-progress-circle': () =>\n import(\n '@spectrum-web-components/progress-circle/sp-progress-circle.js'\n ),\n 'sp-quick-actions': () =>\n import('@spectrum-web-components/quick-actions/sp-quick-actions.js'),\n 'sp-radio-group': () =>\n import('@spectrum-web-components/radio/sp-radio-group.js'),\n 'sp-radio': () => import('@spectrum-web-components/radio/sp-radio.js'),\n 'sp-search': () => import('@spectrum-web-components/search/sp-search.js'),\n 'sp-sidenav-item': () =>\n import('@spectrum-web-components/sidenav/sp-sidenav-item.js'),\n 'sp-sidenav': () =>\n import('@spectrum-web-components/sidenav/sp-sidenav.js'),\n 'sp-slider': () => import('@spectrum-web-components/slider/sp-slider.js'),\n 'sp-slider-handle': () =>\n import('@spectrum-web-components/slider/sp-slider-handle.js'),\n 'sp-split-button': () =>\n import('@spectrum-web-components/split-button/sp-split-button.js'),\n 'sp-split-view': () =>\n import('@spectrum-web-components/split-view/sp-split-view.js'),\n 'sp-status-light': () =>\n import('@spectrum-web-components/status-light/sp-status-light.js'),\n 'sp-swatch-group': () =>\n import('@spectrum-web-components/swatch/sp-swatch-group.js'),\n 'sp-swatch': () => import('@spectrum-web-components/swatch/sp-swatch.js'),\n 'sp-switch': () => import('@spectrum-web-components/switch/sp-switch.js'),\n 'sp-table': () => import('@spectrum-web-components/table/sp-table.js'),\n 'sp-table-body': () =>\n import('@spectrum-web-components/table/sp-table-body.js'),\n 'sp-table-cell': () =>\n import('@spectrum-web-components/table/sp-table-cell.js'),\n 'sp-table-head': () =>\n import('@spectrum-web-components/table/sp-table-head.js'),\n 'sp-table-checkbox-cell': () =>\n import('@spectrum-web-components/table/sp-table-checkbox-cell.js'),\n 'sp-table-head-cell': () =>\n import('@spectrum-web-components/table/sp-table-head-cell.js'),\n 'sp-table-row': () =>\n import('@spectrum-web-components/table/sp-table-row.js'),\n 'sp-tab': () => import('@spectrum-web-components/tabs/sp-tab.js'),\n 'sp-tabs': () => import('@spectrum-web-components/tabs/sp-tabs.js'),\n 'sp-tabs-overflow': () =>\n import('@spectrum-web-components/tabs/sp-tabs-overflow.js'),\n 'sp-tag': () => import('@spectrum-web-components/tags/sp-tag.js'),\n 'sp-tags': () => import('@spectrum-web-components/tags/sp-tags.js'),\n 'sp-textfield': () =>\n import('@spectrum-web-components/textfield/sp-textfield.js'),\n 'sp-thumbnail': () =>\n import('@spectrum-web-components/thumbnail/sp-thumbnail.js'),\n 'sp-toast': () => import('@spectrum-web-components/toast/sp-toast.js'),\n 'sp-tooltip': () =>\n import('@spectrum-web-components/tooltip/sp-tooltip.js'),\n 'sp-top-nav': () =>\n import('@spectrum-web-components/top-nav/sp-top-nav.js'),\n 'sp-tray': () => import('@spectrum-web-components/tray/sp-tray.js'),\n 'sp-underlay': () =>\n import('@spectrum-web-components/underlay/sp-underlay.js'),\n};\n\nconst browser: 'webkit' | 'firefox' | 'chromium' = isWebKit()\n ? 'webkit'\n : isFirefox()\n ? 'firefox'\n : 'chromium';\n\ndescribe('define-element', function () {\n // registrations are globally-unique, so retries will always fail\n this.retries(0);\n\n beforeEach(function () {\n window.__swc.verbose = true;\n this.warn = stub(console, 'warn');\n });\n\n afterEach(function () {\n this.warn.resetHistory();\n window.__swc.verbose = false;\n this.warn.restore();\n });\n\n Object.entries(elements).forEach(([name, register]) =>\n it(`'${name}' warns on redefinition`, async function () {\n // classes already-defined via transitive dependencies can't be tested this way\n if (customElements.get(name)) {\n this.skip();\n }\n const error = {\n webkit: 'Cannot define multiple custom elements with the same tag name',\n firefox: `'${name}' has already been defined`,\n chromium: `\"${name}\" has already been used with this registry`,\n }[browser];\n let caughtError: Error | undefined;\n\n customElements.define(name, class extends HTMLElement {});\n try {\n await register();\n } catch (error) {\n caughtError = error as Error;\n }\n\n expect(caughtError?.message ?? '').to.include(error);\n expect(this.warn.called, 'should call console.warn()').to.be.true;\n const spyCall = this.warn.getCall(0);\n expect(\n (spyCall.args.at(0) as string).includes('redefine'),\n 'message should warn about redefining an element'\n ).to.be.true;\n })\n );\n});\n"],
5
+ "mappings": ";AAYA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