import { Graphics2DEditorController, Graphics2DEditorOptions } from './graphics2d-editor'; export declare const GRAPHICS_2D_PROTOCOL_VERSION: 1; export type Graphics2DElementType = "image" | "text"; export type Graphics2DMappingStatus = "resolved" | "unresolved" | "ambiguous"; export interface Graphics2DChangedDetail { sessionId: string; targetId: string; } export interface Graphics2DSessionEndedDetail extends Graphics2DChangedDetail { committed: boolean; } export interface Graphics2DCommandFailure { code: string; message: string; details?: Record; } export interface Graphics2DErrorDetail { command: Graphics2DCommand; error: Graphics2DCommandFailure; } export interface Graphics2DSizeScaleRange { min: number; max: number; fit: number; cover?: number; } export interface Graphics2DCapabilities { protocolVersion: typeof GRAPHICS_2D_PROTOCOL_VERSION; elementTypes: Graphics2DElementType[]; transforms: Array<"position" | "scale" | "sizeScale" | "rotation" | "flipX" | "flipY" | "opacity">; surfaceFinishes: boolean; rollback: boolean; blobInput: boolean; /** Whether this Viewer build supports picking the active editable region. */ targetPicking: boolean; /** Whether this Viewer accepts and returns session-independent sizeScale. */ sizeScale?: boolean; /** Present on the aggregate Viewer capability response. */ enabled?: boolean; /** Present on the aggregate Viewer capability response. */ targetCount?: number; } export interface ViewerCapabilities { protocolVersion: typeof GRAPHICS_2D_PROTOCOL_VERSION; objectSelection: { requested: boolean; effective: boolean; }; graphics2d: Graphics2DCapabilities & { enabled: boolean; targetCount: number; }; sceneSnapshot: { schemaVersion: 1; graphics2d: boolean; }; } export interface Graphics2DSelectionModeState { enabled: boolean; activeTargetId?: string; } export interface Graphics2DTarget { id: string; name: string; editable: boolean; width: number | null; height: number | null; ownerObjectId?: string; visible: boolean; mappingStatus: Graphics2DMappingStatus; } export interface Graphics2DElement { id: string; type: Graphics2DElementType; name: string; x: number; y: number; width: number; height: number; /** Viewer-owned canonical size; image 100% means contain-fit to the region. */ sizeScale?: number; sizeScaleRange?: Graphics2DSizeScaleRange; rotation: number; opacity: number; flipX: boolean; flipY: boolean; src?: string; content?: string; fontSize?: number; fontFamily?: string; fontWeight?: string; color?: string; surfaceFinish?: Record & { id?: string; name?: string; }; } export interface Graphics2DFont { family: string; weights: string[]; } export interface Graphics2DSessionInfo { sessionId: string; targetId: string; createdAt: number; } export interface Graphics2DAddImageInput { sessionId: string; src: string | Blob; name?: string; x?: number; y?: number; width?: number; height?: number; opacity?: number; } /** @deprecated Use Graphics2DAddImageInput. */ export type AddImageInput = Graphics2DAddImageInput; export interface Graphics2DAddTextInput { sessionId: string; content: string; name?: string; x?: number; y?: number; fontSize?: number; fontFamily?: string; fontWeight?: string; color?: string; opacity?: number; } /** @deprecated Use Graphics2DAddTextInput. */ export type AddTextInput = Graphics2DAddTextInput; export interface Graphics2DUpdateElementInput { sessionId: string; elementId: string; x?: number; y?: number; /** Legacy scale relative to the session baseline. Prefer sizeScale. */ scale?: number; /** Preferred absolute size transform, independent of the edit session. */ sizeScale?: number; rotation?: number; opacity?: number; flipX?: boolean; flipY?: boolean; src?: string | Blob; content?: string; fontSize?: number; fontFamily?: string; fontWeight?: string; color?: string; /** Low-cost interactive render while dragging; false/omitted renders final quality. */ preview?: boolean; } /** @deprecated Use Graphics2DUpdateElementInput. */ export type UpdateElementInput = Graphics2DUpdateElementInput; export interface Graphics2DSurfaceFinishItem { id: string; name: string; thumbnailUrl?: string; source: "preset" | "library"; config?: Record; } /** @deprecated Use Graphics2DSurfaceFinishItem. */ export type SurfaceFinishItem = Graphics2DSurfaceFinishItem; export interface Graphics2DExportState { protocolVersion: typeof GRAPHICS_2D_PROTOCOL_VERSION; targets: Array<{ target: Graphics2DTarget; elements: Graphics2DElement[]; }>; patch: unknown[]; } export interface Graphics2DImportOptions { missingTarget?: "error" | "skip"; } export interface Graphics2DApplySurfaceFinishResult { elements: Graphics2DElement[]; warning?: string; } export interface Graphics2DTargetSelectedDetail { targetId: string; ownerObjectId?: string; mappingStatus: Graphics2DTarget["mappingStatus"]; } export type Graphics2DCommand = "graphics2d.getCapabilities" | "graphics2d.listTargets" | "graphics2d.beginSession" | "graphics2d.listElements" | "graphics2d.listFonts" | "graphics2d.addImage" | "graphics2d.addText" | "graphics2d.updateElement" | "graphics2d.removeElement" | "graphics2d.listSurfaceFinishes" | "graphics2d.applySurfaceFinish" | "graphics2d.clearSurfaceFinish" | "graphics2d.commit" | "graphics2d.rollback" | "graphics2d.exportState" | "graphics2d.importState" | "graphics2d.setSelectionMode" | "graphics2d.getSelectionMode"; export declare class Graphics2DCommandError extends Error { readonly code: string; readonly details?: Record; constructor(code: string, message: string, details?: Record); } export interface ViewerCommandErrorPayload extends Graphics2DCommandFailure { } /** @deprecated Graphics2D commands now throw Graphics2DCommandError. */ export declare class ViewerCommandError extends Graphics2DCommandError { constructor(payload: ViewerCommandErrorPayload); } export interface Graphics2DClient { createEditor(options?: Graphics2DEditorOptions): Graphics2DEditorController; getCapabilities(): Promise; listTargets(): Promise; beginSession(targetId: string): Promise; listElements(input: { sessionId?: string; targetId?: string; }): Promise; listFonts(): Promise; addImage(input: Graphics2DAddImageInput): Promise; addText(input: Graphics2DAddTextInput): Promise; updateElement(input: Graphics2DUpdateElementInput): Promise; removeElement(sessionId: string, elementId: string): Promise; listSurfaceFinishes(): Promise; applySurfaceFinish(sessionId: string, elementId: string, finishId: string): Promise; clearSurfaceFinish(sessionId: string, elementId: string): Promise; commit(sessionId: string): Promise; rollback(sessionId: string): Promise; exportState(): Promise; importState(state: Graphics2DExportState, options?: Graphics2DImportOptions): Promise; setSelectionMode(enabled: boolean): Promise; getSelectionMode(): Promise; }