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.

style(editor): check-theme reads a 1px seam and a nav item for what they are

yhhc88e612d57d7
diff --git a/desktop b/desktop
index 4f5e6f652..a8e70fbe6 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit 4f5e6f65296313e1c5753c989c164a8ccd463790
+Subproject commit a8e70fbe66a6bfcbb4439a3b767038cde1e00481
diff --git a/tools/baselines/theme-drift.json b/tools/baselines/theme-drift.json
index 8740926af..11f712e43 100644
--- a/tools/baselines/theme-drift.json
+++ b/tools/baselines/theme-drift.json
@@ -1,24 +1,5 @@
{
- "spacing": {
- "agent.css": 12,
- "app.css": 1,
- "chrome.css": 1,
- "content.css": 5,
- "controllers.css": 1,
- "controls.css": 2,
- "history.css": 1,
- "inspector.css": 5,
- "menus.css": 3,
- "nodegraph.css": 3,
- "outliner.css": 2,
- "plugins.css": 3,
- "profiler.css": 3,
- "sequencer.css": 1,
- "settings.css": 1,
- "tilemap.css": 1,
- "tileset.css": 1,
- "viewport.css": 5
- },
+ "spacing": {},
"colourLiterals": {},
"colourLiteralsInCode": {},
"rawFontSize": {},
@@ -36,7 +17,6 @@
"30"
],
"strokes": [
- "1.2",
"1.4",
"1.6",
"1.7",
@@ -53,51 +33,41 @@
]
},
"handRolled": {
- "components/AgentCheckpoint.tsx": 2,
- "components/AgentDrawer.tsx": 31,
"components/AudioWavePreview.tsx": 1,
"components/BuildDialog.tsx": 4,
"components/BuildSizePanel.tsx": 1,
"components/ColorControl.tsx": 1,
"components/ErrorBoundary.tsx": 1,
"components/FindingLocations.tsx": 2,
- "components/FindUsagesDialog.tsx": 1,
- "components/MarkdownView.tsx": 1,
"components/OverlayMenu.tsx": 1,
- "components/QuickOpen.tsx": 1,
- "components/SaveButton.tsx": 1,
- "components/SettingsDialog.tsx": 2,
- "components/SettingsRow.tsx": 3,
+ "components/SettingsDialog.tsx": 1,
+ "components/SettingsRow.tsx": 1,
"components/TileLayerMenu.tsx": 1,
- "components/TilemapPickerDialog.tsx": 1,
- "components/Toaster.tsx": 1,
"components/Transport.tsx": 1,
- "launcher/Launcher.tsx": 9,
+ "launcher/Launcher.tsx": 5,
"layout/ActivityBar.tsx": 1,
"layout/DockLayout.tsx": 3,
"layout/MenuBar.tsx": 1,
- "layout/StatusBar.tsx": 6,
+ "layout/StatusBar.tsx": 4,
"layout/SubsystemIndicator.tsx": 1,
"layout/Transport.tsx": 7,
"layout/WindowControls.tsx": 3,
"panels/AnimatorEditor.tsx": 1,
- "panels/ContentBrowser.tsx": 5,
- "panels/ControllersPanel.tsx": 2,
- "panels/Details.tsx": 19,
+ "panels/ContentBrowser.tsx": 3,
+ "panels/ControllersPanel.tsx": 1,
+ "panels/Details.tsx": 6,
"panels/FlipbookEditor.tsx": 3,
- "panels/HistoryPanel.tsx": 5,
+ "panels/HistoryPanel.tsx": 1,
"panels/InputMapEditor.tsx": 1,
- "panels/inspector/componentDecorators.tsx": 9,
- "panels/inspector/controls.tsx": 13,
+ "panels/inspector/componentDecorators.tsx": 7,
+ "panels/inspector/controls.tsx": 8,
"panels/LightingPanel.tsx": 1,
- "panels/Outliner.tsx": 1,
"panels/OutputLog.tsx": 1,
- "panels/ProfilerPanel.tsx": 9,
- "panels/ScatterPanel.tsx": 1,
- "panels/Sequencer.tsx": 7,
+ "panels/ProfilerPanel.tsx": 5,
+ "panels/Sequencer.tsx": 6,
"panels/SpineDiagnosticsSection.tsx": 1,
- "panels/TilemapPainter.tsx": 11,
- "panels/TilesetEditor.tsx": 19,
+ "panels/TilemapPainter.tsx": 3,
+ "panels/TilesetEditor.tsx": 15,
"panels/Viewport.tsx": 3,
"panels/WorldRulesEditor.tsx": 2
}
diff --git a/tools/check-theme.mjs b/tools/check-theme.mjs
index a5150e74a..b29328421 100644
--- a/tools/check-theme.mjs
+++ b/tools/check-theme.mjs
@@ -252,6 +252,10 @@ const offGridByFile = () => {
// spacing step, and read as `5px` it was counted as one.
for (const px of m[1].matchAll(/(?<![\d.])(\d+)px/g)) {
const v = Number(px[1]);
+ // 1px is not a step of the grid but a seam: the hairline between joined
+ // segments (`gap: 1px` showing the groove through), a border's overlap
+ // (`margin: -1px`), a tag's optical inset. Unreal draws its seams the same.
+ if (v === 1) continue;
if (v !== 0 && v % GRID !== 0) n++;
}
}
@@ -391,7 +395,9 @@ const PRIMITIVES = new Set([
'components/Select.tsx', 'components/Segmented.tsx',
]);
-/** A button that declares itself an item of a list, tab strip or menu is not an action button. */
+/** A button that declares itself an item of a list, tab strip or menu is not an action button —
+ * nor is one that marks the current page of a navigation (`aria-current`). */
+const NAV_ITEM = /\baria-current=/;
const ITEM_ROLE = /\brole=(?:"|\{?['"`])(?:option|tab|menuitem|menuitemcheckbox|menuitemradio|radio)\b/;
/**
@@ -408,7 +414,7 @@ const handRolledByFile = () => {
const text = readFileSync(full, 'utf8');
const rel = path.relative(path.join(ROOT, 'desktop', 'src'), full).replaceAll(path.sep, '/');
if (PRIMITIVES.has(rel)) continue;
- const n = [...text.matchAll(/<button\b([^<]*?)\/?>/gs)].filter((m) => !ITEM_ROLE.test(m[1])).length;
+ const n = [...text.matchAll(/<button\b([^<]*?)\/?>/gs)].filter((m) => !ITEM_ROLE.test(m[1]) && !NAV_ITEM.test(m[1])).length;
if (n > 0) out[rel] = n;
}
};