ratatui_ruby 0.7.1 → 0.7.2
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 +8 -1
- data/CHANGELOG.md +21 -0
- data/README.md +5 -5
- data/Rakefile +1 -1
- data/doc/{application_architecture.md → concepts/application_architecture.md} +30 -0
- data/doc/{event_handling.md → concepts/event_handling.md} +1 -1
- data/doc/contributors/auditing/parity.md +233 -0
- data/doc/contributors/developing_examples.md +3 -3
- data/doc/contributors/v1.0.0_blockers.md +8 -8
- data/doc/{quickstart.md → getting_started/quickstart.md} +26 -26
- data/doc/{why.md → getting_started/why.md} +1 -1
- data/doc/index.md +23 -9
- data/doc/{terminal_limitations.md → troubleshooting/terminal_limitations.md} +33 -0
- data/examples/app_all_events/README.md +1 -0
- data/examples/app_all_events/app.rb +2 -0
- data/examples/app_all_events/model/app_model.rb +2 -0
- data/examples/app_all_events/model/event_color_cycle.rb +2 -0
- data/examples/app_all_events/model/event_entry.rb +2 -0
- data/examples/app_all_events/model/msg.rb +2 -0
- data/examples/app_all_events/model/timestamp.rb +2 -0
- data/examples/app_all_events/update.rb +2 -0
- data/examples/app_all_events/view/app_view.rb +2 -0
- data/examples/app_all_events/view/controls_view.rb +2 -0
- data/examples/app_all_events/view/counts_view.rb +2 -0
- data/examples/app_all_events/view/live_view.rb +2 -0
- data/examples/app_all_events/view/log_view.rb +2 -0
- data/examples/app_all_events/view.rb +2 -0
- data/examples/app_color_picker/README.md +2 -0
- data/examples/app_color_picker/app.rb +2 -0
- data/examples/app_color_picker/clipboard.rb +2 -0
- data/examples/app_color_picker/color.rb +2 -0
- data/examples/app_color_picker/controls.rb +2 -0
- data/examples/app_color_picker/copy_dialog.rb +2 -0
- data/examples/app_color_picker/export_pane.rb +2 -0
- data/examples/app_color_picker/harmony.rb +2 -0
- data/examples/app_color_picker/input.rb +2 -0
- data/examples/app_color_picker/main_container.rb +2 -0
- data/examples/app_color_picker/palette.rb +2 -0
- data/examples/app_login_form/README.md +3 -0
- data/examples/app_login_form/app.rb +2 -0
- data/examples/app_stateful_interaction/README.md +2 -0
- data/examples/app_stateful_interaction/app.rb +2 -0
- data/examples/timeout_demo.rb +2 -0
- data/examples/verify_quickstart_dsl/README.md +2 -2
- data/examples/verify_quickstart_dsl/app.rb +2 -0
- data/examples/verify_quickstart_layout/README.md +2 -2
- data/examples/verify_quickstart_layout/app.rb +2 -0
- data/examples/verify_quickstart_lifecycle/README.md +2 -2
- data/examples/verify_quickstart_lifecycle/app.rb +2 -0
- data/examples/verify_readme_usage/app.rb +2 -0
- data/examples/{widget_barchart_demo → widget_barchart}/README.md +5 -3
- data/examples/{widget_barchart_demo → widget_barchart}/app.rb +7 -5
- data/examples/{widget_block_demo → widget_block}/README.md +5 -3
- data/examples/{widget_block_demo → widget_block}/app.rb +6 -4
- data/examples/{widget_box_demo → widget_box}/README.md +7 -4
- data/examples/{widget_box_demo → widget_box}/app.rb +7 -5
- data/examples/{widget_calendar_demo → widget_calendar}/README.md +6 -3
- data/examples/{widget_calendar_demo → widget_calendar}/app.rb +6 -4
- data/examples/{widget_canvas_demo → widget_canvas}/README.md +2 -2
- data/examples/{widget_canvas_demo → widget_canvas}/app.rb +6 -4
- data/examples/{widget_cell_demo → widget_cell}/README.md +6 -3
- data/examples/{widget_cell_demo → widget_cell}/app.rb +7 -5
- data/examples/{widget_center_demo → widget_center}/README.md +2 -2
- data/examples/{widget_center_demo → widget_center}/app.rb +6 -4
- data/examples/{widget_chart_demo → widget_chart}/README.md +7 -4
- data/examples/{widget_chart_demo → widget_chart}/app.rb +7 -5
- data/examples/{widget_gauge_demo → widget_gauge}/README.md +6 -3
- data/examples/{widget_gauge_demo → widget_gauge}/app.rb +7 -5
- data/examples/widget_layout_split/README.md +5 -2
- data/examples/widget_layout_split/app.rb +3 -1
- data/examples/{widget_line_gauge_demo → widget_line_gauge}/README.md +6 -3
- data/examples/{widget_line_gauge_demo → widget_line_gauge}/app.rb +7 -5
- data/examples/{widget_list_demo → widget_list}/README.md +7 -4
- data/examples/{widget_list_demo → widget_list}/app.rb +7 -5
- data/examples/{widget_map_demo → widget_map}/README.md +7 -4
- data/examples/{widget_map_demo → widget_map}/app.rb +4 -2
- data/examples/{widget_overlay_demo → widget_overlay}/README.md +6 -3
- data/examples/{widget_overlay_demo → widget_overlay}/app.rb +5 -3
- data/examples/{widget_popup_demo → widget_popup}/README.md +7 -4
- data/examples/{widget_popup_demo → widget_popup}/app.rb +6 -4
- data/examples/{widget_ratatui_logo_demo → widget_ratatui_logo}/README.md +6 -3
- data/examples/{widget_ratatui_logo_demo → widget_ratatui_logo}/app.rb +8 -6
- data/examples/{widget_ratatui_mascot_demo → widget_ratatui_mascot}/README.md +6 -3
- data/examples/{widget_ratatui_mascot_demo → widget_ratatui_mascot}/app.rb +6 -4
- data/examples/widget_rect/README.md +5 -2
- data/examples/widget_rect/app.rb +2 -0
- data/examples/widget_render/README.md +4 -1
- data/examples/widget_render/app.rb +2 -0
- data/examples/widget_rich_text/README.md +4 -1
- data/examples/widget_rich_text/app.rb +2 -0
- data/examples/widget_scroll_text/README.md +4 -1
- data/examples/widget_scroll_text/app.rb +3 -1
- data/examples/{widget_scrollbar_demo → widget_scrollbar}/README.md +7 -4
- data/examples/{widget_scrollbar_demo → widget_scrollbar}/app.rb +6 -4
- data/examples/{widget_sparkline_demo → widget_sparkline}/README.md +6 -3
- data/examples/{widget_sparkline_demo → widget_sparkline}/app.rb +7 -5
- data/examples/widget_style_colors/README.md +4 -1
- data/examples/widget_style_colors/app.rb +2 -0
- data/examples/{widget_table_demo → widget_table}/README.md +7 -4
- data/examples/{widget_table_demo → widget_table}/app.rb +4 -2
- data/examples/{widget_tabs_demo → widget_tabs}/README.md +6 -3
- data/examples/{widget_tabs_demo → widget_tabs}/app.rb +7 -5
- data/examples/widget_text_width/README.md +5 -2
- data/examples/widget_text_width/app.rb +2 -0
- data/exe/.gitkeep +0 -0
- data/ext/ratatui_ruby/Cargo.lock +1 -1
- data/ext/ratatui_ruby/Cargo.toml +1 -1
- data/ext/ratatui_ruby/extconf.rb +2 -0
- data/ext/ratatui_ruby/src/widgets/barchart.rs +8 -6
- data/ext/ratatui_ruby/src/widgets/chart.rs +26 -4
- data/ext/ratatui_ruby/src/widgets/table.rs +13 -5
- data/ext/ratatui_ruby/src/widgets/tabs.rs +49 -9
- data/lib/ratatui_ruby/buffer/cell.rb +2 -0
- data/lib/ratatui_ruby/buffer.rb +2 -0
- data/lib/ratatui_ruby/cell.rb +2 -0
- data/lib/ratatui_ruby/event/focus_gained.rb +2 -0
- data/lib/ratatui_ruby/event/focus_lost.rb +2 -0
- data/lib/ratatui_ruby/event/key/character.rb +2 -0
- data/lib/ratatui_ruby/event/key/media.rb +2 -0
- data/lib/ratatui_ruby/event/key/modifier.rb +2 -0
- data/lib/ratatui_ruby/event/key/navigation.rb +2 -0
- data/lib/ratatui_ruby/event/key/system.rb +2 -0
- data/lib/ratatui_ruby/event/key.rb +2 -0
- data/lib/ratatui_ruby/event/mouse.rb +2 -0
- data/lib/ratatui_ruby/event/none.rb +2 -0
- data/lib/ratatui_ruby/event/paste.rb +2 -0
- data/lib/ratatui_ruby/event/resize.rb +2 -0
- data/lib/ratatui_ruby/event.rb +2 -0
- data/lib/ratatui_ruby/frame.rb +2 -0
- data/lib/ratatui_ruby/layout/constraint.rb +2 -0
- data/lib/ratatui_ruby/layout/layout.rb +2 -0
- data/lib/ratatui_ruby/layout/rect.rb +2 -0
- data/lib/ratatui_ruby/layout.rb +2 -0
- data/lib/ratatui_ruby/list_state.rb +2 -0
- data/lib/ratatui_ruby/schema/bar_chart/bar.rb +2 -0
- data/lib/ratatui_ruby/schema/bar_chart/bar_group.rb +2 -0
- data/lib/ratatui_ruby/schema/bar_chart.rb +4 -2
- data/lib/ratatui_ruby/schema/block.rb +4 -2
- data/lib/ratatui_ruby/schema/calendar.rb +4 -2
- data/lib/ratatui_ruby/schema/canvas.rb +2 -0
- data/lib/ratatui_ruby/schema/center.rb +2 -0
- data/lib/ratatui_ruby/schema/chart.rb +4 -2
- data/lib/ratatui_ruby/schema/clear.rb +2 -0
- data/lib/ratatui_ruby/schema/constraint.rb +2 -0
- data/lib/ratatui_ruby/schema/cursor.rb +2 -0
- data/lib/ratatui_ruby/schema/draw.rb +2 -0
- data/lib/ratatui_ruby/schema/gauge.rb +4 -2
- data/lib/ratatui_ruby/schema/layout.rb +2 -0
- data/lib/ratatui_ruby/schema/line_gauge.rb +4 -2
- data/lib/ratatui_ruby/schema/list.rb +3 -1
- data/lib/ratatui_ruby/schema/list_item.rb +2 -0
- data/lib/ratatui_ruby/schema/overlay.rb +2 -0
- data/lib/ratatui_ruby/schema/paragraph.rb +2 -0
- data/lib/ratatui_ruby/schema/ratatui_logo.rb +4 -2
- data/lib/ratatui_ruby/schema/ratatui_mascot.rb +4 -2
- data/lib/ratatui_ruby/schema/rect.rb +2 -0
- data/lib/ratatui_ruby/schema/row.rb +2 -0
- data/lib/ratatui_ruby/schema/scrollbar.rb +4 -2
- data/lib/ratatui_ruby/schema/shape/label.rb +2 -0
- data/lib/ratatui_ruby/schema/sparkline.rb +4 -2
- data/lib/ratatui_ruby/schema/style.rb +2 -0
- data/lib/ratatui_ruby/schema/table.rb +2 -0
- data/lib/ratatui_ruby/schema/tabs.rb +4 -2
- data/lib/ratatui_ruby/schema/text.rb +2 -0
- data/lib/ratatui_ruby/scrollbar_state.rb +2 -0
- data/lib/ratatui_ruby/style/style.rb +2 -0
- data/lib/ratatui_ruby/style.rb +2 -0
- data/lib/ratatui_ruby/table_state.rb +2 -0
- data/lib/ratatui_ruby/test_helper/event_injection.rb +2 -0
- data/lib/ratatui_ruby/test_helper/snapshot.rb +2 -0
- data/lib/ratatui_ruby/test_helper/style_assertions.rb +2 -0
- data/lib/ratatui_ruby/test_helper/terminal.rb +2 -0
- data/lib/ratatui_ruby/test_helper/test_doubles.rb +2 -0
- data/lib/ratatui_ruby/test_helper.rb +5 -3
- data/lib/ratatui_ruby/tui/buffer_factories.rb +2 -0
- data/lib/ratatui_ruby/tui/canvas_factories.rb +2 -0
- data/lib/ratatui_ruby/tui/core.rb +2 -0
- data/lib/ratatui_ruby/tui/layout_factories.rb +2 -0
- data/lib/ratatui_ruby/tui/state_factories.rb +2 -0
- data/lib/ratatui_ruby/tui/style_factories.rb +2 -0
- data/lib/ratatui_ruby/tui/text_factories.rb +2 -0
- data/lib/ratatui_ruby/tui/widget_factories.rb +2 -0
- data/lib/ratatui_ruby/tui.rb +2 -0
- data/lib/ratatui_ruby/version.rb +3 -1
- data/lib/ratatui_ruby/widgets/bar_chart/bar.rb +2 -0
- data/lib/ratatui_ruby/widgets/bar_chart/bar_group.rb +2 -0
- data/lib/ratatui_ruby/widgets/bar_chart.rb +4 -2
- data/lib/ratatui_ruby/widgets/block.rb +4 -2
- data/lib/ratatui_ruby/widgets/calendar.rb +4 -2
- data/lib/ratatui_ruby/widgets/canvas.rb +2 -0
- data/lib/ratatui_ruby/widgets/cell.rb +2 -0
- data/lib/ratatui_ruby/widgets/center.rb +2 -0
- data/lib/ratatui_ruby/widgets/chart.rb +4 -2
- data/lib/ratatui_ruby/widgets/clear.rb +2 -0
- data/lib/ratatui_ruby/widgets/cursor.rb +2 -0
- data/lib/ratatui_ruby/widgets/gauge.rb +4 -2
- data/lib/ratatui_ruby/widgets/line_gauge.rb +4 -2
- data/lib/ratatui_ruby/widgets/list.rb +3 -1
- data/lib/ratatui_ruby/widgets/list_item.rb +2 -0
- data/lib/ratatui_ruby/widgets/overlay.rb +2 -0
- data/lib/ratatui_ruby/widgets/paragraph.rb +2 -0
- data/lib/ratatui_ruby/widgets/ratatui_logo.rb +4 -2
- data/lib/ratatui_ruby/widgets/ratatui_mascot.rb +4 -2
- data/lib/ratatui_ruby/widgets/row.rb +2 -0
- data/lib/ratatui_ruby/widgets/scrollbar.rb +4 -2
- data/lib/ratatui_ruby/widgets/shape/label.rb +2 -0
- data/lib/ratatui_ruby/widgets/sparkline.rb +4 -2
- data/lib/ratatui_ruby/widgets/table.rb +2 -0
- data/lib/ratatui_ruby/widgets/tabs.rb +12 -8
- data/lib/ratatui_ruby/widgets.rb +2 -0
- data/lib/ratatui_ruby.rb +2 -0
- data/tasks/autodoc/examples.rb +2 -0
- data/tasks/autodoc/member.rb +2 -0
- data/tasks/autodoc/name.rb +2 -0
- data/tasks/autodoc.rake +2 -0
- data/tasks/bump/cargo_lockfile.rb +2 -0
- data/tasks/bump/changelog.rb +2 -0
- data/tasks/bump/header.rb +2 -0
- data/tasks/bump/history.rb +2 -0
- data/tasks/bump/links.rb +2 -0
- data/tasks/bump/manifest.rb +2 -0
- data/tasks/bump/ruby_gem.rb +2 -0
- data/tasks/bump/sem_ver.rb +2 -0
- data/tasks/bump/unreleased_section.rb +2 -0
- data/tasks/bump.rake +2 -0
- data/tasks/doc.rake +268 -0
- data/tasks/extension.rake +2 -0
- data/tasks/lint.rake +115 -0
- data/tasks/rdoc_config.rb +18 -4
- data/tasks/sourcehut.rake +2 -0
- data/tasks/terminal_preview/app_screenshot.rb +2 -0
- data/tasks/terminal_preview/crash_report.rb +2 -0
- data/tasks/terminal_preview/example_app.rb +2 -0
- data/tasks/terminal_preview/launcher_script.rb +2 -0
- data/tasks/terminal_preview/preview_collection.rb +2 -0
- data/tasks/terminal_preview/preview_timing.rb +2 -0
- data/tasks/terminal_preview/safety_confirmation.rb +2 -0
- data/tasks/terminal_preview/saved_screenshot.rb +2 -0
- data/tasks/terminal_preview/system_appearance.rb +2 -0
- data/tasks/terminal_preview/terminal_window.rb +2 -0
- data/tasks/terminal_preview/window_id.rb +2 -0
- data/tasks/terminal_preview.rake +2 -0
- data/tasks/test.rake +2 -0
- data/tasks/website/index_page.rb +2 -0
- data/tasks/website/version.rb +12 -2
- data/tasks/website/version_menu.rb +2 -0
- data/tasks/website/versioned_documentation.rb +2 -0
- data/tasks/website/website.rb +2 -0
- data/tasks/website.rake +2 -0
- metadata +72 -74
- data/doc/contributors/architectural_overhaul/chat_conversations.md +0 -4952
- data/doc/contributors/architectural_overhaul/implementation_plan.md +0 -60
- data/doc/contributors/architectural_overhaul/task.md +0 -37
- /data/doc/{application_testing.md → concepts/application_testing.md} +0 -0
- /data/doc/{async.md → concepts/async.md} +0 -0
- /data/doc/{interactive_design.md → concepts/interactive_design.md} +0 -0
- /data/doc/images/{widget_barchart_demo.png → widget_barchart.png} +0 -0
- /data/doc/images/{widget_block_demo.png → widget_block.png} +0 -0
- /data/doc/images/{widget_box_demo.png → widget_box.png} +0 -0
- /data/doc/images/{widget_calendar_demo.png → widget_calendar.png} +0 -0
- /data/doc/images/{widget_canvas_demo.png → widget_canvas.png} +0 -0
- /data/doc/images/{widget_cell_demo.png → widget_cell.png} +0 -0
- /data/doc/images/{widget_center_demo.png → widget_center.png} +0 -0
- /data/doc/images/{widget_chart_demo.png → widget_chart.png} +0 -0
- /data/doc/images/{widget_gauge_demo.png → widget_gauge.png} +0 -0
- /data/doc/images/{widget_line_gauge_demo.png → widget_line_gauge.png} +0 -0
- /data/doc/images/{widget_list_demo.png → widget_list.png} +0 -0
- /data/doc/images/{widget_map_demo.png → widget_map.png} +0 -0
- /data/doc/images/{widget_overlay_demo.png → widget_overlay.png} +0 -0
- /data/doc/images/{widget_popup_demo.png → widget_popup.png} +0 -0
- /data/doc/images/{widget_ratatui_logo_demo.png → widget_ratatui_logo.png} +0 -0
- /data/doc/images/{widget_ratatui_mascot_demo.png → widget_ratatui_mascot.png} +0 -0
- /data/doc/images/{widget_scrollbar_demo.png → widget_scrollbar.png} +0 -0
- /data/doc/images/{widget_sparkline_demo.png → widget_sparkline.png} +0 -0
- /data/doc/images/{widget_table_demo.png → widget_table.png} +0 -0
- /data/doc/images/{widget_tabs_demo.png → widget_tabs.png} +0 -0
- /data/doc/{v0.7.0_migration.md → migration/v0_7_0.md} +0 -0
- /data/doc/{debugging.md → troubleshooting/debugging.md} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 52112877db56e3edf7a4baa4c542b55570e8b1172a172934e229c0730d33ca2c
|
|
4
|
+
data.tar.gz: 1f46e0c790f33828dba5ed4cfa6ea6d56d5525634cc587d0986005e287c6b876
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5ee6665ca41a8029b67f9d99ac4908ad5ab124cc8d21952d7a42e3eb3bce0dfd2ef77e19b69294a7c5e2bb1a8bb745047a8f7599712e497ba0c66d3e8607e351
|
|
7
|
+
data.tar.gz: '085180a5bab1b831521750b42398087109129fda7d20fe369b7aa4ff5c746e691e09f82a4251bc62ca964508ed21d9276ace9970ed91fec3fd979923ea2937a5'
|
data/.builds/ruby-3.2.yml
CHANGED
data/.builds/ruby-3.3.yml
CHANGED
data/.builds/ruby-3.4.yml
CHANGED
data/.builds/ruby-4.0.0.yml
CHANGED
data/AGENTS.md
CHANGED
|
@@ -27,7 +27,7 @@ Architecture:
|
|
|
27
27
|
|
|
28
28
|
### STRICT REQUIREMENTS
|
|
29
29
|
|
|
30
|
-
- Every file MUST begin with an SPDX-compliant header. Use `AGPL-3.0-or-later` for code; `CC-BY-SA-4.0` for documentation. `reuse annotate` can help you generate the header.
|
|
30
|
+
- Every file MUST begin with an SPDX-compliant header. Use `AGPL-3.0-or-later` for code; `CC-BY-SA-4.0` for documentation. `reuse annotate` can help you generate the header. **For Ruby files**, wrap SPDX comments in `#--` / `#++` to hide them from RDoc output.
|
|
31
31
|
- Every line of Ruby MUST be covered by tests that would stand up to mutation testing.
|
|
32
32
|
- Tests must be meaningful and verify specific behavior or rendering output; simply verifying that code "doesn't crash" is insufficient and unacceptable.
|
|
33
33
|
- For UI widgets, this means using `with_test_terminal` to verify EVERY character of the terminal buffer's content.
|
|
@@ -78,6 +78,7 @@ The project follows a standard Gem layout with an `ext/` directory for Rust code
|
|
|
78
78
|
|
|
79
79
|
### Development Environment
|
|
80
80
|
|
|
81
|
+
- **Scripting Preference:** Simple `sed` or shell one-liners are fine. When a one-off script grows to multiple lines of logic, prefer a temporary rake task or `ruby -e '...'` over a multi-line shell script in a string. Ruby's `File.read`/`File.write`, `Dir.glob`, and regex handle complex transformations more cleanly.
|
|
81
82
|
|
|
82
83
|
### Documentation
|
|
83
84
|
|
|
@@ -101,6 +102,12 @@ The project follows a standard Gem layout with an `ext/` directory for Rust code
|
|
|
101
102
|
- Skip the body entirely if it's rote, a duplication of the diff, or otherwise unhelpful.
|
|
102
103
|
- **DON'T list the files changed or the edits made in the body.** Don't provide a bulleted list of changes. Use prose to explain the problem and the solution.
|
|
103
104
|
- **DON'T use markdown syntax** (no backticks, no bolding, no lists, no links). The commit message must be plain text.
|
|
105
|
+
- **Type conventions by directory:**
|
|
106
|
+
- `lib/`, `ext/`, `sig/`: Use `feat`, `fix`, `refactor`, `perf` as appropriate.
|
|
107
|
+
- `bin/`, `tasks/`, `.builds/`, CI/CD: Always `chore` (internal tooling).
|
|
108
|
+
- `examples/`: Always `docs` (documentation by example).
|
|
109
|
+
- `test/`: Use `test` for new/changed tests, or match the type of the code being tested.
|
|
110
|
+
- `doc/`: Always `docs`.
|
|
104
111
|
|
|
105
112
|
### 5. Changelog
|
|
106
113
|
|
data/CHANGELOG.md
CHANGED
|
@@ -18,6 +18,26 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
18
18
|
|
|
19
19
|
### Removed
|
|
20
20
|
|
|
21
|
+
## [0.7.2] - 2026-01-04
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- **Tabs `padding_left` and `padding_right`**: Now accept `Integer` (for spaces), `String`, or `Text::Line` for styled padding content. Previously only accepted `Integer`. Passing a `Line` object allows colored or decorated padding.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- **Styled Text Parsing**: Fixed multiple widgets incorrectly rendering styled text objects as Ruby inspect strings (e.g., `#<data RatatuiRuby::Text::Span...>`) instead of their styled content:
|
|
32
|
+
- `Tabs` `divider`: Now correctly renders `Text::Span` objects.
|
|
33
|
+
- `Table` `highlight_symbol`: Now correctly renders `Text::Span` objects.
|
|
34
|
+
- `BarChart` `BarGroup` `label`: Now correctly renders `Text::Line` objects.
|
|
35
|
+
- `Chart` `Axis` `title`: Now correctly renders `Text::Line` objects.
|
|
36
|
+
- `Chart` `Axis` `labels`: Now correctly renders `Text::Line` objects.
|
|
37
|
+
- `Chart` `Dataset` `name`: Now correctly renders `Text::Line` objects.
|
|
38
|
+
|
|
39
|
+
### Removed
|
|
40
|
+
|
|
21
41
|
## [0.7.1] - 2026-01-03
|
|
22
42
|
|
|
23
43
|
### Added
|
|
@@ -368,6 +388,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
368
388
|
- **Testing Support**: Included `RatatuiRuby::TestHelper` and RSpec integration to make testing your TUI applications possible.
|
|
369
389
|
|
|
370
390
|
[Unreleased]: https://git.sr.ht/~kerrick/ratatui_ruby/refs/HEAD
|
|
391
|
+
[0.7.2]: https://git.sr.ht/~kerrick/ratatui_ruby/refs/v0.7.2
|
|
371
392
|
[0.7.1]: https://git.sr.ht/~kerrick/ratatui_ruby/refs/v0.7.1
|
|
372
393
|
[0.7.0]: https://git.sr.ht/~kerrick/ratatui_ruby/refs/v0.7.0
|
|
373
394
|
[0.6.0]: https://git.sr.ht/~kerrick/ratatui_ruby/refs/v0.6.0
|
data/README.md
CHANGED
|
@@ -23,7 +23,7 @@ Mailing List: Announcements](https://img.shields.io/badge/mailing_list-announcem
|
|
|
23
23
|
> [!WARNING]
|
|
24
24
|
> **ratatui_ruby** is currently in **BETA**. The API may change between minor versions.
|
|
25
25
|
|
|
26
|
-
**[Why RatatuiRuby?](./doc/why.md)** — Native Rust performance, zero runtime overhead, and Ruby's expressiveness. [See how we compare](./doc/why.md) to CharmRuby, raw Rust, and Go.
|
|
26
|
+
**[Why RatatuiRuby?](./doc/getting_started/why.md)** — Native Rust performance, zero runtime overhead, and Ruby's expressiveness. [See how we compare](./doc/getting_started/why.md) to CharmRuby, raw Rust, and Go.
|
|
27
27
|
|
|
28
28
|
Please join the **announce** mailing list at https://lists.sr.ht/~kerrick/ratatui_ruby-announce to stay up-to-date on new releases and announcements. See the [`trunk` branch](https://git.sr.ht/~kerrick/ratatui_ruby/tree/trunk) for pre-release updates.
|
|
29
29
|
|
|
@@ -96,7 +96,7 @@ end
|
|
|
96
96
|
|
|
97
97
|

|
|
98
98
|
|
|
99
|
-
For a full tutorial, see [the Quickstart](./doc/quickstart.md). For an explanation of the application architecture, see [Application Architecture](./doc/application_architecture.md).
|
|
99
|
+
For a full tutorial, see [the Quickstart](./doc/getting_started/quickstart.md). For an explanation of the application architecture, see [Application Architecture](./doc/concepts/application_architecture.md).
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
## Features
|
|
@@ -118,9 +118,9 @@ Plus: flexible layouts with constraints, full keyboard/mouse/paste/resize events
|
|
|
118
118
|
|
|
119
119
|
| Resource | Description |
|
|
120
120
|
|----------|-------------|
|
|
121
|
-
| [Quickstart](./doc/quickstart.md) | Get running in 5 minutes |
|
|
122
|
-
| [Widget Gallery](./doc/quickstart.md#widget-demos) | Every widget with examples |
|
|
123
|
-
| [Application Architecture](./doc/application_architecture.md) | Patterns for scaling your app |
|
|
121
|
+
| [Quickstart](./doc/getting_started/quickstart.md) | Get running in 5 minutes |
|
|
122
|
+
| [Widget Gallery](./doc/getting_started/quickstart.md#widget-demos) | Every widget with examples |
|
|
123
|
+
| [Application Architecture](./doc/concepts/application_architecture.md) | Patterns for scaling your app |
|
|
124
124
|
| [API Reference](./doc/index.md) | Full RDoc documentation |
|
|
125
125
|
| [Wiki](https://man.sr.ht/~kerrick/ratatui_ruby) | Guides and community resources |
|
|
126
126
|
|
data/Rakefile
CHANGED
|
@@ -52,6 +52,36 @@ ensure
|
|
|
52
52
|
end
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
+
#### Signal Handling
|
|
56
|
+
|
|
57
|
+
External processes send signals. Your TUI must handle them gracefully.
|
|
58
|
+
|
|
59
|
+
**The Problem:** If a signal terminates your process before `restore_terminal` runs, the terminal stays in raw mode. Your shell becomes unusable until you type `reset` and press Enter (the text won't echo, but it works).
|
|
60
|
+
|
|
61
|
+
**The Solution:** Ruby's default signal handlers work correctly with `ensure` blocks. Most signals unwind the stack, which triggers cleanup.
|
|
62
|
+
|
|
63
|
+
| Signal | Source | Terminal Restored? |
|
|
64
|
+
|--------|--------|--------------------|
|
|
65
|
+
| SIGTERM | `kill -15` | ✓ Yes — ensure runs |
|
|
66
|
+
| SIGINT | `kill -2` (not Ctrl+C) | ✓ Yes — ensure runs |
|
|
67
|
+
| SIGKILL | `kill -9` | ✗ No — cannot be caught |
|
|
68
|
+
|
|
69
|
+
> [!IMPORTANT]
|
|
70
|
+
> **Ctrl+C in Raw Mode:** When your app is in raw mode, pressing Ctrl+C does *not* send SIGINT. It's captured as a `:ctrl_c` key event. Handle this in your event loop—don't use `trap("INT")`.
|
|
71
|
+
|
|
72
|
+
```ruby
|
|
73
|
+
RatatuiRuby.run do |tui|
|
|
74
|
+
loop do
|
|
75
|
+
# ...
|
|
76
|
+
event = tui.poll_event
|
|
77
|
+
break if event == :ctrl_c # Handle Ctrl+C yourself
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Recovery:** If a TUI app leaves your terminal broken, run `reset` in the shell to restore normal behavior.
|
|
83
|
+
|
|
84
|
+
|
|
55
85
|
### Stateful Widgets
|
|
56
86
|
|
|
57
87
|
Most widgets are stateless configuration. You create them, render them, and they are gone. However, the **runtime status** of some widgets (like Lists and Tables) must persist across frames (e.g., scroll offsets or selection).
|
|
@@ -4,7 +4,7 @@ SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
|
4
4
|
SPDX-License-Identifier: AGPL-3.0-or-later
|
|
5
5
|
-->
|
|
6
6
|
|
|
7
|
-
# Event Handling
|
|
7
|
+
# Event Handling
|
|
8
8
|
|
|
9
9
|
`ratatui_ruby` provides a rich, object-oriented event system that supports multiple coding styles, from simple boolean predicates to modern Ruby pattern matching.
|
|
10
10
|
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
3
|
+
SPDX-License-Identifier: CC-BY-SA-4.0
|
|
4
|
+
-->
|
|
5
|
+
|
|
6
|
+
# Parity Auditing Process
|
|
7
|
+
|
|
8
|
+
This guide describes the **process** for auditing RatatuiRuby against upstream Rust Ratatui to find API parity gaps of any kind.
|
|
9
|
+
|
|
10
|
+
## Philosophy
|
|
11
|
+
|
|
12
|
+
RatatuiRuby should behave identically to Rust Ratatui. When a Rust user can do something with a widget, a Ruby user should be able to do the equivalent. Deviations are bugs.
|
|
13
|
+
|
|
14
|
+
## The Audit Mindset
|
|
15
|
+
|
|
16
|
+
### Ask the Right Questions
|
|
17
|
+
|
|
18
|
+
Every audit begins with a question:
|
|
19
|
+
|
|
20
|
+
- "Does RatatuiRuby support everything upstream supports for widget X?"
|
|
21
|
+
- "When I pass type Y to parameter Z, does Ruby do what Rust does?"
|
|
22
|
+
- "Are there features in upstream that we haven't exposed at all?"
|
|
23
|
+
|
|
24
|
+
### Symptoms That Trigger Audits
|
|
25
|
+
|
|
26
|
+
- **Inspect strings in output** (`#<data RatatuiRuby::...>`) — type conversion failure
|
|
27
|
+
- **Missing methods** — user can't access upstream functionality
|
|
28
|
+
- **Wrong behavior** — code runs but produces different results than Rust
|
|
29
|
+
- **Type mismatches** — Ruby API accepts different types than Rust API
|
|
30
|
+
|
|
31
|
+
## The Three-Layer Model
|
|
32
|
+
|
|
33
|
+
Every RatatuiRuby feature has three layers. Gaps can occur at any layer:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
┌─────────────────────────────┐
|
|
37
|
+
│ Ruby API (lib/**/*.rb) │ ← What users see
|
|
38
|
+
├─────────────────────────────┤
|
|
39
|
+
│ Rust Bindings (ext/**/*.rs)│ ← Bridge layer
|
|
40
|
+
├─────────────────────────────┤
|
|
41
|
+
│ Upstream Ratatui │ ← Source of truth
|
|
42
|
+
└─────────────────────────────┘
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Layer 1: Ruby API Gaps
|
|
46
|
+
Ruby doesn't expose a parameter that upstream supports.
|
|
47
|
+
|
|
48
|
+
### Layer 2: Binding Gaps
|
|
49
|
+
Ruby exposes a parameter, but the Rust binding converts it incorrectly.
|
|
50
|
+
|
|
51
|
+
### Layer 3: Upstream Changes
|
|
52
|
+
New upstream features we haven't implemented yet.
|
|
53
|
+
|
|
54
|
+
## Audit Process
|
|
55
|
+
|
|
56
|
+
### 1. Choose an Audit Scope
|
|
57
|
+
|
|
58
|
+
Define what you're auditing:
|
|
59
|
+
- **Single widget**: All parameters of `Tabs`
|
|
60
|
+
- **Single feature**: All places that accept styled text
|
|
61
|
+
- **Version delta**: Everything new in Ratatui 0.29
|
|
62
|
+
|
|
63
|
+
### 2. Establish Source of Truth
|
|
64
|
+
|
|
65
|
+
For any scope, identify the authoritative upstream source:
|
|
66
|
+
- **Method signatures** → Rust source files
|
|
67
|
+
- **Type constraints** → Generic bounds (`Into<Line>`, `&str`, etc.)
|
|
68
|
+
- **Behavior** → Upstream documentation and tests
|
|
69
|
+
|
|
70
|
+
### 3. Inventory Our Implementation
|
|
71
|
+
|
|
72
|
+
List everything in our codebase related to the scope:
|
|
73
|
+
- Ruby classes and methods
|
|
74
|
+
- Rust binding functions
|
|
75
|
+
- Conversion/parsing logic
|
|
76
|
+
|
|
77
|
+
### 4. Compare Systematically
|
|
78
|
+
|
|
79
|
+
For each item in the upstream source of truth, ask:
|
|
80
|
+
1. Do we expose this at all?
|
|
81
|
+
2. If yes, does our implementation match the type signature?
|
|
82
|
+
3. If yes, does our behavior match?
|
|
83
|
+
|
|
84
|
+
### 5. Document Findings
|
|
85
|
+
|
|
86
|
+
For each gap found, record:
|
|
87
|
+
- What the gap is
|
|
88
|
+
- Where it occurs (files, lines)
|
|
89
|
+
- What upstream expects
|
|
90
|
+
- What we currently do
|
|
91
|
+
|
|
92
|
+
### 6. Fix and Verify
|
|
93
|
+
|
|
94
|
+
Apply fixes, then verify:
|
|
95
|
+
- Compiles without errors
|
|
96
|
+
- Tests pass
|
|
97
|
+
- Visual/manual verification if applicable
|
|
98
|
+
|
|
99
|
+
## Verifying Completeness
|
|
100
|
+
|
|
101
|
+
Finding gaps is not enough. You must verify you've found **all** gaps within your scope.
|
|
102
|
+
|
|
103
|
+
### The Completeness Mindset
|
|
104
|
+
|
|
105
|
+
An initial audit pass often finds the obvious issues. But "obvious" means "incomplete." After your first pass, stop and ask:
|
|
106
|
+
|
|
107
|
+
- Did I search for **every variation** of the pattern I was looking for?
|
|
108
|
+
- Are there **synonyms or related terms** I should also search?
|
|
109
|
+
- Did I check **all code paths**, not just the happy path?
|
|
110
|
+
- Are there **duplicate implementations** (e.g., `render` vs `render_stateful`)?
|
|
111
|
+
|
|
112
|
+
### Broaden Your Search Terms
|
|
113
|
+
|
|
114
|
+
Your first search term won't catch everything. For each pattern, think of variations:
|
|
115
|
+
|
|
116
|
+
| If you searched for... | Also search for... |
|
|
117
|
+
|------------------------|-------------------|
|
|
118
|
+
| `funcall("to_s"` | `String::try_convert` |
|
|
119
|
+
| `Into<Line>` | `Into<Span>`, `Into<Text>` |
|
|
120
|
+
| One widget's file | All widget files |
|
|
121
|
+
| The method you're fixing | Related methods in the same file |
|
|
122
|
+
|
|
123
|
+
### Work From the Complete List
|
|
124
|
+
|
|
125
|
+
Don't spot-check. Generate the **complete list** of potential issues, then classify each one:
|
|
126
|
+
|
|
127
|
+
1. Run a search that catches all possible instances
|
|
128
|
+
2. Count them (e.g., "31 `to_s` call sites")
|
|
129
|
+
3. Review **every single one**, marking each as "gap" or "correct"
|
|
130
|
+
|
|
131
|
+
Half-measures lead to half-fixes.
|
|
132
|
+
|
|
133
|
+
### Verify Against Upstream Exhaustively
|
|
134
|
+
|
|
135
|
+
For type-related gaps, don't just check the methods you already know about. Search upstream for **all uses of the pattern**:
|
|
136
|
+
|
|
137
|
+
- `grep -rn 'Into<Line' /path/to/ratatui/src/widgets` finds EVERY place upstream accepts `Line`
|
|
138
|
+
- Then verify we handle EACH of those correctly
|
|
139
|
+
|
|
140
|
+
### Question Your Assumptions
|
|
141
|
+
|
|
142
|
+
After completing your audit, challenge yourself:
|
|
143
|
+
|
|
144
|
+
- "Is there anywhere I should look that I haven't?"
|
|
145
|
+
- "Is there any term I should search that I haven't?"
|
|
146
|
+
- "Am I sure I didn't miss anything?"
|
|
147
|
+
|
|
148
|
+
If you can't answer confidently, keep searching.
|
|
149
|
+
|
|
150
|
+
### The "One More Pass" Rule
|
|
151
|
+
|
|
152
|
+
When you think you're done, do one more verification pass with a different approach:
|
|
153
|
+
|
|
154
|
+
- If you searched our code first, now search upstream first
|
|
155
|
+
- If you searched for method names, now search for type signatures
|
|
156
|
+
- If you audited file-by-file, now audit feature-by-feature
|
|
157
|
+
|
|
158
|
+
This catches gaps your initial framing missed.
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
## Search Strategies
|
|
162
|
+
|
|
163
|
+
Different gap types require different search approaches:
|
|
164
|
+
|
|
165
|
+
### Finding Type Conversion Gaps
|
|
166
|
+
|
|
167
|
+
Look for places where we convert Ruby objects to simpler types:
|
|
168
|
+
- `funcall("to_s", ...)` — converting to string
|
|
169
|
+
- `String::try_convert(...)` — same
|
|
170
|
+
- `u16::try_convert(...)` — numeric conversion
|
|
171
|
+
|
|
172
|
+
Then check: does upstream accept richer types?
|
|
173
|
+
|
|
174
|
+
### Finding Missing Features
|
|
175
|
+
|
|
176
|
+
Compare file structure:
|
|
177
|
+
- What files/modules exist upstream?
|
|
178
|
+
- What methods exist in each upstream struct?
|
|
179
|
+
- What parameters does each upstream method accept?
|
|
180
|
+
|
|
181
|
+
### Finding Behavioral Differences
|
|
182
|
+
|
|
183
|
+
Run equivalent code in both environments and compare output.
|
|
184
|
+
|
|
185
|
+
## Red Flags in Our Code
|
|
186
|
+
|
|
187
|
+
When reviewing RatatuiRuby code, these patterns suggest potential gaps:
|
|
188
|
+
|
|
189
|
+
| Pattern | Potential Gap |
|
|
190
|
+
|---------|---------------|
|
|
191
|
+
| `funcall("to_s", ...)` | Upstream may accept styled types |
|
|
192
|
+
| `usize` or `u16` for padding | Upstream may accept content types |
|
|
193
|
+
| Missing `parse_*` call before using a value | Type not being converted properly |
|
|
194
|
+
| Widget with fewer Ruby methods than Rust methods | Missing functionality |
|
|
195
|
+
| `// TODO` or `// FIXME` comments | Known gaps |
|
|
196
|
+
|
|
197
|
+
## Upstream Patterns to Watch For
|
|
198
|
+
|
|
199
|
+
When reading upstream Rust code, these signatures indicate rich type support:
|
|
200
|
+
|
|
201
|
+
| Rust Signature | Meaning | Ruby Should Accept |
|
|
202
|
+
|----------------|---------|-------------------|
|
|
203
|
+
| `Into<Span<'a>>` | Styled single fragment | `Text::Span` or `String` |
|
|
204
|
+
| `Into<Line<'a>>` | Styled line | `Text::Line`, `Text::Span`, or `String` |
|
|
205
|
+
| `Into<Text<'a>>` | Multi-line styled | `Text::Text`, `Text::Line`, or `String` |
|
|
206
|
+
| `T: AsRef<str>` | Any string-like | `String` (OK) |
|
|
207
|
+
| `&'a str` | String slice | `String` (OK) |
|
|
208
|
+
|
|
209
|
+
## Keeping Audits Maintainable
|
|
210
|
+
|
|
211
|
+
### Create Checklists
|
|
212
|
+
|
|
213
|
+
For each widget or feature area, maintain a checklist of all parameters with their expected types.
|
|
214
|
+
|
|
215
|
+
### Track Upstream Changes
|
|
216
|
+
|
|
217
|
+
When upgrading Ratatui versions:
|
|
218
|
+
1. Read the changelog
|
|
219
|
+
2. Search for new `pub fn` in widget files
|
|
220
|
+
3. Audit new functionality before exposing it
|
|
221
|
+
|
|
222
|
+
### Automate Where Possible
|
|
223
|
+
|
|
224
|
+
Consider tooling that:
|
|
225
|
+
- Compares upstream method counts to ours
|
|
226
|
+
- Flags new `to_s` calls in code review
|
|
227
|
+
- Tests styled content rendering
|
|
228
|
+
|
|
229
|
+
## Example Audit Narrative
|
|
230
|
+
|
|
231
|
+
> "I noticed inspect strings appearing in my tabs. I asked: 'What types does upstream accept for the divider parameter?' I found `Into<Span>`. I then asked: 'What does our binding do?' I found we call `to_s`. Gap identified."
|
|
232
|
+
|
|
233
|
+
This narrative approach—asking questions, finding answers, comparing—works for any parity issue.
|
|
@@ -62,7 +62,7 @@ MyExampleApp.new.run if __FILE__ == $PROGRAM_NAME
|
|
|
62
62
|
|
|
63
63
|
Example directories **must** follow a prefixing convention to categorize them alphabetically:
|
|
64
64
|
- `app_`: Application showcases (e.g., `app_analytics`). Class name: `AppAnalytics`.
|
|
65
|
-
- `widget_`: Widget-focused demonstrations (e.g., `
|
|
65
|
+
- `widget_`: Widget-focused demonstrations (e.g., `widget_gauge`). Class name: `WidgetGaugeDemo`.
|
|
66
66
|
- `verify_`: Documentation verification examples (e.g., `verify_readme_usage`). Class name: `VerifyReadmeUsage`.
|
|
67
67
|
|
|
68
68
|
The directory and class names must match (snake_case directory maps to PascalCase class).
|
|
@@ -254,7 +254,7 @@ def test_initial_render
|
|
|
254
254
|
end
|
|
255
255
|
```
|
|
256
256
|
|
|
257
|
-
Snapshot auto-saved to: `test/examples/
|
|
257
|
+
Snapshot auto-saved to: `test/examples/widget_foo/snapshots/initial_render.txt`
|
|
258
258
|
|
|
259
259
|
### With Normalization (for dynamic content)
|
|
260
260
|
|
|
@@ -320,7 +320,7 @@ Examples must use **realistic, meaningful data**—not dummy placeholder text. T
|
|
|
320
320
|
|
|
321
321
|
**For small datasets (< 10 items):**
|
|
322
322
|
Use hardcoded realistic data. Examples:
|
|
323
|
-
- Geographic coordinates with city names (see `
|
|
323
|
+
- Geographic coordinates with city names (see `widget_map/app.rb`)
|
|
324
324
|
- Real product names or person names
|
|
325
325
|
- Meaningful status values ("Completed", "Pending", "Failed")
|
|
326
326
|
|
|
@@ -1668,7 +1668,7 @@ These are v1.0.0 quality improvements that refine the example suite after P0 is
|
|
|
1668
1668
|
**Status:** Important for API discoverability — Documentation should link library and examples
|
|
1669
1669
|
|
|
1670
1670
|
RDoc should cross-link between:
|
|
1671
|
-
- **Library classes/methods** ↔ **Examples that use them** (See also: examples/
|
|
1671
|
+
- **Library classes/methods** ↔ **Examples that use them** (See also: examples/widget_foo)
|
|
1672
1672
|
- **Primary methods** ↔ **DWIM/TIMTOWTDI aliases** (See also: tui.foo_bar as alias for tui.foo(:bar))
|
|
1673
1673
|
|
|
1674
1674
|
###### Current Practice
|
|
@@ -1685,7 +1685,7 @@ Done for:
|
|
|
1685
1685
|
|
|
1686
1686
|
###### Action
|
|
1687
1687
|
|
|
1688
|
-
1. Add `# See also: examples/
|
|
1688
|
+
1. Add `# See also: examples/widget_foo/app.rb` to class/method RDoc
|
|
1689
1689
|
2. Link DWIM methods to TIMTOWTDI variants: `# Also available as: tui.constraint_length (DWIM) vs tui.constraint(:length) (TIMTOWTDI)`
|
|
1690
1690
|
3. Create consistent pattern across all public APIs in `lib/ratatui_ruby/`
|
|
1691
1691
|
|
|
@@ -1694,7 +1694,7 @@ Done for:
|
|
|
1694
1694
|
```ruby
|
|
1695
1695
|
#### Renders text with styling.
|
|
1696
1696
|
#
|
|
1697
|
-
#### See also: examples/
|
|
1697
|
+
#### See also: examples/widget_paragraph/app.rb (basic paragraph rendering)
|
|
1698
1698
|
class Paragraph < Data.define(...)
|
|
1699
1699
|
# ...
|
|
1700
1700
|
end
|
|
@@ -1714,16 +1714,16 @@ end
|
|
|
1714
1714
|
|
|
1715
1715
|
Current `widget_*` examples mostly focus on interactive parameter turning (changing colors, borders, etc.). While useful for API discovery, they don't show *how* to use the widget in a real application logic flow.
|
|
1716
1716
|
|
|
1717
|
-
###### The Standard:
|
|
1717
|
+
###### The Standard: widget_tabs
|
|
1718
1718
|
|
|
1719
|
-
The `
|
|
1719
|
+
The `widget_tabs` was enhanced to show **conditional rendering** of content based on the selected tab in git commit `38ceed39a011d557cc66e11a4598d3341dc7a0cc`. It doesn't just highlight the tab; it changes the screen content. This connects the widget (the tabs) to the problem it solves (view segregation).
|
|
1720
1720
|
|
|
1721
1721
|
###### Action
|
|
1722
1722
|
|
|
1723
1723
|
Identify other widget examples that could benefit from this "functional context" treatment:
|
|
1724
1724
|
|
|
1725
|
-
- **
|
|
1726
|
-
- **
|
|
1727
|
-
- **
|
|
1725
|
+
- **widget_popup:** Show a multi-step modal flow (e.g., Confirm -> Success) rather than just a static overlay.
|
|
1726
|
+
- **widget_list:** Show a master-detail view where selecting a list item updates a detail pane.
|
|
1727
|
+
- **widget_input:** (If created) Show specific validation logic (email vs number).
|
|
1728
1728
|
|
|
1729
1729
|
**Goal:** Every widget example should answer "How do I build a feature with this?" not just "What does this parameter do?"
|
|
@@ -59,7 +59,7 @@ end
|
|
|
59
59
|
```
|
|
60
60
|
<!-- SYNC:END -->
|
|
61
61
|
|
|
62
|
-
[](../../examples/verify_quickstart_lifecycle/README.md)
|
|
63
63
|
|
|
64
64
|
#### How it works
|
|
65
65
|
|
|
@@ -115,7 +115,7 @@ end
|
|
|
115
115
|
3. **Method Shorthand**: The `TUI` object also provides aliases for module functions of `RatatuiRuby`, allowing you to write `tui.draw(...)` instead of the more verbose `RatatuiRuby.draw(...)`.
|
|
116
116
|
4. **Pattern Matching for Events**: Use `case...in` with pattern matching for elegant event dispatch. Always include an `else` clause at the end to catch unmatched event types (mouse, resize, paste, focus, etc.), otherwise Ruby raises `NoMatchingPatternError`.
|
|
117
117
|
|
|
118
|
-
For a deeper dive into the available application architectures (Manual vs Managed), see [Application Architecture](
|
|
118
|
+
For a deeper dive into the available application architectures (Manual vs Managed), see [Application Architecture](../concepts/application_architecture.md).
|
|
119
119
|
|
|
120
120
|
### Adding Layouts
|
|
121
121
|
|
|
@@ -185,7 +185,7 @@ end
|
|
|
185
185
|
3. **`Frame#render_widget(widget, rect)`**: You pass the specific area (like `top` or `bottom`) to render the widget into that exact region.
|
|
186
186
|
4. **`tui.text_span` (`RatatuiRuby::Text::Span`)**: Allows for rich styling within a single line of text.
|
|
187
187
|
|
|
188
|
-
[](../../examples/verify_quickstart_layout/README.md)
|
|
189
189
|
|
|
190
190
|
## Examples
|
|
191
191
|
|
|
@@ -197,32 +197,32 @@ Focused examples for individual widgets. Each demonstrates a single widget and i
|
|
|
197
197
|
|
|
198
198
|
| Widget | What it demonstrates |
|
|
199
199
|
|--------|---------------------|
|
|
200
|
-
| [Bar Chart](../examples/
|
|
201
|
-
| [Block](../examples/
|
|
202
|
-
| [Box](../examples/
|
|
203
|
-
| [Calendar](../examples/
|
|
204
|
-
| [Chart](../examples/
|
|
205
|
-
| [Gauge](../examples/
|
|
200
|
+
| [Bar Chart](../examples/widget_barchart/app.rb) | Grouped bars, data visualization, custom bar styling |
|
|
201
|
+
| [Block](../examples/widget_block/app.rb) | Borders, titles, padding, nested widgets |
|
|
202
|
+
| [Box](../examples/widget_box/app.rb) | Block + Paragraph composition, text wrapping |
|
|
203
|
+
| [Calendar](../examples/widget_calendar/app.rb) | Date highlighting, month display, event markers |
|
|
204
|
+
| [Chart](../examples/widget_chart/app.rb) | Line/scatter plots, axes, legends, datasets |
|
|
205
|
+
| [Gauge](../examples/widget_gauge/app.rb) | Progress bars, percentage display, unicode blocks |
|
|
206
206
|
| [Layout Split](../examples/widget_layout_split/app.rb) | Constraint types, flex modes, responsive layouts |
|
|
207
|
-
| [Line Gauge](../examples/
|
|
208
|
-
| [List](../examples/
|
|
209
|
-
| [Map](../examples/
|
|
210
|
-
| [Popup](../examples/
|
|
211
|
-
| [Ratatui Logo](../examples/
|
|
212
|
-
| [Ratatui Mascot](../examples/
|
|
207
|
+
| [Line Gauge](../examples/widget_line_gauge/app.rb) | Horizontal progress, labels, thin-style gauges |
|
|
208
|
+
| [List](../examples/widget_list/app.rb) | Selection, scrolling, highlight styles, rich text items |
|
|
209
|
+
| [Map](../examples/widget_map/app.rb) | Canvas widget, world map rendering, coordinates |
|
|
210
|
+
| [Popup](../examples/widget_popup/app.rb) | Clear widget, modal dialogs, overlay composition |
|
|
211
|
+
| [Ratatui Logo](../examples/widget_ratatui_logo/app.rb) | Decorative branding widget |
|
|
212
|
+
| [Ratatui Mascot](../examples/widget_ratatui_mascot/app.rb) | ASCII art Ferris mascot |
|
|
213
213
|
| [Rect](../examples/widget_rect/app.rb) | Geometry helpers, area calculations, contains/intersection |
|
|
214
214
|
| [Rich Text](../examples/widget_rich_text/app.rb) | Spans, lines, inline styling, mixed colors |
|
|
215
|
-
| [Scrollbar](../examples/
|
|
215
|
+
| [Scrollbar](../examples/widget_scrollbar/app.rb) | Orientations, thumb/track styling, scroll state |
|
|
216
216
|
| [Scroll Text](../examples/widget_scroll_text/app.rb) | Paragraph scrolling, viewport control, long content |
|
|
217
|
-
| [Sparkline](../examples/
|
|
217
|
+
| [Sparkline](../examples/widget_sparkline/app.rb) | Mini charts, time series, bar sets |
|
|
218
218
|
| [Style Colors](../examples/widget_style_colors/app.rb) | Named colors, RGB, indexed 256-color palette |
|
|
219
|
-
| [Table](../examples/
|
|
220
|
-
| [Tabs](../examples/
|
|
219
|
+
| [Table](../examples/widget_table/app.rb) | Row selection, column widths, per-cell styling |
|
|
220
|
+
| [Tabs](../examples/widget_tabs/app.rb) | Tab navigation, highlighting, dividers |
|
|
221
221
|
| [Text Width](../examples/widget_text_width/app.rb) | Unicode-aware width measurement, CJK support |
|
|
222
|
-
| [Canvas](../examples/
|
|
223
|
-
| [Cell](../examples/
|
|
224
|
-
| [Center](../examples/
|
|
225
|
-
| [Overlay](../examples/
|
|
222
|
+
| [Canvas](../examples/widget_canvas/app.rb) | Drawing shapes, markers, custom graphics |
|
|
223
|
+
| [Cell](../examples/widget_cell/app.rb) | Buffer cell inspection, styling attributes |
|
|
224
|
+
| [Center](../examples/widget_center/app.rb) | Centering content, horizontal/vertical alignment |
|
|
225
|
+
| [Overlay](../examples/widget_overlay/app.rb) | Layering widgets, modal backgrounds |
|
|
226
226
|
| [Custom Render](../examples/widget_render/app.rb) | Low-level Draw API, escape hatch for custom widgets |
|
|
227
227
|
|
|
228
228
|
### Sample Applications
|
|
@@ -253,8 +253,8 @@ These larger examples combine widgets into complete applications, demonstrating
|
|
|
253
253
|
|
|
254
254
|
Now that you've seen what **ratatui_ruby** can do:
|
|
255
255
|
|
|
256
|
-
- **Deep dive**: Read the [Application Architecture](
|
|
257
|
-
- **Test your TUI**: See the [Testing Guide](
|
|
258
|
-
- **Explore the API**: Browse the [full RDoc documentation](
|
|
256
|
+
- **Deep dive**: Read the [Application Architecture](../concepts/application_architecture.md) guide for scaling patterns
|
|
257
|
+
- **Test your TUI**: See the [Testing Guide](../concepts/application_testing.md) for snapshot and style assertions
|
|
258
|
+
- **Explore the API**: Browse the [full RDoc documentation](../index.md)
|
|
259
259
|
- **Learn the philosophy**: Read [Why RatatuiRuby?](./why.md) for comparisons and design decisions
|
|
260
260
|
- **Get help**: Join the [discussion mailing list](https://lists.sr.ht/~kerrick/ratatui_ruby-discuss)
|
|
@@ -90,4 +90,4 @@ Ready to build?
|
|
|
90
90
|
|
|
91
91
|
- [Quickstart Guide](./quickstart.md) — Your first app in 5 minutes
|
|
92
92
|
- [Widget Gallery](./quickstart.md#widget-demos) — See what's possible
|
|
93
|
-
- [Application Architecture](
|
|
93
|
+
- [Application Architecture](../concepts/application_architecture.md) — Patterns for scaling
|