import type { WorkspaceCommandCapabilities } from './commands/contracts.js'; import type { ReactNode } from 'react'; import type { HostDataCapabilities } from '../binding/contracts.js'; import type { DesignDocument, DocumentNode, DocumentDuplicateMetadataRemapper } from '../document/contracts.js'; import type { WorkspaceSourceCapabilities } from './source/flowContracts.js'; import type { WorkspaceTarget } from './contracts.js'; import type { WorkspaceTokenLibraryCapabilities } from './tokens/contracts.js'; import type { TextFontPreparationRuntime } from './edit/textFontRuntime.js'; import type { TextRasterFaceResolver } from './edit/staticTextRaster.js'; import type { CapturedScreenDocumentOptions } from './capture/contracts.js'; import type { ProjectFontSourceCapabilities } from './fonts/projectFontSource.js'; export interface WorkspaceDocumentLoadProgress { phase: 'loading' | 'retrying'; /** One-based attempt, including the next attempt while waiting to retry. */ attempt: number; maxAttempts: number; } /** One target's source, data, rendering, and persistence capabilities travel together. */ export interface WorkspaceTargetConfiguration { data?: HostDataCapabilities; /** Load revision-bound declarations without blocking the editable document. */ loadData?(target: WorkspaceTarget, options: { signal: AbortSignal; }): Promise; source?: WorkspaceSourceCapabilities; duplicateMetadata?: DocumentDuplicateMetadataRemapper; /** Explicit font face and sample preparation; browser fallback rendering is not exact readiness. */ textFontPreparation?: TextFontPreparationRuntime; /** Bind a prepared face identity to its exact registered browser FontFace for static text output. */ textRasterFaceResolver?: TextRasterFaceResolver; /** Project-owned loaded stylesheet and reviewed font assets; never inferred from browser storage. */ fontSource?: ProjectFontSourceCapabilities; loadDocument?(target: WorkspaceTarget, options: { signal: AbortSignal; onProgress?(progress: WorkspaceDocumentLoadProgress): void; }): Promise; /** Read an unedited screen capture for live display; never replaces the saved draft or grants source writes. */ loadScreenBaseline?(target: WorkspaceTarget, options: { signal: AbortSignal; }): Promise; /** Restore an existing draft without importing or booting the source screen. */ loadSavedDocument?(target: WorkspaceTarget, options: { signal: AbortSignal; }): Promise; /** Explicitly recapture an imported screen; never persists or deletes the existing draft. */ reimportDocument?(target: WorkspaceTarget, options: { signal: AbortSignal; }): Promise; /** Retain a prepared capture only after the session accepts it. This must not modify the draft. */ acceptReimportDocument?(target: WorkspaceTarget, document: DesignDocument): void | Promise; /** Persist the versioned design draft; this is not permission to write source. */ saveDocument?(target: WorkspaceTarget, serializedDocument: string): Promise; /** Render the actual registered implementation with resolved input props. */ renderComponent?(node: DocumentNode, props: Readonly>, context: { document: DesignDocument; }): ReactNode; onRequestData?(request: { screenId: string; description: string; }): void; } /** Source loading and product interpretation stay with the host adapter. */ export interface WorkspaceConfiguration extends WorkspaceTargetConfiguration { /** One shared token library, independent of per-screen visual document drafts. */ tokenLibrary?: WorkspaceTokenLibraryCapabilities; commands?: WorkspaceCommandCapabilities; /** Opens the selected screen directly by default; 'view' starts with the screen browser. */ initialMode?: 'view' | 'edit'; /** Host source/session controls occupy the shared header, outside mode panels. */ chrome?: ReactNode; /** Undefined explicitly marks an unsupported screen or source revision. */ resolveTarget?(target: WorkspaceTarget): WorkspaceTargetConfiguration | undefined; /** Open any routed screen the host does not resolve as an imported design document; edits stay drafts until the host connects a source mapping. */ capturedScreens?: boolean | CapturedScreenDocumentOptions; } export interface WorkspaceTargetResolverOptions { /** The host decides whether this screen and revision have usable capabilities. */ resolve(target: Readonly): WorkspaceTargetConfiguration | undefined; /** Maximum retained target configurations; zero disables caching. Default: 8. */ maxEntries?: number; } /** Retain capability identities per screen and revision; unsupported targets remain retryable. */ export declare function createWorkspaceTargetResolver({ resolve, maxEntries }: WorkspaceTargetResolverOptions): (target: WorkspaceTarget) => WorkspaceTargetConfiguration | undefined; /** Whether Edit can open this target: its resolved capabilities include a document loader. Never loads anything. */ export declare function canEditWorkspaceTarget(configuration: WorkspaceConfiguration, target: WorkspaceTarget | null | undefined): boolean; /** An explicit target resolver never inherits capabilities from the root configuration. */ export declare function resolveWorkspaceTarget(configuration: WorkspaceConfiguration, target: WorkspaceTarget): WorkspaceTargetConfiguration | undefined; /** Compares captured capability identities without invoking any host callbacks. */ export declare function sameWorkspaceTargetConfiguration(left: WorkspaceTargetConfiguration | undefined, right: WorkspaceTargetConfiguration | undefined): boolean;