@octanejs/recharts 0.1.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/LICENSE +21 -0
- package/package.json +53 -0
- package/src/animation/AnimatedItems.tsrx +82 -0
- package/src/animation/AnimationControllerImpl.js +33 -0
- package/src/animation/AnimationHandle.js +291 -0
- package/src/animation/JavascriptAnimate.tsrx +81 -0
- package/src/animation/easing.js +193 -0
- package/src/animation/matchBy.js +279 -0
- package/src/animation/timeoutController.js +49 -0
- package/src/animation/useAnimationController.ts +22 -0
- package/src/animation/useAnimationStartSnapshot.ts +43 -0
- package/src/animation/util.js +11 -0
- package/src/cartesian/Bar.ts +4 -0
- package/src/cartesian/Bar.tsrx +716 -0
- package/src/cartesian/Bar.tsrx.d.ts +4 -0
- package/src/cartesian/BarStack.tsrx +97 -0
- package/src/cartesian/BarStack.tsrx.d.ts +6 -0
- package/src/cartesian/CartesianAxis.tsrx +413 -0
- package/src/cartesian/CartesianAxis.tsrx.d.ts +3 -0
- package/src/cartesian/GraphicalItemClipPath.tsrx +44 -0
- package/src/cartesian/Line.ts +4 -0
- package/src/cartesian/Line.tsrx +544 -0
- package/src/cartesian/Line.tsrx.d.ts +4 -0
- package/src/cartesian/LineDrawShape.tsrx +106 -0
- package/src/cartesian/LineDrawShape.tsrx.d.ts +2 -0
- package/src/cartesian/XAxis.tsrx +156 -0
- package/src/cartesian/XAxis.tsrx.d.ts +3 -0
- package/src/cartesian/YAxis.tsrx +183 -0
- package/src/cartesian/YAxis.tsrx.d.ts +3 -0
- package/src/cartesian/getCartesianPosition.js +277 -0
- package/src/cartesian/getEquidistantTicks.js +133 -0
- package/src/cartesian/getTicks.js +280 -0
- package/src/cartesian/useAnimatedLineLength.ts +33 -0
- package/src/chart/BarChart.tsrx +22 -0
- package/src/chart/BarChart.tsrx.d.ts +2 -0
- package/src/chart/CartesianChart.tsrx +76 -0
- package/src/chart/CartesianChart.tsrx.d.ts +10 -0
- package/src/chart/CategoricalChart.tsrx +54 -0
- package/src/chart/LineChart.tsrx +22 -0
- package/src/chart/LineChart.tsrx.d.ts +2 -0
- package/src/chart/RechartsWrapper.tsrx +294 -0
- package/src/component/ActivePoints.tsrx +76 -0
- package/src/component/Cell.ts +37 -0
- package/src/component/Dots.tsrx +74 -0
- package/src/component/Label.tsrx +309 -0
- package/src/component/Label.tsrx.d.ts +12 -0
- package/src/component/LabelList.tsrx +83 -0
- package/src/component/LabelList.tsrx.d.ts +8 -0
- package/src/component/ResponsiveContainer.ts +22 -0
- package/src/component/Text.tsrx +281 -0
- package/src/component/Text.tsrx.d.ts +9 -0
- package/src/component/responsiveContainerUtils.js +111 -0
- package/src/container/ClipPathProvider.tsrx +29 -0
- package/src/container/Layer.tsrx +9 -0
- package/src/container/Layer.tsrx.d.ts +6 -0
- package/src/container/RootSurface.tsrx +76 -0
- package/src/container/Surface.tsrx +23 -0
- package/src/container/Surface.tsrx.d.ts +12 -0
- package/src/context/CellsContext.ts +80 -0
- package/src/context/ErrorBarContext.tsrx +53 -0
- package/src/context/PanoramaContext.ts +10 -0
- package/src/context/RegisterGraphicalItemId.tsrx +19 -0
- package/src/context/accessibilityContext.js +10 -0
- package/src/context/chartDataContext.ts +57 -0
- package/src/context/chartLayoutContext.ts +171 -0
- package/src/context/legendPortalContext.ts +5 -0
- package/src/context/tooltipContext.js +55 -0
- package/src/context/tooltipPortalContext.ts +5 -0
- package/src/hooks.js +509 -0
- package/src/index.ts +64 -0
- package/src/internal.ts +37 -0
- package/src/polar/defaultPolarAngleAxisProps.js +27 -0
- package/src/polar/defaultPolarRadiusAxisProps.js +24 -0
- package/src/shape/Cross.tsrx +25 -0
- package/src/shape/Cross.tsrx.d.ts +12 -0
- package/src/shape/Curve.tsrx +132 -0
- package/src/shape/Curve.tsrx.d.ts +42 -0
- package/src/shape/Dot.tsrx +21 -0
- package/src/shape/Dot.tsrx.d.ts +9 -0
- package/src/shape/Polygon.tsrx +95 -0
- package/src/shape/Polygon.tsrx.d.ts +13 -0
- package/src/shape/Rectangle.tsrx +162 -0
- package/src/shape/Rectangle.tsrx.d.ts +31 -0
- package/src/shape/Sector.tsrx +219 -0
- package/src/shape/Sector.tsrx.d.ts +29 -0
- package/src/shape/Symbols.tsrx +95 -0
- package/src/shape/Symbols.tsrx.d.ts +15 -0
- package/src/shape/Trapezoid.tsrx +56 -0
- package/src/shape/Trapezoid.tsrx.d.ts +29 -0
- package/src/state/RechartsReduxContext.ts +7 -0
- package/src/state/RechartsStoreProvider.tsrx +24 -0
- package/src/state/ReportChartProps.ts +13 -0
- package/src/state/ReportEventSettings.ts +15 -0
- package/src/state/ReportMainChartProps.ts +22 -0
- package/src/state/SetGraphicalItem.ts +61 -0
- package/src/state/SetLegendPayload.ts +61 -0
- package/src/state/SetTooltipEntrySettings.ts +40 -0
- package/src/state/brushSlice.js +36 -0
- package/src/state/cartesianAxisSlice.js +256 -0
- package/src/state/chartDataSlice.js +67 -0
- package/src/state/errorBarSlice.js +53 -0
- package/src/state/eventSettingsSlice.js +25 -0
- package/src/state/externalEventsMiddleware.js +127 -0
- package/src/state/graphicalItemsSlice.js +91 -0
- package/src/state/hooks.ts +46 -0
- package/src/state/keyboardEventsMiddleware.js +226 -0
- package/src/state/layoutSlice.js +57 -0
- package/src/state/legendSlice.js +83 -0
- package/src/state/mouseEventsMiddleware.js +130 -0
- package/src/state/optionsSlice.js +45 -0
- package/src/state/polarAxisSlice.js +33 -0
- package/src/state/polarOptionsSlice.js +26 -0
- package/src/state/reduxDevtoolsJsonStringifyReplacer.js +14 -0
- package/src/state/referenceElementsSlice.js +51 -0
- package/src/state/renderedTicksSlice.js +41 -0
- package/src/state/rootPropsSlice.js +48 -0
- package/src/state/selectors/arrayEqualityCheck.js +32 -0
- package/src/state/selectors/axisSelectors.js +2113 -0
- package/src/state/selectors/barSelectors.js +263 -0
- package/src/state/selectors/barStackSelectors.js +65 -0
- package/src/state/selectors/brushSelectors.js +21 -0
- package/src/state/selectors/combiners/combineActiveLabel.js +18 -0
- package/src/state/selectors/combiners/combineActiveTooltipIndex.js +75 -0
- package/src/state/selectors/combiners/combineAllBarPositions.js +169 -0
- package/src/state/selectors/combiners/combineAxisRangeWithReverse.js +11 -0
- package/src/state/selectors/combiners/combineBarPosition.js +17 -0
- package/src/state/selectors/combiners/combineBarSizeList.js +115 -0
- package/src/state/selectors/combiners/combineCheckedDomain.js +44 -0
- package/src/state/selectors/combiners/combineConfiguredScale.js +46 -0
- package/src/state/selectors/combiners/combineCoordinateForDefaultIndex.js +48 -0
- package/src/state/selectors/combiners/combineDisplayedStackedData.js +54 -0
- package/src/state/selectors/combiners/combineInverseScaleFunction.js +12 -0
- package/src/state/selectors/combiners/combineRealScaleType.js +36 -0
- package/src/state/selectors/combiners/combineStackedData.js +22 -0
- package/src/state/selectors/combiners/combineTooltipInteractionState.js +121 -0
- package/src/state/selectors/combiners/combineTooltipPayload.js +248 -0
- package/src/state/selectors/combiners/combineTooltipPayloadConfigurations.js +59 -0
- package/src/state/selectors/containerSelectors.js +6 -0
- package/src/state/selectors/dataSelectors.js +97 -0
- package/src/state/selectors/graphicalItemSelectors.js +25 -0
- package/src/state/selectors/legendSelectors.js +18 -0
- package/src/state/selectors/lineSelectors.js +106 -0
- package/src/state/selectors/numberDomainEqualityCheck.js +11 -0
- package/src/state/selectors/pickAxisId.js +3 -0
- package/src/state/selectors/pickAxisType.js +3 -0
- package/src/state/selectors/polarAxisSelectors.js +237 -0
- package/src/state/selectors/rootPropsSelectors.js +13 -0
- package/src/state/selectors/selectActivePropsFromChartPointer.js +23 -0
- package/src/state/selectors/selectAllAxes.js +15 -0
- package/src/state/selectors/selectChartOffset.js +12 -0
- package/src/state/selectors/selectChartOffsetInternal.js +174 -0
- package/src/state/selectors/selectPlotArea.js +19 -0
- package/src/state/selectors/selectTooltipAxisId.js +3 -0
- package/src/state/selectors/selectTooltipAxisType.js +25 -0
- package/src/state/selectors/selectTooltipEventType.js +27 -0
- package/src/state/selectors/selectTooltipPayloadSearcher.js +3 -0
- package/src/state/selectors/selectTooltipSettings.js +3 -0
- package/src/state/selectors/selectTooltipState.js +3 -0
- package/src/state/selectors/selectors.js +222 -0
- package/src/state/selectors/tooltipSelectors.js +471 -0
- package/src/state/selectors/touchSelectors.js +31 -0
- package/src/state/store.js +101 -0
- package/src/state/tooltipSlice.js +237 -0
- package/src/state/touchEventsMiddleware.js +140 -0
- package/src/state/types/StackedGraphicalItem.js +18 -0
- package/src/state/zIndexSlice.js +167 -0
- package/src/synchronisation/syncSelectors.js +5 -0
- package/src/synchronisation/useChartSynchronisation.tsrx +285 -0
- package/src/util/ActiveShapeUtils.tsrx +62 -0
- package/src/util/BarUtils.tsrx +35 -0
- package/src/util/CartesianUtils.js +66 -0
- package/src/util/ChartUtils.js +630 -0
- package/src/util/Constants.js +42 -0
- package/src/util/DOMUtils.js +180 -0
- package/src/util/DataUtils.js +199 -0
- package/src/util/Events.js +7 -0
- package/src/util/Global.js +13 -0
- package/src/util/LRUCache.js +58 -0
- package/src/util/LogUtils.js +29 -0
- package/src/util/PolarUtils.js +190 -0
- package/src/util/ReactUtils.ts +94 -0
- package/src/util/ReduceCSSCalc.js +260 -0
- package/src/util/TickUtils.js +43 -0
- package/src/util/YAxisUtils.js +43 -0
- package/src/util/axisPropsAreEqual.js +63 -0
- package/src/util/createEventProxy.js +18 -0
- package/src/util/excludeEventProps.js +172 -0
- package/src/util/getActiveCoordinate.js +253 -0
- package/src/util/getAxisTypeBasedOnLayout.js +17 -0
- package/src/util/getClassNameFromUnknown.js +8 -0
- package/src/util/getEveryNth.js +29 -0
- package/src/util/getRadiusAndStrokeWidthFromDot.js +28 -0
- package/src/util/getRelativeCoordinate.js +96 -0
- package/src/util/getSliced.js +11 -0
- package/src/util/isDomainSpecifiedByUser.js +255 -0
- package/src/util/isWellBehavedNumber.js +8 -0
- package/src/util/propsAreEqual.js +96 -0
- package/src/util/resolveDefaultProps.js +131 -0
- package/src/util/round.js +39 -0
- package/src/util/scale/RechartsScale.js +68 -0
- package/src/util/scale/createCategoricalInverse.js +77 -0
- package/src/util/scale/getNiceTickValues.js +354 -0
- package/src/util/scale/index.js +3 -0
- package/src/util/scale/util/arithmetic.js +51 -0
- package/src/util/stacks/getStackSeriesIdentifier.js +10 -0
- package/src/util/svgPropertiesAndEvents.ts +29 -0
- package/src/util/svgPropertiesNoEvents.js +383 -0
- package/src/util/types.ts +59 -0
- package/src/util/useAnimationId.ts +14 -0
- package/src/util/useId.ts +13 -0
- package/src/util/usePrefersReducedMotion.ts +30 -0
- package/src/util/useReportScale.ts +26 -0
- package/src/util/useUniqueId.js +34 -0
- package/src/zIndex/DefaultZIndexes.js +75 -0
- package/src/zIndex/ZIndexLayer.tsrx +80 -0
- package/src/zIndex/ZIndexLayer.tsrx.d.ts +2 -0
- package/src/zIndex/ZIndexPortal.tsrx +43 -0
- package/src/zIndex/getZIndexFromUnknown.js +15 -0
- package/src/zIndex/zIndexSelectors.js +45 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Port of recharts' state/hooks.ts on @octanejs/redux primitives. The recharts
|
|
2
|
+
// variants differ from stock useSelector/useDispatch: OUTSIDE a chart they
|
|
3
|
+
// return undefined / a no-op instead of throwing, so components remain usable
|
|
4
|
+
// standalone with all props passed explicitly.
|
|
5
|
+
import { useContext, useMemo } from 'octane';
|
|
6
|
+
import { useSyncExternalStoreWithSelector } from '@octanejs/redux';
|
|
7
|
+
import { RechartsReduxContext } from './RechartsReduxContext';
|
|
8
|
+
import { splitSlot, subSlot } from '../internal';
|
|
9
|
+
|
|
10
|
+
const noopDispatch = (a: any) => a;
|
|
11
|
+
|
|
12
|
+
export function useAppDispatch(): (action: any) => any {
|
|
13
|
+
const context = useContext(RechartsReduxContext);
|
|
14
|
+
if (context) {
|
|
15
|
+
return context.store.dispatch;
|
|
16
|
+
}
|
|
17
|
+
return noopDispatch;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const noop = () => {};
|
|
21
|
+
const addNestedSubNoop = () => noop;
|
|
22
|
+
const refEquality = (a: unknown, b: unknown) => a === b;
|
|
23
|
+
|
|
24
|
+
export function useAppSelector<T>(selector: (state: any) => T, ...rest: any[]): T | undefined {
|
|
25
|
+
const [, slot] = splitSlot(rest);
|
|
26
|
+
const context = useContext(RechartsReduxContext);
|
|
27
|
+
const outOfContextSelector = useMemo(
|
|
28
|
+
() => {
|
|
29
|
+
if (!context) return noop as (state: any) => undefined;
|
|
30
|
+
return (state: any) => {
|
|
31
|
+
if (state == null) return undefined;
|
|
32
|
+
return selector(state);
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
[context, selector],
|
|
36
|
+
subSlot(slot, 'as:memo'),
|
|
37
|
+
);
|
|
38
|
+
return useSyncExternalStoreWithSelector(
|
|
39
|
+
context ? context.subscription.addNestedSub : addNestedSubNoop,
|
|
40
|
+
context ? context.store.getState : noop,
|
|
41
|
+
context ? context.store.getState : noop,
|
|
42
|
+
outOfContextSelector,
|
|
43
|
+
refEquality,
|
|
44
|
+
subSlot(slot, 'as:ws'),
|
|
45
|
+
) as T | undefined;
|
|
46
|
+
}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
// Vendored verbatim from recharts@3.9.2 es6/state/keyboardEventsMiddleware.js (framework-agnostic).
|
|
2
|
+
// Do not edit — update by re-vendoring when the recharts devDependency moves.
|
|
3
|
+
import { createAction, createListenerMiddleware } from '@reduxjs/toolkit';
|
|
4
|
+
import { setKeyboardInteraction } from './tooltipSlice';
|
|
5
|
+
import {
|
|
6
|
+
selectTooltipAxisDomain,
|
|
7
|
+
selectTooltipAxisTicks,
|
|
8
|
+
selectTooltipDisplayedData,
|
|
9
|
+
} from './selectors/tooltipSelectors';
|
|
10
|
+
import { selectCoordinateForDefaultIndex } from './selectors/selectors';
|
|
11
|
+
import { selectChartDirection, selectTooltipAxisDataKey } from './selectors/axisSelectors';
|
|
12
|
+
import { combineActiveTooltipIndex } from './selectors/combiners/combineActiveTooltipIndex';
|
|
13
|
+
import { selectTooltipEventType } from './selectors/selectTooltipEventType';
|
|
14
|
+
export var keyDownAction = createAction('keyDown');
|
|
15
|
+
export var focusAction = createAction('focus');
|
|
16
|
+
export var blurAction = createAction('blur');
|
|
17
|
+
export var keyboardEventsMiddleware = createListenerMiddleware();
|
|
18
|
+
var rafId = null;
|
|
19
|
+
var timeoutId = null;
|
|
20
|
+
var latestKeyboardActionPayload = null;
|
|
21
|
+
keyboardEventsMiddleware.startListening({
|
|
22
|
+
actionCreator: keyDownAction,
|
|
23
|
+
effect: (action, listenerApi) => {
|
|
24
|
+
latestKeyboardActionPayload = action.payload;
|
|
25
|
+
if (rafId !== null) {
|
|
26
|
+
cancelAnimationFrame(rafId);
|
|
27
|
+
rafId = null;
|
|
28
|
+
}
|
|
29
|
+
var state = listenerApi.getState();
|
|
30
|
+
var _state$eventSettings = state.eventSettings,
|
|
31
|
+
throttleDelay = _state$eventSettings.throttleDelay,
|
|
32
|
+
throttledEvents = _state$eventSettings.throttledEvents;
|
|
33
|
+
var isThrottled = throttledEvents === 'all' || throttledEvents.includes('keydown');
|
|
34
|
+
if (timeoutId !== null && (typeof throttleDelay !== 'number' || !isThrottled)) {
|
|
35
|
+
clearTimeout(timeoutId);
|
|
36
|
+
timeoutId = null;
|
|
37
|
+
}
|
|
38
|
+
var callback = () => {
|
|
39
|
+
try {
|
|
40
|
+
var currentState = listenerApi.getState();
|
|
41
|
+
var accessibilityLayerIsActive = currentState.rootProps.accessibilityLayer !== false;
|
|
42
|
+
if (!accessibilityLayerIsActive) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
var keyboardInteraction = currentState.tooltip.keyboardInteraction;
|
|
46
|
+
var key = latestKeyboardActionPayload;
|
|
47
|
+
if (key !== 'ArrowRight' && key !== 'ArrowLeft' && key !== 'Enter') {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// TODO this is lacking index for charts that do not support numeric indexes
|
|
52
|
+
var resolvedIndex = combineActiveTooltipIndex(
|
|
53
|
+
keyboardInteraction,
|
|
54
|
+
selectTooltipDisplayedData(currentState),
|
|
55
|
+
selectTooltipAxisDataKey(currentState),
|
|
56
|
+
selectTooltipAxisDomain(currentState),
|
|
57
|
+
);
|
|
58
|
+
var currentIndex = resolvedIndex == null ? -1 : Number(resolvedIndex);
|
|
59
|
+
var isOutsideDomain = !Number.isFinite(currentIndex) || currentIndex < 0;
|
|
60
|
+
var tooltipTicks = selectTooltipAxisTicks(currentState);
|
|
61
|
+
var displayedData = selectTooltipDisplayedData(currentState);
|
|
62
|
+
var tooltipEventType = selectTooltipEventType(
|
|
63
|
+
currentState,
|
|
64
|
+
currentState.tooltip.settings.shared,
|
|
65
|
+
);
|
|
66
|
+
if (key === 'Enter') {
|
|
67
|
+
if (isOutsideDomain) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
var _coordinate = selectCoordinateForDefaultIndex(
|
|
71
|
+
currentState,
|
|
72
|
+
tooltipEventType,
|
|
73
|
+
'hover',
|
|
74
|
+
String(keyboardInteraction.index),
|
|
75
|
+
);
|
|
76
|
+
listenerApi.dispatch(
|
|
77
|
+
setKeyboardInteraction({
|
|
78
|
+
active: !keyboardInteraction.active,
|
|
79
|
+
activeIndex: keyboardInteraction.index,
|
|
80
|
+
activeCoordinate: _coordinate,
|
|
81
|
+
}),
|
|
82
|
+
);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
var direction = selectChartDirection(currentState);
|
|
86
|
+
var directionMultiplier = direction === 'left-to-right' ? 1 : -1;
|
|
87
|
+
var movement = key === 'ArrowRight' ? 1 : -1;
|
|
88
|
+
var nextIndex;
|
|
89
|
+
if (isOutsideDomain) {
|
|
90
|
+
var axisDataKey = selectTooltipAxisDataKey(currentState);
|
|
91
|
+
var domain = selectTooltipAxisDomain(currentState);
|
|
92
|
+
var effectiveMovement = movement * directionMultiplier;
|
|
93
|
+
|
|
94
|
+
// Build a minimal TooltipInteractionState for the candidate-index check.
|
|
95
|
+
var mkInteraction = (i) => ({
|
|
96
|
+
active: false,
|
|
97
|
+
index: String(i),
|
|
98
|
+
dataKey: undefined,
|
|
99
|
+
graphicalItemId: undefined,
|
|
100
|
+
coordinate: undefined,
|
|
101
|
+
});
|
|
102
|
+
nextIndex = -1;
|
|
103
|
+
if (effectiveMovement > 0) {
|
|
104
|
+
for (var i = 0; i < displayedData.length; i++) {
|
|
105
|
+
if (
|
|
106
|
+
combineActiveTooltipIndex(mkInteraction(i), displayedData, axisDataKey, domain) !=
|
|
107
|
+
null
|
|
108
|
+
) {
|
|
109
|
+
nextIndex = i;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
for (var _i = displayedData.length - 1; _i >= 0; _i--) {
|
|
115
|
+
if (
|
|
116
|
+
combineActiveTooltipIndex(mkInteraction(_i), displayedData, axisDataKey, domain) !=
|
|
117
|
+
null
|
|
118
|
+
) {
|
|
119
|
+
nextIndex = _i;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (nextIndex < 0) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
nextIndex = currentIndex + movement * directionMultiplier;
|
|
129
|
+
var dataLength =
|
|
130
|
+
(tooltipTicks === null || tooltipTicks === void 0 ? void 0 : tooltipTicks.length) ||
|
|
131
|
+
displayedData.length;
|
|
132
|
+
if (dataLength === 0 || nextIndex >= dataLength || nextIndex < 0) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
var coordinate = selectCoordinateForDefaultIndex(
|
|
137
|
+
currentState,
|
|
138
|
+
tooltipEventType,
|
|
139
|
+
'hover',
|
|
140
|
+
String(nextIndex),
|
|
141
|
+
);
|
|
142
|
+
listenerApi.dispatch(
|
|
143
|
+
setKeyboardInteraction({
|
|
144
|
+
active: true,
|
|
145
|
+
activeIndex: nextIndex.toString(),
|
|
146
|
+
activeCoordinate: coordinate,
|
|
147
|
+
}),
|
|
148
|
+
);
|
|
149
|
+
} finally {
|
|
150
|
+
rafId = null;
|
|
151
|
+
timeoutId = null;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
if (!isThrottled) {
|
|
155
|
+
callback();
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (throttleDelay === 'raf') {
|
|
159
|
+
rafId = requestAnimationFrame(callback);
|
|
160
|
+
} else if (typeof throttleDelay === 'number') {
|
|
161
|
+
if (timeoutId === null) {
|
|
162
|
+
callback();
|
|
163
|
+
latestKeyboardActionPayload = null;
|
|
164
|
+
timeoutId = setTimeout(() => {
|
|
165
|
+
if (latestKeyboardActionPayload) {
|
|
166
|
+
callback();
|
|
167
|
+
} else {
|
|
168
|
+
timeoutId = null;
|
|
169
|
+
rafId = null;
|
|
170
|
+
}
|
|
171
|
+
}, throttleDelay);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
keyboardEventsMiddleware.startListening({
|
|
177
|
+
actionCreator: focusAction,
|
|
178
|
+
effect: (_action, listenerApi) => {
|
|
179
|
+
var state = listenerApi.getState();
|
|
180
|
+
var accessibilityLayerIsActive = state.rootProps.accessibilityLayer !== false;
|
|
181
|
+
if (!accessibilityLayerIsActive) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
var keyboardInteraction = state.tooltip.keyboardInteraction;
|
|
185
|
+
if (keyboardInteraction.active) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (keyboardInteraction.index == null) {
|
|
189
|
+
var nextIndex = '0';
|
|
190
|
+
var tooltipEventType = selectTooltipEventType(state, state.tooltip.settings.shared);
|
|
191
|
+
var coordinate = selectCoordinateForDefaultIndex(
|
|
192
|
+
state,
|
|
193
|
+
tooltipEventType,
|
|
194
|
+
'hover',
|
|
195
|
+
String(nextIndex),
|
|
196
|
+
);
|
|
197
|
+
listenerApi.dispatch(
|
|
198
|
+
setKeyboardInteraction({
|
|
199
|
+
active: true,
|
|
200
|
+
activeIndex: nextIndex,
|
|
201
|
+
activeCoordinate: coordinate,
|
|
202
|
+
}),
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
keyboardEventsMiddleware.startListening({
|
|
208
|
+
actionCreator: blurAction,
|
|
209
|
+
effect: (_action, listenerApi) => {
|
|
210
|
+
var state = listenerApi.getState();
|
|
211
|
+
var accessibilityLayerIsActive = state.rootProps.accessibilityLayer !== false;
|
|
212
|
+
if (!accessibilityLayerIsActive) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
var keyboardInteraction = state.tooltip.keyboardInteraction;
|
|
216
|
+
if (keyboardInteraction.active) {
|
|
217
|
+
listenerApi.dispatch(
|
|
218
|
+
setKeyboardInteraction({
|
|
219
|
+
active: false,
|
|
220
|
+
activeIndex: keyboardInteraction.index,
|
|
221
|
+
activeCoordinate: keyboardInteraction.coordinate,
|
|
222
|
+
}),
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Vendored verbatim from recharts@3.9.2 es6/state/layoutSlice.js (framework-agnostic).
|
|
2
|
+
// Do not edit — update by re-vendoring when the recharts devDependency moves.
|
|
3
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
4
|
+
var initialState = {
|
|
5
|
+
layoutType: 'horizontal',
|
|
6
|
+
width: 0,
|
|
7
|
+
height: 0,
|
|
8
|
+
margin: {
|
|
9
|
+
top: 5,
|
|
10
|
+
right: 5,
|
|
11
|
+
bottom: 5,
|
|
12
|
+
left: 5,
|
|
13
|
+
},
|
|
14
|
+
scale: 1,
|
|
15
|
+
};
|
|
16
|
+
var chartLayoutSlice = createSlice({
|
|
17
|
+
name: 'chartLayout',
|
|
18
|
+
initialState,
|
|
19
|
+
reducers: {
|
|
20
|
+
setLayout(state, action) {
|
|
21
|
+
state.layoutType = action.payload;
|
|
22
|
+
},
|
|
23
|
+
setChartSize(state, action) {
|
|
24
|
+
state.width = action.payload.width;
|
|
25
|
+
state.height = action.payload.height;
|
|
26
|
+
},
|
|
27
|
+
setMargin(state, action) {
|
|
28
|
+
var _action$payload$top, _action$payload$right, _action$payload$botto, _action$payload$left;
|
|
29
|
+
state.margin.top =
|
|
30
|
+
(_action$payload$top = action.payload.top) !== null && _action$payload$top !== void 0
|
|
31
|
+
? _action$payload$top
|
|
32
|
+
: 0;
|
|
33
|
+
state.margin.right =
|
|
34
|
+
(_action$payload$right = action.payload.right) !== null && _action$payload$right !== void 0
|
|
35
|
+
? _action$payload$right
|
|
36
|
+
: 0;
|
|
37
|
+
state.margin.bottom =
|
|
38
|
+
(_action$payload$botto = action.payload.bottom) !== null && _action$payload$botto !== void 0
|
|
39
|
+
? _action$payload$botto
|
|
40
|
+
: 0;
|
|
41
|
+
state.margin.left =
|
|
42
|
+
(_action$payload$left = action.payload.left) !== null && _action$payload$left !== void 0
|
|
43
|
+
? _action$payload$left
|
|
44
|
+
: 0;
|
|
45
|
+
},
|
|
46
|
+
setScale(state, action) {
|
|
47
|
+
state.scale = action.payload;
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
var _chartLayoutSlice$act = chartLayoutSlice.actions,
|
|
52
|
+
setMargin = _chartLayoutSlice$act.setMargin,
|
|
53
|
+
setLayout = _chartLayoutSlice$act.setLayout,
|
|
54
|
+
setChartSize = _chartLayoutSlice$act.setChartSize,
|
|
55
|
+
setScale = _chartLayoutSlice$act.setScale;
|
|
56
|
+
export { setMargin, setLayout, setChartSize, setScale };
|
|
57
|
+
export var chartLayoutReducer = chartLayoutSlice.reducer;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Vendored verbatim from recharts@3.9.2 es6/state/legendSlice.js (framework-agnostic).
|
|
2
|
+
// Do not edit — update by re-vendoring when the recharts devDependency moves.
|
|
3
|
+
import { createSlice, current, prepareAutoBatched } from '@reduxjs/toolkit';
|
|
4
|
+
import { castDraft } from 'immer';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The properties inside this state update independently of each other and quite often.
|
|
8
|
+
* When selecting, never select the whole state because you are going to get
|
|
9
|
+
* unnecessary re-renders. Select only the properties you need.
|
|
10
|
+
*
|
|
11
|
+
* This is why this state type is not exported - don't use it directly.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
var initialState = {
|
|
15
|
+
settings: {
|
|
16
|
+
layout: 'horizontal',
|
|
17
|
+
align: 'center',
|
|
18
|
+
verticalAlign: 'bottom',
|
|
19
|
+
itemSorter: 'value',
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
width: 0,
|
|
23
|
+
height: 0,
|
|
24
|
+
},
|
|
25
|
+
payload: [],
|
|
26
|
+
};
|
|
27
|
+
var legendSlice = createSlice({
|
|
28
|
+
name: 'legend',
|
|
29
|
+
initialState,
|
|
30
|
+
reducers: {
|
|
31
|
+
setLegendSize(state, action) {
|
|
32
|
+
state.size.width = action.payload.width;
|
|
33
|
+
state.size.height = action.payload.height;
|
|
34
|
+
},
|
|
35
|
+
setLegendSettings(state, action) {
|
|
36
|
+
state.settings.align = action.payload.align;
|
|
37
|
+
state.settings.layout = action.payload.layout;
|
|
38
|
+
state.settings.verticalAlign = action.payload.verticalAlign;
|
|
39
|
+
state.settings.itemSorter = action.payload.itemSorter;
|
|
40
|
+
},
|
|
41
|
+
addLegendPayload: {
|
|
42
|
+
reducer(state, action) {
|
|
43
|
+
state.payload.push(castDraft(action.payload));
|
|
44
|
+
},
|
|
45
|
+
prepare: prepareAutoBatched(),
|
|
46
|
+
},
|
|
47
|
+
replaceLegendPayload: {
|
|
48
|
+
reducer(state, action) {
|
|
49
|
+
var _action$payload = action.payload,
|
|
50
|
+
prev = _action$payload.prev,
|
|
51
|
+
next = _action$payload.next;
|
|
52
|
+
var index = current(state).payload.indexOf(castDraft(prev));
|
|
53
|
+
if (index > -1) {
|
|
54
|
+
state.payload[index] = castDraft(next);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
prepare: prepareAutoBatched(),
|
|
58
|
+
},
|
|
59
|
+
removeLegendPayload: {
|
|
60
|
+
reducer(state, action) {
|
|
61
|
+
var index = current(state).payload.indexOf(castDraft(action.payload));
|
|
62
|
+
if (index > -1) {
|
|
63
|
+
state.payload.splice(index, 1);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
prepare: prepareAutoBatched(),
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
var _legendSlice$actions = legendSlice.actions,
|
|
71
|
+
setLegendSize = _legendSlice$actions.setLegendSize,
|
|
72
|
+
setLegendSettings = _legendSlice$actions.setLegendSettings,
|
|
73
|
+
addLegendPayload = _legendSlice$actions.addLegendPayload,
|
|
74
|
+
replaceLegendPayload = _legendSlice$actions.replaceLegendPayload,
|
|
75
|
+
removeLegendPayload = _legendSlice$actions.removeLegendPayload;
|
|
76
|
+
export {
|
|
77
|
+
setLegendSize,
|
|
78
|
+
setLegendSettings,
|
|
79
|
+
addLegendPayload,
|
|
80
|
+
replaceLegendPayload,
|
|
81
|
+
removeLegendPayload,
|
|
82
|
+
};
|
|
83
|
+
export var legendReducer = legendSlice.reducer;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// Vendored verbatim from recharts@3.9.2 es6/state/mouseEventsMiddleware.js (framework-agnostic).
|
|
2
|
+
// Do not edit — update by re-vendoring when the recharts devDependency moves.
|
|
3
|
+
import { createAction, createListenerMiddleware } from '@reduxjs/toolkit';
|
|
4
|
+
import { mouseLeaveChart, setMouseClickAxisIndex, setMouseOverAxisIndex } from './tooltipSlice';
|
|
5
|
+
import { selectActivePropsFromChartPointer } from './selectors/selectActivePropsFromChartPointer';
|
|
6
|
+
import { selectTooltipEventType } from './selectors/selectTooltipEventType';
|
|
7
|
+
import { getRelativeCoordinate } from '../util/getRelativeCoordinate';
|
|
8
|
+
export var mouseClickAction = createAction('mouseClick');
|
|
9
|
+
export var mouseClickMiddleware = createListenerMiddleware();
|
|
10
|
+
|
|
11
|
+
// TODO: there's a bug here when you click the chart the activeIndex resets to zero
|
|
12
|
+
mouseClickMiddleware.startListening({
|
|
13
|
+
actionCreator: mouseClickAction,
|
|
14
|
+
effect: (action, listenerApi) => {
|
|
15
|
+
var mousePointer = action.payload;
|
|
16
|
+
var activeProps = selectActivePropsFromChartPointer(
|
|
17
|
+
listenerApi.getState(),
|
|
18
|
+
getRelativeCoordinate(mousePointer),
|
|
19
|
+
);
|
|
20
|
+
if (
|
|
21
|
+
(activeProps === null || activeProps === void 0 ? void 0 : activeProps.activeIndex) != null
|
|
22
|
+
) {
|
|
23
|
+
listenerApi.dispatch(
|
|
24
|
+
setMouseClickAxisIndex({
|
|
25
|
+
activeIndex: activeProps.activeIndex,
|
|
26
|
+
activeDataKey: undefined,
|
|
27
|
+
activeCoordinate: activeProps.activeCoordinate,
|
|
28
|
+
}),
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
export var mouseMoveAction = createAction('mouseMove');
|
|
34
|
+
export var mouseMoveMiddleware = createListenerMiddleware();
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
* This single rafId is safe because:
|
|
38
|
+
* 1. Each chart has its own Redux store instance with its own middleware
|
|
39
|
+
* 2. mouseMoveAction only fires from one DOM element (the chart wrapper)
|
|
40
|
+
* 3. Rapid mousemove events from the same element SHOULD debounce - we only care about the latest position
|
|
41
|
+
* This is different from externalEventsMiddleware which handles multiple event types
|
|
42
|
+
* (click, mouseenter, mouseleave, etc.) that should NOT cancel each other.
|
|
43
|
+
*/
|
|
44
|
+
var rafId = null;
|
|
45
|
+
var timeoutId = null;
|
|
46
|
+
var latestChartPointer = null;
|
|
47
|
+
mouseMoveMiddleware.startListening({
|
|
48
|
+
actionCreator: mouseMoveAction,
|
|
49
|
+
effect: (action, listenerApi) => {
|
|
50
|
+
var mousePointer = action.payload;
|
|
51
|
+
var state = listenerApi.getState();
|
|
52
|
+
var _state$eventSettings = state.eventSettings,
|
|
53
|
+
throttleDelay = _state$eventSettings.throttleDelay,
|
|
54
|
+
throttledEvents = _state$eventSettings.throttledEvents;
|
|
55
|
+
var isThrottled =
|
|
56
|
+
throttledEvents === 'all' ||
|
|
57
|
+
(throttledEvents === null || throttledEvents === void 0
|
|
58
|
+
? void 0
|
|
59
|
+
: throttledEvents.includes('mousemove'));
|
|
60
|
+
|
|
61
|
+
// Cancel any pending execution
|
|
62
|
+
if (rafId !== null) {
|
|
63
|
+
cancelAnimationFrame(rafId);
|
|
64
|
+
rafId = null;
|
|
65
|
+
}
|
|
66
|
+
if (timeoutId !== null && (typeof throttleDelay !== 'number' || !isThrottled)) {
|
|
67
|
+
clearTimeout(timeoutId);
|
|
68
|
+
timeoutId = null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/*
|
|
72
|
+
* Here it is important to resolve the chart pointer _before_ the callback,
|
|
73
|
+
* because once we leave the current event loop, the mousePointer event object will lose
|
|
74
|
+
* reference to currentTarget which getRelativeCoordinate uses.
|
|
75
|
+
*/
|
|
76
|
+
latestChartPointer = getRelativeCoordinate(mousePointer);
|
|
77
|
+
var callback = () => {
|
|
78
|
+
/*
|
|
79
|
+
* Here we read a fresh state again inside the callback to ensure we have the latest state values
|
|
80
|
+
* after any potential actions that may have been dispatched between the original event and this callback.
|
|
81
|
+
*/
|
|
82
|
+
var currentState = listenerApi.getState();
|
|
83
|
+
var tooltipEventType = selectTooltipEventType(
|
|
84
|
+
currentState,
|
|
85
|
+
currentState.tooltip.settings.shared,
|
|
86
|
+
);
|
|
87
|
+
if (!latestChartPointer) {
|
|
88
|
+
rafId = null;
|
|
89
|
+
timeoutId = null;
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/*
|
|
94
|
+
* This functionality only applies to charts that have axes.
|
|
95
|
+
* Graphical items have its own mouse events handling mechanism where they attach events directly to the items.
|
|
96
|
+
*/
|
|
97
|
+
if (tooltipEventType === 'axis') {
|
|
98
|
+
var activeProps = selectActivePropsFromChartPointer(currentState, latestChartPointer);
|
|
99
|
+
if (
|
|
100
|
+
(activeProps === null || activeProps === void 0 ? void 0 : activeProps.activeIndex) !=
|
|
101
|
+
null
|
|
102
|
+
) {
|
|
103
|
+
listenerApi.dispatch(
|
|
104
|
+
setMouseOverAxisIndex({
|
|
105
|
+
activeIndex: activeProps.activeIndex,
|
|
106
|
+
activeDataKey: undefined,
|
|
107
|
+
activeCoordinate: activeProps.activeCoordinate,
|
|
108
|
+
}),
|
|
109
|
+
);
|
|
110
|
+
} else {
|
|
111
|
+
// this is needed to clear tooltip state when the mouse moves out of the inRange (svg - offset) function, but not yet out of the svg
|
|
112
|
+
listenerApi.dispatch(mouseLeaveChart());
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
rafId = null;
|
|
116
|
+
timeoutId = null;
|
|
117
|
+
};
|
|
118
|
+
if (!isThrottled) {
|
|
119
|
+
callback();
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (throttleDelay === 'raf') {
|
|
123
|
+
rafId = requestAnimationFrame(callback);
|
|
124
|
+
} else if (typeof throttleDelay === 'number') {
|
|
125
|
+
if (timeoutId === null) {
|
|
126
|
+
timeoutId = setTimeout(callback, throttleDelay);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Vendored verbatim from recharts@3.9.2 es6/state/optionsSlice.js (framework-agnostic).
|
|
2
|
+
// Do not edit — update by re-vendoring when the recharts devDependency moves.
|
|
3
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
4
|
+
import { isNan } from '../util/DataUtils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* These chart options are decided internally, by Recharts,
|
|
8
|
+
* and will not change during the lifetime of the chart.
|
|
9
|
+
*
|
|
10
|
+
* Changing these options can be done by swapping the root element
|
|
11
|
+
* which will make a brand-new Redux store.
|
|
12
|
+
*
|
|
13
|
+
* If you want to store options that can be changed by the user,
|
|
14
|
+
* use UpdatableChartOptions in rootPropsSlice.ts.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export var arrayTooltipSearcher = (data, strIndex) => {
|
|
18
|
+
if (!strIndex) return undefined;
|
|
19
|
+
if (!Array.isArray(data)) return undefined;
|
|
20
|
+
var numIndex = Number.parseInt(strIndex, 10);
|
|
21
|
+
if (isNan(numIndex)) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
return data[numIndex];
|
|
25
|
+
};
|
|
26
|
+
var initialState = {
|
|
27
|
+
chartName: '',
|
|
28
|
+
tooltipPayloadSearcher: () => undefined,
|
|
29
|
+
eventEmitter: undefined,
|
|
30
|
+
defaultTooltipEventType: 'axis',
|
|
31
|
+
};
|
|
32
|
+
var optionsSlice = createSlice({
|
|
33
|
+
name: 'options',
|
|
34
|
+
initialState,
|
|
35
|
+
reducers: {
|
|
36
|
+
createEventEmitter: (state) => {
|
|
37
|
+
if (state.eventEmitter == null) {
|
|
38
|
+
state.eventEmitter = Symbol('rechartsEventEmitter');
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
export var optionsReducer = optionsSlice.reducer;
|
|
44
|
+
var createEventEmitter = optionsSlice.actions.createEventEmitter;
|
|
45
|
+
export { createEventEmitter };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Vendored verbatim from recharts@3.9.2 es6/state/polarAxisSlice.js (framework-agnostic).
|
|
2
|
+
// Do not edit — update by re-vendoring when the recharts devDependency moves.
|
|
3
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
4
|
+
import { castDraft } from 'immer';
|
|
5
|
+
var initialState = {
|
|
6
|
+
radiusAxis: {},
|
|
7
|
+
angleAxis: {},
|
|
8
|
+
};
|
|
9
|
+
var polarAxisSlice = createSlice({
|
|
10
|
+
name: 'polarAxis',
|
|
11
|
+
initialState,
|
|
12
|
+
reducers: {
|
|
13
|
+
addRadiusAxis(state, action) {
|
|
14
|
+
state.radiusAxis[action.payload.id] = castDraft(action.payload);
|
|
15
|
+
},
|
|
16
|
+
removeRadiusAxis(state, action) {
|
|
17
|
+
delete state.radiusAxis[action.payload.id];
|
|
18
|
+
},
|
|
19
|
+
addAngleAxis(state, action) {
|
|
20
|
+
state.angleAxis[action.payload.id] = castDraft(action.payload);
|
|
21
|
+
},
|
|
22
|
+
removeAngleAxis(state, action) {
|
|
23
|
+
delete state.angleAxis[action.payload.id];
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
var _polarAxisSlice$actio = polarAxisSlice.actions,
|
|
28
|
+
addRadiusAxis = _polarAxisSlice$actio.addRadiusAxis,
|
|
29
|
+
removeRadiusAxis = _polarAxisSlice$actio.removeRadiusAxis,
|
|
30
|
+
addAngleAxis = _polarAxisSlice$actio.addAngleAxis,
|
|
31
|
+
removeAngleAxis = _polarAxisSlice$actio.removeAngleAxis;
|
|
32
|
+
export { addRadiusAxis, removeRadiusAxis, addAngleAxis, removeAngleAxis };
|
|
33
|
+
export var polarAxisReducer = polarAxisSlice.reducer;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Vendored verbatim from recharts@3.9.2 es6/state/polarOptionsSlice.js (framework-agnostic).
|
|
2
|
+
// Do not edit — update by re-vendoring when the recharts devDependency moves.
|
|
3
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
4
|
+
var initialState = null;
|
|
5
|
+
var reducers = {
|
|
6
|
+
updatePolarOptions: (state, action) => {
|
|
7
|
+
if (state === null) {
|
|
8
|
+
return action.payload;
|
|
9
|
+
}
|
|
10
|
+
state.startAngle = action.payload.startAngle;
|
|
11
|
+
state.endAngle = action.payload.endAngle;
|
|
12
|
+
state.cx = action.payload.cx;
|
|
13
|
+
state.cy = action.payload.cy;
|
|
14
|
+
state.innerRadius = action.payload.innerRadius;
|
|
15
|
+
state.outerRadius = action.payload.outerRadius;
|
|
16
|
+
return state;
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
var polarOptionsSlice = createSlice({
|
|
20
|
+
name: 'polarOptions',
|
|
21
|
+
initialState,
|
|
22
|
+
reducers,
|
|
23
|
+
});
|
|
24
|
+
var updatePolarOptions = polarOptionsSlice.actions.updatePolarOptions;
|
|
25
|
+
export { updatePolarOptions };
|
|
26
|
+
export var polarOptionsReducer = polarOptionsSlice.reducer;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Vendored verbatim from recharts@3.9.2 es6/state/reduxDevtoolsJsonStringifyReplacer.js (framework-agnostic).
|
|
2
|
+
// Do not edit — update by re-vendoring when the recharts devDependency moves.
|
|
3
|
+
export function reduxDevtoolsJsonStringifyReplacer(key, value) {
|
|
4
|
+
if (value instanceof HTMLElement) {
|
|
5
|
+
return 'HTMLElement <'.concat(value.tagName, ' class="').concat(value.className, '">');
|
|
6
|
+
}
|
|
7
|
+
if (value === window) {
|
|
8
|
+
return 'global.window';
|
|
9
|
+
}
|
|
10
|
+
if (key === 'children' && typeof value === 'object' && value !== null) {
|
|
11
|
+
return '<<CHILDREN>>';
|
|
12
|
+
}
|
|
13
|
+
return value;
|
|
14
|
+
}
|