MingaEditor.State.ModalOverlay (Minga v0.1.0)

Copy Markdown View Source

Pure tagged-union lifecycle owner for exclusive input-capturing modals.

Conflict modals are sticky under open/2; transition/2 is unconditional. Completion trigger bookkeeping and stale-tab dismissal receive the required active-tab context as values rather than reaching into Editor state.

Summary

Functions

Returns whether a modal is active.

Closes a completed modal.

Returns the active command-completion payload.

Returns the inner completion value when completion is active.

Returns the source-owned generation for the active completion presentation.

Returns the active completion trigger or a fresh trigger.

Dismisses a canceled modal.

Dismisses completion whose owner does not match the active tab id.

Returns whether the modal has the expected tag.

Updates completion through an explicit user-navigation transition.

Returns the closed modal value.

Opens an exact modal value, preserving an active conflict against other variants.

Records completion-trigger lifecycle using explicit active-tab context.

Returns the active tag, or :none.

Transitions to an exact modal value unconditionally, bypassing conflict stickiness.

Updates the active inner completion value.

Types

active()

t()

@type t() :: :none | active()

variant()

@type variant() :: :picker | :prompt | :completion | :command_completion | :conflict

Functions

active?(modal)

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

Returns whether a modal is active.

close(arg1)

@spec close(t()) :: :none

Closes a completed modal.

command_completion(arg1)

@spec command_completion(t()) ::
  MingaEditor.State.ModalOverlay.CommandCompletion.t() | nil

Returns the active command-completion payload.

completion(arg1)

@spec completion(t()) :: Minga.Editing.Completion.t() | nil

Returns the inner completion value when completion is active.

completion_generation(arg1)

@spec completion_generation(t()) :: non_neg_integer()

Returns the source-owned generation for the active completion presentation.

completion_trigger(arg1)

@spec completion_trigger(t()) :: MingaEditor.CompletionTrigger.t()

Returns the active completion trigger or a fresh trigger.

dismiss(arg1)

@spec dismiss(t()) :: :none

Dismisses a canceled modal.

dismiss_if_stale(modal, active_tab_id)

@spec dismiss_if_stale(t(), MingaEditor.State.Tab.id() | nil) :: t()

Dismisses completion whose owner does not match the active tab id.

match(modal, expected)

@spec match(t(), :none | variant()) :: boolean()

Returns whether the modal has the expected tag.

none()

@spec none() :: t()

Returns the closed modal value.

open(modal, next)

@spec open(t(), active()) :: t()

Opens an exact modal value, preserving an active conflict against other variants.

put_completion_trigger(modal, trigger, active_tab_id, presentation_generation)

@spec put_completion_trigger(
  t(),
  MingaEditor.CompletionTrigger.t(),
  MingaEditor.State.Tab.id() | nil,
  pos_integer()
) :: t()

Records completion-trigger lifecycle using explicit active-tab context.

tag(arg1)

@spec tag(t()) :: :none | variant()

Returns the active tag, or :none.

transition(modal, next)

@spec transition(t(), active()) :: active()

Transitions to an exact modal value unconditionally, bypassing conflict stickiness.

update_completion(modal, fun)

@spec update_completion(t(), (Minga.Editing.Completion.t() ->
                          Minga.Editing.Completion.t())) :: t()

Updates the active inner completion value.