@arcfusionz/arc-analytic-ui 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +13 -0
  2. package/dist/components/AnomalyCard/AnomalyCard.chart.d.ts +64 -0
  3. package/dist/components/AnomalyCard/AnomalyCard.chart.js +341 -0
  4. package/dist/components/AnomalyCard/AnomalyCard.d.ts +169 -0
  5. package/dist/components/AnomalyCard/AnomalyCard.js +1019 -0
  6. package/dist/components/AnomalyCard/AnomalyCard.model.d.ts +508 -0
  7. package/dist/components/AnomalyCard/AnomalyCard.model.js +553 -0
  8. package/dist/components/AnomalyCard/index.d.ts +4 -0
  9. package/dist/components/AnomalyCard/index.js +4 -0
  10. package/dist/components/ChartCard/ChartCard.chart.d.ts +72 -0
  11. package/dist/components/ChartCard/ChartCard.chart.js +1333 -0
  12. package/dist/components/ChartCard/ChartCard.d.ts +206 -0
  13. package/dist/components/ChartCard/ChartCard.js +718 -0
  14. package/dist/components/ChartCard/ChartCard.model.d.ts +452 -0
  15. package/dist/components/ChartCard/ChartCard.model.js +1223 -0
  16. package/dist/components/ChartCard/index.d.ts +4 -0
  17. package/dist/components/ChartCard/index.js +4 -0
  18. package/dist/components/ComparisonCard/ComparisonCard.chart.d.ts +80 -0
  19. package/dist/components/ComparisonCard/ComparisonCard.chart.js +337 -0
  20. package/dist/components/ComparisonCard/ComparisonCard.d.ts +200 -0
  21. package/dist/components/ComparisonCard/ComparisonCard.js +1325 -0
  22. package/dist/components/ComparisonCard/ComparisonCard.model.d.ts +309 -0
  23. package/dist/components/ComparisonCard/ComparisonCard.model.js +263 -0
  24. package/dist/components/ComparisonCard/index.d.ts +4 -0
  25. package/dist/components/ComparisonCard/index.js +4 -0
  26. package/dist/components/ForecastCard/ForecastCard.chart.d.ts +82 -0
  27. package/dist/components/ForecastCard/ForecastCard.chart.js +416 -0
  28. package/dist/components/ForecastCard/ForecastCard.d.ts +148 -0
  29. package/dist/components/ForecastCard/ForecastCard.js +1029 -0
  30. package/dist/components/ForecastCard/ForecastCard.model.d.ts +497 -0
  31. package/dist/components/ForecastCard/ForecastCard.model.js +554 -0
  32. package/dist/components/ForecastCard/index.d.ts +4 -0
  33. package/dist/components/ForecastCard/index.js +4 -0
  34. package/dist/components/HighlightCard/HighlightCard.chart.d.ts +122 -0
  35. package/dist/components/HighlightCard/HighlightCard.chart.js +660 -0
  36. package/dist/components/HighlightCard/HighlightCard.d.ts +202 -0
  37. package/dist/components/HighlightCard/HighlightCard.js +1286 -0
  38. package/dist/components/HighlightCard/HighlightCard.model.d.ts +692 -0
  39. package/dist/components/HighlightCard/HighlightCard.model.js +875 -0
  40. package/dist/components/HighlightCard/index.d.ts +4 -0
  41. package/dist/components/HighlightCard/index.js +4 -0
  42. package/dist/components/InsightCard/InsightCard.chart.d.ts +91 -0
  43. package/dist/components/InsightCard/InsightCard.chart.js +471 -0
  44. package/dist/components/InsightCard/InsightCard.d.ts +161 -0
  45. package/dist/components/InsightCard/InsightCard.js +961 -0
  46. package/dist/components/InsightCard/InsightCard.model.d.ts +405 -0
  47. package/dist/components/InsightCard/InsightCard.model.js +421 -0
  48. package/dist/components/InsightCard/index.d.ts +4 -0
  49. package/dist/components/InsightCard/index.js +4 -0
  50. package/dist/components/MetricCard/MetricCard.chart.d.ts +79 -0
  51. package/dist/components/MetricCard/MetricCard.chart.js +435 -0
  52. package/dist/components/MetricCard/MetricCard.d.ts +227 -0
  53. package/dist/components/MetricCard/MetricCard.js +1293 -0
  54. package/dist/components/MetricCard/MetricCard.model.d.ts +521 -0
  55. package/dist/components/MetricCard/MetricCard.model.js +627 -0
  56. package/dist/components/MetricCard/index.d.ts +4 -0
  57. package/dist/components/MetricCard/index.js +4 -0
  58. package/dist/components/ProfileCard/ProfileCard.chart.d.ts +64 -0
  59. package/dist/components/ProfileCard/ProfileCard.chart.js +427 -0
  60. package/dist/components/ProfileCard/ProfileCard.d.ts +140 -0
  61. package/dist/components/ProfileCard/ProfileCard.js +735 -0
  62. package/dist/components/ProfileCard/ProfileCard.model.d.ts +279 -0
  63. package/dist/components/ProfileCard/ProfileCard.model.js +244 -0
  64. package/dist/components/ProfileCard/index.d.ts +4 -0
  65. package/dist/components/ProfileCard/index.js +4 -0
  66. package/dist/components/ProgressCard/ProgressCard.chart.d.ts +73 -0
  67. package/dist/components/ProgressCard/ProgressCard.chart.js +373 -0
  68. package/dist/components/ProgressCard/ProgressCard.d.ts +137 -0
  69. package/dist/components/ProgressCard/ProgressCard.js +908 -0
  70. package/dist/components/ProgressCard/ProgressCard.model.d.ts +385 -0
  71. package/dist/components/ProgressCard/ProgressCard.model.js +389 -0
  72. package/dist/components/ProgressCard/index.d.ts +4 -0
  73. package/dist/components/ProgressCard/index.js +4 -0
  74. package/dist/components/ReportCard/ReportCard.chart.d.ts +45 -0
  75. package/dist/components/ReportCard/ReportCard.chart.js +231 -0
  76. package/dist/components/ReportCard/ReportCard.d.ts +153 -0
  77. package/dist/components/ReportCard/ReportCard.js +1118 -0
  78. package/dist/components/ReportCard/ReportCard.model.d.ts +392 -0
  79. package/dist/components/ReportCard/ReportCard.model.js +399 -0
  80. package/dist/components/ReportCard/index.d.ts +4 -0
  81. package/dist/components/ReportCard/index.js +4 -0
  82. package/dist/components/SankeyCard/SankeyCard.chart.d.ts +75 -0
  83. package/dist/components/SankeyCard/SankeyCard.chart.js +249 -0
  84. package/dist/components/SankeyCard/SankeyCard.d.ts +185 -0
  85. package/dist/components/SankeyCard/SankeyCard.js +788 -0
  86. package/dist/components/SankeyCard/SankeyCard.model.d.ts +501 -0
  87. package/dist/components/SankeyCard/SankeyCard.model.js +789 -0
  88. package/dist/components/SankeyCard/index.d.ts +4 -0
  89. package/dist/components/SankeyCard/index.js +4 -0
  90. package/dist/components/StatusCard/StatusCard.chart.d.ts +60 -0
  91. package/dist/components/StatusCard/StatusCard.chart.js +188 -0
  92. package/dist/components/StatusCard/StatusCard.d.ts +176 -0
  93. package/dist/components/StatusCard/StatusCard.js +989 -0
  94. package/dist/components/StatusCard/StatusCard.model.d.ts +555 -0
  95. package/dist/components/StatusCard/StatusCard.model.js +776 -0
  96. package/dist/components/StatusCard/index.d.ts +4 -0
  97. package/dist/components/StatusCard/index.js +4 -0
  98. package/dist/components/TableCard/TableCard.chart.d.ts +53 -0
  99. package/dist/components/TableCard/TableCard.chart.js +192 -0
  100. package/dist/components/TableCard/TableCard.d.ts +140 -0
  101. package/dist/components/TableCard/TableCard.js +811 -0
  102. package/dist/components/TableCard/TableCard.model.d.ts +381 -0
  103. package/dist/components/TableCard/TableCard.model.js +475 -0
  104. package/dist/components/TableCard/index.d.ts +4 -0
  105. package/dist/components/TableCard/index.js +4 -0
  106. package/dist/components/TargetCard/TargetCard.chart.d.ts +52 -0
  107. package/dist/components/TargetCard/TargetCard.chart.js +273 -0
  108. package/dist/components/TargetCard/TargetCard.d.ts +143 -0
  109. package/dist/components/TargetCard/TargetCard.js +910 -0
  110. package/dist/components/TargetCard/TargetCard.model.d.ts +468 -0
  111. package/dist/components/TargetCard/TargetCard.model.js +581 -0
  112. package/dist/components/TargetCard/index.d.ts +4 -0
  113. package/dist/components/TargetCard/index.js +4 -0
  114. package/dist/components/TreeCard/TreeCard.chart.d.ts +80 -0
  115. package/dist/components/TreeCard/TreeCard.chart.js +178 -0
  116. package/dist/components/TreeCard/TreeCard.d.ts +182 -0
  117. package/dist/components/TreeCard/TreeCard.js +1187 -0
  118. package/dist/components/TreeCard/TreeCard.model.d.ts +330 -0
  119. package/dist/components/TreeCard/TreeCard.model.js +401 -0
  120. package/dist/components/TreeCard/index.d.ts +4 -0
  121. package/dist/components/TreeCard/index.js +4 -0
  122. package/dist/components/TrendCard/TrendCard.chart.d.ts +75 -0
  123. package/dist/components/TrendCard/TrendCard.chart.js +393 -0
  124. package/dist/components/TrendCard/TrendCard.d.ts +224 -0
  125. package/dist/components/TrendCard/TrendCard.js +1053 -0
  126. package/dist/components/TrendCard/TrendCard.model.d.ts +545 -0
  127. package/dist/components/TrendCard/TrendCard.model.js +623 -0
  128. package/dist/components/TrendCard/index.d.ts +4 -0
  129. package/dist/components/TrendCard/index.js +4 -0
  130. package/dist/index.d.ts +76 -0
  131. package/dist/index.js +57 -0
  132. package/dist/lib/vega/ArcVegaChart.d.ts +24 -0
  133. package/dist/lib/vega/ArcVegaChart.js +42 -0
  134. package/dist/lib/vega/ArcVegaSurface.d.ts +13 -0
  135. package/dist/lib/vega/ArcVegaSurface.js +38 -0
  136. package/dist/lib/vega/axisTicks.js +156 -0
  137. package/dist/lib/vega/config.d.ts +29 -0
  138. package/dist/lib/vega/config.js +113 -0
  139. package/dist/lib/vega/embed.d.ts +29 -0
  140. package/dist/lib/vega/embed.js +29 -0
  141. package/dist/lib/vega/engine.d.ts +10 -0
  142. package/dist/lib/vega/engine.js +6 -0
  143. package/dist/lib/vega/formatters.d.ts +125 -0
  144. package/dist/lib/vega/formatters.js +277 -0
  145. package/dist/lib/vega/index.d.ts +11 -0
  146. package/dist/lib/vega/load.d.ts +13 -0
  147. package/dist/lib/vega/load.js +21 -0
  148. package/dist/lib/vega/time.d.ts +45 -0
  149. package/dist/lib/vega/time.js +105 -0
  150. package/dist/lib/vega/tokens.d.ts +73 -0
  151. package/dist/lib/vega/tokens.js +137 -0
  152. package/dist/lib/vega/tooltip.d.ts +45 -0
  153. package/dist/lib/vega/tooltip.js +124 -0
  154. package/dist/lib/vega/useArcVega.d.ts +43 -0
  155. package/dist/lib/vega/useArcVega.js +121 -0
  156. package/package.json +60 -0
@@ -0,0 +1,555 @@
1
+ import { ArcTimeGranularity } from "../../lib/vega/formatters.js";
2
+ import { ChartTokens } from "../../lib/vega/tokens.js";
3
+ //#region src/components/StatusCard/StatusCard.model.d.ts
4
+ /** What the consumer's transport reports. */
5
+ type StatusCardStatus = "loading" | "ready" | "error";
6
+ /**
7
+ * What the card actually shows, derived from `status`, the level, the history
8
+ * and `filtered`. Stamped on the root as `data-state`. `insufficient` is a
9
+ * known level with no history to put it in context: there is a state to
10
+ * report but no run to draw, so the strip's place carries a caption rather
11
+ * than a one-cell timeline pretending to be a history.
12
+ */
13
+ type StatusCardState = "loading" | "refreshing" | "ready" | "insufficient" | "empty" | "no-match" | "error";
14
+ /**
15
+ * The state a monitored thing can be in. Ordered by severity for the strip's
16
+ * bucket rule (see `STATUS_SEVERITY`), with the two levels that sit outside
17
+ * the good/bad ladder last: `maintenance` is planned work and `unknown` is
18
+ * time nobody was watching. The five map onto every status model in the
19
+ * ecosystem — Statuspage's operational / degraded_performance / partial or
20
+ * major outage / under_maintenance, Grafana's OK / Pending / Alerting / No
21
+ * Data, Datadog's OK / Warn / Alert / No Data, Cloudscape's success / warning
22
+ * / error / pending. Rename them for the product through `labels.levelNames`.
23
+ */
24
+ type StatusLevel = "operational" | "degraded" | "down" | "maintenance" | "unknown";
25
+ /** Every level in ladder order — the order the key row and the table use. */
26
+ declare const STATUS_LEVELS: readonly StatusLevel[];
27
+ /**
28
+ * How bad each level is. A strip cell takes the WORST level it overlaps, so
29
+ * an outage can never be averaged away by the operational time around it; a
30
+ * gap in monitoring outranks planned work, because "we don't know" is worse
31
+ * news than "we took it down on purpose".
32
+ */
33
+ declare const STATUS_SEVERITY: Record<StatusLevel, number>;
34
+ type StatusCardSize = "sm" | "md" | "lg";
35
+ /**
36
+ * What the big thing is: `level` (default) — the current state as a word, the
37
+ * answer an operational reader scans for; or `uptime` — the availability
38
+ * percentage, for an SLA tile whose subject is the number. Stamped as
39
+ * `data-headline`.
40
+ */
41
+ type StatusHeadline = "level" | "uptime";
42
+ /**
43
+ * How the strip divides the window. `auto` (default) buckets it to the finest
44
+ * step whose cells the measured frame can still render — so no incident is
45
+ * ever a sub-pixel sliver that disappears — and each cell takes the worst
46
+ * level inside it. `exact` draws the true state segments, durations
47
+ * proportional, which is honest on a wide frame and lossy on a narrow one.
48
+ * The named steps force a granularity. Every figure the card reports is
49
+ * computed from the exact segments whatever this says; only the drawing
50
+ * changes. Stamped as `data-resolution`.
51
+ */
52
+ type StatusResolution = "auto" | "exact" | "minute" | "hour" | "day" | "week";
53
+ /** Whether the availability target was reached over the window. Stamped as `data-verdict`. */
54
+ type StatusVerdict = "met" | "missed";
55
+ /** How availability reads against its target. Stamped as `data-polarity`. */
56
+ type StatusPolarity = "positive" | "negative" | "neutral";
57
+ /**
58
+ * What availability is a share OF. `monitored` (default) excludes planned
59
+ * maintenance and unmonitored time from the denominator — the industry
60
+ * convention, and the only honest one when a window is partly unwatched —
61
+ * and the card reports how much it excluded. `window` divides by the whole
62
+ * window, so maintenance and gaps count against the number.
63
+ */
64
+ type StatusUptimeMode = "monitored" | "window";
65
+ /**
66
+ * One reported state. `start` is when it began; `end` when it ended — omit it
67
+ * for the state that is still running and it runs to the window's end. A
68
+ * date-only ISO string (`"2026-09-10"`) is that calendar day's midnight in the
69
+ * card's `timeZone`; anything else is an exact instant. `label` names what
70
+ * happened (`Database failover`) for the tooltip, the incident table and the
71
+ * descriptions.
72
+ */
73
+ interface StatusPeriod {
74
+ level: StatusLevel;
75
+ start: Date | string | number;
76
+ end?: Date | string | number | null;
77
+ label?: string;
78
+ }
79
+ /** A reported state after normalisation: resolved, clipped to the window, contiguous with its neighbours. */
80
+ interface StatusSegment {
81
+ level: StatusLevel;
82
+ /** Instants, `end` exclusive. */
83
+ start: number;
84
+ end: number;
85
+ duration: number;
86
+ label?: string;
87
+ /** The segment was invented to cover a hole in the history — nobody was watching. */
88
+ gap?: boolean;
89
+ }
90
+ /** A maximal run of `degraded` / `down` time: what a reader counts as "something happened". */
91
+ interface StatusIncident {
92
+ start: number;
93
+ end: number;
94
+ duration: number;
95
+ /** The worst level reached inside the run. */
96
+ level: "degraded" | "down";
97
+ /** How much of the run was fully down. */
98
+ downtime: number;
99
+ label?: string;
100
+ }
101
+ /** Availability against a target, and the error budget that leaves. */
102
+ interface StatusSla {
103
+ /** The target as a ratio (`0.999`). */
104
+ target: number;
105
+ verdict: StatusVerdict;
106
+ /** Unavailable time the target allows over the denominator. */
107
+ allowed: number;
108
+ /** Unavailable time actually spent. */
109
+ used: number;
110
+ /** `allowed - used`, floored at zero. */
111
+ remaining: number;
112
+ /** How much of the budget is gone, as a ratio — may exceed 1. */
113
+ consumed: number;
114
+ }
115
+ interface StatusWindow {
116
+ start: number;
117
+ end: number;
118
+ span: number;
119
+ }
120
+ /** Everything the card reports, all of it measured on the exact segments. */
121
+ interface StatusRun {
122
+ window: StatusWindow;
123
+ /** The run, contiguous across the whole window. */
124
+ segments: StatusSegment[];
125
+ /** Milliseconds spent at each level. */
126
+ durations: Record<StatusLevel, number>;
127
+ /** The state as of the window's end. */
128
+ level: StatusLevel;
129
+ /** When the current state began — the start of the last unbroken run at `level`. */
130
+ since: number;
131
+ /** How long it has held, to the window's end. */
132
+ sinceDuration: number;
133
+ /** The state was already running when the window opened, so `sinceDuration` is a floor, not the true age. */
134
+ sinceClipped: boolean;
135
+ /** The worst level anywhere in the window. */
136
+ worst: StatusLevel;
137
+ incidents: StatusIncident[];
138
+ /** The longest incident, for the details table. */
139
+ longestIncident: StatusIncident | null;
140
+ /** Time fully down. */
141
+ downtime: number;
142
+ /** Time excluded from the denominator (maintenance and unmonitored), under `monitored`. */
143
+ excluded: number;
144
+ /** The denominator availability is a share of. */
145
+ monitored: number;
146
+ /** Operational share of `monitored`, or `null` when there is nothing to divide by. */
147
+ uptime: number | null;
148
+ mode: StatusUptimeMode;
149
+ sla: StatusSla | null;
150
+ polarity: StatusPolarity;
151
+ }
152
+ interface DeriveStatusStateInput {
153
+ status: StatusCardStatus;
154
+ /** A current level is known — reported or read off the history. */
155
+ hasLevel: boolean;
156
+ /** A run exists to draw. */
157
+ hasHistory: boolean;
158
+ /** Anything is on screen already, so a reload is a refresh rather than a first load. */
159
+ hasData: boolean;
160
+ filtered: boolean;
161
+ }
162
+ /**
163
+ * The state machine. Error wins; loading over existing data is a refresh (the
164
+ * previous render stays under the veil); a missing level is `no-match` when
165
+ * the consumer's filter caused it and `empty` otherwise; a level with no run
166
+ * behind it is `insufficient` — the card reports the state and says it has no
167
+ * history rather than drawing a single cell as if it were one.
168
+ */
169
+ declare function deriveStatusState({ status, hasLevel, hasHistory, hasData, filtered }: DeriveStatusStateInput): StatusCardState;
170
+ interface StatusWindowInput {
171
+ start: Date | string | number;
172
+ end: Date | string | number;
173
+ }
174
+ /**
175
+ * The strip's domain. An explicit `window` wins; otherwise it spans the
176
+ * history — from the first reported start to the last reported end, extended
177
+ * to `asOf` when the card knows when it was last true, so a still-running
178
+ * state reaches the right-hand edge. `null` when there is nothing to span or
179
+ * the bounds have no length.
180
+ */
181
+ declare function resolveStatusWindow(window: StatusWindowInput | undefined, history: readonly StatusPeriod[] | undefined, asOf: number | null, timeZone?: string): StatusWindow | null;
182
+ /**
183
+ * The reported states as one contiguous run across the window: resolved to
184
+ * instants, sorted, clipped to the window, implicit ends closed by the next
185
+ * start, overlaps resolved in favour of the later report (a correction
186
+ * supersedes what it corrects), holes filled with explicit `unknown` segments
187
+ * — a gap in monitoring is a fact, not a blank — and neighbours at the same
188
+ * level merged so the run reads as states rather than as reports.
189
+ */
190
+ declare function normalizeHistory(history: readonly StatusPeriod[] | undefined, window: StatusWindow, timeZone?: string): StatusSegment[];
191
+ /** The `degraded` / `down` runs inside a normalised run. */
192
+ declare function deriveIncidents(segments: readonly StatusSegment[]): StatusIncident[];
193
+ interface DeriveStatusRunInput {
194
+ level?: StatusLevel | null;
195
+ since?: Date | string | number | null;
196
+ history?: readonly StatusPeriod[];
197
+ window?: StatusWindowInput;
198
+ /** When the data was last true — the run's right-hand edge when no window is given. */
199
+ asOf?: number | null;
200
+ uptimeTarget?: number | null;
201
+ mode?: StatusUptimeMode;
202
+ timeZone?: string;
203
+ }
204
+ /**
205
+ * Everything the card reports, measured on the exact segments — never on the
206
+ * strip's cells, so the figures stay true however coarsely the strip has to
207
+ * draw. `null` when there is no window to measure over.
208
+ *
209
+ * A reported `level` is the current state, appended to the history as a
210
+ * still-running period: from `since` when the consumer knows when it began,
211
+ * otherwise from wherever the history stops — so the strip's right-hand edge
212
+ * always agrees with the word in the headline instead of contradicting it.
213
+ * With no `level` at all, the current state is read off the end of the run.
214
+ */
215
+ declare function deriveStatusRun({ level, since, history, window, asOf, uptimeTarget, mode, timeZone }: DeriveStatusRunInput): StatusRun | null;
216
+ /** How long the current state has held, and whether that is its true age. */
217
+ interface StatusHold {
218
+ since: number;
219
+ duration: number;
220
+ /** The state was already running when the window opened — the duration is a floor. */
221
+ atLeast: boolean;
222
+ }
223
+ /**
224
+ * The current state's age. From the run when there is one; from `since`
225
+ * against `asOf` when the card has a level but no window to draw (the
226
+ * `insufficient` state still owes the reader "how long"). `null` when nothing
227
+ * pins the moment it began.
228
+ */
229
+ declare function resolveStatusHold({ run, since, asOf, timeZone }: {
230
+ run: StatusRun | null;
231
+ since?: Date | string | number | null;
232
+ asOf: number | null;
233
+ timeZone?: string;
234
+ }): StatusHold | null;
235
+ /** One cell the strip draws — a bucket, or an exact segment. */
236
+ interface StatusStripRow {
237
+ /** Instants; already inset by the gap that keeps touching fills apart. */
238
+ start: number;
239
+ end: number;
240
+ /** The cell's true bounds, for the tooltip and the description. */
241
+ from: number;
242
+ to: number;
243
+ /** The worst level the cell covers — what it is painted. */
244
+ level: StatusLevel;
245
+ /** The paintable hue, carried in the row so a level change is a data push that cannot repaint its neighbours. */
246
+ c: string;
247
+ /** True milliseconds at each level inside the cell, for the tooltip. */
248
+ durations: Record<StatusLevel, number>;
249
+ /** The first event name the cell covers. */
250
+ label?: string;
251
+ }
252
+ interface StatusStrip {
253
+ rows: StatusStripRow[];
254
+ /** The bucket width in milliseconds, or `null` when the rows are exact segments. */
255
+ step: number | null;
256
+ /** The granularity dates read at in the cell tooltip. */
257
+ granularity: ArcTimeGranularity;
258
+ /** The granularity the x-axis labels read at. */
259
+ axisGranularity: ArcTimeGranularity;
260
+ }
261
+ /** The hue a level paints with, from the theme's status ladder. */
262
+ declare function statusHue(tokens: ChartTokens, level: StatusLevel): string;
263
+ /** The resolved granularity as a word — the value of `data-resolution`. */
264
+ declare function statusStepKey(step: number | null): string;
265
+ interface BuildStatusStripInput {
266
+ run: StatusRun;
267
+ resolution: StatusResolution;
268
+ tokens: ChartTokens;
269
+ /** The plot's measured width in pixels — what decides how fine `auto` can go. */
270
+ plotWidth: number;
271
+ /** The narrowest cell that still reads as a block. */
272
+ minCellPx: number;
273
+ /** The gap between touching cells, as a share of the cell pitch. */
274
+ gapRatio: number;
275
+ /** …clamped to this many pixels at each end, so a wide cell keeps its gap modest and a narrow one keeps its fill. */
276
+ gapMinPx: number;
277
+ gapMaxPx: number;
278
+ timeZone?: string;
279
+ }
280
+ /**
281
+ * The rows the strip draws. `exact` emits the true segments; every other
282
+ * resolution divides the window into equal cells, each painted the worst
283
+ * level it overlaps — the Statuspage rule, and the only way a 40-second
284
+ * outage in a 90-day window is visible at all. `auto` takes the finest step
285
+ * from the ladder whose cells still clear `minCellPx` at the measured width,
286
+ * so a narrow tile degrades to coarser cells instead of to sub-pixel slivers.
287
+ *
288
+ * Cells are inset by a share of their own pitch so touching fills stay apart
289
+ * without a stroke eating a narrow cell, and each row keeps its true bounds
290
+ * and its true per-level durations for the tooltip — the drawing rounds, the
291
+ * numbers never do.
292
+ */
293
+ declare function buildStatusStrip({ run, resolution, tokens, plotWidth, minCellPx, gapRatio, gapMinPx, gapMaxPx, timeZone }: BuildStatusStripInput): StatusStrip;
294
+ /** The bucket width, or `null` for exact segments. Exported for the unit tests. */
295
+ declare function resolveStep(resolution: StatusResolution, span: number, plotWidth: number, minCellPx: number): number | null;
296
+ interface StatusDurationUnits {
297
+ day: string;
298
+ hour: string;
299
+ minute: string;
300
+ second: string;
301
+ }
302
+ interface FormatDurationOptions {
303
+ units: StatusDurationUnits;
304
+ locale?: string;
305
+ /** How many units the text carries. Default 2 — `6d 4h`, never `6d 4h 12m 3s`. */
306
+ maxUnits?: number;
307
+ /** Rendered for a zero duration. */
308
+ zero: string;
309
+ }
310
+ /**
311
+ * A duration in the two most significant units it has — `6d 4h`, `2h 14m`,
312
+ * `41m`, `18s`. Precision to the decision (Few's pitfall #3): nobody pages
313
+ * anyone over the seconds of a six-day uptime. Units come from `labels` so a
314
+ * Thai product reads in Thai; `Intl.DurationFormat` is deliberately not used
315
+ * — it is too new to rely on across the runtimes this package supports.
316
+ */
317
+ declare function formatDuration(ms: number | null | undefined, { units, locale, maxUnits, zero }: FormatDurationOptions): string;
318
+ interface StatusTextFormatters {
319
+ /** Availability as a percentage, in the card's `uptimeFormat`. */
320
+ formatUptime: (value: number | null | undefined) => string;
321
+ /** A duration in words. */
322
+ formatDuration: (ms: number | null | undefined) => string;
323
+ /** An instant at a granularity. */
324
+ formatInstant: (instant: number | null | undefined, granularity?: ArcTimeGranularity) => string;
325
+ /** A cell's or an incident's span. */
326
+ formatSpan: (from: number, to: number, granularity?: ArcTimeGranularity) => string;
327
+ }
328
+ interface CreateStatusFormattersInput {
329
+ uptimeFormat: string;
330
+ formatUptimeValue?: (value: number) => string;
331
+ units: StatusDurationUnits;
332
+ zeroDuration: string;
333
+ locale?: string;
334
+ timeZone?: string;
335
+ }
336
+ /** One grammar for every surface, so the same duration or share never reads two ways. */
337
+ declare function createStatusFormatters({ uptimeFormat, formatUptimeValue, units, zeroDuration, locale, timeZone }: CreateStatusFormattersInput): StatusTextFormatters;
338
+ interface StatusCardLabels {
339
+ /** The five levels as the product names them. */
340
+ levelNames: Record<StatusLevel, string>;
341
+ /** How long the current state has held — `for 6d 4h`. */
342
+ heldFor: (duration: string) => string;
343
+ /** The chip when the current state began outside the window, so its true age is unknown. */
344
+ heldAtLeast: (duration: string) => string;
345
+ /** After the availability number in the badge's comparison line, with no target — `uptime · 30d`. */
346
+ uptimeOver: (span: string) => string;
347
+ /**
348
+ * … and with one. The verdict and the target it is against share ONE line —
349
+ * `99.50% target met` — rather than a chip above a `vs 99.50% target`
350
+ * caption: two rows to say one thing is what made the tile read as clutter.
351
+ * Kept short enough to stay on one line in a wallboard column, which is why
352
+ * the error budget is not appended here — it is a figure a reader looks up,
353
+ * and it has three homes already (the badge's own tooltip, the details
354
+ * table and the generated description).
355
+ */
356
+ vsTarget: (target: string, met: boolean) => string;
357
+ /** The availability figure's name in the table and the descriptions. */
358
+ uptime: string;
359
+ /** The denominator's name — availability is a share of monitored time by default. */
360
+ monitored: string;
361
+ /** The window's name. */
362
+ window: string;
363
+ /** The incident count in the strip's caption — `2 incidents`, `1 incident`. `count` is already formatted for the locale; `n` is the number, for languages that inflect. */
364
+ incidents: (count: string, n: number) => string;
365
+ /** The time fully down on the figures line — `41m down`. */
366
+ downFor: (duration: string) => string;
367
+ /** The error budget still unspent — `2m budget left`. */
368
+ budgetLeft: (duration: string) => string;
369
+ /** … and the overspend once it is gone — `18m over budget`. */
370
+ budgetOver: (duration: string) => string;
371
+ /** The table row naming the current state. */
372
+ currentRow: string;
373
+ sinceRow: string;
374
+ durationRow: string;
375
+ worstRow: string;
376
+ incidentsRow: string;
377
+ longestIncidentRow: string;
378
+ downtimeRow: string;
379
+ excludedRow: string;
380
+ targetRow: string;
381
+ budgetRow: string;
382
+ /** The table row naming what the strip's cells mean. */
383
+ stripRow: string;
384
+ /** The strip's granularity, declared — `worst status per day`. */
385
+ resolutionNote: (step: string) => string;
386
+ /** … and when the strip draws true segments instead of buckets. */
387
+ exactNote: string;
388
+ /** The verdicts as words. */
389
+ verdictNames: Record<StatusVerdict, string>;
390
+ /** Column headers for the summary table. */
391
+ tableItem: string;
392
+ tableValue: string;
393
+ /** Column headers for the incident table. */
394
+ incidentTableWhen: string;
395
+ incidentTableLevel: string;
396
+ incidentTableFor: string;
397
+ /** Caption over the incident table. */
398
+ incidentTableCaption: (name: string) => string;
399
+ /** The caption's centre when the window had none, and the incident table's own empty line. Kept short: the window's dates flank it on both sides. */
400
+ noIncidents: string;
401
+ /** Duration units, shortest form — a duration is scanned, not read. */
402
+ durationUnits: StatusDurationUnits;
403
+ /** Rendered for a zero duration. */
404
+ zeroDuration: string;
405
+ noData: string;
406
+ noMatch: string;
407
+ clearFilters: string;
408
+ error: string;
409
+ retry: string;
410
+ /** Caption in the strip's place when a level is known but no history is. */
411
+ noHistory: string;
412
+ stale: string;
413
+ asOf: string;
414
+ showTable: (name: string) => string;
415
+ hideTable: (name: string) => string;
416
+ about: (name: string) => string;
417
+ loading: (name: string) => string;
418
+ tableCaption: (name: string) => string;
419
+ /** Accessible name of the focusable availability group. */
420
+ uptimeGroup: (name: string) => string;
421
+ /** Accessible name of the current-state announcement. */
422
+ levelGroup: (name: string) => string;
423
+ insightMark: string;
424
+ /** The rows behind the availability badge, on hover and through `aria-describedby`. */
425
+ explanation: (input: StatusExplanationInput) => (readonly [string, string])[];
426
+ /** Sentences the card's own description is assembled from. */
427
+ levelSentence: (input: {
428
+ name: string;
429
+ level: string;
430
+ duration: string;
431
+ atLeast: boolean;
432
+ }) => string;
433
+ uptimeSentence: (input: {
434
+ uptime: string;
435
+ span: string;
436
+ monitored: string;
437
+ mode: StatusUptimeMode;
438
+ }) => string;
439
+ incidentSentence: (input: {
440
+ count: number;
441
+ countText: string;
442
+ downtime: string;
443
+ longest: string | null;
444
+ }) => string;
445
+ slaSentence: (input: {
446
+ target: string;
447
+ met: boolean;
448
+ remaining: string;
449
+ over: boolean;
450
+ }) => string;
451
+ windowSentence: (input: {
452
+ range: string;
453
+ }) => string;
454
+ /** The strip's own `aria-label`. */
455
+ chartDescription: (input: StatusChartDescriptionInput) => string;
456
+ }
457
+ interface StatusExplanationInput {
458
+ uptimeText: string;
459
+ spanText: string;
460
+ monitoredText: string;
461
+ mode: StatusUptimeMode;
462
+ excludedText: string | null;
463
+ downtimeText: string;
464
+ incidentsText: string;
465
+ sla: {
466
+ targetText: string;
467
+ verdictText: string;
468
+ remainingText: string;
469
+ over: boolean;
470
+ } | null;
471
+ }
472
+ interface StatusChartDescriptionInput {
473
+ name: string;
474
+ rangeText: string;
475
+ resolutionText: string;
476
+ levels: (readonly [string, string])[];
477
+ incidents: string;
478
+ }
479
+ declare const DEFAULT_STATUS_LABELS: StatusCardLabels;
480
+ declare function resolveStatusLabels(overrides?: Partial<StatusCardLabels>): StatusCardLabels;
481
+ /** The levels present in the window, in ladder order, with their durations — the key row, the table and the descriptions all read from this. */
482
+ declare function statusLevelBreakdown(run: StatusRun, formatters: StatusTextFormatters, labels: StatusCardLabels): {
483
+ level: StatusLevel;
484
+ name: string;
485
+ duration: number;
486
+ durationText: string;
487
+ }[];
488
+ /**
489
+ * A strip cell's span as the tooltip states it. A bucket's `end` is EXCLUSIVE,
490
+ * so at day granularity a single-day cell would read "Sep 2 – 3, 2026" — two
491
+ * days for one cell. Closing the range on the last instant the cell actually
492
+ * covers collapses it to "Sep 2, 2026" and turns a three-day cell into
493
+ * "Jun 12 – 14, 2026". Sub-day cells keep the exclusive bound, where
494
+ * "12:00 AM – 12:00 PM" reads better than "12:00 AM – 11:59 AM".
495
+ */
496
+ declare function formatStripCell(row: Pick<StatusStripRow, "from" | "to">, strip: Pick<StatusStrip, "granularity" | "step">, formatters: StatusTextFormatters): string;
497
+ /** How the strip's granularity is stated, in words. */
498
+ declare function describeResolution(strip: StatusStrip, formatters: StatusTextFormatters, labels: StatusCardLabels): string;
499
+ interface BuildStatusExplanationInput {
500
+ run: StatusRun;
501
+ formatters: StatusTextFormatters;
502
+ labels: StatusCardLabels;
503
+ }
504
+ /** The rows behind the availability badge — hover, and `aria-describedby`. */
505
+ declare function buildStatusExplanation({ run, formatters, labels }: BuildStatusExplanationInput): (readonly [string, string])[];
506
+ interface StatusDetailRow {
507
+ key: string;
508
+ label: string;
509
+ value: string;
510
+ /** Colours the value the way a delta is coloured — only where the figure means good or bad. */
511
+ tone?: StatusPolarity;
512
+ }
513
+ /** The summary table twin: every figure the card face and its tooltips show. */
514
+ declare function buildStatusDetailRows({ run, strip, formatters, labels }: BuildStatusExplanationInput & {
515
+ strip: StatusStrip | null;
516
+ }): StatusDetailRow[];
517
+ interface StatusIncidentRow {
518
+ key: string;
519
+ when: string;
520
+ level: StatusLevel;
521
+ levelName: string;
522
+ duration: string;
523
+ label?: string;
524
+ }
525
+ /** The incident table twin — every incident the strip paints, with its true duration. */
526
+ declare function buildStatusIncidentRows({ run, formatters, labels }: BuildStatusExplanationInput): StatusIncidentRow[];
527
+ interface BuildStatusDescriptionInput {
528
+ name: string;
529
+ state: StatusCardState;
530
+ run: StatusRun | null;
531
+ /** The current state — known in the `insufficient` state too, where there is no run. */
532
+ level: StatusLevel | null;
533
+ hold: StatusHold | null;
534
+ formatters: StatusTextFormatters;
535
+ labels: StatusCardLabels;
536
+ asOfText?: string;
537
+ }
538
+ /**
539
+ * The card's generated accessible description: the state and how long it has
540
+ * held, availability over the window (and how much of it was monitored), the
541
+ * incidents and the downtime, the SLA verdict with the budget it leaves, the
542
+ * window, and when the data was last true — Amy Cesal's alt-text formula
543
+ * applied to a status tile.
544
+ */
545
+ declare function buildStatusDescription({ name, state, run, level, hold, formatters, labels, asOfText }: BuildStatusDescriptionInput): string;
546
+ /** The strip's own `aria-label` — chart type, what data, at what granularity, and what it adds up to. */
547
+ declare function buildStatusChartDescription({ name, run, strip, formatters, labels }: {
548
+ name: string;
549
+ run: StatusRun;
550
+ strip: StatusStrip;
551
+ formatters: StatusTextFormatters;
552
+ labels: StatusCardLabels;
553
+ }): string;
554
+ //#endregion
555
+ export { BuildStatusDescriptionInput, BuildStatusExplanationInput, BuildStatusStripInput, CreateStatusFormattersInput, DEFAULT_STATUS_LABELS, DeriveStatusRunInput, DeriveStatusStateInput, FormatDurationOptions, STATUS_LEVELS, STATUS_SEVERITY, StatusCardLabels, StatusCardSize, StatusCardState, StatusCardStatus, StatusChartDescriptionInput, StatusDetailRow, StatusDurationUnits, StatusExplanationInput, StatusHeadline, StatusHold, StatusIncident, StatusIncidentRow, StatusLevel, StatusPeriod, StatusPolarity, StatusResolution, StatusRun, StatusSegment, StatusSla, StatusStrip, StatusStripRow, StatusTextFormatters, StatusUptimeMode, StatusVerdict, StatusWindow, StatusWindowInput, buildStatusChartDescription, buildStatusDescription, buildStatusDetailRows, buildStatusExplanation, buildStatusIncidentRows, buildStatusStrip, createStatusFormatters, deriveIncidents, deriveStatusRun, deriveStatusState, describeResolution, formatDuration, formatStripCell, normalizeHistory, resolveStatusHold, resolveStatusLabels, resolveStatusWindow, resolveStep, statusHue, statusLevelBreakdown, statusStepKey };