@n1kname/components 0.67.0 → 0.67.2
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 +25 -6
- package/src/Personas.astro +9 -6
- package/src/ScreenStack.astro +8 -4
package/package.json
CHANGED
package/src/CareerMap.astro
CHANGED
|
@@ -6,8 +6,10 @@
|
|
|
6
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
|
-
* the ends. Picking changes the panel at once; it's an answer to a question, not a moment.
|
|
10
|
-
*
|
|
9
|
+
* the ends. Picking changes the panel at once; it's an answer to a question, not a moment. The
|
|
10
|
+
* level picked goes in the URL (`?level=`, or `?<id>=` with more than one map on a page), so a
|
|
11
|
+
* reload or a shared link opens on it. Without script only the level given as `selected` shows,
|
|
12
|
+
* and the table still holds everything.
|
|
11
13
|
*
|
|
12
14
|
* Drawn in the diagrams' own style, on a sunken plate, as Flow diagram is. Below 640px wide the
|
|
13
15
|
* ladder becomes a list.
|
|
@@ -91,7 +93,7 @@ const byTheme = (t: string) => areas.filter((a) => (a.theme ?? '') === t);
|
|
|
91
93
|
const ordered = ranks.flatMap((r) => at(r));
|
|
92
94
|
---
|
|
93
95
|
|
|
94
|
-
<figure class:list={['career-map', className]} data-career-map>
|
|
96
|
+
<figure class:list={['career-map', className]} data-career-map={uid}>
|
|
95
97
|
<div class="plate">
|
|
96
98
|
<div class="ladder" role="tablist" aria-label={title} style={`grid-template-columns: ${columns}`}>
|
|
97
99
|
{
|
|
@@ -592,8 +594,17 @@ const ordered = ranks.flatMap((r) => at(r));
|
|
|
592
594
|
<script>
|
|
593
595
|
// Picking a level shows its panel. The arrow keys move along the ladder in reading order and pick
|
|
594
596
|
// as they go; Home and End go to the ends.
|
|
595
|
-
|
|
597
|
+
// The level picked goes in the URL, replacing the entry rather than adding one, so Back still
|
|
598
|
+
// leaves the page.
|
|
599
|
+
const maps = [...document.querySelectorAll<HTMLElement>('[data-career-map]')];
|
|
600
|
+
maps.forEach((map) => {
|
|
596
601
|
const tabs = [...map.querySelectorAll<HTMLButtonElement>('[role="tab"]')];
|
|
602
|
+
const key = maps.length > 1 ? map.dataset.careerMap || 'level' : 'level';
|
|
603
|
+
const remember = (tab: HTMLButtonElement) => {
|
|
604
|
+
const url = new URL(location.href);
|
|
605
|
+
url.searchParams.set(key, tab.dataset.level ?? '');
|
|
606
|
+
history.replaceState(history.state, '', url);
|
|
607
|
+
};
|
|
597
608
|
// Reading order follows the ranks: the DOM already lists them so.
|
|
598
609
|
const pick = (tab: HTMLButtonElement, focus = false) => {
|
|
599
610
|
tabs.forEach((t) => {
|
|
@@ -606,13 +617,21 @@ const ordered = ranks.flatMap((r) => at(r));
|
|
|
606
617
|
if (focus) tab.focus();
|
|
607
618
|
};
|
|
608
619
|
tabs.forEach((t, i) => {
|
|
609
|
-
t.addEventListener('click', () =>
|
|
620
|
+
t.addEventListener('click', () => {
|
|
621
|
+
pick(t);
|
|
622
|
+
remember(t);
|
|
623
|
+
});
|
|
610
624
|
t.addEventListener('keydown', (e) => {
|
|
611
625
|
const to = { ArrowRight: i + 1, ArrowDown: i + 1, ArrowLeft: i - 1, ArrowUp: i - 1, Home: 0, End: tabs.length - 1 }[e.key];
|
|
612
626
|
if (to === undefined) return;
|
|
613
627
|
e.preventDefault();
|
|
614
|
-
|
|
628
|
+
const next = tabs[(to + tabs.length) % tabs.length];
|
|
629
|
+
pick(next, true);
|
|
630
|
+
remember(next);
|
|
615
631
|
});
|
|
616
632
|
});
|
|
633
|
+
const asked = new URL(location.href).searchParams.get(key);
|
|
634
|
+
const start = asked && tabs.find((t) => t.dataset.level === asked);
|
|
635
|
+
if (start) pick(start);
|
|
617
636
|
});
|
|
618
637
|
</script>
|
package/src/Personas.astro
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* such as the four on a story map.
|
|
6
6
|
*
|
|
7
7
|
* Deliberately not cards: open columns with a hairline between them, so a page that already has
|
|
8
|
-
* boxes doesn't get more. The quote
|
|
8
|
+
* boxes doesn't get more. The quote sits on a soft tint of the person's tone. A list, each person a
|
|
9
9
|
* heading, their notes and their quote, read in order. Up to four columns; below 640px wide two,
|
|
10
10
|
* below 420px one, with a rule above each person instead.
|
|
11
11
|
*
|
|
@@ -202,7 +202,8 @@ const tones: Tone[] = ['accent', 'cool'];
|
|
|
202
202
|
margin-bottom: 2px;
|
|
203
203
|
font-size: var(--text-caption);
|
|
204
204
|
font-weight: 600;
|
|
205
|
-
|
|
205
|
+
/* Tinted from the surface it sits on, not a flat grey. */
|
|
206
|
+
color: var(--mark);
|
|
206
207
|
}
|
|
207
208
|
|
|
208
209
|
dd {
|
|
@@ -213,11 +214,13 @@ const tones: Tone[] = ['accent', 'cool'];
|
|
|
213
214
|
text-wrap: pretty;
|
|
214
215
|
}
|
|
215
216
|
|
|
216
|
-
/* The person's voice
|
|
217
|
+
/* The person's voice, at the foot of the column: a 10% tint of their tone, as the Notice. Not
|
|
218
|
+
* a rule down one side, which reads as a coloured bar on a box. */
|
|
217
219
|
blockquote {
|
|
218
220
|
margin: auto 0 0;
|
|
219
|
-
padding: var(--sp-
|
|
220
|
-
border-
|
|
221
|
+
padding: var(--sp-3) var(--sp-4);
|
|
222
|
+
border-radius: var(--radius-md);
|
|
223
|
+
background: color-mix(in oklab, var(--mark) 10%, var(--c-surface));
|
|
221
224
|
}
|
|
222
225
|
|
|
223
226
|
blockquote p {
|
|
@@ -308,7 +311,7 @@ const tones: Tone[] = ['accent', 'cool'];
|
|
|
308
311
|
}
|
|
309
312
|
|
|
310
313
|
blockquote {
|
|
311
|
-
border
|
|
314
|
+
border: 1px solid CanvasText;
|
|
312
315
|
}
|
|
313
316
|
}
|
|
314
317
|
</style>
|
package/src/ScreenStack.astro
CHANGED
|
@@ -74,7 +74,8 @@ interface Props {
|
|
|
74
74
|
device?: 'laptop' | 'phone';
|
|
75
75
|
/** A view-transition-name, so a card's stack can grow into the cover on the page it opens. */
|
|
76
76
|
transition?: string;
|
|
77
|
-
/**
|
|
77
|
+
/** For a cover above the fold: every picture loads at once (none lazily), and the front screen,
|
|
78
|
+
* or the widest layer, first. */
|
|
78
79
|
eager?: boolean;
|
|
79
80
|
/** Follow the pointer. On by default for a cover; a card fans out on hover instead. */
|
|
80
81
|
parallax?: boolean;
|
|
@@ -101,6 +102,8 @@ const layerSizes = (width: number) =>
|
|
|
101
102
|
? `(max-width: 640px) ${Math.round(width * 0.7)}vw, ${Math.round(width * 7)}px`
|
|
102
103
|
: `(max-width: 640px) ${Math.round(width * 0.9)}vw, ${Math.round(width * 3.6)}px`;
|
|
103
104
|
const fit = (img: ImageMetadata) => [...new Set(widths.filter((w) => w <= img.width))];
|
|
105
|
+
// The widest layer is the largest paint on a cover, so it is the one fetched first.
|
|
106
|
+
const lead = layers.reduce((best, l, i) => (l.width > layers[best].width ? i : best), 0);
|
|
104
107
|
---
|
|
105
108
|
|
|
106
109
|
<div
|
|
@@ -115,7 +118,7 @@ const fit = (img: ImageMetadata) => [...new Set(widths.filter((w) => w <= img.wi
|
|
|
115
118
|
{layers.map((l, i) => (
|
|
116
119
|
<div class:list={['layer', { float: l.float }]} style={`left: ${l.x}%; top: ${l.y}%; width: ${l.width}%; --depth: ${l.depth ?? 0}; --i: ${i}`}>
|
|
117
120
|
{typeof l.image === 'string' ? (
|
|
118
|
-
<img src={l.image} alt={l.alt ?? ''} width={l.size?.width} height={l.size?.height} loading={eager ? 'eager' : 'lazy'} />
|
|
121
|
+
<img src={l.image} alt={l.alt ?? ''} width={l.size?.width} height={l.size?.height} loading={eager ? 'eager' : 'lazy'} fetchpriority={eager && i === lead ? 'high' : 'auto'} />
|
|
119
122
|
) : (
|
|
120
123
|
<Image
|
|
121
124
|
src={l.image}
|
|
@@ -125,6 +128,7 @@ const fit = (img: ImageMetadata) => [...new Set(widths.filter((w) => w <= img.wi
|
|
|
125
128
|
format="webp"
|
|
126
129
|
quality={80}
|
|
127
130
|
loading={eager ? 'eager' : 'lazy'}
|
|
131
|
+
fetchpriority={eager && i === lead ? 'high' : 'auto'}
|
|
128
132
|
/>
|
|
129
133
|
)}
|
|
130
134
|
</div>
|
|
@@ -139,7 +143,7 @@ const fit = (img: ImageMetadata) => [...new Set(widths.filter((w) => w <= img.wi
|
|
|
139
143
|
return (
|
|
140
144
|
<div class={`screen s${i}`}>
|
|
141
145
|
{typeof s.image === 'string' ? (
|
|
142
|
-
<img src={s.image} alt={s.alt} width={s.size?.width} height={s.size?.height} loading={eager && first ? '
|
|
146
|
+
<img src={s.image} alt={s.alt} width={s.size?.width} height={s.size?.height} loading={eager ? 'eager' : 'lazy'} fetchpriority={eager && first ? 'high' : 'auto'} />
|
|
143
147
|
) : (
|
|
144
148
|
<Image
|
|
145
149
|
src={s.image}
|
|
@@ -148,7 +152,7 @@ const fit = (img: ImageMetadata) => [...new Set(widths.filter((w) => w <= img.wi
|
|
|
148
152
|
sizes={sizes}
|
|
149
153
|
format="webp"
|
|
150
154
|
quality={82}
|
|
151
|
-
loading={eager
|
|
155
|
+
loading={eager ? 'eager' : 'lazy'}
|
|
152
156
|
fetchpriority={eager && first ? 'high' : 'auto'}
|
|
153
157
|
/>
|
|
154
158
|
)}
|