Internal source for @prc/charting-library. Folders are ordered by dependency layer (low → high). Location encodes meaning: a file's folder tells you what it may import and what must not import it.
primitives → store → animation / labels → overlays → charts → controller
presets (examples)
data/maps (static)
| Folder | Layer | Role |
|---|---|---|
primitives/ |
0 | Low-level SVG/React primitives |
store/ |
1 | Chart reactive store (useChartStore) |
animation/ |
2 | Transition engine + Animated* components + providers |
labels/ |
2 | Label components + leader lines (coupled with animation/; layout compute lives in @prc/charting-utilities/labelLayout/) |
overlays/ |
3 | Presentational chrome (legend, tooltip, axes, annotations) |
charts/ |
4 | D3 chart mark renderers (one per chart type) |
controller/ |
5 | ChartBuilder* orchestration |
presets/ |
— | Example chart configs (dev/examples only) |
data/maps/ |
— | GeoJSON/topology data + generation scripts |
- Default: a file lives in the folder for its rendering role / layer.
- Sibling vs nested: a top-level sibling (
labels/,animation/) requires a cohesive, engine-backed subsystem with its own internal API — not just "it's drawn on top." Presentational chrome belongs inoverlays/even when visually overlaid. - Nested subfolders (
labels/leader-line/,charts/maps/) when a cluster exceeds ~5–6 files or has a distinct concern. - Framework-agnostic label compute lives in
@prc/charting-utilities/labelLayout/.
Each folder has its own README with the precise admission rules for that layer.
Adding a new chart type? See the Cursor skill .cursor/skills/charting-library-new-chart-type/SKILL.md and its architecture reference.