bubbles 0.0.5 → 0.1.1

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.
Files changed (62) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE.txt +21 -0
  3. data/README.md +601 -80
  4. data/bubbles.gemspec +29 -21
  5. data/lib/bubbles/ansi.rb +71 -0
  6. data/lib/bubbles/cryptic_spinner.rb +274 -0
  7. data/lib/bubbles/cursor.rb +169 -0
  8. data/lib/bubbles/file_picker.rb +397 -0
  9. data/lib/bubbles/help.rb +165 -0
  10. data/lib/bubbles/key.rb +96 -0
  11. data/lib/bubbles/list.rb +365 -0
  12. data/lib/bubbles/paginator.rb +158 -0
  13. data/lib/bubbles/progress.rb +276 -0
  14. data/lib/bubbles/spinner/spinners.rb +77 -0
  15. data/lib/bubbles/spinner.rb +122 -0
  16. data/lib/bubbles/stopwatch.rb +189 -0
  17. data/lib/bubbles/table.rb +248 -0
  18. data/lib/bubbles/text_area.rb +503 -0
  19. data/lib/bubbles/text_input.rb +543 -0
  20. data/lib/bubbles/timer.rb +196 -0
  21. data/lib/bubbles/version.rb +4 -1
  22. data/lib/bubbles/viewport.rb +283 -0
  23. data/lib/bubbles.rb +20 -35
  24. data/sig/bubbles/ansi.rbs +23 -0
  25. data/sig/bubbles/cryptic_spinner.rbs +143 -0
  26. data/sig/bubbles/cursor.rbs +87 -0
  27. data/sig/bubbles/file_picker.rbs +138 -0
  28. data/sig/bubbles/help.rbs +85 -0
  29. data/sig/bubbles/key.rbs +63 -0
  30. data/sig/bubbles/list.rbs +138 -0
  31. data/sig/bubbles/paginator.rbs +90 -0
  32. data/sig/bubbles/progress.rbs +123 -0
  33. data/sig/bubbles/spinner/spinners.rbs +32 -0
  34. data/sig/bubbles/spinner.rbs +74 -0
  35. data/sig/bubbles/stopwatch.rbs +97 -0
  36. data/sig/bubbles/table.rbs +119 -0
  37. data/sig/bubbles/text_area.rbs +161 -0
  38. data/sig/bubbles/text_input.rbs +183 -0
  39. data/sig/bubbles/timer.rbs +107 -0
  40. data/sig/bubbles/version.rbs +5 -0
  41. data/sig/bubbles/viewport.rbs +119 -0
  42. data/sig/bubbles.rbs +4 -0
  43. metadata +70 -67
  44. data/.gitignore +0 -14
  45. data/.rspec +0 -2
  46. data/.travis.yml +0 -10
  47. data/Gemfile +0 -4
  48. data/LICENSE +0 -20
  49. data/Rakefile +0 -6
  50. data/bin/console +0 -14
  51. data/bin/setup +0 -8
  52. data/exe/bubbles +0 -5
  53. data/lib/bubbles/bubblicious_file.rb +0 -42
  54. data/lib/bubbles/command_queue.rb +0 -43
  55. data/lib/bubbles/common_uploader_interface.rb +0 -13
  56. data/lib/bubbles/config.rb +0 -149
  57. data/lib/bubbles/dir_watcher.rb +0 -53
  58. data/lib/bubbles/uploaders/local_dir.rb +0 -39
  59. data/lib/bubbles/uploaders/s3.rb +0 -36
  60. data/lib/bubbles/uploaders/s3_ensure_connection.rb +0 -26
  61. data/tmp/dummy_local_dir_uploader_dir/.gitkeep +0 -0
  62. data/tmp/dummy_processing_dir/.gitkeep +0 -0
@@ -0,0 +1,123 @@
1
+ # Generated from lib/bubbles/progress.rb with RBS::Inline
2
+
3
+ module Bubbles
4
+ # Progress renders an animated progress bar.
5
+ #
6
+ # Example:
7
+ # progress = Bubbles::Progress.new
8
+ # progress.width = 40
9
+ #
10
+ # # Static rendering
11
+ # puts progress.view_as(0.5) # 50%
12
+ #
13
+ # # Animated rendering (use in bubbletea)
14
+ # command = progress.set_percent(0.75)
15
+ # # Then in update: progress.update(message)
16
+ # puts progress.view
17
+ class Progress
18
+ class FrameMessage < Bubbletea::Message
19
+ attr_reader id: Integer
20
+
21
+ attr_reader tag: Integer
22
+
23
+ # : (id: Integer, tag: Integer) -> void
24
+ def initialize: (id: Integer, tag: Integer) -> void
25
+ end
26
+
27
+ FPS: Integer
28
+
29
+ DEFAULT_WIDTH: Integer
30
+
31
+ SPRING_FREQUENCY: Float
32
+
33
+ SPRING_DAMPING: Float
34
+
35
+ # : () -> Integer
36
+ def self.next_id: () -> Integer
37
+
38
+ attr_accessor width: Integer
39
+
40
+ attr_accessor full: String
41
+
42
+ attr_accessor full_color: String
43
+
44
+ attr_accessor empty: String
45
+
46
+ attr_accessor empty_color: String
47
+
48
+ attr_accessor show_percentage: bool
49
+
50
+ attr_accessor percent_format: String
51
+
52
+ attr_accessor percent_style: Lipgloss::Style?
53
+
54
+ attr_accessor use_gradient: bool
55
+
56
+ attr_accessor gradient_a: String?
57
+
58
+ attr_accessor gradient_b: String?
59
+
60
+ attr_accessor scale_gradient: bool
61
+
62
+ attr_reader id: Integer
63
+
64
+ # : (?width: Integer, ?gradient: Array[String]?, ?scaled_gradient: Array[String]?, ?solid_fill: String?) -> void
65
+ def initialize: (?width: Integer, ?gradient: Array[String]?, ?scaled_gradient: Array[String]?, ?solid_fill: String?) -> void
66
+
67
+ # : () -> nil
68
+ def init: () -> nil
69
+
70
+ # : (Bubbletea::Message) -> [Progress, Bubbletea::Command?]
71
+ def update: (Bubbletea::Message) -> [ Progress, Bubbletea::Command? ]
72
+
73
+ # : () -> String
74
+ def view: () -> String
75
+
76
+ # : (Float) -> String
77
+ def view_as: (Float) -> String
78
+
79
+ # : () -> Float
80
+ def percent: () -> Float
81
+
82
+ # : (Float) -> Bubbletea::Command
83
+ def set_percent: (Float) -> Bubbletea::Command
84
+
85
+ # : (?Float) -> Bubbletea::Command
86
+ def increment_percent: (?Float) -> Bubbletea::Command
87
+
88
+ # : (?Float) -> Bubbletea::Command
89
+ def decrement_percent: (?Float) -> Bubbletea::Command
90
+
91
+ # : () -> bool
92
+ def animating?: () -> bool
93
+
94
+ # : (String, String, ?scaled: bool) -> void
95
+ def gradient: (String, String, ?scaled: bool) -> void
96
+
97
+ private
98
+
99
+ # : () -> Bubbletea::Command
100
+ def next_frame: () -> Bubbletea::Command
101
+
102
+ # : (Float, Integer) -> String
103
+ def render_bar: (Float, Integer) -> String
104
+
105
+ # : (Integer) -> String
106
+ def render_solid_fill: (Integer) -> String
107
+
108
+ # : (Integer) -> String
109
+ def render_empty_fill: (Integer) -> String
110
+
111
+ # : (Integer, Integer) -> String
112
+ def render_gradient_fill: (Integer, Integer) -> String
113
+
114
+ # : (Float) -> String
115
+ def render_percentage: (Float) -> String
116
+
117
+ # : (String, String) -> String
118
+ def colorize: (String, String) -> String
119
+
120
+ # : (String?, String?, Float) -> String
121
+ def blend_colors: (String?, String?, Float) -> String
122
+ end
123
+ end
@@ -0,0 +1,32 @@
1
+ # Generated from lib/bubbles/spinner/spinners.rb with RBS::Inline
2
+
3
+ module Bubbles
4
+ module Spinners
5
+ LINE: Hash[Symbol, Array[String] | Float]
6
+
7
+ DOT: Hash[Symbol, Array[String] | Float]
8
+
9
+ MINI_DOT: Hash[Symbol, Array[String] | Float]
10
+
11
+ JUMP: Hash[Symbol, Array[String] | Float]
12
+
13
+ PULSE: Hash[Symbol, Array[String] | Float]
14
+
15
+ POINTS: Hash[Symbol, Array[String] | Float]
16
+
17
+ GLOBE: Hash[Symbol, Array[String] | Float]
18
+
19
+ MOON: Hash[Symbol, Array[String] | Float]
20
+
21
+ MONKEY: Hash[Symbol, Array[String] | Float]
22
+
23
+ METER: Hash[Symbol, Array[String] | Float]
24
+
25
+ HAMBURGER: Hash[Symbol, Array[String] | Float]
26
+
27
+ ELLIPSIS: Hash[Symbol, Array[String] | Float]
28
+
29
+ # @rbs DEFAULT:
30
+ DEFAULT: Hash[Symbol, Array[String] | Float]
31
+ end
32
+ end
@@ -0,0 +1,74 @@
1
+ # Generated from lib/bubbles/spinner.rb with RBS::Inline
2
+
3
+ module Bubbles
4
+ # Spinner is an animated activity indicator component.
5
+ #
6
+ # Example:
7
+ # spinner = Bubbles::Spinner.new(spinner: Bubbles::Spinners::DOT)
8
+ # spinner.style = Lipgloss::Style.new.foreground("205")
9
+ #
10
+ # # In your model's init:
11
+ # def init
12
+ # [self, @spinner.tick]
13
+ # end
14
+ #
15
+ # # In your model's update:
16
+ # def update(message)
17
+ # case message
18
+ # when Bubbles::Spinner::TickMessage
19
+ # @spinner, command = @spinner.update(message)
20
+ # [self, command]
21
+ # end
22
+ # end
23
+ #
24
+ # # In your model's view:
25
+ # def view
26
+ # "#{@spinner.view} Loading..."
27
+ # end
28
+ class Spinner
29
+ class TickMessage < Bubbletea::Message
30
+ attr_reader id: Integer
31
+
32
+ attr_reader tag: Integer
33
+
34
+ # : (id: Integer, tag: Integer) -> void
35
+ def initialize: (id: Integer, tag: Integer) -> void
36
+ end
37
+
38
+ self.@next_id: Integer
39
+
40
+ self.@id_mutex: Mutex
41
+
42
+ # : () -> Integer
43
+ def self.next_id: () -> Integer
44
+
45
+ attr_reader id: Integer
46
+
47
+ attr_accessor spinner: Hash[Symbol, untyped]
48
+
49
+ attr_accessor style: Lipgloss::Style?
50
+
51
+ # : (?spinner: Hash[Symbol, untyped], ?style: Lipgloss::Style?) -> void
52
+ def initialize: (?spinner: Hash[Symbol, untyped], ?style: Lipgloss::Style?) -> void
53
+
54
+ # : () -> [Spinner, Bubbletea::Command]
55
+ def init: () -> [ Spinner, Bubbletea::Command ]
56
+
57
+ # : (Bubbletea::Message) -> [Spinner, Bubbletea::Command?]
58
+ def update: (Bubbletea::Message) -> [ Spinner, Bubbletea::Command? ]
59
+
60
+ # : () -> String
61
+ def view: () -> String
62
+
63
+ # : () -> Bubbletea::Command
64
+ def tick: () -> Bubbletea::Command
65
+
66
+ private
67
+
68
+ # : () -> Array[String]
69
+ def frames: () -> Array[String]
70
+
71
+ # : () -> Float
72
+ def fps: () -> Float
73
+ end
74
+ end
@@ -0,0 +1,97 @@
1
+ # Generated from lib/bubbles/stopwatch.rb with RBS::Inline
2
+
3
+ module Bubbles
4
+ # Stopwatch is an elapsed time counter component.
5
+ #
6
+ # Example:
7
+ # stopwatch = Bubbles::Stopwatch.new
8
+ #
9
+ # # In your model's init:
10
+ # def init
11
+ # [self, @stopwatch.init]
12
+ # end
13
+ #
14
+ # # In your model's update:
15
+ # def update(message)
16
+ # case message
17
+ # when Bubbles::Stopwatch::TickMessage, Bubbles::Stopwatch::StartStopMessage, Bubbles::Stopwatch::ResetMessage
18
+ # @stopwatch, command = @stopwatch.update(message)
19
+ #
20
+ # [self, command]
21
+ # end
22
+ # end
23
+ class Stopwatch
24
+ class TickMessage < Bubbletea::Message
25
+ attr_reader id: Integer
26
+
27
+ attr_reader tag: Integer
28
+
29
+ # : (id: Integer, tag: Integer) -> void
30
+ def initialize: (id: Integer, tag: Integer) -> void
31
+ end
32
+
33
+ class StartStopMessage < Bubbletea::Message
34
+ attr_reader id: Integer
35
+
36
+ attr_reader running: bool
37
+
38
+ # : (id: Integer, running: bool) -> void
39
+ def initialize: (id: Integer, running: bool) -> void
40
+ end
41
+
42
+ class ResetMessage < Bubbletea::Message
43
+ attr_reader id: Integer
44
+
45
+ # : (id: Integer) -> void
46
+ def initialize: (id: Integer) -> void
47
+ end
48
+
49
+ self.@id_mutex: Mutex
50
+
51
+ self.@next_id: Integer
52
+
53
+ # : () -> Integer
54
+ def self.next_id: () -> Integer
55
+
56
+ attr_reader elapsed: Float
57
+
58
+ attr_reader interval: Float
59
+
60
+ attr_reader id: Integer
61
+
62
+ # : (?interval: Float) -> void
63
+ def initialize: (?interval: Float) -> void
64
+
65
+ # : () -> Bubbletea::Command
66
+ def init: () -> Bubbletea::Command
67
+
68
+ # : () -> bool
69
+ def running?: () -> bool
70
+
71
+ # : (Bubbletea::Message) -> [Stopwatch, Bubbletea::Command?]
72
+ def update: (Bubbletea::Message) -> [ Stopwatch, Bubbletea::Command? ]
73
+
74
+ # : () -> String
75
+ def view: () -> String
76
+
77
+ # : () -> Bubbletea::Command
78
+ def start: () -> Bubbletea::Command
79
+
80
+ # : () -> Bubbletea::Command
81
+ def stop: () -> Bubbletea::Command
82
+
83
+ # : () -> Bubbletea::Command
84
+ def toggle: () -> Bubbletea::Command
85
+
86
+ # : () -> Bubbletea::Command
87
+ def reset: () -> Bubbletea::Command
88
+
89
+ private
90
+
91
+ # : () -> Bubbletea::Command?
92
+ def tick: () -> Bubbletea::Command?
93
+
94
+ # : (Float) -> String
95
+ def format_duration: (Float) -> String
96
+ end
97
+ end
@@ -0,0 +1,119 @@
1
+ # Generated from lib/bubbles/table.rb with RBS::Inline
2
+
3
+ module Bubbles
4
+ # Table is a simple table component for displaying tabular data.
5
+ #
6
+ # Example:
7
+ # columns = [
8
+ # { title: "Name", width: 20 },
9
+ # { title: "Age", width: 5 }
10
+ # ]
11
+ # rows = [
12
+ # ["Alice", "30"],
13
+ # ["Bob", "25"]
14
+ # ]
15
+ # table = Bubbles::Table.new(columns: columns, rows: rows)
16
+ #
17
+ # # In update:
18
+ # table, command = table.update(message)
19
+ #
20
+ # # In view:
21
+ # table.view
22
+ class Table
23
+ class Column < Struct[untyped]
24
+ attr_accessor title(): untyped
25
+
26
+ attr_accessor width(): untyped
27
+
28
+ def self.new: (?title: untyped, ?width: untyped) -> instance
29
+ | ({ ?title: untyped, ?width: untyped }) -> instance
30
+ end
31
+
32
+ attr_accessor height: Integer
33
+
34
+ attr_accessor focus: bool
35
+
36
+ attr_reader cursor: Integer
37
+
38
+ attr_reader columns: Array[Column]
39
+
40
+ attr_reader rows: Array[Array[String]]
41
+
42
+ attr_accessor header_style: Lipgloss::Style?
43
+
44
+ attr_accessor cell_style: Lipgloss::Style?
45
+
46
+ attr_accessor selected_style: Lipgloss::Style?
47
+
48
+ # @rbs columns: Array[Hash[Symbol, untyped] | Column] -- Column definitions with :title and :width
49
+ # @rbs rows: Array[Array[String]] -- Row data
50
+ # @rbs height: Integer -- Visible rows (excluding header)
51
+ # @rbs return: void
52
+ def initialize: (?columns: Array[Hash[Symbol, untyped] | Column], ?rows: Array[Array[String]], ?height: Integer) -> void
53
+
54
+ # : (Array[Hash[Symbol, untyped] | Column]) -> void
55
+ def columns=: (Array[Hash[Symbol, untyped] | Column]) -> void
56
+
57
+ # : (Array[Array[String]]) -> void
58
+ def rows=: (Array[Array[String]]) -> void
59
+
60
+ # : () -> Integer
61
+ def selected_row: () -> Integer
62
+
63
+ # : () -> Array[String]?
64
+ def selected_row_data: () -> Array[String]?
65
+
66
+ # : (Integer) -> void
67
+ def go_to_row: (Integer) -> void
68
+
69
+ # : (?Integer) -> void
70
+ def move_up: (?Integer) -> void
71
+
72
+ # : (?Integer) -> void
73
+ def move_down: (?Integer) -> void
74
+
75
+ # : () -> void
76
+ def go_to_top: () -> void
77
+
78
+ # : () -> void
79
+ def go_to_bottom: () -> void
80
+
81
+ # : () -> void
82
+ def page_up: () -> void
83
+
84
+ # : () -> void
85
+ def page_down: () -> void
86
+
87
+ # : () -> void
88
+ def focus!: () -> void
89
+
90
+ # : () -> void
91
+ def blur: () -> void
92
+
93
+ # : () -> bool
94
+ def focused?: () -> bool
95
+
96
+ # : (Bubbletea::Message) -> [Table, Bubbletea::Command?]
97
+ def update: (Bubbletea::Message) -> [ Table, Bubbletea::Command? ]
98
+
99
+ # : () -> String
100
+ def view: () -> String
101
+
102
+ private
103
+
104
+ # : () -> String
105
+ def render_header: () -> String
106
+
107
+ # : () -> String
108
+ def render_separator: () -> String
109
+
110
+ # : (Integer) -> String
111
+ def render_row: (Integer) -> String
112
+
113
+ # : (String, Integer) -> String
114
+ def truncate_or_pad: (String, Integer) -> String
115
+
116
+ # : () -> void
117
+ def update_offset: () -> void
118
+ end
119
+ end
@@ -0,0 +1,161 @@
1
+ # Generated from lib/bubbles/text_area.rb with RBS::Inline
2
+
3
+ module Bubbles
4
+ # TextArea is a multi-line text input component.
5
+ #
6
+ # Example:
7
+ # textarea = Bubbles::TextArea.new
8
+ # textarea.placeholder = "Enter text..."
9
+ # textarea.focus
10
+ #
11
+ # # In update:
12
+ # textarea, command = textarea.update(message)
13
+ #
14
+ # # In view:
15
+ # textarea.view
16
+ class TextArea
17
+ DEFAULT_WIDTH: Integer
18
+
19
+ DEFAULT_HEIGHT: Integer
20
+
21
+ DEFAULT_CHAR_LIMIT: Integer
22
+
23
+ class PasteMessage < Bubbletea::Message
24
+ attr_reader text: String
25
+
26
+ # : (String) -> void
27
+ def initialize: (String) -> void
28
+ end
29
+
30
+ attr_accessor width: Integer
31
+
32
+ attr_accessor height: Integer
33
+
34
+ attr_accessor char_limit: Integer
35
+
36
+ attr_accessor placeholder: String
37
+
38
+ attr_accessor prompt: String
39
+
40
+ attr_accessor show_line_numbers: bool
41
+
42
+ attr_accessor end_of_buffer_character: String
43
+
44
+ attr_accessor placeholder_style: Lipgloss::Style?
45
+
46
+ attr_accessor prompt_style: Lipgloss::Style?
47
+
48
+ attr_accessor text_style: Lipgloss::Style?
49
+
50
+ attr_accessor line_number_style: Lipgloss::Style?
51
+
52
+ attr_reader cursor: Cursor
53
+
54
+ attr_reader error: StandardError?
55
+
56
+ attr_reader row: Integer
57
+
58
+ attr_reader col: Integer
59
+
60
+ # : (?width: Integer, ?height: Integer) -> void
61
+ def initialize: (?width: Integer, ?height: Integer) -> void
62
+
63
+ # : () -> String
64
+ def value: () -> String
65
+
66
+ # : (String) -> void
67
+ def value=: (String) -> void
68
+
69
+ # : () -> Integer
70
+ def line_count: () -> Integer
71
+
72
+ # : () -> String
73
+ def current_line: () -> String
74
+
75
+ # : () -> bool
76
+ def focused?: () -> bool
77
+
78
+ # : () -> Bubbletea::Command?
79
+ def focus: () -> Bubbletea::Command?
80
+
81
+ # : () -> void
82
+ def blur: () -> void
83
+
84
+ # : () -> void
85
+ def reset: () -> void
86
+
87
+ # : (Bubbletea::Message) -> [TextArea, Bubbletea::Command?]
88
+ def update: (Bubbletea::Message) -> [ TextArea, Bubbletea::Command? ]
89
+
90
+ # : () -> String
91
+ def view: () -> String
92
+
93
+ private
94
+
95
+ # : (Bubbletea::KeyMessage) -> void
96
+ def handle_key: (Bubbletea::KeyMessage) -> void
97
+
98
+ # : (String) -> void
99
+ def insert_text: (String) -> void
100
+
101
+ # : () -> void
102
+ def insert_newline: () -> void
103
+
104
+ # : () -> void
105
+ def delete_backward: () -> void
106
+
107
+ # : () -> void
108
+ def delete_forward: () -> void
109
+
110
+ # : () -> void
111
+ def delete_to_end: () -> void
112
+
113
+ # : () -> void
114
+ def delete_to_start: () -> void
115
+
116
+ # : () -> void
117
+ def delete_word_backward: () -> void
118
+
119
+ # : () -> void
120
+ def move_left: () -> void
121
+
122
+ # : () -> void
123
+ def move_right: () -> void
124
+
125
+ # : () -> void
126
+ def move_up: () -> void
127
+
128
+ # : () -> void
129
+ def move_down: () -> void
130
+
131
+ # : () -> void
132
+ def line_start: () -> void
133
+
134
+ # : () -> void
135
+ def line_end: () -> void
136
+
137
+ # : () -> void
138
+ def word_backward: () -> void
139
+
140
+ # : () -> void
141
+ def word_forward: () -> void
142
+
143
+ # : () -> void
144
+ def update_viewport: () -> void
145
+
146
+ # : () -> Integer
147
+ def total_length: () -> Integer
148
+
149
+ # : (Integer) -> String
150
+ def render_line: (Integer) -> String
151
+
152
+ # : (String) -> String
153
+ def render_text: (String) -> String
154
+
155
+ # : () -> String
156
+ def render_end_of_buffer: () -> String
157
+
158
+ # : () -> String
159
+ def placeholder_view: () -> String
160
+ end
161
+ end