@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,392 @@
|
|
|
1
|
+
//#region src/components/ReportCard/ReportCard.model.d.ts
|
|
2
|
+
/** What the consumer's transport reports. */
|
|
3
|
+
type ReportCardStatus = "loading" | "ready" | "error";
|
|
4
|
+
/**
|
|
5
|
+
* What the card actually shows, derived from `status`, the criteria and
|
|
6
|
+
* `filtered`. Stamped on the root as `data-state`. `insufficient` is a list of
|
|
7
|
+
* criteria none of which is scored: there are rows to name but nothing to
|
|
8
|
+
* grade, so the rows carry a caption rather than a plot of empty tracks.
|
|
9
|
+
*/
|
|
10
|
+
type ReportCardState = "loading" | "refreshing" | "ready" | "insufficient" | "empty" | "no-match" | "error";
|
|
11
|
+
/** Which way is good for a criterion's raw reading: revenue up, cost down. Only used when a score is derived from `value`. */
|
|
12
|
+
type ReportGoodDirection = "up" | "down";
|
|
13
|
+
/**
|
|
14
|
+
* What a band means. `positive` and `negative` take the diverging ends,
|
|
15
|
+
* `warning` the degraded status hue, `neutral` the emphasis hue — the one
|
|
16
|
+
* place status hues belong on a mark, because a grade IS good or bad.
|
|
17
|
+
*/
|
|
18
|
+
type ReportBandTone = "positive" | "neutral" | "warning" | "negative";
|
|
19
|
+
/** How the score of a criterion was reached — stated in the table so a normalisation is never silent. */
|
|
20
|
+
type ReportScoreSource = "score" | "target" | "range" | "none";
|
|
21
|
+
/** How the overall score was reached. `given` is the consumer's own roll-up. */
|
|
22
|
+
type ReportOverallMode = "weighted" | "min" | "none";
|
|
23
|
+
type ReportOverallSource = ReportOverallMode | "given";
|
|
24
|
+
/** Row order: the consumer's, worst score first (the action list), best first, or by the weighted points a criterion costs the grade. */
|
|
25
|
+
type ReportSort = "none" | "worst" | "best" | "impact";
|
|
26
|
+
/** What the big number is: the overall score, its grade, or nothing. Stamped as `data-headline`. */
|
|
27
|
+
type ReportHeadline = "score" | "grade" | "none";
|
|
28
|
+
/** How the change against `previousScore` reads. Stamped as `data-polarity`. A score is always up-is-good. */
|
|
29
|
+
type ReportPolarity = "positive" | "negative" | "neutral";
|
|
30
|
+
type ReportCardSize = "sm" | "md" | "lg";
|
|
31
|
+
/** A row's part in the report — a criterion, or the fold of the long tail. */
|
|
32
|
+
type ReportRole = "criterion" | "other";
|
|
33
|
+
/** The score scale's two ends, `[floor, ceiling]` — the bars' baseline and a perfect score. */
|
|
34
|
+
type ReportScoreDomain = readonly [number, number];
|
|
35
|
+
/**
|
|
36
|
+
* One step of the grade ladder. `min` is the lowest score in the band; the
|
|
37
|
+
* band runs up to the next band's `min` (or the top of the scale), so the
|
|
38
|
+
* ladder needs no `max` and can never leave a gap.
|
|
39
|
+
*/
|
|
40
|
+
interface ReportBand {
|
|
41
|
+
/** Identifies the band for `data-grade` and the table. Defaults to `label`. */
|
|
42
|
+
key?: string;
|
|
43
|
+
/** What this grade is called — `Excellent`, `Meets standard`, `A`. */
|
|
44
|
+
label: string;
|
|
45
|
+
/** Lowest score in the band, inclusive. */
|
|
46
|
+
min: number;
|
|
47
|
+
/** What the grade means. Default `neutral`. */
|
|
48
|
+
tone?: ReportBandTone;
|
|
49
|
+
/** One or two characters for the row's grade column. Defaults to `label`. */
|
|
50
|
+
short?: string;
|
|
51
|
+
}
|
|
52
|
+
/** A band resolved against the scale: its span, its tone and its place in the ladder. */
|
|
53
|
+
interface ReportBandSpan {
|
|
54
|
+
key: string;
|
|
55
|
+
label: string;
|
|
56
|
+
short: string;
|
|
57
|
+
tone: ReportBandTone;
|
|
58
|
+
/** Lowest score in the band, inclusive — clipped to the plotted domain. */
|
|
59
|
+
from: number;
|
|
60
|
+
/** Top of the band, exclusive (inclusive at the ceiling) — clipped to the plotted domain. */
|
|
61
|
+
to: number;
|
|
62
|
+
/** 0 for the lowest band, upward — the neutral wash's intensity follows it. */
|
|
63
|
+
index: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* One thing the subject is graded on. A criterion resolves to exactly one
|
|
67
|
+
* score on the card's scale, by one of three routes, checked in order:
|
|
68
|
+
* `score` as given; `value` against `target` (attainment, ×100 — `down`
|
|
69
|
+
* criteria invert it, so staying under a budget scores above 100); `value`
|
|
70
|
+
* inside `range` (linear, `[worst, best]` — a reversed pair reads as
|
|
71
|
+
* lower-is-better). A criterion with none of those is unscored: its row stays,
|
|
72
|
+
* with no bar, and it is left out of the roll-up rather than counted as zero.
|
|
73
|
+
*/
|
|
74
|
+
interface ReportCriterion {
|
|
75
|
+
/** Identifies the criterion for `selected` and the table. Defaults to `label`. */
|
|
76
|
+
key?: string;
|
|
77
|
+
label: string;
|
|
78
|
+
/** The score itself, on the card's `scoreDomain`. Takes precedence over `value`. */
|
|
79
|
+
score?: number | null;
|
|
80
|
+
/** The raw reading in the criterion's own units — always shown as text, and the source of a derived score. */
|
|
81
|
+
value?: number | null;
|
|
82
|
+
/** The reading's goal, in the reading's units. With `value` it makes the score an attainment percentage. */
|
|
83
|
+
target?: number | null;
|
|
84
|
+
/** `[worst, best]` readings that map to the ends of the score scale. With `value` it makes the score a linear normalisation. */
|
|
85
|
+
range?: readonly [number, number];
|
|
86
|
+
/** Which way is good for this reading. Defaults to the card's `goodDirection`. */
|
|
87
|
+
goodDirection?: ReportGoodDirection;
|
|
88
|
+
/** How much this criterion counts in the roll-up. Default 1; non-finite and negative weights fall back to 1. */
|
|
89
|
+
weight?: number;
|
|
90
|
+
/** The score this criterion is expected to reach — the row's comparative tick. Defaults to the card's `passing`. */
|
|
91
|
+
targetScore?: number | null;
|
|
92
|
+
/** Number format for this criterion's raw reading, overriding the card's `format` — criteria rarely share units. */
|
|
93
|
+
format?: string;
|
|
94
|
+
/** One line of context, shown in the tooltip, the table and the selected row's detail line. */
|
|
95
|
+
note?: string;
|
|
96
|
+
}
|
|
97
|
+
/** A criterion after normalisation, in display order, with its score, grade and cost resolved. */
|
|
98
|
+
interface ReportRow {
|
|
99
|
+
key: string;
|
|
100
|
+
label: string;
|
|
101
|
+
role: ReportRole;
|
|
102
|
+
/** The score as reported — may sit above the scale's ceiling (140% of target is not clipped away). `null` when unscored. */
|
|
103
|
+
score: number | null;
|
|
104
|
+
/** The score the plot draws, clamped into the plotted domain. `null` when unscored. */
|
|
105
|
+
plotted: number | null;
|
|
106
|
+
/** Where the score came from. */
|
|
107
|
+
source: ReportScoreSource;
|
|
108
|
+
/** The raw reading, when there is one. */
|
|
109
|
+
value: number | null;
|
|
110
|
+
/** The reading's goal, when there is one. */
|
|
111
|
+
target: number | null;
|
|
112
|
+
/** The row's comparative tick, in the score domain. */
|
|
113
|
+
targetScore: number | null;
|
|
114
|
+
weight: number;
|
|
115
|
+
/** The band the score falls in. `null` when unscored. */
|
|
116
|
+
band: ReportBandSpan | null;
|
|
117
|
+
/** The band's tone, or `neutral` when unscored — what the bar is painted with. */
|
|
118
|
+
tone: ReportBandTone;
|
|
119
|
+
/** This row's share of the weighted overall: `score × weight / total weight`. `null` when unscored. */
|
|
120
|
+
contribution: number | null;
|
|
121
|
+
/** Weighted points this row costs a perfect overall: `(ceiling − score) × weight / total weight`. The ranking behind `sort="impact"`. */
|
|
122
|
+
shortfall: number | null;
|
|
123
|
+
/** Number format for the raw reading. */
|
|
124
|
+
format?: string;
|
|
125
|
+
note?: string;
|
|
126
|
+
}
|
|
127
|
+
/** The roll-up: one score, one grade, and how honestly it was reached. */
|
|
128
|
+
interface ReportOverall {
|
|
129
|
+
/** The composite score, or `null` when nothing is scored and none was given. */
|
|
130
|
+
score: number | null;
|
|
131
|
+
/** The band the composite falls in. */
|
|
132
|
+
band: ReportBandSpan | null;
|
|
133
|
+
/** How it was reached — `given` when the consumer supplied it. */
|
|
134
|
+
source: ReportOverallSource;
|
|
135
|
+
/** Criteria that carry a score. */
|
|
136
|
+
scored: number;
|
|
137
|
+
/** Criteria with no score — declared, never silently counted as zero. */
|
|
138
|
+
unscored: number;
|
|
139
|
+
/** Total weight behind the composite. */
|
|
140
|
+
weight: number;
|
|
141
|
+
/** The criteria do not all weigh the same, so the roll-up is a weighted mean and says so. */
|
|
142
|
+
weighted: boolean;
|
|
143
|
+
}
|
|
144
|
+
interface ReportSummary {
|
|
145
|
+
rows: ReportRow[];
|
|
146
|
+
bands: ReportBandSpan[];
|
|
147
|
+
overall: ReportOverall;
|
|
148
|
+
/** The domain the plot draws, `scoreDomain` widened to hold every score. */
|
|
149
|
+
domain: readonly [number, number];
|
|
150
|
+
/** The scale's declared floor — the bars' baseline, whatever the plotted domain grew to. */
|
|
151
|
+
floor: number;
|
|
152
|
+
/** The scale's declared ceiling — a perfect score, whatever the plotted domain grew to. */
|
|
153
|
+
ceiling: number;
|
|
154
|
+
/** The strongest and weakest scored rows — what the chart description names. */
|
|
155
|
+
best: ReportRow | null;
|
|
156
|
+
worst: ReportRow | null;
|
|
157
|
+
/** Criteria folded into the `Other` row; 0 when nothing was folded. */
|
|
158
|
+
folded: number;
|
|
159
|
+
}
|
|
160
|
+
/** The change of the overall score against `previousScore`, in points. */
|
|
161
|
+
interface ReportDelta {
|
|
162
|
+
direction: "up" | "down" | "flat";
|
|
163
|
+
polarity: ReportPolarity;
|
|
164
|
+
/** The change in score points, signed: `+6`. */
|
|
165
|
+
text: string;
|
|
166
|
+
points: number;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* The default ladder: a four-step grade on a 0–100 scale, lettered for the
|
|
170
|
+
* row column and worded for the headline. `Good` is neutral on purpose —
|
|
171
|
+
* meeting the standard is not a celebration; only `Excellent` earns the
|
|
172
|
+
* positive hue and only `Poor` the negative one.
|
|
173
|
+
*/
|
|
174
|
+
declare const DEFAULT_REPORT_BANDS: readonly ReportBand[];
|
|
175
|
+
/** The key of the row the long tail folds into. Never collides with a consumer key that is a label. */
|
|
176
|
+
declare const REPORT_OTHER_KEY = "__other__";
|
|
177
|
+
/** What the delta explanation and the description say about the overall roll-up. */
|
|
178
|
+
interface ReportOverallExplanation {
|
|
179
|
+
scoreText: string;
|
|
180
|
+
gradeLabel: string | null;
|
|
181
|
+
scored: number;
|
|
182
|
+
unscored: number;
|
|
183
|
+
weighted: boolean;
|
|
184
|
+
source: ReportOverallSource;
|
|
185
|
+
}
|
|
186
|
+
/** Every string the card renders or announces, so a product can localise it. Sentences are functions. */
|
|
187
|
+
interface ReportCardLabels {
|
|
188
|
+
/** Caption under the headline — `across 8 criteria`. */
|
|
189
|
+
criteriaCount: (count: number) => string;
|
|
190
|
+
/** Comparison line under the delta badge when `previousLabel` is omitted. */
|
|
191
|
+
versusPrevious: string;
|
|
192
|
+
increase: string;
|
|
193
|
+
decrease: string;
|
|
194
|
+
unchanged: string;
|
|
195
|
+
/** Suffix after a score delta — `+6 pts`. */
|
|
196
|
+
points: string;
|
|
197
|
+
/** Written after the overall score in the headline's unit slot — `/100`. */
|
|
198
|
+
outOf: (ceiling: string) => string;
|
|
199
|
+
/** Caption when some criteria carry no score. */
|
|
200
|
+
notMeasured: (unscored: number, total: number) => string;
|
|
201
|
+
/** The detail line for the selected row: its grade, its reading and what it is expected to reach. */
|
|
202
|
+
rowDetail: (input: {
|
|
203
|
+
label: string;
|
|
204
|
+
scoreText: string;
|
|
205
|
+
gradeLabel: string | null;
|
|
206
|
+
valueText: string | null;
|
|
207
|
+
targetText: string | null;
|
|
208
|
+
targetScoreText: string | null;
|
|
209
|
+
weightText: string | null;
|
|
210
|
+
note?: string;
|
|
211
|
+
}) => string;
|
|
212
|
+
/** Shown in place of a score a criterion does not have. */
|
|
213
|
+
unscored: string;
|
|
214
|
+
noData: string;
|
|
215
|
+
noMatch: string;
|
|
216
|
+
clearFilters: string;
|
|
217
|
+
error: string;
|
|
218
|
+
retry: string;
|
|
219
|
+
/** Shown in place of the plot when criteria exist but none is scored. */
|
|
220
|
+
insufficient: string;
|
|
221
|
+
stale: string;
|
|
222
|
+
asOf: string;
|
|
223
|
+
/** Column headers of the data table. */
|
|
224
|
+
tableCriterion: string;
|
|
225
|
+
tableValue: string;
|
|
226
|
+
tableTarget: string;
|
|
227
|
+
tableScore: string;
|
|
228
|
+
tableGrade: string;
|
|
229
|
+
tableWeight: string;
|
|
230
|
+
/** Header of the weighted points a criterion costs the overall. */
|
|
231
|
+
tableShortfall: string;
|
|
232
|
+
/** The overall row's name in the table. */
|
|
233
|
+
tableOverall: string;
|
|
234
|
+
/** Label of the row the long tail folds into. */
|
|
235
|
+
other: string;
|
|
236
|
+
/** Legend heading over the band ladder. */
|
|
237
|
+
bandsLegend: string;
|
|
238
|
+
/** A band's span in the legend — `75–90`. */
|
|
239
|
+
bandRange: (from: string, to: string) => string;
|
|
240
|
+
/** Tooltip title for a row's comparative tick. */
|
|
241
|
+
expected: string;
|
|
242
|
+
/** Read out after the selected row's label. */
|
|
243
|
+
selected: string;
|
|
244
|
+
weight: string;
|
|
245
|
+
showTable: (name: string) => string;
|
|
246
|
+
hideTable: (name: string) => string;
|
|
247
|
+
about: (name: string) => string;
|
|
248
|
+
loading: (name: string) => string;
|
|
249
|
+
tableCaption: (name: string) => string;
|
|
250
|
+
/** Accessible name of the selectable rows (a radio group). */
|
|
251
|
+
criteriaGroup: (name: string) => string;
|
|
252
|
+
/** The card's first sentence — the overall grade. */
|
|
253
|
+
overallSentence: (input: ReportOverallExplanation) => string;
|
|
254
|
+
/** Lists every row — `list` is `Delivery 92 Excellent, Quality 61 Fair, …`. */
|
|
255
|
+
criteriaSummary: (count: number, list: string) => string;
|
|
256
|
+
/** Appended when criteria were folded into Other. */
|
|
257
|
+
foldedSummary: (count: number) => string;
|
|
258
|
+
/** The change sentence in the description. */
|
|
259
|
+
changeSentence: (input: {
|
|
260
|
+
word: string;
|
|
261
|
+
points: string;
|
|
262
|
+
previous: string;
|
|
263
|
+
previousLabel: string;
|
|
264
|
+
}) => string;
|
|
265
|
+
/** The plot's own `aria-label`. */
|
|
266
|
+
chartDescription: (input: {
|
|
267
|
+
name: string;
|
|
268
|
+
count: number;
|
|
269
|
+
ceiling: string;
|
|
270
|
+
best: string;
|
|
271
|
+
bestScore: string;
|
|
272
|
+
worst: string;
|
|
273
|
+
worstScore: string;
|
|
274
|
+
bands: string;
|
|
275
|
+
}) => string;
|
|
276
|
+
/** Accessible name of the AI mark beside the insight sentence. */
|
|
277
|
+
insightMark: string;
|
|
278
|
+
}
|
|
279
|
+
declare const DEFAULT_REPORT_LABELS: ReportCardLabels;
|
|
280
|
+
declare function resolveReportLabels(overrides?: Partial<ReportCardLabels>): ReportCardLabels;
|
|
281
|
+
interface DeriveReportStateInput {
|
|
282
|
+
status: ReportCardStatus;
|
|
283
|
+
/** At least one criterion carries a score. */
|
|
284
|
+
hasScore: boolean;
|
|
285
|
+
/** Anything is on screen already — any criterion at all — so a reload is a refresh, not a first load. */
|
|
286
|
+
hasData: boolean;
|
|
287
|
+
filtered: boolean;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* The state machine. Error wins; loading over existing criteria is a refresh
|
|
291
|
+
* (the previous render stays under the veil); criteria with no scores at all
|
|
292
|
+
* is `insufficient` — the rows are real, the grade is not; nothing at all is
|
|
293
|
+
* `no-match` when the consumer's filter caused it and `empty` otherwise.
|
|
294
|
+
*/
|
|
295
|
+
declare function deriveReportState({ status, hasScore, hasData, filtered }: DeriveReportStateInput): ReportCardState;
|
|
296
|
+
/**
|
|
297
|
+
* Resolves the ladder against the scale: bands sorted low to high, each
|
|
298
|
+
* running up to the next one's floor and the last to the ceiling, clipped to
|
|
299
|
+
* the plotted domain so a stripe never paints outside the axis. Bands wholly
|
|
300
|
+
* below the floor or above the ceiling of the plotted domain are dropped.
|
|
301
|
+
*/
|
|
302
|
+
declare function normalizeBands(bands: readonly ReportBand[] | undefined, domain: readonly [number, number]): ReportBandSpan[];
|
|
303
|
+
/** The band a score falls in — the highest band whose floor it reaches; the lowest band catches anything under the ladder. */
|
|
304
|
+
declare function findBand(bands: readonly ReportBandSpan[], score: number | null | undefined): ReportBandSpan | null;
|
|
305
|
+
interface NormalizeCriteriaOptions {
|
|
306
|
+
bands?: readonly ReportBand[];
|
|
307
|
+
/** The declared score scale, `[floor, ceiling]`. Default `[0, 100]`. */
|
|
308
|
+
scoreDomain?: ReportScoreDomain;
|
|
309
|
+
/** Which way is good for a reading, when a criterion does not say. Default `up`. */
|
|
310
|
+
goodDirection?: ReportGoodDirection;
|
|
311
|
+
/** The score every criterion is expected to reach, when it does not name its own. */
|
|
312
|
+
passing?: number | null;
|
|
313
|
+
/** How the composite is reached. Default `weighted`. */
|
|
314
|
+
overallMode?: ReportOverallMode;
|
|
315
|
+
/** The consumer's own composite, which replaces the roll-up. */
|
|
316
|
+
overall?: number | null;
|
|
317
|
+
sort?: ReportSort;
|
|
318
|
+
/** Fold every criterion past this count (after sorting) into one `Other` row. */
|
|
319
|
+
maxCriteria?: number;
|
|
320
|
+
otherLabel: string;
|
|
321
|
+
}
|
|
322
|
+
/** The score a criterion resolves to, and the route it took. */
|
|
323
|
+
declare function resolveScore(criterion: ReportCriterion, { goodDirection, ceiling }?: {
|
|
324
|
+
goodDirection?: ReportGoodDirection;
|
|
325
|
+
ceiling?: number;
|
|
326
|
+
}): {
|
|
327
|
+
score: number | null;
|
|
328
|
+
source: ReportScoreSource;
|
|
329
|
+
};
|
|
330
|
+
/**
|
|
331
|
+
* Normalises `criteria` for the plot, the rows and the table: keys default to
|
|
332
|
+
* labels (a repeated key is suffixed so two rows never share a band), each
|
|
333
|
+
* criterion resolves to one score on the declared scale, the plotted domain
|
|
334
|
+
* widens to hold any score past the ends (a reading at 140% of target extends
|
|
335
|
+
* the axis rather than clipping to a full bar), the ladder is resolved and
|
|
336
|
+
* clipped to it, rows are sorted if asked, the tail past `maxCriteria` folds
|
|
337
|
+
* into one `Other` row whose score is the *weighted mean* of the folded rows
|
|
338
|
+
* (a mean folds honestly where a sum would not), and every row's contribution
|
|
339
|
+
* and weighted shortfall are computed against the total weight. Returns `null`
|
|
340
|
+
* when there are no criteria to speak of.
|
|
341
|
+
*/
|
|
342
|
+
declare function normalizeCriteria(criteria: readonly ReportCriterion[] | undefined, { bands, scoreDomain, goodDirection, passing, overallMode, overall, sort, maxCriteria, otherLabel }: NormalizeCriteriaOptions): ReportSummary | null;
|
|
343
|
+
/** The overall score against `previousScore`, in points. A score is always up-is-good, so the polarity follows the direction. */
|
|
344
|
+
declare function deriveReportDelta(score: number | null | undefined, previous: number | null | undefined, { scoreFormat, locale }?: {
|
|
345
|
+
scoreFormat?: string;
|
|
346
|
+
locale?: string;
|
|
347
|
+
}): ReportDelta | null;
|
|
348
|
+
interface ReportTextFormatters {
|
|
349
|
+
/** A score, in the card's score format. */
|
|
350
|
+
formatScore: (score: number | null | undefined) => string;
|
|
351
|
+
/** A raw reading, in the criterion's own format when it has one. */
|
|
352
|
+
formatValue: (value: number | null | undefined, format?: string) => string;
|
|
353
|
+
/** A weight — `×2`, and nothing at all for the default weight of 1. */
|
|
354
|
+
formatWeight: (weight: number) => string | null;
|
|
355
|
+
}
|
|
356
|
+
/** The formatters every text surface shares — headline, rows, detail line, table, tooltip, descriptions. */
|
|
357
|
+
declare function createReportFormatters({ scoreFormat, format, locale, formatScore, formatValue }: {
|
|
358
|
+
scoreFormat?: string;
|
|
359
|
+
format?: string;
|
|
360
|
+
locale?: string;
|
|
361
|
+
formatScore?: (score: number) => string;
|
|
362
|
+
formatValue?: (value: number) => string;
|
|
363
|
+
}): ReportTextFormatters;
|
|
364
|
+
interface BuildReportDescriptionInput {
|
|
365
|
+
name: string;
|
|
366
|
+
state: ReportCardState;
|
|
367
|
+
summary: ReportSummary | null;
|
|
368
|
+
delta: ReportDelta | null;
|
|
369
|
+
previousScore?: number | null;
|
|
370
|
+
previousLabel?: string;
|
|
371
|
+
formatters: ReportTextFormatters;
|
|
372
|
+
asOfText?: string;
|
|
373
|
+
labels: ReportCardLabels;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* The card's text equivalent (Amy Cesal's alt-text formula: what it is, what
|
|
377
|
+
* it shows, why it is here, when it was true) — the figure's accessible
|
|
378
|
+
* description, and the summary a screen reader gets before the parts. Every
|
|
379
|
+
* criterion is listed with its score and grade, so nothing lives only in the
|
|
380
|
+
* bars, and an unmeasured criterion is named as unmeasured rather than
|
|
381
|
+
* silently missing.
|
|
382
|
+
*/
|
|
383
|
+
declare function buildReportDescription({ name, state, summary, delta, previousScore, previousLabel, formatters, asOfText, labels }: BuildReportDescriptionInput): string;
|
|
384
|
+
/** The plot's own `description` — the `aria-label` Vega stamps on the `graphics-document`. */
|
|
385
|
+
declare function buildReportChartDescription({ name, summary, formatters, labels }: {
|
|
386
|
+
name: string;
|
|
387
|
+
summary: ReportSummary;
|
|
388
|
+
formatters: ReportTextFormatters;
|
|
389
|
+
labels: ReportCardLabels;
|
|
390
|
+
}): string;
|
|
391
|
+
//#endregion
|
|
392
|
+
export { BuildReportDescriptionInput, DEFAULT_REPORT_BANDS, DEFAULT_REPORT_LABELS, DeriveReportStateInput, NormalizeCriteriaOptions, REPORT_OTHER_KEY, ReportBand, ReportBandSpan, ReportBandTone, ReportCardLabels, ReportCardSize, ReportCardState, ReportCardStatus, ReportCriterion, ReportDelta, ReportGoodDirection, ReportHeadline, ReportOverall, ReportOverallExplanation, ReportOverallMode, ReportOverallSource, ReportPolarity, ReportRole, ReportRow, ReportScoreDomain, ReportScoreSource, ReportSort, ReportSummary, ReportTextFormatters, buildReportChartDescription, buildReportDescription, createReportFormatters, deriveReportDelta, deriveReportState, findBand, normalizeBands, normalizeCriteria, resolveReportLabels, resolveScore };
|