oui-kit
Version:
🎯 *UI toolkit with a French touch* 🇫🇷
25 lines (24 loc) • 972 B
TypeScript
import { App, Component } from 'vue';
/**
* Creates a temporary Vue app from a component and mounts it to the DOM.
* Useful for temporary UI elements like menus, dialogs, or notifications.
*
* @template T - The type of value returned when the component is done
* @param component - The Vue component to mount
* @param props - Props to pass to the component
* @param delay - Optional delay in milliseconds before cleanup after done() is called
* @returns Object containing app instance, done callback, cancel callback, and awaitDone promise
*
* @example
* ```typescript
* const { done, awaitDone } = mountComponentAsApp(MyMenu, { items: [] })
* const result = await awaitDone
* console.log('Menu closed with result:', result)
* ```
*/
export declare function mountComponentAsApp<T>(component: Component, props: Record<string, any>, delay?: number): {
app: App<any>;
done: (value?: any) => void;
cancel: () => void;
awaitDone: Promise<T>;
};