Comprehensive component factory mixin.
Can be included in Builder, StackBuilder, Screen, or any custom class.
Instance methods
<<(el : Element) : Element
Sourceadd(el : Element) : Element
Appends an existing element into the current builder context.
Sourceadd_element(el : Element) : Element
Appends an element into the current builder context.
Builders override this to store in @root or @elements.
Sourceasync_mermaid_viewer(label :
String = "
Generating diagram...", &block : ->
String) :
AsyncMermaidViewer Declarative DSL helper for async mermaid viewer with background computation
Sourcecharacter_grid(interval_x :
Int32 = 8, interval_y :
Int32 = 4, offset_x :
Int32 = 0, offset_y :
Int32 = 0, style :
Symbol |
Graphics::GridStylePreset |
Graphics::GridGlyphs = :solid, fg :
Color =
Color.hex("#6272
A4"), bg :
Color =
Color.none, intersection_fg :
Color |
Nil =
Color.hex("#8
BE9FD"), major_interval_x :
Int32 |
Nil = nil, major_interval_y :
Int32 |
Nil = nil, major_fg :
Color |
Nil =
Color.hex("#
BD93F9"), show_horizontal :
Bool = true, show_vertical :
Bool = true, show_coordinates :
Bool = false, show_border :
Bool = true, border_color :
Color =
Color.hex("#6272
A4"), border_style :
Symbol = :rounded, title :
String |
Nil = "
Character Grid", width :
Int32 |
Nil = 30, height :
Int32 |
Nil = 12) :
CharacterGrid Sourcecollapsible(title :
String, collapsed :
Bool = true, disabled :
Bool = false, child :
Element |
Nil = nil, &) :
Collapsible Sourcecollapsible(title :
String, child :
Element |
Nil = nil, collapsed :
Bool = true, disabled :
Bool = false) :
Collapsible Sourcecolor_picker_3d(shape :
ColorPickerShape =
ColorPickerShape::Cube3D, pitch :
Float64 = 0.42, yaw :
Float64 = 0.58, auto_rotate :
Bool = false, initial_color :
Color =
Color.hex("#89
B4FA"), size :
Int32 = 12) :
ColorPicker3D Sourcecompact_meter(value :
Float64) :
Text Compact 1-character meter glyph
Sourcecontainer(title :
String |
Nil = nil, direction :
LayoutDirection =
LayoutDirection::Vertical, overflow :
OverflowPolicy =
OverflowPolicy::Hidden, border :
Border =
Border.none, padding :
Int32 = 0, &) :
Group Sourcecontent_switcher(current :
String |
Nil = nil, &) :
ContentSwitcher Sourcecustom(el : Element) : Element
Alias for inserting custom elements or controls.
Sourcegame_loop(target_fps :
Int32 = 60, tick_rate :
Int32 = 60, &block :
Game::Loop ->
Nil) :
Game::Loop DSL extension for Game Loop
Sourcegroup(title :
String |
Nil = nil, direction :
LayoutDirection =
LayoutDirection::Vertical, overflow :
OverflowPolicy =
OverflowPolicy::Hidden, border :
Border =
Border.none, padding :
Int32 = 0, &) :
Group Group layout container supporting directional flow and overflow clipping
Sourcehtml_browser(initial_url :
String = "about:home", enable_osc8 :
Bool = true, &block :
HTMLBrowser ->
Nil) :
HTMLBrowser Declarative DSL helper to construct a TUI HTML web browser component
Sourcehtml_browser(initial_url :
String = "about:home", enable_osc8 :
Bool = true) :
HTMLBrowser Sourceimage_view(path :
String, protocol :
Image::Protocol =
Image::Protocol::Auto) :
ImageView Sourcemarkdown(content :
String, width :
Int32 = 80) :
MarkdownElement Sourcemarkdown_viewer(content :
String, scrollable :
Bool = true, auto_scroll :
Bool = false, scroll_speed :
Float64 = 1.0, width :
Int32 = 80) :
MarkdownViewer Interactive Markdown Viewer element
Sourcemask(mask_map :
MaskMap, feather :
Bool = true, offset_x :
Int32 = 0, offset_y :
Int32 = 0, &) :
MaskContainer Masking container rendering children under an active MaskMap
Sourcemermaid_viewer(diagram_text :
String, scrollable :
Bool = true, auto_scroll :
Bool = false, scroll_speed :
Float64 = 1.0, border :
Border =
Border.rounded) :
MermaidViewer Declarative DSL helper to construct a Mermaid diagram viewer
Sourcemesh_3d(mesh :
Opal::Graphics::Mesh3D, camera_dist :
Float64 = 3.5, pitch :
Float64 = 0.0, yaw :
Float64 = 0.0, roll :
Float64 = 0.0, render_mode :
Symbol |
MeshRenderMode = :wireframe, border :
Symbol |
Border = :rounded, width :
Int32 |
Nil = nil, height :
Int32 |
Nil = nil) :
Mesh3DElement Sourcemeter(value :
Float64, orientation :
MeterOrientation =
MeterOrientation::Horizontal, gradient :
MeterGradient =
MeterGradient::Heat, show_label :
Bool = true, width :
Int32 |
Nil = nil, height :
Int32 |
Nil = nil) :
Meter Fractional 1/8th Unicode block meter
Sourcepalette(model :
PaletteModel, picker_mode :
ColorMode =
ColorMode::RGB, picker_layout :
ColorPickerLayout =
ColorPickerLayout::Sliders, title :
String = "
Color Palette", width :
Int32 |
Nil = 54, height :
Int32 |
Nil = 16) :
Palette Sourcepalette(colors :
Array(
Color), min_colors :
Int32 |
Nil = nil, max_colors :
Int32 |
Nil = nil, allow_add :
Bool = true, allow_remove :
Bool = true, allow_reorder :
Bool = true, picker_mode :
ColorMode =
ColorMode::RGB, picker_layout :
ColorPickerLayout =
ColorPickerLayout::Sliders, title :
String = "
Indexed Palette", width :
Int32 |
Nil = 54, height :
Int32 |
Nil = 16) :
Palette Sourcepalette(entries :
Hash(
String,
Color), allow_add :
Bool = true, allow_rename :
Bool = true, allow_remove :
Bool = true, picker_mode :
ColorMode =
ColorMode::RGB, picker_layout :
ColorPickerLayout =
ColorPickerLayout::Sliders, title :
String = "
Named Palette", width :
Int32 |
Nil = 54, height :
Int32 |
Nil = 16) :
Palette Sourceplaceholder(label :
String |
Nil = nil, border :
Symbol |
Border = :rounded) :
Placeholder Sourcescissor(rect : Rect, &) : ScissorContainer
Scissor clipping container restricting child rendering to a specific rect
Sourcescrollbar(orientation :
ScrollBar::Orientation |
Symbol =
ScrollBar::Orientation::Vertical, min_value :
Int32 = 0, max_value :
Int32 = 100, value :
Int32 = 0, page_size :
Int32 = 10, length :
Int32 |
Nil = nil, total :
Int32 |
Nil = nil, show_arrows :
Bool = true, &on_scroll :
Int32 ->
Nil) :
ScrollBar Sourcescrollbar(orientation :
ScrollBar::Orientation |
Symbol =
ScrollBar::Orientation::Vertical, min_value :
Int32 = 0, max_value :
Int32 = 100, value :
Int32 = 0, page_size :
Int32 = 10, length :
Int32 |
Nil = nil, total :
Int32 |
Nil = nil, show_arrows :
Bool = true) :
ScrollBar Sourcesplit_view(direction :
SplitDirection =
SplitDirection::Horizontal, ratio :
Float64 |
Nil = 0.5, first_size :
Int32 |
Nil = nil, second_size :
Int32 |
Nil = nil, separator :
Char |
Nil = nil, separator_fg :
Color |
Symbol |
String =
Color.none, focused_pane :
Symbol = :first, show_separator :
Bool = true, &) :
SplitView Sourcetarget_selector_2d(x_range :
Range(
Float64,
Float64) = 0.0..1.0, y_range :
Range(
Float64,
Float64) = 0.0..1.0, initial_x :
Float64 |
Nil = nil, initial_y :
Float64 |
Nil = nil, reticle_char :
Char = '⌖', show_coordinates :
Bool = true, border :
Bool = true, width :
Int32 |
Nil = 24, height :
Int32 |
Nil = 10, &block :
Float64,
Float64 ->
Color) :
TargetSelector2D Sourcetarget_selector_2d(x_range :
Range(
Float64,
Float64) = 0.0..1.0, y_range :
Range(
Float64,
Float64) = 0.0..1.0, initial_x :
Float64 |
Nil = nil, initial_y :
Float64 |
Nil = nil, reticle_char :
Char = '⌖', show_coordinates :
Bool = true, border :
Bool = true, width :
Int32 |
Nil = 24, height :
Int32 |
Nil = 10) :
TargetSelector2D Sourcewindow(title :
String, x :
Int32 = 0, y :
Int32 = 0, width :
Int32 = 40, height :
Int32 = 15, border :
Symbol |
Border = :rounded, resizable :
Bool = true, minimizable :
Bool = true, maximizable :
Bool = true, child :
Element |
Nil = nil, &) :
Window Sourcewindow(title :
String, x :
Int32 = 0, y :
Int32 = 0, width :
Int32 = 40, height :
Int32 = 15, border :
Symbol |
Border = :rounded, resizable :
Bool = true, minimizable :
Bool = true, maximizable :
Bool = true, child :
Element |
Nil = nil) :
Window Source