@spectrum-web-components/iconset 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/iconset",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -66,7 +66,7 @@
66
66
  "css"
67
67
  ],
68
68
  "dependencies": {
69
- "@spectrum-web-components/base": "1.7.0"
69
+ "@spectrum-web-components/base": "1.8.0"
70
70
  },
71
71
  "types": "./src/index.d.ts",
72
72
  "customElements": "custom-elements.json",
@@ -1,3 +1,14 @@
1
+ /**
2
+ * Copyright 2025 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
1
12
  import { Iconset } from './iconset.js';
2
13
  export interface IconsetAddedDetail {
3
14
  name: string;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["iconset-registry.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { Iconset } from './iconset.dev.js'\nexport interface IconsetAddedDetail {\n name: string;\n iconset: Iconset;\n}\nexport interface IconsetRemovedDetail {\n name: string;\n}\n\nexport class IconsetRegistry {\n // singleton getter\n public static getInstance(): IconsetRegistry {\n if (!IconsetRegistry.instance) {\n IconsetRegistry.instance = new IconsetRegistry();\n }\n return IconsetRegistry.instance;\n }\n private static instance: IconsetRegistry;\n\n private iconsetMap = new Map<string, Iconset>();\n\n public addIconset(name: string, iconset: Iconset): void {\n this.iconsetMap.set(name, iconset);\n\n // dispatch a sp-iconset-added event on window to let everyone know we have a new iconset\n // note we're using window here for efficiency since we don't need to bubble through the dom since everyone\n // will know where to look for this event\n const event = new CustomEvent('sp-iconset-added', {\n bubbles: true,\n composed: true,\n detail: { name, iconset },\n });\n // we're dispatching this event in the next tick to allow the iconset to finish any slotchange or other event\n // listeners caused by connection to the dom and first render to complete, this way any icons listening for\n // this iconset will be able to access the completed iconset\n setTimeout(() => window.dispatchEvent(event), 0);\n }\n public removeIconset(name: string): void {\n this.iconsetMap.delete(name);\n // dispatch a sp-iconset-removed event on window to let everyone know we have a new iconset\n // note we're using window here for efficiency since we don't need to bubble through the dom since everyone\n // will know where to look for this event\n const event = new CustomEvent('sp-iconset-removed', {\n bubbles: true,\n composed: true,\n detail: { name },\n });\n // we're dispatching this event in the next tick To keep the event model consistent with the added event\n setTimeout(() => window.dispatchEvent(event), 0);\n }\n public getIconset(name: string): Iconset | undefined {\n return this.iconsetMap.get(name);\n }\n}\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n 'sp-iconset-added': CustomEvent<IconsetAddedDetail>;\n 'sp-iconset-removed': CustomEvent<IconsetRemovedDetail>;\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { Iconset } from './iconset.dev.js'\nexport interface IconsetAddedDetail {\n name: string;\n iconset: Iconset;\n}\nexport interface IconsetRemovedDetail {\n name: string;\n}\n\nexport class IconsetRegistry {\n // singleton getter\n public static getInstance(): IconsetRegistry {\n if (!IconsetRegistry.instance) {\n IconsetRegistry.instance = new IconsetRegistry();\n }\n return IconsetRegistry.instance;\n }\n private static instance: IconsetRegistry;\n\n private iconsetMap = new Map<string, Iconset>();\n\n public addIconset(name: string, iconset: Iconset): void {\n this.iconsetMap.set(name, iconset);\n\n // dispatch a sp-iconset-added event on window to let everyone know we have a new iconset\n // note we're using window here for efficiency since we don't need to bubble through the dom since everyone\n // will know where to look for this event\n const event = new CustomEvent('sp-iconset-added', {\n bubbles: true,\n composed: true,\n detail: { name, iconset },\n });\n // we're dispatching this event in the next tick to allow the iconset to finish any slotchange or other event\n // listeners caused by connection to the dom and first render to complete, this way any icons listening for\n // this iconset will be able to access the completed iconset\n setTimeout(() => window.dispatchEvent(event), 0);\n }\n public removeIconset(name: string): void {\n this.iconsetMap.delete(name);\n // dispatch a sp-iconset-removed event on window to let everyone know we have a new iconset\n // note we're using window here for efficiency since we don't need to bubble through the dom since everyone\n // will know where to look for this event\n const event = new CustomEvent('sp-iconset-removed', {\n bubbles: true,\n composed: true,\n detail: { name },\n });\n // we're dispatching this event in the next tick To keep the event model consistent with the added event\n setTimeout(() => window.dispatchEvent(event), 0);\n }\n public getIconset(name: string): Iconset | undefined {\n return this.iconsetMap.get(name);\n }\n}\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n 'sp-iconset-added': CustomEvent<IconsetAddedDetail>;\n 'sp-iconset-removed': CustomEvent<IconsetRemovedDetail>;\n }\n}\n"],
5
5
  "mappings": ";AAoBO,aAAM,gBAAgB;AAAA,EAAtB;AAUH,SAAQ,aAAa,oBAAI,IAAqB;AAAA;AAAA;AAAA,EAR9C,OAAc,cAA+B;AACzC,QAAI,CAAC,gBAAgB,UAAU;AAC3B,sBAAgB,WAAW,IAAI,gBAAgB;AAAA,IACnD;AACA,WAAO,gBAAgB;AAAA,EAC3B;AAAA,EAKO,WAAW,MAAc,SAAwB;AACpD,SAAK,WAAW,IAAI,MAAM,OAAO;AAKjC,UAAM,QAAQ,IAAI,YAAY,oBAAoB;AAAA,MAC9C,SAAS;AAAA,MACT,UAAU;AAAA,MACV,QAAQ,EAAE,MAAM,QAAQ;AAAA,IAC5B,CAAC;AAID,eAAW,MAAM,OAAO,cAAc,KAAK,GAAG,CAAC;AAAA,EACnD;AAAA,EACO,cAAc,MAAoB;AACrC,SAAK,WAAW,OAAO,IAAI;AAI3B,UAAM,QAAQ,IAAI,YAAY,sBAAsB;AAAA,MAChD,SAAS;AAAA,MACT,UAAU;AAAA,MACV,QAAQ,EAAE,KAAK;AAAA,IACnB,CAAC;AAED,eAAW,MAAM,OAAO,cAAc,KAAK,GAAG,CAAC;AAAA,EACnD;AAAA,EACO,WAAW,MAAmC;AACjD,WAAO,KAAK,WAAW,IAAI,IAAI;AAAA,EACnC;AACJ;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["iconset-registry.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { Iconset } from './iconset.js';\nexport interface IconsetAddedDetail {\n name: string;\n iconset: Iconset;\n}\nexport interface IconsetRemovedDetail {\n name: string;\n}\n\nexport class IconsetRegistry {\n // singleton getter\n public static getInstance(): IconsetRegistry {\n if (!IconsetRegistry.instance) {\n IconsetRegistry.instance = new IconsetRegistry();\n }\n return IconsetRegistry.instance;\n }\n private static instance: IconsetRegistry;\n\n private iconsetMap = new Map<string, Iconset>();\n\n public addIconset(name: string, iconset: Iconset): void {\n this.iconsetMap.set(name, iconset);\n\n // dispatch a sp-iconset-added event on window to let everyone know we have a new iconset\n // note we're using window here for efficiency since we don't need to bubble through the dom since everyone\n // will know where to look for this event\n const event = new CustomEvent('sp-iconset-added', {\n bubbles: true,\n composed: true,\n detail: { name, iconset },\n });\n // we're dispatching this event in the next tick to allow the iconset to finish any slotchange or other event\n // listeners caused by connection to the dom and first render to complete, this way any icons listening for\n // this iconset will be able to access the completed iconset\n setTimeout(() => window.dispatchEvent(event), 0);\n }\n public removeIconset(name: string): void {\n this.iconsetMap.delete(name);\n // dispatch a sp-iconset-removed event on window to let everyone know we have a new iconset\n // note we're using window here for efficiency since we don't need to bubble through the dom since everyone\n // will know where to look for this event\n const event = new CustomEvent('sp-iconset-removed', {\n bubbles: true,\n composed: true,\n detail: { name },\n });\n // we're dispatching this event in the next tick To keep the event model consistent with the added event\n setTimeout(() => window.dispatchEvent(event), 0);\n }\n public getIconset(name: string): Iconset | undefined {\n return this.iconsetMap.get(name);\n }\n}\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n 'sp-iconset-added': CustomEvent<IconsetAddedDetail>;\n 'sp-iconset-removed': CustomEvent<IconsetRemovedDetail>;\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { Iconset } from './iconset.js';\nexport interface IconsetAddedDetail {\n name: string;\n iconset: Iconset;\n}\nexport interface IconsetRemovedDetail {\n name: string;\n}\n\nexport class IconsetRegistry {\n // singleton getter\n public static getInstance(): IconsetRegistry {\n if (!IconsetRegistry.instance) {\n IconsetRegistry.instance = new IconsetRegistry();\n }\n return IconsetRegistry.instance;\n }\n private static instance: IconsetRegistry;\n\n private iconsetMap = new Map<string, Iconset>();\n\n public addIconset(name: string, iconset: Iconset): void {\n this.iconsetMap.set(name, iconset);\n\n // dispatch a sp-iconset-added event on window to let everyone know we have a new iconset\n // note we're using window here for efficiency since we don't need to bubble through the dom since everyone\n // will know where to look for this event\n const event = new CustomEvent('sp-iconset-added', {\n bubbles: true,\n composed: true,\n detail: { name, iconset },\n });\n // we're dispatching this event in the next tick to allow the iconset to finish any slotchange or other event\n // listeners caused by connection to the dom and first render to complete, this way any icons listening for\n // this iconset will be able to access the completed iconset\n setTimeout(() => window.dispatchEvent(event), 0);\n }\n public removeIconset(name: string): void {\n this.iconsetMap.delete(name);\n // dispatch a sp-iconset-removed event on window to let everyone know we have a new iconset\n // note we're using window here for efficiency since we don't need to bubble through the dom since everyone\n // will know where to look for this event\n const event = new CustomEvent('sp-iconset-removed', {\n bubbles: true,\n composed: true,\n detail: { name },\n });\n // we're dispatching this event in the next tick To keep the event model consistent with the added event\n setTimeout(() => window.dispatchEvent(event), 0);\n }\n public getIconset(name: string): Iconset | undefined {\n return this.iconsetMap.get(name);\n }\n}\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n 'sp-iconset-added': CustomEvent<IconsetAddedDetail>;\n 'sp-iconset-removed': CustomEvent<IconsetRemovedDetail>;\n }\n}\n"],
5
5
  "mappings": "aAoBO,aAAM,eAAgB,CAAtB,cAUH,KAAQ,WAAa,IAAI,IARzB,OAAc,aAA+B,CACzC,OAAK,gBAAgB,WACjB,gBAAgB,SAAW,IAAI,iBAE5B,gBAAgB,QAC3B,CAKO,WAAWA,EAAcC,EAAwB,CACpD,KAAK,WAAW,IAAID,EAAMC,CAAO,EAKjC,MAAMC,EAAQ,IAAI,YAAY,mBAAoB,CAC9C,QAAS,GACT,SAAU,GACV,OAAQ,CAAE,KAAAF,EAAM,QAAAC,CAAQ,CAC5B,CAAC,EAID,WAAW,IAAM,OAAO,cAAcC,CAAK,EAAG,CAAC,CACnD,CACO,cAAcF,EAAoB,CACrC,KAAK,WAAW,OAAOA,CAAI,EAI3B,MAAME,EAAQ,IAAI,YAAY,qBAAsB,CAChD,QAAS,GACT,SAAU,GACV,OAAQ,CAAE,KAAAF,CAAK,CACnB,CAAC,EAED,WAAW,IAAM,OAAO,cAAcE,CAAK,EAAG,CAAC,CACnD,CACO,WAAWF,EAAmC,CACjD,OAAO,KAAK,WAAW,IAAIA,CAAI,CACnC,CACJ",
6
6
  "names": ["name", "iconset", "event"]
7
7
  }
@@ -1,3 +1,14 @@
1
+ /**
2
+ * Copyright 2025 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
1
12
  import { PropertyValues, TemplateResult } from '@spectrum-web-components/base';
2
13
  import { Iconset } from './iconset.js';
3
14
  export declare abstract class IconsetSVG extends Iconset {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["iconset-svg.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 html,\n PropertyValues,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { query } from '@spectrum-web-components/base/src/decorators.js';\n\nimport { Iconset } from './iconset.dev.js'\n\nexport abstract class IconsetSVG extends Iconset {\n private iconMap: Map<string, SVGSymbolElement> = new Map();\n\n @query('slot')\n private slotContainer?: HTMLSlotElement;\n\n /**\n * First updated handler just ensures we've processed any slotted symbols\n */\n public override updated(changedProperties: PropertyValues): void {\n if (!this.slotContainer) {\n return;\n }\n const currentSVGNodes = this.getSVGNodes(this.slotContainer);\n this.updateSVG(currentSVGNodes);\n super.updated(changedProperties);\n }\n /**\n * Applies the requested icon from this iconset instance to the given element.\n *\n * @param el - the element to apply the icon to\n * @param icon - the name of the icon within this set to apply.\n */\n public async applyIconToElement(\n el: HTMLElement,\n icon: string,\n _size: string,\n label: string\n ): Promise<void> {\n await this.updateComplete;\n const iconSymbol = this.iconMap.get(icon);\n if (!iconSymbol) {\n throw new Error(`Unable to find icon ${icon}`);\n }\n // we cannot share a single SVG globally across shadowroot boundaries\n // so copy the template node so we can inject it where we need it\n const clonedNode = this.prepareSvgClone(iconSymbol);\n clonedNode.setAttribute('role', 'img');\n if (label) {\n clonedNode.setAttribute('aria-label', label);\n } else {\n clonedNode.setAttribute('aria-hidden', 'true');\n }\n // append the svg to the node either in its shadowroot or directly into its dom\n if (el.shadowRoot) {\n el.shadowRoot.appendChild(clonedNode);\n } else {\n el.appendChild(clonedNode);\n }\n }\n\n /**\n * Returns a list of all icons in this iconset.\n */\n public getIconList(): string[] {\n return [...this.iconMap.keys()];\n }\n\n protected prepareSvgClone(sourceSvg: SVGSymbolElement): SVGSVGElement {\n const content = sourceSvg.cloneNode(true) as SVGSymbolElement;\n // we're going to create a new svg element that will have our symbol geometry inside\n const svg = document.createElementNS(\n 'http://www.w3.org/2000/svg',\n 'svg'\n );\n const viewBox = content.getAttribute('viewBox') || '';\n // inline style isn't ideal but will work in all cases and means our icons don't need to know\n // if they are svg or spritesheet provided\n const cssText =\n 'pointer-events: none; display: block; width: 100%; height: 100%;';\n svg.style.cssText = cssText;\n // copy the viewbox and other properties into the svg\n svg.setAttribute('viewBox', viewBox);\n svg.setAttribute('preserveAspectRatio', 'xMidYMid meet');\n svg.setAttribute('focusable', 'false');\n // move all the child nodes over to the svg\n while (content.childNodes.length > 0) {\n svg.appendChild(content.childNodes[0]);\n }\n return svg;\n }\n protected getSVGIconName(icon: string): string {\n return icon;\n }\n protected getSanitizedIconName(icon: string): string {\n return icon;\n }\n protected renderDefaultContent(): TemplateResult {\n return html``;\n }\n\n protected override render(): TemplateResult {\n return html`\n <slot @slotchange=${this.onSlotChange}>\n ${this.renderDefaultContent()}\n </slot>\n `;\n }\n\n protected updateSVG(nodes: SVGElement[]): void {\n // iterate over the nodes that were passed in, and find all the top level symbols\n const symbols = nodes.reduce((prev, svgNode) => {\n const containedSymbols = svgNode.querySelectorAll('symbol');\n prev.push(...containedSymbols);\n return prev;\n }, [] as SVGSymbolElement[]);\n symbols.forEach((symbol) => {\n this.iconMap.set(this.getSanitizedIconName(symbol.id), symbol);\n });\n }\n\n protected getSVGNodes(slotTarget: HTMLSlotElement): SVGElement[] {\n const nodes = slotTarget.assignedNodes({ flatten: true });\n // find all the svg nodes\n const svgNodes = nodes.filter((node) => {\n return node.nodeName === 'svg';\n }) as SVGElement[];\n return svgNodes;\n }\n\n private onSlotChange(event: Event): void {\n const slotTarget = event.target as HTMLSlotElement;\n const svgNodes = this.getSVGNodes(slotTarget);\n this.updateSVG(svgNodes);\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n html,\n PropertyValues,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { query } from '@spectrum-web-components/base/src/decorators.js';\n\nimport { Iconset } from './iconset.dev.js'\n\nexport abstract class IconsetSVG extends Iconset {\n private iconMap: Map<string, SVGSymbolElement> = new Map();\n\n @query('slot')\n private slotContainer?: HTMLSlotElement;\n\n /**\n * First updated handler just ensures we've processed any slotted symbols\n */\n public override updated(changedProperties: PropertyValues): void {\n if (!this.slotContainer) {\n return;\n }\n const currentSVGNodes = this.getSVGNodes(this.slotContainer);\n this.updateSVG(currentSVGNodes);\n super.updated(changedProperties);\n }\n /**\n * Applies the requested icon from this iconset instance to the given element.\n *\n * @param el - the element to apply the icon to\n * @param icon - the name of the icon within this set to apply.\n */\n public async applyIconToElement(\n el: HTMLElement,\n icon: string,\n _size: string,\n label: string\n ): Promise<void> {\n await this.updateComplete;\n const iconSymbol = this.iconMap.get(icon);\n if (!iconSymbol) {\n throw new Error(`Unable to find icon ${icon}`);\n }\n // we cannot share a single SVG globally across shadowroot boundaries\n // so copy the template node so we can inject it where we need it\n const clonedNode = this.prepareSvgClone(iconSymbol);\n clonedNode.setAttribute('role', 'img');\n if (label) {\n clonedNode.setAttribute('aria-label', label);\n } else {\n clonedNode.setAttribute('aria-hidden', 'true');\n }\n // append the svg to the node either in its shadowroot or directly into its dom\n if (el.shadowRoot) {\n el.shadowRoot.appendChild(clonedNode);\n } else {\n el.appendChild(clonedNode);\n }\n }\n\n /**\n * Returns a list of all icons in this iconset.\n */\n public getIconList(): string[] {\n return [...this.iconMap.keys()];\n }\n\n protected prepareSvgClone(sourceSvg: SVGSymbolElement): SVGSVGElement {\n const content = sourceSvg.cloneNode(true) as SVGSymbolElement;\n // we're going to create a new svg element that will have our symbol geometry inside\n const svg = document.createElementNS(\n 'http://www.w3.org/2000/svg',\n 'svg'\n );\n const viewBox = content.getAttribute('viewBox') || '';\n // inline style isn't ideal but will work in all cases and means our icons don't need to know\n // if they are svg or spritesheet provided\n const cssText =\n 'pointer-events: none; display: block; width: 100%; height: 100%;';\n svg.style.cssText = cssText;\n // copy the viewbox and other properties into the svg\n svg.setAttribute('viewBox', viewBox);\n svg.setAttribute('preserveAspectRatio', 'xMidYMid meet');\n svg.setAttribute('focusable', 'false');\n // move all the child nodes over to the svg\n while (content.childNodes.length > 0) {\n svg.appendChild(content.childNodes[0]);\n }\n return svg;\n }\n protected getSVGIconName(icon: string): string {\n return icon;\n }\n protected getSanitizedIconName(icon: string): string {\n return icon;\n }\n protected renderDefaultContent(): TemplateResult {\n return html``;\n }\n\n protected override render(): TemplateResult {\n return html`\n <slot @slotchange=${this.onSlotChange}>\n ${this.renderDefaultContent()}\n </slot>\n `;\n }\n\n protected updateSVG(nodes: SVGElement[]): void {\n // iterate over the nodes that were passed in, and find all the top level symbols\n const symbols = nodes.reduce((prev, svgNode) => {\n const containedSymbols = svgNode.querySelectorAll('symbol');\n prev.push(...containedSymbols);\n return prev;\n }, [] as SVGSymbolElement[]);\n symbols.forEach((symbol) => {\n this.iconMap.set(this.getSanitizedIconName(symbol.id), symbol);\n });\n }\n\n protected getSVGNodes(slotTarget: HTMLSlotElement): SVGElement[] {\n const nodes = slotTarget.assignedNodes({ flatten: true });\n // find all the svg nodes\n const svgNodes = nodes.filter((node) => {\n return node.nodeName === 'svg';\n }) as SVGElement[];\n return svgNodes;\n }\n\n private onSlotChange(event: Event): void {\n const slotTarget = event.target as HTMLSlotElement;\n const svgNodes = this.getSVGNodes(slotTarget);\n this.updateSVG(svgNodes);\n }\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;AAYA;AAAA,EACI;AAAA,OAGG;AACP,SAAS,aAAa;AAEtB,SAAS,eAAe;AAEjB,aAAe,mBAAmB,QAAQ;AAAA,EAA1C;AAAA;AACH,SAAQ,UAAyC,oBAAI,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA,EAQzC,QAAQ,mBAAyC;AAC7D,QAAI,CAAC,KAAK,eAAe;AACrB;AAAA,IACJ;AACA,UAAM,kBAAkB,KAAK,YAAY,KAAK,aAAa;AAC3D,SAAK,UAAU,eAAe;AAC9B,UAAM,QAAQ,iBAAiB;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAa,mBACT,IACA,MACA,OACA,OACa;AACb,UAAM,KAAK;AACX,UAAM,aAAa,KAAK,QAAQ,IAAI,IAAI;AACxC,QAAI,CAAC,YAAY;AACb,YAAM,IAAI,MAAM,uBAAuB,IAAI,EAAE;AAAA,IACjD;AAGA,UAAM,aAAa,KAAK,gBAAgB,UAAU;AAClD,eAAW,aAAa,QAAQ,KAAK;AACrC,QAAI,OAAO;AACP,iBAAW,aAAa,cAAc,KAAK;AAAA,IAC/C,OAAO;AACH,iBAAW,aAAa,eAAe,MAAM;AAAA,IACjD;AAEA,QAAI,GAAG,YAAY;AACf,SAAG,WAAW,YAAY,UAAU;AAAA,IACxC,OAAO;AACH,SAAG,YAAY,UAAU;AAAA,IAC7B;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA,EAKO,cAAwB;AAC3B,WAAO,CAAC,GAAG,KAAK,QAAQ,KAAK,CAAC;AAAA,EAClC;AAAA,EAEU,gBAAgB,WAA4C;AAClE,UAAM,UAAU,UAAU,UAAU,IAAI;AAExC,UAAM,MAAM,SAAS;AAAA,MACjB;AAAA,MACA;AAAA,IACJ;AACA,UAAM,UAAU,QAAQ,aAAa,SAAS,KAAK;AAGnD,UAAM,UACF;AACJ,QAAI,MAAM,UAAU;AAEpB,QAAI,aAAa,WAAW,OAAO;AACnC,QAAI,aAAa,uBAAuB,eAAe;AACvD,QAAI,aAAa,aAAa,OAAO;AAErC,WAAO,QAAQ,WAAW,SAAS,GAAG;AAClC,UAAI,YAAY,QAAQ,WAAW,CAAC,CAAC;AAAA,IACzC;AACA,WAAO;AAAA,EACX;AAAA,EACU,eAAe,MAAsB;AAC3C,WAAO;AAAA,EACX;AAAA,EACU,qBAAqB,MAAsB;AACjD,WAAO;AAAA,EACX;AAAA,EACU,uBAAuC;AAC7C,WAAO;AAAA,EACX;AAAA,EAEmB,SAAyB;AACxC,WAAO;AAAA,gCACiB,KAAK,YAAY;AAAA,kBAC/B,KAAK,qBAAqB,CAAC;AAAA;AAAA;AAAA,EAGzC;AAAA,EAEU,UAAU,OAA2B;AAE3C,UAAM,UAAU,MAAM,OAAO,CAAC,MAAM,YAAY;AAC5C,YAAM,mBAAmB,QAAQ,iBAAiB,QAAQ;AAC1D,WAAK,KAAK,GAAG,gBAAgB;AAC7B,aAAO;AAAA,IACX,GAAG,CAAC,CAAuB;AAC3B,YAAQ,QAAQ,CAAC,WAAW;AACxB,WAAK,QAAQ,IAAI,KAAK,qBAAqB,OAAO,EAAE,GAAG,MAAM;AAAA,IACjE,CAAC;AAAA,EACL;AAAA,EAEU,YAAY,YAA2C;AAC7D,UAAM,QAAQ,WAAW,cAAc,EAAE,SAAS,KAAK,CAAC;AAExD,UAAM,WAAW,MAAM,OAAO,CAAC,SAAS;AACpC,aAAO,KAAK,aAAa;AAAA,IAC7B,CAAC;AACD,WAAO;AAAA,EACX;AAAA,EAEQ,aAAa,OAAoB;AACrC,UAAM,aAAa,MAAM;AACzB,UAAM,WAAW,KAAK,YAAY,UAAU;AAC5C,SAAK,UAAU,QAAQ;AAAA,EAC3B;AACJ;AAzHY;AAAA,EADP,MAAM,MAAM;AAAA,GAHK,WAIV;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["iconset-svg.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 html,\n PropertyValues,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { query } from '@spectrum-web-components/base/src/decorators.js';\n\nimport { Iconset } from './iconset.js';\n\nexport abstract class IconsetSVG extends Iconset {\n private iconMap: Map<string, SVGSymbolElement> = new Map();\n\n @query('slot')\n private slotContainer?: HTMLSlotElement;\n\n /**\n * First updated handler just ensures we've processed any slotted symbols\n */\n public override updated(changedProperties: PropertyValues): void {\n if (!this.slotContainer) {\n return;\n }\n const currentSVGNodes = this.getSVGNodes(this.slotContainer);\n this.updateSVG(currentSVGNodes);\n super.updated(changedProperties);\n }\n /**\n * Applies the requested icon from this iconset instance to the given element.\n *\n * @param el - the element to apply the icon to\n * @param icon - the name of the icon within this set to apply.\n */\n public async applyIconToElement(\n el: HTMLElement,\n icon: string,\n _size: string,\n label: string\n ): Promise<void> {\n await this.updateComplete;\n const iconSymbol = this.iconMap.get(icon);\n if (!iconSymbol) {\n throw new Error(`Unable to find icon ${icon}`);\n }\n // we cannot share a single SVG globally across shadowroot boundaries\n // so copy the template node so we can inject it where we need it\n const clonedNode = this.prepareSvgClone(iconSymbol);\n clonedNode.setAttribute('role', 'img');\n if (label) {\n clonedNode.setAttribute('aria-label', label);\n } else {\n clonedNode.setAttribute('aria-hidden', 'true');\n }\n // append the svg to the node either in its shadowroot or directly into its dom\n if (el.shadowRoot) {\n el.shadowRoot.appendChild(clonedNode);\n } else {\n el.appendChild(clonedNode);\n }\n }\n\n /**\n * Returns a list of all icons in this iconset.\n */\n public getIconList(): string[] {\n return [...this.iconMap.keys()];\n }\n\n protected prepareSvgClone(sourceSvg: SVGSymbolElement): SVGSVGElement {\n const content = sourceSvg.cloneNode(true) as SVGSymbolElement;\n // we're going to create a new svg element that will have our symbol geometry inside\n const svg = document.createElementNS(\n 'http://www.w3.org/2000/svg',\n 'svg'\n );\n const viewBox = content.getAttribute('viewBox') || '';\n // inline style isn't ideal but will work in all cases and means our icons don't need to know\n // if they are svg or spritesheet provided\n const cssText =\n 'pointer-events: none; display: block; width: 100%; height: 100%;';\n svg.style.cssText = cssText;\n // copy the viewbox and other properties into the svg\n svg.setAttribute('viewBox', viewBox);\n svg.setAttribute('preserveAspectRatio', 'xMidYMid meet');\n svg.setAttribute('focusable', 'false');\n // move all the child nodes over to the svg\n while (content.childNodes.length > 0) {\n svg.appendChild(content.childNodes[0]);\n }\n return svg;\n }\n protected getSVGIconName(icon: string): string {\n return icon;\n }\n protected getSanitizedIconName(icon: string): string {\n return icon;\n }\n protected renderDefaultContent(): TemplateResult {\n return html``;\n }\n\n protected override render(): TemplateResult {\n return html`\n <slot @slotchange=${this.onSlotChange}>\n ${this.renderDefaultContent()}\n </slot>\n `;\n }\n\n protected updateSVG(nodes: SVGElement[]): void {\n // iterate over the nodes that were passed in, and find all the top level symbols\n const symbols = nodes.reduce((prev, svgNode) => {\n const containedSymbols = svgNode.querySelectorAll('symbol');\n prev.push(...containedSymbols);\n return prev;\n }, [] as SVGSymbolElement[]);\n symbols.forEach((symbol) => {\n this.iconMap.set(this.getSanitizedIconName(symbol.id), symbol);\n });\n }\n\n protected getSVGNodes(slotTarget: HTMLSlotElement): SVGElement[] {\n const nodes = slotTarget.assignedNodes({ flatten: true });\n // find all the svg nodes\n const svgNodes = nodes.filter((node) => {\n return node.nodeName === 'svg';\n }) as SVGElement[];\n return svgNodes;\n }\n\n private onSlotChange(event: Event): void {\n const slotTarget = event.target as HTMLSlotElement;\n const svgNodes = this.getSVGNodes(slotTarget);\n this.updateSVG(svgNodes);\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n html,\n PropertyValues,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { query } from '@spectrum-web-components/base/src/decorators.js';\n\nimport { Iconset } from './iconset.js';\n\nexport abstract class IconsetSVG extends Iconset {\n private iconMap: Map<string, SVGSymbolElement> = new Map();\n\n @query('slot')\n private slotContainer?: HTMLSlotElement;\n\n /**\n * First updated handler just ensures we've processed any slotted symbols\n */\n public override updated(changedProperties: PropertyValues): void {\n if (!this.slotContainer) {\n return;\n }\n const currentSVGNodes = this.getSVGNodes(this.slotContainer);\n this.updateSVG(currentSVGNodes);\n super.updated(changedProperties);\n }\n /**\n * Applies the requested icon from this iconset instance to the given element.\n *\n * @param el - the element to apply the icon to\n * @param icon - the name of the icon within this set to apply.\n */\n public async applyIconToElement(\n el: HTMLElement,\n icon: string,\n _size: string,\n label: string\n ): Promise<void> {\n await this.updateComplete;\n const iconSymbol = this.iconMap.get(icon);\n if (!iconSymbol) {\n throw new Error(`Unable to find icon ${icon}`);\n }\n // we cannot share a single SVG globally across shadowroot boundaries\n // so copy the template node so we can inject it where we need it\n const clonedNode = this.prepareSvgClone(iconSymbol);\n clonedNode.setAttribute('role', 'img');\n if (label) {\n clonedNode.setAttribute('aria-label', label);\n } else {\n clonedNode.setAttribute('aria-hidden', 'true');\n }\n // append the svg to the node either in its shadowroot or directly into its dom\n if (el.shadowRoot) {\n el.shadowRoot.appendChild(clonedNode);\n } else {\n el.appendChild(clonedNode);\n }\n }\n\n /**\n * Returns a list of all icons in this iconset.\n */\n public getIconList(): string[] {\n return [...this.iconMap.keys()];\n }\n\n protected prepareSvgClone(sourceSvg: SVGSymbolElement): SVGSVGElement {\n const content = sourceSvg.cloneNode(true) as SVGSymbolElement;\n // we're going to create a new svg element that will have our symbol geometry inside\n const svg = document.createElementNS(\n 'http://www.w3.org/2000/svg',\n 'svg'\n );\n const viewBox = content.getAttribute('viewBox') || '';\n // inline style isn't ideal but will work in all cases and means our icons don't need to know\n // if they are svg or spritesheet provided\n const cssText =\n 'pointer-events: none; display: block; width: 100%; height: 100%;';\n svg.style.cssText = cssText;\n // copy the viewbox and other properties into the svg\n svg.setAttribute('viewBox', viewBox);\n svg.setAttribute('preserveAspectRatio', 'xMidYMid meet');\n svg.setAttribute('focusable', 'false');\n // move all the child nodes over to the svg\n while (content.childNodes.length > 0) {\n svg.appendChild(content.childNodes[0]);\n }\n return svg;\n }\n protected getSVGIconName(icon: string): string {\n return icon;\n }\n protected getSanitizedIconName(icon: string): string {\n return icon;\n }\n protected renderDefaultContent(): TemplateResult {\n return html``;\n }\n\n protected override render(): TemplateResult {\n return html`\n <slot @slotchange=${this.onSlotChange}>\n ${this.renderDefaultContent()}\n </slot>\n `;\n }\n\n protected updateSVG(nodes: SVGElement[]): void {\n // iterate over the nodes that were passed in, and find all the top level symbols\n const symbols = nodes.reduce((prev, svgNode) => {\n const containedSymbols = svgNode.querySelectorAll('symbol');\n prev.push(...containedSymbols);\n return prev;\n }, [] as SVGSymbolElement[]);\n symbols.forEach((symbol) => {\n this.iconMap.set(this.getSanitizedIconName(symbol.id), symbol);\n });\n }\n\n protected getSVGNodes(slotTarget: HTMLSlotElement): SVGElement[] {\n const nodes = slotTarget.assignedNodes({ flatten: true });\n // find all the svg nodes\n const svgNodes = nodes.filter((node) => {\n return node.nodeName === 'svg';\n }) as SVGElement[];\n return svgNodes;\n }\n\n private onSlotChange(event: Event): void {\n const slotTarget = event.target as HTMLSlotElement;\n const svgNodes = this.getSVGNodes(slotTarget);\n this.updateSVG(svgNodes);\n }\n}\n"],
5
5
  "mappings": "qNAYA,OACI,QAAAA,MAGG,gCACP,OAAS,SAAAC,MAAa,kDAEtB,OAAS,WAAAC,MAAe,eAEjB,aAAe,mBAAmBA,CAAQ,CAA1C,kCACH,KAAQ,QAAyC,IAAI,IAQrC,QAAQC,EAAyC,CAC7D,GAAI,CAAC,KAAK,cACN,OAEJ,MAAMC,EAAkB,KAAK,YAAY,KAAK,aAAa,EAC3D,KAAK,UAAUA,CAAe,EAC9B,MAAM,QAAQD,CAAiB,CACnC,CAOA,MAAa,mBACTE,EACAC,EACAC,EACAC,EACa,CACb,MAAM,KAAK,eACX,MAAMC,EAAa,KAAK,QAAQ,IAAIH,CAAI,EACxC,GAAI,CAACG,EACD,MAAM,IAAI,MAAM,uBAAuBH,CAAI,EAAE,EAIjD,MAAMI,EAAa,KAAK,gBAAgBD,CAAU,EAClDC,EAAW,aAAa,OAAQ,KAAK,EACjCF,EACAE,EAAW,aAAa,aAAcF,CAAK,EAE3CE,EAAW,aAAa,cAAe,MAAM,EAG7CL,EAAG,WACHA,EAAG,WAAW,YAAYK,CAAU,EAEpCL,EAAG,YAAYK,CAAU,CAEjC,CAKO,aAAwB,CAC3B,MAAO,CAAC,GAAG,KAAK,QAAQ,KAAK,CAAC,CAClC,CAEU,gBAAgBC,EAA4C,CAClE,MAAMC,EAAUD,EAAU,UAAU,EAAI,EAElCE,EAAM,SAAS,gBACjB,6BACA,KACJ,EACMC,EAAUF,EAAQ,aAAa,SAAS,GAAK,GAG7CG,EACF,mEAOJ,IANAF,EAAI,MAAM,QAAUE,EAEpBF,EAAI,aAAa,UAAWC,CAAO,EACnCD,EAAI,aAAa,sBAAuB,eAAe,EACvDA,EAAI,aAAa,YAAa,OAAO,EAE9BD,EAAQ,WAAW,OAAS,GAC/BC,EAAI,YAAYD,EAAQ,WAAW,CAAC,CAAC,EAEzC,OAAOC,CACX,CACU,eAAeP,EAAsB,CAC3C,OAAOA,CACX,CACU,qBAAqBA,EAAsB,CACjD,OAAOA,CACX,CACU,sBAAuC,CAC7C,OAAON,GACX,CAEmB,QAAyB,CACxC,OAAOA;AAAA,gCACiB,KAAK,YAAY;AAAA,kBAC/B,KAAK,qBAAqB,CAAC;AAAA;AAAA,SAGzC,CAEU,UAAUgB,EAA2B,CAE3BA,EAAM,OAAO,CAACC,EAAMC,IAAY,CAC5C,MAAMC,EAAmBD,EAAQ,iBAAiB,QAAQ,EAC1D,OAAAD,EAAK,KAAK,GAAGE,CAAgB,EACtBF,CACX,EAAG,CAAC,CAAuB,EACnB,QAASG,GAAW,CACxB,KAAK,QAAQ,IAAI,KAAK,qBAAqBA,EAAO,EAAE,EAAGA,CAAM,CACjE,CAAC,CACL,CAEU,YAAYC,EAA2C,CAM7D,OALcA,EAAW,cAAc,CAAE,QAAS,EAAK,CAAC,EAEjC,OAAQC,GACpBA,EAAK,WAAa,KAC5B,CAEL,CAEQ,aAAaC,EAAoB,CACrC,MAAMF,EAAaE,EAAM,OACnBC,EAAW,KAAK,YAAYH,CAAU,EAC5C,KAAK,UAAUG,CAAQ,CAC3B,CACJ,CAzHYC,EAAA,CADPxB,EAAM,MAAM,GAHK,WAIV",
6
6
  "names": ["html", "query", "Iconset", "changedProperties", "currentSVGNodes", "el", "icon", "_size", "label", "iconSymbol", "clonedNode", "sourceSvg", "content", "svg", "viewBox", "cssText", "nodes", "prev", "svgNode", "containedSymbols", "symbol", "slotTarget", "node", "event", "svgNodes", "__decorateClass"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["iconset.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { IconsetRegistry } from './iconset-registry.dev.js'\n\nimport { LitElement } from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nexport abstract class Iconset extends LitElement {\n protected registered = false;\n\n private _name!: string;\n\n protected override firstUpdated(): void {\n // force no display for all iconsets\n this.style.display = 'none';\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n 'Iconsets have been deprecated and will be removed from the project in an upcoming version. For default Spectrum Icons, learn more about leveraging UI Icons (https://opensource.adobe.com/spectrum-web-components/components/icons-ui/) or Workflow Icons (https://opensource.adobe.com/spectrum-web-components/components/icons-workflow/) as an alternative.',\n 'https://opensource.adobe.com/spectrum-web-components/components/iconset/#deprecated',\n { level: 'deprecation' }\n );\n }\n }\n\n /**\n * Name of the iconset, used by the IconsetRegistry to serve this icon set\n * to consuming icons.\n */\n @property()\n public set name(value: string) {\n // if we're already registered in the iconset registry\n // we'll need to update our registration\n if (this.registered) {\n if (this._name) {\n // remove from the iconset map using the old name\n IconsetRegistry.getInstance().removeIconset(this._name);\n }\n\n if (value) {\n // set in the map using the new name\n IconsetRegistry.getInstance().addIconset(value, this);\n }\n }\n this._name = value;\n }\n public get name(): string {\n return this._name;\n }\n\n /**\n * Applies an icon to the given element\n */\n public abstract applyIconToElement(\n el: HTMLElement,\n icon: string,\n size: string,\n label: string\n ): void;\n\n /**\n * Returns a list of all icons in this iconset.\n */\n public abstract getIconList(): string[];\n\n private handleRemoved = ({\n detail,\n }: {\n detail: { name: string };\n }): void => {\n if (detail.name === this.name) {\n this.registered = false;\n this.addIconset();\n }\n };\n\n /**\n * On updated we register the iconset if we're not already registered\n */\n public override connectedCallback(): void {\n super.connectedCallback();\n this.addIconset();\n window.addEventListener('sp-iconset-removed', this.handleRemoved);\n }\n /**\n * On disconnected we remove the iconset\n */\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener('sp-iconset-removed', this.handleRemoved);\n this.removeIconset();\n }\n\n private addIconset(): void {\n if (!this.name || this.registered) {\n return;\n }\n IconsetRegistry.getInstance().addIconset(this.name, this);\n this.registered = true;\n }\n\n private removeIconset(): void {\n if (!this.name) {\n return;\n }\n IconsetRegistry.getInstance().removeIconset(this.name);\n this.registered = false;\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { IconsetRegistry } from './iconset-registry.dev.js'\n\nimport { LitElement } from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nexport abstract class Iconset extends LitElement {\n protected registered = false;\n\n private _name!: string;\n\n protected override firstUpdated(): void {\n // force no display for all iconsets\n this.style.display = 'none';\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n 'Iconsets have been deprecated and will be removed from the project in an upcoming version. For default Spectrum Icons, learn more about leveraging UI Icons (https://opensource.adobe.com/spectrum-web-components/components/icons-ui/) or Workflow Icons (https://opensource.adobe.com/spectrum-web-components/components/icons-workflow/) as an alternative.',\n 'https://opensource.adobe.com/spectrum-web-components/components/iconset/#deprecated',\n { level: 'deprecation' }\n );\n }\n }\n\n /**\n * Name of the iconset, used by the IconsetRegistry to serve this icon set\n * to consuming icons.\n */\n @property()\n public set name(value: string) {\n // if we're already registered in the iconset registry\n // we'll need to update our registration\n if (this.registered) {\n if (this._name) {\n // remove from the iconset map using the old name\n IconsetRegistry.getInstance().removeIconset(this._name);\n }\n\n if (value) {\n // set in the map using the new name\n IconsetRegistry.getInstance().addIconset(value, this);\n }\n }\n this._name = value;\n }\n public get name(): string {\n return this._name;\n }\n\n /**\n * Applies an icon to the given element\n */\n public abstract applyIconToElement(\n el: HTMLElement,\n icon: string,\n size: string,\n label: string\n ): void;\n\n /**\n * Returns a list of all icons in this iconset.\n */\n public abstract getIconList(): string[];\n\n private handleRemoved = ({\n detail,\n }: {\n detail: { name: string };\n }): void => {\n if (detail.name === this.name) {\n this.registered = false;\n this.addIconset();\n }\n };\n\n /**\n * On updated we register the iconset if we're not already registered\n */\n public override connectedCallback(): void {\n super.connectedCallback();\n this.addIconset();\n window.addEventListener('sp-iconset-removed', this.handleRemoved);\n }\n /**\n * On disconnected we remove the iconset\n */\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener('sp-iconset-removed', this.handleRemoved);\n this.removeIconset();\n }\n\n private addIconset(): void {\n if (!this.name || this.registered) {\n return;\n }\n IconsetRegistry.getInstance().addIconset(this.name, this);\n this.registered = true;\n }\n\n private removeIconset(): void {\n if (!this.name) {\n return;\n }\n IconsetRegistry.getInstance().removeIconset(this.name);\n this.registered = false;\n }\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;AAWA,SAAS,uBAAuB;AAEhC,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AAElB,aAAe,gBAAgB,WAAW;AAAA,EAA1C;AAAA;AACH,SAAU,aAAa;AAyDvB,SAAQ,gBAAgB,CAAC;AAAA,MACrB;AAAA,IACJ,MAEY;AACR,UAAI,OAAO,SAAS,KAAK,MAAM;AAC3B,aAAK,aAAa;AAClB,aAAK,WAAW;AAAA,MACpB;AAAA,IACJ;AAAA;AAAA,EA9DmB,eAAqB;AAEpC,SAAK,MAAM,UAAU;AACrB,QAAI,MAAoB;AACpB,aAAO,MAAM;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA,EAAE,OAAO,cAAc;AAAA,MAC3B;AAAA,IACJ;AAAA,EACJ;AAAA,EAOA,IAAW,KAAK,OAAe;AAG3B,QAAI,KAAK,YAAY;AACjB,UAAI,KAAK,OAAO;AAEZ,wBAAgB,YAAY,EAAE,cAAc,KAAK,KAAK;AAAA,MAC1D;AAEA,UAAI,OAAO;AAEP,wBAAgB,YAAY,EAAE,WAAW,OAAO,IAAI;AAAA,MACxD;AAAA,IACJ;AACA,SAAK,QAAQ;AAAA,EACjB;AAAA,EACA,IAAW,OAAe;AACtB,WAAO,KAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA,EA+BgB,oBAA0B;AACtC,UAAM,kBAAkB;AACxB,SAAK,WAAW;AAChB,WAAO,iBAAiB,sBAAsB,KAAK,aAAa;AAAA,EACpE;AAAA;AAAA;AAAA;AAAA,EAIgB,uBAA6B;AACzC,UAAM,qBAAqB;AAC3B,WAAO,oBAAoB,sBAAsB,KAAK,aAAa;AACnE,SAAK,cAAc;AAAA,EACvB;AAAA,EAEQ,aAAmB;AACvB,QAAI,CAAC,KAAK,QAAQ,KAAK,YAAY;AAC/B;AAAA,IACJ;AACA,oBAAgB,YAAY,EAAE,WAAW,KAAK,MAAM,IAAI;AACxD,SAAK,aAAa;AAAA,EACtB;AAAA,EAEQ,gBAAsB;AAC1B,QAAI,CAAC,KAAK,MAAM;AACZ;AAAA,IACJ;AACA,oBAAgB,YAAY,EAAE,cAAc,KAAK,IAAI;AACrD,SAAK,aAAa;AAAA,EACtB;AACJ;AA9Ee;AAAA,EADV,SAAS;AAAA,GAtBQ,QAuBP;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["iconset.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { IconsetRegistry } from './iconset-registry.js';\n\nimport { LitElement } from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nexport abstract class Iconset extends LitElement {\n protected registered = false;\n\n private _name!: string;\n\n protected override firstUpdated(): void {\n // force no display for all iconsets\n this.style.display = 'none';\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n 'Iconsets have been deprecated and will be removed from the project in an upcoming version. For default Spectrum Icons, learn more about leveraging UI Icons (https://opensource.adobe.com/spectrum-web-components/components/icons-ui/) or Workflow Icons (https://opensource.adobe.com/spectrum-web-components/components/icons-workflow/) as an alternative.',\n 'https://opensource.adobe.com/spectrum-web-components/components/iconset/#deprecated',\n { level: 'deprecation' }\n );\n }\n }\n\n /**\n * Name of the iconset, used by the IconsetRegistry to serve this icon set\n * to consuming icons.\n */\n @property()\n public set name(value: string) {\n // if we're already registered in the iconset registry\n // we'll need to update our registration\n if (this.registered) {\n if (this._name) {\n // remove from the iconset map using the old name\n IconsetRegistry.getInstance().removeIconset(this._name);\n }\n\n if (value) {\n // set in the map using the new name\n IconsetRegistry.getInstance().addIconset(value, this);\n }\n }\n this._name = value;\n }\n public get name(): string {\n return this._name;\n }\n\n /**\n * Applies an icon to the given element\n */\n public abstract applyIconToElement(\n el: HTMLElement,\n icon: string,\n size: string,\n label: string\n ): void;\n\n /**\n * Returns a list of all icons in this iconset.\n */\n public abstract getIconList(): string[];\n\n private handleRemoved = ({\n detail,\n }: {\n detail: { name: string };\n }): void => {\n if (detail.name === this.name) {\n this.registered = false;\n this.addIconset();\n }\n };\n\n /**\n * On updated we register the iconset if we're not already registered\n */\n public override connectedCallback(): void {\n super.connectedCallback();\n this.addIconset();\n window.addEventListener('sp-iconset-removed', this.handleRemoved);\n }\n /**\n * On disconnected we remove the iconset\n */\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener('sp-iconset-removed', this.handleRemoved);\n this.removeIconset();\n }\n\n private addIconset(): void {\n if (!this.name || this.registered) {\n return;\n }\n IconsetRegistry.getInstance().addIconset(this.name, this);\n this.registered = true;\n }\n\n private removeIconset(): void {\n if (!this.name) {\n return;\n }\n IconsetRegistry.getInstance().removeIconset(this.name);\n this.registered = false;\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { IconsetRegistry } from './iconset-registry.js';\n\nimport { LitElement } from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nexport abstract class Iconset extends LitElement {\n protected registered = false;\n\n private _name!: string;\n\n protected override firstUpdated(): void {\n // force no display for all iconsets\n this.style.display = 'none';\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n 'Iconsets have been deprecated and will be removed from the project in an upcoming version. For default Spectrum Icons, learn more about leveraging UI Icons (https://opensource.adobe.com/spectrum-web-components/components/icons-ui/) or Workflow Icons (https://opensource.adobe.com/spectrum-web-components/components/icons-workflow/) as an alternative.',\n 'https://opensource.adobe.com/spectrum-web-components/components/iconset/#deprecated',\n { level: 'deprecation' }\n );\n }\n }\n\n /**\n * Name of the iconset, used by the IconsetRegistry to serve this icon set\n * to consuming icons.\n */\n @property()\n public set name(value: string) {\n // if we're already registered in the iconset registry\n // we'll need to update our registration\n if (this.registered) {\n if (this._name) {\n // remove from the iconset map using the old name\n IconsetRegistry.getInstance().removeIconset(this._name);\n }\n\n if (value) {\n // set in the map using the new name\n IconsetRegistry.getInstance().addIconset(value, this);\n }\n }\n this._name = value;\n }\n public get name(): string {\n return this._name;\n }\n\n /**\n * Applies an icon to the given element\n */\n public abstract applyIconToElement(\n el: HTMLElement,\n icon: string,\n size: string,\n label: string\n ): void;\n\n /**\n * Returns a list of all icons in this iconset.\n */\n public abstract getIconList(): string[];\n\n private handleRemoved = ({\n detail,\n }: {\n detail: { name: string };\n }): void => {\n if (detail.name === this.name) {\n this.registered = false;\n this.addIconset();\n }\n };\n\n /**\n * On updated we register the iconset if we're not already registered\n */\n public override connectedCallback(): void {\n super.connectedCallback();\n this.addIconset();\n window.addEventListener('sp-iconset-removed', this.handleRemoved);\n }\n /**\n * On disconnected we remove the iconset\n */\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener('sp-iconset-removed', this.handleRemoved);\n this.removeIconset();\n }\n\n private addIconset(): void {\n if (!this.name || this.registered) {\n return;\n }\n IconsetRegistry.getInstance().addIconset(this.name, this);\n this.registered = true;\n }\n\n private removeIconset(): void {\n if (!this.name) {\n return;\n }\n IconsetRegistry.getInstance().removeIconset(this.name);\n this.registered = false;\n }\n}\n"],
5
5
  "mappings": "qNAWA,OAAS,mBAAAA,MAAuB,wBAEhC,OAAS,cAAAC,MAAkB,gCAC3B,OAAS,YAAAC,MAAgB,kDAElB,aAAe,gBAAgBD,CAAW,CAA1C,kCACH,KAAU,WAAa,GAyDvB,KAAQ,cAAgB,CAAC,CACrB,OAAAE,CACJ,IAEY,CACJA,EAAO,OAAS,KAAK,OACrB,KAAK,WAAa,GAClB,KAAK,WAAW,EAExB,EA9DmB,cAAqB,CAEpC,KAAK,MAAM,QAAU,MASzB,CAOA,IAAW,KAAKC,EAAe,CAGvB,KAAK,aACD,KAAK,OAELJ,EAAgB,YAAY,EAAE,cAAc,KAAK,KAAK,EAGtDI,GAEAJ,EAAgB,YAAY,EAAE,WAAWI,EAAO,IAAI,GAG5D,KAAK,MAAQA,CACjB,CACA,IAAW,MAAe,CACtB,OAAO,KAAK,KAChB,CA+BgB,mBAA0B,CACtC,MAAM,kBAAkB,EACxB,KAAK,WAAW,EAChB,OAAO,iBAAiB,qBAAsB,KAAK,aAAa,CACpE,CAIgB,sBAA6B,CACzC,MAAM,qBAAqB,EAC3B,OAAO,oBAAoB,qBAAsB,KAAK,aAAa,EACnE,KAAK,cAAc,CACvB,CAEQ,YAAmB,CACnB,CAAC,KAAK,MAAQ,KAAK,aAGvBJ,EAAgB,YAAY,EAAE,WAAW,KAAK,KAAM,IAAI,EACxD,KAAK,WAAa,GACtB,CAEQ,eAAsB,CACrB,KAAK,OAGVA,EAAgB,YAAY,EAAE,cAAc,KAAK,IAAI,EACrD,KAAK,WAAa,GACtB,CACJ,CA9EeK,EAAA,CADVH,EAAS,GAtBQ,QAuBP",
6
6
  "names": ["IconsetRegistry", "LitElement", "property", "detail", "value", "__decorateClass"]
7
7
  }
package/src/index.d.ts CHANGED
@@ -1,3 +1,14 @@
1
+ /**
2
+ * Copyright 2025 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
1
12
  export * from './iconset.js';
2
13
  export * from './iconset-svg.js';
3
14
  export * from './iconset-registry.js';
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["index.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*/\nexport * from './iconset.dev.js'\nexport * from './iconset-svg.dev.js'\nexport * from './iconset-registry.dev.js'\n"],
5
- "mappings": ";AAUA,cAAc;AACd,cAAc;AACd,cAAc;",
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport * from './iconset.dev.js'\nexport * from './iconset-svg.dev.js'\nexport * from './iconset-registry.dev.js'\n"],
5
+ "mappings": ";AAWA,cAAc;AACd,cAAc;AACd,cAAc;",
6
6
  "names": []
7
7
  }
package/src/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["index.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*/\nexport * from './iconset.js';\nexport * from './iconset-svg.js';\nexport * from './iconset-registry.js';\n"],
5
- "mappings": "aAUA,WAAc,eACd,WAAc,mBACd,WAAc",
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport * from './iconset.js';\nexport * from './iconset-svg.js';\nexport * from './iconset-registry.js';\n"],
5
+ "mappings": "aAWA,WAAc,eACd,WAAc,mBACd,WAAc",
6
6
  "names": []
7
7
  }