class Opal::UI::ScreenStack

Overview

Screen stack orchestrator inspired by Python Textual's Screen Stack. Manages navigation flow, modal dialog layering, backdrop dimming, and dismissal callbacks.

Defined in:

opal/asciicast.cr
opal/ui/screen_stack.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(initial_screen : Screen | Nil = nil) #

[View source]

Instance Method Detail

def active_screen : Screen | Nil #

Returns the currently focused top-of-stack screen


[View source]
def empty? : Bool #

[View source]
def handle_key(event : Terminal::KeyEvent) : Bool #

[View source]
def handle_mouse(event : Terminal::MouseEvent) : Bool #

[View source]
def pop_screen : Screen | Nil #

Pops and unmounts the active screen


[View source]
def push_screen(screen : Screen, &callback : ModalResult -> Nil) : Screen #

Pushes a new screen onto the stack with optional dismissal callback


[View source]
def push_screen(screen : Screen) : Screen #

Pushes a screen without a dismissal block


[View source]
def record_cast(output_path : String, width : Int32 = 80, height : Int32 = 24, title : String = "Opal Session", &block : Asciicast::ScreenRecorder -> Nil) : Nil #

[View source]
def render(buffer : Buffer, x : Int32 = 0, y : Int32 = 0, width : Int32 = buffer.width, height : Int32 = buffer.height) : Nil #

Renders the screen stack with automatic modal backdrop compositing


[View source]
def size : Int32 #

[View source]
def stack : Array(Screen) #

[View source]
def switch_screen(screen : Screen) : Screen #

Replaces entire stack or top screen with a new screen


[View source]