{"$schema":"https:\/\/ui.particle.academy\/schema\/registry-item.json","name":"diff-viewer","type":"registry:ui","title":"DiffViewer","description":"Unified\/split Git diff surface with stable file and hunk handles.","package":"fancy-git-ui","dependencies":[],"registryDependencies":[],"files":[{"path":"components\/fancy\/diff-viewer\/diff-viewer.tsx","content":"export type DiffLine = { id: string; kind: \"context\" | \"addition\" | \"deletion\" | \"header\"; oldNumber?: number; newNumber?: number; text: string };\nexport type DiffFile = { id: string; path: string; previousPath?: string; binary?: boolean; lines: DiffLine[] };\nexport interface DiffViewerProps {\n  value: DiffFile[];\n  selectedHunkIds?: string[];\n  onSelectedHunkIdsChange?: (ids: string[]) => void;\n  mode?: \"unified\" | \"split\";\n  onModeChange?: (mode: \"unified\" | \"split\") => void;\n  className?: string;\n}\nexport function DiffViewer({ value, selectedHunkIds = [], onSelectedHunkIdsChange, mode = \"unified\", onModeChange, className }: DiffViewerProps) {\n  const toggle = (id: string) => onSelectedHunkIdsChange?.(selectedHunkIds.includes(id) ? selectedHunkIds.filter((item) => item !== id) : [...selectedHunkIds, id]);\n  return <section className={className} data-git-diff=\"\" data-git-diff-mode={mode} aria-label=\"Git diff\">\n    <header><strong>Changes<\/strong><button type=\"button\" onClick={() => onModeChange?.(mode === \"unified\" ? \"split\" : \"unified\")}>{mode}<\/button><\/header>\n    {value.map((file) => <article key={file.id} data-git-diff-file={file.path}><h3>{file.path}<\/h3>\n      {file.binary ? <p>Binary file<\/p> : <pre>{file.lines.map((line) => <button type=\"button\" key={line.id} data-git-diff-line={line.id} data-kind={line.kind} aria-pressed={selectedHunkIds.includes(line.id)} onClick={() => line.kind === \"header\" && toggle(line.id)}><span>{line.oldNumber ?? \" \"}<\/span><span>{line.newNumber ?? \" \"}<\/span><code>{line.text}<\/code><\/button>)}<\/pre>}\n    <\/article>)}\n  <\/section>;\n}\n","type":"registry:ui","target":"components\/fancy\/diff-viewer\/diff-viewer.tsx"}]}