@cascivo/charts 0.2.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 +68 -0
- package/dist/charts.css +2 -0
- package/dist/index.d.ts +684 -0
- package/dist/index.js +2090 -0
- package/package.json +72 -0
- package/readme.body.md +38 -0
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cascivo/charts",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Chart components built from scratch — scales, shapes, and signal-driven rendering, zero dependencies",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"cascivo",
|
|
8
|
+
"charts",
|
|
9
|
+
"css",
|
|
10
|
+
"data-visualization",
|
|
11
|
+
"design-system",
|
|
12
|
+
"react",
|
|
13
|
+
"signals",
|
|
14
|
+
"svg"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://github.com/cascivo/cascivo/tree/main/packages/charts#readme",
|
|
17
|
+
"bugs": "https://github.com/cascivo/cascivo/issues",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"author": "urbanisierung",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/cascivo/cascivo.git",
|
|
23
|
+
"directory": "packages/charts"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
28
|
+
"type": "module",
|
|
29
|
+
"sideEffects": [
|
|
30
|
+
"**/*.css"
|
|
31
|
+
],
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"import": "./dist/index.js",
|
|
37
|
+
"default": "./dist/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./styles.css": "./dist/charts.css"
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public",
|
|
43
|
+
"provenance": true
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "vp build && node scripts/flatten-types.mjs && node scripts/check-types-flat.mjs",
|
|
47
|
+
"check": "tsc --noEmit",
|
|
48
|
+
"test": "vp test"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@cascivo/core": "workspace:^",
|
|
52
|
+
"@cascivo/i18n": "workspace:^"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@testing-library/jest-dom": "catalog:",
|
|
56
|
+
"@testing-library/react": "catalog:",
|
|
57
|
+
"@testing-library/user-event": "catalog:",
|
|
58
|
+
"@types/react": "catalog:",
|
|
59
|
+
"@types/react-dom": "catalog:",
|
|
60
|
+
"fast-check": "catalog:",
|
|
61
|
+
"jsdom": "catalog:",
|
|
62
|
+
"react": "catalog:",
|
|
63
|
+
"react-dom": "catalog:",
|
|
64
|
+
"typescript": "catalog:",
|
|
65
|
+
"vite-plus": "catalog:"
|
|
66
|
+
},
|
|
67
|
+
"peerDependencies": {
|
|
68
|
+
"@preact/signals-react": ">=2.0.0",
|
|
69
|
+
"react": ">=18.0.0",
|
|
70
|
+
"react-dom": ">=18.0.0"
|
|
71
|
+
}
|
|
72
|
+
}
|
package/readme.body.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Accessible, signal-driven chart library for cascivo — AreaChart, BarChart, LineChart, Sparkline, Heatmap, and more. All charts are keyboard-navigable with `aria-live` tooltips. CVD-safe palettes (Okabe-Ito, oklch) verified in CI across all 14 themes.
|
|
2
|
+
|
|
3
|
+
## Install
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
pnpm add @cascivo/charts @preact/signals-react
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
`react`, `react-dom`, and `@preact/signals-react` are peer dependencies — install them in your app.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { AreaChart, BarChart, LineChart, Sparkline } from '@cascivo/charts'
|
|
15
|
+
import '@cascivo/charts/styles.css' // required — maps to the dist `charts.css`
|
|
16
|
+
import '@cascivo/themes/dark.css' // any cascivo theme drives the chart colors
|
|
17
|
+
|
|
18
|
+
export function Traffic() {
|
|
19
|
+
return (
|
|
20
|
+
<LineChart
|
|
21
|
+
data={[
|
|
22
|
+
{ x: 0, y: 12 },
|
|
23
|
+
{ x: 1, y: 28 },
|
|
24
|
+
{ x: 2, y: 19 },
|
|
25
|
+
]}
|
|
26
|
+
/>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Charts are CSS-token-themed: drop them inside any element carrying a `data-theme` (or import a
|
|
32
|
+
theme stylesheet) and they pick up the same palette, radii, and typography as the rest of cascivo.
|
|
33
|
+
|
|
34
|
+
### React apps must subscribe to signals
|
|
35
|
+
|
|
36
|
+
The charts are signal-driven. In a plain React app (no Babel signals transform), call `useSignals()`
|
|
37
|
+
from `@cascivo/core` as the first statement of any component that reads a signal during render. The
|
|
38
|
+
docs app (Preact) does not need this.
|