MingaEditor.Agent.UIState.Presentation (Minga v0.1.0)

Copy Markdown View Source

Pure lifecycle owner for activation of the full-screen agent presentation.

Activation records one coherent editor return target and saved layout. Completion or cancellation deactivates the presentation and clears every activation-local field together, preventing stale return targets or key prefixes from leaking into a replacement activation.

Summary

Functions

Activates or replaces the presentation's complete return context.

Returns whether the agent presentation is active.

Cancels presentation use with the same cleanup guarantee as completion.

Completes presentation use and returns the layout to restore.

Returns the focused agent panel.

Switches keyboard focus inside the agent presentation.

Installs a pending multi-key prefix.

Returns the pending multi-key prefix.

Replaces the editor return target for the active presentation.

Clears a pending multi-key prefix.

Returns the editor return target.

Types

focus()

@type focus() :: :chat | :file_viewer

prefix()

@type prefix() ::
  nil | :g | :z | :bracket_next | :bracket_prev | Minga.Keymap.Bindings.Node.t()

t()

@type t() :: %MingaEditor.Agent.UIState.Presentation{
  active: boolean(),
  focus: focus(),
  pending_prefix: prefix(),
  return_target: MingaEditor.Agent.UIState.ReturnTarget.t() | nil,
  saved_file_tree: MingaEditor.State.FileTree.t() | nil,
  saved_windows: MingaEditor.State.Windows.t() | nil
}

Functions

activate(presentation, windows, file_tree, return_target)

Activates or replaces the presentation's complete return context.

active?(presentation)

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

Returns whether the agent presentation is active.

cancel(presentation)

@spec cancel(t()) ::
  {t(), MingaEditor.State.Windows.t() | nil,
   MingaEditor.State.FileTree.t() | nil}

Cancels presentation use with the same cleanup guarantee as completion.

complete(presentation)

@spec complete(t()) ::
  {t(), MingaEditor.State.Windows.t() | nil,
   MingaEditor.State.FileTree.t() | nil}

Completes presentation use and returns the layout to restore.

current_focus(presentation)

@spec current_focus(t()) :: focus()

Returns the focused agent panel.

focus(presentation, focus)

@spec focus(t(), focus()) :: t()

Switches keyboard focus inside the agent presentation.

install_prefix(presentation, prefix)

@spec install_prefix(t(), prefix()) :: t()

Installs a pending multi-key prefix.

pending_prefix(presentation)

@spec pending_prefix(t()) :: prefix()

Returns the pending multi-key prefix.

replace_return_target(presentation, return_target)

@spec replace_return_target(t(), MingaEditor.Agent.UIState.ReturnTarget.t() | nil) ::
  t()

Replaces the editor return target for the active presentation.

reset_prefix(presentation)

@spec reset_prefix(t()) :: t()

Clears a pending multi-key prefix.

return_target(presentation)

@spec return_target(t()) :: MingaEditor.Agent.UIState.ReturnTarget.t() | nil

Returns the editor return target.