Expand description
Terminal backend for Presentar UI framework.
This crate bridges presentar_core abstractions (Canvas, Widget, Brick) to
the terminal using crossterm directly.
§Architecture (PROBAR-SPEC-009)
The crate follows the Brick Architecture from PROBAR-SPEC-009:
- All widgets implement
Bricktrait (tests define interface) - Jidoka gate prevents rendering if assertions fail
- Performance budgets are enforced
- Zero-allocation steady-state rendering via direct crossterm backend
§Example
ⓘ
use presentar_terminal::{TuiApp, TuiConfig};
use presentar_core::{Brick, Widget};
// Create your root widget (must implement Widget + Brick)
let root = MyRootWidget::new();
// Run the application
TuiApp::new(root)?.run()?;§Design Principles Enforcement
This library enforces strict adherence to design principles (Tufte, Popper, Nielsen).
The following include_str! ensures that the design principles test suite exists at compile time.
Re-exports§
pub use direct::Cell;pub use direct::CellBuffer;pub use direct::DiffRenderer;pub use direct::DirectTerminalCanvas;pub use direct::Modifiers;pub use theme::Gradient;pub use theme::Theme;pub use widgets::truncate;pub use widgets::Axis;pub use widgets::BarStyle;pub use widgets::BinStrategy;pub use widgets::Border;pub use widgets::BorderStyle;pub use widgets::BoxPlot;pub use widgets::BoxStats;pub use widgets::BrailleGraph;pub use widgets::ColumnHighlight;pub use widgets::CompactBreakdown;pub use widgets::ConfusionMatrix;pub use widgets::CpuGrid;pub use widgets::Cursor;pub use widgets::CurveData;pub use widgets::CurveMode;pub use widgets::EmaConfig;pub use widgets::EmptyState;pub use widgets::FocusRing;pub use widgets::ForceGraph;pub use widgets::ForceParams;pub use widgets::Gauge;pub use widgets::GaugeMode;pub use widgets::GraphEdge;pub use widgets::GraphMode;pub use widgets::GraphNode;pub use widgets::HealthStatus;pub use widgets::HeatBarStyle;pub use widgets::HeatScheme;pub use widgets::Heatmap;pub use widgets::HeatmapCell;pub use widgets::HeatmapPalette;pub use widgets::Histogram;pub use widgets::HistogramOrientation;pub use widgets::HorizonGraph;pub use widgets::HorizonScheme;pub use widgets::HugePages;pub use widgets::LegendPosition;pub use widgets::LineChart;pub use widgets::LineStyle;pub use widgets::LossCurve;pub use widgets::LossSeries;pub use widgets::MarkerStyle;pub use widgets::MatrixPalette;pub use widgets::MemoryBar;pub use widgets::MemorySegment;pub use widgets::Meter;pub use widgets::MicroHeatBar;pub use widgets::MultiBarGraph;pub use widgets::MultiBarMode;pub use widgets::NetworkInterface;pub use widgets::NetworkPanel;pub use widgets::NodeId;pub use widgets::Normalization;pub use widgets::Orientation;pub use widgets::ProcessEntry;pub use widgets::ProcessSort;pub use widgets::ProcessState;pub use widgets::ProcessTable;pub use widgets::RocPrCurve;pub use widgets::RowHighlight;pub use widgets::ScatterAxis;pub use widgets::ScatterPlot;pub use widgets::Segment;pub use widgets::SegmentedMeter;pub use widgets::Series;pub use widgets::Simplification;pub use widgets::Sparkline;pub use widgets::Table;pub use widgets::TitleBar;pub use widgets::TitleBarPosition;pub use widgets::TitleBarStyle;pub use widgets::Tree;pub use widgets::TreeNode;pub use widgets::Treemap;pub use widgets::TreemapLayout;pub use widgets::TreemapNode;pub use widgets::TrendDirection;pub use widgets::ViolinData;pub use widgets::ViolinOrientation;pub use widgets::ViolinPlot;pub use widgets::ViolinStats;pub use widgets::DIMMED_BG;pub use widgets::SELECTION_ACCENT;pub use widgets::SELECTION_BG;pub use widgets::SELECTION_GUTTER;pub use random_seed::get_seed;pub use random_seed::init_from_env;pub use random_seed::set_global_seed;pub use random_seed::with_seed;pub use random_seed::SeededRng;pub use random_seed::DEFAULT_SEED;pub use compute_block::ComputeBlock;pub use compute_block::ComputeBlockId;pub use compute_block::CpuFrequencyBlock;pub use compute_block::CpuGovernor;pub use compute_block::CpuGovernorBlock;pub use compute_block::FrequencyScalingState;pub use compute_block::GpuThermalBlock;pub use compute_block::GpuThermalState;pub use compute_block::GpuVramBlock;pub use compute_block::HugePagesBlock;pub use compute_block::LoadTrendBlock;pub use compute_block::MemPressureBlock;pub use compute_block::MemoryPressureLevel;pub use compute_block::SimdInstructionSet;pub use compute_block::SparklineBlock;pub use compute_block::TrendDirection as ComputeTrendDirection;
Modules§
- cli
- CLI utilities for simple terminal output.
- compute_
block ComputeBlock: SIMD-optimized panel element trait- direct
- Direct terminal backend (PROBAR-SPEC-009 compliant).
- perf_
trace - Performance tracing for ptop
ComputeBlocks - random_
seed - Random Seed Management
- seed
- Random Seed Management for Reproducible Testing
- theme
- Theme system with CIELAB perceptual gradients.
- tools
- Tools for TUI comparison, verification, and benchmarking.
- widgets
- Standard terminal widgets implementing Brick + Widget traits.
Structs§
- Brick
Budget - Performance budget for a brick.
- Brick
Verification - Result of verifying brick assertions
- Color
- RGBA color with values in the range [0.0, 1.0].
- Constraints
- Layout constraints that specify minimum and maximum sizes.
- Input
Handler - Input handler for converting crossterm events to presentar events.
- KeyBinding
- Key binding configuration.
- Point
- A 2D point with x and y coordinates.
- QaTimings
- QA timing diagnostics for non-blocking UI verification.
- Rect
- A rectangle defined by position and size.
- Size
- A 2D size with width and height.
- Text
Style - Text style for rendering.
- TuiApp
- Main TUI application runner.
- TuiConfig
- Configuration for the TUI application.
Enums§
- Brick
Assertion - Brick assertion that must be verified at runtime.
- Color
Mode - Terminal color capability mode.
- TuiError
- Errors that can occur in the TUI application.
Traits§
- Async
Collector - Background collector that produces snapshots.
- Brick
- Core Brick trait - the foundation of the Brick Architecture.
- Canvas
- Canvas trait for paint operations.
- Snapshot
- Snapshot of collected metrics, transportable via channel.
- Snapshot
Receiver - Application that can apply snapshots to update its state.
- Widget
- Core widget trait that all UI elements implement.