@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,149 +0,0 @@
1
- use alloc::borrow::Cow;
2
- use core::fmt;
3
-
4
- use crate::text::Text;
5
-
6
- /// A wrapper around a string that is masked when displayed.
7
- ///
8
- /// The masked string is displayed as a series of the same character. This might be used to display
9
- /// a password field or similar secure data.
10
- ///
11
- /// # Examples
12
- ///
13
- /// ```rust
14
- /// use ratatui_core::buffer::Buffer;
15
- /// use ratatui_core::layout::Rect;
16
- /// use ratatui_core::text::{Masked, Text};
17
- /// use ratatui_core::widgets::Widget;
18
- ///
19
- /// let mut buffer = Buffer::empty(Rect::new(0, 0, 5, 1));
20
- /// let password = Masked::new("12345", 'x');
21
- ///
22
- /// Text::from(password).render(buffer.area, &mut buffer);
23
- /// assert_eq!(buffer, Buffer::with_lines(["xxxxx"]));
24
- /// ```
25
- #[derive(Default, Clone, Eq, PartialEq, Hash)]
26
- pub struct Masked<'a> {
27
- inner: Cow<'a, str>,
28
- mask_char: char,
29
- }
30
-
31
- impl<'a> Masked<'a> {
32
- pub fn new(s: impl Into<Cow<'a, str>>, mask_char: char) -> Self {
33
- Self {
34
- inner: s.into(),
35
- mask_char,
36
- }
37
- }
38
-
39
- /// The character to use for masking.
40
- pub const fn mask_char(&self) -> char {
41
- self.mask_char
42
- }
43
-
44
- /// The underlying string, with all characters masked.
45
- pub fn value(&self) -> Cow<'a, str> {
46
- self.inner.chars().map(|_| self.mask_char).collect()
47
- }
48
- }
49
-
50
- impl fmt::Debug for Masked<'_> {
51
- /// Debug representation of a masked string is the underlying string
52
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
53
- // note that calling display instead of Debug here is intentional
54
- fmt::Display::fmt(&self.inner, f)
55
- }
56
- }
57
-
58
- impl fmt::Display for Masked<'_> {
59
- /// Display representation of a masked string is the masked string
60
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
61
- fmt::Display::fmt(&self.value(), f)
62
- }
63
- }
64
-
65
- impl<'a> From<&'a Masked<'a>> for Cow<'a, str> {
66
- fn from(masked: &'a Masked) -> Self {
67
- masked.value()
68
- }
69
- }
70
-
71
- impl<'a> From<Masked<'a>> for Cow<'a, str> {
72
- fn from(masked: Masked<'a>) -> Self {
73
- masked.value()
74
- }
75
- }
76
-
77
- impl<'a> From<&'a Masked<'_>> for Text<'a> {
78
- fn from(masked: &'a Masked) -> Self {
79
- Text::raw(masked.value())
80
- }
81
- }
82
-
83
- impl<'a> From<Masked<'a>> for Text<'a> {
84
- fn from(masked: Masked<'a>) -> Self {
85
- Text::raw(masked.value())
86
- }
87
- }
88
-
89
- #[cfg(test)]
90
- mod tests {
91
- use alloc::format;
92
-
93
- use super::*;
94
- use crate::text::Line;
95
-
96
- #[test]
97
- fn new() {
98
- let masked = Masked::new("12345", 'x');
99
- assert_eq!(masked.inner, "12345");
100
- assert_eq!(masked.mask_char, 'x');
101
- }
102
-
103
- #[test]
104
- fn value() {
105
- let masked = Masked::new("12345", 'x');
106
- assert_eq!(masked.value(), "xxxxx");
107
- }
108
-
109
- #[test]
110
- fn mask_char() {
111
- let masked = Masked::new("12345", 'x');
112
- assert_eq!(masked.mask_char(), 'x');
113
- }
114
-
115
- #[test]
116
- fn debug() {
117
- let masked = Masked::new("12345", 'x');
118
- assert_eq!(format!("{masked:?}"), "12345");
119
- assert_eq!(format!("{masked:.3?}"), "123", "Debug truncates");
120
- }
121
-
122
- #[test]
123
- fn display() {
124
- let masked = Masked::new("12345", 'x');
125
- assert_eq!(format!("{masked}"), "xxxxx");
126
- assert_eq!(format!("{masked:.3}"), "xxx", "Display truncates");
127
- }
128
-
129
- #[test]
130
- fn into_text() {
131
- let masked = Masked::new("12345", 'x');
132
-
133
- let text: Text = (&masked).into();
134
- assert_eq!(text.lines, [Line::from("xxxxx")]);
135
-
136
- let text: Text = masked.into();
137
- assert_eq!(text.lines, [Line::from("xxxxx")]);
138
- }
139
-
140
- #[test]
141
- fn into_cow() {
142
- let masked = Masked::new("12345", 'x');
143
- let cow: Cow<str> = (&masked).into();
144
- assert_eq!(cow, "xxxxx");
145
-
146
- let cow: Cow<str> = masked.into();
147
- assert_eq!(cow, "xxxxx");
148
- }
149
- }