@vaadin/message-list 24.8.0-alpha9 → 25.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/README.md +0 -23
- package/package.json +11 -13
- package/src/vaadin-message-list-mixin.d.ts +5 -0
- package/src/vaadin-message-list-mixin.js +30 -1
- package/src/vaadin-message-list.js +18 -13
- package/src/vaadin-message-mixin.d.ts +1 -2
- package/src/vaadin-message-mixin.js +1 -3
- package/src/vaadin-message-styles.js +4 -0
- package/src/vaadin-message.js +16 -12
- package/theme/lumo/vaadin-message-list.d.ts +1 -0
- package/theme/lumo/vaadin-message-list.js +1 -0
- 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-list.js +0 -53
- package/src/vaadin-lit-message.d.ts +0 -1
- package/src/vaadin-lit-message.js +0 -50
- package/theme/lumo/vaadin-lit-message-list.d.ts +0 -2
- package/theme/lumo/vaadin-lit-message-list.js +0 -2
- package/theme/lumo/vaadin-lit-message.d.ts +0 -2
- package/theme/lumo/vaadin-lit-message.js +0 -2
- package/theme/material/vaadin-lit-message-list.d.ts +0 -2
- package/theme/material/vaadin-lit-message-list.js +0 -2
- package/theme/material/vaadin-lit-message.d.ts +0 -2
- package/theme/material/vaadin-lit-message.js +0 -2
- package/theme/material/vaadin-message-list-styles.d.ts +0 -3
- package/theme/material/vaadin-message-list-styles.js +0 -14
- package/theme/material/vaadin-message-list.d.ts +0 -2
- package/theme/material/vaadin-message-list.js +0 -2
- package/theme/material/vaadin-message-styles.d.ts +0 -3
- package/theme/material/vaadin-message-styles.js +0 -69
- package/theme/material/vaadin-message.d.ts +0 -2
- package/theme/material/vaadin-message.js +0 -2
- package/vaadin-lit-message-list.d.ts +0 -1
- package/vaadin-lit-message-list.js +0 -2
- package/vaadin-lit-message.d.ts +0 -1
- package/vaadin-lit-message.js +0 -2
package/README.md
CHANGED
|
@@ -32,29 +32,6 @@ Once installed, import the component in your application:
|
|
|
32
32
|
import '@vaadin/message-list';
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
## Themes
|
|
36
|
-
|
|
37
|
-
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
|
|
38
|
-
The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/message-list/vaadin-message-list.js) of the package uses the Lumo theme.
|
|
39
|
-
|
|
40
|
-
To use the Material theme, import the component from the `theme/material` folder:
|
|
41
|
-
|
|
42
|
-
```js
|
|
43
|
-
import '@vaadin/message-list/theme/material/vaadin-message-list.js';
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
You can also import the Lumo version of the component explicitly:
|
|
47
|
-
|
|
48
|
-
```js
|
|
49
|
-
import '@vaadin/message-list/theme/lumo/vaadin-message-list.js';
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
|
|
53
|
-
|
|
54
|
-
```js
|
|
55
|
-
import '@vaadin/message-list/src/vaadin-message-list.js';
|
|
56
|
-
```
|
|
57
|
-
|
|
58
35
|
## Contributing
|
|
59
36
|
|
|
60
37
|
Read the [contributing guide](https://vaadin.com/docs/latest/contributing) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/message-list",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.0-alpha1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -33,23 +33,21 @@
|
|
|
33
33
|
"vaadin-message",
|
|
34
34
|
"vaadin-message-list",
|
|
35
35
|
"web-components",
|
|
36
|
-
"web-component"
|
|
37
|
-
"polymer"
|
|
36
|
+
"web-component"
|
|
38
37
|
],
|
|
39
38
|
"dependencies": {
|
|
40
39
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
41
|
-
"@
|
|
42
|
-
"@vaadin/
|
|
43
|
-
"@vaadin/
|
|
44
|
-
"@vaadin/
|
|
45
|
-
"@vaadin/vaadin-lumo-styles": "
|
|
46
|
-
"@vaadin/vaadin-
|
|
47
|
-
"@vaadin/vaadin-themable-mixin": "24.8.0-alpha9",
|
|
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",
|
|
48
46
|
"lit": "^3.0.0"
|
|
49
47
|
},
|
|
50
48
|
"devDependencies": {
|
|
51
|
-
"@vaadin/chai-plugins": "
|
|
52
|
-
"@vaadin/test-runner-commands": "
|
|
49
|
+
"@vaadin/chai-plugins": "25.0.0-alpha1",
|
|
50
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha1",
|
|
53
51
|
"@vaadin/testing-helpers": "^1.1.0",
|
|
54
52
|
"sinon": "^18.0.0"
|
|
55
53
|
},
|
|
@@ -57,5 +55,5 @@
|
|
|
57
55
|
"web-types.json",
|
|
58
56
|
"web-types.lit.json"
|
|
59
57
|
],
|
|
60
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49"
|
|
61
59
|
}
|
|
@@ -37,6 +37,16 @@ export const MessageListMixin = (superClass) =>
|
|
|
37
37
|
observer: '_itemsChanged',
|
|
38
38
|
sync: true,
|
|
39
39
|
},
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* When set to `true`, the message text is parsed as Markdown.
|
|
43
|
+
* @type {boolean}
|
|
44
|
+
*/
|
|
45
|
+
markdown: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
observer: '__markdownChanged',
|
|
48
|
+
reflectToAttribute: true,
|
|
49
|
+
},
|
|
40
50
|
};
|
|
41
51
|
}
|
|
42
52
|
|
|
@@ -86,8 +96,24 @@ export const MessageListMixin = (superClass) =>
|
|
|
86
96
|
}
|
|
87
97
|
}
|
|
88
98
|
|
|
99
|
+
/** @private */
|
|
100
|
+
__markdownChanged(markdown) {
|
|
101
|
+
if (markdown && !customElements.get('vaadin-markdown')) {
|
|
102
|
+
// Dynamically import the markdown component
|
|
103
|
+
import('@vaadin/markdown/src/vaadin-markdown.js')
|
|
104
|
+
// Wait until the component is defined
|
|
105
|
+
.then(() => customElements.whenDefined('vaadin-markdown'))
|
|
106
|
+
// Render the messages again
|
|
107
|
+
.then(() => this._renderMessages(this.items));
|
|
108
|
+
}
|
|
109
|
+
this._renderMessages(this.items);
|
|
110
|
+
}
|
|
111
|
+
|
|
89
112
|
/** @private */
|
|
90
113
|
_renderMessages(items) {
|
|
114
|
+
// Check if markdown component is still loading
|
|
115
|
+
const loadingMarkdown = this.markdown && !customElements.get('vaadin-markdown');
|
|
116
|
+
|
|
91
117
|
render(
|
|
92
118
|
html`
|
|
93
119
|
${items.map(
|
|
@@ -102,7 +128,10 @@ export const MessageListMixin = (superClass) =>
|
|
|
102
128
|
theme="${ifDefined(item.theme)}"
|
|
103
129
|
class="${ifDefined(item.className)}"
|
|
104
130
|
@focusin="${this._onMessageFocusIn}"
|
|
105
|
-
|
|
131
|
+
style="${ifDefined(loadingMarkdown ? 'visibility: hidden' : undefined)}"
|
|
132
|
+
>${this.markdown
|
|
133
|
+
? html`<vaadin-markdown .content=${item.text}></vaadin-markdown>`
|
|
134
|
+
: item.text}<vaadin-avatar slot="avatar"></vaadin-avatar
|
|
106
135
|
></vaadin-message>
|
|
107
136
|
`,
|
|
108
137
|
)}
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import './vaadin-message.js';
|
|
7
|
-
import { html,
|
|
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
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
11
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
12
|
import { MessageListMixin } from './vaadin-message-list-mixin.js';
|
|
12
13
|
|
|
@@ -49,23 +50,27 @@ import { MessageListMixin } from './vaadin-message-list-mixin.js';
|
|
|
49
50
|
* @mixes ElementMixin
|
|
50
51
|
* @mixes MessageListMixin
|
|
51
52
|
*/
|
|
52
|
-
class MessageList extends MessageListMixin(ElementMixin(ThemableMixin(
|
|
53
|
+
class MessageList extends MessageListMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
53
54
|
static get is() {
|
|
54
55
|
return 'vaadin-message-list';
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
static get
|
|
58
|
-
return
|
|
59
|
-
|
|
60
|
-
:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
58
|
+
static get styles() {
|
|
59
|
+
return css`
|
|
60
|
+
:host {
|
|
61
|
+
display: block;
|
|
62
|
+
overflow: auto;
|
|
63
|
+
}
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
:host([hidden]) {
|
|
66
|
+
display: none !important;
|
|
67
|
+
}
|
|
68
|
+
`;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** @protected */
|
|
72
|
+
render() {
|
|
73
|
+
return html`
|
|
69
74
|
<div part="list" role="list">
|
|
70
75
|
<slot></slot>
|
|
71
76
|
</div>
|
|
@@ -5,11 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
7
|
import type { FocusMixinClass } from '@vaadin/a11y-base/src/focus-mixin.js';
|
|
8
|
-
import type { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js';
|
|
9
8
|
|
|
10
9
|
export declare function MessageMixin<T extends Constructor<HTMLElement>>(
|
|
11
10
|
base: T,
|
|
12
|
-
): Constructor<
|
|
11
|
+
): Constructor<FocusMixinClass> & Constructor<MessageMixinClass> & T;
|
|
13
12
|
|
|
14
13
|
export declare class MessageMixinClass {
|
|
15
14
|
/**
|
|
@@ -4,16 +4,14 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
|
|
7
|
-
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
8
7
|
import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* @polymerMixin
|
|
12
|
-
* @mixes ControllerMixin
|
|
13
11
|
* @mixes FocusMixin
|
|
14
12
|
*/
|
|
15
13
|
export const MessageMixin = (superClass) =>
|
|
16
|
-
class MessageMixinClass extends FocusMixin(
|
|
14
|
+
class MessageMixinClass extends FocusMixin(superClass) {
|
|
17
15
|
static get properties() {
|
|
18
16
|
return {
|
|
19
17
|
/**
|
package/src/vaadin-message.js
CHANGED
|
@@ -4,15 +4,14 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/avatar/src/vaadin-avatar.js';
|
|
7
|
-
import { html,
|
|
7
|
+
import { 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
|
-
import {
|
|
10
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
11
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
12
|
import { MessageMixin } from './vaadin-message-mixin.js';
|
|
12
13
|
import { messageStyles } from './vaadin-message-styles.js';
|
|
13
14
|
|
|
14
|
-
registerStyles('vaadin-message', messageStyles, { moduleId: 'vaadin-message-styles' });
|
|
15
|
-
|
|
16
15
|
/**
|
|
17
16
|
* `<vaadin-message>` is a Web Component for showing a single message with an author, message and time.
|
|
18
17
|
*
|
|
@@ -48,23 +47,28 @@ registerStyles('vaadin-message', messageStyles, { moduleId: 'vaadin-message-styl
|
|
|
48
47
|
* @mixes ThemableMixin
|
|
49
48
|
* @mixes ElementMixin
|
|
50
49
|
*/
|
|
51
|
-
class Message extends MessageMixin(ElementMixin(ThemableMixin(
|
|
52
|
-
static get
|
|
50
|
+
class Message extends MessageMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
51
|
+
static get is() {
|
|
52
|
+
return 'vaadin-message';
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
static get styles() {
|
|
56
|
+
return messageStyles;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** @protected */
|
|
60
|
+
render() {
|
|
53
61
|
return html`
|
|
54
62
|
<slot name="avatar"></slot>
|
|
55
63
|
<div part="content">
|
|
56
64
|
<div part="header">
|
|
57
|
-
<span part="name"
|
|
58
|
-
<span part="time"
|
|
65
|
+
<span part="name">${this.userName}</span>
|
|
66
|
+
<span part="time">${this.time}</span>
|
|
59
67
|
</div>
|
|
60
68
|
<div part="message"><slot></slot></div>
|
|
61
69
|
</div>
|
|
62
70
|
`;
|
|
63
71
|
}
|
|
64
|
-
|
|
65
|
-
static get is() {
|
|
66
|
-
return 'vaadin-message';
|
|
67
|
-
}
|
|
68
72
|
}
|
|
69
73
|
|
|
70
74
|
defineCustomElement(Message);
|
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": "
|
|
4
|
+
"version": "25.0.0-alpha1",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -140,8 +140,17 @@
|
|
|
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/
|
|
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.",
|
|
144
144
|
"attributes": [
|
|
145
|
+
{
|
|
146
|
+
"name": "markdown",
|
|
147
|
+
"description": "When set to `true`, the message text is parsed as Markdown.",
|
|
148
|
+
"value": {
|
|
149
|
+
"type": [
|
|
150
|
+
"boolean"
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
},
|
|
145
154
|
{
|
|
146
155
|
"name": "theme",
|
|
147
156
|
"description": "The theme variants to apply to the component.",
|
|
@@ -166,6 +175,15 @@
|
|
|
166
175
|
"undefined"
|
|
167
176
|
]
|
|
168
177
|
}
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"name": "markdown",
|
|
181
|
+
"description": "When set to `true`, the message text is parsed as Markdown.",
|
|
182
|
+
"value": {
|
|
183
|
+
"type": [
|
|
184
|
+
"boolean"
|
|
185
|
+
]
|
|
186
|
+
}
|
|
169
187
|
}
|
|
170
188
|
],
|
|
171
189
|
"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": "
|
|
4
|
+
"version": "25.0.0-alpha1",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -58,9 +58,16 @@
|
|
|
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/
|
|
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.",
|
|
62
62
|
"extension": true,
|
|
63
63
|
"attributes": [
|
|
64
|
+
{
|
|
65
|
+
"name": "?markdown",
|
|
66
|
+
"description": "When set to `true`, the message text is parsed as Markdown.",
|
|
67
|
+
"value": {
|
|
68
|
+
"kind": "expression"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
64
71
|
{
|
|
65
72
|
"name": ".items",
|
|
66
73
|
"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,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import './vaadin-lit-message.js';
|
|
7
|
-
import { css, html, LitElement } from 'lit';
|
|
8
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
9
|
-
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
10
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
11
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
|
-
import { MessageListMixin } from './vaadin-message-list-mixin.js';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* LitElement based version of `<vaadin-message-list>` web component.
|
|
16
|
-
*
|
|
17
|
-
* ## Disclaimer
|
|
18
|
-
*
|
|
19
|
-
* This component is an experiment and not yet a part of Vaadin platform.
|
|
20
|
-
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
21
|
-
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
22
|
-
*/
|
|
23
|
-
class MessageList extends MessageListMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
24
|
-
static get is() {
|
|
25
|
-
return 'vaadin-message-list';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static get styles() {
|
|
29
|
-
return css`
|
|
30
|
-
:host {
|
|
31
|
-
display: block;
|
|
32
|
-
overflow: auto;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
:host([hidden]) {
|
|
36
|
-
display: none !important;
|
|
37
|
-
}
|
|
38
|
-
`;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/** @protected */
|
|
42
|
-
render() {
|
|
43
|
-
return html`
|
|
44
|
-
<div part="list" role="list">
|
|
45
|
-
<slot></slot>
|
|
46
|
-
</div>
|
|
47
|
-
`;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
defineCustomElement(MessageList);
|
|
52
|
-
|
|
53
|
-
export { MessageList };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './vaadin-message.js';
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import '@vaadin/avatar/src/vaadin-lit-avatar.js';
|
|
7
|
-
import { html, LitElement } from 'lit';
|
|
8
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
9
|
-
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
10
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
11
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
|
-
import { MessageMixin } from './vaadin-message-mixin.js';
|
|
13
|
-
import { messageStyles } from './vaadin-message-styles.js';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* LitElement based version of `<vaadin-message>` web component.
|
|
17
|
-
*
|
|
18
|
-
* ## Disclaimer
|
|
19
|
-
*
|
|
20
|
-
* This component is an experiment and not yet a part of Vaadin platform.
|
|
21
|
-
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
22
|
-
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
23
|
-
*/
|
|
24
|
-
class Message extends MessageMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
25
|
-
static get is() {
|
|
26
|
-
return 'vaadin-message';
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
static get styles() {
|
|
30
|
-
return messageStyles;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/** @protected */
|
|
34
|
-
render() {
|
|
35
|
-
return html`
|
|
36
|
-
<slot name="avatar"></slot>
|
|
37
|
-
<div part="content">
|
|
38
|
-
<div part="header">
|
|
39
|
-
<span part="name">${this.userName}</span>
|
|
40
|
-
<span part="time">${this.time}</span>
|
|
41
|
-
</div>
|
|
42
|
-
<div part="message"><slot></slot></div>
|
|
43
|
-
</div>
|
|
44
|
-
`;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
defineCustomElement(Message);
|
|
49
|
-
|
|
50
|
-
export { Message };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-material-styles/color.js';
|
|
2
|
-
import '@vaadin/vaadin-material-styles/typography.js';
|
|
3
|
-
import './vaadin-message-styles.js';
|
|
4
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
5
|
-
|
|
6
|
-
registerStyles(
|
|
7
|
-
'vaadin-message-list',
|
|
8
|
-
css`
|
|
9
|
-
[part='list'] {
|
|
10
|
-
padding: 8px 0;
|
|
11
|
-
}
|
|
12
|
-
`,
|
|
13
|
-
{ moduleId: 'material-message-list' },
|
|
14
|
-
);
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-material-styles/color.js';
|
|
2
|
-
import '@vaadin/vaadin-material-styles/typography.js';
|
|
3
|
-
import '@vaadin/avatar/theme/material/vaadin-avatar-styles.js';
|
|
4
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
5
|
-
|
|
6
|
-
registerStyles(
|
|
7
|
-
'vaadin-message',
|
|
8
|
-
css`
|
|
9
|
-
:host {
|
|
10
|
-
color: var(--material-body-text-color);
|
|
11
|
-
font-family: var(--material-font-family);
|
|
12
|
-
font-size: var(--material-body-font-size);
|
|
13
|
-
line-height: 1.5;
|
|
14
|
-
padding: 0.75rem 1rem;
|
|
15
|
-
-moz-osx-font-smoothing: grayscale;
|
|
16
|
-
-webkit-font-smoothing: antialiased;
|
|
17
|
-
-webkit-text-size-adjust: 100%;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
:host(:hover:not([disabled])) {
|
|
21
|
-
background-color: var(--material-secondary-background-color);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
:host([focused]:not([disabled])) {
|
|
25
|
-
background-color: var(--material-divider-color);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
@media (pointer: coarse) {
|
|
29
|
-
:host(:hover:not([disabled])),
|
|
30
|
-
:host([focused]:not([disabled])) {
|
|
31
|
-
background-color: transparent;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
[part='header'] {
|
|
36
|
-
min-height: calc(var(--material-body-font-size) * 1.5);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
[part='name'] {
|
|
40
|
-
margin-right: 0.5rem;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
[part='name']:empty {
|
|
44
|
-
margin-right: 0;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
:host([dir='rtl']) [part='name'] {
|
|
48
|
-
margin-left: 0.5rem;
|
|
49
|
-
margin-right: 0;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
:host([dir='rtl']) [part='name']:empty {
|
|
53
|
-
margin-left: 0;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
[part='time'] {
|
|
57
|
-
color: var(--material-secondary-text-color);
|
|
58
|
-
font-size: var(--material-small-font-size);
|
|
59
|
-
line-height: 1.25rem;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
::slotted([slot='avatar']) {
|
|
63
|
-
--vaadin-avatar-size: 2.5rem;
|
|
64
|
-
margin-top: 0.25rem;
|
|
65
|
-
margin-inline-end: 1rem;
|
|
66
|
-
}
|
|
67
|
-
`,
|
|
68
|
-
{ moduleId: 'material-message' },
|
|
69
|
-
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/vaadin-message-list.js';
|
package/vaadin-lit-message.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/vaadin-message.js';
|
package/vaadin-lit-message.js
DELETED