Layout, drawing, hit testing, and event dispatch pipeline.
Renderer: layout, drawing, hit testing, and event dispatch.
The renderer drives a three-pass pipeline over a Renderable.t tree:
Lifecycle: runs per-frame and resize hooks on registered nodes.
Layout and command generation: computes layout via Toffee, walks the tree depth-first to extract absolute positions, and builds a flat render command list (opacity, scissors, draw calls).
Execution: replays the command list to populate the grid and hit grid.
After the pipeline, render diffs the grid against the previous frame and returns minimal ANSI output.
The renderer owns the root Renderable.t, the Screen.t, and all pipeline state. Widget code builds the tree under root; the event loop calls render_frame and render, then dispatches input events.
dispatch_key t key sends key to the focused renderable and returns the resulting event.
If the focused node does not prevent default, the default key handler runs. The returned event carries the default_prevented flag set by the focused node's handler; callers can inspect it to determine whether the key was consumed.
hover t is the renderable currently under the mouse pointer, if any.
Frame callbacks
Sourceval add_frame_callback : t->(float -> unit)-> unit
add_frame_callback t f registers f to run at the start of each frame with delta time in milliseconds. Callbacks run after lifecycle passes and before layout computation.
add_post_process t f registers f as a persistent post-processing transform on the underlying screen. f receives the rendered Grid.t and the frame delta in milliseconds; it runs after frame building and before diffing. Returns a Screen.effect_id for later removal.