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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
//! Scrin is a Rust terminal UI toolkit for building polished command-line
//! interfaces without depending on Ratatui.
//!
//! It provides a Scrin-native rendering model with buffers, colors, rectangles,
//! layout constraints, styled text, widgets, panes, overlays, command palettes,
//! status bars, input routing, terminal lifecycle helpers, and animation glue.
//! The effects layer is powered by [`aisling`](https://crates.io/crates/aisling)
//! and adapts Aisling frames into Scrin buffers, so loaders and text effects can
//! be composed with normal Scrin widgets.
//!
//! # Install
//!
//! ```toml
//! [dependencies]
//! scrin = "0.1.82"
//! ```
//!
//! # Draw A Widget
//!
//! ```rust
//! use scrin::core::buffer::Buffer;
//! use scrin::core::color::Color;
//! use scrin::core::rect::Rect;
//! use scrin::style::Style;
//! use scrin::widgets::block::Block;
//! use scrin::widgets::Widget;
//!
//! let mut buffer = Buffer::new(40, 8);
//! buffer.fill(Rect::new(0, 0, 40, 8), ' ', Color::WHITE, None);
//!
//! let block = Block::bordered()
//! .title("scrin")
//! .border_style(Style::new().fg(Color::CYAN));
//! block.render(&mut buffer, Rect::new(0, 0, 40, 8));
//! ```
//!
//! # Render An Aisling Effect Into A Scrin Buffer
//!
//! ```rust
//! use scrin::core::{buffer::Buffer, rect::Rect};
//! use scrin::effects::{EffectKind, EffectPlayer};
//!
//! let mut buffer = Buffer::new(60, 6);
//! let mut effect = EffectPlayer::new(EffectKind::Matrix, "Scrin + Aisling")
//! .with_size(60, 6)
//! .with_duration(24);
//!
//! effect.render_to_buffer(&mut buffer, Rect::new(0, 0, 60, 6));
//! effect.advance();
//! ```
//!
//! # Render An Aisling Loader
//!
//! ```rust
//! use scrin::core::{buffer::Buffer, rect::Rect};
//! use scrin::effects::{LoaderKind, LoaderPlayer};
//!
//! let mut buffer = Buffer::new(48, 4);
//! let loader = LoaderPlayer::new(LoaderKind::Bar)
//! .with_size(48, 4)
//! .with_label("indexing".to_string());
//! let progress = LoaderPlayer::progress_from_fraction(0.42);
//!
//! loader.render(3, progress, &mut buffer, Rect::new(0, 0, 48, 4));
//! ```
//!
//! # Terminal Rendering
//!
//! [`Terminal::draw`] uses Scrin's diff presenter and updates only changed
//! cells. [`Terminal::draw_full`] is available when an application wants a full
//! buffer repaint every frame, for example during dense animation.
//!
//! # Re-Exports
//!
//! Common Aisling selector/config types are re-exported from [`effects`] so a
//! Scrin application can choose effects and loaders through one crate path.
//!
//! # Performance APIs
//!
//! Larger Scrin applications can use [`widgets::ScrollableText`] for retained
//! styled-text wrapping, [`widgets::RetainedMarkdownOutput`] for cached Markdown
//! rows, retained Aisling widgets through [`effects::RetainedEffectWidget`] and
//! [`effects::RetainedLoaderWidget`], dirty-rectangle presentation through
//! [`Terminal::present_areas`], strategy-based drawing through
//! [`Terminal::draw_with_present_strategy`], cursor-preserving area draws through
//! [`Terminal::draw_area_preserve_cursor_timed`], frame diagnostics through
//! [`FrameTiming`] / [`FrameDiagnostic`] / [`NamedFrameTiming`], and shared widget
//! roles through [`ThemeTokens`]. Retained Aisling hot paths can use
//! [`effects::RetainedEffectWidget::render_frame_into`] and
//! [`effects::RetainedEffectWidget::render_cached_only`] to avoid mutating widget
//! state or doing unexpected cache rebuild work.
//!
//! # Application Validation
//!
//! Full-screen applications should pair Scrin's crate-level tests with app-level
//! pseudo-terminal captures for frame output, prompt input, overlays, provider
//! setup, and terminal restore paths. A real-terminal visual pass is still useful
//! for subjective clipping, spacing, contrast, and animation pacing.
//!
pub use Timeline;
pub use CommandPalette;
pub use Buffer;
pub use Color;
pub use Rect;
pub use ;
pub use FlowManager;
pub use EventRouter;
pub use Layout;
pub use ;
pub use ;
pub use ;
pub use StatusBar;
pub use Style;
pub use ;
pub use TextExpander;
pub use ;