vccs 0.4.0 → 0.5.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 +4 -0
- package/dist/cartesian/axis/YAxis.d.ts +5 -5
- package/dist/cartesian/cartesian-axis/CartesianAxis.d.ts +11 -0
- package/dist/chart/{RechartsWrapper.d.ts → ChartsWrapper.d.ts} +19 -4
- package/dist/chart/Sankey.d.ts +327 -0
- package/dist/chart/SunburstChart.d.ts +249 -0
- package/dist/chart/Surface.d.ts +2 -2
- package/dist/chart/generateCategoricalChart.d.ts +6 -2
- package/dist/chart/index.d.ts +2 -0
- package/dist/chart/sankeyUtils.d.ts +36 -0
- package/dist/chart/sunburstUtils.d.ts +34 -0
- package/dist/container/Surface.d.ts +3 -3
- package/dist/es/cartesian/axis/YAxis.mjs +52 -5
- package/dist/es/cartesian/cartesian-axis/CartesianAxis.mjs +6 -1
- package/dist/es/cartesian/utils/get-ticks.mjs +3 -2
- package/dist/es/chart/{RechartsWrapper.mjs → ChartsWrapper.mjs} +37 -10
- package/dist/es/chart/Sankey.mjs +332 -0
- package/dist/es/chart/SunburstChart.mjs +229 -0
- package/dist/es/chart/Surface.vue_vue_type_script_setup_true_lang.mjs +7 -1
- package/dist/es/chart/Treemap.mjs +2 -2
- package/dist/es/chart/generateCategoricalChart.mjs +72 -43
- package/dist/es/chart/sankeyUtils.mjs +28 -0
- package/dist/es/chart/sunburstUtils.mjs +67 -0
- package/dist/es/components/Tooltip.mjs +15 -6
- package/dist/es/container/ResponsiveContainer.vue_vue_type_script_setup_true_lang.mjs +15 -2
- package/dist/es/container/Surface.mjs +5 -1
- package/dist/es/index.mjs +5 -2
- package/dist/es/polar/pie/Pie.mjs +1 -1
- package/dist/es/polar/pie/type.mjs +7 -0
- package/dist/es/polar/radar/Radar.mjs +9 -1
- package/dist/es/polar/radial-bar/RadialBar.mjs +1 -0
- package/dist/es/polar/radial-bar/type.mjs +7 -0
- package/dist/es/state/cartesianAxisSlice.mjs +13 -2
- package/dist/es/state/selectors/axisSelectors.mjs +2 -2
- package/dist/es/state/selectors/selectChartOffset.mjs +7 -4
- package/dist/es/state/touchEventsMiddleware.mjs +1 -1
- package/dist/es/utils/Global.mjs +18 -0
- package/dist/es/utils/YAxisUtils.mjs +29 -0
- package/dist/es/utils/attrs.mjs +2 -2
- package/dist/es/utils/validate.mjs +1 -2
- package/dist/hooks/publicHooks.d.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/polar/pie/type.d.ts +8 -0
- package/dist/polar/radar/Radar.d.ts +16 -0
- package/dist/polar/radial-bar/type.d.ts +8 -0
- package/dist/state/cartesianAxisSlice.d.ts +11 -3
- package/dist/state/selectors/combiners/combineActiveLabel.d.ts +1 -1
- package/dist/state/selectors/selectors.d.ts +1 -1
- package/dist/state/selectors/tooltipSelectors.d.ts +1 -1
- package/dist/types/axis.d.ts +11 -1
- package/dist/types/common.d.ts +1 -1
- package/dist/utils/Global.d.ts +9 -0
- package/dist/utils/YAxisUtils.d.ts +20 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/validate.d.ts +0 -1
- package/package.json +3 -1
|
@@ -33,7 +33,7 @@ export declare function useActiveTooltipCoordinate(): Readonly<import('vue').Sha
|
|
|
33
33
|
*
|
|
34
34
|
* @returns A reactive string label or undefined when no tooltip is active
|
|
35
35
|
*/
|
|
36
|
-
export declare function useActiveTooltipLabel(): Readonly<import('vue').ShallowRef<string>>;
|
|
36
|
+
export declare function useActiveTooltipLabel(): Readonly<import('vue').ShallowRef<string | number>>;
|
|
37
37
|
/**
|
|
38
38
|
* Returns the plot area rectangle { x, y, width, height }.
|
|
39
39
|
* This is the area inside all axes, legend, and brush — where graphical items render.
|
package/dist/index.d.ts
CHANGED
package/dist/polar/pie/type.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
|
+
import { AnimationOptions } from 'motion-v';
|
|
2
3
|
import { DataKey, VuePropsToType, WithSVGProps } from '../../types';
|
|
3
4
|
import { LegendType } from '../../types/legend';
|
|
4
5
|
import { TooltipType } from '../../types/tooltip';
|
|
@@ -75,6 +76,13 @@ export declare const PieVueProps: {
|
|
|
75
76
|
type: BooleanConstructor;
|
|
76
77
|
default: boolean;
|
|
77
78
|
};
|
|
79
|
+
transition: {
|
|
80
|
+
type: PropType<AnimationOptions>;
|
|
81
|
+
default: () => {
|
|
82
|
+
duration: number;
|
|
83
|
+
ease: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
78
86
|
label: {
|
|
79
87
|
type: BooleanConstructor;
|
|
80
88
|
default: boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
|
+
import { AnimationOptions } from 'motion-v';
|
|
2
3
|
import { DataKey } from '../../types';
|
|
3
4
|
import { LegendType } from '../../types/legend';
|
|
4
5
|
import { TooltipType } from '../../types/tooltip';
|
|
@@ -67,6 +68,13 @@ export declare const Radar: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
67
68
|
type: BooleanConstructor;
|
|
68
69
|
default: boolean;
|
|
69
70
|
};
|
|
71
|
+
transition: {
|
|
72
|
+
type: PropType<AnimationOptions>;
|
|
73
|
+
default: () => {
|
|
74
|
+
duration: number;
|
|
75
|
+
ease: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
70
78
|
activeDot: {
|
|
71
79
|
type: PropType<object | boolean>;
|
|
72
80
|
default: boolean;
|
|
@@ -136,6 +144,13 @@ export declare const Radar: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
136
144
|
type: BooleanConstructor;
|
|
137
145
|
default: boolean;
|
|
138
146
|
};
|
|
147
|
+
transition: {
|
|
148
|
+
type: PropType<AnimationOptions>;
|
|
149
|
+
default: () => {
|
|
150
|
+
duration: number;
|
|
151
|
+
ease: string;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
139
154
|
activeDot: {
|
|
140
155
|
type: PropType<object | boolean>;
|
|
141
156
|
default: boolean;
|
|
@@ -146,6 +161,7 @@ export declare const Radar: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
146
161
|
stroke: string;
|
|
147
162
|
strokeDasharray: string;
|
|
148
163
|
strokeWidth: number;
|
|
164
|
+
transition: AnimationOptions;
|
|
149
165
|
name: string;
|
|
150
166
|
label: boolean | Record<string, any>;
|
|
151
167
|
connectNulls: boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
|
+
import { AnimationOptions } from 'motion-v';
|
|
2
3
|
import { DataKey, VuePropsToType, WithSVGProps } from '../../types';
|
|
3
4
|
import { LegendType } from '../../types/legend';
|
|
4
5
|
import { TooltipType } from '../../types/tooltip';
|
|
@@ -64,6 +65,13 @@ export declare const RadialBarVueProps: {
|
|
|
64
65
|
type: BooleanConstructor;
|
|
65
66
|
default: boolean;
|
|
66
67
|
};
|
|
68
|
+
transition: {
|
|
69
|
+
type: PropType<AnimationOptions>;
|
|
70
|
+
default: () => {
|
|
71
|
+
duration: number;
|
|
72
|
+
ease: string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
67
75
|
minPointSize: {
|
|
68
76
|
type: NumberConstructor;
|
|
69
77
|
default: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxisRange } from './selectors/axisSelectors';
|
|
2
2
|
import { SVGAttributes } from 'vue';
|
|
3
3
|
import { RechartsScale, ScaleType } from '../types/scale';
|
|
4
|
-
import { AxisDomain, AxisDomainType, AxisInterval } from '../types/axis';
|
|
4
|
+
import { AxisDomain, AxisDomainType, AxisInterval, YAxisWidth } from '../types/axis';
|
|
5
5
|
import { DataKey } from '../types';
|
|
6
6
|
import { AxisTick, TickFormatter } from '../types/tick';
|
|
7
7
|
export type AxisId = string | number;
|
|
@@ -68,8 +68,13 @@ export type XAxisSettings = CartesianAxisSettings & {
|
|
|
68
68
|
};
|
|
69
69
|
export type YAxisSettings = CartesianAxisSettings & {
|
|
70
70
|
padding: YAxisPadding;
|
|
71
|
-
width:
|
|
71
|
+
width: YAxisWidth;
|
|
72
72
|
orientation: YAxisOrientation;
|
|
73
|
+
/**
|
|
74
|
+
* Internal: recent measured widths, used to detect A→B→A oscillation
|
|
75
|
+
* when width is measured dynamically (width === 'auto').
|
|
76
|
+
*/
|
|
77
|
+
widthHistory?: number[];
|
|
73
78
|
};
|
|
74
79
|
/**
|
|
75
80
|
* Z axis is special because it's never displayed. It controls the size of Scatter dots,
|
|
@@ -83,6 +88,9 @@ type AxisMapState = {
|
|
|
83
88
|
yAxis: Record<AxisId, YAxisSettings>;
|
|
84
89
|
zAxis: Record<AxisId, ZAxisSettings>;
|
|
85
90
|
};
|
|
86
|
-
export declare const addXAxis: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<XAxisSettings, "cartesianAxis/addXAxis">, removeXAxis: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<XAxisSettings, "cartesianAxis/removeXAxis">, addYAxis: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<YAxisSettings, "cartesianAxis/addYAxis">, removeYAxis: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<YAxisSettings, "cartesianAxis/removeYAxis">, addZAxis: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<ZAxisSettings, "cartesianAxis/addZAxis">, removeZAxis: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<ZAxisSettings, "cartesianAxis/removeZAxis"
|
|
91
|
+
export declare const addXAxis: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<XAxisSettings, "cartesianAxis/addXAxis">, removeXAxis: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<XAxisSettings, "cartesianAxis/removeXAxis">, addYAxis: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<YAxisSettings, "cartesianAxis/addYAxis">, removeYAxis: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<YAxisSettings, "cartesianAxis/removeYAxis">, addZAxis: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<ZAxisSettings, "cartesianAxis/addZAxis">, removeZAxis: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<ZAxisSettings, "cartesianAxis/removeZAxis">, updateYAxisWidth: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
92
|
+
id: AxisId;
|
|
93
|
+
width: number;
|
|
94
|
+
}, "cartesianAxis/updateYAxisWidth">;
|
|
87
95
|
export declare const cartesianAxisReducer: import('@reduxjs/toolkit').Reducer<AxisMapState>;
|
|
88
96
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { TooltipIndex } from '../../tooltipSlice';
|
|
2
2
|
import { TickItem } from '../../../types';
|
|
3
|
-
export declare function combineActiveLabel(tooltipTicks: ReadonlyArray<TickItem>, activeIndex: TooltipIndex): string | undefined;
|
|
3
|
+
export declare function combineActiveLabel(tooltipTicks: ReadonlyArray<TickItem>, activeIndex: TooltipIndex): string | number | undefined;
|
|
@@ -175,7 +175,7 @@ export declare function selectTooltipDataKey(state: RechartsRootState, tooltipEv
|
|
|
175
175
|
export declare const selectTooltipPayloadConfigurations: (state: RechartsRootState, tooltipEventType: TooltipEventType, trigger: TooltipTrigger, defaultIndex: TooltipIndex | undefined) => ReadonlyArray<TooltipPayloadConfiguration>;
|
|
176
176
|
export declare const selectCoordinateForDefaultIndex: (state: RechartsRootState, tooltipEventType: TooltipEventType, trigger: TooltipTrigger, defaultIndex: TooltipIndex | undefined) => Coordinate | undefined;
|
|
177
177
|
export declare const selectActiveCoordinate: (state: RechartsRootState, tooltipEventType: TooltipEventType, trigger: TooltipTrigger, defaultIndex: TooltipIndex | undefined) => Coordinate | undefined;
|
|
178
|
-
export declare const selectActiveLabel: (state: RechartsRootState, tooltipEventType: TooltipEventType, trigger: TooltipTrigger, defaultIndex: TooltipIndex | undefined) => string | undefined;
|
|
178
|
+
export declare const selectActiveLabel: (state: RechartsRootState, tooltipEventType: TooltipEventType, trigger: TooltipTrigger, defaultIndex: TooltipIndex | undefined) => string | number | undefined;
|
|
179
179
|
export declare const selectTooltipPayload: (state: RechartsRootState, tooltipEventType: TooltipEventType, trigger: TooltipTrigger, defaultIndex: TooltipIndex | undefined) => TooltipPayload | undefined;
|
|
180
180
|
export declare const selectIsTooltipActive: (state: RechartsRootState, tooltipEventType: TooltipEventType, trigger: TooltipTrigger, defaultIndex: TooltipIndex | undefined) => {
|
|
181
181
|
isActive: boolean;
|
|
@@ -518,7 +518,7 @@ export declare const selectTooltipAxisTicks: ((state: {
|
|
|
518
518
|
memoize: typeof import('@reduxjs/toolkit').weakMapMemoize;
|
|
519
519
|
};
|
|
520
520
|
export declare const selectActiveTooltipIndex: (state: RechartsRootState) => TooltipIndex | null;
|
|
521
|
-
export declare const selectActiveLabel: (state: RechartsRootState) => string | undefined;
|
|
521
|
+
export declare const selectActiveLabel: (state: RechartsRootState) => string | number | undefined;
|
|
522
522
|
export declare const selectActiveTooltipDataKey: (state: RechartsRootState) => DataKey<any> | undefined;
|
|
523
523
|
export declare const selectActiveTooltipCoordinate: (state: RechartsRootState) => Coordinate | undefined;
|
|
524
524
|
export declare const selectIsTooltipActive: (state: RechartsRootState) => boolean;
|
package/dist/types/axis.d.ts
CHANGED
|
@@ -63,10 +63,20 @@ export type YAxisPadding = {
|
|
|
63
63
|
bottom?: number;
|
|
64
64
|
} | 'gap' | 'no-gap';
|
|
65
65
|
export type YAxisOrientation = 'left' | 'right';
|
|
66
|
+
/**
|
|
67
|
+
* Width of the Y axis in pixels.
|
|
68
|
+
* `auto` will attempt to resize the axis based on its content.
|
|
69
|
+
*/
|
|
70
|
+
export type YAxisWidth = number | 'auto';
|
|
66
71
|
export type YAxisSettings = CartesianAxisSettings & {
|
|
67
72
|
padding: YAxisPadding;
|
|
68
|
-
width:
|
|
73
|
+
width: YAxisWidth;
|
|
69
74
|
orientation: YAxisOrientation;
|
|
75
|
+
/**
|
|
76
|
+
* Internal: recent measured widths, used to detect A→B→A oscillation
|
|
77
|
+
* when width is measured dynamically (width === 'auto').
|
|
78
|
+
*/
|
|
79
|
+
widthHistory?: number[];
|
|
70
80
|
};
|
|
71
81
|
export type AxisRange = readonly [number, number];
|
|
72
82
|
/**
|
package/dist/types/common.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export type MouseHandlerDataParam = {
|
|
|
49
49
|
* Exactly the same as activeTooltipIndex - this was also duplicated in recharts@2 so let's keep both properties for better backwards compatibility.
|
|
50
50
|
*/
|
|
51
51
|
activeIndex: number | TooltipIndex | undefined;
|
|
52
|
-
activeLabel: string | undefined;
|
|
52
|
+
activeLabel: string | number | undefined;
|
|
53
53
|
activeDataKey: DataKey<any> | undefined;
|
|
54
54
|
activeCoordinate: Coordinate | undefined;
|
|
55
55
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type IGetBoundingClient = Pick<Element, 'getBoundingClientRect'>;
|
|
2
|
+
/**
|
|
3
|
+
* Calculates the width of the Y-axis based on the tick labels and the axis label.
|
|
4
|
+
* @param params - The parameters object.
|
|
5
|
+
* @param [params.ticks] - An array-like object of tick elements, each with a `getBoundingClientRect` method.
|
|
6
|
+
* @param [params.label] - The axis label element, with a `getBoundingClientRect` method.
|
|
7
|
+
* @param [params.labelGapWithTick] - The gap between the label and the tick.
|
|
8
|
+
* @param [params.tickSize] - The length of the tick line.
|
|
9
|
+
* @param [params.tickMargin] - The margin between the tick line and the tick text.
|
|
10
|
+
* @returns The calculated width of the Y-axis.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getCalculatedYAxisWidth({ ticks, label, labelGapWithTick, // Default gap between label and tick
|
|
13
|
+
tickSize, tickMargin, }: {
|
|
14
|
+
ticks: ArrayLike<IGetBoundingClient> | null;
|
|
15
|
+
label: IGetBoundingClient | null | undefined;
|
|
16
|
+
labelGapWithTick: number | undefined;
|
|
17
|
+
tickSize: number | undefined;
|
|
18
|
+
tickMargin: number | undefined;
|
|
19
|
+
}): number;
|
|
20
|
+
export {};
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/validate.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export declare function isWellBehavedNumber(n: unknown): n is number;
|
|
|
15
15
|
export declare function isPercent(value: string | number): value is `${number}%`;
|
|
16
16
|
export declare function isCategoricalAxis(layout: LayoutType, axisType: AxisType): boolean;
|
|
17
17
|
export declare function isVisible(sign: number, tickPosition: number, getSize: () => number, start: number, end: number): boolean;
|
|
18
|
-
export declare const isSsr: boolean;
|
|
19
18
|
/**
|
|
20
19
|
* Checks if the value is null or undefined
|
|
21
20
|
* @param {any} value The value to check
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vccs",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"description": "Composable charting components for Vue 3 — an unofficial port of Recharts",
|
|
6
6
|
"author": "rick-hup",
|
|
7
7
|
"license": "MIT",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"@reduxjs/vue-redux": "^1.0.1",
|
|
49
49
|
"@vueuse/core": "^13.1.0",
|
|
50
50
|
"d3-hierarchy": "^3.1.2",
|
|
51
|
+
"d3-sankey": "^0.12.3",
|
|
51
52
|
"decimal.js-light": "^2.5.1",
|
|
52
53
|
"es-toolkit": "^1.39.3",
|
|
53
54
|
"eventemitter3": "^5.0.1",
|
|
@@ -56,6 +57,7 @@
|
|
|
56
57
|
"victory-vendor": "^37.3.6"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
60
|
+
"@types/d3-sankey": "^0.12.5",
|
|
59
61
|
"@types/lodash-es": "^4.17.12",
|
|
60
62
|
"@vitejs/plugin-vue-jsx": "^5.0.0",
|
|
61
63
|
"@vue/babel-plugin-jsx": "^1.1.1",
|