@vaadin/icon 24.2.0-alpha10 → 24.2.0-alpha12

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": "24.2.0-alpha10",
3
+ "version": "24.2.0-alpha12",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,9 +35,9 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@polymer/polymer": "^3.0.0",
38
- "@vaadin/component-base": "24.2.0-alpha10",
39
- "@vaadin/vaadin-lumo-styles": "24.2.0-alpha10",
40
- "@vaadin/vaadin-themable-mixin": "24.2.0-alpha10",
38
+ "@vaadin/component-base": "24.2.0-alpha12",
39
+ "@vaadin/vaadin-lumo-styles": "24.2.0-alpha12",
40
+ "@vaadin/vaadin-themable-mixin": "24.2.0-alpha12",
41
41
  "lit": "^2.0.0"
42
42
  },
43
43
  "devDependencies": {
@@ -49,5 +49,5 @@
49
49
  "web-types.json",
50
50
  "web-types.lit.json"
51
51
  ],
52
- "gitHead": "ca16b5f88b00ae05fb6d7c7e9874525048e389f0"
52
+ "gitHead": "854d2809340ef73f765350808bb92ed5c840d147"
53
53
  }
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
7
7
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
8
+ import { SlotStylesMixin } from '@vaadin/component-base/src/slot-styles-mixin.js';
8
9
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
10
  import type { IconSvgLiteral } from './vaadin-icon-svg.js';
10
11
 
@@ -47,7 +48,7 @@ import type { IconSvgLiteral } from './vaadin-icon-svg.js';
47
48
  * }
48
49
  * ```
49
50
  */
50
- declare class Icon extends ThemableMixin(ElementMixin(ControllerMixin(HTMLElement))) {
51
+ declare class Icon extends ThemableMixin(ElementMixin(ControllerMixin(SlotStylesMixin(HTMLElement)))) {
51
52
  /**
52
53
  * The name of the icon to use. The name should be of the form:
53
54
  * `iconset_name:icon_name`. When using `vaadin-icons` it is possible
@@ -67,6 +68,36 @@ declare class Icon extends ThemableMixin(ElementMixin(ControllerMixin(HTMLElemen
67
68
  */
68
69
  svg: IconSvgLiteral | null;
69
70
 
71
+ /**
72
+ * The SVG source to be loaded as the icon. It can be:
73
+ * - an URL to a file containing the icon
74
+ * - an URL in the format "/path/to/file.svg#objectID", where the "objectID" refers to an ID attribute contained
75
+ * inside the SVG referenced by the path. Note that the file needs to follow the same-origin policy.
76
+ * - a string in the format "data:image/svg+xml,<svg>...</svg>". You may need to use the "encodeURIComponent"
77
+ * function for the SVG content passed
78
+ */
79
+ src: string | null;
80
+
81
+ /**
82
+ * Class names defining an icon font and/or a specific glyph inside an icon font.
83
+ *
84
+ * @attr {string} font
85
+ */
86
+ font: string | null;
87
+
88
+ /**
89
+ * The specific glyph from a font to use as an icon.
90
+ * Can be a code point or a ligature name.
91
+ *
92
+ * @attr {string} char
93
+ */
94
+ char: string | null;
95
+
96
+ /**
97
+ * The font family to use for the font icon.
98
+ */
99
+ fontFamily: string | null;
100
+
70
101
  /**
71
102
  * The size of an icon, used to set the `viewBox` attribute.
72
103
  */
@@ -4,13 +4,23 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
7
+ import { svg } from 'lit';
8
+ import { isSafari } from '@vaadin/component-base/src/browser-utils.js';
7
9
  import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
8
10
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
11
+ import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
12
+ import { SlotStylesMixin } from '@vaadin/component-base/src/slot-styles-mixin.js';
9
13
  import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
10
14
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
- import { ensureSvgLiteral, renderSvg } from './vaadin-icon-svg.js';
15
+ import { ensureSvgLiteral, renderSvg, unsafeSvgLiteral } from './vaadin-icon-svg.js';
12
16
  import { Iconset } from './vaadin-iconset.js';
13
17
 
18
+ const supportsCSSContainerQueries = CSS.supports('container-type: inline-size');
19
+ const needsFontIconSizingFallback = !supportsCSSContainerQueries || isSafari;
20
+ // ResizeObserver-based fallback for browsers without CSS Container Queries support (Safari 15)
21
+ // or buggy Container Queries support for pseudo elements (Safari 16)
22
+ const ConditionalResizeMixin = (superClass) => (needsFontIconSizingFallback ? ResizeMixin(superClass) : superClass);
23
+
14
24
  /**
15
25
  * `<vaadin-icon>` is a Web Component for displaying SVG icons.
16
26
  *
@@ -54,8 +64,11 @@ import { Iconset } from './vaadin-iconset.js';
54
64
  * @mixes ControllerMixin
55
65
  * @mixes ThemableMixin
56
66
  * @mixes ElementMixin
67
+ * @mixes SlotStylesMixin
57
68
  */
58
- class Icon extends ThemableMixin(ElementMixin(ControllerMixin(PolymerElement))) {
69
+ class Icon extends ThemableMixin(
70
+ ElementMixin(ControllerMixin(SlotStylesMixin(ConditionalResizeMixin(PolymerElement)))),
71
+ ) {
59
72
  static get template() {
60
73
  return html`
61
74
  <style>
@@ -68,6 +81,13 @@ class Icon extends ThemableMixin(ElementMixin(ControllerMixin(PolymerElement)))
68
81
  width: 24px;
69
82
  height: 24px;
70
83
  fill: currentColor;
84
+ container-type: size;
85
+ }
86
+
87
+ :host::after,
88
+ :host::before {
89
+ line-height: 1;
90
+ font-size: var(--_vaadin-font-icon-size, 100cqh);
71
91
  }
72
92
 
73
93
  :host([hidden]) {
@@ -79,6 +99,14 @@ class Icon extends ThemableMixin(ElementMixin(ControllerMixin(PolymerElement)))
79
99
  width: 100%;
80
100
  height: 100%;
81
101
  }
102
+
103
+ :host(:is([font], [char])) svg {
104
+ display: none;
105
+ }
106
+
107
+ :host([char])::before {
108
+ content: attr(char);
109
+ }
82
110
  </style>
83
111
  <svg
84
112
  version="1.1"
@@ -125,6 +153,51 @@ class Icon extends ThemableMixin(ElementMixin(ControllerMixin(PolymerElement)))
125
153
  type: Object,
126
154
  },
127
155
 
156
+ /**
157
+ * The SVG source to be loaded as the icon. It can be:
158
+ * - an URL to a file containing the icon
159
+ * - an URL in the format "/path/to/file.svg#objectID", where the "objectID" refers to an ID attribute contained
160
+ * inside the SVG referenced by the path. Note that the file needs to follow the same-origin policy.
161
+ * - a string in the format "data:image/svg+xml,<svg>...</svg>". You may need to use the "encodeURIComponent"
162
+ * function for the SVG content passed
163
+ */
164
+ src: {
165
+ type: String,
166
+ },
167
+
168
+ /**
169
+ * Class names defining an icon font and/or a specific glyph inside an icon font.
170
+ *
171
+ * @attr {string} font
172
+ * @type {string}
173
+ */
174
+ font: {
175
+ type: String,
176
+ reflectToAttribute: true,
177
+ },
178
+
179
+ /**
180
+ * The specific glyph from a font to use as an icon.
181
+ * Can be a code point or a ligature name.
182
+ *
183
+ * @attr {string} char
184
+ * @type {string}
185
+ */
186
+ char: {
187
+ type: String,
188
+ reflectToAttribute: true,
189
+ },
190
+
191
+ /**
192
+ * The font family to use for the font icon.
193
+ *
194
+ * @type {string}
195
+ */
196
+ fontFamily: {
197
+ type: String,
198
+ observer: '__fontFamilyChanged',
199
+ },
200
+
128
201
  /**
129
202
  * The size of an icon, used to set the `viewBox` attribute.
130
203
  */
@@ -151,7 +224,27 @@ class Icon extends ThemableMixin(ElementMixin(ControllerMixin(PolymerElement)))
151
224
  }
152
225
 
153
226
  static get observers() {
154
- return ['__svgChanged(svg, __svgElement)'];
227
+ return ['__svgChanged(svg, __svgElement)', '__fontChanged(font, char)', '__srcChanged(src)'];
228
+ }
229
+
230
+ constructor() {
231
+ super();
232
+
233
+ this.__fetch = fetch.bind(window);
234
+ }
235
+
236
+ /** @protected */
237
+ get slotStyles() {
238
+ const tag = this.localName;
239
+ return [
240
+ `
241
+ ${tag}[font] {
242
+ display: inline-flex;
243
+ vertical-align: middle;
244
+ font-size: inherit;
245
+ }
246
+ `,
247
+ ];
155
248
  }
156
249
 
157
250
  /** @protected */
@@ -161,6 +254,9 @@ class Icon extends ThemableMixin(ElementMixin(ControllerMixin(PolymerElement)))
161
254
 
162
255
  this._tooltipController = new TooltipController(this);
163
256
  this.addController(this._tooltipController);
257
+
258
+ // Call once initially to avoid a fouc
259
+ this._onResize();
164
260
  }
165
261
 
166
262
  /** @protected */
@@ -205,6 +301,47 @@ class Icon extends ThemableMixin(ElementMixin(ControllerMixin(PolymerElement)))
205
301
  }
206
302
  }
207
303
 
304
+ /** @private */
305
+ async __srcChanged(src) {
306
+ if (!src) {
307
+ this.svg = null;
308
+ return;
309
+ }
310
+
311
+ // Need to add the "icon" attribute to avoid issues as described in
312
+ // https://github.com/vaadin/web-components/issues/6301
313
+ this.icon = '';
314
+
315
+ if (src.includes('#')) {
316
+ this.svg = svg`<use href="${src}"/>`;
317
+ } else {
318
+ try {
319
+ const data = await this.__fetch(src, { mode: 'cors' });
320
+ if (!data.ok) {
321
+ throw new Error('Error loading icon');
322
+ }
323
+
324
+ const svgData = await data.text();
325
+
326
+ if (!Icon.__domParser) {
327
+ Icon.__domParser = new DOMParser();
328
+ }
329
+ const parsedResponse = Icon.__domParser.parseFromString(svgData, 'text/html');
330
+
331
+ const svgElement = parsedResponse.querySelector('svg');
332
+ if (!svgElement) {
333
+ throw new Error(`SVG element not found on path: ${src}`);
334
+ }
335
+
336
+ this.__viewBox = svgElement.getAttribute('viewBox');
337
+ this.svg = unsafeSvgLiteral(svgElement.innerHTML);
338
+ } catch (e) {
339
+ console.error(e);
340
+ this.svg = null;
341
+ }
342
+ }
343
+ }
344
+
208
345
  /** @private */
209
346
  __svgChanged(svg, svgElement) {
210
347
  if (!svgElement) {
@@ -223,6 +360,41 @@ class Icon extends ThemableMixin(ElementMixin(ControllerMixin(PolymerElement)))
223
360
  __computeViewBox(size, viewBox) {
224
361
  return viewBox || `0 0 ${size} ${size}`;
225
362
  }
363
+
364
+ /** @private */
365
+ __fontChanged(font, char) {
366
+ this.classList.remove(...(this.__addedFontClasses || []));
367
+ if (font) {
368
+ this.__addedFontClasses = font.split(' ');
369
+ this.classList.add(...this.__addedFontClasses);
370
+ }
371
+
372
+ if (font || char) {
373
+ if (!this.icon) {
374
+ // The "icon" attribute needs to be set on the host also when using font icons
375
+ // to avoid issues such as https://github.com/vaadin/web-components/issues/6301
376
+ this.icon = '';
377
+ }
378
+ this._onResize();
379
+ }
380
+ }
381
+
382
+ /** @private */
383
+ __fontFamilyChanged(fontFamily) {
384
+ this.style.fontFamily = fontFamily;
385
+ }
386
+
387
+ /**
388
+ * @protected
389
+ * @override
390
+ */
391
+ _onResize() {
392
+ if (needsFontIconSizingFallback && (this.char || this.font)) {
393
+ const { paddingTop, paddingBottom, height } = getComputedStyle(this);
394
+ const fontIconSize = parseFloat(height) - parseFloat(paddingTop) - parseFloat(paddingBottom);
395
+ this.style.setProperty('--_vaadin-font-icon-size', `${fontIconSize}px`);
396
+ }
397
+ }
226
398
  }
227
399
 
228
400
  customElements.define(Icon.is, Icon);
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/icon",
4
- "version": "24.2.0-alpha10",
4
+ "version": "24.2.0-alpha12",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -12,7 +12,7 @@
12
12
  "attributes": [
13
13
  {
14
14
  "name": "name",
15
- "description": "The name of the iconset. Every iconset is required to have its own unique name.\nAll the SVG icons in the iconset must have IDs conforming to its name.\n\nSee also [`name`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha10/#/elements/vaadin-icon#property-name) property of `vaadin-icon`.",
15
+ "description": "The name of the iconset. Every iconset is required to have its own unique name.\nAll the SVG icons in the iconset must have IDs conforming to its name.\n\nSee also [`name`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha12/#/elements/vaadin-icon#property-name) property of `vaadin-icon`.",
16
16
  "value": {
17
17
  "type": [
18
18
  "string",
@@ -48,7 +48,7 @@
48
48
  "properties": [
49
49
  {
50
50
  "name": "name",
51
- "description": "The name of the iconset. Every iconset is required to have its own unique name.\nAll the SVG icons in the iconset must have IDs conforming to its name.\n\nSee also [`name`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha10/#/elements/vaadin-icon#property-name) property of `vaadin-icon`.",
51
+ "description": "The name of the iconset. Every iconset is required to have its own unique name.\nAll the SVG icons in the iconset must have IDs conforming to its name.\n\nSee also [`name`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha12/#/elements/vaadin-icon#property-name) property of `vaadin-icon`.",
52
52
  "value": {
53
53
  "type": [
54
54
  "string",
@@ -74,11 +74,49 @@
74
74
  },
75
75
  {
76
76
  "name": "vaadin-icon",
77
- "description": "`<vaadin-icon>` is a Web Component for displaying SVG icons.\n\n### Icon property\n\nThe `<vaadin-icon>` component is designed to be used as a drop-in replacement for `<iron-icon>`.\nFor example, you can use it with `vaadin-icons` like this:\n\n```html\n<vaadin-icon icon=\"vaadin:angle-down\"></vaadin-icon>\n```\n\nAlternatively, you can also pick one of the Lumo icons:\n\n```html\n<vaadin-icon icon=\"lumo:user\"></vaadin-icon>\n```\n\n### Custom SVG icon\n\nAlternatively, instead of selecting an icon from an iconset by name, you can pass any custom `svg`\nliteral using the [`svg`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha10/#/elements/vaadin-icon#property-svg) property. In this case you can also\ndefine the size of the SVG `viewBox` using the [`size`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha10/#/elements/vaadin-icon#property-size) property:\n\n```js\nimport { html, svg } from 'lit';\n\n// in your component\nrender() {\n const svgIcon = svg`<path d=\"M13 4v2l-5 5-5-5v-2l5 5z\"></path>`;\n return html`\n <vaadin-icon\n .svg=\"${svgIcon}\"\n size=\"16\"\n ></vaadin-icon>\n `;\n}\n```",
77
+ "description": "`<vaadin-icon>` is a Web Component for displaying SVG icons.\n\n### Icon property\n\nThe `<vaadin-icon>` component is designed to be used as a drop-in replacement for `<iron-icon>`.\nFor example, you can use it with `vaadin-icons` like this:\n\n```html\n<vaadin-icon icon=\"vaadin:angle-down\"></vaadin-icon>\n```\n\nAlternatively, you can also pick one of the Lumo icons:\n\n```html\n<vaadin-icon icon=\"lumo:user\"></vaadin-icon>\n```\n\n### Custom SVG icon\n\nAlternatively, instead of selecting an icon from an iconset by name, you can pass any custom `svg`\nliteral using the [`svg`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha12/#/elements/vaadin-icon#property-svg) property. In this case you can also\ndefine the size of the SVG `viewBox` using the [`size`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha12/#/elements/vaadin-icon#property-size) property:\n\n```js\nimport { html, svg } from 'lit';\n\n// in your component\nrender() {\n const svgIcon = svg`<path d=\"M13 4v2l-5 5-5-5v-2l5 5z\"></path>`;\n return html`\n <vaadin-icon\n .svg=\"${svgIcon}\"\n size=\"16\"\n ></vaadin-icon>\n `;\n}\n```",
78
78
  "attributes": [
79
79
  {
80
80
  "name": "icon",
81
- "description": "The name of the icon to use. The name should be of the form:\n`iconset_name:icon_name`. When using `vaadin-icons` it is possible\nto omit the first part and only use `icon_name` as a value.\n\nSetting the `icon` property updates the `svg` and `size` based on the\nvalues provided by the corresponding `vaadin-iconset` element.\n\nSee also [`name`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha10/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
81
+ "description": "The name of the icon to use. The name should be of the form:\n`iconset_name:icon_name`. When using `vaadin-icons` it is possible\nto omit the first part and only use `icon_name` as a value.\n\nSetting the `icon` property updates the `svg` and `size` based on the\nvalues provided by the corresponding `vaadin-iconset` element.\n\nSee also [`name`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha12/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
82
+ "value": {
83
+ "type": [
84
+ "string"
85
+ ]
86
+ }
87
+ },
88
+ {
89
+ "name": "src",
90
+ "description": "The SVG source to be loaded as the icon. It can be:\n- an URL to a file containing the icon\n- an URL in the format \"/path/to/file.svg#objectID\", where the \"objectID\" refers to an ID attribute contained\n inside the SVG referenced by the path. Note that the file needs to follow the same-origin policy.\n- a string in the format \"data:image/svg+xml,<svg>...</svg>\". You may need to use the \"encodeURIComponent\"\n function for the SVG content passed",
91
+ "value": {
92
+ "type": [
93
+ "string",
94
+ "null",
95
+ "undefined"
96
+ ]
97
+ }
98
+ },
99
+ {
100
+ "name": "font",
101
+ "description": "Class names defining an icon font and/or a specific glyph inside an icon font.",
102
+ "value": {
103
+ "type": [
104
+ "string"
105
+ ]
106
+ }
107
+ },
108
+ {
109
+ "name": "char",
110
+ "description": "The specific glyph from a font to use as an icon.\nCan be a code point or a ligature name.",
111
+ "value": {
112
+ "type": [
113
+ "string"
114
+ ]
115
+ }
116
+ },
117
+ {
118
+ "name": "font-family",
119
+ "description": "The font family to use for the font icon.",
82
120
  "value": {
83
121
  "type": [
84
122
  "string"
@@ -112,7 +150,7 @@
112
150
  "properties": [
113
151
  {
114
152
  "name": "icon",
115
- "description": "The name of the icon to use. The name should be of the form:\n`iconset_name:icon_name`. When using `vaadin-icons` it is possible\nto omit the first part and only use `icon_name` as a value.\n\nSetting the `icon` property updates the `svg` and `size` based on the\nvalues provided by the corresponding `vaadin-iconset` element.\n\nSee also [`name`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha10/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
153
+ "description": "The name of the icon to use. The name should be of the form:\n`iconset_name:icon_name`. When using `vaadin-icons` it is possible\nto omit the first part and only use `icon_name` as a value.\n\nSetting the `icon` property updates the `svg` and `size` based on the\nvalues provided by the corresponding `vaadin-iconset` element.\n\nSee also [`name`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha12/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
116
154
  "value": {
117
155
  "type": [
118
156
  "string"
@@ -130,6 +168,44 @@
130
168
  ]
131
169
  }
132
170
  },
171
+ {
172
+ "name": "src",
173
+ "description": "The SVG source to be loaded as the icon. It can be:\n- an URL to a file containing the icon\n- an URL in the format \"/path/to/file.svg#objectID\", where the \"objectID\" refers to an ID attribute contained\n inside the SVG referenced by the path. Note that the file needs to follow the same-origin policy.\n- a string in the format \"data:image/svg+xml,<svg>...</svg>\". You may need to use the \"encodeURIComponent\"\n function for the SVG content passed",
174
+ "value": {
175
+ "type": [
176
+ "string",
177
+ "null",
178
+ "undefined"
179
+ ]
180
+ }
181
+ },
182
+ {
183
+ "name": "font",
184
+ "description": "Class names defining an icon font and/or a specific glyph inside an icon font.",
185
+ "value": {
186
+ "type": [
187
+ "string"
188
+ ]
189
+ }
190
+ },
191
+ {
192
+ "name": "char",
193
+ "description": "The specific glyph from a font to use as an icon.\nCan be a code point or a ligature name.",
194
+ "value": {
195
+ "type": [
196
+ "string"
197
+ ]
198
+ }
199
+ },
200
+ {
201
+ "name": "fontFamily",
202
+ "description": "The font family to use for the font icon.",
203
+ "value": {
204
+ "type": [
205
+ "string"
206
+ ]
207
+ }
208
+ },
133
209
  {
134
210
  "name": "size",
135
211
  "description": "The size of an icon, used to set the `viewBox` attribute.",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/icon",
4
- "version": "24.2.0-alpha10",
4
+ "version": "24.2.0-alpha12",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -21,7 +21,7 @@
21
21
  "attributes": [
22
22
  {
23
23
  "name": ".name",
24
- "description": "The name of the iconset. Every iconset is required to have its own unique name.\nAll the SVG icons in the iconset must have IDs conforming to its name.\n\nSee also [`name`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha10/#/elements/vaadin-icon#property-name) property of `vaadin-icon`.",
24
+ "description": "The name of the iconset. Every iconset is required to have its own unique name.\nAll the SVG icons in the iconset must have IDs conforming to its name.\n\nSee also [`name`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha12/#/elements/vaadin-icon#property-name) property of `vaadin-icon`.",
25
25
  "value": {
26
26
  "kind": "expression"
27
27
  }
@@ -37,12 +37,12 @@
37
37
  },
38
38
  {
39
39
  "name": "vaadin-icon",
40
- "description": "`<vaadin-icon>` is a Web Component for displaying SVG icons.\n\n### Icon property\n\nThe `<vaadin-icon>` component is designed to be used as a drop-in replacement for `<iron-icon>`.\nFor example, you can use it with `vaadin-icons` like this:\n\n```html\n<vaadin-icon icon=\"vaadin:angle-down\"></vaadin-icon>\n```\n\nAlternatively, you can also pick one of the Lumo icons:\n\n```html\n<vaadin-icon icon=\"lumo:user\"></vaadin-icon>\n```\n\n### Custom SVG icon\n\nAlternatively, instead of selecting an icon from an iconset by name, you can pass any custom `svg`\nliteral using the [`svg`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha10/#/elements/vaadin-icon#property-svg) property. In this case you can also\ndefine the size of the SVG `viewBox` using the [`size`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha10/#/elements/vaadin-icon#property-size) property:\n\n```js\nimport { html, svg } from 'lit';\n\n// in your component\nrender() {\n const svgIcon = svg`<path d=\"M13 4v2l-5 5-5-5v-2l5 5z\"></path>`;\n return html`\n <vaadin-icon\n .svg=\"${svgIcon}\"\n size=\"16\"\n ></vaadin-icon>\n `;\n}\n```",
40
+ "description": "`<vaadin-icon>` is a Web Component for displaying SVG icons.\n\n### Icon property\n\nThe `<vaadin-icon>` component is designed to be used as a drop-in replacement for `<iron-icon>`.\nFor example, you can use it with `vaadin-icons` like this:\n\n```html\n<vaadin-icon icon=\"vaadin:angle-down\"></vaadin-icon>\n```\n\nAlternatively, you can also pick one of the Lumo icons:\n\n```html\n<vaadin-icon icon=\"lumo:user\"></vaadin-icon>\n```\n\n### Custom SVG icon\n\nAlternatively, instead of selecting an icon from an iconset by name, you can pass any custom `svg`\nliteral using the [`svg`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha12/#/elements/vaadin-icon#property-svg) property. In this case you can also\ndefine the size of the SVG `viewBox` using the [`size`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha12/#/elements/vaadin-icon#property-size) property:\n\n```js\nimport { html, svg } from 'lit';\n\n// in your component\nrender() {\n const svgIcon = svg`<path d=\"M13 4v2l-5 5-5-5v-2l5 5z\"></path>`;\n return html`\n <vaadin-icon\n .svg=\"${svgIcon}\"\n size=\"16\"\n ></vaadin-icon>\n `;\n}\n```",
41
41
  "extension": true,
42
42
  "attributes": [
43
43
  {
44
44
  "name": ".icon",
45
- "description": "The name of the icon to use. The name should be of the form:\n`iconset_name:icon_name`. When using `vaadin-icons` it is possible\nto omit the first part and only use `icon_name` as a value.\n\nSetting the `icon` property updates the `svg` and `size` based on the\nvalues provided by the corresponding `vaadin-iconset` element.\n\nSee also [`name`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha10/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
45
+ "description": "The name of the icon to use. The name should be of the form:\n`iconset_name:icon_name`. When using `vaadin-icons` it is possible\nto omit the first part and only use `icon_name` as a value.\n\nSetting the `icon` property updates the `svg` and `size` based on the\nvalues provided by the corresponding `vaadin-iconset` element.\n\nSee also [`name`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha12/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
46
46
  "value": {
47
47
  "kind": "expression"
48
48
  }
@@ -54,6 +54,34 @@
54
54
  "kind": "expression"
55
55
  }
56
56
  },
57
+ {
58
+ "name": ".src",
59
+ "description": "The SVG source to be loaded as the icon. It can be:\n- an URL to a file containing the icon\n- an URL in the format \"/path/to/file.svg#objectID\", where the \"objectID\" refers to an ID attribute contained\n inside the SVG referenced by the path. Note that the file needs to follow the same-origin policy.\n- a string in the format \"data:image/svg+xml,<svg>...</svg>\". You may need to use the \"encodeURIComponent\"\n function for the SVG content passed",
60
+ "value": {
61
+ "kind": "expression"
62
+ }
63
+ },
64
+ {
65
+ "name": ".font",
66
+ "description": "Class names defining an icon font and/or a specific glyph inside an icon font.",
67
+ "value": {
68
+ "kind": "expression"
69
+ }
70
+ },
71
+ {
72
+ "name": ".char",
73
+ "description": "The specific glyph from a font to use as an icon.\nCan be a code point or a ligature name.",
74
+ "value": {
75
+ "kind": "expression"
76
+ }
77
+ },
78
+ {
79
+ "name": ".fontFamily",
80
+ "description": "The font family to use for the font icon.",
81
+ "value": {
82
+ "kind": "expression"
83
+ }
84
+ },
57
85
  {
58
86
  "name": ".size",
59
87
  "description": "The size of an icon, used to set the `viewBox` attribute.",