nuxt-charts 2.2.1-beta.0 → 3.0.0-beta.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.
Files changed (92) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +80 -79
  3. package/dist/module.d.mts +4 -4
  4. package/dist/module.json +1 -1
  5. package/dist/module.mjs +64 -95
  6. package/dist/runtime/assets/components.css +1 -0
  7. package/dist/runtime/assets/theme.css +1 -0
  8. package/dist/runtime/components/AreaChart.d.vue.ts +19 -0
  9. package/dist/runtime/components/AreaChart.vue +149 -0
  10. package/dist/runtime/components/AreaChart.vue.d.ts +19 -0
  11. package/dist/runtime/components/BarChart.d.vue.ts +19 -0
  12. package/dist/runtime/components/BarChart.vue +175 -0
  13. package/dist/runtime/components/BarChart.vue.d.ts +19 -0
  14. package/dist/runtime/components/BubbleChart.d.vue.ts +19 -0
  15. package/dist/runtime/components/BubbleChart.vue +213 -0
  16. package/dist/runtime/components/BubbleChart.vue.d.ts +19 -0
  17. package/dist/runtime/components/CandlestickChart.d.vue.ts +19 -0
  18. package/dist/runtime/components/CandlestickChart.vue +329 -0
  19. package/dist/runtime/components/CandlestickChart.vue.d.ts +19 -0
  20. package/dist/runtime/components/DonutChart.d.vue.ts +21 -0
  21. package/dist/runtime/components/DonutChart.vue +116 -0
  22. package/dist/runtime/components/DonutChart.vue.d.ts +21 -0
  23. package/dist/runtime/components/FunnelChart.d.vue.ts +19 -0
  24. package/dist/runtime/components/FunnelChart.vue +152 -0
  25. package/dist/runtime/components/FunnelChart.vue.d.ts +19 -0
  26. package/dist/runtime/components/LineChart.d.vue.ts +19 -0
  27. package/dist/runtime/components/LineChart.vue +84 -0
  28. package/dist/runtime/components/LineChart.vue.d.ts +19 -0
  29. package/dist/runtime/components/RadarChart.d.vue.ts +19 -0
  30. package/dist/runtime/components/RadarChart.vue +90 -0
  31. package/dist/runtime/components/RadarChart.vue.d.ts +19 -0
  32. package/dist/runtime/components/RadialBarChart.d.vue.ts +19 -0
  33. package/dist/runtime/components/RadialBarChart.vue +81 -0
  34. package/dist/runtime/components/RadialBarChart.vue.d.ts +19 -0
  35. package/dist/runtime/components/StatusTrackerChart.d.vue.ts +19 -0
  36. package/dist/runtime/components/StatusTrackerChart.vue +147 -0
  37. package/dist/runtime/components/StatusTrackerChart.vue.d.ts +19 -0
  38. package/dist/runtime/components/internal/CandlestickTooltip.d.vue.ts +17 -0
  39. package/dist/runtime/components/internal/CandlestickTooltip.vue +38 -0
  40. package/dist/runtime/components/internal/CandlestickTooltip.vue.d.ts +17 -0
  41. package/dist/runtime/components/internal/CartesianFrame.d.vue.ts +40 -0
  42. package/dist/runtime/components/internal/CartesianFrame.vue +321 -0
  43. package/dist/runtime/components/internal/CartesianFrame.vue.d.ts +40 -0
  44. package/dist/runtime/components/internal/ChartLegend.d.vue.ts +11 -0
  45. package/dist/runtime/components/internal/ChartLegend.vue +22 -0
  46. package/dist/runtime/components/internal/ChartLegend.vue.d.ts +11 -0
  47. package/dist/runtime/components/internal/ChartTooltip.d.vue.ts +3 -0
  48. package/dist/runtime/components/internal/ChartTooltip.vue +39 -0
  49. package/dist/runtime/components/internal/ChartTooltip.vue.d.ts +3 -0
  50. package/dist/runtime/components/internal/CubeBarShape.d.vue.ts +28 -0
  51. package/dist/runtime/components/internal/CubeBarShape.vue +69 -0
  52. package/dist/runtime/components/internal/CubeBarShape.vue.d.ts +28 -0
  53. package/dist/runtime/components/internal/DitherDefs.d.ts +98 -0
  54. package/dist/runtime/components/internal/DitherDefs.js +158 -0
  55. package/dist/runtime/components/internal/FunnelLayeredShape.d.vue.ts +42 -0
  56. package/dist/runtime/components/internal/FunnelLayeredShape.vue +124 -0
  57. package/dist/runtime/components/internal/FunnelLayeredShape.vue.d.ts +42 -0
  58. package/dist/runtime/components/internal/GradientDefs.d.ts +46 -0
  59. package/dist/runtime/components/internal/GradientDefs.js +38 -0
  60. package/dist/runtime/enums.d.ts +65 -0
  61. package/dist/runtime/enums.js +40 -0
  62. package/dist/runtime/types/charts.d.ts +642 -0
  63. package/dist/runtime/types/charts.js +0 -0
  64. package/dist/runtime/types/shared.d.ts +202 -0
  65. package/dist/runtime/types/shared.js +0 -0
  66. package/dist/runtime/types.d.ts +8 -0
  67. package/dist/runtime/types.js +0 -0
  68. package/dist/runtime/utils/axis.d.ts +132 -0
  69. package/dist/runtime/utils/axis.js +93 -0
  70. package/dist/runtime/utils/categories.d.ts +36 -0
  71. package/dist/runtime/utils/categories.js +18 -0
  72. package/dist/runtime/utils/cubes.d.ts +100 -0
  73. package/dist/runtime/utils/cubes.js +73 -0
  74. package/dist/runtime/utils/curve.d.ts +12 -0
  75. package/dist/runtime/utils/curve.js +26 -0
  76. package/dist/runtime/utils/dither.d.ts +55 -0
  77. package/dist/runtime/utils/dither.js +45 -0
  78. package/dist/runtime/utils/gradient.d.ts +12 -0
  79. package/dist/runtime/utils/gradient.js +8 -0
  80. package/dist/runtime/utils/index.d.ts +6 -0
  81. package/dist/runtime/utils/index.js +6 -0
  82. package/dist/runtime/utils/legend.d.ts +27 -0
  83. package/dist/runtime/utils/legend.js +19 -0
  84. package/dist/runtime/utils/marker.d.ts +20 -0
  85. package/dist/runtime/utils/marker.js +21 -0
  86. package/dist/runtime/utils/style.d.ts +14 -0
  87. package/dist/runtime/utils/style.js +10 -0
  88. package/dist/runtime/utils/theme.d.ts +36 -0
  89. package/dist/runtime/utils/theme.js +45 -0
  90. package/package.json +56 -12
  91. package/dist/runtime/vue-chrts.d.ts +0 -1
  92. package/dist/runtime/vue-chrts.js +0 -13
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) [year] [fullname]
3
+ Copyright (c) 2025 Dennis Adriaansen
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,109 +1,110 @@
1
1
  # nuxt-charts
2
2
 
3
- [![npm version][npm-version-src]][npm-version-href]
4
- [![npm downloads][npm-downloads-src]][npm-downloads-href]
3
+ Beautiful chart components for Nuxt — Area, Bar, Line, Donut, Bubble, Radar, Radial Bar, Funnel, Candlestick and Status Tracker.
5
4
 
6
- Nuxt module for [vue-chrts](https://github.com/dennisadriaans/vue-chrts/tree/main/packages/vue)
5
+ Powered by [vccs](https://vue-charts.com) (Vue port of Recharts). Drop-in config-prop API from nuxt-charts v2.
7
6
 
8
- ## Features
9
-
10
- - 📊 Use beautiful chart components in your Nuxt applications
11
- - 🔄 Auto-imports for all chart components
12
- - 📊 Multiple types: Line, Bar, Area, Donut
13
- - 🎨 Easily customizable
14
- - 💡 Simple, intuitive API
15
- - 🚀 Built with Vue 3 and TypeScript
16
-
17
- ## Installation
7
+ ## Install
18
8
 
19
9
  ```bash
20
- # npm
21
- npm install nuxt-charts
22
-
23
- # yarn
24
- yarn add nuxt-charts
25
-
26
- # pnpm
27
- pnpm add nuxt-charts
10
+ # beta (v3)
11
+ pnpm add nuxt-charts@beta
28
12
  ```
29
13
 
30
- ## Usage
31
-
32
- Add the module to your Nuxt config:
33
-
34
14
  ```ts
35
- // nuxt.config.ts
36
15
  export default defineNuxtConfig({
37
- modules: ["nuxt-charts"]
38
- });
16
+ modules: ["nuxt-charts"],
17
+ })
39
18
  ```
40
19
 
41
- Then use the components in your Nuxt application:
20
+ ## Charts
42
21
 
43
- ```vue
44
- <template>
45
- <div class="chart-wrapper">
46
- <LineChart
47
- :data="data"
48
- :categories="categories"
49
- :height="300"
50
- :xFormatter="xFormatter"
51
- xLabel="Month"
52
- yLabel="Amount"
53
- />
54
- </div>
55
- </template>
22
+ | Component | Notes |
23
+ |---|---|
24
+ | `AreaChart` | Gradients, dither fills, stacked |
25
+ | `BarChart` | Grouped, stacked, horizontal, cube bars |
26
+ | `LineChart` | Multi-series, curve types |
27
+ | `DonutChart` | Center slot for labels |
28
+ | `BubbleChart` | Scatter with size encoding |
29
+ | `RadarChart` | New in v3 |
30
+ | `RadialBarChart` | New in v3 |
31
+ | `FunnelChart` | New in v3 |
32
+ | `CandlestickChart` | New in v3 |
33
+ | `StatusTrackerChart` | New in v3 |
34
+
35
+ ### New cross-cutting props (cartesian charts)
36
+
37
+ - `yAxes` — plot series with different units on independent y-axes.
38
+ - `referenceLines` — draw horizontal / vertical reference lines across the plot.
39
+ - `syncId` — synchronise tooltip / hover across charts that share the same id.
40
+ - Revived from v2: `xExplicitTicks` / `yExplicitTicks` (→ axis `ticks`),
41
+ `minMaxTicksOnly` (→ `interval="preserveStartEnd"`), and `AxisConfig` tick text
42
+ colour / size / alignment now apply.
56
43
 
57
- <script setup>
58
- import { LineChart } from 'vue-chrts';
44
+ #### Multiple y-axes
59
45
 
60
- const data = [
61
- { month: 'Jan', sales: 100, profit: 50 },
62
- { month: 'Feb', sales: 120, profit: 55 },
63
- { month: 'Mar', sales: 180, profit: 80 },
64
- { month: 'Apr', sales: 110, profit: 40 },
65
- { month: 'May', sales: 90, profit: 30 },
66
- ];
46
+ Give a category a `yAxis` id and describe that axis in `yAxes`. Series sharing
47
+ an id share a scale; series without one stay on the primary axis, so existing
48
+ charts are unaffected.
67
49
 
50
+ ```vue
51
+ <script setup lang="ts">
68
52
  const categories = {
69
- sales: {
70
- name: 'Sales',
71
- color: '#3b82f6'
72
- },
73
- profit: {
74
- name: 'Profit',
75
- color: '#10b981'
76
- }
53
+ indoor: { name: "Indoor", color: "#2662d9", yAxis: "temp" },
54
+ outdoor: { name: "Outdoor", color: "#e23670", yAxis: "temp" },
55
+ humidity: { name: "Humidity", color: "#af57db", yAxis: "pct" },
77
56
  };
78
57
 
79
- const xFormatter = (i) => data[i].month;
58
+ const yAxes = {
59
+ temp: { orientation: "left", label: "°C" },
60
+ pct: { orientation: "right", label: "%", domain: [0, 100] },
61
+ };
80
62
  </script>
63
+
64
+ <template>
65
+ <LineChart :data="data" :categories="categories" :y-axes="yAxes" :height="320" x-axis="time" />
66
+ </template>
81
67
  ```
82
68
 
83
- ## Available Components
69
+ Each axis accepts `orientation`, `label`, `domain`, `numTicks`, `formatter`,
70
+ `hide`, and the usual `AxisConfig` tick options; anything unset falls back to
71
+ the top-level `yLabel` / `yDomain` / `yAxisConfig` props. Supported on
72
+ `LineChart`, `AreaChart` and `BarChart` (vertical orientation).
84
73
 
85
- - `AreaChart` - Area chart
86
- - `AreaStackedChart` - Stacked area chart
87
- - `LineChart` - Line chart
88
- - `BarChart` - Bar chart
89
- - `DonutChart` - Donut chart
74
+ ### Deferred / removed
90
75
 
91
- ## Auto-imported Types
76
+ - **`SankeyChart`** — deferred: the published `vccs` release does not yet export
77
+ a Sankey chart. Returns once `vccs` ships it.
78
+ - **`DualChart`** — planned for v3.1 (maps onto the `vccs` `ComposedChart`).
79
+ - **`GanttChart`, `DagreGraph`, `Maps`** — removed in v3. They were Unovis /
80
+ d3-geo specific and have no `vccs` equivalent.
92
81
 
93
- The following types are auto-imported:
82
+ ## Module options
94
83
 
95
- - `LegendPosition`
96
- - `CurveType`
97
- - `Orientation`
98
- - `BulletLegendItemInterface`
84
+ ```ts
85
+ export default defineNuxtConfig({
86
+ modules: ["nuxt-charts"],
87
+ nuxtCharts: {
88
+ prefix: "", // prefix component names, e.g. "V" -> <VBarChart>
89
+ global: true, // register globally (no import needed)
90
+ autoImports: true, // auto-import enums and prop types
91
+ include: [], // [] = all; or a subset, e.g. ["BarChart", "LineChart"]
92
+ },
93
+ })
94
+ ```
99
95
 
100
- ## License
96
+ ## Auto-imported enums & types
101
97
 
102
- MIT
98
+ - Enums: `CurveType`, `LegendPosition`, `Orientation`, `DonutType`
99
+ - Types: `AreaChartProps`, `BarChartProps`, `LineChartProps`, `BubbleChartProps`,
100
+ `DonutChartProps`, `RadarChartProps`, `RadialBarChartProps`, `FunnelChartProps`,
101
+ `StatusTrackerChartProps`, `StatusTrackerDatum`, `BulletLegendItemInterface`,
102
+ `AxisConfig`, `TooltipConfig`, `ValueLabel`, `ReferenceLineConfig`
103
+
104
+ ## Migrating from v2
103
105
 
104
- <!-- Badges -->
106
+ See the [Upgrade to v3](https://nuxtcharts.com/docs/getting-started/upgrade-to-v3) guide. Specialty charts (maps, gantt, dual, sankey, dagre) are not in v3 yet — stay on `nuxt-charts@2` if you need them.
105
107
 
106
- [npm-version-src]: https://img.shields.io/npm/v/nuxt-charts/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
107
- [npm-version-href]: https://npmjs.com/package/nuxt-charts
108
- [npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-charts.svg?style=flat&colorA=18181B&colorB=28CF8D
109
- [npm-downloads-href]: https://npmjs.com/package/nuxt-charts
108
+ ## License
109
+
110
+ MIT
package/dist/module.d.mts CHANGED
@@ -2,22 +2,22 @@ import * as _nuxt_schema from '@nuxt/schema';
2
2
 
3
3
  interface ModuleOptions {
4
4
  /**
5
- * Prefix for component names
5
+ * Prefix for component names.
6
6
  * @default ''
7
7
  */
8
8
  prefix?: string;
9
9
  /**
10
- * Register global components
10
+ * Register components globally (no explicit import needed in templates).
11
11
  * @default true
12
12
  */
13
13
  global?: boolean;
14
14
  /**
15
- * Use auto-imports (recommended)
15
+ * Auto-import enums and types.
16
16
  * @default true
17
17
  */
18
18
  autoImports?: boolean;
19
19
  /**
20
- * Components to include (empty array means all components)
20
+ * Components to include. Empty means all.
21
21
  * @default []
22
22
  */
23
23
  include?: string[];
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3"
6
6
  },
7
- "version": "2.2.1-beta.0",
7
+ "version": "3.0.0-beta.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -1,85 +1,70 @@
1
- import { createRequire } from 'node:module';
2
- import { dirname } from 'node:path';
3
- import { addComponent, addImportsSources, defineNuxtModule, createResolver } from '@nuxt/kit';
1
+ import { createResolver, addComponent, addImportsSources, defineNuxtModule } from '@nuxt/kit';
4
2
 
5
- const resolveComponents = (config, filePath) => {
3
+ const COMPONENTS = {
4
+ AreaChart: "AreaChart",
5
+ BarChart: "BarChart",
6
+ LineChart: "LineChart",
7
+ DonutChart: "DonutChart",
8
+ BubbleChart: "BubbleChart",
9
+ RadarChart: "RadarChart",
10
+ RadialBarChart: "RadialBarChart",
11
+ FunnelChart: "FunnelChart",
12
+ CandlestickChart: "CandlestickChart",
13
+ StatusTrackerChart: "StatusTrackerChart"
14
+ };
15
+ const resolveComponents = (config, resolverUrl) => {
6
16
  const { prefix, include, global } = config;
7
- const allComponents = [
8
- "AreaChart",
9
- "LineChart",
10
- "BarChart",
11
- "DonutChart",
12
- "BubbleChart",
13
- "GanttChart",
14
- "DagreGraph",
15
- "DualChart",
16
- "SankeyChart",
17
- "TopoJSONMap",
18
- "DottedMap"
19
- ];
20
- const components = include?.length ? allComponents.filter((component) => include.includes(component)) : allComponents;
21
- components.forEach((component) => {
17
+ const { resolve } = createResolver(resolverUrl);
18
+ const names = Object.keys(COMPONENTS).filter(
19
+ (name) => include?.length ? include.includes(name) : true
20
+ );
21
+ for (const name of names) {
22
22
  addComponent({
23
- export: component,
24
- name: prefix + component,
23
+ name: `${prefix}${name}`,
24
+ filePath: resolve(`./runtime/components/${COMPONENTS[name]}.vue`),
25
25
  mode: "client",
26
- global,
27
- filePath
26
+ global
28
27
  });
29
- });
28
+ }
30
29
  };
31
30
 
32
- const resolveImports = (config, filePath) => {
33
- if (!config.autoImports) {
34
- return;
35
- }
36
- const allTypes = ["BulletLegendItemInterface", "MarkerConfig", "CrosshairConfig", "AxisConfig", "TooltipConfig", "MapRegion", "MapPin"];
37
- addImportsSources({
38
- from: "vue-chrts/types",
39
- type: true,
40
- imports: [...allTypes]
41
- });
42
- const enumImports = ["CurveType", "LegendPosition", "Orientation"];
43
- addImportsSources({
44
- from: "vue-chrts/enums",
45
- imports: [...enumImports]
46
- });
47
- const runtimeImports = ["DonutType", "getMap", "getPin"];
48
- addImportsSources({
49
- from: "vue-chrts",
50
- imports: [...runtimeImports]
51
- });
52
- const geoImports = ["geoMercator"];
31
+ const resolveImports = (config, resolverUrl) => {
32
+ if (!config.autoImports) return;
33
+ const { resolve } = createResolver(resolverUrl);
53
34
  addImportsSources({
54
- from: "vue-chrts",
55
- imports: [...geoImports]
35
+ from: resolve("./runtime/enums"),
36
+ imports: ["CurveType", "LegendPosition", "Orientation", "DonutType"]
56
37
  });
57
- const topoJsonImports = [
58
- "ChinaTopoJSON",
59
- "FranceTopoJSON",
60
- "GermanyTopoJSON",
61
- "IndiaTopoJSON",
62
- "UKTopoJSON",
63
- "USATopoJSON",
64
- "USCountiesTopoJSON",
65
- "WorldMap110mAlphaTopoJSON",
66
- "WorldMapSimplestTopoJSON",
67
- "WorldMapTopoJSON"
68
- ];
69
38
  addImportsSources({
70
- from: "vue-chrts",
71
- imports: [...topoJsonImports]
39
+ from: resolve("./runtime/types"),
40
+ type: true,
41
+ imports: [
42
+ "AreaChartProps",
43
+ "BarChartProps",
44
+ "LineChartProps",
45
+ "BubbleChartProps",
46
+ "DonutChartProps",
47
+ "RadarChartProps",
48
+ "RadialBarChartProps",
49
+ "FunnelChartProps",
50
+ "CandlestickChartProps",
51
+ "StatusTrackerChartProps",
52
+ "StatusTrackerDatum",
53
+ "BulletLegendItemInterface",
54
+ "AxisConfig",
55
+ "TooltipConfig",
56
+ "ValueLabel",
57
+ "ReferenceLineConfig",
58
+ // v2 parity: these auto-imported in nuxt-charts v2. The types still exist
59
+ // (MarkerConfig drives line/area dot rendering; CrosshairConfig is inert
60
+ // but kept so old templates type-check), so keep them auto-importable.
61
+ "MarkerConfig",
62
+ "CrosshairConfig"
63
+ ]
72
64
  });
73
65
  };
74
66
 
75
- function resolvePackageDir(packageName, fromPackage) {
76
- try {
77
- const _require = fromPackage ? createRequire(createRequire(import.meta.url).resolve(fromPackage)) : createRequire(import.meta.url);
78
- return dirname(_require.resolve(`${packageName}/package.json`));
79
- } catch {
80
- return void 0;
81
- }
82
- }
67
+ const VCCS_DEPS = ["vccs", "motion-v", "vccs > eventemitter3"];
83
68
  const module$1 = defineNuxtModule({
84
69
  meta: {
85
70
  name: "nuxt-charts",
@@ -94,40 +79,24 @@ const module$1 = defineNuxtModule({
94
79
  autoImports: true,
95
80
  include: []
96
81
  },
97
- async setup(options, nuxt) {
98
- nuxt.hook("modules:done", () => {
99
- nuxt.options.build.transpile = nuxt.options.build.transpile.filter(
100
- (entry) => entry !== "vue-chrts"
101
- );
102
- });
103
- const unovisTsDir = resolvePackageDir("@unovis/ts", "vue-chrts");
104
- const unovisVueDir = resolvePackageDir("@unovis/vue", "vue-chrts");
105
- if (unovisTsDir) {
106
- nuxt.options.alias["@unovis/ts"] = unovisTsDir;
107
- }
108
- if (unovisVueDir) {
109
- nuxt.options.alias["@unovis/vue"] = unovisVueDir;
110
- }
82
+ setup(options, nuxt) {
111
83
  nuxt.hook("vite:extendConfig", (viteConfig, { isClient }) => {
112
84
  if (!isClient) return;
113
85
  const config = viteConfig;
114
86
  config.optimizeDeps ??= {};
115
87
  config.optimizeDeps.include ??= [];
116
- const entries = [
117
- "vue-chrts",
118
- ...unovisTsDir ? ["@unovis/ts"] : [],
119
- ...unovisVueDir ? ["@unovis/vue"] : []
120
- ];
121
- for (const entry of entries) {
122
- if (!config.optimizeDeps.include.includes(entry)) {
123
- config.optimizeDeps.include.push(entry);
124
- }
88
+ const include = config.optimizeDeps.include;
89
+ for (const dep of VCCS_DEPS) {
90
+ if (!include.includes(dep)) include.push(dep);
125
91
  }
126
92
  });
127
93
  const { resolve } = createResolver(import.meta.url);
128
- const runtimePath = resolve("./runtime/vue-chrts");
129
- resolveImports(options);
130
- resolveComponents(options, runtimePath);
94
+ nuxt.options.css.push(
95
+ resolve("./runtime/assets/theme.css"),
96
+ resolve("./runtime/assets/components.css")
97
+ );
98
+ resolveImports(options, import.meta.url);
99
+ resolveComponents(options, import.meta.url);
131
100
  }
132
101
  });
133
102
 
@@ -0,0 +1 @@
1
+ @layer vue-chrts{.vc-tooltip{background:var(--vc-tooltip-bg,oklch(1 0 0));border:1px solid var(--vc-tooltip-border,oklch(.922 0 0));border-radius:var(--vc-tooltip-radius,.5rem);box-shadow:var(--vc-tooltip-shadow,0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1));font-size:var(--vc-legend-size,.75rem);line-height:1.5;min-width:8rem;padding:var(--vc-tooltip-padding,.375rem .625rem);pointer-events:none}.vc-tooltip,.vc-tooltip__label{color:var(--vc-tooltip-fg,oklch(.205 0 0))}.vc-tooltip__label{font-weight:500;margin:0 0 .25rem}.vc-tooltip__list{display:flex;flex-direction:column;gap:.125rem;list-style:none;margin:0;padding:0}.vc-tooltip__item{align-items:center;display:flex;gap:.375rem}.vc-tooltip__dot{border-radius:9999px;display:inline-block;flex-shrink:0;height:.5rem;width:.5rem}.vc-tooltip__name{color:var(--vc-tooltip-muted,oklch(.556 0 0))}.vc-tooltip__value{color:var(--vc-tooltip-fg,oklch(.205 0 0));font-variant-numeric:tabular-nums;font-weight:500;margin-left:auto}.vc-legend{flex-wrap:wrap;font-size:var(--vc-legend-size,.75rem);font-weight:var(--vc-legend-weight,400);gap:var(--vc-legend-gap,.75rem);justify-content:center;line-height:1.5;list-style:none;margin:0;padding:0}.vc-legend,.vc-legend__item{align-items:center;display:flex}.vc-legend__item{gap:.375rem}.vc-legend__item--inactive{opacity:.4}.vc-legend__dot{border-radius:9999px;display:inline-block;flex-shrink:0;height:var(--vc-legend-dot-size,.5rem);width:var(--vc-legend-dot-size,.5rem)}.vc-legend__label{color:var(--vc-legend-color,oklch(.556 0 0))}.vc-candlestick-chart{cursor:crosshair;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}.vc-candlestick-chart__svg{display:block;overflow:visible;width:100%}.vc-funnel-layered{position:relative;width:100%}.vc-funnel-layered__tooltip{align-items:center;background:var(--vc-tooltip-bg,oklch(1 0 0));border:1px solid var(--vc-tooltip-border,oklch(.922 0 0));border-radius:var(--vc-tooltip-radius,.5rem);box-shadow:var(--vc-tooltip-shadow,0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1));color:var(--vc-tooltip-fg,oklch(.205 0 0));display:flex;font-size:var(--vc-legend-size,.75rem);gap:.375rem;padding:var(--vc-tooltip-padding,.375rem .625rem);pointer-events:none;position:absolute;transform:translate(-50%,calc(-100% - 10px));white-space:nowrap}.vc-funnel-layered__name{color:var(--vc-tooltip-muted,oklch(.556 0 0))}.vc-funnel-layered__value{font-variant-numeric:tabular-nums;font-weight:600}.vc-funnel-layered__dot{border-radius:9999px;display:inline-block;flex-shrink:0;height:var(--vc-legend-dot-size,.5rem);width:var(--vc-legend-dot-size,.5rem)}.vc-funnel-layered-shape{opacity:.96;transition:opacity .15s}.vc-funnel-layered-shape:hover{opacity:1}.vc-status-tracker{color:var(--foreground,oklch(.205 0 0));font-family:inherit;width:100%}.vc-status-tracker__header{align-items:baseline;display:flex;gap:1rem;justify-content:space-between;margin-bottom:.75rem}.vc-status-tracker__summary,.vc-status-tracker__title{font-size:.875rem;line-height:1.25rem;margin:0}.vc-status-tracker__title{font-weight:600}.vc-status-tracker__summary{color:var(--muted-foreground,oklch(.556 0 0));font-variant-numeric:tabular-nums}.vc-status-tracker__track{display:flex;overflow:hidden;width:100%}.vc-status-tracker__bar{display:block;flex:0 0 auto;height:100%;min-width:1px;transition:opacity .16s ease}.vc-status-tracker__bar:hover{opacity:.78}.vc-status-tracker__bar--rounded-start{border-bottom-left-radius:.25rem;border-top-left-radius:.25rem}.vc-status-tracker__bar--rounded-end{border-bottom-right-radius:.25rem;border-top-right-radius:.25rem}.vc-status-tracker__bar--empty:hover{opacity:1}.vc-status-tracker__labels{gap:1rem;justify-content:space-between;margin-top:.5rem}.vc-status-tracker__labels,.vc-status-tracker__legend{color:var(--vc-legend-color,oklch(.556 0 0));display:flex;font-size:var(--vc-legend-size,.75rem);line-height:1rem}.vc-status-tracker__legend{flex-wrap:wrap;gap:.5rem 1rem;list-style:none;margin:.75rem 0 0;padding:0}.vc-status-tracker__legend-item{align-items:center;display:inline-flex;gap:.375rem}.vc-status-tracker__legend-dot{border-radius:9999px;flex:0 0 auto;height:var(--vc-legend-dot-size,.5rem);width:var(--vc-legend-dot-size,.5rem)}}
@@ -0,0 +1 @@
1
+ @layer vue-chrts{.vue-chrts{--vc-grid-color:var(--border,oklch(0.922 0 0));--vc-grid-dash:3 3;--vc-grid-width:1px;--vc-axis-line-color:var(--border,oklch(0.922 0 0));--vc-axis-line-width:1px;--vc-legend-size:0.75rem;--vc-legend-weight:400;--vc-tick-color:var(--muted-foreground,oklch(0.556 0 0));--vc-tick-size:var(--vc-legend-size);--vc-tick-weight:var(--vc-legend-weight);--vc-axis-label-color:var(--foreground,oklch(0.205 0 0));--vc-axis-label-size:var(--vc-legend-size);--vc-axis-label-weight:500}.vue-chrts .v-charts-cartesian-axis .v-charts-label{fill:var(--vc-axis-label-color);font-size:var(--vc-axis-label-size);font-weight:var(--vc-axis-label-weight)}.vue-chrts{--vc-legend-gap:0.75rem;--vc-legend-inset:0.75rem;--vc-legend-color:var(--muted-foreground,oklch(0.556 0 0));--vc-legend-dot-size:0.5rem;--vc-hover-fill:color-mix(in oklab,var(--foreground,oklch(0.205 0 0)) 6%,transparent);--vc-hover-stroke:transparent;--vc-hover-radius:6px;--vc-tooltip-bg:var(--popover,oklch(1 0 0));--vc-tooltip-fg:var(--popover-foreground,oklch(0.205 0 0));--vc-tooltip-muted:var(--muted-foreground,oklch(0.556 0 0));--vc-tooltip-border:var(--border,oklch(0.922 0 0));--vc-tooltip-radius:0.5rem;--vc-tooltip-padding:0.375rem 0.625rem;--vc-tooltip-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1)}.vue-chrts .v-charts-xAxis .v-charts-cartesian-axis-tick-value{fill:var(--vc-x-tick-color,var(--vc-tick-color));font-size:var(--vc-x-tick-size,var(--vc-tick-size));font-weight:var(--vc-x-tick-weight,var(--vc-tick-weight))}.vue-chrts .v-charts-yAxis .v-charts-cartesian-axis-tick-value{fill:var(--vc-y-tick-color,var(--vc-tick-color));font-size:var(--vc-y-tick-size,var(--vc-tick-size));font-weight:var(--vc-y-tick-weight,var(--vc-tick-weight))}.vue-chrts .v-charts-polar-angle-axis-tick-value,.vue-chrts .v-charts-polar-radius-axis-tick-value{fill:var(--vc-tick-color);font-size:var(--vc-tick-size);font-weight:var(--vc-tick-weight)}.vue-chrts:is(.dark,[data-theme=dark],.dark *,[data-theme=dark] *),:is(.dark,[data-theme=dark]) .vue-chrts{--vc-grid-color:var(--border,oklch(0.269 0 0));--vc-axis-line-color:var(--border,oklch(0.269 0 0));--vc-tick-color:var(--muted-foreground,oklch(0.708 0 0));--vc-axis-label-color:var(--foreground,oklch(0.985 0 0));--vc-legend-color:var(--muted-foreground,oklch(0.708 0 0));--vc-hover-fill:color-mix(in oklab,oklch(0.985 0 0) 8%,transparent);--vc-tooltip-bg:var(--popover,oklch(0.205 0 0));--vc-tooltip-fg:var(--popover-foreground,oklch(0.985 0 0));--vc-tooltip-muted:var(--muted-foreground,oklch(0.708 0 0));--vc-tooltip-border:var(--border,oklch(0.269 0 0))}}
@@ -0,0 +1,19 @@
1
+ import type { AreaChartProps } from "../types/charts.js";
2
+ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<AreaChartProps<T>> & (typeof globalThis extends {
4
+ __VLS_PROPS_FALLBACK: infer P;
5
+ } ? P : {});
6
+ expose: (exposed: {}) => void;
7
+ attrs: any;
8
+ slots: {};
9
+ emit: {};
10
+ }>) => import("vue").VNode & {
11
+ __ctx?: Awaited<typeof __VLS_setup>;
12
+ };
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
15
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
16
+ [K in keyof T]: T[K];
17
+ } : {
18
+ [K in keyof T as K]: T[K];
19
+ }) & {};
@@ -0,0 +1,149 @@
1
+ <script setup>
2
+ import { computed, useId } from "vue";
3
+ import { Area, AreaChart as VccsAreaChart } from "vccs";
4
+ import CartesianFrame from "./internal/CartesianFrame.vue";
5
+ import GradientDefs from "./internal/GradientDefs";
6
+ import { categoriesToSeries } from "../utils/categories";
7
+ import { curveTypeToVccs } from "../utils/curve";
8
+ import { markerToDot, normalizeMarkerConfig, toStrokeDasharray } from "../utils/marker";
9
+ import { DEFAULT_GRADIENT_STOPS, gradientId } from "../utils/gradient";
10
+ import DitherDefs from "./internal/DitherDefs";
11
+ import { ditherId } from "../utils/dither";
12
+ const props = defineProps({
13
+ xAxis: { type: null, required: false },
14
+ curveType: { type: String, required: false },
15
+ hideArea: { type: Boolean, required: false },
16
+ gradient: { type: Boolean, required: false, default: true },
17
+ gradientStops: { type: Array, required: false },
18
+ dither: { type: [Boolean, String], required: false },
19
+ ditherTile: { type: Number, required: false },
20
+ ditherWash: { type: Number, required: false },
21
+ lineWidth: { type: Number, required: false },
22
+ stacked: { type: Boolean, required: false },
23
+ lineDashArray: { type: [Array, String], required: false },
24
+ markerConfig: { type: Object, required: false },
25
+ data: { type: Array, required: true },
26
+ height: { type: Number, required: true },
27
+ xLabel: { type: String, required: false },
28
+ yLabel: { type: String, required: false },
29
+ padding: { type: Object, required: false },
30
+ categories: { type: Object, required: true },
31
+ xFormatter: { type: Function, required: false },
32
+ yFormatter: { type: Function, required: false },
33
+ tooltipTitleFormatter: { type: Function, required: false },
34
+ xNumTicks: { type: Number, required: false },
35
+ yNumTicks: { type: Number, required: false },
36
+ hideLegend: { type: Boolean, required: false },
37
+ hideTooltip: { type: Boolean, required: false },
38
+ legendPosition: { type: String, required: false },
39
+ legendStyle: { type: [String, Object], required: false },
40
+ xDomainLine: { type: Boolean, required: false },
41
+ yDomainLine: { type: Boolean, required: false },
42
+ xTickLine: { type: Boolean, required: false },
43
+ yTickLine: { type: Boolean, required: false },
44
+ xGridLine: { type: Boolean, required: false },
45
+ yGridLine: { type: Boolean, required: false },
46
+ hideXAxis: { type: Boolean, required: false },
47
+ hideYAxis: { type: Boolean, required: false },
48
+ xDomain: { type: Array, required: false },
49
+ yDomain: { type: Array, required: false },
50
+ duration: { type: Number, required: false },
51
+ xAxisConfig: { type: Object, required: false },
52
+ yAxisConfig: { type: Object, required: false },
53
+ yAxes: { type: Object, required: false },
54
+ tooltip: { type: Object, required: false },
55
+ referenceLines: { type: Array, required: false },
56
+ syncId: { type: String, required: false },
57
+ minMaxTicksOnly: { type: Boolean, required: false },
58
+ xExplicitTicks: { type: Array, required: false },
59
+ yExplicitTicks: { type: Array, required: false },
60
+ crosshairConfig: { type: Object, required: false },
61
+ theme: { type: Object, required: false }
62
+ });
63
+ const gradientScope = useId();
64
+ const markers = computed(() => normalizeMarkerConfig(props.markerConfig));
65
+ const series = computed(
66
+ () => categoriesToSeries(props.categories).map((s) => ({
67
+ ...s,
68
+ dot: markerToDot(markers.value[s.dataKey], s.color)
69
+ }))
70
+ );
71
+ const curve = computed(() => curveTypeToVccs(props.curveType));
72
+ const stackId = computed(() => props.stacked ? "stack" : void 0);
73
+ const fillOpacity = computed(() => props.hideArea ? 0 : 0.6);
74
+ const dashArray = computed(() => toStrokeDasharray(props.lineDashArray));
75
+ const useDither = computed(
76
+ () => !props.hideArea && props.dither !== void 0 && props.dither !== false
77
+ );
78
+ const ditherVariant = computed(
79
+ () => typeof props.dither === "string" ? props.dither : "bayer"
80
+ );
81
+ const useGradientFill = computed(
82
+ () => !props.hideArea && props.gradient !== false && !useDither.value
83
+ );
84
+ const useDitherFade = computed(
85
+ () => useDither.value && props.gradient !== false
86
+ );
87
+ const gradientStops = computed(
88
+ () => props.gradientStops?.length ? props.gradientStops : DEFAULT_GRADIENT_STOPS
89
+ );
90
+ const ditherWashStops = computed(() => {
91
+ if (!useDitherFade.value) return void 0;
92
+ const scale = props.ditherWash ?? 1;
93
+ if (scale <= 0) return void 0;
94
+ return gradientStops.value.map((stop) => ({
95
+ ...stop,
96
+ stopOpacity: stop.stopOpacity * scale
97
+ }));
98
+ });
99
+ function fillFor(dataKey, color) {
100
+ if (useDither.value) return `url(#${ditherId(dataKey, gradientScope)})`;
101
+ if (useGradientFill.value) return `url(#${gradientId(dataKey, gradientScope)})`;
102
+ return color;
103
+ }
104
+ const xAxisKey = computed(() => props.xAxis !== void 0 ? String(props.xAxis) : void 0);
105
+ </script>
106
+
107
+ <template>
108
+ <CartesianFrame :container="VccsAreaChart" :x-axis-key="xAxisKey" v-bind="props">
109
+ <!--
110
+ GradientDefs builds SVG nodes with `h()` so they land in the SVG namespace
111
+ inside the chart surface. Do not wrap this in vccs `<Customized>`: that
112
+ component subscribes to the chart store and re-renders on every tooltip
113
+ mousemove, which recreates all gradients and freezes the page.
114
+ -->
115
+ <GradientDefs
116
+ v-if="useGradientFill"
117
+ :series="series"
118
+ :stops="gradientStops"
119
+ :scope="gradientScope"
120
+ />
121
+ <!-- Same namespace/`Customized` constraints as GradientDefs above. -->
122
+ <DitherDefs
123
+ v-if="useDither"
124
+ :series="series"
125
+ :variant="ditherVariant"
126
+ :scope="gradientScope"
127
+ :tile="ditherTile ?? 8"
128
+ :fade-stops="ditherWashStops"
129
+ :height="height"
130
+ />
131
+ <Area
132
+ v-for="s in series"
133
+ :key="s.dataKey"
134
+ :data-key="s.dataKey"
135
+ :name="s.name"
136
+ :y-axis-id="s.yAxisId"
137
+ :type="curve"
138
+ :stack-id="stackId"
139
+ :stroke="s.color"
140
+ :fill="fillFor(s.dataKey, s.color)"
141
+ :fill-opacity="useGradientFill || useDither ? 1 : fillOpacity"
142
+ :stroke-width="lineWidth ?? 2"
143
+ :stroke-dasharray="dashArray"
144
+ :dot="s.dot"
145
+ :hide="s.hidden"
146
+ :is-animation-active="duration !== void 0 && duration !== 0"
147
+ />
148
+ </CartesianFrame>
149
+ </template>
@@ -0,0 +1,19 @@
1
+ import type { AreaChartProps } from "../types/charts.js";
2
+ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<AreaChartProps<T>> & (typeof globalThis extends {
4
+ __VLS_PROPS_FALLBACK: infer P;
5
+ } ? P : {});
6
+ expose: (exposed: {}) => void;
7
+ attrs: any;
8
+ slots: {};
9
+ emit: {};
10
+ }>) => import("vue").VNode & {
11
+ __ctx?: Awaited<typeof __VLS_setup>;
12
+ };
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
15
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
16
+ [K in keyof T]: T[K];
17
+ } : {
18
+ [K in keyof T as K]: T[K];
19
+ }) & {};
@@ -0,0 +1,19 @@
1
+ import type { BarChartProps } from "../types/charts.js";
2
+ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<BarChartProps<T>> & (typeof globalThis extends {
4
+ __VLS_PROPS_FALLBACK: infer P;
5
+ } ? P : {});
6
+ expose: (exposed: {}) => void;
7
+ attrs: any;
8
+ slots: {};
9
+ emit: {};
10
+ }>) => import("vue").VNode & {
11
+ __ctx?: Awaited<typeof __VLS_setup>;
12
+ };
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
15
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
16
+ [K in keyof T]: T[K];
17
+ } : {
18
+ [K in keyof T as K]: T[K];
19
+ }) & {};