@n1kname/components 0.14.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -3
- package/src/AppShell.astro +412 -0
- package/src/FlowDiagram.astro +536 -0
- package/src/PeriodPicker.astro +264 -0
- package/src/SideNav.astro +188 -0
- package/src/icons.ts +34 -0
- package/src/page-change.css +41 -2
- package/src/period.js +160 -0
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* A drawn diagram: nodes placed by hand on a viewBox, edges routed between their sides with
|
|
4
|
+
* rounded elbows, Lucide icons inside the nodes. For a diagram that makes an argument through
|
|
5
|
+
* its shape, where a layout engine would put things in the wrong place.
|
|
6
|
+
*
|
|
7
|
+
* It builds itself once as it comes into view, in `step` order: nodes settle in, edges draw
|
|
8
|
+
* from their source, the arrowhead and label land as the line arrives. An edge with `flow`
|
|
9
|
+
* then carries a small pulse along itself, so a loop reads as a loop. Without script, or with
|
|
10
|
+
* reduced motion, the diagram is simply there and nothing moves.
|
|
11
|
+
*/
|
|
12
|
+
import { ICONS, type IconName } from './icons';
|
|
13
|
+
|
|
14
|
+
type Side = 'top' | 'right' | 'bottom' | 'left';
|
|
15
|
+
type Tone = 'accent' | 'cool' | 'quiet' | 'solid';
|
|
16
|
+
|
|
17
|
+
interface Node {
|
|
18
|
+
id: string;
|
|
19
|
+
/** Centre. */
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
w?: number;
|
|
23
|
+
h?: number;
|
|
24
|
+
shape?: 'pill' | 'circle' | 'icon';
|
|
25
|
+
icon?: IconName;
|
|
26
|
+
label: string;
|
|
27
|
+
/** Up to two lines under an icon node; break them with \\n. */
|
|
28
|
+
sub?: string;
|
|
29
|
+
tone?: Tone;
|
|
30
|
+
step?: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface Edge {
|
|
34
|
+
from: string;
|
|
35
|
+
to: string;
|
|
36
|
+
fromSide: Side;
|
|
37
|
+
toSide: Side;
|
|
38
|
+
/** Shift the anchor along its side, in px from the side's middle. */
|
|
39
|
+
fromShift?: number;
|
|
40
|
+
toShift?: number;
|
|
41
|
+
/** Where a horizontal-to-horizontal edge turns, as an x; vertical-to-vertical, as a y. */
|
|
42
|
+
turn?: number;
|
|
43
|
+
label?: string;
|
|
44
|
+
/** Label position, defaults to the middle of the longest segment, above it. */
|
|
45
|
+
labelAt?: [number, number];
|
|
46
|
+
tone?: Tone;
|
|
47
|
+
step?: number;
|
|
48
|
+
flow?: boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface Ring {
|
|
52
|
+
cx: number;
|
|
53
|
+
cy: number;
|
|
54
|
+
r: number;
|
|
55
|
+
step?: number;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface Props {
|
|
59
|
+
title: string;
|
|
60
|
+
desc: string;
|
|
61
|
+
width: number;
|
|
62
|
+
height: number;
|
|
63
|
+
nodes: Node[];
|
|
64
|
+
edges: Edge[];
|
|
65
|
+
rings?: Ring[];
|
|
66
|
+
/** A short legend in the corner: lines of text, the first one bold. */
|
|
67
|
+
note?: { x: number; y: number; lines: { text: string; tone?: Tone }[] };
|
|
68
|
+
caption?: string;
|
|
69
|
+
/** Narrowest the drawing may get before it scrolls instead. */
|
|
70
|
+
minWidth?: number;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const { title, desc, width, height, nodes, edges, rings = [], note, caption, minWidth = 640 } = Astro.props;
|
|
74
|
+
// Ids from the title, so two diagrams on a page don't collide and a build stays the same.
|
|
75
|
+
let hash = 0;
|
|
76
|
+
for (const c of title) hash = (hash * 31 + c.charCodeAt(0)) | 0;
|
|
77
|
+
const uid = `flow-${(hash >>> 0).toString(36)}`;
|
|
78
|
+
|
|
79
|
+
const size = (n: Node) => {
|
|
80
|
+
if (n.shape === 'circle') return { w: n.w ?? 88, h: n.w ?? 88 };
|
|
81
|
+
if (n.shape === 'icon') return { w: n.w ?? 64, h: n.w ?? 64 };
|
|
82
|
+
return { w: n.w ?? 200, h: n.h ?? 44 };
|
|
83
|
+
};
|
|
84
|
+
const byId = new Map(nodes.map((n) => [n.id, n]));
|
|
85
|
+
|
|
86
|
+
const anchor = (n: Node, side: Side, shift = 0): [number, number] => {
|
|
87
|
+
const { w, h } = size(n);
|
|
88
|
+
if (side === 'top') return [n.x + shift, n.y - h / 2];
|
|
89
|
+
if (side === 'bottom') return [n.x + shift, n.y + h / 2];
|
|
90
|
+
if (side === 'left') return [n.x - w / 2, n.y + shift];
|
|
91
|
+
return [n.x + w / 2, n.y + shift];
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const horizontal = (s: Side) => s === 'left' || s === 'right';
|
|
95
|
+
|
|
96
|
+
// The corner points of an orthogonal route between two anchors.
|
|
97
|
+
const route = (e: Edge, a: [number, number], b: [number, number]): [number, number][] => {
|
|
98
|
+
const [ax, ay] = a;
|
|
99
|
+
const [bx, by] = b;
|
|
100
|
+
if (horizontal(e.fromSide) && horizontal(e.toSide)) {
|
|
101
|
+
if (ay === by) return [a, b];
|
|
102
|
+
const tx = e.turn ?? (ax + bx) / 2;
|
|
103
|
+
return [a, [tx, ay], [tx, by], b];
|
|
104
|
+
}
|
|
105
|
+
if (!horizontal(e.fromSide) && !horizontal(e.toSide)) {
|
|
106
|
+
if (ax === bx) return [a, b];
|
|
107
|
+
const ty = e.turn ?? (ay + by) / 2;
|
|
108
|
+
return [a, [ax, ty], [bx, ty], b];
|
|
109
|
+
}
|
|
110
|
+
return horizontal(e.fromSide) ? [a, [bx, ay], b] : [a, [ax, by], b];
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// A path through the points with each corner rounded, never by more than half a segment.
|
|
114
|
+
const R = 12;
|
|
115
|
+
const rounded = (pts: [number, number][]) => {
|
|
116
|
+
let d = `M${pts[0][0]} ${pts[0][1]}`;
|
|
117
|
+
for (let i = 1; i < pts.length - 1; i++) {
|
|
118
|
+
const [px, py] = pts[i - 1];
|
|
119
|
+
const [cx, cy] = pts[i];
|
|
120
|
+
const [nx, ny] = pts[i + 1];
|
|
121
|
+
const r = Math.min(R, Math.hypot(cx - px, cy - py) / 2, Math.hypot(nx - cx, ny - cy) / 2);
|
|
122
|
+
const inX = cx - Math.sign(cx - px) * r;
|
|
123
|
+
const inY = cy - Math.sign(cy - py) * r;
|
|
124
|
+
const outX = cx + Math.sign(nx - cx) * r;
|
|
125
|
+
const outY = cy + Math.sign(ny - cy) * r;
|
|
126
|
+
d += ` L${inX} ${inY} Q${cx} ${cy} ${outX} ${outY}`;
|
|
127
|
+
}
|
|
128
|
+
const [lx, ly] = pts[pts.length - 1];
|
|
129
|
+
return `${d} L${lx} ${ly}`;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// A small open chevron at the end, pointing along the last segment.
|
|
133
|
+
const head = (pts: [number, number][]) => {
|
|
134
|
+
const [x, y] = pts[pts.length - 1];
|
|
135
|
+
const [px, py] = pts[pts.length - 2];
|
|
136
|
+
const dx = Math.sign(x - px);
|
|
137
|
+
const dy = Math.sign(y - py);
|
|
138
|
+
const s = 6;
|
|
139
|
+
return `M${x - dx * s - dy * s} ${y - dy * s - dx * s} L${x} ${y} L${x - dx * s + dy * s} ${y - dy * s + dx * s}`;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const longest = (pts: [number, number][]): [number, number] => {
|
|
143
|
+
let best = 0;
|
|
144
|
+
let at: [number, number] = pts[0];
|
|
145
|
+
for (let i = 1; i < pts.length; i++) {
|
|
146
|
+
const len = Math.hypot(pts[i][0] - pts[i - 1][0], pts[i][1] - pts[i - 1][1]);
|
|
147
|
+
if (len > best) {
|
|
148
|
+
best = len;
|
|
149
|
+
at = [(pts[i][0] + pts[i - 1][0]) / 2, (pts[i][1] + pts[i - 1][1]) / 2 - 10];
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return at;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const drawn = edges.map((e) => {
|
|
156
|
+
const a = anchor(byId.get(e.from)!, e.fromSide, e.fromShift);
|
|
157
|
+
// Stop short of the target so the arrowhead does not sit on its border.
|
|
158
|
+
const t = anchor(byId.get(e.to)!, e.toSide, e.toShift);
|
|
159
|
+
const gap = 4;
|
|
160
|
+
const b: [number, number] =
|
|
161
|
+
e.toSide === 'left' ? [t[0] - gap, t[1]] : e.toSide === 'right' ? [t[0] + gap, t[1]] : e.toSide === 'top' ? [t[0], t[1] - gap] : [t[0], t[1] + gap];
|
|
162
|
+
const pts = route(e, a, b);
|
|
163
|
+
return { ...e, d: rounded(pts), head: head(pts), at: e.labelAt ?? longest(pts), tone: e.tone ?? 'quiet', step: e.step ?? 1 };
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// Label lines for a circle: break at the space nearest the middle when it is long.
|
|
167
|
+
const lines = (label: string) => {
|
|
168
|
+
if (label.length <= 10 || !label.includes(' ')) return [label];
|
|
169
|
+
const words = label.split(' ');
|
|
170
|
+
// Three or more words: keep short words with their neighbour ("UI and motion" / "designer").
|
|
171
|
+
if (words.length >= 3 && label.length > 14) {
|
|
172
|
+
const last = words.pop()!;
|
|
173
|
+
const head = words.join(' ');
|
|
174
|
+
return head.length > 10 ? [words.slice(0, -1).join(' '), words.at(-1)!, last] : [head, last];
|
|
175
|
+
}
|
|
176
|
+
const mid = label.length / 2;
|
|
177
|
+
let cut = 0;
|
|
178
|
+
let best = Infinity;
|
|
179
|
+
for (let i = 0; i < label.length; i++) if (label[i] === ' ' && Math.abs(i - mid) < best) (best = Math.abs(i - mid)), (cut = i);
|
|
180
|
+
return [label.slice(0, cut), label.slice(cut + 1)];
|
|
181
|
+
};
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
<figure class="flow" data-flow>
|
|
185
|
+
<div class="scroll" tabindex="0" role="region" aria-label={title}>
|
|
186
|
+
<svg viewBox={`0 0 ${width} ${height}`} role="img" aria-labelledby={`${uid}-t ${uid}-d`} style={`min-width: ${minWidth}px`}>
|
|
187
|
+
<title id={`${uid}-t`}>{title}</title>
|
|
188
|
+
<desc id={`${uid}-d`}>{desc}</desc>
|
|
189
|
+
|
|
190
|
+
{rings.map((r) => <circle class="ring" data-step={r.step ?? 0} cx={r.cx} cy={r.cy} r={r.r} />)}
|
|
191
|
+
|
|
192
|
+
<g class="edges">
|
|
193
|
+
{
|
|
194
|
+
drawn.map((e) => (
|
|
195
|
+
<g class:list={['edge', e.tone]} data-step={e.step}>
|
|
196
|
+
<path class="line" d={e.d} pathLength="1" />
|
|
197
|
+
<path class="head" d={e.head} />
|
|
198
|
+
{e.label && (
|
|
199
|
+
<text class="edge-label" x={e.at[0]} y={e.at[1]}>
|
|
200
|
+
{e.label}
|
|
201
|
+
</text>
|
|
202
|
+
)}
|
|
203
|
+
{e.flow && (
|
|
204
|
+
<circle class="pulse" r="3.5">
|
|
205
|
+
<animateMotion dur="2.8s" begin="indefinite" repeatCount="indefinite" keyPoints="0;1;1" keyTimes="0;0.7;1" calcMode="linear" path={e.d} />
|
|
206
|
+
</circle>
|
|
207
|
+
)}
|
|
208
|
+
</g>
|
|
209
|
+
))
|
|
210
|
+
}
|
|
211
|
+
</g>
|
|
212
|
+
|
|
213
|
+
{
|
|
214
|
+
nodes.map((n) => {
|
|
215
|
+
const { w, h } = size(n);
|
|
216
|
+
const tone = n.tone ?? 'quiet';
|
|
217
|
+
const step = n.step ?? 0;
|
|
218
|
+
if (n.shape === 'icon') {
|
|
219
|
+
return (
|
|
220
|
+
<g class:list={['node', 'icon-node', tone]} data-step={step}>
|
|
221
|
+
<circle class="disc" cx={n.x} cy={n.y} r={w / 2} />
|
|
222
|
+
{n.icon && (
|
|
223
|
+
<svg x={n.x - 15} y={n.y - 15} width="30" height="30" viewBox="0 0 24 24" class="glyph" set:html={ICONS[n.icon]} />
|
|
224
|
+
)}
|
|
225
|
+
<text class="name" x={n.x} y={n.y + w / 2 + 24}>{n.label}</text>
|
|
226
|
+
{n.sub?.split('\n').map((s, i) => <text class="sub" x={n.x} y={n.y + w / 2 + 44 + i * 18}>{s}</text>)}
|
|
227
|
+
</g>
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
if (n.shape === 'circle') {
|
|
231
|
+
const ls = lines(n.label);
|
|
232
|
+
return (
|
|
233
|
+
<g class:list={['node', 'circle-node', tone]} data-step={step}>
|
|
234
|
+
<circle class="disc" cx={n.x} cy={n.y} r={w / 2} />
|
|
235
|
+
{ls.map((l, i) => (
|
|
236
|
+
<text class="name" x={n.x} y={n.y + (i - (ls.length - 1) / 2) * 19 + 5}>
|
|
237
|
+
{l}
|
|
238
|
+
</text>
|
|
239
|
+
))}
|
|
240
|
+
</g>
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
return (
|
|
244
|
+
<g class:list={['node', 'pill-node', tone]} data-step={step}>
|
|
245
|
+
<rect class="disc" x={n.x - w / 2} y={n.y - h / 2} width={w} height={h} rx={h / 2} />
|
|
246
|
+
{n.icon && <svg x={n.x - w / 2 + 16} y={n.y - 10} width="20" height="20" viewBox="0 0 24 24" class="glyph" set:html={ICONS[n.icon]} />}
|
|
247
|
+
<text class="name" x={n.icon ? n.x + 12 : n.x} y={n.y + 5}>{n.label}</text>
|
|
248
|
+
</g>
|
|
249
|
+
);
|
|
250
|
+
})
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
{
|
|
254
|
+
note && (
|
|
255
|
+
<g class="note" data-step={Math.max(...drawn.map((e) => e.step), 0) + 1}>
|
|
256
|
+
{note.lines.map((l, i) => (
|
|
257
|
+
<text x={note.x} y={note.y + i * 22} class:list={[i === 0 && 'note-head', l.tone]}>
|
|
258
|
+
{l.text}
|
|
259
|
+
</text>
|
|
260
|
+
))}
|
|
261
|
+
</g>
|
|
262
|
+
)
|
|
263
|
+
}
|
|
264
|
+
</svg>
|
|
265
|
+
</div>
|
|
266
|
+
{caption && <figcaption>{caption}</figcaption>}
|
|
267
|
+
</figure>
|
|
268
|
+
|
|
269
|
+
<script>
|
|
270
|
+
// One step is a beat. Arm only what is below the fold, so a diagram already on screen
|
|
271
|
+
// never blinks out, and start the pulses once their line has drawn.
|
|
272
|
+
const STEP = 220;
|
|
273
|
+
if (matchMedia('(prefers-reduced-motion: no-preference)').matches) {
|
|
274
|
+
document.querySelectorAll<HTMLElement>('[data-flow]').forEach((fig) => {
|
|
275
|
+
if (fig.getBoundingClientRect().top < innerHeight * 0.85) return;
|
|
276
|
+
fig.classList.add('armed');
|
|
277
|
+
const io = new IntersectionObserver(
|
|
278
|
+
(entries) => {
|
|
279
|
+
if (!entries.some((e) => e.isIntersecting)) return;
|
|
280
|
+
io.disconnect();
|
|
281
|
+
fig.querySelectorAll<SVGElement>('[data-step]').forEach((el) => el.style.setProperty('--d', `${Number(el.dataset.step) * STEP}ms`));
|
|
282
|
+
fig.classList.replace('armed', 'in');
|
|
283
|
+
let last = 0;
|
|
284
|
+
fig.querySelectorAll<SVGGElement>('.edge').forEach((g) => {
|
|
285
|
+
const at = Number(g.dataset.step) * STEP + 900;
|
|
286
|
+
last = Math.max(last, at);
|
|
287
|
+
const m = g.querySelector<SVGAnimationElement>('animateMotion');
|
|
288
|
+
if (m) setTimeout(() => (g.classList.add('flowing'), m.beginElement()), at);
|
|
289
|
+
});
|
|
290
|
+
},
|
|
291
|
+
{ rootMargin: '0px 0px -15% 0px' },
|
|
292
|
+
);
|
|
293
|
+
io.observe(fig);
|
|
294
|
+
});
|
|
295
|
+
// On screen from the start: the pulses still run, a beat after load.
|
|
296
|
+
document.querySelectorAll<HTMLElement>('[data-flow]:not(.armed) .edge').forEach((g) => {
|
|
297
|
+
const m = g.querySelector<SVGAnimationElement>('animateMotion');
|
|
298
|
+
if (m) setTimeout(() => (g.classList.add('flowing'), m.beginElement()), 600);
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
</script>
|
|
302
|
+
|
|
303
|
+
<style>
|
|
304
|
+
.flow {
|
|
305
|
+
margin-block: var(--sp-7);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.scroll {
|
|
309
|
+
overflow-x: auto;
|
|
310
|
+
background: var(--c-surface-sunken);
|
|
311
|
+
border: 1px solid var(--c-border);
|
|
312
|
+
border-radius: var(--radius-lg);
|
|
313
|
+
padding: var(--sp-6) var(--sp-5);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
svg {
|
|
317
|
+
display: block;
|
|
318
|
+
width: 100%;
|
|
319
|
+
height: auto;
|
|
320
|
+
overflow: visible;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
text {
|
|
324
|
+
font-family: var(--font-body);
|
|
325
|
+
text-anchor: middle;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.name {
|
|
329
|
+
font-weight: 600;
|
|
330
|
+
font-size: 15px;
|
|
331
|
+
fill: var(--c-text);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.sub {
|
|
335
|
+
font-size: 13px;
|
|
336
|
+
fill: var(--c-text-muted);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/* Nodes. Tint and border carry the tone, never a saturated slab, except `solid`, the one
|
|
340
|
+
* node a diagram is about. */
|
|
341
|
+
.disc {
|
|
342
|
+
fill: var(--c-surface);
|
|
343
|
+
stroke: var(--c-diagram-edge);
|
|
344
|
+
stroke-width: 1.5;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.accent .disc {
|
|
348
|
+
fill: var(--c-surface-tint);
|
|
349
|
+
stroke: var(--c-accent-edge);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.cool .disc {
|
|
353
|
+
fill: var(--c-tag-cool-bg);
|
|
354
|
+
stroke: color-mix(in oklab, var(--c-tag-cool-text) 45%, transparent);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.solid .disc {
|
|
358
|
+
fill: var(--c-accent);
|
|
359
|
+
stroke: var(--c-accent);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.solid .name {
|
|
363
|
+
fill: var(--c-on-accent);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.glyph {
|
|
367
|
+
fill: none;
|
|
368
|
+
stroke: currentColor;
|
|
369
|
+
stroke-width: 1.75;
|
|
370
|
+
stroke-linecap: round;
|
|
371
|
+
stroke-linejoin: round;
|
|
372
|
+
color: var(--c-text-accent);
|
|
373
|
+
overflow: visible;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.cool .glyph {
|
|
377
|
+
color: var(--c-tag-cool-text);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.ring {
|
|
381
|
+
fill: color-mix(in oklab, var(--c-accent) 5%, transparent);
|
|
382
|
+
stroke: var(--c-accent-edge);
|
|
383
|
+
stroke-width: 1.5;
|
|
384
|
+
stroke-dasharray: 2 5;
|
|
385
|
+
stroke-linecap: round;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/* Edges. */
|
|
389
|
+
.line,
|
|
390
|
+
.head {
|
|
391
|
+
fill: none;
|
|
392
|
+
stroke: var(--c-diagram-line);
|
|
393
|
+
stroke-width: 1.75;
|
|
394
|
+
stroke-linecap: round;
|
|
395
|
+
stroke-linejoin: round;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.edge.accent .line,
|
|
399
|
+
.edge.accent .head {
|
|
400
|
+
stroke: var(--c-accent);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
.edge.cool .line,
|
|
404
|
+
.edge.cool .head {
|
|
405
|
+
stroke: var(--c-tag-cool-text);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.edge-label {
|
|
409
|
+
font-size: 13px;
|
|
410
|
+
font-weight: 600;
|
|
411
|
+
fill: var(--c-text-muted);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.edge.accent .edge-label {
|
|
415
|
+
fill: var(--c-text-accent);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.edge.cool .edge-label {
|
|
419
|
+
fill: var(--c-tag-cool-text);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.pulse {
|
|
423
|
+
fill: var(--c-diagram-line);
|
|
424
|
+
opacity: 0;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.edge.accent .pulse {
|
|
428
|
+
fill: var(--c-accent);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.edge.cool .pulse {
|
|
432
|
+
fill: var(--c-tag-cool-text);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.flowing .pulse {
|
|
436
|
+
opacity: 1;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
.note text {
|
|
440
|
+
text-anchor: start;
|
|
441
|
+
font-size: 14px;
|
|
442
|
+
fill: var(--c-text-muted);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
.note .note-head {
|
|
446
|
+
font-weight: 600;
|
|
447
|
+
fill: var(--c-text);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.note .accent {
|
|
451
|
+
fill: var(--c-text-accent);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/* The build. Armed: everything waits. In: each part plays at its own beat. */
|
|
455
|
+
.armed [data-step] {
|
|
456
|
+
opacity: 0;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.armed .line {
|
|
460
|
+
stroke-dasharray: 1 1;
|
|
461
|
+
stroke-dashoffset: 1;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.in [data-step] {
|
|
465
|
+
animation: settle 560ms var(--ease-spring) var(--d, 0ms) both;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.in .node,
|
|
469
|
+
.in .ring {
|
|
470
|
+
transform-box: fill-box;
|
|
471
|
+
transform-origin: center;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
.in .edge {
|
|
475
|
+
animation: none;
|
|
476
|
+
opacity: 1;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
.in .edge .line {
|
|
480
|
+
animation: draw 700ms cubic-bezier(0.3, 0, 0.2, 1) var(--d, 0ms) both;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
.in .edge .head,
|
|
484
|
+
.in .edge .edge-label {
|
|
485
|
+
animation: land 320ms var(--ease-out) calc(var(--d, 0ms) + 560ms) both;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.in .ring {
|
|
489
|
+
animation-name: grow;
|
|
490
|
+
animation-duration: 900ms;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
@keyframes settle {
|
|
494
|
+
from {
|
|
495
|
+
opacity: 0;
|
|
496
|
+
scale: 0.92;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
@keyframes grow {
|
|
501
|
+
from {
|
|
502
|
+
opacity: 0;
|
|
503
|
+
scale: 0.8;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
@keyframes draw {
|
|
508
|
+
from {
|
|
509
|
+
stroke-dasharray: 1 1;
|
|
510
|
+
stroke-dashoffset: 1;
|
|
511
|
+
}
|
|
512
|
+
to {
|
|
513
|
+
stroke-dasharray: 1 1;
|
|
514
|
+
stroke-dashoffset: 0;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
@keyframes land {
|
|
519
|
+
from {
|
|
520
|
+
opacity: 0;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
@media (prefers-reduced-motion: reduce) {
|
|
525
|
+
.pulse {
|
|
526
|
+
display: none;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
figcaption {
|
|
531
|
+
margin-top: var(--sp-4);
|
|
532
|
+
font-size: var(--text-body-sm);
|
|
533
|
+
color: var(--c-text-muted);
|
|
534
|
+
max-width: var(--layout-measure);
|
|
535
|
+
}
|
|
536
|
+
</style>
|