@classic-homes/charts-core 0.2.0 → 0.3.1
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 +43 -0
- package/dist/{chunk-JM72YHZD.js → chunk-WAHMKXRF.js} +13 -3
- package/dist/index.cjs +910 -35
- package/dist/index.d.cts +402 -6
- package/dist/index.d.ts +402 -6
- package/dist/index.js +853 -35
- package/dist/theme/index.cjs +12 -2
- package/dist/theme/index.d.cts +10 -0
- package/dist/theme/index.d.ts +10 -0
- package/dist/theme/index.js +1 -1
- package/dist/types/index.d.cts +551 -23
- package/dist/types/index.d.ts +551 -23
- package/package.json +25 -10
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @classic-homes/charts-core
|
|
2
|
+
|
|
3
|
+
Framework-agnostic utilities, types, and ECharts themes for Classic Theme chart components. This package is the shared foundation for `@classic-homes/charts-react` and `@classic-homes/charts-svelte`.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @classic-homes/charts-core echarts
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Peer dependency: `echarts@^5.5.0`.
|
|
12
|
+
|
|
13
|
+
## Exports
|
|
14
|
+
|
|
15
|
+
| Import | Contents |
|
|
16
|
+
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| `@classic-homes/charts-core` | Themes, chart color helpers, prop and data types, formatting and data utilities |
|
|
18
|
+
| `@classic-homes/charts-core/theme` | `generateLightTheme`, `generateDarkTheme`, `lightTheme`, `darkTheme`, `THEME_LIGHT`, `THEME_DARK`, `lightChartColors`, `darkChartColors`, `getChartColors`, `colorWithAlpha` |
|
|
19
|
+
| `@classic-homes/charts-core/types` | Chart prop, data, and event types (`LineChartData`, `BarChartProps`, `ChartEventHandlers`, ...) |
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
### Themes
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { lightTheme, darkTheme } from '@classic-homes/charts-core/theme';
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Types
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import type { LineChartData, BarChartData, PieSliceData } from '@classic-homes/charts-core/types';
|
|
33
|
+
|
|
34
|
+
const revenue: LineChartData = {
|
|
35
|
+
categories: ['Jan', 'Feb', 'Mar'],
|
|
36
|
+
series: [{ name: '2025', data: [120, 132, 101] }],
|
|
37
|
+
};
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Related Packages
|
|
41
|
+
|
|
42
|
+
- `@classic-homes/charts-react`: React ECharts components
|
|
43
|
+
- `@classic-homes/charts-svelte`: Svelte ECharts components
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { colors, semanticColors, borderRadius, fontFamily } from '@classic-homes/theme-tokens';
|
|
2
2
|
|
|
3
3
|
// src/theme/generator.ts
|
|
4
4
|
function generateLightTheme() {
|
|
@@ -282,7 +282,12 @@ var lightChartColors = {
|
|
|
282
282
|
axisPointerLabel: semanticColors.light.mutedForeground,
|
|
283
283
|
divider: colors.gray[600],
|
|
284
284
|
success: semanticColors.light.success,
|
|
285
|
-
destructive: semanticColors.light.destructive
|
|
285
|
+
destructive: semanticColors.light.destructive,
|
|
286
|
+
warning: semanticColors.light.warning,
|
|
287
|
+
reference: semanticColors.light.mutedForeground,
|
|
288
|
+
referenceBand: "rgba(102, 102, 102, 0.08)",
|
|
289
|
+
surface: semanticColors.light.card,
|
|
290
|
+
ranges: [colors.gray[300], colors.gray[200], colors.gray[100]]
|
|
286
291
|
};
|
|
287
292
|
var darkChartColors = {
|
|
288
293
|
series: darkTheme.color,
|
|
@@ -292,7 +297,12 @@ var darkChartColors = {
|
|
|
292
297
|
axisPointerLabel: colors.gray[600],
|
|
293
298
|
divider: colors.gray[700],
|
|
294
299
|
success: semanticColors.dark.success,
|
|
295
|
-
destructive: semanticColors.dark.destructive
|
|
300
|
+
destructive: semanticColors.dark.destructive,
|
|
301
|
+
warning: semanticColors.dark.warning,
|
|
302
|
+
reference: semanticColors.dark.mutedForeground,
|
|
303
|
+
referenceBand: "rgba(255, 255, 255, 0.06)",
|
|
304
|
+
surface: semanticColors.dark.card,
|
|
305
|
+
ranges: [colors.gray[600], colors.gray[700], colors.gray[800]]
|
|
296
306
|
};
|
|
297
307
|
function getChartColors(themeName) {
|
|
298
308
|
return themeName === THEME_DARK ? darkChartColors : lightChartColors;
|