Generates Elixir code (AST) for the server side of a hybrid component.
Produces:
mount/3— initializes LiveView assignsrender/1— produces%Rendered{}with server slots + props payloadhandle_event/3— one clause per server action
Summary
Functions
Build the %Phoenix.LiveView.Rendered{} struct at runtime.
Classify each slot in the Vapor IR as server-owned or client-owned.
Generate handle_event/3 clauses for server actions.
Generate the render/1 function.
Generate all server-side function ASTs for a hybrid component.
Functions
Build the %Phoenix.LiveView.Rendered{} struct at runtime.
Handles:
- Full initial render (all slots evaluated for first paint)
- Props JSON payload injected into the statics via a wrapper
- Change tracking: client-owned slots still re-evaluate when their underlying server prop changes (for LV diff correctness)
Classify each slot in the Vapor IR as server-owned or client-owned.
A slot is client-owned if any of its referenced identifiers belong to a client ref, client computed, or mixed computed.
Generate handle_event/3 clauses for server actions.
Generate the render/1 function.
The rendered output includes:
- All slots evaluated for the initial/full render (SEO, first paint)
- A
data-pv-propsattribute with JSON-encoded client-consumed props - Change tracking that skips client-owned slots when only client props changed
@spec generate( split :: map(), classification :: PhoenixVapor.Hybrid.Classifier.classification(), opts :: keyword() ) :: [Macro.t()]
Generate all server-side function ASTs for a hybrid component.
Returns a list of quoted expressions to be injected into the LiveView module.