diff --git a/AGENTS.md b/AGENTS.md index a7f56d7..50e34fd 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -71,6 +71,7 @@ Drop the workbook in `data/` named like `Physioshark_Shark Log 2026-2027.xlsx` ( ## Charts & design - Follow the dataviz method: categorical slots in fixed order (`--series-1…8`, validated light and dark), sequential = one hue (`--seq-*`), diverging = blue ↔ red with a neutral midpoint, one y-axis only (never dual axes), legends for ≥ 2 series, text in ink tokens (never the series colour), 4 px rounded bar ends, 2 px lines, hover tooltips, data tables via `ChartCard table`. +- Every chart registers its data with the enclosing `ChartCard` (`registerCsv` in `charts/csv.ts`), which shows **Download CSV**. A new chart component must call `registerCsv` too. An explicit `ChartCard table` takes precedence. - Species colours come from `src/lib/species.ts` (blacktip = slot 1, sicklefin lemon = slot 2). - Charts measure their width (`bind:clientWidth`) and carry a `viewBox` so pre-hydration renders scale down instead of overflowing. - Interactive marks (links) inside an SVG → the SVG gets `role="group"`, not `img` (axe `nested-interactive`). Only put `aria-label` on elements that are links. diff --git a/src/lib/components/ChartCard.svelte b/src/lib/components/ChartCard.svelte index 0289486..8ec64a1 100644 --- a/src/lib/components/ChartCard.svelte +++ b/src/lib/components/ChartCard.svelte @@ -1,6 +1,7 @@
@@ -34,6 +60,11 @@ {/if} + {#if canDownload} + + {/if} {#if source}

Source: {source}

{/if}
@@ -73,6 +104,26 @@ margin-top: 10px; font-size: 0.85rem; } + .csv { + align-self: flex-start; + margin-top: 8px; + padding: 0; + background: none; + border: 0; + color: var(--accent-ink); + font: inherit; + font-size: 0.8rem; + cursor: pointer; + text-decoration: underline; + text-underline-offset: 2px; + } + .sr { + position: absolute; + width: 1px; + height: 1px; + overflow: hidden; + clip: rect(0 0 0 0); + } .tbl summary { cursor: pointer; color: var(--accent-ink); diff --git a/src/lib/components/charts/BarChart.svelte b/src/lib/components/charts/BarChart.svelte index 9a4b752..2251b36 100644 --- a/src/lib/components/charts/BarChart.svelte +++ b/src/lib/components/charts/BarChart.svelte @@ -7,6 +7,7 @@