@vaadin/notification 24.4.0-dev.4b20a0c55.3 → 24.4.0-rc1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/notification",
3
- "version": "24.4.0-dev.4b20a0c55.3",
3
+ "version": "24.4.0-rc1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,16 +38,16 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "@polymer/polymer": "^3.0.0",
41
- "@vaadin/component-base": "24.4.0-dev.4b20a0c55.3",
42
- "@vaadin/lit-renderer": "24.4.0-dev.4b20a0c55.3",
43
- "@vaadin/vaadin-lumo-styles": "24.4.0-dev.4b20a0c55.3",
44
- "@vaadin/vaadin-material-styles": "24.4.0-dev.4b20a0c55.3",
45
- "@vaadin/vaadin-themable-mixin": "24.4.0-dev.4b20a0c55.3",
41
+ "@vaadin/component-base": "24.4.0-rc1",
42
+ "@vaadin/lit-renderer": "24.4.0-rc1",
43
+ "@vaadin/vaadin-lumo-styles": "24.4.0-rc1",
44
+ "@vaadin/vaadin-material-styles": "24.4.0-rc1",
45
+ "@vaadin/vaadin-themable-mixin": "24.4.0-rc1",
46
46
  "lit": "^3.0.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@esm-bundle/chai": "^4.3.4",
50
- "@vaadin/button": "24.4.0-dev.4b20a0c55.3",
50
+ "@vaadin/button": "24.4.0-rc1",
51
51
  "@vaadin/testing-helpers": "^0.6.0",
52
52
  "sinon": "^13.0.2"
53
53
  },
@@ -55,5 +55,5 @@
55
55
  "web-types.json",
56
56
  "web-types.lit.json"
57
57
  ],
58
- "gitHead": "41cf17453d7506fb635c088a0425e20b6e82b89b"
58
+ "gitHead": "a81e3b927d44c56613fa4e1307494a2acc81005f"
59
59
  }
@@ -484,16 +484,22 @@ class Notification extends OverlayClassMixin(ThemePropertyMixin(ElementMixin(Pol
484
484
  }
485
485
  }
486
486
 
487
+ /** @private */
488
+ __cleanUpOpeningClosingState() {
489
+ this._card.removeAttribute('opening');
490
+ this._card.removeAttribute('closing');
491
+ this._card.removeEventListener('animationend', this.__animationEndListener);
492
+ }
493
+
487
494
  /** @private */
488
495
  _animatedAppendNotificationCard() {
489
496
  if (this._card) {
497
+ this.__cleanUpOpeningClosingState();
498
+
490
499
  this._card.setAttribute('opening', '');
491
500
  this._appendNotificationCard();
492
- const listener = () => {
493
- this._card.removeEventListener('animationend', listener);
494
- this._card.removeAttribute('opening');
495
- };
496
- this._card.addEventListener('animationend', listener);
501
+ this.__animationEndListener = () => this.__cleanUpOpeningClosingState();
502
+ this._card.addEventListener('animationend', this.__animationEndListener);
497
503
  this._didAnimateNotificationAppend = true;
498
504
  } else {
499
505
  this._didAnimateNotificationAppend = false;
@@ -538,14 +544,16 @@ class Notification extends OverlayClassMixin(ThemePropertyMixin(ElementMixin(Pol
538
544
 
539
545
  /** @private */
540
546
  _animatedRemoveNotificationCard() {
547
+ this.__cleanUpOpeningClosingState();
548
+
541
549
  this._card.setAttribute('closing', '');
542
550
  const name = getComputedStyle(this._card).getPropertyValue('animation-name');
543
551
  if (name && name !== 'none') {
544
- const listener = () => {
552
+ this.__animationEndListener = () => {
545
553
  this._removeNotificationCard();
546
- this._card.removeEventListener('animationend', listener);
554
+ this.__cleanUpOpeningClosingState();
547
555
  };
548
- this._card.addEventListener('animationend', listener);
556
+ this._card.addEventListener('animationend', this.__animationEndListener);
549
557
  } else {
550
558
  this._removeNotificationCard();
551
559
  }
@@ -0,0 +1,4 @@
1
+ import '@vaadin/vaadin-lumo-styles/color.js';
2
+ import '@vaadin/vaadin-lumo-styles/spacing.js';
3
+ import '@vaadin/vaadin-lumo-styles/style.js';
4
+ import '@vaadin/vaadin-lumo-styles/typography.js';
@@ -0,0 +1,2 @@
1
+ import './vaadin-notification-styles.js';
2
+ import '../../src/vaadin-notification.js';
@@ -0,0 +1,2 @@
1
+ import '@vaadin/vaadin-material-styles/typography.js';
2
+ import '@vaadin/vaadin-material-styles/shadow.js';
@@ -0,0 +1,2 @@
1
+ import './vaadin-notification-styles.js';
2
+ import '../../src/vaadin-notification.js';
package/web-types.json ADDED
@@ -0,0 +1,125 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/web-types",
3
+ "name": "@vaadin/notification",
4
+ "version": "24.4.0-rc1",
5
+ "description-markup": "markdown",
6
+ "contributions": {
7
+ "html": {
8
+ "elements": [
9
+ {
10
+ "name": "vaadin-notification",
11
+ "description": "`<vaadin-notification>` is a Web Component providing accessible and customizable notifications (toasts).\n\n### Rendering\n\nThe content of the notification can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `notification` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `notification`. Before generating new content,\nusers are able to check if there is already content in `root` for reusing it.\n\n```html\n<vaadin-notification id=\"notification\"></vaadin-notification>\n```\n```js\nconst notification = document.querySelector('#notification');\nnotification.renderer = function(root, notification) {\n root.textContent = \"Your work has been saved\";\n};\n```\n\nRenderer is called on the opening of the notification.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n### Styling\n\n`<vaadin-notification>` uses `<vaadin-notification-card>` internal\nthemable component as the actual visible notification cards.\n\nThe following shadow DOM parts of the `<vaadin-notification-card>` are available for styling:\n\nPart name | Description\n----------------|----------------\n`overlay` | The notification container\n`content` | The content of the notification\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\nNote: the `theme` attribute value set on `<vaadin-notification>` is\npropagated to the internal `<vaadin-notification-card>`.",
12
+ "attributes": [
13
+ {
14
+ "name": "overlay-class",
15
+ "description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
16
+ "value": {
17
+ "type": [
18
+ "string",
19
+ "null",
20
+ "undefined"
21
+ ]
22
+ }
23
+ },
24
+ {
25
+ "name": "duration",
26
+ "description": "The duration in milliseconds to show the notification.\nSet to `0` or a negative number to disable the notification auto-closing.",
27
+ "value": {
28
+ "type": [
29
+ "number"
30
+ ]
31
+ }
32
+ },
33
+ {
34
+ "name": "opened",
35
+ "description": "True if the notification is currently displayed.",
36
+ "value": {
37
+ "type": [
38
+ "boolean"
39
+ ]
40
+ }
41
+ },
42
+ {
43
+ "name": "position",
44
+ "description": "Alignment of the notification in the viewport\nValid values are `top-stretch|top-start|top-center|top-end|middle|bottom-start|bottom-center|bottom-end|bottom-stretch`",
45
+ "value": {
46
+ "type": [
47
+ "NotificationPosition"
48
+ ]
49
+ }
50
+ },
51
+ {
52
+ "name": "theme",
53
+ "description": "The theme variants to apply to the component.",
54
+ "value": {
55
+ "type": [
56
+ "string",
57
+ "null",
58
+ "undefined"
59
+ ]
60
+ }
61
+ }
62
+ ],
63
+ "js": {
64
+ "properties": [
65
+ {
66
+ "name": "overlayClass",
67
+ "description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
68
+ "value": {
69
+ "type": [
70
+ "string",
71
+ "null",
72
+ "undefined"
73
+ ]
74
+ }
75
+ },
76
+ {
77
+ "name": "duration",
78
+ "description": "The duration in milliseconds to show the notification.\nSet to `0` or a negative number to disable the notification auto-closing.",
79
+ "value": {
80
+ "type": [
81
+ "number"
82
+ ]
83
+ }
84
+ },
85
+ {
86
+ "name": "opened",
87
+ "description": "True if the notification is currently displayed.",
88
+ "value": {
89
+ "type": [
90
+ "boolean"
91
+ ]
92
+ }
93
+ },
94
+ {
95
+ "name": "position",
96
+ "description": "Alignment of the notification in the viewport\nValid values are `top-stretch|top-start|top-center|top-end|middle|bottom-start|bottom-center|bottom-end|bottom-stretch`",
97
+ "value": {
98
+ "type": [
99
+ "NotificationPosition"
100
+ ]
101
+ }
102
+ },
103
+ {
104
+ "name": "renderer",
105
+ "description": "Custom function for rendering the content of the notification.\nReceives two arguments:\n\n- `root` The `<vaadin-notification-card>` DOM element. Append\n your content to it.\n- `notification` The reference to the `<vaadin-notification>` element.",
106
+ "value": {
107
+ "type": [
108
+ "NotificationRenderer",
109
+ "undefined"
110
+ ]
111
+ }
112
+ }
113
+ ],
114
+ "events": [
115
+ {
116
+ "name": "opened-changed",
117
+ "description": "Fired when the `opened` property changes."
118
+ }
119
+ ]
120
+ }
121
+ }
122
+ ]
123
+ }
124
+ }
125
+ }
@@ -0,0 +1,69 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/web-types",
3
+ "name": "@vaadin/notification",
4
+ "version": "24.4.0-rc1",
5
+ "description-markup": "markdown",
6
+ "framework": "lit",
7
+ "framework-config": {
8
+ "enable-when": {
9
+ "node-packages": [
10
+ "lit"
11
+ ]
12
+ }
13
+ },
14
+ "contributions": {
15
+ "html": {
16
+ "elements": [
17
+ {
18
+ "name": "vaadin-notification",
19
+ "description": "`<vaadin-notification>` is a Web Component providing accessible and customizable notifications (toasts).\n\n### Rendering\n\nThe content of the notification can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `notification` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `notification`. Before generating new content,\nusers are able to check if there is already content in `root` for reusing it.\n\n```html\n<vaadin-notification id=\"notification\"></vaadin-notification>\n```\n```js\nconst notification = document.querySelector('#notification');\nnotification.renderer = function(root, notification) {\n root.textContent = \"Your work has been saved\";\n};\n```\n\nRenderer is called on the opening of the notification.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n### Styling\n\n`<vaadin-notification>` uses `<vaadin-notification-card>` internal\nthemable component as the actual visible notification cards.\n\nThe following shadow DOM parts of the `<vaadin-notification-card>` are available for styling:\n\nPart name | Description\n----------------|----------------\n`overlay` | The notification container\n`content` | The content of the notification\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\nNote: the `theme` attribute value set on `<vaadin-notification>` is\npropagated to the internal `<vaadin-notification-card>`.",
20
+ "extension": true,
21
+ "attributes": [
22
+ {
23
+ "name": "?opened",
24
+ "description": "True if the notification is currently displayed.",
25
+ "value": {
26
+ "kind": "expression"
27
+ }
28
+ },
29
+ {
30
+ "name": ".overlayClass",
31
+ "description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
32
+ "value": {
33
+ "kind": "expression"
34
+ }
35
+ },
36
+ {
37
+ "name": ".duration",
38
+ "description": "The duration in milliseconds to show the notification.\nSet to `0` or a negative number to disable the notification auto-closing.",
39
+ "value": {
40
+ "kind": "expression"
41
+ }
42
+ },
43
+ {
44
+ "name": ".position",
45
+ "description": "Alignment of the notification in the viewport\nValid values are `top-stretch|top-start|top-center|top-end|middle|bottom-start|bottom-center|bottom-end|bottom-stretch`",
46
+ "value": {
47
+ "kind": "expression"
48
+ }
49
+ },
50
+ {
51
+ "name": ".renderer",
52
+ "description": "Custom function for rendering the content of the notification.\nReceives two arguments:\n\n- `root` The `<vaadin-notification-card>` DOM element. Append\n your content to it.\n- `notification` The reference to the `<vaadin-notification>` element.",
53
+ "value": {
54
+ "kind": "expression"
55
+ }
56
+ },
57
+ {
58
+ "name": "@opened-changed",
59
+ "description": "Fired when the `opened` property changes.",
60
+ "value": {
61
+ "kind": "expression"
62
+ }
63
+ }
64
+ ]
65
+ }
66
+ ]
67
+ }
68
+ }
69
+ }