semiotic 3.0.0-beta.3 → 3.0.0-beta.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 (132) hide show
  1. package/CLAUDE.md +93 -753
  2. package/README.md +80 -7
  3. package/dist/ChartContainer.d.ts +60 -0
  4. package/dist/DetailsPanel.d.ts +37 -0
  5. package/dist/LinkedCharts.d.ts +2 -0
  6. package/dist/Tooltip/Tooltip.d.ts +2 -2
  7. package/dist/charts/index.d.ts +1 -1
  8. package/dist/charts/ordinal/BarChart.d.ts +1 -0
  9. package/dist/charts/ordinal/BoxPlot.d.ts +1 -0
  10. package/dist/charts/ordinal/DonutChart.d.ts +1 -0
  11. package/dist/charts/ordinal/DotPlot.d.ts +1 -0
  12. package/dist/charts/ordinal/GroupedBarChart.d.ts +1 -0
  13. package/dist/charts/ordinal/Histogram.d.ts +1 -0
  14. package/dist/charts/ordinal/PieChart.d.ts +1 -0
  15. package/dist/charts/ordinal/RidgelinePlot.d.ts +1 -0
  16. package/dist/charts/ordinal/StackedBarChart.d.ts +1 -0
  17. package/dist/charts/ordinal/SwarmPlot.d.ts +1 -0
  18. package/dist/charts/ordinal/ViolinPlot.d.ts +1 -0
  19. package/dist/charts/realtime/RealtimeHeatmap.d.ts +11 -0
  20. package/dist/charts/realtime/RealtimeHistogram.d.ts +15 -1
  21. package/dist/charts/realtime/RealtimeLineChart.d.ts +6 -0
  22. package/dist/charts/realtime/RealtimeSwarmChart.d.ts +6 -0
  23. package/dist/charts/realtime/RealtimeWaterfallChart.d.ts +6 -0
  24. package/dist/charts/shared/annotationRules.d.ts +3 -0
  25. package/dist/charts/shared/colorUtils.d.ts +17 -11
  26. package/dist/charts/shared/hooks.d.ts +96 -1
  27. package/dist/charts/shared/loess.d.ts +13 -0
  28. package/dist/charts/shared/networkUtils.d.ts +31 -0
  29. package/dist/charts/shared/tooltipUtils.d.ts +16 -0
  30. package/dist/charts/shared/types.d.ts +17 -2
  31. package/dist/charts/shared/validateChartData.d.ts +2 -3
  32. package/dist/charts/shared/validateProps.d.ts +18 -0
  33. package/dist/charts/xy/AreaChart.d.ts +4 -0
  34. package/dist/charts/xy/BubbleChart.d.ts +6 -0
  35. package/dist/charts/xy/Heatmap.d.ts +4 -0
  36. package/dist/charts/xy/LineChart.d.ts +6 -0
  37. package/dist/charts/xy/Scatterplot.d.ts +4 -0
  38. package/dist/charts/xy/StackedAreaChart.d.ts +4 -0
  39. package/dist/data/fromVegaLite.d.ts +48 -0
  40. package/dist/export/chartConfig.d.ts +29 -0
  41. package/dist/export/selectionSerializer.d.ts +20 -0
  42. package/dist/geometry/sankeyLinks.d.ts +1 -1
  43. package/dist/network.min.js +1 -1
  44. package/dist/network.module.min.js +1 -1
  45. package/dist/ordinal.min.js +1 -1
  46. package/dist/ordinal.module.min.js +1 -1
  47. package/dist/realtime/types.d.ts +20 -6
  48. package/dist/realtime.min.js +1 -1
  49. package/dist/realtime.module.min.js +1 -1
  50. package/dist/semiotic-ai.d.ts +14 -0
  51. package/dist/semiotic-ai.min.js +1 -1
  52. package/dist/semiotic-ai.module.min.js +1 -1
  53. package/dist/semiotic-data.d.ts +2 -0
  54. package/dist/semiotic-data.min.js +1 -1
  55. package/dist/semiotic-data.module.min.js +1 -1
  56. package/dist/semiotic-network.d.ts +9 -19
  57. package/dist/semiotic-ordinal.d.ts +12 -14
  58. package/dist/semiotic-xy.d.ts +12 -18
  59. package/dist/semiotic.d.ts +16 -13
  60. package/dist/semiotic.min.js +1 -1
  61. package/dist/semiotic.module.min.js +1 -1
  62. package/dist/server.min.js +1 -1
  63. package/dist/server.module.min.js +1 -1
  64. package/dist/store/ObservationStore.d.ts +61 -0
  65. package/dist/store/SelectionStore.d.ts +9 -1
  66. package/dist/store/ThemeStore.d.ts +6 -1
  67. package/dist/store/TooltipStore.d.ts +3 -1
  68. package/dist/store/createStore.d.ts +4 -1
  69. package/dist/store/useObservation.d.ts +18 -0
  70. package/dist/stream/MarginalGraphics.d.ts +1 -1
  71. package/dist/stream/NetworkPipelineStore.d.ts +44 -0
  72. package/dist/stream/OrdinalCanvasHitTester.d.ts +1 -0
  73. package/dist/stream/OrdinalSVGOverlay.d.ts +6 -2
  74. package/dist/stream/ParticlePool.d.ts +2 -1
  75. package/dist/stream/PipelineStore.d.ts +11 -0
  76. package/dist/stream/SVGOverlay.d.ts +21 -2
  77. package/dist/stream/SceneGraph.d.ts +1 -1
  78. package/dist/stream/networkTypes.d.ts +58 -1
  79. package/dist/stream/ordinalTypes.d.ts +13 -0
  80. package/dist/stream/types.d.ts +14 -0
  81. package/dist/types/annotationTypes.d.ts +10 -0
  82. package/dist/types/networkTypes.d.ts +1 -2
  83. package/dist/xy.min.js +1 -1
  84. package/dist/xy.module.min.js +1 -1
  85. package/package.json +27 -38
  86. package/dist/AnnotationLayer/AnnotationLayer.d.ts +0 -25
  87. package/dist/Axis/Axis.d.ts +0 -7
  88. package/dist/Axis/axisTitle.d.ts +0 -10
  89. package/dist/Axis/index.d.ts +0 -2
  90. package/dist/Axis/summaryGraphic.d.ts +0 -17
  91. package/dist/Brush.d.ts +0 -12
  92. package/dist/DividedLine.d.ts +0 -16
  93. package/dist/TooltipPositioner/index.d.ts +0 -7
  94. package/dist/annotationLayerBehavior/annotationHandling.d.ts +0 -19
  95. package/dist/annotationLayerBehavior/d3labeler.d.ts +0 -9
  96. package/dist/annotationRules/baseRules.d.ts +0 -25
  97. package/dist/annotationRules/networkframeRules.d.ts +0 -48
  98. package/dist/annotationRules/xyframeRules.d.ts +0 -117
  99. package/dist/batchWork.d.ts +0 -6
  100. package/dist/constants/coordinateNames.d.ts +0 -8
  101. package/dist/constants/frame_props.d.ts +0 -13
  102. package/dist/data/dataFunctions.d.ts +0 -45
  103. package/dist/data/multiAccessorUtils.d.ts +0 -1
  104. package/dist/data/unflowedFunctions.d.ts +0 -1
  105. package/dist/generic_utilities/functions.d.ts +0 -1
  106. package/dist/geometry/areaDrawing.d.ts +0 -21
  107. package/dist/geometry/contourLayout.d.ts +0 -6
  108. package/dist/geometry/hexbinLayout.d.ts +0 -7
  109. package/dist/geometry/lineDrawing.d.ts +0 -71
  110. package/dist/geometry/summaryLayouts.d.ts +0 -45
  111. package/dist/index.d.ts +0 -1
  112. package/dist/processing/InteractionItems.d.ts +0 -13
  113. package/dist/processing/hierarchyUtils.d.ts +0 -16
  114. package/dist/processing/layouts/chordLayout.d.ts +0 -2
  115. package/dist/processing/layouts/forceLayout.d.ts +0 -3
  116. package/dist/processing/layouts/hierarchyLayout.d.ts +0 -10
  117. package/dist/processing/layouts/index.d.ts +0 -8
  118. package/dist/processing/layouts/sankeyLayout.d.ts +0 -8
  119. package/dist/processing/layouts/simpleLayouts.d.ts +0 -7
  120. package/dist/processing/layouts/types.d.ts +0 -17
  121. package/dist/processing/networkDefaults.d.ts +0 -36
  122. package/dist/realtime/renderers/barRenderer.d.ts +0 -2
  123. package/dist/realtime/renderers/candlestickRenderer.d.ts +0 -2
  124. package/dist/realtime/renderers/lineRenderer.d.ts +0 -2
  125. package/dist/realtime/renderers/swarmRenderer.d.ts +0 -2
  126. package/dist/stream/NetworkSceneGraph.d.ts +0 -14
  127. package/dist/stream/index.d.ts +0 -16
  128. package/dist/types/canvasTypes.d.ts +0 -9
  129. package/dist/types/xyTypes.d.ts +0 -24
  130. package/dist/useBoundingRect.d.ts +0 -2
  131. package/dist/visualizationLayerBehavior/axis.d.ts +0 -36
  132. package/dist/visualizationLayerBehavior/general.d.ts +0 -80
@@ -1,4 +1,8 @@
1
- import type { Accessor } from "./types";
1
+ import { createLegend } from "./legendUtils";
2
+ import type { SelectionHookResult } from "./selectionUtils";
3
+ import type { OnObservationCallback } from "../../store/ObservationStore";
4
+ import type { Accessor, SelectionConfig, LinkedHoverProp, ChartMode } from "./types";
5
+ import type { MarginType } from "../../types/generalTypes";
2
6
  /**
3
7
  * Default fill color used when no colorBy is specified
4
8
  */
@@ -18,3 +22,94 @@ export declare function useColorScale(data: Array<Record<string, any>>, colorBy:
18
22
  * Used by BarChart and DotPlot.
19
23
  */
20
24
  export declare function useSortedData(data: Array<Record<string, any>>, sort: boolean | "asc" | "desc" | ((a: Record<string, any>, b: Record<string, any>) => number), valueAccessor: Accessor<number>): Array<Record<string, any>>;
25
+ /**
26
+ * Hook to set up selection and linked hover for a chart component.
27
+ * Consolidates normalizeLinkedHover, useSelection, useLinkedHover,
28
+ * and the customHoverBehavior callback that every HOC chart repeats.
29
+ *
30
+ * @param unwrapData - Deprecated / no-op. Hover data is always unwrapped
31
+ * (stream frames wrap the raw datum in { data, time, value, x, y }).
32
+ */
33
+ export declare function useChartSelection({ selection, linkedHover, fallbackFields, unwrapData, onObservation, chartType, chartId, }: {
34
+ selection?: SelectionConfig;
35
+ linkedHover?: LinkedHoverProp;
36
+ fallbackFields?: string[];
37
+ unwrapData?: boolean;
38
+ onObservation?: OnObservationCallback;
39
+ chartType?: string;
40
+ chartId?: string;
41
+ }): {
42
+ activeSelectionHook: SelectionHookResult | null;
43
+ customHoverBehavior: (d: Record<string, any> | null) => void;
44
+ customClickBehavior: (d: Record<string, any> | null) => void;
45
+ };
46
+ /**
47
+ * Hook to create a legend and compute margins with legend-aware adjustment.
48
+ * Consolidates the shouldShowLegend / createLegend / margin merge / right-margin
49
+ * expansion pattern that every chart with color encoding repeats.
50
+ */
51
+ export declare function useChartLegendAndMargin({ data, colorBy, colorScale, showLegend, userMargin, defaults, }: {
52
+ data: Array<Record<string, any>>;
53
+ colorBy: Accessor<string> | undefined;
54
+ colorScale: ((v: string) => string) | undefined;
55
+ showLegend: boolean | undefined;
56
+ userMargin: MarginType | undefined;
57
+ defaults?: {
58
+ top: number;
59
+ bottom: number;
60
+ left: number;
61
+ right: number;
62
+ };
63
+ }): {
64
+ legend: ReturnType<typeof createLegend> | undefined;
65
+ margin: {
66
+ top: number;
67
+ bottom: number;
68
+ left: number;
69
+ right: number;
70
+ };
71
+ };
72
+ interface ChartModeInput {
73
+ width?: number;
74
+ height?: number;
75
+ showGrid?: boolean;
76
+ enableHover?: boolean;
77
+ showLegend?: boolean;
78
+ showLabels?: boolean;
79
+ title?: string;
80
+ xLabel?: string;
81
+ yLabel?: string;
82
+ categoryLabel?: string;
83
+ valueLabel?: string;
84
+ /** When truthy, enableHover is forced true regardless of mode (LinkedCharts needs hover) */
85
+ linkedHover?: any;
86
+ }
87
+ interface ChartModeResult {
88
+ width: number;
89
+ height: number;
90
+ showAxes: boolean;
91
+ showGrid: boolean;
92
+ enableHover: boolean;
93
+ showLegend: boolean | undefined;
94
+ showLabels: boolean | undefined;
95
+ title: string | undefined;
96
+ xLabel: string | undefined;
97
+ yLabel: string | undefined;
98
+ categoryLabel: string | undefined;
99
+ valueLabel: string | undefined;
100
+ marginDefaults: {
101
+ top: number;
102
+ bottom: number;
103
+ left: number;
104
+ right: number;
105
+ };
106
+ }
107
+ /**
108
+ * Resolve chart display mode into concrete prop defaults.
109
+ * User-provided values always override mode defaults.
110
+ */
111
+ export declare function useChartMode(mode: ChartMode | undefined, userProps: ChartModeInput, primaryDefaults?: {
112
+ width?: number;
113
+ height?: number;
114
+ }): ChartModeResult;
115
+ export {};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * LOESS (Locally Weighted Scatterplot Smoothing) regression.
3
+ *
4
+ * For each x-point, fits a local weighted linear regression using tricube
5
+ * weights, producing a smooth curve that follows the data more closely
6
+ * than global polynomial regression.
7
+ *
8
+ * @param points - Array of [x, y] pairs (need not be sorted)
9
+ * @param bandwidth - Smoothing parameter 0-1. Lower = more local detail,
10
+ * higher = smoother. Default 0.3.
11
+ * @returns Array of [x, y_smoothed] pairs sorted by x
12
+ */
13
+ export declare function loess(points: [number, number][], bandwidth?: number): [number, number][];
@@ -0,0 +1,31 @@
1
+ import type { Accessor } from "./types";
2
+ /**
3
+ * Flatten a hierarchical data structure into an array of all nodes
4
+ * by recursively traversing children.
5
+ */
6
+ export declare function flattenHierarchy(data: Record<string, any> | null, childrenAccessor: string | ((d: any) => any[])): Array<Record<string, any>>;
7
+ /**
8
+ * Infer nodes from edges when a nodes array is not provided.
9
+ * Extracts unique source/target IDs and returns `{ id }` objects.
10
+ * Returns the provided nodes array if it's non-empty.
11
+ */
12
+ export declare function inferNodesFromEdges(nodes: any[] | undefined, edges: any[], sourceAccessor: string | ((d: any) => string), targetAccessor: string | ((d: any) => string)): Array<{
13
+ id: string;
14
+ }>;
15
+ /**
16
+ * Convert a valueAccessor prop into a hierarchy sum function.
17
+ * Used by TreeDiagram, Treemap, and CirclePack for d3-hierarchy's `.sum()`.
18
+ */
19
+ export declare function resolveHierarchySum(valueAccessor: string | ((d: any) => number)): (d: Record<string, any>) => number;
20
+ /**
21
+ * Create an edge style function for Sankey/Chord edge coloring.
22
+ * Handles edgeColorBy = "source" | "target" | "gradient" | function.
23
+ */
24
+ export declare function createEdgeStyleFn({ edgeColorBy, colorBy, colorScale, nodeStyleFn, edgeOpacity, baseStyle, }: {
25
+ edgeColorBy: "source" | "target" | "gradient" | ((d: any) => string);
26
+ colorBy: Accessor<string> | undefined;
27
+ colorScale: ((v: string) => string) | undefined;
28
+ nodeStyleFn: (d: any, index?: number) => Record<string, any>;
29
+ edgeOpacity: number;
30
+ baseStyle?: Record<string, string | number>;
31
+ }): (d: Record<string, any>) => Record<string, any>;
@@ -10,9 +10,25 @@ export interface TooltipFieldConfig {
10
10
  * Strings return themselves; functions return "value".
11
11
  */
12
12
  export declare function accessorName(acc: string | Function): string;
13
+ export declare function formatVal(v: unknown): string;
14
+ export declare function resolveValue(d: Record<string, any>, acc: string | ((d: Record<string, any>) => any)): unknown;
13
15
  /**
14
16
  * Build a default tooltipContent function for StreamXYFrame HOCs.
15
17
  * Receives HoverData ({ data, time, value, x, y }) and renders
16
18
  * labeled fields derived from the HOC's props.
17
19
  */
18
20
  export declare function buildDefaultTooltip(fields: TooltipFieldConfig[]): (hover: HoverData) => React.ReactNode;
21
+ /**
22
+ * Build a default tooltip for ordinal charts (BarChart, DotPlot, SwarmPlot, etc.).
23
+ * Shows a bold category header, formatted value, and optional group field.
24
+ *
25
+ * @param pieData - If true, extracts datum via `d.data?.[0] || d.data || d`
26
+ * (PieChart/DonutChart wrap data in arrays). Default: `d.data || d`.
27
+ */
28
+ export declare function buildOrdinalTooltip({ categoryAccessor, valueAccessor, groupAccessor, groupLabel, pieData, }: {
29
+ categoryAccessor: string | ((d: any) => any);
30
+ valueAccessor: string | ((d: any) => any);
31
+ groupAccessor?: string | ((d: any) => any);
32
+ groupLabel?: string;
33
+ pieData?: boolean;
34
+ }): (d: Record<string, any>) => React.ReactNode;
@@ -1,4 +1,5 @@
1
1
  import type { MarginType } from "../../types/generalTypes";
2
+ import type { OnObservationCallback } from "../../store/ObservationStore";
2
3
  /**
3
4
  * Selection consumption config — makes this chart react to a named selection
4
5
  */
@@ -32,10 +33,17 @@ export type LinkedBrushProp = string | {
32
33
  xField?: string;
33
34
  yField?: string;
34
35
  };
36
+ /**
37
+ * Chart display mode — controls default chrome, size, and interaction.
38
+ * User-provided props always override mode defaults.
39
+ */
40
+ export type ChartMode = "primary" | "context" | "sparkline";
35
41
  /**
36
42
  * Base props shared across all chart components
37
43
  */
38
44
  export interface BaseChartProps {
45
+ /** Display mode: "primary" (full chrome), "context" (compact), "sparkline" (inline) */
46
+ mode?: ChartMode;
39
47
  /** Chart width in pixels. Default: 600 */
40
48
  width?: number;
41
49
  /** Chart height in pixels. Default: 400 */
@@ -52,6 +60,11 @@ export interface BaseChartProps {
52
60
  linkedHover?: LinkedHoverProp;
53
61
  /** Produce brush-based selections for cross-filtering */
54
62
  linkedBrush?: LinkedBrushProp;
63
+ /** Callback emitting structured observation events on user interaction.
64
+ * Used by AI agent systems to observe user behavior for insight generation. */
65
+ onObservation?: OnObservationCallback;
66
+ /** Identifier for this chart instance, included in observation events */
67
+ chartId?: string;
55
68
  }
56
69
  /**
57
70
  * Axis configuration props
@@ -72,9 +85,11 @@ export interface AxisConfig {
72
85
  */
73
86
  export type Accessor<T = any> = string | ((d: any, i?: number) => T);
74
87
  /**
75
- * Generic accessor type that provides autocomplete when TDatum is specified
88
+ * Generic accessor type that provides autocomplete when TDatum is specified.
89
+ * Uses Record<string, any> in the function param so HOC charts can pass
90
+ * accessors to Stream Frames without contravariance errors under strict mode.
76
91
  */
77
- export type ChartAccessor<TDatum, T> = (keyof TDatum & string) | ((d: TDatum, i?: number) => T);
92
+ export type ChartAccessor<TDatum, T> = (keyof TDatum & string) | ((d: Record<string, any>, i?: number) => T);
78
93
  /**
79
94
  * Color configuration
80
95
  */
@@ -2,9 +2,8 @@
2
2
  * Validates chart data and accessors at render time.
3
3
  * Returns null if data is valid, or an error message string if not.
4
4
  *
5
- * Validation is intentionally lightweight it checks the first data point
6
- * to catch common mistakes (wrong field names, missing data) without
7
- * iterating the entire dataset.
5
+ * Samples first, last, and a middle element to catch common mistakes
6
+ * (wrong field names, missing data) without iterating the entire dataset.
8
7
  */
9
8
  type AccessorLike = string | ((...args: any[]) => any);
10
9
  interface ArrayDataValidation {
@@ -9,6 +9,23 @@ export interface ValidationResult {
9
9
  valid: boolean;
10
10
  errors: string[];
11
11
  }
12
+ export type PropType = "string" | "number" | "boolean" | "array" | "object" | "function";
13
+ export interface PropDef {
14
+ type: PropType | PropType[];
15
+ enum?: readonly string[];
16
+ }
17
+ type DataShape = "array" | "object" | "network" | "realtime";
18
+ export interface ComponentSpec {
19
+ /** Props that must be present */
20
+ required: string[];
21
+ /** Data shape — drives which validateChartData helper to call */
22
+ dataShape: DataShape;
23
+ /** Accessor props to validate against data (key = prop name) */
24
+ dataAccessors: string[];
25
+ /** Per-prop type / enum constraints */
26
+ props: Record<string, PropDef>;
27
+ }
28
+ export declare const VALIDATION_MAP: Record<string, ComponentSpec>;
12
29
  /**
13
30
  * Validate props for a Semiotic HOC chart component.
14
31
  *
@@ -16,3 +33,4 @@ export interface ValidationResult {
16
33
  * unknown prop names (typo detection), and data shape + accessor validity.
17
34
  */
18
35
  export declare function validateProps(componentName: string, props: Record<string, any>): ValidationResult;
36
+ export {};
@@ -93,6 +93,10 @@ export interface AreaChartProps<TDatum extends Record<string, any> = Record<stri
93
93
  * Tooltip configuration
94
94
  */
95
95
  tooltip?: TooltipProp;
96
+ /**
97
+ * Annotation objects to render on the chart
98
+ */
99
+ annotations?: Record<string, any>[];
96
100
  /**
97
101
  * Additional StreamXYFrame props for advanced customization
98
102
  * For full control, consider using StreamXYFrame directly
@@ -90,6 +90,12 @@ export interface BubbleChartProps<TDatum extends Record<string, any> = Record<st
90
90
  * Marginal distribution plots in axis margins
91
91
  */
92
92
  marginalGraphics?: MarginalGraphicsConfig;
93
+ /** Accessor for unique point IDs, used by point-anchored annotations */
94
+ pointIdAccessor?: ChartAccessor<TDatum, string>;
95
+ /**
96
+ * Annotation objects to render on the chart
97
+ */
98
+ annotations?: Record<string, any>[];
93
99
  /**
94
100
  * Additional StreamXYFrame props for advanced customization
95
101
  * For full control, consider using StreamXYFrame directly
@@ -86,6 +86,10 @@ export interface HeatmapProps<TDatum extends Record<string, any> = Record<string
86
86
  * Tooltip configuration
87
87
  */
88
88
  tooltip?: TooltipProp;
89
+ /**
90
+ * Annotation objects to render on the chart
91
+ */
92
+ annotations?: Record<string, any>[];
89
93
  /**
90
94
  * Additional StreamXYFrame props for advanced customization
91
95
  * For full control, consider using StreamXYFrame directly
@@ -109,6 +109,12 @@ export interface LineChartProps<TDatum extends Record<string, any> = Record<stri
109
109
  * Tooltip configuration
110
110
  */
111
111
  tooltip?: TooltipProp;
112
+ /** Accessor for unique point IDs, used by point-anchored annotations (when showPoints is true) */
113
+ pointIdAccessor?: ChartAccessor<TDatum, string>;
114
+ /**
115
+ * Annotation objects to render on the chart
116
+ */
117
+ annotations?: Record<string, any>[];
112
118
  /**
113
119
  * Additional StreamXYFrame props for advanced customization
114
120
  * For full control, consider using StreamXYFrame directly
@@ -34,6 +34,10 @@ export interface ScatterplotProps<TDatum extends Record<string, any> = Record<st
34
34
  tooltip?: TooltipProp;
35
35
  /** Marginal distribution plots in axis margins */
36
36
  marginalGraphics?: MarginalGraphicsConfig;
37
+ /** Accessor for unique point IDs, used by point-anchored annotations */
38
+ pointIdAccessor?: ChartAccessor<TDatum, string>;
39
+ /** Annotation objects to render on the chart */
40
+ annotations?: Record<string, any>[];
37
41
  /** Additional StreamXYFrame props for advanced customization */
38
42
  frameProps?: Partial<Omit<StreamXYFrameProps, "chartType" | "data" | "size">>;
39
43
  }
@@ -97,6 +97,10 @@ export interface StackedAreaChartProps<TDatum extends Record<string, any> = Reco
97
97
  * Tooltip configuration
98
98
  */
99
99
  tooltip?: TooltipProp;
100
+ /**
101
+ * Annotation objects to render on the chart
102
+ */
103
+ annotations?: Record<string, any>[];
100
104
  /**
101
105
  * Additional StreamXYFrame props for advanced customization
102
106
  * For full control, consider using StreamXYFrame directly
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Vega-Lite to Semiotic translator.
3
+ * Converts a Vega-Lite spec into a Semiotic ChartConfig.
4
+ *
5
+ * Scope: core marks (bar, line, point, area, rect, arc, circle, square, tick)
6
+ * with basic encodings. No layers, facets, selections, or complex transforms.
7
+ */
8
+ import type { ChartConfig } from "../export/chartConfig";
9
+ export interface VegaLiteEncoding {
10
+ field?: string;
11
+ type?: "quantitative" | "nominal" | "ordinal" | "temporal";
12
+ aggregate?: string;
13
+ scale?: {
14
+ scheme?: string;
15
+ range?: any;
16
+ domain?: any;
17
+ };
18
+ axis?: {
19
+ title?: string;
20
+ labelAngle?: number;
21
+ };
22
+ value?: any;
23
+ bin?: boolean | {
24
+ maxbins?: number;
25
+ };
26
+ stack?: boolean | string | null;
27
+ }
28
+ export interface VegaLiteSpec {
29
+ mark: string | {
30
+ type: string;
31
+ [key: string]: any;
32
+ };
33
+ data?: {
34
+ values?: any[];
35
+ url?: string;
36
+ };
37
+ encoding?: Record<string, VegaLiteEncoding>;
38
+ width?: number;
39
+ height?: number;
40
+ title?: string | {
41
+ text: string;
42
+ };
43
+ transform?: any[];
44
+ [key: string]: any;
45
+ }
46
+ export declare function fromVegaLite(spec: VegaLiteSpec): ChartConfig & {
47
+ warnings?: string[];
48
+ };
@@ -0,0 +1,29 @@
1
+ import type { SerializedSelections } from "./selectionSerializer";
2
+ export interface ChartConfig {
3
+ /** Component name, e.g. "LineChart", "SankeyDiagram" */
4
+ component: string;
5
+ /** Serializable props only — functions and React elements stripped */
6
+ props: Record<string, any>;
7
+ /** Config schema version */
8
+ version: string;
9
+ /** ISO 8601 timestamp */
10
+ createdAt: string;
11
+ /** Optional serialized selection/brush state */
12
+ selections?: SerializedSelections;
13
+ }
14
+ export interface ToConfigOptions {
15
+ /** Include data arrays in the config. Default: true */
16
+ includeData?: boolean;
17
+ /** Serialized selection state to embed */
18
+ selections?: SerializedSelections;
19
+ }
20
+ export type CopyFormat = "json" | "jsx";
21
+ export declare function toConfig(componentName: string, props: Record<string, any>, options?: ToConfigOptions): ChartConfig;
22
+ export declare function fromConfig(config: ChartConfig): {
23
+ componentName: string;
24
+ props: Record<string, any>;
25
+ };
26
+ export declare function toURL(config: ChartConfig): string;
27
+ export declare function fromURL(urlString: string): ChartConfig;
28
+ export declare function copyConfig(config: ChartConfig, format?: CopyFormat): Promise<void>;
29
+ export declare function configToJSX(config: ChartConfig): string;
@@ -0,0 +1,20 @@
1
+ import type { Selection } from "../store/SelectionStore";
2
+ export type SerializedFieldSelection = {
3
+ type: "point";
4
+ values: any[];
5
+ } | {
6
+ type: "interval";
7
+ range: [number, number];
8
+ };
9
+ export interface SerializedSelection {
10
+ name: string;
11
+ resolution: "union" | "intersect" | "crossfilter";
12
+ clauses: Array<{
13
+ clientId: string;
14
+ type: "point" | "interval";
15
+ fields: Record<string, SerializedFieldSelection>;
16
+ }>;
17
+ }
18
+ export type SerializedSelections = Record<string, SerializedSelection>;
19
+ export declare function serializeSelections(selections: Map<string, Selection>): SerializedSelections;
20
+ export declare function deserializeSelections(serialized: SerializedSelections): Map<string, Selection>;
@@ -1,2 +1,2 @@
1
1
  export declare const areaLink: (d: any) => string;
2
- export declare function circularAreaLink(link: any): any;
2
+ export declare function circularAreaLink(link: any): string | null;