The design schema as data (spec/14 §14.2).
Every node kind of the design map (spec/14 §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 JSON codec and the introspection a builder needs all derive from
these specs, so a key added here reaches every consumer at once (D-58). Which keys are
style is keys(:style), never a hand-kept list.
The design-level node kinds live here; the frame's and the marks' tables are in two hidden submodules reached only through this one.
Examples
iex> Visualize.Chart.Schema.key(:mark, :style).facet
:style
iex> Visualize.Chart.Schema.default(:frame, :margin)
%{top: 20, right: 20, bottom: 30, left: 40}
iex> Visualize.Chart.Schema.channels(:line)
%{required: [:x, :y], optional: [:series]}
Summary
Types
What a key is about (spec/14 §1.3).
The heading a style key is shown under in a form (spec/14 §3.1, §14.2).
One key of a node kind.
A node kind of the design map (spec/14 §1.2).
How two fragments combine under a key (spec/14 §1.5).
A type term of spec/14 §1.4.
Functions
The style names every design declares (spec/14 §3.3).
The required and optional channels of a mark type (spec/14 §5.2).
The four column types a source's types may name (spec/14 §2.3, #369).
The default of a key, nil when it has none or is required.
The key specs of a node kind, in the order of its table in spec/14.
The group a key is shown under, or nil (spec/14 §14.2).
The groups a node kind's keys carry, once each, in table order (spec/14 §14.2).
The spec of one key of a node kind, or nil when the node has no such key.
Every {kind, key} pair carrying the facet, over every node kind (spec/14 §1.3).
The keys of one node kind carrying the facet, in table order.
Every node kind of spec/14 §1.2, the design first.
The mark types of spec/14 §5.2, in table order.
The option keys a mark type reads (spec/14 §5.3).
The scale kinds of spec/14 §4.3.
The type a style site takes (spec/14 §3.6): a reference, an inline node, or a list of either.
The required and optional keys of a transform op (spec/14 §5.4).
The transform ops of spec/14 §5.4.
Types
@type facet() :: :binding | :channel | :geometry | :style | :content
What a key is about (spec/14 §1.3).
@type group() :: :fill | :stroke | :font | :position | :effects
The heading a style key is shown under in a form (spec/14 §3.1, §14.2).
@type key_spec() :: %{ key: atom(), type: type(), facet: facet(), default: term(), required: boolean(), merge: merge(), range: {number(), number(), number()} | nil, group: group() | nil }
One key of a node kind.
@type kind() :: atom()
A node kind of the design map (spec/14 §1.2).
@type merge() :: :concat | :union | :deep | :override
How two fragments combine under a key (spec/14 §1.5).
A type term of spec/14 §1.4.
Functions
@spec builtin_styles() :: [atom(), ...]
The style names every design declares (spec/14 §3.3).
The required and optional channels of a mark type (spec/14 §5.2).
@spec column_types() :: [atom(), ...]
The four column types a source's types may name (spec/14 §2.3, #369).
The default of a key, nil when it has none or is required.
The key specs of a node kind, in the order of its table in spec/14.
The group a key is shown under, or nil (spec/14 §14.2).
iex> Visualize.Chart.Schema.group(:style, :stroke_linecap)
:stroke
iex> Visualize.Chart.Schema.group(:style, :extends)
nil
The groups a node kind's keys carry, once each, in table order (spec/14 §14.2).
iex> Visualize.Chart.Schema.groups(:style)
[:fill, :stroke, :font, :position, :effects]
iex> Visualize.Chart.Schema.groups(:mark)
[]
The spec of one key of a node kind, or nil when the node has no such key.
Every {kind, key} pair carrying the facet, over every node kind (spec/14 §1.3).
The keys of one node kind carrying the facet, in table order.
@spec kinds() :: [kind(), ...]
Every node kind of spec/14 §1.2, the design first.
@spec mark_types() :: [atom(), ...]
The mark types of spec/14 §5.2, in table order.
The option keys a mark type reads (spec/14 §5.3).
@spec scale_kinds() :: [atom(), ...]
The scale kinds of spec/14 §4.3.
@spec style_stack() :: type()
The type a style site takes (spec/14 §3.6): a reference, an inline node, or a list of either.
Written once because five keys share it — mark.style, label.style, mark_label.style,
axis.style and legend.style — and a sixth would otherwise be a sixth copy.
iex> {:one_of, alts} = Visualize.Chart.Schema.style_stack()
iex> {:ref, :style} in alts
true
The required and optional keys of a transform op (spec/14 §5.4).
@spec transform_ops() :: [atom(), ...]
The transform ops of spec/14 §5.4.