@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,79 +0,0 @@
1
- use core::fmt;
2
-
3
- /// Represents spacing around rectangular areas.
4
- ///
5
- /// `Margin` defines the horizontal and vertical spacing that should be applied around a rectangular
6
- /// area. It's commonly used with [`Layout`](crate::layout::Layout) to add space between the
7
- /// layout's boundaries and its contents, or with [`Rect::inner`](crate::layout::Rect::inner) and
8
- /// [`Rect::outer`](crate::layout::Rect::outer) to create padded areas.
9
- ///
10
- /// The margin values represent the number of character cells to add on each side. For horizontal
11
- /// margin, the space is applied to both the left and right sides. For vertical margin, the space
12
- /// is applied to both the top and bottom sides.
13
- ///
14
- /// # Construction
15
- ///
16
- /// - [`new`](Self::new) - Create a new margin with horizontal and vertical spacing
17
- /// - [`default`](Default::default) - Create with zero margin
18
- ///
19
- /// # Examples
20
- ///
21
- /// ```rust
22
- /// use ratatui_core::layout::{Constraint, Layout, Margin, Rect};
23
- ///
24
- /// // Create a margin of 2 cells horizontally and 1 cell vertically
25
- /// let margin = Margin::new(2, 1);
26
- ///
27
- /// // Apply directly to a rectangle
28
- /// let area = Rect::new(0, 0, 80, 24);
29
- /// let inner_area = area.inner(margin);
30
- ///
31
- /// // Or use with a layout (which only accepts uniform margins)
32
- /// let layout = Layout::vertical([Constraint::Fill(1)]).margin(2);
33
- /// ```
34
- ///
35
- /// For comprehensive layout documentation and examples, see the [`layout`](crate::layout) module.
36
- #[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash)]
37
- #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
38
- pub struct Margin {
39
- pub horizontal: u16,
40
- pub vertical: u16,
41
- }
42
-
43
- impl Margin {
44
- pub const fn new(horizontal: u16, vertical: u16) -> Self {
45
- Self {
46
- horizontal,
47
- vertical,
48
- }
49
- }
50
- }
51
-
52
- impl fmt::Display for Margin {
53
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
54
- write!(f, "{}x{}", self.horizontal, self.vertical)
55
- }
56
- }
57
-
58
- #[cfg(test)]
59
- mod tests {
60
- use alloc::string::ToString;
61
-
62
- use super::*;
63
-
64
- #[test]
65
- fn margin_to_string() {
66
- assert_eq!(Margin::new(1, 2).to_string(), "1x2");
67
- }
68
-
69
- #[test]
70
- fn margin_new() {
71
- assert_eq!(
72
- Margin::new(1, 2),
73
- Margin {
74
- horizontal: 1,
75
- vertical: 2
76
- }
77
- );
78
- }
79
- }
@@ -1,66 +0,0 @@
1
- use crate::layout::Position;
2
-
3
- /// Amounts by which to move a [`Rect`](crate::layout::Rect).
4
- ///
5
- /// Positive numbers move to the right/bottom and negative to the left/top.
6
- ///
7
- /// See [`Rect::offset`](crate::layout::Rect::offset) for usage.
8
- #[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash)]
9
- #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
10
- pub struct Offset {
11
- /// How much to move on the X axis
12
- pub x: i32,
13
-
14
- /// How much to move on the Y axis
15
- pub y: i32,
16
- }
17
-
18
- impl Offset {
19
- /// A zero offset
20
- pub const ZERO: Self = Self::new(0, 0);
21
-
22
- /// The minimum offset
23
- pub const MIN: Self = Self::new(i32::MIN, i32::MIN);
24
-
25
- /// The maximum offset
26
- pub const MAX: Self = Self::new(i32::MAX, i32::MAX);
27
-
28
- /// Creates a new `Offset` with the given values.
29
- pub const fn new(x: i32, y: i32) -> Self {
30
- Self { x, y }
31
- }
32
- }
33
-
34
- impl From<Position> for Offset {
35
- fn from(position: Position) -> Self {
36
- Self {
37
- x: i32::from(position.x),
38
- y: i32::from(position.y),
39
- }
40
- }
41
- }
42
-
43
- #[cfg(test)]
44
- mod tests {
45
- use super::*;
46
-
47
- #[test]
48
- fn new_sets_components() {
49
- assert_eq!(Offset::new(-3, 7), Offset { x: -3, y: 7 });
50
- }
51
-
52
- #[test]
53
- fn constants_match_expected_values() {
54
- assert_eq!(Offset::ZERO, Offset::new(0, 0));
55
- assert_eq!(Offset::MIN, Offset::new(i32::MIN, i32::MIN));
56
- assert_eq!(Offset::MAX, Offset::new(i32::MAX, i32::MAX));
57
- }
58
-
59
- #[test]
60
- fn from_position_converts_coordinates() {
61
- let position = Position::new(4, 9);
62
- let offset = Offset::from(position);
63
-
64
- assert_eq!(offset, Offset::new(4, 9));
65
- }
66
- }
@@ -1,253 +0,0 @@
1
- #![warn(missing_docs)]
2
- use core::fmt;
3
- use core::ops::{Add, AddAssign, Sub, SubAssign};
4
-
5
- use crate::layout::{Offset, Rect};
6
-
7
- /// Position in the terminal coordinate system.
8
- ///
9
- /// The position is relative to the top left corner of the terminal window, with the top left corner
10
- /// being (0, 0). The x axis is horizontal increasing to the right, and the y axis is vertical
11
- /// increasing downwards.
12
- ///
13
- /// `Position` is used throughout the layout system to represent specific points in the terminal.
14
- /// It can be created from coordinates, tuples, or extracted from rectangular areas.
15
- ///
16
- /// # Construction
17
- ///
18
- /// - [`new`](Self::new) - Create a new position from x and y coordinates
19
- /// - [`default`](Default::default) - Create at origin (0, 0)
20
- ///
21
- /// # Conversion
22
- ///
23
- /// - [`from((u16, u16))`](Self::from) - Create from `(u16, u16)` tuple
24
- /// - [`from(Rect)`](Self::from) - Create from [`Rect`] (uses top-left corner)
25
- /// - [`into((u16, u16))`] - Convert to `(u16, u16)` tuple
26
- ///
27
- /// # Movement
28
- ///
29
- /// - [`offset`](Self::offset) - Move by an [`Offset`]
30
- /// - [`Add<Offset>`](core::ops::Add) and [`Sub<Offset>`](core::ops::Sub) - Shift by offsets with
31
- /// clamping
32
- /// - [`AddAssign<Offset>`](core::ops::AddAssign) and [`SubAssign<Offset>`](core::ops::SubAssign) -
33
- /// In-place shifting
34
- ///
35
- /// # Examples
36
- ///
37
- /// ```
38
- /// use ratatui_core::layout::{Offset, Position, Rect};
39
- ///
40
- /// // the following are all equivalent
41
- /// let position = Position { x: 1, y: 2 };
42
- /// let position = Position::new(1, 2);
43
- /// let position = Position::from((1, 2));
44
- /// let position = Position::from(Rect::new(1, 2, 3, 4));
45
- ///
46
- /// // position can be converted back into the components when needed
47
- /// let (x, y) = position.into();
48
- ///
49
- /// // movement by offsets
50
- /// let position = Position::new(5, 5) + Offset::new(2, -3);
51
- /// assert_eq!(position, Position::new(7, 2));
52
- /// ```
53
- ///
54
- /// For comprehensive layout documentation and examples, see the [`layout`](crate::layout) module.
55
- #[derive(Debug, Default, Copy, Clone, PartialEq, Eq, Ord, PartialOrd, Hash)]
56
- #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
57
- pub struct Position {
58
- /// The x coordinate of the position
59
- ///
60
- /// The x coordinate is relative to the left edge of the terminal window, with the left edge
61
- /// being 0.
62
- pub x: u16,
63
-
64
- /// The y coordinate of the position
65
- ///
66
- /// The y coordinate is relative to the top edge of the terminal window, with the top edge
67
- /// being 0.
68
- pub y: u16,
69
- }
70
-
71
- impl Position {
72
- /// Position at the origin, the top left edge at 0,0
73
- pub const ORIGIN: Self = Self::new(0, 0);
74
-
75
- /// Position at the minimum x and y values
76
- pub const MIN: Self = Self::ORIGIN;
77
-
78
- /// Position at the maximum x and y values
79
- pub const MAX: Self = Self::new(u16::MAX, u16::MAX);
80
-
81
- /// Create a new position
82
- pub const fn new(x: u16, y: u16) -> Self {
83
- Self { x, y }
84
- }
85
-
86
- /// Moves the position by the given offset.
87
- ///
88
- /// Positive offsets move right and down, negative offsets move left and up. Values that would
89
- /// move the position outside the `u16` range are clamped to the nearest edge.
90
- #[must_use = "method returns the modified value"]
91
- pub fn offset(self, offset: Offset) -> Self {
92
- self + offset
93
- }
94
- }
95
-
96
- impl From<(u16, u16)> for Position {
97
- fn from((x, y): (u16, u16)) -> Self {
98
- Self { x, y }
99
- }
100
- }
101
-
102
- impl From<Position> for (u16, u16) {
103
- fn from(position: Position) -> Self {
104
- (position.x, position.y)
105
- }
106
- }
107
-
108
- impl From<Rect> for Position {
109
- fn from(rect: Rect) -> Self {
110
- rect.as_position()
111
- }
112
- }
113
-
114
- impl fmt::Display for Position {
115
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
116
- write!(f, "({}, {})", self.x, self.y)
117
- }
118
- }
119
-
120
- impl Add<Offset> for Position {
121
- type Output = Self;
122
-
123
- /// Moves the position by the given offset.
124
- ///
125
- /// Values that would move the position outside the `u16` range are clamped to the nearest
126
- /// edge.
127
- fn add(self, offset: Offset) -> Self {
128
- let max = i32::from(u16::MAX);
129
- let x = i32::from(self.x).saturating_add(offset.x).clamp(0, max) as u16;
130
- let y = i32::from(self.y).saturating_add(offset.y).clamp(0, max) as u16;
131
- Self { x, y }
132
- }
133
- }
134
-
135
- impl Add<Position> for Offset {
136
- type Output = Position;
137
-
138
- /// Moves the position by the given offset.
139
- ///
140
- /// Values that would move the position outside the `u16` range are clamped to the nearest
141
- /// edge.
142
- fn add(self, position: Position) -> Position {
143
- position + self
144
- }
145
- }
146
-
147
- impl Sub<Offset> for Position {
148
- type Output = Self;
149
-
150
- /// Moves the position by the inverse of the given offset.
151
- ///
152
- /// Values that would move the position outside the `u16` range are clamped to the nearest
153
- /// edge.
154
- fn sub(self, offset: Offset) -> Self {
155
- let max = i32::from(u16::MAX);
156
- let x = i32::from(self.x).saturating_sub(offset.x).clamp(0, max) as u16;
157
- let y = i32::from(self.y).saturating_sub(offset.y).clamp(0, max) as u16;
158
- Self { x, y }
159
- }
160
- }
161
-
162
- impl AddAssign<Offset> for Position {
163
- /// Moves the position in place by the given offset.
164
- ///
165
- /// Values that would move the position outside the `u16` range are clamped to the nearest
166
- /// edge.
167
- fn add_assign(&mut self, offset: Offset) {
168
- *self = *self + offset;
169
- }
170
- }
171
-
172
- impl SubAssign<Offset> for Position {
173
- /// Moves the position in place by the inverse of the given offset.
174
- ///
175
- /// Values that would move the position outside the `u16` range are clamped to the nearest
176
- /// edge.
177
- fn sub_assign(&mut self, offset: Offset) {
178
- *self = *self - offset;
179
- }
180
- }
181
-
182
- #[cfg(test)]
183
- mod tests {
184
- use alloc::string::ToString;
185
-
186
- use super::*;
187
-
188
- #[test]
189
- fn new() {
190
- let position = Position::new(1, 2);
191
-
192
- assert_eq!(position, Position { x: 1, y: 2 });
193
- }
194
-
195
- #[test]
196
- fn from_tuple() {
197
- let position = Position::from((1, 2));
198
-
199
- assert_eq!(position, Position { x: 1, y: 2 });
200
- }
201
-
202
- #[test]
203
- fn into_tuple() {
204
- let position = Position::new(1, 2);
205
- let (x, y) = position.into();
206
- assert_eq!(x, 1);
207
- assert_eq!(y, 2);
208
- }
209
-
210
- #[test]
211
- fn from_rect() {
212
- let rect = Rect::new(1, 2, 3, 4);
213
- let position = Position::from(rect);
214
-
215
- assert_eq!(position, Position { x: 1, y: 2 });
216
- }
217
-
218
- #[test]
219
- fn to_string() {
220
- let position = Position::new(1, 2);
221
- assert_eq!(position.to_string(), "(1, 2)");
222
- }
223
-
224
- #[test]
225
- fn offset_moves_position() {
226
- let position = Position::new(2, 3).offset(Offset::new(5, 7));
227
-
228
- assert_eq!(position, Position::new(7, 10));
229
- }
230
-
231
- #[test]
232
- fn offset_clamps_to_bounds() {
233
- let position = Position::new(1, 1).offset(Offset::MAX);
234
-
235
- assert_eq!(position, Position::MAX);
236
- }
237
-
238
- #[test]
239
- fn add_and_subtract_offset() {
240
- let position = Position::new(10, 10) + Offset::new(-3, 4) - Offset::new(5, 20);
241
-
242
- assert_eq!(position, Position::new(2, 0));
243
- }
244
-
245
- #[test]
246
- fn add_assign_and_sub_assign_offset() {
247
- let mut position = Position::new(5, 5);
248
- position += Offset::new(2, 3);
249
- position -= Offset::new(10, 1);
250
-
251
- assert_eq!(position, Position::new(0, 7));
252
- }
253
- }