# Theme Builder -- editor UI This directory documents the two-stage plan for the in-browser theme editor. The editor is mounted (admin-only) at `GET /theme-builder/editor`, whose shell page (`lib/page.js`, ARCHITECTURE.md 8.2) loads a single static bundle served by Saltcorn's built-in plugin static route at `/plugins/public/theme-builder/builderApp.js` (no extra route -- plugins.js 1246-1276). ## Phase 1 -- the shipping editor (`public/builderApp.js`) `public/builderApp.js` is the **buildless, dependency-free Phase-1 editor**. It is hand-written **vanilla ES2020** -- no React, no Craft.js, no build step, no imports. It IS the committed, shipped artifact: an installed plugin works without ever running a bundler. What it does (talking only to the REST API under `window.__TB__.apiBase`): - **Manager panel** -- `GET /api/state` lists every theme with `active` and `built-in` badges (ARCHITECTURE.md 8.5/8.8). Per-row buttons: Activate, Edit, Duplicate, Rename, Delete, Export (plain `` to `/api/themes/:id/export`). Top toolbar: New, Import (file input -> multipart `POST /api/import`). - **Token panel** -- color / font / spacing inputs rendered **from the manifest** returned by `/api/state` (`manifest.tokens[] = { kind, cssVar, selector, prop, derive, default }`, from `lib/apiState.buildManifest`). - **Live preview** -- a sandboxed `