@atelic-action/ui 0.6.1 → 0.7.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/README.md +4 -2
- package/package.json +1 -1
- package/src/email/index.ts +11 -0
- package/src/email/scoreboard.tsx +178 -25
- package/src/email/text.ts +61 -4
- package/src/tokens/palettes.ts +6 -0
package/README.md
CHANGED
|
@@ -162,6 +162,8 @@ Runner emails are mobile first. A layout that squashes on a phone is fixed here,
|
|
|
162
162
|
|
|
163
163
|
`RecordStack` takes `records`, each a `RecordStackItem` (`title`, `url`, `meta`, `note`, `badge`, `callout`), and renders one table row per record: the title on its own line at 15px, bold and wrapping freely, linked when `url` is set; a mono meta line beneath it with the items joined by middle dots (empty items drop); an optional note beneath that; a hairline between records and none after the last. No cell carries a width, so a name of any length wraps at 320 pixels instead of squashing. An optional `badge` (a stage word such as `"Contacted"`) sits on the title line in a small mono uppercase pill on a `line` hairline, in its own right aligned unbroken cell, so the title keeps wrapping beside it and the badge stays on the title's first line. An optional `callout` (`{ eyebrow, text }`) sets a short task under the meta and the note in the accented `Note` idiom: the eyebrow in the accent, the text at 13px, and a 2px accent rule down its left edge. A record with neither renders exactly as it did before. `recordStackText(records)` is its plain text twin: each title on its own line under a two space indent with any badge after it in square brackets (`Blue Heron Plumbing [Contacted]`), the meta and the note wrapped under a four space indent, any callout as its eyebrow in upper case over its text under that same indent, a blank line between records, and no line past `textWidth` (68 columns, indent included).
|
|
164
164
|
|
|
165
|
+
The Company Cards additions (0.7.0, from the `Company Cards IA` design, 2026-09-29) ride on the same item and change nothing for a record without them. `badges` is a list of further pills after `badge`, each with a `tone`: `faint` is the quiet stage word, `ink` a bold pill in ink on a 1.5px border (the next touch), `accent` the same in the accent (New). `timeline` (`{ days, touches, opens }`, each day count back from today) draws the record's recent days between the title and the meta line as one table cell per day, an 8px ink square on each send day and a 5px accent dot on each known open day, the two stacked when they share a day, all standing on a `line` hairline with a 1.5px ink tick at today's edge; nothing is positioned, so it survives Gmail. `RecordTimelineStrip` renders one on its own and `RecordTimelineLegend` names the marks once above a list. `aside` (`{ text, strong, tone }`) sets a fact right on the meta line with its number in bold and colored by tone: `up` fresh, `warm` cooling, `accent` cold. In the text twin every pill follows the title in brackets, the timeline is one character per day (`10d [#······@·o|]`: `#` a send, `o` an open, `@` both, `·` nothing, `|` today), and the aside ends the meta line; `recordTimelineText` and `recordBadges` are the helpers it uses.
|
|
166
|
+
|
|
165
167
|
`StatStrip` lays its stats out as inline block cells with an 88 pixel floor inside one centered cell, so six or seven stats flow onto a second row on a phone rather than shrinking. Each stat takes an optional `delta` (`"+3 (12%)"`), set small under its label and colored by its sign: one that opens on `+` wears the palette's `up`, one that opens on `-` its `down`, and anything else stays muted.
|
|
166
168
|
|
|
167
169
|
`Masthead` takes an optional `meta` (`"Week 39 · 09/21 to 09/27"`) set in the eyebrow style at the right end of the row, so the title card no longer carries the week. It is a right aligned, unbroken block floated after the wordmark and title: on the same line while the row has room, and dropped under the title on its own line, still right aligned, when it does not (checked at 320 pixels). `Eyebrow` takes `strong`, which sets the label at 15px and weight 700 in ink rather than faint, with a slightly tighter tracking, so a section such as `MQL · 15` reads as a heading on a phone.
|
|
@@ -227,7 +229,7 @@ Where the jq takes a pre rendered html string (`$rows`, `$body_html`, `$cells_ht
|
|
|
227
229
|
| `badge` | `Badge` | `letter` |
|
|
228
230
|
| `day_strip` | `DayStrip` | `days`, `last` |
|
|
229
231
|
| `stat_strip` | `StatStrip` | `stats`, each with an optional `delta` colored by its sign (the component wraps where the jq does not) |
|
|
230
|
-
| none | `RecordStack` | `records`, each with an optional `badge` and `
|
|
232
|
+
| none | `RecordStack` | `records`, each with an optional `badge`, `callout`, and since 0.7.0 `badges`, `timeline` and `aside` (born here on 2026-09-24, with no jq counterpart) |
|
|
231
233
|
| `records` | `Records` | `columns`, `rows`; a cell's `html` is a `ReactNode` |
|
|
232
234
|
| `masthead` | `Masthead` | `title`, `wordmark` (defaults to `atelic`), `meta` (added 0.5.0, no jq counterpart) |
|
|
233
235
|
| `title_card` | `TitleCard` | `eyebrowText`, `headlineLines`, `lede`, `stats` (the rows under the lede, in place of the jq's `$stats_html`) |
|
|
@@ -243,7 +245,7 @@ The plain text alternative part ports as plain functions with no React anywhere
|
|
|
243
245
|
|
|
244
246
|
`@atelic-action/ui/tokens` carries the palette and the font stacks with no React import, so a build script or a plain text renderer can read them. `toThemeCSS(palette)` writes the palette out as the site token declarations (`--surface`, `--surface-dark`, `--card`, `--ink`, `--primary`), and `themeTokenMap` exposes which palette key each token takes.
|
|
245
247
|
|
|
246
|
-
The palette carries
|
|
248
|
+
The palette carries three optional keys beyond the jq's eight: `up` (`#2F7A4B`, a calm green) and `down` (`#B23A2E`, a calm red, kept well apart from the orange accent), the colors a `StatStrip` delta wears by its sign, and `warm` (`#B7791F`, an amber between `up` and the accent) for a record's aside that is cooling but not cold. All three read on the cream card. They are optional so a client palette written before 0.5.0 still compiles, and a palette without them borrows the Atelic values. None maps to a site token.
|
|
247
249
|
|
|
248
250
|
## Releasing
|
|
249
251
|
|
package/package.json
CHANGED
package/src/email/index.ts
CHANGED
|
@@ -62,6 +62,10 @@ export {
|
|
|
62
62
|
type RecordsCell,
|
|
63
63
|
type RecordsColumn,
|
|
64
64
|
type RecordsProps,
|
|
65
|
+
RecordTimelineLegend,
|
|
66
|
+
type RecordTimelineLegendProps,
|
|
67
|
+
RecordTimelineStrip,
|
|
68
|
+
type RecordTimelineStripProps,
|
|
65
69
|
Scoreboard,
|
|
66
70
|
type ScoreboardProps,
|
|
67
71
|
StatStrip,
|
|
@@ -79,8 +83,15 @@ export {
|
|
|
79
83
|
asciiDowncase,
|
|
80
84
|
asciiUpcase,
|
|
81
85
|
lpad,
|
|
86
|
+
type RecordAside,
|
|
87
|
+
type RecordAsideTone,
|
|
88
|
+
type RecordBadge,
|
|
89
|
+
type RecordBadgeTone,
|
|
82
90
|
type RecordStackItem,
|
|
91
|
+
type RecordTimeline,
|
|
92
|
+
recordBadges,
|
|
83
93
|
recordStackText,
|
|
94
|
+
recordTimelineText,
|
|
84
95
|
rpad,
|
|
85
96
|
spaces,
|
|
86
97
|
type TextTarget,
|
package/src/email/scoreboard.tsx
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { type CSSProperties, Fragment, type ReactNode } from "react";
|
|
2
2
|
import { atelicPalette, type Palette } from "../tokens";
|
|
3
|
-
import
|
|
3
|
+
import {
|
|
4
|
+
type RecordAsideTone,
|
|
5
|
+
type RecordBadgeTone,
|
|
6
|
+
type RecordStackItem,
|
|
7
|
+
type RecordTimeline,
|
|
8
|
+
recordBadges,
|
|
9
|
+
} from "./text";
|
|
4
10
|
import { eyebrowStyle, tableReset, useEmailTheme } from "./theme";
|
|
5
11
|
|
|
6
12
|
/*
|
|
@@ -410,14 +416,17 @@ export function StatStrip({ stats }: StatStripProps) {
|
|
|
410
416
|
);
|
|
411
417
|
}
|
|
412
418
|
|
|
413
|
-
type RecordBadgeProps = { text: string };
|
|
419
|
+
type RecordBadgeProps = { text: string; tone?: RecordBadgeTone };
|
|
414
420
|
|
|
415
421
|
/**
|
|
416
|
-
*
|
|
417
|
-
*
|
|
422
|
+
* The pill on a record's title line. Faint is the stage word as it always
|
|
423
|
+
* was, dim text in a hairline box; ink and accent are the Company Cards
|
|
424
|
+
* pills (2026-09-29), bold, drawn in their own color on a heavier border:
|
|
425
|
+
* the next touch in ink, New in the accent.
|
|
418
426
|
*/
|
|
419
|
-
function RecordBadge({ text }: RecordBadgeProps) {
|
|
427
|
+
function RecordBadge({ text, tone = "faint" }: RecordBadgeProps) {
|
|
420
428
|
const { palette, fonts } = useEmailTheme();
|
|
429
|
+
const color = tone === "ink" ? palette.ink : tone === "accent" ? palette.accent : palette.dim;
|
|
421
430
|
return (
|
|
422
431
|
<span
|
|
423
432
|
style={{
|
|
@@ -427,10 +436,11 @@ function RecordBadge({ text }: RecordBadgeProps) {
|
|
|
427
436
|
lineHeight: "14px",
|
|
428
437
|
letterSpacing: "0.08em",
|
|
429
438
|
textTransform: "uppercase",
|
|
439
|
+
fontWeight: tone === "faint" ? "normal" : "bold",
|
|
430
440
|
padding: "0 6px",
|
|
431
|
-
border: `1px solid ${palette.line}`,
|
|
441
|
+
border: tone === "faint" ? `1px solid ${palette.line}` : `1.5px solid ${color}`,
|
|
432
442
|
borderRadius: "3px",
|
|
433
|
-
color
|
|
443
|
+
color,
|
|
434
444
|
whiteSpace: "nowrap",
|
|
435
445
|
}}
|
|
436
446
|
>
|
|
@@ -440,13 +450,119 @@ function RecordBadge({ text }: RecordBadgeProps) {
|
|
|
440
450
|
}
|
|
441
451
|
|
|
442
452
|
export type { RecordStackItem };
|
|
453
|
+
|
|
454
|
+
/** The default for a palette written before `warm` existed: the cooling tone between `up` and the accent. */
|
|
455
|
+
const WARM = "#B7791F";
|
|
456
|
+
|
|
457
|
+
function asideColor(tone: RecordAsideTone | undefined, palette: Palette): string {
|
|
458
|
+
if (tone === "up") return palette.up ?? atelicPalette.up ?? palette.ink;
|
|
459
|
+
if (tone === "warm") return palette.warm ?? WARM;
|
|
460
|
+
if (tone === "accent") return palette.accent;
|
|
461
|
+
return palette.faint;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
export type RecordTimelineStripProps = { timeline: RecordTimeline };
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* A record's recent days on one line, today at the right edge: an ink square
|
|
468
|
+
* on each day a send went out, an accent dot on each day an open is known,
|
|
469
|
+
* the two stacked when they share a day, all standing on a hairline with a
|
|
470
|
+
* tick for today. One table cell per day and nothing positioned, so it
|
|
471
|
+
* survives every mail client (Company Cards IA, 2026-09-29).
|
|
472
|
+
*/
|
|
473
|
+
export function RecordTimelineStrip({ timeline }: RecordTimelineStripProps) {
|
|
474
|
+
const { palette } = useEmailTheme();
|
|
475
|
+
const days = Math.max(1, Math.round(timeline.days));
|
|
476
|
+
const touch = new Set(timeline.touches.map((d) => Math.round(d)));
|
|
477
|
+
const open = new Set(timeline.opens.map((d) => Math.round(d)));
|
|
478
|
+
const cells = Array.from({ length: days }, (_, i) => days - 1 - i);
|
|
479
|
+
return (
|
|
480
|
+
<table {...tableReset} width="100%" style={{ marginTop: "8px" }}>
|
|
481
|
+
<tbody>
|
|
482
|
+
<tr>
|
|
483
|
+
{cells.map((ago) => {
|
|
484
|
+
const sent = touch.has(ago);
|
|
485
|
+
const opened = open.has(ago);
|
|
486
|
+
return (
|
|
487
|
+
<td
|
|
488
|
+
key={ago}
|
|
489
|
+
width={`${100 / days}%`}
|
|
490
|
+
style={{
|
|
491
|
+
height: "16px",
|
|
492
|
+
verticalAlign: "bottom",
|
|
493
|
+
textAlign: "center",
|
|
494
|
+
borderBottom: `1px solid ${palette.line}`,
|
|
495
|
+
...(ago === 0 ? { borderRight: `1.5px solid ${palette.ink}` } : {}),
|
|
496
|
+
}}
|
|
497
|
+
>
|
|
498
|
+
{sent ? (
|
|
499
|
+
<div
|
|
500
|
+
style={{
|
|
501
|
+
width: "8px",
|
|
502
|
+
height: "8px",
|
|
503
|
+
margin: "0 auto",
|
|
504
|
+
background: palette.ink,
|
|
505
|
+
}}
|
|
506
|
+
/>
|
|
507
|
+
) : null}
|
|
508
|
+
{opened ? (
|
|
509
|
+
<div
|
|
510
|
+
style={{
|
|
511
|
+
width: "5px",
|
|
512
|
+
height: "5px",
|
|
513
|
+
margin: `${sent ? "2px" : "0"} auto 0`,
|
|
514
|
+
borderRadius: "50%",
|
|
515
|
+
background: palette.accent,
|
|
516
|
+
}}
|
|
517
|
+
/>
|
|
518
|
+
) : null}
|
|
519
|
+
{sent || opened ? null : (
|
|
520
|
+
<div style={{ height: "1px", fontSize: "1px", lineHeight: "1px" }}> </div>
|
|
521
|
+
)}
|
|
522
|
+
</td>
|
|
523
|
+
);
|
|
524
|
+
})}
|
|
525
|
+
</tr>
|
|
526
|
+
</tbody>
|
|
527
|
+
</table>
|
|
528
|
+
);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
export type RecordTimelineLegendProps = { days: number };
|
|
532
|
+
|
|
533
|
+
/** What the marks on a timeline are, once above a list of records: the square, the dot, and the span. */
|
|
534
|
+
export function RecordTimelineLegend({ days }: RecordTimelineLegendProps) {
|
|
535
|
+
const { palette, fonts } = useEmailTheme();
|
|
536
|
+
const mark = (style: CSSProperties) => (
|
|
537
|
+
<span
|
|
538
|
+
style={{ display: "inline-block", verticalAlign: "middle", marginRight: "5px", ...style }}
|
|
539
|
+
/>
|
|
540
|
+
);
|
|
541
|
+
return (
|
|
542
|
+
<div
|
|
543
|
+
style={{ fontFamily: fonts.mono, fontSize: "11px", lineHeight: "16px", color: palette.faint }}
|
|
544
|
+
>
|
|
545
|
+
{mark({ width: "8px", height: "8px", background: palette.ink })}
|
|
546
|
+
touch
|
|
547
|
+
<span style={{ display: "inline-block", width: "14px" }} />
|
|
548
|
+
{mark({ width: "5px", height: "5px", borderRadius: "50%", background: palette.accent })}
|
|
549
|
+
open
|
|
550
|
+
<span style={{ display: "inline-block", width: "14px" }} />
|
|
551
|
+
{`${days} days to today`}
|
|
552
|
+
</div>
|
|
553
|
+
);
|
|
554
|
+
}
|
|
555
|
+
|
|
443
556
|
export type RecordStackProps = { records: RecordStackItem[] };
|
|
444
557
|
|
|
445
558
|
/**
|
|
446
|
-
* One record per row, stacked: the title on its own line
|
|
447
|
-
*
|
|
448
|
-
*
|
|
449
|
-
* column
|
|
559
|
+
* One record per row, stacked: the title on its own line with its pills
|
|
560
|
+
* beside it, an optional timeline, a mono meta line with an optional aside
|
|
561
|
+
* set right, an optional note under that, an optional callout last. No
|
|
562
|
+
* column cells and no fixed widths, so a name of any length wraps instead of
|
|
563
|
+
* squashing on a phone. A fixed column table is for numbers alone; names go
|
|
564
|
+
* here. The pills, the timeline and the aside are the Company Cards IA
|
|
565
|
+
* (2026-09-29); a record without them renders as it always did.
|
|
450
566
|
*/
|
|
451
567
|
export function RecordStack({ records }: RecordStackProps) {
|
|
452
568
|
const { palette, fonts } = useEmailTheme();
|
|
@@ -457,12 +573,19 @@ export function RecordStack({ records }: RecordStackProps) {
|
|
|
457
573
|
color: palette.ink,
|
|
458
574
|
wordBreak: "break-word",
|
|
459
575
|
};
|
|
576
|
+
const metaStyle: CSSProperties = {
|
|
577
|
+
fontFamily: fonts.mono,
|
|
578
|
+
fontSize: "12px",
|
|
579
|
+
lineHeight: "1.5",
|
|
580
|
+
color: palette.faint,
|
|
581
|
+
};
|
|
460
582
|
return (
|
|
461
583
|
<table {...tableReset} width="100%" style={{ fontFamily: fonts.sans, color: palette.ink }}>
|
|
462
584
|
<tbody>
|
|
463
585
|
{records.map((record, i) => {
|
|
464
586
|
const last = i === records.length - 1;
|
|
465
587
|
const meta = record.meta.filter((m) => m !== "");
|
|
588
|
+
const badges = recordBadges(record);
|
|
466
589
|
const title = record.url ? (
|
|
467
590
|
<a
|
|
468
591
|
href={record.url}
|
|
@@ -477,6 +600,19 @@ export function RecordStack({ records }: RecordStackProps) {
|
|
|
477
600
|
) : (
|
|
478
601
|
record.title
|
|
479
602
|
);
|
|
603
|
+
const aside = record.aside ? (
|
|
604
|
+
<>
|
|
605
|
+
{record.aside.text}
|
|
606
|
+
{record.aside.strong ? (
|
|
607
|
+
<>
|
|
608
|
+
{" "}
|
|
609
|
+
<b style={{ color: asideColor(record.aside.tone, palette) }}>
|
|
610
|
+
{record.aside.strong}
|
|
611
|
+
</b>
|
|
612
|
+
</>
|
|
613
|
+
) : null}
|
|
614
|
+
</>
|
|
615
|
+
) : null;
|
|
480
616
|
return (
|
|
481
617
|
// biome-ignore lint/suspicious/noArrayIndexKey: a record's position is its identity
|
|
482
618
|
<tr key={i}>
|
|
@@ -487,7 +623,7 @@ export function RecordStack({ records }: RecordStackProps) {
|
|
|
487
623
|
...(last ? {} : { borderBottom: `1px solid ${palette.line}` }),
|
|
488
624
|
}}
|
|
489
625
|
>
|
|
490
|
-
{
|
|
626
|
+
{badges.length > 0 ? (
|
|
491
627
|
<table {...tableReset} width="100%">
|
|
492
628
|
<tbody>
|
|
493
629
|
<tr>
|
|
@@ -502,7 +638,12 @@ export function RecordStack({ records }: RecordStackProps) {
|
|
|
502
638
|
paddingTop: "2px",
|
|
503
639
|
}}
|
|
504
640
|
>
|
|
505
|
-
|
|
641
|
+
{badges.map((badge, j) => (
|
|
642
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: a pill's position is its identity
|
|
643
|
+
<span key={j} style={{ marginLeft: j === 0 ? "0" : "4px" }}>
|
|
644
|
+
<RecordBadge text={badge.text} tone={badge.tone} />
|
|
645
|
+
</span>
|
|
646
|
+
))}
|
|
506
647
|
</td>
|
|
507
648
|
</tr>
|
|
508
649
|
</tbody>
|
|
@@ -510,18 +651,30 @@ export function RecordStack({ records }: RecordStackProps) {
|
|
|
510
651
|
) : (
|
|
511
652
|
<div style={titleStyle}>{title}</div>
|
|
512
653
|
)}
|
|
513
|
-
{
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
654
|
+
{record.timeline ? <RecordTimelineStrip timeline={record.timeline} /> : null}
|
|
655
|
+
{meta.length > 0 || aside ? (
|
|
656
|
+
aside ? (
|
|
657
|
+
<table {...tableReset} width="100%" style={{ marginTop: "4px" }}>
|
|
658
|
+
<tbody>
|
|
659
|
+
<tr>
|
|
660
|
+
<td style={metaStyle}>{meta.join(" · ")}</td>
|
|
661
|
+
<td
|
|
662
|
+
align="right"
|
|
663
|
+
style={{
|
|
664
|
+
...metaStyle,
|
|
665
|
+
textAlign: "right",
|
|
666
|
+
whiteSpace: "nowrap",
|
|
667
|
+
paddingLeft: "12px",
|
|
668
|
+
}}
|
|
669
|
+
>
|
|
670
|
+
{aside}
|
|
671
|
+
</td>
|
|
672
|
+
</tr>
|
|
673
|
+
</tbody>
|
|
674
|
+
</table>
|
|
675
|
+
) : (
|
|
676
|
+
<div style={{ ...metaStyle, marginTop: "4px" }}>{meta.join(" · ")}</div>
|
|
677
|
+
)
|
|
525
678
|
) : null}
|
|
526
679
|
{record.note ? (
|
|
527
680
|
<div
|
package/src/email/text.ts
CHANGED
|
@@ -124,6 +124,28 @@ export function textTable(cols: string[], rows: string[][], right: number[]): st
|
|
|
124
124
|
return textTableGrid(cols, rows, right, null);
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
/** A pill on a record's title line: faint is the quiet stage word, ink and accent are the Company Cards tones. */
|
|
128
|
+
export type RecordBadgeTone = "faint" | "ink" | "accent";
|
|
129
|
+
export type RecordBadge = { text: string; tone?: RecordBadgeTone };
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* A record's last `days` days on one line, today at the right edge: each
|
|
133
|
+
* send as a day count back from today, and each known open the same way.
|
|
134
|
+
* The html draws squares and dots on a baseline; the text twin draws one
|
|
135
|
+
* character per day.
|
|
136
|
+
*/
|
|
137
|
+
export type RecordTimeline = {
|
|
138
|
+
days: number;
|
|
139
|
+
touches: number[];
|
|
140
|
+
opens: number[];
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
/** The color a record's aside number wears: `up` is fresh, `warm` is cooling, `accent` is cold. */
|
|
144
|
+
export type RecordAsideTone = "up" | "warm" | "accent";
|
|
145
|
+
|
|
146
|
+
/** A fact set right on the meta line, its number in a tone: "opened" and "6d". */
|
|
147
|
+
export type RecordAside = { text: string; strong?: string; tone?: RecordAsideTone };
|
|
148
|
+
|
|
127
149
|
/**
|
|
128
150
|
* One record in a stack: what `RecordStack` renders and `recordStackText`
|
|
129
151
|
* writes. It lives here, with no React, so a plain text renderer can import it.
|
|
@@ -137,14 +159,44 @@ export type RecordStackItem = {
|
|
|
137
159
|
note?: string;
|
|
138
160
|
/** A stage word on the title line, right aligned in a pill; "[Contacted]" in the text twin. */
|
|
139
161
|
badge?: string;
|
|
162
|
+
/** More pills after `badge`, each in its tone: New in the accent, the next touch in ink, Wait faint (Company Cards, 2026-09-29). */
|
|
163
|
+
badges?: RecordBadge[];
|
|
164
|
+
/** The record's recent days, drawn between the title and the meta line. */
|
|
165
|
+
timeline?: RecordTimeline;
|
|
166
|
+
/** A fact set right on the meta line, its number colored by its tone. */
|
|
167
|
+
aside?: RecordAside;
|
|
140
168
|
/** A short task under the record, an orange eyebrow over a line of text. */
|
|
141
169
|
callout?: { eyebrow: string; text: string };
|
|
142
170
|
};
|
|
143
171
|
|
|
172
|
+
/** Every pill on a record's title line, the quiet stage word first. */
|
|
173
|
+
export function recordBadges(record: RecordStackItem): RecordBadge[] {
|
|
174
|
+
const badges: RecordBadge[] = record.badge ? [{ text: record.badge, tone: "faint" }] : [];
|
|
175
|
+
return [...badges, ...(record.badges ?? [])];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* The timeline as one character per day, oldest on the left and today on the
|
|
180
|
+
* right: `#` a send, `o` an open, `@` both on one day, `·` nothing, then `|`
|
|
181
|
+
* for today's edge. "30d [#····o··@···|]" reads the same way the drawn one does.
|
|
182
|
+
*/
|
|
183
|
+
export function recordTimelineText(timeline: RecordTimeline): string {
|
|
184
|
+
const days = Math.max(1, Math.round(timeline.days));
|
|
185
|
+
const touch = new Set(timeline.touches.map((d) => Math.round(d)));
|
|
186
|
+
const open = new Set(timeline.opens.map((d) => Math.round(d)));
|
|
187
|
+
let strip = "";
|
|
188
|
+
for (let ago = days - 1; ago >= 0; ago -= 1) {
|
|
189
|
+
strip +=
|
|
190
|
+
touch.has(ago) && open.has(ago) ? "@" : touch.has(ago) ? "#" : open.has(ago) ? "o" : "·";
|
|
191
|
+
}
|
|
192
|
+
return `${days}d [${strip}|]`;
|
|
193
|
+
}
|
|
194
|
+
|
|
144
195
|
/**
|
|
145
196
|
* The plain text twin of `RecordStack`: each title on its own line under a
|
|
146
|
-
* two space indent with
|
|
147
|
-
*
|
|
197
|
+
* two space indent with every badge after it in square brackets, the
|
|
198
|
+
* timeline as a character strip, the meta joined by middle dots with the
|
|
199
|
+
* aside at its end and the note beneath it, all wrapped under a four space
|
|
148
200
|
* indent, then any callout as its eyebrow in upper case over its text under
|
|
149
201
|
* the same indent, a blank line between records. No line runs past
|
|
150
202
|
* `textWidth`.
|
|
@@ -152,9 +204,14 @@ export type RecordStackItem = {
|
|
|
152
204
|
export function recordStackText(records: RecordStackItem[]): string {
|
|
153
205
|
return records
|
|
154
206
|
.map((record) => {
|
|
155
|
-
const
|
|
156
|
-
|
|
207
|
+
const badges = recordBadges(record)
|
|
208
|
+
.map((b) => ` [${b.text}]`)
|
|
209
|
+
.join("");
|
|
210
|
+
const lines = [wrapIndented(`${record.title}${badges}`, 2)];
|
|
211
|
+
if (record.timeline) lines.push(wrapIndented(recordTimelineText(record.timeline), 4));
|
|
157
212
|
const meta = record.meta.filter((m) => m !== "");
|
|
213
|
+
if (record.aside)
|
|
214
|
+
meta.push([record.aside.text, record.aside.strong ?? ""].filter((x) => x !== "").join(" "));
|
|
158
215
|
if (meta.length > 0) lines.push(wrapIndented(meta.join(" · "), 4));
|
|
159
216
|
if (record.note) lines.push(wrapIndented(record.note, 4));
|
|
160
217
|
if (record.callout) {
|
package/src/tokens/palettes.ts
CHANGED
|
@@ -32,6 +32,11 @@ export type Palette = {
|
|
|
32
32
|
up?: string;
|
|
33
33
|
/** A change for the worse, the negative delta's color. Optional the same way. */
|
|
34
34
|
down?: string;
|
|
35
|
+
/**
|
|
36
|
+
* The cooling tone between `up` and the accent: a record opened inside two
|
|
37
|
+
* weeks but not one (Company Cards, 0.7.0). Optional the same way.
|
|
38
|
+
*/
|
|
39
|
+
warm?: string;
|
|
35
40
|
};
|
|
36
41
|
|
|
37
42
|
export const atelicPalette: Palette = {
|
|
@@ -45,6 +50,7 @@ export const atelicPalette: Palette = {
|
|
|
45
50
|
hair: "#F0EAE0",
|
|
46
51
|
up: "#2F7A4B",
|
|
47
52
|
down: "#B23A2E",
|
|
53
|
+
warm: "#B7791F",
|
|
48
54
|
};
|
|
49
55
|
|
|
50
56
|
/**
|