module Opal
Overview
Opal: Next-generation TUI and CLI DSL framework for Crystal. Unifies The Elm Architecture (Bubbletea), Declarative Layout (Ink), and Low-Level Double-Buffered Terminal Diffing (Blessed).
Defined in:
opal.cropal/animation/animator.cr
opal/asciicast.cr
opal/asciicast/asciinema.cr
opal/asciicast/driver.cr
opal/asciicast/event.cr
opal/asciicast/header.cr
opal/asciicast/playback_engine.cr
opal/asciicast/reader.cr
opal/asciicast/screen_recorder.cr
opal/asciicast/uploader.cr
opal/asciicast/vcr.cr
opal/asciicast/writer.cr
opal/async/worker.cr
opal/cli.cr
opal/cli/app.cr
opal/cli/argument.cr
opal/cli/command.cr
opal/cli/completion.cr
opal/cli/context.cr
opal/cli/help.cr
opal/cli/main.cr
opal/cli/option.cr
opal/cli/parser.cr
opal/cli/tools/box_tool.cr
opal/cli/tools/chart_tool.cr
opal/cli/tools/choose_tool.cr
opal/cli/tools/color_picker_tool.cr
opal/cli/tools/confirm_tool.cr
opal/cli/tools/gauge_tool.cr
opal/cli/tools/input_reader.cr
opal/cli/tools/markdown_tool.cr
opal/cli/tools/misc_tools.cr
opal/cli/tools/palette_tool.cr
opal/cli/tools/remap_tool.cr
opal/cli/tools/table_tool.cr
opal/cli/tools/target_tool.cr
opal/cli/tools/tree_tool.cr
opal/clipboard.cr
opal/form.cr
opal/form/field.cr
opal/form/form.cr
opal/form/validator.cr
opal/game.cr
opal/game/loop.cr
opal/game/pong.cr
opal/gamepad.cr
opal/gamepad/focus_mapper.cr
opal/gamepad/mock_dsl.cr
opal/gamepad/types.cr
opal/gamepad/virtual_cursor.cr
opal/gamepad/xinput.cr
opal/graphics/grid_style.cr
opal/graphics/primitives_2d.cr
opal/graphics/primitives_3d.cr
opal/html.cr
opal/html/browser.cr
opal/html/parser.cr
opal/image.cr
opal/image/pixel_buffer.cr
opal/image/protocols.cr
opal/input.cr
opal/input/autocomplete.cr
opal/input/core/remap_model.cr
opal/input/dsl/remap_builder.cr
opal/input/fuzzy.cr
opal/input/key_map.cr
opal/input/mouse_map.cr
opal/input/text_input.cr
opal/mermaid.cr
opal/mermaid/ast.cr
opal/mermaid/parser.cr
opal/mermaid/renderer.cr
opal/mermaid/viewer.cr
opal/prompt.cr
opal/prompt/ask.cr
opal/prompt/confirm.cr
opal/prompt/multi_select.cr
opal/prompt/progress.cr
opal/prompt/select.cr
opal/prompt/spinner.cr
opal/shader.cr
opal/shader/context.cr
opal/shader/fast_math.cr
opal/shader/pass.cr
opal/shader/pipeline.cr
opal/shader/presets.cr
opal/style.cr
opal/style/animation.cr
opal/style/border.cr
opal/style/color.cr
opal/style/color_spaces.cr
opal/style/glyph_set.cr
opal/style/glyphs.cr
opal/style/layout.cr
opal/style/palette_formats.cr
opal/style/palette_model.cr
opal/style/style.cr
opal/style/theme.cr
opal/style/theme_store.cr
opal/style/visual_width.cr
opal/tea.cr
opal/tea/cmd.cr
opal/tea/model.cr
opal/tea/msg.cr
opal/tea/program.cr
opal/terminal.cr
opal/terminal/ansi_parser.cr
opal/terminal/ascii.cr
opal/terminal/driver.cr
opal/terminal/info.cr
opal/terminal/mock.cr
opal/terminal/osc.cr
opal/terminal/posix.cr
opal/terminal/raw_mode.cr
opal/terminal/screen.cr
opal/terminal/windows.cr
opal/testing.cr
opal/testing/buffer_assertions.cr
opal/testing/frame_recorder.cr
opal/testing/pilot.cr
opal/testing/teatest.cr
opal/ui.cr
opal/ui/buffer.cr
opal/ui/cell.cr
opal/ui/components/ascii_image.cr
opal/ui/components/badge.cr
opal/ui/components/barchart.cr
opal/ui/components/binary_metrics.cr
opal/ui/components/box.cr
opal/ui/components/button.cr
opal/ui/components/canvas_2d.cr
opal/ui/components/character_grid.cr
opal/ui/components/checkbox.cr
opal/ui/components/code_view.cr
opal/ui/components/collapsible.cr
opal/ui/components/color_picker.cr
opal/ui/components/color_picker_3d.cr
opal/ui/components/command_palette.cr
opal/ui/components/content_switcher.cr
opal/ui/components/curve_editor.cr
opal/ui/components/digits.cr
opal/ui/components/dropdown.cr
opal/ui/components/equation_viewer.cr
opal/ui/components/file_dialog.cr
opal/ui/components/filter_list.cr
opal/ui/components/footer.cr
opal/ui/components/gauge.cr
opal/ui/components/group.cr
opal/ui/components/header.cr
opal/ui/components/hex_viewer.cr
opal/ui/components/input_remapper.cr
opal/ui/components/line_graph.cr
opal/ui/components/link.cr
opal/ui/components/loading_indicator.cr
opal/ui/components/mask.cr
opal/ui/components/mesh_3d.cr
opal/ui/components/meter.cr
opal/ui/components/modal.cr
opal/ui/components/palette.cr
opal/ui/components/pie_chart.cr
opal/ui/components/placeholder.cr
opal/ui/components/radio_set.cr
opal/ui/components/rich_log.cr
opal/ui/components/rule.cr
opal/ui/components/scissor.cr
opal/ui/components/scrollbar.cr
opal/ui/components/slider.cr
opal/ui/components/sparkline.cr
opal/ui/components/split_view.cr
opal/ui/components/stack.cr
opal/ui/components/switch.cr
opal/ui/components/table.cr
opal/ui/components/tabs.cr
opal/ui/components/target_selector_2d.cr
opal/ui/components/text.cr
opal/ui/components/toast.cr
opal/ui/components/tree.cr
opal/ui/components/viewport.cr
opal/ui/components/window.cr
opal/ui/control.cr
opal/ui/diff_renderer.cr
opal/ui/dsl.cr
opal/ui/dsl_methods.cr
opal/ui/element.cr
opal/ui/engine.cr
opal/ui/input_hookable.cr
opal/ui/layer.cr
opal/ui/layer_stack.cr
opal/ui/layouts/dock.cr
opal/ui/layouts/grid.cr
opal/ui/markdown/renderer.cr
opal/ui/mask.cr
opal/ui/query.cr
opal/ui/rect.cr
opal/ui/screen.cr
opal/ui/screen_stack.cr
opal/ui/themable.cr
opal/version.cr
Constant Summary
-
VERSION =
"0.1.65"
Class Method Summary
-
.ask(question : String, default : String | Nil = nil, required : Bool = false) : String
Top-level Opal shortcuts
-
.autocomplete(&block : Input::Autocomplete -> Nil) : Input::Autocomplete
Convenience DSL to define an Autocomplete engine
-
.cli(name : String, version : String = "0.1.0", &block : CLI::App -> Nil) : CLI::App
Convenience DSL to define and configure a CLI application.
-
.clipboard : Clipboard.class
Access to the universal clipboard subsystem.
- .confirm(question : String, default : Bool = true) : Bool
-
.copy_to_clipboard(text : String, io : IO = STDOUT) : Bool
Copies text to the system clipboard using OSC 52 and native OS tools.
-
.discussion_link(repo : String, number : Int32 | String, label : String | Nil = nil, id : String | Nil = nil) : String
Creates an OSC 8 hyperlink for a GitHub Discussion (
Discussion #XX). -
.file_dialog(initial_path : String = ".", mode : Symbol = :open_file, show_hidden : Bool = false, filters : Array(String) = [] of String, preview : Proc(String, String) | Nil = nil, driver : Terminal::Driver | Nil = nil) : String | Nil
High-level interactive file dialog helper
-
.filter(items : Array(String), title : String = "Filter Items", preview : Proc(String, String) | Nil = nil, driver : Terminal::Driver | Nil = nil) : String | Nil
High-level interactive filter prompt helper.
-
.form(title : String = "Form", &block : FormModule::Form -> Nil) : Hash(String, FormValue) | Nil
High-level entry point to declare and run an interactive form.
-
.github_link(repo : String, kind : Symbol | String, number : Int32 | String, label : String | Nil = nil, id : String | Nil = nil) : String
Creates an OSC 8 hyperlink for a GitHub repository, RFC/Discussion, Issue, or PR.
-
.hyperlink(text : String, url : String, id : String | Nil = nil) : String
Creates a clickable OSC 8 hyperlink for modern terminals.
-
.input_map(profile_name : String = "Default Controls", max_slots : Int32 = 2, conflict_policy : Input::Core::ConflictPolicy | Symbol | String = :allow, gamepad_style : Input::Core::GamepadStyle | Symbol | String = :dualshock, &) : Input::Core::InputRemapModel
Top-level declarative helper for building an InputRemapModel
-
.issue_link(repo : String, number : Int32 | String, label : String | Nil = nil, id : String | Nil = nil) : String
Creates an OSC 8 hyperlink for a GitHub Issue (
Issue #XX). -
.link(url : String, label : String | Nil = nil, id : String | Nil = nil) : String
Declarative
link(url, label)OSC 8 terminal hyperlink helper. -
.manage_palette(palette : UI::Palette, driver : Terminal::Driver | Nil = nil, output : IO | Nil = nil) : PaletteModel | Nil
High-level interactive palette runner for CLI or embedding.
-
.mock_gamepad(driver : Input::Gamepad::Driver = Input::Gamepad::Driver.new, &block : Input::Gamepad::MockDSL -> Nil) : Input::Gamepad::Driver
Top-level helper for declarative mock gamepad testing
- .multi_select(question : String, options : Array(String), default_indices : Array(Int32) = [] of Int32) : Array(String)
-
.new_file_dialog(initial_path : String = ".", is_folder : Bool = false, driver : Terminal::Driver | Nil = nil) : String | Nil
High-level helper for creating new files or folders
-
.on_key(&block : Input::KeyMap -> Nil) : Input::KeyMap
Convenience DSL builder for key bindings
-
.on_mouse(&block : Input::MouseMap -> Nil) : Input::MouseMap
Convenience DSL builder for mouse routing
-
.open_file_dialog(initial_path : String = ".", filters : Array(String) = [] of String, driver : Terminal::Driver | Nil = nil) : String | Nil
High-level helper for opening files
-
.open_folder_dialog(initial_path : String = ".", driver : Terminal::Driver | Nil = nil) : String | Nil
High-level helper for choosing folders
-
.pick_color(initial : Color = Color.hex("#89B4FA"), driver : Terminal::Driver | Nil = nil, mode : UI::ColorMode = UI::ColorMode::RGB, layout : UI::ColorPickerLayout = UI::ColorPickerLayout::Studio, show_harmonies : Bool = true, show_select_button : Bool = true, output : IO | Nil = nil) : Color | Nil
High-level interactive color picker helper.
-
.pick_color_3d(initial_shape : UI::ColorPickerShape = UI::ColorPickerShape::Cube3D, auto_rotate : Bool = false, driver : Terminal::Driver | Nil = nil) : Color | Nil
High-level standalone runner for 3D rotatable color picker
-
.pixel_buffer(width : Int32, height : Int32, default_color : Color = Color.none) : Image::PixelBuffer
Creates a new PixelBuffer with specified width, height, and optional default color.
-
.pr_link(repo : String, number : Int32 | String, label : String | Nil = nil, id : String | Nil = nil) : String
Creates an OSC 8 hyperlink for a GitHub Pull Request (
PR #XX). -
.print_markdown(text : String, io : IO = STDOUT, width : Int32 | Nil = nil) : Nil
Prints Markdown text directly to IO stream.
- .progress(total : Int32, bar_width : Int32 = 30, color : Color | Symbol | String = :cyan, title : String | Nil = nil, &block : Prompt::ProgressBar -> Nil) : Nil
-
.prompt_autocomplete(prompt : String = "> ", candidates : Array(String) = [] of String, driver : Terminal::Driver | Nil = nil, &block : Input::Autocomplete -> Nil) : String
Convenience DSL to prompt with tab autocomplete and ghost text
- .prompt_autocomplete(prompt : String = "> ", candidates : Array(String) = [] of String, driver : Terminal::Driver | Nil = nil) : String
-
.remap_inputs(remapper : UI::InputRemapper, driver : Terminal::Driver | Nil = nil, output : IO | Nil = nil) : Input::Core::InputRemapModel | Nil
High-level interactive input remapper runner for CLI or modal invocation.
-
.render_markdown(text : String, width : Int32 = 80) : String
Renders Markdown text directly to an ANSI formatted string.
-
.render_ui(width : Int32 = 80, height : Int32 = 24, with_ansi : Bool = false, &) : String
Convenience shortcut to render a declarative UI tree
-
.render_ui_ansi(width : Int32 = 80, height : Int32 = 24, &) : String
Convenience shortcut to render a declarative UI tree with ANSI colors and OSC 8 hyperlinks
-
.rfc_link(repo : String, number : Int32 | String, label : String | Nil = nil, id : String | Nil = nil) : String
Creates an OSC 8 hyperlink for a GitHub RFC Discussion (
RFC #XX). -
.run_tea(model : TEA::Model, driver : Terminal::Driver | Nil = nil, alt_screen : Bool = true, diff_render : Bool = true, mouse_enabled : Bool = true, record_cast : String | Nil = nil, cast_title : String = "Opal Session") : TEA::Model
Overload run_tea with record_cast support
-
.save_file_dialog(initial_path : String = ".", default_name : String = "untitled.txt", filters : Array(String) = [] of String, driver : Terminal::Driver | Nil = nil) : String | Nil
High-level helper for saving files
- .select(question : String, options : Array(String), default_index : Int32 = 0) : String
-
.shader_pipeline(&block : Shader::Pipeline -> Nil) : Shader::Pipeline
Shortcut to construct a shader pipeline.
- .spinner(text : String, &block : Prompt::Spinner -> T) : T forall T
-
.style : Style
Convenience helper to create a new Style instance
-
.terminal : Terminal::Info
Returns terminal information object
-
.terminal(&block : Terminal::Info -> T) : T forall T
Executes a block with the terminal information DSL
-
.theme(name : String, &block : ThemeBuilder -> Nil) : Theme
Top-level DSL helper: Opal.theme "my_theme" do |t| ...
-
.theme : Theme
Returns the current active Theme
-
.theme=(theme : Theme | Symbol | String) : Theme
Sets the current active Theme by symbol, string, or Theme instance
-
.theme_store : ThemeStore.class
Returns the global ThemeStore registry
Class Method Detail
Top-level Opal shortcuts
Convenience DSL to define an Autocomplete engine
Convenience DSL to define and configure a CLI application.
Copies text to the system clipboard using OSC 52 and native OS tools.
Creates an OSC 8 hyperlink for a GitHub Discussion (Discussion #XX).
High-level interactive filter prompt helper.
High-level entry point to declare and run an interactive form.
Creates an OSC 8 hyperlink for a GitHub repository, RFC/Discussion, Issue, or PR.
Creates a clickable OSC 8 hyperlink for modern terminals.
Top-level declarative helper for building an InputRemapModel
Creates an OSC 8 hyperlink for a GitHub Issue (Issue #XX).
Declarative link(url, label) OSC 8 terminal hyperlink helper.
If label is omitted, defaults to url. Also supports (label, url) if the second argument is a URI.
High-level interactive palette runner for CLI or embedding.
Top-level helper for declarative mock gamepad testing
High-level helper for creating new files or folders
Convenience DSL builder for key bindings
Convenience DSL builder for mouse routing
High-level helper for opening files
High-level helper for choosing folders
High-level interactive color picker helper.
High-level standalone runner for 3D rotatable color picker
Creates a new PixelBuffer with specified width, height, and optional default color.
Creates an OSC 8 hyperlink for a GitHub Pull Request (PR #XX).
Prints Markdown text directly to IO stream.
Convenience DSL to prompt with tab autocomplete and ghost text
High-level interactive input remapper runner for CLI or modal invocation.
Renders Markdown text directly to an ANSI formatted string.
Convenience shortcut to render a declarative UI tree
Convenience shortcut to render a declarative UI tree with ANSI colors and OSC 8 hyperlinks
Creates an OSC 8 hyperlink for a GitHub RFC Discussion (RFC #XX).
Overload run_tea with record_cast support
High-level helper for saving files
Shortcut to construct a shader pipeline.
Executes a block with the terminal information DSL
Top-level DSL helper: Opal.theme "my_theme" do |t| ... end
Sets the current active Theme by symbol, string, or Theme instance