semiotic 3.3.1 → 3.4.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 +25 -6
- package/README.md +1 -1
- package/ai/dist/mcp-server.js +104 -9
- package/ai/schema.json +42 -1
- package/ai/system-prompt.md +4 -0
- package/dist/components/Annotation.d.ts +42 -2
- package/dist/components/CategoryColors.d.ts +1 -1
- package/dist/components/ChartGrid.d.ts +1 -1
- package/dist/components/ContextLayout.d.ts +1 -1
- package/dist/components/DataSummaryContext.d.ts +1 -1
- package/dist/components/DetailsPanel.d.ts +3 -2
- package/dist/components/Legend.d.ts +2 -3
- package/dist/components/LinkedCharts.d.ts +9 -1
- package/dist/components/ThemeProvider.d.ts +1 -1
- package/dist/components/Tooltip/FlippingTooltip.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +4 -3
- package/dist/components/charts/geo/ChoroplethMap.d.ts +4 -4
- package/dist/components/charts/geo/DistanceCartogram.d.ts +5 -4
- package/dist/components/charts/geo/FlowMap.d.ts +4 -4
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +4 -3
- package/dist/components/charts/index.d.ts +3 -1
- package/dist/components/charts/network/ChordDiagram.d.ts +4 -3
- package/dist/components/charts/network/CirclePack.d.ts +3 -3
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +3 -2
- package/dist/components/charts/network/OrbitDiagram.d.ts +6 -5
- package/dist/components/charts/network/SankeyDiagram.d.ts +4 -3
- package/dist/components/charts/network/TreeDiagram.d.ts +3 -3
- package/dist/components/charts/network/Treemap.d.ts +3 -3
- package/dist/components/charts/ordinal/BarChart.d.ts +30 -4
- package/dist/components/charts/ordinal/BoxPlot.d.ts +4 -3
- package/dist/components/charts/ordinal/DonutChart.d.ts +4 -3
- package/dist/components/charts/ordinal/DotPlot.d.ts +13 -4
- package/dist/components/charts/ordinal/FunnelChart.d.ts +4 -3
- package/dist/components/charts/ordinal/GaugeChart.d.ts +2 -1
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +6 -5
- package/dist/components/charts/ordinal/Histogram.d.ts +4 -3
- package/dist/components/charts/ordinal/LikertChart.d.ts +8 -4
- package/dist/components/charts/ordinal/PieChart.d.ts +4 -3
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +4 -3
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +6 -5
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +4 -3
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +4 -3
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +4 -3
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +7 -6
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +10 -7
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +9 -6
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +7 -6
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +9 -6
- package/dist/components/charts/shared/ChartError.d.ts +1 -2
- package/dist/components/charts/shared/annotationResolvers.d.ts +4 -3
- package/dist/components/charts/shared/annotationRules.d.ts +2 -1
- package/dist/components/charts/shared/colorUtils.d.ts +4 -3
- package/dist/components/charts/shared/datumTypes.d.ts +20 -0
- package/dist/components/charts/shared/diagnoseConfig.d.ts +2 -7
- package/dist/components/charts/shared/formatUtils.d.ts +4 -2
- package/dist/components/charts/shared/hooks.d.ts +41 -24
- package/dist/components/charts/shared/legendUtils.d.ts +3 -2
- package/dist/components/charts/shared/mergeShapeStyle.d.ts +43 -0
- package/dist/components/charts/shared/networkUtils.d.ts +7 -6
- package/dist/components/charts/shared/selectionUtils.d.ts +14 -11
- package/dist/components/charts/shared/statisticalOverlays.d.ts +14 -26
- package/dist/components/charts/shared/statisticalOverlaysLazy.d.ts +2 -2
- package/dist/components/charts/shared/statsTooltip.d.ts +3 -2
- package/dist/components/charts/shared/tooltipUtils.d.ts +20 -7
- package/dist/components/charts/shared/types.d.ts +27 -19
- package/dist/components/charts/shared/useChartSetup.d.ts +15 -6
- package/dist/components/charts/shared/useLikertAggregation.d.ts +18 -7
- package/dist/components/charts/shared/useOrdinalStreaming.d.ts +3 -2
- package/dist/components/charts/shared/useResolvedSelection.d.ts +2 -0
- package/dist/components/charts/shared/useStreamingLegend.d.ts +2 -1
- package/dist/components/charts/shared/validateChartData.d.ts +2 -1
- package/dist/components/charts/shared/validateProps.d.ts +2 -8
- package/dist/components/charts/shared/withChartWrapper.d.ts +1 -1
- package/dist/components/charts/xy/AreaChart.d.ts +4 -3
- package/dist/components/charts/xy/BubbleChart.d.ts +4 -3
- package/dist/components/charts/xy/CandlestickChart.d.ts +47 -0
- package/dist/components/charts/xy/ConnectedScatterplot.d.ts +4 -3
- package/dist/components/charts/xy/Heatmap.d.ts +12 -7
- package/dist/components/charts/xy/LineChart.d.ts +4 -3
- package/dist/components/charts/xy/MinimapChart.d.ts +4 -4
- package/dist/components/charts/xy/MultiAxisLineChart.d.ts +5 -4
- package/dist/components/charts/xy/QuadrantChart.d.ts +4 -3
- package/dist/components/charts/xy/Scatterplot.d.ts +4 -3
- package/dist/components/charts/xy/ScatterplotMatrix.d.ts +3 -3
- package/dist/components/charts/xy/StackedAreaChart.d.ts +4 -3
- package/dist/components/data/transforms.d.ts +8 -7
- package/dist/components/export/chartConfig.d.ts +4 -3
- package/dist/components/geo/mergeData.d.ts +2 -1
- package/dist/components/realtime/BinAccumulator.d.ts +3 -2
- package/dist/components/realtime/renderers/types.d.ts +2 -1
- package/dist/components/realtime/renderers/waterfallRenderer.d.ts +2 -1
- package/dist/components/realtime/types.d.ts +32 -16
- package/dist/components/semiotic-geo.d.ts +4 -0
- package/dist/components/semiotic-network.d.ts +7 -0
- package/dist/components/semiotic-ordinal.d.ts +8 -0
- package/dist/components/semiotic-themes.d.ts +2 -1
- package/dist/components/semiotic-xy.d.ts +11 -0
- package/dist/components/semiotic.d.ts +3 -3
- package/dist/components/server/animatedGif.d.ts +4 -18
- package/dist/components/server/renderToStaticSVG.d.ts +6 -5
- package/dist/components/server/serverChartConfigs.d.ts +2 -10
- package/dist/components/server/staticAnnotations.d.ts +2 -1
- package/dist/components/server/staticLegend.d.ts +2 -1
- package/dist/components/store/ObservationStore.d.ts +4 -3
- package/dist/components/store/SelectionStore.d.ts +3 -8
- package/dist/components/store/ThemeStore.d.ts +34 -4
- package/dist/components/store/TooltipStore.d.ts +1 -1
- package/dist/components/store/useSelection.d.ts +6 -5
- package/dist/components/stream/AccessibleDataTable.d.ts +5 -5
- package/dist/components/stream/CanvasHitTester.d.ts +10 -4
- package/dist/components/stream/DataSourceAdapter.d.ts +19 -1
- package/dist/components/stream/FocusRing.d.ts +1 -2
- package/dist/components/stream/GeoCanvasHitTester.d.ts +1 -1
- package/dist/components/stream/GeoParticlePool.d.ts +2 -1
- package/dist/components/stream/GeoPipelineStore.d.ts +26 -7
- package/dist/components/stream/MarginalGraphics.d.ts +1 -2
- package/dist/components/stream/NetworkPipelineStore.d.ts +8 -2
- package/dist/components/stream/NetworkSVGOverlay.d.ts +4 -4
- package/dist/components/stream/OrdinalBrushOverlay.d.ts +1 -19
- package/dist/components/stream/OrdinalCanvasHitTester.d.ts +3 -1
- package/dist/components/stream/OrdinalPipelineStore.d.ts +44 -6
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +6 -5
- package/dist/components/stream/ParticlePool.d.ts +4 -0
- package/dist/components/stream/PipelineStore.d.ts +80 -30
- package/dist/components/stream/SVGOverlay.d.ts +10 -10
- package/dist/components/stream/SceneGraph.d.ts +6 -5
- package/dist/components/stream/StreamGeoFrame.d.ts +2 -1
- package/dist/components/stream/StreamNetworkFrame.d.ts +2 -1
- package/dist/components/stream/StreamOrdinalFrame.d.ts +2 -1
- package/dist/components/stream/StreamXYFrame.d.ts +19 -1
- package/dist/components/stream/XYBrushOverlay.d.ts +1 -21
- package/dist/components/stream/devDataAccessWarning.d.ts +2 -11
- package/dist/components/stream/geoTypes.d.ts +32 -18
- package/dist/components/stream/hoverUtils.d.ts +14 -1
- package/dist/components/stream/layouts/hierarchySceneBuilders.d.ts +4 -3
- package/dist/components/stream/layouts/hierarchyUtils.d.ts +4 -3
- package/dist/components/stream/networkTypes.d.ts +51 -28
- package/dist/components/stream/ordinalSceneBuilders/barFunnelScene.d.ts +1 -1
- package/dist/components/stream/ordinalSceneBuilders/barScene.d.ts +2 -2
- package/dist/components/stream/ordinalSceneBuilders/connectorScene.d.ts +1 -1
- package/dist/components/stream/ordinalSceneBuilders/pointScene.d.ts +2 -2
- package/dist/components/stream/ordinalSceneBuilders/statisticalScene.d.ts +4 -4
- package/dist/components/stream/ordinalSceneBuilders/swimlaneScene.d.ts +1 -1
- package/dist/components/stream/ordinalSceneBuilders/timelineScene.d.ts +1 -1
- package/dist/components/stream/ordinalSceneBuilders/types.d.ts +9 -8
- package/dist/components/stream/ordinalTypes.d.ts +102 -29
- package/dist/components/stream/pipelineDecay.d.ts +2 -1
- package/dist/components/stream/pipelinePulse.d.ts +2 -1
- package/dist/components/stream/pipelineTransitionUtils.d.ts +21 -0
- package/dist/components/stream/pipelineTransitions.d.ts +16 -4
- package/dist/components/stream/quadtreeHitTest.d.ts +22 -0
- package/dist/components/stream/renderers/colorUtils.d.ts +20 -0
- package/dist/components/stream/renderers/resolveCSSColor.d.ts +23 -6
- package/dist/components/stream/types.d.ts +63 -8
- package/dist/components/stream/useFrame.d.ts +122 -0
- package/dist/components/stream/xySceneBuilders/areaScene.d.ts +3 -2
- package/dist/components/stream/xySceneBuilders/barScene.d.ts +2 -1
- package/dist/components/stream/xySceneBuilders/boundsScene.d.ts +2 -1
- package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +2 -1
- package/dist/components/stream/xySceneBuilders/emitPointNodes.d.ts +3 -2
- package/dist/components/stream/xySceneBuilders/heatmapScene.d.ts +2 -1
- package/dist/components/stream/xySceneBuilders/lineScene.d.ts +2 -1
- package/dist/components/stream/xySceneBuilders/mixedScene.d.ts +2 -1
- package/dist/components/stream/xySceneBuilders/pointScene.d.ts +2 -1
- package/dist/components/stream/xySceneBuilders/swarmScene.d.ts +2 -1
- package/dist/components/stream/xySceneBuilders/types.d.ts +35 -26
- package/dist/components/stream/xySceneBuilders/waterfallScene.d.ts +2 -1
- package/dist/components/types/marginType.d.ts +15 -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.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-geo.d.ts +4 -0
- package/dist/semiotic-network.d.ts +7 -0
- package/dist/semiotic-ordinal.d.ts +8 -0
- package/dist/semiotic-statisticalOverlays-Ckd_jM8z.js +1 -0
- package/dist/semiotic-themes.d.ts +2 -1
- package/dist/semiotic-themes.min.js +1 -1
- package/dist/semiotic-themes.module.min.js +1 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +11 -0
- package/dist/semiotic.d.ts +3 -3
- 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/test-utils/canvasMock.d.ts +35 -1
- package/dist/test-utils/ordinalFixtures.d.ts +48 -0
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +50 -42
- package/dist/components/types/annotationTypes.d.ts +0 -145
- package/dist/components/types/generalTypes.d.ts +0 -241
- package/dist/components/types/interactionTypes.d.ts +0 -72
- package/dist/components/types/networkTypes.d.ts +0 -174
- package/dist/components/types/ordinalTypes.d.ts +0 -112
- package/dist/semiotic-statisticalOverlays-DGX_WWc5.js +0 -1
package/CLAUDE.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Quick Start
|
|
4
4
|
- Install: `npm install semiotic`
|
|
5
|
-
- **Use sub-path imports** — `semiotic/xy` (
|
|
5
|
+
- **Use sub-path imports** — `semiotic/xy` (78KB gz), `semiotic/ordinal` (65KB), `semiotic/network` (54KB), `semiotic/geo` (53KB), `semiotic/realtime` (77KB), `semiotic/server` (58KB), `semiotic/utils` (19KB), `semiotic/themes` (3KB), `semiotic/data` (3KB). Full `semiotic` is 158KB gz.
|
|
6
6
|
- CLI: `npx semiotic-ai [--schema|--compact|--examples|--doctor]`
|
|
7
7
|
- MCP: `npx semiotic-mcp`
|
|
8
8
|
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
- Every HOC accepts `frameProps` for pass-through. TypeScript `strict: true`. Every HOC has error boundary + dev-mode validation.
|
|
13
13
|
|
|
14
14
|
## Common Props (all HOCs)
|
|
15
|
-
`title`, `description` (aria-label), `summary` (sr-only), `width` (600), `height` (400), `responsiveWidth`, `responsiveHeight`, `margin`, `className`, `color` (uniform fill), `enableHover` (true), `tooltip` (boolean | "multi" | function | config object), `showLegend`, `showGrid` (false), `frameProps`, `onObservation`, `onClick`, `chartId`, `loading` (false), `emptyContent`, `legendInteraction` ("none"|"highlight"|"isolate"), `legendPosition` ("right"|"left"|"top"|"bottom"), `emphasis` ("primary"|"secondary"), `annotations` (array), `accessibleTable` (true), `hoverHighlight` (boolean — dims non-hovered series, requires `colorBy`), `hoverRadius` (30)
|
|
15
|
+
`title`, `description` (aria-label), `summary` (sr-only), `width` (600), `height` (400), `responsiveWidth`, `responsiveHeight`, `margin`, `className`, `color` (uniform fill), `stroke` (uniform stroke color — CSS var OK), `strokeWidth` (uniform stroke width in px), `opacity` (uniform 0–1 opacity), `enableHover` (true), `tooltip` (boolean | "multi" | function | config object), `showLegend`, `showGrid` (false), `frameProps`, `onObservation`, `onClick`, `chartId`, `loading` (false), `emptyContent`, `legendInteraction` ("none"|"highlight"|"isolate"), `legendPosition` ("right"|"left"|"top"|"bottom"), `emphasis` ("primary"|"secondary"), `annotations` (array), `accessibleTable` (true), `hoverHighlight` (boolean — dims non-hovered series, requires `colorBy`), `hoverRadius` (30), `animate` (boolean | { duration?, easing?, intro? } — animated intro on first render + smooth transitions on data change; intro defaults to true when animate is enabled)
|
|
16
|
+
|
|
17
|
+
**Primitive styling props** (`color`, `stroke`, `strokeWidth`, `opacity`) apply to any shape the chart draws (bars, circles, lines, wedges, rects). Precedence: top-level prop > `frameProps.*Style` function return > HOC base > theme fallback. Use CSS variables (`stroke="var(--semiotic-border)"`) for theme-aware, cascade-overridable styling. For per-datum customization, keep using the function-form `frameProps.pieceStyle` / `pointStyle` / `lineStyle` etc. — the top-level prop overlays on top of whatever the function returns.
|
|
16
18
|
|
|
17
19
|
`onClick` receives `(datum, { x, y })`. `onObservation` receives `{ type, datum?, x?, y?, timestamp, chartType, chartId }`.
|
|
18
20
|
|
|
@@ -29,10 +31,11 @@
|
|
|
29
31
|
**Heatmap** — `data`, `xAccessor`, `yAccessor`, `valueAccessor`, `colorScheme`, `showValues`, `cellBorderColor`
|
|
30
32
|
**ScatterplotMatrix** — `data`, `fields` (array of numeric field names for grid)
|
|
31
33
|
**MinimapChart** — Overview + detail with linked zoom. Wraps an XY chart.
|
|
34
|
+
**CandlestickChart** — `data`, `xAccessor`, `highAccessor` (req), `lowAccessor` (req), `openAccessor` + `closeAccessor` (optional). With all four: OHLC bars. With only high/low: degrades to a range chart. `candlestickStyle` ({ upColor, downColor, wickColor, rangeColor, bodyWidth, wickWidth }). Honors `mode` (primary/context/sparkline).
|
|
32
35
|
|
|
33
36
|
## Ordinal Charts (`semiotic/ordinal`)
|
|
34
37
|
|
|
35
|
-
**BarChart** — `data`, `categoryAccessor`, `valueAccessor`, `orientation`, `colorBy`, `sort`, `barPadding` (40)
|
|
38
|
+
**BarChart** — `data`, `categoryAccessor`, `valueAccessor`, `orientation`, `colorBy`, `sort`, `barPadding` (40), `roundedTop`, `gradientFill` (`true` | `{topOpacity, bottomOpacity}` | `{colorStops}` — same API as AreaChart; runs tip→base)
|
|
36
39
|
**StackedBarChart** — + `stackBy` (required), `normalize`, `sort` (default false — insertion order)
|
|
37
40
|
**GroupedBarChart** — + `groupBy` (required), `barPadding` (60), `sort` (default false — insertion order)
|
|
38
41
|
**SwarmPlot** — `colorBy`, `sizeBy`, `pointRadius`, `pointOpacity`
|
|
@@ -40,7 +43,7 @@
|
|
|
40
43
|
**Histogram** — + `bins` (25), `relative`. Always horizontal.
|
|
41
44
|
**ViolinPlot** — + `bins`, `curve`, `showIQR`
|
|
42
45
|
**RidgelinePlot** — + `bins`, `amplitude` (1.5)
|
|
43
|
-
**DotPlot** — + `sort` (
|
|
46
|
+
**DotPlot** — + `sort` ("auto" — insertion order when streaming, value-desc on static), `dotRadius`, `showGrid` default true
|
|
44
47
|
**PieChart** — `categoryAccessor`, `valueAccessor`, `colorBy`, `startAngle`
|
|
45
48
|
**DonutChart** — PieChart + `innerRadius` (60), `centerContent`
|
|
46
49
|
**FunnelChart** — `stepAccessor`, `valueAccessor`, `categoryAccessor` (optional), `connectorOpacity`, `orientation`
|
|
@@ -86,20 +89,23 @@ Most HOCs support push via `forwardRef`. **Omit** `data` — do NOT pass `data={
|
|
|
86
89
|
const ref = useRef()
|
|
87
90
|
ref.current.push({ id: "p1", x: 1, y: 2 })
|
|
88
91
|
ref.current.pushMany([...points])
|
|
92
|
+
ref.current.replace([...points]) // ordinal only — full dataset replacement, preserves category order + transitions (progressively chunks large datasets)
|
|
89
93
|
ref.current.remove("p1") // by ID — requires pointIdAccessor
|
|
90
94
|
ref.current.remove(["p1", "p2"]) // batch remove
|
|
91
95
|
ref.current.update("p1", d => ({ ...d, y: 99 })) // in-place update — requires pointIdAccessor
|
|
92
96
|
ref.current.clear()
|
|
93
97
|
ref.current.getData()
|
|
98
|
+
ref.current.getScales() // returns {o, r, projection} (ordinal) / {x, y} (XY) — null if not yet computed
|
|
94
99
|
<Scatterplot ref={ref} xAccessor="x" yAccessor="y" pointIdAccessor="id" />
|
|
95
100
|
```
|
|
96
|
-
`remove()` and `update()` require an ID accessor: `pointIdAccessor` on XY/realtime charts, `dataIdAccessor` on ordinal charts. Network HOC refs also use `remove(id)`/`update(id, updater)` (operates on nodes). For edge-level operations, use `StreamNetworkFrameHandle` directly: `removeNode(id)`, `removeEdge(sourceId, targetId)` or `removeEdge(edgeId)` (requires `edgeIdAccessor`), `updateNode(id, updater)`, `updateEdge(sourceId, targetId, updater)`.
|
|
101
|
+
`remove()` and `update()` require an ID accessor: `pointIdAccessor` on XY/realtime charts, `dataIdAccessor` on ordinal charts. `replace()` is ordinal-only and routes through a bounded-ingest path that preserves category insertion-order memory and the transition position snapshot — what aggregator HOCs like LikertChart use under the hood to re-aggregate streaming input without shuffling categories or losing animations. Network HOC refs also use `remove(id)`/`update(id, updater)` (operates on nodes). For edge-level operations, use `StreamNetworkFrameHandle` directly: `removeNode(id)`, `removeEdge(sourceId, targetId)` or `removeEdge(edgeId)` (requires `edgeIdAccessor`), `updateNode(id, updater)`, `updateEdge(sourceId, targetId, updater)`.
|
|
97
102
|
Not supported: Tree, Treemap, CirclePack, Orbit, ChoroplethMap, FlowMap, ScatterplotMatrix.
|
|
98
103
|
|
|
99
104
|
## Coordinated Views
|
|
100
105
|
|
|
101
106
|
**LinkedCharts** — `selections`, **CategoryColorProvider** — `colors`|`categories` + `colorScheme`
|
|
102
107
|
Chart props: `selection`, `linkedHover`, `linkedBrush`. Hooks: `useSelection`, `useLinkedHover`, `useBrushSelection`
|
|
108
|
+
**Shared categories inside LinkedCharts → wrap in `CategoryColorProvider`.** When two or more charts encode the same categorical field (e.g. both `colorBy="region"`), wrapping in `CategoryColorProvider` gives every chart identical colors per category AND makes `LinkedCharts` render one unified legend (and suppress individual chart legends). Without it, each chart renders its own legend independently — often with mismatched colors.
|
|
103
109
|
**Linked crosshair**: `linkedHover={{ name: "sync", mode: "x-position", xField: "time" }}`. Click-to-lock: click locks crosshair (dashed white), click/Escape unlocks.
|
|
104
110
|
**ScatterplotMatrix**, **ChartContainer** (`title`, `subtitle`, `actions`), **ChartGrid** (`columns`, `gap`), **ContextLayout**
|
|
105
111
|
|
|
@@ -152,7 +158,7 @@ All HOCs accept `annotations` (array). Coordinates use data field names.
|
|
|
152
158
|
|
|
153
159
|
## Theming
|
|
154
160
|
|
|
155
|
-
CSS custom properties: `--semiotic-bg`, `--semiotic-text`, `--semiotic-text-secondary`, `--semiotic-border`, `--semiotic-grid`, `--semiotic-primary`, `--semiotic-focus`, `--semiotic-font-family`, `--semiotic-annotation-color`, `--semiotic-legend-font-size`, `--semiotic-title-font-size`, `--semiotic-tick-font-family`, `--semiotic-tooltip-bg`/`text`/`radius`/`font-size`/`shadow`.
|
|
161
|
+
CSS custom properties: `--semiotic-bg`, `--semiotic-text`, `--semiotic-text-secondary`, `--semiotic-border`, `--semiotic-grid`, `--semiotic-primary`, `--semiotic-secondary`, `--semiotic-surface`, `--semiotic-success`, `--semiotic-danger`, `--semiotic-warning`, `--semiotic-error`, `--semiotic-info`, `--semiotic-focus`, `--semiotic-font-family`, `--semiotic-annotation-color`, `--semiotic-legend-font-size`, `--semiotic-title-font-size`, `--semiotic-tick-font-family`, `--semiotic-tooltip-bg`/`text`/`radius`/`font-size`/`shadow`.
|
|
156
162
|
|
|
157
163
|
```jsx
|
|
158
164
|
<ThemeProvider theme="tufte"> {/* Named preset */}
|
|
@@ -163,6 +169,16 @@ CSS custom properties: `--semiotic-bg`, `--semiotic-text`, `--semiotic-text-seco
|
|
|
163
169
|
Presets: `light`, `dark`, `high-contrast`, `pastels`(-dark), `bi-tool`(-dark), `italian`(-dark), `tufte`(-dark), `journalist`(-dark), `playful`(-dark), `carbon`(-dark).
|
|
164
170
|
Serialization: `themeToCSS(theme, selector)`, `themeToTokens(theme)`, `resolveThemePreset(name)`.
|
|
165
171
|
|
|
172
|
+
**Semantic status roles** (on every preset): `colors.success`, `colors.danger`, `colors.warning`, `colors.error`, `colors.info`, plus `colors.secondary` and `colors.surface`. Each emits as a `--semiotic-{role}` CSS custom property. Use for status-driven charts: `<Waterfall positiveColor="var(--semiotic-success)" negativeColor="var(--semiotic-danger)" />`, `<Swimlane color="var(--semiotic-warning)" />`, bar stroke delineation `<RealtimeHistogram stroke="var(--semiotic-border)" />`, status annotations.
|
|
173
|
+
|
|
174
|
+
**Scoped CSS cascade override** (per-subtree, no ThemeProvider needed):
|
|
175
|
+
```jsx
|
|
176
|
+
<div style={{ "--semiotic-danger": "#4b0082" }}>
|
|
177
|
+
{/* every chart below inherits this danger color via canvas CSS-var lookup */}
|
|
178
|
+
</div>
|
|
179
|
+
```
|
|
180
|
+
Canvas scene builders read CSS variables via `getComputedStyle` on the canvas DOM ancestor, so standard CSS cascade rules apply even though rendering is canvas-based. Use CSS vars for **single-role** overrides; use a nested `ThemeProvider` for **array/scale** overrides (categorical palette, sequential/diverging scheme name).
|
|
181
|
+
|
|
166
182
|
## AI Features
|
|
167
183
|
`onObservation`/`useChartObserver`, `toConfig`/`fromConfig`/`toURL`/`fromURL`/`copyConfig`/`configToJSX`, `validateProps(component, props)`, `diagnoseConfig(component, props)`, `exportChart(div, { format })`, `npx semiotic-ai --doctor`
|
|
168
184
|
|
|
@@ -177,6 +193,8 @@ Serialization: `themeToCSS(theme, selector)`, `themeToTokens(theme)`, `resolveTh
|
|
|
177
193
|
- **Log scale**: Domain min clamped to 1e-6.
|
|
178
194
|
- **barPadding**: Pixel value (40/60 default). Reduce for small charts.
|
|
179
195
|
- **sort on StackedBarChart/GroupedBarChart**: Default `false` preserves insertion order. The underlying frame defaults to value-descending if `oSort` is undefined, so always pass `sort` explicitly if order matters.
|
|
196
|
+
- **sort `"auto"`** (BarChart/StackedBarChart/GroupedBarChart/DotPlot): insertion order while streaming, value-desc on static data. The right choice when using the push API — avoids categories shuffling as values fluctuate. DotPlot's default; opt-in on others.
|
|
197
|
+
- **Tooltip format cascade**: `valueFormat` (ordinal) / `xFormat` / `yFormat` (XY) / `valueFormat` on Heatmap flow to the default tooltip automatically, so axis and tooltip read identically. Only applies to the default tooltip — a custom `tooltip` prop fully overrides; re-pass the formatter inside `Tooltip({format})` / `MultiLineTooltip({fields:[{format}]})` if you want it there. Bespoke-tooltip charts (Histogram, FunnelChart, LikertChart, GaugeChart) don't participate; customize via `tooltip`.
|
|
180
198
|
- **Horizontal bars**: Need wider left margin: `margin={{ left: 120 }}`.
|
|
181
199
|
- **Push API**: Omit `data` entirely. `data={[]}` clears on every render.
|
|
182
200
|
- **frameProps style functions**: Bypass HOC color resolution — use `colorBy` prop instead.
|
|
@@ -189,6 +207,7 @@ Serialization: `themeToCSS(theme, selector)`, `themeToTokens(theme)`, `resolveTh
|
|
|
189
207
|
- **scalePadding**: Pixel inset on scale ranges. Pass via `frameProps={{ scalePadding: 12 }}`.
|
|
190
208
|
- **categoryFormat/xFormat/yFormat**: Can return ReactNode (renders in `<foreignObject>`).
|
|
191
209
|
- **Tick deduplication**: Adjacent identical labels auto-removed.
|
|
210
|
+
- **Composing overlays**: XY/Ordinal charts paint `--semiotic-bg` across the full canvas by default, hiding anything beneath. When stacking charts (e.g. `position: absolute` overlay on top of a base), pass `frameProps={{ background: "transparent" }}` on the overlay to skip the fill. Network/Geo frames don't paint bg by default, so this only matters for XY/Ordinal.
|
|
192
211
|
|
|
193
212
|
## Performance
|
|
194
213
|
|
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ generate correct code without examples.
|
|
|
34
34
|
Semiotic ships with everything an AI coding assistant needs to generate
|
|
35
35
|
correct visualizations without trial and error:
|
|
36
36
|
|
|
37
|
-
- **`semiotic/ai`** — a single import with
|
|
37
|
+
- **`semiotic/ai`** — a single import with 35 HOC charts (XY, ordinal, network, realtime), optimized for LLM code generation. Geo charts are in `semiotic/geo` to keep d3-geo out of non-geo bundles.
|
|
38
38
|
- **`ai/schema.json`** — machine-readable prop schemas for every component
|
|
39
39
|
- **`npx semiotic-mcp`** — an MCP server for tool-based chart rendering in any MCP client
|
|
40
40
|
- **`npx semiotic-ai --doctor`** — validate component + props JSON from the command line with typo suggestions and anti-pattern detection
|
package/ai/dist/mcp-server.js
CHANGED
|
@@ -24642,10 +24642,9 @@ var ProgressTokenSchema = union([string2(), number2().int()]);
|
|
|
24642
24642
|
var CursorSchema = string2();
|
|
24643
24643
|
var TaskCreationParamsSchema = looseObject({
|
|
24644
24644
|
/**
|
|
24645
|
-
*
|
|
24646
|
-
* If null, the task has unlimited lifetime until manually cleaned up.
|
|
24645
|
+
* Requested duration in milliseconds to retain task from creation.
|
|
24647
24646
|
*/
|
|
24648
|
-
ttl:
|
|
24647
|
+
ttl: number2().optional(),
|
|
24649
24648
|
/**
|
|
24650
24649
|
* Time in milliseconds to wait between task status requests.
|
|
24651
24650
|
*/
|
|
@@ -24945,7 +24944,11 @@ var ClientCapabilitiesSchema = object2({
|
|
|
24945
24944
|
/**
|
|
24946
24945
|
* Present if the client supports task creation.
|
|
24947
24946
|
*/
|
|
24948
|
-
tasks: ClientTasksCapabilitySchema.optional()
|
|
24947
|
+
tasks: ClientTasksCapabilitySchema.optional(),
|
|
24948
|
+
/**
|
|
24949
|
+
* Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name).
|
|
24950
|
+
*/
|
|
24951
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
24949
24952
|
});
|
|
24950
24953
|
var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
24951
24954
|
/**
|
|
@@ -25007,7 +25010,11 @@ var ServerCapabilitiesSchema = object2({
|
|
|
25007
25010
|
/**
|
|
25008
25011
|
* Present if the server supports task creation.
|
|
25009
25012
|
*/
|
|
25010
|
-
tasks: ServerTasksCapabilitySchema.optional()
|
|
25013
|
+
tasks: ServerTasksCapabilitySchema.optional(),
|
|
25014
|
+
/**
|
|
25015
|
+
* Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name).
|
|
25016
|
+
*/
|
|
25017
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
25011
25018
|
});
|
|
25012
25019
|
var InitializeResultSchema = ResultSchema.extend({
|
|
25013
25020
|
/**
|
|
@@ -25199,6 +25206,12 @@ var ResourceSchema = object2({
|
|
|
25199
25206
|
* The MIME type of this resource, if known.
|
|
25200
25207
|
*/
|
|
25201
25208
|
mimeType: optional(string2()),
|
|
25209
|
+
/**
|
|
25210
|
+
* The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
|
|
25211
|
+
*
|
|
25212
|
+
* This can be used by Hosts to display file sizes and estimate context window usage.
|
|
25213
|
+
*/
|
|
25214
|
+
size: optional(number2()),
|
|
25202
25215
|
/**
|
|
25203
25216
|
* Optional annotations for the client.
|
|
25204
25217
|
*/
|
|
@@ -27694,6 +27707,10 @@ var Protocol = class {
|
|
|
27694
27707
|
this._progressHandlers.clear();
|
|
27695
27708
|
this._taskProgressTokens.clear();
|
|
27696
27709
|
this._pendingDebouncedNotifications.clear();
|
|
27710
|
+
for (const info of this._timeoutInfo.values()) {
|
|
27711
|
+
clearTimeout(info.timeoutId);
|
|
27712
|
+
}
|
|
27713
|
+
this._timeoutInfo.clear();
|
|
27697
27714
|
for (const controller of this._requestHandlerAbortControllers.values()) {
|
|
27698
27715
|
controller.abort();
|
|
27699
27716
|
}
|
|
@@ -27824,7 +27841,9 @@ var Protocol = class {
|
|
|
27824
27841
|
await capturedTransport?.send(errorResponse);
|
|
27825
27842
|
}
|
|
27826
27843
|
}).catch((error48) => this._onerror(new Error(`Failed to send response: ${error48}`))).finally(() => {
|
|
27827
|
-
this._requestHandlerAbortControllers.
|
|
27844
|
+
if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
|
|
27845
|
+
this._requestHandlerAbortControllers.delete(request.id);
|
|
27846
|
+
}
|
|
27828
27847
|
});
|
|
27829
27848
|
}
|
|
27830
27849
|
_onprogress(notification) {
|
|
@@ -29837,6 +29856,9 @@ var McpServer = class {
|
|
|
29837
29856
|
annotations = rest.shift();
|
|
29838
29857
|
}
|
|
29839
29858
|
} else if (typeof firstArg === "object" && firstArg !== null) {
|
|
29859
|
+
if (Object.values(firstArg).some((v) => typeof v === "object" && v !== null)) {
|
|
29860
|
+
throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
|
|
29861
|
+
}
|
|
29840
29862
|
annotations = rest.shift();
|
|
29841
29863
|
}
|
|
29842
29864
|
}
|
|
@@ -29955,6 +29977,9 @@ function getZodSchemaObject(schema2) {
|
|
|
29955
29977
|
if (isZodRawShapeCompat(schema2)) {
|
|
29956
29978
|
return objectFromShape(schema2);
|
|
29957
29979
|
}
|
|
29980
|
+
if (!isZodSchemaInstance(schema2)) {
|
|
29981
|
+
throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
|
|
29982
|
+
}
|
|
29958
29983
|
return schema2;
|
|
29959
29984
|
}
|
|
29960
29985
|
function promptArgumentsFromSchema(schema2) {
|
|
@@ -30240,6 +30265,17 @@ var requestPrototype = {
|
|
|
30240
30265
|
}
|
|
30241
30266
|
});
|
|
30242
30267
|
});
|
|
30268
|
+
Object.defineProperty(requestPrototype, /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom"), {
|
|
30269
|
+
value: function(depth, options, inspectFn) {
|
|
30270
|
+
const props = {
|
|
30271
|
+
method: this.method,
|
|
30272
|
+
url: this.url,
|
|
30273
|
+
headers: this.headers,
|
|
30274
|
+
nativeRequest: this[requestCache]
|
|
30275
|
+
};
|
|
30276
|
+
return `Request (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`;
|
|
30277
|
+
}
|
|
30278
|
+
});
|
|
30243
30279
|
Object.setPrototypeOf(requestPrototype, Request.prototype);
|
|
30244
30280
|
var newRequest = (incoming, defaultHostname) => {
|
|
30245
30281
|
const req = Object.create(requestPrototype);
|
|
@@ -30344,6 +30380,17 @@ var Response2 = class _Response {
|
|
|
30344
30380
|
}
|
|
30345
30381
|
});
|
|
30346
30382
|
});
|
|
30383
|
+
Object.defineProperty(Response2.prototype, /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom"), {
|
|
30384
|
+
value: function(depth, options, inspectFn) {
|
|
30385
|
+
const props = {
|
|
30386
|
+
status: this.status,
|
|
30387
|
+
headers: this.headers,
|
|
30388
|
+
ok: this.ok,
|
|
30389
|
+
nativeResponse: this[responseCache]
|
|
30390
|
+
};
|
|
30391
|
+
return `Response (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`;
|
|
30392
|
+
}
|
|
30393
|
+
});
|
|
30347
30394
|
Object.setPrototypeOf(Response2, GlobalResponse);
|
|
30348
30395
|
Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
|
|
30349
30396
|
async function readWithoutBlocking(readPromise) {
|
|
@@ -30415,6 +30462,50 @@ if (typeof global.crypto === "undefined") {
|
|
|
30415
30462
|
global.crypto = import_crypto.default;
|
|
30416
30463
|
}
|
|
30417
30464
|
var outgoingEnded = /* @__PURE__ */ Symbol("outgoingEnded");
|
|
30465
|
+
var incomingDraining = /* @__PURE__ */ Symbol("incomingDraining");
|
|
30466
|
+
var DRAIN_TIMEOUT_MS = 500;
|
|
30467
|
+
var MAX_DRAIN_BYTES = 64 * 1024 * 1024;
|
|
30468
|
+
var drainIncoming = (incoming) => {
|
|
30469
|
+
const incomingWithDrainState = incoming;
|
|
30470
|
+
if (incoming.destroyed || incomingWithDrainState[incomingDraining]) {
|
|
30471
|
+
return;
|
|
30472
|
+
}
|
|
30473
|
+
incomingWithDrainState[incomingDraining] = true;
|
|
30474
|
+
if (incoming instanceof import_http2.Http2ServerRequest) {
|
|
30475
|
+
try {
|
|
30476
|
+
;
|
|
30477
|
+
incoming.stream?.close?.(import_http2.constants.NGHTTP2_NO_ERROR);
|
|
30478
|
+
} catch {
|
|
30479
|
+
}
|
|
30480
|
+
return;
|
|
30481
|
+
}
|
|
30482
|
+
let bytesRead = 0;
|
|
30483
|
+
const cleanup = () => {
|
|
30484
|
+
clearTimeout(timer);
|
|
30485
|
+
incoming.off("data", onData);
|
|
30486
|
+
incoming.off("end", cleanup);
|
|
30487
|
+
incoming.off("error", cleanup);
|
|
30488
|
+
};
|
|
30489
|
+
const forceClose = () => {
|
|
30490
|
+
cleanup();
|
|
30491
|
+
const socket = incoming.socket;
|
|
30492
|
+
if (socket && !socket.destroyed) {
|
|
30493
|
+
socket.destroySoon();
|
|
30494
|
+
}
|
|
30495
|
+
};
|
|
30496
|
+
const timer = setTimeout(forceClose, DRAIN_TIMEOUT_MS);
|
|
30497
|
+
timer.unref?.();
|
|
30498
|
+
const onData = (chunk) => {
|
|
30499
|
+
bytesRead += chunk.length;
|
|
30500
|
+
if (bytesRead > MAX_DRAIN_BYTES) {
|
|
30501
|
+
forceClose();
|
|
30502
|
+
}
|
|
30503
|
+
};
|
|
30504
|
+
incoming.on("data", onData);
|
|
30505
|
+
incoming.on("end", cleanup);
|
|
30506
|
+
incoming.on("error", cleanup);
|
|
30507
|
+
incoming.resume();
|
|
30508
|
+
};
|
|
30418
30509
|
var handleRequestError = () => new Response(null, {
|
|
30419
30510
|
status: 400
|
|
30420
30511
|
});
|
|
@@ -30586,14 +30677,18 @@ var getRequestListener = (fetchCallback, options = {}) => {
|
|
|
30586
30677
|
setTimeout(() => {
|
|
30587
30678
|
if (!incomingEnded) {
|
|
30588
30679
|
setTimeout(() => {
|
|
30589
|
-
incoming
|
|
30590
|
-
outgoing.destroy();
|
|
30680
|
+
drainIncoming(incoming);
|
|
30591
30681
|
});
|
|
30592
30682
|
}
|
|
30593
30683
|
});
|
|
30594
30684
|
}
|
|
30595
30685
|
};
|
|
30596
30686
|
}
|
|
30687
|
+
outgoing.on("finish", () => {
|
|
30688
|
+
if (!incomingEnded) {
|
|
30689
|
+
drainIncoming(incoming);
|
|
30690
|
+
}
|
|
30691
|
+
});
|
|
30597
30692
|
}
|
|
30598
30693
|
outgoing.on("close", () => {
|
|
30599
30694
|
const abortController = req[abortControllerKey];
|
|
@@ -30608,7 +30703,7 @@ var getRequestListener = (fetchCallback, options = {}) => {
|
|
|
30608
30703
|
setTimeout(() => {
|
|
30609
30704
|
if (!incomingEnded) {
|
|
30610
30705
|
setTimeout(() => {
|
|
30611
|
-
incoming
|
|
30706
|
+
drainIncoming(incoming);
|
|
30612
30707
|
});
|
|
30613
30708
|
}
|
|
30614
30709
|
});
|
package/ai/schema.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"name": "semiotic",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.4.1",
|
|
5
5
|
"description": "React data visualization library for charts, networks, and beyond",
|
|
6
6
|
"tools": [
|
|
7
7
|
{
|
|
@@ -932,6 +932,47 @@
|
|
|
932
932
|
}
|
|
933
933
|
}
|
|
934
934
|
},
|
|
935
|
+
{
|
|
936
|
+
"type": "function",
|
|
937
|
+
"function": {
|
|
938
|
+
"name": "CandlestickChart",
|
|
939
|
+
"description": "OHLC candlestick bars, or a range chart when open/close are omitted. Honors mode (primary/context/sparkline). Range variant degrades cleanly: endpoint dots + wick, sized against canvas height so sparkline rows don't render marble-sized dots.",
|
|
940
|
+
"parameters": {
|
|
941
|
+
"type": "object",
|
|
942
|
+
"properties": {
|
|
943
|
+
"data": { "type": "array", "items": { "type": "object" } },
|
|
944
|
+
"xAccessor": { "type": "string", "default": "x" },
|
|
945
|
+
"highAccessor": { "type": "string", "default": "high", "description": "Required. Upper bound (candlestick high or range top)." },
|
|
946
|
+
"lowAccessor": { "type": "string", "default": "low", "description": "Required. Lower bound (candlestick low or range bottom)." },
|
|
947
|
+
"openAccessor": { "type": "string", "description": "Optional. Pair with closeAccessor for OHLC; omit both to render a range chart." },
|
|
948
|
+
"closeAccessor": { "type": "string", "description": "Optional. See openAccessor." },
|
|
949
|
+
"candlestickStyle": {
|
|
950
|
+
"type": "object",
|
|
951
|
+
"description": "Style overrides.",
|
|
952
|
+
"properties": {
|
|
953
|
+
"upColor": { "type": "string" },
|
|
954
|
+
"downColor": { "type": "string" },
|
|
955
|
+
"wickColor": { "type": "string" },
|
|
956
|
+
"wickWidth": { "type": "number" },
|
|
957
|
+
"bodyWidth": { "type": "number" },
|
|
958
|
+
"rangeColor": { "type": "string", "description": "Color for range-mode dots and wick." }
|
|
959
|
+
}
|
|
960
|
+
},
|
|
961
|
+
"mode": { "type": "string", "enum": ["primary", "context", "sparkline"] },
|
|
962
|
+
"xLabel": { "type": "string" },
|
|
963
|
+
"yLabel": { "type": "string" },
|
|
964
|
+
"title": { "type": "string" },
|
|
965
|
+
"width": { "type": "number", "default": 600 },
|
|
966
|
+
"height": { "type": "number", "default": 400 },
|
|
967
|
+
"enableHover": { "type": "boolean", "default": true },
|
|
968
|
+
"showGrid": { "type": "boolean", "default": false },
|
|
969
|
+
"margin": { "type": "object" },
|
|
970
|
+
"annotations": { "type": "array", "items": { "type": "object" } }
|
|
971
|
+
},
|
|
972
|
+
"required": ["highAccessor", "lowAccessor"]
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
},
|
|
935
976
|
{
|
|
936
977
|
"type": "function",
|
|
937
978
|
"function": {
|
package/ai/system-prompt.md
CHANGED
|
@@ -109,6 +109,10 @@ Or use ThemeProvider with 15 named presets: `<ThemeProvider theme="tufte">`, `"t
|
|
|
109
109
|
|
|
110
110
|
`semiotic/themes` entry point: `themeToCSS(theme, selector)` generates CSS string, `themeToTokens(theme)` generates DTCG design tokens, `resolveThemePreset("tufte")` returns theme object by name. Theme objects: `TUFTE_LIGHT`, `TUFTE_DARK`, `PASTELS_LIGHT`, `BI_TOOL_LIGHT`, `ITALIAN_LIGHT`, `JOURNALIST_LIGHT`, `PLAYFUL_LIGHT`, etc.
|
|
111
111
|
|
|
112
|
+
**Semantic status roles**: Every preset defines `colors.success`, `colors.danger`, `colors.warning`, `colors.error`, `colors.info`, plus `colors.secondary` and `colors.surface`. Each emits as a `--semiotic-{role}` CSS custom property via ThemeProvider. Use for status-driven charts: `<Waterfall positiveColor="var(--semiotic-success)" negativeColor="var(--semiotic-danger)" />`, bar stroke delineation `<RealtimeHistogram stroke="var(--semiotic-border)" />`, status annotations.
|
|
113
|
+
|
|
114
|
+
**Scoped CSS cascade override** (per-subtree, no ThemeProvider needed): wrap in `<div style={{ "--semiotic-danger": "#c00" }}>` — every chart beneath inherits the override via canvas CSS-var lookup (`getComputedStyle` on the canvas's DOM ancestor). Use CSS vars for **single-role** overrides, nested `ThemeProvider` for **array/scale** overrides.
|
|
115
|
+
|
|
112
116
|
`COLOR_BLIND_SAFE_CATEGORICAL` — 8-color accessible palette (Wong 2011). Import from `semiotic`.
|
|
113
117
|
|
|
114
118
|
## Key Patterns
|
|
@@ -1,3 +1,43 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/** Props for the single-annotation renderer. Consumed only by `SemioticAnnotation`
|
|
3
|
+
* below; the broader annotation API flows through the frame-level `annotations`
|
|
4
|
+
* array and its `svgAnnotationRules` hook. */
|
|
5
|
+
export interface AnnotationProps {
|
|
6
|
+
noteData: {
|
|
7
|
+
eventListeners?: Record<string, (e: React.SyntheticEvent) => void>;
|
|
8
|
+
events?: Record<string, (e: React.SyntheticEvent) => void>;
|
|
9
|
+
type: string;
|
|
10
|
+
screenCoordinates?: number[][];
|
|
11
|
+
/** When truthy, `screenCoordinates` is read as a sequence of anchor points
|
|
12
|
+
* and one annotation renders per coordinate with `nx`/`ny` shared. */
|
|
13
|
+
coordinates?: boolean;
|
|
14
|
+
noteHeight?: number | ((d: Record<string, unknown>) => number);
|
|
15
|
+
noteWidth?: number | ((d: Record<string, unknown>) => number);
|
|
16
|
+
x: number | number[];
|
|
17
|
+
y: number | number[];
|
|
18
|
+
nx?: number;
|
|
19
|
+
ny?: number;
|
|
20
|
+
dx?: number;
|
|
21
|
+
dy?: number;
|
|
22
|
+
note: {
|
|
23
|
+
label?: string;
|
|
24
|
+
title?: string;
|
|
25
|
+
wrap?: number;
|
|
26
|
+
orientation?: string;
|
|
27
|
+
align?: string;
|
|
28
|
+
noWrap?: boolean;
|
|
29
|
+
};
|
|
30
|
+
i?: number;
|
|
31
|
+
fixedPosition?: boolean;
|
|
32
|
+
label?: string;
|
|
33
|
+
connector?: {
|
|
34
|
+
end?: "arrow";
|
|
35
|
+
};
|
|
36
|
+
subject?: Record<string, unknown>;
|
|
37
|
+
color?: string;
|
|
38
|
+
className?: string;
|
|
39
|
+
disable?: string[];
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export default function SemioticAnnotation(props: AnnotationProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -37,7 +37,7 @@ export interface CategoryColorProviderProps {
|
|
|
37
37
|
* </CategoryColorProvider>
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
export declare function CategoryColorProvider({ colors, categories, colorScheme, children, }: CategoryColorProviderProps):
|
|
40
|
+
export declare function CategoryColorProvider({ colors, categories, colorScheme, children, }: CategoryColorProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
41
41
|
export declare namespace CategoryColorProvider {
|
|
42
42
|
var displayName: string;
|
|
43
43
|
}
|
|
@@ -33,7 +33,7 @@ export interface ChartGridProps {
|
|
|
33
33
|
* </ChartGrid>
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
|
-
export declare function ChartGrid({ children, columns, minCellWidth, gap, className, style, }: ChartGridProps):
|
|
36
|
+
export declare function ChartGrid({ children, columns, minCellWidth, gap, className, style, }: ChartGridProps): import("react/jsx-runtime").JSX.Element;
|
|
37
37
|
export declare namespace ChartGrid {
|
|
38
38
|
var displayName: string;
|
|
39
39
|
}
|
|
@@ -32,7 +32,7 @@ export interface ContextLayoutProps {
|
|
|
32
32
|
* </ContextLayout>
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
|
-
export declare function ContextLayout({ children, context, position, contextSize, gap, className, style, }: ContextLayoutProps):
|
|
35
|
+
export declare function ContextLayout({ children, context, position, contextSize, gap, className, style, }: ContextLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
36
36
|
export declare namespace ContextLayout {
|
|
37
37
|
var displayName: string;
|
|
38
38
|
}
|
|
@@ -6,7 +6,7 @@ interface DataSummaryState {
|
|
|
6
6
|
}
|
|
7
7
|
export declare function DataSummaryProvider({ children }: {
|
|
8
8
|
children: React.ReactNode;
|
|
9
|
-
}):
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export declare function useDataSummary(): DataSummaryState | null;
|
|
11
11
|
export declare function useDataSummaryToggle(): (() => void) | null;
|
|
12
12
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Datum } from "./charts/shared/datumTypes";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import type { ChartObservation, ClickObservation } from "./store/ObservationStore";
|
|
3
4
|
export interface DetailsPanelProps {
|
|
@@ -5,7 +6,7 @@ export interface DetailsPanelProps {
|
|
|
5
6
|
* Render function receiving the clicked datum and the full observation.
|
|
6
7
|
* Return null to hide the panel for a given datum.
|
|
7
8
|
*/
|
|
8
|
-
children: (datum:
|
|
9
|
+
children: (datum: Datum, observation: ClickObservation) => React.ReactNode;
|
|
9
10
|
/** Panel position relative to the chart. Default: "right" */
|
|
10
11
|
position?: "right" | "bottom" | "overlay";
|
|
11
12
|
/** Panel width (for "right" position) or height (for "bottom"). Default: 300 */
|
|
@@ -31,7 +32,7 @@ export interface DetailsPanelProps {
|
|
|
31
32
|
/** Inline style overrides */
|
|
32
33
|
style?: React.CSSProperties;
|
|
33
34
|
}
|
|
34
|
-
export declare function DetailsPanel({ children, position, size, trigger, chartId, observation: directObservation, dismissOnEmpty, showClose, onToggle, className, style, }: DetailsPanelProps):
|
|
35
|
+
export declare function DetailsPanel({ children, position, size, trigger, chartId, observation: directObservation, dismissOnEmpty, showClose, onToggle, className, style, }: DetailsPanelProps): import("react/jsx-runtime").JSX.Element | null;
|
|
35
36
|
export declare namespace DetailsPanel {
|
|
36
37
|
var displayName: string;
|
|
37
38
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
import { LegendProps, GradientLegendConfig } from "./types/legendTypes";
|
|
3
2
|
/** Gradient legend for continuous/sequential color scales */
|
|
4
3
|
export declare function GradientLegend({ config, orientation, width, }: {
|
|
5
4
|
config: GradientLegendConfig;
|
|
6
5
|
orientation?: "vertical" | "horizontal";
|
|
7
6
|
width?: number;
|
|
8
|
-
}):
|
|
9
|
-
export default function Legend(props: LegendProps):
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default function Legend(props: LegendProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -44,6 +44,14 @@ export interface LinkedChartsProps {
|
|
|
44
44
|
*/
|
|
45
45
|
legendField?: string;
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Mirror of the wrap logic in Legend's renderLegendGroupHorizontal:
|
|
49
|
+
* itemWidth = SWATCH(16) + 10 + label.length * 7, wrap when the cursor
|
|
50
|
+
* would exceed maxWidth. Used only to size the container SVG — the
|
|
51
|
+
* authoritative layout still happens inside <Legend>. When width is
|
|
52
|
+
* unknown (e.g. first paint, SSR), return 1 so we don't pre-grow.
|
|
53
|
+
*/
|
|
54
|
+
export declare function estimateLegendRowCount(labels: string[], width: number): number;
|
|
47
55
|
/**
|
|
48
56
|
* LinkedCharts — context provider for coordinated chart views.
|
|
49
57
|
*
|
|
@@ -74,4 +82,4 @@ export interface LinkedChartsProps {
|
|
|
74
82
|
* </LinkedCharts>
|
|
75
83
|
* ```
|
|
76
84
|
*/
|
|
77
|
-
export declare function LinkedCharts({ children, selections, showLegend, legendPosition, legendInteraction, legendSelectionName, legendField, }: LinkedChartsProps):
|
|
85
|
+
export declare function LinkedCharts({ children, selections, showLegend, legendPosition, legendInteraction, legendSelectionName, legendField, }: LinkedChartsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,7 +7,7 @@ interface ThemeProviderProps {
|
|
|
7
7
|
theme?: ThemePresetName | Partial<SemioticTheme>;
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
}
|
|
10
|
-
declare function ThemeProviderWrapper({ theme, children }: ThemeProviderProps):
|
|
10
|
+
declare function ThemeProviderWrapper({ theme, children }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
declare function useTheme(): SemioticTheme;
|
|
12
12
|
export { ThemeProviderWrapper as ThemeProvider, useTheme };
|
|
13
13
|
export { LIGHT_THEME, DARK_THEME, HIGH_CONTRAST_THEME };
|
|
@@ -30,5 +30,5 @@ interface FlippingTooltipProps {
|
|
|
30
30
|
* After measuring the actual tooltip size via ref, repositions precisely to
|
|
31
31
|
* prevent clipping against container edges.
|
|
32
32
|
*/
|
|
33
|
-
export declare function FlippingTooltip({ x, y, containerWidth, containerHeight, margin, children, className, zIndex }: FlippingTooltipProps):
|
|
33
|
+
export declare function FlippingTooltip({ x, y, containerWidth, containerHeight, margin, children, className, zIndex }: FlippingTooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
34
34
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { Accessor } from "../charts/shared/types";
|
|
3
|
+
import type { Datum } from "../charts/shared/datumTypes";
|
|
3
4
|
/**
|
|
4
5
|
* Configuration for a single tooltip field
|
|
5
6
|
*/
|
|
@@ -87,7 +88,7 @@ export declare const defaultTooltipStyle: React.CSSProperties;
|
|
|
87
88
|
* />
|
|
88
89
|
* ```
|
|
89
90
|
*/
|
|
90
|
-
export declare function Tooltip(config?: TooltipConfig): (data: Record<string, unknown>) =>
|
|
91
|
+
export declare function Tooltip(config?: TooltipConfig): (data: Record<string, unknown>) => import("react/jsx-runtime").JSX.Element | null;
|
|
91
92
|
/**
|
|
92
93
|
* Create a multi-line tooltip that displays multiple fields
|
|
93
94
|
*
|
|
@@ -130,7 +131,7 @@ export declare function Tooltip(config?: TooltipConfig): (data: Record<string, u
|
|
|
130
131
|
* />
|
|
131
132
|
* ```
|
|
132
133
|
*/
|
|
133
|
-
export declare function MultiLineTooltip(config?: MultiLineTooltipConfig): (data: Record<string, unknown>) =>
|
|
134
|
+
export declare function MultiLineTooltip(config?: MultiLineTooltipConfig): (data: Record<string, unknown>) => import("react/jsx-runtime").JSX.Element | null;
|
|
134
135
|
/**
|
|
135
136
|
* Type for tooltip prop that chart components accept
|
|
136
137
|
*/
|
|
@@ -139,7 +140,7 @@ export type TooltipProp = boolean | "multi" | ((data: Record<string, unknown>) =
|
|
|
139
140
|
* The function signature that Stream Frames expect for tooltipContent.
|
|
140
141
|
* Compatible with HoverData and any Record-based hover object.
|
|
141
142
|
*/
|
|
142
|
-
export type TooltipContentFn = (d:
|
|
143
|
+
export type TooltipContentFn = (d: Datum) => React.ReactNode;
|
|
143
144
|
/**
|
|
144
145
|
* Multi-point tooltip: shows all series values at the hovered X position
|
|
145
146
|
* with color swatches (legend-style). Used when tooltipMode="multi".
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { Datum } from "../shared/datumTypes";
|
|
2
2
|
import type { StreamGeoFrameProps, ProjectionProp } from "../../stream/geoTypes";
|
|
3
3
|
import type { BaseChartProps, ChartAccessor } from "../shared/types";
|
|
4
4
|
import { type TooltipProp } from "../../Tooltip/Tooltip";
|
|
5
5
|
import type { LegendInteractionMode } from "../shared/hooks";
|
|
6
6
|
import { type AreasProp } from "../../geo/useReferenceAreas";
|
|
7
|
-
export interface ChoroplethMapProps<TDatum extends
|
|
7
|
+
export interface ChoroplethMapProps<TDatum extends Datum = Datum> extends BaseChartProps {
|
|
8
8
|
/** GeoJSON features or a reference string ("world-110m", "world-50m", "land-110m", "land-50m") */
|
|
9
9
|
areas: AreasProp;
|
|
10
10
|
/** Accessor for the numeric value to encode as color */
|
|
@@ -43,11 +43,11 @@ export interface ChoroplethMapProps<TDatum extends Record<string, any> = Record<
|
|
|
43
43
|
/** Fill opacity for area polygons. Useful for layering over tile basemaps. @default 1 */
|
|
44
44
|
areaOpacity?: number;
|
|
45
45
|
/** Annotations */
|
|
46
|
-
annotations?:
|
|
46
|
+
annotations?: Datum[];
|
|
47
47
|
/** Passthrough to StreamGeoFrame */
|
|
48
48
|
frameProps?: Partial<Omit<StreamGeoFrameProps, "areas" | "projection">>;
|
|
49
49
|
}
|
|
50
|
-
export declare function ChoroplethMap<TDatum extends
|
|
50
|
+
export declare function ChoroplethMap<TDatum extends Datum = Datum>(props: ChoroplethMapProps<TDatum>): import("react/jsx-runtime").JSX.Element;
|
|
51
51
|
export declare namespace ChoroplethMap {
|
|
52
52
|
var displayName: string;
|
|
53
53
|
}
|