ratatui_ruby 0.8.0 → 0.9.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 (352) hide show
  1. checksums.yaml +4 -4
  2. data/.builds/ruby-3.2.yml +2 -2
  3. data/.builds/ruby-3.3.yml +2 -2
  4. data/.builds/ruby-3.4.yml +2 -2
  5. data/.builds/ruby-4.0.0.yml +2 -2
  6. data/.pre-commit-config.yaml +1 -1
  7. data/AGENTS.md +3 -3
  8. data/CHANGELOG.md +53 -1
  9. data/LICENSES/LGPL-3.0-or-later.txt +304 -0
  10. data/LICENSES/MIT-0.txt +16 -0
  11. data/README.md +33 -5
  12. data/Rakefile +1 -1
  13. data/doc/concepts/application_architecture.md +44 -3
  14. data/doc/concepts/application_testing.md +43 -1
  15. data/doc/concepts/async.md +32 -2
  16. data/doc/concepts/custom_widgets.md +247 -0
  17. data/doc/concepts/event_handling.md +32 -3
  18. data/doc/concepts/interactive_design.md +32 -2
  19. data/doc/contributors/auditing/parity.md +7 -1
  20. data/doc/contributors/design/ruby_frontend.md +85 -1
  21. data/doc/contributors/design/rust_backend.md +67 -1
  22. data/doc/contributors/developing_examples.md +56 -2
  23. data/doc/contributors/documentation_style.md +20 -3
  24. data/doc/contributors/future_work.md +169 -0
  25. data/doc/contributors/index.md +1 -1
  26. data/doc/contributors/v1.0.0_blockers.md +15 -175
  27. data/doc/getting_started/quickstart.md +22 -4
  28. data/doc/getting_started/why.md +1 -1
  29. data/doc/index.md +2 -1
  30. data/doc/troubleshooting/debugging.md +32 -2
  31. data/doc/troubleshooting/terminal_limitations.md +8 -2
  32. data/doc/troubleshooting/tui_output.md +42 -0
  33. data/examples/app_all_events/README.md +14 -2
  34. data/examples/app_all_events/app.rb +1 -1
  35. data/examples/app_all_events/model/app_model.rb +1 -1
  36. data/examples/app_all_events/model/event_color_cycle.rb +1 -1
  37. data/examples/app_all_events/model/event_entry.rb +1 -1
  38. data/examples/app_all_events/model/msg.rb +1 -1
  39. data/examples/app_all_events/model/timestamp.rb +1 -1
  40. data/examples/app_all_events/update.rb +1 -1
  41. data/examples/app_all_events/view/app_view.rb +1 -1
  42. data/examples/app_all_events/view/controls_view.rb +1 -1
  43. data/examples/app_all_events/view/counts_view.rb +1 -1
  44. data/examples/app_all_events/view/live_view.rb +1 -1
  45. data/examples/app_all_events/view/log_view.rb +1 -1
  46. data/examples/app_all_events/view.rb +1 -1
  47. data/examples/app_color_picker/README.md +20 -2
  48. data/examples/app_color_picker/app.rb +1 -1
  49. data/examples/app_color_picker/clipboard.rb +1 -1
  50. data/examples/app_color_picker/color.rb +1 -1
  51. data/examples/app_color_picker/controls.rb +1 -1
  52. data/examples/app_color_picker/copy_dialog.rb +1 -1
  53. data/examples/app_color_picker/export_pane.rb +1 -1
  54. data/examples/app_color_picker/harmony.rb +1 -1
  55. data/examples/app_color_picker/input.rb +1 -1
  56. data/examples/app_color_picker/main_container.rb +1 -1
  57. data/examples/app_color_picker/palette.rb +1 -1
  58. data/examples/app_login_form/README.md +8 -2
  59. data/examples/app_login_form/app.rb +1 -1
  60. data/examples/app_stateful_interaction/README.md +2 -2
  61. data/examples/app_stateful_interaction/app.rb +71 -17
  62. data/examples/timeout_demo.rb +1 -1
  63. data/examples/verify_quickstart_dsl/README.md +6 -0
  64. data/examples/verify_quickstart_dsl/app.rb +3 -3
  65. data/examples/verify_quickstart_layout/README.md +6 -0
  66. data/examples/verify_quickstart_layout/app.rb +3 -3
  67. data/examples/verify_quickstart_lifecycle/README.md +6 -0
  68. data/examples/verify_quickstart_lifecycle/app.rb +3 -3
  69. data/examples/verify_readme_usage/README.md +6 -0
  70. data/examples/verify_readme_usage/app.rb +3 -3
  71. data/examples/widget_barchart/README.md +6 -0
  72. data/examples/widget_barchart/app.rb +2 -2
  73. data/examples/widget_block/README.md +7 -1
  74. data/examples/widget_block/app.rb +2 -2
  75. data/examples/widget_box/README.md +6 -0
  76. data/examples/widget_box/app.rb +9 -6
  77. data/examples/widget_calendar/README.md +6 -0
  78. data/examples/widget_calendar/app.rb +2 -2
  79. data/examples/widget_canvas/README.md +4 -0
  80. data/examples/widget_canvas/app.rb +2 -2
  81. data/examples/widget_cell/README.md +6 -0
  82. data/examples/widget_cell/app.rb +2 -3
  83. data/examples/widget_center/README.md +4 -0
  84. data/examples/widget_center/app.rb +2 -2
  85. data/examples/widget_chart/README.md +6 -0
  86. data/examples/widget_chart/app.rb +2 -2
  87. data/examples/widget_gauge/README.md +6 -0
  88. data/examples/widget_gauge/app.rb +2 -2
  89. data/examples/widget_layout_split/README.md +6 -0
  90. data/examples/widget_layout_split/app.rb +3 -3
  91. data/examples/widget_line_gauge/README.md +6 -0
  92. data/examples/widget_line_gauge/app.rb +2 -2
  93. data/examples/widget_list/README.md +6 -0
  94. data/examples/widget_list/app.rb +2 -2
  95. data/examples/widget_map/README.md +8 -2
  96. data/examples/widget_map/app.rb +2 -2
  97. data/examples/widget_overlay/README.md +7 -1
  98. data/examples/widget_overlay/app.rb +2 -2
  99. data/examples/widget_popup/README.md +6 -0
  100. data/examples/widget_popup/app.rb +2 -2
  101. data/examples/widget_ratatui_logo/README.md +6 -0
  102. data/examples/widget_ratatui_logo/app.rb +2 -3
  103. data/examples/widget_ratatui_mascot/README.md +6 -0
  104. data/examples/widget_ratatui_mascot/app.rb +2 -2
  105. data/examples/widget_rect/README.md +12 -0
  106. data/examples/widget_rect/app.rb +40 -26
  107. data/examples/widget_render/README.md +6 -0
  108. data/examples/widget_render/app.rb +2 -2
  109. data/examples/widget_render/app.rbs +41 -0
  110. data/examples/widget_rich_text/README.md +6 -0
  111. data/examples/widget_rich_text/app.rb +2 -2
  112. data/examples/widget_scroll_text/README.md +6 -0
  113. data/examples/widget_scroll_text/app.rb +2 -2
  114. data/examples/widget_scrollbar/README.md +6 -0
  115. data/examples/widget_scrollbar/app.rb +2 -2
  116. data/examples/widget_sparkline/README.md +6 -0
  117. data/examples/widget_sparkline/app.rb +2 -2
  118. data/examples/widget_style_colors/README.md +6 -0
  119. data/examples/widget_style_colors/app.rb +2 -2
  120. data/examples/widget_table/README.md +8 -2
  121. data/examples/widget_table/app.rb +2 -2
  122. data/examples/widget_tabs/README.md +6 -0
  123. data/examples/widget_tabs/app.rb +2 -2
  124. data/examples/widget_text_width/README.md +6 -0
  125. data/examples/widget_text_width/app.rb +4 -4
  126. data/ext/ratatui_ruby/Cargo.lock +1 -1
  127. data/ext/ratatui_ruby/Cargo.toml +1 -1
  128. data/ext/ratatui_ruby/extconf.rb +2 -2
  129. data/ext/ratatui_ruby/src/rendering.rs +1 -1
  130. data/ext/ratatui_ruby/src/style.rs +0 -8
  131. data/ext/ratatui_ruby/src/widgets/chart.rs +0 -118
  132. data/ext/ratatui_ruby/src/widgets/list_state.rs +36 -0
  133. data/lib/ratatui_ruby/buffer/cell.rb +34 -2
  134. data/lib/ratatui_ruby/buffer.rb +2 -2
  135. data/lib/ratatui_ruby/cell.rb +34 -2
  136. data/lib/ratatui_ruby/event/focus_gained.rb +26 -2
  137. data/lib/ratatui_ruby/event/focus_lost.rb +26 -2
  138. data/lib/ratatui_ruby/event/key/character.rb +18 -2
  139. data/lib/ratatui_ruby/event/key/media.rb +2 -2
  140. data/lib/ratatui_ruby/event/key/modifier.rb +10 -2
  141. data/lib/ratatui_ruby/event/key/navigation.rb +2 -2
  142. data/lib/ratatui_ruby/event/key/system.rb +2 -2
  143. data/lib/ratatui_ruby/event/key.rb +114 -2
  144. data/lib/ratatui_ruby/event/mouse.rb +42 -2
  145. data/lib/ratatui_ruby/event/none.rb +10 -2
  146. data/lib/ratatui_ruby/event/paste.rb +34 -2
  147. data/lib/ratatui_ruby/event/resize.rb +34 -2
  148. data/lib/ratatui_ruby/event.rb +26 -2
  149. data/lib/ratatui_ruby/frame.rb +74 -2
  150. data/lib/ratatui_ruby/layout/constraint.rb +58 -2
  151. data/lib/ratatui_ruby/layout/layout.rb +47 -2
  152. data/lib/ratatui_ruby/layout/rect.rb +403 -2
  153. data/lib/ratatui_ruby/layout.rb +2 -2
  154. data/lib/ratatui_ruby/list_state.rb +113 -2
  155. data/lib/ratatui_ruby/output_guard.rb +26 -3
  156. data/lib/ratatui_ruby/schema/bar_chart/bar.rb +2 -2
  157. data/lib/ratatui_ruby/schema/bar_chart/bar_group.rb +2 -2
  158. data/lib/ratatui_ruby/schema/bar_chart.rb +50 -2
  159. data/lib/ratatui_ruby/schema/block.rb +21 -15
  160. data/lib/ratatui_ruby/schema/calendar.rb +2 -2
  161. data/lib/ratatui_ruby/schema/canvas.rb +10 -2
  162. data/lib/ratatui_ruby/schema/center.rb +10 -2
  163. data/lib/ratatui_ruby/schema/chart.rb +2 -28
  164. data/lib/ratatui_ruby/schema/clear.rb +10 -2
  165. data/lib/ratatui_ruby/schema/constraint.rb +58 -2
  166. data/lib/ratatui_ruby/schema/cursor.rb +10 -2
  167. data/lib/ratatui_ruby/schema/draw.rb +10 -2
  168. data/lib/ratatui_ruby/schema/gauge.rb +2 -2
  169. data/lib/ratatui_ruby/schema/layout.rb +18 -2
  170. data/lib/ratatui_ruby/schema/line_gauge.rb +2 -2
  171. data/lib/ratatui_ruby/schema/list.rb +10 -2
  172. data/lib/ratatui_ruby/schema/list_item.rb +10 -2
  173. data/lib/ratatui_ruby/schema/overlay.rb +10 -2
  174. data/lib/ratatui_ruby/schema/paragraph.rb +10 -2
  175. data/lib/ratatui_ruby/schema/ratatui_logo.rb +2 -2
  176. data/lib/ratatui_ruby/schema/ratatui_mascot.rb +2 -2
  177. data/lib/ratatui_ruby/schema/rect.rb +58 -2
  178. data/lib/ratatui_ruby/schema/row.rb +10 -2
  179. data/lib/ratatui_ruby/schema/scrollbar.rb +2 -2
  180. data/lib/ratatui_ruby/schema/shape/label.rb +10 -2
  181. data/lib/ratatui_ruby/schema/sparkline.rb +10 -2
  182. data/lib/ratatui_ruby/schema/style.rb +18 -2
  183. data/lib/ratatui_ruby/schema/table.rb +2 -2
  184. data/lib/ratatui_ruby/schema/tabs.rb +2 -2
  185. data/lib/ratatui_ruby/schema/text.rb +34 -2
  186. data/lib/ratatui_ruby/scrollbar_state.rb +10 -2
  187. data/lib/ratatui_ruby/style/style.rb +18 -2
  188. data/lib/ratatui_ruby/style.rb +2 -2
  189. data/lib/ratatui_ruby/table_state.rb +10 -2
  190. data/lib/ratatui_ruby/terminal_lifecycle.rb +18 -3
  191. data/lib/ratatui_ruby/test_helper/event_injection.rb +34 -2
  192. data/lib/ratatui_ruby/test_helper/snapshot.rb +74 -9
  193. data/lib/ratatui_ruby/test_helper/style_assertions.rb +98 -2
  194. data/lib/ratatui_ruby/test_helper/terminal.rb +50 -2
  195. data/lib/ratatui_ruby/test_helper/test_doubles.rb +18 -2
  196. data/lib/ratatui_ruby/test_helper.rb +10 -2
  197. data/lib/ratatui_ruby/tui/buffer_factories.rb +2 -2
  198. data/lib/ratatui_ruby/tui/canvas_factories.rb +2 -2
  199. data/lib/ratatui_ruby/tui/core.rb +2 -2
  200. data/lib/ratatui_ruby/tui/layout_factories.rb +32 -2
  201. data/lib/ratatui_ruby/tui/state_factories.rb +2 -2
  202. data/lib/ratatui_ruby/tui/style_factories.rb +2 -2
  203. data/lib/ratatui_ruby/tui/text_factories.rb +2 -2
  204. data/lib/ratatui_ruby/tui/widget_factories.rb +2 -2
  205. data/lib/ratatui_ruby/tui.rb +11 -3
  206. data/lib/ratatui_ruby/version.rb +3 -3
  207. data/lib/ratatui_ruby/widgets/bar_chart/bar.rb +2 -2
  208. data/lib/ratatui_ruby/widgets/bar_chart/bar_group.rb +2 -2
  209. data/lib/ratatui_ruby/widgets/bar_chart.rb +58 -2
  210. data/lib/ratatui_ruby/widgets/block.rb +37 -15
  211. data/lib/ratatui_ruby/widgets/calendar.rb +2 -2
  212. data/lib/ratatui_ruby/widgets/canvas.rb +10 -2
  213. data/lib/ratatui_ruby/widgets/cell.rb +10 -2
  214. data/lib/ratatui_ruby/widgets/center.rb +10 -2
  215. data/lib/ratatui_ruby/widgets/chart.rb +2 -28
  216. data/lib/ratatui_ruby/widgets/clear.rb +10 -2
  217. data/lib/ratatui_ruby/widgets/cursor.rb +10 -2
  218. data/lib/ratatui_ruby/widgets/gauge.rb +16 -2
  219. data/lib/ratatui_ruby/widgets/line_gauge.rb +16 -2
  220. data/lib/ratatui_ruby/widgets/list.rb +41 -2
  221. data/lib/ratatui_ruby/widgets/list_item.rb +10 -2
  222. data/lib/ratatui_ruby/widgets/overlay.rb +10 -2
  223. data/lib/ratatui_ruby/widgets/paragraph.rb +10 -2
  224. data/lib/ratatui_ruby/widgets/ratatui_logo.rb +2 -2
  225. data/lib/ratatui_ruby/widgets/ratatui_mascot.rb +2 -2
  226. data/lib/ratatui_ruby/widgets/row.rb +10 -2
  227. data/lib/ratatui_ruby/widgets/scrollbar.rb +2 -2
  228. data/lib/ratatui_ruby/widgets/shape/label.rb +10 -2
  229. data/lib/ratatui_ruby/widgets/sparkline.rb +10 -2
  230. data/lib/ratatui_ruby/widgets/table.rb +62 -2
  231. data/lib/ratatui_ruby/widgets/tabs.rb +2 -2
  232. data/lib/ratatui_ruby/widgets.rb +2 -2
  233. data/lib/ratatui_ruby.rb +90 -2
  234. data/sig/examples/app_all_events/view.rbs +7 -1
  235. data/sig/examples/app_all_events/view_state.rbs +7 -1
  236. data/sig/examples/app_color_picker/app.rbs +5 -0
  237. data/sig/examples/app_stateful_interaction/app.rbs +7 -1
  238. data/sig/examples/verify_quickstart_dsl/app.rbs +7 -1
  239. data/sig/examples/verify_quickstart_lifecycle/app.rbs +7 -1
  240. data/sig/examples/verify_readme_usage/app.rbs +7 -1
  241. data/sig/examples/widget_block_demo/app.rbs +6 -0
  242. data/sig/examples/widget_box_demo/app.rbs +7 -1
  243. data/sig/examples/widget_calendar_demo/app.rbs +7 -1
  244. data/sig/examples/widget_cell_demo/app.rbs +7 -1
  245. data/sig/examples/widget_chart_demo/app.rbs +7 -1
  246. data/sig/examples/widget_gauge_demo/app.rbs +7 -1
  247. data/sig/examples/widget_layout_split/app.rbs +7 -1
  248. data/sig/examples/widget_line_gauge_demo/app.rbs +7 -1
  249. data/sig/examples/widget_list_demo/app.rbs +5 -0
  250. data/sig/examples/widget_map_demo/app.rbs +7 -1
  251. data/sig/examples/widget_popup_demo/app.rbs +7 -1
  252. data/sig/examples/widget_ratatui_logo_demo/app.rbs +7 -1
  253. data/sig/examples/widget_ratatui_mascot_demo/app.rbs +7 -1
  254. data/sig/examples/widget_rect/app.rbs +7 -1
  255. data/sig/examples/widget_render/app.rbs +7 -1
  256. data/sig/examples/widget_rich_text/app.rbs +7 -1
  257. data/sig/examples/widget_scroll_text/app.rbs +7 -1
  258. data/sig/examples/widget_scrollbar_demo/app.rbs +7 -1
  259. data/sig/examples/widget_sparkline_demo/app.rbs +7 -1
  260. data/sig/examples/widget_style_colors/app.rbs +7 -1
  261. data/sig/examples/widget_table_demo/app.rbs +7 -1
  262. data/sig/examples/widget_text_width/app.rbs +7 -1
  263. data/sig/ratatui_ruby/event.rbs +7 -1
  264. data/sig/ratatui_ruby/frame.rbs +15 -3
  265. data/sig/ratatui_ruby/list_state.rbs +11 -1
  266. data/sig/ratatui_ruby/ratatui_ruby.rbs +8 -2
  267. data/sig/ratatui_ruby/schema/bar_chart/bar.rbs +7 -1
  268. data/sig/ratatui_ruby/schema/bar_chart/bar_group.rbs +6 -0
  269. data/sig/ratatui_ruby/schema/bar_chart.rbs +6 -0
  270. data/sig/ratatui_ruby/schema/block.rbs +7 -1
  271. data/sig/ratatui_ruby/schema/calendar.rbs +6 -0
  272. data/sig/ratatui_ruby/schema/canvas.rbs +6 -0
  273. data/sig/ratatui_ruby/schema/center.rbs +6 -0
  274. data/sig/ratatui_ruby/schema/chart.rbs +6 -9
  275. data/sig/ratatui_ruby/schema/constraint.rbs +6 -0
  276. data/sig/ratatui_ruby/schema/cursor.rbs +6 -0
  277. data/sig/ratatui_ruby/schema/draw.rbs +6 -0
  278. data/sig/ratatui_ruby/schema/gauge.rbs +9 -1
  279. data/sig/ratatui_ruby/schema/layout.rbs +6 -0
  280. data/sig/ratatui_ruby/schema/line_gauge.rbs +9 -1
  281. data/sig/ratatui_ruby/schema/list.rbs +9 -1
  282. data/sig/ratatui_ruby/schema/list_item.rbs +7 -1
  283. data/sig/ratatui_ruby/schema/overlay.rbs +6 -0
  284. data/sig/ratatui_ruby/schema/paragraph.rbs +6 -0
  285. data/sig/ratatui_ruby/schema/ratatui_logo.rbs +6 -0
  286. data/sig/ratatui_ruby/schema/ratatui_mascot.rbs +5 -0
  287. data/sig/ratatui_ruby/schema/rect.rbs +30 -0
  288. data/sig/ratatui_ruby/schema/row.rbs +7 -1
  289. data/sig/ratatui_ruby/schema/scrollbar.rbs +6 -0
  290. data/sig/ratatui_ruby/schema/sparkline.rbs +6 -0
  291. data/sig/ratatui_ruby/schema/style.rbs +7 -1
  292. data/sig/ratatui_ruby/schema/table.rbs +11 -1
  293. data/sig/ratatui_ruby/schema/tabs.rbs +6 -0
  294. data/sig/ratatui_ruby/schema/text.rbs +7 -1
  295. data/sig/ratatui_ruby/scrollbar_state.rbs +7 -1
  296. data/sig/ratatui_ruby/session.rbs +7 -1
  297. data/sig/ratatui_ruby/table_state.rbs +7 -1
  298. data/sig/ratatui_ruby/test_helper/event_injection.rbs +7 -1
  299. data/sig/ratatui_ruby/test_helper/snapshot.rbs +7 -1
  300. data/sig/ratatui_ruby/test_helper/style_assertions.rbs +7 -1
  301. data/sig/ratatui_ruby/test_helper/terminal.rbs +7 -1
  302. data/sig/ratatui_ruby/test_helper/test_doubles.rbs +7 -1
  303. data/sig/ratatui_ruby/test_helper.rbs +7 -1
  304. data/sig/ratatui_ruby/tui/buffer_factories.rbs +7 -1
  305. data/sig/ratatui_ruby/tui/canvas_factories.rbs +7 -1
  306. data/sig/ratatui_ruby/tui/core.rbs +7 -1
  307. data/sig/ratatui_ruby/tui/layout_factories.rbs +7 -1
  308. data/sig/ratatui_ruby/tui/state_factories.rbs +7 -1
  309. data/sig/ratatui_ruby/tui/style_factories.rbs +7 -1
  310. data/sig/ratatui_ruby/tui/text_factories.rbs +7 -1
  311. data/sig/ratatui_ruby/tui/widget_factories.rbs +7 -1
  312. data/sig/ratatui_ruby/tui.rbs +7 -1
  313. data/sig/ratatui_ruby/version.rbs +6 -0
  314. data/tasks/autodoc/examples.rb +1 -1
  315. data/tasks/autodoc/member.rb +1 -1
  316. data/tasks/autodoc/name.rb +1 -1
  317. data/tasks/bump/cargo_lockfile.rb +1 -1
  318. data/tasks/bump/changelog.rb +1 -1
  319. data/tasks/bump/header.rb +1 -1
  320. data/tasks/bump/history.rb +1 -1
  321. data/tasks/bump/links.rb +1 -1
  322. data/tasks/bump/manifest.rb +1 -1
  323. data/tasks/bump/ruby_gem.rb +1 -1
  324. data/tasks/bump/sem_ver.rb +1 -1
  325. data/tasks/bump/unreleased_section.rb +1 -1
  326. data/tasks/license/headers_md.rb +223 -0
  327. data/tasks/license/headers_rb.rb +210 -0
  328. data/tasks/license/license_utils.rb +130 -0
  329. data/tasks/license/snippets_md.rb +315 -0
  330. data/tasks/license/snippets_rdoc.rb +150 -0
  331. data/tasks/license.rake +91 -0
  332. data/tasks/rdoc_config.rb +1 -1
  333. data/tasks/resources/build.yml.erb +13 -7
  334. data/tasks/sourcehut.rake +3 -1
  335. data/tasks/terminal_preview/app_screenshot.rb +1 -1
  336. data/tasks/terminal_preview/crash_report.rb +1 -1
  337. data/tasks/terminal_preview/example_app.rb +1 -1
  338. data/tasks/terminal_preview/launcher_script.rb +1 -1
  339. data/tasks/terminal_preview/preview_collection.rb +1 -1
  340. data/tasks/terminal_preview/preview_timing.rb +1 -1
  341. data/tasks/terminal_preview/safety_confirmation.rb +1 -1
  342. data/tasks/terminal_preview/saved_screenshot.rb +1 -1
  343. data/tasks/terminal_preview/system_appearance.rb +1 -1
  344. data/tasks/terminal_preview/terminal_window.rb +1 -1
  345. data/tasks/terminal_preview/window_id.rb +1 -1
  346. data/tasks/website/index_page.rb +1 -1
  347. data/tasks/website/version.rb +1 -1
  348. data/tasks/website/version_menu.rb +1 -1
  349. data/tasks/website/versioned_documentation.rb +1 -1
  350. data/tasks/website/website.rb +1 -1
  351. metadata +13 -3
  352. data/doc/migration/v0_7_0.md +0 -236
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: AGPL-3.0-or-later
4
+ # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
5
+ # SPDX-License-Identifier: LGPL-3.0-or-later
6
6
  #++
7
7
 
8
8
  module RatatuiRuby
@@ -20,6 +20,11 @@ module RatatuiRuby
20
20
  #
21
21
  # Run the interactive demo from the terminal:
22
22
  #
23
+ #--
24
+ # SPDX-SnippetBegin
25
+ # SPDX-FileCopyrightText: 2026 Kerrick Long
26
+ # SPDX-License-Identifier: MIT-0
27
+ #++
23
28
  # ruby examples/widget_barchart/app.rb
24
29
  #
25
30
  # # Grouped Bar Chart
@@ -31,6 +36,9 @@ module RatatuiRuby
31
36
  # bar_width: 5,
32
37
  # group_gap: 3
33
38
  # )
39
+ #--
40
+ # SPDX-SnippetEnd
41
+ #++
34
42
  class BarChart < Data.define(:data, :bar_width, :bar_gap, :group_gap, :max, :style, :block, :direction, :label_style, :value_style, :bar_set)
35
43
  ##
36
44
  ##
@@ -45,23 +53,55 @@ module RatatuiRuby
45
53
  # [<tt>Array</tt> of tuples]
46
54
  # Ordered list of <tt>["Label", Value]</tt> or <tt>["Label", Value, Style]</tt> pairs.
47
55
  # [<tt>Array</tt> of <tt>BarChart::BarGroup</tt>]
56
+ #--
57
+ # SPDX-SnippetBegin
58
+ # SPDX-FileCopyrightText: 2025 Kerrick Long
59
+ # SPDX-License-Identifier: MIT-0
60
+ #++
48
61
  # List of <tt>BarChart::BarGroup</tt> objects for grouped charts.
49
62
  #
63
+ #--
64
+ # SPDX-SnippetEnd
65
+ #++
50
66
  # === Examples
51
67
  #
52
68
  # Hash (Simple):
69
+ #--
70
+ # SPDX-SnippetBegin
71
+ # SPDX-FileCopyrightText: 2025 Kerrick Long
72
+ # SPDX-License-Identifier: MIT-0
73
+ #++
53
74
  # { "Apples" => 10, :Oranges => 15 }
54
75
  #
76
+ #--
77
+ # SPDX-SnippetEnd
78
+ #++
55
79
  # Array of Tuples (Ordered):
80
+ #--
81
+ # SPDX-SnippetBegin
82
+ # SPDX-FileCopyrightText: 2025 Kerrick Long
83
+ # SPDX-License-Identifier: MIT-0
84
+ #++
56
85
  # [["Mon", 20], ["Tue", 30], ["Wed", 25]]
57
86
  #
87
+ #--
88
+ # SPDX-SnippetEnd
89
+ #++
58
90
  # BarGroup (Grouped):
91
+ #--
92
+ # SPDX-SnippetBegin
93
+ # SPDX-FileCopyrightText: 2025 Kerrick Long
94
+ # SPDX-License-Identifier: MIT-0
95
+ #++
59
96
  # [
60
97
  # RatatuiRuby::BarChart::BarGroup.new(label: "Q1", bars: [
61
98
  # RatatuiRuby::BarChart::Bar.new(value: 50, label: "Rev"),
62
99
  # RatatuiRuby::BarChart::Bar.new(value: 30, label: "Cost")
63
100
  # ])
64
101
  # ]
102
+ #--
103
+ # SPDX-SnippetEnd
104
+ #++
65
105
 
66
106
  ##
67
107
  # :attr_reader: bar_width
@@ -110,6 +150,11 @@ module RatatuiRuby
110
150
  #
111
151
  # === Examples
112
152
  #
153
+ #--
154
+ # SPDX-SnippetBegin
155
+ # SPDX-FileCopyrightText: 2025 Kerrick Long
156
+ # SPDX-License-Identifier: MIT-0
157
+ #++
113
158
  # bar_set: {
114
159
  # empty: " ",
115
160
  # one_eighth: " ",
@@ -129,6 +174,9 @@ module RatatuiRuby
129
174
  #
130
175
  # # Array (9 items)
131
176
  # bar_set: [" ", " ", "▂", "▃", "▄", "▅", "▆", "▇", "█"]
177
+ #--
178
+ # SPDX-SnippetEnd
179
+ #++
132
180
 
133
181
  BAR_KEYS = %i[empty one_eighth one_quarter three_eighths half five_eighths three_quarters seven_eighths full].freeze
134
182
 
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: AGPL-3.0-or-later
4
+ # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
5
+ # SPDX-License-Identifier: LGPL-3.0-or-later
6
6
  #++
7
7
 
8
8
  module RatatuiRuby
@@ -21,7 +21,7 @@ module RatatuiRuby
21
21
  # Run the interactive demo from the terminal:
22
22
  #
23
23
  # ruby examples/widget_box/app.rb
24
- class Block < Data.define(:title, :titles, :title_alignment, :title_style, :borders, :border_color, :border_style, :border_type, :border_set, :style, :padding, :children)
24
+ class Block < Data.define(:title, :titles, :title_alignment, :title_style, :borders, :border_style, :border_type, :border_set, :style, :padding, :children)
25
25
  ##
26
26
  # :attr_reader: title
27
27
  # The main title displayed on the top border.
@@ -68,19 +68,12 @@ module RatatuiRuby
68
68
  #
69
69
  # Block.new(borders: [:left, :right]).borders # => [:left, :right]
70
70
 
71
- ##
72
- # :attr_reader: border_color
73
- # Color of the border lines.
74
- #
75
- # Deprecated: Use <tt>border_style:</tt> instead for full style support.
76
-
77
71
  ##
78
72
  # :attr_reader: border_style
79
73
  # Full style (colors/modifiers) for the border lines.
80
74
  #
81
75
  # A Style object or Hash with <tt>:fg</tt>, <tt>:bg</tt>, and <tt>:modifiers</tt>.
82
- # This allows borders to be bold, italic, colored, etc. If both <tt>border_color</tt>
83
- # and <tt>border_style</tt> are provided, <tt>border_style</tt> takes precedence.
76
+ # This allows borders to be bold, italic, colored, etc.
84
77
 
85
78
  ##
86
79
  # :attr_reader: border_type
@@ -115,8 +108,16 @@ module RatatuiRuby
115
108
  #
116
109
  # === Example
117
110
  #
111
+ #--
112
+ # SPDX-SnippetBegin
113
+ # SPDX-FileCopyrightText: 2025 Kerrick Long
114
+ # SPDX-License-Identifier: MIT-0
115
+ #++
118
116
  # Block.new(padding: 2).padding # => 2
119
117
  # Block.new(padding: [1, 1, 0, 0]).padding # => [1, 1, 0, 0]
118
+ #--
119
+ # SPDX-SnippetEnd
120
+ #++
120
121
 
121
122
  ##
122
123
  # :attr_reader: children
@@ -126,11 +127,19 @@ module RatatuiRuby
126
127
  #
127
128
  # === Example
128
129
  #
130
+ #--
131
+ # SPDX-SnippetBegin
132
+ # SPDX-FileCopyrightText: 2025 Kerrick Long
133
+ # SPDX-License-Identifier: MIT-0
134
+ #++
129
135
  # Block.new(
130
136
  # title: "Content",
131
137
  # borders: [:all],
132
138
  # children: [Paragraph.new(text: "Hello")]
133
139
  # )
140
+ #--
141
+ # SPDX-SnippetEnd
142
+ #++
134
143
 
135
144
  # Creates a new Block.
136
145
  #
@@ -144,8 +153,6 @@ module RatatuiRuby
144
153
  # Base style for all titles (optional).
145
154
  # [borders]
146
155
  # Array of borders to show: <tt>:top</tt>, <tt>:bottom</tt>, <tt>:left</tt>, <tt>:right</tt>, or <tt>:all</tt> (default).
147
- # [border_color]
148
- # Color string or symbol (e.g., <tt>:red</tt>). Deprecated: use <tt>border_style</tt> instead.
149
156
  # [border_style]
150
157
  # Style object or Hash for the border lines.
151
158
  # [border_type]
@@ -158,7 +165,7 @@ module RatatuiRuby
158
165
  # Integer (uniform) or Array[4] (left, right, top, bottom).
159
166
  # [children]
160
167
  # Array of widgets to render inside the block (optional).
161
- def initialize(title: nil, titles: [], title_alignment: nil, title_style: nil, borders: [:all], border_color: nil, border_style: nil, border_type: nil, border_set: nil, style: nil, padding: 0, children: [])
168
+ def initialize(title: nil, titles: [], title_alignment: nil, title_style: nil, borders: [:all], border_style: nil, border_type: nil, border_set: nil, style: nil, padding: 0, children: [])
162
169
  if border_set
163
170
  border_set = border_set.dup
164
171
  %i[top_left top_right bottom_left bottom_right vertical_left vertical_right horizontal_top horizontal_bottom].each do |long_key|
@@ -179,7 +186,6 @@ module RatatuiRuby
179
186
  title_alignment:,
180
187
  title_style:,
181
188
  borders:,
182
- border_color:,
183
189
  border_style:,
184
190
  border_type:,
185
191
  border_set:,
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: AGPL-3.0-or-later
4
+ # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
5
+ # SPDX-License-Identifier: LGPL-3.0-or-later
6
6
  #++
7
7
 
8
8
  module RatatuiRuby
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: AGPL-3.0-or-later
4
+ # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
5
+ # SPDX-License-Identifier: LGPL-3.0-or-later
6
6
  #++
7
7
 
8
8
  module RatatuiRuby
@@ -171,6 +171,11 @@ module RatatuiRuby
171
171
  #
172
172
  # === Examples
173
173
  #
174
+ #--
175
+ # SPDX-SnippetBegin
176
+ # SPDX-FileCopyrightText: 2025 Kerrick Long
177
+ # SPDX-License-Identifier: MIT-0
178
+ #++
174
179
  # Canvas.new(
175
180
  # x_bounds: [-180, 180],
176
181
  # y_bounds: [-90, 90],
@@ -180,6 +185,9 @@ module RatatuiRuby
180
185
  # Shape::Label.new(x: -122.4, y: 37.8, text: "San Francisco")
181
186
  # ]
182
187
  # )
188
+ #--
189
+ # SPDX-SnippetEnd
190
+ #++
183
191
  class Canvas < Data.define(:shapes, :x_bounds, :y_bounds, :marker, :block, :background_color)
184
192
  ##
185
193
  # :attr_reader: shapes
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: AGPL-3.0-or-later
4
+ # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
5
+ # SPDX-License-Identifier: LGPL-3.0-or-later
6
6
  #++
7
7
 
8
8
  module RatatuiRuby
@@ -17,12 +17,20 @@ module RatatuiRuby
17
17
  #
18
18
  # === Examples
19
19
  #
20
+ #--
21
+ # SPDX-SnippetBegin
22
+ # SPDX-FileCopyrightText: 2025 Kerrick Long
23
+ # SPDX-License-Identifier: MIT-0
24
+ #++
20
25
  # # Center a paragraph using 50% of width and height
21
26
  # Center.new(
22
27
  # child: Paragraph.new(text: "Hello"),
23
28
  # width_percent: 50,
24
29
  # height_percent: 50
25
30
  # )
31
+ #--
32
+ # SPDX-SnippetEnd
33
+ #++
26
34
  class Center < Data.define(:child, :width_percent, :height_percent)
27
35
  ##
28
36
  # :attr_reader: child
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: AGPL-3.0-or-later
4
+ # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
5
+ # SPDX-License-Identifier: LGPL-3.0-or-later
6
6
  #++
7
7
 
8
8
  module RatatuiRuby
@@ -156,30 +156,4 @@ module RatatuiRuby
156
156
  super
157
157
  end
158
158
  end
159
-
160
- # A complex chart widget. (Legacy/Alias for Chart)
161
- #
162
- # [datasets] Array of Dataset objects.
163
- # [x_labels] Array of Strings for the X-axis labels.
164
- # [y_labels] Array of Strings for the Y-axis labels.
165
- # [y_bounds] Array of two Floats [min, max] for the Y-axis.
166
- # [block] Optional block widget to wrap the chart.
167
- class LineChart < Data.define(:datasets, :x_labels, :y_labels, :y_bounds, :block)
168
- # Creates a new LineChart widget.
169
- #
170
- # [datasets] Array of Dataset objects.
171
- # [x_labels] Array of Strings for the X-axis labels.
172
- # [y_labels] Array of Strings for the Y-axis labels.
173
- # [y_bounds] Array of two Floats [min, max] for the Y-axis.
174
- # [block] Optional block widget to wrap the chart.
175
- def initialize(datasets:, x_labels: [], y_labels: [], y_bounds: [0.0, 100.0], block: nil)
176
- super(
177
- datasets:,
178
- x_labels:,
179
- y_labels:,
180
- y_bounds: [Float(y_bounds[0]), Float(y_bounds[1])],
181
- block:
182
- )
183
- end
184
- end
185
159
  end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: AGPL-3.0-or-later
4
+ # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
5
+ # SPDX-License-Identifier: LGPL-3.0-or-later
6
6
  #++
7
7
 
8
8
  module RatatuiRuby
@@ -17,6 +17,11 @@ module RatatuiRuby
17
17
  #
18
18
  # === Examples
19
19
  #
20
+ #--
21
+ # SPDX-SnippetBegin
22
+ # SPDX-FileCopyrightText: 2025 Kerrick Long
23
+ # SPDX-License-Identifier: MIT-0
24
+ #++
20
25
  # # Opaque Popup Construction
21
26
  # Overlay.new(
22
27
  # layers: [
@@ -36,6 +41,9 @@ module RatatuiRuby
36
41
  #
37
42
  # # Shortcut: rendering a block directly
38
43
  # Clear.new(block: Block.new(title: "Cleared area", borders: [:all]))
44
+ #--
45
+ # SPDX-SnippetEnd
46
+ #++
39
47
  class Clear < Data.define(:block)
40
48
  ##
41
49
  # :attr_reader: block
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: AGPL-3.0-or-later
4
+ # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
5
+ # SPDX-License-Identifier: LGPL-3.0-or-later
6
6
  #++
7
7
 
8
8
  module RatatuiRuby
@@ -16,10 +16,18 @@ module RatatuiRuby
16
16
  #
17
17
  # === Examples
18
18
  #
19
+ #--
20
+ # SPDX-SnippetBegin
21
+ # SPDX-FileCopyrightText: 2025 Kerrick Long
22
+ # SPDX-License-Identifier: MIT-0
23
+ #++
19
24
  # Constraint.length(5) # Exactly 5 cells
20
25
  # Constraint.percentage(50) # Half the available space
21
26
  # Constraint.min(10) # At least 10 cells, maybe more
22
27
  # Constraint.fill(1) # Fill remaining space (weight 1)
28
+ #--
29
+ # SPDX-SnippetEnd
30
+ #++
23
31
  class Constraint < Data.define(:type, :value)
24
32
  ##
25
33
  # :attr_reader: type
@@ -33,8 +41,16 @@ module RatatuiRuby
33
41
 
34
42
  # Requests a fixed size.
35
43
  #
44
+ #--
45
+ # SPDX-SnippetBegin
46
+ # SPDX-FileCopyrightText: 2025 Kerrick Long
47
+ # SPDX-License-Identifier: MIT-0
48
+ #++
36
49
  # Constraint.length(10) # 10 characters wide/high
37
50
  #
51
+ #--
52
+ # SPDX-SnippetEnd
53
+ #++
38
54
  # [v] Number of cells (Integer).
39
55
  def self.length(v)
40
56
  new(type: :length, value: Integer(v))
@@ -42,8 +58,16 @@ module RatatuiRuby
42
58
 
43
59
  # Requests a percentage of available space.
44
60
  #
61
+ #--
62
+ # SPDX-SnippetBegin
63
+ # SPDX-FileCopyrightText: 2025 Kerrick Long
64
+ # SPDX-License-Identifier: MIT-0
65
+ #++
45
66
  # Constraint.percentage(25) # 25% of the area
46
67
  #
68
+ #--
69
+ # SPDX-SnippetEnd
70
+ #++
47
71
  # [v] Percentage 0-100 (Integer).
48
72
  def self.percentage(v)
49
73
  new(type: :percentage, value: Integer(v))
@@ -51,8 +75,16 @@ module RatatuiRuby
51
75
 
52
76
  # Enforces a minimum size.
53
77
  #
78
+ #--
79
+ # SPDX-SnippetBegin
80
+ # SPDX-FileCopyrightText: 2025 Kerrick Long
81
+ # SPDX-License-Identifier: MIT-0
82
+ #++
54
83
  # Constraint.min(5) # At least 5 cells
55
84
  #
85
+ #--
86
+ # SPDX-SnippetEnd
87
+ #++
56
88
  # This section will grow if space permits, but never shrink below +v+.
57
89
  #
58
90
  # [v] Minimum cells (Integer).
@@ -62,8 +94,16 @@ module RatatuiRuby
62
94
 
63
95
  # Enforces a maximum size.
64
96
  #
97
+ #--
98
+ # SPDX-SnippetBegin
99
+ # SPDX-FileCopyrightText: 2025 Kerrick Long
100
+ # SPDX-License-Identifier: MIT-0
101
+ #++
65
102
  # Constraint.max(10) # At most 10 cells
66
103
  #
104
+ #--
105
+ # SPDX-SnippetEnd
106
+ #++
67
107
  # [v] Maximum cells (Integer).
68
108
  def self.max(v)
69
109
  new(type: :max, value: Integer(v))
@@ -71,9 +111,17 @@ module RatatuiRuby
71
111
 
72
112
  # Fills remaining space proportionally.
73
113
  #
114
+ #--
115
+ # SPDX-SnippetBegin
116
+ # SPDX-FileCopyrightText: 2025 Kerrick Long
117
+ # SPDX-License-Identifier: MIT-0
118
+ #++
74
119
  # Constraint.fill(1) # Equal share
75
120
  # Constraint.fill(2) # Double share
76
121
  #
122
+ #--
123
+ # SPDX-SnippetEnd
124
+ #++
77
125
  # Fill constraints distribute any space left after satisfying strict rules.
78
126
  # They behave like flex-grow. A fill(2) takes twice as much space as a fill(1).
79
127
  #
@@ -84,8 +132,16 @@ module RatatuiRuby
84
132
 
85
133
  # Requests a specific ratio of the total space.
86
134
  #
135
+ #--
136
+ # SPDX-SnippetBegin
137
+ # SPDX-FileCopyrightText: 2025 Kerrick Long
138
+ # SPDX-License-Identifier: MIT-0
139
+ #++
87
140
  # Constraint.ratio(1, 3) # 1/3rd of the area
88
141
  #
142
+ #--
143
+ # SPDX-SnippetEnd
144
+ #++
89
145
  # [numerator] Top part of fraction (Integer).
90
146
  # [denominator] Bottom part of fraction (Integer).
91
147
  def self.ratio(numerator, denominator)
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: AGPL-3.0-or-later
4
+ # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
5
+ # SPDX-License-Identifier: LGPL-3.0-or-later
6
6
  #++
7
7
 
8
8
  module RatatuiRuby
@@ -16,8 +16,16 @@ module RatatuiRuby
16
16
  #
17
17
  # === Examples
18
18
  #
19
+ #--
20
+ # SPDX-SnippetBegin
21
+ # SPDX-FileCopyrightText: 2026 Kerrick Long
22
+ # SPDX-License-Identifier: MIT-0
23
+ #++
19
24
  # Cursor.new(x: 10, y: 5)
20
25
  #
26
+ #--
27
+ # SPDX-SnippetEnd
28
+ #++
21
29
  # See also:
22
30
  # - {Declarative implementation using Tree API}[link:/examples/app_login_form/app_rb.html]
23
31
  # - {Component-based implementation using Frame API}[link:/examples/app_color_picker/app_rb.html]
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: AGPL-3.0-or-later
4
+ # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
5
+ # SPDX-License-Identifier: LGPL-3.0-or-later
6
6
  #++
7
7
 
8
8
  module RatatuiRuby
@@ -13,6 +13,11 @@ module RatatuiRuby
13
13
  #
14
14
  # === Example
15
15
  #
16
+ #--
17
+ # SPDX-SnippetBegin
18
+ # SPDX-FileCopyrightText: 2025 Kerrick Long
19
+ # SPDX-License-Identifier: MIT-0
20
+ #++
16
21
  # class MyWidget
17
22
  # def render(area)
18
23
  # [
@@ -21,6 +26,9 @@ module RatatuiRuby
21
26
  # ]
22
27
  # end
23
28
  # end
29
+ #--
30
+ # SPDX-SnippetEnd
31
+ #++
24
32
  module Draw
25
33
  # Command to draw a string at the given coordinates.
26
34
  #
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: AGPL-3.0-or-later
4
+ # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
5
+ # SPDX-License-Identifier: LGPL-3.0-or-later
6
6
  #++
7
7
 
8
8
  module RatatuiRuby
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: AGPL-3.0-or-later
4
+ # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
5
+ # SPDX-License-Identifier: LGPL-3.0-or-later
6
6
  #++
7
7
 
8
8
  module RatatuiRuby
@@ -70,6 +70,11 @@ module RatatuiRuby
70
70
  # This is a pure calculation helper for hit testing. It computes where
71
71
  # widgets *would* be placed without actually rendering them.
72
72
  #
73
+ #--
74
+ # SPDX-SnippetBegin
75
+ # SPDX-FileCopyrightText: 2025 Kerrick Long
76
+ # SPDX-License-Identifier: MIT-0
77
+ #++
73
78
  # rects = Layout.split(
74
79
  # area,
75
80
  # direction: :horizontal,
@@ -77,6 +82,9 @@ module RatatuiRuby
77
82
  # )
78
83
  # left, right = rects
79
84
  #
85
+ #--
86
+ # SPDX-SnippetEnd
87
+ #++
80
88
  # [area]
81
89
  # The area to split. Can be a <tt>Rect</tt> or a <tt>Hash</tt> containing <tt>:x</tt>, <tt>:y</tt>, <tt>:width</tt>, and <tt>:height</tt>.
82
90
  # [direction]
@@ -84,8 +92,16 @@ module RatatuiRuby
84
92
  # [constraints]
85
93
  # Array of <tt>Constraint</tt> objects defining section sizes.
86
94
  # [flex]
95
+ #--
96
+ # SPDX-SnippetBegin
97
+ # SPDX-FileCopyrightText: 2025 Kerrick Long
98
+ # SPDX-License-Identifier: MIT-0
99
+ #++
87
100
  # Flex mode for spacing (default: <tt>:legacy</tt>).
88
101
  #
102
+ #--
103
+ # SPDX-SnippetEnd
104
+ #++
89
105
  # Returns an Array of <tt>Rect</tt> objects.
90
106
  def self.split(area, direction: :vertical, constraints:, flex: :legacy)
91
107
  # Duck-typing: If it lacks geometry methods but can be a Hash, convert it.
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: AGPL-3.0-or-later
4
+ # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
5
+ # SPDX-License-Identifier: LGPL-3.0-or-later
6
6
  #++
7
7
 
8
8
  module RatatuiRuby
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: AGPL-3.0-or-later
4
+ # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
5
+ # SPDX-License-Identifier: LGPL-3.0-or-later
6
6
  #++
7
7
 
8
8
  module RatatuiRuby
@@ -19,6 +19,11 @@ module RatatuiRuby
19
19
  #
20
20
  # === Examples
21
21
  #
22
+ #--
23
+ # SPDX-SnippetBegin
24
+ # SPDX-FileCopyrightText: 2025 Kerrick Long
25
+ # SPDX-License-Identifier: MIT-0
26
+ #++
22
27
  # # Basic List
23
28
  # List.new(items: ["Item 1", "Item 2"])
24
29
  #
@@ -29,6 +34,9 @@ module RatatuiRuby
29
34
  # highlight_style: Style.new(bg: :blue),
30
35
  # highlight_symbol: ">> "
31
36
  # )
37
+ #--
38
+ # SPDX-SnippetEnd
39
+ #++
32
40
  class List < Data.define(:items, :selected_index, :offset, :style, :highlight_style, :highlight_symbol, :repeat_highlight_symbol, :highlight_spacing, :direction, :scroll_padding, :block)
33
41
  ##
34
42
  # :attr_reader: items
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
5
- # SPDX-License-Identifier: AGPL-3.0-or-later
4
+ # SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
5
+ # SPDX-License-Identifier: LGPL-3.0-or-later
6
6
  #++
7
7
 
8
8
  module RatatuiRuby
@@ -16,6 +16,11 @@ module RatatuiRuby
16
16
  #
17
17
  # === Examples
18
18
  #
19
+ #--
20
+ # SPDX-SnippetBegin
21
+ # SPDX-FileCopyrightText: 2026 Kerrick Long
22
+ # SPDX-License-Identifier: MIT-0
23
+ #++
19
24
  # # Item with red background
20
25
  # ListItem.new(content: "Error", style: Style.new(bg: :red))
21
26
  #
@@ -23,6 +28,9 @@ module RatatuiRuby
23
28
  # ListItem.new(
24
29
  # content: Text::Span.new(content: "Status: OK", style: Style.new(fg: :green, modifiers: [:bold]))
25
30
  # )
31
+ #--
32
+ # SPDX-SnippetEnd
33
+ #++
26
34
  class ListItem < Data.define(:content, :style)
27
35
  ##
28
36
  # :attr_reader: content