@vaadin/message-list 23.3.3 → 24.0.0-alpha10
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 +8 -7
- package/src/vaadin-message-list.d.ts +8 -2
- package/src/vaadin-message-list.js +56 -31
- package/src/vaadin-message.d.ts +3 -10
- package/src/vaadin-message.js +47 -20
- package/theme/lumo/vaadin-message-styles.js +7 -1
- package/theme/lumo/vaadin-message.js +0 -1
- package/theme/material/vaadin-message-styles.js +7 -1
- package/theme/material/vaadin-message.js +0 -1
- package/web-types.json +3 -3
- package/web-types.lit.json +3 -3
- package/src/vaadin-message-avatar.d.ts +0 -17
- package/src/vaadin-message-avatar.js +0 -32
- package/theme/lumo/vaadin-message-avatar-styles.js +0 -18
- package/theme/lumo/vaadin-message-avatar.js +0 -2
- package/theme/material/vaadin-message-avatar-styles.js +0 -19
- package/theme/material/vaadin-message-avatar.js +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/message-list",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "24.0.0-alpha10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,11 +38,12 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@polymer/polymer": "^3.0.0",
|
|
41
|
-
"@vaadin/avatar": "
|
|
42
|
-
"@vaadin/component-base": "
|
|
43
|
-
"@vaadin/vaadin-lumo-styles": "
|
|
44
|
-
"@vaadin/vaadin-material-styles": "
|
|
45
|
-
"@vaadin/vaadin-themable-mixin": "
|
|
41
|
+
"@vaadin/avatar": "24.0.0-alpha10",
|
|
42
|
+
"@vaadin/component-base": "24.0.0-alpha10",
|
|
43
|
+
"@vaadin/vaadin-lumo-styles": "24.0.0-alpha10",
|
|
44
|
+
"@vaadin/vaadin-material-styles": "24.0.0-alpha10",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "24.0.0-alpha10",
|
|
46
|
+
"lit": "^2.0.0"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"@esm-bundle/chai": "^4.3.4",
|
|
@@ -53,5 +54,5 @@
|
|
|
53
54
|
"web-types.json",
|
|
54
55
|
"web-types.lit.json"
|
|
55
56
|
],
|
|
56
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "2e04534d8b47bcd216f89b5f849bafef1a73b174"
|
|
57
58
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
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';
|
|
@@ -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))) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 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/
|
|
7
|
-
import { html,
|
|
8
|
-
import {
|
|
6
|
+
import { html as legacyHtml, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
|
+
import { html, render } from 'lit';
|
|
8
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
9
9
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
10
10
|
import { KeyboardDirectionMixin } from '@vaadin/component-base/src/keyboard-direction-mixin.js';
|
|
11
11
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
@@ -15,12 +15,15 @@ import { Message } from './vaadin-message.js';
|
|
|
15
15
|
* `<vaadin-message-list>` is a Web Component for showing an ordered list of messages. The messages are rendered as <vaadin-message>
|
|
16
16
|
*
|
|
17
17
|
* ### Example
|
|
18
|
+
*
|
|
18
19
|
* To create a new message list, add the component to the page:
|
|
20
|
+
*
|
|
19
21
|
* ```html
|
|
20
22
|
* <vaadin-message-list></vaadin-message-list>
|
|
21
23
|
* ```
|
|
22
24
|
*
|
|
23
|
-
* Provide the messages to the message list with the `items` property.
|
|
25
|
+
* Provide the messages to the message list with the [`items`](#/elements/vaadin-message-list#property-items) property.
|
|
26
|
+
*
|
|
24
27
|
* ```js
|
|
25
28
|
* document.querySelector('vaadin-message-list').items = [
|
|
26
29
|
* { text: 'Hello list', time: 'yesterday', userName: 'Matt Mambo', userAbbr: 'MM', userColorIndex: 1 },
|
|
@@ -36,6 +39,9 @@ import { Message } from './vaadin-message.js';
|
|
|
36
39
|
* ----------|----------------
|
|
37
40
|
* `list` | The container wrapping messages.
|
|
38
41
|
*
|
|
42
|
+
* See the [`<vaadin-message>`](#/elements/vaadin-message) documentation for the available
|
|
43
|
+
* state attributes and stylable shadow parts of message elements.
|
|
44
|
+
*
|
|
39
45
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
40
46
|
*
|
|
41
47
|
* @extends HTMLElement
|
|
@@ -74,7 +80,7 @@ class MessageList extends KeyboardDirectionMixin(ElementMixin(ThemableMixin(Poly
|
|
|
74
80
|
}
|
|
75
81
|
|
|
76
82
|
static get template() {
|
|
77
|
-
return
|
|
83
|
+
return legacyHtml`
|
|
78
84
|
<style>
|
|
79
85
|
:host {
|
|
80
86
|
display: block;
|
|
@@ -86,23 +92,16 @@ class MessageList extends KeyboardDirectionMixin(ElementMixin(ThemableMixin(Poly
|
|
|
86
92
|
}
|
|
87
93
|
</style>
|
|
88
94
|
<div part="list" role="list">
|
|
89
|
-
<
|
|
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>
|
|
95
|
+
<slot></slot>
|
|
102
96
|
</div>
|
|
103
97
|
`;
|
|
104
98
|
}
|
|
105
99
|
|
|
100
|
+
/** @protected */
|
|
101
|
+
get _messages() {
|
|
102
|
+
return [...this.querySelectorAll('vaadin-message')];
|
|
103
|
+
}
|
|
104
|
+
|
|
106
105
|
/** @protected */
|
|
107
106
|
ready() {
|
|
108
107
|
super.ready();
|
|
@@ -124,26 +123,52 @@ class MessageList extends KeyboardDirectionMixin(ElementMixin(ThemableMixin(Poly
|
|
|
124
123
|
return this._messages;
|
|
125
124
|
}
|
|
126
125
|
|
|
127
|
-
/** @protected */
|
|
128
|
-
get _messages() {
|
|
129
|
-
return Array.from(this.shadowRoot.querySelectorAll('vaadin-message'));
|
|
130
|
-
}
|
|
131
|
-
|
|
132
126
|
/** @private */
|
|
133
127
|
_itemsChanged(newVal, oldVal) {
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
128
|
+
const items = newVal || [];
|
|
129
|
+
const oldItems = oldVal || [];
|
|
130
|
+
|
|
131
|
+
if (items.length || oldItems.length) {
|
|
132
|
+
const focusedIndex = this._getIndexOfFocusableElement();
|
|
137
133
|
const closeToBottom = this.scrollHeight < this.clientHeight + this.scrollTop + 50;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
134
|
+
|
|
135
|
+
this._renderMessages(items);
|
|
136
|
+
this._setTabIndexesByIndex(focusedIndex);
|
|
137
|
+
|
|
138
|
+
requestAnimationFrame(() => {
|
|
139
|
+
if (items.length > oldItems.length && closeToBottom) {
|
|
141
140
|
this._scrollToLastMessage();
|
|
142
141
|
}
|
|
143
142
|
});
|
|
144
143
|
}
|
|
145
144
|
}
|
|
146
145
|
|
|
146
|
+
/** @private */
|
|
147
|
+
_renderMessages(items) {
|
|
148
|
+
render(
|
|
149
|
+
html`
|
|
150
|
+
${items.map(
|
|
151
|
+
(item) =>
|
|
152
|
+
html`
|
|
153
|
+
<vaadin-message
|
|
154
|
+
role="listitem"
|
|
155
|
+
.time="${item.time}"
|
|
156
|
+
.userAbbr="${item.userAbbr}"
|
|
157
|
+
.userName="${item.userName}"
|
|
158
|
+
.userImg="${item.userImg}"
|
|
159
|
+
.userColorIndex="${item.userColorIndex}"
|
|
160
|
+
theme="${ifDefined(item.theme)}"
|
|
161
|
+
@focusin="${this._onMessageFocusIn}"
|
|
162
|
+
>${item.text}</vaadin-message
|
|
163
|
+
>
|
|
164
|
+
`,
|
|
165
|
+
)}
|
|
166
|
+
`,
|
|
167
|
+
this,
|
|
168
|
+
{ host: this },
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
147
172
|
/** @private */
|
|
148
173
|
_scrollToLastMessage() {
|
|
149
174
|
if (this.items.length > 0) {
|
|
@@ -152,7 +177,7 @@ class MessageList extends KeyboardDirectionMixin(ElementMixin(ThemableMixin(Poly
|
|
|
152
177
|
}
|
|
153
178
|
|
|
154
179
|
/** @private */
|
|
155
|
-
|
|
180
|
+
_onMessageFocusIn(e) {
|
|
156
181
|
const target = e.composedPath().find((node) => node instanceof Message);
|
|
157
182
|
this._setTabIndexesByMessage(target);
|
|
158
183
|
}
|
package/src/vaadin-message.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 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.
|
package/src/vaadin-message.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import '
|
|
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
|
-
<
|
|
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,36 @@ 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(this, 'avatar', 'vaadin-avatar', {
|
|
186
|
+
initializer: (avatar) => {
|
|
187
|
+
avatar.setAttribute('tabindex', '-1');
|
|
188
|
+
avatar.setAttribute('aria-hidden', 'true');
|
|
189
|
+
this._avatar = avatar;
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
this.addController(this._avatarController);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** @private */
|
|
196
|
+
__avatarChanged(avatar, userName, userAbbr, userImg, userColorIndex) {
|
|
197
|
+
if (avatar) {
|
|
198
|
+
avatar.setProperties({
|
|
199
|
+
name: userName,
|
|
200
|
+
abbr: userAbbr,
|
|
201
|
+
img: userImg,
|
|
202
|
+
colorIndex: userColorIndex,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
179
206
|
}
|
|
180
207
|
|
|
181
208
|
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 '
|
|
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,6 +1,6 @@
|
|
|
1
1
|
import '@vaadin/vaadin-material-styles/color.js';
|
|
2
2
|
import '@vaadin/vaadin-material-styles/typography.js';
|
|
3
|
-
import '
|
|
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
|
);
|
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": "
|
|
4
|
+
"version": "24.0.0-alpha10",
|
|
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`
|
|
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-alpha10/#/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-alpha10/#/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",
|
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": "
|
|
4
|
+
"version": "24.0.0-alpha10",
|
|
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`
|
|
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-alpha10/#/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-alpha10/#/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,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
|
-
);
|