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

The Frame's configured declarations, derived from its compiled frame document (spec/01
§2.2), copied from visualize's `Visualize.Observation.declared/2` and
`Visualize.Event.declared/1`.

`of(settings, registry)` reads the `design` setting and the `sync` setting and nothing
else that varies: the document is validated and compiled through the Frame module's
registry, every bindable parameter and variable at its default, and every declaration
of §2.2's table follows from the result:

  * `slots`: one per slot the document declares, each role with its requirement
    (`type`, `window`, `identity`, `many`, `optional`) from its layers' channels,
    `Macaw.Frame.Slots.of/2` (spec/05 §1.2); two readings of a role sharing no type
    refuse the document;
  * `writes`: `selection` and `window` as the coordinate models and the document's
    `interaction` write them (§5.1), `window` only over a `:time` `x` until the
    standard window is widened (§9, `Macaw.Frame.Contract`);
  * `local`: the group's keys with their domain types, `%{}` with no `sync` (§5.2);
  * `events`: the Frame's own (`pick`, `brush`, `zoom`, `reset`, `view`), then each
    layer's in document order (§5.3);
  * `announces`: `"point"` with keyboard reach (a data layer), `"selection"` beside it
    when the Frame writes `selection`;
  * `observes`: `view` and `dwell`; `focus_item` with keyboard reach; `hover_item` and
    `activate` when a layer declares an event; `select` when it writes `selection`;
    `brush` when it brushes; in the vocabulary's order;
  * `requests`: the keyboard's `"arm"`, `"disarm"` and `"key"` with keyboard reach
    (spec/11 §5.6, `Macaw.Frame.Keyboard`), answered by the value's `request/2`;
  * `reading`: `:scan` for more than one data layer, a layer with a `series` channel or
    a facet frame, `:glance` otherwise;
  * `stylesheets` and `proxy_routes`: the document's generated sheets and its layers'
    routes; `isolation` `:contained`; `actions`, `shortcuts` `[]`; `words` and `access`
    `nil`.

A fact (spec/02 §7.3) stands as a value of its key's shape, since no schema is bound
when declarations are made: what the design declares follows from its shape.

It is pure: equal settings answer equal declarations. A document that does not
validate answers its faults, each at `["design" | path]`.

# `of`

```elixir
@spec of(term(), term()) :: {:ok, keyword()} | {:error, [{list(), term()}, ...]}
```

The declarations of a Frame's settings through its module's `registry` (§2.2):
`{:ok, keyword}` for `Macaw.Component.Declarations.new/2`, or `{:error, faults}`, each
fault at `["design" | path]`.

---

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