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
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
|
|
2
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
module RatatuiRuby
|
|
5
|
+
module Widgets
|
|
6
|
+
# Mixin that provides DWIM hash coercion for widget classes.
|
|
7
|
+
#
|
|
8
|
+
# When users call `tui.table(hash)` instead of `tui.table(**hash)`,
|
|
9
|
+
# this mixin detects the bare hash and automatically splats it.
|
|
10
|
+
#
|
|
11
|
+
# This module is designed to be included in Data subclasses.
|
|
12
|
+
# The coerce_args method is typed per-widget rather than generically
|
|
13
|
+
# here because RBS cannot express "self.new" in module ClassMethods.
|
|
14
|
+
module CoerceableWidget
|
|
15
|
+
KNOWN_KEYS: Array[Symbol]
|
|
16
|
+
|
|
17
|
+
# Class methods extended onto widget classes.
|
|
18
|
+
# Each widget class provides its own typed coerce_args signature.
|
|
19
|
+
module ClassMethods
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Called when the module is included; extends ClassMethods.
|
|
23
|
+
def self.included: (Class base) -> void
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
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
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
9
|
+
|
|
10
|
+
module RatatuiRuby
|
|
11
|
+
module Widgets
|
|
12
|
+
# Options hash type for Gauge constructor arguments.
|
|
13
|
+
type gauge_options = {
|
|
14
|
+
?ratio: _ToF?,
|
|
15
|
+
?percent: _ToF?,
|
|
16
|
+
?label: String | Text::Span | nil,
|
|
17
|
+
?style: Style::Style?,
|
|
18
|
+
?gauge_style: Style::Style?,
|
|
19
|
+
?block: Widgets::Block?,
|
|
20
|
+
?use_unicode: bool
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
class Gauge < Data
|
|
24
|
+
attr_reader ratio: Float
|
|
25
|
+
attr_reader label: (String | Text::Span)?
|
|
26
|
+
attr_reader style: Style::Style?
|
|
27
|
+
attr_reader gauge_style: Style::Style?
|
|
28
|
+
attr_reader block: Widgets::Block?
|
|
29
|
+
attr_reader use_unicode: bool
|
|
30
|
+
|
|
31
|
+
include CoerceableWidget
|
|
32
|
+
|
|
33
|
+
def self.coerce_args: (gauge_options first, ?gauge_options kwargs) -> Gauge
|
|
34
|
+
| (nil first, gauge_options kwargs) -> Gauge
|
|
35
|
+
|
|
36
|
+
def self.new: (?ratio: _ToF?, ?percent: _ToF?, ?label: String | Text::Span | nil, ?style: Style::Style?, ?gauge_style: Style::Style?, ?block: Widgets::Block?, ?use_unicode: bool) -> Gauge
|
|
37
|
+
def initialize: (?ratio: _ToF?, ?percent: _ToF?, ?label: String | Text::Span | nil, ?style: Style::Style?, ?gauge_style: Style::Style?, ?block: Widgets::Block?, ?use_unicode: bool) -> void
|
|
38
|
+
|
|
39
|
+
def filled?: () -> bool
|
|
40
|
+
def complete?: () -> bool
|
|
41
|
+
def percent: () -> Integer
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
module Widgets
|
|
12
|
+
# Options hash type for LineGauge constructor arguments.
|
|
13
|
+
type line_gauge_options = {
|
|
14
|
+
?ratio: _ToF?,
|
|
15
|
+
?percent: _ToF?,
|
|
16
|
+
?label: String | Text::Span | nil,
|
|
17
|
+
?style: Style::Style?,
|
|
18
|
+
?filled_style: Style::Style?,
|
|
19
|
+
?unfilled_style: Style::Style?,
|
|
20
|
+
?block: Widgets::Block?,
|
|
21
|
+
?filled_symbol: String,
|
|
22
|
+
?unfilled_symbol: String
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
class LineGauge < Data
|
|
26
|
+
attr_reader ratio: Float
|
|
27
|
+
attr_reader label: (String | Text::Span)?
|
|
28
|
+
attr_reader style: Style::Style?
|
|
29
|
+
attr_reader filled_style: Style::Style?
|
|
30
|
+
attr_reader unfilled_style: Style::Style?
|
|
31
|
+
attr_reader block: Widgets::Block?
|
|
32
|
+
attr_reader filled_symbol: String
|
|
33
|
+
attr_reader unfilled_symbol: String
|
|
34
|
+
|
|
35
|
+
include CoerceableWidget
|
|
36
|
+
|
|
37
|
+
def self.coerce_args: (line_gauge_options first, ?line_gauge_options kwargs) -> LineGauge
|
|
38
|
+
| (nil first, line_gauge_options kwargs) -> LineGauge
|
|
39
|
+
|
|
40
|
+
def self.new: (?ratio: _ToF?, ?percent: _ToF?, ?label: String | Text::Span | nil, ?style: Style::Style?, ?filled_style: Style::Style?, ?unfilled_style: Style::Style?, ?block: Widgets::Block?, ?filled_symbol: String, ?unfilled_symbol: String) -> LineGauge
|
|
41
|
+
def initialize: (?ratio: _ToF?, ?percent: _ToF?, ?label: String | Text::Span | nil, ?style: Style::Style?, ?filled_style: Style::Style?, ?unfilled_style: Style::Style?, ?block: Widgets::Block?, ?filled_symbol: String, ?unfilled_symbol: String) -> void
|
|
42
|
+
|
|
43
|
+
def filled?: () -> bool
|
|
44
|
+
def complete?: () -> bool
|
|
45
|
+
def percent: () -> Integer
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
module Widgets
|
|
12
|
+
# Options hash type for List constructor arguments.
|
|
13
|
+
type list_options = {
|
|
14
|
+
?items: Array[String | Text::Span | Text::Line | ListItem],
|
|
15
|
+
?selected_index: _ToI?,
|
|
16
|
+
?offset: _ToI?,
|
|
17
|
+
?style: Style::Style?,
|
|
18
|
+
?highlight_style: Style::Style?,
|
|
19
|
+
?highlight_symbol: String?,
|
|
20
|
+
?repeat_highlight_symbol: bool,
|
|
21
|
+
?highlight_spacing: Symbol,
|
|
22
|
+
?direction: Symbol,
|
|
23
|
+
?scroll_padding: _ToI?,
|
|
24
|
+
?block: Widgets::Block?
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
class List < Data
|
|
28
|
+
HIGHLIGHT_ALWAYS: Symbol
|
|
29
|
+
HIGHLIGHT_WHEN_SELECTED: Symbol
|
|
30
|
+
HIGHLIGHT_NEVER: Symbol
|
|
31
|
+
DIRECTION_TOP_TO_BOTTOM: Symbol
|
|
32
|
+
DIRECTION_BOTTOM_TO_TOP: Symbol
|
|
33
|
+
|
|
34
|
+
attr_reader items: Array[String | Text::Span | Text::Line | ListItem]
|
|
35
|
+
attr_reader selected_index: Integer?
|
|
36
|
+
attr_reader offset: Integer?
|
|
37
|
+
attr_reader style: Style::Style?
|
|
38
|
+
attr_reader highlight_style: Style::Style?
|
|
39
|
+
attr_reader highlight_symbol: String?
|
|
40
|
+
attr_reader repeat_highlight_symbol: bool
|
|
41
|
+
attr_reader highlight_spacing: Symbol
|
|
42
|
+
attr_reader direction: Symbol
|
|
43
|
+
attr_reader scroll_padding: Integer?
|
|
44
|
+
attr_reader block: Widgets::Block?
|
|
45
|
+
|
|
46
|
+
include CoerceableWidget
|
|
47
|
+
|
|
48
|
+
def self.coerce_args: (list_options first, ?list_options kwargs) -> List
|
|
49
|
+
| (nil first, list_options kwargs) -> List
|
|
50
|
+
|
|
51
|
+
def self.new: (?items: Array[String | Text::Span | Text::Line | ListItem], ?selected_index: _ToI?, ?offset: _ToI?, ?style: Style::Style?, ?highlight_style: Style::Style?, ?highlight_symbol: String?, ?repeat_highlight_symbol: bool, ?highlight_spacing: Symbol, ?direction: Symbol, ?scroll_padding: _ToI?, ?block: Widgets::Block?) -> List
|
|
52
|
+
def initialize: (?items: Array[String | Text::Span | Text::Line | ListItem], ?selected_index: _ToI?, ?offset: _ToI?, ?style: Style::Style?, ?highlight_style: Style::Style?, ?highlight_symbol: String?, ?repeat_highlight_symbol: bool, ?highlight_spacing: Symbol, ?direction: Symbol, ?scroll_padding: _ToI?, ?block: Widgets::Block?) -> void
|
|
53
|
+
|
|
54
|
+
def selected?: () -> bool
|
|
55
|
+
def empty?: () -> bool
|
|
56
|
+
def len: () -> Integer
|
|
57
|
+
alias length len
|
|
58
|
+
alias size len
|
|
59
|
+
# NOTE: No 'selection' alias - use selected_index or selected_item
|
|
60
|
+
def selected_item: () -> (String | Text::Span | Text::Line | ListItem)?
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -0,0 +1,158 @@
|
|
|
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
|
+
module Widgets
|
|
12
|
+
# Options hash type for Cell constructor arguments.
|
|
13
|
+
type cell_options = {
|
|
14
|
+
?content: String | Text::Span | Text::Line | Paragraph,
|
|
15
|
+
?style: Style::Style?
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
# Options hash type for Center constructor arguments.
|
|
19
|
+
type center_options = {
|
|
20
|
+
?child: widget,
|
|
21
|
+
?width_percent: _ToF,
|
|
22
|
+
?height_percent: _ToF
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
# Options hash type for Cursor constructor arguments.
|
|
26
|
+
type cursor_options = {
|
|
27
|
+
?x: _ToI,
|
|
28
|
+
?y: _ToI
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# NOTE: line_gauge_options and LineGauge are now defined in line_gauge.rbs
|
|
32
|
+
|
|
33
|
+
# Options hash type for ListItem constructor arguments.
|
|
34
|
+
type list_item_options = {
|
|
35
|
+
?content: String | Text::Span | Text::Line,
|
|
36
|
+
?style: Style::Style?
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
# Options hash type for Overlay constructor arguments.
|
|
40
|
+
type overlay_options = {
|
|
41
|
+
?layers: Array[widget]
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
# Options hash type for Clear constructor arguments.
|
|
45
|
+
type clear_options = {
|
|
46
|
+
?block: Widgets::Block?
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
# Options hash type for RatatuiLogo constructor arguments (empty).
|
|
50
|
+
type ratatui_logo_options = { }
|
|
51
|
+
|
|
52
|
+
# Options hash type for RatatuiMascot constructor arguments.
|
|
53
|
+
type ratatui_mascot_options = {
|
|
54
|
+
?block: Widgets::Block?
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
class Cell < Data
|
|
58
|
+
attr_reader content: String | Text::Span | Text::Line | Paragraph
|
|
59
|
+
attr_reader style: Style::Style?
|
|
60
|
+
|
|
61
|
+
include CoerceableWidget
|
|
62
|
+
|
|
63
|
+
def self.coerce_args: (cell_options first, ?cell_options kwargs) -> Cell
|
|
64
|
+
| (nil first, cell_options kwargs) -> Cell
|
|
65
|
+
|
|
66
|
+
def self.new: (content: String | Text::Span | Text::Line | Paragraph, ?style: Style::Style?) -> Cell
|
|
67
|
+
def initialize: (content: String | Text::Span | Text::Line | Paragraph, ?style: Style::Style?) -> void
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
class Center < Data
|
|
71
|
+
attr_reader child: widget
|
|
72
|
+
attr_reader width_percent: Float
|
|
73
|
+
attr_reader height_percent: Float
|
|
74
|
+
|
|
75
|
+
include CoerceableWidget
|
|
76
|
+
|
|
77
|
+
def self.coerce_args: (center_options first, ?center_options kwargs) -> Center
|
|
78
|
+
| (nil first, center_options kwargs) -> Center
|
|
79
|
+
|
|
80
|
+
def self.new: (child: widget, ?width_percent: _ToF, ?height_percent: _ToF) -> Center
|
|
81
|
+
def initialize: (child: widget, ?width_percent: _ToF, ?height_percent: _ToF) -> void
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
class Cursor < Data
|
|
85
|
+
attr_reader x: Integer
|
|
86
|
+
attr_reader y: Integer
|
|
87
|
+
|
|
88
|
+
include CoerceableWidget
|
|
89
|
+
|
|
90
|
+
def self.coerce_args: (cursor_options first, ?cursor_options kwargs) -> Cursor
|
|
91
|
+
| (nil first, cursor_options kwargs) -> Cursor
|
|
92
|
+
|
|
93
|
+
def self.new: (x: _ToI, y: _ToI) -> Cursor
|
|
94
|
+
def initialize: (x: _ToI, y: _ToI) -> void
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# NOTE: LineGauge is now defined in line_gauge.rbs
|
|
98
|
+
|
|
99
|
+
class ListItem < Data
|
|
100
|
+
attr_reader content: String | Text::Span | Text::Line
|
|
101
|
+
attr_reader style: Style::Style?
|
|
102
|
+
|
|
103
|
+
include CoerceableWidget
|
|
104
|
+
|
|
105
|
+
def self.coerce_args: (list_item_options first, ?list_item_options kwargs) -> ListItem
|
|
106
|
+
| (nil first, list_item_options kwargs) -> ListItem
|
|
107
|
+
|
|
108
|
+
def self.new: (content: String | Text::Span | Text::Line, ?style: Style::Style?) -> ListItem
|
|
109
|
+
def initialize: (content: String | Text::Span | Text::Line, ?style: Style::Style?) -> void
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
class Overlay < Data
|
|
113
|
+
attr_reader layers: Array[widget]
|
|
114
|
+
|
|
115
|
+
include CoerceableWidget
|
|
116
|
+
|
|
117
|
+
def self.coerce_args: (overlay_options first, ?overlay_options kwargs) -> Overlay
|
|
118
|
+
| (nil first, overlay_options kwargs) -> Overlay
|
|
119
|
+
|
|
120
|
+
def self.new: (?layers: Array[widget]) -> Overlay
|
|
121
|
+
def initialize: (?layers: Array[widget]) -> void
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
class Clear < Data
|
|
125
|
+
attr_reader block: Widgets::Block?
|
|
126
|
+
|
|
127
|
+
include CoerceableWidget
|
|
128
|
+
|
|
129
|
+
def self.coerce_args: (clear_options first, ?clear_options kwargs) -> Clear
|
|
130
|
+
| (nil first, clear_options kwargs) -> Clear
|
|
131
|
+
|
|
132
|
+
def self.new: (?block: Widgets::Block?) -> Clear
|
|
133
|
+
def initialize: (?block: Widgets::Block?) -> void
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
class RatatuiLogo < Data
|
|
137
|
+
include CoerceableWidget
|
|
138
|
+
|
|
139
|
+
def self.coerce_args: (ratatui_logo_options first, ?ratatui_logo_options kwargs) -> RatatuiLogo
|
|
140
|
+
| (nil first, ratatui_logo_options kwargs) -> RatatuiLogo
|
|
141
|
+
|
|
142
|
+
def self.new: () -> RatatuiLogo
|
|
143
|
+
def initialize: () -> void
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
class RatatuiMascot < Data
|
|
147
|
+
attr_reader block: Widgets::Block?
|
|
148
|
+
|
|
149
|
+
include CoerceableWidget
|
|
150
|
+
|
|
151
|
+
def self.coerce_args: (ratatui_mascot_options first, ?ratatui_mascot_options kwargs) -> RatatuiMascot
|
|
152
|
+
| (nil first, ratatui_mascot_options kwargs) -> RatatuiMascot
|
|
153
|
+
|
|
154
|
+
def self.new: (?block: Widgets::Block?) -> RatatuiMascot
|
|
155
|
+
def initialize: (?block: Widgets::Block?) -> void
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
module Widgets
|
|
12
|
+
# Options hash type for Paragraph constructor arguments.
|
|
13
|
+
type paragraph_options = {
|
|
14
|
+
?text: String,
|
|
15
|
+
?style: Style::Style?,
|
|
16
|
+
?fg: (String | Symbol)?,
|
|
17
|
+
?bg: (String | Symbol)?,
|
|
18
|
+
?block: Widgets::Block?,
|
|
19
|
+
?wrap: bool,
|
|
20
|
+
?alignment: Symbol,
|
|
21
|
+
?scroll: [_ToI, _ToI]
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
class Paragraph < Data
|
|
25
|
+
attr_reader text: String
|
|
26
|
+
attr_reader style: Style::Style?
|
|
27
|
+
attr_reader block: Widgets::Block?
|
|
28
|
+
attr_reader wrap: bool
|
|
29
|
+
attr_reader alignment: Symbol
|
|
30
|
+
attr_reader scroll: [Integer, Integer]
|
|
31
|
+
|
|
32
|
+
include CoerceableWidget
|
|
33
|
+
|
|
34
|
+
def self.coerce_args: (paragraph_options first, ?paragraph_options kwargs) -> Paragraph
|
|
35
|
+
| (nil first, paragraph_options kwargs) -> Paragraph
|
|
36
|
+
|
|
37
|
+
# Legacy constructor with fg/bg convenience params
|
|
38
|
+
def self.new: (text: String, ?style: Style::Style?, ?fg: (String | Symbol)?, ?bg: (String | Symbol)?, ?block: Widgets::Block?, ?wrap: bool, ?alignment: Symbol, ?scroll: [_ToI, _ToI]) -> Paragraph
|
|
39
|
+
# Instance initialize
|
|
40
|
+
def initialize: (?text: String, ?style: Style::Style?, ?block: Widgets::Block?, ?wrap: bool, ?alignment: Symbol, ?scroll: Array[Integer]) -> void
|
|
41
|
+
def line_count: (Integer width) -> Integer
|
|
42
|
+
def line_width: () -> Integer
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
module Widgets
|
|
12
|
+
# Options hash type for Row constructor arguments.
|
|
13
|
+
type row_options = {
|
|
14
|
+
?cells: Array[Row::cell_content],
|
|
15
|
+
?style: Style::Style?,
|
|
16
|
+
?height: Integer?,
|
|
17
|
+
?top_margin: Integer?,
|
|
18
|
+
?bottom_margin: Integer?
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
class Row < Data
|
|
22
|
+
type cell_content = String | Text::Span | Text::Line | Paragraph | Cell
|
|
23
|
+
|
|
24
|
+
attr_reader cells: Array[cell_content]
|
|
25
|
+
attr_reader style: Style::Style?
|
|
26
|
+
attr_reader height: Integer?
|
|
27
|
+
attr_reader top_margin: Integer?
|
|
28
|
+
attr_reader bottom_margin: Integer?
|
|
29
|
+
|
|
30
|
+
include CoerceableWidget
|
|
31
|
+
|
|
32
|
+
def self.coerce_args: (row_options first, ?row_options kwargs) -> Row
|
|
33
|
+
| (nil first, row_options kwargs) -> Row
|
|
34
|
+
|
|
35
|
+
def self.new: (cells: Array[cell_content], ?style: Style::Style?, ?height: Integer?, ?top_margin: Integer?, ?bottom_margin: Integer?) -> Row
|
|
36
|
+
def initialize: (cells: Array[cell_content], ?style: Style::Style?, ?height: Integer?, ?top_margin: Integer?, ?bottom_margin: Integer?) -> void
|
|
37
|
+
|
|
38
|
+
# Returns a new Row with strikethrough styling enabled.
|
|
39
|
+
def enable_strikethrough: () -> Row
|
|
40
|
+
alias strikethrough enable_strikethrough
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
module Widgets
|
|
12
|
+
# Options hash type for Scrollbar constructor arguments.
|
|
13
|
+
type scrollbar_options = {
|
|
14
|
+
?content_length: _ToI,
|
|
15
|
+
?position: _ToI,
|
|
16
|
+
?orientation: Symbol,
|
|
17
|
+
?thumb_symbol: String,
|
|
18
|
+
?thumb_style: Style::Style?,
|
|
19
|
+
?track_symbol: String?,
|
|
20
|
+
?track_style: Style::Style?,
|
|
21
|
+
?begin_symbol: String?,
|
|
22
|
+
?begin_style: Style::Style?,
|
|
23
|
+
?end_symbol: String?,
|
|
24
|
+
?end_style: Style::Style?,
|
|
25
|
+
?style: Style::Style?,
|
|
26
|
+
?block: Widgets::Block?
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
class Scrollbar < Data
|
|
30
|
+
attr_reader content_length: Integer
|
|
31
|
+
attr_reader position: Integer
|
|
32
|
+
attr_reader orientation: Symbol
|
|
33
|
+
attr_reader thumb_symbol: String
|
|
34
|
+
attr_reader thumb_style: Style::Style?
|
|
35
|
+
attr_reader track_symbol: String?
|
|
36
|
+
attr_reader track_style: Style::Style?
|
|
37
|
+
attr_reader begin_symbol: String?
|
|
38
|
+
attr_reader begin_style: Style::Style?
|
|
39
|
+
attr_reader end_symbol: String?
|
|
40
|
+
attr_reader end_style: Style::Style?
|
|
41
|
+
attr_reader style: Style::Style?
|
|
42
|
+
attr_reader block: Widgets::Block?
|
|
43
|
+
|
|
44
|
+
include CoerceableWidget
|
|
45
|
+
|
|
46
|
+
def self.coerce_args: (scrollbar_options first, ?scrollbar_options kwargs) -> Scrollbar
|
|
47
|
+
| (nil first, scrollbar_options kwargs) -> Scrollbar
|
|
48
|
+
|
|
49
|
+
def self.new: (content_length: _ToI, position: _ToI, ?orientation: Symbol, ?thumb_symbol: String, ?thumb_style: Style::Style?, ?track_symbol: String?, ?track_style: Style::Style?, ?begin_symbol: String?, ?begin_style: Style::Style?, ?end_symbol: String?, ?end_style: Style::Style?, ?style: Style::Style?, ?block: Widgets::Block?) -> Scrollbar
|
|
50
|
+
def initialize: (content_length: _ToI, position: _ToI, ?orientation: Symbol, ?thumb_symbol: String, ?thumb_style: Style::Style?, ?track_symbol: String?, ?track_style: Style::Style?, ?begin_symbol: String?, ?begin_style: Style::Style?, ?end_symbol: String?, ?end_style: Style::Style?, ?style: Style::Style?, ?block: Widgets::Block?) -> void
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
module Widgets
|
|
12
|
+
module Shape
|
|
13
|
+
# Options hash type for Shape::Label constructor arguments.
|
|
14
|
+
type label_options = {
|
|
15
|
+
?x: _ToF,
|
|
16
|
+
?y: _ToF,
|
|
17
|
+
?text: String | Text::Line,
|
|
18
|
+
?style: Style::Style?
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
class Label < Data
|
|
22
|
+
attr_reader x: Float
|
|
23
|
+
attr_reader y: Float
|
|
24
|
+
attr_reader text: String | Text::Line
|
|
25
|
+
attr_reader style: Style::Style?
|
|
26
|
+
|
|
27
|
+
include CoerceableWidget
|
|
28
|
+
|
|
29
|
+
def self.coerce_args: (label_options first, ?label_options kwargs) -> Label
|
|
30
|
+
| (nil first, label_options kwargs) -> Label
|
|
31
|
+
|
|
32
|
+
def self.new: (x: _ToF, y: _ToF, text: String | Text::Line, ?style: Style::Style?) -> Label
|
|
33
|
+
def initialize: (x: _ToF, y: _ToF, text: String | Text::Line, ?style: Style::Style?) -> void
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
module Widgets
|
|
12
|
+
# Options hash type for Sparkline constructor arguments.
|
|
13
|
+
type sparkline_options = {
|
|
14
|
+
?data: Array[_ToI?],
|
|
15
|
+
?max: _ToI?,
|
|
16
|
+
?style: Style::Style?,
|
|
17
|
+
?block: Widgets::Block?,
|
|
18
|
+
?direction: (:left_to_right | :right_to_left)?,
|
|
19
|
+
?absent_value_symbol: String?,
|
|
20
|
+
?absent_value_style: Style::Style?,
|
|
21
|
+
?bar_set: Hash[Symbol, String]?
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
class Sparkline < Data
|
|
25
|
+
BAR_KEYS: Array[Symbol]
|
|
26
|
+
|
|
27
|
+
attr_reader data: Array[Integer?]
|
|
28
|
+
attr_reader max: Integer?
|
|
29
|
+
attr_reader style: Style::Style?
|
|
30
|
+
attr_reader block: Widgets::Block?
|
|
31
|
+
attr_reader direction: (:left_to_right | :right_to_left)?
|
|
32
|
+
attr_reader absent_value_symbol: String?
|
|
33
|
+
attr_reader absent_value_style: Style::Style?
|
|
34
|
+
attr_reader bar_set: Hash[Symbol, String]?
|
|
35
|
+
|
|
36
|
+
include CoerceableWidget
|
|
37
|
+
|
|
38
|
+
def self.coerce_args: (sparkline_options first, ?sparkline_options kwargs) -> Sparkline
|
|
39
|
+
| (nil first, sparkline_options kwargs) -> Sparkline
|
|
40
|
+
|
|
41
|
+
def self.new: (data: Array[_ToI?], ?max: _ToI?, ?style: Style::Style?, ?block: Widgets::Block?, ?direction: (:left_to_right | :right_to_left)?, ?absent_value_symbol: String?, ?absent_value_style: Style::Style?, ?bar_set: Hash[Symbol, String]?) -> Sparkline
|
|
42
|
+
def initialize: (data: Array[_ToI?], ?max: _ToI?, ?style: Style::Style?, ?block: Widgets::Block?, ?direction: (:left_to_right | :right_to_left)?, ?absent_value_symbol: String?, ?absent_value_style: Style::Style?, ?bar_set: Hash[Symbol, String]?) -> void
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
module Widgets
|
|
12
|
+
# Options hash type for Table constructor arguments.
|
|
13
|
+
# Used by coerce_args for DWIM bare-hash acceptance.
|
|
14
|
+
type table_options = {
|
|
15
|
+
?header: Array[String | Paragraph]?,
|
|
16
|
+
?rows: Array[Array[String | Paragraph | Style::Style | _ToS]],
|
|
17
|
+
?widths: Array[Layout::Constraint | Integer],
|
|
18
|
+
?row_highlight_style: Style::Style?,
|
|
19
|
+
?highlight_symbol: String?,
|
|
20
|
+
?highlight_spacing: Symbol,
|
|
21
|
+
?column_highlight_style: Style::Style?,
|
|
22
|
+
?cell_highlight_style: Style::Style?,
|
|
23
|
+
?selected_row: _ToI?,
|
|
24
|
+
?selected_column: _ToI?,
|
|
25
|
+
?offset: _ToI?,
|
|
26
|
+
?block: Widgets::Block?,
|
|
27
|
+
?footer: Array[String | Paragraph]?,
|
|
28
|
+
?flex: Symbol,
|
|
29
|
+
?style: style_input?,
|
|
30
|
+
?column_spacing: _ToI
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
class Table < Data
|
|
34
|
+
HIGHLIGHT_ALWAYS: Symbol
|
|
35
|
+
HIGHLIGHT_WHEN_SELECTED: Symbol
|
|
36
|
+
HIGHLIGHT_NEVER: Symbol
|
|
37
|
+
FLEX_LEGACY: Symbol
|
|
38
|
+
FLEX_START: Symbol
|
|
39
|
+
FLEX_CENTER: Symbol
|
|
40
|
+
FLEX_END: Symbol
|
|
41
|
+
FLEX_SPACE_BETWEEN: Symbol
|
|
42
|
+
FLEX_SPACE_AROUND: Symbol
|
|
43
|
+
FLEX_SPACE_EVENLY: Symbol
|
|
44
|
+
|
|
45
|
+
attr_reader header: Array[String | Paragraph]?
|
|
46
|
+
attr_reader rows: Array[Array[String | Paragraph | Style::Style | _ToS]]
|
|
47
|
+
attr_reader widths: Array[Layout::Constraint]
|
|
48
|
+
attr_reader block: Widgets::Block?
|
|
49
|
+
attr_reader footer: Array[String | Paragraph]?
|
|
50
|
+
attr_reader flex: Symbol
|
|
51
|
+
attr_reader style: style_input?
|
|
52
|
+
attr_reader column_spacing: Integer?
|
|
53
|
+
attr_reader highlight_spacing: Symbol
|
|
54
|
+
attr_reader column_highlight_style: Style::Style?
|
|
55
|
+
attr_reader selected_column: Integer?
|
|
56
|
+
attr_reader offset: Integer?
|
|
57
|
+
attr_reader row_highlight_style: Style::Style?
|
|
58
|
+
attr_reader highlight_symbol: String?
|
|
59
|
+
attr_reader cell_highlight_style: Style::Style?
|
|
60
|
+
attr_reader selected_row: Integer?
|
|
61
|
+
|
|
62
|
+
include CoerceableWidget
|
|
63
|
+
|
|
64
|
+
# DWIM hash coercion: accepts bare Hash (first arg) or keyword arguments.
|
|
65
|
+
def self.coerce_args: (table_options first, ?table_options kwargs) -> Table
|
|
66
|
+
| (nil first, table_options kwargs) -> Table
|
|
67
|
+
|
|
68
|
+
def self.new: (?header: Array[String | Paragraph]?, ?rows: Array[Array[String | Paragraph | Style::Style | _ToS]], ?widths: Array[Layout::Constraint | Integer], ?row_highlight_style: Style::Style?, ?highlight_symbol: String?, ?highlight_spacing: Symbol, ?column_highlight_style: Style::Style?, ?cell_highlight_style: Style::Style?, ?selected_row: _ToI?, ?selected_column: _ToI?, ?offset: _ToI?, ?block: Widgets::Block?, ?footer: Array[String | Paragraph]?, ?flex: Symbol, ?style: style_input?, ?column_spacing: _ToI) -> Table
|
|
69
|
+
def initialize: (?header: Array[String | Paragraph]?, ?rows: Array[Array[String | Paragraph | Style::Style | _ToS]], ?widths: Array[Layout::Constraint | Integer], ?row_highlight_style: Style::Style?, ?highlight_symbol: String?, ?highlight_spacing: Symbol, ?column_highlight_style: Style::Style?, ?cell_highlight_style: Style::Style?, ?selected_row: _ToI?, ?selected_column: _ToI?, ?offset: _ToI?, ?block: Widgets::Block?, ?footer: Array[String | Paragraph]?, ?flex: Symbol, ?style: style_input?, ?column_spacing: _ToI) -> void
|
|
70
|
+
|
|
71
|
+
def row_selected?: () -> bool
|
|
72
|
+
def column_selected?: () -> bool
|
|
73
|
+
def cell_selected?: () -> bool
|
|
74
|
+
def empty?: () -> bool
|
|
75
|
+
# NOTE: No 'selection' alias - use selected_row or selected_column
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|