1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//! cornichon — composable TUI menu patterns themed after Claude Code, Codex, and Grok.
//!
//! cornichon is a Rust library that ports the menu patterns used by the
//! major AI coding CLIs to [`ratatui`]. The five widget types
//! ([`SlashMenu`], [`SelectMenu`], [`PermissionPrompt`], [`ProjectPicker`],
//! [`ShortcutsModal`]) ship as builders and render via the standard
//! `frame.render_widget_ref(&menu, area)` call — no ratatui knowledge
//! required at the consumer site beyond passing the area.
//!
//! The visual designs are taken from the [`brainless`] shadcn registry
//! (Claude / Codex / Grok UIs). Three themes ship with the crate as
//! [`CLAUDE`], [`CODEX`], and [`GROK`]; custom themes are struct literals.
//!
//! [`ratatui`]: https://ratatui.rs
//! [`brainless`]: https://brainless.swerdlow.dev
//!
//! # Quickstart
//!
//! ```rust,no_run
//! use cornichon::prelude::*;
//! use cornichon::ports::{KeyCode, KeyEvent, KeyModifiers};
//!
//! let mut menu = SlashMenu::with_defaults()?;
//! // ... drive menu.update(KeyEvent) in your event loop ...
//! # Ok::<(), cornichon::Error>(())
//! ```
//!
//! # Architecture
//!
//! Internal layout follows the project's
//! [`src/{domain,ports,application,adapters}`] standard
//! (see [`AGENTS.md`](https://github.com/greysquirr3l/cornichon/blob/main/AGENTS.md) for the full discussion):
//!
//! - [`domain`]: pure value objects ([`MenuItem`], [`Theme`], [`Selection`],
//! [`MenuAction`], [`Error`]). No `ratatui`, no `crossterm`.
//! - [`ports`]: type re-exports so consumers don't need a direct
//! `ratatui` / `crossterm` dependency to type-annotate handlers.
//! - [`application`]: per-menu state machines (`update` → [`MenuAction`]).
//! Total: invalid events are [`MenuAction::None`], not `Result::Err`.
//! - [`adapters`]: ratatui `WidgetRef` impls for each menu type.
//!
//! # Conventions
//!
//! - `update` is **total**: every event produces a [`MenuAction`]. There
//! is no `Result` return path because menus cannot be in an invalid
//! state.
//! - Builders consume `self` and return `Self` (true builder pattern).
//! - The only place `Result` appears in the public API is at the
//! construction boundary (`build()`), where parsed input is funneled
//! through [`TryFrom`].
//!
//! [`src/{domain,ports,application,adapters}`]: ./index.html#architecture
pub use ;
pub use ;
pub use ;
/// Convenient re-exports for the most common cornichon types.
///
/// ```rust,ignore
/// use cornichon::prelude::*;
/// ```