@n1kname/components 0.66.1 → 0.67.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.66.1",
3
+ "version": "0.67.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
package/src/Facts.astro CHANGED
@@ -199,20 +199,26 @@ const hl = highlight && variant === 'tiles';
199
199
  color: var(--c-text-secondary);
200
200
  }
201
201
 
202
- /* A label that would get less than 7rem beside its icon (a narrow tile, two across on a phone)
203
- drops under it and takes the tile's whole width: beside the icon it had about 70px and broke
204
- a word to a line. Done with wrapping, not a container query: a container on the tile would
205
- switch off its subgrid, and the figures would no longer share a baseline. */
202
+ /* A long label (a description, over 18 characters) that would get less than 5rem beside its
203
+ icon, as in a narrow tile two across on a phone, drops under it and takes the tile's whole
204
+ width: beside the icon it had about 70px and broke a word to a line. A short label ("Steps",
205
+ "Avg sleep") always stays beside its icon. Done with wrapping, not a container query: a
206
+ container on the tile would switch off its subgrid, and the figures would no longer share a
207
+ baseline. */
206
208
  .tiles :global(dt) {
207
209
  flex-wrap: wrap;
208
210
  row-gap: var(--sp-2);
209
211
  }
210
212
 
211
213
  .tiles :global(.fact-label) {
212
- flex: 1 1 7rem;
214
+ flex: 1 1 0;
213
215
  min-width: 0;
214
216
  }
215
217
 
218
+ .tiles :global(.fact-label[data-long]) {
219
+ flex-basis: 5rem;
220
+ }
221
+
216
222
  .tiles :global(.fact-icon) {
217
223
  width: 28px;
218
224
  height: 28px;
@@ -10,6 +10,10 @@ interface Item {
10
10
  icon: IconName;
11
11
  dimension: string;
12
12
  outcome: string;
13
+ /** The chip's colour, for rows that carry a status: `cool` (teal) for done, `accent` (the
14
+ * default) for in progress, `quiet` (grey) for not started. Rows without a status keep the
15
+ * accent. */
16
+ tone?: 'accent' | 'cool' | 'quiet';
13
17
  }
14
18
 
15
19
  interface Props {
@@ -32,7 +36,7 @@ const { items, closing, headings = ['Dimension', 'The outcome'] } = Astro.props;
32
36
  items.map((item) => (
33
37
  <div class="row">
34
38
  <dt class="t-sub">
35
- <span class="chip">
39
+ <span class="chip" data-tone={item.tone ?? 'accent'}>
36
40
  <Icon name={item.icon} size={17} />
37
41
  </span>
38
42
  {item.dimension}
@@ -97,6 +101,18 @@ const { items, closing, headings = ['Dimension', 'The outcome'] } = Astro.props;
97
101
  color: var(--c-text-accent);
98
102
  }
99
103
 
104
+ /* A status, readable at a glance down the column: done in the teal of the cool tags, not
105
+ started in grey. */
106
+ .chip[data-tone='cool'] {
107
+ background: var(--c-tag-cool-bg);
108
+ color: var(--c-tag-cool-text);
109
+ }
110
+
111
+ .chip[data-tone='quiet'] {
112
+ background: var(--c-surface-sunken);
113
+ color: var(--c-text-secondary);
114
+ }
115
+
100
116
  dd {
101
117
  margin: 0;
102
118
  max-width: none;
@@ -8,7 +8,7 @@
8
8
  * with a halo); any after it are still to come (hollow markers on a dashed line). By default the
9
9
  * last entry is now. `order="newest-first"` turns that round for a history read from today back,
10
10
  * such as a career: the first entry is now and the ones below it are done. An entry can carry an
11
- * icon, shown in a disc: soft for what's done, the accent with a halo for now. With `fill` the discs
11
+ * icon, shown in a disc: light teal for what's done, the accent with a halo for now. With `fill` the discs
12
12
  * are the same, in teal for the history behind and the accent for now.
13
13
  *
14
14
  * Once, as each entry comes into view, its marker settles in, its text rises and its line draws on
@@ -237,9 +237,15 @@ const extras = await Promise.all(
237
237
  box-shadow: inset 0 0 0 2px var(--c-border-strong);
238
238
  }
239
239
 
240
- /* With icons: a soft disc of the accent for what's done, the accent itself for now. */
240
+ /* With icons: the light teal of the cool tags for what's done, on a teal line, and the accent
241
+ itself for now, so the orange marks only where things stand (as with fill). */
242
+ .timeline[data-icons] {
243
+ --rail-done: color-mix(in oklab, var(--c-tag-cool-text) 45%, var(--c-border));
244
+ }
245
+
241
246
  [data-icons] [data-state='done'] .marker {
242
- background: color-mix(in oklab, var(--c-accent) 16%, var(--c-surface));
247
+ background: var(--c-tag-cool-bg);
248
+ color: var(--c-tag-cool-text);
243
249
  }
244
250
 
245
251
  [data-icons] [data-state='current'] .marker {
package/src/Tracks.astro CHANGED
@@ -47,7 +47,10 @@ interface Props {
47
47
  const { title, steps, tracks, stepTones, caption, class: className } = Astro.props;
48
48
  const n = steps.length;
49
49
  const toneOf = (k: number): Tone => stepTones?.[k] ?? (k === n - 1 ? 'accent' : 'quiet');
50
- const trackTones: Tone[] = ['accent', 'cool'];
50
+ // A track's disc is teal unless the track says otherwise: the row names a kind of thing, and
51
+ // alternating orange and teal by position read as meaning where there was none. The orange stays
52
+ // for the step that matters.
53
+ const trackTones: Tone[] = ['cool'];
51
54
  ---
52
55
 
53
56
  <figure class:list={['tracks', className]} data-tracks>
package/src/facts.js CHANGED
@@ -26,7 +26,7 @@ const deltaOf = (d) => (d == null || d === '' ? null : typeof d === 'string' ? {
26
26
  const hasLine = (f) => f.context != null || f.contextId != null || deltaOf(f.delta) != null;
27
27
  const sizeOf = (variant) => (variant === 'tiles' ? 16 : 14);
28
28
 
29
- const dtHTML = (f, size) => `${f.icon ? `<span class="fact-icon">${icon(f.icon, size)}</span>` : ''}<span class="fact-label">${esc(f.label)}</span>`;
29
+ const dtHTML = (f, size) => `${f.icon ? `<span class="fact-icon">${icon(f.icon, size)}</span>` : ''}<span class="fact-label"${String(f.label ?? '').length > 18 ? ' data-long' : ''}>${esc(f.label)}</span>`;
30
30
  const lineHTML = (f) => {
31
31
  const d = deltaOf(f.delta);
32
32
  return `${d ? `<strong class="fact-delta" data-tone="${d.tone}">${esc(d.text)}</strong> ` : ''}${esc(f.context)}`;