import type { DesignImportKind } from './designImport.js'; import type { InspectQaResult } from './visualQa.js'; export interface ApplyPayload { tokens: { name: string; value: string; }[]; pages: { id: string; name: string; path: string; width: number; height: number; canvas: string; section?: string; jsx: string; }[]; } /** Result returned after the host applies inspected source changes. */ export interface InspectApplyResult { applied: number; /** Modification session branch created by the host. */ branch?: string; /** Result of merging with latest development code. */ integration?: 'up_to_date' | 'auto_merged' | 'review_required' | 'conflict' | 'offline'; /** Text of application results to show to the designer. */ message?: string; /** Comparison of DOM·PNG recapture of the impact screen immediately after application. */ qa?: InspectQaResult; } export interface InspectPreviewResult { revision: number; files: { file: string; diff: string; }[]; affectedFiles: string[]; /** Based on comparison of impact screens captured in current revision. */ qa?: InspectQaResult; } /** A frame the node side decided a source change reaches. */ export interface InspectImpactFrame { /** The canonical frame id the editor and the capture worker share. */ id: string; name?: string; } export interface InspectImpactResult { files: string[]; /** Present when the service knows the revision catalog; the editor prefers it to its own matching. */ frames?: InspectImpactFrame[]; } /** * Unit of code edited on the canvas. * The save UI is not divided according to asset type. icon/atom/component/screen are all * It is the same JSX document, and the only difference is that the token is a value document, leaving the transport payload. */ export interface DesignCodeDocument { type: 'document'; id: string; kind: DesignImportKind; name: string; canvas: string; section?: string; path?: string; route?: string; width: number; height: number; assetIds: string[]; sourcePaths: string[]; jsx: string; } export interface DesignTokenDocument { type: 'token'; id: string; kind: 'design-tokens'; name: string; value: string; } export type DesignElementDocument = DesignCodeDocument | DesignTokenDocument; export interface DesignElementChange { operation: 'upsert' | 'delete'; element: DesignElementDocument; } /** Successive edits of one element are combined into one final state and delivered to the host. */ export interface DesignChangePayload { revision: number; /** Exact source checkout that owned the edited document batch. */ sourceRevision?: string; /** * Aborted when that source checkout is retired before the host finishes. * This property is intentionally non-enumerable at runtime so JSON * transports keep their existing payload shape unless they explicitly read * the signal. */ signal?: AbortSignal; changes: DesignElementChange[]; } export interface DesignChangeResult { saved: number; files?: string[]; message?: string; }