MingaEditor.UI.Notification (Minga v0.1.0)

Copy Markdown View Source

BEAM-owned model for structured editor notifications.

Native GUI frontends render these as bottom-right notification cards. TUI users receive the same important information through *Messages* at the call site.

Summary

Functions

Builds a notification from attrs.

Returns a copy updated with attrs while preserving creation time.

Sets the original creation timestamp when replacing an existing notification.

Attaches the auto-dismiss timer reference used to reject stale timer messages.

Sets the recency timestamp for a notification snapshot or replacement.

Types

level()

@type level() :: :info | :warning | :error | :success | :progress

t()

@type t() :: %MingaEditor.UI.Notification{
  actions: [MingaEditor.UI.Notification.Action.t()],
  auto_dismiss_ms: non_neg_integer() | nil,
  body: String.t() | nil,
  created_at: integer(),
  dismiss_ref: reference() | nil,
  dismissable: boolean(),
  id: String.t(),
  level: level(),
  source: String.t() | nil,
  title: String.t(),
  updated_at: integer() | nil
}

Functions

new(attrs)

@spec new(keyword() | map()) :: t()

Builds a notification from attrs.

update(notification, attrs)

@spec update(t(), keyword() | map()) :: t()

Returns a copy updated with attrs while preserving creation time.

with_created_at(notification, created_at)

@spec with_created_at(t(), integer()) :: t()

Sets the original creation timestamp when replacing an existing notification.

with_dismiss_ref(notification, dismiss_ref)

@spec with_dismiss_ref(t(), reference() | nil) :: t()

Attaches the auto-dismiss timer reference used to reject stale timer messages.

with_updated_at(notification, updated_at)

@spec with_updated_at(t(), integer()) :: t()

Sets the recency timestamp for a notification snapshot or replacement.