The frame document's version line and its canonical value (spec/02 §9.1).
The line starts at 1. visualize's line and its migrations (its singular frame,
its flat style keys, its filled lines) are not carried over: a frame document is never
in visualize's shapes. current/0 is 1 until a change needs a migration, and step/2
holds the pure steps, one per version, each producing a value that validates at its
target; there is none yet.
Within a version a read value is canonical (canonical/1): names as strings (an
atom given in Elixir is read as its string), a member of an enumeration spelled as a
string as the member, a style's shorthands as its parts, a text given as parts as its
string, a bare color atom as its typed color. The walk reads every
value by the schema's type at its position, so only a name is rewritten into a string
and only a color position's atom into a color; it stops at a struct, as every walk over
a design does (§1.7), but for a variable's and a fact's names. It is idempotent.
iex> Macaw.Frame.Document.Migration.canonical(%{frames: %{main: %{kind: :cartesian}},
...> styles: %{bad: %{fill: :red}}})
%{frames: %{"main" => %{kind: "cartesian"}},
styles: %{"bad" => %{fill: %{type: :solid, color: {:color, "red"}}}}}
Summary
Functions
A design in its canonical shape (§9.1); any term that is no map as it is.
A node of kind alone in its canonical shape: a fragment's body. A kind the schema does
not have reads its value's names only.
The type's current version (§9.1): 1.
The document at from migrated to from + 1. The line has no step yet, so every
version asked for is {:error, [{[], {:no_step, from}}]}; the kernel never asks for one
while current/0 is 1.
Functions
A design in its canonical shape (§9.1); any term that is no map as it is.
A node of kind alone in its canonical shape: a fragment's body. A kind the schema does
not have reads its value's names only.
iex> Macaw.Frame.Document.Migration.canonical(%{stroke: :blue}, :style)
%{stroke: %{type: :solid, color: {:color, "blue"}}}
@spec current() :: pos_integer()
The type's current version (§9.1): 1.
@spec step(term(), term()) :: {:ok, map()} | {:error, [Macaw.Base.Fault.t(), ...]}
The document at from migrated to from + 1. The line has no step yet, so every
version asked for is {:error, [{[], {:no_step, from}}]}; the kernel never asks for one
while current/0 is 1.