Expand description
Plain-frame render assembly — M1-5 implementation per ADR-2.
§Module structure
cli_boxes— vendored cli-boxes@4.0.1 char table (border drawing chars).grid— char grid: write/clip/wide-char cleanup/get (output.ts port).border— border char drawing (render-border.ts port, plain slice).walk— arena tree walk → grid (render-node-to-output.ts port).mod(this) —render_to_stringentry point tying layout + grid together.
§Engine-per-call design (ADR-3, M3-A)
Both render_to_string and the build_layout_engine seam create a fresh
TaffyEngine on each call. ADR-3 (docs/adr3-engine-lifetime.md) chose
per-frame rebuild over a live incremental engine: persistence lives in the
Arena (which InkRoot will own across commit() calls, M3-D), while the
engine is a pure function of the arena at render time. A fresh engine
re-runs set_measure for every text node every frame, so the
measure-invalidation discipline (layout/engine.rs:78-82) is satisfied for
free — the rejected incremental option would have had to replicate it by
hand, at the risk of silent text-measure corruption. The node-creation walk
is NEVER re-run against an already-populated engine: insert_child appends,
so reuse would duplicate child lists. See ADR-3 for the full rationale.
§Height for unconstrained render (render-to-string.ts:62-68 citation)
ink’s renderToString calls:
rootNode.yogaNode!.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR);ink passes undefined for both axes in yoga, but the root node has an
explicit setWidth(columns) call immediately before (render-to-string.ts:62),
so in practice width is definite and only height is unconstrained.
render_to_string mirrors this: width is AvailableSpace::Definite(columns),
height is AvailableSpace::MaxContent (passed as None to calculate).
The grid is sized to the computed root height so trailing empty rows are
never included in the output.
Re-exports§
pub use colorize::ColorLevel;pub use colorize::Kind as ColorKind;pub use colorize::colorize;pub use colorize::dim;
Modules§
- background
- Box background-fill rendering — port of ink’s
render-background.ts. - border
- Border rendering — styled-frame slice.
- cli_
boxes - Vendored cli-boxes character table.
- colorize
- Chalk SGR emission — port of
ink/src/colorize.ts. - grid
- Char grid — plain-frame output assembly.
- walk
- Tree walk — plain-frame render pass.
Functions§
- build_
layout_ engine - Build a fresh layout engine for the arena tree rooted at
root_id, compute layout at the givenwidth, and return the built engine plus the root rect. - render_
static - Render the static subtree (ink’s
<Static>) to its standalone output string — the text ink prints once, above the live region. - render_
styled - Render the arena tree rooted at
root_idto a styled frame, returning both the frame string and its height in rows (mirrors ink's{output, height}, output.ts:315-316). This is the entry M3-Erender_frame` calls. - render_
to_ string - Render the arena tree rooted at
root_idto a plain-frame string.