semiotic 3.5.4 → 3.7.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 (164) hide show
  1. package/CLAUDE.md +196 -175
  2. package/README.md +52 -15
  3. package/ai/cli.js +41 -0
  4. package/ai/componentMetadata.cjs +11 -2
  5. package/ai/dist/mcp-server.js +454 -4
  6. package/ai/examples.md +98 -0
  7. package/ai/schema.json +614 -9
  8. package/ai/system-prompt.md +5 -2
  9. package/dist/components/AccessibleNavTree.d.ts +25 -0
  10. package/dist/components/Annotation.d.ts +40 -14
  11. package/dist/components/ChartContainer.d.ts +32 -2
  12. package/dist/components/ai/annotationProvenance.d.ts +349 -0
  13. package/dist/components/ai/audienceProfile.d.ts +147 -0
  14. package/dist/components/ai/audiences.d.ts +31 -0
  15. package/dist/components/ai/chartCapabilities.d.ts +55 -0
  16. package/dist/components/ai/chartCapabilityTypes.d.ts +254 -0
  17. package/dist/components/ai/chartRoles.d.ts +27 -0
  18. package/dist/components/ai/conversationArc.d.ts +379 -0
  19. package/dist/components/ai/dataScaleProfile.d.ts +320 -0
  20. package/dist/components/ai/describeChart.d.ts +114 -0
  21. package/dist/components/ai/diffProfile.d.ts +51 -0
  22. package/dist/components/ai/inferIntent.d.ts +24 -0
  23. package/dist/components/ai/intents.d.ts +34 -0
  24. package/dist/components/ai/navigationTree.d.ts +45 -0
  25. package/dist/components/ai/profileData.d.ts +16 -0
  26. package/dist/components/ai/qualityFixtures.d.ts +2 -0
  27. package/dist/components/ai/qualityScorecard.d.ts +82 -0
  28. package/dist/components/ai/readerGrounding.d.ts +70 -0
  29. package/dist/components/ai/repairChartConfig.d.ts +73 -0
  30. package/dist/components/ai/streamingTypes.d.ts +64 -0
  31. package/dist/components/ai/suggestCharts.d.ts +109 -0
  32. package/dist/components/ai/suggestDashboard.d.ts +92 -0
  33. package/dist/components/ai/suggestStreamCharts.d.ts +34 -0
  34. package/dist/components/ai/suggestStretchCharts.d.ts +60 -0
  35. package/dist/components/ai/useChartSuggestions.d.ts +22 -0
  36. package/dist/components/ai/useConversationArc.d.ts +89 -0
  37. package/dist/components/ai/useNavigationSync.d.ts +61 -0
  38. package/dist/components/ai/variantDiscovery.d.ts +168 -0
  39. package/dist/components/charts/geo/ChoroplethMap.capability.d.ts +2 -0
  40. package/dist/components/charts/geo/DistanceCartogram.capability.d.ts +2 -0
  41. package/dist/components/charts/geo/FlowMap.capability.d.ts +2 -0
  42. package/dist/components/charts/geo/ProportionalSymbolMap.capability.d.ts +2 -0
  43. package/dist/components/charts/index.d.ts +1 -1
  44. package/dist/components/charts/network/ChordDiagram.capability.d.ts +2 -0
  45. package/dist/components/charts/network/CirclePack.capability.d.ts +2 -0
  46. package/dist/components/charts/network/ForceDirectedGraph.capability.d.ts +2 -0
  47. package/dist/components/charts/network/OrbitDiagram.capability.d.ts +2 -0
  48. package/dist/components/charts/network/ProcessSankey.capability.d.ts +2 -0
  49. package/dist/components/charts/network/SankeyDiagram.capability.d.ts +2 -0
  50. package/dist/components/charts/network/TreeDiagram.capability.d.ts +2 -0
  51. package/dist/components/charts/network/Treemap.capability.d.ts +2 -0
  52. package/dist/components/charts/ordinal/BarChart.capability.d.ts +2 -0
  53. package/dist/components/charts/ordinal/BoxPlot.capability.d.ts +2 -0
  54. package/dist/components/charts/ordinal/DonutChart.capability.d.ts +2 -0
  55. package/dist/components/charts/ordinal/DotPlot.capability.d.ts +2 -0
  56. package/dist/components/charts/ordinal/FunnelChart.capability.d.ts +2 -0
  57. package/dist/components/charts/ordinal/GaugeChart.capability.d.ts +2 -0
  58. package/dist/components/charts/ordinal/GroupedBarChart.capability.d.ts +2 -0
  59. package/dist/components/charts/ordinal/Histogram.capability.d.ts +2 -0
  60. package/dist/components/charts/ordinal/Histogram.d.ts +4 -2
  61. package/dist/components/charts/ordinal/LikertChart.capability.d.ts +2 -0
  62. package/dist/components/charts/ordinal/LikertChart.d.ts +1 -1
  63. package/dist/components/charts/ordinal/LikertChart.defaults.d.ts +1 -0
  64. package/dist/components/charts/ordinal/PieChart.capability.d.ts +2 -0
  65. package/dist/components/charts/ordinal/RidgelinePlot.capability.d.ts +2 -0
  66. package/dist/components/charts/ordinal/StackedBarChart.capability.d.ts +2 -0
  67. package/dist/components/charts/ordinal/SwarmPlot.capability.d.ts +2 -0
  68. package/dist/components/charts/ordinal/SwimlaneChart.capability.d.ts +2 -0
  69. package/dist/components/charts/ordinal/ViolinPlot.capability.d.ts +2 -0
  70. package/dist/components/charts/realtime/RealtimeHeatmap.capability.d.ts +2 -0
  71. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +3 -0
  72. package/dist/components/charts/realtime/RealtimeHistogram.capability.d.ts +2 -0
  73. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +3 -0
  74. package/dist/components/charts/realtime/RealtimeLineChart.capability.d.ts +2 -0
  75. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +3 -0
  76. package/dist/components/charts/realtime/RealtimeSwarmChart.capability.d.ts +2 -0
  77. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +3 -0
  78. package/dist/components/charts/realtime/RealtimeWaterfallChart.capability.d.ts +2 -0
  79. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +3 -0
  80. package/dist/components/charts/realtime/TemporalHistogram.capability.d.ts +7 -0
  81. package/dist/components/charts/shared/annotationHierarchy.d.ts +42 -0
  82. package/dist/components/charts/shared/annotationResolvers.d.ts +3 -2
  83. package/dist/components/charts/shared/annotationRules.d.ts +16 -0
  84. package/dist/components/charts/shared/annotationTypes.d.ts +14 -0
  85. package/dist/components/charts/shared/auditAccessibility.d.ts +90 -0
  86. package/dist/components/charts/shared/chartSpecs.d.ts +2 -37
  87. package/dist/components/charts/shared/diagnoseConfig.d.ts +4 -6
  88. package/dist/components/charts/shared/selectionUtils.d.ts +5 -2
  89. package/dist/components/charts/shared/streamPropsHelpers.d.ts +2 -0
  90. package/dist/components/charts/shared/types.d.ts +5 -1
  91. package/dist/components/charts/value/BigNumber.capability.d.ts +13 -0
  92. package/dist/components/charts/value/BigNumber.d.ts +14 -0
  93. package/dist/components/charts/value/formatting.d.ts +40 -0
  94. package/dist/components/charts/value/thresholdSparkline.d.ts +40 -0
  95. package/dist/components/charts/value/types.d.ts +292 -0
  96. package/dist/components/charts/xy/AreaChart.capability.d.ts +10 -0
  97. package/dist/components/charts/xy/BubbleChart.capability.d.ts +2 -0
  98. package/dist/components/charts/xy/CandlestickChart.capability.d.ts +2 -0
  99. package/dist/components/charts/xy/ConnectedScatterplot.capability.d.ts +2 -0
  100. package/dist/components/charts/xy/DifferenceChart.capability.d.ts +8 -0
  101. package/dist/components/charts/xy/Heatmap.capability.d.ts +9 -0
  102. package/dist/components/charts/xy/LineChart.capability.d.ts +9 -0
  103. package/dist/components/charts/xy/MinimapChart.capability.d.ts +2 -0
  104. package/dist/components/charts/xy/MultiAxisLineChart.capability.d.ts +2 -0
  105. package/dist/components/charts/xy/QuadrantChart.capability.d.ts +2 -0
  106. package/dist/components/charts/xy/QuadrantChart.d.ts +5 -2
  107. package/dist/components/charts/xy/QuadrantChart.defaults.d.ts +2 -0
  108. package/dist/components/charts/xy/Scatterplot.capability.d.ts +2 -0
  109. package/dist/components/charts/xy/StackedAreaChart.capability.d.ts +2 -0
  110. package/dist/components/data/DataSummarizer.d.ts +45 -0
  111. package/dist/components/realtime/lifecycleBands.d.ts +44 -0
  112. package/dist/components/realtime/types.d.ts +23 -8
  113. package/dist/components/recipes/annotationDensity.d.ts +69 -0
  114. package/dist/components/recipes/annotationLayout.d.ts +93 -0
  115. package/dist/components/semiotic-ai.d.ts +58 -0
  116. package/dist/components/semiotic-realtime.d.ts +2 -0
  117. package/dist/components/semiotic-recipes.d.ts +4 -0
  118. package/dist/components/semiotic-utils.d.ts +8 -0
  119. package/dist/components/semiotic-value.d.ts +55 -0
  120. package/dist/components/semiotic-xy.d.ts +1 -1
  121. package/dist/components/semiotic.d.ts +8 -1
  122. package/dist/components/server/staticAnnotations.d.ts +2 -0
  123. package/dist/components/store/useChartFocus.d.ts +43 -0
  124. package/dist/components/store/useChartInterrogation.d.ts +141 -0
  125. package/dist/components/stream/AccessibleDataTable.d.ts +10 -1
  126. package/dist/components/stream/NetworkSVGOverlay.d.ts +11 -5
  127. package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -0
  128. package/dist/components/stream/SVGOverlay.d.ts +2 -0
  129. package/dist/components/stream/geoTypes.d.ts +3 -0
  130. package/dist/components/stream/networkTypes.d.ts +2 -0
  131. package/dist/components/stream/ordinalTypes.d.ts +2 -0
  132. package/dist/components/stream/types.d.ts +2 -0
  133. package/dist/geo.min.js +1 -1
  134. package/dist/geo.module.min.js +1 -1
  135. package/dist/network.min.js +1 -1
  136. package/dist/network.module.min.js +1 -1
  137. package/dist/ordinal.min.js +1 -1
  138. package/dist/ordinal.module.min.js +1 -1
  139. package/dist/realtime.min.js +1 -1
  140. package/dist/realtime.module.min.js +1 -1
  141. package/dist/semiotic-ai.d.ts +58 -0
  142. package/dist/semiotic-ai.min.js +1 -1
  143. package/dist/semiotic-ai.module.min.js +1 -1
  144. package/dist/semiotic-realtime.d.ts +2 -0
  145. package/dist/semiotic-recipes.d.ts +4 -0
  146. package/dist/semiotic-recipes.min.js +1 -1
  147. package/dist/semiotic-recipes.module.min.js +1 -1
  148. package/dist/semiotic-themes.min.js +1 -1
  149. package/dist/semiotic-themes.module.min.js +1 -1
  150. package/dist/semiotic-utils.d.ts +8 -0
  151. package/dist/semiotic-utils.min.js +1 -1
  152. package/dist/semiotic-utils.module.min.js +1 -1
  153. package/dist/semiotic-value.d.ts +55 -0
  154. package/dist/semiotic-value.min.js +2 -0
  155. package/dist/semiotic-value.module.min.js +2 -0
  156. package/dist/semiotic-xy.d.ts +1 -1
  157. package/dist/semiotic.d.ts +8 -1
  158. package/dist/semiotic.min.js +1 -1
  159. package/dist/semiotic.module.min.js +1 -1
  160. package/dist/server.min.js +1 -1
  161. package/dist/server.module.min.js +1 -1
  162. package/dist/xy.min.js +1 -1
  163. package/dist/xy.module.min.js +1 -1
  164. package/package.json +28 -5
@@ -0,0 +1,292 @@
1
+ /**
2
+ * BigNumber and (forward-looking) SingleValueFrame types.
3
+ *
4
+ * BigNumber ships today as a plain React component under
5
+ * `semiotic/value`. The type vocabulary here is intentionally a bit
6
+ * broader than the v1 component uses — it sketches the contract a
7
+ * future `SingleValueFrame` would own,
8
+ * so adopters can write against types that survive the migration.
9
+ */
10
+ import type * as React from "react";
11
+ import type { Datum } from "../shared/datumTypes";
12
+ /**
13
+ * Layout mode — chrome envelope around the focal value.
14
+ *
15
+ * - `tile` — dashboard cell. Label + value + comparison/target row + optional sparkline.
16
+ * - `presentation` — large centered value for a slide or hero card.
17
+ * - `inline` — value + optional delta indicator, no card chrome; flows in prose.
18
+ * - `thumbnail` — value only, no chrome, fixed-height. For embedding in dense grids.
19
+ */
20
+ export type BigNumberMode = "tile" | "presentation" | "inline" | "thumbnail";
21
+ /**
22
+ * Status level mapped to a semantic CSS variable
23
+ * (`--semiotic-success`, `--semiotic-warning`, `--semiotic-danger`,
24
+ * `--semiotic-info`, falls through to `--semiotic-text` for `neutral`).
25
+ */
26
+ export type BigNumberLevel = "success" | "warning" | "danger" | "info" | "neutral";
27
+ /**
28
+ * Whether a higher value is "better" semantically. Drives the
29
+ * sentiment of a delta — a `+5` delta is positive sentiment under
30
+ * "higher-is-better", negative under "lower-is-better", neutral when
31
+ * the direction isn't loaded.
32
+ */
33
+ export type BigNumberDirection = "higher-is-better" | "lower-is-better" | "neutral";
34
+ /**
35
+ * Resolved sentiment for a delta or value-vs-target. Controls whether
36
+ * a delta renders in success-coloured or danger-coloured ink.
37
+ * `"auto"` lets the component infer from `direction` + the sign of the delta.
38
+ */
39
+ export type BigNumberSentiment = "auto" | "positive" | "negative" | "neutral";
40
+ /**
41
+ * Number-format shortcut. `(value) => string` lets you plug in d3-format,
42
+ * Intl.NumberFormat, or any custom formatter.
43
+ *
44
+ * Built-in shortcuts read locale + currency + precision off the props:
45
+ *
46
+ * - `"number"` — Intl.NumberFormat with grouping.
47
+ * - `"currency"` — currency style; needs `currency` prop (default USD).
48
+ * - `"percent"` — multiplies × 100, suffixes "%".
49
+ * - `"compact"` — Intl compact notation: 1.2M, 3.4K.
50
+ * - `"duration"` — formats a millisecond duration as `1h 23m 4s`.
51
+ */
52
+ export type BigNumberFormat = "number" | "currency" | "percent" | "compact" | "duration" | ((value: number) => string);
53
+ /**
54
+ * Threshold zone — a lower bound + status level. Zones must be sorted
55
+ * ascending by `at` and resolved by "highest `at` ≤ value".
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * thresholds={[
60
+ * { at: -Infinity, level: "danger" },
61
+ * { at: 50, level: "warning" },
62
+ * { at: 80, level: "success" },
63
+ * ]}
64
+ * ```
65
+ */
66
+ export interface BigNumberThreshold {
67
+ /** Lower bound (inclusive) for this zone. `-Infinity` covers everything below. */
68
+ at: number;
69
+ /** Status level. Maps to a semantic CSS variable on the value text. */
70
+ level: BigNumberLevel;
71
+ /** Explicit colour override; otherwise `var(--semiotic-{level})`. */
72
+ color?: string;
73
+ /** Optional label surfaced in tooltips, the ARIA sentence, and capability output. */
74
+ label?: string;
75
+ }
76
+ /**
77
+ * Comparison value (vs. prior period, vs. last quarter, etc.). The
78
+ * delta is derived as `value - comparison.value` unless `delta` is set
79
+ * explicitly on the parent.
80
+ */
81
+ export interface BigNumberComparison {
82
+ /** Prior-period value used to compute the delta. */
83
+ value: number;
84
+ /** Descriptor — e.g. `"vs last quarter"`. */
85
+ label?: string;
86
+ /** Inherit `format`/`locale`/`currency` if omitted. */
87
+ format?: BigNumberFormat;
88
+ /** Whether higher is better. Defaults to the top-level `direction`. */
89
+ direction?: BigNumberDirection;
90
+ }
91
+ /**
92
+ * Target / goal value. Renders as `… of {target.value}` with optional
93
+ * progress framing (the value's distance to target).
94
+ */
95
+ export interface BigNumberTarget {
96
+ /** Goal value. */
97
+ value: number;
98
+ /** Descriptor — e.g. `"of Q3 target"`. */
99
+ label?: string;
100
+ /** Inherit `format`/`locale`/`currency` if omitted. */
101
+ format?: BigNumberFormat;
102
+ /** Whether higher is better. Defaults to the top-level `direction`. */
103
+ direction?: BigNumberDirection;
104
+ }
105
+ /** Imperative ref handle for streaming/push usage. */
106
+ export interface BigNumberHandle {
107
+ /** Append a new datapoint; updates the focal value + extends the trend. */
108
+ push(input: number | BigNumberPushInput): void;
109
+ /** Append many in one pass. */
110
+ pushMany(inputs: ReadonlyArray<number | BigNumberPushInput>): void;
111
+ /** Reset trend buffer and focal value. */
112
+ clear(): void;
113
+ /** Current focal value. Returns the most-recently-pushed value when the
114
+ * push API has been used; otherwise falls back to the `value` prop. Returns
115
+ * `null` only when no push has landed AND the prop value is not finite. */
116
+ getValue(): number | null;
117
+ /** Trend buffer snapshot (most-recent-last). */
118
+ getData(): ReadonlyArray<BigNumberPushInput>;
119
+ }
120
+ export interface BigNumberPushInput {
121
+ value: number;
122
+ time?: number | Date;
123
+ /** Override the comparison value at this tick. */
124
+ comparison?: number;
125
+ }
126
+ /**
127
+ * Render slots — drop-ins for any slot in the layout. ReactNode form
128
+ * is rendered as-is; the function form receives the resolved context
129
+ * so the slot can read formatted strings without re-deriving them.
130
+ */
131
+ export interface BigNumberSlotContext {
132
+ value: number | null;
133
+ formattedValue: string;
134
+ level: BigNumberLevel;
135
+ /** Resolved colour for the focal value, ready to drop into a `color` /
136
+ * `stroke` / `fill` prop on an embedded Semiotic chart so its marks
137
+ * match the BigNumber's threshold level. Either a hex / rgb string
138
+ * or a `var(--semiotic-{level})` reference. */
139
+ color: string;
140
+ delta: number | null;
141
+ deltaFormatted: string | null;
142
+ /** Formatted percent change string (e.g. `"+20%"`), or null when undefined. */
143
+ deltaPercent: string | null;
144
+ sentiment: "positive" | "negative" | "neutral";
145
+ isStale: boolean;
146
+ /** Live push-API buffer (most-recent-last). Useful when a slot chart
147
+ * should redraw on every ingest — read from this in the function
148
+ * form so the chart re-renders alongside the focal value. */
149
+ pushBuffer: ReadonlyArray<BigNumberPushInput>;
150
+ }
151
+ export type BigNumberSlot = React.ReactNode | ((ctx: BigNumberSlotContext) => React.ReactNode);
152
+ /**
153
+ * The full prop surface. Intentionally broad — every block here maps
154
+ * to a documented `SingleValueFrame` capability so users targeting
155
+ * the v1 component can roll forward unchanged when (if) the frame ships.
156
+ *
157
+ * Does NOT extend `BaseChartProps` because most of those (axisExtent,
158
+ * pointIdAccessor, linkedHover, linkedBrush, hoverHighlight, ...) are
159
+ * irrelevant for a single value. The contract is documented per-prop.
160
+ */
161
+ export interface BigNumberProps<_TDatum extends Datum = Datum> {
162
+ /** The number this card exists to display. `null` / `undefined` / `NaN`
163
+ * routes the card into its empty state (see `emptyContent`); this lets
164
+ * consumers pass `data?.revenue` style optional values without a
165
+ * conditional. */
166
+ value: number | null | undefined;
167
+ /** Top-line descriptor — e.g. `"Q3 Revenue"`. Rendered above the value. */
168
+ label?: string;
169
+ /** Secondary descriptor, smaller, below the label. */
170
+ caption?: string;
171
+ /** Format the focal value. Default `"number"`. */
172
+ format?: BigNumberFormat;
173
+ /** BCP-47 locale tag for built-in formats. Default `"en-US"`. */
174
+ locale?: string;
175
+ /** ISO 4217 code; required for `format: "currency"`. Default `"USD"`. */
176
+ currency?: string;
177
+ /** `Intl.NumberFormat` `maximumFractionDigits`. Default 0 for compact, 2 for currency, 0 elsewhere. */
178
+ precision?: number;
179
+ /** Prepend to the formatted value. */
180
+ prefix?: string;
181
+ /** Append to the formatted value. */
182
+ suffix?: string;
183
+ /** Unit label rendered after the value as small text — e.g. `"USD"`, `"req/s"`. */
184
+ unit?: string;
185
+ /** Comparison value (vs prior period). Drives delta if `delta` is not explicit. */
186
+ comparison?: BigNumberComparison;
187
+ /** Goal value; renders alongside the comparison row. */
188
+ target?: BigNumberTarget;
189
+ /** Explicit delta override; bypasses comparison.value subtraction. */
190
+ delta?: number;
191
+ /** Format the delta; defaults to `format` (inherits currency/locale). */
192
+ deltaFormat?: BigNumberFormat;
193
+ /** Also render the percent change next to the absolute delta. Default true when a comparison is present. */
194
+ showDeltaPercent?: boolean;
195
+ /** Default direction for sentiment inference. Per-comparison/target wins. */
196
+ direction?: BigNumberDirection;
197
+ /** Force sentiment classification. `"auto"` infers from `direction` + sign. Default `"auto"`. */
198
+ sentiment?: BigNumberSentiment;
199
+ /** Threshold zones — ordered ascending by `at`. Defines the level
200
+ * applied to the value text via a semantic CSS variable. */
201
+ thresholds?: ReadonlyArray<BigNumberThreshold>;
202
+ /** Cap the push buffer surfaced via `getData()` / `slotCtx.pushBuffer`. Default 60. */
203
+ windowSize?: number;
204
+ /** Layout mode. Default `"tile"`. */
205
+ mode?: BigNumberMode;
206
+ /** Horizontal alignment within the card. Default `"start"` for tile,
207
+ * `"center"` for presentation / thumbnail, `"inherit"` for inline. */
208
+ align?: "start" | "center" | "end";
209
+ /** Reserve width. Default 280 (tile), 540 (presentation), unset (inline/thumbnail). */
210
+ width?: number | string;
211
+ /** Reserve height. Default 184 (tile), 320 (presentation), unset (inline/thumbnail). */
212
+ height?: number | string;
213
+ /** Inner padding; number or `{top, right, bottom, left}`. */
214
+ padding?: number | {
215
+ top?: number;
216
+ right?: number;
217
+ bottom?: number;
218
+ left?: number;
219
+ };
220
+ /** Visual emphasis hint — dashboards can use this to span columns. */
221
+ emphasis?: "primary" | "secondary";
222
+ /** Override the value text colour. CSS variables work. */
223
+ color?: string;
224
+ /** Card background. CSS variables work; transparent by default in inline/thumbnail. */
225
+ background?: string;
226
+ /** Border colour. Defaults to `--semiotic-border`. */
227
+ borderColor?: string;
228
+ /** Border radius (px or any CSS length). Defaults to theme `--semiotic-border-radius`. */
229
+ borderRadius?: number | string;
230
+ /** Optional class for the outer container. */
231
+ className?: string;
232
+ /** Optional inline style — composed with the layout defaults. */
233
+ style?: React.CSSProperties;
234
+ /** Tween between value changes. `true` = 300ms ease-out + intro. */
235
+ animate?: boolean | {
236
+ duration?: number;
237
+ easing?: "linear" | "ease-out";
238
+ intro?: boolean;
239
+ };
240
+ /** Mark the card stale (dimmed) when no push occurs for this many ms. */
241
+ stalenessThreshold?: number;
242
+ /** Custom stale label appended to the ARIA sentence. Default `"stale"`. */
243
+ staleLabel?: string;
244
+ /** Replace the entire header (label + caption) slot. */
245
+ headerSlot?: BigNumberSlot;
246
+ /** Replace the focal value slot. */
247
+ valueSlot?: BigNumberSlot;
248
+ /** Replace the delta / comparison / target row. */
249
+ deltaSlot?: BigNumberSlot;
250
+ /** **Wide / rectangular** chart embedded beneath the value — e.g. a
251
+ * `LineChart` / `AreaChart` in `mode="sparkline"`. The card stays
252
+ * full-width and stacks the chart at full card width under the delta
253
+ * row. */
254
+ trendSlot?: BigNumberSlot;
255
+ /** **Square** chart embedded beside the value — e.g. a `DonutChart` /
256
+ * `PieChart` / `Scatterplot` / `Treemap`. When set, the card splits
257
+ * into a left column (header + value + delta) and a right column
258
+ * (the square chart). Compose with `trendSlot` to get both
259
+ * (square chart on the right, wide trend along the bottom). */
260
+ chartSlot?: BigNumberSlot;
261
+ /** Reserved pixel size (square) for `chartSlot`. Defaults are
262
+ * mode-keyed for sparkline scale — 44 px for `tile`, 80 px for
263
+ * `presentation` — so the embedded chart reads as a corner
264
+ * decoration. Pass a larger value for a hero-style anchor. */
265
+ chartSize?: number;
266
+ /** Free-form footer below the trend. */
267
+ footerSlot?: BigNumberSlot;
268
+ /** Card click. */
269
+ onClick?: (datum: {
270
+ value: number;
271
+ level: BigNumberLevel;
272
+ delta: number | null;
273
+ }, event: {
274
+ x: number;
275
+ y: number;
276
+ }) => void;
277
+ /** Generic observation hook — fires on click today; future SingleValueFrame work
278
+ * may extend this to value-update / hover events. */
279
+ onObservation?: import("../../store/ObservationStore").OnObservationCallback;
280
+ /** Identifier surfaced on every observation event. */
281
+ chartId?: string;
282
+ /** Override the auto-generated aria-label sentence. */
283
+ description?: string;
284
+ /** Sr-only supplement appended below the auto sentence. */
285
+ summary?: string;
286
+ /** Loading skeleton overlay. */
287
+ loading?: boolean;
288
+ /** Replace the default skeleton; `false` suppresses it entirely. */
289
+ loadingContent?: React.ReactNode | false;
290
+ /** Empty-state placeholder rendered when `value` is `null`/`undefined`/`NaN`. */
291
+ emptyContent?: React.ReactNode | false;
292
+ }
@@ -0,0 +1,10 @@
1
+ import type { ChartCapability } from "../../ai/chartCapabilityTypes";
2
+ /**
3
+ * AreaChart is treated as a strictly single-series chart. Multi-series areas
4
+ * are an occlusion nightmare — when the data has 2+ series we subselect the
5
+ * leading series (largest cumulative y) and surface a caveat so the reader
6
+ * knows they're looking at one slice, not the whole dataset. For full multi-
7
+ * series comparison the engine routes callers to LineChart; for two-series
8
+ * comparison, to DifferenceChart.
9
+ */
10
+ export declare const AreaChartCapability: ChartCapability;
@@ -0,0 +1,2 @@
1
+ import type { ChartCapability } from "../../ai/chartCapabilityTypes";
2
+ export declare const BubbleChartCapability: ChartCapability;
@@ -0,0 +1,2 @@
1
+ import type { ChartCapability } from "../../ai/chartCapabilityTypes";
2
+ export declare const CandlestickChartCapability: ChartCapability;
@@ -0,0 +1,2 @@
1
+ import type { ChartCapability } from "../../ai/chartCapabilityTypes";
2
+ export declare const ConnectedScatterplotCapability: ChartCapability;
@@ -0,0 +1,8 @@
1
+ import type { ChartCapability } from "../../ai/chartCapabilityTypes";
2
+ /**
3
+ * DifferenceChart's native shape is two series. When the input has 2+ series
4
+ * we subselect the top two by total y and pivot them into the wide form the
5
+ * chart expects — same "narrow the dataset to make the chart honest" pattern
6
+ * AreaChart uses for its single-series fallback.
7
+ */
8
+ export declare const DifferenceChartCapability: ChartCapability;
@@ -0,0 +1,9 @@
1
+ import type { ChartCapability } from "../../ai/chartCapabilityTypes";
2
+ /**
3
+ * Heatmap is a matrix: categorical × categorical (or temporal × categorical),
4
+ * with a numeric encoded as color. Without two genuine discrete dimensions
5
+ * for the axes, a heatmap of raw rows is sparse and unreadable. Tuned in
6
+ * Phase 2.1 after the scorecard surfaced Heatmap winning unsuitable
7
+ * compare-categories rankings.
8
+ */
9
+ export declare const HeatmapCapability: ChartCapability;
@@ -0,0 +1,9 @@
1
+ import type { ChartCapability } from "../../ai/chartCapabilityTypes";
2
+ /**
3
+ * LineChart capability — declares what data shapes LineChart serves well,
4
+ * what intents it answers, and what variants change those answers.
5
+ *
6
+ * Read alongside `LineChart.tsx`; this file is what makes the chart
7
+ * "self-aware" for suggestion and interrogation flows.
8
+ */
9
+ export declare const LineChartCapability: ChartCapability;
@@ -0,0 +1,2 @@
1
+ import type { ChartCapability } from "../../ai/chartCapabilityTypes";
2
+ export declare const MinimapChartCapability: ChartCapability;
@@ -0,0 +1,2 @@
1
+ import type { ChartCapability } from "../../ai/chartCapabilityTypes";
2
+ export declare const MultiAxisLineChartCapability: ChartCapability;
@@ -0,0 +1,2 @@
1
+ import type { ChartCapability } from "../../ai/chartCapabilityTypes";
2
+ export declare const QuadrantChartCapability: ChartCapability;
@@ -30,6 +30,9 @@ export interface QuadrantsConfig {
30
30
  bottomRight: QuadrantConfig;
31
31
  bottomLeft: QuadrantConfig;
32
32
  }
33
+ export type QuadrantsConfigOverride = {
34
+ [TQuadrant in keyof QuadrantsConfig]?: Partial<QuadrantsConfig[TQuadrant]>;
35
+ };
33
36
  /**
34
37
  * Centerline style configuration
35
38
  */
@@ -55,8 +58,8 @@ export interface QuadrantChartProps<TDatum extends Datum = Datum> extends BaseCh
55
58
  xCenter?: number;
56
59
  /** Y-coordinate of the horizontal center line. Defaults to midpoint of y domain. */
57
60
  yCenter?: number;
58
- /** Quadrant configuration: labels and colors for each of the four quadrants */
59
- quadrants: QuadrantsConfig;
61
+ /** Optional quadrant overrides. Omitted quadrants and quadrant fields fall back to built-in defaults. */
62
+ quadrants?: QuadrantsConfigOverride;
60
63
  /** Style for the center lines */
61
64
  centerlineStyle?: CenterlineStyle;
62
65
  /** Show quadrant labels @default true */
@@ -0,0 +1,2 @@
1
+ import type { QuadrantsConfig } from "./QuadrantChart";
2
+ export declare const DEFAULT_QUADRANTS: QuadrantsConfig;
@@ -0,0 +1,2 @@
1
+ import type { ChartCapability } from "../../ai/chartCapabilityTypes";
2
+ export declare const ScatterplotCapability: ChartCapability;
@@ -0,0 +1,2 @@
1
+ import type { ChartCapability } from "../../ai/chartCapabilityTypes";
2
+ export declare const StackedAreaChartCapability: ChartCapability;
@@ -0,0 +1,45 @@
1
+ import type { Datum } from "../charts/shared/datumTypes";
2
+ export type FieldType = "numeric" | "categorical" | "date" | "unknown";
3
+ export interface NumericFieldSummary {
4
+ type: "numeric";
5
+ min: number;
6
+ max: number;
7
+ mean: number;
8
+ median: number;
9
+ }
10
+ export interface DateFieldSummary {
11
+ type: "date";
12
+ min: string;
13
+ max: string;
14
+ }
15
+ export interface CategoricalFieldSummary {
16
+ type: "categorical";
17
+ distinctCount: number;
18
+ topValues: ReadonlyArray<{
19
+ value: string;
20
+ count: number;
21
+ }>;
22
+ distinctValues?: ReadonlyArray<string>;
23
+ }
24
+ export interface UnknownFieldSummary {
25
+ type: "unknown";
26
+ }
27
+ export type FieldSummary = NumericFieldSummary | DateFieldSummary | CategoricalFieldSummary | UnknownFieldSummary;
28
+ export interface DataSummary {
29
+ rowCount: number;
30
+ fields: Record<string, FieldSummary>;
31
+ sample: ReadonlyArray<Datum>;
32
+ }
33
+ export interface SummarizeOptions {
34
+ maxDistinct?: number;
35
+ sampleSize?: number;
36
+ /** Scan up to this many rows when discovering field keys (handles ragged rows). */
37
+ keyScanRows?: number;
38
+ }
39
+ /**
40
+ * Summarize a dataset for an LLM. Returns row count, per-field statistics, and a small sample.
41
+ *
42
+ * Designed so a model can answer questions about ranges, peaks, distributions, and categories
43
+ * without seeing the full dataset.
44
+ */
45
+ export declare function summarizeData(data: ReadonlyArray<Datum> | null | undefined, options?: SummarizeOptions): DataSummary;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Named lifecycle bands. Shared by the annotation freshness surface
3
+ * today and available to other temporal-lifecycle policies that opt
4
+ * into banded classification.
5
+ */
6
+ export type LifecycleBand = "fresh" | "aging" | "stale" | "expired";
7
+ /**
8
+ * Multipliers of `ttlMs` that mark the upper edge of each band. The
9
+ * default schedule:
10
+ *
11
+ * • `fresh` — `age < 1.0 × ttl`
12
+ * • `aging` — `age < 1.5 × ttl`
13
+ * • `stale` — `age < 3.0 × ttl`
14
+ * • `expired` — `age ≥ 3.0 × ttl`
15
+ *
16
+ * Override individual thresholds; missing entries fall back to the
17
+ * defaults. Setting a smaller value than the previous band's
18
+ * threshold is allowed but produces an unreachable band.
19
+ */
20
+ export interface LifecycleBandThresholds {
21
+ /** Upper edge of the `fresh` band, as a multiple of `ttlMs`. Default `1.0`. */
22
+ fresh?: number;
23
+ /** Upper edge of the `aging` band, as a multiple of `ttlMs`. Default `1.5`. */
24
+ aging?: number;
25
+ /** Upper edge of the `stale` band, as a multiple of `ttlMs`. Default `3.0`. */
26
+ stale?: number;
27
+ }
28
+ export declare const DEFAULT_LIFECYCLE_THRESHOLDS: Required<LifecycleBandThresholds>;
29
+ /**
30
+ * Classify an age into a named band given a TTL.
31
+ *
32
+ * Pure function. Edge cases:
33
+ *
34
+ * - **Negative age** (future-dated items): classifies as `fresh`.
35
+ * - **`NaN` age** (parse failure or `now - undefined`): classifies as
36
+ * `fresh` — the safer default, since `expired` is filtered by the
37
+ * visual treatment.
38
+ * - **`+Infinity` age**: classifies as `expired`. Monotonic in age —
39
+ * "older than any finite TTL multiple" should be the oldest band.
40
+ * - **Non-finite / non-positive TTL**: classifies as `fresh`, since
41
+ * there's no meaningful interval to age against. Callers that need
42
+ * stricter handling should gate `ttlMs` before calling.
43
+ */
44
+ export declare function bandFromAge(ageMs: number, ttlMs: number, thresholds?: LifecycleBandThresholds): LifecycleBand;
@@ -1,6 +1,7 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { ScaleBand, ScaleLinear } from "d3-scale";
3
3
  import type { Datum } from "../charts/shared/datumTypes";
4
+ import type { AutoPlaceAnnotations } from "../recipes/annotationLayout";
4
5
  export type ArrowOfTime = "up" | "down" | "left" | "right";
5
6
  export type WindowMode = "sliding" | "growing";
6
7
  export type ThresholdType = "greater" | "lesser";
@@ -11,15 +12,28 @@ export interface LineStyle {
11
12
  opacity?: number;
12
13
  }
13
14
  /**
14
- * Anchoring mode for streaming annotations.
15
- * - `"fixed"` (default): anchored to specific datum coordinates; disappears when out of view.
16
- * - `"latest"`: annotation attaches to the most recent datum in the buffer.
17
- * On each frame, the annotation's position is re-resolved to the latest data point.
18
- * Useful for "current value" labels.
19
- * - `"sticky"`: annotation stays at its last known pixel position after the target datum
20
- * is evicted from the window. It freezes in place rather than disappearing.
15
+ * How an annotation's anchor is resolved across renders. Shared between
16
+ * the streaming runtime (which implements the resolution) and the
17
+ * `semiotic/ai` annotation lifecycle surface (which exposes the choice
18
+ * to authors via `lifecycle.anchor`).
19
+ *
20
+ * - `"fixed"` (default): anchored to specific datum coordinates;
21
+ * disappears when out of view.
22
+ * - `"latest"`: annotation re-pins to the most recent datum each frame.
23
+ * - `"sticky"`: annotation stays at its last known pixel position
24
+ * after the target datum scrolls off; uses `stickyPositionCache`
25
+ * on `AnnotationContext`.
26
+ * - `"semantic"`: re-resolves via `provenance.stableId` when new data
27
+ * arrives, falling back to the recorded coordinate if the anchor
28
+ * can no longer be located.
21
29
  */
22
- export type AnnotationAnchorMode = "fixed" | "latest" | "sticky";
30
+ export type AnnotationAnchor = "fixed" | "latest" | "sticky" | "semantic";
31
+ /**
32
+ * @deprecated Use {@link AnnotationAnchor}. Kept as a back-compat alias
33
+ * because earlier 3.x releases shipped this name from the streaming
34
+ * surface; the `Mode` suffix added nothing semantically.
35
+ */
36
+ export type AnnotationAnchorMode = AnnotationAnchor;
23
37
  export interface AnnotationContext {
24
38
  scales?: {
25
39
  x?: ScaleLinear<number, number>;
@@ -154,6 +168,7 @@ export interface RealtimeFrameProps {
154
168
  className?: string;
155
169
  lineStyle?: LineStyle;
156
170
  annotations?: Datum[];
171
+ autoPlaceAnnotations?: AutoPlaceAnnotations;
157
172
  svgAnnotationRules?: (annotation: Datum, index: number, context: AnnotationContext) => ReactNode;
158
173
  hoverAnnotation?: boolean | HoverAnnotationConfig;
159
174
  tooltipContent?: (d: HoverData) => ReactNode;
@@ -0,0 +1,69 @@
1
+ import type { Datum } from "../charts/shared/datumTypes";
2
+ /**
3
+ * M3 — Amount & density management (Rahman et al.'s sixth consideration:
4
+ * "balance explanatory support against clutter").
5
+ *
6
+ * A pure, geometry-light pass that decides *which* note-like annotations should
7
+ * stay on screen when there are more than the plot area can carry without
8
+ * clutter. It does not move anything (that is M2's `annotationLayout`); it
9
+ * partitions notes into a persistent set and a deferred set by importance and
10
+ * freshness, with the lowest-priority notes shed first.
11
+ *
12
+ * Priority signals, reusing what M0/M1 already attach:
13
+ * • `emphasis` (M1) — `"primary"` is the floor (never shed); `"secondary"`
14
+ * ranks below an un-emphasised note.
15
+ * • `provenance.confidence` (M0) — a small nudge so a higher-confidence note
16
+ * outranks a lower-confidence one at the same emphasis.
17
+ * • `lifecycle.freshness` (M0) — `fresh > aging > stale`; `expired` is shed
18
+ * first.
19
+ *
20
+ * Only note types compete for the budget; reference lines, bands, enclosures
21
+ * and statistical overlays pass through untouched (they are not "clutter notes"
22
+ * in the paper's sense and a density cap shedding a threshold line would be
23
+ * surprising).
24
+ *
25
+ * The persistent set is the floor and is never empty when any note exists — the
26
+ * paper's "keep the core message persistent; hover is not guaranteed."
27
+ */
28
+ /** Plot area (px²) allotted per note before the budget tightens. */
29
+ export declare const DEFAULT_AREA_PER_ANNOTATION = 20000;
30
+ export interface AnnotationDensityConfig {
31
+ /**
32
+ * Hard cap on simultaneously-persistent notes. When set, overrides the
33
+ * `width`×`height`-derived budget.
34
+ */
35
+ maxAnnotations?: number;
36
+ /**
37
+ * Plot area (px²) allotted per note when deriving the budget from the chart
38
+ * dimensions. Larger ⇒ fewer notes. Default {@link DEFAULT_AREA_PER_ANNOTATION}.
39
+ */
40
+ areaPerAnnotation?: number;
41
+ /** Minimum notes kept regardless of budget. Default 1. */
42
+ minVisible?: number;
43
+ }
44
+ export interface AnnotationDensityOptions extends AnnotationDensityConfig {
45
+ annotations: ReadonlyArray<Datum>;
46
+ /** Plot width in px (used to derive the budget when `maxAnnotations` is unset). */
47
+ width: number;
48
+ /** Plot height in px. */
49
+ height: number;
50
+ }
51
+ export interface AnnotationDensityResult {
52
+ /** Notes kept on screen plus every non-note annotation, in author order. */
53
+ visible: Datum[];
54
+ /** Notes shed by the budget, in author order. Empty when nothing is shed. */
55
+ deferred: Datum[];
56
+ /** The note budget that produced this partition. */
57
+ budget: number;
58
+ }
59
+ /**
60
+ * Derive the note budget for a plot. Exported so the clutter diagnostic
61
+ * (`diagnoseConfig`) and the runtime pass agree on the same threshold.
62
+ */
63
+ export declare function annotationBudget(width: number, height: number, config?: AnnotationDensityConfig): number;
64
+ /**
65
+ * Partition annotations into a persistent (visible) set and a deferred set
66
+ * given a note budget. Pure and deterministic; preserves author order within
67
+ * each returned array.
68
+ */
69
+ export declare function annotationDensity(options: AnnotationDensityOptions): AnnotationDensityResult;