semiotic 3.5.2 → 3.5.4

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 (101) hide show
  1. package/CLAUDE.md +9 -8
  2. package/README.md +15 -15
  3. package/ai/componentMetadata.cjs +9 -2
  4. package/ai/dist/mcp-server.js +4 -1
  5. package/ai/examples.md +27 -0
  6. package/ai/schema.json +300 -41
  7. package/ai/system-prompt.md +1 -1
  8. package/dist/components/ThemeProvider.d.ts +2 -2
  9. package/dist/components/charts/index.d.ts +3 -3
  10. package/dist/components/charts/network/ProcessSankey.d.ts +22 -0
  11. package/dist/components/charts/network/SankeyDiagram.d.ts +5 -1
  12. package/dist/components/charts/network/Treemap.d.ts +8 -0
  13. package/dist/components/charts/network/processSankey/algorithm.d.ts +57 -0
  14. package/dist/components/charts/network/processSankey/buildScenes.d.ts +6 -0
  15. package/dist/components/charts/network/processSankey/streamingLayout.d.ts +13 -0
  16. package/dist/components/charts/ordinal/GaugeChart.d.ts +10 -0
  17. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +2 -0
  18. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +24 -0
  19. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +2 -0
  20. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +2 -0
  21. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +2 -0
  22. package/dist/components/charts/shared/gaugeGradient.d.ts +62 -0
  23. package/dist/components/charts/shared/hooks.d.ts +2 -2
  24. package/dist/components/charts/shared/streamPropsHelpers.d.ts +2 -2
  25. package/dist/components/charts/shared/tooltipUtils.d.ts +11 -0
  26. package/dist/components/charts/shared/types.d.ts +17 -2
  27. package/dist/components/charts/shared/useAreaSeriesSetup.d.ts +4 -1
  28. package/dist/components/charts/shared/useChartSetup.d.ts +4 -2
  29. package/dist/components/charts/shared/useCustomChartSetup.d.ts +2 -1
  30. package/dist/components/charts/shared/useNetworkChartSetup.d.ts +2 -0
  31. package/dist/components/charts/shared/withChartWrapper.d.ts +10 -3
  32. package/dist/components/charts/xy/AreaChart.d.ts +27 -2
  33. package/dist/components/charts/xy/LineChart.d.ts +26 -2
  34. package/dist/components/charts/xy/Scatterplot.d.ts +5 -1
  35. package/dist/components/semiotic-ai.d.ts +1 -1
  36. package/dist/components/semiotic-realtime.d.ts +3 -3
  37. package/dist/components/semiotic-server.d.ts +1 -0
  38. package/dist/components/semiotic-xy.d.ts +1 -1
  39. package/dist/components/semiotic.d.ts +6 -5
  40. package/dist/components/server/renderToStaticSVG.d.ts +4 -1
  41. package/dist/components/server/serverChartConfigs.d.ts +1 -0
  42. package/dist/components/server/staticAnnotations.d.ts +1 -1
  43. package/dist/components/server/staticLegend.d.ts +35 -0
  44. package/dist/components/server/themeResolver.d.ts +7 -1
  45. package/dist/components/store/ThemeStore.d.ts +9 -1
  46. package/dist/components/stream/AccessibleDataTable.d.ts +2 -2
  47. package/dist/components/stream/NetworkSVGOverlay.d.ts +2 -1
  48. package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -1
  49. package/dist/components/stream/PipelineStore.d.ts +20 -13
  50. package/dist/components/stream/SVGOverlay.d.ts +4 -30
  51. package/dist/components/stream/SceneToSVG.d.ts +1 -1
  52. package/dist/components/stream/accessorUtils.d.ts +2 -1
  53. package/dist/components/stream/geoTypes.d.ts +2 -1
  54. package/dist/components/stream/hoverUtils.d.ts +1 -0
  55. package/dist/components/stream/layouts/hierarchyLayoutPlugin.d.ts +1 -1
  56. package/dist/components/stream/legendRenderer.d.ts +2 -1
  57. package/dist/components/stream/networkTypes.d.ts +13 -1
  58. package/dist/components/stream/ordinalTypes.d.ts +31 -3
  59. package/dist/components/stream/renderers/wedgePathBuilder.d.ts +87 -0
  60. package/dist/components/stream/types.d.ts +110 -16
  61. package/dist/components/stream/xySceneBuilders/areaGradient.d.ts +20 -0
  62. package/dist/components/stream/xySceneBuilders/barScene.d.ts +2 -2
  63. package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +2 -2
  64. package/dist/components/stream/xySceneBuilders/heatmapScene.d.ts +2 -2
  65. package/dist/components/stream/xySceneBuilders/lineScene.d.ts +4 -3
  66. package/dist/components/stream/xySceneBuilders/pointScene.d.ts +2 -2
  67. package/dist/components/stream/xySceneBuilders/ribbonScene.d.ts +107 -0
  68. package/dist/components/stream/xySceneBuilders/swarmScene.d.ts +2 -2
  69. package/dist/components/stream/xySceneBuilders/types.d.ts +9 -12
  70. package/dist/components/stream/xySceneBuilders/waterfallScene.d.ts +2 -2
  71. package/dist/components/types/legendTypes.d.ts +15 -0
  72. package/dist/components/types/marginType.d.ts +17 -3
  73. package/dist/geo.min.js +1 -1
  74. package/dist/geo.module.min.js +1 -1
  75. package/dist/network.min.js +1 -1
  76. package/dist/network.module.min.js +1 -1
  77. package/dist/ordinal.min.js +1 -1
  78. package/dist/ordinal.module.min.js +1 -1
  79. package/dist/realtime.min.js +1 -1
  80. package/dist/realtime.module.min.js +1 -1
  81. package/dist/semiotic-ai.d.ts +1 -1
  82. package/dist/semiotic-ai.min.js +1 -1
  83. package/dist/semiotic-ai.module.min.js +1 -1
  84. package/dist/semiotic-data.min.js +1 -1
  85. package/dist/semiotic-data.module.min.js +1 -1
  86. package/dist/semiotic-realtime.d.ts +3 -3
  87. package/dist/semiotic-server.d.ts +1 -0
  88. package/dist/semiotic-themes.min.js +1 -1
  89. package/dist/semiotic-themes.module.min.js +1 -1
  90. package/dist/semiotic-utils.min.js +1 -1
  91. package/dist/semiotic-utils.module.min.js +1 -1
  92. package/dist/semiotic-xy.d.ts +1 -1
  93. package/dist/semiotic.d.ts +6 -5
  94. package/dist/semiotic.min.js +1 -1
  95. package/dist/semiotic.module.min.js +1 -1
  96. package/dist/server.min.js +1 -1
  97. package/dist/server.module.min.js +1 -1
  98. package/dist/xy.min.js +1 -1
  99. package/dist/xy.module.min.js +1 -1
  100. package/package.json +25 -25
  101. package/dist/components/stream/xySceneBuilders/boundsScene.d.ts +0 -9
@@ -1,7 +1,7 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { OnObservationCallback } from "../store/ObservationStore";
3
3
  import type { HoverData, AnnotationContext } from "../realtime/types";
4
- import type { LegendGroup } from "../types/legendTypes";
4
+ import type { LegendGroup, LegendLayout } from "../types/legendTypes";
5
5
  import type { Style, DecayConfig, PulseConfig, TransitionConfig, StalenessConfig, ThemeSemanticColors, SceneDatum } from "./types";
6
6
  import type { AnimateProp } from "./pipelineTransitionUtils";
7
7
  import type { Datum } from "../charts/shared/datumTypes";
@@ -262,9 +262,20 @@ export interface NetworkLineEdge {
262
262
  export interface NetworkBezierEdge {
263
263
  type: "bezier";
264
264
  pathD: string;
265
+ /** When false, the hit tester skips this edge. Used for
266
+ * decorative scene-edges like ProcessSankey's gradient stubs —
267
+ * they paint visually but shouldn't intercept hover. */
268
+ interactive?: boolean;
265
269
  bezierCache?: BezierCache;
266
270
  style: Style;
267
271
  datum: SceneDatum;
272
+ /** Internal gradient used by circular sankey stub bands. */
273
+ _gradient?: {
274
+ x0: number;
275
+ x1: number;
276
+ from: number;
277
+ to: number;
278
+ };
268
279
  _pulseIntensity?: number;
269
280
  _pulseColor?: string;
270
281
  /** Lazily-built Path2D for hit testing; invalidated when pathD changes. */
@@ -512,6 +523,7 @@ export interface StreamNetworkFrameProps<T = Datum> {
512
523
  legendGroups: LegendGroup[];
513
524
  };
514
525
  legendPosition?: "right" | "left" | "top" | "bottom";
526
+ legendLayout?: LegendLayout;
515
527
  legendHoverBehavior?: (item: {
516
528
  label: string;
517
529
  } | null) => void;
@@ -3,7 +3,7 @@ import type { ScaleLinear, ScaleBand } from "d3-scale";
3
3
  import type { WindowMode, HoverAnnotationConfig, HoverData, AnnotationContext } from "../realtime/types";
4
4
  import type { Style, SceneDatum, DecayConfig, PulseConfig, TransitionConfig, StalenessConfig, ThemeSemanticColors } from "./types";
5
5
  import type { AnimateProp } from "./pipelineTransitionUtils";
6
- import type { LegendGroup } from "../types/legendTypes";
6
+ import type { GradientLegendConfig, LegendGroup, LegendLayout } from "../types/legendTypes";
7
7
  import type { Datum } from "../charts/shared/datumTypes";
8
8
  export type OrdinalChartType = "bar" | "clusterbar" | "point" | "swarm" | "pie" | "donut" | "boxplot" | "violin" | "histogram" | "ridgeline" | "timeline" | "funnel" | "bar-funnel" | "swimlane" | "custom";
9
9
  export interface OrdinalScales {
@@ -21,8 +21,35 @@ export interface WedgeSceneNode {
21
21
  startAngle: number;
22
22
  /** End angle in radians, canvas convention */
23
23
  endAngle: number;
24
- /** Corner radius for rounded wedge arcs (d3-shape arc.cornerRadius) */
24
+ /** Corner radius for rounded wedge arcs (d3-shape arc.cornerRadius).
25
+ * When set on its own, rounds ALL FOUR corners (the d3-shape default).
26
+ * Pair with `roundedEnds` to round only the gauge's outer endpoints —
27
+ * the swimlane analogue for radial sectors: first wedge's start side
28
+ * + last wedge's end side rounded, internal zone seams stay square. */
25
29
  cornerRadius?: number;
30
+ /** Selective per-end rounding. When omitted, `cornerRadius` rounds all
31
+ * four corners. When provided, `cornerRadius` rounds ONLY the sides
32
+ * marked `true` — `{ start: true }` rounds the wedge's startAngle
33
+ * side (both inner and outer corners at that angle), `{ end: true }`
34
+ * rounds the endAngle side. The gauge scene builder uses this to
35
+ * paint outer endpoints rounded but internal zone seams square. */
36
+ roundedEnds?: {
37
+ start?: boolean;
38
+ end?: boolean;
39
+ };
40
+ /** Render the wedge's interior as N equal angular slices, each filled
41
+ * with the corresponding color from `colors`. The wedge's own shape
42
+ * (incl. `cornerRadius` + `roundedEnds`) is used as a clip mask so
43
+ * only the slice geometry shows through the rounded outline. Used by
44
+ * GaugeChart's gradient-fill mode: the band reads as one continuous
45
+ * rounded arc with a gradient sampled along its length, without any
46
+ * individual slice (which would be far too narrow to host its own
47
+ * rounded corners) needing to round. Slices are an internal
48
+ * rendering detail — they do not appear as separate scene nodes,
49
+ * participate in hit testing, or transition independently. */
50
+ _gradientBand?: {
51
+ colors: string[];
52
+ };
26
53
  style: Style;
27
54
  datum: SceneDatum;
28
55
  category?: string;
@@ -359,7 +386,7 @@ export interface StreamOrdinalFrameProps<T = Datum> {
359
386
  legend?: ReactNode | {
360
387
  legendGroups: LegendGroup[];
361
388
  } | {
362
- gradient: import("../types/legendTypes").GradientLegendConfig;
389
+ gradient: GradientLegendConfig;
363
390
  };
364
391
  legendHoverBehavior?: (item: {
365
392
  label: string;
@@ -370,6 +397,7 @@ export interface StreamOrdinalFrameProps<T = Datum> {
370
397
  legendHighlightedCategory?: string | null;
371
398
  legendIsolatedCategories?: Set<string>;
372
399
  legendPosition?: "right" | "left" | "top" | "bottom";
400
+ legendLayout?: LegendLayout;
373
401
  /** Accessor used to report the current legend category domain in push mode. */
374
402
  legendCategoryAccessor?: string | ((d: T) => string);
375
403
  /** Fires when the current legend category domain changes after scene rebuilds. */
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Annular sector path builder with selective per-end corner rounding.
3
+ *
4
+ * d3-shape's `arc().cornerRadius()` rounds ALL FOUR corners of an
5
+ * annular sector uniformly — there's no built-in per-corner control.
6
+ * For gauges with multiple zones we want the gauge's OUTER endpoints
7
+ * rounded (the swimlane convention applied radially) but internal zone
8
+ * seams to stay square. This helper builds the path manually so each
9
+ * end can be opted in independently.
10
+ *
11
+ * The geometry mirrors d3's algorithm: a corner circle of radius `cr`
12
+ * is inscribed tangent to both walls (the outer/inner arc and the
13
+ * radial line at the relevant angle). The angular setback from the
14
+ * radial line is `asin(cr / (R ± cr))` — `R - cr` for outer corners
15
+ * (corner centers sit `cr` inward of the outer arc), `R + cr` for
16
+ * inner corners.
17
+ *
18
+ * Returned shape is an SVG path `d` attribute, equivalently consumable
19
+ * by Path2D in canvas. Coordinates are wedge-local (centered at
20
+ * origin); the renderer translates to `(cx, cy)`.
21
+ *
22
+ * Inputs use the **canvas angle convention** (0 = 3 o'clock, positive
23
+ * clockwise) — same as `WedgeSceneNode.startAngle/endAngle`. d3-shape
24
+ * uses 0 = 12 o'clock, so callers that pre-rotated by `+π/2` to call
25
+ * d3-arc should NOT pre-rotate when calling this helper.
26
+ */
27
+ export interface AnnularPathOptions {
28
+ innerRadius: number;
29
+ outerRadius: number;
30
+ startAngle: number;
31
+ endAngle: number;
32
+ cornerRadius?: number;
33
+ /** Round the side at startAngle (both inner + outer corners there). */
34
+ roundStart?: boolean;
35
+ /** Round the side at endAngle (both inner + outer corners there). */
36
+ roundEnd?: boolean;
37
+ }
38
+ /**
39
+ * Build the SVG path for an annular sector with per-end rounding.
40
+ *
41
+ * When `cornerRadius` is 0 or unset, OR neither `roundStart` nor
42
+ * `roundEnd` is true, the result is a plain unrounded sector — same
43
+ * shape `drawWedgeManual` would emit. When both ends are rounded with
44
+ * a single cornerRadius value, the output matches what d3-arc would
45
+ * produce. The novel case is mixed rounding: e.g. `roundStart: true,
46
+ * roundEnd: false` rounds only the gauge's leading edge.
47
+ *
48
+ * Defensive clamps:
49
+ * - `cornerRadius` is clamped to `(outerRadius - innerRadius) / 2`
50
+ * so the corner circles can't cross the ring's centerline (which
51
+ * would invert the inner radial line).
52
+ * - If the angular sweep is too small to fit two corner radii
53
+ * end-to-end on the requested side, that side falls back to
54
+ * unrounded so the path stays well-formed.
55
+ */
56
+ export declare function annularSectorPath(opts: AnnularPathOptions): string;
57
+ /**
58
+ * Build the clip outline + slice paths for a gauge gradient band.
59
+ *
60
+ * The band is rendered as one rounded annular sector used as a clip
61
+ * mask, with N unrounded slice sectors painted inside. Each slice
62
+ * extends from its own start angle out to the band's full end angle,
63
+ * so adjacent colors overpaint each other's trailing edge — eliminates
64
+ * subpixel AA gaps between slices without an explicit overlap epsilon
65
+ * and means the staircase reveals one color per `sliceAngle` of arc.
66
+ *
67
+ * Canvas and SVG renderers both consume this: canvas builds Path2D
68
+ * objects from the strings, SVG drops them straight into `<path d="…"/>`.
69
+ */
70
+ export interface GaugeGradientGeometryOptions {
71
+ innerRadius: number;
72
+ outerRadius: number;
73
+ startAngle: number;
74
+ endAngle: number;
75
+ cornerRadius?: number;
76
+ roundStart?: boolean;
77
+ roundEnd?: boolean;
78
+ colors: string[];
79
+ }
80
+ export interface GaugeGradientGeometry {
81
+ clipPath: string;
82
+ slices: {
83
+ d: string;
84
+ color: string;
85
+ }[];
86
+ }
87
+ export declare function buildGaugeGradientGeometry(opts: GaugeGradientGeometryOptions): GaugeGradientGeometry;
@@ -1,9 +1,10 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { ScaleLinear } from "d3-scale";
3
3
  import type { AnimateProp } from "./pipelineTransitionUtils";
4
- import type { LegendGroup, GradientLegendConfig } from "../types/legendTypes";
4
+ import type { LegendGroup, GradientLegendConfig, LegendLayout } from "../types/legendTypes";
5
5
  import type { ArrowOfTime, WindowMode, LineStyle, BarStyle, WaterfallStyle, SwarmStyle, HoverAnnotationConfig, HoverData, AnnotationContext, AnnotationAnchorMode } from "../realtime/types";
6
6
  import type { Datum } from "../charts/shared/datumTypes";
7
+ import type { CoercibleNumber } from "./accessorUtils";
7
8
  export type SceneDatum = Datum | null;
8
9
  export type SeriesDatum = Datum[] | null;
9
10
  export type AxisTickFormat = ((d: number, index?: number, allTicks?: number[]) => string) | ((d: string, index?: number, allTicks?: number[]) => string) | ((d: Date, index?: number, allTicks?: number[]) => string);
@@ -89,6 +90,10 @@ export interface Style {
89
90
  icon?: HTMLImageElement | HTMLCanvasElement;
90
91
  /** Padding between stamped icons */
91
92
  iconPadding?: number;
93
+ /** Optional radius when style callbacks drive point size directly. */
94
+ r?: number;
95
+ /** Internal geo line flag: fade line ends at projection clipping edges. */
96
+ _edgeFade?: boolean;
92
97
  }
93
98
  export type SceneNode = LineSceneNode | AreaSceneNode | PointSceneNode | RectSceneNode | HeatcellSceneNode | CandlestickSceneNode;
94
99
  export interface LineColorThreshold {
@@ -369,6 +374,86 @@ export interface StreamLayout {
369
374
  height: number;
370
375
  }
371
376
  export type CurveType = "linear" | "monotoneX" | "monotoneY" | "step" | "stepAfter" | "stepBefore" | "basis" | "cardinal" | "catmullRom" | "natural";
377
+ /**
378
+ * Asymmetric min/max envelope drawn under lines/areas. Data-driven cousin
379
+ * of `boundsAccessor` (which takes a single symmetric ±offset). Use for
380
+ * throughput min/max ribbons, percentile bands (p5–p95), SLO ranges, and
381
+ * fan charts (pass an array of bands).
382
+ *
383
+ * Painted with the parent series color at 0.2 fillOpacity by default.
384
+ * Override with `style`. Non-interactive by default; participates in
385
+ * y-extent auto-derivation so it can't clip.
386
+ */
387
+ export interface BandConfig<T = Datum> {
388
+ /** Bottom of the band — field name or accessor function. */
389
+ y0Accessor: string | ((d: T) => number);
390
+ /** Top of the band — field name or accessor function. */
391
+ y1Accessor: string | ((d: T) => number);
392
+ /**
393
+ * Style override. Defaults to the parent line/area color at 0.2
394
+ * fillOpacity, matching the `boundsStyle` cascade.
395
+ */
396
+ style?: Style | ((d: T, group?: string) => Style);
397
+ /**
398
+ * When the parent chart groups by `lineBy` / `colorBy`:
399
+ * - `true` (default): one band per group, colored to match the line
400
+ * - `false`: a single band drawn across the whole dataset (e.g. an
401
+ * aggregate min/max across all series)
402
+ */
403
+ perSeries?: boolean;
404
+ /**
405
+ * Whether the band area participates in hit testing. Defaults to
406
+ * `false` — the band is decorative; hover/click pass through to the
407
+ * line on top. Independent of the `datum.band` enrichment, which
408
+ * happens whenever a band is configured.
409
+ */
410
+ interactive?: boolean;
411
+ }
412
+ /**
413
+ * Per-axis configuration object for an XY frame's `axes: []` array.
414
+ * Distinct from `AxisConfig` exported from the HOC layer (which is the
415
+ * chart-level `xLabel` / `yLabel` / `xFormat` / `yFormat` bundle) —
416
+ * this type describes one axis at a time and is what
417
+ * `frameProps.axes[i]` consumes.
418
+ *
419
+ * Re-exported under the legacy name `AxisConfig` from `SVGOverlay.tsx`
420
+ * for backwards-compatibility with internal callers; new code should
421
+ * import this name directly.
422
+ */
423
+ export interface XYFrameAxisConfig {
424
+ orient: "left" | "right" | "top" | "bottom";
425
+ label?: string;
426
+ ticks?: number;
427
+ /** Per-axis tick label formatter. ReactNode return is supported and
428
+ * renders inside a `<foreignObject>`. */
429
+ tickFormat?: (d: any, index?: number, allTicks?: number[]) => string | ReactNode;
430
+ baseline?: boolean | "under";
431
+ jaggedBase?: boolean;
432
+ /** Explicit tick values. When provided, bypasses both d3's "nice"
433
+ * generator and `axisExtent: "exact"` — the caller has hand-picked
434
+ * the positions. Pixel-distance filtering downstream still drops
435
+ * overlapping labels. Mirrors the ordinal frame's `rTickValues`. */
436
+ tickValues?: Array<number | Date>;
437
+ /** Grid line stroke style: `"dashed"` (6,4), `"dotted"` (2,4), or a
438
+ * custom strokeDasharray string. Applied to grid lines extending
439
+ * from ticks across the chart area. */
440
+ gridStyle?: "dashed" | "dotted" | string;
441
+ /** Always include the domain max as a tick, even if d3 omits it. */
442
+ includeMax?: boolean;
443
+ /** Auto-rotate labels 45° when horizontal spacing is too tight. */
444
+ autoRotate?: boolean;
445
+ /** Highlight ticks at time boundaries (new month, year, etc.) with
446
+ * semibold text. `true` auto-detects Date boundaries. A function
447
+ * receives (value, index) and returns true for landmark ticks. */
448
+ landmarkTicks?: boolean | ((value: any, index: number) => boolean);
449
+ /** Tick label anchoring strategy:
450
+ * - `"middle"` (default): all tick labels centered on the tick mark
451
+ * - `"edges"`: first tick label anchors to start, last to end,
452
+ * middles stay centered. Pairs naturally with `axisExtent: "exact"`
453
+ * — pins the domain to the data min/max AND keeps the extreme
454
+ * labels from overflowing the plot. */
455
+ tickAnchor?: "middle" | "edges";
456
+ }
372
457
  export interface StreamXYFrameProps<T = Datum> {
373
458
  chartType: StreamChartType;
374
459
  runtimeMode?: RuntimeMode;
@@ -377,10 +462,10 @@ export interface StreamXYFrameProps<T = Datum> {
377
462
  chunkThreshold?: number;
378
463
  /** Number of items per progressive chunk (default 5000) */
379
464
  chunkSize?: number;
380
- xAccessor?: string | ((d: T) => number);
381
- yAccessor?: string | ((d: T) => number);
465
+ xAccessor?: string | ((d: T) => CoercibleNumber);
466
+ yAccessor?: string | ((d: T) => CoercibleNumber);
382
467
  colorAccessor?: string | ((d: T) => string);
383
- sizeAccessor?: string | ((d: T) => number);
468
+ sizeAccessor?: string | ((d: T) => CoercibleNumber);
384
469
  groupAccessor?: string | ((d: T) => string);
385
470
  lineDataAccessor?: string;
386
471
  curve?: CurveType;
@@ -445,6 +530,19 @@ export interface StreamXYFrameProps<T = Datum> {
445
530
  * If omitted, defaults to the line color at 0.2 opacity.
446
531
  */
447
532
  boundsStyle?: Style | ((d: T, group?: string) => Style);
533
+ /**
534
+ * Asymmetric min/max band(s) drawn under the line/area. Differs from
535
+ * `boundsAccessor` (which is a symmetric ±offset) and from `y0Accessor`
536
+ * (which replaces the area baseline). A band is a decorative envelope
537
+ * — painted under the lines, above the grid, non-interactive by default
538
+ * — driven by per-point `y0`/`y1` accessors.
539
+ *
540
+ * Pass an array for multi-band fan charts (e.g. p25/p75 inside p10/p90).
541
+ * Outer bands first; inner bands stack on top.
542
+ *
543
+ * Participates in y-extent auto-derivation when `yExtent` is not pinned.
544
+ */
545
+ band?: BandConfig<T> | Array<BandConfig<T>>;
448
546
  openAccessor?: string | ((d: T) => number);
449
547
  highAccessor?: string | ((d: T) => number);
450
548
  lowAccessor?: string | ((d: T) => number);
@@ -488,18 +586,13 @@ export interface StreamXYFrameProps<T = Datum> {
488
586
  barColors?: Record<string, string>;
489
587
  colorScheme?: string | string[];
490
588
  showAxes?: boolean;
491
- axes?: Array<{
492
- orient: "left" | "right" | "top" | "bottom";
493
- label?: string;
494
- ticks?: number;
495
- /** Explicit tick values. When provided, bypasses both d3's nice-tick
496
- * generator and `axisExtent`; pixel-distance filtering still drops
497
- * overlapping labels. Mirrors the ordinal frame's `rTickValues`. */
498
- tickValues?: Array<number | Date>;
499
- tickFormat?: AxisTickFormat;
500
- baseline?: boolean | "under";
501
- jaggedBase?: boolean;
502
- }>;
589
+ /**
590
+ * Per-axis config array. See `XYFrameAxisConfig` for the full set of
591
+ * fields — covers `tickValues`, `tickFormat`, `tickAnchor`,
592
+ * `landmarkTicks`, `autoRotate`, `gridStyle`, `includeMax`,
593
+ * `baseline`, `jaggedBase`, `label`, and `ticks`.
594
+ */
595
+ axes?: XYFrameAxisConfig[];
503
596
  xLabel?: string;
504
597
  yLabel?: string;
505
598
  /** Label for the right Y axis (dual-axis charts) */
@@ -558,6 +651,7 @@ export interface StreamXYFrameProps<T = Datum> {
558
651
  legendHighlightedCategory?: string | null;
559
652
  legendIsolatedCategories?: Set<string>;
560
653
  legendPosition?: "right" | "left" | "top" | "bottom";
654
+ legendLayout?: LegendLayout;
561
655
  /** Accessor used to report the current legend category domain in push mode. */
562
656
  legendCategoryAccessor?: string | ((d: T) => string);
563
657
  /** Fires when the current legend category domain changes after scene rebuilds. */
@@ -0,0 +1,20 @@
1
+ import type { AreaSceneNode } from "../types";
2
+ type ResolvedAreaGradient = NonNullable<AreaSceneNode["fillGradient"]>;
3
+ type OpacityGradient = {
4
+ topOpacity: number;
5
+ bottomOpacity: number;
6
+ };
7
+ type ColorStopGradient = {
8
+ colorStops: Array<{
9
+ offset: number;
10
+ color: string;
11
+ }>;
12
+ };
13
+ type OpacityGradientConfig = {
14
+ topOpacity?: number;
15
+ bottomOpacity?: number;
16
+ };
17
+ export type AreaGradientConfig = boolean | OpacityGradientConfig | ColorStopGradient;
18
+ export declare const DEFAULT_AREA_GRADIENT: OpacityGradient;
19
+ export declare function resolveAreaGradient(gradient: AreaGradientConfig | undefined): ResolvedAreaGradient | undefined;
20
+ export {};
@@ -9,10 +9,10 @@ import type { Datum } from "../../charts/shared/datumTypes";
9
9
  * Dependencies: BinAccumulator (computeBins), SceneGraph (buildRectNode)
10
10
  * Consumed by: PipelineStore.buildSceneNodes (chartType "bar")
11
11
  */
12
- import type { SceneNode } from "../types";
12
+ import type { RectSceneNode } from "../types";
13
13
  import type { XYSceneContext } from "./types";
14
14
  export interface BarSceneResult {
15
- nodes: SceneNode[];
15
+ nodes: RectSceneNode[];
16
16
  /** Sorted bin boundary values (edges of all bins) for data-driven brush snapping */
17
17
  binBoundaries: number[];
18
18
  }
@@ -6,6 +6,6 @@ import type { Datum } from "../../charts/shared/datumTypes";
6
6
  *
7
7
  * Consumed by: PipelineStore.buildSceneNodes (chartType "candlestick")
8
8
  */
9
- import type { SceneNode, StreamLayout } from "../types";
9
+ import type { CandlestickSceneNode, StreamLayout } from "../types";
10
10
  import type { XYSceneContext } from "./types";
11
- export declare function buildCandlestickScene(ctx: XYSceneContext, data: Datum[], _layout: StreamLayout): SceneNode[];
11
+ export declare function buildCandlestickScene(ctx: XYSceneContext, data: Datum[], _layout: StreamLayout): CandlestickSceneNode[];
@@ -1,4 +1,4 @@
1
1
  import type { Datum } from "../../charts/shared/datumTypes";
2
- import type { SceneNode, StreamLayout } from "../types";
2
+ import type { HeatcellSceneNode, StreamLayout } from "../types";
3
3
  import type { XYSceneContext } from "./types";
4
- export declare function buildHeatmapScene(ctx: XYSceneContext, data: Datum[], layout: StreamLayout): SceneNode[];
4
+ export declare function buildHeatmapScene(ctx: XYSceneContext, data: Datum[], layout: StreamLayout): HeatcellSceneNode[];
@@ -2,10 +2,11 @@ import type { Datum } from "../../charts/shared/datumTypes";
2
2
  /**
3
3
  * Line scene builder — produces LineSceneNode[] from grouped data.
4
4
  *
5
- * Handles: color thresholds from annotations, bounds/envelope areas,
6
- * and curve type attachment for canvas interpolation.
5
+ * Handles: color thresholds from annotations, ribbon envelopes
6
+ * (boundsAccessor + band), and curve type attachment for canvas
7
+ * interpolation.
7
8
  *
8
- * Dependencies: SceneGraph (buildLineNode), boundsScene (buildBoundsForGroup)
9
+ * Dependencies: SceneGraph (buildLineNode), ribbonScene (buildRibbon*)
9
10
  * Consumed by: PipelineStore.buildSceneNodes (chartType "line")
10
11
  */
11
12
  import type { SceneNode } from "../types";
@@ -8,6 +8,6 @@ import type { Datum } from "../../charts/shared/datumTypes";
8
8
  * Dependencies: SceneGraph (buildPointNode)
9
9
  * Consumed by: PipelineStore.buildSceneNodes (chartTypes "scatter", "bubble")
10
10
  */
11
- import type { SceneNode } from "../types";
11
+ import type { PointSceneNode } from "../types";
12
12
  import type { XYSceneContext } from "./types";
13
- export declare function buildPointScene(ctx: XYSceneContext, data: Datum[]): SceneNode[];
13
+ export declare function buildPointScene(ctx: XYSceneContext, data: Datum[]): PointSceneNode[];
@@ -0,0 +1,107 @@
1
+ import type { Datum } from "../../charts/shared/datumTypes";
2
+ /**
3
+ * Ribbon scene builder — the unified primitive for painting a closed
4
+ * top/bottom envelope underneath a line/area, used by:
5
+ *
6
+ * - `boundsAccessor` (symmetric ±offset around `yAccessor`)
7
+ * - `band` (asymmetric `y0Accessor` / `y1Accessor` per BandConfig, with
8
+ * multi-band fan support)
9
+ *
10
+ * Both public APIs normalize to `ResolvedRibbon[]` at the PipelineStore
11
+ * layer; the scene builders, y-extent expansion, and tooltip enrichment
12
+ * all read that single array.
13
+ *
14
+ * Consumed by: lineScene, areaScene, mixedScene (each renders ribbons
15
+ * before lines/areas so they sit underneath in z-order).
16
+ */
17
+ import type { AreaSceneNode, Style } from "../types";
18
+ import type { XYSceneContext } from "./types";
19
+ /**
20
+ * One ribbon worth of geometry + style. The PipelineStore owns the
21
+ * normalization from `boundsAccessor` and `band` public props into this
22
+ * single internal shape.
23
+ */
24
+ export interface ResolvedRibbon {
25
+ /**
26
+ * Origin of this ribbon:
27
+ * - `"bounds"`: produced by `boundsAccessor` (decorative-only)
28
+ * - `"band"`: produced by `band` (eligible for `datum.band` tooltip
29
+ * enrichment in the hover handler)
30
+ */
31
+ kind: "bounds" | "band";
32
+ /**
33
+ * Top y-value for each datum. Return `NaN` to skip a datum entirely
34
+ * (gap behavior). Bounds resolves this from `y + offset` (collapsing
35
+ * to `y` when offset is non-finite, matching legacy behavior); band
36
+ * resolves it from `y1Accessor`.
37
+ */
38
+ getTop: (d: Datum) => number;
39
+ /**
40
+ * Bottom y-value for each datum. Same gap semantics as `getTop`.
41
+ */
42
+ getBottom: (d: Datum) => number;
43
+ /**
44
+ * Style override. When omitted, the scene builder falls back to
45
+ * `ctx.resolveBoundsStyle(group, sampleDatum)` — line color at 0.2
46
+ * fillOpacity. Functions get the first datum and group key.
47
+ */
48
+ style?: Style | ((d: Datum, group?: string) => Style);
49
+ /**
50
+ * `true` → one ribbon per group, colored to match each line.
51
+ * `false` → a single aggregate ribbon across the whole dataset.
52
+ * Bounds is always `true`. Band defaults to `true`; the public
53
+ * `BandConfig.perSeries: false` opt-out flips this.
54
+ */
55
+ perSeries: boolean;
56
+ /**
57
+ * Whether the ribbon area participates in hit testing. Bounds is
58
+ * always `false`. Band defaults to `false` but supports `interactive: true`.
59
+ */
60
+ interactive: boolean;
61
+ }
62
+ /**
63
+ * Build a single ribbon scene node for one slice of data.
64
+ *
65
+ * Iterates the data once, evaluates `getTop`/`getBottom` per datum, and
66
+ * collects coordinate pairs. Any datum with non-finite x, top, or bottom
67
+ * is skipped (gap semantics — equivalent to `gapStrategy: "break"`).
68
+ * Returns `null` when fewer than two valid points remain (a single
69
+ * point can't form a visible ribbon).
70
+ */
71
+ export declare function buildRibbonForGroup(ctx: XYSceneContext, data: Datum[], group: string, ribbon: ResolvedRibbon): AreaSceneNode | null;
72
+ /**
73
+ * Split ribbons by `perSeries` so the caller can dispatch correctly:
74
+ * per-series ribbons render once per group; aggregate ribbons render
75
+ * once across the full dataset.
76
+ */
77
+ export declare function partitionRibbons(ribbons: ResolvedRibbon[] | undefined): {
78
+ perSeries: ResolvedRibbon[];
79
+ aggregate: ResolvedRibbon[];
80
+ };
81
+ /**
82
+ * Build all aggregate ribbons (perSeries=false) for the whole dataset.
83
+ * Each ribbon emits at most one AreaSceneNode under the synthetic
84
+ * group key `__ribbon_aggregate`.
85
+ */
86
+ export declare function buildAggregateRibbons(ctx: XYSceneContext, data: Datum[], ribbons: ResolvedRibbon[]): AreaSceneNode[];
87
+ /**
88
+ * Build all per-series ribbons for one grouped data slice. Each ribbon
89
+ * in the list emits at most one AreaSceneNode for the given group.
90
+ */
91
+ export declare function buildPerSeriesRibbons(ctx: XYSceneContext, data: Datum[], group: string, ribbons: ResolvedRibbon[]): AreaSceneNode[];
92
+ /**
93
+ * Enrich a hovered datum with band values so user tooltips can read
94
+ * `datum.band = { y0, y1 }` (first band) and `datum.bands = [...]`
95
+ * (all bands). Returns a shallow copy so the original data row is
96
+ * never mutated.
97
+ *
98
+ * Bounds-sourced ribbons (`kind: "bounds"`) are intentionally excluded
99
+ * — they're decorative, and the tooltip enrichment contract is
100
+ * band-only. Returns the input datum unchanged when no band-kind
101
+ * ribbons are configured or none produce finite values at this datum.
102
+ *
103
+ * Consumed by every code path that produces a `HoverData` in
104
+ * StreamXYFrame: pointer hover, multi-mode per-series datum, and
105
+ * keyboard navigation.
106
+ */
107
+ export declare function enrichDatumWithBand(datum: Datum | null | undefined, ribbons: ResolvedRibbon[] | undefined): Datum;
@@ -6,6 +6,6 @@ import type { Datum } from "../../charts/shared/datumTypes";
6
6
  *
7
7
  * Consumed by: PipelineStore.buildSceneNodes (chartType "swarm")
8
8
  */
9
- import type { SceneNode } from "../types";
9
+ import type { PointSceneNode } from "../types";
10
10
  import type { XYSceneContext } from "./types";
11
- export declare function buildSwarmScene(ctx: XYSceneContext, data: Datum[]): SceneNode[];
11
+ export declare function buildSwarmScene(ctx: XYSceneContext, data: Datum[]): PointSceneNode[];
@@ -1,4 +1,5 @@
1
1
  import type { Datum } from "../../charts/shared/datumTypes";
2
+ import type { AreaGradientConfig } from "./areaGradient";
2
3
  /**
3
4
  * XYSceneContext — shared context passed to all XY scene builder functions.
4
5
  *
@@ -7,6 +8,7 @@ import type { Datum } from "../../charts/shared/datumTypes";
7
8
  * accessing PipelineStore instance fields directly.
8
9
  */
9
10
  import type { StreamScales, Style, CurveType, BarStyle, ThemeSemanticColors } from "../types";
11
+ import type { ResolvedRibbon } from "./ribbonScene";
10
12
  export interface XYSceneContext {
11
13
  scales: StreamScales;
12
14
  config: XYSceneConfig;
@@ -18,7 +20,10 @@ export interface XYSceneContext {
18
20
  getGroup?: (d: Datum) => string;
19
21
  getCategory?: (d: Datum) => string;
20
22
  getPointId?: (d: Datum) => string;
21
- getBounds?: (d: Datum) => number | null;
23
+ /** Resolved ribbons unified list from `boundsAccessor` + `band`. The
24
+ * scene builders iterate this once instead of carrying two parallel
25
+ * code paths. Empty when neither prop is set. */
26
+ ribbons?: ResolvedRibbon[];
22
27
  getOpen?: (d: Datum) => number;
23
28
  getHigh?: (d: Datum) => number;
24
29
  getLow?: (d: Datum) => number;
@@ -42,7 +47,7 @@ export interface XYSceneContext {
42
47
  }
43
48
  /** Subset of PipelineConfig fields that scene builders need */
44
49
  export interface XYSceneConfig {
45
- chartType: string;
50
+ chartType?: string;
46
51
  curve?: CurveType;
47
52
  colorScheme?: string | string[];
48
53
  normalize?: boolean;
@@ -50,15 +55,7 @@ export interface XYSceneConfig {
50
55
  baseline?: "zero" | "wiggle" | "silhouette";
51
56
  /** Stack order — see PipelineConfig.stackOrder. */
52
57
  stackOrder?: "key" | "insideOut" | "asc" | "desc";
53
- gradientFill?: boolean | {
54
- topOpacity?: number;
55
- bottomOpacity?: number;
56
- } | {
57
- colorStops: Array<{
58
- offset: number;
59
- color: string;
60
- }>;
61
- };
58
+ gradientFill?: AreaGradientConfig;
62
59
  areaGroups?: Set<string>;
63
60
  lineGradient?: {
64
61
  colorStops: Array<{
@@ -83,7 +80,7 @@ export interface XYSceneConfig {
83
80
  barColors?: Record<string, string>;
84
81
  /** Bar fill/stroke/strokeWidth/gap. Threaded through from RealtimeHistogram. */
85
82
  barStyle?: BarStyle;
86
- themeSemantic?: ThemeSemanticColors;
83
+ themeSemantic?: Partial<ThemeSemanticColors>;
87
84
  /** Theme sequential scheme name — fallback when colorScheme is not set (heatmap). */
88
85
  themeSequential?: string;
89
86
  /** Theme diverging scheme name — fallback when colorScheme is not set. */
@@ -8,6 +8,6 @@
8
8
  * Consumed by: PipelineStore.buildSceneNodes (chartType "waterfall")
9
9
  */
10
10
  import type { Datum } from "../../charts/shared/datumTypes";
11
- import type { SceneNode, StreamLayout } from "../types";
11
+ import type { RectSceneNode, StreamLayout } from "../types";
12
12
  import type { XYSceneContext } from "./types";
13
- export declare function buildWaterfallScene(ctx: XYSceneContext, data: Datum[], layout: StreamLayout): SceneNode[];
13
+ export declare function buildWaterfallScene(ctx: XYSceneContext, data: Datum[], layout: StreamLayout): RectSceneNode[];
@@ -31,6 +31,20 @@ export declare function isLegendConfig(value: unknown): value is {
31
31
  export declare function isGradientLegendConfig(value: unknown): value is {
32
32
  gradient: GradientLegendConfig;
33
33
  };
34
+ export interface LegendLayout {
35
+ /** Horizontal alignment for top/bottom legends within the plot width */
36
+ align?: "start" | "center" | "end" | "left" | "right";
37
+ /** Width/height of categorical swatches in pixels */
38
+ swatchSize?: number;
39
+ /** Gap between a swatch and its label in pixels */
40
+ labelGap?: number;
41
+ /** Gap between horizontal legend items in pixels */
42
+ itemGap?: number;
43
+ /** Vertical row height for stacked legend items in pixels */
44
+ rowHeight?: number;
45
+ /** Override the alignment width used for top/bottom legends */
46
+ maxWidth?: number;
47
+ }
34
48
  export interface LegendProps {
35
49
  legendGroups?: LegendGroup[];
36
50
  customClickBehavior?: (item: LegendItem) => void;
@@ -46,4 +60,5 @@ export interface LegendProps {
46
60
  height?: number;
47
61
  orientation?: string;
48
62
  position?: "left" | "right";
63
+ legendLayout?: LegendLayout;
49
64
  }