Raxol.UI.Components.Terminal (Raxol v2.0.1)

View Source

A terminal component that emulates a standard terminal within the UI.

Summary

Types

t()

State for the Terminal component.

Functions

Handles key events for the Terminal component.

Initializes the Terminal component state from props.

Mount hook - called when component is mounted. No special setup needed for Terminal.

Renders the Terminal component, displaying the buffer as lines.

Unmount hook - called when component is unmounted. No cleanup needed for Terminal.

Updates the Terminal component state in response to messages. Handles writing, clearing, etc.

Types

t()

@type t() :: %Raxol.UI.Components.Terminal{
  buffer: [String.t()],
  height: non_neg_integer(),
  id: any(),
  style: map(),
  width: non_neg_integer()
}

State for the Terminal component.

  • :id - unique identifier
  • :width - terminal width
  • :height - terminal height
  • :buffer - list of lines
  • :style - style map

Functions

broadcast(msg)

command(cmd)

handle_event(event, props, state)

@spec handle_event(map(), map(), map()) :: {map(), list()}
@spec handle_event(map(), map(), map()) :: {map(), list()}

Handles key events for the Terminal component.

init(props)

@spec init(map()) :: map()

Initializes the Terminal component state from props.

mount(state)

@spec mount(map()) :: {map(), list()}

Mount hook - called when component is mounted. No special setup needed for Terminal.

render(state, props)

@spec render(map(), map()) :: map()

Renders the Terminal component, displaying the buffer as lines.

schedule(msg, delay)

unmount(state)

@spec unmount(map()) :: map()

Unmount hook - called when component is unmounted. No cleanup needed for Terminal.

update(msg, state)

@spec update(term(), map()) :: {map(), list()}

Updates the Terminal component state in response to messages. Handles writing, clearing, etc.