import { Component, Ref } from 'vue'; import { VsComponentRegistry } from '../components/component-map'; import { ALIGNMENTS, COLOR_SCHEMES, PLACEMENTS, SIZES, TEXT_ALIGNMENTS, VERTICAL_ALIGNMENTS } from './constants'; import { VsComponent } from './enums'; import { VlossomMessages } from './messages'; export type ColorScheme = (typeof COLOR_SCHEMES)[number]; export type Theme = 'light' | 'dark'; export type GlobalColorSchemes = { [key in VsComponent]?: ColorScheme; } & { default?: ColorScheme; } & { [key: string]: ColorScheme; }; export type GlobalStyleSets = { [key: string]: { [key in VsComponent]?: any; } & { [key: string]: any; }; }; export interface VlossomOptions { components: { [key: string]: Component; }; colorScheme?: GlobalColorSchemes; styleSet?: GlobalStyleSets; theme?: Theme; radiusRatio?: number; messages?: Partial; } export type CssPosition = 'static' | 'relative' | 'absolute' | 'fixed' | 'sticky'; export type Placement = (typeof PLACEMENTS)[number]; export type Alignment = (typeof ALIGNMENTS)[number]; export type TextAlignment = (typeof TEXT_ALIGNMENTS)[number]; export type VerticalAlignment = (typeof VERTICAL_ALIGNMENTS)[number]; export interface BarLayout { position: CssPosition; height: string; } export type DrawerPlacement = 'top' | 'bottom' | 'left' | 'right'; export type OverlayTuple = [string, Ref]; export type OverlayCallbacks = { [eventName: string]: (...args: any[]) => T | Promise; }; export interface DrawerLayout { isOpen: boolean; pushContainer: boolean; placement: DrawerPlacement; size: string; } export type DrawerLayouts = { [key in DrawerPlacement]: DrawerLayout; }; export type Size = (typeof SIZES)[number]; export type SizeProp = Size | string | number; export interface Breakpoints { xs?: string | number; sm?: string | number; md?: string | number; lg?: string | number; xl?: string | number; } export type UIState = 'idle' | 'success' | 'info' | 'error' | 'warning'; export interface StateMessage { state: T; text: string; } export type ValueOrFunction = V | ((value: T) => V) | ((value: T) => PromiseLike); export type Rule = ((v: T) => string) | ((v: T) => PromiseLike); export type Message = ValueOrFunction; export type PropsOf = InstanceType['$props']; export type AttrsOf = InstanceType['$attrs']; export type EmitsOf = InstanceType['$emit']; export type SlotsOf = InstanceType['$slots']; export interface InputComponentParams { inputValue: Ref; modelValue: Ref; id?: Ref; disabled?: Ref; readonly?: Ref; messages?: Ref[]>; rules?: Ref[]>; defaultRules?: Ref[]>; noDefaultRules?: Ref; state?: Ref; callbacks?: { onBeforeMount?: () => void; onMounted?: () => void; onChange?: (newValue: T, oldValue: T) => void; onClear?: () => void; onBeforeUnmount?: () => void; onUnmounted?: () => void; }; } export interface FormChildRef { validate: () => boolean; clear: () => void; reset: () => void; } export interface FocusableRef { focus: () => void; blur: () => void; } export interface StringModifiers { capitalize?: boolean; lower?: boolean; upper?: boolean; } export interface SearchOptions { useRegex?: boolean; useCaseSensitive?: boolean; placeholder?: string; } export type SearchProps = boolean | SearchOptions; export interface OptionItem { id: string; item: any; label: string; value: any; index: number; disabled: boolean; } export type MessageParams = Record; export type VlossomMessage = string | ((params: MessageParams) => string);