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,42 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { Datum } from "./datumTypes";
|
|
3
|
+
export type AnnotationEmphasis = "primary" | "secondary";
|
|
4
|
+
/** A rendered annotation node paired with the source annotation it came
|
|
5
|
+
* from, so hierarchy treatment can read metadata after the per-type rule has
|
|
6
|
+
* produced the node. */
|
|
7
|
+
export interface AnnotationRenderPair {
|
|
8
|
+
node: React.ReactNode;
|
|
9
|
+
annotation: Datum;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Reveal CSS for M3 progressive disclosure. Density-deferred notes are hidden
|
|
13
|
+
* (opacity 0) until the chart they belong to is hovered or focused. The
|
|
14
|
+
* selectors are scoped to each frame's stable wrapper class so a chart only
|
|
15
|
+
* reveals its *own* deferred notes; `:focus-within` covers keyboard users who
|
|
16
|
+
* focus the canvas (the canvas lives inside the wrapper). Style rules are
|
|
17
|
+
* document-global regardless of where the `<style>` tag lands, so injecting it
|
|
18
|
+
* inside the (pointer-events:none) overlay svg is fine. Identical across charts
|
|
19
|
+
* — duplicate injections are harmless.
|
|
20
|
+
*/
|
|
21
|
+
export declare const ANNOTATION_DISCLOSURE_REVEAL_CSS: string;
|
|
22
|
+
/**
|
|
23
|
+
* Apply annotation hierarchy — Rahman et al.'s "Hierarchy" consideration,
|
|
24
|
+
* reusing the same `emphasis` token charts already accept (`"primary"` /
|
|
25
|
+
* `"secondary"`). A `secondary` annotation dims, shrinks note text through
|
|
26
|
+
* inherited SVG font-size, and yields z-order; a `primary` one paints at full
|
|
27
|
+
* weight and on top.
|
|
28
|
+
*
|
|
29
|
+
* If no explicit emphasis is declared, annotations with
|
|
30
|
+
* `provenance.confidence` get an inferred reading order: confidence
|
|
31
|
+
* descending, then authored array order. The visual output uses that order as
|
|
32
|
+
* a subtle opacity gradient, with higher-confidence notes painted later.
|
|
33
|
+
*
|
|
34
|
+
* Type-agnostic: it wraps whatever the per-type rule produced, so all
|
|
35
|
+
* annotation types get hierarchy without each rule knowing about it.
|
|
36
|
+
*
|
|
37
|
+
* Zero-overhead and structure-preserving when no annotation declares an
|
|
38
|
+
* explicit emphasis or provenance confidence: the original nodes are returned
|
|
39
|
+
* untouched (same keys, same order), so existing charts render identically.
|
|
40
|
+
* Opacity composes multiplicatively with lifecycle freshness opacity.
|
|
41
|
+
*/
|
|
42
|
+
export declare function applyAnnotationEmphasis(pairs: ReadonlyArray<AnnotationRenderPair>): React.ReactNode[];
|
|
@@ -3,8 +3,8 @@ import type { Datum } from "./datumTypes";
|
|
|
3
3
|
* Coordinate resolution helpers for annotations.
|
|
4
4
|
*
|
|
5
5
|
* Resolves data coordinates to pixel positions, respecting anchor modes
|
|
6
|
-
* (fixed, latest, sticky), pointId matching, and
|
|
7
|
-
* streaming charts where data scrolls off-screen.
|
|
6
|
+
* (fixed, latest, sticky, semantic), pointId / stableId matching, and
|
|
7
|
+
* bounds checking for streaming charts where data scrolls off-screen.
|
|
8
8
|
*
|
|
9
9
|
* Dependencies: types (AnnotationContext)
|
|
10
10
|
* Consumed by: annotationRules.tsx (all annotation type renderers)
|
|
@@ -17,6 +17,7 @@ export declare function resolveY(ann: Datum, context: AnnotationContext): number
|
|
|
17
17
|
* - "fixed" (default): resolve from annotation's own fields
|
|
18
18
|
* - "latest": resolve from the most recent datum in the buffer
|
|
19
19
|
* - "sticky": resolve from annotation fields; if not found, use cached position
|
|
20
|
+
* - "semantic": resolve from provenance.stableId; if not found, use recorded fields
|
|
20
21
|
*/
|
|
21
22
|
export declare function resolveAnchoredPosition(ann: Datum, index: number, context: AnnotationContext): {
|
|
22
23
|
x: number;
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { AnnotationContext } from "../../realtime/types";
|
|
3
3
|
import type { Datum } from "./datumTypes";
|
|
4
|
+
export { applyAnnotationEmphasis, type AnnotationRenderPair } from "./annotationHierarchy";
|
|
5
|
+
type AnnotationRule = (annotation: Datum, index: number, context: AnnotationContext) => React.ReactNode | null;
|
|
6
|
+
/**
|
|
7
|
+
* Run the SVG-overlay annotation pass: dispatch each annotation through the
|
|
8
|
+
* user's `svgAnnotationRules` (falling back to the default rules), drop the
|
|
9
|
+
* ones that render nothing, then apply emphasis hierarchy. Shared verbatim by
|
|
10
|
+
* the XY and ordinal overlays so the dispatch/filter/hierarchy logic lives in
|
|
11
|
+
* one place.
|
|
12
|
+
*
|
|
13
|
+
* Falsy-node semantics match the pre-emphasis `.filter(Boolean)` exactly: a
|
|
14
|
+
* rule returning `null`/`undefined` ("skip", e.g. the default rules' out-of-
|
|
15
|
+
* bounds path) — or any other falsy node (`0`/`""`/`false`) — produces no
|
|
16
|
+
* annotation and is dropped. A user rule that returns `null`/`undefined` falls
|
|
17
|
+
* through to the default rule, preserving the existing override contract.
|
|
18
|
+
*/
|
|
19
|
+
export declare function renderAnnotationPass(annotations: ReadonlyArray<Datum>, defaultRule: AnnotationRule, userRule: AnnotationRule | undefined, context: AnnotationContext): React.ReactNode[];
|
|
4
20
|
export declare function createDefaultAnnotationRules(_frameType: "xy" | "ordinal" | "network"): (annotation: Datum, index: number, context: AnnotationContext) => React.ReactNode | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Datum } from "./datumTypes";
|
|
2
|
+
/**
|
|
3
|
+
* Note-like annotations compete for placement and density budgets. Keep this
|
|
4
|
+
* taxonomy centralized because layout, diagnostics, and accessibility checks
|
|
5
|
+
* all need to agree on what counts as a note.
|
|
6
|
+
*/
|
|
7
|
+
export declare const NOTE_ANNOTATION_TYPES: readonly ["label", "callout", "callout-circle", "callout-rect", "text", "widget"];
|
|
8
|
+
export type NoteAnnotationType = (typeof NOTE_ANNOTATION_TYPES)[number];
|
|
9
|
+
/** Note types whose default renderer draws a connector unless disabled. */
|
|
10
|
+
export declare const CONNECTOR_ANNOTATION_TYPES: readonly ["label", "callout", "callout-circle", "callout-rect"];
|
|
11
|
+
export declare function annotationType(annotation: Datum): string;
|
|
12
|
+
export declare function isNoteAnnotation(annotation: Datum): boolean;
|
|
13
|
+
export declare function annotationDisablesConnector(annotation: Datum): boolean;
|
|
14
|
+
export declare function annotationDrawsConnector(annotation: Datum): boolean;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { Datum } from "./datumTypes";
|
|
2
|
+
export type A11yPrinciple = "perceivable" | "operable" | "understandable" | "robust" | "compromising" | "assistive" | "flexible";
|
|
3
|
+
/**
|
|
4
|
+
* - `pass` — satisfied (by config or by Semiotic's built-ins)
|
|
5
|
+
* - `fail` — a problem we can prove from the config
|
|
6
|
+
* - `warn` — a likely problem or a default worth revisiting
|
|
7
|
+
* - `manual`— can't be settled statically; run the named Chartability test
|
|
8
|
+
* - `not-applicable` — heuristic doesn't apply to this chart
|
|
9
|
+
*/
|
|
10
|
+
export type A11yStatus = "pass" | "fail" | "warn" | "manual" | "not-applicable";
|
|
11
|
+
export interface A11yFinding {
|
|
12
|
+
/** Stable id, `principle.heuristic-slug` (e.g. "perceivable.low-contrast"). */
|
|
13
|
+
id: string;
|
|
14
|
+
principle: A11yPrinciple;
|
|
15
|
+
/** The Chartability heuristic name, verbatim. */
|
|
16
|
+
heuristic: string;
|
|
17
|
+
/** Chartability flags 14 of 50 heuristics as critical. */
|
|
18
|
+
critical: boolean;
|
|
19
|
+
status: A11yStatus;
|
|
20
|
+
message: string;
|
|
21
|
+
/** How to fix or, for `manual`, the test to run. */
|
|
22
|
+
fix?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface AccessibilityAuditResult {
|
|
25
|
+
component: string;
|
|
26
|
+
/** No critical heuristic is in a `fail` state. (warn/manual don't break this.) */
|
|
27
|
+
ok: boolean;
|
|
28
|
+
summary: {
|
|
29
|
+
criticalsPassed: number;
|
|
30
|
+
/** Critical heuristics actually evaluated (excludes not-applicable). */
|
|
31
|
+
criticalsEvaluated: number;
|
|
32
|
+
fails: number;
|
|
33
|
+
warnings: number;
|
|
34
|
+
manual: number;
|
|
35
|
+
passes: number;
|
|
36
|
+
};
|
|
37
|
+
findings: A11yFinding[];
|
|
38
|
+
/** Always points back to the source framework. */
|
|
39
|
+
reference: string;
|
|
40
|
+
}
|
|
41
|
+
export interface AuditAccessibilityOptions {
|
|
42
|
+
/**
|
|
43
|
+
* Whether the chart is wrapped in a ChartContainer (or otherwise exposes a
|
|
44
|
+
* data-download / copy-config affordance). Lets the audit credit the
|
|
45
|
+
* "downloadable table" and "shareable state" heuristics. ChartContainer is
|
|
46
|
+
* the opt-in layer for full-accessibility chrome (title, caption,
|
|
47
|
+
* description), so several heuristics soften their remediation toward it.
|
|
48
|
+
* Default false.
|
|
49
|
+
*/
|
|
50
|
+
inChartContainer?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Whether ChartContainer's `describe` option (auto-generated L1–L3 description
|
|
53
|
+
* via describeChart) is enabled. Lets the "features described" heuristic pass.
|
|
54
|
+
* Default false.
|
|
55
|
+
*/
|
|
56
|
+
describe?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Whether ChartContainer's `navigable` option (a structured, screen-reader-
|
|
59
|
+
* navigable tree via buildNavigationTree/AccessibleNavTree) is enabled. Lets
|
|
60
|
+
* the "navigable structure" heuristic pass — including for hierarchy charts.
|
|
61
|
+
* Default false.
|
|
62
|
+
*/
|
|
63
|
+
navigable?: boolean;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Audit a Semiotic chart configuration against the Chartability heuristics.
|
|
67
|
+
* Pure, SSR-safe, no DOM. See module docstring for what static analysis can
|
|
68
|
+
* and cannot determine.
|
|
69
|
+
*/
|
|
70
|
+
export declare function auditAccessibility(component: string, props: Datum, options?: AuditAccessibilityOptions): AccessibilityAuditResult;
|
|
71
|
+
/**
|
|
72
|
+
* Distil an audit result into terse caveat strings — the author-actionable
|
|
73
|
+
* `fail` and `warn` findings, one line each. Lets the recommender (and an AI
|
|
74
|
+
* agent) read *receivability* caveats ("8 slices is too many," "color-only
|
|
75
|
+
* encoding") from the same channel as the perceptual caveats a capability
|
|
76
|
+
* descriptor already declares, instead of two disconnected surfaces.
|
|
77
|
+
*
|
|
78
|
+
* Pure. Pair with {@link auditAccessibility}:
|
|
79
|
+
* ```ts
|
|
80
|
+
* const caveats = accessibilityCaveats(auditAccessibility("PieChart", props))
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* @param onlyCritical When true, restrict to critical heuristics (the 14 that
|
|
84
|
+
* Chartability flags). Default false — include all fail/warn findings.
|
|
85
|
+
*/
|
|
86
|
+
export declare function accessibilityCaveats(result: AccessibilityAuditResult, { onlyCritical }?: {
|
|
87
|
+
onlyCritical?: boolean;
|
|
88
|
+
}): string[];
|
|
89
|
+
/** Render an audit result as a human-readable report (used by --audit-a11y + MCP). */
|
|
90
|
+
export declare function formatAccessibilityAudit(result: AccessibilityAuditResult): string;
|
|
@@ -1,43 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Single source of truth for per-chart prop specifications.
|
|
3
|
-
*
|
|
4
|
-
* Three downstream consumers used to maintain their own per-chart entries:
|
|
5
|
-
* - `ai/schema.json` (LLM tool definitions)
|
|
6
|
-
* - `src/components/charts/shared/validationMap.ts` (runtime prop validation)
|
|
7
|
-
* - `ai/componentMetadata.cjs` (category buckets)
|
|
8
|
-
*
|
|
9
|
-
* Today, `ai/schema.json` is generated from this registry — run
|
|
10
|
-
* `npm run docs:chart-specs:schema` to refresh it after editing a spec.
|
|
11
|
-
* `validationMap.ts` and `ai/componentMetadata.cjs` are still hand-edited
|
|
12
|
-
* but are gated for parity by the registry: `check:chart-specs` (run via
|
|
13
|
-
* `npm run check:chart-specs`) regenerates each chart's schema/
|
|
14
|
-
* validation/metadata entries with the pure functions in
|
|
15
|
-
* `scripts/lib/chart-specs-generators.mjs` and fails the build on any
|
|
16
|
-
* drift, including unexpected adds or removes that bypass the registry.
|
|
17
|
-
*
|
|
18
|
-
* Design notes:
|
|
19
|
-
* - Shared prop bags (common, xyAxis, ordinalAxis) live in `PROP_BAGS` and
|
|
20
|
-
* are referenced by name in each spec so common surface stays in one place.
|
|
21
|
-
* - The runtime PropType set ("string" | "number" | "boolean" | "array" |
|
|
22
|
-
* "object" | "function") is broader than JSON Schema's, but the schema
|
|
23
|
-
* generator emits whatever types this registry declares — including
|
|
24
|
-
* "function" inside type unions (canonical entries like
|
|
25
|
-
* `RidgelinePlot.tooltip: ["function", "object"]` and
|
|
26
|
-
* `SwimlaneChart.onBrush: "function"` already use this convention; LLMs
|
|
27
|
-
* read the union and pick a non-function alternative when they can't
|
|
28
|
-
* supply a function value). For props that are purely callbacks or
|
|
29
|
-
* escape hatches an LLM cannot meaningfully populate, tag the spec
|
|
30
|
-
* with `omitFromSchema: true` to keep it in validationMap but out of
|
|
31
|
-
* schema.json. `description` and `default` annotations surface in
|
|
32
|
-
* schema.json (and MCP responses) but are dropped from validationMap
|
|
33
|
-
* (which only reads `type` and `enum`).
|
|
34
|
-
*/
|
|
35
1
|
export type PropType = "string" | "number" | "boolean" | "array" | "object" | "function";
|
|
36
2
|
export type DataShape = "array" | "object" | "network" | "realtime" | "none";
|
|
37
|
-
export type ChartCategory = "xy" | "ordinal" | "network" | "geo" | "realtime";
|
|
3
|
+
export type ChartCategory = "xy" | "ordinal" | "network" | "geo" | "realtime" | "value";
|
|
38
4
|
/**
|
|
39
|
-
* Capability tags for runtime behavior.
|
|
40
|
-
* `hoc-frame-architecture-audit` Phase 1: each chart declares which
|
|
5
|
+
* Capability tags for runtime behavior. Each chart declares which
|
|
41
6
|
* features it actually supports so docs, AI/MCP tools, and CI gates
|
|
42
7
|
* can read structured truth instead of inferring it from the source.
|
|
43
8
|
*
|
|
@@ -9,10 +9,8 @@ export interface DiagnosisResult {
|
|
|
9
9
|
ok: boolean;
|
|
10
10
|
diagnoses: Diagnosis[];
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
|
|
16
|
-
* Runs validateProps internally — validation errors are included as diagnoses.
|
|
17
|
-
*/
|
|
12
|
+
/** WCAG contrast ratio between two hex colors. Exported for reuse by the
|
|
13
|
+
* accessibility audit (auditAccessibility.ts) — single source of truth for the
|
|
14
|
+
* contrast math. Returns null if either color isn't a parseable hex. */
|
|
15
|
+
export declare function contrastRatio(hex1: string, hex2: string): number | null;
|
|
18
16
|
export declare function diagnoseConfig(componentName: string, props: Datum): DiagnosisResult;
|
|
@@ -8,8 +8,10 @@ import type { Datum } from "./datumTypes";
|
|
|
8
8
|
export interface NormalizedLinkedHover {
|
|
9
9
|
name: string;
|
|
10
10
|
fields: string[];
|
|
11
|
-
mode?: "field" | "x-position";
|
|
11
|
+
mode?: "field" | "x-position" | "series";
|
|
12
12
|
xField?: string;
|
|
13
|
+
/** Explicit series-identity field for `mode: "series"`; overrides the auto-resolved one. */
|
|
14
|
+
seriesField?: string;
|
|
13
15
|
}
|
|
14
16
|
export interface NormalizedLinkedBrush {
|
|
15
17
|
name: string;
|
|
@@ -26,8 +28,9 @@ export interface NormalizedLinkedBrush {
|
|
|
26
28
|
export declare function normalizeLinkedHover(prop: boolean | string | {
|
|
27
29
|
name?: string;
|
|
28
30
|
fields?: string[];
|
|
29
|
-
mode?: "field" | "x-position";
|
|
31
|
+
mode?: "field" | "x-position" | "series";
|
|
30
32
|
xField?: string;
|
|
33
|
+
seriesField?: string;
|
|
31
34
|
} | undefined, fallbackFields?: string[]): NormalizedLinkedHover | null;
|
|
32
35
|
/**
|
|
33
36
|
* Normalize the linkedBrush prop into a consistent config object.
|
|
@@ -5,6 +5,7 @@ import type { HoverData } from "../../realtime/types";
|
|
|
5
5
|
import type { HoverHighlightMode, LinkedHoverProp, SelectionConfig } from "./types";
|
|
6
6
|
import type { OnObservationCallback } from "../../store/ObservationStore";
|
|
7
7
|
import type { AnimateProp } from "../../stream/pipelineTransitionUtils";
|
|
8
|
+
import type { AutoPlaceAnnotations } from "../../recipes/annotationLayout";
|
|
8
9
|
/**
|
|
9
10
|
* The frames accept `tooltipContent: (d: HoverData) => ReactNode`,
|
|
10
11
|
* which is a slightly wider parameter than the `TooltipContentFn`
|
|
@@ -48,6 +49,7 @@ export interface BaseMetadataProps {
|
|
|
48
49
|
* this to the frame. Bundling it here avoids a parallel helper
|
|
49
50
|
* + 22 separate adoption edits. */
|
|
50
51
|
axisExtent?: import("./axisExtent").AxisExtentMode;
|
|
52
|
+
autoPlaceAnnotations?: AutoPlaceAnnotations;
|
|
51
53
|
}
|
|
52
54
|
export declare function buildBaseMetadataProps(input: BaseMetadataProps): BaseMetadataProps;
|
|
53
55
|
/**
|
|
@@ -3,6 +3,7 @@ import type { PartialMargin } from "../../types/marginType";
|
|
|
3
3
|
import type { OnObservationCallback } from "../../store/ObservationStore";
|
|
4
4
|
import type { AnimateProp } from "../../stream/pipelineTransitionUtils";
|
|
5
5
|
import type { Datum } from "./datumTypes";
|
|
6
|
+
import type { AutoPlaceAnnotations } from "../../recipes/annotationLayout";
|
|
6
7
|
/**
|
|
7
8
|
* Selection consumption config — makes this chart react to a named selection
|
|
8
9
|
*/
|
|
@@ -25,8 +26,9 @@ export interface SelectionConfig {
|
|
|
25
26
|
export type LinkedHoverProp = boolean | string | {
|
|
26
27
|
name?: string;
|
|
27
28
|
fields?: string[];
|
|
28
|
-
mode?: "field" | "x-position";
|
|
29
|
+
mode?: "field" | "x-position" | "series";
|
|
29
30
|
xField?: string;
|
|
31
|
+
seriesField?: string;
|
|
30
32
|
};
|
|
31
33
|
/**
|
|
32
34
|
* Linked brush config
|
|
@@ -128,6 +130,8 @@ export interface BaseChartProps {
|
|
|
128
130
|
dataIdAccessor?: string | ((d: Datum) => string);
|
|
129
131
|
/** Visual emphasis level for dashboard hierarchy. "primary" spans two columns in ChartGrid. */
|
|
130
132
|
emphasis?: "primary" | "secondary";
|
|
133
|
+
/** Opt into annotation placement assistance. Preserves authored dx/dy by default. */
|
|
134
|
+
autoPlaceAnnotations?: AutoPlaceAnnotations;
|
|
131
135
|
/** Enable declarative bounded animation (enter/exit/update transitions + intro).
|
|
132
136
|
* `true` uses defaults (300ms ease-out, intro enabled). Object form allows customization.
|
|
133
137
|
* Set `{ intro: false }` to disable the animated intro on first render. */
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ChartCapability } from "../../ai/chartCapabilityTypes";
|
|
2
|
+
/**
|
|
3
|
+
* BigNumber capability descriptor.
|
|
4
|
+
*
|
|
5
|
+
* `fits()` accepts datasets that resolve to a single focal value:
|
|
6
|
+
* - exactly one row with a numeric field, or
|
|
7
|
+
* - any dataset where a `total` / `value` aggregation makes sense
|
|
8
|
+
* and the suggestion engine has already declared the scale `tiny`.
|
|
9
|
+
*
|
|
10
|
+
* At tiny scale BigNumber is the catalog's "honest" answer: when you
|
|
11
|
+
* have one number, a chart is the wrong abstraction — show the number.
|
|
12
|
+
*/
|
|
13
|
+
export declare const BigNumberCapability: ChartCapability;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BigNumber — the focal-value HOC behind `semiotic/value`.
|
|
3
|
+
*
|
|
4
|
+
* A plain React component (no Stream Frame underneath). This ships as a forward-looking React
|
|
5
|
+
* component that already honours the contracts a `SingleValueFrame`
|
|
6
|
+
* would inherit (format cascade, threshold zones via semantic theme
|
|
7
|
+
* roles, comparison anchoring, sentence-form ARIA, push API + staleness).
|
|
8
|
+
*/
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import type { BigNumberHandle, BigNumberProps } from "./types";
|
|
11
|
+
export declare const BigNumber: (props: BigNumberProps & {
|
|
12
|
+
ref?: React.ForwardedRef<BigNumberHandle>;
|
|
13
|
+
}) => React.ReactElement | null;
|
|
14
|
+
export default BigNumber;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Number-format cascade for BigNumber.
|
|
3
|
+
*
|
|
4
|
+
* Resolves a `BigNumberFormat` shortcut (or custom fn) against the
|
|
5
|
+
* card's locale + currency + precision props and returns a memoizable
|
|
6
|
+
* formatter. All built-ins use `Intl.NumberFormat` so locale + grouping
|
|
7
|
+
* behave correctly without bundling a separate number-format library.
|
|
8
|
+
*/
|
|
9
|
+
import type { BigNumberFormat } from "./types";
|
|
10
|
+
export interface FormatContext {
|
|
11
|
+
locale?: string;
|
|
12
|
+
currency?: string;
|
|
13
|
+
precision?: number;
|
|
14
|
+
notation?: Intl.NumberFormatOptions["notation"];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Build a `(value) => string` formatter from a shortcut + context.
|
|
18
|
+
* Custom-function shortcuts are returned as-is.
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildFormatter(format: BigNumberFormat | undefined, ctx?: FormatContext): (value: number) => string;
|
|
21
|
+
/**
|
|
22
|
+
* Format a millisecond duration as a short human string:
|
|
23
|
+
* `2h 14m`, `45s`, `12ms`. Useful for latency-style KPIs.
|
|
24
|
+
*/
|
|
25
|
+
export declare function formatDuration(ms: number): string;
|
|
26
|
+
/**
|
|
27
|
+
* Decorate a formatted number with prefix/suffix. Empty strings are
|
|
28
|
+
* skipped without padding.
|
|
29
|
+
*/
|
|
30
|
+
export declare function decorate(formatted: string, prefix: string | undefined, suffix: string | undefined): string;
|
|
31
|
+
/**
|
|
32
|
+
* Format a signed delta — always carry an explicit + on positive values
|
|
33
|
+
* so the sign-as-information stays legible. Zero renders as `"0"`
|
|
34
|
+
* unformatted-by-sign (no `+0`).
|
|
35
|
+
*/
|
|
36
|
+
export declare function formatSignedDelta(delta: number, formatter: (value: number) => string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Format a percent change. `from` of 0 yields `null` (undefined ratio).
|
|
39
|
+
*/
|
|
40
|
+
export declare function formatDeltaPercent(from: number, to: number, locale?: string, precision?: number): string | null;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Threshold zone resolution + inline sparkline path builder for
|
|
3
|
+
* BigNumber. Lifted out so the component file stays focused on layout.
|
|
4
|
+
*/
|
|
5
|
+
import type { BigNumberLevel, BigNumberThreshold } from "./types";
|
|
6
|
+
/**
|
|
7
|
+
* Resolve a numeric value against an ordered threshold list. Zones are
|
|
8
|
+
* tested by "highest `at` whose bound is ≤ value." `-Infinity` works
|
|
9
|
+
* as a "catch-all" lower zone.
|
|
10
|
+
*
|
|
11
|
+
* Returns `null` when no threshold fits (caller falls back to neutral).
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveThreshold(value: number, thresholds: ReadonlyArray<BigNumberThreshold> | undefined): BigNumberThreshold | null;
|
|
14
|
+
/**
|
|
15
|
+
* Map a level + explicit-color override to a CSS color string. The
|
|
16
|
+
* neutral level falls through to `--semiotic-text` so the value reads
|
|
17
|
+
* as the regular text colour when no thresholds fire.
|
|
18
|
+
*/
|
|
19
|
+
export declare function colorForLevel(level: BigNumberLevel, explicit?: string): string;
|
|
20
|
+
export interface SparklinePoint {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Build the SVG path string for a polyline sparkline. Maps values into
|
|
26
|
+
* a [0..width] × [0..height] box; auto-fits the y-domain by default.
|
|
27
|
+
*
|
|
28
|
+
* Empty / single-point input returns an empty string.
|
|
29
|
+
*/
|
|
30
|
+
export declare function buildSparklinePath(values: ReadonlyArray<number>, opts: {
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
padding?: number;
|
|
34
|
+
yMin?: number;
|
|
35
|
+
yMax?: number;
|
|
36
|
+
}): {
|
|
37
|
+
line: string;
|
|
38
|
+
area: string;
|
|
39
|
+
points: SparklinePoint[];
|
|
40
|
+
};
|