AsterUIDocsv1.0.2

Docs / Component reference

DiffViewer

Read a change line by line. Added and removed lines have their own markers and line numbers.

Diff viewer example

Install

sh
npx @fierst/ui@1.0.2 add diff-viewer

Registry dependencies: theme.

Exports from ./ui/diff-viewer: DiffLine, DiffViewer.

Download the registry source for diff-viewer 1.0.2.

API contracts

ts
export interface DiffLine {
  kind: 'ctx' | 'add' | 'del';
  text: string;
  lineNo?: number;
}

export function DiffViewer({
  filename = 'migration.sql',
  lines,
  class: extraClass,
}: {
  filename?: string;
  lines: readonly DiffLine[];
  class?: string;
})