semiotic 3.5.1 → 3.5.3

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 (127) hide show
  1. package/CLAUDE.md +26 -23
  2. package/README.md +27 -21
  3. package/ai/chartSuggestions.cjs +191 -3
  4. package/ai/componentMetadata.cjs +3 -3
  5. package/ai/dist/mcp-server.js +266 -48
  6. package/ai/examples.md +68 -0
  7. package/ai/schema.json +914 -1
  8. package/ai/system-prompt.md +4 -1
  9. package/dist/components/ThemeProvider.d.ts +2 -2
  10. package/dist/components/Tooltip/FlippingTooltip.d.ts +16 -1
  11. package/dist/components/charts/geo/FlowMap.d.ts +13 -4
  12. package/dist/components/charts/index.d.ts +6 -0
  13. package/dist/components/charts/network/OrbitDiagram.d.ts +5 -5
  14. package/dist/components/charts/network/ProcessSankey.d.ts +163 -0
  15. package/dist/components/charts/network/SankeyDiagram.d.ts +5 -1
  16. package/dist/components/charts/network/processSankey/algorithm.d.ts +193 -0
  17. package/dist/components/charts/network/processSankey/buildScenes.d.ts +51 -0
  18. package/dist/components/charts/network/processSankey/ribbonInputs.d.ts +32 -0
  19. package/dist/components/charts/network/processSankey/streamingLayout.d.ts +71 -0
  20. package/dist/components/charts/network/processSankey/tooltipUtils.d.ts +41 -0
  21. package/dist/components/charts/ordinal/BarChart.d.ts +12 -0
  22. package/dist/components/charts/ordinal/DotPlot.d.ts +9 -0
  23. package/dist/components/charts/ordinal/GaugeChart.d.ts +20 -0
  24. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +5 -0
  25. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +2 -0
  26. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +16 -11
  27. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +2 -0
  28. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +2 -0
  29. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +2 -0
  30. package/dist/components/charts/realtime/defaultRealtimeTooltip.d.ts +19 -0
  31. package/dist/components/charts/shared/axisExtent.d.ts +59 -0
  32. package/dist/components/charts/shared/chartSpecs.d.ts +75 -0
  33. package/dist/components/charts/shared/colorUtils.d.ts +8 -2
  34. package/dist/components/charts/shared/networkUtils.d.ts +3 -5
  35. package/dist/components/charts/shared/radialGeometry.d.ts +99 -0
  36. package/dist/components/charts/shared/regressionUtils.d.ts +59 -0
  37. package/dist/components/charts/shared/selectionUtils.d.ts +8 -1
  38. package/dist/components/charts/shared/streamPropsHelpers.d.ts +5 -0
  39. package/dist/components/charts/shared/tooltipUtils.d.ts +11 -0
  40. package/dist/components/charts/shared/types.d.ts +19 -0
  41. package/dist/components/charts/shared/useAreaSeriesSetup.d.ts +78 -0
  42. package/dist/components/charts/shared/useChartSetup.d.ts +2 -0
  43. package/dist/components/charts/shared/useCustomChartSetup.d.ts +1 -0
  44. package/dist/components/charts/shared/useEncodingDomain.d.ts +48 -0
  45. package/dist/components/charts/shared/useFrameImperativeHandle.d.ts +1 -1
  46. package/dist/components/charts/shared/useNetworkChartSetup.d.ts +150 -0
  47. package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +87 -0
  48. package/dist/components/charts/shared/useSeriesFeatures.d.ts +57 -0
  49. package/dist/components/charts/shared/useStreamStatus.d.ts +33 -0
  50. package/dist/components/charts/shared/useXYLineStyle.d.ts +69 -0
  51. package/dist/components/charts/shared/useXYPointStyle.d.ts +87 -0
  52. package/dist/components/charts/shared/withChartWrapper.d.ts +10 -3
  53. package/dist/components/charts/xy/AreaChart.d.ts +36 -2
  54. package/dist/components/charts/xy/BubbleChart.d.ts +9 -0
  55. package/dist/components/charts/xy/ConnectedScatterplot.d.ts +16 -0
  56. package/dist/components/charts/xy/DifferenceChart.d.ts +172 -0
  57. package/dist/components/charts/xy/LineChart.d.ts +26 -2
  58. package/dist/components/charts/xy/Scatterplot.d.ts +39 -1
  59. package/dist/components/geometry/ribbonGeometry.d.ts +76 -0
  60. package/dist/components/semiotic-ai.d.ts +2 -0
  61. package/dist/components/semiotic-network.d.ts +4 -0
  62. package/dist/components/semiotic-realtime.d.ts +2 -0
  63. package/dist/components/semiotic-utils.d.ts +4 -0
  64. package/dist/components/semiotic-xy.d.ts +2 -0
  65. package/dist/components/semiotic.d.ts +4 -4
  66. package/dist/components/server/renderToStaticSVG.d.ts +2 -1
  67. package/dist/components/server/serverChartConfigs.d.ts +3 -0
  68. package/dist/components/server/staticAnnotations.d.ts +1 -1
  69. package/dist/components/server/themeResolver.d.ts +7 -1
  70. package/dist/components/store/ThemeStore.d.ts +7 -1
  71. package/dist/components/stream/AccessibleDataTable.d.ts +2 -2
  72. package/dist/components/stream/GeoPipelineStore.d.ts +21 -0
  73. package/dist/components/stream/OrdinalSVGOverlay.d.ts +8 -0
  74. package/dist/components/stream/PipelineStore.d.ts +25 -13
  75. package/dist/components/stream/SVGOverlay.d.ts +9 -18
  76. package/dist/components/stream/accessorUtils.d.ts +2 -1
  77. package/dist/components/stream/annotationAccessorResolver.d.ts +39 -0
  78. package/dist/components/stream/geoTypes.d.ts +12 -0
  79. package/dist/components/stream/layouts/hierarchyLayoutPlugin.d.ts +1 -1
  80. package/dist/components/stream/networkTypes.d.ts +11 -0
  81. package/dist/components/stream/ordinalTypes.d.ts +27 -1
  82. package/dist/components/stream/renderers/cornerRadii.d.ts +33 -0
  83. package/dist/components/stream/renderers/wedgePathBuilder.d.ts +56 -0
  84. package/dist/components/stream/types.d.ts +127 -11
  85. package/dist/components/stream/xySceneBuilders/areaGradient.d.ts +20 -0
  86. package/dist/components/stream/xySceneBuilders/barScene.d.ts +2 -2
  87. package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +2 -2
  88. package/dist/components/stream/xySceneBuilders/heatmapScene.d.ts +2 -2
  89. package/dist/components/stream/xySceneBuilders/lineScene.d.ts +4 -3
  90. package/dist/components/stream/xySceneBuilders/pointScene.d.ts +2 -2
  91. package/dist/components/stream/xySceneBuilders/ribbonScene.d.ts +107 -0
  92. package/dist/components/stream/xySceneBuilders/swarmScene.d.ts +2 -2
  93. package/dist/components/stream/xySceneBuilders/types.d.ts +9 -12
  94. package/dist/components/stream/xySceneBuilders/waterfallScene.d.ts +2 -2
  95. package/dist/components/types/legendTypes.d.ts +1 -1
  96. package/dist/geo.min.js +1 -1
  97. package/dist/geo.module.min.js +1 -1
  98. package/dist/network.min.js +1 -1
  99. package/dist/network.module.min.js +1 -1
  100. package/dist/ordinal.min.js +1 -1
  101. package/dist/ordinal.module.min.js +1 -1
  102. package/dist/realtime.min.js +1 -1
  103. package/dist/realtime.module.min.js +1 -1
  104. package/dist/semiotic-ai.d.ts +2 -0
  105. package/dist/semiotic-ai.min.js +1 -1
  106. package/dist/semiotic-ai.module.min.js +1 -1
  107. package/dist/semiotic-data.min.js +1 -1
  108. package/dist/semiotic-data.module.min.js +1 -1
  109. package/dist/semiotic-network.d.ts +4 -0
  110. package/dist/semiotic-realtime.d.ts +2 -0
  111. package/dist/semiotic-recipes.min.js +1 -1
  112. package/dist/semiotic-recipes.module.min.js +1 -1
  113. package/dist/semiotic-themes.min.js +1 -1
  114. package/dist/semiotic-themes.module.min.js +1 -1
  115. package/dist/semiotic-utils.d.ts +4 -0
  116. package/dist/semiotic-utils.min.js +1 -1
  117. package/dist/semiotic-utils.module.min.js +1 -1
  118. package/dist/semiotic-xy.d.ts +2 -0
  119. package/dist/semiotic.d.ts +4 -4
  120. package/dist/semiotic.min.js +1 -1
  121. package/dist/semiotic.module.min.js +1 -1
  122. package/dist/server.min.js +1 -1
  123. package/dist/server.module.min.js +1 -1
  124. package/dist/xy.min.js +1 -1
  125. package/dist/xy.module.min.js +1 -1
  126. package/package.json +23 -10
  127. package/dist/components/stream/xySceneBuilders/boundsScene.d.ts +0 -9
@@ -0,0 +1,71 @@
1
+ import type { NetworkCustomLayout } from "../../../stream/networkCustomLayout";
2
+ import type { BezierCache } from "../../../stream/networkTypes";
3
+ import type { Datum } from "../../shared/datumTypes";
4
+ export interface ProcessSankeyBandSpec {
5
+ id: string;
6
+ /** Outer band perimeter — same path used for fill and stroke. */
7
+ pathD: string;
8
+ fill: string;
9
+ stroke?: string;
10
+ strokeWidth?: number;
11
+ /** Per-edge 20-px gradient stubs (band-color fade-in for
12
+ * systemInTime, fade-out for systemOutTime). When at least one
13
+ * stub is present, the band paints outline-only and the stubs
14
+ * are the only colored regions inside the perimeter. */
15
+ gradientStubs?: BandGradientStub[];
16
+ /** The user's raw node datum, surfaced as `data` in HoverData. */
17
+ rawDatum: Datum;
18
+ /** Pre-computed label x/y for the node band. */
19
+ labelX: number;
20
+ labelY: number;
21
+ labelText: string;
22
+ }
23
+ export interface BandGradientStub {
24
+ pathD: string;
25
+ x0: number;
26
+ x1: number;
27
+ from: 0 | 1;
28
+ to: 0 | 1;
29
+ }
30
+ export interface ProcessSankeyRibbonSpec {
31
+ id: string;
32
+ pathD: string;
33
+ fill: string;
34
+ opacity: number;
35
+ /** The user's raw edge datum, surfaced as `data` in HoverData. */
36
+ rawDatum: Datum;
37
+ /**
38
+ * Pre-computed cubic bezier control points + halfWidth for the
39
+ * shared particle pipeline. ProcessSankey writes these alongside
40
+ * the ribbon's path-D string so the frame's particle pool can
41
+ * spawn / step / render against them without re-deriving the
42
+ * ribbon geometry. Optional — when omitted the ribbon paints
43
+ * normally but no particles flow along it.
44
+ */
45
+ bezier?: BezierCache;
46
+ }
47
+ export interface ProcessSankeyLayoutConfig {
48
+ bands: ProcessSankeyBandSpec[];
49
+ ribbons: ProcessSankeyRibbonSpec[];
50
+ /** Optional dim opacity for unselected bands/ribbons (linkedHover). */
51
+ showLabels?: boolean;
52
+ }
53
+ /**
54
+ * Marker attached to scene-edge datums so the HOC's `tooltipContent`
55
+ * can route node bands vs. flow ribbons through different default
56
+ * bodies. `data` still carries the user's original node/edge datum.
57
+ */
58
+ export interface SceneDatumPayload {
59
+ __kind: "band" | "ribbon";
60
+ /** Original node/edge record, as the user pushed it. */
61
+ data: Datum;
62
+ /** Stable id for hit-deduplication and ref operations. */
63
+ id: string;
64
+ }
65
+ export declare const emitProcessSankeyScenes: NetworkCustomLayout<ProcessSankeyLayoutConfig>;
66
+ /**
67
+ * Test whether an arbitrary HoverData/datum-shaped value carries the
68
+ * ProcessSankey scene marker. Lets the HOC's tooltipContent narrow to
69
+ * the band/ribbon variants without leaking the marker key everywhere.
70
+ */
71
+ export declare function isProcessSankeyScenePayload(d: unknown): d is SceneDatumPayload;
@@ -0,0 +1,41 @@
1
+ import type { ProcessSankeyNodeData } from "./algorithm";
2
+ export interface MassHistoryRow {
3
+ t: number;
4
+ total: number;
5
+ }
6
+ export interface MassHistoryRowMarked extends MassHistoryRow {
7
+ /** "min" | "q25" | "median" | "q75" | "max" — present only when the
8
+ * full series was condensed via `pickMassQuantiles`. */
9
+ mark?: string;
10
+ }
11
+ /**
12
+ * Distinct (time, total-mass) tuples drawn from a node's sample series.
13
+ * The same `(t, total)` pair never appears twice — the layout's
14
+ * same-time pre/post sample collapse is preserved here. Returns an
15
+ * empty array when `data` has no samples (or is undefined).
16
+ */
17
+ export declare function massHistoryRows(data: ProcessSankeyNodeData | undefined): MassHistoryRow[];
18
+ /** Number of quantile picks emitted on truncation. Fixed at five —
19
+ * `min`, `q25`, `median`, `q75`, `max` — because the picks are
20
+ * semantic (named labels), not cap-driven. The `truncateAt` parameter
21
+ * on `pickMassQuantiles` controls *when* to truncate, not how many to
22
+ * return. */
23
+ export declare const QUANTILE_PICK_COUNT = 5;
24
+ /**
25
+ * Condense a row series down to the five mass-quantile picks —
26
+ * `min`, `q25`, `median`, `q75`, `max` — re-sorted by time so the
27
+ * tooltip table reads chronologically. Returns the input unchanged
28
+ * when its length is at or below `truncateAt` (default 5).
29
+ *
30
+ * Same-time collisions are deduplicated, so very small or very flat
31
+ * series may yield fewer than five output rows even when truncation
32
+ * fires; the marks attached are the first ones encountered for each
33
+ * surviving timestamp, which keeps `min` and `max` stable when ties
34
+ * are present.
35
+ *
36
+ * Note: `truncateAt` is the *trigger threshold*, not the output cap —
37
+ * once truncation fires, the output always emits the five quantile
38
+ * picks. To raise/lower the threshold without changing the picks,
39
+ * pass a different `truncateAt`; to vary the picks, fork this util.
40
+ */
41
+ export declare function pickMassQuantiles(rows: MassHistoryRow[], truncateAt?: number): MassHistoryRowMarked[];
@@ -5,6 +5,7 @@ import type { LegendInteractionMode } from "../shared/hooks";
5
5
  import type { BaseChartProps, ChartAccessor, CategoryFormatFn } from "../shared/types";
6
6
  import { type TooltipProp } from "../../Tooltip/Tooltip";
7
7
  import type { RealtimeFrameHandle } from "../../realtime/types";
8
+ import { type RegressionProp } from "../shared/regressionUtils";
8
9
  /**
9
10
  * BarChart component props
10
11
  */
@@ -90,6 +91,17 @@ export interface BarChartProps<TDatum extends Datum = Datum> extends BaseChartPr
90
91
  legendPosition?: "right" | "left" | "top" | "bottom";
91
92
  tooltip?: TooltipProp;
92
93
  annotations?: Datum[];
94
+ /**
95
+ * Overlay a regression line through the bar tops. Accepts `true`
96
+ * (linear), a method name (`"linear"` | `"polynomial"` | `"loess"`),
97
+ * or a full `RegressionConfig`. The regression treats categories
98
+ * as a numeric category-index for fit input; pixel positions are
99
+ * resolved through the band scale, so the line passes through bar
100
+ * centers. Best for ordered categories (months, quarters, score
101
+ * buckets) where a slope reads as a meaningful trend. Sugar over
102
+ * the `trend` annotation.
103
+ */
104
+ regression?: RegressionProp;
93
105
  /** Custom formatter for category tick labels */
94
106
  categoryFormat?: CategoryFormatFn;
95
107
  /** Fixed value-axis domain `[min, max]`. Either bound may be `undefined` to leave that side data-derived. */
@@ -5,6 +5,7 @@ import type { LegendInteractionMode, LegendPosition } from "../shared/hooks";
5
5
  import type { BaseChartProps, ChartAccessor, CategoryFormatFn } from "../shared/types";
6
6
  import { type TooltipProp } from "../../Tooltip/Tooltip";
7
7
  import type { RealtimeFrameHandle } from "../../realtime/types";
8
+ import { type RegressionProp } from "../shared/regressionUtils";
8
9
  export interface DotPlotProps<TDatum extends Datum = Datum> extends BaseChartProps {
9
10
  data?: TDatum[];
10
11
  categoryAccessor?: ChartAccessor<TDatum, string>;
@@ -34,6 +35,14 @@ export interface DotPlotProps<TDatum extends Datum = Datum> extends BaseChartPro
34
35
  legendPosition?: LegendPosition;
35
36
  tooltip?: TooltipProp;
36
37
  annotations?: Datum[];
38
+ /**
39
+ * Overlay a regression line through the dots. Same shape as
40
+ * Scatterplot's regression prop — accepts boolean, method-string,
41
+ * or full `RegressionConfig`. Pixel positions resolve through the
42
+ * band scale, so the line passes through dot centers. Sugar over
43
+ * the `trend` annotation.
44
+ */
45
+ regression?: RegressionProp;
37
46
  /** Custom formatter for category tick labels */
38
47
  categoryFormat?: CategoryFormatFn;
39
48
  /** Fixed value-axis domain `[min, max]`. Either bound may be `undefined` to leave that side data-derived. */
@@ -27,6 +27,11 @@ export interface GaugeChartProps extends BaseChartProps {
27
27
  backgroundColor?: string;
28
28
  /** Arc thickness as fraction of radius (0–1, default 0.3) */
29
29
  arcWidth?: number;
30
+ /** Pixel radius for the rounded ends of each arc segment, same prop
31
+ * semantics as `DonutChart.cornerRadius`. Default `undefined`
32
+ * (sharp corners). Useful for the "pill" aesthetic where each
33
+ * threshold zone reads as a discrete capsule. */
34
+ cornerRadius?: number;
30
35
  /** Show needle indicator (default true) */
31
36
  showNeedle?: boolean;
32
37
  /** Needle color (default: var(--semiotic-text, #333)) */
@@ -94,6 +99,21 @@ export interface GaugeChartProps extends BaseChartProps {
94
99
  * fillZones
95
100
  * />
96
101
  * ```
102
+ *
103
+ * @example
104
+ * ```tsx
105
+ * // Rounded segment ends — same `cornerRadius` semantics as DonutChart.
106
+ * // Each threshold zone reads as a capsule with the others.
107
+ * <GaugeChart
108
+ * value={65}
109
+ * thresholds={[
110
+ * { value: 60, color: "#22c55e" },
111
+ * { value: 80, color: "#f59e0b" },
112
+ * { value: 100, color: "#ef4444" },
113
+ * ]}
114
+ * cornerRadius={6}
115
+ * />
116
+ * ```
97
117
  */
98
118
  export declare const GaugeChart: {
99
119
  (props: GaugeChartProps & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
@@ -83,6 +83,11 @@ export interface SwimlaneChartProps<TDatum extends Datum = Datum> extends BaseCh
83
83
  color: string;
84
84
  opacity?: number;
85
85
  };
86
+ /** Rounded corner radius (in pixels) for the outermost ends of each
87
+ * lane. Both ends round: left+right in horizontal orientation, top+bottom
88
+ * in vertical. Middle segments of multi-segment lanes stay square so
89
+ * pieces visually butt against each other. */
90
+ roundedTop?: number;
86
91
  /** Fixed value-axis domain `[min, max]`. Either bound may be `undefined` to leave that side data-derived. */
87
92
  valueExtent?: [number | undefined, number | undefined] | [number];
88
93
  /** Pass-through props to StreamOrdinalFrame */
@@ -87,6 +87,8 @@ export interface RealtimeHeatmapProps<TDatum extends Datum = Datum> {
87
87
  selection?: SelectionConfig;
88
88
  /** Show a loading skeleton placeholder */
89
89
  loading?: boolean;
90
+ /** Custom content rendered in place of the default skeleton while `loading` is true. */
91
+ loadingContent?: React.ReactNode | false;
90
92
  /** Custom content to render when data is empty. Set to `false` to disable empty state. */
91
93
  emptyContent?: ReactNode | false;
92
94
  /** Visual emphasis level for dashboard hierarchy. "primary" spans two columns in ChartGrid. */
@@ -6,7 +6,7 @@ import type { LegendInteractionMode, LegendPosition } from "../shared/hooks";
6
6
  import type { ChartMode, ChartAccessor, SelectionConfig } from "../shared/types";
7
7
  import type { OnObservationCallback } from "../../store/ObservationStore";
8
8
  import type { Datum } from "../shared/datumTypes";
9
- export interface RealtimeTemporalHistogramProps<TDatum extends Datum = Datum> {
9
+ export interface RealtimeHistogramProps<TDatum extends Datum = Datum> {
10
10
  /** Display mode: "primary" (full chrome), "context" (compact), "sparkline" (inline) */
11
11
  mode?: ChartMode;
12
12
  /** Time interval for binning */
@@ -103,6 +103,8 @@ export interface RealtimeTemporalHistogramProps<TDatum extends Datum = Datum> {
103
103
  transition?: TransitionConfig;
104
104
  /** Show a loading skeleton placeholder */
105
105
  loading?: boolean;
106
+ /** Custom content rendered in place of the default skeleton while `loading` is true. */
107
+ loadingContent?: React.ReactNode | false;
106
108
  /** Custom content to render when data is empty. Set to `false` to disable empty state. */
107
109
  emptyContent?: ReactNode | false;
108
110
  /** Brush configuration. `true` defaults to `{ dimension: "x", snap: "bin" }`. */
@@ -137,7 +139,7 @@ export interface RealtimeTemporalHistogramProps<TDatum extends Datum = Datum> {
137
139
  pointIdAccessor?: string | ((d: Datum) => string);
138
140
  }
139
141
  /**
140
- * RealtimeTemporalHistogram - Streaming temporal histogram.
142
+ * RealtimeHistogram - Streaming temporal histogram.
141
143
  *
142
144
  * Wraps StreamXYFrame with `chartType="bar"` and `runtimeMode="streaming"`,
143
145
  * binning pushed data points into time-windowed bars. Supports both simple
@@ -149,7 +151,7 @@ export interface RealtimeTemporalHistogramProps<TDatum extends Datum = Datum> {
149
151
  * @example
150
152
  * ```tsx
151
153
  * // Simple temporal histogram — push each event, the chart bins by time
152
- * <RealtimeTemporalHistogram
154
+ * <RealtimeHistogram
153
155
  * ref={ref}
154
156
  * binSize={20}
155
157
  * fill="#007bff"
@@ -160,7 +162,7 @@ export interface RealtimeTemporalHistogramProps<TDatum extends Datum = Datum> {
160
162
  * @example
161
163
  * ```tsx
162
164
  * // Stacked by category — same push API, color by status field
163
- * <RealtimeTemporalHistogram
165
+ * <RealtimeHistogram
164
166
  * ref={ref}
165
167
  * binSize={25}
166
168
  * categoryAccessor="category"
@@ -169,14 +171,17 @@ export interface RealtimeTemporalHistogramProps<TDatum extends Datum = Datum> {
169
171
  * />
170
172
  * ```
171
173
  */
172
- export declare const RealtimeTemporalHistogram: {
173
- <TDatum extends Datum = Datum>(props: RealtimeTemporalHistogramProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
174
+ export declare const RealtimeHistogram: {
175
+ <TDatum extends Datum = Datum>(props: RealtimeHistogramProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
174
176
  displayName?: string;
175
177
  };
176
- /** @deprecated Use RealtimeTemporalHistogram instead */
177
- export declare const RealtimeHistogram: {
178
- <TDatum extends Datum = Datum>(props: RealtimeTemporalHistogramProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
178
+ /** @deprecated Use `RealtimeHistogram` (the canonical public name) instead. The
179
+ * `RealtimeTemporalHistogram` alias is preserved for back-compat with code
180
+ * written before the rename and will be removed in a future major version. */
181
+ export declare const RealtimeTemporalHistogram: {
182
+ <TDatum extends Datum = Datum>(props: RealtimeHistogramProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
179
183
  displayName?: string;
180
184
  };
181
- /** @deprecated Use RealtimeTemporalHistogramProps instead */
182
- export type RealtimeHistogramProps = RealtimeTemporalHistogramProps;
185
+ /** @deprecated Use `RealtimeHistogramProps` instead. Same component, just the
186
+ * pre-rename type alias. */
187
+ export type RealtimeTemporalHistogramProps<TDatum extends Datum = Datum> = RealtimeHistogramProps<TDatum>;
@@ -89,6 +89,8 @@ export interface RealtimeLineChartProps<TDatum extends Datum = Datum> {
89
89
  selection?: SelectionConfig;
90
90
  /** Show a loading skeleton placeholder */
91
91
  loading?: boolean;
92
+ /** Custom content rendered in place of the default skeleton while `loading` is true. */
93
+ loadingContent?: React.ReactNode | false;
92
94
  /** Custom content to render when data is empty. Set to `false` to disable empty state. */
93
95
  emptyContent?: ReactNode | false;
94
96
  /** Visual emphasis level for dashboard hierarchy. "primary" spans two columns in ChartGrid. */
@@ -87,6 +87,8 @@ export interface RealtimeSwarmChartProps<TDatum extends Datum = Datum> {
87
87
  selection?: SelectionConfig;
88
88
  /** Show a loading skeleton placeholder */
89
89
  loading?: boolean;
90
+ /** Custom content rendered in place of the default skeleton while `loading` is true. */
91
+ loadingContent?: React.ReactNode | false;
90
92
  /** Custom content to render when data is empty. Set to `false` to disable empty state. */
91
93
  emptyContent?: ReactNode | false;
92
94
  /** Visual emphasis level for dashboard hierarchy. "primary" spans two columns in ChartGrid. */
@@ -89,6 +89,8 @@ export interface RealtimeWaterfallChartProps<TDatum extends Datum = Datum> {
89
89
  selection?: SelectionConfig;
90
90
  /** Show a loading skeleton placeholder */
91
91
  loading?: boolean;
92
+ /** Custom content rendered in place of the default skeleton while `loading` is true. */
93
+ loadingContent?: React.ReactNode | false;
92
94
  /** Custom content to render when data is empty. Set to `false` to disable empty state. */
93
95
  emptyContent?: ReactNode | false;
94
96
  /** Visual emphasis level for dashboard hierarchy. "primary" spans two columns in ChartGrid. */
@@ -40,6 +40,25 @@ export declare function buildDefaultRealtimeTooltip<TDatum extends Datum = Datum
40
40
  * scene builder).
41
41
  */
42
42
  export declare function buildWaterfallTooltip<TDatum extends Datum = Datum>(options?: DefaultRealtimeTooltipOptions<TDatum>): (d: HoverData) => ReactNode;
43
+ /**
44
+ * Histogram-specific default tooltip.
45
+ *
46
+ * The barScene's histogram path enriches each rect's datum with
47
+ * `{ binStart, binEnd, total, category?, categoryValue? }`. The generic
48
+ * `x: <time>, y: <value>` shape produces empty strings on those bins
49
+ * because neither `time` nor `value` exists on the aggregated payload.
50
+ * This builder surfaces the fields that actually carry meaning for a
51
+ * histogram bin:
52
+ *
53
+ * range: <binStart>–<binEnd>
54
+ * count: <total>
55
+ * category: <category> (only when categoryAccessor is set)
56
+ *
57
+ * Falls back to the canonical x/y shape if a bin's enriched fields are
58
+ * absent — guards against a non-streaming render path or a static frame
59
+ * that bypasses the bin scene.
60
+ */
61
+ export declare function buildHistogramTooltip<TDatum extends Datum = Datum>(options?: DefaultRealtimeTooltipOptions<TDatum>): (d: HoverData) => ReactNode;
43
62
  /**
44
63
  * Heatmap-specific default tooltip.
45
64
  *
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Equidistant tick generation for the `axisExtent="exact"` axis mode.
3
+ *
4
+ * The default "nice" mode (d3 scale's `.ticks(count)` algorithm)
5
+ * returns aesthetically-rounded tick values WITHIN the data domain —
6
+ * the first tick may sit above the data min and the last tick may
7
+ * sit below the data max. That's the standard reading: round labels
8
+ * win, exact data bounds lose.
9
+ *
10
+ * "exact" mode reverses that tradeoff. The first tick sits exactly at
11
+ * `dataMin`, the last tick sits exactly at `dataMax`, and the
12
+ * intermediate ticks are equidistant within the domain. Labels are
13
+ * whatever the value formatter produces — often not round.
14
+ *
15
+ * Works on `scaleLinear` and `scaleTime` (operates on millisecond
16
+ * timestamps, returns Date objects so downstream formatters receive
17
+ * the same shape they get from `scale.ticks()`).
18
+ *
19
+ * `scaleLog` is supported but the ticks come out evenly spaced in
20
+ * VALUE space, not pixel space — `[1, 250.75, 500.5, 750.25, 1000]`
21
+ * instead of `[1, 10, 100, 1000]`. That's intentional for the
22
+ * "endpoints must read as the actual data bounds" use case the
23
+ * feature was added for, but it's not "equidistant on the rendered
24
+ * axis". Users that want log-space-equidistant ticks should pass
25
+ * explicit `tickValues` (e.g. `[1, 10, 100, 1000]`) — those bypass
26
+ * `axisExtent` entirely.
27
+ */
28
+ export type AxisExtentMode = "nice" | "exact";
29
+ /** A d3-style continuous scale (linear, time, log) — the bit we use.
30
+ * The `domain()` return type stays as `number[]` / `Date[]` rather
31
+ * than a strict 2-tuple because that's what d3-scale's own types
32
+ * declare (the runtime contract is "first and last elements are the
33
+ * bounds" — d3 never returns a single-element domain in practice). */
34
+ type TickableScale<T = number | Date> = {
35
+ domain(): T[];
36
+ ticks(count?: number): T[];
37
+ };
38
+ /**
39
+ * Generate `count` ticks evenly spaced across the scale's domain,
40
+ * inclusive of both endpoints. For a domain of `[lo, hi]` and a
41
+ * count of `n`, returns `[lo, lo + step, ..., hi]` where
42
+ * `step = (hi - lo) / (n - 1)`.
43
+ *
44
+ * Edge cases:
45
+ * - `count < 2` returns just the two endpoints.
46
+ * - Empty/zero-width domain returns the endpoints unchanged.
47
+ * - Date-valued domain returns Date objects (preserving the shape
48
+ * d3-scale-time's `.ticks()` returns).
49
+ */
50
+ export declare function equidistantTicks<T extends number | Date>(scale: TickableScale<T>, count: number): T[];
51
+ /**
52
+ * Return either equidistant ticks (when `mode === "exact"`) or the
53
+ * scale's own d3-generated ticks (default "nice" behavior).
54
+ *
55
+ * Centralized so XY and ordinal overlay code paths can both call
56
+ * one function instead of branching at every `.ticks()` site.
57
+ */
58
+ export declare function ticksForMode<T extends number | Date>(scale: TickableScale<T>, count: number, mode: AxisExtentMode | undefined): T[];
59
+ export {};
@@ -35,6 +35,73 @@
35
35
  export type PropType = "string" | "number" | "boolean" | "array" | "object" | "function";
36
36
  export type DataShape = "array" | "object" | "network" | "realtime" | "none";
37
37
  export type ChartCategory = "xy" | "ordinal" | "network" | "geo" | "realtime";
38
+ /**
39
+ * Capability tags for runtime behavior. Driven by the
40
+ * `hoc-frame-architecture-audit` Phase 1: each chart declares which
41
+ * features it actually supports so docs, AI/MCP tools, and CI gates
42
+ * can read structured truth instead of inferring it from the source.
43
+ *
44
+ * All fields are required so a new chart entry can't omit them
45
+ * silently — the audit's anti-goal "Do not make registry metadata
46
+ * aspirational. It should describe real runtime behavior and be
47
+ * checked." applies here.
48
+ */
49
+ export interface ChartCapabilities {
50
+ /**
51
+ * Render pipeline. `canvas` for Stream-Frame-driven charts that
52
+ * paint to canvas with SVG overlays for chrome (the common case).
53
+ * `svg` for charts that are pure SVG (none today, but reserved).
54
+ * `hybrid` for charts that use both — currently every Stream-Frame
55
+ * HOC qualifies as hybrid; reserve `canvas` for any future
56
+ * canvas-only fallback.
57
+ */
58
+ renderModes: Array<"canvas" | "svg" | "hybrid">;
59
+ /** Renders a legend swatch column when `colorBy` (or equivalent)
60
+ * resolves to non-empty categories. */
61
+ supportsLegend: boolean;
62
+ /** Reads from a `selection` prop and dims/highlights matching
63
+ * marks via `wrapStyleWithSelection` or equivalent. */
64
+ supportsSelection: boolean;
65
+ /** Produces a hover-driven selection (used by linked crosshair /
66
+ * cross-filter patterns) via `linkedHover`. */
67
+ supportsLinkedHover: boolean;
68
+ /** Exposes a ref handle (`push`, `pushMany`, etc.) so consumers
69
+ * can mutate the data list without re-rendering. Hierarchy
70
+ * charts (Treemap/CirclePack/TreeDiagram/OrbitDiagram) and
71
+ * pure-synthetic charts (GaugeChart) declare false. */
72
+ supportsPush: boolean;
73
+ /** Renders to a static SVG via `renderChart()` from `semiotic/server`
74
+ * through a registered entry in `serverChartConfigs.ts`. SSR-only
75
+ * charts (none yet) and HOC-SSR exclusions also declare false. */
76
+ supportsSSR: boolean;
77
+ /**
78
+ * How color is consumed by the chart's data marks.
79
+ * - `categorical`: discrete buckets, paired with a `colorBy` accessor.
80
+ * - `sequential`: continuous scale (heatmap intensity, choropleth value).
81
+ * - `threshold`: stepped scale with explicit breakpoints (gauge zones).
82
+ * - `continuous`: smooth interpolation along a 1-D path (gradient fill).
83
+ * - `none`: chart doesn't use color encoding (sparkline, pure layout).
84
+ */
85
+ colorModel: "categorical" | "sequential" | "threshold" | "continuous" | "none";
86
+ /**
87
+ * Where the geometry comes from.
88
+ * - `plugin`: a built-in plugin in the frame (sankey/force/chord/tree
89
+ * for network; bar/pie/swarm/etc. for ordinal; line/area/etc. for XY).
90
+ * - `custom`: emitted via the frame's customLayout escape hatch
91
+ * (ProcessSankey via `customNetworkLayout`, NetworkCustomChart,
92
+ * XYCustomChart, OrdinalCustomChart).
93
+ * - `synthetic`: no layout — the chart constructs its scene from
94
+ * the input value(s) directly (GaugeChart computes arc geometry).
95
+ */
96
+ layoutMode: "plugin" | "custom" | "synthetic";
97
+ /**
98
+ * Free-form tag list for opt-in features that don't fit the
99
+ * boolean shape — e.g. "particles", "forecast", "anomaly", "brush",
100
+ * "streamgraph", "minimap". Used by docs feature tables and
101
+ * potential capability-driven AI suggestions.
102
+ */
103
+ specialFeatures: string[];
104
+ }
38
105
  export interface ChartPropSpec {
39
106
  /** Allowed runtime types. May be a single value or a union. */
40
107
  type: PropType | PropType[];
@@ -71,6 +138,14 @@ export interface ChartSpec {
71
138
  propBags: ReadonlyArray<keyof typeof PROP_BAGS>;
72
139
  /** Chart-specific prop spec, overlaid on top of the composed bags. */
73
140
  ownProps: Record<string, ChartPropSpec>;
141
+ /**
142
+ * Capability matrix — declarative facts about runtime behavior.
143
+ * Drives docs feature tables, capability-aware AI/MCP tools, and
144
+ * the `check:capabilities` drift gate (which verifies, e.g., that
145
+ * a chart claiming `supportsSSR: true` has a matching entry in
146
+ * `serverChartConfigs.ts`).
147
+ */
148
+ capabilities: ChartCapabilities;
74
149
  }
75
150
  export declare const PROP_BAGS: {
76
151
  readonly common: Record<string, ChartPropSpec>;
@@ -62,12 +62,18 @@ export declare function getColor(dataPoint: Datum, colorBy: string | ((d: Datum)
62
62
  */
63
63
  export declare function createColorScale(data: Array<Datum>, colorBy: string, scheme?: string | string[]): (v: string) => string;
64
64
  /**
65
- * Generates a size function based on sizeBy configuration
65
+ * Generates a size function based on sizeBy configuration.
66
+ *
67
+ * Output is clamped to `sizeRange`. A pushed point whose `sizeBy`
68
+ * value falls outside the currently-known domain (which can happen
69
+ * in push mode before the running min/max catches up) renders at
70
+ * the boundary radius rather than producing an arbitrarily large
71
+ * (or negative) pixel value.
66
72
  *
67
73
  * @param dataPoint - The data point
68
74
  * @param sizeBy - Field name or function to determine size
69
75
  * @param sizeRange - Min and max size range [min, max]
70
76
  * @param domain - Optional domain for scaling [minValue, maxValue]
71
- * @returns Size value
77
+ * @returns Size value, clamped to `sizeRange` when a domain is given
72
78
  */
73
79
  export declare function getSize(dataPoint: Datum, sizeBy: string | ((d: Datum) => number), sizeRange?: [number, number], domain?: [number, number]): number;
@@ -4,15 +4,13 @@ import type { Accessor } from "./types";
4
4
  * Flatten a hierarchical data structure into an array of all nodes
5
5
  * by recursively traversing children.
6
6
  */
7
- export declare function flattenHierarchy(data: Datum | null, childrenAccessor: string | ((d: Datum) => any[])): Array<Datum>;
7
+ export declare function flattenHierarchy(data: Datum | null, childrenAccessor: string | ((d: Datum) => Datum[])): Array<Datum>;
8
8
  /**
9
9
  * Infer nodes from edges when a nodes array is not provided.
10
10
  * Extracts unique source/target IDs and returns `{ id }` objects.
11
11
  * Returns the provided nodes array if it's non-empty.
12
12
  */
13
- export declare function inferNodesFromEdges(nodes: any[] | undefined, edges: any[], sourceAccessor: string | ((d: Datum) => string), targetAccessor: string | ((d: Datum) => string)): Array<{
14
- id: string;
15
- }>;
13
+ export declare function inferNodesFromEdges(nodes: Datum[] | undefined, edges: Datum[], sourceAccessor: string | ((d: Datum) => string), targetAccessor: string | ((d: Datum) => string)): Datum[];
16
14
  /**
17
15
  * Convert a valueAccessor prop into a hierarchy sum function.
18
16
  * Used by TreeDiagram, Treemap, and CirclePack for d3-hierarchy's `.sum()`.
@@ -26,7 +24,7 @@ export declare function createEdgeStyleFn({ edgeColorBy, colorBy, colorScale, no
26
24
  edgeColorBy: "source" | "target" | "gradient" | ((d: Datum) => string);
27
25
  colorBy: Accessor<string> | undefined;
28
26
  colorScale: ((v: string) => string) | undefined;
29
- nodeStyleFn: (d: any, index?: number) => Datum;
27
+ nodeStyleFn: (d: Datum, index?: number) => Datum;
30
28
  edgeOpacity: number;
31
29
  baseStyle?: Record<string, string | number>;
32
30
  }): (d: Datum) => Datum;
@@ -0,0 +1,99 @@
1
+ /**
2
+ * radialGeometry — pure math helpers for radial chart authoring.
3
+ *
4
+ * The original consumer is `GaugeChart`, which needs to:
5
+ * - Convert a sweep angle (degrees) into start-angle + radian
6
+ * forms that align with the convention pieScene.ts uses
7
+ * (0° = 12 o'clock, positive = clockwise, gap centered at the
8
+ * 6 o'clock position).
9
+ * - Map a value in `[min, max]` to its angle along the arc.
10
+ * - Compute the arc's visible bounding box in unit-circle coords
11
+ * so a container can fit the arc and pick a maximum radius.
12
+ *
13
+ * Custom radial chart authors using `XYCustomChart` or building a
14
+ * bespoke radial layout can reach for the same primitives without
15
+ * reimplementing the trigonometry. Surface intentionally tight —
16
+ * each function is a few lines of math with a documented input
17
+ * convention.
18
+ */
19
+ /** Result of `sweepToAngles`. All angles are in the
20
+ * 12-o'clock-zero, clockwise-positive convention used by pieScene
21
+ * and the underlying gauge implementation. */
22
+ export interface SweepAngles {
23
+ /** Full sweep angle in radians. */
24
+ sweepRad: number;
25
+ /** Gap angle (the unfilled portion) in degrees. */
26
+ gapDeg: number;
27
+ /** Starting angle of the arc, measured in degrees clockwise from
28
+ * 12 o'clock. The gap is centered at 6 o'clock (180°), so the
29
+ * arc starts at `180° + gapDeg / 2`. */
30
+ startAngleDeg: number;
31
+ /** Same as `startAngleDeg`, in radians (12 o'clock = 0). */
32
+ startAngleRad: number;
33
+ /** Offset angle in radians measured from +X (3 o'clock, the
34
+ * trigonometric convention). Useful for direct `Math.cos` /
35
+ * `Math.sin` calls when projecting points onto the arc. */
36
+ offsetRad: number;
37
+ }
38
+ /**
39
+ * Convert a sweep angle (degrees) into the four angle forms a
40
+ * radial chart layout typically needs. Defaults to a 240° sweep
41
+ * (gauge-style: gap of 120° centered at the bottom).
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * const { sweepRad, startAngleRad } = sweepToAngles(180) // half-circle
46
+ * ```
47
+ */
48
+ export declare function sweepToAngles(sweepDegrees?: number): SweepAngles;
49
+ /**
50
+ * Map a numeric value in `[min, max]` to its angle along the arc.
51
+ * Returned angles are in trig-convention radians (suitable for
52
+ * `Math.cos` / `Math.sin` to project to unit-circle x/y).
53
+ *
54
+ * Values outside `[min, max]` are clamped.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const { offsetRad, sweepRad } = sweepToAngles(240)
59
+ * const θ = valueToAngle(75, 0, 100, sweepRad, offsetRad)
60
+ * // x = Math.cos(θ), y = Math.sin(θ)
61
+ * ```
62
+ */
63
+ export declare function valueToAngle(value: number, min: number, max: number, sweepRad: number, offsetRad: number): number;
64
+ /** Bounding box of the visible arc in unit-circle coordinates
65
+ * (radius = 1 around the origin). Multiply by the chosen radius
66
+ * to get pixel-space extents. */
67
+ export interface ArcBoundingBox {
68
+ minX: number;
69
+ maxX: number;
70
+ minY: number;
71
+ maxY: number;
72
+ /** `maxX - minX`. Multiply by radius for pixel width. */
73
+ width: number;
74
+ /** `maxY - minY`. Multiply by radius for pixel height. */
75
+ height: number;
76
+ /** Center of the bbox in unit-circle coords. */
77
+ cx: number;
78
+ cy: number;
79
+ }
80
+ /**
81
+ * Compute the bounding box of an arc with the given sweep, in
82
+ * unit-circle coordinates. Useful for centering the arc within a
83
+ * container and picking a maximum radius that keeps the arc inside
84
+ * the available width/height.
85
+ *
86
+ * The bbox includes:
87
+ * - The two arc endpoints.
88
+ * - The arc's center point `(0, 0)`.
89
+ * - Any of the cardinal points `(±1, 0)`, `(0, ±1)` that fall
90
+ * within the swept range.
91
+ *
92
+ * @example
93
+ * ```ts
94
+ * const bbox = computeArcBoundingBox(240)
95
+ * // Maximize radius so the arc fits in a (W × H) container:
96
+ * const radius = Math.min((W - 2 * pad) / bbox.width, (H - 2 * pad) / bbox.height)
97
+ * ```
98
+ */
99
+ export declare function computeArcBoundingBox(sweepDegrees?: number): ArcBoundingBox;