# `MingaEditor.Shell.Traditional.SpaceLeader`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_editor/shell/traditional/space_leader.ex#L1)

Pure lifecycle owner for the TUI CUA space-leader timeout window.

Each installation advances a generation. Timeout delivery carries that
generation, so cancellation and replacement remain safe even when an old
timer message is already in the Editor mailbox.

# `generation`

```elixir
@type generation() :: non_neg_integer()
```

# `t`

```elixir
@type t() :: %MingaEditor.Shell.Traditional.SpaceLeader{
  generation: generation(),
  pending: boolean(),
  timer: reference() | nil
}
```

# `begin`

```elixir
@spec begin(t()) :: {generation(), t()}
```

Begins a new pending leader window and returns its generation.

# `expire`

```elixir
@spec expire(t(), generation()) :: {:expired | :stale, t()}
```

Expires only the current pending generation.

# `install_timer`

```elixir
@spec install_timer(t(), generation(), reference()) :: t()
```

Records the timer handle only for the current pending generation.

# `pending?`

```elixir
@spec pending?(t()) :: boolean()
```

Returns whether a space-leader window is pending.

# `reset`

```elixir
@spec reset(t()) :: t()
```

Cancels or consumes the current pending window without changing identity.

# `timer`

```elixir
@spec timer(t()) :: reference() | nil
```

Returns the timer handle for best-effort cancellation by a handler.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
