The function components that walk a resolved surface, and the helpers component implementations share.
component_node/1 renders one node of an A2UICore.Resolution.NodeResolver
tree: a placeholder for the states that have no definition (:pending,
:unknown_type, :cyclic), else the function component the context's
component map has for the node's type. That component receives:
@ctx— theA2UIPhoenix.Context;@node— theA2UICore.Resolution.Node;@props— the node's props with every binding replaced by its current value (children stay{:node, ref}, actions stayA2UICore.Resolution.Actions);@a11y—A2UICore.Accessibility.attributes/2of the component;@attrs— the global attributes for the component's root element: its DOM id,data-a2ui-id, and the ARIA attributes the component declared (aria-labelfor an explicit label,aria-description,aria-livewhen not"off",aria-hiddenwhen hidden), andaria-busywhile a property waits for an agent function.
A component renders its children with child/1 and its failed checks
with validation_errors/1.
Summary
Functions
Renders a child slot: {:node, ref}, a list of them, or nothing.
Renders node ref of the context's tree (nothing when it is not
mounted).
The ids of the error messages validation_errors/1 renders, for an
input's aria-describedby (nil when the checks pass).
Whether the component's checks fail.
The node's props with every binding replaced by its value.
An inline style: the component's flex weight followed by extra
declarations; nil when there is nothing to say.
Text for display: strings as they are, other scalars in their JSON
spelling, nil as empty.
Renders the messages of a component's failed checks (isValid false and
validationErrors), each with the id aria-describedby points at.
Functions
@spec child(map()) :: Phoenix.LiveView.Rendered.t()
Renders a child slot: {:node, ref}, a list of them, or nothing.
Attributes
ctx(A2UIPhoenix.Context) (required)child(:any) (required)
@spec component_node(map()) :: Phoenix.LiveView.Rendered.t()
Renders node ref of the context's tree (nothing when it is not
mounted).
Attributes
ctx(A2UIPhoenix.Context) (required)ref(:integer) (required)
@spec error_ids(A2UIPhoenix.Context.t(), A2UICore.Resolution.Node.t(), map()) :: String.t() | nil
The ids of the error messages validation_errors/1 renders, for an
input's aria-describedby (nil when the checks pass).
Whether the component's checks fail.
@spec props(A2UICore.Resolution.Node.t()) :: map()
The node's props with every binding replaced by its value.
An inline style: the component's flex weight followed by extra
declarations; nil when there is nothing to say.
iex> A2UIPhoenix.Components.style(%{"weight" => 2}, ["text-align: center"])
"flex: 2; text-align: center"
iex> A2UIPhoenix.Components.style(%{})
nil
Text for display: strings as they are, other scalars in their JSON
spelling, nil as empty.
iex> A2UIPhoenix.Components.text(3.5)
"3.5"
iex> A2UIPhoenix.Components.text(nil)
""
@spec validation_errors(map()) :: Phoenix.LiveView.Rendered.t()
Renders the messages of a component's failed checks (isValid false and
validationErrors), each with the id aria-describedby points at.
Attributes
ctx(A2UIPhoenix.Context) (required)node(A2UICore.Resolution.Node) (required)props(:map) (required)