@vaadin/icon 22.0.15 → 22.0.18

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": "@vaadin/icon",
3
- "version": "22.0.15",
3
+ "version": "22.0.18",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,13 +32,13 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "@polymer/polymer": "^3.0.0",
35
- "@vaadin/component-base": "^22.0.15",
36
- "@vaadin/vaadin-lumo-styles": "^22.0.15",
37
- "@vaadin/vaadin-themable-mixin": "^22.0.15",
35
+ "@vaadin/component-base": "^22.0.18",
36
+ "@vaadin/vaadin-lumo-styles": "^22.0.18",
37
+ "@vaadin/vaadin-themable-mixin": "^22.0.18",
38
38
  "lit": "^2.0.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@vaadin/testing-helpers": "^0.3.2"
42
42
  },
43
- "gitHead": "bba021b56ba45da93d2bb980242956ad929ecfe2"
43
+ "gitHead": "8f5d45192adbb084661af01c8837d0898cd68a23"
44
44
  }
@@ -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
 
@@ -179,7 +182,10 @@ class Icon extends ThemableMixin(ElementMixin(PolymerElement)) {
179
182
  this.__checkDeprecatedIcon(icon);
180
183
  const iconsetName = this.__getIconsetName(icon);
181
184
  const iconset = Iconset.getIconset(iconsetName);
182
- const { svg, size } = iconset.applyIcon(icon);
185
+ const { svg, size, viewBox } = iconset.applyIcon(icon);
186
+ if (viewBox) {
187
+ this.__viewBox = viewBox;
188
+ }
183
189
  if (size !== this.size) {
184
190
  this.size = size;
185
191
  }
@@ -213,8 +219,8 @@ class Icon extends ThemableMixin(ElementMixin(PolymerElement)) {
213
219
  }
214
220
 
215
221
  /** @private */
216
- __computeViewBox(size) {
217
- return `0 0 ${size} ${size}`;
222
+ __computeViewBox(size, viewBox) {
223
+ return viewBox || `0 0 ${size} ${size}`;
218
224
  }
219
225
  }
220
226
 
@@ -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 {
@@ -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
- return { svg: cloneSvgNode(this._icons[this.__getIconId(name)]), size: this.size };
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
  /**