semiotic 3.5.4 → 3.7.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.
- package/CLAUDE.md +196 -175
- package/README.md +52 -15
- package/ai/cli.js +41 -0
- package/ai/componentMetadata.cjs +11 -2
- package/ai/dist/mcp-server.js +454 -4
- package/ai/examples.md +98 -0
- package/ai/schema.json +614 -9
- package/ai/system-prompt.md +5 -2
- package/dist/components/AccessibleNavTree.d.ts +25 -0
- package/dist/components/Annotation.d.ts +40 -14
- package/dist/components/ChartContainer.d.ts +32 -2
- package/dist/components/ai/annotationProvenance.d.ts +349 -0
- package/dist/components/ai/audienceProfile.d.ts +147 -0
- package/dist/components/ai/audiences.d.ts +31 -0
- package/dist/components/ai/chartCapabilities.d.ts +55 -0
- package/dist/components/ai/chartCapabilityTypes.d.ts +254 -0
- package/dist/components/ai/chartRoles.d.ts +27 -0
- package/dist/components/ai/conversationArc.d.ts +379 -0
- package/dist/components/ai/dataScaleProfile.d.ts +320 -0
- package/dist/components/ai/describeChart.d.ts +114 -0
- package/dist/components/ai/diffProfile.d.ts +51 -0
- package/dist/components/ai/inferIntent.d.ts +24 -0
- package/dist/components/ai/intents.d.ts +34 -0
- package/dist/components/ai/navigationTree.d.ts +45 -0
- package/dist/components/ai/profileData.d.ts +16 -0
- package/dist/components/ai/qualityFixtures.d.ts +2 -0
- package/dist/components/ai/qualityScorecard.d.ts +82 -0
- package/dist/components/ai/readerGrounding.d.ts +70 -0
- package/dist/components/ai/repairChartConfig.d.ts +73 -0
- package/dist/components/ai/streamingTypes.d.ts +64 -0
- package/dist/components/ai/suggestCharts.d.ts +109 -0
- package/dist/components/ai/suggestDashboard.d.ts +92 -0
- package/dist/components/ai/suggestStreamCharts.d.ts +34 -0
- package/dist/components/ai/suggestStretchCharts.d.ts +60 -0
- package/dist/components/ai/useChartSuggestions.d.ts +22 -0
- package/dist/components/ai/useConversationArc.d.ts +89 -0
- package/dist/components/ai/useNavigationSync.d.ts +61 -0
- package/dist/components/ai/variantDiscovery.d.ts +168 -0
- package/dist/components/charts/geo/ChoroplethMap.capability.d.ts +2 -0
- package/dist/components/charts/geo/DistanceCartogram.capability.d.ts +2 -0
- package/dist/components/charts/geo/FlowMap.capability.d.ts +2 -0
- package/dist/components/charts/geo/ProportionalSymbolMap.capability.d.ts +2 -0
- package/dist/components/charts/index.d.ts +1 -1
- package/dist/components/charts/network/ChordDiagram.capability.d.ts +2 -0
- package/dist/components/charts/network/CirclePack.capability.d.ts +2 -0
- package/dist/components/charts/network/ForceDirectedGraph.capability.d.ts +2 -0
- package/dist/components/charts/network/OrbitDiagram.capability.d.ts +2 -0
- package/dist/components/charts/network/ProcessSankey.capability.d.ts +2 -0
- package/dist/components/charts/network/SankeyDiagram.capability.d.ts +2 -0
- package/dist/components/charts/network/TreeDiagram.capability.d.ts +2 -0
- package/dist/components/charts/network/Treemap.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/BarChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/BoxPlot.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/DonutChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/DotPlot.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/FunnelChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/GaugeChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/GroupedBarChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/Histogram.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/Histogram.d.ts +4 -2
- package/dist/components/charts/ordinal/LikertChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/LikertChart.d.ts +1 -1
- package/dist/components/charts/ordinal/LikertChart.defaults.d.ts +1 -0
- package/dist/components/charts/ordinal/PieChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/RidgelinePlot.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/StackedBarChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/SwarmPlot.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/SwimlaneChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/ViolinPlot.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +3 -0
- package/dist/components/charts/realtime/RealtimeHistogram.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +3 -0
- package/dist/components/charts/realtime/RealtimeLineChart.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +3 -0
- package/dist/components/charts/realtime/RealtimeSwarmChart.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +3 -0
- package/dist/components/charts/realtime/RealtimeWaterfallChart.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +3 -0
- package/dist/components/charts/realtime/TemporalHistogram.capability.d.ts +7 -0
- package/dist/components/charts/shared/annotationHierarchy.d.ts +42 -0
- package/dist/components/charts/shared/annotationResolvers.d.ts +3 -2
- package/dist/components/charts/shared/annotationRules.d.ts +16 -0
- package/dist/components/charts/shared/annotationTypes.d.ts +14 -0
- package/dist/components/charts/shared/auditAccessibility.d.ts +90 -0
- package/dist/components/charts/shared/chartSpecs.d.ts +2 -37
- package/dist/components/charts/shared/diagnoseConfig.d.ts +4 -6
- package/dist/components/charts/shared/selectionUtils.d.ts +5 -2
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +2 -0
- package/dist/components/charts/shared/types.d.ts +5 -1
- package/dist/components/charts/value/BigNumber.capability.d.ts +13 -0
- package/dist/components/charts/value/BigNumber.d.ts +14 -0
- package/dist/components/charts/value/formatting.d.ts +40 -0
- package/dist/components/charts/value/thresholdSparkline.d.ts +40 -0
- package/dist/components/charts/value/types.d.ts +292 -0
- package/dist/components/charts/xy/AreaChart.capability.d.ts +10 -0
- package/dist/components/charts/xy/BubbleChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/CandlestickChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/ConnectedScatterplot.capability.d.ts +2 -0
- package/dist/components/charts/xy/DifferenceChart.capability.d.ts +8 -0
- package/dist/components/charts/xy/Heatmap.capability.d.ts +9 -0
- package/dist/components/charts/xy/LineChart.capability.d.ts +9 -0
- package/dist/components/charts/xy/MinimapChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/MultiAxisLineChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/QuadrantChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/QuadrantChart.d.ts +5 -2
- package/dist/components/charts/xy/QuadrantChart.defaults.d.ts +2 -0
- package/dist/components/charts/xy/Scatterplot.capability.d.ts +2 -0
- package/dist/components/charts/xy/StackedAreaChart.capability.d.ts +2 -0
- package/dist/components/data/DataSummarizer.d.ts +45 -0
- package/dist/components/realtime/lifecycleBands.d.ts +44 -0
- package/dist/components/realtime/types.d.ts +23 -8
- package/dist/components/recipes/annotationDensity.d.ts +69 -0
- package/dist/components/recipes/annotationLayout.d.ts +93 -0
- package/dist/components/semiotic-ai.d.ts +58 -0
- package/dist/components/semiotic-realtime.d.ts +2 -0
- package/dist/components/semiotic-recipes.d.ts +4 -0
- package/dist/components/semiotic-utils.d.ts +8 -0
- package/dist/components/semiotic-value.d.ts +55 -0
- package/dist/components/semiotic-xy.d.ts +1 -1
- package/dist/components/semiotic.d.ts +8 -1
- package/dist/components/server/staticAnnotations.d.ts +2 -0
- package/dist/components/store/useChartFocus.d.ts +43 -0
- package/dist/components/store/useChartInterrogation.d.ts +141 -0
- package/dist/components/stream/AccessibleDataTable.d.ts +10 -1
- package/dist/components/stream/NetworkSVGOverlay.d.ts +11 -5
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -0
- package/dist/components/stream/SVGOverlay.d.ts +2 -0
- package/dist/components/stream/geoTypes.d.ts +3 -0
- package/dist/components/stream/networkTypes.d.ts +2 -0
- package/dist/components/stream/ordinalTypes.d.ts +2 -0
- package/dist/components/stream/types.d.ts +2 -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.d.ts +58 -0
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-realtime.d.ts +2 -0
- package/dist/semiotic-recipes.d.ts +4 -0
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-themes.min.js +1 -1
- package/dist/semiotic-themes.module.min.js +1 -1
- package/dist/semiotic-utils.d.ts +8 -0
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-value.d.ts +55 -0
- package/dist/semiotic-value.min.js +2 -0
- package/dist/semiotic-value.module.min.js +2 -0
- package/dist/semiotic-xy.d.ts +1 -1
- package/dist/semiotic.d.ts +8 -1
- 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.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +28 -5
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { AnnotationContext } from "../realtime/types";
|
|
2
|
+
import type { Datum } from "../charts/shared/datumTypes";
|
|
3
|
+
import { type AnnotationDensityConfig } from "./annotationDensity";
|
|
4
|
+
export interface AnnotationLayoutConfig {
|
|
5
|
+
/** Distance from the anchor for the first candidate ring. */
|
|
6
|
+
defaultOffset?: number;
|
|
7
|
+
/** Gap around note boxes when testing note-note collisions. */
|
|
8
|
+
notePadding?: number;
|
|
9
|
+
/** Gap around point marks when testing note-mark collisions. */
|
|
10
|
+
markPadding?: number;
|
|
11
|
+
/** Gap from the plot edge, used as a cheap axis-occlusion proxy. */
|
|
12
|
+
edgePadding?: number;
|
|
13
|
+
/** Preserve annotations that already declare either dx or dy. Default true. */
|
|
14
|
+
preserveManualOffsets?: boolean;
|
|
15
|
+
/** Use a curved connector when auto-placement has to route far from the target. */
|
|
16
|
+
routeLongConnectors?: boolean;
|
|
17
|
+
/** Distance threshold for routeLongConnectors. */
|
|
18
|
+
connectorThreshold?: number;
|
|
19
|
+
/**
|
|
20
|
+
* M3 — amount & density management. When set, after placement the lowest-
|
|
21
|
+
* priority note-like annotations are shed so the plot is not over-crowded
|
|
22
|
+
* (`true` uses the area-derived default budget; an object tunes it). Reference
|
|
23
|
+
* lines, bands and overlays are never shed. Off by default.
|
|
24
|
+
*/
|
|
25
|
+
density?: boolean | AnnotationDensityConfig;
|
|
26
|
+
/**
|
|
27
|
+
* M3 — progressive disclosure. When `true`, notes shed by `density` (M3) or
|
|
28
|
+
* the `responsive` breakpoint (M5) are kept in the output tagged
|
|
29
|
+
* `_annotationDeferred` (hidden by default, revealed on chart hover/focus)
|
|
30
|
+
* instead of dropped. The persistent set is always rendered, so a non-hover
|
|
31
|
+
* reader still sees the core notes. No effect unless a shedding pass is on.
|
|
32
|
+
*/
|
|
33
|
+
progressiveDisclosure?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* M4 — redundant-cue default (Rahman et al.'s "Association"). A colored
|
|
36
|
+
* `text` note is the one note type that never draws a connector, so it ties
|
|
37
|
+
* to its target by color alone — invisible to a color-blind or non-visual
|
|
38
|
+
* reader. When `true`, an offset colored `text` note is flagged
|
|
39
|
+
* `_redundantConnector` so the renderer adds a faint leader line from the
|
|
40
|
+
* anchor to the text: a spatial cue, not another color. Off by default.
|
|
41
|
+
*/
|
|
42
|
+
redundantCues?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* M5 — responsive annotation behavior. As the plot narrows past `minWidth`
|
|
45
|
+
* (default 480px), `secondary`-emphasis notes are shed by *importance* — a
|
|
46
|
+
* complement to `density`'s count budget. Pass `true` for the default
|
|
47
|
+
* breakpoint or `{ minWidth }` to tune it. With `progressiveDisclosure`,
|
|
48
|
+
* shed notes are deferred (revealable) rather than dropped. Primary and
|
|
49
|
+
* unmarked notes are always kept. Off by default.
|
|
50
|
+
*/
|
|
51
|
+
responsive?: boolean | {
|
|
52
|
+
minWidth?: number;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* M5 — cohesion mode (Rahman et al.'s "Cohesion"). `"blended"` lets notes
|
|
56
|
+
* adopt the chart's visual language (mark colors / chart typography — the
|
|
57
|
+
* default look); `"layer"` presents them as a distinct editorial layer
|
|
58
|
+
* (annotation-color, italic editorial type). Stamped onto note-like
|
|
59
|
+
* annotations that don't set their own `cohesion`; a per-annotation
|
|
60
|
+
* `cohesion` always wins. Off (inherit) by default.
|
|
61
|
+
*/
|
|
62
|
+
cohesion?: AnnotationCohesion;
|
|
63
|
+
/**
|
|
64
|
+
* M6 — audience adaptation. An `AudienceProfile` (structurally, anything with
|
|
65
|
+
* a `familiarity` map) biases annotation *amount*: a low-familiarity audience
|
|
66
|
+
* keeps more notes (orienting context), an expert audience fewer. It scales
|
|
67
|
+
* the `density` budget, so it only takes effect when `density` is engaged.
|
|
68
|
+
*/
|
|
69
|
+
audience?: AnnotationAudience;
|
|
70
|
+
}
|
|
71
|
+
export type AnnotationCohesion = "blended" | "layer";
|
|
72
|
+
/** Structural subset of `AudienceProfile` the annotation layer reads — anything
|
|
73
|
+
* with a per-chart `familiarity` map satisfies it, so a real `AudienceProfile`
|
|
74
|
+
* can be passed directly without coupling `recipes` to the `ai` module. */
|
|
75
|
+
export interface AnnotationAudience {
|
|
76
|
+
name?: string;
|
|
77
|
+
familiarity?: Partial<Record<string, number>>;
|
|
78
|
+
}
|
|
79
|
+
export type AutoPlaceAnnotationsConfig = AnnotationLayoutConfig;
|
|
80
|
+
export type AutoPlaceAnnotations = boolean | AutoPlaceAnnotationsConfig;
|
|
81
|
+
export interface AnnotationLayoutOptions extends AnnotationLayoutConfig {
|
|
82
|
+
annotations: ReadonlyArray<Datum>;
|
|
83
|
+
context: AnnotationContext;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Pure annotation placement recipe.
|
|
87
|
+
*
|
|
88
|
+
* It clones note-like annotations that do not already declare `dx`/`dy`, picks
|
|
89
|
+
* an adjacent candidate offset, and leaves every other annotation untouched.
|
|
90
|
+
* The pass is deterministic and geometry-only; renderers still own the actual
|
|
91
|
+
* SVG/HTML annotation drawing.
|
|
92
|
+
*/
|
|
93
|
+
export declare function annotationLayout(options: AnnotationLayoutOptions): Datum[];
|
|
@@ -41,6 +41,7 @@ export { RealtimeHistogram, TemporalHistogram } from "./charts/realtime/Realtime
|
|
|
41
41
|
export { RealtimeSwarmChart } from "./charts/realtime/RealtimeSwarmChart";
|
|
42
42
|
export { RealtimeWaterfallChart } from "./charts/realtime/RealtimeWaterfallChart";
|
|
43
43
|
export { RealtimeHeatmap } from "./charts/realtime/RealtimeHeatmap";
|
|
44
|
+
export { BigNumber } from "./charts/value/BigNumber";
|
|
44
45
|
export { TooltipProvider } from "./store/TooltipStore";
|
|
45
46
|
export { MultiLineTooltip } from "./Tooltip/Tooltip";
|
|
46
47
|
export { ThemeProvider, useTheme } from "./ThemeProvider";
|
|
@@ -59,6 +60,8 @@ export { validateProps } from "./charts/shared/validateProps";
|
|
|
59
60
|
export type { ValidationResult } from "./charts/shared/validateProps";
|
|
60
61
|
export { diagnoseConfig } from "./charts/shared/diagnoseConfig";
|
|
61
62
|
export type { Diagnosis, DiagnosisResult } from "./charts/shared/diagnoseConfig";
|
|
63
|
+
export { auditAccessibility, formatAccessibilityAudit, accessibilityCaveats } from "./charts/shared/auditAccessibility";
|
|
64
|
+
export type { A11yPrinciple, A11yStatus, A11yFinding, AccessibilityAuditResult, AuditAccessibilityOptions } from "./charts/shared/auditAccessibility";
|
|
62
65
|
export type { AnomalyConfig, ForecastConfig } from "./charts/shared/statisticalOverlays";
|
|
63
66
|
export { toConfig, fromConfig, toURL, fromURL, copyConfig, configToJSX } from "./export/chartConfig";
|
|
64
67
|
export type { ChartConfig, ToConfigOptions, CopyFormat } from "./export/chartConfig";
|
|
@@ -66,6 +69,61 @@ export { serializeSelections, deserializeSelections } from "./export/selectionSe
|
|
|
66
69
|
export type { SerializedSelections, SerializedSelection, SerializedFieldSelection } from "./export/selectionSerializer";
|
|
67
70
|
export { fromVegaLite } from "./data/fromVegaLite";
|
|
68
71
|
export type { VegaLiteSpec, VegaLiteEncoding } from "./data/fromVegaLite";
|
|
72
|
+
export { useChartInterrogation } from "./store/useChartInterrogation";
|
|
73
|
+
export type { UseChartInterrogationOptions, UseChartInterrogationResult, InterrogationContext, InterrogationFocus, InterrogationResult, InterrogationQuery, InterrogationMessage } from "./store/useChartInterrogation";
|
|
74
|
+
export { useChartFocus } from "./store/useChartFocus";
|
|
75
|
+
export type { UseChartFocusOptions } from "./store/useChartFocus";
|
|
76
|
+
export { summarizeData } from "./data/DataSummarizer";
|
|
77
|
+
export { describeChart, resolveCommunicativeAct, communicativeActForIntent } from "./ai/describeChart";
|
|
78
|
+
export type { DescribeChartResult, DescribeChartOptions, DescribeLevel, CommunicativeAct, DescribeCapabilityContext } from "./ai/describeChart";
|
|
79
|
+
export { buildReaderGrounding } from "./ai/readerGrounding";
|
|
80
|
+
export type { ChartReaderGrounding, ChartReaderGroundingOptions, ChartReaderGroundingIntent } from "./ai/readerGrounding";
|
|
81
|
+
export { buildNavigationTree, flattenVisible, countNodes } from "./ai/navigationTree";
|
|
82
|
+
export type { NavTreeNode, NavTreeRole, BuildNavigationTreeOptions } from "./ai/navigationTree";
|
|
83
|
+
export { AccessibleNavTree } from "./AccessibleNavTree";
|
|
84
|
+
export type { AccessibleNavTreeProps } from "./AccessibleNavTree";
|
|
85
|
+
export { useNavigationSync } from "./ai/useNavigationSync";
|
|
86
|
+
export type { UseNavigationSyncOptions, UseNavigationSyncResult } from "./ai/useNavigationSync";
|
|
87
|
+
export type { DataSummary, FieldSummary, FieldType, NumericFieldSummary, DateFieldSummary, CategoricalFieldSummary, UnknownFieldSummary, SummarizeOptions } from "./data/DataSummarizer";
|
|
88
|
+
export { profileData } from "./ai/profileData";
|
|
89
|
+
export type { ProfileDataOptions } from "./ai/profileData";
|
|
90
|
+
export { suggestCharts, suggestChartsGrouped, scoreChart, explainCapabilityFit } from "./ai/suggestCharts";
|
|
91
|
+
export type { SuggestChartsOptions, RejectedCapability, ExplainCapabilityFitResult } from "./ai/suggestCharts";
|
|
92
|
+
export { DEFAULT_SCALE_THRESHOLDS, applyScaleBias, classifyRowBand, classifyCardinalityBand, classifyFieldBand, compareBands, computeEffectiveScale, resolveRowsToNumber, resolveCardinalityToNumber, scaleHints } from "./ai/dataScaleProfile";
|
|
93
|
+
export type { DataScaleProfile, DataQualityProfile, ScaleBand, CardinalityBand, FieldBand, ScaleThresholds, ChartScalePreference, EffectiveScale, ScaleBiasResult, ScaleFitFn, ScaleFitResult, QualityFitFn, ScaleHintInput } from "./ai/dataScaleProfile";
|
|
94
|
+
export { inferIntent } from "./ai/inferIntent";
|
|
95
|
+
export type { InferIntentResult } from "./ai/inferIntent";
|
|
96
|
+
export { suggestDashboard } from "./ai/suggestDashboard";
|
|
97
|
+
export type { DashboardPanel, DashboardSuggestion, SuggestDashboardOptions } from "./ai/suggestDashboard";
|
|
98
|
+
export { applyAudienceBias, effectiveFamiliarity, stretchFamiliarityCeiling, receivabilityBias } from "./ai/audienceProfile";
|
|
99
|
+
export type { AudienceProfile, AudienceTarget, AudienceBiasResult, ReceptionModality, ReceivabilitySignal } from "./ai/audienceProfile";
|
|
100
|
+
export { executivePersona, analystPersona, dataScientistPersona, BUILT_IN_AUDIENCES } from "./ai/audiences";
|
|
101
|
+
export { suggestStretchCharts } from "./ai/suggestStretchCharts";
|
|
102
|
+
export type { StretchSuggestion, SuggestStretchChartsOptions } from "./ai/suggestStretchCharts";
|
|
103
|
+
export { suggestStreamCharts, registerStreamChartCapability, unregisterStreamChartCapability, getStreamCapabilities } from "./ai/suggestStreamCharts";
|
|
104
|
+
export type { SuggestStreamChartsOptions } from "./ai/suggestStreamCharts";
|
|
105
|
+
export type { StreamSchema, StreamFieldSchema, StreamFieldKind, StreamChartCapability, StreamIntentScorer, StreamSuggestion } from "./ai/streamingTypes";
|
|
106
|
+
export { diffProfile } from "./ai/diffProfile";
|
|
107
|
+
export type { ProfileDiff, FieldTypeChange, PrimaryRoleChange, PrimaryRole } from "./ai/diffProfile";
|
|
108
|
+
export { repairChartConfig } from "./ai/repairChartConfig";
|
|
109
|
+
export type { RepairResult, RepairOkResult, RepairAlternativeResult, RepairUnknownResult, RepairOptions } from "./ai/repairChartConfig";
|
|
110
|
+
export { runQualityScorecard } from "./ai/qualityScorecard";
|
|
111
|
+
export type { ScorecardFixture, ScorecardReport, PerCapabilityScore, PerFixtureScore } from "./ai/qualityScorecard";
|
|
112
|
+
export { CANONICAL_FIXTURES } from "./ai/qualityFixtures";
|
|
113
|
+
export { useChartSuggestions } from "./ai/useChartSuggestions";
|
|
114
|
+
export type { UseChartSuggestionsOptions, UseChartSuggestionsResult } from "./ai/useChartSuggestions";
|
|
115
|
+
export { getCapabilities, getCapability, registerChartCapability, unregisterChartCapability, LineChartCapability, AreaChartCapability, StackedAreaChartCapability, ScatterplotCapability, ConnectedScatterplotCapability, BubbleChartCapability, QuadrantChartCapability, MultiAxisLineChartCapability, MinimapChartCapability, DifferenceChartCapability, CandlestickChartCapability, HeatmapCapability, BarChartCapability, GroupedBarChartCapability, StackedBarChartCapability, DotPlotCapability, PieChartCapability, DonutChartCapability, FunnelChartCapability, GaugeChartCapability, LikertChartCapability, SwimlaneChartCapability, HistogramCapability, BoxPlotCapability, SwarmPlotCapability, ViolinPlotCapability, RidgelinePlotCapability, ForceDirectedGraphCapability, SankeyDiagramCapability, ChordDiagramCapability, ProcessSankeyCapability, TreeDiagramCapability, TreemapCapability, CirclePackCapability, OrbitDiagramCapability, ChoroplethMapCapability, ProportionalSymbolMapCapability, FlowMapCapability, DistanceCartogramCapability } from "./ai/chartCapabilities";
|
|
116
|
+
export type { ChartCapability, ChartDataProfile, ChartFamily, ChartImportPath, ChartRubric, ChartVariant, FieldCandidate, FieldKind, FitResult, IntentScorer, ScaledSuggestionGroups, Suggestion, SuggestionScaleRange } from "./ai/chartCapabilityTypes";
|
|
117
|
+
export { listIntents, getIntent, registerIntent, BUILT_IN_INTENT_IDS } from "./ai/intents";
|
|
118
|
+
export type { BuiltInIntentId, IntentId, IntentDescriptor } from "./ai/intents";
|
|
119
|
+
export { proposeVariant, evaluateVariantProposal, registerVariantDiscovery, getRegisteredVariantDiscovery, clearVariantDiscovery } from "./ai/variantDiscovery";
|
|
120
|
+
export type { VariantProposal, VariantProposalSource, VariantScore, VariantRejectionReason, VariantDiscoveryContext, EvaluateVariantProposalOptions, ProposeVariantFn, EvaluateVariantProposalFn } from "./ai/variantDiscovery";
|
|
121
|
+
export { withProvenance, withCurrentProvenance, currentTimestamp, computeAnnotationFreshness, applyAnnotationLifecycle, applyAnnotationStatus, filterAnnotationsByStatus, annotationFreshnessFor, bandFromAge, DEFAULT_LIFECYCLE_THRESHOLDS } from "./ai/annotationProvenance";
|
|
122
|
+
export type { AnnotationProvenance, AnnotationSource, AnnotationActorKind, AnnotationBasis, AnnotationLifecycle, AnnotationFreshness, AnnotationStatus, AnnotationAnchor, Annotated, ComputeAnnotationFreshnessOptions, AnnotationLifecycleTreatment, ApplyAnnotationLifecycleOptions, AnnotationStatusTreatment, AnnotationStatusVisibility, LifecycleBand, LifecycleBandThresholds } from "./ai/annotationProvenance";
|
|
123
|
+
export { useConversationArc, summarizeArc } from "./ai/useConversationArc";
|
|
124
|
+
export type { UseConversationArcOptions, UseConversationArcResult, ConversationArcSummary } from "./ai/useConversationArc";
|
|
125
|
+
export { enableConversationArc, disableConversationArc, getConversationArcStore, subscribeToConversationArcChange, registerConversationArcSink, createLocalStorageConversationArcSink, createIndexedDBConversationArcSink, createWebhookConversationArcSink, loadConversationArc, replayConversationArc, recordAudienceChange, recordAnnotationStatusChange } from "./ai/conversationArc";
|
|
126
|
+
export type { ConversationArcEvent, ConversationArcEventType, ConversationArcEventInput, ConversationArcStore, ConversationArcListener, ConversationArcSink, ConversationArcStorageLike, EnableConversationArcOptions, LoadConversationArcOptions, LocalStorageConversationArcSinkOptions, IndexedDBConversationArcSinkOptions, ConversationArcWebhookFetch, WebhookConversationArcSinkOptions, SuggestionShownEvent, SuggestionChosenEvent, AudienceSetEvent, ChartRenderedEvent, ChartEditedEvent, ChartReplacedEvent, ChartExportedEvent, ChartAbandonedEvent, InterrogationAskedEvent, InterrogationAnsweredEvent, NavNodeFocusedEvent, NavBranchExpandedEvent, AnnotationStatusChangedEvent } from "./ai/conversationArc";
|
|
69
127
|
export { useChartObserver } from "./store/useObservation";
|
|
70
128
|
export type { UseChartObserverOptions, UseChartObserverResult } from "./store/useObservation";
|
|
71
129
|
export type { ChartObservation, OnObservationCallback, HoverObservation, HoverEndObservation, BrushObservation, BrushEndObservation, SelectionObservation, SelectionEndObservation, ClickObservation, ClickEndObservation } from "./store/ObservationStore";
|
|
@@ -22,3 +22,5 @@ export type { StreamXYFrameProps, StreamXYFrameHandle, StreamChartType } from ".
|
|
|
22
22
|
export type { StreamNetworkFrameProps, StreamNetworkFrameHandle, NetworkChartType } from "./stream/networkTypes";
|
|
23
23
|
export { useStreamStatus } from "./charts/shared/useStreamStatus";
|
|
24
24
|
export type { StreamStatus, StreamStatusOptions, StreamStatusResult, } from "./charts/shared/useStreamStatus";
|
|
25
|
+
export { bandFromAge, DEFAULT_LIFECYCLE_THRESHOLDS } from "./realtime/lifecycleBands";
|
|
26
|
+
export type { LifecycleBand, LifecycleBandThresholds } from "./realtime/lifecycleBands";
|
|
@@ -19,6 +19,10 @@ export { bulletLayout } from "./recipes/bullet";
|
|
|
19
19
|
export type { BulletConfig } from "./recipes/bullet";
|
|
20
20
|
export { parallelCoordinatesLayout } from "./recipes/parallelCoordinates";
|
|
21
21
|
export type { ParallelCoordinatesConfig } from "./recipes/parallelCoordinates";
|
|
22
|
+
export { annotationLayout } from "./recipes/annotationLayout";
|
|
23
|
+
export type { AnnotationLayoutConfig, AnnotationLayoutOptions, AutoPlaceAnnotations, AutoPlaceAnnotationsConfig, AnnotationCohesion, AnnotationAudience, } from "./recipes/annotationLayout";
|
|
24
|
+
export { annotationDensity, annotationBudget, DEFAULT_AREA_PER_ANNOTATION } from "./recipes/annotationDensity";
|
|
25
|
+
export type { AnnotationDensityConfig, AnnotationDensityOptions, AnnotationDensityResult, } from "./recipes/annotationDensity";
|
|
22
26
|
export type { CustomLayout, LayoutContext, LayoutResult, } from "./stream/customLayout";
|
|
23
27
|
export type { NetworkCustomLayout, NetworkLayoutContext, NetworkLayoutResult, } from "./stream/networkCustomLayout";
|
|
24
28
|
export type { OrdinalCustomLayout, OrdinalLayoutContext, OrdinalLayoutResult, } from "./stream/ordinalCustomLayout";
|
|
@@ -17,6 +17,14 @@ export { createHatchPattern } from "./charts/shared/hatchPattern";
|
|
|
17
17
|
export type { HatchPatternOptions } from "./charts/shared/hatchPattern";
|
|
18
18
|
export { validateProps } from "./charts/shared/validateProps";
|
|
19
19
|
export { diagnoseConfig } from "./charts/shared/diagnoseConfig";
|
|
20
|
+
export { auditAccessibility, formatAccessibilityAudit, accessibilityCaveats } from "./charts/shared/auditAccessibility";
|
|
21
|
+
export { describeChart, resolveCommunicativeAct, communicativeActForIntent } from "./ai/describeChart";
|
|
22
|
+
export type { DescribeChartResult, DescribeChartOptions, DescribeLevel, CommunicativeAct, DescribeCapabilityContext } from "./ai/describeChart";
|
|
23
|
+
export { buildNavigationTree, flattenVisible, countNodes } from "./ai/navigationTree";
|
|
24
|
+
export type { NavTreeNode, NavTreeRole, BuildNavigationTreeOptions } from "./ai/navigationTree";
|
|
25
|
+
export { buildReaderGrounding } from "./ai/readerGrounding";
|
|
26
|
+
export type { ChartReaderGrounding, ChartReaderGroundingOptions, ChartReaderGroundingIntent } from "./ai/readerGrounding";
|
|
27
|
+
export type { A11yPrinciple, A11yStatus, A11yFinding, AccessibilityAuditResult, AuditAccessibilityOptions } from "./charts/shared/auditAccessibility";
|
|
20
28
|
export { getHitRadius } from "./stream/hitTestUtils";
|
|
21
29
|
export { toConfig, fromConfig, toURL, fromURL, copyConfig, configToJSX } from "./export/chartConfig";
|
|
22
30
|
export type { ChartConfig, ToConfigOptions, CopyFormat } from "./export/chartConfig";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* semiotic/value — Focal-value visualizations.
|
|
3
|
+
*
|
|
4
|
+
* Charts that render *one* number rather than a coordinate space. At
|
|
5
|
+
* row counts of 1–3, a chart is usually the wrong abstraction — the
|
|
6
|
+
* scale-aware suggestion engine routes those datasets here.
|
|
7
|
+
*
|
|
8
|
+
* v1 ships `BigNumber` as a plain React component. The component is
|
|
9
|
+
* deliberately chart-dependency-free: consumers compose their own
|
|
10
|
+
* Semiotic chart (or any ReactNode) into the `trendSlot` (wide /
|
|
11
|
+
* rectangular charts, e.g. LineChart / AreaChart in sparkline mode) or
|
|
12
|
+
* `chartSlot` (square charts, e.g. DonutChart / PieChart / Scatterplot
|
|
13
|
+
* / Treemap). The slot context exposes the resolved threshold colour
|
|
14
|
+
* + sentiment + push buffer so embedded charts can theme-link.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* import { BigNumber } from "semiotic/value"
|
|
19
|
+
* import { LineChart } from "semiotic/xy"
|
|
20
|
+
* import { DonutChart } from "semiotic/ordinal"
|
|
21
|
+
*
|
|
22
|
+
* <BigNumber
|
|
23
|
+
* value={1284900}
|
|
24
|
+
* label="Q3 Revenue"
|
|
25
|
+
* format="currency"
|
|
26
|
+
* comparison={{ value: 980000, label: "vs Q2" }}
|
|
27
|
+
* target={{ value: 1500000, label: "Q3 plan" }}
|
|
28
|
+
* thresholds={[
|
|
29
|
+
* { at: -Infinity, level: "danger" },
|
|
30
|
+
* { at: 1_000_000, level: "warning" },
|
|
31
|
+
* { at: 1_300_000, level: "success" },
|
|
32
|
+
* ]}
|
|
33
|
+
* trendSlot={(ctx) => (
|
|
34
|
+
* <LineChart
|
|
35
|
+
* data={recentMonths.map((y, x) => ({ x, y }))}
|
|
36
|
+
* xAccessor="x" yAccessor="y"
|
|
37
|
+
* mode="sparkline"
|
|
38
|
+
* width={260} height={32}
|
|
39
|
+
* color={ctx.color}
|
|
40
|
+
* />
|
|
41
|
+
* )}
|
|
42
|
+
* chartSlot={(ctx) => (
|
|
43
|
+
* <DonutChart
|
|
44
|
+
* data={revenueByRegion}
|
|
45
|
+
* categoryAccessor="region" valueAccessor="revenue"
|
|
46
|
+
* width={120} height={120}
|
|
47
|
+
* />
|
|
48
|
+
* )}
|
|
49
|
+
* />
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export { BigNumber, default as BigNumberDefault } from "./charts/value/BigNumber";
|
|
53
|
+
export type { BigNumberProps, BigNumberHandle, BigNumberMode, BigNumberLevel, BigNumberDirection, BigNumberSentiment, BigNumberFormat, BigNumberThreshold, BigNumberComparison, BigNumberTarget, BigNumberPushInput, BigNumberSlot, BigNumberSlotContext } from "./charts/value/types";
|
|
54
|
+
export { buildFormatter, formatSignedDelta, formatDeltaPercent, formatDuration } from "./charts/value/formatting";
|
|
55
|
+
export { resolveThreshold, colorForLevel, buildSparklinePath } from "./charts/value/thresholdSparkline";
|
|
@@ -28,7 +28,7 @@ export type { ScatterplotProps } from "./charts/xy/Scatterplot";
|
|
|
28
28
|
export type { ConnectedScatterplotProps } from "./charts/xy/ConnectedScatterplot";
|
|
29
29
|
export type { BubbleChartProps } from "./charts/xy/BubbleChart";
|
|
30
30
|
export type { HeatmapProps } from "./charts/xy/Heatmap";
|
|
31
|
-
export type { QuadrantChartProps } from "./charts/xy/QuadrantChart";
|
|
31
|
+
export type { QuadrantChartProps, QuadrantsConfig, QuadrantsConfigOverride, QuadrantConfig, CenterlineStyle } from "./charts/xy/QuadrantChart";
|
|
32
32
|
export type { MultiAxisLineChartProps } from "./charts/xy/MultiAxisLineChart";
|
|
33
33
|
export type { CandlestickChartProps } from "./charts/xy/CandlestickChart";
|
|
34
34
|
export type { XYCustomChartProps } from "./charts/custom/XYCustomChart";
|
|
@@ -25,7 +25,7 @@ import { RealtimeWaterfallChart } from "./charts/realtime/RealtimeWaterfallChart
|
|
|
25
25
|
import { RealtimeHeatmap } from "./charts/realtime/RealtimeHeatmap";
|
|
26
26
|
export { StreamXYFrame, StreamOrdinalFrame, StreamNetworkFrame, Scatterplot, ConnectedScatterplot, LineChart, AreaChart, DifferenceChart, StackedAreaChart, Heatmap, BubbleChart, BarChart, StackedBarChart, LikertChart, SwarmPlot, BoxPlot, Histogram, ViolinPlot, RidgelinePlot, DotPlot, ForceDirectedGraph, ChordDiagram, SankeyDiagram, ProcessSankey, TreeDiagram, PieChart, DonutChart, GaugeChart, FunnelChart, GroupedBarChart, SwimlaneChart, Treemap, CirclePack, OrbitDiagram, ScatterplotMatrix, MinimapChart, QuadrantChart, MultiAxisLineChart, CandlestickChart, XYCustomChart, NetworkCustomChart, OrdinalCustomChart, LinkedCharts, ThemeProvider, useTheme, exportChart, toConfig, fromConfig, toURL, fromURL, copyConfig, configToJSX, serializeSelections, deserializeSelections, fromVegaLite, ChartErrorBoundary, ChartContainer, ChartGrid, CategoryColorProvider, useCategoryColors, ContextLayout, DetailsPanel, Tooltip, MultiLineTooltip, normalizeTooltip, RingBuffer, IncrementalExtent, RealtimeLineChart, RealtimeTemporalHistogram, RealtimeHistogram, TemporalHistogram, RealtimeSwarmChart, RealtimeWaterfallChart, RealtimeHeatmap, createHatchPattern };
|
|
27
27
|
export type { LegendLayout } from "./types/legendTypes";
|
|
28
|
-
export { ScatterplotProps, ConnectedScatterplotProps, LineChartProps, AreaChartProps, SemanticGradientStop, DifferenceChartProps, StackedAreaChartProps, HeatmapProps, BubbleChartProps, BarChartProps, StackedBarChartProps, LikertChartProps, SwarmPlotProps, BoxPlotProps, HistogramProps, ViolinPlotProps, DotPlotProps, PieChartProps, DonutChartProps, GaugeChartProps, GaugeThreshold, FunnelChartProps, GroupedBarChartProps, SwimlaneChartProps, RidgelinePlotProps, OrbitDiagramProps, OrbitNode, ForceDirectedGraphProps, ChordDiagramProps, SankeyDiagramProps, ProcessSankeyProps, ProcessSankeyTick, TreeDiagramProps, TreemapProps, CirclePackProps, ScatterplotMatrixProps, MinimapChartProps, MinimapConfig, QuadrantChartProps, MultiAxisLineChartProps, MultiAxisSeriesConfig, CandlestickChartProps, QuadrantsConfig, QuadrantConfig, CenterlineStyle, BaseChartProps, AxisConfig, Accessor, ChartAccessor, ChartMode } from "./charts";
|
|
28
|
+
export { ScatterplotProps, ConnectedScatterplotProps, LineChartProps, AreaChartProps, SemanticGradientStop, DifferenceChartProps, StackedAreaChartProps, HeatmapProps, BubbleChartProps, BarChartProps, StackedBarChartProps, LikertChartProps, SwarmPlotProps, BoxPlotProps, HistogramProps, ViolinPlotProps, DotPlotProps, PieChartProps, DonutChartProps, GaugeChartProps, GaugeThreshold, FunnelChartProps, GroupedBarChartProps, SwimlaneChartProps, RidgelinePlotProps, OrbitDiagramProps, OrbitNode, ForceDirectedGraphProps, ChordDiagramProps, SankeyDiagramProps, ProcessSankeyProps, ProcessSankeyTick, TreeDiagramProps, TreemapProps, CirclePackProps, ScatterplotMatrixProps, MinimapChartProps, MinimapConfig, QuadrantChartProps, MultiAxisLineChartProps, MultiAxisSeriesConfig, CandlestickChartProps, QuadrantsConfig, QuadrantsConfigOverride, QuadrantConfig, CenterlineStyle, BaseChartProps, AxisConfig, Accessor, ChartAccessor, ChartMode } from "./charts";
|
|
29
29
|
export type { StreamXYFrameProps, StreamXYFrameHandle, StreamChartType, RuntimeMode, SceneNode, Changeset, StreamScales, StreamLayout, CurveType, CanvasRendererFn, XYFrameAxisConfig, BandConfig } from "./stream/types";
|
|
30
30
|
export type { StreamRendererFn } from "./stream/renderers/types";
|
|
31
31
|
export type { StreamOrdinalFrameProps, StreamOrdinalFrameHandle, OrdinalChartType, OrdinalScales, OrdinalSceneNode } from "./stream/ordinalTypes";
|
|
@@ -44,6 +44,12 @@ export { COLOR_BLIND_SAFE_CATEGORICAL } from "./store/ThemeStore";
|
|
|
44
44
|
export { themeToCSS, themeToTokens, resolveThemePreset, THEME_PRESETS, CARBON_CATEGORICAL_14, CARBON_ALERT } from "./semiotic-themes";
|
|
45
45
|
export type { ThemePresetName } from "./semiotic-themes";
|
|
46
46
|
export type { ChartErrorBoundaryProps } from "./ChartErrorBoundary";
|
|
47
|
+
export { AccessibleNavTree } from "./AccessibleNavTree";
|
|
48
|
+
export type { AccessibleNavTreeProps } from "./AccessibleNavTree";
|
|
49
|
+
export { buildNavigationTree } from "./ai/navigationTree";
|
|
50
|
+
export type { NavTreeNode, NavTreeRole, BuildNavigationTreeOptions } from "./ai/navigationTree";
|
|
51
|
+
export { useNavigationSync } from "./ai/useNavigationSync";
|
|
52
|
+
export type { UseNavigationSyncOptions, UseNavigationSyncResult } from "./ai/useNavigationSync";
|
|
47
53
|
export type { ChartContainerProps, ChartContainerHandle } from "./ChartContainer";
|
|
48
54
|
export type { ChartGridProps } from "./ChartGrid";
|
|
49
55
|
export type { CategoryColorMap, CategoryColorProviderProps } from "./CategoryColors";
|
|
@@ -62,3 +68,4 @@ export type { RealtimeTemporalHistogramProps, RealtimeHistogramProps, TemporalHi
|
|
|
62
68
|
export type { RealtimeSwarmChartProps } from "./charts/realtime/RealtimeSwarmChart";
|
|
63
69
|
export type { RealtimeWaterfallChartProps } from "./charts/realtime/RealtimeWaterfallChart";
|
|
64
70
|
export type { RealtimeHeatmapProps } from "./charts/realtime/RealtimeHeatmap";
|
|
71
|
+
export type { AnnotationProvenance, AnnotationSource, AnnotationActorKind, AnnotationBasis, AnnotationLifecycle, AnnotationFreshness, AnnotationStatus, AnnotationAnchor, Annotated, } from "./ai/annotationProvenance";
|
|
@@ -7,6 +7,7 @@ import type { Datum } from "../charts/shared/datumTypes";
|
|
|
7
7
|
*/
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import type { SemioticTheme } from "../store/ThemeStore";
|
|
10
|
+
import { type AutoPlaceAnnotations } from "../recipes/annotationLayout";
|
|
10
11
|
interface AnnotationScales {
|
|
11
12
|
x?: (v: any) => number;
|
|
12
13
|
y?: (v: any) => number;
|
|
@@ -30,6 +31,7 @@ interface AnnotationLayout {
|
|
|
30
31
|
}
|
|
31
32
|
export interface StaticAnnotationConfig {
|
|
32
33
|
annotations?: Datum[];
|
|
34
|
+
autoPlaceAnnotations?: AutoPlaceAnnotations;
|
|
33
35
|
scales: AnnotationScales;
|
|
34
36
|
layout: AnnotationLayout;
|
|
35
37
|
theme: SemioticTheme;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ChartObservation } from "./ObservationStore";
|
|
2
|
+
import type { InterrogationFocus } from "./useChartInterrogation";
|
|
3
|
+
export interface UseChartFocusOptions {
|
|
4
|
+
/** Limit attention to a specific chart instance. Required when the page has more than one. */
|
|
5
|
+
chartId?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Which observation types count as "focused." Default is hover + click +
|
|
8
|
+
* selection — anything that signals user attention. Set to ["click"] for
|
|
9
|
+
* sticky-focus UIs where hover doesn't change the AI's reference point.
|
|
10
|
+
*/
|
|
11
|
+
types?: ChartObservation["type"][];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Convenience hook: returns the latest `InterrogationFocus` for use with
|
|
15
|
+
* `useChartInterrogation`'s `focus` option. Internally subscribes to the
|
|
16
|
+
* observation store and converts the latest matching observation into the
|
|
17
|
+
* focus shape.
|
|
18
|
+
*
|
|
19
|
+
* Pair with `<Chart onObservation={…} chartId="myChart" />` and an
|
|
20
|
+
* `<ObservationProvider>` ancestor.
|
|
21
|
+
*
|
|
22
|
+
* Returns `null` when no qualifying observation has fired yet.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* function ChartWithChat({ data }) {
|
|
26
|
+
* const focus = useChartFocus({ chartId: "sales" })
|
|
27
|
+
* const { ask, history, annotations } = useChartInterrogation({
|
|
28
|
+
* data,
|
|
29
|
+
* focus, // ← latest hovered/clicked datum threads in
|
|
30
|
+
* onQuery: async (q, ctx) => {
|
|
31
|
+
* // ctx.focus is the same `focus` value passed above
|
|
32
|
+
* return askLLM({ question: q, focus: ctx.focus, summary: ctx.summary })
|
|
33
|
+
* },
|
|
34
|
+
* })
|
|
35
|
+
* return (
|
|
36
|
+
* <>
|
|
37
|
+
* <LineChart data={data} chartId="sales" annotations={annotations} />
|
|
38
|
+
* <YourChatUI history={history} onAsk={ask} />
|
|
39
|
+
* </>
|
|
40
|
+
* )
|
|
41
|
+
* }
|
|
42
|
+
*/
|
|
43
|
+
export declare function useChartFocus(options?: UseChartFocusOptions): InterrogationFocus | null;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import type { Datum } from "../charts/shared/datumTypes";
|
|
2
|
+
import { type DataSummary } from "../data/DataSummarizer";
|
|
3
|
+
import type { ChartDataProfile, Suggestion } from "../ai/chartCapabilityTypes";
|
|
4
|
+
import type { IntentId } from "../ai/intents";
|
|
5
|
+
/**
|
|
6
|
+
* Identifies a single point of interest on the chart — typically the datum
|
|
7
|
+
* the user is currently hovering, clicked, or otherwise focused on. When
|
|
8
|
+
* provided, the LLM gets the explicit signal that the user is asking
|
|
9
|
+
* "about *this specific point*" rather than the chart at large.
|
|
10
|
+
*/
|
|
11
|
+
export interface InterrogationFocus {
|
|
12
|
+
/** The row the user is focused on. */
|
|
13
|
+
datum: Datum;
|
|
14
|
+
/** Pixel x coordinate, when known. Useful for anchoring response annotations. */
|
|
15
|
+
x?: number;
|
|
16
|
+
/** Pixel y coordinate, when known. */
|
|
17
|
+
y?: number;
|
|
18
|
+
/** Optional source label — "hover" / "click" / "selection". Surfaces in the LLM prompt. */
|
|
19
|
+
source?: "hover" | "click" | "selection" | "manual";
|
|
20
|
+
}
|
|
21
|
+
export interface InterrogationContext {
|
|
22
|
+
/** The data extracted from the chart (or whatever caller passed in). */
|
|
23
|
+
data: ReadonlyArray<Datum>;
|
|
24
|
+
/** Statistical summary, ready to send to an LLM. */
|
|
25
|
+
summary: DataSummary;
|
|
26
|
+
/** Shape profile — present when `includeProfile` or `includeSuggestions` is enabled. */
|
|
27
|
+
profile?: ChartDataProfile;
|
|
28
|
+
/** Heuristic chart suggestions — present when `includeSuggestions` is enabled. */
|
|
29
|
+
suggestions?: ReadonlyArray<Suggestion>;
|
|
30
|
+
/** Optional caller-supplied chart component name (e.g. "LineChart"). */
|
|
31
|
+
componentName?: string;
|
|
32
|
+
/** Optional caller-supplied chart props (accessor names, scales, etc.). */
|
|
33
|
+
props?: Record<string, unknown>;
|
|
34
|
+
/**
|
|
35
|
+
* The current focused datum — what the user is interactively pointing at.
|
|
36
|
+
* Lets the LLM tailor responses to a specific point ("why is *this* one
|
|
37
|
+
* higher than the rest?") and to anchor visual responses (callouts,
|
|
38
|
+
* comments) back at the same coordinates.
|
|
39
|
+
*/
|
|
40
|
+
focus?: InterrogationFocus;
|
|
41
|
+
}
|
|
42
|
+
export interface InterrogationResult {
|
|
43
|
+
/** Natural-language answer to display to the user. */
|
|
44
|
+
answer: string;
|
|
45
|
+
/** Optional Semiotic annotations to overlay on the chart. */
|
|
46
|
+
annotations?: ReadonlyArray<Datum>;
|
|
47
|
+
}
|
|
48
|
+
export type InterrogationQuery = (query: string, context: InterrogationContext) => Promise<InterrogationResult>;
|
|
49
|
+
export interface InterrogationMessage {
|
|
50
|
+
role: "user" | "assistant";
|
|
51
|
+
text: string;
|
|
52
|
+
}
|
|
53
|
+
export interface UseChartInterrogationOptions {
|
|
54
|
+
/** Data backing the chart. Use whatever shape the chart consumes (rows, nodes, etc.). */
|
|
55
|
+
data: ReadonlyArray<Datum> | null | undefined;
|
|
56
|
+
/** Async handler — typically calls your LLM with the query + summary. */
|
|
57
|
+
onQuery: InterrogationQuery;
|
|
58
|
+
/** Annotations to seed the merged set (e.g. existing chart annotations). */
|
|
59
|
+
initialAnnotations?: ReadonlyArray<Datum>;
|
|
60
|
+
/** Optional context passed through to onQuery for richer prompts. */
|
|
61
|
+
componentName?: string;
|
|
62
|
+
/** Optional context passed through to onQuery. */
|
|
63
|
+
props?: Record<string, unknown>;
|
|
64
|
+
/**
|
|
65
|
+
* Include the shape `profile` in the interrogation context. Required to let an LLM
|
|
66
|
+
* reason about candidate axes, distinct counts, hierarchy/network/geo detection, etc.
|
|
67
|
+
*/
|
|
68
|
+
includeProfile?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Include heuristic chart `suggestions` in the interrogation context. Implies `includeProfile`.
|
|
71
|
+
* Lets an LLM answer "would another chart show this better?" without re-deriving rules.
|
|
72
|
+
*/
|
|
73
|
+
includeSuggestions?: boolean;
|
|
74
|
+
/** When `includeSuggestions` is true, rank by this intent. */
|
|
75
|
+
suggestionsIntent?: IntentId | IntentId[];
|
|
76
|
+
/** When `includeSuggestions` is true, cap the suggestion list. Default 5. */
|
|
77
|
+
suggestionsMax?: number;
|
|
78
|
+
/**
|
|
79
|
+
* The point on the chart the user is currently focused on. Forwarded to
|
|
80
|
+
* onQuery so an LLM can answer "about this specific datum" rather than
|
|
81
|
+
* "about the chart in general." Typically wired from a chart's
|
|
82
|
+
* `onObservation` callback or the convenience `useChartFocus` hook.
|
|
83
|
+
*/
|
|
84
|
+
focus?: InterrogationFocus | null;
|
|
85
|
+
}
|
|
86
|
+
export interface UseChartInterrogationResult {
|
|
87
|
+
/** Ask a question. Updates history, annotations, loading, and error. */
|
|
88
|
+
ask: (query: string) => Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Append an AI-initiated message to the transcript without a user query.
|
|
91
|
+
*
|
|
92
|
+
* Use for proactive narration — a streaming watcher that detected an
|
|
93
|
+
* anomaly, a background analysis that surfaced an insight, an LLM that
|
|
94
|
+
* decided to volunteer information mid-session. Synchronous; no `onQuery`
|
|
95
|
+
* call. Annotations merge into the chart's `annotations` array like
|
|
96
|
+
* any other AI response.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* announce({
|
|
100
|
+
* text: "Spike detected at 14:32 — 3.2σ above rolling mean.",
|
|
101
|
+
* annotations: [{ type: "callout", ts: now, value: 850, note: "Slow query?" }],
|
|
102
|
+
* })
|
|
103
|
+
*/
|
|
104
|
+
announce: (message: {
|
|
105
|
+
text: string;
|
|
106
|
+
annotations?: ReadonlyArray<Datum>;
|
|
107
|
+
}) => void;
|
|
108
|
+
/** Conversation history, oldest first. */
|
|
109
|
+
history: ReadonlyArray<InterrogationMessage>;
|
|
110
|
+
/** Statistical summary of the data — memoized, safe to pass to a prompt. */
|
|
111
|
+
summary: DataSummary;
|
|
112
|
+
/** Merged annotations: initial + latest AI response. Pass to the chart's `annotations` prop. */
|
|
113
|
+
annotations: ReadonlyArray<Datum>;
|
|
114
|
+
/** True while onQuery is in flight. */
|
|
115
|
+
loading: boolean;
|
|
116
|
+
/** Last error from onQuery, if any. */
|
|
117
|
+
error: Error | null;
|
|
118
|
+
/** Clear history, AI annotations, and error. */
|
|
119
|
+
reset: () => void;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Headless interrogation hook — a sibling to `useChartObserver`.
|
|
123
|
+
*
|
|
124
|
+
* Generates an LLM-friendly statistical summary of your chart's data, runs queries through
|
|
125
|
+
* a caller-supplied `onQuery`, and merges any annotations the response returns so the chart
|
|
126
|
+
* can highlight what the model is talking about.
|
|
127
|
+
*
|
|
128
|
+
* The hook owns no UI. Render whatever input/transcript surface fits your product.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* const { ask, history, annotations, loading } = useChartInterrogation({
|
|
132
|
+
* data,
|
|
133
|
+
* onQuery: async (q, ctx) => {
|
|
134
|
+
* const res = await fetch("/api/chat", { method: "POST", body: JSON.stringify({ q, summary: ctx.summary }) })
|
|
135
|
+
* return res.json()
|
|
136
|
+
* },
|
|
137
|
+
* })
|
|
138
|
+
*
|
|
139
|
+
* <LineChart data={data} annotations={annotations} ... />
|
|
140
|
+
*/
|
|
141
|
+
export declare function useChartInterrogation(options: UseChartInterrogationOptions): UseChartInterrogationResult;
|
|
@@ -13,6 +13,14 @@ export declare function computeCanvasAriaLabel(scene: AnySceneNode[] | null | un
|
|
|
13
13
|
* Compute an aria-label for network charts from scene nodes and edges.
|
|
14
14
|
*/
|
|
15
15
|
export declare function computeNetworkAriaLabel(nodeCount: number, edgeCount: number, chartType: string): string;
|
|
16
|
+
interface DataRow {
|
|
17
|
+
label: string;
|
|
18
|
+
values: Record<string, string | number>;
|
|
19
|
+
}
|
|
20
|
+
/** Extract a flat list of typed rows from scene nodes, surfacing the raw datum
|
|
21
|
+
* fields (not pixel coordinates). Defensively handles missing/malformed data —
|
|
22
|
+
* never throws. Exported for direct testing. */
|
|
23
|
+
export declare function extractAllRows(scene: AnySceneNode[]): DataRow[];
|
|
16
24
|
interface AccessibleDataTableProps {
|
|
17
25
|
scene: AnySceneNode[];
|
|
18
26
|
chartType: string;
|
|
@@ -24,7 +32,8 @@ interface AccessibleDataTableProps {
|
|
|
24
32
|
/**
|
|
25
33
|
* JIT accessible data summary. Renders a lightweight sr-only button by default.
|
|
26
34
|
* On activation (or when ChartContainer's dataSummary action is toggled),
|
|
27
|
-
* computes a statistical summary (.describe()-style) and shows
|
|
35
|
+
* computes a statistical summary (.describe()-style) and shows a sample of rows
|
|
36
|
+
* (5 to start), pageable to the full dataset via "Show more".
|
|
28
37
|
*/
|
|
29
38
|
export declare function AccessibleDataTable({ scene, chartType, tableId, chartTitle }: AccessibleDataTableProps): import("react/jsx-runtime").JSX.Element | null;
|
|
30
39
|
interface NetworkAccessibleDataTableProps {
|
|
@@ -2,6 +2,8 @@ import type { Datum } from "../charts/shared/datumTypes";
|
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
import type { NetworkLabel } from "./networkTypes";
|
|
4
4
|
import type { LegendGroup, GradientLegendConfig, LegendLayout } from "../types/legendTypes";
|
|
5
|
+
import { type AutoPlaceAnnotations } from "../recipes/annotationLayout";
|
|
6
|
+
import type { AnnotationContext } from "../realtime/types";
|
|
5
7
|
type AnnotationAnchorNode = {
|
|
6
8
|
type: string;
|
|
7
9
|
datum: Datum | null;
|
|
@@ -12,6 +14,13 @@ type AnnotationAnchorNode = {
|
|
|
12
14
|
cy?: number;
|
|
13
15
|
w?: number;
|
|
14
16
|
h?: number;
|
|
17
|
+
/** Circle nodes (NetworkCircleNode, force/tree/orbit marks) carry an explicit radius. */
|
|
18
|
+
r?: number;
|
|
19
|
+
/** Arc nodes (chord, radial) carry an outer radius. */
|
|
20
|
+
outerR?: number;
|
|
21
|
+
};
|
|
22
|
+
type NetworkAnnotationContext = AnnotationContext & {
|
|
23
|
+
sceneNodes?: AnnotationAnchorNode[];
|
|
15
24
|
};
|
|
16
25
|
export interface NetworkSVGOverlayProps {
|
|
17
26
|
width: number;
|
|
@@ -50,11 +59,8 @@ export interface NetworkSVGOverlayProps {
|
|
|
50
59
|
sceneNodes?: AnnotationAnchorNode[];
|
|
51
60
|
/** Annotations */
|
|
52
61
|
annotations?: Datum[];
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
height: number;
|
|
56
|
-
sceneNodes?: AnnotationAnchorNode[];
|
|
57
|
-
}) => ReactNode;
|
|
62
|
+
autoPlaceAnnotations?: AutoPlaceAnnotations;
|
|
63
|
+
svgAnnotationRules?: (annotation: Datum, index: number, context: NetworkAnnotationContext) => ReactNode;
|
|
58
64
|
annotationFrame?: number;
|
|
59
65
|
}
|
|
60
66
|
/**
|
|
@@ -4,6 +4,7 @@ import type { OrdinalScales } from "./ordinalTypes";
|
|
|
4
4
|
import type { AnnotationContext } from "../realtime/types";
|
|
5
5
|
import type { ReactNode } from "react";
|
|
6
6
|
import type { LegendGroup, GradientLegendConfig, LegendLayout } from "../types/legendTypes";
|
|
7
|
+
import { type AutoPlaceAnnotations } from "../recipes/annotationLayout";
|
|
7
8
|
import { type AxisExtentMode } from "../charts/shared/axisExtent";
|
|
8
9
|
interface OrdinalSVGOverlayProps {
|
|
9
10
|
width: number;
|
|
@@ -52,6 +53,7 @@ interface OrdinalSVGOverlayProps {
|
|
|
52
53
|
legendLayout?: LegendLayout;
|
|
53
54
|
foregroundGraphics?: ReactNode;
|
|
54
55
|
annotations?: Datum[];
|
|
56
|
+
autoPlaceAnnotations?: AutoPlaceAnnotations;
|
|
55
57
|
svgAnnotationRules?: (annotation: Datum, index: number, context: AnnotationContext) => ReactNode;
|
|
56
58
|
annotationFrame?: number;
|
|
57
59
|
xAccessor?: string;
|
|
@@ -3,6 +3,7 @@ import type { StreamScales, MarginalGraphicsConfig, XYFrameAxisConfig } from "./
|
|
|
3
3
|
import type { AnnotationContext } from "../realtime/types";
|
|
4
4
|
import type { ReactNode } from "react";
|
|
5
5
|
import type { LegendGroup, GradientLegendConfig, LegendLayout } from "../types/legendTypes";
|
|
6
|
+
import { type AutoPlaceAnnotations } from "../recipes/annotationLayout";
|
|
6
7
|
export type AxisConfig = XYFrameAxisConfig;
|
|
7
8
|
interface SVGOverlayProps {
|
|
8
9
|
width: number;
|
|
@@ -57,6 +58,7 @@ interface SVGOverlayProps {
|
|
|
57
58
|
xValues?: number[];
|
|
58
59
|
yValues?: number[];
|
|
59
60
|
annotations?: Datum[];
|
|
61
|
+
autoPlaceAnnotations?: AutoPlaceAnnotations;
|
|
60
62
|
svgAnnotationRules?: (annotation: Datum, index: number, context: AnnotationContext) => ReactNode;
|
|
61
63
|
annotationFrame?: number;
|
|
62
64
|
xAccessor?: string;
|
|
@@ -6,6 +6,7 @@ import type { AnimateProp } from "./pipelineTransitionUtils";
|
|
|
6
6
|
import type { HoverAnnotationConfig, HoverData } from "../realtime/types";
|
|
7
7
|
import type { GeoParticleStyle } from "./GeoParticlePool";
|
|
8
8
|
import type { Datum } from "../charts/shared/datumTypes";
|
|
9
|
+
import type { AutoPlaceAnnotations } from "../recipes/annotationLayout";
|
|
9
10
|
export type ProjectionProp = GeoProjection | ProjectionName | ProjectionConfig;
|
|
10
11
|
export type ProjectionName = "mercator" | "equalEarth" | "albersUsa" | "orthographic" | "naturalEarth" | "equirectangular";
|
|
11
12
|
export interface ProjectionConfig {
|
|
@@ -94,6 +95,7 @@ export interface GeoPipelineConfig {
|
|
|
94
95
|
/** Whether to animate elements on first render */
|
|
95
96
|
introAnimation?: boolean;
|
|
96
97
|
annotations?: Datum[];
|
|
98
|
+
autoPlaceAnnotations?: AutoPlaceAnnotations;
|
|
97
99
|
pointIdAccessor?: string | ((d: Datum) => string);
|
|
98
100
|
/** ID accessor on line data — required for `removeLine` by id. */
|
|
99
101
|
lineIdAccessor?: string | ((d: Datum) => string);
|
|
@@ -174,6 +176,7 @@ export interface StreamGeoFrameProps<T = Datum> {
|
|
|
174
176
|
customClickBehavior?: (d: HoverData | null) => void;
|
|
175
177
|
customHoverBehavior?: (d: HoverData | null) => void;
|
|
176
178
|
annotations?: Datum[];
|
|
179
|
+
autoPlaceAnnotations?: AutoPlaceAnnotations;
|
|
177
180
|
decay?: DecayConfig;
|
|
178
181
|
pulse?: PulseConfig;
|
|
179
182
|
transition?: TransitionConfig;
|