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

Copy Markdown View Source

Modal-overlay payload for the picker variant.

Wraps the existing MingaEditor.State.Picker struct with the metadata the ModalOverlay sum type carries for every variant: opened_at (monotonic millisecond timestamp) and owner (a tag identifying the lifecycle scope the modal belongs to).

The picker is global UX, so owner defaults to :global. It is included here for API uniformity with the per-tab variants (Completion, Conflict).

Summary

Functions

Builds a picker payload wrapping the given picker_ui state.

Replaces the inner picker_ui state on the payload, preserving owner and opened_at. This is 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.Picker{
  opened_at: integer(),
  owner: owner(),
  picker_ui: MingaEditor.State.Picker.t()
}

Functions

new(picker_ui, opts \\ [])

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

Builds a picker payload wrapping the given picker_ui state.

The optional :owner keyword defaults to :global. The optional :opened_at keyword defaults to System.monotonic_time(:millisecond).

put_picker_ui(payload, picker_ui)

@spec put_picker_ui(t(), MingaEditor.State.Picker.t()) :: t()

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