@n1kname/components 0.63.0 → 0.65.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 +2 -2
- package/src/AtAGlance.astro +9 -6
- package/src/ServiceBlueprint.astro +3 -0
- package/src/Timeline.astro +8 -7
- package/src/Tracks.astro +2 -1
- package/src/YearCalendar.astro +2 -0
- package/src/mapstage.js +9 -1
- package/src/yearcalendar.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n1kname/components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.65.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@n1kname/charts": "0.15.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@n1kname/tokens": "^0.
|
|
42
|
+
"@n1kname/tokens": "^0.11.0",
|
|
43
43
|
"astro": "^7.4.4"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
package/src/AtAGlance.astro
CHANGED
|
@@ -80,17 +80,20 @@ const Heading = `h${level}` as 'h2' | 'h3';
|
|
|
80
80
|
container-type: inline-size;
|
|
81
81
|
padding: var(--sp-5) var(--sp-6) var(--sp-6);
|
|
82
82
|
background: var(--c-surface);
|
|
83
|
-
|
|
83
|
+
/* The accent all round: the summary is where a reader should land first. */
|
|
84
|
+
border: 1.5px solid var(--c-accent);
|
|
84
85
|
border-radius: var(--radius-lg);
|
|
85
86
|
}
|
|
86
87
|
|
|
88
|
+
/* A real heading, a step above the part labels, in the accent text colour like the figures and
|
|
89
|
+
* bullets under it. It was a small label in a heading's place, smaller than the parts. */
|
|
87
90
|
.glance-title {
|
|
88
|
-
margin: 0 0 var(--sp-
|
|
89
|
-
font-family: var(--font-
|
|
90
|
-
font-size: var(--text-
|
|
91
|
+
margin: 0 0 var(--sp-5);
|
|
92
|
+
font-family: var(--font-display);
|
|
93
|
+
font-size: var(--text-h3);
|
|
91
94
|
font-weight: 600;
|
|
92
|
-
line-height: var(--leading-
|
|
93
|
-
letter-spacing: var(--tracking-
|
|
95
|
+
line-height: var(--leading-h3);
|
|
96
|
+
letter-spacing: var(--tracking-h3);
|
|
94
97
|
color: var(--c-text-accent);
|
|
95
98
|
}
|
|
96
99
|
|
|
@@ -152,7 +152,10 @@ const lineAbove = (stage: Stage, laneIndex: number) => {
|
|
|
152
152
|
overflow: hidden;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
+
/* Positioned, so the screen-reader labels (absolute) inside it stay inside it: without this they
|
|
156
|
+
* anchored to the page and widened it by the grid's full width. */
|
|
155
157
|
.scroller {
|
|
158
|
+
position: relative;
|
|
156
159
|
overflow-x: auto;
|
|
157
160
|
overscroll-behavior-x: contain;
|
|
158
161
|
padding: var(--sp-5) var(--sp-5) var(--sp-5) 0;
|
package/src/Timeline.astro
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* `fill` is the other motion, for a long history that is read rather than glanced at: the same
|
|
18
18
|
* gapped, rounded segments, each filling as the reading line (60% down the window) passes it, in
|
|
19
19
|
* the accent for the step into now and the chart teal for the rest. Each marker it reaches lights
|
|
20
|
-
* up in
|
|
20
|
+
* up in the light teal of the cool tags. The entries
|
|
21
21
|
* don't arrive: the fill is the one moment. Under reduced motion, or without script, the rail is
|
|
22
22
|
* drawn in full.
|
|
23
23
|
*
|
|
@@ -381,7 +381,7 @@ const extras = await Promise.all(
|
|
|
381
381
|
The same line as without the fill: a segment between each pair of markers, a small gap clear
|
|
382
382
|
of each and rounded at both ends. Each segment fills from the top as the reading line passes
|
|
383
383
|
it (--p, from 0 to 1, set by the script), teal for the history and the accent for the step into
|
|
384
|
-
now. A marker turns
|
|
384
|
+
now. A marker turns light teal as the fill reaches it, with a small spring. Without the script
|
|
385
385
|
(or with reduced motion) nothing is held back: every segment and marker is drawn in full. */
|
|
386
386
|
[data-fill] {
|
|
387
387
|
--m: 12px;
|
|
@@ -441,16 +441,17 @@ const extras = await Promise.all(
|
|
|
441
441
|
color: var(--c-on-accent);
|
|
442
442
|
}
|
|
443
443
|
|
|
444
|
-
/* With icons: a disc the fill has reached is
|
|
444
|
+
/* With icons: a disc the fill has reached is the light teal of the cool tags, its icon in their
|
|
445
|
+
text colour (full teal read heavy on a light page); one it has yet to reach is a quiet tint;
|
|
445
446
|
now is the accent itself, with its halo. */
|
|
446
447
|
[data-fill][data-icons] [data-state] .marker {
|
|
447
|
-
background: var(--
|
|
448
|
-
color: var(--c-
|
|
448
|
+
background: var(--c-tag-cool-bg);
|
|
449
|
+
color: var(--c-tag-cool-text);
|
|
449
450
|
}
|
|
450
451
|
|
|
451
452
|
[data-fill][data-icons].filling li:not(.reached) .marker {
|
|
452
|
-
background:
|
|
453
|
-
color: color-mix(in oklab, var(--c-
|
|
453
|
+
background: var(--c-surface-sunken);
|
|
454
|
+
color: color-mix(in oklab, var(--c-tag-cool-text) 50%, var(--c-bg));
|
|
454
455
|
}
|
|
455
456
|
|
|
456
457
|
[data-fill][data-icons] [data-state='current'] .marker,
|
package/src/Tracks.astro
CHANGED
|
@@ -126,7 +126,8 @@ const trackTones: Tone[] = ['accent', 'cool'];
|
|
|
126
126
|
|
|
127
127
|
/* The diagrams' tones: a tint for the band, the edge colour for the disc. */
|
|
128
128
|
[data-tone='accent'] {
|
|
129
|
-
|
|
129
|
+
/* 24%: at 16% the band read pale next to the cool one. */
|
|
130
|
+
--fill: color-mix(in oklab, var(--c-accent) 24%, var(--c-surface));
|
|
130
131
|
--edge: var(--c-accent-edge);
|
|
131
132
|
/* The readable orange: the raw accent on its own tint is 2.6:1. */
|
|
132
133
|
--mark: var(--c-text-accent);
|
package/src/YearCalendar.astro
CHANGED
|
@@ -183,6 +183,8 @@ const html = calendarHTML({ year, days, tone, levels, colors, steps, weekStart,
|
|
|
183
183
|
z-index: 5;
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
+
/* The table for screen readers sits in a 1px box that clips it: a table can't be narrower than
|
|
187
|
+
* its cells, so on the table itself width: 1px did nothing and it widened the page on a phone. */
|
|
186
188
|
.year-calendar :global(.yc-sr) {
|
|
187
189
|
position: absolute;
|
|
188
190
|
width: 1px;
|
package/src/mapstage.js
CHANGED
|
@@ -9,6 +9,7 @@ export const HEAT = [1, 2, 3, 4, 5, 6].map((i) => `var(--c-heat-${i})`);
|
|
|
9
9
|
* A canvas reads colours, not tokens: a token (or any CSS colour), resolved now, as rgb(). Call it
|
|
10
10
|
* again when the theme changes (onTheme).
|
|
11
11
|
*/
|
|
12
|
+
let paint;
|
|
12
13
|
export const resolve = (value) => {
|
|
13
14
|
const probe = document.createElement('i');
|
|
14
15
|
probe.style.color = value;
|
|
@@ -16,7 +17,14 @@ export const resolve = (value) => {
|
|
|
16
17
|
document.body.append(probe);
|
|
17
18
|
const colour = getComputedStyle(probe).color;
|
|
18
19
|
probe.remove();
|
|
19
|
-
|
|
20
|
+
// The browser keeps the token's own colour space (oklch() since tokens 0.10), which MapLibre
|
|
21
|
+
// can't read: it drops the paint without a word. One pixel on a canvas turns it into rgb().
|
|
22
|
+
paint ??= (typeof OffscreenCanvas === 'function' ? new OffscreenCanvas(1, 1) : Object.assign(document.createElement('canvas'), { width: 1, height: 1 })).getContext('2d', { willReadFrequently: true });
|
|
23
|
+
paint.clearRect(0, 0, 1, 1);
|
|
24
|
+
paint.fillStyle = colour;
|
|
25
|
+
paint.fillRect(0, 0, 1, 1);
|
|
26
|
+
const [r, g, b, a] = paint.getImageData(0, 0, 1, 1).data;
|
|
27
|
+
return a === 255 ? `rgb(${r}, ${g}, ${b})` : `rgba(${r}, ${g}, ${b}, ${+(a / 255).toFixed(3)})`;
|
|
20
28
|
};
|
|
21
29
|
|
|
22
30
|
/** Calls fn when the theme changes, by the switch (data-theme) or by the system. */
|
package/src/yearcalendar.js
CHANGED
|
@@ -129,9 +129,9 @@ export const calendarHTML = (opts) => {
|
|
|
129
129
|
const table =
|
|
130
130
|
opts.table === false
|
|
131
131
|
? ''
|
|
132
|
-
: `<
|
|
132
|
+
: `<div class="yc-sr"><table><caption>${esc(named)}</caption><thead><tr><th scope="col">${esc(say.month)}</th><th scope="col">${esc(say.days)}</th>${total ? `<th scope="col">${esc(say.total)}</th>` : ''}</tr></thead><tbody>${byMonth
|
|
133
133
|
.map((m, i) => `<tr><th scope="row">${esc(monthNames[i])}</th><td>${m.days}</td>${total ? `<td>${esc(total(m.sum, i))}</td>` : ''}</tr>`)
|
|
134
|
-
.join('')}</tbody></table>`;
|
|
134
|
+
.join('')}</tbody></table></div>`;
|
|
135
135
|
|
|
136
136
|
return (
|
|
137
137
|
`<div class="yc-frame" style="--weeks: ${weeks.length}; ${ramp}">` +
|