ratatui_ruby 0.7.0 → 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 +34 -0
- data/README.md +5 -5
- data/Rakefile +1 -1
- data/doc/{application_architecture.md → concepts/application_architecture.md} +30 -0
- data/doc/concepts/async.md +160 -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/troubleshooting/debugging.md +71 -0
- 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/style.rs +25 -9
- 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 +10 -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 +14 -0
- data/tasks/bump/sem_ver.rb +2 -0
- data/tasks/bump/unreleased_section.rb +18 -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 -72
- 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/{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
|
@@ -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
|
data/doc/index.md
CHANGED
|
@@ -2,20 +2,34 @@
|
|
|
2
2
|
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
3
3
|
SPDX-License-Identifier: CC-BY-SA-4.0
|
|
4
4
|
-->
|
|
5
|
-
#
|
|
5
|
+
# Start Here
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
## Documentation for Users
|
|
9
9
|
|
|
10
10
|
- [README](../README.md): Project overview and installation
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
- [
|
|
15
|
-
- [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
|
|
12
|
+
### Getting Started
|
|
13
|
+
|
|
14
|
+
- [Why RatatuiRuby?](./getting_started/why.md): Philosophy, comparisons, and what makes us different
|
|
15
|
+
- [Quickstart](./getting_started/quickstart.md): Build your first TUI app
|
|
16
|
+
|
|
17
|
+
### Concepts
|
|
18
|
+
|
|
19
|
+
- [Application Architecture](./concepts/application_architecture.md): Lifecycle patterns and API choices
|
|
20
|
+
- [Event Handling](./concepts/event_handling.md): Keyboard, mouse, and terminal events
|
|
21
|
+
- [Interactive Design](./concepts/interactive_design.md): Cached layout pattern for hit testing
|
|
22
|
+
- [Testing Your Application](./concepts/application_testing.md): Snapshot testing and style assertions
|
|
23
|
+
- [Async Operations](./concepts/async.md): Background tasks and non-blocking I/O
|
|
24
|
+
|
|
25
|
+
### Troubleshooting
|
|
26
|
+
|
|
27
|
+
- [Debugging](./troubleshooting/debugging.md): Debugging techniques and tools
|
|
28
|
+
- [Terminal Limitations](./troubleshooting/terminal_limitations.md): Platform quirks and workarounds
|
|
29
|
+
|
|
30
|
+
### Migration
|
|
31
|
+
|
|
32
|
+
- [Migrating to v0.7.0](./migration/v0_7_0.md): Namespace changes and upgrade guide
|
|
19
33
|
|
|
20
34
|
|
|
21
35
|
## Documentation for Contributors
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
3
|
+
SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
|
+
-->
|
|
5
|
+
|
|
6
|
+
# Debugging TUI Applications
|
|
7
|
+
|
|
8
|
+
TUI applications run in raw terminal mode. stderr and stdout carry terminal escape sequences. Using `puts` or `warn` inside the render loop corrupts the display.
|
|
9
|
+
|
|
10
|
+
This creates a problem: how do you inspect variables and trace execution?
|
|
11
|
+
|
|
12
|
+
Write debug output to files. Tail them in a separate terminal.
|
|
13
|
+
|
|
14
|
+
## File-Based Logging
|
|
15
|
+
|
|
16
|
+
Create timestamped log files to avoid overwrites:
|
|
17
|
+
|
|
18
|
+
```ruby
|
|
19
|
+
FileUtils.mkdir_p(File.join(Dir.tmpdir, "my_debug"))
|
|
20
|
+
timestamp = Time.now.strftime('%Y%m%d_%H%M%S_%N')
|
|
21
|
+
File.write(
|
|
22
|
+
File.join(Dir.tmpdir, "my_debug", "#{timestamp}.log"),
|
|
23
|
+
"variable=#{value.inspect}\n"
|
|
24
|
+
)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Or append to a single file:
|
|
28
|
+
|
|
29
|
+
```ruby
|
|
30
|
+
File.write("/tmp/debug.log", "#{Time.now}: #{message}\n", mode: "a")
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Tail the logs in a separate terminal:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Single file
|
|
37
|
+
tail -f /tmp/debug.log
|
|
38
|
+
|
|
39
|
+
# Directory of timestamped files
|
|
40
|
+
watch -n 0.5 'ls -la /tmp/my_debug/ && cat /tmp/my_debug/*.log'
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## REPL Debugging with `__FILE__` Guards
|
|
44
|
+
|
|
45
|
+
Unit tests verify correctness. But during exploratory debugging, you want to poke at objects interactively. Loading the full TUI just to inspect one object is slow.
|
|
46
|
+
|
|
47
|
+
Wrap your main execution in a guard:
|
|
48
|
+
|
|
49
|
+
```ruby
|
|
50
|
+
if __FILE__ == $PROGRAM_NAME
|
|
51
|
+
MyApp.new.run
|
|
52
|
+
end
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Now load the file and interact with classes directly:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
ruby -e 'load "./bin/my_tui"; obj = MyClass.new; sleep 1; puts obj.result'
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
This exercises domain logic without entering raw terminal mode. Use it for exploratory debugging. Write tests using the [TestHelper](application_testing.md) for regression coverage.
|
|
62
|
+
|
|
63
|
+
## Isolating Terminal Issues
|
|
64
|
+
|
|
65
|
+
Something works in a `ruby -e` script but fails in the TUI. Common causes:
|
|
66
|
+
|
|
67
|
+
1. **Thread context.** Ruby threads share the process's terminal state.
|
|
68
|
+
2. **Raw mode.** External commands fail when stdin/stdout are reconfigured.
|
|
69
|
+
3. **SSH/Git auth.** Commands that prompt for credentials hang or return empty.
|
|
70
|
+
|
|
71
|
+
See [Async Operations](async.md) for solutions.
|
|
@@ -90,3 +90,36 @@ Focus event reporting requires explicit terminal support and configuration. Some
|
|
|
90
90
|
### The Solution
|
|
91
91
|
|
|
92
92
|
Don't rely on focus events for critical functionality. Treat them as nice-to-have enhancements. If your application shows stale data when the user returns, periodically refresh instead of waiting for focus events.
|
|
93
|
+
|
|
94
|
+
## Process Termination
|
|
95
|
+
|
|
96
|
+
### The Problem
|
|
97
|
+
|
|
98
|
+
Your TUI app is terminated by `kill -9` or the [OOM killer](https://en.wikipedia.org/wiki/Out_of_memory#Out_of_memory_management). The terminal stays in raw mode. The user's cursor vanishes. Input echoes weirdly. Their shell is unusable.
|
|
99
|
+
|
|
100
|
+
### The Cause
|
|
101
|
+
|
|
102
|
+
SIGKILL (`kill -9`) terminates processes immediately. No cleanup code runs. The terminal never receives the escape sequences to restore normal mode.
|
|
103
|
+
|
|
104
|
+
This also happens when:
|
|
105
|
+
- The system OOM killer terminates your process
|
|
106
|
+
- A parent process force-kills your app
|
|
107
|
+
- A debugger disconnects ungracefully
|
|
108
|
+
|
|
109
|
+
### The Solution
|
|
110
|
+
|
|
111
|
+
There's no way to catch SIGKILL. You can only mitigate the impact.
|
|
112
|
+
|
|
113
|
+
**Tell your users how to recover.** In your README or troubleshooting docs, explain: if the terminal breaks, type `reset` and press Enter. The characters won't echo, but the command runs.
|
|
114
|
+
|
|
115
|
+
**Script graceful shutdowns.** If you write deployment or process management scripts, prefer graceful signals with a timeout before SIGKILL:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# Graceful first, force if needed
|
|
119
|
+
kill -15 $PID
|
|
120
|
+
sleep 2
|
|
121
|
+
kill -0 $PID 2>/dev/null && kill -9 $PID
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
See [Application Architecture: Signal Handling](../concepts/application_architecture.md#signal-handling) for programmatic cleanup strategies.
|
|
125
|
+
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
#--
|
|
3
4
|
# SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
4
5
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
6
|
+
#++
|
|
5
7
|
|
|
6
8
|
$LOAD_PATH.unshift File.expand_path("../../lib", __dir__)
|
|
7
9
|
$LOAD_PATH.unshift File.expand_path(__dir__)
|
|
@@ -134,3 +134,5 @@ Use this pattern for forms, editors, and mouse-driven tools.
|
|
|
134
134
|
Dashboards display data. They rarely require complex mouse interaction. Model-View-Update works best there. State is immutable. Logic is pure. Updates are predictable. This simplifies testing.
|
|
135
135
|
|
|
136
136
|
Use that pattern for logs, monitors, and data viewers.
|
|
137
|
+
|
|
138
|
+
[Read the source code →](app.rb)
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
#--
|
|
3
4
|
# SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
4
5
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
6
|
+
#++
|
|
5
7
|
|
|
6
8
|
$LOAD_PATH.unshift File.expand_path("../../lib", __dir__)
|
|
7
9
|
$LOAD_PATH.unshift File.expand_path(__dir__)
|
|
@@ -43,7 +43,10 @@ ruby examples/app_login_form/app.rb
|
|
|
43
43
|
## Learning Outcomes
|
|
44
44
|
|
|
45
45
|
Use this example if you need to...
|
|
46
|
+
|
|
46
47
|
- Create a modal dialog or popup.
|
|
47
48
|
- Center a widget on the screen (vertically and horizontally).
|
|
48
49
|
- Implement a simple text input field with cursor management.
|
|
49
50
|
- layer widgets using the `Overlay` widget.
|
|
51
|
+
|
|
52
|
+
[Read the source code →](app.rb)
|
data/examples/timeout_demo.rb
CHANGED
|
@@ -5,7 +5,7 @@ SPDX-License-Identifier: CC-BY-SA-4.0
|
|
|
5
5
|
|
|
6
6
|
# Quickstart DSL Verification
|
|
7
7
|
|
|
8
|
-
Verifies the "Simplified API" tutorial in the [Quickstart](../../doc/quickstart.md#simplified-api).
|
|
8
|
+
Verifies the "Simplified API" tutorial in the [Quickstart](../../doc/getting_started/quickstart.md#simplified-api).
|
|
9
9
|
|
|
10
10
|
This example exists as a documentation regression test. It ensures the recommended TUI facade and managed lifecycle workflow remains functional.
|
|
11
11
|
|
|
@@ -46,4 +46,4 @@ end
|
|
|
46
46
|
```
|
|
47
47
|
<!-- SYNC:END -->
|
|
48
48
|
|
|
49
|
-
[](../../doc/quickstart.md#simplified-api)
|
|
49
|
+
[](../../doc/getting_started/quickstart.md#simplified-api)
|