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

The variables a stack still demands (spec/02 §15.2): one entry per variable still open
in a fragment or a stack of fragments, ordered by name, each
`%{name, uses, parameter, required, expects}`: its uses as `Macaw.Layers.Var.free/2`
answers them, each `%{path, layer, expects}` with the schema's type at its path (which a
form chooses a control by), its declaration under the stack's `vars` (`nil` when none
declares it), `required` when the declaration gives no default, and every type the
schema expects where it stands, the type a value given for it is held to once applied.

    iex> fragment = %{vars: %{"unit" => %{type: :text}},
    ...>   labels: [%{anchor: :title, text: "\#{var(unit)}"}], frames: %{"m" => %{z: %Macaw.Layers.Var{name: "z"}}}}
    iex> [unit, z] = Macaw.Frame.Document.FreeVars.free_vars(fragment)
    iex> {unit.name, unit.parameter, unit.expects, z.parameter, z.expects}
    {"unit", %{type: :text}, [:text], nil, [:integer]}

# `free_vars`

```elixir
@spec free_vars(term()) :: [map()]
```

The open variables of a fragment or a stack, `[]` for a term that is neither.

# `type_at`

```elixir
@spec type_at(term()) :: Macaw.Frame.Document.Schema.type() | nil
```

The type the schema gives the value at `path` from the design, or `nil` where the path
leaves the schema (an open node's key, a term's inside).

    iex> Macaw.Frame.Document.FreeVars.type_at([:frames, "main", :margin])
    {:node, :margin}

---

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