The frame document's schema as data (spec/02 §1.2–§1.5, §13.2).
Every node kind of the design map (§1.2) is a list of key specs, each with a type
(§1.4), a facet (§1.3), a default, whether it is required and a merge rule (§1.5). The
validator, the forms, the merge rules of composition and any tool that groups keys read
them here, so a key added to a table reaches every consumer at once. The tables are
written in Schema.Design, Schema.Frame and Schema.Layer and built once, when the
library compiles.
Names in a design are strings; the keys of these tables and the members of their
enumerations are the library's own vocabulary, atoms, read from a document only by
lookup (spec/02 §9.3). Three node kinds are open (open?/1): a layer's channels
and options and a data step, whose string keys are their layer kind's and their
operation's to declare.
iex> Macaw.Frame.Document.Schema.key(:layer, :style).facet
:style
iex> Macaw.Frame.Document.Schema.default(:frame, :margin)
%{top: 20, right: 20, bottom: 30, left: 40}
iex> hd(Macaw.Frame.Document.Schema.kinds())
:design
Summary
Types
What a key is about (§1.3).
One key of a node kind.
A node kind of the design map (§1.2).
A type term of §1.4.
Functions
The six data-model types a slot's types may name, field_types/0 (§13.2).
The default of a key: nil when it has none, is required, or is no key of the kind.
The default of a key in a given node, where the node decides it: a label's style is
"title" at the :title anchor and "label" elsewhere (§6.1), a frame's span is
[1, 1] with a cell (§4.1); every other key's is default/2's.
The key specs of a node kind, in the order of its table in spec/02;
{:error, [{[], {:enum, kinds}}]} for a term that is no kind.
Every member of every enumeration of the schema (§9.3).
The five facets of §1.3.
The six data-model types a slot's types may name (§2.3).
The style names every design can name without declaring them (§3.3).
The spec of one key of a node kind, or nil when the kind has no such key.
Every atom key of every node kind, once each: the words a document's keys are read in (§9.3).
Every {kind, key} pair carrying the facet, over every node kind in kinds/0 order;
[] for a term that is no facet.
The keys of one node kind carrying the facet, in table order (§1.3); [] for a kind or
facet the schema does not have.
Every node kind of §1.2, :design first, level by level.
Whether a node kind's keys are their owner's (§5.3, §5.4): a layer's channels and
options are its kind's, a step's keys its operation's.
A style's parts, the keys merged by §3.5's rule (§1.5).
The scale kinds of macaw_draw spec/06 a :scale node names (§4.3).
The alternative of a {:one_of, types} whose shape a value has, or nil (§1.4): what
the validator judges the value as, and what canonicalization reads it by. A map is the
first node or name map admitted, a list the first list, a tagged tuple the type that
tags it.
The type a styles entry takes (§2.6).
Every style site of the schema (§3.6): each {kind, key} whose type is the style stack,
in kinds/0 order, derived from the tables. A layer kind's own site (a choice's
style) is the kind's to declare.
The type a style site takes (§3.6): a reference, an inline node, a field binding, a generator call, or a list of them.
Types
@type facet() :: :binding | :channel | :geometry | :style | :content
What a key is about (§1.3).
@type key_spec() :: Macaw.Frame.Document.Schema.Spec.t()
One key of a node kind.
@type kind() :: atom()
A node kind of the design map (§1.2).
A type term of §1.4.
Functions
@spec column_types() :: [atom(), ...]
The six data-model types a slot's types may name, field_types/0 (§13.2).
The default of a key: nil when it has none, is required, or is no key of the kind.
The default of a key in a given node, where the node decides it: a label's style is
"title" at the :title anchor and "label" elsewhere (§6.1), a frame's span is
[1, 1] with a cell (§4.1); every other key's is default/2's.
iex> Macaw.Frame.Document.Schema.default(:label, :style, %{anchor: :title})
"title"
iex> Macaw.Frame.Document.Schema.default(:label, :style, %{anchor: :caption})
"label"
@spec describe(term()) :: [key_spec()] | {:error, [Macaw.Base.Fault.t(), ...]}
The key specs of a node kind, in the order of its table in spec/02;
{:error, [{[], {:enum, kinds}}]} for a term that is no kind.
@spec enum_members() :: [atom(), ...]
Every member of every enumeration of the schema (§9.3).
@spec facets() :: [facet(), ...]
The five facets of §1.3.
@spec field_types() :: [atom(), ...]
The six data-model types a slot's types may name (§2.3).
@spec furniture() :: [String.t(), ...]
The style names every design can name without declaring them (§3.3).
The spec of one key of a node kind, or nil when the kind has no such key.
@spec key_names() :: [atom(), ...]
Every atom key of every node kind, once each: the words a document's keys are read in (§9.3).
Every {kind, key} pair carrying the facet, over every node kind in kinds/0 order;
[] for a term that is no facet.
The keys of one node kind carrying the facet, in table order (§1.3); [] for a kind or
facet the schema does not have.
iex> Macaw.Frame.Document.Schema.keys(:grid, :geometry)
[:columns, :rows, :gap]
@spec kinds() :: [kind(), ...]
Every node kind of §1.2, :design first, level by level.
Whether a node kind's keys are their owner's (§5.3, §5.4): a layer's channels and
options are its kind's, a step's keys its operation's.
@spec parts() :: [atom(), ...]
A style's parts, the keys merged by §3.5's rule (§1.5).
@spec scale_kinds() :: [atom(), ...]
The scale kinds of macaw_draw spec/06 a :scale node names (§4.3).
The alternative of a {:one_of, types} whose shape a value has, or nil (§1.4): what
the validator judges the value as, and what canonicalization reads it by. A map is the
first node or name map admitted, a list the first list, a tagged tuple the type that
tags it.
iex> Macaw.Frame.Document.Schema.select([:name, {:node, :theme}], %{name: "x"})
{:node, :theme}
iex> Macaw.Frame.Document.Schema.select([{:ref, :style}, :field_ref], {:field, "f"})
:field_ref
@spec style_entry() :: type()
The type a styles entry takes (§2.6).
Every style site of the schema (§3.6): each {kind, key} whose type is the style stack,
in kinds/0 order, derived from the tables. A layer kind's own site (a choice's
style) is the kind's to declare.
iex> Macaw.Frame.Document.Schema.style_sites()
[layer: :style, label: :style, axis: :style, legend: :style, layer_label: :style]
@spec style_stack() :: type()
The type a style site takes (§3.6): a reference, an inline node, a field binding, a generator call, or a list of them.