# `MingaEditor.InlineOverlay.Store`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_editor/inline_overlay/store.ex#L1)

Shared per-buffer store for inline overlays (ask and edit).

Both variants key their ephemeral overlays by `buffer_pid` and track an
optional `session_pid`. The lookup/insert/dismiss/session plumbing only
touches those two fields, so it lives here once and is reused by both
`MingaEditor.State.InlineAsk` and `MingaEditor.State.InlineEdit` rather
than being copied per variant.

An overlay is any struct carrying `:buffer_pid` and `:session_pid`. The
variant struct modules own their own fields and transitions; this module
owns only the store mechanics.

# `overlay`

```elixir
@type overlay() :: %{
  :__struct__ =&gt; module(),
  :buffer_pid =&gt; pid(),
  :session_pid =&gt; pid() | nil,
  optional(atom()) =&gt; term()
}
```

An overlay struct carrying `:buffer_pid` and `:session_pid`.

# `store`

```elixir
@type store() :: %{required(pid()) =&gt; overlay()}
```

A per-buffer overlay store.

# `active`

```elixir
@spec active(store(), pid() | nil) :: overlay() | nil
```

Returns the active overlay for a buffer, or `nil`.

# `dismiss`

```elixir
@spec dismiss(store(), pid() | nil) :: {store(), pid() | nil}
```

Dismisses the overlay for a buffer.

Returns `{store, session_pid}` where `session_pid` is the dismissed
overlay's session pid (or `nil` when there was no overlay), so callers
can stop the session.

# `put`

```elixir
@spec put(store(), overlay()) :: store()
```

Opens or replaces an overlay for its buffer.

# `session?`

```elixir
@spec session?(store(), pid()) :: boolean()
```

Returns true when the given session pid belongs to an overlay in this store.

---

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