import type { MutableRefObject, CSSProperties } from 'react'; import type { BehaviorSubject } from 'rxjs'; import type { Artery, Node } from '@one-for-all/artery'; export interface Block { render: (props: BlockItemProps) => JSX.Element; style?: CSSProperties; hide?: boolean; id?: string; } export interface BlockProps extends Block { onUpdateLayer: (params: Omit & { layerId?: string; }) => void; } export interface Layer { blocks: Array>; style?: CSSProperties; id?: string; hide?: boolean; } export interface LayerProps extends Layer { zIndex: number; updateLayer: (params: UpdateLayer) => void; } export declare type LayerTransfer = (layer: Layer) => Layer; export interface BaseBlocksCommunicationState { [key: string]: any; } export declare type BlocksCommunicationState = BehaviorSubject; export interface BlockItemProps { onChange: (artery: Artery) => void; artery: Artery; sharedState: T; onSharedStateChange: (path: string, value: any) => void; commands?: CommandNameRunnerMap; commandsHasNext: boolean; commandsHasPrev: boolean; activeNode?: Node; setActiveNode: (node?: Node) => void; generateNodeId: (prefix?: string) => string; onUpdateLayer: (params: Omit & { layerId?: string; }) => void; onUpdateBlock: (params: Omit & { layerId?: string; }) => void; } export interface Props { artery: Artery; layers: Array>; blocksCommunicationStateInitialValue: T; } export interface EngineState { arteryStore$?: BehaviorSubject; blocksCommunicationState$?: BlocksCommunicationState; activeNode?: Node; useCommandState?: UseCommandState; } interface RedoUndo { undo?: () => void; redo?: () => void; } export interface Command { name: string; execute: (...args: any[]) => RedoUndo; initer?: () => ((() => void) | undefined); keyboard?: string | string[]; } export declare type CommandExecuteWrapper = (...args: any[]) => void; export declare type CommandNameRunnerMap = Record; export interface CommandState { currentUndoRedoIndex: number; redoUndoList: RedoUndo[]; commandList: Array; commandNameRunnerMap: CommandNameRunnerMap; destroyList: Array<((() => void) | undefined)>; } export interface UseCommandState { commandStateRef: MutableRefObject; registry: (command: Command) => void; commandNameRunnerMap: CommandNameRunnerMap; } export interface UpdateLayer { layerId: string; blockId?: string; name: string; value: unknown; } export {};