nuxt-charts 2.2.1 → 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
@@ -0,0 +1,12 @@
1
+ import { CurveType } from "../enums.js";
2
+ /**
3
+ * The subset of `vccs` curve `type` strings we map onto. `vccs`'s union also
4
+ * includes `bump*` variants and a `CurveFactory`, which the v2 `CurveType`
5
+ * enum has no members for, so they're unreachable here.
6
+ */
7
+ export type VccsCurveType = "basis" | "basisClosed" | "basisOpen" | "linear" | "linearClosed" | "natural" | "monotoneX" | "monotoneY" | "monotone" | "step" | "stepBefore" | "stepAfter";
8
+ /**
9
+ * Translate a {@link CurveType} into the `vccs` curve `type` string.
10
+ * Defaults to `monotone` when unset (matches v2's smooth default).
11
+ */
12
+ export declare function curveTypeToVccs(curve: CurveType | undefined): VccsCurveType;
@@ -0,0 +1,26 @@
1
+ import { CurveType } from "../enums.js";
2
+ const CURVE_MAP = {
3
+ [CurveType.Basis]: "basis",
4
+ [CurveType.BasisClosed]: "basisClosed",
5
+ [CurveType.BasisOpen]: "basisOpen",
6
+ // No direct vccs equivalent — basis is the closest smooth spline.
7
+ [CurveType.Bundle]: "basis",
8
+ [CurveType.Cardinal]: "natural",
9
+ [CurveType.CardinalClosed]: "basisClosed",
10
+ [CurveType.CardinalOpen]: "basisOpen",
11
+ [CurveType.CatmullRom]: "natural",
12
+ [CurveType.CatmullRomClosed]: "basisClosed",
13
+ [CurveType.CatmullRomOpen]: "basisOpen",
14
+ [CurveType.Linear]: "linear",
15
+ [CurveType.LinearClosed]: "linearClosed",
16
+ [CurveType.MonotoneX]: "monotoneX",
17
+ [CurveType.MonotoneY]: "monotoneY",
18
+ [CurveType.Natural]: "natural",
19
+ [CurveType.Step]: "step",
20
+ [CurveType.StepAfter]: "stepAfter",
21
+ [CurveType.StepBefore]: "stepBefore"
22
+ };
23
+ export function curveTypeToVccs(curve) {
24
+ if (curve === void 0) return "monotone";
25
+ return CURVE_MAP[curve];
26
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Dithered area fills.
3
+ *
4
+ * Instead of a smooth gradient, the area is filled with a tiling SVG
5
+ * `<pattern>` of dots whose size steps down the height of the plot — the
6
+ * halftone/ordered-dither look. Each variant is a list of rows; a row's
7
+ * `radius` is a fraction of the tile size, so tiles stay crisp at any scale.
8
+ */
9
+ /** Built-in dither treatments for an area fill. */
10
+ export type DitherVariant = "bayer" | "noise" | "fade";
11
+ /** All variants, in the order a UI should cycle through them. */
12
+ export declare const DITHER_VARIANTS: DitherVariant[];
13
+ /**
14
+ * Build a deterministic pattern id so the `<defs>` element and the
15
+ * `fill="url(#id)"` reference agree. Mirrors `gradientId`.
16
+ */
17
+ export declare function ditherId(dataKey: string, scope?: string): string;
18
+ /**
19
+ * Id for the repeating dot tile of a series.
20
+ *
21
+ * Separate from `ditherId` because a faded dither composes two paints: this
22
+ * tile is painted over a gradient wash inside the plot-sized pattern that
23
+ * `ditherId` names and the area's `fill` actually references.
24
+ */
25
+ export declare function dotsId(dataKey: string, scope?: string): string;
26
+ /**
27
+ * Id for the shared vertical fade applied to the dot texture. One per chart
28
+ * scope — the stops carry opacity only, so every series can reuse it.
29
+ */
30
+ export declare function ditherFadeMaskId(scope: string): string;
31
+ /** One dot within a dither tile, in tile-relative units (0–1). */
32
+ export interface DitherDot {
33
+ /** Horizontal centre, as a fraction of the tile width. */
34
+ cx: number;
35
+ /** Vertical centre, as a fraction of the tile height. */
36
+ cy: number;
37
+ /** Dot radius, as a fraction of the tile width. */
38
+ r: number;
39
+ }
40
+ /** Geometry + sizing for one dither variant. */
41
+ export interface DitherPattern {
42
+ /** Tile edge length in user units (px). */
43
+ tile: number;
44
+ /** Dots within a single tile. */
45
+ dots: DitherDot[];
46
+ }
47
+ /**
48
+ * Build the dot geometry for a variant.
49
+ *
50
+ * - `bayer` — uniform grid, radius stepped by the Bayer matrix.
51
+ * - `noise` — same radii, but each dot jittered off the grid for a grain look.
52
+ * - `fade` — radius scales with the row, so the tile reads denser at its top;
53
+ * stacked vertically this makes the fill thin out toward the baseline.
54
+ */
55
+ export declare function buildDitherPattern(variant: DitherVariant, tile?: number): DitherPattern;
@@ -0,0 +1,45 @@
1
+ export const DITHER_VARIANTS = ["bayer", "noise", "fade"];
2
+ export function ditherId(dataKey, scope) {
3
+ const id = scope ? `${scope}-${dataKey}` : dataKey;
4
+ return `nc-dither-${id.replace(/[^a-zA-Z0-9_-]/g, "-")}`;
5
+ }
6
+ export function dotsId(dataKey, scope) {
7
+ return `${ditherId(dataKey, scope)}-dots`;
8
+ }
9
+ export function ditherFadeMaskId(scope) {
10
+ return `nc-dither-fade-${scope.replace(/[^a-zA-Z0-9_-]/g, "-")}`;
11
+ }
12
+ const BAYER_4X4 = [
13
+ [0, 8, 2, 10],
14
+ [12, 4, 14, 6],
15
+ [3, 11, 1, 9],
16
+ [15, 7, 13, 5]
17
+ ];
18
+ const NOISE_OFFSETS = [
19
+ [0.18, 0.72, 0.41, 0.94],
20
+ [0.63, 0.07, 0.86, 0.29],
21
+ [0.35, 0.51, 0.12, 0.68],
22
+ [0.79, 0.24, 0.57, 0.03]
23
+ ];
24
+ const GRID = 4;
25
+ const DEFAULT_TILE = 8;
26
+ export function buildDitherPattern(variant, tile = DEFAULT_TILE) {
27
+ const dots = [];
28
+ const cell = 1 / GRID;
29
+ const maxRadius = cell * 0.5;
30
+ for (let row = 0; row < GRID; row++) {
31
+ for (let col = 0; col < GRID; col++) {
32
+ const threshold = (BAYER_4X4[row]?.[col] ?? 0) / (GRID * GRID);
33
+ const weight = variant === "fade" ? 1 - row / GRID : 1 - threshold;
34
+ const r = maxRadius * weight;
35
+ if (r <= 0) continue;
36
+ const jitter = variant === "noise" ? ((NOISE_OFFSETS[row]?.[col] ?? 0.5) - 0.5) * cell : 0;
37
+ dots.push({
38
+ cx: col * cell + cell / 2 + jitter,
39
+ cy: row * cell + cell / 2 + jitter,
40
+ r
41
+ });
42
+ }
43
+ }
44
+ return { tile, dots };
45
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Build a deterministic gradient id for one series so the `<defs>` element and
3
+ * the `fill="url(#id)"` reference agree.
4
+ */
5
+ export declare function gradientId(dataKey: string, scope?: string): string;
6
+ /** One stop in a vertical area-fill gradient. */
7
+ export interface GradientStop {
8
+ offset: string;
9
+ stopOpacity: number;
10
+ }
11
+ /** Default vertical fade used for the area fill when no explicit stops are given. */
12
+ export declare const DEFAULT_GRADIENT_STOPS: GradientStop[];
@@ -0,0 +1,8 @@
1
+ export function gradientId(dataKey, scope) {
2
+ const id = scope ? `${scope}-${dataKey}` : dataKey;
3
+ return `nc-grad-${id.replace(/[^a-zA-Z0-9_-]/g, "-")}`;
4
+ }
5
+ export const DEFAULT_GRADIENT_STOPS = [
6
+ { offset: "0%", stopOpacity: 0.6 },
7
+ { offset: "100%", stopOpacity: 0 }
8
+ ];
@@ -0,0 +1,6 @@
1
+ export * from "./categories.js";
2
+ export * from "./curve.js";
3
+ export * from "./legend.js";
4
+ export * from "./axis.js";
5
+ export * from "./style.js";
6
+ export * from "./cubes.js";
@@ -0,0 +1,6 @@
1
+ export * from "./categories.js";
2
+ export * from "./curve.js";
3
+ export * from "./legend.js";
4
+ export * from "./axis.js";
5
+ export * from "./style.js";
6
+ export * from "./cubes.js";
@@ -0,0 +1,27 @@
1
+ import type { CSSProperties } from "vue";
2
+ import { LegendPosition } from "../enums.js";
3
+ /** `vccs` `<Legend>` horizontal alignment. */
4
+ export type LegendAlign = "left" | "center" | "right";
5
+ /** `vccs` `<Legend>` vertical alignment. */
6
+ export type LegendVerticalAlign = "top" | "middle" | "bottom";
7
+ export interface VccsLegendProps {
8
+ align: LegendAlign;
9
+ verticalAlign: LegendVerticalAlign;
10
+ layout: "horizontal" | "vertical";
11
+ }
12
+ /**
13
+ * Translate a {@link LegendPosition} into `vccs` `<Legend>` props.
14
+ * Defaults to bottom-centre (matches v2).
15
+ */
16
+ export declare function legendPositionToLegendProps(position: LegendPosition | undefined): VccsLegendProps;
17
+ /**
18
+ * Gap between the plot area and the legend. Applied as wrapper padding on the
19
+ * side facing the chart so vccs's legend-size measurement reserves the extra
20
+ * space in chart margins (see `appendOffsetOfLegend` in vccs).
21
+ */
22
+ export declare const LEGEND_INSET: "var(--vc-legend-inset, 0.75rem)";
23
+ /**
24
+ * Build the `vccs` `<Legend wrapperStyle>` object: a position-aware inset
25
+ * between chart and legend, merged with any user `legendStyle` overrides.
26
+ */
27
+ export declare function resolveLegendWrapperStyle(position: LegendPosition | undefined, userStyle?: CSSProperties): CSSProperties;
@@ -0,0 +1,19 @@
1
+ import { LegendPosition } from "../enums.js";
2
+ const LEGEND_MAP = {
3
+ [LegendPosition.TopLeft]: { align: "left", verticalAlign: "top", layout: "horizontal" },
4
+ [LegendPosition.TopCenter]: { align: "center", verticalAlign: "top", layout: "horizontal" },
5
+ [LegendPosition.TopRight]: { align: "right", verticalAlign: "top", layout: "horizontal" },
6
+ [LegendPosition.BottomLeft]: { align: "left", verticalAlign: "bottom", layout: "horizontal" },
7
+ [LegendPosition.BottomCenter]: { align: "center", verticalAlign: "bottom", layout: "horizontal" },
8
+ [LegendPosition.BottomRight]: { align: "right", verticalAlign: "bottom", layout: "horizontal" }
9
+ };
10
+ export function legendPositionToLegendProps(position) {
11
+ if (position === void 0) return LEGEND_MAP[LegendPosition.BottomCenter];
12
+ return LEGEND_MAP[position];
13
+ }
14
+ export const LEGEND_INSET = "var(--vc-legend-inset, 0.75rem)";
15
+ export function resolveLegendWrapperStyle(position, userStyle) {
16
+ const { verticalAlign } = legendPositionToLegendProps(position);
17
+ const insetStyle = verticalAlign === "bottom" ? { paddingTop: LEGEND_INSET } : verticalAlign === "top" ? { paddingBottom: LEGEND_INSET } : {};
18
+ return { ...insetStyle, ...userStyle };
19
+ }
@@ -0,0 +1,20 @@
1
+ import type { MarkerConfig, MarkerSeriesConfig } from "../types/shared.js";
2
+ /**
3
+ * Normalise the v2 `markerConfig` (flat record, or legacy `{ id, config }`
4
+ * wrapper) into a flat `Record<seriesKey, MarkerSeriesConfig>`.
5
+ */
6
+ export declare function normalizeMarkerConfig(markerConfig: MarkerConfig | undefined): Record<string, MarkerSeriesConfig>;
7
+ /**
8
+ * Resolve the `vccs` `dot` prop for one series from its marker config.
9
+ * Returns `false` (no dot) when the series has no marker, otherwise a dot
10
+ * options object (`r`, `fill`, `stroke`, `strokeWidth`) `vccs` understands.
11
+ *
12
+ * `vccs` (recharts-shaped) renders circular dots; the v2 `type` (square /
13
+ * triangle / diamond) has no analog, so only the size / colours carry over.
14
+ */
15
+ export declare function markerToDot(marker: MarkerSeriesConfig | undefined, seriesColor: string): false | Record<string, unknown>;
16
+ /**
17
+ * Convert the v2 `lineDashArray` into an SVG `stroke-dasharray` string.
18
+ * Accepts the v2 `number[][]` form (first pattern used) or a ready string.
19
+ */
20
+ export declare function toStrokeDasharray(lineDashArray: number[][] | string | undefined): string | undefined;
@@ -0,0 +1,21 @@
1
+ export function normalizeMarkerConfig(markerConfig) {
2
+ if (!markerConfig) return {};
3
+ const wrapped = markerConfig;
4
+ if (wrapped.config) return wrapped.config;
5
+ return markerConfig;
6
+ }
7
+ export function markerToDot(marker, seriesColor) {
8
+ if (!marker) return false;
9
+ return {
10
+ r: marker.size ? marker.size / 2 : 3,
11
+ fill: marker.color ?? seriesColor,
12
+ stroke: marker.strokeColor ?? marker.color ?? seriesColor,
13
+ strokeWidth: marker.strokeWidth ?? 1
14
+ };
15
+ }
16
+ export function toStrokeDasharray(lineDashArray) {
17
+ if (lineDashArray === void 0) return void 0;
18
+ if (typeof lineDashArray === "string") return lineDashArray;
19
+ const first = lineDashArray[0];
20
+ return first?.length ? first.join(" ") : void 0;
21
+ }
@@ -0,0 +1,14 @@
1
+ import type { CSSProperties } from "vue";
2
+ /**
3
+ * Coerce a v2 `legendStyle` (a CSS string or a `Record<string,string>`) into the
4
+ * `CSSProperties` object `vccs`'s `<Legend wrapperStyle>` expects. A raw CSS
5
+ * string has no structured equivalent, so it's dropped (returns `undefined`)
6
+ * rather than asserted.
7
+ */
8
+ export declare function toCssProperties(style: string | Record<string, string> | undefined): CSSProperties | undefined;
9
+ /**
10
+ * Normalise a v2 domain tuple into a `vccs` axis `domain`. `vccs` requires both
11
+ * bounds to be defined; if either is missing the whole domain is dropped
12
+ * (returns `undefined`) so the axis auto-scales instead of erroring.
13
+ */
14
+ export declare function toAxisDomain(domain: [number | undefined, number | undefined] | undefined): readonly [number, number] | undefined;
@@ -0,0 +1,10 @@
1
+ export function toCssProperties(style) {
2
+ if (style === void 0 || typeof style === "string") return void 0;
3
+ return style;
4
+ }
5
+ export function toAxisDomain(domain) {
6
+ if (!domain) return void 0;
7
+ const [min, max] = domain;
8
+ if (min === void 0 || max === void 0) return void 0;
9
+ return [min, max];
10
+ }
@@ -0,0 +1,36 @@
1
+ import type { CSSProperties } from "vue";
2
+ import type { ChartTheme } from "../types/shared.js";
3
+ /**
4
+ * Flatten a {@link ChartTheme} into the `--vc-*` CSS custom properties the chart
5
+ * components read (`runtime/assets/theme.css`, `runtime/assets/components.css`).
6
+ * bound as an inline `style` on the `.vue-chrts` root, where it overrides the
7
+ * global token defaults (inline custom properties beat class-scoped ones).
8
+ *
9
+ * Only the keys the caller actually set produce a variable, so unset fields fall
10
+ * through to the shipped light/dark defaults. `hover.visible` is intentionally
11
+ * *not* a token — it toggles the vccs `<Tooltip cursor>` prop and is surfaced
12
+ * separately via {@link resolveHoverVisible}.
13
+ */
14
+ export declare function themeToVars(theme: ChartTheme | undefined): CSSProperties;
15
+ /**
16
+ * Whether the hover cursor should render. Defaults to `true`; only an explicit
17
+ * `hover.visible === false` disables it.
18
+ */
19
+ export declare function resolveHoverVisible(theme: ChartTheme | undefined): boolean;
20
+ /** Default matches `--vc-hover-radius` in `theme.css`. vccs `Rectangle` needs a number. */
21
+ export declare const DEFAULT_HOVER_RADIUS = 6;
22
+ /**
23
+ * Corner radius for the hover cursor rectangle. CSS vars can't be passed —
24
+ * vccs validates `radius` as `Number | Array`.
25
+ */
26
+ export declare function resolveHoverRadius(theme: ChartTheme | undefined): number;
27
+ /**
28
+ * Map per-axis tick *colour / size / weight* (from {@link AxisConfig}) onto
29
+ * scoped `--vc-{x|y}-tick-*` CSS variables read by
30
+ * `.v-charts-cartesian-axis-tick-value`. These are applied via CSS (not the
31
+ * vccs `tick` prop) because the stylesheet sets `fill` / `font-*`
32
+ * unconditionally, so a CSS rule always wins over an SVG presentation attr.
33
+ * Horizontal alignment is handled separately by the native `tick` prop, since
34
+ * it must live in SVG space to position correctly (see `toTickProp`).
35
+ */
36
+ export declare function axisTickVars(prefix: "x" | "y", tick: Record<string, unknown> | undefined): CSSProperties;
@@ -0,0 +1,45 @@
1
+ export function themeToVars(theme) {
2
+ const vars = {};
3
+ if (!theme) return vars;
4
+ const set = (name, value) => {
5
+ if (value !== void 0) vars[name] = String(value);
6
+ };
7
+ set("--vc-grid-color", theme.grid?.color);
8
+ set("--vc-grid-dash", theme.grid?.dash);
9
+ set("--vc-grid-width", theme.grid?.width);
10
+ set("--vc-tick-color", theme.axis?.tickColor);
11
+ set("--vc-tick-size", theme.axis?.tickSize);
12
+ set("--vc-tick-weight", theme.axis?.tickWeight);
13
+ set("--vc-axis-label-color", theme.axis?.labelColor);
14
+ set("--vc-axis-label-size", theme.axis?.labelSize);
15
+ set("--vc-axis-line-color", theme.axis?.lineColor);
16
+ set("--vc-legend-color", theme.legend?.color);
17
+ set("--vc-legend-size", theme.legend?.size);
18
+ set("--vc-legend-weight", theme.legend?.weight);
19
+ set("--vc-legend-gap", theme.legend?.gap);
20
+ set("--vc-legend-inset", theme.legend?.inset);
21
+ set("--vc-hover-fill", theme.hover?.fill);
22
+ set("--vc-hover-stroke", theme.hover?.stroke);
23
+ set("--vc-hover-radius", theme.hover?.radius);
24
+ set("--vc-tooltip-bg", theme.tooltip?.bg);
25
+ set("--vc-tooltip-fg", theme.tooltip?.fg);
26
+ set("--vc-tooltip-border", theme.tooltip?.border);
27
+ set("--vc-tooltip-radius", theme.tooltip?.radius);
28
+ return vars;
29
+ }
30
+ export function resolveHoverVisible(theme) {
31
+ return theme?.hover?.visible !== false;
32
+ }
33
+ export const DEFAULT_HOVER_RADIUS = 6;
34
+ export function resolveHoverRadius(theme) {
35
+ const r = theme?.hover?.radius;
36
+ return typeof r === "number" && Number.isFinite(r) ? r : DEFAULT_HOVER_RADIUS;
37
+ }
38
+ export function axisTickVars(prefix, tick) {
39
+ const vars = {};
40
+ if (!tick) return vars;
41
+ if (tick.fill !== void 0) vars[`--vc-${prefix}-tick-color`] = String(tick.fill);
42
+ if (tick.fontSize !== void 0) vars[`--vc-${prefix}-tick-size`] = String(tick.fontSize);
43
+ if (tick.fontWeight !== void 0) vars[`--vc-${prefix}-tick-weight`] = String(tick.fontWeight);
44
+ return vars;
45
+ }
package/package.json CHANGED
@@ -1,14 +1,44 @@
1
1
  {
2
2
  "name": "nuxt-charts",
3
- "version": "2.2.1",
4
- "description": "Nuxt module for vue-chrts (legacy Unovis engine)",
3
+ "version": "3.0.0-beta.0",
4
+ "description": "Beautiful chart components for Nuxt (vccs engine) — Area, Bar, Line, Donut, Bubble, Radar, Radial Bar, Funnel, Candlestick, Status Tracker",
5
5
  "license": "MIT",
6
+ "author": "Dennis Adriaansen <adriaansendennis@gmail.com>",
7
+ "homepage": "https://nuxtcharts.com",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/dennisadriaans/vue-chrts.git",
11
+ "directory": "packages/nuxt-charts-next"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/dennisadriaans/vue-chrts/issues"
15
+ },
16
+ "keywords": [
17
+ "nuxt",
18
+ "nuxt-module",
19
+ "vue",
20
+ "charts",
21
+ "chart",
22
+ "dataviz",
23
+ "visualization",
24
+ "vccs"
25
+ ],
6
26
  "type": "module",
7
27
  "exports": {
8
28
  ".": {
9
29
  "types": "./dist/types.d.mts",
10
30
  "import": "./dist/module.mjs",
11
31
  "default": "./dist/module.mjs"
32
+ },
33
+ "./types": {
34
+ "types": "./dist/runtime/types.d.ts",
35
+ "import": "./dist/runtime/types.js",
36
+ "default": "./dist/runtime/types.js"
37
+ },
38
+ "./enums": {
39
+ "types": "./dist/runtime/enums.d.ts",
40
+ "import": "./dist/runtime/enums.js",
41
+ "default": "./dist/runtime/enums.js"
12
42
  }
13
43
  },
14
44
  "main": "./dist/module.mjs",
@@ -17,7 +47,18 @@
17
47
  "dist"
18
48
  ],
19
49
  "dependencies": {
20
- "vue-chrts": "2.2.1"
50
+ "@types/d3-array": "^3.2.2",
51
+ "@types/d3-scale": "^4.0.9",
52
+ "@types/d3-selection": "^3.0.11",
53
+ "@types/d3-shape": "^3.1.8",
54
+ "@types/d3-zoom": "^3.0.8",
55
+ "d3-array": "^3.2.4",
56
+ "d3-scale": "^4.0.2",
57
+ "d3-selection": "^3.0.0",
58
+ "d3-shape": "^3.2.0",
59
+ "d3-zoom": "^3.0.0",
60
+ "motion-v": "^2.3.0",
61
+ "vccs": "^0.4.0"
21
62
  },
22
63
  "devDependencies": {
23
64
  "@nuxt/devtools": "^3.1.1",
@@ -27,30 +68,33 @@
27
68
  "@nuxt/module-builder": "^1.0.2",
28
69
  "@nuxt/schema": "^4.3.0",
29
70
  "@nuxt/test-utils": "^3.23.0",
30
- "@playwright/test": "^1.61.1",
31
71
  "@tailwindcss/vite": "^4.2.2",
32
72
  "@types/node": "latest",
33
- "changelogen": "^0.6.2",
34
- "commit-and-tag-version": "^12.5.1",
73
+ "@vitejs/plugin-vue": "^5.2.4",
74
+ "@vue/test-utils": "^2.4.11",
35
75
  "eslint": "^9.39.2",
76
+ "happy-dom": "^20.10.6",
36
77
  "nuxt": "^4.3.0",
37
78
  "tailwindcss": "^4.2.2",
38
79
  "typescript": "~5.9.3",
39
80
  "vitest": "^4.0.18",
40
81
  "vue-tsc": "^3.2.4"
41
82
  },
83
+ "publishConfig": {
84
+ "access": "public",
85
+ "tag": "beta"
86
+ },
42
87
  "scripts": {
43
88
  "dev": "nuxi dev playground",
44
- "build": "nuxi build playground",
89
+ "build": "nuxt-module-build build",
90
+ "build:playground": "nuxi build playground",
45
91
  "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
46
- "release": "pnpm run prepack && commit-and-tag-version && pnpm publish",
92
+ "release": "node ../../tools/release.mjs --package nuxt-charts",
47
93
  "lint": "eslint .",
48
94
  "typecheck": "pnpm run test:types",
49
95
  "test": "vitest run",
50
96
  "test:watch": "vitest watch",
51
- "test:e2e": "playwright test",
52
- "test:e2e:prod": "NUXT_CHARTS_E2E_MODE=prod playwright test",
53
- "test:e2e:all": "./scripts/run-e2e.sh",
54
- "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
97
+ "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
98
+ "release:dry": "node ../../tools/release.mjs --package nuxt-charts --dry-run"
55
99
  }
56
100
  }
@@ -1 +0,0 @@
1
- export { AreaChart, LineChart, BarChart, DonutChart, BubbleChart, GanttChart, DagreGraph, DualChart, SankeyChart, TopoJSONMap, DottedMap, } from "vue-chrts";
@@ -1,13 +0,0 @@
1
- export {
2
- AreaChart,
3
- LineChart,
4
- BarChart,
5
- DonutChart,
6
- BubbleChart,
7
- GanttChart,
8
- DagreGraph,
9
- DualChart,
10
- SankeyChart,
11
- TopoJSONMap,
12
- DottedMap
13
- } from "vue-chrts";