@kazee-ds/vue 0.4.0 → 0.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/dist/index.js +971 -150
- package/dist/index.js.map +1 -1
- package/dist/types/Toast.vue.d.ts +35 -0
- package/dist/types/ToastProvider.vue.d.ts +41 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/toast-model.d.ts +64 -0
- package/dist/types/useToast.d.ts +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ToastEntry, ToastManager, ToastPlacement } from './toast-model.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
entry: ToastEntry;
|
|
4
|
+
manager?: ToastManager;
|
|
5
|
+
placement?: ToastPlacement;
|
|
6
|
+
closeLabel?: string;
|
|
7
|
+
dir?: 'ltr' | 'rtl';
|
|
8
|
+
showProgress?: boolean;
|
|
9
|
+
swipeThreshold?: number;
|
|
10
|
+
};
|
|
11
|
+
type __VLS_Slots = {
|
|
12
|
+
default?: (props: {
|
|
13
|
+
entry: ToastEntry;
|
|
14
|
+
dismiss: () => void;
|
|
15
|
+
}) => unknown;
|
|
16
|
+
indicator?: (props: {
|
|
17
|
+
entry: ToastEntry;
|
|
18
|
+
}) => unknown;
|
|
19
|
+
};
|
|
20
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
21
|
+
dir: "ltr" | "rtl";
|
|
22
|
+
closeLabel: string;
|
|
23
|
+
placement: ToastPlacement;
|
|
24
|
+
manager: ToastManager;
|
|
25
|
+
showProgress: boolean;
|
|
26
|
+
swipeThreshold: number;
|
|
27
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
29
|
+
declare const _default: typeof __VLS_export;
|
|
30
|
+
export default _default;
|
|
31
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
32
|
+
new (): {
|
|
33
|
+
$slots: S;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type ToastEntry, type ToastManager, type ToastPlacement } from './toast-model.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
manager?: ToastManager;
|
|
4
|
+
placement?: ToastPlacement;
|
|
5
|
+
label?: string;
|
|
6
|
+
closeLabel?: string;
|
|
7
|
+
hotkey?: string[];
|
|
8
|
+
dir?: 'ltr' | 'rtl';
|
|
9
|
+
showProgress?: boolean;
|
|
10
|
+
swipeThreshold?: number;
|
|
11
|
+
};
|
|
12
|
+
type __VLS_Slots = {
|
|
13
|
+
default?: (props: {
|
|
14
|
+
toast: ToastManager;
|
|
15
|
+
}) => unknown;
|
|
16
|
+
toast?: (props: {
|
|
17
|
+
entry: ToastEntry;
|
|
18
|
+
dismiss: () => void;
|
|
19
|
+
}) => unknown;
|
|
20
|
+
indicator?: (props: {
|
|
21
|
+
entry: ToastEntry;
|
|
22
|
+
}) => unknown;
|
|
23
|
+
};
|
|
24
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
25
|
+
label: string;
|
|
26
|
+
dir: "ltr" | "rtl";
|
|
27
|
+
closeLabel: string;
|
|
28
|
+
placement: ToastPlacement;
|
|
29
|
+
manager: ToastManager;
|
|
30
|
+
showProgress: boolean;
|
|
31
|
+
swipeThreshold: number;
|
|
32
|
+
hotkey: string[];
|
|
33
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
34
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
35
|
+
declare const _default: typeof __VLS_export;
|
|
36
|
+
export default _default;
|
|
37
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
38
|
+
new (): {
|
|
39
|
+
$slots: S;
|
|
40
|
+
};
|
|
41
|
+
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -34,6 +34,11 @@ export { default as DataTable } from './DataTable.vue.js';
|
|
|
34
34
|
export type { DataTableColumn, DataTableRow, TableSort } from './data-table-types.js';
|
|
35
35
|
export type { TabItem } from './types.js';
|
|
36
36
|
export { default as Alert } from './Alert.vue.js';
|
|
37
|
+
export { default as ToastProvider } from './ToastProvider.vue.js';
|
|
38
|
+
export { default as Toast } from './Toast.vue.js';
|
|
39
|
+
export { useToast } from './useToast.js';
|
|
40
|
+
export { createToastManager } from './toast-model.js';
|
|
41
|
+
export type { ToastTone, ToastPlacement, ToastCloseReason, ToastAction, ToastOptions, ToastEntry, ToastManagerOptions, ToastPromiseMessages, ToastManager, } from './toast-model.js';
|
|
37
42
|
export { default as Empty } from './Empty.vue.js';
|
|
38
43
|
export { default as Breadcrumb } from './Breadcrumb.vue.js';
|
|
39
44
|
export { default as Sidebar } from './Sidebar.vue.js';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export type ToastTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger';
|
|
2
|
+
export type ToastPlacement = 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end';
|
|
3
|
+
export type ToastCloseReason = 'timeout' | 'dismiss' | 'action' | 'cancel' | 'swipe' | 'clear' | 'unmount';
|
|
4
|
+
export interface ToastAction {
|
|
5
|
+
label: string;
|
|
6
|
+
altText: string;
|
|
7
|
+
onAction: () => void;
|
|
8
|
+
dismiss?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ToastOptions {
|
|
11
|
+
id?: string;
|
|
12
|
+
title: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
tone?: ToastTone;
|
|
15
|
+
duration?: number;
|
|
16
|
+
isLoading?: boolean;
|
|
17
|
+
action?: ToastAction;
|
|
18
|
+
cancel?: ToastAction;
|
|
19
|
+
onClose?: (reason: ToastCloseReason) => void;
|
|
20
|
+
}
|
|
21
|
+
export interface ToastEntry extends Readonly<ToastOptions> {
|
|
22
|
+
readonly id: string;
|
|
23
|
+
readonly tone: ToastTone;
|
|
24
|
+
readonly duration: number;
|
|
25
|
+
readonly isLoading: boolean;
|
|
26
|
+
readonly generation: number;
|
|
27
|
+
readonly state: 'open' | 'closing';
|
|
28
|
+
readonly createdAt: number;
|
|
29
|
+
readonly visibleAt: number | null;
|
|
30
|
+
readonly remaining: number;
|
|
31
|
+
readonly paused: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface ToastManagerOptions {
|
|
34
|
+
maxVisible?: number;
|
|
35
|
+
maxPending?: number;
|
|
36
|
+
duration?: number;
|
|
37
|
+
exitDuration?: number;
|
|
38
|
+
}
|
|
39
|
+
type ToastMessage = string | ToastOptions;
|
|
40
|
+
export interface ToastPromiseMessages<T> {
|
|
41
|
+
loading: ToastMessage;
|
|
42
|
+
success: ToastMessage | ((value: T) => ToastMessage);
|
|
43
|
+
error: ToastMessage | ((error: unknown) => ToastMessage);
|
|
44
|
+
}
|
|
45
|
+
export interface ToastManager {
|
|
46
|
+
add(options: ToastOptions): string | null;
|
|
47
|
+
update(id: string, options: Partial<ToastOptions>): boolean;
|
|
48
|
+
dismiss(id: string, reason?: ToastCloseReason): void;
|
|
49
|
+
clear(reason?: ToastCloseReason): void;
|
|
50
|
+
pause(reason: string): void;
|
|
51
|
+
resume(reason: string): void;
|
|
52
|
+
attach(): () => void;
|
|
53
|
+
dispose(): void;
|
|
54
|
+
subscribe(listener: () => void): () => void;
|
|
55
|
+
getSnapshot(): readonly ToastEntry[];
|
|
56
|
+
getServerSnapshot(): readonly ToastEntry[];
|
|
57
|
+
promise<T>(promise: Promise<T>, messages: ToastPromiseMessages<T>, options?: Partial<ToastOptions>): {
|
|
58
|
+
id: string | null;
|
|
59
|
+
promise: Promise<T>;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/** Create per application/provider; no browser globals or timers are used until attached. */
|
|
63
|
+
export declare function createToastManager(options?: ToastManagerOptions): ToastManager;
|
|
64
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type InjectionKey } from 'vue';
|
|
2
|
+
import type { ToastManager } from './toast-model.js';
|
|
3
|
+
export declare const toastManagerKey: InjectionKey<ToastManager>;
|
|
4
|
+
/** Access the nearest provider's manager. Create imperative managers per application. */
|
|
5
|
+
export declare function useToast(): ToastManager;
|