# `Macaw.Component.State`
[🔗](https://github.com/dcoai/macaw_component/blob/v0.1.2/lib/macaw/component/state.ex#L1)

The state vocabulary a component and every host agree on (spec/01 §1.5): the standard
state sources a component may write, and the value and domain types.

    iex> Macaw.Component.State.conforms?(:window, %{last: 3600})
    true
    iex> Macaw.Component.State.conforms?(:identity, %{"host" => "a", "port" => 80})
    true

# `type`

```elixir
@type type() ::
  :time
  | :number
  | :category
  | :text
  | :point
  | :identity
  | :window
  | :box
  | :camera
  | :breakpoints
```

# `conforms?`

```elixir
@spec conforms?(type(), term()) :: boolean()
```

Whether a value is of a type. `:identity` is a scalar or a non-empty map of field to
scalar; `:window` is `nil`, `%{last: seconds}` or `%{from: a, to: b}`, either with an
optional `as_of` instant; `:box` is `%{west, south, east, north}` in degrees; `:camera`
a map and `:breakpoints` a list; the data-model types are `Macaw.Data.Parameter`'s.

# `local_types`

```elixir
@spec local_types() :: [type(), ...]
```

The domain types a `local` key may carry: the first eight of `types/0`.

# `standard`

```elixir
@spec standard() :: %{required(String.t()) =&gt; [type(), ...]}
```

The standard state sources, each with the value types it takes.

# `types`

```elixir
@spec types() :: [type(), ...]
```

The value and domain types, in order.

---

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