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(settings): give fields and dropdowns one control height
Lane41203f0b18e
diff --git a/apps/desktop/src/features/scheduled/scheduled-editor.css b/apps/desktop/src/features/scheduled/scheduled-editor.cssindex b69ea92fb..d4055fc3d 100644--- a/apps/desktop/src/features/scheduled/scheduled-editor.css+++ b/apps/desktop/src/features/scheduled/scheduled-editor.css@@ -6,7 +6,9 @@}.scheduled-fields > * { min-width: 0; max-width: 100%; }.scheduled-fields .settings-menu-select-trigger {- height: 36px;+ /* The editor is a form: its dropdowns are fields, so they take the shared+ field metric rather than the compact Settings-row pill size. */+ height: var(--ds-field-height);border-radius: var(--radius-md);}.scheduled-weekday-trigger { max-width: min(300px, 100%); }diff --git a/apps/desktop/src/styles/extensions.css b/apps/desktop/src/styles/extensions.cssindex 05e857697..5040c37df 100644--- a/apps/desktop/src/styles/extensions.css+++ b/apps/desktop/src/styles/extensions.css@@ -1053,6 +1053,12 @@line-height: var(--leading-compact);}+/* The sheet's menu trigger is a form control beside those fields, so it takes+ the sheet's compact field height instead of the field vocabulary's metric. */+.ext-sheet .settings-menu-select-trigger {+ height: 34px;+}+.ext-sheet .field-input:hover,.ext-sheet .field-select:hover,.ext-sheet .field-textarea:hover {diff --git a/apps/desktop/src/styles/model-config.css b/apps/desktop/src/styles/model-config.cssindex add9138ca..ec4a437d1 100644--- a/apps/desktop/src/styles/model-config.css+++ b/apps/desktop/src/styles/model-config.css@@ -250,8 +250,12 @@color: var(--ds-text-faint);}+/* A menu search row keeps its compact box. The input inherits the field+ vocabulary's shared height as a minimum, so the row's own metric has to be+ declared as a minimum too or the search would swallow the row. */.provider-service-search input {min-width: 0;+ min-height: 26px;height: 26px;padding: 3px 0;border: 0;@@ -1103,8 +1107,11 @@margin-left: auto;}+/* The row body keeps its own compact field metric (28px inputs and selects), so+ the default-thinking dropdown takes that height instead of a chip-sized box+ that would read as a different control than the fields around it. */.provider-chosen-thinking-select .settings-menu-select-trigger {- height: 24px;+ height: 28px;padding: 0 8px;border-radius: var(--radius-sm);font-size: var(--text-2xs);@@ -1403,6 +1410,9 @@.model-default-search input {min-width: 0;+ /* Same compact metric as the service search above: the default-model menu's+ search row must not inherit the field vocabulary's shared height. */+ min-height: 26px;height: 26px;padding: 3px 0;border: 0;diff --git a/apps/desktop/src/styles/plugins.css b/apps/desktop/src/styles/plugins.cssindex 22b42a85e..453326798 100644--- a/apps/desktop/src/styles/plugins.css+++ b/apps/desktop/src/styles/plugins.css@@ -851,11 +851,18 @@flex: 1 1 auto;}+/* One plugin setting list mixes string/number rows (field-height inputs),+ switches and enum rows, so an enum dropdown takes the same field metric as+ the input in the row above it instead of the Settings-row pill size. */.plugins-setting-control > .settings-menu-select-anchor {min-width: 0;max-width: 100%;}+.plugins-setting-control .settings-menu-select-trigger {+ height: var(--ds-field-height);+}+.plugins-setting-json {min-height: 72px;width: 100%;@@ -1196,6 +1203,13 @@min-width: 0;}+/* Same list, same right column: the provider dropdown sits directly above the+ custom-URL input row, so it takes the shared field metric rather than the+ compact Settings-row pill size. */+.plugins-market-settings-control .settings-menu-select-trigger {+ height: var(--ds-field-height);+}+@media (max-width: 720px) {.plugins-market-settings-head,.plugins-market-settings-row {diff --git a/apps/desktop/src/styles/settings.css b/apps/desktop/src/styles/settings.cssindex 4f80c32e6..08dda764c 100644--- a/apps/desktop/src/styles/settings.css+++ b/apps/desktop/src/styles/settings.css@@ -1277,7 +1277,11 @@width: max-content;max-width: 100%;min-width: 0;- height: 30px;+ /* Every Settings row that holds a value uses the same height: these pill+ selects stand beside the row's text inputs, so they take the shared field+ metric instead of a shorter pill that reads as a different control. */+ min-height: var(--ds-field-height);+ height: var(--ds-field-height);border-radius: var(--radius-full);border: 0;/* D297: controls on a tile row are raised fills, not ringed boxes. */@@ -1438,7 +1442,9 @@width: max-content;max-width: 100%;min-width: 0;- height: 30px;+ /* One closed-trigger height for every picker: the metric a text input in the+ same Settings row resolves to, so the two never disagree (see the token). */+ height: var(--ds-field-height);padding: 0 10px 0 12px;border-radius: var(--radius-full);background: var(--ds-raised);@@ -1452,6 +1458,15 @@width: 100%;}+/* A stretched trigger is a form field, not a Settings-row pill: it stands as+ tall as the input in the same grid row (provider setup, config sync).+ `:where()` keeps this at the field metric's own specificity, so a surface+ that owns a denser metric (the subagent sheet) still wins with a single+ class instead of depending on stylesheet order. */+:where(.settings-menu-select-anchor.is-full) .settings-menu-select-trigger {+ height: var(--ds-field-height);+}+.settings-language-trigger:hover,.settings-theme-trigger:hover,.settings-menu-select-trigger:hover,diff --git a/apps/desktop/src/styles/tokens.css b/apps/desktop/src/styles/tokens.cssindex 2e7e71537..c25ddbc58 100644--- a/apps/desktop/src/styles/tokens.css+++ b/apps/desktop/src/styles/tokens.css@@ -159,6 +159,15 @@/* Square icon-only control. `.icon-btn` takes its width from its label, so anicon-only use pins both axes to this token instead. */--ds-control-size: 28px;+ /* The field metric: one height for a text input, a native select and the+ dropdowns that act as form fields, so a control can never look like a+ different-sized box than the input beside it. Derived from the single-line+ field box (9px + 9px padding around one `--leading-body` line at+ `--text-base`) so it follows the Appearance font scale instead of pinning+ a px value that drifts once type is resized. Dense nested surfaces — the+ subagent sheet's row body, a compact menu search — and the import toolbar,+ whose row holds small buttons and no field, declare their own metric. */+ --ds-field-height: calc(18px + var(--text-base) * var(--leading-body));/* Work-panel controls share these geometry tokens so the header's safe lanecannot drift away from the viewport-fixed toggle. */--ds-work-panel-toggle-size: 28px;diff --git a/apps/desktop/src/styles/ui-kit.css b/apps/desktop/src/styles/ui-kit.cssindex 5b01c94b6..3bf7ed1b6 100644--- a/apps/desktop/src/styles/ui-kit.css+++ b/apps/desktop/src/styles/ui-kit.css@@ -74,6 +74,11 @@border-radius: var(--radius-sm);background: var(--ds-tile-hover);padding: 9px 11px;+ /* The whole field vocabulary pins to one height, so a native select (whose+ closed box resolves ~2px shorter on its own) and an input that asks for a+ smaller font (`text-sm-plus`) still line up with the plain input beside+ them. Compact surfaces that own a smaller scale override the minimum. */+ min-height: var(--ds-field-height);color: var(--ds-text-primary);outline: none;transition:diff --git a/apps/desktop/test/field-control-height.test.mjs b/apps/desktop/test/field-control-height.test.mjsnew file mode 100644index 000000000..28b113813--- /dev/null+++ b/apps/desktop/test/field-control-height.test.mjs@@ -0,0 +1,148 @@+/**+ * Field/control height contract (renderer CSS).+ *+ * A text input, a native select and a menu-select trigger that acts as a form+ * field must resolve to one height, or the dropdown reads as a different-sized+ * control than the input beside it. `--ds-field-height` is that metric.+ *+ * Compact surfaces — a menu search row, the dense subagent sheet, the+ * Settings-row pill, the model row body — own a smaller metric instead. They+ * have to declare it as a *minimum*: the field vocabulary pins `min-height`, so+ * a bare `height` on one of their inputs would lose and the control would be+ * stretched to the field metric.+ *+ * These assertions read the stylesheets as text (no renderer harness), matching+ * the other CSS-contract tests in this directory.+ */++import assert from "node:assert/strict";+import { readFile } from "node:fs/promises";+import test from "node:test";++const read = (path) => readFile(new URL(path, import.meta.url), "utf8");+const [tokensCss, uiKitCss, settingsCss, modelConfigCss, extensionsCss, pluginsCss, scheduledCss, sessionsCss] =+ await Promise.all([+ read("../src/styles/tokens.css"),+ read("../src/styles/ui-kit.css"),+ read("../src/styles/settings.css"),+ read("../src/styles/model-config.css"),+ read("../src/styles/extensions.css"),+ read("../src/styles/plugins.css"),+ read("../src/features/scheduled/scheduled-editor.css"),+ read("../src/styles/sessions.css"),+ ]);++/** Body of one rule, so a declaration can be asserted inside the right block. */+function declarations(css, selectorText) {+ const escaped = selectorText.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");+ const match = css.match(new RegExp(`${escaped}\\s*\\{([^}]*)\\}`));+ assert.ok(match, `rule not found: ${selectorText}`);+ return match[1];+}++function heightValue(body, property) {+ // Anchored to a declaration line, so a comment that mentions "height:" in+ // prose cannot be mistaken for the declaration.+ const match = body.match(new RegExp(`(?:^|\\n)\\s*${property}:\\s*([^;]+);`));+ assert.ok(match, `declaration not found: ${property}`);+ return match[1].trim();+}++test("the field vocabulary shares one height metric", () => {+ assert.match(+ tokensCss,+ /--ds-field-height:\s*calc\(18px \+ var\(--text-base\) \* var\(--leading-body\)\)/,+ );+ const field = declarations(uiKitCss, ".field-input,\n.field-select,\n.field-textarea");+ assert.equal(heightValue(field, "min-height"), "var(--ds-field-height)");+});++test("a stretched trigger takes the field metric without outranking a denser surface", () => {+ const stretched = declarations(+ settingsCss,+ ".settings-menu-select-anchor.is-full .settings-menu-select-trigger",+ );+ assert.match(stretched, /display:\s*flex/);+ assert.match(stretched, /width:\s*100%/);+ // Height lives in a `:where()` rule so it stays at field specificity: a+ // surface with its own metric must win with one class, not stylesheet order.+ assert.match(+ settingsCss,+ /:where\(\.settings-menu-select-anchor\.is-full\) \.settings-menu-select-trigger\s*\{[^}]*height:\s*var\(--ds-field-height\)/,+ );+ assert.doesNotMatch(stretched, /height:/);+});++test("dropdowns that act as form fields take the field metric", () => {+ for (const [css, selector] of [+ [pluginsCss, ".plugins-setting-control .settings-menu-select-trigger"],+ [pluginsCss, ".plugins-market-settings-control .settings-menu-select-trigger"],+ [scheduledCss, ".scheduled-fields .settings-menu-select-trigger"],+ ]) {+ assert.equal(+ heightValue(declarations(css, selector), "height"),+ "var(--ds-field-height)",+ selector,+ );+ }+});++test("a dense surface's dropdown matches that surface's own field height", () => {+ const sheetField = declarations(+ extensionsCss,+ ".ext-sheet .field-input,\n.ext-sheet .field-select,\n.ext-sheet .field-textarea",+ );+ const sheetTrigger = declarations(extensionsCss, ".ext-sheet .settings-menu-select-trigger");+ assert.equal(heightValue(sheetTrigger, "height"), heightValue(sheetField, "min-height"));++ const rowBodyField = declarations(+ modelConfigCss,+ ".provider-chosen-row-body .field-input,\n.provider-chosen-row-body .field-select",+ );+ const rowBodyTrigger = declarations(+ modelConfigCss,+ ".provider-chosen-thinking-select .settings-menu-select-trigger",+ );+ assert.equal(heightValue(rowBodyTrigger, "height"), heightValue(rowBodyField, "min-height"));+});++test("compact menu searches keep their own height as a minimum", () => {+ for (const selector of [".provider-service-search input", ".model-default-search input"]) {+ const body = declarations(modelConfigCss, selector);+ // Without the minimum, `--ds-field-height` wins over the row's 26px box and+ // the search swallows the menu row.+ assert.equal(heightValue(body, "min-height"), heightValue(body, "height"), selector);+ assert.equal(heightValue(body, "height"), "26px");+ }+});++test("a Settings-row dropdown matches the row's input", () => {+ const rowInput = declarations(settingsCss, ".settings-row-control .field-input");+ const pill = declarations(+ settingsCss,+ ".settings-pill-select,\n.settings-row-control .field-select",+ );+ const picker = declarations(+ settingsCss,+ ".settings-language-trigger,\n.settings-theme-trigger,\n.settings-menu-select-trigger,\n.settings-font-trigger",+ );+ // A Settings row can hold a text input, a select or a picker pill; all three+ // resolve to the shared field metric, so the column has one control height.+ assert.equal(heightValue(pill, "height"), "var(--ds-field-height)");+ assert.equal(heightValue(pill, "min-height"), "var(--ds-field-height)");+ for (const rule of [picker]) {+ assert.equal(heightValue(rule, "height"), "var(--ds-field-height)");+ }+ // The row's own text input takes the same metric through the field+ // vocabulary; a compact row input would have to declare its own minimum.+ assert.doesNotMatch(rowInput, /height:/);+});++test("the import toolbar's dropdown keeps the toolbar's own metric", () => {+ // That row holds 28px action buttons and no text input, so the shared field+ // metric would leave the dropdown taller than the controls beside it.+ const select = declarations(sessionsCss, ".import-option-select .settings-menu-select-trigger");+ assert.equal(heightValue(select, "height"), "28px");+ const button = declarations(sessionsCss, ".import-toolbar-actions > .btn");+ assert.equal(heightValue(button, "min-height"), "28px");+});