You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(muix): add MUI X Charts (community, React/TSX) as a JavaScript entry (#8517)
Closes#8243.
Adds the **community `@mui/x-charts`** package (MIT) as the catalog's
**first React (`framework: react`) and first `.tsx`** library — the
Tier-3 / Phase-4 entry from `docs/concepts/library-expansion.md`, pulled
forward to validate the React/TSX render path end to end. `language_id`
stays `javascript`: React is a runtime constraint, not a language (§6).
## The new surface: the harness `framework: react` branch
The framework-agnostic JS libs (Chart.js/D3/ECharts/Highcharts) load a
UMD global and draw imperatively. MUI X is different and gets its own
branch in `automation/js-render/render.mjs`:
- the `.tsx` snippet **default-exports a React component**;
- the harness **esbuild-bundles** it with `react` / `react-dom` /
`@mui/x-charts` / `@mui/material` / `@emotion`, wraps it in a
**theme-aware MUI `ThemeProvider`** (mapped onto `ANYPLOT_TOKENS`),
mounts it via `createRoot`, and Playwright-screenshots `#container` at
the **exact** canvas size (3200×1800 / 2400×2400) + emits the
self-contained interactive HTML — the same contract as the UMD libs;
- it emulates **`prefers-reduced-motion: reduce`** so MUI X skips
entrance animation and the screenshot is a deterministic *final* frame.
Validated end-to-end locally with the real harness (Playwright +
Chromium): light & dark, landscape **3200×1800** and square
**2400×2400**, exact pixels from the PNG IHDR, first series in brand
green `#009E73`, theme-adaptive chrome, no clipped legends. `setup-node`
now smoke-tests the React path too (the sibling of the existing chartjs
smoke test).
## What changed
**Runtime** — `package.json` / lockfile pin `react@18.3.1`,
`react-dom@18.3.1`, `@mui/x-charts@7.29.1`, `@mui/material@5.18.0`,
`@emotion@11`. `render.mjs` gains the esbuild React branch. `npm ci
--dry-run` clean.
**Registry & backend** — `core/constants.py`: `muix` (`javascript`,
`framework: react`, `.tsx` override), added to `INTERACTIVE_LIBRARIES`.
`/libraries` surfaces `framework`. The debug matrix now builds
per-library scores via a **registry spread** (also fixes the
pre-existing bug where chartjs/d3/echarts columns were silently
dropped). `seo` + `insights` counts and display names. **No alembic
migration needed** — the `framework` column already exists and a
brand-new row inserts via the existing `on_conflict_do_nothing` seed.
**Frontend** — `LIB_TO_FRAMEWORK` + per-library extension override
(`muix → tsx`); TSX syntax highlighting (`CodeHighlighter` + d.ts shim);
`LibraryCard` React badge + MIT note; `LibrariesPage` generic
**"React-compatible" filter** (built off `LIB_TO_FRAMEWORK` so
Recharts/Vue/etc. slot in with no UI change); `PlotOfTheDay(Terminal)`
`.tsx` runner; library-count meta copy bumped **14 → 15**.
**Prompts / workflows / docs** — new `prompts/library/muix.md`; `muix`
arms in the impl-generate/repair/review/merge case tables + workflow
choices + `ALL_LIBRARIES`; canvas-gate hint; `plot-generator.md` /
`impl-*-claude.md` updated; `library-expansion.md` §1/§8/§9,
`project-guide.md`, `prompts/README.md`, `README.md`.
### Community-only hard rule (emphasized per request)
Snippets use the **MIT community `@mui/x-charts` surface only** —
`@mui/x-charts-pro` / Premium are **forbidden** (only the community
package is installed, so a Pro import fails the build). `muix.md` and
`plot-generator.md` state this prominently, while explicitly allowing
the LLM to add richer chart features when they serve the spec, as long
as every one comes from the community surface.
## Tests
- `uv run pytest tests/unit` — **1496 passed** (new: muix registry
assertions, `.tsx` discovery, framework checks).
- Frontend `yarn vitest run` — **536 passed** (new: tsx-highlighting
case, `?language=javascript` fetch, React-filter test, debug muix
column); `yarn tsc --noEmit` + `yarn lint` clean (no TS7016
carry-forward).
- `ruff check` / `ruff format --check` clean; workflow YAML validated.
Integration tests (DB-backed) run in CI; the `/libraries` shape change
only **adds** `framework`, which is safe against the existing fixtures.
https://claude.ai/code/session_01HEs4b7jkqVUSTMt8mAo7in
---
_Generated by [Claude
Code](https://claude.ai/code/session_01HEs4b7jkqVUSTMt8mAo7in)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .github/workflows/impl-review.yml
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -113,6 +113,12 @@ jobs:
113
113
LANGUAGE="javascript"
114
114
EXT=".js"
115
115
;;
116
+
muix)
117
+
# MUI X — JavaScript with framework=react, authored as TSX and
118
+
# bundled through the render harness's esbuild React branch.
119
+
LANGUAGE="javascript"
120
+
EXT=".tsx"
121
+
;;
116
122
*)
117
123
LANGUAGE="python"
118
124
EXT=".py"
@@ -275,6 +281,7 @@ jobs:
275
281
"chartjs": "The harness owns exact pixels (Playwright deviceScaleFactor 2 over a fixed mount). Drift means the snippet forced its own canvas size: set `responsive: true` + `maintainAspectRatio: false` and let the canvas fill `#container` — do NOT set canvas width/height. Use `//# anyplot-orientation: square` only for square specs.",
276
282
"d3": "The harness owns exact pixels (Playwright deviceScaleFactor 2 over a fixed mount). Size the `<svg>` to `window.ANYPLOT_SIZE` (1600×900 landscape / 1200×1200 square) — never hard-code other dimensions. Use `//# anyplot-orientation: square` only for square specs.",
277
283
"echarts": "The harness owns exact pixels (Playwright deviceScaleFactor 2 over a fixed mount). Call `echarts.init(document.getElementById('container'))` with no explicit width/height so it fills the mount; do not pass a `devicePixelRatio` (the page already runs at 2×). Use `//# anyplot-orientation: square` only for square specs.",
284
+
"muix": "The harness owns exact pixels (Playwright deviceScaleFactor 2 over a fixed mount via a MUI ThemeProvider). Size the chart with `width={window.ANYPLOT_SIZE.width}` / `height={window.ANYPLOT_SIZE.height}` (1600×900 landscape / 1200×1200 square) — never hard-code other dimensions. Use `//# anyplot-orientation: square` only for square specs.",
278
285
}
279
286
cause = causes.get(LIBRARY, f"Review `prompts/library/{LIBRARY}.md` 'Canvas — hard rule' section.")
└── implementations/ # Grouped by language; one file per library
54
+
├── python/
55
+
│ ├── matplotlib.py
56
+
│ ├── seaborn.py
57
+
│ └── ... (6 more)
58
+
├── r/ggplot2.R
59
+
├── julia/makie.jl
60
+
└── javascript/
61
+
├── chartjs.js # framework-agnostic JS libs → .js
62
+
├── d3.js
63
+
├── echarts.js
64
+
├── highcharts.js
65
+
└── muix.tsx # MUI X — React, authored as .tsx
57
66
```
58
67
59
68
**Issue-based workflow**: GitHub Issues as state machine for plot lifecycle. Status tracked via live-updating table (no sub-issues). Each library generates in parallel, creating PRs to a feature branch.
@@ -70,9 +79,10 @@ See [docs/reference/](docs/reference/) for details.
Copy file name to clipboardExpand all lines: agentic/docs/project-guide.md
+30-21Lines changed: 30 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,17 +6,16 @@ This document contains comprehensive project documentation for AI agents working
6
6
7
7
**anyplot** is an AI-powered platform for Python data visualization that automatically discovers, generates, tests, and maintains plotting examples. The platform is specification-driven: every plot starts as a library-agnostic Markdown spec, then AI generates implementations for all supported libraries.
8
8
9
-
**Supported Libraries** (10 total):
9
+
**Supported Libraries** (15 total):
10
10
11
-
*Python (9):*
11
+
*Python (8):*
12
12
-**matplotlib** - The classic standard, maximum flexibility
-**highcharts** - Industry-standard SVG charts (commercial license, free for non-commercial use); migrated Python → JavaScript in Phase 2
32
+
-**MUI X Charts** - Charts for the MUI / Material UI **React** ecosystem (`framework: react`, authored as `.tsx`). Community `@mui/x-charts` (MIT) only; Pro/Premium out of scope. The first React entry — bundled via the harness's esbuild React branch.
33
+
28
34
**Core Principle**: Community proposes plot ideas via GitHub Issues -> AI generates code -> AI quality review -> Deployed.
29
35
30
36
## Essential Commands
@@ -125,22 +131,23 @@ Everything for one plot type lives in a single directory:
0 commit comments