ratatui_ruby 0.5.0 → 0.7.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.
- checksums.yaml +4 -4
- data/.builds/ruby-3.2.yml +1 -1
- data/.builds/ruby-3.3.yml +1 -1
- data/.builds/ruby-3.4.yml +1 -1
- data/.builds/ruby-4.0.0.yml +1 -1
- data/AGENTS.md +10 -4
- data/CHANGELOG.md +79 -7
- data/README.md +37 -5
- data/REUSE.toml +2 -7
- data/doc/application_architecture.md +96 -22
- data/doc/application_testing.md +76 -30
- data/doc/contributors/architectural_overhaul/chat_conversations.md +4952 -0
- data/doc/contributors/architectural_overhaul/implementation_plan.md +60 -0
- data/doc/contributors/architectural_overhaul/task.md +37 -0
- data/doc/contributors/design/ruby_frontend.md +288 -56
- data/doc/contributors/design/rust_backend.md +349 -54
- data/doc/contributors/developing_examples.md +134 -49
- data/doc/contributors/index.md +7 -5
- data/doc/contributors/v1.0.0_blockers.md +1729 -0
- data/doc/event_handling.md +11 -3
- data/doc/images/app_all_events.png +0 -0
- data/doc/images/app_color_picker.png +0 -0
- data/doc/images/app_login_form.png +0 -0
- data/doc/images/app_stateful_interaction.png +0 -0
- data/doc/images/verify_quickstart_dsl.png +0 -0
- data/doc/images/verify_quickstart_layout.png +0 -0
- data/doc/images/verify_quickstart_lifecycle.png +0 -0
- data/doc/images/verify_readme_usage.png +0 -0
- data/doc/images/widget_barchart_demo.png +0 -0
- data/doc/images/widget_block_demo.png +0 -0
- data/doc/images/widget_canvas_demo.png +0 -0
- data/doc/images/widget_cell_demo.png +0 -0
- data/doc/images/widget_center_demo.png +0 -0
- data/doc/images/widget_chart_demo.png +0 -0
- data/doc/images/widget_list_demo.png +0 -0
- data/doc/images/widget_overlay_demo.png +0 -0
- data/doc/images/widget_render.png +0 -0
- data/doc/images/widget_rich_text.png +0 -0
- data/doc/images/widget_scroll_text.png +0 -0
- data/doc/images/widget_sparkline_demo.png +0 -0
- data/doc/images/widget_table_demo.png +0 -0
- data/doc/images/widget_tabs_demo.png +0 -0
- data/doc/images/widget_text_width.png +0 -0
- data/doc/index.md +11 -6
- data/doc/interactive_design.md +2 -2
- data/doc/quickstart.md +127 -165
- data/doc/terminal_limitations.md +92 -0
- data/doc/v0.7.0_migration.md +236 -0
- data/doc/why.md +93 -0
- data/examples/app_all_events/README.md +47 -27
- data/examples/app_all_events/app.rb +38 -35
- data/examples/app_all_events/model/app_model.rb +157 -0
- data/examples/app_all_events/model/event_entry.rb +17 -0
- data/examples/app_all_events/model/msg.rb +37 -0
- data/examples/app_all_events/update.rb +73 -0
- data/examples/app_all_events/view/app_view.rb +9 -9
- data/examples/app_all_events/view/controls_view.rb +9 -7
- data/examples/app_all_events/view/counts_view.rb +13 -9
- data/examples/app_all_events/view/live_view.rb +9 -8
- data/examples/app_all_events/view/log_view.rb +11 -16
- data/examples/app_color_picker/README.md +84 -42
- data/examples/app_color_picker/app.rb +24 -62
- data/examples/app_color_picker/controls.rb +90 -0
- data/examples/app_color_picker/copy_dialog.rb +45 -49
- data/examples/app_color_picker/export_pane.rb +126 -0
- data/examples/app_color_picker/input.rb +99 -67
- data/examples/app_color_picker/main_container.rb +178 -0
- data/examples/app_color_picker/palette.rb +55 -26
- data/examples/app_login_form/README.md +49 -0
- data/examples/app_login_form/app.rb +2 -3
- data/examples/app_stateful_interaction/README.md +33 -0
- data/examples/app_stateful_interaction/app.rb +272 -0
- data/examples/timeout_demo.rb +43 -0
- data/examples/verify_quickstart_dsl/README.md +49 -0
- data/examples/verify_quickstart_dsl/app.rb +2 -0
- data/examples/verify_quickstart_layout/README.md +71 -0
- data/examples/verify_quickstart_layout/app.rb +2 -0
- data/examples/verify_quickstart_lifecycle/README.md +56 -0
- data/examples/verify_quickstart_lifecycle/app.rb +10 -4
- data/examples/verify_readme_usage/README.md +43 -0
- data/examples/verify_readme_usage/app.rb +8 -2
- data/examples/widget_barchart_demo/README.md +50 -0
- data/examples/widget_barchart_demo/app.rb +5 -5
- data/examples/widget_block_demo/README.md +36 -0
- data/examples/widget_block_demo/app.rb +256 -0
- data/examples/widget_box_demo/README.md +45 -0
- data/examples/widget_calendar_demo/README.md +39 -0
- data/examples/widget_calendar_demo/app.rb +5 -1
- data/examples/widget_canvas_demo/README.md +27 -0
- data/examples/widget_canvas_demo/app.rb +123 -0
- data/examples/widget_cell_demo/README.md +36 -0
- data/examples/widget_cell_demo/app.rb +31 -24
- data/examples/widget_center_demo/README.md +29 -0
- data/examples/widget_center_demo/app.rb +116 -0
- data/examples/widget_chart_demo/README.md +41 -0
- data/examples/widget_chart_demo/app.rb +7 -2
- data/examples/widget_gauge_demo/README.md +41 -0
- data/examples/widget_layout_split/README.md +44 -0
- data/examples/widget_line_gauge_demo/README.md +41 -0
- data/examples/widget_list_demo/README.md +49 -0
- data/examples/widget_list_demo/app.rb +91 -107
- data/examples/widget_map_demo/README.md +39 -0
- data/examples/{app_map_demo → widget_map_demo}/app.rb +4 -4
- data/examples/widget_overlay_demo/README.md +36 -0
- data/examples/widget_overlay_demo/app.rb +248 -0
- data/examples/widget_popup_demo/README.md +36 -0
- data/examples/widget_ratatui_logo_demo/README.md +34 -0
- data/examples/widget_ratatui_logo_demo/app.rb +1 -1
- data/examples/widget_ratatui_mascot_demo/README.md +34 -0
- data/examples/widget_rect/README.md +38 -0
- data/examples/widget_render/README.md +37 -0
- data/examples/widget_render/app.rb +3 -3
- data/examples/widget_rich_text/README.md +35 -0
- data/examples/widget_rich_text/app.rb +62 -33
- data/examples/widget_scroll_text/README.md +37 -0
- data/examples/widget_scroll_text/app.rb +0 -1
- data/examples/widget_scrollbar_demo/README.md +37 -0
- data/examples/widget_sparkline_demo/README.md +42 -0
- data/examples/widget_sparkline_demo/app.rb +4 -3
- data/examples/widget_style_colors/README.md +34 -0
- data/examples/widget_table_demo/README.md +48 -0
- data/examples/{app_table_select → widget_table_demo}/app.rb +65 -12
- data/examples/widget_tabs_demo/README.md +41 -0
- data/examples/widget_tabs_demo/app.rb +15 -1
- data/examples/widget_text_width/README.md +35 -0
- data/examples/widget_text_width/app.rb +113 -0
- data/exe/.gitkeep +0 -0
- data/ext/ratatui_ruby/Cargo.lock +11 -4
- data/ext/ratatui_ruby/Cargo.toml +2 -1
- data/ext/ratatui_ruby/src/events.rs +238 -26
- data/ext/ratatui_ruby/src/frame.rs +116 -3
- data/ext/ratatui_ruby/src/lib.rs +37 -6
- data/ext/ratatui_ruby/src/rendering.rs +22 -21
- data/ext/ratatui_ruby/src/string_width.rs +101 -0
- data/ext/ratatui_ruby/src/terminal.rs +39 -15
- data/ext/ratatui_ruby/src/text.rs +13 -4
- data/ext/ratatui_ruby/src/widgets/barchart.rs +24 -6
- data/ext/ratatui_ruby/src/widgets/canvas.rs +5 -5
- data/ext/ratatui_ruby/src/widgets/gauge.rs +9 -2
- data/ext/ratatui_ruby/src/widgets/line_gauge.rs +9 -2
- data/ext/ratatui_ruby/src/widgets/list.rs +179 -3
- data/ext/ratatui_ruby/src/widgets/list_state.rs +137 -0
- data/ext/ratatui_ruby/src/widgets/mod.rs +3 -0
- data/ext/ratatui_ruby/src/widgets/scrollbar.rs +93 -1
- data/ext/ratatui_ruby/src/widgets/scrollbar_state.rs +169 -0
- data/ext/ratatui_ruby/src/widgets/table.rs +191 -34
- data/ext/ratatui_ruby/src/widgets/table_state.rs +121 -0
- data/lib/ratatui_ruby/buffer/cell.rb +168 -0
- data/lib/ratatui_ruby/buffer.rb +15 -0
- data/lib/ratatui_ruby/cell.rb +4 -4
- data/lib/ratatui_ruby/event/key/character.rb +35 -0
- data/lib/ratatui_ruby/event/key/media.rb +44 -0
- data/lib/ratatui_ruby/event/key/modifier.rb +95 -0
- data/lib/ratatui_ruby/event/key/navigation.rb +55 -0
- data/lib/ratatui_ruby/event/key/system.rb +45 -0
- data/lib/ratatui_ruby/event/key.rb +111 -51
- data/lib/ratatui_ruby/event/mouse.rb +3 -3
- data/lib/ratatui_ruby/event/paste.rb +1 -1
- data/lib/ratatui_ruby/frame.rb +100 -4
- data/lib/ratatui_ruby/layout/constraint.rb +95 -0
- data/lib/ratatui_ruby/layout/layout.rb +106 -0
- data/lib/ratatui_ruby/layout/rect.rb +118 -0
- data/lib/ratatui_ruby/layout.rb +19 -0
- data/lib/ratatui_ruby/list_state.rb +88 -0
- data/lib/ratatui_ruby/schema/bar_chart/bar.rb +2 -2
- data/lib/ratatui_ruby/schema/cursor.rb +5 -0
- data/lib/ratatui_ruby/schema/gauge.rb +3 -1
- data/lib/ratatui_ruby/schema/layout.rb +1 -1
- data/lib/ratatui_ruby/schema/line_gauge.rb +2 -2
- data/lib/ratatui_ruby/schema/list.rb +25 -4
- data/lib/ratatui_ruby/schema/list_item.rb +41 -0
- data/lib/ratatui_ruby/schema/rect.rb +43 -0
- data/lib/ratatui_ruby/schema/row.rb +66 -0
- data/lib/ratatui_ruby/schema/style.rb +24 -4
- data/lib/ratatui_ruby/schema/table.rb +29 -11
- data/lib/ratatui_ruby/schema/text.rb +96 -3
- data/lib/ratatui_ruby/scrollbar_state.rb +112 -0
- data/lib/ratatui_ruby/style/style.rb +81 -0
- data/lib/ratatui_ruby/style.rb +15 -0
- data/lib/ratatui_ruby/table_state.rb +90 -0
- data/lib/ratatui_ruby/test_helper/event_injection.rb +169 -0
- data/lib/ratatui_ruby/test_helper/snapshot.rb +414 -0
- data/lib/ratatui_ruby/test_helper/style_assertions.rb +351 -0
- data/lib/ratatui_ruby/test_helper/terminal.rb +127 -0
- data/lib/ratatui_ruby/test_helper/test_doubles.rb +68 -0
- data/lib/ratatui_ruby/test_helper.rb +65 -358
- data/lib/ratatui_ruby/tui/buffer_factories.rb +20 -0
- data/lib/ratatui_ruby/tui/canvas_factories.rb +44 -0
- data/lib/ratatui_ruby/tui/core.rb +38 -0
- data/lib/ratatui_ruby/tui/layout_factories.rb +74 -0
- data/lib/ratatui_ruby/tui/state_factories.rb +33 -0
- data/lib/ratatui_ruby/tui/style_factories.rb +20 -0
- data/lib/ratatui_ruby/tui/text_factories.rb +44 -0
- data/lib/ratatui_ruby/tui/widget_factories.rb +195 -0
- data/lib/ratatui_ruby/tui.rb +75 -0
- data/lib/ratatui_ruby/version.rb +1 -1
- data/lib/ratatui_ruby/widgets/bar_chart/bar.rb +47 -0
- data/lib/ratatui_ruby/widgets/bar_chart/bar_group.rb +25 -0
- data/lib/ratatui_ruby/widgets/bar_chart.rb +239 -0
- data/lib/ratatui_ruby/widgets/block.rb +192 -0
- data/lib/ratatui_ruby/widgets/calendar.rb +84 -0
- data/lib/ratatui_ruby/widgets/canvas.rb +231 -0
- data/lib/ratatui_ruby/widgets/cell.rb +47 -0
- data/lib/ratatui_ruby/widgets/center.rb +59 -0
- data/lib/ratatui_ruby/widgets/chart.rb +185 -0
- data/lib/ratatui_ruby/widgets/clear.rb +54 -0
- data/lib/ratatui_ruby/widgets/cursor.rb +42 -0
- data/lib/ratatui_ruby/widgets/gauge.rb +72 -0
- data/lib/ratatui_ruby/widgets/line_gauge.rb +80 -0
- data/lib/ratatui_ruby/widgets/list.rb +127 -0
- data/lib/ratatui_ruby/widgets/list_item.rb +43 -0
- data/lib/ratatui_ruby/widgets/overlay.rb +43 -0
- data/lib/ratatui_ruby/widgets/paragraph.rb +99 -0
- data/lib/ratatui_ruby/widgets/ratatui_logo.rb +31 -0
- data/lib/ratatui_ruby/widgets/ratatui_mascot.rb +36 -0
- data/lib/ratatui_ruby/widgets/row.rb +68 -0
- data/lib/ratatui_ruby/widgets/scrollbar.rb +143 -0
- data/lib/ratatui_ruby/widgets/shape/label.rb +68 -0
- data/lib/ratatui_ruby/widgets/sparkline.rb +134 -0
- data/lib/ratatui_ruby/widgets/table.rb +141 -0
- data/lib/ratatui_ruby/widgets/tabs.rb +85 -0
- data/lib/ratatui_ruby/widgets.rb +40 -0
- data/lib/ratatui_ruby.rb +64 -57
- data/sig/examples/app_all_events/view.rbs +1 -1
- data/sig/examples/app_all_events/view_state.rbs +1 -1
- data/sig/examples/app_stateful_interaction/app.rbs +33 -0
- data/sig/examples/widget_block_demo/app.rbs +32 -0
- data/sig/examples/{app_map_demo → widget_map_demo}/app.rbs +2 -2
- data/sig/examples/{app_table_select → widget_table_demo}/app.rbs +2 -2
- data/sig/examples/{widget_table_flex → widget_text_width}/app.rbs +2 -3
- data/sig/ratatui_ruby/event.rbs +11 -1
- data/sig/ratatui_ruby/frame.rbs +2 -0
- data/sig/ratatui_ruby/list_state.rbs +13 -0
- data/sig/ratatui_ruby/ratatui_ruby.rbs +2 -2
- data/sig/ratatui_ruby/schema/bar_chart/bar.rbs +3 -3
- data/sig/ratatui_ruby/schema/gauge.rbs +2 -2
- data/sig/ratatui_ruby/schema/line_gauge.rbs +2 -2
- data/sig/ratatui_ruby/schema/list.rbs +4 -2
- data/sig/ratatui_ruby/schema/list_item.rbs +10 -0
- data/sig/ratatui_ruby/schema/rect.rbs +3 -0
- data/sig/ratatui_ruby/schema/row.rbs +22 -0
- data/sig/ratatui_ruby/schema/style.rbs +3 -3
- data/sig/ratatui_ruby/schema/table.rbs +3 -1
- data/sig/ratatui_ruby/schema/text.rbs +9 -6
- data/sig/ratatui_ruby/scrollbar_state.rbs +18 -0
- data/sig/ratatui_ruby/session.rbs +41 -48
- data/sig/ratatui_ruby/table_state.rbs +15 -0
- data/sig/ratatui_ruby/test_helper/event_injection.rbs +16 -0
- data/sig/ratatui_ruby/test_helper/snapshot.rbs +12 -0
- data/sig/ratatui_ruby/test_helper/style_assertions.rbs +64 -0
- data/sig/ratatui_ruby/test_helper/terminal.rbs +14 -0
- data/sig/ratatui_ruby/test_helper/test_doubles.rbs +22 -0
- data/sig/ratatui_ruby/test_helper.rbs +5 -4
- data/sig/ratatui_ruby/tui/buffer_factories.rbs +10 -0
- data/sig/ratatui_ruby/tui/canvas_factories.rbs +14 -0
- data/sig/ratatui_ruby/tui/core.rbs +14 -0
- data/sig/ratatui_ruby/tui/layout_factories.rbs +19 -0
- data/sig/ratatui_ruby/tui/state_factories.rbs +12 -0
- data/sig/ratatui_ruby/tui/style_factories.rbs +10 -0
- data/sig/ratatui_ruby/tui/text_factories.rbs +14 -0
- data/sig/ratatui_ruby/tui/widget_factories.rbs +39 -0
- data/sig/ratatui_ruby/tui.rbs +19 -0
- data/tasks/autodoc/examples.rb +79 -0
- data/tasks/autodoc.rake +7 -35
- data/tasks/bump/changelog.rb +3 -3
- data/tasks/bump/links.rb +67 -0
- data/tasks/sourcehut.rake +64 -21
- data/tasks/terminal_preview/app_screenshot.rb +13 -3
- data/tasks/terminal_preview/saved_screenshot.rb +4 -3
- metadata +169 -48
- data/doc/contributors/dwim_dx.md +0 -366
- data/doc/images/app_analytics.png +0 -0
- data/doc/images/app_custom_widget.png +0 -0
- data/doc/images/app_mouse_events.png +0 -0
- data/doc/images/app_table_select.png +0 -0
- data/doc/images/widget_block_padding.png +0 -0
- data/doc/images/widget_block_titles.png +0 -0
- data/doc/images/widget_list_styles.png +0 -0
- data/doc/images/widget_table_flex.png +0 -0
- data/examples/app_all_events/model/events.rb +0 -180
- data/examples/app_all_events/model/highlight.rb +0 -57
- data/examples/app_all_events/test/snapshots/after_focus_lost.txt +0 -24
- data/examples/app_all_events/test/snapshots/after_focus_regained.txt +0 -24
- data/examples/app_all_events/test/snapshots/after_horizontal_resize.txt +0 -24
- data/examples/app_all_events/test/snapshots/after_key_a.txt +0 -24
- data/examples/app_all_events/test/snapshots/after_key_ctrl_x.txt +0 -24
- data/examples/app_all_events/test/snapshots/after_mouse_click.txt +0 -24
- data/examples/app_all_events/test/snapshots/after_mouse_drag.txt +0 -24
- data/examples/app_all_events/test/snapshots/after_multiple_events.txt +0 -24
- data/examples/app_all_events/test/snapshots/after_paste.txt +0 -24
- data/examples/app_all_events/test/snapshots/after_resize.txt +0 -24
- data/examples/app_all_events/test/snapshots/after_right_click.txt +0 -24
- data/examples/app_all_events/test/snapshots/after_vertical_resize.txt +0 -24
- data/examples/app_all_events/test/snapshots/initial_state.txt +0 -24
- data/examples/app_all_events/view_state.rb +0 -42
- data/examples/app_color_picker/scene.rb +0 -201
- data/examples/widget_block_padding/app.rb +0 -67
- data/examples/widget_block_titles/app.rb +0 -69
- data/examples/widget_list_styles/app.rb +0 -141
- data/examples/widget_table_flex/app.rb +0 -95
- data/lib/ratatui_ruby/session/autodoc.rb +0 -417
- data/lib/ratatui_ruby/session.rb +0 -163
- data/sig/examples/widget_block_padding/app.rbs +0 -11
- data/sig/examples/widget_block_titles/app.rbs +0 -11
- data/sig/examples/widget_list_styles/app.rbs +0 -11
- data/tasks/autodoc/inventory.rb +0 -61
- data/tasks/autodoc/notice.rb +0 -26
- data/tasks/autodoc/rbs.rb +0 -38
- data/tasks/autodoc/rdoc.rb +0 -45
- data/tasks/bump/comparison_links.rb +0 -41
- /data/doc/images/{app_map_demo.png → widget_map_demo.png} +0 -0
|
@@ -5,12 +5,12 @@ module RatatuiRuby
|
|
|
5
5
|
class BarChart
|
|
6
6
|
class Bar < Data
|
|
7
7
|
attr_reader value: Integer
|
|
8
|
-
attr_reader label: String?
|
|
8
|
+
attr_reader label: (String | Text::Span | Text::Line)?
|
|
9
9
|
attr_reader style: Style?
|
|
10
10
|
attr_reader value_style: Style?
|
|
11
|
-
attr_reader text_value: String?
|
|
11
|
+
attr_reader text_value: (String | Text::Span | Text::Line)?
|
|
12
12
|
|
|
13
|
-
def self.new: (value: Numeric, ?label: String
|
|
13
|
+
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
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
end
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
module RatatuiRuby
|
|
5
5
|
class Gauge < Data
|
|
6
6
|
attr_reader ratio: Float
|
|
7
|
-
attr_reader label: String?
|
|
7
|
+
attr_reader label: (String | Text::Span)?
|
|
8
8
|
attr_reader style: Style?
|
|
9
9
|
attr_reader gauge_style: Style?
|
|
10
10
|
attr_reader block: Block?
|
|
11
11
|
|
|
12
12
|
attr_reader use_unicode: bool
|
|
13
|
-
def self.new: (?ratio: Numeric?, ?percent: Numeric?, ?label: String
|
|
13
|
+
def self.new: (?ratio: Numeric?, ?percent: Numeric?, ?label: String | Text::Span | nil, ?style: Style?, ?gauge_style: Style?, ?block: Block?, ?use_unicode: bool) -> Gauge
|
|
14
14
|
end
|
|
15
15
|
end
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
module RatatuiRuby
|
|
5
5
|
class LineGauge < Data
|
|
6
6
|
attr_reader ratio: Float
|
|
7
|
-
attr_reader label: String?
|
|
7
|
+
attr_reader label: (String | Text::Span)?
|
|
8
8
|
attr_reader filled_style: Style?
|
|
9
9
|
attr_reader unfilled_style: Style?
|
|
10
10
|
attr_reader block: Block?
|
|
11
11
|
attr_reader filled_symbol: String
|
|
12
12
|
attr_reader unfilled_symbol: String
|
|
13
13
|
|
|
14
|
-
def self.new: (?ratio: Numeric, ?label: String
|
|
14
|
+
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
|
|
15
15
|
end
|
|
16
16
|
end
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
module RatatuiRuby
|
|
5
5
|
class List < Data
|
|
6
|
-
attr_reader items: Array[String]
|
|
6
|
+
attr_reader items: Array[String | Text::Span | Text::Line | ListItem]
|
|
7
7
|
attr_reader selected_index: Integer?
|
|
8
|
+
attr_reader offset: Integer?
|
|
8
9
|
attr_reader style: Style?
|
|
9
10
|
attr_reader highlight_style: Style?
|
|
10
11
|
attr_reader highlight_symbol: String?
|
|
@@ -13,6 +14,7 @@ module RatatuiRuby
|
|
|
13
14
|
attr_reader direction: Symbol
|
|
14
15
|
attr_reader scroll_padding: Integer?
|
|
15
16
|
attr_reader block: Block?
|
|
16
|
-
def self.new: (?items: Array[String], ?selected_index: Numeric?, ?style: Style?, ?highlight_style: Style?, ?highlight_symbol: String?, ?repeat_highlight_symbol: bool, ?highlight_spacing: Symbol, ?direction: Symbol, ?scroll_padding: Numeric?, ?block: Block?) -> List
|
|
17
|
+
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
|
|
17
18
|
end
|
|
18
19
|
end
|
|
20
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
2
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
module RatatuiRuby
|
|
5
|
+
class ListItem < Data
|
|
6
|
+
attr_reader content: String | Text::Span | Text::Line
|
|
7
|
+
attr_reader style: Style?
|
|
8
|
+
def self.new: (content: String | Text::Span | Text::Line, ?style: Style?) -> ListItem
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -11,5 +11,8 @@ module RatatuiRuby
|
|
|
11
11
|
attr_reader height: Integer
|
|
12
12
|
def self.new: (?x: Numeric, ?y: Numeric, ?width: Numeric, ?height: Numeric) -> instance
|
|
13
13
|
def contains?: (Integer px, Integer py) -> bool
|
|
14
|
+
def intersects?: (Rect other) -> bool
|
|
15
|
+
def intersection: (Rect other) -> Rect?
|
|
14
16
|
end
|
|
15
17
|
end
|
|
18
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
2
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
module RatatuiRuby
|
|
5
|
+
class Row < Data
|
|
6
|
+
type cell_content = String | Text::Span | Text::Line | Paragraph | Cell
|
|
7
|
+
|
|
8
|
+
attr_reader cells: Array[cell_content]
|
|
9
|
+
attr_reader style: Style?
|
|
10
|
+
attr_reader height: Integer?
|
|
11
|
+
attr_reader top_margin: Integer?
|
|
12
|
+
attr_reader bottom_margin: Integer?
|
|
13
|
+
|
|
14
|
+
def self.new: (
|
|
15
|
+
cells: Array[cell_content],
|
|
16
|
+
?style: Style?,
|
|
17
|
+
?height: Integer?,
|
|
18
|
+
?top_margin: Integer?,
|
|
19
|
+
?bottom_margin: Integer?
|
|
20
|
+
) -> Row
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
module RatatuiRuby
|
|
5
5
|
class Style < Data
|
|
6
|
-
attr_reader fg: (String | Symbol)?
|
|
7
|
-
attr_reader bg: (String | Symbol)?
|
|
6
|
+
attr_reader fg: (String | Symbol | Integer)?
|
|
7
|
+
attr_reader bg: (String | Symbol | Integer)?
|
|
8
8
|
attr_reader modifiers: Array[Symbol]
|
|
9
9
|
|
|
10
|
-
def self.new: (?fg: (String | Symbol)?, ?bg: (String | Symbol)?, ?modifiers: Array[Symbol]) -> Style
|
|
10
|
+
def self.new: (?fg: (String | Symbol | Integer)?, ?bg: (String | Symbol | Integer)?, ?modifiers: Array[Symbol]) -> Style
|
|
11
11
|
def self.default: () -> Style
|
|
12
12
|
end
|
|
13
13
|
end
|
|
@@ -14,7 +14,9 @@ module RatatuiRuby
|
|
|
14
14
|
attr_reader highlight_spacing: Symbol
|
|
15
15
|
attr_reader column_highlight_style: Style?
|
|
16
16
|
attr_reader selected_column: Integer?
|
|
17
|
+
attr_reader offset: Integer?
|
|
17
18
|
|
|
18
|
-
def self.new: (?header: Array[String | Paragraph]?, ?rows: Array[Array[String | Paragraph | Style | _ToS]], ?widths: Array[Constraint], ?
|
|
19
|
+
def self.new: (?header: Array[String | Paragraph]?, ?rows: Array[Array[String | Paragraph | Style | _ToS]], ?widths: Array[Constraint], ?row_highlight_style: Style?, ?highlight_symbol: String, ?highlight_spacing: Symbol, ?column_highlight_style: Style?, ?cell_highlight_style: Style?, ?selected_row: Numeric?, ?selected_column: Numeric?, ?offset: Numeric?, ?block: Block?, ?footer: Array[String | Paragraph]?, ?flex: Symbol, ?style: (Style | Hash[Symbol, untyped])?, ?column_spacing: Numeric) -> Table
|
|
19
20
|
end
|
|
20
21
|
end
|
|
22
|
+
|
|
@@ -5,18 +5,21 @@ module RatatuiRuby
|
|
|
5
5
|
module Text
|
|
6
6
|
class Span < Data
|
|
7
7
|
attr_reader content: String
|
|
8
|
-
attr_reader style: Style
|
|
8
|
+
attr_reader style: Style | nil
|
|
9
9
|
|
|
10
|
-
def
|
|
11
|
-
def self.styled: (String,
|
|
10
|
+
def initialize: (content: String, style: Style | nil) -> void
|
|
11
|
+
def self.styled: (String, Style | nil) -> Span
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
class Line < Data
|
|
15
15
|
attr_reader spans: Array[Span]
|
|
16
|
-
attr_reader alignment:
|
|
16
|
+
attr_reader alignment: Symbol | nil
|
|
17
17
|
|
|
18
|
-
def
|
|
19
|
-
def self.from_string: (String,
|
|
18
|
+
def initialize: (spans: Array[Span], alignment: Symbol | nil) -> void
|
|
19
|
+
def self.from_string: (String, alignment: Symbol | nil) -> Line
|
|
20
|
+
def width: () -> Integer
|
|
20
21
|
end
|
|
22
|
+
|
|
23
|
+
def self.width: (String) -> Integer
|
|
21
24
|
end
|
|
22
25
|
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
2
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
module RatatuiRuby
|
|
5
|
+
class ScrollbarState
|
|
6
|
+
def self.new: (Integer content_length) -> ScrollbarState
|
|
7
|
+
def position: () -> Integer
|
|
8
|
+
def position=: (Integer value) -> Integer
|
|
9
|
+
def content_length: () -> Integer
|
|
10
|
+
def content_length=: (Integer value) -> Integer
|
|
11
|
+
def viewport_content_length: () -> Integer
|
|
12
|
+
def viewport_content_length=: (Integer value) -> Integer
|
|
13
|
+
def first: () -> nil
|
|
14
|
+
def last: () -> nil
|
|
15
|
+
def next: () -> nil
|
|
16
|
+
def prev: () -> nil
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -13,6 +13,7 @@ module RatatuiRuby
|
|
|
13
13
|
def _paragraph_line_count: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
14
14
|
def _paragraph_line_width: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
15
15
|
def _tabs_width: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
16
|
+
def _text_width: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
16
17
|
def clear_events: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
17
18
|
def draw: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
18
19
|
def experimental_warnings: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
@@ -28,33 +29,13 @@ module RatatuiRuby
|
|
|
28
29
|
def restore_terminal: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
29
30
|
def run: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
30
31
|
def warn_experimental_feature: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
31
|
-
def
|
|
32
|
-
def
|
|
33
|
-
def bar_chart_bar: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
34
|
-
def bar_chart_bar_group: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
35
|
-
def block: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
36
|
-
def calendar: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
37
|
-
def canvas: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
38
|
-
def cell: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
39
|
-
def cell_char: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
40
|
-
def cell_default: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
41
|
-
def cell_empty: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
42
|
-
def cell_symbol: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
43
|
-
def center: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
44
|
-
def chart: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
45
|
-
def clear: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
46
|
-
def constraint: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
47
|
-
def constraint_fill: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
48
|
-
def constraint_length: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
49
|
-
def constraint_max: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
50
|
-
def constraint_min: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
51
|
-
def constraint_percentage: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
52
|
-
def constraint_ratio: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
53
|
-
def cursor: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
54
|
-
def dataset: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
32
|
+
def draw_cell: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
33
|
+
def draw_string: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
55
34
|
def draw_cell_cmd: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
56
35
|
def draw_string_cmd: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
57
36
|
def error: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
37
|
+
def error_safety: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
38
|
+
def error_terminal: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
58
39
|
def event: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
59
40
|
def event_focus_gained: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
60
41
|
def event_focus_lost: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
@@ -64,31 +45,43 @@ module RatatuiRuby
|
|
|
64
45
|
def event_paste: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
65
46
|
def event_resize: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
66
47
|
def frame: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
67
|
-
def
|
|
68
|
-
def
|
|
69
|
-
def
|
|
70
|
-
def
|
|
71
|
-
def
|
|
72
|
-
def
|
|
73
|
-
def
|
|
74
|
-
def
|
|
75
|
-
def
|
|
76
|
-
def
|
|
77
|
-
def
|
|
78
|
-
def rect: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
79
|
-
def scrollbar: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
80
|
-
def shape_circle: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
81
|
-
def shape_label: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
82
|
-
def shape_line: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
83
|
-
def shape_map: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
84
|
-
def shape_point: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
85
|
-
def shape_rectangle: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
86
|
-
def sparkline: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
87
|
-
def style: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
88
|
-
def style_default: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
89
|
-
def table: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
90
|
-
def tabs: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
48
|
+
def layout_constraint: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
49
|
+
def layout_layout: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
50
|
+
def layout_rect: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
51
|
+
def list_state: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
52
|
+
def list_state_new: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
53
|
+
def scrollbar_state: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
54
|
+
def scrollbar_state_new: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
55
|
+
def style_style: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
56
|
+
def table_state: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
57
|
+
def table_state_new: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
58
|
+
def text_width: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
91
59
|
def text_line: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
92
60
|
def text_span: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
61
|
+
def widgets_axis: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
62
|
+
def widgets_bar_chart: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
63
|
+
def widgets_block: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
64
|
+
def widgets_calendar: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
65
|
+
def widgets_canvas: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
66
|
+
def widgets_cell: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
67
|
+
def widgets_center: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
68
|
+
def widgets_chart: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
69
|
+
def widgets_clear: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
70
|
+
def widgets_cursor: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
71
|
+
def widgets_dataset: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
72
|
+
def widgets_gauge: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
73
|
+
def widgets_line_chart: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
74
|
+
def widgets_line_gauge: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
75
|
+
def widgets_list: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
76
|
+
def widgets_list_item: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
77
|
+
def widgets_overlay: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
78
|
+
def widgets_paragraph: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
79
|
+
def widgets_ratatui_logo: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
80
|
+
def widgets_ratatui_mascot: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
81
|
+
def widgets_row: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
82
|
+
def widgets_scrollbar: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
83
|
+
def widgets_sparkline: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
84
|
+
def widgets_table: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
85
|
+
def widgets_tabs: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
93
86
|
end
|
|
94
87
|
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
2
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
module RatatuiRuby
|
|
5
|
+
class TableState
|
|
6
|
+
def self.new: (?Integer? selected) -> TableState
|
|
7
|
+
def select: (Integer? index) -> nil
|
|
8
|
+
def selected: () -> Integer?
|
|
9
|
+
def select_column: (Integer? index) -> nil
|
|
10
|
+
def selected_column: () -> Integer?
|
|
11
|
+
def offset: () -> Integer
|
|
12
|
+
def scroll_down_by: (Integer n) -> nil
|
|
13
|
+
def scroll_up_by: (Integer n) -> nil
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
2
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
module RatatuiRuby
|
|
5
|
+
module TestHelper
|
|
6
|
+
module EventInjection
|
|
7
|
+
def inject_event: (Event::Base event) -> void
|
|
8
|
+
def inject_mouse: (x: Integer, y: Integer, ?kind: Symbol, ?modifiers: Array[String], ?button: Symbol) -> void
|
|
9
|
+
def inject_click: (x: Integer, y: Integer, ?modifiers: Array[String]) -> void
|
|
10
|
+
def inject_right_click: (x: Integer, y: Integer, ?modifiers: Array[String]) -> void
|
|
11
|
+
def inject_drag: (x: Integer, y: Integer, ?modifiers: Array[String], ?button: Symbol) -> void
|
|
12
|
+
def inject_keys: (*(String | Symbol | (Hash[Symbol, untyped]) | Event::Key) args) -> void
|
|
13
|
+
alias inject_key inject_keys
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
2
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
module RatatuiRuby
|
|
5
|
+
module TestHelper
|
|
6
|
+
module Snapshot
|
|
7
|
+
def assert_snapshot: (String name, ?String? msg) ?{ (Array[String]) -> Array[String] } -> void
|
|
8
|
+
def assert_screen_matches: (String | Array[String] expected, ?String? msg) ?{ (Array[String]) -> Array[String] } -> void
|
|
9
|
+
def assert_rich_snapshot: (String name, ?String? msg) ?{ (Array[String]) -> Array[String] } -> void
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
2
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
module RatatuiRuby
|
|
5
|
+
module TestHelper
|
|
6
|
+
module StyleAssertions
|
|
7
|
+
def assert_cell_style: (Integer x, Integer y, **untyped expected_attributes) -> void
|
|
8
|
+
def assert_color: (Symbol | Integer | String expected, x: Integer, y: Integer, ?layer: Symbol) -> void
|
|
9
|
+
def assert_area_style: (Rect | Hash[Symbol, Integer] area, **untyped attributes) -> void
|
|
10
|
+
def assert_fg_color: (Symbol | Integer | String expected, Integer x, Integer y) -> void
|
|
11
|
+
alias assert_fg assert_fg_color
|
|
12
|
+
def assert_bg_color: (Symbol | Integer | String expected, Integer x, Integer y) -> void
|
|
13
|
+
alias assert_bg assert_bg_color
|
|
14
|
+
def assert_bold: (Integer x, Integer y) -> void
|
|
15
|
+
def assert_italic: (Integer x, Integer y) -> void
|
|
16
|
+
def assert_underlined: (Integer x, Integer y) -> void
|
|
17
|
+
alias assert_underline assert_underlined
|
|
18
|
+
def assert_dim: (Integer x, Integer y) -> void
|
|
19
|
+
def assert_reversed: (Integer x, Integer y) -> void
|
|
20
|
+
alias assert_inverse assert_reversed
|
|
21
|
+
alias assert_inverse_video assert_reversed
|
|
22
|
+
def assert_crossed_out: (Integer x, Integer y) -> void
|
|
23
|
+
alias assert_strikethrough assert_crossed_out
|
|
24
|
+
alias assert_strike assert_crossed_out
|
|
25
|
+
def assert_hidden: (Integer x, Integer y) -> void
|
|
26
|
+
def assert_slow_blink: (Integer x, Integer y) -> void
|
|
27
|
+
alias assert_blink assert_slow_blink
|
|
28
|
+
def assert_rapid_blink: (Integer x, Integer y) -> void
|
|
29
|
+
|
|
30
|
+
def assert_black: (Integer x, Integer y) -> void
|
|
31
|
+
def assert_bg_black: (Integer x, Integer y) -> void
|
|
32
|
+
def assert_red: (Integer x, Integer y) -> void
|
|
33
|
+
def assert_bg_red: (Integer x, Integer y) -> void
|
|
34
|
+
def assert_green: (Integer x, Integer y) -> void
|
|
35
|
+
def assert_bg_green: (Integer x, Integer y) -> void
|
|
36
|
+
def assert_yellow: (Integer x, Integer y) -> void
|
|
37
|
+
def assert_bg_yellow: (Integer x, Integer y) -> void
|
|
38
|
+
def assert_blue: (Integer x, Integer y) -> void
|
|
39
|
+
def assert_bg_blue: (Integer x, Integer y) -> void
|
|
40
|
+
def assert_magenta: (Integer x, Integer y) -> void
|
|
41
|
+
def assert_bg_magenta: (Integer x, Integer y) -> void
|
|
42
|
+
def assert_cyan: (Integer x, Integer y) -> void
|
|
43
|
+
def assert_bg_cyan: (Integer x, Integer y) -> void
|
|
44
|
+
def assert_gray: (Integer x, Integer y) -> void
|
|
45
|
+
def assert_bg_gray: (Integer x, Integer y) -> void
|
|
46
|
+
def assert_dark_gray: (Integer x, Integer y) -> void
|
|
47
|
+
def assert_bg_dark_gray: (Integer x, Integer y) -> void
|
|
48
|
+
def assert_light_red: (Integer x, Integer y) -> void
|
|
49
|
+
def assert_bg_light_red: (Integer x, Integer y) -> void
|
|
50
|
+
def assert_light_green: (Integer x, Integer y) -> void
|
|
51
|
+
def assert_bg_light_green: (Integer x, Integer y) -> void
|
|
52
|
+
def assert_light_yellow: (Integer x, Integer y) -> void
|
|
53
|
+
def assert_bg_light_yellow: (Integer x, Integer y) -> void
|
|
54
|
+
def assert_light_blue: (Integer x, Integer y) -> void
|
|
55
|
+
def assert_bg_light_blue: (Integer x, Integer y) -> void
|
|
56
|
+
def assert_light_magenta: (Integer x, Integer y) -> void
|
|
57
|
+
def assert_bg_light_magenta: (Integer x, Integer y) -> void
|
|
58
|
+
def assert_light_cyan: (Integer x, Integer y) -> void
|
|
59
|
+
def assert_bg_light_cyan: (Integer x, Integer y) -> void
|
|
60
|
+
def assert_white: (Integer x, Integer y) -> void
|
|
61
|
+
def assert_bg_white: (Integer x, Integer y) -> void
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
2
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
module RatatuiRuby
|
|
5
|
+
module TestHelper
|
|
6
|
+
module Terminal
|
|
7
|
+
def with_test_terminal: (?Integer width, ?Integer height, ?timeout: Integer?) ?{ () -> void } -> void
|
|
8
|
+
def buffer_content: () -> Array[String]
|
|
9
|
+
def cursor_position: () -> { x: Integer, y: Integer }
|
|
10
|
+
def get_cell: (Integer x, Integer y) -> Cell
|
|
11
|
+
def print_buffer: () -> void
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
2
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
module RatatuiRuby
|
|
5
|
+
module TestHelper
|
|
6
|
+
module TestDoubles
|
|
7
|
+
class MockFrame < Data
|
|
8
|
+
attr_accessor rendered_widgets: Array[{ widget: untyped, area: Rect }]
|
|
9
|
+
def self.new: (?rendered_widgets: Array[{ widget: untyped, area: Rect }]) -> MockFrame
|
|
10
|
+
def render_widget: (untyped widget, Rect area) -> void
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class StubRect < Data
|
|
14
|
+
attr_accessor x: Integer
|
|
15
|
+
attr_accessor y: Integer
|
|
16
|
+
attr_accessor width: Integer
|
|
17
|
+
attr_accessor height: Integer
|
|
18
|
+
def self.new: (?x: Integer, ?y: Integer, ?width: Integer, ?height: Integer) -> StubRect
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
module RatatuiRuby
|
|
5
5
|
module TestHelper
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
include Terminal
|
|
7
|
+
include Snapshot
|
|
8
|
+
include EventInjection
|
|
9
|
+
include StyleAssertions
|
|
10
|
+
include TestDoubles
|
|
10
11
|
end
|
|
11
12
|
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
2
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
module RatatuiRuby
|
|
5
|
+
class TUI
|
|
6
|
+
module BufferFactories
|
|
7
|
+
def cell: (?char: String?, ?fg: Symbol?, ?bg: Symbol?, ?modifiers: Array[Symbol]?) -> Buffer::Cell
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
2
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
module RatatuiRuby
|
|
5
|
+
class TUI
|
|
6
|
+
module CanvasFactories
|
|
7
|
+
def shape_map: (**top) -> Widgets::Shape::Map
|
|
8
|
+
def shape_line: (**top) -> Widgets::Shape::Line
|
|
9
|
+
def shape_point: (**top) -> Widgets::Shape::Point
|
|
10
|
+
def shape_circle: (**top) -> Widgets::Shape::Circle
|
|
11
|
+
def shape_rectangle: (**top) -> Widgets::Shape::Rectangle
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
2
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
module RatatuiRuby
|
|
5
|
+
class TUI
|
|
6
|
+
module Core
|
|
7
|
+
def draw: (?Widgets::_Widget? tree) -> void
|
|
8
|
+
| () { (Frame) -> void } -> void
|
|
9
|
+
def poll_event: (?timeout: Float) -> Event::event
|
|
10
|
+
def get_cell_at: (Integer x, Integer y) -> Buffer::Cell
|
|
11
|
+
def draw_cell: (Integer x, Integer y, Buffer::Cell cell) -> Draw::CellCmd
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
2
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
module RatatuiRuby
|
|
5
|
+
class TUI
|
|
6
|
+
module LayoutFactories
|
|
7
|
+
def rect: (?x: Integer, ?y: Integer, ?width: Integer, ?height: Integer) -> Layout::Rect
|
|
8
|
+
def constraint: (**top) -> Layout::Constraint
|
|
9
|
+
def constraint_length: (Integer n) -> Layout::Constraint
|
|
10
|
+
def constraint_percentage: (Integer n) -> Layout::Constraint
|
|
11
|
+
def constraint_min: (Integer n) -> Layout::Constraint
|
|
12
|
+
def constraint_max: (Integer n) -> Layout::Constraint
|
|
13
|
+
def constraint_fill: (?Integer n) -> Layout::Constraint
|
|
14
|
+
def constraint_ratio: (Integer numerator, Integer denominator) -> Layout::Constraint
|
|
15
|
+
def layout: (**top) -> Layout::Layout
|
|
16
|
+
def layout_split: (Layout::Rect area, ?direction: Symbol, constraints: Array[Layout::Constraint], ?flex: Symbol) -> Array[Layout::Rect]
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
2
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
module RatatuiRuby
|
|
5
|
+
class TUI
|
|
6
|
+
module StateFactories
|
|
7
|
+
def list_state: (**top) -> ListState
|
|
8
|
+
def table_state: (**top) -> TableState
|
|
9
|
+
def scrollbar_state: (**top) -> ScrollbarState
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
2
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
module RatatuiRuby
|
|
5
|
+
class TUI
|
|
6
|
+
module StyleFactories
|
|
7
|
+
def style: (?fg: Symbol?, ?bg: Symbol?, ?modifiers: Array[Symbol]?) -> Style::Style
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
2
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
module RatatuiRuby
|
|
5
|
+
class TUI
|
|
6
|
+
module TextFactories
|
|
7
|
+
def text_span: (?content: String, ?style: Style::Style?) -> Text::Span
|
|
8
|
+
def span: (?content: String, ?style: Style::Style?) -> Text::Span
|
|
9
|
+
def text_line: (?spans: Array[Text::Span], ?alignment: Symbol?) -> Text::Line
|
|
10
|
+
def line: (?spans: Array[Text::Span], ?alignment: Symbol?) -> Text::Line
|
|
11
|
+
def text_width: (String string) -> Integer
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
2
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
module RatatuiRuby
|
|
5
|
+
class TUI
|
|
6
|
+
module WidgetFactories
|
|
7
|
+
def block: (**top) -> Widgets::Block
|
|
8
|
+
def paragraph: (**top) -> Widgets::Paragraph
|
|
9
|
+
def list: (**top) -> Widgets::List
|
|
10
|
+
def list_item: (**top) -> Widgets::ListItem
|
|
11
|
+
def table: (**top) -> Widgets::Table
|
|
12
|
+
def row: (**top) -> Widgets::Row
|
|
13
|
+
def table_row: (**top) -> Widgets::Row
|
|
14
|
+
def table_cell: (**top) -> Widgets::Cell
|
|
15
|
+
def tabs: (**top) -> Widgets::Tabs
|
|
16
|
+
def gauge: (**top) -> Widgets::Gauge
|
|
17
|
+
def line_gauge: (**top) -> Widgets::LineGauge
|
|
18
|
+
def sparkline: (**top) -> Widgets::Sparkline
|
|
19
|
+
def bar_chart: (**top) -> Widgets::BarChart
|
|
20
|
+
def bar: (**top) -> Widgets::BarChart::Bar
|
|
21
|
+
def bar_group: (**top) -> Widgets::BarChart::BarGroup
|
|
22
|
+
def bar_chart_bar: (**top) -> Widgets::BarChart::Bar
|
|
23
|
+
def bar_chart_bar_group: (**top) -> Widgets::BarChart::BarGroup
|
|
24
|
+
def chart: (**top) -> Widgets::Chart
|
|
25
|
+
def dataset: (**top) -> Widgets::Dataset
|
|
26
|
+
def axis: (**top) -> Widgets::Axis
|
|
27
|
+
def scrollbar: (**top) -> Widgets::Scrollbar
|
|
28
|
+
def calendar: (**top) -> Widgets::Calendar
|
|
29
|
+
def canvas: (**top) -> Widgets::Canvas
|
|
30
|
+
def clear: (**top) -> Widgets::Clear
|
|
31
|
+
def cursor: (**top) -> Widgets::Cursor
|
|
32
|
+
def overlay: (**top) -> Widgets::Overlay
|
|
33
|
+
def center: (**top) -> Widgets::Center
|
|
34
|
+
def ratatui_logo: (**top) -> Widgets::RatatuiLogo
|
|
35
|
+
def ratatui_mascot: (**top) -> Widgets::RatatuiMascot
|
|
36
|
+
def shape_label: (**top) -> Widgets::Shape::Label
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
2
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
module RatatuiRuby
|
|
5
|
+
# Terminal User Interface facade providing a concise DSL for building TUI applications.
|
|
6
|
+
#
|
|
7
|
+
# Combines all factory mixins to provide convenient access to widgets, layouts,
|
|
8
|
+
# styles, and terminal operations without verbose class name qualification.
|
|
9
|
+
class TUI
|
|
10
|
+
include Core
|
|
11
|
+
include LayoutFactories
|
|
12
|
+
include StyleFactories
|
|
13
|
+
include WidgetFactories
|
|
14
|
+
include TextFactories
|
|
15
|
+
include StateFactories
|
|
16
|
+
include CanvasFactories
|
|
17
|
+
include BufferFactories
|
|
18
|
+
end
|
|
19
|
+
end
|