@silverpoint/core 0.1.1 → 0.2.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.
@@ -0,0 +1,719 @@
1
+ /** A row of data. Charts reach its fields through accessors. */
2
+ type Datum = Readonly<Record<string, unknown>>;
3
+ /** Access to a field: key name or pure function. */
4
+ type Accessor<T = number> = string | ((d: Datum, i: number) => T);
5
+ /** Inking mode. `precision` amounts to using NullInker (REQ-021). */
6
+ type InkMode = 'ink' | 'precision';
7
+ /** Seed. A string is converted to an integer stably (REQ-003). */
8
+ type Seed = number | string;
9
+ /** Prepared substrates of the silverpoint ground (REQ-046). */
10
+ type SubstrateName = 'cream' | 'green' | 'blue' | 'ochre';
11
+ /** Active item resolved by the interaction engine (REQ-140). */
12
+ interface ActiveItem {
13
+ readonly seriesKey: string;
14
+ readonly index: number;
15
+ readonly datum: Datum;
16
+ readonly value: number;
17
+ /** Coordinates in SVG space, not screen space. */
18
+ readonly point: Readonly<{
19
+ x: number;
20
+ y: number;
21
+ }>;
22
+ }
23
+
24
+ /** What a stroke is. Determines whether the Inker may touch it (REQ-022). */
25
+ type StrokeRole = 'encoding' | 'ornament' | 'hatch';
26
+ /** Semantic paint slot; maps to a CSS variable (API Spec §10). */
27
+ type StrokePart = 'ink' | 'ink-secondary' | 'heighten' | 'rule' | 'grid' | 'axis';
28
+ /**
29
+ * How the stylesheet paints the shape: its outline, its interior with the part colour, its
30
+ * interior with a hatch tile, or nothing — a toned shape whose edges other strokes draw, so the
31
+ * Inker hatches it and no outline covers those edges.
32
+ * @internal
33
+ */
34
+ type StrokePaint = 'stroke' | 'fill' | 'tile' | 'none';
35
+ /** Tonal level on the ground's ramp; 0 is no fill (Data Model §3.4). */
36
+ type ToneLevel = 0 | 1 | 2 | 3 | 4;
37
+ /** Stroke instruction. It carries no color: color comes from CSS (REQ-042). */
38
+ interface Stroke {
39
+ /** SVG path data, already rounded to 2 decimals (REQ-002). */
40
+ readonly d: string;
41
+ readonly role: StrokeRole;
42
+ readonly part: StrokePart;
43
+ /** Relative weight, resolved against the ground's token. */
44
+ readonly weight?: number;
45
+ /** @internal Defaults to `'stroke'`. */
46
+ readonly paint?: StrokePaint;
47
+ /** @internal Dash pattern, resolved by the stylesheet. */
48
+ readonly dash?: 'dotted';
49
+ /** @internal Tonal level a closed shape asks the Inker to hatch. */
50
+ readonly tone?: ToneLevel;
51
+ /** @internal Id of the tile in `Geometry.defs` that fills this shape. */
52
+ readonly tile?: string;
53
+ /**
54
+ * @internal The tonal level a `weight` ground's Inker drew as line weight in place of hatching;
55
+ * written as `data-weight` and resolved by the stylesheet to a stroke width (REQ-028).
56
+ */
57
+ readonly tonalWeight?: Exclude<ToneLevel, 0>;
58
+ }
59
+ /** Kind of text a label carries; the stylesheet sets type by it. */
60
+ type LabelKind = 'title' | 'badge' | 'value' | 'unit' | 'footer' | 'tick' | 'empty';
61
+ interface TextLabel {
62
+ readonly x: number;
63
+ readonly y: number;
64
+ readonly text: string;
65
+ readonly kind: LabelKind;
66
+ /** Paint slot: `text` for primary labels, `axis` for muted ones. */
67
+ readonly part: 'text' | 'axis';
68
+ readonly anchor: 'start' | 'middle' | 'end';
69
+ }
70
+ /** A datum's position, as the interaction engine sees it (REQ-140). */
71
+ interface HitArea {
72
+ readonly seriesKey: string;
73
+ readonly index: number;
74
+ readonly datum: Datum;
75
+ readonly value: number;
76
+ readonly x: number;
77
+ readonly y: number;
78
+ /** The item's area, when it has one — a bar, a cell, a tile. A pointer inside it wins. */
79
+ readonly box?: Rect;
80
+ /**
81
+ * The item's place in a grid, when the chart is one. When every item has one, the arrow keys
82
+ * move by column (left, right) and by row (up, down) across the whole grid (REQ-122).
83
+ */
84
+ readonly cell?: Readonly<{
85
+ column: number;
86
+ row: number;
87
+ }>;
88
+ }
89
+ /**
90
+ * A hatch tile shared by every shape of one tonal level (REQ-029).
91
+ * @internal
92
+ */
93
+ interface Tile {
94
+ /** Scoped to the chart instance (REQ-030). */
95
+ readonly id: string;
96
+ readonly width: number;
97
+ readonly height: number;
98
+ /** Rotation of the tile in degrees. */
99
+ readonly angle: number;
100
+ readonly strokes: readonly Stroke[];
101
+ }
102
+ interface Rect {
103
+ readonly x: number;
104
+ readonly y: number;
105
+ readonly width: number;
106
+ readonly height: number;
107
+ }
108
+ /** Everything a chart needs in order to draw itself. Serializable (REQ-011). */
109
+ interface Geometry {
110
+ readonly viewBox: Rect;
111
+ readonly strokes: readonly Stroke[];
112
+ readonly labels: readonly TextLabel[];
113
+ readonly hitAreas: readonly HitArea[];
114
+ /** @internal Hatch tiles referenced by strokes painted with `'tile'`. */
115
+ readonly defs: readonly Tile[];
116
+ /** @internal The drawing area; the interaction engine ignores anything outside it. */
117
+ readonly plot: Rect;
118
+ }
119
+
120
+ /** One step of a `hatch` ground's tonal ramp (Data Model §3.4). */
121
+ interface HatchToneSpec {
122
+ readonly style: 'hachure' | 'cross-hatch';
123
+ readonly gap: number;
124
+ /** Hatch angle in degrees; cross-hatch adds the perpendicular. */
125
+ readonly angle: number;
126
+ }
127
+ /** One step of a `weight` ground's tonal ramp (Data Model §3.7, REQ-028). */
128
+ interface WeightToneSpec {
129
+ readonly style: 'weight';
130
+ /** Stroke width of a toned shape's outline, times `--sp-stroke-width`. */
131
+ readonly weight: number;
132
+ }
133
+ /** One step of a ground's tonal ramp: a hatch under `hatch`, a line weight under `weight`. */
134
+ type ToneSpec = HatchToneSpec | WeightToneSpec;
135
+ type TonalRamp = Readonly<Record<Exclude<ToneLevel, 0>, ToneSpec>>;
136
+ interface InkOptions {
137
+ readonly seed: number;
138
+ readonly roughness: number;
139
+ readonly bowing: number;
140
+ readonly hatchAngle: number;
141
+ readonly hatchGap: number;
142
+ readonly fillWeight: number;
143
+ /** Upper bound of nodes the Inker must not exceed. */
144
+ readonly nodeBudget: number;
145
+ /** @internal `tile` shares one hatch tile per tonal level (REQ-029). */
146
+ readonly hatchFill?: 'tile' | 'per-shape';
147
+ /** @internal The ground's tonal ramp. */
148
+ readonly tonalRamp?: TonalRamp;
149
+ /** @internal Prefix that scopes generated ids to the chart instance (REQ-030). */
150
+ readonly scope?: string;
151
+ }
152
+ interface Inker {
153
+ readonly name: string;
154
+ /** Receives exact geometry and returns the inked geometry. */
155
+ ink(geometry: Geometry, options: InkOptions): Geometry;
156
+ }
157
+
158
+ /** Name of a registered ground. */
159
+ type GroundName = 'silverpoint' | (string & {});
160
+ /** Declarative token set of a style ground (API Spec §6, Art. 7). */
161
+ interface Ground {
162
+ readonly name: string;
163
+ /** How it builds tonal value. `wash` is the anticipated exception to Art. 6. */
164
+ readonly tonalMechanism: 'hatch' | 'weight' | 'wash';
165
+ /** Name of the registered Inker that inks it. */
166
+ readonly inker: string;
167
+ readonly substrates: Readonly<Record<string, string>>;
168
+ readonly ink: Readonly<{
169
+ primary: string;
170
+ secondary: string;
171
+ heighten: string;
172
+ rule: string;
173
+ grid: string;
174
+ text: string;
175
+ textMuted: string;
176
+ }>;
177
+ readonly inkOptions: Omit<InkOptions, 'seed' | 'nodeBudget' | 'hatchFill' | 'tonalRamp' | 'scope'>;
178
+ /** Hatch density bound, to stay within the node budget. */
179
+ readonly maxHatchDensity: number;
180
+ /** Tonal levels 1-4 (Data Model §3.4). */
181
+ readonly tonalRamp: TonalRamp;
182
+ readonly typography: Readonly<{
183
+ display: string;
184
+ scale: number;
185
+ }>;
186
+ /** What to draw when there is no data (REQ-007). */
187
+ readonly emptyState: Readonly<{
188
+ text: string;
189
+ rule: boolean;
190
+ }>;
191
+ /** Expansion of degenerate domains (REQ-010). */
192
+ readonly domainPadding: number;
193
+ }
194
+ /** Name of a registered ground, or a complete ground. */
195
+ type GroundRef = GroundName | Ground;
196
+
197
+ /** Props present in every chart, identical in React and Angular (REQ-094). */
198
+ interface CommonChartProps {
199
+ /**
200
+ * Rows to draw. If omitted, the demo dataset is rendered (REQ-093): accessor props (`…Key`,
201
+ * `keys`, `names`) are ignored, every other prop applies.
202
+ */
203
+ data?: readonly Datum[];
204
+ /** Style ground. Defaults to the app provider's, or `silverpoint`. */
205
+ ground?: GroundRef;
206
+ /** Prepared substrate within the ground (REQ-046). */
207
+ substrate?: SubstrateName;
208
+ /** `ink` by default; `precision` disables inking (REQ-021). */
209
+ mode?: InkMode;
210
+ /** Seed. If omitted, it is derived from `id` stably (REQ-003). */
211
+ seed?: Seed;
212
+ /** Stable identifier. If omitted, it is generated deterministically. */
213
+ id?: string;
214
+ /** Height of the drawing area in px. Width is the container's unless pinned. */
215
+ height?: number;
216
+ width?: number;
217
+ /** `card` draws the full frame; `bare` only the drawing area (REQ-095). */
218
+ chrome?: 'card' | 'bare';
219
+ /** How areas are filled (REQ-029). */
220
+ hatchFill?: 'tile' | 'per-shape';
221
+ title?: string;
222
+ badge?: string;
223
+ value?: string | number;
224
+ unit?: string;
225
+ footerLeft?: string;
226
+ footerRight?: string;
227
+ /** Accessible name. If omitted, it is derived from `title` (REQ-120). */
228
+ label?: string;
229
+ /** Long description for screen readers (REQ-120). */
230
+ description?: string;
231
+ /** Tabular alternative; `hidden` leaves it for assistive technology only (REQ-121). */
232
+ dataTable?: 'visible' | 'hidden' | 'none';
233
+ locale?: string;
234
+ numberFormat?: Intl.NumberFormatOptions;
235
+ className?: string;
236
+ }
237
+ type LineCurve = 'monotone' | 'linear' | 'natural' | 'step';
238
+ /** `LineChart` (REQ-060): spline with an optional dotted baseline series. */
239
+ interface LineChartProps extends CommonChartProps {
240
+ /** Ignored without `data`. */
241
+ xKey?: Accessor<string | number>;
242
+ /** Ignored without `data`. */
243
+ valueKey?: Accessor<number | null | undefined>;
244
+ /** Ignored without `data`. */
245
+ secondaryKey?: Accessor<number | null | undefined>;
246
+ curve?: LineCurve;
247
+ /** `all` draws the secondary series when there is one; `primary` omits it. */
248
+ series?: 'all' | 'primary';
249
+ /** Whether a gap left by a missing value is bridged (REQ-008). */
250
+ connectNulls?: boolean;
251
+ }
252
+ /** Configuration an application sets once for every chart (API Spec §8). */
253
+ interface ProviderConfig {
254
+ ground?: GroundRef;
255
+ substrate?: SubstrateName;
256
+ mode?: InkMode;
257
+ locale?: string;
258
+ }
259
+ /** `BulletChart` (REQ-069): one bar per target, with a marker at the target. Values in 0-100. */
260
+ interface BulletChartProps extends CommonChartProps {
261
+ /** Ignored without `data`. */
262
+ titleKey?: Accessor<string>;
263
+ /** Ignored without `data`. */
264
+ actualKey?: Accessor<number | null | undefined>;
265
+ /** Ignored without `data`. */
266
+ targetKey?: Accessor<number | null | undefined>;
267
+ }
268
+ /** `PyramidChart` (REQ-070): stacked tiers whose width encodes the value (0-100). */
269
+ interface PyramidChartProps extends CommonChartProps {
270
+ /** Ignored without `data`. */
271
+ labelKey?: Accessor<string>;
272
+ /** Ignored without `data`. */
273
+ widthKey?: Accessor<number | null | undefined>;
274
+ /** Ignored without `data`. */
275
+ toneKey?: Accessor<number | null | undefined>;
276
+ }
277
+ /** `HeatmapChart` (REQ-084): labelled rows of values, normalised against `scaleMax`. */
278
+ interface HeatmapChartProps extends CommonChartProps {
279
+ /** Ignored without `data`. */
280
+ labelKey?: Accessor<string>;
281
+ /** Ignored without `data`. */
282
+ valuesKey?: Accessor<readonly (number | null)[] | null | undefined>;
283
+ /** Value that maps to the darkest tone; 100 by default. */
284
+ scaleMax?: number;
285
+ /** Names of the columns, in order; missing ones fall back to `#k` (delta-006). */
286
+ columnLabels?: readonly string[];
287
+ }
288
+ /** `TreemapChart` (REQ-085): tiles of `cols × rows` cells placed in a `columns × rows` grid. */
289
+ interface TreemapChartProps extends CommonChartProps {
290
+ /** Ignored without `data`. */
291
+ labelKey?: Accessor<string>;
292
+ /** Ignored without `data`. */
293
+ shareKey?: Accessor<number | null | undefined>;
294
+ columns?: number;
295
+ rows?: number;
296
+ }
297
+ /** `SankeyChart` (REQ-086): flow bands between layered nodes. */
298
+ interface SankeyChartProps extends CommonChartProps {
299
+ /** Ignored without `data`. */
300
+ sourceKey?: Accessor<string>;
301
+ /** Ignored without `data`. */
302
+ targetKey?: Accessor<string>;
303
+ /** Ignored without `data`. */
304
+ valueKey?: Accessor<number | null | undefined>;
305
+ }
306
+ /** `ActivityGrid` (REQ-087): one cell per day, a column per week. */
307
+ interface ActivityGridProps extends CommonChartProps {
308
+ /** Ignored without `data`. */
309
+ dateKey?: Accessor<string>;
310
+ /** Ignored without `data`. */
311
+ countKey?: Accessor<number | null | undefined>;
312
+ /** Ignored without `data`. */
313
+ levelKey?: Accessor<number | null | undefined>;
314
+ /** Weeks shown, the most recent last; 26 by default. */
315
+ weeks?: number;
316
+ }
317
+ /** `StepChart` (REQ-061): a series drawn as steps. */
318
+ interface StepChartProps extends CommonChartProps {
319
+ /** Ignored without `data`. */
320
+ xKey?: Accessor<string | number>;
321
+ /** Ignored without `data`. */
322
+ valueKey?: Accessor<number | null | undefined>;
323
+ /** Where the step sits between two points; `after` by default. */
324
+ step?: 'after' | 'before' | 'middle';
325
+ }
326
+ /** `SparklineRows` (REQ-062): one row per series — name, sparkline, readout (delta-008). */
327
+ interface SparklineRowsProps extends CommonChartProps {
328
+ /** Rows shown, from the first; all by default. */
329
+ rows?: number;
330
+ /** Ignored without `data`. */
331
+ nameKey?: Accessor<string>;
332
+ /** The printed readout; the last value of the series by default. Ignored without `data`. */
333
+ readoutKey?: Accessor<string | number | null | undefined>;
334
+ /** The row's points: an array. Ignored without `data`. */
335
+ seriesKey?: Accessor<readonly unknown[] | null | undefined>;
336
+ /** The value of one point; the point itself when it is a number, else its `value`. Ignored without `data`. */
337
+ pointKey?: Accessor<number | null | undefined>;
338
+ }
339
+ /** `KpiCard` (REQ-063): a metric, its delta, and an area sparkline of the series. */
340
+ interface KpiCardProps extends CommonChartProps {
341
+ /** Ignored without `data`. */
342
+ valueKey?: Accessor<number | null | undefined>;
343
+ /** The metric's name, printed under the figure. */
344
+ metric?: string;
345
+ /** Signed change, printed with its sign and a direction mark. */
346
+ delta?: number;
347
+ /** Direction of the mark; from the sign of `delta` by default. */
348
+ deltaTone?: 'up' | 'down' | 'flat';
349
+ }
350
+ /** `BarChart` (REQ-064): pill bars, as columns or rows, with an optional second series. */
351
+ interface BarChartProps extends CommonChartProps {
352
+ /** Ignored without `data`. */
353
+ xKey?: Accessor<string | number>;
354
+ /** Ignored without `data`. */
355
+ valueKey?: Accessor<number | null | undefined>;
356
+ /** Ignored without `data`. */
357
+ secondaryKey?: Accessor<number | null | undefined>;
358
+ orientation?: 'columns' | 'rows';
359
+ }
360
+ /** `StackedBarChart` (REQ-065): one stacked segment per key. */
361
+ interface StackedBarChartProps extends CommonChartProps {
362
+ /** Ignored without `data`. */
363
+ xKey?: Accessor<string | number>;
364
+ /** Ignored without `data`. */
365
+ keys?: readonly string[];
366
+ /** Display names of the keys, in order; the keys themselves by default. Ignored without `data`. */
367
+ names?: readonly string[];
368
+ }
369
+ /** `ComposedChart` (REQ-066): columns and a spline on one value scale. */
370
+ interface ComposedChartProps extends CommonChartProps {
371
+ /** Ignored without `data`. */
372
+ xKey?: Accessor<string | number>;
373
+ /** Ignored without `data`. */
374
+ barKey?: Accessor<number | null | undefined>;
375
+ /** Ignored without `data`. */
376
+ lineKey?: Accessor<number | null | undefined>;
377
+ showLine?: boolean;
378
+ }
379
+ /** `WaterfallChart` (REQ-067): totals from zero and floating deltas from the running total. */
380
+ interface WaterfallChartProps extends CommonChartProps {
381
+ /** Ignored without `data`. */
382
+ stepKey?: Accessor<string>;
383
+ /** An absolute total: the bar starts at zero and resets the running total. Ignored without `data`. */
384
+ baseKey?: Accessor<number | null | undefined>;
385
+ /** A change from the running total. Ignored without `data`. */
386
+ deltaKey?: Accessor<number | null | undefined>;
387
+ }
388
+ /** `FunnelChart` (REQ-068): horizontal, centred stages. */
389
+ interface FunnelChartProps extends CommonChartProps {
390
+ /** Ignored without `data`. */
391
+ stageKey?: Accessor<string>;
392
+ /** Ignored without `data`. */
393
+ valueKey?: Accessor<number | null | undefined>;
394
+ }
395
+ /** `CandlestickChart` (REQ-071): OHLC bodies and wicks (Data Model §2.6). */
396
+ interface CandlestickChartProps extends CommonChartProps {
397
+ /** Ignored without `data`. */
398
+ timeKey?: Accessor<string | number>;
399
+ /** Ignored without `data`. */
400
+ openKey?: Accessor<number | null | undefined>;
401
+ /** Ignored without `data`. */
402
+ highKey?: Accessor<number | null | undefined>;
403
+ /** Ignored without `data`. */
404
+ lowKey?: Accessor<number | null | undefined>;
405
+ /** Ignored without `data`. */
406
+ closeKey?: Accessor<number | null | undefined>;
407
+ /** Price bounds of the scale; derived from the data when omitted (REQ-097). */
408
+ bounds?: readonly [number, number];
409
+ }
410
+ /** `AreaChart` (REQ-072): a curved, toned area under its line. */
411
+ interface AreaChartProps extends CommonChartProps {
412
+ /** Ignored without `data`. */
413
+ xKey?: Accessor<string | number>;
414
+ /** Ignored without `data`. */
415
+ valueKey?: Accessor<number | null | undefined>;
416
+ curve?: LineCurve;
417
+ }
418
+ /** `RangeBandChart` (REQ-073): the band between a low and a high series. */
419
+ interface RangeBandChartProps extends CommonChartProps {
420
+ /** Ignored without `data`. */
421
+ xKey?: Accessor<string | number>;
422
+ /** Ignored without `data`. */
423
+ lowKey?: Accessor<number | null | undefined>;
424
+ /** Ignored without `data`. */
425
+ highKey?: Accessor<number | null | undefined>;
426
+ }
427
+ /** `StreamChart` (REQ-074): two waves, overlaid or stacked. */
428
+ interface StreamChartProps extends CommonChartProps {
429
+ /** Ignored without `data`. */
430
+ xKey?: Accessor<string | number>;
431
+ /** Ignored without `data`. */
432
+ keys?: readonly string[];
433
+ stacked?: boolean;
434
+ }
435
+ /** `ScatterChart` (REQ-082): points on two linear scales, optionally sized. */
436
+ interface ScatterChartProps extends CommonChartProps {
437
+ /** Ignored without `data`. */
438
+ xKey?: Accessor<number | null | undefined>;
439
+ /** Ignored without `data`. */
440
+ yKey?: Accessor<number | null | undefined>;
441
+ /** Ignored without `data`. */
442
+ sizeKey?: Accessor<number | null | undefined>;
443
+ /** Marker area in px², smallest to largest; `[60, 240]` by default. */
444
+ sizeRange?: readonly [number, number];
445
+ }
446
+ /** `BubbleChart` (REQ-083): circles whose area encodes `sizeKey`. */
447
+ interface BubbleChartProps extends CommonChartProps {
448
+ /** Ignored without `data`. */
449
+ xKey?: Accessor<number | null | undefined>;
450
+ /** Ignored without `data`. */
451
+ yKey?: Accessor<number | null | undefined>;
452
+ /** Ignored without `data`. */
453
+ sizeKey?: Accessor<number | null | undefined>;
454
+ /** Circle area in px², smallest to largest; `[100, 500]` by default. */
455
+ sizeRange?: readonly [number, number];
456
+ }
457
+ /** `DonutChart` (REQ-075): sectors ∝ value around a central readout (Data Model §2.2). */
458
+ interface DonutChartProps extends CommonChartProps {
459
+ /** Ignored without `data`. */
460
+ nameKey?: Accessor<string | number>;
461
+ /** Ignored without `data`. */
462
+ valueKey?: Accessor<number | null | undefined>;
463
+ /** Printed in the centre; the total by default. */
464
+ centerValue?: string | number;
465
+ /** A line under the centre value. */
466
+ centerLabel?: string;
467
+ /** Names every sector with its share beside the ring; `true` by default. */
468
+ legend?: boolean;
469
+ }
470
+ /** `RadarChart` (REQ-076): one spoke per subject, a closed polygon of values (Data Model §2.2). */
471
+ interface RadarChartProps extends CommonChartProps {
472
+ /** Ignored without `data`. */
473
+ subjectKey?: Accessor<string | number>;
474
+ /** Ignored without `data`. */
475
+ valueKey?: Accessor<number | null | undefined>;
476
+ /** The value range along a spoke; `[0, the largest value]`, niced, by default. */
477
+ domain?: readonly [number, number];
478
+ }
479
+ /** `PolarBarChart` (REQ-077): 360° bars out from a hole, length ∝ value (Data Model §2.2). */
480
+ interface PolarBarChartProps extends CommonChartProps {
481
+ /** Ignored without `data`. */
482
+ nameKey?: Accessor<string | number>;
483
+ /** Ignored without `data`. */
484
+ valueKey?: Accessor<number | null | undefined>;
485
+ }
486
+ /** `CoxcombChart` (REQ-088): equal angles, sector **area** ∝ value (Data Model §2.2). */
487
+ interface CoxcombChartProps extends CommonChartProps {
488
+ /** Ignored without `data`. */
489
+ nameKey?: Accessor<string | number>;
490
+ /** Ignored without `data`. */
491
+ valueKey?: Accessor<number | null | undefined>;
492
+ /** Where the first sector starts, in degrees clockwise from 12 o'clock; 0 by default. */
493
+ startAngle?: number;
494
+ }
495
+ /** `RadialArcGroup` (REQ-078): concentric 180° tracks, sweep ∝ value / the largest (Data Model §2.2). */
496
+ interface RadialArcGroupProps extends CommonChartProps {
497
+ /** Ignored without `data`. */
498
+ nameKey?: Accessor<string | number>;
499
+ /** Ignored without `data`. */
500
+ valueKey?: Accessor<number | null | undefined>;
501
+ }
502
+ /** `RadialRings` (REQ-079): concentric progress rings, sweep ∝ value in 0-100 (Data Model §2.2). */
503
+ interface RadialRingsProps extends CommonChartProps {
504
+ /** Ignored without `data`. */
505
+ nameKey?: Accessor<string | number>;
506
+ /** Ignored without `data`. */
507
+ valueKey?: Accessor<number | null | undefined>;
508
+ }
509
+ /** `GaugeArc` (REQ-080): a 240° arc swept to a percent (Data Model §2.3). */
510
+ interface GaugeArcProps extends CommonChartProps {
511
+ /** 0 to 100; saturated at the ends outside it. */
512
+ percent?: number;
513
+ /** Names the measure under the readout. */
514
+ caption?: string;
515
+ /** Printed in place of the percent. */
516
+ readout?: string;
517
+ }
518
+ /** `MeterChart` (REQ-081): a semicircular meter with a needle at a percent (Data Model §2.3). */
519
+ interface MeterChartProps extends CommonChartProps {
520
+ /** 0 to 100; saturated at the ends outside it. */
521
+ percent?: number;
522
+ /** Names the measure under the readout. */
523
+ caption?: string;
524
+ /** Printed in place of the percent. */
525
+ readout?: string;
526
+ }
527
+ /** `WindRose` (REQ-089): observations of (bearing, speed) binned by compass sector and speed. */
528
+ interface WindRoseProps extends CommonChartProps {
529
+ /** Where the wind blows from, in degrees clockwise from north. Ignored without `data`. */
530
+ bearingKey?: Accessor<number | null | undefined>;
531
+ /** The wind speed; 0 is a calm, which has no direction. Ignored without `data`. */
532
+ valueKey?: Accessor<number | null | undefined>;
533
+ /** Compass sectors: 4, 8, 16 or 32; 16 by default. */
534
+ sectors?: number;
535
+ /** Ascending speed thresholds that split each sector; `[5, 10, 15, 20]` by default. */
536
+ bins?: readonly number[];
537
+ }
538
+ /** `ChordRing` (REQ-091): directed flows between categories around a circle (Data Model §2.7). */
539
+ interface ChordRingProps extends CommonChartProps {
540
+ /** Ignored without `data`. */
541
+ sourceKey?: Accessor<string | number>;
542
+ /** Ignored without `data`. */
543
+ targetKey?: Accessor<string | number>;
544
+ /** Ignored without `data`. */
545
+ valueKey?: Accessor<number | null | undefined>;
546
+ /** Categories drawn; past it the smallest merge into "Other" (`SP010`). 12 by default. */
547
+ maxCategories?: number;
548
+ }
549
+ /** `OrbitChart` (REQ-092): nested elliptical orbits with markers along them (Data Model §2.10, delta-009). */
550
+ interface OrbitChartProps extends CommonChartProps {
551
+ /** Orbits shown, from the inside out; all by default. */
552
+ orbits?: number;
553
+ /** A row's markers; `'markers'` by default. Ignored without `data`. */
554
+ markerKey?: Accessor<readonly unknown[] | null | undefined>;
555
+ /** A marker's period, 0-1 over the cycle; `'period'` by default. Ignored without `data`. */
556
+ periodKey?: Accessor<number | null | undefined>;
557
+ }
558
+ /** `VolvelleChart` (REQ-090): concentric categorical rings read against one index (delta-010). */
559
+ interface VolvelleChartProps extends CommonChartProps {
560
+ /** Rings shown, from the inside out; all by default. */
561
+ rings?: number;
562
+ /**
563
+ * The ring whose segment is brought under the index, 0-based; 0 by default. Without `data`, it
564
+ * addresses the demo’s rings: `Day`, `Shift`, `Team`.
565
+ */
566
+ indexRing?: number;
567
+ /**
568
+ * The segment of `indexRing` under the index; its first segment by default. Without `data`, it
569
+ * addresses the demo’s rings: `Day`, `Shift`, `Team`.
570
+ */
571
+ indexValue?: string;
572
+ }
573
+
574
+ /** The three container breakpoints; their widths are fixed (TD DD-014). */
575
+ type DashboardBreakpoint = 'sm' | 'md' | 'lg';
576
+ /** A value that may differ per breakpoint; a bare number applies to all three. */
577
+ type PerBreakpoint<T> = T | Partial<Record<DashboardBreakpoint, T>>;
578
+ /** Serialisable layout (REQ-201). No functions, no DOM, no chart references. */
579
+ interface DashboardLayout {
580
+ /** Columns per breakpoint. Default `{ sm: 1, md: 2, lg: 4 }` (REQ-208). */
581
+ columns?: PerBreakpoint<number>;
582
+ /** Height of one row unit, in px, card chrome included. Default `240`. */
583
+ rowHeight?: number;
584
+ /** Gap between cells, in px. Default `16`. */
585
+ gap?: number;
586
+ /** Cells in reading order (REQ-203). Omitted: every child, span 1. */
587
+ cells?: readonly DashboardCellLayout[];
588
+ }
589
+ interface DashboardCellLayout {
590
+ /** Matches `DashboardCell`'s `cell` prop; unique within the dashboard (REQ-205). */
591
+ id: string;
592
+ /** Default `1`. Clamped to the breakpoint's columns with `SP014` (REQ-204). */
593
+ colSpan?: PerBreakpoint<number>;
594
+ /** Default `1`. */
595
+ rowSpan?: PerBreakpoint<number>;
596
+ }
597
+ /** Link on a category key across the dashboard's charts (REQ-216). */
598
+ interface DashboardLink {
599
+ /** The datum field whose value is matched, e.g. `'hour'`. */
600
+ key: string;
601
+ }
602
+ /** Name is required by the type: `title` or `label` (REQ-214). */
603
+ type DashboardName = {
604
+ title: string;
605
+ label?: string;
606
+ } | {
607
+ title?: undefined;
608
+ label: string;
609
+ };
610
+ type DashboardProps = DashboardName & {
611
+ /** Stable identifier; seeds of unnamed charts derive from it (REQ-209). Required. */
612
+ id: string;
613
+ layout?: DashboardLayout;
614
+ /** Long description, exposed as the region's description (REQ-214). */
615
+ description?: string;
616
+ /** Heading level of `title`. Default `2`. */
617
+ headingLevel?: 2 | 3 | 4 | 5 | 6;
618
+ /** Width in px used for nominal cell boxes on the server and at hydration (REQ-207). Default `1200`. */
619
+ ssrWidth?: number;
620
+ /** Linked interaction (REQ-216); client entry points only. */
621
+ link?: DashboardLink;
622
+ /** Inherited by every chart inside, below the chart's own prop (REQ-212). */
623
+ ground?: GroundRef;
624
+ substrate?: SubstrateName;
625
+ mode?: InkMode;
626
+ locale?: string;
627
+ className?: string;
628
+ };
629
+ interface DashboardCellProps {
630
+ /** The layout cell this child fills. Omitted: next in source order, span 1. */
631
+ cell?: string;
632
+ }
633
+ /** A cell's spans at every breakpoint. */
634
+ type ResolvedSpan = Readonly<Record<DashboardBreakpoint, {
635
+ readonly col: number;
636
+ readonly row: number;
637
+ }>>;
638
+ /** The layout with every default applied and every per-breakpoint value expanded (internal surface). */
639
+ interface ResolvedLayout {
640
+ readonly columns: Readonly<Record<DashboardBreakpoint, number>>;
641
+ readonly rowHeight: number;
642
+ readonly gap: number;
643
+ /** The layout's own cells, in its order; children are matched to them by `resolveDashboard`. */
644
+ readonly cells: readonly {
645
+ readonly id: string;
646
+ readonly span: ResolvedSpan;
647
+ }[];
648
+ }
649
+ /** The resolved dashboard (internal surface, API Spec §2). */
650
+ interface DashboardModel {
651
+ readonly id: string;
652
+ /** In reading order. */
653
+ readonly cells: readonly ResolvedCell[];
654
+ /** The CSS custom properties of the wrapper, e.g. `--sp-dashboard-columns-md: 2`. */
655
+ readonly style: Readonly<Record<string, string>>;
656
+ }
657
+ interface ResolvedCell {
658
+ /** The layout cell's id; for a child placed in source order, its source index. */
659
+ readonly id: string;
660
+ /** The child this cell holds: its index in `childCells`, so the adapter emits it here (I-11). */
661
+ readonly child: number;
662
+ /** Derived chart id: `${dashboard.id}--${cell.id}` (REQ-209). */
663
+ readonly chartId: string;
664
+ readonly span: ResolvedSpan;
665
+ /** Outer box at `ssrWidth`, 2 decimals (REQ-002, REQ-206). */
666
+ readonly nominal: {
667
+ readonly width: number;
668
+ readonly height: number;
669
+ };
670
+ /** The cell's CSS custom properties, e.g. `--sp-cell-col-lg: 2`. */
671
+ readonly style: Readonly<Record<string, string>>;
672
+ }
673
+ /**
674
+ * What a cell hands its chart (TD §3.3): the derived id, the nominal box and the configuration the
675
+ * dashboard sets. Plain data, so it crosses a React Server Components boundary as a prop.
676
+ */
677
+ interface DashboardCellContext {
678
+ readonly chartId: string;
679
+ readonly box: {
680
+ readonly width: number;
681
+ readonly height: number;
682
+ };
683
+ /** Only the keys the dashboard sets; the chart's own props and then the provider come around it. */
684
+ readonly config: Readonly<ProviderConfig>;
685
+ }
686
+ /** Everything an adapter writes for a dashboard: attributes, texts and cells, all from the core (Art. 2). */
687
+ interface DashboardView {
688
+ readonly model: DashboardModel;
689
+ readonly section: {
690
+ readonly className: string;
691
+ readonly substrate: SubstrateName;
692
+ /** The heading's id, when there is a title. */
693
+ readonly labelledby?: string;
694
+ readonly describedby?: string;
695
+ /** `aria-label`, when only `label` names the dashboard. */
696
+ readonly label?: string;
697
+ readonly style: Readonly<Record<string, string>>;
698
+ };
699
+ readonly heading?: {
700
+ readonly level: 2 | 3 | 4 | 5 | 6;
701
+ readonly id: string;
702
+ readonly text: string;
703
+ };
704
+ readonly description?: {
705
+ readonly id: string;
706
+ readonly text: string;
707
+ };
708
+ /** In reading order. */
709
+ readonly cells: readonly {
710
+ /** Index of the child this cell holds. */
711
+ readonly child: number;
712
+ /** The chart's title id: `aria-labelledby` of the `article` (REQ-214). */
713
+ readonly labelledby: string;
714
+ readonly style: Readonly<Record<string, string>>;
715
+ readonly context: DashboardCellContext;
716
+ }[];
717
+ }
718
+
719
+ export type { DashboardModel as $, ActiveItem as A, BulletChartProps as B, CommonChartProps as C, DashboardProps as D, AreaChartProps as E, FunnelChartProps as F, Geometry as G, HeatmapChartProps as H, InkMode as I, RangeBandChartProps as J, KpiCardProps as K, LineChartProps as L, MeterChartProps as M, StreamChartProps as N, OrbitChartProps as O, ProviderConfig as P, ScatterChartProps as Q, Rect as R, Seed as S, TextLabel as T, BubbleChartProps as U, VolvelleChartProps as V, WaterfallChartProps as W, PerBreakpoint as X, DashboardBreakpoint as Y, DashboardLayout as Z, ResolvedLayout as _, Ground as a, DashboardView as a0, DashboardCellContext as a1, Accessor as a2, DashboardCellLayout as a3, DashboardCellProps as a4, DashboardLink as a5, GroundName as a6, HatchToneSpec as a7, HitArea as a8, InkOptions as a9, LabelKind as aa, LineCurve as ab, ResolvedCell as ac, ResolvedSpan as ad, StrokePart as ae, StrokeRole as af, Tile as ag, TonalRamp as ah, ToneLevel as ai, ToneSpec as aj, WeightToneSpec as ak, Stroke as b, StrokePaint as c, Inker as d, GroundRef as e, SubstrateName as f, Datum as g, PyramidChartProps as h, TreemapChartProps as i, SankeyChartProps as j, ActivityGridProps as k, StepChartProps as l, SparklineRowsProps as m, BarChartProps as n, StackedBarChartProps as o, ComposedChartProps as p, DonutChartProps as q, RadarChartProps as r, PolarBarChartProps as s, CoxcombChartProps as t, RadialArcGroupProps as u, RadialRingsProps as v, GaugeArcProps as w, WindRoseProps as x, ChordRingProps as y, CandlestickChartProps as z };