A new package — pure-SVG token-themed chart primitives, zero deps,
SSR-safe. Slots into the existing dataviz family next to
@bytelyst/data-viz (which owns Sparkline + KpiCard + Heatmap).
──────────────────────────────────────────────────────────────────
Components
──────────────────────────────────────────────────────────────────
<LineChart> Wave 9.A.1
- Multi-series with per-series colour override
- Smooth (catmull-rom) or straight polyline
- 3-tick subtle Y grid + per-tick label
- SSR-safe title id via useId()
<BarChart> Wave 9.A.2
- Negative-value support via configurable baseline
- Per-bar colour override; per-bar accessible label
- Compact-K tick labels
<AreaChart> Wave 9.A.3
- Single-series with gradient fill + line stroke
- Zero-baseline included automatically when data >= 0
<Donut> Wave 9.A.4 (a)
- Categorical share-of-total ring
- Token palette walks 6 colours; per-slice override
- Empty / all-zero data renders a muted ring (no NaN slices)
- Single near-100% slice collapses to a closed ring
- centerContent slot via <foreignObject>
<Gauge> Wave 9.A.4 (b)
- Half-circle 'fuel-tank' dial
- NaN / out-of-range clamped safely
- Caption slot below the dial
──────────────────────────────────────────────────────────────────
Shared utilities (src/utils.ts) — also exported
──────────────────────────────────────────────────────────────────
- linearScale, extent (NaN-safe), smoothPath, formatNumber
──────────────────────────────────────────────────────────────────
Quality gates
──────────────────────────────────────────────────────────────────
✓ pnpm -F @bytelyst/charts test → 19/19 passing
- utils: 3 cases (extent / linearScale / smoothPath edge cases)
- Line: 3 cases (series count, colour override, useId aria)
- Bar: 3 cases (count, diverging negative, colour)
- Area: 2 cases (gradient + line, single-point safety)
- Donut: 4 cases (slice count, empty ring, full-ring collapse,
centerContent slot)
- Gauge: 4 cases (in-domain, clamp >max, NaN→min, caption)
✓ pnpm -F @bytelyst/charts build → tsc clean
✓ No console.log / no Math.random for ids
✓ All primitives honour the design-system anti-patterns doc
──────────────────────────────────────────────────────────────────
Deferred to 0.2.x
──────────────────────────────────────────────────────────────────
- <StackedBar>, <RadarChart> (see roadmap §9.A)
Showcase routes + roadmap flips land in the paired commit.
35 lines
846 B
JSON
35 lines
846 B
JSON
{
|
|
"name": "@bytelyst/charts",
|
|
"version": "0.1.0",
|
|
"type": "module",
|
|
"description": "Token-themed chart primitives — LineChart, BarChart, AreaChart, Donut, Gauge. Pure SVG, zero deps.",
|
|
"exports": {
|
|
".": {
|
|
"import": "./dist/index.js",
|
|
"types": "./dist/index.d.ts"
|
|
}
|
|
},
|
|
"main": "./dist/index.js",
|
|
"types": "./dist/index.d.ts",
|
|
"files": ["dist"],
|
|
"scripts": {
|
|
"build": "tsc",
|
|
"test": "vitest run --pool forks",
|
|
"typecheck": "tsc --noEmit"
|
|
},
|
|
"peerDependencies": {
|
|
"react": ">=18.0.0",
|
|
"react-dom": ">=18.0.0"
|
|
},
|
|
"devDependencies": {
|
|
"@testing-library/react": "^16.3.2",
|
|
"@types/react": "^19.2.14",
|
|
"@types/react-dom": "^19.2.3",
|
|
"happy-dom": "^18.0.1",
|
|
"react": "^19.2.4",
|
|
"react-dom": "^19.2.4",
|
|
"typescript": "^5.7.3",
|
|
"vitest": "^4.0.18"
|
|
}
|
|
}
|