@n1kname/components 0.23.0 → 0.24.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n1kname/components",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -0,0 +1,537 @@
1
+ ---
2
+ /**
3
+ * A career framework: the levels as a ladder you can pick from, forking where one level has two
4
+ * routes (a lead and a specialist at the same level, say), and for the level picked, what it is in
5
+ * one line, its scope and what it's expected to do in each skill area. Under it, every level side
6
+ * by side in one table, to compare.
7
+ *
8
+ * The ladder is a tab list: the arrow keys move along it and pick as they go, Home and End go to
9
+ * the ends. Picking changes the panel at once; it's an answer to a question, not a moment. Without
10
+ * script only the level given as `selected` shows, and the table still holds everything.
11
+ *
12
+ * Drawn in the diagrams' own style, on a sunken plate, as Flow diagram is. Below 640px wide the
13
+ * ladder becomes a list.
14
+ */
15
+ interface Level {
16
+ id: string;
17
+ /** Its place on the ladder, 1 first. Two levels with the same rank sit one above the other. */
18
+ rank: number;
19
+ title: string;
20
+ /** Above the title, small: "Level 3". */
21
+ label?: string;
22
+ /** The route it's on, where there's more than one: "Individual contributor". */
23
+ track?: string;
24
+ experience?: string;
25
+ scope?: string;
26
+ /** The level in one sentence. */
27
+ summary?: string;
28
+ /** What it's expected to do, by area id. */
29
+ skills?: Record<string, string>;
30
+ }
31
+
32
+ interface Area {
33
+ id: string;
34
+ label: string;
35
+ /** The group it belongs to: "Craft", "Collaboration". */
36
+ theme?: string;
37
+ }
38
+
39
+ interface Props {
40
+ /** Names the ladder and the table for a screen reader. */
41
+ title: string;
42
+ levels: Level[];
43
+ areas?: Area[];
44
+ /** The level shown first. The first one by default. */
45
+ selected?: string;
46
+ /** The label on the table's disclosure. */
47
+ compare?: string;
48
+ caption?: string;
49
+ id?: string;
50
+ class?: string;
51
+ }
52
+
53
+ const { title, levels, areas = [], selected, compare = 'Compare every level', caption, class: className } = Astro.props;
54
+ let hash = 0;
55
+ for (const c of title) hash = (hash * 31 + c.charCodeAt(0)) | 0;
56
+ const uid = Astro.props.id ?? `career-${(hash >>> 0).toString(36)}`;
57
+ const current = selected ?? levels[0]?.id;
58
+
59
+ const ranks = [...new Set(levels.map((l) => l.rank))].sort((a, b) => a - b);
60
+ const at = (r: number) => levels.filter((l) => l.rank === r);
61
+ // The ladder's columns: a level (or two) per rank, a joint between ranks.
62
+ const columns = ranks.map(() => 'minmax(0, 1fr)').join(' var(--joint) ');
63
+ // A joint's shape: straight on, forking into two, joining from two, or two straight on.
64
+ const joint = (a: number, b: number) => {
65
+ const [from, to] = [at(a).length > 1, at(b).length > 1];
66
+ if (!from && !to) return 'M0 50 H28';
67
+ if (!from && to) return 'M0 50 H12 V25 H28 M12 50 V75 H28';
68
+ if (from && !to) return 'M0 25 H16 V50 H28 M0 75 H16 V50';
69
+ return 'M0 25 H28 M0 75 H28';
70
+ };
71
+
72
+ const themes = [...new Set(areas.map((a) => a.theme ?? ''))];
73
+ const byTheme = (t: string) => areas.filter((a) => (a.theme ?? '') === t);
74
+ const ordered = ranks.flatMap((r) => at(r));
75
+ ---
76
+
77
+ <figure class:list={['career-map', className]} data-career-map>
78
+ <div class="plate">
79
+ <div class="ladder" role="tablist" aria-label={title} style={`grid-template-columns: ${columns}`}>
80
+ {
81
+ ranks.map((r, k) => (
82
+ <>
83
+ {k > 0 && (
84
+ <svg class="joint" style={`grid-column: ${k * 2}`} viewBox="0 0 28 100" preserveAspectRatio="none" aria-hidden="true">
85
+ <path d={joint(ranks[k - 1], r)} vector-effect="non-scaling-stroke" />
86
+ </svg>
87
+ )}
88
+ {at(r).map((l, j, all) => (
89
+ <button
90
+ type="button"
91
+ role="tab"
92
+ class:list={['level', { fork: all.length > 1 }]}
93
+ id={`${uid}-tab-${l.id}`}
94
+ aria-selected={l.id === current ? 'true' : 'false'}
95
+ aria-controls={`${uid}-panel-${l.id}`}
96
+ tabindex={l.id === current ? 0 : -1}
97
+ data-level={l.id}
98
+ style={`grid-column: ${k * 2 + 1}; grid-row: ${all.length > 1 ? j + 1 : '1 / span 2'}`}
99
+ >
100
+ {l.label && <span class="level-label">{l.label}</span>}
101
+ <span class="level-title">{l.title}</span>
102
+ </button>
103
+ ))}
104
+ </>
105
+ ))
106
+ }
107
+ </div>
108
+
109
+ {
110
+ ordered.map((l) => (
111
+ <section class="panel" role="tabpanel" id={`${uid}-panel-${l.id}`} aria-labelledby={`${uid}-tab-${l.id}`} hidden={l.id !== current} tabindex="0">
112
+ <header class="panel-head">
113
+ <h3 class="panel-title">{l.title}</h3>
114
+ <p class="meta">{[l.label, l.track, l.experience].filter(Boolean).join(' · ')}</p>
115
+ {l.summary && <p class="summary">{l.summary}</p>}
116
+ {l.scope && (
117
+ <p class="scope">
118
+ <strong>Scope.</strong> {l.scope}
119
+ </p>
120
+ )}
121
+ </header>
122
+ {l.skills &&
123
+ themes.map((t) => (
124
+ <div class="theme">
125
+ {t && <h4 class="theme-title">{t}</h4>}
126
+ <dl>
127
+ {byTheme(t)
128
+ .filter((a) => l.skills?.[a.id])
129
+ .map((a) => (
130
+ <div>
131
+ <dt>{a.label}</dt>
132
+ <dd>{l.skills![a.id]}</dd>
133
+ </div>
134
+ ))}
135
+ </dl>
136
+ </div>
137
+ ))}
138
+ </section>
139
+ ))
140
+ }
141
+ </div>
142
+
143
+ {
144
+ areas.length > 0 && (
145
+ <details class="compare">
146
+ <summary>{compare}</summary>
147
+ <div class="scroll" role="region" aria-label={`${title}: every level side by side`} tabindex="0">
148
+ <table>
149
+ <thead>
150
+ <tr>
151
+ <td />
152
+ {ordered.map((l) => (
153
+ <th scope="col">
154
+ {l.label && <span class="level-label">{l.label}</span>}
155
+ {l.title}
156
+ </th>
157
+ ))}
158
+ </tr>
159
+ </thead>
160
+ {themes.map((t) => (
161
+ <tbody>
162
+ {t && (
163
+ <tr class="theme-row">
164
+ <th scope="colgroup" colspan={ordered.length + 1}>
165
+ {t}
166
+ </th>
167
+ </tr>
168
+ )}
169
+ {byTheme(t).map((a) => (
170
+ <tr>
171
+ <th scope="row">{a.label}</th>
172
+ {ordered.map((l) => (
173
+ <td>{l.skills?.[a.id] ?? ''}</td>
174
+ ))}
175
+ </tr>
176
+ ))}
177
+ </tbody>
178
+ ))}
179
+ </table>
180
+ </div>
181
+ </details>
182
+ )
183
+ }
184
+ {caption && <figcaption>{caption}</figcaption>}
185
+ </figure>
186
+
187
+ <style>
188
+ .career-map {
189
+ --joint: 28px;
190
+ min-width: 0;
191
+ margin: 0;
192
+ }
193
+
194
+ .plate {
195
+ container-type: inline-size;
196
+ background: var(--c-surface-sunken);
197
+ border: 1px solid var(--c-border);
198
+ border-radius: var(--radius-lg);
199
+ padding: var(--sp-5);
200
+ }
201
+
202
+ /* The ladder: a level per rank, a joint between ranks, two levels stacked where it forks. */
203
+ .ladder {
204
+ display: grid;
205
+ grid-template-rows: auto auto;
206
+ align-items: center;
207
+ }
208
+
209
+ .joint {
210
+ grid-row: 1 / span 2;
211
+ align-self: stretch;
212
+ width: 100%;
213
+ height: 100%;
214
+ overflow: visible;
215
+ }
216
+
217
+ .joint path {
218
+ fill: none;
219
+ stroke: var(--c-diagram-line);
220
+ stroke-width: 1.75;
221
+ stroke-linejoin: round;
222
+ }
223
+
224
+ .level {
225
+ display: flex;
226
+ flex-direction: column;
227
+ align-items: center;
228
+ justify-content: center;
229
+ gap: 2px;
230
+ min-height: 56px;
231
+ margin-block: var(--sp-1);
232
+ padding: var(--sp-2) var(--sp-3);
233
+ border: 1.5px solid var(--c-diagram-edge);
234
+ border-radius: var(--radius-md);
235
+ background: var(--c-surface);
236
+ color: var(--c-text);
237
+ font: inherit;
238
+ text-align: center;
239
+ cursor: pointer;
240
+ transition: border-color var(--motion-hover) var(--ease-hover);
241
+ }
242
+
243
+ .level.fork {
244
+ background: var(--c-surface-tint);
245
+ border-color: var(--c-accent-edge);
246
+ }
247
+
248
+ .level:hover {
249
+ border-color: var(--c-border-strong);
250
+ }
251
+
252
+ .level.fork:hover {
253
+ border-color: var(--c-accent);
254
+ }
255
+
256
+ /* The level picked: the one solid node, as in Flow diagram. */
257
+ .level[aria-selected='true'] {
258
+ background: var(--c-accent);
259
+ border-color: var(--c-accent);
260
+ color: var(--c-on-accent);
261
+ }
262
+
263
+ .level:focus-visible {
264
+ outline: 2px solid var(--c-focus);
265
+ outline-offset: 2px;
266
+ }
267
+
268
+ .level-label {
269
+ display: block;
270
+ font-size: var(--text-caption);
271
+ line-height: var(--leading-caption);
272
+ color: var(--c-text-muted);
273
+ }
274
+
275
+ .level[aria-selected='true'] .level-label {
276
+ color: inherit;
277
+ }
278
+
279
+ .level-title {
280
+ font-size: var(--text-body-sm);
281
+ font-weight: 600;
282
+ line-height: 1.3;
283
+ text-wrap: balance;
284
+ }
285
+
286
+ /* The level picked. */
287
+ .panel {
288
+ margin-top: var(--sp-5);
289
+ padding: var(--sp-5);
290
+ border: 1px solid var(--c-border);
291
+ border-radius: var(--radius-md);
292
+ background: var(--c-surface);
293
+ }
294
+
295
+ .panel:focus-visible {
296
+ outline: 2px solid var(--c-focus);
297
+ outline-offset: 2px;
298
+ }
299
+
300
+ .panel-title {
301
+ margin: 0;
302
+ font-family: var(--font-display);
303
+ font-size: var(--text-h3);
304
+ line-height: var(--leading-h3);
305
+ }
306
+
307
+ .meta {
308
+ margin: var(--sp-1) 0 0;
309
+ font-size: var(--text-caption);
310
+ color: var(--c-text-muted);
311
+ }
312
+
313
+ .summary {
314
+ margin: var(--sp-4) 0 0;
315
+ font-family: var(--font-display);
316
+ font-size: var(--text-sub);
317
+ line-height: var(--leading-sub);
318
+ color: var(--c-text);
319
+ text-wrap: pretty;
320
+ }
321
+
322
+ .scope {
323
+ margin: var(--sp-3) 0 0;
324
+ font-size: var(--text-body-sm);
325
+ line-height: var(--leading-body-sm);
326
+ color: var(--c-text-secondary);
327
+ }
328
+
329
+ .scope strong {
330
+ color: var(--c-text);
331
+ }
332
+
333
+ .theme {
334
+ margin-top: var(--sp-5);
335
+ padding-top: var(--sp-4);
336
+ border-top: 1px solid var(--c-border);
337
+ }
338
+
339
+ .theme-title {
340
+ margin: 0 0 var(--sp-3);
341
+ font-size: var(--text-overline);
342
+ letter-spacing: var(--tracking-overline);
343
+ text-transform: uppercase;
344
+ color: var(--c-text-accent);
345
+ }
346
+
347
+ dl {
348
+ display: grid;
349
+ gap: var(--sp-3);
350
+ margin: 0;
351
+ }
352
+
353
+ dl > div {
354
+ display: grid;
355
+ grid-template-columns: minmax(10rem, 14rem) 1fr;
356
+ gap: var(--sp-4);
357
+ }
358
+
359
+ dt {
360
+ font-size: var(--text-body-sm);
361
+ font-weight: 600;
362
+ color: var(--c-text);
363
+ }
364
+
365
+ dd {
366
+ margin: 0;
367
+ font-size: var(--text-body-sm);
368
+ line-height: var(--leading-body-sm);
369
+ color: var(--c-text-secondary);
370
+ }
371
+
372
+ /* Every level side by side. */
373
+ .compare {
374
+ margin-top: var(--sp-4);
375
+ }
376
+
377
+ .compare summary {
378
+ display: inline-flex;
379
+ align-items: center;
380
+ gap: var(--sp-2);
381
+ padding: var(--sp-2) var(--sp-3);
382
+ border: 1px solid var(--c-border);
383
+ border-radius: var(--radius-full);
384
+ background: var(--c-surface);
385
+ font-size: var(--text-body-sm);
386
+ font-weight: 600;
387
+ cursor: pointer;
388
+ list-style: none;
389
+ }
390
+
391
+ .compare summary::-webkit-details-marker {
392
+ display: none;
393
+ }
394
+
395
+ .compare summary::after {
396
+ content: '';
397
+ width: 7px;
398
+ height: 7px;
399
+ border-right: 1.75px solid currentColor;
400
+ border-bottom: 1.75px solid currentColor;
401
+ rotate: 45deg;
402
+ translate: 0 -2px;
403
+ }
404
+
405
+ .compare[open] summary::after {
406
+ rotate: 225deg;
407
+ translate: 0 2px;
408
+ }
409
+
410
+ .compare summary:focus-visible,
411
+ .scroll:focus-visible {
412
+ outline: 2px solid var(--c-focus);
413
+ outline-offset: 2px;
414
+ }
415
+
416
+ .scroll {
417
+ margin-top: var(--sp-3);
418
+ overflow-x: auto;
419
+ border: 1px solid var(--c-border);
420
+ border-radius: var(--radius-md);
421
+ background: var(--c-surface);
422
+ }
423
+
424
+ table {
425
+ min-width: 1080px;
426
+ border-collapse: collapse;
427
+ font-size: var(--text-caption);
428
+ line-height: var(--leading-caption);
429
+ }
430
+
431
+ th,
432
+ td {
433
+ padding: var(--sp-3);
434
+ text-align: left;
435
+ vertical-align: top;
436
+ border-bottom: 1px solid var(--c-border);
437
+ }
438
+
439
+ td {
440
+ color: var(--c-text-secondary);
441
+ }
442
+
443
+ thead th {
444
+ position: sticky;
445
+ top: 0;
446
+ background: var(--c-surface);
447
+ font-weight: 600;
448
+ color: var(--c-text);
449
+ }
450
+
451
+ tbody th[scope='row'] {
452
+ width: 9rem;
453
+ font-weight: 600;
454
+ color: var(--c-text);
455
+ }
456
+
457
+ .theme-row th {
458
+ padding-top: var(--sp-4);
459
+ background: var(--c-surface-sunken);
460
+ font-size: var(--text-overline);
461
+ letter-spacing: var(--tracking-overline);
462
+ text-transform: uppercase;
463
+ color: var(--c-text-accent);
464
+ }
465
+
466
+ figcaption {
467
+ margin-top: var(--sp-3);
468
+ font-size: var(--text-caption);
469
+ line-height: var(--leading-caption);
470
+ color: var(--c-text-muted);
471
+ }
472
+
473
+ /* Too narrow for a ladder: a list, the routes marked in each level's label. */
474
+ @container (max-width: 640px) {
475
+ .ladder {
476
+ grid-template-columns: 1fr !important;
477
+ grid-template-rows: none;
478
+ gap: var(--sp-2);
479
+ }
480
+
481
+ .joint {
482
+ display: none;
483
+ }
484
+
485
+ .level {
486
+ grid-column: 1 !important;
487
+ grid-row: auto !important;
488
+ margin: 0;
489
+ min-height: 0;
490
+ }
491
+
492
+ .panel {
493
+ padding: var(--sp-4);
494
+ }
495
+
496
+ dl > div {
497
+ grid-template-columns: 1fr;
498
+ gap: var(--sp-1);
499
+ }
500
+ }
501
+
502
+ @media (forced-colors: active) {
503
+ .level[aria-selected='true'] {
504
+ forced-color-adjust: none;
505
+ background: Highlight;
506
+ color: HighlightText;
507
+ }
508
+ }
509
+ </style>
510
+
511
+ <script>
512
+ // Picking a level shows its panel. The arrow keys move along the ladder in reading order and pick
513
+ // as they go; Home and End go to the ends.
514
+ document.querySelectorAll<HTMLElement>('[data-career-map]').forEach((map) => {
515
+ const tabs = [...map.querySelectorAll<HTMLButtonElement>('[role="tab"]')];
516
+ // Reading order follows the ranks: the DOM already lists them so.
517
+ const pick = (tab: HTMLButtonElement, focus = false) => {
518
+ tabs.forEach((t) => {
519
+ const on = t === tab;
520
+ t.setAttribute('aria-selected', String(on));
521
+ t.tabIndex = on ? 0 : -1;
522
+ const panel = map.querySelector<HTMLElement>(`#${t.getAttribute('aria-controls')}`);
523
+ if (panel) panel.hidden = !on;
524
+ });
525
+ if (focus) tab.focus();
526
+ };
527
+ tabs.forEach((t, i) => {
528
+ t.addEventListener('click', () => pick(t));
529
+ t.addEventListener('keydown', (e) => {
530
+ const to = { ArrowRight: i + 1, ArrowDown: i + 1, ArrowLeft: i - 1, ArrowUp: i - 1, Home: 0, End: tabs.length - 1 }[e.key];
531
+ if (to === undefined) return;
532
+ e.preventDefault();
533
+ pick(tabs[(to + tabs.length) % tabs.length], true);
534
+ });
535
+ });
536
+ });
537
+ </script>
@@ -1,23 +1,23 @@
1
1
  ---
2
2
  /**
3
3
  * A design process as diamonds: each phase opens out (diverge) and narrows again (converge), with
4
- * the moments between them on the line, such as kick-off and launch. A last phase can repeat
5
- * instead, as smaller diamonds that fade out, for the work that goes on after launch.
4
+ * the moments between them as stops on one line, such as kick-off and launch. A last phase can
5
+ * repeat instead, as smaller diamonds that fade out, for the work that goes on after launch.
6
6
  *
7
- * Drawn in HTML and SVG, so the words are text: they wrap, scale with the page, and are read out
8
- * in order (moment, phase, its two halves and their notes, its name). Below 560px wide the phases
9
- * stack. The halves use three fixed tones, the closing half paler, with the dark text on them, so
10
- * they read the same in either theme.
7
+ * Drawn in the diagrams' own style, on a sunken plate: tinted fills with a hairline edge, as in
8
+ * Flow diagram, so it sits beside them. HTML and SVG, so the words are text: they wrap, scale with
9
+ * the page, and are read out in order (moment, phase, its two halves, its name, its notes). Below
10
+ * 560px wide the phases stack.
11
11
  *
12
12
  * Once, as it comes into view, the parts arrive left to right. Nothing moves under reduced
13
13
  * motion, and without script it is simply there.
14
14
  */
15
- type Tone = 'cool' | 'accent' | 'sun';
15
+ type Tone = 'cool' | 'accent' | 'quiet';
16
16
 
17
17
  interface Half {
18
18
  /** Inside the half, such as "Discover". */
19
19
  label: string;
20
- /** Above the half: a short title ("Diverge") and the question it asks. */
20
+ /** Under the phase's name: a short title ("Diverge") and the question this half asks. */
21
21
  note?: { title: string; text: string };
22
22
  }
23
23
 
@@ -31,7 +31,7 @@ interface Phase {
31
31
  halves?: [Half, Half];
32
32
  /** Smaller diamonds that fade out, for work that keeps going. */
33
33
  repeat?: boolean;
34
- /** Above a repeating phase, as a half's note is above a half. */
34
+ /** Under a repeating phase's name, as a half's note is under a diamond. */
35
35
  note?: { title: string; text: string };
36
36
  }
37
37
 
@@ -46,74 +46,81 @@ interface Props {
46
46
  }
47
47
 
48
48
  const { title, phases, milestones = [], caption, class: className } = Astro.props;
49
- const tones: Tone[] = ['cool', 'accent', 'sun'];
49
+ const tones: Tone[] = ['cool', 'accent', 'quiet'];
50
50
  const items = phases.flatMap((p, i) => {
51
- const tone = p.tone ?? tones[i % tones.length];
51
+ const tone = p.tone ?? (p.repeat ? 'quiet' : tones[i % tones.length]);
52
52
  return [...(milestones[i] ? [{ kind: 'moment' as const, label: milestones[i]!, tone }] : []), { kind: 'phase' as const, phase: p, tone }];
53
53
  });
54
- const columns = items.map((it) => (it.kind === 'moment' ? 'auto' : it.phase.repeat ? 'minmax(0, 0.8fr)' : 'minmax(0, 1fr)')).join(' ');
54
+ const columns = items.map((it) => (it.kind === 'moment' ? 'auto' : it.phase.repeat ? 'minmax(0, 0.75fr)' : 'minmax(0, 1fr)')).join(' ');
55
55
  ---
56
56
 
57
57
  <figure class:list={['diamonds', className]} data-diamonds>
58
- <ol class="row" aria-label={title} style={`--cols: ${columns}`}>
59
- {
60
- items.map((it, i) =>
61
- it.kind === 'moment' ? (
62
- <li class="moment" data-tone={it.tone} style={`--i: ${i}`}>
63
- <span class="dot" aria-hidden="true" />
64
- <span class="moment-label">{it.label}</span>
65
- </li>
66
- ) : (
67
- <li class:list={['phase', { repeat: it.phase.repeat }]} data-tone={it.tone} style={`--i: ${i}`}>
68
- <div class="notes">
69
- {it.phase.repeat
70
- ? it.phase.note && (
71
- <p class="note wide">
72
- <strong>{it.phase.note.title}</strong> {it.phase.note.text}
73
- </p>
74
- )
75
- : it.phase.halves?.map(
76
- (h) =>
77
- h.note && (
78
- <p class="note">
79
- <strong>{h.note.title}</strong> {h.note.text}
80
- </p>
81
- ),
82
- )}
83
- </div>
84
- <div class="shape">
85
- {it.phase.repeat ? (
86
- <svg viewBox="0 0 300 120" preserveAspectRatio="xMidYMid meet" aria-hidden="true">
87
- {[0, 1, 2].map((k) => (
88
- <g opacity={[1, 0.55, 0.25][k]}>
89
- <polygon class="open" points={`${k * 100},60 ${k * 100 + 50},24 ${k * 100 + 50},96`} />
90
- <polygon class="close" points={`${k * 100 + 50},24 ${k * 100 + 100},60 ${k * 100 + 50},96`} />
91
- </g>
92
- ))}
93
- </svg>
94
- ) : (
95
- <>
96
- <svg viewBox="0 0 200 120" preserveAspectRatio="none" aria-hidden="true">
97
- <polygon class="open" points="0,60 100,0 100,120" />
98
- <polygon class="close" points="100,0 200,60 100,120" />
99
- </svg>
100
- <p class="halves">
101
- {it.phase.halves?.map((h) => (
102
- <span>{h.label}</span>
58
+ <div class="plate">
59
+ <ol class="row" aria-label={title} style={`--cols: ${columns}`}>
60
+ {
61
+ items.map((it, i) =>
62
+ it.kind === 'moment' ? (
63
+ <li class="moment" data-tone={it.tone} style={`--i: ${i}`}>
64
+ <span class="stop-cell">
65
+ <span class="stop" aria-hidden="true" />
66
+ <span class="moment-label">{it.label}</span>
67
+ </span>
68
+ </li>
69
+ ) : (
70
+ <li class:list={['phase', { repeat: it.phase.repeat }]} data-tone={it.tone} style={`--i: ${i}`}>
71
+ <div class="shape">
72
+ {it.phase.repeat ? (
73
+ <svg viewBox="0 0 300 100" aria-hidden="true">
74
+ {[0, 1, 2].map((k) => (
75
+ <g opacity={[1, 0.6, 0.3][k]}>
76
+ <polygon class="open" points={`${k * 100 + 2},50 ${k * 100 + 50},16 ${k * 100 + 50},84`} />
77
+ <polygon class="close" points={`${k * 100 + 50},16 ${k * 100 + 98},50 ${k * 100 + 50},84`} />
78
+ <polygon class="edge" points={`${k * 100 + 2},50 ${k * 100 + 50},16 ${k * 100 + 98},50 ${k * 100 + 50},84`} />
79
+ </g>
103
80
  ))}
104
- </p>
105
- </>
106
- )}
107
- </div>
108
- <p class="name">
109
- {it.phase.name}
110
- {it.phase.motto && <span class="motto">{it.phase.motto}</span>}
111
- </p>
112
- </li>
113
- ),
114
- )
115
- }
116
- </ol>
81
+ </svg>
82
+ ) : (
83
+ <>
84
+ <svg viewBox="0 0 200 120" preserveAspectRatio="none" aria-hidden="true">
85
+ <polygon class="open" points="1,60 100,1 100,119" />
86
+ <polygon class="close" points="100,1 199,60 100,119" />
87
+ <polygon class="edge" points="1,60 100,1 199,60 100,119" vector-effect="non-scaling-stroke" />
88
+ <line class="split" x1="100" y1="1" x2="100" y2="119" vector-effect="non-scaling-stroke" />
89
+ </svg>
90
+ <p class="halves">
91
+ {it.phase.halves?.map((h) => (
92
+ <span>{h.label}</span>
93
+ ))}
94
+ </p>
95
+ </>
96
+ )}
97
+ </div>
98
+ <p class="name">
99
+ {it.phase.name}
100
+ {it.phase.motto && <span class="motto">{it.phase.motto}</span>}
101
+ </p>
102
+ <div class:list={['notes', { one: it.phase.repeat }]}>
103
+ {it.phase.repeat
104
+ ? it.phase.note && (
105
+ <p class="note">
106
+ <strong>{it.phase.note.title}</strong> {it.phase.note.text}
107
+ </p>
108
+ )
109
+ : it.phase.halves?.map(
110
+ (h) =>
111
+ h.note && (
112
+ <p class="note">
113
+ <strong>{h.note.title}</strong> {h.note.text}
114
+ </p>
115
+ ),
116
+ )}
117
+ </div>
118
+ </li>
119
+ ),
120
+ )
121
+ }
122
+ </ol>
123
+ </div>
117
124
  {caption && <figcaption>{caption}</figcaption>}
118
125
  </figure>
119
126
 
@@ -130,27 +137,41 @@ const columns = items.map((it) => (it.kind === 'moment' ? 'auto' : it.phase.repe
130
137
  .diamonds {
131
138
  min-width: 0;
132
139
  margin: 0;
140
+ }
141
+
142
+ .plate {
133
143
  container-type: inline-size;
144
+ background: var(--c-surface-sunken);
145
+ border: 1px solid var(--c-border);
146
+ border-radius: var(--radius-lg);
147
+ padding: var(--sp-6) var(--sp-5) var(--sp-5);
134
148
  }
135
149
 
150
+ /* The diagrams' tones: a tint and an edge, never a saturated slab. The opening half carries a
151
+ * little more of the tone than the narrowing one. */
136
152
  [data-tone='cool'] {
137
- --tone: var(--c-seq2-4);
153
+ --edge: color-mix(in oklab, var(--c-tag-cool-text) 55%, transparent);
154
+ --soft: var(--c-tag-cool-bg);
155
+ --mark: var(--c-tag-cool-text);
138
156
  }
139
157
 
140
158
  [data-tone='accent'] {
141
- --tone: var(--c-accent);
159
+ --edge: var(--c-accent-edge);
160
+ --soft: var(--c-surface-tint);
161
+ --mark: var(--c-accent);
142
162
  }
143
163
 
144
- [data-tone='sun'] {
145
- --tone: var(--c-heat-4);
164
+ [data-tone='quiet'] {
165
+ --edge: var(--c-diagram-edge);
166
+ --soft: var(--c-surface);
167
+ --mark: var(--c-diagram-edge);
146
168
  }
147
169
 
148
170
  .row {
149
171
  display: grid;
150
172
  grid-template-columns: var(--cols);
151
173
  grid-template-rows: auto auto auto;
152
- column-gap: var(--sp-1);
153
- row-gap: var(--sp-3);
174
+ column-gap: var(--sp-2);
154
175
  list-style: none;
155
176
  margin: 0;
156
177
  padding: 0;
@@ -163,83 +184,92 @@ const columns = items.map((it) => (it.kind === 'moment' ? 'auto' : it.phase.repe
163
184
  min-width: 0;
164
185
  }
165
186
 
166
- /* A moment on the line: a dot level with the diamonds' points, its name under it. */
167
- .moment {
168
- justify-items: center;
187
+ /* One line through every stop and behind every diamond, level with their points: each cell in
188
+ * the diamonds' row draws its own piece, across the gap to the next. */
189
+ .stop-cell,
190
+ .shape {
191
+ position: relative;
169
192
  }
170
193
 
171
- .dot {
172
- grid-row: 2;
173
- align-self: center;
174
- width: 20px;
175
- height: 20px;
176
- border-radius: 50%;
177
- background: var(--tone);
178
- box-shadow: 0 0 0 4px var(--c-bg);
194
+ .stop-cell::before,
195
+ .shape::before {
196
+ content: '';
197
+ position: absolute;
198
+ top: calc(50% - 0.875px);
199
+ left: calc(var(--sp-2) / -2);
200
+ right: calc(var(--sp-2) / -2);
201
+ height: 1.75px;
202
+ background: var(--c-diagram-line);
179
203
  }
180
204
 
181
- .moment-label {
182
- grid-row: 3;
183
- font-size: var(--text-caption);
184
- font-weight: 600;
185
- letter-spacing: var(--tracking-overline);
186
- text-transform: uppercase;
187
- color: var(--c-text-secondary);
188
- white-space: nowrap;
205
+ .row > li:first-child .stop-cell::before {
206
+ left: 50%;
189
207
  }
190
208
 
191
- .notes {
209
+ .stop-cell {
192
210
  grid-row: 1;
193
- align-self: end;
194
211
  display: grid;
195
- grid-template-columns: 1fr 1fr;
196
- gap: var(--sp-3);
212
+ place-items: center;
197
213
  }
198
214
 
199
- .note {
200
- margin: 0;
201
- font-size: var(--text-caption);
202
- line-height: var(--leading-caption);
203
- color: var(--c-text-secondary);
204
- text-wrap: pretty;
215
+ .stop {
216
+ position: relative;
217
+ width: 14px;
218
+ height: 14px;
219
+ border-radius: 50%;
220
+ background: var(--c-surface);
221
+ border: 2px solid var(--mark);
222
+ box-shadow: 0 0 0 4px var(--c-surface-sunken);
205
223
  }
206
224
 
207
- .note strong {
208
- display: block;
225
+ .moment-label {
226
+ position: absolute;
227
+ top: calc(50% + 16px);
228
+ font-size: 13px;
209
229
  font-weight: 600;
210
- letter-spacing: var(--tracking-overline);
211
- text-transform: uppercase;
212
- color: var(--c-text);
213
- }
214
-
215
- .note.wide {
216
- grid-column: 1 / -1;
217
- text-align: center;
230
+ color: var(--c-text-muted);
231
+ white-space: nowrap;
218
232
  }
219
233
 
220
- /* Its width is the column's and its height follows, so a narrower phase is a smaller diamond,
221
- * centred on the line. */
222
234
  .shape {
223
- grid-row: 2;
235
+ grid-row: 1;
224
236
  align-self: center;
225
237
  position: relative;
226
238
  width: 100%;
227
239
  aspect-ratio: 5 / 3;
228
240
  }
229
241
 
242
+ .repeat .shape {
243
+ aspect-ratio: 3 / 1;
244
+ }
245
+
230
246
  .shape svg {
247
+ position: relative;
231
248
  display: block;
232
249
  width: 100%;
233
250
  height: 100%;
251
+ overflow: visible;
234
252
  }
235
253
 
236
- /* Opening out in the tone itself; narrowing in a paler one. */
254
+ /* The opening half: its tint with a little of its edge colour in it, in either theme. */
237
255
  .open {
238
- fill: var(--tone);
256
+ fill: color-mix(in oklab, var(--soft), var(--mark) 20%);
239
257
  }
240
258
 
241
259
  .close {
242
- fill: color-mix(in oklab, var(--tone) 55%, #fff);
260
+ fill: var(--soft);
261
+ }
262
+
263
+ .edge,
264
+ .split {
265
+ fill: none;
266
+ stroke: var(--edge);
267
+ stroke-width: 1.5;
268
+ stroke-linejoin: round;
269
+ }
270
+
271
+ .repeat .edge {
272
+ stroke-dasharray: 3 4;
243
273
  }
244
274
 
245
275
  .halves {
@@ -249,53 +279,80 @@ const columns = items.map((it) => (it.kind === 'moment' ? 'auto' : it.phase.repe
249
279
  grid-template-columns: 1fr 1fr;
250
280
  align-items: center;
251
281
  margin: 0;
252
- color: var(--c-on-accent);
282
+ color: var(--c-text);
253
283
  font-weight: 600;
254
- font-size: clamp(0.6875rem, 2.4cqi, var(--text-label));
255
- letter-spacing: 0.04em;
256
- text-transform: uppercase;
257
- line-height: 1.2;
284
+ font-size: clamp(0.75rem, 1.9cqi, 0.9375rem);
285
+ line-height: 1.25;
258
286
  }
259
287
 
260
- /* Each label leans toward the middle, where its half is widest. */
288
+ /* Each label sits toward the middle, where its half is widest. */
261
289
  .halves span:first-child {
262
290
  justify-self: end;
263
- padding-right: 10%;
291
+ padding-right: 12%;
264
292
  text-align: right;
265
293
  }
266
294
 
267
295
  .halves span:last-child {
268
- padding-left: 10%;
296
+ padding-left: 12%;
269
297
  }
270
298
 
271
299
  .name {
272
- grid-row: 3;
273
- margin: 0;
300
+ grid-row: 2;
301
+ margin: var(--sp-4) 0 0;
274
302
  text-align: center;
275
303
  font-family: var(--font-display);
276
304
  font-weight: 600;
277
- font-size: var(--text-h3);
278
- line-height: var(--leading-h3);
305
+ font-size: var(--text-sub);
306
+ line-height: var(--leading-sub);
279
307
  color: var(--c-text);
280
308
  }
281
309
 
282
310
  .motto {
283
311
  display: block;
284
- margin-top: var(--sp-1);
285
312
  font-family: var(--font-body);
286
313
  font-weight: 400;
287
- font-size: var(--text-body-sm);
314
+ font-size: var(--text-caption);
288
315
  color: var(--c-text-muted);
289
316
  }
290
317
 
318
+ .notes {
319
+ grid-row: 3;
320
+ display: grid;
321
+ grid-template-columns: 1fr 1fr;
322
+ align-content: start;
323
+ gap: var(--sp-3);
324
+ margin-top: var(--sp-4);
325
+ padding-top: var(--sp-3);
326
+ border-top: 1px solid var(--c-border);
327
+ }
328
+
329
+ .notes.one {
330
+ grid-template-columns: 1fr;
331
+ text-align: center;
332
+ }
333
+
334
+ .note {
335
+ margin: 0;
336
+ font-size: var(--text-caption);
337
+ line-height: var(--leading-caption);
338
+ color: var(--c-text-muted);
339
+ text-wrap: pretty;
340
+ }
341
+
342
+ .note strong {
343
+ display: block;
344
+ font-weight: 600;
345
+ color: var(--c-text);
346
+ }
347
+
291
348
  figcaption {
292
- margin-top: var(--sp-5);
349
+ margin-top: var(--sp-3);
293
350
  font-size: var(--text-caption);
294
351
  line-height: var(--leading-caption);
295
352
  color: var(--c-text-muted);
296
353
  }
297
354
 
298
- /* Too narrow for a row: the phases stack, each moment a dot and its name between them. */
355
+ /* Too narrow for a row: the phases stack, each moment a stop and its name between them. */
299
356
  @container (max-width: 560px) {
300
357
  .row {
301
358
  grid-template-columns: 1fr;
@@ -303,47 +360,54 @@ const columns = items.map((it) => (it.kind === 'moment' ? 'auto' : it.phase.repe
303
360
  row-gap: var(--sp-5);
304
361
  }
305
362
 
363
+ .stop-cell::before,
364
+ .shape::before {
365
+ display: none;
366
+ }
367
+
306
368
  .row > li {
307
369
  grid-row: auto;
308
370
  grid-template-rows: none;
309
- row-gap: var(--sp-3);
310
371
  }
311
372
 
312
- .moment {
373
+ .stop-cell {
313
374
  display: flex;
314
- align-items: center;
315
375
  justify-content: center;
316
376
  gap: var(--sp-3);
317
377
  }
318
378
 
319
- .shape {
320
- grid-row: auto;
321
- width: min(100%, 420px);
322
- justify-self: center;
379
+ .moment-label {
380
+ position: static;
323
381
  }
324
382
 
325
- .notes,
326
- .name {
383
+ .shape,
384
+ .name,
385
+ .notes {
327
386
  grid-row: auto;
328
387
  }
329
388
 
389
+ .shape {
390
+ width: min(100%, 360px);
391
+ justify-self: center;
392
+ }
393
+
330
394
  .notes {
331
395
  width: min(100%, 420px);
332
396
  justify-self: center;
333
397
  }
334
398
 
335
399
  .halves {
336
- font-size: var(--text-label);
400
+ font-size: var(--text-body-sm);
337
401
  }
338
402
  }
339
403
 
340
404
  @media (prefers-reduced-motion: no-preference) {
341
- .arrive li {
405
+ .arrive .row > li {
342
406
  opacity: 0;
343
407
  translate: 0 8px;
344
408
  }
345
409
 
346
- .arrive.seen li {
410
+ .arrive.seen .row > li {
347
411
  opacity: 1;
348
412
  translate: 0 0;
349
413
  transition:
@@ -353,17 +417,14 @@ const columns = items.map((it) => (it.kind === 'moment' ? 'auto' : it.phase.repe
353
417
  }
354
418
 
355
419
  @media (forced-colors: active) {
356
- .open,
357
- .close {
358
- fill: CanvasText;
420
+ .edge,
421
+ .split {
422
+ stroke: CanvasText;
359
423
  }
360
424
 
425
+ .open,
361
426
  .close {
362
- fill-opacity: 0.6;
363
- }
364
-
365
- .halves {
366
- color: Canvas;
427
+ fill: Canvas;
367
428
  }
368
429
  }
369
430
  </style>
package/src/Phases.astro CHANGED
@@ -4,14 +4,14 @@
4
4
  * under it, and a short text on what happens in it. Below them, spans for what runs across
5
5
  * phases, such as discovery that never quite stops.
6
6
  *
7
- * Drawn in HTML, so the words are text that wraps and is read out in order. Below 640px wide the
8
- * phases stack and each span says which phases it runs across in words. The bands use three
9
- * fixed tones with the dark text on them, so they read the same in either theme.
7
+ * Drawn in the diagrams' own style, on a sunken plate with tinted bands and hairline rings, as in
8
+ * Flow diagram and Diamonds. HTML, so the words are text that wraps and is read out in order.
9
+ * Below 640px wide the phases stack and each span says which phases it runs across in words.
10
10
  *
11
11
  * Once, as it comes into view, the phases arrive left to right. Nothing moves under reduced
12
12
  * motion, and without script it is simply there.
13
13
  */
14
- type Tone = 'cool' | 'accent' | 'sun';
14
+ type Tone = 'cool' | 'accent' | 'quiet';
15
15
 
16
16
  interface Phase {
17
17
  /** On the band, such as "Define & validate". */
@@ -42,11 +42,12 @@ interface Props {
42
42
  }
43
43
 
44
44
  const { title, phases, spans = [], caption, class: className } = Astro.props;
45
- const tones: Tone[] = ['cool', 'accent', 'sun'];
45
+ const tones: Tone[] = ['cool', 'accent', 'quiet'];
46
46
  const last = phases.length - 1;
47
47
  ---
48
48
 
49
49
  <figure class:list={['phases', className]} data-phases>
50
+ <div class="plate">
50
51
  <ol class="row" aria-label={title} style={`--n: ${phases.length}`}>
51
52
  {
52
53
  phases.map((p, i) => (
@@ -87,6 +88,7 @@ const last = phases.length - 1;
87
88
  </ul>
88
89
  )
89
90
  }
91
+ </div>
90
92
  {caption && <figcaption>{caption}</figcaption>}
91
93
  </figure>
92
94
 
@@ -101,22 +103,33 @@ const last = phases.length - 1;
101
103
 
102
104
  <style>
103
105
  .phases {
104
- --notch: 22px;
106
+ --notch: 20px;
105
107
  min-width: 0;
106
108
  margin: 0;
109
+ }
110
+
111
+ .plate {
107
112
  container-type: inline-size;
113
+ background: var(--c-surface-sunken);
114
+ border: 1px solid var(--c-border);
115
+ border-radius: var(--radius-lg);
116
+ padding: var(--sp-6) var(--sp-5) var(--sp-5);
108
117
  }
109
118
 
119
+ /* The diagrams' tones: a tint for the band, the edge colour for the rings. */
110
120
  [data-tone='cool'] {
111
- --tone: var(--c-seq2-4);
121
+ --fill: var(--c-tag-cool-bg);
122
+ --mark: color-mix(in oklab, var(--c-tag-cool-text) 70%, transparent);
112
123
  }
113
124
 
114
125
  [data-tone='accent'] {
115
- --tone: var(--c-accent);
126
+ --fill: color-mix(in oklab, var(--c-accent) 16%, var(--c-surface));
127
+ --mark: var(--c-accent-edge);
116
128
  }
117
129
 
118
- [data-tone='sun'] {
119
- --tone: var(--c-heat-4);
130
+ [data-tone='quiet'] {
131
+ --fill: var(--c-surface);
132
+ --mark: var(--c-diagram-edge);
120
133
  }
121
134
 
122
135
  .row {
@@ -145,8 +158,8 @@ const last = phases.length - 1;
145
158
  min-height: 64px;
146
159
  margin: 0 calc(var(--notch) * -1 + 3px) 0 0;
147
160
  padding: var(--sp-3) calc(var(--notch) + var(--sp-3));
148
- background: var(--tone);
149
- color: var(--c-on-accent);
161
+ background: var(--fill);
162
+ color: var(--c-text-secondary);
150
163
  text-align: center;
151
164
  clip-path: polygon(0 0, calc(100% - var(--notch)) 0, 100% 50%, calc(100% - var(--notch)) 100%, 0 100%, var(--notch) 50%);
152
165
  font-size: var(--text-body-sm);
@@ -164,7 +177,7 @@ const last = phases.length - 1;
164
177
  }
165
178
 
166
179
  .band strong {
167
- color: inherit;
180
+ color: var(--c-text);
168
181
  font-family: var(--font-display);
169
182
  font-weight: 600;
170
183
  font-size: var(--text-body);
@@ -189,7 +202,7 @@ const last = phases.length - 1;
189
202
  place-items: center;
190
203
  aspect-ratio: 1;
191
204
  padding: var(--sp-3);
192
- border: 5px solid var(--tone);
205
+ border: 2px solid var(--mark);
193
206
  border-radius: 50%;
194
207
  background: var(--c-surface);
195
208
  color: var(--c-text);
@@ -234,17 +247,17 @@ const last = phases.length - 1;
234
247
  .spans li::after {
235
248
  content: '';
236
249
  flex: 1;
237
- border-top: 1.5px dashed var(--c-border-strong);
250
+ border-top: 1.5px dashed var(--c-diagram-line);
238
251
  }
239
252
 
240
253
  .spans li::before {
241
- border-left: 1.5px solid var(--c-border-strong);
254
+ border-left: 1.5px solid var(--c-diagram-line);
242
255
  height: 8px;
243
256
  margin-top: 8px;
244
257
  }
245
258
 
246
259
  .spans li::after {
247
- border-right: 1.5px solid var(--c-border-strong);
260
+ border-right: 1.5px solid var(--c-diagram-line);
248
261
  height: 8px;
249
262
  margin-top: 8px;
250
263
  }
@@ -263,7 +276,7 @@ const last = phases.length - 1;
263
276
  }
264
277
 
265
278
  figcaption {
266
- margin-top: var(--sp-5);
279
+ margin-top: var(--sp-3);
267
280
  font-size: var(--text-caption);
268
281
  line-height: var(--leading-caption);
269
282
  color: var(--c-text-muted);