import { COLORS, PLACEMENTS, ALIGNS, CSS_POSITION, SIZES } from './constants'; import { Component, Ref } from 'vue'; import { VsAccordionStyleSet, VsAvatarStyleSet, VsBlockStyleSet, VsButtonStyleSet, VsCheckboxNodeStyleSet, VsCheckboxStyleSet, VsCheckboxSetStyleSet, VsChipStyleSet, VsConfirmStyleSet, VsDividerStyleSet, VsDrawerStyleSet, VsFileInputStyleSet, VsFooterStyleSet, VsHeaderStyleSet, VsImageStyleSet, VsInputStyleSet, VsLabelValueStyleSet, VsLoadingStyleSet, VsMenuButtonStyleSet, VsModalNodeStyleSet, VsNoticeStyleSet, VsPageStyleSet, VsPaginationStyleSet, VsProgressStyleSet, VsRadioNodeStyleSet, VsRadioStyleSet, VsRadioSetStyleSet, VsSectionStyleSet, VsSelectStyleSet, VsStepperStyleSet, VsSwitchStyleSet, VsTableStyleSet, VsTabsStyleSet, VsTextareaStyleSet, VsTextWrapStyleSet, VsThemeButtonStyleSet, VsTooltipStyleSet } from '../components'; import { VsComponent } from './enums'; export type ColorScheme = (typeof COLORS)[number]; export type GlobalColorScheme = { default?: ColorScheme; } & { [key in VsComponent]?: ColorScheme; } & { [key: string]: ColorScheme; }; export interface VsBoxStyleSet { backgroundColor?: string; fontColor?: string; fontSize?: string; fontWeight?: string | number; padding?: string; } export interface VsFlexStyleSet { flexDirection?: string; flexWrap?: string; alignItems?: string; justifyContent?: string; } export interface VsTextStyleSet { fontColor?: string; fontSize?: string; fontWeight?: string | number; whiteSpace?: string; } export interface VsComponentStyleSet { VsAccordion?: { [key: string]: VsAccordionStyleSet; }; VsAvatar?: { [key: string]: VsAvatarStyleSet; }; VsBlock?: { [key: string]: VsBlockStyleSet; }; VsButton?: { [key: string]: VsButtonStyleSet; }; VsCheckbox?: { [key: string]: VsCheckboxStyleSet; }; VsCheckboxNode?: { [key: string]: VsCheckboxNodeStyleSet; }; VsCheckboxSet?: { [key: string]: VsCheckboxSetStyleSet; }; VsChip?: { [key: string]: VsChipStyleSet; }; VsConfirm?: { [key: string]: VsConfirmStyleSet; }; VsDivider?: { [key: string]: VsDividerStyleSet; }; VsDrawer?: { [key: string]: VsDrawerStyleSet; }; VsFileInput?: { [key: string]: VsFileInputStyleSet; }; VsFooter?: { [key: string]: VsFooterStyleSet; }; VsHeader?: { [key: string]: VsHeaderStyleSet; }; VsImage?: { [key: string]: VsImageStyleSet; }; VsInput?: { [key: string]: VsInputStyleSet; }; VsLabelValue?: { [key: string]: VsLabelValueStyleSet; }; VsLoading?: { [key: string]: VsLoadingStyleSet; }; VsMenuButton?: { [key: string]: VsMenuButtonStyleSet; }; VsModal?: { [key: string]: VsModalNodeStyleSet; }; VsModalNode?: { [key: string]: VsModalNodeStyleSet; }; VsNotice?: { [key: string]: VsNoticeStyleSet; }; VsPage?: { [key: string]: VsPageStyleSet; }; VsPagination?: { [key: string]: VsPaginationStyleSet; }; VsProgress?: { [key: string]: VsProgressStyleSet; }; VsRadio?: { [key: string]: VsRadioStyleSet; }; VsRadioNode?: { [key: string]: VsRadioNodeStyleSet; }; VsRadioSet?: { [key: string]: VsRadioSetStyleSet; }; VsSection?: { [key: string]: VsSectionStyleSet; }; VsSelect?: { [key: string]: VsSelectStyleSet; }; VsStepper?: { [key: string]: VsStepperStyleSet; }; VsSwitch?: { [key: string]: VsSwitchStyleSet; }; VsTable?: { [key: string]: VsTableStyleSet; }; VsTabs?: { [key: string]: VsTabsStyleSet; }; VsTextarea?: { [key: string]: VsTextareaStyleSet; }; VsTextWrap?: { [key: string]: VsTextWrapStyleSet; }; VsThemeButton?: { [key: string]: VsThemeButtonStyleSet; }; VsTooltip?: { [key: string]: VsTooltipStyleSet; }; } export type StyleSet = VsComponentStyleSet & { [key: string]: { [key: string]: any; }; }; export interface VlossomOptions { components?: VsComponent[]; colorScheme?: GlobalColorScheme; styleSet?: StyleSet; theme?: 'light' | 'dark'; darkThemeClass?: string; detectOSTheme?: boolean; radiusRatio?: 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' | 'selected'; export interface StateMessage { state: T; text: string; } export type Rule = ((v: T) => string) | ((v: T) => PromiseLike); export type Message = StateMessage | ((v: T) => StateMessage) | ((v: T) => PromiseLike); export interface InputComponentParams { inputValue: Ref; modelValue: Ref; id?: Ref; disabled?: Ref; readonly?: Ref; messages?: Ref[]>; rules?: Ref[]>; defaultRules?: Rule[]; noDefaultRules?: Ref; state?: Ref; callbacks?: { onBeforeMount?: () => void; onMounted?: () => void; onChange?: (newValue: T, oldValue: T) => void; onClear?: () => void; onBeforeUnmount?: () => void; onUnmounted?: () => void; }; } export interface FormRef { validate: () => void; clear: () => void; } export interface InputRef extends FormRef { focus: () => void; blur: () => void; } export interface StringModifiers { capitalize?: boolean; lower?: boolean; upper?: boolean; } export interface VsFormProvide { disabled: Ref; readonly: Ref; changedObj: Ref>; validObj: Ref>; validateFlag: Ref; clearFlag: Ref; updateChanged: (id: string, changed: boolean) => void; updateValid: (id: string, valid: boolean) => void; removeFromForm: (id: string) => void; } export interface BarLayout { position: (typeof CSS_POSITION)[number]; height: string; } export interface DrawerLayout { drawerOpen: boolean; placement: Exclude; size: string; } export interface DrawerLayouts { left: DrawerLayout; top: DrawerLayout; right: DrawerLayout; bottom: DrawerLayout; } export interface VsLayoutProvide { header: Ref; footer: Ref; drawers: Ref; setHeaderLayout: (headerLayout: BarLayout) => void; setFooterLayout: (footerLayout: BarLayout) => void; setDrawerLayout: (drawerLayout: DrawerLayout) => void; } export type Placement = (typeof PLACEMENTS)[number]; export type Size = (typeof SIZES)[number]; export type SizeProp = Size | string | number; export interface LabelValue { label: string; value: T; } export type Align = (typeof ALIGNS)[number]; export interface Focusable { focus(): void; blur(): void; } export interface AttachInfo { placement?: Exclude; align?: Align; margin?: number; followWidth?: boolean; } export type OverlayCallbacks = { [eventName: string]: (...args: any[]) => T | Promise; }; export interface ModalOptions { component: string | Component; props?: Record; container?: string; colorScheme?: ColorScheme; styleSet?: string | T; callbacks?: OverlayCallbacks; dimClose?: boolean; dimmed?: boolean; escClose?: boolean; focusLock?: boolean; id?: string; initialFocusRef?: HTMLElement | null; scrollLock?: boolean; size?: string | number | { width?: string | number; height?: string | number; }; } export interface ToastOptions { container?: string; colorScheme?: ColorScheme; styleSet?: string | T; align?: Align; autoClose?: boolean; placement?: Exclude; primary?: boolean; timeout?: number; logger?: (message: string | Component) => string; } export interface ToastInfo extends ToastOptions { id: string; content: string | Component; }