Commit 31afb9b
feat(impl-generate): enable interactive HTML previews for JavaScript libs (#8251)
## Problem
Interactive JS charts (echarts/chartjs/d3) render no **Interactive**
toggle on the site, even though the interactive HTML already exists in
production GCS:
```
.../plots/scatter-basic/javascript/echarts/plot-light.html → 200
.../plots/scatter-basic/javascript/echarts/plot-dark.html → 200
```
The pipeline already does the hard parts: the render harness emits
standalone `plot-{light,dark}.html`, the GCS upload promotes them (gated
only on file existence, not library), and the frontend
(`themedPreview.ts` + `SpecDetailView`/`SpecOverview`) renders
`preview_html` when present.
**The only gap:** the metadata `HAS_HTML` allowlist lists only the 6
Python interactive libs, so `preview_html_light/dark` are written as
`null` for all JavaScript libs → the frontend never shows the toggle and
the uploaded HTML sits unused.
## Fix
Enable HTML for JavaScript libs in both places that carried the
allowlist:
- the metadata block (`HAS_HTML` → `preview_html_*`)
- the issue-preview step (cosmetic "Interactive" links)
**Gated on file existence**, not language alone:
```bash
if [ "$LANGUAGE" = "javascript" ] && [ -f "$IMPL_DIR/plot-light.html" ] && [ -f "$IMPL_DIR/plot-dark.html" ]; then
HAS_HTML="true"
fi
```
so a JS lib (or a failed render) that produces no HTML can never wire
`preview_html` to a 404 — strictly safer than the current `null`.
Verified all three current JS libs emit both theme HTMLs (staging 200
for chartjs/d3, production 200 for echarts). The Python interactive
allowlist is left untouched.
## Follow-up after merge
Re-dispatch `impl-generate` for echarts/chartjs/d3 on scatter-basic so
their metadata picks up the `preview_html` URLs (the HTML is already in
GCS). No frontend change needed — the `Interactive` toggle is already
wired to `preview_html`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 8500d08 commit 31afb9b
1 file changed
Lines changed: 15 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
649 | 649 | | |
650 | 650 | | |
651 | 651 | | |
652 | | - | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
653 | 657 | | |
654 | 658 | | |
655 | 659 | | |
656 | 660 | | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
657 | 664 | | |
658 | 665 | | |
659 | 666 | | |
| |||
943 | 950 | | |
944 | 951 | | |
945 | 952 | | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
946 | 960 | | |
947 | 961 | | |
948 | 962 | | |
| |||
0 commit comments