ratatui_ruby 1.4.0-x86_64-linux

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 (292) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +15 -0
  3. data/LICENSES/AGPL-3.0-or-later.txt +661 -0
  4. data/LICENSES/CC-BY-SA-4.0.txt +427 -0
  5. data/LICENSES/CC0-1.0.txt +121 -0
  6. data/LICENSES/LGPL-3.0-or-later.txt +304 -0
  7. data/LICENSES/MIT-0.txt +16 -0
  8. data/LICENSES/MIT.txt +21 -0
  9. data/REUSE.toml +42 -0
  10. data/exe/.gitkeep +0 -0
  11. data/ext/ratatui_ruby/.cargo/config.toml +13 -0
  12. data/ext/ratatui_ruby/.gitignore +4 -0
  13. data/ext/ratatui_ruby/Cargo.lock +1737 -0
  14. data/ext/ratatui_ruby/Cargo.toml +24 -0
  15. data/ext/ratatui_ruby/clippy.toml +7 -0
  16. data/ext/ratatui_ruby/extconf.rb +21 -0
  17. data/ext/ratatui_ruby/src/color.rs +82 -0
  18. data/ext/ratatui_ruby/src/errors.rs +28 -0
  19. data/ext/ratatui_ruby/src/events.rs +700 -0
  20. data/ext/ratatui_ruby/src/frame.rs +241 -0
  21. data/ext/ratatui_ruby/src/lib.rs +343 -0
  22. data/ext/ratatui_ruby/src/lib_header.rs +11 -0
  23. data/ext/ratatui_ruby/src/rendering.rs +158 -0
  24. data/ext/ratatui_ruby/src/string_width.rs +101 -0
  25. data/ext/ratatui_ruby/src/style.rs +469 -0
  26. data/ext/ratatui_ruby/src/terminal/capabilities.rs +46 -0
  27. data/ext/ratatui_ruby/src/terminal/init.rs +233 -0
  28. data/ext/ratatui_ruby/src/terminal/mod.rs +42 -0
  29. data/ext/ratatui_ruby/src/terminal/mutations.rs +158 -0
  30. data/ext/ratatui_ruby/src/terminal/queries.rs +231 -0
  31. data/ext/ratatui_ruby/src/terminal/query.rs +400 -0
  32. data/ext/ratatui_ruby/src/terminal/storage.rs +109 -0
  33. data/ext/ratatui_ruby/src/terminal/wrapper.rs +16 -0
  34. data/ext/ratatui_ruby/src/text.rs +225 -0
  35. data/ext/ratatui_ruby/src/widgets/barchart.rs +169 -0
  36. data/ext/ratatui_ruby/src/widgets/block.rs +41 -0
  37. data/ext/ratatui_ruby/src/widgets/calendar.rs +84 -0
  38. data/ext/ratatui_ruby/src/widgets/canvas.rs +183 -0
  39. data/ext/ratatui_ruby/src/widgets/center.rs +79 -0
  40. data/ext/ratatui_ruby/src/widgets/chart.rs +222 -0
  41. data/ext/ratatui_ruby/src/widgets/clear.rs +39 -0
  42. data/ext/ratatui_ruby/src/widgets/cursor.rs +32 -0
  43. data/ext/ratatui_ruby/src/widgets/gauge.rs +65 -0
  44. data/ext/ratatui_ruby/src/widgets/layout.rs +379 -0
  45. data/ext/ratatui_ruby/src/widgets/line_gauge.rs +100 -0
  46. data/ext/ratatui_ruby/src/widgets/list.rs +378 -0
  47. data/ext/ratatui_ruby/src/widgets/list_state.rs +173 -0
  48. data/ext/ratatui_ruby/src/widgets/mod.rs +26 -0
  49. data/ext/ratatui_ruby/src/widgets/overlay.rs +24 -0
  50. data/ext/ratatui_ruby/src/widgets/paragraph.rs +87 -0
  51. data/ext/ratatui_ruby/src/widgets/ratatui_logo.rs +40 -0
  52. data/ext/ratatui_ruby/src/widgets/ratatui_mascot.rs +55 -0
  53. data/ext/ratatui_ruby/src/widgets/scrollbar.rs +214 -0
  54. data/ext/ratatui_ruby/src/widgets/scrollbar_state.rs +169 -0
  55. data/ext/ratatui_ruby/src/widgets/sparkline.rs +127 -0
  56. data/ext/ratatui_ruby/src/widgets/table.rs +415 -0
  57. data/ext/ratatui_ruby/src/widgets/table_state.rs +203 -0
  58. data/ext/ratatui_ruby/src/widgets/tabs.rs +194 -0
  59. data/lib/ratatui_ruby/backend/window_size.rb +50 -0
  60. data/lib/ratatui_ruby/backend.rb +59 -0
  61. data/lib/ratatui_ruby/buffer/cell.rb +212 -0
  62. data/lib/ratatui_ruby/buffer.rb +149 -0
  63. data/lib/ratatui_ruby/cell.rb +208 -0
  64. data/lib/ratatui_ruby/debug.rb +215 -0
  65. data/lib/ratatui_ruby/draw.rb +63 -0
  66. data/lib/ratatui_ruby/event/focus_gained.rb +125 -0
  67. data/lib/ratatui_ruby/event/focus_lost.rb +127 -0
  68. data/lib/ratatui_ruby/event/key/character.rb +53 -0
  69. data/lib/ratatui_ruby/event/key/dwim.rb +301 -0
  70. data/lib/ratatui_ruby/event/key/media.rb +46 -0
  71. data/lib/ratatui_ruby/event/key/modifier.rb +107 -0
  72. data/lib/ratatui_ruby/event/key/navigation.rb +72 -0
  73. data/lib/ratatui_ruby/event/key/system.rb +47 -0
  74. data/lib/ratatui_ruby/event/key.rb +479 -0
  75. data/lib/ratatui_ruby/event/mouse.rb +291 -0
  76. data/lib/ratatui_ruby/event/none.rb +53 -0
  77. data/lib/ratatui_ruby/event/paste.rb +130 -0
  78. data/lib/ratatui_ruby/event/resize.rb +221 -0
  79. data/lib/ratatui_ruby/event/sync.rb +52 -0
  80. data/lib/ratatui_ruby/event.rb +163 -0
  81. data/lib/ratatui_ruby/frame.rb +257 -0
  82. data/lib/ratatui_ruby/labs/a11y.rb +182 -0
  83. data/lib/ratatui_ruby/labs/frame_a11y_capture.rb +50 -0
  84. data/lib/ratatui_ruby/labs.rb +47 -0
  85. data/lib/ratatui_ruby/layout/alignment.rb +91 -0
  86. data/lib/ratatui_ruby/layout/constraint.rb +337 -0
  87. data/lib/ratatui_ruby/layout/layout.rb +258 -0
  88. data/lib/ratatui_ruby/layout/position.rb +81 -0
  89. data/lib/ratatui_ruby/layout/rect.rb +733 -0
  90. data/lib/ratatui_ruby/layout/size.rb +62 -0
  91. data/lib/ratatui_ruby/layout.rb +29 -0
  92. data/lib/ratatui_ruby/list_state.rb +201 -0
  93. data/lib/ratatui_ruby/output_guard.rb +171 -0
  94. data/lib/ratatui_ruby/ratatui_ruby.so +0 -0
  95. data/lib/ratatui_ruby/scrollbar_state.rb +122 -0
  96. data/lib/ratatui_ruby/style/color.rb +149 -0
  97. data/lib/ratatui_ruby/style/style.rb +147 -0
  98. data/lib/ratatui_ruby/style.rb +19 -0
  99. data/lib/ratatui_ruby/symbols.rb +435 -0
  100. data/lib/ratatui_ruby/synthetic_events.rb +106 -0
  101. data/lib/ratatui_ruby/table_state.rb +251 -0
  102. data/lib/ratatui_ruby/terminal/capabilities.rb +316 -0
  103. data/lib/ratatui_ruby/terminal/viewport.rb +80 -0
  104. data/lib/ratatui_ruby/terminal.rb +66 -0
  105. data/lib/ratatui_ruby/terminal_lifecycle.rb +303 -0
  106. data/lib/ratatui_ruby/terminal_lifecycle.rb.bak +197 -0
  107. data/lib/ratatui_ruby/test_helper/event_injection.rb +241 -0
  108. data/lib/ratatui_ruby/test_helper/global_state.rb +111 -0
  109. data/lib/ratatui_ruby/test_helper/snapshot.rb +568 -0
  110. data/lib/ratatui_ruby/test_helper/snapshots/axis_labels_alignment.ansi +24 -0
  111. data/lib/ratatui_ruby/test_helper/snapshots/axis_labels_alignment.txt +24 -0
  112. data/lib/ratatui_ruby/test_helper/snapshots/barchart_styled_label.ansi +5 -0
  113. data/lib/ratatui_ruby/test_helper/snapshots/barchart_styled_label.txt +5 -0
  114. data/lib/ratatui_ruby/test_helper/snapshots/chart_rendering.ansi +24 -0
  115. data/lib/ratatui_ruby/test_helper/snapshots/chart_rendering.txt +24 -0
  116. data/lib/ratatui_ruby/test_helper/snapshots/half_block_marker.ansi +12 -0
  117. data/lib/ratatui_ruby/test_helper/snapshots/half_block_marker.txt +12 -0
  118. data/lib/ratatui_ruby/test_helper/snapshots/legend_position_bottom.ansi +12 -0
  119. data/lib/ratatui_ruby/test_helper/snapshots/legend_position_bottom.txt +12 -0
  120. data/lib/ratatui_ruby/test_helper/snapshots/legend_position_left.ansi +12 -0
  121. data/lib/ratatui_ruby/test_helper/snapshots/legend_position_left.txt +12 -0
  122. data/lib/ratatui_ruby/test_helper/snapshots/legend_position_right.ansi +12 -0
  123. data/lib/ratatui_ruby/test_helper/snapshots/legend_position_right.txt +12 -0
  124. data/lib/ratatui_ruby/test_helper/snapshots/legend_position_top.ansi +12 -0
  125. data/lib/ratatui_ruby/test_helper/snapshots/legend_position_top.txt +12 -0
  126. data/lib/ratatui_ruby/test_helper/snapshots/my_snapshot.txt +1 -0
  127. data/lib/ratatui_ruby/test_helper/snapshots/styled_axis_title.ansi +10 -0
  128. data/lib/ratatui_ruby/test_helper/snapshots/styled_axis_title.txt +10 -0
  129. data/lib/ratatui_ruby/test_helper/snapshots/styled_dataset_name.ansi +10 -0
  130. data/lib/ratatui_ruby/test_helper/snapshots/styled_dataset_name.txt +10 -0
  131. data/lib/ratatui_ruby/test_helper/style_assertions.rb +449 -0
  132. data/lib/ratatui_ruby/test_helper/subprocess_timeout.rb +35 -0
  133. data/lib/ratatui_ruby/test_helper/terminal.rb +187 -0
  134. data/lib/ratatui_ruby/test_helper/test_doubles.rb +86 -0
  135. data/lib/ratatui_ruby/test_helper.rb +115 -0
  136. data/lib/ratatui_ruby/text/line.rb +245 -0
  137. data/lib/ratatui_ruby/text/span.rb +158 -0
  138. data/lib/ratatui_ruby/text.rb +99 -0
  139. data/lib/ratatui_ruby/tui/buffer_factories.rb +22 -0
  140. data/lib/ratatui_ruby/tui/canvas_factories.rb +149 -0
  141. data/lib/ratatui_ruby/tui/core.rb +67 -0
  142. data/lib/ratatui_ruby/tui/layout_factories.rb +153 -0
  143. data/lib/ratatui_ruby/tui/state_factories.rb +77 -0
  144. data/lib/ratatui_ruby/tui/style_factories.rb +22 -0
  145. data/lib/ratatui_ruby/tui/text_factories.rb +86 -0
  146. data/lib/ratatui_ruby/tui/widget_factories.rb +272 -0
  147. data/lib/ratatui_ruby/tui.rb +106 -0
  148. data/lib/ratatui_ruby/version.rb +12 -0
  149. data/lib/ratatui_ruby/widgets/bar_chart/bar.rb +51 -0
  150. data/lib/ratatui_ruby/widgets/bar_chart/bar_group.rb +29 -0
  151. data/lib/ratatui_ruby/widgets/bar_chart.rb +308 -0
  152. data/lib/ratatui_ruby/widgets/block.rb +266 -0
  153. data/lib/ratatui_ruby/widgets/calendar.rb +88 -0
  154. data/lib/ratatui_ruby/widgets/canvas.rb +297 -0
  155. data/lib/ratatui_ruby/widgets/cell.rb +59 -0
  156. data/lib/ratatui_ruby/widgets/center.rb +71 -0
  157. data/lib/ratatui_ruby/widgets/chart.rb +172 -0
  158. data/lib/ratatui_ruby/widgets/clear.rb +66 -0
  159. data/lib/ratatui_ruby/widgets/coerceable_widget.rb +77 -0
  160. data/lib/ratatui_ruby/widgets/cursor.rb +54 -0
  161. data/lib/ratatui_ruby/widgets/gauge.rb +146 -0
  162. data/lib/ratatui_ruby/widgets/line_gauge.rb +158 -0
  163. data/lib/ratatui_ruby/widgets/list.rb +252 -0
  164. data/lib/ratatui_ruby/widgets/list_item.rb +55 -0
  165. data/lib/ratatui_ruby/widgets/overlay.rb +55 -0
  166. data/lib/ratatui_ruby/widgets/paragraph.rb +113 -0
  167. data/lib/ratatui_ruby/widgets/ratatui_logo.rb +35 -0
  168. data/lib/ratatui_ruby/widgets/ratatui_mascot.rb +40 -0
  169. data/lib/ratatui_ruby/widgets/row.rb +123 -0
  170. data/lib/ratatui_ruby/widgets/scrollbar.rb +147 -0
  171. data/lib/ratatui_ruby/widgets/shape/label.rb +80 -0
  172. data/lib/ratatui_ruby/widgets/sparkline.rb +153 -0
  173. data/lib/ratatui_ruby/widgets/table.rb +213 -0
  174. data/lib/ratatui_ruby/widgets/tabs.rb +91 -0
  175. data/lib/ratatui_ruby/widgets.rb +43 -0
  176. data/lib/ratatui_ruby.rb +555 -0
  177. data/sig/examples/app_all_events/app.rbs +11 -0
  178. data/sig/examples/app_all_events/model/app_model.rbs +23 -0
  179. data/sig/examples/app_all_events/model/event_entry.rbs +23 -0
  180. data/sig/examples/app_all_events/model/timestamp.rbs +11 -0
  181. data/sig/examples/app_all_events/view/app_view.rbs +8 -0
  182. data/sig/examples/app_all_events/view/controls_view.rbs +6 -0
  183. data/sig/examples/app_all_events/view/counts_view.rbs +6 -0
  184. data/sig/examples/app_all_events/view/live_view.rbs +6 -0
  185. data/sig/examples/app_all_events/view/log_view.rbs +6 -0
  186. data/sig/examples/app_all_events/view.rbs +14 -0
  187. data/sig/examples/app_cli_rich_moments/app.rbs +12 -0
  188. data/sig/examples/app_color_picker/app.rbs +17 -0
  189. data/sig/examples/app_external_editor/app.rbs +12 -0
  190. data/sig/examples/app_login_form/app.rbs +11 -0
  191. data/sig/examples/app_stateful_interaction/app.rbs +39 -0
  192. data/sig/examples/verify_quickstart_dsl/app.rbs +17 -0
  193. data/sig/examples/verify_quickstart_lifecycle/app.rbs +17 -0
  194. data/sig/examples/verify_readme_usage/app.rbs +17 -0
  195. data/sig/examples/widget_block_demo/app.rbs +38 -0
  196. data/sig/examples/widget_box_demo/app.rbs +17 -0
  197. data/sig/examples/widget_calendar_demo/app.rbs +17 -0
  198. data/sig/examples/widget_cell_demo/app.rbs +17 -0
  199. data/sig/examples/widget_chart_demo/app.rbs +17 -0
  200. data/sig/examples/widget_gauge_demo/app.rbs +17 -0
  201. data/sig/examples/widget_layout_split/app.rbs +16 -0
  202. data/sig/examples/widget_line_gauge_demo/app.rbs +17 -0
  203. data/sig/examples/widget_list_demo/app.rbs +17 -0
  204. data/sig/examples/widget_map_demo/app.rbs +17 -0
  205. data/sig/examples/widget_popup_demo/app.rbs +17 -0
  206. data/sig/examples/widget_ratatui_logo_demo/app.rbs +17 -0
  207. data/sig/examples/widget_ratatui_mascot_demo/app.rbs +17 -0
  208. data/sig/examples/widget_rect/app.rbs +18 -0
  209. data/sig/examples/widget_render/app.rbs +16 -0
  210. data/sig/examples/widget_rich_text/app.rbs +17 -0
  211. data/sig/examples/widget_scroll_text/app.rbs +17 -0
  212. data/sig/examples/widget_scrollbar_demo/app.rbs +17 -0
  213. data/sig/examples/widget_sparkline_demo/app.rbs +16 -0
  214. data/sig/examples/widget_style_colors/app.rbs +20 -0
  215. data/sig/examples/widget_table_demo/app.rbs +17 -0
  216. data/sig/examples/widget_text_width/app.rbs +16 -0
  217. data/sig/generated/event_key_predicates.rbs +1348 -0
  218. data/sig/manifest.yaml +5 -0
  219. data/sig/patches/data.rbs +26 -0
  220. data/sig/patches/debugger__.rbs +8 -0
  221. data/sig/ratatui_ruby/backend/window_size.rbs +17 -0
  222. data/sig/ratatui_ruby/backend.rbs +12 -0
  223. data/sig/ratatui_ruby/buffer/cell.rbs +46 -0
  224. data/sig/ratatui_ruby/buffer.rbs +18 -0
  225. data/sig/ratatui_ruby/cell.rbs +44 -0
  226. data/sig/ratatui_ruby/clear.rbs +18 -0
  227. data/sig/ratatui_ruby/constraint.rbs +26 -0
  228. data/sig/ratatui_ruby/debug.rbs +45 -0
  229. data/sig/ratatui_ruby/draw.rbs +30 -0
  230. data/sig/ratatui_ruby/event.rbs +249 -0
  231. data/sig/ratatui_ruby/frame.rbs +23 -0
  232. data/sig/ratatui_ruby/interfaces.rbs +25 -0
  233. data/sig/ratatui_ruby/labs.rbs +90 -0
  234. data/sig/ratatui_ruby/layout/alignment.rbs +26 -0
  235. data/sig/ratatui_ruby/layout/constraint.rbs +39 -0
  236. data/sig/ratatui_ruby/layout/layout.rbs +45 -0
  237. data/sig/ratatui_ruby/layout/position.rbs +18 -0
  238. data/sig/ratatui_ruby/layout/rect.rbs +64 -0
  239. data/sig/ratatui_ruby/layout/size.rbs +18 -0
  240. data/sig/ratatui_ruby/list_state.rbs +23 -0
  241. data/sig/ratatui_ruby/output_guard.rbs +23 -0
  242. data/sig/ratatui_ruby/ratatui_ruby.rbs +113 -0
  243. data/sig/ratatui_ruby/rect.rbs +17 -0
  244. data/sig/ratatui_ruby/scrollbar_state.rbs +24 -0
  245. data/sig/ratatui_ruby/session.rbs +93 -0
  246. data/sig/ratatui_ruby/style/color.rbs +22 -0
  247. data/sig/ratatui_ruby/style/style.rbs +29 -0
  248. data/sig/ratatui_ruby/symbols.rbs +141 -0
  249. data/sig/ratatui_ruby/synthetic_events.rbs +24 -0
  250. data/sig/ratatui_ruby/table_state.rbs +27 -0
  251. data/sig/ratatui_ruby/terminal/capabilities.rbs +38 -0
  252. data/sig/ratatui_ruby/terminal/viewport.rbs +33 -0
  253. data/sig/ratatui_ruby/terminal_lifecycle.rbs +39 -0
  254. data/sig/ratatui_ruby/test_helper/event_injection.rbs +22 -0
  255. data/sig/ratatui_ruby/test_helper/snapshot.rbs +37 -0
  256. data/sig/ratatui_ruby/test_helper/style_assertions.rbs +77 -0
  257. data/sig/ratatui_ruby/test_helper/terminal.rbs +20 -0
  258. data/sig/ratatui_ruby/test_helper/test_doubles.rbs +32 -0
  259. data/sig/ratatui_ruby/test_helper.rbs +18 -0
  260. data/sig/ratatui_ruby/text/line.rbs +27 -0
  261. data/sig/ratatui_ruby/text/span.rbs +23 -0
  262. data/sig/ratatui_ruby/text.rbs +12 -0
  263. data/sig/ratatui_ruby/tui/buffer_factories.rbs +16 -0
  264. data/sig/ratatui_ruby/tui/canvas_factories.rbs +38 -0
  265. data/sig/ratatui_ruby/tui/core.rbs +23 -0
  266. data/sig/ratatui_ruby/tui/layout_factories.rbs +39 -0
  267. data/sig/ratatui_ruby/tui/state_factories.rbs +23 -0
  268. data/sig/ratatui_ruby/tui/style_factories.rbs +18 -0
  269. data/sig/ratatui_ruby/tui/text_factories.rbs +23 -0
  270. data/sig/ratatui_ruby/tui/widget_factories.rbs +138 -0
  271. data/sig/ratatui_ruby/tui.rbs +25 -0
  272. data/sig/ratatui_ruby/version.rbs +12 -0
  273. data/sig/ratatui_ruby/widgets/bar_chart.rbs +95 -0
  274. data/sig/ratatui_ruby/widgets/block.rbs +51 -0
  275. data/sig/ratatui_ruby/widgets/calendar.rbs +45 -0
  276. data/sig/ratatui_ruby/widgets/canvas.rbs +95 -0
  277. data/sig/ratatui_ruby/widgets/chart.rbs +91 -0
  278. data/sig/ratatui_ruby/widgets/coerceable_widget.rbs +26 -0
  279. data/sig/ratatui_ruby/widgets/gauge.rbs +44 -0
  280. data/sig/ratatui_ruby/widgets/line_gauge.rbs +48 -0
  281. data/sig/ratatui_ruby/widgets/list.rbs +63 -0
  282. data/sig/ratatui_ruby/widgets/misc.rbs +158 -0
  283. data/sig/ratatui_ruby/widgets/paragraph.rbs +45 -0
  284. data/sig/ratatui_ruby/widgets/row.rbs +43 -0
  285. data/sig/ratatui_ruby/widgets/scrollbar.rbs +53 -0
  286. data/sig/ratatui_ruby/widgets/shape/label.rbs +37 -0
  287. data/sig/ratatui_ruby/widgets/sparkline.rbs +45 -0
  288. data/sig/ratatui_ruby/widgets/table.rbs +78 -0
  289. data/sig/ratatui_ruby/widgets/tabs.rbs +44 -0
  290. data/sig/ratatui_ruby/widgets.rbs +16 -0
  291. data/vendor/goodcop/base.yml +1047 -0
  292. metadata +729 -0
@@ -0,0 +1,141 @@
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
+ module RatatuiRuby
9
+ module Symbols
10
+ module Shade
11
+ EMPTY: String
12
+ LIGHT: String
13
+ MEDIUM: String
14
+ DARK: String
15
+ FULL: String
16
+ end
17
+
18
+ # Type alias for line set hashes
19
+ type line_set = {
20
+ vertical: String,
21
+ horizontal: String,
22
+ top_right: String,
23
+ top_left: String,
24
+ bottom_right: String,
25
+ bottom_left: String,
26
+ vertical_left: String,
27
+ vertical_right: String,
28
+ horizontal_down: String,
29
+ horizontal_up: String,
30
+ cross: String
31
+ }
32
+
33
+ module Line
34
+ # Individual character constants
35
+ VERTICAL: String
36
+ DOUBLE_VERTICAL: String
37
+ THICK_VERTICAL: String
38
+ HORIZONTAL: String
39
+ DOUBLE_HORIZONTAL: String
40
+ THICK_HORIZONTAL: String
41
+ TOP_RIGHT: String
42
+ ROUNDED_TOP_RIGHT: String
43
+ DOUBLE_TOP_RIGHT: String
44
+ THICK_TOP_RIGHT: String
45
+ TOP_LEFT: String
46
+ ROUNDED_TOP_LEFT: String
47
+ DOUBLE_TOP_LEFT: String
48
+ THICK_TOP_LEFT: String
49
+ BOTTOM_RIGHT: String
50
+ ROUNDED_BOTTOM_RIGHT: String
51
+ DOUBLE_BOTTOM_RIGHT: String
52
+ THICK_BOTTOM_RIGHT: String
53
+ BOTTOM_LEFT: String
54
+ ROUNDED_BOTTOM_LEFT: String
55
+ DOUBLE_BOTTOM_LEFT: String
56
+ THICK_BOTTOM_LEFT: String
57
+ VERTICAL_LEFT: String
58
+ DOUBLE_VERTICAL_LEFT: String
59
+ THICK_VERTICAL_LEFT: String
60
+ VERTICAL_RIGHT: String
61
+ DOUBLE_VERTICAL_RIGHT: String
62
+ THICK_VERTICAL_RIGHT: String
63
+ HORIZONTAL_DOWN: String
64
+ DOUBLE_HORIZONTAL_DOWN: String
65
+ THICK_HORIZONTAL_DOWN: String
66
+ HORIZONTAL_UP: String
67
+ DOUBLE_HORIZONTAL_UP: String
68
+ THICK_HORIZONTAL_UP: String
69
+ CROSS: String
70
+ DOUBLE_CROSS: String
71
+ THICK_CROSS: String
72
+
73
+ # Predefined sets
74
+ NORMAL: line_set
75
+ ROUNDED: line_set
76
+ DOUBLE: line_set
77
+ THICK: line_set
78
+ end
79
+
80
+ # Type alias for bar set hashes
81
+ type bar_set = {
82
+ full: String,
83
+ seven_eighths: String,
84
+ three_quarters: String,
85
+ five_eighths: String,
86
+ half: String,
87
+ three_eighths: String,
88
+ one_quarter: String,
89
+ one_eighth: String,
90
+ empty: String
91
+ }
92
+
93
+ module Bar
94
+ # Individual character constants
95
+ FULL: String
96
+ SEVEN_EIGHTHS: String
97
+ THREE_QUARTERS: String
98
+ FIVE_EIGHTHS: String
99
+ HALF: String
100
+ THREE_EIGHTHS: String
101
+ ONE_QUARTER: String
102
+ ONE_EIGHTH: String
103
+
104
+ # Predefined sets
105
+ NINE_LEVELS: bar_set
106
+ THREE_LEVELS: bar_set
107
+ end
108
+
109
+ module Block
110
+ # Individual character constants
111
+ FULL: String
112
+ SEVEN_EIGHTHS: String
113
+ THREE_QUARTERS: String
114
+ FIVE_EIGHTHS: String
115
+ HALF: String
116
+ THREE_EIGHTHS: String
117
+ ONE_QUARTER: String
118
+ ONE_EIGHTH: String
119
+
120
+ # Predefined sets (same structure as bar_set)
121
+ NINE_LEVELS: bar_set
122
+ THREE_LEVELS: bar_set
123
+ end
124
+
125
+ # Type alias for scrollbar set hashes
126
+ type scrollbar_set = {
127
+ track: String,
128
+ thumb: String,
129
+ begin_char: String,
130
+ end_char: String
131
+ }
132
+
133
+ module Scrollbar
134
+ # Predefined sets
135
+ DOUBLE_VERTICAL: scrollbar_set
136
+ DOUBLE_HORIZONTAL: scrollbar_set
137
+ VERTICAL: scrollbar_set
138
+ HORIZONTAL: scrollbar_set
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,24 @@
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
+ # Synthetic event queue for injecting events into the event loop.
12
+ # Used primarily for testing and the andThen-like integration pattern.
13
+ module SyntheticEvents
14
+ @queue: Array[Event]
15
+ @inline_sync: bool
16
+
17
+ def self.inline_sync!: () -> void
18
+ def self.inline_sync?: () -> bool
19
+ def self.push: (Event event) -> void
20
+ def self.pop: () -> Event?
21
+ def self.clear: () -> void
22
+ def self.pending?: () -> bool
23
+ end
24
+ end
@@ -0,0 +1,27 @@
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 TableState
12
+ def self.new: (?Integer? selected) -> TableState
13
+ def self.with_selected_cell: ([Integer, Integer]? cell) -> TableState
14
+ def select: (Integer? index) -> nil
15
+ def selected: () -> Integer?
16
+ def select_column: (Integer? index) -> nil
17
+ def selected_column: () -> Integer?
18
+ def selected_cell: () -> [Integer, Integer]?
19
+ def select_next_column: () -> nil
20
+ def select_previous_column: () -> nil
21
+ def select_first_column: () -> nil
22
+ def select_last_column: () -> nil
23
+ def offset: () -> Integer
24
+ def scroll_down_by: (Integer n) -> nil
25
+ def scroll_up_by: (Integer n) -> nil
26
+ end
27
+ end
@@ -0,0 +1,38 @@
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
+ module RatatuiRuby
9
+ class Terminal
10
+ # Environment-based terminal capability detection.
11
+ # Provides class methods for detecting terminal capabilities.
12
+ module Capabilities
13
+ def tty?: () -> bool
14
+ def dumb?: () -> bool
15
+ def no_color?: () -> bool
16
+ def force_color?: () -> bool
17
+ def interactive?: () -> bool
18
+ def available_color_count: () -> Integer
19
+ def color_support: () -> (:none | :basic | :ansi256 | :truecolor)
20
+ def supports_keyboard_enhancement?: () -> bool
21
+ def force_color_output: (bool enable) -> void
22
+
23
+ private
24
+
25
+ # FFI methods (defined in Rust, exposed on Terminal singleton)
26
+ def _available_color_count: () -> Integer
27
+ def _supports_keyboard_enhancement: () -> bool
28
+ def _force_color_output: (bool enable) -> void
29
+ end
30
+
31
+ extend Capabilities
32
+
33
+ private
34
+
35
+ # FFI singleton method for Backend.window_size
36
+ def self._terminal_window_size: () -> [Integer, Integer, Integer, Integer]?
37
+ end
38
+ end
@@ -0,0 +1,33 @@
1
+ # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
2
+ # SPDX-License-Identifier: LGPL-3.0-or-later
3
+
4
+ module RatatuiRuby
5
+ class Terminal
6
+ @viewport: Terminal::Viewport
7
+ @terminal_id: Integer
8
+
9
+ attr_reader terminal_id: Integer
10
+
11
+ def initialize: (?viewport: (Terminal::Viewport | :fullscreen | :inline)?, ?height: Integer?) -> void
12
+ def size: () -> Layout::Rect
13
+
14
+ # Private native methods (defined in Rust)
15
+ def self._init_test_terminal_instance: (Integer width, Integer height, String viewport_type, Integer? viewport_height) -> Integer
16
+ def self._get_terminal_size_instance: (Integer terminal_id) -> Layout::Rect
17
+
18
+ private def resolve_viewport: ((Terminal::Viewport | :fullscreen | :inline)? viewport, Integer? height) -> Terminal::Viewport
19
+
20
+ class Viewport < Data
21
+ attr_reader type: Symbol
22
+ attr_reader height: Integer?
23
+
24
+ def self.fullscreen: () -> Viewport
25
+ def self.inline: (Integer height) -> Viewport
26
+
27
+ def initialize: (type: Symbol, ?height: Integer?) -> void
28
+
29
+ def fullscreen?: () -> bool
30
+ def inline?: () -> bool
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,39 @@
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
+ # Terminal lifecycle management for TUI sessions.
12
+ # Provides methods to initialize and restore the terminal state.
13
+ module TerminalLifecycle
14
+ @tui_session_active: bool?
15
+ @headless_mode: bool?
16
+
17
+ def init_terminal: (?focus_events: bool, ?bracketed_paste: bool, ?viewport: (Terminal::Viewport | :fullscreen | :inline)?, ?height: Integer?) -> void
18
+ def restore_terminal: () -> void
19
+ def terminal_active?: () -> (bool | nil)
20
+ def init_test_terminal: (Integer width, Integer height, ?String viewport_type, ?Integer? viewport_height) -> void
21
+ def run: (?focus_events: bool, ?bracketed_paste: bool, ?viewport: (Terminal::Viewport | :fullscreen | :inline)?, ?height: Integer?) { (TUI) -> void } -> void
22
+ def insert_before: (Integer height, ?widget? widget) ?{ () -> widget } -> void
23
+ def cursor_position=: (Layout::Position | [Integer, Integer] position) -> void
24
+ def cursor_position: () -> Layout::Position
25
+ def set_cursor_position: (Integer x, Integer y) -> void
26
+ def get_cursor_position: () -> [Integer, Integer]
27
+
28
+ # Private native methods
29
+ def _init_terminal: (bool focus_events, bool bracketed_paste, String viewport_type, Integer? viewport_height) -> void
30
+ def _init_test_terminal: (Integer width, Integer height, String viewport_type, Integer? viewport_height) -> void
31
+ def _restore_terminal: () -> void
32
+ def _get_viewport_type: () -> String
33
+ def _insert_before: (Integer height, widget? content) -> void
34
+ def resolve_viewport: ((Terminal::Viewport | :fullscreen | :inline)? viewport, Integer? height) -> Terminal::Viewport
35
+ def flush_warnings: () -> void
36
+ def flush_panic_info: () -> void
37
+ end
38
+ end
39
+
@@ -0,0 +1,22 @@
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
+ module TestHelper
12
+ module EventInjection
13
+ def inject_event: (Event event) -> void
14
+ def inject_mouse: (x: Integer, y: Integer, ?kind: Symbol, ?modifiers: Array[String], ?button: Symbol) -> void
15
+ def inject_click: (x: Integer, y: Integer, ?modifiers: Array[String]) -> void
16
+ def inject_right_click: (x: Integer, y: Integer, ?modifiers: Array[String]) -> void
17
+ def inject_drag: (x: Integer, y: Integer, ?modifiers: Array[String], ?button: Symbol) -> void
18
+ def inject_keys: (*(String | Symbol | { code: String, ?modifiers: Array[String] } | Event::Key) args) -> void
19
+ alias inject_key inject_keys
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,37 @@
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
+ module TestHelper
12
+ module Snapshot
13
+ include ::Minitest::Assertions
14
+
15
+ # Public assertions
16
+ def assert_plain_snapshot: (String name, ?String? msg, ?snapshot_dir: String?) ?{ (Array[String]) -> Array[String] } -> void
17
+ def assert_screen_matches: ((String | Array[String]) expected, ?String? msg) ?{ (Array[String]) -> Array[String] } -> void
18
+ def assert_rich_snapshot: (String name, ?String? msg, ?snapshot_dir: String?) ?{ (Array[String]) -> Array[String] } -> void
19
+ def assert_snapshots: (String name, ?String? msg) ?{ (Array[String]) -> Array[String] } -> void
20
+ def render_rich_buffer: () -> String
21
+
22
+ # Methods available via mixin context (from Minitest::Assertions)
23
+ # untyped: assert_equal from Minitest compares any two values
24
+ def assert_equal: (untyped expected, untyped actual, ?String? msg) -> void
25
+
26
+ # Methods available via mixin context (from Terminal)
27
+ def buffer_content: () -> Array[String]
28
+
29
+ private
30
+
31
+ def _render_buffer_with_ansi: () -> String
32
+ def _ansi_for_color: ((Symbol | String)?, Symbol layer) -> String
33
+ def _ansi_named_color: (Symbol name, bool is_fg) -> String
34
+ def _ansi_for_modifiers: (Array[Symbol]?) -> String
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,77 @@
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
+ # untyped: **untyped splat - assertions accept any attribute combination (fg, bg, bold, etc.)
11
+
12
+ module RatatuiRuby
13
+ module TestHelper
14
+ module StyleAssertions
15
+ include ::Minitest::Assertions
16
+
17
+ # From Terminal module
18
+ def get_cell: (Integer x, Integer y) -> Hash[Symbol, untyped]
19
+
20
+ def assert_cell_style: (Integer x, Integer y, **untyped expected_attributes) -> void
21
+ def assert_color: (Symbol | Integer | String expected, x: Integer, y: Integer, ?layer: Symbol) -> void
22
+ def assert_area_style: (Layout::Rect | Hash[Symbol, Integer] area, **untyped attributes) -> void
23
+ def assert_fg_color: (Symbol | Integer | String expected, Integer x, Integer y) -> void
24
+ alias assert_fg assert_fg_color
25
+ def assert_bg_color: (Symbol | Integer | String expected, Integer x, Integer y) -> void
26
+ alias assert_bg assert_bg_color
27
+ def assert_bold: (Integer x, Integer y) -> void
28
+ def assert_italic: (Integer x, Integer y) -> void
29
+ def assert_underlined: (Integer x, Integer y) -> void
30
+ alias assert_underline assert_underlined
31
+ def assert_dim: (Integer x, Integer y) -> void
32
+ def assert_reversed: (Integer x, Integer y) -> void
33
+ alias assert_inverse assert_reversed
34
+ alias assert_inverse_video assert_reversed
35
+ def assert_crossed_out: (Integer x, Integer y) -> void
36
+ alias assert_strikethrough assert_crossed_out
37
+ alias assert_strike assert_crossed_out
38
+ def assert_hidden: (Integer x, Integer y) -> void
39
+ def assert_slow_blink: (Integer x, Integer y) -> void
40
+ alias assert_blink assert_slow_blink
41
+ def assert_rapid_blink: (Integer x, Integer y) -> void
42
+
43
+ def assert_black: (Integer x, Integer y) -> void
44
+ def assert_bg_black: (Integer x, Integer y) -> void
45
+ def assert_red: (Integer x, Integer y) -> void
46
+ def assert_bg_red: (Integer x, Integer y) -> void
47
+ def assert_green: (Integer x, Integer y) -> void
48
+ def assert_bg_green: (Integer x, Integer y) -> void
49
+ def assert_yellow: (Integer x, Integer y) -> void
50
+ def assert_bg_yellow: (Integer x, Integer y) -> void
51
+ def assert_blue: (Integer x, Integer y) -> void
52
+ def assert_bg_blue: (Integer x, Integer y) -> void
53
+ def assert_magenta: (Integer x, Integer y) -> void
54
+ def assert_bg_magenta: (Integer x, Integer y) -> void
55
+ def assert_cyan: (Integer x, Integer y) -> void
56
+ def assert_bg_cyan: (Integer x, Integer y) -> void
57
+ def assert_gray: (Integer x, Integer y) -> void
58
+ def assert_bg_gray: (Integer x, Integer y) -> void
59
+ def assert_dark_gray: (Integer x, Integer y) -> void
60
+ def assert_bg_dark_gray: (Integer x, Integer y) -> void
61
+ def assert_light_red: (Integer x, Integer y) -> void
62
+ def assert_bg_light_red: (Integer x, Integer y) -> void
63
+ def assert_light_green: (Integer x, Integer y) -> void
64
+ def assert_bg_light_green: (Integer x, Integer y) -> void
65
+ def assert_light_yellow: (Integer x, Integer y) -> void
66
+ def assert_bg_light_yellow: (Integer x, Integer y) -> void
67
+ def assert_light_blue: (Integer x, Integer y) -> void
68
+ def assert_bg_light_blue: (Integer x, Integer y) -> void
69
+ def assert_light_magenta: (Integer x, Integer y) -> void
70
+ def assert_bg_light_magenta: (Integer x, Integer y) -> void
71
+ def assert_light_cyan: (Integer x, Integer y) -> void
72
+ def assert_bg_light_cyan: (Integer x, Integer y) -> void
73
+ def assert_white: (Integer x, Integer y) -> void
74
+ def assert_bg_white: (Integer x, Integer y) -> void
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,20 @@
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
+ module TestHelper
12
+ module Terminal
13
+ def with_test_terminal: (?Integer width, ?Integer height, ?timeout: Integer?) ?{ () -> void } -> void
14
+ def buffer_content: () -> Array[String]
15
+ def cursor_position: () -> { x: Integer, y: Integer }
16
+ def get_cell: (Integer x, Integer y) -> Cell
17
+ def print_buffer: () -> void
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,32 @@
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
+ # untyped: widget parameter/storage - test mocks accept any widget type for flexibility
11
+
12
+ module RatatuiRuby
13
+ module TestHelper
14
+ module TestDoubles
15
+ class MockFrame < Data
16
+ attr_accessor rendered_widgets: Array[{ widget: untyped, area: Layout::Rect }]
17
+ def self.new: (?rendered_widgets: Array[{ widget: untyped, area: Layout::Rect }]) -> MockFrame
18
+ def initialize: (?rendered_widgets: Array[{ widget: untyped, area: Layout::Rect }]) -> void
19
+ def render_widget: (untyped widget, Layout::Rect area) -> void
20
+ end
21
+
22
+ class StubRect < Data
23
+ attr_accessor x: Integer
24
+ attr_accessor y: Integer
25
+ attr_accessor width: Integer
26
+ attr_accessor height: Integer
27
+ def self.new: (?x: Integer, ?y: Integer, ?width: Integer, ?height: Integer) -> StubRect
28
+ def initialize: (?x: Integer, ?y: Integer, ?width: Integer, ?height: Integer) -> void
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,18 @@
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
+ module TestHelper
12
+ include Terminal
13
+ include Snapshot
14
+ include EventInjection
15
+ include StyleAssertions
16
+ include TestDoubles
17
+ end
18
+ end
@@ -0,0 +1,27 @@
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
+ module RatatuiRuby
9
+ module Text
10
+ class Line < Data
11
+ attr_reader spans: Array[Span]
12
+ attr_reader alignment: Symbol?
13
+ attr_reader style: Style::Style?
14
+
15
+ def self.new: (?spans: Array[Span], ?alignment: Symbol?, ?style: Style::Style?) -> Line
16
+ def initialize: (?spans: Array[Span], ?alignment: Symbol?, ?style: Style::Style?) -> void
17
+ def self.from_string: (String, ?alignment: Symbol?) -> Line
18
+ def width: () -> Integer
19
+ def left_aligned: () -> Line
20
+ def centered: () -> Line
21
+ def right_aligned: () -> Line
22
+ def push_span: (Span) -> Line
23
+ def patch_style: (Style::Style?) -> Line
24
+ def reset_style: () -> Line
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,23 @@
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
+ module RatatuiRuby
9
+ module Text
10
+ class Span < Data
11
+ attr_reader content: String
12
+ attr_reader style: Style::Style?
13
+
14
+ def self.new: (content: String, ?style: Style::Style?) -> Span
15
+ def initialize: (content: String, ?style: Style::Style?) -> void
16
+ def self.styled: (String, ?Style?) -> Span
17
+ def width: () -> Integer
18
+ def self.raw: (String) -> Span
19
+ def patch_style: (Style::Style?) -> Span
20
+ def reset_style: () -> Span
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,12 @@
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
+ module RatatuiRuby
9
+ module Text
10
+ def self.width: (String) -> Integer
11
+ end
12
+ end
@@ -0,0 +1,16 @@
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 TUI
12
+ module BufferFactories
13
+ def cell: (?symbol: String?, ?char: String?, ?fg: (Symbol | String | nil), ?bg: (Symbol | String | nil), ?modifiers: Array[String]) -> Buffer::Cell
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,38 @@
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 TUI
12
+ module CanvasFactories
13
+ # Core shape methods
14
+ def shape_map: (?color: (String | Symbol), ?resolution: Symbol) -> Widgets::Shape::Map
15
+ def shape_line: (x1: _ToF, y1: _ToF, x2: _ToF, y2: _ToF, color: (String | Symbol)) -> Widgets::Shape::Line
16
+ def shape_point: (x: _ToF, y: _ToF) -> Widgets::Shape::Point
17
+ def shape_circle: (x: _ToF, y: _ToF, radius: _ToF, color: (String | Symbol)) -> Widgets::Shape::Circle
18
+ def shape_rectangle: (x: _ToF, y: _ToF, width: _ToF, height: _ToF, color: (String | Symbol)) -> Widgets::Shape::Rectangle
19
+ def shape_label: (x: _ToF, y: _ToF, ?text: String?, ?line: Text::Line?) -> Widgets::Shape::Label
20
+
21
+ # Terse aliases (DWIM) - no rectangle to avoid confusion with Layout::Rect
22
+ alias circle shape_circle
23
+ alias point shape_point
24
+ alias map shape_map
25
+ def label: (?untyped first, **untyped kwargs) -> Widgets::Shape::Label
26
+
27
+ # Bidirectional aliases (*_shape)
28
+ alias circle_shape shape_circle
29
+ alias point_shape shape_point
30
+ alias rectangle_shape shape_rectangle
31
+ alias map_shape shape_map
32
+ alias label_shape label
33
+
34
+ # Shape dispatcher (TIMTOWTDI pattern)
35
+ def shape: (Symbol, **untyped) -> untyped
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,23 @@
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 TUI
12
+ module Core
13
+ def draw: (?widget? tree) -> void
14
+ | () { (Frame) -> void } -> void
15
+ def poll_event: (?timeout: Float) -> Event
16
+ def get_cell_at: (Integer x, Integer y) -> Buffer::Cell
17
+ def draw_cell: (Integer x, Integer y, Buffer::Cell cell) -> Draw::CellCmd
18
+ def insert_before: (Integer height, ?widget? widget) ?{ () -> widget } -> void
19
+ def terminal_area: () -> RatatuiRuby::Layout::Rect
20
+ def viewport_area: () -> RatatuiRuby::Layout::Rect
21
+ end
22
+ end
23
+ end