hojicha_rendering/lib.rs
1//! High-performance rendering optimization for the Hojicha TUI framework
2//!
3//! This crate provides differential rendering to minimize terminal updates
4//! by tracking and only redrawing changed regions of the UI.
5//!
6//! # Features
7//!
8//! - **Differential Rendering**: Track dirty regions and only redraw what changed
9//! - **Region Coalescing**: Automatically merge overlapping dirty regions
10//! - **Component Dependencies**: Track component relationships for cascading updates
11//! - **Checksum-based Change Detection**: Detect actual content changes
12//!
13//! # Example
14//!
15//! ```rust
16//! use hojicha_rendering::DifferentialRenderer;
17//! use ratatui::layout::Rect;
18//!
19//! let mut renderer = DifferentialRenderer::new();
20//!
21//! // Register UI components
22//! renderer.register_component("header".to_string(), Rect::new(0, 0, 80, 3));
23//! renderer.register_component("content".to_string(), Rect::new(0, 3, 80, 20));
24//!
25//! // Mark a component as dirty when it changes
26//! renderer.mark_component_dirty("content");
27//!
28//! // Check if rendering is needed
29//! if renderer.component_needs_render("content") {
30//! // Render the component
31//! }
32//! ```
33
34#![warn(missing_docs)]
35
36pub mod algorithms;
37pub mod differential;
38
39// Re-export main types
40pub use differential::{
41 next_version, Checksum, ComponentState, DifferentialConfig, DifferentialRenderer, DirtyRegion,
42 Version,
43};
44
45/// Prelude for convenient imports
46pub mod prelude {
47 pub use crate::differential::{DifferentialConfig, DifferentialRenderer};
48}