Skip to content

In-browser WASM playground + site-wide UX/design polish#35

Merged
lightsofapollo merged 9 commits into
mainfrom
james/playground-wasm
Jul 18, 2026
Merged

In-browser WASM playground + site-wide UX/design polish#35
lightsofapollo merged 9 commits into
mainfrom
james/playground-wasm

Conversation

@lightsofapollo

Copy link
Copy Markdown
Contributor

What

1. /playground — the real generator, in the browser (earlier commits on this branch)

  • openapi-to-rust compiled to WebAssembly, running in a worker; paste/fetch a spec, get the generated files, download a complete crate as .tar.gz (hand-rolled ustar + native CompressionStream). Nothing is uploaded.
  • Reliable crate download + edition 2024 fixes.

2. Design-critique loop over the whole site (cb96b6e) — two dual-agent critique→fix rounds, score 25/40 → 37/40, every fix verified in a real browser at 390/768/1440:

  • P0 mobile clipping: playground panes and .doc-shell used 1fr single-column grids (min-content) under overflow: clip, making tabs/Copy/Download and docs body text unreachable ≤900px → minmax(0, 1fr).
  • Runtime-created result tabs were unstyled UA buttons (scoped Astro styles can't match JS-created elements) → styled via is:global, aria-pressed, 40px targets.
  • Generating before the WASM worker was ready was a silent no-op → queued with a status notice, auto-runs on ready.
  • A failed generate destroyed the previous result → kept visible, dimmed, under the error; role=alert/role=status on notices; result scrolls into view in single-column layout.
  • compressHTML was stripping the newline before inline <a>/<code>, jamming words together ("…review theschema notes") in 12+ places across 6 pages → compressHTML: false (+ html-validate config drops the now-conflicting trailing-whitespace rule).
  • Nested <main> removed; types.rs tab first; stats pluralization; stale example-dropdown label reset; doc h1 scale 5.7→4.2rem (compare h1 was 84px, breaking the product name); all microtext ≥12px; docs "Last reviewed"/dateModified now opt-in instead of a hardcoded fabricated date; /playground gained WebApplication JSON-LD.

3. Homepage hero leads with the playground (eea9a5d)

  • The hero card is now a spec→Rust teaser linking to /playground ("about 5 seconds, in your browser"); primary CTA "Try it in your browser"; cargo install --locked openapi-to-rust kept on-page in the closing band for the install-intent keyword.

Verification

  • astro check: 0 errors · html-validate over dist/: clean · repo SEO audit: 10/10 pages pass
  • All critique fixes browser-verified (incl. pre-ready flow under 6× CPU throttle); snapshots in .impeccable/critique/

🤖 Generated with Claude Code

lightsofapollo and others added 5 commits July 17, 2026 20:10
- Feature-gate cli (clap+reqwest) behind default-on 'cli' feature; extract
  pure URL policy + spec parsing into src/spec_source.rs so the library
  compiles on wasm32-unknown-unknown with --no-default-features
- Add wasm/ workspace member wrapping the in-memory pipeline for the
  browser; output is byte-identical to 'openapi-to-rust generate <SOURCE>'
  (verified by diff) and includes a complete compilable crate file set
- Playground page: paste/URL-fetch/example inputs, Web Worker generation,
  highlighted tabbed output, downloadable runnable crate as .tar.gz
- Deploy via artifact pull, no Vercel secrets: playground-wasm.yml publishes
  the bundle as a public release asset and bumps website/playground-wasm.lock;
  the website prebuild fetch script stages the pinned asset when no local
  build exists (bootstrap release playground-wasm-0.7.0-bootstrap is live)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Attach the download anchor to the DOM and defer blob-URL revocation;
  immediate revoke after click races the browser's blob fetch and stalled
  downloads outside headless Chromium. Button shows Preparing… while packing.
- Downloaded crate now declares edition 2024 (matches the generator repo);
  verified cargo build passes for simple and Anthropic-spec crates.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two critique->fix rounds (score 25/40 -> 37/40, browser-verified):

- Fix P0 mobile clipping: .playground and .doc-shell single-column grids
  used 1fr (min-content) with overflow:clip, making tabs/Copy/Download and
  docs body text unreachable at <=900px; now minmax(0,1fr) + pane min-width
- Style runtime-created result tabs via is:global (scoped styles can't
  match JS-created elements); aria-pressed, 40px targets, hover state
- Queue generation while WASM loads (was a silent no-op) with a status
  notice and auto-run on ready
- Keep last good result visible (dimmed) when a generate fails; role=alert/
  role=status on notices; result scrolls into view in single-column layout
- types.rs tab first / REQUIRED_DEPS.toml last; pluralize stats; reset
  stale example-dropdown label on edit
- Remove nested <main> on /playground; add WebApplication JSON-LD
- Homepage secondary CTA now sells the playground
- compressHTML:false — it stripped newlines before inline <a>/<code>,
  jamming words together on 6 pages; html-validate config drops the
  now-noisy trailing-whitespace rule
- Type scale: doc-page h1 clamp 5.7->4.2rem (compare h1 was 84px and broke
  the product name), compact playground hero (Generate above the fold),
  all microtext >=12px, cap footer/verification-note line length
- Docs "Last reviewed" + dateModified now opt-in per page (was a
  hardcoded fabricated default no page overrode)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The hero sold the 30-second path (cargo install) while the 5-second one
sat behind a secondary button. The install card is now a spec->Rust
teaser linking to /playground (YAML schema, "about 5 seconds" divider,
generated struct), the primary CTA is "Try it in your browser", and the
CLI install moved to a secondary button plus a copy-able line in the
closing band so the cargo-install intent keyword stays on the page.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openapi-to-rust Ready Ready Preview, Comment Jul 18, 2026 6:05am

Request Review

The fetch script no-op'd whenever public/playground/pkg/ existed, so a
long-lived local checkout kept serving a stale bundle forever after the
lock bumped. The staged bundle now carries a .source-tag stamp: "local"
(written by build-playground-wasm.sh) always wins, a stamp matching the
lock is a no-op, and anything else refetches the pinned release asset.
A failed refetch keeps a working staged bundle with a warning instead of
blocking dev.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
git push origin main was hardcoded, so a workflow_dispatch off a feature
branch would fail at the final step (no local main ref). Push back to
GITHUB_REF_NAME instead: identical on main, and pre-merge test runs bump
the lock on their own branch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adding [workspace] members=["wasm"] for the playground made cargo adopt
the spec-compile scratch crates under tmp/, failing every cargo check
with "current package believes it's in a workspace when it's not". The
generated scratch manifest now carries an empty [workspace] table, and
the root workspace excludes tmp/ so ad-hoc generator runs stay out too.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@lightsofapollo
lightsofapollo merged commit f4d899f into main Jul 18, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant