@arcfusionz/arc-analytic-ui 0.0.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.
Files changed (156) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +13 -0
  2. package/dist/components/AnomalyCard/AnomalyCard.chart.d.ts +64 -0
  3. package/dist/components/AnomalyCard/AnomalyCard.chart.js +341 -0
  4. package/dist/components/AnomalyCard/AnomalyCard.d.ts +169 -0
  5. package/dist/components/AnomalyCard/AnomalyCard.js +1019 -0
  6. package/dist/components/AnomalyCard/AnomalyCard.model.d.ts +508 -0
  7. package/dist/components/AnomalyCard/AnomalyCard.model.js +553 -0
  8. package/dist/components/AnomalyCard/index.d.ts +4 -0
  9. package/dist/components/AnomalyCard/index.js +4 -0
  10. package/dist/components/ChartCard/ChartCard.chart.d.ts +72 -0
  11. package/dist/components/ChartCard/ChartCard.chart.js +1333 -0
  12. package/dist/components/ChartCard/ChartCard.d.ts +206 -0
  13. package/dist/components/ChartCard/ChartCard.js +718 -0
  14. package/dist/components/ChartCard/ChartCard.model.d.ts +452 -0
  15. package/dist/components/ChartCard/ChartCard.model.js +1223 -0
  16. package/dist/components/ChartCard/index.d.ts +4 -0
  17. package/dist/components/ChartCard/index.js +4 -0
  18. package/dist/components/ComparisonCard/ComparisonCard.chart.d.ts +80 -0
  19. package/dist/components/ComparisonCard/ComparisonCard.chart.js +337 -0
  20. package/dist/components/ComparisonCard/ComparisonCard.d.ts +200 -0
  21. package/dist/components/ComparisonCard/ComparisonCard.js +1325 -0
  22. package/dist/components/ComparisonCard/ComparisonCard.model.d.ts +309 -0
  23. package/dist/components/ComparisonCard/ComparisonCard.model.js +263 -0
  24. package/dist/components/ComparisonCard/index.d.ts +4 -0
  25. package/dist/components/ComparisonCard/index.js +4 -0
  26. package/dist/components/ForecastCard/ForecastCard.chart.d.ts +82 -0
  27. package/dist/components/ForecastCard/ForecastCard.chart.js +416 -0
  28. package/dist/components/ForecastCard/ForecastCard.d.ts +148 -0
  29. package/dist/components/ForecastCard/ForecastCard.js +1029 -0
  30. package/dist/components/ForecastCard/ForecastCard.model.d.ts +497 -0
  31. package/dist/components/ForecastCard/ForecastCard.model.js +554 -0
  32. package/dist/components/ForecastCard/index.d.ts +4 -0
  33. package/dist/components/ForecastCard/index.js +4 -0
  34. package/dist/components/HighlightCard/HighlightCard.chart.d.ts +122 -0
  35. package/dist/components/HighlightCard/HighlightCard.chart.js +660 -0
  36. package/dist/components/HighlightCard/HighlightCard.d.ts +202 -0
  37. package/dist/components/HighlightCard/HighlightCard.js +1286 -0
  38. package/dist/components/HighlightCard/HighlightCard.model.d.ts +692 -0
  39. package/dist/components/HighlightCard/HighlightCard.model.js +875 -0
  40. package/dist/components/HighlightCard/index.d.ts +4 -0
  41. package/dist/components/HighlightCard/index.js +4 -0
  42. package/dist/components/InsightCard/InsightCard.chart.d.ts +91 -0
  43. package/dist/components/InsightCard/InsightCard.chart.js +471 -0
  44. package/dist/components/InsightCard/InsightCard.d.ts +161 -0
  45. package/dist/components/InsightCard/InsightCard.js +961 -0
  46. package/dist/components/InsightCard/InsightCard.model.d.ts +405 -0
  47. package/dist/components/InsightCard/InsightCard.model.js +421 -0
  48. package/dist/components/InsightCard/index.d.ts +4 -0
  49. package/dist/components/InsightCard/index.js +4 -0
  50. package/dist/components/MetricCard/MetricCard.chart.d.ts +79 -0
  51. package/dist/components/MetricCard/MetricCard.chart.js +435 -0
  52. package/dist/components/MetricCard/MetricCard.d.ts +227 -0
  53. package/dist/components/MetricCard/MetricCard.js +1293 -0
  54. package/dist/components/MetricCard/MetricCard.model.d.ts +521 -0
  55. package/dist/components/MetricCard/MetricCard.model.js +627 -0
  56. package/dist/components/MetricCard/index.d.ts +4 -0
  57. package/dist/components/MetricCard/index.js +4 -0
  58. package/dist/components/ProfileCard/ProfileCard.chart.d.ts +64 -0
  59. package/dist/components/ProfileCard/ProfileCard.chart.js +427 -0
  60. package/dist/components/ProfileCard/ProfileCard.d.ts +140 -0
  61. package/dist/components/ProfileCard/ProfileCard.js +735 -0
  62. package/dist/components/ProfileCard/ProfileCard.model.d.ts +279 -0
  63. package/dist/components/ProfileCard/ProfileCard.model.js +244 -0
  64. package/dist/components/ProfileCard/index.d.ts +4 -0
  65. package/dist/components/ProfileCard/index.js +4 -0
  66. package/dist/components/ProgressCard/ProgressCard.chart.d.ts +73 -0
  67. package/dist/components/ProgressCard/ProgressCard.chart.js +373 -0
  68. package/dist/components/ProgressCard/ProgressCard.d.ts +137 -0
  69. package/dist/components/ProgressCard/ProgressCard.js +908 -0
  70. package/dist/components/ProgressCard/ProgressCard.model.d.ts +385 -0
  71. package/dist/components/ProgressCard/ProgressCard.model.js +389 -0
  72. package/dist/components/ProgressCard/index.d.ts +4 -0
  73. package/dist/components/ProgressCard/index.js +4 -0
  74. package/dist/components/ReportCard/ReportCard.chart.d.ts +45 -0
  75. package/dist/components/ReportCard/ReportCard.chart.js +231 -0
  76. package/dist/components/ReportCard/ReportCard.d.ts +153 -0
  77. package/dist/components/ReportCard/ReportCard.js +1118 -0
  78. package/dist/components/ReportCard/ReportCard.model.d.ts +392 -0
  79. package/dist/components/ReportCard/ReportCard.model.js +399 -0
  80. package/dist/components/ReportCard/index.d.ts +4 -0
  81. package/dist/components/ReportCard/index.js +4 -0
  82. package/dist/components/SankeyCard/SankeyCard.chart.d.ts +75 -0
  83. package/dist/components/SankeyCard/SankeyCard.chart.js +249 -0
  84. package/dist/components/SankeyCard/SankeyCard.d.ts +185 -0
  85. package/dist/components/SankeyCard/SankeyCard.js +788 -0
  86. package/dist/components/SankeyCard/SankeyCard.model.d.ts +501 -0
  87. package/dist/components/SankeyCard/SankeyCard.model.js +789 -0
  88. package/dist/components/SankeyCard/index.d.ts +4 -0
  89. package/dist/components/SankeyCard/index.js +4 -0
  90. package/dist/components/StatusCard/StatusCard.chart.d.ts +60 -0
  91. package/dist/components/StatusCard/StatusCard.chart.js +188 -0
  92. package/dist/components/StatusCard/StatusCard.d.ts +176 -0
  93. package/dist/components/StatusCard/StatusCard.js +989 -0
  94. package/dist/components/StatusCard/StatusCard.model.d.ts +555 -0
  95. package/dist/components/StatusCard/StatusCard.model.js +776 -0
  96. package/dist/components/StatusCard/index.d.ts +4 -0
  97. package/dist/components/StatusCard/index.js +4 -0
  98. package/dist/components/TableCard/TableCard.chart.d.ts +53 -0
  99. package/dist/components/TableCard/TableCard.chart.js +192 -0
  100. package/dist/components/TableCard/TableCard.d.ts +140 -0
  101. package/dist/components/TableCard/TableCard.js +811 -0
  102. package/dist/components/TableCard/TableCard.model.d.ts +381 -0
  103. package/dist/components/TableCard/TableCard.model.js +475 -0
  104. package/dist/components/TableCard/index.d.ts +4 -0
  105. package/dist/components/TableCard/index.js +4 -0
  106. package/dist/components/TargetCard/TargetCard.chart.d.ts +52 -0
  107. package/dist/components/TargetCard/TargetCard.chart.js +273 -0
  108. package/dist/components/TargetCard/TargetCard.d.ts +143 -0
  109. package/dist/components/TargetCard/TargetCard.js +910 -0
  110. package/dist/components/TargetCard/TargetCard.model.d.ts +468 -0
  111. package/dist/components/TargetCard/TargetCard.model.js +581 -0
  112. package/dist/components/TargetCard/index.d.ts +4 -0
  113. package/dist/components/TargetCard/index.js +4 -0
  114. package/dist/components/TreeCard/TreeCard.chart.d.ts +80 -0
  115. package/dist/components/TreeCard/TreeCard.chart.js +178 -0
  116. package/dist/components/TreeCard/TreeCard.d.ts +182 -0
  117. package/dist/components/TreeCard/TreeCard.js +1187 -0
  118. package/dist/components/TreeCard/TreeCard.model.d.ts +330 -0
  119. package/dist/components/TreeCard/TreeCard.model.js +401 -0
  120. package/dist/components/TreeCard/index.d.ts +4 -0
  121. package/dist/components/TreeCard/index.js +4 -0
  122. package/dist/components/TrendCard/TrendCard.chart.d.ts +75 -0
  123. package/dist/components/TrendCard/TrendCard.chart.js +393 -0
  124. package/dist/components/TrendCard/TrendCard.d.ts +224 -0
  125. package/dist/components/TrendCard/TrendCard.js +1053 -0
  126. package/dist/components/TrendCard/TrendCard.model.d.ts +545 -0
  127. package/dist/components/TrendCard/TrendCard.model.js +623 -0
  128. package/dist/components/TrendCard/index.d.ts +4 -0
  129. package/dist/components/TrendCard/index.js +4 -0
  130. package/dist/index.d.ts +76 -0
  131. package/dist/index.js +57 -0
  132. package/dist/lib/vega/ArcVegaChart.d.ts +24 -0
  133. package/dist/lib/vega/ArcVegaChart.js +42 -0
  134. package/dist/lib/vega/ArcVegaSurface.d.ts +13 -0
  135. package/dist/lib/vega/ArcVegaSurface.js +38 -0
  136. package/dist/lib/vega/axisTicks.js +156 -0
  137. package/dist/lib/vega/config.d.ts +29 -0
  138. package/dist/lib/vega/config.js +113 -0
  139. package/dist/lib/vega/embed.d.ts +29 -0
  140. package/dist/lib/vega/embed.js +29 -0
  141. package/dist/lib/vega/engine.d.ts +10 -0
  142. package/dist/lib/vega/engine.js +6 -0
  143. package/dist/lib/vega/formatters.d.ts +125 -0
  144. package/dist/lib/vega/formatters.js +277 -0
  145. package/dist/lib/vega/index.d.ts +11 -0
  146. package/dist/lib/vega/load.d.ts +13 -0
  147. package/dist/lib/vega/load.js +21 -0
  148. package/dist/lib/vega/time.d.ts +45 -0
  149. package/dist/lib/vega/time.js +105 -0
  150. package/dist/lib/vega/tokens.d.ts +73 -0
  151. package/dist/lib/vega/tokens.js +137 -0
  152. package/dist/lib/vega/tooltip.d.ts +45 -0
  153. package/dist/lib/vega/tooltip.js +124 -0
  154. package/dist/lib/vega/useArcVega.d.ts +43 -0
  155. package/dist/lib/vega/useArcVega.js +121 -0
  156. package/package.json +60 -0
@@ -0,0 +1,452 @@
1
+ import { ArcTimeGranularity } from "../../lib/vega/formatters.js";
2
+ import { ChartTokens } from "../../lib/vega/tokens.js";
3
+ //#region src/components/ChartCard/ChartCard.model.d.ts
4
+ /** What the consumer's transport reports. */
5
+ type ChartCardStatus = "loading" | "ready" | "error";
6
+ /**
7
+ * What the card actually shows, derived from `status`, the rows and
8
+ * `filtered`. Stamped on the root as `data-state`.
9
+ */
10
+ type ChartCardState = "loading" | "refreshing" | "ready" | "empty" | "no-match" | "insufficient" | "error";
11
+ type ChartCardSize = "sm" | "md" | "lg";
12
+ /**
13
+ * The FT Visual Vocabulary category a form belongs to — what comparison it
14
+ * makes visible. Drives the generated description and groups the types in the
15
+ * docs.
16
+ */
17
+ type ChartIntent = "magnitude" | "change-over-time" | "part-to-whole" | "correlation" | "distribution" | "deviation" | "ranking" | "flow" | "spatial";
18
+ /**
19
+ * Every form this card can draw, one per distinct Vega-Lite encoding. Grouped
20
+ * by the mark family that renders it; the FT intent each one serves is in
21
+ * `CHART_TYPES`.
22
+ */
23
+ type ChartType = "bar" | "bar-horizontal" | "bar-grouped" | "bar-stacked" | "bar-normalized" | "bar-diverging" | "bar-range" | "lollipop" | "waterfall" | "line" | "line-points" | "step" | "trail" | "area" | "area-stacked" | "area-normalized" | "streamgraph" | "slope" | "pie" | "donut" | "radial" | "scatter" | "bubble" | "connected-scatter" | "heatmap-binned" | "histogram" | "density" | "boxplot" | "violin" | "strip" | "dot" | "errorbar" | "errorband" | "heatmap" | "punchcard" | "radar";
24
+ /** Vega-Lite's field types, as this card infers or accepts them. */
25
+ type ChartFieldType = "quantitative" | "temporal" | "ordinal" | "nominal";
26
+ /** Aggregation applied to the measure before it is drawn — declared, never silent. */
27
+ type ChartAggregate = "sum" | "mean" | "median" | "min" | "max" | "count" | "distinct";
28
+ /** How colour is used. `auto` picks by series count against the theme's identity budget. */
29
+ type ChartSeriesColor = "auto" | "categorical" | "sequential" | "emphasis";
30
+ /** The resolved colour job, stamped as `data-series-color`. */
31
+ type ChartColorMode = "single" | "categorical" | "sequential" | "emphasis" | "magnitude";
32
+ /** What the legend row shows: one chip per series, a ramp of magnitude buckets, or nothing. */
33
+ type ChartLegendKind = "series" | "ramp" | "none";
34
+ /** Row order for a ranked form. */
35
+ type ChartSort = "none" | "asc" | "desc";
36
+ /** Extent of a `boxplot` whisker (`1.5` or `"min-max"`) or an `errorbar`/`errorband` band. */
37
+ type ChartExtent = number | "min-max" | "ci" | "stderr" | "stdev" | "iqr";
38
+ /** Which fields a form reads, so the card can validate and infer only what matters. */
39
+ interface ChartTypeFields {
40
+ /** `x` is the primary position. `none` for the polar forms, which have no cartesian axes. */
41
+ x: "required" | "optional" | "none";
42
+ /** `y` is the second position. Forms that count (histogram, strip) derive it. */
43
+ y: "required" | "optional" | "none";
44
+ /** `series` is the identity field — it drives colour and the legend. */
45
+ series: "required" | "optional" | "none";
46
+ /** `value` is the measure when it is NOT a position: an angle, a cell's colour, a bubble's area. Falls back to `y`. */
47
+ value: boolean;
48
+ /** `size` is a second measure drawn as area. */
49
+ size: boolean;
50
+ /** `x2` closes a range (a Gantt bar, a duration). */
51
+ x2: boolean;
52
+ }
53
+ interface ChartTypeInfo {
54
+ /** The comparison this form makes visible. */
55
+ intent: ChartIntent;
56
+ /** The Vega-Lite mark family, for the description and the legend swatch. */
57
+ mark: "bar" | "line" | "area" | "arc" | "point" | "rect" | "tick" | "rule" | "boxplot" | "band";
58
+ fields: ChartTypeFields;
59
+ /** Polar forms draw no cartesian axes, so the plot reserves no room for one. */
60
+ polar: boolean;
61
+ /** The plot must be square — a wedge chart in an oval misreads every angle. A radar instead spends extra width on its label gutter. */
62
+ square: boolean;
63
+ /** The measure sits on x, not y — the plot reads as rows. */
64
+ horizontal: boolean;
65
+ /** How several series sit together, when the form stacks at all. */
66
+ stack: false | "zero" | "normalize" | "center";
67
+ /** Colour's job when `seriesColor` is `auto`: identity per series, magnitude through the ramp, or one hue. */
68
+ color: "identity" | "magnitude" | "single";
69
+ /** What the legend row can show for this form. */
70
+ legend: ChartLegendKind;
71
+ /** Vega aggregates or bins the rows itself — the card hands it raw observations. */
72
+ aggregating: boolean;
73
+ /** Fewer rows than this and the form says nothing (a one-point line is not a trend). */
74
+ minRows: number;
75
+ /** A short phrase naming the form in the generated description. */
76
+ name: string;
77
+ }
78
+ /**
79
+ * The registry every other part of the card reads: field-type inference, the
80
+ * legend, the description, the table twin and the spec builder all branch on
81
+ * this rather than on `type` directly, so adding a form is one entry plus one
82
+ * encoding.
83
+ */
84
+ declare const CHART_TYPES: Record<ChartType, ChartTypeInfo>;
85
+ /** Every form, in the docs' own order — the docs table and the type control read this. */
86
+ declare const CHART_TYPE_ORDER: ChartType[];
87
+ /** Every string the card renders or announces, so a product can localise it. Sentences are functions. */
88
+ interface ChartCardLabels {
89
+ noData: string;
90
+ noMatch: string;
91
+ clearFilters: string;
92
+ error: string;
93
+ retry: string;
94
+ /** Shown in place of the plot when there are too few rows for the form to say anything. */
95
+ insufficient: string;
96
+ stale: string;
97
+ /** Accessible name of the legend group. */
98
+ legendGroup: (name: string) => string;
99
+ showSeries: (label: string) => string;
100
+ hideSeries: (label: string) => string;
101
+ /** Label of the row the long tail folds into. */
102
+ other: string;
103
+ /** Accessible name and caption of the table twin. */
104
+ showTable: (name: string) => string;
105
+ hideTable: (name: string) => string;
106
+ tableCaption: (name: string) => string;
107
+ /** Table column headers, used when the consumer names no field titles. */
108
+ tableSeries: string;
109
+ tableValue: string;
110
+ tableShare: string;
111
+ /** Caption under a table that shows only the head of a large dataset. */
112
+ tableTruncated: (shown: number, total: number) => string;
113
+ /** The generated `aria-label` of the plot: "<form> of <measure> by <dimension>". */
114
+ chartOf: (form: string, measure: string, dimension: string) => string;
115
+ /** Card description sentences. */
116
+ describeSeries: (count: number, names: string) => string;
117
+ describeRange: (from: string, to: string) => string;
118
+ describeExtremes: (maxLabel: string, maxValue: string, minLabel: string, minValue: string) => string;
119
+ describeTotal: (total: string) => string;
120
+ describeRamp: (low: string, high: string) => string;
121
+ describeAggregate: (op: string, measure: string) => string;
122
+ describeFolded: (count: number, label: string) => string;
123
+ describeHidden: (count: number) => string;
124
+ describeStale: string;
125
+ describeLoading: (name: string) => string;
126
+ describeEmpty: (name: string) => string;
127
+ describeError: (name: string) => string;
128
+ }
129
+ declare const DEFAULT_CHART_LABELS: ChartCardLabels;
130
+ declare function resolveChartLabels(overrides?: Partial<ChartCardLabels>): ChartCardLabels;
131
+ interface DeriveChartStateInput {
132
+ status: ChartCardStatus;
133
+ /** The form has enough rows to draw. */
134
+ hasChart: boolean;
135
+ /** Any rows arrived at all. */
136
+ hasData: boolean;
137
+ /** The consumer's filter is active, so "nothing" reads as no-match rather than empty. */
138
+ filtered: boolean;
139
+ }
140
+ /**
141
+ * The state machine every card in this package shares, plus `insufficient`:
142
+ * rows arrived but the form needs more of them than it got.
143
+ */
144
+ declare function deriveChartState({ status, hasChart, hasData, filtered }: DeriveChartStateInput): ChartCardState;
145
+ /**
146
+ * Whether the form has enough to say something. Beyond the row floor in the
147
+ * registry, the forms Vega aggregates need several observations INSIDE a
148
+ * group: a box plot of one reading per category has no interquartile range to
149
+ * draw, and Vega then logs an empty-extent warning rather than a chart.
150
+ */
151
+ declare function hasEnoughData(type: ChartType, summary: ChartSummary | null): boolean;
152
+ /**
153
+ * The field names a form needs but did not get. A card missing one of these
154
+ * cannot draw at all, so it shows the insufficient state and says which field
155
+ * is absent rather than rendering an empty frame.
156
+ */
157
+ declare function missingChartFields(type: ChartType, provided: {
158
+ x?: string;
159
+ y?: string;
160
+ series?: string;
161
+ value?: string;
162
+ size?: string;
163
+ x2?: string;
164
+ }): string[];
165
+ /**
166
+ * Infers a field's Vega-Lite type from the first rows that actually carry it:
167
+ * `Date` objects and ISO-8601 strings are temporal, numbers quantitative,
168
+ * everything else nominal. Returns `undefined` for a field no row defines, so
169
+ * a caller can tell "not present" from "nominal".
170
+ */
171
+ declare function inferFieldType(rows: readonly ChartRecord[] | undefined, field: string | undefined): ChartFieldType | undefined;
172
+ /** One record from the consumer's transport. Field names, never a Vega-Lite spec. */
173
+ type ChartRecord = Record<string, unknown>;
174
+ /**
175
+ * A row as the plot reads it. Short keys because they travel into the Vega
176
+ * dataflow on every row: `x`/`y` are the positions, `v` the measure (equal to
177
+ * `y` wherever the measure IS the y position), `s`/`n`/`c`/`i` the series'
178
+ * key, label, paint and index, `z` a size measure, `x2` a range end, and
179
+ * `lo`/`hi` a waterfall step's foot and head.
180
+ */
181
+ interface ChartRow {
182
+ x?: unknown;
183
+ x2?: unknown;
184
+ y?: number | string | null;
185
+ v?: number | null;
186
+ z?: number | null;
187
+ s?: string;
188
+ n?: string;
189
+ c?: string;
190
+ i?: number;
191
+ lo?: number;
192
+ hi?: number;
193
+ /** A waterfall step's sign, so the bar can be painted by polarity without a scale. */
194
+ d?: "up" | "down" | "total";
195
+ /**
196
+ * The row's place in the consumer's order. A connected scatter's path
197
+ * follows it — without an explicit `order` a Vega-Lite line sorts its path
198
+ * by x, which is exactly the sequence a connected scatter exists to break.
199
+ */
200
+ o?: number;
201
+ /**
202
+ * A radar vertex on the unit plane, x right and y down. Vega-Lite 6.4 accepts
203
+ * `theta`/`radius` on `arc` and `text` marks ONLY — every other mark drops
204
+ * them with a warning — so a radar's polygon is drawn on ordinary cartesian
205
+ * scales from coordinates computed here: `sin(angle) * v / max` and
206
+ * `-cos(angle) * v / max`, with the first axis at twelve o'clock.
207
+ */
208
+ px?: number;
209
+ py?: number;
210
+ /** The radar axis this vertex belongs to, as an index — the polygon's path order. */
211
+ ai?: number;
212
+ }
213
+ /** One series as the legend, the table and the description see it. */
214
+ interface ChartSeriesInfo {
215
+ key: string;
216
+ label: string;
217
+ /** The paint every row of this series carries. */
218
+ color: string;
219
+ /** Position in the consumer's order — the colour slot follows this, never the rank. */
220
+ index: number;
221
+ /** Sum of this series' finite measures, for the part-to-whole forms and the fold. */
222
+ total: number;
223
+ /** Finite readings in this series. */
224
+ count: number;
225
+ }
226
+ interface ChartExtremes {
227
+ maxLabel: string;
228
+ maxValue: number;
229
+ minLabel: string;
230
+ minValue: number;
231
+ }
232
+ interface ChartSummary {
233
+ /** Long-form rows for the visible series, in the consumer's order. */
234
+ rows: ChartRow[];
235
+ /** Every series the data contains, hidden ones included — the legend renders them all. */
236
+ series: ChartSeriesInfo[];
237
+ /** Rows with a finite measure. */
238
+ count: number;
239
+ /**
240
+ * A measure field was resolved at all. A range bar given only its two bounds
241
+ * has none, and `count` is then 0 for a chart that is perfectly drawable.
242
+ */
243
+ hasMeasure: boolean;
244
+ /** Distinct x values, in first-seen order. */
245
+ xValues: unknown[];
246
+ xType: ChartFieldType;
247
+ yType: ChartFieldType;
248
+ /** Extent of the measure across the visible rows — the ramp legend's domain. */
249
+ domain: [number, number] | null;
250
+ /** Sum of every visible finite measure, for part-to-whole descriptions. */
251
+ total: number;
252
+ /** The strongest and weakest readings, named. */
253
+ extremes: ChartExtremes | null;
254
+ /** How many series the tail fold swallowed; 0 when nothing was folded. */
255
+ folded: number;
256
+ /** The resolved colour job. */
257
+ colorMode: ChartColorMode;
258
+ /** Inferred period of temporal x values, for the axis and the tooltip. */
259
+ granularity: ArcTimeGranularity;
260
+ }
261
+ /** The key the folded tail takes. Never collides with a consumer key, which is a field value. */
262
+ declare const CHART_OTHER_KEY = "__other__";
263
+ interface NormalizeChartDataOptions {
264
+ type: ChartType;
265
+ /** Field names. `value` falls back to `y`; every one of them may be absent when the form does not read it. */
266
+ x?: string;
267
+ y?: string;
268
+ series?: string;
269
+ value?: string;
270
+ size?: string;
271
+ x2?: string;
272
+ /** Explicit field types; inferred from the rows when omitted. */
273
+ xType?: ChartFieldType;
274
+ yType?: ChartFieldType;
275
+ /** Keys of the series currently shown. `undefined` shows all of them. */
276
+ visible?: readonly string[];
277
+ /** Fold every series past this count (in the consumer's order) into one summed `Other`. Additive measures only. */
278
+ maxSeries?: number;
279
+ otherLabel: string;
280
+ /** Rank the x categories by the measure. Only meaningful for a discrete x. */
281
+ sort?: ChartSort;
282
+ colorMode: ChartColorMode;
283
+ tokens: ChartTokens;
284
+ }
285
+ /**
286
+ * Picks the paint for series `index` under the resolved colour job. Identity
287
+ * slots are assigned by the series' place in the consumer's order — never by
288
+ * rank — so hiding or re-sorting can never repaint the survivors. Past the
289
+ * theme's identity budget the ramp takes over: repeating a slot would make two
290
+ * series look like one, and a ramp at least stays ordered and separable.
291
+ */
292
+ declare function chartSeriesColorAt(mode: ChartColorMode, index: number, total: number, tokens: ChartTokens): string;
293
+ /**
294
+ * Resolves the colour job from the prop, the series count and the theme's own
295
+ * identity budget (`chart-1…N`, three hues on the stock theme). A form whose
296
+ * colour encodes a MEASURE — a heatmap, a punch card — always resolves to
297
+ * `magnitude`, whatever the prop says: colour has one job per chart, and there
298
+ * it is already spoken for.
299
+ */
300
+ declare function resolveChartColorMode(requested: ChartSeriesColor, type: ChartType, seriesCount: number, slots: number): ChartColorMode;
301
+ /** Infers the period of a temporal axis from the closest spacing its values show. */
302
+ declare function inferGranularity(values: readonly unknown[]): ArcTimeGranularity;
303
+ /**
304
+ * Turns the consumer's records into the long-form rows the plot draws: series
305
+ * keys and labels resolved (a series is one distinct value of the `series`
306
+ * field, in first-seen order), the measure coerced to a finite number or
307
+ * `null`, a paint baked into every row, the tail folded, the x categories
308
+ * optionally ranked, and the waterfall's running total computed here rather
309
+ * than in Vega so the table twin and the tooltip can show the same feet and
310
+ * heads the bars stand on.
311
+ *
312
+ * Returns `null` when there is nothing to normalise.
313
+ */
314
+ declare function normalizeChartData(data: readonly ChartRecord[] | undefined, options: NormalizeChartDataOptions): ChartSummary | null;
315
+ /** One vertex of a radar's grid, on the same unit plane the polygons use. */
316
+ interface ChartWebRow {
317
+ /** The axis this vertex belongs to. */
318
+ x: unknown;
319
+ /** That axis' index — the ring polygons' path order. */
320
+ ai: number;
321
+ /** Which ring, as a fraction of the outer one. `0` is the centre. */
322
+ k: number;
323
+ px: number;
324
+ py: number;
325
+ /** Where this axis' label sits — outside the outer ring. */
326
+ lx: number;
327
+ ly: number;
328
+ /** The value the ring stands for, so the outer ring can be named. */
329
+ r: number;
330
+ }
331
+ /** Fractions of the outer ring a radar's web is drawn at. */
332
+ declare const RADAR_RING_FRACTIONS: readonly [0.25, 0.5, 0.75, 1];
333
+ /**
334
+ * The radar's grid: one row per axis per ring, on the same unit plane the
335
+ * polygons are drawn on. Built here rather than in the spec because the spec
336
+ * must stay structural — and because a ring then stands for a real value the
337
+ * description can name, not just a fraction of the frame.
338
+ */
339
+ declare function buildRadarWebRows(summary: ChartSummary | null): ChartWebRow[];
340
+ /** One bucket of a magnitude legend — a swatch and the range it stands for. */
341
+ interface ChartRampBucket {
342
+ color: string;
343
+ /** Inclusive lower bound of the bucket. */
344
+ from: number;
345
+ /** Exclusive upper bound, except for the last bucket. */
346
+ to: number;
347
+ label: string;
348
+ }
349
+ /**
350
+ * Buckets a magnitude ramp for the legend row. Vega owns the continuous scale
351
+ * on the plot; this is the reader's key to it, and — like the reference
352
+ * heatmap's HIGH / MODERATE / LOW row — it is the only way a colour-encoded
353
+ * measure is legible without hovering.
354
+ */
355
+ declare function buildRampBuckets(domain: [number, number] | null, tokens: ChartTokens, format: (value: number) => string, steps?: number): ChartRampBucket[];
356
+ interface ChartTextFormatters {
357
+ /** The measure, in the card's one grammar. */
358
+ formatValue: (value: number | null | undefined) => string;
359
+ /** An x value, at whatever type the axis resolved to. */
360
+ formatX: (value: unknown) => string;
361
+ /** A y value that is a position rather than the measure (a heatmap's row). */
362
+ formatY: (value: unknown) => string;
363
+ /** A share of the total, for the part-to-whole forms. */
364
+ formatShare: (value: number | null | undefined) => string;
365
+ }
366
+ interface CreateChartFormattersOptions {
367
+ /** `arcNumber` grammar for the measure. */
368
+ format?: string;
369
+ locale?: string;
370
+ timeZone?: string;
371
+ /** Takes precedence over `format` everywhere a measure is rendered. */
372
+ formatValue?: (value: number) => string;
373
+ xType: ChartFieldType;
374
+ yType: ChartFieldType;
375
+ granularity: ArcTimeGranularity;
376
+ }
377
+ /**
378
+ * One set of formatters for the axis, the tooltip, the legend, the table and
379
+ * the description, so the same value never rounds two ways (Few's precision
380
+ * pitfall).
381
+ */
382
+ declare function createChartFormatters({ format, locale, timeZone, formatValue, xType, yType, granularity }: CreateChartFormattersOptions): ChartTextFormatters;
383
+ interface BuildChartDescriptionInput {
384
+ name: string;
385
+ type: ChartType;
386
+ state: ChartCardState;
387
+ summary: ChartSummary | null;
388
+ /** Keys of the series currently shown. */
389
+ visibleKeys: readonly string[];
390
+ formatters: ChartTextFormatters;
391
+ labels: ChartCardLabels;
392
+ /** Plain-text name of the measure, for "revenue by channel". */
393
+ measureName: string;
394
+ /** Plain-text name of the primary dimension. */
395
+ dimensionName: string;
396
+ aggregate?: ChartAggregate;
397
+ stale?: boolean;
398
+ }
399
+ /**
400
+ * The card's own accessible description (the figure's `aria-describedby`
401
+ * text): what the chart is, what it covers, where its extremes are, and what
402
+ * has been folded, hidden or aggregated away. Amy Cesal's alt-text formula —
403
+ * chart type, what data, why it is here — generated from the props, because a
404
+ * card whose face carries no text has nothing else for a screen reader to read.
405
+ */
406
+ declare function buildChartDescription({ name, type, state, summary, visibleKeys, formatters, labels, measureName, dimensionName, aggregate, stale }: BuildChartDescriptionInput): string;
407
+ /**
408
+ * The plot's own `aria-label` — set live through `view.description`, so Vega
409
+ * stamps it on the `graphics-document` node. Deliberately shorter than the
410
+ * card description: the figure's description already carries the detail, and
411
+ * repeating it makes a screen reader say everything twice.
412
+ */
413
+ declare function buildChartPlotDescription({ type, measureName, dimensionName, labels }: {
414
+ type: ChartType;
415
+ measureName: string;
416
+ dimensionName: string;
417
+ labels: ChartCardLabels;
418
+ }): string;
419
+ interface ChartTableColumn {
420
+ key: string;
421
+ label: string;
422
+ /** Numeric columns are right-aligned and set in tabular figures. */
423
+ numeric: boolean;
424
+ }
425
+ interface ChartTableModel {
426
+ columns: ChartTableColumn[];
427
+ rows: string[][];
428
+ /** Rows the table shows out of the rows the plot draws — a large dataset is capped. */
429
+ shown: number;
430
+ total: number;
431
+ }
432
+ /** How many rows the table twin renders before it says "first N of M". */
433
+ declare const CHART_TABLE_ROW_CAP = 200;
434
+ /**
435
+ * Every value the plot draws, as text — the keyboard path to the data, since
436
+ * Vega gives marks none. Columns follow the form: a part-to-whole chart gets a
437
+ * share column, a range bar gets both bounds, a bubble gets its size, a
438
+ * waterfall gets the running total the bars stand on.
439
+ */
440
+ declare function buildChartTableModel({ type, summary, formatters, labels, measureName, dimensionName, seriesName, sizeName, cap }: {
441
+ type: ChartType;
442
+ summary: ChartSummary | null;
443
+ formatters: ChartTextFormatters;
444
+ labels: ChartCardLabels;
445
+ measureName: string;
446
+ dimensionName: string;
447
+ seriesName: string;
448
+ sizeName?: string;
449
+ cap?: number;
450
+ }): ChartTableModel | null;
451
+ //#endregion
452
+ export { BuildChartDescriptionInput, CHART_OTHER_KEY, CHART_TABLE_ROW_CAP, CHART_TYPES, CHART_TYPE_ORDER, ChartAggregate, ChartCardLabels, ChartCardSize, ChartCardState, ChartCardStatus, ChartColorMode, ChartExtent, ChartExtremes, ChartFieldType, ChartIntent, ChartLegendKind, ChartRampBucket, ChartRecord, ChartRow, ChartSeriesColor, ChartSeriesInfo, ChartSort, ChartSummary, ChartTableColumn, ChartTableModel, ChartTextFormatters, ChartType, ChartTypeFields, ChartTypeInfo, ChartWebRow, CreateChartFormattersOptions, DEFAULT_CHART_LABELS, DeriveChartStateInput, NormalizeChartDataOptions, RADAR_RING_FRACTIONS, buildChartDescription, buildChartPlotDescription, buildChartTableModel, buildRadarWebRows, buildRampBuckets, chartSeriesColorAt, createChartFormatters, deriveChartState, hasEnoughData, inferFieldType, inferGranularity, missingChartFields, normalizeChartData, resolveChartColorMode, resolveChartLabels };