bubbles 0.0.5 → 0.1.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 +5 -5
- data/LICENSE.txt +21 -0
- data/README.md +524 -80
- data/bubbles.gemspec +29 -21
- data/lib/bubbles/cursor.rb +169 -0
- data/lib/bubbles/file_picker.rb +397 -0
- data/lib/bubbles/help.rb +170 -0
- data/lib/bubbles/key.rb +96 -0
- data/lib/bubbles/list.rb +365 -0
- data/lib/bubbles/paginator.rb +158 -0
- data/lib/bubbles/progress.rb +276 -0
- data/lib/bubbles/spinner/spinners.rb +77 -0
- data/lib/bubbles/spinner.rb +122 -0
- data/lib/bubbles/stopwatch.rb +189 -0
- data/lib/bubbles/table.rb +248 -0
- data/lib/bubbles/text_area.rb +503 -0
- data/lib/bubbles/text_input.rb +543 -0
- data/lib/bubbles/timer.rb +196 -0
- data/lib/bubbles/version.rb +4 -1
- data/lib/bubbles/viewport.rb +296 -0
- data/lib/bubbles.rb +18 -35
- data/sig/bubbles/cursor.rbs +87 -0
- data/sig/bubbles/file_picker.rbs +138 -0
- data/sig/bubbles/help.rbs +88 -0
- data/sig/bubbles/key.rbs +63 -0
- data/sig/bubbles/list.rbs +138 -0
- data/sig/bubbles/paginator.rbs +90 -0
- data/sig/bubbles/progress.rbs +123 -0
- data/sig/bubbles/spinner/spinners.rbs +32 -0
- data/sig/bubbles/spinner.rbs +74 -0
- data/sig/bubbles/stopwatch.rbs +97 -0
- data/sig/bubbles/table.rbs +119 -0
- data/sig/bubbles/text_area.rbs +161 -0
- data/sig/bubbles/text_input.rbs +183 -0
- data/sig/bubbles/timer.rbs +107 -0
- data/sig/bubbles/version.rbs +5 -0
- data/sig/bubbles/viewport.rbs +125 -0
- data/sig/bubbles.rbs +4 -0
- metadata +66 -67
- data/.gitignore +0 -14
- data/.rspec +0 -2
- data/.travis.yml +0 -10
- data/Gemfile +0 -4
- data/LICENSE +0 -20
- data/Rakefile +0 -6
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/exe/bubbles +0 -5
- data/lib/bubbles/bubblicious_file.rb +0 -42
- data/lib/bubbles/command_queue.rb +0 -43
- data/lib/bubbles/common_uploader_interface.rb +0 -13
- data/lib/bubbles/config.rb +0 -149
- data/lib/bubbles/dir_watcher.rb +0 -53
- data/lib/bubbles/uploaders/local_dir.rb +0 -39
- data/lib/bubbles/uploaders/s3.rb +0 -36
- data/lib/bubbles/uploaders/s3_ensure_connection.rb +0 -26
- data/tmp/dummy_local_dir_uploader_dir/.gitkeep +0 -0
- data/tmp/dummy_processing_dir/.gitkeep +0 -0
|
@@ -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
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Generated from lib/bubbles/text_input.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Bubbles
|
|
4
|
+
# TextInput is a single-line text input component.
|
|
5
|
+
#
|
|
6
|
+
# Example:
|
|
7
|
+
# input = Bubbles::TextInput.new
|
|
8
|
+
# input.placeholder = "Enter your name..."
|
|
9
|
+
# input.focus
|
|
10
|
+
#
|
|
11
|
+
# # In update:
|
|
12
|
+
# input, command = input.update(message)
|
|
13
|
+
#
|
|
14
|
+
# # In view:
|
|
15
|
+
# input.view
|
|
16
|
+
class TextInput
|
|
17
|
+
ECHO_NORMAL: Symbol
|
|
18
|
+
|
|
19
|
+
ECHO_PASSWORD: Symbol
|
|
20
|
+
|
|
21
|
+
ECHO_NONE: Symbol
|
|
22
|
+
|
|
23
|
+
class PasteMessage < Bubbletea::Message
|
|
24
|
+
attr_reader text: String
|
|
25
|
+
|
|
26
|
+
# : (String) -> void
|
|
27
|
+
def initialize: (String) -> void
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
class PasteErrorMessage < Bubbletea::Message
|
|
31
|
+
attr_reader error: StandardError
|
|
32
|
+
|
|
33
|
+
# : (StandardError) -> void
|
|
34
|
+
def initialize: (StandardError) -> void
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
attr_accessor prompt: String
|
|
38
|
+
|
|
39
|
+
attr_accessor placeholder: String
|
|
40
|
+
|
|
41
|
+
attr_accessor echo_mode: Symbol
|
|
42
|
+
|
|
43
|
+
attr_accessor echo_character: String
|
|
44
|
+
|
|
45
|
+
attr_accessor char_limit: Integer
|
|
46
|
+
|
|
47
|
+
attr_accessor width: Integer
|
|
48
|
+
|
|
49
|
+
attr_accessor prompt_style: Lipgloss::Style?
|
|
50
|
+
|
|
51
|
+
attr_accessor text_style: Lipgloss::Style?
|
|
52
|
+
|
|
53
|
+
attr_accessor placeholder_style: Lipgloss::Style?
|
|
54
|
+
|
|
55
|
+
attr_accessor cursor_style: Lipgloss::Style?
|
|
56
|
+
|
|
57
|
+
attr_accessor validate: (^(String) -> StandardError?)?
|
|
58
|
+
|
|
59
|
+
attr_accessor show_suggestions: bool
|
|
60
|
+
|
|
61
|
+
attr_reader position: Integer
|
|
62
|
+
|
|
63
|
+
attr_reader cursor: Cursor
|
|
64
|
+
|
|
65
|
+
attr_reader error: StandardError?
|
|
66
|
+
|
|
67
|
+
# : () -> void
|
|
68
|
+
def initialize: () -> void
|
|
69
|
+
|
|
70
|
+
# : () -> String
|
|
71
|
+
def value: () -> String
|
|
72
|
+
|
|
73
|
+
# : (String) -> void
|
|
74
|
+
def value=: (String) -> void
|
|
75
|
+
|
|
76
|
+
# : (Integer) -> void
|
|
77
|
+
def position=: (Integer) -> void
|
|
78
|
+
|
|
79
|
+
# : () -> void
|
|
80
|
+
def cursor_start: () -> void
|
|
81
|
+
|
|
82
|
+
# : () -> void
|
|
83
|
+
def cursor_end: () -> void
|
|
84
|
+
|
|
85
|
+
# : () -> bool
|
|
86
|
+
def focused?: () -> bool
|
|
87
|
+
|
|
88
|
+
# : () -> Bubbletea::Command?
|
|
89
|
+
def focus: () -> Bubbletea::Command?
|
|
90
|
+
|
|
91
|
+
# : () -> void
|
|
92
|
+
def blur: () -> void
|
|
93
|
+
|
|
94
|
+
# : () -> void
|
|
95
|
+
def reset: () -> void
|
|
96
|
+
|
|
97
|
+
# : (Array[String]) -> void
|
|
98
|
+
def suggestions=: (Array[String]) -> void
|
|
99
|
+
|
|
100
|
+
# : (Bubbletea::Message) -> [TextInput, Bubbletea::Command?]
|
|
101
|
+
def update: (Bubbletea::Message) -> [ TextInput, Bubbletea::Command? ]
|
|
102
|
+
|
|
103
|
+
# : () -> String
|
|
104
|
+
def view: () -> String
|
|
105
|
+
|
|
106
|
+
private
|
|
107
|
+
|
|
108
|
+
# : (Bubbletea::KeyMessage) -> void
|
|
109
|
+
def handle_key: (Bubbletea::KeyMessage) -> void
|
|
110
|
+
|
|
111
|
+
# : () -> void
|
|
112
|
+
def delete_character_backward: () -> void
|
|
113
|
+
|
|
114
|
+
# : () -> void
|
|
115
|
+
def delete_character_forward: () -> void
|
|
116
|
+
|
|
117
|
+
# : () -> void
|
|
118
|
+
def delete_before_cursor: () -> void
|
|
119
|
+
|
|
120
|
+
# : () -> void
|
|
121
|
+
def delete_after_cursor: () -> void
|
|
122
|
+
|
|
123
|
+
# : () -> void
|
|
124
|
+
def delete_word_backward: () -> void
|
|
125
|
+
|
|
126
|
+
# : () -> void
|
|
127
|
+
def delete_word_forward: () -> void
|
|
128
|
+
|
|
129
|
+
# : () -> void
|
|
130
|
+
def word_backward: () -> void
|
|
131
|
+
|
|
132
|
+
# : () -> void
|
|
133
|
+
def word_forward: () -> void
|
|
134
|
+
|
|
135
|
+
# : (Array[String]) -> void
|
|
136
|
+
def insert_runes: (Array[String]) -> void
|
|
137
|
+
|
|
138
|
+
# : (Array[String]) -> Array[String]
|
|
139
|
+
def sanitize: (Array[String]) -> Array[String]
|
|
140
|
+
|
|
141
|
+
# : () -> void
|
|
142
|
+
def handle_overflow: () -> void
|
|
143
|
+
|
|
144
|
+
# : (String) -> String
|
|
145
|
+
def echo_transform: (String) -> String
|
|
146
|
+
|
|
147
|
+
# : (Array[String]) -> void
|
|
148
|
+
def apply_value: (Array[String]) -> void
|
|
149
|
+
|
|
150
|
+
# : (Array[String]) -> StandardError?
|
|
151
|
+
def run_validate: (Array[String]) -> StandardError?
|
|
152
|
+
|
|
153
|
+
# : () -> String
|
|
154
|
+
def render_prompt: () -> String
|
|
155
|
+
|
|
156
|
+
# : (String) -> String
|
|
157
|
+
def render_text: (String) -> String
|
|
158
|
+
|
|
159
|
+
# : (String) -> String
|
|
160
|
+
def render_placeholder: (String) -> String
|
|
161
|
+
|
|
162
|
+
# : () -> String
|
|
163
|
+
def placeholder_view: () -> String
|
|
164
|
+
|
|
165
|
+
# : () -> String?
|
|
166
|
+
def current_suggestion_remainder: () -> String?
|
|
167
|
+
|
|
168
|
+
# : () -> void
|
|
169
|
+
def update_suggestions: () -> void
|
|
170
|
+
|
|
171
|
+
# : () -> bool
|
|
172
|
+
def can_accept_suggestion?: () -> bool
|
|
173
|
+
|
|
174
|
+
# : () -> void
|
|
175
|
+
def accept_suggestion: () -> void
|
|
176
|
+
|
|
177
|
+
# : () -> void
|
|
178
|
+
def next_suggestion: () -> void
|
|
179
|
+
|
|
180
|
+
# : () -> void
|
|
181
|
+
def previous_suggestion: () -> void
|
|
182
|
+
end
|
|
183
|
+
end
|