import { type ReactNode } from "react"; import { type ErrorDetail } from "./error-message.js"; /** A load that failed: what happened, what to do next, and an optional retry. */ export interface FailedLoad { /** What happened: "Couldn't load the history". */ message: string; /** What to do next. A raw "Opengeni API 404: ..." string is replaced with advice. */ detail?: ReactNode | undefined; /** The error itself: its advice stands in for a missing detail, its facts go behind Technical details. */ cause?: unknown | undefined; onRetry?: (() => void) | undefined; } /** * The line under a failed load's title and its Technical details. An API * error never shows as its raw string: the status and reference go behind * Technical details (DESIGN.md section 6). */ export declare function failedLoadParts(failure: Pick): { detail: ReactNode; details: ErrorDetail[]; }; export type DiffLineKind = "context" | "added" | "removed"; export interface DiffLine { kind: DiffLineKind; text: string; } export interface DiffSegment { kind: "same" | "added" | "removed"; text: string; } /** * Line diff of two texts. Within each changed block, removed lines come * before added ones, like a reviewer reads them. */ export declare function diffLines(before: string, after: string): DiffLine[]; /** Word diff of two lines. Whitespace stays attached so the text reads naturally. */ export declare function diffWords(before: string, after: string): DiffSegment[]; export declare function diffStats(lines: readonly DiffLine[]): { added: number; removed: number; }; /** A row the views render: a single line, a changed pair, or a run of hidden context. */ export type DiffRow = { type: "line"; line: DiffLine; words?: DiffSegment[] | undefined; } | { type: "collapsed"; lines: DiffLine[]; id: string; }; /** * Pairs removed and added lines one to one for word highlights, and hides * long runs of unchanged lines, keeping `context` lines around each change. */ export declare function buildDiffRows(lines: readonly DiffLine[], context?: number): DiffRow[]; export type DiffViewVariant = "inline" | "split" | "prose"; export type DiffFormat = "text" | "markdown" | "code"; export interface DiffViewProps { /** Precomputed lines, for example from the server. */ lines?: readonly DiffLine[] | undefined; /** Or two texts to compare. */ before?: string | undefined; after?: string | undefined; variant?: DiffViewVariant | undefined; /** * "markdown" (default) shows headings and bullets as they read; "text" * shows lines as they are; "code" uses the mono face. */ format?: DiffFormat | undefined; /** "md" is 14px text; "sm" is 12px for lists and review queues. */ size?: "sm" | "md" | undefined; /** Unchanged lines kept around each change before the rest collapses. Infinity shows all. */ context?: number | undefined; /** A heading inside the frame, for example the entry's name. */ title?: ReactNode | undefined; /** Quiet line under the title: "From schedule Weekly dependency update PR". */ meta?: ReactNode | undefined; /** Buttons on the right of the header: Approve, Restore. */ actions?: ReactNode | undefined; /** Hide the added and removed counts. */ hideStats?: boolean | undefined; /** Accessible name when there is no title. */ label?: string | undefined; loading?: boolean | undefined; /** What happened, what to do next, and an optional retry. */ error?: FailedLoad | undefined; /** Shown when nothing changed. */ emptyMessage?: ReactNode | undefined; /** No frame: for use inside a sheet section or a review pane that has its own. */ bare?: boolean | undefined; className?: string | undefined; } /** Inline added and removed text with context. */ export declare function DiffView({ lines: linesProp, before, after, variant, format, size, context, title, meta, actions, hideStats, label, loading, error, emptyMessage, bare, className, }: DiffViewProps): import("react").JSX.Element;