ratatui_zonekit/lib.rs
1//! Extensible zone and plugin rendering system for [ratatui](https://ratatui.rs).
2//!
3//! `ratatui-zonekit` lets plugins **own** UI zones in a ratatui application.
4//! Plugins declare what they need (tabs, panels, overlays), and the host
5//! application decides where and how to render them.
6//!
7//! # Design Principles
8//!
9//! - **Request, don't mutate**: plugins request zones, the host approves.
10//! - **Safe delegation**: plugin renders are wrapped in `catch_unwind`.
11//! - **Theme-agnostic**: works with any styling system (themekit, raw Style, custom).
12//! - **Model B**: plugins declare intent, host renders. Plugins never touch `Frame`.
13//!
14//! # Quick Start
15//!
16//! ```rust
17//! use ratatui_zonekit::{ZonePlugin, ZoneId, RenderContext};
18//! use ratatui::buffer::Buffer;
19//! use ratatui::layout::Rect;
20//!
21//! struct MyPlugin;
22//!
23//! impl ZonePlugin for MyPlugin {
24//! fn id(&self) -> &str { "my-plugin" }
25//! fn render(&self, _zone_id: ZoneId, _ctx: &RenderContext, area: Rect, buf: &mut Buffer) -> bool {
26//! use ratatui::widgets::{Paragraph, Widget};
27//! Paragraph::new("Hello from plugin!").render(area, buf);
28//! true
29//! }
30//! }
31//! ```
32
33mod plugin;
34mod registry;
35mod render;
36mod zone;
37
38pub use plugin::{RenderContext, ZoneEvent, ZonePlugin};
39pub use registry::{RegistrationResult, ZoneRegistry};
40pub use render::SafeRenderer;
41pub use zone::{ZoneHint, ZoneId, ZoneRequest, ZoneSpec};