@siemens/ix-icons 0.0.0-20240827135516 → 0.0.0-20250114162200

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 (73) hide show
  1. package/README.md +19 -2
  2. package/components/icon.js +9 -2
  3. package/components/icon.js.map +1 -1
  4. package/components/index.js +1 -1
  5. package/dist/cjs/{icon-93104dbb.js → icon-7938bd17.js} +11 -3
  6. package/dist/cjs/icon-7938bd17.js.map +1 -0
  7. package/dist/cjs/index-12b9d30e.js +1221 -0
  8. package/dist/cjs/index-12b9d30e.js.map +1 -0
  9. package/dist/cjs/index.cjs.js +3 -2
  10. package/dist/cjs/index.cjs.js.map +1 -1
  11. package/dist/cjs/ix-icon.cjs.entry.js +2 -2
  12. package/dist/cjs/ix-icons.cjs.js +9 -9
  13. package/dist/cjs/ix-icons.cjs.js.map +1 -1
  14. package/dist/cjs/loader.cjs.js +1 -1
  15. package/dist/collection/collection-manifest.json +2 -2
  16. package/dist/collection/components/icon/resolveIcon.js +8 -1
  17. package/dist/collection/components/icon/resolveIcon.js.map +1 -1
  18. package/dist/collection/components/icon/test/{rocker-example.js → rocket-example.js} +1 -1
  19. package/dist/collection/components/icon/test/{rocker-example.js.map → rocket-example.js.map} +1 -1
  20. package/dist/collection/index.js +1 -0
  21. package/dist/collection/index.js.map +1 -1
  22. package/dist/esm/{icon-97776d4a.js → icon-7346da2f.js} +11 -4
  23. package/dist/esm/icon-7346da2f.js.map +1 -0
  24. package/dist/esm/index-05493327.js +1191 -0
  25. package/dist/esm/index-05493327.js.map +1 -0
  26. package/dist/esm/index.js +2 -2
  27. package/dist/esm/ix-icon.entry.js +2 -2
  28. package/dist/esm/ix-icons.js +10 -10
  29. package/dist/esm/ix-icons.js.map +1 -1
  30. package/dist/esm/loader.js +2 -2
  31. package/dist/ix-icons/index.esm.js +1 -1
  32. package/dist/ix-icons/index.esm.js.map +1 -1
  33. package/dist/ix-icons/ix-icons.esm.js +1 -1
  34. package/dist/ix-icons/ix-icons.esm.js.map +1 -1
  35. package/dist/ix-icons/p-07c8bd06.entry.js +2 -0
  36. package/dist/ix-icons/p-07c8bd06.entry.js.map +1 -0
  37. package/dist/ix-icons/p-20132e89.js +3 -0
  38. package/dist/ix-icons/p-20132e89.js.map +1 -0
  39. package/dist/ix-icons/p-daba5432.js +2 -0
  40. package/dist/ix-icons/p-daba5432.js.map +1 -0
  41. package/dist/ix-icons/p-e1255160.js.map +1 -1
  42. package/dist/types/components/icon/resolveIcon.d.ts +1 -0
  43. package/dist/types/index.d.ts +1 -0
  44. package/dist/types/stencil-public-runtime.d.ts +3 -10
  45. package/icons/package.json +1 -1
  46. package/loader/cdn.js +1 -3
  47. package/loader/index.cjs.js +1 -3
  48. package/loader/index.d.ts +3 -0
  49. package/loader/index.es2017.js +1 -3
  50. package/loader/index.js +1 -3
  51. package/package.json +2 -2
  52. package/dist/cjs/icon-93104dbb.js.map +0 -1
  53. package/dist/cjs/index-8f585802.js +0 -1810
  54. package/dist/cjs/index-8f585802.js.map +0 -1
  55. package/dist/collection/components/icon/test/ix-icon.spec.js +0 -61
  56. package/dist/collection/components/icon/test/ix-icon.spec.js.map +0 -1
  57. package/dist/collection/components/icon/test/resolveIcon.spec.js +0 -88
  58. package/dist/collection/components/icon/test/resolveIcon.spec.js.map +0 -1
  59. package/dist/esm/icon-97776d4a.js.map +0 -1
  60. package/dist/esm/index-d1072d3f.js +0 -1780
  61. package/dist/esm/index-d1072d3f.js.map +0 -1
  62. package/dist/esm/polyfills/core-js.js +0 -11
  63. package/dist/esm/polyfills/dom.js +0 -79
  64. package/dist/esm/polyfills/es5-html-element.js +0 -1
  65. package/dist/esm/polyfills/index.js +0 -34
  66. package/dist/esm/polyfills/system.js +0 -6
  67. package/dist/ix-icons/p-05455ad0.js +0 -3
  68. package/dist/ix-icons/p-05455ad0.js.map +0 -1
  69. package/dist/ix-icons/p-60aebf69.entry.js +0 -2
  70. package/dist/ix-icons/p-60aebf69.entry.js.map +0 -1
  71. package/dist/ix-icons/p-cf592f05.js +0 -2
  72. package/dist/ix-icons/p-cf592f05.js.map +0 -1
  73. /package/dist/types/components/icon/test/{rocker-example.d.ts → rocket-example.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"rocker-example.js","sourceRoot":"","sources":["../../../../src/components/icon/test/rocker-example.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GACjB,sxDAAsxD,CAAC","sourcesContent":["/*\n * COPYRIGHT (c) Siemens AG 2018-2023 ALL RIGHTS RESERVED.\n */\nexport const rocket =\n \"data:image/svg+xml;utf8,<?xml version='1.0' encoding='UTF-8'?><svg width='512px' height='512px' viewBox='0 0 512 512' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'><g id='Page-1' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'><g id='icon' transform='translate(42.666667, 64.000000)'><path d='M405.333333,1.42108547e-14 C396.316305,122.794806 364.316305,211.683695 309.333333,266.666667 C299.582265,276.417735 288.905446,285.33185 277.302879,293.409011 L277.302464,341.234872 L213.302464,405.234872 L174.248,336.891 L68.525,231.157 L7.10542736e-15,192 L64,128 L112.079613,128.000404 C120.083859,116.387258 128.94621,105.720457 138.666667,96 C193.649638,41.0170286 282.538527,9.01702859 405.333333,1.42108547e-14 Z M357.333333,47.9786667 L348.203556,49.3631108 C266.32942,62.2476147 206.763982,88.2424635 168.836556,126.169889 C146.004433,149.002012 128.637057,178.732412 116.876114,215.881246 L116.096,218.389333 L187.584,289.877333 L191.120585,288.76541 C224.531258,277.548675 251.975141,261.807487 273.818948,241.632769 L279.163444,236.496777 C317.09087,198.569351 343.085719,139.003914 355.970222,57.1297769 L357.333333,47.9786667 Z M75.9901363,269.368015 L30.7353023,314.622849 L0.565412939,284.452959 L45.8202469,239.198125 L75.9901363,269.368015 Z M121.24497,314.622849 L45.8202469,390.047572 L15.6503576,359.877683 L91.0750809,284.452959 L121.24497,314.622849 Z M136.329915,329.707793 L166.499804,359.877683 L121.24497,405.132517 L91.0750809,374.962627 L136.329915,329.707793 Z M245.333333,128 C263.006445,128 277.333333,142.326888 277.333333,160 C277.333333,177.673112 263.006445,192 245.333333,192 C227.660221,192 213.333333,177.673112 213.333333,160 C213.333333,142.326888 227.660221,128 245.333333,128 Z' id='Combined-Shape'/></g></g></svg>\";\n"]}
1
+ {"version":3,"file":"rocket-example.js","sourceRoot":"","sources":["../../../../src/components/icon/test/rocket-example.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GACjB,sxDAAsxD,CAAC","sourcesContent":["/*\n * COPYRIGHT (c) Siemens AG 2018-2023 ALL RIGHTS RESERVED.\n */\nexport const rocket =\n \"data:image/svg+xml;utf8,<?xml version='1.0' encoding='UTF-8'?><svg width='512px' height='512px' viewBox='0 0 512 512' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'><g id='Page-1' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'><g id='icon' transform='translate(42.666667, 64.000000)'><path d='M405.333333,1.42108547e-14 C396.316305,122.794806 364.316305,211.683695 309.333333,266.666667 C299.582265,276.417735 288.905446,285.33185 277.302879,293.409011 L277.302464,341.234872 L213.302464,405.234872 L174.248,336.891 L68.525,231.157 L7.10542736e-15,192 L64,128 L112.079613,128.000404 C120.083859,116.387258 128.94621,105.720457 138.666667,96 C193.649638,41.0170286 282.538527,9.01702859 405.333333,1.42108547e-14 Z M357.333333,47.9786667 L348.203556,49.3631108 C266.32942,62.2476147 206.763982,88.2424635 168.836556,126.169889 C146.004433,149.002012 128.637057,178.732412 116.876114,215.881246 L116.096,218.389333 L187.584,289.877333 L191.120585,288.76541 C224.531258,277.548675 251.975141,261.807487 273.818948,241.632769 L279.163444,236.496777 C317.09087,198.569351 343.085719,139.003914 355.970222,57.1297769 L357.333333,47.9786667 Z M75.9901363,269.368015 L30.7353023,314.622849 L0.565412939,284.452959 L45.8202469,239.198125 L75.9901363,269.368015 Z M121.24497,314.622849 L45.8202469,390.047572 L15.6503576,359.877683 L91.0750809,284.452959 L121.24497,314.622849 Z M136.329915,329.707793 L166.499804,359.877683 L121.24497,405.132517 L91.0750809,374.962627 L136.329915,329.707793 Z M245.333333,128 C263.006445,128 277.333333,142.326888 277.333333,160 C277.333333,177.673112 263.006445,192 245.333333,192 C227.660221,192 213.333333,177.673112 213.333333,160 C213.333333,142.326888 227.660221,128 245.333333,128 Z' id='Combined-Shape'/></g></g></svg>\";\n"]}
@@ -1,3 +1,4 @@
1
1
  export * from './components/icon/icon';
2
+ export { loadIcons } from './components/icon/resolveIcon';
2
3
  export { setAssetPath } from '@stencil/core';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export type { Components, JSX } from './components';\nexport * from './components/icon/icon';\nexport { setAssetPath } from '@stencil/core';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export type { Components, JSX } from './components';\nexport * from './components/icon/icon';\nexport { loadIcons } from './components/icon/resolveIcon';\nexport { setAssetPath } from '@stencil/core';\n"]}
@@ -1,4 +1,4 @@
1
- import { g as getAssetPath, a as setAssetPath, r as registerInstance, h, H as Host, c as getElement } from './index-d1072d3f.js';
1
+ import { g as getAssetPath, a as setAssetPath, r as registerInstance, h, H as Host, c as getElement } from './index-05493327.js';
2
2
 
3
3
  /**
4
4
  * Provide custom SVG path for icons
@@ -75,6 +75,7 @@ async function fetchSVG(url) {
75
75
  }
76
76
  const svgContent = parseSVGDataContent(responseText);
77
77
  cache.set(url, svgContent);
78
+ requests.delete(url);
78
79
  return svgContent;
79
80
  });
80
81
  requests.set(url, fetching);
@@ -107,6 +108,9 @@ async function resolveIcon(iconName) {
107
108
  if (isSvgDataUrl(iconName)) {
108
109
  return parseSVGDataContent(iconName);
109
110
  }
111
+ return await loadIcon(iconName);
112
+ }
113
+ async function loadIcon(iconName) {
110
114
  if (isValidUrl(iconName)) {
111
115
  try {
112
116
  return fetchSVG(iconName);
@@ -119,9 +123,12 @@ async function resolveIcon(iconName) {
119
123
  return fetchSVG(getIconUrl(iconName));
120
124
  }
121
125
  catch (error) {
122
- throw Error('Cannot resolve any icon');
126
+ throw Error(`Could not resolve ${iconName}`);
123
127
  }
124
128
  }
129
+ function loadIcons(icons) {
130
+ icons.map(icon => loadIcon(icon));
131
+ }
125
132
 
126
133
  const iconCss = ":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}";
127
134
  const IxIconStyle0 = iconCss;
@@ -189,6 +196,6 @@ const Icon = class {
189
196
  };
190
197
  Icon.style = IxIconStyle0;
191
198
 
192
- export { Icon as I };
199
+ export { Icon as I, loadIcons as l };
193
200
 
194
- //# sourceMappingURL=icon-97776d4a.js.map
201
+ //# sourceMappingURL=icon-7346da2f.js.map
@@ -0,0 +1 @@
1
+ {"file":"icon-7346da2f.js","mappings":";;AAAA;;;;;SAKgB,iBAAiB;IAC/B,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,4BAA4B,CAA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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 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\nexport function loadIcons(icons: string[]) {\n icons.map(icon => loadIcon(icon));\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 connectedCallback() {\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}