@spectrum-web-components/base 0.5.9-devmode.31 → 0.7.0-devmode.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 +5 -3
- package/src/Base.dev.js +24 -9
- package/src/Base.dev.js.map +2 -2
- package/src/Base.js +24 -9
- package/src/Base.js.map +2 -2
- package/test/base-devmode.test.js +21 -0
- package/test/base-devmode.test.js.map +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/base",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0-devmode.0+1a8b29491",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -101,6 +101,8 @@
|
|
|
101
101
|
},
|
|
102
102
|
"types": "./src/index.d.ts",
|
|
103
103
|
"customElements": "custom-elements.json",
|
|
104
|
-
"sideEffects":
|
|
105
|
-
|
|
104
|
+
"sideEffects": [
|
|
105
|
+
"./**/*.dev.js"
|
|
106
|
+
],
|
|
107
|
+
"gitHead": "1a8b294911ab377fa4f07e16eb016f1e3bf7b517"
|
|
106
108
|
}
|
package/src/Base.dev.js
CHANGED
|
@@ -94,17 +94,18 @@ if (true) {
|
|
|
94
94
|
window.__swc = {
|
|
95
95
|
...window.__swc,
|
|
96
96
|
issuedWarnings: /* @__PURE__ */ new Set(),
|
|
97
|
-
|
|
98
|
-
var _a, _b, _c
|
|
99
|
-
|
|
97
|
+
warn: (element, message, url, { type = "api", level = "default", issues } = {}) => {
|
|
98
|
+
var _a, _b, _c;
|
|
99
|
+
const { localName = "base" } = element || {};
|
|
100
|
+
const id = `${localName}:${type}:${level}`;
|
|
101
|
+
if (!window.__swc.verbose && window.__swc.issuedWarnings.has(id))
|
|
100
102
|
return;
|
|
101
103
|
window.__swc.issuedWarnings.add(id);
|
|
102
|
-
|
|
103
|
-
if ((_b = (_a = window.__swc) == null ? void 0 : _a.ignoreWarningLocalNames) == null ? void 0 : _b[tagName])
|
|
104
|
+
if ((_a = window.__swc.ignoreWarningLocalNames) == null ? void 0 : _a[localName])
|
|
104
105
|
return;
|
|
105
|
-
if ((
|
|
106
|
+
if ((_b = window.__swc.ignoreWarningTypes) == null ? void 0 : _b[type])
|
|
106
107
|
return;
|
|
107
|
-
if ((
|
|
108
|
+
if ((_c = window.__swc.ignoreWarningLevels) == null ? void 0 : _c[level])
|
|
108
109
|
return;
|
|
109
110
|
let listedIssues = "";
|
|
110
111
|
if (issues && issues.length) {
|
|
@@ -112,9 +113,23 @@ if (true) {
|
|
|
112
113
|
listedIssues = issues.join("\n - ") + "\n";
|
|
113
114
|
}
|
|
114
115
|
const intro = level === "deprecation" ? "DEPRECATION NOTICE: " : "";
|
|
115
|
-
|
|
116
|
+
const inspectElement = element ? "\nInspect this issue in the follow element:" : "";
|
|
117
|
+
const displayURL = (element ? "\n\n" : "\n") + url + "\n";
|
|
118
|
+
const messages = [];
|
|
119
|
+
messages.push(intro + message + "\n" + listedIssues + inspectElement);
|
|
120
|
+
if (element) {
|
|
121
|
+
messages.push(element);
|
|
122
|
+
}
|
|
123
|
+
messages.push(displayURL, {
|
|
124
|
+
data: {
|
|
125
|
+
localName,
|
|
126
|
+
type,
|
|
127
|
+
level
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
console.warn(...messages);
|
|
116
131
|
}
|
|
117
132
|
};
|
|
118
|
-
window.__swc.
|
|
133
|
+
window.__swc.warn(void 0, "Spectrum Web Components is in dev mode. Not recommended for production!", "https://opensource.adobe.com/spectrum-web-components/dev-mode/", { type: "default" });
|
|
119
134
|
}
|
|
120
135
|
//# sourceMappingURL=Base.dev.js.map
|
package/src/Base.dev.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';\nimport { property } from 'lit/decorators.js';\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 SlotTextObservingElement extends constructor {\n /**\n * @private\n */\n public override shadowRoot!: ShadowRoot;\n private _dirParent?: HTMLElement;\n\n /**\n * @private\n */\n @property({ reflect: true })\n public override dir: 'ltr' | 'rtl' = 'ltr';\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 } 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 const oldDir = this.dir;\n this.dir =\n dirParent.dir === 'rtl' ? dirParent.dir : this.dir || 'ltr';\n if (oldDir === this.dir) {\n this.setAttribute('dir', this.dir);\n }\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 SlotTextObservingElement;\n}\n\nexport class SpectrumElement extends SpectrumMixin(LitElement) {}\n\nif (window.__swc.DEBU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AK,KAAK;AACrB,eAAK,aAAa,OAAO,KAAK,GAAG;AAAA,QACrC;AACA,YAAI,cAAc,SAAS,iBAAiB;AACxC,8BAAoB,IAAI,IAAI;AAAA,QAChC,OAAO;AACH,gBAAM,EAAE,cAAc;AACtB,cACI,UAAU,OAAO,GAAG,IAAI,MACxB,CAAC,eAAe,IAAI,SAAS,GAC/B;AACE,2BAAe,YAAY,SAAS,EAAE,KAAK,MAAM;AAC7C,cACI,UACF,8BAA8B,IAAI;AAAA,YACxC,CAAC;AAAA,UACL,OAAO;AACH,YAAC,UAAwB,8BACrB,IACJ;AAAA,UACJ;AAAA,QACJ;AACA,aAAK,aAAa;AAAA,MACtB;AACA,YAAM,kBAAkB;AAAA,IAC5B;AAAA,IAEgB,uBAA6B;AACzC,YAAM,qBAAqB;AAC3B,UAAI,KAAK,YAAY;AACjB,YAAI,KAAK,eAAe,SAAS,iBAAiB;AAC9C,8BAAoB,OAAO,IAAI;AAAA,QACnC,OAAO;AACH,UAAC,KAAK,WAAyB,6BAC3B,IACJ;AAAA,QACJ;AACA,aAAK,gBAAgB,KAAK;AAAA,MAC9B;AAAA,IACJ;AAAA,EACJ;AAvFoB;AAAA,IADhB,AAAC,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,KACX,AAXpB,yBAWoB;AAwFpB,SAAO;AACX;AAEO,aAAM,wBAAwB,cAAc,UAAU,EAAE;AAAC;AAEhE,IAAI,MAAoB;AACpB,SAAO,QAAQ;AAAA,OACR,OAAO;AAAA,IACV,gBAAgB,oBAAI,IAAI;AAAA,IACxB,
|
|
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';\nimport { property } from 'lit/decorators.js';\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 SlotTextObservingElement extends constructor {\n /**\n * @private\n */\n public override shadowRoot!: ShadowRoot;\n private _dirParent?: HTMLElement;\n\n /**\n * @private\n */\n @property({ reflect: true })\n public override dir: 'ltr' | 'rtl' = 'ltr';\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 } 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 const oldDir = this.dir;\n this.dir =\n dirParent.dir === 'rtl' ? dirParent.dir : this.dir || 'ltr';\n if (oldDir === this.dir) {\n this.setAttribute('dir', this.dir);\n }\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 SlotTextObservingElement;\n}\n\nexport class SpectrumElement extends SpectrumMixin(LitElement) {}\n\nif (window.__swc.DEBUG) {\n window.__swc = {\n ...window.__swc,\n issuedWarnings: new Set(),\n warn: (element, message, url, { type = 'api', level = 'default', issues } = {}): 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 window.__swc.issuedWarnings.add(id);\n if (window.__swc.ignoreWarningLocalNames?.[localName]) return;\n if (window.__swc.ignoreWarningTypes?.[type]) return;\n if (window.__swc.ignoreWarningLevels?.[level]) return;\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;AACA;AAmBA,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,YAAY,QAAQ,SAAS,iBAAiB;AAAA,EAC1C,YAAY;AAAA,EACZ,iBAAiB,CAAC,KAAK;AAC3B,CAAC;AAMD,MAAM,4BAA4B,CAAC,OAC/B,OAAO,GAAG,kCAAkC,eAC5C,GAAG,YAAY;AAEZ,8BACH,aACkC;AAClC,QAAM,iCAAiC,YAAY;AAAA,IAAnD;AAAA;AAWoB,iBAAqB;AAAA;AAAA,QAK1B,QAAiB;AACxB,aAAO,KAAK,QAAQ;AAAA,IACxB;AAAA,IAEO,wBAAiC;AACpC,YAAM,gBAAiB,K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KACT,QACA,2EACA,kEACA,EAAE,MAAM,UAAU,CACtB;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/Base.js
CHANGED
|
@@ -94,17 +94,18 @@ if (false) {
|
|
|
94
94
|
window.__swc = {
|
|
95
95
|
...window.__swc,
|
|
96
96
|
issuedWarnings: /* @__PURE__ */ new Set(),
|
|
97
|
-
|
|
98
|
-
var _a, _b, _c
|
|
99
|
-
|
|
97
|
+
warn: (element, message, url, { type = "api", level = "default", issues } = {}) => {
|
|
98
|
+
var _a, _b, _c;
|
|
99
|
+
const { localName = "base" } = element || {};
|
|
100
|
+
const id = `${localName}:${type}:${level}`;
|
|
101
|
+
if (!window.__swc.verbose && window.__swc.issuedWarnings.has(id))
|
|
100
102
|
return;
|
|
101
103
|
window.__swc.issuedWarnings.add(id);
|
|
102
|
-
|
|
103
|
-
if ((_b = (_a = window.__swc) == null ? void 0 : _a.ignoreWarningLocalNames) == null ? void 0 : _b[tagName])
|
|
104
|
+
if ((_a = window.__swc.ignoreWarningLocalNames) == null ? void 0 : _a[localName])
|
|
104
105
|
return;
|
|
105
|
-
if ((
|
|
106
|
+
if ((_b = window.__swc.ignoreWarningTypes) == null ? void 0 : _b[type])
|
|
106
107
|
return;
|
|
107
|
-
if ((
|
|
108
|
+
if ((_c = window.__swc.ignoreWarningLevels) == null ? void 0 : _c[level])
|
|
108
109
|
return;
|
|
109
110
|
let listedIssues = "";
|
|
110
111
|
if (issues && issues.length) {
|
|
@@ -112,9 +113,23 @@ if (false) {
|
|
|
112
113
|
listedIssues = issues.join("\n - ") + "\n";
|
|
113
114
|
}
|
|
114
115
|
const intro = level === "deprecation" ? "DEPRECATION NOTICE: " : "";
|
|
115
|
-
|
|
116
|
+
const inspectElement = element ? "\nInspect this issue in the follow element:" : "";
|
|
117
|
+
const displayURL = (element ? "\n\n" : "\n") + url + "\n";
|
|
118
|
+
const messages = [];
|
|
119
|
+
messages.push(intro + message + "\n" + listedIssues + inspectElement);
|
|
120
|
+
if (element) {
|
|
121
|
+
messages.push(element);
|
|
122
|
+
}
|
|
123
|
+
messages.push(displayURL, {
|
|
124
|
+
data: {
|
|
125
|
+
localName,
|
|
126
|
+
type,
|
|
127
|
+
level
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
console.warn(...messages);
|
|
116
131
|
}
|
|
117
132
|
};
|
|
118
|
-
window.__swc.
|
|
133
|
+
window.__swc.warn(void 0, "Spectrum Web Components is in dev mode. Not recommended for production!", "https://opensource.adobe.com/spectrum-web-components/dev-mode/", { type: "default" });
|
|
119
134
|
}
|
|
120
135
|
//# 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';\nimport { property } from 'lit/decorators.js';\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 SlotTextObservingElement extends constructor {\n /**\n * @private\n */\n public override shadowRoot!: ShadowRoot;\n private _dirParent?: HTMLElement;\n\n /**\n * @private\n */\n @property({ reflect: true })\n public override dir: 'ltr' | 'rtl' = 'ltr';\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 } 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 const oldDir = this.dir;\n this.dir =\n dirParent.dir === 'rtl' ? dirParent.dir : this.dir || 'ltr';\n if (oldDir === this.dir) {\n this.setAttribute('dir', this.dir);\n }\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 SlotTextObservingElement;\n}\n\nexport class SpectrumElement extends SpectrumMixin(LitElement) {}\n\nif (window.__swc.DEBUG) {\n window.__swc = {\n ...window.__swc,\n issuedWarnings: new Set(),\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAYA;AACA;AAmBA,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,YAAY,QAAQ,SAAS,iBAAiB;AAAA,EAC1C,YAAY;AAAA,EACZ,iBAAiB,CAAC,KAAK;AAC3B,CAAC;AAMD,MAAM,4BAA4B,CAAC,OAC/B,OAAO,GAAG,kCAAkC,eAC5C,GAAG,YAAY;AAEZ,8BACH,aACkC;AAClC,QAAM,iCAAiC,YAAY;AAAA,IAAnD;AAAA;AAWoB,iBAAqB;AAAA;AAAA,QAK1B,QAAiB;AACxB,aAAO,KAAK,QAAQ;AAAA,IACxB;AAAA,IAEO,wBA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KAAK;AAAA,MAC9B;AAAA,IACJ;AAAA,EACJ;AAvFoB;AAAA,IADhB,AAAC,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,KACX,AAXpB,yBAWoB;AAwFpB,SAAO;AACX;AAEO,aAAM,wBAAwB,cAAc,UAAU,EAAE;AAAC;AAEhE,IAAI,OAAoB;AACpB,SAAO,QAAQ;AAAA,OACR,OAAO;AAAA,IACV,gBAAgB,oBAAI,IAAI;AAAA,IACxB,
|
|
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';\nimport { property } from 'lit/decorators.js';\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 SlotTextObservingElement extends constructor {\n /**\n * @private\n */\n public override shadowRoot!: ShadowRoot;\n private _dirParent?: HTMLElement;\n\n /**\n * @private\n */\n @property({ reflect: true })\n public override dir: 'ltr' | 'rtl' = 'ltr';\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 } 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 const oldDir = this.dir;\n this.dir =\n dirParent.dir === 'rtl' ? dirParent.dir : this.dir || 'ltr';\n if (oldDir === this.dir) {\n this.setAttribute('dir', this.dir);\n }\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 SlotTextObservingElement;\n}\n\nexport class SpectrumElement extends SpectrumMixin(LitElement) {}\n\nif (window.__swc.DEBUG) {\n window.__swc = {\n ...window.__swc,\n issuedWarnings: new Set(),\n warn: (element, message, url, { type = 'api', level = 'default', issues } = {}): 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 window.__swc.issuedWarnings.add(id);\n if (window.__swc.ignoreWarningLocalNames?.[localName]) return;\n if (window.__swc.ignoreWarningTypes?.[type]) return;\n if (window.__swc.ignoreWarningLevels?.[level]) return;\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;AACA;AAmBA,MAAM,sBAAwC,oBAAI,IAAI;AAEtD,MAAM,YAAY,M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AAAQ;AAC/C,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,aAAc,WAAU,SAAS,QAAQ,MAAM;AACrD,YAAM,WAAsB,CAAC;AAC7B,eAAS,KACL,QAAQ,UAAU,OAAO,eAAe,cAC5C;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,KACT,QACA,2EACA,kEACA,EAAE,MAAM,UAAU,CACtB;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { expect } from "@open-wc/testing";
|
|
2
|
+
import { stub } from "sinon";
|
|
3
|
+
describe("Base", () => {
|
|
4
|
+
it("warns in Dev Mode when no attributes", async () => {
|
|
5
|
+
const consoleWarnStub = stub(console, "warn");
|
|
6
|
+
const { SpectrumElement } = await import("@spectrum-web-components/base");
|
|
7
|
+
expect(SpectrumElement).to.not.be.undefined;
|
|
8
|
+
expect(consoleWarnStub.called).to.be.true;
|
|
9
|
+
const spyCall = consoleWarnStub.getCall(0);
|
|
10
|
+
expect(spyCall.args.at(0).includes("dev mode"), 'confirm "dev mode"-centric message').to.be.true;
|
|
11
|
+
expect(spyCall.args.at(-1), "confirm `data` shape").to.deep.equal({
|
|
12
|
+
data: {
|
|
13
|
+
localName: "base",
|
|
14
|
+
type: "default",
|
|
15
|
+
level: "default"
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
consoleWarnStub.restore();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=base-devmode.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["base-devmode.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\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 { expect } from '@open-wc/testing';\nimport { stub } from 'sinon';\n\ndescribe('Base', () => {\n it('warns in Dev Mode when no attributes', async () => {\n const consoleWarnStub = stub(console, 'warn');\n const { SpectrumElement } = await import(\n '@spectrum-web-components/base'\n );\n expect(SpectrumElement).to.not.be.undefined;\n\n expect(consoleWarnStub.called).to.be.true;\n const spyCall = consoleWarnStub.getCall(0);\n expect(\n spyCall.args.at(0).includes('dev mode'),\n 'confirm \"dev mode\"-centric message'\n ).to.be.true;\n expect(spyCall.args.at(-1), 'confirm `data` shape').to.deep.equal({\n data: {\n localName: 'base',\n type: 'default',\n level: 'default',\n },\n });\n consoleWarnStub.restore();\n });\n});\n"],
|
|
5
|
+
"mappings": "AAUA;AACA;AAEA,SAAS,QAAQ,MAAM;AACnB,KAAG,wCAAwC,YAAY;AACnD,UAAM,kBAAkB,KAAK,SAAS,MAAM;AAC5C,UAAM,EAAE,oBAAoB,MAAM,OAC9B;AAEJ,WAAO,eAAe,EAAE,GAAG,IAAI,GAAG;AAElC,WAAO,gBAAgB,MAAM,EAAE,GAAG,GAAG;AACrC,UAAM,UAAU,gBAAgB,QAAQ,CAAC;AACzC,WACI,QAAQ,KAAK,GAAG,CAAC,EAAE,SAAS,UAAU,GACtC,oCACJ,EAAE,GAAG,GAAG;AACR,WAAO,QAAQ,KAAK,GAAG,EAAE,GAAG,sBAAsB,EAAE,GAAG,KAAK,MAAM;AAAA,MAC9D,MAAM;AAAA,QACF,WAAW;AAAA,QACX,MAAM;AAAA,QACN,OAAO;AAAA,MACX;AAAA,IACJ,CAAC;AACD,oBAAgB,QAAQ;AAAA,EAC5B,CAAC;AACL,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|