Generates a complete Phoenix LiveView module source string from a scene graph.
The output is a ready-to-paste .ex file containing:
use MyAppWeb, :live_viewimportstatements for every PhiaUI module referenced by components in the scene- A
mount/3callback that assigns any specified initial state - A
render/1callback containing the emitted HEEx template - Optional
handle_event/3callbacks
Also provides helpers to list required JS hooks and mix phia.add commands
so the consumer app can install everything the design needs.
Summary
Functions
Generate a complete LiveView module source string.
Generate import statements for the modules that provide the used components.
Return the mix phia.add commands needed to install all used components.
Return the list of JS hook names required by the given component keys.
Functions
Generate a complete LiveView module source string.
Parameters
scene- the ETS scene referencemodule_name- fully-qualified module name string, e.g."MyAppWeb.DashboardLive"
Options
:web_module- the Phoenix web module (default:"MyAppWeb"):assigns- map of assigns to set inmount/3(default:%{}):events- list of{event_name, body_string}tuples forhandle_event/3callbacks (default:[])
Generate import statements for the modules that provide the used components.
Looks up each component key in PhiaUi.ComponentRegistry, collects the
unique modules, and returns a list of import Module lines.
Return the mix phia.add commands needed to install all used components.
Return the list of JS hook names required by the given component keys.
The hooks must be registered in the LiveSocket on the client side.