semiotic 3.5.0 → 3.5.2

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 (105) hide show
  1. package/CLAUDE.md +21 -19
  2. package/README.md +22 -16
  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 +900 -1
  8. package/ai/system-prompt.md +4 -1
  9. package/dist/components/Tooltip/FlippingTooltip.d.ts +16 -1
  10. package/dist/components/charts/geo/FlowMap.d.ts +13 -4
  11. package/dist/components/charts/index.d.ts +6 -0
  12. package/dist/components/charts/network/OrbitDiagram.d.ts +5 -5
  13. package/dist/components/charts/network/ProcessSankey.d.ts +141 -0
  14. package/dist/components/charts/network/processSankey/algorithm.d.ts +136 -0
  15. package/dist/components/charts/network/processSankey/buildScenes.d.ts +45 -0
  16. package/dist/components/charts/network/processSankey/ribbonInputs.d.ts +32 -0
  17. package/dist/components/charts/network/processSankey/streamingLayout.d.ts +58 -0
  18. package/dist/components/charts/network/processSankey/tooltipUtils.d.ts +41 -0
  19. package/dist/components/charts/ordinal/BarChart.d.ts +14 -0
  20. package/dist/components/charts/ordinal/BoxPlot.d.ts +2 -0
  21. package/dist/components/charts/ordinal/DotPlot.d.ts +11 -0
  22. package/dist/components/charts/ordinal/GaugeChart.d.ts +20 -0
  23. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +2 -0
  24. package/dist/components/charts/ordinal/Histogram.d.ts +2 -0
  25. package/dist/components/charts/ordinal/LikertChart.d.ts +2 -0
  26. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +2 -0
  27. package/dist/components/charts/ordinal/StackedBarChart.d.ts +2 -0
  28. package/dist/components/charts/ordinal/SwarmPlot.d.ts +2 -0
  29. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +7 -0
  30. package/dist/components/charts/ordinal/ViolinPlot.d.ts +2 -0
  31. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +14 -11
  32. package/dist/components/charts/realtime/defaultRealtimeTooltip.d.ts +43 -0
  33. package/dist/components/charts/shared/axisExtent.d.ts +59 -0
  34. package/dist/components/charts/shared/chartSpecs.d.ts +75 -0
  35. package/dist/components/charts/shared/colorUtils.d.ts +8 -2
  36. package/dist/components/charts/shared/networkUtils.d.ts +3 -5
  37. package/dist/components/charts/shared/radialGeometry.d.ts +99 -0
  38. package/dist/components/charts/shared/regressionUtils.d.ts +59 -0
  39. package/dist/components/charts/shared/selectionUtils.d.ts +8 -1
  40. package/dist/components/charts/shared/streamPropsHelpers.d.ts +5 -0
  41. package/dist/components/charts/shared/types.d.ts +13 -0
  42. package/dist/components/charts/shared/useAreaSeriesSetup.d.ts +75 -0
  43. package/dist/components/charts/shared/useEncodingDomain.d.ts +48 -0
  44. package/dist/components/charts/shared/useFrameImperativeHandle.d.ts +1 -1
  45. package/dist/components/charts/shared/useNetworkChartSetup.d.ts +148 -0
  46. package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +87 -0
  47. package/dist/components/charts/shared/useSeriesFeatures.d.ts +57 -0
  48. package/dist/components/charts/shared/useStreamStatus.d.ts +33 -0
  49. package/dist/components/charts/shared/useXYLineStyle.d.ts +69 -0
  50. package/dist/components/charts/shared/useXYPointStyle.d.ts +87 -0
  51. package/dist/components/charts/xy/AreaChart.d.ts +38 -0
  52. package/dist/components/charts/xy/BubbleChart.d.ts +13 -0
  53. package/dist/components/charts/xy/CandlestickChart.d.ts +4 -0
  54. package/dist/components/charts/xy/ConnectedScatterplot.d.ts +20 -0
  55. package/dist/components/charts/xy/DifferenceChart.d.ts +172 -0
  56. package/dist/components/charts/xy/Heatmap.d.ts +4 -0
  57. package/dist/components/charts/xy/LineChart.d.ts +12 -0
  58. package/dist/components/charts/xy/MinimapChart.d.ts +7 -0
  59. package/dist/components/charts/xy/Scatterplot.d.ts +38 -0
  60. package/dist/components/charts/xy/StackedAreaChart.d.ts +12 -0
  61. package/dist/components/geometry/ribbonGeometry.d.ts +76 -0
  62. package/dist/components/semiotic-ai.d.ts +2 -0
  63. package/dist/components/semiotic-network.d.ts +4 -0
  64. package/dist/components/semiotic-realtime.d.ts +2 -0
  65. package/dist/components/semiotic-utils.d.ts +4 -0
  66. package/dist/components/semiotic-xy.d.ts +2 -0
  67. package/dist/components/semiotic.d.ts +3 -3
  68. package/dist/components/server/serverChartConfigs.d.ts +2 -0
  69. package/dist/components/stream/GeoPipelineStore.d.ts +21 -0
  70. package/dist/components/stream/OrdinalSVGOverlay.d.ts +8 -0
  71. package/dist/components/stream/PipelineStore.d.ts +5 -0
  72. package/dist/components/stream/SVGOverlay.d.ts +18 -0
  73. package/dist/components/stream/annotationAccessorResolver.d.ts +39 -0
  74. package/dist/components/stream/geoTypes.d.ts +12 -0
  75. package/dist/components/stream/ordinalTypes.d.ts +12 -0
  76. package/dist/components/stream/renderers/cornerRadii.d.ts +33 -0
  77. package/dist/components/stream/types.d.ts +23 -0
  78. package/dist/components/types/legendTypes.d.ts +1 -1
  79. package/dist/geo.min.js +1 -1
  80. package/dist/geo.module.min.js +1 -1
  81. package/dist/network.min.js +1 -1
  82. package/dist/network.module.min.js +1 -1
  83. package/dist/ordinal.min.js +1 -1
  84. package/dist/ordinal.module.min.js +1 -1
  85. package/dist/realtime.min.js +1 -1
  86. package/dist/realtime.module.min.js +1 -1
  87. package/dist/semiotic-ai.d.ts +2 -0
  88. package/dist/semiotic-ai.min.js +1 -1
  89. package/dist/semiotic-ai.module.min.js +1 -1
  90. package/dist/semiotic-network.d.ts +4 -0
  91. package/dist/semiotic-realtime.d.ts +2 -0
  92. package/dist/semiotic-recipes.min.js +1 -1
  93. package/dist/semiotic-recipes.module.min.js +1 -1
  94. package/dist/semiotic-utils.d.ts +4 -0
  95. package/dist/semiotic-utils.min.js +1 -1
  96. package/dist/semiotic-utils.module.min.js +1 -1
  97. package/dist/semiotic-xy.d.ts +2 -0
  98. package/dist/semiotic.d.ts +3 -3
  99. package/dist/semiotic.min.js +1 -1
  100. package/dist/semiotic.module.min.js +1 -1
  101. package/dist/server.min.js +1 -1
  102. package/dist/server.module.min.js +1 -1
  103. package/dist/xy.min.js +1 -1
  104. package/dist/xy.module.min.js +1 -1
  105. package/package.json +10 -5
@@ -10,6 +10,17 @@ export interface AxisConfig {
10
10
  tickFormat?: (d: any, index?: number, allTicks?: number[]) => string | ReactNode;
11
11
  baseline?: boolean | "under";
12
12
  jaggedBase?: boolean;
13
+ /** Explicit tick values. When provided, bypasses both d3's "nice"
14
+ * generator and `axisExtent: "exact"` — the caller has hand-picked
15
+ * the positions. Pixel-distance filtering downstream still drops
16
+ * overlapping labels. Accepts `number | Date`: values pass through
17
+ * to the scale (d3-scale's `scaleTime` reads Dates natively;
18
+ * `scaleLinear` accepts numbers — feeding a Date into a linear
19
+ * scale via `valueOf()` works at runtime but `tickFormat` receives
20
+ * the Date as-is, so user formatters should match the axis's
21
+ * underlying scale type). Mirrors the ordinal frame's
22
+ * `rTickValues` contract. */
23
+ tickValues?: Array<number | Date>;
13
24
  /** Grid line stroke style: "dashed" (6,4), "dotted" (2,4), or a custom strokeDasharray string. Applied to grid lines extending from ticks across the chart area. */
14
25
  gridStyle?: "dashed" | "dotted" | string;
15
26
  /** Always include the domain max as a tick, even if d3 omits it. */
@@ -40,6 +51,12 @@ interface SVGOverlayProps {
40
51
  yLabelRight?: string;
41
52
  xFormat?: (d: number | Date | string, index?: number, allTicks?: number[]) => string | ReactNode;
42
53
  yFormat?: (d: number | Date | string) => string | ReactNode;
54
+ /** Axis extent mode. "nice" (default) uses d3-scale's rounded
55
+ * tick generator — labels stay round but the first/last tick
56
+ * may sit inside the data domain. "exact" pins the first and
57
+ * last tick to the actual data min and max with equidistant
58
+ * intermediate ticks. Applies to both x and y axes. */
59
+ axisExtent?: import("../charts/shared/axisExtent").AxisExtentMode;
43
60
  showGrid?: boolean;
44
61
  title?: string | ReactNode;
45
62
  legend?: ReactNode | {
@@ -116,6 +133,7 @@ interface SVGUnderlayProps {
116
133
  showGrid?: boolean;
117
134
  xFormat?: (d: number | Date | string, index?: number, allTicks?: number[]) => string | ReactNode;
118
135
  yFormat?: (d: number | Date | string) => string | ReactNode;
136
+ axisExtent?: import("../charts/shared/axisExtent").AxisExtentMode;
119
137
  }
120
138
  export declare function SVGUnderlay(props: SVGUnderlayProps): import("react/jsx-runtime").JSX.Element | null;
121
139
  export declare function SVGOverlay(props: SVGOverlayProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Annotation-context accessors must be string keys — SVG overlay
3
+ * rules look up coordinates with `data[xAccessor]`. When a chart's
4
+ * user accessor is a function, we bake the resolved value under a
5
+ * synthetic stable key on each annotation datum and forward the
6
+ * synthetic key as the annotation's xAccessor / yAccessor.
7
+ *
8
+ * Originally inline in `StreamXYFrame.tsx`; lifted here so
9
+ * `StreamOrdinalFrame` (and any future frame with the same need)
10
+ * can share the same plumbing rather than re-implementing it.
11
+ */
12
+ import type { Datum } from "../charts/shared/datumTypes";
13
+ export interface ResolvedAnnotationAccessor {
14
+ /** String key the annotation context will read on each datum. */
15
+ key: string | undefined;
16
+ /** Accessor function when the user supplied one (synthetic key
17
+ * gets baked from this); `null` when the user supplied a string
18
+ * or nothing. */
19
+ fn: ((d: Datum) => any) | null;
20
+ }
21
+ /**
22
+ * Resolve an accessor pair to the (key, fn) shape the annotation
23
+ * pipeline needs. Probes the primary accessor first, then the
24
+ * fallback (e.g. `valueAccessor` when no `yAccessor` was supplied).
25
+ *
26
+ * - String accessor → use it as the key, no enrichment needed.
27
+ * - Function accessor → use the synthetic resolved-key, run the fn
28
+ * per-datum to bake the value.
29
+ * - Otherwise undefined.
30
+ */
31
+ export declare function resolveAnnotationAccessor(primary: unknown, fallback: unknown, resolvedKey: string, fallbackKey: string): ResolvedAnnotationAccessor;
32
+ /**
33
+ * Build an `enrichAnnotationData(rawData)` function that walks the
34
+ * data array and bakes synthetic-key values for any function
35
+ * accessors. Returns the original array reference unchanged when no
36
+ * enrichment is needed (no annotations, no function accessors, or
37
+ * synthetic keys already present).
38
+ */
39
+ export declare function buildEnrichAnnotationData(xResolved: ResolvedAnnotationAccessor, yResolved: ResolvedAnnotationAccessor, hasAnnotations: boolean): (rawData: Datum[] | undefined) => Datum[] | undefined;
@@ -95,6 +95,8 @@ export interface GeoPipelineConfig {
95
95
  introAnimation?: boolean;
96
96
  annotations?: Datum[];
97
97
  pointIdAccessor?: string | ((d: Datum) => string);
98
+ /** ID accessor on line data — required for `removeLine` by id. */
99
+ lineIdAccessor?: string | ((d: Datum) => string);
98
100
  }
99
101
  export interface StreamGeoFrameProps<T = Datum> {
100
102
  projection: ProjectionProp;
@@ -108,6 +110,8 @@ export interface StreamGeoFrameProps<T = Datum> {
108
110
  yAccessor?: string | ((d: T) => number);
109
111
  lineDataAccessor?: string | ((d: T) => Datum[]);
110
112
  pointIdAccessor?: string | ((d: T) => string);
113
+ /** ID accessor on line data — required for ref `removeLine` by id. */
114
+ lineIdAccessor?: string | ((d: T) => string);
111
115
  lineType?: "geo" | "line";
112
116
  /** Flow rendering style: "basic" (straight/great-circle), "offset" (bidirectional offset), "arc" (curved arcs) @default "basic" */
113
117
  flowStyle?: "basic" | "offset" | "arc";
@@ -212,6 +216,14 @@ export interface StreamGeoFrameHandle {
212
216
  pushMany(data: Datum[]): void;
213
217
  /** Remove points by ID. Requires pointIdAccessor. */
214
218
  removePoint(id: string | string[]): Datum[];
219
+ /** Append a single line/flow record. Coordinates pre-resolved per `lineDataAccessor`. */
220
+ pushLine(line: Datum): void;
221
+ /** Append multiple line/flow records in one batch. */
222
+ pushManyLines(lines: Datum[]): void;
223
+ /** Remove lines by ID. Requires `lineIdAccessor`. */
224
+ removeLine(id: string | string[]): Datum[];
225
+ /** Read the current line/flow set. */
226
+ getLines(): Datum[];
215
227
  clear(): void;
216
228
  getProjection(): GeoProjection | null;
217
229
  getGeoPath(): GeoPath<any, GeoPermissibleObjects> | null;
@@ -156,6 +156,11 @@ export interface OrdinalPipelineConfig {
156
156
  windowSize: number;
157
157
  windowMode: WindowMode;
158
158
  extentPadding: number;
159
+ /** When `"exact"`, the value-axis domain is pinned to the literal data
160
+ * min/max — `extentPadding` is skipped so the first and last ticks
161
+ * land on the actual data bounds. Default `"nice"` keeps the existing
162
+ * padded domain so symbols at the extremes don't clip the plot edge. */
163
+ axisExtent?: import("../charts/shared/axisExtent").AxisExtentMode;
159
164
  projection: "vertical" | "horizontal" | "radial";
160
165
  categoryAccessor?: string | ((d: Datum) => string);
161
166
  valueAccessor?: string | ((d: Datum) => number) | Array<string | ((d: Datum) => number)>;
@@ -315,6 +320,13 @@ export interface StreamOrdinalFrameProps<T = Datum> {
315
320
  rTickValues?: number[];
316
321
  /** Align first tick label to start and last tick label to end. Default false. */
317
322
  tickLabelEdgeAlign?: boolean;
323
+ /** Axis extent mode for the value (r) axis. `"nice"` (default) uses
324
+ * d3-scale's rounded tick generator. `"exact"` pins the first and
325
+ * last tick to the actual data min and max with equidistant
326
+ * intermediate ticks. The categorical (o) axis is unaffected since
327
+ * it's a band scale, not a continuous one. Ignored when explicit
328
+ * `rTickValues` are provided — caller has hand-picked positions. */
329
+ axisExtent?: import("../charts/shared/axisExtent").AxisExtentMode;
318
330
  pieceStyle?: (d: Datum, category?: string) => Style;
319
331
  summaryStyle?: (d: Datum, category?: string) => Style;
320
332
  colorScheme?: string | string[];
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Per-corner radius utilities shared between the canvas (`barCanvasRenderer`)
3
+ * and SVG (`SceneToSVG`) paint paths.
4
+ *
5
+ * Both paths previously carried the same `hasAnyCornerRadius` predicate
6
+ * and the same `min(radius, w/2, h/2)` clamp inline. Splitting them by
7
+ * renderer left two near-identical implementations that drifted in
8
+ * comments more than once; centralizing here keeps the swimlane rounding
9
+ * contract — and any future per-corner shape (cards, tab corners,
10
+ * partial-stack rounding) — in one place.
11
+ *
12
+ * The actual path-tracing primitives (canvas `arcTo` vs SVG `A`) stay in
13
+ * each renderer because their output formats differ — this module owns
14
+ * the geometry, the renderers own the drawing language.
15
+ */
16
+ import type { RectSceneNode } from "../types";
17
+ /** True when at least one corner has a positive radius. */
18
+ export declare function hasAnyCornerRadius(c: NonNullable<RectSceneNode["cornerRadii"]>): boolean;
19
+ export interface ClampedCornerRadii {
20
+ tl: number;
21
+ tr: number;
22
+ br: number;
23
+ bl: number;
24
+ }
25
+ /**
26
+ * Read each corner's radius and clamp to `[0, min(w, h) / 2]` so a
27
+ * corner never overdraws past the rect's center on thin lanes AND a
28
+ * negative input never leaks into the `moveTo` / `lineTo` math (where
29
+ * a negative radius would offset the start point into invalid space,
30
+ * producing visibly bent or escaping paths even though the `arcTo`
31
+ * is gated on `> 0`). Missing corners collapse to 0 (square).
32
+ */
33
+ export declare function clampCornerRadii(node: RectSceneNode): ClampedCornerRadii;
@@ -227,6 +227,19 @@ export interface RectSceneNode {
227
227
  * bar scene builders unconditionally so gradients resolve without
228
228
  * requiring roundedTop. */
229
229
  roundedEdge?: "top" | "bottom" | "right" | "left";
230
+ /** Explicit per-corner radii. Overrides the `roundedTop` + `roundedEdge`
231
+ * shortcut when present. Used by swimlanes (and any future chart that
232
+ * needs to round arbitrary subsets of a rect's four corners) — the
233
+ * outermost pieces of a lane round their leading/trailing corners and
234
+ * middle pieces stay square. Keys map to physical corners: `tl`
235
+ * top-left, `tr` top-right, `br` bottom-right, `bl` bottom-left.
236
+ * Missing keys are treated as 0 (square). */
237
+ cornerRadii?: {
238
+ tl?: number;
239
+ tr?: number;
240
+ br?: number;
241
+ bl?: number;
242
+ };
230
243
  /** Gradient fill — same shape as the area-scene version. Runs tip → base
231
244
  * along the bar axis (inferred from `roundedEdge`). */
232
245
  fillGradient?: {
@@ -479,6 +492,10 @@ export interface StreamXYFrameProps<T = Datum> {
479
492
  orient: "left" | "right" | "top" | "bottom";
480
493
  label?: string;
481
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>;
482
499
  tickFormat?: AxisTickFormat;
483
500
  baseline?: boolean | "under";
484
501
  jaggedBase?: boolean;
@@ -489,6 +506,12 @@ export interface StreamXYFrameProps<T = Datum> {
489
506
  yLabelRight?: string;
490
507
  xFormat?: (d: number | Date | string, index?: number, allTicks?: number[]) => string | ReactNode;
491
508
  yFormat?: (d: number | Date | string) => string | ReactNode;
509
+ /** Axis extent mode. `"nice"` (default) uses d3-scale's rounded
510
+ * tick generator — round tick labels at the cost of ticks not
511
+ * reaching the exact data min/max. `"exact"` pins the first
512
+ * and last tick to the data domain and spaces intermediate
513
+ * ticks equidistantly. Applies to both x and y axes. */
514
+ axisExtent?: import("../charts/shared/axisExtent").AxisExtentMode;
492
515
  tickFormatTime?: (value: number) => string;
493
516
  tickFormatValue?: (value: number) => string;
494
517
  hoverAnnotation?: boolean | HoverAnnotationConfig;
@@ -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;