@vaadin/message-list 25.0.2 → 25.1.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 +10 -10
- package/src/vaadin-message-list-mixin.js +15 -0
- package/src/vaadin-message-list.js +9 -1
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/message-list",
|
|
3
|
-
"version": "25.0
|
|
3
|
+
"version": "25.1.0-alpha1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -36,23 +36,23 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
39
|
-
"@vaadin/a11y-base": "
|
|
40
|
-
"@vaadin/avatar": "
|
|
41
|
-
"@vaadin/component-base": "
|
|
42
|
-
"@vaadin/markdown": "
|
|
43
|
-
"@vaadin/vaadin-themable-mixin": "
|
|
39
|
+
"@vaadin/a11y-base": "25.1.0-alpha1",
|
|
40
|
+
"@vaadin/avatar": "25.1.0-alpha1",
|
|
41
|
+
"@vaadin/component-base": "25.1.0-alpha1",
|
|
42
|
+
"@vaadin/markdown": "25.1.0-alpha1",
|
|
43
|
+
"@vaadin/vaadin-themable-mixin": "25.1.0-alpha1",
|
|
44
44
|
"lit": "^3.0.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@vaadin/chai-plugins": "
|
|
48
|
-
"@vaadin/test-runner-commands": "
|
|
47
|
+
"@vaadin/chai-plugins": "25.1.0-alpha1",
|
|
48
|
+
"@vaadin/test-runner-commands": "25.1.0-alpha1",
|
|
49
49
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
50
|
-
"@vaadin/vaadin-lumo-styles": "
|
|
50
|
+
"@vaadin/vaadin-lumo-styles": "25.1.0-alpha1",
|
|
51
51
|
"sinon": "^21.0.0"
|
|
52
52
|
},
|
|
53
53
|
"web-types": [
|
|
54
54
|
"web-types.json",
|
|
55
55
|
"web-types.lit.json"
|
|
56
56
|
],
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "c789cdd350bcd74b280268a83f5475ad7f2f65e1"
|
|
58
58
|
}
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
import { html, render } from 'lit';
|
|
7
7
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
8
8
|
import { KeyboardDirectionMixin } from '@vaadin/a11y-base/src/keyboard-direction-mixin.js';
|
|
9
|
+
import { timeOut } from '@vaadin/component-base/src/async.js';
|
|
10
|
+
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* @polymerMixin
|
|
@@ -99,6 +101,9 @@ export const MessageListMixin = (superClass) =>
|
|
|
99
101
|
|
|
100
102
|
this._renderMessages(items);
|
|
101
103
|
this._setTabIndexesByIndex(focusedIndex);
|
|
104
|
+
if (oldItems.length) {
|
|
105
|
+
this.__enableScrollSnapping();
|
|
106
|
+
}
|
|
102
107
|
|
|
103
108
|
requestAnimationFrame(() => {
|
|
104
109
|
if (items.length > oldItems.length && closeToBottom) {
|
|
@@ -160,6 +165,16 @@ export const MessageListMixin = (superClass) =>
|
|
|
160
165
|
}
|
|
161
166
|
}
|
|
162
167
|
|
|
168
|
+
/** @private */
|
|
169
|
+
__enableScrollSnapping() {
|
|
170
|
+
this.$.list.style.setProperty('--_vaadin-message-list-scroll-snap-align', 'end');
|
|
171
|
+
// Disable scroll-snapping after a delay to allow the user to freely scroll
|
|
172
|
+
// without being snapped back to the bottom.
|
|
173
|
+
this.__debounceScrollSnapping = Debouncer.debounce(this.__debounceScrollSnapping, timeOut.after(500), () => {
|
|
174
|
+
this.$.list.style.removeProperty('--_vaadin-message-list-scroll-snap-align');
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
163
178
|
/** @private */
|
|
164
179
|
_onMessageFocusIn(e) {
|
|
165
180
|
const target = e.composedPath().find((node) => node instanceof customElements.get('vaadin-message'));
|
|
@@ -63,18 +63,26 @@ class MessageList extends SlotStylesMixin(MessageListMixin(ElementMixin(Themable
|
|
|
63
63
|
display: block;
|
|
64
64
|
overflow: auto;
|
|
65
65
|
padding: var(--vaadin-message-list-padding, var(--vaadin-padding-xs) 0);
|
|
66
|
+
scroll-padding: var(--vaadin-message-list-padding, var(--vaadin-padding-xs) 0);
|
|
67
|
+
scroll-snap-type: y proximity;
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
:host([hidden]) {
|
|
69
71
|
display: none !important;
|
|
70
72
|
}
|
|
73
|
+
|
|
74
|
+
[part='list']::after {
|
|
75
|
+
content: '';
|
|
76
|
+
display: block;
|
|
77
|
+
scroll-snap-align: var(--_vaadin-message-list-scroll-snap-align, none);
|
|
78
|
+
}
|
|
71
79
|
`;
|
|
72
80
|
}
|
|
73
81
|
|
|
74
82
|
/** @protected */
|
|
75
83
|
render() {
|
|
76
84
|
return html`
|
|
77
|
-
<div part="list" role="list">
|
|
85
|
+
<div part="list" role="list" id="list">
|
|
78
86
|
<slot></slot>
|
|
79
87
|
</div>
|
|
80
88
|
`;
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/message-list",
|
|
4
|
-
"version": "25.0
|
|
4
|
+
"version": "25.1.0-alpha1",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
},
|
|
141
141
|
{
|
|
142
142
|
"name": "vaadin-message-list",
|
|
143
|
-
"description": "`<vaadin-message-list>` is a Web Component for showing an ordered list of messages. The messages are rendered as <vaadin-message>\n\n### Example\n\nTo create a new message list, add the component to the page:\n\n```html\n<vaadin-message-list></vaadin-message-list>\n```\n\nProvide the messages to the message list with the [`items`](https://cdn.vaadin.com/vaadin-web-components/25.0
|
|
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.1.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.1.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
145
|
{
|
|
146
146
|
"name": "markdown",
|
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": "25.0
|
|
4
|
+
"version": "25.1.0-alpha1",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
"name": "vaadin-message-list",
|
|
61
|
-
"description": "`<vaadin-message-list>` is a Web Component for showing an ordered list of messages. The messages are rendered as <vaadin-message>\n\n### Example\n\nTo create a new message list, add the component to the page:\n\n```html\n<vaadin-message-list></vaadin-message-list>\n```\n\nProvide the messages to the message list with the [`items`](https://cdn.vaadin.com/vaadin-web-components/25.0
|
|
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.1.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.1.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
64
|
{
|