import { ActionFunction, PromiseActorLogic, EventObject, CancelAction, LogAction, GuardArgs, ActorRef, MachineSnapshot, AnyActorRef, StateValue, AnyEventObject, DoneActorEvent, ErrorActorEvent, ActionArgs } from 'xstate'; import { EditorActorContext, EditorActorEvent, EditorActorEmitedEvent } from './types'; import { HotkeyActorLogic } from './hotkey'; import { DiagramView, Any, ViewId, ViewChange } from '@likec4/core'; export declare const syncQueue: { initial: string; states: { idle: { always: { target: "#queue-pending"; guard: "has pending"; }; on: { 'delete.nodes-edges': { actions: ActionFunction; id: string | undefined; } | { src: "executeChange"; logic: PromiseActorLogic; id: string | undefined; } | { src: "applySemanticLayout"; logic: PromiseActorLogic; id: string | undefined; }, never, { type: "has pending"; params: unknown; } | { type: "can undo"; params: unknown; } | { type: "can redo"; params: unknown; }, "500ms" | "wait-after-edit", EditorActorEmitedEvent>; }; 'change.sync-snapshot': { target: "#queue-pending"; actions: ActionFunction; id: string | undefined; } | { src: "executeChange"; logic: PromiseActorLogic; id: string | undefined; } | { src: "applySemanticLayout"; logic: PromiseActorLogic; id: string | undefined; }, never, never, never, never>; }; 'change.*': { target: "#queue-process"; actions: ActionFunction; id: string | undefined; } | { src: "executeChange"; logic: PromiseActorLogic; id: string | undefined; } | { src: "applySemanticLayout"; logic: PromiseActorLogic; id: string | undefined; }, never, never, never, never>; }; undo: { actions: ActionFunction; id: string | undefined; } | { src: "executeChange"; logic: PromiseActorLogic; id: string | undefined; } | { src: "applySemanticLayout"; logic: PromiseActorLogic; id: string | undefined; }, never, { type: "has pending"; params: unknown; } | { type: "can undo"; params: unknown; } | { type: "can redo"; params: unknown; }, "500ms" | "wait-after-edit", EditorActorEmitedEvent>; }; redo: { actions: ActionFunction; id: string | undefined; } | { src: "executeChange"; logic: PromiseActorLogic; id: string | undefined; } | { src: "applySemanticLayout"; logic: PromiseActorLogic; id: string | undefined; }, never, { type: "has pending"; params: unknown; } | { type: "can undo"; params: unknown; } | { type: "can redo"; params: unknown; }, "500ms" | "wait-after-edit", EditorActorEmitedEvent>; }; cancel: { target: "#queue-idle"; actions: CancelAction; }; 'view.synched': { actions: LogAction; }; }; id: string; }; pending: { on: { 'change.sync-snapshot': { target: "#queue-pending"; reenter: true; actions: ActionFunction; id: string | undefined; } | { src: "executeChange"; logic: PromiseActorLogic; id: string | undefined; } | { src: "applySemanticLayout"; logic: PromiseActorLogic; id: string | undefined; }, never, never, never, never>; }; 'change.*': { target: "#queue-process"; actions: ActionFunction; id: string | undefined; } | { src: "executeChange"; logic: PromiseActorLogic; id: string | undefined; } | { src: "applySemanticLayout"; logic: PromiseActorLogic; id: string | undefined; }, never, never, never, never>; }; 'delete.nodes-edges': { target: "#queue-pending"; actions: ActionFunction; id: string | undefined; } | { src: "executeChange"; logic: PromiseActorLogic; id: string | undefined; } | { src: "applySemanticLayout"; logic: PromiseActorLogic; id: string | undefined; }, never, { type: "has pending"; params: unknown; } | { type: "can undo"; params: unknown; } | { type: "can redo"; params: unknown; }, "500ms" | "wait-after-edit", EditorActorEmitedEvent>; reenter: true; }; 'edit.move.start': { target: "#queue-suspended"; }; undo: { target: "#queue-pending"; reenter: true; actions: ActionFunction; id: string | undefined; } | { src: "executeChange"; logic: PromiseActorLogic; id: string | undefined; } | { src: "applySemanticLayout"; logic: PromiseActorLogic; id: string | undefined; }, never, { type: "has pending"; params: unknown; } | { type: "can undo"; params: unknown; } | { type: "can redo"; params: unknown; }, "500ms" | "wait-after-edit", EditorActorEmitedEvent>; }; redo: { target: "#queue-pending"; reenter: true; actions: ActionFunction; id: string | undefined; } | { src: "executeChange"; logic: PromiseActorLogic; id: string | undefined; } | { src: "applySemanticLayout"; logic: PromiseActorLogic; id: string | undefined; }, never, { type: "has pending"; params: unknown; } | { type: "can undo"; params: unknown; } | { type: "can redo"; params: unknown; }, "500ms" | "wait-after-edit", EditorActorEmitedEvent>; }; cancel: { target: "#queue-idle"; actions: ActionFunction; id: string | undefined; } | { src: "executeChange"; logic: PromiseActorLogic; id: string | undefined; } | { src: "applySemanticLayout"; logic: PromiseActorLogic; id: string | undefined; }, never, never, never, never>; }; 'view.synched': { actions: LogAction; }; }; after: { 'wait-after-edit': ({ readonly target: "#queue-idle"; } | { target: "#queue-process"; guard: "has pending"; })[]; }; id: string; }; suspended: { on: { 'edit.*': { readonly target: "#queue-idle"; }; cancel: { target: "#queue-idle"; actions: CancelAction[]; }; }; id: string; }; process: { initial: string; tags: "busy"[]; states: { peekFromQueue: { entry: ActionFunction; id: string | undefined; } | { src: "executeChange"; logic: PromiseActorLogic; id: string | undefined; } | { src: "applySemanticLayout"; logic: PromiseActorLogic; id: string | undefined; }, never, never, never, never>; always: ({ guard: ({ context: { processing } }: GuardArgs) => boolean; target: string; } | { target: "#queue-process"; guard: "has pending"; reenter: true; } | { target: "#queue-idle"; actions: ActionFunction; id: string | undefined; } | { src: "executeChange"; logic: PromiseActorLogic; id: string | undefined; } | { src: "applySemanticLayout"; logic: PromiseActorLogic; id: string | undefined; }, never, never, never, never>; guard?: never; })[]; }; /** * Syncing state, some edits are not yet synced */ applyLatestToManual: { initial: string; entry: ActionFunction; id: string | undefined; } | { src: "executeChange"; logic: PromiseActorLogic; id: string | undefined; } | { src: "applySemanticLayout"; logic: PromiseActorLogic; id: string | undefined; }, never, never, never, never>; states: { call: { invoke: { src: "applyLatest"; input: ({ context }: { context: EditorActorContext; event: EditorActorEvent; self: ActorRef, StateValue, string, unknown, any, any>, EditorActorEvent, AnyEventObject>; }) => { current: DiagramView; viewId: ViewId; }; onDone: { actions: ActionFunction, EditorActorEvent, undefined, never, never, never, "500ms" | "wait-after-edit", never>; target: string; }; onError: { target: "#queue-idle"; actions: ActionFunction, EditorActorEvent, undefined, { src: "hotkey"; logic: HotkeyActorLogic; id: "hotkey"; } | { src: "applyLatest"; logic: PromiseActorLogic; id: string | undefined; } | { src: "executeChange"; logic: PromiseActorLogic; id: string | undefined; } | { src: "applySemanticLayout"; logic: PromiseActorLogic; id: string | undefined; }, never, never, never, never>; }; }; }; wait: { on: { '*': { actions: LogAction; }; }; after: { '500ms': { target: "#queue-idle"; actions: ( ActionFunction | ActionFunction; id: string | undefined; } | { src: "executeChange"; logic: PromiseActorLogic; id: string | undefined; } | { src: "applySemanticLayout"; logic: PromiseActorLogic; id: string | undefined; }, never, never, never, never>)[]; }; }; }; }; }; /** * User requested semantic layout, we will call the AI */ applySemanticLayout: { tags: "ai-semantic-layout"[]; invoke: { src: "applySemanticLayout"; input: ({ context }: { context: EditorActorContext; event: EditorActorEvent; self: ActorRef, StateValue, string, unknown, any, any>, EditorActorEvent, AnyEventObject>; }) => { viewId: ViewId; }; onDone: { target: string; }; onError: { actions: ({ event }: ActionArgs, EditorActorEvent>) => void; target: string; }; }; }; /** * Calls `executeChange` to save the snapshot */ executeChanges: { invoke: { src: "executeChange"; input: ({ context: { processing, syncQueue, viewId } }: { context: EditorActorContext; event: EditorActorEvent; self: ActorRef, StateValue, string, unknown, any, any>, EditorActorEvent, AnyEventObject>; }) => { changes: ViewChange[]; viewId: ViewId; }; onDone: { actions: ActionFunction, EditorActorEvent, undefined, { src: "hotkey"; logic: HotkeyActorLogic; id: "hotkey"; } | { src: "applyLatest"; logic: PromiseActorLogic; id: string | undefined; } | { src: "executeChange"; logic: PromiseActorLogic; id: string | undefined; } | { src: "applySemanticLayout"; logic: PromiseActorLogic; id: string | undefined; }, never, { type: "has pending"; params: unknown; } | { type: "can undo"; params: unknown; } | { type: "can redo"; params: unknown; }, "500ms" | "wait-after-edit", EditorActorEmitedEvent>; target: string; }; onError: { actions: ({ event }: ActionArgs, EditorActorEvent>) => void; target: string; }; }; }; waitViewSynced: { on: { 'view.synched': { target: string; }; }; after: { 2000: string; }; }; decideNext: { entry: ActionFunction; id: string | undefined; } | { src: "executeChange"; logic: PromiseActorLogic; id: string | undefined; } | { src: "applySemanticLayout"; logic: PromiseActorLogic; id: string | undefined; }, never, never, never, never>; always: ({ readonly target: "#queue-idle"; } | { target: "#queue-process"; guard: "has pending"; reenter: true; })[]; }; failure: { always: { target: "#queue-idle"; actions: ActionFunction; id: string | undefined; } | { src: "executeChange"; logic: PromiseActorLogic; id: string | undefined; } | { src: "applySemanticLayout"; logic: PromiseActorLogic; id: string | undefined; }, never, never, never, never>; }; }; }; on: {}; id: string; }; }; on: {}; };