@su-labs/notifications 22.2.0 → 22.3.1
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/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [22.3.1] - 2026-11-16
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
- Uses `@su-labs/core` 1.9.0 (was 1.3.0), the same version as every other `@su-labs` package, so apps using several of them install core once
|
|
14
|
+
|
|
15
|
+
## [22.3.0] - 2026-11-07
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
- Links inside the message: pass `message` as a list of text and links (`{ label, onClick, dismiss }`), each link closing the notification unless `dismiss: false`
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- Depends on exactly `@su-labs/core` 1.3.0
|
|
22
|
+
|
|
10
23
|
## [22.2.0] - 2026-11-07
|
|
11
24
|
|
|
12
25
|
### Added
|
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
A highly customizable Angular notification library built with modern practices, including reactive Signals. Easily display different types of notifications with various positions, custom icons, and optional auto-closing behavior.
|
|
15
15
|
|
|
16
|
-
> **Not using Angular?** The same notification logic is available for React, Svelte, vanilla JavaScript and Node in [`@su-labs/core`](https://www.npmjs.com/package/@su-labs/core). See the [installation guides](https://github.com/Greezaaa/settings-utils-lib/blob/main/docs/README.md).
|
|
16
|
+
> **Not using Angular?** The same notification logic is available for React, Vue, Svelte, vanilla JavaScript and Node in [`@su-labs/core`](https://www.npmjs.com/package/@su-labs/core). See the [installation guides](https://github.com/Greezaaa/settings-utils-lib/blob/main/docs/README.md).
|
|
17
17
|
|
|
18
18
|
## Table of Contents
|
|
19
19
|
|
|
@@ -64,6 +64,8 @@ You can install this library via npm:
|
|
|
64
64
|
npm install @su-labs/notifications
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
+
On Angular 19 or 20, install the matching version: `npm install @su-labs/notifications@ng19` or `npm install @su-labs/notifications@ng20`.
|
|
68
|
+
|
|
67
69
|
## Peer Dependencies
|
|
68
70
|
|
|
69
71
|
This library requires the following peer dependencies:
|
|
@@ -221,7 +223,7 @@ type NotificationPosition =
|
|
|
221
223
|
|
|
222
224
|
interface NotificationConfig {
|
|
223
225
|
type: NotificationType;
|
|
224
|
-
message: string;
|
|
226
|
+
message: string | (string | NotificationAction)[]; // Text, or text and links
|
|
225
227
|
duration?: number; // Default: 3000ms
|
|
226
228
|
autoClose?: boolean; // Default: true
|
|
227
229
|
cssClass?: string; // Custom CSS class
|
|
@@ -252,6 +254,19 @@ this.notifications.show({
|
|
|
252
254
|
});
|
|
253
255
|
```
|
|
254
256
|
|
|
257
|
+
### Links in the message
|
|
258
|
+
|
|
259
|
+
Pass `message` as a list to make part of it a link. Text pieces show as they are; each `{ label, onClick }` piece is a link that runs `onClick`, then closes the notification unless it sets `dismiss: false`:
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
this.notifications.show({
|
|
263
|
+
type: 'info',
|
|
264
|
+
message: ['New: ', { label: 'Sliding puzzle', onClick: () => this.router.navigateByUrl('/sliding-puzzle') }],
|
|
265
|
+
});
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Restyle the links with the `.link` class inside `su-lib-notifications`.
|
|
269
|
+
|
|
255
270
|
## Configuration Options
|
|
256
271
|
|
|
257
272
|
### Notification Types
|
|
@@ -93,8 +93,8 @@ var SuNotificationComponent = class SuNotificationComponent {
|
|
|
93
93
|
isStandalone: true,
|
|
94
94
|
selector: "su-lib-notifications",
|
|
95
95
|
ngImport: i0,
|
|
96
|
-
template: "<div class=\"notification-container {{ service.position }}\" [attr.data-slide]=\"service.slideFrom\">\n @for (notification of notifications(); track notification.id) {\n <div\n class=\"notification {{ notification.type }} {{ notification.cssClass ?? '' }}\"\n animate.enter=\"su-notification-enter\"\n animate.leave=\"su-notification-leave\"\n >\n\n <div class=\"icon-container\">\n @if (notification.icon) {\n @if (isImage(notification.icon!)) {\n <img [src]=\"notification.icon\" alt=\"icon\" />\n } @else if (typeof notification.icon === 'string') {\n <span [innerHTML]=\"getSanitizedIcon(notification.icon)\"></span>\n }\n
|
|
97
|
-
styles: [".notification-container{--_edge: var(--su-notification-container-position, 1rem);--_left: calc(-100% - 2rem) 0;--_right: calc(100% + 2rem) 0;--_top: 0 calc(-100% - 2rem) ;--_bottom: 0 calc(100% + 2rem) ;position:fixed;pointer-events:none;display:flex;flex-direction:column;gap:var(--su-notification-container-gap, 1.2rem);width:var(--su-notification-width, max-content);max-width:var(--su-notification-max-width, min(100% - 2rem, 300px));z-index:999999}.notification-container[class*=top-]{top:var(--_edge);--_slide: var(--_top)}.notification-container[class*=bottom-]{bottom:var(--_edge);flex-direction:column-reverse;--_slide: var(--_bottom)}.notification-container[class*=-right]{align-items:flex-end;right:var(--_edge);--_slide: var(--_right)}.notification-container[class*=-left]{align-items:flex-start;left:var(--_edge);--_slide: var(--_left)}.notification-container[class*=-center]{align-items:center;left:50%;translate:-50% 0}.notification-container[data-slide=left]{--_slide: var(--_left)}.notification-container[data-slide=right]{--_slide: var(--_right)}.notification-container[data-slide=top]{--_slide: var(--_top)}.notification-container[data-slide=bottom]{--_slide: var(--_bottom)}.notification{position:relative;pointer-events:auto;background-color:var(--su-notification-background-color, #fff);color:var(--su-notification-text-color, #333);padding-block:var(--su-notification-padding-block, 1rem);padding-inline:var(--su-notification-padding-inline, 1.25rem);--_shadow: 0 4px 8px var(--su-notification-box-shadow, rgba(0, 0, 0, .15));box-shadow:var(--_shadow);border-left:4px solid var(--_border);display:flex;align-items:center;gap:1rem}.notification.success{--_border: var(--su-notification-success-border-color, #4caf50)}.notification.info{--_border: var(--su-notification-info-border-color, #2196f3)}.notification.warning{--_border: var(--su-notification-warning-border-color, #ff9800)}.notification.error{--_border: var(--su-notification-error-border-color, #f44336)}.notification.custom{--_border: var(--su-notification-custom-border-color, #9c27b0)}.notification .
|
|
96
|
+
template: "<div class=\"notification-container {{ service.position }}\" [attr.data-slide]=\"service.slideFrom\">\n @for (notification of notifications(); track notification.id) {\n <div\n class=\"notification {{ notification.type }} {{ notification.cssClass ?? '' }}\"\n animate.enter=\"su-notification-enter\"\n animate.leave=\"su-notification-leave\"\n >\n\n <div class=\"icon-container\">\n @if (notification.icon) {\n @if (isImage(notification.icon!)) {\n <img [src]=\"notification.icon\" alt=\"icon\" />\n } @else if (typeof notification.icon === 'string') {\n <span [innerHTML]=\"getSanitizedIcon(notification.icon)\"></span>\n }\n @else {\n @switch (notification.type) {\n @case('success') {\n <svg class=\"icon\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M20 6L9 17l-5-5\" />\n </svg>\n }\n @case('info') {\n <svg class=\"icon\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"12\" y1=\"16\" x2=\"12\" y2=\"12\" />\n <line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"8\" />\n </svg>\n }\n @case('warning') {\n <svg class=\"icon\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z\" />\n <line x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\" />\n <line x1=\"12\" y1=\"17\" x2=\"12\" y2=\"17\" />\n </svg>\n }\n @case('error') {\n <svg class=\"icon\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"15\" y1=\"9\" x2=\"9\" y2=\"15\" />\n <line x1=\"9\" y1=\"9\" x2=\"15\" y2=\"15\" />\n </svg>\n }\n }\n }\n }\n </div>\n\n <div class=\"content\">\n <span class=\"message\">\n @if (typeof notification.message === 'string') {\n {{ notification.message }}\n } @else {\n @for (part of notification.message; track $index) {\n @if (typeof part === 'string') {{{ part }}} @else {<button class=\"link\" type=\"button\" (click)=\"runAction(notification.id, part)\">{{ part.label }}</button>}\n }\n }\n </span>\n\n @if (notification.actions?.length) {\n <div class=\"actions\">\n @for (action of notification.actions; track $index) {\n <button class=\"action\" type=\"button\" (click)=\"runAction(notification.id, action)\">{{ action.label }}</button>\n }\n </div>\n }\n </div>\n\n <button class=\"close\" (click)=\"dismiss(notification.id)\" type=\"button\">×</button>\n </div>\n }\n</div>\n\n\n",
|
|
97
|
+
styles: [".notification-container{--_edge: var(--su-notification-container-position, 1rem);--_left: calc(-100% - 2rem) 0;--_right: calc(100% + 2rem) 0;--_top: 0 calc(-100% - 2rem) ;--_bottom: 0 calc(100% + 2rem) ;position:fixed;pointer-events:none;display:flex;flex-direction:column;gap:var(--su-notification-container-gap, 1.2rem);width:var(--su-notification-width, max-content);max-width:var(--su-notification-max-width, min(100% - 2rem, 300px));z-index:999999}.notification-container[class*=top-]{top:var(--_edge);--_slide: var(--_top)}.notification-container[class*=bottom-]{bottom:var(--_edge);flex-direction:column-reverse;--_slide: var(--_bottom)}.notification-container[class*=-right]{align-items:flex-end;right:var(--_edge);--_slide: var(--_right)}.notification-container[class*=-left]{align-items:flex-start;left:var(--_edge);--_slide: var(--_left)}.notification-container[class*=-center]{align-items:center;left:50%;translate:-50% 0}.notification-container[data-slide=left]{--_slide: var(--_left)}.notification-container[data-slide=right]{--_slide: var(--_right)}.notification-container[data-slide=top]{--_slide: var(--_top)}.notification-container[data-slide=bottom]{--_slide: var(--_bottom)}.notification{position:relative;pointer-events:auto;background-color:var(--su-notification-background-color, #fff);color:var(--su-notification-text-color, #333);padding-block:var(--su-notification-padding-block, 1rem);padding-inline:var(--su-notification-padding-inline, 1.25rem);--_shadow: 0 4px 8px var(--su-notification-box-shadow, rgba(0, 0, 0, .15));box-shadow:var(--_shadow);border-left:4px solid var(--_border);display:flex;align-items:center;gap:1rem}.notification.success{--_border: var(--su-notification-success-border-color, #4caf50)}.notification.info{--_border: var(--su-notification-info-border-color, #2196f3)}.notification.warning{--_border: var(--su-notification-warning-border-color, #ff9800)}.notification.error{--_border: var(--su-notification-error-border-color, #f44336)}.notification.custom{--_border: var(--su-notification-custom-border-color, #9c27b0)}.notification .close{--_size: var(--su-notification-close-btn-size, 20px);position:absolute;width:var(--_size);height:var(--_size);top:calc(var(--_size) / -2);right:calc(var(--_size) / -2);background:var(--su-notification-close-btn-background-color, var(--su-notification-background-color, #fff));color:var(--su-notification-close-btn-text-color, var(--su-notification-text-color, #333));border:1px solid var(--su-notification-close-btn-border-color, rgba(0, 0, 0, 0));border-radius:var(--su-notification-close-btn-border-radius, 50%);box-shadow:var(--_shadow);font-size:var(--su-notification-close-btn-font-size, 1rem);display:flex;justify-content:center;align-items:center;line-height:1;cursor:pointer}.notification .close:hover{background:var(--su-notification-close-btn-hover-background, rgba(51, 51, 51, .5));color:var(--su-notification-close-btn-hover-color, #fff)}.icon-container{display:flex;align-items:center;justify-content:center;width:var(--su-notification-icon-width, 24px);height:var(--su-notification-icon-height, var(--su-notification-icon-width, 24px));color:var(--su-notification-icon-color, currentColor)}.icon{width:100%;height:100%}.content{display:grid;flex:1;gap:.75rem}.actions{display:flex;flex-wrap:wrap;gap:.5rem}.action,.link{background:none;color:inherit;cursor:pointer;font:inherit}.action{border:1px solid var(--su-notification-action-border-color, currentColor);border-radius:6px;padding:.25rem .75rem}.link{border:0;padding:0;text-decoration:underline}.su-notification-enter{animation:su-notification-slide var(--su-notification-enter-duration, .4s) ease-out}.su-notification-leave{animation:su-notification-slide var(--su-notification-leave-duration, .3s) ease-in reverse forwards}@keyframes su-notification-slide{0%{opacity:0;translate:var(--_slide)}}@media(prefers-reduced-motion:reduce){.su-notification-enter,.su-notification-leave{animation:none}}\n"],
|
|
98
98
|
changeDetection: i0.ChangeDetectionStrategy.Eager
|
|
99
99
|
});
|
|
100
100
|
};
|
|
@@ -109,8 +109,8 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
109
109
|
selector: "su-lib-notifications",
|
|
110
110
|
standalone: true,
|
|
111
111
|
changeDetection: ChangeDetectionStrategy.Eager,
|
|
112
|
-
template: "<div class=\"notification-container {{ service.position }}\" [attr.data-slide]=\"service.slideFrom\">\n @for (notification of notifications(); track notification.id) {\n <div\n class=\"notification {{ notification.type }} {{ notification.cssClass ?? '' }}\"\n animate.enter=\"su-notification-enter\"\n animate.leave=\"su-notification-leave\"\n >\n\n <div class=\"icon-container\">\n @if (notification.icon) {\n @if (isImage(notification.icon!)) {\n <img [src]=\"notification.icon\" alt=\"icon\" />\n } @else if (typeof notification.icon === 'string') {\n <span [innerHTML]=\"getSanitizedIcon(notification.icon)\"></span>\n }\n
|
|
113
|
-
styles: [".notification-container{--_edge: var(--su-notification-container-position, 1rem);--_left: calc(-100% - 2rem) 0;--_right: calc(100% + 2rem) 0;--_top: 0 calc(-100% - 2rem) ;--_bottom: 0 calc(100% + 2rem) ;position:fixed;pointer-events:none;display:flex;flex-direction:column;gap:var(--su-notification-container-gap, 1.2rem);width:var(--su-notification-width, max-content);max-width:var(--su-notification-max-width, min(100% - 2rem, 300px));z-index:999999}.notification-container[class*=top-]{top:var(--_edge);--_slide: var(--_top)}.notification-container[class*=bottom-]{bottom:var(--_edge);flex-direction:column-reverse;--_slide: var(--_bottom)}.notification-container[class*=-right]{align-items:flex-end;right:var(--_edge);--_slide: var(--_right)}.notification-container[class*=-left]{align-items:flex-start;left:var(--_edge);--_slide: var(--_left)}.notification-container[class*=-center]{align-items:center;left:50%;translate:-50% 0}.notification-container[data-slide=left]{--_slide: var(--_left)}.notification-container[data-slide=right]{--_slide: var(--_right)}.notification-container[data-slide=top]{--_slide: var(--_top)}.notification-container[data-slide=bottom]{--_slide: var(--_bottom)}.notification{position:relative;pointer-events:auto;background-color:var(--su-notification-background-color, #fff);color:var(--su-notification-text-color, #333);padding-block:var(--su-notification-padding-block, 1rem);padding-inline:var(--su-notification-padding-inline, 1.25rem);--_shadow: 0 4px 8px var(--su-notification-box-shadow, rgba(0, 0, 0, .15));box-shadow:var(--_shadow);border-left:4px solid var(--_border);display:flex;align-items:center;gap:1rem}.notification.success{--_border: var(--su-notification-success-border-color, #4caf50)}.notification.info{--_border: var(--su-notification-info-border-color, #2196f3)}.notification.warning{--_border: var(--su-notification-warning-border-color, #ff9800)}.notification.error{--_border: var(--su-notification-error-border-color, #f44336)}.notification.custom{--_border: var(--su-notification-custom-border-color, #9c27b0)}.notification .
|
|
112
|
+
template: "<div class=\"notification-container {{ service.position }}\" [attr.data-slide]=\"service.slideFrom\">\n @for (notification of notifications(); track notification.id) {\n <div\n class=\"notification {{ notification.type }} {{ notification.cssClass ?? '' }}\"\n animate.enter=\"su-notification-enter\"\n animate.leave=\"su-notification-leave\"\n >\n\n <div class=\"icon-container\">\n @if (notification.icon) {\n @if (isImage(notification.icon!)) {\n <img [src]=\"notification.icon\" alt=\"icon\" />\n } @else if (typeof notification.icon === 'string') {\n <span [innerHTML]=\"getSanitizedIcon(notification.icon)\"></span>\n }\n @else {\n @switch (notification.type) {\n @case('success') {\n <svg class=\"icon\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M20 6L9 17l-5-5\" />\n </svg>\n }\n @case('info') {\n <svg class=\"icon\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"12\" y1=\"16\" x2=\"12\" y2=\"12\" />\n <line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"8\" />\n </svg>\n }\n @case('warning') {\n <svg class=\"icon\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z\" />\n <line x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\" />\n <line x1=\"12\" y1=\"17\" x2=\"12\" y2=\"17\" />\n </svg>\n }\n @case('error') {\n <svg class=\"icon\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"15\" y1=\"9\" x2=\"9\" y2=\"15\" />\n <line x1=\"9\" y1=\"9\" x2=\"15\" y2=\"15\" />\n </svg>\n }\n }\n }\n }\n </div>\n\n <div class=\"content\">\n <span class=\"message\">\n @if (typeof notification.message === 'string') {\n {{ notification.message }}\n } @else {\n @for (part of notification.message; track $index) {\n @if (typeof part === 'string') {{{ part }}} @else {<button class=\"link\" type=\"button\" (click)=\"runAction(notification.id, part)\">{{ part.label }}</button>}\n }\n }\n </span>\n\n @if (notification.actions?.length) {\n <div class=\"actions\">\n @for (action of notification.actions; track $index) {\n <button class=\"action\" type=\"button\" (click)=\"runAction(notification.id, action)\">{{ action.label }}</button>\n }\n </div>\n }\n </div>\n\n <button class=\"close\" (click)=\"dismiss(notification.id)\" type=\"button\">×</button>\n </div>\n }\n</div>\n\n\n",
|
|
113
|
+
styles: [".notification-container{--_edge: var(--su-notification-container-position, 1rem);--_left: calc(-100% - 2rem) 0;--_right: calc(100% + 2rem) 0;--_top: 0 calc(-100% - 2rem) ;--_bottom: 0 calc(100% + 2rem) ;position:fixed;pointer-events:none;display:flex;flex-direction:column;gap:var(--su-notification-container-gap, 1.2rem);width:var(--su-notification-width, max-content);max-width:var(--su-notification-max-width, min(100% - 2rem, 300px));z-index:999999}.notification-container[class*=top-]{top:var(--_edge);--_slide: var(--_top)}.notification-container[class*=bottom-]{bottom:var(--_edge);flex-direction:column-reverse;--_slide: var(--_bottom)}.notification-container[class*=-right]{align-items:flex-end;right:var(--_edge);--_slide: var(--_right)}.notification-container[class*=-left]{align-items:flex-start;left:var(--_edge);--_slide: var(--_left)}.notification-container[class*=-center]{align-items:center;left:50%;translate:-50% 0}.notification-container[data-slide=left]{--_slide: var(--_left)}.notification-container[data-slide=right]{--_slide: var(--_right)}.notification-container[data-slide=top]{--_slide: var(--_top)}.notification-container[data-slide=bottom]{--_slide: var(--_bottom)}.notification{position:relative;pointer-events:auto;background-color:var(--su-notification-background-color, #fff);color:var(--su-notification-text-color, #333);padding-block:var(--su-notification-padding-block, 1rem);padding-inline:var(--su-notification-padding-inline, 1.25rem);--_shadow: 0 4px 8px var(--su-notification-box-shadow, rgba(0, 0, 0, .15));box-shadow:var(--_shadow);border-left:4px solid var(--_border);display:flex;align-items:center;gap:1rem}.notification.success{--_border: var(--su-notification-success-border-color, #4caf50)}.notification.info{--_border: var(--su-notification-info-border-color, #2196f3)}.notification.warning{--_border: var(--su-notification-warning-border-color, #ff9800)}.notification.error{--_border: var(--su-notification-error-border-color, #f44336)}.notification.custom{--_border: var(--su-notification-custom-border-color, #9c27b0)}.notification .close{--_size: var(--su-notification-close-btn-size, 20px);position:absolute;width:var(--_size);height:var(--_size);top:calc(var(--_size) / -2);right:calc(var(--_size) / -2);background:var(--su-notification-close-btn-background-color, var(--su-notification-background-color, #fff));color:var(--su-notification-close-btn-text-color, var(--su-notification-text-color, #333));border:1px solid var(--su-notification-close-btn-border-color, rgba(0, 0, 0, 0));border-radius:var(--su-notification-close-btn-border-radius, 50%);box-shadow:var(--_shadow);font-size:var(--su-notification-close-btn-font-size, 1rem);display:flex;justify-content:center;align-items:center;line-height:1;cursor:pointer}.notification .close:hover{background:var(--su-notification-close-btn-hover-background, rgba(51, 51, 51, .5));color:var(--su-notification-close-btn-hover-color, #fff)}.icon-container{display:flex;align-items:center;justify-content:center;width:var(--su-notification-icon-width, 24px);height:var(--su-notification-icon-height, var(--su-notification-icon-width, 24px));color:var(--su-notification-icon-color, currentColor)}.icon{width:100%;height:100%}.content{display:grid;flex:1;gap:.75rem}.actions{display:flex;flex-wrap:wrap;gap:.5rem}.action,.link{background:none;color:inherit;cursor:pointer;font:inherit}.action{border:1px solid var(--su-notification-action-border-color, currentColor);border-radius:6px;padding:.25rem .75rem}.link{border:0;padding:0;text-decoration:underline}.su-notification-enter{animation:su-notification-slide var(--su-notification-enter-duration, .4s) ease-out}.su-notification-leave{animation:su-notification-slide var(--su-notification-leave-duration, .3s) ease-in reverse forwards}@keyframes su-notification-slide{0%{opacity:0;translate:var(--_slide)}}@media(prefers-reduced-motion:reduce){.su-notification-enter,.su-notification-leave{animation:none}}\n"]
|
|
114
114
|
}]
|
|
115
115
|
}]
|
|
116
116
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"su-labs-notifications.mjs","names":[],"sources":["../../../../projects/su-labs/notifications/src/lib/notification.service.ts","../../../../projects/su-labs/notifications/src/lib/notification.component.ts","../../../../projects/su-labs/notifications/src/lib/notification.component.html"],"sourcesContent":["import { Injectable, OnDestroy, signal } from '@angular/core';\nimport {\n SuNotification,\n SuNotificationConfig,\n SuNotificationController,\n SuNotificationOptions,\n SuNotificationPosition,\n SuNotificationSlide,\n} from '@su-labs/core/notifications';\n\n/**\n * Angular service for managing notifications.\n *\n * Thin wrapper around the framework-agnostic `SuNotificationController` from\n * `@su-labs/core/notifications` that exposes the notifications as an Angular signal.\n */\n@Injectable({ providedIn: 'root' })\nexport class SuNotificationService implements OnDestroy {\n /** Framework-agnostic notification logic */\n private readonly controller = new SuNotificationController();\n\n /** Internal signal holding the list of notifications, kept in sync with the controller */\n private readonly _notifications = signal<SuNotification[]>(this.controller.notifications.get());\n\n /**\n * Read-only access to the notifications list.\n * Can be used in templates for reactive updates.\n */\n readonly notifications = this._notifications.asReadonly();\n\n /** Stops syncing the controller's notifications into the signal */\n private readonly unsubscribe = this.controller.notifications.subscribe((list) => this._notifications.set(list));\n\n /**\n * Position where notifications appear on the screen.\n * Can also be set via the `configure` method.\n * @default 'top-right'\n */\n get position(): SuNotificationPosition {\n return this.controller.position.get();\n }\n\n set position(position: SuNotificationPosition) {\n this.controller.configure({ position });\n }\n\n /**\n * The direction notifications slide in from, whatever their position.\n * Can also be set via the `configure` method.\n * @default 'auto'\n */\n get slideFrom(): SuNotificationSlide {\n return this.controller.slideFrom.get();\n }\n\n set slideFrom(slideFrom: SuNotificationSlide) {\n this.controller.configure({ slideFrom });\n }\n\n /**\n * Configure the notification service.\n * @param cfg Configuration object\n * @param cfg.position Optional position to display notifications.\n * @param cfg.slideFrom Optional direction notifications slide in from.\n */\n configure(cfg: SuNotificationConfig): void {\n this.controller.configure(cfg);\n }\n\n /**\n * Show a new notification.\n * @param options Options to configure the notification.\n * @returns The unique ID of the notification.\n */\n show(options: SuNotificationOptions): string {\n return this.controller.show(options);\n }\n\n /**\n * Dismiss a specific notification by its ID.\n * @param id ID of the notification to remove.\n */\n dismiss(id: string): void {\n this.controller.dismiss(id);\n }\n\n /**\n * Clear all notifications immediately.\n */\n clearAll(): void {\n this.controller.clearAll();\n }\n\n /** Angular lifecycle hook for service destruction */\n ngOnDestroy(): void {\n this.unsubscribe();\n this.controller.destroy();\n }\n}\n","import { Component, inject, ChangeDetectionStrategy } from '@angular/core';\nimport { SuNotificationService } from './notification.service';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { isSuNotificationImageIcon, SuNotificationAction } from '@su-labs/core/notifications';\n\n/**\n * Component to display notifications on the screen.\n *\n * Uses `SuNotificationService` to manage and render notifications.\n */\n@Component({\n selector: 'su-lib-notifications',\n standalone: true,\n templateUrl: './notification.component.html',\n changeDetection: ChangeDetectionStrategy.Eager,\n styleUrls: ['./notification.component.scss'],\n})\nexport class SuNotificationComponent {\n /** Injected notification service */\n service = inject(SuNotificationService);\n\n /** Read-only signal of the current notifications */\n notifications = this.service.notifications;\n\n /** Angular sanitizer to safely render inline SVG strings */\n private sanitizer = inject(DomSanitizer);\n\n /**\n * Dismiss a notification by its ID.\n * Delegates to the service.\n * @param id ID of the notification to dismiss\n */\n dismiss(id: string): void {\n this.service.dismiss(id);\n }\n\n /**\n * Runs an action button of a notification, then closes the notification unless the action says not to.\n * @param id ID of the notification the button belongs to\n * @param action The action that was pressed\n */\n runAction(id: string, action: SuNotificationAction): void {\n action.onClick();\n if (action.dismiss !== false) {\n this.service.dismiss(id);\n }\n }\n\n /**\n * Checks if the provided `icon` value should be rendered as an image (`<img>`).\n * Inline SVG strings are rendered with `[innerHTML]` instead.\n * See `isSuNotificationImageIcon` in `@su-labs/core/notifications` for the rules.\n *\n * @param icon The icon value from the notification (boolean or string)\n * @returns `true` if the icon is an image path or URL\n */\n isImage(icon: string | boolean): boolean {\n return isSuNotificationImageIcon(icon);\n }\n\n /**\n * Sanitizes an inline SVG string so it can be safely rendered with [innerHTML].\n *\n * @param icon Inline SVG string\n * @returns SafeHtml object that can be bound to [innerHTML]\n */\n getSanitizedIcon(icon: string): SafeHtml {\n return this.sanitizer.bypassSecurityTrustHtml(icon);\n }\n}\n","<div class=\"notification-container {{ service.position }}\" [attr.data-slide]=\"service.slideFrom\">\n\t@for (notification of notifications(); track notification.id) {\n\t<div\n\t\tclass=\"notification {{ notification.type }} {{ notification.cssClass ?? '' }}\"\n\t\tanimate.enter=\"su-notification-enter\"\n\t\tanimate.leave=\"su-notification-leave\"\n\t>\n\n\t\t<div class=\"icon-container\">\n\t\t\t@if (notification.icon) {\n\t\t\t\t@if (isImage(notification.icon!)) {\n\t\t\t\t\t<img [src]=\"notification.icon\" alt=\"icon\" />\n\t\t\t\t} @else if (typeof notification.icon === 'string') {\n\t\t\t\t\t<span [innerHTML]=\"getSanitizedIcon(notification.icon)\"></span>\n\t\t\t\t}\n\t\t\t<!-- if icon === true, render default SVG via switch -->\n\t\t\t\t@else {\n\t\t\t\t\t@switch (notification.type) {\n\t\t\t\t\t@case('success') {\n\t\t\t\t\t\t<svg class=\"icon\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"\n\t\t\t\t\t\t\tstroke-linecap=\"round\" stroke-linejoin=\"round\">\n\t\t\t\t\t\t\t<path d=\"M20 6L9 17l-5-5\" />\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t}\n\t\t\t\t\t@case('info') {\n\t\t\t\t\t\t<svg class=\"icon\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"\n\t\t\t\t\t\t\tstroke-linecap=\"round\" stroke-linejoin=\"round\">\n\t\t\t\t\t\t\t<circle cx=\"12\" cy=\"12\" r=\"10\" />\n\t\t\t\t\t\t\t<line x1=\"12\" y1=\"16\" x2=\"12\" y2=\"12\" />\n\t\t\t\t\t\t\t<line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"8\" />\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t}\n\t\t\t\t\t@case('warning') {\n\t\t\t\t\t\t<svg class=\"icon\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"\n\t\t\t\t\t\t\tstroke-linecap=\"round\" stroke-linejoin=\"round\">\n\t\t\t\t\t\t\t<path d=\"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z\" />\n\t\t\t\t\t\t\t<line x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\" />\n\t\t\t\t\t\t\t<line x1=\"12\" y1=\"17\" x2=\"12\" y2=\"17\" />\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t}\n\t\t\t\t\t@case('error') {\n\t\t\t\t\t\t<svg class=\"icon\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"\n\t\t\t\t\t\t\tstroke-linecap=\"round\" stroke-linejoin=\"round\">\n\t\t\t\t\t\t\t<circle cx=\"12\" cy=\"12\" r=\"10\" />\n\t\t\t\t\t\t\t<line x1=\"15\" y1=\"9\" x2=\"9\" y2=\"15\" />\n\t\t\t\t\t\t\t<line x1=\"9\" y1=\"9\" x2=\"15\" y2=\"15\" />\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t</div>\n\n\t\t<div class=\"content\">\n\t\t\t<span class=\"message\">{{ notification.message }}</span>\n\n\t\t\t@if (notification.actions?.length) {\n\t\t\t<div class=\"actions\">\n\t\t\t\t@for (action of notification.actions; track $index) {\n\t\t\t\t<button class=\"action\" type=\"button\" (click)=\"runAction(notification.id, action)\">{{ action.label }}</button>\n\t\t\t\t}\n\t\t\t</div>\n\t\t\t}\n\t\t</div>\n\n\t\t<button class=\"close\" (click)=\"dismiss(notification.id)\" type=\"button\">×</button>\n\t</div>\n\t}\n</div>\n\n\n"],"mappings":";;;;AAiBA,IAAa,wBAAb,MAAa,sBAAqB;CAEf,aAAa,IAAI,yBAAwB;CAGzC,iBAAiB,OAAyB,KAAK,WAAW,cAAc,IAAG,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,iBAAA,CAAA,+BAAA,CAAA,CAAA;CAMtF,gBAAgB,KAAK,eAAe,WAAU;CAGtC,cAAc,KAAK,WAAW,cAAc,WAAW,SAAS,KAAK,eAAe,IAAI,IAAI,CAAC;CAO9G,IAAI,WAAQ;EACV,OAAO,KAAK,WAAW,SAAS,IAAG;CACrC;CAEA,IAAI,SAAS,UAAgC;EAC3C,KAAK,WAAW,UAAU,EAAE,SAAQ,CAAE;CACxC;CAOA,IAAI,YAAS;EACX,OAAO,KAAK,WAAW,UAAU,IAAG;CACtC;CAEA,IAAI,UAAU,WAA8B;EAC1C,KAAK,WAAW,UAAU,EAAE,UAAS,CAAE;CACzC;CAQA,UAAU,KAAyB;EACjC,KAAK,WAAW,UAAU,GAAG;CAC/B;CAOA,KAAK,SAA8B;EACjC,OAAO,KAAK,WAAW,KAAK,OAAO;CACrC;CAMA,QAAQ,IAAU;EAChB,KAAK,WAAW,QAAQ,EAAE;CAC5B;CAKA,WAAQ;EACN,KAAK,WAAW,SAAQ;CAC1B;CAGA,cAAW;EACT,KAAK,YAAW;EAChB,KAAK,WAAW,QAAO;CACzB;CAhFW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAqB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAArB,OAAA,QAAA,GAAA,sBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAqB,YADR;CAAM,CAAA;;AACnB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAqB,YAAA,CAAA;EADjC,MAAA;EAAW,MAAA,CAAA,EAAE,YAAY,OAAM,CAAE;;;ACClC,IAAa,0BAAb,MAAa,wBAAuB;CAElC,UAAU,OAAO,qBAAqB;CAGtC,gBAAgB,KAAK,QAAQ;CAGrB,YAAY,OAAO,YAAY;CAOvC,QAAQ,IAAU;EAChB,KAAK,QAAQ,QAAQ,EAAE;CACzB;CAOA,UAAU,IAAY,QAA4B;EAChD,OAAO,QAAO;EACd,IAAI,OAAO,YAAY,OACrB,KAAK,QAAQ,QAAQ,EAAE;CAE3B;CAUA,QAAQ,MAAsB;EAC5B,OAAO,0BAA0B,IAAI;CACvC;CAQA,iBAAiB,MAAY;EAC3B,OAAO,KAAK,UAAU,wBAAwB,IAAI;CACpD;CAnDW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAuB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAvB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAuB,cAAA;EAAA,UAAA;EAAA,UAAA;EAAA,UCjBpC;EAuEA,QAAA,CAAA,+4HAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;ADtDa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAuB,YAAA,CAAA;EAPnC,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAsB,YACpB;GAAI,iBAEC,wBAAwB;GAAK,UAAA;GAAA,QAAA,CAAA,+4HAAA;EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"su-labs-notifications.mjs","names":[],"sources":["../../../../projects/su-labs/notifications/src/lib/notification.service.ts","../../../../projects/su-labs/notifications/src/lib/notification.component.ts","../../../../projects/su-labs/notifications/src/lib/notification.component.html"],"sourcesContent":["import { Injectable, OnDestroy, signal } from '@angular/core';\nimport {\n SuNotification,\n SuNotificationConfig,\n SuNotificationController,\n SuNotificationOptions,\n SuNotificationPosition,\n SuNotificationSlide,\n} from '@su-labs/core/notifications';\n\n/**\n * Angular service for managing notifications.\n *\n * Thin wrapper around the framework-agnostic `SuNotificationController` from\n * `@su-labs/core/notifications` that exposes the notifications as an Angular signal.\n */\n@Injectable({ providedIn: 'root' })\nexport class SuNotificationService implements OnDestroy {\n /** Framework-agnostic notification logic */\n private readonly controller = new SuNotificationController();\n\n /** Internal signal holding the list of notifications, kept in sync with the controller */\n private readonly _notifications = signal<SuNotification[]>(this.controller.notifications.get());\n\n /**\n * Read-only access to the notifications list.\n * Can be used in templates for reactive updates.\n */\n readonly notifications = this._notifications.asReadonly();\n\n /** Stops syncing the controller's notifications into the signal */\n private readonly unsubscribe = this.controller.notifications.subscribe((list) => this._notifications.set(list));\n\n /**\n * Position where notifications appear on the screen.\n * Can also be set via the `configure` method.\n * @default 'top-right'\n */\n get position(): SuNotificationPosition {\n return this.controller.position.get();\n }\n\n set position(position: SuNotificationPosition) {\n this.controller.configure({ position });\n }\n\n /**\n * The direction notifications slide in from, whatever their position.\n * Can also be set via the `configure` method.\n * @default 'auto'\n */\n get slideFrom(): SuNotificationSlide {\n return this.controller.slideFrom.get();\n }\n\n set slideFrom(slideFrom: SuNotificationSlide) {\n this.controller.configure({ slideFrom });\n }\n\n /**\n * Configure the notification service.\n * @param cfg Configuration object\n * @param cfg.position Optional position to display notifications.\n * @param cfg.slideFrom Optional direction notifications slide in from.\n */\n configure(cfg: SuNotificationConfig): void {\n this.controller.configure(cfg);\n }\n\n /**\n * Show a new notification.\n * @param options Options to configure the notification.\n * @returns The unique ID of the notification.\n */\n show(options: SuNotificationOptions): string {\n return this.controller.show(options);\n }\n\n /**\n * Dismiss a specific notification by its ID.\n * @param id ID of the notification to remove.\n */\n dismiss(id: string): void {\n this.controller.dismiss(id);\n }\n\n /**\n * Clear all notifications immediately.\n */\n clearAll(): void {\n this.controller.clearAll();\n }\n\n /** Angular lifecycle hook for service destruction */\n ngOnDestroy(): void {\n this.unsubscribe();\n this.controller.destroy();\n }\n}\n","import { Component, inject, ChangeDetectionStrategy } from '@angular/core';\nimport { SuNotificationService } from './notification.service';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { isSuNotificationImageIcon, SuNotificationAction } from '@su-labs/core/notifications';\n\n/**\n * Component to display notifications on the screen.\n *\n * Uses `SuNotificationService` to manage and render notifications.\n */\n@Component({\n selector: 'su-lib-notifications',\n standalone: true,\n templateUrl: './notification.component.html',\n changeDetection: ChangeDetectionStrategy.Eager,\n styleUrls: ['./notification.component.scss'],\n})\nexport class SuNotificationComponent {\n /** Injected notification service */\n service = inject(SuNotificationService);\n\n /** Read-only signal of the current notifications */\n notifications = this.service.notifications;\n\n /** Angular sanitizer to safely render inline SVG strings */\n private sanitizer = inject(DomSanitizer);\n\n /**\n * Dismiss a notification by its ID.\n * Delegates to the service.\n * @param id ID of the notification to dismiss\n */\n dismiss(id: string): void {\n this.service.dismiss(id);\n }\n\n /**\n * Runs an action button of a notification, then closes the notification unless the action says not to.\n * @param id ID of the notification the button belongs to\n * @param action The action that was pressed\n */\n runAction(id: string, action: SuNotificationAction): void {\n action.onClick();\n if (action.dismiss !== false) {\n this.service.dismiss(id);\n }\n }\n\n /**\n * Checks if the provided `icon` value should be rendered as an image (`<img>`).\n * Inline SVG strings are rendered with `[innerHTML]` instead.\n * See `isSuNotificationImageIcon` in `@su-labs/core/notifications` for the rules.\n *\n * @param icon The icon value from the notification (boolean or string)\n * @returns `true` if the icon is an image path or URL\n */\n isImage(icon: string | boolean): boolean {\n return isSuNotificationImageIcon(icon);\n }\n\n /**\n * Sanitizes an inline SVG string so it can be safely rendered with [innerHTML].\n *\n * @param icon Inline SVG string\n * @returns SafeHtml object that can be bound to [innerHTML]\n */\n getSanitizedIcon(icon: string): SafeHtml {\n return this.sanitizer.bypassSecurityTrustHtml(icon);\n }\n}\n","<div class=\"notification-container {{ service.position }}\" [attr.data-slide]=\"service.slideFrom\">\n\t@for (notification of notifications(); track notification.id) {\n\t<div\n\t\tclass=\"notification {{ notification.type }} {{ notification.cssClass ?? '' }}\"\n\t\tanimate.enter=\"su-notification-enter\"\n\t\tanimate.leave=\"su-notification-leave\"\n\t>\n\n\t\t<div class=\"icon-container\">\n\t\t\t@if (notification.icon) {\n\t\t\t\t@if (isImage(notification.icon!)) {\n\t\t\t\t\t<img [src]=\"notification.icon\" alt=\"icon\" />\n\t\t\t\t} @else if (typeof notification.icon === 'string') {\n\t\t\t\t\t<span [innerHTML]=\"getSanitizedIcon(notification.icon)\"></span>\n\t\t\t\t}\n\t\t\t\t@else {\n\t\t\t\t\t@switch (notification.type) {\n\t\t\t\t\t@case('success') {\n\t\t\t\t\t\t<svg class=\"icon\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"\n\t\t\t\t\t\t\tstroke-linecap=\"round\" stroke-linejoin=\"round\">\n\t\t\t\t\t\t\t<path d=\"M20 6L9 17l-5-5\" />\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t}\n\t\t\t\t\t@case('info') {\n\t\t\t\t\t\t<svg class=\"icon\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"\n\t\t\t\t\t\t\tstroke-linecap=\"round\" stroke-linejoin=\"round\">\n\t\t\t\t\t\t\t<circle cx=\"12\" cy=\"12\" r=\"10\" />\n\t\t\t\t\t\t\t<line x1=\"12\" y1=\"16\" x2=\"12\" y2=\"12\" />\n\t\t\t\t\t\t\t<line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"8\" />\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t}\n\t\t\t\t\t@case('warning') {\n\t\t\t\t\t\t<svg class=\"icon\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"\n\t\t\t\t\t\t\tstroke-linecap=\"round\" stroke-linejoin=\"round\">\n\t\t\t\t\t\t\t<path d=\"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z\" />\n\t\t\t\t\t\t\t<line x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\" />\n\t\t\t\t\t\t\t<line x1=\"12\" y1=\"17\" x2=\"12\" y2=\"17\" />\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t}\n\t\t\t\t\t@case('error') {\n\t\t\t\t\t\t<svg class=\"icon\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"\n\t\t\t\t\t\t\tstroke-linecap=\"round\" stroke-linejoin=\"round\">\n\t\t\t\t\t\t\t<circle cx=\"12\" cy=\"12\" r=\"10\" />\n\t\t\t\t\t\t\t<line x1=\"15\" y1=\"9\" x2=\"9\" y2=\"15\" />\n\t\t\t\t\t\t\t<line x1=\"9\" y1=\"9\" x2=\"15\" y2=\"15\" />\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t</div>\n\n\t\t<div class=\"content\">\n\t\t\t<span class=\"message\">\n\t\t\t\t@if (typeof notification.message === 'string') {\n\t\t\t\t\t{{ notification.message }}\n\t\t\t\t} @else {\n\t\t\t\t\t@for (part of notification.message; track $index) {\n\t\t\t\t\t\t@if (typeof part === 'string') {{{ part }}} @else {<button class=\"link\" type=\"button\" (click)=\"runAction(notification.id, part)\">{{ part.label }}</button>}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t</span>\n\n\t\t\t@if (notification.actions?.length) {\n\t\t\t<div class=\"actions\">\n\t\t\t\t@for (action of notification.actions; track $index) {\n\t\t\t\t<button class=\"action\" type=\"button\" (click)=\"runAction(notification.id, action)\">{{ action.label }}</button>\n\t\t\t\t}\n\t\t\t</div>\n\t\t\t}\n\t\t</div>\n\n\t\t<button class=\"close\" (click)=\"dismiss(notification.id)\" type=\"button\">×</button>\n\t</div>\n\t}\n</div>\n\n\n"],"mappings":";;;;AAiBA,IAAa,wBAAb,MAAa,sBAAqB;CAEf,aAAa,IAAI,yBAAwB;CAGzC,iBAAiB,OAAyB,KAAK,WAAW,cAAc,IAAG,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,iBAAA,CAAA,+BAAA,CAAA,CAAA;CAMtF,gBAAgB,KAAK,eAAe,WAAU;CAGtC,cAAc,KAAK,WAAW,cAAc,WAAW,SAAS,KAAK,eAAe,IAAI,IAAI,CAAC;CAO9G,IAAI,WAAQ;EACV,OAAO,KAAK,WAAW,SAAS,IAAG;CACrC;CAEA,IAAI,SAAS,UAAgC;EAC3C,KAAK,WAAW,UAAU,EAAE,SAAQ,CAAE;CACxC;CAOA,IAAI,YAAS;EACX,OAAO,KAAK,WAAW,UAAU,IAAG;CACtC;CAEA,IAAI,UAAU,WAA8B;EAC1C,KAAK,WAAW,UAAU,EAAE,UAAS,CAAE;CACzC;CAQA,UAAU,KAAyB;EACjC,KAAK,WAAW,UAAU,GAAG;CAC/B;CAOA,KAAK,SAA8B;EACjC,OAAO,KAAK,WAAW,KAAK,OAAO;CACrC;CAMA,QAAQ,IAAU;EAChB,KAAK,WAAW,QAAQ,EAAE;CAC5B;CAKA,WAAQ;EACN,KAAK,WAAW,SAAQ;CAC1B;CAGA,cAAW;EACT,KAAK,YAAW;EAChB,KAAK,WAAW,QAAO;CACzB;CAhFW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAqB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAArB,OAAA,QAAA,GAAA,sBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAqB,YADR;CAAM,CAAA;;AACnB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAqB,YAAA,CAAA;EADjC,MAAA;EAAW,MAAA,CAAA,EAAE,YAAY,OAAM,CAAE;;;ACClC,IAAa,0BAAb,MAAa,wBAAuB;CAElC,UAAU,OAAO,qBAAqB;CAGtC,gBAAgB,KAAK,QAAQ;CAGrB,YAAY,OAAO,YAAY;CAOvC,QAAQ,IAAU;EAChB,KAAK,QAAQ,QAAQ,EAAE;CACzB;CAOA,UAAU,IAAY,QAA4B;EAChD,OAAO,QAAO;EACd,IAAI,OAAO,YAAY,OACrB,KAAK,QAAQ,QAAQ,EAAE;CAE3B;CAUA,QAAQ,MAAsB;EAC5B,OAAO,0BAA0B,IAAI;CACvC;CAQA,iBAAiB,MAAY;EAC3B,OAAO,KAAK,UAAU,wBAAwB,IAAI;CACpD;CAnDW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAuB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAvB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAuB,cAAA;EAAA,UAAA;EAAA,UAAA;EAAA,UCjBpC;EA8EA,QAAA,CAAA,03HAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AD7Da,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAuB,YAAA,CAAA;EAPnC,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAsB,YACpB;GAAI,iBAEC,wBAAwB;GAAK,UAAA;GAAA,QAAA,CAAA,03HAAA;EAAA,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@su-labs/notifications",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.3.1",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"angular",
|
|
6
6
|
"notifications",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@angular/core": "^22.0.0"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@su-labs/core": "1.
|
|
39
|
+
"@su-labs/core": "1.9.0",
|
|
40
40
|
"tslib": "^2.3.0"
|
|
41
41
|
},
|
|
42
42
|
"sideEffects": false,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { OnDestroy } from "@angular/core";
|
|
3
|
-
import { SuNotification, SuNotification as SuNotification$1, SuNotificationAction, SuNotificationAction as SuNotificationAction$1, SuNotificationConfig, SuNotificationConfig as SuNotificationConfig$1, SuNotificationOptions, SuNotificationOptions as SuNotificationOptions$1, SuNotificationPosition, SuNotificationPosition as SuNotificationPosition$1, SuNotificationSlide, SuNotificationSlide as SuNotificationSlide$1, SuNotificationType } from "@su-labs/core/notifications";
|
|
3
|
+
import { SuNotification, SuNotification as SuNotification$1, SuNotificationAction, SuNotificationAction as SuNotificationAction$1, SuNotificationConfig, SuNotificationConfig as SuNotificationConfig$1, SuNotificationMessagePart, SuNotificationOptions, SuNotificationOptions as SuNotificationOptions$1, SuNotificationPosition, SuNotificationPosition as SuNotificationPosition$1, SuNotificationSlide, SuNotificationSlide as SuNotificationSlide$1, SuNotificationType } from "@su-labs/core/notifications";
|
|
4
4
|
import { SafeHtml } from "@angular/platform-browser";
|
|
5
5
|
/**
|
|
6
6
|
* Angular service for managing notifications.
|
|
@@ -104,4 +104,4 @@ export declare class SuNotificationComponent {
|
|
|
104
104
|
static ɵfac: i0.ɵɵFactoryDeclaration<SuNotificationComponent, never>;
|
|
105
105
|
static ɵcmp: i0.ɵɵComponentDeclaration<SuNotificationComponent, "su-lib-notifications", never, {}, {}, never, never, true, never>;
|
|
106
106
|
}
|
|
107
|
-
export type { SuNotification, SuNotificationAction, SuNotificationConfig, SuNotificationOptions, SuNotificationPosition, SuNotificationSlide, SuNotificationType };
|
|
107
|
+
export type { SuNotification, SuNotificationAction, SuNotificationConfig, SuNotificationMessagePart, SuNotificationOptions, SuNotificationPosition, SuNotificationSlide, SuNotificationType };
|