Module

server.view_transitions

View Transitions bridge — one-flag setup for the View Transitions API.

Enables smooth, animated page transitions for both browser-native MPA navigations and htmx-driven SPA-style swaps. Two snippets are injected:

Head snippet (before</head>):

  • <meta name="view-transition" content="same-origin">— enables the browser's native cross-document View Transitions API.
  • @view-transition { navigation: auto; }— CSS at-rule that opts the page into automatic cross-document transitions.
  • Default crossfade keyframes (chirp-vt-out / chirp-vt-in) on the roottransition name. Apps can override with their own view-transition-nameCSS for per-element transitions.

Script snippet (before</body>):

  • Setshtmx.config.globalViewTransitions = trueso every htmx swap automatically uses the View Transitions API when available.
  • Idempotent guard (window.__chirpViewTransitions) prevents double-init.
  • Deferred listener (htmx:load) handles the case where htmx loads after the script (e.g.,<script defer>).

Injected into full-page HTML responses viaHTMLInjectmiddleware. Controlled byAppConfig(view_transitions=True) (default: False).