tuviv/widgets/mod.rs
1//! # Widgets
2//!
3//! Tuviv comes with many widgets by default and they can be
4//! broadly catagorised into three catagories:
5//!
6//! ## Display Widgets
7//!
8//! These widgets directly render something on screen,
9//! and do not contain children. These include:
10//!
11//! * [`Paragraph`] - renders text
12//! * [`Filler`] - renders text on repeat
13//! * [`ProgressBar`] - renders a progress bar
14//! * [`Char`] - renders a [`prim@char`]
15//! * [`Image`] - displays an image in the terminal (not using kitty/sixel/&c)
16//! Requires the `image` dependency to be enabled.
17//! * [`KittyImage`] - displays an image in the terminal (using kitty)
18//! Requires the `kitty` dependency to be enabled.
19//!
20//! ## Layout Containers
21//!
22//! These containers take multiple children and arrange them nicely:
23//!
24//! * [`Flexbox`] - arranges items simmilar to CSS flexbox
25//! * [`Grid`] - arranges items simmilar to CSS grid
26//! * [`Stack`] - stacks widgets on top of each other
27//!
28//! ## Bin Containers
29//!
30//! These containers take one child. Please note that many of
31//! these widgets can be constructed via builder methods in
32//! [`WidgetExt`](crate::prelude::WidgetExt) for much cleaner
33//! code.
34//!
35//! * [`SizeConstraint`] - mandates a specific size or range of sizes for a child
36//! * [`Align`] - aligns a child, useful for centering
37//! * [`LayoutRecord`] - records the position of a widget
38//! * [`RefWidget`] - stores a child in multiple places
39//! * [`BoxSizing`] - give an item padding, borders and margins
40//! * [`Scroll`] - allows a widget to scroll
41//! * [`Ratio`] - forces a widget to a certain ratio
42//! * [`Cache`] - caches a widget's display at a certain height
43//!
44//! ## Other
45//!
46//! - [`either::Either`] - uses the `either` crate to render either the left
47//! or right widget
48
49/// Flexbox related items
50pub mod flexbox;
51pub use flexbox::Flexbox;
52
53mod size_constraint;
54pub use size_constraint::SizeConstraint;
55
56mod align;
57pub use align::Align;
58
59/// Grid related items
60pub mod grid;
61pub use grid::Grid;
62
63mod char;
64pub use self::char::Char;
65
66mod layout_record;
67pub use layout_record::LayoutRecord;
68
69mod ref_widget;
70pub use ref_widget::RefWidget;
71
72mod paragraph;
73pub use paragraph::Paragraph;
74
75pub mod box_sizing;
76pub use box_sizing::BoxSizing;
77
78mod filler;
79pub use filler::Filler;
80
81mod scroll;
82pub use scroll::*;
83
84mod progress_bar;
85pub use progress_bar::ProgressBar;
86
87mod stack;
88pub use stack::Stack;
89
90#[cfg(feature = "either")]
91mod either;
92
93#[cfg(feature = "image")]
94mod image;
95#[cfg(feature = "image")]
96pub use self::image::Image;
97
98#[cfg(feature = "kitty")]
99mod kitty_image;
100#[cfg(feature = "kitty")]
101pub use kitty_image::*;
102
103mod ratio;
104pub use ratio::Ratio;
105
106pub mod cache;
107pub use cache::Cache;