solid-recharts 0.1.0 → 0.2.1
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 +24 -0
- package/package.json +10 -7
- package/src/cartesian/Area.tsx +40 -55
- package/src/cartesian/Bar.tsx +66 -58
- package/src/cartesian/BarStack.tsx +5 -2
- package/src/cartesian/Brush.tsx +1 -1
- package/src/cartesian/Funnel.tsx +15 -19
- package/src/cartesian/Line.tsx +34 -51
- package/src/cartesian/LineDrawShape.tsx +8 -6
- package/src/cartesian/ReferenceArea.tsx +25 -35
- package/src/cartesian/ReferenceDot.tsx +24 -34
- package/src/cartesian/ReferenceLine.tsx +25 -34
- package/src/cartesian/Scatter.tsx +25 -37
- package/src/cartesian/XAxis.tsx +54 -67
- package/src/cartesian/YAxis.tsx +53 -66
- package/src/cartesian/ZAxis.tsx +27 -40
- package/src/chart/SunburstChart.tsx +1 -1
- package/src/component/ActivePoints.tsx +0 -9
- package/src/component/Customized.tsx +1 -1
- package/src/component/Dots.tsx +7 -3
- package/src/context/ErrorBarContext.tsx +15 -24
- package/src/polar/Pie.tsx +36 -48
- package/src/polar/PolarAngleAxis.tsx +41 -50
- package/src/polar/PolarRadiusAxis.tsx +40 -48
- package/src/polar/Radar.tsx +22 -34
- package/src/polar/RadialBar.tsx +21 -39
- package/src/shape/Curve.tsx +1 -1
- package/src/shape/Symbols.tsx +1 -1
- package/src/state/RechartsReduxContext.tsx +1 -1
- package/src/state/SetLegendPayload.ts +19 -27
- package/src/state/SetTooltipEntrySettings.tsx +9 -26
- package/src/state/cartesianAxisSlice.ts +40 -60
- package/src/state/createCollectionActions.ts +51 -0
- package/src/state/createSelector.ts +97 -0
- package/src/state/externalEventsMiddleware.ts +2 -11
- package/src/state/graphicalItemsSlice.ts +27 -40
- package/src/state/isEventThrottled.ts +12 -0
- package/src/state/keyboardEventsMiddleware.ts +2 -8
- package/src/state/layoutSlice.ts +8 -4
- package/src/state/legendSlice.ts +24 -26
- package/src/state/mouseEventsMiddleware.ts +2 -13
- package/src/state/patched.ts +19 -0
- package/src/state/referenceElementsSlice.ts +40 -31
- package/src/state/registerInStore.ts +68 -0
- package/src/state/selectors/areaSelectors.ts +13 -36
- package/src/state/selectors/arrayEqualityCheck.ts +32 -7
- package/src/state/selectors/axisSelectors.ts +215 -169
- package/src/state/selectors/barSelectors.ts +8 -36
- package/src/state/selectors/combiners/combineConfiguredScale.ts +1 -1
- package/src/state/selectors/combiners/combineRealScaleType.ts +1 -1
- package/src/state/selectors/dataSelectors.ts +35 -16
- package/src/state/selectors/numberDomainEqualityCheck.ts +16 -8
- package/src/state/selectors/selectAxisForGraphicalItem.ts +52 -0
- package/src/state/store.ts +0 -1
- package/src/state/tooltipSlice.ts +93 -64
- package/src/util/ActiveShapeUtils.tsx +0 -7
- package/src/util/BarUtils.tsx +27 -22
- package/src/util/ChartUtils.ts +69 -25
- package/src/util/propsAreEqual.ts +3 -33
- package/src/util/stacks/stackTypes.ts +1 -1
- package/src/util/types.ts +2 -2
- package/test/animation/CSSTransitionAnimate.timing.spec.tsx +1 -1
- package/test/animation/JavascriptAnimate.spec.tsx +1 -1
- package/test/animation/legacyAnimationLengthChange.spec.tsx +1 -1
- package/test/cartesian/Area.animation.spec.tsx +1 -1
- package/test/cartesian/Area.range.spec.tsx +1 -1
- package/test/cartesian/Area.spec.tsx +1 -1
- package/test/cartesian/Area.stacked.render.spec.tsx +1 -1
- package/test/cartesian/Area.typed.spec.tsx +1 -1
- package/test/cartesian/Axis.integration.spec.tsx +1 -1
- package/test/cartesian/Bar/Bar.csstransition.spec.tsx +1 -1
- package/test/cartesian/Bar/Bar.spec.tsx +1 -1
- package/test/cartesian/Bar/Bar.typed.spec.tsx +1 -1
- package/test/cartesian/Bar.animation.spec.tsx +1 -1
- package/test/cartesian/Bar.stackDomain.spec.tsx +1 -1
- package/test/cartesian/Bar.stacked.render.spec.tsx +1 -1
- package/test/cartesian/Bar.zeroDimensionFiltering.spec.tsx +1 -1
- package/test/cartesian/Brush.keyboard.spec.tsx +1 -1
- package/test/cartesian/Brush.panorama.spec.tsx +1 -1
- package/test/cartesian/Brush.props.spec.tsx +1 -1
- package/test/cartesian/Brush.render.spec.tsx +1 -1
- package/test/cartesian/Brush.spec.tsx +1 -1
- package/test/cartesian/Brush.stacked.spec.tsx +1 -1
- package/test/cartesian/CartesianAxis.render.spec.tsx +1 -1
- package/test/cartesian/CartesianAxis.spec.tsx +2 -2
- package/test/cartesian/CartesianGrid.render.spec.tsx +1 -1
- package/test/cartesian/CartesianGrid.spec.tsx +1 -1
- package/test/cartesian/ErrorBar.render.spec.tsx +1 -1
- package/test/cartesian/ErrorBar.spec.tsx +1 -1
- package/test/cartesian/Funnel.animation.spec.tsx +1 -1
- package/test/cartesian/Funnel.spec.tsx +1 -1
- package/test/cartesian/Funnel.typed.spec.tsx +1 -1
- package/test/cartesian/GraphicalItemClipPath.scale-behavior.spec.tsx +2 -2
- package/test/cartesian/Line.animation.spec.tsx +1 -1
- package/test/cartesian/Line.sparseAnimationPath.spec.tsx +1 -1
- package/test/cartesian/Line.spec.tsx +1 -1
- package/test/cartesian/Line.typed.spec.tsx +1 -1
- package/test/cartesian/ReferenceArea.render.spec.tsx +1 -1
- package/test/cartesian/ReferenceArea.spec.tsx +1 -1
- package/test/cartesian/ReferenceArea.typed.spec.tsx +1 -1
- package/test/cartesian/ReferenceDot.render.spec.tsx +1 -1
- package/test/cartesian/ReferenceDot.spec.tsx +1 -1
- package/test/cartesian/ReferenceDot.typed.spec.tsx +1 -1
- package/test/cartesian/ReferenceLine/ReferenceLine.panorama.spec.tsx +1 -1
- package/test/cartesian/ReferenceLine/ReferenceLine.spec.tsx +1 -1
- package/test/cartesian/ReferenceLine/ReferenceLine.typed.spec.tsx +1 -1
- package/test/cartesian/ReferenceLine/getEndPoints.spec.ts +1 -1
- package/test/cartesian/ReferenceLine.render.spec.tsx +1 -1
- package/test/cartesian/Scatter.animation.spec.tsx +1 -1
- package/test/cartesian/Scatter.render.spec.tsx +1 -1
- package/test/cartesian/Scatter.spec.tsx +1 -1
- package/test/cartesian/Scatter.typed.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.barSize.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.brush.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.categorydomain.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.datatypes.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.hide.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.multiaxis.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.numberdomain.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.padding.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.padding_clip.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.state.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.tick.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.timescale.spec.tsx +2 -2
- package/test/cartesian/XAxis/XAxis.typed.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.vertical.spec.tsx +1 -1
- package/test/cartesian/XAxis.tickFormatter.spec.tsx +1 -1
- package/test/cartesian/YAxis/YAxis.7362.derivedDomain.spec.tsx +1 -1
- package/test/cartesian/YAxis/YAxis.interval-zero.spec.tsx +1 -1
- package/test/cartesian/YAxis/YAxis.label.spec.tsx +1 -1
- package/test/cartesian/YAxis/YAxis.spec.tsx +1 -1
- package/test/cartesian/YAxis/YAxis.tick.spec.tsx +1 -1
- package/test/cartesian/YAxis/YAxis.tickFormatter.spec.tsx +1 -1
- package/test/cartesian/YAxis/YAxis.typed.spec.tsx +1 -1
- package/test/cartesian/ZAxis.spec.tsx +1 -1
- package/test/cartesian/ZAxis.typed.spec.tsx +1 -1
- package/test/cartesian/axisLineAndStroke.spec.tsx +1 -1
- package/test/cartesian/miscFeatureGaps.spec.tsx +1 -1
- package/test/chart/AccessibilityLayer.spec.tsx +1 -1
- package/test/chart/AccessibilityScans.spec.tsx +2 -2
- package/test/chart/AreaChart.spec.tsx +1 -1
- package/test/chart/AreaChart.typed.spec.tsx +1 -1
- package/test/chart/BarChart.spec.tsx +1 -1
- package/test/chart/BarChart.typed.spec.tsx +1 -1
- package/test/chart/CategoricalChart.spec.tsx +1 -1
- package/test/chart/ComposedChart.spec.tsx +1 -1
- package/test/chart/ComposedChart.typed.spec.tsx +1 -1
- package/test/chart/FunnelChart.spec.tsx +1 -1
- package/test/chart/FunnelChart.typed.spec.tsx +1 -1
- package/test/chart/LineChart.smoke.spec.tsx +1 -1
- package/test/chart/LineChart.spec.tsx +1 -1
- package/test/chart/LineChart.typed.spec.tsx +1 -1
- package/test/chart/NicheChartTooltip.spec.tsx +1 -1
- package/test/chart/PieChart.spec.tsx +1 -1
- package/test/chart/PieChart.typed.spec.tsx +1 -1
- package/test/chart/RadarChart.spec.tsx +1 -1
- package/test/chart/RadarChart.typed.spec.tsx +1 -1
- package/test/chart/RadialBarChart.spec.tsx +1 -1
- package/test/chart/RadialBarChart.typed.spec.tsx +1 -1
- package/test/chart/RechartsWrapper.spec.tsx +1 -1
- package/test/chart/Sankey.content.spec.tsx +1 -1
- package/test/chart/Sankey.spec.tsx +1 -1
- package/test/chart/ScatterChart.spec.tsx +1 -1
- package/test/chart/ScatterChart.typed.spec.tsx +1 -1
- package/test/chart/SunburstChart.spec.tsx +1 -1
- package/test/chart/Treemap.animation.spec.tsx +1 -1
- package/test/chart/Treemap.spec.tsx +1 -1
- package/test/chart/chartEvents.spec.tsx +1 -1
- package/test/chart/responsive.spec.tsx +1 -1
- package/test/component/Cell.render.spec.tsx +1 -1
- package/test/component/Cell.spec.tsx +1 -1
- package/test/component/Cursor.spec.tsx +1 -1
- package/test/component/DefaultTooltipContent.spec.tsx +1 -1
- package/test/component/Label.render.spec.tsx +1 -1
- package/test/component/Label.spec.tsx +1 -1
- package/test/component/LabelList.spec.tsx +1 -1
- package/test/component/Legend.itemSorter.spec.tsx +1 -1
- package/test/component/Legend.render.spec.tsx +1 -1
- package/test/component/Legend.spec.tsx +1 -1
- package/test/component/ResponsiveContainer.spec.tsx +1 -1
- package/test/component/ResponsiveContainerDataTest.spec.tsx +1 -1
- package/test/component/Text.spec.tsx +1 -1
- package/test/component/Tooltip/ActiveDot.spec.tsx +1 -1
- package/test/component/Tooltip/tooltipEventType.spec.tsx +1 -1
- package/test/component/Tooltip/tooltipTestHelpers.tsx +1 -1
- package/test/component/Tooltip.defaultIndex.spec.tsx +1 -1
- package/test/component/Tooltip.hover.spec.tsx +1 -1
- package/test/component/Tooltip.item.spec.tsx +1 -1
- package/test/component/Tooltip.keyboard.spec.tsx +1 -1
- package/test/component/Tooltip.payload.spec.tsx +1 -1
- package/test/component/Tooltip.touch.spec.tsx +1 -1
- package/test/component/Tooltip.visibility.spec.tsx +1 -1
- package/test/component/TooltipBoundingBox.spec.tsx +2 -2
- package/test/container/ClipPath.spec.tsx +1 -1
- package/test/context/chartLayoutContext.spec.tsx +1 -1
- package/test/helper/createSelectorTestCase.tsx +1 -1
- package/test/helper/mockAxes.ts +1 -1
- package/test/helper/selectorTestHelpers.tsx +1 -1
- package/test/hooks/useActiveTooltipDataPoints.spec.tsx +1 -1
- package/test/hooks/useOffset.spec.tsx +1 -1
- package/test/hooks/useTooltipStateHooks.spec.tsx +1 -1
- package/test/polar/Pie/Pie-TwoLevelPieChart.spec.tsx +1 -1
- package/test/polar/Pie/Pie.spec.tsx +1 -1
- package/test/polar/Pie/Pie.typed.spec.tsx +1 -1
- package/test/polar/Pie.animation.spec.tsx +1 -1
- package/test/polar/PieWithLegend.animation.spec.tsx +1 -1
- package/test/polar/PolarAngleAxis/PolarAngleAxis.events.spec.tsx +1 -1
- package/test/polar/PolarAngleAxis/PolarAngleAxis.spec.tsx +1 -1
- package/test/polar/PolarAngleAxis/PolarAngleAxis.typed.spec.tsx +1 -1
- package/test/polar/PolarAngleAxis.render.spec.tsx +1 -1
- package/test/polar/PolarGrid.render.spec.tsx +1 -1
- package/test/polar/PolarGrid.spec.tsx +1 -1
- package/test/polar/PolarLegendPerRow.render.spec.tsx +1 -1
- package/test/polar/PolarRadiusAxis.events.spec.tsx +1 -1
- package/test/polar/PolarRadiusAxis.render.spec.tsx +1 -1
- package/test/polar/PolarRadiusAxis.spec.tsx +1 -1
- package/test/polar/PolarRadiusAxis.typed.spec.tsx +1 -1
- package/test/polar/PolarTooltipLegend.render.spec.tsx +1 -1
- package/test/polar/Radar.animation.spec.tsx +1 -1
- package/test/polar/Radar.render.spec.tsx +1 -1
- package/test/polar/Radar.spec.tsx +1 -1
- package/test/polar/Radar.typed.spec.tsx +1 -1
- package/test/polar/RadialBar/RadialBar.spec.tsx +1 -1
- package/test/polar/RadialBar/RadialBar.typed.spec.tsx +1 -1
- package/test/polar/RadialBar.animation.spec.tsx +1 -1
- package/test/polar/RadialBar.render.spec.tsx +1 -1
- package/test/polar/RadialBar.stacked.spec.tsx +1 -1
- package/test/setup.ts +1 -1
- package/test/shape/ActiveShape.spec.tsx +1 -1
- package/test/shape/Cross.spec.tsx +1 -1
- package/test/shape/Curve.spec.tsx +2 -2
- package/test/shape/Curve.typed.spec.tsx +1 -1
- package/test/shape/Dot.spec.tsx +1 -1
- package/test/shape/Polygon.spec.tsx +1 -1
- package/test/shape/Rectangle.animation.spec.tsx +1 -1
- package/test/shape/Rectangle.spec.tsx +1 -1
- package/test/shape/Sector.spec.tsx +1 -1
- package/test/shape/Symbols.spec.tsx +1 -1
- package/test/shape/Trapezoid.spec.tsx +1 -1
- package/test/state/createCollectionActions.spec.ts +87 -0
- package/test/state/createSelector.spec.ts +158 -0
- package/test/state/hooks.spec.tsx +1 -1
- package/test/state/registerInStore.spec.tsx +101 -0
- package/test/state/selectors/axisSelectors.spec.tsx +1 -1
- package/test/state/selectors/combiners/combineConfiguredScale.spec.ts +1 -1
- package/test/state/selectors/combiners/combineRealScaleType.spec.ts +1 -1
- package/test/state/selectors/dataSelectors.spec.tsx +1 -1
- package/test/state/selectors/legendSelectors.spec.tsx +1 -1
- package/test/state/selectors/radarSelectors.spec.tsx +1 -1
- package/test/state/selectors/selectActiveTooltipIndex.spec.tsx +1 -1
- package/test/state/selectors/selectDisplayedData.spec.tsx +1 -1
- package/test/state/selectors/selectStackGroups.spec.tsx +1 -1
- package/test/state/selectors/selectorMemoization.spec.tsx +136 -0
- package/test/state/selectors/selectors.spec.tsx +1 -1
- package/test/util/CartesianUtils/CartesianUtils.spec.ts +1 -1
- package/test/util/ChartUtils/ChartUtils.spec.ts +1 -1
- package/test/util/ChartUtils/getCateCoordinateOfLine.spec.ts +14 -0
- package/test/util/ChartUtils/getStackedData.spec.ts +1 -1
- package/test/util/ChartUtils/truncateByDomain.spec.ts +1 -1
- package/test/util/DomUtils.spec.tsx +1 -1
- package/test/util/FunnelUtils.spec.tsx +1 -1
- package/test/util/scale/createCategoricalInverse.spec.ts +1 -1
- package/test/util/useElementOffset.spec.tsx +1 -1
- package/test/util/usePrefersReducedMotion.spec.ts +1 -1
- package/test/util/useUniqueId.spec.ts +1 -1
- package/test/zIndex/AllZIndexPortals.spec.tsx +1 -1
- package/test/zIndex/DynamicZIndex.spec.tsx +1 -1
- package/test/zIndex/ZIndexLayer.portalOwner.spec.tsx +1 -1
- package/test/zIndex/componentZIndex.spec.tsx +1 -1
- package/test/zIndex/multiChartZIndexIsolation.spec.tsx +1 -1
- package/test-results/.last-run.json +4 -0
- package/NEXT_SESSION_PROMPT.md +0 -114
- package/src/state/reduxDevtoolsJsonStringifyReplacer.ts +0 -15
- package/src/util/axisPropsAreEqual.ts +0 -42
- package/src/util/resolveDefaultProps.tsx +0 -8
- package/src/util/typedDataKey.ts +0 -8
- package/test/helper/render.ts +0 -7
- package/test/state/reduxDevtoolsJsonStringifyReplacer.spec.ts +0 -25
- package/test/util/axisPropsAreEqual.spec.ts +0 -93
package/src/util/ChartUtils.ts
CHANGED
|
@@ -15,16 +15,8 @@ import {
|
|
|
15
15
|
stackOffsetSilhouette,
|
|
16
16
|
stackOffsetWiggle,
|
|
17
17
|
stackOrderNone,
|
|
18
|
-
} from "
|
|
19
|
-
import {
|
|
20
|
-
findEntryInArray,
|
|
21
|
-
isNan,
|
|
22
|
-
isNotNil,
|
|
23
|
-
isNullish,
|
|
24
|
-
isNumber,
|
|
25
|
-
isNumOrStr,
|
|
26
|
-
mathSign,
|
|
27
|
-
} from "./DataUtils";
|
|
18
|
+
} from "d3-shape";
|
|
19
|
+
import { isNan, isNotNil, isNullish, isNumber, isNumOrStr, mathSign } from "./DataUtils";
|
|
28
20
|
import { getSliced } from "./getSliced";
|
|
29
21
|
import { isWellBehavedNumber } from "./isWellBehavedNumber";
|
|
30
22
|
import type {
|
|
@@ -276,6 +268,32 @@ export const truncateByDomain = <T>(
|
|
|
276
268
|
return result;
|
|
277
269
|
};
|
|
278
270
|
|
|
271
|
+
// Value→tick lookup cache, keyed on the ticks array reference. getCateCoordinateOfLine
|
|
272
|
+
// is called once per data point; a linear findEntryInArray scan there is O(points²)
|
|
273
|
+
// across a full series when allowDuplicatedCategory=false (ticks.length ≈ points).
|
|
274
|
+
// The axis-ticks selector memoizes the ticks array, so this map is built once per
|
|
275
|
+
// render and reused for every point lookup, making it O(points). First value wins,
|
|
276
|
+
// mirroring Array.find.
|
|
277
|
+
const tickByValueCache = new WeakMap<ReadonlyArray<TickItem>, Map<unknown, TickItem>>();
|
|
278
|
+
function findTickByValue(ticks: ReadonlyArray<TickItem>, value: unknown): TickItem | undefined {
|
|
279
|
+
// Map uses SameValueZero and would match NaN, while the upstream Array.find
|
|
280
|
+
// lookup uses strict equality (NaN !== NaN). Preserve that fallback behavior.
|
|
281
|
+
if (typeof value === "number" && Number.isNaN(value)) {
|
|
282
|
+
return undefined;
|
|
283
|
+
}
|
|
284
|
+
let map = tickByValueCache.get(ticks);
|
|
285
|
+
if (map == null) {
|
|
286
|
+
map = new Map<unknown, TickItem>();
|
|
287
|
+
for (const tick of ticks) {
|
|
288
|
+
if (tick != null && !map.has(tick.value)) {
|
|
289
|
+
map.set(tick.value, tick);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
tickByValueCache.set(ticks, map);
|
|
293
|
+
}
|
|
294
|
+
return map.get(value);
|
|
295
|
+
}
|
|
296
|
+
|
|
279
297
|
export function getCateCoordinateOfLine<T>({
|
|
280
298
|
axis,
|
|
281
299
|
ticks,
|
|
@@ -312,7 +330,7 @@ export function getCateCoordinateOfLine<T>({
|
|
|
312
330
|
const key: string | number = axisDataKey;
|
|
313
331
|
const cellValue = entry[key];
|
|
314
332
|
if (!isNullish(cellValue)) {
|
|
315
|
-
const matchedTick = ticks ?
|
|
333
|
+
const matchedTick = ticks ? findTickByValue(ticks, cellValue) : undefined;
|
|
316
334
|
|
|
317
335
|
if (matchedTick) {
|
|
318
336
|
return matchedTick.coordinate + bandSize / 2;
|
|
@@ -625,35 +643,61 @@ export const getStackedData = (
|
|
|
625
643
|
offsetType: StackOffsetType,
|
|
626
644
|
): ReadonlyArray<Series<StackDatum, StackKey>> => {
|
|
627
645
|
const offsetAccessor: OffsetAccessor = STACK_OFFSET_MAP[offsetType] ?? offsetSign;
|
|
646
|
+
// Track whether any value is a [min, max] tuple during the (unavoidable) value
|
|
647
|
+
// accessor pass, so the ranged-data fixup below can be skipped entirely for the
|
|
648
|
+
// common scalar case instead of running a second full series×points scan.
|
|
649
|
+
let hasRangedValues = false;
|
|
628
650
|
const stack = shapeStack<StackDatum, StackKey>()
|
|
629
651
|
.keys(dataKeys)
|
|
630
|
-
.value((d, key) =>
|
|
652
|
+
.value((d, key) => {
|
|
653
|
+
const raw = getValueByDataKey(d, key, 0);
|
|
654
|
+
if (Array.isArray(raw) && raw.length === 2) {
|
|
655
|
+
hasRangedValues = true;
|
|
656
|
+
}
|
|
657
|
+
return Number(raw);
|
|
658
|
+
})
|
|
631
659
|
.order(stackOrderNone)
|
|
632
660
|
.offset(offsetAccessor);
|
|
633
661
|
|
|
634
662
|
const result = stack(data);
|
|
635
663
|
|
|
636
664
|
// Ranged data: when a value is a [min, max] tuple, use it directly (no stacking).
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
665
|
+
if (hasRangedValues) {
|
|
666
|
+
result.forEach((s, seriesIndex) => {
|
|
667
|
+
s.forEach((point, pointIndex) => {
|
|
668
|
+
const value = getValueByDataKey(data[pointIndex], dataKeys[seriesIndex], 0);
|
|
669
|
+
if (value != null && Array.isArray(value) && value.length === 2) {
|
|
670
|
+
const lo: unknown = value[0];
|
|
671
|
+
const hi: unknown = value[1];
|
|
672
|
+
if (isNumber(lo) && isNumber(hi)) {
|
|
673
|
+
point[0] = lo;
|
|
674
|
+
point[1] = hi;
|
|
675
|
+
}
|
|
646
676
|
}
|
|
647
|
-
}
|
|
677
|
+
});
|
|
648
678
|
});
|
|
649
|
-
}
|
|
679
|
+
}
|
|
650
680
|
|
|
651
681
|
return result;
|
|
652
682
|
};
|
|
653
683
|
|
|
654
684
|
const getDomainOfSingle = (data: ReadonlyArray<ReadonlyArray<unknown>>): number[] => {
|
|
655
|
-
|
|
656
|
-
|
|
685
|
+
// Reduce loop, not `Math.min(...flat)`: spreading a data-sized array throws a V8
|
|
686
|
+
// RangeError past ~100k elements. Empty input yields [Infinity, -Infinity],
|
|
687
|
+
// matching the previous Math.min/Math.max-of-empty behavior.
|
|
688
|
+
let min = Infinity;
|
|
689
|
+
let max = -Infinity;
|
|
690
|
+
for (const value of data.flat(2)) {
|
|
691
|
+
if (isNumber(value)) {
|
|
692
|
+
if (value < min) {
|
|
693
|
+
min = value;
|
|
694
|
+
}
|
|
695
|
+
if (value > max) {
|
|
696
|
+
max = value;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
return [min, max];
|
|
657
701
|
};
|
|
658
702
|
|
|
659
703
|
const makeDomainFinite = (domain: NumberDomain): NumberDomain => [
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
// Ported from recharts 3.8.1 src/util/propsAreEqual.ts (commit 7a23854).
|
|
2
2
|
//
|
|
3
3
|
// Deviation: recharts imports `shallowEqual` from `react-redux`. A SolidJS port
|
|
4
|
-
// has no react-redux, so
|
|
5
|
-
//
|
|
6
|
-
// key (its internal `is` predates and mirrors `Object.is`), so the local
|
|
7
|
-
// version below is behavior-identical — NaN compares equal, +0 and -0 do not.
|
|
4
|
+
// has no react-redux, so it reuses the local equivalent in `./ShallowEqual`
|
|
5
|
+
// (one-level same-value compare — NaN equal, +0 and -0 distinct).
|
|
8
6
|
//
|
|
9
7
|
// NOTE on relevance: recharts uses `propsAreEqual` only as the `React.memo`
|
|
10
8
|
// comparator on Bar/Area/Line/Scatter/Legend/ReportEventSettings/etc. Solid
|
|
11
9
|
// components do not re-render, so when those units are ported this comparator
|
|
12
10
|
// will most likely be dropped or repurposed. The function itself is pure and
|
|
13
11
|
// spec-tested, so we port it now and revisit its call sites in Tier 2.
|
|
12
|
+
import { shallowEqual } from "./ShallowEqual";
|
|
14
13
|
|
|
15
14
|
const propsToShallowCompare = new Set<string>([
|
|
16
15
|
"axisLine",
|
|
@@ -37,35 +36,6 @@ const propsToShallowCompare = new Set<string>([
|
|
|
37
36
|
"throttledEvents",
|
|
38
37
|
]);
|
|
39
38
|
|
|
40
|
-
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
41
|
-
return typeof value === "object" && value !== null;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* One-level same-value comparison, equivalent to react-redux's `shallowEqual`.
|
|
46
|
-
* Uses `Object.is`, so two NaNs are equal and +0/-0 are not — matching the
|
|
47
|
-
* original.
|
|
48
|
-
*/
|
|
49
|
-
function shallowEqual(objA: unknown, objB: unknown): boolean {
|
|
50
|
-
if (Object.is(objA, objB)) {
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
if (!isRecord(objA) || !isRecord(objB)) {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
const keysA = Object.keys(objA);
|
|
57
|
-
const keysB = Object.keys(objB);
|
|
58
|
-
if (keysA.length !== keysB.length) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
for (const key of keysA) {
|
|
62
|
-
if (!Object.hasOwn(objB, key) || !Object.is(objA[key], objB[key])) {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return true;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
39
|
/**
|
|
70
40
|
* When comparing two values, returns true if they are the same value or
|
|
71
41
|
* are both NaN.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Ported from recharts 3.8.1 src/util/stacks/stackTypes.ts (commit 7a23854).
|
|
2
|
-
import { Series } from "
|
|
2
|
+
import { Series } from "d3-shape";
|
|
3
3
|
import { StackId } from "../ChartUtils";
|
|
4
4
|
import { DataKey } from "../types";
|
|
5
5
|
import { GraphicalItemId } from "../../state/graphicalItemsSlice";
|
package/src/util/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { JSX } from "@solidjs/web";
|
|
2
2
|
import type { Element } from "solid-js";
|
|
3
|
-
import type * as d3Scales from "
|
|
3
|
+
import type * as d3Scales from "d3-scale";
|
|
4
4
|
import type { DotProps } from "../shape/Dot";
|
|
5
5
|
import type { ExternalMouseEvents } from "../chart/types";
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ import type { ExternalMouseEvents } from "../chart/types";
|
|
|
10
10
|
// codebase (Area, Label, Text, axisSelectors, d3-scale, the public index). We do
|
|
11
11
|
// NOT port it whole — only the geometry/value types the currently-ported units
|
|
12
12
|
// reference, growing this file as later units need more ("declare/stub then
|
|
13
|
-
// backfill"
|
|
13
|
+
// backfill"). Definitions are copied faithfully; the sole
|
|
14
14
|
// deviation is `ChartCoordinate`'s `any` fields → `unknown` (this repo bans
|
|
15
15
|
// `any`; the type is `@deprecated` and those fields aren't read structurally by
|
|
16
16
|
// current consumers).
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
// load-bearing contracts (fresh `from`, settled `to`, gating) are asserted.
|
|
23
23
|
import { describe, expect, it, vi, beforeEach } from "vitest";
|
|
24
24
|
import { createSignal, flush } from "solid-js";
|
|
25
|
-
import { render, fireEvent } from "
|
|
25
|
+
import { render, fireEvent } from "@solidjs/testing-library";
|
|
26
26
|
import { CSSTransitionAnimate } from "../../src/animation/CSSTransitionAnimate";
|
|
27
27
|
import { MockControllerAnimationManager } from "./mockControllerAnimationManager";
|
|
28
28
|
import { expectLastCalledWith } from "../helper/expectLastCalledWith";
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// injected MockControllerAnimationManager (deterministic, no requestAnimationFrame).
|
|
10
10
|
import { describe, it, expect, vi } from "vitest";
|
|
11
11
|
import { flush } from "solid-js";
|
|
12
|
-
import { render } from "
|
|
12
|
+
import { render } from "@solidjs/testing-library";
|
|
13
13
|
import { JavascriptAnimate } from "../../src/animation/JavascriptAnimate";
|
|
14
14
|
import { MockControllerAnimationManager } from "./mockControllerAnimationManager";
|
|
15
15
|
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
Scatter,
|
|
52
52
|
ScatterChart,
|
|
53
53
|
} from "../../src";
|
|
54
|
-
import { render, fireEvent } from "
|
|
54
|
+
import { render, fireEvent } from "@solidjs/testing-library";
|
|
55
55
|
import { AnimationControllerProvider } from "../../src/animation/useAnimationController";
|
|
56
56
|
import type { AnimationController } from "../../src";
|
|
57
57
|
import {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
// propagation to a flush boundary.
|
|
20
20
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
21
21
|
import { createSignal, flush } from "solid-js";
|
|
22
|
-
import { render } from "
|
|
22
|
+
import { render } from "@solidjs/testing-library";
|
|
23
23
|
import { AreaChart, Area } from "../../src";
|
|
24
24
|
import { AnimationControllerProvider } from "../../src/animation/useAnimationController";
|
|
25
25
|
import { MockControllerAnimationManager as MockProgressAnimationManager } from "../animation/mockControllerAnimationManager";
|
|
@@ -7,7 +7,7 @@ import { beforeEach, describe, expect, it } from "vitest";
|
|
|
7
7
|
import { flush } from "solid-js";
|
|
8
8
|
import { Area, AreaChart, Tooltip, XAxis, YAxis } from "../../src";
|
|
9
9
|
import { rangeData } from "../_data";
|
|
10
|
-
import { render } from "
|
|
10
|
+
import { render } from "@solidjs/testing-library";
|
|
11
11
|
import { mockGetBoundingClientRect } from "../helper/mockGetBoundingClientRect";
|
|
12
12
|
import { showTooltip } from "../component/Tooltip/tooltipTestHelpers";
|
|
13
13
|
import { areaChartMouseHoverTooltipSelector } from "../component/Tooltip/tooltipMouseHoverSelectors";
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
allCartesianChartsExcept,
|
|
41
41
|
type CartesianChartTestCase,
|
|
42
42
|
} from "../helper/parameterizedTestCases";
|
|
43
|
-
import { fireEvent, render, screen } from "
|
|
43
|
+
import { fireEvent, render, screen } from "@solidjs/testing-library";
|
|
44
44
|
|
|
45
45
|
const emptyBaseValues: ReadonlyArray<BaseValue | undefined> = [undefined, NaN];
|
|
46
46
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// register via effects and points compute from the store.
|
|
8
8
|
import { describe, expect, it } from "vitest";
|
|
9
9
|
import { flush } from "solid-js";
|
|
10
|
-
import { render } from "
|
|
10
|
+
import { render } from "@solidjs/testing-library";
|
|
11
11
|
import { AreaChart, Area } from "../../src";
|
|
12
12
|
|
|
13
13
|
const data = [
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
// shape; `getRelativeCoordinate(e)` still accepts the (SVG) event.
|
|
24
24
|
import { describe, it } from "vitest";
|
|
25
25
|
import { Area, AreaChart, getRelativeCoordinate } from "../../src";
|
|
26
|
-
import { render } from "
|
|
26
|
+
import { render } from "@solidjs/testing-library";
|
|
27
27
|
import { expectAreaCurve, type ExpectedArea } from "../helper/expectAreaCurve";
|
|
28
28
|
|
|
29
29
|
type ExampleDataPoint = {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// coords would diverge from recharts for reasons unrelated to axis logic.
|
|
9
9
|
import { describe, expect, it } from "vitest";
|
|
10
10
|
import { flush } from "solid-js";
|
|
11
|
-
import { render } from "
|
|
11
|
+
import { render } from "@solidjs/testing-library";
|
|
12
12
|
import { LineChart, Line, XAxis, YAxis } from "../../src";
|
|
13
13
|
|
|
14
14
|
function tickTexts(container: Element, axis: ".recharts-xAxis" | ".recharts-yAxis"): string[] {
|
|
@@ -12,7 +12,7 @@ import { barChartMouseHoverTooltipSelector } from "../../component/Tooltip/toolt
|
|
|
12
12
|
import { mockGetBoundingClientRect } from "../../helper/mockGetBoundingClientRect";
|
|
13
13
|
import { expectNthCalledWith } from "../../helper/expectLastCalledWith";
|
|
14
14
|
import { assertNotNull } from "../../helper/assertNotNull";
|
|
15
|
-
import { fireEvent } from "
|
|
15
|
+
import { fireEvent } from "@solidjs/testing-library";
|
|
16
16
|
|
|
17
17
|
const expectedBars: ReadonlyArray<ExpectedBar> = [
|
|
18
18
|
{
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
import type { CartesianGraphicalItemSettings } from "../../../src/state/graphicalItemsSlice";
|
|
22
22
|
import { useAppSelector } from "../../../src/state/hooks";
|
|
23
23
|
import { BarSettings } from "../../../src/state/types/BarSettings";
|
|
24
|
-
import { fireEvent, render } from "
|
|
24
|
+
import { fireEvent, render } from "@solidjs/testing-library";
|
|
25
25
|
import { assertZIndexLayerOrder } from "../../helper/assertZIndexLayerOrder";
|
|
26
26
|
import { expectActiveBars, expectBars, getAllBarPaths, getAllBars } from "../../helper/expectBars";
|
|
27
27
|
import { expectLabels } from "../../helper/expectLabel";
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
// on each call (golden-anchored to the Solid type surface).
|
|
20
20
|
import { describe, it } from "vitest";
|
|
21
21
|
import { Bar, BarChart, getRelativeCoordinate, type BarRectangleItem } from "../../../src";
|
|
22
|
-
import { render } from "
|
|
22
|
+
import { render } from "@solidjs/testing-library";
|
|
23
23
|
import { expectBars, type ExpectedBar } from "../../helper/expectBars";
|
|
24
24
|
|
|
25
25
|
type ExampleDataPoint = {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
// same "restart from the beginning" behaviour.
|
|
31
31
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
32
32
|
import { createSignal, flush } from "solid-js";
|
|
33
|
-
import { render, fireEvent } from "
|
|
33
|
+
import { render, fireEvent } from "@solidjs/testing-library";
|
|
34
34
|
import { BarChart, Bar } from "../../src";
|
|
35
35
|
import { AnimationControllerProvider } from "../../src/animation/useAnimationController";
|
|
36
36
|
import { MockControllerAnimationManager as MockProgressAnimationManager } from "../animation/mockControllerAnimationManager";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// exercises the un-deferred selectDomainOfStackGroups → combineNumericalDomain path.
|
|
4
4
|
import { describe, expect, it } from "vitest";
|
|
5
5
|
import { flush } from "solid-js";
|
|
6
|
-
import { render } from "
|
|
6
|
+
import { render } from "@solidjs/testing-library";
|
|
7
7
|
import { BarChart, Bar, XAxis, YAxis } from "../../src";
|
|
8
8
|
|
|
9
9
|
const data = [
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// register via effects and rects compute from the store.
|
|
6
6
|
import { describe, expect, it } from "vitest";
|
|
7
7
|
import { flush } from "solid-js";
|
|
8
|
-
import { render } from "
|
|
8
|
+
import { render } from "@solidjs/testing-library";
|
|
9
9
|
import { BarChart, Bar } from "../../src";
|
|
10
10
|
|
|
11
11
|
const data = [
|
|
@@ -3,7 +3,7 @@ import { describe, expect, it } from "vitest";
|
|
|
3
3
|
import { flush } from "solid-js";
|
|
4
4
|
import { Bar, BarChart, BarStack, XAxis, YAxis } from "../../src";
|
|
5
5
|
import { createSelectorTestCase } from "../helper/createSelectorTestCase";
|
|
6
|
-
import { render } from "
|
|
6
|
+
import { render } from "@solidjs/testing-library";
|
|
7
7
|
import { selectBarRectangles } from "../../src/state/selectors/barSelectors";
|
|
8
8
|
import { getAllBars } from "../helper/expectBars";
|
|
9
9
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// real browser; here we flush manually).
|
|
5
5
|
import { describe, expect, it } from "vitest";
|
|
6
6
|
import { flush } from "solid-js";
|
|
7
|
-
import { render, fireEvent } from "
|
|
7
|
+
import { render, fireEvent } from "@solidjs/testing-library";
|
|
8
8
|
import { LineChart, Line, XAxis, YAxis, Brush } from "../../src";
|
|
9
9
|
|
|
10
10
|
const data = [
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { describe, expect, it } from "vitest";
|
|
7
7
|
import { flush } from "solid-js";
|
|
8
8
|
import { Brush, Line, LineChart } from "../../src";
|
|
9
|
-
import { render } from "
|
|
9
|
+
import { render } from "@solidjs/testing-library";
|
|
10
10
|
|
|
11
11
|
const data = [
|
|
12
12
|
{ name: "a", uv: 100 },
|
|
@@ -6,7 +6,7 @@ import { describe, expect, it, vi } from "vitest";
|
|
|
6
6
|
import { flush } from "solid-js";
|
|
7
7
|
import type { JSX } from "@solidjs/web";
|
|
8
8
|
import { BarChart, Brush } from "../../src";
|
|
9
|
-
import { fireEvent, render } from "
|
|
9
|
+
import { fireEvent, render } from "@solidjs/testing-library";
|
|
10
10
|
import { assertNotNull } from "../helper/assertNotNull";
|
|
11
11
|
|
|
12
12
|
const data = [
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// `flush()` because the brush registers settings + reads indices via effects.
|
|
6
6
|
import { describe, expect, it } from "vitest";
|
|
7
7
|
import { flush } from "solid-js";
|
|
8
|
-
import { render, fireEvent } from "
|
|
8
|
+
import { render, fireEvent } from "@solidjs/testing-library";
|
|
9
9
|
import { LineChart, Line, XAxis, YAxis, Brush } from "../../src";
|
|
10
10
|
|
|
11
11
|
const data = [
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
import { describe, expect, it, test } from "vitest";
|
|
27
27
|
import { createSignal, flush } from "solid-js";
|
|
28
28
|
import type { JSX } from "@solidjs/web";
|
|
29
|
-
import { render, fireEvent, screen, waitFor } from "
|
|
29
|
+
import { render, fireEvent, screen, waitFor } from "@solidjs/testing-library";
|
|
30
30
|
import { BarChart, Brush, ComposedChart, Line, LineChart, ReferenceLine } from "../../src";
|
|
31
31
|
import type { BrushProps } from "../../src";
|
|
32
32
|
import { assertNotNull } from "../helper/assertNotNull";
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
import { describe, expect, it } from "vitest";
|
|
19
19
|
import { flush } from "solid-js";
|
|
20
20
|
import { createSelectorTestCase } from "../helper/createSelectorTestCase";
|
|
21
|
-
import { fireEvent } from "
|
|
21
|
+
import { fireEvent } from "@solidjs/testing-library";
|
|
22
22
|
import { BarChart, Bar, Brush } from "../../src";
|
|
23
23
|
import { PageData } from "../_data";
|
|
24
24
|
import { assertNotNull } from "../helper/assertNotNull";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// not just register settings.
|
|
4
4
|
import { describe, expect, it } from "vitest";
|
|
5
5
|
import { flush } from "solid-js";
|
|
6
|
-
import { render } from "
|
|
6
|
+
import { render } from "@solidjs/testing-library";
|
|
7
7
|
import { LineChart, Line, XAxis, YAxis } from "../../src";
|
|
8
8
|
import { PageData } from "../_data";
|
|
9
9
|
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
// React.cloneElement an already-evaluated element to inject computed x/y — function form
|
|
7
7
|
// covers it).
|
|
8
8
|
import { describe, expect, it } from "vitest";
|
|
9
|
-
import { scaleLinear } from "
|
|
10
|
-
import { render } from "
|
|
9
|
+
import { scaleLinear } from "d3-scale";
|
|
10
|
+
import { render } from "@solidjs/testing-library";
|
|
11
11
|
import { CartesianAxis, Surface } from "../../src";
|
|
12
12
|
import type { CartesianTickContentProps, TickItem } from "../../src/util/types";
|
|
13
13
|
import type { LabelContentType } from "../../src/component/Label";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// axis ticks across the plot area.
|
|
3
3
|
import { describe, expect, it } from "vitest";
|
|
4
4
|
import { flush } from "solid-js";
|
|
5
|
-
import { render } from "
|
|
5
|
+
import { render } from "@solidjs/testing-library";
|
|
6
6
|
import { LineChart, Line, XAxis, YAxis, CartesianGrid } from "../../src";
|
|
7
7
|
import { PageData } from "../_data";
|
|
8
8
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import { describe, expect, it, type Mock, test, vi } from "vitest";
|
|
16
16
|
import { createEffect, flush } from "solid-js";
|
|
17
17
|
import type { JSX } from "@solidjs/web";
|
|
18
|
-
import { render } from "
|
|
18
|
+
import { render } from "@solidjs/testing-library";
|
|
19
19
|
import {
|
|
20
20
|
CartesianGrid,
|
|
21
21
|
LineChart,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// selectAllErrorBarSettings → getErrorDomainByDataKey path).
|
|
4
4
|
import { describe, expect, it } from "vitest";
|
|
5
5
|
import { flush } from "solid-js";
|
|
6
|
-
import { render } from "
|
|
6
|
+
import { render } from "@solidjs/testing-library";
|
|
7
7
|
import { LineChart, Line, XAxis, YAxis, ErrorBar } from "../../src";
|
|
8
8
|
|
|
9
9
|
const data = [
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
XAxis,
|
|
19
19
|
YAxis,
|
|
20
20
|
} from "../../src";
|
|
21
|
-
import { render } from "
|
|
21
|
+
import { render } from "@solidjs/testing-library";
|
|
22
22
|
import { AnimationControllerProvider } from "../../src/animation/useAnimationController";
|
|
23
23
|
import type { AnimationController } from "../../src";
|
|
24
24
|
import { MockControllerAnimationManager } from "../animation/mockControllerAnimationManager";
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
import { describe, expect, it, vi } from "vitest";
|
|
23
23
|
import { createSignal, flush } from "solid-js";
|
|
24
24
|
import { createSelectorTestCase } from "../helper/createSelectorTestCase";
|
|
25
|
-
import { render, fireEvent } from "
|
|
25
|
+
import { render, fireEvent } from "@solidjs/testing-library";
|
|
26
26
|
import { AnimationControllerProvider } from "../../src/animation/useAnimationController";
|
|
27
27
|
import { MockControllerAnimationManager as MockProgressAnimationManager } from "../animation/mockControllerAnimationManager";
|
|
28
28
|
import { Funnel, FunnelChart } from "../../src";
|
|
@@ -10,7 +10,7 @@ import { Cell, Funnel, FunnelChart, FunnelProps, FunnelTrapezoidItem, LabelList
|
|
|
10
10
|
import { showTooltip } from "../component/Tooltip/tooltipTestHelpers";
|
|
11
11
|
import { funnelChartMouseHoverTooltipSelector } from "../component/Tooltip/tooltipMouseHoverSelectors";
|
|
12
12
|
import { computeFunnelTrapezoids } from "../../src/cartesian/Funnel";
|
|
13
|
-
import { render } from "
|
|
13
|
+
import { render } from "@solidjs/testing-library";
|
|
14
14
|
|
|
15
15
|
const data = [
|
|
16
16
|
{ value: 100, name: "展现" },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import { Funnel, FunnelChart, getRelativeCoordinate, type FunnelTrapezoidItem } from "../../src";
|
|
3
|
-
import { render } from "
|
|
3
|
+
import { render } from "@solidjs/testing-library";
|
|
4
4
|
|
|
5
5
|
type ExampleDataPoint = {
|
|
6
6
|
value: number;
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
// last spy call holds the current points. `p.payload` is `unknown` in our port
|
|
13
13
|
// (recharts erases it via `any`), so a runtime guard reads `name`/`x` — no `as`.
|
|
14
14
|
import { describe, it, expect, beforeEach } from "vitest";
|
|
15
|
-
import { scaleLinear, scalePoint } from "
|
|
15
|
+
import { scaleLinear, scalePoint } from "d3-scale";
|
|
16
16
|
import { createSignal, flush } from "solid-js";
|
|
17
17
|
import type { JSX } from "@solidjs/web";
|
|
18
|
-
import { fireEvent } from "
|
|
18
|
+
import { fireEvent } from "@solidjs/testing-library";
|
|
19
19
|
import { Line, LineChart, XAxis, YAxis } from "../../src";
|
|
20
20
|
import { createSelectorTestCase } from "../helper/createSelectorTestCase";
|
|
21
21
|
import { mockGetBoundingClientRect } from "../helper/mockGetBoundingClientRect";
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
// scheduling — render-count coupled.
|
|
26
26
|
import { describe, expect, it, beforeAll, afterAll, beforeEach } from "vitest";
|
|
27
27
|
import { createSignal, flush } from "solid-js";
|
|
28
|
-
import { render } from "
|
|
28
|
+
import { render } from "@solidjs/testing-library";
|
|
29
29
|
import { LineChart, Line } from "../../src";
|
|
30
30
|
import { AnimationControllerProvider } from "../../src/animation/useAnimationController";
|
|
31
31
|
import { MockControllerAnimationManager as MockProgressAnimationManager } from "../animation/mockControllerAnimationManager";
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// mocked on SVGElement.prototype (jsdom lacks it).
|
|
12
12
|
import { describe, expect, it, beforeAll, afterAll } from "vitest";
|
|
13
13
|
import { flush } from "solid-js";
|
|
14
|
-
import { render } from "
|
|
14
|
+
import { render } from "@solidjs/testing-library";
|
|
15
15
|
import { ComposedChart, Line, XAxis } from "../../src";
|
|
16
16
|
import { AnimationControllerProvider } from "../../src/animation/useAnimationController";
|
|
17
17
|
import { MockControllerAnimationManager as MockProgressAnimationManager } from "../animation/mockControllerAnimationManager";
|
|
@@ -23,7 +23,7 @@ import { showTooltip } from "../component/Tooltip/tooltipTestHelpers";
|
|
|
23
23
|
import { lineChartMouseHoverTooltipSelector } from "../component/Tooltip/tooltipMouseHoverSelectors";
|
|
24
24
|
import { assertNotNull } from "../helper/assertNotNull";
|
|
25
25
|
import { expectLastCalledWith } from "../helper/expectLastCalledWith";
|
|
26
|
-
import { fireEvent, render } from "
|
|
26
|
+
import { fireEvent, render } from "@solidjs/testing-library";
|
|
27
27
|
|
|
28
28
|
describe("<Line />", () => {
|
|
29
29
|
beforeEach(() => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// range (x1..x2, y1..y2), mapped to pixels through both cartesian scales.
|
|
3
3
|
import { describe, expect, it } from "vitest";
|
|
4
4
|
import { flush } from "solid-js";
|
|
5
|
-
import { render } from "
|
|
5
|
+
import { render } from "@solidjs/testing-library";
|
|
6
6
|
import { LineChart, Line, XAxis, YAxis, ReferenceArea } from "../../src";
|
|
7
7
|
|
|
8
8
|
const data = [
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import { describe, expect, it, test, vi } from "vitest";
|
|
21
21
|
import { createEffect, createSignal, flush, Show } from "solid-js";
|
|
22
22
|
import type { JSX } from "@solidjs/web";
|
|
23
|
-
import { fireEvent, render, screen } from "
|
|
23
|
+
import { fireEvent, render, screen } from "@solidjs/testing-library";
|
|
24
24
|
import { Bar, BarChart, IfOverflow, LineChart, ReferenceArea, XAxis, YAxis } from "../../src";
|
|
25
25
|
import { useAppSelector } from "../../src/state/hooks";
|
|
26
26
|
import { selectReferenceAreasByAxis } from "../../src/state/selectors/axisSelectors";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import { Line, LineChart, ReferenceArea, getRelativeCoordinate } from "../../src";
|
|
3
|
-
import { render } from "
|
|
3
|
+
import { render } from "@solidjs/testing-library";
|
|
4
4
|
|
|
5
5
|
// Ported from recharts 3.8.1 test/cartesian/ReferenceArea.typed.spec.tsx.
|
|
6
6
|
|