@su-labs/notifications 21.0.5 → 21.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 ADDED
@@ -0,0 +1,53 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
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
+
23
+ ## [22.2.0] - 2026-11-07
24
+
25
+ ### Added
26
+ - Notifications slide in from their side of the screen and slide out when closed; durations set with `--su-notification-enter-duration` (400ms) and `--su-notification-leave-duration` (300ms), and no motion for visitors who prefer reduced motion
27
+ - `slideFrom` option (`'auto'`, `'left'`, `'right'`, `'top'`, `'bottom'`) to slide in from a chosen direction whatever the position, as `configure({ slideFrom })` or the `slideFrom` property
28
+ - `actions` option: buttons under the message (`label`, `onClick`, `dismiss`), each closing the notification unless `dismiss: false`
29
+
30
+ ### Changed
31
+ - Depends on exactly `@su-labs/core` 1.2.0 (no version range), so every install runs the core it was tested with
32
+
33
+ ### Documentation
34
+ - README lists every CSS variable, including `--su-notification-max-width` for wider notifications
35
+
36
+ ## [22.1.1] - 2026-11-05
37
+
38
+ ### Changed
39
+ - Package homepage now points to the website with a live demo
40
+
41
+ ### Fixed
42
+ - Notifications without `cssClass` rendered empty under Angular 22 (`NgClass` no longer accepts `undefined`); classes are now bound directly and `CommonModule` is no longer imported
43
+
44
+ ## [22.1.0] - 2026-11-05
45
+
46
+ ### Changed
47
+ - Notification logic moved to the framework-agnostic `@su-labs/core/notifications`; `SuNotificationService` is now an Angular wrapper around `SuNotificationController` with the same public API
48
+ - Added `@su-labs/core` as a dependency
49
+ - README links to the `@su-labs/core` installation guides for non-Angular projects
50
+
51
+ ### Fixed
52
+ - Auto-close timers are cancelled when a notification is dismissed or the service is destroyed
53
+ - Repair table of contents links in README.md
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  `@su-labs/notifications`
4
4
 
5
5
  ![Angular](https://img.shields.io/badge/Angular-DD0031?style=for-the-badge&logo=angular&logoColor=white)
6
- ![Angular Version](https://img.shields.io/badge/Angular-v21-DD0031?style=for-the-badge&logo=angular&logoColor=white)
6
+ ![Angular Version](https://img.shields.io/badge/Angular-v22-DD0031?style=for-the-badge&logo=angular&logoColor=white)
7
7
  ![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white)
8
8
  ![License](https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge)
9
9
  ![NPM](https://img.shields.io/badge/NPM-CB3837?style=for-the-badge&logo=npm&logoColor=white)
@@ -13,34 +13,37 @@
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
- ## 📚 Table of Contents
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
- - [Why Use This Library?](#-why-use-this-library)
18
+ ## Table of Contents
19
+
20
+ - [Why Use This Library?](#why-use-this-library)
19
21
  - [Features](#features)
20
22
  - [Installation](#installation)
21
- - [Quick Start](#-quick-start)
23
+ - [Quick Start](#quick-start)
22
24
  - [Usage](#usage)
23
- - [API Reference](#-api-reference)
25
+ - [API Reference](#api-reference)
24
26
  - [Configuration Options](#configuration-options)
27
+ - [Styling](#styling)
25
28
  - [How It Works](#how-it-works)
26
- - [Browser Compatibility](#-browser-compatibility)
27
- - [Related Libraries](#-related-libraries)
28
- - [Troubleshooting](#-troubleshooting)
29
- - [Support](#-support)
29
+ - [Browser Compatibility](#browser-compatibility)
30
+ - [Related Libraries](#related-libraries)
31
+ - [Troubleshooting](#troubleshooting)
32
+ - [Support](#support)
30
33
  - [Contributing](#contributing)
31
34
  - [License](#license)
32
35
 
33
- ## 💡 Why Use This Library?
36
+ ## Why Use This Library?
34
37
 
35
- - 🎯 **Lightweight** - Minimal bundle size
36
- - ⚡ **Reactive** - Built with Angular Signals
37
- - 🎨 **Customizable** - Multiple themes and positions
38
- - 🖼️ **Icon Support** - Default SVG or custom icons
39
- - ⏱️ **Auto-dismiss** - Configurable duration
40
- - 🔒 **Type-Safe** - Full TypeScript support
41
- - 📦 **Zero Dependencies** - No bloat
42
- - 🧪 **Well Tested** - Comprehensive test coverage
43
- - 📝 **Well Documented** - Clear examples and API docs
38
+ - **Lightweight** - Minimal bundle size
39
+ - **Reactive** - Built with Angular Signals
40
+ - **Customizable** - Multiple themes and positions
41
+ - **Icon Support** - Default SVG or custom icons
42
+ - **Auto-dismiss** - Configurable duration
43
+ - **Type-Safe** - Full TypeScript support
44
+ - **Zero Dependencies** - No bloat
45
+ - **Well Tested** - Comprehensive test coverage
46
+ - **Well Documented** - Clear examples and API docs
44
47
 
45
48
  ## Features
46
49
 
@@ -58,9 +61,11 @@ A highly customizable Angular notification library built with modern practices,
58
61
  You can install this library via npm:
59
62
 
60
63
  ```sh
61
- npm install @su-labs/notifications
64
+ npm install @su-labs/notifications@ng21
62
65
  ```
63
66
 
67
+ This is the Angular 21 version. For the newest Angular, install `@su-labs/notifications` without a tag.
68
+
64
69
  ## Peer Dependencies
65
70
 
66
71
  This library requires the following peer dependencies:
@@ -69,11 +74,11 @@ This library requires the following peer dependencies:
69
74
  npm install @angular/common@^21 @angular/core@^21
70
75
  ```
71
76
 
72
- ## 🚀 Quick Start
77
+ ## Quick Start
73
78
 
74
79
  ```typescript
75
80
  // 1. Install
76
- npm install @su-labs/notifications
81
+ npm install @su-labs/notifications@ng21
77
82
 
78
83
  // 2. Add component to your app template
79
84
  // app.component.html
@@ -180,7 +185,13 @@ export const appConfig: ApplicationConfig = {
180
185
  };
181
186
  ```
182
187
 
183
- ## 📖 API Reference
188
+ Notifications slide in from the side they sit on (from the left here). To slide them in from another direction, whatever the position, set `slideFrom` to `'left'`, `'right'`, `'top'` or `'bottom'` (`'auto'` is the default):
189
+
190
+ ```ts
191
+ notificationService.configure({ position: 'top-right', slideFrom: 'top' });
192
+ ```
193
+
194
+ ## API Reference
184
195
 
185
196
  ### Service (SuNotificationService)
186
197
 
@@ -188,7 +199,7 @@ export const appConfig: ApplicationConfig = {
188
199
 
189
200
  | Property | Type | Description |
190
201
  |----------|------|-------------|
191
- | `position` | `NotificationPosition` | Global notification position |
202
+ | `position` | `NotificationPosition` |
192
203
 
193
204
  #### Methods
194
205
 
@@ -212,25 +223,61 @@ type NotificationPosition =
212
223
 
213
224
  interface NotificationConfig {
214
225
  type: NotificationType;
215
- message: string;
226
+ message: string | (string | NotificationAction)[]; // Text, or text and links
216
227
  duration?: number; // Default: 3000ms
217
228
  autoClose?: boolean; // Default: true
218
229
  cssClass?: string; // Custom CSS class
219
230
  icon?: string; // Custom SVG string or image URL
231
+ actions?: NotificationAction[]; // Buttons under the message
220
232
  }
233
+
234
+ interface NotificationAction {
235
+ label: string; // Button text
236
+ onClick: () => void; // Called when the button is pressed
237
+ dismiss?: boolean; // Close the notification afterwards (default: true)
238
+ }
239
+ ```
240
+
241
+ ### Action buttons
242
+
243
+ Give a notification `actions` to show buttons under its message, for example to undo or to open a page. Each button closes the notification after its `onClick` runs, unless it sets `dismiss: false`. Combine with `autoClose: false` to keep the notification until the user answers:
244
+
245
+ ```typescript
246
+ this.notifications.show({
247
+ type: 'info',
248
+ message: 'Photo deleted',
249
+ autoClose: false,
250
+ actions: [
251
+ { label: 'Undo', onClick: () => this.restorePhoto() },
252
+ { label: 'OK', onClick: () => {} },
253
+ ],
254
+ });
221
255
  ```
222
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
+
223
270
  ## Configuration Options
224
271
 
225
272
  ### Notification Types
226
273
 
227
- | Type | Description | Default Icon |
228
- |------|-------------|--------------|
229
- | `info` | Informational message | ℹ️ |
230
- | `success` | Success message | ✅ |
231
- | `warning` | Warning message | ⚠️ |
232
- | `error` | Error message | ❌ |
233
- | `custom` | Custom styled message | 🔔 |
274
+ | Type | Description |
275
+ |------|-------------|
276
+ | `info` | Informational message |
277
+ | `success` | Success message |
278
+ | `warning` | Warning message |
279
+ | `error` | Error message |
280
+ | `custom` | Custom styled message |
234
281
 
235
282
  ### Positions
236
283
 
@@ -243,6 +290,36 @@ interface NotificationConfig {
243
290
  | `bottom-left` | Bottom left corner |
244
291
  | `bottom-center` | Bottom center |
245
292
 
293
+ ## Styling
294
+
295
+ Notifications slide in from the side of the screen they appear on and slide back out when they close (they simply appear and disappear for visitors who prefer reduced motion). Every part of a notification can be restyled with CSS variables, set on `:root` or any parent element. For example, to let long messages use more width:
296
+
297
+ ```css
298
+ :root {
299
+ --su-notification-max-width: min(100% - 2rem, 26rem);
300
+ }
301
+ ```
302
+
303
+ | Variable | Default | Controls |
304
+ |----------|---------|----------|
305
+ | `--su-notification-width` | `max-content` | Width of a notification; by default it fits its text |
306
+ | `--su-notification-max-width` | `min(100% - 2rem, 300px)` | Widest a notification gets before its text wraps |
307
+ | `--su-notification-padding-block` | `1rem` | Space above and below the text |
308
+ | `--su-notification-padding-inline` | `1.25rem` | Space left and right of the text |
309
+ | `--su-notification-container-gap` | `1.2rem` | Space between stacked notifications |
310
+ | `--su-notification-container-position` | `1rem` | Distance from the edges of the screen |
311
+ | `--su-notification-enter-duration` | `400ms` | How long a notification takes to slide in from its side of the screen |
312
+ | `--su-notification-leave-duration` | `300ms` | How long it takes to slide back out when closed |
313
+ | `--su-notification-background-color` | `#fff` | Background |
314
+ | `--su-notification-text-color` | `#333` | Text |
315
+ | `--su-notification-box-shadow` | `rgba(0, 0, 0, 0.15)` | Shadow colour |
316
+ | `--su-notification-info-border-color` | `#2196f3` | Left border of `info` (likewise `success`, `warning`, `error`, `custom`) |
317
+ | `--su-notification-icon-color` | `currentColor` | Icon colour |
318
+ | `--su-notification-icon-width` / `-height` | `24px` | Icon size |
319
+ | `--su-notification-action-border-color` | `currentColor` | Border of action buttons (they take the notification's text colour) |
320
+ | `--su-notification-close-btn-size` | `20px` | Close button size |
321
+ | `--su-notification-close-btn-background-color` | the background | Close button background (also `-text-color`, `-border-color`, `-border-radius`, `-font-size`, `-hover-background`, `-hover-color`) |
322
+
246
323
  ## How It Works
247
324
 
248
325
  The library consists of a stateless service (`SuNotificationService`) and a presentational component (`SuNotificationComponent`).
@@ -251,13 +328,13 @@ The service manages a list of notifications using a private Signal. When you cal
251
328
 
252
329
  The component's icons are rendered using `[innerHTML]` to safely inject SVG markup into the template. Angular's `DomSanitizer` is used to prevent security risks like Cross-Site Scripting (XSS) attacks.
253
330
 
254
- ## 🌐 Browser Compatibility
331
+ ## Browser Compatibility
255
332
 
256
333
  Works in all modern browsers that support:
257
- - ✅ CSS Flexbox
258
- - ✅ CSS Animations
259
- - ✅ Angular 21+
260
- - ✅ ES2022+
334
+ - CSS Flexbox
335
+ - CSS Animations
336
+ - Angular 21
337
+ - ES2022+
261
338
 
262
339
  | Browser | Version |
263
340
  |---------|---------|
@@ -266,16 +343,16 @@ Works in all modern browsers that support:
266
343
  | Safari | ≥ 14 |
267
344
  | Edge | ≥ 90 |
268
345
 
269
- ## 🔗 Related Libraries
346
+ ## Related Libraries
270
347
 
271
348
  Part of the **@su-labs** suite:
272
349
 
273
- - 👀 [@su-labs/visit-tracker](https://www.npmjs.com/package/@su-labs/visit-tracker) - User visit tracking
274
- - 🎨 [@su-labs/theme](https://www.npmjs.com/package/@su-labs/theme) - Theme management with dark mode support
275
- - 🔍 [@su-labs/scroll-spy](https://www.npmjs.com/package/@su-labs/scroll-spy) - Scroll position tracking
276
- - 📏 [@su-labs/font-size](https://www.npmjs.com/package/@su-labs/font-size) - Accessible font size controls
350
+ - [@su-labs/visit-tracker](https://www.npmjs.com/package/@su-labs/visit-tracker) - User visit tracking
351
+ - [@su-labs/theme](https://www.npmjs.com/package/@su-labs/theme) - Theme management with dark mode support
352
+ - [@su-labs/scroll-spy](https://www.npmjs.com/package/@su-labs/scroll-spy) - Scroll position tracking
353
+ - [@su-labs/font-size](https://www.npmjs.com/package/@su-labs/font-size) - Accessible font size controls
277
354
 
278
- ## 🔧 Troubleshooting
355
+ ## Troubleshooting
279
356
 
280
357
  ### Notifications not showing?
281
358
 
@@ -291,13 +368,13 @@ Set the position property during app initialization using `provideAppInitializer
291
368
 
292
369
  ### TypeScript errors?
293
370
 
294
- Ensure you have Angular 21+ and TypeScript 5.7+ installed.
371
+ Ensure you have Angular 21 and TypeScript 5.9+ installed.
295
372
 
296
- ## 💬 Support
373
+ ## Support
297
374
 
298
- - 🐛 Found a bug? [Open an issue](https://github.com/Greezaaa/settings-utils-lib/issues)
299
- - 💡 Have a feature request? [Start a discussion](https://github.com/Greezaaa/settings-utils-lib/discussions)
300
- - ⭐ Like this library? [Give it a star!](https://github.com/Greezaaa/settings-utils-lib)
375
+ - Found a bug? [Open an issue](https://github.com/Greezaaa/settings-utils-lib/issues)
376
+ - Have a feature request? [Start a discussion](https://github.com/Greezaaa/settings-utils-lib/discussions)
377
+ - Like this library? [Give it a star!](https://github.com/Greezaaa/settings-utils-lib)
301
378
 
302
379
  ## Contributing
303
380
 
@@ -1,39 +1,56 @@
1
1
  import * as i0 from '@angular/core';
2
- import { signal, Injectable, inject, Component } from '@angular/core';
3
- import * as i1 from '@angular/common';
4
- import { CommonModule } from '@angular/common';
2
+ import { signal, Injectable, inject, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { SuNotificationController, isSuNotificationImageIcon } from '@su-labs/core/notifications';
5
4
  import { DomSanitizer } from '@angular/platform-browser';
6
5
 
7
6
  /**
8
- * Service for managing notifications.
7
+ * Angular service for managing notifications.
9
8
  *
10
- * Provides methods to show, dismiss, and clear notifications.
11
- * Notifications are reactive signals, making them easy to bind in templates.
9
+ * Thin wrapper around the framework-agnostic `SuNotificationController` from
10
+ * `@su-labs/core/notifications` that exposes the notifications as an Angular signal.
12
11
  */
13
12
  class SuNotificationService {
14
- /**
15
- * Internal signal holding the list of notifications.
16
- */
17
- _notifications = signal([], ...(ngDevMode ? [{ debugName: "_notifications" }] : []));
13
+ /** Framework-agnostic notification logic */
14
+ controller = new SuNotificationController();
15
+ /** Internal signal holding the list of notifications, kept in sync with the controller */
16
+ _notifications = signal(this.controller.notifications.get(), ...(ngDevMode ? [{ debugName: "_notifications" }] : /* istanbul ignore next */ []));
18
17
  /**
19
18
  * Read-only access to the notifications list.
20
19
  * Can be used in templates for reactive updates.
21
20
  */
22
21
  notifications = this._notifications.asReadonly();
22
+ /** Stops syncing the controller's notifications into the signal */
23
+ unsubscribe = this.controller.notifications.subscribe((list) => this._notifications.set(list));
23
24
  /**
24
- * Default position where notifications will appear on the screen.
25
- * Can be configured via `configure` method.
25
+ * Position where notifications appear on the screen.
26
+ * Can also be set via the `configure` method.
26
27
  * @default 'top-right'
27
28
  */
28
- position = 'top-right';
29
+ get position() {
30
+ return this.controller.position.get();
31
+ }
32
+ set position(position) {
33
+ this.controller.configure({ position });
34
+ }
35
+ /**
36
+ * The direction notifications slide in from, whatever their position.
37
+ * Can also be set via the `configure` method.
38
+ * @default 'auto'
39
+ */
40
+ get slideFrom() {
41
+ return this.controller.slideFrom.get();
42
+ }
43
+ set slideFrom(slideFrom) {
44
+ this.controller.configure({ slideFrom });
45
+ }
29
46
  /**
30
47
  * Configure the notification service.
31
48
  * @param cfg Configuration object
32
49
  * @param cfg.position Optional position to display notifications.
50
+ * @param cfg.slideFrom Optional direction notifications slide in from.
33
51
  */
34
52
  configure(cfg) {
35
- if (cfg.position)
36
- this.position = cfg.position;
53
+ this.controller.configure(cfg);
37
54
  }
38
55
  /**
39
56
  * Show a new notification.
@@ -41,39 +58,30 @@ class SuNotificationService {
41
58
  * @returns The unique ID of the notification.
42
59
  */
43
60
  show(options) {
44
- const id = crypto.randomUUID();
45
- const notification = {
46
- id,
47
- type: options.type,
48
- message: options.message,
49
- duration: options.duration ?? 3000,
50
- autoClose: options.autoClose ?? true,
51
- cssClass: options.cssClass,
52
- icon: options.icon ?? true,
53
- };
54
- this._notifications.update((list) => [...list, notification]);
55
- if (notification.autoClose) {
56
- setTimeout(() => this.dismiss(id), notification.duration);
57
- }
58
- return id;
61
+ return this.controller.show(options);
59
62
  }
60
63
  /**
61
64
  * Dismiss a specific notification by its ID.
62
65
  * @param id ID of the notification to remove.
63
66
  */
64
67
  dismiss(id) {
65
- this._notifications.update((list) => list.filter((n) => n.id !== id));
68
+ this.controller.dismiss(id);
66
69
  }
67
70
  /**
68
71
  * Clear all notifications immediately.
69
72
  */
70
73
  clearAll() {
71
- this._notifications.set([]);
74
+ this.controller.clearAll();
72
75
  }
73
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SuNotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
74
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SuNotificationService, providedIn: 'root' });
76
+ /** Angular lifecycle hook for service destruction */
77
+ ngOnDestroy() {
78
+ this.unsubscribe();
79
+ this.controller.destroy();
80
+ }
81
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuNotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
82
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuNotificationService, providedIn: 'root' });
75
83
  }
76
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SuNotificationService, decorators: [{
84
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuNotificationService, decorators: [{
77
85
  type: Injectable,
78
86
  args: [{ providedIn: 'root' }]
79
87
  }] });
@@ -98,27 +106,27 @@ class SuNotificationComponent {
98
106
  dismiss(id) {
99
107
  this.service.dismiss(id);
100
108
  }
109
+ /**
110
+ * Runs an action button of a notification, then closes the notification unless the action says not to.
111
+ * @param id ID of the notification the button belongs to
112
+ * @param action The action that was pressed
113
+ */
114
+ runAction(id, action) {
115
+ action.onClick();
116
+ if (action.dismiss !== false) {
117
+ this.service.dismiss(id);
118
+ }
119
+ }
101
120
  /**
102
121
  * Checks if the provided `icon` value should be rendered as an image (`<img>`).
103
- *
104
- * Determines whether the `icon` is a string pointing to an image file:
105
- * - Local or relative paths (starting with `/`)
106
- * - URLs (starting with `http`)
107
- * - File paths ending with `.png`, `.jpg`, or `.svg`
108
- *
109
- * Inline SVG strings (e.g., `<svg>...</svg>`) are **not** treated as images and
110
- * should be rendered with `[innerHTML]`.
122
+ * Inline SVG strings are rendered with `[innerHTML]` instead.
123
+ * See `isSuNotificationImageIcon` in `@su-labs/core/notifications` for the rules.
111
124
  *
112
125
  * @param icon The icon value from the notification (boolean or string)
113
- * @returns `true` if the icon is an image path or URL, `false` for inline SVGs or `false`
126
+ * @returns `true` if the icon is an image path or URL
114
127
  */
115
128
  isImage(icon) {
116
- return (typeof icon === 'string' &&
117
- (icon.endsWith('.png') ||
118
- icon.endsWith('.jpg') ||
119
- icon.endsWith('.svg') ||
120
- icon.startsWith('http') ||
121
- icon.startsWith('/')));
129
+ return isSuNotificationImageIcon(icon);
122
130
  }
123
131
  /**
124
132
  * Sanitizes an inline SVG string so it can be safely rendered with [innerHTML].
@@ -129,18 +137,14 @@ class SuNotificationComponent {
129
137
  getSanitizedIcon(icon) {
130
138
  return this.sanitizer.bypassSecurityTrustHtml(icon);
131
139
  }
132
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SuNotificationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
133
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.2", type: SuNotificationComponent, isStandalone: true, selector: "su-lib-notifications", ngImport: i0, template: "<div class=\"notification-container\" [ngClass]=\"[service.position]\">\n\t@for (notification of notifications(); track notification.id) {\n\t<div class=\"notification\" [ngClass]=\"[notification.type, notification.cssClass]\">\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<span class=\"message\">{{ notification.message }}</span>\n\n\t\t<button class=\"close\" (click)=\"dismiss(notification.id)\" type=\"button\">\u00D7</button>\n\t</div>\n\t}\n</div>\n\n\n", styles: [".notification-container{position:fixed;pointer-events:none;display:flex;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.top-right{align-items:flex-end;flex-direction:column;top:var(--su-notification-container-position, 1rem);right:var(--su-notification-container-position, 1rem)}.notification-container.top-left{align-items:flex-start;flex-direction:column;top:var(--su-notification-container-position, 1rem);left:var(--su-notification-container-position, 1rem)}.notification-container.bottom-right{align-items:flex-end;flex-direction:column-reverse;bottom:var(--su-notification-container-position, 1rem);right:var(--su-notification-container-position, 1rem)}.notification-container.bottom-left{align-items:flex-start;flex-direction:column-reverse;bottom:var(--su-notification-container-position, 1rem);left:var(--su-notification-container-position, 1rem)}.notification-container.top-center{align-items:center;flex-direction:column;top:var(--su-notification-container-position, 1rem);left:50%;translate:-50% 0}.notification-container.bottom-center{align-items:center;flex-direction:column-reverse;bottom:var(--su-notification-container-position, 1rem);left:50%;translate:-50% 0}.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);box-shadow:0 4px 8px var(--su-notification-box-shadow, rgba(0, 0, 0, .15));display:flex;align-items:center;gap:1rem;transition:transform .2s ease,opacity .2s ease}.notification.success{border-left:4px solid var(--su-notification-success-border-color, #4caf50)}.notification.info{border-left:4px solid var(--su-notification-info-border-color, #2196f3)}.notification.warning{border-left:4px solid var(--su-notification-warning-border-color, #ff9800)}.notification.error{border-left:4px solid var(--su-notification-error-border-color, #f44336)}.notification.custom{border-left:4px solid var(--su-notification-custom-border-color, #9c27b0)}.notification .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)}.notification .icon-container .icon{width:100%;height:100%}.notification .message{flex:1}.notification .close{position:absolute;width:var(--su-notification-close-btn-size, 20px);height:var(--su-notification-close-btn-size, 20px);top:calc(var(--su-notification-close-btn-size, 20px) * -.5);right:calc(var(--su-notification-close-btn-size, 20px) * -.5);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:0 4px 8px var(--su-notification-box-shadow, rgba(0, 0, 0, .15));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)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
140
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuNotificationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
141
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.26", type: SuNotificationComponent, isStandalone: true, selector: "su-lib-notifications", ngImport: i0, template: "<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\">\u00D7</button>\n\t</div>\n\t}\n</div>\n\n\n", 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"], changeDetection: i0.ChangeDetectionStrategy.Eager });
134
142
  }
135
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SuNotificationComponent, decorators: [{
143
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuNotificationComponent, decorators: [{
136
144
  type: Component,
137
- args: [{ selector: 'su-lib-notifications', standalone: true, imports: [CommonModule], template: "<div class=\"notification-container\" [ngClass]=\"[service.position]\">\n\t@for (notification of notifications(); track notification.id) {\n\t<div class=\"notification\" [ngClass]=\"[notification.type, notification.cssClass]\">\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<span class=\"message\">{{ notification.message }}</span>\n\n\t\t<button class=\"close\" (click)=\"dismiss(notification.id)\" type=\"button\">\u00D7</button>\n\t</div>\n\t}\n</div>\n\n\n", styles: [".notification-container{position:fixed;pointer-events:none;display:flex;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.top-right{align-items:flex-end;flex-direction:column;top:var(--su-notification-container-position, 1rem);right:var(--su-notification-container-position, 1rem)}.notification-container.top-left{align-items:flex-start;flex-direction:column;top:var(--su-notification-container-position, 1rem);left:var(--su-notification-container-position, 1rem)}.notification-container.bottom-right{align-items:flex-end;flex-direction:column-reverse;bottom:var(--su-notification-container-position, 1rem);right:var(--su-notification-container-position, 1rem)}.notification-container.bottom-left{align-items:flex-start;flex-direction:column-reverse;bottom:var(--su-notification-container-position, 1rem);left:var(--su-notification-container-position, 1rem)}.notification-container.top-center{align-items:center;flex-direction:column;top:var(--su-notification-container-position, 1rem);left:50%;translate:-50% 0}.notification-container.bottom-center{align-items:center;flex-direction:column-reverse;bottom:var(--su-notification-container-position, 1rem);left:50%;translate:-50% 0}.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);box-shadow:0 4px 8px var(--su-notification-box-shadow, rgba(0, 0, 0, .15));display:flex;align-items:center;gap:1rem;transition:transform .2s ease,opacity .2s ease}.notification.success{border-left:4px solid var(--su-notification-success-border-color, #4caf50)}.notification.info{border-left:4px solid var(--su-notification-info-border-color, #2196f3)}.notification.warning{border-left:4px solid var(--su-notification-warning-border-color, #ff9800)}.notification.error{border-left:4px solid var(--su-notification-error-border-color, #f44336)}.notification.custom{border-left:4px solid var(--su-notification-custom-border-color, #9c27b0)}.notification .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)}.notification .icon-container .icon{width:100%;height:100%}.notification .message{flex:1}.notification .close{position:absolute;width:var(--su-notification-close-btn-size, 20px);height:var(--su-notification-close-btn-size, 20px);top:calc(var(--su-notification-close-btn-size, 20px) * -.5);right:calc(var(--su-notification-close-btn-size, 20px) * -.5);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:0 4px 8px var(--su-notification-box-shadow, rgba(0, 0, 0, .15));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)}\n"] }]
145
+ args: [{ selector: 'su-lib-notifications', standalone: true, changeDetection: ChangeDetectionStrategy.Eager, template: "<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\">\u00D7</button>\n\t</div>\n\t}\n</div>\n\n\n", 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"] }]
138
146
  }] });
139
147
 
140
- /*
141
- * Public API Surface of notifications
142
- */
143
-
144
148
  /**
145
149
  * Generated bundle index. Do not edit.
146
150
  */
@@ -1 +1 @@
1
- {"version":3,"file":"su-labs-notifications.mjs","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","../../../../projects/su-labs/notifications/src/public-api.ts","../../../../projects/su-labs/notifications/src/su-labs-notifications.ts"],"sourcesContent":["import { Injectable, signal } from '@angular/core';\nimport {\n SuNotification,\n SuNotificationOptions,\n SuNotificationPosition,\n} from './notification.model';\n\n/**\n * Service for managing notifications.\n *\n * Provides methods to show, dismiss, and clear notifications.\n * Notifications are reactive signals, making them easy to bind in templates.\n */\n@Injectable({ providedIn: 'root' })\nexport class SuNotificationService {\n /**\n * Internal signal holding the list of notifications.\n */\n private _notifications = signal<SuNotification[]>([]);\n\n /**\n * Read-only access to the notifications list.\n * Can be used in templates for reactive updates.\n */\n notifications = this._notifications.asReadonly();\n\n /**\n * Default position where notifications will appear on the screen.\n * Can be configured via `configure` method.\n * @default 'top-right'\n */\n position: SuNotificationPosition = 'top-right';\n\n /**\n * Configure the notification service.\n * @param cfg Configuration object\n * @param cfg.position Optional position to display notifications.\n */\n configure(cfg: { position?: SuNotificationPosition }): void {\n if (cfg.position) this.position = cfg.position;\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 const id = crypto.randomUUID();\n const notification: SuNotification = {\n id,\n type: options.type,\n message: options.message,\n duration: options.duration ?? 3000,\n autoClose: options.autoClose ?? true,\n cssClass: options.cssClass,\n icon: options.icon ?? true,\n };\n\n this._notifications.update((list) => [...list, notification]);\n\n if (notification.autoClose) {\n setTimeout(() => this.dismiss(id), notification.duration);\n }\n\n return id;\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._notifications.update((list) => list.filter((n) => n.id !== id));\n }\n\n /**\n * Clear all notifications immediately.\n */\n clearAll(): void {\n this._notifications.set([]);\n }\n}\n","import { Component, inject } from '@angular/core';\nimport { SuNotificationService } from './notification.service';\nimport { CommonModule } from '@angular/common';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\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 imports: [CommonModule],\n templateUrl: './notification.component.html',\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 * Checks if the provided `icon` value should be rendered as an image (`<img>`).\n *\n * Determines whether the `icon` is a string pointing to an image file:\n * - Local or relative paths (starting with `/`)\n * - URLs (starting with `http`)\n * - File paths ending with `.png`, `.jpg`, or `.svg`\n *\n * Inline SVG strings (e.g., `<svg>...</svg>`) are **not** treated as images and\n * should be rendered with `[innerHTML]`.\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, `false` for inline SVGs or `false`\n */\n isImage(icon: string | boolean): boolean {\n return (\n typeof icon === 'string' &&\n (icon.endsWith('.png') ||\n icon.endsWith('.jpg') ||\n icon.endsWith('.svg') ||\n icon.startsWith('http') ||\n icon.startsWith('/'))\n );\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\" [ngClass]=\"[service.position]\">\n\t@for (notification of notifications(); track notification.id) {\n\t<div class=\"notification\" [ngClass]=\"[notification.type, notification.cssClass]\">\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<span class=\"message\">{{ notification.message }}</span>\n\n\t\t<button class=\"close\" (click)=\"dismiss(notification.id)\" type=\"button\">×</button>\n\t</div>\n\t}\n</div>\n\n\n","/*\n * Public API Surface of notifications\n */\n\nexport * from './lib/notification.component';\nexport * from './lib/notification.service';\nexport * from './lib/notification.model';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAOA;;;;;AAKG;MAEU,qBAAqB,CAAA;AAChC;;AAEG;AACK,IAAA,cAAc,GAAG,MAAM,CAAmB,EAAE,0DAAC;AAErD;;;AAGG;AACH,IAAA,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE;AAEhD;;;;AAIG;IACH,QAAQ,GAA2B,WAAW;AAE9C;;;;AAIG;AACH,IAAA,SAAS,CAAC,GAA0C,EAAA;QAClD,IAAI,GAAG,CAAC,QAAQ;AAAE,YAAA,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ;IAChD;AAEA;;;;AAIG;AACH,IAAA,IAAI,CAAC,OAA8B,EAAA;AACjC,QAAA,MAAM,EAAE,GAAG,MAAM,CAAC,UAAU,EAAE;AAC9B,QAAA,MAAM,YAAY,GAAmB;YACnC,EAAE;YACF,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,OAAO,EAAE,OAAO,CAAC,OAAO;AACxB,YAAA,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,IAAI;AAClC,YAAA,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,IAAI;YACpC,QAAQ,EAAE,OAAO,CAAC,QAAQ;AAC1B,YAAA,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,IAAI;SAC3B;AAED,QAAA,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,IAAI,EAAE,YAAY,CAAC,CAAC;AAE7D,QAAA,IAAI,YAAY,CAAC,SAAS,EAAE;AAC1B,YAAA,UAAU,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC;QAC3D;AAEA,QAAA,OAAO,EAAE;IACX;AAEA;;;AAGG;AACH,IAAA,OAAO,CAAC,EAAU,EAAA;QAChB,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IACvE;AAEA;;AAEG;IACH,QAAQ,GAAA;AACN,QAAA,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;IAC7B;uGAnEW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAArB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,cADR,MAAM,EAAA,CAAA;;2FACnB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBADjC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACRlC;;;;AAIG;MAQU,uBAAuB,CAAA;;AAElC,IAAA,OAAO,GAAG,MAAM,CAAC,qBAAqB,CAAC;;AAGvC,IAAA,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa;;AAGlC,IAAA,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC;AAExC;;;;AAIG;AACH,IAAA,OAAO,CAAC,EAAU,EAAA;AAChB,QAAA,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;IAC1B;AAEA;;;;;;;;;;;;;AAaG;AACH,IAAA,OAAO,CAAC,IAAsB,EAAA;AAC5B,QAAA,QACE,OAAO,IAAI,KAAK,QAAQ;AACxB,aAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;AACpB,gBAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;AACrB,gBAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;AACrB,gBAAA,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;AACvB,gBAAA,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAE3B;AAEA;;;;;AAKG;AACH,IAAA,gBAAgB,CAAC,IAAY,EAAA;QAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,IAAI,CAAC;IACrD;uGApDW,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAvB,uBAAuB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,sBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECjBpC,ilFAyDA,EAAA,MAAA,EAAA,CAAA,ohHAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,ED5CY,YAAY,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,OAAA,EAAA,QAAA,EAAA,WAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,SAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FAIX,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAPnC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,sBAAsB,EAAA,UAAA,EACpB,IAAI,EAAA,OAAA,EACP,CAAC,YAAY,CAAC,EAAA,QAAA,EAAA,ilFAAA,EAAA,MAAA,EAAA,CAAA,ohHAAA,CAAA,EAAA;;;AEbzB;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"su-labs-notifications.mjs","sources":["../../../../compat/angular-21/build/notifications/src/lib/notification.service.ts","../../../../compat/angular-21/build/notifications/src/lib/notification.component.ts","../../../../compat/angular-21/build/notifications/src/lib/notification.component.html","../../../../compat/angular-21/build/notifications/src/su-labs-notifications.ts"],"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","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@su-labs/notifications",
3
- "version": "21.0.5",
3
+ "version": "21.3.1",
4
4
  "keywords": [
5
5
  "angular",
6
6
  "notifications",
@@ -17,7 +17,7 @@
17
17
  "snack-bar",
18
18
  "library"
19
19
  ],
20
- "homepage": "https://github.com/Greezaaa/settings-utils-lib/tree/main/projects/su-labs/font-size#readme",
20
+ "homepage": "https://su-labs.dev/notifications/",
21
21
  "author": {
22
22
  "name": "Yevheniy Alekseyev",
23
23
  "email": "yev.alekseyev@gmail.com",
@@ -26,7 +26,7 @@
26
26
  "repository": {
27
27
  "type": "git",
28
28
  "url": "https://github.com/Greezaaa/settings-utils-lib.git",
29
- "directory": "projects/su-labs/font-size"
29
+ "directory": "projects/su-labs/notifications"
30
30
  },
31
31
  "bugs": {
32
32
  "url": "https://github.com/Greezaaa/settings-utils-lib/issues"
@@ -36,6 +36,7 @@
36
36
  "@angular/core": "^21.0.0"
37
37
  },
38
38
  "dependencies": {
39
+ "@su-labs/core": "1.9.0",
39
40
  "tslib": "^2.3.0"
40
41
  },
41
42
  "sideEffects": false,
@@ -50,5 +51,6 @@
50
51
  "types": "./types/su-labs-notifications.d.ts",
51
52
  "default": "./fesm2022/su-labs-notifications.mjs"
52
53
  }
53
- }
54
+ },
55
+ "type": "module"
54
56
  }
@@ -1,89 +1,49 @@
1
1
  import * as i0 from '@angular/core';
2
+ import { OnDestroy } from '@angular/core';
2
3
  import * as _su_labs_notifications from '@su-labs/notifications';
4
+ import { SuNotification, SuNotificationPosition, SuNotificationSlide, SuNotificationConfig, SuNotificationOptions, SuNotificationAction } from '@su-labs/core/notifications';
5
+ export { SuNotification, SuNotificationAction, SuNotificationConfig, SuNotificationMessagePart, SuNotificationOptions, SuNotificationPosition, SuNotificationSlide, SuNotificationType } from '@su-labs/core/notifications';
3
6
  import { SafeHtml } from '@angular/platform-browser';
4
7
 
5
8
  /**
6
- * Represents the type of a notification.
7
- */
8
- type SuNotificationType = 'info' | 'success' | 'warning' | 'error' | 'custom';
9
- /**
10
- * Options for configuring a notification.
11
- */
12
- interface SuNotificationOptions {
13
- /**
14
- * The type of notification. Determines styling and default icon.
15
- */
16
- type: SuNotificationType;
17
- /**
18
- * The main message text to display in the notification.
19
- */
20
- message: string;
21
- /**
22
- * Duration in milliseconds before the notification automatically closes.
23
- * @default 3000
24
- */
25
- duration?: number;
26
- /**
27
- * Whether the notification should automatically close after the duration.
28
- * @default true
29
- */
30
- autoClose?: boolean;
31
- /**
32
- * Additional CSS class(es) to apply to the notification for custom styling.
33
- */
34
- cssClass?: string;
35
- /**
36
- * Icon configuration for the notification:
37
- * - `false`: no icon
38
- * - `true`: default icon for the given type
39
- * - `string`: custom SVG markup or URL for the icon
40
- */
41
- icon?: boolean | string;
42
- }
43
- /**
44
- * A notification instance with a unique identifier.
45
- */
46
- interface SuNotification extends SuNotificationOptions {
47
- /**
48
- * Unique identifier for the notification instance.
49
- */
50
- id: string;
51
- }
52
- /**
53
- * Possible positions for displaying notifications on the screen.
54
- */
55
- type SuNotificationPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center';
56
-
57
- /**
58
- * Service for managing notifications.
9
+ * Angular service for managing notifications.
59
10
  *
60
- * Provides methods to show, dismiss, and clear notifications.
61
- * Notifications are reactive signals, making them easy to bind in templates.
11
+ * Thin wrapper around the framework-agnostic `SuNotificationController` from
12
+ * `@su-labs/core/notifications` that exposes the notifications as an Angular signal.
62
13
  */
63
- declare class SuNotificationService {
64
- /**
65
- * Internal signal holding the list of notifications.
66
- */
67
- private _notifications;
14
+ declare class SuNotificationService implements OnDestroy {
15
+ /** Framework-agnostic notification logic */
16
+ private readonly controller;
17
+ /** Internal signal holding the list of notifications, kept in sync with the controller */
18
+ private readonly _notifications;
68
19
  /**
69
20
  * Read-only access to the notifications list.
70
21
  * Can be used in templates for reactive updates.
71
22
  */
72
- notifications: i0.Signal<SuNotification[]>;
23
+ readonly notifications: i0.Signal<SuNotification[]>;
24
+ /** Stops syncing the controller's notifications into the signal */
25
+ private readonly unsubscribe;
73
26
  /**
74
- * Default position where notifications will appear on the screen.
75
- * Can be configured via `configure` method.
27
+ * Position where notifications appear on the screen.
28
+ * Can also be set via the `configure` method.
76
29
  * @default 'top-right'
77
30
  */
78
- position: SuNotificationPosition;
31
+ get position(): SuNotificationPosition;
32
+ set position(position: SuNotificationPosition);
33
+ /**
34
+ * The direction notifications slide in from, whatever their position.
35
+ * Can also be set via the `configure` method.
36
+ * @default 'auto'
37
+ */
38
+ get slideFrom(): SuNotificationSlide;
39
+ set slideFrom(slideFrom: SuNotificationSlide);
79
40
  /**
80
41
  * Configure the notification service.
81
42
  * @param cfg Configuration object
82
43
  * @param cfg.position Optional position to display notifications.
44
+ * @param cfg.slideFrom Optional direction notifications slide in from.
83
45
  */
84
- configure(cfg: {
85
- position?: SuNotificationPosition;
86
- }): void;
46
+ configure(cfg: SuNotificationConfig): void;
87
47
  /**
88
48
  * Show a new notification.
89
49
  * @param options Options to configure the notification.
@@ -99,6 +59,8 @@ declare class SuNotificationService {
99
59
  * Clear all notifications immediately.
100
60
  */
101
61
  clearAll(): void;
62
+ /** Angular lifecycle hook for service destruction */
63
+ ngOnDestroy(): void;
102
64
  static ɵfac: i0.ɵɵFactoryDeclaration<SuNotificationService, never>;
103
65
  static ɵprov: i0.ɵɵInjectableDeclaration<SuNotificationService>;
104
66
  }
@@ -121,19 +83,19 @@ declare class SuNotificationComponent {
121
83
  * @param id ID of the notification to dismiss
122
84
  */
123
85
  dismiss(id: string): void;
86
+ /**
87
+ * Runs an action button of a notification, then closes the notification unless the action says not to.
88
+ * @param id ID of the notification the button belongs to
89
+ * @param action The action that was pressed
90
+ */
91
+ runAction(id: string, action: SuNotificationAction): void;
124
92
  /**
125
93
  * Checks if the provided `icon` value should be rendered as an image (`<img>`).
126
- *
127
- * Determines whether the `icon` is a string pointing to an image file:
128
- * - Local or relative paths (starting with `/`)
129
- * - URLs (starting with `http`)
130
- * - File paths ending with `.png`, `.jpg`, or `.svg`
131
- *
132
- * Inline SVG strings (e.g., `<svg>...</svg>`) are **not** treated as images and
133
- * should be rendered with `[innerHTML]`.
94
+ * Inline SVG strings are rendered with `[innerHTML]` instead.
95
+ * See `isSuNotificationImageIcon` in `@su-labs/core/notifications` for the rules.
134
96
  *
135
97
  * @param icon The icon value from the notification (boolean or string)
136
- * @returns `true` if the icon is an image path or URL, `false` for inline SVGs or `false`
98
+ * @returns `true` if the icon is an image path or URL
137
99
  */
138
100
  isImage(icon: string | boolean): boolean;
139
101
  /**
@@ -148,4 +110,3 @@ declare class SuNotificationComponent {
148
110
  }
149
111
 
150
112
  export { SuNotificationComponent, SuNotificationService };
151
- export type { SuNotification, SuNotificationOptions, SuNotificationPosition, SuNotificationType };