arizona_native (arizona v0.4.0)

View Source

Native (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

attr(Name, Value)

-spec attr(binary(), binary()) -> binary().

attr_bool(Name, Bool)

-spec attr_bool(binary(), boolean()) -> binary().

attr_command(Name, Cmd)

-spec attr_command(binary(), term()) -> binary().

attr_dyn_name(Name)

-spec attr_dyn_name(binary()) -> binary().

attr_names()

-spec attr_names() -> case_sensitive.

az_attr(Az)

-spec az_attr(binary()) -> binary().

boolean_attrs()

children_sep()

-spec children_sep() -> binary().

content_context(Tag, Parent)

content_type()

each_items(Items)

-spec each_items([iodata()]) -> iodata().

element_close(TagName)

-spec element_close(binary()) -> binary().

element_open(TagName)

-spec element_open(binary()) -> binary().

element_open_end()

-spec element_open_end() -> binary().

element_void_close()

-spec element_void_close() -> binary().

escape(Bin)

-spec escape(binary()) -> binary().

implied_attrs(Tag, Names)

-spec implied_attrs(arizona_renderer:tag(), [binary()]) -> [].

is_void(Tag)

-spec is_void(arizona_renderer:tag()) -> boolean().

keyed_item_ops()

name/1

-spec name(arizona_renderer:tag()) -> binary().

raw_text(Tag, Before, After, Value)

-spec raw_text(atom(), binary(), binary(), term()) -> term().

raw_text_kind(Tag, Context)

render_attr(Name, Value)

-spec render_attr(binary(), term()) -> binary().

scope_static(Fp, Prefix, S0)

-spec scope_static(binary(), binary(), binary()) -> binary().

single_root_document()

supports_list_patch()

supports_local()

supports_nodiff_keep()

target()

text_az(ElemAz, Slot)

-spec text_az(binary(), non_neg_integer()) -> binary().

text_child(Text)

-spec text_child(binary()) -> binary().

text_slot_close()

-spec text_slot_close() -> binary().

text_slot_open(Az)

-spec text_slot_open(binary()) -> binary().

wire_attr/2

-spec wire_attr(binary(), term()) -> json:encode_value().

wire_escape(Bin)

-spec wire_escape(binary()) -> binary().