charming 0.2.1 → 0.2.3
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/README.md +16 -3
- data/lib/charming/application.rb +48 -0
- data/lib/charming/cli.rb +16 -4
- data/lib/charming/controller/key_dispatch.rb +113 -0
- data/lib/charming/controller/session_state.rb +11 -0
- data/lib/charming/controller/terminal.rb +33 -0
- data/lib/charming/controller.rb +13 -40
- data/lib/charming/escape.rb +81 -0
- data/lib/charming/events/mouse_event.rb +22 -9
- data/lib/charming/generators/app_file_generator.rb +29 -0
- data/lib/charming/generators/app_generator.rb +13 -25
- data/lib/charming/generators/base.rb +5 -0
- data/lib/charming/generators/layout_generator.rb +155 -0
- data/lib/charming/generators/screen_generator.rb +0 -29
- data/lib/charming/generators/templates/app/Gemfile.template +6 -0
- data/lib/charming/generators/templates/app/README.md.template +15 -1
- data/lib/charming/generators/templates/app/application.template +0 -6
- data/lib/charming/generators/templates/app/application_controller.template +0 -10
- data/lib/charming/generators/templates/app/dot_rspec.template +2 -0
- data/lib/charming/generators/templates/app/layout.template +4 -93
- data/lib/charming/generators/templates/app/routes.template +3 -1
- data/lib/charming/generators/templates/layout/sidebar/application_layout.rb.template +110 -0
- data/lib/charming/image/protocol/kitty.rb +133 -0
- data/lib/charming/image/protocol.rb +18 -0
- data/lib/charming/image/source.rb +95 -0
- data/lib/charming/image/terminal.rb +52 -0
- data/lib/charming/image/transmit.rb +11 -0
- data/lib/charming/image.rb +21 -0
- data/lib/charming/internal/event_loop.rb +155 -0
- data/lib/charming/internal/terminal/adapter.rb +14 -0
- data/lib/charming/internal/terminal/key_normalizer.rb +20 -0
- data/lib/charming/internal/terminal/memory_backend.rb +21 -3
- data/lib/charming/internal/terminal/modified_key_parser.rb +63 -0
- data/lib/charming/internal/terminal/mouse_parser.rb +32 -27
- data/lib/charming/internal/terminal/tty_backend.rb +79 -2
- data/lib/charming/presentation/components/activity_indicator.rb +2 -19
- data/lib/charming/presentation/components/autocomplete.rb +7 -0
- data/lib/charming/presentation/components/chart.rb +80 -0
- data/lib/charming/presentation/components/error_screen.rb +1 -1
- data/lib/charming/presentation/components/filepicker.rb +101 -0
- data/lib/charming/presentation/components/form/builder.rb +5 -0
- data/lib/charming/presentation/components/form/field.rb +5 -0
- data/lib/charming/presentation/components/form/input.rb +14 -4
- data/lib/charming/presentation/components/form/multiselect.rb +105 -0
- data/lib/charming/presentation/components/form/textarea.rb +18 -8
- data/lib/charming/presentation/components/form.rb +6 -0
- data/lib/charming/presentation/components/image.rb +38 -0
- data/lib/charming/presentation/components/list.rb +22 -4
- data/lib/charming/presentation/components/modal.rb +4 -4
- data/lib/charming/presentation/components/paginator.rb +54 -0
- data/lib/charming/presentation/components/progressbar.rb +26 -4
- data/lib/charming/presentation/components/sparkline.rb +38 -0
- data/lib/charming/presentation/components/spinner.rb +22 -3
- data/lib/charming/presentation/components/stopwatch.rb +55 -0
- data/lib/charming/presentation/components/table.rb +42 -1
- data/lib/charming/presentation/components/text_area.rb +3 -4
- data/lib/charming/presentation/components/text_input.rb +11 -6
- data/lib/charming/presentation/components/time_display.rb +20 -0
- data/lib/charming/presentation/components/timer.rb +43 -0
- data/lib/charming/presentation/components/toast.rb +4 -3
- data/lib/charming/presentation/components/viewport/content_lines.rb +1 -1
- data/lib/charming/presentation/components/viewport/line_window.rb +1 -1
- data/lib/charming/presentation/components/viewport.rb +11 -1
- data/lib/charming/presentation/markdown/renderer.rb +1 -1
- data/lib/charming/presentation/markdown/style_config.rb +1 -0
- data/lib/charming/presentation/markdown/table_renderer.rb +2 -3
- data/lib/charming/presentation/ui/adaptive_color.rb +20 -0
- data/lib/charming/presentation/ui/ansi_codes.rb +5 -2
- data/lib/charming/presentation/ui/background.rb +58 -0
- data/lib/charming/presentation/ui/border.rb +14 -1
- data/lib/charming/presentation/ui/border_painter.rb +23 -11
- data/lib/charming/presentation/ui/braille_canvas.rb +80 -0
- data/lib/charming/presentation/ui/canvas.rb +1 -0
- data/lib/charming/presentation/ui/gradient.rb +47 -0
- data/lib/charming/presentation/ui/style.rb +119 -19
- data/lib/charming/presentation/{markdown → ui}/text_wrapper.rb +4 -4
- data/lib/charming/presentation/ui/truncate.rb +29 -0
- data/lib/charming/presentation/ui/width.rb +11 -0
- data/lib/charming/presentation/ui.rb +52 -11
- data/lib/charming/presentation/view.rb +8 -6
- data/lib/charming/response.rb +11 -6
- data/lib/charming/runtime.rb +167 -90
- data/lib/charming/version.rb +1 -1
- data/lib/charming/welcome/controller.rb +23 -0
- data/lib/charming/welcome/show_view.rb +113 -0
- data/lib/charming/welcome.rb +13 -0
- metadata +34 -9
- data/lib/charming/generators/templates/app/home_controller.template +0 -6
- data/lib/charming/generators/templates/app/home_state.template +0 -7
- data/lib/charming/generators/templates/app/spec_controller.template +0 -17
- data/lib/charming/generators/templates/app/spec_state.template +0 -17
- data/lib/charming/generators/templates/app/spec_view.template +0 -16
- data/lib/charming/generators/templates/app/view.template +0 -21
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Charming
|
|
4
|
+
# Welcome is the built-in placeholder screen shown when an application defines no
|
|
5
|
+
# routes yet — the TUI equivalent of Rails' welcome page. It lives in the gem and is
|
|
6
|
+
# never copied into apps: defining any route in config/routes.rb replaces it.
|
|
7
|
+
module Welcome
|
|
8
|
+
# The fallback route the Runtime uses when the application has no routes.
|
|
9
|
+
def self.route
|
|
10
|
+
Router::Route.new(path: "/", controller_class: Controller, action: :show, title: "Welcome", params: {})
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: charming
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- pando
|
|
@@ -201,10 +201,13 @@ files:
|
|
|
201
201
|
- lib/charming/controller/dispatching.rb
|
|
202
202
|
- lib/charming/controller/focus.rb
|
|
203
203
|
- lib/charming/controller/focus_management.rb
|
|
204
|
+
- lib/charming/controller/key_dispatch.rb
|
|
204
205
|
- lib/charming/controller/rendering.rb
|
|
205
206
|
- lib/charming/controller/session_state.rb
|
|
206
207
|
- lib/charming/controller/sidebar_navigation.rb
|
|
208
|
+
- lib/charming/controller/terminal.rb
|
|
207
209
|
- lib/charming/database/commands.rb
|
|
210
|
+
- lib/charming/escape.rb
|
|
208
211
|
- lib/charming/events/focus_event.rb
|
|
209
212
|
- lib/charming/events/key_event.rb
|
|
210
213
|
- lib/charming/events/mouse_event.rb
|
|
@@ -220,6 +223,7 @@ files:
|
|
|
220
223
|
- lib/charming/generators/controller_generator.rb
|
|
221
224
|
- lib/charming/generators/database_installer.rb
|
|
222
225
|
- lib/charming/generators/error.rb
|
|
226
|
+
- lib/charming/generators/layout_generator.rb
|
|
223
227
|
- lib/charming/generators/migration_generator.rb
|
|
224
228
|
- lib/charming/generators/migration_timestamp.rb
|
|
225
229
|
- lib/charming/generators/model_generator.rb
|
|
@@ -233,23 +237,19 @@ files:
|
|
|
233
237
|
- lib/charming/generators/templates/app/application_record.template
|
|
234
238
|
- lib/charming/generators/templates/app/application_state.template
|
|
235
239
|
- lib/charming/generators/templates/app/database_config.template
|
|
240
|
+
- lib/charming/generators/templates/app/dot_rspec.template
|
|
236
241
|
- lib/charming/generators/templates/app/executable.template
|
|
237
242
|
- lib/charming/generators/templates/app/gemspec.template
|
|
238
|
-
- lib/charming/generators/templates/app/home_controller.template
|
|
239
|
-
- lib/charming/generators/templates/app/home_state.template
|
|
240
243
|
- lib/charming/generators/templates/app/keep.template
|
|
241
244
|
- lib/charming/generators/templates/app/layout.template
|
|
242
245
|
- lib/charming/generators/templates/app/root_file.template
|
|
243
246
|
- lib/charming/generators/templates/app/routes.template
|
|
244
247
|
- lib/charming/generators/templates/app/seeds.template
|
|
245
|
-
- lib/charming/generators/templates/app/spec_controller.template
|
|
246
248
|
- lib/charming/generators/templates/app/spec_helper.template
|
|
247
|
-
- lib/charming/generators/templates/app/spec_state.template
|
|
248
|
-
- lib/charming/generators/templates/app/spec_view.template
|
|
249
249
|
- lib/charming/generators/templates/app/version.template
|
|
250
|
-
- lib/charming/generators/templates/app/view.template
|
|
251
250
|
- lib/charming/generators/templates/component/component.rb.template
|
|
252
251
|
- lib/charming/generators/templates/controller/controller.rb.template
|
|
252
|
+
- lib/charming/generators/templates/layout/sidebar/application_layout.rb.template
|
|
253
253
|
- lib/charming/generators/templates/model/migration.rb.template
|
|
254
254
|
- lib/charming/generators/templates/model/model.rb.template
|
|
255
255
|
- lib/charming/generators/templates/model/spec.rb.template
|
|
@@ -261,11 +261,19 @@ files:
|
|
|
261
261
|
- lib/charming/generators/templates/screen/view.rb.template
|
|
262
262
|
- lib/charming/generators/templates/view/view.rb.template
|
|
263
263
|
- lib/charming/generators/view_generator.rb
|
|
264
|
+
- lib/charming/image.rb
|
|
265
|
+
- lib/charming/image/protocol.rb
|
|
266
|
+
- lib/charming/image/protocol/kitty.rb
|
|
267
|
+
- lib/charming/image/source.rb
|
|
268
|
+
- lib/charming/image/terminal.rb
|
|
269
|
+
- lib/charming/image/transmit.rb
|
|
270
|
+
- lib/charming/internal/event_loop.rb
|
|
264
271
|
- lib/charming/internal/renderer/differential.rb
|
|
265
272
|
- lib/charming/internal/renderer/full_repaint.rb
|
|
266
273
|
- lib/charming/internal/terminal/adapter.rb
|
|
267
274
|
- lib/charming/internal/terminal/key_normalizer.rb
|
|
268
275
|
- lib/charming/internal/terminal/memory_backend.rb
|
|
276
|
+
- lib/charming/internal/terminal/modified_key_parser.rb
|
|
269
277
|
- lib/charming/internal/terminal/mouse_parser.rb
|
|
270
278
|
- lib/charming/internal/terminal/tty_backend.rb
|
|
271
279
|
- lib/charming/presentation/component.rb
|
|
@@ -274,32 +282,41 @@ files:
|
|
|
274
282
|
- lib/charming/presentation/components/autocomplete.rb
|
|
275
283
|
- lib/charming/presentation/components/badge.rb
|
|
276
284
|
- lib/charming/presentation/components/breadcrumbs.rb
|
|
285
|
+
- lib/charming/presentation/components/chart.rb
|
|
277
286
|
- lib/charming/presentation/components/command_palette.rb
|
|
278
287
|
- lib/charming/presentation/components/command_palette_modal.rb
|
|
279
288
|
- lib/charming/presentation/components/empty_state.rb
|
|
280
289
|
- lib/charming/presentation/components/error_screen.rb
|
|
290
|
+
- lib/charming/presentation/components/filepicker.rb
|
|
281
291
|
- lib/charming/presentation/components/form.rb
|
|
282
292
|
- lib/charming/presentation/components/form/builder.rb
|
|
283
293
|
- lib/charming/presentation/components/form/confirm.rb
|
|
284
294
|
- lib/charming/presentation/components/form/field.rb
|
|
285
295
|
- lib/charming/presentation/components/form/input.rb
|
|
296
|
+
- lib/charming/presentation/components/form/multiselect.rb
|
|
286
297
|
- lib/charming/presentation/components/form/note.rb
|
|
287
298
|
- lib/charming/presentation/components/form/select.rb
|
|
288
299
|
- lib/charming/presentation/components/form/textarea.rb
|
|
289
300
|
- lib/charming/presentation/components/fuzzy_matcher.rb
|
|
290
301
|
- lib/charming/presentation/components/help_overlay.rb
|
|
302
|
+
- lib/charming/presentation/components/image.rb
|
|
291
303
|
- lib/charming/presentation/components/keyboard_handler.rb
|
|
292
304
|
- lib/charming/presentation/components/list.rb
|
|
293
305
|
- lib/charming/presentation/components/markdown.rb
|
|
294
306
|
- lib/charming/presentation/components/modal.rb
|
|
295
307
|
- lib/charming/presentation/components/multi_select_list.rb
|
|
308
|
+
- lib/charming/presentation/components/paginator.rb
|
|
296
309
|
- lib/charming/presentation/components/progressbar.rb
|
|
310
|
+
- lib/charming/presentation/components/sparkline.rb
|
|
297
311
|
- lib/charming/presentation/components/spinner.rb
|
|
298
312
|
- lib/charming/presentation/components/status_bar.rb
|
|
313
|
+
- lib/charming/presentation/components/stopwatch.rb
|
|
299
314
|
- lib/charming/presentation/components/tab_bar.rb
|
|
300
315
|
- lib/charming/presentation/components/table.rb
|
|
301
316
|
- lib/charming/presentation/components/text_area.rb
|
|
302
317
|
- lib/charming/presentation/components/text_input.rb
|
|
318
|
+
- lib/charming/presentation/components/time_display.rb
|
|
319
|
+
- lib/charming/presentation/components/timer.rb
|
|
303
320
|
- lib/charming/presentation/components/toast.rb
|
|
304
321
|
- lib/charming/presentation/components/tree.rb
|
|
305
322
|
- lib/charming/presentation/components/viewport.rb
|
|
@@ -322,19 +339,23 @@ files:
|
|
|
322
339
|
- lib/charming/presentation/markdown/style_config.rb
|
|
323
340
|
- lib/charming/presentation/markdown/syntax_highlighter.rb
|
|
324
341
|
- lib/charming/presentation/markdown/table_renderer.rb
|
|
325
|
-
- lib/charming/presentation/markdown/text_wrapper.rb
|
|
326
342
|
- lib/charming/presentation/markdown/url_resolver.rb
|
|
327
343
|
- lib/charming/presentation/template_view.rb
|
|
328
344
|
- lib/charming/presentation/templates.rb
|
|
329
345
|
- lib/charming/presentation/templates/erb_handler.rb
|
|
330
346
|
- lib/charming/presentation/ui.rb
|
|
347
|
+
- lib/charming/presentation/ui/adaptive_color.rb
|
|
331
348
|
- lib/charming/presentation/ui/ansi_codes.rb
|
|
332
349
|
- lib/charming/presentation/ui/ansi_slicer.rb
|
|
350
|
+
- lib/charming/presentation/ui/background.rb
|
|
333
351
|
- lib/charming/presentation/ui/border.rb
|
|
334
352
|
- lib/charming/presentation/ui/border_painter.rb
|
|
353
|
+
- lib/charming/presentation/ui/braille_canvas.rb
|
|
335
354
|
- lib/charming/presentation/ui/canvas.rb
|
|
336
355
|
- lib/charming/presentation/ui/color_support.rb
|
|
356
|
+
- lib/charming/presentation/ui/gradient.rb
|
|
337
357
|
- lib/charming/presentation/ui/style.rb
|
|
358
|
+
- lib/charming/presentation/ui/text_wrapper.rb
|
|
338
359
|
- lib/charming/presentation/ui/theme.rb
|
|
339
360
|
- lib/charming/presentation/ui/themes/catppuccin-latte.json
|
|
340
361
|
- lib/charming/presentation/ui/themes/catppuccin-mocha.json
|
|
@@ -342,6 +363,7 @@ files:
|
|
|
342
363
|
- lib/charming/presentation/ui/themes/nord.json
|
|
343
364
|
- lib/charming/presentation/ui/themes/phosphor.json
|
|
344
365
|
- lib/charming/presentation/ui/themes/tokyonight.json
|
|
366
|
+
- lib/charming/presentation/ui/truncate.rb
|
|
345
367
|
- lib/charming/presentation/ui/width.rb
|
|
346
368
|
- lib/charming/presentation/view.rb
|
|
347
369
|
- lib/charming/response.rb
|
|
@@ -355,6 +377,9 @@ files:
|
|
|
355
377
|
- lib/charming/tasks/threaded_executor.rb
|
|
356
378
|
- lib/charming/test_helper.rb
|
|
357
379
|
- lib/charming/version.rb
|
|
380
|
+
- lib/charming/welcome.rb
|
|
381
|
+
- lib/charming/welcome/controller.rb
|
|
382
|
+
- lib/charming/welcome/show_view.rb
|
|
358
383
|
- sig/charming.rbs
|
|
359
384
|
homepage: https://github.com/pandorocks/charming
|
|
360
385
|
licenses:
|
|
@@ -377,7 +402,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
377
402
|
- !ruby/object:Gem::Version
|
|
378
403
|
version: '0'
|
|
379
404
|
requirements: []
|
|
380
|
-
rubygems_version: 4.0.
|
|
405
|
+
rubygems_version: 4.0.16
|
|
381
406
|
specification_version: 4
|
|
382
407
|
summary: A Rails-inspired TUI framework for Ruby.
|
|
383
408
|
test_files: []
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "__APP_SNAKE__"
|
|
4
|
-
|
|
5
|
-
RSpec.describe __APP_CLASS__::HomeController do
|
|
6
|
-
let(:application) { __APP_CLASS__::Application.new }
|
|
7
|
-
|
|
8
|
-
subject(:controller) { described_class.new(application: application) }
|
|
9
|
-
|
|
10
|
-
describe "#show" do
|
|
11
|
-
it "renders the view with the state" do
|
|
12
|
-
response = controller.dispatch(:show)
|
|
13
|
-
|
|
14
|
-
expect(response).to respond_to(:body)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "__APP_SNAKE__"
|
|
4
|
-
|
|
5
|
-
RSpec.describe __APP_CLASS__::HomeState do
|
|
6
|
-
describe "#title" do
|
|
7
|
-
it "has the correct default string value" do
|
|
8
|
-
instance = described_class.new
|
|
9
|
-
expect(instance.title).to eq("__APP_NAME__")
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it "accepts overridden title values" do
|
|
13
|
-
instance = described_class.new(title: "Alternative")
|
|
14
|
-
expect(instance.title).to eq("Alternative")
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "__APP_SNAKE__"
|
|
4
|
-
|
|
5
|
-
RSpec.describe __APP_CLASS__::Home::ShowView do
|
|
6
|
-
describe "#render" do
|
|
7
|
-
it "renders the state title" do
|
|
8
|
-
view = described_class.new(
|
|
9
|
-
home: double(title: "__APP_NAME__"),
|
|
10
|
-
theme: __APP_CLASS__::Application.new.theme
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
expect(view.render).to include("__APP_NAME__")
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module __APP_CLASS__
|
|
4
|
-
module Home
|
|
5
|
-
class ShowView < Charming::View
|
|
6
|
-
def render
|
|
7
|
-
column(title_line, help_line, gap: 1)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
private
|
|
11
|
-
|
|
12
|
-
def title_line
|
|
13
|
-
text home.title, style: theme.title
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def help_line
|
|
17
|
-
text "Press ctrl+p for commands, q to quit.", style: theme.muted
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|