arizona_native (arizona v0.4.0)
View SourceNative (JSON) render-target backend.
Emits the byte sequences that make up the s statics as a JSON widget tree
for native clients (iOS/SwiftUI, Android/Compose, ...). Each element becomes a
flat JSON object:
{"type": "Column", "az": "0", "padding": "16", "children": [ ... ]}type, az and children are reserved keys; every other key is a widget
prop. The framework is vocabulary-agnostic -- the tag atom is emitted verbatim
as type and the client engine maps it to a real widget. Dynamic text children
become addressable #text nodes so the diff engine can target them by az.
String keys and values are escaped via json:encode/1, so the zipped statics
form valid JSON. So do the dynamics in the zipped document (escape/1,
render_attr/2): a scalar is a JSON string, an effect command its array and a
typed boolean prop a JSON boolean, exactly what a client builds by JSON-encoding
the wire value. On the wire itself a value stays raw
(wire_escape/1, wire_attr/2), because the client does that encoding.
Summary
Functions
-spec attr_names() -> case_sensitive.
-spec children_sep() -> binary().
-spec content_context(arizona_renderer:tag(), arizona_renderer:content_context()) -> arizona_renderer:content_context().
-spec element_open_end() -> binary().
-spec element_void_close() -> binary().
-spec implied_attrs(arizona_renderer:tag(), [binary()]) -> [].
-spec is_void(arizona_renderer:tag()) -> boolean().
-spec name(arizona_renderer:tag()) -> binary().
-spec raw_text_kind(arizona_renderer:tag(), arizona_renderer:content_context()) -> arizona_renderer:raw_text_kind().
-spec text_az(binary(), non_neg_integer()) -> binary().
-spec text_slot_close() -> binary().
-spec wire_attr(binary(), term()) -> json:encode_value().