@n1kname/components 0.22.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 +1 -1
- package/src/CareerMap.astro +537 -0
- package/src/Diamonds.astro +446 -0
- package/src/Phases.astro +376 -0
- package/src/SectionNav.astro +149 -0
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
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
|
|
5
|
+
* repeat instead, as smaller diamonds that fade out, for the work that goes on after launch.
|
|
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
|
|
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
|
+
*
|
|
12
|
+
* Once, as it comes into view, the parts arrive left to right. Nothing moves under reduced
|
|
13
|
+
* motion, and without script it is simply there.
|
|
14
|
+
*/
|
|
15
|
+
type Tone = 'cool' | 'accent' | 'quiet';
|
|
16
|
+
|
|
17
|
+
interface Half {
|
|
18
|
+
/** Inside the half, such as "Discover". */
|
|
19
|
+
label: string;
|
|
20
|
+
/** Under the phase's name: a short title ("Diverge") and the question this half asks. */
|
|
21
|
+
note?: { title: string; text: string };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface Phase {
|
|
25
|
+
/** Under the diamond, such as "Discovery". */
|
|
26
|
+
name: string;
|
|
27
|
+
/** Under the name, such as "Design the right thing". */
|
|
28
|
+
motto?: string;
|
|
29
|
+
tone?: Tone;
|
|
30
|
+
/** The two halves: opening out, then narrowing. Leave out with `repeat`. */
|
|
31
|
+
halves?: [Half, Half];
|
|
32
|
+
/** Smaller diamonds that fade out, for work that keeps going. */
|
|
33
|
+
repeat?: boolean;
|
|
34
|
+
/** Under a repeating phase's name, as a half's note is under a diamond. */
|
|
35
|
+
note?: { title: string; text: string };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface Props {
|
|
39
|
+
/** What the diagram is, for a screen reader: the list is named by it. */
|
|
40
|
+
title: string;
|
|
41
|
+
phases: Phase[];
|
|
42
|
+
/** The moment before each phase, in order: "Kick off", "Plan", "Launch". */
|
|
43
|
+
milestones?: (string | undefined)[];
|
|
44
|
+
caption?: string;
|
|
45
|
+
class?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const { title, phases, milestones = [], caption, class: className } = Astro.props;
|
|
49
|
+
const tones: Tone[] = ['cool', 'accent', 'quiet'];
|
|
50
|
+
const items = phases.flatMap((p, i) => {
|
|
51
|
+
const tone = p.tone ?? (p.repeat ? 'quiet' : tones[i % tones.length]);
|
|
52
|
+
return [...(milestones[i] ? [{ kind: 'moment' as const, label: milestones[i]!, tone }] : []), { kind: 'phase' as const, phase: p, tone }];
|
|
53
|
+
});
|
|
54
|
+
const columns = items.map((it) => (it.kind === 'moment' ? 'auto' : it.phase.repeat ? 'minmax(0, 0.75fr)' : 'minmax(0, 1fr)')).join(' ');
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
<figure class:list={['diamonds', className]} data-diamonds>
|
|
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>
|
|
80
|
+
))}
|
|
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>
|
|
124
|
+
{caption && <figcaption>{caption}</figcaption>}
|
|
125
|
+
</figure>
|
|
126
|
+
|
|
127
|
+
<script is:inline>
|
|
128
|
+
// Before the first paint, so parts waiting to arrive never show and then vanish.
|
|
129
|
+
(() => {
|
|
130
|
+
const all = document.querySelectorAll('[data-diamonds]:not(.arrive):not(.seen)');
|
|
131
|
+
const fig = all[all.length - 1];
|
|
132
|
+
if (fig && 'IntersectionObserver' in window && !matchMedia('(prefers-reduced-motion: reduce)').matches) fig.classList.add('arrive');
|
|
133
|
+
})();
|
|
134
|
+
</script>
|
|
135
|
+
|
|
136
|
+
<style>
|
|
137
|
+
.diamonds {
|
|
138
|
+
min-width: 0;
|
|
139
|
+
margin: 0;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.plate {
|
|
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);
|
|
148
|
+
}
|
|
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. */
|
|
152
|
+
[data-tone='cool'] {
|
|
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);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
[data-tone='accent'] {
|
|
159
|
+
--edge: var(--c-accent-edge);
|
|
160
|
+
--soft: var(--c-surface-tint);
|
|
161
|
+
--mark: var(--c-accent);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
[data-tone='quiet'] {
|
|
165
|
+
--edge: var(--c-diagram-edge);
|
|
166
|
+
--soft: var(--c-surface);
|
|
167
|
+
--mark: var(--c-diagram-edge);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.row {
|
|
171
|
+
display: grid;
|
|
172
|
+
grid-template-columns: var(--cols);
|
|
173
|
+
grid-template-rows: auto auto auto;
|
|
174
|
+
column-gap: var(--sp-2);
|
|
175
|
+
list-style: none;
|
|
176
|
+
margin: 0;
|
|
177
|
+
padding: 0;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.row > li {
|
|
181
|
+
display: grid;
|
|
182
|
+
grid-row: span 3;
|
|
183
|
+
grid-template-rows: subgrid;
|
|
184
|
+
min-width: 0;
|
|
185
|
+
}
|
|
186
|
+
|
|
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;
|
|
192
|
+
}
|
|
193
|
+
|
|
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);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.row > li:first-child .stop-cell::before {
|
|
206
|
+
left: 50%;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.stop-cell {
|
|
210
|
+
grid-row: 1;
|
|
211
|
+
display: grid;
|
|
212
|
+
place-items: center;
|
|
213
|
+
}
|
|
214
|
+
|
|
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);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.moment-label {
|
|
226
|
+
position: absolute;
|
|
227
|
+
top: calc(50% + 16px);
|
|
228
|
+
font-size: 13px;
|
|
229
|
+
font-weight: 600;
|
|
230
|
+
color: var(--c-text-muted);
|
|
231
|
+
white-space: nowrap;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.shape {
|
|
235
|
+
grid-row: 1;
|
|
236
|
+
align-self: center;
|
|
237
|
+
position: relative;
|
|
238
|
+
width: 100%;
|
|
239
|
+
aspect-ratio: 5 / 3;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.repeat .shape {
|
|
243
|
+
aspect-ratio: 3 / 1;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.shape svg {
|
|
247
|
+
position: relative;
|
|
248
|
+
display: block;
|
|
249
|
+
width: 100%;
|
|
250
|
+
height: 100%;
|
|
251
|
+
overflow: visible;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/* The opening half: its tint with a little of its edge colour in it, in either theme. */
|
|
255
|
+
.open {
|
|
256
|
+
fill: color-mix(in oklab, var(--soft), var(--mark) 20%);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.close {
|
|
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;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.halves {
|
|
276
|
+
position: absolute;
|
|
277
|
+
inset: 0;
|
|
278
|
+
display: grid;
|
|
279
|
+
grid-template-columns: 1fr 1fr;
|
|
280
|
+
align-items: center;
|
|
281
|
+
margin: 0;
|
|
282
|
+
color: var(--c-text);
|
|
283
|
+
font-weight: 600;
|
|
284
|
+
font-size: clamp(0.75rem, 1.9cqi, 0.9375rem);
|
|
285
|
+
line-height: 1.25;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/* Each label sits toward the middle, where its half is widest. */
|
|
289
|
+
.halves span:first-child {
|
|
290
|
+
justify-self: end;
|
|
291
|
+
padding-right: 12%;
|
|
292
|
+
text-align: right;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.halves span:last-child {
|
|
296
|
+
padding-left: 12%;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.name {
|
|
300
|
+
grid-row: 2;
|
|
301
|
+
margin: var(--sp-4) 0 0;
|
|
302
|
+
text-align: center;
|
|
303
|
+
font-family: var(--font-display);
|
|
304
|
+
font-weight: 600;
|
|
305
|
+
font-size: var(--text-sub);
|
|
306
|
+
line-height: var(--leading-sub);
|
|
307
|
+
color: var(--c-text);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.motto {
|
|
311
|
+
display: block;
|
|
312
|
+
font-family: var(--font-body);
|
|
313
|
+
font-weight: 400;
|
|
314
|
+
font-size: var(--text-caption);
|
|
315
|
+
color: var(--c-text-muted);
|
|
316
|
+
}
|
|
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
|
+
|
|
348
|
+
figcaption {
|
|
349
|
+
margin-top: var(--sp-3);
|
|
350
|
+
font-size: var(--text-caption);
|
|
351
|
+
line-height: var(--leading-caption);
|
|
352
|
+
color: var(--c-text-muted);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/* Too narrow for a row: the phases stack, each moment a stop and its name between them. */
|
|
356
|
+
@container (max-width: 560px) {
|
|
357
|
+
.row {
|
|
358
|
+
grid-template-columns: 1fr;
|
|
359
|
+
grid-template-rows: none;
|
|
360
|
+
row-gap: var(--sp-5);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.stop-cell::before,
|
|
364
|
+
.shape::before {
|
|
365
|
+
display: none;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.row > li {
|
|
369
|
+
grid-row: auto;
|
|
370
|
+
grid-template-rows: none;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.stop-cell {
|
|
374
|
+
display: flex;
|
|
375
|
+
justify-content: center;
|
|
376
|
+
gap: var(--sp-3);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.moment-label {
|
|
380
|
+
position: static;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.shape,
|
|
384
|
+
.name,
|
|
385
|
+
.notes {
|
|
386
|
+
grid-row: auto;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.shape {
|
|
390
|
+
width: min(100%, 360px);
|
|
391
|
+
justify-self: center;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.notes {
|
|
395
|
+
width: min(100%, 420px);
|
|
396
|
+
justify-self: center;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.halves {
|
|
400
|
+
font-size: var(--text-body-sm);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
405
|
+
.arrive .row > li {
|
|
406
|
+
opacity: 0;
|
|
407
|
+
translate: 0 8px;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.arrive.seen .row > li {
|
|
411
|
+
opacity: 1;
|
|
412
|
+
translate: 0 0;
|
|
413
|
+
transition:
|
|
414
|
+
opacity var(--motion-base) var(--ease-out) calc(var(--i) * 80ms),
|
|
415
|
+
translate var(--motion-spring) var(--ease-spring) calc(var(--i) * 80ms);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
@media (forced-colors: active) {
|
|
420
|
+
.edge,
|
|
421
|
+
.split {
|
|
422
|
+
stroke: CanvasText;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.open,
|
|
426
|
+
.close {
|
|
427
|
+
fill: Canvas;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
</style>
|
|
431
|
+
|
|
432
|
+
<script>
|
|
433
|
+
// Once, as it comes into view, the parts arrive left to right.
|
|
434
|
+
const seen = new IntersectionObserver(
|
|
435
|
+
(entries) => {
|
|
436
|
+
entries
|
|
437
|
+
.filter((e) => e.isIntersecting)
|
|
438
|
+
.forEach((e) => {
|
|
439
|
+
e.target.classList.add('seen');
|
|
440
|
+
seen.unobserve(e.target);
|
|
441
|
+
});
|
|
442
|
+
},
|
|
443
|
+
{ threshold: 0.3 },
|
|
444
|
+
);
|
|
445
|
+
document.querySelectorAll('[data-diamonds].arrive').forEach((fig) => seen.observe(fig));
|
|
446
|
+
</script>
|