@vaadin/icon 24.0.0-alpha9 → 24.0.0-beta2
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 +6 -6
- package/src/vaadin-icon.js +20 -36
- package/src/vaadin-iconset.d.ts +18 -7
- package/src/vaadin-iconset.js +102 -40
- package/web-types.json +6 -6
- package/web-types.lit.json +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/icon",
|
|
3
|
-
"version": "24.0.0-
|
|
3
|
+
"version": "24.0.0-beta2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,19 +35,19 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@polymer/polymer": "^3.0.0",
|
|
38
|
-
"@vaadin/component-base": "24.0.0-
|
|
39
|
-
"@vaadin/vaadin-lumo-styles": "24.0.0-
|
|
40
|
-
"@vaadin/vaadin-themable-mixin": "24.0.0-
|
|
38
|
+
"@vaadin/component-base": "24.0.0-beta2",
|
|
39
|
+
"@vaadin/vaadin-lumo-styles": "24.0.0-beta2",
|
|
40
|
+
"@vaadin/vaadin-themable-mixin": "24.0.0-beta2",
|
|
41
41
|
"lit": "^2.0.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@esm-bundle/chai": "^4.3.4",
|
|
45
|
-
"@vaadin/testing-helpers": "^0.
|
|
45
|
+
"@vaadin/testing-helpers": "^0.4.0",
|
|
46
46
|
"sinon": "^13.0.2"
|
|
47
47
|
},
|
|
48
48
|
"web-types": [
|
|
49
49
|
"web-types.json",
|
|
50
50
|
"web-types.lit.json"
|
|
51
51
|
],
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "00086f1f6d487f042f189c9b9ecd7ba736960888"
|
|
53
53
|
}
|
package/src/vaadin-icon.js
CHANGED
|
@@ -11,8 +11,6 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
|
|
|
11
11
|
import { ensureSvgLiteral, renderSvg } from './vaadin-icon-svg.js';
|
|
12
12
|
import { Iconset } from './vaadin-iconset.js';
|
|
13
13
|
|
|
14
|
-
const DEFAULT_ICONSET = 'vaadin';
|
|
15
|
-
|
|
16
14
|
/**
|
|
17
15
|
* `<vaadin-icon>` is a Web Component for displaying SVG icons.
|
|
18
16
|
*
|
|
@@ -143,11 +141,6 @@ class Icon extends ThemableMixin(ElementMixin(ControllerMixin(PolymerElement)))
|
|
|
143
141
|
return ['__svgChanged(svg, __svgElement)'];
|
|
144
142
|
}
|
|
145
143
|
|
|
146
|
-
constructor() {
|
|
147
|
-
super();
|
|
148
|
-
this.__onIconsetRegistered = this.__onIconsetRegistered.bind(this);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
144
|
/** @protected */
|
|
152
145
|
ready() {
|
|
153
146
|
super.ready();
|
|
@@ -157,48 +150,39 @@ class Icon extends ThemableMixin(ElementMixin(ControllerMixin(PolymerElement)))
|
|
|
157
150
|
this.addController(this._tooltipController);
|
|
158
151
|
}
|
|
159
152
|
|
|
160
|
-
/** @private */
|
|
161
|
-
__getIconsetName(icon) {
|
|
162
|
-
if (!icon) {
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
const parts = icon.split(':');
|
|
167
|
-
return parts[0] || DEFAULT_ICONSET;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/** @private */
|
|
171
|
-
__onIconsetRegistered(e) {
|
|
172
|
-
if (e.detail === this.__getIconsetName(this.icon)) {
|
|
173
|
-
this.__iconChanged(this.icon);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
153
|
/** @protected */
|
|
178
154
|
connectedCallback() {
|
|
179
155
|
super.connectedCallback();
|
|
180
|
-
|
|
156
|
+
|
|
157
|
+
Iconset.attachedIcons.add(this);
|
|
181
158
|
}
|
|
182
159
|
|
|
183
160
|
/** @protected */
|
|
184
161
|
disconnectedCallback() {
|
|
185
162
|
super.disconnectedCallback();
|
|
186
|
-
|
|
163
|
+
|
|
164
|
+
Iconset.attachedIcons.delete(this);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** @protected */
|
|
168
|
+
_applyIcon() {
|
|
169
|
+
const { svg, size, viewBox } = Iconset.getIconSvg(this.icon);
|
|
170
|
+
|
|
171
|
+
if (viewBox) {
|
|
172
|
+
this.__viewBox = viewBox;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (size && size !== this.size) {
|
|
176
|
+
this.size = size;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
this.svg = svg;
|
|
187
180
|
}
|
|
188
181
|
|
|
189
182
|
/** @private */
|
|
190
183
|
__iconChanged(icon) {
|
|
191
184
|
if (icon) {
|
|
192
|
-
|
|
193
|
-
const iconset = Iconset.getIconset(iconsetName);
|
|
194
|
-
const { svg, size, viewBox } = iconset.applyIcon(icon);
|
|
195
|
-
if (viewBox) {
|
|
196
|
-
this.__viewBox = viewBox;
|
|
197
|
-
}
|
|
198
|
-
if (size !== this.size) {
|
|
199
|
-
this.size = size;
|
|
200
|
-
}
|
|
201
|
-
this.svg = svg;
|
|
185
|
+
this._applyIcon();
|
|
202
186
|
} else {
|
|
203
187
|
this.svg = ensureSvgLiteral(null);
|
|
204
188
|
}
|
package/src/vaadin-iconset.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
7
|
+
import type { Icon } from './vaadin-icon.js';
|
|
7
8
|
import type { IconSvgLiteral } from './vaadin-icon-svg.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -11,10 +12,26 @@ import type { IconSvgLiteral } from './vaadin-icon-svg.js';
|
|
|
11
12
|
*/
|
|
12
13
|
declare class Iconset extends ElementMixin(HTMLElement) {
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
+
* Set of the `vaadin-icon` instances in the DOM.
|
|
16
|
+
*/
|
|
17
|
+
static attachedIcons(): Set<Icon>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Returns an instance of the iconset by its name.
|
|
15
21
|
*/
|
|
16
22
|
static getIconset(name: string): Iconset;
|
|
17
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Register an iconset without adding to the DOM.
|
|
26
|
+
*/
|
|
27
|
+
static register(name: string, size: number, template: HTMLTemplateElement): void;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Returns SVGTemplateResult for the `icon` ID matching `name` of the
|
|
31
|
+
* iconset, or `nothing` literal if there is no matching icon found.
|
|
32
|
+
*/
|
|
33
|
+
static getIconSvg(icon: string, name?: string): { svg: IconSvgLiteral; size?: number; viewBox?: string | null };
|
|
34
|
+
|
|
18
35
|
/**
|
|
19
36
|
* The name of the iconset. Every iconset is required to have its own unique name.
|
|
20
37
|
* All the SVG icons in the iconset must have IDs conforming to its name.
|
|
@@ -30,12 +47,6 @@ declare class Iconset extends ElementMixin(HTMLElement) {
|
|
|
30
47
|
* over the size defined by the user to ensure correct appearance.
|
|
31
48
|
*/
|
|
32
49
|
size: number;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Produce SVGTemplateResult for the element matching `name` in this
|
|
36
|
-
* iconset, or `undefined` if there is no matching element.
|
|
37
|
-
*/
|
|
38
|
-
applyIcon(name: string): { svg: IconSvgLiteral; size: number; viewBox: string | null };
|
|
39
50
|
}
|
|
40
51
|
|
|
41
52
|
declare global {
|
package/src/vaadin-iconset.js
CHANGED
|
@@ -7,7 +7,32 @@ import { PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
|
7
7
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
8
8
|
import { cloneSvgNode } from './vaadin-icon-svg.js';
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const iconsetRegistry = {};
|
|
11
|
+
|
|
12
|
+
const attachedIcons = new Set();
|
|
13
|
+
|
|
14
|
+
function getIconId(id, name) {
|
|
15
|
+
return (id || '').replace(`${name}:`, '');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function getIconsetName(icon) {
|
|
19
|
+
if (!icon) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const parts = icon.split(':');
|
|
24
|
+
|
|
25
|
+
// Use "vaadin" as a fallback
|
|
26
|
+
return parts[0] || 'vaadin';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function initIconsMap(iconset, name) {
|
|
30
|
+
iconset._icons = [...iconset.querySelectorAll('[id]')].reduce((map, svg) => {
|
|
31
|
+
const key = getIconId(svg.id, name);
|
|
32
|
+
map[key] = svg;
|
|
33
|
+
return map;
|
|
34
|
+
}, {});
|
|
35
|
+
}
|
|
11
36
|
|
|
12
37
|
/**
|
|
13
38
|
* `<vaadin-iconset>` is a Web Component for creating SVG icon collections.
|
|
@@ -51,18 +76,72 @@ class Iconset extends ElementMixin(PolymerElement) {
|
|
|
51
76
|
}
|
|
52
77
|
|
|
53
78
|
/**
|
|
54
|
-
*
|
|
79
|
+
* Set of the `vaadin-icon` instances in the DOM.
|
|
80
|
+
*
|
|
81
|
+
* @return {Set<Icon>}
|
|
82
|
+
*/
|
|
83
|
+
static get attachedIcons() {
|
|
84
|
+
return attachedIcons;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Returns an instance of the iconset by its name.
|
|
55
89
|
*
|
|
56
90
|
* @param {string} name
|
|
91
|
+
* @return {Iconset}
|
|
57
92
|
*/
|
|
58
93
|
static getIconset(name) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
94
|
+
return iconsetRegistry[name];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Returns SVGTemplateResult for the `icon` ID matching `name` of the
|
|
99
|
+
* iconset, or `nothing` literal if there is no matching icon found.
|
|
100
|
+
*
|
|
101
|
+
* @param {string} icon
|
|
102
|
+
* @param {?string} name
|
|
103
|
+
*/
|
|
104
|
+
static getIconSvg(icon, name) {
|
|
105
|
+
const iconsetName = name || getIconsetName(icon);
|
|
106
|
+
const iconset = this.getIconset(iconsetName);
|
|
107
|
+
|
|
108
|
+
if (!icon || !iconset) {
|
|
109
|
+
// Missing icon, return `nothing` literal.
|
|
110
|
+
return { svg: cloneSvgNode(null) };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const iconId = getIconId(icon, iconsetName);
|
|
114
|
+
const iconSvg = iconset._icons[iconId];
|
|
115
|
+
|
|
116
|
+
return {
|
|
117
|
+
svg: cloneSvgNode(iconSvg),
|
|
118
|
+
size: iconset.size,
|
|
119
|
+
viewBox: iconSvg ? iconSvg.getAttribute('viewBox') : null,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Register an iconset without adding to the DOM.
|
|
125
|
+
*
|
|
126
|
+
* @param {string} name
|
|
127
|
+
* @param {number} size
|
|
128
|
+
* @param {?HTMLTemplateElement} template
|
|
129
|
+
*/
|
|
130
|
+
static register(name, size, template) {
|
|
131
|
+
if (!iconsetRegistry[name]) {
|
|
132
|
+
const iconset = document.createElement('vaadin-iconset');
|
|
133
|
+
iconset.appendChild(template.content.cloneNode(true));
|
|
134
|
+
iconsetRegistry[name] = iconset;
|
|
135
|
+
|
|
136
|
+
initIconsMap(iconset, name);
|
|
137
|
+
|
|
138
|
+
iconset.size = size;
|
|
62
139
|
iconset.name = name;
|
|
63
|
-
|
|
140
|
+
|
|
141
|
+
// Call this function manually instead of using observer
|
|
142
|
+
// to make it work without appending element to the DOM.
|
|
143
|
+
iconset.__nameChanged(name);
|
|
64
144
|
}
|
|
65
|
-
return iconset;
|
|
66
145
|
}
|
|
67
146
|
|
|
68
147
|
/** @protected */
|
|
@@ -70,53 +149,36 @@ class Iconset extends ElementMixin(PolymerElement) {
|
|
|
70
149
|
super.connectedCallback();
|
|
71
150
|
|
|
72
151
|
this.style.display = 'none';
|
|
152
|
+
|
|
153
|
+
// Store reference and init icons.
|
|
154
|
+
const { name } = this;
|
|
155
|
+
iconsetRegistry[name] = this;
|
|
156
|
+
initIconsMap(this, name);
|
|
157
|
+
this.__updateIcons(name);
|
|
73
158
|
}
|
|
74
159
|
|
|
75
160
|
/**
|
|
76
|
-
*
|
|
77
|
-
* iconset, or `undefined` if there is no matching element.
|
|
161
|
+
* Update all the icons instances in the DOM.
|
|
78
162
|
*
|
|
79
163
|
* @param {string} name
|
|
164
|
+
* @private
|
|
80
165
|
*/
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
const icon = this._icons[this.__getIconId(name)];
|
|
88
|
-
return {
|
|
89
|
-
svg: cloneSvgNode(icon),
|
|
90
|
-
size: this.size,
|
|
91
|
-
viewBox: icon ? icon.getAttribute('viewBox') : null,
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Create a map of child SVG elements by id.
|
|
97
|
-
*/
|
|
98
|
-
__createIconMap() {
|
|
99
|
-
const icons = {};
|
|
100
|
-
this.querySelectorAll('[id]').forEach((icon) => {
|
|
101
|
-
icons[this.__getIconId(icon.id)] = icon;
|
|
166
|
+
__updateIcons(name) {
|
|
167
|
+
attachedIcons.forEach((element) => {
|
|
168
|
+
if (name === getIconsetName(element.icon)) {
|
|
169
|
+
element._applyIcon();
|
|
170
|
+
}
|
|
102
171
|
});
|
|
103
|
-
return icons;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/** @private */
|
|
107
|
-
__getIconId(id) {
|
|
108
|
-
return (id || '').replace(`${this.name}:`, '');
|
|
109
172
|
}
|
|
110
173
|
|
|
111
174
|
/** @private */
|
|
112
175
|
__nameChanged(name, oldName) {
|
|
113
176
|
if (oldName) {
|
|
114
|
-
|
|
115
|
-
delete
|
|
177
|
+
iconsetRegistry[name] = iconsetRegistry[oldName];
|
|
178
|
+
delete iconsetRegistry[oldName];
|
|
116
179
|
}
|
|
117
180
|
if (name) {
|
|
118
|
-
|
|
119
|
-
document.dispatchEvent(new CustomEvent('vaadin-iconset-registered', { detail: name }));
|
|
181
|
+
this.__updateIcons(name);
|
|
120
182
|
}
|
|
121
183
|
}
|
|
122
184
|
}
|
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.0.0-
|
|
4
|
+
"version": "24.0.0-beta2",
|
|
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.0.0-
|
|
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.0.0-beta2/#/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.0.0-
|
|
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.0.0-beta2/#/elements/vaadin-icon#property-name) property of `vaadin-icon`.",
|
|
52
52
|
"value": {
|
|
53
53
|
"type": [
|
|
54
54
|
"string",
|
|
@@ -74,11 +74,11 @@
|
|
|
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.0.0-
|
|
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.0.0-beta2/#/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.0.0-beta2/#/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.0.0-
|
|
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.0.0-beta2/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
|
|
82
82
|
"value": {
|
|
83
83
|
"type": [
|
|
84
84
|
"string",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"properties": [
|
|
115
115
|
{
|
|
116
116
|
"name": "icon",
|
|
117
|
-
"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.0.0-
|
|
117
|
+
"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.0.0-beta2/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
|
|
118
118
|
"value": {
|
|
119
119
|
"type": [
|
|
120
120
|
"string",
|
package/web-types.lit.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.0.0-
|
|
4
|
+
"version": "24.0.0-beta2",
|
|
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.0.0-
|
|
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.0.0-beta2/#/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.0.0-
|
|
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.0.0-beta2/#/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.0.0-beta2/#/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.0.0-
|
|
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.0.0-beta2/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
|
|
46
46
|
"value": {
|
|
47
47
|
"kind": "expression"
|
|
48
48
|
}
|