import { Component, Plugin } from "vue"; import { FileNames, ModalRegistry } from "./FileNameEnums"; export interface ModalOptions { closeonEsc?: boolean; closeOnOverlayClick?: boolean; [key: string]: any; } export type ModalCallback = (response: T) => void; export interface ModalItem { id: string; modalToOpen: string; data: D; cb?: ModalCallback; _resolve?: (res: T) => void; active: boolean; options?: ModalOptions; } export interface Spinner { id: string; modal: Component; group: string; } export interface FetchedModals { id: string; modal: Component; } /** * Composable to access the modal store. */ export function useModal(): { modals: ModalItem[]; spinners: Spinner[]; fetchedModals: FetchedModals[]; modalName: { value: string }; openModal: ( filename: K, data?: ModalRegistry[K]["Props"], cb?: ModalCallback, options?: ModalOptions, ) => Promise; closeModal: (response?: any, sendResponse?: boolean) => void; getModal: (name: FileNames | string) => ModalItem | undefined; loadSpinners: (modal: any, name: string, group?: string) => Promise; loadModal: (modal: any, name: string, render?: boolean) => Promise; loadGlobalSpinner: (modal: any, name: string) => Promise; }; /** * Retrieves a modal component instance by its name. */ export function getModal(filename: FileNames | string): ModalItem | undefined; /** * Opens a modal component and returns a promise that resolves when the modal is closed. */ export function openModal( filename: K, data?: ModalRegistry[K]["Props"], cb?: ModalCallback, options?: ModalOptions, ): Promise; /** * Closes the topmost open modal. */ export function closeModal(response?: any, sendResponse?: boolean): void; /** * Constant object for all modal names (generated by Vite plugin). */ export const MODALS: typeof import("./FileNameEnums").MODALS; export const ModalParent: Component; declare const modal: Plugin; export default modal;