ratatui_ruby 1.4.0-x86_64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +15 -0
- data/LICENSES/AGPL-3.0-or-later.txt +661 -0
- data/LICENSES/CC-BY-SA-4.0.txt +427 -0
- data/LICENSES/CC0-1.0.txt +121 -0
- data/LICENSES/LGPL-3.0-or-later.txt +304 -0
- data/LICENSES/MIT-0.txt +16 -0
- data/LICENSES/MIT.txt +21 -0
- data/REUSE.toml +42 -0
- data/exe/.gitkeep +0 -0
- data/ext/ratatui_ruby/.cargo/config.toml +13 -0
- data/ext/ratatui_ruby/.gitignore +4 -0
- data/ext/ratatui_ruby/Cargo.lock +1737 -0
- data/ext/ratatui_ruby/Cargo.toml +24 -0
- data/ext/ratatui_ruby/clippy.toml +7 -0
- data/ext/ratatui_ruby/extconf.rb +21 -0
- data/ext/ratatui_ruby/src/color.rs +82 -0
- data/ext/ratatui_ruby/src/errors.rs +28 -0
- data/ext/ratatui_ruby/src/events.rs +700 -0
- data/ext/ratatui_ruby/src/frame.rs +241 -0
- data/ext/ratatui_ruby/src/lib.rs +343 -0
- data/ext/ratatui_ruby/src/lib_header.rs +11 -0
- data/ext/ratatui_ruby/src/rendering.rs +158 -0
- data/ext/ratatui_ruby/src/string_width.rs +101 -0
- data/ext/ratatui_ruby/src/style.rs +469 -0
- data/ext/ratatui_ruby/src/terminal/capabilities.rs +46 -0
- data/ext/ratatui_ruby/src/terminal/init.rs +233 -0
- data/ext/ratatui_ruby/src/terminal/mod.rs +42 -0
- data/ext/ratatui_ruby/src/terminal/mutations.rs +158 -0
- data/ext/ratatui_ruby/src/terminal/queries.rs +231 -0
- data/ext/ratatui_ruby/src/terminal/query.rs +400 -0
- data/ext/ratatui_ruby/src/terminal/storage.rs +109 -0
- data/ext/ratatui_ruby/src/terminal/wrapper.rs +16 -0
- data/ext/ratatui_ruby/src/text.rs +225 -0
- data/ext/ratatui_ruby/src/widgets/barchart.rs +169 -0
- data/ext/ratatui_ruby/src/widgets/block.rs +41 -0
- data/ext/ratatui_ruby/src/widgets/calendar.rs +84 -0
- data/ext/ratatui_ruby/src/widgets/canvas.rs +183 -0
- data/ext/ratatui_ruby/src/widgets/center.rs +79 -0
- data/ext/ratatui_ruby/src/widgets/chart.rs +222 -0
- data/ext/ratatui_ruby/src/widgets/clear.rs +39 -0
- data/ext/ratatui_ruby/src/widgets/cursor.rs +32 -0
- data/ext/ratatui_ruby/src/widgets/gauge.rs +65 -0
- data/ext/ratatui_ruby/src/widgets/layout.rs +379 -0
- data/ext/ratatui_ruby/src/widgets/line_gauge.rs +100 -0
- data/ext/ratatui_ruby/src/widgets/list.rs +378 -0
- data/ext/ratatui_ruby/src/widgets/list_state.rs +173 -0
- data/ext/ratatui_ruby/src/widgets/mod.rs +26 -0
- data/ext/ratatui_ruby/src/widgets/overlay.rs +24 -0
- data/ext/ratatui_ruby/src/widgets/paragraph.rs +87 -0
- data/ext/ratatui_ruby/src/widgets/ratatui_logo.rs +40 -0
- data/ext/ratatui_ruby/src/widgets/ratatui_mascot.rs +55 -0
- data/ext/ratatui_ruby/src/widgets/scrollbar.rs +214 -0
- data/ext/ratatui_ruby/src/widgets/scrollbar_state.rs +169 -0
- data/ext/ratatui_ruby/src/widgets/sparkline.rs +127 -0
- data/ext/ratatui_ruby/src/widgets/table.rs +415 -0
- data/ext/ratatui_ruby/src/widgets/table_state.rs +203 -0
- data/ext/ratatui_ruby/src/widgets/tabs.rs +194 -0
- data/lib/ratatui_ruby/backend/window_size.rb +50 -0
- data/lib/ratatui_ruby/backend.rb +59 -0
- data/lib/ratatui_ruby/buffer/cell.rb +212 -0
- data/lib/ratatui_ruby/buffer.rb +149 -0
- data/lib/ratatui_ruby/cell.rb +208 -0
- data/lib/ratatui_ruby/debug.rb +215 -0
- data/lib/ratatui_ruby/draw.rb +63 -0
- data/lib/ratatui_ruby/event/focus_gained.rb +125 -0
- data/lib/ratatui_ruby/event/focus_lost.rb +127 -0
- data/lib/ratatui_ruby/event/key/character.rb +53 -0
- data/lib/ratatui_ruby/event/key/dwim.rb +301 -0
- data/lib/ratatui_ruby/event/key/media.rb +46 -0
- data/lib/ratatui_ruby/event/key/modifier.rb +107 -0
- data/lib/ratatui_ruby/event/key/navigation.rb +72 -0
- data/lib/ratatui_ruby/event/key/system.rb +47 -0
- data/lib/ratatui_ruby/event/key.rb +479 -0
- data/lib/ratatui_ruby/event/mouse.rb +291 -0
- data/lib/ratatui_ruby/event/none.rb +53 -0
- data/lib/ratatui_ruby/event/paste.rb +130 -0
- data/lib/ratatui_ruby/event/resize.rb +221 -0
- data/lib/ratatui_ruby/event/sync.rb +52 -0
- data/lib/ratatui_ruby/event.rb +163 -0
- data/lib/ratatui_ruby/frame.rb +257 -0
- data/lib/ratatui_ruby/labs/a11y.rb +182 -0
- data/lib/ratatui_ruby/labs/frame_a11y_capture.rb +50 -0
- data/lib/ratatui_ruby/labs.rb +47 -0
- data/lib/ratatui_ruby/layout/alignment.rb +91 -0
- data/lib/ratatui_ruby/layout/constraint.rb +337 -0
- data/lib/ratatui_ruby/layout/layout.rb +258 -0
- data/lib/ratatui_ruby/layout/position.rb +81 -0
- data/lib/ratatui_ruby/layout/rect.rb +733 -0
- data/lib/ratatui_ruby/layout/size.rb +62 -0
- data/lib/ratatui_ruby/layout.rb +29 -0
- data/lib/ratatui_ruby/list_state.rb +201 -0
- data/lib/ratatui_ruby/output_guard.rb +171 -0
- data/lib/ratatui_ruby/ratatui_ruby.so +0 -0
- data/lib/ratatui_ruby/scrollbar_state.rb +122 -0
- data/lib/ratatui_ruby/style/color.rb +149 -0
- data/lib/ratatui_ruby/style/style.rb +147 -0
- data/lib/ratatui_ruby/style.rb +19 -0
- data/lib/ratatui_ruby/symbols.rb +435 -0
- data/lib/ratatui_ruby/synthetic_events.rb +106 -0
- data/lib/ratatui_ruby/table_state.rb +251 -0
- data/lib/ratatui_ruby/terminal/capabilities.rb +316 -0
- data/lib/ratatui_ruby/terminal/viewport.rb +80 -0
- data/lib/ratatui_ruby/terminal.rb +66 -0
- data/lib/ratatui_ruby/terminal_lifecycle.rb +303 -0
- data/lib/ratatui_ruby/terminal_lifecycle.rb.bak +197 -0
- data/lib/ratatui_ruby/test_helper/event_injection.rb +241 -0
- data/lib/ratatui_ruby/test_helper/global_state.rb +111 -0
- data/lib/ratatui_ruby/test_helper/snapshot.rb +568 -0
- data/lib/ratatui_ruby/test_helper/snapshots/axis_labels_alignment.ansi +24 -0
- data/lib/ratatui_ruby/test_helper/snapshots/axis_labels_alignment.txt +24 -0
- data/lib/ratatui_ruby/test_helper/snapshots/barchart_styled_label.ansi +5 -0
- data/lib/ratatui_ruby/test_helper/snapshots/barchart_styled_label.txt +5 -0
- data/lib/ratatui_ruby/test_helper/snapshots/chart_rendering.ansi +24 -0
- data/lib/ratatui_ruby/test_helper/snapshots/chart_rendering.txt +24 -0
- data/lib/ratatui_ruby/test_helper/snapshots/half_block_marker.ansi +12 -0
- data/lib/ratatui_ruby/test_helper/snapshots/half_block_marker.txt +12 -0
- data/lib/ratatui_ruby/test_helper/snapshots/legend_position_bottom.ansi +12 -0
- data/lib/ratatui_ruby/test_helper/snapshots/legend_position_bottom.txt +12 -0
- data/lib/ratatui_ruby/test_helper/snapshots/legend_position_left.ansi +12 -0
- data/lib/ratatui_ruby/test_helper/snapshots/legend_position_left.txt +12 -0
- data/lib/ratatui_ruby/test_helper/snapshots/legend_position_right.ansi +12 -0
- data/lib/ratatui_ruby/test_helper/snapshots/legend_position_right.txt +12 -0
- data/lib/ratatui_ruby/test_helper/snapshots/legend_position_top.ansi +12 -0
- data/lib/ratatui_ruby/test_helper/snapshots/legend_position_top.txt +12 -0
- data/lib/ratatui_ruby/test_helper/snapshots/my_snapshot.txt +1 -0
- data/lib/ratatui_ruby/test_helper/snapshots/styled_axis_title.ansi +10 -0
- data/lib/ratatui_ruby/test_helper/snapshots/styled_axis_title.txt +10 -0
- data/lib/ratatui_ruby/test_helper/snapshots/styled_dataset_name.ansi +10 -0
- data/lib/ratatui_ruby/test_helper/snapshots/styled_dataset_name.txt +10 -0
- data/lib/ratatui_ruby/test_helper/style_assertions.rb +449 -0
- data/lib/ratatui_ruby/test_helper/subprocess_timeout.rb +35 -0
- data/lib/ratatui_ruby/test_helper/terminal.rb +187 -0
- data/lib/ratatui_ruby/test_helper/test_doubles.rb +86 -0
- data/lib/ratatui_ruby/test_helper.rb +115 -0
- data/lib/ratatui_ruby/text/line.rb +245 -0
- data/lib/ratatui_ruby/text/span.rb +158 -0
- data/lib/ratatui_ruby/text.rb +99 -0
- data/lib/ratatui_ruby/tui/buffer_factories.rb +22 -0
- data/lib/ratatui_ruby/tui/canvas_factories.rb +149 -0
- data/lib/ratatui_ruby/tui/core.rb +67 -0
- data/lib/ratatui_ruby/tui/layout_factories.rb +153 -0
- data/lib/ratatui_ruby/tui/state_factories.rb +77 -0
- data/lib/ratatui_ruby/tui/style_factories.rb +22 -0
- data/lib/ratatui_ruby/tui/text_factories.rb +86 -0
- data/lib/ratatui_ruby/tui/widget_factories.rb +272 -0
- data/lib/ratatui_ruby/tui.rb +106 -0
- data/lib/ratatui_ruby/version.rb +12 -0
- data/lib/ratatui_ruby/widgets/bar_chart/bar.rb +51 -0
- data/lib/ratatui_ruby/widgets/bar_chart/bar_group.rb +29 -0
- data/lib/ratatui_ruby/widgets/bar_chart.rb +308 -0
- data/lib/ratatui_ruby/widgets/block.rb +266 -0
- data/lib/ratatui_ruby/widgets/calendar.rb +88 -0
- data/lib/ratatui_ruby/widgets/canvas.rb +297 -0
- data/lib/ratatui_ruby/widgets/cell.rb +59 -0
- data/lib/ratatui_ruby/widgets/center.rb +71 -0
- data/lib/ratatui_ruby/widgets/chart.rb +172 -0
- data/lib/ratatui_ruby/widgets/clear.rb +66 -0
- data/lib/ratatui_ruby/widgets/coerceable_widget.rb +77 -0
- data/lib/ratatui_ruby/widgets/cursor.rb +54 -0
- data/lib/ratatui_ruby/widgets/gauge.rb +146 -0
- data/lib/ratatui_ruby/widgets/line_gauge.rb +158 -0
- data/lib/ratatui_ruby/widgets/list.rb +252 -0
- data/lib/ratatui_ruby/widgets/list_item.rb +55 -0
- data/lib/ratatui_ruby/widgets/overlay.rb +55 -0
- data/lib/ratatui_ruby/widgets/paragraph.rb +113 -0
- data/lib/ratatui_ruby/widgets/ratatui_logo.rb +35 -0
- data/lib/ratatui_ruby/widgets/ratatui_mascot.rb +40 -0
- data/lib/ratatui_ruby/widgets/row.rb +123 -0
- data/lib/ratatui_ruby/widgets/scrollbar.rb +147 -0
- data/lib/ratatui_ruby/widgets/shape/label.rb +80 -0
- data/lib/ratatui_ruby/widgets/sparkline.rb +153 -0
- data/lib/ratatui_ruby/widgets/table.rb +213 -0
- data/lib/ratatui_ruby/widgets/tabs.rb +91 -0
- data/lib/ratatui_ruby/widgets.rb +43 -0
- data/lib/ratatui_ruby.rb +555 -0
- data/sig/examples/app_all_events/app.rbs +11 -0
- data/sig/examples/app_all_events/model/app_model.rbs +23 -0
- data/sig/examples/app_all_events/model/event_entry.rbs +23 -0
- data/sig/examples/app_all_events/model/timestamp.rbs +11 -0
- data/sig/examples/app_all_events/view/app_view.rbs +8 -0
- data/sig/examples/app_all_events/view/controls_view.rbs +6 -0
- data/sig/examples/app_all_events/view/counts_view.rbs +6 -0
- data/sig/examples/app_all_events/view/live_view.rbs +6 -0
- data/sig/examples/app_all_events/view/log_view.rbs +6 -0
- data/sig/examples/app_all_events/view.rbs +14 -0
- data/sig/examples/app_cli_rich_moments/app.rbs +12 -0
- data/sig/examples/app_color_picker/app.rbs +17 -0
- data/sig/examples/app_external_editor/app.rbs +12 -0
- data/sig/examples/app_login_form/app.rbs +11 -0
- data/sig/examples/app_stateful_interaction/app.rbs +39 -0
- data/sig/examples/verify_quickstart_dsl/app.rbs +17 -0
- data/sig/examples/verify_quickstart_lifecycle/app.rbs +17 -0
- data/sig/examples/verify_readme_usage/app.rbs +17 -0
- data/sig/examples/widget_block_demo/app.rbs +38 -0
- data/sig/examples/widget_box_demo/app.rbs +17 -0
- data/sig/examples/widget_calendar_demo/app.rbs +17 -0
- data/sig/examples/widget_cell_demo/app.rbs +17 -0
- data/sig/examples/widget_chart_demo/app.rbs +17 -0
- data/sig/examples/widget_gauge_demo/app.rbs +17 -0
- data/sig/examples/widget_layout_split/app.rbs +16 -0
- data/sig/examples/widget_line_gauge_demo/app.rbs +17 -0
- data/sig/examples/widget_list_demo/app.rbs +17 -0
- data/sig/examples/widget_map_demo/app.rbs +17 -0
- data/sig/examples/widget_popup_demo/app.rbs +17 -0
- data/sig/examples/widget_ratatui_logo_demo/app.rbs +17 -0
- data/sig/examples/widget_ratatui_mascot_demo/app.rbs +17 -0
- data/sig/examples/widget_rect/app.rbs +18 -0
- data/sig/examples/widget_render/app.rbs +16 -0
- data/sig/examples/widget_rich_text/app.rbs +17 -0
- data/sig/examples/widget_scroll_text/app.rbs +17 -0
- data/sig/examples/widget_scrollbar_demo/app.rbs +17 -0
- data/sig/examples/widget_sparkline_demo/app.rbs +16 -0
- data/sig/examples/widget_style_colors/app.rbs +20 -0
- data/sig/examples/widget_table_demo/app.rbs +17 -0
- data/sig/examples/widget_text_width/app.rbs +16 -0
- data/sig/generated/event_key_predicates.rbs +1348 -0
- data/sig/manifest.yaml +5 -0
- data/sig/patches/data.rbs +26 -0
- data/sig/patches/debugger__.rbs +8 -0
- data/sig/ratatui_ruby/backend/window_size.rbs +17 -0
- data/sig/ratatui_ruby/backend.rbs +12 -0
- data/sig/ratatui_ruby/buffer/cell.rbs +46 -0
- data/sig/ratatui_ruby/buffer.rbs +18 -0
- data/sig/ratatui_ruby/cell.rbs +44 -0
- data/sig/ratatui_ruby/clear.rbs +18 -0
- data/sig/ratatui_ruby/constraint.rbs +26 -0
- data/sig/ratatui_ruby/debug.rbs +45 -0
- data/sig/ratatui_ruby/draw.rbs +30 -0
- data/sig/ratatui_ruby/event.rbs +249 -0
- data/sig/ratatui_ruby/frame.rbs +23 -0
- data/sig/ratatui_ruby/interfaces.rbs +25 -0
- data/sig/ratatui_ruby/labs.rbs +90 -0
- data/sig/ratatui_ruby/layout/alignment.rbs +26 -0
- data/sig/ratatui_ruby/layout/constraint.rbs +39 -0
- data/sig/ratatui_ruby/layout/layout.rbs +45 -0
- data/sig/ratatui_ruby/layout/position.rbs +18 -0
- data/sig/ratatui_ruby/layout/rect.rbs +64 -0
- data/sig/ratatui_ruby/layout/size.rbs +18 -0
- data/sig/ratatui_ruby/list_state.rbs +23 -0
- data/sig/ratatui_ruby/output_guard.rbs +23 -0
- data/sig/ratatui_ruby/ratatui_ruby.rbs +113 -0
- data/sig/ratatui_ruby/rect.rbs +17 -0
- data/sig/ratatui_ruby/scrollbar_state.rbs +24 -0
- data/sig/ratatui_ruby/session.rbs +93 -0
- data/sig/ratatui_ruby/style/color.rbs +22 -0
- data/sig/ratatui_ruby/style/style.rbs +29 -0
- data/sig/ratatui_ruby/symbols.rbs +141 -0
- data/sig/ratatui_ruby/synthetic_events.rbs +24 -0
- data/sig/ratatui_ruby/table_state.rbs +27 -0
- data/sig/ratatui_ruby/terminal/capabilities.rbs +38 -0
- data/sig/ratatui_ruby/terminal/viewport.rbs +33 -0
- data/sig/ratatui_ruby/terminal_lifecycle.rbs +39 -0
- data/sig/ratatui_ruby/test_helper/event_injection.rbs +22 -0
- data/sig/ratatui_ruby/test_helper/snapshot.rbs +37 -0
- data/sig/ratatui_ruby/test_helper/style_assertions.rbs +77 -0
- data/sig/ratatui_ruby/test_helper/terminal.rbs +20 -0
- data/sig/ratatui_ruby/test_helper/test_doubles.rbs +32 -0
- data/sig/ratatui_ruby/test_helper.rbs +18 -0
- data/sig/ratatui_ruby/text/line.rbs +27 -0
- data/sig/ratatui_ruby/text/span.rbs +23 -0
- data/sig/ratatui_ruby/text.rbs +12 -0
- data/sig/ratatui_ruby/tui/buffer_factories.rbs +16 -0
- data/sig/ratatui_ruby/tui/canvas_factories.rbs +38 -0
- data/sig/ratatui_ruby/tui/core.rbs +23 -0
- data/sig/ratatui_ruby/tui/layout_factories.rbs +39 -0
- data/sig/ratatui_ruby/tui/state_factories.rbs +23 -0
- data/sig/ratatui_ruby/tui/style_factories.rbs +18 -0
- data/sig/ratatui_ruby/tui/text_factories.rbs +23 -0
- data/sig/ratatui_ruby/tui/widget_factories.rbs +138 -0
- data/sig/ratatui_ruby/tui.rbs +25 -0
- data/sig/ratatui_ruby/version.rbs +12 -0
- data/sig/ratatui_ruby/widgets/bar_chart.rbs +95 -0
- data/sig/ratatui_ruby/widgets/block.rbs +51 -0
- data/sig/ratatui_ruby/widgets/calendar.rbs +45 -0
- data/sig/ratatui_ruby/widgets/canvas.rbs +95 -0
- data/sig/ratatui_ruby/widgets/chart.rbs +91 -0
- data/sig/ratatui_ruby/widgets/coerceable_widget.rbs +26 -0
- data/sig/ratatui_ruby/widgets/gauge.rbs +44 -0
- data/sig/ratatui_ruby/widgets/line_gauge.rbs +48 -0
- data/sig/ratatui_ruby/widgets/list.rbs +63 -0
- data/sig/ratatui_ruby/widgets/misc.rbs +158 -0
- data/sig/ratatui_ruby/widgets/paragraph.rbs +45 -0
- data/sig/ratatui_ruby/widgets/row.rbs +43 -0
- data/sig/ratatui_ruby/widgets/scrollbar.rbs +53 -0
- data/sig/ratatui_ruby/widgets/shape/label.rbs +37 -0
- data/sig/ratatui_ruby/widgets/sparkline.rbs +45 -0
- data/sig/ratatui_ruby/widgets/table.rbs +78 -0
- data/sig/ratatui_ruby/widgets/tabs.rbs +44 -0
- data/sig/ratatui_ruby/widgets.rbs +16 -0
- data/vendor/goodcop/base.yml +1047 -0
- metadata +729 -0
data/sig/manifest.yaml
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
|
|
5
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
6
|
+
#++
|
|
7
|
+
|
|
8
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
9
|
+
|
|
10
|
+
# Patch for Data class to support super() calls in Data.define subclasses.
|
|
11
|
+
#
|
|
12
|
+
# The core RBS Data class defines `self.new: (**untyped) -> Data` but not `initialize`.
|
|
13
|
+
# When Steep type-checks `super(items:, ...)` in a Data.define subclass, it looks for
|
|
14
|
+
# the parent's `initialize` method. Since Data has no `initialize` signature in core RBS,
|
|
15
|
+
# Steep can't match arguments and raises errors.
|
|
16
|
+
#
|
|
17
|
+
# This patch adds the missing `initialize` signatures that Data.define generates dynamically.
|
|
18
|
+
class Data
|
|
19
|
+
# Accept both positional and keyword arguments for the dynamically-generated initialize.
|
|
20
|
+
# This allows subclasses to call super(foo, bar, ...) or super(foo:, bar:, ...) without type errors.
|
|
21
|
+
def initialize: (*untyped) -> void
|
|
22
|
+
| (**untyped) -> void
|
|
23
|
+
# Allow super() calls from overridden self.new methods to work with any keyword args
|
|
24
|
+
def self.new: (**untyped) -> instance
|
|
25
|
+
end
|
|
26
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
|
|
2
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
# Minimal stub for debug gem's DEBUGGER__ constant
|
|
5
|
+
# Full library causes Steep deadlock on Ruby 4.0 (Steep 1.10.0 threading issue)
|
|
6
|
+
module DEBUGGER__
|
|
7
|
+
def self.create_unix_domain_socket_name: () -> String?
|
|
8
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
|
|
5
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
6
|
+
#++
|
|
7
|
+
|
|
8
|
+
module RatatuiRuby
|
|
9
|
+
module Backend
|
|
10
|
+
class WindowSize < Data
|
|
11
|
+
attr_reader columns_rows: Layout::Size
|
|
12
|
+
attr_reader pixels: Layout::Size
|
|
13
|
+
|
|
14
|
+
def self.new: (columns_rows: Layout::Size, pixels: Layout::Size) -> instance
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
|
|
5
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
6
|
+
#++
|
|
7
|
+
|
|
8
|
+
module RatatuiRuby
|
|
9
|
+
module Buffer
|
|
10
|
+
class Cell
|
|
11
|
+
type color = Symbol | String | nil
|
|
12
|
+
|
|
13
|
+
attr_reader symbol: String
|
|
14
|
+
attr_reader fg: color
|
|
15
|
+
attr_reader bg: color
|
|
16
|
+
attr_reader underline_color: color
|
|
17
|
+
attr_reader modifiers: Array[Symbol]
|
|
18
|
+
|
|
19
|
+
alias char symbol
|
|
20
|
+
|
|
21
|
+
def self.new: (?symbol: String?, ?char: String?, ?fg: color, ?bg: color, ?underline_color: color, ?modifiers: Array[String | Symbol]) -> Cell
|
|
22
|
+
def self.empty: () -> Cell
|
|
23
|
+
def self.default: () -> Cell
|
|
24
|
+
def self.symbol: (String symbol) -> Cell
|
|
25
|
+
def self.char: (String char) -> Cell
|
|
26
|
+
|
|
27
|
+
def initialize: (?symbol: String?, ?char: String?, ?fg: color, ?bg: color, ?underline_color: color, ?modifiers: Array[String | Symbol]) -> void
|
|
28
|
+
|
|
29
|
+
# Modifier predicates
|
|
30
|
+
def bold?: () -> bool
|
|
31
|
+
def dim?: () -> bool
|
|
32
|
+
def italic?: () -> bool
|
|
33
|
+
def underlined?: () -> bool
|
|
34
|
+
def slow_blink?: () -> bool
|
|
35
|
+
def rapid_blink?: () -> bool
|
|
36
|
+
def reversed?: () -> bool
|
|
37
|
+
def hidden?: () -> bool
|
|
38
|
+
def crossed_out?: () -> bool
|
|
39
|
+
|
|
40
|
+
def ==: (untyped other) -> bool
|
|
41
|
+
def inspect: () -> String
|
|
42
|
+
def to_s: () -> String
|
|
43
|
+
def deconstruct_keys: (Array[Symbol]? keys) -> { symbol: String, char: String, fg: color, bg: color, underline_color: color, modifiers: Array[Symbol] }
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
|
|
5
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
6
|
+
#++
|
|
7
|
+
|
|
8
|
+
module RatatuiRuby
|
|
9
|
+
module Buffer
|
|
10
|
+
def self.index_of: (Integer x, Integer y) -> Integer
|
|
11
|
+
def self.pos_of: (Integer index) -> [Integer, Integer]
|
|
12
|
+
def self.get: (Integer x, Integer y) -> Cell
|
|
13
|
+
def self.content: () -> Array[Cell]
|
|
14
|
+
|
|
15
|
+
# Ruby-idiomatic alias
|
|
16
|
+
alias self.[] self.get
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
|
|
5
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
6
|
+
#++
|
|
7
|
+
|
|
8
|
+
module RatatuiRuby
|
|
9
|
+
class Cell
|
|
10
|
+
type color = Symbol | String | nil
|
|
11
|
+
|
|
12
|
+
attr_reader symbol: String
|
|
13
|
+
attr_reader fg: color
|
|
14
|
+
attr_reader bg: color
|
|
15
|
+
attr_reader underline_color: color
|
|
16
|
+
attr_reader modifiers: Array[String]
|
|
17
|
+
|
|
18
|
+
alias char symbol
|
|
19
|
+
|
|
20
|
+
def self.new: (?symbol: String?, ?char: String?, ?fg: color, ?bg: color, ?underline_color: color, ?modifiers: Array[String]) -> Cell
|
|
21
|
+
def self.empty: () -> Cell
|
|
22
|
+
def self.default: () -> Cell
|
|
23
|
+
def self.symbol: (String symbol) -> Cell
|
|
24
|
+
def self.char: (String char) -> Cell
|
|
25
|
+
|
|
26
|
+
def initialize: (?symbol: String?, ?char: String?, ?fg: color, ?bg: color, ?underline_color: color, ?modifiers: Array[String]) -> void
|
|
27
|
+
|
|
28
|
+
# Modifier predicates
|
|
29
|
+
def bold?: () -> bool
|
|
30
|
+
def dim?: () -> bool
|
|
31
|
+
def italic?: () -> bool
|
|
32
|
+
def underlined?: () -> bool
|
|
33
|
+
def slow_blink?: () -> bool
|
|
34
|
+
def rapid_blink?: () -> bool
|
|
35
|
+
def reversed?: () -> bool
|
|
36
|
+
def hidden?: () -> bool
|
|
37
|
+
def crossed_out?: () -> bool
|
|
38
|
+
|
|
39
|
+
def ==: (untyped other) -> bool
|
|
40
|
+
def inspect: () -> String
|
|
41
|
+
def to_s: () -> String
|
|
42
|
+
def deconstruct_keys: (Array[Symbol]? keys) -> { symbol: String, char: String, fg: color, bg: color, underline_color: color, modifiers: Array[String] }
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
|
|
5
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
6
|
+
#++
|
|
7
|
+
|
|
8
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
9
|
+
|
|
10
|
+
module RatatuiRuby
|
|
11
|
+
# Widget to clear/reset a terminal area before rendering.
|
|
12
|
+
class Clear < Data
|
|
13
|
+
attr_reader block: Widgets::Block?
|
|
14
|
+
|
|
15
|
+
def self.new: (?block: Widgets::Block?) -> Clear
|
|
16
|
+
def initialize: (?block: Widgets::Block?) -> void
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
|
|
5
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
6
|
+
#++
|
|
7
|
+
|
|
8
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
9
|
+
|
|
10
|
+
module RatatuiRuby
|
|
11
|
+
# Schema Constraint - defined directly under RatatuiRuby namespace.
|
|
12
|
+
class Constraint < Data
|
|
13
|
+
attr_reader type: Symbol
|
|
14
|
+
attr_reader value: (Integer | Array[Integer])
|
|
15
|
+
|
|
16
|
+
def self.new: (type: Symbol, value: (Integer | Array[Integer])) -> Constraint
|
|
17
|
+
def initialize: (type: Symbol, value: (Integer | Array[Integer])) -> void
|
|
18
|
+
|
|
19
|
+
def self.length: (_ToI) -> Constraint
|
|
20
|
+
def self.percentage: (_ToI) -> Constraint
|
|
21
|
+
def self.min: (_ToI) -> Constraint
|
|
22
|
+
def self.max: (_ToI) -> Constraint
|
|
23
|
+
def self.fill: (?_ToI) -> Constraint
|
|
24
|
+
def self.ratio: (_ToI, _ToI) -> Constraint
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
|
|
2
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
module RatatuiRuby
|
|
5
|
+
# Debug mode control for RatatuiRuby.
|
|
6
|
+
#
|
|
7
|
+
# Manages Rust backtrace visibility and Ruby-side debug features.
|
|
8
|
+
module Debug
|
|
9
|
+
@rust_backtrace_enabled: bool
|
|
10
|
+
@debug_mode_enabled: bool
|
|
11
|
+
@remote_debugging_mode: (:open | :open_nonstop)?
|
|
12
|
+
@socket_path: String?
|
|
13
|
+
|
|
14
|
+
type source = :env | :test | :programmatic
|
|
15
|
+
|
|
16
|
+
# Enables Rust backtraces only.
|
|
17
|
+
def self.enable_rust_backtrace!: () -> void
|
|
18
|
+
|
|
19
|
+
# Enables full debug mode (Rust backtraces + Ruby-side features).
|
|
20
|
+
# Returns the socket path for remote debugging (nil on Windows or in test mode).
|
|
21
|
+
# source: :env (from RR_DEBUG), :test (from TestHelper), :programmatic (default)
|
|
22
|
+
def self.enable!: (?source: source) -> String?
|
|
23
|
+
|
|
24
|
+
# Returns whether full debug mode is enabled.
|
|
25
|
+
def self.enabled?: () -> bool
|
|
26
|
+
|
|
27
|
+
# Returns whether Rust backtraces are enabled.
|
|
28
|
+
def self.rust_backtrace_enabled?: () -> bool
|
|
29
|
+
|
|
30
|
+
# Returns the remote debugging mode for debug gem integration.
|
|
31
|
+
def self.remote_debugging_mode: () -> (:open | :open_nonstop)?
|
|
32
|
+
|
|
33
|
+
# Triggers a Rust panic for backtrace verification.
|
|
34
|
+
# WARNING: Crashes your process. Use only for debugging.
|
|
35
|
+
def self.test_panic!: () -> bot
|
|
36
|
+
|
|
37
|
+
# Temporarily suppresses Ruby-side debug mode checks within the block.
|
|
38
|
+
def self.suppress_debug_mode: [T] () { () -> T } -> T
|
|
39
|
+
|
|
40
|
+
private
|
|
41
|
+
|
|
42
|
+
# Enables remote debugging via the debug gem. Returns socket path.
|
|
43
|
+
def self.enable_remote_debugging!: () -> String?
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
|
|
5
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
6
|
+
#++
|
|
7
|
+
|
|
8
|
+
module RatatuiRuby
|
|
9
|
+
module Draw
|
|
10
|
+
class StringCmd < Data
|
|
11
|
+
attr_reader x: Integer
|
|
12
|
+
attr_reader y: Integer
|
|
13
|
+
attr_reader string: String
|
|
14
|
+
attr_reader style: style_input
|
|
15
|
+
|
|
16
|
+
def self.new: (x: Integer, y: Integer, string: String, style: style_input) -> StringCmd
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
class CellCmd < Data
|
|
20
|
+
attr_reader x: Integer
|
|
21
|
+
attr_reader y: Integer
|
|
22
|
+
attr_reader cell: Buffer::Cell
|
|
23
|
+
|
|
24
|
+
def self.new: (x: Integer, y: Integer, cell: Buffer::Cell) -> CellCmd
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.string: (_ToI x, _ToI y, String string, ?style_input style) -> StringCmd
|
|
28
|
+
def self.cell: (_ToI x, _ToI y, Buffer::Cell cell) -> CellCmd
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
|
|
5
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
6
|
+
#++
|
|
7
|
+
|
|
8
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
9
|
+
|
|
10
|
+
module RatatuiRuby
|
|
11
|
+
class Event
|
|
12
|
+
def none?: () -> bool
|
|
13
|
+
def key?: () -> bool
|
|
14
|
+
def mouse?: () -> bool
|
|
15
|
+
def resize?: () -> bool
|
|
16
|
+
def paste?: () -> bool
|
|
17
|
+
def focus_gained?: () -> bool
|
|
18
|
+
def focus_lost?: () -> bool
|
|
19
|
+
def sync?: () -> bool
|
|
20
|
+
def method_missing: (Symbol, *untyped, **untyped) ?{ (?) -> untyped } -> untyped
|
|
21
|
+
def respond_to_missing?: (Symbol, *untyped) -> bool
|
|
22
|
+
def deconstruct_keys: (Array[Symbol]?) -> { }
|
|
23
|
+
|
|
24
|
+
type key_kind = :standard | :function | :media | :modifier | :system
|
|
25
|
+
|
|
26
|
+
class Sync < Event
|
|
27
|
+
def sync?: () -> bool
|
|
28
|
+
def deconstruct_keys: (Array[Symbol]?) -> { type: :sync }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
class Key < Event
|
|
32
|
+
# Character handling module
|
|
33
|
+
module Character
|
|
34
|
+
def text?: () -> bool
|
|
35
|
+
def char: () -> String?
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Modifier key detection module
|
|
39
|
+
module Modifier
|
|
40
|
+
def ctrl?: () -> bool
|
|
41
|
+
def alt?: () -> bool
|
|
42
|
+
def shift?: () -> bool
|
|
43
|
+
def super?: () -> bool
|
|
44
|
+
def hyper?: () -> bool
|
|
45
|
+
def meta?: () -> bool
|
|
46
|
+
def modifier?: () -> bool
|
|
47
|
+
private def match_modifier_dwim?: (String key_name, Symbol key_sym) -> bool
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Media key handling module
|
|
51
|
+
module Media
|
|
52
|
+
def media?: () -> bool
|
|
53
|
+
private def match_media_dwim?: (String key_name) -> bool
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Navigation key handling module
|
|
57
|
+
module Navigation
|
|
58
|
+
def standard?: () -> bool
|
|
59
|
+
alias unmodified? standard?
|
|
60
|
+
private def match_navigation_dwim?: (String key_name, Symbol key_sym) -> bool
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# System key handling module
|
|
64
|
+
module System
|
|
65
|
+
def system?: () -> bool
|
|
66
|
+
def function?: () -> bool
|
|
67
|
+
private def match_system_dwim?: (String key_name, Symbol key_sym) -> bool
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# DWIM predicates for common key patterns
|
|
71
|
+
module Dwim
|
|
72
|
+
NAVIGATION_KEYS: Array[String]
|
|
73
|
+
ARROW_KEYS: Array[String]
|
|
74
|
+
VIM_MOVEMENT_KEYS: Array[String]
|
|
75
|
+
PUNCTUATION_NAMES: Hash[Symbol, String]
|
|
76
|
+
|
|
77
|
+
def space?: () -> bool
|
|
78
|
+
def cr?: () -> bool
|
|
79
|
+
def letter?: () -> bool
|
|
80
|
+
def digit?: () -> bool
|
|
81
|
+
def alphanumeric?: () -> bool
|
|
82
|
+
def punctuation?: () -> bool
|
|
83
|
+
def whitespace?: () -> bool
|
|
84
|
+
def interrupt?: () -> bool
|
|
85
|
+
def eof?: () -> bool
|
|
86
|
+
def cancel?: () -> bool
|
|
87
|
+
def sigint?: () -> bool
|
|
88
|
+
def suspend?: () -> bool
|
|
89
|
+
def quit?: () -> bool
|
|
90
|
+
def navigation?: () -> bool
|
|
91
|
+
def arrow?: () -> bool
|
|
92
|
+
def vim?: () -> bool
|
|
93
|
+
def vim_left?: () -> bool
|
|
94
|
+
def vim_down?: () -> bool
|
|
95
|
+
def vim_up?: () -> bool
|
|
96
|
+
def vim_right?: () -> bool
|
|
97
|
+
def vim_word_forward?: () -> bool
|
|
98
|
+
def vim_word_backward?: () -> bool
|
|
99
|
+
def vim_top?: () -> bool
|
|
100
|
+
def vim_bottom?: () -> bool
|
|
101
|
+
def quote?: () -> bool
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
include Character
|
|
105
|
+
include Modifier
|
|
106
|
+
include Media
|
|
107
|
+
include Navigation
|
|
108
|
+
include System
|
|
109
|
+
include Dwim
|
|
110
|
+
|
|
111
|
+
attr_reader code: String
|
|
112
|
+
attr_reader modifiers: Array[String]
|
|
113
|
+
attr_reader kind: key_kind
|
|
114
|
+
|
|
115
|
+
def initialize: (code: String, ?modifiers: Array[String], ?kind: key_kind) -> void
|
|
116
|
+
def ==: (untyped other) -> bool
|
|
117
|
+
def to_sym: () -> Symbol
|
|
118
|
+
def to_s: () -> String
|
|
119
|
+
def inspect: () -> String
|
|
120
|
+
def ctrl?: () -> bool
|
|
121
|
+
def alt?: () -> bool
|
|
122
|
+
def shift?: () -> bool
|
|
123
|
+
def text?: () -> bool
|
|
124
|
+
def char: () -> String?
|
|
125
|
+
def media?: () -> bool
|
|
126
|
+
def system?: () -> bool
|
|
127
|
+
def function?: () -> bool
|
|
128
|
+
def modifier?: () -> bool
|
|
129
|
+
def standard?: () -> bool
|
|
130
|
+
def unmodified?: () -> bool
|
|
131
|
+
def method_missing: (Symbol, *untyped, **untyped) ?{ (?) -> untyped } -> untyped
|
|
132
|
+
def respond_to_missing?: (Symbol, *untyped) -> bool
|
|
133
|
+
def deconstruct_keys: (Array[Symbol]?) -> { type: :key, code: String, modifiers: Array[String], kind: key_kind }
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
class Mouse < Event
|
|
137
|
+
attr_reader kind: String
|
|
138
|
+
attr_reader x: Integer
|
|
139
|
+
attr_reader y: Integer
|
|
140
|
+
attr_reader button: String
|
|
141
|
+
attr_reader modifiers: Array[String]
|
|
142
|
+
|
|
143
|
+
def initialize: (kind: String, x: Integer, y: Integer, button: String?, modifiers: Array[String]) -> void
|
|
144
|
+
def down?: () -> bool
|
|
145
|
+
def up?: () -> bool
|
|
146
|
+
def drag?: () -> bool
|
|
147
|
+
def scroll_up?: () -> bool
|
|
148
|
+
def scroll_down?: () -> bool
|
|
149
|
+
def left?: () -> bool
|
|
150
|
+
def right?: () -> bool
|
|
151
|
+
def middle?: () -> bool
|
|
152
|
+
def scroll?: () -> bool
|
|
153
|
+
def moved?: () -> bool
|
|
154
|
+
def hover?: () -> bool
|
|
155
|
+
def hovering?: () -> bool
|
|
156
|
+
def move?: () -> bool
|
|
157
|
+
def primary?: () -> bool
|
|
158
|
+
def secondary?: () -> bool
|
|
159
|
+
def context_menu?: () -> bool
|
|
160
|
+
def aux?: () -> bool
|
|
161
|
+
def auxiliary?: () -> bool
|
|
162
|
+
def wheel_up?: () -> bool
|
|
163
|
+
def wheel_down?: () -> bool
|
|
164
|
+
def release?: () -> bool
|
|
165
|
+
def released?: () -> bool
|
|
166
|
+
def press?: () -> bool
|
|
167
|
+
def pressed?: () -> bool
|
|
168
|
+
def dragging?: () -> bool
|
|
169
|
+
def to_sym: () -> Symbol
|
|
170
|
+
def ==: (top other) -> bool
|
|
171
|
+
def deconstruct_keys: (Array[Symbol]?) -> { type: :mouse, kind: String, x: Integer, y: Integer, button: String, modifiers: Array[String] }
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
class Resize < Event
|
|
175
|
+
attr_reader width: Integer
|
|
176
|
+
attr_reader height: Integer
|
|
177
|
+
|
|
178
|
+
def initialize: (width: Integer, height: Integer) -> void
|
|
179
|
+
def to_sym: () -> Symbol
|
|
180
|
+
def ==: (top other) -> bool
|
|
181
|
+
def deconstruct_keys: (Array[Symbol]?) -> { type: :resize, width: Integer, height: Integer }
|
|
182
|
+
|
|
183
|
+
# DWIM predicates
|
|
184
|
+
VT100_WIDTH: Integer
|
|
185
|
+
VT100_HEIGHT: Integer
|
|
186
|
+
def sigwinch?: () -> bool
|
|
187
|
+
def winch?: () -> bool
|
|
188
|
+
def sig_winch?: () -> bool
|
|
189
|
+
def landscape?: () -> bool
|
|
190
|
+
def portrait?: () -> bool
|
|
191
|
+
def vt100?: () -> bool
|
|
192
|
+
def at_least_vt100?: () -> bool
|
|
193
|
+
def over_vt100?: () -> bool
|
|
194
|
+
def cramped?: () -> bool
|
|
195
|
+
def constrained?: () -> bool
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
class Paste < Event
|
|
199
|
+
attr_reader content: String
|
|
200
|
+
|
|
201
|
+
def initialize: (content: String) -> void
|
|
202
|
+
def deconstruct_keys: (Array[Symbol]?) -> { type: :paste, content: String }
|
|
203
|
+
|
|
204
|
+
# DWIM predicates
|
|
205
|
+
def clipboard?: () -> bool
|
|
206
|
+
def pasteboard?: () -> bool
|
|
207
|
+
def pasted?: () -> bool
|
|
208
|
+
def empty?: () -> bool
|
|
209
|
+
def blank?: () -> bool
|
|
210
|
+
def multiline?: () -> bool
|
|
211
|
+
def multi_line?: () -> bool
|
|
212
|
+
def single_line?: () -> bool
|
|
213
|
+
def singleline?: () -> bool
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
class FocusGained < Event
|
|
217
|
+
def deconstruct_keys: (Array[Symbol]?) -> { type: :focus_gained }
|
|
218
|
+
|
|
219
|
+
# DWIM predicates
|
|
220
|
+
def focus?: () -> bool
|
|
221
|
+
def gained?: () -> bool
|
|
222
|
+
def lost?: () -> bool
|
|
223
|
+
def blur?: () -> bool
|
|
224
|
+
def active?: () -> bool
|
|
225
|
+
def inactive?: () -> bool
|
|
226
|
+
def foreground?: () -> bool
|
|
227
|
+
def background?: () -> bool
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
class FocusLost < Event
|
|
231
|
+
def deconstruct_keys: (Array[Symbol]?) -> { type: :focus_lost }
|
|
232
|
+
|
|
233
|
+
# DWIM predicates
|
|
234
|
+
def focus?: () -> bool
|
|
235
|
+
def gained?: () -> bool
|
|
236
|
+
def lost?: () -> bool
|
|
237
|
+
def blur?: () -> bool
|
|
238
|
+
def active?: () -> bool
|
|
239
|
+
def inactive?: () -> bool
|
|
240
|
+
def foreground?: () -> bool
|
|
241
|
+
def background?: () -> bool
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
class None < Event
|
|
245
|
+
def none?: () -> bool
|
|
246
|
+
def deconstruct_keys: (Array[Symbol]?) -> { type: :none }
|
|
247
|
+
end
|
|
248
|
+
end
|
|
249
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
|
|
5
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
6
|
+
#++
|
|
7
|
+
|
|
8
|
+
module RatatuiRuby
|
|
9
|
+
# Interface for custom widgets that can be passed to Frame#render_widget.
|
|
10
|
+
#
|
|
11
|
+
# Any Ruby object implementing this interface works as a widget.
|
|
12
|
+
# Return an Array of Draw commands describing what to render.
|
|
13
|
+
interface _CustomWidget
|
|
14
|
+
def render: (Layout::Rect area) -> Array[Draw::StringCmd | Draw::CellCmd]
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class Frame
|
|
18
|
+
def area: () -> Layout::Rect
|
|
19
|
+
def render_widget: ((_CustomWidget | widget) widget, Layout::Rect area) -> nil
|
|
20
|
+
def render_stateful_widget: (widget widget, Layout::Rect area, (ListState | TableState | ScrollbarState) state) -> nil
|
|
21
|
+
def set_cursor_position: (Integer x, Integer y) -> nil
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
|
|
5
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
6
|
+
#++
|
|
7
|
+
|
|
8
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
9
|
+
|
|
10
|
+
# Duck-typing interfaces for RatatuiRuby.
|
|
11
|
+
#
|
|
12
|
+
# These interfaces enable type-safe duck typing: any object responding to
|
|
13
|
+
# the specified methods can be used, not just the canonical types.
|
|
14
|
+
module RatatuiRuby
|
|
15
|
+
# Interface for Rect-like objects.
|
|
16
|
+
#
|
|
17
|
+
# Any object responding to x, y, width, and height with Integer returns
|
|
18
|
+
# can be used where Layout::Rect is expected.
|
|
19
|
+
interface _RectLike
|
|
20
|
+
def x: () -> Integer
|
|
21
|
+
def y: () -> Integer
|
|
22
|
+
def width: () -> Integer
|
|
23
|
+
def height: () -> Integer
|
|
24
|
+
end
|
|
25
|
+
end
|