@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,692 @@
1
+ import { ArcDeltaDirection, ArcDeltaMode, ArcTimeGranularity } from "../../lib/vega/formatters.js";
2
+ //#region src/components/HighlightCard/HighlightCard.model.d.ts
3
+ /** What the consumer's transport reports. */
4
+ type HighlightCardStatus = "loading" | "ready" | "error";
5
+ /**
6
+ * What the panel actually shows, derived from `status`, the series and
7
+ * `filtered`. Stamped on the root as `data-state`.
8
+ */
9
+ type HighlightCardState = "loading" | "refreshing" | "ready" | "empty" | "no-match" | "error";
10
+ /** Which way is good: revenue up, churn down, headcount neither. */
11
+ type HighlightGoodDirection = "up" | "down" | "none";
12
+ /** How a change reads once `goodDirection` is applied. Stamped as `data-polarity`. */
13
+ type HighlightPolarity = "positive" | "negative" | "neutral";
14
+ type HighlightDeltaMode = ArcDeltaMode;
15
+ type HighlightMark = "line" | "area" | "bar";
16
+ type HighlightScale = "auto" | "zero";
17
+ type HighlightXType = "temporal" | "quantitative" | "ordinal";
18
+ type HighlightCardSize = "sm" | "md" | "lg";
19
+ /**
20
+ * How the window's change is placed among its peers. `sigma` reports the mean
21
+ * and standard deviation of the comparable changes and the window's distance
22
+ * from the mean in them; `percentile` reports where the change falls in the
23
+ * sorted peers. Stamped as `data-baseline`.
24
+ *
25
+ * Neither is a significance test — see `HighlightPeerMode`.
26
+ */
27
+ type HighlightBaseline = "sigma" | "percentile";
28
+ /**
29
+ * Which comparable windows the change is placed among. `rolling` takes a
30
+ * window at every offset — the most peers, but overlapping windows share
31
+ * readings, so the spread is narrower than independent sampling would give.
32
+ * `adjacent` tiles non-overlapping windows aligned to the highlight's own
33
+ * start, which is the statistically honest set and a much smaller one.
34
+ *
35
+ * Either way the card reports a COMPARISON, never a significance test: it says
36
+ * "the 2nd largest of 48 windows this length", not "p < 0.05". Stamped as
37
+ * `data-peers`.
38
+ */
39
+ type HighlightPeerMode = "rolling" | "adjacent";
40
+ /**
41
+ * The verdict, from where the change falls among its peers. Drives the badge
42
+ * beside the headline and is stamped as `data-severity`. A heuristic on the
43
+ * spread of comparable windows — thresholds are documented on
44
+ * `severityThresholds` and overridable.
45
+ */
46
+ type HighlightSeverity = "typical" | "notable" | "unusual" | "extreme";
47
+ /** Which analysis sections the panel draws, in order. Stamped as `data-sections`. */
48
+ type HighlightSection = "context" | "peers" | "drivers";
49
+ /**
50
+ * One reading of the metric. Cloudscape's `{ x, y }` point contract: `x` is a
51
+ * `Date`, an ISO string, a number or a period label; `y` is the value, or
52
+ * `null` for a period with no reading (drawn as a gap, never as zero).
53
+ */
54
+ interface HighlightPoint {
55
+ x: Date | string | number;
56
+ y: number | null;
57
+ }
58
+ /** A reading after normalisation: temporal `x` is epoch milliseconds, ordinal `x` a string. */
59
+ interface HighlightRow {
60
+ x: number | string;
61
+ y: number | null;
62
+ }
63
+ interface HighlightSummary {
64
+ rows: HighlightRow[];
65
+ xType: HighlightXType;
66
+ /** Readings with a finite `y`. */
67
+ count: number;
68
+ first: HighlightRow | null;
69
+ last: HighlightRow | null;
70
+ /** The last reading with a finite `y`. */
71
+ latest: HighlightRow | null;
72
+ min: number | null;
73
+ max: number | null;
74
+ granularity: ArcTimeGranularity;
75
+ }
76
+ /** A finite reading the window snapped to, with its index in the normalised rows. */
77
+ interface HighlightReading {
78
+ x: number | string;
79
+ y: number;
80
+ index: number;
81
+ }
82
+ /** A change in every form the panel speaks it. */
83
+ interface HighlightDelta {
84
+ direction: ArcDeltaDirection;
85
+ polarity: HighlightPolarity;
86
+ /** Signed, formatted change: `+12.4%`, `-0.3 pp`, `+฿124K`. */
87
+ text: string;
88
+ renderedMode: ArcDeltaMode;
89
+ /** The same change in the other form, or `null` when it has none (a zero baseline has no percent). */
90
+ secondaryText: string | null;
91
+ }
92
+ /**
93
+ * The window the panel is about, in the series' own `x` type: `Date`s or ISO
94
+ * strings for a temporal series, numbers for a quantitative one, the category
95
+ * labels for an ordinal one. Each bound snaps inward to the nearest finite
96
+ * reading, so a window may begin or end on a gap.
97
+ */
98
+ interface HighlightWindow {
99
+ start: Date | string | number;
100
+ end: Date | string | number;
101
+ /**
102
+ * Names the window — `Steepest 2-week drop`, `Outage`. Shown beside the
103
+ * period on the headline and used as the window's name in every generated
104
+ * sentence; the period itself always travels with it.
105
+ */
106
+ label?: string;
107
+ }
108
+ /** One step between consecutive readings inside the window. */
109
+ interface HighlightLeg {
110
+ from: HighlightReading;
111
+ to: HighlightReading;
112
+ /** `to.y - from.y`, in the value's units. */
113
+ change: number;
114
+ /** The step in the panel's `deltaMode`. */
115
+ changeText: string;
116
+ rangeText: string;
117
+ direction: ArcDeltaDirection;
118
+ polarity: HighlightPolarity;
119
+ }
120
+ /** The resolved window: its bounds, its change, and its anatomy. */
121
+ interface HighlightWindowInfo {
122
+ start: HighlightReading;
123
+ end: HighlightReading;
124
+ label?: string;
125
+ /** The period, formatted with the panel's locale — `Aug 17 – 24, 2026`, `Q2 – Q4`. */
126
+ rangeText: string;
127
+ /** The change from start to end in the panel's `deltaMode` — the headline. */
128
+ delta: HighlightDelta;
129
+ /** `end.y - start.y`, in the value's units — the total the drivers must reconcile with. */
130
+ absolute: number;
131
+ absoluteText: string;
132
+ /** The relative change, or `MISSING_VALUE` when the start reading is zero. */
133
+ percentText: string;
134
+ /** Every finite reading inside the window, in axis order. */
135
+ readings: HighlightReading[];
136
+ /** Steps between consecutive readings — the window's path. */
137
+ legs: HighlightLeg[];
138
+ /** How many rows the window spans, gaps included — the peer windows' length. */
139
+ length: number;
140
+ /** The highest and lowest readings inside the window. `null` when the window holds one reading. */
141
+ peak: HighlightReading | null;
142
+ trough: HighlightReading | null;
143
+ /** The single largest step inside the window, by absolute size. */
144
+ steepest: HighlightLeg | null;
145
+ }
146
+ /** One comparable window's change, as the strip plot draws it and the table lists it. */
147
+ interface HighlightPeer {
148
+ start: number | string;
149
+ end: number | string;
150
+ /** The change in the compared mode — a ratio for `percent`, the value's units for `absolute`. */
151
+ change: number;
152
+ changeText: string;
153
+ rangeText: string;
154
+ /** The highlight's own window, which the strip marks and the table flags. */
155
+ isHighlight: boolean;
156
+ /** `positive`/`negative` once `goodDirection` resolves it, for the mark colour. */
157
+ polarity: HighlightPolarity;
158
+ }
159
+ /**
160
+ * Where the window's change falls among the changes of every comparable
161
+ * window in the same series — the reading that establishes the highlight.
162
+ */
163
+ interface HighlightPeerStats {
164
+ mode: HighlightPeerMode;
165
+ baseline: HighlightBaseline;
166
+ /** Every compared window including the highlight's own, in axis order. */
167
+ peers: HighlightPeer[];
168
+ /** Comparable windows, the highlight's own excluded. */
169
+ count: number;
170
+ /** `count + 1` — what `rank` is out of. */
171
+ total: number;
172
+ /** Windows dropped because a relative change needs a non-zero start reading, or a bound fell on a gap. */
173
+ skipped: number;
174
+ /** The window's length in rows, so the text can say "windows this length". */
175
+ length: number;
176
+ /** The highlight's own change, in the compared mode. */
177
+ change: number;
178
+ changeText: string;
179
+ /** Mean and standard deviation of the comparable changes (population, the highlight excluded). */
180
+ mean: number;
181
+ sd: number;
182
+ meanText: string;
183
+ sdText: string;
184
+ /** Distance from the mean in standard deviations. `null` when every peer changed by the same amount. */
185
+ z: number | null;
186
+ zText: string;
187
+ /** Where the change sits in the sorted peers, 0–100. */
188
+ percentile: number;
189
+ percentileText: string;
190
+ /** 1 is the largest absolute change of `total` windows. */
191
+ rank: number;
192
+ rankText: string;
193
+ /** The typical range: mean ± 1 sd, or the 10th–90th percentile. */
194
+ typicalLow: number;
195
+ typicalHigh: number;
196
+ typicalText: string;
197
+ /** Whether the change sits inside the typical range. */
198
+ typical: boolean;
199
+ severity: HighlightSeverity;
200
+ }
201
+ /** Thresholds turning a placement into a verdict. Compared against `|z|` for the `sigma` baseline, and against the distance from the median percentile (0–50) for `percentile`. */
202
+ interface HighlightSeverityThresholds {
203
+ /** Above this the verdict is `notable`. Defaults: 1 (sigma), 40 (percentile — outside p10–p90). */
204
+ notable: number;
205
+ /** Above this the verdict is `unusual`. Defaults: 2 (sigma), 45 (outside p5–p95). */
206
+ unusual: number;
207
+ /** Above this the verdict is `extreme`. Defaults: 3 (sigma), 49 (outside p1–p99). */
208
+ extreme: number;
209
+ }
210
+ declare const DEFAULT_SIGMA_THRESHOLDS: HighlightSeverityThresholds;
211
+ declare const DEFAULT_PERCENTILE_THRESHOLDS: HighlightSeverityThresholds;
212
+ /**
213
+ * One contributor to the window's change. Pass `contribution` (the signed
214
+ * amount this driver added to the total, in the value's units) or `from` and
215
+ * `to` (its readings at the window's bounds, from which the contribution is
216
+ * the difference). Contributions are amounts, never percentages — the panel
217
+ * derives each share against the total itself.
218
+ */
219
+ interface HighlightDriver {
220
+ /** Stable identity for selection and for the colour, if the panel ever assigns one. Defaults to `label`. */
221
+ key?: string;
222
+ label: string;
223
+ /** The signed amount this driver added to the window's change. Takes precedence over `from`/`to`. */
224
+ contribution?: number;
225
+ /** This driver's reading at the window's start and end — the contribution is `to - from`. */
226
+ from?: number | null;
227
+ to?: number | null;
228
+ }
229
+ /** A driver after normalisation, in every form the bars, the table and the sentences need. */
230
+ interface HighlightDriverInfo {
231
+ key: string;
232
+ label: string;
233
+ contribution: number;
234
+ contributionText: string;
235
+ /** `contribution / total`, or `null` when the total is zero (no share is definable). */
236
+ share: number | null;
237
+ shareText: string;
238
+ from: number | null;
239
+ to: number | null;
240
+ fromText: string;
241
+ toText: string;
242
+ direction: ArcDeltaDirection;
243
+ polarity: HighlightPolarity;
244
+ /** `driver` is a passed contributor, `other` the fold of the tail, `residual` the part no driver explains. */
245
+ role: "driver" | "other" | "residual";
246
+ }
247
+ /** The decomposition of the window's change, reconciled against it. */
248
+ interface HighlightDriversInfo {
249
+ /** The bars, largest absolute contribution first, with `other` and `residual` last. */
250
+ rows: HighlightDriverInfo[];
251
+ /** The window's own change in the value's units — what the parts must sum to. */
252
+ total: number;
253
+ totalText: string;
254
+ /** The sum of the passed contributions. */
255
+ explained: number;
256
+ explainedText: string;
257
+ /** `total - explained` — rendered as its own row once it clears `tolerance`. */
258
+ residual: number;
259
+ residualText: string;
260
+ /** Whether the parts reconcile with the total inside `tolerance`. Stamped as `data-reconciles`. */
261
+ reconciles: boolean;
262
+ /** How many drivers were folded into `Other`. */
263
+ folded: number;
264
+ /** The largest contributor in the total's own direction, and the largest one against it — the insight's subjects. */
265
+ top: HighlightDriverInfo | null;
266
+ counter: HighlightDriverInfo | null;
267
+ }
268
+ /** A piece of a generated insight sentence: plain text, or a value the panel sets in bold. */
269
+ type HighlightInsightSegment = string | {
270
+ value: string;
271
+ };
272
+ /** Every string the panel renders or announces, so a product can localise it. Sentences are functions. */
273
+ interface HighlightCardLabels {
274
+ severityNames: Record<HighlightSeverity, string>;
275
+ increase: string;
276
+ decrease: string;
277
+ unchanged: string;
278
+ percentagePoints: string;
279
+ contextTitle: string;
280
+ peersTitle: string;
281
+ driversTitle: string;
282
+ noData: string;
283
+ noMatch: string;
284
+ clearFilters: string;
285
+ error: string;
286
+ retry: string;
287
+ unresolved: string;
288
+ insufficientPeers: string;
289
+ stale: string;
290
+ asOf: string;
291
+ tablePeriod: string;
292
+ tableValue: string;
293
+ tableStep: string;
294
+ tableChange: string;
295
+ tableShare: string;
296
+ tableDriver: string;
297
+ tableWindow: string;
298
+ windowStart: string;
299
+ windowEnd: string;
300
+ windowChange: string;
301
+ windowChangePercent: string;
302
+ windowPeriod: string;
303
+ windowPeak: string;
304
+ windowTrough: string;
305
+ windowSteepest: string;
306
+ highlighted: string;
307
+ peerMean: string;
308
+ peerSd: string;
309
+ peerTypical: string;
310
+ peerRank: string;
311
+ peerPercentile: string;
312
+ peerZ: string;
313
+ peerThis: string;
314
+ peerCount: string;
315
+ driverTotal: string;
316
+ driverExplained: string;
317
+ driverResidual: string;
318
+ driverOther: string;
319
+ driverContribution: string;
320
+ insightMark: string;
321
+ about: (name: string) => string;
322
+ loading: (name: string) => string;
323
+ showTable: (name: string) => string;
324
+ hideTable: (name: string) => string;
325
+ /** Accessible name of the headline stack, which opens the window's details. */
326
+ windowDetails: (name: string) => string;
327
+ /** Accessible name of the drivers list, and of one driver's drill button. */
328
+ driversGroup: (name: string) => string;
329
+ selectDriver: (label: string) => string;
330
+ /**
331
+ * Spoken once through the polite status line when the reader drills into a
332
+ * driver. The button's own `aria-pressed` already carries its state, so this
333
+ * adds the figures beside it — what a sighted reader takes from the row at a
334
+ * glance. `share` is `null` when the window did not move, which leaves no
335
+ * total to be a share of.
336
+ */
337
+ driverSelected: (input: {
338
+ label: string;
339
+ contribution: string;
340
+ share: string | null;
341
+ }) => string;
342
+ tableCaption: (name: string) => string;
343
+ peersCaption: (input: {
344
+ count: number;
345
+ readings: number;
346
+ mode: HighlightPeerMode;
347
+ }) => string;
348
+ driversCaption: (input: {
349
+ total: string;
350
+ explained: string;
351
+ residual: string;
352
+ reconciles: boolean;
353
+ }) => string;
354
+ foldedCaption: (folded: number, label: string) => string;
355
+ /** The period line under the headline: the window's name and its period, or the period alone. */
356
+ windowLine: (input: {
357
+ range: string;
358
+ label?: string;
359
+ }) => string;
360
+ /** Compact label/value rows explaining the headline — the window's readings, its change in both forms, and its anatomy. */
361
+ windowExplanation: (input: {
362
+ periodText: string;
363
+ startText: string;
364
+ endText: string;
365
+ changeText: string;
366
+ secondaryText: string | null;
367
+ renderedMode: ArcDeltaMode;
368
+ direction: ArcDeltaDirection;
369
+ peakText: string | null;
370
+ troughText: string | null;
371
+ steepestText: string | null;
372
+ }) => readonly (readonly [label: string, value: string])[];
373
+ /** Compact label/value rows explaining the peer placement. */
374
+ peerExplanation: (stats: HighlightPeerStats) => readonly (readonly [label: string, value: string])[];
375
+ /** The sentence stating the verdict, rendered as visible text under the strip. */
376
+ peerVerdict: (input: {
377
+ severity: HighlightSeverity;
378
+ rank: string;
379
+ /** Windows the rank is out of — the peers plus this one. */
380
+ total: number;
381
+ readings: number;
382
+ typical: string;
383
+ change: string;
384
+ inside: boolean;
385
+ }) => string;
386
+ /** Accessible description of the context plot. */
387
+ contextDescription: (input: {
388
+ mark: string;
389
+ name: string;
390
+ count: number;
391
+ first: string;
392
+ last: string;
393
+ min: string;
394
+ max: string;
395
+ range: string;
396
+ label?: string;
397
+ direction: ArcDeltaDirection;
398
+ change: string;
399
+ }) => string;
400
+ /** Accessible description of the peer strip. */
401
+ peersDescription: (input: {
402
+ name: string;
403
+ count: number;
404
+ readings: number;
405
+ mode: HighlightPeerMode;
406
+ change: string;
407
+ rank: string;
408
+ typical: string;
409
+ /** The verdict as its localised word, already lowercased for mid-sentence use. */
410
+ severity: string;
411
+ }) => string;
412
+ /** Accessible description of the drivers bars. */
413
+ driversDescription: (input: {
414
+ name: string;
415
+ count: number;
416
+ total: string;
417
+ top: string | null;
418
+ topContribution: string | null;
419
+ counter: string | null;
420
+ counterContribution: string | null;
421
+ residual: string | null;
422
+ }) => string;
423
+ /** The whole panel's text equivalent. */
424
+ cardDescription: (input: {
425
+ name: string;
426
+ state: HighlightCardState;
427
+ range: string;
428
+ label?: string;
429
+ direction: ArcDeltaDirection;
430
+ change: string;
431
+ secondary: string | null;
432
+ startText: string;
433
+ endText: string;
434
+ severity: string | null;
435
+ rank: string | null;
436
+ count: number | null;
437
+ driverCount: number;
438
+ topDriver: string | null;
439
+ topContribution: string | null;
440
+ asOf: string | null;
441
+ }) => string;
442
+ /**
443
+ * The generated insight, as segments so the values render in bold while the
444
+ * words stay plain: what moved, how it places among its peers, and which
445
+ * driver carried it.
446
+ */
447
+ insight: (input: {
448
+ name: string;
449
+ direction: ArcDeltaDirection;
450
+ change: string;
451
+ secondary: string | null;
452
+ range: string;
453
+ label?: string;
454
+ severity: HighlightSeverity;
455
+ rank: string | null;
456
+ count: number | null;
457
+ topDriver: string | null;
458
+ topContribution: string | null;
459
+ topShare: string | null;
460
+ }) => HighlightInsightSegment[];
461
+ markNames: Record<HighlightMark, string>;
462
+ peerModeNames: Record<HighlightPeerMode, string>;
463
+ }
464
+ declare const DEFAULT_HIGHLIGHT_LABELS: HighlightCardLabels;
465
+ declare function resolveHighlightLabels(overrides?: Partial<HighlightCardLabels>): HighlightCardLabels;
466
+ interface DeriveHighlightStateInput {
467
+ status: HighlightCardStatus;
468
+ /** The series holds at least one finite reading. */
469
+ hasData: boolean;
470
+ /** The consumer's filter is active, so nothing to show is a no-match rather than an empty. */
471
+ filtered: boolean;
472
+ }
473
+ /**
474
+ * The state the panel renders, from the transport's status and the data.
475
+ * `loading` with data already present is a refresh: the previous render stays
476
+ * under the veil rather than collapsing to a skeleton.
477
+ */
478
+ declare function deriveHighlightState({ status, hasData, filtered }: DeriveHighlightStateInput): HighlightCardState;
479
+ /**
480
+ * Normalises `series` for Vega and the tables: temporal `x` becomes epoch
481
+ * milliseconds (a bare number is quantitative — pass a `Date` or an ISO string
482
+ * for time), invalid dates are dropped, `null` readings stay as gaps, and the
483
+ * range is summarised for the text equivalents. Rows are sorted along the axis
484
+ * for a temporal or quantitative series, so a window can be snapped and peer
485
+ * windows can be walked; an ordinal series keeps the consumer's order, which
486
+ * IS its axis. Returns `null` without a series at all.
487
+ */
488
+ declare function normalizeHighlightSeries(points: readonly HighlightPoint[] | undefined, granularity?: ArcTimeGranularity): HighlightSummary | null;
489
+ interface HighlightTextFormatters {
490
+ /** A reading in the panel's value format. */
491
+ formatY: (value: number | null | undefined) => string;
492
+ formatX: (x: number | string) => string;
493
+ /** A period between two `x` values — a collapsed date range for a temporal axis. */
494
+ formatXRange: (start: number | string, end: number | string) => string;
495
+ /** A signed change in the value's own units — percentage points for a percent format. */
496
+ formatAmountChange: (delta: number) => string;
497
+ /** A signed change in the compared mode: a ratio as a percent, or the amount. */
498
+ formatPeerChange: (change: number) => string;
499
+ /** A share of the total, as a whole percentage. */
500
+ formatShare: (share: number | null) => string;
501
+ }
502
+ /** The formatters every text surface shares — headline, badges, strip, bars, tables, tooltips, descriptions. */
503
+ declare function createHighlightFormatters({ format, locale, timeZone, formatValue, xType, granularity, deltaMode, percentagePoints }: {
504
+ format: string;
505
+ locale?: string;
506
+ timeZone?: string;
507
+ formatValue?: (value: number) => string;
508
+ xType: HighlightXType;
509
+ granularity: ArcTimeGranularity;
510
+ deltaMode: HighlightDeltaMode;
511
+ percentagePoints: string;
512
+ }): HighlightTextFormatters;
513
+ interface DeriveHighlightDeltaOptions {
514
+ deltaMode: HighlightDeltaMode;
515
+ goodDirection: HighlightGoodDirection;
516
+ format: string;
517
+ locale?: string;
518
+ percentagePoints: string;
519
+ }
520
+ /** The change between two readings, with polarity resolved through `goodDirection`. */
521
+ declare function deriveHighlightDelta(value: number | null | undefined, previousValue: number | null | undefined, { deltaMode, goodDirection, format, locale, percentagePoints }: DeriveHighlightDeltaOptions): HighlightDelta | null;
522
+ interface ResolveHighlightWindowOptions extends DeriveHighlightDeltaOptions {
523
+ formatters: HighlightTextFormatters;
524
+ }
525
+ /**
526
+ * Snaps the window onto the series and measures it. Each bound moves inward to
527
+ * the nearest finite reading (a temporal or quantitative bound need not hit a
528
+ * reading exactly; an ordinal bound is a category label), the bounds may come
529
+ * in either order, and the result is `null` when the window does not hold two
530
+ * distinct finite readings — the panel then says so and stamps
531
+ * `data-window="unresolved"` rather than inventing a change.
532
+ *
533
+ * Beyond the change it records the window's ANATOMY, which is what makes this
534
+ * a highlight-analysis panel rather than a tile: every reading inside it, the
535
+ * step between each consecutive pair, the peak, the trough and the steepest
536
+ * single step.
537
+ */
538
+ declare function resolveHighlightWindow(summary: HighlightSummary | null | undefined, window: HighlightWindow | undefined, { deltaMode, goodDirection, format, locale, percentagePoints, formatters }: ResolveHighlightWindowOptions): HighlightWindowInfo | null;
539
+ interface DerivePeersOptions extends DeriveHighlightDeltaOptions {
540
+ mode: HighlightPeerMode;
541
+ baseline: HighlightBaseline;
542
+ formatters: HighlightTextFormatters;
543
+ /** Fewer comparable windows than this and the section is not drawn — a spread of two is not a spread. Default 4. */
544
+ minPeers?: number;
545
+ thresholds?: HighlightSeverityThresholds;
546
+ }
547
+ /**
548
+ * Places the window's change among the changes of every comparable window in
549
+ * the same series — the reading that ESTABLISHES the highlight, and the half
550
+ * MetricCard's tile cannot show. Windows are the same length as the
551
+ * highlight's (in rows), taken at every offset (`rolling`) or tiled
552
+ * non-overlapping from the highlight's own start (`adjacent`), and both bounds
553
+ * must carry a finite reading; a window that cannot produce a change in the
554
+ * compared mode is skipped and counted in `skipped`.
555
+ *
556
+ * Returns `null` when fewer than `minPeers` comparable windows exist — the
557
+ * panel then omits the section and says why, rather than calling one window
558
+ * out of three "extreme".
559
+ *
560
+ * The spread is a COMPARISON, not a significance test: `rolling` windows
561
+ * overlap, so their changes are autocorrelated and the standard deviation is
562
+ * narrower than independent sampling would give. `adjacent` is the honest set.
563
+ * The generated text says "the 2nd largest of 48 comparable periods"; nothing
564
+ * here claims a p-value.
565
+ */
566
+ declare function derivePeers(summary: HighlightSummary | null | undefined, info: HighlightWindowInfo | null | undefined, { mode, baseline, deltaMode, goodDirection, format, locale, percentagePoints, formatters, minPeers, thresholds }: DerivePeersOptions): HighlightPeerStats | null;
567
+ interface NormalizeDriversOptions {
568
+ goodDirection: HighlightGoodDirection;
569
+ formatters: HighlightTextFormatters;
570
+ /** Fold every driver past this count (by absolute contribution) into one `Other` row. */
571
+ limit?: number;
572
+ otherLabel: string;
573
+ residualLabel: string;
574
+ /**
575
+ * How far the contributions may miss the window's own change and still
576
+ * reconcile, as a fraction of that change. Default 0.005 (half a percent).
577
+ */
578
+ tolerance?: number;
579
+ }
580
+ /**
581
+ * Decomposes the window's change into its contributors — the half that
582
+ * EXPLAINS the highlight. Each driver's contribution is the amount it added to
583
+ * the total, either passed directly or derived from its own `from`/`to`
584
+ * readings; rows sort by absolute contribution so the biggest mover reads
585
+ * first, the tail folds into `Other`, and whatever the parts do not account
586
+ * for becomes an explicit `Unexplained` row.
587
+ *
588
+ * Totals reconcile with parts or the panel says they do not: a decomposition
589
+ * that silently misses a third of the move is worse than none.
590
+ */
591
+ declare function normalizeDrivers(drivers: readonly HighlightDriver[] | undefined, info: HighlightWindowInfo | null | undefined, { goodDirection, formatters, limit, otherLabel, residualLabel, tolerance }: NormalizeDriversOptions): HighlightDriversInfo | null;
592
+ /** A context-plot row: `hl` marks the window, `tone` carries its polarity for the mark colour. */
593
+ interface HighlightContextRow extends HighlightRow {
594
+ hl: boolean;
595
+ tone: HighlightPolarity | null;
596
+ }
597
+ /** The readings outside the window, split so the context line stops at the window's edges. */
598
+ interface HighlightOutsideRow extends HighlightRow {
599
+ seg: "before" | "after";
600
+ }
601
+ interface HighlightEndpointRow {
602
+ x: number | string;
603
+ y: number;
604
+ role: "start" | "end";
605
+ tone: HighlightPolarity;
606
+ }
607
+ /** One row spanning the window — the band behind the line and the source of the axis anchors. */
608
+ interface HighlightBandRow {
609
+ start: number | string;
610
+ end: number | string;
611
+ tone: HighlightPolarity;
612
+ }
613
+ /** Every named dataset the three plots read. */
614
+ interface HighlightContextDatasets {
615
+ table: HighlightContextRow[];
616
+ outside: HighlightOutsideRow[];
617
+ inside: HighlightContextRow[];
618
+ endpoints: HighlightEndpointRow[];
619
+ band: HighlightBandRow[];
620
+ }
621
+ /**
622
+ * Splits the series around the window for the context plot: every row carries
623
+ * `hl` and the window's `tone`, the readings outside it are split into a
624
+ * `before` and an `after` run so the gray path never runs under the coloured
625
+ * one, and the window's extent rides one band row.
626
+ */
627
+ declare function buildHighlightContextDatasets(summary: HighlightSummary, info: HighlightWindowInfo): HighlightContextDatasets;
628
+ /** One row `{ low, high }` — the typical-range band behind the strip. */
629
+ declare function buildTypicalRows(stats: HighlightPeerStats): {
630
+ low: number;
631
+ high: number;
632
+ }[];
633
+ /** The driver bars, in row order, with the fields the spec encodes. */
634
+ declare function buildDriverRows(info: HighlightDriversInfo): {
635
+ key: string;
636
+ label: string;
637
+ value: number;
638
+ share: number | null;
639
+ tone: HighlightPolarity;
640
+ role: string;
641
+ }[];
642
+ declare function highlightSegmentsToText(segments: readonly HighlightInsightSegment[]): string;
643
+ interface BuildHighlightAnalysisInsightInput {
644
+ name: string;
645
+ info: HighlightWindowInfo;
646
+ peers: HighlightPeerStats | null;
647
+ drivers: HighlightDriversInfo | null;
648
+ labels: HighlightCardLabels;
649
+ }
650
+ /** The takeaway: what moved, how it places among its peers, which driver carried it. */
651
+ declare function buildHighlightAnalysisInsight({ name, info, peers, drivers, labels }: BuildHighlightAnalysisInsightInput): HighlightInsightSegment[];
652
+ interface BuildHighlightDescriptionInput {
653
+ name: string;
654
+ state: HighlightCardState;
655
+ info: HighlightWindowInfo | null;
656
+ peers: HighlightPeerStats | null;
657
+ drivers: HighlightDriversInfo | null;
658
+ formatters: HighlightTextFormatters;
659
+ asOfText?: string;
660
+ labels: HighlightCardLabels;
661
+ }
662
+ /**
663
+ * The panel's text equivalent (Amy Cesal's alt-text formula: what it is, what
664
+ * it shows, why it is here, when it was true) — the figure's accessible
665
+ * description, and the summary a screen reader gets before the parts.
666
+ */
667
+ declare function buildHighlightDescription({ name, state, info, peers, drivers, formatters, asOfText, labels }: BuildHighlightDescriptionInput): string;
668
+ /** Accessible description of the context plot — set live through `view.description`. */
669
+ declare function buildContextDescription({ name, mark, summary, info, formatters, labels }: {
670
+ name: string;
671
+ mark: HighlightMark;
672
+ summary: HighlightSummary;
673
+ info: HighlightWindowInfo;
674
+ formatters: HighlightTextFormatters;
675
+ labels: HighlightCardLabels;
676
+ }): string;
677
+ /** Accessible description of the peer strip. */
678
+ declare function buildPeersDescription({ name, stats, labels }: {
679
+ name: string;
680
+ stats: HighlightPeerStats;
681
+ labels: HighlightCardLabels;
682
+ }): string;
683
+ /** Accessible description of the drivers bars. */
684
+ declare function buildDriversDescription({ name, info, labels }: {
685
+ name: string;
686
+ info: HighlightDriversInfo;
687
+ labels: HighlightCardLabels;
688
+ }): string;
689
+ /** The verdict sentence under the strip — visible text, never colour alone. */
690
+ declare function buildPeerVerdict(stats: HighlightPeerStats, labels: HighlightCardLabels): string;
691
+ //#endregion
692
+ export { BuildHighlightAnalysisInsightInput, BuildHighlightDescriptionInput, DEFAULT_HIGHLIGHT_LABELS, DEFAULT_PERCENTILE_THRESHOLDS, DEFAULT_SIGMA_THRESHOLDS, DeriveHighlightDeltaOptions, DeriveHighlightStateInput, DerivePeersOptions, HighlightBandRow, HighlightBaseline, HighlightCardLabels, HighlightCardSize, HighlightCardState, HighlightCardStatus, HighlightContextDatasets, HighlightContextRow, HighlightDelta, HighlightDeltaMode, HighlightDriver, HighlightDriverInfo, HighlightDriversInfo, HighlightEndpointRow, HighlightGoodDirection, HighlightInsightSegment, HighlightLeg, HighlightMark, HighlightOutsideRow, HighlightPeer, HighlightPeerMode, HighlightPeerStats, HighlightPoint, HighlightPolarity, HighlightReading, HighlightRow, HighlightScale, HighlightSection, HighlightSeverity, HighlightSeverityThresholds, HighlightSummary, HighlightTextFormatters, HighlightWindow, HighlightWindowInfo, HighlightXType, NormalizeDriversOptions, ResolveHighlightWindowOptions, buildContextDescription, buildDriverRows, buildDriversDescription, buildHighlightAnalysisInsight, buildHighlightContextDatasets, buildHighlightDescription, buildPeerVerdict, buildPeersDescription, buildTypicalRows, createHighlightFormatters, deriveHighlightDelta, deriveHighlightState, derivePeers, highlightSegmentsToText, normalizeDrivers, normalizeHighlightSeries, resolveHighlightLabels, resolveHighlightWindow };