MingaEditor.State.Frontend (Minga v0.1.0)

Copy Markdown View Source

Per-editor frontend connection and capability state.

The value owns frontend identity, rendering policy, connection handles, terminal dimensions, capability negotiation, pressure reporting, and input correlation. Renderer-owned state lives in MingaEditor.State.Render.

Summary

Functions

Accepts frontend capability negotiation.

Correlates the next committed frame with the latest frontend input.

Builds frontend state from editor startup options.

Returns whether this editor emits rendered frames.

Records the frontend's current resource-pressure report.

Records the terminal viewport reported by the active frontend.

Types

backend()

@type backend() :: :tui | :gui | :native_gui | :headless

rendering_policy()

@type rendering_policy() :: :enabled | :disabled

t()

@type t() :: %MingaEditor.State.Frontend{
  backend: backend(),
  capabilities: MingaEditor.Frontend.Capabilities.t(),
  last_input_seq: non_neg_integer(),
  port_manager: GenServer.server() | nil,
  rendering: rendering_policy(),
  resource_pressure: MingaEditor.State.ResourcePressure.t(),
  terminal_viewport: MingaEditor.Viewport.t()
}

Functions

accept_capabilities(frontend, capabilities)

@spec accept_capabilities(t(), MingaEditor.Frontend.Capabilities.t()) :: t()

Accepts frontend capability negotiation.

correlate_input(frontend, sequence)

@spec correlate_input(t(), non_neg_integer()) :: t()

Correlates the next committed frame with the latest frontend input.

new(opts \\ [])

@spec new(keyword()) :: t()

Builds frontend state from editor startup options.

rendering_enabled?(frontend)

@spec rendering_enabled?(t()) :: boolean()

Returns whether this editor emits rendered frames.

report_resource_pressure(frontend, low_power?, thermal_state)

@spec report_resource_pressure(
  t(),
  boolean(),
  MingaEditor.State.ResourcePressure.thermal_state()
) ::
  t()

Records the frontend's current resource-pressure report.

resize_terminal(frontend, viewport)

@spec resize_terminal(t(), MingaEditor.Viewport.t()) :: t()

Records the terminal viewport reported by the active frontend.