@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,497 @@
|
|
|
1
|
+
import { ArcDeltaDirection, ArcDeltaMode, ArcTimeGranularity } from "../../lib/vega/formatters.js";
|
|
2
|
+
//#region src/components/ForecastCard/ForecastCard.model.d.ts
|
|
3
|
+
/** What the consumer's transport reports. */
|
|
4
|
+
type ForecastCardStatus = "loading" | "ready" | "error";
|
|
5
|
+
/**
|
|
6
|
+
* What the card actually shows, derived from `status`, the readings and
|
|
7
|
+
* `filtered`. Stamped on the root as `data-state`.
|
|
8
|
+
*/
|
|
9
|
+
type ForecastCardState = "loading" | "refreshing" | "ready" | "empty" | "no-match" | "error";
|
|
10
|
+
/** Which way is good for this measure: revenue up, cost down, headcount neutral. */
|
|
11
|
+
type ForecastGoodDirection = "up" | "down" | "none";
|
|
12
|
+
/** How the projected change reads once `goodDirection` is applied. Stamped as `data-polarity`. */
|
|
13
|
+
type ForecastPolarity = "positive" | "negative" | "neutral";
|
|
14
|
+
type ForecastDeltaMode = ArcDeltaMode;
|
|
15
|
+
/**
|
|
16
|
+
* How the measured half is drawn. `line` may crop; `area` fills it from zero.
|
|
17
|
+
* The projected half is never filled from zero either way — the ink you can
|
|
18
|
+
* trust there is the interval, not the magnitude.
|
|
19
|
+
*/
|
|
20
|
+
type ForecastMark = "line" | "area";
|
|
21
|
+
type ForecastScale = "auto" | "zero";
|
|
22
|
+
type ForecastCardSize = "sm" | "md" | "lg";
|
|
23
|
+
/**
|
|
24
|
+
* The big number. `landing` (default) is where the forecast ends, with its
|
|
25
|
+
* interval underneath; `latest` is the last measured reading; `change` makes
|
|
26
|
+
* the projected move itself the number; `none` leaves the plot to carry the
|
|
27
|
+
* panel. Stamped as `data-headline`.
|
|
28
|
+
*/
|
|
29
|
+
type ForecastHeadline = "landing" | "latest" | "change" | "none";
|
|
30
|
+
type ForecastXType = "temporal" | "quantitative" | "ordinal";
|
|
31
|
+
/** Which half of the axis a period belongs to — measured, or projected. */
|
|
32
|
+
type ForecastKind = "actual" | "forecast";
|
|
33
|
+
/**
|
|
34
|
+
* Where the target sits relative to the forecast's interval at the horizon —
|
|
35
|
+
* the verdict only a forecast WITH uncertainty can honestly give. `likely`: the
|
|
36
|
+
* whole interval reaches the target. `unlikely`: none of it does. `uncertain`:
|
|
37
|
+
* the target falls inside the interval, so the data does not decide. `none`: no
|
|
38
|
+
* target, no landing, or `goodDirection: "none"` — reaching is undefined
|
|
39
|
+
* without a direction, and the card does not guess. Stamped as `data-outlook`.
|
|
40
|
+
*/
|
|
41
|
+
type ForecastOutlook = "likely" | "uncertain" | "unlikely" | "none";
|
|
42
|
+
/**
|
|
43
|
+
* One reading. `{ x, y }` is Cloudscape's point contract; a forecast point may
|
|
44
|
+
* also carry the bounds of its prediction interval. `y` is `null` for a period
|
|
45
|
+
* with no reading — drawn as a gap, never as zero — and `lower`/`upper` are
|
|
46
|
+
* optional per point, so a path may be certain at its start and uncertain later.
|
|
47
|
+
*/
|
|
48
|
+
interface ForecastPoint {
|
|
49
|
+
x: Date | string | number;
|
|
50
|
+
y: number | null;
|
|
51
|
+
/** Lower bound of the interval at this period. Ignored unless `upper` is finite too. */
|
|
52
|
+
lower?: number | null;
|
|
53
|
+
/** Upper bound of the interval at this period. */
|
|
54
|
+
upper?: number | null;
|
|
55
|
+
}
|
|
56
|
+
/** A period in the shape the plot reads: the value, its bounds, and which half of the axis it is on. */
|
|
57
|
+
interface ForecastRow {
|
|
58
|
+
x: number | string;
|
|
59
|
+
y: number | null;
|
|
60
|
+
/** Interval bounds, `null` where the period has none. */
|
|
61
|
+
lo: number | null;
|
|
62
|
+
hi: number | null;
|
|
63
|
+
k: ForecastKind;
|
|
64
|
+
/** The paintable colour, baked into the row so the spec stays structural. */
|
|
65
|
+
c: string;
|
|
66
|
+
/** The measure's name, for Vega's own aria text. */
|
|
67
|
+
n: string;
|
|
68
|
+
}
|
|
69
|
+
/** One row per period — the crosshair's own dataset, so the nearest-point selection is unambiguous. */
|
|
70
|
+
interface ForecastPeriodRow {
|
|
71
|
+
x: number | string;
|
|
72
|
+
}
|
|
73
|
+
/** The projected stretch of the axis, as a single washed rect. */
|
|
74
|
+
interface ForecastRegionRow {
|
|
75
|
+
start: number | string;
|
|
76
|
+
end: number | string;
|
|
77
|
+
}
|
|
78
|
+
/** A period with everything the table, the tooltip and the text equivalents need. */
|
|
79
|
+
interface ForecastReading {
|
|
80
|
+
x: number | string;
|
|
81
|
+
y: number | null;
|
|
82
|
+
lower: number | null;
|
|
83
|
+
upper: number | null;
|
|
84
|
+
kind: ForecastKind;
|
|
85
|
+
}
|
|
86
|
+
/** A reading that is certain to have a value — the latest, the landing, a crossing. */
|
|
87
|
+
interface ForecastMoment {
|
|
88
|
+
x: number | string;
|
|
89
|
+
y: number;
|
|
90
|
+
lower: number | null;
|
|
91
|
+
upper: number | null;
|
|
92
|
+
}
|
|
93
|
+
interface ForecastSummary {
|
|
94
|
+
xType: ForecastXType;
|
|
95
|
+
granularity: ArcTimeGranularity;
|
|
96
|
+
/** Every period, measured then projected, in axis order. */
|
|
97
|
+
periods: (number | string)[];
|
|
98
|
+
/** One entry per period, in the same order — the table twin's rows. */
|
|
99
|
+
readings: ForecastReading[];
|
|
100
|
+
/**
|
|
101
|
+
* Plot rows. The last measured reading appears TWICE — once as `actual` and
|
|
102
|
+
* once as the projected path's anchor — so the solid and dashed paths meet
|
|
103
|
+
* instead of leaving a gap at the boundary. `readings` carries it once.
|
|
104
|
+
*/
|
|
105
|
+
rows: ForecastRow[];
|
|
106
|
+
/** Interval rows: the anchor (a zero-width band at the last reading) and every projected period with finite bounds. */
|
|
107
|
+
interval: {
|
|
108
|
+
x: number | string;
|
|
109
|
+
lo: number;
|
|
110
|
+
hi: number;
|
|
111
|
+
}[];
|
|
112
|
+
/** The last measured period — where the axis stops being data. `null` when nothing is measured. */
|
|
113
|
+
boundary: number | string | null;
|
|
114
|
+
/** The last measured reading. */
|
|
115
|
+
latest: ForecastMoment | null;
|
|
116
|
+
/** The last projected reading — where the forecast lands. */
|
|
117
|
+
landing: ForecastMoment | null;
|
|
118
|
+
/** Measured periods carrying a finite reading. */
|
|
119
|
+
actualCount: number;
|
|
120
|
+
/** Projected periods carrying a finite reading. */
|
|
121
|
+
forecastCount: number;
|
|
122
|
+
/** Projected periods carrying a finite interval. */
|
|
123
|
+
intervalCount: number;
|
|
124
|
+
/** The extent the y scale must span — bounds included, since the band is drawn. */
|
|
125
|
+
min: number | null;
|
|
126
|
+
max: number | null;
|
|
127
|
+
hasNegative: boolean;
|
|
128
|
+
}
|
|
129
|
+
interface ForecastDelta {
|
|
130
|
+
direction: ArcDeltaDirection;
|
|
131
|
+
polarity: ForecastPolarity;
|
|
132
|
+
/** Signed, formatted change: `+12.4%`, `-0.3 pp`, `+฿124K`. */
|
|
133
|
+
text: string;
|
|
134
|
+
renderedMode: ArcDeltaMode;
|
|
135
|
+
/** The same change in the other form, or `null` when it does not exist (a zero baseline has no percent). */
|
|
136
|
+
secondaryText: string | null;
|
|
137
|
+
}
|
|
138
|
+
/** The move the forecast projects, from the last measured reading to the landing. */
|
|
139
|
+
interface ForecastProjection {
|
|
140
|
+
from: ForecastMoment;
|
|
141
|
+
to: ForecastMoment;
|
|
142
|
+
/** The span as text — `Sep 7 – Nov 2, 2026`. */
|
|
143
|
+
rangeText: string;
|
|
144
|
+
delta: ForecastDelta;
|
|
145
|
+
}
|
|
146
|
+
/** A piece of a generated insight sentence: plain text, or a value the card sets in bold. */
|
|
147
|
+
type ForecastInsightSegment = string | {
|
|
148
|
+
value: string;
|
|
149
|
+
};
|
|
150
|
+
/** What the change tooltip explains: the two readings behind the badge and the change in both forms. */
|
|
151
|
+
interface ForecastDeltaExplanation {
|
|
152
|
+
fromLabel: string;
|
|
153
|
+
fromText: string;
|
|
154
|
+
toLabel: string;
|
|
155
|
+
toText: string;
|
|
156
|
+
changeText: string;
|
|
157
|
+
secondaryText: string | null;
|
|
158
|
+
renderedMode: ArcDeltaMode;
|
|
159
|
+
direction: ArcDeltaDirection;
|
|
160
|
+
/** The landing's interval, when it has one. */
|
|
161
|
+
rangeText: string | null;
|
|
162
|
+
}
|
|
163
|
+
/** Every string the card renders or announces, so a product can localise it. Sentences are functions. */
|
|
164
|
+
interface ForecastCardLabels {
|
|
165
|
+
increase: string;
|
|
166
|
+
decrease: string;
|
|
167
|
+
unchanged: string;
|
|
168
|
+
/** Suffix for a percentage-point delta. */
|
|
169
|
+
percentagePoints: string;
|
|
170
|
+
noData: string;
|
|
171
|
+
noMatch: string;
|
|
172
|
+
clearFilters: string;
|
|
173
|
+
error: string;
|
|
174
|
+
retry: string;
|
|
175
|
+
/** Shown in place of the plot when there are fewer than two periods to draw. */
|
|
176
|
+
insufficient: string;
|
|
177
|
+
/** Caption under a plot that has history but nothing projected — a forecast card must say when it has no forecast. */
|
|
178
|
+
noForecast: string;
|
|
179
|
+
stale: string;
|
|
180
|
+
asOf: string;
|
|
181
|
+
/** Mark keys, the table's kind column and the legend row. */
|
|
182
|
+
actual: string;
|
|
183
|
+
forecast: string;
|
|
184
|
+
interval: string;
|
|
185
|
+
target: string;
|
|
186
|
+
/** The rule at the last measured period. */
|
|
187
|
+
boundary: string;
|
|
188
|
+
tablePeriod: string;
|
|
189
|
+
tableValue: string;
|
|
190
|
+
tableKind: string;
|
|
191
|
+
tableInterval: string;
|
|
192
|
+
/**
|
|
193
|
+
* The description's opening sentence: the name, the big number, and what
|
|
194
|
+
* that number IS. A caption is a fragment written for the card face, so it is
|
|
195
|
+
* placed rather than case-folded into a sentence — folding it would rewrite
|
|
196
|
+
* the date inside it.
|
|
197
|
+
*/
|
|
198
|
+
headlineSentence: (input: {
|
|
199
|
+
name: string;
|
|
200
|
+
value: string;
|
|
201
|
+
caption: string;
|
|
202
|
+
}) => string;
|
|
203
|
+
/** Headline captions: what the big number IS, since a projection is not a reading. */
|
|
204
|
+
landingCaption: (period: string) => string;
|
|
205
|
+
latestCaption: (period: string) => string;
|
|
206
|
+
/** The interval under the headline — `฿2.3M – ฿2.9M`, named by its level when there is one. */
|
|
207
|
+
intervalCaption: (range: string, level: string | null) => string;
|
|
208
|
+
/**
|
|
209
|
+
* The interval's name in the key row and the tooltip — `90% interval`. A
|
|
210
|
+
* function rather than `level + interval`, so a localisation is not at the
|
|
211
|
+
* mercy of case folding or word order.
|
|
212
|
+
*/
|
|
213
|
+
intervalKey: (level: string | null) => string;
|
|
214
|
+
/** A confidence level as text — `90%`. */
|
|
215
|
+
levelText: (level: number) => string;
|
|
216
|
+
/** The verdict chip. */
|
|
217
|
+
outlook: Record<Exclude<ForecastOutlook, "none">, string>;
|
|
218
|
+
/** The verdict chip's accessible explanation. */
|
|
219
|
+
outlookExplanation: (input: {
|
|
220
|
+
outlook: Exclude<ForecastOutlook, "none">;
|
|
221
|
+
target: string;
|
|
222
|
+
landing: string;
|
|
223
|
+
range: string | null;
|
|
224
|
+
horizon: string;
|
|
225
|
+
}) => string;
|
|
226
|
+
/** The crossing sentence — when the path reaches the target. */
|
|
227
|
+
crossesAt: (period: string) => string;
|
|
228
|
+
/** Shown when the path never reaches the target inside the horizon. */
|
|
229
|
+
noCrossing: string;
|
|
230
|
+
showTable: (name: string) => string;
|
|
231
|
+
hideTable: (name: string) => string;
|
|
232
|
+
about: (name: string) => string;
|
|
233
|
+
loading: (name: string) => string;
|
|
234
|
+
tableCaption: (name: string) => string;
|
|
235
|
+
/** Accessible name of the change group beside the value. */
|
|
236
|
+
changeGroup: (name: string) => string;
|
|
237
|
+
/** Compact label/value rows explaining the change badge. */
|
|
238
|
+
deltaExplanation: (delta: ForecastDeltaExplanation) => readonly (readonly [label: string, value: string])[];
|
|
239
|
+
/** The projection sentence in the card description. */
|
|
240
|
+
projectionSentence: (input: {
|
|
241
|
+
word: string;
|
|
242
|
+
primary: string;
|
|
243
|
+
secondary: string | null;
|
|
244
|
+
from: string;
|
|
245
|
+
to: string;
|
|
246
|
+
horizon: string;
|
|
247
|
+
}) => string;
|
|
248
|
+
/** The interval sentence in the card description. */
|
|
249
|
+
intervalSentence: (input: {
|
|
250
|
+
low: string;
|
|
251
|
+
high: string;
|
|
252
|
+
level: string | null;
|
|
253
|
+
horizon: string;
|
|
254
|
+
}) => string;
|
|
255
|
+
/** Names the measured span behind the projection. */
|
|
256
|
+
historySentence: (input: {
|
|
257
|
+
count: number;
|
|
258
|
+
range: string;
|
|
259
|
+
latest: string;
|
|
260
|
+
}) => string;
|
|
261
|
+
/** Appended when some projected periods carry no interval. */
|
|
262
|
+
partialIntervalSentence: (input: {
|
|
263
|
+
with: number;
|
|
264
|
+
total: number;
|
|
265
|
+
}) => string;
|
|
266
|
+
markNames: Record<ForecastMark, string>;
|
|
267
|
+
/** The plot's own `aria-label`. */
|
|
268
|
+
chartDescription: (input: {
|
|
269
|
+
mark: string;
|
|
270
|
+
name: string;
|
|
271
|
+
actualCount: number;
|
|
272
|
+
forecastCount: number;
|
|
273
|
+
range: string;
|
|
274
|
+
min: string;
|
|
275
|
+
max: string;
|
|
276
|
+
boundary: string | null;
|
|
277
|
+
interval: string | null;
|
|
278
|
+
target: string | null;
|
|
279
|
+
}) => string;
|
|
280
|
+
/** Accessible name of the AI mark beside the insight sentence. */
|
|
281
|
+
insightMark: string;
|
|
282
|
+
/**
|
|
283
|
+
* The generated insight, as segments so the readings and the change render in
|
|
284
|
+
* bold while the words stay plain.
|
|
285
|
+
*/
|
|
286
|
+
insight: (input: {
|
|
287
|
+
name: string;
|
|
288
|
+
direction: ArcDeltaDirection;
|
|
289
|
+
from: string;
|
|
290
|
+
to: string;
|
|
291
|
+
change: string;
|
|
292
|
+
horizon: string;
|
|
293
|
+
low: string | null;
|
|
294
|
+
high: string | null;
|
|
295
|
+
level: string | null;
|
|
296
|
+
outlook: ForecastOutlook;
|
|
297
|
+
target: string | null;
|
|
298
|
+
crossesAt: string | null;
|
|
299
|
+
}) => ForecastInsightSegment[];
|
|
300
|
+
}
|
|
301
|
+
declare const DEFAULT_FORECAST_LABELS: ForecastCardLabels;
|
|
302
|
+
declare function resolveForecastLabels(overrides?: Partial<ForecastCardLabels>): ForecastCardLabels;
|
|
303
|
+
interface DeriveForecastStateInput {
|
|
304
|
+
status: ForecastCardStatus;
|
|
305
|
+
/** At least one reading exists, measured or projected. */
|
|
306
|
+
hasValue: boolean;
|
|
307
|
+
/** Anything is on screen already, so a reload is a refresh, not a first load. */
|
|
308
|
+
hasData: boolean;
|
|
309
|
+
filtered: boolean;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* The state machine. Error wins; loading over existing readings is a refresh
|
|
313
|
+
* (the previous render stays under the veil); no readings is `no-match` when
|
|
314
|
+
* the consumer's filter caused it and `empty` otherwise.
|
|
315
|
+
*/
|
|
316
|
+
declare function deriveForecastState({ status, hasValue, hasData, filtered }: DeriveForecastStateInput): ForecastCardState;
|
|
317
|
+
/**
|
|
318
|
+
* The granularity an x axis labels its ticks at: the tooltip and the table keep
|
|
319
|
+
* the full form (`Sep 8, 2026`); an axis has room for `Sep 8`. Duplicated per
|
|
320
|
+
* component rather than shared, so a card's text grammar is readable in one
|
|
321
|
+
* file — the same reason each card owns its own state machine.
|
|
322
|
+
*/
|
|
323
|
+
declare function forecastAxisGranularity(granularity: ArcTimeGranularity): ArcTimeGranularity;
|
|
324
|
+
interface NormalizeForecastOptions {
|
|
325
|
+
granularity?: ArcTimeGranularity;
|
|
326
|
+
/** The measure's name, baked into every row for Vega's aria text. */
|
|
327
|
+
name: string;
|
|
328
|
+
/** The one hue the whole card paints with — actual, forecast and interval are the same measure. */
|
|
329
|
+
color: string;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Lays the measured and the projected readings onto one period domain.
|
|
333
|
+
*
|
|
334
|
+
* The two halves stay distinguishable at every level: each period carries its
|
|
335
|
+
* `kind`, the projected half is the only one with interval bounds, and the plot
|
|
336
|
+
* rows repeat the last measured reading as the projected path's ANCHOR so the
|
|
337
|
+
* solid and dashed paths meet — the interval opens from that anchor at zero
|
|
338
|
+
* width, which is what makes a fan read as growing uncertainty rather than as a
|
|
339
|
+
* band that appears from nowhere. `readings` carries the anchor once, so the
|
|
340
|
+
* table and the description never double-count it.
|
|
341
|
+
*
|
|
342
|
+
* A projected period that repeats a measured one is dropped: a forecast cannot
|
|
343
|
+
* overwrite a reading. Returns `null` when there is nothing at all to show.
|
|
344
|
+
*/
|
|
345
|
+
declare function normalizeForecast(actual: readonly ForecastPoint[] | undefined, forecast: readonly ForecastPoint[] | undefined, { granularity, name, color }: NormalizeForecastOptions): ForecastSummary | null;
|
|
346
|
+
/** The periods the crosshair reads — one row each, so it lands on the period rather than on a mark. */
|
|
347
|
+
declare function buildForecastPeriodRows(summary: ForecastSummary): ForecastPeriodRow[];
|
|
348
|
+
/**
|
|
349
|
+
* The projected stretch as one washed rect, from the last measured period to
|
|
350
|
+
* the horizon — the ground under everything the card did not measure. Empty
|
|
351
|
+
* when nothing is projected, so a card with history alone draws no wash.
|
|
352
|
+
*/
|
|
353
|
+
declare function buildForecastRegionRows(summary: ForecastSummary): ForecastRegionRow[];
|
|
354
|
+
/** Zero or one row — the rule at the last measured period. */
|
|
355
|
+
declare function buildForecastBoundaryRows(summary: ForecastSummary): ForecastPeriodRow[];
|
|
356
|
+
/** Zero or one row — where the landing label sits. */
|
|
357
|
+
declare function buildForecastLandingRows(summary: ForecastSummary, text: string): {
|
|
358
|
+
x: number | string;
|
|
359
|
+
y: number;
|
|
360
|
+
n: string;
|
|
361
|
+
c: string;
|
|
362
|
+
}[];
|
|
363
|
+
/** Whether a value reaches the target, given which direction is good. `null` when reaching is undefined. */
|
|
364
|
+
declare function reachesTarget(value: number, target: number, goodDirection: ForecastGoodDirection): boolean | null;
|
|
365
|
+
interface DeriveForecastOutlookInput {
|
|
366
|
+
landing: ForecastMoment | null;
|
|
367
|
+
target?: number | null;
|
|
368
|
+
goodDirection: ForecastGoodDirection;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* The verdict the interval supports, and nothing more: `likely` when the WHOLE
|
|
372
|
+
* interval reaches the target, `unlikely` when none of it does, `uncertain`
|
|
373
|
+
* when the target falls inside it — the honest answer a point estimate cannot
|
|
374
|
+
* give. Without an interval the point estimate decides between `likely` and
|
|
375
|
+
* `unlikely` (the card says so in its explanation); without a target, a landing
|
|
376
|
+
* or a direction, there is no verdict at all.
|
|
377
|
+
*/
|
|
378
|
+
declare function deriveForecastOutlook({ landing, target, goodDirection }: DeriveForecastOutlookInput): ForecastOutlook;
|
|
379
|
+
/**
|
|
380
|
+
* The first projected period whose reading reaches the target — the "when" a
|
|
381
|
+
* forecast is really asked for. `null` when the last measured reading already
|
|
382
|
+
* reaches it (there is nothing to wait for), when the path never gets there, or
|
|
383
|
+
* when reaching is undefined.
|
|
384
|
+
*/
|
|
385
|
+
declare function deriveForecastCrossing(summary: ForecastSummary | null | undefined, target: number | null | undefined, goodDirection: ForecastGoodDirection): ForecastMoment | null;
|
|
386
|
+
interface DeriveForecastDeltaOptions {
|
|
387
|
+
deltaMode: ForecastDeltaMode;
|
|
388
|
+
goodDirection: ForecastGoodDirection;
|
|
389
|
+
format: string;
|
|
390
|
+
locale?: string;
|
|
391
|
+
percentagePoints: string;
|
|
392
|
+
}
|
|
393
|
+
/** A change between two readings, with polarity resolved through `goodDirection`. */
|
|
394
|
+
declare function deriveForecastDelta(value: number | null | undefined, previous: number | null | undefined, { deltaMode, goodDirection, format, locale, percentagePoints }: DeriveForecastDeltaOptions): ForecastDelta | null;
|
|
395
|
+
interface DeriveForecastProjectionOptions extends DeriveForecastDeltaOptions {
|
|
396
|
+
formatters: ForecastTextFormatters;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* The move from the last measured reading to the landing. `null` unless the
|
|
400
|
+
* card has both — a forecast with no history to leave from, or a history with
|
|
401
|
+
* nothing projected, has no projected change to state.
|
|
402
|
+
*/
|
|
403
|
+
declare function deriveForecastProjection(summary: ForecastSummary | null | undefined, { formatters, ...deltaOptions }: DeriveForecastProjectionOptions): ForecastProjection | null;
|
|
404
|
+
interface ForecastTextFormatters {
|
|
405
|
+
/** A reading in the card's own grammar. */
|
|
406
|
+
formatValue: (value: number | null | undefined) => string;
|
|
407
|
+
formatX: (x: number | string) => string;
|
|
408
|
+
/** A span between two `x` values — a collapsed date range for a temporal axis, `start – end` otherwise. */
|
|
409
|
+
formatXRange: (start: number | string, end: number | string) => string;
|
|
410
|
+
/** An interval as text — `฿2.3M – ฿2.9M`. `null` when either bound is missing. */
|
|
411
|
+
formatInterval: (lower: number | null | undefined, upper: number | null | undefined) => string | null;
|
|
412
|
+
}
|
|
413
|
+
/** The formatters every text surface shares — headline, badge, table, tooltip, descriptions. */
|
|
414
|
+
declare function createForecastFormatters({ format, locale, timeZone, formatValue, xType, granularity }: {
|
|
415
|
+
format: string;
|
|
416
|
+
locale?: string;
|
|
417
|
+
timeZone?: string;
|
|
418
|
+
formatValue?: (value: number) => string;
|
|
419
|
+
xType: ForecastXType;
|
|
420
|
+
granularity: ArcTimeGranularity;
|
|
421
|
+
}): ForecastTextFormatters;
|
|
422
|
+
/** Everything the hover chip shows for one period. */
|
|
423
|
+
interface ForecastTooltipModel {
|
|
424
|
+
periodText: string;
|
|
425
|
+
kind: ForecastKind;
|
|
426
|
+
kindText: string;
|
|
427
|
+
valueText: string;
|
|
428
|
+
/** The interval at this period, or `null` where there is none. */
|
|
429
|
+
intervalText: string | null;
|
|
430
|
+
targetText: string | null;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* The hover chip's contents for one period — pure, so the reading is
|
|
434
|
+
* unit-tested rather than only reachable through a pointer event (Vega's own
|
|
435
|
+
* hit-testing needs a visible document, which a hidden frame does not give).
|
|
436
|
+
* Returns `null` for a period the card does not have.
|
|
437
|
+
*/
|
|
438
|
+
declare function buildForecastTooltip({ summary, x, target, formatters, labels }: {
|
|
439
|
+
summary: ForecastSummary | null | undefined;
|
|
440
|
+
/** The hovered period, as it arrives on the row. */
|
|
441
|
+
x: number | string | undefined;
|
|
442
|
+
target?: number | null;
|
|
443
|
+
formatters: ForecastTextFormatters;
|
|
444
|
+
labels: ForecastCardLabels;
|
|
445
|
+
}): ForecastTooltipModel | null;
|
|
446
|
+
interface BuildForecastInsightInput {
|
|
447
|
+
name: string;
|
|
448
|
+
summary: ForecastSummary;
|
|
449
|
+
projection: ForecastProjection | null;
|
|
450
|
+
outlook: ForecastOutlook;
|
|
451
|
+
crossing: ForecastMoment | null;
|
|
452
|
+
target?: number | null;
|
|
453
|
+
level?: number | null;
|
|
454
|
+
formatters: ForecastTextFormatters;
|
|
455
|
+
labels: ForecastCardLabels;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* The generated insight — what the card shows beside the AI mark when the
|
|
459
|
+
* consumer passes no `insight`: where the measure lands, the move that takes it
|
|
460
|
+
* there, the interval around it, and what that means for the target. Values
|
|
461
|
+
* come back as `{ value }` segments so the card can set them in bold.
|
|
462
|
+
*/
|
|
463
|
+
declare function buildForecastInsight({ name, summary, projection, outlook, crossing, target, level, formatters, labels }: BuildForecastInsightInput): ForecastInsightSegment[] | null;
|
|
464
|
+
interface BuildForecastDescriptionInput {
|
|
465
|
+
name: string;
|
|
466
|
+
state: ForecastCardState;
|
|
467
|
+
headline: ForecastHeadline;
|
|
468
|
+
summary: ForecastSummary | null;
|
|
469
|
+
projection: ForecastProjection | null;
|
|
470
|
+
outlook: ForecastOutlook;
|
|
471
|
+
crossing: ForecastMoment | null;
|
|
472
|
+
target?: number | null;
|
|
473
|
+
level?: number | null;
|
|
474
|
+
formatters: ForecastTextFormatters;
|
|
475
|
+
asOfText?: string;
|
|
476
|
+
labels: ForecastCardLabels;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* The card's text equivalent (Amy Cesal's alt-text formula: what it is, what it
|
|
480
|
+
* shows, why it is here, when it was true) — the figure's accessible
|
|
481
|
+
* description, and the summary a screen reader gets before the parts. The
|
|
482
|
+
* landing, its interval, the measured span behind it and the verdict are all
|
|
483
|
+
* here, so nothing the plot says lives only in the marks.
|
|
484
|
+
*/
|
|
485
|
+
declare function buildForecastDescription({ name, state, headline, summary, projection, outlook, crossing, target, level, formatters, asOfText, labels }: BuildForecastDescriptionInput): string;
|
|
486
|
+
/** The plot's own `description` — the `aria-label` Vega stamps on the `graphics-document`. */
|
|
487
|
+
declare function buildForecastChartDescription({ name, mark, summary, level, formatters, targetText, labels }: {
|
|
488
|
+
name: string;
|
|
489
|
+
mark: ForecastMark;
|
|
490
|
+
summary: ForecastSummary;
|
|
491
|
+
level?: number | null;
|
|
492
|
+
formatters: ForecastTextFormatters;
|
|
493
|
+
targetText?: string | null;
|
|
494
|
+
labels: ForecastCardLabels;
|
|
495
|
+
}): string;
|
|
496
|
+
//#endregion
|
|
497
|
+
export { BuildForecastDescriptionInput, BuildForecastInsightInput, DEFAULT_FORECAST_LABELS, DeriveForecastDeltaOptions, DeriveForecastOutlookInput, DeriveForecastProjectionOptions, DeriveForecastStateInput, ForecastCardLabels, ForecastCardSize, ForecastCardState, ForecastCardStatus, ForecastDelta, ForecastDeltaExplanation, ForecastDeltaMode, ForecastGoodDirection, ForecastHeadline, ForecastInsightSegment, ForecastKind, ForecastMark, ForecastMoment, ForecastOutlook, ForecastPeriodRow, ForecastPoint, ForecastPolarity, ForecastProjection, ForecastReading, ForecastRegionRow, ForecastRow, ForecastScale, ForecastSummary, ForecastTextFormatters, ForecastTooltipModel, ForecastXType, NormalizeForecastOptions, buildForecastBoundaryRows, buildForecastChartDescription, buildForecastDescription, buildForecastInsight, buildForecastLandingRows, buildForecastPeriodRows, buildForecastRegionRows, buildForecastTooltip, createForecastFormatters, deriveForecastCrossing, deriveForecastDelta, deriveForecastOutlook, deriveForecastProjection, deriveForecastState, forecastAxisGranularity, normalizeForecast, reachesTarget, resolveForecastLabels };
|