Aurora. Uix. Templates. Basic. Handlers. ShowComponentImpl behaviour
(Aurora UIX v0.1.4-rc.8)
Copy Markdown
Behaviour and macro for implementing show live view component handlers in Aurora UIX LiveView templates.
Provides a set of callbacks and a __using__/1 macro to standardize the handling of mount, parameter changes,
events, info messages, and action application. Designed for use with Phoenix LiveView and
Aurora UIX conventions.
Key Features
- Defines required callbacks for form live component lifecycle and event handling.
- Supplies a macro to inject default implementations and imports for LiveView modules.
- Integrates with Aurora UIX context and module generators for dynamic entity management.
Key Constraints
- Expects the
:auixassign to be present in the LiveView socket. - Designed for use with Phoenix LiveView and Aurora UIX context modules.
- Assumes certain structure in the
auixassign (e.g.,modules.context,source_key, etc.).
Summary
Callbacks
Internally handles all LiveView events for the show component.
Updates the show view state and assigns for the LiveComponent.
Functions
Handles events such as section switching and navigation in the show view.
Updates the show view state and assigns for the LiveComponent.
Callbacks
@callback auix_handle_event( event :: binary(), params :: map(), socket :: Phoenix.LiveView.Socket.t() ) :: {:noreply, Phoenix.LiveView.Socket.t()}
Internally handles all LiveView events for the show component.
Parameters
event(binary()) - Event name.params(map()) - Event parameters.socket(Socket.t()) - LiveView socket.
Returns
{:noreply, Socket.t()} - Updated socket after event handling.
@callback auix_update(assigns :: map(), socket :: Phoenix.LiveView.Socket.t()) :: {:ok, Phoenix.LiveView.Socket.t()}
Updates the show view state and assigns for the LiveComponent.
Parameters
assigns(map()) - Assigns containing at least%{auix: %{entity: map(), routing_stack: Stack.t()}}.socket(Socket.t()) - The current LiveView socket.
Returns
{:ok, Socket.t()} - The updated socket with show view state and routing stack assigned.
Functions
@spec auix_handle_event(binary(), map(), Phoenix.LiveView.Socket.t()) :: {:noreply, Phoenix.LiveView.Socket.t()}
Handles events such as section switching and navigation in the show view.
Parameters
event(binary()) - The event name (e.g., "switch_section", "auix_route_back").params(map()) - Parameters from the event.socket(Socket.t()) - The current LiveView socket.
Returns
{:noreply, Socket.t()} - The updated socket after handling the event.
@spec auix_update(map(), Phoenix.LiveView.Socket.t()) :: {:ok, Phoenix.LiveView.Socket.t()}
Updates the show view state and assigns for the LiveComponent.
Parameters
assigns(map()) - Assigns containing at least%{auix: %{entity: map(), routing_stack: Stack.t()}}.socket(Socket.t()) - The current LiveView socket.
Returns
{:ok, Socket.t()} - The updated socket with show view state and routing stack assigned.