@n1kname/components 0.24.0 → 0.26.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.24.0",
3
+ "version": "0.26.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -2,8 +2,8 @@
2
2
  /**
3
3
  * A career framework: the levels as a ladder you can pick from, forking where one level has two
4
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.
5
+ * one line, what it's responsible for, what changes from the level before (the promotion step),
6
+ * and what it does in each skill area. On request, every level side by side in one table.
7
7
  *
8
8
  * The ladder is a tab list: the arrow keys move along it and pick as they go, Home and End go to
9
9
  * the ends. Picking changes the panel at once; it's an answer to a question, not a moment. Without
@@ -27,6 +27,8 @@ interface Level {
27
27
  summary?: string;
28
28
  /** What it's expected to do, by area id. */
29
29
  skills?: Record<string, string>;
30
+ /** What changes from the level before: the few things a promotion to it rests on. */
31
+ changes?: string[];
30
32
  }
31
33
 
32
34
  interface Area {
@@ -43,14 +45,29 @@ interface Props {
43
45
  areas?: Area[];
44
46
  /** The level shown first. The first one by default. */
45
47
  selected?: string;
46
- /** The label on the table's disclosure. */
48
+ /** Shows every level side by side in a table, under this label. None by default. */
47
49
  compare?: string;
50
+ /** The panel's headings. */
51
+ scopeLabel?: string;
52
+ changesLabel?: string;
53
+ skillsLabel?: string;
48
54
  caption?: string;
49
55
  id?: string;
50
56
  class?: string;
51
57
  }
52
58
 
53
- const { title, levels, areas = [], selected, compare = 'Compare every level', caption, class: className } = Astro.props;
59
+ const {
60
+ title,
61
+ levels,
62
+ areas = [],
63
+ selected,
64
+ compare,
65
+ scopeLabel = 'Responsible for',
66
+ changesLabel = 'What changes from the level before',
67
+ skillsLabel = 'Skills',
68
+ caption,
69
+ class: className,
70
+ } = Astro.props;
54
71
  let hash = 0;
55
72
  for (const c of title) hash = (hash * 31 + c.charCodeAt(0)) | 0;
56
73
  const uid = Astro.props.id ?? `career-${(hash >>> 0).toString(36)}`;
@@ -113,35 +130,54 @@ const ordered = ranks.flatMap((r) => at(r));
113
130
  <h3 class="panel-title">{l.title}</h3>
114
131
  <p class="meta">{[l.label, l.track, l.experience].filter(Boolean).join(' · ')}</p>
115
132
  {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
133
  </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
+ <div class="cols">
135
+ <div class="main">
136
+ {l.scope && (
137
+ <>
138
+ <h4 class="part">{scopeLabel}</h4>
139
+ <p class="scope">{l.scope}</p>
140
+ </>
141
+ )}
142
+ {l.changes && l.changes.length > 0 && (
143
+ <>
144
+ <h4 class="part">{changesLabel}</h4>
145
+ <ul class="changes">
146
+ {l.changes.map((c) => (
147
+ <li>{c}</li>
134
148
  ))}
135
- </dl>
149
+ </ul>
150
+ </>
151
+ )}
152
+ </div>
153
+ {l.skills && (
154
+ <div class="skills">
155
+ <h4 class="part">{skillsLabel}</h4>
156
+ {themes.map((t) => (
157
+ <div class="theme">
158
+ {t && <h5 class="theme-title">{t}</h5>}
159
+ <dl>
160
+ {byTheme(t)
161
+ .filter((a) => l.skills?.[a.id])
162
+ .map((a) => (
163
+ <div>
164
+ <dt>{a.label}</dt>
165
+ <dd>{l.skills![a.id]}</dd>
166
+ </div>
167
+ ))}
168
+ </dl>
169
+ </div>
170
+ ))}
136
171
  </div>
137
- ))}
172
+ )}
173
+ </div>
138
174
  </section>
139
175
  ))
140
176
  }
141
177
  </div>
142
178
 
143
179
  {
144
- areas.length > 0 && (
180
+ compare && areas.length > 0 && (
145
181
  <details class="compare">
146
182
  <summary>{compare}</summary>
147
183
  <div class="scroll" role="region" aria-label={`${title}: every level side by side`} tabindex="0">
@@ -319,29 +355,80 @@ const ordered = ranks.flatMap((r) => at(r));
319
355
  text-wrap: pretty;
320
356
  }
321
357
 
358
+ /* What it's responsible for and what changes, beside its skills where there's room. */
359
+ .cols {
360
+ display: grid;
361
+ gap: var(--sp-5);
362
+ margin-top: var(--sp-5);
363
+ padding-top: var(--sp-5);
364
+ border-top: 1px solid var(--c-border);
365
+ }
366
+
367
+ @container (min-width: 760px) {
368
+ .cols {
369
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
370
+ gap: var(--sp-7);
371
+ }
372
+ }
373
+
374
+ .part {
375
+ margin: 0 0 var(--sp-2);
376
+ font-size: var(--text-overline);
377
+ line-height: var(--leading-overline);
378
+ letter-spacing: var(--tracking-overline);
379
+ text-transform: uppercase;
380
+ color: var(--c-text-accent);
381
+ }
382
+
383
+ .main > .part:not(:first-child) {
384
+ margin-top: var(--sp-5);
385
+ }
386
+
322
387
  .scope {
323
- margin: var(--sp-3) 0 0;
388
+ margin: 0;
324
389
  font-size: var(--text-body-sm);
325
390
  line-height: var(--leading-body-sm);
326
391
  color: var(--c-text-secondary);
327
392
  }
328
393
 
329
- .scope strong {
330
- color: var(--c-text);
394
+ .changes {
395
+ display: grid;
396
+ gap: var(--sp-2);
397
+ margin: 0;
398
+ padding: 0;
399
+ list-style: none;
400
+ font-size: var(--text-body-sm);
401
+ line-height: var(--leading-body-sm);
402
+ color: var(--c-text-secondary);
331
403
  }
332
404
 
333
- .theme {
334
- margin-top: var(--sp-5);
335
- padding-top: var(--sp-4);
336
- border-top: 1px solid var(--c-border);
405
+ /* A small step up for each change: what the promotion adds. */
406
+ .changes li {
407
+ position: relative;
408
+ padding-left: var(--sp-5);
409
+ }
410
+
411
+ .changes li::before {
412
+ content: '';
413
+ position: absolute;
414
+ left: 2px;
415
+ top: 0.55em;
416
+ width: 8px;
417
+ height: 8px;
418
+ border-top: 1.75px solid var(--c-accent-edge);
419
+ border-right: 1.75px solid var(--c-accent-edge);
420
+ rotate: -45deg;
421
+ }
422
+
423
+ .theme + .theme {
424
+ margin-top: var(--sp-4);
337
425
  }
338
426
 
339
427
  .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);
428
+ margin: 0 0 var(--sp-2);
429
+ font-size: var(--text-body-sm);
430
+ font-weight: 600;
431
+ color: var(--c-text);
345
432
  }
346
433
 
347
434
  dl {
@@ -352,8 +439,7 @@ const ordered = ranks.flatMap((r) => at(r));
352
439
 
353
440
  dl > div {
354
441
  display: grid;
355
- grid-template-columns: minmax(10rem, 14rem) 1fr;
356
- gap: var(--sp-4);
442
+ gap: 2px;
357
443
  }
358
444
 
359
445
  dt {
@@ -492,11 +578,6 @@ const ordered = ranks.flatMap((r) => at(r));
492
578
  .panel {
493
579
  padding: var(--sp-4);
494
580
  }
495
-
496
- dl > div {
497
- grid-template-columns: 1fr;
498
- gap: var(--sp-1);
499
- }
500
581
  }
501
582
 
502
583
  @media (forced-colors: active) {
@@ -1,11 +1,11 @@
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 as stops on one line, such as kick-off and launch. A last phase can
4
+ * the moments between them as stops at the diamonds' points, such as kick-off and launch. A last phase can
5
5
  * repeat instead, as smaller diamonds that fade out, for the work that goes on after launch.
6
6
  *
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
7
+ * Drawn in the diagrams' own style, on a sunken plate: tinted fills with a hairline edge and soft
8
+ * corners, as in Flow diagram, so it sits beside them. HTML and SVG, so the words are text: they wrap, scale with
9
9
  * the page, and are read out in order (moment, phase, its two halves, its name, its notes). Below
10
10
  * 560px wide the phases stack.
11
11
  *
@@ -51,7 +51,28 @@ const items = phases.flatMap((p, i) => {
51
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.75fr)' : 'minmax(0, 1fr)')).join(' ');
54
+ // A diamond with soft corners: rounder at top and bottom, a little at the points. Drawn on a fixed
55
+ // viewBox the shape keeps, so the corners never stretch.
56
+ const rounded = (pts: [number, number][], radii: number[]) =>
57
+ pts
58
+ .map((p, i) => {
59
+ const prev = pts[(i + pts.length - 1) % pts.length];
60
+ const next = pts[(i + 1) % pts.length];
61
+ const cut = (to: [number, number]) => {
62
+ const [dx, dy] = [to[0] - p[0], to[1] - p[1]];
63
+ const len = Math.hypot(dx, dy);
64
+ return [p[0] + (dx / len) * radii[i], p[1] + (dy / len) * radii[i]].map((v) => +v.toFixed(2));
65
+ };
66
+ const [a, b] = [cut(prev), cut(next)];
67
+ return `${i ? 'L' : 'M'}${a[0]} ${a[1]} Q${p[0]} ${p[1]} ${b[0]} ${b[1]}`;
68
+ })
69
+ .join(' ') + ' Z';
70
+ const big = rounded([[1, 60], [100, 1], [199, 60], [100, 119]], [5, 16, 5, 16]);
71
+ const small = (x: number) => rounded([[x + 4, 50], [x + 50, 18], [x + 96, 50], [x + 50, 82]], [3, 9, 3, 9]);
72
+ let hash = 0;
73
+ for (const c of title) hash = (hash * 31 + c.charCodeAt(0)) | 0;
74
+ const uid = `dia-${(hash >>> 0).toString(36)}`;
75
+ const columns = items.map((it) => (it.kind === 'moment' ? 'minmax(4.5rem, auto)' : it.phase.repeat ? 'minmax(0, 0.75fr)' : 'minmax(0, 1fr)')).join(' ');
55
76
  ---
56
77
 
57
78
  <figure class:list={['diamonds', className]} data-diamonds>
@@ -72,20 +93,31 @@ const columns = items.map((it) => (it.kind === 'moment' ? 'auto' : it.phase.repe
72
93
  {it.phase.repeat ? (
73
94
  <svg viewBox="0 0 300 100" aria-hidden="true">
74
95
  {[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`} />
96
+ <g opacity={[1, 0.6, 0.32][k]}>
97
+ <clipPath id={`${uid}-${i}-${k}`}>
98
+ <path d={small(k * 100)} />
99
+ </clipPath>
100
+ <g clip-path={`url(#${uid}-${i}-${k})`}>
101
+ <rect class="open" x={k * 100} y="0" width="50" height="100" />
102
+ <rect class="close" x={k * 100 + 50} y="0" width="50" height="100" />
103
+ </g>
104
+ <path class="edge" d={small(k * 100)} vector-effect="non-scaling-stroke" />
105
+ {k < 2 && <line class="link" x1={k * 100 + 97} y1="50" x2={k * 100 + 103} y2="50" vector-effect="non-scaling-stroke" />}
79
106
  </g>
80
107
  ))}
81
108
  </svg>
82
109
  ) : (
83
110
  <>
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" />
111
+ <svg viewBox="0 0 200 120" aria-hidden="true">
112
+ <clipPath id={`${uid}-${i}`}>
113
+ <path d={big} />
114
+ </clipPath>
115
+ <g clip-path={`url(#${uid}-${i})`}>
116
+ <rect class="open" x="0" y="0" width="100" height="120" />
117
+ <rect class="close" x="100" y="0" width="100" height="120" />
118
+ <line class="split" x1="100" y1="0" x2="100" y2="120" vector-effect="non-scaling-stroke" />
119
+ </g>
120
+ <path class="edge" d={big} vector-effect="non-scaling-stroke" />
89
121
  </svg>
90
122
  <p class="halves">
91
123
  {it.phase.halves?.map((h) => (
@@ -184,21 +216,23 @@ const columns = items.map((it) => (it.kind === 'moment' ? 'auto' : it.phase.repe
184
216
  min-width: 0;
185
217
  }
186
218
 
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 {
219
+ /* A moment: a stop level with the diamonds' points, its name just under it, and a short line
220
+ * from the point before to the point after, ending in an arrowhead. It never crosses a diamond:
221
+ * the diamonds are drawn over its ends. */
222
+ .stop-cell {
191
223
  position: relative;
224
+ grid-row: 1;
225
+ display: grid;
226
+ place-items: center;
192
227
  }
193
228
 
194
- .stop-cell::before,
195
- .shape::before {
229
+ .stop-cell::before {
196
230
  content: '';
197
231
  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;
232
+ top: calc(50% - 0.75px);
233
+ left: calc(var(--sp-2) / -2 - 8px);
234
+ right: calc(var(--sp-2) / -2 - 8px);
235
+ height: 1.5px;
202
236
  background: var(--c-diagram-line);
203
237
  }
204
238
 
@@ -206,20 +240,27 @@ const columns = items.map((it) => (it.kind === 'moment' ? 'auto' : it.phase.repe
206
240
  left: 50%;
207
241
  }
208
242
 
209
- .stop-cell {
210
- grid-row: 1;
211
- display: grid;
212
- place-items: center;
243
+ .stop-cell::after {
244
+ content: '';
245
+ position: absolute;
246
+ top: 50%;
247
+ right: 4px;
248
+ width: 7px;
249
+ height: 7px;
250
+ border-top: 1.5px solid var(--c-diagram-line);
251
+ border-right: 1.5px solid var(--c-diagram-line);
252
+ translate: 0 -50%;
253
+ rotate: 45deg;
213
254
  }
214
255
 
215
256
  .stop {
216
257
  position: relative;
217
- width: 14px;
218
- height: 14px;
258
+ z-index: 1;
259
+ width: 12px;
260
+ height: 12px;
219
261
  border-radius: 50%;
220
262
  background: var(--c-surface);
221
263
  border: 2px solid var(--mark);
222
- box-shadow: 0 0 0 4px var(--c-surface-sunken);
223
264
  }
224
265
 
225
266
  .moment-label {
@@ -245,6 +286,7 @@ const columns = items.map((it) => (it.kind === 'moment' ? 'auto' : it.phase.repe
245
286
 
246
287
  .shape svg {
247
288
  position: relative;
289
+ z-index: 1;
248
290
  display: block;
249
291
  width: 100%;
250
292
  height: 100%;
@@ -268,32 +310,48 @@ const columns = items.map((it) => (it.kind === 'moment' ? 'auto' : it.phase.repe
268
310
  stroke-linejoin: round;
269
311
  }
270
312
 
313
+ .split {
314
+ stroke-width: 1;
315
+ opacity: 0.6;
316
+ }
317
+
271
318
  .repeat .edge {
272
319
  stroke-dasharray: 3 4;
273
320
  }
274
321
 
322
+ .link {
323
+ stroke: var(--c-diagram-line);
324
+ stroke-width: 1.5;
325
+ }
326
+
327
+ /* Each label centred on its half's own middle, a third of the way in from its point, at one
328
+ * size wherever the diamond is drawn. */
275
329
  .halves {
276
330
  position: absolute;
331
+ z-index: 2;
277
332
  inset: 0;
278
- display: grid;
279
- grid-template-columns: 1fr 1fr;
280
- align-items: center;
281
333
  margin: 0;
282
334
  color: var(--c-text);
283
335
  font-weight: 600;
284
- font-size: clamp(0.75rem, 1.9cqi, 0.9375rem);
336
+ font-size: var(--text-body-sm);
285
337
  line-height: 1.25;
338
+ text-align: center;
339
+ }
340
+
341
+ .halves span {
342
+ position: absolute;
343
+ top: 50%;
344
+ width: 30%;
345
+ translate: -50% -50%;
346
+ text-wrap: balance;
286
347
  }
287
348
 
288
- /* Each label sits toward the middle, where its half is widest. */
289
349
  .halves span:first-child {
290
- justify-self: end;
291
- padding-right: 12%;
292
- text-align: right;
350
+ left: 34%;
293
351
  }
294
352
 
295
353
  .halves span:last-child {
296
- padding-left: 12%;
354
+ left: 66%;
297
355
  }
298
356
 
299
357
  .name {
@@ -360,11 +418,6 @@ const columns = items.map((it) => (it.kind === 'moment' ? 'auto' : it.phase.repe
360
418
  row-gap: var(--sp-5);
361
419
  }
362
420
 
363
- .stop-cell::before,
364
- .shape::before {
365
- display: none;
366
- }
367
-
368
421
  .row > li {
369
422
  grid-row: auto;
370
423
  grid-template-rows: none;
@@ -376,6 +429,11 @@ const columns = items.map((it) => (it.kind === 'moment' ? 'auto' : it.phase.repe
376
429
  gap: var(--sp-3);
377
430
  }
378
431
 
432
+ .stop-cell::before,
433
+ .stop-cell::after {
434
+ display: none;
435
+ }
436
+
379
437
  .moment-label {
380
438
  position: static;
381
439
  }
@@ -396,9 +454,6 @@ const columns = items.map((it) => (it.kind === 'moment' ? 'auto' : it.phase.repe
396
454
  justify-self: center;
397
455
  }
398
456
 
399
- .halves {
400
- font-size: var(--text-body-sm);
401
- }
402
457
  }
403
458
 
404
459
  @media (prefers-reduced-motion: no-preference) {
@@ -68,9 +68,23 @@ interface Props {
68
68
  caption?: string;
69
69
  /** Narrowest the drawing may get before it scrolls instead. */
70
70
  minWidth?: number;
71
+ /**
72
+ * A second drawing of the same diagram for a narrow screen, below 560px wide: its own size, where
73
+ * each node sits (by id; label, shape and tone come from `nodes`), and its own edges, rings and
74
+ * note. It fits the width instead of scrolling, so draw it about 360 to 420 wide.
75
+ */
76
+ narrow?: {
77
+ width: number;
78
+ height: number;
79
+ /** `icon: false` leaves a pill's icon out where the narrow pill is too short for it. */
80
+ nodes: { id: string; x: number; y: number; w?: number; h?: number; icon?: IconName | false }[];
81
+ edges: Edge[];
82
+ rings?: Ring[];
83
+ note?: { x: number; y: number; lines: { text: string; tone?: Tone }[] };
84
+ };
71
85
  }
72
86
 
73
- const { title, desc, width, height, nodes, edges, rings = [], note, caption, minWidth = 640 } = Astro.props;
87
+ const { title, desc, width, height, nodes, edges, rings = [], note, caption, minWidth = 640, narrow } = Astro.props;
74
88
  // Ids from the title, so two diagrams on a page don't collide and a build stays the same.
75
89
  let hash = 0;
76
90
  for (const c of title) hash = (hash * 31 + c.charCodeAt(0)) | 0;
@@ -81,7 +95,6 @@ const size = (n: Node) => {
81
95
  if (n.shape === 'icon') return { w: n.w ?? 64, h: n.w ?? 64 };
82
96
  return { w: n.w ?? 200, h: n.h ?? 44 };
83
97
  };
84
- const byId = new Map(nodes.map((n) => [n.id, n]));
85
98
 
86
99
  const anchor = (n: Node, side: Side, shift = 0): [number, number] => {
87
100
  const { w, h } = size(n);
@@ -152,7 +165,9 @@ const longest = (pts: [number, number][]): [number, number] => {
152
165
  return at;
153
166
  };
154
167
 
155
- const drawn = edges.map((e) => {
168
+ const draw = (ns: Node[], es: Edge[]) => {
169
+ const byId = new Map(ns.map((n) => [n.id, n]));
170
+ return es.map((e) => {
156
171
  const a = anchor(byId.get(e.from)!, e.fromSide, e.fromShift);
157
172
  // Stop short of the target so the arrowhead does not sit on its border.
158
173
  const t = anchor(byId.get(e.to)!, e.toSide, e.toShift);
@@ -161,7 +176,23 @@ const drawn = edges.map((e) => {
161
176
  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
177
  const pts = route(e, a, b);
163
178
  return { ...e, d: rounded(pts), head: head(pts), at: e.labelAt ?? longest(pts), tone: e.tone ?? 'quiet', step: e.step ?? 1 };
164
- });
179
+ });
180
+ };
181
+
182
+ // The drawings: the diagram as given, and its narrow one where there is one.
183
+ const narrowNodes = narrow
184
+ ? narrow.nodes.map((p) => {
185
+ const n = nodes.find((m) => m.id === p.id);
186
+ if (!n) throw new Error(`FlowDiagram "${title}": narrow node "${p.id}" is not in nodes.`);
187
+ return { ...n, ...p, icon: p.icon === false ? undefined : (p.icon ?? n.icon) };
188
+ })
189
+ : [];
190
+ const views = [
191
+ { kind: 'wide', width, height, nodes, drawn: draw(nodes, edges), rings, note, minWidth },
192
+ ...(narrow
193
+ ? [{ kind: 'narrow', width: narrow.width, height: narrow.height, nodes: narrowNodes, drawn: draw(narrowNodes, narrow.edges), rings: narrow.rings ?? [], note: narrow.note, minWidth: 0 }]
194
+ : []),
195
+ ];
165
196
 
166
197
  // Label lines for a circle: break at the space nearest the middle when it is long.
167
198
  const lines = (label: string) => {
@@ -181,11 +212,12 @@ const lines = (label: string) => {
181
212
  };
182
213
  ---
183
214
 
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>
215
+ <figure class:list={['flow', { 'has-narrow': narrow }]} data-flow>
216
+ {views.map(({ kind, width, height, nodes, drawn, rings, note, minWidth }) => (
217
+ <div class:list={['scroll', kind]} tabindex={kind === 'wide' ? '0' : undefined} role={kind === 'wide' ? 'region' : undefined} aria-label={kind === 'wide' ? title : undefined}>
218
+ <svg viewBox={`0 0 ${width} ${height}`} role="img" aria-labelledby={`${uid}-${kind}-t ${uid}-${kind}-d`} style={minWidth ? `min-width: ${minWidth}px` : undefined}>
219
+ <title id={`${uid}-${kind}-t`}>{title}</title>
220
+ <desc id={`${uid}-${kind}-d`}>{desc}</desc>
189
221
 
190
222
  {rings.map((r) => <circle class="ring" data-step={r.step ?? 0} cx={r.cx} cy={r.cy} r={r.r} />)}
191
223
 
@@ -263,6 +295,7 @@ const lines = (label: string) => {
263
295
  }
264
296
  </svg>
265
297
  </div>
298
+ ))}
266
299
  {caption && <figcaption>{caption}</figcaption>}
267
300
  </figure>
268
301
 
@@ -303,6 +336,24 @@ const lines = (label: string) => {
303
336
  <style>
304
337
  .flow {
305
338
  margin-block: var(--sp-7);
339
+ container-type: inline-size;
340
+ }
341
+
342
+ /* With a narrow drawing, it takes over below 560px, fitting the width instead of scrolling. */
343
+ .scroll.narrow {
344
+ display: none;
345
+ }
346
+
347
+ @container (max-width: 560px) {
348
+ .has-narrow .scroll.wide {
349
+ display: none;
350
+ }
351
+
352
+ .has-narrow .scroll.narrow {
353
+ display: block;
354
+ overflow: visible;
355
+ padding: var(--sp-5) var(--sp-3);
356
+ }
306
357
  }
307
358
 
308
359
  .scroll {
package/src/Phases.astro CHANGED
@@ -168,8 +168,8 @@ const last = phases.length - 1;
168
168
 
169
169
  .row > li:first-child .band {
170
170
  clip-path: polygon(0 0, calc(100% - var(--notch)) 0, 100% 50%, calc(100% - var(--notch)) 100%, 0 100%);
171
- border-radius: 999px 0 0 999px;
172
- padding-left: var(--sp-5);
171
+ border-radius: var(--radius-lg) 0 0 var(--radius-lg);
172
+ padding-left: var(--sp-4);
173
173
  }
174
174
 
175
175
  .row > li:last-child .band {
@@ -286,7 +286,7 @@ const last = phases.length - 1;
286
286
  .row {
287
287
  grid-template-columns: 1fr;
288
288
  grid-template-rows: none;
289
- row-gap: var(--sp-6);
289
+ row-gap: var(--sp-3);
290
290
  }
291
291
 
292
292
  .row > li {
@@ -303,6 +303,17 @@ const last = phases.length - 1;
303
303
  padding-inline: var(--sp-4);
304
304
  }
305
305
 
306
+ /* Stacked, an arrow down from each phase to the next says they follow on. */
307
+ .row > li:not(:last-child)::after {
308
+ content: '';
309
+ justify-self: center;
310
+ width: 14px;
311
+ height: 32px;
312
+ margin-top: var(--sp-2);
313
+ background: var(--c-diagram-line);
314
+ mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 32'%3E%3Cpath d='M7 1V30M1.5 24.5 7 30l5.5-5.5' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
315
+ }
316
+
306
317
  .spans {
307
318
  grid-template-columns: 1fr;
308
319
  }
@@ -347,6 +358,11 @@ const last = phases.length - 1;
347
358
  }
348
359
 
349
360
  @media (forced-colors: active) {
361
+ .row > li::after {
362
+ forced-color-adjust: none;
363
+ background: CanvasText;
364
+ }
365
+
350
366
  .band {
351
367
  border: 1px solid CanvasText;
352
368
  clip-path: none;