@vaadin/message-list 25.0.0-alpha1 → 25.0.0-alpha2

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/message-list",
3
- "version": "25.0.0-alpha1",
3
+ "version": "25.0.0-alpha2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,23 +37,23 @@
37
37
  ],
38
38
  "dependencies": {
39
39
  "@open-wc/dedupe-mixin": "^1.3.0",
40
- "@vaadin/a11y-base": "25.0.0-alpha1",
41
- "@vaadin/avatar": "25.0.0-alpha1",
42
- "@vaadin/component-base": "25.0.0-alpha1",
43
- "@vaadin/markdown": "25.0.0-alpha1",
44
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha1",
45
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha1",
40
+ "@vaadin/a11y-base": "25.0.0-alpha2",
41
+ "@vaadin/avatar": "25.0.0-alpha2",
42
+ "@vaadin/component-base": "25.0.0-alpha2",
43
+ "@vaadin/markdown": "25.0.0-alpha2",
44
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha2",
45
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha2",
46
46
  "lit": "^3.0.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@vaadin/chai-plugins": "25.0.0-alpha1",
50
- "@vaadin/test-runner-commands": "25.0.0-alpha1",
51
- "@vaadin/testing-helpers": "^1.1.0",
49
+ "@vaadin/chai-plugins": "25.0.0-alpha2",
50
+ "@vaadin/test-runner-commands": "25.0.0-alpha2",
51
+ "@vaadin/testing-helpers": "^2.0.0",
52
52
  "sinon": "^18.0.0"
53
53
  },
54
54
  "web-types": [
55
55
  "web-types.json",
56
56
  "web-types.lit.json"
57
57
  ],
58
- "gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49"
58
+ "gitHead": "67ffcd5355cf21ce1b5039c598525109fc4c164b"
59
59
  }
@@ -44,4 +44,10 @@ export declare class MessageListMixinClass {
44
44
  * When set to `true`, the message text is parsed as Markdown.
45
45
  */
46
46
  markdown: boolean | undefined;
47
+
48
+ /**
49
+ * When set to `true`, new messages are announced to assistive technologies using ARIA live regions.
50
+ * @attr {boolean} announce-messages
51
+ */
52
+ announceMessages: boolean | undefined;
47
53
  }
@@ -47,6 +47,18 @@ export const MessageListMixin = (superClass) =>
47
47
  observer: '__markdownChanged',
48
48
  reflectToAttribute: true,
49
49
  },
50
+
51
+ /**
52
+ * When set to `true`, new messages are announced to assistive technologies using ARIA live regions.
53
+ * @attr {boolean} announce-messages
54
+ * @type {boolean}
55
+ */
56
+ announceMessages: {
57
+ type: Boolean,
58
+ value: false,
59
+ observer: '__announceChanged',
60
+ sync: true,
61
+ },
50
62
  };
51
63
  }
52
64
 
@@ -61,7 +73,7 @@ export const MessageListMixin = (superClass) =>
61
73
 
62
74
  // Make screen readers announce new messages
63
75
  this.setAttribute('aria-relevant', 'additions');
64
- this.setAttribute('role', 'log');
76
+ this.setAttribute('role', 'region');
65
77
  }
66
78
 
67
79
  /**
@@ -175,4 +187,9 @@ export const MessageListMixin = (superClass) =>
175
187
  const index = this._messages.findIndex((e) => e.tabIndex === 0);
176
188
  return index !== -1 ? index : 0;
177
189
  }
190
+
191
+ /** @private */
192
+ __announceChanged(announceMessages) {
193
+ this.ariaLive = announceMessages ? 'polite' : null;
194
+ }
178
195
  };
@@ -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 { SlotStylesMixin } from '@vaadin/component-base/src/slot-styles-mixin.js';
7
8
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
9
  import { MessageListMixin } from './vaadin-message-list-mixin.js';
9
10
 
@@ -42,7 +43,7 @@ export { MessageListItem } from './vaadin-message-list-mixin.js';
42
43
  *
43
44
  * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
44
45
  */
45
- declare class MessageList extends MessageListMixin(ThemableMixin(ElementMixin(HTMLElement))) {}
46
+ declare class MessageList extends SlotStylesMixin(MessageListMixin(ThemableMixin(ElementMixin(HTMLElement)))) {}
46
47
 
47
48
  declare global {
48
49
  interface HTMLElementTagNameMap {
@@ -8,6 +8,7 @@ import { css, html, LitElement } from 'lit';
8
8
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
9
9
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
10
10
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
11
+ import { SlotStylesMixin } from '@vaadin/component-base/src/slot-styles-mixin.js';
11
12
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
12
13
  import { MessageListMixin } from './vaadin-message-list-mixin.js';
13
14
 
@@ -49,8 +50,9 @@ import { MessageListMixin } from './vaadin-message-list-mixin.js';
49
50
  * @mixes ThemableMixin
50
51
  * @mixes ElementMixin
51
52
  * @mixes MessageListMixin
53
+ * @mixes SlotStylesMixin
52
54
  */
53
- class MessageList extends MessageListMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
55
+ class MessageList extends SlotStylesMixin(MessageListMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement))))) {
54
56
  static get is() {
55
57
  return 'vaadin-message-list';
56
58
  }
@@ -76,6 +78,22 @@ class MessageList extends MessageListMixin(ElementMixin(ThemableMixin(PolylitMix
76
78
  </div>
77
79
  `;
78
80
  }
81
+
82
+ /** @protected */
83
+ get slotStyles() {
84
+ const tag = this.localName;
85
+ return [
86
+ `
87
+ ${tag} :where(vaadin-markdown > :is(h1, h2, h3, h4, h5, h6, p, ul, ol):first-child) {
88
+ margin-top: 0;
89
+ }
90
+
91
+ ${tag} :where(vaadin-markdown > :is(h1, h2, h3, h4, h5, h6, p, ul, ol):last-child) {
92
+ margin-bottom: 0;
93
+ }
94
+ `,
95
+ ];
96
+ }
79
97
  }
80
98
 
81
99
  defineCustomElement(MessageList);
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": "25.0.0-alpha1",
4
+ "version": "25.0.0-alpha2",
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/25.0.0-alpha1/#/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/25.0.0-alpha1/#/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.",
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/25.0.0-alpha2/#/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/25.0.0-alpha2/#/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": []
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/message-list",
4
- "version": "25.0.0-alpha1",
4
+ "version": "25.0.0-alpha2",
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/25.0.0-alpha1/#/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/25.0.0-alpha1/#/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.",
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/25.0.0-alpha2/#/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/25.0.0-alpha2/#/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```",