# `Macaw.Frame.Drawn`
[🔗](https://github.com/dcoai/macaw_frame/blob/v0.1.0/lib/macaw/frame/drawn.ex#L1)

The Frame's own drawn state, and how a state other than `live` is drawn over or in
place of the drawing (spec/01 §4.3). Copied from the drawing-over parts of visualize's
`Visualize.Board.State` and `Visualize.Board.Draw` (a state painted over the last
drawing, so a person still sees the last data with what is wrong with it); the states
are `Macaw.Component.Drawn`'s eight, and visualize's `:over_budget` and its SVG panels
are not carried over.

| The Frame's own | When |
|---|---|
| `:invalid` | the value holds faults: a delivery its slot cannot read, a schema version it was not compiled for, a document fault, a bound value of the wrong type |
| `:capped` | a layer drew fewer of its rows than it was handed, by its own point ceiling |
| `:live` | otherwise |

A layer's pixel reduction (a continuous kind's drawn reduction keeping each pixel
column's extremes) is not capped: it draws the picture its rows make.

**The state drawn** is the higher of the host's assignment and the Frame's own,
`Macaw.Component.Drawn.pick/1`, so the host's `crashed` and `down` win over the Frame's
`invalid`, which wins over `loading`, as the contract's precedence orders them. The
host's states (`crashed`, `down`, `loading`, `no_data`, `stale`, the host's `capped`)
stay the host's: the Frame reads no clock and no source to decide one.

**Where its notice stands** (`place/2`): with a drawing held, before it as a banner;
with none, in its place; `:live` draws none. The notice is the contract's static one,
`Macaw.Component.Drawn.render/2`, in every mode, its words, glyph and role every
component's; `notice/3` with `:phrasing` writes the same notice as a `<span>`, for the
Sparkline's phrasing content (§6).

# `notice`

```elixir
@spec notice(
  Macaw.Component.Drawn.t(),
  Macaw.Component.Context.t() | nil,
  :flow | :phrasing
) ::
  iodata()
```

A state's notice as markup (§4.3): `:flow` is the contract's `<p>`
(`Macaw.Component.Drawn.render/2`); `:phrasing` the same classes, `data-mw-drawn`,
glyph and words in a `<span>`, so it stays phrasing content (§6). `:live` is empty.

# `own`

```elixir
@spec own(term()) :: :invalid | :capped | :live
```

The Frame's own state (§4.3): `:invalid` with faults, `:capped` with a capped layer, `:live`.

# `place`

```elixir
@spec place(Macaw.Component.Drawn.t(), boolean()) :: :banner | :in_place | :none
```

Where a state's notice stands (§4.3): `:banner` before a held drawing, `:in_place` of
none, `:none` for `:live`.

# `state`

```elixir
@spec state(term(), term()) :: Macaw.Component.Drawn.t()
```

The state a Frame draws (§4.3): the higher of the host's `assigned` state and the
value's own; an assignment that is no drawn state is read as `:live`.

---

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