Rendering state for Phlex components.
Manages the buffer, rendering flags, fragments, and cache capture contexts.
Summary
Functions
Appends content to the buffer.
Increments fragment depth unconditionally.
Begins a named fragment: updates selective-render depth and cache offsets.
Renders a block into an isolated buffer for cache storage.
Captures the output of a block.
Decrements fragment depth unconditionally.
Ends a named fragment: finalizes cache length and clears selective-render membership.
Flushes the buffer to the output buffer.
Creates a new state with default values.
Records a fragment range into the current cache context, shifting by buffer size.
Checks if the component should render.
Types
@type cache_entry() :: %{map: map(), frozen_prefix_bytes: non_neg_integer()}
@type fragment_meta() :: {non_neg_integer(), non_neg_integer() | nil, list()}
@type t() :: %Phlex.SGML.State{ buffer: IO.chardata(), cache_stack: [cache_entry()], capturing: boolean(), content_block: function() | nil, fragment_depth: non_neg_integer(), fragment_map: map(), fragments: MapSet.t() | nil, output_buffer: IO.chardata(), rendering: boolean(), should_render: boolean(), user_context: map() }
Functions
Appends content to the buffer.
Increments fragment depth unconditionally.
Begins a named fragment: updates selective-render depth and cache offsets.
Renders a block into an isolated buffer for cache storage.
Returns {binary, fragment_map} where fragment_map maps fragment names to
{byte_offset, byte_length, nested_fragment_names}.
Captures the output of a block.
Returns the captured buffer content as a binary.
Decrements fragment depth unconditionally.
Ends a named fragment: finalizes cache length and clears selective-render membership.
Flushes the buffer to the output buffer.
Creates a new state with default values.
Records a fragment range into the current cache context, shifting by buffer size.
Checks if the component should render.