@n1kname/components 0.50.0 → 0.52.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/FlowDiagram.astro +10 -0
- package/src/Timeline.astro +55 -71
package/package.json
CHANGED
package/src/FlowDiagram.astro
CHANGED
|
@@ -410,6 +410,16 @@ const lines = (label: string) => {
|
|
|
410
410
|
fill: var(--c-on-accent);
|
|
411
411
|
}
|
|
412
412
|
|
|
413
|
+
/* An icon node's name and line sit under the disc, on the page, so they keep the page's text
|
|
414
|
+
* colour; only the glyph inside turns to the on-accent colour. */
|
|
415
|
+
.solid.icon-node .name {
|
|
416
|
+
fill: var(--c-text);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.solid.icon-node .glyph {
|
|
420
|
+
color: var(--c-on-accent);
|
|
421
|
+
}
|
|
422
|
+
|
|
413
423
|
.glyph {
|
|
414
424
|
fill: none;
|
|
415
425
|
stroke: currentColor;
|
package/src/Timeline.astro
CHANGED
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
* Once, as each entry comes into view, its marker settles in, its text rises and its line draws on
|
|
15
15
|
* to the next. Nothing moves under reduced motion, and without script everything is simply there.
|
|
16
16
|
*
|
|
17
|
-
* `fill` is the other motion, for a long history that is read rather than glanced at:
|
|
18
|
-
*
|
|
19
|
-
* step into now and the chart teal for the rest. Each marker it
|
|
17
|
+
* `fill` is the other motion, for a long history that is read rather than glanced at: the same
|
|
18
|
+
* gapped, rounded segments, each filling as the reading line (60% down the window) passes it, in
|
|
19
|
+
* the accent for the step into now and the chart teal for the rest. Each marker it reaches lights
|
|
20
|
+
* up in full teal. The entries
|
|
20
21
|
* don't arrive: the fill is the one moment. Under reduced motion, or without script, the rail is
|
|
21
22
|
* drawn in full.
|
|
22
23
|
*
|
|
@@ -120,30 +121,27 @@ const extras = await Promise.all(
|
|
|
120
121
|
list.querySelectorAll('li').forEach((li) => seen.observe(li));
|
|
121
122
|
});
|
|
122
123
|
|
|
123
|
-
// The fill: from
|
|
124
|
-
// the
|
|
124
|
+
// The fill: each segment, from below one marker to above the next, fills as the line being read
|
|
125
|
+
// (60% down the window) passes it, and a marker counts as reached once the line is level with it.
|
|
125
126
|
document.querySelectorAll<HTMLElement>('[data-timeline].filling').forEach((list) => {
|
|
126
127
|
const items = [...list.querySelectorAll<HTMLElement>(':scope > li')];
|
|
127
128
|
if (items.length < 2) return;
|
|
128
|
-
const
|
|
129
|
-
const before = list.dataset.order === 'newest-first' ? now + 1 : now - 1;
|
|
129
|
+
const GAP = 6;
|
|
130
130
|
let queued = false;
|
|
131
131
|
const draw = () => {
|
|
132
132
|
queued = false;
|
|
133
|
-
const
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
list.style.setProperty('--lit-to', `${lit[1] - first}px`);
|
|
146
|
-
items.forEach((li, i) => li.classList.toggle('reached', at[i] <= end + 1));
|
|
133
|
+
const line = innerHeight * 0.6;
|
|
134
|
+
const marks = items.map((li) => li.querySelector('.marker')!.getBoundingClientRect());
|
|
135
|
+
items.forEach((li, i) => {
|
|
136
|
+
const m = marks[i];
|
|
137
|
+
li.classList.toggle('reached', m.top + m.height / 2 <= line + 1);
|
|
138
|
+
const next = marks[i + 1];
|
|
139
|
+
if (!next) return;
|
|
140
|
+
const top = m.bottom + GAP;
|
|
141
|
+
const bottom = next.top - GAP;
|
|
142
|
+
const p = Math.min(1, Math.max(0, (line - top) / Math.max(1, bottom - top)));
|
|
143
|
+
li.style.setProperty('--p', p.toFixed(3));
|
|
144
|
+
});
|
|
147
145
|
};
|
|
148
146
|
const queue = () => {
|
|
149
147
|
if (!queued) {
|
|
@@ -380,9 +378,11 @@ const extras = await Promise.all(
|
|
|
380
378
|
}
|
|
381
379
|
|
|
382
380
|
/* ── Fill ───────────────────────────────────────────────────────────────────
|
|
383
|
-
The
|
|
384
|
-
|
|
385
|
-
|
|
381
|
+
The same line as without the fill: a segment between each pair of markers, a small gap clear
|
|
382
|
+
of each and rounded at both ends. Each segment fills from the top as the reading line passes
|
|
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 full teal as the fill reaches it, with a small spring. Without the script
|
|
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;
|
|
388
388
|
--mt: 6px;
|
|
@@ -390,7 +390,6 @@ const extras = await Promise.all(
|
|
|
390
390
|
--gap: var(--sp-8);
|
|
391
391
|
--rail: var(--c-chart-2);
|
|
392
392
|
--rail-faint: color-mix(in oklab, var(--c-chart-2) 22%, transparent);
|
|
393
|
-
position: relative;
|
|
394
393
|
}
|
|
395
394
|
|
|
396
395
|
/* With icons, the same discs as without the fill. */
|
|
@@ -402,51 +401,32 @@ const extras = await Promise.all(
|
|
|
402
401
|
|
|
403
402
|
[data-fill] li {
|
|
404
403
|
column-gap: var(--sp-5);
|
|
404
|
+
--seg: var(--rail);
|
|
405
|
+
--seg-faint: var(--rail-faint);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/* The step into now is the accent, before the fill reaches it as well as after. */
|
|
409
|
+
[data-fill][data-order='newest-first'] li[data-state='current'],
|
|
410
|
+
[data-fill][data-order='oldest-first'] li:has(+ li[data-state='current']) {
|
|
411
|
+
--seg: var(--c-accent);
|
|
412
|
+
--seg-faint: color-mix(in oklab, var(--c-accent) 28%, transparent);
|
|
405
413
|
}
|
|
406
414
|
|
|
407
415
|
[data-fill] li:not(:last-child)::before {
|
|
408
|
-
|
|
409
|
-
bottom: calc(-1 * (var(--mt) + var(--m) / 2));
|
|
410
|
-
background: var(--rail);
|
|
416
|
+
background: var(--seg);
|
|
411
417
|
opacity: 1;
|
|
412
418
|
}
|
|
413
419
|
|
|
414
420
|
[data-fill].filling li:not(:last-child)::before {
|
|
415
|
-
background: var(--rail-faint);
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
/* The step into now waits in a faint accent rather than faint teal, so it reads orange before
|
|
419
|
-
the fill reaches it as well as after. */
|
|
420
|
-
[data-fill][data-order='newest-first'].filling li[data-state='current']:not(:last-child)::before,
|
|
421
|
-
[data-fill][data-order='oldest-first'].filling li:has(+ li[data-state='current'])::before {
|
|
422
|
-
background: color-mix(in oklab, var(--c-accent) 28%, transparent);
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
/* Drawn in full (no script, reduced motion): the step into now is still the accent. */
|
|
426
|
-
[data-fill][data-order='newest-first']:not(.filling) li[data-state='current']:not(:last-child)::before,
|
|
427
|
-
[data-fill][data-order='oldest-first']:not(.filling) li:has(+ li[data-state='current'])::before {
|
|
428
|
-
background: var(--c-accent);
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
[data-fill].filling::after {
|
|
432
|
-
content: '';
|
|
433
|
-
position: absolute;
|
|
434
|
-
inset-inline-start: calc(var(--col) / 2 - 1px);
|
|
435
|
-
top: var(--fill-top, 0px);
|
|
436
|
-
width: 2px;
|
|
437
|
-
height: var(--fill-h, 0px);
|
|
438
|
-
border-radius: 1px;
|
|
439
421
|
background: linear-gradient(to bottom,
|
|
440
|
-
var(--
|
|
441
|
-
var(--
|
|
442
|
-
var(--rail) var(--lit-to, 0px));
|
|
422
|
+
var(--seg) 0 calc(var(--p, 0) * 100%),
|
|
423
|
+
var(--seg-faint) calc(var(--p, 0) * 100%));
|
|
443
424
|
}
|
|
444
425
|
|
|
445
426
|
[data-fill] .marker {
|
|
446
427
|
z-index: 1;
|
|
447
428
|
background: var(--rail);
|
|
448
|
-
|
|
449
|
-
color: var(--rail);
|
|
429
|
+
color: var(--c-bg);
|
|
450
430
|
transition:
|
|
451
431
|
background-color var(--motion-base) var(--ease-out),
|
|
452
432
|
color var(--motion-base) var(--ease-out);
|
|
@@ -456,28 +436,21 @@ const extras = await Promise.all(
|
|
|
456
436
|
background: color-mix(in oklab, var(--c-chart-2) 40%, var(--c-bg));
|
|
457
437
|
}
|
|
458
438
|
|
|
459
|
-
[data-fill] [data-state='current'] .marker,
|
|
460
|
-
[data-fill] [data-state='next'] .marker {
|
|
461
|
-
box-shadow: 0 0 0 4px var(--c-bg);
|
|
462
|
-
}
|
|
463
|
-
|
|
464
439
|
[data-fill] [data-state='current'] .marker {
|
|
465
440
|
background: var(--c-accent);
|
|
441
|
+
color: var(--c-on-accent);
|
|
466
442
|
}
|
|
467
443
|
|
|
468
|
-
/* With icons:
|
|
469
|
-
|
|
470
|
-
to reach is fainter; now is the accent itself, with its halo. */
|
|
471
|
-
[data-fill][data-icons] .marker,
|
|
444
|
+
/* With icons: a disc the fill has reached is full teal; one it has yet to reach is a quiet tint;
|
|
445
|
+
now is the accent itself, with its halo. */
|
|
472
446
|
[data-fill][data-icons] [data-state] .marker {
|
|
473
|
-
background:
|
|
474
|
-
|
|
475
|
-
color: var(--rail);
|
|
447
|
+
background: var(--rail);
|
|
448
|
+
color: var(--c-bg);
|
|
476
449
|
}
|
|
477
450
|
|
|
478
451
|
[data-fill][data-icons].filling li:not(.reached) .marker {
|
|
479
|
-
background: color-mix(in oklab, var(--rail)
|
|
480
|
-
color: color-mix(in oklab, var(--c-chart-2)
|
|
452
|
+
background: color-mix(in oklab, var(--rail) 16%, var(--c-bg));
|
|
453
|
+
color: color-mix(in oklab, var(--c-chart-2) 60%, var(--c-bg));
|
|
481
454
|
}
|
|
482
455
|
|
|
483
456
|
[data-fill][data-icons] [data-state='current'] .marker,
|
|
@@ -487,6 +460,17 @@ const extras = await Promise.all(
|
|
|
487
460
|
box-shadow: 0 0 0 4px color-mix(in oklab, var(--c-accent) 28%, var(--c-bg));
|
|
488
461
|
}
|
|
489
462
|
|
|
463
|
+
/* Lighting up: the marker swells a little and settles, on the spring. */
|
|
464
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
465
|
+
[data-fill].filling li.reached .marker {
|
|
466
|
+
animation: marker-lit var(--motion-spring, 340ms) var(--ease-spring, ease-out);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
@keyframes marker-lit {
|
|
471
|
+
from { transform: scale(0.82); }
|
|
472
|
+
}
|
|
473
|
+
|
|
490
474
|
@media (max-width: 560px) {
|
|
491
475
|
[data-fill] {
|
|
492
476
|
--col: 18px;
|