ViteHub is still experimental. Expect bugs and breaking changes.

Diff

Render files, patches, parsed diffs, and merge conflicts inside a Vue application.

ViteHub provides Vue lifecycle adapters for Pierre's six code and diff views. They use Nuxt UI backgrounds, borders, radius, typography, and semantic colors by default while Pierre continues to own parsing, syntax highlighting, selection, and rendering.

Preview

Components

ComponentPurpose
AgentCodeViewRender a virtualized list containing files and diffs.
AgentMultiFileDiffCompare two FileContents values directly.
AgentPatchDiffRender one file change from a unified patch string.
AgentFileDiffRender pre-parsed FileDiffMetadata.
AgentFileRender one syntax-highlighted file without a diff.
AgentUnresolvedFileRender conflict markers with resolution controls.

Nuxt registers every component automatically. In Vue with Vite, import them from @vite-hub/ui.

Usage

Render a unified patch:

<AgentPatchDiff :patch="patch" />

Compare two files without creating a patch first:

<AgentMultiFileDiff :old-file="before" :new-file="after" />

Pass null for the missing side of an added or deleted file.

Use a parsed diff when the application already owns parsing or partial diff hydration:

<AgentFileDiff :file-diff="fileDiff" />

Render a mixed virtualized view. Give the component a height so it can own scrolling:

<AgentCodeView class="h-[32rem]" :items="items" />

Shared diff props

AgentMultiFileDiff, AgentPatchDiff, and AgentFileDiff share these props:

PropTypePurpose
optionsFileDiffOptionsConfigure layout, themes, headers, interactions, and hydration.
lineAnnotationsDiffLineAnnotation[]Render application-owned content on diff lines.
selectedLinesSelectedLineRange | nullControl the selected line range.

AgentFile uses FileOptions and LineAnnotation[]. AgentUnresolvedFile uses UnresolvedFileOptions. AgentCodeView accepts CodeViewItem[], CodeViewOptions, and a CodeViewLineSelection.

The package also exports Pierre's getSingularPatch, parseDiffFromFile, and parsePatchFiles helpers plus the public types used by these components.

Styling

The default theme maps Pierre's inherited CSS properties to Nuxt UI's --ui-* properties. Override a ViteHub property on one view when a product needs a different treatment:

.review-diff {
  --vh-ui-bg: var(--ui-bg-elevated);
  --vh-ui-success: var(--ui-primary);
}

Pass Pierre's theme option when you need different syntax token colors. The surrounding backgrounds and semantic diff colors still follow the application theme.