@octanejs/recharts 0.1.32 → 0.1.34
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octanejs/recharts",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.34",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -21,13 +21,16 @@
|
|
|
21
21
|
},
|
|
22
22
|
"main": "src/index.ts",
|
|
23
23
|
"module": "src/index.ts",
|
|
24
|
-
"types": "src/index.ts",
|
|
24
|
+
"types": "src/index.d.ts",
|
|
25
25
|
"files": [
|
|
26
26
|
"src",
|
|
27
27
|
"README.md"
|
|
28
28
|
],
|
|
29
29
|
"exports": {
|
|
30
|
-
".":
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./src/index.d.ts",
|
|
32
|
+
"default": "./src/index.ts"
|
|
33
|
+
}
|
|
31
34
|
},
|
|
32
35
|
"dependencies": {
|
|
33
36
|
"@reduxjs/toolkit": "^2.12.0",
|
|
@@ -39,10 +42,10 @@
|
|
|
39
42
|
"reselect": "5.2.0",
|
|
40
43
|
"tiny-invariant": "^1.3.3",
|
|
41
44
|
"victory-vendor": "^37.3.6",
|
|
42
|
-
"@octanejs/redux": "0.1.
|
|
45
|
+
"@octanejs/redux": "0.1.34"
|
|
43
46
|
},
|
|
44
47
|
"peerDependencies": {
|
|
45
|
-
"octane": "0.1.
|
|
48
|
+
"octane": "0.1.37"
|
|
46
49
|
},
|
|
47
50
|
"devDependencies": {
|
|
48
51
|
"@tsrx/react": "^0.2.56",
|
|
@@ -51,7 +54,7 @@
|
|
|
51
54
|
"react-dom": "^19.2.7",
|
|
52
55
|
"recharts": "3.9.2",
|
|
53
56
|
"vitest": "^4.1.10",
|
|
54
|
-
"octane": "0.1.
|
|
57
|
+
"octane": "0.1.37"
|
|
55
58
|
},
|
|
56
59
|
"scripts": {
|
|
57
60
|
"test": "vitest run"
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Port of animation/AnimationController.ts — upstream ships this module as
|
|
2
|
+
// types only (its compiled `es6/animation/AnimationController.js` is `export {}`),
|
|
3
|
+
// so the vendoring pass that copies recharts' compiled JS skipped it and left
|
|
4
|
+
// `CSSTransitionAnimate` importing a module that does not exist.
|
|
5
|
+
//
|
|
6
|
+
// `TimeoutController`, `CallbackType` and `CancelableTimeout` live in
|
|
7
|
+
// `animation/timeoutController.ts` upstream, and `AnimationHandle` is exported
|
|
8
|
+
// as a type from `animation/AnimationHandle.ts`. Both of those modules are
|
|
9
|
+
// vendored here as compiled `.js`, which carries their runtime classes but
|
|
10
|
+
// erases every type-only export, so they cannot be imported by name yet. They
|
|
11
|
+
// are co-located here until those two modules are typed; move them back to
|
|
12
|
+
// their upstream homes at that point rather than growing this module.
|
|
13
|
+
import type { CSSTransitionAnimation, JavascriptAnimation } from './AnimationHandle';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Callback type for the timeout function.
|
|
17
|
+
* Receives current time as an argument.
|
|
18
|
+
*/
|
|
19
|
+
export type CallbackType = (now: number) => void;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A function that, when called, cancels the timeout.
|
|
23
|
+
*
|
|
24
|
+
* @since 3.9
|
|
25
|
+
*/
|
|
26
|
+
export type CancelableTimeout = () => void;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* TimeoutController is responsible for controlling the movement of time.
|
|
30
|
+
* Think of it as a clock.
|
|
31
|
+
*
|
|
32
|
+
* Recharts default implementation uses requestAnimationFrame which works great
|
|
33
|
+
* in a browser. You may choose to override this which is especially useful if
|
|
34
|
+
* you want to control animations.
|
|
35
|
+
*
|
|
36
|
+
* @see {@link https://recharts.github.io/en-US/guide/animations/ Animation guide}
|
|
37
|
+
*
|
|
38
|
+
* @since 3.9
|
|
39
|
+
*/
|
|
40
|
+
export interface TimeoutController {
|
|
41
|
+
/**
|
|
42
|
+
* Sets a timeout that executes a callback after a specified delay.
|
|
43
|
+
* Allows setting multiple timeouts and provides a way to cancel them
|
|
44
|
+
* independently.
|
|
45
|
+
*
|
|
46
|
+
* The input (`delay`) is relative — "wait for this long". The output (`now`,
|
|
47
|
+
* the callback's parameter) is absolute — "this is the time now".
|
|
48
|
+
*/
|
|
49
|
+
setTimeout(callback: CallbackType, delay?: number): CancelableTimeout;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Recharts animation state machine.
|
|
54
|
+
*
|
|
55
|
+
* @see {@link https://recharts.github.io/en-US/guide/animations/ Animation guide}
|
|
56
|
+
*
|
|
57
|
+
* @since 3.9
|
|
58
|
+
*/
|
|
59
|
+
export type AnimationHandle = JavascriptAnimation | CSSTransitionAnimation;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* It's actually always the case that JavaScript-based animations produce numbers,
|
|
63
|
+
* and CSS transition-based animations always produce strings,
|
|
64
|
+
* but it's so much easier to just have them together than to deal with all the generics.
|
|
65
|
+
*
|
|
66
|
+
* @see {@link https://recharts.github.io/en-US/guide/animations/ Animation guide}
|
|
67
|
+
*
|
|
68
|
+
* @since 3.9
|
|
69
|
+
*/
|
|
70
|
+
export type OnAnimationStateUpdate = (newState: number | string) => void;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* AnimationController accepts the animation state machine (= RechartsAnimation) plus a timeout controller,
|
|
74
|
+
* and manages the animation by calling the tick method of the animation state machine at the right time.
|
|
75
|
+
*
|
|
76
|
+
* One controller is only responsible for one animation. Every new animation will create a new controller.
|
|
77
|
+
*
|
|
78
|
+
* The animation state machine is responsible for calculating the animation progress
|
|
79
|
+
* and calling the onAnimationStart and onAnimationEnd callbacks at the right time,
|
|
80
|
+
* while the AnimationController is responsible for calling the tick method of the animation state machine.
|
|
81
|
+
*
|
|
82
|
+
* @see {@link https://recharts.github.io/en-US/guide/animations/ Animation guide}
|
|
83
|
+
*
|
|
84
|
+
* @since 3.9
|
|
85
|
+
*/
|
|
86
|
+
export type AnimationController = (
|
|
87
|
+
timeoutController: TimeoutController,
|
|
88
|
+
animationHandle: AnimationHandle,
|
|
89
|
+
listener: OnAnimationStateUpdate,
|
|
90
|
+
) => CancelableTimeout;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'octane';
|
|
2
|
-
import {
|
|
2
|
+
import { useCallback, useEffect, useRef, useState, type OctaneNode } from 'octane';
|
|
3
|
+
import type { Octane } from 'octane/jsx-runtime';
|
|
3
4
|
import { noop } from '../util/DataUtils';
|
|
4
5
|
import { resolveDefaultProps } from '../util/resolveDefaultProps';
|
|
5
6
|
import { useAnimationController } from './useAnimationController';
|
|
@@ -11,6 +12,12 @@ import { RequestAnimationFrameTimeoutController } from './timeoutController';
|
|
|
11
12
|
import { EasingInput, NamedBezier } from './easing';
|
|
12
13
|
import type { AnimationController } from './AnimationController';
|
|
13
14
|
|
|
15
|
+
// `octane` does not export `CSSProperties`. The object form of octane's JSX
|
|
16
|
+
// `style` prop is the type this render prop hands out, so take it from there
|
|
17
|
+
// (`octane/jsx-runtime` types it as `string | React.CSSProperties`) rather than
|
|
18
|
+
// importing @types/react, which this package does not depend on.
|
|
19
|
+
type CSSProperties = Exclude<NonNullable<Octane.HTMLAttributes<Element>['style']>, string>;
|
|
20
|
+
|
|
14
21
|
type CSSTransitionAnimateProps = {
|
|
15
22
|
animationId: string;
|
|
16
23
|
animationController?: AnimationController;
|
package/src/index.d.ts
CHANGED
|
@@ -155,7 +155,10 @@ export type BarShapeProps = Omit<RechartsProps, 'payload'> & {
|
|
|
155
155
|
};
|
|
156
156
|
export type BrushProps = RechartsProps;
|
|
157
157
|
export type CartesianGridProps = RechartsProps;
|
|
158
|
+
export type DefaultLegendContentProps = RechartsProps;
|
|
159
|
+
export type DefaultTooltipContentProps = RechartsProps;
|
|
158
160
|
export type DotProps = RechartsProps;
|
|
161
|
+
export type ErrorBarProps = RechartsProps;
|
|
159
162
|
export type FunnelProps = RechartsProps;
|
|
160
163
|
export type LabelListProps = RechartsProps;
|
|
161
164
|
export type LabelProps = RechartsProps;
|
|
@@ -194,6 +197,10 @@ export type TooltipProps<
|
|
|
194
197
|
> = RechartsProps & {
|
|
195
198
|
formatter?: (value: TValue, name: TName, ...rest: any[]) => OctaneNode;
|
|
196
199
|
};
|
|
200
|
+
export type TooltipFormatter<
|
|
201
|
+
TValue extends ValueType = ValueType,
|
|
202
|
+
TName extends NameType = NameType,
|
|
203
|
+
> = NonNullable<TooltipProps<TValue, TName>['formatter']>;
|
|
197
204
|
export type TreemapProps = RechartsProps;
|
|
198
205
|
export type XAxisProps = RechartsProps;
|
|
199
206
|
export type YAxisProps = RechartsProps;
|
|
@@ -203,18 +210,30 @@ export declare const Area: Component<AreaProps>;
|
|
|
203
210
|
export declare const AreaChart: Component<ChartProps>;
|
|
204
211
|
export declare const Bar: Component<BarProps>;
|
|
205
212
|
export declare const BarChart: Component<ChartProps>;
|
|
206
|
-
export declare const
|
|
213
|
+
export declare const BarStack: Component<RechartsProps>;
|
|
207
214
|
export declare const CartesianGrid: Component<CartesianGridProps>;
|
|
215
|
+
export declare const CartesianAxis: Component<RechartsProps>;
|
|
216
|
+
export declare const CartesianChart: Component<ChartProps>;
|
|
217
|
+
export declare const Cell: Component<Record<string, unknown>>;
|
|
208
218
|
export declare const ComposedChart: Component<ChartProps>;
|
|
219
|
+
export declare const Cross: Component<RechartsProps>;
|
|
220
|
+
export declare const Curve: Component<RechartsProps>;
|
|
221
|
+
export declare const DefaultLegendContent: Component<DefaultLegendContentProps>;
|
|
222
|
+
export declare const DefaultTooltipContent: Component<DefaultTooltipContentProps>;
|
|
223
|
+
export declare const Dot: Component<DotProps>;
|
|
224
|
+
export declare const ErrorBar: Component<ErrorBarProps>;
|
|
209
225
|
export declare const Funnel: Component<FunnelProps>;
|
|
210
226
|
export declare const FunnelChart: Component<ChartProps>;
|
|
227
|
+
export declare const Layer: Component<RechartsProps>;
|
|
211
228
|
export declare const Label: Component<LabelProps>;
|
|
212
229
|
export declare const LabelList: Component<LabelListProps>;
|
|
213
230
|
export declare const Legend: Component<LegendProps>;
|
|
214
231
|
export declare const Line: Component<LineProps>;
|
|
215
232
|
export declare const LineChart: Component<ChartProps>;
|
|
233
|
+
export declare const LineDrawShape: Component<RechartsProps>;
|
|
216
234
|
export declare const Pie: Component<PieProps>;
|
|
217
235
|
export declare const PieChart: Component<ChartProps>;
|
|
236
|
+
export declare const Polygon: Component<RechartsProps>;
|
|
218
237
|
export declare const PolarAngleAxis: Component<PolarAngleAxisProps>;
|
|
219
238
|
export declare const PolarGrid: Component<PolarGridProps>;
|
|
220
239
|
export declare const PolarRadiusAxis: Component<PolarRadiusAxisProps>;
|
|
@@ -228,9 +247,35 @@ export declare const ResponsiveContainer: Component<ResponsiveContainerProps>;
|
|
|
228
247
|
export declare const Sankey: Component<SankeyProps>;
|
|
229
248
|
export declare const Scatter: Component<ScatterProps>;
|
|
230
249
|
export declare const ScatterChart: Component<ChartProps>;
|
|
250
|
+
export declare const Sector: Component<RechartsProps>;
|
|
231
251
|
export declare const SunburstChart: Component<SunburstChartProps>;
|
|
252
|
+
export declare const Surface: Component<RechartsProps>;
|
|
253
|
+
export declare const Symbols: Component<RechartsProps>;
|
|
254
|
+
export declare const Text: Component<RechartsProps>;
|
|
232
255
|
export declare const Tooltip: Component<TooltipProps>;
|
|
233
|
-
export declare const
|
|
256
|
+
export declare const Trapezoid: Component<RechartsProps>;
|
|
234
257
|
export declare const XAxis: Component<XAxisProps>;
|
|
235
258
|
export declare const YAxis: Component<YAxisProps>;
|
|
236
259
|
export declare const ZAxis: Component<ZAxisProps>;
|
|
260
|
+
export declare const ZIndexLayer: Component<RechartsProps>;
|
|
261
|
+
|
|
262
|
+
export declare const AnimationControllerProvider: Component<{ children?: OctaneNode }>;
|
|
263
|
+
|
|
264
|
+
export declare function useChartWidth(): number | undefined;
|
|
265
|
+
export declare function useChartHeight(): number | undefined;
|
|
266
|
+
export declare function useMargin(): unknown;
|
|
267
|
+
export declare function useChartLayout(): RechartsProps['layout'] | undefined;
|
|
268
|
+
export declare function useCartesianChartLayout(): 'horizontal' | 'vertical' | undefined;
|
|
269
|
+
export declare function usePolarChartLayout(): 'centric' | 'radial' | undefined;
|
|
270
|
+
export declare function useIsInChartContext(): boolean;
|
|
271
|
+
export declare function useViewBox(): unknown;
|
|
272
|
+
export declare function useXAxis(xAxisId?: string | number): unknown;
|
|
273
|
+
export declare function useYAxis(yAxisId?: string | number): unknown;
|
|
274
|
+
export declare function useXAxisScale(xAxisId?: string | number): unknown;
|
|
275
|
+
export declare function useYAxisScale(yAxisId?: string | number): unknown;
|
|
276
|
+
export declare function useXAxisInverseScale(xAxisId?: string | number): unknown;
|
|
277
|
+
export declare function useYAxisInverseScale(yAxisId?: string | number): unknown;
|
|
278
|
+
export declare function useOffset(): unknown;
|
|
279
|
+
export declare function usePlotArea(): unknown;
|
|
280
|
+
export declare function useActiveTooltipLabel(): unknown;
|
|
281
|
+
export declare function useActiveTooltipDataPoints(): unknown;
|