also looking at this
fix(spa): repair client-side router and polish default theme
#71
9 files
+1037
-170
Summary
- Rewrites the SPA router in
serve.tsso internal navigation handles cross-page hash anchors, browser back/forward scroll restoration, layout switches, and inline-script re-execution correctly. Layout is detected via newVPContent--doc/VPContent--pagemodifiers; scroll uses the active scroll container (the doc layout'sposition: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 exportedlayoutCSSchunk shared by both thevitepressandbunthemes. Closes #69. - Fixes two SPA-related listener leaks:
sidebar.stxguards its document-level click handler withwindow.__bpSidebarBound, andpage-toc.stxremoves its prior scroll listener before re-binding on each init.
Test plan
bun run typecheckcleanbunx --bun pickier packages/bunpress/src— only the two pre-existing warnings remain- Dev server:
bunpress devand 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.