Macaw.Frame.Document.Coverage (macaw_frame v0.1.0)

Copy Markdown View Source

Coverage of a field's declared values (spec/02 §7.3, D-194): a mapping by a field — a layer's style stack holding {:field, f}, or a kind's own mapping named under on with its cases — is held to the field's declared values wherever the slot's schema declares them. Every value must name a style (the design's or the theme's palette) or a case, else {:uncovered, f, missing} at the layer's style or the kind's key, missing in declared order. A field with no declared values is not checked. Coverage is accessibility's too: a value with no style has no cue beyond hue (11 §7).

iex> schema = Macaw.Data.Schema.new!(%{"health" => %{type: :category, values: ["good", "sick"]}})
iex> design = %{slots: %{"s" => %{fields: ["health"]}},
...>   layers: [%{kind: "symbol", data: "s", style: [{:field, "health"}]}]}
iex> Macaw.Frame.Document.Coverage.check(design, %{"s" => schema})
{:error, [{[:layers, 0, :style], {:uncovered, "health", ["sick"]}}]}

Summary

Functions

:ok, or every mapping that misses a declared value; theme the theme whose palette names are styles too (the default theme's when not given).

Functions

check(design, schemas, theme \\ Theme.default())

@spec check(term(), term(), term()) :: :ok | {:error, [Macaw.Base.Fault.t(), ...]}

:ok, or every mapping that misses a declared value; theme the theme whose palette names are styles too (the default theme's when not given).