A Vue template compiled for rendering on the server: static HTML and the
dynamic slots between it, the shape of %Phoenix.LiveView.Rendered{}.
A template comes from Vize.split_template/2, compiled by PhoenixVapor's
compiler. Its expressions are parsed, and every
slot's :position is {line, column} in :file. Blocks inside it, such as
a v-if branch, are templates too.
Summary
Functions
The blocks directly inside a slot. See map_blocks/3.
Every expression in a template, in document order. See map_exprs/3.
Identifies statics and slots, as the fingerprint of a
%Phoenix.LiveView.Rendered{} does, so LiveView sends statics only when
they change.
Maps the blocks directly inside a slot, threading an accumulator: a
v-if's branches, a v-for's body, a component's slot content, a
<slot>'s fallback, and a fragment's template. Other slots have none.
Maps every expression in a template, threading an accumulator: fun gets
the expression, the slot it belongs to, and the accumulator. A component's
own template, under :component, belongs to that component and is skipped.
A template from its statics and compiled slots, with their fingerprint.
Stores on every slot, in this template and the blocks inside it, the root
assign keys its expressions read, its own and its blocks', as :keys.
Rendering skips a slot none of whose keys changed. Call it again after
replacing a template's expressions.
The expressions in one slot, including the blocks inside it.
Types
@type position() :: {pos_integer(), pos_integer()}
@type t() :: %PhoenixVapor.Template{ file: Path.t() | nil, fingerprint: non_neg_integer() | nil, slots: [map()], statics: [String.t()] }
Functions
The blocks directly inside a slot. See map_blocks/3.
Every expression in a template, in document order. See map_exprs/3.
@spec fingerprint([String.t()], [map()]) :: non_neg_integer()
Identifies statics and slots, as the fingerprint of a
%Phoenix.LiveView.Rendered{} does, so LiveView sends statics only when
they change.
@spec map_blocks(map(), acc, (block, acc -> {block, acc})) :: {map(), acc} when acc: term(), block: t() | map()
Maps the blocks directly inside a slot, threading an accumulator: a
v-if's branches, a v-for's body, a component's slot content, a
<slot>'s fallback, and a fragment's template. Other slots have none.
@spec map_exprs(block, acc, (term(), map(), acc -> {term(), acc})) :: {block, acc} when block: t() | %{slots: [map()]}, acc: term()
Maps every expression in a template, threading an accumulator: fun gets
the expression, the slot it belongs to, and the accumulator. A component's
own template, under :component, belongs to that component and is skipped.
A template from its statics and compiled slots, with their fingerprint.
Stores on every slot, in this template and the blocks inside it, the root
assign keys its expressions read, its own and its blocks', as :keys.
Rendering skips a slot none of whose keys changed. Call it again after
replacing a template's expressions.
The expressions in one slot, including the blocks inside it.