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
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ generate correct code without examples.
|
|
|
35
35
|
Semiotic ships with everything an AI coding assistant needs to generate
|
|
36
36
|
correct visualizations without trial and error:
|
|
37
37
|
|
|
38
|
-
- **`semiotic/ai`** — a single import with
|
|
38
|
+
- **`semiotic/ai`** — a single import with the 47-chart capability catalog (XY, ordinal, network, realtime, geo, value), optimized for LLM code generation. Prefer family subpaths such as `semiotic/xy`, `semiotic/geo`, and `semiotic/value` when bundle size matters.
|
|
39
39
|
- **`ai/schema.json`** — machine-readable prop schemas for every component
|
|
40
40
|
- **`npx semiotic-mcp`** — an MCP server for tool-based chart rendering in any MCP client
|
|
41
41
|
- **`npx semiotic-ai --doctor`** — validate component + props JSON from the command line with typo suggestions and anti-pattern detection
|
|
@@ -71,6 +71,13 @@ with d3-geo projections, zoom/pan, tile basemaps, and drag-rotate globe spinning
|
|
|
71
71
|
LOESS smoothing, forecast with confidence envelopes, and anomaly detection.
|
|
72
72
|
Marginal distribution graphics on scatterplot axes with a single prop.
|
|
73
73
|
|
|
74
|
+
**First-class annotations.** Annotations are data-bound objects, not post-hoc
|
|
75
|
+
artwork. Labels, callouts, thresholds, enclosures, statistical overlays, and
|
|
76
|
+
React widgets move with the chart and render through browser, SSR, and export
|
|
77
|
+
paths. Opt into placement, hierarchy, density, progressive disclosure,
|
|
78
|
+
audience-aware amount, provenance, and editorial lifecycle when the chart
|
|
79
|
+
needs to communicate more than its encoding alone.
|
|
80
|
+
|
|
74
81
|
### Start simple, go deep
|
|
75
82
|
|
|
76
83
|
| Layer | For | Example |
|
|
@@ -278,6 +285,27 @@ configToJSX(config)
|
|
|
278
285
|
Supports bar, line, area, point, rect, arc, tick marks with encoding translation
|
|
279
286
|
for color, size, aggregation, and binning.
|
|
280
287
|
|
|
288
|
+
### Conversation Arc Telemetry
|
|
289
|
+
|
|
290
|
+
Capture and replay the path an AI-assisted chart session took:
|
|
291
|
+
|
|
292
|
+
```ts
|
|
293
|
+
import {
|
|
294
|
+
createLocalStorageConversationArcSink,
|
|
295
|
+
enableConversationArc,
|
|
296
|
+
getConversationArcStore,
|
|
297
|
+
loadConversationArc,
|
|
298
|
+
registerConversationArcSink,
|
|
299
|
+
} from "semiotic/ai"
|
|
300
|
+
|
|
301
|
+
const sink = createLocalStorageConversationArcSink({ key: "my-app:arc" })
|
|
302
|
+
registerConversationArcSink(sink)
|
|
303
|
+
enableConversationArc({ sessionId: "session-abc" })
|
|
304
|
+
|
|
305
|
+
getConversationArcStore().record({ type: "chart-rendered", component: "LineChart" })
|
|
306
|
+
loadConversationArc(sink.load(), { enabled: false })
|
|
307
|
+
```
|
|
308
|
+
|
|
281
309
|
## Bundle Sizes
|
|
282
310
|
|
|
283
311
|
Semiotic ships 12 entry points. **Don't import from `"semiotic"` unless you need everything** — use the sub-path that matches your chart type:
|
|
@@ -287,18 +315,19 @@ Semiotic ships 12 entry points. **Don't import from `"semiotic"` unless you need
|
|
|
287
315
|
|
|
288
316
|
| Entry Point | gzip | What's inside |
|
|
289
317
|
|---|---|---|
|
|
290
|
-
| `semiotic/xy` | **
|
|
291
|
-
| `semiotic/ordinal` | **
|
|
292
|
-
| `semiotic/network` | **
|
|
293
|
-
| `semiotic/geo` | **
|
|
294
|
-
| `semiotic/realtime` | **
|
|
295
|
-
| `semiotic/server` | **
|
|
296
|
-
| `semiotic/utils` | **
|
|
297
|
-
| `semiotic/recipes` | **
|
|
318
|
+
| `semiotic/xy` | **90 KB** | LineChart, AreaChart, Scatterplot, Heatmap, + 8 more XY charts |
|
|
319
|
+
| `semiotic/ordinal` | **74 KB** | BarChart, PieChart, BoxPlot, Histogram, + 11 more categorical charts |
|
|
320
|
+
| `semiotic/network` | **68 KB** | ForceDirectedGraph, SankeyDiagram, ProcessSankey, Treemap, + 4 more |
|
|
321
|
+
| `semiotic/geo` | **55 KB** | ChoroplethMap, FlowMap, DistanceCartogram, ProportionalSymbolMap |
|
|
322
|
+
| `semiotic/realtime` | **95 KB** | RealtimeLineChart, RealtimeHistogram, + 4 streaming charts |
|
|
323
|
+
| `semiotic/server` | **127 KB** | renderChart, renderDashboard, renderToImage, renderToAnimatedGif |
|
|
324
|
+
| `semiotic/utils` | **37 KB** | ThemeProvider, validators, serialization — no chart components |
|
|
325
|
+
| `semiotic/recipes` | **9 KB** | Pure layout functions (waffle, marimekko, flextree, dagre, …) |
|
|
298
326
|
| `semiotic/themes` | **4 KB** | Theme presets only (tufte, carbon, etc.) |
|
|
299
327
|
| `semiotic/data` | **3 KB** | bin, rollup, groupBy, pivot, fromVegaLite |
|
|
300
|
-
| `semiotic/
|
|
301
|
-
| `semiotic` | **
|
|
328
|
+
| `semiotic/value` | **6 KB** | BigNumber — focal-value KPI / scorecard (SingleValueFrame POC) |
|
|
329
|
+
| `semiotic/ai` | **246 KB** | All 47 schema-backed charts + validation — optimized for LLM code generation |
|
|
330
|
+
| `semiotic` | **203 KB** | Everything below (full bundle) |
|
|
302
331
|
|
|
303
332
|
<!-- semiotic-bundle-sizes:end -->
|
|
304
333
|
|
|
@@ -389,8 +418,14 @@ No API keys or authentication required. The server runs locally via stdio. HTTP
|
|
|
389
418
|
| Tool | Description |
|
|
390
419
|
|------|-------------|
|
|
391
420
|
| **`renderChart`** | Render a Semiotic chart to static SVG. Supports the components returned by `getSchema` that are marked `[renderable]`. Pass `{ component: "LineChart", props: { data: [...], xAccessor: "x", yAccessor: "y" } }`. Returns SVG string or validation errors with fix suggestions. |
|
|
392
|
-
| **`getSchema`** | Return the prop schema for a specific component. Pass `{ component: "LineChart" }` to get its props, or omit `component` to list all
|
|
393
|
-
| **`suggestChart`** |
|
|
421
|
+
| **`getSchema`** | Return the prop schema for a specific component. Pass `{ component: "LineChart" }` to get its props, or omit `component` to list all 47 chart schemas. Components marked `[renderable]` are available through `renderChart`; realtime charts require a browser/live environment. |
|
|
422
|
+
| **`suggestChart`** | Legacy sample-row recommender. Pass `{ data: [{...}, ...] }` with 1–5 sample objects plus optional broad intent/capability filters. |
|
|
423
|
+
| **`suggestCharts`** | Capability-based recommender for bounded row data. Returns ranked chart suggestions with scores, reasons, caveats, import paths, and ready-to-use props. |
|
|
424
|
+
| **`suggestStreamCharts`** | Recommend realtime charts from a stream schema, throughput, and retention hints. |
|
|
425
|
+
| **`suggestDashboard`** | Build a multi-panel dashboard suggestion that covers distinct analytical intents. |
|
|
426
|
+
| **`suggestStretchCharts`** | Recommend audience-literacy stretch picks from an `AudienceProfile`. |
|
|
427
|
+
| **`repairChartConfig`** | Check whether a requested chart fits a dataset and return ranked alternatives when it does not. |
|
|
428
|
+
| **`interrogateChart`** | Return a statistical summary and chart-aware context for answering natural-language questions with optional annotations. |
|
|
394
429
|
| **`diagnoseConfig`** | Check a chart configuration for common problems — empty data, bad dimensions, missing accessors, wrong data shape, and more. Returns a human-readable diagnostic report with actionable fixes. |
|
|
395
430
|
| **`reportIssue`** | Generate a pre-filled GitHub issue URL for bug reports or feature requests. Pass `{ title: "...", body: "...", labels: ["bug"] }`. Returns a URL the user can open to submit. |
|
|
396
431
|
| **`applyTheme`** | List named theme presets or return ThemeProvider/CSS/token usage for a preset such as `{ name: "tufte" }`. |
|
|
@@ -401,6 +436,7 @@ No API keys or authentication required. The server runs locally via stdio. HTTP
|
|
|
401
436
|
|----------|-------------|
|
|
402
437
|
| **`semiotic://schema`** | Full machine-readable component schema JSON. |
|
|
403
438
|
| **`semiotic://components`** | Component index showing renderable/browser-only status and MCP categories. |
|
|
439
|
+
| **`semiotic://behavior-contracts`** | Agent-visible semantic rules for color precedence, required prop combinations, push refs, and renderability. |
|
|
404
440
|
| **`semiotic://system-prompt`** | Compact AI instructions with import rules, chart props, SSR guidance, and pitfalls. |
|
|
405
441
|
| **`semiotic://examples`** | Copy-paste chart examples by data shape. |
|
|
406
442
|
|
|
@@ -502,7 +538,7 @@ Semiotic is indexed by AI-coding-agent documentation tools so your assistant (Cl
|
|
|
502
538
|
|
|
503
539
|
Agent-facing API surface:
|
|
504
540
|
|
|
505
|
-
- **`CLAUDE.md`**, **`ai/schema.json`**, **`ai/behaviorContracts.cjs`** — bundled in the npm tarball (see `package.json#files`); agents that install Semiotic locally read these directly. `CLAUDE.md` is the quick-start cheat sheet (HOC props, push API, theming, usage notes); `ai/schema.json` is the JSON Schema for every chart's prop surface (
|
|
541
|
+
- **`CLAUDE.md`**, **`ai/schema.json`**, **`ai/behaviorContracts.cjs`** — bundled in the npm tarball (see `package.json#files`); agents that install Semiotic locally read these directly. `CLAUDE.md` is the quick-start cheat sheet (HOC props, push API, theming, usage notes); `ai/schema.json` is the JSON Schema for every chart's prop surface (47 charts); `ai/behaviorContracts.cjs` carries the agent-visible semantic rules (color precedence, push-mode requirements, ID-accessor contracts).
|
|
506
542
|
- [**`semiotic.nteract.io/llms.txt`**](https://semiotic.nteract.io/llms.txt) + [**`/llms-full.txt`**](https://semiotic.nteract.io/llms-full.txt) — deployed at the docs site per the [llms.txt standard](https://llmstxt.org). Agents fetch the navigation map (`llms.txt`) or the full inlined docs (`llms-full.txt`) over HTTP; they're not part of the npm package itself.
|
|
507
543
|
|
|
508
544
|
## Documentation
|
|
@@ -512,7 +548,8 @@ Agent-facing API surface:
|
|
|
512
548
|
- [Getting Started](https://semiotic.nteract.io/getting-started)
|
|
513
549
|
- [Charts](https://semiotic.nteract.io/charts) — chart types with live examples
|
|
514
550
|
- [Frames](https://semiotic.nteract.io/frames) — full Frame API reference
|
|
515
|
-
- [Features](https://semiotic.nteract.io/features) — axes,
|
|
551
|
+
- [Features](https://semiotic.nteract.io/features) — axes, tooltips, interaction, responsive behavior, and composition
|
|
552
|
+
- [Annotations](https://semiotic.nteract.io/annotations) — first-class annotation types, design guidance, provenance, and lifecycle
|
|
516
553
|
- [Cookbook](https://semiotic.nteract.io/cookbook) — advanced patterns and recipes
|
|
517
554
|
- [Playground](https://semiotic.nteract.io/playground) — interactive prop exploration
|
|
518
555
|
|
package/ai/cli.js
CHANGED
|
@@ -48,6 +48,8 @@ Usage:
|
|
|
48
48
|
npx semiotic-ai --compact Print ai/system-prompt.md (compact prompt)
|
|
49
49
|
npx semiotic-ai --examples Print ai/examples.md (copy-paste examples)
|
|
50
50
|
npx semiotic-ai --doctor Validate { component, props, usageMode? } JSON from stdin
|
|
51
|
+
npx semiotic-ai --audit-a11y Audit { component, props, inChartContainer?, describe?, navigable? }
|
|
52
|
+
JSON against Chartability (POUR-CAF) accessibility heuristics
|
|
51
53
|
npx semiotic-ai --help Show this help message
|
|
52
54
|
`.trim()
|
|
53
55
|
|
|
@@ -341,6 +343,45 @@ if (flag === "--doctor") {
|
|
|
341
343
|
process.exit(0)
|
|
342
344
|
}
|
|
343
345
|
|
|
346
|
+
// --audit-a11y: grade component + props against Chartability heuristics
|
|
347
|
+
if (flag === "--audit-a11y") {
|
|
348
|
+
const input = readJSONInput("Usage: npx semiotic-ai --audit-a11y '{\"component\":\"LineChart\",\"props\":{\"data\":[...],\"xAccessor\":\"x\",\"yAccessor\":\"y\"}}'\n echo '{\"component\":\"BarChart\",\"props\":{...},\"inChartContainer\":true}' | npx semiotic-ai --audit-a11y")
|
|
349
|
+
|
|
350
|
+
try {
|
|
351
|
+
const { component, props, inChartContainer, describe, navigable } = JSON.parse(input)
|
|
352
|
+
if (!component || !props) {
|
|
353
|
+
console.error("Input must be JSON with { component, props } fields.")
|
|
354
|
+
process.exit(1)
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// Load the audit from dist (same strategy as --doctor). It lives in the
|
|
358
|
+
// semiotic/ai bundle; a clean source checkout without a build can't run it.
|
|
359
|
+
const distPath = path.join(pkgRoot, "dist", "semiotic-ai.min.js")
|
|
360
|
+
let auditAccessibility, formatAccessibilityAudit
|
|
361
|
+
try {
|
|
362
|
+
if (!process.env.SEMIOTIC_AI_SCHEMA_ONLY) {
|
|
363
|
+
const mod = require(distPath)
|
|
364
|
+
auditAccessibility = mod.auditAccessibility
|
|
365
|
+
formatAccessibilityAudit = mod.formatAccessibilityAudit
|
|
366
|
+
}
|
|
367
|
+
} catch (e) {
|
|
368
|
+
// Dist unavailable.
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
if (!auditAccessibility || !formatAccessibilityAudit) {
|
|
372
|
+
console.error("Accessibility audit requires the built library. Run `npm run dist` first, or use the MCP `auditAccessibility` tool.")
|
|
373
|
+
process.exit(2)
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
const result = auditAccessibility(component, props, { inChartContainer: inChartContainer === true, describe: describe === true, navigable: navigable === true })
|
|
377
|
+
console.log(formatAccessibilityAudit(result))
|
|
378
|
+
process.exit(result.ok ? 0 : 1)
|
|
379
|
+
} catch (err) {
|
|
380
|
+
console.error(`Failed to parse input: ${errorMessage(err)}`)
|
|
381
|
+
process.exit(1)
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
344
385
|
const filePath = flag ? FILES[flag] : FILES.default
|
|
345
386
|
|
|
346
387
|
if (!filePath) {
|
package/ai/componentMetadata.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict"
|
|
2
2
|
|
|
3
|
-
const CATEGORY_ORDER = ["xy", "ordinal", "network", "geo", "realtime"]
|
|
3
|
+
const CATEGORY_ORDER = ["xy", "ordinal", "network", "geo", "realtime", "value"]
|
|
4
4
|
|
|
5
5
|
const COMPONENTS_BY_CATEGORY = {
|
|
6
6
|
xy: [
|
|
@@ -24,6 +24,9 @@ const COMPONENTS_BY_CATEGORY = {
|
|
|
24
24
|
"RealtimeLineChart", "RealtimeHistogram", "TemporalHistogram", "RealtimeSwarmChart",
|
|
25
25
|
"RealtimeWaterfallChart", "RealtimeHeatmap",
|
|
26
26
|
],
|
|
27
|
+
value: [
|
|
28
|
+
"BigNumber",
|
|
29
|
+
],
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
const COMPONENT_TO_CATEGORY = new Map()
|
|
@@ -59,11 +62,17 @@ function metadataForComponent(entryOrName) {
|
|
|
59
62
|
// any other static HOC. Matches the name-prefix exclusion the
|
|
60
63
|
// check-surface-parity script applies.
|
|
61
64
|
const isPushOnly = category === "realtime" && name.startsWith("Realtime")
|
|
65
|
+
// Value-family charts (BigNumber, future SingleValueFrame HOCs)
|
|
66
|
+
// render via react-dom/server in a normal React tree, but they do
|
|
67
|
+
// not route through the frame-driven `renderChart` path in
|
|
68
|
+
// serverChartConfigs.ts — so they are not MCP-renderable. Mirrors
|
|
69
|
+
// the `hoc-ssr-only` special feature documented in chartSpecs.ts.
|
|
70
|
+
const isValueCategory = category === "value"
|
|
62
71
|
return {
|
|
63
72
|
name,
|
|
64
73
|
category,
|
|
65
74
|
importPath: importPathForCategory(category),
|
|
66
|
-
renderable: !isPushOnly,
|
|
75
|
+
renderable: !isPushOnly && !isValueCategory,
|
|
67
76
|
description: typeof entryOrName === "string" ? undefined : entryOrName.description,
|
|
68
77
|
}
|
|
69
78
|
}
|