@vaadin/notification 25.2.7 → 25.3.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/custom-elements.json +32 -25
- package/package.json +11 -10
- package/src/styles/vaadin-notification-card-base-styles.d.ts +1 -1
- package/src/styles/vaadin-notification-card-base-styles.js +111 -1
- package/src/vaadin-notification-mixin.js +44 -7
- package/src/vaadin-notification.js +3 -0
- package/web-types.json +2 -4
- package/web-types.lit.json +1 -1
package/custom-elements.json
CHANGED
|
@@ -418,30 +418,6 @@
|
|
|
418
418
|
"name": "opened-changed"
|
|
419
419
|
}
|
|
420
420
|
],
|
|
421
|
-
"mixins": [
|
|
422
|
-
{
|
|
423
|
-
"name": "NotificationMixin",
|
|
424
|
-
"module": "src/vaadin-notification-mixin.js"
|
|
425
|
-
},
|
|
426
|
-
{
|
|
427
|
-
"name": "ElementMixin",
|
|
428
|
-
"package": "@vaadin/component-base/src/element-mixin.js"
|
|
429
|
-
},
|
|
430
|
-
{
|
|
431
|
-
"name": "ThemableMixin",
|
|
432
|
-
"package": "@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js"
|
|
433
|
-
},
|
|
434
|
-
{
|
|
435
|
-
"name": "PolylitMixin",
|
|
436
|
-
"package": "@vaadin/component-base/src/polylit-mixin.js"
|
|
437
|
-
}
|
|
438
|
-
],
|
|
439
|
-
"superclass": {
|
|
440
|
-
"name": "LitElement",
|
|
441
|
-
"package": "lit"
|
|
442
|
-
},
|
|
443
|
-
"tagName": "vaadin-notification",
|
|
444
|
-
"customElement": true,
|
|
445
421
|
"attributes": [
|
|
446
422
|
{
|
|
447
423
|
"name": "assertive",
|
|
@@ -514,8 +490,39 @@
|
|
|
514
490
|
"name": "NotificationMixin",
|
|
515
491
|
"module": "src/vaadin-notification-mixin.js"
|
|
516
492
|
}
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
"type": {
|
|
496
|
+
"text": "string"
|
|
497
|
+
},
|
|
498
|
+
"description": "The theme variants to apply to the component.",
|
|
499
|
+
"name": "theme"
|
|
517
500
|
}
|
|
518
|
-
]
|
|
501
|
+
],
|
|
502
|
+
"mixins": [
|
|
503
|
+
{
|
|
504
|
+
"name": "NotificationMixin",
|
|
505
|
+
"module": "src/vaadin-notification-mixin.js"
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
"name": "ElementMixin",
|
|
509
|
+
"package": "@vaadin/component-base/src/element-mixin.js"
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
"name": "ThemableMixin",
|
|
513
|
+
"package": "@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js"
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
"name": "PolylitMixin",
|
|
517
|
+
"package": "@vaadin/component-base/src/polylit-mixin.js"
|
|
518
|
+
}
|
|
519
|
+
],
|
|
520
|
+
"superclass": {
|
|
521
|
+
"name": "LitElement",
|
|
522
|
+
"package": "lit"
|
|
523
|
+
},
|
|
524
|
+
"tagName": "vaadin-notification",
|
|
525
|
+
"customElement": true
|
|
519
526
|
}
|
|
520
527
|
],
|
|
521
528
|
"exports": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/notification",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.3.0-alpha10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,18 +37,19 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
40
|
-
"@vaadin/component-base": "
|
|
41
|
-
"@vaadin/lit-renderer": "
|
|
42
|
-
"@vaadin/
|
|
40
|
+
"@vaadin/component-base": "25.3.0-alpha10",
|
|
41
|
+
"@vaadin/lit-renderer": "25.3.0-alpha10",
|
|
42
|
+
"@vaadin/overlay": "25.3.0-alpha10",
|
|
43
|
+
"@vaadin/vaadin-themable-mixin": "25.3.0-alpha10",
|
|
43
44
|
"lit": "^3.0.0"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"@vaadin/aura": "
|
|
47
|
-
"@vaadin/button": "
|
|
48
|
-
"@vaadin/chai-plugins": "
|
|
49
|
-
"@vaadin/test-runner-commands": "
|
|
47
|
+
"@vaadin/aura": "25.3.0-alpha10",
|
|
48
|
+
"@vaadin/button": "25.3.0-alpha10",
|
|
49
|
+
"@vaadin/chai-plugins": "25.3.0-alpha10",
|
|
50
|
+
"@vaadin/test-runner-commands": "25.3.0-alpha10",
|
|
50
51
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
51
|
-
"@vaadin/vaadin-lumo-styles": "
|
|
52
|
+
"@vaadin/vaadin-lumo-styles": "25.3.0-alpha10",
|
|
52
53
|
"sinon": "^22.0.0"
|
|
53
54
|
},
|
|
54
55
|
"customElements": "custom-elements.json",
|
|
@@ -56,5 +57,5 @@
|
|
|
56
57
|
"web-types.json",
|
|
57
58
|
"web-types.lit.json"
|
|
58
59
|
],
|
|
59
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "f2833abdf9b613fa0d0ed216830e3f4de87b7dac"
|
|
60
61
|
}
|
|
@@ -5,10 +5,57 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/component-base/src/styles/style-props.js';
|
|
7
7
|
import { css } from 'lit';
|
|
8
|
+
import { overlayAnimationStyles } from '@vaadin/overlay/src/styles/vaadin-overlay-animation-base-styles.js';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
const notificationCard = css`
|
|
10
11
|
:host {
|
|
11
12
|
display: block;
|
|
13
|
+
position: relative;
|
|
14
|
+
--vaadin-overlay-animation-duration: 0.3s;
|
|
15
|
+
transition-duration: var(--vaadin-overlay-animation-duration);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:host([closing]) [part='overlay'] {
|
|
19
|
+
animation-fill-mode: both;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
:host([slot^='top']) {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: end;
|
|
25
|
+
--vaadin-overlay-translate-closed: 0% -30%;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:host([slot^='bottom']) {
|
|
29
|
+
--vaadin-overlay-translate-closed: 0% 30%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Cards on the sides slide in horizontally, once the vertical collapse is done */
|
|
33
|
+
@media (min-width: 600px) and (min-height: 600px) {
|
|
34
|
+
:host([slot$='start']) {
|
|
35
|
+
--vaadin-overlay-translate-closed: -30% 0%;
|
|
36
|
+
--vaadin-overlay-animation-delay: var(--vaadin-overlay-animation-duration);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:host([slot$='end']) {
|
|
40
|
+
--vaadin-overlay-translate-closed: 30% 0%;
|
|
41
|
+
--vaadin-overlay-animation-delay: var(--vaadin-overlay-animation-duration);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:host([closing]) {
|
|
46
|
+
animation-direction: reverse;
|
|
47
|
+
animation-duration: var(--vaadin-overlay-animation-duration);
|
|
48
|
+
animation-delay: var(--vaadin-overlay-animation-duration);
|
|
49
|
+
transition-delay: var(--vaadin-overlay-animation-duration);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Cards scale down in place instead of sliding back out */
|
|
53
|
+
/* WebKit/Safari needs these to be explicitly set on the part=overlay element as well */
|
|
54
|
+
:host([closing]),
|
|
55
|
+
:host([closing]) [part='overlay'] {
|
|
56
|
+
--vaadin-overlay-translate-closed: 0%;
|
|
57
|
+
--vaadin-overlay-scale-closed: 0.98;
|
|
58
|
+
--vaadin-overlay-animation-delay: 0s;
|
|
12
59
|
}
|
|
13
60
|
|
|
14
61
|
[part='overlay'] {
|
|
@@ -30,4 +77,67 @@ export const notificationCardStyles = css`
|
|
|
30
77
|
border: 3px solid !important;
|
|
31
78
|
}
|
|
32
79
|
}
|
|
80
|
+
|
|
81
|
+
/* The other cards make room for a card that opens, and close the gap when it is removed */
|
|
82
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
83
|
+
@supports (interpolate-size: allow-keywords) {
|
|
84
|
+
:host {
|
|
85
|
+
interpolate-size: allow-keywords;
|
|
86
|
+
transition-property: height, margin-top, margin-bottom;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@starting-style {
|
|
90
|
+
:host([opening]:not(:nth-child(1 of [slot='middle']))),
|
|
91
|
+
:host([closing]) {
|
|
92
|
+
height: 0;
|
|
93
|
+
margin-top: 0 !important;
|
|
94
|
+
margin-bottom: 0 !important;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
:host([closing]) {
|
|
99
|
+
height: 0;
|
|
100
|
+
margin-top: 0 !important;
|
|
101
|
+
margin-bottom: 0 !important;
|
|
102
|
+
transition-delay: var(--vaadin-overlay-animation-duration);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* Without interpolate-size, only the margins animate, and max-height stands in for the height */
|
|
107
|
+
@supports not (interpolate-size: allow-keywords) {
|
|
108
|
+
:host([opening]:not(:nth-child(1 of [slot='middle']))),
|
|
109
|
+
:host([closing]) {
|
|
110
|
+
animation-name: --notification-max-height, --notification-margins;
|
|
111
|
+
animation-duration: calc(var(--vaadin-overlay-animation-duration) * 2 + var(--vaadin-overlay-animation-delay));
|
|
112
|
+
animation-delay: 0s;
|
|
113
|
+
animation-timing-function: ease-in-out, cubic-bezier(0.4, 1.1, 0, 1);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@media (prefers-reduced-motion) {
|
|
119
|
+
/* The height animation of the fallback above is a keyframe animation, not a transition */
|
|
120
|
+
:host(:is([opening], [closing])) {
|
|
121
|
+
animation-name: --fade !important;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@keyframes --notification-max-height {
|
|
126
|
+
0% {
|
|
127
|
+
max-height: 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
50% {
|
|
131
|
+
max-height: 20em;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@keyframes --notification-margins {
|
|
136
|
+
0% {
|
|
137
|
+
margin-top: 0;
|
|
138
|
+
margin-bottom: 0;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
33
141
|
`;
|
|
142
|
+
|
|
143
|
+
export const notificationCardStyles = [overlayAnimationStyles, notificationCard];
|
|
@@ -342,6 +342,42 @@ export const NotificationMixin = (superClass) =>
|
|
|
342
342
|
this._card.removeEventListener('animationend', this.__animationEndListener);
|
|
343
343
|
}
|
|
344
344
|
|
|
345
|
+
/**
|
|
346
|
+
* Detect whether an animation runs on the card, so that its end can be awaited before the
|
|
347
|
+
* card is removed. A card that is not rendered, has no animation name, or has a zero
|
|
348
|
+
* duration does not fire `animationend`.
|
|
349
|
+
*
|
|
350
|
+
* `getStateAnimations()` cannot replace this: the card declares the same keyframes for both
|
|
351
|
+
* states, so nothing restarts when it closes right after the opening animation ended, and no
|
|
352
|
+
* animation is found. The computed style still reports the declared animation, which is what
|
|
353
|
+
* the card needs in order to stay in the DOM until its height has collapsed.
|
|
354
|
+
* @private
|
|
355
|
+
*/
|
|
356
|
+
__shouldAnimateCard() {
|
|
357
|
+
const style = getComputedStyle(this._card);
|
|
358
|
+
const name = style.getPropertyValue('animation-name');
|
|
359
|
+
const hasDuration = style
|
|
360
|
+
.getPropertyValue('animation-duration')
|
|
361
|
+
.split(',')
|
|
362
|
+
.some((duration) => parseFloat(duration) > 0);
|
|
363
|
+
return style.getPropertyValue('display') !== 'none' && name && name !== 'none' && hasDuration;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Run the callback when the animation of the card itself ends. Animations of the
|
|
368
|
+
* notification content also end on the card, as the content is in its light DOM.
|
|
369
|
+
* @private
|
|
370
|
+
*/
|
|
371
|
+
__onCardAnimationEnd(callback) {
|
|
372
|
+
this.__animationEndListener = (event) => {
|
|
373
|
+
if (event.target !== this._card) {
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
callback();
|
|
377
|
+
};
|
|
378
|
+
this._card.addEventListener('animationend', this.__animationEndListener);
|
|
379
|
+
}
|
|
380
|
+
|
|
345
381
|
/** @private */
|
|
346
382
|
_animatedAppendNotificationCard() {
|
|
347
383
|
if (this._card) {
|
|
@@ -349,8 +385,11 @@ export const NotificationMixin = (superClass) =>
|
|
|
349
385
|
|
|
350
386
|
this._card.setAttribute('opening', '');
|
|
351
387
|
this._appendNotificationCard();
|
|
352
|
-
|
|
353
|
-
|
|
388
|
+
if (this.__shouldAnimateCard()) {
|
|
389
|
+
this.__onCardAnimationEnd(() => this.__cleanUpOpeningClosingState());
|
|
390
|
+
} else {
|
|
391
|
+
this.__cleanUpOpeningClosingState();
|
|
392
|
+
}
|
|
354
393
|
this._didAnimateNotificationAppend = true;
|
|
355
394
|
} else {
|
|
356
395
|
this._didAnimateNotificationAppend = false;
|
|
@@ -409,13 +448,11 @@ export const NotificationMixin = (superClass) =>
|
|
|
409
448
|
this.__cleanUpOpeningClosingState();
|
|
410
449
|
|
|
411
450
|
this._card.setAttribute('closing', '');
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
this.__animationEndListener = () => {
|
|
451
|
+
if (this.__shouldAnimateCard()) {
|
|
452
|
+
this.__onCardAnimationEnd(() => {
|
|
415
453
|
this._removeNotificationCard();
|
|
416
454
|
this.__cleanUpOpeningClosingState();
|
|
417
|
-
};
|
|
418
|
-
this._card.addEventListener('animationend', this.__animationEndListener);
|
|
455
|
+
});
|
|
419
456
|
} else {
|
|
420
457
|
this._removeNotificationCard();
|
|
421
458
|
}
|
|
@@ -17,6 +17,7 @@ import { NotificationContainerMixin, NotificationMixin } from './vaadin-notifica
|
|
|
17
17
|
/**
|
|
18
18
|
* An element used internally by `<vaadin-notification>`. Not intended to be used separately.
|
|
19
19
|
*
|
|
20
|
+
* @attr {string} theme - The theme variants to apply to the component.
|
|
20
21
|
* @customElement vaadin-notification-container
|
|
21
22
|
* @extends HTMLElement
|
|
22
23
|
* @private
|
|
@@ -55,6 +56,7 @@ class NotificationContainer extends NotificationContainerMixin(
|
|
|
55
56
|
/**
|
|
56
57
|
* An element used internally by `<vaadin-notification>`. Not intended to be used separately.
|
|
57
58
|
*
|
|
59
|
+
* @attr {string} theme - The theme variants to apply to the component.
|
|
58
60
|
* @customElement vaadin-notification-card
|
|
59
61
|
* @extends HTMLElement
|
|
60
62
|
* @private
|
|
@@ -147,6 +149,7 @@ class NotificationCard extends ThemableMixin(PolylitMixin(LumoInjectionMixin(Lit
|
|
|
147
149
|
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
148
150
|
* @fires {CustomEvent} closed - Fired when the notification is closed.
|
|
149
151
|
*
|
|
152
|
+
* @attr {string} theme - The theme variants to apply to the component.
|
|
150
153
|
* @customElement vaadin-notification
|
|
151
154
|
* @extends HTMLElement
|
|
152
155
|
*/
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/notification",
|
|
4
|
-
"version": "25.
|
|
4
|
+
"version": "25.3.0-alpha10",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -60,9 +60,7 @@
|
|
|
60
60
|
"description": "The theme variants to apply to the component.",
|
|
61
61
|
"value": {
|
|
62
62
|
"type": [
|
|
63
|
-
"string"
|
|
64
|
-
"null",
|
|
65
|
-
"undefined"
|
|
63
|
+
"string"
|
|
66
64
|
]
|
|
67
65
|
}
|
|
68
66
|
}
|