import type { Document as ReferenceDocument, DocumentTextStyle as ReferenceDocumentTextStyle } from "@opengeni/artifact-tool/reference"; import { type ReactNode } from "react"; export type DocumentLayoutMode = "paginated" | "continuous"; export type DocumentSelection = { blockId: string; start: number; end: number; }; export type DocumentCommit = { kind: "text"; blockId: string; text: string; revision: string | number; } | { kind: "format"; blockId: string; range: { start: number; end: number; }; style: Partial; revision: string | number; } | { kind: "insert-paragraph"; blockId: string; revision: string | number; }; export type DocumentCommitHandler = ((commit: DocumentCommit) => void) | ((commit: DocumentCommit) => Promise); export type DocumentProjectionPageGeometry = Readonly<{ widthPt: number; heightPt: number; marginTopPt: number; marginRightPt: number; marginBottomPt: number; marginLeftPt: number; headerPt?: number; footerPt?: number; gutterPt?: number; }>; export type DocumentProjectionTextStyle = Readonly<{ fontFamily?: string; fontSizePt?: number; color?: string; bold?: boolean; italic?: boolean; underline?: boolean; strike?: boolean; }>; export type DocumentProjectionParagraphStyle = Readonly<{ headingLevel?: 1 | 2 | 3 | 4 | 5 | 6; alignment?: "left" | "center" | "right" | "justify"; spaceBeforePt?: number; spaceAfterPt?: number; lineHeight?: number; keepNext?: boolean; pageBreakBefore?: boolean; list?: Readonly<{ kind: "bullet" | "number"; level?: number; instanceId?: string; }>; }>; export type DocumentProjectionTextRun = Readonly<{ text: string; style?: DocumentProjectionTextStyle; }>; export type DocumentProjectionParagraph = Readonly<{ kind: "paragraph"; id: string; runs: readonly DocumentProjectionTextRun[]; style?: DocumentProjectionParagraphStyle; }>; export type DocumentProjectionTable = Readonly<{ kind: "table"; id: string; rows: readonly (readonly (readonly DocumentProjectionTextRun[])[])[]; style?: Readonly<{ widthPt?: number; columnWidthsPt?: readonly number[]; headerRows?: number; cellPaddingPt?: number; borderColor?: string; headerFill?: string; allowRowSplit?: boolean; }>; }>; export type DocumentProjectionPageBreak = Readonly<{ kind: "pageBreak"; id: string; }>; export type DocumentProjectionBlock = DocumentProjectionParagraph | DocumentProjectionTable | DocumentProjectionPageBreak; export type DocumentProjectionSection = Readonly<{ id: string; startBlockIndex: number; page: DocumentProjectionPageGeometry; titlePage?: boolean; headerBlockCounts?: readonly [number, number, number]; footerBlockCounts?: readonly [number, number, number]; }>; export type DocumentProjectionComment = Readonly<{ id: string; blockId: string; start: number; end: number; resolved: boolean; replies: readonly Readonly<{ author: string; text: string; createdAt: string; }>[]; }>; export type DocumentProjectionChange = Readonly<{ id: string; blockId: string; kind: "insert" | "delete"; start: number; end: number; author: string; createdAt: string; }>; /** Immutable render/edit projection; canonical document state stays with the host. */ export type DocumentEditorProjection = Readonly<{ revision: string | number; page: DocumentProjectionPageGeometry; blocks: readonly DocumentProjectionBlock[]; sections?: readonly DocumentProjectionSection[]; comments?: readonly DocumentProjectionComment[]; changes?: readonly DocumentProjectionChange[]; }>; export type DocumentEditorProps = { document: ReferenceDocument; /** Controlled projection mode. Omit to let the editor own the toggle. */ layout?: DocumentLayoutMode | undefined; defaultLayout?: DocumentLayoutMode | undefined; onLayoutChange?: ((layout: DocumentLayoutMode) => void) | undefined; onSelectionChange?: ((selection: DocumentSelection) => void) | undefined; onCommit?: DocumentCommitHandler | undefined; onCommandError?: ((error: Error) => void) | undefined; readOnly?: boolean | undefined; ariaLabel?: string | undefined; viewportHeight?: number | undefined; overscanPages?: number | undefined; className?: string | undefined; }; export type DocumentProjectionEditorProps = Omit & { projection: DocumentEditorProjection; commit?: DocumentCommitHandler | undefined; onCommandError?: ((error: Error) => void) | undefined; onSelectionChange?: ((selection: DocumentSelection) => void) | undefined; }; export type DocumentProjectionArtifactSurfaceProps = Omit & { title: string; showHeader?: boolean | undefined; subtitle?: ReactNode | undefined; actions?: ReactNode | undefined; busy?: boolean | undefined; className?: string | undefined; editorClassName?: string | undefined; }; export type DocumentArtifactSurfaceProps = Omit & { title: string; showHeader?: boolean | undefined; subtitle?: ReactNode | undefined; busy?: boolean | undefined; className?: string | undefined; editorClassName?: string | undefined; }; /** Compatibility adapter for the public authoring model. */ export declare function DocumentEditor(props: DocumentEditorProps): import("react").JSX.Element; /** Projection-first document editor with one async command boundary. */ export declare function DocumentProjectionEditor({ projection, commit, onCommandError, onSelectionChange, readOnly, ...props }: DocumentProjectionEditorProps): import("react").JSX.Element; /** Artifact chrome plus the reusable document editor. */ export declare function DocumentArtifactSurface({ document, title, showHeader, subtitle, busy, className, editorClassName, ...editorProps }: DocumentArtifactSurfaceProps): import("react").JSX.Element; /** Artifact chrome over the projection-first document editor. */ export declare function DocumentProjectionArtifactSurface({ projection, title, showHeader, subtitle, actions, busy, className, editorClassName, ...editorProps }: DocumentProjectionArtifactSurfaceProps): import("react").JSX.Element;