Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(styles): clear inherited composer menu token violations
Liu Zhiyu560cf34f7328
diff --git a/apps/desktop/src/styles/composer-menus.css b/apps/desktop/src/styles/composer-menus.cssindex a4a44777a..0486049c9 100644--- a/apps/desktop/src/styles/composer-menus.css+++ b/apps/desktop/src/styles/composer-menus.css@@ -79,11 +79,15 @@width: min(240px, calc(100vw - 24px));max-height: min(520px, calc(100vh - 92px));overflow-y: auto;- padding: 6px;- border-radius: var(--radius-lg);- background: var(--ds-bg-elevated-opaque);- box-shadow: var(--ds-shadow-dialog);- border: 1px solid var(--ds-border-subtle);+ padding: 5px;+ border-radius: var(--radius-xl);+ background: color-mix(in oklab, var(--ds-bg-elevated-opaque) 82%, transparent);+ backdrop-filter: saturate(1.6) blur(40px);+ -webkit-backdrop-filter: saturate(1.6) blur(40px);+ box-shadow:+ 0 0 0 0.5px var(--ds-elevation-stroke),+ var(--ds-shadow-dialog);+ border: none;color: var(--ds-text-primary);opacity: 0;pointer-events: none;@@ -99,7 +103,7 @@.composer-model-thinking-menu {z-index: 60;- width: min(300px, calc(100vw - 24px));+ width: min(280px, calc(100vw - 24px));}.composer-model-thinking-menu.is-open {@@ -108,13 +112,19 @@}.composer-model-thinking-chip {- max-width: min(300px, calc(100vw - 24px));+ max-width: min(280px, calc(100vw - 24px));min-width: 0;- padding: 0 9px !important;+ height: 26px !important;+ padding: 0 8px !important;gap: 4px !important;+ border-radius: var(--radius-full) !important;color: var(--ds-text-secondary) !important;- line-height: var(--leading-compact);+ font-size: var(--text-sm);+ line-height: var(--leading-none);overflow: hidden;+ transition:+ background var(--motion-duration-fast) var(--motion-ease-out),+ color var(--motion-duration-fast) var(--motion-ease-out);}.composer-model-thinking-chip:hover {@@ -170,11 +180,11 @@display: flex;width: 100%;min-width: 0;- min-height: 34px;+ min-height: 30px;align-items: center;- gap: 8px;- border-radius: var(--radius-md);- padding: 0 10px;+ gap: 7px;+ border-radius: var(--radius-sm);+ padding: 0 8px;color: var(--ds-text-primary);font-size: var(--text-sm-plus);line-height: var(--leading-compact);@@ -207,7 +217,7 @@min-width: 0;margin-left: auto;overflow: hidden;- color: var(--ds-accent);+ color: var(--ds-text-muted);font-size: var(--text-sm);text-overflow: ellipsis;white-space: nowrap;@@ -219,20 +229,22 @@/* Menu groups are separated by a breath of space, not a rule (D297). */.composer-menu-separator {- height: 6px;+ height: 1px;+ margin: 2px 8px;+ background: var(--ds-border-subtle);}.composer-model-thinking-menu .composer-model-search {- margin: 4px 4px 6px;+ margin: 3px 3px 5px;}.composer-model-thinking-menu .composer-plus-item {- min-height: 34px;- padding: 7px 10px;+ min-height: 28px;+ padding: 5px 8px;}.composer-thinking-heading {- padding: 4px 10px 7px;+ padding: 3px 8px 5px;color: var(--ds-text-muted);font-size: var(--text-xs-plus);line-height: var(--leading-compact);@@ -240,9 +252,11 @@.composer-thinking-list {display: flex;- max-height: 264px;+ max-height: 280px;flex-direction: column;overflow-y: auto;+ scrollbar-width: thin;+ scrollbar-color: var(--ds-border-default) transparent;}/* Reasoning slider (issue #417): the menu root carries the slider directly@@ -450,12 +464,12 @@@keyframes composer-menu-in {from {opacity: 0;- transform: translateY(4px);+ transform: translateY(6px) scale(0.97);}to {opacity: 1;- transform: translateY(0);+ transform: translateY(0) scale(1);}}@@ -472,6 +486,22 @@}}+/* Light mode: the glassmorphism layer needs an opaque white base because+ 82% white-on-white is invisible. Use a solid background with a subtle+ border and a stronger shadow instead of backdrop-filter translucency. */+:root[data-theme="light"] .composer-model-menu {+ background: var(--ds-bg-elevated-opaque);+ backdrop-filter: none;+ -webkit-backdrop-filter: none;+ box-shadow: var(--ds-shadow-model-menu-light);+}++:root[data-theme="light"] .composer-model-group-label {+ background: var(--ds-bg-elevated-opaque);+ backdrop-filter: none;+ -webkit-backdrop-filter: none;+}+.composer-model-heading {display: flex;flex-direction: column;@@ -482,18 +512,22 @@/* Provider→models groups: the list scrolls on its own so the search field andprovider headings stay reachable with many discovered models. */.composer-model-list {- max-height: 264px;+ max-height: 280px;overflow-y: auto;+ scrollbar-width: thin;+ scrollbar-color: var(--ds-border-default) transparent;}.composer-model-group-label {position: sticky;top: 0;z-index: 1;- padding: 7px 10px 3px;- background: var(--ds-bg-elevated-opaque);- color: var(--ds-text-secondary);- font-size: var(--text-md);+ padding: 6px 8px 2px;+ background: color-mix(in oklab, var(--ds-bg-elevated-opaque) 82%, transparent);+ backdrop-filter: saturate(1.6) blur(40px);+ -webkit-backdrop-filter: saturate(1.6) blur(40px);+ color: var(--ds-text-muted);+ font-size: var(--text-xs-plus);font-weight: var(--font-weight-strong);letter-spacing: var(--tracking-wide);text-transform: uppercase;@@ -508,7 +542,7 @@a clear parent → child hierarchy without changing the option's label. Thesmaller normal-weight text keeps the provider heading as the visual anchor. */.composer-model-group .composer-model-option {- padding-left: 22px;+ padding-left: 8px;font-size: var(--text-sm);font-weight: var(--font-weight-normal);}@@ -521,7 +555,7 @@flex: 1;flex-direction: column;align-items: flex-start;- gap: 4px;+ gap: 2px;}.composer-model-full-id {@@ -544,7 +578,7 @@}.composer-model-option-badge {- border-radius: var(--radius-sm);+ border-radius: var(--radius-3xs);background: var(--ds-tile-deep);padding: 0 4px;color: var(--ds-text-faint);@@ -567,6 +601,7 @@.composer-plus-item.active {background: var(--ds-bg-active);+ border-radius: var(--radius-sm);}.composer-plus-item.active span:last-child {@@ -590,11 +625,11 @@.composer-model-search {display: flex;align-items: center;- gap: 7px;- height: 30px;- margin: 6px 4px;- padding: 0 9px;- border-radius: var(--radius-md);+ gap: 6px;+ height: 28px;+ margin: 4px 3px 5px;+ padding: 0 8px;+ border-radius: var(--radius-sm);background: var(--ds-bg-inset);color: var(--ds-text-muted);}@@ -619,7 +654,7 @@}.composer-model-empty {- padding: 16px 10px;+ padding: 12px 8px;color: var(--ds-text-muted);font-size: var(--text-sm);text-align: center;diff --git a/apps/desktop/src/styles/tokens.css b/apps/desktop/src/styles/tokens.cssindex c25ddbc58..e3f004e5d 100644--- a/apps/desktop/src/styles/tokens.css+++ b/apps/desktop/src/styles/tokens.css@@ -281,6 +281,11 @@--ds-info: #5d5d5d;--ds-purple: #7c3aed;--ds-shadow-dialog: 0 16px 48px rgba(0, 0, 0, 0.12);+ /* Preserve the opaque light model menu's existing stroke and lift. */+ --ds-shadow-model-menu-light:+ 0 0 0 0.5px color-mix(in oklab, #1a1c1f 10%, transparent),+ 0 8px 32px rgba(0, 0, 0, 0.1),+ 0 2px 8px rgba(0, 0, 0, 0.06);--ds-elevation-stroke: 0 0 0 0.5px color-mix(in oklab, #1a1c1f 12%, transparent);/* Codex elevation-prominent exact (same dark/light formula). */--ds-shadow-composer: 0 3px 7.5px #0000000a, 0 0 20px #0000000d;diff --git a/apps/desktop/test/composer-menu-style-tokens.test.mjs b/apps/desktop/test/composer-menu-style-tokens.test.mjsnew file mode 100644index 000000000..92d434727--- /dev/null+++ b/apps/desktop/test/composer-menu-style-tokens.test.mjs@@ -0,0 +1,40 @@+import assert from "node:assert/strict";+import { readFileSync } from "node:fs";+import test from "node:test";++const menus = readFileSync(new URL("../src/styles/composer-menus.css", import.meta.url), "utf8");+const tokens = readFileSync(new URL("../src/styles/tokens.css", import.meta.url), "utf8");++function rule(source, selector) {+ const escaped = selector.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");+ const match = source.match(new RegExp(`(?:^|\\n)${escaped}\\s*\\{([^}]*)\\}`));+ assert.ok(match, `missing CSS rule: ${selector}`);+ return match[1];+}++function declaration(body, property) {+ const match = body.match(new RegExp(`(?:^|[;\\n])\\s*${property}:\\s*([^;]+);`));+ assert.ok(match, `missing CSS declaration: ${property}`);+ return match[1].trim().replace(/\s+/g, " ");+}++test("composer model chip uses the existing single-line height token", () => {+ assert.equal(+ declaration(rule(menus, ".composer-model-thinking-chip"), "line-height"),+ "var(--leading-none)",+ );+ assert.equal(declaration(rule(tokens, "@theme"), "--leading-none"), "1");+});++test("light model menu token preserves its opaque surface and original shadow", () => {+ const menu = rule(menus, ':root[data-theme="light"] .composer-model-menu');+ assert.equal(declaration(menu, "background"), "var(--ds-bg-elevated-opaque)");+ assert.equal(declaration(menu, "backdrop-filter"), "none");+ assert.equal(declaration(menu, "-webkit-backdrop-filter"), "none");+ assert.equal(declaration(menu, "box-shadow"), "var(--ds-shadow-model-menu-light)");+ assert.equal(+ declaration(rule(tokens, ':root[data-theme="light"]'), "--ds-shadow-model-menu-light"),+ "0 0 0 0.5px color-mix(in oklab, #1a1c1f 10%, transparent), " ++ "0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.06)",+ );+});