@filip.mazev/toastr 0.0.7 → 0.0.9
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/README.md
CHANGED
|
@@ -1 +1,247 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @filip.mazev/toastr
|
|
2
|
+
|
|
3
|
+
## Blocks - Toastr Library
|
|
4
|
+
|
|
5
|
+
**Blocks** is a powerful Angular component library. The **Toastr** package provides a highly customizable, component-driven toast notification system. It features robust queue management, swipe-to-dismiss gestures for mobile, flexible screen positioning, and full type safety for dynamic content.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
* Service-Driven & Component-Based: Queue toasts from anywhere using ToastrService while rendering your own custom Angular components inside the toast wrappers.
|
|
10
|
+
* Smart Queue Management: Automatically limits the number of visible toasts on screen (configurable) and queues the rest.
|
|
11
|
+
* Flexible Positioning: Supports top/bottom and left/right/center placements, adjusting automatically for mobile viewports.
|
|
12
|
+
* Mobile Optimized: Native-feeling vertical swipe-to-dismiss gestures built-in.
|
|
13
|
+
* Auto-Dismiss: Configurable timeouts to automatically close notifications.
|
|
14
|
+
* Dynamic Data: Pass strictly typed data to your toast components and return results.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
Please install both @filip.mazev/blocks-core and @filip.mazev/toastr for propert functionality and full customization.
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm i @filip.mazev/blocks-core@latest @filip.mazev/toastr@latest
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Theme Configuration
|
|
25
|
+
|
|
26
|
+
To ensure the library's stylization works correctly, import the core theme provider in your global styles (`styles.scss`). The toast notifications utilize standard CSS variables for styling.
|
|
27
|
+
|
|
28
|
+
```scss
|
|
29
|
+
@use '@filip.mazev/blocks-core/src/lib/styles/index' as blocks;
|
|
30
|
+
@use '@filip.mazev/toastr/lib/styles/index' as toastr;
|
|
31
|
+
|
|
32
|
+
@layer base {
|
|
33
|
+
:root {
|
|
34
|
+
@include blocks.core-theme(blocks.$default-light-theme-config);
|
|
35
|
+
|
|
36
|
+
/* Optional: Override default Toast wrapper variables */
|
|
37
|
+
@include toastr.toastr-theme((
|
|
38
|
+
'--toast-bg': #ffffff,
|
|
39
|
+
'--toast-text': #000000
|
|
40
|
+
));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[data-theme='dark'] {
|
|
44
|
+
@include blocks.core-theme(blocks.$default-dark-theme-config);
|
|
45
|
+
|
|
46
|
+
/* Optional: Override default Toast wrapper variables */
|
|
47
|
+
@include toastr.toastr-theme((
|
|
48
|
+
'--toast-bg': #000000,
|
|
49
|
+
'--toast-text': #ffffff
|
|
50
|
+
));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
_Note: If you provide a custom wrapperClass in your toast configuration, you can bypass the default wrapper styling entirely and apply your own custom CSS classes._
|
|
56
|
+
|
|
57
|
+
## Usage
|
|
58
|
+
|
|
59
|
+
### Create a Toast Component
|
|
60
|
+
|
|
61
|
+
Your custom toast components must extend the `Toast<TData, TResult>` base class (which implements `IToast<D, R>`).
|
|
62
|
+
|
|
63
|
+
Typescript:
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
import { Component } from '@angular/core';
|
|
67
|
+
import { Toast } from '@filip.mazev/toastr';
|
|
68
|
+
import { INotificationView } from '@interfaces/ui/inotification-view.interface';
|
|
69
|
+
|
|
70
|
+
@Component({
|
|
71
|
+
selector: 'app-custom-toast',
|
|
72
|
+
templateUrl: './custom-toast.html',
|
|
73
|
+
styleUrl: './custom-toast.scss'
|
|
74
|
+
})
|
|
75
|
+
export class CustomToastComponent extends Toast<INotificationView, undefined> {
|
|
76
|
+
|
|
77
|
+
// Example method to close the toast from within the component
|
|
78
|
+
protected onDismiss(): void {
|
|
79
|
+
this.close();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
HTML (Template):
|
|
85
|
+
|
|
86
|
+
```HTML
|
|
87
|
+
<div class="notification">
|
|
88
|
+
<button class="notification-close-button" (click)="onDismiss()">✕</button>
|
|
89
|
+
<div class="notification-content">
|
|
90
|
+
<h3>{{ data.title }}</h3>
|
|
91
|
+
<p [class]="'notification-' + data.type">{{ data.message }}</p>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### About `ToastRef<R>`
|
|
97
|
+
|
|
98
|
+
Accessible via `this.toast` inside any component that extends `Toast`. This reference provides programmatic control over the active toast instance.
|
|
99
|
+
|
|
100
|
+
#### Methods & Observables
|
|
101
|
+
|
|
102
|
+
* `close()`: Triggers the exit animation and safely removes the toast from the DOM, allowing the next queued toast to appear.
|
|
103
|
+
* `afterClosed$`: An `Observable<void>` that emits once the toast has fully closed and animations have finished.
|
|
104
|
+
|
|
105
|
+
### 2. Opening the Toast
|
|
106
|
+
|
|
107
|
+
Use the `ToastrService` to launch your component. Unlike modals, toasts are "queued", meaning if you exceed the `maxOpened` limit, they will wait their turn before displaying.
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
import { Component, inject } from '@angular/core';
|
|
111
|
+
import { ToastrService } from '@filip.mazev/toastr';
|
|
112
|
+
|
|
113
|
+
@Component({ ... })
|
|
114
|
+
export class MyFeatureComponent {
|
|
115
|
+
private readonly toastr = inject(ToastrService);
|
|
116
|
+
|
|
117
|
+
public showNotification(view: INotificationView) {
|
|
118
|
+
const toastRef = this.toastr.queueToast(CustomToastComponent, {
|
|
119
|
+
data: view, // Strictly typed to INotificationView
|
|
120
|
+
position: 'top-right',
|
|
121
|
+
durationInMs: 5000,
|
|
122
|
+
swipeToDismiss: true
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
toastRef.afterClosed$.subscribe(() => {
|
|
126
|
+
console.log('Toast finished and removed from screen.');
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Configuration Options
|
|
133
|
+
|
|
134
|
+
### `IToastConfig<D>`
|
|
135
|
+
|
|
136
|
+
Controls the behavior, data, and placement of an individual toast:
|
|
137
|
+
|
|
138
|
+
* `data` |`D`|: (optional) The typed payload passed into the toast component.
|
|
139
|
+
* `position` |`ToastPosition`|: (optional) Where the toast should appear on the screen ('top-right', 'top-left', 'top-center', 'bottom-right', 'bottom-left', 'bottom-center'). Defaults to 'top-right'.
|
|
140
|
+
* `durationInMs` |`number`|: (optional) The time in milliseconds before the toast automatically closes. Defaults to 5000.
|
|
141
|
+
* `swipeToDismiss` |`boolean`|: (optional) Whether the user can swipe vertically to dismiss the toast. Defaults to true.
|
|
142
|
+
* `animate` |`boolean`|: (optional) Whether the toast should animate in and out. Defaults to true.
|
|
143
|
+
* `wrapperClass` |`string`|: (optional) A custom CSS class to apply to the toast's outer wrapper container. If omitted, it uses 'default-wrapper'.
|
|
144
|
+
|
|
145
|
+
## Global Toastr Settings
|
|
146
|
+
|
|
147
|
+
Similar to the modal library (`@filip.mazev/modal`), you can manage application-wide defaults using the `ToastrGlobalSettingsService`. These defaults apply automatically unless overridden by the IToastConfig during the queueToast call. It also is the place where `maxOpened` is configured since this is a global configuration.
|
|
148
|
+
|
|
149
|
+
### Example Usage
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
import { Component, inject } from '@angular/core';
|
|
153
|
+
import { ToastrGlobalSettingsService } from '@filip.mazev/toastr';
|
|
154
|
+
|
|
155
|
+
@Component({ ... })
|
|
156
|
+
export class AppComponent {
|
|
157
|
+
private readonly toastrGlobalSettings = inject(ToastrGlobalSettingsService);
|
|
158
|
+
|
|
159
|
+
constructor() {
|
|
160
|
+
// Update global defaults at runtime
|
|
161
|
+
this.toastrGlobalSettings.update({
|
|
162
|
+
position: 'bottom-right', // Move all toasts to the bottom right
|
|
163
|
+
durationInMs: 7500, // Keep toasts open longer by default
|
|
164
|
+
maxOpened: 3, // Only show 3 toasts at a time; queue the rest
|
|
165
|
+
swipeToDismiss: true
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### How It Works
|
|
172
|
+
|
|
173
|
+
* The `ToastrGlobalSettingsService` utilizes Angular Signals (`signal<T>`) for its internal state.
|
|
174
|
+
* Whenever `ToastrService.queueToast()` is called, it resolves missing configuration options against these global signals.
|
|
175
|
+
* You can dynamically alter these settings at any point in your application's lifecycle, affecting all subsequent toast notifications.
|
|
176
|
+
|
|
177
|
+
## Quick Status Toasts (SimpleToast)
|
|
178
|
+
|
|
179
|
+
While toastr excels at rendering highly customized components, it also provides a built-in `SimpleToast` component for standard status notifications. You don't need to create your own components to display basic success, info, warning, or error messages.
|
|
180
|
+
|
|
181
|
+
The `ToastrService` exposes four convenience methods: `queueSuccess`, `queueInfo`, `queueWarning`, and `queueError`.
|
|
182
|
+
|
|
183
|
+
### SimpleToast Usage
|
|
184
|
+
|
|
185
|
+
These methods accept an `IQueueSimpleToastRequest` object. They automatically apply a default wrapperClass ('simple-toast-wrapper') and inherit your global settings unless overridden.
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
import { Component, inject } from '@angular/core';
|
|
189
|
+
import { ToastrService } from '@filip.mazev/toastr';
|
|
190
|
+
|
|
191
|
+
@Component({ ... })
|
|
192
|
+
export class MyFeatureComponent {
|
|
193
|
+
private readonly toastr = inject(ToastrService);
|
|
194
|
+
|
|
195
|
+
public saveDocument() {
|
|
196
|
+
// ... save logic ...
|
|
197
|
+
|
|
198
|
+
// Fire a quick success toast
|
|
199
|
+
this.toastr.queueSuccess({
|
|
200
|
+
message: 'Your document was saved successfully.',
|
|
201
|
+
title: 'Save Complete' // Optional
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
public reportIssue() {
|
|
206
|
+
// Fire a quick error toast with an overridden position
|
|
207
|
+
this.toastr.queueError({
|
|
208
|
+
message: 'Failed to connect to the server. Please try again later.',
|
|
209
|
+
position: 'bottom-center', // Optional override
|
|
210
|
+
durationInMs: 10000 // Optional override
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### The `IQueueSimpleToastRequest` Interface
|
|
217
|
+
|
|
218
|
+
When using the quick status methods, the configuration is streamlined to focus on the text content:
|
|
219
|
+
|
|
220
|
+
* `message` |`string`|: The main text body of the toast. If no title is provided, this text is automatically scaled up slightly for better visibility.
|
|
221
|
+
* `title` |`string`|: (optional) A bolded header for the toast.
|
|
222
|
+
* `position` |`ToastPosition`|: (optional) Overrides the globally configured screen position.
|
|
223
|
+
* `durationInMs` |`number`|: (optional) Overrides the globally configured auto-close timeout.
|
|
224
|
+
|
|
225
|
+
### Styling the Simple Toasts
|
|
226
|
+
|
|
227
|
+
The `SimpleToast` component uses specific CSS variables for its status colors. To ensure they look correct in your application, define these variables in your global styles.scss theme configuration:
|
|
228
|
+
|
|
229
|
+
```scss
|
|
230
|
+
@use '@filip.mazev/blocks-core/src/lib/styles/index' as blocks;
|
|
231
|
+
@use '@filip.mazev/toastr/lib/styles/index' as toastr;
|
|
232
|
+
|
|
233
|
+
@layer base {
|
|
234
|
+
:root {
|
|
235
|
+
@include blocks.core-theme(blocks.$default-light-theme-config);
|
|
236
|
+
|
|
237
|
+
/* Optional: Override default Toast wrapper variables */
|
|
238
|
+
@include toastr.toastr-theme((
|
|
239
|
+
'--simple-toast-info': #e3f2fd,
|
|
240
|
+
'--simple-toast-success': #e8f5e9,
|
|
241
|
+
'--simple-toast-warn': #fff3cd,
|
|
242
|
+
'--simple-toast-error': #fdecea,
|
|
243
|
+
'toast-text-warn': #d32f2f
|
|
244
|
+
));
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
```
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { InjectionToken, signal, Injectable, computed, ViewContainerRef, ViewChild, Component, inject, Injector, ApplicationRef, EnvironmentInjector, createComponent } from '@angular/core';
|
|
3
|
-
import
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import { NgClass, DOCUMENT, CommonModule } from '@angular/common';
|
|
4
5
|
import { Subject, take } from 'rxjs';
|
|
6
|
+
import { SimpleToast as SimpleToast$1 } from '@toastr/components/views/simple-toast/simple-toast';
|
|
7
|
+
import { Toast as Toast$1 } from '@toastr/classes/toast';
|
|
5
8
|
|
|
6
9
|
class ToastRef {
|
|
7
10
|
afterClosedSubject = new Subject();
|
|
@@ -63,7 +66,7 @@ class ToastCore {
|
|
|
63
66
|
wrapperClasses = computed(() => {
|
|
64
67
|
const isTop = (this.config?.position ?? 'top-right').includes('top');
|
|
65
68
|
const animClass = isTop ? 'anim-dir-top' : 'anim-dir-bottom';
|
|
66
|
-
const wrapperClass = this.config?.wrapperClass ?? 'default-wrapper';
|
|
69
|
+
const wrapperClass = this.config?.wrapperClass ?? 'default-wrapper' + (this.config?.hasDefaultBackground === false ? ' no-bg' : '');
|
|
67
70
|
return `${animClass} ${wrapperClass}`;
|
|
68
71
|
}, ...(ngDevMode ? [{ debugName: "wrapperClasses" }] : []));
|
|
69
72
|
modalTransform = computed(() => {
|
|
@@ -179,11 +182,11 @@ class ToastCore {
|
|
|
179
182
|
});
|
|
180
183
|
}
|
|
181
184
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ToastCore, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
182
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.4", type: ToastCore, isStandalone: true, selector: "app-toast-core", viewQueries: [{ propertyName: "dynamicContainer", first: true, predicate: ["dynamicContainer"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "toastSwipeTarget", first: true, predicate: ["toastSwipeTarget"], descendants: true, static: true }], ngImport: i0, template: "<div #toastSwipeTarget class=\"toast-wrapper\" [ngClass]=\"wrapperClasses()\" [class.show]=\"isVisible()\"\n [class.no-animate]=\"!isAnimated()\" [style.transform]=\"modalTransform()\">\n <ng-container #dynamicContainer></ng-container>\n</div>", styles: ["::ng-deep .toast-container{position:fixed;z-index:9999;display:flex;gap:1rem;pointer-events:none}@media(max-width:768px){::ng-deep .toast-container{left:1rem!important;right:1rem!important;width:calc(100% - 2rem)}}::ng-deep .toast-container-top-right{top:1rem;right:1rem;flex-direction:column}::ng-deep .toast-container-top-left{top:1rem;left:1rem;flex-direction:column}::ng-deep .toast-container-top-center{top:1rem;left:50%;transform:translate(-50%);flex-direction:column}::ng-deep .toast-container-bottom-right{bottom:1rem;right:1rem;flex-direction:column-reverse}::ng-deep .toast-container-bottom-left{bottom:1rem;left:1rem;flex-direction:column-reverse}::ng-deep .toast-container-bottom-center{bottom:1rem;left:50%;transform:translate(-50%);flex-direction:column-reverse}@media(max-width:768px){::ng-deep .toast-container[class*=-top-]{top:1rem!important;bottom:auto!important;flex-direction:column!important;transform:none!important}::ng-deep .toast-container[class*=-bottom-]{bottom:1rem!important;top:auto!important;flex-direction:column-reverse!important;transform:none!important}}.toast-wrapper{position:relative;pointer-events:auto;opacity:0;transition:opacity .4s cubic-bezier(.25,.8,.25,1),transform .4s cubic-bezier(.25,.8,.25,1);transition-duration:calc(.4s * (1 - var(--a11y-reduced-motion, 0)))}.toast-wrapper.default-wrapper{background-color:var(--toast-bg, #fff);color:var(--toast-text, #000);border-radius:8px;box-shadow:0 4px 12px #00000026;padding:1rem;width:24rem;max-width:100%}.toast-wrapper.anim-dir-top{transform:translateY(-30px)}.toast-wrapper.anim-dir-bottom{transform:translateY(30px)}.toast-wrapper.show{opacity:1;transform:translateY(0)}.toast-wrapper.no-animate{transition:none!important;transform:none!important}@media(max-width:768px){.toast-wrapper{width:
|
|
185
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.4", type: ToastCore, isStandalone: true, selector: "app-toast-core", viewQueries: [{ propertyName: "dynamicContainer", first: true, predicate: ["dynamicContainer"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "toastSwipeTarget", first: true, predicate: ["toastSwipeTarget"], descendants: true, static: true }], ngImport: i0, template: "<div #toastSwipeTarget class=\"toast-wrapper\" [ngClass]=\"wrapperClasses()\" [class.show]=\"isVisible()\"\n [class.no-animate]=\"!isAnimated()\" [style.transform]=\"modalTransform()\">\n <ng-container #dynamicContainer></ng-container>\n</div>", styles: ["::ng-deep .toast-container{position:fixed;z-index:9999;display:flex;gap:1rem;pointer-events:none}@media(max-width:768px){::ng-deep .toast-container{left:1rem!important;right:1rem!important;width:calc(100% - 2rem)}}::ng-deep .toast-container-top-right{top:1rem;right:1rem;flex-direction:column}::ng-deep .toast-container-top-left{top:1rem;left:1rem;flex-direction:column}::ng-deep .toast-container-top-center{top:1rem;left:50%;transform:translate(-50%);flex-direction:column}::ng-deep .toast-container-bottom-right{bottom:1rem;right:1rem;flex-direction:column-reverse}::ng-deep .toast-container-bottom-left{bottom:1rem;left:1rem;flex-direction:column-reverse}::ng-deep .toast-container-bottom-center{bottom:1rem;left:50%;transform:translate(-50%);flex-direction:column-reverse}@media(max-width:768px){::ng-deep .toast-container[class*=-top-]{top:1rem!important;bottom:auto!important;flex-direction:column!important;transform:none!important}::ng-deep .toast-container[class*=-bottom-]{bottom:1rem!important;top:auto!important;flex-direction:column-reverse!important;transform:none!important}}.toast-wrapper{position:relative;pointer-events:auto;opacity:0;transition:opacity .4s cubic-bezier(.25,.8,.25,1),transform .4s cubic-bezier(.25,.8,.25,1);transition-duration:calc(.4s * (1 - var(--a11y-reduced-motion, 0)))}.toast-wrapper.default-wrapper{background-color:var(--toast-bg, #fff);color:var(--toast-text, #000);border-radius:8px;box-shadow:0 4px 12px #00000026;padding:1rem;width:24rem;max-width:100%}.toast-wrapper.default-wrapper.no-bg{background-color:transparent}.toast-wrapper.anim-dir-top{transform:translateY(-30px)}.toast-wrapper.anim-dir-bottom{transform:translateY(30px)}.toast-wrapper.show{opacity:1;transform:translateY(0)}.toast-wrapper.no-animate{transition:none!important;transform:none!important}@media(max-width:768px){.toast-wrapper{width:unset}}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
183
186
|
}
|
|
184
187
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ToastCore, decorators: [{
|
|
185
188
|
type: Component,
|
|
186
|
-
args: [{ selector: 'app-toast-core', imports: [NgClass], template: "<div #toastSwipeTarget class=\"toast-wrapper\" [ngClass]=\"wrapperClasses()\" [class.show]=\"isVisible()\"\n [class.no-animate]=\"!isAnimated()\" [style.transform]=\"modalTransform()\">\n <ng-container #dynamicContainer></ng-container>\n</div>", styles: ["::ng-deep .toast-container{position:fixed;z-index:9999;display:flex;gap:1rem;pointer-events:none}@media(max-width:768px){::ng-deep .toast-container{left:1rem!important;right:1rem!important;width:calc(100% - 2rem)}}::ng-deep .toast-container-top-right{top:1rem;right:1rem;flex-direction:column}::ng-deep .toast-container-top-left{top:1rem;left:1rem;flex-direction:column}::ng-deep .toast-container-top-center{top:1rem;left:50%;transform:translate(-50%);flex-direction:column}::ng-deep .toast-container-bottom-right{bottom:1rem;right:1rem;flex-direction:column-reverse}::ng-deep .toast-container-bottom-left{bottom:1rem;left:1rem;flex-direction:column-reverse}::ng-deep .toast-container-bottom-center{bottom:1rem;left:50%;transform:translate(-50%);flex-direction:column-reverse}@media(max-width:768px){::ng-deep .toast-container[class*=-top-]{top:1rem!important;bottom:auto!important;flex-direction:column!important;transform:none!important}::ng-deep .toast-container[class*=-bottom-]{bottom:1rem!important;top:auto!important;flex-direction:column-reverse!important;transform:none!important}}.toast-wrapper{position:relative;pointer-events:auto;opacity:0;transition:opacity .4s cubic-bezier(.25,.8,.25,1),transform .4s cubic-bezier(.25,.8,.25,1);transition-duration:calc(.4s * (1 - var(--a11y-reduced-motion, 0)))}.toast-wrapper.default-wrapper{background-color:var(--toast-bg, #fff);color:var(--toast-text, #000);border-radius:8px;box-shadow:0 4px 12px #00000026;padding:1rem;width:24rem;max-width:100%}.toast-wrapper.anim-dir-top{transform:translateY(-30px)}.toast-wrapper.anim-dir-bottom{transform:translateY(30px)}.toast-wrapper.show{opacity:1;transform:translateY(0)}.toast-wrapper.no-animate{transition:none!important;transform:none!important}@media(max-width:768px){.toast-wrapper{width:
|
|
189
|
+
args: [{ selector: 'app-toast-core', imports: [NgClass], template: "<div #toastSwipeTarget class=\"toast-wrapper\" [ngClass]=\"wrapperClasses()\" [class.show]=\"isVisible()\"\n [class.no-animate]=\"!isAnimated()\" [style.transform]=\"modalTransform()\">\n <ng-container #dynamicContainer></ng-container>\n</div>", styles: ["::ng-deep .toast-container{position:fixed;z-index:9999;display:flex;gap:1rem;pointer-events:none}@media(max-width:768px){::ng-deep .toast-container{left:1rem!important;right:1rem!important;width:calc(100% - 2rem)}}::ng-deep .toast-container-top-right{top:1rem;right:1rem;flex-direction:column}::ng-deep .toast-container-top-left{top:1rem;left:1rem;flex-direction:column}::ng-deep .toast-container-top-center{top:1rem;left:50%;transform:translate(-50%);flex-direction:column}::ng-deep .toast-container-bottom-right{bottom:1rem;right:1rem;flex-direction:column-reverse}::ng-deep .toast-container-bottom-left{bottom:1rem;left:1rem;flex-direction:column-reverse}::ng-deep .toast-container-bottom-center{bottom:1rem;left:50%;transform:translate(-50%);flex-direction:column-reverse}@media(max-width:768px){::ng-deep .toast-container[class*=-top-]{top:1rem!important;bottom:auto!important;flex-direction:column!important;transform:none!important}::ng-deep .toast-container[class*=-bottom-]{bottom:1rem!important;top:auto!important;flex-direction:column-reverse!important;transform:none!important}}.toast-wrapper{position:relative;pointer-events:auto;opacity:0;transition:opacity .4s cubic-bezier(.25,.8,.25,1),transform .4s cubic-bezier(.25,.8,.25,1);transition-duration:calc(.4s * (1 - var(--a11y-reduced-motion, 0)))}.toast-wrapper.default-wrapper{background-color:var(--toast-bg, #fff);color:var(--toast-text, #000);border-radius:8px;box-shadow:0 4px 12px #00000026;padding:1rem;width:24rem;max-width:100%}.toast-wrapper.default-wrapper.no-bg{background-color:transparent}.toast-wrapper.anim-dir-top{transform:translateY(-30px)}.toast-wrapper.anim-dir-bottom{transform:translateY(30px)}.toast-wrapper.show{opacity:1;transform:translateY(0)}.toast-wrapper.no-animate{transition:none!important;transform:none!important}@media(max-width:768px){.toast-wrapper{width:unset}}\n"] }]
|
|
187
190
|
}], propDecorators: { dynamicContainer: [{
|
|
188
191
|
type: ViewChild,
|
|
189
192
|
args: ['dynamicContainer', { read: ViewContainerRef, static: true }]
|
|
@@ -214,6 +217,79 @@ class ToastrService {
|
|
|
214
217
|
this.processQueue();
|
|
215
218
|
return toastRef;
|
|
216
219
|
}
|
|
220
|
+
/**
|
|
221
|
+
* Queues a simple success toast notification with the specified message and optional title, position, and duration.
|
|
222
|
+
* @param request An object containing the message, optional title, optional position, and duration for the toast notification.
|
|
223
|
+
* @returns A ToastRef instance representing the queued toast.
|
|
224
|
+
*/
|
|
225
|
+
queueSuccess(request) {
|
|
226
|
+
return this.queueToast(SimpleToast$1, {
|
|
227
|
+
position: request.position ?? this.globalSettings.position(),
|
|
228
|
+
data: {
|
|
229
|
+
title: request.title,
|
|
230
|
+
message: request.message,
|
|
231
|
+
type: 'success'
|
|
232
|
+
},
|
|
233
|
+
wrapperClass: 'simple-toast-wrapper',
|
|
234
|
+
durationInMs: request.durationInMs ?? this.globalSettings.durationInMs(),
|
|
235
|
+
animate: this.globalSettings.animate()
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Queues a simple info toast notification with the specified message and optional title, position, and duration.
|
|
240
|
+
* @param request An object containing the message, optional title, optional position, and duration for the toast notification.
|
|
241
|
+
* @returns A ToastRef instance representing the queued toast.
|
|
242
|
+
*/
|
|
243
|
+
queueInfo(request) {
|
|
244
|
+
return this.queueToast(SimpleToast$1, {
|
|
245
|
+
position: request.position ?? this.globalSettings.position(),
|
|
246
|
+
data: {
|
|
247
|
+
title: request.title,
|
|
248
|
+
message: request.message,
|
|
249
|
+
type: 'info'
|
|
250
|
+
},
|
|
251
|
+
wrapperClass: 'simple-toast-wrapper',
|
|
252
|
+
durationInMs: request.durationInMs ?? this.globalSettings.durationInMs(),
|
|
253
|
+
animate: this.globalSettings.animate()
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Queues a simple warning toast notification with the specified message and optional title, position, and duration.
|
|
258
|
+
* @param request An object containing the message, optional title, optional position, and duration for the toast notification.
|
|
259
|
+
* @returns A ToastRef instance representing the queued toast.
|
|
260
|
+
*/
|
|
261
|
+
queueWarning(request) {
|
|
262
|
+
return this.queueToast(SimpleToast$1, {
|
|
263
|
+
position: request.position ?? this.globalSettings.position(),
|
|
264
|
+
data: {
|
|
265
|
+
title: request.title,
|
|
266
|
+
message: request.message,
|
|
267
|
+
type: 'warn'
|
|
268
|
+
},
|
|
269
|
+
wrapperClass: 'simple-toast-wrapper',
|
|
270
|
+
durationInMs: request.durationInMs ?? this.globalSettings.durationInMs(),
|
|
271
|
+
animate: this.globalSettings.animate()
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Queues a simple error toast notification with the specified message and optional title, position, and duration.
|
|
276
|
+
* @param request An object containing the message, optional title, optional position, and duration for the toast notification.
|
|
277
|
+
* @returns A ToastRef instance representing the queued toast.
|
|
278
|
+
*/
|
|
279
|
+
queueError(request) {
|
|
280
|
+
return this.queueToast(SimpleToast$1, {
|
|
281
|
+
position: request.position ?? this.globalSettings.position(),
|
|
282
|
+
data: {
|
|
283
|
+
title: request.title,
|
|
284
|
+
message: request.message,
|
|
285
|
+
type: 'error'
|
|
286
|
+
},
|
|
287
|
+
wrapperClass: 'simple-toast-wrapper',
|
|
288
|
+
durationInMs: request.durationInMs ?? this.globalSettings.durationInMs(),
|
|
289
|
+
animate: this.globalSettings.animate()
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
//#region Helper Methods
|
|
217
293
|
processQueue() {
|
|
218
294
|
const max = this.globalSettings.maxOpened();
|
|
219
295
|
while (this.activeToasts.length < max && this.toastQueue.length > 0) {
|
|
@@ -296,6 +372,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImpor
|
|
|
296
372
|
}]
|
|
297
373
|
}] });
|
|
298
374
|
|
|
375
|
+
class SimpleToast extends Toast$1 {
|
|
376
|
+
dismiss() {
|
|
377
|
+
this.toast?.close();
|
|
378
|
+
}
|
|
379
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: SimpleToast, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
380
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.4", type: SimpleToast, isStandalone: true, selector: "app-simple-toast", usesInheritance: true, ngImport: i0, template: "<div class=\"simple-toast\" [ngClass]=\"data.type\">\n <button class=\"simple-toast-close-button\" (click)=\"dismiss()\" aria-label=\"Close toast\">\n \u2715\n </button>\n\n <div class=\"simple-toast-content\">\n @if(data.title ) {\n <h4 class=\"simple-toast-title\">{{ data.title }}</h4>\n <p class=\"simple-toast-message\">{{ data.message }}</p>\n } @else {\n <p class=\"simple-toast-message large-message\">{{ data.message }}</p>\n }\n </div>\n</div>", styles: [".simple-toast{display:flex;flex-direction:column;justify-content:center;position:relative;padding:1rem;border-radius:10px;color:var(--toast-text);box-shadow:0 2px 8px #00000026;border:1px solid var(--fm-border, #ccc);min-height:40px}.simple-toast.info{background-color:var(--simple-toast-info)}.simple-toast.success{background-color:var(--simple-toast-success)}.simple-toast.warning{background-color:var(--simple-toast-warn)}.simple-toast.error{background-color:var(--simple-toast-error)}.simple-toast-content{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;flex-grow:1;padding-right:1.5rem;font-family:inherit}.simple-toast-title{margin:0 0 .25rem;font-size:1rem;font-weight:600}.simple-toast-message{margin:0;font-size:.875rem;line-height:1.4}.simple-toast-message.large-message{font-size:1rem}.simple-toast-close-button{position:absolute;top:.5rem;right:.5rem;background:none;border:none;cursor:pointer;color:var(--toast-text, #888);width:1.5rem;height:1.5rem;font-size:1rem;display:flex;align-items:center;justify-content:center;transition:color .2s}.simple-toast-close-button:hover{color:var(--toast-text-warn, #d32f2f)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
381
|
+
}
|
|
382
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: SimpleToast, decorators: [{
|
|
383
|
+
type: Component,
|
|
384
|
+
args: [{ selector: 'app-simple-toast', standalone: true, imports: [CommonModule], template: "<div class=\"simple-toast\" [ngClass]=\"data.type\">\n <button class=\"simple-toast-close-button\" (click)=\"dismiss()\" aria-label=\"Close toast\">\n \u2715\n </button>\n\n <div class=\"simple-toast-content\">\n @if(data.title ) {\n <h4 class=\"simple-toast-title\">{{ data.title }}</h4>\n <p class=\"simple-toast-message\">{{ data.message }}</p>\n } @else {\n <p class=\"simple-toast-message large-message\">{{ data.message }}</p>\n }\n </div>\n</div>", styles: [".simple-toast{display:flex;flex-direction:column;justify-content:center;position:relative;padding:1rem;border-radius:10px;color:var(--toast-text);box-shadow:0 2px 8px #00000026;border:1px solid var(--fm-border, #ccc);min-height:40px}.simple-toast.info{background-color:var(--simple-toast-info)}.simple-toast.success{background-color:var(--simple-toast-success)}.simple-toast.warning{background-color:var(--simple-toast-warn)}.simple-toast.error{background-color:var(--simple-toast-error)}.simple-toast-content{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;flex-grow:1;padding-right:1.5rem;font-family:inherit}.simple-toast-title{margin:0 0 .25rem;font-size:1rem;font-weight:600}.simple-toast-message{margin:0;font-size:.875rem;line-height:1.4}.simple-toast-message.large-message{font-size:1rem}.simple-toast-close-button{position:absolute;top:.5rem;right:.5rem;background:none;border:none;cursor:pointer;color:var(--toast-text, #888);width:1.5rem;height:1.5rem;font-size:1rem;display:flex;align-items:center;justify-content:center;transition:color .2s}.simple-toast-close-button:hover{color:var(--toast-text-warn, #d32f2f)}\n"] }]
|
|
385
|
+
}] });
|
|
386
|
+
|
|
299
387
|
class Toast {
|
|
300
388
|
/**
|
|
301
389
|
* Data injected into the toast component.
|
|
@@ -331,5 +419,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImpor
|
|
|
331
419
|
* Generated bundle index. Do not edit.
|
|
332
420
|
*/
|
|
333
421
|
|
|
334
|
-
export { TOAST_DATA, Toast, ToastCore, ToastRef, ToastrGlobalSettingsService, ToastrService };
|
|
422
|
+
export { SimpleToast, TOAST_DATA, Toast, ToastCore, ToastRef, ToastrGlobalSettingsService, ToastrService };
|
|
335
423
|
//# sourceMappingURL=filip.mazev-toastr.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filip.mazev-toastr.mjs","sources":["../../../projects/toastr/src/lib/classes/toast-ref.ts","../../../projects/toastr/src/lib/tokens/toast-data.token.ts","../../../projects/toastr/src/lib/services/toastr-global-settings.service.ts","../../../projects/toastr/src/lib/components/toast-core.ts","../../../projects/toastr/src/lib/components/toast-core.html","../../../projects/toastr/src/lib/services/toastr.service.ts","../../../projects/toastr/src/lib/classes/toast.ts","../../../projects/toastr/src/public-api.ts","../../../projects/toastr/src/filip.mazev-toastr.ts"],"sourcesContent":["import { Subject } from 'rxjs';\n\nexport class ToastRef<R = unknown> {\n private readonly afterClosedSubject = new Subject<R | undefined>();\n public readonly afterClosed$ = this.afterClosedSubject.asObservable();\n\n public close(result?: R): void {\n this.afterClosedSubject.next(result);\n this.afterClosedSubject.complete();\n }\n}\n","import { InjectionToken } from '@angular/core';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const TOAST_DATA = new InjectionToken<any>('TOAST_DATA');\n","import { Injectable, signal } from '@angular/core';\nimport { ToastPosition } from '../types/toastr.types';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ToastrGlobalSettingsService {\n public readonly position = signal<ToastPosition>('top-right');\n public readonly animate = signal<boolean>(true);\n public readonly wrapperClass = signal<string | undefined>(undefined);\n public readonly durationInMs = signal<number>(5000);\n public readonly swipeToDismiss = signal<boolean>(true);\n public readonly maxOpened = signal<number>(4);\n\n /**\n * Updates the global toast settings with the provided values.\n * @param settings An object containing the settings to be updated.\n */\n public update(\n settings: Partial<{\n position: ToastPosition;\n animate: boolean;\n wrapperClass: string;\n durationInMs: number;\n swipeToDismiss: boolean;\n maxOpened: number;\n }>\n ): void {\n if (settings.position !== undefined) this.position.set(settings.position);\n if (settings.animate !== undefined) this.animate.set(settings.animate);\n if (settings.wrapperClass !== undefined) this.wrapperClass.set(settings.wrapperClass);\n if (settings.durationInMs !== undefined) this.durationInMs.set(settings.durationInMs);\n if (settings.swipeToDismiss !== undefined) this.swipeToDismiss.set(settings.swipeToDismiss);\n if (settings.maxOpened !== undefined) this.maxOpened.set(settings.maxOpened);\n }\n}\n","import { Component, ViewChild, ViewContainerRef, ComponentRef, ElementRef, OnInit, OnDestroy, signal, computed } from '@angular/core';\nimport { NgClass } from '@angular/common';\nimport { IToastConfig } from '../interfaces/itoast-config.interface';\nimport { ToastRef } from '../classes/toast-ref';\nimport { IToast } from '../interfaces/itoast.interface';\n\n@Component({\n selector: 'app-toast-core',\n imports: [NgClass],\n templateUrl: './toast-core.html',\n styleUrl: './toast-core.scss'\n})\nexport class ToastCore<D, R, C extends IToast<D, R> = IToast<D, R>> implements OnInit, OnDestroy {\n public componentRef!: ComponentRef<C>;\n public config?: IToastConfig<D>;\n public toastRef!: ToastRef<R>;\n\n public isVisible = signal(false);\n public currentTranslateY = signal(0);\n public isSwipingFinished = signal(false);\n\n protected isAnimated = computed(() => this.config?.animate !== false);\n\n @ViewChild('dynamicContainer', { read: ViewContainerRef, static: true }) protected dynamicContainer!: ViewContainerRef;\n @ViewChild('toastSwipeTarget', { static: true }) protected toastSwipeTarget!: ElementRef;\n\n protected wrapperClasses = computed(() => {\n const isTop = (this.config?.position ?? 'top-right').includes('top');\n const animClass = isTop ? 'anim-dir-top' : 'anim-dir-bottom';\n const wrapperClass = this.config?.wrapperClass ?? 'default-wrapper';\n return `${animClass} ${wrapperClass}`;\n });\n\n protected modalTransform = computed(() => {\n if (!this.isAnimated()) return null;\n\n const isTop = (this.config?.position ?? 'top-right').includes('top');\n\n if (this.isSwipingFinished()) {\n return isTop ? 'translateY(-120%)' : 'translateY(120%)';\n }\n\n if (this.currentTranslateY() !== 0) {\n return `translateY(${this.currentTranslateY()}px)`;\n }\n\n return null;\n });\n\n private isTrackingSwipe = false;\n private autoCloseTimeout?: ReturnType<typeof setTimeout>;\n private hasEmittedClose = false;\n private cleanupListeners: Array<() => void> = [];\n\n public ngOnInit(): void {\n this.dynamicContainer.insert(this.componentRef.hostView);\n\n setTimeout(() => this.isVisible.set(true), 10);\n\n if (this.config?.swipeToDismiss !== false) {\n this.startVerticalSwipeDetection();\n }\n\n if (this.config?.durationInMs) {\n this.autoCloseTimeout = setTimeout(() => this.closeToast(), this.config.durationInMs);\n }\n\n const target = this.toastSwipeTarget.nativeElement;\n\n const onTransitionEnd = (event: TransitionEvent) => {\n if (event.propertyName !== 'transform') return;\n if (!this.isVisible() && !this.hasEmittedClose) {\n this.hasEmittedClose = true;\n this.toastRef.close();\n }\n };\n\n target.addEventListener('transitionend', onTransitionEnd);\n this.cleanupListeners.push(() => target.removeEventListener('transitionend', onTransitionEnd));\n }\n\n public ngOnDestroy(): void {\n clearTimeout(this.autoCloseTimeout);\n this.isTrackingSwipe = false;\n this.cleanupListeners.forEach((fn) => fn());\n this.cleanupListeners = [];\n }\n\n public closeToast(): void {\n this.isVisible.set(false);\n this.isSwipingFinished.set(true);\n }\n\n //#region Swipe Logic\n\n private startVerticalSwipeDetection(): void {\n if (this.isTrackingSwipe) return;\n\n const hasTouch = typeof window !== 'undefined' && (window.matchMedia('(pointer: coarse)').matches || navigator.maxTouchPoints > 0);\n if (!hasTouch) return;\n\n this.isTrackingSwipe = true;\n const target = this.toastSwipeTarget.nativeElement;\n const isTop = (this.config?.position ?? 'top-right').includes('top');\n\n let startY = 0;\n let startTime = 0;\n let isPointerDown = false;\n let limit = 0;\n\n const pointerDown = (event: PointerEvent) => {\n if (event.button !== 0 && event.pointerType === 'mouse') return;\n\n const toastHeight = target.offsetHeight || 0;\n limit = toastHeight / 3;\n\n isPointerDown = true;\n startY = event.clientY;\n startTime = event.timeStamp;\n\n clearTimeout(this.autoCloseTimeout);\n target.setPointerCapture(event.pointerId);\n };\n\n const pointerMove = (event: PointerEvent) => {\n if (!isPointerDown) return;\n const currentY = event.clientY - startY;\n\n if ((isTop && currentY < 0) || (!isTop && currentY > 0)) {\n if (event.cancelable) event.preventDefault();\n this.currentTranslateY.set(currentY);\n }\n };\n\n const pointerUp = (event: PointerEvent) => {\n if (!isPointerDown) return;\n isPointerDown = false;\n target.releasePointerCapture(event.pointerId);\n\n const deltaY = event.clientY - startY;\n const duration = event.timeStamp - startTime || 1;\n const velocityY = Math.abs(deltaY / duration);\n\n const crossedLimit = isTop ? deltaY < -limit : deltaY > limit;\n\n if (crossedLimit || velocityY > 0.3) {\n this.closeToast();\n } else {\n this.currentTranslateY.set(0);\n if (this.config?.durationInMs) {\n this.autoCloseTimeout = setTimeout(() => this.closeToast(), this.config.durationInMs);\n }\n }\n };\n\n target.addEventListener('pointerdown', pointerDown, { passive: false });\n target.addEventListener('pointermove', pointerMove, { passive: false });\n target.addEventListener('pointerup', pointerUp);\n target.addEventListener('pointercancel', pointerUp);\n\n this.cleanupListeners.push(() => {\n target.removeEventListener('pointerdown', pointerDown);\n target.removeEventListener('pointermove', pointerMove);\n target.removeEventListener('pointerup', pointerUp);\n target.removeEventListener('pointercancel', pointerUp);\n });\n }\n\n //#endregion\n}\n","<div #toastSwipeTarget class=\"toast-wrapper\" [ngClass]=\"wrapperClasses()\" [class.show]=\"isVisible()\"\n [class.no-animate]=\"!isAnimated()\" [style.transform]=\"modalTransform()\">\n <ng-container #dynamicContainer></ng-container>\n</div>","import { Injectable, inject, Injector, ApplicationRef, EnvironmentInjector, createComponent, ComponentRef } from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\nimport { IToastConfig } from '../interfaces/itoast-config.interface';\nimport { ToastRef } from '../classes/toast-ref';\nimport { TOAST_DATA } from '../tokens/toast-data.token';\nimport { IToast } from '../interfaces/itoast.interface';\nimport { ToastrGlobalSettingsService } from './toastr-global-settings.service';\nimport { ToastPosition } from '../types/toastr.types';\nimport { ComponentType } from '@angular/cdk/portal';\nimport { ToastCore } from '../components/toast-core';\nimport { take } from 'rxjs';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ToastrService {\n private readonly injector = inject(Injector);\n private readonly appRef = inject(ApplicationRef);\n private readonly environmentInjector = inject(EnvironmentInjector);\n private readonly document = inject(DOCUMENT);\n private readonly globalSettings = inject(ToastrGlobalSettingsService);\n\n private readonly toastQueue: Array<() => void> = [];\n private readonly activeToasts: Array<ComponentRef<ToastCore<unknown, unknown, IToast<unknown, unknown>>>> = [];\n private readonly containers = new Map<ToastPosition, HTMLElement>();\n\n /**\n * Displays a toast notification with the specified component and configuration.\n * @param componentType\n * @param config\n * @returns\n */\n public queueToast<D, R, C extends IToast<D, R>>(componentType: ComponentType<C>, config?: IToastConfig<D>): ToastRef<R> {\n const resolvedConfig = this.resolveConfig(config);\n const toastRef = new ToastRef<R>();\n\n this.toastQueue.push(() => this.buildAndAttachToast(componentType, resolvedConfig, toastRef));\n\n this.processQueue();\n\n return toastRef;\n }\n\n private processQueue(): void {\n const max = this.globalSettings.maxOpened();\n\n while (this.activeToasts.length < max && this.toastQueue.length > 0) {\n const buildNext = this.toastQueue.shift();\n if (buildNext) {\n buildNext();\n }\n }\n }\n\n private buildAndAttachToast<D, R, C extends IToast<D, R>>(componentType: ComponentType<C>, config: IToastConfig<D>, toastRef: ToastRef<R>): void {\n const dataInjector = Injector.create({\n providers: [{ provide: TOAST_DATA, useValue: config.data }],\n parent: this.injector\n });\n\n const contentRef = createComponent(componentType, {\n environmentInjector: this.environmentInjector,\n elementInjector: dataInjector\n });\n\n if (this.isIToast<D, R, C>(contentRef.instance)) {\n contentRef.instance.toast = toastRef;\n contentRef.instance.onToastInit?.();\n }\n\n const wrapperInjector = Injector.create({\n providers: [{ provide: ToastRef, useValue: toastRef }],\n parent: this.injector\n });\n\n const wrapperRef = createComponent<ToastCore<D, R, C>>(ToastCore, {\n environmentInjector: this.environmentInjector,\n elementInjector: wrapperInjector\n });\n\n wrapperRef.instance.componentRef = contentRef;\n wrapperRef.instance.config = config;\n wrapperRef.instance.toastRef = toastRef;\n\n this.appRef.attachView(wrapperRef.hostView);\n\n const container = this.getContainer(config.position || 'top-right');\n container.appendChild(wrapperRef.location.nativeElement);\n\n this.activeToasts.push(wrapperRef as ComponentRef<ToastCore<unknown, unknown, IToast<unknown, unknown>>>);\n\n toastRef.afterClosed$.pipe(take(1)).subscribe(() => this.finalizeToast(wrapperRef));\n }\n\n private finalizeToast<D, R, C extends IToast<D, R>>(wrapperRef: ComponentRef<ToastCore<D, R, C>>): void {\n const index = this.activeToasts.indexOf(wrapperRef as ComponentRef<ToastCore<unknown, unknown, IToast<unknown, unknown>>>);\n\n if (index > -1) {\n this.activeToasts.splice(index, 1);\n }\n\n this.appRef.detachView(wrapperRef.hostView);\n wrapperRef.location.nativeElement.remove();\n wrapperRef.destroy();\n\n this.processQueue();\n }\n\n private getContainer(position: ToastPosition): HTMLElement {\n if (this.containers.has(position)) {\n return this.containers.get(position) as HTMLElement;\n }\n\n const container = this.document.createElement('div');\n container.classList.add('toast-container', `toast-container-${position}`);\n this.document.body.appendChild(container);\n\n this.containers.set(position, container);\n\n return container;\n }\n\n private resolveConfig<D>(config?: IToastConfig<D>): IToastConfig<D> {\n return {\n ...config,\n position: config?.position ?? this.globalSettings.position(),\n animate: config?.animate ?? this.globalSettings.animate(),\n wrapperClass: config?.wrapperClass ?? this.globalSettings.wrapperClass(),\n durationInMs: config?.durationInMs ?? this.globalSettings.durationInMs(),\n swipeToDismiss: config?.swipeToDismiss ?? this.globalSettings.swipeToDismiss()\n };\n }\n\n private isIToast<D, R, C extends IToast<D, R>>(component: unknown): component is C {\n return typeof component === 'object' && component !== null && 'toast' in component;\n }\n}\n","import { inject, Injectable } from '@angular/core';\nimport { ToastRef } from './toast-ref';\nimport { TOAST_DATA } from '../tokens/toast-data.token';\nimport { IToast } from '../interfaces/itoast.interface';\n\n@Injectable()\nexport abstract class Toast<D = unknown, R = unknown> implements IToast<D, R> {\n /**\n * Data injected into the toast component.\n */\n public data = inject<D>(TOAST_DATA);\n\n /**\n * Reference to the ToastRef instance associated with this toast.\n */\n public toast!: ToastRef<R>;\n\n /**\n * Called when the toast is initialized.\n */\n public onToastInit(): void {}\n\n /**\n * Closes the toast with an optional result.\n * @param result The result to be passed when closing the toast.\n */\n public close(result?: R): void {\n this.toast?.close(result);\n }\n}\n","/*\n * Public API Surface of toastr\n */\n\nexport * from './lib/services/toastr.service';\nexport * from './lib/services/toastr-global-settings.service';\n\nexport * from './lib/components/toast-core';\n\nexport * from './lib/interfaces/itoast-config.interface';\nexport * from './lib/interfaces/itoast.interface';\n\nexport * from './lib/types/toastr.types';\n\nexport * from './lib/tokens/toast-data.token';\n\nexport * from './lib/classes/toast-ref';\nexport * from './lib/classes/toast';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAEa,QAAQ,CAAA;AACF,IAAA,kBAAkB,GAAG,IAAI,OAAO,EAAiB;AAClD,IAAA,YAAY,GAAG,IAAI,CAAC,kBAAkB,CAAC,YAAY,EAAE;AAE9D,IAAA,KAAK,CAAC,MAAU,EAAA;AACrB,QAAA,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC;AACpC,QAAA,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAA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data.token.ts","../../../projects/toastr/src/lib/services/toastr-global-settings.service.ts","../../../projects/toastr/src/lib/components/toast-core.ts","../../../projects/toastr/src/lib/components/toast-core.html","../../../projects/toastr/src/lib/services/toastr.service.ts","../../../projects/toastr/src/lib/components/views/simple-toast/simple-toast.ts","../../../projects/toastr/src/lib/components/views/simple-toast/simple-toast.html","../../../projects/toastr/src/lib/classes/toast.ts","../../../projects/toastr/src/public-api.ts","../../../projects/toastr/src/filip.mazev-toastr.ts"],"sourcesContent":["import { Subject } from 'rxjs';\n\nexport class ToastRef<R = unknown> {\n private readonly afterClosedSubject = new Subject<R | undefined>();\n public readonly afterClosed$ = this.afterClosedSubject.asObservable();\n\n public close(result?: R): void {\n this.afterClosedSubject.next(result);\n this.afterClosedSubject.complete();\n }\n}\n","import { InjectionToken } from '@angular/core';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const TOAST_DATA = new InjectionToken<any>('TOAST_DATA');\n","import { Injectable, signal } from '@angular/core';\nimport { ToastPosition } from '../types/toastr.types';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ToastrGlobalSettingsService {\n public readonly position = signal<ToastPosition>('top-right');\n public readonly animate = signal<boolean>(true);\n public readonly wrapperClass = signal<string | undefined>(undefined);\n public readonly durationInMs = signal<number>(5000);\n public readonly swipeToDismiss = signal<boolean>(true);\n public readonly maxOpened = signal<number>(4);\n\n /**\n * Updates the global toast settings with the provided values.\n * @param settings An object containing the settings to be updated.\n */\n public update(\n settings: Partial<{\n position: ToastPosition;\n animate: boolean;\n wrapperClass: string;\n durationInMs: number;\n swipeToDismiss: boolean;\n maxOpened: number;\n }>\n ): void {\n if (settings.position !== undefined) this.position.set(settings.position);\n if (settings.animate !== undefined) this.animate.set(settings.animate);\n if (settings.wrapperClass !== undefined) this.wrapperClass.set(settings.wrapperClass);\n if (settings.durationInMs !== undefined) this.durationInMs.set(settings.durationInMs);\n if (settings.swipeToDismiss !== undefined) this.swipeToDismiss.set(settings.swipeToDismiss);\n if (settings.maxOpened !== undefined) this.maxOpened.set(settings.maxOpened);\n }\n}\n","import { Component, ViewChild, ViewContainerRef, ComponentRef, ElementRef, OnInit, OnDestroy, signal, computed } from '@angular/core';\nimport { NgClass } from '@angular/common';\nimport { IToastConfig } from '../interfaces/itoast-config.interface';\nimport { ToastRef } from '../classes/toast-ref';\nimport { IToast } from '../interfaces/itoast.interface';\n\n@Component({\n selector: 'app-toast-core',\n imports: [NgClass],\n templateUrl: './toast-core.html',\n styleUrl: './toast-core.scss'\n})\nexport class ToastCore<D, R, C extends IToast<D, R> = IToast<D, R>> implements OnInit, OnDestroy {\n public componentRef!: ComponentRef<C>;\n public config?: IToastConfig<D>;\n public toastRef!: ToastRef<R>;\n\n public isVisible = signal(false);\n public currentTranslateY = signal(0);\n public isSwipingFinished = signal(false);\n\n protected isAnimated = computed(() => this.config?.animate !== false);\n\n @ViewChild('dynamicContainer', { read: ViewContainerRef, static: true }) protected dynamicContainer!: ViewContainerRef;\n @ViewChild('toastSwipeTarget', { static: true }) protected toastSwipeTarget!: ElementRef;\n\n protected wrapperClasses = computed(() => {\n const isTop = (this.config?.position ?? 'top-right').includes('top');\n const animClass = isTop ? 'anim-dir-top' : 'anim-dir-bottom';\n const wrapperClass = this.config?.wrapperClass ?? 'default-wrapper' + (this.config?.hasDefaultBackground === false ? ' no-bg' : '');\n return `${animClass} ${wrapperClass}`;\n });\n\n protected modalTransform = computed(() => {\n if (!this.isAnimated()) return null;\n\n const isTop = (this.config?.position ?? 'top-right').includes('top');\n\n if (this.isSwipingFinished()) {\n return isTop ? 'translateY(-120%)' : 'translateY(120%)';\n }\n\n if (this.currentTranslateY() !== 0) {\n return `translateY(${this.currentTranslateY()}px)`;\n }\n\n return null;\n });\n\n private isTrackingSwipe = false;\n private autoCloseTimeout?: ReturnType<typeof setTimeout>;\n private hasEmittedClose = false;\n private cleanupListeners: Array<() => void> = [];\n\n public ngOnInit(): void {\n this.dynamicContainer.insert(this.componentRef.hostView);\n\n setTimeout(() => this.isVisible.set(true), 10);\n\n if (this.config?.swipeToDismiss !== false) {\n this.startVerticalSwipeDetection();\n }\n\n if (this.config?.durationInMs) {\n this.autoCloseTimeout = setTimeout(() => this.closeToast(), this.config.durationInMs);\n }\n\n const target = this.toastSwipeTarget.nativeElement;\n\n const onTransitionEnd = (event: TransitionEvent) => {\n if (event.propertyName !== 'transform') return;\n if (!this.isVisible() && !this.hasEmittedClose) {\n this.hasEmittedClose = true;\n this.toastRef.close();\n }\n };\n\n target.addEventListener('transitionend', onTransitionEnd);\n this.cleanupListeners.push(() => target.removeEventListener('transitionend', onTransitionEnd));\n }\n\n public ngOnDestroy(): void {\n clearTimeout(this.autoCloseTimeout);\n this.isTrackingSwipe = false;\n this.cleanupListeners.forEach((fn) => fn());\n this.cleanupListeners = [];\n }\n\n public closeToast(): void {\n this.isVisible.set(false);\n this.isSwipingFinished.set(true);\n }\n\n //#region Swipe Logic\n\n private startVerticalSwipeDetection(): void {\n if (this.isTrackingSwipe) return;\n\n const hasTouch = typeof window !== 'undefined' && (window.matchMedia('(pointer: coarse)').matches || navigator.maxTouchPoints > 0);\n if (!hasTouch) return;\n\n this.isTrackingSwipe = true;\n const target = this.toastSwipeTarget.nativeElement;\n const isTop = (this.config?.position ?? 'top-right').includes('top');\n\n let startY = 0;\n let startTime = 0;\n let isPointerDown = false;\n let limit = 0;\n\n const pointerDown = (event: PointerEvent) => {\n if (event.button !== 0 && event.pointerType === 'mouse') return;\n\n const toastHeight = target.offsetHeight || 0;\n limit = toastHeight / 3;\n\n isPointerDown = true;\n startY = event.clientY;\n startTime = event.timeStamp;\n\n clearTimeout(this.autoCloseTimeout);\n target.setPointerCapture(event.pointerId);\n };\n\n const pointerMove = (event: PointerEvent) => {\n if (!isPointerDown) return;\n const currentY = event.clientY - startY;\n\n if ((isTop && currentY < 0) || (!isTop && currentY > 0)) {\n if (event.cancelable) event.preventDefault();\n this.currentTranslateY.set(currentY);\n }\n };\n\n const pointerUp = (event: PointerEvent) => {\n if (!isPointerDown) return;\n isPointerDown = false;\n target.releasePointerCapture(event.pointerId);\n\n const deltaY = event.clientY - startY;\n const duration = event.timeStamp - startTime || 1;\n const velocityY = Math.abs(deltaY / duration);\n\n const crossedLimit = isTop ? deltaY < -limit : deltaY > limit;\n\n if (crossedLimit || velocityY > 0.3) {\n this.closeToast();\n } else {\n this.currentTranslateY.set(0);\n if (this.config?.durationInMs) {\n this.autoCloseTimeout = setTimeout(() => this.closeToast(), this.config.durationInMs);\n }\n }\n };\n\n target.addEventListener('pointerdown', pointerDown, { passive: false });\n target.addEventListener('pointermove', pointerMove, { passive: false });\n target.addEventListener('pointerup', pointerUp);\n target.addEventListener('pointercancel', pointerUp);\n\n this.cleanupListeners.push(() => {\n target.removeEventListener('pointerdown', pointerDown);\n target.removeEventListener('pointermove', pointerMove);\n target.removeEventListener('pointerup', pointerUp);\n target.removeEventListener('pointercancel', pointerUp);\n });\n }\n\n //#endregion\n}\n","<div #toastSwipeTarget class=\"toast-wrapper\" [ngClass]=\"wrapperClasses()\" [class.show]=\"isVisible()\"\n [class.no-animate]=\"!isAnimated()\" [style.transform]=\"modalTransform()\">\n <ng-container #dynamicContainer></ng-container>\n</div>","import { Injectable, inject, Injector, ApplicationRef, EnvironmentInjector, createComponent, ComponentRef } from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\nimport { IToastConfig } from '../interfaces/itoast-config.interface';\nimport { ToastRef } from '../classes/toast-ref';\nimport { TOAST_DATA } from '../tokens/toast-data.token';\nimport { IToast } from '../interfaces/itoast.interface';\nimport { ToastrGlobalSettingsService } from './toastr-global-settings.service';\nimport { ToastPosition } from '../types/toastr.types';\nimport { ComponentType } from '@angular/cdk/portal';\nimport { ToastCore } from '../components/toast-core';\nimport { take } from 'rxjs';\nimport { SimpleToast } from '@toastr/components/views/simple-toast/simple-toast';\nimport { ISimpleToastData } from '@toastr/interfaces/isimple-toast.interface';\nimport { IQueueSimpleToastRequest } from '@toastr/interfaces/iqueue-simple-toast-request.interface';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ToastrService {\n private readonly injector = inject(Injector);\n private readonly appRef = inject(ApplicationRef);\n private readonly environmentInjector = inject(EnvironmentInjector);\n private readonly document = inject(DOCUMENT);\n private readonly globalSettings = inject(ToastrGlobalSettingsService);\n\n private readonly toastQueue: Array<() => void> = [];\n private readonly activeToasts: Array<ComponentRef<ToastCore<unknown, unknown, IToast<unknown, unknown>>>> = [];\n private readonly containers = new Map<ToastPosition, HTMLElement>();\n\n /**\n * Displays a toast notification with the specified component and configuration.\n * @param componentType\n * @param config\n * @returns\n */\n public queueToast<D, R, C extends IToast<D, R>>(componentType: ComponentType<C>, config?: IToastConfig<D>): ToastRef<R> {\n const resolvedConfig = this.resolveConfig(config);\n const toastRef = new ToastRef<R>();\n\n this.toastQueue.push(() => this.buildAndAttachToast(componentType, resolvedConfig, toastRef));\n\n this.processQueue();\n\n return toastRef;\n }\n\n /**\n * Queues a simple success toast notification with the specified message and optional title, position, and duration.\n * @param request An object containing the message, optional title, optional position, and duration for the toast notification.\n * @returns A ToastRef instance representing the queued toast.\n */\n public queueSuccess(request: IQueueSimpleToastRequest): ToastRef<undefined> {\n return this.queueToast<ISimpleToastData, undefined, SimpleToast>(SimpleToast, {\n position: request.position ?? this.globalSettings.position(),\n data: {\n title: request.title,\n message: request.message,\n type: 'success'\n },\n wrapperClass: 'simple-toast-wrapper',\n durationInMs: request.durationInMs ?? this.globalSettings.durationInMs(),\n animate: this.globalSettings.animate()\n });\n }\n\n /**\n * Queues a simple info toast notification with the specified message and optional title, position, and duration.\n * @param request An object containing the message, optional title, optional position, and duration for the toast notification.\n * @returns A ToastRef instance representing the queued toast.\n */\n public queueInfo(request: IQueueSimpleToastRequest): ToastRef<undefined> {\n return this.queueToast<ISimpleToastData, undefined, SimpleToast>(SimpleToast, {\n position: request.position ?? this.globalSettings.position(),\n data: {\n title: request.title,\n message: request.message,\n type: 'info'\n },\n wrapperClass: 'simple-toast-wrapper',\n durationInMs: request.durationInMs ?? this.globalSettings.durationInMs(),\n animate: this.globalSettings.animate()\n });\n }\n\n /**\n * Queues a simple warning toast notification with the specified message and optional title, position, and duration.\n * @param request An object containing the message, optional title, optional position, and duration for the toast notification.\n * @returns A ToastRef instance representing the queued toast.\n */\n public queueWarning(request: IQueueSimpleToastRequest): ToastRef<undefined> {\n return this.queueToast<ISimpleToastData, undefined, SimpleToast>(SimpleToast, {\n position: request.position ?? this.globalSettings.position(),\n data: {\n title: request.title,\n message: request.message,\n type: 'warn'\n },\n wrapperClass: 'simple-toast-wrapper',\n durationInMs: request.durationInMs ?? this.globalSettings.durationInMs(),\n animate: this.globalSettings.animate()\n });\n }\n\n /**\n * Queues a simple error toast notification with the specified message and optional title, position, and duration.\n * @param request An object containing the message, optional title, optional position, and duration for the toast notification.\n * @returns A ToastRef instance representing the queued toast.\n */\n public queueError(request: IQueueSimpleToastRequest): ToastRef<undefined> {\n return this.queueToast<ISimpleToastData, undefined, SimpleToast>(SimpleToast, {\n position: request.position ?? this.globalSettings.position(),\n data: {\n title: request.title,\n message: request.message,\n type: 'error'\n },\n wrapperClass: 'simple-toast-wrapper',\n durationInMs: request.durationInMs ?? this.globalSettings.durationInMs(),\n animate: this.globalSettings.animate()\n });\n }\n\n //#region Helper Methods\n\n private processQueue(): void {\n const max = this.globalSettings.maxOpened();\n\n while (this.activeToasts.length < max && this.toastQueue.length > 0) {\n const buildNext = this.toastQueue.shift();\n if (buildNext) {\n buildNext();\n }\n }\n }\n\n private buildAndAttachToast<D, R, C extends IToast<D, R>>(componentType: ComponentType<C>, config: IToastConfig<D>, toastRef: ToastRef<R>): void {\n const dataInjector = Injector.create({\n providers: [{ provide: TOAST_DATA, useValue: config.data }],\n parent: this.injector\n });\n\n const contentRef = createComponent(componentType, {\n environmentInjector: this.environmentInjector,\n elementInjector: dataInjector\n });\n\n if (this.isIToast<D, R, C>(contentRef.instance)) {\n contentRef.instance.toast = toastRef;\n contentRef.instance.onToastInit?.();\n }\n\n const wrapperInjector = Injector.create({\n providers: [{ provide: ToastRef, useValue: toastRef }],\n parent: this.injector\n });\n\n const wrapperRef = createComponent<ToastCore<D, R, C>>(ToastCore, {\n environmentInjector: this.environmentInjector,\n elementInjector: wrapperInjector\n });\n\n wrapperRef.instance.componentRef = contentRef;\n wrapperRef.instance.config = config;\n wrapperRef.instance.toastRef = toastRef;\n\n this.appRef.attachView(wrapperRef.hostView);\n\n const container = this.getContainer(config.position || 'top-right');\n container.appendChild(wrapperRef.location.nativeElement);\n\n this.activeToasts.push(wrapperRef as ComponentRef<ToastCore<unknown, unknown, IToast<unknown, unknown>>>);\n\n toastRef.afterClosed$.pipe(take(1)).subscribe(() => this.finalizeToast(wrapperRef));\n }\n\n private finalizeToast<D, R, C extends IToast<D, R>>(wrapperRef: ComponentRef<ToastCore<D, R, C>>): void {\n const index = this.activeToasts.indexOf(wrapperRef as ComponentRef<ToastCore<unknown, unknown, IToast<unknown, unknown>>>);\n\n if (index > -1) {\n this.activeToasts.splice(index, 1);\n }\n\n this.appRef.detachView(wrapperRef.hostView);\n wrapperRef.location.nativeElement.remove();\n wrapperRef.destroy();\n\n this.processQueue();\n }\n\n private getContainer(position: ToastPosition): HTMLElement {\n if (this.containers.has(position)) {\n return this.containers.get(position) as HTMLElement;\n }\n\n const container = this.document.createElement('div');\n container.classList.add('toast-container', `toast-container-${position}`);\n this.document.body.appendChild(container);\n\n this.containers.set(position, container);\n\n return container;\n }\n\n private resolveConfig<D>(config?: IToastConfig<D>): IToastConfig<D> {\n return {\n ...config,\n position: config?.position ?? this.globalSettings.position(),\n animate: config?.animate ?? this.globalSettings.animate(),\n wrapperClass: config?.wrapperClass ?? this.globalSettings.wrapperClass(),\n durationInMs: config?.durationInMs ?? this.globalSettings.durationInMs(),\n swipeToDismiss: config?.swipeToDismiss ?? this.globalSettings.swipeToDismiss()\n };\n }\n\n private isIToast<D, R, C extends IToast<D, R>>(component: unknown): component is C {\n return typeof component === 'object' && component !== null && 'toast' in component;\n }\n\n //#endregion\n}\n","import { CommonModule } from '@angular/common';\nimport { Component } from '@angular/core';\nimport { Toast } from '@toastr/classes/toast';\nimport { ISimpleToastData } from '@toastr/interfaces/isimple-toast.interface';\n\n@Component({\n selector: 'app-simple-toast',\n standalone: true,\n imports: [CommonModule],\n templateUrl: './simple-toast.html',\n styleUrl: './simple-toast.scss'\n})\nexport class SimpleToast extends Toast<ISimpleToastData, undefined> {\n protected dismiss(): void {\n this.toast?.close();\n }\n}\n","<div class=\"simple-toast\" [ngClass]=\"data.type\">\n <button class=\"simple-toast-close-button\" (click)=\"dismiss()\" aria-label=\"Close toast\">\n ✕\n </button>\n\n <div class=\"simple-toast-content\">\n @if(data.title ) {\n <h4 class=\"simple-toast-title\">{{ data.title }}</h4>\n <p class=\"simple-toast-message\">{{ data.message }}</p>\n } @else {\n <p class=\"simple-toast-message large-message\">{{ data.message }}</p>\n }\n </div>\n</div>","import { inject, Injectable } from '@angular/core';\nimport { ToastRef } from './toast-ref';\nimport { TOAST_DATA } from '../tokens/toast-data.token';\nimport { IToast } from '../interfaces/itoast.interface';\n\n@Injectable()\nexport abstract class Toast<D = unknown, R = unknown> implements IToast<D, R> {\n /**\n * Data injected into the toast component.\n */\n public data = inject<D>(TOAST_DATA);\n\n /**\n * Reference to the ToastRef instance associated with this toast.\n */\n public toast!: ToastRef<R>;\n\n /**\n * Called when the toast is initialized.\n */\n public onToastInit(): void {}\n\n /**\n * Closes the toast with an optional result.\n * @param result The result to be passed when closing the toast.\n */\n public close(result?: R): void {\n this.toast?.close(result);\n }\n}\n","/*\n * Public API Surface of toastr\n */\n\nexport * from './lib/services/toastr.service';\nexport * from './lib/services/toastr-global-settings.service';\n\nexport * from './lib/components/toast-core';\nexport * from './lib/components/views/simple-toast/simple-toast';\n\nexport * from './lib/interfaces/itoast-config.interface';\nexport * from './lib/interfaces/itoast.interface';\nexport * from './lib/interfaces/isimple-toast.interface';\n\nexport * from './lib/types/toastr.types';\n\nexport * from './lib/tokens/toast-data.token';\n\nexport * from './lib/classes/toast-ref';\nexport * from './lib/classes/toast';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["SimpleToast","Toast"],"mappings":";;;;;;;;MAEa,QAAQ,CAAA;AACF,IAAA,kBAAkB,GAAG,IAAI,OAAO,EAAiB;AAClD,IAAA,YAAY,GAAG,IAAI,CAAC,kBAAkB,CAAC,YAAY,EAAE;AAE9D,IAAA,KAAK,CAAC,MAAU,EAAA;AACrB,QAAA,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC;AACpC,QAAA,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE;IACpC;AACD;;ACRD;MACa,UAAU,GAAG,IAAI,cAAc,CAAM,YAAY;;MCGjD,2BAA2B,CAAA;AACtB,IAAA,QAAQ,GAAG,MAAM,CAAgB,WAAW,oDAAC;AAC7C,IAAA,OAAO,GAAG,MAAM,CAAU,IAAI,mDAAC;AAC/B,IAAA,YAAY,GAAG,MAAM,CAAqB,SAAS,wDAAC;AACpD,IAAA,YAAY,GAAG,MAAM,CAAS,IAAI,wDAAC;AACnC,IAAA,cAAc,GAAG,MAAM,CAAU,IAAI,0DAAC;AACtC,IAAA,SAAS,GAAG,MAAM,CAAS,CAAC,qDAAC;AAE7C;;;AAGG;AACI,IAAA,MAAM,CACX,QAOE,EAAA;AAEF,QAAA,IAAI,QAAQ,CAAC,QAAQ,KAAK,SAAS;YAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC;AACzE,QAAA,IAAI,QAAQ,CAAC,OAAO,KAAK,SAAS;YAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC;AACtE,QAAA,IAAI,QAAQ,CAAC,YAAY,KAAK,SAAS;YAAE,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC;AACrF,QAAA,IAAI,QAAQ,CAAC,YAAY,KAAK,SAAS;YAA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AA,CAAA,OAAA,EAAA,QAAA,EAAA,WAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,SAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FAIX,WAAW,EAAA,UAAA,EAAA,CAAA;kBAPvB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,kBAAkB,EAAA,UAAA,EAChB,IAAI,EAAA,OAAA,EACP,CAAC,YAAY,CAAC,EAAA,QAAA,EAAA,ogBAAA,EAAA,MAAA,EAAA,CAAA,0oCAAA,CAAA,EAAA;;;MEFH,KAAK,CAAA;AACzB;;AAEG;AACI,IAAA,IAAI,GAAG,MAAM,CAAI,UAAU,CAAC;AAEnC;;AAEG;AACI,IAAA,KAAK;AAEZ;;AAEG;AACI,IAAA,WAAW,KAAU;AAE5B;;;AAGG;AACI,IAAA,KAAK,CAAC,MAAU,EAAA;AACrB,QAAA,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC;IAC3B;uGAtBoB,KAAK,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;2GAAL,KAAK,EAAA,CAAA;;2FAAL,KAAK,EAAA,UAAA,EAAA,CAAA;kBAD1B;;;ACLD;;AAEG;;ACFH;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import * as rxjs from 'rxjs';
|
|
2
2
|
import { ComponentType } from '@angular/cdk/portal';
|
|
3
|
+
import { IQueueSimpleToastRequest } from '@toastr/interfaces/iqueue-simple-toast-request.interface';
|
|
3
4
|
import * as _angular_core from '@angular/core';
|
|
4
5
|
import { OnInit, OnDestroy, ComponentRef, ViewContainerRef, ElementRef, InjectionToken } from '@angular/core';
|
|
6
|
+
import { Toast as Toast$1 } from '@toastr/classes/toast';
|
|
7
|
+
import { ISimpleToastData as ISimpleToastData$1 } from '@toastr/interfaces/isimple-toast.interface';
|
|
8
|
+
import { SimpleToastType as SimpleToastType$1 } from '@toastr/public-api';
|
|
5
9
|
|
|
6
10
|
type ToastPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'top-center' | 'bottom-center';
|
|
11
|
+
type SimpleToastType = 'info' | 'success' | 'warn' | 'error';
|
|
7
12
|
|
|
8
13
|
interface IToastConfig<D = unknown> {
|
|
9
14
|
data?: D;
|
|
10
15
|
position?: ToastPosition;
|
|
11
16
|
wrapperClass?: string;
|
|
17
|
+
hasDefaultBackground?: boolean;
|
|
12
18
|
durationInMs?: number;
|
|
13
19
|
swipeToDismiss?: boolean;
|
|
14
20
|
animate?: boolean;
|
|
15
|
-
maxOpened?: number;
|
|
16
21
|
}
|
|
17
22
|
|
|
18
23
|
declare class ToastRef<R = unknown> {
|
|
@@ -43,6 +48,30 @@ declare class ToastrService {
|
|
|
43
48
|
* @returns
|
|
44
49
|
*/
|
|
45
50
|
queueToast<D, R, C extends IToast<D, R>>(componentType: ComponentType<C>, config?: IToastConfig<D>): ToastRef<R>;
|
|
51
|
+
/**
|
|
52
|
+
* Queues a simple success toast notification with the specified message and optional title, position, and duration.
|
|
53
|
+
* @param request An object containing the message, optional title, optional position, and duration for the toast notification.
|
|
54
|
+
* @returns A ToastRef instance representing the queued toast.
|
|
55
|
+
*/
|
|
56
|
+
queueSuccess(request: IQueueSimpleToastRequest): ToastRef<undefined>;
|
|
57
|
+
/**
|
|
58
|
+
* Queues a simple info toast notification with the specified message and optional title, position, and duration.
|
|
59
|
+
* @param request An object containing the message, optional title, optional position, and duration for the toast notification.
|
|
60
|
+
* @returns A ToastRef instance representing the queued toast.
|
|
61
|
+
*/
|
|
62
|
+
queueInfo(request: IQueueSimpleToastRequest): ToastRef<undefined>;
|
|
63
|
+
/**
|
|
64
|
+
* Queues a simple warning toast notification with the specified message and optional title, position, and duration.
|
|
65
|
+
* @param request An object containing the message, optional title, optional position, and duration for the toast notification.
|
|
66
|
+
* @returns A ToastRef instance representing the queued toast.
|
|
67
|
+
*/
|
|
68
|
+
queueWarning(request: IQueueSimpleToastRequest): ToastRef<undefined>;
|
|
69
|
+
/**
|
|
70
|
+
* Queues a simple error toast notification with the specified message and optional title, position, and duration.
|
|
71
|
+
* @param request An object containing the message, optional title, optional position, and duration for the toast notification.
|
|
72
|
+
* @returns A ToastRef instance representing the queued toast.
|
|
73
|
+
*/
|
|
74
|
+
queueError(request: IQueueSimpleToastRequest): ToastRef<undefined>;
|
|
46
75
|
private processQueue;
|
|
47
76
|
private buildAndAttachToast;
|
|
48
77
|
private finalizeToast;
|
|
@@ -100,6 +129,18 @@ declare class ToastCore<D, R, C extends IToast<D, R> = IToast<D, R>> implements
|
|
|
100
129
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ToastCore<any, any, any>, "app-toast-core", never, {}, {}, never, never, true, never>;
|
|
101
130
|
}
|
|
102
131
|
|
|
132
|
+
declare class SimpleToast extends Toast$1<ISimpleToastData$1, undefined> {
|
|
133
|
+
protected dismiss(): void;
|
|
134
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SimpleToast, never>;
|
|
135
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SimpleToast, "app-simple-toast", never, {}, {}, never, never, true, never>;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
interface ISimpleToastData {
|
|
139
|
+
title?: string;
|
|
140
|
+
message: string;
|
|
141
|
+
type: SimpleToastType$1;
|
|
142
|
+
}
|
|
143
|
+
|
|
103
144
|
declare const TOAST_DATA: InjectionToken<any>;
|
|
104
145
|
|
|
105
146
|
declare abstract class Toast<D = unknown, R = unknown> implements IToast<D, R> {
|
|
@@ -124,5 +165,5 @@ declare abstract class Toast<D = unknown, R = unknown> implements IToast<D, R> {
|
|
|
124
165
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<Toast<any, any>>;
|
|
125
166
|
}
|
|
126
167
|
|
|
127
|
-
export { TOAST_DATA, Toast, ToastCore, ToastRef, ToastrGlobalSettingsService, ToastrService };
|
|
128
|
-
export type { IToast, IToastConfig, ToastPosition };
|
|
168
|
+
export { SimpleToast, TOAST_DATA, Toast, ToastCore, ToastRef, ToastrGlobalSettingsService, ToastrService };
|
|
169
|
+
export type { ISimpleToastData, IToast, IToastConfig, SimpleToastType, ToastPosition };
|