Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

feat(editor): import @estella/editor (Electron + React + dockview)

esengine54c225e3cfff
diff --git a/desktop/.gitignore b/desktop/.gitignore
new file mode 100644
index 000000000..5e387e30c
--- /dev/null
+++ b/desktop/.gitignore
@@ -0,0 +1,10 @@
+node_modules
+dist
+dist-electron
+release
+*.log
+.DS_Store
+
+# Synced from the engine/SDK build (build-tools/tasks/sync.js) — generated, not source.
+public/sdk/
+public/wasm/
diff --git a/desktop/README.md b/desktop/README.md
new file mode 100644
index 000000000..b91552884
--- /dev/null
+++ b/desktop/README.md
@@ -0,0 +1,74 @@
+# Estella Editor
+
+A purpose-built visual editor for the Estella 2D WASM engine — Electron + React +
+TypeScript, with a UE5-style dockable workspace.
+
+> **Status:** static UI foundation. Every panel renders against the real domain
+> types with mock data; no engine is wired yet. This is the base to build features on.
+
+## Stack
+
+| Concern | Choice |
+| -------------- | ------------------------------- |
+| Desktop shell | Electron (Node main process reuses the engine's Node build tooling) |
+| UI | React 19 + TypeScript + Vite |
+| Docking | [dockview](https://dockview.dev) — dockable / floating / tabbed panels, serializable layout |
+| State | Zustand |
+| Fonts | Inter (UI) + JetBrains Mono (live data) bundled offline via `@fontsource` |
+
+## Run
+
+```bash
+pnpm install # from the repo root (workspace)
+pnpm --filter @estella/editor dev # launches the Electron window with HMR
+pnpm --filter @estella/editor build # type-check + production bundle
+```
+
+## Layout
+
+```
+MenuBar File · Edit · … + project / scene
+Toolbar Save │ Select Move Rotate Scale │ Snap Grid │ [Play Pause Stop] │ Build
+┌───────────┬───────────────────────────┬───────────┐
+│ World │ Viewport │ Details │
+│ Outliner │ (engine canvas mounts │ (inspector│
+│ │ here — currently a │ driven by│
+│ │ placeholder stage) │ schema) │
+├───────────┴───────────────────────────┴───────────┤
+│ Content Browser · Output Log (tabbed bottom dock)│
+└──────────────────────────────────────────────────┘
+StatusBar Edit Mode · selection · cursor · fps · draw calls · engine version
+```
+
+Panel arrangement is dockable and persisted to `localStorage` (`estella.editor.layout.v1`).
+
+## Source map
+
+```
+electron/ main process + preload bridge (privileged IPC surface)
+src/
+ theme/ design tokens, global reset, dockview theme, app styles
+ layout/ MenuBar · Toolbar · StatusBar · DockLayout (dockview wiring)
+ panels/ Outliner · Viewport · Details · ContentBrowser · OutputLog
+ store/ Zustand editor state (selection, tool, play, overlays)
+ components/ shared bits (icon maps)
+ mock/ placeholder scene / components / assets / logs
+ types.ts editor domain types — mirror the engine bridge contract
+public/ wasm runtime, bundled SDK, example projects (served at web root)
+```
+
+## Wiring the engine (next steps)
+
+The mock layer is deliberately shaped like the real contract, so going live means
+swapping data sources, not rewriting panels:
+
+1. **Boot the runtime** — load `public/wasm/esengine.js` + `.wasm` into a `<canvas>`
+ inside `Viewport`, via the SDK's `CoreApiBridge` / `WasmBridge`.
+2. **Scene tree** — replace `MOCK_SCENE` with a live entity list from the bridge;
+ selection already flows through `editorStore`.
+3. **Inspector** — drive `Details` from the generated `EditorAPI` schema
+ (`tools/eht/generators/editor_api.py`): component list, property get/set by path.
+4. **Assets** — point `ContentBrowser` at the project's content directory (Electron
+ main process: `fs` + `chokidar` watch).
+5. **Play-in-editor** — `Toolbar` play controls drive the engine's run loop.
+```
diff --git a/desktop/electron/launcher.ts b/desktop/electron/launcher.ts
new file mode 100644
index 000000000..20378b61a
--- /dev/null
+++ b/desktop/electron/launcher.ts
@@ -0,0 +1,107 @@
+/**
+ * @file Launcher-supporting main-process ops: the recent-projects list and
+ * project thumbnails. Lives in main because it touches arbitrary paths
+ * (recents point anywhere) and userData — outside the renderer's
+ * project-root sandbox. See RC12 §E7.
+ */
+import { app } from 'electron';
+import { readFile, writeFile, readdir, cp } from 'node:fs/promises';
+import { existsSync } from 'node:fs';
+import path from 'node:path';
+import {
+ PROJECT_MANIFEST_FILE,
+ parseManifest,
+ type RecentEntry,
+ type TemplateEntry,
+} from '../src/project/format';
+
+type StoredRecent = Pick<RecentEntry, 'name' | 'root' | 'openedAt'>;
+
+const recentsFile = (): string => path.join(app.getPath('userData'), 'estella-recents.json');
+
+async function readStored(): Promise<StoredRecent[]> {
+ try {
+ const raw = JSON.parse(await readFile(recentsFile(), 'utf8'));
+ return Array.isArray(raw) ? (raw as StoredRecent[]) : [];
+ } catch {
+ return [];
+ }
+}
+
+/** A project's `thumbnail.png` as a base64 data URL (CSP allows `img-src data:`). */
+async function thumbnailUrl(root: string): Promise<string | undefined> {
+ const file = path.join(root, 'thumbnail.png');
+ if (!existsSync(file)) return undefined;
+ try {
+ const bytes = await readFile(file);
+ return `data:image/png;base64,${bytes.toString('base64')}`;
+ } catch {
+ return undefined;
+ }
+}
+
+/** The manifest's build badge (engineBuildId, else the project version). */
+async function manifestBuild(root: string): Promise<string | undefined> {
+ try {
+ const m = parseManifest(JSON.parse(await readFile(path.join(root, PROJECT_MANIFEST_FILE), 'utf8')));
+ return m.engineBuildId ?? m.version;
+ } catch {
+ return undefined;
+ }
+}
+
+/** Recent projects, newest first, with stale entries (no manifest) dropped. */
+export async function listRecents(): Promise<RecentEntry[]> {
+ const stored = await readStored();
+ const out: RecentEntry[] = [];
+ for (const r of stored) {
+ if (!r?.root || !existsSync(path.join(r.root, PROJECT_MANIFEST_FILE))) continue;
+ out.push({ ...r, build: await manifestBuild(r.root), thumbnail: await thumbnailUrl(r.root) });
+ }
+ return out;
+}
+
+/** Record a freshly-opened project at the top of the recents list (cap 12). */
+export async function addRecent(root: string, name: string): Promise<void> {
+ const stored = (await readStored()).filter((r) => r.root !== root);
+ stored.unshift({ root, name, openedAt: Date.now() });
+ await writeFile(recentsFile(), JSON.stringify(stored.slice(0, 12), null, 2));
+}
+
+// New-project templates. In dev these are the in-repo examples (each is a real
+// project dir); a packaged build would point this at a bundled templates dir.
+const templatesDir = (): string => path.join(process.env.APP_ROOT ?? '', '..', 'examples');
+
+export async function listTemplates(): Promise<TemplateEntry[]> {
+ const root = templatesDir();
+ if (!existsSync(root)) return [];
+ const out: TemplateEntry[] = [];
+ for (const entry of await readdir(root, { withFileTypes: true })) {
+ if (!entry.isDirectory()) continue;
+ const dir = path.join(root, entry.name);
+ if (!existsSync(path.join(dir, PROJECT_MANIFEST_FILE))) continue;
+ let description: string | undefined;
+ let tag: string | undefined;
+ try {
+ const m = parseManifest(JSON.parse(await readFile(path.join(dir, PROJECT_MANIFEST_FILE), 'utf8')));
+ description = m.description;
+ tag = m.tag;
+ } catch {
+ // keep name-only
+ }
+ out.push({ name: entry.name, dir, description, tag, thumbnail: await thumbnailUrl(dir) });
+ }
+ return out;
+}
+
+/** Copy a template into `<location>/<name>`, stamp the manifest name, return the new root. */
+export async function createFromTemplate(templateDir: string, location: string, name: string): Promise<string> {
+ const dest = path.join(location, name);
+ if (existsSync(dest)) throw new Error(`a folder already exists at ${dest}`);
+ await cp(templateDir, dest, { recursive: true });
+ const manifestPath = path.join(dest, PROJECT_MANIFEST_FILE);
+ const m = parseManifest(JSON.parse(await readFile(manifestPath, 'utf8')));
+ m.name = name;
+ await writeFile(manifestPath, JSON.stringify(m, null, 2) + '\n');
+ return dest;
+}
diff --git a/desktop/electron/main.ts b/desktop/electron/main.ts
new file mode 100644
index 000000000..f7351d4fe
--- /dev/null
+++ b/desktop/electron/main.ts
@@ -0,0 +1,197 @@
+import { app, BrowserWindow, shell, ipcMain, dialog, protocol } from 'electron';
+import { fileURLToPath } from 'node:url';
+import { readFile } from 'node:fs/promises';
+import path from 'node:path';
+import {
+ openProject,
+ readInRoot,
+ writeInRoot,
+ readDirInRoot,
+ saveWorkspace,
+ resolveInRoot,
+} from './projectFs';
+import { listRecents, addRecent, listTemplates, createFromTemplate } from './launcher';
+import type { WorkspaceState } from '../src/project/format';
+
+// Custom scheme that serves files from the open project root (sandboxed). Lets
+// the engine fetch project assets (textures via Assets.loadTexture → fetch) and
+// is the foundation for file:// packaging. Must be declared before app ready.
+protocol.registerSchemesAsPrivileged([
+ {
+ scheme: 'estella',
+ privileges: { standard: true, secure: true, supportFetchAPI: true, stream: true },
+ },
+]);
+
+const ASSET_MIME: Record<string, string> = {
+ png: 'image/png',
+ jpg: 'image/jpeg',
+ jpeg: 'image/jpeg',
+ webp: 'image/webp',
+ ktx2: 'image/ktx2',
+ json: 'application/json',
+ esscene: 'application/json',
+ fnt: 'text/plain',
+};
+
+// The engine's Emscripten/embind glue requires 'unsafe-eval' in the renderer
+// CSP (it JIT-compiles call bridges via new Function). That's a deliberate,
+// accepted trade-off for this local dev tool, so silence the dev-only warning.
+process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
+
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+
+// Built directory structure
+//
+// dist-electron/
+// main.mjs > Electron main
+// preload.mjs > Preload scripts
+// dist/ > Vite renderer build
+// public/ > static assets (wasm, sdk, examples) in dev
+process.env.APP_ROOT = path.join(__dirname, '..');
+
+const VITE_DEV_SERVER_URL = process.env.VITE_DEV_SERVER_URL;
+const RENDERER_DIST = path.join(process.env.APP_ROOT, 'dist');
+const VITE_PUBLIC = VITE_DEV_SERVER_URL
+ ? path.join(process.env.APP_ROOT, 'public')
+ : RENDERER_DIST;
+
+let win: BrowserWindow | null = null;
+
+function createWindow() {
+ win = new BrowserWindow({
+ width: 1480,
+ height: 920,
+ minWidth: 1080,
+ minHeight: 680,
+ title: 'Estella Editor',
+ backgroundColor: '#0E121B',
+ // Frameless-ish chrome: the app draws its own menu/title bar.
+ titleBarStyle: 'hiddenInset',
+ trafficLightPosition: { x: 14, y: 14 },
+ icon: path.join(VITE_PUBLIC, 'icon.png'),
+ webPreferences: {
+ preload: path.join(__dirname, 'preload.mjs'),
+ // Keep the renderer sandboxed; all privileged work goes through preload IPC.
+ contextIsolation: true,
+ nodeIntegration: false,
+ },
+ });
+
+ // Open external links in the OS browser, never in-app.
+ win.webContents.setWindowOpenHandler(({ url }) => {
+ if (url.startsWith('http')) shell.openExternal(url);
+ return { action: 'deny' };
+ });
+
+ if (VITE_DEV_SERVER_URL) {
+ win.loadURL(VITE_DEV_SERVER_URL);
+ win.webContents.openDevTools({ mode: 'detach' });
+ } else {
+ win.loadFile(path.join(RENDERER_DIST, 'index.html'));
+ }
+}
+
+// — Minimal IPC surface (expanded as the editor grows) —
+ipcMain.handle('app:version', () => app.getVersion());
+ipcMain.handle('app:platform', () => process.platform);
+ipcMain.on('engine:status', (_e, status: string) => console.log('[engine]', status));
+
+// — Project / filesystem (RC12 §E7). The open project root lives here in main;
+// every fs op is sandboxed to it (projectFs.resolveInRoot), so the renderer
+// can only touch files inside the project it opened. —
+let projectRoot: string | null = null;
+const requireRoot = (): string => {
+ if (!projectRoot) throw new Error('no project open');
+ return projectRoot;
+};
+
+ipcMain.handle('project:openDialog', async () => {
+ if (!win) return null;
+ const res = await dialog.showOpenDialog(win, {
+ title: 'Open Estella Project',
+ properties: ['openDirectory'],
+ });
+ if (res.canceled || res.filePaths.length === 0) return null;
+ const opened = await openProject(res.filePaths[0]);
+ projectRoot = opened.root;
+ return opened;
+});
+
+ipcMain.handle('project:open', async (_e, root: string) => {
+ const opened = await openProject(root);
+ projectRoot = opened.root;
+ return opened;
+});
+
+ipcMain.handle('fs:read', (_e, relPath: string) => readInRoot(requireRoot(), relPath));
+ipcMain.handle('fs:write', (_e, relPath: string, contents: string) =>
+ writeInRoot(requireRoot(), relPath, contents),
+);
+ipcMain.handle('fs:readdir', (_e, relPath: string) => readDirInRoot(requireRoot(), relPath));
+ipcMain.handle('workspace:save', (_e, ws: WorkspaceState) => saveWorkspace(requireRoot(), ws));
+
+ipcMain.handle('recents:list', () => listRecents());
+ipcMain.handle('recents:add', (_e, root: string, name: string) => addRecent(root, name));
+
+// New-project templates + creation (launcher New tab).
+ipcMain.handle('templates:list', () => listTemplates());
+ipcMain.handle('project:createFromTemplate', (_e, templateDir: string, location: string, name: string) =>
+ createFromTemplate(templateDir, location, name),
+);
+ipcMain.handle('project:chooseDirectory', async () => {
+ if (!win) return null;
+ const res = await dialog.showOpenDialog(win, {
+ title: 'Choose a location for the new project',
+ properties: ['openDirectory', 'createDirectory'],
+ });
+ return res.canceled || res.filePaths.length === 0 ? null : res.filePaths[0];
+});
+
+// Save-As: pick a destination inside the project; returns a project-relative
+// path (or null if cancelled). Refuses targets outside the project root.
+ipcMain.handle('project:saveDialog', async (_e, defaultRel?: string) => {
+ const root = requireRoot();
+ if (!win) return null;
+ const res = await dialog.showSaveDialog(win, {
+ title: 'Save Scene As',
+ defaultPath: defaultRel ? path.join(root, defaultRel) : path.join(root, 'assets/scenes'),
+ filters: [{ name: 'Estella Scene', extensions: ['esscene'] }],
+ });
+ if (res.canceled || !res.filePath) return null;
+ const rel = path.relative(root, res.filePath);
+ if (rel.startsWith('..') || path.isAbsolute(rel)) {
+ throw new Error('scene must be saved inside the project');
+ }
+ return rel;
+});
+
+// estella://project/<relpath> → bytes from the open project root (sandboxed).
+async function handleEstella(request: Request): Promise<Response> {
+ if (!projectRoot) return new Response('no project open', { status: 503 });
+ try {
+ const rel = decodeURIComponent(new URL(request.url).pathname).replace(/^\/+/, '');
+ const abs = resolveInRoot(projectRoot, rel); // throws if it escapes the root
+ const bytes = await readFile(abs);
+ const ext = path.extname(abs).slice(1).toLowerCase();
+ return new Response(new Uint8Array(bytes), {
+ headers: { 'content-type': ASSET_MIME[ext] ?? 'application/octet-stream' },
+ });
+ } catch (err) {
+ return new Response(String(err), { status: 404 });
+ }
+}
+
+app.whenReady().then(() => {
+ protocol.handle('estella', handleEstella);
+ createWindow();
+});
+
+app.on('activate', () => {
+ if (BrowserWindow.getAllWindows().length === 0) createWindow();
+});
+
+app.on('window-all-closed', () => {
+ win = null;
+ if (process.platform !== 'darwin') app.quit();
+});
diff --git a/desktop/electron/preload.ts b/desktop/electron/preload.ts
new file mode 100644
index 000000000..69d99264c
--- /dev/null
+++ b/desktop/electron/preload.ts
@@ -0,0 +1,51 @@
+import { contextBridge, ipcRenderer } from 'electron';
+import type { OpenedProject, WorkspaceState, DirEntry, RecentEntry, TemplateEntry } from '../src/project/format';
+
+// The privileged bridge the renderer is allowed to touch. Keep this surface small
+// and explicit — anything the editor needs from the OS or Node goes through here.
+// `fs.*` paths are project-relative; main sandboxes them to the open project root.
+const api = {
+ getVersion: (): Promise<string> => ipcRenderer.invoke('app:version'),
+ getPlatform: (): Promise<NodeJS.Platform> => ipcRenderer.invoke('app:platform'),
+ // Surfaces engine lifecycle in the main-process log (useful for headless checks).
+ reportEngineStatus: (status: string): void => ipcRenderer.send('engine:status', status),
+
+ // — Project / workspace (RC12 §E7) —
+ project: {
+ /** Show a directory picker and open the chosen Estella project (null if cancelled). */
+ openDialog: (): Promise<OpenedProject | null> => ipcRenderer.invoke('project:openDialog'),
+ /** Open a project by absolute root path. */
+ open: (root: string): Promise<OpenedProject> => ipcRenderer.invoke('project:open', root),
+ /** Show a Save-As dialog; returns a project-relative scene path (null if cancelled). */
+ saveSceneDialog: (defaultRel?: string): Promise<string | null> =>
+ ipcRenderer.invoke('project:saveDialog', defaultRel),
+ /** Copy a template into `<location>/<name>`; returns the new project root. */
+ createFromTemplate: (templateDir: string, location: string, name: string): Promise<string> =>
+ ipcRenderer.invoke('project:createFromTemplate', templateDir, location, name),
+ /** Pick a folder (for the new-project location); returns an absolute path or null. */
+ chooseDirectory: (): Promise<string | null> => ipcRenderer.invoke('project:chooseDirectory'),
+ },
+ // New-project templates (launcher New tab).
+ templates: {
+ list: (): Promise<TemplateEntry[]> => ipcRenderer.invoke('templates:list'),
+ },
+ // Filesystem, scoped to the open project root (paths are project-relative).
+ fs: {
+ read: (relPath: string): Promise<string> => ipcRenderer.invoke('fs:read', relPath),
+ write: (relPath: string, contents: string): Promise<void> =>
+ ipcRenderer.invoke('fs:write', relPath, contents),
+ readDir: (relPath: string): Promise<DirEntry[]> => ipcRenderer.invoke('fs:readdir', relPath),
+ },
+ workspace: {
+ save: (ws: WorkspaceState): Promise<void> => ipcRenderer.invoke('workspace:save', ws),
+ },
+ // Recent projects (launcher), persisted in userData.
+ recents: {
+ list: (): Promise<RecentEntry[]> => ipcRenderer.invoke('recents:list'),
+ add: (root: string, name: string): Promise<void> => ipcRenderer.invoke('recents:add', root, name),
+ },
+};
+
+contextBridge.exposeInMainWorld('estella', api);
+
+export type EstellaBridge = typeof api;
diff --git a/desktop/electron/projectFs.ts b/desktop/electron/projectFs.ts
new file mode 100644
index 000000000..14a4bb768
--- /dev/null
+++ b/desktop/electron/projectFs.ts
@@ -0,0 +1,76 @@
+/**
+ * @file Project filesystem access for the Electron main process.
+ *
+ * All renderer file I/O funnels through here and is sandboxed to the currently
+ * open project root — paths that escape the root (via `..` or absolute) are
+ * refused, so a compromised/buggy renderer can't read or write arbitrary files.
+ * See RC12 §E7.
+ */
+import { readFile, writeFile, readdir, mkdir } from 'node:fs/promises';
+import { existsSync } from 'node:fs';
+import path from 'node:path';
+import {
+ PROJECT_MANIFEST_FILE,
+ WORKSPACE_DIR,
+ WORKSPACE_FILE,
+ parseManifest,
+ type OpenedProject,
+ type WorkspaceState,
+ type DirEntry,
+} from '../src/project/format';
+
+/**
+ * Resolve a project-relative path, refusing anything that escapes `root`.
+ * Pure (no I/O) — the security boundary for every fs op below.
+ */
+export function resolveInRoot(root: string, relPath: string): string {
+ const resolved = path.resolve(root, relPath);
+ const rel = path.relative(root, resolved);
+ if (rel === '') return resolved; // the root itself
+ if (rel.startsWith('..') || path.isAbsolute(rel)) {
+ throw new Error(`path "${relPath}" escapes the project root`);
+ }
+ return resolved;
+}
+
+/** Open a project: require + parse `project.esproj`, load workspace if present. */
+export async function openProject(root: string): Promise<OpenedProject> {
+ const manifestPath = path.join(root, PROJECT_MANIFEST_FILE);
+ if (!existsSync(manifestPath)) {
+ throw new Error(`not an Estella project (missing ${PROJECT_MANIFEST_FILE}): ${root}`);
+ }
+ const manifest = parseManifest(JSON.parse(await readFile(manifestPath, 'utf8')));
+
+ let workspace: WorkspaceState = {};
+ const wsPath = path.join(root, WORKSPACE_DIR, WORKSPACE_FILE);
+ if (existsSync(wsPath)) {
+ try {
+ workspace = JSON.parse(await readFile(wsPath, 'utf8')) as WorkspaceState;
+ } catch {
+ // A corrupt workspace file is non-fatal — start clean.
+ }
+ }
+ return { root, manifest, workspace };
+}
+
+export function readInRoot(root: string, relPath: string): Promise<string> {
+ return readFile(resolveInRoot(root, relPath), 'utf8');
+}
+
+export async function writeInRoot(root: string, relPath: string, contents: string): Promise<void> {
+ const abs = resolveInRoot(root, relPath);
+ await mkdir(path.dirname(abs), { recursive: true });
+ await writeFile(abs, contents, 'utf8');
+}
+
+export async function readDirInRoot(root: string, relPath: string): Promise<DirEntry[]> {
+ const entries = await readdir(resolveInRoot(root, relPath), { withFileTypes: true });
+ return entries.map((e) => ({ name: e.name, isDir: e.isDirectory() }));
+}
+
+/** Persist editor-local workspace state to `.esengine/workspace.json`. */
+export async function saveWorkspace(root: string, workspace: WorkspaceState): Promise<void> {
+ const dir = path.join(root, WORKSPACE_DIR);
+ await mkdir(dir, { recursive: true });
+ await writeFile(path.join(dir, WORKSPACE_FILE), JSON.stringify(workspace, null, 2) + '\n', 'utf8');
+}
diff --git a/desktop/index.html b/desktop/index.html
new file mode 100644
index 000000000..0ca8e2c6e
--- /dev/null
+++ b/desktop/index.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta
+ http-equiv="Content-Security-Policy"
+ content="default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: estella:; font-src 'self' data:; connect-src 'self' ws: estella:; worker-src 'self' blob:;"
+ />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>Estella Editor</title>
+ <!-- estella editor shell · selection outline + live status bar -->
+ </head>
+ <body>
+ <div id="root"></div>
+ <script type="module" src="/src/main.tsx"></script>
+ </body>
+</html>
diff --git a/desktop/package.json b/desktop/package.json
new file mode 100644
index 000000000..c8d94a567
--- /dev/null
+++ b/desktop/package.json
@@ -0,0 +1,35 @@
+{
+ "name": "@estella/editor",
+ "version": "0.0.1",
+ "private": true,
+ "description": "Estella Editor — visual scene editor for the Estella 2D WASM engine",
+ "type": "module",
+ "main": "dist-electron/main.js",
+ "scripts": {
+ "dev": "vite",
+ "build": "tsc --noEmit && vite build",
+ "preview": "vite preview",
+ "typecheck": "tsc --noEmit"
+ },
+ "dependencies": {
+ "esengine": "workspace:*",
+ "dockview": "^6.6.1",
+ "lucide-react": "^1.21.0",
+ "react": "^19.2.0",
+ "react-dom": "^19.2.0",
+ "zustand": "^5.0.14"
+ },
+ "devDependencies": {
+ "@fontsource/inter": "^5.2.8",
+ "@fontsource/jetbrains-mono": "^5.2.8",
+ "@types/node": "^25.9.3",
+ "@types/react": "^19.2.0",
+ "@types/react-dom": "^19.2.0",
+ "@vitejs/plugin-react": "^6.0.2",
+ "electron": "^42.4.1",
+ "typescript": "^6.0.3",
+ "vite": "^8.0.16",
+ "vite-plugin-electron": "^1.0.4",
+ "vite-plugin-electron-renderer": "^1.0.0"
+ }
+}
diff --git a/desktop/public/scenes/platformer.esscene b/desktop/public/scenes/platformer.esscene
new file mode 100644
index 000000000..f38a3c4d2
--- /dev/null
+++ b/desktop/public/scenes/platformer.esscene
@@ -0,0 +1,170 @@
+{
+ "version": "1.0",
+ "name": "Main",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": 0, "y": 0, "z": 10 } } },
+ { "type": "Camera", "data": { "projectionType": 1, "orthoSize": 350, "isActive": true, "priority": 0 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 13,
+ "name": "Sky",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": 0, "y": 0, "z": -1 } } },
+ { "type": "Sprite", "data": { "size": { "x": 800, "y": 700 }, "texture": "@uuid:74b832b1-40ae-4095-a620-c027735cb482" } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 1,
+ "name": "Ground",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": 0, "y": -250, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 800, "y": 40 }, "color": { "r": 0.4, "g": 0.7, "b": 0.3, "a": 1 }, "texture": "@uuid:931ebe66-cded-4b32-8444-0737da446c0d" } },
+ { "type": "Platform", "data": { "width": 800, "height": 40 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 2,
+ "name": "Platform1",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": -200, "y": -120, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 160, "y": 24 }, "color": { "r": 0.6, "g": 0.5, "b": 0.3, "a": 1 }, "texture": "@uuid:0258e55e-9aa0-47eb-8092-7386e03f97c7" } },
+ { "type": "Platform", "data": { "width": 160, "height": 24 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 3,
+ "name": "Platform2",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": 100, "y": -20, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 160, "y": 24 }, "color": { "r": 0.6, "g": 0.5, "b": 0.3, "a": 1 }, "texture": "@uuid:0258e55e-9aa0-47eb-8092-7386e03f97c7" } },
+ { "type": "Platform", "data": { "width": 160, "height": 24 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 4,
+ "name": "Platform3",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": -80, "y": 100, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 200, "y": 24 }, "color": { "r": 0.6, "g": 0.5, "b": 0.3, "a": 1 }, "texture": "@uuid:0258e55e-9aa0-47eb-8092-7386e03f97c7" } },
+ { "type": "Platform", "data": { "width": 200, "height": 24 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 5,
+ "name": "Platform4",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": 220, "y": 180, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 140, "y": 24 }, "color": { "r": 0.6, "g": 0.5, "b": 0.3, "a": 1 }, "texture": "@uuid:0258e55e-9aa0-47eb-8092-7386e03f97c7" } },
+ { "type": "Platform", "data": { "width": 140, "height": 24 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 6,
+ "name": "Player",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": -200, "y": -200, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 32, "y": 48 }, "color": { "r": 0.2, "g": 0.6, "b": 1, "a": 1 }, "texture": "@uuid:2bde6b7d-0dbe-4434-9e30-ed1cd8e3fe82" } },
+ { "type": "Player", "data": {} }
+ ],
+ "visible": true
+ },
+ {
+ "id": 7,
+ "name": "Coin1",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": -200, "y": -80, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 24, "y": 24 }, "color": { "r": 1, "g": 0.85, "b": 0, "a": 1 }, "texture": "@uuid:c18959bd-f6be-49d3-945b-3d6ecf8ef14f" } },
+ { "type": "Coin", "data": { "baseY": -80, "bobTimer": 0 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 8,
+ "name": "Coin2",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": 100, "y": 20, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 24, "y": 24 }, "color": { "r": 1, "g": 0.85, "b": 0, "a": 1 }, "texture": "@uuid:c18959bd-f6be-49d3-945b-3d6ecf8ef14f" } },
+ { "type": "Coin", "data": { "baseY": 20, "bobTimer": 0 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 9,
+ "name": "Coin3",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": -80, "y": 140, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 24, "y": 24 }, "color": { "r": 1, "g": 0.85, "b": 0, "a": 1 }, "texture": "@uuid:c18959bd-f6be-49d3-945b-3d6ecf8ef14f" } },
+ { "type": "Coin", "data": { "baseY": 140, "bobTimer": 0 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 10,
+ "name": "Coin4",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": 220, "y": 220, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 24, "y": 24 }, "color": { "r": 1, "g": 0.85, "b": 0, "a": 1 }, "texture": "@uuid:c18959bd-f6be-49d3-945b-3d6ecf8ef14f" } },
+ { "type": "Coin", "data": { "baseY": 220, "bobTimer": 0 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 11,
+ "name": "Coin5",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": 0, "y": -200, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 24, "y": 24 }, "color": { "r": 1, "g": 0.85, "b": 0, "a": 1 }, "texture": "@uuid:c18959bd-f6be-49d3-945b-3d6ecf8ef14f" } },
+ { "type": "Coin", "data": { "baseY": -200, "bobTimer": 0 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 12,
+ "name": "ScoreDisplay",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "ScoreDisplay", "data": { "score": 0 } }
+ ],
+ "visible": true
+ }
+ ]
+}
diff --git a/desktop/public/scenes/space-shooter.esscene b/desktop/public/scenes/space-shooter.esscene
new file mode 100644
index 000000000..a05d169d8
--- /dev/null
+++ b/desktop/public/scenes/space-shooter.esscene
@@ -0,0 +1,450 @@
+{
+ "version": "1.0",
+ "name": "Main",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 10
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 540,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 1,
+ "name": "Background",
+ "parent": null,
+ "children": [],
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": -1
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "texture": "@uuid:78c53bf7-88b8-481d-805c-a443c2d06076",
+ "size": {
+ "x": 600,
+ "y": 1080
+ },
+ "layer": -1
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 2,
+ "name": "Player",
+ "parent": null,
+ "children": [],
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": -420,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "texture": "@uuid:92f1ab5f-28f4-4b95-bb82-7182fdb33494",
+ "size": {
+ "x": 64,
+ "y": 64
+ }
+ }
+ },
+ {
+ "type": "Player",
+ "data": {
+ "speed": 400
+ }
+ },
+ {
+ "type": "Health",
+ "data": {
+ "value": 3,
+ "maxValue": 3
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 10,
+ "name": "HUD",
+ "parent": null,
+ "children": [
+ 11,
+ 12,
+ 13,
+ 14,
+ 15
+ ],
+ "components": [
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "Canvas",
+ "data": {
+ "designResolution": {
+ "x": 600,
+ "y": 1080
+ },
+ "scaleMode": 2
+ }
+ },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": {
+ "x": 0.5,
+ "y": 0.5
+ },
+ "anchorMax": {
+ "x": 0.5,
+ "y": 0.5
+ },
+ "size": {
+ "x": 600,
+ "y": 1080
+ },
+ "pivot": {
+ "x": 0.5,
+ "y": 0.5
+ }
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 11,
+ "name": "ScoreText",
+ "parent": 10,
+ "children": [],
+ "components": [
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": {
+ "x": 0,
+ "y": 1
+ },
+ "anchorMax": {
+ "x": 0,
+ "y": 1
+ },
+ "offsetMin": {
+ "x": 20,
+ "y": -40
+ },
+ "size": {
+ "x": 200,
+ "y": 40
+ },
+ "pivot": {
+ "x": 0,
+ "y": 1
+ }
+ }
+ },
+ {
+ "type": "Text",
+ "data": {
+ "content": "SCORE: 0",
+ "fontSize": 28,
+ "color": {
+ "r": 0,
+ "g": 0.86,
+ "b": 1,
+ "a": 1
+ },
+ "align": 0,
+ "verticalAlign": 0
+ }
+ },
+ {
+ "type": "ScoreDisplay",
+ "data": {}
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 12,
+ "name": "Heart1",
+ "parent": 10,
+ "children": [],
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 216,
+ "y": 520,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": {
+ "x": 1,
+ "y": 1
+ },
+ "anchorMax": {
+ "x": 1,
+ "y": 1
+ },
+ "offsetMin": {
+ "x": -84,
+ "y": -20
+ },
+ "size": {
+ "x": 24,
+ "y": 24
+ },
+ "pivot": {
+ "x": 1,
+ "y": 1
+ }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "texture": "@uuid:5b21b6a6-dffa-4256-872a-36f4e4549408",
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ }
+ }
+ },
+ {
+ "type": "HealthHeart",
+ "data": {}
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 13,
+ "name": "Heart2",
+ "parent": 10,
+ "children": [],
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 248,
+ "y": 520,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": {
+ "x": 1,
+ "y": 1
+ },
+ "anchorMax": {
+ "x": 1,
+ "y": 1
+ },
+ "offsetMin": {
+ "x": -52,
+ "y": -20
+ },
+ "size": {
+ "x": 24,
+ "y": 24
+ },
+ "pivot": {
+ "x": 1,
+ "y": 1
+ }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "texture": "@uuid:5b21b6a6-dffa-4256-872a-36f4e4549408",
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ }
+ }
+ },
+ {
+ "type": "HealthHeart",
+ "data": {}
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 14,
+ "name": "Heart3",
+ "parent": 10,
+ "children": [],
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 280,
+ "y": 520,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": {
+ "x": 1,
+ "y": 1
+ },
+ "anchorMax": {
+ "x": 1,
+ "y": 1
+ },
+ "offsetMin": {
+ "x": -20,
+ "y": -20
+ },
+ "size": {
+ "x": 24,
+ "y": 24
+ },
+ "pivot": {
+ "x": 1,
+ "y": 1
+ }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "texture": "@uuid:5b21b6a6-dffa-4256-872a-36f4e4549408",
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ }
+ }
+ },
+ {
+ "type": "HealthHeart",
+ "data": {}
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 15,
+ "name": "GameOverText",
+ "parent": 10,
+ "children": [],
+ "components": [
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": {
+ "x": 0.5,
+ "y": 0.5
+ },
+ "anchorMax": {
+ "x": 0.5,
+ "y": 0.5
+ },
+ "offsetMin": {
+ "x": 0,
+ "y": 0
+ },
+ "size": {
+ "x": 400,
+ "y": 120
+ },
+ "pivot": {
+ "x": 0.5,
+ "y": 0.5
+ }
+ }
+ },
+ {
+ "type": "Text",
+ "data": {
+ "content": "",
+ "fontSize": 36,
+ "color": {
+ "r": 1,
+ "g": 0.24,
+ "b": 0.24,
+ "a": 1
+ },
+ "align": 1,
+ "verticalAlign": 1
+ }
+ },
+ {
+ "type": "GameOverScreen",
+ "data": {}
+ }
+ ],
+ "visible": true
+ }
+ ]
+}
diff --git a/desktop/public/scenes/sprite-rendering.esscene b/desktop/public/scenes/sprite-rendering.esscene
new file mode 100644
index 000000000..413e3234c
--- /dev/null
+++ b/desktop/public/scenes/sprite-rendering.esscene
@@ -0,0 +1,257 @@
+{
+ "version": "1.0",
+ "name": "Main",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": { "x": 0, "y": 0, "z": 10 }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 300,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 1,
+ "name": "Layer0",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": -250, "y": 150, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 120, "y": 40 }, "color": { "r": 0.93, "g": 0.17, "b": 0.17, "a": 0.9 } } },
+ { "type": "Wave", "data": { "amplitude": 15, "frequency": 1.5 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 2,
+ "name": "Layer1",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": -230, "y": 90, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 120, "y": 40 }, "color": { "r": 0.93, "g": 0.74, "b": 0.17, "a": 0.9 }, "layer": 1 } },
+ { "type": "Wave", "data": { "amplitude": 15, "frequency": 1.7, "phase": 0.5 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 3,
+ "name": "Layer2",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": -210, "y": 30, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 120, "y": 40 }, "color": { "r": 0.55, "g": 0.93, "b": 0.17, "a": 0.9 }, "layer": 2 } },
+ { "type": "Wave", "data": { "amplitude": 15, "frequency": 1.9, "phase": 1 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 4,
+ "name": "Layer3",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": -190, "y": -30, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 120, "y": 40 }, "color": { "r": 0.17, "g": 0.93, "b": 0.36, "a": 0.9 }, "layer": 3 } },
+ { "type": "Wave", "data": { "amplitude": 15, "frequency": 2.1, "phase": 1.5 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 5,
+ "name": "Layer4",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": -170, "y": -90, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 120, "y": 40 }, "color": { "r": 0.17, "g": 0.93, "b": 0.93, "a": 0.9 }, "layer": 4 } },
+ { "type": "Wave", "data": { "amplitude": 15, "frequency": 2.3, "phase": 2 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 6,
+ "name": "Layer5",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": -150, "y": -150, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 120, "y": 40 }, "color": { "r": 0.17, "g": 0.36, "b": 0.93, "a": 0.9 }, "layer": 5 } },
+ { "type": "Wave", "data": { "amplitude": 15, "frequency": 2.5, "phase": 2.5 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 7,
+ "name": "Layer6",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": -130, "y": -210, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 120, "y": 40 }, "color": { "r": 0.55, "g": 0.17, "b": 0.93, "a": 0.9 }, "layer": 6 } },
+ { "type": "Wave", "data": { "amplitude": 15, "frequency": 2.7, "phase": 3 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 8,
+ "name": "Layer7",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": -110, "y": -270, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 120, "y": 40 }, "color": { "r": 0.93, "g": 0.17, "b": 0.74, "a": 0.9 }, "layer": 7 } },
+ { "type": "Wave", "data": { "amplitude": 15, "frequency": 2.9, "phase": 3.5 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 9,
+ "name": "OrbitCenter",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": 200, "y": 0, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 40, "y": 40 }, "layer": 10, "texture": "@uuid:ac9483ea-42c0-4fce-8a31-cf4cdc224330" } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 10,
+ "name": "Orbit0",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": 200, "y": 0, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 24, "y": 24 }, "color": { "r": 0.96, "g": 0.24, "b": 0.24, "a": 1 }, "layer": 11, "texture": "@uuid:ac9483ea-42c0-4fce-8a31-cf4cdc224330" } },
+ { "type": "Orbit", "data": { "centerX": 200, "radius": 60 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 11,
+ "name": "Orbit1",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": 200, "y": 0, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 24, "y": 24 }, "color": { "r": 0.96, "g": 0.96, "b": 0.24, "a": 1 }, "layer": 11, "texture": "@uuid:ac9483ea-42c0-4fce-8a31-cf4cdc224330" } },
+ { "type": "Orbit", "data": { "centerX": 200, "radius": 85, "speed": 1.3, "angle": 1.05 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 12,
+ "name": "Orbit2",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": 200, "y": 0, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 24, "y": 24 }, "color": { "r": 0.24, "g": 0.96, "b": 0.24, "a": 1 }, "layer": 11, "texture": "@uuid:ac9483ea-42c0-4fce-8a31-cf4cdc224330" } },
+ { "type": "Orbit", "data": { "centerX": 200, "radius": 110, "speed": 1.6, "angle": 2.09 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 13,
+ "name": "Orbit3",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": 200, "y": 0, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 24, "y": 24 }, "color": { "r": 0.24, "g": 0.96, "b": 0.96, "a": 1 }, "layer": 11, "texture": "@uuid:ac9483ea-42c0-4fce-8a31-cf4cdc224330" } },
+ { "type": "Orbit", "data": { "centerX": 200, "radius": 60, "speed": 1.9, "angle": 3.14 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 14,
+ "name": "Orbit4",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": 200, "y": 0, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 24, "y": 24 }, "color": { "r": 0.24, "g": 0.24, "b": 0.96, "a": 1 }, "layer": 11, "texture": "@uuid:ac9483ea-42c0-4fce-8a31-cf4cdc224330" } },
+ { "type": "Orbit", "data": { "centerX": 200, "radius": 85, "speed": 2.2, "angle": 4.19 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 15,
+ "name": "Orbit5",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": 200, "y": 0, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 24, "y": 24 }, "color": { "r": 0.96, "g": 0.24, "b": 0.96, "a": 1 }, "layer": 11, "texture": "@uuid:ac9483ea-42c0-4fce-8a31-cf4cdc224330" } },
+ { "type": "Orbit", "data": { "centerX": 200, "radius": 110, "speed": 2.5, "angle": 5.24 } }
+ ],
+ "visible": true
+ },
+ {
+ "id": 16,
+ "name": "FlipNormal",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": -90, "y": -200, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 50, "y": 30 }, "color": { "r": 0.4, "g": 0.8, "b": 1, "a": 1 }, "layer": 5, "texture": "@uuid:d7cfc683-b474-4c6a-bedf-c5149593510a" } },
+ { "type": "FlipDemo", "data": {} }
+ ],
+ "visible": true
+ },
+ {
+ "id": 17,
+ "name": "FlipX",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": -10, "y": -200, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 50, "y": 30 }, "color": { "r": 0.4, "g": 0.8, "b": 1, "a": 1 }, "flipX": true, "layer": 5, "texture": "@uuid:d7cfc683-b474-4c6a-bedf-c5149593510a" } },
+ { "type": "FlipDemo", "data": {} }
+ ],
+ "visible": true
+ },
+ {
+ "id": 18,
+ "name": "FlipY",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": 70, "y": -200, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 50, "y": 30 }, "color": { "r": 0.4, "g": 0.8, "b": 1, "a": 1 }, "flipY": true, "layer": 5, "texture": "@uuid:d7cfc683-b474-4c6a-bedf-c5149593510a" } },
+ { "type": "FlipDemo", "data": {} }
+ ],
+ "visible": true
+ },
+ {
+ "id": 19,
+ "name": "FlipXY",
+ "parent": null,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": 150, "y": -200, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 50, "y": 30 }, "color": { "r": 0.4, "g": 0.8, "b": 1, "a": 1 }, "flipX": true, "flipY": true, "layer": 5, "texture": "@uuid:d7cfc683-b474-4c6a-bedf-c5149593510a" } },
+ { "type": "FlipDemo", "data": {} }
+ ],
+ "visible": true
+ }
+ ]
+}
diff --git a/desktop/public/scenes/sprite-rendering.textures.json b/desktop/public/scenes/sprite-rendering.textures.json
new file mode 100644
index 000000000..abff60d41
--- /dev/null
+++ b/desktop/public/scenes/sprite-rendering.textures.json
@@ -0,0 +1,4 @@
+{
+ "d7cfc683-b474-4c6a-bedf-c5149593510a": "/scenes/sprite-rendering/textures/arrow.png",
+ "ac9483ea-42c0-4fce-8a31-cf4cdc224330": "/scenes/sprite-rendering/textures/star.png"
+}
\ No newline at end of file
diff --git a/desktop/public/scenes/sprite-rendering/textures/arrow.png b/desktop/public/scenes/sprite-rendering/textures/arrow.png
new file mode 100644
index 000000000..0c6bd28f6
Binary files /dev/null and b/desktop/public/scenes/sprite-rendering/textures/arrow.png differ
diff --git a/desktop/public/scenes/sprite-rendering/textures/star.png b/desktop/public/scenes/sprite-rendering/textures/star.png
new file mode 100644
index 000000000..070cd68d3
Binary files /dev/null and b/desktop/public/scenes/sprite-rendering/textures/star.png differ
diff --git a/desktop/public/scenes/ui-layout.esscene b/desktop/public/scenes/ui-layout.esscene
new file mode 100644
index 000000000..756c1337d
--- /dev/null
+++ b/desktop/public/scenes/ui-layout.esscene
@@ -0,0 +1,678 @@
+{
+ "version": "1.0",
+ "name": "Main",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": { "x": 0, "y": 0, "z": 10 }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 300,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 1,
+ "name": "Canvas",
+ "parent": null,
+ "children": [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "Canvas",
+ "data": {
+ "designResolution": { "x": 800, "y": 600 },
+ "scaleMode": 2
+ }
+ },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 0.5, "y": 0.5 },
+ "anchorMax": { "x": 0.5, "y": 0.5 },
+ "size": { "x": 800, "y": 600 },
+ "pivot": { "x": 0.5, "y": 0.5 }
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 2,
+ "name": "Title",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 0.5, "y": 1 },
+ "anchorMax": { "x": 0.5, "y": 1 },
+ "offsetMin": { "x": 0, "y": -40 },
+ "size": { "x": 400, "y": 40 },
+ "pivot": { "x": 0.5, "y": 1 }
+ }
+ },
+ {
+ "type": "Text",
+ "data": {
+ "content": "UIRect Anchor Layout",
+ "fontSize": 28,
+ "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "align": 1,
+ "verticalAlign": 1
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 3,
+ "name": "TopLeftPanel",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 0, "y": 1 },
+ "anchorMax": { "x": 0, "y": 1 },
+ "offsetMin": { "x": 10, "y": -10 },
+ "size": { "x": 180, "y": 120 },
+ "pivot": { "x": 0, "y": 1 }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": { "r": 0.2, "g": 0.4, "b": 0.7, "a": 0.8 }
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 4,
+ "name": "TopLeftLabel",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 0, "y": 1 },
+ "anchorMax": { "x": 0, "y": 1 },
+ "offsetMin": { "x": 10, "y": -10 },
+ "size": { "x": 180, "y": 120 },
+ "pivot": { "x": 0, "y": 1 }
+ }
+ },
+ {
+ "type": "Text",
+ "data": {
+ "content": "Top-Left",
+ "fontSize": 16,
+ "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "align": 1,
+ "verticalAlign": 1
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 5,
+ "name": "TopRightPanel",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 1, "y": 1 },
+ "anchorMax": { "x": 1, "y": 1 },
+ "offsetMin": { "x": -10, "y": -10 },
+ "size": { "x": 180, "y": 120 },
+ "pivot": { "x": 1, "y": 1 }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": { "r": 0.7, "g": 0.2, "b": 0.4, "a": 0.8 }
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 6,
+ "name": "TopRightLabel",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 1, "y": 1 },
+ "anchorMax": { "x": 1, "y": 1 },
+ "offsetMin": { "x": -10, "y": -10 },
+ "size": { "x": 180, "y": 120 },
+ "pivot": { "x": 1, "y": 1 }
+ }
+ },
+ {
+ "type": "Text",
+ "data": {
+ "content": "Top-Right",
+ "fontSize": 16,
+ "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "align": 1,
+ "verticalAlign": 1
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 7,
+ "name": "BottomStretchPanel",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 0, "y": 0 },
+ "anchorMax": { "x": 1, "y": 0 },
+ "offsetMin": { "x": 10, "y": 10 },
+ "size": { "x": 780, "y": 80 },
+ "pivot": { "x": 0.5, "y": 0 }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": { "r": 0.2, "g": 0.6, "b": 0.3, "a": 0.8 }
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 8,
+ "name": "BottomStretchLabel",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 0, "y": 0 },
+ "anchorMax": { "x": 1, "y": 0 },
+ "offsetMin": { "x": 10, "y": 10 },
+ "size": { "x": 780, "y": 80 },
+ "pivot": { "x": 0.5, "y": 0 }
+ }
+ },
+ {
+ "type": "Text",
+ "data": {
+ "content": "Bottom Stretch",
+ "fontSize": 16,
+ "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "align": 1,
+ "verticalAlign": 1
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 9,
+ "name": "CenterPanel",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 0.5, "y": 0.5 },
+ "anchorMax": { "x": 0.5, "y": 0.5 },
+ "offsetMin": { "x": 0, "y": 0 },
+ "size": { "x": 200, "y": 150 },
+ "pivot": { "x": 0.5, "y": 0.5 }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": { "r": 0.6, "g": 0.4, "b": 0.2, "a": 0.8 }
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 10,
+ "name": "CenterLabel",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 0.5, "y": 0.5 },
+ "anchorMax": { "x": 0.5, "y": 0.5 },
+ "offsetMin": { "x": 0, "y": 0 },
+ "size": { "x": 200, "y": 150 },
+ "pivot": { "x": 0.5, "y": 0.5 }
+ }
+ },
+ {
+ "type": "Text",
+ "data": {
+ "content": "Center",
+ "fontSize": 16,
+ "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "align": 1,
+ "verticalAlign": 1
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 11,
+ "name": "LeftStretchPanel",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 0, "y": 0.15 },
+ "anchorMax": { "x": 0, "y": 0.85 },
+ "offsetMin": { "x": 200, "y": 0 },
+ "size": { "x": 120, "y": 300 },
+ "pivot": { "x": 0, "y": 0.5 }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": { "r": 0.5, "g": 0.2, "b": 0.6, "a": 0.8 }
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 12,
+ "name": "LeftStretchLabel",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 0, "y": 0.15 },
+ "anchorMax": { "x": 0, "y": 0.85 },
+ "offsetMin": { "x": 200, "y": 0 },
+ "size": { "x": 120, "y": 300 },
+ "pivot": { "x": 0, "y": 0.5 }
+ }
+ },
+ {
+ "type": "Text",
+ "data": {
+ "content": "Left Stretch",
+ "fontSize": 16,
+ "color": { "r": 1, "g": 1, "b": 1, "a": 1 },
+ "align": 1,
+ "verticalAlign": 1
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 13,
+ "name": "GridItem0",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 0, "y": 1 },
+ "anchorMax": { "x": 0, "y": 1 },
+ "offsetMin": { "x": 430, "y": -195 },
+ "size": { "x": 55, "y": 55 },
+ "pivot": { "x": 0, "y": 1 }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": { "r": 0.85, "g": 0.15, "b": 0.15, "a": 0.9 }
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 14,
+ "name": "GridItem1",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 0, "y": 1 },
+ "anchorMax": { "x": 0, "y": 1 },
+ "offsetMin": { "x": 493, "y": -195 },
+ "size": { "x": 55, "y": 55 },
+ "pivot": { "x": 0, "y": 1 }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": { "r": 0.85, "g": 0.5, "b": 0.15, "a": 0.9 }
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 15,
+ "name": "GridItem2",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 0, "y": 1 },
+ "anchorMax": { "x": 0, "y": 1 },
+ "offsetMin": { "x": 556, "y": -195 },
+ "size": { "x": 55, "y": 55 },
+ "pivot": { "x": 0, "y": 1 }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": { "r": 0.85, "g": 0.85, "b": 0.15, "a": 0.9 }
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 16,
+ "name": "GridItem3",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 0, "y": 1 },
+ "anchorMax": { "x": 0, "y": 1 },
+ "offsetMin": { "x": 619, "y": -195 },
+ "size": { "x": 55, "y": 55 },
+ "pivot": { "x": 0, "y": 1 }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": { "r": 0.5, "g": 0.85, "b": 0.15, "a": 0.9 }
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 17,
+ "name": "GridItem4",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 0, "y": 1 },
+ "anchorMax": { "x": 0, "y": 1 },
+ "offsetMin": { "x": 430, "y": -258 },
+ "size": { "x": 55, "y": 55 },
+ "pivot": { "x": 0, "y": 1 }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": { "r": 0.15, "g": 0.85, "b": 0.15, "a": 0.9 }
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 18,
+ "name": "GridItem5",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 0, "y": 1 },
+ "anchorMax": { "x": 0, "y": 1 },
+ "offsetMin": { "x": 493, "y": -258 },
+ "size": { "x": 55, "y": 55 },
+ "pivot": { "x": 0, "y": 1 }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": { "r": 0.15, "g": 0.85, "b": 0.5, "a": 0.9 }
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 19,
+ "name": "GridItem6",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 0, "y": 1 },
+ "anchorMax": { "x": 0, "y": 1 },
+ "offsetMin": { "x": 556, "y": -258 },
+ "size": { "x": 55, "y": 55 },
+ "pivot": { "x": 0, "y": 1 }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": { "r": 0.15, "g": 0.85, "b": 0.85, "a": 0.9 }
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 20,
+ "name": "GridItem7",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 0, "y": 1 },
+ "anchorMax": { "x": 0, "y": 1 },
+ "offsetMin": { "x": 619, "y": -258 },
+ "size": { "x": 55, "y": 55 },
+ "pivot": { "x": 0, "y": 1 }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": { "r": 0.15, "g": 0.5, "b": 0.85, "a": 0.9 }
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 21,
+ "name": "GridItem8",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 0, "y": 1 },
+ "anchorMax": { "x": 0, "y": 1 },
+ "offsetMin": { "x": 430, "y": -321 },
+ "size": { "x": 55, "y": 55 },
+ "pivot": { "x": 0, "y": 1 }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": { "r": 0.15, "g": 0.15, "b": 0.85, "a": 0.9 }
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 22,
+ "name": "GridItem9",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 0, "y": 1 },
+ "anchorMax": { "x": 0, "y": 1 },
+ "offsetMin": { "x": 493, "y": -321 },
+ "size": { "x": 55, "y": 55 },
+ "pivot": { "x": 0, "y": 1 }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": { "r": 0.5, "g": 0.15, "b": 0.85, "a": 0.9 }
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 23,
+ "name": "GridItem10",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 0, "y": 1 },
+ "anchorMax": { "x": 0, "y": 1 },
+ "offsetMin": { "x": 556, "y": -321 },
+ "size": { "x": 55, "y": 55 },
+ "pivot": { "x": 0, "y": 1 }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": { "r": 0.85, "g": 0.15, "b": 0.85, "a": 0.9 }
+ }
+ }
+ ],
+ "visible": true
+ },
+ {
+ "id": 24,
+ "name": "GridItem11",
+ "parent": 1,
+ "children": [],
+ "components": [
+ { "type": "Transform", "data": {} },
+ {
+ "type": "UIRect",
+ "data": {
+ "anchorMin": { "x": 0, "y": 1 },
+ "anchorMax": { "x": 0, "y": 1 },
+ "offsetMin": { "x": 619, "y": -321 },
+ "size": { "x": 55, "y": 55 },
+ "pivot": { "x": 0, "y": 1 }
+ }
+ },
+ {
+ "type": "Image",
+ "data": {
+ "color": { "r": 0.85, "g": 0.15, "b": 0.5, "a": 0.9 }
+ }
+ }
+ ],
+ "visible": true
+ }
+ ]
+}
diff --git a/desktop/src/App.tsx b/desktop/src/App.tsx
new file mode 100644
index 000000000..17bb8623d
--- /dev/null
+++ b/desktop/src/App.tsx
@@ -0,0 +1,91 @@
+import { useEffect } from 'react';
+import { MenuBar } from '@/layout/MenuBar';
+import { Toolbar } from '@/layout/Toolbar';
+import { StatusBar } from '@/layout/StatusBar';
+import { DockLayout } from '@/layout/DockLayout';
+import { EditorHistory } from '@/engine/EditorHistory';
+import { SceneCommands } from '@/engine/SceneCommands';
+import { EngineHost } from '@/engine/EngineHost';
+import { ProjectStore } from '@/project/ProjectStore';
+import { Launcher } from '@/launcher/Launcher';
+import { useEditorStore } from '@/store/editorStore';
+
+// The editor shell: fixed menu + toolbar on top, dockable workspace in the
+// middle, status strip at the bottom.
+export function App() {
+ // Global editor shortcuts — skipped while a text field is focused so typing,
+ // native text undo, and backspace-to-delete-text aren't hijacked.
+ useEffect(() => {
+ const onKey = (e: KeyboardEvent) => {
+ const el = document.activeElement as HTMLElement | null;
+ if (el && (el.tagName === 'INPUT' || el.tagName === 'TEXTAREA' || el.isContentEditable)) {
+ return;
+ }
+ const store = useEditorStore.getState();
+ const sel = store.selectedId;
+ const mod = e.metaKey || e.ctrlKey;
+ const key = e.key.toLowerCase();
+
+ if (mod && key === 'o') {
+ // Open a project folder; loads its scene into the live world (E7-3).
+ e.preventDefault();
+ void ProjectStore.openViaDialog().then((ok) => {
+ if (ok) store.select(null); // entity ids change on load — drop stale selection
+ });
+ } else if (mod && key === 's') {
+ // Save (E7-4): ⌘S overwrites the current scene; ⇧⌘S is Save-As. ⌘S
+ // falls back to Save-As when overwrite is blocked (lossy / no scene).
+ e.preventDefault();
+ if (e.shiftKey) void ProjectStore.saveAsViaDialog();
+ else void ProjectStore.save().catch(() => ProjectStore.saveAsViaDialog());
+ } else if (mod && key === 'z' && !e.shiftKey) {
+ e.preventDefault();
+ EditorHistory.undo();
+ } else if (mod && ((key === 'z' && e.shiftKey) || key === 'y')) {
+ e.preventDefault();
+ EditorHistory.redo();
+ } else if (mod && key === 'd') {
+ e.preventDefault();
+ if (sel != null) {
+ const dup = SceneCommands.duplicateEntity(sel);
+ if (dup != null) store.select(dup);
+ }
+ } else if (e.key === 'Delete' || e.key === 'Backspace') {
+ e.preventDefault();
+ if (sel != null) {
+ SceneCommands.deleteEntity(sel);
+ store.select(null);
+ }
+ }
+ };
+ window.addEventListener('keydown', onKey);
+ return () => window.removeEventListener('keydown', onKey);
+ }, []);
+
+ // Drive engine edit/play mode from the toolbar's play/pause state. Edit mode
+ // (the default) freezes gameplay systems so they don't fight scene edits;
+ // Stop restores the pre-play scene snapshot. A restore re-spawns entities
+ // with new ids, so any selection pointing at the played scene is now stale.
+ const isPlaying = useEditorStore((s) => s.isPlaying);
+ const isPaused = useEditorStore((s) => s.isPaused);
+ useEffect(() => {
+ const restored = EngineHost.setRunMode(isPlaying, isPaused);
+ if (restored) useEditorStore.getState().select(null);
+ }, [isPlaying, isPaused]);
+
+ // The editor opens on the launcher (project browser); the shell + engine mount
+ // only once a project is opened. (Logic wiring lands with the recents IPC.)
+ const showLauncher = useEditorStore((s) => s.showLauncher);
+ if (showLauncher) return <Launcher />;
+
+ return (
+ <div className="shell">
+ <MenuBar />
+ <Toolbar />
+ <main className="shell__workspace">
+ <DockLayout />
+ </main>
+ <StatusBar />
+ </div>
+ );
+}
diff --git a/desktop/src/components/icons.tsx b/desktop/src/components/icons.tsx
new file mode 100644
index 000000000..af526216a
--- /dev/null
+++ b/desktop/src/components/icons.tsx
@@ -0,0 +1,60 @@
+import {
+ Camera,
+ Image,
+ PersonStanding,
+ Boxes,
+ Square,
+ LayoutPanelTop,
+ Volume2,
+ Lightbulb,
+ CircleDot,
+ Folder,
+ Film,
+ FileImage,
+ Music,
+ Component,
+ Blend,
+ FileCode2,
+ type LucideIcon,
+} from 'lucide-react';
+import type { NodeKind, AssetType } from '@/types';
+
+// Scene-node kind → glyph. Keeps the outliner legible at a glance.
+const NODE_ICON: Record<NodeKind, LucideIcon> = {
+ camera: Camera,
+ sprite: Image,
+ spine: PersonStanding,
+ physics: Square,
+ ui: LayoutPanelTop,
+ audio: Volume2,
+ group: Boxes,
+ light: Lightbulb,
+ empty: CircleDot,
+};
+
+export function NodeIcon({ kind, size = 14 }: { kind: NodeKind; size?: number }) {
+ const Glyph = NODE_ICON[kind];
+ return <Glyph size={size} strokeWidth={1.75} />;
+}
+
+// Asset type → glyph + accent tint, so the content browser is scannable by color.
+const ASSET_ICON: Record<AssetType, { icon: LucideIcon; tint: string }> = {
+ folder: { icon: Folder, tint: 'var(--star)' },
+ scene: { icon: Film, tint: '#ff8fa3' },
+ sprite: { icon: Image, tint: '#6fd3ff' },
+ texture: { icon: FileImage, tint: '#6fd3ff' },
+ spine: { icon: PersonStanding, tint: '#b69bff' },
+ audio: { icon: Music, tint: '#43d39e' },
+ prefab: { icon: Component, tint: '#ffb454' },
+ material: { icon: Blend, tint: '#ff9d6f' },
+ script: { icon: FileCode2, tint: '#9fb2d6' },
+};
+
+export function AssetIcon({ type, size = 22 }: { type: AssetType; size?: number }) {
+ const { icon: Glyph, tint } = ASSET_ICON[type];
+ return <Glyph size={size} strokeWidth={1.5} color={tint} />;
+}
+
+export function assetTint(type: AssetType): string {
+ return ASSET_ICON[type].tint;
+}
diff --git a/desktop/src/engine/EditorHistory.ts b/desktop/src/engine/EditorHistory.ts
new file mode 100644
index 000000000..74cfaafb8
--- /dev/null
+++ b/desktop/src/engine/EditorHistory.ts
@@ -0,0 +1,66 @@
+import { TransactionManager } from 'esengine';
+
+/**
+ * Editor undo/redo, built on the engine's {@link TransactionManager}.
+ *
+ * One user gesture (a field edit, a drag, a future add/delete) = one entry.
+ * Mutations are applied live through `EngineHost`; the gesture's owner captures
+ * before/after and calls {@link record} so the pair becomes undoable without
+ * re-running the forward closure. Panels subscribe for undo/redo availability.
+ */
+class EditorHistoryImpl {
+ private readonly tm = new TransactionManager({ historyLimit: 200 });
+ private version = 0;
+ private readonly listeners = new Set<() => void>();
+
+ /** Register an already-applied mutation as one undo step (forward NOT run). */
+ record(label: string, forward: () => void, reverse: () => void) {
+ const tx = this.tm.begin(label);
+ tx.addDeferred({ forward, reverse });
+ this.tm.commit(tx);
+ this.bump();
+ }
+
+ /** Apply a not-yet-applied mutation and record it (forward runs now). */
+ run(label: string, forward: () => void, reverse: () => void) {
+ const tx = this.tm.begin(label);
+ tx.add({ forward, reverse });
+ this.tm.commit(tx);
+ this.bump();
+ }
+
+ undo() {
+ if (this.tm.undo()) this.bump();
+ }
+ redo() {
+ if (this.tm.redo()) this.bump();
+ }
+ canUndo() {
+ return this.tm.canUndo();
+ }
+ canRedo() {
+ return this.tm.canRedo();
+ }
+ undoLabel(): string | null {
+ return this.tm.peekUndo()?.label ?? null;
+ }
+ redoLabel(): string | null {
+ return this.tm.peekRedo()?.label ?? null;
+ }
+ clear() {
+ this.tm.clear();
+ this.bump();
+ }
+
+ private bump() {
+ this.version += 1;
+ for (const l of this.listeners) l();
+ }
+ subscribe = (fn: () => void): (() => void) => {
+ this.listeners.add(fn);
+ return () => this.listeners.delete(fn);
+ };
+ getVersion = (): number => this.version;
+}
+
+export const EditorHistory = new EditorHistoryImpl();
diff --git a/desktop/src/engine/EngineGuard.ts b/desktop/src/engine/EngineGuard.ts
new file mode 100644
index 000000000..e7b67bde4
--- /dev/null
+++ b/desktop/src/engine/EngineGuard.ts
@@ -0,0 +1,108 @@
+import { ABI_LAYOUT_HASH } from 'esengine';
+
+/**
+ * Build-consistency guard for the engine wasm the editor loads.
+ *
+ * The editor links the `esengine` TS SDK at compile time but loads the wasm
+ * binary (`public/wasm/esengine.{js,wasm}`) separately at runtime. Nothing in
+ * the bundler ties those two artifacts together, so a stale or wrong-variant
+ * wasm can sit next to a newer SDK. The engine's own bridge handshake reads the
+ * wasm's `getAbiLayoutHash()` and *fatally* rejects a true layout mismatch — but
+ * only at runtime, only for layout (not build variant), and only once the heavy
+ * instantiate has run.
+ *
+ * This guard is the cheap, early, *advisory* complement: it reads a build
+ * manifest stamped beside the wasm at sync time and surfaces drift (ABI hash,
+ * variant) and provenance (git sha, build time) *before* instantiation. It is
+ * intentionally non-fatal — a manifest can be stale if a binary was hand-copied
+ * without re-running the sync, and we must never block a genuinely-fine boot on
+ * stale metadata. The authoritative fatal check stays in the runtime handshake,
+ * which reads the real binary.
+ *
+ * @see REARCH frontier doc RC12 §E1.
+ */
+
+const MANIFEST_URL = '/wasm/wasm.manifest.json';
+
+/** The wasm build variant the editor expects (web is the only one with a GL/web glue path). */
+const EDITOR_TARGET = 'web';
+
+export interface WasmManifest {
+ /** Manifest schema version (for forward-compat). */
+ schema: number;
+ /** ABI layout hash the wasm was built against (== the SDK's ABI_LAYOUT_HASH at build time). */
+ abiHash: string;
+ /** Build variant the synced binary came from (web | wechat | playable). */
+ editorTarget?: string;
+ /** Variants present in the wasm dir at sync time. */
+ variants?: string[];
+ /** Short git sha of the build, for provenance. */
+ gitSha?: string;
+ /** ISO timestamp the binary was built/synced, for provenance. */
+ builtAt?: string;
+}
+
+export type GuardLevel = 'ok' | 'warn';
+
+export interface GuardResult {
+ level: GuardLevel;
+ /** One-line summary for the console / status. */
+ message: string;
+ manifest: WasmManifest | null;
+}
+
+const provenance = (m: WasmManifest): string =>
+ `variant=${m.editorTarget ?? '?'} abi=${m.abiHash} git=${m.gitSha ?? '?'} builtAt=${m.builtAt ?? '?'}`;
+
+/**
+ * Pure evaluation of a (maybe-null) manifest against the SDK's expected ABI and
+ * variant. No I/O — unit-testable. Never returns a fatal level by design.
+ */
+export function evaluateManifest(manifest: WasmManifest | null): GuardResult {
+ if (!manifest) {
+ return {
+ level: 'ok',
+ manifest: null,
+ message:
+ 'engine wasm: no build manifest (legacy / hand-copied binary). ' +
+ 'ABI is still verified fatally by the runtime bridge handshake.',
+ };
+ }
+ if (manifest.abiHash !== ABI_LAYOUT_HASH) {
+ return {
+ level: 'warn',
+ manifest,
+ message:
+ `engine wasm ABI drift: manifest says the binary was built for ABI ${manifest.abiHash}, ` +
+ `but this SDK expects ${ABI_LAYOUT_HASH}. If boot then fails with an ABI error, rebuild + ` +
+ `resync the wasm (syncToDesktop). The manifest may also be stale if the binary was ` +
+ `hand-copied. [${provenance(manifest)}]`,
+ };
+ }
+ const target = manifest.editorTarget ?? EDITOR_TARGET;
+ if (target !== EDITOR_TARGET) {
+ return {
+ level: 'warn',
+ manifest,
+ message:
+ `engine wasm variant drift: public/wasm is the '${target}' build but the editor expects ` +
+ `'${EDITOR_TARGET}'. Feature flags differ; behavior may be wrong. [${provenance(manifest)}]`,
+ };
+ }
+ return { level: 'ok', manifest, message: `engine wasm ok — ${provenance(manifest)}` };
+}
+
+/**
+ * Fetch the manifest and evaluate it. Network/parse failures degrade to the
+ * "no manifest" (ok) path so a missing manifest never blocks boot.
+ */
+export async function checkEngineBuild(): Promise<GuardResult> {
+ let manifest: WasmManifest | null = null;
+ try {
+ const res = await fetch(MANIFEST_URL, { cache: 'no-cache' });
+ if (res.ok) manifest = (await res.json()) as WasmManifest;
+ } catch {
+ manifest = null;
+ }
+ return evaluateManifest(manifest);
+}
diff --git a/desktop/src/engine/EngineHost.ts b/desktop/src/engine/EngineHost.ts
new file mode 100644
index 000000000..02036d3e2
--- /dev/null
+++ b/desktop/src/engine/EngineHost.ts
@@ -0,0 +1,329 @@
+import {
+ createWebApp,
+ defineSystem,
+ Schedule,
+ Commands,
+ Transform,
+ Sprite,
+ Camera,
+ setEditorMode,
+ setPlayMode,
+ serializeScene,
+ resetWorldTo,
+} from 'esengine';
+import type { App, ESEngineModule, SceneData } from 'esengine';
+import { SceneStore } from './SceneStore';
+import { SceneLoader } from './SceneLoader';
+import { checkEngineBuild } from './EngineGuard';
+
+// Scene the editor opens on boot (placeholder until a project/open-scene flow exists).
+const DEFAULT_SCENE_URL = '/scenes/sprite-rendering.esscene';
+const DEFAULT_TEXTURES_URL = '/scenes/sprite-rendering.textures.json';
+
+export type EngineStatus = 'idle' | 'booting' | 'ready' | 'error';
+
+export interface EngineSnapshot {
+ status: EngineStatus;
+ error: string | null;
+}
+
+/**
+ * The engine runtime host: owns the wasm module, the App/World, the WebGL
+ * canvas, and the boot lifecycle. Everything else (reflection, mutations,
+ * picking, history) is a focused module layered on top — see SceneQuery,
+ * SceneCommands, ViewportController, SceneStore, EditorHistory.
+ *
+ * A single detached <canvas> is created once and re-parented into whichever
+ * Viewport DOM node is currently mounted, keeping the WebGL context and engine
+ * alive across dockview re-mounts and React StrictMode double-invokes.
+ */
+class EngineHostImpl {
+ private canvas_: HTMLCanvasElement | null = null;
+ private app_: App | null = null;
+ private module_: ESEngineModule | null = null;
+ private booted = false;
+ private resizeObserver: ResizeObserver | null = null;
+
+ private snapshot: EngineSnapshot = { status: 'idle', error: null };
+ private readonly listeners = new Set<() => void>();
+
+ // Play-state isolation: the scene captured when entering play, restored on stop.
+ private playing_ = false;
+ private playSnapshot_: SceneData | null = null;
+
+ // What to load once the engine is ready. Set by ProjectStore when a project
+ // is opened from the launcher; absent → the in-repo placeholder scene (dev).
+ private sceneBootstrap: (() => Promise<void>) | null = null;
+ setSceneBootstrap(fn: (() => Promise<void>) | null) {
+ this.sceneBootstrap = fn;
+ }
+
+ // Live handles read by the layered modules.
+ get app(): App | null {
+ return this.app_;
+ }
+ get module(): ESEngineModule | null {
+ return this.module_;
+ }
+ get canvas(): HTMLCanvasElement | null {
+ return this.canvas_;
+ }
+
+ // — Status as an external store (for useSyncExternalStore) —
+ subscribe = (fn: () => void): (() => void) => {
+ this.listeners.add(fn);
+ return () => this.listeners.delete(fn);
+ };
+ getSnapshot = (): EngineSnapshot => this.snapshot;
+
+ private setStatus(status: EngineStatus, error: string | null = null) {
+ this.snapshot = { status, error };
+ window.estella?.reportEngineStatus?.(error ? `${status}: ${error}` : status);
+ this.listeners.forEach((l) => l());
+ }
+
+ private ensureCanvas(): HTMLCanvasElement {
+ if (!this.canvas_) {
+ const c = document.createElement('canvas');
+ c.id = 'estella-viewport-canvas';
+ c.style.display = 'block';
+ c.style.width = '100%';
+ c.style.height = '100%';
+ c.style.outline = 'none';
+ this.canvas_ = c;
+ }
+ return this.canvas_;
+ }
+
+ /** Mount the engine canvas into a container and (lazily) boot the runtime. */
+ attach(container: HTMLElement) {
+ const canvas = this.ensureCanvas();
+ container.appendChild(canvas);
+ this.resize();
+ this.resizeObserver = new ResizeObserver(() => this.resize());
+ this.resizeObserver.observe(container);
+ void this.boot();
+ }
+
+ /** Remove the canvas from its container; the engine keeps running detached. */
+ detach() {
+ this.resizeObserver?.disconnect();
+ this.resizeObserver = null;
+ this.canvas_?.parentElement?.removeChild(this.canvas_);
+ }
+
+ /**
+ * Map the editor's play/pause UI state onto the engine, with play-state
+ * isolation: entering play snapshots the scene; Stop despawns the played
+ * scene and restores the snapshot, so try-playing never dirties the edit
+ * scene. Not playing ⇒ edit mode (gameplay frozen via env.playModeOnly, scene
+ * still rendered/editable); playing ⇒ gameplay runs; paused-while-playing
+ * halts every schedule. No-op until booted.
+ *
+ * @returns true if a play→edit restore happened (the caller should clear any
+ * stale selection, since entity ids change on restore).
+ */
+ setRunMode(isPlaying: boolean, isPaused: boolean): boolean {
+ const app = this.app_;
+ if (!app) return false;
+
+ let restored = false;
+ if (isPlaying && !this.playing_) {
+ // edit → play: capture the scene so Stop can restore it.
+ this.playSnapshot_ = serializeScene(app.world);
+ } else if (!isPlaying && this.playing_ && this.playSnapshot_) {
+ // play → edit (Stop): restore the pre-play scene (snapshot is reusable).
+ resetWorldTo(app.world, this.playSnapshot_);
+ this.playSnapshot_ = null;
+ restored = true;
+ }
+ this.playing_ = isPlaying;
+
+ setPlayMode(isPlaying);
+ app.setPaused(isPlaying && isPaused);
+ return restored;
+ }
+
+ private resize() {
+ const canvas = this.canvas_;
+ const parent = canvas?.parentElement;
+ if (!canvas || !parent) return;
+ const dpr = window.devicePixelRatio || 1;
+ const w = Math.max(1, Math.floor(parent.clientWidth * dpr));
+ const h = Math.max(1, Math.floor(parent.clientHeight * dpr));
+ if (canvas.width !== w) canvas.width = w;
+ if (canvas.height !== h) canvas.height = h;
+ }
+
+ private async boot() {
+ if (this.booted) return;
+ this.booted = true;
+ this.setStatus('booting');
+
+ try {
+ // Early build-consistency check: compare the wasm's stamped manifest
+ // (variant / ABI / provenance) against this SDK before the heavy
+ // instantiate. Advisory only — the runtime bridge handshake is the
+ // authoritative fatal layout check (reads the real binary).
+ const guard = await checkEngineBuild();
+ if (guard.level === 'warn') console.warn('[engine]', guard.message);
+ else console.info('[engine]', guard.message);
+
+ // The glue lives under public/. Vite's import-analysis rejects static
+ // imports of public files, so build the specifier at runtime from the
+ // origin — non-analyzable, so Vite emits a native dynamic import (allowed
+ // by CSP script-src 'self', no eval needed).
+ // NOTE: works in dev (http origin); production packaging will need a
+ // custom protocol or relative base since file:// roots differently.
+ const glueUrl = `${location.origin}/wasm/esengine.js`;
+ const { default: createModule } = (await import(/* @vite-ignore */ glueUrl)) as {
+ default: (options?: Record<string, unknown>) => Promise<ESEngineModule>;
+ };
+ const canvas = this.ensureCanvas();
+
+ const module = await createModule({
+ canvas,
+ // The glue resolves esengine.wasm relative to itself; pin it explicitly.
+ locateFile: (path: string) => `/wasm/${path}`,
+ print: (text: string) => console.log('[wasm]', text),
+ printErr: (text: string) => console.warn('[wasm]', text),
+ });
+ this.module_ = module;
+
+ // Bind the renderer to a context WE create on this canvas (rather than the
+ // engine's default '#canvas' selector) so the viewport works embedded
+ // under any element id. Mirrors the wechat runtime path.
+ const gl = canvas.getContext('webgl2', {
+ alpha: false,
+ antialias: true,
+ depth: true,
+ stencil: true,
+ premultipliedAlpha: false,
+ }) as WebGL2RenderingContext | null;
+ if (!gl) throw new Error('WebGL2 is not available in this renderer.');
+
+ const glHandle = module.GL.registerContext(gl, {
+ majorVersion: 2,
+ minorVersion: 0,
+ enableExtensionsByDefault: true,
+ });
+
+ const app = createWebApp(module, {
+ glContextHandle: glHandle,
+ getViewportSize: () => ({ width: canvas.width, height: canvas.height }),
+ });
+ this.app_ = app;
+
+ // Mark this an editor host and open in edit mode: gameplay systems
+ // (particle/animation/physics/timeline/…, gated on env.playModeOnly) are
+ // frozen so simulation doesn't fight edits, while render/transform/camera
+ // keep ticking. Play mode is toggled later via setRunMode.
+ setEditorMode(true);
+ setPlayMode(false);
+
+ // Register the reactive bridge before the scene spawns so the initial
+ // entities push through too.
+ SceneStore.install();
+
+ // Load the opened project's scene if the launcher set a bootstrap;
+ // otherwise the in-repo placeholder scene (dev). Falls back to the
+ // in-code scene on failure.
+ try {
+ if (this.sceneBootstrap) {
+ await this.sceneBootstrap();
+ } else {
+ await SceneLoader.loadInto(app, DEFAULT_SCENE_URL, DEFAULT_TEXTURES_URL);
+ }
+ } catch (err) {
+ console.warn('[engine] scene load failed; using placeholder', err);
+ this.setupScene(app);
+ }
+
+ // Loop started — report ready before run() in case it never resolves.
+ this.setStatus('ready');
+ void Promise.resolve(app.run()).catch((err) => this.swallowUnwind(err));
+ } catch (err) {
+ this.swallowUnwind(err);
+ }
+ }
+
+ /** Emscripten throws 'unwind' when its main loop takes over — that's success. */
+ private swallowUnwind(err: unknown) {
+ const msg = err instanceof Error ? err.message : String(err);
+ if (err === 'unwind' || msg.includes('unwind')) {
+ if (this.snapshot.status !== 'ready') this.setStatus('ready');
+ return;
+ }
+ console.error('[engine] boot failed', err);
+ // Allow a later re-attach (HMR / remount) to retry with fresh code.
+ this.booted = false;
+ this.setStatus('error', msg);
+ }
+
+ /**
+ * A small placeholder scene — a camera and a few colored quads — purely to
+ * prove the render path end-to-end. Replaced by real scene loading next.
+ */
+ private setupScene(app: App) {
+ app.addSystemToSchedule(
+ Schedule.Startup,
+ defineSystem([Commands()], (cmds) => {
+ cmds
+ .spawn()
+ .insert(Camera, {
+ projectionType: 1, // orthographic
+ fov: 60,
+ orthoSize: 360,
+ nearPlane: 0.1,
+ farPlane: 1000,
+ aspectRatio: 1,
+ isActive: true,
+ priority: 0,
+ })
+ .insert(Transform, {
+ position: { x: 0, y: 0, z: 10 },
+ rotation: { w: 1, x: 0, y: 0, z: 0 },
+ scale: { x: 1, y: 1, z: 1 },
+ });
+
+ const place = (
+ x: number,
+ y: number,
+ color: { r: number; g: number; b: number; a: number },
+ size: number,
+ ) =>
+ cmds
+ .spawn()
+ .insert(Sprite, {
+ texture: 0,
+ color,
+ size: { x: size, y: size },
+ uvOffset: { x: 0, y: 0 },
+ uvScale: { x: 1, y: 1 },
+ layer: 0,
+ flipX: false,
+ flipY: false,
+ })
+ .insert(Transform, {
+ position: { x, y, z: 0 },
+ rotation: { w: 1, x: 0, y: 0, z: 0 },
+ scale: { x: 1, y: 1, z: 1 },
+ });
+
+ place(0, 0, { r: 0.3, g: 0.62, b: 1.0, a: 1 }, 120); // starlight blue
+ place(-170, 96, { r: 1.0, g: 0.7, b: 0.33, a: 1 }, 72); // amber
+ place(168, -84, { r: 0.27, g: 0.83, b: 0.62, a: 1 }, 84); // green
+ place(150, 120, { r: 0.61, g: 0.42, b: 1.0, a: 1 }, 60); // violet
+ }),
+ );
+ }
+}
+
+export const EngineHost = new EngineHostImpl();
+
+// The engine owns a live WebGL context and a singleton runtime — HMR can't
+// safely hot-patch it. Force a full reload whenever this module changes so a
+// fresh context boots cleanly instead of stacking onto a stale one.
+if (import.meta.hot) {
+ import.meta.hot.accept(() => location.reload());
+}
diff --git a/desktop/src/engine/EntityHandles.ts b/desktop/src/engine/EntityHandles.ts
new file mode 100644
index 000000000..185997e37
--- /dev/null
+++ b/desktop/src/engine/EntityHandles.ts
@@ -0,0 +1,43 @@
+import type { EntityId } from '@/types';
+
+/**
+ * Stable editor handles for entities.
+ *
+ * The engine frees an entity id on despawn and hands out a fresh one on the
+ * next spawn, so undo/redo that re-creates an entity changes its live id. Undo
+ * closures therefore can't capture a raw id — they capture a stable handle and
+ * resolve it to the current live id at run time. `acquire` returns the SAME
+ * handle for an id that already has one, so commands acting on the same entity
+ * (e.g. duplicate then delete) share a handle and stay consistent across
+ * re-creates.
+ */
+class EntityHandlesImpl {
+ private next = 1;
+ private readonly toId = new Map<number, EntityId | null>();
+ private readonly toHandle = new Map<EntityId, number>();
+
+ /** Get the handle for an entity, creating one if needed. */
+ acquire(id: EntityId): number {
+ const existing = this.toHandle.get(id);
+ if (existing != null) return existing;
+ const handle = this.next++;
+ this.toId.set(handle, id);
+ this.toHandle.set(id, handle);
+ return handle;
+ }
+
+ /** Current live entity id for a handle, or null if it's deleted. */
+ liveId(handle: number): EntityId | null {
+ return this.toId.get(handle) ?? null;
+ }
+
+ /** Point a handle at a new live id (or null when the entity is deleted). */
+ rebind(handle: number, newId: EntityId | null): void {
+ const old = this.toId.get(handle);
+ if (old != null) this.toHandle.delete(old);
+ this.toId.set(handle, newId);
+ if (newId != null) this.toHandle.set(newId, handle);
+ }
+}
+
+export const EntityHandles = new EntityHandlesImpl();
diff --git a/desktop/src/engine/SceneCommands.ts b/desktop/src/engine/SceneCommands.ts
new file mode 100644
index 000000000..a62e18738
--- /dev/null
+++ b/desktop/src/engine/SceneCommands.ts
@@ -0,0 +1,282 @@
+import { Transform, Name, getAllRegisteredComponents } from 'esengine';
+import type { EntityId, InspectorFieldType, InspectorFieldValue } from '@/types';
+import { EngineHost } from './EngineHost';
+import { EditorHistory } from './EditorHistory';
+import { EntityHandles } from './EntityHandles';
+import { SceneQuery } from './SceneQuery';
+import { componentByName, angleZToQuat, hexToRgb, prettyLabel, type WorldT } from './schema';
+
+// — Entity snapshot capture/restore for undoable create/delete —
+// Parent/Children carry entity-id references that go stale on re-create, so
+// hierarchy links aren't restored here (flat re-spawn). Refinement: remap ids.
+const STRUCTURAL_SKIP = new Set(['Parent', 'Children']);
+
+interface CapturedEntity {
+ name: string;
+ comps: Array<{ name: string; data: unknown }>;
+}
+
+function captureEntity(world: WorldT, id: EntityId): CapturedEntity | null {
+ if (!world.valid(id)) return null;
+ let name = '';
+ const comps: Array<{ name: string; data: unknown }> = [];
+ for (const [compName, def] of getAllRegisteredComponents()) {
+ if (STRUCTURAL_SKIP.has(compName) || !world.has(id, def)) continue;
+ const data = structuredClone(world.get(id, def));
+ if (compName === 'Name') name = (data as { value?: string }).value ?? '';
+ comps.push({ name: compName, data });
+ }
+ return { name, comps };
+}
+
+function recreateEntity(world: WorldT, cap: CapturedEntity): EntityId {
+ const e = world.spawn();
+ for (const c of cap.comps) {
+ const def = componentByName(c.name);
+ if (def) world.insert(e, def, c.data as never);
+ }
+ return e;
+}
+
+const DEFAULT_TRANSFORM = {
+ position: { x: 0, y: 0, z: 0 },
+ rotation: { w: 1, x: 0, y: 0, z: 0 },
+ scale: { x: 1, y: 1, z: 1 },
+};
+
+// — Field-edit gesture: coalesce a focus→blur / drag into a single undo step. —
+//
+// Undo recording is INTERNAL to this module: the only public write door is
+// `setField` (and `setEntityXY`, which routes through it), and it always
+// records. The raw, non-recording writer `applyFieldWrite` is module-private,
+// so no caller can mutate a field while skipping undo. Outside a gesture, one
+// `setField` = one undo step. Inside a gesture, writes coalesce — the BEFORE
+// value is captured on first touch of each field, the AFTER value read at
+// `endGesture`, and the pair recorded as one step.
+
+interface FieldEdit {
+ entity: EntityId;
+ comp: string;
+ key: string;
+ type: InspectorFieldType;
+ before: InspectorFieldValue;
+}
+
+let gesture: { label: string; touched: Map<string, FieldEdit> } | null = null;
+
+const editKey = (entity: EntityId, comp: string, key: string) => `${entity}|${comp}|${key}`;
+
+function fieldEqual(a: InspectorFieldValue, b: InspectorFieldValue): boolean {
+ if (Array.isArray(a) && Array.isArray(b)) {
+ return a.length === b.length && a.every((v, i) => v === b[i]);
+ }
+ return a === b;
+}
+
+// Raw write straight through to the engine World — NO undo recording, NOT
+// exported. Besides `setField`, the only callers are the undo/redo closures
+// (which must re-apply without re-recording).
+function applyFieldWrite(
+ entity: EntityId,
+ compName: string,
+ key: string,
+ type: InspectorFieldType,
+ value: InspectorFieldValue,
+): void {
+ const world = EngineHost.app?.world;
+ if (!world || !world.valid(entity)) return;
+ const def = componentByName(compName);
+ if (!def) return;
+
+ const cur = world.get(entity, def) as unknown as Record<string, unknown>;
+ const next: Record<string, unknown> = { ...cur };
+
+ switch (type) {
+ case 'number':
+ next[key] = Number(value);
+ break;
+ case 'bool':
+ next[key] = Boolean(value);
+ break;
+ case 'string':
+ next[key] = String(value);
+ break;
+ case 'vec2': {
+ const [x, y] = value as [number, number];
+ next[key] = { ...(cur[key] as object), x, y };
+ break;
+ }
+ case 'vec3': {
+ const [x, y, z] = value as [number, number, number];
+ next[key] = { ...(cur[key] as object), x, y, z };
+ break;
+ }
+ case 'angle':
+ next[key] = angleZToQuat(Number(value));
+ break;
+ case 'color': {
+ const a = (cur[key] as { a?: number } | undefined)?.a ?? 1;
+ next[key] = { ...(cur[key] as object), ...hexToRgb(String(value)), a };
+ break;
+ }
+ }
+
+ world.set(entity, def, next as unknown as Parameters<WorldT['set']>[2]);
+}
+
+export const SceneCommands = {
+ /**
+ * Open a coalescing edit gesture. Every `setField` until {@link endGesture}
+ * folds into one undo step. Idempotent-safe: a dangling gesture is committed
+ * before a new one opens.
+ */
+ beginGesture(label: string): void {
+ if (gesture) this.endGesture();
+ gesture = { label, touched: new Map() };
+ },
+
+ /** Close the current gesture, recording all coalesced field edits as one undo step. */
+ endGesture(): void {
+ const g = gesture;
+ gesture = null;
+ if (!g || g.touched.size === 0) return;
+ const edits = [...g.touched.values()]
+ .map((e) => ({ ...e, after: SceneQuery.getFieldValue(e.entity, e.comp, e.key) }))
+ .filter((e) => e.after != null && !fieldEqual(e.before, e.after as InspectorFieldValue));
+ if (edits.length === 0) return;
+ EditorHistory.record(
+ g.label,
+ () =>
+ edits.forEach((e) =>
+ applyFieldWrite(e.entity, e.comp, e.key, e.type, e.after as InspectorFieldValue),
+ ),
+ () => edits.forEach((e) => applyFieldWrite(e.entity, e.comp, e.key, e.type, e.before)),
+ );
+ },
+
+ /**
+ * Write a single inspector field back to the engine (re-renders next frame).
+ * Always undoable: coalesced into an open gesture, else recorded as its own step.
+ */
+ setField(
+ entity: EntityId,
+ compName: string,
+ key: string,
+ type: InspectorFieldType,
+ value: InspectorFieldValue,
+ ): void {
+ const world = EngineHost.app?.world;
+ if (!world || !world.valid(entity) || !componentByName(compName)) return;
+
+ const k = editKey(entity, compName, key);
+ const firstTouch = !gesture || !gesture.touched.has(k);
+ const before = firstTouch ? SceneQuery.getFieldValue(entity, compName, key) : null;
+
+ applyFieldWrite(entity, compName, key, type, value);
+
+ if (gesture) {
+ if (firstTouch && before != null) {
+ gesture.touched.set(k, { entity, comp: compName, key, type, before });
+ }
+ return;
+ }
+ // No open gesture → this edit is its own undo step.
+ if (before == null) return;
+ const after = SceneQuery.getFieldValue(entity, compName, key);
+ if (after == null || fieldEqual(before, after)) return;
+ EditorHistory.record(
+ `Edit ${prettyLabel(key)}`,
+ () => applyFieldWrite(entity, compName, key, type, after),
+ () => applyFieldWrite(entity, compName, key, type, before),
+ );
+ },
+
+ /** Move an entity to a world position (keeps Z). Undoable like any field edit. */
+ setEntityXY(id: EntityId, x: number, y: number): void {
+ const world = EngineHost.app?.world;
+ if (!world || !world.valid(id) || !world.has(id, Transform)) return;
+ const z = world.get(id, Transform).position.z;
+ this.setField(id, 'Transform', 'position', 'vec3', [x, y, z]);
+ },
+
+ // — Undoable entity lifecycle. Re-creating an entity changes its engine id,
+ // so closures track a stable EntityHandle and resolve it live. —
+
+ /** Spawn a new empty entity (with a Transform). Returns its id. */
+ addEntity(): EntityId | null {
+ const world = EngineHost.app?.world;
+ if (!world) return null;
+ const e = world.spawn('Entity');
+ world.insert(e, Transform, DEFAULT_TRANSFORM);
+ const cap = captureEntity(world, e);
+ const handle = EntityHandles.acquire(e);
+ EditorHistory.record(
+ 'Add Entity',
+ () => {
+ if (cap) EntityHandles.rebind(handle, recreateEntity(world, cap));
+ },
+ () => despawnHandle(world, handle),
+ );
+ return e;
+ },
+
+ /** Delete an entity (undo re-creates it under the same stable handle). */
+ deleteEntity(id: EntityId): void {
+ const world = EngineHost.app?.world;
+ if (!world || !world.valid(id)) return;
+ const cap = captureEntity(world, id);
+ if (!cap) return;
+ const handle = EntityHandles.acquire(id);
+ world.despawn(id);
+ EntityHandles.rebind(handle, null);
+ EditorHistory.record(
+ `Delete ${cap.name || 'Entity'}`,
+ () => despawnHandle(world, handle),
+ () => EntityHandles.rebind(handle, recreateEntity(world, cap)),
+ );
+ },
+
+ /** Duplicate an entity (offset slightly). Returns the new id. */
+ duplicateEntity(id: EntityId): EntityId | null {
+ const world = EngineHost.app?.world;
+ if (!world || !world.valid(id)) return null;
+ const cap = captureEntity(world, id);
+ if (!cap) return null;
+ const t = cap.comps.find((c) => c.name === 'Transform');
+ const pos = t && (t.data as { position?: { x: number; y: number } }).position;
+ if (pos) {
+ pos.x += 24;
+ pos.y -= 24;
+ }
+ const dup = recreateEntity(world, cap);
+ const handle = EntityHandles.acquire(dup);
+ EditorHistory.record(
+ `Duplicate ${cap.name || 'Entity'}`,
+ () => EntityHandles.rebind(handle, recreateEntity(world, cap)),
+ () => despawnHandle(world, handle),
+ );
+ return dup;
+ },
+
+ /** Rename an entity via its Name component (undoable). */
+ renameEntity(id: EntityId, name: string): void {
+ const world = EngineHost.app?.world;
+ if (!world || !world.valid(id)) return;
+ const before = world.has(id, Name) ? world.get(id, Name).value : '';
+ if (before === name) return;
+ const handle = EntityHandles.acquire(id);
+ const setName = (value: string) => {
+ const live = EntityHandles.liveId(handle);
+ if (live != null && world.valid(live)) world.insert(live, Name, { value });
+ };
+ setName(name);
+ EditorHistory.record(`Rename ${name || 'Entity'}`, () => setName(name), () => setName(before));
+ },
+};
+
+// Despawn the entity a handle currently points at (no-op if already deleted).
+function despawnHandle(world: WorldT, handle: number): void {
+ const id = EntityHandles.liveId(handle);
+ if (id != null && world.valid(id)) world.despawn(id);
+ EntityHandles.rebind(handle, null);
+}
diff --git a/desktop/src/engine/SceneLoader.ts b/desktop/src/engine/SceneLoader.ts
new file mode 100644
index 000000000..d293667b3
--- /dev/null
+++ b/desktop/src/engine/SceneLoader.ts
@@ -0,0 +1,89 @@
+import { loadSceneData, Assets } from 'esengine';
+import type { App } from 'esengine';
+
+type SceneDataArg = Parameters<typeof loadSceneData>[1];
+
+// Minimal structural view of the engine Assets resource we use.
+interface AssetsLike {
+ loadTexture(ref: string): Promise<{ handle: number }>;
+}
+
+const UUID_PREFIX = '@uuid:';
+
+// Walk every string in the SceneData; `fn` may return a replacement value.
+function mapStrings(value: unknown, fn: (s: string) => unknown): unknown {
+ if (typeof value === 'string') return fn(value);
+ if (Array.isArray(value)) return value.map((v) => mapStrings(v, fn));
+ if (value && typeof value === 'object') {
+ const out: Record<string, unknown> = {};
+ for (const [k, v] of Object.entries(value as Record<string, unknown>)) {
+ out[k] = mapStrings(v, fn);
+ }
+ return out;
+ }
+ return value;
+}
+
+function collectUuids(sceneData: unknown): Set<string> {
+ const uuids = new Set<string>();
+ mapStrings(sceneData, (s) => {
+ if (s.startsWith(UUID_PREFIX)) uuids.add(s.slice(UUID_PREFIX.length));
+ return s;
+ });
+ return uuids;
+}
+
+export const SceneLoader = {
+ /**
+ * Fetch an `.esscene` (SceneData JSON), resolve its `@uuid:` texture refs to
+ * live texture handles via the engine Assets system + a uuid→url manifest,
+ * and spawn it into the world. Returns the entity count. Refs without a
+ * manifest entry (or a failed load) blank to 0 (solid-color sprite).
+ */
+ async loadInto(app: App, sceneUrl: string, manifestUrl?: string): Promise<number> {
+ const res = await fetch(sceneUrl);
+ if (!res.ok) throw new Error(`scene fetch failed: ${res.status} ${sceneUrl}`);
+ const raw = await res.json();
+
+ const uuidToHandle = await loadTextures(app, raw, manifestUrl);
+
+ const sceneData = mapStrings(raw, (s) =>
+ s.startsWith(UUID_PREFIX) ? (uuidToHandle.get(s.slice(UUID_PREFIX.length)) ?? 0) : s,
+ ) as SceneDataArg;
+
+ return loadSceneData(app.world, sceneData).size;
+ },
+};
+
+async function loadTextures(
+ app: App,
+ sceneData: unknown,
+ manifestUrl?: string,
+): Promise<Map<string, number>> {
+ const handles = new Map<string, number>();
+ if (!manifestUrl) return handles;
+
+ let manifest: Record<string, string>;
+ try {
+ const res = await fetch(manifestUrl);
+ if (!res.ok) return handles;
+ manifest = await res.json();
+ } catch {
+ return handles;
+ }
+
+ const assets = app.getResource(Assets) as unknown as AssetsLike | undefined;
+ if (!assets) return handles;
+
+ for (const uuid of collectUuids(sceneData)) {
+ const url = manifest[uuid];
+ if (!url) continue;
+ try {
+ const { handle } = await assets.loadTexture(url);
+ handles.set(uuid, handle);
+ } catch (err) {
+ console.warn('[engine] texture load failed', url, err);
+ }
+ }
+ return handles;
+}
diff --git a/desktop/src/engine/SceneQuery.ts b/desktop/src/engine/SceneQuery.ts
new file mode 100644
index 000000000..6365a8456
--- /dev/null
+++ b/desktop/src/engine/SceneQuery.ts
@@ -0,0 +1,93 @@
+import { Parent } from 'esengine';
+import type { SceneNode, NodeKind, EntityId, InspectorComponent, InspectorFieldValue } from '@/types';
+import { EngineHost } from './EngineHost';
+import {
+ inspectableComponents,
+ componentFields,
+ inferField,
+ kindOf,
+ nameOf,
+ componentByName,
+} from './schema';
+
+// Read-only reflection of the live engine World into editor view-models.
+export const SceneQuery = {
+ /** Monotonic counter; bump means the entity set / structure changed. */
+ worldVersion(): number {
+ return EngineHost.app?.world.getWorldVersion() ?? -1;
+ },
+
+ /** Build the outliner tree from the live World, nesting via the Parent component. */
+ readSceneTree(): SceneNode[] {
+ const world = EngineHost.app?.world;
+ if (!world) return [];
+
+ const ids = world.getAllEntities();
+ const idSet = new Set<EntityId>(ids);
+ const childrenOf = new Map<EntityId, EntityId[]>();
+ const roots: EntityId[] = [];
+
+ for (const e of ids) {
+ let parent: EntityId | null = null;
+ if (world.has(e, Parent)) {
+ const p = world.get(e, Parent).entity;
+ if (p !== e && idSet.has(p)) parent = p;
+ }
+ if (parent === null) {
+ roots.push(e);
+ } else {
+ const arr = childrenOf.get(parent);
+ if (arr) arr.push(e);
+ else childrenOf.set(parent, [e]);
+ }
+ }
+
+ const build = (e: EntityId): SceneNode => {
+ const kind = kindOf(world, e);
+ const kids = childrenOf.get(e);
+ return {
+ id: e,
+ name: nameOf(world, e, kind),
+ kind,
+ visible: true,
+ locked: false,
+ children: kids?.map(build),
+ };
+ };
+
+ return roots.map(build);
+ },
+
+ /** Inspect a single live entity (name, kind, which components it carries). */
+ readEntity(id: EntityId): { name: string; kind: NodeKind; components: string[] } | null {
+ const world = EngineHost.app?.world;
+ if (!world || !world.valid(id)) return null;
+ const kind = kindOf(world, id);
+ const components = inspectableComponents(world, id).map((c) => c.label);
+ return { name: nameOf(world, id, kind), kind, components };
+ },
+
+ /** Full editable inspector model for an entity — components from the engine registry. */
+ readInspector(entity: EntityId): InspectorComponent[] {
+ const world = EngineHost.app?.world;
+ if (!world || !world.valid(entity)) return [];
+
+ const out: InspectorComponent[] = [];
+ for (const { def, label } of inspectableComponents(world, entity)) {
+ const data = world.get(entity, def) as unknown as Record<string, unknown>;
+ out.push({ name: def._name, label, fields: componentFields(def, data) });
+ }
+ return out;
+ },
+
+ /** Read one inspector field's current value (for undo before/after capture). */
+ getFieldValue(entity: EntityId, compName: string, key: string): InspectorFieldValue | null {
+ const world = EngineHost.app?.world;
+ if (!world || !world.valid(entity)) return null;
+ const def = componentByName(compName);
+ if (!def || !world.has(entity, def)) return null;
+ const data = world.get(entity, def) as unknown as Record<string, unknown>;
+ const f = inferField(key, data[key], new Set<string>(def.colorKeys).has(key));
+ return f ? f.value : null;
+ },
+};
diff --git a/desktop/src/engine/SceneStore.ts b/desktop/src/engine/SceneStore.ts
new file mode 100644
index 000000000..ac8949318
--- /dev/null
+++ b/desktop/src/engine/SceneStore.ts
@@ -0,0 +1,52 @@
+import { getDefaultContext } from 'esengine';
+import type { EditorBridge } from 'esengine';
+
+/**
+ * Reactive mirror of the engine scene.
+ *
+ * Registers an {@link EditorBridge} so the engine pushes every mutation
+ * (spawn/despawn/parent/component add/remove/change) instead of the editor
+ * polling. Panels subscribe via `useSyncExternalStore` and re-read through
+ * `EngineHost`; this store only carries revision counters that say *what kind*
+ * of thing changed:
+ *
+ * - `structureRevision` bumps on entity/parent/component add+remove (tree shape)
+ * - `revision` bumps on any change, incl. component-data edits (inspector values)
+ */
+class SceneStoreImpl {
+ private revision = 1;
+ private structureRevision = 1;
+ private installed = false;
+ private readonly listeners = new Set<() => void>();
+
+ /** Register the bridge on the engine's default context. Idempotent. */
+ install() {
+ if (this.installed) return;
+ this.installed = true;
+ const bridge: EditorBridge = {
+ registerComponent: () => {},
+ onEntitySpawned: () => this.bump(true),
+ onEntityDespawned: () => this.bump(true),
+ onComponentAdded: () => this.bump(true),
+ onComponentRemoved: () => this.bump(true),
+ onParentChanged: () => this.bump(true),
+ onComponentChanged: () => this.bump(false),
+ };
+ getDefaultContext().editorBridge = bridge;
+ }
+
+ private bump(structural: boolean) {
+ this.revision += 1;
+ if (structural) this.structureRevision += 1;
+ for (const l of this.listeners) l();
+ }
+
+ subscribe = (fn: () => void): (() => void) => {
+ this.listeners.add(fn);
+ return () => this.listeners.delete(fn);
+ };
+ getRevision = (): number => this.revision;
+ getStructureRevision = (): number => this.structureRevision;
+}
+
+export const SceneStore = new SceneStoreImpl();
diff --git a/desktop/src/engine/StatsStore.ts b/desktop/src/engine/StatsStore.ts
new file mode 100644
index 000000000..1030a0966
--- /dev/null
+++ b/desktop/src/engine/StatsStore.ts
@@ -0,0 +1,68 @@
+import { EngineHost } from './EngineHost';
+
+export interface StatsSnapshot {
+ fps: number;
+ entities: number;
+ cursor: { x: number; y: number } | null;
+}
+
+// Live editor telemetry for the status bar: real FPS (measured here), live
+// entity count, and the viewport cursor's world position. Updated a few times
+// a second (not per frame) to avoid churning the status bar.
+class StatsStoreImpl {
+ private snapshot: StatsSnapshot = { fps: 0, entities: 0, cursor: null };
+ private readonly listeners = new Set<() => void>();
+
+ private running = false;
+ private frames = 0;
+ private windowStart = 0;
+
+ /** Start the FPS/entity-count sampling loop (idempotent). */
+ start() {
+ if (this.running) return;
+ this.running = true;
+ const loop = (t: number) => {
+ if (!this.running) return;
+ requestAnimationFrame(loop);
+ this.frames += 1;
+ if (this.windowStart === 0) this.windowStart = t;
+ const elapsed = t - this.windowStart;
+ if (elapsed >= 333) {
+ const fps = Math.round((this.frames * 1000) / elapsed);
+ const entities = EngineHost.app?.world.getAllEntities().length ?? 0;
+ this.frames = 0;
+ this.windowStart = t;
+ if (fps !== this.snapshot.fps || entities !== this.snapshot.entities) {
+ this.emit({ ...this.snapshot, fps, entities });
+ }
+ }
+ };
+ requestAnimationFrame(loop);
+ }
+
+ /** Report the viewport cursor world position (rounded; ignores no-op moves). */
+ setCursor(x: number, y: number) {
+ const cx = Math.round(x);
+ const cy = Math.round(y);
+ const cur = this.snapshot.cursor;
+ if (cur && cur.x === cx && cur.y === cy) return;
+ this.emit({ ...this.snapshot, cursor: { x: cx, y: cy } });
+ }
+
+ clearCursor() {
+ if (this.snapshot.cursor) this.emit({ ...this.snapshot, cursor: null });
+ }
+
+ private emit(next: StatsSnapshot) {
+ this.snapshot = next;
+ for (const l of this.listeners) l();
+ }
+
+ subscribe = (fn: () => void): (() => void) => {
+ this.listeners.add(fn);
+ return () => this.listeners.delete(fn);
+ };
+ getSnapshot = (): StatsSnapshot => this.snapshot;
+}
+
+export const StatsStore = new StatsStoreImpl();
diff --git a/desktop/src/engine/ViewportController.ts b/desktop/src/engine/ViewportController.ts
new file mode 100644
index 000000000..45d1f7b46
--- /dev/null
+++ b/desktop/src/engine/ViewportController.ts
@@ -0,0 +1,124 @@
+import { CameraView, Sprite, Transform } from 'esengine';
+import type { EntityId } from '@/types';
+import { EngineHost } from './EngineHost';
+
+// Structural shape of the engine's CameraView resource (screen<->world).
+interface CameraViewLike {
+ screenToWorld(x: number, y: number): { x: number; y: number } | null;
+ worldToScreen(x: number, y: number): { x: number; y: number } | null;
+}
+
+function cameraView(): CameraViewLike | null {
+ const cv = EngineHost.app?.getResource(CameraView) as unknown as CameraViewLike | undefined;
+ return cv ?? null;
+}
+
+/** DOM pointer position → engine screen space (buffer px, y-up). */
+function clientToScreen(clientX: number, clientY: number): { sx: number; sy: number } | null {
+ const canvas = EngineHost.canvas;
+ if (!canvas) return null;
+ const rect = canvas.getBoundingClientRect();
+ const dpr = window.devicePixelRatio || 1;
+ return {
+ sx: (clientX - rect.left) * dpr,
+ sy: canvas.height - (clientY - rect.top) * dpr, // GL is y-up; flip
+ };
+}
+
+// Picking and screen<->world conversions for the viewport, all routed through
+// the engine's own camera matrices (no projection assumptions).
+export const ViewportController = {
+ /** DOM pointer position → world coordinates. */
+ canvasToWorld(clientX: number, clientY: number): { x: number; y: number } | null {
+ const cv = cameraView();
+ const s = clientToScreen(clientX, clientY);
+ if (!cv || !s) return null;
+ return cv.screenToWorld(s.sx, s.sy);
+ },
+
+ /** World coordinates → CSS pixels relative to the canvas top-left (gizmo placement). */
+ worldToClient(wx: number, wy: number): { x: number; y: number } | null {
+ const cv = cameraView();
+ const canvas = EngineHost.canvas;
+ if (!cv || !canvas) return null;
+ const s = cv.worldToScreen(wx, wy);
+ if (!s) return null;
+ const dpr = window.devicePixelRatio || 1;
+ return { x: s.x / dpr, y: (canvas.height - s.y) / dpr }; // un-flip, to CSS px
+ },
+
+ /** Topmost sprite under a pointer (AABB test in world space), or null. */
+ pickEntity(clientX: number, clientY: number): EntityId | null {
+ const world = EngineHost.app?.world;
+ const wp = this.canvasToWorld(clientX, clientY);
+ if (!world || !wp) return null;
+
+ let best: EntityId | null = null;
+ let bestLayer = -Infinity;
+ for (const e of world.getAllEntities()) {
+ if (!world.has(e, Sprite) || !world.has(e, Transform)) continue;
+ const t = world.get(e, Transform);
+ const sp = world.get(e, Sprite);
+ const w = sp.size.x * t.scale.x;
+ const h = sp.size.y * t.scale.y;
+ const px = sp.pivot?.x ?? 0.5;
+ const py = sp.pivot?.y ?? 0.5;
+ const left = t.position.x - w * px;
+ const right = t.position.x + w * (1 - px);
+ const bottom = t.position.y - h * py;
+ const top = t.position.y + h * (1 - py);
+ if (wp.x >= left && wp.x <= right && wp.y >= bottom && wp.y <= top) {
+ if (sp.layer >= bestLayer) {
+ bestLayer = sp.layer;
+ best = e;
+ }
+ }
+ }
+ return best;
+ },
+
+ getEntityXY(id: EntityId): { x: number; y: number } | null {
+ const world = EngineHost.app?.world;
+ if (!world || !world.valid(id) || !world.has(id, Transform)) return null;
+ const t = world.get(id, Transform);
+ return { x: t.position.x, y: t.position.y };
+ },
+
+ /** Screen-space bounding rect (CSS px rel. canvas) of an entity, for the selection outline. */
+ getEntityScreenRect(id: EntityId): { x: number; y: number; w: number; h: number } | null {
+ const world = EngineHost.app?.world;
+ if (!world || !world.valid(id) || !world.has(id, Transform)) return null;
+ const t = world.get(id, Transform);
+
+ let w = 40;
+ let h = 40;
+ let px = 0.5;
+ let py = 0.5;
+ if (world.has(id, Sprite)) {
+ const sp = world.get(id, Sprite);
+ w = sp.size.x * t.scale.x;
+ h = sp.size.y * t.scale.y;
+ px = sp.pivot?.x ?? 0.5;
+ py = sp.pivot?.y ?? 0.5;
+ }
+
+ const cx = t.position.x;
+ const cy = t.position.y;
+ const worldCorners: Array<[number, number]> = [
+ [cx - w * px, cy - h * py],
+ [cx + w * (1 - px), cy - h * py],
+ [cx + w * (1 - px), cy + h * (1 - py)],
+ [cx - w * px, cy + h * (1 - py)],
+ ];
+
+ const screen = worldCorners.map(([wx, wy]) => this.worldToClient(wx, wy));
+ if (screen.some((p) => !p)) return null;
+ const xs = screen.map((p) => p!.x);
+ const ys = screen.map((p) => p!.y);
+ const minX = Math.min(...xs);
+ const maxX = Math.max(...xs);
+ const minY = Math.min(...ys);
+ const maxY = Math.max(...ys);
+ return { x: minX, y: minY, w: maxX - minX, h: maxY - minY };
+ },
+};
diff --git a/desktop/src/engine/schema.ts b/desktop/src/engine/schema.ts
new file mode 100644
index 000000000..3c8d086eb
--- /dev/null
+++ b/desktop/src/engine/schema.ts
@@ -0,0 +1,150 @@
+import {
+ getAllRegisteredComponents,
+ getComponent,
+ Sprite,
+ Camera,
+ Name,
+ Children,
+ ShapeRenderer,
+ Canvas,
+ BitmapText,
+ SpineAnimation,
+ TilemapLayer,
+ ParticleEmitter,
+} from 'esengine';
+import type { App } from 'esengine';
+import type { NodeKind, EntityId, InspectorField } from '@/types';
+
+// Shared engine-schema utilities. The set of components and their data shape are
+// owned by the ENGINE: `getComponentRegistry()` enumerates every registered
+// component, and each component's `_default` describes its (JS-side) fields.
+// The editor only adds presentation policy (what to hide, labels, order) and
+// infers an editable control per field from its live value shape.
+//
+// Note: PTR_LAYOUTS (the C++ heap layout) is intentionally NOT used for fields —
+// it can diverge from the JS data shape that world.get/set operate on (e.g.
+// Camera packs a vec4 `viewport` where the JS data exposes viewportX/Y/W/H).
+
+export type WorldT = App['world'];
+export type AnyComp = Parameters<WorldT['has']>[1];
+
+// — Presentation policy (editor-side, not engine schema) —
+
+// Structural/relationship components that drive the tree, not the inspector.
+const HIDDEN_COMPONENTS = new Set(['Parent', 'Children', 'Name']);
+// Computed world-space mirrors on Transform — never editable.
+const DERIVED_FIELDS = new Set(['worldPosition', 'worldRotation', 'worldScale']);
+// Inspector display order; anything not listed follows in registration order.
+const ORDER = ['Transform', 'Camera', 'Sprite', 'ShapeRenderer', 'SpineAnimation'];
+
+const registryDef = (name: string): AnyComp | undefined =>
+ getComponent(name) as unknown as AnyComp | undefined;
+
+export function componentByName(name: string): AnyComp | undefined {
+ return registryDef(name);
+}
+
+/** Every editable component the entity currently carries, in display order. */
+export function inspectableComponents(
+ world: WorldT,
+ entity: EntityId,
+): Array<{ name: string; def: AnyComp; label: string }> {
+ const out: Array<{ name: string; def: AnyComp; label: string }> = [];
+ for (const [name, rawDef] of getAllRegisteredComponents()) {
+ if (HIDDEN_COMPONENTS.has(name)) continue;
+ const def = rawDef as unknown as AnyComp;
+ if (!world.has(entity, def)) continue;
+ out.push({ name, def, label: prettyLabel(name) });
+ }
+ out.sort((a, b) => {
+ const ai = ORDER.indexOf(a.name);
+ const bi = ORDER.indexOf(b.name);
+ return (ai === -1 ? ORDER.length : ai) - (bi === -1 ? ORDER.length : bi);
+ });
+ return out;
+}
+
+/** The editable fields of one component (its live data introspected by shape). */
+export function componentFields(def: AnyComp, data: Record<string, unknown>): InspectorField[] {
+ const colorKeys = new Set<string>(def.colorKeys);
+ const fields: InspectorField[] = [];
+ for (const key of Object.keys(def._default as Record<string, unknown>)) {
+ if (DERIVED_FIELDS.has(key)) continue;
+ const f = inferField(key, data[key], colorKeys.has(key));
+ if (f) fields.push(f);
+ }
+ return fields;
+}
+
+// — Field value inference (matches the JS data shape world.get/set use) —
+
+const RAD2DEG = 180 / Math.PI;
+const DEG2RAD = Math.PI / 180;
+const cap = (s: string) => s.charAt(0).toUpperCase() + s.slice(1);
+
+export const prettyLabel = (key: string) =>
+ key
+ .replace(/([A-Z])/g, ' $1')
+ .replace(/^./, (c) => c.toUpperCase())
+ .trim();
+
+// 2D rotation lives in a quaternion's z/w; surface it as a Z angle in degrees.
+const quatToAngleZ = (q: { z: number; w: number }) =>
+ Math.round(Math.atan2(q.z, q.w) * 2 * RAD2DEG * 100) / 100;
+export const angleZToQuat = (deg: number) => {
+ const h = (deg * DEG2RAD) / 2;
+ return { x: 0, y: 0, z: Math.sin(h), w: Math.cos(h) };
+};
+
+const chan = (n: number) =>
+ Math.max(0, Math.min(255, Math.round(n * 255)))
+ .toString(16)
+ .padStart(2, '0');
+const rgbToHex = (c: { r: number; g: number; b: number }) =>
+ `#${chan(c.r)}${chan(c.g)}${chan(c.b)}`;
+export const hexToRgb = (hex: string) => {
+ const m = /^#?([0-9a-f]{6})$/i.exec(hex.trim());
+ if (!m) return { r: 1, g: 1, b: 1 };
+ const n = parseInt(m[1], 16);
+ return { r: ((n >> 16) & 255) / 255, g: ((n >> 8) & 255) / 255, b: (n & 255) / 255 };
+};
+
+/** Infer an editable field from a live component value + its key. */
+export function inferField(key: string, v: unknown, isColor: boolean): InspectorField | null {
+ const label = prettyLabel(key);
+ if (isColor && v && typeof v === 'object') {
+ return { key, label, type: 'color', value: rgbToHex(v as { r: number; g: number; b: number }) };
+ }
+ if (typeof v === 'number') return { key, label, type: 'number', value: v };
+ if (typeof v === 'boolean') return { key, label, type: 'bool', value: v };
+ if (typeof v === 'string') return { key, label, type: 'string', value: v };
+ if (v && typeof v === 'object') {
+ const o = v as Record<string, number>;
+ if ('w' in o && 'z' in o && 'x' in o)
+ return { key, label, type: 'angle', value: quatToAngleZ(o as { z: number; w: number }) };
+ if ('z' in o && 'x' in o && 'y' in o) return { key, label, type: 'vec3', value: [o.x, o.y, o.z] };
+ if ('x' in o && 'y' in o) return { key, label, type: 'vec2', value: [o.x, o.y] };
+ }
+ return null; // unknown shape — not editable here
+}
+
+// — Outliner kind/name (presentation; uses specific defs for icon mapping) —
+
+export function kindOf(world: WorldT, e: EntityId): NodeKind {
+ if (world.has(e, Camera)) return 'camera';
+ if (world.has(e, SpineAnimation)) return 'spine';
+ if (world.has(e, Canvas) || world.has(e, BitmapText)) return 'ui';
+ if (world.has(e, Sprite) || world.has(e, ShapeRenderer) || world.has(e, TilemapLayer))
+ return 'sprite';
+ if (world.has(e, ParticleEmitter)) return 'sprite';
+ if (world.has(e, Children)) return 'group';
+ return 'empty';
+}
+
+export function nameOf(world: WorldT, e: EntityId, kind: NodeKind): string {
+ if (world.has(e, Name)) {
+ const v = world.get(e, Name).value;
+ if (v) return v;
+ }
+ return `${cap(kind)} ${e}`;
+}
diff --git a/desktop/src/launcher/Launcher.tsx b/desktop/src/launcher/Launcher.tsx
new file mode 100644
index 000000000..9f194b879
--- /dev/null
+++ b/desktop/src/launcher/Launcher.tsx
@@ -0,0 +1,366 @@
+import { useEffect, useMemo, useState } from 'react';
+import { ArrowRight, Clock, FolderOpen, LayoutGrid, Plus, Rows3, Search } from 'lucide-react';
+import { useEditorStore } from '@/store/editorStore';
+import { ProjectStore } from '@/project/ProjectStore';
+import type { RecentEntry, TemplateEntry } from '@/project/format';
+
+// Project browser shown before a project is open. Structure borrows Unity Hub
+// (persistent top actions, build-aware project list, grid/list views) and UE5's
+// Project Browser (template gallery + a create panel), worn in Estella's
+// "stellar instrument" identity. Recent / Open / New-from-template are wired to
+// ProjectStore + the recents / template IPC.
+
+type View = 'recent' | 'new';
+type Layout = 'grid' | 'list';
+
+function relTime(ts: number): string {
+ const s = Math.max(1, Math.floor((Date.now() - ts) / 1000));
+ if (s < 60) return 'just now';
+ const m = Math.floor(s / 60);
+ if (m < 60) return `${m}m ago`;
+ const h = Math.floor(m / 60);
+ if (h < 24) return `${h}h ago`;
+ const d = Math.floor(h / 24);
+ if (d < 7) return `${d}d ago`;
+ return `${Math.floor(d / 7)}w ago`;
+}
+
+/** A static SVG constellation — the launcher's quiet signature mark. */
+function Constellation() {
+ return (
+ <svg className="lc-constellation" viewBox="0 0 120 64" aria-hidden="true">
+ <polyline points="8,40 34,22 58,34 86,14 110,30" fill="none" />
+ <circle cx="8" cy="40" r="1.6" />
+ <circle cx="34" cy="22" r="1.6" />
+ <circle cx="58" cy="34" r="1.6" />
+ <circle cx="86" cy="14" r="2.4" className="lc-constellation__star" />
+ <circle cx="110" cy="30" r="1.6" />
+ </svg>
+ );
+}
+
+/** Project tile — the real thumbnail if present, else a star-chart placeholder. */
+function Thumb({ label, src }: { label: string; src?: string }) {
+ return (
+ <div className="proj-card__thumb" aria-hidden="true">
+ {src ? (
+ <img className="proj-card__img" src={src} alt="" />
+ ) : (
+ <span className="proj-card__glyph">{label.charAt(0).toUpperCase()}</span>
+ )}
+ </div>
+ );
+}
+
+function RecentView({
+ onOpen,
+ onOpenFolder,
+}: {
+ onOpen: (root: string) => void;
+ onOpenFolder: () => void;
+}) {
+ const [recents, setRecents] = useState<RecentEntry[]>([]);
+ const [layout, setLayout] = useState<Layout>('grid');
+ const [query, setQuery] = useState('');
+
+ useEffect(() => {
+ let live = true;
+ void window.estella?.recents
+ ?.list()
+ .then((r) => { if (live) setRecents(r); })
+ .catch(() => {});
+ return () => {
+ live = false;
+ };
+ }, []);
+
+ const items = useMemo(
+ () => recents.filter((p) => p.name.toLowerCase().includes(query.toLowerCase())),
+ [recents, query],
+ );
+
+ return (
+ <>
+ <header className="lc-head">
+ <h1>Recent</h1>
+ <div className="lc-head__tools">
+ <label className="lc-search">
+ <Search size={13} strokeWidth={1.85} />
+ <input
+ value={query}
+ onChange={(e) => setQuery(e.target.value)}
+ placeholder="Search projects"
+ spellCheck={false}
+ />
+ </label>
+ <div className="lc-seg" role="group" aria-label="View">
+ <button
+ type="button"
+ className={`lc-seg__btn${layout === 'grid' ? ' is-active' : ''}`}
+ onClick={() => setLayout('grid')}
+ title="Grid"
+ >
+ <LayoutGrid size={14} strokeWidth={1.9} />
+ </button>
+ <button
+ type="button"
+ className={`lc-seg__btn${layout === 'list' ? ' is-active' : ''}`}
+ onClick={() => setLayout('list')}
+ title="List"
+ >
+ <Rows3 size={14} strokeWidth={1.9} />
+ </button>
+ </div>
+ </div>
+ </header>
+
+ {recents.length === 0 ? (
+ <div className="lc-empty">
+ <p>No recent projects yet.</p>
+ <button type="button" className="lc-btn lc-btn--primary" onClick={onOpenFolder}>
+ <FolderOpen size={14} strokeWidth={2} /> Open a project folder
+ </button>
+ </div>
+ ) : items.length === 0 ? (
+ <div className="lc-empty">
+ <p>No projects match “{query}”.</p>
+ </div>
+ ) : layout === 'grid' ? (
+ <div className="proj-grid">
+ {items.map((p) => (
+ <button key={p.root} type="button" className="proj-card" onClick={() => onOpen(p.root)}>
+ <Thumb label={p.name} src={p.thumbnail} />
+ <div className="proj-card__body">
+ <span className="proj-card__name">{p.name}</span>
+ <span className="proj-card__meta mono">{relTime(p.openedAt)}</span>
+ <span className="proj-card__path mono">{p.root}</span>
+ </div>
+ {p.build && <span className="proj-card__build mono">{p.build}</span>}
+ </button>
+ ))}
+ </div>
+ ) : (
+ <div className="proj-list">
+ <div className="proj-list__head mono">
+ <span>Project</span>
+ <span>Last opened</span>
+ <span>Build</span>
+ </div>
+ {items.map((p) => (
+ <button key={p.root} type="button" className="proj-row" onClick={() => onOpen(p.root)}>
+ <span className="proj-row__main">
+ <span className="proj-row__name">{p.name}</span>
+ <span className="proj-row__path mono">{p.root}</span>
+ </span>
+ <span className="proj-row__col mono">{relTime(p.openedAt)}</span>
+ <span className="proj-row__col">{p.build && <span className="lc-badge mono">{p.build}</span>}</span>
+ </button>
+ ))}
+ </div>
+ )}
+ </>
+ );
+}
+
+function NewView({ onCreated }: { onCreated: () => void }) {
+ const [templates, setTemplates] = useState<TemplateEntry[]>([]);
+ const [selected, setSelected] = useState<number | null>(null);
+ const [name, setName] = useState('');
+ const [location, setLocation] = useState('');
+ const [busy, setBusy] = useState(false);
+
+ useEffect(() => {
+ let live = true;
+ void window.estella?.templates
+ ?.list()
+ .then((t) => { if (live) setTemplates(t); })
+ .catch(() => {});
+ return () => {
+ live = false;
+ };
+ }, []);
+
+ const tpl = selected != null ? templates[selected] : null;
+
+ const pick = (i: number) => {
+ setSelected(i);
+ setName((n) => n || templates[i].name.toLowerCase().replace(/\s+/g, '-'));
+ };
+
+ const browse = () => {
+ void window.estella?.project?.chooseDirectory().then((dir) => {
+ if (dir) setLocation(dir);
+ });
+ };
+
+ const create = async () => {
+ if (!tpl || busy) return;
+ let loc = location;
+ if (!loc) {
+ loc = (await window.estella?.project?.chooseDirectory()) ?? '';
+ if (!loc) return;
+ setLocation(loc);
+ }
+ setBusy(true);
+ const ok = await ProjectStore.createAndOpen(tpl.dir, loc, name || tpl.name);
+ setBusy(false);
+ if (ok) onCreated();
+ };
+
+ return (
+ <div className="lc-new">
+ <div className="lc-new__gallery">
+ <header className="lc-head">
+ <h1>New project</h1>
+ <p className="lc-head__sub">Start from a template — you can change anything later.</p>
+ </header>
+ {templates.length === 0 ? (
+ <div className="lc-empty">
+ <p>No templates found.</p>
+ </div>
+ ) : (
+ <div className="proj-grid">
+ {templates.map((t, i) => (
+ <button
+ key={t.dir}
+ type="button"
+ className={`proj-card proj-card--template${selected === i ? ' is-selected' : ''}`}
+ onClick={() => pick(i)}
+ >
+ <Thumb label={t.name} src={t.thumbnail} />
+ <div className="proj-card__body">
+ <span className="proj-card__name">{t.name}</span>
+ {t.description && <span className="proj-card__desc">{t.description}</span>}
+ </div>
+ {t.tag && <span className="proj-card__tag mono">{t.tag}</span>}
+ </button>
+ ))}
+ </div>
+ )}
+ </div>
+
+ <aside className="lc-create">
+ {tpl ? (
+ <>
+ <div className="lc-create__preview">
+ <Thumb label={tpl.name} src={tpl.thumbnail} />
+ </div>
+ <span className="lc-create__tpl">{tpl.name}</span>
+ {tpl.description && <p className="lc-create__desc">{tpl.description}</p>}
+
+ <label className="lc-field">
+ <span>Project name</span>
+ <input value={name} onChange={(e) => setName(e.target.value)} spellCheck={false} />
+ </label>
+ <label className="lc-field">
+ <span>Location</span>
+ <span className="lc-field__path">
+ <input
+ value={location}
+ onChange={(e) => setLocation(e.target.value)}
+ placeholder="Choose a folder…"
+ spellCheck={false}
+ />
+ <button type="button" className="lc-field__browse" title="Choose folder" onClick={browse}>
+ <FolderOpen size={13} strokeWidth={1.9} />
+ </button>
+ </span>
+ </label>
+
+ <button
+ type="button"
+ className="lc-btn lc-btn--primary lc-create__go"
+ onClick={() => void create()}
+ disabled={busy || !name}
+ >
+ {busy ? (
+ 'Creating…'
+ ) : (
+ <>
+ Create project <ArrowRight size={15} strokeWidth={2} />
+ </>
+ )}
+ </button>
+ </>
+ ) : (
+ <div className="lc-create__hint">
+ <p>Pick a template to begin.</p>
+ </div>
+ )}
+ </aside>
+ </div>
+ );
+}
+
+export function Launcher() {
+ const [view, setView] = useState<View>('recent');
+ const enter = useEditorStore((s) => s.enterEditor);
+
+ const openProject = (root: string) => {
+ void ProjectStore.open(root).then((ok) => {
+ if (ok) enter();
+ });
+ };
+ const openFolder = () => {
+ void ProjectStore.openViaDialog().then((ok) => {
+ if (ok) enter();
+ });
+ };
+
+ return (
+ <div className="launcher">
+ <header className="launcher__bar">
+ <div className="lc-brand">
+ <svg className="lc-brand__mark" viewBox="0 0 24 24" aria-hidden="true">
+ <path d="M12 2 L14 10 L22 12 L14 14 L12 22 L10 14 L2 12 L10 10 Z" />
+ </svg>
+ <div className="lc-brand__text">
+ <strong>Estella</strong>
+ <span>editor</span>
+ </div>
+ </div>
+ <div className="launcher__bar-actions">
+ <button type="button" className="lc-btn" onClick={() => setView('new')}>
+ <Plus size={14} strokeWidth={2} /> New project
+ </button>
+ <button type="button" className="lc-btn lc-btn--primary" onClick={openFolder}>
+ <FolderOpen size={14} strokeWidth={2} /> Open folder…
+ </button>
+ </div>
+ </header>
+
+ <div className="launcher__body">
+ <aside className="launcher__rail">
+ <nav className="lc-nav">
+ <button
+ type="button"
+ className={`lc-nav__item${view === 'recent' ? ' is-active' : ''}`}
+ onClick={() => setView('recent')}
+ >
+ <Clock size={15} strokeWidth={1.85} /> Recent
+ </button>
+ <button
+ type="button"
+ className={`lc-nav__item${view === 'new' ? ' is-active' : ''}`}
+ onClick={() => setView('new')}
+ >
+ <Plus size={15} strokeWidth={1.85} /> New project
+ </button>
+ </nav>
+ <div className="lc-rail__foot">
+ <Constellation />
+ <span className="mono">v0.4.0 · web</span>
+ </div>
+ </aside>
+
+ <main className="launcher__main">
+ {view === 'recent' ? (
+ <RecentView onOpen={openProject} onOpenFolder={openFolder} />
+ ) : (
+ <NewView onCreated={enter} />
+ )}
+ </main>
+ </div>
+ </div>
+ );
+}
diff --git a/desktop/src/layout/DockLayout.tsx b/desktop/src/layout/DockLayout.tsx
new file mode 100644
index 000000000..bd24e3d8d
--- /dev/null
+++ b/desktop/src/layout/DockLayout.tsx
@@ -0,0 +1,86 @@
+import type { FC } from 'react';
+import { DockviewReact, type DockviewReadyEvent, type IDockviewPanelProps } from 'dockview';
+import { Outliner } from '@/panels/Outliner';
+import { Viewport } from '@/panels/Viewport';
+import { Details } from '@/panels/Details';
+import { ContentBrowser } from '@/panels/ContentBrowser';
+import { OutputLog } from '@/panels/OutputLog';
+
+// Each dock panel is a thin wrapper so dockview owns mount/unmount.
+const components: Record<string, FC<IDockviewPanelProps>> = {
+ outliner: () => <Outliner />,
+ viewport: () => <Viewport />,
+ details: () => <Details />,
+ content: () => <ContentBrowser />,
+ log: () => <OutputLog />,
+};
+
+const LAYOUT_KEY = 'estella.editor.layout.v1';
+
+function buildDefaultLayout(api: DockviewReadyEvent['api']) {
+ // Viewport is the anchor; everything docks around it — the UE5 arrangement.
+ api.addPanel({ id: 'viewport', component: 'viewport', title: 'Viewport' });
+
+ api.addPanel({
+ id: 'outliner',
+ component: 'outliner',
+ title: 'World Outliner',
+ position: { referencePanel: 'viewport', direction: 'left' },
+ initialWidth: 264,
+ });
+
+ api.addPanel({
+ id: 'details',
+ component: 'details',
+ title: 'Details',
+ position: { referencePanel: 'viewport', direction: 'right' },
+ initialWidth: 332,
+ });
+
+ api.addPanel({
+ id: 'content',
+ component: 'content',
+ title: 'Content Browser',
+ position: { referencePanel: 'viewport', direction: 'below' },
+ initialHeight: 248,
+ });
+
+ // Output Log shares the bottom group as a sibling tab of Content Browser.
+ api.addPanel({
+ id: 'log',
+ component: 'log',
+ title: 'Output Log',
+ position: { referencePanel: 'content', direction: 'within' },
+ });
+}
+
+export function DockLayout() {
+ const onReady = (event: DockviewReadyEvent) => {
+ const { api } = event;
+
+ const saved = localStorage.getItem(LAYOUT_KEY);
+ if (saved) {
+ try {
+ api.fromJSON(JSON.parse(saved));
+ } catch {
+ api.clear();
+ buildDefaultLayout(api);
+ }
+ } else {
+ buildDefaultLayout(api);
+ }
+
+ // Persist the dock arrangement so it survives reloads — a real editor habit.
+ api.onDidLayoutChange(() => {
+ localStorage.setItem(LAYOUT_KEY, JSON.stringify(api.toJSON()));
+ });
+ };
+
+ return (
+ <DockviewReact
+ className="dockview-theme-abyss dockview-theme-estella"
+ components={components}
+ onReady={onReady}
+ />
+ );
+}
diff --git a/desktop/src/layout/MenuBar.tsx b/desktop/src/layout/MenuBar.tsx
new file mode 100644
index 000000000..cfd49e1a1
--- /dev/null
+++ b/desktop/src/layout/MenuBar.tsx
@@ -0,0 +1,40 @@
+// Top menu bar. Draws the Estella mark and the classic menu set. The window is
+// frameless (titleBarStyle: hiddenInset) so this strip doubles as the drag region.
+
+const MENUS = ['File', 'Edit', 'Selection', 'View', 'Actor', 'Build', 'Window', 'Help'];
+
+function Mark() {
+ // The signature: a four-point starlight glyph — "Estella" = star.
+ return (
+ <svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true">
+ <path
+ d="M8 0.5 L9.4 6.6 L15.5 8 L9.4 9.4 L8 15.5 L6.6 9.4 L0.5 8 L6.6 6.6 Z"
+ fill="var(--star)"
+ />
+ <circle cx="8" cy="8" r="1.1" fill="var(--void)" />
+ </svg>
+ );
+}
+
+export function MenuBar() {
+ return (
+ <div className="menubar">
+ <div className="menubar__brand">
+ <Mark />
+ <span className="menubar__title">Estella</span>
+ </div>
+ <nav className="menubar__menus">
+ {MENUS.map((m) => (
+ <button key={m} className="menubar__item" type="button">
+ {m}
+ </button>
+ ))}
+ </nav>
+ <div className="menubar__project">
+ <span className="menubar__project-name">platformer</span>
+ <span className="menubar__sep">/</span>
+ <span className="menubar__scene mono">Level_01.scene</span>
+ </div>
+ </div>
+ );
+}
diff --git a/desktop/src/layout/StatusBar.tsx b/desktop/src/layout/StatusBar.tsx
new file mode 100644
index 000000000..529126660
--- /dev/null
+++ b/desktop/src/layout/StatusBar.tsx
@@ -0,0 +1,40 @@
+import { useSyncExternalStore } from 'react';
+import { Circle, Gauge, MousePointer2, Boxes } from 'lucide-react';
+import { useEditorStore } from '@/store/editorStore';
+import { StatsStore } from '@/engine/StatsStore';
+
+// Bottom status strip — live engine telemetry (real FPS / entity count / cursor
+// world position) reads in the mono face.
+export function StatusBar() {
+ const isPlaying = useEditorStore((s) => s.isPlaying);
+ const selectedId = useEditorStore((s) => s.selectedId);
+ const stats = useSyncExternalStore(StatsStore.subscribe, StatsStore.getSnapshot);
+
+ return (
+ <footer className="statusbar">
+ <div className="statusbar__left">
+ <span className={`statusbar__dot${isPlaying ? ' is-live' : ''}`}>
+ <Circle size={8} fill="currentColor" strokeWidth={0} />
+ {isPlaying ? 'Running' : 'Edit Mode'}
+ </span>
+ <span className="statusbar__item">
+ {selectedId != null ? '1 selected' : 'No selection'}
+ </span>
+ </div>
+
+ <div className="statusbar__right mono">
+ <span className="statusbar__item">
+ <MousePointer2 size={11} strokeWidth={1.85} />
+ {stats.cursor ? `${stats.cursor.x}, ${stats.cursor.y}` : '—'}
+ </span>
+ <span className="statusbar__item">
+ <Gauge size={11} strokeWidth={1.85} /> {stats.fps} fps
+ </span>
+ <span className="statusbar__item">
+ <Boxes size={11} strokeWidth={1.85} /> {stats.entities} entities
+ </span>
+ <span className="statusbar__item statusbar__item--engine">esengine 0.10.0</span>
+ </div>
+ </footer>
+ );
+}
diff --git a/desktop/src/layout/Toolbar.tsx b/desktop/src/layout/Toolbar.tsx
new file mode 100644
index 000000000..88996e386
--- /dev/null
+++ b/desktop/src/layout/Toolbar.tsx
@@ -0,0 +1,160 @@
+import { useSyncExternalStore } from 'react';
+import {
+ Save,
+ Undo2,
+ Redo2,
+ MousePointer2,
+ Move,
+ RotateCw,
+ Scale3d,
+ Magnet,
+ Grid3x3,
+ Play,
+ Pause,
+ Square as Stop,
+ Eye,
+ Smartphone,
+ Hammer,
+ type LucideIcon,
+} from 'lucide-react';
+import { useEditorStore } from '@/store/editorStore';
+import { EditorHistory } from '@/engine/EditorHistory';
+import type { ToolMode } from '@/types';
+
+interface ToolDef {
+ mode: ToolMode;
+ icon: LucideIcon;
+ label: string;
+ key: string;
+}
+
+const TOOLS: ToolDef[] = [
+ { mode: 'select', icon: MousePointer2, label: 'Select', key: 'Q' },
+ { mode: 'move', icon: Move, label: 'Move', key: 'W' },
+ { mode: 'rotate', icon: RotateCw, label: 'Rotate', key: 'E' },
+ { mode: 'scale', icon: Scale3d, label: 'Scale', key: 'R' },
+];
+
+function TBtn({
+ icon: Icon,
+ label,
+ active,
+ disabled,
+ onClick,
+ tone,
+}: {
+ icon: LucideIcon;
+ label: string;
+ active?: boolean;
+ disabled?: boolean;
+ onClick?: () => void;
+ tone?: 'run';
+}) {
+ return (
+ <button
+ type="button"
+ className={`tbtn${active ? ' is-active' : ''}${tone ? ` tbtn--${tone}` : ''}`}
+ title={label}
+ aria-label={label}
+ aria-pressed={active}
+ disabled={disabled}
+ onClick={onClick}
+ >
+ <Icon size={16} strokeWidth={1.85} />
+ </button>
+ );
+}
+
+export function Toolbar() {
+ const {
+ tool,
+ setTool,
+ snapping,
+ toggleSnapping,
+ showGrid,
+ toggleGrid,
+ isPlaying,
+ isPaused,
+ togglePlay,
+ togglePause,
+ stop,
+ } = useEditorStore();
+
+ // Re-render on history changes to refresh undo/redo enabled state + labels.
+ useSyncExternalStore(EditorHistory.subscribe, EditorHistory.getVersion);
+ const undoLabel = EditorHistory.undoLabel();
+ const redoLabel = EditorHistory.redoLabel();
+
+ return (
+ <div className="toolbar">
+ <div className="toolbar__group">
+ <TBtn icon={Save} label="Save Scene ⌘S" />
+ </div>
+
+ <span className="toolbar__div" />
+
+ <div className="toolbar__group">
+ <TBtn
+ icon={Undo2}
+ label={undoLabel ? `Undo ${undoLabel} ⌘Z` : 'Undo ⌘Z'}
+ disabled={!EditorHistory.canUndo()}
+ onClick={() => EditorHistory.undo()}
+ />
+ <TBtn
+ icon={Redo2}
+ label={redoLabel ? `Redo ${redoLabel} ⇧⌘Z` : 'Redo ⇧⌘Z'}
+ disabled={!EditorHistory.canRedo()}
+ onClick={() => EditorHistory.redo()}
+ />
+ </div>
+
+ <span className="toolbar__div" />
+
+ <div className="toolbar__group" role="radiogroup" aria-label="Transform tool">
+ {TOOLS.map((t) => (
+ <TBtn
+ key={t.mode}
+ icon={t.icon}
+ label={`${t.label} (${t.key})`}
+ active={tool === t.mode}
+ onClick={() => setTool(t.mode)}
+ />
+ ))}
+ </div>
+
+ <span className="toolbar__div" />
+
+ <div className="toolbar__group">
+ <TBtn icon={Magnet} label="Snapping" active={snapping} onClick={toggleSnapping} />
+ <TBtn icon={Grid3x3} label="Show Grid" active={showGrid} onClick={toggleGrid} />
+ </div>
+
+ {/* Play controls sit dead-center — the focal action, like UE5. */}
+ <div className="toolbar__center">
+ <div className="playbar">
+ <TBtn
+ icon={Play}
+ label={isPlaying ? 'Restart' : 'Play (F5)'}
+ tone="run"
+ active={isPlaying}
+ onClick={togglePlay}
+ />
+ <TBtn icon={Pause} label="Pause" active={isPaused} onClick={togglePause} />
+ <TBtn icon={Stop} label="Stop" onClick={stop} />
+ </div>
+ </div>
+
+ <div className="toolbar__group toolbar__right">
+ <TBtn icon={Eye} label="View Options" />
+ <button type="button" className="chip" title="Build target">
+ <Smartphone size={13} strokeWidth={1.85} />
+ <span>Web</span>
+ </button>
+ <button type="button" className="chip chip--accent" title="Build project">
+ <Hammer size={13} strokeWidth={1.85} />
+ <span>Build</span>
+ </button>
+ </div>
+ </div>
+ );
+}
diff --git a/desktop/src/main.tsx b/desktop/src/main.tsx
new file mode 100644
index 000000000..05be5cdbb
--- /dev/null
+++ b/desktop/src/main.tsx
@@ -0,0 +1,24 @@
+import { StrictMode } from 'react';
+import { createRoot } from 'react-dom/client';
+
+// Web fonts bundled locally so the editor renders identically offline.
+import '@fontsource/inter/400.css';
+import '@fontsource/inter/500.css';
+import '@fontsource/inter/600.css';
+import '@fontsource/jetbrains-mono/400.css';
+import '@fontsource/jetbrains-mono/500.css';
+
+import './theme/tokens.css';
+import './theme/global.css';
+// dockview base styles first, then our override layer on top of them.
+import 'dockview/dist/styles/dockview.css';
+import './theme/dockview-theme.css';
+import './theme/app.css';
+import './theme/launcher.css';
+import { App } from './App';
+
+createRoot(document.getElementById('root')!).render(
+ <StrictMode>
+ <App />
+ </StrictMode>,
+);
diff --git a/desktop/src/mock/sceneData.ts b/desktop/src/mock/sceneData.ts
new file mode 100644
index 000000000..e66617612
--- /dev/null
+++ b/desktop/src/mock/sceneData.ts
@@ -0,0 +1,32 @@
+import type { AssetItem, LogEntry } from '@/types';
+
+// Placeholder content for panels not yet wired to live data (Content Browser,
+// Output Log). The scene tree and inspector now read the real engine — see
+// EngineHost.readSceneTree / readInspector.
+
+export const MOCK_ASSETS: AssetItem[] = [
+ { id: 'a1', name: 'scenes', type: 'folder' },
+ { id: 'a2', name: 'sprites', type: 'folder' },
+ { id: 'a3', name: 'audio', type: 'folder' },
+ { id: 'a4', name: 'scripts', type: 'folder' },
+ { id: 'a5', name: 'Level_01', type: 'scene' },
+ { id: 'a6', name: 'hero', type: 'spine' },
+ { id: 'a7', name: 'slime', type: 'sprite' },
+ { id: 'a8', name: 'tileset', type: 'texture' },
+ { id: 'a9', name: 'jump', type: 'audio' },
+ { id: 'a10', name: 'Coin', type: 'prefab' },
+ { id: 'a11', name: 'water', type: 'material' },
+ { id: 'a12', name: 'PlayerController', type: 'script' },
+ { id: 'a13', name: 'Bullet', type: 'prefab' },
+ { id: 'a14', name: 'explosion', type: 'texture' },
+];
+
+export const MOCK_LOG: LogEntry[] = [
+ { id: 1, level: 'info', time: '12:04:01', source: 'Engine', message: 'esengine.wasm instantiated (1.34 MB) in 38ms' },
+ { id: 2, level: 'info', time: '12:04:01', source: 'Assets', message: 'Loaded project "platformer" — 14 assets indexed' },
+ { id: 3, level: 'success', time: '12:04:02', source: 'Scene', message: 'Opened Level_01.scene — 15 entities, 38 components' },
+ { id: 4, level: 'warn', time: '12:04:05', source: 'Spine', message: 'Player: animation "dash" referenced but not found in skeleton' },
+ { id: 5, level: 'info', time: '12:04:06', source: 'Physics', message: 'Box2D world stepped at fixed 60Hz' },
+ { id: 6, level: 'error', time: '12:04:09', source: 'Script', message: 'PlayerController.ts:42 — Cannot read "velocity" of undefined' },
+ { id: 7, level: 'info', time: '12:04:12', source: 'Render', message: 'Draw calls: 23 · batches: 6 · triangles: 4.1k' },
+];
diff --git a/desktop/src/panels/ContentBrowser.tsx b/desktop/src/panels/ContentBrowser.tsx
new file mode 100644
index 000000000..31c76c79c
--- /dev/null
+++ b/desktop/src/panels/ContentBrowser.tsx
@@ -0,0 +1,68 @@
+import { useState } from 'react';
+import { ChevronRight, Search, Plus, LayoutGrid, Import } from 'lucide-react';
+import { MOCK_ASSETS } from '@/mock/sceneData';
+import { AssetIcon } from '@/components/icons';
+
+const FOLDERS = ['Content', 'scenes', 'sprites', 'audio', 'scripts', 'prefabs'];
+
+export function ContentBrowser() {
+ const [active, setActive] = useState('Content');
+
+ return (
+ <div className="panel content">
+ <div className="panel__toolbar">
+ <button type="button" className="btn-soft">
+ <Import size={13} strokeWidth={1.85} /> Import
+ </button>
+ <button type="button" className="btn-soft">
+ <Plus size={13} strokeWidth={1.85} /> Add
+ </button>
+ <div className="searchbox searchbox--grow">
+ <Search size={13} strokeWidth={1.85} />
+ <input className="searchbox__input" placeholder="Search assets" spellCheck={false} />
+ </div>
+ <button type="button" className="iconbtn" title="View options">
+ <LayoutGrid size={15} strokeWidth={1.85} />
+ </button>
+ </div>
+
+ <div className="content__split">
+ {/* Source tree */}
+ <div className="content__tree">
+ {FOLDERS.map((f, i) => (
+ <div
+ key={f}
+ className={`content__folder${active === f ? ' is-active' : ''}`}
+ style={{ paddingLeft: (i === 0 ? 0 : 14) + 8 }}
+ onClick={() => setActive(f)}
+ >
+ <ChevronRight
+ size={12}
+ strokeWidth={2}
+ className={`content__folder-twist${i === 0 ? ' is-open' : ''}`}
+ style={{ opacity: i === 0 ? 1 : 0 }}
+ />
+ <AssetIcon type="folder" size={14} />
+ <span>{f}</span>
+ </div>
+ ))}
+ </div>
+
+ {/* Asset grid */}
+ <div className="content__grid">
+ {MOCK_ASSETS.map((a) => (
+ <button key={a.id} type="button" className="tile">
+ <span className="tile__thumb">
+ <AssetIcon type={a.type} />
+ </span>
+ <span className="tile__name">{a.name}</span>
+ <span className="tile__type">{a.type}</span>
+ </button>
+ ))}
+ </div>
+ </div>
+
+ <div className="content__path mono">/Content · 14 items</div>
+ </div>
+ );
+}
diff --git a/desktop/src/panels/Details.tsx b/desktop/src/panels/Details.tsx
new file mode 100644
index 000000000..63472550c
--- /dev/null
+++ b/desktop/src/panels/Details.tsx
@@ -0,0 +1,287 @@
+import { useMemo, useState, useSyncExternalStore } from 'react';
+import { Box, ChevronDown, MoreHorizontal, Plus } from 'lucide-react';
+import { useEditorStore } from '@/store/editorStore';
+import { EngineHost } from '@/engine/EngineHost';
+import { SceneStore } from '@/engine/SceneStore';
+import { SceneQuery } from '@/engine/SceneQuery';
+import { SceneCommands } from '@/engine/SceneCommands';
+import type { InspectorComponent, InspectorField, EntityId } from '@/types';
+
+const AXES = ['x', 'y', 'z'];
+const fmt = (n: number) => String(Math.round(n * 1000) / 1000);
+
+// Each control reports gesture boundaries (onBegin/onEnd) so one focus→blur or
+// one click becomes a single undo step; onCommit applies the value live.
+interface ControlGesture {
+ onBegin?: () => void;
+ onEnd?: () => void;
+}
+
+function NumField({
+ value,
+ suffix,
+ onBegin,
+ onEnd,
+ onCommit,
+}: ControlGesture & { value: number; suffix?: string; onCommit: (n: number) => void }) {
+ const [editing, setEditing] = useState(false);
+ const [text, setText] = useState('');
+ return (
+ <span className="num-wrap">
+ <input
+ className="num num--solo"
+ value={editing ? text : fmt(value)}
+ spellCheck={false}
+ onFocus={() => {
+ setText(fmt(value));
+ setEditing(true);
+ onBegin?.();
+ }}
+ onBlur={() => {
+ setEditing(false);
+ onEnd?.();
+ }}
+ onChange={(e) => {
+ setText(e.target.value);
+ const n = parseFloat(e.target.value);
+ if (!Number.isNaN(n)) onCommit(n);
+ }}
+ />
+ {suffix && <span className="num__unit">{suffix}</span>}
+ </span>
+ );
+}
+
+function VecControl({
+ value,
+ onBegin,
+ onEnd,
+ onChange,
+}: ControlGesture & { value: number[]; onChange: (v: number[]) => void }) {
+ return (
+ <div className="vec">
+ {value.map((n, i) => (
+ <span key={i} className={`vec__axis vec__axis--${AXES[i]}`}>
+ {AXES[i].toUpperCase()}
+ <NumField
+ value={n}
+ onBegin={onBegin}
+ onEnd={onEnd}
+ onCommit={(v) => {
+ const next = value.slice();
+ next[i] = v;
+ onChange(next);
+ }}
+ />
+ </span>
+ ))}
+ </div>
+ );
+}
+
+function BoolControl({
+ value,
+ onBegin,
+ onEnd,
+ onChange,
+}: ControlGesture & { value: boolean; onChange: (v: boolean) => void }) {
+ return (
+ <button
+ type="button"
+ className={`switch${value ? ' is-on' : ''}`}
+ role="switch"
+ aria-checked={value}
+ onClick={() => {
+ onBegin?.();
+ onChange(!value);
+ onEnd?.();
+ }}
+ >
+ <span className="switch__thumb" />
+ </button>
+ );
+}
+
+function StringControl({
+ value,
+ onBegin,
+ onEnd,
+ onChange,
+}: ControlGesture & { value: string; onChange: (v: string) => void }) {
+ const [editing, setEditing] = useState(false);
+ const [text, setText] = useState('');
+ return (
+ <input
+ className="text-input"
+ value={editing ? text : value}
+ spellCheck={false}
+ onFocus={() => {
+ setText(value);
+ setEditing(true);
+ onBegin?.();
+ }}
+ onBlur={() => {
+ setEditing(false);
+ onEnd?.();
+ }}
+ onChange={(e) => {
+ setText(e.target.value);
+ onChange(e.target.value);
+ }}
+ />
+ );
+}
+
+function ColorControl({
+ value,
+ onBegin,
+ onEnd,
+ onChange,
+}: ControlGesture & { value: string; onChange: (v: string) => void }) {
+ return (
+ <span className="color">
+ <input
+ type="color"
+ className="color__picker"
+ value={value}
+ onFocus={onBegin}
+ onBlur={onEnd}
+ onChange={(e) => onChange(e.target.value)}
+ />
+ <span className="color__hex mono">{value}</span>
+ </span>
+ );
+}
+
+function FieldRow({
+ entity,
+ comp,
+ field,
+}: {
+ entity: EntityId;
+ comp: string;
+ field: InspectorField;
+}) {
+ // The gesture (focus→blur, or one click) coalesces into a single undo step;
+ // SceneCommands owns the before/after capture and recording.
+ const apply = (value: number | boolean | string | number[]) =>
+ SceneCommands.setField(entity, comp, field.key, field.type, value as never);
+ const begin = () => SceneCommands.beginGesture(`Edit ${field.label}`);
+ const end = () => SceneCommands.endGesture();
+
+ let control;
+ switch (field.type) {
+ case 'number':
+ control = <NumField value={field.value as number} onBegin={begin} onEnd={end} onCommit={apply} />;
+ break;
+ case 'angle':
+ control = (
+ <NumField value={field.value as number} suffix="°" onBegin={begin} onEnd={end} onCommit={apply} />
+ );
+ break;
+ case 'vec2':
+ case 'vec3':
+ control = (
+ <VecControl value={field.value as number[]} onBegin={begin} onEnd={end} onChange={apply} />
+ );
+ break;
+ case 'bool':
+ control = (
+ <BoolControl value={field.value as boolean} onBegin={begin} onEnd={end} onChange={apply} />
+ );
+ break;
+ case 'color':
+ control = (
+ <ColorControl value={field.value as string} onBegin={begin} onEnd={end} onChange={apply} />
+ );
+ break;
+ default:
+ control = (
+ <StringControl value={String(field.value)} onBegin={begin} onEnd={end} onChange={apply} />
+ );
+ }
+
+ return (
+ <label className="field">
+ <span className="field__label">{field.label}</span>
+ <span className="field__control">{control}</span>
+ </label>
+ );
+}
+
+function ComponentSection({ entity, comp }: { entity: EntityId; comp: InspectorComponent }) {
+ return (
+ <section className="cblock">
+ <header className="cblock__head">
+ <ChevronDown size={13} strokeWidth={2} className="cblock__twist" />
+ <input
+ type="checkbox"
+ className="cblock__enable"
+ defaultChecked
+ onClick={(e) => e.stopPropagation()}
+ />
+ <span className="cblock__name">{comp.label}</span>
+ <button type="button" className="cblock__more" title="Component options">
+ <MoreHorizontal size={15} strokeWidth={2} />
+ </button>
+ </header>
+ <div className="cblock__fields">
+ {comp.fields.map((f) => (
+ <FieldRow key={f.key} entity={entity} comp={comp.name} field={f} />
+ ))}
+ </div>
+ </section>
+ );
+}
+
+export function Details() {
+ const engine = useSyncExternalStore(EngineHost.subscribe, EngineHost.getSnapshot);
+ const revision = useSyncExternalStore(SceneStore.subscribe, SceneStore.getRevision);
+ const selectedId = useEditorStore((s) => s.selectedId);
+ const ready = engine.status === 'ready' && selectedId != null;
+
+ const entity = useMemo(
+ () => (ready ? SceneQuery.readEntity(selectedId!) : null),
+ [ready, selectedId, revision],
+ );
+ const components = useMemo(
+ () => (ready ? SceneQuery.readInspector(selectedId!) : []),
+ [ready, selectedId, revision],
+ );
+
+ if (!entity || selectedId == null) {
+ return (
+ <div className="panel">
+ <div className="empty">
+ <Box size={26} strokeWidth={1.4} />
+ <p>Select an entity to inspect its components.</p>
+ </div>
+ </div>
+ );
+ }
+
+ return (
+ <div className="panel">
+ <div className="inspector-head">
+ <input
+ key={selectedId}
+ className="inspector-head__name"
+ defaultValue={entity.name}
+ spellCheck={false}
+ onBlur={(e) => SceneCommands.renameEntity(selectedId, e.target.value)}
+ />
+ <span className="inspector-head__id mono">#{selectedId}</span>
+ </div>
+
+ <div className="panel__body">
+ {components.map((comp) => (
+ <ComponentSection key={comp.name} entity={selectedId} comp={comp} />
+ ))}
+
+ <button type="button" className="add-component">
+ <Plus size={15} strokeWidth={2} /> Add Component
+ </button>
+ </div>
+ </div>
+ );
+}
diff --git a/desktop/src/panels/Outliner.tsx b/desktop/src/panels/Outliner.tsx
new file mode 100644
index 000000000..c7e691e21
--- /dev/null
+++ b/desktop/src/panels/Outliner.tsx
@@ -0,0 +1,125 @@
+import { useEffect, useMemo, useRef, useSyncExternalStore } from 'react';
+import { ChevronRight, Eye, EyeOff, Lock, Search, Plus } from 'lucide-react';
+import { useEditorStore } from '@/store/editorStore';
+import { EngineHost } from '@/engine/EngineHost';
+import { SceneStore } from '@/engine/SceneStore';
+import { SceneQuery } from '@/engine/SceneQuery';
+import { SceneCommands } from '@/engine/SceneCommands';
+import { NodeIcon } from '@/components/icons';
+import type { SceneNode, EntityId } from '@/types';
+
+function Row({ node, depth }: { node: SceneNode; depth: number }) {
+ const selectedId = useEditorStore((s) => s.selectedId);
+ const select = useEditorStore((s) => s.select);
+ const expanded = useEditorStore((s) => s.expanded);
+ const toggleExpanded = useEditorStore((s) => s.toggleExpanded);
+
+ const hasChildren = !!node.children?.length;
+ const isOpen = expanded.has(node.id);
+ const isSelected = selectedId === node.id;
+
+ return (
+ <>
+ <div
+ className={`tree-row${isSelected ? ' is-selected' : ''}${node.visible ? '' : ' is-hidden'}`}
+ style={{ paddingLeft: depth * 14 + 6 }}
+ onClick={() => select(node.id)}
+ >
+ <button
+ type="button"
+ className={`tree-row__twist${hasChildren ? '' : ' is-leaf'}${isOpen ? ' is-open' : ''}`}
+ onClick={(e) => {
+ e.stopPropagation();
+ if (hasChildren) toggleExpanded(node.id);
+ }}
+ >
+ {hasChildren && <ChevronRight size={12} strokeWidth={2} />}
+ </button>
+
+ <span className={`tree-row__icon tree-row__icon--${node.kind}`}>
+ <NodeIcon kind={node.kind} />
+ </span>
+
+ <span className="tree-row__name">{node.name}</span>
+
+ <span className="tree-row__actions">
+ {node.locked && <Lock size={12} strokeWidth={1.85} className="tree-row__lock" />}
+ <button type="button" className="tree-row__vis" title="Toggle visibility">
+ {node.visible ? (
+ <Eye size={13} strokeWidth={1.85} />
+ ) : (
+ <EyeOff size={13} strokeWidth={1.85} />
+ )}
+ </button>
+ </span>
+ </div>
+
+ {hasChildren &&
+ isOpen &&
+ node.children!.map((child) => <Row key={child.id} node={child} depth={depth + 1} />)}
+ </>
+ );
+}
+
+export function Outliner() {
+ const engine = useSyncExternalStore(EngineHost.subscribe, EngineHost.getSnapshot);
+ // Rebuild the tree only when the engine pushes a structural change.
+ const structRev = useSyncExternalStore(SceneStore.subscribe, SceneStore.getStructureRevision);
+ const initRef = useRef(false);
+
+ const tree = useMemo(
+ () => (engine.status === 'ready' ? SceneQuery.readSceneTree() : []),
+ [engine.status, structRev],
+ );
+
+ // First time entities appear: expand groups, select the first root.
+ useEffect(() => {
+ if (initRef.current || tree.length === 0) return;
+ initRef.current = true;
+ const parents: EntityId[] = [];
+ const walk = (nodes: SceneNode[]) =>
+ nodes.forEach((n) => {
+ if (n.children?.length) {
+ parents.push(n.id);
+ walk(n.children);
+ }
+ });
+ walk(tree);
+ useEditorStore.getState().setExpanded(parents);
+ if (useEditorStore.getState().selectedId == null) {
+ useEditorStore.getState().select(tree[0].id);
+ }
+ }, [tree]);
+
+ return (
+ <div className="panel">
+ <div className="panel__toolbar">
+ <div className="searchbox">
+ <Search size={13} strokeWidth={1.85} />
+ <input className="searchbox__input" placeholder="Search entities" spellCheck={false} />
+ </div>
+ <button
+ type="button"
+ className="iconbtn"
+ title="Add entity"
+ onClick={() => {
+ const id = SceneCommands.addEntity();
+ if (id != null) useEditorStore.getState().select(id);
+ }}
+ >
+ <Plus size={15} strokeWidth={2} />
+ </button>
+ </div>
+ <div className="panel__body tree">
+ {tree.length === 0 ? (
+ <div className="empty">
+ <Search size={22} strokeWidth={1.4} />
+ <p>{engine.status === 'ready' ? 'No entities in scene.' : 'Waiting for engine…'}</p>
+ </div>
+ ) : (
+ tree.map((node) => <Row key={node.id} node={node} depth={0} />)
+ )}
+ </div>
+ </div>
+ );
+}
diff --git a/desktop/src/panels/OutputLog.tsx b/desktop/src/panels/OutputLog.tsx
new file mode 100644
index 000000000..4e87b1f9d
--- /dev/null
+++ b/desktop/src/panels/OutputLog.tsx
@@ -0,0 +1,32 @@
+import { Trash2, Filter, ArrowDownToLine } from 'lucide-react';
+import { MOCK_LOG } from '@/mock/sceneData';
+
+export function OutputLog() {
+ return (
+ <div className="panel log">
+ <div className="panel__toolbar">
+ <div className="log__filters">
+ <button type="button" className="pill is-active">All</button>
+ <button type="button" className="pill"><i className="dot dot--info" />Info</button>
+ <button type="button" className="pill"><i className="dot dot--warn" />Warnings</button>
+ <button type="button" className="pill"><i className="dot dot--error" />Errors</button>
+ </div>
+ <div className="log__tools">
+ <button type="button" className="iconbtn" title="Filter source"><Filter size={14} strokeWidth={1.85} /></button>
+ <button type="button" className="iconbtn" title="Scroll to bottom"><ArrowDownToLine size={14} strokeWidth={1.85} /></button>
+ <button type="button" className="iconbtn" title="Clear log"><Trash2 size={14} strokeWidth={1.85} /></button>
+ </div>
+ </div>
+
+ <div className="panel__body log__body mono">
+ {MOCK_LOG.map((e) => (
+ <div key={e.id} className={`logline logline--${e.level}`}>
+ <span className="logline__time">{e.time}</span>
+ <span className="logline__source">{e.source}</span>
+ <span className="logline__msg">{e.message}</span>
+ </div>
+ ))}
+ </div>
+ </div>
+ );
+}
diff --git a/desktop/src/panels/Viewport.tsx b/desktop/src/panels/Viewport.tsx
new file mode 100644
index 000000000..fc67753f7
--- /dev/null
+++ b/desktop/src/panels/Viewport.tsx
@@ -0,0 +1,194 @@
+import { useEffect, useRef, useSyncExternalStore } from 'react';
+import type { PointerEvent as ReactPointerEvent } from 'react';
+import { Video, Maximize, Sun, Layers, Frame, Loader2, TriangleAlert } from 'lucide-react';
+import { useEditorStore } from '@/store/editorStore';
+import { EngineHost } from '@/engine/EngineHost';
+import { ViewportController } from '@/engine/ViewportController';
+import { SceneCommands } from '@/engine/SceneCommands';
+import { StatsStore } from '@/engine/StatsStore';
+import type { ToolMode } from '@/types';
+
+// Visual manipulation glyph, centered on the selected entity. Functionally we
+// only translate (drag-to-move) for now; the glyph reflects the active tool.
+function GizmoGlyph({ tool }: { tool: ToolMode }) {
+ if (tool === 'rotate') {
+ return (
+ <svg width="92" height="92" viewBox="0 0 92 92">
+ <circle cx="46" cy="46" r="34" fill="none" stroke="var(--run)" strokeWidth="2" />
+ <circle cx="46" cy="12" r="4" fill="var(--run)" />
+ </svg>
+ );
+ }
+ if (tool === 'scale') {
+ return (
+ <svg width="92" height="92" viewBox="0 0 92 92">
+ <line x1="46" y1="46" x2="80" y2="46" stroke="var(--error)" strokeWidth="2.5" />
+ <rect x="77" y="42" width="8" height="8" fill="var(--error)" />
+ <line x1="46" y1="46" x2="46" y2="12" stroke="var(--run)" strokeWidth="2.5" />
+ <rect x="42" y="9" width="8" height="8" fill="var(--run)" />
+ <rect x="41" y="41" width="10" height="10" fill="var(--star)" />
+ </svg>
+ );
+ }
+ if (tool === 'select') {
+ return (
+ <svg width="92" height="92" viewBox="0 0 92 92">
+ <rect x="16" y="16" width="60" height="60" fill="none" stroke="var(--star)" strokeWidth="1.5" strokeDasharray="4 3" />
+ {[[16, 16], [76, 16], [16, 76], [76, 76]].map(([x, y]) => (
+ <rect key={`${x}-${y}`} x={x - 3} y={y - 3} width="6" height="6" fill="var(--star)" />
+ ))}
+ </svg>
+ );
+ }
+ return (
+ <svg width="92" height="92" viewBox="0 0 92 92">
+ <line x1="46" y1="46" x2="82" y2="46" stroke="var(--error)" strokeWidth="2.5" />
+ <path d="M82 46 L74 42 L74 50 Z" fill="var(--error)" />
+ <line x1="46" y1="46" x2="46" y2="10" stroke="var(--run)" strokeWidth="2.5" />
+ <path d="M46 10 L42 18 L50 18 Z" fill="var(--run)" />
+ <rect x="41" y="41" width="10" height="10" fill="var(--star)" opacity="0.9" />
+ </svg>
+ );
+}
+
+export function Viewport() {
+ const isPlaying = useEditorStore((s) => s.isPlaying);
+ const tool = useEditorStore((s) => s.tool);
+ const stageRef = useRef<HTMLDivElement>(null);
+ const gizmoRef = useRef<HTMLDivElement>(null);
+ const selectionRef = useRef<HTMLDivElement>(null);
+ const dragRef = useRef<{ id: number; dx: number; dy: number } | null>(null);
+ const engine = useSyncExternalStore(EngineHost.subscribe, EngineHost.getSnapshot);
+
+ // Mount the live engine canvas into the stage; it survives panel re-docking.
+ useEffect(() => {
+ const stage = stageRef.current;
+ if (!stage) return;
+ EngineHost.attach(stage);
+ StatsStore.start();
+ return () => EngineHost.detach();
+ }, []);
+
+ // Glue the gizmo to the selected entity's screen position, every frame.
+ useEffect(() => {
+ let raf = 0;
+ const tick = () => {
+ raf = requestAnimationFrame(tick);
+ const g = gizmoRef.current;
+ const sel = selectionRef.current;
+ if (!g || !sel) return;
+ const id = useEditorStore.getState().selectedId;
+ const ready = EngineHost.getSnapshot().status === 'ready';
+
+ const pos = ready && id != null ? ViewportController.getEntityXY(id) : null;
+ const sc = pos ? ViewportController.worldToClient(pos.x, pos.y) : null;
+ if (sc) {
+ g.style.transform = `translate(${sc.x}px, ${sc.y}px)`;
+ g.style.opacity = '1';
+ } else {
+ g.style.opacity = '0';
+ }
+
+ const rect = ready && id != null ? ViewportController.getEntityScreenRect(id) : null;
+ if (rect) {
+ sel.style.transform = `translate(${rect.x}px, ${rect.y}px)`;
+ sel.style.width = `${rect.w}px`;
+ sel.style.height = `${rect.h}px`;
+ sel.style.opacity = '1';
+ } else {
+ sel.style.opacity = '0';
+ }
+ };
+ raf = requestAnimationFrame(tick);
+ return () => cancelAnimationFrame(raf);
+ }, []);
+
+ const onPointerDown = (e: ReactPointerEvent) => {
+ if (engine.status !== 'ready' || e.button !== 0) return;
+ const id = ViewportController.pickEntity(e.clientX, e.clientY);
+ useEditorStore.getState().select(id);
+ if (id != null) {
+ const wp = ViewportController.canvasToWorld(e.clientX, e.clientY);
+ const ep = ViewportController.getEntityXY(id);
+ if (wp && ep) {
+ // Open one gesture for the whole drag; SceneCommands records it on end.
+ SceneCommands.beginGesture('Move');
+ dragRef.current = { id, dx: ep.x - wp.x, dy: ep.y - wp.y };
+ stageRef.current?.setPointerCapture(e.pointerId);
+ }
+ }
+ };
+
+ const onPointerMove = (e: ReactPointerEvent) => {
+ const wp = ViewportController.canvasToWorld(e.clientX, e.clientY);
+ if (wp) StatsStore.setCursor(wp.x, wp.y);
+ const drag = dragRef.current;
+ if (drag && wp) SceneCommands.setEntityXY(drag.id, wp.x + drag.dx, wp.y + drag.dy);
+ };
+
+ const endDrag = (e: ReactPointerEvent) => {
+ const drag = dragRef.current;
+ if (!drag) return;
+ stageRef.current?.releasePointerCapture(e.pointerId);
+ dragRef.current = null;
+ // Close the gesture: SceneCommands records the whole drag as one undo step
+ // (a no-op if the pointer never moved the entity).
+ SceneCommands.endGesture();
+ };
+
+ return (
+ <div className="viewport">
+ <div className="viewport__overlay viewport__overlay--tl">
+ <button type="button" className="vchip"><Video size={13} strokeWidth={1.85} /> Perspective: 2D</button>
+ <button type="button" className="vchip"><Sun size={13} strokeWidth={1.85} /> Lit</button>
+ <button type="button" className="vchip"><Layers size={13} strokeWidth={1.85} /> Show</button>
+ </div>
+
+ <div className="viewport__overlay viewport__overlay--tr">
+ <button type="button" className="vchip vchip--icon" title="Camera bookmarks"><Frame size={14} strokeWidth={1.85} /></button>
+ <button type="button" className="vchip vchip--icon" title="Maximize"><Maximize size={14} strokeWidth={1.85} /></button>
+ </div>
+
+ {/* The engine canvas mounts here; pointer events drive pick + drag-move. */}
+ <div
+ ref={stageRef}
+ className="viewport__stage"
+ data-engine="esengine.wasm"
+ onPointerDown={onPointerDown}
+ onPointerMove={onPointerMove}
+ onPointerUp={endDrag}
+ onPointerCancel={endDrag}
+ onPointerLeave={() => StatsStore.clearCursor()}
+ />
+
+ <div ref={selectionRef} className="viewport__selection" aria-hidden="true" />
+
+ <div ref={gizmoRef} className="viewport__gizmo" aria-hidden="true">
+ <GizmoGlyph tool={tool} />
+ </div>
+
+ {engine.status !== 'ready' && (
+ <div className="viewport__status">
+ {engine.status === 'error' ? (
+ <div className="viewport__status-card viewport__status-card--error">
+ <TriangleAlert size={22} strokeWidth={1.6} />
+ <div>
+ <strong>Engine failed to start</strong>
+ <p className="mono">{engine.error}</p>
+ </div>
+ </div>
+ ) : (
+ <div className="viewport__status-card">
+ <Loader2 size={20} strokeWidth={2} className="spin" />
+ <span>Booting esengine…</span>
+ </div>
+ )}
+ </div>
+ )}
+
+ <div className="viewport__overlay viewport__overlay--bl mono">1920 × 1080 · 100%</div>
+
+ {isPlaying && <div className="viewport__playflag">● PLAY</div>}
+ </div>
+ );
+}
diff --git a/desktop/src/project/ProjectStore.ts b/desktop/src/project/ProjectStore.ts
new file mode 100644
index 000000000..b9aeb9394
--- /dev/null
+++ b/desktop/src/project/ProjectStore.ts
@@ -0,0 +1,308 @@
+import { resetWorldTo, serializeScene, getComponent, getComponentAssetFields, Assets } from 'esengine';
+import type { SceneData } from 'esengine';
+import { EngineHost } from '@/engine/EngineHost';
+import { resolveLayout, type OpenedProject, type ProjectLayout, type WorkspaceState } from './format';
+
+/**
+ * Editor-side project/workspace model (RC12 §E7-3 / §E6-1).
+ *
+ * Wraps the Electron `window.estella.{project,fs}` bridge: opens a project
+ * directory, loads its scene into the live engine World via `resetWorldTo`, and
+ * saves back. The bridge sandboxes every fs path to the open project root.
+ *
+ * Texture `@uuid:` refs resolve through the `estella://` custom protocol
+ * (electron/main) which serves the project's files — so project textures
+ * actually render. On save, texture handles are mapped back to `@uuid:` using
+ * each component's asset fields, keeping saved scenes portable.
+ */
+
+const UUID_PREFIX = '@uuid:';
+
+interface AssetsLike {
+ loadTexture(ref: string): Promise<{ handle: number }>;
+}
+
+interface ProjectState {
+ root: string;
+ name: string;
+ layout: ProjectLayout;
+ workspace: WorkspaceState;
+ /** Entry scene from the manifest (project-relative); the editor opens it. */
+ defaultScene?: string;
+ /** The scene currently loaded into the world (project-relative path). */
+ currentScene: string | null;
+ /**
+ * True if the loaded scene carried component types this editor's engine has
+ * not registered (its `src/` code isn't loaded) — they were dropped on load,
+ * so overwriting the source file would lose them. Blocks overwrite-save until
+ * project code loading lands; Save-As to a new file stays available.
+ */
+ lossy: boolean;
+}
+
+/** Component types in `data` that the engine doesn't know — dropped on load. */
+function unknownComponentTypes(data: SceneData): string[] {
+ const unknown = new Set<string>();
+ for (const entity of data.entities ?? []) {
+ for (const comp of entity.components ?? []) {
+ if (!getComponent(comp.type)) unknown.add(comp.type);
+ }
+ }
+ return [...unknown];
+}
+
+/** Collect every `@uuid:<id>` referenced anywhere in the scene. */
+function collectUuids(value: unknown, into: Set<string>): void {
+ if (typeof value === 'string') {
+ if (value.startsWith(UUID_PREFIX)) into.add(value.slice(UUID_PREFIX.length));
+ return;
+ }
+ if (Array.isArray(value)) {
+ for (const v of value) collectUuids(v, into);
+ return;
+ }
+ if (value && typeof value === 'object') {
+ for (const v of Object.values(value as Record<string, unknown>)) collectUuids(v, into);
+ }
+}
+
+/** Replace `@uuid:<id>` refs with a resolved asset handle (or 0 if unresolved). */
+function mapAssetRefs(value: unknown, resolve: (uuid: string) => number): unknown {
+ if (typeof value === 'string') {
+ return value.startsWith(UUID_PREFIX) ? resolve(value.slice(UUID_PREFIX.length)) : value;
+ }
+ if (Array.isArray(value)) return value.map((v) => mapAssetRefs(v, resolve));
+ if (value && typeof value === 'object') {
+ const out: Record<string, unknown> = {};
+ for (const [k, v] of Object.entries(value as Record<string, unknown>)) out[k] = mapAssetRefs(v, resolve);
+ return out;
+ }
+ return value;
+}
+
+class ProjectStoreImpl {
+ private state: ProjectState | null = null;
+ private readonly listeners = new Set<() => void>();
+ /** Texture GL handle → asset uuid for the loaded scene; reverses refs on save. */
+ private handleToUuid = new Map<number, string>();
+
+ subscribe = (fn: () => void): (() => void) => {
+ this.listeners.add(fn);
+ return () => this.listeners.delete(fn);
+ };
+ getSnapshot = (): ProjectState | null => this.state;
+
+ private emit() {
+ for (const l of this.listeners) l();
+ }
+
+ /** Show the OS folder picker and open the chosen project. */
+ async openViaDialog(): Promise<boolean> {
+ const bridge = window.estella;
+ if (!bridge?.project) {
+ console.warn('[project] fs bridge unavailable (not running under Electron)');
+ return false;
+ }
+ const opened = await bridge.project.openDialog();
+ if (!opened) return false;
+ await this.adopted(opened);
+ return true;
+ }
+
+ /** Open a project by absolute root path (e.g. a recent / dev default). */
+ async open(root: string): Promise<boolean> {
+ const bridge = window.estella;
+ if (!bridge?.project) return false;
+ await this.adopted(await bridge.project.open(root));
+ return true;
+ }
+
+ /** Create a project from a template at `<location>/<name>`, then open it. */
+ async createAndOpen(templateDir: string, location: string, name: string): Promise<boolean> {
+ const bridge = window.estella;
+ if (!bridge?.project?.createFromTemplate) return false;
+ const root = await bridge.project.createFromTemplate(templateDir, location, name);
+ return this.open(root);
+ }
+
+ /**
+ * Adopt an opened project: remember it, and arrange for its scene to load.
+ * The engine usually isn't booted yet (we're still on the launcher), so the
+ * scene loads via EngineHost's boot bootstrap; if the engine is already
+ * running (re-opening from the editor), load immediately.
+ */
+ private async adopted(opened: OpenedProject): Promise<void> {
+ this.adopt(opened);
+ await window.estella.recents.add(opened.root, opened.manifest.name);
+ EngineHost.setSceneBootstrap(() => this.loadCurrentScene());
+ if (EngineHost.app?.world) await this.loadCurrentScene();
+ }
+
+ private adopt(opened: OpenedProject) {
+ this.state = {
+ root: opened.root,
+ name: opened.manifest.name,
+ layout: resolveLayout(opened.manifest),
+ workspace: opened.workspace,
+ defaultScene: opened.manifest.defaultScene,
+ currentScene: null,
+ lossy: false,
+ };
+ this.emit();
+ }
+
+ /** Read + parse a project-relative `.esscene` (raw — refs unresolved). */
+ async readScene(relPath: string): Promise<SceneData> {
+ return JSON.parse(await window.estella.fs.read(relPath)) as SceneData;
+ }
+
+ /** Load the project's last-opened scene (or `<scenes>/main.esscene`) into the world. */
+ async loadCurrentScene(): Promise<void> {
+ const st = this.state;
+ if (!st) return;
+ const rel =
+ st.workspace.lastOpenedScene ?? st.defaultScene ?? `${st.layout.scenes}/main.esscene`;
+ const raw = await this.readScene(rel);
+ const dropped = unknownComponentTypes(raw);
+ if (dropped.length > 0) {
+ console.warn(
+ `[project] scene "${rel}" uses components this editor hasn't loaded ` +
+ `(${dropped.join(', ')}); they are dropped on load — overwrite-save is ` +
+ `blocked until project code loading lands. Use Save As.`,
+ );
+ }
+ const data = await this.resolveTextures(raw);
+ const world = EngineHost.app?.world;
+ if (world) resetWorldTo(world, data);
+ this.state = { ...st, currentScene: rel, lossy: dropped.length > 0 };
+ this.emit();
+ }
+
+ /**
+ * Resolve the scene's `@uuid:` texture refs to live GL handles by loading the
+ * files through the `estella://` protocol; records handle→uuid for save.
+ * Unresolved refs blank to 0 (solid color). Textures only — material/font
+ * refs aren't served yet.
+ */
+ private async resolveTextures(raw: SceneData): Promise<SceneData> {
+ const st = this.state;
+ const bridge = window.estella;
+ this.handleToUuid = new Map();
+ if (!st) return raw;
+
+ const referenced = new Set<string>();
+ collectUuids(raw, referenced);
+ if (referenced.size === 0) return raw;
+
+ // uuid → texture path, from the `.meta` sidecars in the textures dir.
+ const uuidToPath = new Map<string, string>();
+ try {
+ for (const entry of await bridge.fs.readDir(st.layout.textures)) {
+ if (entry.isDir || !entry.name.endsWith('.meta')) continue;
+ try {
+ const meta = JSON.parse(
+ await bridge.fs.read(`${st.layout.textures}/${entry.name}`),
+ ) as { uuid?: string };
+ if (meta.uuid && referenced.has(meta.uuid)) {
+ uuidToPath.set(meta.uuid, `${st.layout.textures}/${entry.name.replace(/\.meta$/, '')}`);
+ }
+ } catch {
+ // skip a malformed .meta
+ }
+ }
+ } catch {
+ // no textures dir — every ref blanks to 0
+ }
+
+ const assets = EngineHost.app?.getResource(Assets) as unknown as AssetsLike | undefined;
+ const uuidToHandle = new Map<string, number>();
+ if (assets) {
+ for (const [uuid, rel] of uuidToPath) {
+ try {
+ const { handle } = await assets.loadTexture(`estella://project/${rel}`);
+ uuidToHandle.set(uuid, handle);
+ this.handleToUuid.set(handle, uuid);
+ } catch (err) {
+ console.warn('[project] texture load failed', rel, err);
+ }
+ }
+ }
+ return mapAssetRefs(raw, (uuid) => uuidToHandle.get(uuid) ?? 0) as SceneData;
+ }
+
+ /** Serialize the live world; map texture handles back to `@uuid:` (portable). */
+ private serializeCurrent(): SceneData {
+ const world = EngineHost.app?.world;
+ if (!world) throw new Error('engine not ready');
+ return this.restoreAssetRefs(serializeScene(world, this.state?.name ?? 'scene'));
+ }
+
+ /** Replace texture-handle values in asset fields with their `@uuid:` refs. */
+ private restoreAssetRefs(data: SceneData): SceneData {
+ if (this.handleToUuid.size === 0) return data;
+ for (const entity of data.entities ?? []) {
+ for (const comp of entity.components ?? []) {
+ const cdata = comp.data as Record<string, unknown>;
+ for (const field of getComponentAssetFields(comp.type)) {
+ const v = cdata[field];
+ if (typeof v === 'number' && this.handleToUuid.has(v)) {
+ cdata[field] = `${UUID_PREFIX}${this.handleToUuid.get(v)}`;
+ }
+ }
+ }
+ }
+ return data;
+ }
+
+ private async writeScene(relPath: string, data: SceneData): Promise<void> {
+ await window.estella.fs.write(relPath, JSON.stringify(data, null, 2) + '\n');
+ }
+
+ private async persistLastScene(relPath: string): Promise<void> {
+ const st = this.state;
+ if (!st) return;
+ const workspace: WorkspaceState = { ...st.workspace, lastOpenedScene: relPath };
+ this.state = { ...st, workspace, currentScene: relPath };
+ this.emit();
+ await window.estella.workspace.save(workspace);
+ }
+
+ /**
+ * Overwrite the current scene file. Refuses when the load was lossy (would
+ * clobber components this editor dropped) — the caller should fall back to
+ * {@link saveAsViaDialog}.
+ */
+ async save(): Promise<void> {
+ const st = this.state;
+ if (!st || !st.currentScene) throw new Error('no scene to save');
+ if (st.lossy) {
+ throw new Error(
+ 'overwrite-save blocked: the scene has components this editor did not ' +
+ 'load (they would be lost). Use Save As to write a new file.',
+ );
+ }
+ await this.writeScene(st.currentScene, this.serializeCurrent());
+ await this.persistLastScene(st.currentScene);
+ }
+
+ /** Write the current world to a project-relative path (explicit, no lossy guard). */
+ async saveAs(relPath: string): Promise<void> {
+ if (!this.state) throw new Error('no project open');
+ await this.writeScene(relPath, this.serializeCurrent());
+ await this.persistLastScene(relPath);
+ }
+
+ /** Prompt for a destination (Save-As) and write there. Returns the path or null. */
+ async saveAsViaDialog(): Promise<string | null> {
+ const st = this.state;
+ if (!st || !window.estella.project.saveSceneDialog) return null;
+ const rel = await window.estella.project.saveSceneDialog(
+ st.currentScene ?? `${st.layout.scenes}/scene.esscene`,
+ );
+ if (!rel) return null;
+ await this.saveAs(rel);
+ return rel;
+ }
+}
+
+export const ProjectStore = new ProjectStoreImpl();
diff --git a/desktop/src/project/format.ts b/desktop/src/project/format.ts
new file mode 100644
index 000000000..19801c00b
--- /dev/null
+++ b/desktop/src/project/format.ts
@@ -0,0 +1,150 @@
+/**
+ * @file Project format — pure types + layout resolution.
+ *
+ * Shared by the Electron main process (which reads/writes the files) and the
+ * renderer (ProjectStore). Deliberately free of node/electron imports so both
+ * builds can consume it. See RC12 §E7.
+ *
+ * A project is a directory containing:
+ * project.esproject — committed identity/config (this manifest)
+ * .esengine/workspace.json — editor-local, transient state (gitignored)
+ * assets/scenes/*.esscene, assets/textures/* (+ .meta), src/ — by convention
+ *
+ * The committed manifest is the established `project.esproject` (which the build
+ * tooling already uses as the project marker); this consolidates the editor onto
+ * it, adding a manifest formatVersion + migration and moving editor-local state
+ * into workspace.json.
+ */
+
+export const PROJECT_FORMAT_VERSION = '1';
+export const PROJECT_MANIFEST_FILE = 'project.esproject';
+export const WORKSPACE_DIR = '.esengine';
+export const WORKSPACE_FILE = 'workspace.json';
+
+/** Resolved directory layout (relative to project root). */
+export interface ProjectLayout {
+ scenes: string;
+ textures: string;
+ src: string;
+}
+
+export const DEFAULT_LAYOUT: ProjectLayout = {
+ scenes: 'assets/scenes',
+ textures: 'assets/textures',
+ src: 'src',
+};
+
+/** Reference resolution the project is designed against (camera / UI scaling). */
+export interface DesignResolution {
+ width: number;
+ height: number;
+}
+
+/** Committed project identity + config (`project.esproject`). */
+export interface ProjectManifest {
+ /** Manifest schema version (migration-aware; rejects newer than supported). */
+ formatVersion: string;
+ name: string;
+ /** The project's own version (semver-ish), informational. */
+ version?: string;
+ /** Engine build the project targets (ties to E1's build id). */
+ engineBuildId?: string;
+ /** Entry scene, project-relative. The editor opens this unless workspace overrides. */
+ defaultScene?: string;
+ /** Design resolution for the viewport / camera. */
+ designResolution?: DesignResolution;
+ /** Spine runtime the project needs ('none' | '3.8' | '4.1' | '4.2' …). */
+ spineVersion?: string;
+ /** Per-path overrides of {@link DEFAULT_LAYOUT}. */
+ layout?: Partial<ProjectLayout>;
+ /** One-line summary, shown when the project is used as a New-project template. */
+ description?: string;
+ /** Short category label for the template gallery (e.g. "2D", "Physics"). */
+ tag?: string;
+}
+
+/** A New-project template (a project directory used as a starting point). */
+export interface TemplateEntry {
+ name: string;
+ dir: string;
+ description?: string;
+ tag?: string;
+ thumbnail?: string;
+}
+
+/** Editor-local, transient state (`.esengine/workspace.json`; gitignored). */
+export interface WorkspaceState {
+ lastOpenedScene?: string;
+ panelLayout?: unknown;
+}
+
+/** An opened project as returned over IPC (plain, structured-clone-safe). */
+export interface OpenedProject {
+ root: string;
+ manifest: ProjectManifest;
+ workspace: WorkspaceState;
+}
+
+/** A directory entry from a sandboxed readdir. */
+export interface DirEntry {
+ name: string;
+ isDir: boolean;
+}
+
+/** A recent project for the launcher (thumbnail is a data URL, if present). */
+export interface RecentEntry {
+ name: string;
+ root: string;
+ openedAt: number;
+ /** engineBuildId or version from the manifest, for the build badge. */
+ build?: string;
+ thumbnail?: string;
+}
+
+const versionNum = (v: string): number => {
+ const n = Number(v);
+ return Number.isFinite(n) ? n : 0;
+};
+
+/** Parse + validate a raw `project.esproject` value. Throws on malformed / too-new. */
+export function parseManifest(raw: unknown): ProjectManifest {
+ if (!raw || typeof raw !== 'object') {
+ throw new Error('project.esproject must be a JSON object');
+ }
+ const o = raw as Record<string, unknown>;
+ const formatVersion = typeof o.formatVersion === 'string' ? o.formatVersion : '1';
+ if (versionNum(formatVersion) > versionNum(PROJECT_FORMAT_VERSION)) {
+ throw new Error(
+ `project.esproject formatVersion "${formatVersion}" is newer than this editor ` +
+ `supports ("${PROJECT_FORMAT_VERSION}"); upgrade the editor.`,
+ );
+ }
+ if (typeof o.name !== 'string' || o.name === '') {
+ throw new Error('project.esproject must have a non-empty "name"');
+ }
+ const manifest: ProjectManifest = { formatVersion, name: o.name };
+ if (typeof o.version === 'string') manifest.version = o.version;
+ if (typeof o.engineBuildId === 'string') manifest.engineBuildId = o.engineBuildId;
+ if (typeof o.defaultScene === 'string') manifest.defaultScene = o.defaultScene;
+ if (typeof o.spineVersion === 'string') manifest.spineVersion = o.spineVersion;
+ const dr = o.designResolution as { width?: unknown; height?: unknown } | undefined;
+ if (dr && typeof dr.width === 'number' && typeof dr.height === 'number') {
+ manifest.designResolution = { width: dr.width, height: dr.height };
+ }
+ if (o.layout && typeof o.layout === 'object') {
+ manifest.layout = o.layout as Partial<ProjectLayout>;
+ }
+ if (typeof o.description === 'string') manifest.description = o.description;
+ if (typeof o.tag === 'string') manifest.tag = o.tag;
+ return manifest;
+}
+
+/** Effective layout = defaults overlaid with the manifest's overrides. */
+export function resolveLayout(manifest: Pick<ProjectManifest, 'layout'>): ProjectLayout {
+ return { ...DEFAULT_LAYOUT, ...(manifest.layout ?? {}) };
+}
+
+/** A fresh manifest for `new project`. */
+export function defaultManifest(name: string): ProjectManifest {
+ return { formatVersion: PROJECT_FORMAT_VERSION, name, defaultScene: 'assets/scenes/main.esscene' };
+}
diff --git a/desktop/src/store/editorStore.ts b/desktop/src/store/editorStore.ts
new file mode 100644
index 000000000..cb330ef36
--- /dev/null
+++ b/desktop/src/store/editorStore.ts
@@ -0,0 +1,75 @@
+import { create } from 'zustand';
+import type { EntityId, ToolMode } from '@/types';
+
+// Global editor state. Intentionally small for the static shell — it grows as
+// real selection/scene/asset operations are wired to the engine bridge.
+interface EditorState {
+ // Active manipulation tool (select / move / rotate / scale).
+ tool: ToolMode;
+ setTool: (tool: ToolMode) => void;
+
+ // Currently selected entity (drives Details panel + viewport gizmo).
+ selectedId: EntityId | null;
+ select: (id: EntityId | null) => void;
+
+ // Expanded nodes in the outliner tree.
+ expanded: Set<EntityId>;
+ toggleExpanded: (id: EntityId) => void;
+ setExpanded: (ids: EntityId[]) => void;
+
+ // Play-in-editor state.
+ isPlaying: boolean;
+ isPaused: boolean;
+ togglePlay: () => void;
+ togglePause: () => void;
+ stop: () => void;
+
+ // Launcher (project browser) vs editor shell. The editor opens on the
+ // launcher until a project is opened/created; `enterEditor` dismisses it.
+ showLauncher: boolean;
+ enterEditor: () => void;
+ openLauncher: () => void;
+
+ // Viewport overlays.
+ showGrid: boolean;
+ showGizmos: boolean;
+ snapping: boolean;
+ toggleGrid: () => void;
+ toggleGizmos: () => void;
+ toggleSnapping: () => void;
+}
+
+export const useEditorStore = create<EditorState>((set) => ({
+ tool: 'move',
+ setTool: (tool) => set({ tool }),
+
+ selectedId: null,
+ select: (selectedId) => set({ selectedId }),
+
+ expanded: new Set<EntityId>(),
+ toggleExpanded: (id) =>
+ set((s) => {
+ const next = new Set(s.expanded);
+ next.has(id) ? next.delete(id) : next.add(id);
+ return { expanded: next };
+ }),
+ setExpanded: (ids) => set({ expanded: new Set(ids) }),
+
+ isPlaying: false,
+ isPaused: false,
+ togglePlay: () =>
+ set((s) => ({ isPlaying: !s.isPlaying, isPaused: false })),
+ togglePause: () => set((s) => ({ isPaused: !s.isPaused })),
+ stop: () => set({ isPlaying: false, isPaused: false }),
+
+ showLauncher: true,
+ enterEditor: () => set({ showLauncher: false }),
+ openLauncher: () => set({ showLauncher: true }),
+
+ showGrid: true,
+ showGizmos: true,
+ snapping: false,
+ toggleGrid: () => set((s) => ({ showGrid: !s.showGrid })),
+ toggleGizmos: () => set((s) => ({ showGizmos: !s.showGizmos })),
+ toggleSnapping: () => set((s) => ({ snapping: !s.snapping })),
+}));
diff --git a/desktop/src/theme/app.css b/desktop/src/theme/app.css
new file mode 100644
index 000000000..8a836036f
--- /dev/null
+++ b/desktop/src/theme/app.css
@@ -0,0 +1,1149 @@
+/* =============================================================================
+ Estella Editor — shell + panel styling. Everything derives from tokens.css.
+ ========================================================================== */
+
+/* ----------------------------------------------------------------- shell --- */
+.shell {
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+ background: var(--base);
+}
+.shell__workspace {
+ flex: 1;
+ min-height: 0;
+ position: relative;
+}
+.shell__workspace .dv-dockview {
+ height: 100%;
+}
+
+/* --------------------------------------------------------------- menubar --- */
+.menubar {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ height: var(--h-titlebar);
+ padding: 0 12px 0 78px; /* leave room for macOS traffic lights */
+ background: var(--base);
+ border-bottom: 1px solid var(--line-soft);
+ -webkit-app-region: drag;
+ user-select: none;
+}
+.menubar__brand {
+ display: flex;
+ align-items: center;
+ gap: 7px;
+ padding-right: 10px;
+}
+.menubar__brand svg {
+ filter: drop-shadow(0 0 5px var(--star-line));
+}
+.menubar__title {
+ font-size: var(--fs-md);
+ font-weight: 600;
+ letter-spacing: 0.04em;
+ color: var(--text-hi);
+}
+.menubar__menus {
+ display: flex;
+ -webkit-app-region: no-drag;
+}
+.menubar__item {
+ padding: 4px 9px;
+ font-size: var(--fs-sm);
+ color: var(--text-dim);
+ border-radius: var(--r-xs);
+}
+.menubar__item:hover {
+ color: var(--text-hi);
+ background: var(--hover);
+}
+.menubar__project {
+ margin-left: auto;
+ display: flex;
+ align-items: center;
+ gap: 7px;
+ font-size: var(--fs-sm);
+ color: var(--text-faint);
+ -webkit-app-region: no-drag;
+}
+.menubar__project-name {
+ color: var(--text-dim);
+}
+.menubar__scene {
+ color: var(--text);
+ font-size: var(--fs-xs);
+}
+
+/* --------------------------------------------------------------- toolbar --- */
+.toolbar {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ height: var(--h-toolbar);
+ padding: 0 10px;
+ background: var(--elevated);
+ border-bottom: 1px solid var(--line);
+ position: relative;
+}
+.toolbar__group {
+ display: flex;
+ align-items: center;
+ gap: 2px;
+}
+.toolbar__div {
+ width: 1px;
+ height: 20px;
+ margin: 0 6px;
+ background: var(--line-strong);
+}
+.toolbar__center {
+ position: absolute;
+ left: 50%;
+ transform: translateX(-50%);
+}
+.toolbar__right {
+ margin-left: auto;
+ gap: 6px;
+}
+
+.tbtn {
+ display: grid;
+ place-items: center;
+ width: 30px;
+ height: 30px;
+ border-radius: var(--r-sm);
+ color: var(--text-dim);
+ transition: background 0.12s, color 0.12s;
+}
+.tbtn:hover {
+ color: var(--text-hi);
+ background: var(--hover);
+}
+.tbtn.is-active {
+ color: var(--star-hi);
+ background: var(--star-dim);
+ box-shadow: inset 0 0 0 1px var(--star-line);
+}
+.tbtn:disabled {
+ opacity: 0.3;
+ cursor: default;
+ pointer-events: none;
+}
+
+.playbar {
+ display: flex;
+ align-items: center;
+ gap: 2px;
+ padding: 3px;
+ background: var(--base);
+ border: 1px solid var(--line);
+ border-radius: var(--r-md);
+}
+.tbtn--run:hover {
+ color: var(--run);
+}
+.tbtn--run.is-active {
+ color: var(--run);
+ background: rgba(67, 211, 158, 0.14);
+ box-shadow: inset 0 0 0 1px rgba(67, 211, 158, 0.4), var(--run-glow);
+}
+
+.chip {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ height: 28px;
+ padding: 0 11px;
+ font-size: var(--fs-sm);
+ font-weight: 500;
+ color: var(--text);
+ background: var(--input);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+}
+.chip:hover {
+ border-color: var(--line-strong);
+ color: var(--text-hi);
+}
+.chip--accent {
+ color: var(--void);
+ background: var(--star);
+ border-color: var(--star);
+}
+.chip--accent:hover {
+ background: var(--star-hi);
+ color: var(--void);
+}
+
+/* ------------------------------------------------------------- statusbar --- */
+.statusbar {
+ display: flex;
+ align-items: center;
+ height: var(--h-statusbar);
+ padding: 0 12px;
+ background: var(--base);
+ border-top: 1px solid var(--line);
+ font-size: var(--fs-xs);
+ color: var(--text-dim);
+}
+.statusbar__left,
+.statusbar__right {
+ display: flex;
+ align-items: center;
+ gap: 16px;
+}
+.statusbar__right {
+ margin-left: auto;
+}
+.statusbar__item {
+ display: flex;
+ align-items: center;
+ gap: 5px;
+}
+.statusbar__dot {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ color: var(--text-faint);
+}
+.statusbar__dot.is-live {
+ color: var(--run);
+}
+.statusbar__item--engine {
+ color: var(--text-faint);
+}
+
+/* ------------------------------------------------------- panel scaffold --- */
+.panel {
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+ background: var(--panel);
+}
+.panel__toolbar {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ padding: 6px 8px;
+ border-bottom: 1px solid var(--line-soft);
+ flex-shrink: 0;
+}
+.panel__body {
+ flex: 1;
+ min-height: 0;
+ overflow: auto;
+ padding: 4px 0;
+}
+
+.searchbox {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ height: 26px;
+ padding: 0 8px;
+ background: var(--input);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+ color: var(--text-faint);
+}
+.searchbox--grow {
+ flex: 1;
+}
+.searchbox:focus-within {
+ border-color: var(--star-line);
+}
+.searchbox__input {
+ flex: 1;
+ min-width: 0;
+ background: none;
+ border: none;
+ outline: none;
+ color: var(--text);
+ font-size: var(--fs-sm);
+}
+.searchbox__input::placeholder {
+ color: var(--text-faint);
+}
+
+.iconbtn {
+ display: grid;
+ place-items: center;
+ width: 26px;
+ height: 26px;
+ border-radius: var(--r-sm);
+ color: var(--text-dim);
+}
+.iconbtn:hover {
+ color: var(--text-hi);
+ background: var(--hover);
+}
+
+.btn-soft {
+ display: flex;
+ align-items: center;
+ gap: 5px;
+ height: 26px;
+ padding: 0 9px;
+ font-size: var(--fs-sm);
+ color: var(--text);
+ background: var(--input);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+}
+.btn-soft:hover {
+ border-color: var(--line-strong);
+ color: var(--text-hi);
+}
+
+.empty {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: 12px;
+ color: var(--text-faint);
+ text-align: center;
+ padding: 24px;
+}
+.empty p {
+ margin: 0;
+ font-size: var(--fs-sm);
+ max-width: 200px;
+}
+
+/* ------------------------------------------------------ outliner / tree --- */
+.tree {
+ padding: 4px 4px;
+}
+.tree-row {
+ display: flex;
+ align-items: center;
+ gap: 5px;
+ height: 24px;
+ padding-right: 6px;
+ border-radius: var(--r-sm);
+ color: var(--text);
+ position: relative;
+ cursor: default;
+}
+.tree-row:hover {
+ background: var(--hover);
+}
+/* Active = a starlight bar on the left + a soft left-to-right fade, not a
+ filled rounded pill (matches the launcher nav). */
+.tree-row.is-selected {
+ background: linear-gradient(90deg, var(--star-dim), transparent 70%);
+ color: var(--text-hi);
+}
+.tree-row.is-selected::before {
+ content: '';
+ position: absolute;
+ left: 0;
+ top: 3px;
+ bottom: 3px;
+ width: 2px;
+ border-radius: 0 2px 2px 0;
+ background: var(--star);
+ box-shadow: 0 0 6px var(--star-line);
+}
+.tree-row.is-hidden {
+ opacity: 0.45;
+}
+.tree-row__twist {
+ display: grid;
+ place-items: center;
+ width: 16px;
+ height: 16px;
+ color: var(--text-faint);
+ flex-shrink: 0;
+ transition: transform 0.12s;
+}
+.tree-row__twist.is-open {
+ transform: rotate(90deg);
+}
+.tree-row__twist.is-leaf {
+ visibility: hidden;
+}
+.tree-row__icon {
+ display: grid;
+ place-items: center;
+ color: var(--text-dim);
+ flex-shrink: 0;
+}
+.tree-row.is-selected .tree-row__icon {
+ color: var(--star-hi);
+}
+.tree-row__name {
+ flex: 1;
+ font-size: var(--fs-sm);
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+.tree-row__actions {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ color: var(--text-faint);
+}
+.tree-row__lock {
+ color: var(--text-faint);
+}
+.tree-row__vis {
+ display: grid;
+ place-items: center;
+ width: 18px;
+ height: 18px;
+ color: var(--text-faint);
+ opacity: 0;
+ border-radius: var(--r-xs);
+}
+.tree-row:hover .tree-row__vis,
+.tree-row.is-hidden .tree-row__vis {
+ opacity: 1;
+}
+.tree-row__vis:hover {
+ color: var(--text-hi);
+}
+
+/* -------------------------------------------------------------- viewport --- */
+.viewport {
+ position: relative;
+ height: 100%;
+ background: var(--void);
+ overflow: hidden;
+}
+.viewport__stage {
+ position: absolute;
+ inset: 0;
+ touch-action: none;
+}
+
+/* Move/rotate/scale gizmo, positioned at the selected entity (rAF-driven). */
+.viewport__gizmo {
+ position: absolute;
+ top: 0;
+ left: 0;
+ z-index: 2;
+ opacity: 0;
+ pointer-events: none;
+ will-change: transform, opacity;
+ transition: opacity 0.1s ease;
+}
+.viewport__gizmo svg {
+ display: block;
+ transform: translate(-50%, -50%);
+ filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.55));
+}
+
+/* Selection outline around the selected entity (rAF-driven, below the gizmo). */
+.viewport__selection {
+ position: absolute;
+ top: 0;
+ left: 0;
+ z-index: 1;
+ opacity: 0;
+ pointer-events: none;
+ border: 1px solid var(--star);
+ box-shadow:
+ 0 0 0 1px rgba(8, 11, 18, 0.55),
+ 0 0 8px -2px var(--star-glow);
+ will-change: transform, width, height, opacity;
+}
+.viewport__stage.has-grid {
+ background-image:
+ linear-gradient(var(--line-soft) 1px, transparent 1px),
+ linear-gradient(90deg, var(--line-soft) 1px, transparent 1px),
+ linear-gradient(rgba(77, 157, 255, 0.07) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(77, 157, 255, 0.07) 1px, transparent 1px);
+ background-size: 32px 32px, 32px 32px, 256px 256px, 256px 256px;
+ background-position: center;
+}
+.viewport__starfield {
+ position: absolute;
+ inset: 0;
+ background-image:
+ radial-gradient(1px 1px at 20% 30%, rgba(255, 255, 255, 0.5), transparent),
+ radial-gradient(1px 1px at 70% 60%, rgba(255, 255, 255, 0.35), transparent),
+ radial-gradient(1px 1px at 40% 80%, rgba(174, 203, 255, 0.5), transparent),
+ radial-gradient(1px 1px at 85% 22%, rgba(255, 255, 255, 0.3), transparent),
+ radial-gradient(1.5px 1.5px at 55% 15%, rgba(174, 203, 255, 0.45), transparent);
+ opacity: 0.7;
+ pointer-events: none;
+}
+.viewport__entity {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ display: grid;
+ place-items: center;
+}
+.viewport__entity-label {
+ position: absolute;
+ bottom: calc(100% + 6px);
+ white-space: nowrap;
+ font-size: var(--fs-2xs);
+ color: var(--star-hi);
+ background: rgba(8, 11, 18, 0.7);
+ padding: 2px 6px;
+ border-radius: var(--r-xs);
+ border: 1px solid var(--star-line);
+}
+.gizmo {
+ display: block;
+ filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.6));
+}
+
+.viewport__overlay {
+ position: absolute;
+ display: flex;
+ gap: 6px;
+ z-index: 2;
+}
+.viewport__overlay--tl {
+ top: 10px;
+ left: 10px;
+}
+.viewport__overlay--tr {
+ top: 10px;
+ right: 10px;
+}
+.viewport__overlay--bl {
+ bottom: 10px;
+ left: 12px;
+ font-size: var(--fs-xs);
+ color: var(--text-dim);
+ background: rgba(8, 11, 18, 0.55);
+ padding: 3px 8px;
+ border-radius: var(--r-sm);
+ border: 1px solid var(--line);
+}
+.vchip {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ height: 26px;
+ padding: 0 10px;
+ font-size: var(--fs-xs);
+ color: var(--text);
+ background: rgba(19, 24, 38, 0.72);
+ backdrop-filter: blur(8px);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+}
+.vchip:hover {
+ border-color: var(--line-strong);
+ color: var(--text-hi);
+}
+.vchip--icon {
+ padding: 0;
+ width: 28px;
+ justify-content: center;
+}
+.viewport__playflag {
+ position: absolute;
+ top: 10px;
+ left: 50%;
+ transform: translateX(-50%);
+ z-index: 3;
+ font-size: var(--fs-xs);
+ font-weight: 600;
+ letter-spacing: 0.1em;
+ color: var(--run);
+ background: rgba(8, 11, 18, 0.8);
+ border: 1px solid rgba(67, 211, 158, 0.5);
+ padding: 4px 12px;
+ border-radius: 999px;
+ box-shadow: var(--run-glow);
+}
+
+/* Engine boot / error overlay, centered over the stage. */
+.viewport__status {
+ position: absolute;
+ inset: 0;
+ display: grid;
+ place-items: center;
+ z-index: 2;
+ pointer-events: none;
+}
+.viewport__status-card {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ padding: 14px 18px;
+ font-size: var(--fs-sm);
+ color: var(--text);
+ background: rgba(13, 17, 27, 0.82);
+ backdrop-filter: blur(10px);
+ border: 1px solid var(--line);
+ border-radius: var(--r-md);
+ box-shadow: var(--shadow-pop);
+ max-width: 420px;
+}
+.viewport__status-card svg {
+ color: var(--star);
+ flex-shrink: 0;
+}
+.viewport__status-card strong {
+ color: var(--text-hi);
+ font-weight: 600;
+}
+.viewport__status-card p {
+ margin: 4px 0 0;
+ font-size: var(--fs-xs);
+ color: var(--text-dim);
+ word-break: break-word;
+}
+.viewport__status-card--error svg {
+ color: var(--error);
+}
+
+.spin {
+ animation: estella-spin 0.9s linear infinite;
+}
+@keyframes estella-spin {
+ to {
+ transform: rotate(360deg);
+ }
+}
+
+/* --------------------------------------------------- details / inspector --- */
+.inspector-head {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 8px 10px;
+ border-bottom: 1px solid var(--line-soft);
+ flex-shrink: 0;
+}
+.inspector-head__name {
+ flex: 1;
+ min-width: 0;
+ background: var(--input);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+ padding: 5px 8px;
+ color: var(--text-hi);
+ font-size: var(--fs-md);
+ font-weight: 500;
+ outline: none;
+}
+.inspector-head__name:focus {
+ border-color: var(--star-line);
+}
+.inspector-head__id {
+ font-size: var(--fs-xs);
+ color: var(--text-faint);
+}
+
+.cblock {
+ border-bottom: 1px solid var(--line-soft);
+}
+.cblock__head {
+ display: flex;
+ align-items: center;
+ gap: 7px;
+ height: 32px;
+ padding: 0 10px;
+ background: var(--elevated);
+}
+.cblock__twist {
+ color: var(--text-dim);
+ flex-shrink: 0;
+}
+.cblock__enable {
+ appearance: none;
+ width: 14px;
+ height: 14px;
+ border: 1px solid var(--line-strong);
+ border-radius: var(--r-xs);
+ background: var(--input);
+ cursor: pointer;
+ position: relative;
+}
+.cblock__enable:checked {
+ background: var(--star);
+ border-color: var(--star);
+}
+.cblock__enable:checked::after {
+ content: '';
+ position: absolute;
+ left: 4px;
+ top: 1px;
+ width: 4px;
+ height: 8px;
+ border: solid var(--void);
+ border-width: 0 2px 2px 0;
+ transform: rotate(45deg);
+}
+.cblock__name {
+ flex: 1;
+ font-size: var(--fs-sm);
+ font-weight: 600;
+ color: var(--text-hi);
+}
+.cblock__more {
+ color: var(--text-faint);
+ display: grid;
+ place-items: center;
+ width: 22px;
+ height: 22px;
+ border-radius: var(--r-xs);
+}
+.cblock__more:hover {
+ color: var(--text-hi);
+ background: var(--hover);
+}
+.cblock__fields {
+ padding: 6px 10px 10px;
+ display: flex;
+ flex-direction: column;
+ gap: 5px;
+}
+
+.field {
+ display: grid;
+ grid-template-columns: 96px 1fr;
+ align-items: center;
+ gap: 8px;
+ min-height: 24px;
+}
+.field__label {
+ font-size: var(--fs-sm);
+ color: var(--text-dim);
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+.field__control {
+ min-width: 0;
+}
+
+.vec {
+ display: grid;
+ grid-auto-flow: column;
+ grid-auto-columns: 1fr;
+ gap: 5px;
+}
+.vec__axis {
+ display: flex;
+ align-items: center;
+ gap: 5px;
+ font-size: var(--fs-2xs);
+ font-weight: 600;
+ color: var(--text-faint);
+ background: var(--input);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+ padding-left: 7px;
+ overflow: hidden;
+}
+.vec__axis:focus-within {
+ border-color: var(--star-line);
+}
+/* Axis color lives on the X/Y/Z letter, not a left inset bar — no rounded
+ box-with-bar motif (matches the nav / tree selected restyle). */
+.vec__axis--x {
+ color: #ff7a85;
+}
+.vec__axis--y {
+ color: #46d08a;
+}
+.vec__axis--z {
+ color: var(--star-hi);
+}
+.num {
+ width: 100%;
+ min-width: 0;
+ background: none;
+ border: none;
+ outline: none;
+ color: var(--text-hi);
+ font-family: var(--font-mono);
+ font-size: var(--fs-xs);
+ font-variant-numeric: tabular-nums;
+ padding: 5px 7px;
+}
+.num-wrap {
+ display: flex;
+ align-items: center;
+ background: var(--input);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+ padding-right: 8px;
+}
+.num-wrap:focus-within {
+ border-color: var(--star-line);
+}
+.num--solo {
+ background: none;
+ border: none;
+}
+.num__unit {
+ font-size: var(--fs-2xs);
+ color: var(--text-faint);
+}
+
+.slider {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+.slider__track {
+ position: relative;
+ flex: 1;
+ height: 4px;
+ background: var(--input);
+ border-radius: 3px;
+}
+.slider__fill {
+ position: absolute;
+ left: 0;
+ top: 0;
+ bottom: 0;
+ background: var(--star);
+ border-radius: 3px;
+}
+.slider__knob {
+ position: absolute;
+ top: 50%;
+ width: 11px;
+ height: 11px;
+ border-radius: 50%;
+ background: var(--star-hi);
+ transform: translate(-50%, -50%);
+ box-shadow: 0 0 6px -1px var(--star-glow);
+}
+.num--mini {
+ width: 44px;
+ flex-shrink: 0;
+ background: var(--input);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+ text-align: right;
+}
+
+.switch {
+ width: 30px;
+ height: 17px;
+ border-radius: 999px;
+ background: var(--input);
+ border: 1px solid var(--line-strong);
+ position: relative;
+ transition: background 0.14s, border-color 0.14s;
+}
+.switch__thumb {
+ position: absolute;
+ top: 1px;
+ left: 1px;
+ width: 13px;
+ height: 13px;
+ border-radius: 50%;
+ background: var(--text-faint);
+ transition: transform 0.14s, background 0.14s;
+}
+.switch.is-on {
+ background: var(--star-dim);
+ border-color: var(--star-line);
+}
+.switch.is-on .switch__thumb {
+ transform: translateX(13px);
+ background: var(--star);
+}
+
+.select {
+ display: flex;
+ align-items: center;
+ position: relative;
+ background: var(--input);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+ padding-right: 7px;
+}
+.select:focus-within {
+ border-color: var(--star-line);
+}
+.select select {
+ appearance: none;
+ flex: 1;
+ min-width: 0;
+ background: none;
+ border: none;
+ outline: none;
+ color: var(--text-hi);
+ font-size: var(--fs-sm);
+ padding: 5px 7px;
+ cursor: pointer;
+}
+.select svg {
+ color: var(--text-faint);
+ pointer-events: none;
+}
+
+.color {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ background: var(--input);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+ padding: 4px 8px;
+}
+.color__swatch {
+ width: 16px;
+ height: 16px;
+ border-radius: var(--r-xs);
+ border: 1px solid rgba(255, 255, 255, 0.12);
+}
+.color__hex {
+ font-size: var(--fs-xs);
+ color: var(--text);
+ text-transform: uppercase;
+}
+.color__picker {
+ width: 22px;
+ height: 18px;
+ padding: 0;
+ border: none;
+ background: none;
+ border-radius: var(--r-xs);
+ cursor: pointer;
+}
+.color__picker::-webkit-color-swatch-wrapper {
+ padding: 0;
+}
+.color__picker::-webkit-color-swatch {
+ border: 1px solid rgba(255, 255, 255, 0.14);
+ border-radius: var(--r-xs);
+}
+
+.asset-ref {
+ display: flex;
+ align-items: center;
+ gap: 7px;
+ background: var(--input);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+ padding: 5px 8px;
+ color: var(--star-hi);
+}
+.asset-ref__name {
+ font-size: var(--fs-sm);
+ color: var(--text-hi);
+}
+
+.text-input {
+ width: 100%;
+ background: var(--input);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+ padding: 5px 8px;
+ color: var(--text-hi);
+ font-size: var(--fs-sm);
+ outline: none;
+}
+.text-input:focus {
+ border-color: var(--star-line);
+}
+
+.add-component {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 6px;
+ margin: 12px 10px;
+ height: 30px;
+ font-size: var(--fs-sm);
+ font-weight: 500;
+ color: var(--star-hi);
+ background: var(--star-dim);
+ border: 1px solid var(--star-line);
+ border-radius: var(--r-sm);
+}
+.add-component:hover {
+ background: rgba(77, 157, 255, 0.22);
+}
+
+.inspector-note {
+ margin: 10px 10px 0;
+ padding: 8px 10px;
+ font-size: var(--fs-2xs);
+ color: var(--text-faint);
+ background: var(--input);
+ border: 1px dashed var(--line);
+ border-radius: var(--r-sm);
+ line-height: 1.5;
+}
+
+/* -------------------------------------------------------- content browser --- */
+.content__split {
+ flex: 1;
+ min-height: 0;
+ display: grid;
+ grid-template-columns: 160px 1fr;
+}
+.content__tree {
+ border-right: 1px solid var(--line-soft);
+ overflow: auto;
+ padding: 4px;
+}
+.content__folder {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ height: 24px;
+ padding-right: 8px;
+ border-radius: var(--r-sm);
+ font-size: var(--fs-sm);
+ color: var(--text);
+}
+.content__folder:hover {
+ background: var(--hover);
+}
+.content__folder.is-active {
+ background: var(--star-dim);
+ color: var(--text-hi);
+}
+.content__folder-twist {
+ color: var(--text-faint);
+ transition: transform 0.12s;
+}
+.content__folder-twist.is-open {
+ transform: rotate(90deg);
+}
+.content__grid {
+ overflow: auto;
+ padding: 12px;
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
+ gap: 10px;
+ align-content: start;
+}
+.tile {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 6px;
+ padding: 10px 4px 6px;
+ border-radius: var(--r-md);
+ border: 1px solid transparent;
+}
+.tile:hover {
+ background: var(--hover);
+ border-color: var(--line);
+}
+.tile:focus-visible {
+ outline: none;
+ background: var(--star-dim);
+ border-color: var(--star-line);
+}
+.tile__thumb {
+ display: grid;
+ place-items: center;
+ width: 100%;
+ aspect-ratio: 1;
+ background: var(--void);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+}
+.tile__name {
+ font-size: var(--fs-xs);
+ color: var(--text);
+ max-width: 100%;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+.tile__type {
+ font-size: var(--fs-2xs);
+ color: var(--text-faint);
+ text-transform: uppercase;
+ letter-spacing: 0.04em;
+}
+.content__path {
+ flex-shrink: 0;
+ padding: 5px 12px;
+ border-top: 1px solid var(--line-soft);
+ font-size: var(--fs-xs);
+ color: var(--text-faint);
+}
+
+/* ------------------------------------------------------------ output log --- */
+.log__filters {
+ display: flex;
+ gap: 3px;
+ flex: 1;
+}
+.pill {
+ display: flex;
+ align-items: center;
+ gap: 5px;
+ height: 24px;
+ padding: 0 10px;
+ font-size: var(--fs-xs);
+ color: var(--text-dim);
+ border-radius: 999px;
+}
+.pill:hover {
+ color: var(--text-hi);
+ background: var(--hover);
+}
+.pill.is-active {
+ color: var(--text-hi);
+ background: var(--input);
+}
+.dot {
+ width: 6px;
+ height: 6px;
+ border-radius: 50%;
+}
+.dot--info {
+ background: var(--star);
+}
+.dot--warn {
+ background: var(--warn);
+}
+.dot--error {
+ background: var(--error);
+}
+.log__tools {
+ display: flex;
+ gap: 2px;
+}
+.log__body {
+ padding: 4px 0;
+ font-size: var(--fs-xs);
+ line-height: 1.7;
+}
+.logline {
+ display: grid;
+ grid-template-columns: 64px 78px 1fr;
+ gap: 10px;
+ padding: 1px 12px;
+ color: var(--text);
+}
+.logline:hover {
+ background: var(--hover);
+}
+.logline__time {
+ color: var(--text-faint);
+}
+.logline__source {
+ color: var(--text-dim);
+}
+.logline--warn .logline__msg {
+ color: var(--warn);
+}
+.logline--error {
+ background: rgba(255, 107, 107, 0.06);
+}
+.logline--error .logline__msg {
+ color: var(--error);
+}
+.logline--success .logline__msg {
+ color: var(--run);
+}
diff --git a/desktop/src/theme/dockview-theme.css b/desktop/src/theme/dockview-theme.css
new file mode 100644
index 000000000..0ecb8bac1
--- /dev/null
+++ b/desktop/src/theme/dockview-theme.css
@@ -0,0 +1,64 @@
+/* =============================================================================
+ Estella dockview theme.
+
+ dockview 6 ships its themes (structure + `--dv-*` vars) scoped under built-in
+ theme classes. We layer on the dark `abyss` base for all structural rules,
+ then re-tint the variables to Estella's palette. The compound selector
+ `.dockview-theme-abyss.dockview-theme-estella` (specificity 0,2,0) outranks
+ abyss's own `.dockview-theme-abyss` (0,1,0), so our colors always win.
+
+ Apply with: className="dockview-theme-abyss dockview-theme-estella".
+ dockview.css must be imported before this file (see main.tsx).
+ ========================================================================== */
+
+.dockview-theme-abyss.dockview-theme-estella {
+ --dv-group-view-background-color: var(--panel);
+
+ /* Tab strip */
+ --dv-tabs-and-actions-container-background-color: var(--elevated);
+ --dv-tabs-and-actions-container-height: 34px;
+ --dv-tabs-and-actions-container-font-size: var(--fs-sm);
+ --dv-tab-divider-color: transparent;
+
+ /* Active group, focused tab */
+ --dv-activegroup-visiblepanel-tab-background-color: var(--panel);
+ --dv-activegroup-visiblepanel-tab-color: var(--text-hi);
+ /* Active group, background tabs */
+ --dv-activegroup-hiddenpanel-tab-background-color: var(--elevated);
+ --dv-activegroup-hiddenpanel-tab-color: var(--text-dim);
+ /* Inactive group */
+ --dv-inactivegroup-visiblepanel-tab-background-color: var(--panel);
+ --dv-inactivegroup-visiblepanel-tab-color: var(--text);
+ --dv-inactivegroup-hiddenpanel-tab-background-color: var(--elevated);
+ --dv-inactivegroup-hiddenpanel-tab-color: var(--text-faint);
+
+ /* Structure */
+ --dv-separator-border: var(--line);
+ --dv-paneview-header-border-color: var(--line);
+ --dv-active-sash-color: var(--star-line);
+ --dv-paneview-active-outline-color: var(--star);
+
+ /* Drag & drop */
+ --dv-drag-over-background-color: var(--star-dim);
+ --dv-drag-over-border-color: var(--star);
+
+ /* Misc */
+ --dv-icon-hover-background-color: var(--hover);
+ --dv-floating-box-shadow: var(--shadow-pop);
+ --dv-tabs-container-scrollbar-color: var(--line-strong);
+}
+
+/* The focused group gets a thin starlight top-edge — the one "glow" accent. */
+.dockview-theme-estella .dv-groupview.dv-active-group > .dv-tabs-and-actions-container {
+ box-shadow: inset 0 2px 0 -1px var(--star);
+}
+
+/* Tabs: hairline-separated, instrument-like, with a starlight underline when active. */
+.dockview-theme-estella .dv-tab {
+ border-right: 1px solid var(--line-soft);
+ padding: 0 12px;
+ letter-spacing: 0.01em;
+}
+.dockview-theme-estella .dv-tab.dv-active-tab {
+ box-shadow: inset 0 -2px 0 0 var(--star);
+}
diff --git a/desktop/src/theme/global.css b/desktop/src/theme/global.css
new file mode 100644
index 000000000..f60d1285c
--- /dev/null
+++ b/desktop/src/theme/global.css
@@ -0,0 +1,90 @@
+/* Global reset + base for the Estella Editor shell. */
+
+*,
+*::before,
+*::after {
+ box-sizing: border-box;
+}
+
+html,
+body,
+#root {
+ height: 100%;
+ margin: 0;
+}
+
+body {
+ font-family: var(--font-ui);
+ font-size: var(--fs-sm);
+ color: var(--text);
+ background: var(--base);
+ -webkit-font-smoothing: antialiased;
+ text-rendering: optimizeLegibility;
+ /* The whole shell is a fixed instrument — never scroll the document itself. */
+ overflow: hidden;
+ user-select: none;
+ cursor: default;
+}
+
+#root {
+ display: flex;
+ flex-direction: column;
+}
+
+button {
+ font: inherit;
+ color: inherit;
+ background: none;
+ border: none;
+ cursor: pointer;
+}
+
+::selection {
+ background: var(--star-dim);
+}
+
+/* — Numbers & data read in the monospace face wherever they appear — */
+.mono {
+ font-family: var(--font-mono);
+ font-variant-numeric: tabular-nums;
+ letter-spacing: -0.01em;
+}
+
+/* — Scrollbars: thin, ghosted, only visible on hover over a scroll area — */
+* {
+ scrollbar-width: thin;
+ scrollbar-color: transparent transparent;
+}
+*:hover {
+ scrollbar-color: var(--line-strong) transparent;
+}
+::-webkit-scrollbar {
+ width: 10px;
+ height: 10px;
+}
+::-webkit-scrollbar-thumb {
+ background: transparent;
+ border: 3px solid transparent;
+ border-radius: 8px;
+ background-clip: padding-box;
+}
+*:hover::-webkit-scrollbar-thumb {
+ background: var(--line-strong);
+ background-clip: padding-box;
+}
+::-webkit-scrollbar-thumb:hover {
+ background: var(--text-faint);
+ background-clip: padding-box;
+}
+::-webkit-scrollbar-corner {
+ background: transparent;
+}
+
+@media (prefers-reduced-motion: reduce) {
+ *,
+ *::before,
+ *::after {
+ animation-duration: 0.001ms !important;
+ transition-duration: 0.001ms !important;
+ }
+}
diff --git a/desktop/src/theme/launcher.css b/desktop/src/theme/launcher.css
new file mode 100644
index 000000000..d779ed6ca
--- /dev/null
+++ b/desktop/src/theme/launcher.css
@@ -0,0 +1,584 @@
+/* =============================================================================
+ Estella Launcher (project browser). Stellar-instrument identity from
+ tokens.css; structure borrows Unity Hub (persistent top actions, build-aware
+ list) + UE5 (template gallery + create panel). Signature: projects on a star
+ chart — faint starfield, starlight glow on focus, a constellation mark.
+ ========================================================================== */
+
+.launcher {
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+ background: var(--base);
+ color: var(--text);
+ overflow: hidden;
+}
+
+/* --------------------------------------------------------------- top bar --- */
+/* Draggable; left padding clears the macOS traffic lights. */
+.launcher__bar {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ height: 54px;
+ flex-shrink: 0;
+ padding: 0 20px 0 78px;
+ border-bottom: 1px solid var(--line-soft);
+ -webkit-app-region: drag;
+}
+.launcher__bar-actions {
+ display: flex;
+ gap: 10px;
+ -webkit-app-region: no-drag;
+}
+
+.lc-brand {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+}
+.lc-brand__mark {
+ width: 21px;
+ height: 21px;
+ fill: var(--star);
+ filter: drop-shadow(0 0 6px var(--star-line));
+}
+.lc-brand__text {
+ display: flex;
+ flex-direction: column;
+ line-height: 1.12;
+}
+.lc-brand__text strong {
+ font-size: var(--fs-lg);
+ font-weight: 600;
+ letter-spacing: 0.04em;
+ color: var(--text-hi);
+}
+.lc-brand__text span {
+ font-size: var(--fs-2xs);
+ letter-spacing: 0.22em;
+ text-transform: uppercase;
+ color: var(--text-faint);
+}
+
+/* ----------------------------------------------------------------- body --- */
+.launcher__body {
+ flex: 1;
+ min-height: 0;
+ display: flex;
+}
+
+.launcher__rail {
+ display: flex;
+ flex-direction: column;
+ width: 208px;
+ flex-shrink: 0;
+ padding: 18px 14px 16px;
+ border-right: 1px solid var(--line-soft);
+}
+.lc-nav {
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+}
+.lc-nav__item {
+ position: relative;
+ display: flex;
+ align-items: center;
+ gap: 9px;
+ padding: 8px 10px;
+ border-radius: var(--r-sm);
+ font-size: var(--fs-md);
+ color: var(--text-dim);
+ text-align: left;
+ transition: background 0.12s, color 0.12s;
+}
+.lc-nav__item:hover {
+ background: var(--hover);
+ color: var(--text-hi);
+}
+/* Active = a clean starlight bar on the left + a soft left-to-right fade, not a
+ filled rounded pill. */
+.lc-nav__item.is-active {
+ color: var(--star-hi);
+ background: linear-gradient(90deg, var(--star-dim), transparent 70%);
+}
+.lc-nav__item.is-active::before {
+ content: '';
+ position: absolute;
+ left: 0;
+ top: 6px;
+ bottom: 6px;
+ width: 2px;
+ border-radius: 0 2px 2px 0;
+ background: var(--star);
+ box-shadow: 0 0 6px var(--star-line);
+}
+.lc-nav__item.is-active svg {
+ color: var(--star);
+}
+
+.lc-rail__foot {
+ margin-top: auto;
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+ padding: 0 8px;
+}
+.lc-constellation {
+ width: 104px;
+ height: auto;
+ opacity: 0.7;
+}
+.lc-constellation polyline {
+ stroke: var(--line-strong);
+ stroke-width: 1;
+}
+.lc-constellation circle {
+ fill: var(--text-faint);
+}
+.lc-constellation__star {
+ fill: var(--star);
+ filter: drop-shadow(0 0 4px var(--star-line));
+}
+.lc-rail__foot .mono {
+ font-family: var(--font-mono);
+ font-size: var(--fs-2xs);
+ color: var(--text-faint);
+}
+
+/* ----------------------------------------------------------------- main --- */
+.launcher__main {
+ position: relative;
+ flex: 1;
+ min-width: 0;
+ display: flex;
+ flex-direction: column;
+ overflow: hidden;
+ /* Faint star chart behind the gallery — the signature, kept very quiet. */
+ background-image:
+ radial-gradient(circle at 82% 0%, rgba(77, 157, 255, 0.06), transparent 44%),
+ radial-gradient(rgba(122, 162, 247, 0.045) 1px, transparent 1.4px);
+ background-size: auto, 30px 30px;
+}
+
+.lc-head {
+ display: flex;
+ align-items: flex-end;
+ justify-content: space-between;
+ gap: 16px;
+ flex-shrink: 0;
+ padding: 26px 34px 8px;
+}
+.lc-head h1 {
+ margin: 0;
+ font-size: 25px;
+ font-weight: 600;
+ letter-spacing: -0.01em;
+ color: var(--text-hi);
+}
+.lc-head__sub {
+ margin: 6px 0 0;
+ font-size: var(--fs-md);
+ color: var(--text-dim);
+}
+.lc-head__tools {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+}
+
+.lc-search {
+ display: flex;
+ align-items: center;
+ gap: 7px;
+ padding: 6px 11px;
+ width: 210px;
+ background: var(--input);
+ border: 1px solid var(--line);
+ border-radius: var(--r-md);
+ color: var(--text-faint);
+}
+.lc-search input {
+ flex: 1;
+ min-width: 0;
+ background: none;
+ border: none;
+ outline: none;
+ color: var(--text);
+ font-size: var(--fs-sm);
+}
+.lc-search input::placeholder {
+ color: var(--text-faint);
+}
+
+.lc-seg {
+ display: flex;
+ gap: 2px;
+ padding: 2px;
+ background: var(--input);
+ border: 1px solid var(--line);
+ border-radius: var(--r-md);
+}
+.lc-seg__btn {
+ display: grid;
+ place-items: center;
+ width: 28px;
+ height: 24px;
+ border-radius: var(--r-xs);
+ color: var(--text-dim);
+}
+.lc-seg__btn:hover {
+ color: var(--text-hi);
+}
+.lc-seg__btn.is-active {
+ background: var(--raised);
+ color: var(--star-hi);
+}
+
+/* ----------------------------------------------------------- grid cards --- */
+.proj-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
+ gap: 16px;
+ /* Top padding gives the selected/hover star-glow room — without it the
+ scroll container clips the top row's glow ring. */
+ padding: 14px 34px 28px;
+ overflow-y: auto;
+ align-content: start;
+}
+
+.proj-card {
+ position: relative;
+ display: flex;
+ flex-direction: column;
+ text-align: left;
+ background: var(--panel);
+ border: 1px solid var(--line);
+ border-radius: var(--r-md);
+ overflow: hidden;
+ cursor: pointer;
+ transition: border-color 0.14s, box-shadow 0.14s, transform 0.14s;
+}
+.proj-card:hover,
+.proj-card:focus-visible {
+ border-color: var(--star-line);
+ box-shadow: var(--star-glow);
+ transform: translateY(-2px);
+ outline: none;
+}
+.proj-card.is-selected {
+ border-color: var(--star);
+ box-shadow: var(--star-glow);
+}
+
+.proj-card__thumb {
+ position: relative;
+ aspect-ratio: 16 / 10;
+ background: var(--void);
+ border-bottom: 1px solid var(--line);
+ display: grid;
+ place-items: center;
+ overflow: hidden;
+ background-image: radial-gradient(rgba(122, 162, 247, 0.07) 1px, transparent 1.3px);
+ background-size: 16px 16px;
+}
+.proj-card__img {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ display: block;
+}
+.proj-card__glyph {
+ font-size: 38px;
+ font-weight: 600;
+ color: var(--text-faint);
+ opacity: 0.55;
+}
+.proj-card__body {
+ display: flex;
+ flex-direction: column;
+ gap: 3px;
+ padding: 10px 12px 12px;
+}
+.proj-card__name {
+ font-size: var(--fs-md);
+ font-weight: 500;
+ color: var(--text-hi);
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+.proj-card__meta {
+ font-size: var(--fs-2xs);
+ color: var(--star-hi);
+ opacity: 0.85;
+}
+.proj-card__path {
+ font-size: var(--fs-2xs);
+ color: var(--text-faint);
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+.proj-card__desc {
+ font-size: var(--fs-xs);
+ line-height: 1.4;
+ color: var(--text-dim);
+}
+.proj-card__build,
+.proj-card__tag {
+ position: absolute;
+ top: 8px;
+ right: 8px;
+ padding: 2px 6px;
+ border-radius: var(--r-xs);
+ background: rgba(8, 11, 18, 0.66);
+ border: 1px solid var(--line);
+ font-size: var(--fs-2xs);
+ color: var(--text-dim);
+ backdrop-filter: blur(2px);
+}
+.proj-card__tag {
+ color: var(--star-hi);
+ border-color: var(--star-line);
+}
+
+/* ----------------------------------------------------------- list view --- */
+.proj-list {
+ overflow-y: auto;
+ padding: 6px 34px 28px;
+}
+.proj-list__head,
+.proj-row {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) 140px 110px;
+ align-items: center;
+ gap: 12px;
+}
+.proj-list__head {
+ padding: 6px 12px;
+ font-size: var(--fs-2xs);
+ text-transform: uppercase;
+ letter-spacing: 0.08em;
+ color: var(--text-faint);
+ border-bottom: 1px solid var(--line-soft);
+}
+.proj-list__num {
+ text-align: right;
+}
+.proj-row {
+ /* A <button> won't stretch to its container even as a grid (Chromium quirk) —
+ force full width so its columns line up with the (full-width) header. */
+ width: 100%;
+ padding: 10px 12px;
+ border-bottom: 1px solid var(--line-soft);
+ text-align: left;
+ cursor: pointer;
+ transition: background 0.12s;
+}
+.proj-row:hover,
+.proj-row:focus-visible {
+ background: var(--hover);
+ outline: none;
+}
+/* Name over path, both left-aligned to the column edge — so every row's text
+ starts at the same x and lines up under the "Project" header. */
+.proj-row__main {
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+ min-width: 0;
+}
+.proj-row__name {
+ font-size: var(--fs-md);
+ color: var(--text-hi);
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+.proj-row__path {
+ font-size: var(--fs-2xs);
+ color: var(--text-faint);
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+.proj-row__col {
+ font-size: var(--fs-xs);
+ color: var(--text-dim);
+}
+
+.lc-badge {
+ padding: 2px 7px;
+ border-radius: var(--r-xs);
+ background: var(--input);
+ border: 1px solid var(--line);
+ font-size: var(--fs-2xs);
+ color: var(--text-dim);
+}
+
+.mono {
+ font-family: var(--font-mono);
+}
+
+/* --------------------------------------------------------- new project --- */
+.lc-new {
+ flex: 1;
+ min-height: 0;
+ display: flex;
+}
+.lc-new__gallery {
+ flex: 1;
+ min-width: 0;
+ display: flex;
+ flex-direction: column;
+}
+.lc-new .lc-head {
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 0;
+}
+
+.lc-create {
+ width: 296px;
+ flex-shrink: 0;
+ display: flex;
+ flex-direction: column;
+ padding: 26px 24px;
+ border-left: 1px solid var(--line-soft);
+ background: var(--panel);
+}
+.lc-create__hint {
+ margin: auto;
+ color: var(--text-faint);
+ font-size: var(--fs-md);
+}
+.lc-create__preview {
+ border-radius: var(--r-md);
+ overflow: hidden;
+ border: 1px solid var(--line);
+ margin-bottom: 14px;
+}
+.lc-create__preview .proj-card__thumb {
+ border-bottom: none;
+}
+.lc-create__tpl {
+ font-size: var(--fs-lg);
+ font-weight: 600;
+ color: var(--text-hi);
+}
+.lc-create__desc {
+ margin: 6px 0 18px;
+ font-size: var(--fs-sm);
+ line-height: 1.45;
+ color: var(--text-dim);
+}
+
+.lc-field {
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+ margin-bottom: 14px;
+}
+.lc-field > span {
+ font-size: var(--fs-2xs);
+ text-transform: uppercase;
+ letter-spacing: 0.08em;
+ color: var(--text-faint);
+}
+.lc-field input {
+ padding: 7px 10px;
+ background: var(--input);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+ color: var(--text-hi);
+ font-size: var(--fs-sm);
+ outline: none;
+ min-width: 0;
+}
+.lc-field input:focus {
+ border-color: var(--star-line);
+}
+.lc-field__path {
+ display: flex;
+ gap: 6px;
+}
+.lc-field__path input {
+ flex: 1;
+}
+.lc-field__browse {
+ display: grid;
+ place-items: center;
+ width: 32px;
+ background: var(--input);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+ color: var(--text-dim);
+}
+.lc-field__browse:hover {
+ color: var(--star-hi);
+ border-color: var(--star-line);
+}
+.lc-create__go {
+ margin-top: auto;
+ justify-content: center;
+}
+
+/* --------------------------------------------------------------- buttons --- */
+.lc-btn {
+ display: inline-flex;
+ align-items: center;
+ gap: 8px;
+ padding: 8px 14px;
+ background: var(--input);
+ border: 1px solid var(--line-strong);
+ border-radius: var(--r-md);
+ font-size: var(--fs-sm);
+ color: var(--text);
+ cursor: pointer;
+ transition: border-color 0.12s, color 0.12s, background 0.12s, box-shadow 0.12s;
+}
+.lc-btn:hover {
+ border-color: var(--star-line);
+ color: var(--star-hi);
+ background: var(--hover);
+}
+.lc-btn--primary {
+ background: var(--star-dim);
+ border-color: var(--star-line);
+ color: var(--star-hi);
+}
+.lc-btn--primary:hover {
+ background: var(--star-dim);
+ box-shadow: var(--star-glow);
+}
+.lc-btn:disabled {
+ opacity: 0.45;
+ cursor: default;
+ box-shadow: none;
+}
+
+.lc-empty {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 16px;
+ margin: 64px auto;
+ color: var(--text-dim);
+ font-size: var(--fs-md);
+}
+
+/* One quiet page-load moment; off when reduced motion is requested. */
+@media (prefers-reduced-motion: no-preference) {
+ .proj-grid,
+ .proj-list {
+ animation: lc-rise 0.3s ease-out both;
+ }
+ @keyframes lc-rise {
+ from {
+ opacity: 0;
+ transform: translateY(8px);
+ }
+ }
+}
diff --git a/desktop/src/theme/tokens.css b/desktop/src/theme/tokens.css
new file mode 100644
index 000000000..863d3fcdd
--- /dev/null
+++ b/desktop/src/theme/tokens.css
@@ -0,0 +1,70 @@
+/* =============================================================================
+ Estella Editor — design tokens
+ Identity: a precise stellar instrument. Deep ink-navy surfaces (cool, not
+ neutral gray), hairline structure, one luminous "starlight" accent, and a
+ monospace face reserved for live data so numbers read like an instrument.
+ ========================================================================== */
+
+:root {
+ /* — Surfaces: ink-navy ramp, coolest at the bottom (the viewport void) — */
+ --void: #080b12; /* viewport / deepest stage */
+ --base: #0e121b; /* app background behind panels */
+ --panel: #131826; /* panel body */
+ --elevated: #19202f; /* toolbars, tab strips, headers */
+ --raised: #20283a; /* popovers, dropdowns */
+ --input: #1b2336; /* fields, wells */
+ --hover: rgba(122, 162, 247, 0.08);
+ --pressed: rgba(122, 162, 247, 0.14);
+
+ /* — Structure: hairlines do the visual work, not boxes — */
+ --line: #222b3d;
+ --line-soft: #1a2130;
+ --line-strong: #2f3a52;
+
+ /* — Text — */
+ --text-hi: #eef2fb;
+ --text: #c4cde0;
+ --text-dim: #828ea6;
+ --text-faint: #56627c;
+
+ /* — Starlight accent (the single signature color) — */
+ --star: #4d9dff;
+ --star-hi: #74b3ff;
+ --star-dim: rgba(77, 157, 255, 0.16);
+ --star-line: rgba(77, 157, 255, 0.4);
+ --star-glow: 0 0 0 1px var(--star-line), 0 0 12px -2px rgba(77, 157, 255, 0.55);
+ --nebula: #9a6cff; /* secondary stellar, used sparingly */
+
+ /* — Semantic — */
+ --run: #43d39e; /* play / running */
+ --run-glow: 0 0 10px -1px rgba(67, 211, 158, 0.6);
+ --warn: #ffb454; /* supernova amber */
+ --error: #ff6b6b;
+
+ /* — Type — */
+ --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
+ --font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, 'Cascadia Code', monospace;
+
+ --fs-2xs: 10px;
+ --fs-xs: 11px;
+ --fs-sm: 12px;
+ --fs-md: 13px;
+ --fs-lg: 15px;
+
+ /* — Geometry — */
+ --r-xs: 3px;
+ --r-sm: 5px;
+ --r-md: 7px;
+ --r-lg: 10px;
+
+ --u: 4px; /* spacing unit */
+
+ /* — Chrome heights — */
+ --h-titlebar: 30px;
+ --h-toolbar: 42px;
+ --h-statusbar: 24px;
+
+ /* — Elevation — */
+ --shadow-pop: 0 8px 28px -6px rgba(0, 0, 0, 0.55), 0 2px 6px -2px rgba(0, 0, 0, 0.4);
+ --shadow-panel: 0 1px 0 0 rgba(255, 255, 255, 0.02) inset;
+}
diff --git a/desktop/src/types.ts b/desktop/src/types.ts
new file mode 100644
index 000000000..049e437d9
--- /dev/null
+++ b/desktop/src/types.ts
@@ -0,0 +1,86 @@
+// Shared editor domain types. These mirror the shapes the engine bridge
+// (CoreApiBridge / generated EditorAPI) will eventually supply, so panels are
+// written against the real contract from day one — the mock layer just fills it.
+
+export type EntityId = number;
+
+export type NodeKind =
+ | 'camera'
+ | 'sprite'
+ | 'spine'
+ | 'physics'
+ | 'ui'
+ | 'audio'
+ | 'group'
+ | 'light'
+ | 'empty';
+
+export interface SceneNode {
+ id: EntityId;
+ name: string;
+ kind: NodeKind;
+ visible: boolean;
+ locked: boolean;
+ children?: SceneNode[];
+}
+
+// — Inspector model: built from live engine component data via introspection —
+export type InspectorFieldType =
+ | 'number'
+ | 'bool'
+ | 'string'
+ | 'vec2'
+ | 'vec3'
+ | 'angle' // 2D rotation: a quaternion shown/edited as Z degrees
+ | 'color';
+
+export type InspectorFieldValue =
+ | number
+ | boolean
+ | string
+ | [number, number]
+ | [number, number, number];
+
+export interface InspectorField {
+ /** key in the component data object */
+ key: string;
+ label: string;
+ type: InspectorFieldType;
+ value: InspectorFieldValue;
+}
+
+export interface InspectorComponent {
+ /** engine component name, e.g. 'Transform' */
+ name: string;
+ label: string;
+ fields: InspectorField[];
+}
+
+export type AssetType =
+ | 'folder'
+ | 'scene'
+ | 'sprite'
+ | 'texture'
+ | 'spine'
+ | 'audio'
+ | 'prefab'
+ | 'material'
+ | 'script';
+
+export interface AssetItem {
+ id: string;
+ name: string;
+ type: AssetType;
+}
+
+export type LogLevel = 'info' | 'success' | 'warn' | 'error';
+
+export interface LogEntry {
+ id: number;
+ level: LogLevel;
+ time: string;
+ source: string;
+ message: string;
+}
+
+export type ToolMode = 'select' | 'move' | 'rotate' | 'scale';
diff --git a/desktop/src/vite-env.d.ts b/desktop/src/vite-env.d.ts
new file mode 100644
index 000000000..c09ee9661
--- /dev/null
+++ b/desktop/src/vite-env.d.ts
@@ -0,0 +1,9 @@
+/// <reference types="vite/client" />
+
+import type { EstellaBridge } from '../electron/preload';
+
+declare global {
+ interface Window {
+ estella: EstellaBridge;
+ }
+}
diff --git a/desktop/tsconfig.json b/desktop/tsconfig.json
new file mode 100644
index 000000000..d490dadd9
--- /dev/null
+++ b/desktop/tsconfig.json
@@ -0,0 +1,28 @@
+{
+ "compilerOptions": {
+ "target": "ES2022",
+ "useDefineForClassFields": true,
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
+ "module": "ESNext",
+ "skipLibCheck": true,
+
+ "moduleResolution": "bundler",
+ "allowImportingTsExtensions": true,
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "moduleDetection": "force",
+ "noEmit": true,
+ "jsx": "react-jsx",
+
+ "strict": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "noFallthroughCasesInSwitch": true,
+ "verbatimModuleSyntax": true,
+
+ "paths": {
+ "@/*": ["./src/*"]
+ }
+ },
+ "include": ["src", "electron", "vite.config.ts"]
+}
diff --git a/desktop/vite.config.ts b/desktop/vite.config.ts
new file mode 100644
index 000000000..5cbc90664
--- /dev/null
+++ b/desktop/vite.config.ts
@@ -0,0 +1,28 @@
+import { defineConfig } from 'vite';
+import { fileURLToPath, URL } from 'node:url';
+import react from '@vitejs/plugin-react';
+import electron from 'vite-plugin-electron/simple';
+
+// Estella Editor — Electron + React + Vite.
+// `public/` (wasm runtime, bundled SDK, example projects) is served at the web root,
+// so the engine binary is reachable at /wasm/esengine.wasm once we wire the viewport.
+export default defineConfig({
+ resolve: {
+ alias: {
+ '@': fileURLToPath(new URL('./src', import.meta.url)),
+ },
+ },
+ plugins: [
+ react(),
+ electron({
+ main: {
+ entry: 'electron/main.ts',
+ },
+ preload: {
+ input: 'electron/preload.ts',
+ },
+ // The renderer is a normal Vite app; no Node integration in the window.
+ renderer: process.env.NODE_ENV === 'test' ? undefined : {},
+ }),
+ ],
+});