@lamatemaga/sterling 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/README.md +336 -0
- package/assets/fonts/Fraunces-SemiBold.ttf +0 -0
- package/assets/fonts/JetBrainsMono-Regular.ttf +0 -0
- package/assets/fonts/NOTICE.md +12 -0
- package/assets/fonts/OFL-1.1.txt +79 -0
- package/dist/editorial.css +27 -0
- package/dist/index.d.mts +582 -0
- package/dist/index.d.ts +582 -0
- package/dist/index.js +2005 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1912 -0
- package/dist/index.mjs.map +1 -0
- package/dist/server.d.mts +505 -0
- package/dist/server.d.ts +505 -0
- package/dist/server.js +1666 -0
- package/dist/server.js.map +1 -0
- package/dist/server.mjs +1575 -0
- package/dist/server.mjs.map +1 -0
- package/dist/styles.css +101 -0
- package/package.json +79 -0
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
3
|
+
import { ScaleLinear, ScaleTime } from 'd3-scale';
|
|
4
|
+
|
|
5
|
+
/** Languages bundled with Sterling's default editorial copy. */
|
|
6
|
+
type SterlingLocale = "es" | "en";
|
|
7
|
+
|
|
8
|
+
type SterlingLegendShape = "circle" | "square" | "triangle" | "line";
|
|
9
|
+
interface SterlingLegendItem {
|
|
10
|
+
label: string;
|
|
11
|
+
colorIndex?: number;
|
|
12
|
+
color?: string;
|
|
13
|
+
textColor?: string;
|
|
14
|
+
shape?: SterlingLegendShape;
|
|
15
|
+
}
|
|
16
|
+
declare function SterlingInlineLegend({ items, locale, }: {
|
|
17
|
+
items: SterlingLegendItem[];
|
|
18
|
+
locale: SterlingLocale;
|
|
19
|
+
}): react.JSX.Element;
|
|
20
|
+
|
|
21
|
+
interface BarDatum {
|
|
22
|
+
label: string;
|
|
23
|
+
value: number;
|
|
24
|
+
colorIndex?: number;
|
|
25
|
+
}
|
|
26
|
+
declare function SterlingBarChart({ data, ariaLabel, unit, xLabel, }: {
|
|
27
|
+
data: BarDatum[];
|
|
28
|
+
ariaLabel: string;
|
|
29
|
+
unit?: string;
|
|
30
|
+
xLabel?: string;
|
|
31
|
+
}): react.JSX.Element;
|
|
32
|
+
interface ScatterDatum {
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
group: string;
|
|
36
|
+
label?: string;
|
|
37
|
+
}
|
|
38
|
+
declare function SterlingScatterPlot({ data, ariaLabel, xLabel, yLabel, showLegend, zeroX, zeroY, }: {
|
|
39
|
+
data: ScatterDatum[];
|
|
40
|
+
ariaLabel: string;
|
|
41
|
+
xLabel: string;
|
|
42
|
+
yLabel: string;
|
|
43
|
+
showLegend?: boolean;
|
|
44
|
+
zeroX?: boolean;
|
|
45
|
+
zeroY?: boolean;
|
|
46
|
+
}): react.JSX.Element;
|
|
47
|
+
interface LineSeries {
|
|
48
|
+
label: string;
|
|
49
|
+
values: number[];
|
|
50
|
+
}
|
|
51
|
+
declare function SterlingLineChart({ labels, series, ariaLabel, yLabel, xLabel, times, markers, showLegend, }: {
|
|
52
|
+
labels: string[];
|
|
53
|
+
series: LineSeries[];
|
|
54
|
+
ariaLabel: string;
|
|
55
|
+
yLabel: string;
|
|
56
|
+
xLabel?: string;
|
|
57
|
+
/** Epoch-ms per point (parallel to labels); enables the adaptive time axis. */
|
|
58
|
+
times?: number[];
|
|
59
|
+
/** Draw a dot at every point. Off by default for dense time series. */
|
|
60
|
+
markers?: boolean;
|
|
61
|
+
showLegend?: boolean;
|
|
62
|
+
}): react.JSX.Element;
|
|
63
|
+
declare function SterlingHeatmap({ values, rowLabels, columnLabels, ariaLabel, domain, legendTitle, showValues, }: {
|
|
64
|
+
values: number[][];
|
|
65
|
+
rowLabels: string[];
|
|
66
|
+
columnLabels: string[];
|
|
67
|
+
ariaLabel: string;
|
|
68
|
+
/** Symmetric color domain [-domain, +domain]; defaults to the data's max |value|. */
|
|
69
|
+
domain?: number;
|
|
70
|
+
legendTitle?: string;
|
|
71
|
+
showValues?: boolean;
|
|
72
|
+
}): react.JSX.Element;
|
|
73
|
+
declare function SterlingSequentialSurface({ values: suppliedValues, ariaLabel, lowLabel, highLabel, }: {
|
|
74
|
+
values?: number[][];
|
|
75
|
+
ariaLabel: string;
|
|
76
|
+
lowLabel?: string;
|
|
77
|
+
highLabel?: string;
|
|
78
|
+
}): react.JSX.Element;
|
|
79
|
+
declare function SterlingCorrelogram({ values, labels, ariaLabel, }: {
|
|
80
|
+
values: number[][];
|
|
81
|
+
labels: string[];
|
|
82
|
+
ariaLabel: string;
|
|
83
|
+
}): react.JSX.Element;
|
|
84
|
+
declare function SterlingHistogram({ values, bins, ariaLabel, xLabel, yLabel, }: {
|
|
85
|
+
values: number[];
|
|
86
|
+
bins?: number;
|
|
87
|
+
ariaLabel: string;
|
|
88
|
+
xLabel: string;
|
|
89
|
+
yLabel?: string;
|
|
90
|
+
}): react.JSX.Element;
|
|
91
|
+
interface BoxPlotGroup {
|
|
92
|
+
label: string;
|
|
93
|
+
values: number[];
|
|
94
|
+
}
|
|
95
|
+
declare function SterlingBoxPlot({ groups, ariaLabel, yLabel }: {
|
|
96
|
+
groups: BoxPlotGroup[];
|
|
97
|
+
ariaLabel: string;
|
|
98
|
+
yLabel: string;
|
|
99
|
+
}): react.JSX.Element;
|
|
100
|
+
interface DumbbellDatum {
|
|
101
|
+
label: string;
|
|
102
|
+
left: number;
|
|
103
|
+
right: number;
|
|
104
|
+
}
|
|
105
|
+
declare function SterlingDumbbellChart({ data, ariaLabel, leftLabel, rightLabel, xLabel, }: {
|
|
106
|
+
data: DumbbellDatum[];
|
|
107
|
+
ariaLabel: string;
|
|
108
|
+
leftLabel: string;
|
|
109
|
+
rightLabel: string;
|
|
110
|
+
xLabel?: string;
|
|
111
|
+
}): react.JSX.Element;
|
|
112
|
+
declare function kernelDensity(values: number[], steps?: number, domain?: [number, number]): {
|
|
113
|
+
value: number;
|
|
114
|
+
density: number;
|
|
115
|
+
}[];
|
|
116
|
+
declare function SterlingDensityChart({ values, ariaLabel, xLabel, yLabel }: {
|
|
117
|
+
values: number[];
|
|
118
|
+
ariaLabel: string;
|
|
119
|
+
xLabel: string;
|
|
120
|
+
yLabel?: string;
|
|
121
|
+
}): react.JSX.Element;
|
|
122
|
+
interface ViolinGroup {
|
|
123
|
+
label: string;
|
|
124
|
+
values: number[];
|
|
125
|
+
}
|
|
126
|
+
declare function SterlingViolinPlot({ groups, ariaLabel, yLabel }: {
|
|
127
|
+
groups: ViolinGroup[];
|
|
128
|
+
ariaLabel: string;
|
|
129
|
+
yLabel: string;
|
|
130
|
+
}): react.JSX.Element;
|
|
131
|
+
interface DonutDatum {
|
|
132
|
+
label: string;
|
|
133
|
+
value: number;
|
|
134
|
+
}
|
|
135
|
+
declare function SterlingDonutChart({ data, ariaLabel, centerLabel, centerValue }: {
|
|
136
|
+
data: DonutDatum[];
|
|
137
|
+
ariaLabel: string;
|
|
138
|
+
centerLabel: string;
|
|
139
|
+
centerValue?: string;
|
|
140
|
+
}): react.JSX.Element;
|
|
141
|
+
declare function SterlingLollipopChart({ data, ariaLabel, unit, xLabel }: {
|
|
142
|
+
data: BarDatum[];
|
|
143
|
+
ariaLabel: string;
|
|
144
|
+
unit?: string;
|
|
145
|
+
xLabel?: string;
|
|
146
|
+
}): react.JSX.Element;
|
|
147
|
+
declare function SterlingPieChart({ data, ariaLabel }: {
|
|
148
|
+
data: DonutDatum[];
|
|
149
|
+
ariaLabel: string;
|
|
150
|
+
}): react.JSX.Element;
|
|
151
|
+
declare function SterlingChordChart({ rowLabels, columnLabels, values, ariaLabel, }: {
|
|
152
|
+
rowLabels: string[];
|
|
153
|
+
columnLabels: string[];
|
|
154
|
+
values: number[][];
|
|
155
|
+
ariaLabel: string;
|
|
156
|
+
}): react.JSX.Element;
|
|
157
|
+
interface SankeyLinkDatum {
|
|
158
|
+
source: string;
|
|
159
|
+
target: string;
|
|
160
|
+
value: number;
|
|
161
|
+
}
|
|
162
|
+
declare function SterlingSankeyChart({ links, ariaLabel }: {
|
|
163
|
+
links: SankeyLinkDatum[];
|
|
164
|
+
ariaLabel: string;
|
|
165
|
+
}): react.JSX.Element;
|
|
166
|
+
|
|
167
|
+
declare function SterlingVerticalBarChart({ data, ariaLabel, yLabel, xLabel }: {
|
|
168
|
+
data: Array<[string, number]>;
|
|
169
|
+
ariaLabel: string;
|
|
170
|
+
yLabel?: string;
|
|
171
|
+
xLabel?: string;
|
|
172
|
+
}): react.JSX.Element;
|
|
173
|
+
declare function SterlingCandlestickChart({ rows, ariaLabel, yLabel, xLabel }: {
|
|
174
|
+
rows: Array<[string, number, number, number, number]>;
|
|
175
|
+
ariaLabel: string;
|
|
176
|
+
yLabel?: string;
|
|
177
|
+
xLabel?: string;
|
|
178
|
+
}): react.JSX.Element;
|
|
179
|
+
declare function SterlingRadarChart({ labels, series, domain, ariaLabel, unit }: {
|
|
180
|
+
labels: string[];
|
|
181
|
+
series: Array<[string, ...number[]]>;
|
|
182
|
+
domain: number[];
|
|
183
|
+
ariaLabel: string;
|
|
184
|
+
unit?: string;
|
|
185
|
+
}): react.JSX.Element;
|
|
186
|
+
declare function SterlingRidgelineChart({ groups, ariaLabel, xLabel, unit }: {
|
|
187
|
+
groups: Array<{
|
|
188
|
+
label: string;
|
|
189
|
+
values: number[];
|
|
190
|
+
}>;
|
|
191
|
+
ariaLabel: string;
|
|
192
|
+
xLabel?: string;
|
|
193
|
+
unit?: string;
|
|
194
|
+
}): react.JSX.Element;
|
|
195
|
+
declare function SterlingDensity2DChart({ points, regionLabels, ariaLabel, xLabel, yLabel }: {
|
|
196
|
+
points: Array<[number, number, number]>;
|
|
197
|
+
regionLabels: string[];
|
|
198
|
+
ariaLabel: string;
|
|
199
|
+
xLabel?: string;
|
|
200
|
+
yLabel?: string;
|
|
201
|
+
}): react.JSX.Element;
|
|
202
|
+
declare function SterlingTreemapChart({ rows, ariaLabel }: {
|
|
203
|
+
rows: Array<[string, string, string, number]>;
|
|
204
|
+
ariaLabel: string;
|
|
205
|
+
}): react.JSX.Element;
|
|
206
|
+
declare function SterlingNetworkChart({ nodes, edges, ariaLabel }: {
|
|
207
|
+
nodes: Array<[string, number, number, number, number]>;
|
|
208
|
+
edges: Array<[number, number]>;
|
|
209
|
+
ariaLabel: string;
|
|
210
|
+
}): react.JSX.Element;
|
|
211
|
+
declare function SterlingDendrogramChart({ labels, merge, height, order, groups, ariaLabel, yLabel, cutLabel }: {
|
|
212
|
+
labels: string[];
|
|
213
|
+
merge: Array<[number, number]>;
|
|
214
|
+
height: number[];
|
|
215
|
+
order: number[];
|
|
216
|
+
groups: number[][];
|
|
217
|
+
ariaLabel: string;
|
|
218
|
+
yLabel?: string;
|
|
219
|
+
cutLabel?: string;
|
|
220
|
+
}): react.JSX.Element;
|
|
221
|
+
declare function SterlingVolcanoChart({ hex, labels, ariaLabel, xLabel, yLabel }: {
|
|
222
|
+
hex: string;
|
|
223
|
+
labels: Array<[string, number, number]>;
|
|
224
|
+
ariaLabel: string;
|
|
225
|
+
xLabel?: string;
|
|
226
|
+
yLabel?: string;
|
|
227
|
+
}): react.JSX.Element;
|
|
228
|
+
declare function SterlingManhattanChart({ hex, labels, chromosomeCenters, ariaLabel, xLabel, yLabel }: {
|
|
229
|
+
hex: string;
|
|
230
|
+
labels: Array<[string, number, number, number]>;
|
|
231
|
+
chromosomeCenters: number[];
|
|
232
|
+
ariaLabel: string;
|
|
233
|
+
xLabel?: string;
|
|
234
|
+
yLabel?: string;
|
|
235
|
+
}): react.JSX.Element;
|
|
236
|
+
/**
|
|
237
|
+
* Clustered correlation heatmap of NCI60 expression profiles. Rows and columns
|
|
238
|
+
* are reordered by hierarchical clustering so shared signatures surface as
|
|
239
|
+
* diagonal blocks; dendrograms, type annotations, and region frames match the
|
|
240
|
+
* canonical v1.5 figure. Violet = positive correlation, teal = negative.
|
|
241
|
+
*/
|
|
242
|
+
declare function SterlingExpressionChart({ hex, groups, types, ariaLabel }: {
|
|
243
|
+
hex: string;
|
|
244
|
+
groups: number[];
|
|
245
|
+
types: string[];
|
|
246
|
+
ariaLabel: string;
|
|
247
|
+
}): react.JSX.Element;
|
|
248
|
+
declare function SterlingGeoMapChart({ atlas, rows, ariaLabel }: {
|
|
249
|
+
atlas: unknown;
|
|
250
|
+
rows: Array<{
|
|
251
|
+
state: string;
|
|
252
|
+
id: number;
|
|
253
|
+
engineers: number;
|
|
254
|
+
}>;
|
|
255
|
+
ariaLabel: string;
|
|
256
|
+
}): react.JSX.Element;
|
|
257
|
+
|
|
258
|
+
type SterlingMode = "light" | "dark" | "print";
|
|
259
|
+
interface SterlingSurfacePalette {
|
|
260
|
+
paper?: string;
|
|
261
|
+
plot?: string;
|
|
262
|
+
plotAlt?: string;
|
|
263
|
+
text?: string;
|
|
264
|
+
muted?: string;
|
|
265
|
+
grid?: string;
|
|
266
|
+
edge?: string;
|
|
267
|
+
period?: string;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Optional theme overrides for the Sterling grammar. Omitted values keep the
|
|
271
|
+
* Sterling defaults. Values may be CSS variables, which lets a consuming site
|
|
272
|
+
* provide its own light and dark definitions without changing the components.
|
|
273
|
+
*/
|
|
274
|
+
interface SterlingPalette {
|
|
275
|
+
surface?: SterlingSurfacePalette;
|
|
276
|
+
categorical?: readonly string[];
|
|
277
|
+
legend?: readonly string[];
|
|
278
|
+
sequential?: readonly string[];
|
|
279
|
+
divergent?: readonly string[];
|
|
280
|
+
heat?: readonly string[];
|
|
281
|
+
ramps?: readonly (readonly string[])[];
|
|
282
|
+
}
|
|
283
|
+
type SterlingCssVariables = CSSProperties & Record<`--sterling-${string}`, string>;
|
|
284
|
+
/** Identity helper that preserves literal color values in TypeScript. */
|
|
285
|
+
declare function defineSterlingPalette<const T extends SterlingPalette>(palette: T): T;
|
|
286
|
+
/** Convert a palette override into the CSS variables consumed by every chart. */
|
|
287
|
+
declare function sterlingPaletteStyle(palette?: SterlingPalette): SterlingCssVariables;
|
|
288
|
+
declare const sterlingCategorical: {
|
|
289
|
+
readonly light: readonly ["#9A79E7", "#25A08D", "#D45AC7", "#E4A43A", "#5A83D7", "#E87864", "#96AB51", "#536B78"];
|
|
290
|
+
readonly dark: readonly ["#B69AF2", "#5EC9AE", "#E88BDD", "#F2C46D", "#86A8E8", "#F29A88", "#B7C974", "#B7C8D1"];
|
|
291
|
+
readonly print: readonly ["#8E68D8", "#218C7C", "#C653BC", "#D39A32", "#4F73C6", "#DC6A55", "#879347", "#607986"];
|
|
292
|
+
};
|
|
293
|
+
declare const sterlingColorNames: readonly ["Violet", "Teal", "Orchid", "Amber", "Blue", "Coral", "Moss", "Payne"];
|
|
294
|
+
/** CSS variables let one SVG respond to the site's light and dark themes. */
|
|
295
|
+
declare const sterlingChartColors: string[];
|
|
296
|
+
/** Hue-matched text colors keep inline legends readable in both themes. */
|
|
297
|
+
declare const sterlingLegendColors: string[];
|
|
298
|
+
declare const sterlingDivergentColors: string[];
|
|
299
|
+
/** A single-hue ramp for ordered magnitudes such as histogram frequency. */
|
|
300
|
+
declare const sterlingSequentialColors: string[];
|
|
301
|
+
/** Multi-hue ordered ramp from the v1.5 topography field test. */
|
|
302
|
+
declare const sterlingHeatColors: string[];
|
|
303
|
+
/** Stops available in every per-family sequential ramp (ramp stops 200-800). */
|
|
304
|
+
declare const sterlingRampStops = 7;
|
|
305
|
+
/**
|
|
306
|
+
* One sequential ramp per categorical family, mirroring `lm_ramps` in
|
|
307
|
+
* `theme_lamatemaga.R`. `family` is the categorical index (0 = Violet, 1 = Teal,
|
|
308
|
+
* ...) and `stop` runs 1..7 from faintest to strongest. The token order mirrors
|
|
309
|
+
* per theme, so a higher stop always reads as the higher-contrast tone.
|
|
310
|
+
*
|
|
311
|
+
* The band runs 200-800, not the full 100-950. The 900-950 end is nearly flat in
|
|
312
|
+
* luminance (Δ 0.014) so those tones stop reading as separate steps and turn
|
|
313
|
+
* light mode heavy; the 100 end is a near-white tint that all but disappears
|
|
314
|
+
* against the chart surface (contrast 1.11).
|
|
315
|
+
*/
|
|
316
|
+
declare function sterlingRamp(family: number, stop: number): string;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Shared cartesian foundation for every Sterling chart.
|
|
320
|
+
*
|
|
321
|
+
* One geometry, one axis grammar: gridlines, tick marks, tick labels, and axis
|
|
322
|
+
* titles are drawn the same way everywhere so the whole catalog reads as a
|
|
323
|
+
* single visualization package. Colors come from the theme tokens only.
|
|
324
|
+
*/
|
|
325
|
+
declare const axisText = "var(--sterling-text)";
|
|
326
|
+
declare const axisMuted = "var(--sterling-muted)";
|
|
327
|
+
declare const axisGrid = "var(--sterling-grid)";
|
|
328
|
+
declare const axisLine = "var(--sterling-edge)";
|
|
329
|
+
declare const TICK = 5;
|
|
330
|
+
declare const TICK_LABEL = 11;
|
|
331
|
+
declare const AXIS_TITLE = 12;
|
|
332
|
+
interface Margin {
|
|
333
|
+
top: number;
|
|
334
|
+
right: number;
|
|
335
|
+
bottom: number;
|
|
336
|
+
left: number;
|
|
337
|
+
}
|
|
338
|
+
/** Room on the left/bottom for tick labels plus an axis title. */
|
|
339
|
+
declare const defaultMargin: Margin;
|
|
340
|
+
interface Frame {
|
|
341
|
+
width: number;
|
|
342
|
+
height: number;
|
|
343
|
+
x0: number;
|
|
344
|
+
x1: number;
|
|
345
|
+
y0: number;
|
|
346
|
+
y1: number;
|
|
347
|
+
}
|
|
348
|
+
declare function frame(width: number, height: number, margin?: Margin): Frame;
|
|
349
|
+
/** Linear scale with a nice domain; `zero` anchors magnitude charts at 0. */
|
|
350
|
+
declare function linearScale(values: number[], range: [number, number], { zero, padFraction }?: {
|
|
351
|
+
zero?: boolean;
|
|
352
|
+
padFraction?: number;
|
|
353
|
+
}): ScaleLinear<number, number>;
|
|
354
|
+
declare function timeScale(domain: [number, number], range: [number, number]): ScaleTime<number, number>;
|
|
355
|
+
/** Horizontal gridlines aligned to the left-axis ticks. */
|
|
356
|
+
declare function Gridlines({ scale, x0, x1, count, }: {
|
|
357
|
+
scale: ScaleLinear<number, number>;
|
|
358
|
+
x0: number;
|
|
359
|
+
x1: number;
|
|
360
|
+
count?: number;
|
|
361
|
+
}): react.JSX.Element;
|
|
362
|
+
declare function AxisLeft({ scale, x, gridX1, count, title, format, }: {
|
|
363
|
+
scale: ScaleLinear<number, number>;
|
|
364
|
+
x: number;
|
|
365
|
+
gridX1?: number;
|
|
366
|
+
count?: number;
|
|
367
|
+
title?: string;
|
|
368
|
+
format?: (value: number) => string;
|
|
369
|
+
}): react.JSX.Element;
|
|
370
|
+
declare function AxisBottom({ scale, y, count, title, format, titleGap, }: {
|
|
371
|
+
scale: ScaleLinear<number, number>;
|
|
372
|
+
y: number;
|
|
373
|
+
count?: number;
|
|
374
|
+
title?: string;
|
|
375
|
+
format?: (value: number) => string;
|
|
376
|
+
titleGap?: number;
|
|
377
|
+
}): react.JSX.Element;
|
|
378
|
+
/**
|
|
379
|
+
* Time axis whose interval adapts to the span and the available width: d3
|
|
380
|
+
* chooses days, weeks, months, or years and formats each tick to match. One
|
|
381
|
+
* tick roughly every `targetPx` pixels keeps labels from ever colliding.
|
|
382
|
+
*/
|
|
383
|
+
declare function TimeAxisBottom({ scale, y, title, targetPx, titleGap, }: {
|
|
384
|
+
scale: ScaleTime<number, number>;
|
|
385
|
+
y: number;
|
|
386
|
+
title?: string;
|
|
387
|
+
targetPx?: number;
|
|
388
|
+
titleGap?: number;
|
|
389
|
+
}): react.JSX.Element;
|
|
390
|
+
/** Evenly spaced band centers for categorical axes. */
|
|
391
|
+
declare function bandCenters(count: number, x0: number, x1: number): {
|
|
392
|
+
centers: number[];
|
|
393
|
+
step: number;
|
|
394
|
+
};
|
|
395
|
+
/**
|
|
396
|
+
* Signed diverging color with the brand orientation: violet encodes positive,
|
|
397
|
+
* teal encodes negative. The palette token order is violet -> ... -> teal, so a
|
|
398
|
+
* positive value maps to the low (violet) end. Palette values are never mutated.
|
|
399
|
+
*/
|
|
400
|
+
declare function divergentSignedColor(value: number, maxAbs: number): string;
|
|
401
|
+
/** Legend ramp for signed diverging scales, left (negative/teal) to right (positive/violet). */
|
|
402
|
+
declare const divergentSignedRamp: readonly string[];
|
|
403
|
+
/** Tukey five-number summary with 1.5*IQR fences and the outliers beyond them. */
|
|
404
|
+
declare function tukeySummary(values: number[]): {
|
|
405
|
+
q1: number;
|
|
406
|
+
median: number;
|
|
407
|
+
q3: number;
|
|
408
|
+
iqr: number;
|
|
409
|
+
whiskerLow: number;
|
|
410
|
+
whiskerHigh: number;
|
|
411
|
+
outliers: number[];
|
|
412
|
+
min: number;
|
|
413
|
+
max: number;
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* The table that produced a figure, after any transformations used by the
|
|
418
|
+
* wrapper. This deliberately does not claim to be the original source file.
|
|
419
|
+
*/
|
|
420
|
+
interface SterlingDataExport {
|
|
421
|
+
rows: readonly Record<string, unknown>[];
|
|
422
|
+
/** Optional stem for the generated CSV. The title is used when omitted. */
|
|
423
|
+
fileName?: string;
|
|
424
|
+
}
|
|
425
|
+
/** Turn the exact rows supplied to a Sterling figure into a portable UTF-8 CSV. */
|
|
426
|
+
declare function sterlingRowsToCsv(rows: SterlingDataExport["rows"]): string;
|
|
427
|
+
/**
|
|
428
|
+
* A graceful fallback for wrappers that have not supplied `dataExport` yet.
|
|
429
|
+
* It only inspects the already-processed props passed to common primitives;
|
|
430
|
+
* explicit `dataExport` is preferable when field names need editorial care.
|
|
431
|
+
*/
|
|
432
|
+
declare function inferSterlingDataExport(props: Record<string, unknown>): SterlingDataExport | undefined;
|
|
433
|
+
|
|
434
|
+
/** Writing conventions around a figure, kept separate from every chart primitive. */
|
|
435
|
+
interface SterlingEditorial {
|
|
436
|
+
/** Use `false` to remove the QED-like title mark, or supply another mark. */
|
|
437
|
+
titleMark?: ReactNode | false;
|
|
438
|
+
/** Optional destination for an interactive title mark. */
|
|
439
|
+
titleMarkHref?: string;
|
|
440
|
+
/** Accessible label for an interactive title mark. */
|
|
441
|
+
titleMarkLabel?: string;
|
|
442
|
+
/** Use `false` to omit the credit from the caption. */
|
|
443
|
+
signature?: ReactNode | false;
|
|
444
|
+
/** Replaces the localized Source/Fuente label. */
|
|
445
|
+
sourceLabel?: ReactNode;
|
|
446
|
+
}
|
|
447
|
+
interface SterlingCreditOptions {
|
|
448
|
+
author?: ReactNode;
|
|
449
|
+
productName?: ReactNode;
|
|
450
|
+
/** Link the product name to its public documentation. Defaults to true. */
|
|
451
|
+
linkToSterling?: boolean;
|
|
452
|
+
sterlingUrl?: string;
|
|
453
|
+
}
|
|
454
|
+
/** A portable credit, e.g. “Made by Ada with Sterling ✦”. */
|
|
455
|
+
declare function sterlingCredit({ author, productName, linkToSterling, sterlingUrl, }: SterlingCreditOptions, locale?: SterlingLocale): ReactNode;
|
|
456
|
+
|
|
457
|
+
type TailwindStep = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950;
|
|
458
|
+
type TailwindScale = Partial<Record<TailwindStep, string>>;
|
|
459
|
+
interface TailwindSterlingPaletteOptions {
|
|
460
|
+
/** Eight or fewer Tailwind color scales. Their 500 stops become categories. */
|
|
461
|
+
categorical: readonly TailwindScale[];
|
|
462
|
+
/** Use your own surfaces so text and grid contrast remain intentional. */
|
|
463
|
+
surface: SterlingSurfacePalette;
|
|
464
|
+
divergent?: TailwindScale;
|
|
465
|
+
heat?: TailwindScale;
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Convert Tailwind-like 100–950 scales into Sterling's palette contract
|
|
469
|
+
* without making Tailwind a runtime dependency.
|
|
470
|
+
*/
|
|
471
|
+
declare function createTailwindSterlingPalette({ categorical, surface, divergent, heat, }: TailwindSterlingPaletteOptions): SterlingPalette;
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Shared optical weights for Sterling primitives. Values are intentionally
|
|
475
|
+
* modest: data marks lead, while axes and construction lines recede.
|
|
476
|
+
*/
|
|
477
|
+
declare const sterlingVisualStyle: {
|
|
478
|
+
readonly stroke: {
|
|
479
|
+
readonly grid: 1;
|
|
480
|
+
readonly detail: 1.5;
|
|
481
|
+
readonly candle: 1.75;
|
|
482
|
+
readonly mark: 2;
|
|
483
|
+
readonly series: 2.25;
|
|
484
|
+
readonly emphasis: 2.5;
|
|
485
|
+
readonly interval: 7;
|
|
486
|
+
readonly halo: 3;
|
|
487
|
+
readonly ring: 44;
|
|
488
|
+
readonly flowMinimum: 1;
|
|
489
|
+
};
|
|
490
|
+
readonly opacity: {
|
|
491
|
+
readonly ghost: 0.04;
|
|
492
|
+
readonly contour: 0.08;
|
|
493
|
+
readonly surface: 0.1;
|
|
494
|
+
readonly area: 0.24;
|
|
495
|
+
readonly ridge: 0.34;
|
|
496
|
+
readonly interval: 0.28;
|
|
497
|
+
readonly relationship: 0.42;
|
|
498
|
+
readonly secondaryMark: 0.66;
|
|
499
|
+
readonly guide: 0.7;
|
|
500
|
+
readonly signal: 0.84;
|
|
501
|
+
readonly mutedMark: 0.34;
|
|
502
|
+
};
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
export { AXIS_TITLE, AxisBottom, AxisLeft, type BarDatum, type BoxPlotGroup, type DonutDatum, type DumbbellDatum, type Frame, Gridlines, type LineSeries, type Margin, type SankeyLinkDatum, type ScatterDatum, SterlingBarChart, SterlingBoxPlot, SterlingCandlestickChart, SterlingChordChart, SterlingCorrelogram, type SterlingCreditOptions, type SterlingDataExport, SterlingDendrogramChart, SterlingDensity2DChart, SterlingDensityChart, SterlingDonutChart, SterlingDumbbellChart, type SterlingEditorial, SterlingExpressionChart, SterlingGeoMapChart, SterlingHeatmap, SterlingHistogram, SterlingInlineLegend, type SterlingLegendItem, type SterlingLegendShape, SterlingLineChart, type SterlingLocale, SterlingLollipopChart, SterlingManhattanChart, type SterlingMode, SterlingNetworkChart, type SterlingPalette, SterlingPieChart, SterlingRadarChart, SterlingRidgelineChart, SterlingSankeyChart, SterlingScatterPlot, SterlingSequentialSurface, type SterlingSurfacePalette, SterlingTreemapChart, SterlingVerticalBarChart, SterlingViolinPlot, SterlingVolcanoChart, TICK, TICK_LABEL, type TailwindScale, type TailwindStep, type TailwindSterlingPaletteOptions, TimeAxisBottom, type ViolinGroup, axisGrid, axisLine, axisMuted, axisText, bandCenters, createTailwindSterlingPalette, defaultMargin, defineSterlingPalette, divergentSignedColor, divergentSignedRamp, frame, inferSterlingDataExport, kernelDensity, linearScale, sterlingCategorical, sterlingChartColors, sterlingColorNames, sterlingCredit, sterlingDivergentColors, sterlingHeatColors, sterlingLegendColors, sterlingPaletteStyle, sterlingRamp, sterlingRampStops, sterlingRowsToCsv, sterlingSequentialColors, sterlingVisualStyle, timeScale, tukeySummary };
|