import { Component } from "./component";
export type DTPlugin<S> = S;
export type PluginCreator<S, M> = ((meta: Meta<M>) => DTPlugin<S>) & {
    type: string;
    key: string;
    dispose: () => void;
};
export type DefinedPlugin<P, S, M> = (props?: P) => PluginCreator<S, M>;
export type PluginOptions<P, S, M> = {
    setup(props: P, meta: Meta<M>): S;
    render?(time: number): void;
    destroyed?(): void;
} & ThisType<S>;
export interface Plugin<M> extends Array<PluginCreator<unknown, M>> {
    use<C>(creator: C): C extends PluginCreator<infer S, M> ? S : never;
    get<T extends Object>(name: string): T | undefined;
    has(name: string): boolean;
    remove(name: string | PluginCreator<unknown, M>): void;
    clear(): void;
}
type ComponentType<T> = T extends {
    component: infer C;
} ? C extends Component<infer M> ? M : never : never;
export type Meta<T> = T & {
    plugin: Plugin<T>;
    /**
     * 挂载插件、动画、事件等
     * @returns
     */
    use<E extends (meta: Meta<T>) => any>(extension: E): ReturnType<E>;
    search(type: string, shallow?: boolean): Component<ComponentType<T>>[];
    get(id: string, shallow?: boolean): Component<ComponentType<T>> | undefined;
    filter(callback: (component: Component<ComponentType<T>>) => boolean, shallow?: boolean): Component<ComponentType<T>>[];
    add(child: Component<ComponentType<T>>): Promise<void>;
    remove(child: Component<ComponentType<T>>): Promise<void>;
    dispose(): Promise<void>;
    clear(): Promise<void>;
};
export {};
