@n1kname/components 0.44.0 → 0.46.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.44.0",
3
+ "version": "0.46.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -36,7 +36,7 @@
36
36
  "@n1kname/charts": "0.15.0"
37
37
  },
38
38
  "peerDependencies": {
39
- "@n1kname/tokens": "^0.7.0",
39
+ "@n1kname/tokens": "^0.8.0",
40
40
  "astro": "^7.4.4"
41
41
  },
42
42
  "publishConfig": {
@@ -91,7 +91,6 @@ const Heading = `h${level}` as 'h2' | 'h3';
91
91
  font-weight: 600;
92
92
  line-height: var(--leading-overline);
93
93
  letter-spacing: var(--tracking-overline);
94
- text-transform: uppercase;
95
94
  color: var(--c-text-accent);
96
95
  }
97
96
 
@@ -374,9 +374,9 @@ const ordered = ranks.flatMap((r) => at(r));
374
374
  .part {
375
375
  margin: 0 0 var(--sp-2);
376
376
  font-size: var(--text-overline);
377
+ font-weight: 600;
377
378
  line-height: var(--leading-overline);
378
379
  letter-spacing: var(--tracking-overline);
379
- text-transform: uppercase;
380
380
  color: var(--c-text-accent);
381
381
  }
382
382
 
@@ -544,8 +544,8 @@ const ordered = ranks.flatMap((r) => at(r));
544
544
  padding-top: var(--sp-4);
545
545
  background: var(--c-surface-sunken);
546
546
  font-size: var(--text-overline);
547
+ font-weight: 600;
547
548
  letter-spacing: var(--tracking-overline);
548
- text-transform: uppercase;
549
549
  color: var(--c-text-accent);
550
550
  }
551
551
 
@@ -116,10 +116,19 @@ const fit = (img: ImageMetadata) => {
116
116
  return w.length ? w : [img.width];
117
117
  };
118
118
  const layerWidths = (img: ImageMetadata) => {
119
- const w = [800, 1600].filter((x) => x <= img.width);
119
+ const w = [400, 800, 1200, 1600].filter((x) => x <= img.width);
120
120
  return w.length ? w : [img.width];
121
121
  };
122
+ // A layer is shown at its share of the stage, and the stage is the picture area: about the tile's
123
+ // width on a phone, and at most some 600px (half) or 700px (wide) beside it. Saying so lets a small
124
+ // card cut out of a page load a small file.
125
+ const layerSizes = (width: number) =>
126
+ `(max-width: 760px) ${Math.round(width * 0.85)}vw, ${Math.round(width * (layout === 'wide' ? 7 : 6))}px`;
122
127
  const figures = layout === 'wide' ? metrics.slice(0, 4) : [];
128
+ // The link is named title first, then the line, the overline and the note, so a screen reader
129
+ // hears the case before its dates. Ids from the href, so the build stays the same each run.
130
+ const uid = `case-tile-${href.replace(/[^a-z0-9]+/gi, '-').replace(/^-|-$/g, '') || 'home'}`;
131
+ const labelledby = [`${uid}-title`, text && `${uid}-text`, overline && `${uid}-over`, note && `${uid}-note`].filter(Boolean).join(' ');
123
132
  ---
124
133
 
125
134
  <a
@@ -127,13 +136,14 @@ const figures = layout === 'wide' ? metrics.slice(0, 4) : [];
127
136
  href={href}
128
137
  style={`--tile-tone: ${tone}; ${patternStyle(pattern, ink)}`}
129
138
  data-case-tile
139
+ aria-labelledby={labelledby}
130
140
  >
131
141
  <div class="frame">
132
142
  <div class="copy">
133
- {overline && <p class="overline">{overline}</p>}
134
- <Heading class="title">{title}</Heading>
135
- {text && <p class="text">{text}</p>}
136
- {note && <p class="note">{note}</p>}
143
+ {overline && <p class="overline" id={`${uid}-over`}>{overline}</p>}
144
+ <Heading class="title" id={`${uid}-title`}>{title}</Heading>
145
+ {text && <p class="text" id={`${uid}-text`}>{text}</p>}
146
+ {note && <p class="note" id={`${uid}-note`}>{note}</p>}
137
147
  {
138
148
  figures.length > 0 && (
139
149
  <dl class="metrics">
@@ -157,7 +167,7 @@ const figures = layout === 'wide' ? metrics.slice(0, 4) : [];
157
167
  {typeof l.image === 'string' ? (
158
168
  <img src={l.image} alt={l.alt ?? ''} loading="lazy" />
159
169
  ) : (
160
- <Image src={l.image} alt={l.alt ?? ''} widths={layerWidths(l.image)} sizes="(max-width: 760px) 90vw, 700px" format="webp" quality={80} loading="lazy" />
170
+ <Image src={l.image} alt={l.alt ?? ''} widths={layerWidths(l.image)} sizes={layerSizes(l.width)} format="webp" quality={80} loading="lazy" />
161
171
  )}
162
172
  </div>
163
173
  ))}
@@ -87,9 +87,15 @@ const sizes = phone
87
87
  ? size === 'cover' ? '(max-width: 640px) 30vw, 230px' : '(max-width: 640px) 22vw, 70px'
88
88
  : size === 'cover' ? '(max-width: 900px) 80vw, 760px' : '(max-width: 640px) 70vw, 220px';
89
89
  const layerWidths = (img: ImageMetadata) => {
90
- const w = [800, 1600, 2400].filter((x) => x <= img.width);
90
+ const w = [400, 800, 1200, 1600, 2400].filter((x) => x <= img.width);
91
91
  return w.length ? w : [img.width];
92
92
  };
93
+ // A layer is shown at its share of the stage: on a cover about 56% of a panel up to some 1240px wide
94
+ // (76% on a phone), on a card about the card's width. Saying so lets a small card load a small file.
95
+ const layerSizes = (width: number) =>
96
+ size === 'cover'
97
+ ? `(max-width: 640px) ${Math.round(width * 0.7)}vw, ${Math.round(width * 7)}px`
98
+ : `(max-width: 640px) ${Math.round(width * 0.9)}vw, ${Math.round(width * 3.6)}px`;
93
99
  const fit = (img: ImageMetadata) => [...new Set(widths.filter((w) => w <= img.width))];
94
100
  ---
95
101
 
@@ -111,7 +117,7 @@ const fit = (img: ImageMetadata) => [...new Set(widths.filter((w) => w <= img.wi
111
117
  src={l.image}
112
118
  alt={l.alt ?? ''}
113
119
  widths={layerWidths(l.image)}
114
- sizes="(max-width: 900px) 90vw, 1000px"
120
+ sizes={layerSizes(l.width)}
115
121
  format="webp"
116
122
  quality={80}
117
123
  loading={eager ? 'eager' : 'lazy'}
@@ -217,7 +223,11 @@ const fit = (img: ImageMetadata) => [...new Set(widths.filter((w) => w <= img.wi
217
223
  margin: 0;
218
224
  padding: 4px var(--sp-3);
219
225
  border-radius: var(--radius-full);
220
- background: rgb(255 255 255 / 0.16);
226
+ /* Tinted from the panel and blurred, so it reads even where a picture runs under it. */
227
+ background: color-mix(in oklab, var(--stack-tone), black 30%);
228
+ background: color-mix(in oklab, color-mix(in oklab, var(--stack-tone), black 35%) 72%, transparent);
229
+ backdrop-filter: blur(10px);
230
+ -webkit-backdrop-filter: blur(10px);
221
231
  color: #fff;
222
232
  font-size: var(--text-caption);
223
233
  line-height: 1.4;
@@ -274,7 +284,7 @@ const fit = (img: ImageMetadata) => [...new Set(widths.filter((w) => w <= img.wi
274
284
  );
275
285
  }
276
286
  .ink-dark .note {
277
- background: rgb(0 0 0 / 0.1);
287
+ background: color-mix(in oklab, color-mix(in oklab, var(--stack-tone), white 45%) 78%, transparent);
278
288
  color: #17181a;
279
289
  }
280
290
 
@@ -392,17 +402,24 @@ const fit = (img: ImageMetadata) => [...new Set(widths.filter((w) => w <= img.wi
392
402
  .cover.laptop .screen {
393
403
  width: 78%;
394
404
  }
395
- .cover.laptop .s0 { left: 6%; top: 34%; }
396
- .cover.laptop .s1 { left: 16%; top: 20%; }
405
+ /* On a phone the note takes the top, so the pictures start under it rather than behind it. */
406
+ .cover.laptop .s0 { left: 6%; top: 44%; }
407
+ .cover.laptop .s1 { left: 16%; top: 30%; }
397
408
  .cover.laptop .s2 { display: none; }
398
409
 
399
410
  /* Phones keep all three, larger, overlapping more. */
400
411
  .cover.phone .screen {
401
412
  width: 30%;
402
413
  }
403
- .cover.phone .s0 { left: 12%; top: 24%; }
404
- .cover.phone .s1 { left: 35%; top: 19%; }
405
- .cover.phone .s2 { left: 58%; top: 14%; }
414
+ .cover.phone .s0 { left: 12%; top: 36%; }
415
+ .cover.phone .s1 { left: 35%; top: 31%; }
416
+ .cover.phone .s2 { left: 58%; top: 26%; }
417
+
418
+ .cover .stage {
419
+ right: -4%;
420
+ top: 28%;
421
+ width: 76%;
422
+ }
406
423
  .cover.phone .note {
407
424
  max-width: calc(100% - 2 * var(--sp-3));
408
425
  }
@@ -62,8 +62,8 @@ const hash = (h: string) => (h.startsWith('#') ? h : `#${h}`);
62
62
  margin: 0 0 var(--sp-3);
63
63
  font-size: var(--text-overline);
64
64
  line-height: var(--leading-overline);
65
+ font-weight: 600;
65
66
  letter-spacing: var(--tracking-overline);
66
- text-transform: uppercase;
67
67
  color: var(--c-text-muted);
68
68
  }
69
69
 
package/src/SideNav.astro CHANGED
@@ -108,8 +108,6 @@ const icon = (name?: IconName) =>
108
108
  padding-inline: 11px;
109
109
  font-size: var(--text-label);
110
110
  font-weight: 600;
111
- letter-spacing: 0.04em;
112
- text-transform: uppercase;
113
111
  white-space: nowrap;
114
112
  color: var(--c-text-muted);
115
113
  }