@siemens/ix-icons 0.0.0-pr-69-20250205111227 → 0.0.0-pr-69-20250205144920

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/components/index.js +1 -1
  2. package/components/ix-icon.js +1 -1
  3. package/components/{p-da232b5d.js → p-187634d0.js} +61 -51
  4. package/components/p-187634d0.js.map +1 -0
  5. package/dist/cjs/{icon-88309350.js → icon-319056c0.js} +61 -51
  6. package/dist/cjs/icon-319056c0.js.map +1 -0
  7. package/dist/cjs/index.cjs.js +1 -1
  8. package/dist/cjs/ix-icon.cjs.entry.js +1 -1
  9. package/dist/collection/components/icon/icon.js +23 -15
  10. package/dist/collection/components/icon/icon.js.map +1 -1
  11. package/dist/collection/components/icon/parser.js +22 -0
  12. package/dist/collection/components/icon/parser.js.map +1 -0
  13. package/dist/collection/components/icon/resolveIcon.js +26 -43
  14. package/dist/collection/components/icon/resolveIcon.js.map +1 -1
  15. package/dist/esm/{icon-4feff534.js → icon-fc868c56.js} +62 -52
  16. package/dist/esm/icon-fc868c56.js.map +1 -0
  17. package/dist/esm/index.js +1 -1
  18. package/dist/esm/ix-icon.entry.js +1 -1
  19. package/dist/ix-icons/index.esm.js +1 -1
  20. package/dist/ix-icons/ix-icons.esm.js +1 -1
  21. package/dist/ix-icons/p-423803cb.js +2 -0
  22. package/dist/ix-icons/p-423803cb.js.map +1 -0
  23. package/dist/ix-icons/p-ca4fc358.entry.js +2 -0
  24. package/dist/types/components/icon/icon.d.ts +5 -2
  25. package/dist/types/components/icon/meta-tag.d.ts +1 -1
  26. package/dist/types/components/icon/parser.d.ts +2 -0
  27. package/dist/types/components/icon/resolveIcon.d.ts +1 -2
  28. package/dist/types/components.d.ts +8 -2
  29. package/icons/package.json +1 -1
  30. package/package.json +1 -1
  31. package/components/p-da232b5d.js.map +0 -1
  32. package/dist/cjs/icon-88309350.js.map +0 -1
  33. package/dist/collection/components/icon/icons.js +0 -1258
  34. package/dist/collection/components/icon/icons.js.map +0 -1
  35. package/dist/esm/icon-4feff534.js.map +0 -1
  36. package/dist/ix-icons/p-08f117ce.entry.js +0 -2
  37. package/dist/ix-icons/p-588f84dc.js +0 -2
  38. package/dist/ix-icons/p-588f84dc.js.map +0 -1
  39. package/dist/types/components/icon/icons.d.ts +0 -1256
  40. /package/dist/ix-icons/{p-08f117ce.entry.js.map → p-ca4fc358.entry.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"file":"icon-4feff534.js","mappings":";;AAAA;;;;;SAKgB,iBAAiB;IAC/B,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,4BAA4B,CAAC,CAAC;IACvE,IAAI,SAAS,EAAE;QACb,MAAM,IAAI,GAAG,SAAS,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AACf;;ACbA;;;;;;;;AAiBA,IAAI,UAA+B,CAAC;AACpC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA2B,CAAC;AACpD,IAAI,MAAM,GAAG,IAAI,CAAC;AAEX,MAAM,eAAe,GAAG;IAC7B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,IAAI,GAAG,EAAE,CAAC;KAClB;IAED,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;QACtC,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,IAAI,GAAG,EAAE,CAAC;KACnE;IAED,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAEK,MAAM,YAAY,GAAG,CAAC,GAAW;IACtC,IAAI,CAAC,GAAG,EAAE;QACR,OAAO,KAAK,CAAC;KACd;IAED,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,OAAO,KAAK,CAAC;KACd;IAED,OAAO,GAAG,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAC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UAAU,EAAE,MAAM;aACnB,CACF,CAAC;YAEF,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SACpC;aAAM;YACL,QAAQ,EAAE,CAAC;SACZ;KACF;IAED,MAAM;QACJ,MAAM,KAAK,GAEP,EAAE,CAAC;QAEP,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,KAAK,CAAC,OAAO,CAAC,GAAG,eAAe,IAAI,CAAC,KAAK,GAAG,CAAC;SAC/C;QAED,QACE,EAAC,IAAI,qDACH,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE;gBACL,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI;gBAC/B,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI;gBAC/B,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI;gBAC/B,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI;aAChC,IAED,4DAAK,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,IAAI,CAAC,UAAU,GAAQ,CAC1D,EACP;KACH;;;;;;;;;;;","names":[],"sources":["src/components/icon/meta-tag.ts","src/components/icon/resolveIcon.ts","src/components/icon/icon.scss?tag=ix-icon&encapsulation=shadow","src/components/icon/icon.tsx"],"sourcesContent":["/**\n * Provide custom SVG path for icons\n *\n * <meta name=\"ix-icons:path\" content=\"/build/svg\" />\n */\nexport function getCustomAssetUrl() {\n const assetPath = document.querySelector(\"meta[name='ix-icons:path']\");\n if (assetPath) {\n const path = assetPath.getAttribute('content');\n return path;\n }\n\n return false;\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getAssetPath, setAssetPath } from '@stencil/core';\nimport { getCustomAssetUrl } from './meta-tag';\n\ndeclare global {\n interface Window {\n IxIcons: any;\n }\n}\n\nlet fetchCache: Map<string, string>;\nconst requests = new Map<string, Promise<string>>();\nlet parser = null;\n\nexport const getIconCacheMap = (): Map<string, string> => {\n if (typeof window === 'undefined') {\n return new Map();\n }\n\n if (!fetchCache) {\n window.IxIcons = window.IxIcons || {};\n fetchCache = window.IxIcons.map = window.IxIcons.map || new Map();\n }\n\n return fetchCache;\n};\n\nexport const isSvgDataUrl = (url: string) => {\n if (!url) {\n return false;\n }\n\n if (typeof url !== 'string') {\n return false;\n }\n\n return url.startsWith('data:image/svg+xml');\n};\n\nexport function parseSVGDataContent(content: string) {\n if (typeof window['DOMParser'] === 'undefined') {\n console.warn('DOMParser not supported by your browser.');\n return;\n }\n\n if (parser === null) {\n parser = new window['DOMParser']();\n }\n\n const svgDocument = parser.parseFromString(content, 'text/html');\n const svgElement = svgDocument.querySelector('svg') as HTMLElement;\n\n if (!svgElement) {\n throw Error('No valid svg data provided');\n }\n\n return svgElement.outerHTML;\n}\n\nasync function fetchSVG(url: string) {\n const cache = getIconCacheMap();\n\n if (cache.has(url)) {\n return cache.get(url);\n }\n\n if (requests.has(url)) {\n return requests.get(url);\n }\n\n const fetching = fetch(url).then(async response => {\n const responseText = await response.text();\n\n if (!response.ok) {\n console.error(responseText);\n throw Error(responseText);\n }\n\n const svgContent = parseSVGDataContent(responseText);\n cache.set(url, svgContent);\n\n requests.delete(url);\n\n return svgContent;\n });\n\n requests.set(url, fetching);\n return fetching;\n}\n\nconst urlRegex = /^(?:(?:https?|ftp):\\/\\/)?(?:\\S+(?::\\S*)?@)?(?:www\\.)?(?:\\S+\\.\\S+)(?:\\S*)$/i;\n\nfunction isValidUrl(url: string) {\n return urlRegex.test(url);\n}\n\nexport function getIconUrl(name: string) {\n const customAssetUrl = getCustomAssetUrl();\n\n if (customAssetUrl) {\n return `${customAssetUrl}/${name}.svg`;\n }\n\n let url: string = `svg/${name}.svg`;\n\n try {\n url = getAssetPath(url);\n } catch (error) {\n console.warn(error);\n setAssetPath(`${window.location.origin}/`);\n url = getAssetPath(url);\n }\n\n return url;\n}\n\nexport async function resolveIcon(iconName: string) {\n if (!iconName) {\n throw Error('No icon name provided');\n }\n\n if (isSvgDataUrl(iconName)) {\n return parseSVGDataContent(iconName);\n }\n\n return await loadIcon(iconName);\n}\n\nasync function loadIcon(iconName: string) {\n const cache = getIconCacheMap();\n\n if (cache.has(iconName)) {\n return cache.get(iconName);\n }\n\n if (isValidUrl(iconName)) {\n try {\n return fetchSVG(iconName);\n } catch (error) {\n throw error;\n }\n }\n\n try {\n return fetchSVG(getIconUrl(iconName));\n } catch (error) {\n throw Error(`Could not resolve ${iconName}`);\n }\n}\n\nfunction removePrefix(name: string, prefix: string) {\n if (name.startsWith(prefix)) {\n name = name.slice(prefix.length);\n return name.replace(/^(\\w)/, (_match, p1) => p1.toLowerCase());\n }\n\n return name;\n}\n\nexport function addIcons(icons: { [name: string]: any }) {\n Object.keys(icons).forEach(name => {\n const icon = icons[name];\n name = removePrefix(name, 'icon');\n\n addIconToCache(name, icon);\n });\n}\n\nexport function addIconToCache(name: string, icon: string) {\n const cache = getIconCacheMap();\n\n if (cache.has(name)) {\n console.warn(`Icon name '${name}' already in cache. Overwritting with new icon data.`);\n }\n\n const svg = parseSVGDataContent(icon);\n\n cache.set(name, svg);\n\n const toKebabCase = name.replace(/([a-z0-9]|(?=[A-Z]))([A-Z0-9])/g, '$1-$2').toLowerCase();\n\n if (name != toKebabCase) {\n cache.set(toKebabCase, svg);\n }\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n@mixin size($size) {\n height: $size;\n width: $size;\n min-height: $size;\n min-width: $size;\n}\n\n:host {\n display: inline-flex;\n @include size(1.5rem);\n color: inherit;\n\n .svg-container {\n display: block;\n position: relative;\n width: 100%;\n height: 100%;\n\n svg {\n display: block;\n position: relative;\n height: 100%;\n width: 100%;\n }\n\n svg,\n svg[fill],\n svg [fill] {\n fill: currentColor !important;\n }\n }\n}\n\n:host(.size-12) {\n @include size(0.75rem);\n}\n\n:host(.size-16) {\n @include size(1rem);\n}\n\n:host(.size-32) {\n @include size(2rem);\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Component, h, Host, Prop, State, Watch, Element, Build } from '@stencil/core';\nimport { parseSVGDataContent, resolveIcon } from './resolveIcon';\n\nconst iconMissingSymbol =\n \"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='512' height='512' viewBox='0 0 512 512'><path fill-rule='evenodd' d='M384,0 L384,384 L0,384 L0,0 L384,0 Z M192,207.085 L57.751,341.333 L326.248,341.333 L192,207.085 Z M42.666,57.751 L42.666,326.248 L176.915,192 L42.666,57.751 Z M341.333,57.751 L207.085,192 L341.333,326.248 L341.333,57.751 Z M326.248,42.666 L57.751,42.666 L192,176.915 L326.248,42.666 Z' transform='translate(64 64)'/></svg>\";\n\n@Component({\n tag: 'ix-icon',\n styleUrl: 'icon.scss',\n shadow: true,\n assetsDirs: ['svg'],\n})\nexport class Icon {\n @Element() hostElement: HTMLIxIconElement;\n\n /**\n * Size of the icon\n */\n @Prop() size: '12' | '16' | '24' | '32';\n\n /**\n * Color of the icon\n */\n @Prop() color: string;\n\n /**\n * Use one of our defined icon names e.g. `copy`\n *\n * https://ix.siemens.io/docs/icon-library/icons\n *\n * or the import variant\n *\n * ```\n * import { rocket } from '@siemens/ix-icons/icons';\n *\n * <ix-icon name={rocket}></ix-icon>\n * ```\n */\n @Prop() name: string;\n\n @Prop() lazyLoading = false;\n\n @State() svgContent?: string;\n @State() isVisible = false;\n\n componentWillLoad() {\n this.waitForRendering(() => {\n this.isVisible = true;\n this.loadIconContent();\n });\n }\n\n @Watch('name')\n async loadIconContent() {\n try {\n this.svgContent = await resolveIcon(this.name);\n } catch (error) {\n this.svgContent = parseSVGDataContent(iconMissingSymbol);\n }\n }\n\n private waitForRendering(onRender: () => void) {\n if (Build.isBrowser && this.lazyLoading && typeof window !== 'undefined' && (window as any).IntersectionObserver) {\n const observer = new IntersectionObserver(\n entries => {\n entries.forEach(entry => {\n if (entry.isIntersecting) {\n onRender();\n observer.disconnect();\n }\n });\n },\n {\n rootMargin: '25px',\n },\n );\n\n observer.observe(this.hostElement);\n } else {\n onRender();\n }\n }\n\n render() {\n const style: {\n [key: string]: string;\n } = {};\n\n if (this.color) {\n style['color'] = `var(--theme-${this.color})`;\n }\n\n return (\n <Host\n style={style}\n class={{\n ['size-12']: this.size === '12',\n ['size-16']: this.size === '16',\n ['size-24']: this.size === '24',\n ['size-32']: this.size === '32',\n }}\n >\n <div class={'svg-container'} innerHTML={this.svgContent}></div>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -1,2 +0,0 @@
1
- export{I as ix_icon}from"./p-588f84dc.js";import"./p-48b5ebf2.js";
2
- //# sourceMappingURL=p-08f117ce.entry.js.map
@@ -1,2 +0,0 @@
1
- import{g as t,a as n,r as e,h as i,H as r,c as s}from"./p-48b5ebf2.js";function o(){const t=document.querySelector("meta[name='ix-icons:path']");if(t){const n=t.getAttribute("content");return n}return false}let a;const c=new Map;let h=null;const f=()=>{if(typeof window==="undefined"){return new Map}if(!a){window.IxIcons=window.IxIcons||{};a=window.IxIcons.map=window.IxIcons.map||new Map}return a};const w=t=>{if(!t){return false}if(typeof t!=="string"){return false}return t.startsWith("data:image/svg+xml")};function d(t){if(typeof window["DOMParser"]==="undefined"){console.warn("DOMParser not supported by your browser.");return}if(h===null){h=new window["DOMParser"]}const n=h.parseFromString(t,"text/html");const e=n.querySelector("svg");if(!e){throw Error("No valid svg data provided")}return e.outerHTML}async function l(t){const n=f();if(n.has(t)){return n.get(t)}if(c.has(t)){return c.get(t)}const e=fetch(t).then((async e=>{const i=await e.text();if(!e.ok){console.error(i);throw Error(i)}const r=d(i);n.set(t,r);c.delete(t);return r}));c.set(t,e);return e}const u=/^(?:(?:https?|ftp):\/\/)?(?:\S+(?::\S*)?@)?(?:www\.)?(?:\S+\.\S+)(?:\S*)$/i;function g(t){return u.test(t)}function m(e){const i=o();if(i){return`${i}/${e}.svg`}let r=`svg/${e}.svg`;try{r=t(r)}catch(e){console.warn(e);n(`${window.location.origin}/`);r=t(r)}return r}async function v(t){if(!t){throw Error("No icon name provided")}if(w(t)){return d(t)}return await p(t)}async function p(t){const n=f();if(n.has(t)){return n.get(t)}if(g(t)){try{return l(t)}catch(t){throw t}}try{return l(m(t))}catch(n){throw Error(`Could not resolve ${t}`)}}function y(t,n){if(t.startsWith(n)){t=t.slice(n.length);return t.replace(/^(\w)/,((t,n)=>n.toLowerCase()))}return t}function L(t){Object.keys(t).forEach((n=>{const e=t[n];n=y(n,"icon");b(n,e)}))}function b(t,n){const e=f();if(e.has(t)){console.warn(`Icon name '${t}' already in cache. Overwritting with new icon data.`)}const i=d(n);e.set(t,i);const r=t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z0-9])/g,"$1-$2").toLowerCase();if(t!=r){e.set(r,i)}}const M=":host{display:inline-flex;height:1.5rem;width:1.5rem;min-height:1.5rem;min-width:1.5rem;color:inherit}:host .svg-container{display:block;position:relative;width:100%;height:100%}:host .svg-container svg{display:block;position:relative;height:100%;width:100%}:host .svg-container svg,:host .svg-container svg[fill],:host .svg-container svg [fill]{fill:currentColor !important}:host(.size-12){height:0.75rem;width:0.75rem;min-height:0.75rem;min-width:0.75rem}:host(.size-16){height:1rem;width:1rem;min-height:1rem;min-width:1rem}:host(.size-32){height:2rem;width:2rem;min-height:2rem;min-width:2rem}";const $=M;const x="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='512' height='512' viewBox='0 0 512 512'><path fill-rule='evenodd' d='M384,0 L384,384 L0,384 L0,0 L384,0 Z M192,207.085 L57.751,341.333 L326.248,341.333 L192,207.085 Z M42.666,57.751 L42.666,326.248 L176.915,192 L42.666,57.751 Z M341.333,57.751 L207.085,192 L341.333,326.248 L341.333,57.751 Z M326.248,42.666 L57.751,42.666 L192,176.915 L326.248,42.666 Z' transform='translate(64 64)'/></svg>";const z=class{constructor(t){e(this,t);this.lazyLoading=false;this.isVisible=false}componentWillLoad(){this.waitForRendering((()=>{this.isVisible=true;this.loadIconContent()}))}async loadIconContent(){try{this.svgContent=await v(this.name)}catch(t){this.svgContent=d(x)}}waitForRendering(t){if(this.lazyLoading&&typeof window!=="undefined"&&window.IntersectionObserver){const n=new IntersectionObserver((e=>{e.forEach((e=>{if(e.isIntersecting){t();n.disconnect()}}))}),{rootMargin:"25px"});n.observe(this.hostElement)}else{t()}}render(){const t={};if(this.color){t["color"]=`var(--theme-${this.color})`}return i(r,{key:"8dc18bf3b1ab1e2a521bd0fee33fa91b856dc52b",style:t,class:{["size-12"]:this.size==="12",["size-16"]:this.size==="16",["size-24"]:this.size==="24",["size-32"]:this.size==="32"}},i("div",{key:"48c3e8ae8e0d36be5fa112dbd408756f56c19535",class:"svg-container",innerHTML:this.svgContent}))}static get assetsDirs(){return["svg"]}get hostElement(){return s(this)}static get watchers(){return{name:["loadIconContent"]}}};z.style=$;export{z as I,L as a,b};
2
- //# sourceMappingURL=p-588f84dc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["getCustomAssetUrl","assetPath","document","querySelector","path","getAttribute","fetchCache","requests","Map","parser","getIconCacheMap","window","IxIcons","map","isSvgDataUrl","url","startsWith","parseSVGDataContent","content","console","warn","svgDocument","parseFromString","svgElement","Error","outerHTML","async","fetchSVG","cache","has","get","fetching","fetch","then","response","responseText","text","ok","error","svgContent","set","delete","urlRegex","isValidUrl","test","getIconUrl","name","customAssetUrl","getAssetPath","setAssetPath","location","origin","resolveIcon","iconName","loadIcon","removePrefix","prefix","slice","length","replace","_match","p1","toLowerCase","addIcons","icons","Object","keys","forEach","icon","addIconToCache","svg","toKebabCase","iconCss","IxIconStyle0","iconMissingSymbol","Icon","constructor","hostRef","this","lazyLoading","isVisible","componentWillLoad","waitForRendering","loadIconContent","onRender","IntersectionObserver","observer","entries","entry","isIntersecting","disconnect","rootMargin","observe","hostElement","render","style","color","h","Host","key","class","size","innerHTML"],"sources":["src/components/icon/meta-tag.ts","src/components/icon/resolveIcon.ts","src/components/icon/icon.scss?tag=ix-icon&encapsulation=shadow","src/components/icon/icon.tsx"],"sourcesContent":["/**\n * Provide custom SVG path for icons\n *\n * <meta name=\"ix-icons:path\" content=\"/build/svg\" />\n */\nexport function getCustomAssetUrl() {\n const assetPath = document.querySelector(\"meta[name='ix-icons:path']\");\n if (assetPath) {\n const path = assetPath.getAttribute('content');\n return path;\n }\n\n return false;\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getAssetPath, setAssetPath } from '@stencil/core';\nimport { getCustomAssetUrl } from './meta-tag';\n\ndeclare global {\n interface Window {\n IxIcons: any;\n }\n}\n\nlet fetchCache: Map<string, string>;\nconst requests = new Map<string, Promise<string>>();\nlet parser = null;\n\nexport const getIconCacheMap = (): Map<string, string> => {\n if (typeof window === 'undefined') {\n return new Map();\n }\n\n if (!fetchCache) {\n window.IxIcons = window.IxIcons || {};\n fetchCache = window.IxIcons.map = window.IxIcons.map || new Map();\n }\n\n return fetchCache;\n};\n\nexport const isSvgDataUrl = (url: string) => {\n if (!url) {\n return false;\n }\n\n if (typeof url !== 'string') {\n return false;\n }\n\n return url.startsWith('data:image/svg+xml');\n};\n\nexport function parseSVGDataContent(content: string) {\n if (typeof window['DOMParser'] === 'undefined') {\n console.warn('DOMParser not supported by your browser.');\n return;\n }\n\n if (parser === null) {\n parser = new window['DOMParser']();\n }\n\n const svgDocument = parser.parseFromString(content, 'text/html');\n const svgElement = svgDocument.querySelector('svg') as HTMLElement;\n\n if (!svgElement) {\n throw Error('No valid svg data provided');\n }\n\n return svgElement.outerHTML;\n}\n\nasync function fetchSVG(url: string) {\n const cache = getIconCacheMap();\n\n if (cache.has(url)) {\n return cache.get(url);\n }\n\n if (requests.has(url)) {\n return requests.get(url);\n }\n\n const fetching = fetch(url).then(async response => {\n const responseText = await response.text();\n\n if (!response.ok) {\n console.error(responseText);\n throw Error(responseText);\n }\n\n const svgContent = parseSVGDataContent(responseText);\n cache.set(url, svgContent);\n\n requests.delete(url);\n\n return svgContent;\n });\n\n requests.set(url, fetching);\n return fetching;\n}\n\nconst urlRegex = /^(?:(?:https?|ftp):\\/\\/)?(?:\\S+(?::\\S*)?@)?(?:www\\.)?(?:\\S+\\.\\S+)(?:\\S*)$/i;\n\nfunction isValidUrl(url: string) {\n return urlRegex.test(url);\n}\n\nexport function getIconUrl(name: string) {\n const customAssetUrl = getCustomAssetUrl();\n\n if (customAssetUrl) {\n return `${customAssetUrl}/${name}.svg`;\n }\n\n let url: string = `svg/${name}.svg`;\n\n try {\n url = getAssetPath(url);\n } catch (error) {\n console.warn(error);\n setAssetPath(`${window.location.origin}/`);\n url = getAssetPath(url);\n }\n\n return url;\n}\n\nexport async function resolveIcon(iconName: string) {\n if (!iconName) {\n throw Error('No icon name provided');\n }\n\n if (isSvgDataUrl(iconName)) {\n return parseSVGDataContent(iconName);\n }\n\n return await loadIcon(iconName);\n}\n\nasync function loadIcon(iconName: string) {\n const cache = getIconCacheMap();\n\n if (cache.has(iconName)) {\n return cache.get(iconName);\n }\n\n if (isValidUrl(iconName)) {\n try {\n return fetchSVG(iconName);\n } catch (error) {\n throw error;\n }\n }\n\n try {\n return fetchSVG(getIconUrl(iconName));\n } catch (error) {\n throw Error(`Could not resolve ${iconName}`);\n }\n}\n\nfunction removePrefix(name: string, prefix: string) {\n if (name.startsWith(prefix)) {\n name = name.slice(prefix.length);\n return name.replace(/^(\\w)/, (_match, p1) => p1.toLowerCase());\n }\n\n return name;\n}\n\nexport function addIcons(icons: { [name: string]: any }) {\n Object.keys(icons).forEach(name => {\n const icon = icons[name];\n name = removePrefix(name, 'icon');\n\n addIconToCache(name, icon);\n });\n}\n\nexport function addIconToCache(name: string, icon: string) {\n const cache = getIconCacheMap();\n\n if (cache.has(name)) {\n console.warn(`Icon name '${name}' already in cache. Overwritting with new icon data.`);\n }\n\n const svg = parseSVGDataContent(icon);\n\n cache.set(name, svg);\n\n const toKebabCase = name.replace(/([a-z0-9]|(?=[A-Z]))([A-Z0-9])/g, '$1-$2').toLowerCase();\n\n if (name != toKebabCase) {\n cache.set(toKebabCase, svg);\n }\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n@mixin size($size) {\n height: $size;\n width: $size;\n min-height: $size;\n min-width: $size;\n}\n\n:host {\n display: inline-flex;\n @include size(1.5rem);\n color: inherit;\n\n .svg-container {\n display: block;\n position: relative;\n width: 100%;\n height: 100%;\n\n svg {\n display: block;\n position: relative;\n height: 100%;\n width: 100%;\n }\n\n svg,\n svg[fill],\n svg [fill] {\n fill: currentColor !important;\n }\n }\n}\n\n:host(.size-12) {\n @include size(0.75rem);\n}\n\n:host(.size-16) {\n @include size(1rem);\n}\n\n:host(.size-32) {\n @include size(2rem);\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Component, h, Host, Prop, State, Watch, Element, Build } from '@stencil/core';\nimport { parseSVGDataContent, resolveIcon } from './resolveIcon';\n\nconst iconMissingSymbol =\n \"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='512' height='512' viewBox='0 0 512 512'><path fill-rule='evenodd' d='M384,0 L384,384 L0,384 L0,0 L384,0 Z M192,207.085 L57.751,341.333 L326.248,341.333 L192,207.085 Z M42.666,57.751 L42.666,326.248 L176.915,192 L42.666,57.751 Z M341.333,57.751 L207.085,192 L341.333,326.248 L341.333,57.751 Z M326.248,42.666 L57.751,42.666 L192,176.915 L326.248,42.666 Z' transform='translate(64 64)'/></svg>\";\n\n@Component({\n tag: 'ix-icon',\n styleUrl: 'icon.scss',\n shadow: true,\n assetsDirs: ['svg'],\n})\nexport class Icon {\n @Element() hostElement: HTMLIxIconElement;\n\n /**\n * Size of the icon\n */\n @Prop() size: '12' | '16' | '24' | '32';\n\n /**\n * Color of the icon\n */\n @Prop() color: string;\n\n /**\n * Use one of our defined icon names e.g. `copy`\n *\n * https://ix.siemens.io/docs/icon-library/icons\n *\n * or the import variant\n *\n * ```\n * import { rocket } from '@siemens/ix-icons/icons';\n *\n * <ix-icon name={rocket}></ix-icon>\n * ```\n */\n @Prop() name: string;\n\n @Prop() lazyLoading = false;\n\n @State() svgContent?: string;\n @State() isVisible = false;\n\n componentWillLoad() {\n this.waitForRendering(() => {\n this.isVisible = true;\n this.loadIconContent();\n });\n }\n\n @Watch('name')\n async loadIconContent() {\n try {\n this.svgContent = await resolveIcon(this.name);\n } catch (error) {\n this.svgContent = parseSVGDataContent(iconMissingSymbol);\n }\n }\n\n private waitForRendering(onRender: () => void) {\n if (Build.isBrowser && this.lazyLoading && typeof window !== 'undefined' && (window as any).IntersectionObserver) {\n const observer = new IntersectionObserver(\n entries => {\n entries.forEach(entry => {\n if (entry.isIntersecting) {\n onRender();\n observer.disconnect();\n }\n });\n },\n {\n rootMargin: '25px',\n },\n );\n\n observer.observe(this.hostElement);\n } else {\n onRender();\n }\n }\n\n render() {\n const style: {\n [key: string]: string;\n } = {};\n\n if (this.color) {\n style['color'] = `var(--theme-${this.color})`;\n }\n\n return (\n <Host\n style={style}\n class={{\n ['size-12']: this.size === '12',\n ['size-16']: this.size === '16',\n ['size-24']: this.size === '24',\n ['size-32']: this.size === '32',\n }}\n >\n <div class={'svg-container'} innerHTML={this.svgContent}></div>\n </Host>\n );\n }\n}\n"],"mappings":"gFAKgBA,IACd,MAAMC,EAAYC,SAASC,cAAc,8BACzC,GAAIF,EAAW,CACb,MAAMG,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