import { CompactNode, SerializedNodes } from '../compact'; import { NodeRegistry } from '../registry'; export type Position = 'start' | 'end' | { before: string; } | { after: string; }; export type Op = { op: 'insert'; parentId: string; position: Position; node: CompactNode; } | { op: 'replace'; targetId: string; node: CompactNode; } | { op: 'update'; targetId: string; set?: Record; unset?: string[]; text?: string; } | { op: 'remove'; targetId: string; } | { op: 'move'; targetId: string; parentId: string; position: Position; }; export type Proposal = { summary: string; ops: Op[]; }; /** Primitive, ordered edits. `index` is relative to the state after all earlier steps. */ export type Step = { kind: 'remove'; id: string; } | { kind: 'relocate'; id: string; parentId: string; index: number; } | { kind: 'add'; parentId: string; index: number; rootId: string; nodes: SerializedNodes; } | { kind: 'setProps'; id: string; set?: Record; unset?: string[]; text?: string; }; export type PlanOptions = { newId?: () => string; registry?: NodeRegistry; };