# `OpenUI.Canonical`
[🔗](https://github.com/ideia4it/openui/blob/v0.1.1/lib/openui/canonical.ex#L1)

The canonical form of a program at stream end, as the OpenUI conformance
fixtures summarize it (`spec/fixtures/1.0/README.md`, "How the tree is
summarized").

It holds only spec concepts (component types and props, resolved values,
error codes, unresolved names, orphans, state), which makes it a stable
thing to compare across implementations and in tests.

# `result`

```elixir
@spec result(OpenUI.Program.t(), OpenUI.Library.t() | module()) :: map()
```

Evaluates the program as at stream end, before any query returns: state at
its defaults, each query at its defaults and each mutation idle.

# `summarize`

```elixir
@spec summarize(term(), OpenUI.Library.t(), (term() -&gt; term())) :: term()
```

Summarizes an evaluated value: a component becomes `%{"type", "props"}`
without its null props, an action plan `%{"actions" => [...]}`, a binding
`%{"$binding" => name}`. `evaluate` reads the value of each `@Set`.

# `tree`

```elixir
@spec tree(OpenUI.Program.t(), OpenUI.Library.t() | module()) ::
  OpenUI.Element.t() | nil
```

The evaluated tree at stream end, as `result/2` summarizes it.

---

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