@akiojin/gwt 6.30.2 → 9.0.1

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 (98) hide show
  1. package/.cargo/config.toml +2 -0
  2. package/.claude-plugin/marketplace.json +18 -0
  3. package/.coderabbit.yaml +8 -0
  4. package/.codex/skills/gwt-fix-issue/scripts/inspect_issue.py +833 -0
  5. package/.dockerignore +63 -0
  6. package/.gitattributes +27 -0
  7. package/.husky/commit-msg +2 -0
  8. package/.husky/pre-commit +9 -0
  9. package/.husky/pre-push +12 -0
  10. package/.markdownlint.json +18 -0
  11. package/.markdownlintignore +2 -0
  12. package/Dockerfile +58 -0
  13. package/README.ja.md +161 -484
  14. package/README.md +164 -444
  15. package/cliff.toml +56 -0
  16. package/clippy.toml +2 -0
  17. package/cmake/ci-disable-native.cmake +16 -0
  18. package/codecov.yml +16 -0
  19. package/commitlint.config.cjs +107 -0
  20. package/deny.toml +35 -0
  21. package/docker-compose.yml +59 -0
  22. package/messages/errors.toml +52 -0
  23. package/package.json +12 -22
  24. package/rustfmt.toml +8 -0
  25. package/scripts/check-e2e-coverage-threshold.mjs +238 -0
  26. package/scripts/entrypoint.sh +36 -25
  27. package/scripts/install-linux-deps.sh +46 -0
  28. package/scripts/postinstall.js +79 -227
  29. package/scripts/release_issue_refs.py +317 -0
  30. package/scripts/run-local-backend-tests-on-commit.sh +15 -0
  31. package/scripts/run-local-e2e-coverage-on-commit.sh +69 -0
  32. package/scripts/run-local-e2e-on-commit.sh +60 -0
  33. package/scripts/test-all.sh +13 -0
  34. package/scripts/test_release_issue_refs.py +257 -0
  35. package/scripts/validate-skill-frontmatter.sh +108 -0
  36. package/scripts/verify-ci-node-toolchain.sh +76 -0
  37. package/scripts/verify-husky-hooks.sh +6 -0
  38. package/scripts/voice-eval.sh +48 -0
  39. package/tests/voice_eval/README.md +53 -0
  40. package/tests/voice_eval/manifest.template.json +55 -0
  41. package/tests/voice_eval/samples/.gitkeep +1 -0
  42. package/tests/voice_eval/script-ja.txt +10 -0
  43. package/vendor/ratatui-core/src/backend/test.rs +1077 -0
  44. package/vendor/ratatui-core/src/backend.rs +405 -0
  45. package/vendor/ratatui-core/src/buffer/assert.rs +71 -0
  46. package/vendor/ratatui-core/src/buffer/buffer.rs +1388 -0
  47. package/vendor/ratatui-core/src/buffer/cell.rs +377 -0
  48. package/vendor/ratatui-core/src/buffer.rs +9 -0
  49. package/vendor/ratatui-core/src/layout/alignment.rs +89 -0
  50. package/vendor/ratatui-core/src/layout/constraint.rs +526 -0
  51. package/vendor/ratatui-core/src/layout/direction.rs +63 -0
  52. package/vendor/ratatui-core/src/layout/flex.rs +212 -0
  53. package/vendor/ratatui-core/src/layout/layout.rs +2838 -0
  54. package/vendor/ratatui-core/src/layout/margin.rs +79 -0
  55. package/vendor/ratatui-core/src/layout/offset.rs +66 -0
  56. package/vendor/ratatui-core/src/layout/position.rs +253 -0
  57. package/vendor/ratatui-core/src/layout/rect/iter.rs +356 -0
  58. package/vendor/ratatui-core/src/layout/rect/ops.rs +136 -0
  59. package/vendor/ratatui-core/src/layout/rect.rs +1114 -0
  60. package/vendor/ratatui-core/src/layout/size.rs +147 -0
  61. package/vendor/ratatui-core/src/layout.rs +333 -0
  62. package/vendor/ratatui-core/src/lib.rs +82 -0
  63. package/vendor/ratatui-core/src/style/anstyle.rs +348 -0
  64. package/vendor/ratatui-core/src/style/color.rs +788 -0
  65. package/vendor/ratatui-core/src/style/palette/material.rs +608 -0
  66. package/vendor/ratatui-core/src/style/palette/tailwind.rs +653 -0
  67. package/vendor/ratatui-core/src/style/palette.rs +6 -0
  68. package/vendor/ratatui-core/src/style/palette_conversion.rs +82 -0
  69. package/vendor/ratatui-core/src/style/stylize.rs +668 -0
  70. package/vendor/ratatui-core/src/style.rs +1069 -0
  71. package/vendor/ratatui-core/src/symbols/bar.rs +51 -0
  72. package/vendor/ratatui-core/src/symbols/block.rs +51 -0
  73. package/vendor/ratatui-core/src/symbols/border.rs +709 -0
  74. package/vendor/ratatui-core/src/symbols/braille.rs +21 -0
  75. package/vendor/ratatui-core/src/symbols/half_block.rs +3 -0
  76. package/vendor/ratatui-core/src/symbols/line.rs +259 -0
  77. package/vendor/ratatui-core/src/symbols/marker.rs +82 -0
  78. package/vendor/ratatui-core/src/symbols/merge.rs +748 -0
  79. package/vendor/ratatui-core/src/symbols/pixel.rs +30 -0
  80. package/vendor/ratatui-core/src/symbols/scrollbar.rs +46 -0
  81. package/vendor/ratatui-core/src/symbols/shade.rs +5 -0
  82. package/vendor/ratatui-core/src/symbols.rs +15 -0
  83. package/vendor/ratatui-core/src/terminal/frame.rs +192 -0
  84. package/vendor/ratatui-core/src/terminal/terminal.rs +926 -0
  85. package/vendor/ratatui-core/src/terminal/viewport.rs +58 -0
  86. package/vendor/ratatui-core/src/terminal.rs +40 -0
  87. package/vendor/ratatui-core/src/text/grapheme.rs +84 -0
  88. package/vendor/ratatui-core/src/text/line.rs +1678 -0
  89. package/vendor/ratatui-core/src/text/masked.rs +149 -0
  90. package/vendor/ratatui-core/src/text/span.rs +904 -0
  91. package/vendor/ratatui-core/src/text/text.rs +1434 -0
  92. package/vendor/ratatui-core/src/text.rs +64 -0
  93. package/vendor/ratatui-core/src/widgets/stateful_widget.rs +193 -0
  94. package/vendor/ratatui-core/src/widgets/widget.rs +174 -0
  95. package/vendor/ratatui-core/src/widgets.rs +9 -0
  96. package/bin/gwt.js +0 -131
  97. package/scripts/postinstall.test.js +0 -71
  98. package/scripts/release-download.js +0 -66
@@ -0,0 +1,149 @@
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
+ }