MingaEditor.Frontend.Capabilities (Minga v0.1.0)

Copy Markdown View Source

Frontend capabilities reported during the ready handshake.

When a frontend starts, it sends a ready event with optional capability fields. The BEAM uses these to adapt rendering strategy: skipping image commands on terminals without image support, using native floating windows on GUIs, using native floating windows, etc.

Frontends that send the short 5-byte ready format get default/0 caps (TUI, RGB, wcwidth, no images, emulated floats, monospace).

Summary

Functions

Returns the default capabilities (TUI with full RGB, monospace).

Decodes capability fields from the binary payload (7 bytes with semantic_ui; 6- and 5-byte legacy forms decode with semantic_ui false).

Returns true if the frontend is a native GUI (not a terminal).

Returns true if the frontend supports inline images (kitty, sixel, or native).

Returns true if the frontend supports native floating windows (not emulated overlays).

Returns true if the frontend reports proportional text rendering.

Returns true if the frontend supports full 24-bit RGB color.

Returns true if the frontend can consume semantic render-model protocol commands.

Returns the safe production width oracle, monospace for now.

Returns a measured oracle only when the caller passes an owned measurement cache.

Types

color_depth()

@type color_depth() :: :mono | :color_256 | :rgb

float_support()

@type float_support() :: :emulated | :native

frontend_type()

@type frontend_type() :: :tui | :native_gui | :web

image_support()

@type image_support() :: :none | :kitty | :sixel | :native

t()

@type t() :: %MingaEditor.Frontend.Capabilities{
  color_depth: color_depth(),
  float_support: float_support(),
  frontend_type: frontend_type(),
  image_support: image_support(),
  semantic_ui: boolean(),
  text_rendering: text_rendering(),
  unicode_width: unicode_width()
}

text_rendering()

@type text_rendering() :: :monospace | :proportional

unicode_width()

@type unicode_width() :: :wcwidth | :unicode_15

Functions

default()

@spec default() :: t()

Returns the default capabilities (TUI with full RGB, monospace).

from_binary(arg1)

@spec from_binary(binary()) :: t()

Decodes capability fields from the binary payload (7 bytes with semantic_ui; 6- and 5-byte legacy forms decode with semantic_ui false).

gui?(capabilities)

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

Returns true if the frontend is a native GUI (not a terminal).

images?(capabilities)

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

Returns true if the frontend supports inline images (kitty, sixel, or native).

native_floats?(capabilities)

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

Returns true if the frontend supports native floating windows (not emulated overlays).

proportional_text?(capabilities)

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

Returns true if the frontend reports proportional text rendering.

rgb?(capabilities)

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

Returns true if the frontend supports full 24-bit RGB color.

semantic_ui?(capabilities)

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

Returns true if the frontend can consume semantic render-model protocol commands.

width_oracle(caps)

@spec width_oracle(t()) :: Minga.Core.WidthOracle.t()

Returns the safe production width oracle, monospace for now.

width_oracle(capabilities, cache)

@spec width_oracle(t(), map() | nil) :: Minga.Core.WidthOracle.t()

Returns a measured oracle only when the caller passes an owned measurement cache.