@vaadin/icon 24.2.0-alpha14 → 24.2.0-alpha16

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-alpha14",
3
+ "version": "24.2.0-alpha16",
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-alpha14",
39
- "@vaadin/vaadin-lumo-styles": "24.2.0-alpha14",
40
- "@vaadin/vaadin-themable-mixin": "24.2.0-alpha14",
38
+ "@vaadin/component-base": "24.2.0-alpha16",
39
+ "@vaadin/vaadin-lumo-styles": "24.2.0-alpha16",
40
+ "@vaadin/vaadin-themable-mixin": "24.2.0-alpha16",
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": "203a2fda8d879db6ee8bccd7cf5b915de3e5008b"
52
+ "gitHead": "133d3aeb00dedc8be975affa81c7af4b4d22acf6"
53
53
  }
@@ -34,7 +34,7 @@ export const IconFontSizeMixin = dedupingMixin((superclass) =>
34
34
  ? superclass
35
35
  : class extends ResizeMixin(superclass) {
36
36
  static get observers() {
37
- return ['__iconFontSizeMixinfontChanged(font, char)'];
37
+ return ['__iconFontSizeMixinfontChanged(iconClass, char, ligature)'];
38
38
  }
39
39
 
40
40
  /** @protected */
@@ -46,8 +46,8 @@ export const IconFontSizeMixin = dedupingMixin((superclass) =>
46
46
  }
47
47
 
48
48
  /** @private */
49
- __iconFontSizeMixinfontChanged(font, char) {
50
- // Update when font or char changes
49
+ __iconFontSizeMixinfontChanged(_iconClass, _char, _ligature) {
50
+ // Update when iconClass, char or ligature changes
51
51
  this.__updateFontIconSize();
52
52
  }
53
53
 
@@ -61,12 +61,12 @@ export const IconFontSizeMixin = dedupingMixin((superclass) =>
61
61
  }
62
62
 
63
63
  /**
64
- * Updates the --_vaadin-font-icon-size CSS variable value if char or font is set (font icons in use).
64
+ * Updates the --_vaadin-font-icon-size CSS variable value if font icons are used.
65
65
  *
66
66
  * @private
67
67
  */
68
68
  __updateFontIconSize() {
69
- if (this.char || this.font) {
69
+ if (this.char || this.iconClass || this.ligature) {
70
70
  const { paddingTop, paddingBottom, height } = getComputedStyle(this);
71
71
  const fontIconSize = parseFloat(height) - parseFloat(paddingTop) - parseFloat(paddingBottom);
72
72
  this.style.setProperty('--_vaadin-font-icon-size', `${fontIconSize}px`);
@@ -81,21 +81,35 @@ declare class Icon extends ThemableMixin(
81
81
  */
82
82
  src: string | null;
83
83
 
84
+ /**
85
+ * The symbol identifier that references an ID of an element contained in the SVG element assigned to the
86
+ * `src` property
87
+ */
88
+ symbol: string | null;
89
+
84
90
  /**
85
91
  * Class names defining an icon font and/or a specific glyph inside an icon font.
86
92
  *
87
- * @attr {string} font
93
+ * Example: "fa-solid fa-user"
94
+ *
95
+ * @attr {string} icon-class
88
96
  */
89
- font: string | null;
97
+ iconClass: string | null;
90
98
 
91
99
  /**
92
- * The specific glyph from a font to use as an icon.
93
- * Can be a code point or a ligature name.
100
+ * A hexadecimal code point that specifies a glyph from an icon font.
94
101
  *
95
- * @attr {string} char
102
+ * Example: "e001"
96
103
  */
97
104
  char: string | null;
98
105
 
106
+ /**
107
+ * A ligature name that specifies an icon from an icon font with support for ligatures.
108
+ *
109
+ * Example: "home".
110
+ */
111
+ ligature: string | null;
112
+
99
113
  /**
100
114
  * The font family to use for the font icon.
101
115
  */
@@ -4,7 +4,6 @@
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
7
  import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
9
8
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
10
9
  import { SlotStylesMixin } from '@vaadin/component-base/src/slot-styles-mixin.js';
@@ -80,6 +79,9 @@ class Icon extends ThemableMixin(ElementMixin(ControllerMixin(SlotStylesMixin(Ic
80
79
  :host::before {
81
80
  line-height: 1;
82
81
  font-size: 100cqh;
82
+ -webkit-font-smoothing: antialiased;
83
+ text-rendering: optimizeLegibility;
84
+ -moz-osx-font-smoothing: grayscale;
83
85
  }
84
86
 
85
87
  :host([hidden]) {
@@ -92,12 +94,12 @@ class Icon extends ThemableMixin(ElementMixin(ControllerMixin(SlotStylesMixin(Ic
92
94
  height: 100%;
93
95
  }
94
96
 
95
- :host(:is([font], [char])) svg {
97
+ :host(:is([icon-class], [font-icon-content])) svg {
96
98
  display: none;
97
99
  }
98
100
 
99
- :host([char])::before {
100
- content: attr(char);
101
+ :host([font-icon-content])::before {
102
+ content: attr(font-icon-content);
101
103
  }
102
104
  </style>
103
105
  <svg
@@ -107,7 +109,12 @@ class Icon extends ThemableMixin(ElementMixin(ControllerMixin(SlotStylesMixin(Ic
107
109
  viewBox="[[__computeViewBox(size, __viewBox)]]"
108
110
  preserveAspectRatio="[[__computePAR(__defaultPAR, __preserveAspectRatio)]]"
109
111
  aria-hidden="true"
110
- ></svg>
112
+ >
113
+ <g id="svg-group"></g>
114
+ <g id="use-group" visibility$="[[__computeVisibility(__useRef, svg)]]">
115
+ <use href$="[[__useRef]]" />
116
+ </g>
117
+ </svg>
111
118
 
112
119
  <slot name="tooltip"></slot>
113
120
  `;
@@ -152,32 +159,56 @@ class Icon extends ThemableMixin(ElementMixin(ControllerMixin(SlotStylesMixin(Ic
152
159
  * inside the SVG referenced by the path. Note that the file needs to follow the same-origin policy.
153
160
  * - a string in the format "data:image/svg+xml,<svg>...</svg>". You may need to use the "encodeURIComponent"
154
161
  * function for the SVG content passed
162
+ *
163
+ * @type {string}
155
164
  */
156
165
  src: {
157
166
  type: String,
158
167
  },
159
168
 
169
+ /**
170
+ * The symbol identifier that references an ID of an element contained in the SVG element assigned to the
171
+ * `src` property
172
+ *
173
+ * @type {string}
174
+ */
175
+ symbol: {
176
+ type: String,
177
+ },
178
+
160
179
  /**
161
180
  * Class names defining an icon font and/or a specific glyph inside an icon font.
162
181
  *
163
- * @attr {string} font
182
+ * Example: "fa-solid fa-user"
183
+ *
184
+ * @attr {string} icon-class
164
185
  * @type {string}
165
186
  */
166
- font: {
187
+ iconClass: {
167
188
  type: String,
168
189
  reflectToAttribute: true,
169
190
  },
170
191
 
171
192
  /**
172
- * The specific glyph from a font to use as an icon.
173
- * Can be a code point or a ligature name.
193
+ * A hexadecimal code point that specifies a glyph from an icon font.
194
+ *
195
+ * Example: "e001"
174
196
  *
175
- * @attr {string} char
176
197
  * @type {string}
177
198
  */
178
199
  char: {
179
200
  type: String,
180
- reflectToAttribute: true,
201
+ },
202
+
203
+ /**
204
+ * A ligature name that specifies an icon from an icon font with support for ligatures.
205
+ *
206
+ * Example: "home".
207
+ *
208
+ * @type {string}
209
+ */
210
+ ligature: {
211
+ type: String,
181
212
  },
182
213
 
183
214
  /**
@@ -208,7 +239,10 @@ class Icon extends ThemableMixin(ElementMixin(ControllerMixin(SlotStylesMixin(Ic
208
239
  __preserveAspectRatio: String,
209
240
 
210
241
  /** @private */
211
- __svgElement: Object,
242
+ __useRef: Object,
243
+
244
+ /** @private */
245
+ __svgElement: String,
212
246
 
213
247
  /** @private */
214
248
  __viewBox: String,
@@ -216,7 +250,11 @@ class Icon extends ThemableMixin(ElementMixin(ControllerMixin(SlotStylesMixin(Ic
216
250
  }
217
251
 
218
252
  static get observers() {
219
- return ['__svgChanged(svg, __svgElement)', '__fontChanged(font, char)', '__srcChanged(src)'];
253
+ return ['__svgChanged(svg, __svgElement)', '__fontChanged(iconClass, char, ligature)', '__srcChanged(src, symbol)'];
254
+ }
255
+
256
+ static get observedAttributes() {
257
+ return [...super.observedAttributes, 'class'];
220
258
  }
221
259
 
222
260
  constructor() {
@@ -230,7 +268,7 @@ class Icon extends ThemableMixin(ElementMixin(ControllerMixin(SlotStylesMixin(Ic
230
268
  const tag = this.localName;
231
269
  return [
232
270
  `
233
- ${tag}[font] {
271
+ ${tag}[icon-class] {
234
272
  display: inline-flex;
235
273
  vertical-align: middle;
236
274
  font-size: inherit;
@@ -239,10 +277,15 @@ class Icon extends ThemableMixin(ElementMixin(ControllerMixin(SlotStylesMixin(Ic
239
277
  ];
240
278
  }
241
279
 
280
+ /** @private */
281
+ get __iconClasses() {
282
+ return this.iconClass ? this.iconClass.split(' ') : [];
283
+ }
284
+
242
285
  /** @protected */
243
286
  ready() {
244
287
  super.ready();
245
- this.__svgElement = this.shadowRoot.querySelector('svg');
288
+ this.__svgElement = this.shadowRoot.querySelector('#svg-group');
246
289
 
247
290
  this._tooltipController = new TooltipController(this);
248
291
  this.addController(this._tooltipController);
@@ -291,7 +334,7 @@ class Icon extends ThemableMixin(ElementMixin(ControllerMixin(SlotStylesMixin(Ic
291
334
  }
292
335
 
293
336
  /** @private */
294
- async __srcChanged(src) {
337
+ async __srcChanged(src, symbol) {
295
338
  if (!src) {
296
339
  this.svg = null;
297
340
  return;
@@ -301,8 +344,9 @@ class Icon extends ThemableMixin(ElementMixin(ControllerMixin(SlotStylesMixin(Ic
301
344
  // https://github.com/vaadin/web-components/issues/6301
302
345
  this.icon = '';
303
346
 
304
- if (src.includes('#')) {
305
- this.svg = svg`<use href="${src}"/>`;
347
+ if (!src.startsWith('data:') && (symbol || src.includes('#'))) {
348
+ const [path, iconId] = src.split('#');
349
+ this.__useRef = `${path}#${symbol || iconId}`;
306
350
  } else {
307
351
  try {
308
352
  const data = await this.__fetch(src, { mode: 'cors' });
@@ -322,8 +366,13 @@ class Icon extends ThemableMixin(ElementMixin(ControllerMixin(SlotStylesMixin(Ic
322
366
  throw new Error(`SVG element not found on path: ${src}`);
323
367
  }
324
368
 
325
- this.__viewBox = svgElement.getAttribute('viewBox');
326
369
  this.svg = unsafeSvgLiteral(svgElement.innerHTML);
370
+
371
+ if (symbol) {
372
+ this.__useRef = `#${symbol}`;
373
+ }
374
+
375
+ this.__viewBox = svgElement.getAttribute('viewBox');
327
376
  } catch (e) {
328
377
  console.error(e);
329
378
  this.svg = null;
@@ -345,29 +394,52 @@ class Icon extends ThemableMixin(ElementMixin(ControllerMixin(SlotStylesMixin(Ic
345
394
  return preserveAspectRatio || defaultPAR;
346
395
  }
347
396
 
397
+ /** @private */
398
+ __computeVisibility(__useRef) {
399
+ return __useRef ? 'visible' : 'hidden';
400
+ }
401
+
348
402
  /** @private */
349
403
  __computeViewBox(size, viewBox) {
350
404
  return viewBox || `0 0 ${size} ${size}`;
351
405
  }
352
406
 
353
407
  /** @private */
354
- __fontChanged(font, char) {
355
- this.classList.remove(...(this.__addedFontClasses || []));
356
- if (font) {
357
- this.__addedFontClasses = font.split(' ');
358
- this.classList.add(...this.__addedFontClasses);
408
+ __fontChanged(iconClass, char, ligature) {
409
+ this.classList.remove(...(this.__addedIconClasses || []));
410
+ if (iconClass) {
411
+ this.__addedIconClasses = [...this.__iconClasses];
412
+ this.classList.add(...this.__addedIconClasses);
413
+ }
414
+
415
+ if (char) {
416
+ this.setAttribute('font-icon-content', char.length > 1 ? String.fromCodePoint(parseInt(char, 16)) : char);
417
+ } else if (ligature) {
418
+ this.setAttribute('font-icon-content', ligature);
419
+ } else {
420
+ this.removeAttribute('font-icon-content');
359
421
  }
360
422
 
361
- if ((font || char) && !this.icon) {
423
+ if ((iconClass || char || ligature) && !this.icon) {
362
424
  // The "icon" attribute needs to be set on the host also when using font icons
363
425
  // to avoid issues such as https://github.com/vaadin/web-components/issues/6301
364
426
  this.icon = '';
365
427
  }
366
428
  }
367
429
 
430
+ /** @protected */
431
+ attributeChangedCallback(name, oldValue, newValue) {
432
+ super.attributeChangedCallback(name, oldValue, newValue);
433
+
434
+ // Make sure class list always contains all the font class names
435
+ if (name === 'class' && this.__iconClasses.some((className) => !this.classList.contains(className))) {
436
+ this.classList.add(...this.__iconClasses);
437
+ }
438
+ }
439
+
368
440
  /** @private */
369
441
  __fontFamilyChanged(fontFamily) {
370
- this.style.fontFamily = fontFamily;
442
+ this.style.fontFamily = `'${fontFamily}'`;
371
443
  }
372
444
  }
373
445
 
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-alpha14",
4
+ "version": "24.2.0-alpha16",
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-alpha14/#/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-alpha16/#/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-alpha14/#/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-alpha16/#/elements/vaadin-icon#property-name) property of `vaadin-icon`.",
52
52
  "value": {
53
53
  "type": [
54
54
  "string",
@@ -74,63 +74,14 @@
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-alpha14/#/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-alpha14/#/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-alpha16/#/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-alpha16/#/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
- "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-alpha14/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
80
+ "name": "class",
81
+ "description": "",
82
82
  "value": {
83
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.",
120
- "value": {
121
- "type": [
122
- "string"
123
- ]
124
- }
125
- },
126
- {
127
- "name": "size",
128
- "description": "The size of an icon, used to set the `viewBox` attribute.",
129
- "value": {
130
- "type": [
131
- "number",
132
- "null",
133
- "undefined"
84
+ ""
134
85
  ]
135
86
  }
136
87
  },
@@ -150,7 +101,7 @@
150
101
  "properties": [
151
102
  {
152
103
  "name": "icon",
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-alpha14/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
104
+ "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-alpha16/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
154
105
  "value": {
155
106
  "type": [
156
107
  "string"
@@ -173,15 +124,22 @@
173
124
  "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
125
  "value": {
175
126
  "type": [
176
- "string",
177
- "null",
178
- "undefined"
127
+ "string"
179
128
  ]
180
129
  }
181
130
  },
182
131
  {
183
- "name": "font",
184
- "description": "Class names defining an icon font and/or a specific glyph inside an icon font.",
132
+ "name": "symbol",
133
+ "description": "The symbol identifier that references an ID of an element contained in the SVG element assigned to the\n`src` property",
134
+ "value": {
135
+ "type": [
136
+ "string"
137
+ ]
138
+ }
139
+ },
140
+ {
141
+ "name": "iconClass",
142
+ "description": "Class names defining an icon font and/or a specific glyph inside an icon font.\n\nExample: \"fa-solid fa-user\"",
185
143
  "value": {
186
144
  "type": [
187
145
  "string"
@@ -190,7 +148,16 @@
190
148
  },
191
149
  {
192
150
  "name": "char",
193
- "description": "The specific glyph from a font to use as an icon.\nCan be a code point or a ligature name.",
151
+ "description": "A hexadecimal code point that specifies a glyph from an icon font.\n\nExample: \"e001\"",
152
+ "value": {
153
+ "type": [
154
+ "string"
155
+ ]
156
+ }
157
+ },
158
+ {
159
+ "name": "ligature",
160
+ "description": "A ligature name that specifies an icon from an icon font with support for ligatures.\n\nExample: \"home\".",
194
161
  "value": {
195
162
  "type": [
196
163
  "string"
@@ -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-alpha14",
4
+ "version": "24.2.0-alpha16",
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-alpha14/#/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-alpha16/#/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-alpha14/#/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-alpha14/#/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-alpha16/#/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-alpha16/#/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-alpha14/#/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-alpha16/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
46
46
  "value": {
47
47
  "kind": "expression"
48
48
  }
@@ -62,15 +62,29 @@
62
62
  }
63
63
  },
64
64
  {
65
- "name": ".font",
66
- "description": "Class names defining an icon font and/or a specific glyph inside an icon font.",
65
+ "name": ".symbol",
66
+ "description": "The symbol identifier that references an ID of an element contained in the SVG element assigned to the\n`src` property",
67
+ "value": {
68
+ "kind": "expression"
69
+ }
70
+ },
71
+ {
72
+ "name": ".iconClass",
73
+ "description": "Class names defining an icon font and/or a specific glyph inside an icon font.\n\nExample: \"fa-solid fa-user\"",
67
74
  "value": {
68
75
  "kind": "expression"
69
76
  }
70
77
  },
71
78
  {
72
79
  "name": ".char",
73
- "description": "The specific glyph from a font to use as an icon.\nCan be a code point or a ligature name.",
80
+ "description": "A hexadecimal code point that specifies a glyph from an icon font.\n\nExample: \"e001\"",
81
+ "value": {
82
+ "kind": "expression"
83
+ }
84
+ },
85
+ {
86
+ "name": ".ligature",
87
+ "description": "A ligature name that specifies an icon from an icon font with support for ligatures.\n\nExample: \"home\".",
74
88
  "value": {
75
89
  "kind": "expression"
76
90
  }