semiotic 3.4.2 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/CLAUDE.md +114 -9
  2. package/README.md +45 -4
  3. package/ai/behaviorContracts.cjs +311 -0
  4. package/ai/chartSuggestions.cjs +291 -0
  5. package/ai/cli.js +255 -30
  6. package/ai/componentMetadata.cjs +107 -0
  7. package/ai/dist/mcp-server.js +907 -227
  8. package/ai/schema.json +3954 -2537
  9. package/ai/system-prompt.md +23 -4
  10. package/dist/components/LinkedCharts.d.ts +5 -1
  11. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  12. package/dist/components/charts/custom/NetworkCustomChart.d.ts +64 -0
  13. package/dist/components/charts/custom/OrdinalCustomChart.d.ts +71 -0
  14. package/dist/components/charts/custom/XYCustomChart.d.ts +59 -0
  15. package/dist/components/charts/geo/ChoroplethMap.d.ts +93 -2
  16. package/dist/components/charts/geo/DistanceCartogram.d.ts +51 -4
  17. package/dist/components/charts/geo/FlowMap.d.ts +55 -0
  18. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +53 -0
  19. package/dist/components/charts/index.d.ts +6 -0
  20. package/dist/components/charts/network/ChordDiagram.d.ts +34 -2
  21. package/dist/components/charts/network/CirclePack.d.ts +36 -1
  22. package/dist/components/charts/network/ForceDirectedGraph.d.ts +130 -2
  23. package/dist/components/charts/network/OrbitDiagram.d.ts +37 -0
  24. package/dist/components/charts/network/SankeyDiagram.d.ts +51 -2
  25. package/dist/components/charts/network/TreeDiagram.d.ts +37 -2
  26. package/dist/components/charts/network/Treemap.d.ts +36 -2
  27. package/dist/components/charts/ordinal/BarChart.d.ts +111 -1
  28. package/dist/components/charts/ordinal/BoxPlot.d.ts +31 -0
  29. package/dist/components/charts/ordinal/DonutChart.d.ts +36 -0
  30. package/dist/components/charts/ordinal/DotPlot.d.ts +31 -0
  31. package/dist/components/charts/ordinal/FunnelChart.d.ts +40 -0
  32. package/dist/components/charts/ordinal/GaugeChart.d.ts +45 -0
  33. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +38 -0
  34. package/dist/components/charts/ordinal/Histogram.d.ts +95 -0
  35. package/dist/components/charts/ordinal/LikertChart.d.ts +42 -0
  36. package/dist/components/charts/ordinal/PieChart.d.ts +90 -1
  37. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +27 -0
  38. package/dist/components/charts/ordinal/StackedBarChart.d.ts +38 -0
  39. package/dist/components/charts/ordinal/SwarmPlot.d.ts +36 -0
  40. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +60 -0
  41. package/dist/components/charts/ordinal/ViolinPlot.d.ts +32 -0
  42. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +22 -4
  43. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +5 -2
  44. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +24 -3
  45. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +12 -0
  46. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +14 -0
  47. package/dist/components/charts/realtime/defaultRealtimeTooltip.d.ts +43 -0
  48. package/dist/components/charts/realtime/resolveWindowSize.d.ts +26 -0
  49. package/dist/components/charts/shared/chartSpecs.d.ts +91 -0
  50. package/dist/components/charts/shared/colorPalettes.d.ts +62 -0
  51. package/dist/components/charts/shared/colorUtils.d.ts +9 -10
  52. package/dist/components/charts/shared/numberFormat.d.ts +58 -0
  53. package/dist/components/charts/shared/sparseArray.d.ts +27 -0
  54. package/dist/components/charts/shared/streamPropsHelpers.d.ts +113 -0
  55. package/dist/components/charts/shared/timeFormat.d.ts +60 -0
  56. package/dist/components/charts/shared/useChartSetup.d.ts +8 -0
  57. package/dist/components/charts/shared/useCustomChartSetup.d.ts +84 -0
  58. package/dist/components/charts/shared/useFrameImperativeHandle.d.ts +28 -0
  59. package/dist/components/charts/shared/useOrdinalStreaming.d.ts +6 -19
  60. package/dist/components/charts/shared/useStreamingLegend.d.ts +27 -11
  61. package/dist/components/charts/shared/validateProps.d.ts +2 -2
  62. package/dist/components/charts/shared/validationMap.d.ts +2 -1
  63. package/dist/components/charts/shared/withChartWrapper.d.ts +13 -4
  64. package/dist/components/charts/xy/AreaChart.d.ts +30 -1
  65. package/dist/components/charts/xy/CandlestickChart.d.ts +33 -6
  66. package/dist/components/charts/xy/ConnectedScatterplot.d.ts +24 -0
  67. package/dist/components/charts/xy/MinimapChart.d.ts +51 -0
  68. package/dist/components/charts/xy/MultiAxisLineChart.d.ts +27 -0
  69. package/dist/components/charts/xy/QuadrantChart.d.ts +21 -0
  70. package/dist/components/charts/xy/Scatterplot.d.ts +34 -2
  71. package/dist/components/charts/xy/ScatterplotMatrix.d.ts +16 -0
  72. package/dist/components/charts/xy/StackedAreaChart.d.ts +49 -1
  73. package/dist/components/realtime/types.d.ts +2 -4
  74. package/dist/components/recipes/bullet.d.ts +86 -0
  75. package/dist/components/recipes/calendar.d.ts +43 -0
  76. package/dist/components/recipes/dagre.d.ts +56 -0
  77. package/dist/components/recipes/flextree.d.ts +55 -0
  78. package/dist/components/recipes/marimekko.d.ts +55 -0
  79. package/dist/components/recipes/parallelCoordinates.d.ts +97 -0
  80. package/dist/components/recipes/recipeUtils.d.ts +27 -0
  81. package/dist/components/recipes/waffle.d.ts +46 -0
  82. package/dist/components/semiotic-ai.d.ts +4 -0
  83. package/dist/components/semiotic-network.d.ts +3 -0
  84. package/dist/components/semiotic-ordinal.d.ts +3 -0
  85. package/dist/components/semiotic-recipes.d.ts +24 -0
  86. package/dist/components/semiotic-xy.d.ts +3 -0
  87. package/dist/components/semiotic.d.ts +2 -2
  88. package/dist/components/server/renderToStaticSVG.d.ts +8 -2
  89. package/dist/components/server/serverChartConfigs.d.ts +47 -1
  90. package/dist/components/server/staticAnnotations.d.ts +6 -0
  91. package/dist/components/store/ObservationStore.d.ts +1 -3
  92. package/dist/components/store/SelectionStore.d.ts +1 -3
  93. package/dist/components/store/ThemeStore.d.ts +4 -4
  94. package/dist/components/store/TooltipStore.d.ts +1 -3
  95. package/dist/components/store/createStore.d.ts +4 -2
  96. package/dist/components/stream/CanvasHitTester.d.ts +10 -8
  97. package/dist/components/stream/DataSourceAdapter.d.ts +9 -0
  98. package/dist/components/stream/GeoPipelineStore.d.ts +9 -0
  99. package/dist/components/stream/GeoTileRenderer.d.ts +14 -0
  100. package/dist/components/stream/NetworkPipelineStore.d.ts +25 -0
  101. package/dist/components/stream/OrdinalPipelineStore.d.ts +12 -0
  102. package/dist/components/stream/PipelineStore.d.ts +51 -0
  103. package/dist/components/stream/SVGOverlay.d.ts +12 -0
  104. package/dist/components/stream/SceneGraph.d.ts +15 -1
  105. package/dist/components/stream/SceneToSVG.d.ts +1 -1
  106. package/dist/components/stream/categoryDomain.d.ts +4 -0
  107. package/dist/components/stream/composeOverlays.d.ts +15 -0
  108. package/dist/components/stream/customLayout.d.ts +76 -0
  109. package/dist/components/stream/customLayoutPalette.d.ts +29 -0
  110. package/dist/components/stream/geoTypes.d.ts +13 -0
  111. package/dist/components/stream/hoverUtils.d.ts +4 -10
  112. package/dist/components/stream/networkCustomLayout.d.ts +67 -0
  113. package/dist/components/stream/networkTypes.d.ts +45 -0
  114. package/dist/components/stream/ordinalCustomLayout.d.ts +84 -0
  115. package/dist/components/stream/ordinalTypes.d.ts +35 -1
  116. package/dist/components/stream/renderers/barFunnelCanvasRenderer.d.ts +9 -1
  117. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +92 -0
  118. package/dist/components/stream/sampleCurvePath.d.ts +9 -0
  119. package/dist/components/stream/types.d.ts +44 -1
  120. package/dist/components/stream/useHydration.d.ts +89 -0
  121. package/dist/components/stream/useStableShallow.d.ts +1 -0
  122. package/dist/components/stream/xySceneBuilders/types.d.ts +4 -0
  123. package/dist/geo.min.js +2 -1
  124. package/dist/geo.module.min.js +2 -1
  125. package/dist/network.min.js +2 -1
  126. package/dist/network.module.min.js +2 -1
  127. package/dist/ordinal.min.js +2 -1
  128. package/dist/ordinal.module.min.js +2 -1
  129. package/dist/realtime.min.js +2 -1
  130. package/dist/realtime.module.min.js +2 -1
  131. package/dist/semiotic-ai.d.ts +69 -65
  132. package/dist/semiotic-ai.min.js +2 -1
  133. package/dist/semiotic-ai.module.min.js +2 -1
  134. package/dist/semiotic-data.d.ts +4 -4
  135. package/dist/semiotic-geo.d.ts +15 -15
  136. package/dist/semiotic-network.d.ts +19 -16
  137. package/dist/semiotic-ordinal.d.ts +31 -28
  138. package/dist/semiotic-realtime.d.ts +17 -17
  139. package/dist/semiotic-recipes.d.ts +24 -0
  140. package/dist/semiotic-recipes.min.js +1 -0
  141. package/dist/semiotic-recipes.module.min.js +1 -0
  142. package/dist/semiotic-server.d.ts +6 -6
  143. package/dist/semiotic-statisticalOverlays-C3DsOgr_.js +1 -0
  144. package/dist/semiotic-themes.d.ts +3 -3
  145. package/dist/semiotic-themes.min.js +2 -1
  146. package/dist/semiotic-themes.module.min.js +2 -1
  147. package/dist/semiotic-utils.d.ts +23 -23
  148. package/dist/semiotic-utils.min.js +2 -1
  149. package/dist/semiotic-utils.module.min.js +2 -1
  150. package/dist/semiotic-xy.d.ts +27 -24
  151. package/dist/semiotic.d.ts +63 -63
  152. package/dist/semiotic.min.js +2 -1
  153. package/dist/semiotic.module.min.js +2 -1
  154. package/dist/server.min.js +1 -1
  155. package/dist/server.module.min.js +1 -1
  156. package/dist/test-utils/canvasMock.d.ts +34 -5
  157. package/dist/xy.min.js +2 -1
  158. package/dist/xy.module.min.js +2 -1
  159. package/package.json +38 -17
  160. package/dist/semiotic-statisticalOverlays-Ckd_jM8z.js +0 -1
@@ -0,0 +1,84 @@
1
+ import type { Ref, RefObject, ReactElement, ReactNode } from "react";
2
+ import { useChartMode } from "./hooks";
3
+ import { type ChartSetupResult } from "./useChartSetup";
4
+ import type { ChartMode, SelectionConfig, LinkedHoverProp } from "./types";
5
+ import type { OnObservationCallback } from "../../store/ObservationStore";
6
+ import type { PartialMargin, MarginType } from "../../types/marginType";
7
+ import type { Datum } from "./datumTypes";
8
+ import type { RealtimeFrameHandle } from "../../realtime/types";
9
+ /**
10
+ * Margin shorthand → sided form. The Stream*Frame margin props only
11
+ * accept the sided object form, so HOCs that expose the user-friendly
12
+ * number shorthand have to expand it themselves. Centralized here so
13
+ * every custom-layout HOC normalizes consistently.
14
+ */
15
+ export declare function normalizeUserMargin(m: PartialMargin | undefined): Partial<MarginType> | undefined;
16
+ interface ScaffoldOptions {
17
+ /** Ref forwarded by the HOC. The hook binds the imperative handle internally. */
18
+ imperativeRef: Ref<RealtimeFrameHandle> | undefined;
19
+ /** Which `useFrameImperativeHandle` variant to bind. XY/ordinal frames share "xy". */
20
+ imperativeVariant: "xy" | "network";
21
+ /** Margin shorthand or sided form from the HOC's `margin` prop. */
22
+ margin: PartialMargin | undefined;
23
+ width?: number;
24
+ height?: number;
25
+ showGrid?: boolean;
26
+ enableHover?: boolean;
27
+ showLegend?: boolean;
28
+ title?: string;
29
+ mode?: ChartMode;
30
+ xLabel?: string;
31
+ yLabel?: string;
32
+ }
33
+ interface ScaffoldResult<TFrameHandle> {
34
+ /** Ref to attach to the inner Stream*Frame component. */
35
+ frameRef: RefObject<TFrameHandle | null>;
36
+ /** Result of `useChartMode` — width/height/showGrid/etc. with mode defaults applied. */
37
+ resolved: ReturnType<typeof useChartMode>;
38
+ /** User margin normalized to the sided form, or undefined if not supplied. */
39
+ normalizedMargin: Partial<MarginType> | undefined;
40
+ }
41
+ /**
42
+ * Scaffold shared by all three custom-layout HOCs: imperative-handle
43
+ * binding, chart-mode resolution, margin normalization. Network HOCs
44
+ * stop here; data-shaped HOCs layer `useChartSetup` on top via
45
+ * `useCustomChartSetup`.
46
+ */
47
+ export declare function useCustomChartScaffold<TFrameHandle>(options: ScaffoldOptions): ScaffoldResult<TFrameHandle>;
48
+ interface DataSetupOptions extends ScaffoldOptions {
49
+ /** Raw `data` prop from the HOC (may be undefined in push mode). */
50
+ data: Datum[] | undefined;
51
+ /** Label used by useChartSetup for observation events ("XYCustomChart", "OrdinalCustomChart"). */
52
+ chartTypeLabel: string;
53
+ /** Whether the hover callback should unwrap the datum (ordinal/network = true, XY = false). */
54
+ unwrapData: boolean;
55
+ /** Color scheme threaded into useChartSetup's color resolution. */
56
+ colorScheme?: string | string[];
57
+ /** Pass-through chart-setup inputs. */
58
+ selection?: SelectionConfig;
59
+ linkedHover?: LinkedHoverProp;
60
+ onObservation?: OnObservationCallback;
61
+ onClick?: (datum: any, ev: {
62
+ x: number;
63
+ y: number;
64
+ }) => void;
65
+ chartId?: string;
66
+ loading?: boolean;
67
+ emptyContent?: ReactNode;
68
+ }
69
+ interface DataSetupResult<TFrameHandle> extends ScaffoldResult<TFrameHandle> {
70
+ /** Sparse-filtered copy of the input data array. */
71
+ safeData: Datum[];
72
+ /** Full `useChartSetup` result — selection/legend/behavior wiring for the streamProps. */
73
+ setup: ChartSetupResult;
74
+ /** If non-null, the HOC should render this immediately (loading skeleton or empty state). */
75
+ earlyReturn: ReactElement | null;
76
+ }
77
+ /**
78
+ * Scaffold + `useChartSetup` wiring for the data-shaped custom-layout
79
+ * HOCs (`XYCustomChart`, `OrdinalCustomChart`). Each HOC stays in charge
80
+ * of its own frame-specific streamProps; the hook only owns the
81
+ * orchestration that is genuinely identical.
82
+ */
83
+ export declare function useCustomChartSetup<TFrameHandle>(options: DataSetupOptions): DataSetupResult<TFrameHandle>;
84
+ export {};
@@ -0,0 +1,28 @@
1
+ import type { Ref, RefObject, DependencyList } from "react";
2
+ import type { RealtimeFrameHandle } from "../../realtime/types";
3
+ type FrameVariant = "xy" | "network" | "geo-points";
4
+ interface Options {
5
+ /**
6
+ * Variant decides which default method bodies are emitted. The
7
+ * concrete `frameRef` shape must match the variant — the helper
8
+ * trusts the caller here rather than fighting TypeScript's
9
+ * discriminated-union narrowing across heterogeneous frame handle
10
+ * types (`StreamXYFrameHandle` vs `StreamNetworkFrameHandle` vs
11
+ * `StreamGeoFrameHandle`). A regression test in
12
+ * `useFrameImperativeHandle.test.ts` exercises each variant's
13
+ * defaults plus the `getScales` omission for network/geo.
14
+ */
15
+ variant: FrameVariant;
16
+ frameRef: RefObject<unknown>;
17
+ overrides?: Partial<RealtimeFrameHandle>;
18
+ deps?: DependencyList;
19
+ }
20
+ /**
21
+ * Wire up the HOC's exposed `ref` to the inner frame ref using the
22
+ * shape conventions for the chosen variant. Pass `overrides` to
23
+ * replace specific methods (e.g. a wrapped `push` or a custom `clear`
24
+ * that runs HOC-side cleanup before delegating to the frame); the
25
+ * variant's defaults fill in everything else.
26
+ */
27
+ export declare function useFrameImperativeHandle(ref: Ref<RealtimeFrameHandle> | undefined, options: Options): void;
28
+ export {};
@@ -2,27 +2,14 @@ import type { Datum } from "./datumTypes";
2
2
  import type { Ref, RefObject } from "react";
3
3
  import type { StreamOrdinalFrameHandle } from "../../stream/ordinalTypes";
4
4
  import type { RealtimeFrameHandle } from "../../realtime/types";
5
- import type { Accessor } from "./types";
6
- import type { LegendPosition } from "./hooks";
7
5
  interface UseOrdinalStreamingConfig {
8
6
  /** External ref for push API */
9
7
  ref: Ref<RealtimeFrameHandle>;
10
8
  /** Internal frame ref */
11
9
  frameRef: RefObject<StreamOrdinalFrameHandle | null>;
12
- /** True when data prop is undefined (push API mode) */
13
- isPushMode: boolean;
14
- /** Color-by accessor (may be derived from stackBy/groupBy/etc.) */
15
- colorBy: Accessor<string> | undefined;
16
- /** Color scheme name or array — undefined lets useColorScale consult the theme */
17
- colorScheme: string | string[] | undefined;
18
- /** Whether legend is requested */
19
- showLegend: boolean | undefined;
20
- /** Legend position */
21
- legendPosition?: LegendPosition;
22
- /** Results from useChartSetup — needed for legend/margin merge */
10
+ /** Results from useChartSetup that should be forwarded to the stream frame */
23
11
  setup: {
24
12
  legendBehaviorProps: Datum;
25
- legendPosition: LegendPosition;
26
13
  margin: {
27
14
  top: number;
28
15
  right: number;
@@ -32,9 +19,9 @@ interface UseOrdinalStreamingConfig {
32
19
  };
33
20
  }
34
21
  interface UseOrdinalStreamingResult {
35
- /** Legend props merged with streaming legend (spread into streamProps) */
22
+ /** Legend/category-domain props from useChartSetup (spread into streamProps) */
36
23
  effectiveLegendProps: Datum;
37
- /** Margin merged with streaming legend margin adjustments */
24
+ /** Margin from useChartSetup, including frame-domain legend expansion */
38
25
  effectiveMargin: {
39
26
  top: number;
40
27
  right: number;
@@ -45,11 +32,11 @@ interface UseOrdinalStreamingResult {
45
32
  /**
46
33
  * Shared hook for ordinal charts that support push API + streaming legend.
47
34
  *
48
- * Consolidates: useStreamingLegend, wrappedPush/pushMany,
49
- * useImperativeHandle, effectiveLegendProps, effectiveMargin.
35
+ * Consolidates imperative handle forwarding and returns the legend/margin
36
+ * props that useChartSetup derives from static data or frame-reported domains.
50
37
  *
51
38
  * Used by: StackedBarChart, GroupedBarChart, PieChart, DonutChart, SwimlaneChart.
52
39
  * NOT used by LikertChart (custom accumulator + deterministic legend).
53
40
  */
54
- export declare function useOrdinalStreaming({ ref, frameRef, isPushMode, colorBy, colorScheme, showLegend, legendPosition, setup, }: UseOrdinalStreamingConfig): UseOrdinalStreamingResult;
41
+ export declare function useOrdinalStreaming({ ref, frameRef, setup, }: UseOrdinalStreamingConfig): UseOrdinalStreamingResult;
55
42
  export {};
@@ -1,20 +1,28 @@
1
1
  import type { Datum } from "./datumTypes";
2
2
  import type { Accessor } from "./types";
3
- import type { LegendPosition } from "./hooks";
3
+ import { type LegendPosition } from "./hooks";
4
4
  /**
5
- * Hook that discovers categories from streamed (pushed) data and builds
6
- * a legend dynamically.
5
+ * Low-level push-API category-discovery wrapper.
7
6
  *
8
- * When the `data` prop is provided (bounded mode), this hook is inert
9
- * the legend is built by `useChartSetup` from the full dataset.
7
+ * Most HOCs do NOT need this hook anymore. `useChartSetup` already
8
+ * synthesizes a push-mode legend from categories the StreamFrame emits
9
+ * via `onCategoriesChange`, applies the same provider/scheme/theme/
10
+ * STREAMING_PALETTE precedence the marks resolve through, and registers
11
+ * those categories with the parent `LinkedCharts` via
12
+ * `useChartLegendAndMargin` → `useLinkedChartCategories`. For HOCs that
13
+ * just want a working push-mode legend, that is enough.
10
14
  *
11
- * When `data` is undefined (push API mode), this hook:
12
- * 1. Wraps push/pushMany to intercept incoming data
13
- * 2. Extracts category values via `colorBy`
14
- * 3. Builds a legend config when new categories are discovered
15
+ * This hook is kept as the escape hatch for HOCs that must intercept
16
+ * the push call BEFORE the frame ingests it — typically aggregator HOCs
17
+ * like `LikertChart` that re-aggregate streamed rows into a different
18
+ * shape (level × count) before the frame sees them. `wrapPush` /
19
+ * `wrapPushMany` give those charts a place to run their accumulator
20
+ * code; the wrapped function then forwards to the original push.
15
21
  *
16
- * Returns `wrapPush` / `wrapPushMany` callbacks to wrap the imperative handle,
17
- * plus a `streamingLegend` that should override the (empty) legend from useChartSetup.
22
+ * Returned `streamingLegend` and `streamingMarginAdjust` are vestigial
23
+ * for these consumers they're produced for backward compatibility,
24
+ * but new code should rely on `setup.legend` / `setup.margin` from
25
+ * `useChartSetup` instead.
18
26
  */
19
27
  export declare function useStreamingLegend({ isPushMode, colorBy, colorScheme, showLegend, legendPosition, }: {
20
28
  /** True when data prop is undefined (push API mode) */
@@ -31,6 +39,14 @@ export declare function useStreamingLegend({ isPushMode, colorBy, colorScheme, s
31
39
  wrapPush: (originalPush: (d: Datum) => void) => (datum: Datum) => void;
32
40
  wrapPushMany: (originalPushMany: (d: any[]) => void) => (data: any[]) => void;
33
41
  resetCategories: () => void;
42
+ categories: string[];
43
+ categoryDomainProps: {
44
+ legendCategoryAccessor: Accessor<string>;
45
+ onCategoriesChange: (categories: string[]) => void;
46
+ } | {
47
+ legendCategoryAccessor?: undefined;
48
+ onCategoriesChange?: undefined;
49
+ };
34
50
  streamingLegend: {
35
51
  legendGroups: {
36
52
  styleFn: (d: import("../../types/legendTypes").LegendItem) => Record<string, string | number>;
@@ -10,11 +10,11 @@ export interface PropDef {
10
10
  type: PropType | PropType[];
11
11
  enum?: readonly string[];
12
12
  }
13
- type DataShape = "array" | "object" | "network" | "realtime";
13
+ type DataShape = "array" | "object" | "network" | "realtime" | "none";
14
14
  export interface ComponentSpec {
15
15
  /** Props that must be present */
16
16
  required: string[];
17
- /** Data shape — drives which validateChartData helper to call */
17
+ /** Data shape — drives which validateChartData helper to call; "none" means no data prop is expected */
18
18
  dataShape: DataShape;
19
19
  /** Accessor props to validate against data (key = prop name) */
20
20
  dataAccessors: string[];
@@ -6,7 +6,8 @@
6
6
  * via spread to keep individual entries concise.
7
7
  *
8
8
  * Consumed by: validateProps.ts (validation engine), diagnoseConfig.ts,
9
- * chartConfig.ts, check-schema-freshness.js
9
+ * chartConfig.ts. Schema/validation parity is locked by the
10
+ * Chart Spec Registry (`check:chart-specs`).
10
11
  */
11
12
  import type { ComponentSpec } from "./validateProps";
12
13
  export declare const VALIDATION_MAP: Record<string, ComponentSpec>;
@@ -3,15 +3,24 @@ interface SafeRenderProps {
3
3
  componentName: string;
4
4
  width: number;
5
5
  height: number;
6
+ /** @deprecated Retained for back-compat; no longer threaded into the
7
+ * error boundary. Use `npx semiotic-ai --doctor` or import
8
+ * `diagnoseConfig` from `semiotic/utils` for validation diagnostics. */
6
9
  chartProps?: Record<string, unknown>;
7
10
  children: React.ReactNode;
8
11
  }
9
12
  /**
10
- * Wraps a chart's rendered output with an error boundary.
11
- * If the chart throws during render, runs diagnoseConfig to produce
12
- * actionable fix suggestions alongside the error message.
13
+ * Wraps a chart's rendered output with an error boundary. If the chart
14
+ * throws during render, displays the error message with the component
15
+ * name.
16
+ *
17
+ * For richer prop diagnostics ("missing accessor", "wrong data shape",
18
+ * etc.), use `npx semiotic-ai --doctor` (CLI) or import `diagnoseConfig`
19
+ * from `semiotic/utils`. We intentionally don't bundle the validation
20
+ * map into every subpath import — it would add ~7KB gz to xy/ordinal/
21
+ * network just to power a fallback that only fires when render throws.
13
22
  */
14
- export declare function SafeRender({ componentName, width, height, chartProps, children }: SafeRenderProps): import("react/jsx-runtime").JSX.Element;
23
+ export declare function SafeRender({ componentName, width, height, children }: SafeRenderProps): import("react/jsx-runtime").JSX.Element;
15
24
  /**
16
25
  * Renders a "No data available" placeholder when data is empty.
17
26
  * Returns null when data is present or emptyContent is `false`.
@@ -151,7 +151,8 @@ export interface AreaChartProps<TDatum extends Datum = Datum> extends BaseChartP
151
151
  */
152
152
  legendPosition?: LegendPosition;
153
153
  /**
154
- * Tooltip configuration
154
+ * Tooltip configuration. Pass "multi" to show every area value at the
155
+ * hovered x position.
155
156
  */
156
157
  tooltip?: TooltipProp;
157
158
  /**
@@ -175,6 +176,7 @@ export interface AreaChartProps<TDatum extends Datum = Datum> extends BaseChartP
175
176
  *
176
177
  * @example
177
178
  * ```tsx
179
+ * // Multi-series areas with overlap transparency
178
180
  * <AreaChart
179
181
  * data={[
180
182
  * {x: 1, y: 10, category: 'A'},
@@ -188,6 +190,33 @@ export interface AreaChartProps<TDatum extends Datum = Datum> extends BaseChartP
188
190
  * yLabel="Value"
189
191
  * />
190
192
  * ```
193
+ *
194
+ * @example
195
+ * ```tsx
196
+ * // Single series with a vertical opacity gradient (tip → baseline fade)
197
+ * <AreaChart
198
+ * data={data}
199
+ * xAccessor="t"
200
+ * yAccessor="value"
201
+ * color="steelblue"
202
+ * gradientFill={{ topOpacity: 0.8, bottomOpacity: 0.05 }}
203
+ * />
204
+ * ```
205
+ *
206
+ * @example
207
+ * ```tsx
208
+ * // Push mode — omit `data`, drive the chart through a ref. Use a
209
+ * // stable string id so `remove(id)` / `update(id, ...)` work later.
210
+ * const ref = useRef<RealtimeFrameHandle>(null)
211
+ * useEffect(() => {
212
+ * const id = setInterval(() => {
213
+ * const t = Date.now()
214
+ * ref.current?.push({ id: String(t), x: t, y: Math.random() })
215
+ * }, 200)
216
+ * return () => clearInterval(id)
217
+ * }, [])
218
+ * return <AreaChart ref={ref} xAccessor="x" yAccessor="y" pointIdAccessor="id" />
219
+ * ```
191
220
  */
192
221
  export declare const AreaChart: {
193
222
  <TDatum extends Datum = Datum>(props: AreaChartProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
@@ -32,13 +32,40 @@ export interface CandlestickChartProps<TDatum extends Datum = Datum> extends Bas
32
32
  *
33
33
  * @example
34
34
  * ```tsx
35
- * // Full OHLC
36
- * <CandlestickChart data={data} xAccessor="date"
37
- * openAccessor="o" highAccessor="h" lowAccessor="l" closeAccessor="c" />
35
+ * // Full OHLC candlesticks
36
+ * <CandlestickChart
37
+ * data={prices}
38
+ * xAccessor="date"
39
+ * openAccessor="o"
40
+ * highAccessor="h"
41
+ * lowAccessor="l"
42
+ * closeAccessor="c"
43
+ * />
44
+ * ```
38
45
  *
39
- * // Range-only (e.g. min/max over a window)
40
- * <CandlestickChart data={data} xAccessor="date"
41
- * highAccessor="max" lowAccessor="min" />
46
+ * @example
47
+ * ```tsx
48
+ * // Range-only (e.g. min/max bands per period)
49
+ * <CandlestickChart
50
+ * data={data}
51
+ * xAccessor="date"
52
+ * highAccessor="max"
53
+ * lowAccessor="min"
54
+ * />
55
+ * ```
56
+ *
57
+ * @example
58
+ * ```tsx
59
+ * // Custom up/down colors and bar width
60
+ * <CandlestickChart
61
+ * data={prices}
62
+ * xAccessor="date"
63
+ * openAccessor="o"
64
+ * highAccessor="h"
65
+ * lowAccessor="l"
66
+ * closeAccessor="c"
67
+ * candlestickStyle={{ upColor: "#22c55e", downColor: "#ef4444", bodyWidth: 8 }}
68
+ * />
42
69
  * ```
43
70
  */
44
71
  export declare const CandlestickChart: {
@@ -51,6 +51,7 @@ export interface ConnectedScatterplotProps<TDatum extends Datum = Datum> extends
51
51
  *
52
52
  * @example
53
53
  * ```tsx
54
+ * // Country trajectory over time
54
55
  * <ConnectedScatterplot
55
56
  * data={trajectory}
56
57
  * xAccessor="gdp"
@@ -58,6 +59,29 @@ export interface ConnectedScatterplotProps<TDatum extends Datum = Datum> extends
58
59
  * pointRadius={4}
59
60
  * />
60
61
  * ```
62
+ *
63
+ * @example
64
+ * ```tsx
65
+ * // Explicit ordering field — sorts before connecting
66
+ * <ConnectedScatterplot
67
+ * data={observations}
68
+ * xAccessor="x"
69
+ * yAccessor="y"
70
+ * orderAccessor="timestamp"
71
+ * orderLabel="Time"
72
+ * />
73
+ * ```
74
+ *
75
+ * @example
76
+ * ```tsx
77
+ * // Date-based ordering (Date or numeric values both work)
78
+ * <ConnectedScatterplot
79
+ * data={dataByDate}
80
+ * xAccessor="metric"
81
+ * yAccessor="cost"
82
+ * orderAccessor={(d) => new Date(d.month)}
83
+ * />
84
+ * ```
61
85
  */
62
86
  export declare const ConnectedScatterplot: {
63
87
  <TDatum extends Datum = Datum>(props: ConnectedScatterplotProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
@@ -70,6 +70,57 @@ export interface MinimapChartProps<TDatum extends Datum = Datum> extends Omit<Ba
70
70
  /** Additional StreamXYFrame props */
71
71
  frameProps?: Partial<Omit<StreamXYFrameProps, "chartType" | "data" | "size">>;
72
72
  }
73
+ /**
74
+ * MinimapChart - Line chart paired with a brushable overview minimap.
75
+ *
76
+ * Renders the same line data twice: a compressed overview (the minimap)
77
+ * and a zoomed detail view of the brushed range. Drag in the minimap to
78
+ * update the detail's domain. The minimap configuration (height, axes,
79
+ * brush direction) is nested under the `minimap` prop; brush state is
80
+ * exposed via `onBrush` (callback) and `brushExtent` (controlled value).
81
+ *
82
+ * Useful for long time series where the user needs both context and
83
+ * detail without losing their place in the full range.
84
+ *
85
+ * @example
86
+ * ```tsx
87
+ * // Time series with default minimap below the detail view
88
+ * <MinimapChart
89
+ * data={timeSeries}
90
+ * xAccessor="date"
91
+ * yAccessor="value"
92
+ * xScaleType="time"
93
+ * minimap={{ height: 80, brushDirection: "x" }}
94
+ * />
95
+ * ```
96
+ *
97
+ * @example
98
+ * ```tsx
99
+ * // Multi-series with a starting brush selection and an onBrush callback
100
+ * <MinimapChart
101
+ * data={timeSeries}
102
+ * xAccessor="t"
103
+ * yAccessor="v"
104
+ * lineBy="series"
105
+ * colorBy="series"
106
+ * minimap={{ height: 60, showAxes: true }}
107
+ * brushExtent={[100, 500]}
108
+ * onBrush={(extent) => console.log("brushed:", extent)}
109
+ * />
110
+ * ```
111
+ *
112
+ * @example
113
+ * ```tsx
114
+ * // Render the minimap above the detail rather than below
115
+ * <MinimapChart
116
+ * data={timeSeries}
117
+ * xAccessor="date"
118
+ * yAccessor="value"
119
+ * renderBefore
120
+ * minimap={{ height: 50, background: "#f8fafc" }}
121
+ * />
122
+ * ```
123
+ */
73
124
  export declare function MinimapChart<TDatum extends Datum = Datum>(props: MinimapChartProps<TDatum>): import("react/jsx-runtime").JSX.Element;
74
125
  export declare namespace MinimapChart {
75
126
  var displayName: string;
@@ -65,6 +65,33 @@ export interface MultiAxisLineChartProps<TDatum extends Datum = Datum> extends B
65
65
  *
66
66
  * If `series` does not contain exactly 2 entries, renders as a standard
67
67
  * multi-line chart with a dev-mode console warning.
68
+ *
69
+ * @example
70
+ * ```tsx
71
+ * // Revenue (left axis, $) vs. signups (right axis, count)
72
+ * <MultiAxisLineChart
73
+ * data={metrics}
74
+ * xAccessor="month"
75
+ * series={[
76
+ * { yAccessor: "revenue", label: "Revenue", color: "#3b82f6", format: (v) => `$${v}` },
77
+ * { yAccessor: "signups", label: "Signups", color: "#22c55e" },
78
+ * ]}
79
+ * legendPosition="bottom"
80
+ * />
81
+ * ```
82
+ *
83
+ * @example
84
+ * ```tsx
85
+ * // Pinning each axis extent independently
86
+ * <MultiAxisLineChart
87
+ * data={metrics}
88
+ * xAccessor="t"
89
+ * series={[
90
+ * { yAccessor: "tempC", label: "°C", color: "#ef4444", extent: [-10, 40] },
91
+ * { yAccessor: "humidity", label: "%", color: "#06b6d4", extent: [0, 100] },
92
+ * ]}
93
+ * />
94
+ * ```
68
95
  */
69
96
  export declare const MultiAxisLineChart: {
70
97
  <TDatum extends Datum = Datum>(props: MultiAxisLineChartProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
@@ -114,6 +114,27 @@ export interface QuadrantChartProps<TDatum extends Datum = Datum> extends BaseCh
114
114
  * }}
115
115
  * />
116
116
  * ```
117
+ *
118
+ * @example
119
+ * ```tsx
120
+ * // Effort vs. impact prioritization with a fixed 5×5 split.
121
+ * // Omit `xCenter`/`yCenter` to let the chart center on the domain midpoint.
122
+ * <QuadrantChart
123
+ * data={features}
124
+ * xAccessor="impact"
125
+ * yAccessor="effort"
126
+ * xCenter={5}
127
+ * yCenter={5}
128
+ * quadrants={{
129
+ * topRight: { label: "Quick wins", color: "#22c55e" },
130
+ * topLeft: { label: "Maybe later", color: "#94a3b8" },
131
+ * bottomRight: { label: "Big bets", color: "#3b82f6" },
132
+ * bottomLeft: { label: "Skip", color: "#ef4444" },
133
+ * }}
134
+ * colorBy="team"
135
+ * sizeBy="estimate"
136
+ * />
137
+ * ```
117
138
  */
118
139
  export declare const QuadrantChart: {
119
140
  <TDatum extends Datum = Datum>(props: QuadrantChartProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
@@ -49,16 +49,48 @@ export interface ScatterplotProps<TDatum extends Datum = Datum> extends BaseChar
49
49
  frameProps?: Partial<Omit<StreamXYFrameProps, "chartType" | "data" | "size">>;
50
50
  }
51
51
  /**
52
- * Scatterplot - Visualize relationships between two continuous variables
52
+ * Scatterplot - Visualize relationships between two continuous variables.
53
+ *
54
+ * Each row becomes a circle at `(xAccessor, yAccessor)`. Add a third
55
+ * dimension via {@link BubbleChart} (size encoding) or
56
+ * {@link ConnectedScatterplot} (point ordering). For matrix views of every
57
+ * pairwise combination, use {@link ScatterplotMatrix}.
53
58
  *
54
59
  * @example
55
60
  * ```tsx
61
+ * // Simple scatter
56
62
  * <Scatterplot
57
- * data={[{x: 1, y: 10}, {x: 2, y: 20}]}
63
+ * data={[{ x: 1, y: 10 }, { x: 2, y: 20 }]}
58
64
  * xLabel="Time"
59
65
  * yLabel="Value"
60
66
  * />
61
67
  * ```
68
+ *
69
+ * @example
70
+ * ```tsx
71
+ * // Color by category, marginal histograms in axis margins
72
+ * <Scatterplot
73
+ * data={observations}
74
+ * xAccessor="age"
75
+ * yAccessor="income"
76
+ * colorBy="region"
77
+ * showLegend
78
+ * marginalGraphics={{ x: "histogram", y: "histogram" }}
79
+ * />
80
+ * ```
81
+ *
82
+ * @example
83
+ * ```tsx
84
+ * // Hover-highlight non-hovered series + click handler
85
+ * <Scatterplot
86
+ * data={observations}
87
+ * xAccessor="x"
88
+ * yAccessor="y"
89
+ * colorBy="cluster"
90
+ * hoverHighlight
91
+ * onClick={(d) => console.log(d)}
92
+ * />
93
+ * ```
62
94
  */
63
95
  export declare const Scatterplot: {
64
96
  <TDatum extends Datum = Datum>(props: ScatterplotProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
@@ -56,6 +56,7 @@ export interface ScatterplotMatrixProps<TDatum extends Datum = Datum> extends Ba
56
56
  *
57
57
  * @example
58
58
  * ```tsx
59
+ * // Iris dataset — every pairwise field combination
59
60
  * <ScatterplotMatrix
60
61
  * data={iris}
61
62
  * fields={["sepalLength", "sepalWidth", "petalLength", "petalWidth"]}
@@ -64,6 +65,21 @@ export interface ScatterplotMatrixProps<TDatum extends Datum = Datum> extends Ba
64
65
  * diagonal="histogram"
65
66
  * />
66
67
  * ```
68
+ *
69
+ * @example
70
+ * ```tsx
71
+ * // Brush mode: drag in any cell to highlight matching points across the
72
+ * // matrix. The `crossfilter` mode excludes the brushed cell from its own
73
+ * // filter so it stays fully visible while the others dim non-matches.
74
+ * // Brush selections live in the matrix's internal selection store and do
75
+ * // not propagate to charts rendered outside the component.
76
+ * <ScatterplotMatrix
77
+ * data={observations}
78
+ * fields={["x", "y", "z"]}
79
+ * hoverMode={false}
80
+ * brushMode="crossfilter"
81
+ * />
82
+ * ```
67
83
  */
68
84
  export declare function ScatterplotMatrix<TDatum extends Datum = Datum>(props: ScatterplotMatrixProps<TDatum>): import("react/jsx-runtime").JSX.Element;
69
85
  export declare namespace ScatterplotMatrix {