refactor(web): rebuild the UI in React and Tailwind (#279)
ci / web (push) Successful in 29s
e2e / e2e (push) Successful in 1m31s
ci / rust (push) Successful in 1m41s
ci / image (push) Successful in 3m42s

This commit was merged in pull request #279.
This commit is contained in:
2026-11-11 16:34:47 +00:00
parent e23293c24d
commit 5528ac8aa8
31 changed files with 11435 additions and 10503 deletions
+18 -3
View File
@@ -4,8 +4,13 @@
//
// Every `var(--x)` must name a custom property something defines — a token in
// `:root`, a component-local one in the CSS, or one the TS sets with
// `setProperty` — so a mistyped or deleted token fails here rather than
// silently falling back to the browser default.
// `setProperty` or a React `style` key — so a mistyped or deleted token fails
// here rather than silently falling back to the browser default.
//
// Tailwind's theme is reset to the tokens alone (style.css), so a utility can
// only produce a token value. The one way around that is an arbitrary value
// — `p-[3px]`, `bg-[#fff]` — and those are allowed only when they name a
// token: `p-[var(--space-2)]` or the `p-(--space-2)` shorthand.
//
// Allowed colour literals: inside a `:root` block (token definitions) and
// inside `@font-face`. Relative colour derived from a token —
@@ -27,7 +32,7 @@ function walk(dir, out = []) {
if (!SKIP_DIRS.has(name)) {
walk(path, out);
}
} else if (/\.(css|ts|html)$/.test(name)) {
} else if (/\.(css|tsx?|html)$/.test(name)) {
out.push(path);
}
}
@@ -103,6 +108,8 @@ function checkCss(source, rel) {
}
}
const ARBITRARY = /(?:^|[\s"'`:])!?-?[a-z][\w-]*-\[([^\]\s]+)\]/g;
function checkPlain(source, rel) {
// Comments are prose, not styling — `checkCss` already ignores them, and
// without the same treatment here an issue reference like `#140` reads as a
@@ -115,6 +122,11 @@ function checkPlain(source, rel) {
if (COLOR_LITERAL.test(neutral)) {
errors.push(`${rel}:${index + 1}: literal colour outside the token block`);
}
for (const match of rawLine.matchAll(ARBITRARY)) {
if (!/^var\(--[\w-]+\)$/.test(match[1])) {
errors.push(`${rel}:${index + 1}: arbitrary utility value "[${match[1]}]" — use a token`);
}
}
});
}
@@ -139,6 +151,9 @@ for (const { source } of sources) {
for (const match of source.matchAll(/setProperty\(\s*["'](--[\w-]+)["']/g)) {
defined.add(match[1]);
}
for (const match of source.matchAll(/["'](--[\w-]+)["']\s*:/g)) {
defined.add(match[1]);
}
}
for (const { rel, source } of sources) {
source.split("\n").forEach((line, index) => {