The context panel over a layer — its key and its free variables (spec/14 §19.5, §19.10) — and the rows of its mask, which the layer's row lists (§18.8, #316).
A site's mask is the keys removed at that site, so a lower layer shows through
(§19.5). rows/2 lists the paths the site's contribution carries — its top-level
keys, and the keys of each node under them — one checkbox per path under the layer's
› Mask item, checked where the mask holds it. A site masked as a whole is disabled
(§19.3) and is said so rather than drawn as every box checked.
This module compiles only when Phoenix.Component is loaded (spec/10 §1.1, D-45, D-85).
Summary
Functions
Whether a contribution is of a kind the document keys by name — style, scale, source,
var — so the site needs a key to be declared under (spec/14 §19.3).
Renders the layer's context: its declared as key control, its lock actions, the save as form of an inline group (§18.8, #382), its not-placed fault, and the free variables the site carries. Its mask is the layer row's (§18.8).
The paths a site's contribution can mask: every top-level key, and the keys of each
node under one, as Visualize.Chart.Use.mask/2 takes them (spec/14 §19.5).
Whether a contribution is a source, whose key is chosen from the host's pool rather than typed (spec/14 §19.10).
One row per maskable path of a contribution, for the layer row's › Mask item (spec/14
§18.8, #316): its name (the keys joined by ., which is the checkbox's name), whether
use masks it, and the class and title that say so.
A mask with a path added or removed, as a checkbox says: checked masks it, unchecked
does not. A path is spelt as its keys joined by ., which is the checkbox's name.
Functions
Whether a contribution is of a kind the document keys by name — style, scale, source,
var — so the site needs a key to be declared under (spec/14 §19.3).
iex> Visualize.Chart.Builder.Masks.keyed?(%{style: %{stroke: "#111"}})
true
iex> Visualize.Chart.Builder.Masks.keyed?(%{frames: %{main: %{}}})
false
Renders the layer's context: its declared as key control, its lock actions, the save as form of an inline group (§18.8, #382), its not-placed fault, and the free variables the site carries. Its mask is the layer row's (§18.8).
Attributes
id(:string) (required) - the panel's id.use(:any) (required) - the selected site, aVisualize.Chart.Use.label(:string) (required) - the site's name.fragment(:map) (required) - what the site contributes before its mask: the referenced body under its local.free(:list) - the site's free variables, asfree_vars/1gives them. Defaults to[].keyless(:boolean) - whether the site was left out for want of a key. Defaults tofalse.pool(:list) - the names of the host's sample sources, sorted (§19.10). Defaults to[].index(:any) - the site's row, which the lock actions take (§18.8, #381). Defaults tonil.reverting(:boolean) - whether a revert of this site is armed and the next click does it. Defaults tofalse.store?(:boolean) - whether a store is configured, for save as. Defaults tofalse.target(:any) - thephx-targetof the panel's events. Defaults tonil.
The paths a site's contribution can mask: every top-level key, and the keys of each
node under one, as Visualize.Chart.Use.mask/2 takes them (spec/14 §19.5).
iex> Visualize.Chart.Builder.Masks.paths(%{theme: :dark, frames: %{main: %{legend: %{}, margin: %{}}}})
[[:frames], [:frames, :main], [:frames, :main, :legend], [:frames, :main, :margin], [:theme]]
Whether a contribution is a source, whose key is chosen from the host's pool rather than typed (spec/14 §19.10).
iex> Visualize.Chart.Builder.Masks.pooled?(%{source: %{fields: [:t]}})
true
iex> Visualize.Chart.Builder.Masks.pooled?(%{style: %{}})
false
@spec rows(map(), Visualize.Chart.Use.t()) :: [map()]
One row per maskable path of a contribution, for the layer row's › Mask item (spec/14
§18.8, #316): its name (the keys joined by ., which is the checkbox's name), whether
use masks it, and the class and title that say so.
iex> use = %Visualize.Chart.Use{id: 1, ref: nil, mask: [[:frames, :main, :margin]]}
iex> rows = Visualize.Chart.Builder.Masks.rows(%{frames: %{main: %{margin: %{top: 1}}}}, use)
iex> Enum.map(rows, &{&1.name, &1.masked})
[{"frames", false}, {"frames.main", false}, {"frames.main.margin", true}]
@spec toggle(Visualize.Chart.Use.t(), String.t(), boolean()) :: Visualize.Chart.Use.t()
A mask with a path added or removed, as a checkbox says: checked masks it, unchecked
does not. A path is spelt as its keys joined by ., which is the checkbox's name.