Represents an A2UI component in the adjacency list.
Components are flat — parent-child relationships use ID references
via child/children props.
Summary
Functions
Parses a raw JSON map into a Component struct.
Converts a Component struct back to a JSON-compatible map.
Types
Functions
Parses a raw JSON map into a Component struct.
Extracts id, component (as type), and accessibility.
All remaining keys become props.
Examples
iex> A2UI.Component.from_map(%{"id" => "header", "component" => "Text", "text" => "Hello", "variant" => "h1"})
%A2UI.Component{id: "header", type: "Text", props: %{"text" => "Hello", "variant" => "h1"}}
Converts a Component struct back to a JSON-compatible map.
Inverse of from_map/1. Props are spread as top-level keys,
and "accessibility" is included only when non-nil.
Examples
iex> A2UI.Component.to_map(%A2UI.Component{id: "h", type: "Text", props: %{"text" => "Hi"}})
%{"id" => "h", "component" => "Text", "text" => "Hi"}