@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,4 @@
1
+ import { BuildHighlightAnalysisInsightInput, BuildHighlightDescriptionInput, DEFAULT_HIGHLIGHT_LABELS, DEFAULT_PERCENTILE_THRESHOLDS, DEFAULT_SIGMA_THRESHOLDS, DeriveHighlightDeltaOptions, DeriveHighlightStateInput, DerivePeersOptions, HighlightBandRow, HighlightBaseline, HighlightCardLabels, HighlightCardSize, HighlightCardState, HighlightCardStatus, HighlightContextDatasets, HighlightContextRow, HighlightDelta, HighlightDeltaMode, HighlightDriver, HighlightDriverInfo, HighlightDriversInfo, HighlightEndpointRow, HighlightGoodDirection, HighlightInsightSegment, HighlightLeg, HighlightMark, HighlightOutsideRow, HighlightPeer, HighlightPeerMode, HighlightPeerStats, HighlightPoint, HighlightPolarity, HighlightReading, HighlightRow, HighlightScale, HighlightSection, HighlightSeverity, HighlightSeverityThresholds, HighlightSummary, HighlightTextFormatters, HighlightWindow, HighlightWindowInfo, HighlightXType, NormalizeDriversOptions, ResolveHighlightWindowOptions, buildContextDescription, buildDriverRows, buildDriversDescription, buildHighlightAnalysisInsight, buildHighlightContextDatasets, buildHighlightDescription, buildPeerVerdict, buildPeersDescription, buildTypicalRows, createHighlightFormatters, deriveHighlightDelta, deriveHighlightState, derivePeers, highlightSegmentsToText, normalizeDrivers, normalizeHighlightSeries, resolveHighlightLabels, resolveHighlightWindow } from "./HighlightCard.model.js";
2
+ import { HighlightCard, HighlightCardProps } from "./HighlightCard.js";
3
+ import { HIGHLIGHT_BAND_DATASET, HIGHLIGHT_DRIVERS_DATASET, HIGHLIGHT_DRIVER_HOVER_PARAM, HIGHLIGHT_ENDPOINTS_DATASET, HIGHLIGHT_END_PARAM, HIGHLIGHT_HOVER_PARAM, HIGHLIGHT_INSIDE_DATASET, HIGHLIGHT_OUTSIDE_DATASET, HIGHLIGHT_PEERS_DATASET, HIGHLIGHT_PEER_HOVER_PARAM, HIGHLIGHT_START_PARAM, HIGHLIGHT_TABLE_DATASET, HIGHLIGHT_TYPICAL_DATASET, HIGHLIGHT_X_TICKS_PARAM, HIGHLIGHT_ZERO_DATASET, HighlightContextSpecOptions, HighlightDriversSpecOptions, HighlightPeersSpecOptions, MAX_DRIVER_BAR_HEIGHT, buildHighlightContextSpec, buildHighlightDriversSpec, buildHighlightPeersSpec } from "./HighlightCard.chart.js";
4
+ export { type BuildHighlightAnalysisInsightInput, type BuildHighlightDescriptionInput, DEFAULT_HIGHLIGHT_LABELS, DEFAULT_PERCENTILE_THRESHOLDS, DEFAULT_SIGMA_THRESHOLDS, type DeriveHighlightDeltaOptions, type DeriveHighlightStateInput, type DerivePeersOptions, HIGHLIGHT_BAND_DATASET, HIGHLIGHT_DRIVERS_DATASET, HIGHLIGHT_DRIVER_HOVER_PARAM, HIGHLIGHT_ENDPOINTS_DATASET, HIGHLIGHT_END_PARAM, HIGHLIGHT_HOVER_PARAM, HIGHLIGHT_INSIDE_DATASET, HIGHLIGHT_OUTSIDE_DATASET, HIGHLIGHT_PEERS_DATASET, HIGHLIGHT_PEER_HOVER_PARAM, HIGHLIGHT_START_PARAM, HIGHLIGHT_TABLE_DATASET, HIGHLIGHT_TYPICAL_DATASET, HIGHLIGHT_X_TICKS_PARAM, HIGHLIGHT_ZERO_DATASET, type HighlightBandRow, type HighlightBaseline, HighlightCard, type HighlightCardLabels, type HighlightCardProps, type HighlightCardSize, type HighlightCardState, type HighlightCardStatus, type HighlightContextDatasets, type HighlightContextRow, type HighlightContextSpecOptions, type HighlightDelta, type HighlightDeltaMode, type HighlightDriver, type HighlightDriverInfo, type HighlightDriversInfo, type HighlightDriversSpecOptions, type HighlightEndpointRow, type HighlightGoodDirection, type HighlightInsightSegment, type HighlightLeg, type HighlightMark, type HighlightOutsideRow, type HighlightPeer, type HighlightPeerMode, type HighlightPeerStats, type HighlightPeersSpecOptions, type HighlightPoint, type HighlightPolarity, type HighlightReading, type HighlightRow, type HighlightScale, type HighlightSection, type HighlightSeverity, type HighlightSeverityThresholds, type HighlightSummary, type HighlightTextFormatters, type HighlightWindow, type HighlightWindowInfo, type HighlightXType, MAX_DRIVER_BAR_HEIGHT, type NormalizeDriversOptions, type ResolveHighlightWindowOptions, buildContextDescription, buildDriverRows, buildDriversDescription, buildHighlightAnalysisInsight, buildHighlightContextDatasets, buildHighlightContextSpec, buildHighlightDescription, buildHighlightDriversSpec, buildHighlightPeersSpec, buildPeerVerdict, buildPeersDescription, buildTypicalRows, createHighlightFormatters, deriveHighlightDelta, deriveHighlightState, derivePeers, highlightSegmentsToText, normalizeDrivers, normalizeHighlightSeries, resolveHighlightLabels, resolveHighlightWindow };
@@ -0,0 +1,4 @@
1
+ import { HIGHLIGHT_BAND_DATASET, HIGHLIGHT_DRIVERS_DATASET, HIGHLIGHT_DRIVER_HOVER_PARAM, HIGHLIGHT_ENDPOINTS_DATASET, HIGHLIGHT_END_PARAM, HIGHLIGHT_HOVER_PARAM, HIGHLIGHT_INSIDE_DATASET, HIGHLIGHT_OUTSIDE_DATASET, HIGHLIGHT_PEERS_DATASET, HIGHLIGHT_PEER_HOVER_PARAM, HIGHLIGHT_START_PARAM, HIGHLIGHT_TABLE_DATASET, HIGHLIGHT_TYPICAL_DATASET, HIGHLIGHT_X_TICKS_PARAM, HIGHLIGHT_ZERO_DATASET, MAX_DRIVER_BAR_HEIGHT, buildHighlightContextSpec, buildHighlightDriversSpec, buildHighlightPeersSpec } from "./HighlightCard.chart.js";
2
+ import { DEFAULT_HIGHLIGHT_LABELS, DEFAULT_PERCENTILE_THRESHOLDS, DEFAULT_SIGMA_THRESHOLDS, buildContextDescription, buildDriverRows, buildDriversDescription, buildHighlightAnalysisInsight, buildHighlightContextDatasets, buildHighlightDescription, buildPeerVerdict, buildPeersDescription, buildTypicalRows, createHighlightFormatters, deriveHighlightDelta, deriveHighlightState, derivePeers, highlightSegmentsToText, normalizeDrivers, normalizeHighlightSeries, resolveHighlightLabels, resolveHighlightWindow } from "./HighlightCard.model.js";
3
+ import { HighlightCard } from "./HighlightCard.js";
4
+ export { DEFAULT_HIGHLIGHT_LABELS, DEFAULT_PERCENTILE_THRESHOLDS, DEFAULT_SIGMA_THRESHOLDS, HIGHLIGHT_BAND_DATASET, HIGHLIGHT_DRIVERS_DATASET, HIGHLIGHT_DRIVER_HOVER_PARAM, HIGHLIGHT_ENDPOINTS_DATASET, HIGHLIGHT_END_PARAM, HIGHLIGHT_HOVER_PARAM, HIGHLIGHT_INSIDE_DATASET, HIGHLIGHT_OUTSIDE_DATASET, HIGHLIGHT_PEERS_DATASET, HIGHLIGHT_PEER_HOVER_PARAM, HIGHLIGHT_START_PARAM, HIGHLIGHT_TABLE_DATASET, HIGHLIGHT_TYPICAL_DATASET, HIGHLIGHT_X_TICKS_PARAM, HIGHLIGHT_ZERO_DATASET, HighlightCard, MAX_DRIVER_BAR_HEIGHT, buildContextDescription, buildDriverRows, buildDriversDescription, buildHighlightAnalysisInsight, buildHighlightContextDatasets, buildHighlightContextSpec, buildHighlightDescription, buildHighlightDriversSpec, buildHighlightPeersSpec, buildPeerVerdict, buildPeersDescription, buildTypicalRows, createHighlightFormatters, deriveHighlightDelta, deriveHighlightState, derivePeers, highlightSegmentsToText, normalizeDrivers, normalizeHighlightSeries, resolveHighlightLabels, resolveHighlightWindow };
@@ -0,0 +1,91 @@
1
+ import { ChartTokens } from "../../lib/vega/tokens.js";
2
+ import { InsightXType } from "./InsightCard.model.js";
3
+ import { TopLevelSpec } from "vega-lite";
4
+ //#region src/components/InsightCard/InsightCard.chart.d.ts
5
+ /** The measure's history — `{ x, y, e, lo, hi, f, c }`, one row per period. */
6
+ declare const INSIGHT_POINTS_DATASET = "points";
7
+ /** The flagged period's expected interval — one row `{ x, lo, hi }`, and only when the corridor is a single scalar band. */
8
+ declare const INSIGHT_INTERVAL_DATASET = "interval";
9
+ /** The range strip's one row — `{ lo, hi, e, v, d0, d1, c }`. */
10
+ declare const INSIGHT_STRIP_DATASET = "strip";
11
+ /** Evenly spaced x labels that keep both ends and the flagged period. */
12
+ declare const INSIGHT_X_TICKS_PARAM = "xTicks";
13
+ /** The flagged period, so the axis anchors a label on it. */
14
+ declare const INSIGHT_FLAG_PARAM = "flaggedX";
15
+ /** The shared-x hover selection: projected onto `x`, so pointing anywhere in a column reads that period. */
16
+ declare const INSIGHT_HOVER_PARAM = "hover";
17
+ /** Which axes the spark draws. `none` is the sparkline convention the card defaults to. */
18
+ type InsightAxes = "none" | "x" | "y" | "both";
19
+ interface InsightSparkSpecOptions {
20
+ /** Plot height in pixels. The width rides the View API. */
21
+ height: number;
22
+ xType: InsightXType;
23
+ /** Which axes to draw. The key row above the plot carries the numbers, so `none` is honest. */
24
+ axes: InsightAxes;
25
+ /** Include zero in the value scale. A line may crop; `zero` is for a measure whose distance from zero is the point. */
26
+ zero: boolean;
27
+ /** Draw the per-period corridor as a band. Only when two or more rows carry one. */
28
+ band: boolean;
29
+ /** Draw the per-period expectation as a dashed line. Only when two or more rows carry one. */
30
+ expectedLine: boolean;
31
+ /** Draw the flagged period's expected interval as a rule. Only when the corridor is a single scalar band. */
32
+ interval: boolean;
33
+ /** Wire the shared-x hover selection and the tooltip channel. */
34
+ tooltip: boolean;
35
+ /** Tooltip and axis titles. */
36
+ xTitle: string;
37
+ valueTitle: string;
38
+ expectedTitle: string;
39
+ /** `arcNumber` grammar for the value axis and the tooltip. */
40
+ valueFormat: string;
41
+ /** `arcTime` grammar for the tooltip, and the shorter one for the axis. */
42
+ timeFormat: string;
43
+ axisTimeFormat: string;
44
+ /** Value-axis tick budget. */
45
+ yTicks: number;
46
+ locale?: string;
47
+ }
48
+ /**
49
+ * The evidence spark: the measure over its history, the expected corridor
50
+ * behind it, and the flagged reading marked with a dot inside a ring.
51
+ *
52
+ * The series takes the emphasis hue — one measure needs no identity colour —
53
+ * while the corridor and the expectation take the context gray and the
54
+ * reference role, so the ground can never be mistaken for a second series.
55
+ * The flagged marker's colour rides the pushed row (`c`) with `scale: null`:
56
+ * it is the one place a status hue belongs on a mark here, because there the
57
+ * encoded value really is good or bad news.
58
+ */
59
+ declare function buildInsightSparkSpec(options: InsightSparkSpecOptions, tokens: ChartTokens): TopLevelSpec;
60
+ interface InsightStripSpecOptions {
61
+ /** Strip height in pixels. The width rides the View API. */
62
+ height: number;
63
+ /** Draw the expected band. `false` when the detector reported only a point expectation. */
64
+ band: boolean;
65
+ /** Draw the expectation tick. */
66
+ expected: boolean;
67
+ /** Wire the tooltip channel on the observed marker. */
68
+ tooltip: boolean;
69
+ observedTitle: string;
70
+ expectedTitle: string;
71
+ lowerTitle: string;
72
+ upperTitle: string;
73
+ valueFormat: string;
74
+ locale?: string;
75
+ }
76
+ /**
77
+ * The range strip: the expected band laid on the value axis with the observed
78
+ * reading marked against it. One dimension, no time — the honest degrade when
79
+ * a finding has no history to plot, and the compact evidence for a dense rail.
80
+ *
81
+ * It draws no axis. The key row above it prints the reading, the expectation
82
+ * and the range in real type, which is both more legible than three tick
83
+ * labels under a 24px strip and the reason every layer here can agree on
84
+ * `axis: null` — the one arrangement Vega-Lite never mis-merges.
85
+ *
86
+ * The domain comes out of the pushed row rather than from a scale
87
+ * computation, so a new finding moves the marker without re-embedding.
88
+ */
89
+ declare function buildInsightStripSpec(options: InsightStripSpecOptions, tokens: ChartTokens): TopLevelSpec;
90
+ //#endregion
91
+ export { INSIGHT_FLAG_PARAM, INSIGHT_HOVER_PARAM, INSIGHT_INTERVAL_DATASET, INSIGHT_POINTS_DATASET, INSIGHT_STRIP_DATASET, INSIGHT_X_TICKS_PARAM, InsightAxes, InsightSparkSpecOptions, InsightStripSpecOptions, buildInsightSparkSpec, buildInsightStripSpec };
@@ -0,0 +1,471 @@
1
+ import { AXIS_LABEL_LIMIT_EXPR } from "../../lib/vega/axisTicks.js";
2
+ import { arcVegaConfig } from "../../lib/vega/config.js";
3
+ //#region src/components/InsightCard/InsightCard.chart.ts
4
+ /** The measure's history — `{ x, y, e, lo, hi, f, c }`, one row per period. */
5
+ const INSIGHT_POINTS_DATASET = "points";
6
+ /** The flagged period's expected interval — one row `{ x, lo, hi }`, and only when the corridor is a single scalar band. */
7
+ const INSIGHT_INTERVAL_DATASET = "interval";
8
+ /** The range strip's one row — `{ lo, hi, e, v, d0, d1, c }`. */
9
+ const INSIGHT_STRIP_DATASET = "strip";
10
+ /** Evenly spaced x labels that keep both ends and the flagged period. */
11
+ const INSIGHT_X_TICKS_PARAM = "xTicks";
12
+ /** The flagged period, so the axis anchors a label on it. */
13
+ const INSIGHT_FLAG_PARAM = "flaggedX";
14
+ /** The shared-x hover selection: projected onto `x`, so pointing anywhere in a column reads that period. */
15
+ const INSIGHT_HOVER_PARAM = "hover";
16
+ const POINT_SIZE = 72;
17
+ const RING_SIZE = 220;
18
+ const BAND_OPACITY = .16;
19
+ const INTERVAL_WIDTH = 7;
20
+ const INTERVAL_OPACITY = .34;
21
+ const EXPECTED_DASH = [3, 3];
22
+ const STRIP_MID = .5;
23
+ const STRIP_BAND = [.24, .76];
24
+ const STRIP_TICK = [.14, .86];
25
+ const STRIP_HEIGHT_SCALE = {
26
+ domain: [0, 1],
27
+ nice: false
28
+ };
29
+ const STRIP_DOMAIN_EXPR = `length(data('${INSIGHT_STRIP_DATASET}')) ? [data('${INSIGHT_STRIP_DATASET}')[0].d0, data('${INSIGHT_STRIP_DATASET}')[0].d1] : [0, 1]`;
30
+ const FLAG_INDEX_EXPR = `indexof(pluck(data('${INSIGHT_POINTS_DATASET}'), 'f'), true)`;
31
+ const FLAG_EXPR = `(${FLAG_INDEX_EXPR} >= 0 ? data('${INSIGHT_POINTS_DATASET}')[${FLAG_INDEX_EXPR}].x : null)`;
32
+ /**
33
+ * The evidence spark: the measure over its history, the expected corridor
34
+ * behind it, and the flagged reading marked with a dot inside a ring.
35
+ *
36
+ * The series takes the emphasis hue — one measure needs no identity colour —
37
+ * while the corridor and the expectation take the context gray and the
38
+ * reference role, so the ground can never be mistaken for a second series.
39
+ * The flagged marker's colour rides the pushed row (`c`) with `scale: null`:
40
+ * it is the one place a status hue belongs on a mark here, because there the
41
+ * encoded value really is good or bad news.
42
+ */
43
+ function buildInsightSparkSpec(options, tokens) {
44
+ const { height, xType, axes, zero, band, expectedLine, interval, tooltip, xTitle, valueTitle, expectedTitle, valueFormat, timeFormat, axisTimeFormat, yTicks, locale } = options;
45
+ const discreteX = xType === "ordinal";
46
+ const showX = axes === "x" || axes === "both";
47
+ const showY = axes === "y" || axes === "both";
48
+ const xTickFormat = xType === "temporal" ? axisTimeFormat : "compact";
49
+ const xTickKind = xType === "temporal" ? "time" : xType === "quantitative" ? "number" : "text";
50
+ const axisArgs = `domain('x'), width, ${discreteX}, ${JSON.stringify(xTickFormat)}, ${JSON.stringify(xTickKind)}`;
51
+ const anchorsArg = `, [${INSIGHT_FLAG_PARAM}, ${INSIGHT_FLAG_PARAM}]`;
52
+ const xAxisLabels = xType === "temporal" ? {
53
+ format: axisTimeFormat,
54
+ formatType: "arcTime"
55
+ } : xType === "quantitative" ? {
56
+ format: "compact",
57
+ formatType: "arcNumber"
58
+ } : {};
59
+ const xAxis = showX ? {
60
+ title: null,
61
+ orient: "bottom",
62
+ domain: true,
63
+ ticks: false,
64
+ grid: false,
65
+ values: { expr: INSIGHT_X_TICKS_PARAM },
66
+ labelAngle: 0,
67
+ labelAlign: { expr: `arcAxisLabelAlign(datum.value, ${axisArgs}${anchorsArg})` },
68
+ labelFlush: false,
69
+ labelOverlap: false,
70
+ labelLimit: { expr: AXIS_LABEL_LIMIT_EXPR },
71
+ labelPadding: 4,
72
+ ...xAxisLabels
73
+ } : null;
74
+ const yAxis = showY ? {
75
+ title: null,
76
+ orient: "left",
77
+ domain: false,
78
+ ticks: false,
79
+ grid: true,
80
+ tickCount: yTicks,
81
+ labelOverlap: true,
82
+ labelPadding: 6,
83
+ format: valueFormat,
84
+ formatType: "arcNumber"
85
+ } : null;
86
+ const xField = discreteX ? {
87
+ field: "x",
88
+ type: "ordinal",
89
+ sort: null,
90
+ axis: xAxis,
91
+ title: null
92
+ } : {
93
+ field: "x",
94
+ type: xType,
95
+ axis: xAxis,
96
+ title: null,
97
+ scale: {
98
+ nice: false,
99
+ ...xType === "quantitative" ? { zero: false } : {}
100
+ }
101
+ };
102
+ const yField = {
103
+ field: "y",
104
+ type: "quantitative",
105
+ axis: yAxis,
106
+ title: null,
107
+ scale: {
108
+ zero,
109
+ nice: showY
110
+ },
111
+ stack: null
112
+ };
113
+ const markerColor = {
114
+ field: "c",
115
+ type: "nominal",
116
+ scale: null,
117
+ legend: null
118
+ };
119
+ const tooltipChannel = [
120
+ xType === "temporal" ? {
121
+ field: "x",
122
+ type: "temporal",
123
+ title: xTitle,
124
+ format: timeFormat,
125
+ formatType: "arcTime"
126
+ } : xType === "quantitative" ? {
127
+ field: "x",
128
+ type: "quantitative",
129
+ title: xTitle,
130
+ format: "number",
131
+ formatType: "arcNumber"
132
+ } : {
133
+ field: "x",
134
+ type: "nominal",
135
+ title: xTitle
136
+ },
137
+ {
138
+ field: "y",
139
+ type: "quantitative",
140
+ title: valueTitle,
141
+ format: valueFormat,
142
+ formatType: "arcNumber"
143
+ },
144
+ {
145
+ field: "e",
146
+ type: "quantitative",
147
+ title: expectedTitle,
148
+ format: valueFormat,
149
+ formatType: "arcNumber"
150
+ }
151
+ ];
152
+ const layers = [];
153
+ if (band) layers.push({
154
+ mark: {
155
+ type: "area",
156
+ line: false,
157
+ interpolate: "linear",
158
+ fill: tokens.context,
159
+ fillOpacity: BAND_OPACITY,
160
+ aria: false
161
+ },
162
+ encoding: {
163
+ x: xField,
164
+ y: {
165
+ ...yField,
166
+ field: "lo"
167
+ },
168
+ y2: { field: "hi" }
169
+ }
170
+ });
171
+ if (expectedLine) layers.push({
172
+ mark: {
173
+ type: "line",
174
+ interpolate: "linear",
175
+ stroke: tokens.reference,
176
+ strokeWidth: 1,
177
+ strokeDash: EXPECTED_DASH,
178
+ invalid: "break-paths-show-domains",
179
+ aria: false
180
+ },
181
+ encoding: {
182
+ x: xField,
183
+ y: {
184
+ ...yField,
185
+ field: "e"
186
+ }
187
+ }
188
+ });
189
+ if (interval) layers.push({
190
+ data: { name: INSIGHT_INTERVAL_DATASET },
191
+ mark: {
192
+ type: "rule",
193
+ stroke: tokens.context,
194
+ strokeWidth: INTERVAL_WIDTH,
195
+ strokeCap: "butt",
196
+ opacity: INTERVAL_OPACITY,
197
+ aria: false
198
+ },
199
+ encoding: {
200
+ x: xField,
201
+ y: {
202
+ ...yField,
203
+ field: "lo"
204
+ },
205
+ y2: { field: "hi" }
206
+ }
207
+ });
208
+ layers.push({
209
+ mark: {
210
+ type: "line",
211
+ interpolate: "linear",
212
+ stroke: tokens.emphasis,
213
+ invalid: "break-paths-show-domains",
214
+ aria: false
215
+ },
216
+ encoding: {
217
+ x: xField,
218
+ y: yField
219
+ }
220
+ });
221
+ layers.push({
222
+ transform: [{ filter: "datum.f === true && isValid(datum.y)" }],
223
+ mark: {
224
+ type: "point",
225
+ filled: false,
226
+ size: RING_SIZE,
227
+ strokeWidth: 1.5,
228
+ opacity: 1,
229
+ aria: false
230
+ },
231
+ encoding: {
232
+ x: xField,
233
+ y: yField,
234
+ stroke: markerColor
235
+ }
236
+ });
237
+ layers.push({
238
+ transform: [{ filter: "datum.f === true && isValid(datum.y)" }],
239
+ mark: {
240
+ type: "point",
241
+ filled: true,
242
+ size: POINT_SIZE,
243
+ stroke: tokens.background,
244
+ strokeWidth: 1.5,
245
+ opacity: 1,
246
+ aria: false
247
+ },
248
+ encoding: {
249
+ x: xField,
250
+ y: yField,
251
+ fill: markerColor
252
+ }
253
+ });
254
+ if (tooltip) layers.push({
255
+ params: [{
256
+ name: INSIGHT_HOVER_PARAM,
257
+ select: {
258
+ type: "point",
259
+ on: "pointermove",
260
+ nearest: true,
261
+ clear: "pointerout",
262
+ encodings: ["x"]
263
+ }
264
+ }],
265
+ mark: {
266
+ type: "point",
267
+ filled: true,
268
+ size: POINT_SIZE,
269
+ stroke: tokens.background,
270
+ strokeWidth: 1.5,
271
+ aria: false
272
+ },
273
+ encoding: {
274
+ x: xField,
275
+ y: yField,
276
+ fill: { value: tokens.emphasis },
277
+ opacity: {
278
+ condition: {
279
+ param: INSIGHT_HOVER_PARAM,
280
+ empty: false,
281
+ value: 1
282
+ },
283
+ value: 0
284
+ },
285
+ tooltip: tooltipChannel
286
+ }
287
+ });
288
+ const params = [{
289
+ name: INSIGHT_FLAG_PARAM,
290
+ expr: FLAG_EXPR
291
+ }];
292
+ if (showX) params.push({
293
+ name: INSIGHT_X_TICKS_PARAM,
294
+ expr: `arcAxisTicks(${axisArgs}${anchorsArg})`
295
+ });
296
+ return {
297
+ $schema: "https://vega.github.io/schema/vega-lite/v6.json",
298
+ width: 240,
299
+ height,
300
+ autosize: {
301
+ type: "fit",
302
+ contains: "padding"
303
+ },
304
+ padding: 0,
305
+ background: "transparent",
306
+ data: { name: INSIGHT_POINTS_DATASET },
307
+ params,
308
+ layer: layers,
309
+ config: arcVegaConfig(tokens, { locale })
310
+ };
311
+ }
312
+ /**
313
+ * The range strip: the expected band laid on the value axis with the observed
314
+ * reading marked against it. One dimension, no time — the honest degrade when
315
+ * a finding has no history to plot, and the compact evidence for a dense rail.
316
+ *
317
+ * It draws no axis. The key row above it prints the reading, the expectation
318
+ * and the range in real type, which is both more legible than three tick
319
+ * labels under a 24px strip and the reason every layer here can agree on
320
+ * `axis: null` — the one arrangement Vega-Lite never mis-merges.
321
+ *
322
+ * The domain comes out of the pushed row rather than from a scale
323
+ * computation, so a new finding moves the marker without re-embedding.
324
+ */
325
+ function buildInsightStripSpec(options, tokens) {
326
+ const { height, band, expected, tooltip, observedTitle, expectedTitle, lowerTitle, upperTitle, valueFormat, locale } = options;
327
+ const xChannel = (field) => ({
328
+ field,
329
+ type: "quantitative",
330
+ scale: {
331
+ domain: { expr: STRIP_DOMAIN_EXPR },
332
+ nice: false
333
+ },
334
+ axis: null,
335
+ title: null
336
+ });
337
+ const yAt = (value) => ({
338
+ datum: value,
339
+ type: "quantitative",
340
+ scale: STRIP_HEIGHT_SCALE,
341
+ axis: null,
342
+ title: null
343
+ });
344
+ const markerColor = {
345
+ field: "c",
346
+ type: "nominal",
347
+ scale: null,
348
+ legend: null
349
+ };
350
+ const tooltipChannel = [
351
+ {
352
+ field: "v",
353
+ type: "quantitative",
354
+ title: observedTitle,
355
+ format: valueFormat,
356
+ formatType: "arcNumber"
357
+ },
358
+ {
359
+ field: "e",
360
+ type: "quantitative",
361
+ title: expectedTitle,
362
+ format: valueFormat,
363
+ formatType: "arcNumber"
364
+ },
365
+ {
366
+ field: "lo",
367
+ type: "quantitative",
368
+ title: lowerTitle,
369
+ format: valueFormat,
370
+ formatType: "arcNumber"
371
+ },
372
+ {
373
+ field: "hi",
374
+ type: "quantitative",
375
+ title: upperTitle,
376
+ format: valueFormat,
377
+ formatType: "arcNumber"
378
+ }
379
+ ];
380
+ const layers = [];
381
+ layers.push({
382
+ mark: {
383
+ type: "rule",
384
+ stroke: tokens.grid,
385
+ strokeWidth: 1,
386
+ aria: false
387
+ },
388
+ encoding: {
389
+ x: xChannel("d0"),
390
+ x2: { field: "d1" },
391
+ y: yAt(STRIP_MID)
392
+ }
393
+ });
394
+ if (band) layers.push({
395
+ mark: {
396
+ type: "rect",
397
+ fill: tokens.context,
398
+ fillOpacity: BAND_OPACITY * 2,
399
+ cornerRadius: 2,
400
+ aria: false
401
+ },
402
+ encoding: {
403
+ x: xChannel("lo"),
404
+ x2: { field: "hi" },
405
+ y: yAt(STRIP_BAND[0]),
406
+ y2: yAt(STRIP_BAND[1])
407
+ }
408
+ });
409
+ if (expected) layers.push({
410
+ mark: {
411
+ type: "rule",
412
+ stroke: tokens.reference,
413
+ strokeWidth: 1,
414
+ strokeDash: EXPECTED_DASH,
415
+ aria: false
416
+ },
417
+ encoding: {
418
+ x: xChannel("e"),
419
+ y: yAt(STRIP_TICK[0]),
420
+ y2: yAt(STRIP_TICK[1])
421
+ }
422
+ });
423
+ layers.push({
424
+ mark: {
425
+ type: "point",
426
+ filled: false,
427
+ size: RING_SIZE,
428
+ strokeWidth: 1.5,
429
+ opacity: 1,
430
+ aria: false
431
+ },
432
+ encoding: {
433
+ x: xChannel("v"),
434
+ y: yAt(STRIP_MID),
435
+ stroke: markerColor
436
+ }
437
+ });
438
+ layers.push({
439
+ mark: {
440
+ type: "point",
441
+ filled: true,
442
+ size: POINT_SIZE,
443
+ stroke: tokens.background,
444
+ strokeWidth: 1.5,
445
+ opacity: 1,
446
+ aria: false
447
+ },
448
+ encoding: {
449
+ x: xChannel("v"),
450
+ y: yAt(STRIP_MID),
451
+ fill: markerColor,
452
+ ...tooltip ? { tooltip: tooltipChannel } : {}
453
+ }
454
+ });
455
+ return {
456
+ $schema: "https://vega.github.io/schema/vega-lite/v6.json",
457
+ width: 240,
458
+ height,
459
+ autosize: {
460
+ type: "fit",
461
+ contains: "padding"
462
+ },
463
+ padding: 0,
464
+ background: "transparent",
465
+ data: { name: INSIGHT_STRIP_DATASET },
466
+ layer: layers,
467
+ config: arcVegaConfig(tokens, { locale })
468
+ };
469
+ }
470
+ //#endregion
471
+ export { INSIGHT_FLAG_PARAM, INSIGHT_HOVER_PARAM, INSIGHT_INTERVAL_DATASET, INSIGHT_POINTS_DATASET, INSIGHT_STRIP_DATASET, INSIGHT_X_TICKS_PARAM, buildInsightSparkSpec, buildInsightStripSpec };