View states as data (spec/10 §7.2), copied from visualize's Visualize.Hooks.States: a
hook draws a hover or a focus in an overlay outside the patched subtree, where the
style stack cannot reach it, so the server resolves the state's look and hands it over.
attrs(value, state) answers [{"data-mw-hover", json}] or [{"data-mw-focused", json}]: a JSON object from an SVG presentation attribute to its value, the palette's
"hover" or "focused" style looked up as every palette name is (the document's own
styles, then the theme's palette), resolved :literal, only the keys an overlay draws
(fill, fill-opacity, stroke, stroke-width, stroke-opacity,
stroke-dasharray, stroke-linecap, stroke-linejoin, opacity), a binding or a
paint left out. The focus marker lays its look over a 2-unit stroke in the theme's text
color dashed 4 2 (spec/11 §5.6); a hover has no look of its own beyond its style. A
theme swap is a new value, so the next hover's outline is the new theme's.
The looks are resolved once per theme and document styles (looks/2, held in the
drawing's looks and carried from drawing to drawing while neither changes): a render
writes the JSON held and resolves nothing, so no tick pays for a look (spec/12 §7).
Summary
Functions
The view state's attribute for value's Frame: data-mw-hover for :hover,
data-mw-focused for :focused, each a JSON object of presentation attributes. A
state of another name is {:error, [{[1], {:enum, [:hover, :focused]}}]}.
Functions
@spec attrs(Macaw.Frame.Value.t() | term(), :hover | :focused) :: [{String.t(), String.t()}] | {:error, [Macaw.Base.Fault.t()]}
The view state's attribute for value's Frame: data-mw-hover for :hover,
data-mw-focused for :focused, each a JSON object of presentation attributes. A
state of another name is {:error, [{[1], {:enum, [:hover, :focused]}}]}.