Skip to content

perf: lighten the bar's stylesheet, listeners and DOM writes - #11

Merged
kecan0406 merged 1 commit into
mainfrom
perf/leaner-bar
Sep 25, 2026
Merged

kecan0406 merged 1 commit into
mainfrom
perf/leaner-bar

Conversation

@kecan0406

Copy link
Copy Markdown
Owner

What changes

A lighter bar with the same behavior and public API. <RouteProgress /> adds 2363 B min+gzip after tree-shaking (was 2410), <NavigationProgress /> 2099 B (was 2193), and style.css 510 B (was 534).

  • style.css: the bar slides with translate, so transform on .sprogress-bar is free for other effects. The short hop is the default transition and only trickle switches to the long drift. A Chromium trace confirms the transitions still run on the compositor.
  • <html> busy attributes are written only on the first show and the last hide (2 mutation records per load instead of 7, with two set() calls).
  • The default template is a static element instead of a mounted <Bar />.
  • <NavigationProgress> attaches one set of Navigation API listeners (4 on navigation instead of 8).
  • pnpm size measures each drop-in bar tree-shaken on its own.

Checklist

  • pnpm format:check and pnpm check pass
  • Tests cover the changed behavior
  • README.md and the matching page under www/src/routes/docs/ are updated
  • A changeset (pnpm changeset) if the published package changes

🤖 Generated with Claude Code

The bar slides with `translate` instead of `transform`, so `transform`
on `.sprogress-bar` is free for other effects. A Chromium trace shows
its transitions still run on the compositor. The short `--sp-speed`
hop is now the bar's default transition and only the `trickle` state
switches to the long drift, so the `active`/`done` rule goes away, and
the idle fade overrides only the transition delays.

`data-sp-busy` and `aria-busy` are written to `<html>` only when the
first bar shows and the last one hides: one load with two `set()`
calls now makes 2 mutation records instead of 7. The default template
is a static element instead of a mounted `<Bar />`.

One set of Navigation API listeners now serves both cross-document and
same-document navigations, keeping a hold for each kind so a
`pushState` never ends a page load. The engine settles releases and
`done()` through one path.

`pnpm size` also measures `<RouteProgress />` and
`<NavigationProgress />` tree-shaken on their own: 2363 B (was 2410)
and 2099 B (was 2193) min+gzip; `style.css` is 510 B (was 534). The
README and the docs quote those numbers instead of summed chunks.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
solid-route-progress Ready Ready Preview Sep 25, 2026 7:03pm UTC

@kecan0406
kecan0406 merged commit adcdfdf into main Sep 25, 2026
6 checks passed
@kecan0406
kecan0406 deleted the perf/leaner-bar branch September 25, 2026 19:04
@github-actions github-actions Bot mentioned this pull request Sep 25, 2026

This branch was successfully deployed

1 active deployment
Preview — 025d328b Deployed Sep 25, 2026 by vercel[bot]
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