import type { App, CSSProperties, Component, ComponentInternalInstance, FunctionalComponent, Raw, Ref } from 'vue'; import type { ComponentProps, ComponentSlots } from './Component'; export type ModalId = number | string | symbol; export type StyleValue = string | CSSProperties | (string | CSSProperties)[]; export interface ModalSlotOptions { component: Raw; attrs?: Record; } export type ModalSlot = string | Component | ModalSlotOptions; type ComponentConstructor = (abstract new (...args: any) => any); /** Including both generic and non-generic vue components */ export type ComponentType = ComponentConstructor | FunctionalComponent; export type UseModalOptions = { defaultModelValue?: boolean; keepAlive?: boolean; component?: T; attrs?: ComponentProps; slots?: { [K in keyof ComponentSlots]?: ModalSlot; }; }; export type UseModalOptionsPrivate = { id: symbol; modelValue: boolean; resolveOpened: () => void; resolveClosed: () => void; }; export interface UseModalReturnType { options: UseModalOptions & UseModalOptionsPrivate; open: () => Promise; close: () => Promise; patchOptions: (options: Partial>) => void; destroy: () => void; } export type Vfm = { install(app: App): void; modals: ComponentInternalInstance[]; openedModals: ComponentInternalInstance[]; openedModalOverlays: ComponentInternalInstance[]; dynamicModals: (UseModalOptions & UseModalOptionsPrivate)[]; modalsContainers: Ref; get: (modalId: ModalId) => undefined | ComponentInternalInstance; toggle: (modalId: ModalId, show?: boolean) => undefined | Promise; open: (modalId: ModalId) => undefined | Promise; close: (modalId: ModalId) => undefined | Promise; closeAll: () => Promise[]>; }; export type ModalExposed = { modalId?: Ref; hideOverlay?: Ref; overlayBehavior: Ref<'auto' | 'persist'>; overlayVisible: Ref; toggle: (show?: boolean) => Promise; }; export {};