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.

refactor(theme): residual token sweep - gizmo identity, glass, fallback drift

yhh5330ca6ddeaa
diff --git a/desktop/src/components/ErrorBoundary.tsx b/desktop/src/components/ErrorBoundary.tsx
index 0031cb951..6ad633607 100644
--- a/desktop/src/components/ErrorBoundary.tsx
+++ b/desktop/src/components/ErrorBoundary.tsx
@@ -64,8 +64,8 @@ export class ErrorBoundary extends Component<Props, State> {
}
const S: Record<string, CSSProperties> = {
- root: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: 10, height: '100%', padding: 16, textAlign: 'center', color: 'var(--text, #cbd2da)' },
- title: { fontSize: 13, fontWeight: 600, color: 'var(--danger, #e06c75)' },
- msg: { fontSize: 12, opacity: 0.75, maxWidth: 480, wordBreak: 'break-word', fontFamily: 'var(--mono, ui-monospace, monospace)' },
- btn: { padding: '4px 12px', fontSize: 12, borderRadius: 4, border: '1px solid var(--border, #333)', background: 'var(--panel, #232830)', color: 'inherit', cursor: 'pointer' },
+ root: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: 10, height: '100%', padding: 16, textAlign: 'center', color: 'var(--text)' },
+ title: { fontSize: 'var(--fs-md)', fontWeight: 600, color: 'var(--error)' },
+ msg: { fontSize: 'var(--fs-sm)', opacity: 0.75, maxWidth: 480, wordBreak: 'break-word', fontFamily: 'var(--mono)' },
+ btn: { padding: '4px 12px', fontSize: 'var(--fs-sm)', borderRadius: 'var(--r-md)', border: '1px solid var(--line)', background: 'var(--srf-3)', color: 'inherit', cursor: 'pointer' },
};
diff --git a/desktop/src/components/PerfOverlay.tsx b/desktop/src/components/PerfOverlay.tsx
index bcc28f112..9ebb3d4a2 100644
--- a/desktop/src/components/PerfOverlay.tsx
+++ b/desktop/src/components/PerfOverlay.tsx
@@ -7,11 +7,11 @@
import { useSyncExternalStore } from 'react';
import { PerfMonitor } from '@/engine/PerfMonitor';
-const mute = 'var(--text-mute, #888)';
+const mute = 'var(--text-mute)';
export function PerfOverlay() {
const s = useSyncExternalStore(PerfMonitor.subscribe, PerfMonitor.getSnapshot);
- const warn = 'var(--warn, #e5a33b)';
+ const warn = 'var(--warn)';
const p99Bad = s.p99 >= 24;
return (
<div
@@ -23,16 +23,16 @@ export function PerfOverlay() {
right: 10,
zIndex: 4,
pointerEvents: 'none',
- font: 'var(--fs-xs, 11px) var(--mono, ui-monospace, monospace)',
+ font: 'var(--fs-xs) var(--mono)',
lineHeight: 1.55,
- color: 'var(--text-dim, #cfcfcf)',
- background: 'rgba(18, 18, 21, 0.72)',
+ color: 'var(--text-dim)',
+ background: 'rgba(var(--glass-rgb), 0.72)',
backdropFilter: 'blur(14px)',
WebkitBackdropFilter: 'blur(14px)',
- border: '1px solid var(--border-line, #333)',
- borderRadius: 'var(--r-lg, 10px)',
+ border: '1px solid var(--border-line)',
+ borderRadius: 'var(--r-lg)',
padding: '7px 9px',
- boxShadow: 'var(--shadow-2, 0 4px 14px rgba(0,0,0,0.35))',
+ boxShadow: 'var(--shadow-2)',
}}
>
<div>
diff --git a/desktop/src/components/Segmented.tsx b/desktop/src/components/Segmented.tsx
index 82461c5e0..6fc9d71a9 100644
--- a/desktop/src/components/Segmented.tsx
+++ b/desktop/src/components/Segmented.tsx
@@ -22,14 +22,17 @@ export function Segmented<T extends string>({
options,
onChange,
ariaLabel,
+ grow,
}: {
value: T;
options: SegmentedOption<T>[];
onChange: (v: T) => void;
ariaLabel?: string;
+ /** Fill the container width, segments sharing it equally (world picker). */
+ grow?: boolean;
}) {
return (
- <div className="seg" role="radiogroup" aria-label={ariaLabel}>
+ <div className={`seg${grow ? ' grow' : ''}`} role="radiogroup" aria-label={ariaLabel}>
{options.map((o) => (
<button
key={o.value}
diff --git a/desktop/src/panels/Outliner.tsx b/desktop/src/panels/Outliner.tsx
index 241367451..2a895db3c 100644
--- a/desktop/src/panels/Outliner.tsx
+++ b/desktop/src/panels/Outliner.tsx
@@ -21,6 +21,7 @@ import { joinFolder, folderParent, folderName, normalizeFolder, isFolderUnder }
import type { EntityId } from '@/types';
import { type EntityTemplate } from '@/engine/entityTemplates';
import { CreatePopover } from '@/components/CreatePopover';
+import { Segmented } from '@/components/Segmented';
// Must match .row height in outliner.css — the fixed row size the virtual list windows by.
const ROW_H = 24;
@@ -608,12 +609,16 @@ export function Outliner() {
<div className="panel">
{isPlaying && (
<div className="world-pick">
- <button type="button" className={gameMode ? '' : 'on'} onClick={() => setInspectWorld('editor')}>
- Editor
- </button>
- <button type="button" className={gameMode ? 'on' : ''} onClick={() => setInspectWorld('game')}>
- Game
- </button>
+ <Segmented
+ grow
+ ariaLabel="Inspected world"
+ value={gameMode ? 'game' : 'editor'}
+ options={[
+ { value: 'editor', label: 'Editor' },
+ { value: 'game', label: 'Game' },
+ ]}
+ onChange={(v) => setInspectWorld(v)}
+ />
</div>
)}
{gameMode ? (
diff --git a/desktop/src/panels/ProfilerPanel.tsx b/desktop/src/panels/ProfilerPanel.tsx
index 49a9d752b..6cf02d7be 100644
--- a/desktop/src/panels/ProfilerPanel.tsx
+++ b/desktop/src/panels/ProfilerPanel.tsx
@@ -10,6 +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';
+
function kfmt(n: number): string {
return n >= 1000 ? `${(n / 1000).toFixed(n >= 10000 ? 0 : 1)}k` : String(n);
}
@@ -73,7 +77,7 @@ function MemGraph({ hist }: { hist: Array<{ wasm: number; js: number; vram: numb
if (!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: '#3fb2b2' };
+ const colors = { wasm: cssVar(cv, '--warn', '#d3a23c'), js: cssVar(cv, '--star', '#2f88d6'), vram: GPU_COLOR };
const line = (key: 'wasm' | 'js' | 'vram') => {
ctx.strokeStyle = colors[key];
ctx.lineWidth = 1.25;
@@ -113,7 +117,7 @@ function FrameGraph({ frames, pinnedId }: { frames: number[]; pinnedId: number |
const accent = cssVar(cv, '--star', '#2f88d6');
const warn = cssVar(cv, '--warn', '#d3a23c');
- const err = cssVar(cv, '--error', '#d3564b');
+ const err = cssVar(cv, '--error', '#d65a5a');
const grid = cssVar(cv, '--text-faint', '#696a71');
const hi = cssVar(cv, '--text-hi', '#e8e9eb');
@@ -284,7 +288,7 @@ export function ProfilerPanel() {
<div><span>fps</span><b>{s.fps}</b></div>
<div><span>p50</span><b>{s.p50}<i>ms</i></b></div>
<div><span>p95</span><b>{s.p95}<i>ms</i></b></div>
- <div><span>p99</span><b style={{ color: p99Bad ? 'var(--warn, #e5a33b)' : undefined }}>{s.p99}<i>ms</i></b></div>
+ <div><span>p99</span><b style={{ color: p99Bad ? 'var(--warn)' : undefined }}>{s.p99}<i>ms</i></b></div>
</div>
<div className="prof-budget">
budget {BUDGET_MS.toFixed(1)}ms · {s.longFrames} long frame{s.longFrames === 1 ? '' : 's'}
@@ -304,7 +308,7 @@ export function ProfilerPanel() {
<Seg label="editor" ms={v.editorMs} frame={frame} color="var(--star, #2f88d6)" />
<Seg label={presentLabel} ms={other} frame={frame} color="var(--text-mute, #888)" />
{v.gpuMs >= 0 ? (
- <Seg label="gpu" ms={v.gpuMs} frame={frame} color="#3fb2b2" />
+ <Seg label="gpu" ms={v.gpuMs} frame={frame} color={GPU_COLOR} />
) : (
<div className="prof-row">
<span className="prof-key">gpu</span>
@@ -343,9 +347,9 @@ export function ProfilerPanel() {
<h4>Memory</h4>
<MemGraph hist={s.memHist} />
<div className="prof-stat-grid">
- <div><span style={{ color: 'var(--warn, #d3a23c)' }}>wasm</span><b>{s.wasmMB}<i>MB</i></b></div>
- <div><span style={{ color: 'var(--star, #2f88d6)' }}>js heap</span><b>{s.jsHeapMB || '—'}<i>{s.jsHeapMB ? 'MB' : ''}</i></b></div>
- <div><span style={{ color: '#3fb2b2' }}>vram</span><b>{s.vramMB}<i>MB</i></b></div>
+ <div><span style={{ color: 'var(--warn)' }}>wasm</span><b>{s.wasmMB}<i>MB</i></b></div>
+ <div><span style={{ color: 'var(--star)' }}>js heap</span><b>{s.jsHeapMB || '—'}<i>{s.jsHeapMB ? 'MB' : ''}</i></b></div>
+ <div><span style={{ color: GPU_COLOR }}>vram</span><b>{s.vramMB}<i>MB</i></b></div>
</div>
{s.jsHeapLimitMB ? <div className="prof-budget">js heap limit {s.jsHeapLimitMB}MB</div> : null}
</section>
diff --git a/desktop/src/theme/app.css b/desktop/src/theme/app.css
index 081c5a8f0..5b29b1162 100644
--- a/desktop/src/theme/app.css
+++ b/desktop/src/theme/app.css
@@ -361,7 +361,7 @@ body.thumb-capture .viewport__play-stop {
/* Draggable radius handle (Point/Spot) — write the light's radius on canvas. */
.viewport__light-svg .lg-handle {
fill: currentColor;
- stroke: #1a1a1a;
+ stroke: var(--srf-2);
stroke-width: 1.5;
pointer-events: auto;
cursor: ew-resize;
@@ -380,16 +380,16 @@ body.thumb-capture .viewport__play-stop {
}
.viewport__collider-gizmo .cl-box,
.viewport__collider-gizmo .cl-circle {
- fill: rgba(0, 220, 130, 0.06);
- stroke: #00dc82;
+ fill: color-mix(in srgb, var(--gizmo-collider) 6%, transparent);
+ stroke: var(--gizmo-collider);
stroke-width: 1.5;
opacity: 0;
}
/* Draggable handles — circle radius / box corner size (meters), written on canvas. */
.viewport__collider-gizmo .cl-handle,
.viewport__collider-gizmo .cl-size-handle {
- fill: #00dc82;
- stroke: #1a1a1a;
+ fill: var(--gizmo-collider);
+ stroke: var(--srf-2);
stroke-width: 1.5;
pointer-events: auto;
cursor: ew-resize;
@@ -408,8 +408,8 @@ body.thumb-capture .viewport__play-stop {
z-index: 2;
pointer-events: none;
will-change: transform;
- transition: opacity 0.1s;
- color: #ffb454;
+ transition: opacity var(--t-fast);
+ color: var(--gizmo-particle);
}
.viewport__particle-hit {
position: absolute;
@@ -442,8 +442,8 @@ body.thumb-capture .viewport__play-stop {
}
.viewport__particle-shape .pe-poly,
.viewport__particle-shape .pe-circle {
- fill: rgba(255, 180, 84, 0.05);
- stroke: #ffb454;
+ fill: color-mix(in srgb, var(--gizmo-particle) 5%, transparent);
+ stroke: var(--gizmo-particle);
stroke-width: 1.5;
opacity: 0;
}
@@ -451,8 +451,8 @@ body.thumb-capture .viewport__play-stop {
.viewport__particle-shape .pe-handle,
.viewport__particle-shape .pe-size-handle,
.viewport__particle-shape .pe-angle-handle {
- fill: #ffb454;
- stroke: #1a1a1a;
+ fill: var(--gizmo-particle);
+ stroke: var(--srf-2);
stroke-width: 1.5;
pointer-events: auto;
cursor: ew-resize;
@@ -466,7 +466,7 @@ body.thumb-capture .viewport__play-stop {
.viewport__particle-shape .pe-handle:hover,
.viewport__particle-shape .pe-size-handle:hover,
.viewport__particle-shape .pe-angle-handle:hover {
- fill: #ffd08a;
+ fill: color-mix(in srgb, var(--gizmo-particle) 70%, white);
}
.viewport__playflag {
@@ -498,9 +498,9 @@ body.thumb-capture .viewport__play-stop {
font-size: var(--fs-xs);
font-weight: 600;
letter-spacing: 0.06em;
- color: #58b6e6;
+ color: var(--gizmo-tile);
background: rgba(var(--glass-rgb), 0.8);
- border: 1px solid rgba(88, 182, 230, 0.5);
+ border: 1px solid color-mix(in srgb, var(--gizmo-tile) 50%, transparent);
padding: 4px 12px;
border-radius: 999px;
pointer-events: none;
diff --git a/desktop/src/theme/controls.css b/desktop/src/theme/controls.css
index 4ebf493a6..e8ee8a849 100644
--- a/desktop/src/theme/controls.css
+++ b/desktop/src/theme/controls.css
@@ -30,6 +30,8 @@
.seg button.ic { width: 26px; padding: 0; }
.seg button:hover:not(.on) { color: var(--text); }
.seg button.on { background: var(--acc); color: var(--on-accent); }
+.seg.grow { display: flex; }
+.seg.grow button { flex: 1; }
/* — Select trigger, standalone input look (components/Select.tsx). The 'field'
variant reuses the inspector's .dd-trigger; the popover list is the shared
diff --git a/desktop/src/theme/outliner.css b/desktop/src/theme/outliner.css
index c75a8d263..e90a38f3b 100644
--- a/desktop/src/theme/outliner.css
+++ b/desktop/src/theme/outliner.css
@@ -119,8 +119,6 @@
.row.folder .rname { color: var(--text); }
.row.sel.folder .rname { color: var(--on-accent); } /* selected folder reads white on the blue fill */
-/* World picker (UE5): switch the Outliner/Details between edit + live game. */
-.world-pick { display: flex; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
-.world-pick button { flex: 1; height: 24px; font-size: var(--fs-xs); color: var(--text-mute); background: var(--srf-3); border-radius: var(--r-sm); transition: color var(--t-fast), background var(--t-fast); }
-.world-pick button.on { color: var(--on-accent); background: var(--acc); }
-.world-pick button:hover:not(.on) { color: var(--text); }
+/* World picker (UE5): switch the Outliner/Details between edit + live game —
+ a full-width shared Segmented; only the row placement is outliner-specific. */
+.world-pick { padding: 6px 8px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
diff --git a/desktop/src/theme/profiler.css b/desktop/src/theme/profiler.css
index 4fe8bd06c..955a4384a 100644
--- a/desktop/src/theme/profiler.css
+++ b/desktop/src/theme/profiler.css
@@ -105,8 +105,8 @@
.prof-val { color: var(--text-hi); text-align: right; }
.prof-na { color: var(--text-faint); }
.prof-unit { color: var(--text-faint); margin-left: 1px; }
-.prof-bar { height: 6px; border-radius: 3px; background: var(--srf-1, rgba(255, 255, 255, 0.05)); overflow: hidden; }
-.prof-fill { display: block; height: 100%; border-radius: 3px; transition: width 0.25s var(--e-out, ease-out); }
+.prof-bar { height: 6px; border-radius: var(--r-sm); background: var(--srf-1); overflow: hidden; }
+.prof-fill { display: block; height: 100%; border-radius: var(--r-sm); transition: width var(--t-slow) var(--e-out); }
/* Pinned-frame breakdown rows — name (ellipsis) + right-aligned value, so the two
never collide however long the zone/system name is. */
diff --git a/desktop/src/theme/sequencer.css b/desktop/src/theme/sequencer.css
index b193b4add..72bf1de07 100644
--- a/desktop/src/theme/sequencer.css
+++ b/desktop/src/theme/sequencer.css
@@ -39,7 +39,7 @@
height: 24px; min-width: 24px; padding: 0 5px;
border: 0; border-radius: var(--r-md);
background: transparent; color: var(--text-dim); cursor: pointer;
- transition: background 120ms var(--e-out), color 120ms var(--e-out);
+ transition: background var(--t-fast) var(--e-out), color var(--t-fast) var(--e-out);
}
.seq-btn:hover:not(:disabled) { background: var(--raised); color: var(--text); }
.seq-btn:disabled { opacity: 0.4; cursor: default; }
@@ -89,10 +89,10 @@
.seq-row__label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seq-row--channel .seq-row__label { color: var(--text-dim); font-family: var(--mono); font-size: var(--fs-xs); }
.seq-row--track .seq-row__label { color: var(--text-dim); }
-.seq-row__chev { color: var(--text-mute); transition: transform 150ms var(--e-out); flex: none; }
+.seq-row__chev { color: var(--text-mute); transition: transform var(--t) var(--e-out); flex: none; }
.seq-row__chev.is-collapsed { transform: rotate(-90deg); }
.seq-row__chev--leaf { width: 12px; height: 12px; }
-.seq-row__act { display: inline-flex; gap: 1px; opacity: 0; transition: opacity 120ms; }
+.seq-row__act { display: inline-flex; gap: 1px; opacity: 0; transition: opacity var(--t-fast); }
.seq-row:hover .seq-row__act { opacity: 1; }
.seq-row__btn { border: 0; background: transparent; color: var(--text-mute); cursor: pointer; padding: 2px; border-radius: var(--r-xs); }
.seq-row__btn:hover:not(:disabled) { color: var(--text); background: var(--raised); }
diff --git a/desktop/src/theme/tokens.css b/desktop/src/theme/tokens.css
index c0d808684..1abd61eea 100644
--- a/desktop/src/theme/tokens.css
+++ b/desktop/src/theme/tokens.css
@@ -77,6 +77,13 @@
--ax-y: #80b94a;
--ax-z: #4a8fd6;
+ /* — Viewport gizmo identity: high-visibility strokes drawn over scene art
+ (collider green, particle-shape amber, tile-paint cyan). Distinct from
+ the muted panel palette on purpose — gizmos must survive any backdrop. — */
+ --gizmo-collider: #00dc82;
+ --gizmo-particle: #ffb454;
+ --gizmo-tile: #58b6e6;
+
/* — Category identity: component header bars / icons read by domain. — */
--cat-transform: #4a8fd6;
--cat-render: #b272d6;
diff --git a/desktop/src/theme/viewport.css b/desktop/src/theme/viewport.css
index e194671cd..18d98ec5e 100644
--- a/desktop/src/theme/viewport.css
+++ b/desktop/src/theme/viewport.css
@@ -11,7 +11,7 @@
align-items: center;
gap: 1px;
padding: 3px;
- background: rgba(18, 18, 21, 0.72);
+ background: rgba(var(--glass-rgb), 0.72);
-webkit-backdrop-filter: blur(16px) saturate(1.1);
backdrop-filter: blur(16px) saturate(1.1);
border: 1px solid var(--border-line);
@@ -63,7 +63,7 @@
position: absolute;
top: calc(100% + 6px);
min-width: 188px;
- background: rgba(24, 24, 28, 0.96);
+ background: rgba(var(--glass-rgb), 0.96);
-webkit-backdrop-filter: blur(20px);
backdrop-filter: blur(20px);
border: 1px solid var(--border-line);
@@ -132,7 +132,7 @@
z-index: 4;
min-width: 128px;
padding: 7px 9px;
- background: rgba(18, 18, 21, 0.72);
+ background: rgba(var(--glass-rgb), 0.72);
-webkit-backdrop-filter: blur(14px);
backdrop-filter: blur(14px);
border: 1px solid var(--border-line);
@@ -163,7 +163,7 @@
pointer-events: none;
}
.vp-coord .ro {
- background: rgba(18, 18, 21, 0.72);
+ background: rgba(var(--glass-rgb), 0.72);
-webkit-backdrop-filter: blur(14px);
backdrop-filter: blur(14px);
border: 1px solid var(--border-line);
@@ -172,11 +172,11 @@
width: max-content;
}
.vp-coord .ro strong { color: var(--text); }
-.vp-coord .ro .hud-tile { color: #58b6e6; }
+.vp-coord .ro .hud-tile { color: var(--gizmo-tile); }
.vp-coord .hint { color: var(--text-mute); font-family: var(--sans); padding-left: 2px; }
/* Play In Viewport (UE5 PIE): the realm iframe overlays the stage while playing. */
-.viewport__play { position: absolute; inset: 0; z-index: 6; background: #0e121b; }
+.viewport__play { position: absolute; inset: 0; z-index: 6; background: var(--srf-1); }
.viewport__play-host { position: absolute; inset: 0; }
.viewport__play-host iframe { width: 100%; height: 100%; border: 0; display: block; }
.viewport__play-status {
@@ -213,7 +213,7 @@
.viewport__play-stop:hover { background: var(--run-hi); }
/* Game view (isolated play realm iframe) — REARCH_EDITOR_REALM Phase R. */
-.game-panel { position: relative; width: 100%; height: 100%; background: #0e121b; overflow: hidden; }
+.game-panel { position: relative; width: 100%; height: 100%; background: var(--srf-1); overflow: hidden; }
.game-panel__host { position: absolute; inset: 0; }
.game-panel__overlay {
position: absolute;