Skill Tracer
Skills › Visual Explainer › visual-explainer › diagrams.md

diagrams.md

93 lines · plugins/visual-explainer/references/diagrams.md at 9d5f880

Open on GitHub

Most marks come from matching words in the file, so treat them as pointers.

1# Hand-drawn SVG figures
2
3Inline SVG is the default figure: exact placement, page tokens and fonts, and motion. The kit (`kit.md`) styles and runs every pattern here; this file gives the markup contracts and the rules.
4
5Steps, replays, live figures, and 3D: `motion.md`.
6

Hand-drawn SVG figures

Inline SVG is the default figure: exact placement, page tokens and fonts, and motion. The kit (kit.md) styles and runs every pattern here; this file gives the markup contracts and the rules.

Steps, replays, live figures, and 3D: motion.md.

Raw lines 1 to 6
7## Plan on a grid
8
9```
10x: 40 280 520 760 columns 240 apart
11 ┌──────┐ GET /u ┌──────┐ miss ┌──────┐
12y:90│Client│──────────►│ API │────────►│ DB │
13 └──────┘ └──┬───┘ └──────┘
14 hit │ reads
15y:210 ┌──▼───┐
16 │Cache │
17 └──────┘
18```
20- Sketch in ASCII first, then turn columns and rows into coordinates. Labels 14 units or more; the renderer sizes the drawing so they stay readable on a phone, whatever the viewBox.
21- At least 40 units between boxes. Orthogonal edges (`M x y H x V y`). Labels 9 units above their line.
22- SVG text does not wrap: lines of about 18 characters, `<tspan x=".." dy="1.2em">` for a second line.
23- A boundary (process, network, trust zone) is a dashed `rect.ve-bnd` with a `text.ve-bnd-t` label in its top-left corner.
24- Over about 12 nodes, draw a 5–8 node overview and put the detail in cards or a second figure.
25- Sequence: one column per actor with a thin lifeline, time runs down, each arrow labeled with its call. Schema: one box per table with its key fields in mono, crow's-foot ends for many.

Plan on a grid

x:  40        280        520        760      columns 240 apart
    ┌──────┐  GET /u   ┌──────┐  miss   ┌──────┐
y:90│Client│──────────►│ API  │────────►│  DB  │
    └──────┘           └──┬───┘         └──────┘
                     hit  │ reads
y:210                  ┌──▼───┐
                       │Cache │
                       └──────┘
  • Sketch in ASCII first, then turn columns and rows into coordinates. Labels 14 units or more; the renderer sizes the drawing so they stay readable on a phone, whatever the viewBox.
  • At least 40 units between boxes. Orthogonal edges (M x y H x V y). Labels 9 units above their line.
  • SVG text does not wrap: lines of about 18 characters, <tspan x=".." dy="1.2em"> for a second line.
  • A boundary (process, network, trust zone) is a dashed rect.ve-bnd with a text.ve-bnd-t label in its top-left corner.
  • Over about 12 nodes, draw a 5–8 node overview and put the detail in cards or a second figure.
  • Sequence: one column per actor with a thin lifeline, time runs down, each arrow labeled with its call. Schema: one box per table with its key fields in mono, crow's-foot ends for many.
Raw lines 7 to 26
27## Shapes
29- **Shape says what a thing is.** Rect for a service. Cylinder for a datastore (`path.sh` + `ellipse.sh.lid`). Rect with 3 short dividers for a queue. Dashed rect for something optional or down.
30- **Glyph** (`.gl`): a 16-unit line drawing in the node's top-left corner, only when the name does not say the kind. Never emoji.
31- **Edges:** solid = sync call · dashed = async or optional · thick glowing accent = the path this figure is about · red ✕ = blocked.

Shapes

  • Shape says what a thing is. Rect for a service. Cylinder for a datastore (path.sh + ellipse.sh.lid). Rect with 3 short dividers for a queue. Dashed rect for something optional or down.
  • Glyph (.gl): a 16-unit line drawing in the node's top-left corner, only when the name does not say the kind. Never emoji.
  • Edges: solid = sync call · dashed = async or optional · thick glowing accent = the path this figure is about · red ✕ = blocked.
Raw lines 27 to 32
33## Dimensions
35A number that measures a span sits on that span: latency down a sequence's time axis, a TTL window on a timeline, a field's size on a byte layout.
37```
38 ┼ ┼ extension lines from the two measured points
39 │◄─────── 9 ms ────────►│ dimension line, value in a gap at its middle
40```
42```html
43<g class="ve-dim"><path class="ext" d="M120 300V322M380 300V322"/><path class="ln" d="M120 316H380M116 320l8-8M376 320l8-8"/><text x="250" y="310">9 ms</text></g>
44```
46- A short 45° tick at each end. The value sits centered 6 units above the line, never on it.
47- Dimensions run on rails beside the shapes, the shortest nearest. Spans that add up (`1 ms` then `9 ms`) chain on one rail, with the total on the next rail out.
48- The dimension that carries the claim takes the accent (`.is-key`), one per figure.

Dimensions

A number that measures a span sits on that span: latency down a sequence's time axis, a TTL window on a timeline, a field's size on a byte layout.

   ┼                       ┼    extension lines from the two measured points
   │◄─────── 9 ms ────────►│    dimension line, value in a gap at its middle
<g class="ve-dim"><path class="ext" d="M120 300V322M380 300V322"/><path class="ln" d="M120 316H380M116 320l8-8M376 320l8-8"/><text x="250" y="310">9 ms</text></g>
  • A short 45° tick at each end. The value sits centered 6 units above the line, never on it.
  • Dimensions run on rails beside the shapes, the shortest nearest. Spans that add up (1 ms then 9 ms) chain on one rail, with the total on the next rail out.
  • The dimension that carries the claim takes the accent (.is-key), one per figure.
Raw lines 33 to 49
50## Flow dots
52Moving dots show direction and volume on the main figure when traffic or data moves. The ratio of spawn intervals is the real split.
54```html
55<path data-flow="hit" data-every="420" d="M95 105H375V80H695V105H375"/> <!-- invisible route -->
56<path data-flow="miss" data-every="7000" d="M95 105H355V270H395V130H695"/> <!-- 420:7000 ≈ 94:6 -->
57<g class="ve-dots" aria-hidden="true"></g> <!-- after edges, before nodes -->
58```
60Routes pass through node centers, so dots enter one box and leave the next. One moving layer per page.

Flow dots

Moving dots show direction and volume on the main figure when traffic or data moves. The ratio of spawn intervals is the real split.

<path data-flow="hit"  data-every="420"  d="M95 105H375V80H695V105H375"/>   <!-- invisible route -->
<path data-flow="miss" data-every="7000" d="M95 105H355V270H395V130H695"/>  <!-- 420:7000 ≈ 94:6 -->
<g class="ve-dots" aria-hidden="true"></g>                                   <!-- after edges, before nodes -->

Routes pass through node centers, so dots enter one box and leave the next. One moving layer per page.

Raw lines 50 to 61
Starts an agent spawn :52
62## Linked highlighting
64Elements that share a `data-ref` light up together: a prose term, a node, an edge, a card, a button. Prose terms get `tabindex="0"`; one element can carry several refs (`data-ref="hit miss"`). Link 2–4 key terms per figure, not every noun.

Linked highlighting

Elements that share a data-ref light up together: a prose term, a node, an edge, a card, a button. Prose terms get tabindex="0"; one element can carry several refs (data-ref="hit miss"). Link 2–4 key terms per figure, not every noun.

Raw lines 62 to 65
66## Callouts
68A numbered circle with a short leader line that ends exactly on the point it names; plan heroes use the same mark. In a stepper, callout N is step N: give the circle and its leader `data-s="N"`. Without a stepper, list them under the figure as one-line notes (`③ the miss reads Postgres`). 3–6 per figure.
70```html
71<path class="ann" data-s="3" d="M520 71V96"/><g class="ve-co" data-s="3" transform="translate(520 60)"><circle r="11"/><text>3</text></g>
72```

Callouts

A numbered circle with a short leader line that ends exactly on the point it names; plan heroes use the same mark. In a stepper, callout N is step N: give the circle and its leader data-s="N". Without a stepper, list them under the figure as one-line notes (③ the miss reads Postgres). 3–6 per figure.

<path class="ann" data-s="3" d="M520 71V96"/><g class="ve-co" data-s="3" transform="translate(520 60)"><circle r="11"/><text>3</text></g>
Raw lines 66 to 73
74## Before / after
76One drawing in the same coordinates with a toggle (`button[aria-pressed]` flips `figure[data-view]`; `.only-before` / `.only-after` groups). Added = `--ok` stroke; removed = `--risk` dashed. Static: two panels side by side at the same scale.

Before / after

One drawing in the same coordinates with a toggle (button[aria-pressed] flips figure[data-view]; .only-before / .only-after groups). Added = --ok stroke; removed = --risk dashed. Static: two panels side by side at the same scale.

Raw lines 74 to 77
78## Small multiples
80The same small diagram once per case, in the same coordinates, so the eye sees only the difference. The part that changes takes the case's status color (`.case[data-st]`; mark a kit edge or node `.is-st`, and give your own shapes `var(--st)`). Each card: status chip, short title, mini diagram, no sentence. Mini labels 14 units or more.

Small multiples

The same small diagram once per case, in the same coordinates, so the eye sees only the difference. The part that changes takes the case's status color (.case[data-st]; mark a kit edge or node .is-st, and give your own shapes var(--st)). Each card: status chip, short title, mini diagram, no sentence. Mini labels 14 units or more.

Raw lines 78 to 81
82## Small charts
84A number that does not measure a span gets a small chart beside it: `<ve-waffle>` for "N of 100", `<ve-bars>` for 2–5 values (`hot` on the one that matters), `<ve-stack>` for a share of a whole (`kit.md`). A trend is a sparkline: `0 0 100 24`, one `polyline`, `vector-effect: non-scaling-stroke`, with an `aria-label` holding the values. A drawn chart's axes and ticks are `.ve-axis`, their labels `.ve-axis-t`.

Small charts

A number that does not measure a span gets a small chart beside it: <ve-waffle> for "N of 100", <ve-bars> for 2–5 values (hot on the one that matters), <ve-stack> for a share of a whole (kit.md). A trend is a sparkline: 0 0 100 24, one polyline, vector-effect: non-scaling-stroke, with an aria-label holding the values. A drawn chart's axes and ticks are .ve-axis, their labels .ve-axis-t.

Raw lines 82 to 85
86## Page structure for 4+ sections
88A kit `<nav class="ve-toc">` before `<main>` (`kit.md`), one link per section `id`. The kit makes it sticky, scrolls it sideways on a phone, and marks the section in view.

Page structure for 4+ sections

A kit <nav class="ve-toc"> before <main> (kit.md), one link per section id. The kit makes it sticky, scrolls it sideways on a phone, and marks the section in view.

Raw lines 86 to 89
90## Other shapes
92- **File map:** nested `<ul>` in mono; each path gets a status chip (added, modified, deleted) and a `+12 −3` count.
93- **Timeline:** a CSS grid with one rail line and dated nodes; the newest gets the accent.

Other shapes

  • File map: nested <ul> in mono; each path gets a status chip (added, modified, deleted) and a +12 −3 count.
  • Timeline: a CSS grid with one rail line and dated nodes; the newest gets the accent.
Raw lines 90 to 93