@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,330 @@
1
+ import { ArcDeltaDirection, ArcDeltaMode } from "../../lib/vega/formatters.js";
2
+ //#region src/components/TreeCard/TreeCard.model.d.ts
3
+ /** What the consumer's transport reports. */
4
+ type TreeCardStatus = "loading" | "ready" | "error";
5
+ /**
6
+ * What the card actually shows, derived from `status`, the nodes and
7
+ * `filtered`. Stamped on the root as `data-state`.
8
+ */
9
+ type TreeCardState = "loading" | "refreshing" | "ready" | "empty" | "no-match" | "error";
10
+ /** Which way is good for the measure: revenue up, cost down, headcount neutral. */
11
+ type TreeGoodDirection = "up" | "down" | "none";
12
+ /** How a change reads once `goodDirection` is applied. Stamped as `data-polarity`. */
13
+ type TreePolarity = "positive" | "negative" | "neutral";
14
+ type TreeDeltaMode = ArcDeltaMode;
15
+ /**
16
+ * Where a parent's value comes from. `sum` (default) always rolls children up,
17
+ * so the parts reconcile with the whole by construction. `own` lets a parent
18
+ * carry its own reading and reports the difference as an `Unallocated` child.
19
+ */
20
+ type TreeRollup = "sum" | "own";
21
+ /** Sibling order within every parent: the consumer's order, or ranked by value. */
22
+ type TreeSort = "none" | "asc" | "desc";
23
+ /** What the big number is. Stamped as `data-headline`. */
24
+ type TreeHeadline = "total" | "focus" | "none";
25
+ /** What the bars encode identity with. Stamped as `data-color-by`. */
26
+ type TreeColorBy = "depth" | "emphasis";
27
+ /** The second figure beside each row's value. */
28
+ type TreeRowSecondary = "share" | "share-of-total" | "delta" | "none";
29
+ type TreeCardSize = "sm" | "md" | "lg";
30
+ /** A row's part in the tree — a real node, the fold of a long tail, or the remainder a parent's children do not account for. */
31
+ type TreeNodeRole = "node" | "other" | "residual";
32
+ /**
33
+ * One node of the hierarchy. `key` identifies it among its siblings and
34
+ * defaults to `label`; `value` is its own reading, which `rollup: "sum"`
35
+ * ignores for any node that has children. `previous` is the same node in the
36
+ * comparison period — supply it on the leaves and the rollup carries it up.
37
+ */
38
+ interface TreeNode {
39
+ key?: string;
40
+ label: string;
41
+ value?: number | null;
42
+ previous?: number | null;
43
+ children?: readonly TreeNode[];
44
+ }
45
+ /** A node after the walk, in display order, with its rollup, share and ARIA bookkeeping resolved. */
46
+ interface TreeRow {
47
+ /** Unique across the tree: the parent's key, a slash, and this node's own key. */
48
+ key: string;
49
+ label: string;
50
+ /** 0 for a top-level row. Rendered as indentation and announced as `aria-level` (depth + 1). */
51
+ depth: number;
52
+ /** The rolled-up reading, or `null` when nothing under it has one. */
53
+ value: number | null;
54
+ /** The same node in the comparison period, rolled up the same way. `null` without `previous` data. */
55
+ previous: number | null;
56
+ parentKey: string | null;
57
+ /** The parent's rolled-up value — the denominator of `share`. The total for a top-level row. */
58
+ parentValue: number | null;
59
+ /**
60
+ * This row's value over its parent's. `null` when either is missing or the
61
+ * parent is zero. Mixed signs can push it past 100% or below zero — that is
62
+ * the honest report of the data, not a bug.
63
+ */
64
+ share: number | null;
65
+ /** This row's value over the whole tree's total, on the same terms as `share`. */
66
+ shareOfTotal: number | null;
67
+ /** This row can be opened — it kept children after the depth cap. */
68
+ hasChildren: boolean;
69
+ /** This row is open, so its children are among the visible rows. */
70
+ expanded: boolean;
71
+ /** Position among its siblings, 1-based — `aria-posinset`. */
72
+ posInSet: number;
73
+ /** How many siblings it has — `aria-setsize`. */
74
+ setSize: number;
75
+ role: TreeNodeRole;
76
+ /** Source nodes folded into this `Other` row; 0 for every other row. */
77
+ folded: number;
78
+ }
79
+ interface TreeSummary {
80
+ /** The rows on screen — every node whose ancestors are all expanded, depth-first. */
81
+ rows: TreeRow[];
82
+ /** Every node in the tree, expanded or not, depth-first — what the table twin lists. */
83
+ allRows: TreeRow[];
84
+ /** Keys of the nodes that are open in this build; the seed for the reader's first toggle. */
85
+ expandedKeys: string[];
86
+ /** The sum of the top-level rows — the denominator of every `shareOfTotal`. */
87
+ total: number | null;
88
+ /** The same sum in the comparison period. */
89
+ previousTotal: number | null;
90
+ /** Visible rows with a finite value. */
91
+ count: number;
92
+ /** Every node in the tree, folds and residuals included. */
93
+ nodeCount: number;
94
+ /** How many levels deep the tree goes after the cap; 1 for a flat list. */
95
+ levels: number;
96
+ /**
97
+ * The depth the total's direct parts live at — 0 when several roots share
98
+ * the card, 1 when one root *is* the total. `largest` and `topMover` are
99
+ * drawn from it, so "the biggest part" always means a part of the whole.
100
+ */
101
+ partsDepth: number;
102
+ /** The biggest part at `partsDepth` — the branch the description names. */
103
+ largest: TreeRow | null;
104
+ /** The part at `partsDepth` whose value moved furthest from `previous`. `null` without a comparison period. */
105
+ topMover: TreeRow | null;
106
+ /** Any visible value is below zero — the plot then draws a zero rule. */
107
+ hasNegative: boolean;
108
+ /** At least one node carries a `previous` reading, so deltas are real. */
109
+ hasPrevious: boolean;
110
+ /** A parent's children did not account for its own reading; an `Unallocated` row says so. */
111
+ hasResidual: boolean;
112
+ /** Source nodes folded into `Other` rows anywhere in the tree. */
113
+ folded: number;
114
+ /** Any node can be opened. A tree where nothing can is a flat list — the card stamps `data-insufficient`. */
115
+ expandable: boolean;
116
+ }
117
+ interface TreeDelta {
118
+ direction: ArcDeltaDirection;
119
+ polarity: TreePolarity;
120
+ /** Signed, formatted change against the comparison period: `+24.9%`, `-0.3 pp`, `+฿424K`. */
121
+ text: string;
122
+ renderedMode: ArcDeltaMode;
123
+ /** The same change in the other form, or `null` when there is no other form (a zero baseline has no percent). */
124
+ secondaryText: string | null;
125
+ }
126
+ /** Every string the card renders or announces, so a product can localise it. Sentences are functions. */
127
+ interface TreeCardLabels {
128
+ /** Heading of the total when `totalLabel` is not given. */
129
+ total: string;
130
+ /** Comparison line under the delta badge. */
131
+ versusPrevious: string;
132
+ increase: string;
133
+ decrease: string;
134
+ unchanged: string;
135
+ /** Suffix for a percentage-point delta. */
136
+ percentagePoints: string;
137
+ noData: string;
138
+ noMatch: string;
139
+ clearFilters: string;
140
+ error: string;
141
+ retry: string;
142
+ stale: string;
143
+ asOf: string;
144
+ /** Label of the row a parent's long tail folds into. */
145
+ other: string;
146
+ /** Label of the row carrying what a parent's children do not account for. */
147
+ unallocated: string;
148
+ /** Accessible name of a row's disclosure control — `Expand Online`. */
149
+ expand: (label: string) => string;
150
+ collapse: (label: string) => string;
151
+ /** Header of the tree's one control, which opens or closes every branch at once. */
152
+ expandAll: string;
153
+ collapseAll: string;
154
+ tableItem: string;
155
+ tableValue: string;
156
+ tableShare: string;
157
+ tableShareOfTotal: string;
158
+ tableLevel: string;
159
+ /** Header of the per-row change column. */
160
+ tableChange: string;
161
+ /** Read out after the selected row's label. */
162
+ selected: string;
163
+ /** Read out after a fold row's label — `3 items`. */
164
+ foldedItems: (count: number) => string;
165
+ showTable: (name: string) => string;
166
+ hideTable: (name: string) => string;
167
+ about: (name: string) => string;
168
+ loading: (name: string) => string;
169
+ tableCaption: (name: string) => string;
170
+ /** Accessible name of the tree — `Breakdown of Revenue`. */
171
+ treeLabel: (name: string) => string;
172
+ /** Accessible name of the delta group beside the value. */
173
+ deltaComparison: (name: string) => string;
174
+ /** Compact label/value rows explaining the delta badge. */
175
+ deltaExplanation: (input: {
176
+ label: string;
177
+ valueText: string;
178
+ previousText: string;
179
+ changeText: string;
180
+ secondaryText: string | null;
181
+ renderedMode: ArcDeltaMode;
182
+ direction: ArcDeltaDirection;
183
+ }) => readonly (readonly [label: string, value: string])[];
184
+ /** The comparison sentence in the card description. */
185
+ comparisonSentence: (input: {
186
+ word: string;
187
+ primary: string;
188
+ secondary: string | null;
189
+ previousText: string;
190
+ }) => string;
191
+ /** Names the branch that moved the total furthest. */
192
+ moverSentence: (input: {
193
+ label: string;
194
+ changeText: string;
195
+ }) => string;
196
+ /** How the tree is shaped — `12 parts across 3 levels`. */
197
+ shapeSummary: (input: {
198
+ nodes: number;
199
+ levels: number;
200
+ }) => string;
201
+ /** Lists the total's direct parts — `list` is `Online ฿2.1M (55%), Retail ฿1.7M (40%)`. */
202
+ partsSummary: (count: number, list: string) => string;
203
+ /** Appended when nodes were folded into `Other` rows. */
204
+ foldedSummary: (count: number) => string;
205
+ /** Appended when a parent's children do not reconcile with its own reading. */
206
+ residualSummary: string;
207
+ /** The plot's own `aria-label`. */
208
+ chartDescription: (input: {
209
+ name: string;
210
+ count: number;
211
+ levels: number;
212
+ total: string;
213
+ top: string;
214
+ topValue: string;
215
+ }) => string;
216
+ /** Accessible name of the AI mark beside the insight sentence. */
217
+ insightMark: string;
218
+ }
219
+ declare const DEFAULT_TREE_LABELS: TreeCardLabels;
220
+ declare function resolveTreeLabels(overrides?: Partial<TreeCardLabels>): TreeCardLabels;
221
+ interface DeriveTreeStateInput {
222
+ status: TreeCardStatus;
223
+ /** At least one node has a finite value. */
224
+ hasValue: boolean;
225
+ /** Anything is on screen already — any node at all — so a reload is a refresh, not a first load. */
226
+ hasData: boolean;
227
+ filtered: boolean;
228
+ }
229
+ /**
230
+ * The state machine. Error wins; loading over existing nodes is a refresh (the
231
+ * previous render stays under the veil); no values is `no-match` when the
232
+ * consumer's filter caused it and `empty` otherwise.
233
+ */
234
+ declare function deriveTreeState({ status, hasValue, hasData, filtered }: DeriveTreeStateInput): TreeCardState;
235
+ /** Local key segment of the row a parent's long tail folds into. */
236
+ declare const TREE_OTHER_KEY = "__other__";
237
+ /** Local key segment of the row carrying what a parent's children do not account for. */
238
+ declare const TREE_RESIDUAL_KEY = "__residual__";
239
+ /** Default share of a parent's own reading below which a mismatch with its children is rounding, not a gap. */
240
+ declare const DEFAULT_RESIDUAL_TOLERANCE = 0.0005;
241
+ interface BuildTreeOptions {
242
+ /** Where a parent's value comes from. Default `sum`. */
243
+ rollup?: TreeRollup;
244
+ /** Sibling order inside every parent. Default `none` — the consumer's order. */
245
+ sort?: TreeSort;
246
+ /** Fold each parent's tail past this many children into one `Other` row. */
247
+ maxChildren?: number;
248
+ /** Drop every node deeper than this (0-based). Ancestors keep the dropped values in their rollup. */
249
+ maxDepth?: number;
250
+ /** Keys the reader has open. `null` falls back to `expandDepth`. */
251
+ expanded?: ReadonlySet<string> | null;
252
+ /** With no explicit set, every node shallower than this is open. Default 1 — the top level and its children are visible. */
253
+ expandDepth?: number;
254
+ /** Report a parent's unaccounted remainder as an `Unallocated` child. Only ever fires under `rollup: "own"`. Default `true`. */
255
+ showResidual?: boolean;
256
+ /** Fraction of the parent's own reading below which a mismatch is rounding. Default `DEFAULT_RESIDUAL_TOLERANCE`. */
257
+ residualTolerance?: number;
258
+ otherLabel: string;
259
+ residualLabel: string;
260
+ }
261
+ /**
262
+ * Normalises the hierarchy into the rows the plot, the tree and the table all
263
+ * read from: unique path keys, a bottom-up rollup, the depth cap, each
264
+ * parent's long tail folded into `Other`, the unallocated remainder made
265
+ * explicit, shares against the parent and against the total, and the ARIA
266
+ * bookkeeping every `treeitem` needs. Returns `null` when there is nothing to
267
+ * speak of.
268
+ */
269
+ declare function buildTree(nodes: readonly TreeNode[] | undefined, options: BuildTreeOptions): TreeSummary | null;
270
+ interface DeriveTreeDeltaOptions {
271
+ deltaMode: TreeDeltaMode;
272
+ goodDirection: TreeGoodDirection;
273
+ format: string;
274
+ locale?: string;
275
+ percentagePoints: string;
276
+ }
277
+ /** A reading against its comparison period, with polarity resolved through `goodDirection`. `null` unless both are finite. */
278
+ declare function deriveTreeDelta(value: number | null | undefined, previous: number | null | undefined, { deltaMode, goodDirection, format, locale, percentagePoints }: DeriveTreeDeltaOptions): TreeDelta | null;
279
+ interface TreeTextFormatters {
280
+ formatValue: (value: number | null | undefined) => string;
281
+ /** A share as a percentage — `55%`. `MISSING_VALUE` when it could not be computed. */
282
+ formatShare: (share: number | null | undefined) => string;
283
+ /** A row's signed change against its own comparison period, in the card's `deltaMode`. */
284
+ formatChange: (value: number | null | undefined, previous: number | null | undefined) => string;
285
+ }
286
+ /** The formatters every text surface shares — headline, rows, delta, table, tooltip, descriptions. */
287
+ declare function createTreeFormatters({ format, locale, formatValue, deltaMode, shareFormat, percentagePoints }: {
288
+ format: string;
289
+ locale?: string;
290
+ formatValue?: (value: number) => string;
291
+ /** The form of every row's change — the badge's own `deltaMode`, so the table and the badge never disagree. */
292
+ deltaMode?: TreeDeltaMode;
293
+ /** The share grammar; whole percents at tile scale. */
294
+ shareFormat?: string;
295
+ percentagePoints?: string;
296
+ }): TreeTextFormatters;
297
+ interface BuildTreeDescriptionInput {
298
+ name: string;
299
+ state: TreeCardState;
300
+ headline: TreeHeadline;
301
+ summary: TreeSummary | null;
302
+ /** The row the headline is about — the selection, or `null` for the total. */
303
+ focus: TreeRow | null;
304
+ delta: TreeDelta | null;
305
+ formatters: TreeTextFormatters;
306
+ asOfText?: string;
307
+ labels: TreeCardLabels;
308
+ }
309
+ /**
310
+ * The card's text equivalent (Amy Cesal's alt-text formula: what it is, what
311
+ * it shows, why it is here, when it was true) — the figure's accessible
312
+ * description.
313
+ *
314
+ * It names the shape, the total's direct parts with their values and shares,
315
+ * and the branch that moved furthest — rather than enumerating every visible
316
+ * row the way a flat card must. The rows here are real `treeitem`s carrying
317
+ * their own label, value, share and `aria-level`, so a screen reader already
318
+ * reaches each one in place; repeating all of them in one sentence would bury
319
+ * the answer this description exists to give.
320
+ */
321
+ declare function buildTreeDescription({ name, state, headline, summary, focus, delta, formatters, asOfText, labels }: BuildTreeDescriptionInput): string;
322
+ /** The plot's own `description` — the `aria-label` Vega stamps on the `graphics-document`. */
323
+ declare function buildTreeChartDescription({ name, summary, formatters, labels }: {
324
+ name: string;
325
+ summary: TreeSummary;
326
+ formatters: TreeTextFormatters;
327
+ labels: TreeCardLabels;
328
+ }): string;
329
+ //#endregion
330
+ export { BuildTreeDescriptionInput, BuildTreeOptions, DEFAULT_RESIDUAL_TOLERANCE, DEFAULT_TREE_LABELS, DeriveTreeDeltaOptions, DeriveTreeStateInput, TREE_OTHER_KEY, TREE_RESIDUAL_KEY, TreeCardLabels, TreeCardSize, TreeCardState, TreeCardStatus, TreeColorBy, TreeDelta, TreeDeltaMode, TreeGoodDirection, TreeHeadline, TreeNode, TreeNodeRole, TreePolarity, TreeRollup, TreeRow, TreeRowSecondary, TreeSort, TreeSummary, TreeTextFormatters, buildTree, buildTreeChartDescription, buildTreeDescription, createTreeFormatters, deriveTreeDelta, deriveTreeState, resolveTreeLabels };