perf: lighten the bar's stylesheet, listeners and DOM writes - #11
Merged
Merged
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Merged
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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), andstyle.css510 B (was 534).style.css: the bar slides withtranslate, sotransformon.sprogress-baris free for other effects. The short hop is the default transition and onlytrickleswitches 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 twoset()calls).<Bar />.<NavigationProgress>attaches one set of Navigation API listeners (4 onnavigationinstead of 8).pnpm sizemeasures each drop-in bar tree-shaken on its own.Checklist
pnpm format:checkandpnpm checkpassREADME.mdand the matching page underwww/src/routes/docs/are updatedpnpm changeset) if the published package changes🤖 Generated with Claude Code