import { DataLoader, LiteralObject } from '@p-lc/shared'; import { ReactNode } from 'react'; import { Get } from 'type-fest'; import { AnyEditorPlugin, Editor, EditorDefaultPropertiesExtHkt, EditorDefaultPropertiesExtHktPlugin, EditorRawPlugin } from '../../types'; import { editorPluginName } from '../editor-plugin-name'; import { editorPluginUidlStore } from '../uidl-store-plugins'; /** * 编辑器布局仓库插件属性扩展高等类型 */ export interface EditorPluginLayoutStorePropertiesExtHkt { editor: { /** * 布局仓库 */ layoutStore: { /** * 配置 */ config: LiteralObject; /** * 状态 */ state: LiteralObject; /** * 设置状态 * @param state 状态 * @param autoSave 自动保存,默认 true */ setState: (state: Partial>, autoSave?: boolean) => void; /** * 状态加载器 */ stateLoader: LayoutStoreStateLoader | null; /** * UIDL 状态 */ uidlState: LiteralObject; /** * 设置 UIDL 状态 * @param uidlState UIDL 状态 * @param autoSave 自动保存,默认 true */ setUidlState: (uidlState: Partial>, autoSave?: boolean) => void; /** * UIDL 状态加载器 */ uidlStateLoader: LayoutStoreUidlStateLoader | null; /** * 渲染布局,由其他插件实现 */ render: () => ReactNode; }; }; } /** * 布局仓库状态 */ export type LayoutStoreState = Get, [ 'layoutStore', 'state' ]>; /** * 布局仓库状态加载器 */ export type LayoutStoreStateLoader = DataLoader | null>; /** * 布局仓库 UIDL 状态 */ export type LayoutStoreUidlState = Get, [ 'layoutStore', 'uidlState' ]>; /** * 布局仓库 UIDL 状态加载器 */ export type LayoutStoreUidlStateLoader = DataLoader | null>; /** * EditorPluginLayoutStorePropertiesExtHkt 辅助类型 */ export interface $EditorPluginLayoutStorePropertiesExtHkt extends EditorDefaultPropertiesExtHkt { type: EditorPluginLayoutStorePropertiesExtHkt>; } /** * 编辑器布局仓库插件 */ export declare const editorPluginLayoutStore: EditorRawPlugin<$EditorPluginLayoutStorePropertiesExtHkt, typeof editorPluginName | typeof editorPluginUidlStore>; //# sourceMappingURL=editor-plugin-layout-store.d.ts.map