@n1kname/components 0.27.0 → 0.29.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/AtAGlance.astro +185 -0
- package/src/Clip.astro +198 -0
- package/src/FlowDiagram.astro +4 -177
- package/src/SectionNav.astro +53 -10
- package/src/Steps.astro +165 -0
- package/src/Tiers.astro +329 -0
- package/src/parts/DiagramZoom.astro +190 -0
package/package.json
CHANGED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* A long page in one look, at its top: a few labelled parts (a role, the problem, what was done,
|
|
4
|
+
* what changed), each a sentence or a short list, and the key figures under them. For a case
|
|
5
|
+
* study, so a reader who stops here still has the story, and one who reads on knows where it goes.
|
|
6
|
+
*
|
|
7
|
+
* The parts sit two across where there's room and stack where there isn't; each can lead with an
|
|
8
|
+
* icon. The figures are Facts tiles, as everywhere else. It is a section with its own heading, so
|
|
9
|
+
* it shows in a page's outline.
|
|
10
|
+
*/
|
|
11
|
+
import type { IconName } from './icons';
|
|
12
|
+
import Icon from './Icon.astro';
|
|
13
|
+
import Facts from './Facts.astro';
|
|
14
|
+
|
|
15
|
+
interface Part {
|
|
16
|
+
label: string;
|
|
17
|
+
/** Leads the label, from the icon set. One per part; the points keep their dots. */
|
|
18
|
+
icon?: IconName;
|
|
19
|
+
/** One or two sentences. */
|
|
20
|
+
text?: string;
|
|
21
|
+
/** Or a short list: two to four points. */
|
|
22
|
+
points?: string[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface Props {
|
|
26
|
+
parts: Part[];
|
|
27
|
+
/** The figures under the parts, as Facts tiles: a value, what it counts, and an icon, in the
|
|
28
|
+
* accent by default, so they read as this block's. */
|
|
29
|
+
figures?: { value: string; label: string; icon?: IconName; unit?: string; accent?: string }[];
|
|
30
|
+
title?: string;
|
|
31
|
+
/** The heading's level, 2 by default. */
|
|
32
|
+
level?: 2 | 3;
|
|
33
|
+
id?: string;
|
|
34
|
+
class?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const { parts, figures = [], title = 'At a glance', level = 2, id = 'at-a-glance', class: className } = Astro.props;
|
|
38
|
+
const Heading = `h${level}` as 'h2' | 'h3';
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
<section class:list={['glance', className]} aria-labelledby={`${id}-title`}>
|
|
42
|
+
<Heading class="glance-title" id={`${id}-title`}>{title}</Heading>
|
|
43
|
+
<dl class="parts">
|
|
44
|
+
{
|
|
45
|
+
parts.map((p) => (
|
|
46
|
+
<div class="part">
|
|
47
|
+
<dt>
|
|
48
|
+
{p.icon && (
|
|
49
|
+
<span class="part-icon" aria-hidden="true">
|
|
50
|
+
<Icon name={p.icon} size={16} />
|
|
51
|
+
</span>
|
|
52
|
+
)}
|
|
53
|
+
{p.label}
|
|
54
|
+
</dt>
|
|
55
|
+
<dd>
|
|
56
|
+
{p.text && <span class="text">{p.text}</span>}
|
|
57
|
+
{p.points && p.points.length > 0 && (
|
|
58
|
+
<ul>
|
|
59
|
+
{p.points.map((pt) => (
|
|
60
|
+
<li>{pt}</li>
|
|
61
|
+
))}
|
|
62
|
+
</ul>
|
|
63
|
+
)}
|
|
64
|
+
</dd>
|
|
65
|
+
</div>
|
|
66
|
+
))
|
|
67
|
+
}
|
|
68
|
+
</dl>
|
|
69
|
+
{
|
|
70
|
+
figures.length > 0 && (
|
|
71
|
+
<div class="figures">
|
|
72
|
+
<Facts items={figures.map((f) => ({ label: f.label, value: f.value, unit: f.unit, icon: f.icon, accent: f.accent ?? 'var(--c-text-accent)' }))} />
|
|
73
|
+
</div>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
</section>
|
|
77
|
+
|
|
78
|
+
<style>
|
|
79
|
+
.glance {
|
|
80
|
+
container-type: inline-size;
|
|
81
|
+
padding: var(--sp-5) var(--sp-6) var(--sp-6);
|
|
82
|
+
background: var(--c-surface);
|
|
83
|
+
border: 1px solid var(--c-border);
|
|
84
|
+
border-radius: var(--radius-lg);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.glance-title {
|
|
88
|
+
margin: 0 0 var(--sp-4);
|
|
89
|
+
font-family: var(--font-body);
|
|
90
|
+
font-size: var(--text-overline);
|
|
91
|
+
font-weight: 600;
|
|
92
|
+
line-height: var(--leading-overline);
|
|
93
|
+
letter-spacing: var(--tracking-overline);
|
|
94
|
+
text-transform: uppercase;
|
|
95
|
+
color: var(--c-text-accent);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.parts {
|
|
99
|
+
display: grid;
|
|
100
|
+
gap: var(--sp-5) var(--sp-7);
|
|
101
|
+
margin: 0;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@container (min-width: 640px) {
|
|
105
|
+
.parts {
|
|
106
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.part dt {
|
|
111
|
+
display: flex;
|
|
112
|
+
align-items: center;
|
|
113
|
+
gap: var(--sp-2);
|
|
114
|
+
margin-bottom: var(--sp-1);
|
|
115
|
+
font-family: var(--font-display);
|
|
116
|
+
font-weight: 600;
|
|
117
|
+
font-size: var(--text-sub);
|
|
118
|
+
line-height: var(--leading-sub);
|
|
119
|
+
color: var(--c-text);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.part-icon {
|
|
123
|
+
display: grid;
|
|
124
|
+
place-items: center;
|
|
125
|
+
flex: none;
|
|
126
|
+
width: 28px;
|
|
127
|
+
height: 28px;
|
|
128
|
+
border-radius: 50%;
|
|
129
|
+
background: var(--c-surface-tint);
|
|
130
|
+
color: var(--c-text-accent);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.part dd {
|
|
134
|
+
margin: 0;
|
|
135
|
+
font-size: var(--text-body);
|
|
136
|
+
line-height: var(--leading-body);
|
|
137
|
+
color: var(--c-text-secondary);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.text {
|
|
141
|
+
display: block;
|
|
142
|
+
text-wrap: pretty;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
ul {
|
|
146
|
+
display: grid;
|
|
147
|
+
gap: var(--sp-2);
|
|
148
|
+
margin: 0;
|
|
149
|
+
padding: 0;
|
|
150
|
+
list-style: none;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
li {
|
|
154
|
+
position: relative;
|
|
155
|
+
padding-left: var(--sp-4);
|
|
156
|
+
text-wrap: pretty;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
li::before {
|
|
160
|
+
content: '';
|
|
161
|
+
position: absolute;
|
|
162
|
+
left: 0;
|
|
163
|
+
top: 0.7em;
|
|
164
|
+
width: 6px;
|
|
165
|
+
height: 6px;
|
|
166
|
+
border-radius: 50%;
|
|
167
|
+
background: var(--c-accent);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.text + ul {
|
|
171
|
+
margin-top: var(--sp-2);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.figures {
|
|
175
|
+
margin-top: var(--sp-6);
|
|
176
|
+
padding-top: var(--sp-5);
|
|
177
|
+
border-top: 1px solid var(--c-border);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
@media (forced-colors: active) {
|
|
181
|
+
li::before {
|
|
182
|
+
background: CanvasText;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
</style>
|
package/src/Clip.astro
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* A short looping product clip, for where movement carries the point better than a still: a flow
|
|
4
|
+
* running, a theme swapping, a filter applied. On a sunken plate, with a caption.
|
|
5
|
+
*
|
|
6
|
+
* Three things it gets right, which is why it is a component rather than a bare <video>:
|
|
7
|
+
* 1. It never starts on its own for someone who asked for reduced motion. CSS can't cancel
|
|
8
|
+
* autoplay, so it is started from script, and only when motion is welcome and the clip is
|
|
9
|
+
* on screen.
|
|
10
|
+
* 2. Anything that moves for more than five seconds needs a way to stop it (WCAG 2.2.2). The
|
|
11
|
+
* Pause button is always there, never a hover reveal, so touch and keyboard have it too.
|
|
12
|
+
* 3. The still frame (`poster`) is required with a clip: it is what shows before the video
|
|
13
|
+
* loads, and all there is for anyone who never gets the video.
|
|
14
|
+
*
|
|
15
|
+
* Leave `src` off and a labelled placeholder holds the place at the same size, so a page can be
|
|
16
|
+
* written and reviewed before the clip exists.
|
|
17
|
+
*/
|
|
18
|
+
interface Props {
|
|
19
|
+
/** The clip's address. Leave off for a placeholder. */
|
|
20
|
+
src?: string;
|
|
21
|
+
/** The still frame's address. Required with `src`. */
|
|
22
|
+
poster?: string;
|
|
23
|
+
/** What the clip shows, for a screen reader, and on the placeholder. */
|
|
24
|
+
alt: string;
|
|
25
|
+
caption?: string;
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
/** Widest the clip is drawn, in px. */
|
|
29
|
+
maxWidth?: number;
|
|
30
|
+
type?: string;
|
|
31
|
+
/** The placeholder's label. */
|
|
32
|
+
placeholder?: string;
|
|
33
|
+
class?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const { src, poster, alt, caption, width, height, maxWidth = 1240, type = 'video/mp4', placeholder = 'Clip to add', class: className } = Astro.props;
|
|
37
|
+
|
|
38
|
+
if (src && !poster) {
|
|
39
|
+
throw new Error(
|
|
40
|
+
`Clip "${src}" has no poster. A clip without a still frame is a blank rectangle until it downloads, and stays blank for anyone who blocks video.`,
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
<figure class:list={['clip', className]}>
|
|
46
|
+
<div class="plate">
|
|
47
|
+
{
|
|
48
|
+
src ? (
|
|
49
|
+
<div class="frame" style={`max-width: ${maxWidth}px; aspect-ratio: ${width} / ${height}`}>
|
|
50
|
+
<video data-clip muted loop playsinline preload="metadata" poster={poster} aria-label={alt}>
|
|
51
|
+
<source src={src} type={type} />
|
|
52
|
+
</video>
|
|
53
|
+
<button type="button" class="toggle" data-clip-toggle aria-pressed="false">
|
|
54
|
+
<span data-label>Play</span>
|
|
55
|
+
</button>
|
|
56
|
+
</div>
|
|
57
|
+
) : (
|
|
58
|
+
<div class="placeholder" role="img" aria-label={`Placeholder. ${alt}`} style={`max-width: ${maxWidth}px; aspect-ratio: ${width} / ${height}`}>
|
|
59
|
+
<span class="pl-label">{placeholder}</span>
|
|
60
|
+
<span class="spec">
|
|
61
|
+
{width} × {height}
|
|
62
|
+
</span>
|
|
63
|
+
<span class="brief">{alt}</span>
|
|
64
|
+
</div>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
</div>
|
|
68
|
+
{caption && <figcaption>{caption}</figcaption>}
|
|
69
|
+
</figure>
|
|
70
|
+
|
|
71
|
+
<script>
|
|
72
|
+
const reduce = matchMedia('(prefers-reduced-motion: reduce)');
|
|
73
|
+
document.querySelectorAll<HTMLVideoElement>('video[data-clip]').forEach((video) => {
|
|
74
|
+
const frame = video.closest('.frame');
|
|
75
|
+
const button = frame?.querySelector<HTMLButtonElement>('[data-clip-toggle]');
|
|
76
|
+
const label = button?.querySelector('[data-label]');
|
|
77
|
+
const sync = () => {
|
|
78
|
+
const playing = !video.paused && !video.ended;
|
|
79
|
+
button?.setAttribute('aria-pressed', String(playing));
|
|
80
|
+
if (label) label.textContent = playing ? 'Pause' : 'Play';
|
|
81
|
+
};
|
|
82
|
+
button?.addEventListener('click', () => (video.paused ? video.play() : video.pause()));
|
|
83
|
+
video.addEventListener('play', sync);
|
|
84
|
+
video.addEventListener('pause', sync);
|
|
85
|
+
// Starts on its own only when motion is welcome, and only once it is on screen: a clip already
|
|
86
|
+
// scrolled past shouldn't spend bandwidth.
|
|
87
|
+
if (!reduce.matches) {
|
|
88
|
+
new IntersectionObserver(
|
|
89
|
+
(entries, obs) => {
|
|
90
|
+
if (!entries.some((e) => e.isIntersecting)) return;
|
|
91
|
+
video.play().catch(() => {});
|
|
92
|
+
obs.disconnect();
|
|
93
|
+
},
|
|
94
|
+
{ rootMargin: '100px' },
|
|
95
|
+
).observe(video);
|
|
96
|
+
}
|
|
97
|
+
sync();
|
|
98
|
+
});
|
|
99
|
+
</script>
|
|
100
|
+
|
|
101
|
+
<style>
|
|
102
|
+
.clip {
|
|
103
|
+
margin-block: var(--sp-6) var(--sp-7);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.plate {
|
|
107
|
+
display: flex;
|
|
108
|
+
justify-content: center;
|
|
109
|
+
padding: var(--sp-6);
|
|
110
|
+
background: var(--c-surface-sunken);
|
|
111
|
+
border: 1px solid var(--c-border);
|
|
112
|
+
border-radius: var(--radius-lg);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.frame {
|
|
116
|
+
position: relative;
|
|
117
|
+
width: 100%;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
video {
|
|
121
|
+
display: block;
|
|
122
|
+
width: 100%;
|
|
123
|
+
height: 100%;
|
|
124
|
+
object-fit: cover;
|
|
125
|
+
border: 1px solid var(--c-border);
|
|
126
|
+
border-radius: var(--radius-sm);
|
|
127
|
+
background: var(--c-surface);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.toggle {
|
|
131
|
+
position: absolute;
|
|
132
|
+
right: var(--sp-3);
|
|
133
|
+
bottom: var(--sp-3);
|
|
134
|
+
display: inline-flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
gap: var(--sp-2);
|
|
137
|
+
padding: 5px var(--sp-3);
|
|
138
|
+
border: 1px solid var(--c-border);
|
|
139
|
+
border-radius: var(--radius-full);
|
|
140
|
+
background: var(--c-surface);
|
|
141
|
+
color: var(--c-text);
|
|
142
|
+
font-family: var(--font-body);
|
|
143
|
+
font-size: var(--text-body-sm);
|
|
144
|
+
line-height: 1.4;
|
|
145
|
+
cursor: pointer;
|
|
146
|
+
transition: border-color var(--motion-hover) var(--ease-hover);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.toggle:hover {
|
|
150
|
+
border-color: var(--c-border-strong);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.toggle:focus-visible {
|
|
154
|
+
outline: 2px solid var(--c-focus);
|
|
155
|
+
outline-offset: 2px;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.placeholder {
|
|
159
|
+
display: grid;
|
|
160
|
+
place-content: center;
|
|
161
|
+
justify-items: center;
|
|
162
|
+
gap: var(--sp-2);
|
|
163
|
+
width: 100%;
|
|
164
|
+
padding: var(--sp-6);
|
|
165
|
+
text-align: center;
|
|
166
|
+
background: var(--c-surface);
|
|
167
|
+
border: 1px dashed var(--c-border-strong);
|
|
168
|
+
border-radius: var(--radius-sm);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.pl-label {
|
|
172
|
+
font-family: var(--font-body);
|
|
173
|
+
font-weight: 600;
|
|
174
|
+
font-size: var(--text-body-sm);
|
|
175
|
+
color: var(--c-text);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.spec {
|
|
179
|
+
font-family: var(--font-mono);
|
|
180
|
+
font-size: var(--text-caption);
|
|
181
|
+
color: var(--c-text-muted);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.brief {
|
|
185
|
+
max-width: 46ch;
|
|
186
|
+
margin-top: var(--sp-2);
|
|
187
|
+
font-size: var(--text-caption);
|
|
188
|
+
line-height: 1.5;
|
|
189
|
+
color: var(--c-text-muted);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
figcaption {
|
|
193
|
+
max-width: var(--layout-measure);
|
|
194
|
+
margin-top: var(--sp-4);
|
|
195
|
+
font-size: var(--text-body-sm);
|
|
196
|
+
color: var(--c-text-muted);
|
|
197
|
+
}
|
|
198
|
+
</style>
|
package/src/FlowDiagram.astro
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* reduced motion, the diagram is simply there and nothing moves.
|
|
11
11
|
*/
|
|
12
12
|
import { ICONS, type IconName } from './icons';
|
|
13
|
+
import DiagramZoom from './parts/DiagramZoom.astro';
|
|
13
14
|
|
|
14
15
|
type Side = 'top' | 'right' | 'bottom' | 'left';
|
|
15
16
|
type Tone = 'accent' | 'cool' | 'quiet' | 'solid';
|
|
@@ -215,18 +216,10 @@ const lines = (label: string) => {
|
|
|
215
216
|
};
|
|
216
217
|
---
|
|
217
218
|
|
|
218
|
-
<figure class:list={['flow', { 'has-narrow': narrow }]} data-flow
|
|
219
|
+
<figure class:list={['flow', { 'has-narrow': narrow }]} data-flow>
|
|
219
220
|
{views.map(({ kind, width, height, nodes, drawn, rings, note }) => (
|
|
220
221
|
<div class:list={['scroll', kind]}>
|
|
221
|
-
{kind === 'wide'
|
|
222
|
-
<button type="button" class="enlarge" data-enlarge hidden>
|
|
223
|
-
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
224
|
-
<path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7" />
|
|
225
|
-
</svg>
|
|
226
|
-
Enlarge<span class="visually-hidden">: {title}</span>
|
|
227
|
-
</button>
|
|
228
|
-
)}
|
|
229
|
-
<svg class="drawing" viewBox={`0 0 ${width} ${height}`} role="img" aria-labelledby={`${uid}-${kind}-t ${uid}-${kind}-d`}>
|
|
222
|
+
<svg class="drawing" viewBox={`0 0 ${width} ${height}`} role="img" aria-labelledby={`${uid}-${kind}-t ${uid}-${kind}-d`} data-zoom-source={kind === 'wide' ? '' : undefined}>
|
|
230
223
|
<title id={`${uid}-${kind}-t`}>{title}</title>
|
|
231
224
|
<desc id={`${uid}-${kind}-d`}>{desc}</desc>
|
|
232
225
|
|
|
@@ -305,52 +298,13 @@ const lines = (label: string) => {
|
|
|
305
298
|
)
|
|
306
299
|
}
|
|
307
300
|
</svg>
|
|
301
|
+
{kind === 'wide' && <DiagramZoom title={title} min={minWidth} id={uid} />}
|
|
308
302
|
</div>
|
|
309
303
|
))}
|
|
310
|
-
<dialog class="zoom" aria-labelledby={`${uid}-zoom`}>
|
|
311
|
-
<div class="zoom-bar">
|
|
312
|
-
<p class="zoom-title" id={`${uid}-zoom`}>{title}</p>
|
|
313
|
-
<button type="button" class="close" data-close>Close</button>
|
|
314
|
-
</div>
|
|
315
|
-
<div class="zoom-scroll" tabindex="0" role="region" aria-label={`${title}, full size`} data-zoom-body></div>
|
|
316
|
-
</dialog>
|
|
317
304
|
{caption && <figcaption>{caption}</figcaption>}
|
|
318
305
|
</figure>
|
|
319
306
|
|
|
320
307
|
<script>
|
|
321
|
-
// Narrower than it reads well at, it fits, smaller, with an Enlarge button that opens a copy
|
|
322
|
-
// full size in a dialog.
|
|
323
|
-
document.querySelectorAll<HTMLElement>('[data-flow]').forEach((fig) => {
|
|
324
|
-
const min = Number(fig.dataset.min) || 0;
|
|
325
|
-
const wide = fig.querySelector<HTMLElement>('.scroll.wide');
|
|
326
|
-
const button = fig.querySelector<HTMLButtonElement>('[data-enlarge]');
|
|
327
|
-
const dialog = fig.querySelector<HTMLDialogElement>('dialog.zoom');
|
|
328
|
-
const body = fig.querySelector<HTMLElement>('[data-zoom-body]');
|
|
329
|
-
if (!wide || !button || !dialog || !body) return;
|
|
330
|
-
const fit = () => {
|
|
331
|
-
const small = wide.offsetParent !== null && wide.clientWidth < min;
|
|
332
|
-
button.hidden = !small;
|
|
333
|
-
fig.classList.toggle('is-small', small);
|
|
334
|
-
};
|
|
335
|
-
new ResizeObserver(fit).observe(fig);
|
|
336
|
-
fit();
|
|
337
|
-
button.addEventListener('click', () => {
|
|
338
|
-
const copy = wide.querySelector('svg.drawing')!.cloneNode(true) as SVGSVGElement;
|
|
339
|
-
copy.removeAttribute('aria-labelledby');
|
|
340
|
-
copy.setAttribute('aria-hidden', 'true');
|
|
341
|
-
copy.querySelectorAll('[id]').forEach((el) => el.removeAttribute('id'));
|
|
342
|
-
copy.style.setProperty('--full', `${Math.max(min, 640)}px`);
|
|
343
|
-
body.replaceChildren(copy);
|
|
344
|
-
dialog.showModal();
|
|
345
|
-
// Open on the middle of the drawing, where its point usually is.
|
|
346
|
-
body.scrollLeft = (body.scrollWidth - body.clientWidth) / 2;
|
|
347
|
-
});
|
|
348
|
-
dialog.querySelector('[data-close]')?.addEventListener('click', () => dialog.close());
|
|
349
|
-
dialog.addEventListener('click', (e) => {
|
|
350
|
-
if (e.target === dialog) dialog.close();
|
|
351
|
-
});
|
|
352
|
-
});
|
|
353
|
-
|
|
354
308
|
// One step is a beat. Arm only what is below the fold, so a diagram already on screen
|
|
355
309
|
// never blinks out, and start the pulses once their line has drawn.
|
|
356
310
|
const STEP = 220;
|
|
@@ -406,133 +360,6 @@ const lines = (label: string) => {
|
|
|
406
360
|
}
|
|
407
361
|
}
|
|
408
362
|
|
|
409
|
-
/* Narrower than it reads well at: it fits, smaller, and offers itself full size. */
|
|
410
|
-
.enlarge {
|
|
411
|
-
position: absolute;
|
|
412
|
-
top: var(--sp-3);
|
|
413
|
-
right: var(--sp-3);
|
|
414
|
-
z-index: 1;
|
|
415
|
-
display: inline-flex;
|
|
416
|
-
align-items: center;
|
|
417
|
-
gap: var(--sp-1);
|
|
418
|
-
padding: var(--sp-1) var(--sp-3);
|
|
419
|
-
border: 1px solid var(--c-border);
|
|
420
|
-
border-radius: var(--radius-full);
|
|
421
|
-
background: var(--c-surface);
|
|
422
|
-
color: var(--c-text);
|
|
423
|
-
font: inherit;
|
|
424
|
-
font-size: var(--text-caption);
|
|
425
|
-
font-weight: 600;
|
|
426
|
-
cursor: pointer;
|
|
427
|
-
transition: border-color var(--motion-hover) var(--ease-hover);
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
.enlarge[hidden] {
|
|
431
|
-
display: none;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
.enlarge svg {
|
|
435
|
-
display: inline-block;
|
|
436
|
-
width: 16px;
|
|
437
|
-
height: 16px;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
.enlarge:hover {
|
|
441
|
-
border-color: var(--c-border-strong);
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
.is-small .scroll.wide {
|
|
445
|
-
padding-top: calc(var(--sp-3) * 2 + 28px);
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
.enlarge:focus-visible,
|
|
449
|
-
.close:focus-visible,
|
|
450
|
-
.zoom-scroll:focus-visible {
|
|
451
|
-
outline: 2px solid var(--c-focus);
|
|
452
|
-
outline-offset: 2px;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
.visually-hidden {
|
|
456
|
-
position: absolute;
|
|
457
|
-
width: 1px;
|
|
458
|
-
height: 1px;
|
|
459
|
-
overflow: hidden;
|
|
460
|
-
clip-path: inset(50%);
|
|
461
|
-
white-space: nowrap;
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
.zoom {
|
|
465
|
-
width: calc(100vw - var(--sp-4));
|
|
466
|
-
max-width: none;
|
|
467
|
-
height: calc(100dvh - var(--sp-4));
|
|
468
|
-
max-height: none;
|
|
469
|
-
padding: 0;
|
|
470
|
-
border: 1px solid var(--c-border);
|
|
471
|
-
border-radius: var(--radius-lg);
|
|
472
|
-
background: var(--c-bg);
|
|
473
|
-
color: var(--c-text);
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
.zoom[open] {
|
|
477
|
-
display: flex;
|
|
478
|
-
flex-direction: column;
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
.zoom::backdrop {
|
|
482
|
-
background: color-mix(in oklab, var(--c-bg) 70%, transparent);
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
.zoom-bar {
|
|
486
|
-
display: flex;
|
|
487
|
-
align-items: center;
|
|
488
|
-
justify-content: space-between;
|
|
489
|
-
gap: var(--sp-3);
|
|
490
|
-
padding: var(--sp-3) var(--sp-4);
|
|
491
|
-
border-bottom: 1px solid var(--c-border);
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
.zoom-title {
|
|
495
|
-
margin: 0;
|
|
496
|
-
font-weight: 600;
|
|
497
|
-
font-size: var(--text-body-sm);
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
.close {
|
|
501
|
-
padding: var(--sp-1) var(--sp-3);
|
|
502
|
-
border: 1px solid var(--c-border);
|
|
503
|
-
border-radius: var(--radius-full);
|
|
504
|
-
background: var(--c-surface);
|
|
505
|
-
color: var(--c-text);
|
|
506
|
-
font: inherit;
|
|
507
|
-
font-size: var(--text-caption);
|
|
508
|
-
font-weight: 600;
|
|
509
|
-
cursor: pointer;
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
/* Full size, so the words read; it pans where the screen is smaller. */
|
|
513
|
-
.zoom-scroll {
|
|
514
|
-
flex: 1;
|
|
515
|
-
overflow: auto;
|
|
516
|
-
padding: var(--sp-5);
|
|
517
|
-
background: var(--c-surface-sunken);
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
.zoom-scroll > svg {
|
|
521
|
-
display: block;
|
|
522
|
-
width: var(--full);
|
|
523
|
-
max-width: none;
|
|
524
|
-
height: auto;
|
|
525
|
-
overflow: visible;
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
.scroll {
|
|
529
|
-
position: relative;
|
|
530
|
-
background: var(--c-surface-sunken);
|
|
531
|
-
border: 1px solid var(--c-border);
|
|
532
|
-
border-radius: var(--radius-lg);
|
|
533
|
-
padding: var(--sp-6) var(--sp-5);
|
|
534
|
-
}
|
|
535
|
-
|
|
536
363
|
svg {
|
|
537
364
|
display: block;
|
|
538
365
|
width: 100%;
|