@siemens/ix-icons 0.0.0-pr-69-20250205144920 → 0.0.0-v3-preview-20250130095430
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/README.md +17 -46
- package/components/icon.js +252 -0
- package/components/icon.js.map +1 -0
- package/components/index.js +2 -1
- package/components/index.js.map +1 -1
- package/components/ix-icon.js +1 -1
- package/dist/cjs/{icon-319056c0.js → icon-2c9dc943.js} +56 -62
- package/dist/cjs/icon-2c9dc943.js.map +1 -0
- package/dist/cjs/{index-f6043fa9.js → index-ea94711c.js} +70 -178
- package/dist/cjs/index-ea94711c.js.map +1 -0
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/ix-icon.cjs.entry.js +2 -2
- package/dist/cjs/ix-icons.cjs.js +2 -2
- package/dist/cjs/ix-icons.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/icon/icon.js +19 -31
- package/dist/collection/components/icon/icon.js.map +1 -1
- package/dist/collection/components/icon/icons.js +1258 -0
- package/dist/collection/components/icon/icons.js.map +1 -0
- package/dist/collection/components/icon/resolveIcon.js +43 -26
- package/dist/collection/components/icon/resolveIcon.js.map +1 -1
- package/dist/esm/{icon-fc868c56.js → icon-e3f6595d.js} +56 -62
- package/dist/esm/icon-e3f6595d.js.map +1 -0
- package/dist/esm/{index-051cb4f1.js → index-050dd9d6.js} +70 -178
- package/dist/esm/index-050dd9d6.js.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/ix-icon.entry.js +2 -2
- package/dist/esm/ix-icons.js +3 -3
- package/dist/esm/ix-icons.js.map +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/ix-icons/index.esm.js +1 -1
- package/dist/ix-icons/ix-icons.esm.js +1 -1
- package/dist/ix-icons/ix-icons.esm.js.map +1 -1
- package/dist/ix-icons/p-0194ffaa.js +3 -0
- package/dist/ix-icons/p-0194ffaa.js.map +1 -0
- package/dist/ix-icons/p-196f504a.js +2 -0
- package/dist/ix-icons/p-196f504a.js.map +1 -0
- package/dist/ix-icons/p-45457b43.entry.js +2 -0
- package/dist/types/components/icon/icon.d.ts +2 -5
- package/dist/types/components/icon/icons.d.ts +1256 -0
- package/dist/types/components/icon/meta-tag.d.ts +1 -1
- package/dist/types/components/icon/resolveIcon.d.ts +2 -1
- package/dist/types/components.d.ts +2 -8
- package/dist/types/stencil-public-runtime.d.ts +0 -6
- package/icons/package.json +1 -1
- package/package.json +2 -2
- package/components/p-187634d0.js +0 -1363
- package/components/p-187634d0.js.map +0 -1
- package/dist/cjs/icon-319056c0.js.map +0 -1
- package/dist/cjs/index-f6043fa9.js.map +0 -1
- package/dist/collection/components/icon/parser.js +0 -22
- package/dist/collection/components/icon/parser.js.map +0 -1
- package/dist/esm/icon-fc868c56.js.map +0 -1
- package/dist/esm/index-051cb4f1.js.map +0 -1
- package/dist/ix-icons/p-423803cb.js +0 -2
- package/dist/ix-icons/p-423803cb.js.map +0 -1
- package/dist/ix-icons/p-48b5ebf2.js +0 -3
- package/dist/ix-icons/p-48b5ebf2.js.map +0 -1
- package/dist/ix-icons/p-ca4fc358.entry.js +0 -2
- package/dist/sample.json +0 -1259
- package/dist/types/components/icon/parser.d.ts +0 -2
- /package/dist/ix-icons/{p-ca4fc358.entry.js.map → p-45457b43.entry.js.map} +0 -0
|
@@ -7,18 +7,15 @@
|
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
9
|
import { h, Host, Build } from "@stencil/core";
|
|
10
|
-
import { resolveIcon } from "./resolveIcon";
|
|
11
|
-
|
|
10
|
+
import { parseSVGDataContent, resolveIcon } from "./resolveIcon";
|
|
11
|
+
const iconMissingSymbol = "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>";
|
|
12
12
|
export class Icon {
|
|
13
13
|
constructor() {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
this.size = '24';
|
|
18
|
-
/**
|
|
19
|
-
* Only fetch and parse svg data when icon is visible
|
|
20
|
-
*/
|
|
14
|
+
this.size = undefined;
|
|
15
|
+
this.color = undefined;
|
|
16
|
+
this.name = undefined;
|
|
21
17
|
this.lazyLoading = false;
|
|
18
|
+
this.svgContent = undefined;
|
|
22
19
|
this.isVisible = false;
|
|
23
20
|
}
|
|
24
21
|
componentWillLoad() {
|
|
@@ -28,12 +25,12 @@ export class Icon {
|
|
|
28
25
|
});
|
|
29
26
|
}
|
|
30
27
|
async loadIconContent() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
try {
|
|
29
|
+
this.svgContent = await resolveIcon(this.name);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
this.svgContent = parseSVGDataContent(iconMissingSymbol);
|
|
35
33
|
}
|
|
36
|
-
this.svgContent = content;
|
|
37
34
|
}
|
|
38
35
|
waitForRendering(onRender) {
|
|
39
36
|
if (Build.isBrowser && this.lazyLoading && typeof window !== 'undefined' && window.IntersectionObserver) {
|
|
@@ -58,12 +55,12 @@ export class Icon {
|
|
|
58
55
|
if (this.color) {
|
|
59
56
|
style['color'] = `var(--theme-${this.color})`;
|
|
60
57
|
}
|
|
61
|
-
return (h(Host, { key: '
|
|
58
|
+
return (h(Host, { key: '8dc18bf3b1ab1e2a521bd0fee33fa91b856dc52b', style: style, class: {
|
|
62
59
|
['size-12']: this.size === '12',
|
|
63
60
|
['size-16']: this.size === '16',
|
|
64
61
|
['size-24']: this.size === '24',
|
|
65
62
|
['size-32']: this.size === '32',
|
|
66
|
-
} }, h("div", { key: '
|
|
63
|
+
} }, h("div", { key: '48c3e8ae8e0d36be5fa112dbd408756f56c19535', class: 'svg-container', innerHTML: this.svgContent })));
|
|
67
64
|
}
|
|
68
65
|
static get is() { return "ix-icon"; }
|
|
69
66
|
static get encapsulation() { return "shadow"; }
|
|
@@ -94,28 +91,23 @@ export class Icon {
|
|
|
94
91
|
"tags": [],
|
|
95
92
|
"text": "Size of the icon"
|
|
96
93
|
},
|
|
97
|
-
"getter": false,
|
|
98
|
-
"setter": false,
|
|
99
94
|
"attribute": "size",
|
|
100
|
-
"reflect": false
|
|
101
|
-
"defaultValue": "'24'"
|
|
95
|
+
"reflect": false
|
|
102
96
|
},
|
|
103
97
|
"color": {
|
|
104
98
|
"type": "string",
|
|
105
99
|
"mutable": false,
|
|
106
100
|
"complexType": {
|
|
107
101
|
"original": "string",
|
|
108
|
-
"resolved": "string
|
|
102
|
+
"resolved": "string",
|
|
109
103
|
"references": {}
|
|
110
104
|
},
|
|
111
105
|
"required": false,
|
|
112
|
-
"optional":
|
|
106
|
+
"optional": false,
|
|
113
107
|
"docs": {
|
|
114
108
|
"tags": [],
|
|
115
109
|
"text": "Color of the icon"
|
|
116
110
|
},
|
|
117
|
-
"getter": false,
|
|
118
|
-
"setter": false,
|
|
119
111
|
"attribute": "color",
|
|
120
112
|
"reflect": false
|
|
121
113
|
},
|
|
@@ -124,17 +116,15 @@ export class Icon {
|
|
|
124
116
|
"mutable": false,
|
|
125
117
|
"complexType": {
|
|
126
118
|
"original": "string",
|
|
127
|
-
"resolved": "string
|
|
119
|
+
"resolved": "string",
|
|
128
120
|
"references": {}
|
|
129
121
|
},
|
|
130
122
|
"required": false,
|
|
131
|
-
"optional":
|
|
123
|
+
"optional": false,
|
|
132
124
|
"docs": {
|
|
133
125
|
"tags": [],
|
|
134
126
|
"text": "Use one of our defined icon names e.g. `copy`\n\nhttps://ix.siemens.io/docs/icon-library/icons\n\nor the import variant\n\n```\nimport { rocket } from '@siemens/ix-icons/icons';\n\n<ix-icon name={rocket}></ix-icon>\n```"
|
|
135
127
|
},
|
|
136
|
-
"getter": false,
|
|
137
|
-
"setter": false,
|
|
138
128
|
"attribute": "name",
|
|
139
129
|
"reflect": false
|
|
140
130
|
},
|
|
@@ -150,10 +140,8 @@ export class Icon {
|
|
|
150
140
|
"optional": false,
|
|
151
141
|
"docs": {
|
|
152
142
|
"tags": [],
|
|
153
|
-
"text": "
|
|
143
|
+
"text": ""
|
|
154
144
|
},
|
|
155
|
-
"getter": false,
|
|
156
|
-
"setter": false,
|
|
157
145
|
"attribute": "lazy-loading",
|
|
158
146
|
"reflect": false,
|
|
159
147
|
"defaultValue": "false"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.js","sourceRoot":"","sources":["../../../src/components/icon/icon.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"icon.js","sourceRoot":"","sources":["../../../src/components/icon/icon.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACvF,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjE,MAAM,iBAAiB,GACrB,gdAAgd,CAAC;AAQnd,MAAM,OAAO,IAAI;;;;;2BA4BO,KAAK;;yBAGN,KAAK;;IAE1B,iBAAiB;QACf,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE;YACzB,IAAI,CA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,KAAK,IAAI;gBAC/B,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,IAAI,KAAK,IAAI;gBAC/B,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,IAAI,KAAK,IAAI;gBAC/B,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,IAAI,KAAK,IAAI;aAChC;YAED,4DAAK,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,IAAI,CAAC,UAAU,GAAQ,CAC1D,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["/*\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"]}
|