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
21 lines
501 B
Go
21 lines
501 B
Go
package h
|
|
|
|
func DataInit(expression string) H {
|
|
return Data("init", expression)
|
|
}
|
|
|
|
func DataEffect(expression string) H {
|
|
return Data("effect", expression)
|
|
}
|
|
|
|
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)
|
|
}
|