MingaEditor.State.ModalOverlay.Prompt (Minga v0.1.0)

Copy Markdown View Source

Modal-overlay payload for the prompt variant.

Wraps the existing MingaEditor.State.Prompt struct with the metadata the ModalOverlay sum type carries for every variant: opened_at (monotonic millisecond timestamp) and owner. Prompts are global UX, so owner defaults to :global.

Summary

Functions

Builds a prompt payload wrapping the given prompt_ui state.

Replaces the inner prompt_ui state on the payload, preserving owner and opened_at. The only sanctioned way to update the inner state from outside this module (Rule 2: state ownership).

Types

owner()

@type owner() :: term()

t()

@type t() :: %MingaEditor.State.ModalOverlay.Prompt{
  opened_at: integer(),
  owner: owner(),
  prompt_ui: MingaEditor.State.Prompt.t()
}

Functions

new(prompt_ui, opts \\ [])

@spec new(
  MingaEditor.State.Prompt.t(),
  keyword()
) :: t()

Builds a prompt payload wrapping the given prompt_ui state.

put_prompt_ui(payload, prompt_ui)

@spec put_prompt_ui(t(), MingaEditor.State.Prompt.t()) :: t()

Replaces the inner prompt_ui state on the payload, preserving owner and opened_at. The only sanctioned way to update the inner state from outside this module (Rule 2: state ownership).