@vaadin/message-list 24.2.0-dev.f254716fe → 24.2.0
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 +9 -9
- package/src/vaadin-message-list.js +3 -1
- package/src/vaadin-message.js +3 -1
- package/web-types.json +177 -0
- package/web-types.lit.json +76 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/message-list",
|
|
3
|
-
"version": "24.2.0
|
|
3
|
+
"version": "24.2.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,22 +38,22 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@polymer/polymer": "^3.0.0",
|
|
41
|
-
"@vaadin/a11y-base": "24.2.0
|
|
42
|
-
"@vaadin/avatar": "24.2.0
|
|
43
|
-
"@vaadin/component-base": "24.2.0
|
|
44
|
-
"@vaadin/vaadin-lumo-styles": "24.2.0
|
|
45
|
-
"@vaadin/vaadin-material-styles": "24.2.0
|
|
46
|
-
"@vaadin/vaadin-themable-mixin": "24.2.0
|
|
41
|
+
"@vaadin/a11y-base": "~24.2.0",
|
|
42
|
+
"@vaadin/avatar": "~24.2.0",
|
|
43
|
+
"@vaadin/component-base": "~24.2.0",
|
|
44
|
+
"@vaadin/vaadin-lumo-styles": "~24.2.0",
|
|
45
|
+
"@vaadin/vaadin-material-styles": "~24.2.0",
|
|
46
|
+
"@vaadin/vaadin-themable-mixin": "~24.2.0",
|
|
47
47
|
"lit": "^2.0.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@esm-bundle/chai": "^4.3.4",
|
|
51
|
-
"@vaadin/testing-helpers": "^0.
|
|
51
|
+
"@vaadin/testing-helpers": "^0.5.0",
|
|
52
52
|
"sinon": "^13.0.2"
|
|
53
53
|
},
|
|
54
54
|
"web-types": [
|
|
55
55
|
"web-types.json",
|
|
56
56
|
"web-types.lit.json"
|
|
57
57
|
],
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "8b9e860d53fc0132d05d3e8701eeded2dca74eba"
|
|
59
59
|
}
|
|
@@ -7,6 +7,7 @@ import { html as legacyHtml, PolymerElement } from '@polymer/polymer/polymer-ele
|
|
|
7
7
|
import { html, render } from 'lit';
|
|
8
8
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
9
9
|
import { KeyboardDirectionMixin } from '@vaadin/a11y-base/src/keyboard-direction-mixin.js';
|
|
10
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
10
11
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
11
12
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
13
|
import { Message } from './vaadin-message.js';
|
|
@@ -44,6 +45,7 @@ import { Message } from './vaadin-message.js';
|
|
|
44
45
|
*
|
|
45
46
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
46
47
|
*
|
|
48
|
+
* @customElement
|
|
47
49
|
* @extends HTMLElement
|
|
48
50
|
* @mixes ThemableMixin
|
|
49
51
|
* @mixes ElementMixin
|
|
@@ -205,6 +207,6 @@ class MessageList extends KeyboardDirectionMixin(ElementMixin(ThemableMixin(Poly
|
|
|
205
207
|
}
|
|
206
208
|
}
|
|
207
209
|
|
|
208
|
-
|
|
210
|
+
defineCustomElement(MessageList);
|
|
209
211
|
|
|
210
212
|
export { MessageList };
|
package/src/vaadin-message.js
CHANGED
|
@@ -7,6 +7,7 @@ import '@vaadin/avatar/src/vaadin-avatar.js';
|
|
|
7
7
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
8
8
|
import { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
|
|
9
9
|
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
10
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
10
11
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
11
12
|
import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
|
|
12
13
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
@@ -40,6 +41,7 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
|
|
|
40
41
|
*
|
|
41
42
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
42
43
|
*
|
|
44
|
+
* @customElement
|
|
43
45
|
* @extends HTMLElement
|
|
44
46
|
* @mixes ControllerMixin
|
|
45
47
|
* @mixes FocusMixin
|
|
@@ -205,6 +207,6 @@ class Message extends FocusMixin(ElementMixin(ThemableMixin(ControllerMixin(Poly
|
|
|
205
207
|
}
|
|
206
208
|
}
|
|
207
209
|
|
|
208
|
-
|
|
210
|
+
defineCustomElement(Message);
|
|
209
211
|
|
|
210
212
|
export { Message };
|
package/web-types.json
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
+
"name": "@vaadin/message-list",
|
|
4
|
+
"version": "24.2.0",
|
|
5
|
+
"description-markup": "markdown",
|
|
6
|
+
"contributions": {
|
|
7
|
+
"html": {
|
|
8
|
+
"elements": [
|
|
9
|
+
{
|
|
10
|
+
"name": "vaadin-message",
|
|
11
|
+
"description": "`<vaadin-message>` is a Web Component for showing a single message with an author, message and time.\n\n```html\n<vaadin-message time=\"2021-01-28 10:43\"\n user-name = \"Bob Ross\"\n user-abbr = \"BR\"\n user-img = \"/static/img/avatar.jpg\">There is no real ending. It's just the place where you stop the story.</vaadin-message>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------|----------------\n`name` | Author's name\n`time` | When the message was posted\n`content` | The message itself as a slotted content\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-------------|-------------\n`focus-ring` | Set when the message is focused using the keyboard.\n`focused` | Set when the message is focused.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
|
+
"attributes": [
|
|
13
|
+
{
|
|
14
|
+
"name": "time",
|
|
15
|
+
"description": "Time of sending the message. It is rendered as-is to the part='time' slot,\nso the formatting is up to you.",
|
|
16
|
+
"value": {
|
|
17
|
+
"type": [
|
|
18
|
+
"string",
|
|
19
|
+
"null",
|
|
20
|
+
"undefined"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "user-name",
|
|
26
|
+
"description": "The name of the user posting the message.\nIt will be placed in the name part to indicate who has sent the message.\nIt is also used as a tooltip for the avatar.\nExample: `message.userName = \"Jessica Jacobs\";`",
|
|
27
|
+
"value": {
|
|
28
|
+
"type": [
|
|
29
|
+
"string",
|
|
30
|
+
"null",
|
|
31
|
+
"undefined"
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "user-abbr",
|
|
37
|
+
"description": "The abbreviation of the user.\nThe abbreviation will be passed on to avatar of the message.\nIf the user does not have an avatar picture set with `userImg`, `userAbbr` will be shown in the avatar.\nExample: `message.userAbbr = \"JJ\";`",
|
|
38
|
+
"value": {
|
|
39
|
+
"type": [
|
|
40
|
+
"string",
|
|
41
|
+
"null",
|
|
42
|
+
"undefined"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "user-img",
|
|
48
|
+
"description": "An URL for a user image.\nThe image will be used in the avatar component to show who has sent the message.\nExample: `message.userImg = \"/static/img/avatar.jpg\";`",
|
|
49
|
+
"value": {
|
|
50
|
+
"type": [
|
|
51
|
+
"string",
|
|
52
|
+
"null",
|
|
53
|
+
"undefined"
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "user-color-index",
|
|
59
|
+
"description": "A color index to be used to render the color of the avatar.\nWith no `userColorIndex` set, the basic avatar color will be used.\nBy setting a userColorIndex, the component will check if there exists a CSS variable defining the color, and uses it if there is one.\nIf now CSS variable is found for the color index, the property for the color will not be set.\n\nExample:\nCSS:\n```css\nhtml {\n --vaadin-user-color-1: red;\n}\n```\n\nJavaScript:\n```js\nmessage.userColorIndex = 1;\n```",
|
|
60
|
+
"value": {
|
|
61
|
+
"type": [
|
|
62
|
+
"number",
|
|
63
|
+
"null",
|
|
64
|
+
"undefined"
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "theme",
|
|
70
|
+
"description": "The theme variants to apply to the component.",
|
|
71
|
+
"value": {
|
|
72
|
+
"type": [
|
|
73
|
+
"string",
|
|
74
|
+
"null",
|
|
75
|
+
"undefined"
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
"js": {
|
|
81
|
+
"properties": [
|
|
82
|
+
{
|
|
83
|
+
"name": "time",
|
|
84
|
+
"description": "Time of sending the message. It is rendered as-is to the part='time' slot,\nso the formatting is up to you.",
|
|
85
|
+
"value": {
|
|
86
|
+
"type": [
|
|
87
|
+
"string",
|
|
88
|
+
"null",
|
|
89
|
+
"undefined"
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"name": "userName",
|
|
95
|
+
"description": "The name of the user posting the message.\nIt will be placed in the name part to indicate who has sent the message.\nIt is also used as a tooltip for the avatar.\nExample: `message.userName = \"Jessica Jacobs\";`",
|
|
96
|
+
"value": {
|
|
97
|
+
"type": [
|
|
98
|
+
"string",
|
|
99
|
+
"null",
|
|
100
|
+
"undefined"
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "userAbbr",
|
|
106
|
+
"description": "The abbreviation of the user.\nThe abbreviation will be passed on to avatar of the message.\nIf the user does not have an avatar picture set with `userImg`, `userAbbr` will be shown in the avatar.\nExample: `message.userAbbr = \"JJ\";`",
|
|
107
|
+
"value": {
|
|
108
|
+
"type": [
|
|
109
|
+
"string",
|
|
110
|
+
"null",
|
|
111
|
+
"undefined"
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"name": "userImg",
|
|
117
|
+
"description": "An URL for a user image.\nThe image will be used in the avatar component to show who has sent the message.\nExample: `message.userImg = \"/static/img/avatar.jpg\";`",
|
|
118
|
+
"value": {
|
|
119
|
+
"type": [
|
|
120
|
+
"string",
|
|
121
|
+
"null",
|
|
122
|
+
"undefined"
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": "userColorIndex",
|
|
128
|
+
"description": "A color index to be used to render the color of the avatar.\nWith no `userColorIndex` set, the basic avatar color will be used.\nBy setting a userColorIndex, the component will check if there exists a CSS variable defining the color, and uses it if there is one.\nIf now CSS variable is found for the color index, the property for the color will not be set.\n\nExample:\nCSS:\n```css\nhtml {\n --vaadin-user-color-1: red;\n}\n```\n\nJavaScript:\n```js\nmessage.userColorIndex = 1;\n```",
|
|
129
|
+
"value": {
|
|
130
|
+
"type": [
|
|
131
|
+
"number",
|
|
132
|
+
"null",
|
|
133
|
+
"undefined"
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
"events": []
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"name": "vaadin-message-list",
|
|
143
|
+
"description": "`<vaadin-message-list>` is a Web Component for showing an ordered list of messages. The messages are rendered as <vaadin-message>\n\n### Example\n\nTo create a new message list, add the component to the page:\n\n```html\n<vaadin-message-list></vaadin-message-list>\n```\n\nProvide the messages to the message list with the [`items`](https://cdn.vaadin.com/vaadin-web-components/24.2.0/#/elements/vaadin-message-list#property-items) property.\n\n```js\ndocument.querySelector('vaadin-message-list').items = [\n { text: 'Hello list', time: 'yesterday', userName: 'Matt Mambo', userAbbr: 'MM', userColorIndex: 1 },\n { text: 'Another message', time: 'right now', userName: 'Linsey Listy', userAbbr: 'LL', userColorIndex: 2, userImg: '/static/img/avatar.jpg' }\n];\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------|----------------\n`list` | The container wrapping messages.\n\nSee the [`<vaadin-message>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0/#/elements/vaadin-message) documentation for the available\nstate attributes and stylable shadow parts of message elements.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
144
|
+
"attributes": [
|
|
145
|
+
{
|
|
146
|
+
"name": "theme",
|
|
147
|
+
"description": "The theme variants to apply to the component.",
|
|
148
|
+
"value": {
|
|
149
|
+
"type": [
|
|
150
|
+
"string",
|
|
151
|
+
"null",
|
|
152
|
+
"undefined"
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
"js": {
|
|
158
|
+
"properties": [
|
|
159
|
+
{
|
|
160
|
+
"name": "items",
|
|
161
|
+
"description": "An array of objects which will be rendered as messages.\nThe message objects can have the following properties:\n```js\nArray<{\n text: string,\n time: string,\n userName: string,\n userAbbr: string,\n userImg: string,\n userColorIndex: number,\n theme: string\n}>\n```",
|
|
162
|
+
"value": {
|
|
163
|
+
"type": [
|
|
164
|
+
"Array",
|
|
165
|
+
"null",
|
|
166
|
+
"undefined"
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
],
|
|
171
|
+
"events": []
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
+
"name": "@vaadin/message-list",
|
|
4
|
+
"version": "24.2.0",
|
|
5
|
+
"description-markup": "markdown",
|
|
6
|
+
"framework": "lit",
|
|
7
|
+
"framework-config": {
|
|
8
|
+
"enable-when": {
|
|
9
|
+
"node-packages": [
|
|
10
|
+
"lit"
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"contributions": {
|
|
15
|
+
"html": {
|
|
16
|
+
"elements": [
|
|
17
|
+
{
|
|
18
|
+
"name": "vaadin-message",
|
|
19
|
+
"description": "`<vaadin-message>` is a Web Component for showing a single message with an author, message and time.\n\n```html\n<vaadin-message time=\"2021-01-28 10:43\"\n user-name = \"Bob Ross\"\n user-abbr = \"BR\"\n user-img = \"/static/img/avatar.jpg\">There is no real ending. It's just the place where you stop the story.</vaadin-message>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------|----------------\n`name` | Author's name\n`time` | When the message was posted\n`content` | The message itself as a slotted content\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-------------|-------------\n`focus-ring` | Set when the message is focused using the keyboard.\n`focused` | Set when the message is focused.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
|
+
"extension": true,
|
|
21
|
+
"attributes": [
|
|
22
|
+
{
|
|
23
|
+
"name": ".time",
|
|
24
|
+
"description": "Time of sending the message. It is rendered as-is to the part='time' slot,\nso the formatting is up to you.",
|
|
25
|
+
"value": {
|
|
26
|
+
"kind": "expression"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": ".userName",
|
|
31
|
+
"description": "The name of the user posting the message.\nIt will be placed in the name part to indicate who has sent the message.\nIt is also used as a tooltip for the avatar.\nExample: `message.userName = \"Jessica Jacobs\";`",
|
|
32
|
+
"value": {
|
|
33
|
+
"kind": "expression"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": ".userAbbr",
|
|
38
|
+
"description": "The abbreviation of the user.\nThe abbreviation will be passed on to avatar of the message.\nIf the user does not have an avatar picture set with `userImg`, `userAbbr` will be shown in the avatar.\nExample: `message.userAbbr = \"JJ\";`",
|
|
39
|
+
"value": {
|
|
40
|
+
"kind": "expression"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": ".userImg",
|
|
45
|
+
"description": "An URL for a user image.\nThe image will be used in the avatar component to show who has sent the message.\nExample: `message.userImg = \"/static/img/avatar.jpg\";`",
|
|
46
|
+
"value": {
|
|
47
|
+
"kind": "expression"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": ".userColorIndex",
|
|
52
|
+
"description": "A color index to be used to render the color of the avatar.\nWith no `userColorIndex` set, the basic avatar color will be used.\nBy setting a userColorIndex, the component will check if there exists a CSS variable defining the color, and uses it if there is one.\nIf now CSS variable is found for the color index, the property for the color will not be set.\n\nExample:\nCSS:\n```css\nhtml {\n --vaadin-user-color-1: red;\n}\n```\n\nJavaScript:\n```js\nmessage.userColorIndex = 1;\n```",
|
|
53
|
+
"value": {
|
|
54
|
+
"kind": "expression"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "vaadin-message-list",
|
|
61
|
+
"description": "`<vaadin-message-list>` is a Web Component for showing an ordered list of messages. The messages are rendered as <vaadin-message>\n\n### Example\n\nTo create a new message list, add the component to the page:\n\n```html\n<vaadin-message-list></vaadin-message-list>\n```\n\nProvide the messages to the message list with the [`items`](https://cdn.vaadin.com/vaadin-web-components/24.2.0/#/elements/vaadin-message-list#property-items) property.\n\n```js\ndocument.querySelector('vaadin-message-list').items = [\n { text: 'Hello list', time: 'yesterday', userName: 'Matt Mambo', userAbbr: 'MM', userColorIndex: 1 },\n { text: 'Another message', time: 'right now', userName: 'Linsey Listy', userAbbr: 'LL', userColorIndex: 2, userImg: '/static/img/avatar.jpg' }\n];\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------|----------------\n`list` | The container wrapping messages.\n\nSee the [`<vaadin-message>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0/#/elements/vaadin-message) documentation for the available\nstate attributes and stylable shadow parts of message elements.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
62
|
+
"extension": true,
|
|
63
|
+
"attributes": [
|
|
64
|
+
{
|
|
65
|
+
"name": ".items",
|
|
66
|
+
"description": "An array of objects which will be rendered as messages.\nThe message objects can have the following properties:\n```js\nArray<{\n text: string,\n time: string,\n userName: string,\n userAbbr: string,\n userImg: string,\n userColorIndex: number,\n theme: string\n}>\n```",
|
|
67
|
+
"value": {
|
|
68
|
+
"kind": "expression"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|