blizz-ui 2.2.0-dev.1

Self-rendering terminal UI components for the blizz wizard
Documentation
use std::io;
use std::io::Write;
use std::time::Duration;

use rand::rngs::ThreadRng;

pub mod components;

/// Terminal dimensions and timing context shared across all components.
pub struct RenderContext {
  pub terminal_size: Size,
  pub elapsed: Duration,
}

/// A self-rendering UI element.
///
/// Each component owns its visual state (positions, reveal progress, etc.)
/// and knows how to draw itself into a terminal writer. The wizard loop
/// acts as a thin compositor, calling `render` on each component in
/// z-order.
pub trait Component {
  fn render<W: Write>(
    &self,
    writer: &mut W,
    ctx: &RenderContext,
    rng: &mut ThreadRng,
  ) -> io::Result<()>;
}

// Re-exported once utility modules land here in BLIZZ-10.
// For now, pull Size from a local stub so the crate compiles.

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Size {
  pub width: u16,
  pub height: u16,
}