feat: add SPA navigation with view transitions
Swap page content over the existing SSE connection without full page loads. A persistent Context resets its page-specific state (signals, actions, intervals, subscriptions) on navigate while preserving the SSE stream, CSRF token, and session. - c.Navigate(path) for programmatic SPA navigation from actions - Injected JS intercepts same-origin <a> clicks (opt out with data-via-no-boost) and handles popstate for back/forward - v.Layout() wraps pages in a shared shell for DRY nav/chrome - View Transition API integration via WithViewTransitions() on PatchElements and h.DataViewTransition() helper - POST /_navigate endpoint with CSRF validation and rate limiting - pageStopChan cancels page-level OnInterval goroutines on navigate - Includes SPA example with layout, counter, and live clock pages
This commit is contained in:
@@ -11,3 +11,10 @@ func DataEffect(expression string) H {
|
||||
func DataIgnoreMorph() H {
|
||||
return Attr("data-ignore-morph")
|
||||
}
|
||||
|
||||
// DataViewTransition sets the view-transition-name CSS property on an element
|
||||
// via an inline style. Elements with matching names animate between pages
|
||||
// during SPA navigation.
|
||||
func DataViewTransition(name string) H {
|
||||
return Attr("style", "view-transition-name: "+name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user