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,138 @@
|
|
|
1
|
+
# Generated from lib/bubbles/file_picker.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Bubbles
|
|
4
|
+
# FilePicker is a component for browsing and selecting files.
|
|
5
|
+
#
|
|
6
|
+
# Example:
|
|
7
|
+
# picker = Bubbles::FilePicker.new
|
|
8
|
+
# picker.current_directory = "."
|
|
9
|
+
#
|
|
10
|
+
# # In update:
|
|
11
|
+
# picker, command = picker.update(message)
|
|
12
|
+
#
|
|
13
|
+
# # Check if a file was selected:
|
|
14
|
+
# if picker.did_select_file?
|
|
15
|
+
# selected_file = picker.path
|
|
16
|
+
# end
|
|
17
|
+
#
|
|
18
|
+
# # In view:
|
|
19
|
+
# picker.view
|
|
20
|
+
class FilePicker
|
|
21
|
+
class ReadDirMessage < Bubbletea::Message
|
|
22
|
+
attr_reader id: Integer
|
|
23
|
+
|
|
24
|
+
attr_reader entries: Array[Hash[Symbol, untyped]]
|
|
25
|
+
|
|
26
|
+
# : (id: Integer, entries: Array[Hash[Symbol, untyped]]) -> void
|
|
27
|
+
def initialize: (id: Integer, entries: Array[Hash[Symbol, untyped]]) -> void
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
class ErrorMessage < Bubbletea::Message
|
|
31
|
+
attr_reader error: StandardError
|
|
32
|
+
|
|
33
|
+
# : (StandardError) -> void
|
|
34
|
+
def initialize: (StandardError) -> void
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# : () -> Integer
|
|
38
|
+
def self.next_id: () -> Integer
|
|
39
|
+
|
|
40
|
+
attr_accessor height: Integer
|
|
41
|
+
|
|
42
|
+
attr_accessor cursor_char: String
|
|
43
|
+
|
|
44
|
+
attr_accessor show_permissions: bool
|
|
45
|
+
|
|
46
|
+
attr_accessor show_size: bool
|
|
47
|
+
|
|
48
|
+
attr_accessor show_hidden: bool
|
|
49
|
+
|
|
50
|
+
attr_accessor dir_allowed: bool
|
|
51
|
+
|
|
52
|
+
attr_accessor file_allowed: bool
|
|
53
|
+
|
|
54
|
+
attr_accessor allowed_types: Array[String]
|
|
55
|
+
|
|
56
|
+
attr_accessor cursor_style: Lipgloss::Style?
|
|
57
|
+
|
|
58
|
+
attr_accessor dir_style: Lipgloss::Style?
|
|
59
|
+
|
|
60
|
+
attr_accessor file_style: Lipgloss::Style?
|
|
61
|
+
|
|
62
|
+
attr_accessor selected_style: Lipgloss::Style?
|
|
63
|
+
|
|
64
|
+
attr_accessor permission_style: Lipgloss::Style?
|
|
65
|
+
|
|
66
|
+
attr_accessor size_style: Lipgloss::Style?
|
|
67
|
+
|
|
68
|
+
attr_accessor disabled_style: Lipgloss::Style?
|
|
69
|
+
|
|
70
|
+
attr_reader id: Integer
|
|
71
|
+
|
|
72
|
+
attr_reader current_directory: String
|
|
73
|
+
|
|
74
|
+
attr_reader path: String?
|
|
75
|
+
|
|
76
|
+
attr_reader files: Array[Hash[Symbol, untyped]]
|
|
77
|
+
|
|
78
|
+
# @rbs directory: String -- Starting directory
|
|
79
|
+
# @rbs return: void
|
|
80
|
+
def initialize: (?directory: String) -> void
|
|
81
|
+
|
|
82
|
+
# : (String) -> void
|
|
83
|
+
def current_directory=: (String) -> void
|
|
84
|
+
|
|
85
|
+
# : () -> bool
|
|
86
|
+
def did_select_file?: () -> bool
|
|
87
|
+
|
|
88
|
+
# : () -> bool
|
|
89
|
+
def selected?: () -> bool
|
|
90
|
+
|
|
91
|
+
# : () -> void
|
|
92
|
+
def clear_selected: () -> void
|
|
93
|
+
|
|
94
|
+
# : () -> Integer
|
|
95
|
+
def cursor: () -> Integer
|
|
96
|
+
|
|
97
|
+
# : (Bubbletea::Message) -> [FilePicker, Bubbletea::Command?]
|
|
98
|
+
def update: (Bubbletea::Message) -> [ FilePicker, Bubbletea::Command? ]
|
|
99
|
+
|
|
100
|
+
# : () -> String
|
|
101
|
+
def view: () -> String
|
|
102
|
+
|
|
103
|
+
private
|
|
104
|
+
|
|
105
|
+
# : (Bubbletea::KeyMessage) -> void
|
|
106
|
+
def handle_key: (Bubbletea::KeyMessage) -> void
|
|
107
|
+
|
|
108
|
+
# : () -> void
|
|
109
|
+
def read_directory: () -> void
|
|
110
|
+
|
|
111
|
+
# : (Hash[Symbol, untyped]) -> void
|
|
112
|
+
def enter_directory: (Hash[Symbol, untyped]) -> void
|
|
113
|
+
|
|
114
|
+
# : () -> void
|
|
115
|
+
def go_up: () -> void
|
|
116
|
+
|
|
117
|
+
# : (Hash[Symbol, untyped]) -> void
|
|
118
|
+
def select_file: (Hash[Symbol, untyped]) -> void
|
|
119
|
+
|
|
120
|
+
# : (Hash[Symbol, untyped]) -> bool
|
|
121
|
+
def can_select?: (Hash[Symbol, untyped]) -> bool
|
|
122
|
+
|
|
123
|
+
# : (String) -> String
|
|
124
|
+
def render_path: (String) -> String
|
|
125
|
+
|
|
126
|
+
# : (Hash[Symbol, untyped], bool) -> String
|
|
127
|
+
def render_entry: (Hash[Symbol, untyped], bool) -> String
|
|
128
|
+
|
|
129
|
+
# : (Integer) -> String
|
|
130
|
+
def format_permissions: (Integer) -> String
|
|
131
|
+
|
|
132
|
+
# : (Integer) -> String
|
|
133
|
+
def format_size: (Integer) -> String
|
|
134
|
+
|
|
135
|
+
# : () -> void
|
|
136
|
+
def update_offset: () -> void
|
|
137
|
+
end
|
|
138
|
+
end
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Generated from lib/bubbles/help.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Bubbles
|
|
4
|
+
# Help renders help text from key bindings.
|
|
5
|
+
#
|
|
6
|
+
# Example:
|
|
7
|
+
# help = Bubbles::Help.new
|
|
8
|
+
# help.width = 80
|
|
9
|
+
#
|
|
10
|
+
# # Define a keymap with short_help and full_help methods
|
|
11
|
+
# class MyKeyMap
|
|
12
|
+
# BINDINGS = {
|
|
13
|
+
# up: Bubbles::Key.binding(keys: ["up", "k"], help: ["↑/k", "up"]),
|
|
14
|
+
# down: Bubbles::Key.binding(keys: ["down", "j"], help: ["↓/j", "down"]),
|
|
15
|
+
# help: Bubbles::Key.binding(keys: ["?"], help: ["?", "help"]),
|
|
16
|
+
# quit: Bubbles::Key.binding(keys: ["q"], help: ["q", "quit"])
|
|
17
|
+
# }
|
|
18
|
+
#
|
|
19
|
+
# def short_help
|
|
20
|
+
# [BINDINGS[:help], BINDINGS[:quit]]
|
|
21
|
+
# end
|
|
22
|
+
#
|
|
23
|
+
# def full_help
|
|
24
|
+
# [
|
|
25
|
+
# [BINDINGS[:up], BINDINGS[:down]],
|
|
26
|
+
# [BINDINGS[:help], BINDINGS[:quit]]
|
|
27
|
+
# ]
|
|
28
|
+
# end
|
|
29
|
+
# end
|
|
30
|
+
#
|
|
31
|
+
# keymap = MyKeyMap.new
|
|
32
|
+
# puts help.view(keymap)
|
|
33
|
+
class Help
|
|
34
|
+
DEFAULT_KEY_STYLE: Lipgloss::Style?
|
|
35
|
+
|
|
36
|
+
DEFAULT_DESC_STYLE: Lipgloss::Style?
|
|
37
|
+
|
|
38
|
+
DEFAULT_SEPARATOR_STYLE: Lipgloss::Style?
|
|
39
|
+
|
|
40
|
+
attr_accessor width: Integer
|
|
41
|
+
|
|
42
|
+
attr_accessor show_all: bool
|
|
43
|
+
|
|
44
|
+
attr_accessor short_separator: String
|
|
45
|
+
|
|
46
|
+
attr_accessor full_separator: String
|
|
47
|
+
|
|
48
|
+
attr_accessor full_help_column_gap: Integer
|
|
49
|
+
|
|
50
|
+
attr_accessor key_style: Lipgloss::Style?
|
|
51
|
+
|
|
52
|
+
attr_accessor desc_style: Lipgloss::Style?
|
|
53
|
+
|
|
54
|
+
attr_accessor separator_style: Lipgloss::Style?
|
|
55
|
+
|
|
56
|
+
# : () -> void
|
|
57
|
+
def initialize: () -> void
|
|
58
|
+
|
|
59
|
+
# : (untyped) -> String
|
|
60
|
+
def view: (untyped) -> String
|
|
61
|
+
|
|
62
|
+
# : (Array[Key::Binding]?) -> String
|
|
63
|
+
def short_help_view: (Array[Key::Binding]?) -> String
|
|
64
|
+
|
|
65
|
+
# : (Array[Array[Key::Binding]]?) -> String
|
|
66
|
+
def full_help_view: (Array[Array[Key::Binding]]?) -> String
|
|
67
|
+
|
|
68
|
+
private
|
|
69
|
+
|
|
70
|
+
# : (Key::Binding) -> String
|
|
71
|
+
def render_binding: (Key::Binding) -> String
|
|
72
|
+
|
|
73
|
+
# : (String) -> String
|
|
74
|
+
def render_key: (String) -> String
|
|
75
|
+
|
|
76
|
+
# : (String) -> String
|
|
77
|
+
def render_desc: (String) -> String
|
|
78
|
+
|
|
79
|
+
# : (String) -> String
|
|
80
|
+
def render_separator: (String) -> String
|
|
81
|
+
|
|
82
|
+
# : (String) -> String
|
|
83
|
+
def truncate_to_width: (String) -> String
|
|
84
|
+
|
|
85
|
+
# : (String) -> String
|
|
86
|
+
def strip_ansi: (String) -> String
|
|
87
|
+
end
|
|
88
|
+
end
|
data/sig/bubbles/key.rbs
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Generated from lib/bubbles/key.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Bubbles
|
|
4
|
+
# Key provides helpers for defining and matching key bindings.
|
|
5
|
+
#
|
|
6
|
+
# Example:
|
|
7
|
+
# # Define key bindings
|
|
8
|
+
# KEYS = {
|
|
9
|
+
# up: Bubbles::Key.binding(
|
|
10
|
+
# keys: ["up", "k"],
|
|
11
|
+
# help: ["↑/k", "move up"]
|
|
12
|
+
# ),
|
|
13
|
+
# down: Bubbles::Key.binding(
|
|
14
|
+
# keys: ["down", "j"],
|
|
15
|
+
# help: ["↓/j", "move down"]
|
|
16
|
+
# ),
|
|
17
|
+
# quit: Bubbles::Key.binding(
|
|
18
|
+
# keys: ["q", "esc", "ctrl+c"],
|
|
19
|
+
# help: ["q", "quit"]
|
|
20
|
+
# )
|
|
21
|
+
# }
|
|
22
|
+
#
|
|
23
|
+
# # Match in update
|
|
24
|
+
# def update(message)
|
|
25
|
+
# case message
|
|
26
|
+
# when Bubbletea::KeyMessage
|
|
27
|
+
# if Bubbles::Key.matches?(message, KEYS[:up])
|
|
28
|
+
# # handle up
|
|
29
|
+
# elsif Bubbles::Key.matches?(message, KEYS[:down])
|
|
30
|
+
# # handle down
|
|
31
|
+
# end
|
|
32
|
+
# end
|
|
33
|
+
# end
|
|
34
|
+
module Key
|
|
35
|
+
class Binding
|
|
36
|
+
attr_accessor keys: Array[String]
|
|
37
|
+
|
|
38
|
+
attr_accessor help_key: String?
|
|
39
|
+
|
|
40
|
+
attr_accessor help_desc: String?
|
|
41
|
+
|
|
42
|
+
attr_accessor enabled: bool
|
|
43
|
+
|
|
44
|
+
# : (keys: Array[String], ?help_key: String?, ?help_desc: String?, ?enabled: bool) -> void
|
|
45
|
+
def initialize: (keys: Array[String], ?help_key: String?, ?help_desc: String?, ?enabled: bool) -> void
|
|
46
|
+
|
|
47
|
+
# : () -> bool
|
|
48
|
+
def enabled?: () -> bool
|
|
49
|
+
|
|
50
|
+
# : () -> bool
|
|
51
|
+
def help?: () -> bool
|
|
52
|
+
|
|
53
|
+
# : () -> [String, String]
|
|
54
|
+
def help: () -> [ String, String ]
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# : (keys: Array[String] | String, ?help: Array[String]?, ?enabled: bool) -> Binding
|
|
58
|
+
def self.binding: (keys: Array[String] | String, ?help: Array[String]?, ?enabled: bool) -> Binding
|
|
59
|
+
|
|
60
|
+
# : (Bubbletea::KeyMessage, *Binding) -> bool
|
|
61
|
+
def self.matches?: (Bubbletea::KeyMessage, *Binding) -> bool
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Generated from lib/bubbles/list.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Bubbles
|
|
4
|
+
# List is a feature-rich component for browsing a list of items.
|
|
5
|
+
# It features optional filtering, pagination, and status messages.
|
|
6
|
+
#
|
|
7
|
+
# Example:
|
|
8
|
+
# items = [
|
|
9
|
+
# { title: "Item 1", description: "Description 1" },
|
|
10
|
+
# { title: "Item 2", description: "Description 2" }
|
|
11
|
+
# ]
|
|
12
|
+
# list = Bubbles::List.new(items, width: 40, height: 10)
|
|
13
|
+
#
|
|
14
|
+
# # In update:
|
|
15
|
+
# list, command = list.update(message)
|
|
16
|
+
#
|
|
17
|
+
# # In view:
|
|
18
|
+
# list.view
|
|
19
|
+
class List
|
|
20
|
+
UNFILTERED: Symbol
|
|
21
|
+
|
|
22
|
+
FILTERING: Symbol
|
|
23
|
+
|
|
24
|
+
FILTER_APPLIED: Symbol
|
|
25
|
+
|
|
26
|
+
class StatusMessageTimeoutMessage < Bubbletea::Message
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
attr_accessor width: Integer
|
|
30
|
+
|
|
31
|
+
attr_accessor height: Integer
|
|
32
|
+
|
|
33
|
+
attr_accessor title: String
|
|
34
|
+
|
|
35
|
+
attr_accessor show_title: bool
|
|
36
|
+
|
|
37
|
+
attr_accessor show_filter: bool
|
|
38
|
+
|
|
39
|
+
attr_accessor show_pagination: bool
|
|
40
|
+
|
|
41
|
+
attr_accessor show_status_bar: bool
|
|
42
|
+
|
|
43
|
+
attr_accessor status_message_lifetime: Float
|
|
44
|
+
|
|
45
|
+
attr_accessor fill_height: bool
|
|
46
|
+
|
|
47
|
+
attr_accessor title_style: Lipgloss::Style?
|
|
48
|
+
|
|
49
|
+
attr_accessor item_style: Lipgloss::Style?
|
|
50
|
+
|
|
51
|
+
attr_accessor selected_item_style: Lipgloss::Style?
|
|
52
|
+
|
|
53
|
+
attr_accessor filter_prompt: String
|
|
54
|
+
|
|
55
|
+
attr_accessor filter_style: Lipgloss::Style?
|
|
56
|
+
|
|
57
|
+
attr_accessor status_bar_style: Lipgloss::Style?
|
|
58
|
+
|
|
59
|
+
attr_accessor pagination_style: Lipgloss::Style?
|
|
60
|
+
|
|
61
|
+
attr_reader filter_state: Symbol
|
|
62
|
+
|
|
63
|
+
attr_reader filter_input: TextInput
|
|
64
|
+
|
|
65
|
+
# : (?Array[untyped], ?width: Integer, ?height: Integer) -> void
|
|
66
|
+
def initialize: (?Array[untyped], ?width: Integer, ?height: Integer) -> void
|
|
67
|
+
|
|
68
|
+
# : (Array[untyped]) -> void
|
|
69
|
+
def items=: (Array[untyped]) -> void
|
|
70
|
+
|
|
71
|
+
attr_reader items: Array[untyped]
|
|
72
|
+
|
|
73
|
+
# : () -> Array[untyped]
|
|
74
|
+
def visible_items: () -> Array[untyped]
|
|
75
|
+
|
|
76
|
+
# : () -> Integer
|
|
77
|
+
def selected_index: () -> Integer
|
|
78
|
+
|
|
79
|
+
# : () -> untyped
|
|
80
|
+
def selected_item: () -> untyped
|
|
81
|
+
|
|
82
|
+
# : (Integer) -> void
|
|
83
|
+
def select: (Integer) -> void
|
|
84
|
+
|
|
85
|
+
# : () -> void
|
|
86
|
+
def select_next: () -> void
|
|
87
|
+
|
|
88
|
+
# : () -> void
|
|
89
|
+
def select_prev: () -> void
|
|
90
|
+
|
|
91
|
+
# : (String) -> Bubbletea::Command
|
|
92
|
+
def set_status_message: (String) -> Bubbletea::Command
|
|
93
|
+
|
|
94
|
+
# : () -> void
|
|
95
|
+
def clear_status_message: () -> void
|
|
96
|
+
|
|
97
|
+
# : () -> Bubbletea::Command?
|
|
98
|
+
def start_filtering: () -> Bubbletea::Command?
|
|
99
|
+
|
|
100
|
+
# : () -> void
|
|
101
|
+
def apply_filter: () -> void
|
|
102
|
+
|
|
103
|
+
# : () -> void
|
|
104
|
+
def reset_filter: () -> void
|
|
105
|
+
|
|
106
|
+
# : (Bubbletea::Message) -> [List, Bubbletea::Command?]
|
|
107
|
+
def update: (Bubbletea::Message) -> [ List, Bubbletea::Command? ]
|
|
108
|
+
|
|
109
|
+
# : () -> String
|
|
110
|
+
def view: () -> String
|
|
111
|
+
|
|
112
|
+
private
|
|
113
|
+
|
|
114
|
+
# : () -> String
|
|
115
|
+
def items_view: () -> String
|
|
116
|
+
|
|
117
|
+
# : (untyped, Integer, bool) -> String
|
|
118
|
+
def render_item: (untyped, Integer, bool) -> String
|
|
119
|
+
|
|
120
|
+
# : (untyped) -> String
|
|
121
|
+
def item_title: (untyped) -> String
|
|
122
|
+
|
|
123
|
+
# : (untyped) -> String
|
|
124
|
+
def item_filter_value: (untyped) -> String
|
|
125
|
+
|
|
126
|
+
# : () -> void
|
|
127
|
+
def do_filter: () -> void
|
|
128
|
+
|
|
129
|
+
# : () -> Integer
|
|
130
|
+
def visible_item_count: () -> Integer
|
|
131
|
+
|
|
132
|
+
# : () -> void
|
|
133
|
+
def update_offset: () -> void
|
|
134
|
+
|
|
135
|
+
# : () -> void
|
|
136
|
+
def update_pagination: () -> void
|
|
137
|
+
end
|
|
138
|
+
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Generated from lib/bubbles/paginator.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Bubbles
|
|
4
|
+
# Paginator provides pagination logic and rendering.
|
|
5
|
+
#
|
|
6
|
+
# Example:
|
|
7
|
+
# items = (1..100).to_a
|
|
8
|
+
# paginator = Bubbles::Paginator.new(per_page: 10)
|
|
9
|
+
# paginator.update_total_pages(items.length)
|
|
10
|
+
#
|
|
11
|
+
# # Get current page items
|
|
12
|
+
# start_index, end_index = paginator.slice_bounds(items.length)
|
|
13
|
+
# current_items = items[start_index...end_index]
|
|
14
|
+
#
|
|
15
|
+
# # Navigation
|
|
16
|
+
# paginator.next_page
|
|
17
|
+
# paginator.prev_page
|
|
18
|
+
#
|
|
19
|
+
# # Render pagination indicator
|
|
20
|
+
# puts paginator.view
|
|
21
|
+
class Paginator
|
|
22
|
+
ARABIC: Symbol
|
|
23
|
+
|
|
24
|
+
DOTS: Symbol
|
|
25
|
+
|
|
26
|
+
attr_accessor type: Symbol
|
|
27
|
+
|
|
28
|
+
attr_accessor page: Integer
|
|
29
|
+
|
|
30
|
+
attr_accessor per_page: Integer
|
|
31
|
+
|
|
32
|
+
attr_accessor total_pages: Integer
|
|
33
|
+
|
|
34
|
+
attr_accessor active_dot: String
|
|
35
|
+
|
|
36
|
+
attr_accessor inactive_dot: String
|
|
37
|
+
|
|
38
|
+
attr_accessor arabic_format: String
|
|
39
|
+
|
|
40
|
+
attr_accessor key_style: Lipgloss::Style?
|
|
41
|
+
|
|
42
|
+
attr_accessor active_dot_style: Lipgloss::Style?
|
|
43
|
+
|
|
44
|
+
attr_accessor inactive_dot_style: Lipgloss::Style?
|
|
45
|
+
|
|
46
|
+
# : (?type: Symbol, ?per_page: Integer) -> void
|
|
47
|
+
def initialize: (?type: Symbol, ?per_page: Integer) -> void
|
|
48
|
+
|
|
49
|
+
# : (Integer) -> void
|
|
50
|
+
def update_total_pages: (Integer) -> void
|
|
51
|
+
|
|
52
|
+
# : (Integer) -> Integer
|
|
53
|
+
def items_on_page: (Integer) -> Integer
|
|
54
|
+
|
|
55
|
+
# : (Integer) -> [Integer, Integer]
|
|
56
|
+
def slice_bounds: (Integer) -> [ Integer, Integer ]
|
|
57
|
+
|
|
58
|
+
# : () -> bool
|
|
59
|
+
def prev_page?: () -> bool
|
|
60
|
+
|
|
61
|
+
# : () -> bool
|
|
62
|
+
def next_page?: () -> bool
|
|
63
|
+
|
|
64
|
+
# : () -> bool
|
|
65
|
+
def prev_page: () -> bool
|
|
66
|
+
|
|
67
|
+
# : () -> bool
|
|
68
|
+
def next_page: () -> bool
|
|
69
|
+
|
|
70
|
+
# : (Integer) -> bool
|
|
71
|
+
def go_to_page: (Integer) -> bool
|
|
72
|
+
|
|
73
|
+
# : () -> String
|
|
74
|
+
def view: () -> String
|
|
75
|
+
|
|
76
|
+
private
|
|
77
|
+
|
|
78
|
+
# : () -> String
|
|
79
|
+
def arabic_view: () -> String
|
|
80
|
+
|
|
81
|
+
# : () -> String
|
|
82
|
+
def dots_view: () -> String
|
|
83
|
+
|
|
84
|
+
# : () -> String
|
|
85
|
+
def render_active_dot: () -> String
|
|
86
|
+
|
|
87
|
+
# : () -> String
|
|
88
|
+
def render_inactive_dot: () -> String
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -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
|