@akiojin/gwt 9.0.4 → 9.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.ja.md +106 -146
  2. package/README.md +103 -143
  3. package/bin/gwt.cjs +1 -1
  4. package/package.json +5 -5
  5. package/rustfmt.toml +0 -2
  6. package/scripts/check-release-flow.sh +2 -8
  7. package/scripts/postinstall.js +17 -7
  8. package/scripts/run-local-backend-tests-on-commit.sh +6 -12
  9. package/scripts/test-all.sh +1 -5
  10. package/scripts/check-e2e-coverage-threshold.mjs +0 -238
  11. package/scripts/run-local-e2e-coverage-on-commit.sh +0 -69
  12. package/scripts/run-local-e2e-on-commit.sh +0 -60
  13. package/scripts/verify-ci-node-toolchain.sh +0 -76
  14. package/scripts/voice-eval.sh +0 -48
  15. package/vendor/ratatui-core/src/backend/test.rs +0 -1077
  16. package/vendor/ratatui-core/src/backend.rs +0 -405
  17. package/vendor/ratatui-core/src/buffer/assert.rs +0 -71
  18. package/vendor/ratatui-core/src/buffer/buffer.rs +0 -1388
  19. package/vendor/ratatui-core/src/buffer/cell.rs +0 -377
  20. package/vendor/ratatui-core/src/buffer.rs +0 -9
  21. package/vendor/ratatui-core/src/layout/alignment.rs +0 -89
  22. package/vendor/ratatui-core/src/layout/constraint.rs +0 -526
  23. package/vendor/ratatui-core/src/layout/direction.rs +0 -63
  24. package/vendor/ratatui-core/src/layout/flex.rs +0 -212
  25. package/vendor/ratatui-core/src/layout/layout.rs +0 -2838
  26. package/vendor/ratatui-core/src/layout/margin.rs +0 -79
  27. package/vendor/ratatui-core/src/layout/offset.rs +0 -66
  28. package/vendor/ratatui-core/src/layout/position.rs +0 -253
  29. package/vendor/ratatui-core/src/layout/rect/iter.rs +0 -356
  30. package/vendor/ratatui-core/src/layout/rect/ops.rs +0 -136
  31. package/vendor/ratatui-core/src/layout/rect.rs +0 -1114
  32. package/vendor/ratatui-core/src/layout/size.rs +0 -147
  33. package/vendor/ratatui-core/src/layout.rs +0 -333
  34. package/vendor/ratatui-core/src/lib.rs +0 -82
  35. package/vendor/ratatui-core/src/style/anstyle.rs +0 -348
  36. package/vendor/ratatui-core/src/style/color.rs +0 -788
  37. package/vendor/ratatui-core/src/style/palette/material.rs +0 -608
  38. package/vendor/ratatui-core/src/style/palette/tailwind.rs +0 -653
  39. package/vendor/ratatui-core/src/style/palette.rs +0 -6
  40. package/vendor/ratatui-core/src/style/palette_conversion.rs +0 -82
  41. package/vendor/ratatui-core/src/style/stylize.rs +0 -668
  42. package/vendor/ratatui-core/src/style.rs +0 -1069
  43. package/vendor/ratatui-core/src/symbols/bar.rs +0 -51
  44. package/vendor/ratatui-core/src/symbols/block.rs +0 -51
  45. package/vendor/ratatui-core/src/symbols/border.rs +0 -709
  46. package/vendor/ratatui-core/src/symbols/braille.rs +0 -21
  47. package/vendor/ratatui-core/src/symbols/half_block.rs +0 -3
  48. package/vendor/ratatui-core/src/symbols/line.rs +0 -259
  49. package/vendor/ratatui-core/src/symbols/marker.rs +0 -82
  50. package/vendor/ratatui-core/src/symbols/merge.rs +0 -748
  51. package/vendor/ratatui-core/src/symbols/pixel.rs +0 -30
  52. package/vendor/ratatui-core/src/symbols/scrollbar.rs +0 -46
  53. package/vendor/ratatui-core/src/symbols/shade.rs +0 -5
  54. package/vendor/ratatui-core/src/symbols.rs +0 -15
  55. package/vendor/ratatui-core/src/terminal/frame.rs +0 -192
  56. package/vendor/ratatui-core/src/terminal/terminal.rs +0 -926
  57. package/vendor/ratatui-core/src/terminal/viewport.rs +0 -58
  58. package/vendor/ratatui-core/src/terminal.rs +0 -40
  59. package/vendor/ratatui-core/src/text/grapheme.rs +0 -84
  60. package/vendor/ratatui-core/src/text/line.rs +0 -1678
  61. package/vendor/ratatui-core/src/text/masked.rs +0 -149
  62. package/vendor/ratatui-core/src/text/span.rs +0 -904
  63. package/vendor/ratatui-core/src/text/text.rs +0 -1434
  64. package/vendor/ratatui-core/src/text.rs +0 -64
  65. package/vendor/ratatui-core/src/widgets/stateful_widget.rs +0 -193
  66. package/vendor/ratatui-core/src/widgets/widget.rs +0 -174
  67. package/vendor/ratatui-core/src/widgets.rs +0 -9
@@ -1,147 +0,0 @@
1
- #![warn(missing_docs)]
2
- use core::fmt;
3
-
4
- use crate::layout::Rect;
5
-
6
- /// A simple size struct for representing dimensions in the terminal.
7
- ///
8
- /// The width and height are stored as `u16` values and represent the number of columns and rows
9
- /// respectively. This is used throughout the layout system to represent dimensions of rectangular
10
- /// areas and other layout elements.
11
- ///
12
- /// Size can be created from tuples, extracted from rectangular areas, or constructed directly.
13
- /// It's commonly used in conjunction with [`Position`](crate::layout::Position) to define
14
- /// rectangular areas.
15
- ///
16
- /// # Construction
17
- ///
18
- /// - [`new`](Self::new) - Create a new size from width and height
19
- /// - [`default`](Default::default) - Create with zero dimensions
20
- ///
21
- /// # Conversion
22
- ///
23
- /// - [`from((u16, u16))`](Self::from) - Create from `(u16, u16)` tuple
24
- /// - [`from(Rect)`](Self::from) - Create from [`Rect`] (uses width and height)
25
- /// - [`into((u16, u16))`] - Convert to `(u16, u16)` tuple
26
- ///
27
- /// # Computation
28
- ///
29
- /// - [`area`](Self::area) - Compute the total number of cells covered by the size
30
- ///
31
- /// # Examples
32
- ///
33
- /// ```rust
34
- /// use ratatui_core::layout::{Rect, Size};
35
- ///
36
- /// let size = Size::new(80, 24);
37
- /// assert_eq!(size.area(), 1920);
38
- /// let size = Size::from((80, 24));
39
- /// let size = Size::from(Rect::new(0, 0, 80, 24));
40
- /// assert_eq!(size.area(), 1920);
41
- /// ```
42
- ///
43
- /// For comprehensive layout documentation and examples, see the [`layout`](crate::layout) module.
44
- #[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash)]
45
- #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
46
- pub struct Size {
47
- /// The width in columns
48
- pub width: u16,
49
- /// The height in rows
50
- pub height: u16,
51
- }
52
-
53
- impl Size {
54
- /// A zero sized Size
55
- pub const ZERO: Self = Self::new(0, 0);
56
-
57
- /// The minimum possible Size
58
- pub const MIN: Self = Self::ZERO;
59
-
60
- /// The maximum possible Size
61
- pub const MAX: Self = Self::new(u16::MAX, u16::MAX);
62
-
63
- /// Create a new `Size` struct
64
- pub const fn new(width: u16, height: u16) -> Self {
65
- Self { width, height }
66
- }
67
-
68
- /// Compute the total area of the size as a `u32`.
69
- ///
70
- /// The multiplication uses `u32` to avoid overflow when the width and height are at their
71
- /// `u16` maximum values.
72
- pub const fn area(self) -> u32 {
73
- self.width as u32 * self.height as u32
74
- }
75
- }
76
-
77
- impl From<(u16, u16)> for Size {
78
- fn from((width, height): (u16, u16)) -> Self {
79
- Self { width, height }
80
- }
81
- }
82
-
83
- impl From<Size> for (u16, u16) {
84
- fn from(size: Size) -> Self {
85
- (size.width, size.height)
86
- }
87
- }
88
-
89
- impl From<Rect> for Size {
90
- fn from(rect: Rect) -> Self {
91
- rect.as_size()
92
- }
93
- }
94
-
95
- impl fmt::Display for Size {
96
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
97
- write!(f, "{}x{}", self.width, self.height)
98
- }
99
- }
100
-
101
- #[cfg(test)]
102
- mod tests {
103
- use alloc::string::ToString;
104
-
105
- use super::*;
106
-
107
- #[test]
108
- fn new() {
109
- let size = Size::new(10, 20);
110
- assert_eq!(size.width, 10);
111
- assert_eq!(size.height, 20);
112
- }
113
-
114
- #[test]
115
- fn from_tuple() {
116
- let size = Size::from((10, 20));
117
- assert_eq!(size.width, 10);
118
- assert_eq!(size.height, 20);
119
- }
120
-
121
- #[test]
122
- fn to_tuple() {
123
- let size = Size::from((10, 20));
124
- let (width, height) = size.into();
125
- assert_eq!(size.width, width);
126
- assert_eq!(size.height, height);
127
- }
128
-
129
- #[test]
130
- fn from_rect() {
131
- let size = Size::from(Rect::new(0, 0, 10, 20));
132
- assert_eq!(size.width, 10);
133
- assert_eq!(size.height, 20);
134
- }
135
-
136
- #[test]
137
- fn display() {
138
- assert_eq!(Size::new(10, 20).to_string(), "10x20");
139
- }
140
-
141
- #[test]
142
- fn area() {
143
- assert_eq!(Size::new(10, 20).area(), 200);
144
- assert_eq!(Size::new(0, 0).area(), 0);
145
- assert_eq!(Size::new(u16::MAX, u16::MAX).area(), 4_294_836_225_u32);
146
- }
147
- }
@@ -1,333 +0,0 @@
1
- #![warn(clippy::missing_const_for_fn)]
2
- //! Layout and positioning in terminal user interfaces.
3
- //!
4
- //! This module provides a comprehensive set of types and traits for working with layout and
5
- //! positioning in terminal applications. It implements a flexible layout system that allows you to
6
- //! divide the terminal screen into different areas using constraints, manage positioning and
7
- //! sizing, and handle complex UI arrangements.
8
- //!
9
- //! The layout system in Ratatui is based on the Cassowary constraint solver algorithm, implemented
10
- //! through the [`kasuari`] crate. This allows for sophisticated constraint-based layouts where
11
- //! multiple requirements can be satisfied simultaneously, with priorities determining which
12
- //! constraints take precedence when conflicts arise.
13
- //!
14
- //! [`kasuari`]: https://crates.io/crates/kasuari
15
- //!
16
- //! # Core Concepts
17
- //!
18
- //! ## Coordinate System
19
- //!
20
- //! The coordinate system runs left to right, top to bottom, with the origin `(0, 0)` in the top
21
- //! left corner of the terminal. The x and y coordinates are represented by `u16` values.
22
- //!
23
- //! ```text
24
- //! x (columns)
25
- //! ┌─────────────→
26
- //! y │ (0,0)
27
- //! │
28
- //! (rows)
29
- //! ↓
30
- //! ```
31
- //!
32
- //! ## Layout Fundamentals
33
- //!
34
- //! Layouts form the structural foundation of your terminal UI. The [`Layout`] struct divides
35
- //! available screen space into rectangular areas using a constraint-based approach. You define
36
- //! multiple constraints for how space should be allocated, and the Cassowary solver determines
37
- //! the optimal layout that satisfies as many constraints as possible. These areas can then be
38
- //! used to render widgets or nested layouts.
39
- //!
40
- //! Note that the [`Layout`] struct is not required to create layouts - you can also manually
41
- //! calculate and create [`Rect`] areas using simple mathematics to divide up the terminal space
42
- //! if you prefer direct control over positioning and sizing.
43
- //!
44
- //! ## Rectangular Areas
45
- //!
46
- //! All layout operations work with rectangular areas represented by the [`Rect`] type. A [`Rect`]
47
- //! defines a position and size in the terminal, specified by its top-left corner coordinates and
48
- //! dimensions.
49
- //!
50
- //! # Available Types
51
- //!
52
- //! ## Core Layout Types
53
- //!
54
- //! - [`Layout`] - The primary layout engine that divides space using constraints and direction
55
- //! - [`Rect`] - Represents a rectangular area with position and dimensions
56
- //! - [`Constraint`] - Defines how space should be allocated (length, percentage, ratio, etc.)
57
- //! - [`Direction`] - Specifies layout orientation (horizontal or vertical)
58
- //! - [`Flex`] - Controls space distribution when constraints are satisfied
59
- //!
60
- //! ## Positioning and Sizing
61
- //!
62
- //! - [`Position`] - Represents a point in the terminal coordinate system
63
- //! - [`Size`] - Represents dimensions (width and height)
64
- //! - [`Margin`] - Defines spacing around rectangular areas
65
- //! - [`Offset`] - Represents relative movement in the coordinate system
66
- //! - [`Spacing`] - Controls spacing or overlap between layout segments
67
- //!
68
- //! ## Alignment
69
- //!
70
- //! - [`Alignment`] (alias for [`HorizontalAlignment`]) - Horizontal text/content alignment
71
- //! - [`HorizontalAlignment`] - Horizontal alignment options (left, center, right)
72
- //! - [`VerticalAlignment`] - Vertical alignment options (top, center, bottom)
73
- //!
74
- //! ## Iteration Support
75
- //!
76
- //! - [`Rows`] - Iterator over horizontal rows within a rectangular area
77
- //! - [`Columns`] - Iterator over vertical columns within a rectangular area
78
- //! - [`Positions`] - Iterator over all positions within a rectangular area
79
- //!
80
- //! # Quick Start
81
- //!
82
- //! Here's a simple example of creating a basic layout using the [`Layout`] struct:
83
- //!
84
- //! ```rust
85
- //! use ratatui_core::layout::{Constraint, Direction, Layout, Rect};
86
- //!
87
- //! // Create a terminal area
88
- //! let area = Rect::new(0, 0, 80, 24);
89
- //!
90
- //! // Divide it vertically into two equal parts using Layout
91
- //! let layout = Layout::vertical([Constraint::Percentage(50), Constraint::Percentage(50)]);
92
- //! let [top, bottom] = layout.areas(area);
93
- //!
94
- //! // Now you have two areas: top and bottom
95
- //! ```
96
- //!
97
- //! **Note**: When the number of layout areas is known at compile time, use destructuring
98
- //! assignment with descriptive variable names for better readability:
99
- //!
100
- //! ```rust
101
- //! use ratatui_core::layout::{Constraint, Layout, Rect};
102
- //!
103
- //! let area = Rect::new(0, 0, 80, 24);
104
- //! let [header, content, footer] = Layout::vertical([
105
- //! Constraint::Length(3),
106
- //! Constraint::Fill(1),
107
- //! Constraint::Length(1),
108
- //! ])
109
- //! .areas(area);
110
- //! ```
111
- //!
112
- //! Use [`Layout::split`] when the number of areas is only known at runtime.
113
- //!
114
- //! Alternatively, you can create layouts manually using mathematics:
115
- //!
116
- //! ```rust
117
- //! use ratatui_core::layout::Rect;
118
- //!
119
- //! // Create a terminal area
120
- //! let area = Rect::new(0, 0, 80, 24);
121
- //!
122
- //! // Manually divide into two equal parts
123
- //! let top_half = Rect::new(area.x, area.y, area.width, area.height / 2);
124
- //! let bottom_half = Rect::new(
125
- //! area.x,
126
- //! area.y + area.height / 2,
127
- //! area.width,
128
- //! area.height / 2,
129
- //! );
130
- //! ```
131
- //!
132
- //! # Layout Examples
133
- //!
134
- //! ## Basic Vertical Split
135
- //!
136
- //! ```rust
137
- //! use ratatui_core::layout::{Constraint, Layout, Rect};
138
- //!
139
- //! let area = Rect::new(0, 0, 80, 24);
140
- //! let [header, content, footer] = Layout::vertical([
141
- //! Constraint::Length(3), // Header: fixed height
142
- //! Constraint::Fill(1), // Content: flexible
143
- //! Constraint::Length(1), // Footer: fixed height
144
- //! ])
145
- //! .areas(area);
146
- //! ```
147
- //!
148
- //! ## Horizontal Sidebar Layout
149
- //!
150
- //! ```rust
151
- //! use ratatui_core::layout::{Constraint, Layout, Rect};
152
- //!
153
- //! let area = Rect::new(0, 0, 80, 24);
154
- //! let [sidebar, main] = Layout::horizontal([
155
- //! Constraint::Length(20), // Sidebar: fixed width
156
- //! Constraint::Fill(1), // Main content: flexible
157
- //! ])
158
- //! .areas(area);
159
- //! ```
160
- //!
161
- //! ## Complex Nested Layout
162
- //!
163
- //! ```rust
164
- //! use ratatui_core::layout::{Constraint, Layout, Rect};
165
- //!
166
- //! fn create_complex_layout(area: Rect) -> [Rect; 4] {
167
- //! // First, split vertically
168
- //! let [header, body, footer] = Layout::vertical([
169
- //! Constraint::Length(3), // Header
170
- //! Constraint::Fill(1), // Body
171
- //! Constraint::Length(1), // Footer
172
- //! ])
173
- //! .areas(area);
174
- //!
175
- //! // Then split the body horizontally
176
- //! let [sidebar, main] = Layout::horizontal([
177
- //! Constraint::Length(20), // Sidebar
178
- //! Constraint::Fill(1), // Main
179
- //! ])
180
- //! .areas(body);
181
- //!
182
- //! [header, sidebar, main, footer]
183
- //! }
184
- //! ```
185
- //!
186
- //! # Working with Constraints
187
- //!
188
- //! [`Constraint`]s define how space is allocated within a layout using the Cassowary constraint
189
- //! solver algorithm. The constraint solver attempts to satisfy all constraints simultaneously,
190
- //! with priorities determining which constraints take precedence when conflicts arise. Different
191
- //! constraint types serve different purposes:
192
- //!
193
- //! - [`Constraint::Min`] - Minimum size constraint
194
- //! - [`Constraint::Max`] - Maximum size constraint
195
- //! - [`Constraint::Length`] - Fixed size in character cells
196
- //! - [`Constraint::Percentage`] - Relative size as a percentage of available space
197
- //! - [`Constraint::Ratio`] - Proportional size using ratios
198
- //! - [`Constraint::Fill`] - Proportional fill of remaining space
199
- //!
200
- //! Constraints are resolved in priority order, with [`Constraint::Min`] having the highest
201
- //! priority and [`Constraint::Fill`] having the lowest. The constraint solver will satisfy as
202
- //! many constraints as possible while respecting these priorities.
203
- //!
204
- //! # Flexible Space Distribution
205
- //!
206
- //! The [`Flex`] enum controls how extra space is distributed when constraints are satisfied:
207
- //!
208
- //! - [`Flex::Start`] - Align content to the start, leaving excess space at the end
209
- //! - [`Flex::End`] - Align content to the end, leaving excess space at the start
210
- //! - [`Flex::Center`] - Center content, distributing excess space equally on both sides
211
- //! - [`Flex::SpaceBetween`] - Distribute excess space evenly *between* elements, none at the ends
212
- //! - [`Flex::SpaceAround`] - Distribute space *around* elements: equal padding on both sides of
213
- //! each element; gaps between elements are twice the edge spacing
214
- //! - [`Flex::SpaceEvenly`] - Distribute space *evenly*: equal spacing between all elements,
215
- //! including before the first and after the last.
216
- //! - [`Flex::Legacy`] - Legacy behavior (puts excess space in the last element)
217
- //!
218
- //! # Positioning and Alignment
219
- //!
220
- //! Use [`Position`] to represent specific points in the terminal, [`Size`] for dimensions, and the
221
- //! alignment types for controlling content positioning within areas:
222
- //!
223
- //! ```rust
224
- //! use ratatui_core::layout::{Alignment, Position, Rect, Size};
225
- //!
226
- //! let pos = Position::new(10, 5);
227
- //! let size = Size::new(80, 24);
228
- //! let rect = Rect::new(pos.x, pos.y, size.width, size.height);
229
- //!
230
- //! // Alignment for content within areas
231
- //! let center = Alignment::Center;
232
- //! ```
233
- //!
234
- //! # Advanced Features
235
- //!
236
- //! ## Margins and Spacing
237
- //!
238
- //! Add spacing around areas using uniform margins or between layout segments using [`Spacing`]:
239
- //!
240
- //! ```rust
241
- //! use ratatui_core::layout::{Constraint, Layout, Margin, Rect, Spacing};
242
- //!
243
- //! let layout = Layout::vertical([Constraint::Fill(1), Constraint::Fill(1)])
244
- //! .margin(2) // 2-cell margin on all sides
245
- //! .spacing(Spacing::Space(1)); // 1-cell spacing between segments
246
- //!
247
- //! // For asymmetric margins, use the Rect inner method directly
248
- //! let area = Rect::new(0, 0, 80, 24).inner(Margin::new(2, 1));
249
- //! ```
250
- //!
251
- //! ## Area Iteration
252
- //!
253
- //! Iterate over rows, columns, or all positions within a rectangular area. The `rows()` and
254
- //! `columns()` iterators return full [`Rect`] regions that can be used to render widgets or
255
- //! passed to other layout methods for more complex nested layouts. The `positions()` iterator
256
- //! returns [`Position`] values representing individual cell coordinates:
257
- //!
258
- //! ```rust
259
- //! use ratatui_core::buffer::Buffer;
260
- //! use ratatui_core::layout::{Constraint, Layout, Rect};
261
- //! use ratatui_core::widgets::Widget;
262
- //!
263
- //! let area = Rect::new(0, 0, 20, 10);
264
- //! let mut buffer = Buffer::empty(area);
265
- //!
266
- //! // Renders "Row 0", "Row 1", etc. in each horizontal row
267
- //! for (i, row) in area.rows().enumerate() {
268
- //! format!("Row {i}").render(row, &mut buffer);
269
- //! }
270
- //!
271
- //! // Renders column indices (0-9 repeating) in each vertical column
272
- //! for (i, col) in area.columns().enumerate() {
273
- //! format!("{}", i % 10).render(col, &mut buffer);
274
- //! }
275
- //!
276
- //! // Renders position indices (0-9 repeating) at each cell position
277
- //! for (i, pos) in area.positions().enumerate() {
278
- //! buffer[pos].set_symbol(&format!("{}", i % 10));
279
- //! }
280
- //! ```
281
- //!
282
- //! # Performance Considerations
283
- //!
284
- //! The layout system includes optional caching to improve performance for repeated layout
285
- //! calculations. Layout caching is enabled by default in the main `ratatui` crate, but requires
286
- //! explicitly enabling the `layout-cache` feature when using `ratatui-core` directly. When
287
- //! enabled, layout results are cached based on the area and layout configuration.
288
- //!
289
- //! # Related Documentation
290
- //!
291
- //! For more detailed information and practical examples:
292
- //!
293
- //! - [Layout Concepts](https://ratatui.rs/concepts/layout/) - Comprehensive guide to layout
294
- //! concepts
295
- //! - [Layout Recipes](https://ratatui.rs/recipes/layout/) - Practical layout examples and patterns
296
- //! - [Grid Layout Recipe](https://ratatui.rs/recipes/layout/grid/) - Creating grid-based layouts
297
- //! - [Center a Widget Recipe](https://ratatui.rs/recipes/layout/center-a-widget/) - Centering
298
- //! content
299
- //! - [Dynamic Layouts Recipe](https://ratatui.rs/recipes/layout/dynamic/) - Creating responsive
300
- //! layouts
301
- //!
302
- //! # Examples
303
- //!
304
- //! See the Ratatui repository for complete examples:
305
- //!
306
- //! - [`constraints`](https://github.com/ratatui/ratatui/blob/main/examples/apps/constraints/) -
307
- //! Demonstrates different constraint types
308
- //! - [`flex`](https://github.com/ratatui/ratatui/blob/main/examples/apps/flex/) - Shows flex space
309
- //! distribution
310
- //! - [`layout`](https://github.com/ratatui/ratatui/blob/main/examples/apps/layout/) - Basic layout
311
- //! examples
312
-
313
- mod alignment;
314
- mod constraint;
315
- mod direction;
316
- mod flex;
317
- mod layout;
318
- mod margin;
319
- mod offset;
320
- mod position;
321
- mod rect;
322
- mod size;
323
-
324
- pub use alignment::{Alignment, HorizontalAlignment, VerticalAlignment};
325
- pub use constraint::Constraint;
326
- pub use direction::Direction;
327
- pub use flex::Flex;
328
- pub use layout::{Layout, Spacing};
329
- pub use margin::Margin;
330
- pub use offset::Offset;
331
- pub use position::Position;
332
- pub use rect::{Columns, Positions, Rect, Rows};
333
- pub use size::Size;
@@ -1,82 +0,0 @@
1
- #![no_std]
2
- // show the feature flags in the generated documentation
3
- #![cfg_attr(docsrs, feature(doc_cfg))]
4
- #![doc(
5
- html_logo_url = "https://raw.githubusercontent.com/ratatui/ratatui/main/assets/logo.png",
6
- html_favicon_url = "https://raw.githubusercontent.com/ratatui/ratatui/main/assets/favicon.ico"
7
- )]
8
- //! **ratatui-core** is the core library of the [ratatui] project,
9
- //! providing the essential building blocks for creating rich terminal user interfaces in Rust.
10
- //!
11
- //! [ratatui]: https://github.com/ratatui/ratatui
12
- //!
13
- //! ## Why `ratatui-core`?
14
- //!
15
- //! The `ratatui-core` crate is split from the main [`ratatui`](https://crates.io/crates/ratatui) crate
16
- //! to offer better stability for widget library authors. Widget libraries should generally depend
17
- //! on `ratatui-core`, benefiting from a stable API and reducing the need for frequent updates.
18
- //!
19
- //! Applications, on the other hand, should depend on the main `ratatui` crate, which includes
20
- //! built-in widgets and additional features.
21
- //!
22
- //! # Installation
23
- //!
24
- //! Add `ratatui-core` to your `Cargo.toml`:
25
- //!
26
- //! ```shell
27
- //! cargo add ratatui-core
28
- //! ```
29
- //!
30
- //! # Crate Organization
31
- //!
32
- //! `ratatui-core` is part of the Ratatui workspace that was modularized in version 0.30.0 to
33
- //! improve compilation times, API stability, and dependency management. This crate provides the
34
- //! foundational types and traits that other crates in the workspace depend on.
35
- //!
36
- //! **When to use `ratatui-core`:**
37
- //!
38
- //! - Building widget libraries that implement [`Widget`] or [`StatefulWidget`]
39
- //! - Creating lightweight applications that don't need built-in widgets
40
- //! - You want minimal dependencies and faster compilation times
41
- //! - You need maximum API stability (core types change less frequently)
42
- //!
43
- //! **When to use the main [`ratatui`] crate:**
44
- //!
45
- //! - Building applications that use built-in widgets
46
- //! - You want convenience and don't mind slightly longer compilation times
47
- //! - You need backend implementations and terminal management utilities
48
- //!
49
- //! For detailed information about the workspace organization, see [ARCHITECTURE.md].
50
- //!
51
- //! [`ratatui`]: https://crates.io/crates/ratatui
52
- //! [`Widget`]: widgets::Widget
53
- //! [`StatefulWidget`]: widgets::StatefulWidget
54
- //! [ARCHITECTURE.md]: https://github.com/ratatui/ratatui/blob/main/ARCHITECTURE.md
55
- #![cfg_attr(feature = "document-features", doc = "\n## Features")]
56
- #![cfg_attr(feature = "document-features", doc = document_features::document_features!())]
57
- //!
58
- //! # Contributing
59
- //!
60
- //! We welcome contributions from the community! Please see our [CONTRIBUTING](../CONTRIBUTING.md)
61
- //! guide for more details on how to get involved.
62
- //!
63
- //! ## License
64
- //!
65
- //! This project is licensed under the MIT License. See the [LICENSE](../LICENSE) file for details.
66
-
67
- #![warn(clippy::std_instead_of_core)]
68
- #![warn(clippy::std_instead_of_alloc)]
69
- #![warn(clippy::alloc_instead_of_core)]
70
-
71
- extern crate alloc;
72
- #[cfg(feature = "std")]
73
- extern crate std;
74
-
75
- pub mod backend;
76
- pub mod buffer;
77
- pub mod layout;
78
- pub mod style;
79
- pub mod symbols;
80
- pub mod terminal;
81
- pub mod text;
82
- pub mod widgets;