vue-smart-toast 0.1.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 ADDED
@@ -0,0 +1,137 @@
1
+ # Vue Smart Toast
2
+
3
+ A Vue 3 toast library with a Sonner-style desktop experience and a lightweight
4
+ Vant-style mobile experience behind one command API.
5
+
6
+ ## Install
7
+
8
+ ```bash
9
+ pnpm add vue-smart-toast
10
+ ```
11
+
12
+ ## Usage
13
+
14
+ Import the style once and render `<Toaster />` near the root of your app.
15
+
16
+ ```vue
17
+ <script setup lang="ts">
18
+ import { Toaster, toast } from 'vue-smart-toast'
19
+ import 'vue-smart-toast/style.css'
20
+ </script>
21
+
22
+ <template>
23
+ <Toaster />
24
+ <button @click="toast.success('Saved')">Show toast</button>
25
+ </template>
26
+ ```
27
+
28
+ ## API
29
+
30
+ ```ts
31
+ toast('Message')
32
+ toast.success('Saved')
33
+ toast.error('Failed')
34
+ toast.info('Sync started')
35
+ toast.warning('Storage is almost full')
36
+ toast.dismiss(id)
37
+ toast.clear()
38
+ ```
39
+
40
+ Promise toasts update from loading to success or error:
41
+
42
+ ```ts
43
+ toast.promise(save(), {
44
+ loading: 'Saving...',
45
+ success: 'Saved',
46
+ error: 'Save failed',
47
+ })
48
+ ```
49
+
50
+ ## Desktop And Mobile
51
+
52
+ By default, `device: 'auto'` chooses the mobile toast on small or touch-first
53
+ viewports and the desktop toast elsewhere. You can force either surface per
54
+ toast.
55
+
56
+ ```ts
57
+ toast.success('Desktop toast', { device: 'pc' })
58
+ toast.success('Mobile toast', { device: 'mobile' })
59
+ ```
60
+
61
+ ## Toaster Options
62
+
63
+ Desktop options follow the Vue Sonner-style model.
64
+
65
+ ```vue
66
+ <Toaster
67
+ position="top-right"
68
+ theme="light"
69
+ rich-colors
70
+ close-button
71
+ :toast-options="{
72
+ class: 'my-toast',
73
+ style: { background: 'white' },
74
+ classes: {
75
+ toast: 'toast-root',
76
+ title: 'toast-title',
77
+ description: 'toast-description',
78
+ icon: 'toast-icon',
79
+ },
80
+ }"
81
+ />
82
+ ```
83
+
84
+ Mobile toasts have separate options so you can keep a different visual language.
85
+
86
+ ```vue
87
+ <Toaster
88
+ :mobile-toast-options="{
89
+ class: 'mobile-toast',
90
+ classes: {
91
+ toast: 'mobile-toast-root',
92
+ text: 'mobile-toast-text',
93
+ icon: 'mobile-toast-icon',
94
+ },
95
+ }"
96
+ />
97
+ ```
98
+
99
+ ## Icons
100
+
101
+ Use slots to replace default icons globally.
102
+
103
+ ```vue
104
+ <Toaster>
105
+ <template #success-icon>
106
+ <SuccessIcon />
107
+ </template>
108
+
109
+ <template #mobile-success-icon>
110
+ <MobileSuccessIcon />
111
+ </template>
112
+ </Toaster>
113
+ ```
114
+
115
+ Override or hide an icon for a single toast.
116
+
117
+ ```ts
118
+ toast.success('Saved', { icon: SuccessIcon })
119
+ toast.success('Saved', { icon: false })
120
+ toast.success('Saved', { device: 'mobile', mobileIcon: MobileSuccessIcon })
121
+ ```
122
+
123
+ ## Plugin
124
+
125
+ The default export registers the global `<Toaster />` component and `$toast`.
126
+
127
+ ```ts
128
+ import { createApp } from 'vue'
129
+ import VueSmartToast from 'vue-smart-toast'
130
+ import 'vue-smart-toast/style.css'
131
+
132
+ createApp(App).use(VueSmartToast).mount('#app')
133
+ ```
134
+
135
+ ## License
136
+
137
+ MIT
@@ -0,0 +1,135 @@
1
+ import { type PropType } from 'vue';
2
+ import type { ToasterProps } from './types';
3
+ declare var __VLS_8: {}, __VLS_11: {}, __VLS_14: {}, __VLS_17: {}, __VLS_20: {}, __VLS_23: {}, __VLS_32: {}, __VLS_35: {}, __VLS_38: {}, __VLS_41: {}, __VLS_44: {};
4
+ type __VLS_Slots = {} & {
5
+ 'close-icon'?: (props: typeof __VLS_8) => any;
6
+ } & {
7
+ 'loading-icon'?: (props: typeof __VLS_11) => any;
8
+ } & {
9
+ 'success-icon'?: (props: typeof __VLS_14) => any;
10
+ } & {
11
+ 'error-icon'?: (props: typeof __VLS_17) => any;
12
+ } & {
13
+ 'warning-icon'?: (props: typeof __VLS_20) => any;
14
+ } & {
15
+ 'info-icon'?: (props: typeof __VLS_23) => any;
16
+ } & {
17
+ 'mobile-loading-icon'?: (props: typeof __VLS_32) => any;
18
+ } & {
19
+ 'mobile-success-icon'?: (props: typeof __VLS_35) => any;
20
+ } & {
21
+ 'mobile-error-icon'?: (props: typeof __VLS_38) => any;
22
+ } & {
23
+ 'mobile-warning-icon'?: (props: typeof __VLS_41) => any;
24
+ } & {
25
+ 'mobile-info-icon'?: (props: typeof __VLS_44) => any;
26
+ };
27
+ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
28
+ id: StringConstructor;
29
+ invert: BooleanConstructor;
30
+ theme: {
31
+ type: PropType<ToasterProps["theme"]>;
32
+ default: string;
33
+ };
34
+ position: {
35
+ type: PropType<ToasterProps["position"]>;
36
+ default: string;
37
+ };
38
+ closeButtonPosition: {
39
+ type: PropType<ToasterProps["closeButtonPosition"]>;
40
+ default: string;
41
+ };
42
+ hotkey: {
43
+ type: PropType<ToasterProps["hotkey"]>;
44
+ default: () => string[];
45
+ };
46
+ richColors: BooleanConstructor;
47
+ expand: BooleanConstructor;
48
+ duration: NumberConstructor;
49
+ gap: NumberConstructor;
50
+ visibleToasts: NumberConstructor;
51
+ closeButton: BooleanConstructor;
52
+ toastOptions: {
53
+ type: PropType<ToasterProps["toastOptions"]>;
54
+ default: () => {};
55
+ };
56
+ mobileToastOptions: {
57
+ type: PropType<ToasterProps["mobileToastOptions"]>;
58
+ default: () => {};
59
+ };
60
+ class: StringConstructor;
61
+ style: PropType<ToasterProps["style"]>;
62
+ offset: PropType<ToasterProps["offset"]>;
63
+ mobileOffset: PropType<ToasterProps["mobileOffset"]>;
64
+ dir: {
65
+ type: PropType<ToasterProps["dir"]>;
66
+ default: string;
67
+ };
68
+ swipeDirections: PropType<ToasterProps["swipeDirections"]>;
69
+ icons: PropType<ToasterProps["icons"]>;
70
+ containerAriaLabel: StringConstructor;
71
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
72
+ id: StringConstructor;
73
+ invert: BooleanConstructor;
74
+ theme: {
75
+ type: PropType<ToasterProps["theme"]>;
76
+ default: string;
77
+ };
78
+ position: {
79
+ type: PropType<ToasterProps["position"]>;
80
+ default: string;
81
+ };
82
+ closeButtonPosition: {
83
+ type: PropType<ToasterProps["closeButtonPosition"]>;
84
+ default: string;
85
+ };
86
+ hotkey: {
87
+ type: PropType<ToasterProps["hotkey"]>;
88
+ default: () => string[];
89
+ };
90
+ richColors: BooleanConstructor;
91
+ expand: BooleanConstructor;
92
+ duration: NumberConstructor;
93
+ gap: NumberConstructor;
94
+ visibleToasts: NumberConstructor;
95
+ closeButton: BooleanConstructor;
96
+ toastOptions: {
97
+ type: PropType<ToasterProps["toastOptions"]>;
98
+ default: () => {};
99
+ };
100
+ mobileToastOptions: {
101
+ type: PropType<ToasterProps["mobileToastOptions"]>;
102
+ default: () => {};
103
+ };
104
+ class: StringConstructor;
105
+ style: PropType<ToasterProps["style"]>;
106
+ offset: PropType<ToasterProps["offset"]>;
107
+ mobileOffset: PropType<ToasterProps["mobileOffset"]>;
108
+ dir: {
109
+ type: PropType<ToasterProps["dir"]>;
110
+ default: string;
111
+ };
112
+ swipeDirections: PropType<ToasterProps["swipeDirections"]>;
113
+ icons: PropType<ToasterProps["icons"]>;
114
+ containerAriaLabel: StringConstructor;
115
+ }>> & Readonly<{}>, {
116
+ richColors: boolean;
117
+ invert: boolean;
118
+ closeButton: boolean;
119
+ position: import("./types").PcPosition | undefined;
120
+ closeButtonPosition: import("./types").CloseButtonPosition | undefined;
121
+ toastOptions: Pick<import("./types").ToastOptions, "toasterId" | "duration" | "cancelButtonStyle" | "actionButtonStyle" | "style" | "unstyled" | "class" | "classes" | "descriptionClass" | "closeButtonPosition" | "closeButtonAriaLabel"> | undefined;
122
+ dir: "rtl" | "ltr" | "auto" | undefined;
123
+ theme: import("./types").ToastTheme | undefined;
124
+ hotkey: string[] | undefined;
125
+ expand: boolean;
126
+ mobileToastOptions: import("./types").MobileToastOptions | undefined;
127
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
128
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
129
+ declare const _default: typeof __VLS_export;
130
+ export default _default;
131
+ type __VLS_WithSlots<T, S> = T & {
132
+ new (): {
133
+ $slots: S;
134
+ };
135
+ };
@@ -0,0 +1,11 @@
1
+ import './styles.css';
2
+ import { destroyStore, dismissToast } from './store';
3
+ import Toaster from './Toaster.vue';
4
+ import type { ToastApi, ToastId, ToastOptions, VueToastPlugin } from './types';
5
+ declare const toast: ToastApi;
6
+ declare const plugin: VueToastPlugin;
7
+ export declare function showToastOptions(options: ToastOptions): ToastId;
8
+ export declare const showToast: typeof showToastOptions;
9
+ export { Toaster, toast, dismissToast, destroyStore };
10
+ export type { CloseButtonPosition, DeviceMode, MobilePosition, MobileToastClasses, MobileToastOptions, PcPosition, PromiseToastOptions, SwipeDirection, ToastAction, ToastApi, ToastClasses, ToastId, ToastIcons, ToastItem, ToastMessage, ToastOptions, ToastTheme, ToastType, ToasterProps, } from './types';
11
+ export default plugin;
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,27 @@
1
+ import type { MobileToastOptions, ToastItem } from '../types';
2
+ type __VLS_Props = {
3
+ toast: ToastItem;
4
+ index: number;
5
+ toastOptions?: MobileToastOptions;
6
+ };
7
+ declare var __VLS_6: {}, __VLS_8: {}, __VLS_15: {}, __VLS_22: {}, __VLS_29: {};
8
+ type __VLS_Slots = {} & {
9
+ 'loading-icon'?: (props: typeof __VLS_6) => any;
10
+ } & {
11
+ 'success-icon'?: (props: typeof __VLS_8) => any;
12
+ } & {
13
+ 'error-icon'?: (props: typeof __VLS_15) => any;
14
+ } & {
15
+ 'warning-icon'?: (props: typeof __VLS_22) => any;
16
+ } & {
17
+ 'info-icon'?: (props: typeof __VLS_29) => any;
18
+ };
19
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
21
+ declare const _default: typeof __VLS_export;
22
+ export default _default;
23
+ type __VLS_WithSlots<T, S> = T & {
24
+ new (): {
25
+ $slots: S;
26
+ };
27
+ };
@@ -0,0 +1,7 @@
1
+ import type { ToastType } from '../types';
2
+ type __VLS_Props = {
3
+ type: ToastType;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
@@ -0,0 +1,26 @@
1
+ import type { MobileToastOptions, ToastItem } from '../types';
2
+ type __VLS_Props = {
3
+ toasts: ToastItem[];
4
+ toastOptions?: MobileToastOptions;
5
+ };
6
+ declare var __VLS_8: {}, __VLS_11: {}, __VLS_14: {}, __VLS_17: {}, __VLS_20: {};
7
+ type __VLS_Slots = {} & {
8
+ 'loading-icon'?: (props: typeof __VLS_8) => any;
9
+ } & {
10
+ 'success-icon'?: (props: typeof __VLS_11) => any;
11
+ } & {
12
+ 'error-icon'?: (props: typeof __VLS_14) => any;
13
+ } & {
14
+ 'warning-icon'?: (props: typeof __VLS_17) => any;
15
+ } & {
16
+ 'info-icon'?: (props: typeof __VLS_20) => any;
17
+ };
18
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
20
+ declare const _default: typeof __VLS_export;
21
+ export default _default;
22
+ type __VLS_WithSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -0,0 +1,32 @@
1
+ import { type HeightT, type ToastProps, type ToastT } from './types';
2
+ declare var __VLS_6: {}, __VLS_18: {}, __VLS_20: {}, __VLS_22: {}, __VLS_24: {}, __VLS_26: {};
3
+ type __VLS_Slots = {} & {
4
+ 'close-icon'?: (props: typeof __VLS_6) => any;
5
+ } & {
6
+ 'loading-icon'?: (props: typeof __VLS_18) => any;
7
+ } & {
8
+ 'success-icon'?: (props: typeof __VLS_20) => any;
9
+ } & {
10
+ 'error-icon'?: (props: typeof __VLS_22) => any;
11
+ } & {
12
+ 'warning-icon'?: (props: typeof __VLS_24) => any;
13
+ } & {
14
+ 'info-icon'?: (props: typeof __VLS_26) => any;
15
+ };
16
+ declare const __VLS_base: import("vue").DefineComponent<ToastProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
17
+ "update:heights": (heights: HeightT[]) => any;
18
+ "update:height": (height: HeightT) => any;
19
+ removeToast: (toast: ToastT<import("vue").Component>) => any;
20
+ }, string, import("vue").PublicProps, Readonly<ToastProps> & Readonly<{
21
+ "onUpdate:heights"?: ((heights: HeightT[]) => any) | undefined;
22
+ "onUpdate:height"?: ((height: HeightT) => any) | undefined;
23
+ onRemoveToast?: ((toast: ToastT<import("vue").Component>) => any) | undefined;
24
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
25
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
26
+ declare const _default: typeof __VLS_export;
27
+ export default _default;
28
+ type __VLS_WithSlots<T, S> = T & {
29
+ new (): {
30
+ $slots: S;
31
+ };
32
+ };
@@ -0,0 +1,48 @@
1
+ import type { Position, ToasterProps } from './types';
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
4
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ToasterProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ToasterProps> & Readonly<{}>, {
5
+ richColors: boolean;
6
+ invert: boolean;
7
+ closeButton: boolean;
8
+ class: string;
9
+ position: Position;
10
+ closeButtonPosition: import("./types").CloseButtonPosition;
11
+ toastOptions: import("./types").ToastOptions;
12
+ gap: number;
13
+ offset: string | number | {
14
+ top?: string | number;
15
+ right?: string | number;
16
+ bottom?: string | number;
17
+ left?: string | number;
18
+ };
19
+ mobileOffset: string | number | {
20
+ top?: string | number;
21
+ right?: string | number;
22
+ bottom?: string | number;
23
+ left?: string | number;
24
+ };
25
+ visibleToasts: number;
26
+ dir: "rtl" | "ltr" | "auto";
27
+ theme: import("./types").Theme;
28
+ hotkey: string[];
29
+ expand: boolean;
30
+ containerAriaLabel: string;
31
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
32
+ 'close-icon'?: (props: {}) => any;
33
+ } & {
34
+ 'loading-icon'?: (props: {}) => any;
35
+ } & {
36
+ 'success-icon'?: (props: {}) => any;
37
+ } & {
38
+ 'error-icon'?: (props: {}) => any;
39
+ } & {
40
+ 'warning-icon'?: (props: {}) => any;
41
+ } & {
42
+ 'info-icon'?: (props: {}) => any;
43
+ }>;
44
+ type __VLS_WithSlots<T, S> = T & {
45
+ new (): {
46
+ $slots: S;
47
+ };
48
+ };
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,6 @@
1
+ type __VLS_Props = {
2
+ visible: boolean;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
5
+ declare const _default: typeof __VLS_export;
6
+ export default _default;
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1 @@
1
+ export { default as Toaster } from './Toaster.vue';
@@ -0,0 +1,9 @@
1
+ declare const VISIBLE_TOASTS_AMOUNT = 3;
2
+ declare const VIEWPORT_OFFSET = "24px";
3
+ declare const MOBILE_VIEWPORT_OFFSET = "16px";
4
+ declare const TOAST_LIFETIME = 4000;
5
+ declare const TOAST_WIDTH = 356;
6
+ declare const GAP = 14;
7
+ declare const SWIPE_THRESHOLD = 45;
8
+ declare const TIME_BEFORE_UNMOUNT = 200;
9
+ export { VISIBLE_TOASTS_AMOUNT, VIEWPORT_OFFSET, MOBILE_VIEWPORT_OFFSET, TOAST_LIFETIME, TOAST_WIDTH, GAP, SWIPE_THRESHOLD, TIME_BEFORE_UNMOUNT };
@@ -0,0 +1,11 @@
1
+ import { type CSSProperties, type Ref } from 'vue';
2
+ import type { SwipeDirection, ToasterProps, ToastT } from './types';
3
+ export declare function useIsDocumentHidden(): {
4
+ isDocumentHidden: Ref<boolean, boolean>;
5
+ };
6
+ export declare function cn(...classes: (string | undefined)[]): string;
7
+ export declare function getDefaultSwipeDirections(position: string): Array<SwipeDirection>;
8
+ export declare function assignOffset(defaultOffset: ToasterProps['offset'], mobileOffset: ToasterProps['mobileOffset']): CSSProperties;
9
+ export declare function useVueSonner(): {
10
+ activeToasts: Ref<ToastT[]>;
11
+ };
@@ -0,0 +1,8 @@
1
+ import type { Plugin } from 'vue';
2
+ import type { ToasterProps, ToastT, ExternalToast, Action, ToastClasses, ToastToDismiss, PromiseIExtendedResult, ToastTypes } from './types';
3
+ import { Toaster } from './component';
4
+ import { toast } from './state';
5
+ import { useVueSonner } from './hooks';
6
+ export { Toaster, toast, useVueSonner, type ToasterProps, type ToastT, type ExternalToast, type Action, type ToastClasses, type ToastToDismiss, type PromiseIExtendedResult, type ToastTypes };
7
+ declare const plugin: Plugin;
8
+ export default plugin;
@@ -0,0 +1,56 @@
1
+ import { type Component } from 'vue';
2
+ import type { ExternalToast, PromiseData, PromiseT, ToastT, ToastToDismiss, ToastTypes } from './types';
3
+ type titleT = (() => string | Component) | string | Component;
4
+ declare class Observer {
5
+ subscribers: Array<(toast: ExternalToast | ToastToDismiss) => void>;
6
+ toasts: Array<ToastT | ToastToDismiss>;
7
+ dismissedToasts: Set<string | number>;
8
+ constructor();
9
+ subscribe: (subscriber: (toast: ToastT | ToastToDismiss) => void) => () => void;
10
+ publish: (data: ToastT) => void;
11
+ addToast: (data: ToastT) => void;
12
+ create: (data: ExternalToast & {
13
+ message?: titleT;
14
+ type?: ToastTypes;
15
+ promise?: PromiseT;
16
+ }) => string | number;
17
+ dismiss: (id?: number | string) => string | number | undefined;
18
+ message: (message: titleT, data?: ExternalToast) => string | number;
19
+ error: (message: titleT, data?: ExternalToast) => string | number;
20
+ success: (message: titleT, data?: ExternalToast) => string | number;
21
+ info: (message: titleT, data?: ExternalToast) => string | number;
22
+ warning: (message: titleT, data?: ExternalToast) => string | number;
23
+ loading: (message: titleT, data?: ExternalToast) => string | number;
24
+ promise: <ToastData>(promise: PromiseT<ToastData>, data?: PromiseData<ToastData>) => (string & {
25
+ unwrap: () => Promise<ToastData>;
26
+ }) | (number & {
27
+ unwrap: () => Promise<ToastData>;
28
+ }) | {
29
+ unwrap: () => Promise<ToastData>;
30
+ } | undefined;
31
+ custom: (component: Component, data?: ExternalToast) => string | number;
32
+ getActiveToasts: () => (ToastT<Component> | ToastToDismiss)[];
33
+ }
34
+ export declare const ToastState: Observer;
35
+ declare function toastFunction(message: titleT, data?: ExternalToast): string | number;
36
+ export declare const toast: typeof toastFunction & {
37
+ success: (message: titleT, data?: ExternalToast) => string | number;
38
+ info: (message: titleT, data?: ExternalToast) => string | number;
39
+ warning: (message: titleT, data?: ExternalToast) => string | number;
40
+ error: (message: titleT, data?: ExternalToast) => string | number;
41
+ custom: (component: Component, data?: ExternalToast) => string | number;
42
+ message: (message: titleT, data?: ExternalToast) => string | number;
43
+ promise: <ToastData>(promise: PromiseT<ToastData>, data?: PromiseData<ToastData> | undefined) => (string & {
44
+ unwrap: () => Promise<ToastData>;
45
+ }) | (number & {
46
+ unwrap: () => Promise<ToastData>;
47
+ }) | {
48
+ unwrap: () => Promise<ToastData>;
49
+ } | undefined;
50
+ dismiss: (id?: number | string) => string | number | undefined;
51
+ loading: (message: titleT, data?: ExternalToast) => string | number;
52
+ } & {
53
+ getHistory: () => (ToastT<Component> | ToastToDismiss)[];
54
+ getToasts: () => (ToastT<Component> | ToastToDismiss)[];
55
+ };
56
+ export {};