Raxol.UI.Components.Terminal (Raxol v0.4.0)

View Source

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

Summary

Types

t()

State for the Terminal component.

Functions

Handles other events for the Terminal component.

Initializes the Terminal component state from props.

Renders the Terminal component, displaying the buffer as lines.

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 other events for the Terminal component.

init(props)

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

Initializes the Terminal component state from props.

mount(state)

Callback implementation for Raxol.UI.Components.Base.Component.mount/1.

render(state, props)

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

Renders the Terminal component, displaying the buffer as lines.

schedule(msg, delay)

unmount(state)

Callback implementation for Raxol.UI.Components.Base.Component.unmount/1.

update(msg, state)

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

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