@vaadin/icon 23.1.0 → 23.2.0-dev.53560527d
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 +5 -5
- package/src/vaadin-icon.js +10 -4
- package/src/vaadin-iconset.d.ts +1 -1
- package/src/vaadin-iconset.js +6 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/icon",
|
|
3
|
-
"version": "23.
|
|
3
|
+
"version": "23.2.0-dev.53560527d",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@polymer/polymer": "^3.0.0",
|
|
36
|
-
"@vaadin/component-base": "
|
|
37
|
-
"@vaadin/vaadin-lumo-styles": "
|
|
38
|
-
"@vaadin/vaadin-themable-mixin": "
|
|
36
|
+
"@vaadin/component-base": "23.2.0-dev.53560527d",
|
|
37
|
+
"@vaadin/vaadin-lumo-styles": "23.2.0-dev.53560527d",
|
|
38
|
+
"@vaadin/vaadin-themable-mixin": "23.2.0-dev.53560527d",
|
|
39
39
|
"lit": "^2.0.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@vaadin/testing-helpers": "^0.3.2"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "6c5c18369b09e22e76365d8a8a5e4bbb220f969b"
|
|
45
45
|
}
|
package/src/vaadin-icon.js
CHANGED
|
@@ -83,7 +83,7 @@ class Icon extends ThemableMixin(ElementMixin(PolymerElement)) {
|
|
|
83
83
|
version="1.1"
|
|
84
84
|
xmlns="http://www.w3.org/2000/svg"
|
|
85
85
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
86
|
-
viewBox="[[__computeViewBox(size)]]"
|
|
86
|
+
viewBox="[[__computeViewBox(size, __viewBox)]]"
|
|
87
87
|
preserveAspectRatio="xMidYMid meet"
|
|
88
88
|
aria-hidden="true"
|
|
89
89
|
></svg>
|
|
@@ -128,6 +128,9 @@ class Icon extends ThemableMixin(ElementMixin(PolymerElement)) {
|
|
|
128
128
|
|
|
129
129
|
/** @private */
|
|
130
130
|
__svgElement: Object,
|
|
131
|
+
|
|
132
|
+
/** @private */
|
|
133
|
+
__viewBox: String,
|
|
131
134
|
};
|
|
132
135
|
}
|
|
133
136
|
|
|
@@ -181,7 +184,10 @@ class Icon extends ThemableMixin(ElementMixin(PolymerElement)) {
|
|
|
181
184
|
this.__checkDeprecatedIcon(icon);
|
|
182
185
|
const iconsetName = this.__getIconsetName(icon);
|
|
183
186
|
const iconset = Iconset.getIconset(iconsetName);
|
|
184
|
-
const { svg, size } = iconset.applyIcon(icon);
|
|
187
|
+
const { svg, size, viewBox } = iconset.applyIcon(icon);
|
|
188
|
+
if (viewBox) {
|
|
189
|
+
this.__viewBox = viewBox;
|
|
190
|
+
}
|
|
185
191
|
if (size !== this.size) {
|
|
186
192
|
this.size = size;
|
|
187
193
|
}
|
|
@@ -215,8 +221,8 @@ class Icon extends ThemableMixin(ElementMixin(PolymerElement)) {
|
|
|
215
221
|
}
|
|
216
222
|
|
|
217
223
|
/** @private */
|
|
218
|
-
__computeViewBox(size) {
|
|
219
|
-
return `0 0 ${size} ${size}`;
|
|
224
|
+
__computeViewBox(size, viewBox) {
|
|
225
|
+
return viewBox || `0 0 ${size} ${size}`;
|
|
220
226
|
}
|
|
221
227
|
}
|
|
222
228
|
|
package/src/vaadin-iconset.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ declare class Iconset extends ElementMixin(HTMLElement) {
|
|
|
35
35
|
* Produce SVGTemplateResult for the element matching `name` in this
|
|
36
36
|
* iconset, or `undefined` if there is no matching element.
|
|
37
37
|
*/
|
|
38
|
-
applyIcon(name: string): { svg: IconSvgLiteral; size: number };
|
|
38
|
+
applyIcon(name: string): { svg: IconSvgLiteral; size: number; viewBox: string | null };
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
declare global {
|
package/src/vaadin-iconset.js
CHANGED
|
@@ -82,7 +82,12 @@ class Iconset extends ElementMixin(PolymerElement) {
|
|
|
82
82
|
// Create the icon map on-demand, since the iconset itself has no discrete
|
|
83
83
|
// signal to know when it's children are fully parsed
|
|
84
84
|
this._icons = this._icons || this.__createIconMap();
|
|
85
|
-
|
|
85
|
+
const icon = this._icons[this.__getIconId(name)];
|
|
86
|
+
return {
|
|
87
|
+
svg: cloneSvgNode(icon),
|
|
88
|
+
size: this.size,
|
|
89
|
+
viewBox: icon ? icon.getAttribute('viewBox') : null,
|
|
90
|
+
};
|
|
86
91
|
}
|
|
87
92
|
|
|
88
93
|
/**
|