@nuxt/docs-nightly 4.4.0-29534185.873c77bb → 4.4.0-29535694.d52a4fdd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/1.getting-started/09.transitions.md +100 -0
- package/3.guide/3.ai/1.mcp.md +1 -1
- package/3.guide/3.ai/2.llms-txt.md +1 -1
- package/3.guide/5.recipes/4.sessions-and-authentication.md +1 -1
- package/3.guide/6.going-further/1.experimental-features.md +16 -0
- package/4.api/3.utils/define-page-meta.md +8 -2
- package/4.api/6.advanced/1.hooks.md +1 -1
- package/5.community/2.getting-help.md +1 -1
- package/package.json +1 -1
|
@@ -459,6 +459,106 @@ definePageMeta({
|
|
|
459
459
|
Overriding view transitions on a per-page basis will only have an effect if you have enabled the `experimental.viewTransition` option.
|
|
460
460
|
::
|
|
461
461
|
|
|
462
|
+
### View Transition Types
|
|
463
|
+
|
|
464
|
+
[View transition types](https://developer.chrome.com/blog/view-transitions-update-io24#view-transition-types) allow you to apply different CSS animations depending on the type of navigation. This is useful for creating asymmetric transitions (e.g., a different animation when navigating forward vs. backward).
|
|
465
|
+
|
|
466
|
+
Types are set on the [`ViewTransition`](https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition) and can be targeted in CSS using the [`:active-view-transition-type()`](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors/:active-view-transition-type) pseudo-class selector.
|
|
467
|
+
|
|
468
|
+
You can set default types globally in your `nuxt.config.ts`:
|
|
469
|
+
|
|
470
|
+
```ts twoslash [nuxt.config.ts]
|
|
471
|
+
export default defineNuxtConfig({
|
|
472
|
+
app: {
|
|
473
|
+
viewTransition: {
|
|
474
|
+
enabled: true,
|
|
475
|
+
types: ['slide'],
|
|
476
|
+
},
|
|
477
|
+
},
|
|
478
|
+
})
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
Or configure types per-page using `definePageMeta`. Per-page types support both static arrays and functions for dynamic behavior:
|
|
482
|
+
|
|
483
|
+
```vue twoslash [pages/detail.vue]
|
|
484
|
+
<script setup lang="ts">
|
|
485
|
+
definePageMeta({
|
|
486
|
+
viewTransition: {
|
|
487
|
+
enabled: true,
|
|
488
|
+
// Types applied to any transition involving this page
|
|
489
|
+
types: ['slide'],
|
|
490
|
+
// Types applied only when navigating TO this page
|
|
491
|
+
toTypes: ['slide-in'],
|
|
492
|
+
// Types applied only when navigating FROM this page
|
|
493
|
+
fromTypes: ['slide-out'],
|
|
494
|
+
},
|
|
495
|
+
})
|
|
496
|
+
</script>
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
You can also use functions for `types`, `toTypes`, and `fromTypes` in `definePageMeta` to determine types dynamically based on the route:
|
|
500
|
+
|
|
501
|
+
```vue twoslash [pages/[id].vue]
|
|
502
|
+
<script setup lang="ts">
|
|
503
|
+
definePageMeta({
|
|
504
|
+
viewTransition: {
|
|
505
|
+
enabled: true,
|
|
506
|
+
toTypes: (to, from) => {
|
|
507
|
+
// Slide left when going to a higher ID, right otherwise
|
|
508
|
+
return Number(to.params.id) > Number(from.params.id)
|
|
509
|
+
? ['slide-left']
|
|
510
|
+
: ['slide-right']
|
|
511
|
+
},
|
|
512
|
+
},
|
|
513
|
+
})
|
|
514
|
+
</script>
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
Then target these types in your CSS:
|
|
518
|
+
|
|
519
|
+
```css
|
|
520
|
+
/* Default crossfade */
|
|
521
|
+
::view-transition-old(root),
|
|
522
|
+
::view-transition-new(root) {
|
|
523
|
+
animation-duration: 0.3s;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/* Slide left animation */
|
|
527
|
+
html:active-view-transition-type(slide-left) {
|
|
528
|
+
&::view-transition-old(root) {
|
|
529
|
+
animation: slide-out-left 0.3s ease-in-out;
|
|
530
|
+
}
|
|
531
|
+
&::view-transition-new(root) {
|
|
532
|
+
animation: slide-in-right 0.3s ease-in-out;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/* Slide right animation */
|
|
537
|
+
html:active-view-transition-type(slide-right) {
|
|
538
|
+
&::view-transition-old(root) {
|
|
539
|
+
animation: slide-out-right 0.3s ease-in-out;
|
|
540
|
+
}
|
|
541
|
+
&::view-transition-new(root) {
|
|
542
|
+
animation: slide-in-left 0.3s ease-in-out;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
::note
|
|
548
|
+
Function values for `types`, `toTypes`, and `fromTypes` only work in `definePageMeta`, not in `nuxt.config.ts` (where only static `string[]` is supported).
|
|
549
|
+
::
|
|
550
|
+
|
|
551
|
+
The `page:view-transition:start` hook provides access to the [`ViewTransition`](https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition) object, which includes a [`types`](https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition/types) property (`ViewTransitionTypeSet`) that can be read or modified at runtime:
|
|
552
|
+
|
|
553
|
+
```ts [plugins/view-transition.client.ts]
|
|
554
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
555
|
+
nuxtApp.hook('page:view-transition:start', (transition) => {
|
|
556
|
+
// Read or modify types at runtime
|
|
557
|
+
console.log([...transition.types])
|
|
558
|
+
})
|
|
559
|
+
})
|
|
560
|
+
```
|
|
561
|
+
|
|
462
562
|
If you are also using Vue transitions like `pageTransition` and `layoutTransition` (see above) to achieve the same result as the new View Transitions API, then you may wish to _disable_ Vue transitions if the user's browser supports the newer, native web API. You can do this by creating `~/middleware/disable-vue-transitions.global.ts` with the following contents:
|
|
463
563
|
|
|
464
564
|
```ts
|
package/3.guide/3.ai/1.mcp.md
CHANGED
|
@@ -79,7 +79,7 @@ The Nuxt connector will appear in the composer's "Developer mode" tool later dur
|
|
|
79
79
|
### Claude Code
|
|
80
80
|
|
|
81
81
|
::note{icon="i-lucide-info"}
|
|
82
|
-
**Ensure Claude Code is installed** - Visit [Anthropic's documentation](https://
|
|
82
|
+
**Ensure Claude Code is installed** - Visit [Anthropic's documentation](https://code.claude.com/docs/en/quickstart) for installation instructions.
|
|
83
83
|
::
|
|
84
84
|
|
|
85
85
|
Add the server using the CLI command:
|
|
@@ -42,7 +42,7 @@ Nuxt provides specialized LLMs.txt files that you can reference in Cursor for be
|
|
|
42
42
|
1. **Direct reference**: Mention the LLMs.txt URLs when asking questions
|
|
43
43
|
2. Add these specific URLs to your project context using `@docs`
|
|
44
44
|
|
|
45
|
-
[Read more about Cursor Web and Docs Search](https://cursor.com/docs/context/
|
|
45
|
+
[Read more about Cursor Web and Docs Search](https://cursor.com/docs/context/mentions)
|
|
46
46
|
|
|
47
47
|
### Windsurf
|
|
48
48
|
|
|
@@ -210,7 +210,7 @@ We've successfully set up a very basic user authentication and session managemen
|
|
|
210
210
|
|
|
211
211
|
As next steps, you can:
|
|
212
212
|
- Add authentication using the [20+ supported OAuth providers](https://github.com/atinux/nuxt-auth-utils?tab=readme-ov-file#supported-oauth-providers)
|
|
213
|
-
- Add a database to store users, see [Nitro SQL Database](https://nitro.build/guide/database) or [NuxtHub SQL Database](https://hub.nuxt.com/docs/
|
|
213
|
+
- Add a database to store users, see [Nitro SQL Database](https://nitro.build/guide/database) or [NuxtHub SQL Database](https://hub.nuxt.com/docs/database)
|
|
214
214
|
- Let user signup with email & password using [password hashing](https://github.com/atinux/nuxt-auth-utils?tab=readme-ov-file#password-hashing)
|
|
215
215
|
- Add support for [WebAuthn / Passkeys](https://github.com/atinux/nuxt-auth-utils?tab=readme-ov-file#webauthn-passkey)
|
|
216
216
|
|
|
@@ -303,11 +303,27 @@ export default defineNuxtConfig({
|
|
|
303
303
|
})
|
|
304
304
|
```
|
|
305
305
|
|
|
306
|
+
You can also pass an object to configure [view transition types](/docs/4.x/getting-started/transitions#view-transition-types), which allow different CSS animations based on the type of navigation:
|
|
307
|
+
|
|
308
|
+
```ts twoslash [nuxt.config.ts]
|
|
309
|
+
export default defineNuxtConfig({
|
|
310
|
+
experimental: {
|
|
311
|
+
viewTransition: {
|
|
312
|
+
enabled: true,
|
|
313
|
+
types: ['slide'],
|
|
314
|
+
},
|
|
315
|
+
},
|
|
316
|
+
})
|
|
317
|
+
```
|
|
318
|
+
|
|
306
319
|
:link-example{to="https://stackblitz.com/edit/nuxt-view-transitions?file=app.vue" target="_blank"}
|
|
307
320
|
|
|
308
321
|
::read-more{icon="i-simple-icons-mdnwebdocs" to="https://developer.mozilla.org/en-US/docs/Web/API/View_Transition_API" target="_blank"}
|
|
309
322
|
Read more about the **View Transition API**.
|
|
310
323
|
::
|
|
324
|
+
::read-more{icon="i-simple-icons-google" to="https://developer.chrome.com/blog/view-transitions-update-io24" target="_blank"}
|
|
325
|
+
Read more about the **View Transition API**.
|
|
326
|
+
::
|
|
311
327
|
|
|
312
328
|
## writeEarlyHints
|
|
313
329
|
|
|
@@ -35,7 +35,7 @@ interface PageMeta {
|
|
|
35
35
|
groups?: string[]
|
|
36
36
|
pageTransition?: boolean | TransitionProps
|
|
37
37
|
layoutTransition?: boolean | TransitionProps
|
|
38
|
-
viewTransition?:
|
|
38
|
+
viewTransition?: ViewTransitionPageOptions['enabled'] | ViewTransitionPageOptions
|
|
39
39
|
key?: false | string | ((route: RouteLocationNormalizedLoaded) => string)
|
|
40
40
|
keepalive?: boolean | KeepAliveProps
|
|
41
41
|
layout?: false | LayoutKey | Ref<LayoutKey> | ComputedRef<LayoutKey>
|
|
@@ -121,12 +121,18 @@ interface PageMeta {
|
|
|
121
121
|
|
|
122
122
|
**`viewTransition`**
|
|
123
123
|
|
|
124
|
-
- **Type**: `boolean | 'always'`
|
|
124
|
+
- **Type**: `boolean | 'always' | ViewTransitionPageOptions`
|
|
125
125
|
|
|
126
126
|
**Experimental feature, only available when [enabled in your nuxt.config file](/docs/4.x/getting-started/transitions#view-transitions-api-experimental)**</br>
|
|
127
127
|
Enable/disable View Transitions for the current page.
|
|
128
128
|
If set to true, Nuxt will not apply the transition if the users browser matches `prefers-reduced-motion: reduce` (recommended). If set to `always`, Nuxt will always apply the transition.
|
|
129
129
|
|
|
130
|
+
You can also pass a `ViewTransitionPageOptions` object to configure [view transition types](/docs/4.x/getting-started/transitions#view-transition-types):
|
|
131
|
+
- `enabled`: `boolean | 'always'` - enable/disable the transition
|
|
132
|
+
- `types`: `string[] | (to, from) => string[]` - types applied to any transition involving this page
|
|
133
|
+
- `toTypes`: `string[] | (to, from) => string[]` - types applied only when navigating **to** this page
|
|
134
|
+
- `fromTypes`: `string[] | (to, from) => string[]` - types applied only when navigating **from** this page
|
|
135
|
+
|
|
130
136
|
**`redirect`**
|
|
131
137
|
|
|
132
138
|
- **Type**: [`RouteRecordRedirectOption`](https://router.vuejs.org/guide/essentials/redirect-and-alias)
|
|
@@ -30,7 +30,7 @@ Check the [app source code](https://github.com/nuxt/nuxt/blob/main/packages/nuxt
|
|
|
30
30
|
| `page:loading:end` | - | Client | Called after `page:finish` |
|
|
31
31
|
| `page:transition:finish` | `pageComponent?` | Client | After page transition [onAfterLeave](https://vuejs.org/guide/built-ins/transition#javascript-hooks) event. |
|
|
32
32
|
| `dev:ssr-logs` | `logs` | Client | Called with an array of server-side logs that have been passed to the client (if `features.devLogs` is enabled). |
|
|
33
|
-
| `page:view-transition:start` | `transition` | Client | Called after `document.startViewTransition` is called when [experimental viewTransition support is enabled](/docs/4.x/getting-started/transitions#view-transitions-api-experimental). |
|
|
33
|
+
| `page:view-transition:start` | `transition` | Client | Called after `document.startViewTransition` is called when [experimental viewTransition support is enabled](/docs/4.x/getting-started/transitions#view-transitions-api-experimental). The `transition` argument is a [`ViewTransition`](https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition) object with a `types` property ([`ViewTransitionTypeSet`](https://developer.mozilla.org/en-US/docs/Web/API/ViewTransitionTypeSet)) that can be read or modified. |
|
|
34
34
|
|
|
35
35
|
## Nuxt Hooks (build time)
|
|
36
36
|
|
|
@@ -41,7 +41,7 @@ We recommend taking a look at [how to report bugs](/docs/4.x/community/reporting
|
|
|
41
41
|
|
|
42
42
|
## "I need professional help"
|
|
43
43
|
|
|
44
|
-
If the community couldn't provide the help you need in the time-frame you have, NuxtLabs offers professional support with the [Nuxt Experts](https://nuxt.com/enterprise/
|
|
44
|
+
If the community couldn't provide the help you need in the time-frame you have, NuxtLabs offers professional support with the [Nuxt Experts](https://nuxt.com/enterprise/agencies).
|
|
45
45
|
|
|
46
46
|
The objective of the Nuxt Expert is to provide support to the Vue ecosystem, while also creating freelance opportunities for those contributing to open-source solutions, thus helping to maintain the sustainability of the ecosystem.
|
|
47
47
|
|