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
//! A status-line widget that can stack up indicators
//! on the left and right end.
//!
//! If you use the constants SLANT_TL_BR and SLANT_BL_TR as
//! separator you can do neo-vim/neovim style statusline.
//!
//! This is adapted from rat-widget's StatusLineStacked.
//!
//! # Example
//!
//! ```rust,no_run
//! use ratatui::style::{Color, Style};
//! use ratatui::text::Span;
//! use ratatui_toolkit::statusline_stacked::{StatusLineStacked, SLANT_BL_TR, SLANT_TL_BR};
//!
//! StatusLineStacked::new()
//! .start(
//! Span::from(" STATUS ").style(Style::new().fg(Color::Black).bg(Color::DarkGray)),
//! Span::from(SLANT_TL_BR).style(Style::new().fg(Color::DarkGray).bg(Color::Green)),
//! )
//! .start(
//! Span::from(" OPERATIONAL ").style(Style::new().fg(Color::Black).bg(Color::Green)),
//! Span::from(SLANT_TL_BR).style(Style::new().fg(Color::Green)),
//! )
//! .center("Some status message...")
//! .end(
//! Span::from(" INFO ").style(Style::new().fg(Color::Black).bg(Color::Cyan)),
//! Span::from(SLANT_BL_TR).style(Style::new().fg(Color::Cyan)),
//! );
//! ```
use Style;
use Line;
use PhantomData;
/// PowerLine block cut at the diagonal (top-left to bottom-right).
/// Requires a Nerd Font or PowerLine font.
pub const SLANT_TL_BR: &str = "\u{e0b8}";
/// PowerLine block cut at the diagonal (bottom-left to top-right).
/// Requires a Nerd Font or PowerLine font.
pub const SLANT_BL_TR: &str = "\u{e0ba}";
/// Statusline with stacked indicators on the left and right side.
///
/// This widget creates a statusline with a "stacked" appearance using
/// PowerLine-style diagonal separators. It has three sections:
/// - Left: Stack indicators from left to right
/// - Center: Centered status message
/// - Right: Stack indicators from right to left
/// Operational mode for styled statusline
/// Builder for creating a styled statusline that looks like rat-salsa's menu_status2.
///
/// This provides a pre-configured statusline with the "Westinghouse" reactor-control aesthetic.