Skip to content

feat(studio): rewrite the Studio UI in Svelte 5; smoother 3D kitchen - #182

Merged
egagofur merged 1 commit into
mainfrom
feat/studio-svelte
Nov 24, 2026
Merged

egagofur merged 1 commit into
mainfrom
feat/studio-svelte

Conversation

@egagofur

Copy link
Copy Markdown
Owner

Why

Studio felt heavy: animations and the 3D kitchen stuttered. Two causes:

  1. Every SSE snapshot (and the 60 s refresh) rebuilt the project list, Run header, details and ring with innerHTML, causing large style/layout recalcs on the main thread that competed with the render loop.
  2. The 3D render loop interleaved style.transform writes with offsetWidth/offsetHeight reads for each overlay label, forcing ~10 synchronous layouts per frame.

What changed

  • Svelte 5 UI (studio/src/): App.svelte replaces studio/js/main.js; components for the project list, overview, Run head, details, ring overlay, room, sheets, order book and sketch. Updates patch only what changed, so focus, typed names and running animations survive refreshes. Pure helpers and the three.js scene stay in studio/js/.
  • 3D kitchen (studio/js/restaurant.js): overlay sizes come from a ResizeObserver cache (no forced layout per frame); --guest-h is written only on change; pixel ratio capped at 1.5, dropping to 1x when frames run slow.
  • Build: Vite compiles into studio/app/ (committed and shipped, like the generated skills). npm run build:studio / npm run check:studio; the drift check runs in CI and prepublishOnly. Svelte, Vite and the plugin are devDependencies; the CLI still has no runtime dependencies.
  • Server (lib/studio-server.js): serves only studio/app/ (+ diners.json). Content-hashed assets get private, max-age=31536000, immutable; the page stays no-cache. An unknown hashed asset triggers a rescan, so a rebuild is picked up without restarting Studio. Old /js/*, /vendor/*, /styles.css URLs now 404. CSP unchanged (no inline script/style in the build).
  • Package: files ships studio/app/ and studio/diners.json instead of all of studio/; doctor updated; Svelte license added to THIRD_PARTY_NOTICES.md and studio/app/licenses/.
  • CI / publish: npm ci added (tests now need svelte to SSR components); package job runs check:studio.
  • Tests: HTML-string tests now server-render the Svelte components (tests/helpers/svelte.js, a Node loader hook). New tests cover the layout-thrash fix, pixel-ratio cap, asset caching, rebuild pickup, freeze button states, and the sketch frame-loaded reset.
  • Docs: AGENTS.md, core/local-workflow-studio.md, CHANGELOG.

Reviewer notes

  • npm test: 927/929 pass. The 2 failures (setup --yes with no coding agent…, setup without a TTY…) also fail on a clean main on the author's machine because a local opencode host is detected; unrelated to this change.
  • check:skills, check:studio, doctor, eval, audit:package, measure pass.
  • Manually checked in a browser against an isolated fixture: 3D render, Details (D), Order book (O), project switch, room Previous/Next/Esc, Freeze. No console errors or long tasks.
  • Not verified: frame rate (the test browser was backgrounded and throttled) and the sketch iframes (blocked by the test browser). Please check smoothness and the order sketch in a real Chrome.
  • Svelte SSR escapes only & and < in text, so some test assertions now expect > rather than &gt;; output is still safe.
  • Node 18 CI installs Vite 8 with an engines warning; Vite runs only in check:studio on Node 22.

🤖 Generated with Claude Code

Studio's browser UI moves from hand-written DOM code to Svelte 5
components compiled by Vite into studio/app/ (committed and shipped).
Svelte and Vite are devDependencies; the CLI keeps no runtime deps.

- Projects snapshots patch only the rows, labels and chips that changed
  instead of rebuilding panels with innerHTML, so focus, typed names and
  running animations survive refreshes.
- 3D kitchen: overlay labels read sizes from a ResizeObserver cache
  instead of forcing a layout per label per frame; pixel ratio capped at
  1.5 and dropped to 1x when frames run slow.
- Server serves the built app; hashed assets are cached immutably and a
  rebuild is picked up without restarting Studio.
- npm run build:studio / check:studio (drift check in CI and prepublish);
  CI and publish run npm ci.
- Tests render components through Svelte SSR; new tests cover the 3D
  layout fix, asset caching, rebuild pickup and sketch frame state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@egagofur
egagofur merged commit c84cba2 into main Nov 24, 2026
7 of 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