@vaadin/message-list 23.3.0-alpha3 → 24.0.0-alpha1

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": "23.3.0-alpha3",
3
+ "version": "24.0.0-alpha1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,11 +38,11 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "@polymer/polymer": "^3.0.0",
41
- "@vaadin/avatar": "23.3.0-alpha3",
42
- "@vaadin/component-base": "23.3.0-alpha3",
43
- "@vaadin/vaadin-lumo-styles": "23.3.0-alpha3",
44
- "@vaadin/vaadin-material-styles": "23.3.0-alpha3",
45
- "@vaadin/vaadin-themable-mixin": "23.3.0-alpha3"
41
+ "@vaadin/avatar": "24.0.0-alpha1",
42
+ "@vaadin/component-base": "24.0.0-alpha1",
43
+ "@vaadin/vaadin-lumo-styles": "24.0.0-alpha1",
44
+ "@vaadin/vaadin-material-styles": "24.0.0-alpha1",
45
+ "@vaadin/vaadin-themable-mixin": "24.0.0-alpha1"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@esm-bundle/chai": "^4.3.4",
@@ -53,5 +53,5 @@
53
53
  "web-types.json",
54
54
  "web-types.lit.json"
55
55
  ],
56
- "gitHead": "e86cd2abf3e28bade37711291331415d92c454ec"
56
+ "gitHead": "427527c27c4b27822d61fd41d38d7b170134770b"
57
57
  }
@@ -21,12 +21,15 @@ export interface MessageListItem {
21
21
  * `<vaadin-message-list>` is a Web Component for showing an ordered list of messages. The messages are rendered as <vaadin-message>
22
22
  *
23
23
  * ### Example
24
+ *
24
25
  * To create a new message list, add the component to the page:
26
+ *
25
27
  * ```html
26
28
  * <vaadin-message-list></vaadin-message-list>
27
29
  * ```
28
30
  *
29
- * Provide the messages to the message list with the `items` property.
31
+ * Provide the messages to the message list with the [`items`](#/elements/vaadin-message-list#property-items) property.
32
+ *
30
33
  * ```js
31
34
  * document.querySelector('vaadin-message-list').items = [
32
35
  * { text: 'Hello list', time: 'yesterday', userName: 'Matt Mambo', userAbbr: 'MM', userColorIndex: 1 },
@@ -42,6 +45,9 @@ export interface MessageListItem {
42
45
  * ----------|----------------
43
46
  * `list` | The container wrapping messages.
44
47
  *
48
+ * See the [`<vaadin-message>`](#/elements/vaadin-message) documentation for the available
49
+ * state attributes and stylable shadow parts of message elements.
50
+ *
45
51
  * See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
46
52
  */
47
53
  declare class MessageList extends KeyboardDirectionMixin(ThemableMixin(ElementMixin(HTMLElement))) {
@@ -3,9 +3,7 @@
3
3
  * Copyright (c) 2021 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import '@polymer/polymer/lib/elements/dom-repeat.js';
7
6
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
8
- import { microTask } from '@vaadin/component-base/src/async.js';
9
7
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
10
8
  import { KeyboardDirectionMixin } from '@vaadin/component-base/src/keyboard-direction-mixin.js';
11
9
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
@@ -15,12 +13,15 @@ import { Message } from './vaadin-message.js';
15
13
  * `<vaadin-message-list>` is a Web Component for showing an ordered list of messages. The messages are rendered as <vaadin-message>
16
14
  *
17
15
  * ### Example
16
+ *
18
17
  * To create a new message list, add the component to the page:
18
+ *
19
19
  * ```html
20
20
  * <vaadin-message-list></vaadin-message-list>
21
21
  * ```
22
22
  *
23
- * Provide the messages to the message list with the `items` property.
23
+ * Provide the messages to the message list with the [`items`](#/elements/vaadin-message-list#property-items) property.
24
+ *
24
25
  * ```js
25
26
  * document.querySelector('vaadin-message-list').items = [
26
27
  * { text: 'Hello list', time: 'yesterday', userName: 'Matt Mambo', userAbbr: 'MM', userColorIndex: 1 },
@@ -36,6 +37,9 @@ import { Message } from './vaadin-message.js';
36
37
  * ----------|----------------
37
38
  * `list` | The container wrapping messages.
38
39
  *
40
+ * See the [`<vaadin-message>`](#/elements/vaadin-message) documentation for the available
41
+ * state attributes and stylable shadow parts of message elements.
42
+ *
39
43
  * See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
40
44
  *
41
45
  * @extends HTMLElement
@@ -86,19 +90,7 @@ class MessageList extends KeyboardDirectionMixin(ElementMixin(ThemableMixin(Poly
86
90
  }
87
91
  </style>
88
92
  <div part="list" role="list">
89
- <template is="dom-repeat" items="[[items]]">
90
- <vaadin-message
91
- time="[[item.time]]"
92
- user-name="[[item.userName]]"
93
- user-abbr="[[item.userAbbr]]"
94
- user-img="[[item.userImg]]"
95
- user-color-index="[[item.userColorIndex]]"
96
- theme$="[[item.theme]]"
97
- role="listitem"
98
- on-focusin="_handleFocusEvent"
99
- >[[item.text]]</vaadin-message
100
- >
101
- </template>
93
+ <slot></slot>
102
94
  </div>
103
95
  `;
104
96
  }
@@ -126,24 +118,81 @@ class MessageList extends KeyboardDirectionMixin(ElementMixin(ThemableMixin(Poly
126
118
 
127
119
  /** @protected */
128
120
  get _messages() {
129
- return Array.from(this.shadowRoot.querySelectorAll('vaadin-message'));
121
+ return [...this.querySelectorAll('vaadin-message')];
130
122
  }
131
123
 
132
124
  /** @private */
133
125
  _itemsChanged(newVal, oldVal) {
134
- const focusedIndex = this._getIndexOfFocusableElement();
135
- if (newVal && newVal.length) {
136
- const moreItems = !oldVal || newVal.length > oldVal.length;
126
+ const items = newVal || [];
127
+ const oldItems = oldVal || [];
128
+
129
+ if (items.length || oldItems.length) {
130
+ const focusedIndex = this._getIndexOfFocusableElement();
137
131
  const closeToBottom = this.scrollHeight < this.clientHeight + this.scrollTop + 50;
138
- microTask.run(() => {
139
- this._setTabIndexesByIndex(focusedIndex);
140
- if (moreItems && closeToBottom) {
132
+
133
+ const removed = oldItems.filter((item) => !items.includes(item));
134
+ const added = [...items];
135
+
136
+ this._messages.forEach((message) => {
137
+ const item = message._item;
138
+ if (removed.includes(item)) {
139
+ message.remove();
140
+ } else if (added.includes(item)) {
141
+ added.splice(added.indexOf(item), 1);
142
+ }
143
+ });
144
+
145
+ this.__addMessages(added, items);
146
+
147
+ this._setTabIndexesByIndex(focusedIndex);
148
+
149
+ requestAnimationFrame(() => {
150
+ if (items.length > oldItems.length && closeToBottom) {
141
151
  this._scrollToLastMessage();
142
152
  }
143
153
  });
144
154
  }
145
155
  }
146
156
 
157
+ /** @private */
158
+ __addMessages(itemsToAdd, allItems) {
159
+ itemsToAdd.forEach((item) => {
160
+ const message = this.__createMessage(item);
161
+ const nextItem = allItems[allItems.indexOf(item) + 1];
162
+ const nextMessage = this._messages.find((msg) => msg._item === nextItem);
163
+ if (nextMessage) {
164
+ this.insertBefore(message, nextMessage);
165
+ } else {
166
+ this.appendChild(message);
167
+ }
168
+ });
169
+ }
170
+
171
+ /** @private */
172
+ __createMessage(item) {
173
+ const message = document.createElement('vaadin-message');
174
+ message.setAttribute('role', 'listitem');
175
+
176
+ message.textContent = item.text;
177
+ message.time = item.time;
178
+ message.userName = item.userName;
179
+ message.userAbbr = item.userAbbr;
180
+ message.userImg = item.userImg;
181
+ message.userColorIndex = item.userColorIndex;
182
+
183
+ message._item = item;
184
+
185
+ if (item.theme) {
186
+ message.setAttribute('theme', item.theme);
187
+ }
188
+
189
+ message.addEventListener('focusin', (e) => {
190
+ this._onMessageFocusIn(e);
191
+ });
192
+
193
+ return message;
194
+ }
195
+
147
196
  /** @private */
148
197
  _scrollToLastMessage() {
149
198
  if (this.items.length > 0) {
@@ -152,7 +201,7 @@ class MessageList extends KeyboardDirectionMixin(ElementMixin(ThemableMixin(Poly
152
201
  }
153
202
 
154
203
  /** @private */
155
- _handleFocusEvent(e) {
204
+ _onMessageFocusIn(e) {
156
205
  const target = e.composedPath().find((node) => node instanceof Message);
157
206
  this._setTabIndexesByMessage(target);
158
207
  }
@@ -3,6 +3,7 @@
3
3
  * Copyright (c) 2021 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
+ import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
6
7
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
7
8
  import { FocusMixin } from '@vaadin/component-base/src/focus-mixin.js';
8
9
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
@@ -23,7 +24,6 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
23
24
  *
24
25
  * Part name | Description
25
26
  * ----------|----------------
26
- * `avatar` | The author's avatar
27
27
  * `name` | Author's name
28
28
  * `time` | When the message was posted
29
29
  * `content` | The message itself as a slotted content
@@ -36,15 +36,8 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
36
36
  * `focused` | Set when the message is focused.
37
37
  *
38
38
  * See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
39
- *
40
- * ### Internal components
41
- *
42
- * In addition to `<vaadin-message>` itself, the following internal
43
- * components are themable:
44
- *
45
- * - `<vaadin-message-avatar>` - has the same API as [`<vaadin-avatar>`](#/elements/vaadin-avatar).
46
39
  */
47
- declare class Message extends FocusMixin(ThemableMixin(ElementMixin(HTMLElement))) {
40
+ declare class Message extends FocusMixin(ThemableMixin(ElementMixin(ControllerMixin(HTMLElement)))) {
48
41
  /**
49
42
  * Time of sending the message. It is rendered as-is to the part='time' slot,
50
43
  * so the formatting is up to you.
@@ -3,10 +3,12 @@
3
3
  * Copyright (c) 2021 - 2022 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-message-avatar.js';
6
+ import '@vaadin/avatar/src/vaadin-avatar.js';
7
7
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
8
+ import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
8
9
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
9
10
  import { FocusMixin } from '@vaadin/component-base/src/focus-mixin.js';
11
+ import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
10
12
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
13
 
12
14
  /**
@@ -25,7 +27,6 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
25
27
  *
26
28
  * Part name | Description
27
29
  * ----------|----------------
28
- * `avatar` | The author's avatar
29
30
  * `name` | Author's name
30
31
  * `time` | When the message was posted
31
32
  * `content` | The message itself as a slotted content
@@ -39,19 +40,13 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
39
40
  *
40
41
  * See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
41
42
  *
42
- * ### Internal components
43
- *
44
- * In addition to `<vaadin-message>` itself, the following internal
45
- * components are themable:
46
- *
47
- * - `<vaadin-message-avatar>` - has the same API as [`<vaadin-avatar>`](#/elements/vaadin-avatar).
48
- *
49
43
  * @extends HTMLElement
44
+ * @mixes ControllerMixin
50
45
  * @mixes FocusMixin
51
46
  * @mixes ThemableMixin
52
47
  * @mixes ElementMixin
53
48
  */
54
- class Message extends FocusMixin(ElementMixin(ThemableMixin(PolymerElement))) {
49
+ class Message extends FocusMixin(ElementMixin(ThemableMixin(ControllerMixin(PolymerElement)))) {
55
50
  static get properties() {
56
51
  return {
57
52
  /**
@@ -117,6 +112,11 @@ class Message extends FocusMixin(ElementMixin(ThemableMixin(PolymerElement))) {
117
112
  userColorIndex: {
118
113
  type: Number,
119
114
  },
115
+
116
+ /** @private */
117
+ _avatar: {
118
+ ttype: Object,
119
+ },
120
120
  };
121
121
  }
122
122
 
@@ -153,16 +153,13 @@ class Message extends FocusMixin(ElementMixin(ThemableMixin(PolymerElement))) {
153
153
  [part='message'] {
154
154
  white-space: pre-wrap;
155
155
  }
156
+
157
+ ::slotted([slot='avatar']) {
158
+ --vaadin-avatar-outline-width: 0px;
159
+ flex-shrink: 0;
160
+ }
156
161
  </style>
157
- <vaadin-message-avatar
158
- part="avatar"
159
- name="[[userName]]"
160
- abbr="[[userAbbr]]"
161
- img="[[userImg]]"
162
- color-index="[[userColorIndex]]"
163
- tabindex="-1"
164
- aria-hidden="true"
165
- ></vaadin-message-avatar>
162
+ <slot name="avatar"></slot>
166
163
  <div part="content">
167
164
  <div part="header">
168
165
  <span part="name">[[userName]]</span>
@@ -176,6 +173,39 @@ class Message extends FocusMixin(ElementMixin(ThemableMixin(PolymerElement))) {
176
173
  static get is() {
177
174
  return 'vaadin-message';
178
175
  }
176
+
177
+ static get observers() {
178
+ return ['__avatarChanged(_avatar, userName, userAbbr, userImg, userColorIndex)'];
179
+ }
180
+
181
+ /** @protected */
182
+ ready() {
183
+ super.ready();
184
+
185
+ this._avatarController = new SlotController(
186
+ this,
187
+ 'avatar',
188
+ () => document.createElement('vaadin-avatar'),
189
+ (_, avatar) => {
190
+ avatar.setAttribute('tabindex', '-1');
191
+ avatar.setAttribute('aria-hidden', 'true');
192
+ this._avatar = avatar;
193
+ },
194
+ );
195
+ this.addController(this._avatarController);
196
+ }
197
+
198
+ /** @private */
199
+ __avatarChanged(avatar, userName, userAbbr, userImg, userColorIndex) {
200
+ if (avatar) {
201
+ avatar.setProperties({
202
+ name: userName,
203
+ abbr: userAbbr,
204
+ img: userImg,
205
+ colorIndex: userColorIndex,
206
+ });
207
+ }
208
+ }
179
209
  }
180
210
 
181
211
  customElements.define(Message.is, Message);
@@ -3,7 +3,7 @@ import '@vaadin/vaadin-lumo-styles/sizing.js';
3
3
  import '@vaadin/vaadin-lumo-styles/spacing.js';
4
4
  import '@vaadin/vaadin-lumo-styles/style.js';
5
5
  import '@vaadin/vaadin-lumo-styles/typography.js';
6
- import './vaadin-message-avatar-styles.js';
6
+ import '@vaadin/avatar/theme/lumo/vaadin-avatar-styles.js';
7
7
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
8
 
9
9
  registerStyles(
@@ -49,6 +49,12 @@ registerStyles(
49
49
  color: var(--lumo-secondary-text-color);
50
50
  font-size: var(--lumo-font-size-s);
51
51
  }
52
+
53
+ ::slotted([slot='avatar']) {
54
+ --vaadin-avatar-size: var(--lumo-size-m);
55
+ margin-top: calc(var(--lumo-space-s));
56
+ margin-inline-end: calc(var(--lumo-space-m));
57
+ }
52
58
  `,
53
59
  { moduleId: 'lumo-message' },
54
60
  );
@@ -1,3 +1,2 @@
1
1
  import './vaadin-message-styles.js';
2
- import './vaadin-message-avatar.js';
3
2
  import '../../src/vaadin-message.js';
@@ -1,6 +1,6 @@
1
1
  import '@vaadin/vaadin-material-styles/color.js';
2
2
  import '@vaadin/vaadin-material-styles/typography.js';
3
- import './vaadin-message-avatar-styles.js';
3
+ import '@vaadin/avatar/theme/material/vaadin-avatar-styles.js';
4
4
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
5
5
 
6
6
  registerStyles(
@@ -58,6 +58,12 @@ registerStyles(
58
58
  font-size: var(--material-small-font-size);
59
59
  line-height: 1.25rem;
60
60
  }
61
+
62
+ ::slotted([slot='avatar']) {
63
+ --vaadin-avatar-size: 2.5rem;
64
+ margin-top: 0.25rem;
65
+ margin-inline-end: 1rem;
66
+ }
61
67
  `,
62
68
  { moduleId: 'material-message' },
63
69
  );
@@ -1,3 +1,2 @@
1
1
  import './vaadin-message-styles.js';
2
- import './vaadin-message-avatar.js';
3
2
  import '../../src/vaadin-message.js';
package/web-types.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/message-list",
4
- "version": "23.3.0-alpha3",
4
+ "version": "24.0.0-alpha1",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
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`avatar` | The author's avatar\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/custom-theme/styling-components) documentation.\n\n### Internal components\n\nIn addition to `<vaadin-message>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-message-avatar>` - has the same API as [`<vaadin-avatar>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha3/#/elements/vaadin-avatar).",
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/custom-theme/styling-components) documentation.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "time",
@@ -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\nTo create a new message list, add the component to the page:\n```html\n<vaadin-message-list></vaadin-message-list>\n```\n\nProvide the messages to the message list with the `items` property.\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 [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/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/24.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/24.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/custom-theme/styling-components) documentation.",
144
144
  "attributes": [
145
145
  {
146
146
  "name": "theme",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/message-list",
4
- "version": "23.3.0-alpha3",
4
+ "version": "24.0.0-alpha1",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -16,7 +16,7 @@
16
16
  "elements": [
17
17
  {
18
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`avatar` | The author's avatar\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/custom-theme/styling-components) documentation.\n\n### Internal components\n\nIn addition to `<vaadin-message>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-message-avatar>` - has the same API as [`<vaadin-avatar>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha3/#/elements/vaadin-avatar).",
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/custom-theme/styling-components) documentation.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {
@@ -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\nTo create a new message list, add the component to the page:\n```html\n<vaadin-message-list></vaadin-message-list>\n```\n\nProvide the messages to the message list with the `items` property.\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 [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/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/24.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/24.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/custom-theme/styling-components) documentation.",
62
62
  "extension": true,
63
63
  "attributes": [
64
64
  {
@@ -1,17 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import { Avatar } from '@vaadin/avatar/src/vaadin-avatar.js';
7
-
8
- /**
9
- * An element used internally by `<vaadin-message>`. Not intended to be used separately.
10
- */
11
- declare class MessageAvatar extends Avatar {}
12
-
13
- declare global {
14
- interface HTMLElementTagNameMap {
15
- 'vaadin-message-avatar': MessageAvatar;
16
- }
17
- }
@@ -1,32 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import { Avatar } from '@vaadin/avatar/src/vaadin-avatar.js';
7
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
-
9
- registerStyles(
10
- 'vaadin-message-avatar',
11
- css`
12
- :host {
13
- --vaadin-avatar-outline-width: 0px; /* stylelint-disable-line length-zero-no-unit */
14
- flex-shrink: 0;
15
- }
16
- `,
17
- { moduleId: 'vaadin-message-avatar-styles' },
18
- );
19
-
20
- /**
21
- * An element used internally by `<vaadin-message>`. Not intended to be used separately.
22
- *
23
- * @extends Avatar
24
- * @private
25
- */
26
- class MessageAvatar extends Avatar {
27
- static get is() {
28
- return 'vaadin-message-avatar';
29
- }
30
- }
31
-
32
- customElements.define(MessageAvatar.is, MessageAvatar);
@@ -1,18 +0,0 @@
1
- import '@vaadin/avatar/theme/lumo/vaadin-avatar-styles.js';
2
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
3
-
4
- registerStyles(
5
- 'vaadin-message-avatar',
6
- css`
7
- :host {
8
- margin-right: calc(var(--lumo-space-m) - var(--vaadin-avatar-outline-width));
9
- margin-top: calc(var(--lumo-space-s) - var(--vaadin-avatar-outline-width));
10
- }
11
-
12
- :host([dir='rtl']) {
13
- margin-left: calc(var(--lumo-space-m) - var(--vaadin-avatar-outline-width));
14
- margin-right: calc(var(--vaadin-avatar-outline-width) * -1);
15
- }
16
- `,
17
- { moduleId: 'lumo-message-avatar' },
18
- );
@@ -1,2 +0,0 @@
1
- import './vaadin-message-avatar-styles.js';
2
- import '../../src/vaadin-message-avatar.js';
@@ -1,19 +0,0 @@
1
- import '@vaadin/avatar/theme/material/vaadin-avatar-styles.js';
2
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
3
-
4
- registerStyles(
5
- 'vaadin-message-avatar',
6
- css`
7
- :host {
8
- --vaadin-avatar-size: 2.5rem;
9
- margin-right: calc(1rem - var(--vaadin-avatar-outline-width));
10
- margin-top: calc(0.25rem - var(--vaadin-avatar-outline-width));
11
- }
12
-
13
- :host([dir='rtl']) {
14
- margin-left: calc(1em - var(--vaadin-avatar-outline-width));
15
- margin-right: calc(var(--vaadin-avatar-outline-width) * -1);
16
- }
17
- `,
18
- { moduleId: 'material-message-avatar' },
19
- );
@@ -1,2 +0,0 @@
1
- import './vaadin-message-avatar-styles.js';
2
- import '../../src/vaadin-message-avatar.js';