mood-ui 0.7.1 → 0.8.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/dist/mood-ui.cjs +3 -3
- package/dist/mood-ui.cjs.map +1 -1
- package/dist/mood-ui.css +2 -2
- package/dist/mood-ui.mjs +6130 -3387
- package/dist/mood-ui.mjs.map +1 -1
- package/dist/types/components/ModoProvider.vue.d.ts +8 -1
- package/dist/types/components/data-display/calendar/AgendaView.vue.d.ts +2 -2
- package/dist/types/components/data-display/calendar/DayView.vue.d.ts +2 -2
- package/dist/types/components/data-display/calendar/MonthView.vue.d.ts +2 -2
- package/dist/types/components/data-display/calendar/Scheduler.vue.d.ts +2 -2
- package/dist/types/components/data-display/calendar/WeekView.vue.d.ts +2 -2
- package/dist/types/components/feedback/Banner.vue.d.ts +1 -1
- package/dist/types/components/feedback/Drawer.vue.d.ts +4 -4
- package/dist/types/components/feedback/Modal.vue.d.ts +3 -3
- package/dist/types/components/feedback/ToastContainer.vue.d.ts +1 -1
- package/dist/types/components/feedback/Tooltip.vue.d.ts +1 -1
- package/dist/types/components/forms/AvatarCropper.vue.d.ts +15 -0
- package/dist/types/components/forms/AvatarUpload.vue.d.ts +65 -0
- package/dist/types/components/forms/ButtonGroup.vue.d.ts +1 -0
- package/dist/types/components/forms/ColorModeSwitch.vue.d.ts +2 -2
- package/dist/types/components/forms/Combobox.vue.d.ts +2 -2
- package/dist/types/components/forms/DateField.vue.d.ts +2 -2
- package/dist/types/components/forms/DateRangeField.vue.d.ts +2 -2
- package/dist/types/components/forms/DateTimeField.vue.d.ts +2 -2
- package/dist/types/components/forms/Input.vue.d.ts +2 -2
- package/dist/types/components/forms/MultiSelect.vue.d.ts +2 -2
- package/dist/types/components/forms/NumberInput.vue.d.ts +2 -2
- package/dist/types/components/forms/OTPInput.vue.d.ts +24 -0
- package/dist/types/components/forms/PasswordInput.vue.d.ts +2 -2
- package/dist/types/components/forms/PhoneInput.vue.d.ts +31 -0
- package/dist/types/components/forms/SearchInput.vue.d.ts +2 -2
- package/dist/types/components/forms/Select.vue.d.ts +2 -2
- package/dist/types/components/forms/Textarea.vue.d.ts +3 -3
- package/dist/types/components/layout/Canvas.vue.d.ts +1 -1
- package/dist/types/components/navigation/DropdownMenu.vue.d.ts +2 -2
- package/dist/types/composables/useAvatarCrop.d.ts +25 -0
- package/dist/types/composables/useAvatarProvider.d.ts +21 -0
- package/dist/types/composables/useAvatarUpload.d.ts +26 -0
- package/dist/types/composables/useColorMode.d.ts +24 -1
- package/dist/types/composables/useConfirm.d.ts +14 -135
- package/dist/types/composables/useField.d.ts +7 -1
- package/dist/types/composables/useToast.d.ts +14 -139
- package/dist/types/config/ModoConfig.d.ts +12 -0
- package/dist/types/config/ModoLocale.d.ts +47 -0
- package/dist/types/config/createModoUI.d.ts +6 -0
- package/dist/types/data/phoneCountries.d.ts +18 -0
- package/dist/types/index.d.ts +14 -4
- package/dist/types/interfaces/forms/AvatarUpload.interface.d.ts +106 -0
- package/dist/types/interfaces/forms/ButtonGroup.interface.d.ts +7 -5
- package/dist/types/interfaces/forms/OTPInput.interface.d.ts +65 -0
- package/dist/types/interfaces/forms/PhoneInput.interface.d.ts +74 -0
- package/dist/types/utils/createAvatarProvider.d.ts +54 -0
- package/package.json +7 -9
- package/README.OLD.md +0 -5
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canvas-based circular crop composable.
|
|
3
|
+
*
|
|
4
|
+
* Attach the returned `canvasRef` to a `<canvas>` element and call
|
|
5
|
+
* `loadImage(src)` to start. The user can then drag to pan and
|
|
6
|
+
* scroll/pinch to zoom. Call `exportCroppedBlob()` to get the result.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useAvatarCrop(): {
|
|
9
|
+
canvasRef: import('vue').ShallowRef<HTMLCanvasElement | null, HTMLCanvasElement | null>;
|
|
10
|
+
zoom: import('vue').Ref<number, number>;
|
|
11
|
+
isReady: import('vue').Ref<boolean, boolean>;
|
|
12
|
+
loadImage: (src: string, displaySize?: number) => Promise<void>;
|
|
13
|
+
reset: () => void;
|
|
14
|
+
setZoom: (value: number) => void;
|
|
15
|
+
exportCroppedBlob: () => Promise<Blob>;
|
|
16
|
+
onPointerDown: (e: PointerEvent) => void;
|
|
17
|
+
onPointerMove: (e: PointerEvent) => void;
|
|
18
|
+
onPointerUp: () => void;
|
|
19
|
+
onWheel: (e: WheelEvent) => void;
|
|
20
|
+
onTouchStart: (e: TouchEvent) => void;
|
|
21
|
+
onTouchMove: (e: TouchEvent) => void;
|
|
22
|
+
onTouchEnd: () => void;
|
|
23
|
+
MIN_ZOOM: number;
|
|
24
|
+
MAX_ZOOM: number;
|
|
25
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AvatarProvider } from '../interfaces/forms/AvatarUpload.interface';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the avatar AI provider and handles invocation with loading state,
|
|
4
|
+
* error handling, cancellation via AbortController, and session-level caching.
|
|
5
|
+
*
|
|
6
|
+
* Provider resolution order:
|
|
7
|
+
* 1. `localProvider` argument (`:provider` prop on the component)
|
|
8
|
+
* 2. Global `ModoProvider` `ai.avatarProvider` config
|
|
9
|
+
* 3. `undefined` → AI features disabled
|
|
10
|
+
*/
|
|
11
|
+
export declare function useAvatarProvider(localProvider: () => AvatarProvider | undefined): {
|
|
12
|
+
hasProvider: import('vue').ComputedRef<boolean>;
|
|
13
|
+
isGenerating: import('vue').Ref<boolean, boolean>;
|
|
14
|
+
generateError: import('vue').Ref<Error | null, Error | null>;
|
|
15
|
+
generate: (options: {
|
|
16
|
+
prompt?: string;
|
|
17
|
+
image?: File;
|
|
18
|
+
variant?: string;
|
|
19
|
+
}) => Promise<string | null>;
|
|
20
|
+
cancel: () => void;
|
|
21
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface AvatarUploadValidationError {
|
|
2
|
+
code: 'size' | 'type';
|
|
3
|
+
file: File;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Handles file selection, validation, resize and compression.
|
|
7
|
+
* Returns a temporary object URL for immediate preview and a
|
|
8
|
+
* processed Blob (512×512 image/webp) for the cropper / emit.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useAvatarUpload(options: {
|
|
11
|
+
maxSize?: () => number | undefined;
|
|
12
|
+
accept?: () => string[] | undefined;
|
|
13
|
+
}): {
|
|
14
|
+
isProcessing: import('vue').Ref<boolean, boolean>;
|
|
15
|
+
uploadError: import('vue').Ref<Error | null, Error | null>;
|
|
16
|
+
processFile: (file: File) => Promise<{
|
|
17
|
+
previewUrl: string;
|
|
18
|
+
blob: Blob;
|
|
19
|
+
}>;
|
|
20
|
+
createObjectUrl: (blob: Blob | File) => string;
|
|
21
|
+
revokeUrl: (url: string) => void;
|
|
22
|
+
formatFileSize: (bytes: number) => string;
|
|
23
|
+
getAllowedExtensions: (accept: string[]) => string;
|
|
24
|
+
DEFAULT_ACCEPT: string[];
|
|
25
|
+
DEFAULT_MAX_SIZE: number;
|
|
26
|
+
};
|
|
@@ -9,7 +9,30 @@
|
|
|
9
9
|
* when the mode (or the OS preference while in `'system'`) changes.
|
|
10
10
|
*/
|
|
11
11
|
export type ColorMode = "light" | "dark" | "system";
|
|
12
|
-
export
|
|
12
|
+
export interface ColorModeOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Class name added to `<html>` when the resolved mode is `'dark'`.
|
|
15
|
+
* Defaults to `'dark'` (the convention Tailwind v4 uses out of the box).
|
|
16
|
+
*
|
|
17
|
+
* Override it when your app's CSS already keys off a custom class
|
|
18
|
+
* — e.g. `useColorMode({ darkClass: 'appdark' })`. Calling this with
|
|
19
|
+
* a new value swaps the class on `<html>` immediately, so existing
|
|
20
|
+
* dark-mode rules keep firing.
|
|
21
|
+
*
|
|
22
|
+
* Note: mood-ui's own dark-mode CSS is compiled against `.dark`. If
|
|
23
|
+
* you need both your `appdark` selectors AND the lib's dark variants
|
|
24
|
+
* to work, configure Tailwind so `dark:` resolves to your custom
|
|
25
|
+
* selector, or keep both classes in sync via `darkClassExtras`.
|
|
26
|
+
*/
|
|
27
|
+
darkClass?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Configure the color-mode singleton before any component reads from it.
|
|
31
|
+
* Call this once in your app entry (`main.ts` / Nuxt plugin) so the
|
|
32
|
+
* right class is on `<html>` before the first paint.
|
|
33
|
+
*/
|
|
34
|
+
export declare function configureColorMode(options: ColorModeOptions): void;
|
|
35
|
+
export declare function useColorMode(options?: ColorModeOptions): {
|
|
13
36
|
/** The raw chosen mode: `'light' | 'dark' | 'system'`. */
|
|
14
37
|
mode: import('vue').Ref<ColorMode, ColorMode>;
|
|
15
38
|
/** Always a concrete `'light' | 'dark'`, following the OS when `mode === 'system'`. */
|
|
@@ -1,144 +1,23 @@
|
|
|
1
|
-
import { ConfirmInput } from '../interfaces/feedback/ConfirmDialog.interface';
|
|
1
|
+
import { ConfirmInput, ConfirmRequest } from '../interfaces/feedback/ConfirmDialog.interface';
|
|
2
|
+
/**
|
|
3
|
+
* Imperative confirmation dialogs. Mount one `<ConfirmDialog />` near the
|
|
4
|
+
* root of your app and then call `useConfirm().confirm({...})` from any
|
|
5
|
+
* component to obtain a `Promise<boolean>` (resolves `true` on confirm,
|
|
6
|
+
* `false` on cancel/dismiss).
|
|
7
|
+
*
|
|
8
|
+
* Calls are serialized: a second `confirm()` while one is open is queued
|
|
9
|
+
* and shown when the first resolves.
|
|
10
|
+
*/
|
|
11
|
+
interface ConfirmStore {
|
|
12
|
+
queue: ConfirmRequest[];
|
|
13
|
+
}
|
|
2
14
|
declare function confirm(input?: ConfirmInput | string): Promise<boolean>;
|
|
3
15
|
/**
|
|
4
16
|
* Resolve and pop the head of the queue. Used by `<ConfirmDialog>` when
|
|
5
17
|
* the user clicks confirm/cancel or dismisses via overlay/Escape.
|
|
6
18
|
*/
|
|
7
19
|
declare function resolveCurrent(value: boolean): void;
|
|
8
|
-
export declare function useConfirmQueue():
|
|
9
|
-
queue: {
|
|
10
|
-
id: string;
|
|
11
|
-
resolve: (value: boolean) => void;
|
|
12
|
-
title?: string | undefined;
|
|
13
|
-
description?: string | undefined;
|
|
14
|
-
icon?: import('vue').FunctionalComponent<any, {}, any, {}> | {
|
|
15
|
-
new (...args: any[]): any;
|
|
16
|
-
__isFragment?: never;
|
|
17
|
-
__isTeleport?: never;
|
|
18
|
-
__isSuspense?: never;
|
|
19
|
-
} | {
|
|
20
|
-
[x: string]: any;
|
|
21
|
-
setup?: ((this: void, props: import('@vue/shared').LooseRequired<any>, ctx: {
|
|
22
|
-
attrs: import('vue').Attrs;
|
|
23
|
-
slots: Readonly<{
|
|
24
|
-
[name: string]: import('vue').Slot<any> | undefined;
|
|
25
|
-
}>;
|
|
26
|
-
emit: ((event: unknown, ...args: any[]) => void) | ((event: string, ...args: any[]) => void);
|
|
27
|
-
expose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed) => void;
|
|
28
|
-
}) => any) | undefined;
|
|
29
|
-
name?: string | undefined;
|
|
30
|
-
template?: string | object | undefined;
|
|
31
|
-
render?: Function | undefined;
|
|
32
|
-
components?: Record<string, import('vue').Component<any, any, any, import('vue').ComputedOptions, import('vue').MethodOptions, {}, any>> | undefined;
|
|
33
|
-
directives?: Record<string, import('vue').Directive<any, any, string, any>> | undefined;
|
|
34
|
-
inheritAttrs?: boolean | undefined;
|
|
35
|
-
emits?: any;
|
|
36
|
-
slots?: {} | undefined;
|
|
37
|
-
expose?: string[] | undefined;
|
|
38
|
-
serverPrefetch?: (() => void | Promise<any>) | undefined;
|
|
39
|
-
compilerOptions?: {
|
|
40
|
-
isCustomElement?: ((tag: string) => boolean) | undefined;
|
|
41
|
-
whitespace?: "preserve" | "condense" | undefined;
|
|
42
|
-
comments?: boolean | undefined;
|
|
43
|
-
delimiters?: [string, string] | undefined;
|
|
44
|
-
} | undefined;
|
|
45
|
-
call?: ((this: unknown, ...args: unknown[]) => never) | undefined;
|
|
46
|
-
__isFragment?: never | undefined;
|
|
47
|
-
__isTeleport?: never | undefined;
|
|
48
|
-
__isSuspense?: never | undefined;
|
|
49
|
-
__defaults?: {} | undefined;
|
|
50
|
-
compatConfig?: {
|
|
51
|
-
GLOBAL_MOUNT?: boolean | "suppress-warning" | undefined;
|
|
52
|
-
GLOBAL_MOUNT_CONTAINER?: boolean | "suppress-warning" | undefined;
|
|
53
|
-
GLOBAL_EXTEND?: boolean | "suppress-warning" | undefined;
|
|
54
|
-
GLOBAL_PROTOTYPE?: boolean | "suppress-warning" | undefined;
|
|
55
|
-
GLOBAL_SET?: boolean | "suppress-warning" | undefined;
|
|
56
|
-
GLOBAL_DELETE?: boolean | "suppress-warning" | undefined;
|
|
57
|
-
GLOBAL_OBSERVABLE?: boolean | "suppress-warning" | undefined;
|
|
58
|
-
GLOBAL_PRIVATE_UTIL?: boolean | "suppress-warning" | undefined;
|
|
59
|
-
CONFIG_SILENT?: boolean | "suppress-warning" | undefined;
|
|
60
|
-
CONFIG_DEVTOOLS?: boolean | "suppress-warning" | undefined;
|
|
61
|
-
CONFIG_KEY_CODES?: boolean | "suppress-warning" | undefined;
|
|
62
|
-
CONFIG_PRODUCTION_TIP?: boolean | "suppress-warning" | undefined;
|
|
63
|
-
CONFIG_IGNORED_ELEMENTS?: boolean | "suppress-warning" | undefined;
|
|
64
|
-
CONFIG_WHITESPACE?: boolean | "suppress-warning" | undefined;
|
|
65
|
-
CONFIG_OPTION_MERGE_STRATS?: boolean | "suppress-warning" | undefined;
|
|
66
|
-
INSTANCE_SET?: boolean | "suppress-warning" | undefined;
|
|
67
|
-
INSTANCE_DELETE?: boolean | "suppress-warning" | undefined;
|
|
68
|
-
INSTANCE_DESTROY?: boolean | "suppress-warning" | undefined;
|
|
69
|
-
INSTANCE_EVENT_EMITTER?: boolean | "suppress-warning" | undefined;
|
|
70
|
-
INSTANCE_EVENT_HOOKS?: boolean | "suppress-warning" | undefined;
|
|
71
|
-
INSTANCE_CHILDREN?: boolean | "suppress-warning" | undefined;
|
|
72
|
-
INSTANCE_LISTENERS?: boolean | "suppress-warning" | undefined;
|
|
73
|
-
INSTANCE_SCOPED_SLOTS?: boolean | "suppress-warning" | undefined;
|
|
74
|
-
INSTANCE_ATTRS_CLASS_STYLE?: boolean | "suppress-warning" | undefined;
|
|
75
|
-
OPTIONS_DATA_FN?: boolean | "suppress-warning" | undefined;
|
|
76
|
-
OPTIONS_DATA_MERGE?: boolean | "suppress-warning" | undefined;
|
|
77
|
-
OPTIONS_BEFORE_DESTROY?: boolean | "suppress-warning" | undefined;
|
|
78
|
-
OPTIONS_DESTROYED?: boolean | "suppress-warning" | undefined;
|
|
79
|
-
WATCH_ARRAY?: boolean | "suppress-warning" | undefined;
|
|
80
|
-
PROPS_DEFAULT_THIS?: boolean | "suppress-warning" | undefined;
|
|
81
|
-
V_ON_KEYCODE_MODIFIER?: boolean | "suppress-warning" | undefined;
|
|
82
|
-
CUSTOM_DIR?: boolean | "suppress-warning" | undefined;
|
|
83
|
-
ATTR_FALSE_VALUE?: boolean | "suppress-warning" | undefined;
|
|
84
|
-
ATTR_ENUMERATED_COERCION?: boolean | "suppress-warning" | undefined;
|
|
85
|
-
TRANSITION_CLASSES?: boolean | "suppress-warning" | undefined;
|
|
86
|
-
TRANSITION_GROUP_ROOT?: boolean | "suppress-warning" | undefined;
|
|
87
|
-
COMPONENT_ASYNC?: boolean | "suppress-warning" | undefined;
|
|
88
|
-
COMPONENT_FUNCTIONAL?: boolean | "suppress-warning" | undefined;
|
|
89
|
-
COMPONENT_V_MODEL?: boolean | "suppress-warning" | undefined;
|
|
90
|
-
RENDER_FUNCTION?: boolean | "suppress-warning" | undefined;
|
|
91
|
-
FILTERS?: boolean | "suppress-warning" | undefined;
|
|
92
|
-
PRIVATE_APIS?: boolean | "suppress-warning" | undefined;
|
|
93
|
-
MODE?: 2 | 3 | ((comp: import('vue').Component | null) => 2 | 3) | undefined;
|
|
94
|
-
} | undefined;
|
|
95
|
-
data?: ((this: any, vm: any) => any) | undefined;
|
|
96
|
-
computed?: import('vue').ComputedOptions | undefined;
|
|
97
|
-
methods?: import('vue').MethodOptions | undefined;
|
|
98
|
-
watch?: {
|
|
99
|
-
[x: string]: (string | import('vue').WatchCallback | ({
|
|
100
|
-
handler: import('vue').WatchCallback | string;
|
|
101
|
-
} & import('vue').WatchOptions<boolean>)) | (string | import('vue').WatchCallback | ({
|
|
102
|
-
handler: import('vue').WatchCallback | string;
|
|
103
|
-
} & import('vue').WatchOptions<boolean>))[];
|
|
104
|
-
} | undefined;
|
|
105
|
-
provide?: import('vue').ComponentProvideOptions | undefined;
|
|
106
|
-
inject?: {} | string[] | undefined;
|
|
107
|
-
filters?: Record<string, Function> | undefined;
|
|
108
|
-
mixins?: any[] | undefined;
|
|
109
|
-
extends?: any;
|
|
110
|
-
beforeCreate?: (() => any) | undefined;
|
|
111
|
-
created?: (() => any) | undefined;
|
|
112
|
-
beforeMount?: (() => any) | undefined;
|
|
113
|
-
mounted?: (() => any) | undefined;
|
|
114
|
-
beforeUpdate?: (() => any) | undefined;
|
|
115
|
-
updated?: (() => any) | undefined;
|
|
116
|
-
activated?: (() => any) | undefined;
|
|
117
|
-
deactivated?: (() => any) | undefined;
|
|
118
|
-
beforeDestroy?: (() => any) | undefined;
|
|
119
|
-
beforeUnmount?: (() => any) | undefined;
|
|
120
|
-
destroyed?: (() => any) | undefined;
|
|
121
|
-
unmounted?: (() => any) | undefined;
|
|
122
|
-
renderTracked?: ((e: import('vue').DebuggerEvent) => void) | undefined;
|
|
123
|
-
renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | undefined;
|
|
124
|
-
errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | undefined;
|
|
125
|
-
delimiters?: [string, string] | undefined;
|
|
126
|
-
__differentiator?: string | number | symbol | undefined;
|
|
127
|
-
__isBuiltIn?: boolean | undefined;
|
|
128
|
-
__file?: string | undefined;
|
|
129
|
-
__name?: string | undefined;
|
|
130
|
-
} | undefined;
|
|
131
|
-
hideIcon?: boolean | undefined;
|
|
132
|
-
confirmLabel?: string | undefined;
|
|
133
|
-
cancelLabel?: string | undefined;
|
|
134
|
-
color?: import('..').ConfirmColor | undefined;
|
|
135
|
-
size?: import('..').ModalSize | undefined;
|
|
136
|
-
radius?: "none" | "small" | "medium" | "large" | "full" | undefined;
|
|
137
|
-
hideCancel?: boolean | undefined;
|
|
138
|
-
dismissable?: boolean | undefined;
|
|
139
|
-
autoFocusConfirm?: boolean | undefined;
|
|
140
|
-
}[];
|
|
141
|
-
};
|
|
20
|
+
export declare function useConfirmQueue(): ConfirmStore;
|
|
142
21
|
export declare function useConfirm(): {
|
|
143
22
|
confirm: typeof confirm;
|
|
144
23
|
resolveCurrent: typeof resolveCurrent;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import { ComputedRef, MaybeRefOrGetter } from 'vue';
|
|
1
|
+
import { ComputedRef, InjectionKey, MaybeRefOrGetter, Ref } from 'vue';
|
|
2
2
|
import { ModoHalo } from '../config/ModoConfig';
|
|
3
|
+
/**
|
|
4
|
+
* Injection key provided by FormField so child form controls can:
|
|
5
|
+
* 1. Use the FormField's id as their own (connecting `<label for="...">` automatically).
|
|
6
|
+
* 2. Suppress the "no label" a11y warning — the FormField already renders a visible label.
|
|
7
|
+
*/
|
|
8
|
+
export declare const FORM_FIELD_ID_KEY: InjectionKey<Ref<string>>;
|
|
3
9
|
/**
|
|
4
10
|
* Props del campo de formulario que necesita `useFieldState`.
|
|
5
11
|
* Se definen aquí para que cualquier componente (Input, Textarea, Password…)
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
import { ToastInput } from '../interfaces/feedback/Toast.interface';
|
|
1
|
+
import { ToastEntry, ToastInput } from '../interfaces/feedback/Toast.interface';
|
|
2
|
+
/**
|
|
3
|
+
* `useToast()` exposes an imperative API to push toasts onto the global
|
|
4
|
+
* queue. The actual rendering happens in `<ToastContainer>`, which must
|
|
5
|
+
* be mounted once near the root of the app.
|
|
6
|
+
*
|
|
7
|
+
* The store is module-scoped so any component can call `push()` and the
|
|
8
|
+
* toast appears in the (single) container. Mounting more than one
|
|
9
|
+
* container is allowed — both will render the same queue.
|
|
10
|
+
*/
|
|
11
|
+
interface ToastStore {
|
|
12
|
+
queue: ToastEntry[];
|
|
13
|
+
}
|
|
2
14
|
/**
|
|
3
15
|
* Push a new toast onto the queue. Returns the resolved id so callers
|
|
4
16
|
* can later `dismiss(id)` or `update(id, …)` the same toast.
|
|
@@ -22,144 +34,7 @@ declare function danger(input: Omit<ToastInput, 'color'> | string): string | num
|
|
|
22
34
|
* composable; the container is the only consumer that mutates it (via
|
|
23
35
|
* `dismiss(id)`), and it does so through the public API.
|
|
24
36
|
*/
|
|
25
|
-
export declare function useToastQueue():
|
|
26
|
-
queue: {
|
|
27
|
-
id: string | number;
|
|
28
|
-
title?: string | undefined;
|
|
29
|
-
description?: string | undefined;
|
|
30
|
-
color: import('..').ToastColor;
|
|
31
|
-
variant: import('..').ToastVariant;
|
|
32
|
-
icon?: import('vue').FunctionalComponent<any, {}, any, {}> | {
|
|
33
|
-
new (...args: any[]): any;
|
|
34
|
-
__isFragment?: never;
|
|
35
|
-
__isTeleport?: never;
|
|
36
|
-
__isSuspense?: never;
|
|
37
|
-
} | {
|
|
38
|
-
[x: string]: any;
|
|
39
|
-
setup?: ((this: void, props: import('@vue/shared').LooseRequired<any>, ctx: {
|
|
40
|
-
attrs: import('vue').Attrs;
|
|
41
|
-
slots: Readonly<{
|
|
42
|
-
[name: string]: import('vue').Slot<any> | undefined;
|
|
43
|
-
}>;
|
|
44
|
-
emit: ((event: unknown, ...args: any[]) => void) | ((event: string, ...args: any[]) => void);
|
|
45
|
-
expose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed) => void;
|
|
46
|
-
}) => any) | undefined;
|
|
47
|
-
name?: string | undefined;
|
|
48
|
-
template?: string | object | undefined;
|
|
49
|
-
render?: Function | undefined;
|
|
50
|
-
components?: Record<string, import('vue').Component<any, any, any, import('vue').ComputedOptions, import('vue').MethodOptions, {}, any>> | undefined;
|
|
51
|
-
directives?: Record<string, import('vue').Directive<any, any, string, any>> | undefined;
|
|
52
|
-
inheritAttrs?: boolean | undefined;
|
|
53
|
-
emits?: any;
|
|
54
|
-
slots?: {} | undefined;
|
|
55
|
-
expose?: string[] | undefined;
|
|
56
|
-
serverPrefetch?: (() => void | Promise<any>) | undefined;
|
|
57
|
-
compilerOptions?: {
|
|
58
|
-
isCustomElement?: ((tag: string) => boolean) | undefined;
|
|
59
|
-
whitespace?: "preserve" | "condense" | undefined;
|
|
60
|
-
comments?: boolean | undefined;
|
|
61
|
-
delimiters?: [string, string] | undefined;
|
|
62
|
-
} | undefined;
|
|
63
|
-
call?: ((this: unknown, ...args: unknown[]) => never) | undefined;
|
|
64
|
-
__isFragment?: never | undefined;
|
|
65
|
-
__isTeleport?: never | undefined;
|
|
66
|
-
__isSuspense?: never | undefined;
|
|
67
|
-
__defaults?: {} | undefined;
|
|
68
|
-
compatConfig?: {
|
|
69
|
-
GLOBAL_MOUNT?: boolean | "suppress-warning" | undefined;
|
|
70
|
-
GLOBAL_MOUNT_CONTAINER?: boolean | "suppress-warning" | undefined;
|
|
71
|
-
GLOBAL_EXTEND?: boolean | "suppress-warning" | undefined;
|
|
72
|
-
GLOBAL_PROTOTYPE?: boolean | "suppress-warning" | undefined;
|
|
73
|
-
GLOBAL_SET?: boolean | "suppress-warning" | undefined;
|
|
74
|
-
GLOBAL_DELETE?: boolean | "suppress-warning" | undefined;
|
|
75
|
-
GLOBAL_OBSERVABLE?: boolean | "suppress-warning" | undefined;
|
|
76
|
-
GLOBAL_PRIVATE_UTIL?: boolean | "suppress-warning" | undefined;
|
|
77
|
-
CONFIG_SILENT?: boolean | "suppress-warning" | undefined;
|
|
78
|
-
CONFIG_DEVTOOLS?: boolean | "suppress-warning" | undefined;
|
|
79
|
-
CONFIG_KEY_CODES?: boolean | "suppress-warning" | undefined;
|
|
80
|
-
CONFIG_PRODUCTION_TIP?: boolean | "suppress-warning" | undefined;
|
|
81
|
-
CONFIG_IGNORED_ELEMENTS?: boolean | "suppress-warning" | undefined;
|
|
82
|
-
CONFIG_WHITESPACE?: boolean | "suppress-warning" | undefined;
|
|
83
|
-
CONFIG_OPTION_MERGE_STRATS?: boolean | "suppress-warning" | undefined;
|
|
84
|
-
INSTANCE_SET?: boolean | "suppress-warning" | undefined;
|
|
85
|
-
INSTANCE_DELETE?: boolean | "suppress-warning" | undefined;
|
|
86
|
-
INSTANCE_DESTROY?: boolean | "suppress-warning" | undefined;
|
|
87
|
-
INSTANCE_EVENT_EMITTER?: boolean | "suppress-warning" | undefined;
|
|
88
|
-
INSTANCE_EVENT_HOOKS?: boolean | "suppress-warning" | undefined;
|
|
89
|
-
INSTANCE_CHILDREN?: boolean | "suppress-warning" | undefined;
|
|
90
|
-
INSTANCE_LISTENERS?: boolean | "suppress-warning" | undefined;
|
|
91
|
-
INSTANCE_SCOPED_SLOTS?: boolean | "suppress-warning" | undefined;
|
|
92
|
-
INSTANCE_ATTRS_CLASS_STYLE?: boolean | "suppress-warning" | undefined;
|
|
93
|
-
OPTIONS_DATA_FN?: boolean | "suppress-warning" | undefined;
|
|
94
|
-
OPTIONS_DATA_MERGE?: boolean | "suppress-warning" | undefined;
|
|
95
|
-
OPTIONS_BEFORE_DESTROY?: boolean | "suppress-warning" | undefined;
|
|
96
|
-
OPTIONS_DESTROYED?: boolean | "suppress-warning" | undefined;
|
|
97
|
-
WATCH_ARRAY?: boolean | "suppress-warning" | undefined;
|
|
98
|
-
PROPS_DEFAULT_THIS?: boolean | "suppress-warning" | undefined;
|
|
99
|
-
V_ON_KEYCODE_MODIFIER?: boolean | "suppress-warning" | undefined;
|
|
100
|
-
CUSTOM_DIR?: boolean | "suppress-warning" | undefined;
|
|
101
|
-
ATTR_FALSE_VALUE?: boolean | "suppress-warning" | undefined;
|
|
102
|
-
ATTR_ENUMERATED_COERCION?: boolean | "suppress-warning" | undefined;
|
|
103
|
-
TRANSITION_CLASSES?: boolean | "suppress-warning" | undefined;
|
|
104
|
-
TRANSITION_GROUP_ROOT?: boolean | "suppress-warning" | undefined;
|
|
105
|
-
COMPONENT_ASYNC?: boolean | "suppress-warning" | undefined;
|
|
106
|
-
COMPONENT_FUNCTIONAL?: boolean | "suppress-warning" | undefined;
|
|
107
|
-
COMPONENT_V_MODEL?: boolean | "suppress-warning" | undefined;
|
|
108
|
-
RENDER_FUNCTION?: boolean | "suppress-warning" | undefined;
|
|
109
|
-
FILTERS?: boolean | "suppress-warning" | undefined;
|
|
110
|
-
PRIVATE_APIS?: boolean | "suppress-warning" | undefined;
|
|
111
|
-
MODE?: 2 | 3 | ((comp: import('vue').Component | null) => 2 | 3) | undefined;
|
|
112
|
-
} | undefined;
|
|
113
|
-
data?: ((this: any, vm: any) => any) | undefined;
|
|
114
|
-
computed?: import('vue').ComputedOptions | undefined;
|
|
115
|
-
methods?: import('vue').MethodOptions | undefined;
|
|
116
|
-
watch?: {
|
|
117
|
-
[x: string]: (string | import('vue').WatchCallback | ({
|
|
118
|
-
handler: import('vue').WatchCallback | string;
|
|
119
|
-
} & import('vue').WatchOptions<boolean>)) | (string | import('vue').WatchCallback | ({
|
|
120
|
-
handler: import('vue').WatchCallback | string;
|
|
121
|
-
} & import('vue').WatchOptions<boolean>))[];
|
|
122
|
-
} | undefined;
|
|
123
|
-
provide?: import('vue').ComponentProvideOptions | undefined;
|
|
124
|
-
inject?: {} | string[] | undefined;
|
|
125
|
-
filters?: Record<string, Function> | undefined;
|
|
126
|
-
mixins?: any[] | undefined;
|
|
127
|
-
extends?: any;
|
|
128
|
-
beforeCreate?: (() => any) | undefined;
|
|
129
|
-
created?: (() => any) | undefined;
|
|
130
|
-
beforeMount?: (() => any) | undefined;
|
|
131
|
-
mounted?: (() => any) | undefined;
|
|
132
|
-
beforeUpdate?: (() => any) | undefined;
|
|
133
|
-
updated?: (() => any) | undefined;
|
|
134
|
-
activated?: (() => any) | undefined;
|
|
135
|
-
deactivated?: (() => any) | undefined;
|
|
136
|
-
beforeDestroy?: (() => any) | undefined;
|
|
137
|
-
beforeUnmount?: (() => any) | undefined;
|
|
138
|
-
destroyed?: (() => any) | undefined;
|
|
139
|
-
unmounted?: (() => any) | undefined;
|
|
140
|
-
renderTracked?: ((e: import('vue').DebuggerEvent) => void) | undefined;
|
|
141
|
-
renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | undefined;
|
|
142
|
-
errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | undefined;
|
|
143
|
-
delimiters?: [string, string] | undefined;
|
|
144
|
-
__differentiator?: string | number | symbol | undefined;
|
|
145
|
-
__isBuiltIn?: boolean | undefined;
|
|
146
|
-
__file?: string | undefined;
|
|
147
|
-
__name?: string | undefined;
|
|
148
|
-
} | undefined;
|
|
149
|
-
hideIcon?: boolean | undefined;
|
|
150
|
-
action?: {
|
|
151
|
-
label: string;
|
|
152
|
-
onClick?: ((close: () => void) => void) | undefined;
|
|
153
|
-
keepOpen?: boolean | undefined;
|
|
154
|
-
} | undefined;
|
|
155
|
-
radius?: "none" | "small" | "medium" | "large" | "full" | undefined;
|
|
156
|
-
placement?: import('..').ToastPlacement | undefined;
|
|
157
|
-
pushedAt: number;
|
|
158
|
-
duration: number;
|
|
159
|
-
dismissable: boolean;
|
|
160
|
-
pauseOnHover: boolean;
|
|
161
|
-
}[];
|
|
162
|
-
};
|
|
37
|
+
export declare function useToastQueue(): ToastStore;
|
|
163
38
|
/**
|
|
164
39
|
* Public composable. Returns the imperative API. Stable identity — the
|
|
165
40
|
* returned object can safely be destructured at module scope.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { InjectionKey, Ref } from 'vue';
|
|
2
2
|
import { ModoPalette } from './palettes';
|
|
3
|
+
import { AvatarProvider } from '../interfaces/forms/AvatarUpload.interface';
|
|
3
4
|
/**
|
|
4
5
|
* Surface tokens — backgrounds, cards, popovers, borders and neutral fills.
|
|
5
6
|
* Each value is any valid CSS color string (hex, oklch(), hsl(), rgb()…).
|
|
@@ -39,6 +40,15 @@ export type ModoTheme = 'light' | 'dark' | 'system';
|
|
|
39
40
|
* - `off` — sin halo persistente; solo focus-visible ring para a11y.
|
|
40
41
|
*/
|
|
41
42
|
export type ModoHalo = 'tinted' | 'neutral' | 'off';
|
|
43
|
+
/** Global AI configuration. Each field maps to a specific AI-enabled component. */
|
|
44
|
+
export interface ModoAiConfig {
|
|
45
|
+
/**
|
|
46
|
+
* Default avatar generation function used by `<AvatarUpload ai />` when
|
|
47
|
+
* no `:provider` prop is passed. The developer implements this with their
|
|
48
|
+
* own API key / model. Mood UI never provides AI directly.
|
|
49
|
+
*/
|
|
50
|
+
avatarProvider?: AvatarProvider;
|
|
51
|
+
}
|
|
42
52
|
export interface ModoConfig {
|
|
43
53
|
color: ModoColor;
|
|
44
54
|
radius: ModoRadius;
|
|
@@ -51,6 +61,8 @@ export interface ModoConfig {
|
|
|
51
61
|
};
|
|
52
62
|
surfaces?: ModoSurfaces;
|
|
53
63
|
darkSurfaces?: ModoSurfaces;
|
|
64
|
+
/** Optional AI provider config. See `ModoAiConfig`. */
|
|
65
|
+
ai?: ModoAiConfig;
|
|
54
66
|
}
|
|
55
67
|
export declare const MODO_CONFIG: InjectionKey<Ref<ModoConfig>>;
|
|
56
68
|
export declare const defaultModoConfig: ModoConfig;
|
|
@@ -122,6 +122,53 @@ export interface ModoLocale {
|
|
|
122
122
|
skeleton: {
|
|
123
123
|
loading: string;
|
|
124
124
|
};
|
|
125
|
+
avatarUpload: {
|
|
126
|
+
/** Accessible label for the upload dropzone button. */
|
|
127
|
+
uploadLabel: string;
|
|
128
|
+
/** Body text inside the dropzone when empty. */
|
|
129
|
+
dragPrompt: string;
|
|
130
|
+
generateLabel: string;
|
|
131
|
+
regenerateLabel: string;
|
|
132
|
+
saveLabel: string;
|
|
133
|
+
removeLabel: string;
|
|
134
|
+
cancelLabel: string;
|
|
135
|
+
cropTitle: string;
|
|
136
|
+
cropConfirm: string;
|
|
137
|
+
cropReset: string;
|
|
138
|
+
/** Default placeholder for the AI prompt input. */
|
|
139
|
+
promptPlaceholder: string;
|
|
140
|
+
/** Accessible label for the variant selector group. */
|
|
141
|
+
variantLabel: string;
|
|
142
|
+
/** Accessible label for the prompt suggestions chip group. */
|
|
143
|
+
promptSuggestionsLabel: string;
|
|
144
|
+
/** Screen-reader live announcement while generating. */
|
|
145
|
+
generating: string;
|
|
146
|
+
/** Screen-reader live announcement on success. */
|
|
147
|
+
generated: string;
|
|
148
|
+
saving: string;
|
|
149
|
+
saved: string;
|
|
150
|
+
errorGenerate: string;
|
|
151
|
+
errorUpload: string;
|
|
152
|
+
errorSave: string;
|
|
153
|
+
/** `{limit}` placeholder: human-readable size (e.g. "5 MB"). */
|
|
154
|
+
errorSize: string;
|
|
155
|
+
/** `{types}` placeholder: comma-separated list of allowed formats. */
|
|
156
|
+
errorType: string;
|
|
157
|
+
/** Badge label shown on AI-generated avatars. */
|
|
158
|
+
aiLabel: string;
|
|
159
|
+
};
|
|
160
|
+
phoneInput: {
|
|
161
|
+
/** aria-label on the country selector button. */
|
|
162
|
+
selectCountry: string;
|
|
163
|
+
/** Placeholder inside the country search box. */
|
|
164
|
+
searchCountry: string;
|
|
165
|
+
/** Empty state when country search returns no matches. */
|
|
166
|
+
noResults: string;
|
|
167
|
+
};
|
|
168
|
+
otpInput: {
|
|
169
|
+
/** Prefix for per-slot aria-label: "Digit 1", "Digit 2"… */
|
|
170
|
+
digit: string;
|
|
171
|
+
};
|
|
125
172
|
/**
|
|
126
173
|
* Strings for the `Table` component family. Phase 1 only ships a small
|
|
127
174
|
* subset (empty/loading/caption); later phases extend this namespace
|
|
@@ -80,6 +80,9 @@ export declare function createModoUI(options?: ModoUIOptions): {
|
|
|
80
80
|
input?: string | undefined;
|
|
81
81
|
ring?: string | undefined;
|
|
82
82
|
} | undefined;
|
|
83
|
+
ai?: {
|
|
84
|
+
avatarProvider?: import('..').AvatarProvider | undefined;
|
|
85
|
+
} | undefined;
|
|
83
86
|
}, ModoConfig | {
|
|
84
87
|
color: import('./ModoConfig').ModoColor;
|
|
85
88
|
radius: import('./ModoConfig').ModoRadius;
|
|
@@ -148,6 +151,9 @@ export declare function createModoUI(options?: ModoUIOptions): {
|
|
|
148
151
|
input?: string | undefined;
|
|
149
152
|
ring?: string | undefined;
|
|
150
153
|
} | undefined;
|
|
154
|
+
ai?: {
|
|
155
|
+
avatarProvider?: import('..').AvatarProvider | undefined;
|
|
156
|
+
} | undefined;
|
|
151
157
|
}>;
|
|
152
158
|
set(next: Partial<ModoUIOptions>): void;
|
|
153
159
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface PhoneCountry {
|
|
2
|
+
/** ISO 3166-1 alpha-2 */
|
|
3
|
+
iso: string;
|
|
4
|
+
/** Dial code without leading '+' (e.g. '1', '44', '34') */
|
|
5
|
+
dial: string;
|
|
6
|
+
/** English country name */
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Derive a flag emoji from an ISO 3166-1 alpha-2 code.
|
|
11
|
+
* Each letter maps to a Regional Indicator Symbol (U+1F1E6–U+1F1FF).
|
|
12
|
+
*/
|
|
13
|
+
export declare function countryFlag(iso: string): string;
|
|
14
|
+
export declare const PHONE_COUNTRIES: readonly PhoneCountry[];
|
|
15
|
+
/** Find a country by ISO 3166-1 alpha-2 code (case-insensitive). */
|
|
16
|
+
export declare function findCountryByIso(iso: string): PhoneCountry | undefined;
|
|
17
|
+
/** Find countries by dial code (may return multiple, e.g. +1 → US + CA). */
|
|
18
|
+
export declare function findCountriesByDial(dial: string): PhoneCountry[];
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
export { default as ModoProvider } from './components/ModoProvider.vue';
|
|
2
|
-
export { MODO_CONFIG, defaultModoConfig, type ModoColor, type ModoRadius, type ModoSize, type ModoTheme, type ModoHalo, type ModoConfig, type ModoSurfaces, } from './config/ModoConfig';
|
|
2
|
+
export { MODO_CONFIG, defaultModoConfig, type ModoColor, type ModoRadius, type ModoSize, type ModoTheme, type ModoHalo, type ModoConfig, type ModoAiConfig, type ModoSurfaces, } from './config/ModoConfig';
|
|
3
3
|
export { surfacesToCssVars, darkSurfaces, type DarkSurfacePreset, } from './config/surfaces';
|
|
4
4
|
export { MODO_LOCALE, defaultLocale, mergeLocale, type ModoLocale, type PartialLocale, } from './config/ModoLocale';
|
|
5
|
-
export { locales, type LocaleKey
|
|
5
|
+
export { locales, type LocaleKey } from './config/locales';
|
|
6
6
|
export { defaultPalettes, paletteFromHex, mergePalettes, palettesToCssVars, semanticTokensFromPalettes, type ModoPalette, type ModoPalettes, type PaletteShade, } from './config/palettes';
|
|
7
7
|
export { useModoConfig, useResolvedColor, useResolvedRadius, useResolvedSize, useResolvedTheme, useResolvedHalo, useModoLocale, useLocaleString, } from './composables/useModoConfig';
|
|
8
|
-
export { useColorMode, resolveColorMode, type ColorMode } from './composables/useColorMode';
|
|
8
|
+
export { useColorMode, configureColorMode, resolveColorMode, type ColorMode, type ColorModeOptions, } from './composables/useColorMode';
|
|
9
9
|
export { useToast, useToastQueue } from './composables/useToast';
|
|
10
10
|
export { useConfirm, useConfirmQueue } from './composables/useConfirm';
|
|
11
11
|
export { useLocale } from './composables/useLocale';
|
|
12
|
+
export { useAutoScroll, type UseAutoScrollInput, } from './composables/useAutoScroll';
|
|
13
|
+
export { usePopover, type UsePopoverOptions, type PopoverPlacement, type PopoverPosition, } from './composables/usePopover';
|
|
12
14
|
export { useCalendar, isSameDay, startOfDay, type CalendarDay, type UseCalendarOptions, } from './composables/useCalendar';
|
|
13
|
-
export { eventColorClass, eventColorClassStrong, type EventColor, } from './composables/eventColors';
|
|
15
|
+
export { eventColorClass, eventColorClassStrong, hexToRgba, type EventColor, } from './composables/eventColors';
|
|
14
16
|
export { default as Button } from './components/forms/Button.vue';
|
|
15
17
|
export { default as ButtonGroup } from './components/forms/ButtonGroup.vue';
|
|
16
18
|
export { default as FormField } from './components/forms/FormField.vue';
|
|
@@ -36,7 +38,14 @@ export { default as Segmented } from './components/forms/Segmented.vue';
|
|
|
36
38
|
export { default as Rating } from './components/forms/Rating.vue';
|
|
37
39
|
export { default as ColorPicker } from './components/forms/ColorPicker.vue';
|
|
38
40
|
export { default as TagInput } from './components/forms/TagInput.vue';
|
|
41
|
+
export { default as PhoneInput } from './components/forms/PhoneInput.vue';
|
|
42
|
+
export type { PhoneInput as PhoneInputProps } from './interfaces/forms/PhoneInput.interface';
|
|
43
|
+
export { default as OTPInput } from './components/forms/OTPInput.vue';
|
|
44
|
+
export type { OTPInput as OTPInputProps } from './interfaces/forms/OTPInput.interface';
|
|
39
45
|
export { default as ColorModeSwitch } from './components/forms/ColorModeSwitch.vue';
|
|
46
|
+
export { default as AvatarUpload } from './components/forms/AvatarUpload.vue';
|
|
47
|
+
export { default as AvatarCropper } from './components/forms/AvatarCropper.vue';
|
|
48
|
+
export { createAvatarProvider, type CreateAvatarProviderOptions, } from './utils/createAvatarProvider';
|
|
40
49
|
export { default as Badge } from './components/feedback/Badge.vue';
|
|
41
50
|
export { default as Banner } from './components/feedback/Banner.vue';
|
|
42
51
|
export { default as Chip } from './components/feedback/Chip.vue';
|
|
@@ -114,6 +123,7 @@ export type * from './interfaces/forms/Rating.interface';
|
|
|
114
123
|
export type * from './interfaces/forms/ColorPicker.interface';
|
|
115
124
|
export type * from './interfaces/forms/TagInput.interface';
|
|
116
125
|
export type * from './interfaces/forms/ColorModeSwitch.interface';
|
|
126
|
+
export type * from './interfaces/forms/AvatarUpload.interface';
|
|
117
127
|
export type * from './interfaces/feedback/Badge.interface';
|
|
118
128
|
export type * from './interfaces/feedback/Banner.interface';
|
|
119
129
|
export type * from './interfaces/feedback/Chip.interface';
|