import type { IAnyStateTreeNode } from 'mobx-state-tree'; import type { ImageSnapshot, Rect, Size } from './types.js'; import type { ImageToolSession, ImageToolName } from './sessions.js'; export type CloseOutcome = 'commit' | 'discard' | 'stale' | 'drop'; export interface PendingEdit { readonly tool: 'expand' | 'inpaint' | 'upscale' | 'remove-background'; cancel(): void; } export interface PendingOperation extends PendingEdit { readonly applying: boolean; readonly rect: Rect; invalidate(): void; } interface ParentNode { readonly id: string; readonly type?: string; readonly parent?: ParentNode | null; readonly selectable?: boolean; readonly visible?: boolean; readonly contentEditable?: boolean; readonly resizable?: boolean; } export interface ToolTarget extends IAnyStateTreeNode, ImageSnapshot { readonly id: string; readonly type: string; readonly contentEditable: boolean; readonly resizable: boolean; readonly selectable: boolean; readonly visible: boolean; readonly a: { readonly src?: string; }; readonly maskSrc?: string; readonly page: ParentNode | null; readonly parent: ParentNode | null; readonly store: ToolStore | null; readonly _sourceSize: Size | null; _setSourceSize(size: Size, src: string): void; readonly _pendingEdit?: PendingOperation | null; readonly pendingEdit?: PendingEdit | null; set(props: Partial): void; _setPendingEdit?(operation: PendingOperation | null): void; _setImageEditError?(message: string | null): void; } export type BasicToolName = 'selection' | 'draw' | 'pan' | 'text' | 'eraser'; export type ToolName = BasicToolName | ImageToolName; export interface ToolStore extends IAnyStateTreeNode { tool: ToolName; readonly activeTool: ImageToolSession | null; readonly role: string; readonly history: { _whenIdle(signal: AbortSignal): Promise; _commitToolChange(change: () => void): boolean; _startDraft(id: string, entry: Record): void; _draftChange(change: () => void): void; _commitDraft(): void; _discardDraft(): void; }; getElementById(id: string): ToolTarget | undefined; selectElements(ids: string[]): void; selectPage(id: string): void; _closeImageTool(outcome?: CloseOutcome): void; _didApplyImageEdit(elementId: string): void; } export {};