@n1kname/components 0.52.0 → 0.54.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/CaseTile.astro +7 -6
- package/src/DataTable.astro +23 -1
- package/src/Diamonds.astro +46 -0
- package/src/FlowDiagram.astro +14 -1
- package/src/ScreenStack.astro +6 -6
- package/src/icons.ts +3 -0
package/package.json
CHANGED
package/src/CaseTile.astro
CHANGED
|
@@ -45,7 +45,7 @@ interface Layer {
|
|
|
45
45
|
width: number;
|
|
46
46
|
/** How far it floats on hover: 0 stays put, 1 lifts the most. */
|
|
47
47
|
depth?: number;
|
|
48
|
-
/**
|
|
48
|
+
/** Drifts once, down and back, as it arrives, so a card cut out of a page floats above it. */
|
|
49
49
|
float?: boolean;
|
|
50
50
|
alt?: string;
|
|
51
51
|
/** A plain URL's own size in px, so the space is kept while it loads. An import knows its own. */
|
|
@@ -502,15 +502,16 @@ const labelledby = [`${uid}-title`, text && `${uid}-text`, overline && `${uid}-o
|
|
|
502
502
|
/* A floating layer bobs on its picture, not the layer, so it adds to the pointer, the hover lift
|
|
503
503
|
* and the arrival instead of replacing them. */
|
|
504
504
|
@media (prefers-reduced-motion: no-preference) {
|
|
505
|
-
.
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
505
|
+
/* A tile below the fold drifts when it arrives, not unseen at page load. */
|
|
506
|
+
.case-tile:is(:not(.armed), .in) .layer.float :global(img) {
|
|
507
|
+
/* One slow breath as the page arrives, then still; hover lifts it again. The drift scales
|
|
508
|
+
* with the panel, so a phone's small cover moves a few pixels, not a desktop's sixteen. */
|
|
509
|
+
animation: layer-float var(--motion-float, 6s) ease-in-out 1;
|
|
509
510
|
}
|
|
510
511
|
}
|
|
511
512
|
|
|
512
513
|
@keyframes layer-float {
|
|
513
514
|
0%, 100% { translate: 0 0; }
|
|
514
|
-
50% { translate: 0 var(--float-range,
|
|
515
|
+
50% { translate: 0 var(--float-range, 2.4cqw); }
|
|
515
516
|
}
|
|
516
517
|
</style>
|
package/src/DataTable.astro
CHANGED
|
@@ -80,7 +80,7 @@ const show = (c: Cell) => (c === null ? '–' : typeof c === 'number' ? num(c) :
|
|
|
80
80
|
const obj = c !== null && typeof c === 'object' ? c : null;
|
|
81
81
|
const sort = obj ? obj.sort : c;
|
|
82
82
|
return (
|
|
83
|
-
<td class:list={{ left: columns[i]?.align === 'left', wrap: columns[i]?.wrap }} data-sort={sort ?? undefined}>
|
|
83
|
+
<td class:list={{ left: columns[i]?.align === 'left', wrap: columns[i]?.wrap }} data-sort={sort ?? undefined} data-label={columns[i]?.label}>
|
|
84
84
|
{obj ? <Fragment set:html={obj.html} /> : show(c)}
|
|
85
85
|
</td>
|
|
86
86
|
);
|
|
@@ -392,6 +392,28 @@ const show = (c: Cell) => (c === null ? '–' : typeof c === 'number' ? num(c) :
|
|
|
392
392
|
.data-table-wrap.stacked .data-table tbody td.wrap {
|
|
393
393
|
min-width: 0;
|
|
394
394
|
}
|
|
395
|
+
|
|
396
|
+
/* A row of words (a wrapping cell after the first) stacks one cell to a line instead: the first
|
|
397
|
+
* cell as the card's heading, then each wrapping cell under its column's name, so a long last
|
|
398
|
+
* cell can't squeeze the first. A row of figures keeps the first cell beside the last. */
|
|
399
|
+
.data-table-wrap.stacked .data-table tbody tr:has(td.wrap:not(:first-child)) td:first-child {
|
|
400
|
+
flex-basis: 100%;
|
|
401
|
+
font-weight: 600;
|
|
402
|
+
color: var(--c-text);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.data-table-wrap.stacked .data-table tbody td.wrap:not(:first-child) {
|
|
406
|
+
order: 3;
|
|
407
|
+
flex: 1 1 100%;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.data-table-wrap.stacked .data-table tbody td.wrap:not(:first-child)[data-label]::before {
|
|
411
|
+
content: attr(data-label);
|
|
412
|
+
display: block;
|
|
413
|
+
margin-bottom: 2px;
|
|
414
|
+
font-size: var(--text-caption);
|
|
415
|
+
color: var(--c-text-muted);
|
|
416
|
+
}
|
|
395
417
|
|
|
396
418
|
.data-table-wrap.stacked .data-table tbody td:empty {
|
|
397
419
|
display: none;
|
package/src/Diamonds.astro
CHANGED
|
@@ -462,6 +462,52 @@ const columns = items.map((it) => (it.kind === 'moment' ? 'minmax(4.5rem, auto)'
|
|
|
462
462
|
justify-self: center;
|
|
463
463
|
}
|
|
464
464
|
|
|
465
|
+
/* The flow, top to bottom: a line comes into each moment from the phase above, and an arrow
|
|
466
|
+
* leaves it into the phase below, so the stack still reads as one process. */
|
|
467
|
+
.row > .moment {
|
|
468
|
+
position: relative;
|
|
469
|
+
padding-block: var(--sp-5) var(--sp-6);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
.row > .moment:first-child {
|
|
473
|
+
padding-top: 0;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.row > .moment:not(:first-child)::before {
|
|
477
|
+
content: '';
|
|
478
|
+
position: absolute;
|
|
479
|
+
top: 0;
|
|
480
|
+
left: calc(50% - 0.75px);
|
|
481
|
+
width: 1.5px;
|
|
482
|
+
height: var(--sp-4);
|
|
483
|
+
background: var(--c-diagram-line);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
.row > .moment::after {
|
|
487
|
+
content: '';
|
|
488
|
+
position: absolute;
|
|
489
|
+
bottom: var(--sp-1);
|
|
490
|
+
left: 50%;
|
|
491
|
+
width: 1.5px;
|
|
492
|
+
height: var(--sp-4);
|
|
493
|
+
background: var(--c-diagram-line);
|
|
494
|
+
translate: -50% 0;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
.row > .moment .stop-cell {
|
|
498
|
+
position: relative;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/* The arrowhead at the foot of the line out. */
|
|
502
|
+
.row > .moment .stop-cell::after {
|
|
503
|
+
display: block;
|
|
504
|
+
top: auto;
|
|
505
|
+
right: auto;
|
|
506
|
+
bottom: calc(-1 * var(--sp-6) + var(--sp-1));
|
|
507
|
+
left: 50%;
|
|
508
|
+
translate: -50% 0;
|
|
509
|
+
rotate: 135deg;
|
|
510
|
+
}
|
|
465
511
|
}
|
|
466
512
|
|
|
467
513
|
@media (prefers-reduced-motion: no-preference) {
|
package/src/FlowDiagram.astro
CHANGED
|
@@ -66,6 +66,7 @@ interface Props {
|
|
|
66
66
|
rings?: Ring[];
|
|
67
67
|
/** A short legend in the corner: lines of text, the first one bold. */
|
|
68
68
|
note?: { x: number; y: number; lines: { text: string; tone?: Tone }[] };
|
|
69
|
+
/** The caption as text. For a caption with a link in it, use the `caption` slot instead. */
|
|
69
70
|
caption?: string;
|
|
70
71
|
/**
|
|
71
72
|
* Narrowest the drawing reads well at. Narrower, it still fits the width, smaller, and an
|
|
@@ -103,6 +104,12 @@ const size = (n: Node) => {
|
|
|
103
104
|
const anchor = (n: Node, side: Side, shift = 0): [number, number] => {
|
|
104
105
|
const { w, h } = size(n);
|
|
105
106
|
if (side === 'top') return [n.x + shift, n.y - h / 2];
|
|
107
|
+
// An icon node carries its name and line under the disc, so an edge out of its bottom starts
|
|
108
|
+
// below that text instead of running through it.
|
|
109
|
+
if (side === 'bottom' && n.shape === 'icon') {
|
|
110
|
+
const lines = n.sub ? n.sub.split('\n').length : 0;
|
|
111
|
+
return [n.x + shift, n.y + h / 2 + (lines ? 44 + (lines - 1) * 18 : 24) + 12];
|
|
112
|
+
}
|
|
106
113
|
if (side === 'bottom') return [n.x + shift, n.y + h / 2];
|
|
107
114
|
if (side === 'left') return [n.x - w / 2, n.y + shift];
|
|
108
115
|
return [n.x + w / 2, n.y + shift];
|
|
@@ -301,7 +308,13 @@ const lines = (label: string) => {
|
|
|
301
308
|
{kind === 'wide' && <DiagramZoom title={title} min={minWidth} id={uid} />}
|
|
302
309
|
</div>
|
|
303
310
|
))}
|
|
304
|
-
{
|
|
311
|
+
{
|
|
312
|
+
Astro.slots.has('caption') ? (
|
|
313
|
+
<figcaption><slot name="caption" /></figcaption>
|
|
314
|
+
) : (
|
|
315
|
+
caption && <figcaption>{caption}</figcaption>
|
|
316
|
+
)
|
|
317
|
+
}
|
|
305
318
|
</figure>
|
|
306
319
|
|
|
307
320
|
<script>
|
package/src/ScreenStack.astro
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* Motion, all of it off under reduced motion:
|
|
10
10
|
* - The screens play in once, front first, rising a little as they fade in; layers play in back
|
|
11
11
|
* to front. This is the page's entrance: no picture morphs in from the page before.
|
|
12
|
-
* - A layer with `float`
|
|
12
|
+
* - A layer with `float` drifts once, down and back, as it arrives; hover lifts it again.
|
|
13
13
|
* - `size="cover"`: under a real pointer, the screens follow it a few pixels, the front one most,
|
|
14
14
|
* so the stack reads as layers. Leaves no listener behind when there is no fine pointer.
|
|
15
15
|
* - `size="card"`: when the link around it is hovered or focused (a LinkCard), the screens fan
|
|
@@ -45,7 +45,7 @@ interface Layer {
|
|
|
45
45
|
width: number;
|
|
46
46
|
/** 0 stays put; 1 follows the pointer and lifts the most. */
|
|
47
47
|
depth?: number;
|
|
48
|
-
/**
|
|
48
|
+
/** Drifts once, down and back, as it arrives, so a card cut out of a page floats above it. */
|
|
49
49
|
float?: boolean;
|
|
50
50
|
alt?: string;
|
|
51
51
|
/** A plain URL's own size in px, so the space is kept while it loads. An import knows its own. */
|
|
@@ -433,14 +433,14 @@ const fit = (img: ImageMetadata) => [...new Set(widths.filter((w) => w <= img.wi
|
|
|
433
433
|
* and the arrival instead of replacing them. */
|
|
434
434
|
@media (prefers-reduced-motion: no-preference) {
|
|
435
435
|
.layer.float :global(img) {
|
|
436
|
-
/*
|
|
437
|
-
*
|
|
438
|
-
animation: layer-float var(--motion-float, 6s) ease-in-out
|
|
436
|
+
/* One slow breath as the page arrives, then still; hover lifts it again. The drift scales
|
|
437
|
+
* with the panel, so a phone's small cover moves a few pixels, not a desktop's sixteen. */
|
|
438
|
+
animation: layer-float var(--motion-float, 6s) ease-in-out 1;
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
|
|
442
442
|
@keyframes layer-float {
|
|
443
443
|
0%, 100% { translate: 0 0; }
|
|
444
|
-
50% { translate: 0 var(--float-range,
|
|
444
|
+
50% { translate: 0 var(--float-range, 1.3cqw); }
|
|
445
445
|
}
|
|
446
446
|
</style>
|
package/src/icons.ts
CHANGED
|
@@ -82,6 +82,9 @@ export const ICONS = {
|
|
|
82
82
|
'<path d="M12 2v20"/><path d="M2 5h20"/><path d="M3 3v2"/><path d="M7 3v2"/><path d="M17 3v2"/><path d="M21 3v2"/><path d="m19 5-7 7-7-7"/>',
|
|
83
83
|
'house-plug':
|
|
84
84
|
'<path d="M10 12V8.964"/><path d="M14 12V8.964"/><path d="M15 12a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2v-2a1 1 0 0 1 1-1z"/><path d="M8.5 21H5a2 2 0 0 1-2-2v-9a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2h-5a2 2 0 0 1-2-2v-2"/>',
|
|
85
|
+
// A plug with a spark: charging as a service, for a stop about charging rather than hardware.
|
|
86
|
+
'plug-zap':
|
|
87
|
+
'<path d="M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z"/><path d="m2 22 3-3"/><path d="M7.5 13.5 10 11"/><path d="M10.5 16.5 13 14"/><path d="m18 3-4 4h6l-4 4"/>',
|
|
85
88
|
// A charge point, the hardware: a stop on a journey that was about building chargers.
|
|
86
89
|
'ev-charger':
|
|
87
90
|
'<path d="M14 13h2a2 2 0 0 1 2 2v2a2 2 0 0 0 4 0v-6.998a2 2 0 0 0-.59-1.42L18 5"/><path d="M14 21V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v16"/><path d="M2 21h13"/><path d="M3 7h11"/><path d="m9 11-2 3h3l-2 3"/>',
|