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.

feat(gates): a CSS variable that nothing defines is refused

esenginee3364bbaae8b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bd72771e0..5e5f36034 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -33,6 +33,12 @@ published separately; it ships inside the editor.
and every published entry declares itself side-effectful so a game's own bundler cannot
repeat it with `esengine/physics3d`.
+- **The Inspector's effect stack draws its toggle, its rows and its Add button again.**
+ Ten declarations named six CSS variables this editor does not have — `--accent` where the
+ token is `--acc`, `--bg-inset` where it is `--inset`, and four more. CSS has no
+ unknown-variable error, so each one simply did not draw: a checked toggle with no fill, a
+ row with no background, and an "Add effect" button whose dashed box was never there.
+
- **space-shooter's background no longer stretches a 256px starfield over the whole screen.**
The texture was drawn to tile — 256×256, wrap mode repeat — and the scene stretched it over a
600×1080 box, so every star drew 2.3× wider and 4.2× taller than it was painted. It tiles.
diff --git a/desktop b/desktop
index 9840725c4..226af3879 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit 9840725c4be44073782cd2ba3d2b56b1ec846c71
+Subproject commit 226af3879fadba3819ad4a1d350a407fbe537fa1
diff --git a/tools/check-theme.mjs b/tools/check-theme.mjs
index ef05ecfbf..6d013312a 100644
--- a/tools/check-theme.mjs
+++ b/tools/check-theme.mjs
@@ -173,6 +173,39 @@ for (const file of everyFile(SRC_DIR)) {
}
}
+/**
+ * A `var(--x)` with no `--x` anywhere. CSS says nothing and draws nothing, so a
+ * filled toggle loses its fill and a dashed border disappears — silently, since
+ * there is no such thing as an unknown-variable error.
+ *
+ * Only a bare `var(--x)`: one with a fallback has an answer either way.
+ */
+const declaredAnywhere = (text) => {
+ const out = new Set();
+ // A declaration is a declaration wherever it sits — a single-line rule defines
+ // too, and reading only line starts reported `--ag-tone` as dead.
+ for (const m of text.matchAll(/(?:^|[{;\s])(--[A-Za-z0-9_-]+)\s*:/g)) out.add(m[1]);
+ // A script sets one as a style-object key or through setProperty.
+ for (const m of text.matchAll(/[`"'](--[A-Za-z0-9_-]+)[`"']/g)) out.add(m[1]);
+ return out;
+};
+
+{
+ const files = everyFile(SRC_DIR);
+ const defined = new Set();
+ for (const f of files) for (const n of declaredAnywhere(uncomment(readFileSync(f, 'utf8')))) defined.add(n);
+ for (const file of files) {
+ const rel = path.relative(SRC_DIR, file).replaceAll(path.sep, '/');
+ const text = uncomment(readFileSync(file, 'utf8'));
+ for (const m of text.matchAll(/var\(\s*(--[A-Za-z0-9_-]+)\s*([,)])/g)) {
+ if (m[2] === ',' || defined.has(m[1])) continue;
+ const line = text.slice(0, m.index).split('\n').length;
+ problems.push(`desktop/src/${rel}:${line}: ${m[1]} is used and never defined — `
+ + 'the declaration resolves to nothing and draws nothing');
+ }
+ }
+}
+
/**
* Spacing that is not on the 4px grid, per file. A count rather than a line, so
* inserting a rule does not churn the baseline; per file, so a fix in one place
diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjs
index a3fb4f508..9221bf8d5 100644
--- a/tools/releaseNotes.mjs
+++ b/tools/releaseNotes.mjs
@@ -28,6 +28,12 @@ export const NOTES_FLOOR = 'v0.65.0';
* the reader recognises anyway.
*/
export const NOTED = {
+ 'fix(editor): six CSS variables that were never defined, so they drew nothing':
+ { note: "The Inspector's effect stack draws its toggle, its rows and its Add button again." },
+
+ 'feat(gates): a CSS variable that nothing defines is refused':
+ { internal: "A repository gate over the editor's own stylesheets; no creator runs it." },
+
'fix(examples): the starfield tiles, as its texture was drawn to':
{ note: "space-shooter's background no longer stretches a 256px starfield over the whole screen." },