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
@@ -4,6 +4,7 @@ import type { AnimateProp } from "./pipelineTransitionUtils";
4
4
  import type { LegendGroup, GradientLegendConfig } 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 {
@@ -227,6 +232,19 @@ export interface RectSceneNode {
227
232
  * bar scene builders unconditionally so gradients resolve without
228
233
  * requiring roundedTop. */
229
234
  roundedEdge?: "top" | "bottom" | "right" | "left";
235
+ /** Explicit per-corner radii. Overrides the `roundedTop` + `roundedEdge`
236
+ * shortcut when present. Used by swimlanes (and any future chart that
237
+ * needs to round arbitrary subsets of a rect's four corners) — the
238
+ * outermost pieces of a lane round their leading/trailing corners and
239
+ * middle pieces stay square. Keys map to physical corners: `tl`
240
+ * top-left, `tr` top-right, `br` bottom-right, `bl` bottom-left.
241
+ * Missing keys are treated as 0 (square). */
242
+ cornerRadii?: {
243
+ tl?: number;
244
+ tr?: number;
245
+ br?: number;
246
+ bl?: number;
247
+ };
230
248
  /** Gradient fill — same shape as the area-scene version. Runs tip → base
231
249
  * along the bar axis (inferred from `roundedEdge`). */
232
250
  fillGradient?: {
@@ -356,6 +374,86 @@ export interface StreamLayout {
356
374
  height: number;
357
375
  }
358
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
+ }
359
457
  export interface StreamXYFrameProps<T = Datum> {
360
458
  chartType: StreamChartType;
361
459
  runtimeMode?: RuntimeMode;
@@ -364,10 +462,10 @@ export interface StreamXYFrameProps<T = Datum> {
364
462
  chunkThreshold?: number;
365
463
  /** Number of items per progressive chunk (default 5000) */
366
464
  chunkSize?: number;
367
- xAccessor?: string | ((d: T) => number);
368
- yAccessor?: string | ((d: T) => number);
465
+ xAccessor?: string | ((d: T) => CoercibleNumber);
466
+ yAccessor?: string | ((d: T) => CoercibleNumber);
369
467
  colorAccessor?: string | ((d: T) => string);
370
- sizeAccessor?: string | ((d: T) => number);
468
+ sizeAccessor?: string | ((d: T) => CoercibleNumber);
371
469
  groupAccessor?: string | ((d: T) => string);
372
470
  lineDataAccessor?: string;
373
471
  curve?: CurveType;
@@ -432,6 +530,19 @@ export interface StreamXYFrameProps<T = Datum> {
432
530
  * If omitted, defaults to the line color at 0.2 opacity.
433
531
  */
434
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>>;
435
546
  openAccessor?: string | ((d: T) => number);
436
547
  highAccessor?: string | ((d: T) => number);
437
548
  lowAccessor?: string | ((d: T) => number);
@@ -475,20 +586,25 @@ export interface StreamXYFrameProps<T = Datum> {
475
586
  barColors?: Record<string, string>;
476
587
  colorScheme?: string | string[];
477
588
  showAxes?: boolean;
478
- axes?: Array<{
479
- orient: "left" | "right" | "top" | "bottom";
480
- label?: string;
481
- ticks?: number;
482
- tickFormat?: AxisTickFormat;
483
- baseline?: boolean | "under";
484
- jaggedBase?: boolean;
485
- }>;
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[];
486
596
  xLabel?: string;
487
597
  yLabel?: string;
488
598
  /** Label for the right Y axis (dual-axis charts) */
489
599
  yLabelRight?: string;
490
600
  xFormat?: (d: number | Date | string, index?: number, allTicks?: number[]) => string | ReactNode;
491
601
  yFormat?: (d: number | Date | string) => string | ReactNode;
602
+ /** Axis extent mode. `"nice"` (default) uses d3-scale's rounded
603
+ * tick generator — round tick labels at the cost of ticks not
604
+ * reaching the exact data min/max. `"exact"` pins the first
605
+ * and last tick to the data domain and spaces intermediate
606
+ * ticks equidistantly. Applies to both x and y axes. */
607
+ axisExtent?: import("../charts/shared/axisExtent").AxisExtentMode;
492
608
  tickFormatTime?: (value: number) => string;
493
609
  tickFormatValue?: (value: number) => string;
494
610
  hoverAnnotation?: boolean | HoverAnnotationConfig;
@@ -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[];
@@ -41,7 +41,7 @@ export interface LegendProps {
41
41
  highlightedCategory?: string | null;
42
42
  /** Legend interaction mode — used to set aria-multiselectable on the listbox */
43
43
  legendInteraction?: string;
44
- title?: string;
44
+ title?: string | boolean;
45
45
  width?: number;
46
46
  height?: number;
47
47
  orientation?: string;