import type { Emitter } from 'mitt';
import type { AssetPackage, CPage } from '@worldprinter/lowcode-model';
import type { Workbench } from '../component/Workbench';
import type { CustomI18n } from '../i18n';
import type { Engine } from '../index';
export type PluginObj = {
    name: string;
    init: (ctx: CPluginCtx) => Promise<void>;
    destroy: (ctx: CPluginCtx) => Promise<void>;
    /** 用于暴露给外部重载插件 */
    reload?: (ctx: CPluginCtx) => Promise<void>;
    /** 插件暴露给外部可以调用的方法 */
    exports: (ctx: CPluginCtx) => any;
    meta: {
        engine: {
            version: string;
        };
    };
};
export type CPlugin = PluginObj | ((ctx: CPluginCtx) => PluginObj);
type PluginManagerOptions = {
    getWorkbench: () => Workbench;
    emitter: Emitter<any>;
    pageModel: CPage;
    i18n: CustomI18n;
    assets: AssetPackage[];
    engine: Engine;
};
export type CPluginCtx<C = any> = {
    globalEmitter: Emitter<any>;
    /** 当前插件外部传入的配置 **/
    config: C;
    pluginManager: PluginManager;
    pluginReadyOk: () => void;
} & PluginManagerOptions;
export type PluginInstance = {
    ctx: CPluginCtx;
    exports: any;
    source: PluginObj;
    ready: boolean;
};
export type CustomPluginHook = (pluginInstance: PluginInstance) => PluginInstance;
export declare class PluginManager {
    plugins: Map<string, PluginInstance>;
    emitter: Emitter<any>;
    getWorkbench: () => Workbench;
    pageModel: CPage;
    i18n: CustomI18n;
    assets: AssetPackage[];
    engine: Engine;
    customPluginHooks: Record<string, CustomPluginHook[]>;
    constructor({ getWorkbench, emitter, pageModel, i18n, assets, engine }: PluginManagerOptions);
    /** 自定义插件, 可以修改插件的配置 */
    customPlugin: (pluginName: string, customPluginHook: CustomPluginHook) => void;
    createPluginCtx: () => CPluginCtx<any>;
    add(plugin: CPlugin): Promise<void>;
    get(pluginName: string): Promise<PluginInstance | undefined>;
    remove(name: string): Promise<void>;
    onPluginReadyOk(pluginName: string, cb?: (pluginHandle: PluginInstance) => void): Promise<PluginInstance> | undefined;
}
export {};
