Skip to content

Commit 9399cb9

Browse files
committed
Cover e2e theme variants and light surfaces
1 parent 7a98682 commit 9399cb9

6 files changed

Lines changed: 101 additions & 19 deletions

File tree

packages/web/src/styles/base.css

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -485,18 +485,34 @@ textarea::placeholder {
485485
place-items: center;
486486
padding: var(--sp-8);
487487
background:
488-
radial-gradient(circle at top, rgba(120, 215, 178, 0.08), transparent 36%),
489-
radial-gradient(circle at bottom right, rgba(108, 182, 255, 0.1), transparent 34%),
490-
linear-gradient(180deg, rgba(17, 24, 31, 0.92), rgba(10, 16, 20, 0.98));
488+
radial-gradient(
489+
circle at top,
490+
color-mix(in srgb, var(--accent-green) 10%, transparent),
491+
transparent 36%
492+
),
493+
radial-gradient(
494+
circle at bottom right,
495+
color-mix(in srgb, var(--accent-blue) 12%, transparent),
496+
transparent 34%
497+
),
498+
linear-gradient(
499+
180deg,
500+
color-mix(in srgb, var(--bg-page) 88%, var(--bg-surface) 12%),
501+
var(--bg-page)
502+
);
491503
}
492504

493505
.app-loading-card {
494506
width: min(520px, 100%);
495507
padding: var(--sp-8);
496508
border: 1px solid var(--border);
497509
border-radius: var(--radius-2xl);
498-
background: linear-gradient(180deg, rgba(17, 24, 31, 0.96), rgba(13, 20, 26, 0.94));
499-
box-shadow: 0 18px 56px rgba(0, 0, 0, 0.42);
510+
background: linear-gradient(
511+
180deg,
512+
color-mix(in srgb, var(--bg-surface) 98%, white 2%),
513+
color-mix(in srgb, var(--bg-surface) 84%, var(--bg-page) 16%)
514+
);
515+
box-shadow: var(--shadow-xl);
500516
}
501517

502518
.app-loading-kicker {
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// @vitest-environment node
2+
import { readFileSync } from "node:fs";
3+
import { describe, expect, it } from "vitest";
4+
5+
const stylesheet = readFileSync(`${process.cwd()}/src/styles/base.css`, "utf8");
6+
7+
function getRuleBlock(selector: string) {
8+
const matcher = /([^{}]+)\{([^}]*)\}/g;
9+
let match: RegExpExecArray | null = null;
10+
const normalizedSelector = selector.replace(/\s+/g, " ").trim();
11+
12+
while ((match = matcher.exec(stylesheet)) !== null) {
13+
const selectors = match[1]
14+
.replace(/\/\*[\s\S]*?\*\//g, "")
15+
.split(",")
16+
.map((entry) => entry.replace(/\s+/g, " ").trim());
17+
18+
if (selectors.includes(normalizedSelector)) {
19+
return match[2];
20+
}
21+
}
22+
23+
throw new Error(`expected CSS rule for ${selector}`);
24+
}
25+
26+
describe("base.css theme-sensitive shells", () => {
27+
it("keeps the app loading shell on theme tokens instead of dark-only gradients", () => {
28+
const shell = getRuleBlock(".app-loading-shell");
29+
const card = getRuleBlock(".app-loading-card");
30+
31+
expect(shell).toContain("var(--bg-page)");
32+
expect(shell).not.toContain("rgba(17, 24, 31, 0.92)");
33+
expect(card).toContain("var(--bg-surface)");
34+
expect(card).not.toContain("rgba(17, 24, 31, 0.96)");
35+
});
36+
});

packages/web/src/styles/components.css

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5914,7 +5914,11 @@ textarea.input {
59145914
border-radius: 14px;
59155915
box-shadow: var(--shadow-lg);
59165916
overflow: hidden;
5917-
background: linear-gradient(180deg, rgba(17, 24, 31, 0.96), rgba(11, 18, 24, 0.99));
5917+
background: linear-gradient(
5918+
180deg,
5919+
color-mix(in srgb, var(--bg-terminal) 96%, white 4%),
5920+
color-mix(in srgb, var(--bg-terminal) 88%, var(--bg-page) 12%)
5921+
);
59185922
}
59195923

59205924
.terminal-toolbar {
@@ -6284,7 +6288,11 @@ textarea.input {
62846288
}
62856289

62866290
.session-terminal {
6287-
background: linear-gradient(180deg, rgba(11, 18, 24, 0.98), rgba(9, 15, 20, 1));
6291+
background: linear-gradient(
6292+
180deg,
6293+
color-mix(in srgb, var(--bg-terminal) 98%, white 2%),
6294+
color-mix(in srgb, var(--bg-terminal) 90%, var(--bg-page) 10%)
6295+
);
62886296
}
62896297

62906298
.workspace-empty-content,

packages/web/src/styles/components.theme.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,20 @@ describe("components.css theme-sensitive surfaces", () => {
8484
const activeTab = getLastRuleBlock(".topbar-tab.active");
8585
const emptyCard = getLastRuleBlock(".workspace-empty-inner");
8686
const resolvingCard = getLastRuleBlock(".workspace-resolving-card");
87+
const sessionTerminal = getLastRuleBlock(".session-terminal");
88+
const bottomTerminalShell = getLastRuleBlock(
89+
".workspace-main-area > .bottom-terminal > .bottom-terminal"
90+
);
8791

8892
expect(topbar).toContain("var(--bg-surface)");
8993
expect(activeTab).toContain("var(--bg-active)");
9094
expect(activeTab).not.toContain("rgba(45, 63, 79, 0.92)");
9195
expect(emptyCard).toContain("var(--bg-surface)");
9296
expect(resolvingCard).toContain("var(--bg-surface)");
97+
expect(sessionTerminal).toContain("var(--bg-terminal)");
98+
expect(sessionTerminal).not.toContain("rgba(11, 18, 24, 0.98)");
99+
expect(bottomTerminalShell).toContain("var(--bg-terminal)");
100+
expect(bottomTerminalShell).not.toContain("rgba(17, 24, 31, 0.96)");
93101
});
94102

95103
it("keeps quick actions sized to its label instead of icon-button width", () => {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// @vitest-environment node
2+
import { readFileSync } from "node:fs";
3+
import { describe, expect, it } from "vitest";
4+
import { THEME_IDS } from "../theme";
5+
import { UI_PREVIEW_SCENE_METADATA } from "./scene-metadata";
6+
7+
const source = readFileSync(`${process.cwd()}/src/ui-preview/scene-metadata.ts`, "utf8");
8+
9+
describe("ui preview scene metadata", () => {
10+
it("covers every built-in theme for route-backed workspace scenes", () => {
11+
expect(
12+
UI_PREVIEW_SCENE_METADATA.filter(
13+
(scene) =>
14+
scene.source === "real-route" &&
15+
(scene.id === "workspace-desktop" || scene.id === "workspace-mobile")
16+
).map((scene) => scene.themes)
17+
).toEqual([[...THEME_IDS], [...THEME_IDS]]);
18+
});
19+
20+
it("enumerates concrete theme ids instead of dark/light buckets", () => {
21+
expect(source).not.toContain('themeIdsForKinds("dark", "light")');
22+
});
23+
});

packages/web/src/ui-preview/scene-metadata.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { THEME_IDS, type ThemeKind } from "../theme";
1+
import { THEME_IDS } from "../theme";
22

33
export type UiPreviewSceneDevice = "desktop" | "mobile";
44
export type UiPreviewSceneTheme = (typeof THEME_IDS)[number];
@@ -30,19 +30,10 @@ export interface UiPreviewSceneMetadata {
3030
};
3131
}
3232

33-
const THEME_IDS_BY_KIND = {
34-
dark: THEME_IDS.filter((themeId) => themeId.endsWith("-dark")),
35-
light: THEME_IDS.filter((themeId) => themeId.endsWith("-light")),
36-
} satisfies Record<ThemeKind, readonly string[]>;
37-
3833
function allThemeIds(): UiPreviewSceneTheme[] {
3934
return [...THEME_IDS] as UiPreviewSceneTheme[];
4035
}
4136

42-
function themeIdsForKinds(...kinds: ThemeKind[]): UiPreviewSceneTheme[] {
43-
return kinds.flatMap((kind) => THEME_IDS_BY_KIND[kind]) as UiPreviewSceneTheme[];
44-
}
45-
4637
export const UI_PREVIEW_SCENE_METADATA: UiPreviewSceneMetadata[] = [
4738
{
4839
id: "welcome",
@@ -128,7 +119,7 @@ export const UI_PREVIEW_SCENE_METADATA: UiPreviewSceneMetadata[] = [
128119
source: "real-route",
129120
description: "Desktop workspace shell with seeded workspace, git status, and file tree.",
130121
devices: ["desktop"],
131-
themes: themeIdsForKinds("dark", "light"),
122+
themes: allThemeIds(),
132123
locales: ["zh", "en"],
133124
capture: { selector: ".workspace-page" },
134125
},
@@ -139,7 +130,7 @@ export const UI_PREVIEW_SCENE_METADATA: UiPreviewSceneMetadata[] = [
139130
source: "real-route",
140131
description: "Mobile workspace shell with seeded workspace and no active sessions.",
141132
devices: ["mobile"],
142-
themes: themeIdsForKinds("dark", "light"),
133+
themes: allThemeIds(),
143134
locales: ["zh", "en"],
144135
capture: { selector: "[data-testid='mobile-shell']" },
145136
},

0 commit comments

Comments
 (0)