Native layers
Most apps use widgets and App.
If you need more control, such as your own event loop or your own scene, you can use the modules that App is built on.
The native example runs a scene with only these modules, without the framework. Run it with sh run.sh native.
nativewraps the native library safely:Context,Session,Node, frames, paint recordings, offscreen buffers, edit and text buffers, images, and embedded terminals. Each value keeps what it depends on alive, so you can drop values in any order. None of the types areSend: use each one on the thread that created it.hostruns oneSessionon the local terminal. It sets up the terminal, reads input, handles resizes and Ctrl+Z, writes output, and restores the terminal when it is done. If the program returns an error, panics, or receives SIGTERM, SIGHUP, or SIGINT, the host restores the terminal before the process exits.inputturns terminal bytes into key, mouse, paste, and focus events. It understands UTF-8, legacy and Kitty keyboard sequences, SGR and X10 mouse reports, bracketed paste, and focus reports. Replies from the terminal come out separately. A partial escape sequence ends if its next byte takes more than 20 ms, so a key that starts like a sequence cannot hold up later input. A split UTF-8 character, or a bareESC [that may start a mouse report, waits for the next read instead. For pasted text,decode_paste_bytesdecodes bytes as UTF-8, andstrip_ansi_sequencesremoves escape sequences.termhandles raw mode, the terminal size, signals, and wakeups.styleandlayoutprovide colors, attributes, styled spans, and typed flexbox properties. A color remembers whether it is RGB, a palette index, or the terminal’s default.
Native rendering explains the scene, frames, and resources these modules wrap.