{
  "antiPatterns": [
    "Applying the bounded-lookahead preview as a repository patch."
  ],
  "api": {
    "importPath": "@ancrel/workspace/diff",
    "props": [
      {
        "name": "className",
        "required": false,
        "type": "string"
      },
      {
        "name": "diff",
        "required": true,
        "type": "string"
      },
      {
        "name": "key",
        "required": false,
        "type": "React.Key | null | undefined"
      },
      {
        "name": "label",
        "required": false,
        "type": "string"
      },
      {
        "name": "ref",
        "required": false,
        "type": "React.Ref<HTMLPreElement> | undefined"
      }
    ],
    "symbol": "UnifiedDiffBlock",
    "typeRef": "api/workspace/diff/index.d.ts"
  },
  "constraints": [
    "Use authoritative unified diff text for saved or reviewed patches."
  ],
  "docs": "raw/frontend/unified-diff-block.md",
  "examples": [
    {
      "code": "'use client'\n\nimport { useState } from 'react'\nimport { UnifiedDiffBlock, computeClientFileDiffs } from '@ancrel/workspace/diff'\n\nconst serverDiff = '--- a/notes.txt\\n+++ b/notes.txt\\n@@ -1,2 +1,2 @@\\n Title\\n-First edition\\n+Second edition'\nconst files = computeClientFileDiffs({ 'notes.txt': 'Title\\nFirst edition\\n' },\n  { 'notes.txt': 'Title\\nWorking draft\\n' })\n\nexport default function App() {\n  const [local, setLocal] = useState(false)\n  return <>\n    <label><input type=\"checkbox\" checked={local} onChange={event => setLocal(event.target.checked)} />\n      Show local preview</label>\n    <UnifiedDiffBlock label={local ? 'Local preview' : 'Server diff'} diff={local ? files[0].diff : serverDiff} />\n  </>\n}\n",
      "command": "pnpm test",
      "entry": "examples/fe.unified-diff-block/App.tsx",
      "fixture": "examples/fe.unified-diff-block/",
      "id": "minimal"
    }
  ],
  "id": "fe.unified-diff-block",
  "kind": "react-component",
  "language": "typescript",
  "layer": "frontend",
  "owner": "frontend-infra",
  "package": {
    "ecosystem": "npm",
    "name": "@ancrel/workspace",
    "version": "0.2.0"
  },
  "provenance": {
    "changes": "Separated the display and bounded preview helpers from history and saving. Added two hunk-aware line-number gutters, semantic change tokens, missing-final-newline handling and a sorted file comparison model.",
    "commit": "4cc384c3bdbd09a3a50268adf81ba23f53aac93e",
    "mode": "extracted",
    "origin": "rule-studio",
    "path": "frontend/src/components/presets/PresetDraftDiffPanel.tsx",
    "rights": "org-internal; approved-by=owner; ref=item-19"
  },
  "schemaVersion": 1,
  "stability": "experimental",
  "summary": "Read a unified diff with line numbers, literal operation signs and theme-aware change colors.",
  "tokenDependencies": [
    "ref.color.x0a0a0d",
    "ref.color.x17372b",
    "ref.color.x176649",
    "ref.color.x202025",
    "ref.color.x34d399",
    "ref.color.x392628",
    "ref.color.x393941",
    "ref.color.x52525e",
    "ref.color.x684a84",
    "ref.color.x9f3035",
    "ref.color.xa5a5b0",
    "ref.color.xc0c0c9",
    "ref.color.xcdb2ea",
    "ref.color.xe4f4ec",
    "ref.color.xededef",
    "ref.color.xf2f2f5",
    "ref.color.xf39b9b",
    "ref.color.xfbeaec",
    "ref.family.mono",
    "ref.leading.x1p5",
    "ref.space.px12",
    "ref.space.px13",
    "ref.space.px2",
    "ref.space.px4",
    "ref.space.px8",
    "ref.weight.w600",
    "sys.action.focus",
    "sys.diff.add.bg",
    "sys.diff.add.fg",
    "sys.diff.gutter",
    "sys.diff.remove.bg",
    "sys.diff.remove.fg",
    "sys.ink.primary",
    "sys.ink.secondary",
    "sys.space.hair",
    "sys.space.inset",
    "sys.space.tight",
    "sys.surface.sunken",
    "sys.type.code.lineHeight",
    "sys.type.code.size",
    "sys.type.family.mono",
    "sys.type.heading.3.weight"
  ]
}
