Skip to content

refactor(viewer): one owner for heading + breadcrumb-offset semantics - #36

Merged
denolfe merged 7 commits into
mainfrom
refactor/heading-breadcrumb-offset
Jul 23, 2026
Merged

refactor(viewer): one owner for heading + breadcrumb-offset semantics#36
denolfe merged 7 commits into
mainfrom
refactor/heading-breadcrumb-offset

Conversation

@denolfe

@denolfe denolfe commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Consolidates current-heading and breadcrumb-offset logic. A new pure module heading-resolution.ts holds the two offset conventions and the fixed-point resolver that were previously spread across the viewer, dispatch, and toc-util. Runtime behavior is unchanged.

Key Changes

  • New heading-resolution.ts module
    • foldOffset and aboveOffset name the two offset conventions. Fold excludes the heading's own crumb and adds the back badge. Above includes the crumb and drops the badge.
    • resolveHeadings owns the current/visible fixed-point loop moved out of dispatch. It takes geometry as a plain argument, so it is unit-tested against a geometry fake instead of a live scrollbox.
  • Shrunk handle read surface
    • ScrollboxHandle drops getHeadingNearTop and getVisibleHeadingIds. It exposes getGeometry() instead.
    • dispatch, App, and match-nav now read the raw geometry and resolve through the pure module.
  • Removed dead code
    • Deleted breadcrumbHeightForHeading, breadcrumbHeightAboveHeading, and the breadcrumbHeightAfterJump alias, plus the local fixed-point loop in dispatch.

@github-actions

Copy link
Copy Markdown

Startup benchmark (--render test/exhaustive.md, linux-x64)

build mean ratio verdict
baseline (main@df5667d) 795.7ms ± 32.3ms
PR 782.0ms ± 12.6ms 0.98× ✅ ok

Thresholds: warn ≥ 1.1×, fail ≥ 1.25×. Baseline built from main.

@denolfe
denolfe merged commit 85dc9e4 into main Jul 23, 2026
8 checks passed
@denolfe
denolfe deleted the refactor/heading-breadcrumb-offset branch July 23, 2026 03:38
denolfe added a commit that referenced this pull request Jul 24, 2026
- fix(viewer): eliminate flicker on navigation and backward heading jumps (#38) (1766f82)
- refactor(state): replace AppState god-object with a command surface (#37) (7854792)
- refactor(viewer): one owner for heading + breadcrumb-offset semantics (#36) (85dc9e4)
- refactor(viewer): extract useProgressiveMount hook (#35) (df5667d)
- refactor(viewer): extract viewport geometry (#34) (f3b8ffd)
- refactor: live document in a navigation module (#33) (665db23)
- fix: correctness bugs in rendering, navigation, and CLI input handling (#32) (a297f16)
- fix: keep sticky breadcrumb correct after navigating a relative link (#31) (26d6fe2)
- chore: add test/showcase.md (22e14c1)
- chore: update README (bf8b5c1)
- test: silence act() warnings (#30) (a5ae2b5)
- fix: treat frontmatter as topmost navigation stop (#29) (61f2eb9)
- feat: clickable sticky headers (#28) (6f4666d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant