diff --git a/docs/app/assets/icons/embla-carousel.svg b/docs/app/assets/icons/embla-carousel.svg
index 9dbcd64fcd..446fa81b55 100644
--- a/docs/app/assets/icons/embla-carousel.svg
+++ b/docs/app/assets/icons/embla-carousel.svg
@@ -1 +1 @@
-
+
\ No newline at end of file
diff --git a/docs/app/components/content/ComponentThemeVisualizerIcon.vue b/docs/app/components/content/ComponentThemeVisualizerIcon.vue
index c446574375..cc183956c1 100644
--- a/docs/app/components/content/ComponentThemeVisualizerIcon.vue
+++ b/docs/app/components/content/ComponentThemeVisualizerIcon.vue
@@ -1,91 +1,11 @@
@@ -99,53 +19,104 @@ const currentState = computed(() => props.open ? 'open' : 'closed')
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
+ :data-open="open || undefined"
>
-
-
-
-
+
+
diff --git a/docs/app/components/content/HeaderToggleButton.vue b/docs/app/components/content/HeaderToggleButton.vue
index 7e5e856ff7..9833595917 100644
--- a/docs/app/components/content/HeaderToggleButton.vue
+++ b/docs/app/components/content/HeaderToggleButton.vue
@@ -1,33 +1,18 @@
@@ -48,38 +33,26 @@ const state = computed(() => props.open ? 'close' : 'normal')
stroke-linecap="round"
stroke-linejoin="round"
>
-
-
-
diff --git a/docs/app/components/content/examples/header/HeaderToggleAnimatedExample.vue b/docs/app/components/content/examples/header/HeaderToggleAnimatedExample.vue
index 382464c540..72deafed1a 100644
--- a/docs/app/components/content/examples/header/HeaderToggleAnimatedExample.vue
+++ b/docs/app/components/content/examples/header/HeaderToggleAnimatedExample.vue
@@ -1,6 +1,4 @@
@@ -91,35 +70,26 @@ const variants: { [k: string]: VariantType | ((custom: unknown) => VariantType)
stroke-linecap="round"
stroke-linejoin="round"
>
-
-
-
diff --git a/docs/app/composables/useNuxiIcon.ts b/docs/app/composables/useNuxiIcon.ts
index f548697bff..45be2bb288 100644
--- a/docs/app/composables/useNuxiIcon.ts
+++ b/docs/app/composables/useNuxiIcon.ts
@@ -1,4 +1,3 @@
-import { useAnimate } from 'motion-v'
import { useElementVisibility, useEventListener, useRafFn } from '@vueuse/core'
/**
@@ -9,6 +8,18 @@ import { useElementVisibility, useEventListener, useRafFn } from '@vueuse/core'
*/
export type NuxiMood = 'idle' | 'happy' | 'excited' | 'thinking' | 'sleeping' | 'surprised'
+type Keyframes = number | Array
+
+interface BodyKeyframes {
+ y?: Keyframes
+ rotate?: Keyframes
+ scale?: Keyframes
+ scaleX?: Keyframes
+ scaleY?: Keyframes
+}
+
+type Ease = 'easeIn' | [number, number, number, number]
+
type LookDir = 'center' | 'left' | 'right' | 'up'
type MouthShape = 'default' | 'O'
@@ -73,11 +84,49 @@ type EmitFn = (event: 'moodChange', mood: NuxiMood) => void
export function useNuxiIcon(props: NuxiIconProps, emit?: EmitFn) {
const maskId = useId()
- const [svgEl, animate] = useAnimate()
+ const svgEl = shallowRef()
+
+ // Where the body rests between easter eggs: a keyframe of `null` starts from here.
+ const body = { y: 0, rotate: 0, scaleX: 1, scaleY: 1 }
+
+ /**
+ * Plays the easter eggs with the Web Animations API, in the shape of motion's `animate()`: each of
+ * `translate`, `rotate` and `scale` runs as its own animation, the ease applies between keyframes,
+ * and a single value animates from where the body is.
+ */
+ async function animate(selector: string, keyframes: BodyKeyframes, { duration, ease }: { duration: number, ease?: Ease }) {
+ const el = svgEl.value?.querySelector(selector)
+ if (!el) return
+
+ const { scale, ...rest } = keyframes
+ const values: Omit = scale === undefined ? rest : { scaleX: scale, scaleY: scale, ...rest }
+ const frames = Object.fromEntries(Object.entries(values).map(([key, value]) => {
+ const from = body[key as keyof typeof body]
+ return [key, (Array.isArray(value) ? value : [null, value]).map(v => v ?? from)]
+ })) as Partial>
+ for (const [key, list] of Object.entries(frames)) body[key as keyof typeof body] = list.at(-1)!
+
+ const scaleFrames = frames.scaleX || frames.scaleY
+ ? zip(frames.scaleX ?? [body.scaleX], frames.scaleY ?? [body.scaleY], (x, y) => `${x} ${y}`)
+ : undefined
+ const tracks = [
+ ['translate', frames.y?.map(v => `0 ${v}px`)],
+ ['rotate', frames.rotate?.map(v => `${v}deg`)],
+ ['scale', scaleFrames]
+ ].filter((track): track is [string, string[]] => !!track[1])
+
+ const easing = !ease ? 'ease-out' : ease === 'easeIn' ? 'ease-in' : `cubic-bezier(${ease.join(', ')})`
+ await Promise.all(tracks.map(async ([property, list]) => {
+ // The end value goes inline first: the animation runs over it, and it stays once the animation ends.
+ el.style.setProperty(property, list.at(-1)!)
+ // `easing` inside the keyframes applies between each pair of them, as motion's `ease` does.
+ if (duration > 0) await el.animate({ [property]: list, easing }, { duration: duration * 1000 }).finished
+ }))
+ }
// Below `lg` the button is only CSS-hidden, so the icon stays mounted with a
// zeroed rect. Nothing animates, listens or schedules while it is out of view.
- const isElementVisible = useElementVisibility(() => svgEl.value as unknown as SVGSVGElement | undefined)
+ const isElementVisible = useElementVisibility(svgEl)
const isPageVisible = ref(true)
const isAwake = computed(() => isElementVisible.value && isPageVisible.value)
@@ -322,7 +371,7 @@ export function useNuxiIcon(props: NuxiIconProps, emit?: EmitFn) {
if (!isAwake.value) return
if (!svgEl.value || isHovered.value) return
- const rect = (svgEl.value as unknown as Element).getBoundingClientRect()
+ const rect = svgEl.value.getBoundingClientRect()
const cx = rect.left + rect.width / 2
const cy = rect.top + rect.height / 2
const dx = e.clientX - cx
@@ -554,3 +603,10 @@ export function useNuxiIcon(props: NuxiIconProps, emit?: EmitFn) {
handleSvgClick
}
}
+
+/** Pairs two keyframe lists, stretching a shorter one by holding its first and last values. */
+function zip(a: number[], b: number[], join: (a: number, b: number) => string): string[] {
+ const length = Math.max(a.length, b.length)
+ const at = (list: number[], i: number) => list.length === length ? list[i]! : i === 0 ? list[0]! : list.at(-1)!
+ return Array.from({ length }, (_, i) => join(at(a, i), at(b, i)))
+}
diff --git a/docs/content/docs/2.components/header.md b/docs/content/docs/2.components/header.md
index 26afa29747..eb38c5fa2a 100644
--- a/docs/content/docs/2.components/header.md
+++ b/docs/content/docs/2.components/header.md
@@ -184,7 +184,7 @@ props:
### With animated toggle
-Use the `#toggle` slot to replace the default toggle button with a custom animated hamburger icon using [Motion Vue](https://motion.dev/docs/vue/motion-component).
+Use the `#toggle` slot to replace the default toggle button with a custom hamburger icon that turns into a cross with CSS transitions.
::component-example
---
diff --git a/docs/nuxt.config.ts b/docs/nuxt.config.ts
index 87e76796bc..38ae12a648 100644
--- a/docs/nuxt.config.ts
+++ b/docs/nuxt.config.ts
@@ -22,7 +22,6 @@ export default defineNuxtConfig({
'@nuxt/fonts',
'nuxt-og-image',
'nuxt-schema-org',
- 'motion-v/nuxt',
'@vercel/analytics',
'@vercel/speed-insights'
],
diff --git a/docs/package.json b/docs/package.json
index 7ca15b6988..86da65c70a 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -66,7 +66,6 @@
"json5": "catalog:",
"maska": "catalog:",
"minimark": "catalog:",
- "motion-v": "catalog:",
"nuxt": "catalog:",
"nuxt-agent-discovery": "catalog:",
"nuxt-component-meta": "catalog:",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 61f75ae8d0..b24b4fe0f3 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -452,9 +452,6 @@ catalogs:
mlly:
specifier: ^1.8.2
version: 1.8.2
- motion-v:
- specifier: ^2.10.0
- version: 2.10.0
nuxt:
specifier: ^4.6.4
version: 4.6.4
@@ -1046,9 +1043,6 @@ importers:
minimark:
specifier: 'catalog:'
version: 0.2.0
- motion-v:
- specifier: 'catalog:'
- version: 2.10.0(@vueuse/core@14.4.0(vue@3.5.44(typescript@6.0.3)))(vue@3.5.44(typescript@6.0.3))
nuxt:
specifier: 'catalog:'
version: 4.6.4(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0(supports-color@10.2.2)))(@babel/plugin-syntax-typescript@7.29.7(@babel/core@7.29.0(supports-color@10.2.2)))(@oxc-project/types@0.155.0)(@parcel/watcher@2.5.6)(@types/node@25.9.0)(@vue/compiler-sfc@3.5.44)(acorn@8.18.0)(better-sqlite3@12.11.1)(confbox@0.3.1)(db0@0.4.1)(dotenv@17.4.2)(esbuild@0.28.2)(eslint@10.14.0(jiti@2.7.0)(supports-color@10.2.2))(giget@3.3.1)(ioredis@5.11.1(supports-color@10.2.2))(lightningcss@1.33.0)(meow@13.2.0)(mlly@1.8.2)(optionator@0.9.4)(oxc-parser@0.153.0)(rolldown@1.2.15)(rollup-plugin-visualizer@7.1.1(rolldown@1.2.15)(rollup@4.67.4))(rollup@4.67.4)(srvx@1.0.5)(supports-color@10.2.2)(terser@5.51.2)(typescript@6.0.3)(vite@8.3.5(@types/node@25.9.0)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1))(vue-tsc@3.3.11(typescript@6.0.3))(yaml@2.9.1)
@@ -6614,20 +6608,6 @@ packages:
fraction.js@5.3.4:
resolution: {integrity: sha512-1X1NTtiJphryn/uLQz3whtY6jK3fTqoE3ohKs0tT+Ujr1W59oopxmoEh7Lu5p6vBaPbgoM0bzveAW4Qi5RyWDQ==}
- framer-motion@14.8.0:
- resolution: {integrity: sha512-PQsSx+UlaKiyPhADjVT5wALBErJJdbMeKQS4gQx6ibOrSNni7qjqfTKMvf6YHGG8pQWi6njs7AqrIG7R2hbnxA==}
- peerDependencies:
- react: ^18.0.0 || ^19.0.0
- react-dom: ^18.0.0 || ^19.0.0
- remix: ^3.1.0
- peerDependenciesMeta:
- react:
- optional: true
- react-dom:
- optional: true
- remix:
- optional: true
-
fresh@2.0.0:
resolution: {integrity: sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==}
engines: {node: '>= 0.8'}
@@ -6847,9 +6827,6 @@ packages:
hastscript@9.0.1:
resolution: {integrity: sha512-g7df9rMFX/SPi34tyGCyUBREQoKkapwdY/T04Qn9TDWfHhAYt4/I0gMVirzK5wEzeUqIjEB+LXC/ypb7Aqno5w==}
- hey-listen@1.0.8:
- resolution: {integrity: sha512-COpmrF2NOg4TBWUJ5UVyaCU2A88wEMkUPK4hNqyCkqHbxT92BbvfjoSozkAIIm6XhicGlJHhFdullInrdhwU8Q==}
-
hono@4.12.21:
resolution: {integrity: sha512-uV63apnb0kyPtAUwoWgaGh9HyIFcv8lgmzPZSiTBQAFOFGIzka5EZ1dZocmGnn0XdX0+XTqJ6Tqv7selMuGLRQ==}
engines: {node: '>=16.9.0'}
@@ -7781,18 +7758,6 @@ packages:
mocked-exports@0.1.1:
resolution: {integrity: sha512-aF7yRQr/Q0O2/4pIXm6PZ5G+jAd7QS4Yu8m+WEeEHGnbo+7mE36CbLSDQiXYV8bVL3NfmdeqPJct0tUlnjVSnA==}
- motion-dom@14.8.0:
- resolution: {integrity: sha512-HzA41kvV7BgluM7L/XbW+gHFzDtJUbHnEsrlnIzPS9dqSfoPy9YzL6VKF7ai0TiQcykkkLUqvIxECAdwa9gwAw==}
-
- motion-utils@14.7.0:
- resolution: {integrity: sha512-woO0/Nb7ys75f94fjvQi/6leiHGvZUYkeHUPEZ3vxsV+9OpEVhkxp01x8MlRwX0zt31EqgXsKDAoBoJLC148Tw==}
-
- motion-v@2.10.0:
- resolution: {integrity: sha512-uWEEtQgS3fE1AWf6FNJ3JhXMJ9jNv6FJSQnE/Od1a6/dtk1zYcAU7ViBruXM7OgXI0B+fnJrzETIt0wQTIMeJA==}
- peerDependencies:
- '@vueuse/core': '>=10.0.0'
- vue: '>=3.0.0'
-
mrmime@2.0.1:
resolution: {integrity: sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==}
engines: {node: '>=10'}
@@ -17031,12 +16996,6 @@ snapshots:
fraction.js@5.3.4: {}
- framer-motion@14.8.0:
- dependencies:
- motion-dom: 14.8.0
- motion-utils: 14.7.0
- tslib: 2.8.1
-
fresh@2.0.0: {}
fs-constants@1.0.0:
@@ -17364,8 +17323,6 @@ snapshots:
property-information: 7.2.0
space-separated-tokens: 2.0.2
- hey-listen@1.0.8: {}
-
hono@4.12.21: {}
hookable@5.5.3: {}
@@ -18427,25 +18384,6 @@ snapshots:
mocked-exports@0.1.1: {}
- motion-dom@14.8.0:
- dependencies:
- motion-utils: 14.7.0
-
- motion-utils@14.7.0: {}
-
- motion-v@2.10.0(@vueuse/core@14.4.0(vue@3.5.44(typescript@6.0.3)))(vue@3.5.44(typescript@6.0.3)):
- dependencies:
- '@vueuse/core': 14.4.0(vue@3.5.44(typescript@6.0.3))
- framer-motion: 14.8.0
- hey-listen: 1.0.8
- motion-dom: 14.8.0
- motion-utils: 14.7.0
- vue: 3.5.44(typescript@6.0.3)
- transitivePeerDependencies:
- - react
- - react-dom
- - remix
-
mrmime@2.0.1: {}
ms@2.1.3: {}
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index 4550c7f433..cfae9a68f5 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -113,7 +113,6 @@ catalog:
maska: ^3.2.2
minimark: ^0.2.0
mlly: ^1.8.2
- motion-v: ^2.10.0
nuxt: ^4.6.4
nuxt-agent-discovery: ^0.8.1
nuxt-component-meta: ^0.19.0