@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,545 @@
|
|
|
1
|
+
import { ArcDeltaDirection, ArcDeltaMode, ArcTimeGranularity } from "../../lib/vega/formatters.js";
|
|
2
|
+
import { ChartTokens } from "../../lib/vega/tokens.js";
|
|
3
|
+
//#region src/components/TrendCard/TrendCard.model.d.ts
|
|
4
|
+
/** What the consumer's transport reports. */
|
|
5
|
+
type TrendCardStatus = "loading" | "ready" | "error";
|
|
6
|
+
/**
|
|
7
|
+
* What the card actually shows, derived from `status`, the series and
|
|
8
|
+
* `filtered`. Stamped on the root as `data-state`.
|
|
9
|
+
*/
|
|
10
|
+
type TrendCardState = "loading" | "refreshing" | "ready" | "empty" | "no-match" | "error";
|
|
11
|
+
/** Which way is good for the focused series: revenue up, latency down, headcount neutral. */
|
|
12
|
+
type TrendGoodDirection = "up" | "down" | "none";
|
|
13
|
+
/** How the change across the span reads once `goodDirection` is applied. Stamped as `data-polarity`. */
|
|
14
|
+
type TrendPolarity = "positive" | "negative" | "neutral";
|
|
15
|
+
type TrendDeltaMode = ArcDeltaMode;
|
|
16
|
+
/** `line` may crop; `area` and `bar` keep a zero baseline whatever `scale` says. */
|
|
17
|
+
type TrendMark = "line" | "area" | "bar";
|
|
18
|
+
type TrendScale = "auto" | "zero";
|
|
19
|
+
/**
|
|
20
|
+
* How several `area` or `bar` series sit together: `false` overlays them (each
|
|
21
|
+
* read against the same axis), `"zero"` stacks them into a total, `"normalize"`
|
|
22
|
+
* stacks them to 100% — the composition-over-time reading. Lines never stack.
|
|
23
|
+
*/
|
|
24
|
+
type TrendStack = false | "zero" | "normalize";
|
|
25
|
+
/**
|
|
26
|
+
* `none` plots the readings as they are. `index` divides every series by its
|
|
27
|
+
* own first finite reading × 100, which is the honest way to compare series in
|
|
28
|
+
* different units on ONE axis — the alternative to a second y scale, which this
|
|
29
|
+
* package does not allow. The raw reading rides along in the tooltip and the
|
|
30
|
+
* table, so the transformation is never silent.
|
|
31
|
+
*/
|
|
32
|
+
type TrendNormalize = "none" | "index";
|
|
33
|
+
/**
|
|
34
|
+
* What colour is doing. `auto` picks by count against the theme's own slot
|
|
35
|
+
* budget: one series takes the emphasis hue, a handful take the categorical
|
|
36
|
+
* slots, and past the budget identity moves to `emphasis` — the focused series
|
|
37
|
+
* in the hue on a context-gray field. `categorical` forces identity slots (and
|
|
38
|
+
* degrades to `emphasis` when the theme has fewer slots than series, rather
|
|
39
|
+
* than repeating a hue and making two series look like one). `sequential` is
|
|
40
|
+
* for ORDERED series — cohorts, years, buckets — low → high through the ramp.
|
|
41
|
+
*/
|
|
42
|
+
type TrendSeriesColor = "auto" | "emphasis" | "categorical" | "sequential";
|
|
43
|
+
/** The resolved colour job, after `auto` and the slot budget. Stamped as `data-series-color`. */
|
|
44
|
+
type TrendSeriesColorMode = "emphasis" | "categorical" | "sequential";
|
|
45
|
+
type TrendCardSize = "sm" | "md" | "lg";
|
|
46
|
+
/** The big number: the focused series' latest reading, its change across the span, or nothing. Stamped as `data-headline`. */
|
|
47
|
+
type TrendHeadline = "latest" | "change" | "none";
|
|
48
|
+
type TrendXType = "temporal" | "quantitative" | "ordinal";
|
|
49
|
+
/**
|
|
50
|
+
* One reading. Cloudscape's `{ x, y }` point contract: `x` is a `Date`, an ISO
|
|
51
|
+
* string, a number or a period label; `y` is the value, or `null` for a period
|
|
52
|
+
* with no reading — drawn as a gap, never as zero.
|
|
53
|
+
*/
|
|
54
|
+
interface TrendPoint {
|
|
55
|
+
x: Date | string | number;
|
|
56
|
+
y: number | null;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* One series over time. `key` identifies it for `focus` and `visibleSeries`
|
|
60
|
+
* (defaults to `label`); `points` need not cover every period — a period this
|
|
61
|
+
* series is missing is a gap, not a zero.
|
|
62
|
+
*/
|
|
63
|
+
interface TrendSeries {
|
|
64
|
+
key?: string;
|
|
65
|
+
label: string;
|
|
66
|
+
points: readonly TrendPoint[];
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A named stretch of the x axis — a launch week, an outage, a promotion. Drawn
|
|
70
|
+
* as a quiet wash behind the marks (never in a series hue, so it cannot be read
|
|
71
|
+
* as data), named in the legend row, marked on the table's rows and added to
|
|
72
|
+
* the tooltip while the pointer is inside it.
|
|
73
|
+
*/
|
|
74
|
+
interface TrendBand {
|
|
75
|
+
start: Date | string | number;
|
|
76
|
+
end: Date | string | number;
|
|
77
|
+
label?: string;
|
|
78
|
+
}
|
|
79
|
+
/** A reading in the long-form shape the plot reads: series key, series index, and the colour the row paints with. */
|
|
80
|
+
interface TrendRow {
|
|
81
|
+
x: number | string;
|
|
82
|
+
/** Series key. */
|
|
83
|
+
s: string;
|
|
84
|
+
/** The plotted value — indexed when `normalize` is `index`, else the reading. */
|
|
85
|
+
y: number | null;
|
|
86
|
+
/** The reading as it arrived, kept for the tooltip and the table when `normalize` transforms `y`. */
|
|
87
|
+
raw: number | null;
|
|
88
|
+
/** Series index in the consumer's order — the stack order, so stacking never follows a hex string. */
|
|
89
|
+
i: number;
|
|
90
|
+
/** The paintable colour for this series, baked into the row so the spec stays structural and filtering never repaints a survivor. */
|
|
91
|
+
c: string;
|
|
92
|
+
/** Series label, for Vega's own aria text. */
|
|
93
|
+
n: string;
|
|
94
|
+
/** This row belongs to the focused series — what the plot's emphasis opacity tests. */
|
|
95
|
+
f: boolean;
|
|
96
|
+
}
|
|
97
|
+
/** One row per period — the crosshair's own dataset, so the nearest-point selection is unambiguous. */
|
|
98
|
+
interface TrendPeriodRow {
|
|
99
|
+
x: number | string;
|
|
100
|
+
}
|
|
101
|
+
/** A resolved band, snapped to the period domain. */
|
|
102
|
+
interface TrendBandRow {
|
|
103
|
+
start: number | string;
|
|
104
|
+
end: number | string;
|
|
105
|
+
label?: string;
|
|
106
|
+
}
|
|
107
|
+
/** A series after normalisation, with everything the legend, headline and text equivalents need. */
|
|
108
|
+
interface TrendSeriesInfo {
|
|
109
|
+
key: string;
|
|
110
|
+
label: string;
|
|
111
|
+
/** Index in the consumer's order — the identity slot, never the rank, so a filter cannot repaint the survivors. */
|
|
112
|
+
index: number;
|
|
113
|
+
color: string;
|
|
114
|
+
/** Readings by period, aligned to `TrendSummary.periods`; `null` for a gap or a period this series has no reading for. */
|
|
115
|
+
values: (number | null)[];
|
|
116
|
+
/** The plotted values, indexed when `normalize` is `index`. */
|
|
117
|
+
plotted: (number | null)[];
|
|
118
|
+
/**
|
|
119
|
+
* Whether this series mentioned each period at all, aligned to `periods`. A
|
|
120
|
+
* period it never mentioned emits no row (a short series stays short); a
|
|
121
|
+
* period it reported as `null` emits a gap row, which is what breaks a
|
|
122
|
+
* line's path instead of dropping it to zero.
|
|
123
|
+
*/
|
|
124
|
+
reported: boolean[];
|
|
125
|
+
/** Periods with a finite reading. */
|
|
126
|
+
count: number;
|
|
127
|
+
first: {
|
|
128
|
+
x: number | string;
|
|
129
|
+
y: number;
|
|
130
|
+
} | null;
|
|
131
|
+
latest: {
|
|
132
|
+
x: number | string;
|
|
133
|
+
y: number;
|
|
134
|
+
} | null;
|
|
135
|
+
/** The last finite PLOTTED reading — where a direct endpoint label sits. */
|
|
136
|
+
latestPlotted: {
|
|
137
|
+
x: number | string;
|
|
138
|
+
y: number;
|
|
139
|
+
} | null;
|
|
140
|
+
min: number | null;
|
|
141
|
+
max: number | null;
|
|
142
|
+
}
|
|
143
|
+
interface TrendSummary {
|
|
144
|
+
xType: TrendXType;
|
|
145
|
+
granularity: ArcTimeGranularity;
|
|
146
|
+
/** The shared x domain — the union of every series' periods, in axis order. */
|
|
147
|
+
periods: (number | string)[];
|
|
148
|
+
series: TrendSeriesInfo[];
|
|
149
|
+
/** Long-form rows for the visible series, in period × series order. */
|
|
150
|
+
rows: TrendRow[];
|
|
151
|
+
/** Readings with a finite value across every visible series. */
|
|
152
|
+
count: number;
|
|
153
|
+
/** The plotted extent across the visible series — what the y scale spans. */
|
|
154
|
+
min: number | null;
|
|
155
|
+
max: number | null;
|
|
156
|
+
hasNegative: boolean;
|
|
157
|
+
/** Series folded into `Other`; 0 when nothing was folded. */
|
|
158
|
+
folded: number;
|
|
159
|
+
/** The key `focus` actually resolved to — the named series if it exists, else the first. */
|
|
160
|
+
focusKey: string;
|
|
161
|
+
}
|
|
162
|
+
interface TrendDelta {
|
|
163
|
+
direction: ArcDeltaDirection;
|
|
164
|
+
polarity: TrendPolarity;
|
|
165
|
+
/** Signed, formatted change: `+12.4%`, `-0.3 pp`, `+฿124K`. */
|
|
166
|
+
text: string;
|
|
167
|
+
renderedMode: ArcDeltaMode;
|
|
168
|
+
/** The same change in the other form, or `null` when it does not exist (a zero baseline has no percent). */
|
|
169
|
+
secondaryText: string | null;
|
|
170
|
+
}
|
|
171
|
+
/** The change one series made across the span, with the two readings behind it. */
|
|
172
|
+
interface TrendSpan {
|
|
173
|
+
seriesKey: string;
|
|
174
|
+
seriesLabel: string;
|
|
175
|
+
from: {
|
|
176
|
+
x: number | string;
|
|
177
|
+
y: number;
|
|
178
|
+
};
|
|
179
|
+
to: {
|
|
180
|
+
x: number | string;
|
|
181
|
+
y: number;
|
|
182
|
+
};
|
|
183
|
+
/** The span as text — `Aug 7 – Sep 8, 2026`. */
|
|
184
|
+
rangeText: string;
|
|
185
|
+
delta: TrendDelta;
|
|
186
|
+
/** The extremes inside the span, so the description and the insight can name where it peaked and bottomed. */
|
|
187
|
+
peak: {
|
|
188
|
+
x: number | string;
|
|
189
|
+
y: number;
|
|
190
|
+
} | null;
|
|
191
|
+
trough: {
|
|
192
|
+
x: number | string;
|
|
193
|
+
y: number;
|
|
194
|
+
} | null;
|
|
195
|
+
}
|
|
196
|
+
/** A piece of a generated insight sentence: plain text, or a value the card sets in bold. */
|
|
197
|
+
type TrendInsightSegment = string | {
|
|
198
|
+
value: string;
|
|
199
|
+
};
|
|
200
|
+
/** What the change tooltip explains: the two readings behind the badge and the change in both forms. */
|
|
201
|
+
interface TrendDeltaExplanation {
|
|
202
|
+
seriesLabel: string;
|
|
203
|
+
fromLabel: string;
|
|
204
|
+
fromText: string;
|
|
205
|
+
toLabel: string;
|
|
206
|
+
toText: string;
|
|
207
|
+
changeText: string;
|
|
208
|
+
secondaryText: string | null;
|
|
209
|
+
renderedMode: ArcDeltaMode;
|
|
210
|
+
direction: ArcDeltaDirection;
|
|
211
|
+
}
|
|
212
|
+
/** Every string the card renders or announces, so a product can localise it. Sentences are functions. */
|
|
213
|
+
interface TrendCardLabels {
|
|
214
|
+
increase: string;
|
|
215
|
+
decrease: string;
|
|
216
|
+
unchanged: string;
|
|
217
|
+
/** Suffix for a percentage-point delta. */
|
|
218
|
+
percentagePoints: string;
|
|
219
|
+
noData: string;
|
|
220
|
+
noMatch: string;
|
|
221
|
+
clearFilters: string;
|
|
222
|
+
error: string;
|
|
223
|
+
retry: string;
|
|
224
|
+
/** Shown in place of the plot when fewer than two periods carry a reading. */
|
|
225
|
+
insufficient: string;
|
|
226
|
+
stale: string;
|
|
227
|
+
asOf: string;
|
|
228
|
+
tablePeriod: string;
|
|
229
|
+
tableValue: string;
|
|
230
|
+
/** Column suffix for the raw reading beside an indexed value. */
|
|
231
|
+
tableActual: string;
|
|
232
|
+
/** Label for the dotted target reference line. */
|
|
233
|
+
target: string;
|
|
234
|
+
/** Label of the series the long tail folds into. */
|
|
235
|
+
other: string;
|
|
236
|
+
/** Legend group's accessible name — `Series shown in Revenue by channel`. */
|
|
237
|
+
legendGroup: (name: string) => string;
|
|
238
|
+
/** A legend chip's accessible name — `Hide Retail` / `Show Retail`. */
|
|
239
|
+
hideSeries: (series: string) => string;
|
|
240
|
+
showSeries: (series: string) => string;
|
|
241
|
+
/** Read out after the focused series' legend chip. */
|
|
242
|
+
focused: string;
|
|
243
|
+
/** Read out on a band's legend key and its table rows. */
|
|
244
|
+
band: string;
|
|
245
|
+
/** The comparison line under the headline — `vs Aug 7`, or the span for a `change` headline. */
|
|
246
|
+
since: (period: string) => string;
|
|
247
|
+
/** Index-mode caption: `Indexed to 100 at Aug 7`. */
|
|
248
|
+
indexedAt: (period: string) => string;
|
|
249
|
+
/** Stacked-to-100% caption. */
|
|
250
|
+
normalized: string;
|
|
251
|
+
showTable: (name: string) => string;
|
|
252
|
+
hideTable: (name: string) => string;
|
|
253
|
+
about: (name: string) => string;
|
|
254
|
+
loading: (name: string) => string;
|
|
255
|
+
tableCaption: (name: string) => string;
|
|
256
|
+
/** Accessible name of the change group beside the value. */
|
|
257
|
+
changeGroup: (name: string) => string;
|
|
258
|
+
/** Compact label/value rows explaining the change badge. */
|
|
259
|
+
deltaExplanation: (delta: TrendDeltaExplanation) => readonly (readonly [label: string, value: string])[];
|
|
260
|
+
/** The change sentence in the card description. */
|
|
261
|
+
spanSentence: (input: {
|
|
262
|
+
word: string;
|
|
263
|
+
series: string;
|
|
264
|
+
primary: string;
|
|
265
|
+
secondary: string | null;
|
|
266
|
+
range: string;
|
|
267
|
+
from: string;
|
|
268
|
+
to: string;
|
|
269
|
+
}) => string;
|
|
270
|
+
/** Names the peak and the trough inside the span. */
|
|
271
|
+
extremesSentence: (input: {
|
|
272
|
+
peak: string;
|
|
273
|
+
peakAt: string;
|
|
274
|
+
trough: string;
|
|
275
|
+
troughAt: string;
|
|
276
|
+
}) => string;
|
|
277
|
+
/** Lists every series with its latest reading. */
|
|
278
|
+
seriesSummary: (count: number, list: string) => string;
|
|
279
|
+
/** Appended when series were folded into Other. */
|
|
280
|
+
foldedSummary: (count: number) => string;
|
|
281
|
+
/** Appended when bands are drawn. */
|
|
282
|
+
bandsSummary: (list: string) => string;
|
|
283
|
+
markNames: Record<TrendMark, string>;
|
|
284
|
+
/** The plot's own `aria-label`. */
|
|
285
|
+
chartDescription: (input: {
|
|
286
|
+
mark: string;
|
|
287
|
+
name: string;
|
|
288
|
+
seriesCount: number;
|
|
289
|
+
periodCount: number;
|
|
290
|
+
range: string;
|
|
291
|
+
min: string;
|
|
292
|
+
max: string;
|
|
293
|
+
focus: string | null;
|
|
294
|
+
target: string | null;
|
|
295
|
+
stacked: string | null;
|
|
296
|
+
}) => string;
|
|
297
|
+
/** Accessible name of the AI mark beside the insight sentence. */
|
|
298
|
+
insightMark: string;
|
|
299
|
+
/**
|
|
300
|
+
* The generated insight, as segments so the readings and the change render in
|
|
301
|
+
* bold while the words stay plain.
|
|
302
|
+
*/
|
|
303
|
+
insight: (input: {
|
|
304
|
+
series: string;
|
|
305
|
+
direction: ArcDeltaDirection;
|
|
306
|
+
from: string;
|
|
307
|
+
to: string;
|
|
308
|
+
change: string;
|
|
309
|
+
secondary: string | null;
|
|
310
|
+
range: string;
|
|
311
|
+
peak: string | null;
|
|
312
|
+
peakAt: string | null;
|
|
313
|
+
}) => TrendInsightSegment[];
|
|
314
|
+
}
|
|
315
|
+
declare const DEFAULT_TREND_LABELS: TrendCardLabels;
|
|
316
|
+
declare function resolveTrendLabels(overrides?: Partial<TrendCardLabels>): TrendCardLabels;
|
|
317
|
+
interface DeriveTrendStateInput {
|
|
318
|
+
status: TrendCardStatus;
|
|
319
|
+
/** At least one reading exists across the visible series. */
|
|
320
|
+
hasValue: boolean;
|
|
321
|
+
/** Anything is on screen already — any series at all — 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 series is a refresh (the
|
|
327
|
+
* previous render stays under the veil); no readings is `no-match` when the
|
|
328
|
+
* consumer's filter caused it and `empty` otherwise.
|
|
329
|
+
*/
|
|
330
|
+
declare function deriveTrendState({ status, hasValue, hasData, filtered }: DeriveTrendStateInput): TrendCardState;
|
|
331
|
+
/** The key of the series the long tail folds into. Never collides with a consumer key that is a label. */
|
|
332
|
+
declare const TREND_OTHER_KEY = "__other__";
|
|
333
|
+
/**
|
|
334
|
+
* The granularity an x axis labels its ticks at: the tooltip and table keep the
|
|
335
|
+
* full form (`Sep 8, 2026`); an axis has room for `Sep 8`. Duplicated per
|
|
336
|
+
* component rather than shared, so a card's text grammar is readable in one
|
|
337
|
+
* file — the same reason each card owns its own state machine.
|
|
338
|
+
*/
|
|
339
|
+
declare function trendAxisGranularity(granularity: ArcTimeGranularity): ArcTimeGranularity;
|
|
340
|
+
/**
|
|
341
|
+
* The colour job, resolved against the theme's own categorical budget.
|
|
342
|
+
*
|
|
343
|
+
* The brand ships six hues and reserves three for status, so `colors.css`
|
|
344
|
+
* defines only a handful of `chart-N` identity slots. Repeating a slot would
|
|
345
|
+
* make two series look like one, so `categorical` past the budget degrades to
|
|
346
|
+
* `emphasis` — the focused series in the hue on a context-gray field, which is
|
|
347
|
+
* the FT/Few reading of a many-line chart anyway. `auto` applies the same
|
|
348
|
+
* budget without being asked.
|
|
349
|
+
*/
|
|
350
|
+
declare function resolveSeriesColorMode(requested: TrendSeriesColor, seriesCount: number, slots: number): TrendSeriesColorMode;
|
|
351
|
+
/**
|
|
352
|
+
* The colour one series paints with. Identity slots are assigned by the
|
|
353
|
+
* series' index in the consumer's order — never by rank or by value — so
|
|
354
|
+
* hiding a series cannot repaint the survivors (rule 6). A sequential ramp
|
|
355
|
+
* spreads the ordered series across the whole ramp so the ends are always the
|
|
356
|
+
* ends, however many series there are.
|
|
357
|
+
*/
|
|
358
|
+
declare function seriesColorAt(index: number, seriesCount: number, mode: TrendSeriesColorMode, focusIndex: number, tokens: ChartTokens): string;
|
|
359
|
+
interface NormalizeSeriesOptions {
|
|
360
|
+
granularity?: ArcTimeGranularity;
|
|
361
|
+
normalize?: TrendNormalize;
|
|
362
|
+
/** Which series is the subject — its key. Resolves to the first series when absent. */
|
|
363
|
+
focus?: string;
|
|
364
|
+
/** The keys the reader has left switched on. `undefined` shows every series. */
|
|
365
|
+
visible?: readonly string[];
|
|
366
|
+
/** Fold every series past this count (in the consumer's order) into one `Other` series whose readings are the sum of the folded finite readings. The focus is never folded. */
|
|
367
|
+
maxSeries?: number;
|
|
368
|
+
otherLabel: string;
|
|
369
|
+
colorMode: TrendSeriesColorMode;
|
|
370
|
+
tokens: ChartTokens;
|
|
371
|
+
/** Stack mode — a stacked plot's extent is the stack's total, not the tallest series. */
|
|
372
|
+
stack?: TrendStack;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Normalises `series` onto one shared period domain for the plot, the legend
|
|
376
|
+
* and the table: temporal `x` becomes epoch milliseconds, invalid dates are
|
|
377
|
+
* dropped, a period a series has no reading for stays a gap (never a zero),
|
|
378
|
+
* the long tail folds into `Other` when asked, and the visible series are laid
|
|
379
|
+
* out long-form with their colour and stack order baked into each row — so the
|
|
380
|
+
* spec stays structural and a visibility change is a data push, not a re-embed.
|
|
381
|
+
*
|
|
382
|
+
* Returns `null` when there are no series to speak of.
|
|
383
|
+
*/
|
|
384
|
+
declare function normalizeSeries(series: readonly TrendSeries[] | undefined, { granularity, normalize, focus, visible, maxSeries, otherLabel, colorMode, tokens, stack }: NormalizeSeriesOptions): TrendSummary | null;
|
|
385
|
+
/** The periods the crosshair reads — one row each, so it lands on the period rather than on a series. */
|
|
386
|
+
declare function buildPeriodRows(summary: TrendSummary): TrendPeriodRow[];
|
|
387
|
+
/** One row per visible series at its last plotted reading — where a direct endpoint label sits. */
|
|
388
|
+
declare function buildLatestRows(summary: TrendSummary, visibleKeys: readonly string[]): {
|
|
389
|
+
x: number | string;
|
|
390
|
+
y: number;
|
|
391
|
+
n: string;
|
|
392
|
+
c: string;
|
|
393
|
+
}[];
|
|
394
|
+
/**
|
|
395
|
+
* Snaps every band onto the period domain. Each bound moves inward to the
|
|
396
|
+
* nearest period the data actually has, so a band can never extend the axis;
|
|
397
|
+
* a band that covers no period is dropped rather than drawn as a hairline.
|
|
398
|
+
*/
|
|
399
|
+
declare function resolveBands(bands: readonly TrendBand[] | undefined, summary: TrendSummary | null): TrendBandRow[];
|
|
400
|
+
/**
|
|
401
|
+
* The band a period falls inside — the tooltip's and the table's band marker.
|
|
402
|
+
* A continuous axis compares the values; an ordinal one compares positions in
|
|
403
|
+
* `periods`, since a category label has no order of its own. The first
|
|
404
|
+
* matching band wins, so overlapping bands are read in the consumer's order.
|
|
405
|
+
*/
|
|
406
|
+
declare function bandAt(bands: readonly TrendBandRow[], periods: readonly (number | string)[], x: number | string): TrendBandRow | null;
|
|
407
|
+
interface DeriveTrendSpanOptions {
|
|
408
|
+
deltaMode: TrendDeltaMode;
|
|
409
|
+
goodDirection: TrendGoodDirection;
|
|
410
|
+
format: string;
|
|
411
|
+
locale?: string;
|
|
412
|
+
percentagePoints: string;
|
|
413
|
+
formatters: TrendTextFormatters;
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* The change the focused series made across the span it actually covers —
|
|
417
|
+
* first finite reading to last finite reading — with the extremes in between.
|
|
418
|
+
* `null` unless the series holds two distinct readings, so the card never
|
|
419
|
+
* invents a trend from one point.
|
|
420
|
+
*/
|
|
421
|
+
declare function deriveTrendSpan(summary: TrendSummary | null | undefined, focusKey: string | undefined, { deltaMode, goodDirection, format, locale, percentagePoints, formatters }: DeriveTrendSpanOptions): TrendSpan | null;
|
|
422
|
+
interface DeriveTrendDeltaOptions {
|
|
423
|
+
deltaMode: TrendDeltaMode;
|
|
424
|
+
goodDirection: TrendGoodDirection;
|
|
425
|
+
format: string;
|
|
426
|
+
locale?: string;
|
|
427
|
+
percentagePoints: string;
|
|
428
|
+
}
|
|
429
|
+
/** A change between two readings, with polarity resolved through `goodDirection`. */
|
|
430
|
+
declare function deriveTrendDelta(value: number | null | undefined, previous: number | null | undefined, { deltaMode, goodDirection, format, locale, percentagePoints }: DeriveTrendDeltaOptions): TrendDelta | null;
|
|
431
|
+
interface TrendTextFormatters {
|
|
432
|
+
/** A reading in the card's own grammar. */
|
|
433
|
+
formatValue: (value: number | null | undefined) => string;
|
|
434
|
+
/** A plotted value — index points under `normalize="index"`, a share under `stack="normalize"`, else the reading. */
|
|
435
|
+
formatPlotted: (value: number | null | undefined) => string;
|
|
436
|
+
formatX: (x: number | string) => string;
|
|
437
|
+
/** A span between two `x` values — a collapsed date range for a temporal axis (`Aug 7 – Sep 8, 2026`), `start – end` otherwise. */
|
|
438
|
+
formatXRange: (start: number | string, end: number | string) => string;
|
|
439
|
+
}
|
|
440
|
+
/** The formatters every text surface shares — headline, badge, legend, table, tooltip, descriptions. */
|
|
441
|
+
declare function createTrendFormatters({ format, locale, timeZone, formatValue, xType, granularity, normalize, stack, indexFormat }: {
|
|
442
|
+
format: string;
|
|
443
|
+
locale?: string;
|
|
444
|
+
timeZone?: string;
|
|
445
|
+
formatValue?: (value: number) => string;
|
|
446
|
+
xType: TrendXType;
|
|
447
|
+
granularity: ArcTimeGranularity;
|
|
448
|
+
normalize?: TrendNormalize;
|
|
449
|
+
stack?: TrendStack;
|
|
450
|
+
indexFormat?: string;
|
|
451
|
+
}): TrendTextFormatters;
|
|
452
|
+
/**
|
|
453
|
+
* The generated insight — what the card shows beside the AI mark when the
|
|
454
|
+
* consumer passes no `insight`. The focused series' two ends, its change (in
|
|
455
|
+
* the badge's form, with the other form in brackets) and its peak come back as
|
|
456
|
+
* `{ value }` segments so the card can set them in bold; the words come from
|
|
457
|
+
* `labels.insight`.
|
|
458
|
+
*/
|
|
459
|
+
declare function buildTrendInsight({ span, formatters, labels }: {
|
|
460
|
+
span: TrendSpan;
|
|
461
|
+
formatters: TrendTextFormatters;
|
|
462
|
+
labels: TrendCardLabels;
|
|
463
|
+
}): TrendInsightSegment[];
|
|
464
|
+
/** One series' reading at the hovered period, as the tooltip prints it. */
|
|
465
|
+
interface TrendTooltipEntry {
|
|
466
|
+
key: string;
|
|
467
|
+
label: string;
|
|
468
|
+
color: string;
|
|
469
|
+
/** The subject — marked so a field of gray lines still says which one is the point. */
|
|
470
|
+
isFocus: boolean;
|
|
471
|
+
/** The reading in the card's own grammar. */
|
|
472
|
+
valueText: string;
|
|
473
|
+
/**
|
|
474
|
+
* What the plot actually drew, when the axis is transformed (index points or
|
|
475
|
+
* a share) — `null` when the plot draws the reading itself, so the chip shows
|
|
476
|
+
* one number rather than the same number twice.
|
|
477
|
+
*/
|
|
478
|
+
plottedText: string | null;
|
|
479
|
+
}
|
|
480
|
+
/** Everything the hover chip shows for one period. */
|
|
481
|
+
interface TrendTooltipModel {
|
|
482
|
+
periodText: string;
|
|
483
|
+
/** The annotated period the hover falls inside, named — never left to the wash. */
|
|
484
|
+
bandText: string | null;
|
|
485
|
+
/** The visible series that reported this period, ranked by what the plot drew. */
|
|
486
|
+
entries: TrendTooltipEntry[];
|
|
487
|
+
targetText: string | null;
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* The hover chip's contents for one period — pure, so the shared-x reading is
|
|
491
|
+
* unit-tested rather than only reachable through a pointer event (Vega's own
|
|
492
|
+
* hit-testing needs a visible document, which a hidden frame does not give).
|
|
493
|
+
*
|
|
494
|
+
* Ranked descending by the PLOTTED value, so the reader compares by reading
|
|
495
|
+
* down the chip in the order the marks sit on screen. Returns `null` for a
|
|
496
|
+
* period the card does not have.
|
|
497
|
+
*/
|
|
498
|
+
declare function buildTrendTooltip({ summary, visibleKeys, bands, x, target, formatters, transformed }: {
|
|
499
|
+
summary: TrendSummary | null | undefined;
|
|
500
|
+
visibleKeys: readonly string[];
|
|
501
|
+
bands: readonly TrendBandRow[];
|
|
502
|
+
/** The hovered period, as it arrives on the row. */
|
|
503
|
+
x: number | string | undefined;
|
|
504
|
+
target?: number | null;
|
|
505
|
+
formatters: TrendTextFormatters;
|
|
506
|
+
/** The plot draws something other than the reading (`normalize="index"` or a 100% stack). */
|
|
507
|
+
transformed: boolean;
|
|
508
|
+
}): TrendTooltipModel | null;
|
|
509
|
+
interface BuildTrendDescriptionInput {
|
|
510
|
+
name: string;
|
|
511
|
+
state: TrendCardState;
|
|
512
|
+
headline: TrendHeadline;
|
|
513
|
+
summary: TrendSummary | null;
|
|
514
|
+
/** Only the series the reader has left switched on are described — the card describes what it shows. */
|
|
515
|
+
visibleKeys: readonly string[];
|
|
516
|
+
span: TrendSpan | null;
|
|
517
|
+
bands: readonly TrendBandRow[];
|
|
518
|
+
formatters: TrendTextFormatters;
|
|
519
|
+
targetText?: string | null;
|
|
520
|
+
asOfText?: string;
|
|
521
|
+
labels: TrendCardLabels;
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* The card's text equivalent (Amy Cesal's alt-text formula: what it is, what it
|
|
525
|
+
* shows, why it is here, when it was true) — the figure's accessible
|
|
526
|
+
* description, and the summary a screen reader gets before the parts. Every
|
|
527
|
+
* visible series' latest reading is listed, so nothing lives only in the lines.
|
|
528
|
+
*/
|
|
529
|
+
declare function buildTrendDescription({ name, state, headline, summary, visibleKeys, span, bands, formatters, targetText, asOfText, labels }: BuildTrendDescriptionInput): string;
|
|
530
|
+
/** The plot's own `description` — the `aria-label` Vega stamps on the `graphics-document`. */
|
|
531
|
+
declare function buildTrendChartDescription({ name, mark, summary, visibleKeys, focusLabel, stack, normalize, formatters, targetText, labels }: {
|
|
532
|
+
name: string;
|
|
533
|
+
mark: TrendMark;
|
|
534
|
+
summary: TrendSummary;
|
|
535
|
+
visibleKeys: readonly string[];
|
|
536
|
+
/** Named only while colour marks one series out — otherwise nothing is emphasised. */
|
|
537
|
+
focusLabel: string | null;
|
|
538
|
+
stack: TrendStack;
|
|
539
|
+
normalize: TrendNormalize;
|
|
540
|
+
formatters: TrendTextFormatters;
|
|
541
|
+
targetText?: string | null;
|
|
542
|
+
labels: TrendCardLabels;
|
|
543
|
+
}): string;
|
|
544
|
+
//#endregion
|
|
545
|
+
export { BuildTrendDescriptionInput, DEFAULT_TREND_LABELS, DeriveTrendDeltaOptions, DeriveTrendSpanOptions, DeriveTrendStateInput, NormalizeSeriesOptions, TREND_OTHER_KEY, TrendBand, TrendBandRow, TrendCardLabels, TrendCardSize, TrendCardState, TrendCardStatus, TrendDelta, TrendDeltaExplanation, TrendDeltaMode, TrendGoodDirection, TrendHeadline, TrendInsightSegment, TrendMark, TrendNormalize, TrendPeriodRow, TrendPoint, TrendPolarity, TrendRow, TrendScale, TrendSeries, TrendSeriesColor, TrendSeriesColorMode, TrendSeriesInfo, TrendSpan, TrendStack, TrendSummary, TrendTextFormatters, TrendTooltipEntry, TrendTooltipModel, TrendXType, bandAt, buildLatestRows, buildPeriodRows, buildTrendChartDescription, buildTrendDescription, buildTrendInsight, buildTrendTooltip, createTrendFormatters, deriveTrendDelta, deriveTrendSpan, deriveTrendState, normalizeSeries, resolveBands, resolveSeriesColorMode, resolveTrendLabels, seriesColorAt, trendAxisGranularity };
|