/**
 * store
 *
 * @author Ezios
 * @date 10:48 上午
 * @description
 * 渲染引擎状态容器
 */
import type { BlockSchema, CodeSchema, ComponentSchema, QuerySchema, RuntimeState, SchemaExpression, SchemaProps } from '@mo-fang/types';
import { ElementComponent, ElementProps } from '../models';
import type { ActionGeneratorOption, ActionsGeneratorOption, ComputedResolvedValue, FunctionGeneratorOption, InjectComponents, ResolveCodeOption, ResolveReferencesOption, SourcemapConfig, StoreProtocol } from '../types';
import { QueryValue } from './query-value';
import { StateValue } from './state-value';
export declare class Store implements StoreProtocol {
    /**
     * Schema
     */
    private schema;
    /**
     * 渲染元素树
     */
    private elementTree?;
    /**
     * 上一次渲染的 code schema
     */
    private prevCodeSchema;
    /**
     * 注入的 props
     */
    private injectProps;
    /**
     * 注入的上下文
     */
    private injectContext?;
    /**
     * uuid 为键的组件实例集合
     */
    private components;
    /**
     * 变量
     */
    private states;
    /**
     * 函数
     */
    private functions;
    /**
     * 查询
     */
    private queries;
    /**
     * uuid 为键的 props 集合，由 element 主动调用 setProps 更新
     */
    props: Record<string, ElementProps>;
    /**
     * 渲染 key，在 setSchema 时会自增，用来强制刷新组件中的 mount 逻辑
     */
    renderKey: number;
    /**
     * 注入全局上下文的组件，例如：message、notification、modal 等
     */
    injectComponents?: InjectComponents;
    /**
     * 运行时错误回调
     */
    throwRuntimeError?: (error: Error) => void;
    /**
     * 状态报告
     */
    onStateChange?: (state: RuntimeState) => void;
    constructor(throwRuntimeError?: (error: Error) => void);
    /**
     * props schema
     */
    get propsSchema(): Record<string, SchemaProps>;
    /**
     * 是否已经通过 babel 转译
     */
    get isTranspired(): boolean;
    /**
     * 执行上下文
     */
    get globalContext(): {
        injectProps: Record<string, unknown>;
        message?: {
            success(option: import("../types").MessageOption): void;
            error(option: import("../types").MessageOption): void;
            info(option: import("../types").MessageOption): void;
            warning(option: import("../types").MessageOption): void;
            loading(option: import("../types").MessageOption): void;
        } | undefined;
        notification?: {
            success(option: import("../types").NotificationOption): void;
            error(option: import("../types").NotificationOption): void;
            info(option: import("../types").NotificationOption): void;
            warning(option: import("../types").NotificationOption): void;
        } | undefined;
    };
    /**
     * 渲染树
     */
    get renderTree(): import("./element").RenderTree | undefined;
    /**
     * 获取查询
     *
     * @param id
     */
    getQuery: (id: string) => QueryValue;
    /**
     * 获取状态
     *
     * @param id
     * @returns
     */
    getState: (id: string) => StateValue;
    /**
     * 获取注入的组件
     *
     * @param name
     * @returns
     */
    getInjectComponents: (name: 'message' | 'notification') => {
        success(option: import("../types").MessageOption): void;
        error(option: import("../types").MessageOption): void;
        info(option: import("../types").MessageOption): void;
        warning(option: import("../types").MessageOption): void;
        loading(option: import("../types").MessageOption): void;
    } | {
        success(option: import("../types").NotificationOption): void;
        error(option: import("../types").NotificationOption): void;
        info(option: import("../types").NotificationOption): void;
        warning(option: import("../types").NotificationOption): void;
    } | undefined;
    /**
     * 获取指定节点的作用域
     *
     * @param nodeId
     */
    getScopeFromNodeId: (nodeId: string) => Record<string, unknown> | undefined;
    /**
     * 更新 Schema
     *
     * @param schema
     */
    setSchema: (schema: BlockSchema) => void;
    /**
     * 生成或更新渲染元素树
     */
    generateOrUpdateElementTree: (schema: ComponentSchema) => void;
    /**
     * 更新注入的 Props
     */
    setInjectProps: (injectProps?: Record<string, unknown>) => void;
    /**
     * 更新注入的上下文
     */
    setInjectContext: (injectContext?: Record<string, unknown>) => void;
    /**
     * 设置注入的组件
     */
    setInjectComponents: (componentGetter: (componentName: string) => unknown) => void;
    /**
     * 设置 Props
     *
     * @param uuid
     * @param props
     */
    setProps: (uuid: string, props?: ElementProps) => void;
    /**
     * 监听状态变化
     *
     * @param onStateChange
     */
    listenStateChange: (onStateChange: NonNullable<this['onStateChange']>) => void;
    /**
     * 生成状态
     *
     * @param codes
     * @returns
     */
    generateCode: (codes?: CodeSchema[]) => void;
    /**
     * 生成单个动作
     *
     * @param action
     * @param scope
     * @returns
     */
    generateAction: (option: ActionGeneratorOption) => (...rest: unknown[]) => Promise<unknown>;
    /**
     * 生成动作列表
     *
     * @param actions
     * @param scope
     * @returns
     */
    generateActions: ({ actions, sourcemap, ...restOption }: ActionsGeneratorOption) => (...rest: unknown[]) => Promise<unknown[]>;
    /**
     * 生成函数
     *
     * @param fn
     * @param scope
     * @param sourcemap
     */
    generateFunction: <P>({ expression, scope, ...restOption }: FunctionGeneratorOption) => (...rest: unknown[]) => P | undefined;
    /**
     * 生成自定义渲染函数
     */
    generateSchemaRender: (schemaExpression: SchemaExpression) => (() => null) | ((...rest: unknown[]) => import("react").FunctionComponentElement<{
        store: Store;
        prefixKey: string;
    }>);
    /**
     * 创建一个动态的计算值
     *
     * @param params
     */
    createComputedResolvedValue: <P = unknown>(object?: unknown, scope?: Record<string, unknown>, sourcemap?: SourcemapConfig) => ComputedResolvedValue<P>;
    /**
     * 读取数据源配置
     *
     * @param dataSourceUuid
     * @returns
     */
    getGlobalQueryConfig: (dataSourceUuid?: string) => import("@mo-fang/types").GlobalQueryConfig | undefined;
    /**
     * 解析引用
     *
     * @param object
     * @param scope
     * @param sourcemap
     * @returns
     */
    resolveReferences: <P = unknown>({ object, ...restOption }: ResolveReferencesOption) => [Error | undefined, P | undefined];
    /**
     * 解析代码
     */
    resolveCode: <P = unknown>({ code, scope, sourcemap, disableError, }: ResolveCodeOption) => (...rest: unknown[]) => [Error | undefined, P | undefined];
    /**
     * 挂载组件实例
     *
     * @param id
     * @param instance
     */
    mountInstance: (id: string, instance: unknown | ElementComponent | null) => void;
    /**
     * 运行指定查询
     *
     * @param id
     */
    runQuery: (id: QuerySchema['id']) => Promise<unknown>;
    /**
     * 运行所有自动触发的查询
     */
    runAutoQuery: () => Promise<void>;
    /**
     * 预览代码
     *
     * @param code
     */
    previewCode: (code: CodeSchema) => Promise<[
        Error | undefined,
        ({
            data: unknown;
            duration?: number;
        } | undefined)
    ]>;
    /**
     * 清理不可用的组件实例
     *
     * @param props
     */
    private clearUnavailableComponent;
    /**
     * 查询是否变更
     *
     * @param schema
     * @param nextSchema
     * @returns
     */
    private isQueryChanged;
}
//# sourceMappingURL=store.d.ts.map