Expand description
Step-based WASM program runner for FrankenTUI.
StepProgram drives an ftui_runtime::program::Model through
init / event / update / view / present cycles without threads or blocking.
The host (JavaScript) controls the event loop:
- Push events via
StepProgram::push_event. - Advance time via
StepProgram::advance_time. - Call
StepProgram::stepto process one batch of events and render. - Read the rendered buffer via
StepProgram::take_outputs.
§Accessibility
Opt in with StepProgram::with_accessibility. Each rendered frame then
collects the widgets’ accessibility nodes, finalizes hierarchy and focus,
and uses the same diff/announcement policy as the native runtime. A changed
tree invokes Model::on_accessibility after presentation. Mutations and
commands from that hook are rendered on a subsequent host step, never by
recursively rendering inside the callback.
Hosts can read the current tree or bounded text mirror and drain the latest frame’s announcements. This local channel is separate from renderer logs: labels, descriptions and input values are never implicitly logged. A host must forward announcements to its accessibility bridge; this runner does not itself create DOM nodes or deliver operating-system accessibility events.
§Example
use ftui_web::step_program::StepProgram;
use ftui_core::event::Event;
use core::time::Duration;
let mut prog = StepProgram::new(MyModel::default(), 80, 24);
prog.init().unwrap();
// Host-driven frame loop
prog.push_event(Event::Tick).expect("tick admission");
prog.advance_time(Duration::from_millis(16));
let result = prog.step().unwrap();
if result.rendered {
let outputs = prog.take_outputs();
// Send outputs.last_buffer to the renderer...
}Structs§
- Step
Program - Host-driven, non-blocking program runner for WASM.
- Step
Result - Result of a single
StepProgram::stepcall.