Documentation
¶
Overview ¶
Package renderer evaluates GoBeyond rendering plans and emits deterministic HTML without executing JavaScript.
Index ¶
Constants ¶
const FrameworkLocalsKey = "__gobeyond"
FrameworkLocalsKey is the reserved locals namespace used by portable usePathname / useRoute bake paths (`__gobeyond.pathname`, `__gobeyond.route`).
Variables ¶
This section is empty.
Functions ¶
func Render ¶
func Render(plan *renderplan.Plan, props any) (string, error)
Render validates and renders a complete plan. It never returns partial HTML. The render clock is captured once and must also be embedded in hydration data as renderNow so browser Date rewrites match Go (same class of contract as Next.js SSR: first paint uses the server snapshot).
Types ¶
type NavigationMeta ¶
type NavigationMeta struct {
}
NavigationMeta is request-time route identity injected for portable nav hooks.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
func (*Renderer) RenderAt ¶
func (r *Renderer) RenderAt(plan *renderplan.Plan, props any, now time.Time) (string, time.Time, error)
RenderAt validates and renders a plan using now as the render-snapshot clock. It returns the HTML and the normalized UTC instant that callers must embed in hydration JSON as renderNow. A zero now uses r.now (or time.Now).
func (*Renderer) WithNavigation ¶
func (r *Renderer) WithNavigation(meta NavigationMeta) *Renderer
WithNavigation returns a renderer that seeds `__gobeyond` locals for plan evaluation. Hydration payloads should continue to use the original page props; the browser reads soft-navigation state instead of this namespace.
type SafeHTML ¶
type SafeHTML = renderplan.SafeHTML
SafeHTML and TrustedHTML are renderer-level aliases for applications that do not otherwise need to import the render-plan model.