semiotic 3.1.2 → 3.2.1
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.
- package/CLAUDE.md +173 -213
- package/LICENSE +197 -10
- package/README.md +12 -11
- package/ai/dist/componentRegistry.js +6 -0
- package/ai/dist/mcp-server.js +115 -5
- package/ai/examples.md +184 -0
- package/ai/schema.json +4140 -888
- package/ai/system-prompt.md +36 -1
- package/dist/components/ChartContainer.d.ts +2 -0
- package/dist/components/DataSummaryContext.d.ts +12 -0
- package/dist/components/ThemeProvider.d.ts +5 -3
- package/dist/components/Tooltip/FlippingTooltip.d.ts +34 -0
- package/dist/components/charts/geo/ChoroplethMap.d.ts +1 -1
- package/dist/components/charts/index.d.ts +12 -1
- package/dist/components/charts/ordinal/BarChart.d.ts +4 -1
- package/dist/components/charts/ordinal/BoxPlot.d.ts +4 -1
- package/dist/components/charts/ordinal/DonutChart.d.ts +1 -1
- package/dist/components/charts/ordinal/DotPlot.d.ts +4 -1
- package/dist/components/charts/ordinal/FunnelChart.d.ts +57 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +4 -1
- package/dist/components/charts/ordinal/Histogram.d.ts +17 -2
- package/dist/components/charts/ordinal/LikertChart.d.ts +94 -0
- package/dist/components/charts/ordinal/PieChart.d.ts +1 -1
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +12 -7
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +4 -1
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +15 -1
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +65 -0
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +17 -2
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +20 -0
- package/dist/components/charts/shared/annotationResolvers.d.ts +28 -0
- package/dist/components/charts/shared/colorManipulation.d.ts +15 -0
- package/dist/components/charts/shared/formatUtils.d.ts +28 -0
- package/dist/components/charts/shared/hatchPattern.d.ts +35 -0
- package/dist/components/charts/shared/hooks.d.ts +39 -3
- package/dist/components/charts/shared/legendUtils.d.ts +2 -1
- package/dist/components/charts/shared/selectionUtils.d.ts +16 -1
- package/dist/components/charts/shared/statisticalOverlays.d.ts +49 -5
- package/dist/components/charts/shared/statsTooltip.d.ts +11 -0
- package/dist/components/charts/shared/types.d.ts +26 -2
- package/dist/components/charts/shared/useChartSetup.d.ts +12 -2
- package/dist/components/charts/shared/useLikertAggregation.d.ts +51 -0
- package/dist/components/charts/shared/useOrdinalBrush.d.ts +28 -0
- package/dist/components/charts/shared/useOrdinalStreaming.d.ts +54 -0
- package/dist/components/charts/shared/useStreamingLegend.d.ts +2 -2
- package/dist/components/charts/shared/validateProps.d.ts +2 -2
- package/dist/components/charts/shared/validationMap.d.ts +12 -0
- package/dist/components/charts/xy/AreaChart.d.ts +11 -0
- package/dist/components/charts/xy/Heatmap.d.ts +1 -1
- package/dist/components/charts/xy/MinimapChart.d.ts +1 -1
- package/dist/components/charts/xy/MultiAxisLineChart.d.ts +71 -0
- package/dist/components/charts/xy/StackedAreaChart.d.ts +11 -0
- package/dist/components/realtime/types.d.ts +6 -0
- package/dist/components/semiotic-ai.d.ts +4 -0
- package/dist/components/semiotic-ordinal.d.ts +5 -0
- package/dist/components/semiotic-themes.d.ts +80 -0
- package/dist/components/semiotic-utils.d.ts +30 -0
- package/dist/components/semiotic-xy.d.ts +1 -0
- package/dist/components/semiotic.d.ts +11 -5
- package/dist/components/store/LinkedCrosshairStore.d.ts +11 -0
- package/dist/components/store/ThemeStore.d.ts +22 -2
- package/dist/components/store/useSelection.d.ts +1 -0
- package/dist/components/stream/AccessibleDataTable.d.ts +28 -6
- package/dist/components/stream/FocusRing.d.ts +33 -0
- package/dist/components/stream/OrdinalBrushOverlay.d.ts +43 -0
- package/dist/components/stream/OrdinalPipelineStore.d.ts +16 -0
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -1
- package/dist/components/stream/PipelineStore.d.ts +7 -47
- package/dist/components/stream/SVGOverlay.d.ts +9 -3
- package/dist/components/stream/SceneGraph.d.ts +6 -1
- package/dist/components/stream/XYBrushOverlay.d.ts +47 -0
- package/dist/components/stream/accessorUtils.d.ts +14 -0
- package/dist/components/stream/geoTypes.d.ts +5 -1
- package/dist/components/stream/keyboardNav.d.ts +85 -9
- package/dist/components/stream/layouts/hierarchySceneBuilders.d.ts +35 -0
- package/dist/components/stream/layouts/hierarchyUtils.d.ts +25 -0
- package/dist/components/stream/networkTypes.d.ts +7 -1
- package/dist/components/stream/ordinalSceneBuilders/barFunnelScene.d.ts +27 -0
- package/dist/components/stream/ordinalSceneBuilders/funnelScene.d.ts +26 -0
- package/dist/components/stream/ordinalSceneBuilders/swimlaneScene.d.ts +12 -0
- package/dist/components/stream/ordinalTypes.d.ts +30 -4
- package/dist/components/stream/pipelineDecay.d.ts +20 -0
- package/dist/components/stream/pipelinePulse.d.ts +24 -0
- package/dist/components/stream/pipelineTransitions.d.ts +59 -0
- package/dist/components/stream/renderers/barFunnelCanvasRenderer.d.ts +12 -0
- package/dist/components/stream/renderers/pointCanvasRenderer.d.ts +2 -1
- package/dist/components/stream/renderers/trapezoidCanvasRenderer.d.ts +15 -0
- package/dist/components/stream/sceneUtils.d.ts +10 -0
- package/dist/components/stream/types.d.ts +29 -4
- package/dist/components/stream/useMediaPreferences.d.ts +11 -0
- package/dist/components/stream/xySceneBuilders/areaScene.d.ts +13 -0
- package/dist/components/stream/xySceneBuilders/barScene.d.ts +18 -0
- package/dist/components/stream/xySceneBuilders/boundsScene.d.ts +8 -0
- package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +10 -0
- package/dist/components/stream/xySceneBuilders/emitPointNodes.d.ts +13 -0
- package/dist/components/stream/xySceneBuilders/heatmapScene.d.ts +3 -0
- package/dist/components/stream/xySceneBuilders/lineScene.d.ts +12 -0
- package/dist/components/stream/xySceneBuilders/pointScene.d.ts +12 -0
- package/dist/components/stream/xySceneBuilders/swarmScene.d.ts +10 -0
- package/dist/components/stream/xySceneBuilders/types.d.ts +93 -0
- package/dist/components/stream/xySceneBuilders/waterfallScene.d.ts +12 -0
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai-statisticalOverlays-C2PPlmXv.js +1 -0
- package/dist/semiotic-ai.d.ts +4 -0
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-ordinal.d.ts +5 -0
- package/dist/semiotic-statisticalOverlays-DGX_WWc5.js +1 -0
- package/dist/semiotic-themes.d.ts +80 -0
- package/dist/semiotic-themes.min.js +1 -0
- package/dist/semiotic-themes.module.min.js +1 -0
- package/dist/semiotic-utils.d.ts +30 -0
- package/dist/semiotic-utils.min.js +1 -0
- package/dist/semiotic-utils.module.min.js +1 -0
- package/dist/semiotic-xy.d.ts +1 -0
- package/dist/semiotic.d.ts +11 -5
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy-statisticalOverlays-C2PPlmXv.js +1 -0
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +38 -12
- package/dist/semiotic-ai-statisticalOverlays-C1f7TYyD.js +0 -1
- package/dist/semiotic-statisticalOverlays-C1f7TYyD.js +0 -1
- package/dist/xy-statisticalOverlays-C1f7TYyD.js +0 -1
|
@@ -3,7 +3,7 @@ import type { ScaleLinear, ScaleBand } from "d3-scale";
|
|
|
3
3
|
import type { ArrowOfTime, WindowMode, HoverAnnotationConfig, HoverData, AnnotationContext } from "../realtime/types";
|
|
4
4
|
import type { Style, DecayConfig, PulseConfig, TransitionConfig, StalenessConfig } from "./types";
|
|
5
5
|
import type { LegendGroup } from "../types/legendTypes";
|
|
6
|
-
export type OrdinalChartType = "bar" | "clusterbar" | "point" | "swarm" | "pie" | "donut" | "boxplot" | "violin" | "histogram" | "ridgeline" | "timeline";
|
|
6
|
+
export type OrdinalChartType = "bar" | "clusterbar" | "point" | "swarm" | "pie" | "donut" | "boxplot" | "violin" | "histogram" | "ridgeline" | "timeline" | "funnel" | "bar-funnel" | "swimlane";
|
|
7
7
|
export interface OrdinalScales {
|
|
8
8
|
o: ScaleBand<string>;
|
|
9
9
|
r: ScaleLinear<number, number>;
|
|
@@ -102,9 +102,18 @@ export interface ConnectorSceneNode {
|
|
|
102
102
|
group?: string;
|
|
103
103
|
_targetOpacity?: number;
|
|
104
104
|
}
|
|
105
|
+
export interface TrapezoidSceneNode {
|
|
106
|
+
type: "trapezoid";
|
|
107
|
+
/** Four corners: [top-left, top-right, bottom-right, bottom-left] */
|
|
108
|
+
points: [number, number][];
|
|
109
|
+
style: Style;
|
|
110
|
+
datum: any;
|
|
111
|
+
category?: string;
|
|
112
|
+
_targetOpacity?: number;
|
|
113
|
+
}
|
|
105
114
|
export type { Style, PointSceneNode, RectSceneNode } from "./types";
|
|
106
115
|
import type { PointSceneNode, RectSceneNode } from "./types";
|
|
107
|
-
export type OrdinalSceneNode = RectSceneNode | PointSceneNode | WedgeSceneNode | BoxplotSceneNode | ViolinSceneNode | ConnectorSceneNode;
|
|
116
|
+
export type OrdinalSceneNode = RectSceneNode | PointSceneNode | WedgeSceneNode | BoxplotSceneNode | ViolinSceneNode | ConnectorSceneNode | TrapezoidSceneNode;
|
|
108
117
|
export interface OrdinalColumn {
|
|
109
118
|
name: string;
|
|
110
119
|
x: number;
|
|
@@ -144,6 +153,8 @@ export interface OrdinalPipelineConfig {
|
|
|
144
153
|
showOutliers?: boolean;
|
|
145
154
|
showIQR?: boolean;
|
|
146
155
|
amplitude?: number;
|
|
156
|
+
connectorOpacity?: number;
|
|
157
|
+
showLabels?: boolean;
|
|
147
158
|
oSort?: ((a: any, b: any) => number) | boolean | "asc" | "desc";
|
|
148
159
|
connectorAccessor?: string | ((d: any) => string);
|
|
149
160
|
connectorStyle?: Style | ((d: any) => Style);
|
|
@@ -189,6 +200,8 @@ export interface StreamOrdinalFrameProps<T = Record<string, any>> {
|
|
|
189
200
|
showOutliers?: boolean;
|
|
190
201
|
showIQR?: boolean;
|
|
191
202
|
amplitude?: number;
|
|
203
|
+
connectorOpacity?: number;
|
|
204
|
+
showLabels?: boolean;
|
|
192
205
|
rExtent?: [number?, number?];
|
|
193
206
|
oExtent?: string[];
|
|
194
207
|
extentPadding?: number;
|
|
@@ -203,9 +216,10 @@ export interface StreamOrdinalFrameProps<T = Record<string, any>> {
|
|
|
203
216
|
colorScheme?: string | string[];
|
|
204
217
|
barColors?: Record<string, string>;
|
|
205
218
|
showAxes?: boolean;
|
|
219
|
+
showCategoryTicks?: boolean;
|
|
206
220
|
oLabel?: string;
|
|
207
221
|
rLabel?: string;
|
|
208
|
-
oFormat?: (d: string) => string;
|
|
222
|
+
oFormat?: (d: string, index?: number) => string;
|
|
209
223
|
rFormat?: (d: number | string) => string;
|
|
210
224
|
enableHover?: boolean;
|
|
211
225
|
hoverAnnotation?: boolean | HoverAnnotationConfig;
|
|
@@ -234,12 +248,24 @@ export interface StreamOrdinalFrameProps<T = Record<string, any>> {
|
|
|
234
248
|
className?: string;
|
|
235
249
|
background?: string;
|
|
236
250
|
centerContent?: ReactNode;
|
|
251
|
+
/** Brush configuration. "r" brushes the value axis. */
|
|
252
|
+
brush?: boolean | "r" | {
|
|
253
|
+
dimension?: "r";
|
|
254
|
+
};
|
|
255
|
+
/** Callback when brush selection changes. Extent is in data coordinates, or null when cleared. */
|
|
256
|
+
onBrush?: (extent: {
|
|
257
|
+
r: [number, number];
|
|
258
|
+
} | null) => void;
|
|
237
259
|
decay?: DecayConfig;
|
|
238
260
|
pulse?: PulseConfig;
|
|
239
261
|
transition?: TransitionConfig;
|
|
240
262
|
staleness?: StalenessConfig;
|
|
241
|
-
/** Render a visually-hidden data table from the scene graph for screen readers
|
|
263
|
+
/** Render a visually-hidden data table from the scene graph for screen readers */
|
|
242
264
|
accessibleTable?: boolean;
|
|
265
|
+
/** Accessible description overriding the auto-generated aria-label on the chart container */
|
|
266
|
+
description?: string;
|
|
267
|
+
/** Accessible summary rendered as a screen-reader-only note */
|
|
268
|
+
summary?: string;
|
|
243
269
|
}
|
|
244
270
|
export interface StreamOrdinalFrameHandle<T = Record<string, any>> {
|
|
245
271
|
push(datum: T): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decay encoding for XY pipeline scene nodes.
|
|
3
|
+
*
|
|
4
|
+
* Applies age-based opacity fade to scene nodes — linear, exponential, or step.
|
|
5
|
+
* Per-vertex decay for line/area nodes, uniform for discrete nodes (point, rect, etc.).
|
|
6
|
+
*
|
|
7
|
+
* Dependencies: types (SceneNode, DecayConfig)
|
|
8
|
+
* Consumed by: PipelineStore.computeScene (after scene build, before transitions)
|
|
9
|
+
*/
|
|
10
|
+
import type { SceneNode, DecayConfig } from "./types";
|
|
11
|
+
/**
|
|
12
|
+
* Compute decay opacity for a datum at `bufferIndex` out of `bufferSize` items.
|
|
13
|
+
* Index 0 = oldest, bufferSize-1 = newest. Returns 0–1.
|
|
14
|
+
*/
|
|
15
|
+
export declare function computeDecayOpacity(decay: DecayConfig, bufferIndex: number, bufferSize: number): number;
|
|
16
|
+
/**
|
|
17
|
+
* Apply decay opacity to a list of scene nodes.
|
|
18
|
+
* Uses the datum's index in the buffer data array.
|
|
19
|
+
*/
|
|
20
|
+
export declare function applyDecay(decay: DecayConfig, nodes: SceneNode[], data: Record<string, any>[]): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pulse encoding for XY pipeline scene nodes.
|
|
3
|
+
*
|
|
4
|
+
* Applies time-based glow to recently-inserted data points. Intensity fades
|
|
5
|
+
* from 1 (just inserted) to 0 (pulse expired) over a configurable duration.
|
|
6
|
+
*
|
|
7
|
+
* Dependencies: types (SceneNode, PulseConfig), RingBuffer (timestamp buffer)
|
|
8
|
+
* Consumed by: PipelineStore.computeScene (after decay, before transitions)
|
|
9
|
+
*/
|
|
10
|
+
import type { SceneNode, PulseConfig } from "./types";
|
|
11
|
+
import type { RingBuffer } from "../realtime/RingBuffer";
|
|
12
|
+
/**
|
|
13
|
+
* Compute pulse intensity for a datum inserted at `insertTime`.
|
|
14
|
+
* Returns 0–1 (1 = just inserted, 0 = pulse expired).
|
|
15
|
+
*/
|
|
16
|
+
export declare function computePulseIntensity(pulse: PulseConfig, insertTime: number, now: number): number;
|
|
17
|
+
/**
|
|
18
|
+
* Apply pulse glow to scene nodes using insertion timestamps.
|
|
19
|
+
*/
|
|
20
|
+
export declare function applyPulse(pulse: PulseConfig, nodes: SceneNode[], data: Record<string, any>[], timestampBuffer: RingBuffer<number>): void;
|
|
21
|
+
/**
|
|
22
|
+
* Check whether there are active pulse animations needing continuous rendering.
|
|
23
|
+
*/
|
|
24
|
+
export declare function hasActivePulses(pulse: PulseConfig, timestampBuffer: RingBuffer<number> | null): boolean;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transition animation for XY pipeline scene nodes.
|
|
3
|
+
*
|
|
4
|
+
* Handles identity-based enter/update/exit transitions:
|
|
5
|
+
* - snapshotPositions: captures current scene state before rebuild
|
|
6
|
+
* - getNodeIdentity: stable key generation per node type
|
|
7
|
+
* - startTransition: sets up interpolation from old→new positions
|
|
8
|
+
* - advanceTransition: per-frame tick with easing
|
|
9
|
+
*
|
|
10
|
+
* Dependencies: pipelineTransitionUtils (lerp, easing, ActiveTransition)
|
|
11
|
+
* Consumed by: PipelineStore.computeScene (after decay/pulse)
|
|
12
|
+
*/
|
|
13
|
+
import type { SceneNode, TransitionConfig } from "./types";
|
|
14
|
+
import type { ActiveTransition } from "./pipelineTransitionUtils";
|
|
15
|
+
export type PrevPosition = {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
w?: number;
|
|
19
|
+
h?: number;
|
|
20
|
+
r?: number;
|
|
21
|
+
opacity?: number;
|
|
22
|
+
};
|
|
23
|
+
export type PrevPath = {
|
|
24
|
+
topPath?: [number, number][];
|
|
25
|
+
bottomPath?: [number, number][];
|
|
26
|
+
path?: [number, number][];
|
|
27
|
+
opacity?: number;
|
|
28
|
+
};
|
|
29
|
+
/** Context needed from PipelineStore for identity resolution */
|
|
30
|
+
export interface TransitionContext {
|
|
31
|
+
runtimeMode?: "streaming" | "bounded";
|
|
32
|
+
getX: (d: any) => number;
|
|
33
|
+
getY: (d: any) => number;
|
|
34
|
+
getCategory?: (d: any) => string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get a stable identity key for a scene node.
|
|
38
|
+
*/
|
|
39
|
+
export declare function getNodeIdentity(ctx: TransitionContext, node: SceneNode, index: number): string | null;
|
|
40
|
+
/**
|
|
41
|
+
* Snapshot current scene node positions before rebuild.
|
|
42
|
+
*/
|
|
43
|
+
export declare function snapshotPositions(ctx: TransitionContext, scene: SceneNode[], prevPositionMap: Map<string, PrevPosition>, prevPathMap: Map<string, PrevPath>): void;
|
|
44
|
+
export interface TransitionState {
|
|
45
|
+
scene: SceneNode[];
|
|
46
|
+
exitNodes: SceneNode[];
|
|
47
|
+
activeTransition: ActiveTransition | null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* After scene rebuild, set up transition from old to new positions.
|
|
51
|
+
* Detects entering nodes (new, no prev match) and exiting nodes (prev, no new match).
|
|
52
|
+
* Mutates scene and exitNodes in place. Returns updated state.
|
|
53
|
+
*/
|
|
54
|
+
export declare function startTransition(ctx: TransitionContext, transition: TransitionConfig, state: TransitionState, prevPositionMap: Map<string, PrevPosition>, prevPathMap: Map<string, PrevPath>): TransitionState;
|
|
55
|
+
/**
|
|
56
|
+
* Advance the transition animation. Returns true if still animating.
|
|
57
|
+
* Mutates scene nodes in place.
|
|
58
|
+
*/
|
|
59
|
+
export declare function advanceTransition(now: number, transition: TransitionConfig, state: TransitionState, prevPositionMap: Map<string, PrevPosition>, prevPathMap: Map<string, PrevPath>): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OrdinalLayout, OrdinalScales, OrdinalSceneNode } from "../ordinalTypes";
|
|
2
|
+
export declare const barFunnelHatchRenderer: (ctx: CanvasRenderingContext2D, nodes: OrdinalSceneNode[], _scales: OrdinalScales, _layout: OrdinalLayout) => void;
|
|
3
|
+
/**
|
|
4
|
+
* Canvas renderer for bar-funnel labels.
|
|
5
|
+
*
|
|
6
|
+
* Draws a floating label above each bar (or bar group) showing:
|
|
7
|
+
* - Bold percentage (of first step)
|
|
8
|
+
* - Raw value below it
|
|
9
|
+
*
|
|
10
|
+
* Labels appear on a white rounded-rect background (matching the reference images).
|
|
11
|
+
*/
|
|
12
|
+
export declare const barFunnelLabelRenderer: (ctx: CanvasRenderingContext2D, nodes: OrdinalSceneNode[], _scales: OrdinalScales, _layout: OrdinalLayout) => void;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { StreamRendererFn } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* Canvas point renderer.
|
|
4
|
-
* Renders PointSceneNode as circles. Used
|
|
4
|
+
* Renders PointSceneNode as circles. Used by Scatterplot, BubbleChart, SwarmChart,
|
|
5
|
+
* and showPoints on LineChart, AreaChart, and StackedAreaChart.
|
|
5
6
|
* Supports pulse glow effect via _pulseIntensity/_pulseColor fields.
|
|
6
7
|
*/
|
|
7
8
|
export declare const pointCanvasRenderer: StreamRendererFn;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { OrdinalLayout, OrdinalScales, OrdinalSceneNode } from "../ordinalTypes";
|
|
2
|
+
/**
|
|
3
|
+
* Canvas renderer for trapezoid (funnel connector) nodes.
|
|
4
|
+
* Draws filled quadrilaterals connecting consecutive funnel steps.
|
|
5
|
+
*/
|
|
6
|
+
export declare const trapezoidCanvasRenderer: (ctx: CanvasRenderingContext2D, nodes: OrdinalSceneNode[], _scales: OrdinalScales, _layout: OrdinalLayout) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Canvas renderer for funnel labels.
|
|
9
|
+
*
|
|
10
|
+
* Renders white text with dark outline (matching reference images):
|
|
11
|
+
* - Step name: bold, centered at row top, shown once per step
|
|
12
|
+
* - Value (percent): bold, centered in each bar. Suppressed if text overflows bar.
|
|
13
|
+
* First step suppresses "(100%)" since it's always 100%.
|
|
14
|
+
*/
|
|
15
|
+
export declare const funnelLabelRenderer: (ctx: CanvasRenderingContext2D, nodes: OrdinalSceneNode[], _scales: OrdinalScales, _layout: OrdinalLayout) => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SceneNode } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Extract a display color from a scene node's style.
|
|
4
|
+
* For lines/areas, prefers stroke (the visible line color).
|
|
5
|
+
* For points/rects, prefers fill.
|
|
6
|
+
* For heatcells, reads the top-level `fill` field (style is optional).
|
|
7
|
+
* For candlesticks, uses `upColor`/`downColor` based on direction.
|
|
8
|
+
* Returns null if no color can be resolved (e.g. CanvasPattern fill with no stroke).
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveNodeColor(node: SceneNode | null): string | null;
|
|
@@ -61,7 +61,8 @@ export interface Style {
|
|
|
61
61
|
strokeWidth?: number;
|
|
62
62
|
strokeDasharray?: string;
|
|
63
63
|
strokeLinecap?: "butt" | "round" | "square";
|
|
64
|
-
|
|
64
|
+
/** Fill color or CanvasPattern (e.g. from createHatchPattern) */
|
|
65
|
+
fill?: string | CanvasPattern;
|
|
65
66
|
fillOpacity?: number;
|
|
66
67
|
opacity?: number;
|
|
67
68
|
/** For icon/isotype bars: an image to stamp instead of filling */
|
|
@@ -91,6 +92,8 @@ export interface LineSceneNode {
|
|
|
91
92
|
_decayOpacities?: number[];
|
|
92
93
|
/** Animation target opacity (set during enter/exit transitions) */
|
|
93
94
|
_targetOpacity?: number;
|
|
95
|
+
/** Captured start opacity for linear interpolation (avoids compounding from per-tick mutation) */
|
|
96
|
+
_startOpacity?: number;
|
|
94
97
|
/** Stable identity key for transition tracking */
|
|
95
98
|
_transitionKey?: string;
|
|
96
99
|
/** Previous path coordinates for interpolation during transitions */
|
|
@@ -122,6 +125,8 @@ export interface AreaSceneNode {
|
|
|
122
125
|
_decayOpacities?: number[];
|
|
123
126
|
/** Animation target opacity (set during enter/exit transitions) */
|
|
124
127
|
_targetOpacity?: number;
|
|
128
|
+
/** Captured start opacity for linear interpolation (avoids compounding from per-tick mutation) */
|
|
129
|
+
_startOpacity?: number;
|
|
125
130
|
/** Stable identity key for transition tracking */
|
|
126
131
|
_transitionKey?: string;
|
|
127
132
|
/** Previous top path coordinates for interpolation during transitions */
|
|
@@ -342,13 +347,15 @@ export interface StreamXYFrameProps<T = Record<string, any>> {
|
|
|
342
347
|
orient: "left" | "right" | "top" | "bottom";
|
|
343
348
|
label?: string;
|
|
344
349
|
ticks?: number;
|
|
345
|
-
tickFormat?: (d: any) => string;
|
|
350
|
+
tickFormat?: (d: any, index?: number, allTicks?: number[]) => string;
|
|
346
351
|
baseline?: boolean | "under";
|
|
347
352
|
jaggedBase?: boolean;
|
|
348
353
|
}>;
|
|
349
354
|
xLabel?: string;
|
|
350
355
|
yLabel?: string;
|
|
351
|
-
|
|
356
|
+
/** Label for the right Y axis (dual-axis charts) */
|
|
357
|
+
yLabelRight?: string;
|
|
358
|
+
xFormat?: (d: any, index?: number, allTicks?: number[]) => string;
|
|
352
359
|
yFormat?: (d: any) => string;
|
|
353
360
|
tickFormatTime?: (value: number) => string;
|
|
354
361
|
tickFormatValue?: (value: number) => string;
|
|
@@ -360,6 +367,12 @@ export interface StreamXYFrameProps<T = Record<string, any>> {
|
|
|
360
367
|
brush?: {
|
|
361
368
|
/** Which dimension(s) to brush: "x", "y", or "xy" (default "xy") */
|
|
362
369
|
dimension?: "x" | "y" | "xy";
|
|
370
|
+
/** Snap mode: "continuous" (default) for pixel-precise, "bin" to snap to bin boundaries */
|
|
371
|
+
snap?: "continuous" | "bin";
|
|
372
|
+
/** Actual bin boundary values for data-driven snapping (overrides uniform grid math) */
|
|
373
|
+
binBoundaries?: number[];
|
|
374
|
+
/** When true, snap during drag (not just on release). Default false. */
|
|
375
|
+
snapDuring?: boolean;
|
|
363
376
|
};
|
|
364
377
|
/** Callback when brush selection changes. Called with data-space extent, or null when cleared. */
|
|
365
378
|
onBrush?: (extent: {
|
|
@@ -391,6 +404,8 @@ export interface StreamXYFrameProps<T = Record<string, any>> {
|
|
|
391
404
|
foregroundGraphics?: ReactNode;
|
|
392
405
|
/** Canvas renderers executed before the chart-type renderers (e.g. connecting lines under points) */
|
|
393
406
|
canvasPreRenderers?: CanvasRendererFn[];
|
|
407
|
+
/** SVG pre-renderers for SSR — SVG equivalent of canvasPreRenderers, rendered under data marks */
|
|
408
|
+
svgPreRenderers?: SVGPreRendererFn[];
|
|
394
409
|
title?: string | ReactNode;
|
|
395
410
|
categoryAccessor?: string | ((d: T) => string);
|
|
396
411
|
/** Configurable opacity decay for older data points */
|
|
@@ -413,8 +428,16 @@ export interface StreamXYFrameProps<T = Record<string, any>> {
|
|
|
413
428
|
showValues?: boolean;
|
|
414
429
|
/** Format function for heatmap cell value labels */
|
|
415
430
|
heatmapValueFormat?: (v: number) => string;
|
|
416
|
-
/** Render a visually-hidden data table from the scene graph for screen readers
|
|
431
|
+
/** Render a visually-hidden data table from the scene graph for screen readers */
|
|
417
432
|
accessibleTable?: boolean;
|
|
433
|
+
/** Accessible description overriding the auto-generated aria-label on the chart container */
|
|
434
|
+
description?: string;
|
|
435
|
+
/** Accessible summary rendered as a screen-reader-only note */
|
|
436
|
+
summary?: string;
|
|
437
|
+
/** Name of the linked crosshair store entry — enables coordinate-based crosshair rendering */
|
|
438
|
+
linkedCrosshairName?: string;
|
|
439
|
+
/** Source chart ID — crosshair is suppressed on the source chart to avoid double rendering */
|
|
440
|
+
linkedCrosshairSourceId?: string;
|
|
418
441
|
}
|
|
419
442
|
export interface StreamXYFrameHandle<T = Record<string, any>> {
|
|
420
443
|
push(datum: T): void;
|
|
@@ -428,4 +451,6 @@ export interface StreamXYFrameHandle<T = Record<string, any>> {
|
|
|
428
451
|
} | null;
|
|
429
452
|
}
|
|
430
453
|
export type CanvasRendererFn = (ctx: CanvasRenderingContext2D, nodes: SceneNode[], scales: StreamScales, layout: StreamLayout) => void;
|
|
454
|
+
/** SVG equivalent of CanvasRendererFn — returns React elements for SSR/SVG rendering */
|
|
455
|
+
export type SVGPreRendererFn = (nodes: SceneNode[], scales: StreamScales, layout: StreamLayout) => ReactNode;
|
|
431
456
|
export type { ArrowOfTime, WindowMode, LineStyle, BarStyle, WaterfallStyle, SwarmStyle, HoverAnnotationConfig, HoverData, AnnotationContext, AnnotationAnchorMode };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Safari 14 fallback for MediaQueryList listener registration */
|
|
2
|
+
export declare function addMqlListener(mql: MediaQueryList, handler: (e: MediaQueryListEvent) => void): () => void;
|
|
3
|
+
/**
|
|
4
|
+
* SSR-safe hook that returns true when the user prefers reduced motion.
|
|
5
|
+
* Initializes from matchMedia synchronously to avoid a flash of animation.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useReducedMotion(): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* SSR-safe hook that returns true when forced-colors or high-contrast mode is active.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useHighContrast(): boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Area and stacked area scene builders.
|
|
3
|
+
*
|
|
4
|
+
* buildAreaScene — single/multi-group areas with gradient fill and curve support.
|
|
5
|
+
* buildStackedAreaScene — stable-order stacking with optional normalization.
|
|
6
|
+
*
|
|
7
|
+
* Dependencies: SceneGraph (buildAreaNode, buildStackedAreaNodes)
|
|
8
|
+
* Consumed by: PipelineStore.buildSceneNodes (chartTypes "area", "stackedarea")
|
|
9
|
+
*/
|
|
10
|
+
import type { SceneNode } from "../types";
|
|
11
|
+
import type { XYSceneContext } from "./types";
|
|
12
|
+
export declare function buildAreaScene(ctx: XYSceneContext, data: Record<string, any>[]): SceneNode[];
|
|
13
|
+
export declare function buildStackedAreaScene(ctx: XYSceneContext, data: Record<string, any>[]): SceneNode[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Realtime histogram bar scene builder.
|
|
3
|
+
*
|
|
4
|
+
* Builds binned bars with optional category stacking. Maintains stable
|
|
5
|
+
* category order via barColors keys + alphabetical fallback to prevent
|
|
6
|
+
* flicker when bins partially exit the sliding window.
|
|
7
|
+
*
|
|
8
|
+
* Dependencies: BinAccumulator (computeBins), SceneGraph (buildRectNode)
|
|
9
|
+
* Consumed by: PipelineStore.buildSceneNodes (chartType "bar")
|
|
10
|
+
*/
|
|
11
|
+
import type { SceneNode } from "../types";
|
|
12
|
+
import type { XYSceneContext } from "./types";
|
|
13
|
+
export interface BarSceneResult {
|
|
14
|
+
nodes: SceneNode[];
|
|
15
|
+
/** Sorted bin boundary values (edges of all bins) for data-driven brush snapping */
|
|
16
|
+
binBoundaries: number[];
|
|
17
|
+
}
|
|
18
|
+
export declare function buildBarScene(ctx: XYSceneContext, data: Record<string, any>[]): BarSceneResult;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounds scene builder — produces an AreaSceneNode for confidence bands/envelopes.
|
|
3
|
+
*
|
|
4
|
+
* Consumed by: lineScene (renders bounds behind lines)
|
|
5
|
+
*/
|
|
6
|
+
import type { AreaSceneNode } from "../types";
|
|
7
|
+
import type { XYSceneContext } from "./types";
|
|
8
|
+
export declare function buildBoundsForGroup(ctx: XYSceneContext, data: Record<string, any>[], group: string): AreaSceneNode | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Candlestick (OHLC) scene builder.
|
|
3
|
+
*
|
|
4
|
+
* Renders open-high-low-close bars with auto-width sizing based on data spacing.
|
|
5
|
+
*
|
|
6
|
+
* Consumed by: PipelineStore.buildSceneNodes (chartType "candlestick")
|
|
7
|
+
*/
|
|
8
|
+
import type { SceneNode, StreamLayout } from "../types";
|
|
9
|
+
import type { XYSceneContext } from "./types";
|
|
10
|
+
export declare function buildCandlestickScene(ctx: XYSceneContext, data: Record<string, any>[], layout: StreamLayout): SceneNode[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helper for emitting PointSceneNodes from grouped data.
|
|
3
|
+
*
|
|
4
|
+
* Used by line, area, and stacked area scene builders when the HOC's
|
|
5
|
+
* `showPoints` prop is active (i.e., `ctx.config.pointStyle` is set).
|
|
6
|
+
* Handles group color fallback for push API mode and pointId passthrough.
|
|
7
|
+
*/
|
|
8
|
+
import type { SceneNode } from "../types";
|
|
9
|
+
import type { XYSceneContext } from "./types";
|
|
10
|
+
export declare function emitPointNodes(ctx: XYSceneContext, groups: {
|
|
11
|
+
key: string;
|
|
12
|
+
data: Record<string, any>[];
|
|
13
|
+
}[], nodes: SceneNode[], yGetOverride?: (d: Record<string, any>) => number): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Line scene builder — produces LineSceneNode[] from grouped data.
|
|
3
|
+
*
|
|
4
|
+
* Handles: color thresholds from annotations, bounds/envelope areas,
|
|
5
|
+
* and curve type attachment for canvas interpolation.
|
|
6
|
+
*
|
|
7
|
+
* Dependencies: SceneGraph (buildLineNode), boundsScene (buildBoundsForGroup)
|
|
8
|
+
* Consumed by: PipelineStore.buildSceneNodes (chartType "line")
|
|
9
|
+
*/
|
|
10
|
+
import type { SceneNode } from "../types";
|
|
11
|
+
import type { XYSceneContext } from "./types";
|
|
12
|
+
export declare function buildLineScene(ctx: XYSceneContext, data: Record<string, any>[]): SceneNode[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Point/scatter/bubble scene builder.
|
|
3
|
+
*
|
|
4
|
+
* Handles: size scaling from sizeAccessor, color mapping from colorAccessor,
|
|
5
|
+
* and pointId attachment for hit testing.
|
|
6
|
+
*
|
|
7
|
+
* Dependencies: SceneGraph (buildPointNode)
|
|
8
|
+
* Consumed by: PipelineStore.buildSceneNodes (chartTypes "scatter", "bubble")
|
|
9
|
+
*/
|
|
10
|
+
import type { SceneNode } from "../types";
|
|
11
|
+
import type { XYSceneContext } from "./types";
|
|
12
|
+
export declare function buildPointScene(ctx: XYSceneContext, data: Record<string, any>[]): SceneNode[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Realtime swarm chart scene builder.
|
|
3
|
+
*
|
|
4
|
+
* Simple point scatter with category-based coloring from barColors config.
|
|
5
|
+
*
|
|
6
|
+
* Consumed by: PipelineStore.buildSceneNodes (chartType "swarm")
|
|
7
|
+
*/
|
|
8
|
+
import type { SceneNode } from "../types";
|
|
9
|
+
import type { XYSceneContext } from "./types";
|
|
10
|
+
export declare function buildSwarmScene(ctx: XYSceneContext, data: Record<string, any>[]): SceneNode[];
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* XYSceneContext — shared context passed to all XY scene builder functions.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the ordinal pattern (OrdinalSceneContext in ordinalSceneBuilders/).
|
|
5
|
+
* Scene builders are pure functions that receive this context instead of
|
|
6
|
+
* accessing PipelineStore instance fields directly.
|
|
7
|
+
*/
|
|
8
|
+
import type { StreamScales, Style, CurveType } from "../types";
|
|
9
|
+
export interface XYSceneContext {
|
|
10
|
+
scales: StreamScales;
|
|
11
|
+
config: XYSceneConfig;
|
|
12
|
+
getX: (d: any) => number;
|
|
13
|
+
getY: (d: any) => number;
|
|
14
|
+
getY0?: (d: any) => number | null;
|
|
15
|
+
getSize?: (d: any) => number;
|
|
16
|
+
getColor?: (d: any) => string;
|
|
17
|
+
getGroup?: (d: any) => string;
|
|
18
|
+
getCategory?: (d: any) => string;
|
|
19
|
+
getPointId?: (d: any) => string;
|
|
20
|
+
getBounds?: (d: any) => number | null;
|
|
21
|
+
getOpen?: (d: any) => number;
|
|
22
|
+
getHigh?: (d: any) => number;
|
|
23
|
+
getLow?: (d: any) => number;
|
|
24
|
+
getClose?: (d: any) => number;
|
|
25
|
+
/** Style resolvers — delegate to PipelineStore's cached color management */
|
|
26
|
+
resolveLineStyle: (group: string, sampleDatum?: Record<string, any>) => Style;
|
|
27
|
+
resolveAreaStyle: (group: string, sampleDatum?: Record<string, any>) => Style;
|
|
28
|
+
resolveBoundsStyle: (group: string, sampleDatum?: Record<string, any>) => Style;
|
|
29
|
+
resolveColorMap: (data: Record<string, any>[]) => Map<string, string>;
|
|
30
|
+
resolveGroupColor: (group: string) => string | null;
|
|
31
|
+
/** Group data by lineBy/colorBy accessor */
|
|
32
|
+
groupData: (data: Record<string, any>[]) => {
|
|
33
|
+
key: string;
|
|
34
|
+
data: Record<string, any>[];
|
|
35
|
+
}[];
|
|
36
|
+
/** Instance-scoped mutable cache for bar category ordering (prevents cross-instance leaks) */
|
|
37
|
+
barCategoryCache?: {
|
|
38
|
+
key: string;
|
|
39
|
+
order: string[];
|
|
40
|
+
} | null;
|
|
41
|
+
}
|
|
42
|
+
/** Subset of PipelineConfig fields that scene builders need */
|
|
43
|
+
export interface XYSceneConfig {
|
|
44
|
+
chartType: string;
|
|
45
|
+
curve?: CurveType;
|
|
46
|
+
colorScheme?: string | string[];
|
|
47
|
+
normalize?: boolean;
|
|
48
|
+
gradientFill?: boolean | {
|
|
49
|
+
topOpacity?: number;
|
|
50
|
+
bottomOpacity?: number;
|
|
51
|
+
};
|
|
52
|
+
annotations?: Record<string, any>[];
|
|
53
|
+
pointStyle?: (d: any) => Style & {
|
|
54
|
+
r?: number;
|
|
55
|
+
};
|
|
56
|
+
sizeRange?: [number, number];
|
|
57
|
+
xAccessor?: string | ((d: any) => any);
|
|
58
|
+
yAccessor?: string | ((d: any) => any);
|
|
59
|
+
valueAccessor?: string | ((d: any) => any);
|
|
60
|
+
heatmapAggregation?: "count" | "sum" | "mean";
|
|
61
|
+
heatmapXBins?: number;
|
|
62
|
+
heatmapYBins?: number;
|
|
63
|
+
showValues?: boolean;
|
|
64
|
+
heatmapValueFormat?: (v: number) => string;
|
|
65
|
+
binSize?: number;
|
|
66
|
+
barColors?: Record<string, string>;
|
|
67
|
+
swarmStyle?: {
|
|
68
|
+
radius?: number;
|
|
69
|
+
fill?: string;
|
|
70
|
+
opacity?: number;
|
|
71
|
+
stroke?: string;
|
|
72
|
+
strokeWidth?: number;
|
|
73
|
+
};
|
|
74
|
+
waterfallStyle?: {
|
|
75
|
+
positiveColor?: string;
|
|
76
|
+
negativeColor?: string;
|
|
77
|
+
gap?: number;
|
|
78
|
+
stroke?: string;
|
|
79
|
+
strokeWidth?: number;
|
|
80
|
+
connectorStroke?: string;
|
|
81
|
+
connectorWidth?: number;
|
|
82
|
+
};
|
|
83
|
+
candlestickStyle?: {
|
|
84
|
+
upColor?: string;
|
|
85
|
+
downColor?: string;
|
|
86
|
+
wickColor?: string;
|
|
87
|
+
wickWidth?: number;
|
|
88
|
+
bodyWidth?: number;
|
|
89
|
+
};
|
|
90
|
+
boundsStyle?: Style | ((d: any, group: string) => Style);
|
|
91
|
+
lineStyle?: Style | ((d: any, group: string) => Style);
|
|
92
|
+
areaStyle?: (d: any) => Style;
|
|
93
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Waterfall chart scene builder.
|
|
3
|
+
*
|
|
4
|
+
* Builds cumulative delta bars from time-series data. Each bar's base starts
|
|
5
|
+
* where the previous bar ended. Positive/negative deltas get distinct colors.
|
|
6
|
+
*
|
|
7
|
+
* Dependencies: SceneGraph (buildRectNode)
|
|
8
|
+
* Consumed by: PipelineStore.buildSceneNodes (chartType "waterfall")
|
|
9
|
+
*/
|
|
10
|
+
import type { SceneNode, StreamLayout } from "../types";
|
|
11
|
+
import type { XYSceneContext } from "./types";
|
|
12
|
+
export declare function buildWaterfallScene(ctx: XYSceneContext, data: Record<string, any>[], layout: StreamLayout): SceneNode[];
|