@vaadin/message-list 24.8.0-alpha17 → 24.8.0-alpha19
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 +11 -11
- package/src/vaadin-message-list-mixin.d.ts +11 -1
- package/src/vaadin-message-list-mixin.js +50 -4
- package/theme/lumo/vaadin-message-list.d.ts +1 -1
- package/theme/lumo/vaadin-message-list.js +1 -1
- package/theme/material/vaadin-message-list.d.ts +1 -1
- package/theme/material/vaadin-message-list.js +1 -1
- package/web-types.json +20 -2
- package/web-types.lit.json +9 -2
- package/src/vaadin-lit-message-list.d.ts +0 -1
- package/src/vaadin-lit-message.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/message-list",
|
|
3
|
-
"version": "24.8.0-
|
|
3
|
+
"version": "24.8.0-alpha19",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -39,18 +39,18 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
41
41
|
"@polymer/polymer": "^3.0.0",
|
|
42
|
-
"@vaadin/a11y-base": "24.8.0-
|
|
43
|
-
"@vaadin/avatar": "24.8.0-
|
|
44
|
-
"@vaadin/component-base": "24.8.0-
|
|
45
|
-
"@vaadin/markdown": "24.8.0-
|
|
46
|
-
"@vaadin/vaadin-lumo-styles": "24.8.0-
|
|
47
|
-
"@vaadin/vaadin-material-styles": "24.8.0-
|
|
48
|
-
"@vaadin/vaadin-themable-mixin": "24.8.0-
|
|
42
|
+
"@vaadin/a11y-base": "24.8.0-alpha19",
|
|
43
|
+
"@vaadin/avatar": "24.8.0-alpha19",
|
|
44
|
+
"@vaadin/component-base": "24.8.0-alpha19",
|
|
45
|
+
"@vaadin/markdown": "24.8.0-alpha19",
|
|
46
|
+
"@vaadin/vaadin-lumo-styles": "24.8.0-alpha19",
|
|
47
|
+
"@vaadin/vaadin-material-styles": "24.8.0-alpha19",
|
|
48
|
+
"@vaadin/vaadin-themable-mixin": "24.8.0-alpha19",
|
|
49
49
|
"lit": "^3.0.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@vaadin/chai-plugins": "24.8.0-
|
|
53
|
-
"@vaadin/test-runner-commands": "24.8.0-
|
|
52
|
+
"@vaadin/chai-plugins": "24.8.0-alpha19",
|
|
53
|
+
"@vaadin/test-runner-commands": "24.8.0-alpha19",
|
|
54
54
|
"@vaadin/testing-helpers": "^1.1.0",
|
|
55
55
|
"sinon": "^18.0.0"
|
|
56
56
|
},
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"web-types.json",
|
|
59
59
|
"web-types.lit.json"
|
|
60
60
|
],
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "b66da924889a1316f7881742a13b80e1c95a4cc4"
|
|
62
62
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
7
|
import type { KeyboardDirectionMixinClass } from '@vaadin/a11y-base/src/keyboard-direction-mixin.js';
|
|
8
|
+
import type { SlotStylesMixinClass } from '@vaadin/component-base/src/slot-styles-mixin.js';
|
|
8
9
|
|
|
9
10
|
export interface MessageListItem {
|
|
10
11
|
text?: string;
|
|
@@ -19,7 +20,10 @@ export interface MessageListItem {
|
|
|
19
20
|
|
|
20
21
|
export declare function MessageListMixin<T extends Constructor<HTMLElement>>(
|
|
21
22
|
base: T,
|
|
22
|
-
): Constructor<KeyboardDirectionMixinClass> &
|
|
23
|
+
): Constructor<KeyboardDirectionMixinClass> &
|
|
24
|
+
Constructor<MessageListMixinClass> &
|
|
25
|
+
Constructor<SlotStylesMixinClass> &
|
|
26
|
+
T;
|
|
23
27
|
|
|
24
28
|
export declare class MessageListMixinClass {
|
|
25
29
|
/**
|
|
@@ -44,4 +48,10 @@ export declare class MessageListMixinClass {
|
|
|
44
48
|
* When set to `true`, the message text is parsed as Markdown.
|
|
45
49
|
*/
|
|
46
50
|
markdown: boolean | undefined;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* When set to `true`, new messages are announced to assistive technologies using ARIA live regions.
|
|
54
|
+
* @attr {boolean} announce-messages
|
|
55
|
+
*/
|
|
56
|
+
announceMessages: boolean | undefined;
|
|
47
57
|
}
|
|
@@ -3,17 +3,18 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import '@vaadin/markdown/src/vaadin-markdown.js';
|
|
7
6
|
import { html, render } from 'lit';
|
|
8
7
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
9
8
|
import { KeyboardDirectionMixin } from '@vaadin/a11y-base/src/keyboard-direction-mixin.js';
|
|
9
|
+
import { SlotStylesMixin } from '@vaadin/component-base/src/slot-styles-mixin';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @polymerMixin
|
|
13
13
|
* @mixes KeyboardDirectionMixin
|
|
14
|
+
* @mixes SlotStylesMixin
|
|
14
15
|
*/
|
|
15
16
|
export const MessageListMixin = (superClass) =>
|
|
16
|
-
class MessageListMixinClass extends KeyboardDirectionMixin(superClass) {
|
|
17
|
+
class MessageListMixinClass extends SlotStylesMixin(KeyboardDirectionMixin(superClass)) {
|
|
17
18
|
static get properties() {
|
|
18
19
|
return {
|
|
19
20
|
/**
|
|
@@ -48,6 +49,18 @@ export const MessageListMixin = (superClass) =>
|
|
|
48
49
|
observer: '__markdownChanged',
|
|
49
50
|
reflectToAttribute: true,
|
|
50
51
|
},
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* When set to `true`, new messages are announced to assistive technologies using ARIA live regions.
|
|
55
|
+
* @attr {boolean} announce-messages
|
|
56
|
+
* @type {boolean}
|
|
57
|
+
*/
|
|
58
|
+
announceMessages: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
value: false,
|
|
61
|
+
observer: '__announceChanged',
|
|
62
|
+
sync: true,
|
|
63
|
+
},
|
|
51
64
|
};
|
|
52
65
|
}
|
|
53
66
|
|
|
@@ -62,7 +75,23 @@ export const MessageListMixin = (superClass) =>
|
|
|
62
75
|
|
|
63
76
|
// Make screen readers announce new messages
|
|
64
77
|
this.setAttribute('aria-relevant', 'additions');
|
|
65
|
-
this.setAttribute('role', '
|
|
78
|
+
this.setAttribute('role', 'region');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** @protected */
|
|
82
|
+
get slotStyles() {
|
|
83
|
+
const tag = this.localName;
|
|
84
|
+
return [
|
|
85
|
+
`
|
|
86
|
+
${tag} :where(vaadin-markdown > :is(h1, h2, h3, h4, h5, h6, p, ul, ol):first-child) {
|
|
87
|
+
margin-top: 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
${tag} :where(vaadin-markdown > :is(h1, h2, h3, h4, h5, h6, p, ul, ol):last-child) {
|
|
91
|
+
margin-bottom: 0;
|
|
92
|
+
}
|
|
93
|
+
`,
|
|
94
|
+
];
|
|
66
95
|
}
|
|
67
96
|
|
|
68
97
|
/**
|
|
@@ -98,12 +127,23 @@ export const MessageListMixin = (superClass) =>
|
|
|
98
127
|
}
|
|
99
128
|
|
|
100
129
|
/** @private */
|
|
101
|
-
__markdownChanged(
|
|
130
|
+
__markdownChanged(markdown) {
|
|
131
|
+
if (markdown && !customElements.get('vaadin-markdown')) {
|
|
132
|
+
// Dynamically import the markdown component
|
|
133
|
+
import('@vaadin/markdown/src/vaadin-markdown.js')
|
|
134
|
+
// Wait until the component is defined
|
|
135
|
+
.then(() => customElements.whenDefined('vaadin-markdown'))
|
|
136
|
+
// Render the messages again
|
|
137
|
+
.then(() => this._renderMessages(this.items));
|
|
138
|
+
}
|
|
102
139
|
this._renderMessages(this.items);
|
|
103
140
|
}
|
|
104
141
|
|
|
105
142
|
/** @private */
|
|
106
143
|
_renderMessages(items) {
|
|
144
|
+
// Check if markdown component is still loading
|
|
145
|
+
const loadingMarkdown = this.markdown && !customElements.get('vaadin-markdown');
|
|
146
|
+
|
|
107
147
|
render(
|
|
108
148
|
html`
|
|
109
149
|
${items.map(
|
|
@@ -118,6 +158,7 @@ export const MessageListMixin = (superClass) =>
|
|
|
118
158
|
theme="${ifDefined(item.theme)}"
|
|
119
159
|
class="${ifDefined(item.className)}"
|
|
120
160
|
@focusin="${this._onMessageFocusIn}"
|
|
161
|
+
style="${ifDefined(loadingMarkdown ? 'visibility: hidden' : undefined)}"
|
|
121
162
|
>${this.markdown
|
|
122
163
|
? html`<vaadin-markdown .content=${item.text}></vaadin-markdown>`
|
|
123
164
|
: item.text}<vaadin-avatar slot="avatar"></vaadin-avatar
|
|
@@ -164,4 +205,9 @@ export const MessageListMixin = (superClass) =>
|
|
|
164
205
|
const index = this._messages.findIndex((e) => e.tabIndex === 0);
|
|
165
206
|
return index !== -1 ? index : 0;
|
|
166
207
|
}
|
|
208
|
+
|
|
209
|
+
/** @private */
|
|
210
|
+
__announceChanged(announceMessages) {
|
|
211
|
+
this.ariaLive = announceMessages ? 'polite' : null;
|
|
212
|
+
}
|
|
167
213
|
};
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/message-list",
|
|
4
|
-
"version": "24.8.0-
|
|
4
|
+
"version": "24.8.0-alpha19",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
},
|
|
141
141
|
{
|
|
142
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.8.0-
|
|
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.8.0-alpha19/#/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.8.0-alpha19/#/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
144
|
"attributes": [
|
|
145
145
|
{
|
|
146
146
|
"name": "markdown",
|
|
@@ -151,6 +151,15 @@
|
|
|
151
151
|
]
|
|
152
152
|
}
|
|
153
153
|
},
|
|
154
|
+
{
|
|
155
|
+
"name": "announce-messages",
|
|
156
|
+
"description": "When set to `true`, new messages are announced to assistive technologies using ARIA live regions.",
|
|
157
|
+
"value": {
|
|
158
|
+
"type": [
|
|
159
|
+
"boolean"
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
},
|
|
154
163
|
{
|
|
155
164
|
"name": "theme",
|
|
156
165
|
"description": "The theme variants to apply to the component.",
|
|
@@ -184,6 +193,15 @@
|
|
|
184
193
|
"boolean"
|
|
185
194
|
]
|
|
186
195
|
}
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"name": "announceMessages",
|
|
199
|
+
"description": "When set to `true`, new messages are announced to assistive technologies using ARIA live regions.",
|
|
200
|
+
"value": {
|
|
201
|
+
"type": [
|
|
202
|
+
"boolean"
|
|
203
|
+
]
|
|
204
|
+
}
|
|
187
205
|
}
|
|
188
206
|
],
|
|
189
207
|
"events": []
|
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/message-list",
|
|
4
|
-
"version": "24.8.0-
|
|
4
|
+
"version": "24.8.0-alpha19",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
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.8.0-
|
|
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.8.0-alpha19/#/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.8.0-alpha19/#/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
62
|
"extension": true,
|
|
63
63
|
"attributes": [
|
|
64
64
|
{
|
|
@@ -68,6 +68,13 @@
|
|
|
68
68
|
"kind": "expression"
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
|
+
{
|
|
72
|
+
"name": "?announceMessages",
|
|
73
|
+
"description": "When set to `true`, new messages are announced to assistive technologies using ARIA live regions.",
|
|
74
|
+
"value": {
|
|
75
|
+
"kind": "expression"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
71
78
|
{
|
|
72
79
|
"name": ".items",
|
|
73
80
|
"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 className: string,\n theme: string\n}>\n```",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './vaadin-message-list.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './vaadin-message.js';
|