The Sparkline (spec/01 §6): a minimal Frame with no furniture, for a table cell, a stat or a line of prose. One data layer over one slot, no axes, no legend, no labels, no hooks, drawn as phrasing content.
| Component | Name | Kind | Isolation |
|---|---|---|---|
| Sparkline | "macaw.sparkline" | :content | :pure |
| Parameter | Type | Default | Bindable | Meaning |
|---|---|---|---|---|
kind | :category, "line", "area", "bar" | "line" | no | the layer kind drawn |
label | :text | nil | yes | the accessible name; without one, the y field's label from the schema |
mark | :category, "none", "last", "extremes" | "last" | no | whether the last reading, or the least and greatest, carry a point |
design | {:document, Macaw.Frame.Document} | nil | no | a frame document to draw instead, its furniture stripped |
- Its one slot,
"values", has the rolesx(:timeor:number,window: true, so an unboundxreads the source's window field) andy(:number). With adesign, its slots are the document's, and every axis, legend, label and frame label is dropped before compilation (strip/1), so it never draws furniture. - It is
:pure: it renders in the page's process from its settings and its delivery and holds no value. Its render compiles its document, through the Frame's registry, and draws the delivery as the Frame's value would (Macaw.Frame.Value), so every layer reads its channels through the cell's bindings. - It renders
<span class="mw-sparkline" id="<instance>-spark">holding an<svg role="img" aria-label="…">at the context's size, described by a visually hidden sentence: the label, then the first and last readings and the least and greatest, in the field's unit (spec/11). - Its budget is its pixels:
budget("values", settings, {w, _h})is4 × ceil(w)for a line or an area andceil(w / 2)for bars (spec/05 §2); with a design, the Frame's budget of the stripped document. - It writes no state, shares no key and emits no event: it declares no write, no local key, no event, no announcement and no observation.
- Its drawn states are the contract's notices, written in a
<span>(Macaw.Frame.Drawn.notice/3), so they stay phrasing content. - The token (
data-mw-token,:liveand:socketless) is the drawing's, the Frame's content-addressed digest (spec/01 §4.4).
Decision: the visual check set's :table and :tab_stop checks do not apply to the
Sparkline. The visual set (macaw_component spec/04 §4) asks a component that draws
data for a <table> beside its image and exactly one tab stop. Both contradict §6: a
<table> is not phrasing content, so inside a paragraph of prose the HTML parser closes
the paragraph at the table's start tag and the Sparkline breaks the line it sits in; and
a tab stop on an image that is read, not operated, adds a stop with nothing to operate
to every line holding one. Its data reaches assistive technology through the sentence
its image is described by. The Sparkline runs every core check and the visual set's
:image, :token and :svg checks; the two others stand out until macaw_component
gives phrasing content its own rule.
Summary
Functions
A frame document with its furniture stripped (§6): every frame's axes, legend, label and title, and the document's labels, dropped, and every frame's margin, the room its furniture took, the Sparkline's own few pixels.