diffs

Use when an app uses @pierre/diffs to render or edit code files, diffs, patches, merge conflicts, or CodeView review surfaces, including React, vanilla JavaScript, SSR, workers, annotations, selection, and custom Shiki languages or themes.

Install
npx skills add 'https://github.com/pierrecomputer/pierre/tree/main/skills/diffs'
Download bundle ↓
main · 1831817Scanned 2026-09-15

Contributors

GitHub-linked commit authors for this SKILL.md at the saved revision. Co-authors and history before file renames are not included.

File history ↗
View on GitHub
← Back to SKILL.md

Shared types

This reference lists every export from the shared @pierre/diffs type module. The root, React, and SSR entries re-export these types.

Contents

Files and patches

ExportPurpose
FileContentsDescribes a file name, text, language, header, and cache key.
DiffFileInputAccepts an old and new file for changes, additions, or deletions.
MaybeDiffFileInputAccepts a file pair or no file input.
FileDiffContentsLoaderLoads complete files for partial diff metadata.
FileDiffLoadedChangedFilesReturns both files for a loaded changed diff.
FileDiffLoadedPureRenamedFileReturns the new file for a loaded pure rename.
FileDiffLoadedFilesRepresents either loaded-file result.
ChangeTypesNames changed, renamed, added, or deleted file states.
ParsedPatchHolds patch metadata and parsed files.
ContextContentDescribes one unchanged hunk block.
ChangeContentDescribes one additions and deletions block.
HunkDescribes one parsed patch hunk.
FileDiffMetadataHolds parsed file names, lines, hunks, and change metadata.
MergeConflictMarkerRowTypeNames a merge conflict marker row.
MergeConflictMarkerRowDescribes one marker row and its source line.
MergeConflictRegionDescribes one parsed merge conflict region.
MergeConflictResolutionSelects current, incoming, or both conflict contents.
MergeConflictActionPayloadDescribes one conflict action and region.
ProcessFileConflictDataHolds state while patch parsing processes conflicts.
ConflictResolverTypesNames current, incoming, or both conflict choices.

Themes and options

ExportPurpose
SupportedLanguagesAccepts a bundled, text, ANSI, or custom language name.
HighlighterTypesSelects the JavaScript or WebAssembly Shiki engine.
HighlightedTokenStores a character index, foreground, and token text.
DiffsThemeNamesAccepts a bundled or custom theme name.
ThemesTypeMaps light and dark schemes to theme names.
ThemeTypesSelects system, light, or dark mode.
DiffsHighlighterDefines the package's configured Shiki highlighter.
BaseCodeOptionsConfigures themes, wrapping, headers, tokenization, and CSS.
BaseDiffOptionsAdds layout, indicators, context, and line diff options.
BaseDiffOptionsWithDefaultsDescribes required diff options after defaults apply.
DiffIndicatorsSelects classic, bar, or hidden diff indicators.
HunkSeparatorsSelects the hunk separator presentation.
LineDiffTypesSelects word, alternate word, character, or no inline diff.
FileHeaderRenderModeSelects a default or custom file header.
CustomPrePropertiesDefines custom properties for the rendered pre element.
PrePropertiesConfigDescribes calculated pre element properties.
ExtensionFormatMapMaps file names or extensions to languages.
RenderHeaderPrefixCallbackProduces prefix content for a diff header.
RenderHeaderFilenameSuffixCallbackProduces filename suffix content for a diff header.
RenderHeaderMetadataCallbackProduces metadata content for a diff header.
RenderFileMetadataProduces header content for a file.
PostRenderPhaseNames mount, update, or unmount callback phases.

Annotations and selection

ExportPurpose
AnnotationSideSelects deletions or additions for an annotation.
LineAnnotationAssociates metadata with one file line.
DiffLineAnnotationAssociates metadata with one side and line.
AnnotationLineMapGroups diff annotations by line number.
SelectedLineRangeDescribes a selected start and end across diff sides.
SelectionSideSelects deletions or additions for a selection.
SelectionPointDescribes one line and optional side.

CodeView types

ExportPurpose
CodeViewFileItemDescribes one file item in a virtualized list.
CodeViewDiffItemDescribes one diff item in a virtualized list.
CodeViewItemRepresents a file or diff list item.
CodeViewCreateEditorOptionsProvides CodeView's routed editor option subset.
CodeViewItemEditCompleteHandlerHandles completion with correlated event and item types.
CodeViewScrollBehaviorSelects instant, smooth, or automatic smooth scroll.
CodeViewScrollTargetRepresents any supported list scroll target.
CodeViewPositionScrollTargetScrolls to an absolute list position.
CodeViewLineScrollTargetScrolls to one item line.
CodeViewRangeScrollTargetScrolls to one item line range.
CodeViewItemScrollTargetScrolls to one item boundary.
NumericScrollLineAnchorDescribes a numeric position inside a line.
CodeViewLayoutStores item offsets, heights, and total list height.
PendingCodeViewLayoutResetDescribes a deferred list layout reset.
SmoothScrollSettingsConfigures duration and distance for smooth list scroll.

CodeViewCreateEditorOptions currently contains the routed onChange(event) callback that CodeView uses to emit onItemEditChange(event, item); it does not add an item ID. A CodeViewOptions.createEditor factory also receives the optional editStateKey returned by getEditStateKey(item) as its third argument. Forward that key separately to the editor constructor. It retains the editable draft, undo/redo history, selections, and horizontal code scroll. Item editors never own CodeView's shared vertical position.

onItemEditComplete(event, item, nextItem) must return 'accept' to accept the completed item or 'reject' to restore the original while the item remains present; a missing callback rejects. During removal or teardown, neither decision reinserts the item. Controlled owners must put the supplied nextItem into their item state when accepting an item that should remain. If the item uses keyed render caching, assigning a fresh cacheKey to the accepted event file or diff invalidates that cache.

Lines, hunks, and render state

ExportPurpose
HunkLineTypeNames context, expanded, addition, deletion, or metadata lines.
HunkDataDescribes one hunk's render indexes and line ranges.
HunkExpansionRegionDescribes expanded context above and below a hunk.
ExpansionDirectionsSelects up, down, or both expansion directions.
DiffAcceptRejectHunkTypeSelects accept, reject, or both hunk controls.
DiffAcceptRejectHunkConfigConfigures hunk accept and reject behavior.
GapSpanDescribes an empty row span.
AnnotationSpanDescribes an annotation row span.
LineSpansRepresents a gap or annotation span.
LineTypesNames rendered context and change line classes.
LineInfoDescribes a rendered line number, side, and type.
CodeColumnTypeSelects unified, additions, or deletions columns.
LineEventBasePropsSupplies a file line to an interaction callback.
DiffLineEventBasePropsSupplies a diff line and side to an interaction callback.
TokenEventBaseSupplies a token and source event.
DiffTokenEventBasePropsAdds diff side data to a token event.
ObservedAnnotationNodesStores DOM nodes for observed annotations.
ObservedGridNodesStores DOM nodes for observed grid columns.
SharedRenderStateHolds shared token transformer render state.
StickySpecsDescribes sticky header position and height.

Render results and virtualization

ExportPurpose
RenderFileOptionsDefines the resolved options for a highlighted file.
RenderDiffOptionsDefines the resolved options for a highlighted diff.
ForceFilePlainTextOptionsSelects a plain-text file range.
ForceDiffPlainTextOptionsSelects a plain-text diff range and hunk state.
ThemedFileResultHolds the highlighted file syntax tree and line count.
ThemedDiffResultHolds highlighted additions and deletions syntax trees.
RenderDiffFilesResultHolds the resolved old and new file inputs.
RenderFileResultHolds file output and the options that produced it.
RenderDiffResultHolds diff output and the options that produced it.
RenderedFileASTCacheStores one cached file syntax tree by theme.
RenderedDiffASTCacheStores one cached diff syntax tree by theme.
AppliedThemeStyleCacheStores applied light and dark theme CSS.
RenderRangeDescribes a start row, row count, and buffer sizes.
RenderWindowDescribes first and last rows in a render window.
VirtualWindowSpecsDescribes viewport position, height, and row window.
VirtualFileMetricsDescribes estimated header and line heights.

Shiki and diff types

ExportPurpose
BundledLanguageNames a language bundled by Shiki.
CodeToHastOptionsConfigures Shiki code-to-HAST output.
DecorationItemDescribes a Shiki source decoration.
LanguageRegistrationDescribes a Shiki language grammar.
ShikiTransformerDefines a Shiki syntax tree transformer.
ThemeRegistrationDescribes a raw Shiki theme.
ThemeRegistrationResolvedDescribes a normalized Shiki theme.
ThemedTokenDescribes one Shiki token with its theme style.
CreatePatchOptionsNonabortableConfigures the underlying patch algorithm.
Referenced from SKILL.md