vetra-toast 0.0.0-stage → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +320 -2
- package/dist/animations/index.d.ts +7 -0
- package/dist/animations/index.d.ts.map +1 -0
- package/dist/components/ToastIcon.d.ts +10 -0
- package/dist/components/ToastIcon.d.ts.map +1 -0
- package/dist/components/ToastItem.d.ts +33 -0
- package/dist/components/ToastItem.d.ts.map +1 -0
- package/dist/components/ToastProgress.d.ts +14 -0
- package/dist/components/ToastProgress.d.ts.map +1 -0
- package/dist/components/Toaster.d.ts +9 -0
- package/dist/components/Toaster.d.ts.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/store.d.ts +48 -0
- package/dist/core/store.d.ts.map +1 -0
- package/dist/core/timer.d.ts +25 -0
- package/dist/core/timer.d.ts.map +1 -0
- package/dist/core/toast-api.d.ts +19 -0
- package/dist/core/toast-api.d.ts.map +1 -0
- package/dist/core-CqZy4LyN.cjs +893 -0
- package/dist/core-CqZy4LyN.cjs.map +1 -0
- package/dist/core-KMoYj72S.js +804 -0
- package/dist/core-KMoYj72S.js.map +1 -0
- package/dist/core.cjs +9 -0
- package/dist/core.js +1 -0
- package/dist/hooks/use-mounted.d.ts +2 -0
- package/dist/hooks/use-mounted.d.ts.map +1 -0
- package/dist/hooks/use-swipe.d.ts +27 -0
- package/dist/hooks/use-swipe.d.ts.map +1 -0
- package/dist/hooks/use-system-theme.d.ts +3 -0
- package/dist/hooks/use-system-theme.d.ts.map +1 -0
- package/dist/hooks/use-toasts.d.ts +4 -0
- package/dist/hooks/use-toasts.d.ts.map +1 -0
- package/dist/index.cjs +1057 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1043 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +1419 -0
- package/dist/styles.css.d.ts +1 -0
- package/dist/types/index.d.ts +251 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/dom.d.ts +4 -0
- package/dist/utils/dom.d.ts.map +1 -0
- package/dist/utils/feedback.d.ts +4 -0
- package/dist/utils/feedback.d.ts.map +1 -0
- package/dist/utils/id.d.ts +3 -0
- package/dist/utils/id.d.ts.map +1 -0
- package/dist/utils/merge.d.ts +8 -0
- package/dist/utils/merge.d.ts.map +1 -0
- package/package.json +88 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mobarok (https://www.mobarok.me)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,321 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# Vetra Toast
|
|
4
|
+
|
|
5
|
+
**Premium glassmorphism toast notifications for modern React and Next.js applications.**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/vetra-toast)
|
|
8
|
+
[](https://www.npmjs.com/package/vetra-toast)
|
|
9
|
+
[](https://www.typescriptlang.org/)
|
|
10
|
+
[](https://www.npmjs.com/package/vetra-toast)
|
|
11
|
+
[](https://github.com/immobarok/vetra-toast/blob/main/LICENSE)
|
|
12
|
+
|
|
13
|
+
[Installation](#installation) • [Quick Start](#quick-start) • [API Reference](#api-reference) • [Customization](#customization) • [Next.js Setup](#nextjs-app-router) • [Accessibility](#accessibility)
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Why Vetra Toast?
|
|
20
|
+
|
|
21
|
+
- **Signature Frosted Glass UI** — Layered `backdrop-filter` blur, prismatic top specular edge, semantic corner aura, and four glass presets (`subtle`, `frosted`, `crystal`, `solid`).
|
|
22
|
+
- **Bespoke Animated SVG Icons** — Hand-crafted micro-animations per variant (spring-drawn success check with sparkles, dual-stroke error shield with micro-shake, warning prism, orbital info glint, and dual-ring gyroscope loader).
|
|
23
|
+
- **Zero Runtime Dependencies** — No mandatory Tailwind CSS or animation libraries. Tree-shakeable ESM + CJS with standalone `vetra-toast/styles.css`.
|
|
24
|
+
- **Framework-Agnostic Core** — Predictable external store (`useSyncExternalStore`) with FIFO queue promotion, reference-counted multi-reason pause/resume (`hover`, `focus`, `document-hidden`, `swipe`), and duplicate prevention.
|
|
25
|
+
- **Next.js App Router & SSR Safe** — Ships `"use client"` on the React entry, defers portal mounting until client hydration, and keeps browser APIs out of module initialization.
|
|
26
|
+
- **Accessibility First** — Semantic `role="alert"` / `role="status"`, `aria-live`, `Alt+T` focus hotkey, `Escape` dismissal, `prefers-reduced-motion`, and `prefers-reduced-transparency` fallbacks.
|
|
27
|
+
- **Rich Sensory Feedback** — Optional subtle synthesized Web Audio chimes and mobile haptic vibration (`navigator.vibrate`), zero audio asset downloads.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pnpm add vetra-toast
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install vetra-toast
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
yarn add vetra-toast
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
> **Peer dependencies**: `react >= 18` and `react-dom >= 18` (built and tested with React 19.3+).
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
Import the stylesheet once in your app entry, mount `<Toaster />` near the root, and call `toast` from anywhere:
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
import { Toaster, toast } from "vetra-toast";
|
|
55
|
+
import "vetra-toast/styles.css";
|
|
56
|
+
|
|
57
|
+
export function App() {
|
|
58
|
+
return (
|
|
59
|
+
<>
|
|
60
|
+
<Toaster position="top-right" theme="dark" />
|
|
61
|
+
|
|
62
|
+
<button onClick={() => toast.success("Profile updated!")}>
|
|
63
|
+
Save Profile
|
|
64
|
+
</button>
|
|
65
|
+
</>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Next.js App Router
|
|
73
|
+
|
|
74
|
+
Mount `<Toaster />` directly inside your Server Component root layout (`app/layout.tsx`) with zero hydration warnings:
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
// app/layout.tsx
|
|
78
|
+
import type { ReactNode } from "react";
|
|
79
|
+
import { Toaster } from "vetra-toast";
|
|
80
|
+
import "vetra-toast/styles.css";
|
|
81
|
+
|
|
82
|
+
export default function RootLayout({ children }: { children: ReactNode }) {
|
|
83
|
+
return (
|
|
84
|
+
<html lang="en">
|
|
85
|
+
<body>
|
|
86
|
+
{children}
|
|
87
|
+
<Toaster position="top-right" theme="system" />
|
|
88
|
+
</body>
|
|
89
|
+
</html>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Then trigger toasts from any Client Component (`"use client"`):
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
"use client";
|
|
98
|
+
|
|
99
|
+
import { toast } from "vetra-toast";
|
|
100
|
+
|
|
101
|
+
export function SaveButton() {
|
|
102
|
+
return (
|
|
103
|
+
<button onClick={() => toast.success("Saved to cloud!")}>
|
|
104
|
+
Save Changes
|
|
105
|
+
</button>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## API Reference
|
|
113
|
+
|
|
114
|
+
### Variants
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
toast("Default notification");
|
|
118
|
+
toast.success("Profile updated!", { description: "Your preferences are synced." });
|
|
119
|
+
toast.error("Something went wrong!", { description: "Please check your connection." });
|
|
120
|
+
toast.warning("Session expiring!", { description: "Sign in again within 2 minutes." });
|
|
121
|
+
toast.info("New update available!");
|
|
122
|
+
toast.loading("Uploading artifact...");
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Promise Notifications
|
|
126
|
+
|
|
127
|
+
Automatically transitions a single toast from `loading` → `success` or `error`. Rejections are handled internally so fire-and-forget usage never triggers unhandled promise rejections; call `.unwrap()` when you want the original promise result:
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
const req = toast.promise(uploadFile(), {
|
|
131
|
+
loading: "Uploading...",
|
|
132
|
+
success: (file) => `Uploaded ${file.name}!`,
|
|
133
|
+
error: (err) => `Upload failed: ${err.message}`,
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// Optional: await resolved data or catch rejection
|
|
137
|
+
// const file = await req.unwrap();
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Update, Dismiss & Dismiss All
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
const id = toast.loading("Deploying to production...");
|
|
144
|
+
|
|
145
|
+
toast.update(id, {
|
|
146
|
+
variant: "success",
|
|
147
|
+
title: "Deployment live!",
|
|
148
|
+
description: "All health checks passed.",
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
toast.dismiss(id);
|
|
152
|
+
toast.dismissAll();
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Action Buttons, Custom Icons & Custom JSX
|
|
156
|
+
|
|
157
|
+
```tsx
|
|
158
|
+
toast.warning("File moved to trash", {
|
|
159
|
+
description: "Restore it within 30 days.",
|
|
160
|
+
action: {
|
|
161
|
+
label: "Undo",
|
|
162
|
+
onClick: () => restoreFile(),
|
|
163
|
+
},
|
|
164
|
+
cancel: {
|
|
165
|
+
label: "Dismiss",
|
|
166
|
+
onClick: () => {},
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
toast.custom(({ dismiss }) => (
|
|
171
|
+
<div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", gap: 12 }}>
|
|
172
|
+
<strong>Custom Glass Widget</strong>
|
|
173
|
+
<button type="button" onClick={dismiss}>Close</button>
|
|
174
|
+
</div>
|
|
175
|
+
));
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Duplicate Prevention
|
|
179
|
+
|
|
180
|
+
```ts
|
|
181
|
+
// Global: <Toaster preventDuplicates />
|
|
182
|
+
// Or per-toast:
|
|
183
|
+
toast.info("Connection restored", {
|
|
184
|
+
dedupe: true,
|
|
185
|
+
dedupeKey: "network-status",
|
|
186
|
+
});
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Repeated triggers increment a sleek `×2`, `×3` counter badge and reset the auto-dismiss timer instead of flooding the screen.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## `<Toaster />` Props
|
|
194
|
+
|
|
195
|
+
| Prop | Type | Default | Description |
|
|
196
|
+
| :--- | :--- | :--- | :--- |
|
|
197
|
+
| `position` | `"top-left" \| "top-center" \| "top-right" \| "bottom-left" \| "bottom-center" \| "bottom-right"` | `"top-right"` | Viewport anchor (auto-centered on mobile `<= 640px`) |
|
|
198
|
+
| `theme` | `"dark" \| "light" \| "system"` | `"dark"` | Glassmorphism theme mode |
|
|
199
|
+
| `glass` | `"subtle" \| "frosted" \| "crystal" \| "solid"` | `"frosted"` | Glass blur & surface intensity preset |
|
|
200
|
+
| `radius` | `"sm" \| "md" \| "lg" \| "pill"` | `"md"` | Corner radius preset |
|
|
201
|
+
| `size` | `"compact" \| "default" \| "comfortable"` | `"default"` | Spacing & typography density |
|
|
202
|
+
| `animation` | `"spring" \| "slide" \| "fade" \| "zoom" \| "bounce" \| "none"` | `"bounce"` | Entrance & exit animation style |
|
|
203
|
+
| `iconAnimation` | `"default" \| "subtle" \| "none" \| boolean` | `"default"` | Control animated SVG icon motion |
|
|
204
|
+
| `ambientGlow` | `boolean` | `true` | Semantic corner aura glow behind the icon |
|
|
205
|
+
| `richColors` | `boolean` | `false` | Apply subtle semantic tint to glass surface & border |
|
|
206
|
+
| `duration` | `number` | `4000` | Default auto-dismiss duration in ms (`Infinity` disables) |
|
|
207
|
+
| `visibleToasts` | `number` | `4` | Max visible toasts; overflow queues in FIFO order |
|
|
208
|
+
| `expand` | `boolean` | `false` | Stacked depth mode by default (fans open on hover/focus) |
|
|
209
|
+
| `showProgress` | `boolean` | `false` | Synchronized countdown progress bar |
|
|
210
|
+
| `progressPosition` | `"bottom" \| "top"` | `"bottom"` | Progress bar edge placement |
|
|
211
|
+
| `progressHeight` | `number` | `3` | Progress bar height in px |
|
|
212
|
+
| `closeButton` | `boolean` | `true` | Render accessible dismiss button |
|
|
213
|
+
| `closeButtonPosition` | `"top-right" \| "top-left" \| "floating"` | `"floating"` | Close button placement |
|
|
214
|
+
| `showCloseOnHover` | `boolean` | `true` | Reveal close button on hover or keyboard focus |
|
|
215
|
+
| `pauseOnHover` | `boolean` | `true` | Pause auto-dismiss timer while hovered |
|
|
216
|
+
| `pauseOnFocus` | `boolean` | `true` | Pause auto-dismiss timer while focused |
|
|
217
|
+
| `swipeToDismiss` | `boolean` | `true` | Enable pointer/touch swipe dismissal |
|
|
218
|
+
| `swipeDirections` | `Array<"left" \| "right" \| "up" \| "down">` | Position-based | Override allowed swipe directions |
|
|
219
|
+
| `preventDuplicates` | `boolean` | `false` | Deduplicate matching active toasts globally |
|
|
220
|
+
| `hotkey` | `string[]` | `["altKey", "KeyT"]` | Global keyboard shortcut to focus notifications |
|
|
221
|
+
| `sound` | `boolean` | `true` | Subtle synthesized Web Audio chime |
|
|
222
|
+
| `haptic` | `boolean` | `true` | Mobile `navigator.vibrate` haptic pulse |
|
|
223
|
+
| `onToastShow` | `(toast: ToastRecord) => void` | — | Callback fired when a toast becomes visible |
|
|
224
|
+
| `themeTokens` | `VetraThemeTokens` | — | Inline CSS custom property overrides |
|
|
225
|
+
| `icons` | `ToastIcons` | — | Global custom icons (`success`, `error`, `warning`, `info`, `loading`, `close`) |
|
|
226
|
+
| `classNames` | `ToastClassNames` | — | Granular slot class names (`toast`, `title`, `description`, `icon`, `actionButton`, `closeButton`, `progress`, etc.) |
|
|
227
|
+
| `toastOptions` | `ToastDefaultOptions` | — | Global & per-variant default options |
|
|
228
|
+
| `gap` / `offset` | `number` / `number \| string` | `12` / `20` | Stack gap and viewport offset |
|
|
229
|
+
| `portalContainer` | `HTMLElement \| null` | `document.body` | Custom React Portal mount target |
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Customization
|
|
234
|
+
|
|
235
|
+
### Inline Theme Tokens & Per-Variant Defaults
|
|
236
|
+
|
|
237
|
+
```tsx
|
|
238
|
+
<Toaster
|
|
239
|
+
theme="dark"
|
|
240
|
+
glass="crystal"
|
|
241
|
+
radius="lg"
|
|
242
|
+
animation="spring"
|
|
243
|
+
showProgress
|
|
244
|
+
progressPosition="top"
|
|
245
|
+
themeTokens={{
|
|
246
|
+
blur: 28,
|
|
247
|
+
width: 400,
|
|
248
|
+
success: "#10b981",
|
|
249
|
+
error: "#f43f5e",
|
|
250
|
+
}}
|
|
251
|
+
toastOptions={{
|
|
252
|
+
success: { duration: 2500 },
|
|
253
|
+
error: { duration: 6000 },
|
|
254
|
+
}}
|
|
255
|
+
/>
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### CSS Custom Properties
|
|
259
|
+
|
|
260
|
+
Override any `--vt-*` variable directly in CSS:
|
|
261
|
+
|
|
262
|
+
```css
|
|
263
|
+
:root {
|
|
264
|
+
--vt-blur: 24px;
|
|
265
|
+
--vt-saturate: 195%;
|
|
266
|
+
--vt-radius: 18px;
|
|
267
|
+
--vt-width: 390px;
|
|
268
|
+
--vt-success: #34d399;
|
|
269
|
+
--vt-error: #fb7185;
|
|
270
|
+
--vt-warning: #fbbf24;
|
|
271
|
+
--vt-info: #38bdf8;
|
|
272
|
+
--vt-loading: #a78bfa;
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Granular Slot Styling (`classNames`)
|
|
277
|
+
|
|
278
|
+
Style any internal element with Tailwind CSS or CSS Modules:
|
|
279
|
+
|
|
280
|
+
```tsx
|
|
281
|
+
<Toaster
|
|
282
|
+
classNames={{
|
|
283
|
+
toast: "shadow-2xl",
|
|
284
|
+
title: "tracking-tight",
|
|
285
|
+
description: "text-xs opacity-80",
|
|
286
|
+
actionButton: "rounded-full",
|
|
287
|
+
closeButton: "hover:scale-110",
|
|
288
|
+
}}
|
|
289
|
+
/>
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## Framework-Agnostic Core (`vetra-toast/core`)
|
|
295
|
+
|
|
296
|
+
Import the notification store and timer engine without pulling React into non-UI modules:
|
|
297
|
+
|
|
298
|
+
```ts
|
|
299
|
+
import { createToastStore, createToastApi, defaultToastStore } from "vetra-toast/core";
|
|
300
|
+
|
|
301
|
+
const store = createToastStore({ visibleToasts: 3, defaultDuration: 3500 });
|
|
302
|
+
const api = createToastApi(store);
|
|
303
|
+
api.success("Triggered outside React");
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## Accessibility
|
|
309
|
+
|
|
310
|
+
- **Semantic Live Regions**: `error` and `warning` use `role="alert"` (`aria-live="assertive"`); `success`, `info`, and `loading` use `role="status"` (`aria-live="polite"`).
|
|
311
|
+
- **Keyboard Control**: Press `Alt+T` to focus active notifications, `Tab` through actions/close buttons with high-visibility focus rings, or press `Escape` to dismiss.
|
|
312
|
+
- **Tab Visibility Awareness**: Timers pause automatically when the browser tab goes hidden (`document.visibilitychange`) and resume when returning.
|
|
313
|
+
- **OS Preferences**: Automatic `@media (prefers-reduced-transparency: reduce)` solid surface fallback and `@media (prefers-reduced-motion: reduce)` gentle fade transitions.
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
## Author & License
|
|
318
|
+
|
|
319
|
+
Created by **[Mobarok](https://www.mobarok.me)** ([GitHub @immobarok](https://github.com/immobarok)).
|
|
320
|
+
|
|
321
|
+
Licensed under the [MIT License](https://github.com/immobarok/vetra-toast/blob/main/LICENSE).
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SwipeDirection, ToastPosition } from "../types/index.js";
|
|
2
|
+
export declare const DEFAULT_EXIT_DURATION_MS = 240;
|
|
3
|
+
export declare const SWIPE_DISMISS_THRESHOLD_PX = 84;
|
|
4
|
+
export declare const SWIPE_VELOCITY_THRESHOLD = 0.45;
|
|
5
|
+
export declare const SWIPE_DRAG_DAMPENING = 0.35;
|
|
6
|
+
export declare function getDefaultSwipeDirections(position: ToastPosition): readonly SwipeDirection[];
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/animations/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvE,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAC5C,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAC7C,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAC7C,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAEzC,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,aAAa,GAAG,SAAS,cAAc,EAAE,CAW5F"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { ToastIconAnimationMode, ToastVariant } from "../types/index.js";
|
|
3
|
+
export interface ToastIconProps {
|
|
4
|
+
variant: ToastVariant;
|
|
5
|
+
icon?: ReactNode;
|
|
6
|
+
animationMode?: ToastIconAnimationMode;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function ToastIcon({ variant, icon, animationMode, className, }: ToastIconProps): ReactNode;
|
|
10
|
+
//# sourceMappingURL=ToastIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastIcon.d.ts","sourceRoot":"","sources":["../../src/components/ToastIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAS,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG9E,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,YAAY,CAAC;IACtB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,SAAS,CAAC,EACxB,OAAO,EACP,IAAI,EACJ,aAAyB,EACzB,SAAS,GACV,EAAE,cAAc,GAAG,SAAS,CA2U5B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { ToastStore } from "../core/store.js";
|
|
3
|
+
import type { SwipeDirection, ToastAnimationPreset, ToastClassNames, ToastCloseButtonPosition, ToastGlassPreset, ToastIconAnimation, ToastIcons, ToastPosition, ToastProgressPosition, ToastRadiusPreset, ToastRecord, ToastSize } from "../types/index.js";
|
|
4
|
+
export interface ToastItemProps {
|
|
5
|
+
toast: ToastRecord;
|
|
6
|
+
index: number;
|
|
7
|
+
total: number;
|
|
8
|
+
position: ToastPosition;
|
|
9
|
+
expanded: boolean;
|
|
10
|
+
store: ToastStore;
|
|
11
|
+
glassDefault: ToastGlassPreset;
|
|
12
|
+
radiusDefault: ToastRadiusPreset;
|
|
13
|
+
sizeDefault: ToastSize;
|
|
14
|
+
ambientGlowDefault: boolean;
|
|
15
|
+
animationDefault: ToastAnimationPreset;
|
|
16
|
+
iconAnimationDefault: ToastIconAnimation;
|
|
17
|
+
showCloseButton: boolean;
|
|
18
|
+
closeButtonPositionDefault: ToastCloseButtonPosition;
|
|
19
|
+
showCloseOnHoverDefault: boolean;
|
|
20
|
+
showProgressDefault: boolean;
|
|
21
|
+
progressPositionDefault: ToastProgressPosition;
|
|
22
|
+
progressHeightDefault: number;
|
|
23
|
+
pauseOnHoverDefault: boolean;
|
|
24
|
+
pauseOnFocusDefault: boolean;
|
|
25
|
+
swipeToDismissDefault: boolean;
|
|
26
|
+
swipeDirectionsDefault?: readonly SwipeDirection[];
|
|
27
|
+
richColors: boolean;
|
|
28
|
+
icons?: ToastIcons;
|
|
29
|
+
classNames?: ToastClassNames;
|
|
30
|
+
toastClassName?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare const ToastItem: import("react").MemoExoticComponent<({ toast, index, total, position, expanded, store, glassDefault, radiusDefault, sizeDefault, ambientGlowDefault, animationDefault, iconAnimationDefault, showCloseButton, closeButtonPositionDefault, showCloseOnHoverDefault, showProgressDefault, progressPositionDefault, progressHeightDefault, pauseOnHoverDefault, pauseOnFocusDefault, swipeToDismissDefault, swipeDirectionsDefault, richColors, icons, classNames, toastClassName, }: ToastItemProps) => ReactNode>;
|
|
33
|
+
//# sourceMappingURL=ToastItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastItem.d.ts","sourceRoot":"","sources":["../../src/components/ToastItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,EACV,aAAa,EACb,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,EACX,SAAS,EAEV,MAAM,mBAAmB,CAAC;AAK3B,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,aAAa,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,UAAU,CAAC;IAClB,YAAY,EAAE,gBAAgB,CAAC;IAC/B,aAAa,EAAE,iBAAiB,CAAC;IACjC,WAAW,EAAE,SAAS,CAAC;IACvB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,gBAAgB,EAAE,oBAAoB,CAAC;IACvC,oBAAoB,EAAE,kBAAkB,CAAC;IACzC,eAAe,EAAE,OAAO,CAAC;IACzB,0BAA0B,EAAE,wBAAwB,CAAC;IACrD,uBAAuB,EAAE,OAAO,CAAC;IACjC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,uBAAuB,EAAE,qBAAqB,CAAC;IAC/C,qBAAqB,EAAE,MAAM,CAAC;IAC9B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,sBAAsB,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IACnD,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAyBD,eAAO,MAAM,SAAS,qdA2BnB,cAAc,KAAG,SAAS,CAsR3B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ToastProgressPosition, ToastVariant } from "../types/index.js";
|
|
3
|
+
export interface ToastProgressProps {
|
|
4
|
+
duration: number;
|
|
5
|
+
paused: boolean;
|
|
6
|
+
variant: ToastVariant;
|
|
7
|
+
resetKey: string;
|
|
8
|
+
position?: ToastProgressPosition;
|
|
9
|
+
height?: number;
|
|
10
|
+
trackClassName?: string;
|
|
11
|
+
barClassName?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function ToastProgress({ duration, paused, variant, resetKey, position, height, trackClassName, barClassName, }: ToastProgressProps): ReactNode;
|
|
14
|
+
//# sourceMappingURL=ToastProgress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastProgress.d.ts","sourceRoot":"","sources":["../../src/components/ToastProgress.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG7E,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAmB,EACnB,MAAU,EACV,cAAc,EACd,YAAY,GACb,EAAE,kBAAkB,GAAG,SAAS,CA8BhC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type ToastStore } from "../core/store.js";
|
|
3
|
+
import type { ToasterProps } from "../types/index.js";
|
|
4
|
+
export interface InternalToasterProps extends ToasterProps {
|
|
5
|
+
/** Optional isolated store instance (defaults to global defaultToastStore). */
|
|
6
|
+
store?: ToastStore;
|
|
7
|
+
}
|
|
8
|
+
export declare function Toaster({ position, theme, duration, visibleToasts, gap, offset, expand, glass, radius, size, ambientGlow, themeTokens, animation, iconAnimation, progressPosition, progressHeight, pauseOnHover, pauseOnFocus, swipeToDismiss, swipeDirections, showProgress, closeButton, closeButtonPosition, showCloseOnHover, preventDuplicates, richColors, icons, classNames, hotkey, sound, haptic, onToastShow, toastOptions, dir, className, toastClassName, style, containerAriaLabel, portalContainer, exitDuration, store, }: InternalToasterProps): ReactNode;
|
|
9
|
+
//# sourceMappingURL=Toaster.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toaster.d.ts","sourceRoot":"","sources":["../../src/components/Toaster.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,SAAS,EAAwC,MAAM,OAAO,CAAC;AAGjG,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAItE,OAAO,KAAK,EAAE,YAAY,EAA8B,MAAM,mBAAmB,CAAC;AA8BlF,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,+EAA+E;IAC/E,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAED,wBAAgB,OAAO,CAAC,EACtB,QAAsB,EACtB,KAAc,EACd,QAAe,EACf,aAAiB,EACjB,GAAQ,EACR,MAAW,EACX,MAAc,EACd,KAAiB,EACjB,MAAa,EACb,IAAgB,EAChB,WAAkB,EAClB,WAAW,EACX,SAAoB,EACpB,aAAyB,EACzB,gBAA2B,EAC3B,cAAkB,EAClB,YAAmB,EACnB,YAAmB,EACnB,cAAqB,EACrB,eAAe,EACf,YAAoB,EACpB,WAAkB,EAClB,mBAAgC,EAChC,gBAAuB,EACvB,iBAAyB,EACzB,UAAkB,EAClB,KAAK,EACL,UAAU,EACV,MAAuB,EACvB,KAAY,EACZ,MAAa,EACb,WAAW,EACX,YAAY,EACZ,GAAW,EACX,SAAS,EACT,cAAc,EACd,KAAK,EACL,kBAAoC,EACpC,eAAe,EACf,YAAuC,EACvC,KAAyB,GAC1B,EAAE,oBAAoB,GAAG,SAAS,CA+LlC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createToastStore, defaultToastStore, EMPTY_SNAPSHOT, type StoreListener, ToastStore, } from "./store.js";
|
|
2
|
+
export { type Clock, PauseableTimer } from "./timer.js";
|
|
3
|
+
export { createToastApi, type ToastApi, toast } from "./toast-api.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,KAAK,aAAa,EAClB,UAAU,GACX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,KAAK,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { PauseReason, ToastOptions, ToastStoreConfig, ToastStoreSnapshot, ToastUpdateOptions } from "../types/index.js";
|
|
2
|
+
import { type Clock } from "./timer.js";
|
|
3
|
+
export type StoreListener = () => void;
|
|
4
|
+
export declare const EMPTY_SNAPSHOT: ToastStoreSnapshot;
|
|
5
|
+
export declare class ToastStore {
|
|
6
|
+
private toasts;
|
|
7
|
+
private queue;
|
|
8
|
+
private snapshot;
|
|
9
|
+
private config;
|
|
10
|
+
private readonly listeners;
|
|
11
|
+
private readonly autoCloseTimers;
|
|
12
|
+
private readonly exitTimers;
|
|
13
|
+
private readonly clock;
|
|
14
|
+
constructor(initialConfig?: Partial<ToastStoreConfig>, clock?: Clock);
|
|
15
|
+
configure(next: Partial<ToastStoreConfig>): void;
|
|
16
|
+
getConfig(): Readonly<ToastStoreConfig>;
|
|
17
|
+
subscribe: (listener: StoreListener) => (() => void);
|
|
18
|
+
getSnapshot: () => ToastStoreSnapshot;
|
|
19
|
+
getServerSnapshot: () => ToastStoreSnapshot;
|
|
20
|
+
add(rawOptions: ToastOptions): string;
|
|
21
|
+
update(id: string, patch: ToastUpdateOptions): boolean;
|
|
22
|
+
dismiss(id: string, reason?: "user" | "auto"): boolean;
|
|
23
|
+
dismissAll(): void;
|
|
24
|
+
pause(id: string, reason?: PauseReason): void;
|
|
25
|
+
resume(id: string, reason?: PauseReason): void;
|
|
26
|
+
pauseAll(reason?: PauseReason): void;
|
|
27
|
+
resumeAll(reason?: PauseReason): void;
|
|
28
|
+
getRemainingTime(id: string): number;
|
|
29
|
+
removeImmediately(id: string): void;
|
|
30
|
+
clear(): void;
|
|
31
|
+
destroy(): void;
|
|
32
|
+
private applyPatch;
|
|
33
|
+
private syncTimerAfterUpdate;
|
|
34
|
+
private bumpDuplicate;
|
|
35
|
+
private startAutoCloseTimer;
|
|
36
|
+
private clearAutoCloseTimer;
|
|
37
|
+
private scheduleExitRemoval;
|
|
38
|
+
private clearExitTimer;
|
|
39
|
+
private promoteFromQueue;
|
|
40
|
+
private promoteFromQueueInternal;
|
|
41
|
+
private countActiveVisible;
|
|
42
|
+
private findActive;
|
|
43
|
+
private findByDedupeKey;
|
|
44
|
+
private commit;
|
|
45
|
+
}
|
|
46
|
+
export declare function createToastStore(config?: Partial<ToastStoreConfig>, clock?: Clock): ToastStore;
|
|
47
|
+
export declare const defaultToastStore: ToastStore;
|
|
48
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/core/store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EAEX,YAAY,EAEZ,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAGnB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,KAAK,KAAK,EAAkB,MAAM,YAAY,CAAC;AAExD,MAAM,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC;AAUvC,eAAO,MAAM,cAAc,EAAE,kBAG3B,CAAC;AAsFH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,QAAQ,CAAsC;IACtD,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA4B;IACtD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqC;IACrE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoD;IAC/E,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;IAE9B,YAAY,aAAa,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,EAAE,KAAK,GAAE,KAAiC,EAG9F;IAEM,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAStD;IAEM,SAAS,IAAI,QAAQ,CAAC,gBAAgB,CAAC,CAE7C;IAEM,SAAS,aAAc,aAAa,KAAG,CAAC,MAAM,IAAI,CAAC,CAKxD;IAEK,WAAW,QAAO,kBAAkB,CAEzC;IAEK,iBAAiB,QAAO,kBAAkB,CAE/C;IAEK,GAAG,CAAC,UAAU,EAAE,YAAY,GAAG,MAAM,CA6G3C;IAEM,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAkC5D;IAEM,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,MAAe,GAAG,OAAO,CA+CpE;IAEM,UAAU,IAAI,IAAI,CAmCxB;IAEM,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,GAAE,WAAsB,GAAG,IAAI,CAmC7D;IAEM,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,GAAE,WAAsB,GAAG,IAAI,CA8B9D;IAEM,QAAQ,CAAC,MAAM,GAAE,WAAsB,GAAG,IAAI,CAMpD;IAEM,SAAS,CAAC,MAAM,GAAE,WAAsB,GAAG,IAAI,CAMrD;IAEM,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAO1C;IAEM,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAazC;IAEM,KAAK,IAAI,IAAI,CAgBnB;IAEM,OAAO,IAAI,IAAI,CAGrB;IAED,OAAO,CAAC,UAAU;IAgGlB,OAAO,CAAC,oBAAoB;IAoB5B,OAAO,CAAC,aAAa;IAiDrB,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,mBAAmB;IAQ3B,OAAO,CAAC,mBAAmB;IAW3B,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,wBAAwB;IA2BhC,OAAO,CAAC,kBAAkB;IAU1B,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,MAAM;CASf;AAED,wBAAgB,gBAAgB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,UAAU,CAE9F;AAED,eAAO,MAAM,iBAAiB,YAAqB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface Clock {
|
|
2
|
+
now: () => number;
|
|
3
|
+
}
|
|
4
|
+
export declare class PauseableTimer {
|
|
5
|
+
private readonly onComplete;
|
|
6
|
+
private readonly clock;
|
|
7
|
+
private timerId;
|
|
8
|
+
private duration;
|
|
9
|
+
private remaining;
|
|
10
|
+
private startedAt;
|
|
11
|
+
private paused;
|
|
12
|
+
private completed;
|
|
13
|
+
constructor(duration: number, onComplete: () => void, clock?: Clock);
|
|
14
|
+
start(): void;
|
|
15
|
+
pause(): number;
|
|
16
|
+
resume(): void;
|
|
17
|
+
reset(newDuration: number, autoStart?: boolean): void;
|
|
18
|
+
getRemaining(): number;
|
|
19
|
+
getDuration(): number;
|
|
20
|
+
isPaused(): boolean;
|
|
21
|
+
isRunning(): boolean;
|
|
22
|
+
clear(): void;
|
|
23
|
+
private clearHandle;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=timer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../../src/core/timer.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,MAAM,MAAM,CAAC;CACnB;AAMD,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;IAC9B,OAAO,CAAC,OAAO,CAA8C;IAC7D,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAS;IAE1B,YAAY,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,IAAI,EAAE,KAAK,GAAE,KAAoB,EAKhF;IAEM,KAAK,IAAI,IAAI,CAcnB;IAEM,KAAK,IAAI,MAAM,CAYrB;IAEM,MAAM,IAAI,IAAI,CAWpB;IAEM,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,UAAO,GAAG,IAAI,CAUxD;IAEM,YAAY,IAAI,MAAM,CAS5B;IAEM,WAAW,IAAI,MAAM,CAE3B;IAEM,QAAQ,IAAI,OAAO,CAEzB;IAEM,SAAS,IAAI,OAAO,CAE1B;IAEM,KAAK,IAAI,IAAI,CAInB;IAED,OAAO,CAAC,WAAW;CAMpB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { CustomToastRenderer, ToastOptions, ToastPromiseMessages, ToastPromiseResult, ToastUpdateOptions } from "../types/index.js";
|
|
3
|
+
import { type ToastStore } from "./store.js";
|
|
4
|
+
export interface ToastApi {
|
|
5
|
+
(title: ReactNode, options?: Omit<ToastOptions, "title">): string;
|
|
6
|
+
success: (title: ReactNode, options?: Omit<ToastOptions, "title" | "variant">) => string;
|
|
7
|
+
error: (title: ReactNode, options?: Omit<ToastOptions, "title" | "variant">) => string;
|
|
8
|
+
warning: (title: ReactNode, options?: Omit<ToastOptions, "title" | "variant">) => string;
|
|
9
|
+
info: (title: ReactNode, options?: Omit<ToastOptions, "title" | "variant">) => string;
|
|
10
|
+
loading: (title: ReactNode, options?: Omit<ToastOptions, "title" | "variant">) => string;
|
|
11
|
+
custom: (render: CustomToastRenderer, options?: Omit<ToastOptions, "customRender" | "variant">) => string;
|
|
12
|
+
promise: <TData, TError = unknown>(promiseOrFactory: Promise<TData> | (() => Promise<TData>), messages: ToastPromiseMessages<TData, TError>, options?: Omit<ToastOptions, "title" | "variant">) => ToastPromiseResult<TData>;
|
|
13
|
+
update: (id: string, options: ToastUpdateOptions) => boolean;
|
|
14
|
+
dismiss: (id: string) => boolean;
|
|
15
|
+
dismissAll: () => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function createToastApi(store?: ToastStore): ToastApi;
|
|
18
|
+
export declare const toast: ToastApi;
|
|
19
|
+
//# sourceMappingURL=toast-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast-api.d.ts","sourceRoot":"","sources":["../../src/core/toast-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EAEZ,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAwBhE,MAAM,WAAW,QAAQ;IACvB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC;IAClE,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,SAAS,CAAC,KAAK,MAAM,CAAC;IACzF,KAAK,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,SAAS,CAAC,KAAK,MAAM,CAAC;IACvF,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,SAAS,CAAC,KAAK,MAAM,CAAC;IACzF,IAAI,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,SAAS,CAAC,KAAK,MAAM,CAAC;IACtF,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,SAAS,CAAC,KAAK,MAAM,CAAC;IACzF,MAAM,EAAE,CACN,MAAM,EAAE,mBAAmB,EAC3B,OAAO,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,cAAc,GAAG,SAAS,CAAC,KACrD,MAAM,CAAC;IACZ,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,EAC/B,gBAAgB,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC,EACzD,QAAQ,EAAE,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,EAC7C,OAAO,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,SAAS,CAAC,KAC9C,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC/B,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,KAAK,OAAO,CAAC;IAC7D,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IACjC,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,wBAAgB,cAAc,CAAC,KAAK,GAAE,UAA8B,GAAG,QAAQ,CAkF9E;AAED,eAAO,MAAM,KAAK,EAAE,QAA4C,CAAC"}
|