/** * `VersionHistoryPanel` — a GENERIC, kind-agnostic viewer for a versioned * document's history. It knows nothing about presets, AC policies, or authored * agents: it takes a plain versions list (`{version, body, is_current, * created_at}`, optionally `tags`) plus a `onRollback` callback, renders the list * (a "Current" status mark driven by `is_current`), a `JsonTree` view of the selected * version's opaque body, a per-row Rollback action behind a confirm dialog, and a * per-row Compare action that opens a structural `JsonDiff` of two versions' bodies. * Each consumer (e.g. presets, AC policies) wires it to its own routes. * * Two optional affordances, inert unless supplied: * - a Tags column appears when any entry carries `tags` OR `onEditTags` is given * (so tag-less consumers see no empty column); * - when `onEditTags` is provided, a per-row "Edit tags" action opens a small * dialog seeded from the row's tags; SAVE calls the callback with the NEW list * and the panel awaits it with INTERNAL pending/error state, rendering a * rejection's message verbatim. * * SAFETY: `body` and tags are arbitrary server JSON, rendered through `JsonTree` / * `Badge` (React escapes every value) — never an HTML sink. * * Geometry and ink come from the design-system classes. Two rules shape the table: * a row's state is a MARK plus a label (`tai-status` + `CheckCircleIcon` / * `PendingIcon`), never color alone, and the version number and timestamp are the * machine voice (`tai-table-id` / `tai-mono`). The table itself sits in a * `ScrollRegion` so a narrow viewport scrolls it instead of the page. */ import { type ReactNode } from 'react'; /** One version row — the kind-agnostic shape every consumer projects into. */ export interface VersionHistoryEntry { readonly version: number; readonly body: unknown; readonly is_current: boolean; readonly created_at: string; /** The version's generic label list, surfaced as a Tags column when present. */ readonly tags?: readonly string[]; } export interface VersionHistoryPanelProps { readonly versions: readonly VersionHistoryEntry[]; /** Roll the active pointer to `version`. The consumer owns the mutation. */ readonly onRollback: (version: number) => void; /** Fired when a version is selected for viewing (optional). */ readonly onView?: (version: number) => void; /** The consumer's rollback mutation is in flight. */ readonly rollbackPending?: boolean; /** A loud rollback failure message to surface in the confirm dialog. */ readonly rollbackError?: string; /** * A read-only history view: the version list and each version's body stay * visible (history is a read surface), but EVERY mutating action is hidden — * the per-row Rollback and, where `onEditTags` is supplied, Edit tags. * Defaults to interactive. */ readonly readOnly?: boolean; /** * Extra consequence copy appended to the rollback confirm dialog's description * (announced to assistive tech via the dialog's `aria-describedby`). Consumers * whose rollback has an immediate live effect (e.g. re-pointing access-control * enforcement) pass a sentence stating so; omitted when there is nothing extra. */ readonly rollbackConfirmDescription?: string; /** * Replace one version's tag annotation. When provided, a per-row "Edit tags" * action opens a dialog seeded from the row's tags and SAVE calls this with the * NEW list; the panel awaits the returned promise with internal pending/error * state. Omitted ⇒ no edit affordance (tags stay read-only). */ readonly onEditTags?: (version: number, tags: string[]) => Promise; } export declare function VersionHistoryPanel({ versions, onRollback, onView, rollbackPending, rollbackError, readOnly, rollbackConfirmDescription, onEditTags, }: VersionHistoryPanelProps): ReactNode; //# sourceMappingURL=version-history-panel.d.ts.map