@editora/toast 2.0.0 โ 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +126 -0
- package/README.md +28 -26
- package/dist/core/ToastManager.d.ts +2 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +12 -8
- package/dist/index.esm.js +132 -106
- package/dist/index.umd.js +1 -1
- package/package.json +14 -4
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.esm.js.map +0 -1
- package/dist/index.umd.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## 2.0.0 (2026-02-14)
|
|
7
|
+
|
|
8
|
+
### ๐ Major Upgrade: Advanced Notification System
|
|
9
|
+
|
|
10
|
+
**Breaking Changes:** None - Full backward compatibility maintained
|
|
11
|
+
|
|
12
|
+
#### โจ New Features
|
|
13
|
+
|
|
14
|
+
- **Promise Lifecycle Toasts**: Automatic state transitions for async operations
|
|
15
|
+
```typescript
|
|
16
|
+
toast.promise(uploadFile(), {
|
|
17
|
+
loading: 'Uploading...',
|
|
18
|
+
success: 'Uploaded!',
|
|
19
|
+
error: 'Failed'
|
|
20
|
+
});
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- **Rich Content Support**: HTML, icons, actions, and progress bars
|
|
24
|
+
```typescript
|
|
25
|
+
toast.show({
|
|
26
|
+
message: 'File uploaded',
|
|
27
|
+
icon: 'โ',
|
|
28
|
+
actions: [{ label: 'View', onClick: () => {} }],
|
|
29
|
+
progress: { value: 75 }
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
- **Toast Updates**: Modify existing toasts dynamically
|
|
34
|
+
```typescript
|
|
35
|
+
const toast = toast.loading('Saving...');
|
|
36
|
+
toast.update(toast.id, { message: 'Saved!', level: 'success' });
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- **Multiple Positions**: Support for all screen corners and center
|
|
40
|
+
- **Queue Management**: Priority-based queuing with overflow strategies
|
|
41
|
+
- **Theming System**: Light, dark, and custom themes with CSS variables
|
|
42
|
+
- **Plugin Architecture**: Extensible with custom plugins
|
|
43
|
+
- **Toast Grouping**: Related notifications can be grouped together
|
|
44
|
+
- **Spring Physics Animations**: Realistic spring-based animations with customizable physics
|
|
45
|
+
- **Custom Animation Hooks**: User-defined animation functions for complete control
|
|
46
|
+
- **Animation Manager**: Centralized animation system supporting CSS, spring, and custom animations
|
|
47
|
+
- **Accessibility**: WCAG AA compliant with screen reader support
|
|
48
|
+
- **Mobile Gestures**: Swipe and drag to dismiss
|
|
49
|
+
- **Editor Integration**: Built-in hooks for rich text editors
|
|
50
|
+
|
|
51
|
+
#### ๐๏ธ Architecture Changes
|
|
52
|
+
|
|
53
|
+
- **New Core Components**:
|
|
54
|
+
- `ToastManager`: Central orchestrator
|
|
55
|
+
- `ToastStore`: State management
|
|
56
|
+
- `ToastQueue`: Queue and priority management
|
|
57
|
+
- `ToastRenderer`: DOM rendering and animations
|
|
58
|
+
- `ToastLifecycle`: Event hooks and plugins
|
|
59
|
+
|
|
60
|
+
- **Performance Improvements**:
|
|
61
|
+
- O(1) insertion with optimized queue management
|
|
62
|
+
- Batched DOM updates
|
|
63
|
+
- Memory leak prevention
|
|
64
|
+
- Virtualized rendering for large queues
|
|
65
|
+
|
|
66
|
+
- **SSR Safety**: Server-side rendering compatible
|
|
67
|
+
- **Security**: HTML sanitization and XSS protection
|
|
68
|
+
|
|
69
|
+
#### ๐จ UI/UX Enhancements
|
|
70
|
+
|
|
71
|
+
- Modern minimal design with consistent spacing
|
|
72
|
+
- Non-blocking interaction patterns
|
|
73
|
+
- Stacking system for grouped toasts
|
|
74
|
+
- Z-index management
|
|
75
|
+
- Responsive layout for mobile devices
|
|
76
|
+
- Focus management and keyboard navigation
|
|
77
|
+
|
|
78
|
+
#### ๐ฆ API Additions
|
|
79
|
+
|
|
80
|
+
- `toastAdvanced.show()` - Full-featured toast creation
|
|
81
|
+
- `toastAdvanced.update()` - Update existing toasts
|
|
82
|
+
- `toastAdvanced.promise()` - Promise lifecycle toasts
|
|
83
|
+
- `toastAdvanced.group()` - Group related toasts
|
|
84
|
+
- `toastAdvanced.configure()` - Global configuration
|
|
85
|
+
- `toastAdvanced.use()` - Install plugins
|
|
86
|
+
- `toastAdvanced.onEditorEvent()` - Editor integration hooks
|
|
87
|
+
|
|
88
|
+
#### ๐ง Configuration Options
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
toast.configure({
|
|
92
|
+
position: 'top-right',
|
|
93
|
+
duration: 5000,
|
|
94
|
+
maxVisible: 5,
|
|
95
|
+
theme: 'dark',
|
|
96
|
+
pauseOnHover: true,
|
|
97
|
+
enableAccessibility: true,
|
|
98
|
+
swipeDismiss: true,
|
|
99
|
+
dragDismiss: false
|
|
100
|
+
});
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
#### ๐ Documentation
|
|
104
|
+
|
|
105
|
+
- Comprehensive README with examples
|
|
106
|
+
- Migration guide for v1.x โ v2.x
|
|
107
|
+
- Interactive demo with all features
|
|
108
|
+
- TypeScript definitions for all APIs
|
|
109
|
+
|
|
110
|
+
#### ๐งช Quality Assurance
|
|
111
|
+
|
|
112
|
+
- Full backward compatibility maintained
|
|
113
|
+
- Extensive TypeScript typing
|
|
114
|
+
- Accessibility compliance (WCAG AA)
|
|
115
|
+
- Cross-browser testing
|
|
116
|
+
- Mobile device support
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## 1.0.2 (2026-02-13)
|
|
121
|
+
|
|
122
|
+
**Note:** Version bump only for package @editora/toast
|
|
123
|
+
|
|
124
|
+
## 1.0.1 (2026-02-12)
|
|
125
|
+
|
|
126
|
+
**Note:** Version bump only for package @editora/toast
|
package/README.md
CHANGED
|
@@ -109,11 +109,11 @@ You can also use Editora Toast directly from a CDN without installing it via npm
|
|
|
109
109
|
<script src="https://cdn.jsdelivr.net/npm/@editora/toast@latest/dist/index.umd.js"></script>
|
|
110
110
|
|
|
111
111
|
<script>
|
|
112
|
-
// Now you can use the toast functions
|
|
113
|
-
toast.success('Hello from CDN!');
|
|
114
|
-
toast.error('Something went wrong!', 1000);
|
|
115
|
-
toast.info('This is an info message');
|
|
116
|
-
toast.warning('This is a warning');
|
|
112
|
+
// Now you can use the toast functions (legacy API supports an optional options object)
|
|
113
|
+
toast.success('Hello from CDN!', { theme: 'light', position: 'top-right' });
|
|
114
|
+
toast.error('Something went wrong!', { duration: 1000 });
|
|
115
|
+
toast.info('This is an info message', { theme: 'light', position: 'top-right' });
|
|
116
|
+
toast.warning('This is a warning', { theme: 'light', position: 'top-right' });
|
|
117
117
|
|
|
118
118
|
// Advanced usage (toastAdvanced, toastPro)
|
|
119
119
|
// global window.toastPro.show()
|
|
@@ -154,19 +154,20 @@ You can also use Editora Toast directly from a CDN without installing it via npm
|
|
|
154
154
|
|
|
155
155
|
```typescript
|
|
156
156
|
import { toast } from '@editora/toast';
|
|
157
|
+
import "@editora/toast/toast.css";
|
|
157
158
|
|
|
158
|
-
// Simple notifications
|
|
159
|
-
toast.success('File saved successfully!');
|
|
160
|
-
toast.error('Failed to save file');
|
|
161
|
-
toast.info('Info message');
|
|
162
|
-
toast.warning('Warning message');
|
|
159
|
+
// Simple notifications (migrated to optional advanced options)
|
|
160
|
+
toast.success('File saved successfully!', { theme: 'light', position: 'top-right' });
|
|
161
|
+
toast.error('Failed to save file', { theme: 'light', position: 'top-right' });
|
|
162
|
+
toast.info('Info message', { theme: 'light', position: 'top-right' });
|
|
163
|
+
toast.warning('Warning message', { theme: 'light', position: 'top-right' });
|
|
163
164
|
```
|
|
164
165
|
|
|
165
166
|
### Advanced Usage (v2.0.0 Features)
|
|
166
167
|
|
|
167
168
|
```typescript
|
|
168
169
|
import { toastAdvanced as toast } from '@editora/toast';
|
|
169
|
-
|
|
170
|
+
import "@editora/toast/toast.css";
|
|
170
171
|
// Rich notifications with actions and progress
|
|
171
172
|
const notification = toast.show({
|
|
172
173
|
message: 'Document uploaded successfully!',
|
|
@@ -218,7 +219,7 @@ toast.group('file-operations', {
|
|
|
218
219
|
|
|
219
220
|
```typescript
|
|
220
221
|
import { toastAdvanced as toast } from '@editora/toast';
|
|
221
|
-
|
|
222
|
+
import "@editora/toast/toast.css";
|
|
222
223
|
// Global configuration with all available options
|
|
223
224
|
toast.configure({
|
|
224
225
|
// Positioning
|
|
@@ -290,7 +291,7 @@ Editora Toast comes with 13 beautiful themes:
|
|
|
290
291
|
|
|
291
292
|
```typescript
|
|
292
293
|
import { toastAdvanced as toast } from '@editora/toast';
|
|
293
|
-
|
|
294
|
+
import "@editora/toast/toast.css";
|
|
294
295
|
// Set global theme
|
|
295
296
|
toast.configure({
|
|
296
297
|
theme: 'glass' // or 'neon', 'retro', 'ocean', etc.
|
|
@@ -374,7 +375,7 @@ Add interactive buttons to your toasts:
|
|
|
374
375
|
|
|
375
376
|
```typescript
|
|
376
377
|
import { toastAdvanced as toast } from '@editora/toast';
|
|
377
|
-
|
|
378
|
+
import "@editora/toast/toast.css";
|
|
378
379
|
const notification = toast.show({
|
|
379
380
|
message: 'Document saved successfully!',
|
|
380
381
|
level: 'success',
|
|
@@ -407,7 +408,7 @@ Built-in progress bars with customizable display:
|
|
|
407
408
|
|
|
408
409
|
```typescript
|
|
409
410
|
import { toastAdvanced as toast } from '@editora/toast';
|
|
410
|
-
|
|
411
|
+
import "@editora/toast/toast.css";
|
|
411
412
|
// Determinate progress
|
|
412
413
|
const progressToast = toast.show({
|
|
413
414
|
message: 'Processing files...',
|
|
@@ -446,7 +447,7 @@ Modify existing toasts dynamically:
|
|
|
446
447
|
|
|
447
448
|
```typescript
|
|
448
449
|
import { toastAdvanced as toast } from '@editora/toast';
|
|
449
|
-
|
|
450
|
+
import "@editora/toast/toast.css";
|
|
450
451
|
// Create a loading toast
|
|
451
452
|
const loadingToast = toast.loading('Connecting to server...');
|
|
452
453
|
|
|
@@ -477,7 +478,7 @@ Group related notifications together:
|
|
|
477
478
|
|
|
478
479
|
```typescript
|
|
479
480
|
import { toastAdvanced as toast } from '@editora/toast';
|
|
480
|
-
|
|
481
|
+
import "@editora/toast/toast.css";
|
|
481
482
|
// Group file operations
|
|
482
483
|
const files = ['document.pdf', 'image.jpg', 'data.json'];
|
|
483
484
|
|
|
@@ -513,7 +514,7 @@ Create interactive forms within toasts:
|
|
|
513
514
|
|
|
514
515
|
```typescript
|
|
515
516
|
import { toastAdvanced as toast } from '@editora/toast';
|
|
516
|
-
|
|
517
|
+
import "@editora/toast/toast.css";
|
|
517
518
|
toast.show({
|
|
518
519
|
message: 'How was your experience?',
|
|
519
520
|
level: 'info',
|
|
@@ -548,7 +549,7 @@ toast.show({
|
|
|
548
549
|
|
|
549
550
|
```typescript
|
|
550
551
|
import { toastAdvanced as toast } from '@editora/toast';
|
|
551
|
-
|
|
552
|
+
import "@editora/toast/toast.css";
|
|
552
553
|
const myPlugin = {
|
|
553
554
|
name: 'my-plugin',
|
|
554
555
|
install(manager) {
|
|
@@ -577,7 +578,7 @@ toast.show({
|
|
|
577
578
|
|
|
578
579
|
```typescript
|
|
579
580
|
import { toastAdvanced as toast } from '@editora/toast';
|
|
580
|
-
|
|
581
|
+
import "@editora/toast/toast.css";
|
|
581
582
|
// Spring animation with custom physics
|
|
582
583
|
toast.show({
|
|
583
584
|
message: 'Spring animated toast!',
|
|
@@ -598,7 +599,7 @@ toast.show({
|
|
|
598
599
|
|
|
599
600
|
```typescript
|
|
600
601
|
import { toastAdvanced as toast } from '@editora/toast';
|
|
601
|
-
|
|
602
|
+
import "@editora/toast/toast.css";
|
|
602
603
|
// Custom animation functions
|
|
603
604
|
toast.show({
|
|
604
605
|
message: 'Custom animated toast!',
|
|
@@ -642,7 +643,7 @@ toast.show({
|
|
|
642
643
|
|
|
643
644
|
```typescript
|
|
644
645
|
import { toastAdvanced as toast } from '@editora/toast';
|
|
645
|
-
|
|
646
|
+
import "@editora/toast/toast.css";
|
|
646
647
|
// Set default animation for all toasts
|
|
647
648
|
toast.configure({
|
|
648
649
|
animation: {
|
|
@@ -683,10 +684,10 @@ toast.show({
|
|
|
683
684
|
|
|
684
685
|
```typescript
|
|
685
686
|
import { toastAdvanced as toast } from '@editora/toast';
|
|
686
|
-
|
|
687
|
+
import "@editora/toast/toast.css";
|
|
687
688
|
// Listen for editor events
|
|
688
689
|
toast.onEditorEvent('spellcheck-error', (error) => {
|
|
689
|
-
toast.error(`Spelling error: ${error.word}
|
|
690
|
+
toast.error(`Spelling error: ${error.word}`, { theme: 'light', position: 'top-right' });
|
|
690
691
|
});
|
|
691
692
|
|
|
692
693
|
// Trigger editor events
|
|
@@ -855,11 +856,12 @@ The v2.0.0 release introduces powerful new features while maintaining **full bac
|
|
|
855
856
|
```typescript
|
|
856
857
|
// v1.x (still works)
|
|
857
858
|
import { toast } from '@editora/toast';
|
|
858
|
-
toast.
|
|
859
|
+
import "@editora/toast/toast.css";
|
|
860
|
+
toast.success('Hello World', { theme: 'light', position: 'top-right' });
|
|
859
861
|
|
|
860
862
|
// v2.0.0 advanced features
|
|
861
863
|
import { toastAdvanced as toast } from '@editora/toast';
|
|
862
|
-
|
|
864
|
+
import "@editora/toast/toast.css";
|
|
863
865
|
// Promise lifecycle toasts
|
|
864
866
|
toast.promise(fetchData(), {
|
|
865
867
|
loading: 'Loading...',
|
|
@@ -9,6 +9,7 @@ export declare class ToastManager implements IToastManager {
|
|
|
9
9
|
private pausedToasts;
|
|
10
10
|
private windowFocusHandler?;
|
|
11
11
|
private windowBlurHandler?;
|
|
12
|
+
private visibilityChangeHandler?;
|
|
12
13
|
constructor(config?: Partial<ToastConfig>);
|
|
13
14
|
show(options: ToastOptions): ToastInstance;
|
|
14
15
|
update(id: string, options: Partial<ToastOptions>): boolean;
|
|
@@ -30,6 +31,7 @@ export declare class ToastManager implements IToastManager {
|
|
|
30
31
|
onEditorEvent(event: string, callback: (toast: ToastInstance, ...args: any[]) => void): void;
|
|
31
32
|
triggerEditorEvent(event: string, toast: ToastInstance, ...args: any[]): void;
|
|
32
33
|
private setupWindowFocusHandling;
|
|
34
|
+
private teardownWindowFocusHandling;
|
|
33
35
|
private pauseAllToasts;
|
|
34
36
|
private resumeAllToasts;
|
|
35
37
|
destroy(): void;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class k{constructor(t){this.toasts=new Map,this.groups=new Map,this.containers=new Map,this.config={...t}}addToast(t){this.toasts.set(t.id,t),this.updateGroup(t)}removeToast(t){const s=this.toasts.get(t);return s?(this.toasts.delete(t),this.updateGroup(s),!0):!1}getToast(t){return this.toasts.get(t)}getAllToasts(){return Array.from(this.toasts.values())}getToastsByPosition(t){return this.getAllToasts().filter(s=>s.options.position===t)}updateToast(t,s){const e=this.toasts.get(t);return e?(Object.assign(e,s),this.updateGroup(e),!0):!1}updateGroup(t){const s=t.options.group;if(!s)return;let e=this.groups.get(s);e||(e={id:s,toasts:[]},this.groups.set(s,e)),e.toasts=e.toasts.filter(i=>i.id!==t.id),t.options.group===s&&e.toasts.push(t),e.toasts.length===0&&this.groups.delete(s)}getGroup(t){return this.groups.get(t)}getAllGroups(){return Array.from(this.groups.values())}getContainer(t){return this.containers.get(t)}setContainer(t,s){this.containers.set(t,s)}removeContainer(t){return this.containers.delete(t)}getAllContainers(){return new Map(this.containers)}getConfig(){return{...this.config}}updateConfig(t){this.config={...this.config,...t}}clear(){this.toasts.clear(),this.groups.clear()}getStats(){return{totalToasts:this.toasts.size,totalGroups:this.groups.size,toastsByPosition:Object.fromEntries(Array.from(this.containers.keys()).map(t=>[t,this.getToastsByPosition(t).length]))}}}class H{constructor(t){this.queue=[],this.visible=[],this.config=t}enqueue(t){this.deduplicate(t),this.config.queueStrategy==="fifo"?this.queue.push(t):this.queue.unshift(t),this.queue.sort((s,e)=>(e.options.priority||0)-(s.options.priority||0)),this.processQueue()}dequeue(t){let s=!1;const e=this.queue.findIndex(r=>r.id===t);e!==-1&&(this.queue.splice(e,1),s=!0);const i=this.visible.findIndex(r=>r.id===t);return i!==-1&&(this.visible.splice(i,1),s=!0),s&&this.processQueue(),s}processQueue(){const t=this.config.maxVisible;for(;this.visible.length>t;){const s=this.visible.pop();this.hideToast(s)}for(;this.visible.length<t&&this.queue.length>0;){const s=this.queue.shift();this.showToast(s)}}showToast(t){this.visible.push(t)}hideToast(t){}deduplicate(t){this.queue.filter(e=>e.options.message===t.options.message&&e.options.level===t.options.level).forEach(e=>{const i=this.queue.indexOf(e);i!==-1&&this.queue.splice(i,1)})}updateConfig(t){this.config={...this.config,...t},this.processQueue()}getQueued(){return[...this.queue]}getVisible(){return[...this.visible]}getAll(){return[...this.visible,...this.queue]}clear(){const t=[...this.visible,...this.queue];this.queue=[],this.visible=[],t.forEach(s=>{s.element&&this.hideToast(s)})}forceShow(t){if(this.visible.length>=this.config.maxVisible){const s=this.visible.reduce((e,i)=>(i.options.priority||0)<(e.options.priority||0)?i:e);this.dequeue(s.id)}this.showToast(t)}}class L{constructor(t={}){var s,e,i,r;this.config={stiffness:(s=t.stiffness)!=null?s:100,damping:(e=t.damping)!=null?e:10,mass:(i=t.mass)!=null?i:1,precision:(r=t.precision)!=null?r:.01}}animate(t,s,e,i,r){const a={...this.config,...r};let o,n=!1;const p=Object.keys(s).reduce((u,l)=>(u[l]=s[l].from,u),{}),d=Object.keys(s).reduce((u,l)=>(u[l]=0,u),{}),m=()=>{if(n)return;let u=!0;Object.keys(s).forEach(g=>{const b=s[g].to,y=p[g],w=d[g],f=-a.stiffness*(y-b),v=-a.damping*w,x=(f+v)/a.mass;d[g]+=x*.016,p[g]+=d[g]*.016,(Math.abs(y-b)>a.precision||Math.abs(w)>a.precision)&&(u=!1)});const l=Object.keys(p).reduce((g,b)=>{const y=s[b].unit||"px";return g[b]=`${p[b]}${y}`,g},{});e(l),u?(n=!0,i==null||i()):o=requestAnimationFrame(m)};return o=requestAnimationFrame(m),()=>{n=!0,o&&cancelAnimationFrame(o)}}}class M{constructor(){this.springAnimation=new L}async showToast(t,s,e){switch(e.type){case"spring":await this.animateSpringShow(t,e);break;case"bounce":await this.animateBounceShow(t,e);break;case"slide":await this.animateSlideShow(t,e);break;case"zoom":await this.animateZoomShow(t,e);break;case"flip":await this.animateFlipShow(t,e);break;case"fade":await this.animateFadeShow(t,e);break;case"elastic":await this.animateElasticShow(t,e);break;case"rotate":await this.animateRotateShow(t,e);break;case"custom":e.show?await Promise.resolve(e.show(t,s)):this.animateCssShow(t);break;case"css":default:this.animateCssShow(t);break}}async hideToast(t,s,e){switch(e.type){case"spring":await this.animateSpringHide(t,e);break;case"bounce":await this.animateBounceHide(t,e);break;case"slide":await this.animateSlideHide(t,e);break;case"zoom":await this.animateZoomHide(t,e);break;case"flip":await this.animateFlipHide(t,e);break;case"fade":await this.animateFadeHide(t,e);break;case"elastic":await this.animateElasticHide(t,e);break;case"rotate":await this.animateRotateHide(t,e);break;case"custom":e.hide?await Promise.resolve(e.hide(t,s)):this.animateCssHide(t);break;case"css":default:this.animateCssHide(t);break}}async updateToast(t,s,e,i){i.type==="custom"&&i.update&&await Promise.resolve(i.update(t,s,e))}animateCssShow(t){requestAnimationFrame(()=>{t.classList.add("show")})}animateCssHide(t){t.classList.remove("show"),t.classList.add("hiding")}async animateSpringShow(t,s){return new Promise(e=>{var a,o,n;t.classList.add("spring-animation"),t.style.setProperty("transition","none","important"),t.style.setProperty("-webkit-transition","none","important");const r=((a=t.parentElement)==null?void 0:a.classList.contains("editora-toast-bottom-right"))||((o=t.parentElement)==null?void 0:o.classList.contains("editora-toast-bottom-left"))||((n=t.parentElement)==null?void 0:n.classList.contains("editora-toast-bottom-center"))?20:-20;t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`translateY(${r}px) scale(0.95)`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition","opacity 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1)","important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","translateY(0) scale(1)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),e()},800)},16)})}async animateSpringHide(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important"),t.style.setProperty("-webkit-transition","none","important"),setTimeout(()=>{t.style.setProperty("transition","opacity 0.4s ease, transform 0.4s ease","important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform","translateY(-10px) scale(0.95)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),e()},400)},16)})}async animateBounceShow(t,s){return new Promise(e=>{var d,m,u;t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=((d=t.parentElement)==null?void 0:d.classList.contains("editora-toast-bottom-right"))||((m=t.parentElement)==null?void 0:m.classList.contains("editora-toast-bottom-left"))||((u=t.parentElement)==null?void 0:u.classList.contains("editora-toast-bottom-center")),r=s.direction||(i?"up":"down"),a=s.intensity||"normal",o=s.duration||800,n=a==="gentle"?.05:a==="strong"?.15:.1,p=r==="up"?30:r==="down"?-30:r==="left"?30:-30;t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",r==="left"||r==="right"?`translateX(${p}px) scale(${1-n})`:`translateY(${p}px) scale(${1-n})`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms cubic-bezier(0.68, -0.55, 0.265, 1.55), transform ${o}ms cubic-bezier(0.68, -0.55, 0.265, 1.55)`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","translateY(0) scale(1)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),e()},o)},16)})}async animateBounceHide(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=s.intensity||"normal",r=i==="gentle"?.05:i==="strong"?.15:.1;setTimeout(()=>{t.style.setProperty("transition","opacity 0.4s ease, transform 0.4s ease","important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`scale(${1-r})`,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),e()},400)},16)})}async animateSlideShow(t,s){return new Promise(e=>{var d,m,u;t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=((d=t.parentElement)==null?void 0:d.classList.contains("editora-toast-bottom-right"))||((m=t.parentElement)==null?void 0:m.classList.contains("editora-toast-bottom-left"))||((u=t.parentElement)==null?void 0:u.classList.contains("editora-toast-bottom-center")),r=s.direction||(i?"up":"down"),a=s.distance||100,o=s.easing||"ease-out",n=s.duration||400,p=r==="up"?`translateY(${a}px)`:r==="down"?`translateY(-${a}px)`:r==="left"?`translateX(${a}px)`:`translateX(-${a}px)`;t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",p,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms ${o}, transform ${n}ms ${o}`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","translateY(0) translateX(0)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),e()},n)},16)})}async animateSlideHide(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=s.direction||"down",r=s.distance||100,a=s.easing||"ease-in",o=s.duration||300,n=i==="up"?`translateY(-${r}px)`:i==="down"?`translateY(${r}px)`:i==="left"?`translateX(-${r}px)`:`translateX(${r}px)`;setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms ${a}, transform ${o}ms ${a}`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",n,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),e()},o)},16)})}async animateZoomShow(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=s.scale||.3,r=s.origin||"center",a=s.easing||"ease-out",o=s.duration||500;t.style.setProperty("transform-origin",r,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`scale(${i})`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms ${a}, transform ${o}ms ${a}`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","scale(1)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-origin","","important"),e()},o)},16)})}async animateZoomHide(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=s.scale||.3,r=s.origin||"center",a=s.easing||"ease-in",o=s.duration||300;t.style.setProperty("transform-origin",r,"important"),setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms ${a}, transform ${o}ms ${a}`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`scale(${i})`,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-origin","","important"),e()},o)},16)})}async animateFlipShow(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=s.axis||"y",r=s.perspective||1e3,a=s.direction||"forward",o=s.duration||600;t.style.setProperty("transform-style","preserve-3d","important"),t.parentElement.style.setProperty("perspective",`${r}px`,"important");const n=a==="forward"?i==="x"?-90:90:i==="x"?90:-90;t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`rotate${i.toUpperCase()}(${n}deg)`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms ease, transform ${o}ms cubic-bezier(0.175, 0.885, 0.32, 1.275)`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","rotateX(0deg) rotateY(0deg)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-style","","important"),t.parentElement.style.setProperty("perspective","","important"),e()},o)},16)})}async animateFlipHide(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=s.axis||"y",r=s.perspective||1e3,a=s.direction||"backward",o=s.duration||400;t.style.setProperty("transform-style","preserve-3d","important"),t.parentElement.style.setProperty("perspective",`${r}px`,"important");const n=a==="backward"?i==="x"?-90:90:i==="x"?90:-90;setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms ease, transform ${o}ms ease-in`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`rotate${i.toUpperCase()}(${n}deg)`,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-style","","important"),t.parentElement.style.setProperty("perspective","","important"),e()},o)},16)})}async animateFadeShow(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=s.direction||"none",r=s.distance||20,a=s.duration||300;let o="translateY(0) translateX(0)";i!=="none"&&(o=i==="up"?`translateY(${r}px)`:i==="down"?`translateY(-${r}px)`:i==="left"?`translateX(${r}px)`:`translateX(-${r}px)`),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",o,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${a}ms ease, transform ${a}ms ease`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","translateY(0) translateX(0)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),e()},a)},16)})}async animateFadeHide(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=s.direction||"none",r=s.distance||20,a=s.duration||200;let o="translateY(0) translateX(0)";i!=="none"&&(o=i==="up"?`translateY(-${r}px)`:i==="down"?`translateY(${r}px)`:i==="left"?`translateX(-${r}px)`:`translateX(${r}px)`),setTimeout(()=>{t.style.setProperty("transition",`opacity ${a}ms ease, transform ${a}ms ease`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",o,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),e()},a)},16)})}async animateElasticShow(t,s){return new Promise(e=>{var d,m,u;t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=((d=t.parentElement)==null?void 0:d.classList.contains("editora-toast-bottom-right"))||((m=t.parentElement)==null?void 0:m.classList.contains("editora-toast-bottom-left"))||((u=t.parentElement)==null?void 0:u.classList.contains("editora-toast-bottom-center")),r=s.direction||(i?"up":"down"),a=s.intensity||"normal",o=s.duration||1e3,n=a==="gentle"?.1:a==="strong"?.3:.2,p=r==="up"?40:r==="down"?-40:r==="left"?40:-40;t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",r==="left"||r==="right"?`translateX(${p}px) scale(${1+n})`:`translateY(${p}px) scale(${1+n})`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms cubic-bezier(0.68, -0.55, 0.265, 1.55), transform ${o}ms cubic-bezier(0.68, -0.55, 0.265, 1.55)`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","translateY(0) scale(1)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),e()},o)},16)})}async animateElasticHide(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=s.intensity||"normal",r=i==="gentle"?.1:i==="strong"?.3:.2;s.duration,setTimeout(()=>{t.style.setProperty("transition","opacity 0.4s ease, transform 0.4s ease","important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`scale(${1+r})`,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),e()},400)},16)})}async animateRotateShow(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=s.degrees||360,r=s.direction||"clockwise",a=s.origin||"center",o=s.duration||500,n=r==="clockwise"?i:-i;t.style.setProperty("transform-origin",a,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`rotate(${n}deg) scale(0.8)`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms ease, transform ${o}ms cubic-bezier(0.175, 0.885, 0.32, 1.275)`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","rotate(0deg) scale(1)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-origin","","important"),e()},o)},16)})}async animateRotateHide(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=s.degrees||180,r=s.direction||"counterclockwise",a=s.origin||"center",o=s.duration||300,n=r==="clockwise"?i:-i;t.style.setProperty("transform-origin",a,"important"),setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms ease, transform ${o}ms ease-in`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`rotate(${n}deg) scale(0.8)`,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-origin","","important"),e()},o)},16)})}}const S=new M;class A{constructor(t){this.containers=new Map,this.cssInjected=!1,this.config=t}ensureContainer(t){if(this.containers.has(t))return this.containers.get(t);const s=document.createElement("div");s.className=`editora-toast-container editora-toast-${t.replace("-","-")}`,s.setAttribute("role","region"),s.setAttribute("aria-label","Toast notifications"),s.setAttribute("aria-live","polite");const e={position:"fixed",zIndex:(this.config.zIndex||2147483647).toString(),display:"flex",flexDirection:"column",gap:"8px",pointerEvents:"none",maxWidth:"100%",boxSizing:"border-box"};switch(t){case"top-left":e.top="16px",e.left="16px";break;case"top-right":e.top="16px",e.right="16px";break;case"bottom-left":e.bottom="16px",e.left="16px";break;case"bottom-right":e.bottom="16px",e.right="16px";break;case"center":e.top="50%",e.left="50%",e.transform="translate(-50%, -50%)",e.alignItems="center";break}return Object.assign(s.style,e),document.body.appendChild(s),this.containers.set(t,s),this.injectCSS(),s}createToastElement(t){const s=t.options,e=document.createElement("div");e.className=`editora-toast editora-toast-${s.level||"info"}`,s.customClass&&e.classList.add(s.customClass),e.setAttribute("role","alert"),e.setAttribute("aria-atomic","true");const i=s.theme||this.config.theme;i&&i!=="system"&&e.setAttribute("data-theme",i),(s.rtl!==void 0?s.rtl:this.config.rtl)&&(e.setAttribute("data-rtl","true"),e.setAttribute("dir","rtl"));const a=document.createElement("div");if(a.className="editora-toast-content",s.icon){const n=document.createElement("span");n.className="editora-toast-icon",n.textContent=s.icon,a.appendChild(n)}const o=document.createElement("span");if(o.className="editora-toast-message",s.html&&s.message)o.innerHTML=this.sanitizeHTML(s.message);else if(s.render){const n=s.render();o.appendChild(n)}else o.textContent=s.message||"";if(a.appendChild(o),s.progress){const n=document.createElement("div");n.className="editora-toast-progress";const p=document.createElement("div");if(p.className="editora-toast-progress-bar",p.style.width=`${Math.min(100,Math.max(0,s.progress.value))}%`,s.progress.showPercentage){const d=document.createElement("span");d.className="editora-toast-progress-text",d.textContent=`${Math.round(s.progress.value)}%`,n.appendChild(d)}n.appendChild(p),a.appendChild(n)}if(e.appendChild(a),s.actions&&s.actions.length>0){const n=document.createElement("div");n.className="editora-toast-actions",s.actions.forEach(p=>{const d=document.createElement("button");d.className=`editora-toast-action ${p.primary?"primary":""}`,d.textContent=p.label,d.onclick=m=>{m.stopPropagation(),p.onClick()},n.appendChild(d)}),e.appendChild(n)}if(s.closable!==!1){const n=document.createElement("button");n.className="editora-toast-close",n.setAttribute("aria-label","Close notification"),n.innerHTML="ร",n.onclick=()=>t.dismiss(),e.appendChild(n)}return s.pauseOnHover&&(e.addEventListener("mouseenter",()=>this.pauseToast(t)),e.addEventListener("mouseleave",()=>this.resumeToast(t))),s.pauseOnFocus&&(e.addEventListener("focusin",()=>this.pauseToast(t)),e.addEventListener("focusout",()=>this.resumeToast(t))),s.swipeDismiss&&this.addSwipeDismiss(e,t),s.dragDismiss&&this.addDragDismiss(e,t),e}async showToast(t){var r,a;const s=this.ensureContainer(t.options.position||this.config.position),e=this.createToastElement(t);t.element=e,s.appendChild(e);const i=t.options.animation||this.config.animation||{type:"css"};if(await S.showToast(e,t,i),this.config.enableAccessibility&&this.announceToast(t),(a=(r=t.options).onShow)==null||a.call(r),!t.options.persistent&&t.options.duration!==0){const o=t.options.duration||this.config.duration;t.timeoutId=window.setTimeout(()=>{this.hideToast(t)},o)}}async hideToast(t){var e,i;if(!t.element)return;t.timeoutId&&(clearTimeout(t.timeoutId),t.timeoutId=void 0);const s=t.options.animation||this.config.animation||{type:"css"};await S.hideToast(t.element,t,s),t.element&&t.element.parentNode&&(t.element.parentNode.removeChild(t.element),t.element=void 0),(i=(e=t.options).onHide)==null||i.call(e)}async updateToast(t,s){var r,a;if(!t.element)return;const e=t.options.animation||this.config.animation||{type:"css"};if(e.type==="custom"&&e.update){await S.updateToast(t.element,t,s,e);return}Object.assign(t.options,s),s.level&&(t.element.className=t.element.className.replace(/editora-toast--(info|success|error|warning|loading|custom)/g,""),t.element.classList.add(`editora-toast--${s.level}`));const i=t.element.querySelector(".editora-toast-message");if(i&&s.message!==void 0)if(t.options.html&&s.message)i.innerHTML=this.sanitizeHTML(s.message);else if(t.options.render){const o=t.element.querySelector(".editora-toast-content");if(o){const n=t.options.render();o.innerHTML="",o.appendChild(n)}}else i.textContent=s.message||"";if(s.progress!==void 0){let o=t.element.querySelector(".editora-toast-progress");if(s.progress){if(!o){o=document.createElement("div"),o.className="editora-toast-progress";const p=t.element.querySelector(".editora-toast-content");p&&p.appendChild(o)}const n=o.querySelector(".editora-toast-progress-bar");if(n&&(n.style.width=`${Math.min(100,Math.max(0,s.progress.value))}%`),s.progress.showPercentage){let p=o.querySelector(".editora-toast-progress-text");p||(p=document.createElement("span"),p.className="editora-toast-progress-text",o.insertBefore(p,o.firstChild)),p.textContent=`${Math.round(s.progress.value)}%`}else{const p=o.querySelector(".editora-toast-progress-text");p&&p.remove()}}else o&&o.remove()}if(s.actions!==void 0){let o=t.element.querySelector(".editora-toast-actions");s.actions&&s.actions.length>0?(o?o.innerHTML="":(o=document.createElement("div"),o.className="editora-toast-actions",t.element.appendChild(o)),o&&s.actions.forEach(n=>{const p=document.createElement("button");p.className=`editora-toast-action ${n.primary?"primary":""}`,p.textContent=n.label,p.onclick=d=>{d.stopPropagation(),n.onClick()},o.appendChild(p)})):o&&o.remove()}(a=(r=t.options).onUpdate)==null||a.call(r,s)}pauseToast(t){t.timeoutId&&(clearTimeout(t.timeoutId),t.timeoutId=void 0)}resumeToast(t){if(!t.options.persistent&&t.options.duration!==0){const s=t.options.duration||this.config.duration;t.timeoutId=window.setTimeout(()=>{this.hideToast(t)},s)}}addSwipeDismiss(t,s){let e=0,i=0,r=!1;const a=s.options.swipeDirection||this.config.swipeDirection||"any",o=40;let n="",p=!1;const d=l=>{r=!0,p=!1,e="touches"in l?l.touches[0].clientX:l.clientX,i="touches"in l?l.touches[0].clientY:l.clientY,n=t.style.transform||"",t.style.transition="none",t.style.cursor="grabbing",l.preventDefault()},m=l=>{if(!r)return;const g="touches"in l?l.touches[0].clientX:l.clientX,b="touches"in l?l.touches[0].clientY:l.clientY,y=g-e,w=b-i,f=5;if((Math.abs(y)>f||Math.abs(w)>f)&&(p=!0),p){const v=Math.abs(w)>Math.abs(y)?25:20,P=Math.min(Math.max(y*.2,-v),v),x=Math.min(Math.max(w*.2,-v),v);t.style.transform=`${n} translate(${P}px, ${x}px)`}(Math.abs(w)>Math.abs(y)||a==="vertical"||a==="up"||a==="down")&&l.preventDefault()},u=l=>{if(!r)return;if(t.style.transform=n,t.style.transition="",t.style.cursor="",!p){r=!1;return}const g="changedTouches"in l?l.changedTouches[0].clientX:l.clientX,b="changedTouches"in l?l.changedTouches[0].clientY:l.clientY,y=g-e,w=b-i;let f=!1;const v=a==="vertical"||a==="up"||a==="down",P=v?35:o;switch(a){case"any":f=Math.abs(y)>o||Math.abs(w)>o;break;case"horizontal":f=Math.abs(y)>o;break;case"vertical":f=Math.abs(w)>P;break;case"left":f=y<-o;break;case"right":f=y>o;break;case"up":f=w<-P;break;case"down":f=w>P;break}v&&console.log(`Vertical swipe attempt: direction=${a}, deltaY=${w}, effectiveMinDistance=${P}, shouldDismiss=${f}`),f&&s.dismiss(),r=!1};t.addEventListener("dragstart",l=>l.preventDefault()),t.addEventListener("touchstart",d,{passive:!1}),t.addEventListener("touchmove",m,{passive:!1}),t.addEventListener("touchend",u,{passive:!1}),t.addEventListener("mousedown",d),t.addEventListener("mousemove",m),t.addEventListener("mouseup",u),t.addEventListener("mouseleave",u)}addDragDismiss(t,s){this.addSwipeDismiss(t,s)}announceToast(t){const s=document.createElement("div");s.setAttribute("aria-live","assertive"),s.setAttribute("aria-atomic","true"),s.style.position="absolute",s.style.left="-10000px",s.style.width="1px",s.style.height="1px",s.style.overflow="hidden",s.textContent=`${t.options.level||"info"}: ${t.options.message}`,document.body.appendChild(s),setTimeout(()=>{document.body.removeChild(s)},1e3)}sanitizeHTML(t){const s=document.createElement("div");return s.textContent=t,s.innerHTML}injectCSS(){if(this.cssInjected||typeof document=="undefined")return;if(!Array.from(document.styleSheets).find(s=>{var e,i,r,a;return((i=(e=s.ownerNode)==null?void 0:e.href)==null?void 0:i.includes("toast.css"))||((a=(r=s.ownerNode)==null?void 0:r.textContent)==null?void 0:a.includes("editora-toast"))})){const s=document.createElement("link");s.rel="stylesheet",s.href="/packages/editora-toast/dist/toast.css",document.head.appendChild(s)}this.cssInjected=!0}destroy(){this.containers.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.containers.clear()}}class q{constructor(){this.plugins=[],this.hooks={beforeShow:[],afterShow:[],beforeHide:[],afterHide:[],beforeUpdate:[],afterUpdate:[]}}use(t){if(this.plugins.find(s=>s.name===t.name)){console.warn(`Plugin "${t.name}" is already installed`);return}this.plugins.push(t),t.install(this)}remove(t){const s=this.plugins.findIndex(i=>i.name===t);if(s===-1)return!1;const e=this.plugins[s];return e.uninstall&&e.uninstall(this),this.plugins.splice(s,1),!0}getPlugins(){return[...this.plugins]}on(t,s){this.hooks[t]&&this.hooks[t].push(s)}off(t,s){if(this.hooks[t]){const e=this.hooks[t].indexOf(s);e!==-1&&this.hooks[t].splice(e,1)}}async trigger(t,s,...e){const i=this.hooks[t];if(!(!i||i.length===0))for(const r of i)try{await r(s,...e)}catch(a){console.error(`Error in ${t} hook:`,a)}}async beforeShow(t){await this.trigger("beforeShow",t)}async afterShow(t){await this.trigger("afterShow",t)}async beforeHide(t){await this.trigger("beforeHide",t)}async afterHide(t){await this.trigger("afterHide",t)}async beforeUpdate(t,s){await this.trigger("beforeUpdate",t,s)}async afterUpdate(t,s){await this.trigger("afterUpdate",t,s)}onEditorEvent(t,s){const e=`editor:${t}`;this.hooks[e]||(this.hooks[e]=[]),this.hooks[e].push(s)}triggerEditorEvent(t,s,...e){const i=`editor:${t}`;this.trigger(i,s,...e)}async handlePromise(t,s,e,i){s();try{const r=await t;return e(r),r}catch(r){throw i(r),r}}async batchShow(t){const s=t.map(i=>this.beforeShow(i));await Promise.all(s);const e=t.map(i=>this.afterShow(i));await Promise.all(e)}async batchHide(t){const s=t.map(i=>this.beforeHide(i));await Promise.all(s);const e=t.map(i=>this.afterHide(i));await Promise.all(e)}destroy(){this.plugins.forEach(t=>{t.uninstall&&t.uninstall(this)}),this.plugins=[],Object.keys(this.hooks).forEach(t=>{this.hooks[t]=[]})}}const Y={position:"bottom-right",duration:4e3,maxVisible:5,queueStrategy:"fifo",theme:"system",pauseOnHover:!0,pauseOnFocus:!1,pauseOnWindowBlur:!1,swipeDismiss:!1,swipeDirection:"any",dragDismiss:!1,rtl:!1,enableAccessibility:!0,animation:{type:"css"}};class E{constructor(t={}){this.idCounter=0,this.pausedToasts=new Set,this.config={...Y,...t},this.store=new k(this.config),this.queue=new H(this.config),this.renderer=new A(this.config),this.lifecycle=new q,this.setupWindowFocusHandling()}show(t){const s=t.id||`toast-${++this.idCounter}`,e={id:s,options:{...this.config,...t},createdAt:Date.now(),dismiss:()=>this.dismiss(s),update:i=>this.update(s,i)};return this.lifecycle.beforeShow(e).then(async()=>{this.store.addToast(e),this.queue.enqueue(e),await this.renderer.showToast(e),this.lifecycle.afterShow(e)}),e}update(t,s){const e=this.store.getToast(t);return e?(this.lifecycle.beforeUpdate(e,s).then(async()=>{this.store.updateToast(t,{options:{...e.options,...s}}),await this.renderer.updateToast(e,s),this.lifecycle.afterUpdate(e,s)}),!0):!1}dismiss(t){const s=this.store.getToast(t);return s?(this.lifecycle.beforeHide(s).then(async()=>{this.queue.dequeue(t),await this.renderer.hideToast(s),this.store.removeToast(t),this.lifecycle.afterHide(s)}),!0):!1}clear(){const t=this.store.getAllToasts();this.lifecycle.batchHide(t).then(()=>{this.queue.clear(),this.store.clear()})}async promise(t,s){var i,r;const e=this.show(this.normalizeOptions(s.loading,"loading"));try{const a=await t,o=this.normalizeOptions(typeof s.success=="function"?s.success(a):s.success,"success");return this.update(e.id,o),(i=s.onSuccess)==null||i.call(s,a),a}catch(a){const o=this.normalizeOptions(typeof s.error=="function"?s.error(a):s.error,"error");throw this.update(e.id,o),(r=s.onError)==null||r.call(s,a),a}}group(t,s){return this.show({...s,group:t})}use(t){this.lifecycle.use(t)}configure(t){this.config={...this.config,...t},this.store.updateConfig(t),this.queue.updateConfig(t)}getConfig(){return{...this.config}}getToasts(){return this.store.getAllToasts()}getGroups(){return this.store.getAllGroups()}info(t,s){return this.show({message:t,level:"info",duration:s})}success(t,s){return this.show({message:t,level:"success",duration:s})}error(t,s){return this.show({message:t,level:"error",duration:s})}warning(t,s){return this.show({message:t,level:"warning",duration:s})}loading(t,s){return this.show({message:t,level:"loading",duration:s})}normalizeOptions(t,s){return typeof t=="string"?{message:t,level:s}:{...t,level:t.level||s}}onEditorEvent(t,s){this.lifecycle.onEditorEvent(t,s)}triggerEditorEvent(t,s,...e){this.lifecycle.triggerEditorEvent(t,s,...e)}setupWindowFocusHandling(){typeof window=="undefined"||!this.config.pauseOnWindowBlur||(this.windowBlurHandler=()=>this.pauseAllToasts(),this.windowFocusHandler=()=>this.resumeAllToasts(),window.addEventListener("blur",this.windowBlurHandler),window.addEventListener("focus",this.windowFocusHandler),document.addEventListener("visibilitychange",()=>{document.hidden?this.pauseAllToasts():this.resumeAllToasts()}))}pauseAllToasts(){this.store.getAllToasts().forEach(s=>{s.timeoutId&&!this.pausedToasts.has(s.id)&&(clearTimeout(s.timeoutId),s.timeoutId=void 0,this.pausedToasts.add(s.id))})}resumeAllToasts(){this.store.getAllToasts().forEach(s=>{if(this.pausedToasts.has(s.id)&&!s.options.persistent&&s.options.duration!==0){const e=s.options.duration||this.config.duration;s.timeoutId=window.setTimeout(()=>{this.dismiss(s.id)},e),this.pausedToasts.delete(s.id)}})}destroy(){this.windowBlurHandler&&typeof window!="undefined"&&window.removeEventListener("blur",this.windowBlurHandler),this.windowFocusHandler&&typeof window!="undefined"&&window.removeEventListener("focus",this.windowFocusHandler),this.clear(),this.renderer.destroy(),this.lifecycle.destroy()}}const h=new E;function C(c){return typeof document=="undefined"?{dismiss:()=>{}}:h.show(c)}const $={info:(c,t)=>C({message:c,level:"info",duration:t}),success:(c,t)=>C({message:c,level:"success",duration:t}),error:(c,t)=>C({message:c,level:"error",duration:t})},T={show:c=>h.show(c),update:(c,t)=>h.update(c,t),dismiss:c=>h.dismiss(c),clear:()=>h.clear(),info:(c,t)=>h.show({message:c,level:"info",...t}),success:(c,t)=>h.show({message:c,level:"success",...t}),error:(c,t)=>h.show({message:c,level:"error",...t}),warning:(c,t)=>h.show({message:c,level:"warning",...t}),loading:(c,t)=>h.show({message:c,level:"loading",...t}),promise:(c,t)=>h.promise(c,t),group:(c,t)=>h.group(c,t),configure:c=>h.configure(c),use:c=>h.use(c),getToasts:()=>h.getToasts(),getGroups:()=>h.getGroups(),getConfig:()=>h.getConfig(),onEditorEvent:(c,t)=>h.onEditorEvent(c,t),triggerEditorEvent:(c,t,...s)=>h.triggerEditorEvent(c,t,...s),destroy:()=>h.destroy()};typeof window!="undefined"&&typeof document!="undefined"&&(window.toast=$,window.toastAdvanced=T,window.toastPro=T,window.ToastManager=E,window.dispatchEvent(new CustomEvent("toastReady",{detail:{toast:$,toastAdvanced:T,toastPro:T,ToastManager:E}})));exports.ToastManager=E;exports.default=$;exports.toast=$;exports.toastAdvanced=T;exports.toastPro=T;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class k{constructor(t){this.toasts=new Map,this.groups=new Map,this.containers=new Map,this.config={...t}}addToast(t){this.toasts.set(t.id,t),this.updateGroup(t)}removeToast(t){const e=this.toasts.get(t);return e?(this.toasts.delete(t),this.updateGroup(e),!0):!1}getToast(t){return this.toasts.get(t)}getAllToasts(){return Array.from(this.toasts.values())}getToastsByPosition(t){return this.getAllToasts().filter(e=>e.options.position===t)}updateToast(t,e){const s=this.toasts.get(t);return s?(Object.assign(s,e),this.updateGroup(s),!0):!1}updateGroup(t){const e=t.options.group;if(!e)return;let s=this.groups.get(e);s||(s={id:e,toasts:[]},this.groups.set(e,s)),s.toasts=s.toasts.filter(i=>i.id!==t.id),t.options.group===e&&s.toasts.push(t),s.toasts.length===0&&this.groups.delete(e)}getGroup(t){return this.groups.get(t)}getAllGroups(){return Array.from(this.groups.values())}getContainer(t){return this.containers.get(t)}setContainer(t,e){this.containers.set(t,e)}removeContainer(t){return this.containers.delete(t)}getAllContainers(){return new Map(this.containers)}getConfig(){return{...this.config}}updateConfig(t){this.config={...this.config,...t}}clear(){this.toasts.clear(),this.groups.clear()}getStats(){return{totalToasts:this.toasts.size,totalGroups:this.groups.size,toastsByPosition:Object.fromEntries(Array.from(this.containers.keys()).map(t=>[t,this.getToastsByPosition(t).length]))}}}class M{constructor(t){this.queue=[],this.visible=[],this.config=t}enqueue(t){this.deduplicate(t),this.config.queueStrategy==="fifo"?this.queue.push(t):this.queue.unshift(t),this.queue.sort((e,s)=>(s.options.priority||0)-(e.options.priority||0)),this.processQueue()}dequeue(t){let e=!1;const s=this.queue.findIndex(r=>r.id===t);s!==-1&&(this.queue.splice(s,1),e=!0);const i=this.visible.findIndex(r=>r.id===t);return i!==-1&&(this.visible.splice(i,1),e=!0),e&&this.processQueue(),e}processQueue(){const t=this.config.maxVisible;for(;this.visible.length>t;){const e=this.visible.pop();this.hideToast(e)}for(;this.visible.length<t&&this.queue.length>0;){const e=this.queue.shift();this.showToast(e)}}showToast(t){this.visible.push(t)}hideToast(t){}deduplicate(t){this.queue.filter(s=>s.options.message===t.options.message&&s.options.level===t.options.level).forEach(s=>{const i=this.queue.indexOf(s);i!==-1&&this.queue.splice(i,1)})}updateConfig(t){this.config={...this.config,...t},this.processQueue()}getQueued(){return[...this.queue]}getVisible(){return[...this.visible]}getAll(){return[...this.visible,...this.queue]}clear(){const t=[...this.visible,...this.queue];this.queue=[],this.visible=[],t.forEach(e=>{e.element&&this.hideToast(e)})}forceShow(t){if(this.visible.length>=this.config.maxVisible){const e=this.visible.reduce((s,i)=>(i.options.priority||0)<(s.options.priority||0)?i:s);this.dequeue(e.id)}this.showToast(t)}}class A{constructor(t={}){var e,s,i,r;this.config={stiffness:(e=t.stiffness)!=null?e:100,damping:(s=t.damping)!=null?s:10,mass:(i=t.mass)!=null?i:1,precision:(r=t.precision)!=null?r:.01}}animate(t,e,s,i,r){const n={...this.config,...r};let o,a=!1;const l=Object.keys(e).reduce((u,d)=>(u[d]=e[d].from,u),{}),p=Object.keys(e).reduce((u,d)=>(u[d]=0,u),{}),y=()=>{if(a)return;let u=!0;Object.keys(e).forEach(g=>{const b=e[g].to,m=l[g],w=p[g],f=-n.stiffness*(m-b),v=-n.damping*w,C=(f+v)/n.mass;p[g]+=C*.016,l[g]+=p[g]*.016,(Math.abs(m-b)>n.precision||Math.abs(w)>n.precision)&&(u=!1)});const d=Object.keys(l).reduce((g,b)=>{const m=e[b].unit||"px";return g[b]=`${l[b]}${m}`,g},{});s(d),u?(a=!0,i==null||i()):o=requestAnimationFrame(y)};return o=requestAnimationFrame(y),()=>{a=!0,o&&cancelAnimationFrame(o)}}}class q{constructor(){this.springAnimation=new A}async showToast(t,e,s){switch(s.type){case"spring":await this.animateSpringShow(t,s);break;case"bounce":await this.animateBounceShow(t,s);break;case"slide":await this.animateSlideShow(t,s);break;case"zoom":await this.animateZoomShow(t,s);break;case"flip":await this.animateFlipShow(t,s);break;case"fade":await this.animateFadeShow(t,s);break;case"elastic":await this.animateElasticShow(t,s);break;case"rotate":await this.animateRotateShow(t,s);break;case"custom":s.show?await Promise.resolve(s.show(t,e)):this.animateCssShow(t);break;case"css":default:this.animateCssShow(t);break}}async hideToast(t,e,s){switch(s.type){case"spring":await this.animateSpringHide(t,s);break;case"bounce":await this.animateBounceHide(t,s);break;case"slide":await this.animateSlideHide(t,s);break;case"zoom":await this.animateZoomHide(t,s);break;case"flip":await this.animateFlipHide(t,s);break;case"fade":await this.animateFadeHide(t,s);break;case"elastic":await this.animateElasticHide(t,s);break;case"rotate":await this.animateRotateHide(t,s);break;case"custom":s.hide?await Promise.resolve(s.hide(t,e)):this.animateCssHide(t);break;case"css":default:this.animateCssHide(t);break}}async updateToast(t,e,s,i){i.type==="custom"&&i.update&&await Promise.resolve(i.update(t,e,s))}animateCssShow(t){requestAnimationFrame(()=>{t.classList.add("show")})}animateCssHide(t){t.classList.remove("show"),t.classList.add("hiding")}async animateSpringShow(t,e){return new Promise(s=>{var n,o,a;t.classList.add("spring-animation"),t.style.setProperty("transition","none","important"),t.style.setProperty("-webkit-transition","none","important");const r=((n=t.parentElement)==null?void 0:n.classList.contains("editora-toast-bottom-right"))||((o=t.parentElement)==null?void 0:o.classList.contains("editora-toast-bottom-left"))||((a=t.parentElement)==null?void 0:a.classList.contains("editora-toast-bottom-center"))?20:-20;t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`translateY(${r}px) scale(0.95)`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition","opacity 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1)","important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","translateY(0) scale(1)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},800)},16)})}async animateSpringHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important"),t.style.setProperty("-webkit-transition","none","important"),setTimeout(()=>{t.style.setProperty("transition","opacity 0.4s ease, transform 0.4s ease","important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform","translateY(-10px) scale(0.95)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},400)},16)})}async animateBounceShow(t,e){return new Promise(s=>{var p,y,u;t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=((p=t.parentElement)==null?void 0:p.classList.contains("editora-toast-bottom-right"))||((y=t.parentElement)==null?void 0:y.classList.contains("editora-toast-bottom-left"))||((u=t.parentElement)==null?void 0:u.classList.contains("editora-toast-bottom-center")),r=e.direction||(i?"up":"down"),n=e.intensity||"normal",o=e.duration||800,a=n==="gentle"?.05:n==="strong"?.15:.1,l=r==="up"?30:r==="down"?-30:r==="left"?30:-30;t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",r==="left"||r==="right"?`translateX(${l}px) scale(${1-a})`:`translateY(${l}px) scale(${1-a})`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms cubic-bezier(0.68, -0.55, 0.265, 1.55), transform ${o}ms cubic-bezier(0.68, -0.55, 0.265, 1.55)`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","translateY(0) scale(1)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},o)},16)})}async animateBounceHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.intensity||"normal",r=i==="gentle"?.05:i==="strong"?.15:.1;setTimeout(()=>{t.style.setProperty("transition","opacity 0.4s ease, transform 0.4s ease","important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`scale(${1-r})`,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},400)},16)})}async animateSlideShow(t,e){return new Promise(s=>{var p,y,u;t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=((p=t.parentElement)==null?void 0:p.classList.contains("editora-toast-bottom-right"))||((y=t.parentElement)==null?void 0:y.classList.contains("editora-toast-bottom-left"))||((u=t.parentElement)==null?void 0:u.classList.contains("editora-toast-bottom-center")),r=e.direction||(i?"up":"down"),n=e.distance||100,o=e.easing||"ease-out",a=e.duration||400,l=r==="up"?`translateY(${n}px)`:r==="down"?`translateY(-${n}px)`:r==="left"?`translateX(${n}px)`:`translateX(-${n}px)`;t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",l,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${a}ms ${o}, transform ${a}ms ${o}`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","translateY(0) translateX(0)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},a)},16)})}async animateSlideHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.direction||"down",r=e.distance||100,n=e.easing||"ease-in",o=e.duration||300,a=i==="up"?`translateY(-${r}px)`:i==="down"?`translateY(${r}px)`:i==="left"?`translateX(-${r}px)`:`translateX(${r}px)`;setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms ${n}, transform ${o}ms ${n}`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",a,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},o)},16)})}async animateZoomShow(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.scale||.3,r=e.origin||"center",n=e.easing||"ease-out",o=e.duration||500;t.style.setProperty("transform-origin",r,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`scale(${i})`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms ${n}, transform ${o}ms ${n}`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","scale(1)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-origin","","important"),s()},o)},16)})}async animateZoomHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.scale||.3,r=e.origin||"center",n=e.easing||"ease-in",o=e.duration||300;t.style.setProperty("transform-origin",r,"important"),setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms ${n}, transform ${o}ms ${n}`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`scale(${i})`,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-origin","","important"),s()},o)},16)})}async animateFlipShow(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.axis||"y",r=e.perspective||1e3,n=e.direction||"forward",o=e.duration||600;t.style.setProperty("transform-style","preserve-3d","important"),t.parentElement.style.setProperty("perspective",`${r}px`,"important");const a=n==="forward"?i==="x"?-90:90:i==="x"?90:-90;t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`rotate${i.toUpperCase()}(${a}deg)`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms ease, transform ${o}ms cubic-bezier(0.175, 0.885, 0.32, 1.275)`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","rotateX(0deg) rotateY(0deg)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-style","","important"),t.parentElement.style.setProperty("perspective","","important"),s()},o)},16)})}async animateFlipHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.axis||"y",r=e.perspective||1e3,n=e.direction||"backward",o=e.duration||400;t.style.setProperty("transform-style","preserve-3d","important"),t.parentElement.style.setProperty("perspective",`${r}px`,"important");const a=n==="backward"?i==="x"?-90:90:i==="x"?90:-90;setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms ease, transform ${o}ms ease-in`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`rotate${i.toUpperCase()}(${a}deg)`,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-style","","important"),t.parentElement.style.setProperty("perspective","","important"),s()},o)},16)})}async animateFadeShow(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.direction||"none",r=e.distance||20,n=e.duration||300;let o="translateY(0) translateX(0)";i!=="none"&&(o=i==="up"?`translateY(${r}px)`:i==="down"?`translateY(-${r}px)`:i==="left"?`translateX(${r}px)`:`translateX(-${r}px)`),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",o,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms ease, transform ${n}ms ease`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","translateY(0) translateX(0)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},n)},16)})}async animateFadeHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.direction||"none",r=e.distance||20,n=e.duration||200;let o="translateY(0) translateX(0)";i!=="none"&&(o=i==="up"?`translateY(-${r}px)`:i==="down"?`translateY(${r}px)`:i==="left"?`translateX(-${r}px)`:`translateX(${r}px)`),setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms ease, transform ${n}ms ease`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",o,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},n)},16)})}async animateElasticShow(t,e){return new Promise(s=>{var p,y,u;t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=((p=t.parentElement)==null?void 0:p.classList.contains("editora-toast-bottom-right"))||((y=t.parentElement)==null?void 0:y.classList.contains("editora-toast-bottom-left"))||((u=t.parentElement)==null?void 0:u.classList.contains("editora-toast-bottom-center")),r=e.direction||(i?"up":"down"),n=e.intensity||"normal",o=e.duration||1e3,a=n==="gentle"?.1:n==="strong"?.3:.2,l=r==="up"?40:r==="down"?-40:r==="left"?40:-40;t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",r==="left"||r==="right"?`translateX(${l}px) scale(${1+a})`:`translateY(${l}px) scale(${1+a})`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms cubic-bezier(0.68, -0.55, 0.265, 1.55), transform ${o}ms cubic-bezier(0.68, -0.55, 0.265, 1.55)`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","translateY(0) scale(1)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},o)},16)})}async animateElasticHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.intensity||"normal",r=i==="gentle"?.1:i==="strong"?.3:.2;e.duration,setTimeout(()=>{t.style.setProperty("transition","opacity 0.4s ease, transform 0.4s ease","important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`scale(${1+r})`,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},400)},16)})}async animateRotateShow(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.degrees||360,r=e.direction||"clockwise",n=e.origin||"center",o=e.duration||500,a=r==="clockwise"?i:-i;t.style.setProperty("transform-origin",n,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`rotate(${a}deg) scale(0.8)`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms ease, transform ${o}ms cubic-bezier(0.175, 0.885, 0.32, 1.275)`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","rotate(0deg) scale(1)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-origin","","important"),s()},o)},16)})}async animateRotateHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.degrees||180,r=e.direction||"counterclockwise",n=e.origin||"center",o=e.duration||300,a=r==="clockwise"?i:-i;t.style.setProperty("transform-origin",n,"important"),setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms ease, transform ${o}ms ease-in`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`rotate(${a}deg) scale(0.8)`,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-origin","","important"),s()},o)},16)})}}const L=new q;class Y{constructor(t){this.containers=new Map,this.cssInjected=!1,this.config=t}ensureContainer(t){if(this.containers.has(t))return this.containers.get(t);const e=document.createElement("div");e.className=`editora-toast-container editora-toast-${t.replace("-","-")}`,e.setAttribute("role","region"),e.setAttribute("aria-label","Toast notifications"),e.setAttribute("aria-live","polite");const s={position:"fixed",zIndex:(this.config.zIndex||2147483647).toString(),display:"flex",flexDirection:"column",gap:"8px",pointerEvents:"none",maxWidth:"100%",boxSizing:"border-box"};switch(t){case"top-left":s.top="16px",s.left="16px";break;case"top-right":s.top="16px",s.right="16px";break;case"bottom-left":s.bottom="16px",s.left="16px";break;case"bottom-right":s.bottom="16px",s.right="16px";break;case"center":s.top="50%",s.left="50%",s.transform="translate(-50%, -50%)",s.alignItems="center";break}return Object.assign(e.style,s),document.body.appendChild(e),this.containers.set(t,e),this.injectCSS(),e}createToastElement(t){const e=t.options,s=document.createElement("div");s.className=`editora-toast editora-toast-${e.level||"info"}`,e.customClass&&s.classList.add(e.customClass),s.setAttribute("role","alert"),s.setAttribute("aria-atomic","true");const i=e.theme||this.config.theme;i&&i!=="system"&&s.setAttribute("data-theme",i),(e.rtl!==void 0?e.rtl:this.config.rtl)&&(s.setAttribute("data-rtl","true"),s.setAttribute("dir","rtl"));const n=document.createElement("div");if(n.className="editora-toast-content",e.icon){const a=document.createElement("span");a.className="editora-toast-icon",a.textContent=e.icon,n.appendChild(a)}const o=document.createElement("span");if(o.className="editora-toast-message",e.html&&e.message)o.innerHTML=this.sanitizeHTML(e.message);else if(e.render){const a=e.render();o.appendChild(a)}else o.textContent=e.message||"";if(n.appendChild(o),e.progress){const a=document.createElement("div");a.className="editora-toast-progress";const l=document.createElement("div");if(l.className="editora-toast-progress-bar",l.style.width=`${Math.min(100,Math.max(0,e.progress.value))}%`,e.progress.showPercentage){const p=document.createElement("span");p.className="editora-toast-progress-text",p.textContent=`${Math.round(e.progress.value)}%`,a.appendChild(p)}a.appendChild(l),n.appendChild(a)}if(s.appendChild(n),e.actions&&e.actions.length>0){const a=document.createElement("div");a.className="editora-toast-actions",e.actions.forEach(l=>{const p=document.createElement("button");p.className=`editora-toast-action ${l.primary?"primary":""}`,p.textContent=l.label,p.onclick=y=>{y.stopPropagation(),l.onClick()},a.appendChild(p)}),s.appendChild(a)}if(e.closable!==!1){const a=document.createElement("button");a.className="editora-toast-close",a.setAttribute("aria-label","Close notification"),a.innerHTML="ร",a.onclick=()=>t.dismiss(),s.appendChild(a)}return e.pauseOnHover&&(s.addEventListener("mouseenter",()=>this.pauseToast(t)),s.addEventListener("mouseleave",()=>this.resumeToast(t))),e.pauseOnFocus&&(s.addEventListener("focusin",()=>this.pauseToast(t)),s.addEventListener("focusout",()=>this.resumeToast(t))),e.swipeDismiss&&this.addSwipeDismiss(s,t),e.dragDismiss&&this.addDragDismiss(s,t),s}async showToast(t){var r,n;const e=this.ensureContainer(t.options.position||this.config.position),s=this.createToastElement(t);t.element=s,e.appendChild(s);const i=t.options.animation||this.config.animation||{type:"css"};if(await L.showToast(s,t,i),this.config.enableAccessibility&&this.announceToast(t),(n=(r=t.options).onShow)==null||n.call(r),!t.options.persistent&&t.options.duration!==0){const o=t.options.duration||this.config.duration;t.timeoutId=window.setTimeout(()=>{this.hideToast(t)},o)}}async hideToast(t){var s,i;if(!t.element)return;t.timeoutId&&(clearTimeout(t.timeoutId),t.timeoutId=void 0);const e=t.options.animation||this.config.animation||{type:"css"};await L.hideToast(t.element,t,e),t.element&&t.element.parentNode&&(t.element.parentNode.removeChild(t.element),t.element=void 0),(i=(s=t.options).onHide)==null||i.call(s)}async updateToast(t,e){var r,n;if(!t.element)return;const s=t.options.animation||this.config.animation||{type:"css"};if(s.type==="custom"&&s.update){await L.updateToast(t.element,t,e,s);return}Object.assign(t.options,e),e.level&&(t.element.className=t.element.className.replace(/editora-toast--(info|success|error|warning|loading|custom)/g,""),t.element.classList.add(`editora-toast--${e.level}`));const i=t.element.querySelector(".editora-toast-message");if(i&&e.message!==void 0)if(t.options.html&&e.message)i.innerHTML=this.sanitizeHTML(e.message);else if(t.options.render){const o=t.element.querySelector(".editora-toast-content");if(o){const a=t.options.render();o.innerHTML="",o.appendChild(a)}}else i.textContent=e.message||"";if(e.progress!==void 0){let o=t.element.querySelector(".editora-toast-progress");if(e.progress){if(!o){o=document.createElement("div"),o.className="editora-toast-progress";const l=t.element.querySelector(".editora-toast-content");l&&l.appendChild(o)}const a=o.querySelector(".editora-toast-progress-bar");if(a&&(a.style.width=`${Math.min(100,Math.max(0,e.progress.value))}%`),e.progress.showPercentage){let l=o.querySelector(".editora-toast-progress-text");l||(l=document.createElement("span"),l.className="editora-toast-progress-text",o.insertBefore(l,o.firstChild)),l.textContent=`${Math.round(e.progress.value)}%`}else{const l=o.querySelector(".editora-toast-progress-text");l&&l.remove()}}else o&&o.remove()}if(e.actions!==void 0){let o=t.element.querySelector(".editora-toast-actions");e.actions&&e.actions.length>0?(o?o.innerHTML="":(o=document.createElement("div"),o.className="editora-toast-actions",t.element.appendChild(o)),o&&e.actions.forEach(a=>{const l=document.createElement("button");l.className=`editora-toast-action ${a.primary?"primary":""}`,l.textContent=a.label,l.onclick=p=>{p.stopPropagation(),a.onClick()},o.appendChild(l)})):o&&o.remove()}(n=(r=t.options).onUpdate)==null||n.call(r,e)}pauseToast(t){t.timeoutId&&(clearTimeout(t.timeoutId),t.timeoutId=void 0)}resumeToast(t){if(!t.options.persistent&&t.options.duration!==0){const e=t.options.duration||this.config.duration;t.timeoutId=window.setTimeout(()=>{this.hideToast(t)},e)}}addSwipeDismiss(t,e){let s=0,i=0,r=!1;const n=e.options.swipeDirection||this.config.swipeDirection||"any",o=40;let a="",l=!1;const p=d=>{r=!0,l=!1,s="touches"in d?d.touches[0].clientX:d.clientX,i="touches"in d?d.touches[0].clientY:d.clientY,a=t.style.transform||"",t.style.transition="none",t.style.cursor="grabbing",d.preventDefault()},y=d=>{if(!r)return;const g="touches"in d?d.touches[0].clientX:d.clientX,b="touches"in d?d.touches[0].clientY:d.clientY,m=g-s,w=b-i,f=5;if((Math.abs(m)>f||Math.abs(w)>f)&&(l=!0),l){const v=Math.abs(w)>Math.abs(m)?25:20,P=Math.min(Math.max(m*.2,-v),v),C=Math.min(Math.max(w*.2,-v),v);t.style.transform=`${a} translate(${P}px, ${C}px)`}(Math.abs(w)>Math.abs(m)||n==="vertical"||n==="up"||n==="down")&&d.preventDefault()},u=d=>{if(!r)return;if(t.style.transform=a,t.style.transition="",t.style.cursor="",!l){r=!1;return}const g="changedTouches"in d?d.changedTouches[0].clientX:d.clientX,b="changedTouches"in d?d.changedTouches[0].clientY:d.clientY,m=g-s,w=b-i;let f=!1;const v=n==="vertical"||n==="up"||n==="down",P=v?35:o;switch(n){case"any":f=Math.abs(m)>o||Math.abs(w)>o;break;case"horizontal":f=Math.abs(m)>o;break;case"vertical":f=Math.abs(w)>P;break;case"left":f=m<-o;break;case"right":f=m>o;break;case"up":f=w<-P;break;case"down":f=w>P;break}v&&console.log(`Vertical swipe attempt: direction=${n}, deltaY=${w}, effectiveMinDistance=${P}, shouldDismiss=${f}`),f&&e.dismiss(),r=!1};t.addEventListener("dragstart",d=>d.preventDefault()),t.addEventListener("touchstart",p,{passive:!1}),t.addEventListener("touchmove",y,{passive:!1}),t.addEventListener("touchend",u,{passive:!1}),t.addEventListener("mousedown",p),t.addEventListener("mousemove",y),t.addEventListener("mouseup",u),t.addEventListener("mouseleave",u)}addDragDismiss(t,e){this.addSwipeDismiss(t,e)}announceToast(t){const e=document.createElement("div");e.setAttribute("aria-live","assertive"),e.setAttribute("aria-atomic","true"),e.style.position="absolute",e.style.left="-10000px",e.style.width="1px",e.style.height="1px",e.style.overflow="hidden",e.textContent=`${t.options.level||"info"}: ${t.options.message}`,document.body.appendChild(e),setTimeout(()=>{document.body.removeChild(e)},1e3)}sanitizeHTML(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}injectCSS(){if(this.cssInjected||typeof document=="undefined")return;if(!Array.from(document.styleSheets).find(e=>{var s,i,r,n;return((i=(s=e.ownerNode)==null?void 0:s.href)==null?void 0:i.includes("toast.css"))||((n=(r=e.ownerNode)==null?void 0:r.textContent)==null?void 0:n.includes("editora-toast"))})){const e=document.createElement("link");e.rel="stylesheet",e.href="/packages/editora-toast/dist/toast.css",document.head.appendChild(e)}this.cssInjected=!0}destroy(){this.containers.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.containers.clear()}}class F{constructor(){this.plugins=[],this.hooks={beforeShow:[],afterShow:[],beforeHide:[],afterHide:[],beforeUpdate:[],afterUpdate:[]}}use(t){if(this.plugins.find(e=>e.name===t.name)){console.warn(`Plugin "${t.name}" is already installed`);return}this.plugins.push(t),t.install(this)}remove(t){const e=this.plugins.findIndex(i=>i.name===t);if(e===-1)return!1;const s=this.plugins[e];return s.uninstall&&s.uninstall(this),this.plugins.splice(e,1),!0}getPlugins(){return[...this.plugins]}on(t,e){this.hooks[t]&&this.hooks[t].push(e)}off(t,e){if(this.hooks[t]){const s=this.hooks[t].indexOf(e);s!==-1&&this.hooks[t].splice(s,1)}}async trigger(t,e,...s){const i=this.hooks[t];if(!(!i||i.length===0))for(const r of i)try{await r(e,...s)}catch(n){console.error(`Error in ${t} hook:`,n)}}async beforeShow(t){await this.trigger("beforeShow",t)}async afterShow(t){await this.trigger("afterShow",t)}async beforeHide(t){await this.trigger("beforeHide",t)}async afterHide(t){await this.trigger("afterHide",t)}async beforeUpdate(t,e){await this.trigger("beforeUpdate",t,e)}async afterUpdate(t,e){await this.trigger("afterUpdate",t,e)}onEditorEvent(t,e){const s=`editor:${t}`;this.hooks[s]||(this.hooks[s]=[]),this.hooks[s].push(e)}triggerEditorEvent(t,e,...s){const i=`editor:${t}`;this.trigger(i,e,...s)}async handlePromise(t,e,s,i){e();try{const r=await t;return s(r),r}catch(r){throw i(r),r}}async batchShow(t){const e=t.map(i=>this.beforeShow(i));await Promise.all(e);const s=t.map(i=>this.afterShow(i));await Promise.all(s)}async batchHide(t){const e=t.map(i=>this.beforeHide(i));await Promise.all(e);const s=t.map(i=>this.afterHide(i));await Promise.all(s)}destroy(){this.plugins.forEach(t=>{t.uninstall&&t.uninstall(this)}),this.plugins=[],Object.keys(this.hooks).forEach(t=>{this.hooks[t]=[]})}}const I={position:"bottom-right",duration:4e3,maxVisible:5,queueStrategy:"fifo",theme:"system",pauseOnHover:!0,pauseOnFocus:!1,pauseOnWindowBlur:!1,swipeDismiss:!1,swipeDirection:"any",dragDismiss:!1,rtl:!1,enableAccessibility:!0,animation:{type:"css"}};class S{constructor(t={}){this.idCounter=0,this.pausedToasts=new Set,this.config={...I,...t},this.store=new k(this.config),this.queue=new M(this.config),this.renderer=new Y(this.config),this.lifecycle=new F,this.setupWindowFocusHandling()}show(t){const e=t.id||`toast-${++this.idCounter}`,s={id:e,options:{...this.config,...t},createdAt:Date.now(),dismiss:()=>this.dismiss(e),update:i=>this.update(e,i)};return this.lifecycle.beforeShow(s).then(async()=>{this.store.addToast(s),this.queue.enqueue(s),await this.renderer.showToast(s),this.lifecycle.afterShow(s)}),s}update(t,e){const s=this.store.getToast(t);return s?(this.lifecycle.beforeUpdate(s,e).then(async()=>{this.store.updateToast(t,{options:{...s.options,...e}}),await this.renderer.updateToast(s,e),this.lifecycle.afterUpdate(s,e)}),!0):!1}dismiss(t){const e=this.store.getToast(t);return e?(this.lifecycle.beforeHide(e).then(async()=>{this.queue.dequeue(t),await this.renderer.hideToast(e),this.store.removeToast(t),this.lifecycle.afterHide(e)}),!0):!1}clear(){const t=this.store.getAllToasts();this.lifecycle.batchHide(t).then(()=>{this.queue.clear(),this.store.clear()})}async promise(t,e){var i,r;const s=this.show(this.normalizeOptions(e.loading,"loading"));try{const n=await t,o=this.normalizeOptions(typeof e.success=="function"?e.success(n):e.success,"success");return this.update(s.id,o),(i=e.onSuccess)==null||i.call(e,n),n}catch(n){const o=this.normalizeOptions(typeof e.error=="function"?e.error(n):e.error,"error");throw this.update(s.id,o),(r=e.onError)==null||r.call(e,n),n}}group(t,e){return this.show({...e,group:t})}use(t){this.lifecycle.use(t)}configure(t){const e=this.config.pauseOnWindowBlur;this.config={...this.config,...t},this.store.updateConfig(t),this.queue.updateConfig(t),t.pauseOnWindowBlur!==void 0&&t.pauseOnWindowBlur!==e&&(this.teardownWindowFocusHandling(),this.setupWindowFocusHandling())}getConfig(){return{...this.config}}getToasts(){return this.store.getAllToasts()}getGroups(){return this.store.getAllGroups()}info(t,e){return this.show({message:t,level:"info",duration:e})}success(t,e){return this.show({message:t,level:"success",duration:e})}error(t,e){return this.show({message:t,level:"error",duration:e})}warning(t,e){return this.show({message:t,level:"warning",duration:e})}loading(t,e){return this.show({message:t,level:"loading",duration:e})}normalizeOptions(t,e){return typeof t=="string"?{message:t,level:e}:{...t,level:t.level||e}}onEditorEvent(t,e){this.lifecycle.onEditorEvent(t,e)}triggerEditorEvent(t,e,...s){this.lifecycle.triggerEditorEvent(t,e,...s)}setupWindowFocusHandling(){typeof window=="undefined"||typeof document=="undefined"||!this.config.pauseOnWindowBlur||(this.teardownWindowFocusHandling(),this.windowBlurHandler=()=>this.pauseAllToasts(),this.windowFocusHandler=()=>this.resumeAllToasts(),this.visibilityChangeHandler=()=>{document.hidden?this.pauseAllToasts():this.resumeAllToasts()},window.addEventListener("blur",this.windowBlurHandler),window.addEventListener("focus",this.windowFocusHandler),document.addEventListener("visibilitychange",this.visibilityChangeHandler))}teardownWindowFocusHandling(){typeof window!="undefined"&&(this.windowBlurHandler&&(window.removeEventListener("blur",this.windowBlurHandler),this.windowBlurHandler=void 0),this.windowFocusHandler&&(window.removeEventListener("focus",this.windowFocusHandler),this.windowFocusHandler=void 0),typeof document!="undefined"&&this.visibilityChangeHandler&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=void 0))}pauseAllToasts(){this.store.getAllToasts().forEach(e=>{e.timeoutId&&!this.pausedToasts.has(e.id)&&(clearTimeout(e.timeoutId),e.timeoutId=void 0,this.pausedToasts.add(e.id))})}resumeAllToasts(){this.store.getAllToasts().forEach(e=>{if(this.pausedToasts.has(e.id)&&!e.options.persistent&&e.options.duration!==0){const s=e.options.duration||this.config.duration;e.timeoutId=window.setTimeout(()=>{this.dismiss(e.id)},s),this.pausedToasts.delete(e.id)}})}destroy(){this.teardownWindowFocusHandling(),this.clear(),this.renderer.destroy(),this.lifecycle.destroy()}}let E=null;function h(){return E||(E=new S),E}function $(c){return typeof document=="undefined"?{dismiss:()=>{}}:h().show(c)}function x(c,t,e,s){const i={position:"top-right",theme:"light"};let r={};return t&&typeof t=="object"?r={...t}:typeof t=="number"&&(r.duration=t),e&&(r.theme=e),s&&(r.position=s),{message:c,...r,duration:r.duration,level:r.level||void 0,position:r.position||i.position,theme:r.theme||i.theme}}const H={info:(c,t,e,s)=>$({...x(c,t,e,s),level:"info"}),success:(c,t,e,s)=>$({...x(c,t,e,s),level:"success"}),error:(c,t,e,s)=>$({...x(c,t,e,s),level:"error"}),warning:(c,t,e,s)=>$({...x(c,t,e,s),level:"warning"}),loading:(c,t,e,s)=>$({...x(c,t,e,s),level:"loading"})},T={show:c=>h().show(c),update:(c,t)=>h().update(c,t),dismiss:c=>h().dismiss(c),clear:()=>h().clear(),info:(c,t)=>h().show({message:c,level:"info",...t}),success:(c,t)=>h().show({message:c,level:"success",...t}),error:(c,t)=>h().show({message:c,level:"error",...t}),warning:(c,t)=>h().show({message:c,level:"warning",...t}),loading:(c,t)=>h().show({message:c,level:"loading",...t}),promise:(c,t)=>h().promise(c,t),group:(c,t)=>h().group(c,t),configure:c=>h().configure(c),use:c=>h().use(c),getToasts:()=>h().getToasts(),getGroups:()=>h().getGroups(),getConfig:()=>h().getConfig(),onEditorEvent:(c,t)=>h().onEditorEvent(c,t),triggerEditorEvent:(c,t,...e)=>h().triggerEditorEvent(c,t,...e),destroy:()=>{E&&(E.destroy(),E=null)}};if(typeof window!="undefined"&&typeof document!="undefined"){const c=window;c.toast=H,c.toastAdvanced=T,c.toastPro=T,c.ToastManager=S,c.__editoraToastReady||(c.__editoraToastReady=!0,window.dispatchEvent(new CustomEvent("toastReady",{detail:{toast:H,toastAdvanced:T,toastPro:T,ToastManager:S}})))}exports.ToastManager=S;exports.default=H;exports.toast=H;exports.toastAdvanced=T;exports.toastPro=T;
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import { ToastOptions, ToastInstance, ToastConfig, ToastPlugin, ToastPromiseOptions } from './core/types';
|
|
2
|
-
export type ToastLevel = 'info' | 'success' | 'error';
|
|
3
|
-
export interface ToastOptionsLegacy {
|
|
1
|
+
import { ToastOptions, ToastInstance, ToastConfig, ToastPlugin, ToastPromiseOptions, ToastTheme, ToastPosition } from './core/types';
|
|
2
|
+
export type ToastLevel = 'info' | 'success' | 'error' | 'warning' | 'loading';
|
|
3
|
+
export interface ToastOptionsLegacy extends ToastOptions {
|
|
4
4
|
message: string;
|
|
5
|
-
duration?: number;
|
|
6
|
-
level?: ToastLevel;
|
|
7
5
|
}
|
|
8
6
|
export declare const toast: {
|
|
9
|
-
info: (msg: string,
|
|
7
|
+
info: (msg: string, optionsOrDuration?: Partial<ToastOptions> | number, theme?: ToastTheme, position?: ToastPosition) => ToastInstance | {
|
|
10
8
|
dismiss: () => void;
|
|
11
9
|
};
|
|
12
|
-
success: (msg: string,
|
|
10
|
+
success: (msg: string, optionsOrDuration?: Partial<ToastOptions> | number, theme?: ToastTheme, position?: ToastPosition) => ToastInstance | {
|
|
13
11
|
dismiss: () => void;
|
|
14
12
|
};
|
|
15
|
-
error: (msg: string,
|
|
13
|
+
error: (msg: string, optionsOrDuration?: Partial<ToastOptions> | number, theme?: ToastTheme, position?: ToastPosition) => ToastInstance | {
|
|
14
|
+
dismiss: () => void;
|
|
15
|
+
};
|
|
16
|
+
warning: (msg: string, optionsOrDuration?: Partial<ToastOptions> | number, theme?: ToastTheme, position?: ToastPosition) => ToastInstance | {
|
|
17
|
+
dismiss: () => void;
|
|
18
|
+
};
|
|
19
|
+
loading: (msg: string, optionsOrDuration?: Partial<ToastOptions> | number, theme?: ToastTheme, position?: ToastPosition) => ToastInstance | {
|
|
16
20
|
dismiss: () => void;
|
|
17
21
|
};
|
|
18
22
|
};
|