@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.
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/components/AnomalyCard/AnomalyCard.chart.d.ts +64 -0
- package/dist/components/AnomalyCard/AnomalyCard.chart.js +341 -0
- package/dist/components/AnomalyCard/AnomalyCard.d.ts +169 -0
- package/dist/components/AnomalyCard/AnomalyCard.js +1019 -0
- package/dist/components/AnomalyCard/AnomalyCard.model.d.ts +508 -0
- package/dist/components/AnomalyCard/AnomalyCard.model.js +553 -0
- package/dist/components/AnomalyCard/index.d.ts +4 -0
- package/dist/components/AnomalyCard/index.js +4 -0
- package/dist/components/ChartCard/ChartCard.chart.d.ts +72 -0
- package/dist/components/ChartCard/ChartCard.chart.js +1333 -0
- package/dist/components/ChartCard/ChartCard.d.ts +206 -0
- package/dist/components/ChartCard/ChartCard.js +718 -0
- package/dist/components/ChartCard/ChartCard.model.d.ts +452 -0
- package/dist/components/ChartCard/ChartCard.model.js +1223 -0
- package/dist/components/ChartCard/index.d.ts +4 -0
- package/dist/components/ChartCard/index.js +4 -0
- package/dist/components/ComparisonCard/ComparisonCard.chart.d.ts +80 -0
- package/dist/components/ComparisonCard/ComparisonCard.chart.js +337 -0
- package/dist/components/ComparisonCard/ComparisonCard.d.ts +200 -0
- package/dist/components/ComparisonCard/ComparisonCard.js +1325 -0
- package/dist/components/ComparisonCard/ComparisonCard.model.d.ts +309 -0
- package/dist/components/ComparisonCard/ComparisonCard.model.js +263 -0
- package/dist/components/ComparisonCard/index.d.ts +4 -0
- package/dist/components/ComparisonCard/index.js +4 -0
- package/dist/components/ForecastCard/ForecastCard.chart.d.ts +82 -0
- package/dist/components/ForecastCard/ForecastCard.chart.js +416 -0
- package/dist/components/ForecastCard/ForecastCard.d.ts +148 -0
- package/dist/components/ForecastCard/ForecastCard.js +1029 -0
- package/dist/components/ForecastCard/ForecastCard.model.d.ts +497 -0
- package/dist/components/ForecastCard/ForecastCard.model.js +554 -0
- package/dist/components/ForecastCard/index.d.ts +4 -0
- package/dist/components/ForecastCard/index.js +4 -0
- package/dist/components/HighlightCard/HighlightCard.chart.d.ts +122 -0
- package/dist/components/HighlightCard/HighlightCard.chart.js +660 -0
- package/dist/components/HighlightCard/HighlightCard.d.ts +202 -0
- package/dist/components/HighlightCard/HighlightCard.js +1286 -0
- package/dist/components/HighlightCard/HighlightCard.model.d.ts +692 -0
- package/dist/components/HighlightCard/HighlightCard.model.js +875 -0
- package/dist/components/HighlightCard/index.d.ts +4 -0
- package/dist/components/HighlightCard/index.js +4 -0
- package/dist/components/InsightCard/InsightCard.chart.d.ts +91 -0
- package/dist/components/InsightCard/InsightCard.chart.js +471 -0
- package/dist/components/InsightCard/InsightCard.d.ts +161 -0
- package/dist/components/InsightCard/InsightCard.js +961 -0
- package/dist/components/InsightCard/InsightCard.model.d.ts +405 -0
- package/dist/components/InsightCard/InsightCard.model.js +421 -0
- package/dist/components/InsightCard/index.d.ts +4 -0
- package/dist/components/InsightCard/index.js +4 -0
- package/dist/components/MetricCard/MetricCard.chart.d.ts +79 -0
- package/dist/components/MetricCard/MetricCard.chart.js +435 -0
- package/dist/components/MetricCard/MetricCard.d.ts +227 -0
- package/dist/components/MetricCard/MetricCard.js +1293 -0
- package/dist/components/MetricCard/MetricCard.model.d.ts +521 -0
- package/dist/components/MetricCard/MetricCard.model.js +627 -0
- package/dist/components/MetricCard/index.d.ts +4 -0
- package/dist/components/MetricCard/index.js +4 -0
- package/dist/components/ProfileCard/ProfileCard.chart.d.ts +64 -0
- package/dist/components/ProfileCard/ProfileCard.chart.js +427 -0
- package/dist/components/ProfileCard/ProfileCard.d.ts +140 -0
- package/dist/components/ProfileCard/ProfileCard.js +735 -0
- package/dist/components/ProfileCard/ProfileCard.model.d.ts +279 -0
- package/dist/components/ProfileCard/ProfileCard.model.js +244 -0
- package/dist/components/ProfileCard/index.d.ts +4 -0
- package/dist/components/ProfileCard/index.js +4 -0
- package/dist/components/ProgressCard/ProgressCard.chart.d.ts +73 -0
- package/dist/components/ProgressCard/ProgressCard.chart.js +373 -0
- package/dist/components/ProgressCard/ProgressCard.d.ts +137 -0
- package/dist/components/ProgressCard/ProgressCard.js +908 -0
- package/dist/components/ProgressCard/ProgressCard.model.d.ts +385 -0
- package/dist/components/ProgressCard/ProgressCard.model.js +389 -0
- package/dist/components/ProgressCard/index.d.ts +4 -0
- package/dist/components/ProgressCard/index.js +4 -0
- package/dist/components/ReportCard/ReportCard.chart.d.ts +45 -0
- package/dist/components/ReportCard/ReportCard.chart.js +231 -0
- package/dist/components/ReportCard/ReportCard.d.ts +153 -0
- package/dist/components/ReportCard/ReportCard.js +1118 -0
- package/dist/components/ReportCard/ReportCard.model.d.ts +392 -0
- package/dist/components/ReportCard/ReportCard.model.js +399 -0
- package/dist/components/ReportCard/index.d.ts +4 -0
- package/dist/components/ReportCard/index.js +4 -0
- package/dist/components/SankeyCard/SankeyCard.chart.d.ts +75 -0
- package/dist/components/SankeyCard/SankeyCard.chart.js +249 -0
- package/dist/components/SankeyCard/SankeyCard.d.ts +185 -0
- package/dist/components/SankeyCard/SankeyCard.js +788 -0
- package/dist/components/SankeyCard/SankeyCard.model.d.ts +501 -0
- package/dist/components/SankeyCard/SankeyCard.model.js +789 -0
- package/dist/components/SankeyCard/index.d.ts +4 -0
- package/dist/components/SankeyCard/index.js +4 -0
- package/dist/components/StatusCard/StatusCard.chart.d.ts +60 -0
- package/dist/components/StatusCard/StatusCard.chart.js +188 -0
- package/dist/components/StatusCard/StatusCard.d.ts +176 -0
- package/dist/components/StatusCard/StatusCard.js +989 -0
- package/dist/components/StatusCard/StatusCard.model.d.ts +555 -0
- package/dist/components/StatusCard/StatusCard.model.js +776 -0
- package/dist/components/StatusCard/index.d.ts +4 -0
- package/dist/components/StatusCard/index.js +4 -0
- package/dist/components/TableCard/TableCard.chart.d.ts +53 -0
- package/dist/components/TableCard/TableCard.chart.js +192 -0
- package/dist/components/TableCard/TableCard.d.ts +140 -0
- package/dist/components/TableCard/TableCard.js +811 -0
- package/dist/components/TableCard/TableCard.model.d.ts +381 -0
- package/dist/components/TableCard/TableCard.model.js +475 -0
- package/dist/components/TableCard/index.d.ts +4 -0
- package/dist/components/TableCard/index.js +4 -0
- package/dist/components/TargetCard/TargetCard.chart.d.ts +52 -0
- package/dist/components/TargetCard/TargetCard.chart.js +273 -0
- package/dist/components/TargetCard/TargetCard.d.ts +143 -0
- package/dist/components/TargetCard/TargetCard.js +910 -0
- package/dist/components/TargetCard/TargetCard.model.d.ts +468 -0
- package/dist/components/TargetCard/TargetCard.model.js +581 -0
- package/dist/components/TargetCard/index.d.ts +4 -0
- package/dist/components/TargetCard/index.js +4 -0
- package/dist/components/TreeCard/TreeCard.chart.d.ts +80 -0
- package/dist/components/TreeCard/TreeCard.chart.js +178 -0
- package/dist/components/TreeCard/TreeCard.d.ts +182 -0
- package/dist/components/TreeCard/TreeCard.js +1187 -0
- package/dist/components/TreeCard/TreeCard.model.d.ts +330 -0
- package/dist/components/TreeCard/TreeCard.model.js +401 -0
- package/dist/components/TreeCard/index.d.ts +4 -0
- package/dist/components/TreeCard/index.js +4 -0
- package/dist/components/TrendCard/TrendCard.chart.d.ts +75 -0
- package/dist/components/TrendCard/TrendCard.chart.js +393 -0
- package/dist/components/TrendCard/TrendCard.d.ts +224 -0
- package/dist/components/TrendCard/TrendCard.js +1053 -0
- package/dist/components/TrendCard/TrendCard.model.d.ts +545 -0
- package/dist/components/TrendCard/TrendCard.model.js +623 -0
- package/dist/components/TrendCard/index.d.ts +4 -0
- package/dist/components/TrendCard/index.js +4 -0
- package/dist/index.d.ts +76 -0
- package/dist/index.js +57 -0
- package/dist/lib/vega/ArcVegaChart.d.ts +24 -0
- package/dist/lib/vega/ArcVegaChart.js +42 -0
- package/dist/lib/vega/ArcVegaSurface.d.ts +13 -0
- package/dist/lib/vega/ArcVegaSurface.js +38 -0
- package/dist/lib/vega/axisTicks.js +156 -0
- package/dist/lib/vega/config.d.ts +29 -0
- package/dist/lib/vega/config.js +113 -0
- package/dist/lib/vega/embed.d.ts +29 -0
- package/dist/lib/vega/embed.js +29 -0
- package/dist/lib/vega/engine.d.ts +10 -0
- package/dist/lib/vega/engine.js +6 -0
- package/dist/lib/vega/formatters.d.ts +125 -0
- package/dist/lib/vega/formatters.js +277 -0
- package/dist/lib/vega/index.d.ts +11 -0
- package/dist/lib/vega/load.d.ts +13 -0
- package/dist/lib/vega/load.js +21 -0
- package/dist/lib/vega/time.d.ts +45 -0
- package/dist/lib/vega/time.js +105 -0
- package/dist/lib/vega/tokens.d.ts +73 -0
- package/dist/lib/vega/tokens.js +137 -0
- package/dist/lib/vega/tooltip.d.ts +45 -0
- package/dist/lib/vega/tooltip.js +124 -0
- package/dist/lib/vega/useArcVega.d.ts +43 -0
- package/dist/lib/vega/useArcVega.js +121 -0
- package/package.json +60 -0
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
import { ArcDeltaMode, ArcTimeGranularity } from "../../lib/vega/formatters.js";
|
|
2
|
+
import { ChartTokens } from "../../lib/vega/tokens.js";
|
|
3
|
+
//#region src/components/AnomalyCard/AnomalyCard.model.d.ts
|
|
4
|
+
/** What the consumer's transport reports. */
|
|
5
|
+
type AnomalyCardStatus = "loading" | "ready" | "error";
|
|
6
|
+
/**
|
|
7
|
+
* What the card actually shows, derived from `status`, the readings and
|
|
8
|
+
* `filtered`. Stamped on the root as `data-state`.
|
|
9
|
+
*/
|
|
10
|
+
type AnomalyCardState = "loading" | "refreshing" | "ready" | "empty" | "no-match" | "error";
|
|
11
|
+
/** Which side of the expected range a reading broke out of. */
|
|
12
|
+
type AnomalyDirection = "high" | "low";
|
|
13
|
+
/**
|
|
14
|
+
* How an excursion reads once `goodDirection` is applied. `neutral` is the
|
|
15
|
+
* default and the honest one for a detector: leaving the expected range is
|
|
16
|
+
* unexpected, which is neither good nor bad until the product says which way
|
|
17
|
+
* is good.
|
|
18
|
+
*/
|
|
19
|
+
type AnomalyPolarity = "positive" | "negative" | "neutral";
|
|
20
|
+
/** Which way is good for this measure: revenue up, latency down, a detector with no opinion `none`. */
|
|
21
|
+
type AnomalyGoodDirection = "up" | "down" | "none";
|
|
22
|
+
/**
|
|
23
|
+
* The window's answer. `breach` — the latest reading is outside its expected
|
|
24
|
+
* range, so this is happening now; `watch` — it is inside now but the window
|
|
25
|
+
* holds excursions; `clear` — nothing left the range. Stamped as
|
|
26
|
+
* `data-verdict`.
|
|
27
|
+
*/
|
|
28
|
+
type AnomalyVerdict = "clear" | "watch" | "breach";
|
|
29
|
+
/** `line` may crop; `area` keeps a zero baseline whatever `scale` says. */
|
|
30
|
+
type AnomalyMark = "line" | "area";
|
|
31
|
+
type AnomalyScale = "auto" | "zero";
|
|
32
|
+
type AnomalyDeltaMode = ArcDeltaMode;
|
|
33
|
+
type AnomalyCardSize = "sm" | "md" | "lg";
|
|
34
|
+
type AnomalyXType = "temporal" | "quantitative" | "ordinal";
|
|
35
|
+
/**
|
|
36
|
+
* The big number: the latest reading with its standing against the range
|
|
37
|
+
* (default), how many periods broke out, the worst excursion's deviation, or
|
|
38
|
+
* nothing. Stamped as `data-headline`.
|
|
39
|
+
*/
|
|
40
|
+
type AnomalyHeadline = "latest" | "count" | "worst" | "none";
|
|
41
|
+
/**
|
|
42
|
+
* One reading with the range it was expected to sit in.
|
|
43
|
+
*
|
|
44
|
+
* `lower` / `upper` are that period's own expected bounds — a learned band
|
|
45
|
+
* from a detector, or control limits. A period that carries neither falls
|
|
46
|
+
* back to the card's flat `bounds`, and a period with no bounds at all is
|
|
47
|
+
* simply unjudged: it is drawn, and it can never be flagged by comparison.
|
|
48
|
+
*/
|
|
49
|
+
interface AnomalyPoint {
|
|
50
|
+
x: Date | string | number;
|
|
51
|
+
/** The reading, or `null` for a period with no measurement — drawn as a gap, never as zero, and never flagged. */
|
|
52
|
+
y: number | null;
|
|
53
|
+
/** Lower bound of the expected range at this period. */
|
|
54
|
+
lower?: number | null;
|
|
55
|
+
/** Upper bound of the expected range at this period. */
|
|
56
|
+
upper?: number | null;
|
|
57
|
+
/** What the model expected — drawn as a quiet dashed path inside the band, and named in the tooltip and the table. */
|
|
58
|
+
expected?: number | null;
|
|
59
|
+
/**
|
|
60
|
+
* The detector's own verdict for this period. Takes precedence over the
|
|
61
|
+
* band comparison in BOTH directions: `true` flags a reading the bounds
|
|
62
|
+
* would have accepted, `false` clears one they would have rejected. Leave
|
|
63
|
+
* it out to let the bounds decide.
|
|
64
|
+
*/
|
|
65
|
+
anomaly?: boolean;
|
|
66
|
+
/** The detector's own score for this period (sigmas, a probability — whatever `scoreFormat` prints), shown in the tooltip, the rows and the table. */
|
|
67
|
+
score?: number | null;
|
|
68
|
+
}
|
|
69
|
+
/** A reading in the long-form shape the plot reads. */
|
|
70
|
+
interface AnomalyRow {
|
|
71
|
+
x: number | string;
|
|
72
|
+
/** The reading — `null` for a gap, which breaks the path rather than dropping it to zero. */
|
|
73
|
+
y: number | null;
|
|
74
|
+
/** Expected range at this period, after the flat `bounds` fallback. */
|
|
75
|
+
lo: number | null;
|
|
76
|
+
hi: number | null;
|
|
77
|
+
/** What the model expected. */
|
|
78
|
+
ex: number | null;
|
|
79
|
+
/** Signed distance past the nearest bound — positive above `hi`, negative below `lo`; `null` inside the range or unjudged. */
|
|
80
|
+
d: number | null;
|
|
81
|
+
/** This reading is an excursion. */
|
|
82
|
+
a: boolean;
|
|
83
|
+
/** Which side it broke out of; `null` when a flag arrived with no bounds to place it against. */
|
|
84
|
+
dir: AnomalyDirection | null;
|
|
85
|
+
/** The paintable colour of this row's flag mark, baked in so the spec stays structural. */
|
|
86
|
+
c: string;
|
|
87
|
+
/** The flag mark's shape — direction is carried by shape as well as hue, never by hue alone. */
|
|
88
|
+
sh: AnomalyFlagShape;
|
|
89
|
+
/** Index of the episode this reading belongs to, or `-1`. */
|
|
90
|
+
e: number;
|
|
91
|
+
/** The detector's score, or `null`. */
|
|
92
|
+
sc: number | null;
|
|
93
|
+
}
|
|
94
|
+
/** Vega point shapes the flag marks use: direction as shape, so colour is never the only cue. */
|
|
95
|
+
type AnomalyFlagShape = "triangle-up" | "triangle-down" | "circle";
|
|
96
|
+
/** One row per period — the crosshair's own dataset, so the hover lands on the period. */
|
|
97
|
+
interface AnomalyPeriodRow {
|
|
98
|
+
x: number | string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The washed span of the selected episode — always exactly one row while
|
|
102
|
+
* there are periods, carrying `on` rather than appearing and disappearing.
|
|
103
|
+
* An EMPTY dataset still feeds the shared `x` scale, and Vega logs
|
|
104
|
+
* `Infinite extent for field "start"` for the life of the chart; a row that
|
|
105
|
+
* is merely transparent keeps the domain honest and keeps the selection a
|
|
106
|
+
* data push rather than a re-embed.
|
|
107
|
+
*/
|
|
108
|
+
interface AnomalySpanRow {
|
|
109
|
+
start: number | string;
|
|
110
|
+
end: number | string;
|
|
111
|
+
/** An excursion is selected, so the wash is painted. */
|
|
112
|
+
on: boolean;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* A run of consecutive flagged periods — the unit a reader actually acts on.
|
|
116
|
+
* One reading three sigma out and a four-hour excursion are different events,
|
|
117
|
+
* and counting periods would call them the same size.
|
|
118
|
+
*/
|
|
119
|
+
interface AnomalyEpisode {
|
|
120
|
+
/** Stable identity for selection — derived from the first flagged period. */
|
|
121
|
+
key: string;
|
|
122
|
+
index: number;
|
|
123
|
+
start: number | string;
|
|
124
|
+
end: number | string;
|
|
125
|
+
/** Flagged periods inside it. */
|
|
126
|
+
count: number;
|
|
127
|
+
/** The direction of its peak. */
|
|
128
|
+
direction: AnomalyDirection | null;
|
|
129
|
+
/** It broke out of both bounds — the direction word alone would be a half-truth. */
|
|
130
|
+
mixed: boolean;
|
|
131
|
+
polarity: AnomalyPolarity;
|
|
132
|
+
/** The paintable colour of its flags, baked in so a row and its marks can never disagree. */
|
|
133
|
+
color: string;
|
|
134
|
+
/** The reading furthest past its bound; `null` when nothing in the episode could be measured against a bound. */
|
|
135
|
+
peak: AnomalyPeak | null;
|
|
136
|
+
/** It runs to the last period in the window, so it has not ended. */
|
|
137
|
+
ongoing: boolean;
|
|
138
|
+
}
|
|
139
|
+
/** The worst reading inside an episode, with everything the rows and sentences quote. */
|
|
140
|
+
interface AnomalyPeak {
|
|
141
|
+
x: number | string;
|
|
142
|
+
y: number;
|
|
143
|
+
/** Signed distance past the bound it broke. */
|
|
144
|
+
deviation: number;
|
|
145
|
+
/** The bound it broke. */
|
|
146
|
+
bound: number;
|
|
147
|
+
direction: AnomalyDirection;
|
|
148
|
+
score: number | null;
|
|
149
|
+
}
|
|
150
|
+
interface AnomalySummary {
|
|
151
|
+
xType: AnomalyXType;
|
|
152
|
+
granularity: ArcTimeGranularity;
|
|
153
|
+
/** The period domain, in axis order. */
|
|
154
|
+
periods: (number | string)[];
|
|
155
|
+
rows: AnomalyRow[];
|
|
156
|
+
/** Periods with a finite reading. */
|
|
157
|
+
count: number;
|
|
158
|
+
/** The plot's extent — the readings AND the band, so `scale: "auto"` can never crop the range it is judging against. */
|
|
159
|
+
min: number | null;
|
|
160
|
+
max: number | null;
|
|
161
|
+
/** At least one period carries an expected range. */
|
|
162
|
+
hasBand: boolean;
|
|
163
|
+
/** At least one period carries an expected value. */
|
|
164
|
+
hasExpected: boolean;
|
|
165
|
+
/** At least one period carries a detector score. */
|
|
166
|
+
hasScore: boolean;
|
|
167
|
+
/** Periods judged against a range — the denominator the flag rate is honest about. */
|
|
168
|
+
judged: number;
|
|
169
|
+
/** Flagged periods. */
|
|
170
|
+
flagged: number;
|
|
171
|
+
episodes: AnomalyEpisode[];
|
|
172
|
+
/** The last period with a reading. */
|
|
173
|
+
latest: AnomalyRow | null;
|
|
174
|
+
/** The episode the latest period belongs to, when it is flagged — the reason a verdict can be `breach`. */
|
|
175
|
+
current: AnomalyEpisode | null;
|
|
176
|
+
/** The episode with the largest peak deviation, relative to the bound it broke. */
|
|
177
|
+
worst: AnomalyEpisode | null;
|
|
178
|
+
}
|
|
179
|
+
/** A piece of a generated insight sentence: plain text, or a value the card sets in bold. */
|
|
180
|
+
type AnomalyInsightSegment = string | {
|
|
181
|
+
value: string;
|
|
182
|
+
};
|
|
183
|
+
/** What the flag tooltip and the episode rows explain about one excursion. */
|
|
184
|
+
interface AnomalyExplanation {
|
|
185
|
+
periodText: string;
|
|
186
|
+
valueText: string;
|
|
187
|
+
expectedText: string | null;
|
|
188
|
+
rangeText: string;
|
|
189
|
+
deviationText: string;
|
|
190
|
+
secondaryText: string | null;
|
|
191
|
+
scoreText: string | null;
|
|
192
|
+
direction: AnomalyDirection | null;
|
|
193
|
+
}
|
|
194
|
+
/** Every string the card renders or announces, so a product can localise it. Sentences are functions. */
|
|
195
|
+
interface AnomalyCardLabels {
|
|
196
|
+
/** Direction words — used in badges, rows, the table and every sentence, so hue is never the only cue. */
|
|
197
|
+
high: string;
|
|
198
|
+
low: string;
|
|
199
|
+
mixed: string;
|
|
200
|
+
inRange: string;
|
|
201
|
+
/** Suffix for a percentage-point deviation. */
|
|
202
|
+
percentagePoints: string;
|
|
203
|
+
noData: string;
|
|
204
|
+
noMatch: string;
|
|
205
|
+
clearFilters: string;
|
|
206
|
+
error: string;
|
|
207
|
+
retry: string;
|
|
208
|
+
/** Shown in place of the plot when fewer than two periods carry a reading. */
|
|
209
|
+
insufficient: string;
|
|
210
|
+
/** Caption under a plot whose periods carry no expected range at all. */
|
|
211
|
+
unjudged: string;
|
|
212
|
+
stale: string;
|
|
213
|
+
asOf: string;
|
|
214
|
+
/** Verdict chip words. */
|
|
215
|
+
verdicts: Record<AnomalyVerdict, string>;
|
|
216
|
+
/** Key-row and legend names. */
|
|
217
|
+
seriesKey: string;
|
|
218
|
+
bandKey: string;
|
|
219
|
+
expectedKey: string;
|
|
220
|
+
flagKey: string;
|
|
221
|
+
/** Table and tooltip column names. */
|
|
222
|
+
tablePeriod: string;
|
|
223
|
+
tableValue: string;
|
|
224
|
+
tableExpected: string;
|
|
225
|
+
tableRange: string;
|
|
226
|
+
tableDeviation: string;
|
|
227
|
+
tableFlag: string;
|
|
228
|
+
score: string;
|
|
229
|
+
/** Heading of the excursion list. */
|
|
230
|
+
episodes: string;
|
|
231
|
+
/** Accessible name of the excursion list. */
|
|
232
|
+
episodeGroup: (name: string) => string;
|
|
233
|
+
/**
|
|
234
|
+
* A row's accessible name. It REPLACES the row's visible content for
|
|
235
|
+
* assistive technology, so it has to carry everything the row shows — the
|
|
236
|
+
* span, the direction, how many periods, how far out and the score — not
|
|
237
|
+
* just the action (WCAG 2.5.3 also wants the visible label, the span,
|
|
238
|
+
* inside it).
|
|
239
|
+
*/
|
|
240
|
+
openEpisode: (input: {
|
|
241
|
+
range: string;
|
|
242
|
+
direction: string;
|
|
243
|
+
periods: string;
|
|
244
|
+
deviation: string | null;
|
|
245
|
+
score: string | null;
|
|
246
|
+
ongoing: boolean;
|
|
247
|
+
}) => string;
|
|
248
|
+
/** Read out on the episode that is still running. */
|
|
249
|
+
ongoing: string;
|
|
250
|
+
/** `1 period` / `3 periods`. */
|
|
251
|
+
periodCount: (count: number) => string;
|
|
252
|
+
/** Appended when the list is capped. */
|
|
253
|
+
moreEpisodes: (count: number) => string;
|
|
254
|
+
/** Shown in the list when the window is clean. */
|
|
255
|
+
noEpisodes: string;
|
|
256
|
+
showTable: (name: string) => string;
|
|
257
|
+
hideTable: (name: string) => string;
|
|
258
|
+
about: (name: string) => string;
|
|
259
|
+
loading: (name: string) => string;
|
|
260
|
+
tableCaption: (name: string) => string;
|
|
261
|
+
/** Accessible name of the standing group beside the headline. */
|
|
262
|
+
standingGroup: (name: string) => string;
|
|
263
|
+
/** Compact label/value rows explaining one excursion — the flag tooltip and the headline tooltip share them. */
|
|
264
|
+
explanation: (input: AnomalyExplanation) => readonly (readonly [label: string, value: string])[];
|
|
265
|
+
/** The headline caption under a `latest` headline. */
|
|
266
|
+
expectedRange: (range: string) => string;
|
|
267
|
+
/** The headline caption under a `count` headline — `of 84 periods judged`. */
|
|
268
|
+
ofJudged: (count: number) => string;
|
|
269
|
+
/** The verdict sentence in the card description. */
|
|
270
|
+
verdictSentence: (input: {
|
|
271
|
+
verdict: AnomalyVerdict;
|
|
272
|
+
name: string;
|
|
273
|
+
count: number;
|
|
274
|
+
range: string;
|
|
275
|
+
latest: string;
|
|
276
|
+
}) => string;
|
|
277
|
+
/** Names the worst excursion. */
|
|
278
|
+
worstSentence: (input: {
|
|
279
|
+
period: string;
|
|
280
|
+
value: string;
|
|
281
|
+
deviation: string;
|
|
282
|
+
bound: string;
|
|
283
|
+
direction: string;
|
|
284
|
+
}) => string;
|
|
285
|
+
/** Appended when the detector supplied scores. */
|
|
286
|
+
scoreSentence: (score: string) => string;
|
|
287
|
+
markNames: Record<AnomalyMark, string>;
|
|
288
|
+
/** The plot's own `aria-label`. */
|
|
289
|
+
chartDescription: (input: {
|
|
290
|
+
mark: string;
|
|
291
|
+
name: string;
|
|
292
|
+
periodCount: number;
|
|
293
|
+
range: string;
|
|
294
|
+
min: string;
|
|
295
|
+
max: string;
|
|
296
|
+
flagged: number;
|
|
297
|
+
band: string | null;
|
|
298
|
+
}) => string;
|
|
299
|
+
/** Accessible name of the AI mark beside the insight sentence. */
|
|
300
|
+
insightMark: string;
|
|
301
|
+
/** The generated insight, as segments so the readings render in bold while the words stay plain. */
|
|
302
|
+
insight: (input: {
|
|
303
|
+
name: string;
|
|
304
|
+
verdict: AnomalyVerdict;
|
|
305
|
+
count: number;
|
|
306
|
+
range: string;
|
|
307
|
+
worstAt: string | null;
|
|
308
|
+
worstValue: string | null;
|
|
309
|
+
worstDeviation: string | null;
|
|
310
|
+
worstBound: string | null;
|
|
311
|
+
direction: string | null;
|
|
312
|
+
ongoing: boolean;
|
|
313
|
+
}) => AnomalyInsightSegment[];
|
|
314
|
+
}
|
|
315
|
+
declare const DEFAULT_ANOMALY_LABELS: AnomalyCardLabels;
|
|
316
|
+
declare function resolveAnomalyLabels(overrides?: Partial<AnomalyCardLabels>): AnomalyCardLabels;
|
|
317
|
+
interface DeriveAnomalyStateInput {
|
|
318
|
+
status: AnomalyCardStatus;
|
|
319
|
+
/** At least one reading exists. */
|
|
320
|
+
hasValue: boolean;
|
|
321
|
+
/** Anything is on screen already, so a reload is a refresh, not a first load. */
|
|
322
|
+
hasData: boolean;
|
|
323
|
+
filtered: boolean;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* The state machine. Error wins; loading over existing readings is a refresh
|
|
327
|
+
* (the previous render stays under the veil); no readings is `no-match` when
|
|
328
|
+
* the consumer's filter caused it and `empty` otherwise.
|
|
329
|
+
*/
|
|
330
|
+
declare function deriveAnomalyState({ status, hasValue, hasData, filtered }: DeriveAnomalyStateInput): AnomalyCardState;
|
|
331
|
+
/**
|
|
332
|
+
* The granularity an x axis labels its ticks at: the tooltip and the table
|
|
333
|
+
* keep the full form (`Sep 8, 2026`); an axis has room for `Sep 8`. Duplicated
|
|
334
|
+
* per component rather than shared, so a card's text grammar is readable in
|
|
335
|
+
* one file.
|
|
336
|
+
*/
|
|
337
|
+
declare function anomalyAxisGranularity(granularity: ArcTimeGranularity): ArcTimeGranularity;
|
|
338
|
+
/**
|
|
339
|
+
* How an excursion reads once the product says which way is good.
|
|
340
|
+
*
|
|
341
|
+
* `none` — the default — is the honest answer for a detector: leaving the
|
|
342
|
+
* expected range is UNEXPECTED, which is not the same as bad. A product that
|
|
343
|
+
* knows (revenue up, latency down) gets the polarity, and with it the
|
|
344
|
+
* diverging hues; a product that does not gets the attention hue for both
|
|
345
|
+
* directions, and the direction is read from the mark's shape and its word.
|
|
346
|
+
*/
|
|
347
|
+
declare function anomalyPolarityFor(direction: AnomalyDirection | null, goodDirection: AnomalyGoodDirection): AnomalyPolarity;
|
|
348
|
+
/**
|
|
349
|
+
* The colour one excursion paints with — colour's ONE job here is polarity.
|
|
350
|
+
* A neutral excursion takes the attention hue rather than a diverging end,
|
|
351
|
+
* because saying "good" or "bad" about a move nobody has assigned a direction
|
|
352
|
+
* to is exactly the lie rule 6 exists to prevent. This is one of the two
|
|
353
|
+
* places the reserved status hues belong on a mark: the encoded value IS
|
|
354
|
+
* "this needs a look".
|
|
355
|
+
*/
|
|
356
|
+
declare function anomalyColorFor(polarity: AnomalyPolarity, tokens: ChartTokens): string;
|
|
357
|
+
/** Direction as SHAPE, so a flag never depends on hue alone (WCAG 1.4.1). */
|
|
358
|
+
declare function anomalyShapeFor(direction: AnomalyDirection | null): AnomalyFlagShape;
|
|
359
|
+
interface AnomalyBounds {
|
|
360
|
+
lower?: number | null;
|
|
361
|
+
upper?: number | null;
|
|
362
|
+
}
|
|
363
|
+
interface NormalizeAnomalyOptions {
|
|
364
|
+
granularity?: ArcTimeGranularity;
|
|
365
|
+
/**
|
|
366
|
+
* A flat expected range for every period that carries no bounds of its own —
|
|
367
|
+
* a control limit or an SLO, rather than a learned band. A period's own
|
|
368
|
+
* `lower` / `upper` always win.
|
|
369
|
+
*/
|
|
370
|
+
bounds?: AnomalyBounds;
|
|
371
|
+
goodDirection: AnomalyGoodDirection;
|
|
372
|
+
tokens: ChartTokens;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Normalises the readings onto one period domain, resolves each period's
|
|
376
|
+
* expected range (its own bounds, else the flat `bounds`), decides the flag
|
|
377
|
+
* (the detector's `anomaly` first, the bounds second), measures how far past
|
|
378
|
+
* the bound each excursion went, and groups consecutive excursions into
|
|
379
|
+
* episodes.
|
|
380
|
+
*
|
|
381
|
+
* The plot's extent spans the readings AND the band, so a cropped `auto`
|
|
382
|
+
* scale can never hide the range the readings are being judged against.
|
|
383
|
+
*
|
|
384
|
+
* Returns `null` when there are no readings to speak of.
|
|
385
|
+
*/
|
|
386
|
+
declare function normalizeAnomalies(points: readonly AnomalyPoint[] | undefined, { granularity, bounds, goodDirection, tokens }: NormalizeAnomalyOptions): AnomalySummary | null;
|
|
387
|
+
/** The periods the crosshair reads — one row each, so the hover lands on the period. */
|
|
388
|
+
declare function buildAnomalyPeriodRows(summary: AnomalySummary): AnomalyPeriodRow[];
|
|
389
|
+
/**
|
|
390
|
+
* The washed span of the selected episode. A wash in the brush role means
|
|
391
|
+
* SELECTION here, which is exactly what this is: the reader picked an
|
|
392
|
+
* excursion and the plot says which one.
|
|
393
|
+
*
|
|
394
|
+
* Always one row while the window has periods — a selection turns `on`, it
|
|
395
|
+
* does not add a row. An empty dataset would contribute an empty extent to
|
|
396
|
+
* the shared `x` scale (`Infinite extent for field "start"`), and gating the
|
|
397
|
+
* layer on the selection instead would re-embed the view every time the
|
|
398
|
+
* reader picked a different excursion.
|
|
399
|
+
*/
|
|
400
|
+
declare function buildAnomalySpanRows(summary: AnomalySummary | null | undefined, selectedKey: string | null | undefined): AnomalySpanRow[];
|
|
401
|
+
/** The window's answer, and the polarity the verdict chip wears. */
|
|
402
|
+
interface AnomalyStanding {
|
|
403
|
+
verdict: AnomalyVerdict;
|
|
404
|
+
/** The current excursion's polarity when breaching, else neutral — a chip is never coloured by an event that has ended. */
|
|
405
|
+
polarity: AnomalyPolarity;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* `breach` when the latest reading is outside its range, `watch` when the
|
|
409
|
+
* window holds excursions but the latest reading is inside, `clear` when
|
|
410
|
+
* nothing left the range. A window with nothing to judge against is `clear`
|
|
411
|
+
* only in the sense that nothing was flagged, and the card says so in its
|
|
412
|
+
* caption rather than in the verdict.
|
|
413
|
+
*/
|
|
414
|
+
declare function deriveAnomalyStanding(summary: AnomalySummary | null | undefined): AnomalyStanding;
|
|
415
|
+
interface AnomalyTextFormatters {
|
|
416
|
+
/** A reading in the card's own grammar. */
|
|
417
|
+
formatValue: (value: number | null | undefined) => string;
|
|
418
|
+
/** A signed deviation — `+124 ms`, `-2.4 pp`. */
|
|
419
|
+
formatDeviation: (deviation: number | null | undefined, bound: number | null | undefined, mode?: AnomalyDeltaMode) => string | null;
|
|
420
|
+
/** The relative deviation when the absolute one was rendered, and the other way round; `null` when the second form does not exist. */
|
|
421
|
+
formatDeviationSecondary: (deviation: number | null | undefined, bound: number | null | undefined, mode?: AnomalyDeltaMode) => string | null;
|
|
422
|
+
/** An expected range as `lo – hi`, or a one-sided bound as `≤ hi` / `≥ lo`. */
|
|
423
|
+
formatRange: (lo: number | null | undefined, hi: number | null | undefined) => string;
|
|
424
|
+
formatScore: (score: number | null | undefined) => string | null;
|
|
425
|
+
formatX: (x: number | string) => string;
|
|
426
|
+
/** A span between two `x` values — a collapsed date range for a temporal axis, `start – end` otherwise, and one period for a span of one. */
|
|
427
|
+
formatXRange: (start: number | string, end: number | string) => string;
|
|
428
|
+
}
|
|
429
|
+
/** The formatters every text surface shares — headline, rows, table, tooltip, descriptions. */
|
|
430
|
+
declare function createAnomalyFormatters({ format, locale, timeZone, formatValue, xType, granularity, deltaMode, percentagePoints, scoreFormat }: {
|
|
431
|
+
format: string;
|
|
432
|
+
locale?: string;
|
|
433
|
+
timeZone?: string;
|
|
434
|
+
formatValue?: (value: number) => string;
|
|
435
|
+
xType: AnomalyXType;
|
|
436
|
+
granularity: ArcTimeGranularity;
|
|
437
|
+
deltaMode?: AnomalyDeltaMode;
|
|
438
|
+
percentagePoints?: string;
|
|
439
|
+
scoreFormat?: string;
|
|
440
|
+
}): AnomalyTextFormatters;
|
|
441
|
+
/** The label/value rows one excursion explains itself with — shared by the flag tooltip, the headline tooltip and the episode rows. */
|
|
442
|
+
declare function buildAnomalyExplanation({ row, formatters, labels }: {
|
|
443
|
+
row: Pick<AnomalyRow, "x" | "y" | "lo" | "hi" | "ex" | "d" | "dir" | "sc">;
|
|
444
|
+
formatters: AnomalyTextFormatters;
|
|
445
|
+
labels: AnomalyCardLabels;
|
|
446
|
+
}): AnomalyExplanation;
|
|
447
|
+
/**
|
|
448
|
+
* The generated insight — what the card shows beside the AI mark when the
|
|
449
|
+
* consumer passes no `insight`. Values come back as `{ value }` segments so
|
|
450
|
+
* the card can set them in bold; the words come from `labels.insight`.
|
|
451
|
+
*/
|
|
452
|
+
declare function buildAnomalyInsight({ name, summary, standing, formatters, labels }: {
|
|
453
|
+
name: string;
|
|
454
|
+
summary: AnomalySummary;
|
|
455
|
+
standing: AnomalyStanding;
|
|
456
|
+
formatters: AnomalyTextFormatters;
|
|
457
|
+
labels: AnomalyCardLabels;
|
|
458
|
+
}): AnomalyInsightSegment[];
|
|
459
|
+
/** Everything the hover chip shows for one period. */
|
|
460
|
+
interface AnomalyTooltipModel {
|
|
461
|
+
explanation: AnomalyExplanation;
|
|
462
|
+
/** This period is an excursion — the chip leads with the direction word. */
|
|
463
|
+
flagged: boolean;
|
|
464
|
+
directionText: string | null;
|
|
465
|
+
/** The flag's own hue, taken from the row rather than recomputed, so the chip and the mark can never disagree. */
|
|
466
|
+
color: string;
|
|
467
|
+
/** The flag's own shape, for the same reason. */
|
|
468
|
+
shape: AnomalyFlagShape;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* The hover chip's contents for one period — pure, so the reading is
|
|
472
|
+
* unit-tested rather than only reachable through a pointer event (Vega's own
|
|
473
|
+
* hit-testing needs a visible document, which a hidden frame does not give).
|
|
474
|
+
* Returns `null` for a period the card does not have.
|
|
475
|
+
*/
|
|
476
|
+
declare function buildAnomalyTooltip({ summary, x, formatters, labels }: {
|
|
477
|
+
summary: AnomalySummary | null | undefined;
|
|
478
|
+
/** The hovered period, as it arrives on the row. */
|
|
479
|
+
x: number | string | undefined;
|
|
480
|
+
formatters: AnomalyTextFormatters;
|
|
481
|
+
labels: AnomalyCardLabels;
|
|
482
|
+
}): AnomalyTooltipModel | null;
|
|
483
|
+
interface BuildAnomalyDescriptionInput {
|
|
484
|
+
name: string;
|
|
485
|
+
state: AnomalyCardState;
|
|
486
|
+
summary: AnomalySummary | null;
|
|
487
|
+
standing: AnomalyStanding;
|
|
488
|
+
formatters: AnomalyTextFormatters;
|
|
489
|
+
asOfText?: string;
|
|
490
|
+
labels: AnomalyCardLabels;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* The card's text equivalent (Amy Cesal's alt-text formula: what it is, what
|
|
494
|
+
* it shows, why it is here, when it was true) — the figure's accessible
|
|
495
|
+
* description, and the summary a screen reader gets before the parts. Every
|
|
496
|
+
* excursion is named with its span, so nothing lives only in the marks.
|
|
497
|
+
*/
|
|
498
|
+
declare function buildAnomalyDescription({ name, state, summary, standing, formatters, asOfText, labels }: BuildAnomalyDescriptionInput): string;
|
|
499
|
+
/** The plot's own `description` — the `aria-label` Vega stamps on the `graphics-document`. */
|
|
500
|
+
declare function buildAnomalyChartDescription({ name, mark, summary, formatters, labels }: {
|
|
501
|
+
name: string;
|
|
502
|
+
mark: AnomalyMark;
|
|
503
|
+
summary: AnomalySummary;
|
|
504
|
+
formatters: AnomalyTextFormatters;
|
|
505
|
+
labels: AnomalyCardLabels;
|
|
506
|
+
}): string;
|
|
507
|
+
//#endregion
|
|
508
|
+
export { AnomalyBounds, AnomalyCardLabels, AnomalyCardSize, AnomalyCardState, AnomalyCardStatus, AnomalyDeltaMode, AnomalyDirection, AnomalyEpisode, AnomalyExplanation, AnomalyFlagShape, AnomalyGoodDirection, AnomalyHeadline, AnomalyInsightSegment, AnomalyMark, AnomalyPeak, AnomalyPeriodRow, AnomalyPoint, AnomalyPolarity, AnomalyRow, AnomalyScale, AnomalySpanRow, AnomalyStanding, AnomalySummary, AnomalyTextFormatters, AnomalyTooltipModel, AnomalyVerdict, AnomalyXType, BuildAnomalyDescriptionInput, DEFAULT_ANOMALY_LABELS, DeriveAnomalyStateInput, NormalizeAnomalyOptions, anomalyAxisGranularity, anomalyColorFor, anomalyPolarityFor, anomalyShapeFor, buildAnomalyChartDescription, buildAnomalyDescription, buildAnomalyExplanation, buildAnomalyInsight, buildAnomalyPeriodRows, buildAnomalySpanRows, buildAnomalyTooltip, createAnomalyFormatters, deriveAnomalyStanding, deriveAnomalyState, normalizeAnomalies, resolveAnomalyLabels };
|