You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docs: replace motion-v with CSS and remove it - #7432
📖 Documentation (updates to the documentation or readme)
🐞 Bug fix (a non-breaking change that fixes an issue)
👌 Enhancement (improving an existing functionality)
✨ New feature (a non-breaking change that adds functionality)
🧹 Chore (updates to the build process or auxiliary tools and libraries)
⚠️ Breaking change (fix or feature that would cause existing functionality to change)
📚 Description
On the docs, two things in the header pulled motion-v into the entry chunk, so every page loaded it: the mobile menu toggle (HeaderToggleButton) and the Nuxi icon in the Ask button (useNuxiIcon). The "Inspect theme slots" icon (ComponentThemeVisualizerIcon) also loaded it on every component page, as a 136 KB chunk (44 KB gzip). None of them needs a full animation library.
What changed
HeaderToggleButton.vue: the three <motion.line> became plain <line> with CSS transitions on translate, rotate and opacity. The overshoot curve cubic-bezier(0.34, 1.56, 0.64, 1) stands in for the old spring. UHeader renders a second toggle inside its open menu, so the toggle draws itself closed for its first frame and then animates into the X instead of popping in.
useNuxiIcon.ts: useAnimate() is replaced by a small animate() with the same call shape, built on the Web Animations API. The easter eggs (hi, nuxi, spin, flip, wobble, dizzy) keep their keyframes and easings unchanged.
ComponentThemeVisualizerIcon.vue: the eye blink and the eye-to-X morph are CSS keyframes and transitions in a scoped <style>, with the same durations, easings and delays. The open state is a data-open attribute on the <svg>. The blink stops under prefers-reduced-motion.
embla-carousel.svg: the custom icon was one path of thousands of tiny segments (13.4 KB). It's re-traced from a 2048px render with potrace and run through SVGO, now 4.2 KB with the same gradient. Every custom icon ends up in Nuxt Icon's client bundle, which the browser fetches on every page once it's idle, so this takes 9 KB out of it.
@benjamincanac's commit removes motion-v from the docs entirely, including the animated toggle example on the Header page.
Evidence
Two nuxt build runs of docs/ on the same orb (4 vCPU): v5 (142435a) before the change, this branch after. I walked the static imports from the entry script in .output/public/index.html and checked each chunk for motion's code (the transformPerspective string). One run each. The JS that / and /docs/getting-started load up front is the same set on both pages.
v5
This PR
Entry chunk
412.9 KB (127.4 KB gzip)
262.9 KB (78.1 KB gzip)
Static JS on load (136 chunks)
1,014.0 KB (353.0 KB gzip)
864.0 KB (303.7 KB gzip)
motion-v in the entry
yes
no
I checked the production build (node .output/server/index.mjs) in Chromium:
390px wide, menu open: both toggles (header and menu) compute translate: 0px 6px; rotate: 45deg, opacity: 0, and 0px -6px; -45deg. After Escape they go back to none.
1280px wide: typing spin rotates Nuxi (sampled at 274deg mid-way) and it ends at rotate: 0deg; scale: 1. flip samples went from -17px through -50px and 360deg back to 0px / 0deg / 1 (checked on the v4 build before the rebase).
The screenshots and recording below are from the v4 build; on v5 the open toggles compute the same values and the X looks the same.
Menu open (390px)
Toggle open → close
Recording of the toggle opening and closing (390px):
toggle.webm
Theme slots icon
On this PR's Vercel preview, Lighthouse's network list for /docs/components/button (20 theme slots buttons) has 374 scripts and none of them contains motion's code. Before this commit, the same page loaded the 136 KB motion chunk.
Checked in the dev server, 900px wide so the button shows without hover: closed, the lines compute scale: 0; opacity: 0 and the eye blinks (scaleY sampled at 0.80 and 0.19); open, the lines compute rotate: ±45deg; scale: 1 and the eye and pupil scale: 0; opacity: 0; closing again brings the eye back.
Closed
Mid-blink
Open
Recording of opening and closing it:
visualizer.webm
Embla Carousel icon
The old and new icon rendered at 1024px in Chromium differ by a PSNR of 49 dB, which is not visible, and at 24px and 48px they look the same. On the Carousel page in the dev server the icon still renders with the blue to purple gradient.
Old
New
Lint and nuxt typecheck in docs/ pass.
Lighthouse
Lighthouse 13.6.0 with its default mobile profile (simulated throttling), run from a 4 vCPU Linux sandbox against ui.nuxt.com (v4), the v5 branch preview and this PR's preview. Each cell is the median of 3 runs, which alternated between the three sites. v5 is the baseline for this PR.
Page
Metric
ui.nuxt.com
v5
This PR
/
Performance score
70
69
69
Scripts transferred
505 KB
527 KB
475 KB
Unused JavaScript
556 KB
564 KB
531 KB
Total Blocking Time
2,380 ms
3,114 ms
2,536 ms
/docs/getting-started
Performance score
72
70
70
Scripts transferred
517 KB
524 KB
472 KB
Unused JavaScript
299 KB
301 KB
269 KB
Total Blocking Time
1,849 ms
2,357 ms
2,112 ms
About 52 KB less JavaScript is transferred, and unused JavaScript drops by 32 to 33 KB on each page. These numbers were identical in every run.
The score doesn't change. It varies by 1 to 3 points between runs of the same site, more than this change moves it.
Total Blocking Time varies by up to a second between runs of the same site (for example 2,180 to 3,608 ms for v5 on /), so 3 runs can't tell whether this PR changes it. The two largest unused chunks (about 176 KB and 129 KB) are the same on v5 and this PR.
ELI5
Every docs page downloaded a whole animation library just to turn the menu icon into an X and make the Nuxi mascot wiggle, and component pages loaded it again for a blinking eye icon. The browser can do all of that on its own, so each page now loads about 150 KB less JavaScript up front, and component pages skip another 136 KB.
No actionable comments were generated in the recent review.
Walkthrough
The header toggle now uses delayed readiness and CSS transitions instead of Motion Vue variants. The icon composable replaces Motion Vue’s useAnimate helper with a local Web Animations API function. It adds internal animation types and a helper for combining scale keyframes.
This docs-only change swaps icon animations from a JavaScript library to CSS and native browser APIs, which should reduce the amount of JavaScript the docs site loads. No concrete risk was found. The animation visuals were checked by hand and have no automated coverage.
Pre-merge checks: 4
Check name
Status
Explanation
Description check
The description is related to the changeset. It explains why motion-v is removed from the docs header toggle, the Nuxi icon, and the theme-slots icon. It also describes the CSS and Web Animations API …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Title check
The title "docs: replace motion-v with CSS and remove it" matches the main change. The PR replaces motion-v animations in the docs header toggle, Nuxi icon and theme-slots icon with CSS transitions,…
Full details: Description check
Explanation
The description is related to the changeset. It explains why motion-v is removed from the docs header toggle, the Nuxi icon, and the theme-slots icon. It also describes the CSS and Web Animations API replacements, the re-traced Embla Carousel SVG, and the build and Lighthouse evidence.
Full details: Title check
Explanation
The title "docs: replace motion-v with CSS and remove it" matches the main change. The PR replaces motion-v animations in the docs header toggle, Nuxi icon and theme-slots icon with CSS transitions, keyframes or the Web Animations API. It also removes motion-v from nuxt.config.ts, docs/package.json and pnpm-workspace.yaml. The title is concise, specific and uses a conventional commit prefix. It does not mention the Embla Carousel SVG change, which is a minor secondary change.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
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
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.
🔗 Linked issue
Same change as nuxt/nuxt.com#2656 (the motion-v part).
❓ Type of change
📚 Description
On the docs, two things in the header pulled
motion-vinto the entry chunk, so every page loaded it: the mobile menu toggle (HeaderToggleButton) and the Nuxi icon in the Ask button (useNuxiIcon). The "Inspect theme slots" icon (ComponentThemeVisualizerIcon) also loaded it on every component page, as a 136 KB chunk (44 KB gzip). None of them needs a full animation library.What changed
HeaderToggleButton.vue: the three<motion.line>became plain<line>with CSS transitions ontranslate,rotateandopacity. The overshoot curvecubic-bezier(0.34, 1.56, 0.64, 1)stands in for the old spring.UHeaderrenders a second toggle inside its open menu, so the toggle draws itself closed for its first frame and then animates into the X instead of popping in.useNuxiIcon.ts:useAnimate()is replaced by a smallanimate()with the same call shape, built on the Web Animations API. The easter eggs (hi,nuxi,spin,flip, wobble, dizzy) keep their keyframes and easings unchanged.ComponentThemeVisualizerIcon.vue: the eye blink and the eye-to-X morph are CSS keyframes and transitions in a scoped<style>, with the same durations, easings and delays. The open state is adata-openattribute on the<svg>. The blink stops underprefers-reduced-motion.embla-carousel.svg: the custom icon was one path of thousands of tiny segments (13.4 KB). It's re-traced from a 2048px render with potrace and run through SVGO, now 4.2 KB with the same gradient. Every custom icon ends up in Nuxt Icon's client bundle, which the browser fetches on every page once it's idle, so this takes 9 KB out of it.@benjamincanac's commit removes
motion-vfrom the docs entirely, including the animated toggle example on the Header page.Evidence
Two
nuxt buildruns ofdocs/on the same orb (4 vCPU):v5(142435a) before the change, this branch after. I walked the static imports from the entry script in.output/public/index.htmland checked each chunk for motion's code (thetransformPerspectivestring). One run each. The JS that/and/docs/getting-startedload up front is the same set on both pages.v5I checked the production build (
node .output/server/index.mjs) in Chromium:translate: 0px 6px; rotate: 45deg,opacity: 0, and0px -6px; -45deg. After Escape they go back tonone.spinrotates Nuxi (sampled at 274deg mid-way) and it ends atrotate: 0deg; scale: 1.flipsamples went from -17px through -50px and 360deg back to0px / 0deg / 1(checked on thev4build before the rebase).The screenshots and recording below are from the
v4build; onv5the open toggles compute the same values and the X looks the same.Recording of the toggle opening and closing (390px):
toggle.webm
Theme slots icon
On this PR's Vercel preview, Lighthouse's network list for
/docs/components/button(20 theme slots buttons) has 374 scripts and none of them contains motion's code. Before this commit, the same page loaded the 136 KB motion chunk.Checked in the dev server, 900px wide so the button shows without hover: closed, the lines compute
scale: 0; opacity: 0and the eye blinks (scaleYsampled at 0.80 and 0.19); open, the lines computerotate: ±45deg; scale: 1and the eye and pupilscale: 0; opacity: 0; closing again brings the eye back.Recording of opening and closing it:
visualizer.webm
Embla Carousel icon
The old and new icon rendered at 1024px in Chromium differ by a PSNR of 49 dB, which is not visible, and at 24px and 48px they look the same. On the Carousel page in the dev server the icon still renders with the blue to purple gradient.
Lint and
nuxt typecheckindocs/pass.Lighthouse
Lighthouse 13.6.0 with its default mobile profile (simulated throttling), run from a 4 vCPU Linux sandbox against ui.nuxt.com (
v4), thev5branch preview and this PR's preview. Each cell is the median of 3 runs, which alternated between the three sites.v5is the baseline for this PR.v5//docs/getting-startedv5on/), so 3 runs can't tell whether this PR changes it. The two largest unused chunks (about 176 KB and 129 KB) are the same onv5and this PR.ELI5
Every docs page downloaded a whole animation library just to turn the menu icon into an X and make the Nuxi mascot wiggle, and component pages loaded it again for a blinking eye icon. The browser can do all of that on its own, so each page now loads about 150 KB less JavaScript up front, and component pages skip another 136 KB.
📝 Checklist