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): menus.css joins the token ladder; build config on Segmented

yhhfc886eaf8e0b
diff --git a/desktop/src/components/BuildDialog.tsx b/desktop/src/components/BuildDialog.tsx
index 78309fa8d..2692db4fa 100644
--- a/desktop/src/components/BuildDialog.tsx
+++ b/desktop/src/components/BuildDialog.tsx
@@ -13,6 +13,7 @@
import { useState, useSyncExternalStore } from 'react';
import { Loader2, FolderOpen, CheckCircle2, AlertCircle, Boxes, Info, Copy, ExternalLink } from 'lucide-react';
import { Modal } from '@/components/Modal';
+import { Segmented } from '@/components/Segmented';
import { ProjectStore } from '@/project/ProjectStore';
import { useEditorStore } from '@/store/editorStore';
@@ -213,14 +214,15 @@ export function BuildDialog() {
<div className="build__row">
<span className="build__label">Configuration</span>
- <div className="build__seg">
- <button type="button" className={config === 'development' ? 'on' : ''} onClick={() => setConfig('development')}>
- Development
- </button>
- <button type="button" className={config === 'shipping' ? 'on' : ''} onClick={() => setConfig('shipping')}>
- Shipping
- </button>
- </div>
+ <Segmented
+ ariaLabel="Configuration"
+ value={config}
+ options={[
+ { value: 'development', label: 'Development' },
+ { value: 'shipping', label: 'Shipping' },
+ ]}
+ onChange={setConfig}
+ />
</div>
<div className="build__row">
diff --git a/desktop/src/theme/menus.css b/desktop/src/theme/menus.css
index 7b3efe315..36b288c94 100644
--- a/desktop/src/theme/menus.css
+++ b/desktop/src/theme/menus.css
@@ -8,7 +8,7 @@
/* ════════════════════════ Context menu ════════════════════════ */
.ctx {
position: fixed;
- z-index: 140;
+ z-index: var(--z-menu);
min-width: 184px;
background: var(--srf-3);
border: 1px solid var(--border-line);
@@ -49,7 +49,7 @@
etc.). Non-interactive and below the context menu so a menu always wins. */
.tooltip {
position: fixed;
- z-index: 135;
+ z-index: var(--z-tooltip);
min-width: 180px;
max-width: 340px;
padding: 8px 10px;
@@ -65,7 +65,7 @@
.ac-scrim {
position: fixed;
inset: 0;
- z-index: 122;
+ z-index: var(--z-dialog);
background: var(--overlay);
display: flex;
justify-content: center;
@@ -109,7 +109,7 @@
.modal-backdrop {
position: fixed;
inset: 0;
- z-index: 200;
+ z-index: var(--z-dialog);
display: grid;
place-items: center;
background: rgba(0, 0, 0, 0.5);
@@ -151,14 +151,11 @@
.build__platforms { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.build__plat { position: relative; height: 54px; display: grid; place-items: center; font-size: var(--fs-sm); color: var(--text-dim); background: var(--srf-3); border: 1px solid var(--border-line); border-radius: var(--r-md); transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast); }
.build__plat:not(:disabled):hover { color: var(--text); border-color: var(--text-mute); }
-.build__plat.on { color: #fff; background: var(--acc); border-color: var(--acc); }
+.build__plat.on { color: var(--on-accent); background: var(--acc); border-color: var(--acc); }
.build__plat:disabled { opacity: 0.5; }
.build__plat .soon { position: absolute; bottom: 5px; font-size: var(--fs-3xs); text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-mute); }
.build__row { display: flex; align-items: center; gap: 12px; }
.build__row .build__label { width: 92px; flex-shrink: 0; }
-.build__seg { display: flex; gap: 1px; background: var(--inset); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 1px; }
-.build__seg button { height: 24px; padding: 0 12px; font-size: var(--fs-xs); color: var(--text-mute); border-radius: var(--r-xs); transition: color var(--t-fast), background var(--t-fast); }
-.build__seg button.on { color: #fff; background: var(--acc); }
.build__out { flex: 1; display: flex; gap: 6px; }
.build__out input { flex: 1; min-width: 0; height: 26px; padding: 0 8px; font-size: var(--fs-xs); font-family: var(--mono); color: var(--text); background: var(--inset); border: 1px solid var(--border); border-radius: var(--r-sm); outline: none; }
.build__out input:focus { border-color: var(--acc); }
diff --git a/desktop/src/theme/tokens.css b/desktop/src/theme/tokens.css
index 1abd61eea..07b2e821d 100644
--- a/desktop/src/theme/tokens.css
+++ b/desktop/src/theme/tokens.css
@@ -137,13 +137,13 @@
/* — Stacking ladder: global overlay tiers, bottom → top. Panel-local
stacking (z 1–20) stays literal. Same-tier surfaces resolve by DOM
- order. (menus.css still carries literals inside these tiers: 122
- drawer-adjacent, 135 tooltip, 140 palette scrim, 200 context menu.) — */
+ order (a menu summoned from a dialog mounts later, so it wins). — */
--z-toolbar: 40; /* sticky shell chrome above panel content */
--z-drawer: 100; /* content-drawer scrim; drawer +1; statusbar +3 */
- --z-dialog: 124; /* dialog scrims + windows (Settings, Modal) */
- --z-popover: 150; /* anchored popovers/dropdowns — above dialogs, below menus */
- --z-menu: 200; /* context menus, menubar dropdowns, command palettes */
+ --z-dialog: 124; /* dialog/palette scrims + windows (Settings, Modal, pickers) */
+ --z-tooltip: 135; /* hover cards — above dialogs, below interactive floats */
+ --z-popover: 150; /* anchored popovers/dropdowns */
+ --z-menu: 200; /* context menus + menubar dropdowns */
--z-toast: 2000; /* transient toasts above everything */
/* — Elevation — */