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
feat(editor): Steam is a destination in the build nav, not a row to find
esengine946d4adf0de7
diff --git a/desktop/src/components/BuildDialog.tsx b/desktop/src/components/BuildDialog.tsxindex 977a79598..16ddff97c 100644--- a/desktop/src/components/BuildDialog.tsx+++ b/desktop/src/components/BuildDialog.tsx@@ -28,7 +28,7 @@* rendered here by the same row renderer the settings window uses — which* omits those rows, so each value has exactly one editor.*/-import { useState, useEffect, useSyncExternalStore, type ReactNode } from 'react';+import { useState, useEffect, useSyncExternalStore, Fragment, type ReactNode } from 'react';import {Loader2, FolderOpen, CheckCircle2, AlertCircle, Boxes, Info, Copy, ExternalLink, Play,Globe, Monitor, MessageSquare, ChevronRight, Smartphone, Apple, Package, TriangleAlert, Plus,@@ -45,6 +45,7 @@ import { Select } from '@/components/Select';import { Button } from '@/components/Button';import { Group as SettingsGroup, groupByGroup } from '@/components/SettingsRow';import { settingsRegistry } from '@/settings/registry';+import { useSettings } from '@/store/settingsStore';import { ProjectStore } from '@/project/ProjectStore';import { AssetRegistry } from '@/project/AssetRegistry';import { useEditorStore } from '@/store/editorStore';@@ -279,12 +280,22 @@ export function BuildDialog() {// assets are fetched from for hot update. Written on blur.const [cdnRoot, setCdnRoot] = useState(() => ProjectStore.activeProfileRemoteRoot());+ const setSetting = useSettings((s) => s.setValue);const def = platforms.find((p) => p.id === platform) ?? platforms[0];// Re-derived per render rather than memoized: `visibleWhen` reads the project// (a Steam depot id exists only on a Steam channel), and `project` above is what// re-renders this dialog when that answer changes.const platformSettings = groupByGroup(settingsRegistry.settingsForPlatform(platform));const running = phase === 'running';++ /** The enum a target declares as its nav branch (`navBranch`) — one nav entry+ * per option, so a destination is visible before its page is opened. */+ const navBranchOf = (id: Platform) => {+ const s = settingsRegistry.settingsForPlatform(id)+ .find((x) => x.type === 'enum' && x.navBranch && x.visibleWhen?.() !== false);+ if (!s || s.type !== 'enum') return null;+ return { id: s.id, options: s.options, value: useSettings.getState().getValue<string>(s.id) };+ };// Bumped when something the probes read changes on disk (a runtime template is// installed), so the rows re-probe instead of the dialog having to be reopened.const [probeTick, setProbeTick] = useState(0);@@ -617,25 +628,46 @@ export function BuildDialog() {</button>)}</div>- {items.map((p) => (- <button- key={p.id}- type="button"- className={`build__nav-item${!creating && platform === p.id ? ' active' : ''}`}- aria-current={!creating && platform === p.id}- disabled={running}- title={p.label}- onClick={() => { setCreating(false); pickPlatform(p); }}- >- <span className="build__nav-icon">{p.icon}</span>- <span className="build__nav-label">{p.label}</span>- {p.loadError- ? <AlertCircle size={12} className="build__nav-flag is-error" />- : !p.ready- ? <TriangleAlert size={12} className="build__nav-flag is-warn" />- : null}- </button>- ))}+ {items.map((p) => {+ const branch = navBranchOf(p.id);+ const here = !creating && platform === p.id;+ return (+ <Fragment key={p.id}>+ <button+ type="button"+ className={`build__nav-item${here && !branch ? ' active' : ''}${here && branch ? ' is-open' : ''}`}+ aria-current={here && !branch}+ disabled={running}+ title={p.label}+ onClick={() => { setCreating(false); pickPlatform(p); }}+ >+ <span className="build__nav-icon">{p.icon}</span>+ <span className="build__nav-label">{p.label}</span>+ {p.loadError+ ? <AlertCircle size={12} className="build__nav-flag is-error" />+ : !p.ready+ ? <TriangleAlert size={12} className="build__nav-flag is-warn" />+ : null}+ </button>+ {branch?.options.map((o) => (+ <button+ key={o.value}+ type="button"+ className={`build__nav-sub${here && branch.value === o.value ? ' active' : ''}`}+ aria-current={here && branch.value === o.value}+ disabled={running}+ onClick={() => {+ setCreating(false);+ if (platform !== p.id) pickPlatform(p);+ if (branch.value !== o.value) setSetting(branch.id, o.value);+ }}+ >+ {o.label}+ </button>+ ))}+ </Fragment>+ );+ })}{cat === 'custom' && items.length === 0 && (<div className="build__nav-empty">{t('build.noCustomPlatforms')}</div>)}diff --git a/desktop/src/settings/projectSettings.ts b/desktop/src/settings/projectSettings.tsindex 4e082f273..a2408b1aa 100644--- a/desktop/src/settings/projectSettings.ts+++ b/desktop/src/settings/projectSettings.ts@@ -540,7 +540,7 @@ settingsRegistry.register({group: t('set.group.distribution'),label: t('set.project.packaging.desktop.channel'),description: t('set.project.packaging.desktop.channel.desc'),- options: DESKTOP_CHANNEL, segmented: true, default: 'standalone',+ options: DESKTOP_CHANNEL, segmented: true, navBranch: true, default: 'standalone',bind: {get: () => desktopChannel(),set: (v) => void ProjectStore.setPlatformPackaging('desktop', {diff --git a/desktop/src/settings/types.ts b/desktop/src/settings/types.tsindex 30e2c2765..bb77d6d2c 100644--- a/desktop/src/settings/types.ts+++ b/desktop/src/settings/types.ts@@ -99,6 +99,14 @@ export interface EnumSetting extends BaseSetting<string> {options: { value: string; label: string }[];/** Render as a segmented control instead of a dropdown. */segmented?: boolean;+ /**+ * Also branch this target in the build dialog's nav, one entry per option.+ *+ * For an enum naming WHERE the build goes rather than how it is made: that is+ * the question the left rail already answers, and a destination nobody can see+ * until they open the page is one nobody knows exists.+ */+ navBranch?: boolean;}/** A single-line free-text setting (e.g. a WeChat appid, a desktop product name). */diff --git a/desktop/src/theme/menus.css b/desktop/src/theme/menus.cssindex aaabaac97..b1fc8d33a 100644--- a/desktop/src/theme/menus.css+++ b/desktop/src/theme/menus.css@@ -466,3 +466,25 @@.cp-agent .an { display: flex; align-items: center; gap: 8px; }.cp-agent .an svg { color: var(--text-faint); flex: none; }.cp-agent.sel .an svg { color: var(--star-hi); }++/* A target's destinations, under its nav row: where the build GOES, which the+ left rail already answers, rather than a row found after opening the page. */+.build__nav-sub {+ display: block;+ width: 100%;+ padding: 4px 10px 4px 34px;+ border: none;+ background: none;+ border-radius: var(--r-sm);+ color: var(--text-mute);+ font-size: var(--fs-xs);+ text-align: left;+ cursor: pointer;+ transition: color var(--t-fast), background var(--t-fast);+}+.build__nav-sub:hover { color: var(--text); background: var(--srf-4); }+.build__nav-sub.active { color: var(--acc-hi); background: var(--acc-soft); }+.build__nav-sub:disabled { cursor: default; }+/* The parent of a branched target is not itself a destination: the highlighted+ entry is whichever branch is selected, so the row only reads as expanded. */+.build__nav-item.is-open { color: var(--text); }diff --git a/desktop/tests/packaging-settings-home.test.ts b/desktop/tests/packaging-settings-home.test.tsindex 1af96360e..7611c61bd 100644--- a/desktop/tests/packaging-settings-home.test.ts+++ b/desktop/tests/packaging-settings-home.test.ts@@ -15,7 +15,7 @@ import { settingsRegistry } from '@/settings/registry';import { ProjectStore } from '@/project/ProjectStore';import { BUILTIN_PLATFORMS } from '@/project/platforms';import { platformLabel, unlabeledBuiltins } from '@/project/platformLabels';-import type { ObjectListSetting } from '@/settings/types';+import type { EnumSetting, ObjectListSetting } from '@/settings/types';/** Every registered setting that claims a packaging target. */const targetOwned = () => settingsRegistry.all().filter((s) => s.platform);@@ -116,6 +116,24 @@ describe('a list whose store normalizes rows away', () => {});});+describe('a target whose destinations branch the nav', () => {+ it('is the desktop channel, and its options are the branches', () => {+ const s = settingsRegistry.get('project.packaging.desktop.channel');+ expect(s?.type === 'enum' && s.navBranch).toBe(true);+ expect((s as EnumSetting).options.map((o) => o.value)).toEqual(['standalone', 'steam']);+ });++ it('is the only one, so the nav has one level of branching', () => {+ // The nav takes the FIRST branch a target declares; a second would be+ // silently ignored rather than shown, so there must not be one.+ for (const p of BUILTIN_PLATFORMS) {+ const branches = settingsRegistry.settingsForPlatform(p)+ .filter((s) => s.type === 'enum' && s.navBranch);+ expect(branches.length).toBeLessThanOrEqual(1);+ }+ });+});+describe('rows that only apply on one answer', () => {const visible = (id: string) => settingsRegistry.get(id)!.visibleWhen?.() !== false;// The predicates read the live project, so the packaging accessor is stood in