Types

The exported types in VueFinalModal.

ComponentProps

export type ComponentProps = ComponentPublicInstance['$props']

ModalId

export type ModalId = number | string | symbol

StyleValue

export type StyleValue = string | CSSProperties | (string | CSSProperties)[]

ModalSlot

export interface ModalSlotOptions { component: Raw<Component>; attrs?: Record<string, any> }
export type ModalSlot = string | Component | ModalSlotOptions

UseModalOptions

export type UseModalOptions<P> = {
defaultModelValue?: boolean
keepAlive?: boolean
component?: Constructor<P>
attrs?: (RawProps & P) | ({} extends P ? null : never)
slots?: {
[key: string]: ModalSlot
}
}

UseModalOptionsPrivate

export type UseModalOptionsPrivate = {
id: symbol
modelValue: boolean
resolveOpened: () => void
resolveClosed: () => void
}

UseModalReturnType

export interface UseModalReturnType<P> {
options: UseModalOptions<P> & UseModalOptionsPrivate
open: () => Promise<string>
close: () => Promise<string>
patchOptions: (options: Partial<UseModalOptions<P>>) => void
destroy: () => void
}

Vfm

export type Vfm = {
install(app: App): void
modals: ComputedRef<Modal>[]
openedModals: ComputedRef<Modal>[]
openedModalOverlays: ComputedRef<Modal>[]
dynamicModals: (UseModalOptions<any> & UseModalOptionsPrivate)[]
modalsContainers: Ref<symbol[]>
get: (modalId: ModalId) => undefined | ComputedRef<Modal>
toggle: (modalId: ModalId, show?: boolean) => undefined | Promise<string>
open: (modalId: ModalId) => undefined | Promise<string>
close: (modalId: ModalId) => undefined | Promise<string>
closeAll: () => Promise<[PromiseSettledResult<Promise<string>[]>]>
}
export type Modal = {
modalId?: ModalId
hideOverlay: Ref<boolean | undefined> | undefined
overlayVisible: Ref<boolean>
toggle: (show?: boolean) => Promise<string>
}