OpenUI.Canonical (OpenUI v0.1.1)

Copy Markdown View Source

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.

Summary

Functions

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

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.

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

Functions

result(program, library)

@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(element, library, evaluate)

@spec summarize(term(), OpenUI.Library.t(), (term() -> 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(program, library)

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

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