toastify-all 1.0.0
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/LICENSE +1 -0
- package/README.md +311 -0
- package/dist/angular/angular/index.d.ts +29 -0
- package/dist/angular/angular/public-api.d.ts +1 -0
- package/dist/angular/core/AlertService.d.ts +39 -0
- package/dist/angular/core/NotificationCore.d.ts +51 -0
- package/dist/angular/index.d.ts +30 -0
- package/dist/angular/index.esm.js +949 -0
- package/dist/angular/index.esm.js.map +1 -0
- package/dist/angular/index.js +957 -0
- package/dist/angular/index.js.map +1 -0
- package/dist/index.esm.js +824 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +831 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.js +837 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/react/index.d.ts +15 -0
- package/dist/react/index.esm.js +916 -0
- package/dist/react/index.esm.js.map +1 -0
- package/dist/react/index.js +925 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react-native/index.d.ts +17 -0
- package/dist/react-native/index.esm.js +146 -0
- package/dist/react-native/index.esm.js.map +1 -0
- package/dist/react-native/index.js +153 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/types/index.d.ts +95 -0
- package/dist/vue/index.d.ts +19 -0
- package/dist/vue/index.esm.js +845 -0
- package/dist/vue/index.esm.js.map +1 -0
- package/dist/vue/index.js +857 -0
- package/dist/vue/index.js.map +1 -0
- package/package.json +160 -0
package/LICENSE
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Copyright (c) 2026 Veeresh. All rights reserved.
|
package/README.md
ADDED
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
# Toastify-All 🔔
|
|
2
|
+
|
|
3
|
+
> **The universal, modern toast notification engine for all JavaScript frameworks and platforms.**
|
|
4
|
+
> One unified API across **React**, **Next.js**, **Vue 3**, **Angular**, **React Native**, **Svelte**, and **Vanilla HTML/JS**.
|
|
5
|
+
|
|
6
|
+
[](https://www.npmjs.com/package/toastify-all)
|
|
7
|
+
[](https://www.npmjs.com/package/toastify-all)
|
|
8
|
+
[](https://bundlephobia.com/package/toastify-all)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 🎮 Live Interactive Demo
|
|
13
|
+
|
|
14
|
+
Try Toastify-All in real-time in your browser:
|
|
15
|
+
👉 **[Open Live Interactive Playground](https://veereshmaps.github.io/toastify-all/)**
|
|
16
|
+
*(Customize positions, themes, transitions, test audio chimes, switch frameworks, and copy code snippets in 1 click)*
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 💡 Why Toastify-All? (In a world with so many toasters)
|
|
21
|
+
|
|
22
|
+
Most toast libraries lock you into a single framework: `react-toastify` only works in React, `vue-toastification` only works in Vue, and `ngx-toastr` only works in Angular. If you work in a monorepo, micro-frontends, or move between different projects, you have to learn, install, and style completely different toast libraries every time.
|
|
23
|
+
|
|
24
|
+
**Toastify-All eliminates framework lock-in forever.** You get the beauty of modern glassmorphism, the battle-tested power of React-Toastify, and first-class native adapters for every major framework in a single, lightweight package.
|
|
25
|
+
|
|
26
|
+
| Feature | **Toastify-All** 🔔 | `react-toastify` | `sonner` | `vue-toastification` | `ngx-toastr` |
|
|
27
|
+
| :--- | :---: | :---: | :---: | :---: | :---: |
|
|
28
|
+
| **Multi-Framework Support** | 🌟 **React, Vue, Angular, RN, Vanilla** | ❌ React only | ❌ React only | ❌ Vue only | ❌ Angular only |
|
|
29
|
+
| **Next.js App Router Ready** | ✅ **`'use client'` built-in** | ⚠️ Needs manual wrapper | ✅ Built-in | N/A | N/A |
|
|
30
|
+
| **Modern Glassmorphic Design** | ✅ **Blur + Subtle Borders** | ❌ Boxy 2018 design | ✅ Minimalist | ❌ Standard | ❌ Standard |
|
|
31
|
+
| **System Theme Auto-Sync** | ✅ **Auto OS dark/light sync** | ❌ | ❌ | ❌ | ❌ |
|
|
32
|
+
| **Promise Toast (`toast.promise`)** | ✅ **Built-in** | ✅ Built-in | ✅ Built-in | ⚠️ Plugin | ❌ |
|
|
33
|
+
| **Zero-Asset Audio Chimes** | ✅ **Built-in (Web Audio API)** | ❌ | ❌ | ❌ | ❌ |
|
|
34
|
+
| **Direct CDN `<script>` tag** | ✅ **jsDelivr / unpkg** | ❌ | ❌ | ❌ | ❌ |
|
|
35
|
+
| **Swipe & Drag Dismiss** | ✅ **Desktop & Touch** | ✅ | ✅ | ✅ | ❌ |
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 📦 Installation
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install toastify-all
|
|
43
|
+
# or
|
|
44
|
+
yarn add toastify-all
|
|
45
|
+
# or
|
|
46
|
+
pnpm add toastify-all
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 🚀 Quick Start by Platform
|
|
52
|
+
|
|
53
|
+
### 1. React & Next.js (App Router & Pages Router)
|
|
54
|
+
|
|
55
|
+
Place `<ToastContainer />` at the root of your application, then trigger `toast` from anywhere:
|
|
56
|
+
|
|
57
|
+
```jsx
|
|
58
|
+
import React from 'react';
|
|
59
|
+
import { ToastContainer, toast } from 'toastify-all/react';
|
|
60
|
+
|
|
61
|
+
export default function App() {
|
|
62
|
+
const notify = () => {
|
|
63
|
+
// Basic toast
|
|
64
|
+
toast("Welcome to Toastify-All!");
|
|
65
|
+
|
|
66
|
+
// Beautiful variants with colored or system theme
|
|
67
|
+
toast.success("Profile saved successfully!", { theme: "colored" });
|
|
68
|
+
toast.error("Failed to connect to server!");
|
|
69
|
+
toast.warning("Your session is about to expire.");
|
|
70
|
+
toast.info("A new update is available.");
|
|
71
|
+
|
|
72
|
+
// Dynamic Promise Toast (Loading -> Success / Error)
|
|
73
|
+
const uploadFile = () => new Promise((resolve) => setTimeout(resolve, 2000));
|
|
74
|
+
toast.promise(uploadFile(), {
|
|
75
|
+
pending: "Uploading asset...",
|
|
76
|
+
success: "Upload completed! 🚀",
|
|
77
|
+
error: "Upload failed! ❌"
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<div>
|
|
83
|
+
<button onClick={notify}>Show Notifications</button>
|
|
84
|
+
<ToastContainer
|
|
85
|
+
position="top-right"
|
|
86
|
+
autoClose={4000}
|
|
87
|
+
theme="system"
|
|
88
|
+
transition="bounce"
|
|
89
|
+
/>
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
### 2. Vue 3 & Nuxt
|
|
98
|
+
|
|
99
|
+
In `main.js` / `main.ts`:
|
|
100
|
+
|
|
101
|
+
```javascript
|
|
102
|
+
import { createApp } from 'vue';
|
|
103
|
+
import { ToastifyAllPlugin } from 'toastify-all/vue';
|
|
104
|
+
import App from './App.vue';
|
|
105
|
+
|
|
106
|
+
const app = createApp(App);
|
|
107
|
+
app.use(ToastifyAllPlugin, {
|
|
108
|
+
position: 'top-right',
|
|
109
|
+
theme: 'system'
|
|
110
|
+
});
|
|
111
|
+
app.mount('#app');
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
In any Vue component:
|
|
115
|
+
|
|
116
|
+
```vue
|
|
117
|
+
<template>
|
|
118
|
+
<button @click="showToast">Notify</button>
|
|
119
|
+
</template>
|
|
120
|
+
|
|
121
|
+
<script setup>
|
|
122
|
+
import { useToast } from 'toastify-all/vue';
|
|
123
|
+
|
|
124
|
+
const toast = useToast();
|
|
125
|
+
|
|
126
|
+
const showToast = () => {
|
|
127
|
+
toast.success('Toastify-All works seamlessly in Vue 3!');
|
|
128
|
+
};
|
|
129
|
+
</script>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
### 3. Angular
|
|
135
|
+
|
|
136
|
+
#### Standalone Setup (Angular 14+ / 15+ / 16+ / 17+)
|
|
137
|
+
In `main.ts` or `app.config.ts`:
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
import { bootstrapApplication } from '@angular/platform-browser';
|
|
141
|
+
import { provideNotifications } from 'toastify-all/angular';
|
|
142
|
+
import { AppComponent } from './app/app.component';
|
|
143
|
+
|
|
144
|
+
bootstrapApplication(AppComponent, {
|
|
145
|
+
providers: [
|
|
146
|
+
provideNotifications({
|
|
147
|
+
position: 'top-right',
|
|
148
|
+
theme: 'system'
|
|
149
|
+
})
|
|
150
|
+
]
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
#### In your Component:
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
import { Component } from '@angular/core';
|
|
158
|
+
import { NotificationService } from 'toastify-all/angular';
|
|
159
|
+
|
|
160
|
+
@Component({
|
|
161
|
+
selector: 'app-root',
|
|
162
|
+
template: `<button (click)="notify()">Trigger</button>`
|
|
163
|
+
})
|
|
164
|
+
export class AppComponent {
|
|
165
|
+
constructor(private toast: NotificationService) {}
|
|
166
|
+
|
|
167
|
+
notify() {
|
|
168
|
+
this.toast.success('Toastify-All running in Angular!');
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
### 4. React Native
|
|
176
|
+
|
|
177
|
+
Native alerts on iOS and native toasts on Android without browser DOM crashes:
|
|
178
|
+
|
|
179
|
+
```jsx
|
|
180
|
+
import React from 'react';
|
|
181
|
+
import { View, Button } from 'react-native';
|
|
182
|
+
import { toast, ToastContainer } from 'toastify-all/react-native';
|
|
183
|
+
|
|
184
|
+
export default function App() {
|
|
185
|
+
return (
|
|
186
|
+
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
|
|
187
|
+
<Button
|
|
188
|
+
title="Show Toast"
|
|
189
|
+
onPress={() => toast.success('Mobile notification works!')}
|
|
190
|
+
/>
|
|
191
|
+
<ToastContainer />
|
|
192
|
+
</View>
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
### 5. Vanilla JavaScript (No Framework)
|
|
200
|
+
|
|
201
|
+
```javascript
|
|
202
|
+
import toast from 'toastify-all';
|
|
203
|
+
|
|
204
|
+
toast.configure({
|
|
205
|
+
position: 'top-center',
|
|
206
|
+
theme: 'colored'
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
toast.success('Vanilla JS toast!');
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
### 6. Direct CDN Browser `<script>` Tag
|
|
215
|
+
|
|
216
|
+
```html
|
|
217
|
+
<!DOCTYPE html>
|
|
218
|
+
<html>
|
|
219
|
+
<head>
|
|
220
|
+
<title>Toastify-All CDN Demo</title>
|
|
221
|
+
<!-- Load Toastify-All via jsDelivr -->
|
|
222
|
+
<script src="https://cdn.jsdelivr.net/npm/toastify-all/dist/index.umd.js"></script>
|
|
223
|
+
</head>
|
|
224
|
+
<body>
|
|
225
|
+
<button onclick="ToastifyAll.toast.success('Hello from CDN!')">Click Me</button>
|
|
226
|
+
</body>
|
|
227
|
+
</html>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## 🛠️ Complete API Reference
|
|
233
|
+
|
|
234
|
+
### Calling `toast`
|
|
235
|
+
|
|
236
|
+
| Method | Description |
|
|
237
|
+
| :--- | :--- |
|
|
238
|
+
| `toast(message, [options])` | Show a default toast |
|
|
239
|
+
| `toast.success(message, [options])` | Show a success toast (green) |
|
|
240
|
+
| `toast.error(message, [options])` | Show an error toast (red) |
|
|
241
|
+
| `toast.info(message, [options])` | Show an info toast (blue) |
|
|
242
|
+
| `toast.warning(message, [options])` / `toast.warn(...)` | Show a warning toast (amber) |
|
|
243
|
+
| `toast.loading(message, [options])` | Show a persistent loading spinner toast |
|
|
244
|
+
| `toast.promise(promise, states, [options])` | Automatically handles pending, success, and error states |
|
|
245
|
+
| `toast.update(id, newState)` | Update an active toast's content or state |
|
|
246
|
+
| `toast.dismiss([id])` | Dismiss a specific toast by ID, or all toasts if no ID is passed |
|
|
247
|
+
| `toast.isActive(id)` | Check if a toast is currently active on screen |
|
|
248
|
+
| `toast.clearWaitingQueue()` | Dismiss all toasts exceeding the queue limit |
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
### Configuration Options
|
|
253
|
+
|
|
254
|
+
Options can be set globally via `toast.configure(options)` or per-toast:
|
|
255
|
+
|
|
256
|
+
```javascript
|
|
257
|
+
toast.success("File uploaded", {
|
|
258
|
+
title: "Upload Completed",
|
|
259
|
+
position: "bottom-right",
|
|
260
|
+
autoClose: 4000,
|
|
261
|
+
theme: "system", // "light" | "dark" | "colored" | "system"
|
|
262
|
+
transition: "slide", // "bounce" | "slide" | "zoom" | "flip"
|
|
263
|
+
sound: true, // Subtle harmonic Web Audio chime
|
|
264
|
+
hideProgressBar: false,
|
|
265
|
+
closeOnClick: true,
|
|
266
|
+
pauseOnHover: true,
|
|
267
|
+
pauseOnFocusLoss: true,
|
|
268
|
+
draggable: true,
|
|
269
|
+
draggablePercent: 80,
|
|
270
|
+
action: {
|
|
271
|
+
label: "Undo",
|
|
272
|
+
onClick: (id) => console.log("Undo clicked for toast", id)
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## 🌐 CDN Quick Start (No Bundler / Plain HTML)
|
|
280
|
+
|
|
281
|
+
If you are not using npm or a frontend framework, you can use Toastify-All directly from a global CDN without any build step:
|
|
282
|
+
|
|
283
|
+
```html
|
|
284
|
+
<!-- Include Toastify-All via jsDelivr -->
|
|
285
|
+
<script src="https://cdn.jsdelivr.net/npm/toastify-all/dist/index.umd.js"></script>
|
|
286
|
+
|
|
287
|
+
<script>
|
|
288
|
+
// Trigger notifications anytime
|
|
289
|
+
ToastifyAll.toast.success("Welcome to Toastify-All!");
|
|
290
|
+
</script>
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## 🤝 Contributing
|
|
296
|
+
|
|
297
|
+
Contributions, issues, and feature requests are welcome!
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
# 1. Clone the repository
|
|
301
|
+
git clone https://github.com/VeereshMaps/toastify-all.git
|
|
302
|
+
|
|
303
|
+
# 2. Install dependencies
|
|
304
|
+
npm install
|
|
305
|
+
|
|
306
|
+
# 3. Run test suite
|
|
307
|
+
npm test
|
|
308
|
+
|
|
309
|
+
# 4. Build bundles
|
|
310
|
+
npm run build
|
|
311
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { alertService } from '../core/AlertService.js';
|
|
2
|
+
import type { NotificationOptions, NotificationUpdateState, PromiseToastOptions } from '../types/index';
|
|
3
|
+
export declare const NOTIFICATION_CONFIG = "NOTIFICATION_CONFIG";
|
|
4
|
+
export declare class NotificationService {
|
|
5
|
+
private config?;
|
|
6
|
+
private service;
|
|
7
|
+
constructor(config?: NotificationOptions);
|
|
8
|
+
configure(options: NotificationOptions): void;
|
|
9
|
+
success(message: string, options?: NotificationOptions): any;
|
|
10
|
+
error(message: string, options?: NotificationOptions): any;
|
|
11
|
+
info(message: string, options?: NotificationOptions): any;
|
|
12
|
+
warn(message: string, options?: NotificationOptions): any;
|
|
13
|
+
warning(message: string, options?: NotificationOptions): any;
|
|
14
|
+
loading(message: string, options?: NotificationOptions): any;
|
|
15
|
+
custom(content: string, options?: NotificationOptions): any;
|
|
16
|
+
promise<T>(promiseOrFn: Promise<T> | (() => Promise<T>), states?: PromiseToastOptions<T>, options?: NotificationOptions): any;
|
|
17
|
+
update(id: number, newState: NotificationUpdateState): void;
|
|
18
|
+
dismiss(id: number): void;
|
|
19
|
+
clearAll(): void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Standalone provider helper for Angular 14+ / 15+ / 16+ / 17+
|
|
23
|
+
*/
|
|
24
|
+
export declare function provideNotifications(config?: NotificationOptions): (typeof NotificationService | {
|
|
25
|
+
provide: string;
|
|
26
|
+
useValue: NotificationOptions;
|
|
27
|
+
})[];
|
|
28
|
+
export { alertService, alertService as toast };
|
|
29
|
+
export default NotificationService;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './index';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export default toast;
|
|
2
|
+
export class AlertService {
|
|
3
|
+
core: NotificationCore;
|
|
4
|
+
configure(options: any): void;
|
|
5
|
+
show(type: any, message: any, options: any): any;
|
|
6
|
+
success(message: any, options: any): any;
|
|
7
|
+
error(message: any, options: any): any;
|
|
8
|
+
info(message: any, options: any): any;
|
|
9
|
+
warn(message: any, options: any): any;
|
|
10
|
+
warning(message: any, options: any): any;
|
|
11
|
+
loading(message: any, options: any): any;
|
|
12
|
+
custom(content: any, options: any): any;
|
|
13
|
+
promise(promiseOrFn: any, states: any, options: any): any;
|
|
14
|
+
update(id: any, newState: any): void;
|
|
15
|
+
dismiss(id: any): void;
|
|
16
|
+
isActive(id: any): boolean;
|
|
17
|
+
clearWaitingQueue(): void;
|
|
18
|
+
clearAll(): void;
|
|
19
|
+
}
|
|
20
|
+
export const alertService: AlertService;
|
|
21
|
+
export function toast(content: any, options?: {}): any;
|
|
22
|
+
export namespace toast {
|
|
23
|
+
function configure(options: any): any;
|
|
24
|
+
function success(content: any, options: any): any;
|
|
25
|
+
function error(content: any, options: any): any;
|
|
26
|
+
function info(content: any, options: any): any;
|
|
27
|
+
function warning(content: any, options: any): any;
|
|
28
|
+
function warn(content: any, options: any): any;
|
|
29
|
+
function loading(content: any, options: any): any;
|
|
30
|
+
function custom(content: any, options: any): any;
|
|
31
|
+
function promise(promiseOrFn: any, states: any, options: any): any;
|
|
32
|
+
function update(id: any, newState: any): any;
|
|
33
|
+
function dismiss(id: any): any;
|
|
34
|
+
function isActive(id: any): any;
|
|
35
|
+
function clearWaitingQueue(): any;
|
|
36
|
+
function clearAll(): any;
|
|
37
|
+
let core: any;
|
|
38
|
+
}
|
|
39
|
+
import NotificationCore from './NotificationCore.js';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export default NotificationCore;
|
|
2
|
+
declare class NotificationCore {
|
|
3
|
+
notifications: Map<any, any>;
|
|
4
|
+
counter: number;
|
|
5
|
+
config: {
|
|
6
|
+
position: string;
|
|
7
|
+
autoClose: number;
|
|
8
|
+
hideProgressBar: boolean;
|
|
9
|
+
closeOnClick: boolean;
|
|
10
|
+
pauseOnHover: boolean;
|
|
11
|
+
pauseOnFocusLoss: boolean;
|
|
12
|
+
draggable: boolean;
|
|
13
|
+
draggablePercent: number;
|
|
14
|
+
theme: string;
|
|
15
|
+
transition: string;
|
|
16
|
+
limit: any;
|
|
17
|
+
newestOnTop: boolean;
|
|
18
|
+
closeButton: boolean;
|
|
19
|
+
sound: boolean;
|
|
20
|
+
};
|
|
21
|
+
containers: Map<any, any>;
|
|
22
|
+
initialized: boolean;
|
|
23
|
+
isWindowFocused: boolean;
|
|
24
|
+
getEffectiveTheme(theme?: string): string;
|
|
25
|
+
refreshSystemTheme(): void;
|
|
26
|
+
configure(options?: {}): void;
|
|
27
|
+
init(): void;
|
|
28
|
+
getContainer(position?: string): any;
|
|
29
|
+
playChime(type: any): void;
|
|
30
|
+
injectStyles(): void;
|
|
31
|
+
getDefaultIcon(type: any): "<svg viewBox=\"0 0 20 20\" fill=\"#10b981\"><path fill-rule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z\" clip-rule=\"evenodd\"/></svg>" | "<svg viewBox=\"0 0 20 20\" fill=\"#ef4444\"><path fill-rule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z\" clip-rule=\"evenodd\"/></svg>" | "<svg viewBox=\"0 0 20 20\" fill=\"#f59e0b\"><path fill-rule=\"evenodd\" d=\"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z\" clip-rule=\"evenodd\"/></svg>" | "<svg viewBox=\"0 0 20 20\" fill=\"#3b82f6\"><path fill-rule=\"evenodd\" d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z\" clip-rule=\"evenodd\"/></svg>" | "<div class=\"Toastify__spinner\"></div>" | "";
|
|
32
|
+
getAnimationNames(transition: any, position: any): {
|
|
33
|
+
enter: string;
|
|
34
|
+
exit: string;
|
|
35
|
+
};
|
|
36
|
+
show(type: string, message: any, options?: {}): any;
|
|
37
|
+
createToast(id: any, type: any, message: any, config: any, position: any): HTMLDivElement;
|
|
38
|
+
setupAutoClose(entry: any): void;
|
|
39
|
+
setupHoverPause(toast: any, id: any): void;
|
|
40
|
+
pauseToast(id: any): void;
|
|
41
|
+
resumeToast(id: any): void;
|
|
42
|
+
pauseAll(): void;
|
|
43
|
+
resumeAll(): void;
|
|
44
|
+
makeDraggable(toast: any, id: any, config: any): void;
|
|
45
|
+
update(id: any, newState?: {}): void;
|
|
46
|
+
dismiss(id: any): void;
|
|
47
|
+
isActive(id: any): boolean;
|
|
48
|
+
clearWaitingQueue(): void;
|
|
49
|
+
clearAll(): void;
|
|
50
|
+
promise(promiseOrFn: any, states?: {}, options?: {}): any;
|
|
51
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { NotificationOptions, NotificationUpdateState, PromiseToastOptions, AlertService } from '../types/index';
|
|
2
|
+
|
|
3
|
+
export declare const NOTIFICATION_CONFIG = 'NOTIFICATION_CONFIG';
|
|
4
|
+
|
|
5
|
+
export declare class NotificationService {
|
|
6
|
+
private service: AlertService;
|
|
7
|
+
private config?: NotificationOptions;
|
|
8
|
+
constructor(config?: NotificationOptions);
|
|
9
|
+
configure(options: NotificationOptions): void;
|
|
10
|
+
success(message: string, options?: NotificationOptions): number;
|
|
11
|
+
error(message: string, options?: NotificationOptions): number;
|
|
12
|
+
info(message: string, options?: NotificationOptions): number;
|
|
13
|
+
warn(message: string, options?: NotificationOptions): number;
|
|
14
|
+
warning(message: string, options?: NotificationOptions): number;
|
|
15
|
+
loading(message: string, options?: NotificationOptions): number;
|
|
16
|
+
custom(content: string, options?: NotificationOptions): number;
|
|
17
|
+
promise<T>(
|
|
18
|
+
promiseOrFn: Promise<T> | (() => Promise<T>),
|
|
19
|
+
states?: PromiseToastOptions<T>,
|
|
20
|
+
options?: NotificationOptions
|
|
21
|
+
): Promise<T>;
|
|
22
|
+
update(id: number, newState: NotificationUpdateState): void;
|
|
23
|
+
dismiss(id: number): void;
|
|
24
|
+
clearAll(): void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export declare function provideNotifications(config?: NotificationOptions): any[];
|
|
28
|
+
export declare const toast: AlertService;
|
|
29
|
+
export declare const alertService: AlertService;
|
|
30
|
+
export default NotificationService;
|