feat: add View Transitions API support for client-side navigation (#3708)
## Summary - Integrates the [View Transitions API](https://developer.mozilla.org/en-US/docs/Web/API/View_Transition_API) into Fresh's existing partials system - Opt-in via `f-view-transition` attribute, progressive enhancement (falls back gracefully) - Wraps all navigation types (link clicks, popstate, form submissions) in `document.startViewTransition()` ## Usage ```html <body f-client-nav f-view-transition> <!-- your app --> </body> ``` Customize animations with standard CSS: ```css ::view-transition-old(root) { animation: fade-out 0.2s ease-in; } ::view-transition-new(root) { animation: fade-in 0.2s ease-out; } ``` Per-element transitions work via `view-transition-name`: ```css .sidebar { view-transition-name: sidebar; } ``` ## Design decisions - **Opt-in** — only activates when `f-view-transition` attribute is present, can be disabled with `f-view-transition="false"` - **Progressive** — falls back to regular partial updates when the browser doesn't support the View Transitions API - **Minimal** — 35 lines of implementation, integrates into existing partials infrastructure rather than building a parallel navigation system Closes https://github.com/denoland/fresh/issues/3458 --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
cf73d29c3a
commit
400e217c5e
@@ -201,6 +201,13 @@ export default function LogView() {
|
||||
> children from existing ones, leading to subtle rendering bugs. Fresh will log
|
||||
> a warning if it detects a missing key on an append/prepend partial.
|
||||
|
||||
## View Transitions
|
||||
|
||||
Partial updates can be animated using the browser's
|
||||
[View Transitions API](/docs/advanced/view-transitions). Add `f-view-transition`
|
||||
alongside `f-client-nav` to enable smooth animated transitions between pages
|
||||
with zero JavaScript animation code.
|
||||
|
||||
## Bypassing or disabling Partials
|
||||
|
||||
If you want to exempt a particular element from triggering a partial request
|
||||
|
||||
Reference in New Issue
Block a user