MingaEditor.Shell.Chrome behaviour (Minga v0.1.0)

Copy Markdown View Source

Behaviour: how a shell builds chrome (tab bar, modeline, file tree, overlays) and renders complete frames.

Carved out of MingaEditor.Shell so the rendering responsibility is declared as a focused contract independent of input routing or buffer lifecycle.

Summary

Callbacks

Returns true when the shell's current state can safely render through the asynchronous RenderPipeline path.

Returns a chrome struct with draw lists for each UI region. The shell decides which chrome elements exist and how they render.

Returns shell-specific data that affects chrome dirty tracking.

Returns structured GUI payload data for the active shell, or nil when the shell has no native GUI payload.

Runs the full render pipeline (content, chrome, compose, emit) and sends commands to the frontend. Returns updated state with cached render data.

Callbacks

async_render?(editor_state)

@callback async_render?(editor_state :: term()) :: boolean()

Returns true when the shell's current state can safely render through the asynchronous RenderPipeline path.

build_chrome(editor_state, layout, scrolls, cursor_info)

@callback build_chrome(
  editor_state :: term(),
  layout :: MingaEditor.Layout.t(),
  scrolls :: map(),
  cursor_info :: term()
) :: MingaEditor.RenderPipeline.Chrome.t()

Returns a chrome struct with draw lists for each UI region. The shell decides which chrome elements exist and how they render.

chrome_fingerprint(editor_state)

@callback chrome_fingerprint(editor_state :: term()) :: term()

Returns shell-specific data that affects chrome dirty tracking.

gui_payload(editor_state)

@callback gui_payload(editor_state :: term()) :: MingaEditor.Shell.gui_payload() | nil

Returns structured GUI payload data for the active shell, or nil when the shell has no native GUI payload.

render(editor_state)

@callback render(editor_state :: term()) :: term()

Runs the full render pipeline (content, chrome, compose, emit) and sends commands to the frontend. Returns updated state with cached render data.