ratatui_ruby-tea 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AGENTS.md +51 -7
- data/CHANGELOG.md +109 -0
- data/README.md +25 -5
- data/Rakefile +1 -1
- data/Steepfile +3 -3
- data/doc/concepts/async_work.md +164 -0
- data/doc/concepts/commands.md +528 -0
- data/doc/concepts/message_processing.md +51 -0
- data/doc/contributors/WIP/decomposition_strategies_analysis.md +258 -0
- data/doc/contributors/WIP/implementation_plan.md +405 -0
- data/doc/contributors/WIP/init_callable_proposal.md +341 -0
- data/doc/contributors/WIP/mvu_tea_implementations_research.md +372 -0
- data/doc/contributors/WIP/runtime_refactoring_status.md +47 -0
- data/doc/contributors/WIP/task.md +36 -0
- data/doc/contributors/WIP/v0.4.0_todo.md +468 -0
- data/doc/contributors/design/commands_and_outlets.md +214 -0
- data/doc/contributors/kit-no-outlet.md +237 -0
- data/doc/contributors/priorities.md +22 -24
- data/examples/app_fractal_dashboard/app.rb +3 -7
- data/examples/app_fractal_dashboard/dashboard/base.rb +15 -16
- data/examples/app_fractal_dashboard/dashboard/update_helpers.rb +8 -8
- data/examples/app_fractal_dashboard/dashboard/update_manual.rb +11 -11
- data/examples/app_fractal_dashboard/dashboard/update_router.rb +4 -4
- data/examples/app_fractal_dashboard/{bags → fragments}/custom_shell_input.rb +8 -4
- data/examples/app_fractal_dashboard/fragments/custom_shell_modal.rb +82 -0
- data/examples/app_fractal_dashboard/{bags → fragments}/custom_shell_output.rb +8 -4
- data/examples/app_fractal_dashboard/{bags → fragments}/disk_usage.rb +13 -10
- data/examples/app_fractal_dashboard/{bags → fragments}/network_panel.rb +12 -12
- data/examples/app_fractal_dashboard/{bags → fragments}/ping.rb +12 -8
- data/examples/app_fractal_dashboard/{bags → fragments}/stats_panel.rb +12 -12
- data/examples/app_fractal_dashboard/{bags → fragments}/system_info.rb +11 -7
- data/examples/app_fractal_dashboard/{bags → fragments}/uptime.rb +11 -7
- data/examples/verify_readme_usage/README.md +7 -4
- data/examples/verify_readme_usage/app.rb +7 -4
- data/lib/ratatui_ruby/tea/command/all.rb +71 -0
- data/lib/ratatui_ruby/tea/command/batch.rb +79 -0
- data/lib/ratatui_ruby/tea/command/custom.rb +106 -0
- data/lib/ratatui_ruby/tea/command/http.rb +194 -0
- data/lib/ratatui_ruby/tea/command/lifecycle.rb +136 -0
- data/lib/ratatui_ruby/tea/command/outlet.rb +159 -0
- data/lib/ratatui_ruby/tea/command/wait.rb +82 -0
- data/lib/ratatui_ruby/tea/command.rb +416 -13
- data/lib/ratatui_ruby/tea/message/all.rb +47 -0
- data/lib/ratatui_ruby/tea/message/http_response.rb +63 -0
- data/lib/ratatui_ruby/tea/message/system/batch.rb +63 -0
- data/lib/ratatui_ruby/tea/message/system/stream.rb +69 -0
- data/lib/ratatui_ruby/tea/message/timer.rb +48 -0
- data/lib/ratatui_ruby/tea/message.rb +40 -0
- data/lib/ratatui_ruby/tea/router.rb +155 -87
- data/lib/ratatui_ruby/tea/runtime.rb +329 -150
- data/lib/ratatui_ruby/tea/shortcuts.rb +2 -2
- data/lib/ratatui_ruby/tea/test_helper.rb +58 -0
- data/lib/ratatui_ruby/tea/version.rb +1 -1
- data/lib/ratatui_ruby/tea.rb +44 -10
- data/rbs_collection.lock.yaml +108 -0
- data/rbs_collection.yaml +15 -0
- data/sig/concurrent.rbs +72 -0
- data/sig/examples/verify_readme_usage/app.rbs +1 -1
- data/sig/examples/widget_command_system/app.rbs +1 -1
- data/sig/open3.rbs +17 -0
- data/sig/ratatui_ruby/tea/command.rbs +226 -6
- data/sig/ratatui_ruby/tea/message.rbs +123 -0
- data/sig/ratatui_ruby/tea/router.rbs +110 -54
- data/sig/ratatui_ruby/tea/runtime.rbs +63 -12
- data/sig/ratatui_ruby/tea/shortcuts.rbs +18 -0
- data/sig/ratatui_ruby/tea/test_helper.rbs +12 -0
- data/sig/ratatui_ruby/tea/version.rbs +10 -0
- data/sig/ratatui_ruby/tea.rbs +39 -7
- data/tasks/steep.rake +11 -0
- metadata +75 -12
- data/examples/app_fractal_dashboard/bags/custom_shell_modal.rb +0 -73
|
@@ -1,73 +0,0 @@
|
|
|
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
|
-
require_relative "custom_shell_input"
|
|
9
|
-
require_relative "custom_shell_output"
|
|
10
|
-
|
|
11
|
-
# Parent coordinator bag for custom shell modal.
|
|
12
|
-
#
|
|
13
|
-
# Routes to active child (input or output). Checks child model state for transitions.
|
|
14
|
-
module CustomShellModal
|
|
15
|
-
Command = RatatuiRuby::Tea::Command
|
|
16
|
-
|
|
17
|
-
Model = Data.define(:mode, :input, :output)
|
|
18
|
-
INITIAL = Ractor.make_shareable(Model.new(mode: :none, input: CustomShellInput::INITIAL, output: CustomShellOutput::INITIAL))
|
|
19
|
-
|
|
20
|
-
VIEW = lambda do |model, tui|
|
|
21
|
-
case model.mode
|
|
22
|
-
when :none then nil
|
|
23
|
-
when :input then CustomShellInput::VIEW.call(model.input, tui)
|
|
24
|
-
when :output then CustomShellOutput::VIEW.call(model.output, tui)
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
UPDATE = lambda do |message, model|
|
|
29
|
-
case model.mode
|
|
30
|
-
when :input
|
|
31
|
-
new_input, cmd = CustomShellInput::UPDATE.call(message, model.input)
|
|
32
|
-
|
|
33
|
-
if new_input.cancelled
|
|
34
|
-
[INITIAL, nil]
|
|
35
|
-
elsif new_input.submitted
|
|
36
|
-
shell_cmd = new_input.text
|
|
37
|
-
new_output = CustomShellOutput::INITIAL.with(command: shell_cmd, running: true)
|
|
38
|
-
[
|
|
39
|
-
model.with(mode: :output, input: CustomShellInput::INITIAL, output: new_output),
|
|
40
|
-
Command.system(shell_cmd, :shell_output, stream: true),
|
|
41
|
-
]
|
|
42
|
-
else
|
|
43
|
-
[model.with(input: new_input), cmd]
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
when :output
|
|
47
|
-
# Route streaming messages (strip :shell_output prefix)
|
|
48
|
-
routed = case message
|
|
49
|
-
in [:shell_output, *rest] then rest
|
|
50
|
-
else message
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
new_output, cmd = CustomShellOutput::UPDATE.call(routed, model.output)
|
|
54
|
-
|
|
55
|
-
if new_output.dismissed
|
|
56
|
-
[INITIAL, nil]
|
|
57
|
-
else
|
|
58
|
-
[model.with(output: new_output), cmd]
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
else
|
|
62
|
-
[model, nil]
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def self.open
|
|
67
|
-
INITIAL.with(mode: :input, input: CustomShellInput::INITIAL)
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
def self.active?(model)
|
|
71
|
-
model.mode != :none
|
|
72
|
-
end
|
|
73
|
-
end
|