@vaadin/message-list 24.8.0-alpha9 → 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/README.md +0 -23
- package/package.json +12 -14
- package/src/vaadin-message-list-mixin.d.ts +11 -0
- package/src/vaadin-message-list-mixin.js +48 -2
- package/src/vaadin-message-list.d.ts +2 -1
- package/src/vaadin-message-list.js +36 -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 +38 -2
- package/web-types.lit.json +16 -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-alpha2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -33,29 +33,27 @@
|
|
|
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-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",
|
|
48
46
|
"lit": "^3.0.0"
|
|
49
47
|
},
|
|
50
48
|
"devDependencies": {
|
|
51
|
-
"@vaadin/chai-plugins": "
|
|
52
|
-
"@vaadin/test-runner-commands": "
|
|
53
|
-
"@vaadin/testing-helpers": "^
|
|
49
|
+
"@vaadin/chai-plugins": "25.0.0-alpha2",
|
|
50
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha2",
|
|
51
|
+
"@vaadin/testing-helpers": "^2.0.0",
|
|
54
52
|
"sinon": "^18.0.0"
|
|
55
53
|
},
|
|
56
54
|
"web-types": [
|
|
57
55
|
"web-types.json",
|
|
58
56
|
"web-types.lit.json"
|
|
59
57
|
],
|
|
60
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "67ffcd5355cf21ce1b5039c598525109fc4c164b"
|
|
61
59
|
}
|
|
@@ -39,4 +39,15 @@ export declare class MessageListMixinClass {
|
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
41
|
items: MessageListItem[] | null | undefined;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* When set to `true`, the message text is parsed as Markdown.
|
|
45
|
+
*/
|
|
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;
|
|
42
53
|
}
|
|
@@ -37,6 +37,28 @@ 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
|
+
},
|
|
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
|
+
},
|
|
40
62
|
};
|
|
41
63
|
}
|
|
42
64
|
|
|
@@ -51,7 +73,7 @@ export const MessageListMixin = (superClass) =>
|
|
|
51
73
|
|
|
52
74
|
// Make screen readers announce new messages
|
|
53
75
|
this.setAttribute('aria-relevant', 'additions');
|
|
54
|
-
this.setAttribute('role', '
|
|
76
|
+
this.setAttribute('role', 'region');
|
|
55
77
|
}
|
|
56
78
|
|
|
57
79
|
/**
|
|
@@ -86,8 +108,24 @@ export const MessageListMixin = (superClass) =>
|
|
|
86
108
|
}
|
|
87
109
|
}
|
|
88
110
|
|
|
111
|
+
/** @private */
|
|
112
|
+
__markdownChanged(markdown) {
|
|
113
|
+
if (markdown && !customElements.get('vaadin-markdown')) {
|
|
114
|
+
// Dynamically import the markdown component
|
|
115
|
+
import('@vaadin/markdown/src/vaadin-markdown.js')
|
|
116
|
+
// Wait until the component is defined
|
|
117
|
+
.then(() => customElements.whenDefined('vaadin-markdown'))
|
|
118
|
+
// Render the messages again
|
|
119
|
+
.then(() => this._renderMessages(this.items));
|
|
120
|
+
}
|
|
121
|
+
this._renderMessages(this.items);
|
|
122
|
+
}
|
|
123
|
+
|
|
89
124
|
/** @private */
|
|
90
125
|
_renderMessages(items) {
|
|
126
|
+
// Check if markdown component is still loading
|
|
127
|
+
const loadingMarkdown = this.markdown && !customElements.get('vaadin-markdown');
|
|
128
|
+
|
|
91
129
|
render(
|
|
92
130
|
html`
|
|
93
131
|
${items.map(
|
|
@@ -102,7 +140,10 @@ export const MessageListMixin = (superClass) =>
|
|
|
102
140
|
theme="${ifDefined(item.theme)}"
|
|
103
141
|
class="${ifDefined(item.className)}"
|
|
104
142
|
@focusin="${this._onMessageFocusIn}"
|
|
105
|
-
|
|
143
|
+
style="${ifDefined(loadingMarkdown ? 'visibility: hidden' : undefined)}"
|
|
144
|
+
>${this.markdown
|
|
145
|
+
? html`<vaadin-markdown .content=${item.text}></vaadin-markdown>`
|
|
146
|
+
: item.text}<vaadin-avatar slot="avatar"></vaadin-avatar
|
|
106
147
|
></vaadin-message>
|
|
107
148
|
`,
|
|
108
149
|
)}
|
|
@@ -146,4 +187,9 @@ export const MessageListMixin = (superClass) =>
|
|
|
146
187
|
const index = this._messages.findIndex((e) => e.tabIndex === 0);
|
|
147
188
|
return index !== -1 ? index : 0;
|
|
148
189
|
}
|
|
190
|
+
|
|
191
|
+
/** @private */
|
|
192
|
+
__announceChanged(announceMessages) {
|
|
193
|
+
this.ariaLive = announceMessages ? 'polite' : null;
|
|
194
|
+
}
|
|
149
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 {
|
|
@@ -4,9 +4,11 @@
|
|
|
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';
|
|
11
|
+
import { SlotStylesMixin } from '@vaadin/component-base/src/slot-styles-mixin.js';
|
|
10
12
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
13
|
import { MessageListMixin } from './vaadin-message-list-mixin.js';
|
|
12
14
|
|
|
@@ -48,29 +50,50 @@ import { MessageListMixin } from './vaadin-message-list-mixin.js';
|
|
|
48
50
|
* @mixes ThemableMixin
|
|
49
51
|
* @mixes ElementMixin
|
|
50
52
|
* @mixes MessageListMixin
|
|
53
|
+
* @mixes SlotStylesMixin
|
|
51
54
|
*/
|
|
52
|
-
class MessageList extends MessageListMixin(ElementMixin(ThemableMixin(
|
|
55
|
+
class MessageList extends SlotStylesMixin(MessageListMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement))))) {
|
|
53
56
|
static get is() {
|
|
54
57
|
return 'vaadin-message-list';
|
|
55
58
|
}
|
|
56
59
|
|
|
57
|
-
static get
|
|
58
|
-
return
|
|
59
|
-
|
|
60
|
-
:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
static get styles() {
|
|
61
|
+
return css`
|
|
62
|
+
:host {
|
|
63
|
+
display: block;
|
|
64
|
+
overflow: auto;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
:host([hidden]) {
|
|
68
|
+
display: none !important;
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
71
|
+
}
|
|
64
72
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
</style>
|
|
73
|
+
/** @protected */
|
|
74
|
+
render() {
|
|
75
|
+
return html`
|
|
69
76
|
<div part="list" role="list">
|
|
70
77
|
<slot></slot>
|
|
71
78
|
</div>
|
|
72
79
|
`;
|
|
73
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
|
+
}
|
|
74
97
|
}
|
|
75
98
|
|
|
76
99
|
defineCustomElement(MessageList);
|
|
@@ -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-alpha2",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -140,8 +140,26 @@
|
|
|
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-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
|
+
{
|
|
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
|
+
},
|
|
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
|
+
},
|
|
145
163
|
{
|
|
146
164
|
"name": "theme",
|
|
147
165
|
"description": "The theme variants to apply to the component.",
|
|
@@ -166,6 +184,24 @@
|
|
|
166
184
|
"undefined"
|
|
167
185
|
]
|
|
168
186
|
}
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"name": "markdown",
|
|
190
|
+
"description": "When set to `true`, the message text is parsed as Markdown.",
|
|
191
|
+
"value": {
|
|
192
|
+
"type": [
|
|
193
|
+
"boolean"
|
|
194
|
+
]
|
|
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
|
+
}
|
|
169
205
|
}
|
|
170
206
|
],
|
|
171
207
|
"events": []
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/message-list",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "25.0.0-alpha2",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -58,9 +58,23 @@
|
|
|
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-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
|
+
{
|
|
65
|
+
"name": "?markdown",
|
|
66
|
+
"description": "When set to `true`, the message text is parsed as Markdown.",
|
|
67
|
+
"value": {
|
|
68
|
+
"kind": "expression"
|
|
69
|
+
}
|
|
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
|
+
},
|
|
64
78
|
{
|
|
65
79
|
"name": ".items",
|
|
66
80
|
"description": "An array of objects which will be rendered as messages.\nThe message objects can have the following properties:\n```js\nArray<{\n text: string,\n time: string,\n userName: string,\n userAbbr: string,\n userImg: string,\n userColorIndex: number,\n className: string,\n theme: string\n}>\n```",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './vaadin-message-list.js';
|
|
@@ -1,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