@recharts/devtools 0.0.17 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/theme/analyze.d.ts +103 -0
- package/dist/theme/analyze.js +184 -0
- package/dist/theme/color.d.ts +53 -0
- package/dist/theme/color.js +90 -0
- package/dist/theme/failures.d.ts +8 -0
- package/dist/theme/failures.js +37 -0
- package/dist/theme/index.d.ts +8 -0
- package/dist/theme/index.js +5 -0
- package/dist/theme/standards.d.ts +28 -0
- package/dist/theme/standards.js +48 -0
- package/dist/theme/suggest.d.ts +10 -0
- package/dist/theme/suggest.js +29 -0
- package/package.json +30 -4
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @recharts/devtools
|
|
2
2
|
|
|
3
|
+
> **This package is entirely optional.** Recharts works perfectly fine without it. `@recharts/devtools` provides quality of life improvements and development tools to help you build and debug Recharts-based applications more efficiently.
|
|
4
|
+
|
|
3
5
|
Devtools for Recharts.
|
|
4
6
|
|
|
5
7
|
[](https://badge.fury.io/js/@recharts%2Fdevtools)
|
|
@@ -66,3 +68,37 @@ function EditorWithPreview() {
|
|
|
66
68
|
);
|
|
67
69
|
}
|
|
68
70
|
```
|
|
71
|
+
|
|
72
|
+
## Theme accessibility checks
|
|
73
|
+
|
|
74
|
+
`@recharts/devtools/theme` measures how readable the colors of a Recharts theme are. It takes your `RechartsTheme` object as it is. Nothing from React or Recharts runs: the theme is plain data, and Recharts only provides its type (Recharts 3.11.0-canary.6 or newer: earlier versions don't have the full `RechartsTheme` type). All the color math comes from [culori](https://culorijs.org/).
|
|
75
|
+
|
|
76
|
+
For the theme's `pageBackground` (or any backgrounds you pass), and for typical vision plus simulated protanopia, deuteranopia and tritanopia, it checks:
|
|
77
|
+
|
|
78
|
+
| Check | What it measures | Default threshold |
|
|
79
|
+
|---|---|---|
|
|
80
|
+
| `seriesOnBackground` | each series fill and stroke against the page | 3:1, [WCAG 2.2 SC 1.4.11](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html) |
|
|
81
|
+
| `seriesVsSeries` | CIEDE2000 difference between every pair of series | none, you choose |
|
|
82
|
+
| `seriesContrast` | WCAG contrast between every pair, for touching marks like pie slices | none, you choose |
|
|
83
|
+
| `textOnBackground` | `typography.color` on the page | 4.5:1, [WCAG 2.2 SC 1.4.3](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html) |
|
|
84
|
+
| `seriesAsText` | a series color used for label text on the page | 4.5:1, SC 1.4.3 |
|
|
85
|
+
| `textOnSeries` | `typography.color` on each series fill | 4.5:1, SC 1.4.3 |
|
|
86
|
+
|
|
87
|
+
A failed check usually comes with a fix: the nearest lighter or darker color, with the same hue, that would pass. `fix` is `null` when no lightness passes.
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
import { analyzeTheme, themeFailures } from '@recharts/devtools/theme';
|
|
91
|
+
import { myTheme } from './myTheme';
|
|
92
|
+
|
|
93
|
+
test('my theme is readable', () => {
|
|
94
|
+
const report = analyzeTheme(myTheme, {
|
|
95
|
+
thresholds: { seriesDifference: 10, seriesDifferenceCvd: 2 },
|
|
96
|
+
checks: { textOnSeries: false },
|
|
97
|
+
});
|
|
98
|
+
expect(themeFailures(report)).toEqual([]);
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
The guide at https://recharts.github.io/en-US/guide/theme-color-testing/ explains each check and links the standards behind it.
|
|
103
|
+
|
|
104
|
+
The package is ESM only.
|
package/dist/index.d.ts
CHANGED
|
@@ -2,11 +2,13 @@ export { between, random } from './random.js';
|
|
|
2
2
|
export { generateMockData } from './generateMockData.js';
|
|
3
3
|
export type { MockDataType } from './generateMockData.js';
|
|
4
4
|
export { generateMockMarketData } from './generateMockMarketData.js';
|
|
5
|
+
export type { MarketCandle } from './generateMockMarketData.js';
|
|
5
6
|
export { RechartsDevtools } from './components/RechartsDevtools.js';
|
|
6
7
|
export { RechartsAnnotations } from './components/RechartsAnnotations.js';
|
|
7
8
|
export { RechartsDevtoolsPortal, RechartsAnnotationsPortal, RechartsDevtoolsContext, } from './context/RechartsDevtoolsContext.js';
|
|
8
9
|
export { RECHARTS_DEVTOOLS_PORTAL_ID, RECHARTS_ANNOTATIONS_PORTAL_ID } from './constants.js';
|
|
9
10
|
export type { Annotation, AnnotationType, AnnotationStyle } from './annotations/types.js';
|
|
10
11
|
export { useAnnotationsManager } from './annotations/useAnnotationsManager.js';
|
|
12
|
+
export { Blanket } from './annotations/Blanket.js';
|
|
11
13
|
export { useWhyDidYouRender } from './hooks/useWhyDidYouRender.js';
|
|
12
14
|
export { useSessionStorageState } from './hooks/useSessionStorageState.js';
|
package/dist/index.js
CHANGED
|
@@ -6,5 +6,6 @@ export { RechartsAnnotations } from './components/RechartsAnnotations.js';
|
|
|
6
6
|
export { RechartsDevtoolsPortal, RechartsAnnotationsPortal, RechartsDevtoolsContext, } from './context/RechartsDevtoolsContext.js';
|
|
7
7
|
export { RECHARTS_DEVTOOLS_PORTAL_ID, RECHARTS_ANNOTATIONS_PORTAL_ID } from './constants.js';
|
|
8
8
|
export { useAnnotationsManager } from './annotations/useAnnotationsManager.js';
|
|
9
|
+
export { Blanket } from './annotations/Blanket.js';
|
|
9
10
|
export { useWhyDidYouRender } from './hooks/useWhyDidYouRender.js';
|
|
10
11
|
export { useSessionStorageState } from './hooks/useSessionStorageState.js';
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { RechartsTheme } from 'recharts';
|
|
2
|
+
import { type Vision } from './color.js';
|
|
3
|
+
import { type CriterionId } from './standards.js';
|
|
4
|
+
/**
|
|
5
|
+
* - `fill`: the series fill, painted at its `fillOpacity` over the page. Bars, areas, pie slices.
|
|
6
|
+
* - `stroke`: the series stroke, fully opaque. Lines, outlines, dots.
|
|
7
|
+
*/
|
|
8
|
+
export type Mark = 'fill' | 'stroke';
|
|
9
|
+
export type CheckId = 'seriesOnBackground' | 'seriesVsSeries' | 'seriesContrast' | 'textOnBackground' | 'seriesAsText' | 'textOnSeries';
|
|
10
|
+
export type Thresholds = {
|
|
11
|
+
/** Series against the page. Defaults to 3, from WCAG SC 1.4.11. */
|
|
12
|
+
nonTextContrast: number;
|
|
13
|
+
/** Labels against what they sit on. Defaults to 4.5, from WCAG SC 1.4.3. See `WCAG_CONTRAST` for the others. */
|
|
14
|
+
textContrast: number;
|
|
15
|
+
/**
|
|
16
|
+
* Smallest CIEDE2000 difference between two series in typical vision.
|
|
17
|
+
* No standard defines one, so there is no default: without it the check only reports values.
|
|
18
|
+
*/
|
|
19
|
+
seriesDifference: number | null;
|
|
20
|
+
/** Like `seriesDifference`, under simulated color vision deficiencies. No default either. */
|
|
21
|
+
seriesDifferenceCvd: number | null;
|
|
22
|
+
/**
|
|
23
|
+
* WCAG contrast between two series, for charts where series touch, like pie slices without borders.
|
|
24
|
+
* No default: WCAG SC 1.4.11 asks for 3:1 only when nothing else separates them.
|
|
25
|
+
*/
|
|
26
|
+
seriesContrast: number | null;
|
|
27
|
+
};
|
|
28
|
+
export type ThemeCheckOptions = {
|
|
29
|
+
/**
|
|
30
|
+
* The backgrounds to check on, by name. Defaults to `{ page: theme.pageBackground }`, falling back to
|
|
31
|
+
* `theme.chart.backgroundColor`. Pass more when the same theme shows on several surfaces, like cards.
|
|
32
|
+
*/
|
|
33
|
+
backgrounds?: Readonly<Record<string, string>>;
|
|
34
|
+
/** Defaults to all four. */
|
|
35
|
+
visions?: ReadonlyArray<Vision>;
|
|
36
|
+
/** From 0 to 1, see `simulateVision`. Defaults to 1. */
|
|
37
|
+
severity?: number;
|
|
38
|
+
/** Defaults to both. */
|
|
39
|
+
marks?: ReadonlyArray<Mark>;
|
|
40
|
+
thresholds?: Partial<Thresholds>;
|
|
41
|
+
/**
|
|
42
|
+
* Turn off checks that don't apply to your charts. Every check is on by default, except that
|
|
43
|
+
* `textOnBackground` and `textOnSeries` only run when `theme.typography.color` is set.
|
|
44
|
+
*/
|
|
45
|
+
checks?: Partial<Record<CheckId, boolean>>;
|
|
46
|
+
};
|
|
47
|
+
/** One series, as read from `theme.graphicalItems`. */
|
|
48
|
+
export type ThemeSeries = {
|
|
49
|
+
index: number;
|
|
50
|
+
fill: string;
|
|
51
|
+
stroke: string;
|
|
52
|
+
fillOpacity: number;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* A color that would make a failed check pass: the nearest lighter or darker color with the same hue.
|
|
56
|
+
* Changing it may affect other checks, so run the analysis again after you change it.
|
|
57
|
+
*/
|
|
58
|
+
export type Fix = {
|
|
59
|
+
/** Which color to change: a series (its fill or stroke, see `CheckResult.mark`) or the label color. */
|
|
60
|
+
target: 'series' | 'text';
|
|
61
|
+
/** The zero-based index of the series to change, or `null` for the label color. */
|
|
62
|
+
series: number | null;
|
|
63
|
+
from: string;
|
|
64
|
+
to: string;
|
|
65
|
+
};
|
|
66
|
+
export type CheckResult = {
|
|
67
|
+
check: CheckId;
|
|
68
|
+
criterion: CriterionId;
|
|
69
|
+
/** The name of the background, as a key of `ThemeReport.backgrounds`. */
|
|
70
|
+
background: string;
|
|
71
|
+
vision: Vision;
|
|
72
|
+
mark: Mark | null;
|
|
73
|
+
/** Zero-based indexes of the series involved. */
|
|
74
|
+
series: ReadonlyArray<number>;
|
|
75
|
+
/** The two colors compared, as the reader with this vision sees them. */
|
|
76
|
+
colors: readonly [string, string];
|
|
77
|
+
/** A contrast ratio, or a CIEDE2000 difference for `seriesVsSeries`. */
|
|
78
|
+
value: number;
|
|
79
|
+
threshold: number | null;
|
|
80
|
+
/** `null` when there is no threshold, so the result is informational. */
|
|
81
|
+
passes: boolean | null;
|
|
82
|
+
/** Only on failed checks, and `null` when no lighter or darker color passes. */
|
|
83
|
+
fix: Fix | null;
|
|
84
|
+
};
|
|
85
|
+
export type ThemeReport = {
|
|
86
|
+
series: ReadonlyArray<ThemeSeries>;
|
|
87
|
+
backgrounds: Readonly<Record<string, string>>;
|
|
88
|
+
/** `theme.typography.color`, or `null` when the theme has none or the label checks are off. */
|
|
89
|
+
text: string | null;
|
|
90
|
+
visions: ReadonlyArray<Vision>;
|
|
91
|
+
severity: number;
|
|
92
|
+
marks: ReadonlyArray<Mark>;
|
|
93
|
+
thresholds: Thresholds;
|
|
94
|
+
checks: ReadonlyArray<CheckResult>;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Measures how readable the colors of a Recharts theme are: series against the page, series against
|
|
98
|
+
* each other, and labels on the page and on the series, for every background and every simulated vision.
|
|
99
|
+
*
|
|
100
|
+
* Nothing from Recharts runs here: the theme is plain data, and its type is only used at compile time.
|
|
101
|
+
* The result is plain data too. Use `themeFailures` to turn it into test assertions.
|
|
102
|
+
*/
|
|
103
|
+
export declare function analyzeTheme(theme: RechartsTheme, options?: ThemeCheckOptions): ThemeReport;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { colorDifference, composite, contrastRatio, parseColor, simulateVision, toHex, VISIONS, } from './color.js';
|
|
2
|
+
import { WCAG_CONTRAST } from './standards.js';
|
|
3
|
+
import { nearestPassingColor } from './suggest.js';
|
|
4
|
+
const DEFAULT_THRESHOLDS = {
|
|
5
|
+
nonTextContrast: WCAG_CONTRAST.nonText,
|
|
6
|
+
textContrast: WCAG_CONTRAST.text,
|
|
7
|
+
seriesDifference: null,
|
|
8
|
+
seriesDifferenceCvd: null,
|
|
9
|
+
seriesContrast: null,
|
|
10
|
+
};
|
|
11
|
+
/** The checks that need `theme.typography.color`. */
|
|
12
|
+
const LABEL_CHECKS = ['textOnBackground', 'textOnSeries'];
|
|
13
|
+
/** One entry per `graphicalItems` item, with the fill falling back to the stroke and the other way round. */
|
|
14
|
+
function readSeries(theme) {
|
|
15
|
+
return theme.graphicalItems.map((item, index) => {
|
|
16
|
+
const color = item.fill ?? item.stroke;
|
|
17
|
+
if (color == null) {
|
|
18
|
+
throw new Error(`graphicalItems[${index}] has no fill or stroke color`);
|
|
19
|
+
}
|
|
20
|
+
const opacity = Number(item.fillOpacity ?? 1);
|
|
21
|
+
return {
|
|
22
|
+
index,
|
|
23
|
+
fill: color,
|
|
24
|
+
stroke: item.stroke ?? color,
|
|
25
|
+
fillOpacity: Number.isFinite(opacity) ? opacity : 1,
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/** `options.backgrounds`, or else the theme's own page background. */
|
|
30
|
+
function readBackgrounds(theme, options) {
|
|
31
|
+
if (options.backgrounds != null) {
|
|
32
|
+
return options.backgrounds;
|
|
33
|
+
}
|
|
34
|
+
const chartBackground = theme.chart?.backgroundColor;
|
|
35
|
+
const page = theme.pageBackground ?? (typeof chartBackground === 'string' ? chartBackground : undefined);
|
|
36
|
+
if (page == null) {
|
|
37
|
+
throw new Error('The theme has no pageBackground; set it, or pass options.backgrounds');
|
|
38
|
+
}
|
|
39
|
+
return { page };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Measures how readable the colors of a Recharts theme are: series against the page, series against
|
|
43
|
+
* each other, and labels on the page and on the series, for every background and every simulated vision.
|
|
44
|
+
*
|
|
45
|
+
* Nothing from Recharts runs here: the theme is plain data, and its type is only used at compile time.
|
|
46
|
+
* The result is plain data too. Use `themeFailures` to turn it into test assertions.
|
|
47
|
+
*/
|
|
48
|
+
export function analyzeTheme(theme, options = {}) {
|
|
49
|
+
const visions = options.visions ?? VISIONS;
|
|
50
|
+
const severity = options.severity ?? 1;
|
|
51
|
+
const marks = options.marks ?? ['fill', 'stroke'];
|
|
52
|
+
const thresholds = { ...DEFAULT_THRESHOLDS, ...options.thresholds };
|
|
53
|
+
const typography = theme.typography?.color;
|
|
54
|
+
const text = typeof typography === 'string' ? typography : null;
|
|
55
|
+
const enabled = (check) => options.checks?.[check] !== false && (text != null || !LABEL_CHECKS.includes(check));
|
|
56
|
+
const series = readSeries(theme);
|
|
57
|
+
const backgrounds = readBackgrounds(theme, options);
|
|
58
|
+
const checks = [];
|
|
59
|
+
for (const [background, backgroundColor] of Object.entries(backgrounds)) {
|
|
60
|
+
const page = parseColor(backgroundColor);
|
|
61
|
+
if (page.alpha !== undefined && page.alpha < 1) {
|
|
62
|
+
throw new Error(`Background "${background}" must be opaque, got "${backgroundColor}"`);
|
|
63
|
+
}
|
|
64
|
+
const pageHex = toHex(page);
|
|
65
|
+
// What a series looks like on this page in typical vision, before simulation.
|
|
66
|
+
const paint = (s, mark, color = mark === 'fill' ? s.fill : s.stroke) => toHex(composite(color, mark === 'fill' ? s.fillOpacity : 1, page));
|
|
67
|
+
const label = text == null ? null : toHex(composite(text, 1, page));
|
|
68
|
+
for (const vision of visions) {
|
|
69
|
+
const see = (color) => toHex(simulateVision(color, vision, severity));
|
|
70
|
+
const seenPage = see(pageHex);
|
|
71
|
+
const seenLabel = label == null ? null : see(label);
|
|
72
|
+
/**
|
|
73
|
+
* Records one measurement. `measure` takes the color under test as it is in the theme, so the same
|
|
74
|
+
* function finds a fix when the check fails.
|
|
75
|
+
*/
|
|
76
|
+
const add = (result, criterion, target, measure) => {
|
|
77
|
+
const value = measure(target.from);
|
|
78
|
+
const passes = result.threshold == null ? null : value >= result.threshold;
|
|
79
|
+
const threshold = result.threshold;
|
|
80
|
+
const to = passes === false && threshold != null
|
|
81
|
+
? nearestPassingColor(target.from, (hex) => measure(hex) >= threshold)
|
|
82
|
+
: null;
|
|
83
|
+
checks.push({
|
|
84
|
+
...result,
|
|
85
|
+
value,
|
|
86
|
+
criterion,
|
|
87
|
+
passes,
|
|
88
|
+
fix: to == null ? null : { ...target, to },
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
for (const mark of marks) {
|
|
92
|
+
const seen = series.map((s) => see(paint(s, mark)));
|
|
93
|
+
const own = (s) => (mark === 'fill' ? s.fill : s.stroke);
|
|
94
|
+
const seriesFix = (s) => ({ target: 'series', series: s.index, from: own(s) });
|
|
95
|
+
if (enabled('seriesOnBackground')) {
|
|
96
|
+
series.forEach((s, i) => add({
|
|
97
|
+
check: 'seriesOnBackground',
|
|
98
|
+
background,
|
|
99
|
+
vision,
|
|
100
|
+
mark,
|
|
101
|
+
series: [i],
|
|
102
|
+
colors: [seen[i], seenPage],
|
|
103
|
+
threshold: thresholds.nonTextContrast,
|
|
104
|
+
}, 'wcag-1.4.11', seriesFix(s), (color) => contrastRatio(see(paint(s, mark, color)), seenPage)));
|
|
105
|
+
}
|
|
106
|
+
for (let i = 0; i < series.length; i++) {
|
|
107
|
+
for (let j = i + 1; j < series.length; j++) {
|
|
108
|
+
// A fix changes the second series of the pair, and keeps the first one as it is.
|
|
109
|
+
const second = series[j];
|
|
110
|
+
if (enabled('seriesVsSeries')) {
|
|
111
|
+
add({
|
|
112
|
+
check: 'seriesVsSeries',
|
|
113
|
+
background,
|
|
114
|
+
vision,
|
|
115
|
+
mark,
|
|
116
|
+
series: [i, j],
|
|
117
|
+
colors: [seen[i], seen[j]],
|
|
118
|
+
threshold: vision === 'normal'
|
|
119
|
+
? thresholds.seriesDifference
|
|
120
|
+
: thresholds.seriesDifferenceCvd,
|
|
121
|
+
}, 'ciede2000', seriesFix(second), (color) => colorDifference(seen[i], see(paint(second, mark, color))));
|
|
122
|
+
}
|
|
123
|
+
if (enabled('seriesContrast')) {
|
|
124
|
+
add({
|
|
125
|
+
check: 'seriesContrast',
|
|
126
|
+
background,
|
|
127
|
+
vision,
|
|
128
|
+
mark,
|
|
129
|
+
series: [i, j],
|
|
130
|
+
colors: [seen[i], seen[j]],
|
|
131
|
+
threshold: thresholds.seriesContrast,
|
|
132
|
+
}, 'wcag-1.4.11', seriesFix(second), (color) => contrastRatio(seen[i], see(paint(second, mark, color))));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (mark === 'stroke' && enabled('seriesAsText')) {
|
|
137
|
+
series.forEach((s, i) => add({
|
|
138
|
+
check: 'seriesAsText',
|
|
139
|
+
background,
|
|
140
|
+
vision,
|
|
141
|
+
mark,
|
|
142
|
+
series: [i],
|
|
143
|
+
colors: [seen[i], seenPage],
|
|
144
|
+
threshold: thresholds.textContrast,
|
|
145
|
+
}, 'wcag-1.4.3', seriesFix(s), (color) => contrastRatio(see(paint(s, mark, color)), seenPage)));
|
|
146
|
+
}
|
|
147
|
+
if (mark === 'fill' && text != null && seenLabel != null && enabled('textOnSeries')) {
|
|
148
|
+
series.forEach((s, i) => add({
|
|
149
|
+
check: 'textOnSeries',
|
|
150
|
+
background,
|
|
151
|
+
vision,
|
|
152
|
+
mark,
|
|
153
|
+
series: [i],
|
|
154
|
+
colors: [seenLabel, seen[i]],
|
|
155
|
+
threshold: thresholds.textContrast,
|
|
156
|
+
}, 'wcag-1.4.3',
|
|
157
|
+
// The label color is shared by every series, so the fix is a label color for this one series.
|
|
158
|
+
{ target: 'text', series: null, from: text }, (color) => contrastRatio(see(toHex(composite(color, 1, page))), seen[i])));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (text != null && seenLabel != null && enabled('textOnBackground')) {
|
|
162
|
+
add({
|
|
163
|
+
check: 'textOnBackground',
|
|
164
|
+
background,
|
|
165
|
+
vision,
|
|
166
|
+
mark: null,
|
|
167
|
+
series: [],
|
|
168
|
+
colors: [seenLabel, seenPage],
|
|
169
|
+
threshold: thresholds.textContrast,
|
|
170
|
+
}, 'wcag-1.4.3', { target: 'text', series: null, from: text }, (color) => contrastRatio(see(toHex(composite(color, 1, page))), seenPage));
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
series,
|
|
176
|
+
backgrounds: { ...backgrounds },
|
|
177
|
+
text: enabled('textOnBackground') || enabled('textOnSeries') ? text : null,
|
|
178
|
+
visions: [...visions],
|
|
179
|
+
severity,
|
|
180
|
+
marks: [...marks],
|
|
181
|
+
thresholds,
|
|
182
|
+
checks,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin wrappers over culori, so that every measurement in this module goes through one
|
|
3
|
+
* well-tested library instead of hand-written color math.
|
|
4
|
+
* @see {@link https://culorijs.org/api/}
|
|
5
|
+
*/
|
|
6
|
+
import { type Color, type Rgb } from 'culori';
|
|
7
|
+
/**
|
|
8
|
+
* How a reader sees colors: typical color vision, or one of the three dichromacies
|
|
9
|
+
* that Machado, Oliveira and Fernandes (2009) model.
|
|
10
|
+
*/
|
|
11
|
+
export type Vision = 'normal' | 'protanopia' | 'deuteranopia' | 'tritanopia';
|
|
12
|
+
export declare const VISIONS: ReadonlyArray<Vision>;
|
|
13
|
+
/** Any CSS color string that culori parses, or a culori color object. */
|
|
14
|
+
export type ColorInput = string | Color;
|
|
15
|
+
/**
|
|
16
|
+
* Parses a color into sRGB.
|
|
17
|
+
* @throws when the color cannot be parsed. `light-dark()` and CSS variables are not colors on their own;
|
|
18
|
+
* resolve them to the light or the dark value first.
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseColor(color: ColorInput): Rgb;
|
|
21
|
+
/** Formats a color as `#rrggbb`, dropping alpha. */
|
|
22
|
+
export declare function toHex(color: ColorInput): string;
|
|
23
|
+
/**
|
|
24
|
+
* The color a reader sees when `color` is painted at `opacity` over an opaque `background`.
|
|
25
|
+
* Alpha already present in `color` multiplies with `opacity`.
|
|
26
|
+
* This is simple alpha compositing in sRGB, which is what browsers do for SVG `fill-opacity`.
|
|
27
|
+
* @see {@link https://www.w3.org/TR/compositing-1/#simplealphacompositing}
|
|
28
|
+
*/
|
|
29
|
+
export declare function composite(color: ColorInput, opacity: number, background: ColorInput): Rgb;
|
|
30
|
+
/**
|
|
31
|
+
* WCAG 2 contrast ratio, from 1 to 21. The order of the two colors does not matter.
|
|
32
|
+
* @see {@link https://www.w3.org/TR/WCAG22/#dfn-contrast-ratio}
|
|
33
|
+
*/
|
|
34
|
+
export declare function contrastRatio(a: ColorInput, b: ColorInput): number;
|
|
35
|
+
/**
|
|
36
|
+
* CIEDE2000 color difference (ΔE00). Larger means easier to tell apart.
|
|
37
|
+
* @see {@link https://hajim.rochester.edu/ece/sites/gsharma/ciede2000/}
|
|
38
|
+
*/
|
|
39
|
+
export declare function colorDifference(a: ColorInput, b: ColorInput): number;
|
|
40
|
+
/**
|
|
41
|
+
* Approximates how a reader with a color vision deficiency sees `color`.
|
|
42
|
+
*
|
|
43
|
+
* The matrices are culori's, from Machado, Oliveira and Fernandes (2009). culori multiplies them with
|
|
44
|
+
* gamma-encoded sRGB, but the model describes light reaching the cones, which adds up linearly. The R
|
|
45
|
+
* `colorspace` package, which culori took the matrices from, fixed the same issue in version 2.1-0.
|
|
46
|
+
* So this function hands culori's filter linear-light channels and re-encodes the result.
|
|
47
|
+
* @see {@link https://doi.org/10.1109/TVCG.2009.113}
|
|
48
|
+
* @see {@link https://www.zeileis.org/news/simulate_cvd/}
|
|
49
|
+
*
|
|
50
|
+
* @param severity from 0 (typical vision) to 1 (dichromacy, the default). Values in between approximate
|
|
51
|
+
* anomalous trichromacy. culori rounds them to the nearest 0.1, the steps that Machado et al. published.
|
|
52
|
+
*/
|
|
53
|
+
export declare function simulateVision(color: ColorInput, vision: Vision, severity?: number): Rgb;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin wrappers over culori, so that every measurement in this module goes through one
|
|
3
|
+
* well-tested library instead of hand-written color math.
|
|
4
|
+
* @see {@link https://culorijs.org/api/}
|
|
5
|
+
*/
|
|
6
|
+
import { blend, clampRgb, converter, differenceCiede2000, filterDeficiencyDeuter, filterDeficiencyProt, filterDeficiencyTrit, formatHex, parse, wcagContrast, } from 'culori';
|
|
7
|
+
export const VISIONS = [
|
|
8
|
+
'normal',
|
|
9
|
+
'protanopia',
|
|
10
|
+
'deuteranopia',
|
|
11
|
+
'tritanopia',
|
|
12
|
+
];
|
|
13
|
+
const toRgb = converter('rgb');
|
|
14
|
+
const toLrgb = converter('lrgb');
|
|
15
|
+
const ciede2000 = differenceCiede2000();
|
|
16
|
+
/**
|
|
17
|
+
* Parses a color into sRGB.
|
|
18
|
+
* @throws when the color cannot be parsed. `light-dark()` and CSS variables are not colors on their own;
|
|
19
|
+
* resolve them to the light or the dark value first.
|
|
20
|
+
*/
|
|
21
|
+
export function parseColor(color) {
|
|
22
|
+
const parsed = typeof color === 'string' ? parse(color) : color;
|
|
23
|
+
if (parsed === undefined) {
|
|
24
|
+
throw new Error(`Cannot parse color "${String(color)}"`);
|
|
25
|
+
}
|
|
26
|
+
return toRgb(parsed);
|
|
27
|
+
}
|
|
28
|
+
/** Formats a color as `#rrggbb`, dropping alpha. */
|
|
29
|
+
export function toHex(color) {
|
|
30
|
+
return formatHex(parseColor(color));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The color a reader sees when `color` is painted at `opacity` over an opaque `background`.
|
|
34
|
+
* Alpha already present in `color` multiplies with `opacity`.
|
|
35
|
+
* This is simple alpha compositing in sRGB, which is what browsers do for SVG `fill-opacity`.
|
|
36
|
+
* @see {@link https://www.w3.org/TR/compositing-1/#simplealphacompositing}
|
|
37
|
+
*/
|
|
38
|
+
export function composite(color, opacity, background) {
|
|
39
|
+
const foreground = parseColor(color);
|
|
40
|
+
const alpha = (foreground.alpha ?? 1) * opacity;
|
|
41
|
+
const backdrop = { ...parseColor(background), alpha: 1 };
|
|
42
|
+
return toRgb(blend([backdrop, { ...foreground, alpha }], 'normal', 'rgb'));
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* WCAG 2 contrast ratio, from 1 to 21. The order of the two colors does not matter.
|
|
46
|
+
* @see {@link https://www.w3.org/TR/WCAG22/#dfn-contrast-ratio}
|
|
47
|
+
*/
|
|
48
|
+
export function contrastRatio(a, b) {
|
|
49
|
+
return wcagContrast(parseColor(a), parseColor(b));
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* CIEDE2000 color difference (ΔE00). Larger means easier to tell apart.
|
|
53
|
+
* @see {@link https://hajim.rochester.edu/ece/sites/gsharma/ciede2000/}
|
|
54
|
+
*/
|
|
55
|
+
export function colorDifference(a, b) {
|
|
56
|
+
return ciede2000(parseColor(a), parseColor(b));
|
|
57
|
+
}
|
|
58
|
+
const FILTERS = {
|
|
59
|
+
protanopia: filterDeficiencyProt,
|
|
60
|
+
deuteranopia: filterDeficiencyDeuter,
|
|
61
|
+
tritanopia: filterDeficiencyTrit,
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Approximates how a reader with a color vision deficiency sees `color`.
|
|
65
|
+
*
|
|
66
|
+
* The matrices are culori's, from Machado, Oliveira and Fernandes (2009). culori multiplies them with
|
|
67
|
+
* gamma-encoded sRGB, but the model describes light reaching the cones, which adds up linearly. The R
|
|
68
|
+
* `colorspace` package, which culori took the matrices from, fixed the same issue in version 2.1-0.
|
|
69
|
+
* So this function hands culori's filter linear-light channels and re-encodes the result.
|
|
70
|
+
* @see {@link https://doi.org/10.1109/TVCG.2009.113}
|
|
71
|
+
* @see {@link https://www.zeileis.org/news/simulate_cvd/}
|
|
72
|
+
*
|
|
73
|
+
* @param severity from 0 (typical vision) to 1 (dichromacy, the default). Values in between approximate
|
|
74
|
+
* anomalous trichromacy. culori rounds them to the nearest 0.1, the steps that Machado et al. published.
|
|
75
|
+
*/
|
|
76
|
+
export function simulateVision(color, vision, severity = 1) {
|
|
77
|
+
const rgb = parseColor(color);
|
|
78
|
+
if (vision === 'normal') {
|
|
79
|
+
return rgb;
|
|
80
|
+
}
|
|
81
|
+
const linear = toLrgb(rgb);
|
|
82
|
+
// Labelled as 'rgb' on purpose: culori's filter then applies the matrix to these channels as they are.
|
|
83
|
+
const filtered = FILTERS[vision](severity)({
|
|
84
|
+
mode: 'rgb',
|
|
85
|
+
r: linear.r,
|
|
86
|
+
g: linear.g,
|
|
87
|
+
b: linear.b,
|
|
88
|
+
});
|
|
89
|
+
return clampRgb(toRgb({ mode: 'lrgb', r: filtered.r, g: filtered.g, b: filtered.b }));
|
|
90
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ThemeReport } from './analyze.js';
|
|
2
|
+
/**
|
|
3
|
+
* One readable line per failed check. Checks without a threshold never fail.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* expect(themeFailures(analyzeTheme(myTheme))).toEqual([]);
|
|
7
|
+
*/
|
|
8
|
+
export declare function themeFailures(report: ThemeReport): string[];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { CRITERIA } from './standards.js';
|
|
2
|
+
/** Two decimals, or more when two would round a failing value up to the threshold. */
|
|
3
|
+
function format(value, threshold) {
|
|
4
|
+
let digits = 2;
|
|
5
|
+
while (threshold != null && digits < 6 && Number(value.toFixed(digits)) >= threshold) {
|
|
6
|
+
digits++;
|
|
7
|
+
}
|
|
8
|
+
return value.toFixed(digits);
|
|
9
|
+
}
|
|
10
|
+
/** The suggested color as a sentence to append to a failure, or nothing when there is no fix. */
|
|
11
|
+
function describeFix({ fix }) {
|
|
12
|
+
if (fix == null) {
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
15
|
+
const what = fix.target === 'text' ? 'label color' : `series ${(fix.series ?? 0) + 1}`;
|
|
16
|
+
return `. Try ${what} ${fix.to} instead of ${fix.from}`;
|
|
17
|
+
}
|
|
18
|
+
/** One failure as a line: the check, where, the colors, the measured value against its threshold, and the standard. */
|
|
19
|
+
function describeFailure(result) {
|
|
20
|
+
const who = result.series.length === 0 ? 'text' : result.series.map((i) => `series ${i + 1}`).join(' vs ');
|
|
21
|
+
const subject = result.mark == null ? who : `${who} ${result.mark}`;
|
|
22
|
+
const measured = result.check === 'seriesVsSeries'
|
|
23
|
+
? `ΔE00 ${format(result.value, result.threshold)} < ${result.threshold}`
|
|
24
|
+
: `${format(result.value, result.threshold)}:1 < ${result.threshold}:1`;
|
|
25
|
+
return (`${result.check} [${result.background}, ${result.vision}] ${subject} ` +
|
|
26
|
+
`(${result.colors[0]} / ${result.colors[1]}): ${measured}, ${CRITERIA[result.criterion].title}` +
|
|
27
|
+
describeFix(result));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* One readable line per failed check. Checks without a threshold never fail.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* expect(themeFailures(analyzeTheme(myTheme))).toEqual([]);
|
|
34
|
+
*/
|
|
35
|
+
export function themeFailures(report) {
|
|
36
|
+
return report.checks.filter((result) => result.passes === false).map(describeFailure);
|
|
37
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { colorDifference, composite, contrastRatio, parseColor, simulateVision, toHex, VISIONS, } from './color.js';
|
|
2
|
+
export type { ColorInput, Vision } from './color.js';
|
|
3
|
+
export { analyzeTheme } from './analyze.js';
|
|
4
|
+
export type { CheckId, CheckResult, Fix, Mark, ThemeCheckOptions, ThemeReport, ThemeSeries, Thresholds, } from './analyze.js';
|
|
5
|
+
export { themeFailures } from './failures.js';
|
|
6
|
+
export { nearestPassingColor } from './suggest.js';
|
|
7
|
+
export { CRITERIA, WCAG_CONTRAST } from './standards.js';
|
|
8
|
+
export type { Criterion, CriterionId } from './standards.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { colorDifference, composite, contrastRatio, parseColor, simulateVision, toHex, VISIONS, } from './color.js';
|
|
2
|
+
export { analyzeTheme } from './analyze.js';
|
|
3
|
+
export { themeFailures } from './failures.js';
|
|
4
|
+
export { nearestPassingColor } from './suggest.js';
|
|
5
|
+
export { CRITERIA, WCAG_CONTRAST } from './standards.js';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The standards behind each check, with links, so that every threshold in a report can be traced back
|
|
3
|
+
* to the text that defines it.
|
|
4
|
+
*/
|
|
5
|
+
export type CriterionId = 'wcag-1.4.3' | 'wcag-1.4.6' | 'wcag-1.4.11' | 'wcag-1.4.1' | 'ciede2000';
|
|
6
|
+
export type Criterion = {
|
|
7
|
+
id: CriterionId;
|
|
8
|
+
title: string;
|
|
9
|
+
url: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const CRITERIA: Readonly<Record<CriterionId, Criterion>>;
|
|
12
|
+
/**
|
|
13
|
+
* Contrast ratios that WCAG 2.2 defines. Pick the one that matches your text size and target level.
|
|
14
|
+
* "Large" text is at least 18pt, or 14pt bold.
|
|
15
|
+
* @see {@link https://www.w3.org/TR/WCAG22/#dfn-large-scale}
|
|
16
|
+
*/
|
|
17
|
+
export declare const WCAG_CONTRAST: {
|
|
18
|
+
/** SC 1.4.3, level AA, normal text */
|
|
19
|
+
readonly text: 4.5;
|
|
20
|
+
/** SC 1.4.3, level AA, large text */
|
|
21
|
+
readonly largeText: 3;
|
|
22
|
+
/** SC 1.4.6, level AAA, normal text */
|
|
23
|
+
readonly enhancedText: 7;
|
|
24
|
+
/** SC 1.4.6, level AAA, large text */
|
|
25
|
+
readonly enhancedLargeText: 4.5;
|
|
26
|
+
/** SC 1.4.11, level AA, graphical objects */
|
|
27
|
+
readonly nonText: 3;
|
|
28
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The standards behind each check, with links, so that every threshold in a report can be traced back
|
|
3
|
+
* to the text that defines it.
|
|
4
|
+
*/
|
|
5
|
+
export const CRITERIA = {
|
|
6
|
+
'wcag-1.4.1': {
|
|
7
|
+
id: 'wcag-1.4.1',
|
|
8
|
+
title: 'WCAG 2.2 Success Criterion 1.4.1 Use of Color (Level A)',
|
|
9
|
+
url: 'https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.html',
|
|
10
|
+
},
|
|
11
|
+
'wcag-1.4.3': {
|
|
12
|
+
id: 'wcag-1.4.3',
|
|
13
|
+
title: 'WCAG 2.2 Success Criterion 1.4.3 Contrast (Minimum) (Level AA)',
|
|
14
|
+
url: 'https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html',
|
|
15
|
+
},
|
|
16
|
+
'wcag-1.4.6': {
|
|
17
|
+
id: 'wcag-1.4.6',
|
|
18
|
+
title: 'WCAG 2.2 Success Criterion 1.4.6 Contrast (Enhanced) (Level AAA)',
|
|
19
|
+
url: 'https://www.w3.org/WAI/WCAG22/Understanding/contrast-enhanced.html',
|
|
20
|
+
},
|
|
21
|
+
'wcag-1.4.11': {
|
|
22
|
+
id: 'wcag-1.4.11',
|
|
23
|
+
title: 'WCAG 2.2 Success Criterion 1.4.11 Non-text Contrast (Level AA)',
|
|
24
|
+
url: 'https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html',
|
|
25
|
+
},
|
|
26
|
+
ciede2000: {
|
|
27
|
+
id: 'ciede2000',
|
|
28
|
+
title: 'CIEDE2000 color difference (ISO/CIE 11664-6), no pass or fail threshold defined',
|
|
29
|
+
url: 'https://hajim.rochester.edu/ece/sites/gsharma/ciede2000/',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Contrast ratios that WCAG 2.2 defines. Pick the one that matches your text size and target level.
|
|
34
|
+
* "Large" text is at least 18pt, or 14pt bold.
|
|
35
|
+
* @see {@link https://www.w3.org/TR/WCAG22/#dfn-large-scale}
|
|
36
|
+
*/
|
|
37
|
+
export const WCAG_CONTRAST = {
|
|
38
|
+
/** SC 1.4.3, level AA, normal text */
|
|
39
|
+
text: 4.5,
|
|
40
|
+
/** SC 1.4.3, level AA, large text */
|
|
41
|
+
largeText: 3,
|
|
42
|
+
/** SC 1.4.6, level AAA, normal text */
|
|
43
|
+
enhancedText: 7,
|
|
44
|
+
/** SC 1.4.6, level AAA, large text */
|
|
45
|
+
enhancedLargeText: 4.5,
|
|
46
|
+
/** SC 1.4.11, level AA, graphical objects */
|
|
47
|
+
nonText: 3,
|
|
48
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The color closest in lightness to `color` that `passes`, keeping its hue and as much of its chroma as the
|
|
3
|
+
* sRGB gamut allows. It tries lighter and darker one step at a time and returns the first that passes,
|
|
4
|
+
* or `null` when no lightness works, for example when the hue itself is the problem.
|
|
5
|
+
*
|
|
6
|
+
* The search moves along OKLCH lightness, so the hue stays the same and only lightness (and, at the gamut
|
|
7
|
+
* edge, chroma) changes.
|
|
8
|
+
* @see {@link https://www.w3.org/TR/css-color-4/#ok-lab}
|
|
9
|
+
*/
|
|
10
|
+
export declare function nearestPassingColor(color: string, passes: (hex: string) => boolean): string | null;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { clampChroma, converter, formatHex } from 'culori';
|
|
2
|
+
import { parseColor } from './color.js';
|
|
3
|
+
const toOklch = converter('oklch');
|
|
4
|
+
/** How far, in OKLCH lightness (0 to 1), one search step moves. */
|
|
5
|
+
const STEP = 0.002;
|
|
6
|
+
/**
|
|
7
|
+
* The color closest in lightness to `color` that `passes`, keeping its hue and as much of its chroma as the
|
|
8
|
+
* sRGB gamut allows. It tries lighter and darker one step at a time and returns the first that passes,
|
|
9
|
+
* or `null` when no lightness works, for example when the hue itself is the problem.
|
|
10
|
+
*
|
|
11
|
+
* The search moves along OKLCH lightness, so the hue stays the same and only lightness (and, at the gamut
|
|
12
|
+
* edge, chroma) changes.
|
|
13
|
+
* @see {@link https://www.w3.org/TR/css-color-4/#ok-lab}
|
|
14
|
+
*/
|
|
15
|
+
export function nearestPassingColor(color, passes) {
|
|
16
|
+
const start = toOklch(parseColor(color));
|
|
17
|
+
for (let delta = STEP; delta <= 1; delta += STEP) {
|
|
18
|
+
for (const l of [start.l - delta, start.l + delta]) {
|
|
19
|
+
if (l < 0 || l > 1) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
const candidate = formatHex(clampChroma({ ...start, l }, 'oklch'));
|
|
23
|
+
if (passes(candidate)) {
|
|
24
|
+
return candidate;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
package/package.json
CHANGED
|
@@ -4,10 +4,21 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"type": "module",
|
|
7
|
-
"version": "0.0.
|
|
7
|
+
"version": "0.0.19",
|
|
8
8
|
"description": "Devtools and helper functions for Recharts",
|
|
9
9
|
"main": "dist/index.js",
|
|
10
10
|
"types": "dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./theme": {
|
|
17
|
+
"types": "./dist/theme/index.d.ts",
|
|
18
|
+
"default": "./dist/theme/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./package.json": "./package.json"
|
|
21
|
+
},
|
|
11
22
|
"files": [
|
|
12
23
|
"dist"
|
|
13
24
|
],
|
|
@@ -30,6 +41,7 @@
|
|
|
30
41
|
"license": "MIT",
|
|
31
42
|
"devDependencies": {
|
|
32
43
|
"@testing-library/react": "^16.3.2",
|
|
44
|
+
"@types/culori": "^4.0.1",
|
|
33
45
|
"@types/node": "^26.1.0",
|
|
34
46
|
"@types/react": "^18.0.0",
|
|
35
47
|
"@types/react-dom": "^18.0.0",
|
|
@@ -40,14 +52,28 @@
|
|
|
40
52
|
"prettier": "^3.0.0",
|
|
41
53
|
"react": "^19.0.0",
|
|
42
54
|
"react-dom": "^19.0.0",
|
|
43
|
-
"recharts": "^3.
|
|
55
|
+
"recharts": "^3.11.0-canary.6",
|
|
44
56
|
"typescript": "^5.0.0",
|
|
45
57
|
"typescript-eslint": "^8.0.0",
|
|
46
|
-
"vitest": "^
|
|
58
|
+
"vitest": "^5.0.2"
|
|
47
59
|
},
|
|
48
60
|
"peerDependencies": {
|
|
49
61
|
"react": "^18.0.0 || ^19.0.0",
|
|
50
62
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
51
|
-
"recharts": "3.9.0"
|
|
63
|
+
"recharts": "^3.9.0 || >=3.11.0-canary.6 <4.0.0"
|
|
64
|
+
},
|
|
65
|
+
"peerDependenciesMeta": {
|
|
66
|
+
"react": {
|
|
67
|
+
"optional": true
|
|
68
|
+
},
|
|
69
|
+
"react-dom": {
|
|
70
|
+
"optional": true
|
|
71
|
+
},
|
|
72
|
+
"recharts": {
|
|
73
|
+
"optional": true
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"dependencies": {
|
|
77
|
+
"culori": "^4.0.2"
|
|
52
78
|
}
|
|
53
79
|
}
|