@tsirosgeorge/toastnotification 5.3.3 → 5.5.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/Readme.md CHANGED
@@ -8,7 +8,7 @@ A lightweight, customizable, and dependency-free toast notification system writt
8
8
 
9
9
  ## 📦 Include package via cdn
10
10
  ```html
11
- <script src="https://cdn.jsdelivr.net/npm/@tsirosgeorge/toastnotification@5.3.3/toast.min.js"></script>
11
+ <script src="https://cdn.jsdelivr.net/npm/@tsirosgeorge/toastnotification@5.4.0/toast.min.js"></script>
12
12
  ```
13
13
 
14
14
  ## 📦 Include package via npm
@@ -41,8 +41,12 @@ toast('Data saved successfully!', {
41
41
  ```javascript
42
42
  toast.success('Saved!');
43
43
  toast.error('Failed!');
44
+ toast.warning('Careful!');
45
+ toast.info('Heads up.');
44
46
  ```
45
47
 
48
+ Each helper returns the toast element, so you can hand it to `toast.update()` later.
49
+
46
50
  ### ⚠️ Confirm (SweetAlert-like)
47
51
  - Promise API
48
52
  ```javascript
@@ -75,13 +79,19 @@ const name = await toast.confirm('Enter your name:', {
75
79
  confirmText: 'Submit',
76
80
  cancelText: 'Cancel',
77
81
  });
78
- if (name) {
79
- console.log('Hello', name);
82
+ if (name !== null) {
83
+ console.log('Hello', name); // may be '' if they submitted an empty field
80
84
  } else {
81
85
  console.log('Cancelled');
82
86
  }
83
87
  ```
84
88
 
89
+ > **Resolution contract.** Without `input`, `toast.confirm()` resolves `true` on confirm and
90
+ > `false` on cancel. With `input`, it resolves the field's **string** value on confirm — which
91
+ > may be `''` — and `null` on cancel. Check against `null`, not truthiness, or an empty
92
+ > submission reads as a cancel. Cancelling, clicking the backdrop and the `(×)` button all
93
+ > resolve the promise.
94
+
85
95
  - Callback API
86
96
  ```javascript
87
97
  toast('Are you sure?', {
@@ -93,6 +103,24 @@ toast('Are you sure?', {
93
103
  });
94
104
  ```
95
105
 
106
+ ### ⌨️ Keyboard and screen readers
107
+
108
+ Confirm dialogs take focus when they open, keep Tab inside themselves while they are
109
+ open, and hand focus back to whatever opened them when they close. Escape cancels, and
110
+ Enter submits a single-line input. Without this the element that opened the dialog kept
111
+ focus behind the backdrop, so Enter or Space re-triggered it and stacked a second dialog.
112
+
113
+ Toast containers are announced as `aria-live="polite"`; `error` and `warning` toasts get
114
+ `role="alert"`. Everything respects `prefers-reduced-motion`.
115
+
116
+ ### ✋ Closing toasts yourself
117
+
118
+ ```javascript
119
+ const t = toast('Working…', { duration: 0 });
120
+ t.close(); // dismiss this one
121
+ toast.dismissAll(); // dismiss everything; open dialogs settle as a cancel
122
+ ```
123
+
96
124
  ### ⏳ Loading → Update
97
125
  ```javascript
98
126
  const t = toast.loading('Uploading…', { type: 'info' });
@@ -104,12 +132,14 @@ t.update('Done!', { type: 'success', duration: 2000 });
104
132
 
105
133
  | Option | Type | Default | Description |
106
134
  |--------------|------------|---------------|-----------------------------------------------------------------------------------------------|
107
- | `position` | `string` | `'top-right'` | Container position. Values: `'top-left'`, `'top-right'`, `'bottom-left'`, `'bottom-right'`, `'top-center'`, `'bottom-center'`. |
135
+ | `position` | `string` | `'top-right'` | Container position. Values: `'top-left'`, `'top-right'`, `'bottom-left'`, `'bottom-right'`, `'top-center'`, `'bottom-center'`, `'center'`. `'center'` places it dead centre of the viewport and defaults to the `zoom-in` animation; it works for plain toasts and for confirm dialogs. |
108
136
  | `animation` | `string` | `'slide-right'` | Show animation. Examples: `'slide-right'`, `'slide-left'`, `'slide-top'`, `'slide-bottom'`, `'zoom-in'`. Hide uses reverse automatically. |
109
137
  | `type` | `string` | `'info'` | Type of toast, controlling icon and styling. Possible values: `'info'`, `'success'`, `'error'`, `'warning'`. |
110
138
  | `duration` | `number` | `3000` | Duration in milliseconds before the toast automatically dismisses. |
111
139
  | `icon` | `string` or `null` | `null` | Optional custom icon displayed as text (e.g., emoji) before the toast message. If not set, a default GIF icon is used based on the `type`. |
112
140
  | `showLoader` | `boolean` | `false` | Whether to show a loader/progress bar animation on the toast during its visible duration. |
141
+ | `allowHtml` | `boolean` | `true` | `message` is written as HTML. Pass `false` to render it as plain text — do that for anything user-supplied, or you have an XSS hole. |
142
+ | `closeOnEscape` | `boolean` | `true` | Confirm dialogs only. Escape cancels the dialog. |
113
143
  | `onClick` | `function` or `null` | `null` | Callback function executed when the toast is clicked. |
114
144
  | `onShow` | `function` or `null` | `null` | Callback function executed when the toast appears (after it's added to the DOM and shown). |
115
145
  | `onDismiss` | `function` or `null` | `null` | Callback function executed when the toast is dismissed and removed from the DOM. |
@@ -52,6 +52,14 @@
52
52
  align-items: center;
53
53
  }
54
54
 
55
+ /* Dead centre of the viewport, for alerts that should not sit in a corner. */
56
+ .ts-toast-container.center {
57
+ top: 50%;
58
+ left: 50%;
59
+ transform: translate(-50%, -50%);
60
+ align-items: center;
61
+ }
62
+
55
63
  /* General Toast styles */
56
64
  .ts-toast-container .ts-toast {
57
65
  display: flex;
@@ -334,6 +342,7 @@
334
342
  .ts-toast-overlay.bottom-left { align-items: flex-end; justify-content: flex-start; padding: 1rem; }
335
343
  .ts-toast-overlay.bottom-center { align-items: flex-end; justify-content: center; padding: 1rem; }
336
344
  .ts-toast-overlay.bottom-right { align-items: flex-end; justify-content: flex-end; padding: 1rem; }
345
+ .ts-toast-overlay.center { align-items: center; justify-content: center; padding: 1rem; }
337
346
 
338
347
  /* Tiny utility: flex icon container */
339
348
  /* Scoped utility to avoid conflicts */
@@ -1 +1 @@
1
- .ts-toast-container{position:fixed;z-index:9999;display:flex;flex-direction:column;gap:10px;pointer-events:none;width:fit-content;max-width:calc(100% - 2rem)}.ts-toast-container>:not(:last-child){margin-bottom:0!important}.ts-toast-container.top-right{top:1rem;right:1rem;align-items:flex-end}.ts-toast-container.top-left{top:1rem;left:1rem;align-items:flex-start}.ts-toast-container.top-center{top:1rem;left:50%;transform:translateX(-50%);align-items:center}.ts-toast-container.bottom-right{bottom:1rem;right:1rem;align-items:flex-end}.ts-toast-container.bottom-left{bottom:1rem;left:1rem;align-items:flex-start}.ts-toast-container.bottom-center{bottom:1rem;left:50%;transform:translateX(-50%);align-items:center}.ts-toast-container .ts-toast{display:flex;align-items:center;gap:.75rem;background-color:var(--toast-bg,#fff);color:var(--toast-color,#000);padding:.75rem 1rem;border-radius:8px;border:1px solid var(--toast-border,#e5e7eb);box-shadow:var(--toast-shadow,0 10px 15px -3px rgba(0,0,0,.1));font-family:sans-serif;font-size:.95rem;pointer-events:all;position:relative;opacity:0;transform:translateY(20px);transition:opacity .5s ease,transform .5s ease;width:auto!important}.ts-toast.ts-toast-confirm{display:flex;align-items:center;justify-content:center;background-color:var(--toast-bg,#fff);color:var(--toast-color,#000);border:1px solid var(--toast-border,#e5e7eb);border-radius:12px;padding:16px 20px;box-shadow:var(--toast-shadow,0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1));transition:opacity .5s ease,transform .5s ease}.ts-toast.ts-toast-confirm .ts-toast-content{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;text-align:center}.ts-toast.ts-toast-confirm .ts-toast-body{text-align:center}.ts-toast-actions{display:flex;gap:10px;justify-content:center;margin-top:12px}.ts-toast-input{width:100%;padding:8px 12px;border:1px solid var(--toast-border,#e5e7eb);border-radius:8px;font-family:inherit;font-size:.95rem;margin-top:12px;background:var(--toast-bg,#fff);color:var(--toast-color,#000);outline:0;transition:border-color .2s ease}.ts-toast-input:focus{border-color:#3b82f6}.ts-toast-container .ts-toast.ts-toast-show{opacity:1;transform:translateY(0)}@keyframes ts-toast-slide-left{from{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes ts-toast-slide-right{from{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes ts-toast-slide-top{from{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes ts-toast-slide-bottom{from{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes ts-toast-zoom-in{from{transform:scale(0)}to{transform:scale(1)}}@keyframes ts-toast-zoom-out{from{transform:scale(1)}to{transform:scale(0)}}@keyframes ts-toast-flip{from{transform:rotateY(90deg)}to{transform:rotateY(0)}}.ts-toast-container .ts-toast-icon{font-size:1.2rem}.ts-toast-container .ts-toast-success .ts-toast-icon{color:var(--toast-success-color,#66ee78)}.ts-toast-container .ts-toast-error .ts-toast-icon{color:var(--toast-error-color,#ef4444)}.ts-toast-container .ts-toast-loader{width:20px;height:20px;border:3px solid #f3f3f3;border-top:3px solid var(--toast-loader-color,#66ee78);border-radius:50%;animation:ts-toast-spin 1s linear infinite}@keyframes ts-toast-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.ts-toast-container .ts-toast-loader.done{animation:none;opacity:0;transition:opacity .5s ease}.ts-toast-container .ts-toast-icon{font-size:1.2rem;opacity:0;transition:opacity .5s ease}.ts-toast-container .ts-toast.ts-toast-show .ts-toast-icon{opacity:1}@keyframes progress-bar{0%{width:0%}100%{width:100%}}@keyframes ts-toast-slide-top-reverse{from{transform:translateY(0)}to{transform:translateY(-100%)}}@keyframes ts-toast-slide-bottom-reverse{from{transform:translateY(0)}to{transform:translateY(100%)}}@keyframes ts-toast-slide-left-reverse{from{transform:translateX(0)}to{transform:translateX(-100%)}}@keyframes ts-toast-slide-right-reverse{from{transform:translateX(0)}to{transform:translateX(100%)}}.ts-toast.ts-toast-slide-out{opacity:0}.ts-toast-overlay{position:fixed;inset:0;background:rgba(0,0,0,.5);display:flex;align-items:center;justify-content:center;z-index:2147483646}.ts-toast-overlay.top-left{align-items:flex-start;justify-content:flex-start;padding:1rem}.ts-toast-overlay.top-center{align-items:flex-start;justify-content:center;padding:1rem}.ts-toast-overlay.top-right{align-items:flex-start;justify-content:flex-end;padding:1rem}.ts-toast-overlay.bottom-left{align-items:flex-end;justify-content:flex-start;padding:1rem}.ts-toast-overlay.bottom-center{align-items:flex-end;justify-content:center;padding:1rem}.ts-toast-overlay.bottom-right{align-items:flex-end;justify-content:flex-end;padding:1rem}.ts-toast-d-flex{display:inline-flex;align-items:center}body.ts-toast-no-scroll{overflow:hidden}
1
+ .ts-toast-container{position:fixed;z-index:9999;display:flex;flex-direction:column;gap:10px;pointer-events:none;width:fit-content;max-width:calc(100% - 2rem)}.ts-toast-container>:not(:last-child){margin-bottom:0!important}.ts-toast-container.top-right{top:1rem;right:1rem;align-items:flex-end}.ts-toast-container.top-left{top:1rem;left:1rem;align-items:flex-start}.ts-toast-container.top-center{top:1rem;left:50%;transform:translateX(-50%);align-items:center}.ts-toast-container.bottom-right{bottom:1rem;right:1rem;align-items:flex-end}.ts-toast-container.bottom-left{bottom:1rem;left:1rem;align-items:flex-start}.ts-toast-container.bottom-center{bottom:1rem;left:50%;transform:translateX(-50%);align-items:center}.ts-toast-container.center{top:50%;left:50%;transform:translate(-50%,-50%);align-items:center}.ts-toast-container .ts-toast{display:flex;align-items:center;gap:.75rem;background-color:var(--toast-bg,#fff);color:var(--toast-color,#000);padding:.75rem 1rem;border-radius:8px;border:1px solid var(--toast-border,#e5e7eb);box-shadow:var(--toast-shadow,0 10px 15px -3px rgba(0,0,0,.1));font-family:sans-serif;font-size:.95rem;pointer-events:all;position:relative;opacity:0;transform:translateY(20px);transition:opacity .5s ease,transform .5s ease;width:auto!important}.ts-toast.ts-toast-confirm{display:flex;align-items:center;justify-content:center;background-color:var(--toast-bg,#fff);color:var(--toast-color,#000);border:1px solid var(--toast-border,#e5e7eb);border-radius:12px;padding:16px 20px;box-shadow:var(--toast-shadow,0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1));transition:opacity .5s ease,transform .5s ease}.ts-toast.ts-toast-confirm .ts-toast-content{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;text-align:center}.ts-toast.ts-toast-confirm .ts-toast-body{text-align:center}.ts-toast-actions{display:flex;gap:10px;justify-content:center;margin-top:12px}.ts-toast-input{width:100%;padding:8px 12px;border:1px solid var(--toast-border,#e5e7eb);border-radius:8px;font-family:inherit;font-size:.95rem;margin-top:12px;background:var(--toast-bg,#fff);color:var(--toast-color,#000);outline:0;transition:border-color .2s ease}.ts-toast-input:focus{border-color:#3b82f6}.ts-toast-container .ts-toast.ts-toast-show{opacity:1;transform:translateY(0)}@keyframes ts-toast-slide-left{from{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes ts-toast-slide-right{from{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes ts-toast-slide-top{from{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes ts-toast-slide-bottom{from{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes ts-toast-zoom-in{from{transform:scale(0)}to{transform:scale(1)}}@keyframes ts-toast-zoom-out{from{transform:scale(1)}to{transform:scale(0)}}@keyframes ts-toast-flip{from{transform:rotateY(90deg)}to{transform:rotateY(0)}}.ts-toast-container .ts-toast-icon{font-size:1.2rem}.ts-toast-container .ts-toast-success .ts-toast-icon{color:var(--toast-success-color,#66ee78)}.ts-toast-container .ts-toast-error .ts-toast-icon{color:var(--toast-error-color,#ef4444)}.ts-toast-container .ts-toast-loader{width:20px;height:20px;border:3px solid #f3f3f3;border-top:3px solid var(--toast-loader-color,#66ee78);border-radius:50%;animation:ts-toast-spin 1s linear infinite}@keyframes ts-toast-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.ts-toast-container .ts-toast-loader.done{animation:none;opacity:0;transition:opacity .5s ease}.ts-toast-container .ts-toast-icon{font-size:1.2rem;opacity:0;transition:opacity .5s ease}.ts-toast-container .ts-toast.ts-toast-show .ts-toast-icon{opacity:1}@keyframes progress-bar{0%{width:0%}100%{width:100%}}@keyframes ts-toast-slide-top-reverse{from{transform:translateY(0)}to{transform:translateY(-100%)}}@keyframes ts-toast-slide-bottom-reverse{from{transform:translateY(0)}to{transform:translateY(100%)}}@keyframes ts-toast-slide-left-reverse{from{transform:translateX(0)}to{transform:translateX(-100%)}}@keyframes ts-toast-slide-right-reverse{from{transform:translateX(0)}to{transform:translateX(100%)}}.ts-toast.ts-toast-slide-out{opacity:0}.ts-toast-overlay{position:fixed;inset:0;background:rgba(0,0,0,.5);display:flex;align-items:center;justify-content:center;z-index:2147483646}.ts-toast-overlay.top-left{align-items:flex-start;justify-content:flex-start;padding:1rem}.ts-toast-overlay.top-center{align-items:flex-start;justify-content:center;padding:1rem}.ts-toast-overlay.top-right{align-items:flex-start;justify-content:flex-end;padding:1rem}.ts-toast-overlay.bottom-left{align-items:flex-end;justify-content:flex-start;padding:1rem}.ts-toast-overlay.bottom-center{align-items:flex-end;justify-content:center;padding:1rem}.ts-toast-overlay.bottom-right{align-items:flex-end;justify-content:flex-end;padding:1rem}.ts-toast-overlay.center{align-items:center;justify-content:center;padding:1rem}.ts-toast-d-flex{display:inline-flex;align-items:center}body.ts-toast-no-scroll{overflow:hidden}
package/package.json CHANGED
@@ -1,33 +1,41 @@
1
1
  {
2
2
  "name": "@tsirosgeorge/toastnotification",
3
- "version": "5.3.3",
3
+ "version": "5.5.0",
4
4
  "description": "a toast notification plugin",
5
5
  "main": "toast.min.js",
6
6
  "module": "toast.module.js",
7
7
  "exports": {
8
8
  ".": {
9
+ "types": "./toast.d.ts",
9
10
  "import": "./toast.module.js",
10
11
  "require": "./toast.min.js"
11
- }
12
+ },
13
+ "./assets/css/toast.css": "./assets/css/toast.css",
14
+ "./assets/css/toast.min.css": "./assets/css/toast.min.css",
15
+ "./package.json": "./package.json"
12
16
  },
13
17
  "scripts": {
14
- "test": "echo \"Error: no test specified\" && exit 1",
15
- "build:css": "cleancss -o assets/css/toast.min.css assets/css/toast.css",
16
- "build:js": "terser toast.js --compress --mangle --output toast.min.js",
17
- "build": "npm run build:css && npm run build:js",
18
- "prepublishOnly": "npm run build",
19
- "release": "npm version && git push origin main --follow-tags && npm publish --access public",
20
- "publish": "npm run build && git add -A && git commit -m \"Release v5.3.2: Add LICENSE file and license documentation\" && git tag v5.3.2 && git push origin main --tags && npm publish --access public"
18
+ "test": "tsc --noEmit --strict --skipLibCheck toast.d.ts",
19
+ "sync:version": "node scripts/sync-version.mjs",
20
+ "build:module": "node scripts/build-module.mjs",
21
+ "build:css": "cleancss -o assets/css/toast.min.css assets/css/toast.css",
22
+ "build:js": "terser toast.js --compress --mangle --output toast.min.js",
23
+ "build": "npm run sync:version && npm run build:module && npm run build:css && npm run build:js",
24
+ "version": "npm run build && git add -A",
25
+ "prepublishOnly": "npm run build",
26
+ "release": "npm version ${V:-patch} && git push origin main --follow-tags"
21
27
  },
22
28
  "files": [
23
29
  "toast.js",
24
30
  "toast.min.js",
25
31
  "toast.module.js",
32
+ "toast.d.ts",
26
33
  "assets/css/toast.css",
27
34
  "assets/css/toast.min.css",
28
35
  "assets/img/",
36
+ "!assets/img/old/",
29
37
  "LICENSE",
30
- "README.md"
38
+ "Readme.md"
31
39
  ],
32
40
  "repository": {
33
41
  "type": "git",
@@ -50,6 +58,14 @@
50
58
  "homepage": "https://github.com/tsirosgeorge/toast-notification#readme",
51
59
  "devDependencies": {
52
60
  "clean-css-cli": "^5.6.3",
53
- "terser": "^5.40.0"
54
- }
55
- }
61
+ "terser": "^5.40.0",
62
+ "typescript": "^5.9.3"
63
+ },
64
+ "types": "toast.d.ts",
65
+ "sideEffects": [
66
+ "./toast.js",
67
+ "./toast.min.js",
68
+ "./toast.module.js",
69
+ "*.css"
70
+ ]
71
+ }
package/toast.d.ts ADDED
@@ -0,0 +1,102 @@
1
+ export type ToastType = 'info' | 'success' | 'warning' | 'error';
2
+
3
+ export type ToastPosition =
4
+ | 'top-left' | 'top-right' | 'top-center'
5
+ | 'bottom-left' | 'bottom-right' | 'bottom-center'
6
+ /** Dead centre of the viewport. Defaults to the zoom-in animation. */
7
+ | 'center';
8
+
9
+ export type ToastAnimation =
10
+ | 'slide-top' | 'slide-bottom' | 'slide-left' | 'slide-right'
11
+ | 'zoom-in' | 'zoom-out' | 'flip';
12
+
13
+ export type ToastInput = 'text' | 'email' | 'password' | 'number' | 'textarea' | false;
14
+
15
+ /** Value handed to a confirm dialog's callbacks and promise. */
16
+ export type ConfirmResult = boolean | string | null;
17
+
18
+ export interface ToastElement extends HTMLDivElement {
19
+ /** Present in confirm mode: resolves when the user confirms, cancels or dismisses. */
20
+ result?: Promise<ConfirmResult>;
21
+ /** Dismiss this toast now. On a confirm dialog this settles as a cancel. */
22
+ close(): void;
23
+ }
24
+
25
+ export interface ToastOptions {
26
+ position?: ToastPosition;
27
+ animation?: ToastAnimation;
28
+ type?: ToastType;
29
+ /** Auto-dismiss delay in ms. `0` keeps the toast until it is closed. */
30
+ duration?: number;
31
+ /** Emoji or text used instead of the bundled animated icon. */
32
+ icon?: string | null;
33
+ showLoader?: boolean;
34
+ /**
35
+ * `message` is written as HTML by default, for backwards compatibility.
36
+ * Pass `false` to render it as plain text — do that for anything user-supplied.
37
+ */
38
+ allowHtml?: boolean;
39
+ /** `'confirm'` (alias `'swal'`) renders a modal dialog instead of a toast. */
40
+ mode?: 'alert' | 'confirm' | 'swal';
41
+ dismissOnClick?: boolean;
42
+ onClick?: (el: ToastElement) => void;
43
+ onShow?: (el: ToastElement) => void;
44
+ onDismiss?: (el: ToastElement) => void;
45
+ }
46
+
47
+ export interface ConfirmOptions extends ToastOptions {
48
+ title?: string | null;
49
+ confirmText?: string;
50
+ cancelText?: string;
51
+ input?: ToastInput;
52
+ inputPlaceholder?: string;
53
+ inputValue?: string;
54
+ confirmButtonBg?: string | null;
55
+ confirmButtonColor?: string | null;
56
+ cancelButtonBg?: string | null;
57
+ cancelButtonColor?: string | null;
58
+ useOverlay?: boolean;
59
+ closeOnOverlayClick?: boolean;
60
+ /** Escape cancels the dialog. Defaults to true. */
61
+ closeOnEscape?: boolean;
62
+ showClose?: boolean;
63
+ /** Receives the input's value when `input` is set, otherwise `true`. */
64
+ onConfirm?: (value: string | true, el: ToastElement) => void;
65
+ onCancel?: (el: ToastElement) => void;
66
+ onResult?: (result: ConfirmResult, el: ToastElement) => void;
67
+ }
68
+
69
+ export interface LoadingHandle {
70
+ update(message: string, options?: ToastOptions): void;
71
+ close(): void;
72
+ }
73
+
74
+ export interface Toast {
75
+ (message: string, options?: ToastOptions | ConfirmOptions): ToastElement;
76
+ success(message: string, options?: ToastOptions): ToastElement;
77
+ error(message: string, options?: ToastOptions): ToastElement;
78
+ warning(message: string, options?: ToastOptions): ToastElement;
79
+ info(message: string, options?: ToastOptions): ToastElement;
80
+ update(el: ToastElement, message: string, options?: ToastOptions): void;
81
+ loading(message: string, options?: ToastOptions): LoadingHandle;
82
+ /**
83
+ * Without `input`: resolves `true` on confirm, `false` on cancel/dismiss.
84
+ * With `input`: resolves the input's string value on confirm (possibly `''`),
85
+ * and `null` on cancel/dismiss — so an empty submission is not read as a cancel.
86
+ */
87
+ confirm(message: string, options?: ConfirmOptions): Promise<ConfirmResult>;
88
+ /** Dismiss every toast on screen; open confirm dialogs settle as a cancel. */
89
+ dismissAll(): void;
90
+ }
91
+
92
+ declare const toast: Toast;
93
+ export default toast;
94
+ export { toast };
95
+
96
+ declare global {
97
+ interface Window {
98
+ toast: Toast;
99
+ /** Set before loading the script to skip the CDN stylesheet injection. */
100
+ TS_TOAST_NO_CSS?: boolean;
101
+ }
102
+ }