Skip to main content

urushi_tui_app/
lib.rs

1//! A TEA application framework for full-screen Urushi interfaces.
2//!
3//! An application is a value: [`Application`] describes a program, its `Model`
4//! is the state the runtime owns, and its `update` returns an [`Effect`] rather
5//! than performing one. Everything the program wants to hear from — terminal
6//! input included — it declares as a [`Subscription`]. Building those values
7//! reads no terminal and starts no work; the runtime's executor machinery
8//! interprets them behind boundaries that do not appear in application types.
9//!
10//! The framework resolves each application [`urushi::View`] and presents it
11//! through [`urushi_tui::Screen`]. Cell storage, diffing, and transactional
12//! frame commit stay in `urushi-tui`; this crate owns application state,
13//! delivery ordering, effects, subscriptions, drawing policy, terminal input,
14//! and session restoration.
15//!
16//! # Cargo features
17//!
18//! - `crossterm` is enabled by default and provides [`run`] and
19//!   [`Runtime::run`]. Cell-only builds and platforms without the native Unix
20//!   connection use its portable backend; graphics-enabled Unix builds use the
21//!   native bidirectional backend so protocol support can be queried. With
22//!   default features disabled, supply a backend through [`Runtime::backend`].
23//! - `graphics` integrates Kitty or Sixel presentation and re-exports
24//!   `GraphicsPreference` for runtime selection. The runtime retains Kitty
25//!   uploads and caches encoded Sixel bands while redrawing each complete
26//!   Sixel scene. Applications construct image views with a direct
27//!   `urushi-graphics` dependency.
28
29mod application;
30mod core;
31mod delivery;
32mod effect;
33mod entry;
34#[cfg_attr(
35    not(test),
36    expect(dead_code, reason = "wired by the public runtime entry point")
37)]
38pub(crate) mod evaluator;
39#[cfg_attr(
40    not(test),
41    expect(dead_code, reason = "consumed by the runtime core and test harness")
42)]
43mod executor;
44#[cfg_attr(
45    not(test),
46    expect(dead_code, reason = "wired by the public runtime entry point")
47)]
48mod presentation;
49pub(crate) mod renderer;
50mod scheduler;
51mod source;
52mod sources;
53mod subscription;
54#[cfg_attr(
55    not(test),
56    expect(dead_code, reason = "wired by the public runtime entry point")
57)]
58mod terminal_source;
59#[cfg(test)]
60mod testing;
61
62pub use application::Application;
63pub use delivery::{Admission, SendError, Sender};
64pub use effect::Effect;
65#[cfg(feature = "crossterm")]
66pub use entry::run;
67pub use entry::{DefaultTerminal, Error, Runtime};
68pub use executor::{BlockingTask, Clock, Execution, Executor, Task, TokioClock, TokioExecutor};
69pub use source::{
70    CellPixels, FocusChange, Input, KeyCode, KeyEvent, KeyEventState, KeyKind, MediaKeyCode,
71    ModifierKeyCode, Modifiers, MouseButton, MouseEvent, MouseKind, Signal, Surface, SurfaceSize,
72};
73pub use subscription::Subscription;
74#[cfg(feature = "graphics")]
75pub use urushi_graphics::GraphicsPreference;