Skip to content

Releases: pierrecomputer/pierre

diffs-v1.2.4

28 May 00:21

Choose a tag to compare

What's Changed

Full Changelog: diffs-v1.2.3...diffs-v1.2.4

@pierre/diffs v1.2.3

24 May 05:29

Choose a tag to compare

What's Changed

  • fix(diffs): handle quoted git diff headers by @amadeus in #736
  • [diffs] CodeView Layout & Options Optimizations by @amadeus in #718
  • [diffs] WorkerPool & Element Pool Hardening by @amadeus in #737

Full Changelog: diffs-v1.2.2...diffs-v1.2.3

@pierre/diffs v1.2.2

22 May 01:15

Choose a tag to compare

What's Changed

  • [diffs] Fix for theme changes on collapsed files by @amadeus in #733

Full Changelog: diffs-v1.2.1...diffs-v1.2.2

@pierre/diffs v1.2.1

20 May 23:30

Choose a tag to compare

What's Changed

  • [diffs] Fix gutter utility rendering quirk by @amadeus in #729

Full Changelog: diffs-v1.2.0...diffs-v1.2.1

@pierre/diffs v1.2.0

20 May 23:21

Choose a tag to compare

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) and cleanUp() for vanilla lifecycle.
  • setItems(items), addItem(item), and addItems(items).
  • getItem(id) and updateItem(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(), and clearSelectedLines().
  • 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-motion handling: 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 selectedLines and onSelectedLinesChange.
  • Collapsible items through the collapsed item property.
  • Header, annotation, and gutter-utility rendering hooks that receive the complete CodeViewItem context.

The layout model changed in ways consumers should notice. This will affect the current consumers of the current Virtualization APIs as well:

  • VirtualFileMetrics.fileGap was renamed to spacing.
  • VirtualFileMetrics.hunkSeparatorHeight is now optional.
  • VirtualFileMetrics.paddingTop and paddingBottom were added for advanced estimation of custom CSS.
  • CodeViewOptions.layout now controls real CodeView outer padding and item gaps with { paddingTop, paddingBottom, gap }.
  • __devOnlyValidateItemHeights was added to help consumers verify custom itemMetrics values in development.

Diffs Rendering API Changes

Notable public API changes beyond CodeView:

  • DiffIndicators is now a named exported type: 'classic' | 'bars' | 'none'.
  • SelectedLineRange is now a named exported type with side-aware endpoints.
  • DiffsThemeNames now includes pierre-dark-soft and pierre-light-soft.
  • BaseCodeOptions.stickyHeader was added for file and diff headers.
  • BaseCodeOptions.tokenizeMaxLength was added so very large files/diffs can fall back to plain text instead of syntax highlighting which can crash shiki
  • prefersReducedMotion() 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) and primeDiffHighlightCache(diff).
  • areDiffTargetsEqual, areFileRenderOptionsEqual, and detachString are newly exported utilities.

Migration notes:

  • The deprecated enableHoverUtility and renderHoverUtility aliases were removed. Use enableGutterUtility and renderGutterUtility.
  • FileOptions.renderCustomMetadata was replaced by renderHeaderMetadata, 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 fileGap to spacing and audit any code that assumed hunkSeparatorHeight was 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 IntersectionObserver entries after virtualizer disconnect are ignored instead of throwing.
  • ResizeManager now uses a shared ResizeObserver.
  • CodeView recycles item shell elements with a bounded element pool.
  • Recycled File and FileDiff instances cache serialized file-header HTML when identity and options remain stable.
  • Syntax-highlight cache priming reduces the cost of scrollTo targets 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.
  • parsePatchFiles now ignores git format-patch version trailers after the final hunk once the hunk-declared line counts are satisfied.
  • Virtualized diffs now reset layout state correctly when reused.
  • simple hunk separators now compute layout correctly in VirtualizedFile and VirtualizedFileDiff.

@pierre/diffs v1.2.0-beta.5

16 May 00:53

Choose a tag to compare

Pre-release

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

11 May 23:43

Choose a tag to compare

Pre-release

What's Changed

  • [diffs] CodeView item metrics validation by @amadeus in #665

Full Changelog: diffs-v1.2.0-beta.3...diffs-v1.2.0-beta.4

@pierre/diffs v1.1.21

07 May 18:53

Choose a tag to compare

What's Changed

Full Changelog: v1.1.20...v1.1.21

@pierre/diffs v1.2.0-beta.3

07 May 01:40

Choose a tag to compare

Pre-release

What's Changed

Full Changelog: v1.2.0-beta.2...v1.2.0-beta.3