@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,405 @@
1
+ import { ArcDeltaDirection, ArcDeltaMode, ArcTimeGranularity } from "../../lib/vega/formatters.js";
2
+ import { ChartTokens } from "../../lib/vega/tokens.js";
3
+ //#region src/components/InsightCard/InsightCard.model.d.ts
4
+ /** What the consumer's transport reports. */
5
+ type InsightCardStatus = "loading" | "ready" | "error";
6
+ /**
7
+ * What the card actually shows, derived from `status`, the finding and
8
+ * `filtered`. Stamped on the root as `data-state`. `insufficient` is a
9
+ * finding with too little history to plot: the claim, the evidence row and
10
+ * the range strip all still read, so the card renders — the time plot is
11
+ * what degrades, and it says so rather than drawing a trend from one point.
12
+ */
13
+ type InsightCardState = "loading" | "refreshing" | "ready" | "insufficient" | "empty" | "no-match" | "error";
14
+ /** Which way is good for this measure: revenue up, churn down, headcount neither. */
15
+ type InsightGoodDirection = "up" | "down" | "none";
16
+ /** How the deviation reads once `goodDirection` is applied. Stamped as `data-polarity`. */
17
+ type InsightPolarity = "positive" | "negative" | "neutral";
18
+ /**
19
+ * How much the finding matters — a different axis from `polarity`, which says
20
+ * whether it is good news. Stamped as `data-severity`.
21
+ */
22
+ type InsightSeverity = "info" | "notable" | "critical";
23
+ /**
24
+ * What kind of finding this is. It drives the badge's word and glyph and
25
+ * nothing else: a rail of mixed kinds still reads as one medium, because the
26
+ * encoding underneath never changes with the kind (Few's pitfall #6).
27
+ */
28
+ type InsightKind = "anomaly" | "trend" | "threshold" | "outlier" | "correlation" | "forecast" | "milestone" | "note";
29
+ /**
30
+ * The form the evidence plot draws. Every one shows the same thing — where
31
+ * the observed reading sits against what was expected — at a different
32
+ * density:
33
+ *
34
+ * - `spark`: the measure over its history, with the expected corridor, the
35
+ * flagged period's expected interval and the flagged reading marked. The
36
+ * fullest evidence, and the default whenever there is history.
37
+ * - `range`: a one-dimensional strip — the expected band laid on the value
38
+ * domain with the observed reading marked against it. The honest degrade
39
+ * when there is no history, and the compact form for a dense rail.
40
+ * - `none`: no plot. For a finding whose evidence is not a number on a scale
41
+ * (a correlation, a data-quality note) — the statement and the table carry it.
42
+ *
43
+ * `auto` (default) picks `spark` when the history supports one, then `range`
44
+ * when an expectation does, then `none`. Stamped as `data-evidence`.
45
+ */
46
+ type InsightEvidence = "auto" | "spark" | "range" | "none";
47
+ type InsightXType = "temporal" | "quantitative" | "ordinal";
48
+ type InsightCardSize = "sm" | "md" | "lg";
49
+ type InsightDeltaMode = ArcDeltaMode;
50
+ /**
51
+ * Which scale the deviation is measured on, and therefore what
52
+ * `severityThresholds` are counted in. Stamped as `data-strength`.
53
+ *
54
+ * - `sigma`: the detector reported a standard deviation — the deviation in
55
+ * standard deviations. Defaults 2 and 3, the conventional bounds.
56
+ * - `band`: an expected range without a σ — the deviation in half-widths of
57
+ * that range, so 1 is exactly at the edge. Defaults 1 and 2.
58
+ * - `relative`: a point expectation only — the deviation as a share of it.
59
+ * Defaults 0.1 and 0.25.
60
+ */
61
+ type InsightStrengthKind = "sigma" | "band" | "relative";
62
+ /** What the reader told us about the finding. */
63
+ type InsightFeedback = "helpful" | "not-helpful";
64
+ /** How much the detector trusts the finding, bucketed for the provenance line. */
65
+ type InsightConfidenceLevel = "high" | "moderate" | "low";
66
+ /** One reading on the measure's history — what the evidence spark draws. */
67
+ interface InsightPoint {
68
+ /** Period or position. A `Date`, an ISO string, a number, or a category name. */
69
+ x: Date | string | number;
70
+ /** The reading. `null` or omitted is a gap, never a zero. */
71
+ y?: number | null;
72
+ /** What was expected at this period, when the detector reports one per period. Drawn as a dashed line. */
73
+ expected?: number | null;
74
+ /** The expected corridor at this period. Both bounds or neither; drawn as a band. */
75
+ lower?: number | null;
76
+ upper?: number | null;
77
+ /** This is the reading the finding is about. Without one the card flags the period named by `observation.at`, then the last finite reading. */
78
+ flagged?: boolean;
79
+ }
80
+ /**
81
+ * The finding as numbers: the reading it is about and what was expected of
82
+ * it. This is what makes the claim checkable — a statement with no
83
+ * observation is an assertion, and the card renders it as one.
84
+ */
85
+ interface InsightObservation {
86
+ /** The reading the finding is about. */
87
+ value: number;
88
+ /** The point expectation. Defaults to the midpoint of `lower`/`upper` when only a band is reported. */
89
+ expected?: number | null;
90
+ /** The expected range. Both bounds or neither. */
91
+ lower?: number | null;
92
+ upper?: number | null;
93
+ /** Standard deviation of the expectation, when the detector reports one — it turns the deviation into a z-score. */
94
+ sd?: number | null;
95
+ /** The period the reading belongs to. Matches a point's `x` to place the marker; also read out in the description. */
96
+ at?: Date | string | number;
97
+ }
98
+ /** Overrides for the severity ladder, in the units of the active `InsightStrengthKind`. */
99
+ interface InsightSeverityThresholds {
100
+ /** At or above this strength the finding is `notable`. */
101
+ notable?: number;
102
+ /** At or above this strength it is `critical`. */
103
+ critical?: number;
104
+ }
105
+ /** One row the spark reads. */
106
+ interface InsightRow {
107
+ /** Epoch ms for a temporal axis, the number for a quantitative one, the category otherwise. */
108
+ x: number | string;
109
+ /** The reading; `null` for a gap, so the path breaks rather than inventing a segment. */
110
+ y: number | null;
111
+ /** The per-period expectation, or `null`. */
112
+ e: number | null;
113
+ /** The per-period corridor, or `null`. */
114
+ lo: number | null;
115
+ hi: number | null;
116
+ /** This row is the flagged reading. */
117
+ f: boolean;
118
+ /** The paintable colour of the flagged marker, baked in so the spec stays structural. */
119
+ c: string;
120
+ }
121
+ /** The flagged period's expected interval, drawn as a rule when the corridor is a single scalar band. */
122
+ interface InsightIntervalRow {
123
+ x: number | string;
124
+ lo: number;
125
+ hi: number;
126
+ }
127
+ /** The one row the range strip reads: the band, the expectation, the reading, and the domain to draw them in. */
128
+ interface InsightStripRow {
129
+ lo: number | null;
130
+ hi: number | null;
131
+ e: number | null;
132
+ v: number;
133
+ /** Scale bounds, computed here so the strip's domain is a data push and never a re-embed. */
134
+ d0: number;
135
+ d1: number;
136
+ c: string;
137
+ }
138
+ /** The finding, resolved. */
139
+ interface InsightSummary {
140
+ /** The reading the finding is about, or `null` when the finding carries no number. */
141
+ value: number | null;
142
+ /** The expectation — as reported, or the midpoint of the band. */
143
+ expected: number | null;
144
+ lower: number | null;
145
+ upper: number | null;
146
+ sd: number | null;
147
+ /** `value - expected`, in the measure's own units. */
148
+ deviation: number | null;
149
+ /** The deviation as a share of the expectation, or `null` when the expectation is zero. */
150
+ relative: number | null;
151
+ /** The reading falls outside the expected range. `false` when no range was reported. */
152
+ outside: boolean;
153
+ /** How far from expectation, on `strengthKind`'s scale. */
154
+ strength: number | null;
155
+ strengthKind: InsightStrengthKind | null;
156
+ direction: ArcDeltaDirection;
157
+ polarity: InsightPolarity;
158
+ severity: InsightSeverity;
159
+ /** The colour the flagged marker paints with — polarity, because there the encoded value IS good or bad. */
160
+ color: string;
161
+ /** The evidence form the data can actually carry, after `evidence` was asked for. */
162
+ evidence: "spark" | "range" | "none";
163
+ xType: InsightXType;
164
+ /** History rows, in axis order. */
165
+ points: InsightRow[];
166
+ /** The flagged period's interval — one row, or none when the corridor is per-period (the band already shows it). */
167
+ interval: InsightIntervalRow[];
168
+ /** The range strip's one row, or none. */
169
+ strip: InsightStripRow[];
170
+ /** The flagged row's x, for the axis anchor and the description. */
171
+ flaggedX: number | string | null;
172
+ /** The period the reading belongs to, as given — for the "as of this period" sentence. */
173
+ at: Date | string | number | null;
174
+ /** Readings with a finite value. */
175
+ count: number;
176
+ /** At least two rows carry a corridor, so the spark draws a band rather than one interval. */
177
+ hasBand: boolean;
178
+ /** At least one row carries a per-period expectation, so the spark draws the dashed expected line. */
179
+ hasExpectedLine: boolean;
180
+ /** Fewer than two finite readings — there is a claim to state but no history to plot. */
181
+ insufficient: boolean;
182
+ }
183
+ /** Default severity ladders, per scale. Sigma takes the conventional 2σ / 3σ; a band counts half-widths, so 1 is the edge. */
184
+ declare const DEFAULT_SEVERITY_THRESHOLDS: Record<InsightStrengthKind, {
185
+ notable: number;
186
+ critical: number;
187
+ }>;
188
+ /** Confidence at or above these reads as high, then moderate; below, low. */
189
+ declare const CONFIDENCE_BOUNDS: {
190
+ readonly high: 0.9;
191
+ readonly moderate: 0.7;
192
+ };
193
+ /** Buckets a 0–1 confidence for the provenance line. `null` for anything outside the range. */
194
+ declare function insightConfidenceLevel(confidence: number | null | undefined): InsightConfidenceLevel | null;
195
+ /** Guesses the axis kind from the first reading that has an `x`. */
196
+ declare function inferInsightXType(points: readonly InsightPoint[] | undefined): InsightXType;
197
+ /** The severity the strength supports. Never guesses from a scale the data does not establish. */
198
+ declare function deriveInsightSeverity(strength: number | null, kind: InsightStrengthKind | null, overrides?: InsightSeverityThresholds): InsightSeverity;
199
+ /** How a deviation reads once the measure's good direction is applied. */
200
+ declare function deriveInsightPolarity(direction: ArcDeltaDirection, goodDirection: InsightGoodDirection): InsightPolarity;
201
+ interface NormalizeInsightOptions {
202
+ /** The finding's numbers. Without one the card has a statement and no checkable claim. */
203
+ observation?: InsightObservation | null;
204
+ /** The measure's history. Two or more finite readings make a spark possible. */
205
+ points?: readonly InsightPoint[];
206
+ /** Axis kind. Inferred from the first reading when omitted. */
207
+ xType?: InsightXType;
208
+ goodDirection?: InsightGoodDirection;
209
+ /** The evidence form asked for; `auto` takes the fullest the data supports. */
210
+ evidence?: InsightEvidence;
211
+ /** Overrides the derived severity — a detector that already scored the finding passes its own. */
212
+ severity?: InsightSeverity;
213
+ severityThresholds?: InsightSeverityThresholds;
214
+ /** Resolved theme tokens; `null` before the first read, which leaves the marker colour empty until it lands. */
215
+ tokens: ChartTokens | null;
216
+ }
217
+ /**
218
+ * Resolves the finding: which reading is flagged, what was expected of it,
219
+ * how far off it is and on which scale, how that reads as severity and
220
+ * polarity, which evidence form the data can carry, and the rows each form
221
+ * draws. Returns `null` when there is neither a reading nor a history to
222
+ * speak of.
223
+ */
224
+ declare function normalizeInsight({ observation, points, xType: xTypeProp, goodDirection, evidence, severity: severityOverride, severityThresholds, tokens }: NormalizeInsightOptions): InsightSummary | null;
225
+ interface InsightTextFormatters {
226
+ /** A reading in the measure's grammar. */
227
+ formatValue: (value: number | null | undefined) => string;
228
+ /** The expected range as one string, or `null` when there is no range. */
229
+ formatRange: (lower: number | null, upper: number | null) => string | null;
230
+ /** The deviation, signed, in the mode asked for. */
231
+ formatDeviation: (value: number, expected: number) => string;
232
+ /** The strength, in the units of its own scale — `2.8σ`, `1.4× the range`, `+51%`. */
233
+ formatStrength: (strength: number | null, kind: InsightStrengthKind | null) => string | null;
234
+ }
235
+ declare function createInsightFormatters({ format, locale, deltaMode, formatValue, labels }: {
236
+ format: string;
237
+ locale?: string;
238
+ deltaMode: InsightDeltaMode;
239
+ formatValue?: (value: number) => string;
240
+ labels: InsightCardLabels;
241
+ }): InsightTextFormatters;
242
+ /** Every string the card renders or announces, so a product can localise it. Sentences are functions. */
243
+ interface InsightCardLabels {
244
+ noData: string;
245
+ noMatch: string;
246
+ clearFilters: string;
247
+ error: string;
248
+ retry: string;
249
+ stale: string;
250
+ asOf: string;
251
+ /** Key-row headers. */
252
+ observed: string;
253
+ expected: string;
254
+ deviation: string;
255
+ /** The expected range, written as one value. */
256
+ rangeText: (lower: string, upper: string) => string;
257
+ /** Says whether the reading cleared the range — the claim in words, so it never rests on the plot. */
258
+ outsideRange: (range: string) => string;
259
+ insideRange: (range: string) => string;
260
+ /** The strength, in its own units. */
261
+ sigmaText: (value: string) => string;
262
+ bandText: (value: string) => string;
263
+ relativeText: (value: string) => string;
264
+ /** Provenance parts. */
265
+ detected: (when: string) => string;
266
+ sample: (count: string) => string;
267
+ confidence: (level: string, percent: string) => string;
268
+ confidenceNames: Record<InsightConfidenceLevel, string>;
269
+ /** Badge words. */
270
+ kindNames: Record<InsightKind, string>;
271
+ severityNames: Record<InsightSeverity, string>;
272
+ /**
273
+ * The badge's text, from the already-localised severity and kind. Severity
274
+ * rides the badge's hue AND its words — an `info` finding drops the word,
275
+ * because "Info anomaly" is noise, not information.
276
+ */
277
+ badge: (severity: string, kind: string, key: InsightSeverity) => string;
278
+ /** Spoken beside the delta glyph, so direction never rests on an arrow or a hue. */
279
+ directionWords: Record<ArcDeltaDirection, string>;
280
+ /** Controls. */
281
+ dismiss: (name: string) => string;
282
+ helpful: string;
283
+ notHelpful: string;
284
+ feedbackGroup: (name: string) => string;
285
+ showTable: (name: string) => string;
286
+ hideTable: (name: string) => string;
287
+ about: (name: string) => string;
288
+ loading: (name: string) => string;
289
+ tableCaption: (name: string) => string;
290
+ /** Table headers. */
291
+ tablePeriod: string;
292
+ tableValue: string;
293
+ tableExpected: string;
294
+ tableRange: string;
295
+ tableFlagged: string;
296
+ /** Marks the flagged row in the table, so the marker is never colour alone. */
297
+ flagged: string;
298
+ /** Caption under a plot that could not be drawn from one reading. */
299
+ needsHistory: string;
300
+ /** How each evidence form names itself at the start of the plot's `aria-label`. */
301
+ evidenceNames: Record<"spark" | "range", string>;
302
+ /** The plot's own `aria-label`. */
303
+ chartDescription: (input: {
304
+ evidence: string;
305
+ name: string;
306
+ readings: number;
307
+ observed: string;
308
+ expected: string | null;
309
+ range: string | null;
310
+ at: string | null;
311
+ }) => string;
312
+ /** The finding restated for the description, when the statement is not plain text. */
313
+ claim: (input: {
314
+ kind: string;
315
+ name: string;
316
+ observed: string;
317
+ expected: string | null;
318
+ deviation: string | null;
319
+ }) => string;
320
+ /** Accessible name of the AI mark beside the statement. */
321
+ insightMark: string;
322
+ }
323
+ declare const DEFAULT_INSIGHT_LABELS: InsightCardLabels;
324
+ declare function resolveInsightLabels(overrides?: Partial<InsightCardLabels>): InsightCardLabels;
325
+ interface DeriveInsightStateInput {
326
+ status: InsightCardStatus;
327
+ /** There is something to say — a statement, or a reading to report. */
328
+ hasFinding: boolean;
329
+ /** Anything is on screen already, so a reload is a refresh rather than a first load. */
330
+ hasData: boolean;
331
+ /** A finding with fewer than two readings behind it. */
332
+ insufficient: boolean;
333
+ filtered: boolean;
334
+ }
335
+ /**
336
+ * The state machine. Error wins; loading over an existing finding is a
337
+ * refresh (the previous render stays under the veil); a finding with too
338
+ * little history to plot is `insufficient`, not `ready` — the claim still
339
+ * reads, only the time plot degrades; nothing to say is `no-match` when the
340
+ * consumer's filter caused it and `empty` otherwise.
341
+ */
342
+ declare function deriveInsightState({ status, hasFinding, hasData, insufficient, filtered }: DeriveInsightStateInput): InsightCardState;
343
+ interface BuildInsightDescriptionInput {
344
+ name: string;
345
+ state: InsightCardState;
346
+ /** The finding in plain text, when the statement is a string or `statementText` was given. */
347
+ statement?: string | null;
348
+ kind: InsightKind;
349
+ severity: InsightSeverity;
350
+ summary: InsightSummary | null;
351
+ formatters: InsightTextFormatters;
352
+ /** The provenance sentence parts, already formatted. */
353
+ provenance?: readonly string[];
354
+ asOfText?: string | null;
355
+ labels: InsightCardLabels;
356
+ }
357
+ /**
358
+ * The figure's generated description: what kind of finding this is, how much
359
+ * it matters, the claim, the evidence that supports it, where the reading sits
360
+ * against the expected range, and the provenance — because a machine claim
361
+ * without provenance is not honest data.
362
+ */
363
+ declare function buildInsightDescription({ name, state, statement, kind, severity, summary, formatters, provenance, asOfText, labels }: BuildInsightDescriptionInput): string;
364
+ /** The plot's own `aria-label` — the form, what is on it, and where the flagged reading sits. */
365
+ declare function buildInsightChartDescription({ name, summary, formatters, atText, labels }: {
366
+ name: string;
367
+ summary: InsightSummary;
368
+ formatters: InsightTextFormatters;
369
+ atText?: string | null;
370
+ labels: InsightCardLabels;
371
+ }): string;
372
+ /**
373
+ * The provenance parts, in reading order — method, confidence, sample size,
374
+ * detection time. Empty when the consumer reported none, which is itself
375
+ * worth seeing: an unattributed claim looks unattributed.
376
+ */
377
+ declare function buildInsightProvenance({ method, confidence, sampleSize, detectedAtText, locale, labels }: {
378
+ method?: string | null;
379
+ confidence?: number | null;
380
+ sampleSize?: number | null;
381
+ detectedAtText?: string | null;
382
+ locale?: string;
383
+ labels: InsightCardLabels;
384
+ }): string[];
385
+ /** Writes a row's period the way the axis and the tooltip write it, so the table never disagrees with the plot. */
386
+ declare function formatInsightX(x: number | string | null, { xType, granularity, locale, timeZone }: {
387
+ xType: InsightXType;
388
+ granularity?: ArcTimeGranularity;
389
+ locale?: string;
390
+ timeZone?: string;
391
+ }): string;
392
+ /** Whether a measure's own format is a percentage, so an absolute delta is written in points rather than percent. */
393
+ declare function insightFormatIsPercent(format: string): boolean;
394
+ /**
395
+ * The granularity an axis tick may use, given the one the card reads dates at
396
+ * and how long the plotted window is. An axis label has a pixel budget and
397
+ * ellipsizes past it, so the tooltip's full form is never the axis's form: a
398
+ * date drops its year, a month drops its year, and a datetime drops its clock
399
+ * — except across a window shorter than two days, where a bare date would
400
+ * print the same label at both ends and the hour is the part that separates
401
+ * them. The hour is in the tooltip and the table either way.
402
+ */
403
+ declare function insightAxisGranularity(granularity: ArcTimeGranularity, spanMs?: number | null): ArcTimeGranularity;
404
+ //#endregion
405
+ export { BuildInsightDescriptionInput, CONFIDENCE_BOUNDS, DEFAULT_INSIGHT_LABELS, DEFAULT_SEVERITY_THRESHOLDS, DeriveInsightStateInput, InsightCardLabels, InsightCardSize, InsightCardState, InsightCardStatus, InsightConfidenceLevel, InsightDeltaMode, InsightEvidence, InsightFeedback, InsightGoodDirection, InsightIntervalRow, InsightKind, InsightObservation, InsightPoint, InsightPolarity, InsightRow, InsightSeverity, InsightSeverityThresholds, InsightStrengthKind, InsightStripRow, InsightSummary, InsightTextFormatters, InsightXType, NormalizeInsightOptions, buildInsightChartDescription, buildInsightDescription, buildInsightProvenance, createInsightFormatters, deriveInsightPolarity, deriveInsightSeverity, deriveInsightState, formatInsightX, inferInsightXType, insightAxisGranularity, insightConfidenceLevel, insightFormatIsPercent, normalizeInsight, resolveInsightLabels };