Expand description
§Envision
A ratatui framework for collaborative TUI development with headless testing support.
Envision provides a custom CaptureBackend that implements ratatui’s Backend trait,
enabling you to:
- Capture rendered frames as inspectable text or structured data
- Track frame history and compute diffs between renders
- Annotate widgets with semantic information
- Simulate user input for testing
- Run applications in headless mode for CI/testing
§Quick Start
use envision::backend::CaptureBackend;
use ratatui::Terminal;
use ratatui::widgets::Paragraph;
// Create a headless terminal
let backend = CaptureBackend::new(80, 24);
let mut terminal = Terminal::new(backend).unwrap();
// Render something
terminal.draw(|frame| {
frame.render_widget(Paragraph::new("Hello, Envision!"), frame.area());
}).unwrap();
// Capture the output
let output = terminal.backend().to_string();
println!("{}", output);§Input Simulation
use envision::input::{EventQueue, KeyCode};
let mut queue = EventQueue::new();
queue.type_str("hello");
queue.enter();
// Events can be consumed by your app's event loop
while let Some(event) = queue.pop() {
// handle event...
}Re-exports§
pub use adapter::DualBackend;pub use annotation::Annotate;pub use annotation::Annotation;pub use annotation::AnnotationRegistry;pub use annotation::WidgetType;pub use app::App;pub use app::AsyncCommandHandler;pub use app::AsyncRuntime;pub use app::AsyncRuntimeConfig;pub use app::Command;pub use app::DebounceSubscription;pub use app::FilterSubscription;pub use app::IntervalImmediateSubscription;pub use app::Runtime;pub use app::RuntimeConfig;pub use app::Subscription;pub use app::SubscriptionExt;pub use app::TakeSubscription;pub use app::TerminalEventSubscription;pub use app::ThrottleSubscription;pub use app::TickSubscription;pub use app::TimerSubscription;pub use backend::CaptureBackend;pub use backend::EnhancedCell;pub use backend::FrameSnapshot;pub use component::Component;pub use component::Focusable;pub use component::InputField;pub use component::InputFieldState;pub use component::InputMessage;pub use component::InputOutput;pub use component::ListMessage;pub use component::ListOutput;pub use component::SelectableList;pub use component::SelectableListState;pub use component::Toggleable;pub use harness::Assertion;pub use harness::AsyncTestHarness;pub use harness::Snapshot;pub use harness::TestHarness;pub use input::EventQueue;pub use input::SimulatedEvent;
Modules§
- adapter
- Dual adapter for simultaneous real and capture backends.
- annotation
- Widget annotation system for semantic UI understanding.
- app
- TEA (The Elm Architecture) application framework.
- backend
- Backend module providing the
CaptureBackendimplementation. - component
- Composable UI components for TUI applications.
- harness
- Test harness for headless TUI testing.
- input
- Input simulation module for programmatic event injection.
- prelude
- Prelude module for convenient imports