dynaura 0.0.0-stage → 0.1.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 +422 -2
- package/dist/chunk-VCDDW4W7.js +563 -0
- package/dist/index.cjs +619 -0
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +39 -0
- package/dist/styles.css +161 -0
- package/dist/svelte.cjs +595 -0
- package/dist/svelte.d.cts +10 -0
- package/dist/svelte.d.ts +10 -0
- package/dist/svelte.js +15 -0
- package/dist/vanilla.cjs +589 -0
- package/dist/vanilla.d.cts +86 -0
- package/dist/vanilla.d.ts +86 -0
- package/dist/vanilla.js +9 -0
- package/dist/vue.cjs +613 -0
- package/dist/vue.d.cts +43 -0
- package/dist/vue.d.ts +43 -0
- package/dist/vue.js +33 -0
- package/package.json +131 -4
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
type Position = "top" | "top-left" | "top-center" | "top-right" | "bottom" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
2
|
+
/** Any CSS color. Omitted keys fall back to the dark theme. */
|
|
3
|
+
interface CustomTheme {
|
|
4
|
+
background?: string;
|
|
5
|
+
foreground?: string;
|
|
6
|
+
muted?: string;
|
|
7
|
+
ring?: string;
|
|
8
|
+
button?: string;
|
|
9
|
+
success?: string;
|
|
10
|
+
error?: string;
|
|
11
|
+
warning?: string;
|
|
12
|
+
info?: string;
|
|
13
|
+
loading?: string;
|
|
14
|
+
live?: string;
|
|
15
|
+
}
|
|
16
|
+
interface ToasterOptions {
|
|
17
|
+
position?: Position;
|
|
18
|
+
/** px from the screen edge */
|
|
19
|
+
offset?: number;
|
|
20
|
+
/** "dark" | "light" | "system" (follows OS) | custom colors */
|
|
21
|
+
theme?: "dark" | "light" | "system" | CustomTheme;
|
|
22
|
+
/** thin time-remaining bar on timed toasts (default true) */
|
|
23
|
+
timer?: boolean;
|
|
24
|
+
/** navigator.vibrate on show (default true; no-op where unsupported) */
|
|
25
|
+
haptics?: boolean;
|
|
26
|
+
/** show toasts one after another instead of replacing (default false) */
|
|
27
|
+
queue?: boolean;
|
|
28
|
+
/** framework hook: mount non-string/non-Node content (e.g. a React element) into `el`; node=null unmounts */
|
|
29
|
+
render?: (el: HTMLElement, node: unknown) => void;
|
|
30
|
+
}
|
|
31
|
+
interface ToasterHandle {
|
|
32
|
+
set(o: ToasterOptions): void;
|
|
33
|
+
destroy(): void;
|
|
34
|
+
}
|
|
35
|
+
declare function createToaster(initial?: ToasterOptions): ToasterHandle;
|
|
36
|
+
|
|
37
|
+
type ToastType = "success" | "error" | "warning" | "info" | "loading" | "live";
|
|
38
|
+
/** string | number | DOM Node | framework node (React element when used with the React adapter) */
|
|
39
|
+
type Content = string | number | boolean | Node | object | null;
|
|
40
|
+
interface ToastOptions {
|
|
41
|
+
title: string;
|
|
42
|
+
description?: Content;
|
|
43
|
+
/** replaces the built-in icon (leading slot) */
|
|
44
|
+
icon?: Content;
|
|
45
|
+
/** compact right-side slot, e.g. a countdown */
|
|
46
|
+
trailing?: Content;
|
|
47
|
+
/** ms; null = sticky. Default 4000 (loading / live: null). */
|
|
48
|
+
duration?: number | null;
|
|
49
|
+
button?: {
|
|
50
|
+
title: string;
|
|
51
|
+
onClick: () => void;
|
|
52
|
+
};
|
|
53
|
+
/** 0..1. Shows a progress bar + rolling percent. Clear with update(id, { progress: undefined }). */
|
|
54
|
+
progress?: number;
|
|
55
|
+
/** burst of confetti when shown */
|
|
56
|
+
confetti?: boolean;
|
|
57
|
+
/** live activity flavor (type "live"): running timer or waveform */
|
|
58
|
+
kind?: "timer" | "wave";
|
|
59
|
+
/** "card": rich layout. Header tab + wider body joined by a curved notch; description is full-bleed custom content. */
|
|
60
|
+
variant?: "default" | "card";
|
|
61
|
+
/** per-toast override of the Toaster `queue` option */
|
|
62
|
+
queue?: boolean;
|
|
63
|
+
}
|
|
64
|
+
type Resolve<T> = ToastOptions | string | ((v: T) => ToastOptions | string);
|
|
65
|
+
declare const dynaura: {
|
|
66
|
+
success: (o: ToastOptions | string) => string;
|
|
67
|
+
error: (o: ToastOptions | string) => string;
|
|
68
|
+
warning: (o: ToastOptions | string) => string;
|
|
69
|
+
info: (o: ToastOptions | string) => string;
|
|
70
|
+
loading: (o: ToastOptions | string) => string;
|
|
71
|
+
/** Live activity: sticky island with a running timer (default) or waveform. */
|
|
72
|
+
live: (o: ToastOptions | string) => string;
|
|
73
|
+
update: (id: string, patch: Partial<ToastOptions> & {
|
|
74
|
+
type?: ToastType;
|
|
75
|
+
}) => void;
|
|
76
|
+
/** dismiss the current toast (next queued one shows) or a specific id */
|
|
77
|
+
dismiss: (id?: string) => void;
|
|
78
|
+
clear: () => void;
|
|
79
|
+
promise<T>(p: Promise<T>, o: {
|
|
80
|
+
loading: ToastOptions | string;
|
|
81
|
+
success: Resolve<T>;
|
|
82
|
+
error: Resolve<unknown>;
|
|
83
|
+
}): Promise<T>;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export { type Content, type CustomTheme, type Position, type ToastOptions, type ToastType, type ToasterHandle, type ToasterOptions, createToaster, dynaura };
|