Skip to main content

ono/
lib.rs

1//! Beautiful terminal UI components for Ratatui.
2//!
3//! Ono ships themeable, parameterized widgets that drop into an existing
4//! Ratatui app like any other `Widget`. The library is the default path —
5//! the `ono` CLI (`list` / `preview` / `add`) is a helper for discovery and
6//! for users who want to eject the source into their own tree.
7//!
8//! # Quick start
9//!
10//! ```no_run
11//! use std::time::Duration;
12//! use figlet_rs::FIGlet;
13//! use ono::components::splash::{Banner, Splash};
14//! use ono::theme::Theme;
15//! use ratatui::widgets::Widget;
16//! # use ratatui::{buffer::Buffer, layout::Rect};
17//! # let mut buf = Buffer::empty(Rect::new(0, 0, 80, 16));
18//! # let area = buf.area;
19//!
20//! let theme = Theme::Forest;
21//! let font = FIGlet::standard().unwrap();
22//! let banner = Banner::from_text("ono", &font);
23//!
24//! Splash::new(&banner, theme.palette(), theme.knobs())
25//!     .elapsed(Duration::from_millis(1200))
26//!     .render(area, &mut buf);
27//! ```
28//!
29//! # What's in the crate
30//!
31//! - [`theme`] — [`theme::Theme`], [`theme::Palette`] (9 semantic roles),
32//!   [`theme::Knobs`] (animation + behavior).
33//! - [`elements`] — atomic widgets: `box`, `progress`, `spinner`,
34//!   `percentage`, `sparkline`, `typewriter`.
35//! - [`components`] — composites: `splash`, `boot`, `dashboard`,
36//!   `statusbar`, `map`.
37//!
38//! # Themes
39//!
40//! Ono ships four built-in themes — Forest, Retro, Minimal, and Cyber.
41//! Forest is the default and is always built; enable the `theme-retro`,
42//! `theme-minimal`, `theme-cyber`, or `all-themes` cargo features to compile
43//! in the others. Components never branch on theme identity for visual logic
44//! — they pull colors from the palette and behaviour from the knobs.
45//!
46//! # Ejecting to source
47//!
48//! Run `cargo install ono` and then `ono add splash` in your project to copy
49//! a component's source (plus transitive deps and a `theme.rs` you own) into
50//! `./src/ono/`. Ejected code imports only `ratatui` and your own `theme.rs`
51//! — no runtime dependency on this crate.
52//!
53//! # Semver
54//!
55//! The public surface covered by semver is everything under [`theme`],
56//! [`elements`], and [`components`]. The CLI (`cli`) and spec engine
57//! (internal) are not semver-stable.
58//!
59//! # Narrative docs
60//!
61//! Rustdoc covers the API; the repo's `docs/` directory covers the
62//! conceptual side — getting started, theming guide, component catalog,
63//! eject guide.
64//!
65//! <https://github.com/nullorder/ono/tree/main/docs>
66
67#![warn(missing_docs)]
68
69#[doc(hidden)]
70pub mod cli;
71pub mod components;
72pub mod elements;
73pub(crate) mod spec;
74pub mod theme;