ReviewOS

also looking at this

stacks/bunpress

fix(spa): repair client-side router and polish default theme

#71
Merged glennmichael123 wants to merge fix/spa-nav-and-theme-polish into main
9 files +1037 -170

Summary

  • Rewrites the SPA router in serve.ts so internal navigation handles cross-page hash anchors, browser back/forward scroll restoration, layout switches, and inline-script re-execution correctly. Layout is detected via new VPContent--doc / VPContent--page modifiers; scroll uses the active scroll container (the doc layout's position:fixed .VPContent) instead of the window. Closes #70.
  • Polishes the default theme: 41 inline style="..." attributes across the layout templates are replaced with VitePress-style classes; chrome CSS (nav, sidebar, hero, features, buttons, badges, mobile drawer with hamburger + backdrop + body-scroll lock, code-block scrollbar, table hover, blockquote brand accent) is consolidated into a new exported layoutCSS chunk shared by both the vitepress and bun themes. Closes #69.
  • Fixes two SPA-related listener leaks: sidebar.stx guards its document-level click handler with window.__bpSidebarBound, and page-toc.stx removes its prior scroll listener before re-binding on each init.

Test plan

  • bun run typecheck clean
  • bunx --bun pickier packages/bunpress/src — only the two pre-existing warnings remain
  • Dev server: bunpress dev and click through internal links, verify no full-document fetches in DevTools Network panel
  • Back/forward navigation restores prior scroll position
  • Cross-page hash links scroll to the right anchor on first nav and on subsequent SPA nav
  • Mobile (<960px): hamburger opens drawer, backdrop closes it, body scroll locks while open, link click closes it
  • Code block scrollbar styling matches the rest of the theme; tables hover correctly; dark-mode contrast acceptable
  • Bun theme also picks up layout chrome (not just vitepress)

🤖 Generated with Claude Code

9 changed files on the files tab, with 0 review threads.