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.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
refactor(theme): literal stragglers join the token ladder
yhh15446a21d58b
diff --git a/desktop/src/engine/PlayRealm.ts b/desktop/src/engine/PlayRealm.tsindex 242f34f8d..b99d5b0d6 100644--- a/desktop/src/engine/PlayRealm.ts+++ b/desktop/src/engine/PlayRealm.ts@@ -50,7 +50,7 @@ export class PlayRealmInstance {if (!this.iframe) {const f = document.createElement('iframe');f.title = this.id === 0 ? 'Game' : `Game P${this.id + 1}`;- f.style.cssText = 'display:block;width:100%;height:100%;border:0;background:#0e121b';+ f.style.cssText = 'display:block;width:100%;height:100%;border:0;background:var(--srf-1)';window.addEventListener('message', this.onMessage);this.iframe = f;}diff --git a/desktop/src/gameHost.ts b/desktop/src/gameHost.tsindex 79f71e7d2..27625fbe6 100644--- a/desktop/src/gameHost.ts+++ b/desktop/src/gameHost.ts@@ -135,5 +135,6 @@ boot().catch((err) => {const message = err instanceof Error ? err.message : String(err);if (err === 'unwind' || message.includes('unwind')) return; // emscripten loop took over — successconsole.error('[game] boot failed', err);- document.body.innerHTML = `<pre style="color:#f87171;padding:20px;font:13px monospace">${message}</pre>`;+ // The game realm has no editor stylesheet — this literal mirrors --error.+ document.body.innerHTML = `<pre style="color:#d65a5a;padding:20px;font:13px monospace">${message}</pre>`;});diff --git a/desktop/src/panels/ProfilerPanel.tsx b/desktop/src/panels/ProfilerPanel.tsxindex 6cf02d7be..da68ebbfe 100644--- a/desktop/src/panels/ProfilerPanel.tsx+++ b/desktop/src/panels/ProfilerPanel.tsx@@ -10,9 +10,10 @@ import { PerfMonitor } from '@/engine/PerfMonitor';const BUDGET_MS = 1000 / 60; // 60 Hz frame budget (16.6ms)const BUDGET_30 = 1000 / 30; // 30 Hz (33.3ms) — the hitch threshold-// GPU/VRAM metric identity — a teal deliberately outside the panel palette so-// the third series never reads as accent or warning.-const GPU_COLOR = '#3fb2b2';+// GPU/VRAM metric identity — the --vram token (canvas draws read it at paint+// time via cssVar; this is the same-value fallback).+const GPU_FALLBACK = '#3fb2b2';+const GPU_COLOR = `var(--vram, ${GPU_FALLBACK})`;function kfmt(n: number): string {return n >= 1000 ? `${(n / 1000).toFixed(n >= 10000 ? 0 : 1)}k` : String(n);@@ -77,7 +78,7 @@ function MemGraph({ hist }: { hist: Array<{ wasm: number; js: number; vram: numbif (!n) return;let max = 1;for (const m of hist) max = Math.max(max, m.wasm, m.js, m.vram);- const colors = { wasm: cssVar(cv, '--warn', '#d3a23c'), js: cssVar(cv, '--star', '#2f88d6'), vram: GPU_COLOR };+ const colors = { wasm: cssVar(cv, '--warn', '#d3a23c'), js: cssVar(cv, '--star', '#2f88d6'), vram: cssVar(cv, '--vram', GPU_FALLBACK) };const line = (key: 'wasm' | 'js' | 'vram') => {ctx.strokeStyle = colors[key];ctx.lineWidth = 1.25;@@ -306,7 +307,7 @@ export function ProfilerPanel() {<h4>Unit <span className="prof-realm">· {s.realm}</span></h4><Seg label="engine" ms={v.engineMs} frame={frame} color="var(--run, #46a04a)" /><Seg label="editor" ms={v.editorMs} frame={frame} color="var(--star, #2f88d6)" />- <Seg label={presentLabel} ms={other} frame={frame} color="var(--text-mute, #888)" />+ <Seg label={presentLabel} ms={other} frame={frame} color="var(--text-mute, #696a71)" />{v.gpuMs >= 0 ? (<Seg label="gpu" ms={v.gpuMs} frame={frame} color={GPU_COLOR} />) : (diff --git a/desktop/src/panels/SequencerCurve.tsx b/desktop/src/panels/SequencerCurve.tsxindex 983d28e2f..3cde82d21 100644--- a/desktop/src/panels/SequencerCurve.tsx+++ b/desktop/src/panels/SequencerCurve.tsx@@ -24,7 +24,7 @@ import { findChannel, timeToPct, type SeqRow } from '@/timeline/timelineView';const PAD_T = 8;const PAD_B = 8;const SAMPLES = 100;-const PALETTE = ['var(--ax-x)', 'var(--ax-y)', 'var(--acc-hi)', '#c9a14e', '#9b8fc0', '#7faf9c'];+const PALETTE = ['var(--ax-x)', 'var(--ax-y)', 'var(--acc-hi)', 'var(--curve-4)', 'var(--curve-5)', 'var(--curve-6)'];interface CurveChannel {row: SeqRow;diff --git a/desktop/src/theme/app.css b/desktop/src/theme/app.cssindex 235d1be02..63584e637 100644--- a/desktop/src/theme/app.css+++ b/desktop/src/theme/app.css@@ -172,7 +172,7 @@opacity: 0;pointer-events: none;will-change: transform, opacity;- transition: opacity 0.1s ease;+ transition: opacity var(--t-fast) ease;}/* The gizmo SVG is a fixed square whose viewBox is centered on (0,0); place thatcenter at the wrapper origin (= the pivot) by pulling it back half its size. */@@ -224,8 +224,8 @@z-index: 1;opacity: 0;pointer-events: none;- border: 1px dashed #5ac8fa;- background: rgba(90, 200, 250, 0.12);+ border: 1px dashed var(--gizmo-tile);+ background: color-mix(in srgb, var(--gizmo-tile) 12%, transparent);will-change: transform, width, height, opacity;}.viewport__tilepreview {@@ -271,8 +271,8 @@top: 0;left: 0;display: none;- border: 1px solid rgba(90, 200, 250, 0.7);- background: rgba(90, 200, 250, 0.22);+ border: 1px solid color-mix(in srgb, var(--gizmo-tile) 70%, transparent);+ background: color-mix(in srgb, var(--gizmo-tile) 22%, transparent);will-change: transform, width, height;}@@ -318,7 +318,7 @@ body.thumb-capture .viewport__play-stop {z-index: 2;pointer-events: none;will-change: transform;- transition: opacity 0.1s;+ transition: opacity var(--t-fast);}/* The bulb is the light's click target (select-to-identify); generously padded hit box. */.viewport__light-hit {@@ -336,7 +336,7 @@ body.thumb-capture .viewport__play-stop {.viewport__light-icon {display: block;filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.8));- transition: transform 0.1s;+ transition: transform var(--t-fast);}.viewport__light-hit:hover .viewport__light-icon {transform: scale(1.2);@@ -433,7 +433,7 @@ body.thumb-capture .viewport__play-stop {.viewport__particle-icon {display: block;filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.8));- transition: transform 0.1s;+ transition: transform var(--t-fast);}.viewport__particle-hit:hover .viewport__particle-icon {transform: scale(1.2);@@ -590,7 +590,7 @@ body.thumb-capture .viewport__play-stop {color: var(--text-hi);font-size: var(--fs-sm);pointer-events: auto;- animation: toast-in 0.16s ease-out;+ animation: toast-in var(--t) ease-out;}.toast__msg {diff --git a/desktop/src/theme/chrome.css b/desktop/src/theme/chrome.cssindex 152be3354..e67faeb9c 100644--- a/desktop/src/theme/chrome.css+++ b/desktop/src/theme/chrome.css@@ -58,7 +58,7 @@transition: color var(--t-fast), background var(--t-fast);}.winctl__btn:hover { color: var(--text); background: var(--srf-3); }-.winctl__btn--close:hover { color: #fff; background: var(--error); }+.winctl__btn--close:hover { color: var(--on-accent); background: var(--error); }/* ── Toolbar (modes left · play center · actions right) ── */.toolbar {@@ -116,7 +116,7 @@.play-mode { width: auto; padding: 0 6px; display: inline-flex; align-items: center; gap: 2px; }.play-mode .play-mode-cv { opacity: 0.6; }.play-wrap.playing .play-main, .play-wrap.playing .play-side { background: var(--error); }-.play-wrap.playing .play-main:hover { background: #e36a6a; }+.play-wrap.playing .play-main:hover { background: var(--error-hi); }.play-wrap.paused .play-main, .play-wrap.paused .play-side { background: var(--warn); }/* ── Status bar ── */diff --git a/desktop/src/theme/content.css b/desktop/src/theme/content.cssindex 55844d120..12552222a 100644--- a/desktop/src/theme/content.css+++ b/desktop/src/theme/content.css@@ -80,7 +80,7 @@.asset.is-dragging, .lr.is-dragging { opacity: 0.45; }.asset .th { position: relative; width: 100%; aspect-ratio: 1; border-radius: var(--r-md) var(--r-md) 0 0; display: grid; place-items: center; color: rgba(255, 255, 255, 0.85); overflow: hidden; background: var(--srf-4); }.asset .th img { width: 100%; height: 100%; object-fit: cover; }-.asset .th .badge { position: absolute; top: 5px; left: 5px; font-size: var(--fs-3xs); font-weight: 700; letter-spacing: 0.4px; padding: 1px 4px; border-radius: var(--r-xs); background: rgba(0, 0, 0, 0.5); color: #fff; font-family: var(--mono); }+.asset .th .badge { position: absolute; top: 5px; left: 5px; font-size: var(--fs-3xs); font-weight: 700; letter-spacing: 0.4px; padding: 1px 4px; border-radius: var(--r-xs); background: rgba(0, 0, 0, 0.5); color: var(--on-accent); font-family: var(--mono); }.asset .nm { display: flex; align-items: center; gap: 4px; padding: 6px 7px; font-size: var(--fs-xs); color: var(--text); background: var(--srf-3); border-radius: 0 0 var(--r-md) var(--r-md); border-top: 2px solid var(--tc, var(--text-mute)); }.asset .nm span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.folder .th { background: none; color: var(--cat-collision); }@@ -127,7 +127,7 @@.cb-prev .pv img { max-width: 100%; max-height: 100%; object-fit: contain; }.cb-dt { padding: 11px 13px; }.cb-dt .an { font-size: var(--fs-md); font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 7px; word-break: break-word; }-.cb-dt .an .tg { font-size: var(--fs-3xs); font-weight: 700; padding: 1px 5px; border-radius: var(--r-xs); color: #fff; flex-shrink: 0; font-family: var(--mono); }+.cb-dt .an .tg { font-size: var(--fs-3xs); font-weight: 700; padding: 1px 5px; border-radius: var(--r-xs); color: var(--on-accent); flex-shrink: 0; font-family: var(--mono); }.cb-dt .ap { font-size: var(--fs-2xs); color: var(--text-mute); font-family: var(--mono); margin-top: 3px; word-break: break-all; }.cb-meta { margin-top: 12px; display: flex; flex-direction: column; gap: 1px; }.cb-mr { display: flex; align-items: center; height: 26px; font-size: var(--fs-sm); }diff --git a/desktop/src/theme/inspector.css b/desktop/src/theme/inspector.cssindex 1aa05b983..1a9ca97ff 100644--- a/desktop/src/theme/inspector.css+++ b/desktop/src/theme/inspector.css@@ -96,7 +96,7 @@.vec { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; flex: 1; min-width: 0; }.vfield { height: 22px; display: flex; align-items: center; background: var(--inset); border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; min-width: 0; transition: border-color var(--t-fast), box-shadow var(--t-fast); }.vfield:focus-within { border-color: var(--acc); box-shadow: 0 0 0 2px var(--acc-soft); }-.ax { width: 16px; height: 100%; display: grid; place-items: center; font-size: var(--fs-3xs); font-weight: 700; font-family: var(--mono); color: #fff; cursor: ew-resize; flex-shrink: 0; font-style: normal; }+.ax { width: 16px; height: 100%; display: grid; place-items: center; font-size: var(--fs-3xs); font-weight: 700; font-family: var(--mono); color: var(--on-accent); cursor: ew-resize; flex-shrink: 0; font-style: normal; }.ax.x { background: var(--ax-x); }.ax.y { background: var(--ax-y); }.ax.z { background: var(--ax-z); }diff --git a/desktop/src/theme/launcher.css b/desktop/src/theme/launcher.cssindex ea0ce2408..4e899262e 100644--- a/desktop/src/theme/launcher.css+++ b/desktop/src/theme/launcher.css@@ -96,7 +96,7 @@font-size: var(--fs-md);color: var(--text-dim);text-align: left;- transition: background 0.12s, color 0.12s;+ transition: background var(--t-fast), color var(--t-fast);}.lc-nav__item:hover {background: var(--hover);@@ -227,7 +227,7 @@border-radius: var(--r-md);overflow: hidden;cursor: pointer;- transition: border-color 0.14s, box-shadow 0.14s, transform 0.14s;+ transition: border-color var(--t), box-shadow var(--t), transform var(--t);}.proj-card:hover,.proj-card:focus-visible {@@ -333,7 +333,7 @@color: var(--text-dim);cursor: pointer;opacity: 0;- transition: opacity 0.12s, color 0.12s, border-color 0.12s;+ transition: opacity var(--t-fast), color var(--t-fast), border-color var(--t-fast);backdrop-filter: blur(2px);}.proj-card:hover .proj-card__remove,@@ -394,7 +394,7 @@border-bottom: 1px solid var(--line-soft);text-align: left;cursor: pointer;- transition: background 0.12s;+ transition: background var(--t-fast);}.proj-row:hover,.proj-row:focus-visible {@@ -420,7 +420,7 @@color: var(--text-dim);cursor: pointer;opacity: 0;- transition: opacity 0.12s, color 0.12s, border-color 0.12s;+ transition: opacity var(--t-fast), color var(--t-fast), border-color var(--t-fast);}.proj-row:hover .proj-row__remove,.proj-row:focus-within .proj-row__remove { opacity: 1; }@@ -580,7 +580,7 @@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;+ transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);}.lc-btn:hover {border-color: var(--star-line);@@ -616,7 +616,7 @@@media (prefers-reduced-motion: no-preference) {.proj-grid,.proj-list {- animation: lc-rise 0.3s ease-out both;+ animation: lc-rise var(--t-slow) ease-out both;}@keyframes lc-rise {from {diff --git a/desktop/src/theme/profiler.css b/desktop/src/theme/profiler.cssindex a608323ba..5d9cc4c16 100644--- a/desktop/src/theme/profiler.css+++ b/desktop/src/theme/profiler.css@@ -60,7 +60,7 @@.prof-btn:hover { color: var(--text-hi); background: var(--srf-4); }.prof-btn:active { background: var(--srf-5); }.prof-btn.on { color: var(--star-hi, var(--star)); border-color: var(--star); } /* frozen → "Live" is armed */-.prof-btn.rec { color: var(--error, #d3564b); border-color: var(--error, #d3564b); }+.prof-btn.rec { color: var(--error, #d65a5a); border-color: var(--error, #d65a5a); }.prof-check { display: flex; align-items: center; gap: 4px; color: var(--text-mute); cursor: pointer; }.prof-check input { accent-color: var(--star); }.prof-live { color: var(--run, #46a04a); }diff --git a/desktop/src/theme/tileset.css b/desktop/src/theme/tileset.cssindex 2b4a500fe..784a000a3 100644--- a/desktop/src/theme/tileset.css+++ b/desktop/src/theme/tileset.css@@ -175,7 +175,7 @@.ts-zone-c:hover { background: rgba(255, 255, 255, 0.1); }/* Polygon-collision cell marker + the focused polygon editor overlay */-.ts-pcell.is-poly { background: rgba(90, 200, 250, 0.22); border-color: rgba(90, 200, 250, 0.85); }+.ts-pcell.is-poly { background: color-mix(in srgb, var(--gizmo-tile) 22%, transparent); border-color: color-mix(in srgb, var(--gizmo-tile) 85%, transparent); }.ts-pcell:hover { border-color: var(--star); background: var(--star-dim); }.ts-pe-backdrop {@@ -214,8 +214,8 @@cursor: crosshair;}.ts-pe-svg { position: absolute; left: 0; top: 0; pointer-events: none; }-.ts-pe-poly { fill: rgba(90, 200, 250, 0.3); stroke: #5ac8fa; stroke-width: 0.5; }-.ts-pe-pt { fill: #fff; stroke: #5ac8fa; stroke-width: 0.5; pointer-events: auto; cursor: pointer; }+.ts-pe-poly { fill: color-mix(in srgb, var(--gizmo-tile) 30%, transparent); stroke: var(--gizmo-tile); stroke-width: 0.5; }+.ts-pe-pt { fill: #fff; stroke: var(--gizmo-tile); stroke-width: 0.5; pointer-events: auto; cursor: pointer; }.ts-pe-pt:hover { fill: #f0645a; }.ts-pe-hint { color: var(--text-faint); font-size: var(--fs-xs); text-align: center; }diff --git a/desktop/src/theme/tokens.css b/desktop/src/theme/tokens.cssindex 07b2e821d..4a191c18e 100644--- a/desktop/src/theme/tokens.css+++ b/desktop/src/theme/tokens.css@@ -77,6 +77,17 @@--ax-y: #80b94a;--ax-z: #4a8fd6;+ /* — Curve-channel identity: the sequencer's curve view cycles axes first,+ then these three (gold / lilac / sage) — hues that never collide with+ the axis triple or the accent. — */+ --curve-4: #c9a14e;+ --curve-5: #9b8fc0;+ --curve-6: #7faf9c;++ /* — Profiler VRAM/GPU series: a teal deliberately outside the panel palette+ so the third series never reads as accent or warning. — */+ --vram: #3fb2b2;+/* — Viewport gizmo identity: high-visibility strokes drawn over scene art(collider green, particle-shape amber, tile-paint cyan). Distinct fromthe muted panel palette on purpose — gizmos must survive any backdrop. — */@@ -100,6 +111,7 @@--create-hi: #34b163;--warn: #d3a23c; /* amber / warnings */--error: #d65a5a;+ --error-hi: #e36a6a; /* hover over an error fill (Stop while playing) *//* — Type — */--font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;