# `MingaEditor.UI.Popup.Active`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_editor/ui/popup/active.ex#L1)

Tracks the state of an open popup window.

When a popup rule fires and creates a managed split (or floating overlay),
an `Active` struct is stored on the window to record the rule that created
it and the previous active window id so focus can be restored when the
popup is closed.

## Lifecycle

1. A buffer name matches a `Popup.Rule` in the registry.
2. `Popup.Lifecycle.open_popup/3` creates the popup split/float and
   attaches this struct to the new window's `popup_meta` field.
3. When the user dismisses the popup (quit key, auto-close, or explicit
   close), `Popup.Lifecycle.close_popup/2` removes the popup's window
   from the current tree via `WindowTree.close/2` (like `delete-window`
   in Emacs) and restores focus using `previous_active`.

This approach lets multiple popups coexist: closing one only removes its
own window from the tree without affecting other popups.

# `t`

```elixir
@type t() :: %MingaEditor.UI.Popup.Active{
  previous_active: MingaEditor.Window.id(),
  rule: Minga.Popup.Rule.t(),
  window_id: MingaEditor.Window.id()
}
```

# `new`

```elixir
@spec new(Minga.Popup.Rule.t(), MingaEditor.Window.id(), MingaEditor.Window.id()) ::
  t()
```

Creates a new active popup record.

Captures the rule that matched, the window id of the new popup window,
and the previously active window id for focus restoration on close.

---

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