mirror of
https://github.com/bitbaum/substrata.git
synced 2026-12-05 03:27:15 +01:00
* feat(chartkit): the fleet's chart package @bitbaum/chartkit 0.1.0 in packages/chartkit, a standalone package the fleet creates a repo from (registers/package-repos.json). Seven charts — LineChart, BarChart, ShareBars, Sparkline, Meter, Timeline, StatTiles — rendered on the server as SVG + HTML with text in rem, a visually hidden table behind each, colours only from --ck-* tokens, labels that truncate instead of clipping and events that take a second lane instead of overprinting. findChartDefects (@bitbaum/chartkit/audit) measures that in a real browser; test/browser.mjs runs it over the demo at 320, 390 and 1280 in light and dark, after proving it fails on a broken figure. Same conventions as chatkit: tsc to dist/ (committed), node --test for the arithmetic and the server render, Playwright for layout, one verify. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE * feat(series): draw the series chart with chartkit The hand-rolled line chart (components/series/SeriesChart.tsx, lib/series-chart.ts, ~130 lines of series.css) is replaced by @bitbaum/chartkit's LineChart and Sparkline, consumed by path (workspace:*) until the package has its own repo. SeriesChart.tsx is now only the join between a Series and the package's contract; the geometry test moved with the geometry. Chart tokens map to Substrata's ink, line and status colours next to the chatkit mapping. The app's lint and tsc stop at packages/, which verify themselves; root verify runs the package's, and CI installs Chromium for its browser audit and checks the committed dist against the source. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE --------- Co-authored-by: Claude <noreply@anthropic.com>
346 lines
7.8 KiB
CSS
346 lines
7.8 KiB
CSS
/* ── Data series: key numbers, charts, the index (components/series/) ── */
|
||
.series-keys {
|
||
border-top: 1px solid var(--color-border-subtle);
|
||
}
|
||
.series-keys > li {
|
||
border-bottom: 1px solid var(--color-border-subtle);
|
||
}
|
||
.series-key > summary {
|
||
display: grid;
|
||
grid-template-columns: minmax(0, 1fr);
|
||
gap: 0.35rem 1.5rem;
|
||
padding: 0.9rem 0;
|
||
cursor: pointer;
|
||
list-style: none;
|
||
}
|
||
.series-key > summary::-webkit-details-marker {
|
||
display: none;
|
||
}
|
||
.series-key > summary:focus-visible {
|
||
outline: 2px solid var(--color-accent);
|
||
outline-offset: 2px;
|
||
}
|
||
@media (min-width: 768px) {
|
||
.series-key > summary {
|
||
grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr);
|
||
align-items: baseline;
|
||
}
|
||
}
|
||
.series-key-metric {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 0.2rem;
|
||
color: var(--color-fg-primary);
|
||
font-weight: 500;
|
||
line-height: 1.35;
|
||
}
|
||
.series-key-kind {
|
||
font-family: var(--font-mono);
|
||
font-size: 0.7rem;
|
||
letter-spacing: var(--tracking-caps);
|
||
text-transform: uppercase;
|
||
color: var(--color-fg-tertiary);
|
||
font-weight: 400;
|
||
}
|
||
.series-key-kind a {
|
||
text-decoration: underline;
|
||
text-underline-offset: 3px;
|
||
}
|
||
.series-key-value {
|
||
font-size: 1.35rem;
|
||
font-weight: 600;
|
||
color: var(--color-fg-primary);
|
||
line-height: 1.2;
|
||
}
|
||
.series-unit {
|
||
font-size: 0.8rem;
|
||
font-weight: 400;
|
||
color: var(--color-fg-tertiary);
|
||
}
|
||
.series-key-date {
|
||
display: block;
|
||
font-family: var(--font-mono);
|
||
font-size: 0.72rem;
|
||
font-weight: 400;
|
||
color: var(--color-fg-muted);
|
||
margin-top: 0.15rem;
|
||
}
|
||
.series-key-trend {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
align-items: center;
|
||
gap: 0.25rem 0.75rem;
|
||
min-width: 0;
|
||
}
|
||
.series-key-body {
|
||
padding: 0 0 1.25rem;
|
||
}
|
||
.series-describes {
|
||
max-width: 65ch;
|
||
margin: 0 0 0.75rem;
|
||
padding: 0.4rem 0.9rem;
|
||
border-left: 2px solid var(--color-status-warning);
|
||
background: var(--color-surface-raised);
|
||
font-size: 0.8rem;
|
||
line-height: 1.55;
|
||
color: var(--color-fg-tertiary);
|
||
}
|
||
|
||
/* Change badge: ink carries the value; a hairline rule carries the direction. */
|
||
.series-change {
|
||
font-family: var(--font-mono);
|
||
font-size: 0.75rem;
|
||
color: var(--color-fg-secondary);
|
||
/* Wraps inside its column: with the shell's sidebar beside it, a 3-column
|
||
row at 834px left ~190px for "−6.8% vs Jul 2026 · tightens", and the
|
||
unwrapped badge pushed the page 96px sideways (nav contract rule 8). */
|
||
padding-left: 0.5rem;
|
||
border-left: 2px solid var(--color-border-strong);
|
||
}
|
||
.series-change-tightens {
|
||
border-left-color: var(--color-status-negative);
|
||
}
|
||
.series-change-loosens {
|
||
border-left-color: var(--color-status-positive);
|
||
}
|
||
.series-change-effect {
|
||
color: var(--color-fg-tertiary);
|
||
}
|
||
|
||
/* The chart is @bitbaum/chartkit; it is given room under the key row. */
|
||
.series-chart {
|
||
margin: 1rem 0 1.25rem;
|
||
}
|
||
|
||
/* Points table: the chart's table view and its provenance. */
|
||
.series-table-wrap {
|
||
overflow-x: auto;
|
||
}
|
||
.series-table {
|
||
width: 100%;
|
||
border-collapse: collapse;
|
||
font-size: 0.8rem;
|
||
}
|
||
.series-table th,
|
||
.series-table td {
|
||
padding: 0.5rem 0.75rem 0.5rem 0;
|
||
border-bottom: 1px solid var(--color-border-subtle);
|
||
text-align: left;
|
||
vertical-align: top;
|
||
}
|
||
.series-table thead th {
|
||
font-family: var(--font-mono);
|
||
font-size: 0.68rem;
|
||
font-weight: 400;
|
||
letter-spacing: var(--tracking-caps);
|
||
text-transform: uppercase;
|
||
color: var(--color-fg-tertiary);
|
||
}
|
||
.series-td-date {
|
||
white-space: nowrap;
|
||
font-weight: 400;
|
||
color: var(--color-fg-secondary);
|
||
}
|
||
.series-td-value {
|
||
white-space: nowrap;
|
||
color: var(--color-fg-primary);
|
||
font-variant-numeric: tabular-nums;
|
||
}
|
||
.series-td-source {
|
||
min-width: 14rem;
|
||
color: var(--color-fg-tertiary);
|
||
}
|
||
.series-td-source a {
|
||
color: var(--color-fg-secondary);
|
||
text-decoration: underline;
|
||
text-underline-offset: 3px;
|
||
}
|
||
.series-flag {
|
||
font-family: var(--font-mono);
|
||
font-size: 0.68rem;
|
||
color: var(--color-fg-muted);
|
||
}
|
||
.series-quote {
|
||
display: block;
|
||
margin-top: 0.25rem;
|
||
font-style: italic;
|
||
line-height: 1.5;
|
||
color: var(--color-fg-tertiary);
|
||
}
|
||
.series-note {
|
||
display: block;
|
||
margin-top: 0.2rem;
|
||
font-size: 0.72rem;
|
||
color: var(--color-fg-muted);
|
||
}
|
||
.series-more,
|
||
.series-links {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 1.25rem;
|
||
margin-top: 0.75rem;
|
||
font-size: 0.8rem;
|
||
}
|
||
.series-more a,
|
||
.series-links a,
|
||
.series-origin a {
|
||
color: var(--color-accent);
|
||
text-decoration: underline;
|
||
text-underline-offset: 3px;
|
||
}
|
||
.series-origin {
|
||
max-width: 65ch;
|
||
margin-top: 0.75rem;
|
||
font-size: 0.75rem;
|
||
line-height: 1.55;
|
||
color: var(--color-fg-muted);
|
||
}
|
||
.series-origin-tag {
|
||
font-family: var(--font-mono);
|
||
font-size: 0.68rem;
|
||
letter-spacing: var(--tracking-caps);
|
||
text-transform: uppercase;
|
||
color: var(--color-fg-secondary);
|
||
margin-right: 0.35rem;
|
||
}
|
||
|
||
/* Series page header */
|
||
.series-head {
|
||
margin-bottom: 1rem;
|
||
}
|
||
.series-head h1 {
|
||
margin: 0.5rem 0 0.75rem;
|
||
font-family: var(--font-heading);
|
||
font-size: 1.9rem;
|
||
font-weight: 600;
|
||
letter-spacing: var(--tracking-display);
|
||
line-height: 1.15;
|
||
color: var(--color-fg-primary);
|
||
}
|
||
|
||
/* Index: the shared filter bar (.desk-filters) above, then one line per series. */
|
||
.series-index {
|
||
border-top: 1px solid var(--color-border-subtle);
|
||
}
|
||
.series-row {
|
||
display: grid;
|
||
grid-template-columns: minmax(0, 1fr) auto;
|
||
gap: 0.4rem 1.25rem;
|
||
padding: 0.9rem 0;
|
||
border-bottom: 1px solid var(--color-border-subtle);
|
||
align-items: baseline;
|
||
}
|
||
.series-row-main {
|
||
grid-column: 1 / -1;
|
||
}
|
||
.series-row-title {
|
||
display: block;
|
||
margin-top: 0.2rem;
|
||
color: var(--color-fg-primary);
|
||
font-weight: 500;
|
||
}
|
||
.series-row-title:hover {
|
||
text-decoration: underline;
|
||
text-underline-offset: 3px;
|
||
}
|
||
.series-row-value {
|
||
font-size: 1.1rem;
|
||
font-weight: 600;
|
||
color: var(--color-fg-primary);
|
||
}
|
||
.series-row-csv {
|
||
font-family: var(--font-mono);
|
||
font-size: 0.72rem;
|
||
color: var(--color-fg-tertiary);
|
||
text-decoration: underline;
|
||
text-underline-offset: 3px;
|
||
}
|
||
@media (min-width: 900px) {
|
||
.series-row {
|
||
grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.9fr) minmax(0, 1.1fr) auto;
|
||
}
|
||
.series-row-main {
|
||
grid-column: auto;
|
||
}
|
||
}
|
||
|
||
/* More series, collapsed under the first few. */
|
||
.series-rest > summary {
|
||
padding: 0.75rem 0;
|
||
font-size: 0.85rem;
|
||
color: var(--color-fg-secondary);
|
||
cursor: pointer;
|
||
}
|
||
|
||
/* Phones: each point is a block — period and value on one line, source below. */
|
||
@media (max-width: 639px) {
|
||
.series-table thead {
|
||
display: none;
|
||
}
|
||
.series-table tr {
|
||
display: grid;
|
||
grid-template-columns: auto 1fr;
|
||
gap: 0.2rem 0.75rem;
|
||
padding: 0.6rem 0;
|
||
border-bottom: 1px solid var(--color-border-subtle);
|
||
}
|
||
.series-table th,
|
||
.series-table td {
|
||
padding: 0;
|
||
border: 0;
|
||
}
|
||
.series-td-source {
|
||
grid-column: 1 / -1;
|
||
min-width: 0;
|
||
}
|
||
}
|
||
|
||
/* Claims: a sentence from the page, its verdict, and the numbers behind it. */
|
||
.series-claims {
|
||
margin: 0 0 1.5rem;
|
||
padding: 0.9rem 1rem;
|
||
border: 1px solid var(--color-border-subtle);
|
||
background: var(--color-surface-raised);
|
||
}
|
||
.series-claims > ul > li + li {
|
||
margin-top: 0.9rem;
|
||
padding-top: 0.9rem;
|
||
border-top: 1px solid var(--color-border-subtle);
|
||
}
|
||
.series-claim-text {
|
||
margin-top: 0.5rem;
|
||
font-size: 0.95rem;
|
||
color: var(--color-fg-primary);
|
||
}
|
||
.series-claim-verdict {
|
||
font-family: var(--font-mono);
|
||
font-size: 0.68rem;
|
||
letter-spacing: var(--tracking-caps);
|
||
text-transform: uppercase;
|
||
padding-left: 0.4rem;
|
||
border-left: 2px solid var(--color-status-positive);
|
||
color: var(--color-fg-tertiary);
|
||
}
|
||
.series-claim-softened {
|
||
border-left-color: var(--color-status-warning);
|
||
}
|
||
.series-claim-how {
|
||
margin-top: 0.3rem;
|
||
max-width: 70ch;
|
||
font-size: 0.8rem;
|
||
line-height: 1.55;
|
||
color: var(--color-fg-tertiary);
|
||
}
|
||
.series-claim-numbers {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 0.2rem;
|
||
margin-top: 0.4rem;
|
||
font-size: 0.8rem;
|
||
color: var(--color-fg-secondary);
|
||
}
|
||
.series-claim-numbers a {
|
||
text-decoration: underline;
|
||
text-underline-offset: 3px;
|
||
}
|