Releases: pierrecomputer/pierre
diffs-v1.2.4
What's Changed
Full Changelog: diffs-v1.2.3...diffs-v1.2.4
@pierre/diffs v1.2.3
@pierre/diffs v1.2.2
What's Changed
Full Changelog: diffs-v1.2.1...diffs-v1.2.2
@pierre/diffs v1.2.1
What's Changed
Full Changelog: diffs-v1.2.0...diffs-v1.2.1
@pierre/diffs v1.2.0
Release Highlights
New CodeView API
This branch introduces CodeView, a high-level diff/code viewer API for rendering a single large scroll container containing many files and diffs. It is exported from the root @pierre/diffs package for vanilla JS usage and from @pierre/diffs/react as a React component.
CodeView is intended to be the default API when a consumer needs one scrollable review surface instead of independently rendered file or diff components. It owns virtualization, layout reconciliation, scroll anchoring, selection, sticky headers, and target-based scrolling across all items.
CodeViewItem entries require stable ids and may represent either a file or a diff:
type CodeViewItem<T = undefined> =
| {
id: string;
type: 'file';
file: FileContents;
annotations?: LineAnnotation<T>[];
version?: number;
collapsed?: boolean;
}
| {
id: string;
type: 'diff';
fileDiff: FileDiffMetadata;
annotations?: DiffLineAnnotation<T>[];
version?: number;
collapsed?: boolean;
};Public item and viewer operations include:
setup(root)andcleanUp()for vanilla lifecycle.setItems(items),addItem(item), andaddItems(items).getItem(id)andupdateItem(item).updateItemId(oldId, newId), added for streaming cases where a path's canonical id must move as later patch entries supersede earlier entries.scrollTo(target)for item, line, range, and absolute-position targets.getTopForItem(id).setSelectedLines(selection),getSelectedLines(), andclearSelectedLines().subscribeToScroll(listener).getRenderedItems()for currently mounted virtual items.
React usage has two ownership modes:
- Controlled mode: pass
items; React owns the full list. - Imperative mode: pass optional
initialItems; later updates go through the ref methods (addItems,updateItem,updateItemId,scrollTo, etc.).
The React component deliberately rejects switching between controlled and imperative modes without remounting.
CodeView Scrolling, Selection, and Layout
CodeView supports:
- Scroll targets by item id, line number, selected range, or pixel position.
behavior: 'instant' | 'smooth' | 'smooth-auto'.smooth-auto, which uses smooth scrolling for nearby targets and instant scrolling for far-away targets.prefers-reduced-motionhandling: programmatic smooth scrolls resolve to instant movement when the user prefers reduced motion.- Per-file/per-diff sticky headers via
stickyHeaders. - Range-based selection with side-aware start and end points.
- Range scroll targets.
- Controlled selection in React with
selectedLinesandonSelectedLinesChange. - Collapsible items through the
collapseditem property. - Header, annotation, and gutter-utility rendering hooks that receive the complete
CodeViewItemcontext.
The layout model changed in ways consumers should notice. This will affect the current consumers of the current Virtualization APIs as well:
VirtualFileMetrics.fileGapwas renamed tospacing.VirtualFileMetrics.hunkSeparatorHeightis now optional.VirtualFileMetrics.paddingTopandpaddingBottomwere added for advanced estimation of custom CSS.CodeViewOptions.layoutnow controls real CodeView outer padding and item gaps with{ paddingTop, paddingBottom, gap }.__devOnlyValidateItemHeightswas added to help consumers verify customitemMetricsvalues in development.
Diffs Rendering API Changes
Notable public API changes beyond CodeView:
DiffIndicatorsis now a named exported type:'classic' | 'bars' | 'none'.SelectedLineRangeis now a named exported type with side-aware endpoints.DiffsThemeNamesnow includespierre-dark-softandpierre-light-soft.BaseCodeOptions.stickyHeaderwas added for file and diff headers.BaseCodeOptions.tokenizeMaxLengthwas added so very large files/diffs can fall back to plain text instead of syntax highlighting which can crash shikiprefersReducedMotion()is exported for consumers that want to mirror the library's reduced-motion behavior.- Worker cache priming APIs were added on the worker manager:
primeFileHighlightCache(file)andprimeDiffHighlightCache(diff). areDiffTargetsEqual,areFileRenderOptionsEqual, anddetachStringare newly exported utilities.
Migration notes:
- The deprecated
enableHoverUtilityandrenderHoverUtilityaliases were removed. UseenableGutterUtilityandrenderGutterUtility. FileOptions.renderCustomMetadatawas replaced byrenderHeaderMetadata, matching the diff API naming.- Custom hunk separator functions remain marked deprecated. CodeView only accepts built-in hunk separator modes, excluding the old custom function path.
- Consumers with custom virtualization metrics should update
fileGaptospacingand audit any code that assumedhunkSeparatorHeightwas required.
Performance and Stability
This branch contains a large set of scaling and browser-stability changes:
- The new CodeView uses a paged scroll scaffold so extremely tall diffs can be navigated beyond normal browser scroll-height limits.
- CodeView preserves scroll anchors while content is measured, resized, collapsed, expanded, appended, or re-rendered.
- Append-only CodeView updates avoid full list reconciliation.
- Layout recalculation tracks the earliest dirty item and recomputes from that point instead of rebuilding all item positions.
- CodeView can temporarily suspend pointer events while scrolling to improve scroll performance.
- Mobile Safari gets an additional horizontal-overflow suspension while scrolling to avoid crash-prone aggressive scroll scenarios.
- Stale
IntersectionObserverentries after virtualizer disconnect are ignored instead of throwing. ResizeManagernow uses a sharedResizeObserver.- CodeView recycles item shell elements with a bounded element pool.
- Recycled
FileandFileDiffinstances cache serialized file-header HTML when identity and options remain stable. - Syntax-highlight cache priming reduces the cost of
scrollTotargets before they render. - Worker tasks perform extra cleanup after large jobs.
- Patch parsing was rewritten to reduce large-string retention and to avoid regular-expression-heavy hot paths.
parsePatchFilesnow ignoresgit format-patchversion trailers after the final hunk once the hunk-declared line counts are satisfied.- Virtualized diffs now reset layout state correctly when reused.
simplehunk separators now compute layout correctly inVirtualizedFileandVirtualizedFileDiff.
@pierre/diffs v1.2.0-beta.5
What's Changed
- Increase the clickbox a bit on the default gutter utility button by @amadeus in #682
- [diffs] Improve InteractionManager on Mobile by @amadeus in #667
Full Changelog: diffs-v1.2.0-beta.4...diffs-v1.2.0-beta.5
@peirre/diffs v1.2.0-beta.4
What's Changed
Full Changelog: diffs-v1.2.0-beta.3...diffs-v1.2.0-beta.4
@pierre/diffs v1.1.21
What's Changed
Full Changelog: v1.1.20...v1.1.21
@pierre/diffs v1.2.0-beta.3
What's Changed
Full Changelog: v1.2.0-beta.2...v1.2.0-beta.3