MingaEditor.Shell.Traditional.NavFlash (Minga v0.1.0)

Copy Markdown View Source

Pure lifecycle owner for the navigation flash animation.

Summary

Functions

Returns whether a navigation flash is active.

Advances a matching generation, rejecting stale timer delivery.

Cancels the active flash value while retaining its generation.

Computes the current animation color.

Records a timer handle only for the current active generation.

Replaces the active flash and advances its monotonic generation.

Returns the animation interval used by the workflow.

Types

generation()

@type generation() :: non_neg_integer()

t()

@type t() :: %MingaEditor.Shell.Traditional.NavFlash{
  generation: generation(),
  line: non_neg_integer() | nil,
  max_steps: pos_integer(),
  step: non_neg_integer(),
  timer: reference() | nil
}

Functions

active?(nav_flash)

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

Returns whether a navigation flash is active.

advance(flash, generation)

@spec advance(t(), generation()) :: {:continue, t()} | {:done, t()} | {:stale, t()}

Advances a matching generation, rejecting stale timer delivery.

cancel(flash)

@spec cancel(t()) :: t()

Cancels the active flash value while retaining its generation.

color_for_step(nav_flash, flash_bg, target_bg)

@spec color_for_step(t(), non_neg_integer(), non_neg_integer()) :: non_neg_integer()

Computes the current animation color.

record_timer(flash, generation, timer)

@spec record_timer(t(), generation(), reference()) :: t()

Records a timer handle only for the current active generation.

replace(flash, line)

@spec replace(t(), non_neg_integer()) :: t()

Replaces the active flash and advances its monotonic generation.

step_interval_ms()

@spec step_interval_ms() :: pos_integer()

Returns the animation interval used by the workflow.