@spectrum-web-components/theme 0.41.0 → 0.41.2

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.
Files changed (56) hide show
  1. package/package.json +4 -4
  2. package/src/Theme.dev.js +2 -0
  3. package/src/Theme.dev.js.map +2 -2
  4. package/src/Theme.js.map +2 -2
  5. package/src/express/scale-large.css.dev.js +1 -141
  6. package/src/express/scale-large.css.dev.js.map +2 -2
  7. package/src/express/scale-large.css.js +1 -141
  8. package/src/express/scale-large.css.js.map +2 -2
  9. package/src/express/scale-medium.css.dev.js +1 -147
  10. package/src/express/scale-medium.css.dev.js.map +2 -2
  11. package/src/express/scale-medium.css.js +3 -149
  12. package/src/express/scale-medium.css.js.map +2 -2
  13. package/src/express/theme-dark.css.dev.js +1 -79
  14. package/src/express/theme-dark.css.dev.js.map +2 -2
  15. package/src/express/theme-dark.css.js +1 -79
  16. package/src/express/theme-dark.css.js.map +2 -2
  17. package/src/express/theme-light.css.dev.js +1 -81
  18. package/src/express/theme-light.css.dev.js.map +2 -2
  19. package/src/express/theme-light.css.js +1 -81
  20. package/src/express/theme-light.css.js.map +2 -2
  21. package/src/express/theme.css.dev.js +4 -2615
  22. package/src/express/theme.css.dev.js.map +2 -2
  23. package/src/express/theme.css.js +4 -2615
  24. package/src/express/theme.css.js.map +2 -2
  25. package/src/scale-large.css.dev.js +1 -139
  26. package/src/scale-large.css.dev.js.map +2 -2
  27. package/src/scale-large.css.js +1 -139
  28. package/src/scale-large.css.js.map +2 -2
  29. package/src/scale-medium.css.dev.js +1 -139
  30. package/src/scale-medium.css.dev.js.map +2 -2
  31. package/src/scale-medium.css.js +3 -141
  32. package/src/scale-medium.css.js.map +2 -2
  33. package/src/theme-dark.css.dev.js +1 -75
  34. package/src/theme-dark.css.dev.js.map +2 -2
  35. package/src/theme-dark.css.js +1 -75
  36. package/src/theme-dark.css.js.map +2 -2
  37. package/src/theme-darkest.css.dev.js +1 -73
  38. package/src/theme-darkest.css.dev.js.map +2 -2
  39. package/src/theme-darkest.css.js +1 -73
  40. package/src/theme-darkest.css.js.map +2 -2
  41. package/src/theme-light.css.dev.js +1 -75
  42. package/src/theme-light.css.dev.js.map +2 -2
  43. package/src/theme-light.css.js +1 -75
  44. package/src/theme-light.css.js.map +2 -2
  45. package/src/theme-lightest.css.dev.js +1 -69
  46. package/src/theme-lightest.css.dev.js.map +2 -2
  47. package/src/theme-lightest.css.js +1 -69
  48. package/src/theme-lightest.css.js.map +2 -2
  49. package/src/theme.css.dev.js +4 -2639
  50. package/src/theme.css.dev.js.map +2 -2
  51. package/src/theme.css.js +4 -2639
  52. package/src/theme.css.js.map +2 -2
  53. package/src/typography.css.dev.js +4 -387
  54. package/src/typography.css.dev.js.map +2 -2
  55. package/src/typography.css.js +4 -387
  56. package/src/typography.css.js.map +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/theme",
3
- "version": "0.41.0",
3
+ "version": "0.41.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -133,8 +133,8 @@
133
133
  "lit-html"
134
134
  ],
135
135
  "dependencies": {
136
- "@spectrum-web-components/base": "^0.41.0",
137
- "@spectrum-web-components/styles": "^0.41.0"
136
+ "@spectrum-web-components/base": "^0.41.2",
137
+ "@spectrum-web-components/styles": "^0.41.2"
138
138
  },
139
139
  "types": "./src/index.d.ts",
140
140
  "customElements": "custom-elements.json",
@@ -150,5 +150,5 @@
150
150
  "./src/express/core.js",
151
151
  "./src/express/themes.js"
152
152
  ],
153
- "gitHead": "0bf38fd427adc39804b228a4c61de623e5ebb82e"
153
+ "gitHead": "78c3f16b08c9133c9e5ca88d0c9fef5ea7d2ab87"
154
154
  }
package/src/Theme.dev.js CHANGED
@@ -239,6 +239,7 @@ const _Theme = class _Theme extends HTMLElement {
239
239
  this.__resolve = resolve;
240
240
  });
241
241
  }
242
+ /* c8 ignore next 12 */
242
243
  onQueryTheme(event) {
243
244
  if (event.defaultPrevented) {
244
245
  return;
@@ -335,6 +336,7 @@ const _Theme = class _Theme extends HTMLElement {
335
336
  fragmentMap.set(name, { name, styles });
336
337
  _Theme.instances.forEach((instance) => instance.shouldAdoptStyles());
337
338
  }
339
+ /* c8 ignore next 5 */
338
340
  _provideContext() {
339
341
  this._contextConsumers.forEach(
340
342
  ([callback, unsubscribe]) => callback(this.lang, unsubscribe)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["Theme.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 {\n CSSResult,\n CSSResultGroup,\n supportsAdoptingStyleSheets,\n} from '@spectrum-web-components/base';\nimport { version } from '@spectrum-web-components/base/src/version.js';\n\ndeclare global {\n interface Window {\n ShadyCSS: {\n nativeShadow: boolean;\n prepareTemplate(\n template: HTMLTemplateElement,\n elementName: string,\n typeExtension?: string\n ): void;\n styleElement(host: HTMLElement): void;\n ScopingShim: {\n prepareAdoptedCssText(\n cssTextArray: string[],\n elementName: string\n ): void;\n };\n };\n }\n}\n\ntype ShadowRootWithAdoptedStyleSheets = HTMLElement['shadowRoot'] & {\n adoptedStyleSheets?: CSSStyleSheet[];\n};\n\ntype FragmentType = 'color' | 'scale' | 'theme' | 'core' | 'app';\ntype SettableFragmentTypes = 'color' | 'scale' | 'theme';\ntype FragmentMap = Map<string, { name: string; styles: CSSResultGroup }>;\nexport type ThemeFragmentMap = Map<FragmentType, FragmentMap>;\nexport type Color =\n | 'light'\n | 'lightest'\n | 'dark'\n | 'darkest'\n | 'light-express'\n | 'lightest-express'\n | 'dark-express'\n | 'darkest-express';\nexport type Scale = 'medium' | 'large' | 'medium-express' | 'large-express';\nexport type ThemeVariant = 'spectrum' | 'express';\nconst ThemeVariantValues = ['spectrum', 'express'];\nconst ScaleValues = ['medium', 'large', 'medium-express', 'large-express'];\nconst ColorValues = [\n 'light',\n 'lightest',\n 'dark',\n 'darkest',\n 'light-express',\n 'lightest-express',\n 'dark-express',\n 'darkest-express',\n];\ntype FragmentName = Color | Scale | ThemeVariant | 'core' | 'app';\n\nexport interface ThemeData {\n color?: Color;\n scale?: Scale;\n lang?: string;\n theme?: ThemeVariant;\n}\n\ntype ThemeKindProvider = {\n [P in SettableFragmentTypes]: ThemeVariant | Color | Scale | '';\n};\n\nexport interface ProvideLang {\n callback: (lang: string, unsubscribe: () => void) => void;\n}\n\n/**\n * @element sp-theme\n * @attr {string} [lang=\"\"] - The language of the content scoped to this `sp-theme` element, see: <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang\" target=\"_blank\">MDN reference</a>.\n *\n * @slot - Content on which to apply the CSS Custom Properties defined by the current theme configuration\n */\nexport class Theme extends HTMLElement implements ThemeKindProvider {\n private static themeFragmentsByKind: ThemeFragmentMap = new Map();\n private static defaultFragments: Set<FragmentName> = new Set(['spectrum']);\n private static templateElement?: HTMLTemplateElement;\n private static instances: Set<Theme> = new Set();\n static VERSION = version;\n\n static get observedAttributes(): string[] {\n return ['color', 'scale', 'theme', 'lang', 'dir'];\n }\n\n _dir: 'ltr' | 'rtl' | '' = '';\n\n override set dir(dir: 'ltr' | 'rtl' | '') {\n if (dir === this.dir) return;\n this.setAttribute('dir', dir);\n this._dir = dir;\n const targetDir = dir === 'rtl' ? dir : 'ltr';\n this.trackedChildren.forEach((el) => {\n el.setAttribute('dir', targetDir);\n });\n }\n\n /**\n * Reading direction of the content scoped to this `sp-theme` element.\n * @type {\"ltr\" | \"rtl\" | \"\"}\n * @attr\n */\n override get dir(): 'ltr' | 'rtl' | '' {\n return this._dir;\n }\n\n protected attributeChangedCallback(\n attrName: SettableFragmentTypes | 'lang' | 'dir',\n old: string | null,\n value: string | null\n ): void {\n if (old === value) {\n return;\n }\n if (attrName === 'color') {\n this.color = value as Color;\n } else if (attrName === 'scale') {\n this.scale = value as Scale;\n } else if (attrName === 'lang' && !!value) {\n this.lang = value;\n this._provideContext();\n } else if (attrName === 'theme') {\n this.theme = value as ThemeVariant;\n } else if (attrName === 'dir') {\n this.dir = value as 'ltr' | 'rtl' | '';\n }\n }\n\n private requestUpdate(): void {\n if (window.ShadyCSS !== undefined && !window.ShadyCSS.nativeShadow) {\n window.ShadyCSS.styleElement(this);\n } else {\n this.shouldAdoptStyles();\n }\n }\n\n public override shadowRoot!: ShadowRootWithAdoptedStyleSheets;\n\n private _theme: ThemeVariant | '' = 'spectrum';\n\n /**\n * The Spectrum theme that is applied to the content scoped to this `sp-theme` element.\n *\n * A value is requried.\n * @type {\"spectrum\" | \"express\" | \"\"}\n * @attr\n */\n get theme(): ThemeVariant | '' {\n const themeFragments = Theme.themeFragmentsByKind.get('theme');\n const { name } =\n (themeFragments && themeFragments.get('default')) || {};\n return this._theme || (name as ThemeVariant) || '';\n }\n\n set theme(newValue: ThemeVariant | '') {\n if (newValue === this._theme) return;\n const theme =\n !!newValue && ThemeVariantValues.includes(newValue)\n ? newValue\n : this.theme;\n if (theme !== this._theme) {\n this._theme = theme;\n this.requestUpdate();\n }\n if (theme) {\n this.setAttribute('theme', theme);\n } else {\n this.removeAttribute('theme');\n }\n }\n\n private _color: Color | '' = '';\n\n /**\n * The Spectrum color stops to apply to content scoped by this `sp-theme` element.\n *\n * A value is requried.\n * @type {\"lightest\" | \"light\" | \"dark\" | \"darkest\" | \"\"}\n * @attr\n */\n get color(): Color | '' {\n const themeFragments = Theme.themeFragmentsByKind.get('color');\n const { name } =\n (themeFragments && themeFragments.get('default')) || {};\n return this._color || (name as Color) || '';\n }\n\n set color(newValue: Color | '') {\n if (newValue === this._color) return;\n const color =\n !!newValue && ColorValues.includes(newValue)\n ? newValue\n : this.color;\n if (color !== this._color) {\n this._color = color;\n this.requestUpdate();\n }\n if (color) {\n this.setAttribute('color', color);\n } else {\n this.removeAttribute('color');\n }\n }\n\n private _scale: Scale | '' = '';\n\n /**\n * The Spectrum platform scale to apply to content scoped by this `sp-theme` element.\n *\n * A value is requried.\n * @type {\"medium\" | \"large\" | \"\"}\n * @attr\n */\n get scale(): Scale | '' {\n const themeFragments = Theme.themeFragmentsByKind.get('scale');\n const { name } =\n (themeFragments && themeFragments.get('default')) || {};\n return this._scale || (name as Scale) || '';\n }\n\n set scale(newValue: Scale | '') {\n if (newValue === this._scale) return;\n const scale =\n !!newValue && ScaleValues.includes(newValue)\n ? newValue\n : this.scale;\n if (scale !== this._scale) {\n this._scale = scale;\n this.requestUpdate();\n }\n if (scale) {\n this.setAttribute('scale', scale);\n } else {\n this.removeAttribute('scale');\n }\n }\n\n private get styles(): CSSResultGroup[] {\n const themeKinds: FragmentType[] = [\n ...Theme.themeFragmentsByKind.keys(),\n ];\n const getStyle = (\n fragments: FragmentMap,\n name: FragmentName,\n kind?: FragmentType\n ): CSSResultGroup | undefined => {\n const currentStyles =\n kind && kind !== 'theme' && this.theme === 'express'\n ? fragments.get(`${name}-express`)\n : fragments.get(name);\n // theme=\"spectrum\" is available by default and doesn't need to be applied.\n const isAppliedFragment =\n name === 'spectrum' || !kind || this.hasAttribute(kind);\n if (currentStyles && isAppliedFragment) {\n return currentStyles.styles;\n }\n return;\n };\n const styles = themeKinds.reduce((acc, kind) => {\n const kindFragments = Theme.themeFragmentsByKind.get(\n kind\n ) as FragmentMap;\n let style: CSSResultGroup | undefined;\n if (kind === 'app' || kind === 'core') {\n style = getStyle(kindFragments, kind);\n } else {\n const { [kind]: name } = this;\n style = getStyle(kindFragments, <FragmentName>name, kind);\n }\n if (style) {\n acc.push(style);\n }\n return acc;\n }, [] as CSSResultGroup[]);\n if (window.__swc.DEBUG) {\n const issues: string[] = [];\n const checkForAttribute = (\n name: FragmentType,\n resolvedValue?: string,\n actualValue?: string\n ): void => {\n const themeModifier =\n this.theme && this.theme !== 'spectrum'\n ? `-${this.theme}`\n : '';\n if (!resolvedValue) {\n issues.push(\n `You have not explicitly set the \"${name}\" attribute and there is no default value on which to fallback.`\n );\n } else if (!actualValue) {\n issues.push(\n `You have not explicitly set the \"${name}\" attribute, the default value (\"${resolvedValue}\") is being used as a fallback.`\n );\n } else if (\n !Theme.themeFragmentsByKind\n .get(name)\n ?.get(\n resolvedValue +\n (name === 'theme' ? '' : themeModifier)\n )\n ) {\n issues.push(\n `You have set \"${name}='${resolvedValue}'\" but the associated theme fragment has not been loaded.`\n );\n }\n };\n checkForAttribute('theme', this.theme, this._theme);\n checkForAttribute('color', this.color, this._color);\n checkForAttribute('scale', this.scale, this._scale);\n if (issues.length) {\n window.__swc.warn(\n this,\n 'You are leveraging an <sp-theme> element and the following issues may disrupt your theme delivery:',\n 'https://opensource.adobe.com/spectrum-web-components/components/theme/#example',\n {\n issues,\n }\n );\n }\n }\n return [...styles];\n }\n\n private static get template(): HTMLTemplateElement {\n if (!this.templateElement) {\n this.templateElement = document.createElement('template');\n this.templateElement.innerHTML = '<slot></slot>';\n }\n return this.templateElement;\n }\n\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n const node = document.importNode(Theme.template.content, true);\n this.shadowRoot.appendChild(node);\n this.shouldAdoptStyles();\n this.addEventListener(\n 'sp-query-theme',\n this.onQueryTheme as EventListener\n );\n this.addEventListener(\n 'sp-language-context',\n this._handleContextPresence as EventListener\n );\n this.updateComplete = this.__createDeferredPromise();\n }\n\n public updateComplete!: Promise<boolean>;\n private __resolve!: (compelted: boolean) => void;\n\n private __createDeferredPromise(): Promise<boolean> {\n return new Promise((resolve) => {\n this.__resolve = resolve;\n });\n }\n\n private onQueryTheme(event: CustomEvent<ThemeData>): void {\n if (event.defaultPrevented) {\n return;\n }\n event.preventDefault();\n const { detail: theme } = event;\n theme.color = this.color || undefined;\n theme.scale = this.scale || undefined;\n theme.lang =\n this.lang || document.documentElement.lang || navigator.language;\n theme.theme = this.theme || undefined;\n }\n\n protected connectedCallback(): void {\n this.shouldAdoptStyles();\n // Note, first update/render handles styleElement so we only call this if\n // connected after first update.\n /* c8 ignore next 3 */\n if (window.ShadyCSS !== undefined) {\n window.ShadyCSS.styleElement(this);\n }\n // Add `this` to the instances array.\n Theme.instances.add(this);\n if (!this.hasAttribute('dir')) {\n let dirParent = ((this as HTMLElement).assignedSlot ||\n this.parentNode) as HTMLElement | DocumentFragment | ShadowRoot;\n while (\n dirParent !== document.documentElement &&\n !(dirParent instanceof Theme)\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 ShadowRoot).host) as\n | HTMLElement\n | DocumentFragment\n | ShadowRoot;\n }\n this.dir = dirParent.dir === 'rtl' ? dirParent.dir : 'ltr';\n }\n }\n\n protected disconnectedCallback(): void {\n // Remove `this` to the instances array.\n Theme.instances.delete(this);\n }\n\n public startManagingContentDirection(el: HTMLElement): void {\n this.trackedChildren.add(el);\n }\n\n public stopManagingContentDirection(el: HTMLElement): void {\n this.trackedChildren.delete(el);\n }\n\n private trackedChildren: Set<HTMLElement> = new Set();\n\n private _updateRequested = false;\n\n private async shouldAdoptStyles(): Promise<void> {\n if (!this._updateRequested) {\n this.updateComplete = this.__createDeferredPromise();\n this._updateRequested = true;\n this._updateRequested = await false;\n this.adoptStyles();\n this.__resolve(true);\n }\n }\n\n protected adoptStyles(): void {\n const styles = this.styles; // No test coverage on Edge\n\n // There are three separate cases here based on Shadow DOM support.\n // (1) shadowRoot polyfilled: use ShadyCSS\n // (2) shadowRoot.adoptedStyleSheets available: use it.\n // (3) shadowRoot.adoptedStyleSheets polyfilled: append styles after\n // rendering\n /* c8 ignore next */ if (\n window.ShadyCSS !== undefined &&\n !window.ShadyCSS.nativeShadow &&\n window.ShadyCSS.ScopingShim\n ) {\n // For browsers using the shim, there seems to be one set of\n // processed styles per template, so it is hard to nest styles. So,\n // for those, we load in all style fragments and then switch using a\n // host selector (e.g. :host([color='dark']))\n const fragmentCSS: string[] = [];\n for (const [kind, fragments] of Theme.themeFragmentsByKind) {\n for (const [name, { styles }] of fragments) {\n if (name === 'default') continue;\n let cssText = (styles as CSSResult).cssText;\n if (!Theme.defaultFragments.has(name as FragmentName)) {\n cssText = cssText.replace(\n ':host',\n `:host([${kind}='${name}'])`\n );\n }\n fragmentCSS.push(cssText);\n }\n }\n window.ShadyCSS.ScopingShim.prepareAdoptedCssText(\n fragmentCSS,\n this.localName\n );\n window.ShadyCSS.prepareTemplate(Theme.template, this.localName);\n } else if (supportsAdoptingStyleSheets) {\n const styleSheets: CSSStyleSheet[] = [];\n for (const style of styles) {\n styleSheets.push(\n (style as CSSResult).styleSheet as CSSStyleSheet\n );\n }\n this.shadowRoot.adoptedStyleSheets = styleSheets;\n } else {\n const styleNodes = this.shadowRoot.querySelectorAll('style');\n styleNodes.forEach((element) => element.remove());\n styles.forEach((s) => {\n const style = document.createElement('style');\n style.textContent = (s as CSSResult).cssText;\n this.shadowRoot.appendChild(style);\n });\n }\n }\n\n static registerThemeFragment(\n name: FragmentName,\n kind: FragmentType,\n styles: CSSResultGroup\n ): void {\n const fragmentMap = Theme.themeFragmentsByKind.get(kind) || new Map();\n if (fragmentMap.size === 0) {\n Theme.themeFragmentsByKind.set(kind, fragmentMap);\n // we're adding our first fragment for this kind, set as default\n fragmentMap.set('default', { name, styles });\n Theme.defaultFragments.add(name);\n }\n fragmentMap.set(name, { name, styles });\n Theme.instances.forEach((instance) => instance.shouldAdoptStyles());\n }\n\n private _contextConsumers = new Map<\n HTMLElement,\n [ProvideLang['callback'], () => void]\n >();\n\n private _provideContext(): void {\n this._contextConsumers.forEach(([callback, unsubscribe]) =>\n callback(this.lang, unsubscribe)\n );\n }\n\n private _handleContextPresence(event: CustomEvent<ProvideLang>): void {\n event.stopPropagation();\n const target = event.composedPath()[0] as HTMLElement;\n if (this._contextConsumers.has(target)) {\n return;\n }\n this._contextConsumers.set(target, [\n event.detail.callback,\n () => this._contextConsumers.delete(target),\n ]);\n const [callback, unsubscribe] =\n this._contextConsumers.get(target) || [];\n if (callback && unsubscribe) {\n callback(\n this.lang ||\n document.documentElement.lang ||\n navigator.language,\n unsubscribe\n );\n }\n }\n}\n"],
5
- "mappings": ";AAYA;AAAA,EAGI;AAAA,OACG;AACP,SAAS,eAAe;AAyCxB,MAAM,qBAAqB,CAAC,YAAY,SAAS;AACjD,MAAM,cAAc,CAAC,UAAU,SAAS,kBAAkB,eAAe;AACzE,MAAM,cAAc;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAwBO,MAAM,SAAN,MAAM,eAAc,YAAyC;AAAA,EAiQhE,cAAc;AACV,UAAM;AAvPV,gBAA2B;AAqD3B,SAAQ,SAA4B;AAiCpC,SAAQ,SAAqB;AAiC7B,SAAQ,SAAqB;AA+M7B,SAAQ,kBAAoC,oBAAI,IAAI;AAEpD,SAAQ,mBAAmB;AAmF3B,SAAQ,oBAAoB,oBAAI,IAG9B;AAtKE,SAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAClC,UAAM,OAAO,SAAS,WAAW,OAAM,SAAS,SAAS,IAAI;AAC7D,SAAK,WAAW,YAAY,IAAI;AAChC,SAAK,kBAAkB;AACvB,SAAK;AAAA,MACD;AAAA,MACA,KAAK;AAAA,IACT;AACA,SAAK;AAAA,MACD;AAAA,MACA,KAAK;AAAA,IACT;AACA,SAAK,iBAAiB,KAAK,wBAAwB;AAAA,EACvD;AAAA,EAzQA,WAAW,qBAA+B;AACtC,WAAO,CAAC,SAAS,SAAS,SAAS,QAAQ,KAAK;AAAA,EACpD;AAAA,EAIA,IAAa,IAAI,KAAyB;AACtC,QAAI,QAAQ,KAAK;AAAK;AACtB,SAAK,aAAa,OAAO,GAAG;AAC5B,SAAK,OAAO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AK,CAAC;AAC3C,QAAI,YAAY,aAAa;AACzB;AAAA,QACI,KAAK,QACD,SAAS,gBAAgB,QACzB,UAAU;AAAA,QACd;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ;AAtca,OACM,uBAAyC,oBAAI,IAAI;AADvD,OAEM,mBAAsC,oBAAI,IAAI,CAAC,UAAU,CAAC;AAFhE,OAIM,YAAwB,oBAAI,IAAI;AAJtC,OAKF,UAAU;AALd,WAAM,QAAN;",
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 {\n CSSResult,\n CSSResultGroup,\n supportsAdoptingStyleSheets,\n} from '@spectrum-web-components/base';\nimport { version } from '@spectrum-web-components/base/src/version.js';\n\ndeclare global {\n interface Window {\n ShadyCSS: {\n nativeShadow: boolean;\n prepareTemplate(\n template: HTMLTemplateElement,\n elementName: string,\n typeExtension?: string\n ): void;\n styleElement(host: HTMLElement): void;\n ScopingShim: {\n prepareAdoptedCssText(\n cssTextArray: string[],\n elementName: string\n ): void;\n };\n };\n }\n}\n\ntype ShadowRootWithAdoptedStyleSheets = HTMLElement['shadowRoot'] & {\n adoptedStyleSheets?: CSSStyleSheet[];\n};\n\ntype FragmentType = 'color' | 'scale' | 'theme' | 'core' | 'app';\ntype SettableFragmentTypes = 'color' | 'scale' | 'theme';\ntype FragmentMap = Map<string, { name: string; styles: CSSResultGroup }>;\nexport type ThemeFragmentMap = Map<FragmentType, FragmentMap>;\nexport type Color =\n | 'light'\n | 'lightest'\n | 'dark'\n | 'darkest'\n | 'light-express'\n | 'lightest-express'\n | 'dark-express'\n | 'darkest-express';\nexport type Scale = 'medium' | 'large' | 'medium-express' | 'large-express';\nexport type ThemeVariant = 'spectrum' | 'express';\nconst ThemeVariantValues = ['spectrum', 'express'];\nconst ScaleValues = ['medium', 'large', 'medium-express', 'large-express'];\nconst ColorValues = [\n 'light',\n 'lightest',\n 'dark',\n 'darkest',\n 'light-express',\n 'lightest-express',\n 'dark-express',\n 'darkest-express',\n];\ntype FragmentName = Color | Scale | ThemeVariant | 'core' | 'app';\n\nexport interface ThemeData {\n color?: Color;\n scale?: Scale;\n lang?: string;\n theme?: ThemeVariant;\n}\n\ntype ThemeKindProvider = {\n [P in SettableFragmentTypes]: ThemeVariant | Color | Scale | '';\n};\n\nexport interface ProvideLang {\n callback: (lang: string, unsubscribe: () => void) => void;\n}\n\n/**\n * @element sp-theme\n * @attr {string} [lang=\"\"] - The language of the content scoped to this `sp-theme` element, see: <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang\" target=\"_blank\">MDN reference</a>.\n *\n * @slot - Content on which to apply the CSS Custom Properties defined by the current theme configuration\n */\nexport class Theme extends HTMLElement implements ThemeKindProvider {\n private static themeFragmentsByKind: ThemeFragmentMap = new Map();\n private static defaultFragments: Set<FragmentName> = new Set(['spectrum']);\n private static templateElement?: HTMLTemplateElement;\n private static instances: Set<Theme> = new Set();\n static VERSION = version;\n\n static get observedAttributes(): string[] {\n return ['color', 'scale', 'theme', 'lang', 'dir'];\n }\n\n _dir: 'ltr' | 'rtl' | '' = '';\n\n override set dir(dir: 'ltr' | 'rtl' | '') {\n if (dir === this.dir) return;\n this.setAttribute('dir', dir);\n this._dir = dir;\n const targetDir = dir === 'rtl' ? dir : 'ltr';\n /* c8 ignore next 3 */\n this.trackedChildren.forEach((el) => {\n el.setAttribute('dir', targetDir);\n });\n }\n\n /**\n * Reading direction of the content scoped to this `sp-theme` element.\n * @type {\"ltr\" | \"rtl\" | \"\"}\n * @attr\n */\n override get dir(): 'ltr' | 'rtl' | '' {\n return this._dir;\n }\n\n protected attributeChangedCallback(\n attrName: SettableFragmentTypes | 'lang' | 'dir',\n old: string | null,\n value: string | null\n ): void {\n if (old === value) {\n return;\n }\n if (attrName === 'color') {\n this.color = value as Color;\n } else if (attrName === 'scale') {\n this.scale = value as Scale;\n /* c8 ignore next 3 */\n } else if (attrName === 'lang' && !!value) {\n this.lang = value;\n this._provideContext();\n } else if (attrName === 'theme') {\n this.theme = value as ThemeVariant;\n } else if (attrName === 'dir') {\n this.dir = value as 'ltr' | 'rtl' | '';\n }\n }\n\n private requestUpdate(): void {\n /* c8 ignore next 3 */\n if (window.ShadyCSS !== undefined && !window.ShadyCSS.nativeShadow) {\n window.ShadyCSS.styleElement(this);\n } else {\n this.shouldAdoptStyles();\n }\n }\n\n public override shadowRoot!: ShadowRootWithAdoptedStyleSheets;\n\n private _theme: ThemeVariant | '' = 'spectrum';\n\n /**\n * The Spectrum theme that is applied to the content scoped to this `sp-theme` element.\n *\n * A value is requried.\n * @type {\"spectrum\" | \"express\" | \"\"}\n * @attr\n */\n get theme(): ThemeVariant | '' {\n const themeFragments = Theme.themeFragmentsByKind.get('theme');\n const { name } =\n (themeFragments && themeFragments.get('default')) || {};\n return this._theme || (name as ThemeVariant) || '';\n }\n\n set theme(newValue: ThemeVariant | '') {\n if (newValue === this._theme) return;\n const theme =\n !!newValue && ThemeVariantValues.includes(newValue)\n ? newValue\n : this.theme;\n if (theme !== this._theme) {\n this._theme = theme;\n this.requestUpdate();\n }\n if (theme) {\n this.setAttribute('theme', theme);\n /* c8 ignore next 3 */\n } else {\n this.removeAttribute('theme');\n }\n }\n\n private _color: Color | '' = '';\n\n /**\n * The Spectrum color stops to apply to content scoped by this `sp-theme` element.\n *\n * A value is requried.\n * @type {\"lightest\" | \"light\" | \"dark\" | \"darkest\" | \"\"}\n * @attr\n */\n get color(): Color | '' {\n const themeFragments = Theme.themeFragmentsByKind.get('color');\n const { name } =\n (themeFragments && themeFragments.get('default')) || {};\n return this._color || (name as Color) || '';\n }\n\n set color(newValue: Color | '') {\n if (newValue === this._color) return;\n const color =\n !!newValue && ColorValues.includes(newValue)\n ? newValue\n : this.color;\n if (color !== this._color) {\n this._color = color;\n this.requestUpdate();\n }\n if (color) {\n this.setAttribute('color', color);\n /* c8 ignore next 3 */\n } else {\n this.removeAttribute('color');\n }\n }\n\n private _scale: Scale | '' = '';\n\n /**\n * The Spectrum platform scale to apply to content scoped by this `sp-theme` element.\n *\n * A value is requried.\n * @type {\"medium\" | \"large\" | \"\"}\n * @attr\n */\n get scale(): Scale | '' {\n const themeFragments = Theme.themeFragmentsByKind.get('scale');\n const { name } =\n (themeFragments && themeFragments.get('default')) || {};\n return this._scale || (name as Scale) || '';\n }\n\n set scale(newValue: Scale | '') {\n if (newValue === this._scale) return;\n const scale =\n !!newValue && ScaleValues.includes(newValue)\n ? newValue\n : this.scale;\n if (scale !== this._scale) {\n this._scale = scale;\n this.requestUpdate();\n }\n if (scale) {\n this.setAttribute('scale', scale);\n /* c8 ignore next 3 */\n } else {\n this.removeAttribute('scale');\n }\n }\n\n private get styles(): CSSResultGroup[] {\n const themeKinds: FragmentType[] = [\n ...Theme.themeFragmentsByKind.keys(),\n ];\n const getStyle = (\n fragments: FragmentMap,\n name: FragmentName,\n kind?: FragmentType\n ): CSSResultGroup | undefined => {\n const currentStyles =\n kind && kind !== 'theme' && this.theme === 'express'\n ? fragments.get(`${name}-express`)\n : fragments.get(name);\n // theme=\"spectrum\" is available by default and doesn't need to be applied.\n const isAppliedFragment =\n name === 'spectrum' || !kind || this.hasAttribute(kind);\n if (currentStyles && isAppliedFragment) {\n return currentStyles.styles;\n }\n return;\n };\n const styles = themeKinds.reduce((acc, kind) => {\n const kindFragments = Theme.themeFragmentsByKind.get(\n kind\n ) as FragmentMap;\n let style: CSSResultGroup | undefined;\n if (kind === 'app' || kind === 'core') {\n style = getStyle(kindFragments, kind);\n } else {\n const { [kind]: name } = this;\n style = getStyle(kindFragments, <FragmentName>name, kind);\n }\n if (style) {\n acc.push(style);\n }\n return acc;\n }, [] as CSSResultGroup[]);\n if (window.__swc.DEBUG) {\n const issues: string[] = [];\n const checkForAttribute = (\n name: FragmentType,\n resolvedValue?: string,\n actualValue?: string\n ): void => {\n const themeModifier =\n this.theme && this.theme !== 'spectrum'\n ? `-${this.theme}`\n : '';\n if (!resolvedValue) {\n issues.push(\n `You have not explicitly set the \"${name}\" attribute and there is no default value on which to fallback.`\n );\n } else if (!actualValue) {\n issues.push(\n `You have not explicitly set the \"${name}\" attribute, the default value (\"${resolvedValue}\") is being used as a fallback.`\n );\n } else if (\n !Theme.themeFragmentsByKind\n .get(name)\n ?.get(\n resolvedValue +\n (name === 'theme' ? '' : themeModifier)\n )\n ) {\n issues.push(\n `You have set \"${name}='${resolvedValue}'\" but the associated theme fragment has not been loaded.`\n );\n }\n };\n checkForAttribute('theme', this.theme, this._theme);\n checkForAttribute('color', this.color, this._color);\n checkForAttribute('scale', this.scale, this._scale);\n if (issues.length) {\n window.__swc.warn(\n this,\n 'You are leveraging an <sp-theme> element and the following issues may disrupt your theme delivery:',\n 'https://opensource.adobe.com/spectrum-web-components/components/theme/#example',\n {\n issues,\n }\n );\n }\n }\n return [...styles];\n }\n\n private static get template(): HTMLTemplateElement {\n if (!this.templateElement) {\n this.templateElement = document.createElement('template');\n this.templateElement.innerHTML = '<slot></slot>';\n }\n return this.templateElement;\n }\n\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n const node = document.importNode(Theme.template.content, true);\n this.shadowRoot.appendChild(node);\n this.shouldAdoptStyles();\n this.addEventListener(\n 'sp-query-theme',\n this.onQueryTheme as EventListener\n );\n this.addEventListener(\n 'sp-language-context',\n this._handleContextPresence as EventListener\n );\n this.updateComplete = this.__createDeferredPromise();\n }\n\n public updateComplete!: Promise<boolean>;\n private __resolve!: (compelted: boolean) => void;\n\n private __createDeferredPromise(): Promise<boolean> {\n return new Promise((resolve) => {\n this.__resolve = resolve;\n });\n }\n\n /* c8 ignore next 12 */\n private onQueryTheme(event: CustomEvent<ThemeData>): void {\n if (event.defaultPrevented) {\n return;\n }\n event.preventDefault();\n const { detail: theme } = event;\n theme.color = this.color || undefined;\n theme.scale = this.scale || undefined;\n theme.lang =\n this.lang || document.documentElement.lang || navigator.language;\n theme.theme = this.theme || undefined;\n }\n\n protected connectedCallback(): void {\n this.shouldAdoptStyles();\n // Note, first update/render handles styleElement so we only call this if\n // connected after first update.\n /* c8 ignore next 3 */\n if (window.ShadyCSS !== undefined) {\n window.ShadyCSS.styleElement(this);\n }\n // Add `this` to the instances array.\n Theme.instances.add(this);\n if (!this.hasAttribute('dir')) {\n let dirParent = ((this as HTMLElement).assignedSlot ||\n this.parentNode) as HTMLElement | DocumentFragment | ShadowRoot;\n while (\n dirParent !== document.documentElement &&\n !(dirParent instanceof Theme)\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 ShadowRoot).host) as\n | HTMLElement\n | DocumentFragment\n | ShadowRoot;\n }\n this.dir = dirParent.dir === 'rtl' ? dirParent.dir : 'ltr';\n }\n }\n\n protected disconnectedCallback(): void {\n // Remove `this` to the instances array.\n Theme.instances.delete(this);\n }\n\n public startManagingContentDirection(el: HTMLElement): void {\n this.trackedChildren.add(el);\n }\n\n public stopManagingContentDirection(el: HTMLElement): void {\n this.trackedChildren.delete(el);\n }\n\n private trackedChildren: Set<HTMLElement> = new Set();\n\n private _updateRequested = false;\n\n private async shouldAdoptStyles(): Promise<void> {\n if (!this._updateRequested) {\n this.updateComplete = this.__createDeferredPromise();\n this._updateRequested = true;\n this._updateRequested = await false;\n this.adoptStyles();\n this.__resolve(true);\n }\n }\n\n protected adoptStyles(): void {\n const styles = this.styles; // No test coverage on Edge\n\n // There are three separate cases here based on Shadow DOM support.\n // (1) shadowRoot polyfilled: use ShadyCSS\n // (2) shadowRoot.adoptedStyleSheets available: use it.\n // (3) shadowRoot.adoptedStyleSheets polyfilled: append styles after rendering\n /* c8 ignore next 28 */\n if (\n window.ShadyCSS !== undefined &&\n !window.ShadyCSS.nativeShadow &&\n window.ShadyCSS.ScopingShim\n ) {\n // For browsers using the shim, there seems to be one set of\n // processed styles per template, so it is hard to nest styles. So,\n // for those, we load in all style fragments and then switch using a\n // host selector (e.g. :host([color='dark']))\n const fragmentCSS: string[] = [];\n for (const [kind, fragments] of Theme.themeFragmentsByKind) {\n for (const [name, { styles }] of fragments) {\n if (name === 'default') continue;\n let cssText = (styles as CSSResult).cssText;\n if (!Theme.defaultFragments.has(name as FragmentName)) {\n cssText = cssText.replace(\n ':host',\n `:host([${kind}='${name}'])`\n );\n }\n fragmentCSS.push(cssText);\n }\n }\n window.ShadyCSS.ScopingShim.prepareAdoptedCssText(\n fragmentCSS,\n this.localName\n );\n window.ShadyCSS.prepareTemplate(Theme.template, this.localName);\n } else if (supportsAdoptingStyleSheets) {\n const styleSheets: CSSStyleSheet[] = [];\n for (const style of styles) {\n styleSheets.push(\n (style as CSSResult).styleSheet as CSSStyleSheet\n );\n }\n this.shadowRoot.adoptedStyleSheets = styleSheets;\n /* c8 ignore next 9 */\n } else {\n const styleNodes = this.shadowRoot.querySelectorAll('style');\n styleNodes.forEach((element) => element.remove());\n styles.forEach((s) => {\n const style = document.createElement('style');\n style.textContent = (s as CSSResult).cssText;\n this.shadowRoot.appendChild(style);\n });\n }\n }\n\n static registerThemeFragment(\n name: FragmentName,\n kind: FragmentType,\n styles: CSSResultGroup\n ): void {\n const fragmentMap = Theme.themeFragmentsByKind.get(kind) || new Map();\n if (fragmentMap.size === 0) {\n Theme.themeFragmentsByKind.set(kind, fragmentMap);\n // we're adding our first fragment for this kind, set as default\n fragmentMap.set('default', { name, styles });\n Theme.defaultFragments.add(name);\n }\n fragmentMap.set(name, { name, styles });\n Theme.instances.forEach((instance) => instance.shouldAdoptStyles());\n }\n\n private _contextConsumers = new Map<\n HTMLElement,\n [ProvideLang['callback'], () => void]\n >();\n\n /* c8 ignore next 5 */\n private _provideContext(): void {\n this._contextConsumers.forEach(([callback, unsubscribe]) =>\n callback(this.lang, unsubscribe)\n );\n }\n\n private _handleContextPresence(event: CustomEvent<ProvideLang>): void {\n event.stopPropagation();\n const target = event.composedPath()[0] as HTMLElement;\n /* c8 ignore next 3 */\n if (this._contextConsumers.has(target)) {\n return;\n }\n this._contextConsumers.set(target, [\n event.detail.callback,\n () => this._contextConsumers.delete(target),\n ]);\n const [callback, unsubscribe] =\n this._contextConsumers.get(target) || [];\n if (callback && unsubscribe) {\n callback(\n this.lang ||\n document.documentElement.lang ||\n navigator.language,\n unsubscribe\n );\n }\n }\n}\n"],
5
+ "mappings": ";AAYA;AAAA,EAGI;AAAA,OACG;AACP,SAAS,eAAe;AAyCxB,MAAM,qBAAqB,CAAC,YAAY,SAAS;AACjD,MAAM,cAAc,CAAC,UAAU,SAAS,kBAAkB,eAAe;AACzE,MAAM,cAAc;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAwBO,MAAM,SAAN,MAAM,eAAc,YAAyC;AAAA,EAuQhE,cAAc;AACV,UAAM;AA7PV,gBAA2B;AAwD3B,SAAQ,SAA4B;AAkCpC,SAAQ,SAAqB;AAkC7B,SAAQ,SAAqB;AAiN7B,SAAQ,kBAAoC,oBAAI,IAAI;AAEpD,SAAQ,mBAAmB;AAoF3B,SAAQ,oBAAoB,oBAAI,IAG9B;AAxKE,SAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAClC,UAAM,OAAO,SAAS,WAAW,OAAM,SAAS,SAAS,IAAI;AAC7D,SAAK,WAAW,YAAY,IAAI;AAChC,SAAK,kBAAkB;AACvB,SAAK;AAAA,MACD;AAAA,MACA,KAAK;AAAA,IACT;AACA,SAAK;AAAA,MACD;AAAA,MACA,KAAK;AAAA,IACT;AACA,SAAK,iBAAiB,KAAK,wBAAwB;AAAA,EACvD;AAAA,EA/QA,WAAW,qBAA+B;AACtC,WAAO,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AAK,kBAAkB,IAAI,QAAQ;AAAA,MAC/B,MAAM,OAAO;AAAA,MACb,MAAM,KAAK,kBAAkB,OAAO,MAAM;AAAA,IAC9C,CAAC;AACD,UAAM,CAAC,UAAU,WAAW,IACxB,KAAK,kBAAkB,IAAI,MAAM,KAAK,CAAC;AAC3C,QAAI,YAAY,aAAa;AACzB;AAAA,QACI,KAAK,QACD,SAAS,gBAAgB,QACzB,UAAU;AAAA,QACd;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ;AAhda,OACM,uBAAyC,oBAAI,IAAI;AADvD,OAEM,mBAAsC,oBAAI,IAAI,CAAC,UAAU,CAAC;AAFhE,OAIM,YAAwB,oBAAI,IAAI;AAJtC,OAKF,UAAU;AALd,WAAM,QAAN;",
6
6
  "names": ["styles"]
7
7
  }
package/src/Theme.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["Theme.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 {\n CSSResult,\n CSSResultGroup,\n supportsAdoptingStyleSheets,\n} from '@spectrum-web-components/base';\nimport { version } from '@spectrum-web-components/base/src/version.js';\n\ndeclare global {\n interface Window {\n ShadyCSS: {\n nativeShadow: boolean;\n prepareTemplate(\n template: HTMLTemplateElement,\n elementName: string,\n typeExtension?: string\n ): void;\n styleElement(host: HTMLElement): void;\n ScopingShim: {\n prepareAdoptedCssText(\n cssTextArray: string[],\n elementName: string\n ): void;\n };\n };\n }\n}\n\ntype ShadowRootWithAdoptedStyleSheets = HTMLElement['shadowRoot'] & {\n adoptedStyleSheets?: CSSStyleSheet[];\n};\n\ntype FragmentType = 'color' | 'scale' | 'theme' | 'core' | 'app';\ntype SettableFragmentTypes = 'color' | 'scale' | 'theme';\ntype FragmentMap = Map<string, { name: string; styles: CSSResultGroup }>;\nexport type ThemeFragmentMap = Map<FragmentType, FragmentMap>;\nexport type Color =\n | 'light'\n | 'lightest'\n | 'dark'\n | 'darkest'\n | 'light-express'\n | 'lightest-express'\n | 'dark-express'\n | 'darkest-express';\nexport type Scale = 'medium' | 'large' | 'medium-express' | 'large-express';\nexport type ThemeVariant = 'spectrum' | 'express';\nconst ThemeVariantValues = ['spectrum', 'express'];\nconst ScaleValues = ['medium', 'large', 'medium-express', 'large-express'];\nconst ColorValues = [\n 'light',\n 'lightest',\n 'dark',\n 'darkest',\n 'light-express',\n 'lightest-express',\n 'dark-express',\n 'darkest-express',\n];\ntype FragmentName = Color | Scale | ThemeVariant | 'core' | 'app';\n\nexport interface ThemeData {\n color?: Color;\n scale?: Scale;\n lang?: string;\n theme?: ThemeVariant;\n}\n\ntype ThemeKindProvider = {\n [P in SettableFragmentTypes]: ThemeVariant | Color | Scale | '';\n};\n\nexport interface ProvideLang {\n callback: (lang: string, unsubscribe: () => void) => void;\n}\n\n/**\n * @element sp-theme\n * @attr {string} [lang=\"\"] - The language of the content scoped to this `sp-theme` element, see: <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang\" target=\"_blank\">MDN reference</a>.\n *\n * @slot - Content on which to apply the CSS Custom Properties defined by the current theme configuration\n */\nexport class Theme extends HTMLElement implements ThemeKindProvider {\n private static themeFragmentsByKind: ThemeFragmentMap = new Map();\n private static defaultFragments: Set<FragmentName> = new Set(['spectrum']);\n private static templateElement?: HTMLTemplateElement;\n private static instances: Set<Theme> = new Set();\n static VERSION = version;\n\n static get observedAttributes(): string[] {\n return ['color', 'scale', 'theme', 'lang', 'dir'];\n }\n\n _dir: 'ltr' | 'rtl' | '' = '';\n\n override set dir(dir: 'ltr' | 'rtl' | '') {\n if (dir === this.dir) return;\n this.setAttribute('dir', dir);\n this._dir = dir;\n const targetDir = dir === 'rtl' ? dir : 'ltr';\n this.trackedChildren.forEach((el) => {\n el.setAttribute('dir', targetDir);\n });\n }\n\n /**\n * Reading direction of the content scoped to this `sp-theme` element.\n * @type {\"ltr\" | \"rtl\" | \"\"}\n * @attr\n */\n override get dir(): 'ltr' | 'rtl' | '' {\n return this._dir;\n }\n\n protected attributeChangedCallback(\n attrName: SettableFragmentTypes | 'lang' | 'dir',\n old: string | null,\n value: string | null\n ): void {\n if (old === value) {\n return;\n }\n if (attrName === 'color') {\n this.color = value as Color;\n } else if (attrName === 'scale') {\n this.scale = value as Scale;\n } else if (attrName === 'lang' && !!value) {\n this.lang = value;\n this._provideContext();\n } else if (attrName === 'theme') {\n this.theme = value as ThemeVariant;\n } else if (attrName === 'dir') {\n this.dir = value as 'ltr' | 'rtl' | '';\n }\n }\n\n private requestUpdate(): void {\n if (window.ShadyCSS !== undefined && !window.ShadyCSS.nativeShadow) {\n window.ShadyCSS.styleElement(this);\n } else {\n this.shouldAdoptStyles();\n }\n }\n\n public override shadowRoot!: ShadowRootWithAdoptedStyleSheets;\n\n private _theme: ThemeVariant | '' = 'spectrum';\n\n /**\n * The Spectrum theme that is applied to the content scoped to this `sp-theme` element.\n *\n * A value is requried.\n * @type {\"spectrum\" | \"express\" | \"\"}\n * @attr\n */\n get theme(): ThemeVariant | '' {\n const themeFragments = Theme.themeFragmentsByKind.get('theme');\n const { name } =\n (themeFragments && themeFragments.get('default')) || {};\n return this._theme || (name as ThemeVariant) || '';\n }\n\n set theme(newValue: ThemeVariant | '') {\n if (newValue === this._theme) return;\n const theme =\n !!newValue && ThemeVariantValues.includes(newValue)\n ? newValue\n : this.theme;\n if (theme !== this._theme) {\n this._theme = theme;\n this.requestUpdate();\n }\n if (theme) {\n this.setAttribute('theme', theme);\n } else {\n this.removeAttribute('theme');\n }\n }\n\n private _color: Color | '' = '';\n\n /**\n * The Spectrum color stops to apply to content scoped by this `sp-theme` element.\n *\n * A value is requried.\n * @type {\"lightest\" | \"light\" | \"dark\" | \"darkest\" | \"\"}\n * @attr\n */\n get color(): Color | '' {\n const themeFragments = Theme.themeFragmentsByKind.get('color');\n const { name } =\n (themeFragments && themeFragments.get('default')) || {};\n return this._color || (name as Color) || '';\n }\n\n set color(newValue: Color | '') {\n if (newValue === this._color) return;\n const color =\n !!newValue && ColorValues.includes(newValue)\n ? newValue\n : this.color;\n if (color !== this._color) {\n this._color = color;\n this.requestUpdate();\n }\n if (color) {\n this.setAttribute('color', color);\n } else {\n this.removeAttribute('color');\n }\n }\n\n private _scale: Scale | '' = '';\n\n /**\n * The Spectrum platform scale to apply to content scoped by this `sp-theme` element.\n *\n * A value is requried.\n * @type {\"medium\" | \"large\" | \"\"}\n * @attr\n */\n get scale(): Scale | '' {\n const themeFragments = Theme.themeFragmentsByKind.get('scale');\n const { name } =\n (themeFragments && themeFragments.get('default')) || {};\n return this._scale || (name as Scale) || '';\n }\n\n set scale(newValue: Scale | '') {\n if (newValue === this._scale) return;\n const scale =\n !!newValue && ScaleValues.includes(newValue)\n ? newValue\n : this.scale;\n if (scale !== this._scale) {\n this._scale = scale;\n this.requestUpdate();\n }\n if (scale) {\n this.setAttribute('scale', scale);\n } else {\n this.removeAttribute('scale');\n }\n }\n\n private get styles(): CSSResultGroup[] {\n const themeKinds: FragmentType[] = [\n ...Theme.themeFragmentsByKind.keys(),\n ];\n const getStyle = (\n fragments: FragmentMap,\n name: FragmentName,\n kind?: FragmentType\n ): CSSResultGroup | undefined => {\n const currentStyles =\n kind && kind !== 'theme' && this.theme === 'express'\n ? fragments.get(`${name}-express`)\n : fragments.get(name);\n // theme=\"spectrum\" is available by default and doesn't need to be applied.\n const isAppliedFragment =\n name === 'spectrum' || !kind || this.hasAttribute(kind);\n if (currentStyles && isAppliedFragment) {\n return currentStyles.styles;\n }\n return;\n };\n const styles = themeKinds.reduce((acc, kind) => {\n const kindFragments = Theme.themeFragmentsByKind.get(\n kind\n ) as FragmentMap;\n let style: CSSResultGroup | undefined;\n if (kind === 'app' || kind === 'core') {\n style = getStyle(kindFragments, kind);\n } else {\n const { [kind]: name } = this;\n style = getStyle(kindFragments, <FragmentName>name, kind);\n }\n if (style) {\n acc.push(style);\n }\n return acc;\n }, [] as CSSResultGroup[]);\n if (window.__swc.DEBUG) {\n const issues: string[] = [];\n const checkForAttribute = (\n name: FragmentType,\n resolvedValue?: string,\n actualValue?: string\n ): void => {\n const themeModifier =\n this.theme && this.theme !== 'spectrum'\n ? `-${this.theme}`\n : '';\n if (!resolvedValue) {\n issues.push(\n `You have not explicitly set the \"${name}\" attribute and there is no default value on which to fallback.`\n );\n } else if (!actualValue) {\n issues.push(\n `You have not explicitly set the \"${name}\" attribute, the default value (\"${resolvedValue}\") is being used as a fallback.`\n );\n } else if (\n !Theme.themeFragmentsByKind\n .get(name)\n ?.get(\n resolvedValue +\n (name === 'theme' ? '' : themeModifier)\n )\n ) {\n issues.push(\n `You have set \"${name}='${resolvedValue}'\" but the associated theme fragment has not been loaded.`\n );\n }\n };\n checkForAttribute('theme', this.theme, this._theme);\n checkForAttribute('color', this.color, this._color);\n checkForAttribute('scale', this.scale, this._scale);\n if (issues.length) {\n window.__swc.warn(\n this,\n 'You are leveraging an <sp-theme> element and the following issues may disrupt your theme delivery:',\n 'https://opensource.adobe.com/spectrum-web-components/components/theme/#example',\n {\n issues,\n }\n );\n }\n }\n return [...styles];\n }\n\n private static get template(): HTMLTemplateElement {\n if (!this.templateElement) {\n this.templateElement = document.createElement('template');\n this.templateElement.innerHTML = '<slot></slot>';\n }\n return this.templateElement;\n }\n\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n const node = document.importNode(Theme.template.content, true);\n this.shadowRoot.appendChild(node);\n this.shouldAdoptStyles();\n this.addEventListener(\n 'sp-query-theme',\n this.onQueryTheme as EventListener\n );\n this.addEventListener(\n 'sp-language-context',\n this._handleContextPresence as EventListener\n );\n this.updateComplete = this.__createDeferredPromise();\n }\n\n public updateComplete!: Promise<boolean>;\n private __resolve!: (compelted: boolean) => void;\n\n private __createDeferredPromise(): Promise<boolean> {\n return new Promise((resolve) => {\n this.__resolve = resolve;\n });\n }\n\n private onQueryTheme(event: CustomEvent<ThemeData>): void {\n if (event.defaultPrevented) {\n return;\n }\n event.preventDefault();\n const { detail: theme } = event;\n theme.color = this.color || undefined;\n theme.scale = this.scale || undefined;\n theme.lang =\n this.lang || document.documentElement.lang || navigator.language;\n theme.theme = this.theme || undefined;\n }\n\n protected connectedCallback(): void {\n this.shouldAdoptStyles();\n // Note, first update/render handles styleElement so we only call this if\n // connected after first update.\n /* c8 ignore next 3 */\n if (window.ShadyCSS !== undefined) {\n window.ShadyCSS.styleElement(this);\n }\n // Add `this` to the instances array.\n Theme.instances.add(this);\n if (!this.hasAttribute('dir')) {\n let dirParent = ((this as HTMLElement).assignedSlot ||\n this.parentNode) as HTMLElement | DocumentFragment | ShadowRoot;\n while (\n dirParent !== document.documentElement &&\n !(dirParent instanceof Theme)\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 ShadowRoot).host) as\n | HTMLElement\n | DocumentFragment\n | ShadowRoot;\n }\n this.dir = dirParent.dir === 'rtl' ? dirParent.dir : 'ltr';\n }\n }\n\n protected disconnectedCallback(): void {\n // Remove `this` to the instances array.\n Theme.instances.delete(this);\n }\n\n public startManagingContentDirection(el: HTMLElement): void {\n this.trackedChildren.add(el);\n }\n\n public stopManagingContentDirection(el: HTMLElement): void {\n this.trackedChildren.delete(el);\n }\n\n private trackedChildren: Set<HTMLElement> = new Set();\n\n private _updateRequested = false;\n\n private async shouldAdoptStyles(): Promise<void> {\n if (!this._updateRequested) {\n this.updateComplete = this.__createDeferredPromise();\n this._updateRequested = true;\n this._updateRequested = await false;\n this.adoptStyles();\n this.__resolve(true);\n }\n }\n\n protected adoptStyles(): void {\n const styles = this.styles; // No test coverage on Edge\n\n // There are three separate cases here based on Shadow DOM support.\n // (1) shadowRoot polyfilled: use ShadyCSS\n // (2) shadowRoot.adoptedStyleSheets available: use it.\n // (3) shadowRoot.adoptedStyleSheets polyfilled: append styles after\n // rendering\n /* c8 ignore next */ if (\n window.ShadyCSS !== undefined &&\n !window.ShadyCSS.nativeShadow &&\n window.ShadyCSS.ScopingShim\n ) {\n // For browsers using the shim, there seems to be one set of\n // processed styles per template, so it is hard to nest styles. So,\n // for those, we load in all style fragments and then switch using a\n // host selector (e.g. :host([color='dark']))\n const fragmentCSS: string[] = [];\n for (const [kind, fragments] of Theme.themeFragmentsByKind) {\n for (const [name, { styles }] of fragments) {\n if (name === 'default') continue;\n let cssText = (styles as CSSResult).cssText;\n if (!Theme.defaultFragments.has(name as FragmentName)) {\n cssText = cssText.replace(\n ':host',\n `:host([${kind}='${name}'])`\n );\n }\n fragmentCSS.push(cssText);\n }\n }\n window.ShadyCSS.ScopingShim.prepareAdoptedCssText(\n fragmentCSS,\n this.localName\n );\n window.ShadyCSS.prepareTemplate(Theme.template, this.localName);\n } else if (supportsAdoptingStyleSheets) {\n const styleSheets: CSSStyleSheet[] = [];\n for (const style of styles) {\n styleSheets.push(\n (style as CSSResult).styleSheet as CSSStyleSheet\n );\n }\n this.shadowRoot.adoptedStyleSheets = styleSheets;\n } else {\n const styleNodes = this.shadowRoot.querySelectorAll('style');\n styleNodes.forEach((element) => element.remove());\n styles.forEach((s) => {\n const style = document.createElement('style');\n style.textContent = (s as CSSResult).cssText;\n this.shadowRoot.appendChild(style);\n });\n }\n }\n\n static registerThemeFragment(\n name: FragmentName,\n kind: FragmentType,\n styles: CSSResultGroup\n ): void {\n const fragmentMap = Theme.themeFragmentsByKind.get(kind) || new Map();\n if (fragmentMap.size === 0) {\n Theme.themeFragmentsByKind.set(kind, fragmentMap);\n // we're adding our first fragment for this kind, set as default\n fragmentMap.set('default', { name, styles });\n Theme.defaultFragments.add(name);\n }\n fragmentMap.set(name, { name, styles });\n Theme.instances.forEach((instance) => instance.shouldAdoptStyles());\n }\n\n private _contextConsumers = new Map<\n HTMLElement,\n [ProvideLang['callback'], () => void]\n >();\n\n private _provideContext(): void {\n this._contextConsumers.forEach(([callback, unsubscribe]) =>\n callback(this.lang, unsubscribe)\n );\n }\n\n private _handleContextPresence(event: CustomEvent<ProvideLang>): void {\n event.stopPropagation();\n const target = event.composedPath()[0] as HTMLElement;\n if (this._contextConsumers.has(target)) {\n return;\n }\n this._contextConsumers.set(target, [\n event.detail.callback,\n () => this._contextConsumers.delete(target),\n ]);\n const [callback, unsubscribe] =\n this._contextConsumers.get(target) || [];\n if (callback && unsubscribe) {\n callback(\n this.lang ||\n document.documentElement.lang ||\n navigator.language,\n unsubscribe\n );\n }\n }\n}\n"],
5
- "mappings": "aAYA,OAGI,+BAAAA,MACG,gCACP,OAAS,WAAAC,MAAe,+CAyCxB,MAAMC,EAAqB,CAAC,WAAY,SAAS,EAC3CC,EAAc,CAAC,SAAU,QAAS,iBAAkB,eAAe,EACnEC,EAAc,CAChB,QACA,WACA,OACA,UACA,gBACA,mBACA,eACA,iBACJ,EAwBaC,EAAN,MAAMA,UAAc,WAAyC,CAiQhE,aAAc,CACV,MAAM,EAvPV,UAA2B,GAqD3B,KAAQ,OAA4B,WAiCpC,KAAQ,OAAqB,GAiC7B,KAAQ,OAAqB,GA+M7B,KAAQ,gBAAoC,IAAI,IAEhD,KAAQ,iBAAmB,GAmF3B,KAAQ,kBAAoB,IAAI,IAnK5B,KAAK,aAAa,CAAE,KAAM,MAAO,CAAC,EAClC,MAAMC,EAAO,SAAS,WAAWD,EAAM,SAAS,QAAS,EAAI,EAC7D,KAAK,WAAW,YAAYC,CAAI,EAChC,KAAK,kBAAkB,EACvB,KAAK,iBACD,iBACA,KAAK,YACT,EACA,KAAK,iBACD,sBACA,KAAK,sBACT,EACA,KAAK,eAAiB,KAAK,wBAAwB,CACvD,CAzQA,WAAW,oBAA+B,CACtC,MAAO,CAAC,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,EAAY,IAAI,UAAW,CAAE,KAAAtB,EAAM,OAAAiB,CAAO,CAAC,EAC3C1B,EAAM,iBAAiB,IAAIS,CAAI,GAEnCsB,EAAY,IAAItB,EAAM,CAAE,KAAAA,EAAM,OAAAiB,CAAO,CAAC,EACtC1B,EAAM,UAAU,QAASgC,GAAaA,EAAS,kBAAkB,CAAC,CACtE,CAOQ,iBAAwB,CAC5B,KAAK,kBAAkB,QAAQ,CAAC,CAACC,EAAUC,CAAW,IAClDD,EAAS,KAAK,KAAMC,CAAW,CACnC,CACJ,CAEQ,uBAAuBV,EAAuC,CAClEA,EAAM,gBAAgB,EACtB,MAAMW,EAASX,EAAM,aAAa,EAAE,CAAC,EACrC,GAAI,KAAK,kBAAkB,IAAIW,CAAM,EACjC,OAEJ,KAAK,kBAAkB,IAAIA,EAAQ,CAC/BX,EAAM,OAAO,SACb,IAAM,KAAK,kBAAkB,OAAOW,CAAM,CAC9C,CAAC,EACD,KAAM,CAACF,EAAUC,CAAW,EACxB,KAAK,kBAAkB,IAAIC,CAAM,GAAK,CAAC,EACvCF,GAAYC,GACZD,EACI,KAAK,MACD,SAAS,gBAAgB,MACzB,UAAU,SACdC,CACJ,CAER,CACJ,EAtcalC,EACM,qBAAyC,IAAI,IADnDA,EAEM,iBAAsC,IAAI,IAAI,CAAC,UAAU,CAAC,EAFhEA,EAIM,UAAwB,IAAI,IAJlCA,EAKF,QAAUJ,EALd,WAAM,MAANI",
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 {\n CSSResult,\n CSSResultGroup,\n supportsAdoptingStyleSheets,\n} from '@spectrum-web-components/base';\nimport { version } from '@spectrum-web-components/base/src/version.js';\n\ndeclare global {\n interface Window {\n ShadyCSS: {\n nativeShadow: boolean;\n prepareTemplate(\n template: HTMLTemplateElement,\n elementName: string,\n typeExtension?: string\n ): void;\n styleElement(host: HTMLElement): void;\n ScopingShim: {\n prepareAdoptedCssText(\n cssTextArray: string[],\n elementName: string\n ): void;\n };\n };\n }\n}\n\ntype ShadowRootWithAdoptedStyleSheets = HTMLElement['shadowRoot'] & {\n adoptedStyleSheets?: CSSStyleSheet[];\n};\n\ntype FragmentType = 'color' | 'scale' | 'theme' | 'core' | 'app';\ntype SettableFragmentTypes = 'color' | 'scale' | 'theme';\ntype FragmentMap = Map<string, { name: string; styles: CSSResultGroup }>;\nexport type ThemeFragmentMap = Map<FragmentType, FragmentMap>;\nexport type Color =\n | 'light'\n | 'lightest'\n | 'dark'\n | 'darkest'\n | 'light-express'\n | 'lightest-express'\n | 'dark-express'\n | 'darkest-express';\nexport type Scale = 'medium' | 'large' | 'medium-express' | 'large-express';\nexport type ThemeVariant = 'spectrum' | 'express';\nconst ThemeVariantValues = ['spectrum', 'express'];\nconst ScaleValues = ['medium', 'large', 'medium-express', 'large-express'];\nconst ColorValues = [\n 'light',\n 'lightest',\n 'dark',\n 'darkest',\n 'light-express',\n 'lightest-express',\n 'dark-express',\n 'darkest-express',\n];\ntype FragmentName = Color | Scale | ThemeVariant | 'core' | 'app';\n\nexport interface ThemeData {\n color?: Color;\n scale?: Scale;\n lang?: string;\n theme?: ThemeVariant;\n}\n\ntype ThemeKindProvider = {\n [P in SettableFragmentTypes]: ThemeVariant | Color | Scale | '';\n};\n\nexport interface ProvideLang {\n callback: (lang: string, unsubscribe: () => void) => void;\n}\n\n/**\n * @element sp-theme\n * @attr {string} [lang=\"\"] - The language of the content scoped to this `sp-theme` element, see: <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang\" target=\"_blank\">MDN reference</a>.\n *\n * @slot - Content on which to apply the CSS Custom Properties defined by the current theme configuration\n */\nexport class Theme extends HTMLElement implements ThemeKindProvider {\n private static themeFragmentsByKind: ThemeFragmentMap = new Map();\n private static defaultFragments: Set<FragmentName> = new Set(['spectrum']);\n private static templateElement?: HTMLTemplateElement;\n private static instances: Set<Theme> = new Set();\n static VERSION = version;\n\n static get observedAttributes(): string[] {\n return ['color', 'scale', 'theme', 'lang', 'dir'];\n }\n\n _dir: 'ltr' | 'rtl' | '' = '';\n\n override set dir(dir: 'ltr' | 'rtl' | '') {\n if (dir === this.dir) return;\n this.setAttribute('dir', dir);\n this._dir = dir;\n const targetDir = dir === 'rtl' ? dir : 'ltr';\n /* c8 ignore next 3 */\n this.trackedChildren.forEach((el) => {\n el.setAttribute('dir', targetDir);\n });\n }\n\n /**\n * Reading direction of the content scoped to this `sp-theme` element.\n * @type {\"ltr\" | \"rtl\" | \"\"}\n * @attr\n */\n override get dir(): 'ltr' | 'rtl' | '' {\n return this._dir;\n }\n\n protected attributeChangedCallback(\n attrName: SettableFragmentTypes | 'lang' | 'dir',\n old: string | null,\n value: string | null\n ): void {\n if (old === value) {\n return;\n }\n if (attrName === 'color') {\n this.color = value as Color;\n } else if (attrName === 'scale') {\n this.scale = value as Scale;\n /* c8 ignore next 3 */\n } else if (attrName === 'lang' && !!value) {\n this.lang = value;\n this._provideContext();\n } else if (attrName === 'theme') {\n this.theme = value as ThemeVariant;\n } else if (attrName === 'dir') {\n this.dir = value as 'ltr' | 'rtl' | '';\n }\n }\n\n private requestUpdate(): void {\n /* c8 ignore next 3 */\n if (window.ShadyCSS !== undefined && !window.ShadyCSS.nativeShadow) {\n window.ShadyCSS.styleElement(this);\n } else {\n this.shouldAdoptStyles();\n }\n }\n\n public override shadowRoot!: ShadowRootWithAdoptedStyleSheets;\n\n private _theme: ThemeVariant | '' = 'spectrum';\n\n /**\n * The Spectrum theme that is applied to the content scoped to this `sp-theme` element.\n *\n * A value is requried.\n * @type {\"spectrum\" | \"express\" | \"\"}\n * @attr\n */\n get theme(): ThemeVariant | '' {\n const themeFragments = Theme.themeFragmentsByKind.get('theme');\n const { name } =\n (themeFragments && themeFragments.get('default')) || {};\n return this._theme || (name as ThemeVariant) || '';\n }\n\n set theme(newValue: ThemeVariant | '') {\n if (newValue === this._theme) return;\n const theme =\n !!newValue && ThemeVariantValues.includes(newValue)\n ? newValue\n : this.theme;\n if (theme !== this._theme) {\n this._theme = theme;\n this.requestUpdate();\n }\n if (theme) {\n this.setAttribute('theme', theme);\n /* c8 ignore next 3 */\n } else {\n this.removeAttribute('theme');\n }\n }\n\n private _color: Color | '' = '';\n\n /**\n * The Spectrum color stops to apply to content scoped by this `sp-theme` element.\n *\n * A value is requried.\n * @type {\"lightest\" | \"light\" | \"dark\" | \"darkest\" | \"\"}\n * @attr\n */\n get color(): Color | '' {\n const themeFragments = Theme.themeFragmentsByKind.get('color');\n const { name } =\n (themeFragments && themeFragments.get('default')) || {};\n return this._color || (name as Color) || '';\n }\n\n set color(newValue: Color | '') {\n if (newValue === this._color) return;\n const color =\n !!newValue && ColorValues.includes(newValue)\n ? newValue\n : this.color;\n if (color !== this._color) {\n this._color = color;\n this.requestUpdate();\n }\n if (color) {\n this.setAttribute('color', color);\n /* c8 ignore next 3 */\n } else {\n this.removeAttribute('color');\n }\n }\n\n private _scale: Scale | '' = '';\n\n /**\n * The Spectrum platform scale to apply to content scoped by this `sp-theme` element.\n *\n * A value is requried.\n * @type {\"medium\" | \"large\" | \"\"}\n * @attr\n */\n get scale(): Scale | '' {\n const themeFragments = Theme.themeFragmentsByKind.get('scale');\n const { name } =\n (themeFragments && themeFragments.get('default')) || {};\n return this._scale || (name as Scale) || '';\n }\n\n set scale(newValue: Scale | '') {\n if (newValue === this._scale) return;\n const scale =\n !!newValue && ScaleValues.includes(newValue)\n ? newValue\n : this.scale;\n if (scale !== this._scale) {\n this._scale = scale;\n this.requestUpdate();\n }\n if (scale) {\n this.setAttribute('scale', scale);\n /* c8 ignore next 3 */\n } else {\n this.removeAttribute('scale');\n }\n }\n\n private get styles(): CSSResultGroup[] {\n const themeKinds: FragmentType[] = [\n ...Theme.themeFragmentsByKind.keys(),\n ];\n const getStyle = (\n fragments: FragmentMap,\n name: FragmentName,\n kind?: FragmentType\n ): CSSResultGroup | undefined => {\n const currentStyles =\n kind && kind !== 'theme' && this.theme === 'express'\n ? fragments.get(`${name}-express`)\n : fragments.get(name);\n // theme=\"spectrum\" is available by default and doesn't need to be applied.\n const isAppliedFragment =\n name === 'spectrum' || !kind || this.hasAttribute(kind);\n if (currentStyles && isAppliedFragment) {\n return currentStyles.styles;\n }\n return;\n };\n const styles = themeKinds.reduce((acc, kind) => {\n const kindFragments = Theme.themeFragmentsByKind.get(\n kind\n ) as FragmentMap;\n let style: CSSResultGroup | undefined;\n if (kind === 'app' || kind === 'core') {\n style = getStyle(kindFragments, kind);\n } else {\n const { [kind]: name } = this;\n style = getStyle(kindFragments, <FragmentName>name, kind);\n }\n if (style) {\n acc.push(style);\n }\n return acc;\n }, [] as CSSResultGroup[]);\n if (window.__swc.DEBUG) {\n const issues: string[] = [];\n const checkForAttribute = (\n name: FragmentType,\n resolvedValue?: string,\n actualValue?: string\n ): void => {\n const themeModifier =\n this.theme && this.theme !== 'spectrum'\n ? `-${this.theme}`\n : '';\n if (!resolvedValue) {\n issues.push(\n `You have not explicitly set the \"${name}\" attribute and there is no default value on which to fallback.`\n );\n } else if (!actualValue) {\n issues.push(\n `You have not explicitly set the \"${name}\" attribute, the default value (\"${resolvedValue}\") is being used as a fallback.`\n );\n } else if (\n !Theme.themeFragmentsByKind\n .get(name)\n ?.get(\n resolvedValue +\n (name === 'theme' ? '' : themeModifier)\n )\n ) {\n issues.push(\n `You have set \"${name}='${resolvedValue}'\" but the associated theme fragment has not been loaded.`\n );\n }\n };\n checkForAttribute('theme', this.theme, this._theme);\n checkForAttribute('color', this.color, this._color);\n checkForAttribute('scale', this.scale, this._scale);\n if (issues.length) {\n window.__swc.warn(\n this,\n 'You are leveraging an <sp-theme> element and the following issues may disrupt your theme delivery:',\n 'https://opensource.adobe.com/spectrum-web-components/components/theme/#example',\n {\n issues,\n }\n );\n }\n }\n return [...styles];\n }\n\n private static get template(): HTMLTemplateElement {\n if (!this.templateElement) {\n this.templateElement = document.createElement('template');\n this.templateElement.innerHTML = '<slot></slot>';\n }\n return this.templateElement;\n }\n\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n const node = document.importNode(Theme.template.content, true);\n this.shadowRoot.appendChild(node);\n this.shouldAdoptStyles();\n this.addEventListener(\n 'sp-query-theme',\n this.onQueryTheme as EventListener\n );\n this.addEventListener(\n 'sp-language-context',\n this._handleContextPresence as EventListener\n );\n this.updateComplete = this.__createDeferredPromise();\n }\n\n public updateComplete!: Promise<boolean>;\n private __resolve!: (compelted: boolean) => void;\n\n private __createDeferredPromise(): Promise<boolean> {\n return new Promise((resolve) => {\n this.__resolve = resolve;\n });\n }\n\n /* c8 ignore next 12 */\n private onQueryTheme(event: CustomEvent<ThemeData>): void {\n if (event.defaultPrevented) {\n return;\n }\n event.preventDefault();\n const { detail: theme } = event;\n theme.color = this.color || undefined;\n theme.scale = this.scale || undefined;\n theme.lang =\n this.lang || document.documentElement.lang || navigator.language;\n theme.theme = this.theme || undefined;\n }\n\n protected connectedCallback(): void {\n this.shouldAdoptStyles();\n // Note, first update/render handles styleElement so we only call this if\n // connected after first update.\n /* c8 ignore next 3 */\n if (window.ShadyCSS !== undefined) {\n window.ShadyCSS.styleElement(this);\n }\n // Add `this` to the instances array.\n Theme.instances.add(this);\n if (!this.hasAttribute('dir')) {\n let dirParent = ((this as HTMLElement).assignedSlot ||\n this.parentNode) as HTMLElement | DocumentFragment | ShadowRoot;\n while (\n dirParent !== document.documentElement &&\n !(dirParent instanceof Theme)\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 ShadowRoot).host) as\n | HTMLElement\n | DocumentFragment\n | ShadowRoot;\n }\n this.dir = dirParent.dir === 'rtl' ? dirParent.dir : 'ltr';\n }\n }\n\n protected disconnectedCallback(): void {\n // Remove `this` to the instances array.\n Theme.instances.delete(this);\n }\n\n public startManagingContentDirection(el: HTMLElement): void {\n this.trackedChildren.add(el);\n }\n\n public stopManagingContentDirection(el: HTMLElement): void {\n this.trackedChildren.delete(el);\n }\n\n private trackedChildren: Set<HTMLElement> = new Set();\n\n private _updateRequested = false;\n\n private async shouldAdoptStyles(): Promise<void> {\n if (!this._updateRequested) {\n this.updateComplete = this.__createDeferredPromise();\n this._updateRequested = true;\n this._updateRequested = await false;\n this.adoptStyles();\n this.__resolve(true);\n }\n }\n\n protected adoptStyles(): void {\n const styles = this.styles; // No test coverage on Edge\n\n // There are three separate cases here based on Shadow DOM support.\n // (1) shadowRoot polyfilled: use ShadyCSS\n // (2) shadowRoot.adoptedStyleSheets available: use it.\n // (3) shadowRoot.adoptedStyleSheets polyfilled: append styles after rendering\n /* c8 ignore next 28 */\n if (\n window.ShadyCSS !== undefined &&\n !window.ShadyCSS.nativeShadow &&\n window.ShadyCSS.ScopingShim\n ) {\n // For browsers using the shim, there seems to be one set of\n // processed styles per template, so it is hard to nest styles. So,\n // for those, we load in all style fragments and then switch using a\n // host selector (e.g. :host([color='dark']))\n const fragmentCSS: string[] = [];\n for (const [kind, fragments] of Theme.themeFragmentsByKind) {\n for (const [name, { styles }] of fragments) {\n if (name === 'default') continue;\n let cssText = (styles as CSSResult).cssText;\n if (!Theme.defaultFragments.has(name as FragmentName)) {\n cssText = cssText.replace(\n ':host',\n `:host([${kind}='${name}'])`\n );\n }\n fragmentCSS.push(cssText);\n }\n }\n window.ShadyCSS.ScopingShim.prepareAdoptedCssText(\n fragmentCSS,\n this.localName\n );\n window.ShadyCSS.prepareTemplate(Theme.template, this.localName);\n } else if (supportsAdoptingStyleSheets) {\n const styleSheets: CSSStyleSheet[] = [];\n for (const style of styles) {\n styleSheets.push(\n (style as CSSResult).styleSheet as CSSStyleSheet\n );\n }\n this.shadowRoot.adoptedStyleSheets = styleSheets;\n /* c8 ignore next 9 */\n } else {\n const styleNodes = this.shadowRoot.querySelectorAll('style');\n styleNodes.forEach((element) => element.remove());\n styles.forEach((s) => {\n const style = document.createElement('style');\n style.textContent = (s as CSSResult).cssText;\n this.shadowRoot.appendChild(style);\n });\n }\n }\n\n static registerThemeFragment(\n name: FragmentName,\n kind: FragmentType,\n styles: CSSResultGroup\n ): void {\n const fragmentMap = Theme.themeFragmentsByKind.get(kind) || new Map();\n if (fragmentMap.size === 0) {\n Theme.themeFragmentsByKind.set(kind, fragmentMap);\n // we're adding our first fragment for this kind, set as default\n fragmentMap.set('default', { name, styles });\n Theme.defaultFragments.add(name);\n }\n fragmentMap.set(name, { name, styles });\n Theme.instances.forEach((instance) => instance.shouldAdoptStyles());\n }\n\n private _contextConsumers = new Map<\n HTMLElement,\n [ProvideLang['callback'], () => void]\n >();\n\n /* c8 ignore next 5 */\n private _provideContext(): void {\n this._contextConsumers.forEach(([callback, unsubscribe]) =>\n callback(this.lang, unsubscribe)\n );\n }\n\n private _handleContextPresence(event: CustomEvent<ProvideLang>): void {\n event.stopPropagation();\n const target = event.composedPath()[0] as HTMLElement;\n /* c8 ignore next 3 */\n if (this._contextConsumers.has(target)) {\n return;\n }\n this._contextConsumers.set(target, [\n event.detail.callback,\n () => this._contextConsumers.delete(target),\n ]);\n const [callback, unsubscribe] =\n this._contextConsumers.get(target) || [];\n if (callback && unsubscribe) {\n callback(\n this.lang ||\n document.documentElement.lang ||\n navigator.language,\n unsubscribe\n );\n }\n }\n}\n"],
5
+ "mappings": "aAYA,OAGI,+BAAAA,MACG,gCACP,OAAS,WAAAC,MAAe,+CAyCxB,MAAMC,EAAqB,CAAC,WAAY,SAAS,EAC3CC,EAAc,CAAC,SAAU,QAAS,iBAAkB,eAAe,EACnEC,EAAc,CAChB,QACA,WACA,OACA,UACA,gBACA,mBACA,eACA,iBACJ,EAwBaC,EAAN,MAAMA,UAAc,WAAyC,CAuQ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J,EAhdalC,EACM,qBAAyC,IAAI,IADnDA,EAEM,iBAAsC,IAAI,IAAI,CAAC,UAAU,CAAC,EAFhEA,EAIM,UAAwB,IAAI,IAJlCA,EAKF,QAAUJ,EALd,WAAM,MAANI",
6
6
  "names": ["supportsAdoptingStyleSheets", "version", "ThemeVariantValues", "ScaleValues", "ColorValues", "_Theme", "node", "dir", "targetDir", "el", "attrName", "old", "value", "themeFragments", "name", "newValue", "theme", "color", "scale", "themeKinds", "getStyle", "fragments", "kind", "currentStyles", "isAppliedFragment", "acc", "kindFragments", "style", "resolve", "event", "dirParent", "styles", "fragmentCSS", "cssText", "styleSheets", "element", "fragmentMap", "instance", "callback", "unsubscribe", "target"]
7
7
  }