ratatui_ruby 0.9.0 → 0.10.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 (268) hide show
  1. checksums.yaml +4 -4
  2. data/.builds/ruby-3.2.yml +1 -1
  3. data/.builds/ruby-3.3.yml +1 -1
  4. data/.builds/ruby-3.4.yml +1 -1
  5. data/.builds/ruby-4.0.0.yml +1 -1
  6. data/AGENTS.md +2 -1
  7. data/CHANGELOG.md +122 -0
  8. data/REUSE.toml +5 -0
  9. data/Rakefile +1 -1
  10. data/Steepfile +49 -0
  11. data/doc/concepts/debugging.md +401 -0
  12. data/doc/getting_started/quickstart.md +8 -3
  13. data/doc/images/app_all_events.png +0 -0
  14. data/doc/images/app_color_picker.png +0 -0
  15. data/doc/images/app_debugging_showcase.gif +0 -0
  16. data/doc/images/app_debugging_showcase.png +0 -0
  17. data/doc/images/app_login_form.png +0 -0
  18. data/doc/images/app_stateful_interaction.png +0 -0
  19. data/doc/images/verify_quickstart_dsl.png +0 -0
  20. data/doc/images/verify_quickstart_layout.png +0 -0
  21. data/doc/images/verify_quickstart_lifecycle.png +0 -0
  22. data/doc/images/verify_readme_usage.png +0 -0
  23. data/doc/images/widget_barchart.png +0 -0
  24. data/doc/images/widget_block.png +0 -0
  25. data/doc/images/widget_box.png +0 -0
  26. data/doc/images/widget_calendar.png +0 -0
  27. data/doc/images/widget_canvas.png +0 -0
  28. data/doc/images/widget_cell.png +0 -0
  29. data/doc/images/widget_center.png +0 -0
  30. data/doc/images/widget_chart.png +0 -0
  31. data/doc/images/widget_gauge.png +0 -0
  32. data/doc/images/widget_layout_split.png +0 -0
  33. data/doc/images/widget_line_gauge.png +0 -0
  34. data/doc/images/widget_list.png +0 -0
  35. data/doc/images/widget_map.png +0 -0
  36. data/doc/images/widget_overlay.png +0 -0
  37. data/doc/images/widget_popup.png +0 -0
  38. data/doc/images/widget_ratatui_logo.png +0 -0
  39. data/doc/images/widget_ratatui_mascot.png +0 -0
  40. data/doc/images/widget_rect.png +0 -0
  41. data/doc/images/widget_render.png +0 -0
  42. data/doc/images/widget_rich_text.png +0 -0
  43. data/doc/images/widget_scroll_text.png +0 -0
  44. data/doc/images/widget_scrollbar.png +0 -0
  45. data/doc/images/widget_sparkline.png +0 -0
  46. data/doc/images/widget_style_colors.png +0 -0
  47. data/doc/images/widget_table.png +0 -0
  48. data/doc/images/widget_tabs.png +0 -0
  49. data/doc/images/widget_text_width.png +0 -0
  50. data/doc/troubleshooting/async.md +4 -0
  51. data/examples/app_debugging_showcase/README.md +119 -0
  52. data/examples/app_debugging_showcase/app.rb +318 -0
  53. data/examples/widget_canvas/app.rb +19 -14
  54. data/examples/widget_gauge/app.rb +18 -3
  55. data/examples/widget_layout_split/app.rb +16 -4
  56. data/examples/widget_list/app.rb +22 -6
  57. data/examples/widget_rect/app.rb +7 -6
  58. data/examples/widget_rich_text/app.rb +62 -37
  59. data/examples/widget_style_colors/app.rb +26 -47
  60. data/examples/widget_table/app.rb +28 -5
  61. data/examples/widget_text_width/app.rb +6 -4
  62. data/ext/ratatui_ruby/Cargo.lock +48 -1
  63. data/ext/ratatui_ruby/Cargo.toml +6 -2
  64. data/ext/ratatui_ruby/src/color.rs +82 -0
  65. data/ext/ratatui_ruby/src/errors.rs +28 -0
  66. data/ext/ratatui_ruby/src/events.rs +16 -14
  67. data/ext/ratatui_ruby/src/lib.rs +56 -0
  68. data/ext/ratatui_ruby/src/rendering.rs +3 -1
  69. data/ext/ratatui_ruby/src/style.rs +48 -21
  70. data/ext/ratatui_ruby/src/terminal.rs +40 -9
  71. data/ext/ratatui_ruby/src/text.rs +21 -9
  72. data/ext/ratatui_ruby/src/widgets/chart.rs +2 -1
  73. data/ext/ratatui_ruby/src/widgets/layout.rs +90 -2
  74. data/ext/ratatui_ruby/src/widgets/list.rs +6 -5
  75. data/ext/ratatui_ruby/src/widgets/overlay.rs +2 -1
  76. data/ext/ratatui_ruby/src/widgets/table.rs +7 -6
  77. data/ext/ratatui_ruby/src/widgets/table_state.rs +55 -0
  78. data/ext/ratatui_ruby/src/widgets/tabs.rs +3 -2
  79. data/lib/ratatui_ruby/buffer/cell.rb +25 -15
  80. data/lib/ratatui_ruby/buffer.rb +134 -2
  81. data/lib/ratatui_ruby/cell.rb +13 -5
  82. data/lib/ratatui_ruby/debug.rb +215 -0
  83. data/lib/ratatui_ruby/event/key.rb +3 -2
  84. data/lib/ratatui_ruby/event/sync.rb +52 -0
  85. data/lib/ratatui_ruby/event.rb +7 -1
  86. data/lib/ratatui_ruby/layout/constraint.rb +184 -0
  87. data/lib/ratatui_ruby/layout/layout.rb +119 -13
  88. data/lib/ratatui_ruby/layout/position.rb +55 -0
  89. data/lib/ratatui_ruby/layout/rect.rb +188 -0
  90. data/lib/ratatui_ruby/layout/size.rb +55 -0
  91. data/lib/ratatui_ruby/layout.rb +4 -0
  92. data/lib/ratatui_ruby/style/color.rb +149 -0
  93. data/lib/ratatui_ruby/style/style.rb +51 -4
  94. data/lib/ratatui_ruby/style.rb +2 -0
  95. data/lib/ratatui_ruby/symbols.rb +435 -0
  96. data/lib/ratatui_ruby/synthetic_events.rb +86 -0
  97. data/lib/ratatui_ruby/table_state.rb +51 -0
  98. data/lib/ratatui_ruby/terminal_lifecycle.rb +2 -1
  99. data/lib/ratatui_ruby/test_helper/event_injection.rb +34 -1
  100. data/lib/ratatui_ruby/test_helper.rb +9 -0
  101. data/lib/ratatui_ruby/text/line.rb +245 -0
  102. data/lib/ratatui_ruby/text/span.rb +158 -0
  103. data/lib/ratatui_ruby/text.rb +99 -0
  104. data/lib/ratatui_ruby/tui/canvas_factories.rb +103 -0
  105. data/lib/ratatui_ruby/tui/core.rb +13 -2
  106. data/lib/ratatui_ruby/tui/layout_factories.rb +50 -3
  107. data/lib/ratatui_ruby/tui/state_factories.rb +42 -0
  108. data/lib/ratatui_ruby/tui/text_factories.rb +40 -0
  109. data/lib/ratatui_ruby/tui/widget_factories.rb +135 -60
  110. data/lib/ratatui_ruby/tui.rb +22 -1
  111. data/lib/ratatui_ruby/version.rb +1 -1
  112. data/lib/ratatui_ruby/widgets/bar_chart/bar.rb +2 -0
  113. data/lib/ratatui_ruby/widgets/bar_chart/bar_group.rb +2 -0
  114. data/lib/ratatui_ruby/widgets/bar_chart.rb +30 -20
  115. data/lib/ratatui_ruby/widgets/block.rb +14 -6
  116. data/lib/ratatui_ruby/widgets/calendar.rb +2 -0
  117. data/lib/ratatui_ruby/widgets/canvas.rb +56 -0
  118. data/lib/ratatui_ruby/widgets/cell.rb +2 -0
  119. data/lib/ratatui_ruby/widgets/center.rb +2 -0
  120. data/lib/ratatui_ruby/widgets/chart.rb +6 -0
  121. data/lib/ratatui_ruby/widgets/clear.rb +2 -0
  122. data/lib/ratatui_ruby/widgets/coerceable_widget.rb +77 -0
  123. data/lib/ratatui_ruby/widgets/cursor.rb +2 -0
  124. data/lib/ratatui_ruby/widgets/gauge.rb +61 -3
  125. data/lib/ratatui_ruby/widgets/line_gauge.rb +66 -4
  126. data/lib/ratatui_ruby/widgets/list.rb +87 -3
  127. data/lib/ratatui_ruby/widgets/list_item.rb +2 -0
  128. data/lib/ratatui_ruby/widgets/overlay.rb +2 -0
  129. data/lib/ratatui_ruby/widgets/paragraph.rb +4 -0
  130. data/lib/ratatui_ruby/widgets/ratatui_logo.rb +2 -0
  131. data/lib/ratatui_ruby/widgets/ratatui_mascot.rb +2 -0
  132. data/lib/ratatui_ruby/widgets/row.rb +45 -0
  133. data/lib/ratatui_ruby/widgets/scrollbar.rb +2 -0
  134. data/lib/ratatui_ruby/widgets/shape/label.rb +2 -0
  135. data/lib/ratatui_ruby/widgets/sparkline.rb +21 -13
  136. data/lib/ratatui_ruby/widgets/table.rb +13 -3
  137. data/lib/ratatui_ruby/widgets/tabs.rb +6 -4
  138. data/lib/ratatui_ruby/widgets.rb +1 -0
  139. data/lib/ratatui_ruby.rb +51 -16
  140. data/sig/examples/app_all_events/model/app_model.rbs +23 -0
  141. data/sig/examples/app_all_events/model/event_entry.rbs +15 -8
  142. data/sig/examples/app_all_events/model/timestamp.rbs +1 -1
  143. data/sig/examples/app_all_events/view.rbs +1 -1
  144. data/sig/examples/app_stateful_interaction/app.rbs +5 -5
  145. data/sig/examples/widget_block_demo/app.rbs +6 -6
  146. data/sig/manifest.yaml +5 -0
  147. data/sig/patches/data.rbs +26 -0
  148. data/sig/patches/debugger__.rbs +8 -0
  149. data/sig/ratatui_ruby/buffer/cell.rbs +46 -0
  150. data/sig/ratatui_ruby/buffer.rbs +18 -0
  151. data/sig/ratatui_ruby/cell.rbs +44 -0
  152. data/sig/ratatui_ruby/clear.rbs +18 -0
  153. data/sig/ratatui_ruby/constraint.rbs +26 -0
  154. data/sig/ratatui_ruby/debug.rbs +45 -0
  155. data/sig/ratatui_ruby/draw.rbs +30 -0
  156. data/sig/ratatui_ruby/event.rbs +68 -8
  157. data/sig/ratatui_ruby/frame.rbs +4 -4
  158. data/sig/ratatui_ruby/interfaces.rbs +25 -0
  159. data/sig/ratatui_ruby/layout/constraint.rbs +39 -0
  160. data/sig/ratatui_ruby/layout/layout.rbs +45 -0
  161. data/sig/ratatui_ruby/layout/position.rbs +18 -0
  162. data/sig/ratatui_ruby/layout/rect.rbs +64 -0
  163. data/sig/ratatui_ruby/layout/size.rbs +18 -0
  164. data/sig/ratatui_ruby/output_guard.rbs +23 -0
  165. data/sig/ratatui_ruby/ratatui_ruby.rbs +83 -4
  166. data/sig/ratatui_ruby/rect.rbs +17 -0
  167. data/sig/ratatui_ruby/style/color.rbs +22 -0
  168. data/sig/ratatui_ruby/style/style.rbs +29 -0
  169. data/sig/ratatui_ruby/symbols.rbs +141 -0
  170. data/sig/ratatui_ruby/synthetic_events.rbs +21 -0
  171. data/sig/ratatui_ruby/table_state.rbs +6 -0
  172. data/sig/ratatui_ruby/terminal_lifecycle.rbs +31 -0
  173. data/sig/ratatui_ruby/test_helper/event_injection.rbs +2 -2
  174. data/sig/ratatui_ruby/test_helper/snapshot.rbs +22 -3
  175. data/sig/ratatui_ruby/test_helper/style_assertions.rbs +8 -1
  176. data/sig/ratatui_ruby/test_helper/test_doubles.rbs +7 -3
  177. data/sig/ratatui_ruby/text/line.rbs +27 -0
  178. data/sig/ratatui_ruby/text/span.rbs +23 -0
  179. data/sig/ratatui_ruby/text.rbs +12 -0
  180. data/sig/ratatui_ruby/tui/buffer_factories.rbs +1 -1
  181. data/sig/ratatui_ruby/tui/canvas_factories.rbs +23 -5
  182. data/sig/ratatui_ruby/tui/core.rbs +2 -2
  183. data/sig/ratatui_ruby/tui/layout_factories.rbs +16 -2
  184. data/sig/ratatui_ruby/tui/state_factories.rbs +8 -3
  185. data/sig/ratatui_ruby/tui/style_factories.rbs +3 -1
  186. data/sig/ratatui_ruby/tui/text_factories.rbs +7 -4
  187. data/sig/ratatui_ruby/tui/widget_factories.rbs +123 -30
  188. data/sig/ratatui_ruby/widgets/bar_chart.rbs +95 -0
  189. data/sig/ratatui_ruby/widgets/block.rbs +51 -0
  190. data/sig/ratatui_ruby/widgets/calendar.rbs +45 -0
  191. data/sig/ratatui_ruby/widgets/canvas.rbs +95 -0
  192. data/sig/ratatui_ruby/widgets/chart.rbs +91 -0
  193. data/sig/ratatui_ruby/widgets/coerceable_widget.rbs +26 -0
  194. data/sig/ratatui_ruby/widgets/gauge.rbs +44 -0
  195. data/sig/ratatui_ruby/widgets/line_gauge.rbs +48 -0
  196. data/sig/ratatui_ruby/widgets/list.rbs +63 -0
  197. data/sig/ratatui_ruby/widgets/misc.rbs +158 -0
  198. data/sig/ratatui_ruby/widgets/paragraph.rbs +45 -0
  199. data/sig/ratatui_ruby/widgets/row.rbs +43 -0
  200. data/sig/ratatui_ruby/widgets/scrollbar.rbs +53 -0
  201. data/sig/ratatui_ruby/widgets/shape/label.rbs +37 -0
  202. data/sig/ratatui_ruby/widgets/sparkline.rbs +45 -0
  203. data/sig/ratatui_ruby/widgets/table.rbs +78 -0
  204. data/sig/ratatui_ruby/widgets/tabs.rbs +44 -0
  205. data/sig/ratatui_ruby/{schema/list_item.rbs → widgets.rbs} +4 -4
  206. data/tasks/steep.rake +11 -0
  207. metadata +82 -63
  208. data/doc/contributors/v1.0.0_blockers.md +0 -876
  209. data/doc/troubleshooting/debugging.md +0 -101
  210. data/lib/ratatui_ruby/schema/bar_chart/bar.rb +0 -47
  211. data/lib/ratatui_ruby/schema/bar_chart/bar_group.rb +0 -25
  212. data/lib/ratatui_ruby/schema/bar_chart.rb +0 -287
  213. data/lib/ratatui_ruby/schema/block.rb +0 -198
  214. data/lib/ratatui_ruby/schema/calendar.rb +0 -84
  215. data/lib/ratatui_ruby/schema/canvas.rb +0 -239
  216. data/lib/ratatui_ruby/schema/center.rb +0 -67
  217. data/lib/ratatui_ruby/schema/chart.rb +0 -159
  218. data/lib/ratatui_ruby/schema/clear.rb +0 -62
  219. data/lib/ratatui_ruby/schema/constraint.rb +0 -151
  220. data/lib/ratatui_ruby/schema/cursor.rb +0 -50
  221. data/lib/ratatui_ruby/schema/gauge.rb +0 -72
  222. data/lib/ratatui_ruby/schema/layout.rb +0 -122
  223. data/lib/ratatui_ruby/schema/line_gauge.rb +0 -80
  224. data/lib/ratatui_ruby/schema/list.rb +0 -135
  225. data/lib/ratatui_ruby/schema/list_item.rb +0 -51
  226. data/lib/ratatui_ruby/schema/overlay.rb +0 -51
  227. data/lib/ratatui_ruby/schema/paragraph.rb +0 -107
  228. data/lib/ratatui_ruby/schema/ratatui_logo.rb +0 -31
  229. data/lib/ratatui_ruby/schema/ratatui_mascot.rb +0 -36
  230. data/lib/ratatui_ruby/schema/rect.rb +0 -174
  231. data/lib/ratatui_ruby/schema/row.rb +0 -76
  232. data/lib/ratatui_ruby/schema/scrollbar.rb +0 -143
  233. data/lib/ratatui_ruby/schema/shape/label.rb +0 -76
  234. data/lib/ratatui_ruby/schema/sparkline.rb +0 -142
  235. data/lib/ratatui_ruby/schema/style.rb +0 -97
  236. data/lib/ratatui_ruby/schema/table.rb +0 -141
  237. data/lib/ratatui_ruby/schema/tabs.rb +0 -85
  238. data/lib/ratatui_ruby/schema/text.rb +0 -217
  239. data/sig/examples/app_all_events/model/events.rbs +0 -15
  240. data/sig/examples/app_all_events/view_state.rbs +0 -21
  241. data/sig/ratatui_ruby/schema/bar_chart/bar.rbs +0 -22
  242. data/sig/ratatui_ruby/schema/bar_chart/bar_group.rbs +0 -19
  243. data/sig/ratatui_ruby/schema/bar_chart.rbs +0 -38
  244. data/sig/ratatui_ruby/schema/block.rbs +0 -18
  245. data/sig/ratatui_ruby/schema/calendar.rbs +0 -23
  246. data/sig/ratatui_ruby/schema/canvas.rbs +0 -81
  247. data/sig/ratatui_ruby/schema/center.rbs +0 -17
  248. data/sig/ratatui_ruby/schema/chart.rbs +0 -39
  249. data/sig/ratatui_ruby/schema/constraint.rbs +0 -22
  250. data/sig/ratatui_ruby/schema/cursor.rbs +0 -16
  251. data/sig/ratatui_ruby/schema/draw.rbs +0 -33
  252. data/sig/ratatui_ruby/schema/gauge.rbs +0 -23
  253. data/sig/ratatui_ruby/schema/layout.rbs +0 -27
  254. data/sig/ratatui_ruby/schema/line_gauge.rbs +0 -24
  255. data/sig/ratatui_ruby/schema/list.rbs +0 -28
  256. data/sig/ratatui_ruby/schema/overlay.rbs +0 -15
  257. data/sig/ratatui_ruby/schema/paragraph.rbs +0 -20
  258. data/sig/ratatui_ruby/schema/ratatui_logo.rbs +0 -14
  259. data/sig/ratatui_ruby/schema/ratatui_mascot.rbs +0 -17
  260. data/sig/ratatui_ruby/schema/rect.rbs +0 -48
  261. data/sig/ratatui_ruby/schema/row.rbs +0 -28
  262. data/sig/ratatui_ruby/schema/scrollbar.rbs +0 -42
  263. data/sig/ratatui_ruby/schema/sparkline.rbs +0 -22
  264. data/sig/ratatui_ruby/schema/style.rbs +0 -19
  265. data/sig/ratatui_ruby/schema/table.rbs +0 -32
  266. data/sig/ratatui_ruby/schema/tabs.rbs +0 -21
  267. data/sig/ratatui_ruby/schema/text.rbs +0 -31
  268. /data/lib/ratatui_ruby/{schema/draw.rb → draw.rb} +0 -0
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: AGPL-3.0-or-later
6
- #++
7
-
8
- # SPDX-License-Identifier: AGPL-3.0-or-later
9
-
10
- class ViewState < Data
11
- attr_reader events: Events
12
- attr_reader focused: bool
13
- attr_reader hotkey_style: RatatuiRuby::Style
14
- attr_reader dimmed_style: RatatuiRuby::Style
15
- attr_reader lit_style: RatatuiRuby::Style
16
- attr_reader border_color: Symbol
17
- attr_reader area: RatatuiRuby::Rect?
18
-
19
- def self.build(events: Events, focused: bool, tui: RatatuiRuby::TUI, _resize_sub_counter: untyped) -> instance
20
- def self.new: (?events: Events, ?focused: bool, ?hotkey_style: RatatuiRuby::Style, ?dimmed_style: RatatuiRuby::Style, ?lit_style: RatatuiRuby::Style, ?border_color: Symbol, ?area: RatatuiRuby::Rect | nil) -> instance
21
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: LGPL-3.0-or-later
6
- #++
7
-
8
- # SPDX-License-Identifier: AGPL-3.0-or-later
9
-
10
- module RatatuiRuby
11
- class BarChart
12
- class Bar < Data
13
- attr_reader value: Integer
14
- attr_reader label: (String | Text::Span | Text::Line)?
15
- attr_reader style: Style?
16
- attr_reader value_style: Style?
17
- attr_reader text_value: (String | Text::Span | Text::Line)?
18
-
19
- def self.new: (value: Numeric, ?label: String | Text::Span | Text::Line | nil, ?style: Style?, ?value_style: Style?, ?text_value: String | Text::Span | Text::Line | nil) -> Bar
20
- end
21
- end
22
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: LGPL-3.0-or-later
6
- #++
7
-
8
- # SPDX-License-Identifier: AGPL-3.0-or-later
9
-
10
- module RatatuiRuby
11
- class BarChart
12
- class BarGroup < Data
13
- attr_reader label: String
14
- attr_reader bars: Array[BarChart::Bar]
15
-
16
- def self.new: (label: String, bars: Array[BarChart::Bar]) -> BarGroup
17
- end
18
- end
19
- end
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: LGPL-3.0-or-later
6
- #++
7
-
8
- # SPDX-License-Identifier: AGPL-3.0-or-later
9
-
10
- module RatatuiRuby
11
- class BarChart < Data
12
- attr_reader data: Array[BarChart::BarGroup]
13
- attr_reader bar_width: Integer
14
- attr_reader bar_gap: Integer
15
- attr_reader group_gap: Integer
16
- attr_reader max: Integer?
17
- attr_reader style: Style?
18
- attr_reader block: Block?
19
- attr_reader direction: :vertical | :horizontal
20
- attr_reader label_style: Style?
21
- attr_reader value_style: Style?
22
- attr_reader bar_set: String?
23
-
24
- def self.new: (
25
- data: Hash[String | Symbol | _ToS, Numeric] | Array[Array[String | Symbol | _ToS | Numeric]] | Array[BarChart::BarGroup],
26
- ?bar_width: Numeric,
27
- ?bar_gap: Numeric,
28
- ?group_gap: Numeric,
29
- ?max: Numeric?,
30
- ?style: Style?,
31
- ?block: Block?,
32
- ?direction: :vertical | :horizontal,
33
- ?label_style: Style?,
34
- ?value_style: Style?,
35
- ?bar_set: String?
36
- ) -> BarChart
37
- end
38
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: LGPL-3.0-or-later
6
- #++
7
-
8
- # SPDX-License-Identifier: AGPL-3.0-or-later
9
-
10
- module RatatuiRuby
11
- class Block < Data
12
- attr_reader titles: Array[Hash[Symbol, untyped]]
13
- attr_reader title_style: (Style | Hash[Symbol, untyped])?
14
- attr_reader border_style: (Style | Hash[Symbol, untyped])?
15
- attr_reader children: Array[untyped]
16
- def self.new: (?title: String?, ?titles: Array[Hash[Symbol, untyped]], ?title_alignment: Symbol?, ?title_style: (Style | Hash[Symbol, untyped])?, ?borders: Array[Symbol], ?border_style: (Style | Hash[Symbol, untyped])?, ?border_type: Symbol?, ?border_set: Hash[Symbol, String]?, ?style: (Style | Hash[Symbol, untyped])?, ?padding: (Numeric | Array[Numeric]), ?children: Array[untyped]) -> Block
17
- end
18
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: LGPL-3.0-or-later
6
- #++
7
-
8
- # SPDX-License-Identifier: AGPL-3.0-or-later
9
-
10
- module RatatuiRuby
11
- class Calendar < Data
12
- attr_reader year: Integer
13
- attr_reader month: Integer
14
- attr_reader events: Hash[untyped, Style]
15
- attr_reader default_style: Style?
16
- attr_reader header_style: Style?
17
- attr_reader block: Block?
18
- attr_reader show_weekdays_header: bool
19
- attr_reader show_surrounding: Style?
20
- attr_reader show_month_header: bool
21
- def self.new: (year: Numeric, month: Numeric, ?events: Hash[untyped, Style], ?default_style: Style?, ?header_style: Style?, ?block: Block?, ?show_weekdays_header: bool, ?show_surrounding: Style?, ?show_month_header: bool) -> Calendar
22
- end
23
- end
@@ -1,81 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: LGPL-3.0-or-later
6
- #++
7
-
8
- # SPDX-License-Identifier: AGPL-3.0-or-later
9
-
10
- module RatatuiRuby
11
- module Shape
12
- class Point < Data
13
- attr_reader x: Float
14
- attr_reader y: Float
15
-
16
- def self.new: (x: Numeric, y: Numeric) -> Point
17
- | (Numeric, Numeric) -> Point
18
- end
19
-
20
- class Line < Data
21
- attr_reader x1: Float
22
- attr_reader y1: Float
23
- attr_reader x2: Float
24
- attr_reader y2: Float
25
- attr_reader color: String | Symbol
26
-
27
- def self.new: (x1: Numeric, y1: Numeric, x2: Numeric, y2: Numeric, color: String | Symbol) -> Line
28
- | (Numeric, Numeric, Numeric, Numeric, String | Symbol) -> Line
29
- end
30
-
31
- class Rectangle < Data
32
- attr_reader x: Float
33
- attr_reader y: Float
34
- attr_reader width: Float
35
- attr_reader height: Float
36
- attr_reader color: String | Symbol
37
-
38
- def self.new: (x: Numeric, y: Numeric, width: Numeric, height: Numeric, color: String | Symbol) -> Rectangle
39
- | (Numeric, Numeric, Numeric, Numeric, String | Symbol) -> Rectangle
40
- end
41
-
42
- class Circle < Data
43
- attr_reader x: Float
44
- attr_reader y: Float
45
- attr_reader radius: Float
46
- attr_reader color: String | Symbol
47
-
48
- def self.new: (x: Numeric, y: Numeric, radius: Numeric, color: String | Symbol) -> Circle
49
- | (Numeric, Numeric, Numeric, String | Symbol) -> Circle
50
- end
51
-
52
- class Map < Data
53
- attr_reader color: String | Symbol
54
- attr_reader resolution: Symbol
55
-
56
- def self.new: (color: String | Symbol, resolution: Symbol) -> Map
57
- | (String | Symbol, Symbol) -> Map
58
- end
59
-
60
- class Label < Data
61
- attr_reader x: Float
62
- attr_reader y: Float
63
- attr_reader text: String | Text::Line
64
- attr_reader style: Style?
65
-
66
- def self.new: (x: Numeric, y: Numeric, text: String | Text::Line, ?style: Style?) -> Label
67
- end
68
- end
69
-
70
- class Canvas < Data
71
- attr_reader shapes: Array[Shape::Line | Shape::Rectangle | Shape::Circle | Shape::Map | Shape::Label]
72
- attr_reader x_bounds: Array[Float]
73
- attr_reader y_bounds: Array[Float]
74
- attr_reader marker: Symbol
75
- attr_reader block: Block?
76
-
77
- attr_reader background_color: String | Symbol | nil
78
-
79
- def self.new: (?shapes: Array[Shape::Line | Shape::Rectangle | Shape::Circle | Shape::Map | Shape::Label], ?x_bounds: Array[Numeric], ?y_bounds: Array[Numeric], ?marker: Symbol, ?block: Block?, ?background_color: String | Symbol | nil) -> Canvas
80
- end
81
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: LGPL-3.0-or-later
6
- #++
7
-
8
- # SPDX-License-Identifier: AGPL-3.0-or-later
9
-
10
- module RatatuiRuby
11
- class Center < Data
12
- attr_reader child: widget
13
- attr_reader width_percent: Float
14
- attr_reader height_percent: Float
15
- def self.new: (child: widget, ?width_percent: Numeric, ?height_percent: Numeric) -> Center
16
- end
17
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: LGPL-3.0-or-later
6
- #++
7
-
8
- # SPDX-License-Identifier: AGPL-3.0-or-later
9
-
10
- module RatatuiRuby
11
- class Axis < Data
12
- attr_reader title: String
13
- attr_reader bounds: [Float, Float]
14
- attr_reader labels: Array[String]
15
- attr_reader style: Style?
16
- attr_reader labels_alignment: Symbol?
17
- def self.new: (?title: String, ?bounds: [Numeric, Numeric], ?labels: Array[String], ?style: Style?, ?labels_alignment: Symbol?) -> Axis
18
- end
19
-
20
- class Dataset < Data
21
- attr_reader name: String | Symbol
22
- attr_reader data: Array[[Float, Float]]
23
- attr_reader style: Style?
24
- attr_reader marker: Symbol
25
- attr_reader graph_type: Symbol
26
- def self.new: (name: String | Symbol, data: Array[[Numeric, Numeric]], ?style: Style?, ?marker: Symbol, ?graph_type: Symbol) -> Dataset
27
- end
28
-
29
- class Chart < Data
30
- attr_reader datasets: Array[Dataset]
31
- attr_reader x_axis: Axis
32
- attr_reader y_axis: Axis
33
- attr_reader block: Block?
34
- attr_reader style: Style?
35
- attr_reader legend_position: Symbol?
36
- attr_reader hidden_legend_constraints: Array[Constraint]
37
- def self.new: (datasets: Array[Dataset], x_axis: Axis, y_axis: Axis, ?block: Block?, ?style: Style?, ?legend_position: Symbol?, ?hidden_legend_constraints: Array[Constraint]) -> Chart
38
- end
39
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: LGPL-3.0-or-later
6
- #++
7
-
8
- # SPDX-License-Identifier: AGPL-3.0-or-later
9
-
10
- module RatatuiRuby
11
- class Constraint < Data
12
- attr_reader type: Symbol
13
- attr_reader value: (Integer | Array[Integer])
14
- def self.length: (Numeric) -> Constraint
15
- def self.percentage: (Numeric) -> Constraint
16
- def self.min: (Numeric) -> Constraint
17
- def self.max: (Numeric) -> Constraint
18
- def self.fill: (?Numeric) -> Constraint
19
- def self.ratio: (Numeric, Numeric) -> Constraint
20
- def self.new: (type: Symbol, value: (Integer | Array[Integer])) -> Constraint
21
- end
22
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: LGPL-3.0-or-later
6
- #++
7
-
8
- # SPDX-License-Identifier: AGPL-3.0-or-later
9
-
10
- module RatatuiRuby
11
- class Cursor < Data
12
- attr_reader x: Integer
13
- attr_reader y: Integer
14
- def self.new: (x: Numeric, y: Numeric) -> Cursor
15
- end
16
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: LGPL-3.0-or-later
6
- #++
7
-
8
- #
9
- # SPDX-License-Identifier: AGPL-3.0-or-later
10
-
11
- module RatatuiRuby
12
- module Draw
13
- class StringCmd < Data
14
- attr_reader x: Integer
15
- attr_reader y: Integer
16
- attr_reader string: String
17
- attr_reader style: Style | Hash[Symbol, untyped]
18
-
19
- def self.new: (x: Integer, y: Integer, string: String, style: Style | Hash[Symbol, untyped]) -> StringCmd
20
- end
21
-
22
- class CellCmd < Data
23
- attr_reader x: Integer
24
- attr_reader y: Integer
25
- attr_reader cell: Cell
26
-
27
- def self.new: (x: Integer, y: Integer, cell: Cell) -> CellCmd
28
- end
29
-
30
- def self.string: (Numeric x, Numeric y, String string, ?Style | Hash[Symbol, untyped] style) -> StringCmd
31
- def self.cell: (Numeric x, Numeric y, Cell cell) -> CellCmd
32
- end
33
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: LGPL-3.0-or-later
6
- #++
7
-
8
- # SPDX-License-Identifier: AGPL-3.0-or-later
9
-
10
- module RatatuiRuby
11
- class Gauge < Data
12
- attr_reader ratio: Float
13
- attr_reader label: (String | Text::Span)?
14
- attr_reader style: Style?
15
- attr_reader gauge_style: Style?
16
- attr_reader block: Block?
17
-
18
- attr_reader use_unicode: bool
19
- def self.new: (?ratio: Numeric?, ?percent: Numeric?, ?label: String | Text::Span | nil, ?style: Style?, ?gauge_style: Style?, ?block: Block?, ?use_unicode: bool) -> Gauge
20
- def filled?: () -> bool
21
- def complete?: () -> bool
22
- end
23
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: LGPL-3.0-or-later
6
- #++
7
-
8
- # SPDX-License-Identifier: AGPL-3.0-or-later
9
-
10
- module RatatuiRuby
11
- type flex_mode = :legacy | :start | :center | :end | :space_between | :space_around | :space_evenly
12
-
13
- class Layout < Data
14
- FLEX_MODES: Array[Symbol]
15
-
16
- attr_reader direction: Symbol
17
- attr_reader constraints: Array[Constraint]
18
- attr_reader children: Array[widget]
19
- attr_reader flex: flex_mode
20
- def self.new: (?direction: Symbol, ?constraints: Array[Constraint], ?children: Array[widget], ?flex: flex_mode) -> Layout
21
- def self.split: (Rect | Hash[Symbol, Integer] area, ?direction: Symbol, constraints: Array[Constraint], ?flex: flex_mode) -> Array[Rect]
22
-
23
- private
24
-
25
- def self._split: (Rect, Symbol, Array[Constraint], Symbol) -> Array[Hash[Symbol, Integer]]
26
- end
27
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: LGPL-3.0-or-later
6
- #++
7
-
8
- # SPDX-License-Identifier: AGPL-3.0-or-later
9
-
10
- module RatatuiRuby
11
- class LineGauge < Data
12
- attr_reader ratio: Float
13
- attr_reader label: (String | Text::Span)?
14
- attr_reader filled_style: Style?
15
- attr_reader unfilled_style: Style?
16
- attr_reader block: Block?
17
- attr_reader filled_symbol: String
18
- attr_reader unfilled_symbol: String
19
-
20
- def self.new: (?ratio: Numeric, ?label: String | Text::Span | nil, ?style: Style?, ?filled_style: Style?, ?unfilled_style: Style?, ?block: Block?, ?filled_symbol: String, ?unfilled_symbol: String) -> LineGauge
21
- def filled?: () -> bool
22
- def complete?: () -> bool
23
- end
24
- end
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: LGPL-3.0-or-later
6
- #++
7
-
8
- # SPDX-License-Identifier: AGPL-3.0-or-later
9
-
10
- module RatatuiRuby
11
- class List < Data
12
- attr_reader items: Array[String | Text::Span | Text::Line | ListItem]
13
- attr_reader selected_index: Integer?
14
- attr_reader offset: Integer?
15
- attr_reader style: Style?
16
- attr_reader highlight_style: Style?
17
- attr_reader highlight_symbol: String?
18
- attr_reader repeat_highlight_symbol: bool
19
- attr_reader highlight_spacing: Symbol
20
- attr_reader direction: Symbol
21
- attr_reader scroll_padding: Integer?
22
- attr_reader block: Block?
23
- def self.new: (?items: Array[String | Text::Span | Text::Line | ListItem], ?selected_index: Numeric?, ?offset: Numeric?, ?style: Style?, ?highlight_style: Style?, ?highlight_symbol: String?, ?repeat_highlight_symbol: bool, ?highlight_spacing: Symbol, ?direction: Symbol, ?scroll_padding: Numeric?, ?block: Block?) -> List
24
- def selected?: () -> bool
25
- def empty?: () -> bool
26
- end
27
- end
28
-
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: LGPL-3.0-or-later
6
- #++
7
-
8
- # SPDX-License-Identifier: AGPL-3.0-or-later
9
-
10
- module RatatuiRuby
11
- class Overlay < Data
12
- attr_reader layers: Array[widget]
13
- def self.new: (layers: Array[widget]) -> Overlay
14
- end
15
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: LGPL-3.0-or-later
6
- #++
7
-
8
- # SPDX-License-Identifier: AGPL-3.0-or-later
9
-
10
- module RatatuiRuby
11
- class Paragraph < Data
12
- attr_reader text: String
13
- attr_reader style: Style
14
- attr_reader block: Block?
15
- attr_reader wrap: bool
16
- attr_reader alignment: Symbol
17
- def initialize: (text: String, ?style: Style, ?block: Block?, ?wrap: bool, ?alignment: Symbol, ?scroll: [Numeric, Numeric]) -> void
18
- def self.new: (text: String, ?style: Style?, ?fg: (String | Symbol)?, ?bg: (String | Symbol)?, ?block: Block?, ?wrap: bool, ?alignment: Symbol, ?scroll: [Numeric, Numeric]) -> Paragraph
19
- end
20
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: LGPL-3.0-or-later
6
- #++
7
-
8
- # SPDX-License-Identifier: AGPL-3.0-or-later
9
-
10
- module RatatuiRuby
11
- class RatatuiLogo < Data
12
- def self.new: () -> RatatuiLogo
13
- end
14
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: LGPL-3.0-or-later
6
- #++
7
-
8
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
9
- # SPDX-License-Identifier: AGPL-3.0-or-later
10
-
11
- module RatatuiRuby
12
- class RatatuiMascot < Data
13
- attr_reader block: Block?
14
-
15
- def self.new: (?block: Block?) -> RatatuiMascot
16
- end
17
- end
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: LGPL-3.0-or-later
6
- #++
7
-
8
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
9
- # SPDX-License-Identifier: AGPL-3.0-or-later
10
-
11
- module RatatuiRuby
12
- class Rect < Data
13
- attr_reader x: Integer
14
- attr_reader y: Integer
15
- attr_reader width: Integer
16
- attr_reader height: Integer
17
-
18
- def self.new: (?x: Numeric, ?y: Numeric, ?width: Numeric, ?height: Numeric) -> instance
19
-
20
- # Predicates
21
- def contains?: (Integer px, Integer py) -> bool
22
- def intersects?: (Rect other) -> bool
23
- def empty?: () -> bool
24
-
25
- # Edge accessors
26
- def left: () -> Integer
27
- def right: () -> Integer
28
- def top: () -> Integer
29
- def bottom: () -> Integer
30
- def area: () -> Integer
31
-
32
- # Geometry transformations
33
- def intersection: (Rect other) -> Rect?
34
- def union: (Rect other) -> Rect
35
- def inner: (Integer margin) -> Rect
36
- def offset: (Integer dx, Integer dy) -> Rect
37
- def clamp: (Rect other) -> Rect
38
-
39
- # Iterators
40
- def rows: () -> Enumerator[Rect, void]
41
- | () { (Rect) -> void } -> void
42
- def columns: () -> Enumerator[Rect, void]
43
- | () { (Rect) -> void } -> void
44
- def positions: () -> Enumerator[[Integer, Integer], void]
45
- | () { ([Integer, Integer]) -> void } -> void
46
- end
47
- end
48
-
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: LGPL-3.0-or-later
6
- #++
7
-
8
- # SPDX-License-Identifier: AGPL-3.0-or-later
9
-
10
- module RatatuiRuby
11
- class Row < Data
12
- type cell_content = String | Text::Span | Text::Line | Paragraph | Cell
13
-
14
- attr_reader cells: Array[cell_content]
15
- attr_reader style: Style?
16
- attr_reader height: Integer?
17
- attr_reader top_margin: Integer?
18
- attr_reader bottom_margin: Integer?
19
-
20
- def self.new: (
21
- cells: Array[cell_content],
22
- ?style: Style?,
23
- ?height: Integer?,
24
- ?top_margin: Integer?,
25
- ?bottom_margin: Integer?
26
- ) -> Row
27
- end
28
- end
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: LGPL-3.0-or-later
6
- #++
7
-
8
- # SPDX-License-Identifier: AGPL-3.0-or-later
9
-
10
- module RatatuiRuby
11
- class Scrollbar < Data
12
- attr_reader content_length: Integer
13
- attr_reader position: Integer
14
- attr_reader orientation: Symbol
15
- attr_reader thumb_symbol: String
16
- attr_reader thumb_style: Style?
17
- attr_reader track_symbol: String?
18
- attr_reader track_style: Style?
19
- attr_reader begin_symbol: String?
20
- attr_reader begin_style: Style?
21
- attr_reader end_symbol: String?
22
- attr_reader end_style: Style?
23
- attr_reader style: Style?
24
- attr_reader block: Block?
25
-
26
- def self.new: (
27
- content_length: Numeric,
28
- position: Numeric,
29
- ?orientation: Symbol,
30
- ?thumb_symbol: String,
31
- ?thumb_style: Style?,
32
- ?track_symbol: String?,
33
- ?track_style: Style?,
34
- ?begin_symbol: String?,
35
- ?begin_style: Style?,
36
- ?end_symbol: String?,
37
- ?end_style: Style?,
38
- ?style: Style?,
39
- ?block: Block?
40
- ) -> Scrollbar
41
- end
42
- end