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

`diagrams.page_flow` (spec/13 §7.5): how data flows through a Macaw page, from its
sources through the state its controls change to the cells that show it, drawn as a
layered flowchart over the `layered` step in a layout frame, as SVG with no script.

Its data is the shape macaw's `Macaw.Page.Graph.describe/1` answers (macaw#451),
`%{nodes, edges}`, each list a slot's rows: `nodes` (`id`, `kind`, `label`) and `edges`
(`source`, `target`, `label`), the shape's other fields read by nothing. `rows/1` turns
the shape into those rows, judged. Each kind is drawn by its own shape and named in
words on its left, never by color alone: a `source` is a cylinder, a `derived` source
a hexagon, a `state` a stadium, an `export` a parallelogram and a `cell` a rectangle.

Like every diagram it is its text form's design: `Macaw.Frame.TextForms.PageFlow`
walks the flow as a nested list, source by source, so the same flow is authored as
text, read as text by a person who can't see the drawing, or bound to sources.
`text/2` writes a described flow in that form.

    iex> Macaw.Frame.Diagrams.PageFlow.id()
    "diagrams.page_flow"

# `doc`

```elixir
@spec doc() :: String.t()
```

What it draws, for a person and a builder's library.

# `example`

```elixir
@spec example() :: %{nodes: [map()], edges: [map()]}
```

A small page's data flow exactly as `Macaw.Page.Graph.describe/1` answers it (spec/13
§7.5), copied from macaw's answer (2026-11-19): a `services` feed shown by two `stat`
cells and read, with the `health.service` export of the `health.filter` state, by the
`busy` derived source; the `notes` surface mirrors the export into a state its
`latency` cell's request reads.

# `fixtures`

```elixir
@spec fixtures() :: [map()]
```

Its fixtures (spec/14 §1): a small page's data flow as `describe/1` answers it
(`example/0`), written in the text form, a feed and a derived source over an export, a
mirror, and three cells.

# `fragment`

```elixir
@spec fragment() :: map()
```

The fragment: the text form's design, its direction a parameter.

# `id`

```elixir
@spec id() :: String.t()
```

The fragment's id in the catalog store.

# `kind`

```elixir
@spec kind() :: :design | :layers
```

What the fragment is: a whole design, or layers placed in one.

# `kinds`

```elixir
@spec kinds() :: [String.t(), ...]
```

The kinds of a page's nodes (spec/13 §7.5), in flow order.

# `namespace`

```elixir
@spec namespace() :: :charts | :maps | :diagrams
```

Its namespace (spec/13 §2).

# `parameters`

```elixir
@spec parameters() :: [{String.t(), map()}]
```

Its parameters (spec/13 §3, §7.5): the conventions, its description naming each kind's
shape, its margin leaving room on the left for the kind word beside a box, and
`direction`, `TB` by default.

# `rows`

```elixir
@spec rows(term()) ::
  {:ok, %{required(String.t()) =&gt; [%{required(String.t()) =&gt; term()}]}}
  | {:error, [Macaw.Base.Fault.t(), ...]}
```

The slots' rows of a page's described data flow (spec/13 §7.5): of `%{nodes, edges}` as
`Macaw.Page.Graph.describe/1` answers it (keys and kinds by atom or by spelling),
`{:ok, %{"nodes" => rows, "edges" => rows}}`, each row string-keyed with the fields the
slots read and each kind by its spelling; or every fault at once by path: a shape that
is no such map `{[], {:type, :described}}`, a node or an edge that is no map
`{[:nodes, i], {:type, :map}}`, an id, a label or an end that is no text
`{[:nodes, i, :id], {:type, :text}}`, a kind of none of `kinds/0` `{[:nodes, i, :kind],
{:kind, spelling}}`, an id given twice `{[:nodes, i, :id], {:duplicate, id}}` and an
end naming no node `{[:edges, i, :source], {:unknown_node, id}}`.

# `shapes`

```elixir
@spec shapes() :: %{required(String.t()) =&gt; String.t()}
```

The shape each kind is drawn by (spec/13 §7.5).

# `slots`

```elixir
@spec slots() :: %{required(String.t()) =&gt; map()}
```

Its slots: the text form's `nodes` (`id`, `kind`, `label`) and `edges` (`source`, `target`, `label`).

# `text`

```elixir
@spec text(term(), String.t()) ::
  {:ok, String.t()} | {:error, [Macaw.Base.Fault.t(), ...]}
```

A described flow written in the text form (spec/13 §7.5), under a header of
`direction` (`"TB"` by default): `{:ok, text}`, the described flow's faults as
`rows/1` gives them, or `{:error, [{[], {:type, :text}}]}` for a flow the form can't
write (a name or a label holding a line break or an arrow).

# `text_bind`

```elixir
@spec text_bind(map()) :: %{required(String.t()) =&gt; term()}
```

The parameters a read text sets: its header's direction.

# `text_form`

```elixir
@spec text_form() :: module()
```

Its text form (spec/13 §7.5): the flow walked as a nested list.

---

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