🤖 Open-source, local-first alternative to Grok Bot, OpenAI dots and Claude Duet. Your own AI bots on any model: GPT, Claude, Gemini, Grok, DeepSeek, Kimi, GLM and 70+ more through one Modelflare key. Reach them in the app, WeChat or Feishu; they remember you, work in the background, run commands and use your computer. Pay per use.
Python ai-agentai-assistantchatbotclaudecomputer-usedeepseekdesktop-appdshelectronfeishugeminigptgrokllmlocal-firstmodelflaremulti-modelopenai-compatiblepersonal-ai-agentwechat
feat(ui): unify spacing on role tokens; replace bordered boxes with tonal wells
Marla2c369b73de2f
diff --git a/electron/main.ts b/electron/main.tsindex 81ad85b..39a2180 100644--- a/electron/main.ts+++ b/electron/main.ts@@ -52,8 +52,9 @@ function createWindow(): void {icon: iconPath(),show: !SMOKE,autoHideMenuBar: true,- // macOS:无标题栏,红绿灯嵌进侧栏顶部(界面在 Electron + Mac 下给它留位);其他系统用系统标题栏- ...(process.platform === "darwin" ? { titleBarStyle: "hiddenInset" as const, trafficLightPosition: { x: 16, y: 15 } } : {}),+ // macOS:无标题栏,红绿灯嵌进侧栏顶部(界面在 Electron + Mac 下给它留位);其他系统用系统标题栏。+ // 侧栏顶部先让出 --pane-gap(8)再放 52 高的顶栏,和主区顶栏同一条中线,所以红绿灯也比顶栏原来的位置低 8+ ...(process.platform === "darwin" ? { titleBarStyle: "hiddenInset" as const, trafficLightPosition: { x: 16, y: 23 } } : {}),webPreferences: { contextIsolation: true, nodeIntegration: false, sandbox: true },});const origin = new URL(entryUrl).origin;diff --git a/test/design-system.unit.test.ts b/test/design-system.unit.test.tsindex 26a2afa..f0e019f 100644--- a/test/design-system.unit.test.ts+++ b/test/design-system.unit.test.ts@@ -1,10 +1,13 @@/**- * 设计规范守卫(ui/design/README.md):颜色、字号、圆角、动效、层级只能来自 token。+ * 设计规范守卫(ui/design/README.md):颜色、字号、圆角、动效、层级、间距只能来自 token。* 原始值只允许出现在 ui/design/tokens/ 里;组件文件里需要的"魔法数"先起名(--组件-xxx: 值)再用。+ * 间距例外只有三种:0、≤1px 的细线,以及同一行带 /* 微调:… *\/ 注释的光学微调。+ * 容器(README「容器与层次」):内容里的一组靠 --well 底色成组,不描边、不加侧边色条;要保留的边在同一行写 /* 描边:… *\/。* 另外检查所有 var(--x) 都有定义,改名或删 token 时不会留下悬空引用。*/import { describe, it, expect } from "vitest";import fs from "node:fs";+import os from "node:os";import path from "node:path";const UI = path.join(import.meta.dirname, "..", "ui");@@ -49,14 +52,162 @@ function lintJs(file: string): Hit[] {return hits;}+// —— 间距 ——+/** 间距属性:外边距、内边距、间隙、定位偏移 */+const SPACING = /^(margin|padding|scroll-margin|scroll-padding)(-[a-z-]+)?$|^(gap|row-gap|column-gap|inset(-[a-z-]+)?|top|right|bottom|left)$/;+/** 按用途命名的间距变量(--row-py、--pop-pad、--page-px、--composer-pad …):它们是组件对外的间距接口,也要取自 token */+const SPACING_VAR = /^--[\w-]+-(gap|pad|px|py|pl|pr|pt|pb|inset|gutter)$/;+/** 写死的像素;0 和 ≤1px 的细线不算 */+const rawPx = (v: string) => (v.match(/(?<![\w.-])-?[\d.]+px\b/g) || []).filter((n) => Math.abs(parseFloat(n)) > 1);+/** calc() 里加减写死的像素:藏在宽度里的边距(calc(100% - 48px))也算间距 */+const calcPx = (v: string) => (/calc\(/.test(v) ? (v.match(/[+-]\s+[\d.]+px\b/g) || []).filter((n) => parseFloat(n.replace(/[+-]\s+/, "")) > 1) : []);+/** 同一行带"微调"注释的声明:有意的光学微调 */+const TUNED = /\/\*\s*微调/;++function lintSpacingCss(file: string): Hit[] {+ const text = fs.readFileSync(file, "utf8");+ const tuned = new Set(text.split("\n").flatMap((l, i) => (TUNED.test(l) ? [i + 1] : [])));+ const src = stripComments(text);+ const hits: Hit[] = [];+ const decl = /([\w-]+)\s*:\s*([^;{}]+)/g;+ for (let m; (m = decl.exec(src)); ) {+ const [, prop, value] = m;+ const line = lineOf(src, m.index);+ if (tuned.has(line)) continue;+ const raw = withoutVars(value);+ const px = SPACING.test(prop) || SPACING_VAR.test(prop) ? rawPx(raw) : prop.startsWith("--") ? [] : calcPx(raw);+ if (px.length) hits.push(`${rel(file)}:${line} 原始间距:${prop}: ${value.trim()}`);+ }+ return hits;+}++function lintSpacingJs(file: string): Hit[] {+ const src = fs.readFileSync(file, "utf8");+ const hits: Hit[] = [];+ const bad = /\b(margin|padding|gap|inset|top|right|bottom|left)[\w-]*\s*:\s*[^;"'`}]*?(?<![\w.-])-?[\d.]+px\b/g;+ for (let m; (m = bad.exec(src)); ) if (rawPx(m[0].slice(m[0].indexOf(":") + 1)).length) hits.push(`${rel(file)}:${lineOf(src, m.index)} 内联样式里的原始间距:${m[0]}`);+ return hits;+}++// —— 容器(README「容器与层次」)——+// 内容里的一组靠 --well 底色和间距成组,不画描边;描边只留给输入框和浮层玻璃,而且要在同一行写明理由。+/** 同一行带"描边"注释的声明:有意保留的边(输入框、浮层玻璃、图形本身) */+const EDGE_OK = /\/\*\s*描边[::]/;+/** box-shadow 画的一圈边:0 0 0 <宽>(可带 inset),宽度是像素或变量 */+const RING = /(?:^|[,(\s])(?:inset\s+)?0\s+0\s+0\s+(?:[\d.]+px|var\()/;+/** box-shadow 画的侧边色条:inset ±Npx 0 0(N ≥ 2) */+const SIDE_BAR = /inset\s+-?([\d.]+)px\s+0\s+0\b/;+/** 宽度:取声明里第一个长度(px 或 calc/var 都算"有宽度") */+const edgeWidth = (v: string) => {+ if (/^\s*(0|none)\s*(!important)?\s*$/.test(v) || /^\s*(0|none)\s/.test(v)) return 0;+ const px = v.match(/(?<![\w.-])([\d.]+)px\b/);+ return px ? parseFloat(px[1]) : /calc\(|var\(|\b(thin|medium|thick)\b/.test(v) ? Infinity : 0;+};++function lintEdgesCss(file: string): Hit[] {+ const text = fs.readFileSync(file, "utf8");+ const marked = new Set(text.split("\n").flatMap((l, i) => (EDGE_OK.test(l) ? [i + 1] : [])));+ const src = stripComments(text);+ const hits: Hit[] = [];+ const block = /([^{}]*)\{([^{}]*)\}/g;+ for (let b; (b = block.exec(src)); ) {+ const selector = b[1].trim();+ const focus = /:focus/.test(selector);+ const bodyAt = b.index + b[1].length + 1;+ const decl = /([\w-]+)\s*:\s*([^;{}]+)/g;+ for (let m; (m = decl.exec(b[2])); ) {+ const [, prop, value] = m;+ const line = lineOf(src, bodyAt + m.index);+ if (marked.has(line)) continue;+ const at = `${rel(file)}:${line}`;+ if (/^(border|border-width|outline|outline-width)$/.test(prop) && !focus && edgeWidth(value) > 0)+ hits.push(`${at} 描边容器:${selector} { ${prop}: ${value.trim()} } —— 用 --well 底色成组;确实要边(输入框、浮层玻璃)就在同一行写 /* 描边:理由 */`);+ else if (/^border-(left|right|inline(-start|-end)?)(-width)?$/.test(prop) && edgeWidth(value) >= 2)+ hits.push(`${at} 侧边色条:${selector} { ${prop}: ${value.trim()} } —— 提示用淡底 + 图标,不加左侧色条`);+ else if (/^border-(top|bottom|block(-start|-end)?)(-width)?$/.test(prop) && edgeWidth(value) > 1)+ hits.push(`${at} 粗分隔线:${selector} { ${prop}: ${value.trim()} } —— 行间只用 ≤1px 的 --line-2`);+ else if (SIDE_BAR.test(value) && parseFloat(value.match(SIDE_BAR)![1]) >= 2)+ hits.push(`${at} 侧边色条:${selector} { ${prop}: ${value.trim()} } —— 提示用淡底 + 图标,不加左侧色条`);+ else if ((prop === "box-shadow" || prop.startsWith("--")) && RING.test(value) && !focus)+ hits.push(`${at} 投影描边:${selector} { ${prop}: ${value.trim()} } —— 内容里的组不描边;确实要边就在同一行写 /* 描边:理由 */`);+ }+ }+ return hits;+}++/** 小标签:不全大写、不加字距 */+function lintLabelsCss(file: string): Hit[] {+ const src = stripComments(fs.readFileSync(file, "utf8"));+ const hits: Hit[] = [];+ for (const m of src.matchAll(/(text-transform)\s*:\s*(uppercase|capitalize)|(letter-spacing)\s*:\s*\+?(\.\d+|\d+(\.\d+)?)(em|px|rem)/g))+ if (!m[4] || parseFloat(m[4]) > 0) hits.push(`${rel(file)}:${lineOf(src, m.index!)} 大写 / 加字距的小标签:${m[0]}`);+ return hits;+}++function lintEdgesJs(file: string): Hit[] {+ const src = fs.readFileSync(file, "utf8");+ const hits: Hit[] = [];+ const bad = /\b(border(-left|-right)?\s*:\s*[^;"'`}]*?\d[^;"'`}]*?solid|box-shadow\s*:\s*[^;"'`}]*?\b0 0 0 [\d.]+px)/g;+ for (let m; (m = bad.exec(src)); ) hits.push(`${rel(file)}:${lineOf(src, m.index)} 内联样式里的描边:${m[0]}`);+ return hits;+}+describe("设计规范", () => {const css = files(".css").filter((f) => !f.startsWith(TOKENS + path.sep));const js = files(".js");+ it("内容里的组不描边、不加侧边色条(输入框、浮层玻璃等写明「描边:」理由的除外)", () => {+ expect([...css.flatMap(lintEdgesCss), ...js.flatMap(lintEdgesJs)]).toEqual([]);+ });++ it("容器守卫能拦下描边卡片、投影描边和侧边色条", () => {+ const tmp = path.join(fs.mkdtempSync(path.join(os.tmpdir(), "amb-edges-")), "x.css");+ try {+ fs.writeFileSync(tmp, [+ ".a { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-xl); }",+ ".b { box-shadow: inset 0 0 0 .5px var(--line), var(--shadow-xs); }",+ ".c { border-left: 3px solid var(--red); }",+ ".d { --notice-edge: inset 3px 0 0 var(--red), inset 0 0 0 1px var(--line); }",+ ".e { border: 0; border-top: 1px solid var(--line-2); background: var(--well); }",+ ".f:focus-visible { outline: 2px solid var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }",+ ".g { border: 1px solid var(--ctl-edge); } /* 描边:输入框的边 */",+ ".h { --x-edge: 0 0 0 var(--w) var(--line); }",+ ".i { border-bottom: 2px solid var(--accent); }",+ ].join("\n"));+ expect(lintEdgesCss(tmp).map((h) => h.split(" ")[0].split(":").pop())).toEqual(["1", "2", "3", "4", "8", "9"]);+ } finally {+ fs.rmSync(path.dirname(tmp), { recursive: true, force: true });+ }+ });++ it("小标签不全大写、不加字距", () => {+ expect(css.flatMap(lintLabelsCss)).toEqual([]);+ });+it("颜色 / 字号 / 圆角 / 动效 / 层级只用 token", () => {expect([...css.flatMap(lintCss), ...js.flatMap(lintJs)]).toEqual([]);});+ it("间距只用 token(0、≤1px 细线、带「微调」注释的光学微调除外)", () => {+ expect([...css.flatMap(lintSpacingCss), ...js.flatMap(lintSpacingJs)]).toEqual([]);+ });++ it("间距守卫能拦下写死的像素", () => {+ const tmp = path.join(fs.mkdtempSync(path.join(os.tmpdir(), "amb-spacing-")), "x.css");+ try {+ fs.writeFileSync(tmp, [+ ".a { padding: 0 12px; }",+ ".b { width: min(var(--col-w), calc(100% - 48px)); }",+ ".c { --row-py: 7px; }",+ ".d { margin: 0; gap: 1px; padding: var(--space-2); }",+ ".e { top: 3px; } /* 微调:居中 */",+ ].join("\n"));+ expect(lintSpacingCss(tmp).map((h) => h.split(" ")[0].split(":").pop())).toEqual(["1", "2", "3"]);+ } finally {+ fs.rmSync(path.dirname(tmp), { recursive: true, force: true });+ }+ });+it("每个 var(--x)(没有回退值的)都有定义", () => {const all = [...files(".css"), ...js].map((f) => [f, fs.readFileSync(f, "utf8")] as const);const defined = new Set<string>();diff --git a/ui/components/ui.js b/ui/components/ui.jsindex 71e67b2..1838851 100644--- a/ui/components/ui.js+++ b/ui/components/ui.js@@ -41,6 +41,7 @@ const P = {globe: "M8 14a6 6 0 1 0 0-12 6 6 0 0 0 0 12ZM2.25 8h11.5M8 2c1.55 1.65 2.35 3.65 2.35 6S9.55 12.35 8 14M8 2C6.45 3.65 5.65 5.65 5.65 8s.8 4.35 2.35 6",database: "M8 5.25c2.9 0 5.25-.78 5.25-1.75S10.9 1.75 8 1.75 2.75 2.53 2.75 3.5 5.1 5.25 8 5.25ZM2.75 3.5v9c0 .97 2.35 1.75 5.25 1.75s5.25-.78 5.25-1.75v-9M2.75 8c0 .97 2.35 1.75 5.25 1.75S13.25 8.97 13.25 8",info: "M8 14a6 6 0 1 0 0-12 6 6 0 0 0 0 12ZM8 7.25v3.75M8 4.9v.1",+ alert: "M8 14a6 6 0 1 0 0-12 6 6 0 0 0 0 12ZM8 4.75v3.75M8 11v.1",chat: "M3.25 2.75h9.5c.41 0 .75.34.75.75v6.75c0 .41-.34.75-.75.75H7.25L4.5 13.25V11H3.25a.75.75 0 0 1-.75-.75V3.5c0-.41.34-.75.75-.75Z",code: "M5.25 4.5 1.75 8l3.5 3.5M10.75 4.5 14.25 8l-3.5 3.5M9.1 2.75 6.9 13.25",shield: "M8 1.75 2.75 3.6v4.15c0 3.05 2.2 5.4 5.25 6.5 3.05-1.1 5.25-3.45 5.25-6.5V3.6L8 1.75Z",@@ -67,10 +68,10 @@ export function IconButton({ icon, label, size, iconSize = 14, on, class: cls, t</button>`;}-/** 行内提示:tone = "amber" | "red"(缺省为品牌色);action 放在右侧 */+/** 行内提示:tone = "amber" | "red"(缺省为中性);左边一个图标表达语气,action 放在右侧 */export function Notice({ tone, action, children }) {return html`<div class=${cx("notice", tone)} role=${tone === "red" ? "alert" : undefined}>- <span class="notice-text">${children}</span>${action}+ <${Icon} name=${tone ? "alert" : "info"} size=${14} /><span class="notice-text">${children}</span>${action}</div>`;}@@ -143,7 +144,13 @@ export function Seg({ options, value, onChange, disabled, label }) {</div>`;}-/** 打开在锚点下方(空间不够时在上方)的浮层,position: fixed */+/** 长度 token 的像素值("--pop-offset" → 6):JS 里的间距也从 token 来,不写死 */+function tokenPx(name, fallback) {+ const n = parseFloat(getComputedStyle(document.documentElement).getPropertyValue(name));+ return Number.isFinite(n) ? n : fallback;+}++/** 打开在锚点下方(空间不够时在上方)的浮层,position: fixed。离锚点 --pop-offset,离窗口边缘 --pane-gap(和面板的边对齐) */export function usePopPosition(anchor, open, { width = 280, prefer = "down", align = "left", maxHeight = 360 } = {}) {const [pos, setPos] = useState(null);useLayoutEffect(() => {@@ -152,13 +159,15 @@ export function usePopPosition(anchor, open, { width = 280, prefer = "down", aliconst r = anchor.getBoundingClientRect ? anchor.getBoundingClientRect() : anchor;const vw = window.innerWidth;const vh = window.innerHeight;- const below = vh - r.bottom - 12;- const above = r.top - 12;+ const gap = tokenPx("--pop-offset", 6);+ const edge = tokenPx("--pane-gap", 8);+ const below = vh - r.bottom - gap - edge;+ const above = r.top - gap - edge;const up = prefer === "up" ? above > 160 || above > below : below < Math.min(maxHeight, 220) && above > below;let left = align === "right" ? r.right - width : r.left;- left = Math.max(8, Math.min(left, vw - width - 8));+ left = Math.max(edge, Math.min(left, vw - width - edge));const ox = Math.max(12, Math.min(width - 12, r.left + (r.width || 0) / 2 - left));- setPos(up ? { left, bottom: vh - r.top + 6, up: true, ox, max: Math.min(maxHeight, above) } : { left, top: r.bottom + 6, up: false, ox, max: Math.min(maxHeight, below) });+ setPos(up ? { left, bottom: vh - r.top + gap, up: true, ox, max: Math.min(maxHeight, above) } : { left, top: r.bottom + gap, up: false, ox, max: Math.min(maxHeight, below) });};compute();window.addEventListener("resize", compute);diff --git a/ui/css/chat.css b/ui/css/chat.cssindex 9ffd2d2..224247e 100644--- a/ui/css/chat.css+++ b/ui/css/chat.css@@ -3,11 +3,23 @@底部是两行输入框(文字区 + 工具栏:更多 | 模型 · 发送)。顶栏和输入框都是盖在对话流上的毛玻璃:消息从它们底下滚过,透出来是模糊的。 */@layer app {-.chat { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }+/* 对话列和输入框同宽、同一个居中列(两侧至少 --page-gutter)。输入框浮在主区底部,+ 对话列的下边距和"回到底部"的位置都从它的高度算出来,改输入框的内边距时这里跟着变。 */+.chat, .composer {+ --composer-line: 22px; /* 输入框的行高 */+ --composer-pad: var(--space-2); /* 工具栏离输入框的左、右、下边:加号和发送钮都贴着这条线 */+ /* 一行字时输入框的高度:文字区(上 14 + 行高 + 下 4)+ 工具栏(上 6 + 发送钮 + 下 --composer-pad) */+ --composer-h: calc(var(--space-3-5) + var(--composer-line) + var(--space-1) + var(--space-1-5) + var(--ctl-lg) + var(--composer-pad));+}+.chat {+ --col: min(var(--col-w), calc(100% - 2 * var(--page-gutter)));+ --dock-pb: var(--space-4); /* 输入框离主区下沿 */+ position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column;+}/* —— 顶栏:对话页里浮在滚动内容上;内容滚到它底下时(.scrolled)才出现细线和投影 —— */.chat-head {- flex: none; display: flex; align-items: center; gap: var(--space-1); height: var(--head-h); padding: 0 var(--space-3) 0 var(--space-3-5);+ flex: none; display: flex; align-items: center; gap: var(--bar-gap); height: var(--head-h); padding: 0 var(--head-px);-webkit-app-region: drag;}.chat > .chat-head {@@ -30,18 +42,20 @@ button.head-bot[aria-pressed="true"] { background: var(--pill-hover); }button.head-bot:active { background: var(--pill-press); }.head-bot .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }-/* —— 对话流 —— */+/* —— 对话流 ——+ 滚动条总是占着右边那一条(scrollbar-gutter),输入框的底座也留同样一条:对话列和输入框按同一个宽度居中,左右边对齐 */.chat-scroll {- flex: 1; min-height: 0; overflow-y: auto; overflow-anchor: none; scroll-padding-top: var(--head-h);+ flex: 1; min-height: 0; overflow-y: auto; overflow-anchor: none; scroll-padding-top: var(--head-h); scrollbar-gutter: stable;/* 输入框下面那一窄条:内容淡出,露出主区本身 */mask-image: linear-gradient(to top, transparent, var(--black) var(--space-4));}+/* 下边距 = 输入框占的高度 + 48,最后一条消息滚到底时停在输入框上方 */.chat-col {- width: min(var(--col-w), calc(100% - 48px)); margin: 0 auto;- padding: calc(var(--head-h) + var(--space-6)) 0 150px; display: flex; flex-direction: column;+ width: var(--col); margin: 0 auto;+ padding: calc(var(--head-h) + var(--space-6)) 0 calc(var(--dock-pb) + var(--composer-h) + var(--space-12)); display: flex; flex-direction: column;}.chat-skel { display: grid; gap: var(--space-3-5); margin-top: var(--space-6); }-.chat-skel .skel { height: 34px; border-radius: var(--r-3xl); }+.chat-skel .skel { height: 34px; border-radius: var(--r-bubble); }.chat-skel .skel:nth-child(2) { justify-self: end; }.chat-col > .notice { margin-top: var(--space-2); }@@ -51,7 +65,7 @@ button.head-bot:active { background: var(--pill-press); }.msg-row.assistant { align-items: stretch; }.msg { font-size: var(--fs-xl); word-break: break-word; overflow-wrap: anywhere; cursor: text; }.msg-row.user .msg {- max-width: min(var(--bubble-w), 80%); padding: 9px var(--space-4); border-radius: var(--r-3xl);+ max-width: min(var(--bubble-w), 80%); padding: var(--space-2-5) var(--space-4); border-radius: var(--r-bubble);background: var(--bubble-user); color: var(--fg); line-height: 1.55; white-space: pre-wrap;}.msg-row.assistant .msg { color: var(--fg); line-height: 1.7; }@@ -74,7 +88,7 @@ button.head-bot:active { background: var(--pill-press); }/* 消息下方的操作:悬停出现;最后一条回复常显 */.msg-actions {- display: flex; align-items: center; gap: var(--space-1); height: 24px; margin-top: var(--space-0-5);+ display: flex; align-items: center; gap: var(--bar-gap); height: 24px; margin-top: var(--space-0-5);color: var(--muted); opacity: 0; transition: opacity var(--t-fast);}.msg-row.user .msg-actions { flex-direction: row-reverse; }@@ -97,29 +111,36 @@ button.head-bot:active { background: var(--pill-press); }.md p, .md ul, .md ol, .md blockquote, .md pre, .md table, .md hr { margin: 0 0 var(--space-3); }.md h1, .md h2, .md h3, .md h4 { margin: var(--space-5) 0 var(--space-2); font-size: var(--fs-xl); font-weight: var(--fw-semibold); line-height: 1.5; }.md h1 { font-size: var(--fs-2xl); }-.md ul, .md ol { padding-left: 22px; }+.md ul, .md ol { padding-left: var(--space-6); }.md li + li { margin-top: var(--space-1); }-.md blockquote { padding-left: var(--space-3); border-left: 3px solid var(--line); color: var(--fg-2); }+.md blockquote { padding-left: var(--space-3); border-left: 3px solid var(--line); color: var(--fg-2); } /* 描边:引文的排版记号(灰色、不圈住内容),不是提示框的色条 */.md hr { border: 0; border-top: 1px solid var(--line); }-.md code { font-size: var(--fs-sm); padding: 1px 5px; border-radius: var(--r-xs); background: var(--code-bg); }+.md code { font-size: var(--fs-sm); padding: var(--space-0-5) var(--space-1); border-radius: var(--r-xs); background: var(--code-bg); }.md a { text-decoration: underline; text-underline-offset: 2px; }.md .table-wrap { overflow-x: auto; margin: 0 0 var(--space-3); }.md table { border-collapse: collapse; font-size: var(--fs-md); line-height: 1.45; margin: 0; }-.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }-.md th { font-weight: var(--fw-semibold); background: var(--card-2); }-.codeblock { margin: 0 0 var(--space-3); border-radius: var(--r-xl); background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line-2); overflow: hidden; }+/* 表格不画格子:表头下一条 --line,行与行之间一条 --line-2,没有外框、竖线和表头底色;列靠右边距分开,第一列贴着正文左边 */+.md th, .md td { padding: var(--space-1-5) var(--space-5) var(--space-1-5) 0; text-align: left; vertical-align: top; }+.md :is(th, td):last-child { padding-right: 0; }+.md th { font-weight: var(--fw-semibold); border-bottom: 1px solid var(--line); }+.md tr + tr > td { border-top: 1px solid var(--line-2); }+/* 代码块:一块 --well,不描边 */+.codeblock { margin: 0 0 var(--space-3); border-radius: var(--r-well); background: var(--well); overflow: hidden; }+/* 语言名和代码左对齐;复制钮离右边和上边一样远(30 高的条里放 22 的按钮) */.codeblock .bar {display: flex; align-items: center; height: 30px; padding: 0 var(--space-1) 0 var(--space-3);font-family: var(--code); font-size: var(--fs-2xs); color: var(--muted);}.codeblock .bar .lang { flex: 1; }-.codeblock pre { margin: 0; padding: 0 var(--space-3-5) var(--space-3); overflow-x: auto; font: var(--fs-sm)/var(--lh-relaxed) var(--code); color: var(--fg); white-space: pre; }+.codeblock .bar .icon-btn { --ib-size: var(--ctl-xs); }+.codeblock pre { margin: 0; padding: 0 var(--space-3) var(--space-3); overflow-x: auto; font: var(--fs-sm)/var(--lh-relaxed) var(--code); color: var(--fg); white-space: pre; }.codeblock pre code { font-size: inherit; padding: 0; background: none; }-/* 流里的卡片:提问 / 审批 / 文件 */+/* 流里的一组:提问 / 审批 / 文件。一块 --well,不描边、不加投影;里面不再套框——+ 命令是一行等宽字,选项是可悬停的行,只有输入框留着自己的边 */.card {- width: min(var(--bubble-w), 100%); background: var(--card); border-radius: var(--r-2xl);- box-shadow: inset 0 0 0 .5px var(--line), var(--shadow-xs); padding: var(--space-4) 18px; display: grid; gap: var(--space-2-5);+ width: min(var(--bubble-w), 100%); background: var(--well); border-radius: var(--r-well);+ padding: var(--card-pad); display: grid; gap: var(--space-2-5);}.card .q { font-size: var(--fs-xl); font-weight: var(--fw-semibold); color: var(--fg); line-height: 1.45; }.card .q-detail { font-size: var(--fs-md); color: var(--fg-2); line-height: var(--lh-normal); white-space: pre-wrap; }@@ -132,28 +153,29 @@ button.head-bot:active { background: var(--pill-press); }}.card .opt:hover:not(:disabled) { background: var(--pill); }.card .opt:active:not(:disabled) { background: var(--pill-hover); }+/* 选项字母平时只是一列字;选中后才填成一块(这是状态,不是容器) */.card .opt .letter {width: 22px; height: 22px; border-radius: var(--r-sm); flex: none; display: grid; place-items: center;- background: var(--pill); color: var(--muted); font-size: var(--fs-sm); font-weight: var(--fw-semibold);+ color: var(--muted); font-size: var(--fs-sm); font-weight: var(--fw-semibold);transition: background var(--t-fast), color var(--t-fast);}-.card .opt:hover:not(:disabled) .letter { background: var(--pill-hover); color: var(--fg-2); }+.card .opt:hover:not(:disabled) .letter { color: var(--fg); }.card .opt .desc { display: block; font-size: var(--fs-sm); color: var(--muted); }.card .opt.picked .letter, .card .opt.picked:hover .letter { background: var(--fg); color: var(--surface-solid); }.card.done .q { color: var(--muted); }.card.done .opt { color: var(--placeholder); }.card .meta { display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-sm); color: var(--muted); }-.card .actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }+.card .actions { display: flex; gap: var(--ctl-gap); flex-wrap: wrap; }.card .cmd {- font: var(--fs-sm)/var(--lh-normal) var(--code); background: var(--card-2); border-radius: var(--r-md); padding: 7px 9px;+ font: var(--fs-sm)/var(--lh-normal) var(--code);white-space: pre-wrap; word-break: break-all; color: var(--fg-2); max-height: 160px; overflow: auto;}-.card .answer { display: flex; gap: var(--space-1-5); }+.card .answer { display: flex; gap: var(--ctl-gap); }.file-card {display: flex; align-items: center; gap: var(--space-3); width: min(360px, 100%); padding: var(--space-2-5) var(--space-3-5) var(--space-2-5) var(--space-2-5);- background: var(--card); border-radius: var(--r-xl); box-shadow: inset 0 0 0 .5px var(--line), var(--shadow-xs);+ background: var(--well); border-radius: var(--r-well);}-.file-card > .ic { width: 40px; height: 40px; padding: var(--space-2); border-radius: var(--r-lg); background: var(--pill); color: var(--fg-2); }+.file-card > .ic { width: 40px; height: 40px; padding: var(--space-2); color: var(--fg-2); }.file-card .fname { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }.file-card .fsub { font-size: var(--fs-sm); color: var(--muted); }.msg-row .notice { max-width: min(var(--bubble-w), 100%); }@@ -161,30 +183,33 @@ button.head-bot:active { background: var(--pill-press); }.chat-empty { margin: auto; padding-top: 16vh; display: grid; justify-items: center; gap: var(--space-2-5); text-align: center; color: var(--muted); }.chat-empty h2 { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); color: var(--fg); }.chips { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: center; margin-top: var(--space-1-5); }+/* 建议:和次级按钮一样是一层静默填充,不描边、不浮起 */.chip {- height: 32px; padding: 0 var(--space-3-5); border-radius: var(--r-full); background: var(--card);- box-shadow: inset 0 0 0 .5px var(--line), var(--shadow-xs);- font-size: var(--fs-sm); color: var(--fg-2); transition: color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);+ height: 32px; padding: 0 var(--space-3-5); border-radius: var(--r-full); background: var(--pill);+ font-size: var(--fs-sm); color: var(--fg-2); transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);}-.chip:hover { color: var(--fg); box-shadow: inset 0 0 0 .5px var(--line-strong), var(--shadow-sm); }-.chip:active { transform: scale(var(--press)); box-shadow: inset 0 0 0 .5px var(--line-strong), var(--shadow-xs); }+.chip:hover { background: var(--pill-hover); color: var(--fg); }+.chip:active { background: var(--pill-press); transform: scale(var(--press)); }/* —— 回到底部:玻璃小圆钮 —— */.to-bottom {- position: absolute; z-index: var(--z-float); left: 50%; bottom: 128px; translate: -50% 0;- width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;+ position: absolute; z-index: var(--z-float); left: 50%; bottom: calc(var(--dock-pb) + var(--composer-h) + var(--space-6)); translate: -50% 0;+ width: var(--ctl-lg); height: var(--ctl-lg); border-radius: 50%; display: grid; place-items: center;background: var(--grain), var(--glass-float); backdrop-filter: var(--glass-filter-sm); color: var(--fg-2); box-shadow: var(--shadow-float);--rise: 6px; animation: rise-in var(--dur-base) var(--ease-out);- transition: color var(--t-fast), box-shadow var(--t-fast), scale var(--t-fast);+ transition: color var(--t-fast), scale var(--t-fast);}-.to-bottom:hover { color: var(--fg); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 .5px var(--line-strong), var(--shadow-md); }+.to-bottom:hover { color: var(--fg); }.to-bottom:active { scale: var(--press-strong); }-.to-bottom .new { position: absolute; top: 0; right: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-solid); box-shadow: 0 0 0 2px var(--surface-solid), 0 0 0 2.5px var(--accent-line); }+.to-bottom .new { position: absolute; top: 0; right: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-solid); box-shadow: 0 0 0 2px var(--surface-solid), 0 0 0 2.5px var(--accent-line); } /* 描边:圆点外的缺口和墨色细边,黄绿点才压得住白底 */-/* —— 输入框:文字区 + 工具栏两行,一块浮在对话流上的玻璃。- 状态:悬停描边加深;输入时描边更实、投影更大;拖入文件时 accent 描边 + 光晕 + 一层黄绿 —— */+/* —— 输入框:文字区 + 工具栏两行,一块浮在对话流上的玻璃(和菜单、提示同一种材质:细边 + 投影,不额外描边)。+ 认得出它靠的是:浮起的投影、常显的占位文字(3:1)、工具栏和发送钮,以及固定在底部的位置。+ 状态:输入时浮得更高(投影更大);拖入文件时 accent 描边 + 光晕 + 一层黄绿 —— */+/* 底座是透明的、不接收指针;上边留得够高,输入框聚焦时的投影不会被 overflow 裁掉 */.composer-dock {- position: absolute; z-index: var(--z-float); left: 0; right: 0; bottom: 0; padding: var(--space-6) 0 var(--space-4); pointer-events: none;+ position: absolute; z-index: var(--z-float); left: 0; right: 0; bottom: 0; padding: var(--space-12) 0 var(--dock-pb); pointer-events: none;+ overflow: hidden; scrollbar-gutter: stable;}.composer {--composer-edge: var(--glass-edge);@@ -192,23 +217,23 @@ button.head-bot:active { background: var(--pill-press); }--composer-shadow: var(--shadow-md);--composer-tint: transparent;pointer-events: auto; position: relative;- width: min(var(--col-w), calc(100% - 48px)); margin: 0 auto;+ width: var(--col, auto); margin: 0 auto;display: flex; flex-direction: column;background: var(--grain), linear-gradient(var(--composer-tint), var(--composer-tint)), var(--glass-float);backdrop-filter: var(--glass-filter); border-radius: var(--r-3xl);- box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 var(--composer-edge-w) var(--composer-edge), var(--composer-shadow);+ box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 var(--composer-edge-w) var(--composer-edge), var(--composer-shadow); /* 描边:浮层玻璃的细边;拖入文件时换成 accent */transition: box-shadow var(--t-base);}-.composer:hover { --composer-edge: var(--line-strong); }-.composer:focus-within { --composer-edge: var(--line-strong); --composer-edge-w: 1px; --composer-shadow: var(--shadow-lg); }+.composer:focus-within { --composer-shadow: var(--shadow-lg); }.composer.drag { --composer-edge: var(--accent); --composer-edge-w: 1.5px; --composer-shadow: var(--ring), var(--shadow-md); --composer-tint: var(--accent-wash); }.composer textarea {display: block; width: 100%; min-width: 0; border: 0; outline: none; background: transparent; resize: none;- font-size: var(--fs-xl); line-height: 22px; padding: var(--space-3-5) var(--space-4) var(--space-1); max-height: calc(22px * 8 + 18px); overflow-y: auto; color: var(--fg);+ font-size: var(--fs-xl); line-height: var(--composer-line); padding: var(--space-3-5) var(--space-4) var(--space-1);+ max-height: calc(var(--composer-line) * 8 + var(--space-3-5) + var(--space-1)); overflow-y: auto; color: var(--fg);}.composer textarea::placeholder { color: var(--placeholder); }.composer textarea:focus-visible { outline: none; }-.composer-bar { display: flex; align-items: center; gap: var(--space-1); padding: var(--space-1-5) var(--space-2) var(--space-2) var(--space-2-5); }+.composer-bar { display: flex; align-items: center; gap: var(--bar-gap); padding: var(--space-1-5) var(--composer-pad) var(--composer-pad); }.composer-bar .grow { flex: 1; }.composer :is(.plus, .model-chip) {flex: none; height: 30px; display: inline-flex; align-items: center; justify-content: center; color: var(--ctl-fg);@@ -228,7 +253,7 @@ button.head-bot:active { background: var(--pill-press); }.composer .model-chip.perm { max-width: 160px; }/* 发送:空的时候是中性的灰钮(不用半透明的墨色或黄绿,会发浑);能发了才亮起品牌色,悬停时箭头往上提一点 */.send {- width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center;+ width: var(--ctl-lg); height: var(--ctl-lg); border-radius: 50%; flex: none; display: grid; place-items: center;background: var(--send-bg); color: var(--send-fg); box-shadow: var(--primary-edge);transition: background var(--t-base), color var(--t-base), box-shadow var(--t-base), transform var(--t-fast);}@@ -237,9 +262,5 @@ button.head-bot:active { background: var(--pill-press); }.send:hover:not(:disabled):not(.stop) .ic { transform: translateY(-1px); }.send:active:not(:disabled) { background: var(--primary-press); transform: scale(var(--press-strong)); }.send:disabled { background: var(--pill); color: var(--faint); box-shadow: none; }-.composer-disabled { pointer-events: auto; width: min(var(--col-w), calc(100% - 48px)); margin: 0 auto var(--space-2); }--@media (max-width: 1000px) {- .chat-col, .composer, .composer-disabled { width: calc(100% - 32px); }-}+.composer-disabled { pointer-events: auto; width: var(--col); margin: 0 auto var(--space-2); }}diff --git a/ui/css/settings.css b/ui/css/settings.cssindex 7551544..6b65eab 100644--- a/ui/css/settings.css+++ b/ui/css/settings.css@@ -1,10 +1,12 @@-/* 设置页与机器人设置(参考 Codex):白底,大标题,分组标题是正文色的小标题,白色圆角 .list 一行一项,开关用 Switch。+/* 设置页与机器人设置(参考 Codex / macOS 系统设置):大标题,分组标题是正文色的小标题,每组是一块 --well(底色深一级、+ 不描边),一行一项、行间一条细线,开关用 Switch。设置分页在侧栏(shell.css 的 .side-nav)。 */@layer app {-.settings { flex: 1; min-height: 0; overflow-y: auto; }+/* 内容列居中、最宽 --page-w,两侧至少 --page-gutter(和对话列同一条规则) */+.settings { --page-px: max(var(--page-gutter), calc((100% - var(--page-w)) / 2)); flex: 1; min-height: 0; overflow-y: auto; }.set-head {display: flex; align-items: center; gap: var(--space-3);- padding: var(--space-12) max(24px, calc((100% - var(--page-w)) / 2)) var(--space-2);+ padding: var(--page-top) var(--page-px) var(--space-2);-webkit-app-region: drag;}.set-head > * { -webkit-app-region: no-drag; }@@ -12,25 +14,24 @@.set-titles { min-width: 0; display: grid; gap: var(--space-0-5); }.set-titles .set-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }.set-sub { font-size: var(--fs-md); color: var(--muted); }-.set-back { --ib-size: 32px; --ib-r: var(--r-full); --ib-fg: var(--ctl-fg); margin-left: calc(-1 * var(--space-1-5)); }-.set-body { padding: var(--space-2) max(24px, calc((100% - var(--page-w)) / 2)) var(--space-16); }+/* 返回钮往左探出,箭头的笔画落在内容列的左边上(和分组标题、标签、卡片同一条线) */+.set-back { --ib-size: 32px; --ib-r: var(--r-full); --ib-fg: var(--ctl-fg); margin-left: calc(-1 * var(--space-2-5)); }+.set-body { padding: var(--space-2) var(--page-px) var(--page-bottom); }-/* 分组标题与卡片 */-.settings .list-head { margin: var(--space-8) var(--space-0-5) var(--space-2-5); font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--fg); }+/* 分组标题与卡片:标题、输入框标签、卡片共用内容列的左边 */+.settings .list-head { margin: var(--section-gap) 0 var(--heading-gap); font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--fg); }.settings .list-head:first-child { margin-top: var(--space-6); }-.settings .list { border-radius: var(--r-2xl); }.settings .list + .list { margin-top: var(--space-3); }.settings .row { --row-h: 60px; --row-py: var(--space-3); --row-pl: var(--space-4); --row-pr: var(--space-4); --row-gap: var(--space-4); }.settings .row .name { font-size: var(--fs-lg); }-.settings .row .sub { font-size: var(--fs-sm); line-height: var(--lh-snug); margin-top: var(--space-0-5); max-width: 460px; white-space: normal; }-.settings .row .ctl { gap: var(--space-1-5); }+.settings .row .sub { font-size: var(--fs-sm); line-height: var(--lh-snug); max-width: 460px; white-space: normal; }.settings .pick { height: var(--ctl-md); padding: 0 var(--space-2) 0 var(--space-3); border-radius: var(--r-lg); }.settings .seg { --seg-r: var(--r-lg); }.settings .seg button { height: var(--ctl-sm); }-.set-part { margin: var(--space-8) var(--space-0-5) var(--space-2-5); font-size: var(--fs-lg); font-weight: var(--fw-semibold); }+.set-part { margin: var(--section-gap) 0 var(--heading-gap); font-size: var(--fs-lg); font-weight: var(--fw-semibold); }.set-part:first-child { margin-top: var(--space-6); }.set-body > .list:first-child { margin-top: var(--space-6); }-.set-none { margin: var(--space-8) var(--space-0-5); font-size: var(--fs-md); color: var(--muted); }+.set-none { margin: var(--section-gap) 0; font-size: var(--fs-md); color: var(--muted); }.mf-state { display: inline-flex; align-items: center; gap: var(--space-1-5); font-size: var(--fs-sm); color: var(--fg-2); }/* 机器人设置:身份是带标签的输入框(参考 Codex 的编辑页) */@@ -43,38 +44,39 @@/* 新建机器人(参考 Grok Bot 的创建页):居中的表单,下面是模板卡片 */.new-bot { flex: 1; min-height: 0; display: flex; flex-direction: column; }.new-bot .head-bot.static:hover { background: none; }-.new-body { flex: 1; min-height: 0; overflow-y: auto; display: grid; justify-items: center; align-content: start; gap: var(--space-12); padding: var(--space-12) var(--space-6) var(--space-16); }+.new-body { flex: 1; min-height: 0; overflow-y: auto; display: grid; justify-items: center; align-content: start; gap: var(--space-12); padding: var(--page-top) var(--page-gutter) var(--page-bottom); }.new-form { width: min(460px, 100%); display: grid; justify-items: center; }.new-title { margin-top: var(--space-4); font-size: var(--fs-4xl); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tighter); line-height: var(--lh-tight); text-align: center; }.new-lead { margin: var(--space-2) 0 var(--space-6); font-size: var(--fs-md); color: var(--muted); line-height: var(--lh-relaxed); text-align: center; }.new-form .set-field { width: 100%; }.new-form .btn { min-width: 140px; }.new-sugg { width: min(720px, 100%); }-.new-sugg .list-head { margin: 0 var(--space-0-5) var(--space-3); font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--fg); }+.new-sugg .list-head { margin: 0 0 var(--heading-gap); font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--fg); }.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(216px, 1fr)); gap: var(--space-3); }-/* 模板卡:悬停浮起 1px(描边加深、投影变大),按下压回去,选中是 accent 描边 + 一层黄绿,图标亮成黄绿片 */+/* 模板卡:一块 --well,不描边、不浮起。悬停底色深一级,按下再深一级并轻微缩小;+ 选中是一层黄绿 + 图标亮成黄绿片(图标平时只是一个字形,不套底) */.tpl {display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: var(--space-3); row-gap: var(--space-0-5); align-content: start;- padding: var(--space-3-5) var(--space-4); border-radius: var(--r-2xl); text-align: left;- background: var(--card); box-shadow: inset 0 0 0 .5px var(--line), var(--shadow-xs);- transition: background var(--t-fast), box-shadow var(--t-base), transform var(--t-base);+ padding: var(--card-pad); border-radius: var(--r-well); text-align: left;+ background: var(--well);+ transition: background var(--t-fast), transform var(--t-fast);}-.tpl:hover { box-shadow: inset 0 0 0 .5px var(--line-strong), var(--shadow-sm); transform: translateY(-1px); }-.tpl:active { box-shadow: inset 0 0 0 .5px var(--line-strong), var(--shadow-xs); transform: scale(var(--press)); transition-duration: var(--dur-fast); }-.tpl.on { background: linear-gradient(var(--accent-wash), var(--accent-wash)), var(--card); box-shadow: inset 0 0 0 1.5px var(--accent), var(--shadow-xs); }+.tpl:hover { background: var(--well-hover); }+.tpl:active { background: var(--well-press); transform: scale(var(--press)); }+.tpl.on, .tpl.on:hover { background: var(--accent-wash); }.tpl-ic {- grid-row: span 2; width: 36px; height: 36px; border-radius: var(--r-lg); display: grid; place-items: center; background: var(--pill); color: var(--fg-2);- transition: background var(--t-base), color var(--t-base), box-shadow var(--t-base);+ grid-row: span 2; width: 36px; height: 36px; border-radius: var(--r-lg); display: grid; place-items: center; color: var(--fg-2);+ transition: background var(--t-base), color var(--t-base);}-.tpl:hover .tpl-ic { background: var(--pill-hover); color: var(--fg); }-.tpl.on .tpl-ic { background: var(--accent-solid); color: var(--on-accent); box-shadow: inset 0 0 0 .5px var(--accent-line); }+.tpl:hover .tpl-ic { color: var(--fg); }+.tpl.on .tpl-ic { background: var(--accent-solid); color: var(--on-accent); box-shadow: inset 0 0 0 .5px var(--accent-line); } /* 描边:黄绿在白底上只有 1.15:1,要一道墨色细边 */.tpl-name { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }.tpl-desc { font-size: var(--fs-sm); color: var(--muted); line-height: var(--lh-snug); }/* onboarding */.onboard {flex: 1; min-height: 0; height: 100vh; overflow-y: auto;- display: grid; justify-items: center; align-content: center; padding: var(--space-12) var(--space-4);+ display: grid; justify-items: center; align-content: center; padding: var(--page-top) var(--page-gutter);-webkit-app-region: drag;}.onboard > * { -webkit-app-region: no-drag; }@@ -82,10 +84,13 @@.onboard-hero { display: grid; justify-items: center; gap: var(--space-2-5); text-align: center; margin-bottom: var(--space-1-5); }.onboard-hero h1 { font-size: var(--fs-3xl); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tighter); }.onboard-hero p { font-size: var(--fs-md); color: var(--muted); line-height: var(--lh-relaxed); }+/* 引导页的卡片是浮在环境光上的一块玻璃,和对话框同一种面(同一个圆角、同一种材质) */.onboard .list {- padding: var(--space-4); display: grid; gap: var(--space-2-5); border: 0; border-radius: var(--r-3xl);+ padding: var(--card-pad); display: grid; gap: var(--space-2-5); border-radius: var(--r-pane);background: var(--grain), var(--glass-sheet); box-shadow: var(--shadow-pop);}+/* 同一个表单(onboarding.js 的 KeyForm)在"更换密钥"对话框里:对话框本身就是那张卡,表单直接排在对话框的内边距里,不再套一层 */+.sheet > form.list { padding: 0; background: none; border-radius: 0; overflow: visible; display: grid; gap: var(--space-2-5); }.onboard label.k { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--fg-2); }.onboard .err-text { font-size: var(--fs-sm); color: var(--red); line-height: var(--lh-normal); display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }.onboard .slow { font-size: var(--fs-sm); color: var(--muted); }@@ -97,11 +102,12 @@.onboard details[open] summary .ic { transform: rotate(180deg); }.onboard details summary { transition: color var(--t-fast); }.onboard details summary:hover { color: var(--fg); }-.onboard details .row { margin-top: var(--space-2); background: var(--grain), var(--glass-sheet); box-shadow: var(--glass-ring); border-radius: var(--r-xl); }+/* "高级"里的行直接排在卡片里,左右贴着卡片的内容边,不再套一块玻璃 */+.onboard details .row { --row-pl: 0; --row-pr: 0; margin-top: var(--space-1); }.onboard .connected { display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-lg); font-weight: var(--fw-semibold); }.picklist { max-height: 300px; overflow-y: auto; margin: 0 calc(-1 * var(--space-1-5)); padding: 0 var(--space-1-5); }.picklist > .hint { padding: var(--space-2); }-.picklist .group { padding: var(--space-2) var(--space-1) 3px; font-size: var(--fs-2xs); font-weight: var(--fw-semibold); color: var(--faint); letter-spacing: var(--tracking-caps); }+.picklist .group { padding: var(--space-2) var(--space-2) var(--space-1); font-size: var(--fs-2xs); font-weight: var(--fw-semibold); color: var(--muted); }.picklist button {--focus-offset: -2px;display: flex; align-items: center; width: 100%; height: var(--ctl-lg); padding: 0 var(--space-2); border-radius: var(--r-md);diff --git a/ui/css/shell.css b/ui/css/shell.cssindex 937e955..5fb1364 100644--- a/ui/css/shell.css+++ b/ui/css/shell.css@@ -21,14 +21,14 @@grid-template-columns: var(--side-w) minmax(0, 1fr);}/* "已保存" sits in the window's bottom-left corner, over the sidebar above the account button,- so it never covers the floating composer */-.app .toasts { bottom: 68px; }+ so it never covers the floating composer: left edge on the sidebar rows' line, one --side-inset above the account row */+.app .toasts { left: var(--side-inset); bottom: calc(var(--side-inset) * 2 + var(--ctl-2xl)); }.app.with-panel { grid-template-columns: var(--side-w) minmax(0, 1fr) var(--panel-w); }/* 主区:浮在环境光上的面板。不要给它加 backdrop-filter / transform——里面的菜单是 position: fixed */.main {position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column;margin: var(--pane-gap) var(--pane-gap) var(--pane-gap) 0;- border-radius: var(--r-2xl); background: var(--surface); box-shadow: var(--shadow-pane); overflow: hidden;+ border-radius: var(--r-pane); background: var(--surface); box-shadow: var(--shadow-pane); overflow: hidden; /* 描边:浮在环境光上的面板,浅色下和环境光只差 1.1:1,要一道 .5px 的边 */}.view { --rise: 4px; animation: rise-in var(--dur-moderate) var(--ease-out); }@@ -41,43 +41,45 @@min-height: 0; display: flex; flex-direction: column;background: var(--grain), var(--glass-side);}+/* 顶部按钮和主区顶栏在同一条中线上:主区离窗口上沿 --pane-gap,这里也先让出 --pane-gap */.side-top {- display: flex; align-items: center; justify-content: flex-end; gap: var(--space-1);- height: var(--head-h); padding: 0 var(--space-3) 0 var(--space-4); flex: none;+ display: flex; align-items: center; justify-content: flex-end; gap: var(--bar-gap);+ height: calc(var(--pane-gap) + var(--head-h)); padding: var(--pane-gap) var(--side-inset) 0; flex: none;-webkit-app-region: drag;}.side-top > * { -webkit-app-region: no-drag; }-.side-top.start { justify-content: flex-start; padding-left: var(--space-2); }+.side-top.start { justify-content: flex-start; }.side-back {- display: inline-flex; align-items: center; gap: var(--space-1-5); height: var(--ctl-lg); padding: 0 var(--space-2-5) 0 var(--space-2);+ display: inline-flex; align-items: center; gap: var(--space-1-5); height: var(--ctl-lg); padding: 0 var(--side-row-px);border-radius: var(--r-lg); font-size: var(--fs-md); color: var(--ctl-fg); transition: background var(--t-fast), color var(--t-fast);}.side-back:hover { background: var(--side-hover); color: var(--fg); }.side-back:active { background: var(--side-press); }.side-top .icon-btn { --ib-size: 30px; --ib-fg: var(--ctl-fg); }.side-top .icon-btn.on { box-shadow: var(--shadow-tile); }+/* 搜索框和行同宽;图标、间隙和设置导航一样,搜索文字和导航文字对齐 */.side-search {- flex: none; display: flex; align-items: center; gap: var(--space-2); height: 34px; margin: 0 var(--space-3) var(--space-2-5); padding: 0 var(--space-3);+ flex: none; display: flex; align-items: center; gap: var(--space-2-5); height: 34px; margin: 0 var(--side-inset) var(--side-inset); padding: 0 var(--side-row-px);border-radius: var(--r-lg); background: var(--pill); color: var(--muted);- box-shadow: inset 0 0 0 .5px var(--line-2);transition: box-shadow var(--t-fast), background var(--t-fast), color var(--t-fast);}.side-search:hover { background: var(--pill-hover); }.side-search:focus-within { background: var(--card); color: var(--fg-2); box-shadow: inset 0 0 0 1px var(--accent), var(--ring); }-.side-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; font-size: var(--fs-md); color: var(--fg); }+.side-search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: none; background: transparent; font-size: var(--fs-md); color: var(--fg); }.side-search input::placeholder { color: var(--muted); }.side-search input::-webkit-search-cancel-button { display: none; }+/* 上边留一行的间隙,选中行的投影不被滚动容器裁掉 */.side-list {- flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-0-5) var(--space-2) var(--space-2);- display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: var(--space-0-5);+ flex: 1; min-height: 0; overflow-y: auto; padding: var(--side-row-gap) var(--side-inset) var(--side-inset);+ display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: var(--side-row-gap);}-.side-list > .hint { padding: var(--space-2) var(--space-2-5); }+.side-list > .hint { padding: var(--space-2) var(--side-row-px); }/* 设置时的侧栏:分页导航 */-.side-nav { gap: var(--space-0-5); --rise: 3px; animation: rise-in var(--dur-moderate) var(--ease-out); }+.side-nav { --rise: 3px; animation: rise-in var(--dur-moderate) var(--ease-out); }.nav-item {--focus-offset: -2px;- display: flex; align-items: center; gap: var(--space-2-5); height: var(--ctl-xl); padding: 0 var(--space-2-5);+ display: flex; align-items: center; gap: var(--space-2-5); height: var(--ctl-xl); padding: 0 var(--side-row-px);border-radius: var(--r-lg); font-size: var(--fs-lg); color: var(--fg-2); text-align: left;transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);}@@ -89,14 +91,14 @@.thread {--focus-offset: -2px;min-width: 0;- display: flex; align-items: center; gap: var(--space-3); width: 100%; height: 60px; padding: 0 var(--space-2-5);+ display: flex; align-items: center; gap: var(--space-3); width: 100%; height: 60px; padding: 0 var(--side-row-px);border-radius: var(--r-xl); text-align: left; position: relative;transition: background var(--t-fast), box-shadow var(--t-fast);}.thread:hover { background: var(--side-hover); }button.thread:active { background: var(--side-press); }.thread.sel, button.thread.sel:active { background: var(--side-active); box-shadow: var(--shadow-tile); }-.thread .body { min-width: 0; flex: 1; display: grid; gap: 1px; }+.thread .body { min-width: 0; flex: 1; display: grid; gap: var(--space-0-5); }.thread .line { display: flex; align-items: baseline; gap: var(--space-2); min-width: 0; }.thread .title { flex: 1; min-width: 0; font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: var(--lh-tight); }.thread .when { flex: none; font-size: var(--fs-xs); color: var(--muted); }@@ -105,22 +107,23 @@ button.thread:active { background: var(--side-press); }.thread .badge.count { --badge-bg: var(--amber-soft); --badge-fg: var(--amber); align-self: center; }.thread .avatar-wrap { position: relative; flex: none; }.thread .working-dot {- position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%;- background: var(--green); box-shadow: 0 0 0 2px var(--surface-solid);+ position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; /* 微调:压住头像的边 */+ background: var(--green); box-shadow: 0 0 0 2px var(--surface-solid); /* 描边:压在头像上的缺口,不是边框 */animation: breathe var(--dur-pulse) var(--ease-in-out) infinite;}.thread-skel { flex: 1; display: grid; gap: var(--space-1-5); }.thread .field { --field-h: 30px; }+/* 侧栏空状态:一句话 + 一个按钮,靠留白成组,不套卡片 */.side-empty {- margin: var(--space-3) var(--space-1); padding: 18px var(--space-3-5); border-radius: var(--r-xl);- background: var(--card); box-shadow: inset 0 0 0 .5px var(--line), var(--shadow-xs);+ margin: var(--space-3) 0; padding: var(--card-pad);text-align: center; display: grid; gap: var(--space-2-5); justify-items: center; color: var(--muted);}-.side-foot { flex: none; display: flex; align-items: center; padding: var(--space-2) var(--space-2) var(--space-3); }+/* 账户行的下沿和主区的下沿对齐(都离窗口下沿 --pane-gap) */+.side-foot { flex: none; display: flex; align-items: center; padding: var(--side-inset); }.account {--focus-offset: -2px;- display: flex; align-items: center; gap: var(--space-2-5); min-width: 0; flex: 1; height: var(--ctl-2xl); padding: 0 var(--space-3) 0 var(--space-2);+ display: flex; align-items: center; gap: var(--space-2-5); min-width: 0; flex: 1; height: var(--ctl-2xl); padding: 0 var(--side-row-px);border-radius: var(--r-xl); text-align: left; transition: background var(--t-fast), box-shadow var(--t-fast);}.account:hover { background: var(--side-hover); }@@ -128,7 +131,7 @@ button.thread:active { background: var(--side-press); }.account.on { background: var(--side-active); box-shadow: var(--shadow-tile); }.account .me {width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center;- background: var(--card); box-shadow: inset 0 0 0 .5px var(--line), var(--shadow-xs);+ background: var(--pill);font-weight: var(--fw-semibold); font-size: var(--fs-sm); color: var(--fg-2);}.account .who { flex: 1; min-width: 0; font-size: var(--fs-lg); color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }@@ -137,42 +140,49 @@ button.thread:active { background: var(--side-press); }/* macOS desktop: traffic lights live in the sidebar's top-left.拖动窗口只靠侧栏顶部和各页顶栏;不要把 .app 整个设成拖动区——盖在上面的命令面板、对话框、提示会跟着变成拖动区 */-:root.mac-app .side-top { padding-left: 84px; }+:root.mac-app .side-top { padding-left: var(--titlebar-inset); }-/* —— Info panel(参考 Grok Bot 的详情栏):一块更通透的玻璃面板,分组直接是列表行,不再套卡片 —— */+/* —— Info panel(参考 Grok Bot 的详情栏):一块更通透的玻璃面板,分组直接是列表行,不再套卡片;+ 需要成组的东西(展开的编辑区、待审批)是面板上唯一的一层 --well —— */.panel {min-height: 0; display: flex; flex-direction: column;margin: var(--pane-gap) var(--pane-gap) var(--pane-gap) 0;- border-radius: var(--r-2xl); background: var(--grain), var(--glass-panel); box-shadow: var(--shadow-pane); overflow: hidden;+ border-radius: var(--r-pane); background: var(--grain), var(--glass-panel); box-shadow: var(--shadow-pane); overflow: hidden;animation: slide-in var(--dur-moderate) var(--ease-out);}.panel-head {- height: var(--head-h); flex: none; display: flex; align-items: center; gap: var(--space-1); padding: 0 var(--space-2-5) 0 var(--space-4);+ height: var(--head-h); flex: none; display: flex; align-items: center; gap: var(--bar-gap); padding: 0 var(--head-px) 0 var(--pane-px);-webkit-app-region: drag;}.panel-head > * { -webkit-app-region: no-drag; }.panel-head .title { flex: 1; min-width: 0; font-size: var(--fs-xl); font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }.panel-head .icon-btn { --ib-size: 30px; }+/* 行是贴着面板的玻璃片:片离面板边缘 8,行里再缩进 8,文字落在 --pane-px,和面板标题对齐 */.panel-body { flex: 1; overflow-y: auto; padding: 0 var(--space-2) var(--space-6); }-.panel-body .list-head { margin: var(--space-5) var(--space-2) var(--space-1); }+.panel-body .list-head { margin: var(--section-gap-sm) var(--space-2) var(--space-1); }.panel-body .list-head:first-child { margin-top: var(--space-2); }-.panel-body .list { background: transparent; border: 0; border-radius: 0; overflow: visible; }+.panel-body .list { background: none; border-radius: 0; overflow: visible; } /* 面板里的行直接排在面板上,不铺 --well */.panel-body .list + .list, .panel-body .list-head + .list { margin-top: 0; }.panel-body .row { --row-h: 48px; --row-py: var(--space-1-5); --row-pl: var(--space-2); --row-pr: var(--space-2); --row-gap: var(--space-2-5); border-radius: var(--r-lg); }.panel-body .row + .row, .panel-body .row + .row-edit, .panel-body .row-edit + .row { border-top: 0; }.panel-body .row.clickable { --focus-offset: 0px; }-.panel-body .row-edit { border-radius: var(--r-lg); background: var(--card-2); box-shadow: inset 0 0 0 .5px var(--line-2); margin: var(--space-0-5) 0 var(--space-1); }+.panel-body .row-edit {+ padding-left: var(--space-2); padding-right: var(--space-2); /* 和上面那行的文字对齐 */+ border-radius: var(--r-well); background: var(--well); margin: var(--space-0-5) 0 var(--space-1);+}+/* 待审批:卡片和行一样贴着面板,上方的说明缩进到行文字那条线 */+.panel-body .approval > .hint { padding: 0 var(--space-2); }.panel-body .row > .hint { flex: none; white-space: nowrap; }.panel-qr {width: 180px; height: 180px; image-rendering: pixelated; background: var(--qr-bg);- padding: var(--space-2); border-radius: var(--r-lg); box-shadow: 0 0 0 .5px var(--line), var(--shadow-sm);+ padding: var(--space-2); border-radius: var(--r-lg);}/* 会话记录预览(信息面板 → 最近会话) */.transcript { display: grid; gap: var(--space-2); max-height: 60vh; overflow: auto; }.transcript-msg { justify-self: start; max-width: 85%; }.transcript-msg.user { justify-self: end; }.transcript-msg .bubble {- white-space: pre-wrap; padding: 7px 11px; border-radius: var(--r-2xl);+ white-space: pre-wrap; padding: var(--space-2) var(--space-3); border-radius: var(--r-bubble);font-size: var(--fs-md); line-height: var(--lh-normal); background: var(--bubble-ai);}.transcript-msg.user .bubble { background: var(--bubble-user); }diff --git a/ui/design/README.md b/ui/design/README.mdindex 47e9ebc..45df251 100644--- a/ui/design/README.md+++ b/ui/design/README.md@@ -12,7 +12,7 @@ ui/design/index.css 入口:声明层顺序并按层引入下面所有文件tokens/primitives.css L1 原始值:品牌/状态色板,间距、字号、圆角、控件高度、层级等尺度- semantic.css L2 语义 token:按用途命名、按主题取值(浅色 + 深色)+ semantic.css L2 语义 token:按用途命名、按主题取值(浅色 + 深色);另有与主题无关的间距角色motion.css 动效 token:时长、缓动、位移量、--motion 开关base/reset.css 重置、焦点环、可选中规则@@ -46,15 +46,51 @@ ui/components/ui.js 组件的 JS 写法:Button IconButton Notice Skeleton|---|---|| 颜色 | 页面和组件**只用语义色**。原始色板只在 `semantic.css` 里引用。新颜色先加语义 token(两个主题都要给值),再用。 || 字号 | 9 级 `--fs-2xs … --fs-4xl`(11 / 11.5 / 12.5 / 13 / 14 / 15 / 17 / 20 / 24)。新界面优先用文字角色 `.t-*`。 |-| 圆角 | `--r-xs … --r-3xl`、`--r-full`。嵌套时内层 = 外层 − 内边距(`.seg`、`.pop` 里的列表项就是这样算的)。圆形用 `50%`。 |-| 间距 | 4 的倍数 `--space-1 … --space-16`,另有 `-0-5 / -1-5 / -2-5 / -3-5` 半步。组件内部的精调像素可以保留。 |+| 圆角 | `--r-xs … --r-3xl`、`--r-full`。同一种面用同一个圆角角色:`--r-well`(内容里的一组)、`--r-pane`(面板与浮层)、`--r-bubble`(消息气泡),见「容器与层次」。嵌套时内层 = 外层 − 内边距(`.seg`、`.pop` 里的列表项就是这样算的)。圆形用 `50%`。 |+| 间距 | 4 的倍数 `--space-1 … --space-16`,另有 `-0-5 / -1-5 / -2-5 / -3-5` 半步。页面和组件先用按用途命名的间距角色(见下文「间距」)。写死的像素只允许 0、≤1px 的细线,以及同一行带 `/* 微调:… */` 注释的光学微调。 || 控件高度 | `--ctl-xs … --ctl-2xl`(22 / 24 / 28 / 32 / 36 / 44)。 |-| 投影 | `--shadow-xs / sm / md / lg`;`--shadow-pane`(浮在环境光上的面板)、`--shadow-tile`(侧栏选中项)、`--shadow-float` / `--shadow-pop`(玻璃的边 + 投影)、`--primary-edge`、`--seg-edge`。深色下更重,都是主题 token。 |+| 层次 | `--well` / `--well-hover` / `--well-press`(内容里的一组,只有这一层);`--line-2`(行间细线);`--ctl-edge` / `--ctl-edge-hover`(输入框的边,≥ 3:1);`--red-wash` / `--amber-wash`(提示行的淡底)。规则见「容器与层次」。 |+| 投影 | `--shadow-xs / sm / md / lg`;`--shadow-pane`(浮在环境光上的面板)、`--shadow-tile`(侧栏选中项,只有投影)、`--shadow-float` / `--shadow-pop`(玻璃的边 + 投影)、`--primary-edge`、`--seg-edge`(分段 thumb、开关圆钮,只有投影)。深色下更重,都是主题 token。内容里的组不加投影。 || 层级 | 只用 `--z-*`;同一窗格内的浮动件用 `calc(var(--z-float) ± 1)`。 || 焦点 | 输入框:accent 描边(浅色墨、深色黄绿)+ `box-shadow: var(--ring)` 黄绿光晕(错误时 `--ring-danger`);其他控件:全局 `:focus-visible` 2px 描边、外移 2px,装在会裁切的容器里时用 `--focus-offset` 往里收。 |现有语义色名(`--bg --card --pill --line --fg --muted --accent …`)沿用 magpie 的叫法,分组见 `semantic.css` 里的 `/* —— 组 —— */` 注释。+## 间距++页面和组件先用**间距角色**(`semantic.css` 里与主题无关的 `:root` 块,样例页「间距与尺寸」里有表),没有合适的角色时才直接用 `--space-*`。**一个角色只用一个值**:同一种用途不要这里 10、那里 12、别处 14。++| 角色 | token | 值 | 用在哪 |+|---|---|---|---|+| 面板间隙 | `--pane-gap` | 8 | 主区、信息面板离窗口边缘;弹出层离窗口边缘 |+| 面板内容边距 | `--pane-px` | 16 | 信息面板的标题与行文字、对话顶栏的头像 |+| 顶栏边距 | `--head-px` | 10 | 对话、信息面板、新建页的顶栏到首尾按钮 |+| 工具栏间隙 | `--bar-gap` | 4 | 一排图标按钮:顶栏、输入框工具栏、消息操作 |+| 侧栏边距 | `--side-inset` | 8 | 侧栏的行、搜索框、顶部按钮、账户离侧栏边缘 |+| 侧栏行内边距 | `--side-row-px` | 10 | 机器人行、设置导航、账户、返回、搜索框 |+| 侧栏行间隙 | `--side-row-gap` | 2 | 相邻两行 |+| 内容列边距 | `--page-gutter` | 24(窗口窄于 1000px 时 16) | 对话列、输入框、设置页、新建页、引导页两侧至少留这么多 |+| 页面上 / 下边距 | `--page-top` / `--page-bottom` | 48 / 64 | 设置页、新建页、引导页 |+| 分组间距 | `--section-gap` / `--section-gap-sm` | 32 / 20 | 页面里 / 窄面板里分组标题的上方 |+| 标题到内容 | `--heading-gap` | 10 | 页面分组标题的下方 |+| 卡片内边距 | `--card-pad` | 16 | 提问 / 审批卡、引导页卡片、侧栏空状态、模板卡 |+| 对话框内边距 | `--sheet-pad` | 20 | `.sheet` |+| 按钮组间隙 | `--ctl-gap` | 8 | 对话框、卡片、展开编辑区里的一组操作 |+| 浮层离窗口 | `--float-inset` | 16 | 提示胶囊、命令面板、对话框 |+| 弹出层离锚点 | `--pop-offset` | 6 | `usePopPosition`(JS 读 token 的像素值,不写死) |++**对齐的线**,改间距时守住:++- **顶部中线**:侧栏顶部先让出 `--pane-gap` 再放 `--head-h`,新建按钮和主区、信息面板的顶栏按钮在同一条水平线上;搜索框的上沿就是顶栏的下沿。+- **底边**:侧栏的账户行离窗口下沿 `--pane-gap`,和主区、信息面板的下沿对齐;"已保存"浮在账户行上方一个 `--side-inset`,左边和侧栏的行对齐。+- **侧栏竖线**:行、搜索框、账户的边离侧栏边缘 `--side-inset`;头像、导航图标、搜索图标、返回箭头都在 `--side-inset + --side-row-px`(18);搜索框的文字和设置导航的文字对齐。+- **面板竖线**:信息面板的标题、分组标题、行文字、展开编辑区、待审批说明都在 `--pane-px`(16);对话顶栏是 `--head-px` + 按钮自带的 6,头像也落在 16。+- **居中列**:对话列和输入框同宽 `min(--col-w, 100% − 2 × --page-gutter)`,设置页、新建页、引导页两侧也至少 `--page-gutter`。对话列的下边距和"回到底部"的位置由输入框高度 `--composer-h` 算出来。+- **弹出层**:列表离边缘 `--pop-pad`(4),项再缩进 8,于是项的文字、分组名、分隔线、搜索图标、空状态都在离边缘 12 的线上。+- **行**:默认行上下 6,"标题 + 说明"两行的行和一行的行一样高(48);`.row.compact` 只是矮一些,左右和默认行一样;`.row-edit` 的左右也和行一样,输入框和上面那行的文字对齐。++**写死的像素**只允许三种:`0`;≤1px 的细线(比如 `right: -1px` 压住描边);同一行带 `/* 微调:理由 */` 注释的光学微调,守卫测试认这个注释。尺寸(宽、高、控件大小)不算间距,但 `calc()` 里加减的像素算(`calc(100% - 48px)` 其实是两侧的边距)。+## 品牌色品牌色是 Modelflare 的**信号黄绿 `#d7ff00` + 墨色 `#161a00`**。界面骨架是纯灰阶(布局参考 Grok Bot / Codex),颜色留给两样东西:品牌信号和机器人头像。@@ -93,7 +129,39 @@ ui/components/ui.js 组件的 JS 写法:Button IconButton Notice Skeleton- **填充、悬停、描边都是半透明的一层**(`--pill*`、`--side-*`、`--line*`、`--sel*`),放在玻璃和实色上都对。不要在玻璃上用实色灰。- **`backdrop-filter` 会让元素变成 `position: fixed` 子元素的包含块**。里面会渲染菜单、对话框的容器(侧栏、主区、`.chat`)不要加,模糊只加在叶子级的浮层上。-- 系统开了"降低透明度"(`prefers-reduced-transparency`),材质自动换成接近实色,层次靠描边和投影。+- 系统开了"降低透明度"(`prefers-reduced-transparency`),材质自动换成接近实色,层次靠浮层的细边和投影。+- **模糊只给浮层**:对话框、命令面板后面的遮罩只压暗、不模糊——对话框自己的玻璃已经模糊了一层,两层叠在一起既糊又费 GPU。++## 容器与层次++一句话:**成组靠底色和间距,不靠描边;一组里面不再套一组。**++| 层 | 是什么 | 怎么画 |+|---|---|---|+| 面板 | 主区、信息面板(浮在环境光上) | `--surface` / `--glass-panel` + `--shadow-pane`(带 .5px 的边:浅色下面板和环境光只差 1.1:1)、`--r-pane` |+| 一组(只有这一层) | 设置分组 `.list`、对话里的提问 / 审批卡 `.card`、代码块、文件、模板卡、行内提示、信息面板里展开的编辑区和待审批 | `--well` 底色 + `--r-well`,**不描边、不加投影**;可点的组悬停 `--well-hover`、按下 `--well-press` |+| 组里的东西 | 行、命令、选项、按钮、输入框 | 直接排在组里:行与行之间一条 `--line-2` 细线(真需要分开时才加);命令就是一行等宽字;选项是可悬停的行 |+| 浮层 | 对话输入框、回到底部、菜单、命令面板、对话框、提示胶囊、引导页卡片 | 玻璃材质(见「材质」):`--glass-edge` 细边 + 投影是浮层自己的边,不另加描边 |++- **不嵌套**:`--well` 里不再放 `--well`、卡片或描边框。审批卡里的 `write_file …` 就是一行等宽字;选项字母平时只是一列字,选中才填成一块(这是状态,不是容器);图标不套底片(模板卡选中时图标亮成黄绿片,也是状态)。对话框里不再套卡片:"更换密钥"的表单直接排在对话框的内边距里。信息面板上的行直接排在面板上,只有展开的编辑区和待审批是一层 `--well`。+- **描边只给两种东西**:+ 1. 文字输入框 `.field`:`--ctl-edge`,对它可能落在的每一种表面(主区、信息面板、对话框、`--well`)都 ≥ 3:1(两个主题都约 3.2:1),底色透明;悬停 `--ctl-edge-hover`,聚焦换 accent + `--ring`。这是界面里唯一常驻的边——看到边就知道"这里能打字"。+ 2. 浮层玻璃的细边 `--glass-edge`,以及黄绿填充面的墨色细边 `--accent-line`(黄绿在白底上只有 1.15:1:应用标志、"已保存"、选中模板的图标)。+- **分隔线**只用在行与行之间(列表行、表格行、菜单分隔、正文 `hr`、"用时"下面),≤ 1px 的 `--line-2`(表头下沿用 `--line`)。表格不画格子:没有外框、竖线和表头底色,第一列贴着正文左边。+- **不加侧边色条**:提示 `.notice` 是一行淡底(`--red-wash` / `--amber-wash` / `--well`)+ 左边一个图标 + `--fg` 的字(在淡底上 ≥ 14:1);语气靠图标颜色,不要"淡红底 + 红边 + 左侧粗红条",也不要淡红底上的红字(对比度不够)。引文 `blockquote` 的灰色竖线是排版记号,可以留。+- **描边和投影不叠在同一个元素上**:内容里的组两样都不要;浮层只有"玻璃细边 + 投影"这一种写法;侧栏选中项、分段 thumb、开关圆钮只有投影。+- **状态用点,不用彩色胶囊**:`.badge` 是"状态点 + 文字"(和设置页的「● 已连接」同一种写法);只有计数 `.badge.count` 保留一小块底。+- **小标签**:分组名、菜单分组一律 `.t-label`(11px semibold、`--muted`),不全大写、不加字距、不用 `--faint`(读不清)。+- **同一种面同一个圆角**:`--r-well`(12)、`--r-pane`(14)、`--r-bubble`(20)。+- **不用装饰性 emoji**:服务端用 `⚠️` 标记出错的消息(微信、飞书里只能这样),界面里显示前去掉,语气交给 `Notice` 的图标。++**可交互的东西要认得出来**(非文字对比度 ≥ 3:1,或者有等效的提示):++- 输入框:`--ctl-edge` 本身 ≥ 3:1。+- 对话输入框是浮层,认得出它靠浮起的投影、常显的占位文字(`--placeholder`,3:1)、工具栏和发送钮、固定在底部的位置,输入时投影变大;侧栏搜索框靠放大镜图标 + 占位文字 + 底色,聚焦时 accent 描边 + 光晕。+- 按钮、分段、开关、下拉靠文字和填充;键盘焦点一律 2px accent 描边(`:focus-visible`),输入框是 accent 描边 + `--ring`。++真的需要一道边时,在**同一行**写 `/* 描边:理由 */`,守卫测试认这个注释(`ui/` 下除 token 文件外的所有 CSS)。## 状态@@ -101,11 +169,11 @@ ui/components/ui.js 组件的 JS 写法:Button IconButton Notice Skeleton| 状态 | 怎么表现 | 用什么 ||---|---|---|-| 悬停 | 叠一层半透明,静默控件的字从 `--ctl-fg` 变 `--fg`;卡片类(模板、胶囊、提示里的按钮)是描边加深 + 投影变大 | `--pill` → `--pill-hover`;侧栏里是更亮的一层玻璃 `--side-hover` |+| 悬停 | 叠一层半透明,静默控件的字从 `--ctl-fg` 变 `--fg`;可点的组(模板卡)底色深一级,不浮起、不加描边 | `--pill` → `--pill-hover`,`--well` → `--well-hover`;侧栏里是更亮的一层玻璃 `--side-hover` || 按下 | 再深一级,并轻微缩小(`--press` / `--press-strong`);列表行只变色不缩放 | `--pill-press`、`--sel-press`、`--side-press` || 键盘焦点 | `:focus-visible` 2px `--accent` 描边;输入框是描边 + 光晕 | `--focus-offset`、`--ring` || 打开 | 菜单展开时触发它的按钮保持"按住"的样子,箭头翻转,加号转成叉 | `[aria-expanded="true"]`,`.icon-btn.on` |-| 选中 / 当前 | 侧栏行和设置导航是浮起的玻璃片;菜单当前项打勾;模板卡 accent 描边 + `--accent-wash`,图标亮成黄绿 | `--side-active` + `--shadow-tile`,`--accent-wash` |+| 选中 / 当前 | 侧栏行和设置导航是浮起的玻璃片;菜单当前项打勾;模板卡铺一层 `--accent-wash`、图标亮成黄绿片;头像选择是底色深一级 + 名字变实(头像在"听")。都不描边 | `--side-active` + `--shadow-tile`,`--accent-wash`,`--pill-press` || 禁用 | `--o-disabled`,不响应悬停和按下;主按钮和发送钮退成中性灰(半透明的墨色或黄绿会发浑) | `:disabled` || 加载 | 转圈,颜色不变,只是不可点(`aria-busy`) | `Button loading` || 错误 | 红描边,聚焦时红光晕 | `.err` / `aria-invalid`,`--ring-danger` |@@ -125,7 +193,7 @@ ui/components/ui.js 组件的 JS 写法:Button IconButton Notice Skeleton```css.btn.primary { --btn-bg: var(--accent-solid); --btn-fg: var(--on-accent); … } /* 变体 */-.notice .btn { --btn-h: var(--ctl-sm); --btn-bg: var(--card); } /* 上下文 */+.notice .btn { --btn-h: var(--ctl-sm); --btn-px: var(--space-2-5); } /* 上下文 */```| 组件 | 类名 API | 变量 |@@ -134,15 +202,15 @@ ui/components/ui.js 组件的 JS 写法:Button IconButton Notice Skeleton| 毛玻璃 | `.glass`(组件自己是玻璃时直接写三行,见「材质」) | `--glass-bg --glass-blur --glass-shadow` || 图标按钮 | `.icon-btn [xs] [on]` | `--ib-size --ib-r --ib-fg --ib-fg-hover --ib-bg-hover --ib-bg-on --ib-bg-press` || 文字按钮 | `.text [danger\|accent]` | — |-| 输入框 | `.field [mono] [err]`,`.field-wrap > .field + .tail` | `--field-h --field-px --field-r --field-bg --field-edge --field-edge-hover --field-edge-focus --field-ring` |-| 徽标 / 点 | `.badge [ok\|err\|warn\|off] [count]`,`.dot [ok\|err\|warn]` | `--badge-bg --badge-fg`,`--dot-bg` |-| 列表行 | `.list > .row [compact] [clickable] [off] [flash]`,`.row-edit`,`.list-head` | `--row-h --row-py --row-pl --row-pr --row-gap` |+| 输入框 | `.field [mono] [err]`,`.field-wrap > .field + .tail`;边是 `--ctl-edge`(≥ 3:1),底透明 | `--field-h --field-px --field-r --field-bg --field-edge --field-edge-hover --field-edge-focus --field-ring` |+| 状态 / 计数 / 点 | `.badge [ok\|err\|warn\|off]`(状态点 + 文字),`.badge.count [warn]`(计数,唯一带底的徽标),`.dot [ok\|err\|warn]` | `--badge-fg`(点的颜色;计数的字色)`--badge-bg`(只对计数),`--dot-bg` |+| 列表行 | `.list > .row [compact] [clickable] [off] [flash]`,`.row-edit`,`.list-head`;`.list` 是一块 `--well`,行间 `--line-2` | `--row-h --row-py --row-pl --row-pr --row-gap` || 分段 | `Seg` 组件(`.seg > .thumb + button`),两个以上的选项 | `--seg-r --seg-pad --seg-thumb --seg-on` || 开关 | `Switch` 组件(`button.switch[role=switch] [sm]`),只有开 / 关 | `--switch-w --switch-h --switch-pad --switch-track --switch-track-hover --switch-dot --switch-stretch` || 菜单 | `.pick`,`.pop [up]`,`.palette`,`Menu` / `MenuButton` / `Popover` | `--pop-r --pop-pad` || 对话框 | `Sheet` / `confirmSheet()`(`.scrim > .sheet [wide]`) | `--sheet-w --sheet-r` || 提示胶囊 | `toast()` / `saved()` / `failed()`(`.toast [ok\|err\|warn]`) | `--toast-bg --toast-fg --toast-edge` |-| 行内提示 | `Notice` / `.notice [amber\|red]` | `--notice-bg --notice-fg --notice-edge` |+| 行内提示 | `Notice`(自带图标)/ `.notice [amber\|red]`:淡底 + 图标 + `--fg` 字,不描边 | `--notice-bg --notice-ic` || 加载 | `Spinner`、`Skeleton`(`.skel [circle]`)、`.empty-state` | — || 头像 | `BotAvatar [bot\|char] [state] [cue] [lively] [pokeable] [greet] [neutral]`、`AvatarPicker`、`AppMark`;6 个内置角色,见下文「头像」 | `--avatar-aura --avatar-shadow`(主题),角色颜色 `--bot-*`(原画色,两个主题相同) |@@ -187,7 +255,7 @@ JS 组件(`ui/components/ui.js`)只是给常用组合一个带逻辑的写## 新增或修改1. 先在样例页里找现成的 token、组件、文字角色。-2. 缺颜色 → `semantic.css` 加语义 token(浅色、深色各一个值);缺尺度 → `primitives.css`。+2. 缺颜色 → `semantic.css` 加语义 token(浅色、深色各一个值);缺间距 → 先找同一用途的间距角色,没有再在 `semantic.css` 的间距块里加一个(取值来自 `--space-*`);缺尺度 → `primitives.css`。3. 新组件 → `components/<name>.css`,开放 `--<name>-*` 变量,在 `index.css` 按层引入;需要逻辑时在 `ui/components/ui.js` 加 JS 写法;在 `gallery.js` 加样例。4. 页面专属样式写在 `ui/css/*.css` 的 `@layer app` 里,只引用 token。5. 跑 `npm test`。@@ -199,7 +267,12 @@ JS 组件(`ui/components/ui.js`)只是给常用组合一个带逻辑的写- `border-radius` 写死 ≥ 3px(1–2px 的细节、`50%` 不算)- `transition` / `animation` 里写死时长或缓动(`linear`、`steps()` 可以)- `z-index` 写死数字-- JS 内联样式里写死颜色或字号+- 间距写死 px:`margin` / `padding` / `gap` / `inset` / `top|right|bottom|left` / `scroll-margin|padding`,以及 `--*-gap|pad|px|py|pl|pr|pt|pb|inset|gutter` 这类间距变量;`calc()` 里加减写死的 px。0、≤1px 细线、同一行带 `/* 微调:… */` 注释的除外+- JS 内联样式里写死颜色、字号或间距+- 描边容器:`border` / `outline` 带宽度,或 `box-shadow`(包括自定义属性的值)里画一圈 `0 0 0 <宽>` 的边,而同一行没有 `/* 描边:… */`;`:focus*` 选择器里的焦点描边除外+- 侧边色条:左右两侧 ≥ 2px 的 `border`,或 `box-shadow: inset Npx 0 0`;以及上下 > 1px 的分隔线+- JS 内联样式里画边框+- `text-transform: uppercase` 和正的 `letter-spacing`(小标签不全大写、不加字距)- 引用了没定义的 `var(--x)`(带回退值的除外)- 有组件或基础样式文件没在 `index.css` 里引入diff --git a/ui/design/base/typography.css b/ui/design/base/typography.cssindex 3a4e85f..b40e67c 100644--- a/ui/design/base/typography.css+++ b/ui/design/base/typography.css@@ -1,6 +1,6 @@/* 文字角色:新界面优先用这些类,不要再挑字号。放在 utilities 层,加在组件上也能生效。- 已有组件直接引用 --fs-* / --fw-* token,效果与对应角色一致。 */-.t-caption { font-size: var(--fs-2xs); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-caps); color: var(--faint); }+ 已有组件直接引用 --fs-* / --fw-* token,效果与对应角色一致。+ 小标签(分组名、菜单分组)一律 .t-label:不全大写、不加字距、不用 --faint(对比度不够读)。 */.t-label { font-size: var(--fs-2xs); font-weight: var(--fw-semibold); color: var(--muted); }.t-meta { font-size: var(--fs-xs); color: var(--muted); line-height: var(--lh-normal); }.t-control { font-size: var(--fs-sm); }diff --git a/ui/design/components/avatar.css b/ui/design/components/avatar.cssindex 99ef75d..0614a26 100644--- a/ui/design/components/avatar.css+++ b/ui/design/components/avatar.css@@ -368,7 +368,7 @@.fx-rings { left: var(--tip-x); top: var(--tip-y); }.fx-rings i {width: calc(var(--s) * .22); aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; opacity: 0;- border: calc(var(--s) * .016) solid var(--bf-glow);+ border: calc(var(--s) * .016) solid var(--bf-glow); /* 描边:小蓝天线发出的信号圈,是图形不是容器 */animation: bf-ring var(--bf-ring) var(--ease-out) infinite;}.fx-rings i:nth-child(2) { animation-delay: var(--bf-ring-gap); }@@ -500,14 +500,16 @@.avatar-opt {display: grid; justify-items: center; gap: var(--space-1); min-width: 64px; padding: var(--space-2-5) var(--space-1-5) var(--space-1-5);border-radius: var(--r-lg); color: var(--muted); font-size: var(--fs-xs);- transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);+ transition: background var(--t-fast), color var(--t-fast);}+/* 选中:底色比悬停深一级 + 名字变实,头像本身在"听"(avatar.js 给选中项 listening)。不描边 */.avatar-opt:hover { background: var(--sel); color: var(--fg); }-.avatar-opt.on { background: var(--sel); color: var(--fg); font-weight: var(--fw-medium); box-shadow: inset 0 0 0 1.5px var(--accent); }+.avatar-opt.on, .avatar-opt.on:hover { background: var(--pill-press); color: var(--fg); font-weight: var(--fw-medium); }+.avatar-opt:active { background: var(--sel-press); }/* 应用自己的标志(不是 Modelflare 或其他任何人的 logo) */.app-mark {display: grid; place-items: center; flex: none; border-radius: 30%;- background: var(--accent-solid); color: var(--on-accent); box-shadow: inset 0 0 0 1px var(--accent-line);+ background: var(--accent-solid); color: var(--on-accent); box-shadow: inset 0 0 0 1px var(--accent-line); /* 描边:黄绿在白底上只有 1.15:1,要一道墨色细边 */}.app-mark svg { width: 56%; height: 56%; }diff --git a/ui/design/components/badge.css b/ui/design/components/badge.cssindex a3c32aa..af741d3 100644--- a/ui/design/components/badge.css+++ b/ui/design/components/badge.css@@ -1,17 +1,26 @@-/* 状态徽标 .badge [ok | err | warn | off] [count],状态点 .dot [ok | err | warn]。- 定制:覆盖 --badge-bg / --badge-fg。 */+/* 状态 .badge [ok | err | warn | off]:一个状态点 + 文字,不做成彩色胶囊(和设置页「● 已连接」同一种写法)。+ 计数 .badge.count:唯一保留底色的徽标——数字需要一块底才读得出是"几条待处理"。+ 状态点 .dot [ok | err | warn]。+ 定制:覆盖 --badge-fg(点的颜色;计数时也是字色)/ --badge-bg(只对计数生效)。 */.badge {--badge-bg: var(--pill);+ --badge-fg: var(--faint);+ display: inline-flex; align-items: center; gap: var(--space-1-5); height: 20px;+ font-size: var(--fs-xs); white-space: nowrap; flex: none; color: var(--fg-2);+}+.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--badge-fg); flex: none; }+.badge.ok { --badge-fg: var(--green); }+.badge.err { --badge-fg: var(--red); }+.badge.warn { --badge-fg: var(--amber); }+.badge.off { --badge-fg: var(--faint); color: var(--muted); }+.badge.count {--badge-fg: var(--fg-2);- display: inline-flex; align-items: center; height: 20px; padding: 0 var(--space-2); border-radius: var(--r-full);- font-size: var(--fs-2xs); font-weight: var(--fw-medium); white-space: nowrap; flex: none;+ height: 18px; min-width: 18px; padding: 0 var(--space-1-5); border-radius: var(--r-full); justify-content: center;+ font-size: var(--fs-2xs); font-weight: var(--fw-medium); font-variant-numeric: tabular-nums;background: var(--badge-bg); color: var(--badge-fg);}-.badge.ok { --badge-bg: var(--green-soft); --badge-fg: var(--green); }-.badge.err { --badge-bg: var(--red-soft); --badge-fg: var(--red); }-.badge.warn { --badge-bg: var(--amber-soft); --badge-fg: var(--amber); }-.badge.off { --badge-fg: var(--muted); }-.badge.count { height: 18px; min-width: 18px; padding: 0 5px; justify-content: center; font-variant-numeric: tabular-nums; }+.badge.count::before { content: none; }+.badge.count.warn { --badge-bg: var(--amber-soft); --badge-fg: var(--amber); }.dot { --dot-bg: var(--faint); width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--dot-bg); display: inline-block; }.dot.ok { --dot-bg: var(--green); }diff --git a/ui/design/components/button.css b/ui/design/components/button.cssindex 21ed0d7..a30bdf8 100644--- a/ui/design/components/button.css+++ b/ui/design/components/button.css@@ -63,9 +63,9 @@.icon-btn:disabled { opacity: var(--o-disabled); }.icon-btn.xs { --ib-size: 18px; --ib-r: var(--r-sm); }-/* —— 文字按钮 .text [danger | accent] —— */+/* —— 文字按钮 .text [danger | accent]:悬停底和旁边 26 高的图标按钮差不多高 —— */.text {- font-size: var(--fs-sm); color: var(--ctl-fg); padding: 3px 7px; border-radius: var(--r-sm); white-space: nowrap;+ font-size: var(--fs-sm); color: var(--ctl-fg); padding: var(--space-1) var(--space-2); border-radius: var(--r-sm); white-space: nowrap;transition: background var(--t-fast), color var(--t-fast);}.text:hover:not(:disabled) { background: var(--pill); color: var(--fg); }diff --git a/ui/design/components/feedback.css b/ui/design/components/feedback.cssindex 4a52af8..df47eb9 100644--- a/ui/design/components/feedback.css+++ b/ui/design/components/feedback.css@@ -1,7 +1,7 @@/* 加载与空状态:.spinner、.skel(骨架条)、.empty-state。 */.spinner {width: 14px; height: 14px; border-radius: 50%; flex: none;- border: 2px solid currentColor; border-right-color: transparent;+ border: 2px solid currentColor; border-right-color: transparent; /* 描边:转圈本身就是一道缺了口的圆边 */animation: spin var(--dur-spin) linear infinite;}.skel {diff --git a/ui/design/components/field.css b/ui/design/components/field.cssindex 5491857..8dd00c7 100644--- a/ui/design/components/field.css+++ b/ui/design/components/field.css@@ -1,18 +1,20 @@/* 输入框 .field [mono] [err],带尾部按钮的 .field-wrap > .field + .tail。定制:覆盖 --field-*。+ 输入框是界面里唯一常驻描边的东西(容器靠底色,见 README「容器与层次」):边是 --ctl-edge,+ 对它可能落在的每一种表面(主区、信息面板、对话框、--well)都 ≥ 3:1,所以底色透明、放在哪都认得出来。状态:悬停描边加深;聚焦 accent 描边 + --ring 光晕;错误(.err 或 aria-invalid)红描边,聚焦时红光晕;- 只读是次级底、聚焦不发光;禁用变淡且不响应悬停。 */+ 只读是 --well 底、聚焦不发光;禁用变淡且不响应悬停。 */.field {--field-h: var(--ctl-lg);--field-px: var(--space-2-5);--field-r: var(--r-md);- --field-bg: var(--card);- --field-edge: var(--line);- --field-edge-hover: var(--line-strong);+ --field-bg: transparent;+ --field-edge: var(--ctl-edge);+ --field-edge-hover: var(--ctl-edge-hover);--field-edge-focus: var(--accent);--field-ring: var(--ring);width: 100%; height: var(--field-h); padding: 0 var(--field-px);- border: 1px solid var(--field-edge); border-radius: var(--field-r);+ border: 1px solid var(--field-edge); border-radius: var(--field-r); /* 描边:输入框的边,≥ 3:1 */background: var(--field-bg); color: var(--fg); outline: none;transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);}@@ -24,10 +26,12 @@.field.err, .field[aria-invalid="true"] {--field-edge: var(--red); --field-edge-hover: var(--red); --field-edge-focus: var(--red); --field-ring: var(--ring-danger);}-.field[readonly] { --field-bg: var(--card-2); --field-edge-focus: var(--line-strong); --field-ring: 0 0 transparent; }-.field:disabled { --field-bg: var(--card-2); opacity: var(--o-disabled); }+.field[readonly] { --field-bg: var(--well); --field-edge-focus: var(--ctl-edge-hover); --field-ring: 0 0 transparent; }+.field:disabled { --field-bg: var(--well); opacity: var(--o-disabled); }textarea.field { height: auto; padding: var(--space-2) var(--field-px); resize: none; line-height: var(--lh-normal); }-.field-wrap { position: relative; display: flex; align-items: center; }-.field-wrap .field { padding-right: 62px; }+/* 尾部按钮:32 高的框里放 24 的按钮,离框的上、下、右边都是 4;文字停在按钮左边 8 */+.field-wrap { --tail-w: calc(2 * var(--ctl-sm) + var(--space-0-5)); position: relative; display: flex; align-items: center; }+.field-wrap .field { padding-right: calc(var(--space-1) + var(--tail-w) + var(--space-2)); }.field-wrap .tail { position: absolute; right: var(--space-1); display: flex; gap: var(--space-0-5); }+.field-wrap .tail .icon-btn { --ib-size: var(--ctl-sm); }diff --git a/ui/design/components/list.css b/ui/design/components/list.cssindex d31ab6b..73188c7 100644--- a/ui/design/components/list.css+++ b/ui/design/components/list.css@@ -1,10 +1,12 @@-/* 列表卡片与行:一张 .list 白卡里放若干 .row,每行"说明在左、控件在右"。+/* 列表与行:一组 .list 里放若干 .row,每行"说明在左、控件在右"。+ .list 是一块 --well(底色深一级),不描边、不加投影;行与行之间一条 --line-2 细线。改编自 yetone/magpie internal/gui/assets/app.css 的 .list / .row(MIT,© 2026 yetone)。- 定制:覆盖 --row-h / --row-px / --row-gap。 */-.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-xl); overflow: hidden; flex: none; }+ 定制:覆盖 --row-h / --row-py / --row-pl / --row-pr / --row-gap。+ 默认的上下内边距(6)让"标题 + 说明"两行的行也是 --row-h 高,一行、两行的行一样高。 */+.list { background: var(--well); border-radius: var(--r-well); overflow: hidden; flex: none; }.list + .list, .list-head + .list { margin-top: var(--space-2); }.list-head {- display: flex; align-items: center; gap: var(--space-2); margin: 18px var(--space-0-5) var(--space-1-5);+ display: flex; align-items: center; gap: var(--space-2); margin: var(--section-gap-sm) var(--space-0-5) var(--space-1-5);font-size: var(--fs-2xs); font-weight: var(--fw-semibold); color: var(--muted);}.list-head:first-child { margin-top: 0; }@@ -12,7 +14,7 @@.row {--row-h: 48px;- --row-py: 7px;+ --row-py: var(--space-1-5);--row-pl: var(--space-3-5);--row-pr: var(--space-3);--row-gap: var(--space-3);@@ -22,22 +24,25 @@.row + .row, .row + .row-edit, .row-edit + .row { border-top: 1px solid var(--line-2); }.row .who { min-width: 0; flex: 1 1 auto; }.row .name { font-weight: var(--fw-medium); letter-spacing: -.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }-.row .sub { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }+.row .sub { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: var(--space-0-5); }.row .sub.wrap { white-space: normal; }-.row .ctl { display: flex; align-items: center; gap: var(--space-1); flex: none; }+.row .ctl { display: flex; align-items: center; gap: var(--space-1-5); flex: none; }.row .val {font-family: var(--code); font-size: var(--fs-xs); color: var(--fg-2); max-width: 280px;overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: text; -webkit-user-select: text;}.row.off > :not(.ctl) { opacity: .5; }-.row.compact { --row-h: 40px; --row-py: 5px; --row-pl: 11px; --row-pr: 9px; --row-gap: 9px; }+/* 紧凑行只是矮一些;左右和默认行一样,混在同一张卡里时文字仍在一条线上 */+.row.compact { --row-h: 40px; --row-py: var(--space-1); }/* 可点的行:悬停叠一层,按下深一级,键盘焦点描边往里收(卡片会裁掉外描边) */.row.clickable { --focus-offset: -2px; transition: background var(--t-fast); }.row.clickable:hover { background: var(--pill); }.row.clickable:active { background: var(--pill-hover); }.row.flash { animation: flash var(--dur-flash) var(--ease-out); }-.row-edit { padding: var(--space-3) var(--space-3-5) var(--space-3-5); background: var(--card-2); display: grid; gap: var(--space-2-5); }-.row-edit label { display: grid; gap: 5px; font-size: var(--fs-xs); color: var(--fg-2); font-weight: var(--fw-medium); }-.row-edit .actions { display: flex; align-items: center; gap: var(--space-1-5); flex-wrap: wrap; }+/* 行下面展开的编辑区:左右和默认的行一样,里面的输入框和上面那行的文字对齐 */+/* 已经在 .list 的底色里,所以展开区不再铺一层底:只靠上面那条细线和缩进 */+.row-edit { padding: var(--space-3) var(--space-3) var(--space-3) var(--space-3-5); display: grid; gap: var(--space-2-5); }+.row-edit label { display: grid; gap: var(--space-1-5); font-size: var(--fs-xs); color: var(--fg-2); font-weight: var(--fw-medium); }+.row-edit .actions { display: flex; align-items: center; gap: var(--ctl-gap); flex-wrap: wrap; }.row-edit .hint, .hint { font-size: var(--fs-xs); color: var(--muted); line-height: var(--lh-normal); }diff --git a/ui/design/components/notice.css b/ui/design/components/notice.cssindex e53e53a..56f7086 100644--- a/ui/design/components/notice.css+++ b/ui/design/components/notice.css@@ -1,26 +1,16 @@-/* 行内提示(可带一个操作):.notice [amber | red] > .notice-text + .btn。- 定制:覆盖 --notice-bg / --notice-fg / --notice-edge。 */+/* 行内提示(可带一个操作):.notice [amber | red] > 图标 + .notice-text + .btn(Notice 组件会带上图标)。+ 一行安静的提示:只铺一层很淡的底色,不描边、不加左侧色条。字总是 --fg(在淡底上 ≥ 14:1),+ 语气由图标的颜色和底色表达,所以不会出现"淡红底上的红字"这种对比度不够的组合。+ 定制:覆盖 --notice-bg / --notice-ic。 */.notice {- --notice-bg: var(--card-2);- --notice-fg: var(--fg);- --notice-edge: inset 0 0 0 1px var(--line);- display: flex; align-items: center; gap: var(--space-2-5); padding: var(--space-2) var(--space-2-5) var(--space-2) var(--space-3);- border-radius: var(--r-lg); font-size: var(--fs-sm); line-height: var(--lh-normal);- background: var(--notice-bg); color: var(--notice-fg); box-shadow: var(--notice-edge);+ --notice-bg: var(--well);+ --notice-ic: var(--muted);+ display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3);+ border-radius: var(--r-well); font-size: var(--fs-sm); line-height: var(--lh-normal);+ background: var(--notice-bg); color: var(--fg);}+.notice > .ic { color: var(--notice-ic); }.notice .notice-text { flex: 1; min-width: 0; }-.notice.amber {- --notice-bg: var(--amber-soft); --notice-fg: var(--amber);- --notice-edge: inset 0 0 0 1px color-mix(in srgb, var(--amber) 25%, transparent);-}-.notice.red {- --notice-bg: var(--red-soft); --notice-fg: var(--red);- --notice-edge: inset 3px 0 0 var(--red), inset 0 0 0 1px color-mix(in srgb, var(--red) 22%, transparent);-}-/* 提示里的按钮是一块白色小卡:悬停时浮起一点(描边加深、投影变大),在任何底色的提示上都成立 */-.notice .btn {- --btn-h: var(--ctl-sm); --btn-px: var(--space-2-5);- --btn-bg: var(--card); --btn-bg-hover: var(--card); --btn-bg-press: var(--card);- --btn-edge: 0 0 0 .5px var(--line), var(--shadow-xs);-}-.notice .btn:hover:not(:disabled) { --btn-edge: 0 0 0 .5px var(--line-strong), var(--shadow-sm); }+.notice.amber { --notice-bg: var(--amber-wash); --notice-ic: var(--amber); }+.notice.red { --notice-bg: var(--red-wash); --notice-ic: var(--red); }+.notice .btn { --btn-h: var(--ctl-sm); --btn-px: var(--space-2-5); }diff --git a/ui/design/components/popover.css b/ui/design/components/popover.cssindex d793a8e..f47ac17 100644--- a/ui/design/components/popover.css+++ b/ui/design/components/popover.css@@ -1,10 +1,11 @@/* 菜单按钮 .pick、弹出层 .pop、命令面板 .palette,以及两者共用的列表内容。- .pick / .pop 改编自 yetone/magpie internal/gui/assets/app.css(MIT,© 2026 yetone)。 */+ .pick / .pop 改编自 yetone/magpie internal/gui/assets/app.css(MIT,© 2026 yetone)。+ 内边距:列表离弹出层边缘 --pop-pad,列表项再缩进 8,于是项的文字、分组名、搜索图标、空状态都落在离边缘 12 的同一条线上。 */-/* —— 菜单按钮:行右侧的下拉 —— */+/* —— 菜单按钮:行右侧的下拉。左边距和同高的 .btn.sm 一样;箭头图标自带留白,右边少一档 —— */.pick {display: inline-flex; align-items: center; gap: var(--space-1); height: var(--ctl-sm); max-width: 260px;- padding: 0 var(--space-1-5) 0 9px; border-radius: var(--r-md); background: var(--pill); color: var(--fg);+ padding: 0 var(--space-1-5) 0 var(--space-2-5); border-radius: var(--r-md); background: var(--pill); color: var(--fg);font-size: var(--fs-sm); transition: background var(--t-fast), transform var(--t-fast);}.pick:hover:not(:disabled), .pick[aria-expanded="true"] { background: var(--pill-hover); }@@ -17,7 +18,7 @@/* —— 弹出层:从锚点方向(--ox)弹出;向上打开时加 .up —— */.pop {--pop-r: var(--r-xl);- --pop-pad: 5px;+ --pop-pad: var(--space-1);position: fixed; z-index: var(--z-popover); width: 280px; max-height: 360px;display: flex; flex-direction: column;background: var(--grain), var(--glass-pop); backdrop-filter: var(--glass-filter-lg);@@ -32,12 +33,12 @@/* —— 命令面板 —— */.palette-scrim {position: fixed; inset: 0; z-index: calc(var(--z-palette) - 1); background: var(--scrim-soft);- backdrop-filter: blur(var(--blur-scrim)); animation: fade-in var(--dur-base) var(--ease-out);+ animation: fade-in var(--dur-base) var(--ease-out);}.palette {- --pop-r: var(--r-2xl);- --pop-pad: 5px;- position: fixed; z-index: var(--z-palette); left: 50%; top: 14vh; width: min(520px, calc(100vw - 32px)); translate: -50% 0;+ --pop-r: var(--r-pane);+ --pop-pad: var(--space-1);+ position: fixed; z-index: var(--z-palette); left: 50%; top: 14vh; width: min(520px, calc(100vw - 2 * var(--float-inset))); translate: -50% 0;max-height: 60vh; display: flex; flex-direction: column;background: var(--grain), var(--glass-pop); backdrop-filter: var(--glass-filter-lg);border-radius: var(--pop-r); box-shadow: var(--shadow-pop); overflow: hidden;@@ -55,7 +56,7 @@:is(.pop, .palette) .search input::placeholder { color: var(--faint); }:is(.pop, .palette) ul { list-style: none; margin: 0; overflow-y: auto; padding: var(--pop-pad); flex: 1 1 auto; }:is(.pop, .palette) li {- display: flex; align-items: center; gap: 9px; min-height: 30px; padding: 0 var(--space-2);+ display: flex; align-items: center; gap: var(--space-2); min-height: 30px; padding: 0 var(--space-2);border-radius: calc(var(--pop-r) - var(--pop-pad));font-size: var(--fs-sm); white-space: nowrap;}@@ -73,14 +74,15 @@:is(.pop, .palette) li.cur .check { display: inline-flex; }:is(.pop, .palette) li.group {min-height: 22px; padding: var(--space-1-5) var(--space-2) 0;- font-size: var(--fs-2xs); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-caps); color: var(--faint); pointer-events: none;+ font-size: var(--fs-2xs); font-weight: var(--fw-semibold); color: var(--muted); pointer-events: none;}-:is(.pop, .palette) li.sep { min-height: 0; height: 1px; margin: var(--space-1) var(--space-1-5); padding: 0; background: var(--line-2); pointer-events: none; }-:is(.pop, .palette) li.explained { white-space: normal; padding: var(--space-1-5) var(--space-2); align-items: flex-start; flex-direction: column; gap: 1px; }+:is(.pop, .palette) li.sep { min-height: 0; height: 1px; margin: var(--space-1) var(--space-2); padding: 0; background: var(--line-2); pointer-events: none; }+/* 两行的项(命令 + 说明、图标 + 标题 + 说明):上下内边距相同,两行之间 2px,和列表行的标题 / 说明一致 */+:is(.pop, .palette) li.explained { white-space: normal; padding: var(--space-1-5) var(--space-2); align-items: flex-start; flex-direction: column; gap: var(--space-0-5); }/* Menu 的说明项:[图标] 标题 / 说明两行 [✓] */-:is(.pop, .palette) li.rich { white-space: normal; padding: 7px var(--space-2); }-:is(.pop, .palette) li .lead { flex: none; align-self: flex-start; margin-top: 1px; color: var(--ctl-fg); display: inline-flex; }-:is(.pop, .palette) li .txt { flex: 1; min-width: 0; display: grid; gap: 1px; }+:is(.pop, .palette) li.rich { white-space: normal; padding: var(--space-1-5) var(--space-2); }+:is(.pop, .palette) li .lead { flex: none; align-self: flex-start; margin-top: 1px; color: var(--ctl-fg); display: inline-flex; } /* 微调:图标和第一行文字居中 */+:is(.pop, .palette) li .txt { flex: 1; min-width: 0; display: grid; gap: var(--space-0-5); }:is(.pop, .palette) li .txt .n { font-size: var(--fs-xs); line-height: var(--lh-snug); }:is(.pop, .palette) .empty { padding: var(--space-3-5) var(--space-3); color: var(--muted); font-size: var(--fs-sm); text-align: center; }:is(.pop, .palette) .foot { flex: none; border-top: 1px solid var(--line-2); padding: var(--pop-pad); display: flex; }diff --git a/ui/design/components/sheet.css b/ui/design/components/sheet.cssindex 3510a2c..bc8a46c 100644--- a/ui/design/components/sheet.css+++ b/ui/design/components/sheet.css@@ -1,23 +1,25 @@-/* 模态对话框:.scrim > .sheet [wide]。遮罩把后面的界面压暗并轻微模糊,对话框是最厚的一层玻璃。+/* 模态对话框:.scrim > .sheet [wide]。遮罩只把后面的界面压暗(不模糊——对话框自己的玻璃已经模糊了一层,+ 两层模糊叠在一起既糊又费 GPU),对话框是最厚的一层玻璃。+ 对话框里不再套卡片:表单、说明直接排在对话框的内边距里。退场时给 .scrim 加 .leaving(见 design/motion.js 的 usePresence)。 */.scrim {- position: fixed; inset: 0; z-index: var(--z-modal); background: var(--scrim); backdrop-filter: blur(var(--blur-scrim));- display: grid; place-items: center; padding: var(--space-6);+ position: fixed; inset: 0; z-index: var(--z-modal); background: var(--scrim);+ display: grid; place-items: center; padding: var(--float-inset);animation: fade-in var(--dur-base) var(--ease-out);}.sheet {--sheet-w: 440px;- --sheet-r: var(--r-2xl);- width: min(var(--sheet-w), 100%); max-height: calc(100vh - 48px); overflow: auto;+ --sheet-r: var(--r-pane);+ width: min(var(--sheet-w), 100%); max-height: calc(100vh - 2 * var(--float-inset)); overflow: auto;background: var(--grain), var(--glass-sheet); backdrop-filter: var(--glass-filter-lg);border-radius: var(--sheet-r); box-shadow: var(--shadow-pop);- padding: 18px 18px var(--space-4); display: grid; gap: var(--space-3);+ padding: var(--sheet-pad); display: grid; gap: var(--space-3);animation: pop-in var(--dur-slow) var(--ease-spring);}.sheet.wide { --sheet-w: 640px; }.sheet h2 { font-size: var(--fs-xl); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); }.sheet .body { color: var(--fg-2); line-height: var(--lh-relaxed); }-.sheet .actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-1); }+.sheet .actions { display: flex; justify-content: flex-end; gap: var(--ctl-gap); margin-top: var(--space-1); }.sheet pre.doc { white-space: pre-wrap; font: var(--fs-xs)/var(--lh-normal) var(--code); color: var(--fg-2); margin: 0; max-height: 60vh; overflow: auto; }.scrim.leaving { animation: fade-out var(--dur-base) var(--ease-in) forwards; pointer-events: none; }diff --git a/ui/design/components/switch.css b/ui/design/components/switch.cssindex b496028..494096a 100644--- a/ui/design/components/switch.css+++ b/ui/design/components/switch.css@@ -5,13 +5,13 @@.switch {--switch-w: 34px;--switch-h: 20px;- --switch-pad: 2px;+ --switch-pad: var(--space-0-5);--switch-track: var(--switch-off);--switch-track-hover: var(--switch-off-hover);--switch-dot: var(--switch-knob);--switch-stretch: 3px; /* 按下时圆钮拉长多少 */position: relative; flex: none; width: var(--switch-w); height: var(--switch-h); border-radius: var(--r-full);- background: var(--switch-track); box-shadow: inset 0 0 0 .5px var(--line-2);+ background: var(--switch-track);transition: background var(--t-base);}.switch::after {diff --git a/ui/design/components/toast.css b/ui/design/components/toast.cssindex 432ec8c..dee9fcb 100644--- a/ui/design/components/toast.css+++ b/ui/design/components/toast.css@@ -1,7 +1,7 @@/* 提示胶囊("已保存"):.toasts > .toast [ok | err | warn] [leaving]。改编自 yetone/magpie internal/gui/assets/app.css 的状态胶囊(MIT,© 2026 yetone)。 */.toasts {- position: fixed; z-index: var(--z-toast); left: var(--space-4); bottom: var(--space-4);+ position: fixed; z-index: var(--z-toast); left: var(--float-inset); bottom: var(--float-inset);display: grid; gap: var(--space-1-5); justify-items: start; pointer-events: none;}.toast {@@ -9,17 +9,18 @@--toast-fg: var(--fg);--toast-edge: var(--glass-edge);pointer-events: auto; font-size: var(--fs-sm); line-height: 16px; font-weight: var(--fw-medium);- padding: var(--space-1) 11px; border-radius: var(--r-full);- max-width: min(480px, calc(100vw - 32px));+ padding: var(--space-1) var(--space-3); border-radius: var(--r-full);+ max-width: min(480px, calc(100vw - 2 * var(--float-inset)));background: var(--grain), var(--toast-bg); color: var(--toast-fg); backdrop-filter: var(--glass-filter-sm);- box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 .5px var(--toast-edge), var(--shadow-md);+ box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 .5px var(--toast-edge), var(--shadow-md); /* 描边:浮层玻璃的细边 */display: flex; gap: var(--space-2); align-items: center;--rise: 6px;animation: rise-in var(--dur-base) var(--ease-out);}-.toast.ok { --toast-bg: var(--accent-solid); --toast-fg: var(--on-accent); --toast-edge: var(--accent-line); } /* "已保存":黄绿信号 */-.toast.err { --toast-bg: color-mix(in srgb, var(--red-soft) 88%, transparent); --toast-fg: var(--red); --toast-edge: color-mix(in srgb, var(--red) 30%, transparent); }-.toast.warn { --toast-bg: color-mix(in srgb, var(--amber-soft) 88%, transparent); --toast-fg: var(--amber); --toast-edge: color-mix(in srgb, var(--amber) 25%, transparent); }+.toast.ok { --toast-bg: var(--accent-solid); --toast-fg: var(--on-accent); --toast-edge: var(--accent-line); } /* "已保存":黄绿信号;黄绿在白底上只有 1.15:1,要一道墨色细边 */+/* 出错 / 注意:只换底色,边仍是中性的玻璃细边(不要"淡红底 + 红边"两层都染色) */+.toast.err { --toast-bg: color-mix(in srgb, var(--red-soft) 88%, transparent); --toast-fg: var(--red); }+.toast.warn { --toast-bg: color-mix(in srgb, var(--amber-soft) 88%, transparent); --toast-fg: var(--amber); }.toast.leaving { --rise: 4px; animation: sink-out var(--dur-base) var(--ease-in) forwards; }.toast .icon-btn {--ib-fg: currentColor; --ib-fg-hover: currentColor;diff --git a/ui/design/gallery.css b/ui/design/gallery.cssindex be4b162..2396dff 100644--- a/ui/design/gallery.css+++ b/ui/design/gallery.css@@ -2,13 +2,13 @@@layer app {.gal { display: grid; grid-template-columns: 196px minmax(0, 1fr); height: 100vh; background: var(--bg); }.gal-nav {- display: grid; align-content: start; gap: 1px; overflow-y: auto;+ display: grid; align-content: start; gap: var(--space-0-5); overflow-y: auto;padding: var(--space-5) var(--space-3); background: var(--grain), var(--glass-side); border-right: .5px solid var(--line-2);}.gal-nav .brand { display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-2) var(--space-4); font-weight: var(--fw-semibold); }-.gal-nav .t-caption { padding: var(--space-3) var(--space-2-5) var(--space-1); }+.gal-nav .t-label { padding: var(--space-3) var(--space-2-5) var(--space-1); }.gal-nav a {- display: block; padding: 5px var(--space-2-5); border-radius: var(--r-md);+ display: block; padding: var(--space-1-5) var(--space-2-5); border-radius: var(--r-md);font-size: var(--fs-sm); color: var(--fg-2); transition: background var(--t-fast), color var(--t-fast);}.gal-nav a:hover { background: var(--side-hover); color: var(--fg); text-decoration: none; }@@ -19,34 +19,35 @@display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;padding: var(--space-3) var(--space-8);background: color-mix(in srgb, var(--bg) 92%, transparent);- -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px);+ backdrop-filter: var(--glass-filter);border-bottom: 1px solid var(--line-2);}-.gal-body { max-width: 1080px; padding: var(--space-2) var(--space-8) 120px; }-.gal-sec { padding-top: var(--space-8); scroll-margin-top: 56px; }+.gal-body { max-width: 1080px; padding: var(--space-2) var(--space-8) calc(2 * var(--space-16)); }+.gal-sec { padding-top: var(--space-8); scroll-margin-top: calc(var(--space-12) + var(--space-2)); } /* 让出粘在顶上的标题栏 */.gal-sec > h2 { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); }.gal-sec > .lead { max-width: 680px; margin: var(--space-1-5) 0 var(--space-4); color: var(--muted); line-height: var(--lh-relaxed); }+.gal-sec > h2 + :not(.lead) { margin-top: var(--space-4); } /* 没有导语的分节:标题和第一个样例之间留出同样的距离 */.gal-sec h3 { margin: var(--space-6) var(--space-0-5) var(--space-2); }-/* —— 样例卡:标题 / 演示区(可双主题对照)/ 用法 —— */-.gal-specimen { margin: 0 0 var(--space-3); background: var(--card); border: 1px solid var(--line); border-radius: var(--r-xl); overflow: hidden; }+/* —— 样例卡:标题 / 演示区(可双主题对照)/ 用法。白卡放在 --bg 上,靠底色区分,不描边;卡里的几段之间是细线 —— */+.gal-specimen { margin: 0 0 var(--space-3); background: var(--card); border-radius: var(--r-xl); overflow: hidden; }.gal-specimen > figcaption { display: flex; align-items: baseline; gap: var(--space-2); padding: var(--space-2-5) var(--space-3-5); border-bottom: 1px solid var(--line-2); }.gal-specimen > figcaption b { font-weight: var(--fw-semibold); }.gal-pair { display: grid; grid-template-columns: 1fr 1fr; }-.gal-pair > .gal-demo + .gal-demo { border-left: 1px solid var(--line); }+.gal-pair > .gal-demo + .gal-demo { border-left: 1px solid var(--line-2); }.gal-demo { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); padding: var(--space-5); min-width: 0; }.gal-demo[data-theme] { background: var(--card); }.gal-demo.col { flex-direction: column; align-items: stretch; }.gal-demo.flush { padding: 0; }-.gal-demo.flush > .list { border: 0; border-radius: 0; width: 100%; }+.gal-demo.flush > .list { border-radius: 0; width: 100%; }.gal-code {- margin: 0; padding: var(--space-2-5) var(--space-3-5); border-top: 1px solid var(--line-2); background: var(--card-2);+ margin: 0; padding: var(--space-2-5) var(--space-3-5); border-top: 1px solid var(--line-2); background: var(--well);font: var(--fs-xs)/var(--lh-normal) var(--code); color: var(--fg-2); white-space: pre-wrap; overflow-x: auto;user-select: text; -webkit-user-select: text;}/* —— token 表 —— */-.gal-rows { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-xl); overflow: hidden; }+.gal-rows { background: var(--card); border-radius: var(--r-xl); overflow: hidden; }.gal-row {display: grid; grid-template-columns: minmax(190px, 1.1fr) minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-3); align-items: center;padding: var(--space-2) var(--space-3-5); border-top: 1px solid var(--line-2);@@ -59,26 +60,26 @@.gal-chip { display: flex; align-items: center; gap: var(--space-2); min-width: 0; padding: var(--space-1); border-radius: var(--r-md); }.gal-chip i {width: 28px; height: 28px; flex: none; border-radius: var(--r-sm); background: var(--sw);- box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 12%, transparent);+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 12%, transparent); /* 描边:色块样例,白色、透明色也要看得出边界 */}.gal-chip code { font-size: var(--fs-2xs); color: var(--muted); overflow-wrap: anywhere; }-.gal-bar { height: 10px; width: var(--w); border-radius: 2px; background: var(--accent-solid); box-shadow: inset 0 0 0 1px var(--accent-line); }-.gal-radius { width: 64px; height: 40px; border-radius: var(--r); background: var(--pill); box-shadow: inset 0 0 0 1px var(--line); }-.gal-height { height: var(--h); width: 120px; border-radius: var(--r-sm); background: var(--pill); box-shadow: inset 0 0 0 1px var(--line); }+.gal-bar { height: 10px; width: var(--w); border-radius: 2px; background: var(--accent-solid); box-shadow: inset 0 0 0 1px var(--accent-line); } /* 描边:黄绿样例条要一道墨色细边 */+.gal-radius { width: 64px; height: 40px; border-radius: var(--r); background: var(--pill); box-shadow: inset 0 0 0 1px var(--line); } /* 描边:圆角样例,画出轮廓才看得出圆角 */+.gal-height { height: var(--h); width: 120px; border-radius: var(--r-sm); background: var(--pill); box-shadow: inset 0 0 0 1px var(--line); } /* 描边:高度样例 */.gal-elev { display: grid; place-items: end start; width: 150px; height: 84px; padding: var(--space-2-5); border-radius: var(--r-xl); background: var(--card); box-shadow: var(--sh); }/* —— 动效 —— */.gal-track { position: relative; flex: 1; min-width: 120px; height: 18px; border-radius: var(--r-full); background: var(--pill); }.gal-track i {- position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent);+ position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); /* 微调:18 高的轨道里居中 12 的圆点 */transition: left var(--d, var(--dur-slow)) var(--e, var(--ease-out));}-.gal-track.on i { left: calc(100% - 15px); }+.gal-track.on i { left: calc(100% - 15px); } /* 微调:圆点 12 + 右边留 3 */.gal-curve { width: 56px; height: 56px; flex: none; overflow: visible; }.gal-curve rect { fill: none; stroke: var(--line); }.gal-curve path { fill: none; stroke: var(--accent); stroke-width: 2; }.gal-anim { display: grid; justify-items: center; gap: var(--space-2); width: 120px; }-.gal-anim-box { width: 72px; height: 48px; border-radius: var(--r-lg); background: var(--accent-solid); box-shadow: inset 0 0 0 1px var(--accent-line); }+.gal-anim-box { width: 72px; height: 48px; border-radius: var(--r-lg); background: var(--accent-solid); box-shadow: inset 0 0 0 1px var(--accent-line); } /* 描边:黄绿样例块要一道墨色细边 *//* —— 页面模式 —— */.gal-chat { display: flex; flex-direction: column; width: 100%; }@@ -119,6 +120,6 @@.gal-pair { grid-template-columns: minmax(0, 1fr); }.gal-stage { height: 520px; }.gal-stage-over { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }- .gal-pair > .gal-demo + .gal-demo { border-left: 0; border-top: 1px solid var(--line); }+ .gal-pair > .gal-demo + .gal-demo { border-left: 0; border-top: 1px solid var(--line-2); }}}diff --git a/ui/design/gallery.js b/ui/design/gallery.jsindex 6695d72..caf4a91 100644--- a/ui/design/gallery.js+++ b/ui/design/gallery.js@@ -10,10 +10,11 @@ import { themeMode, setThemeMode } from "../lib/theme.js";const Compare = createContext(false);-// —— 解析 token 文件:取第一个规则块,"/* —— 组名:说明 —— */" 分组,行尾注释作为说明 ——-async function loadTokens(file) {+// —— 解析 token 文件:取第一个规则块(或 from 之后的第一个),"/* —— 组名:说明 —— */" 分组,行尾注释作为说明 ——+async function loadTokens(file, from = "") {const text = await fetch(new URL(`./tokens/${file}`, import.meta.url)).then((r) => r.text());- const block = text.slice(text.indexOf("{") + 1, text.indexOf("\n}"));+ const start = from ? text.indexOf(from) : 0;+ const block = text.slice(text.indexOf("{", start) + 1, text.indexOf("\n}", start));const groups = [];let g = null;for (const line of block.split("\n")) {@@ -327,7 +328,7 @@ const STATE_ROWS = [...basic((c) => html`<div class="composer gal-bare"><button type="button" class=${`model-chip ${c}`}><span class="v">claude-sonnet-5-5</span><${Icon} name="chevDown" /></button></div>`),["打开", () => html`<div class="composer gal-bare"><button type="button" class="model-chip" aria-expanded="true"><span class="v">claude-sonnet-5-5</span><${Icon} name="chevDown" /></button></div>`],["加号 · 打开", () => html`<div class="composer gal-bare"><button type="button" class="plus" aria-expanded="true" aria-label="更多"><${Icon} name="plus" size=${15} stroke=${1.7} /></button></div>`]] },- { name: "模板卡", note: ".tpl · 悬停浮起 1px,选中是 accent 描边 + 一层黄绿", cells: [+ { name: "模板卡", note: ".tpl · 一块 --well;悬停底色深一级,选中是一层黄绿 + 黄绿图标,不描边", cells: [...basic((c) => html`<button type="button" class=${`tpl ${c}`} style="width: 190px"><span class="tpl-ic"><${Icon} name="chat" size=${17} /></span><span class="tpl-name">群聊日报</span><span class="tpl-desc">每天整理群消息</span></button>`),["选中", () => html`<button type="button" class="tpl on" style="width: 190px"><span class="tpl-ic"><${Icon} name="chat" size=${17} /></span><span class="tpl-name">群聊日报</span><span class="tpl-desc">每天整理群消息</span></button>`]] },{ name: "建议胶囊", note: ".chip", cells: basic((c) => html`<button type="button" class=${`chip ${c}`}>你能帮我做什么?</button>`) },@@ -356,9 +357,13 @@ function Gallery() {const [prim, setPrim] = useState(null);const [sem, setSem] = useState(null);const [mot, setMot] = useState(null);+ const [roles, setRoles] = useState(null);+ const [radii, setRadii] = useState(null);useEffect(() => {loadTokens("primitives.css").then(setPrim);loadTokens("semantic.css").then(setSem);+ loadTokens("semantic.css", "\n:root {").then(setRoles);+ loadTokens("semantic.css", "/* 圆角角色").then(setRadii);loadTokens("motion.css").then(setMot);}, []);const motion = (mot || []).flatMap((g) => g.tokens);@@ -371,7 +376,7 @@ function Gallery() {return html`<${Compare.Provider} value=${compare}><div class="gal"><nav class="gal-nav" aria-label="目录"><div class="brand"><${AppMark} size=${24} />设计库</div>- ${nav.map(([g, items]) => html`<div class="t-caption">${g}</div>${items.map(([id, label]) => html`<a href=${"#" + id}>${label}</a>`)}`)}+ ${nav.map(([g, items]) => html`<div class="t-label">${g}</div>${items.map(([id, label]) => html`<a href=${"#" + id}>${label}</a>`)}`)}</nav><main class="gal-main"><header class="gal-head">@@ -391,6 +396,15 @@ function Gallery() {utilities .t-*(文字角色).stack .cluster .grow .truncate .tone-* */`}>${() => html`<${Notice} action=${html`<a class="btn" href="#custom">看定制示例</a>`}>写新界面前先在这里找现成的 token 和组件;找不到再加,并且加在 token 文件里。<//>`}<//>+ <${Demo} col title="容器与层次" note="一组东西 = 底色深一级(--well)+ 间距;里面不再套框;描边只留给输入框(≥ 3:1)和浮层玻璃" code=${`.card { background: var(--well); border-radius: var(--r-well); } /* 不描边、不加投影 */+.card .cmd { font-family: var(--code); } /* 卡片里的命令是一行等宽字,不再套底 */+.notice.red { --notice-bg: var(--red-wash); --notice-ic: var(--red); } /* 提示:淡底 + 图标 + --fg 字,不描边、无色条 */`}>+ ${() => html`<div class="card"><div class="meta">需要你的批准 · <span class="num">A7K2</span></div><div class="q">机器人想在工作区之外写入文件</div>+ <div class="cmd">write_file ~/Documents/周报/2026-W44.md</div>+ <div class="actions"><${Button} variant="primary">允许(仅本次)<//><${Button}>拒绝<//></div></div>+ <${Notice} tone="red">模型请求失败:HTTP 529 上游繁忙,请稍后重试<//>+ <input class="field" placeholder="输入框保留自己的边" />`}+ <//><//><${Section} id="color" title="颜色" lead="页面与组件只用语义色。中性色按主题精调;品牌与状态色来自原始色板。点击 token 名复制 var()。">@@ -410,15 +424,18 @@ function Gallery() {${prim && html`<${ScaleRows} tokens=${group(prim, "字号")} sample=${(t) => html`<span style=${{ fontSize: `var(${t.name})` }}>模型网关 Modelflare 0123</span>`} />`}<h3 class="t-label">文字角色</h3><${Demo} col code=${`<div class="t-heading">…</div> <p class="t-meta">…</p>`}>- ${() => html`${[["t-display", "引导页标题"], ["t-heading", "对话框 / 页面标题"], ["t-title", "列表标题"], ["t-prose", "对话正文:15px,行高 1.5"], ["t-body", "界面正文:13px"], ["t-control", "控件文字:12.5px"], ["t-meta", "次要说明:11.5px,muted"], ["t-label", "分组标题:11px semibold"], ["t-caption", "菜单分组:11px,字距 .04em"]].map(+ ${() => html`${[["t-display", "引导页标题"], ["t-heading", "对话框 / 页面标题"], ["t-title", "列表标题"], ["t-prose", "对话正文:15px,行高 1.5"], ["t-body", "界面正文:13px"], ["t-control", "控件文字:12.5px"], ["t-meta", "次要说明:11.5px,muted"], ["t-label", "分组标题、菜单分组:11px semibold,不加字距"]].map(([c, s]) => html`<div class="cluster"><code class="t-meta" style="width:96px">.${c}</code><span class=${c}>${s}</span></div>`,)}`}<//><//>- <${Section} id="space" title="间距与尺寸" lead="间距以 4 为步长;圆角嵌套时内层 = 外层 − 内边距;控件高度 6 档。">- ${prim && html`<h3 class="t-label">间距</h3><${ScaleRows} tokens=${group(prim, "间距")} sample=${(t) => html`<div class="gal-bar" style=${{ "--w": `var(${t.name})` }}></div>`} />+ <${Section} id="space" title="间距与尺寸" lead="间距以 4 为步长;页面和组件优先用按用途命名的间距角色,一个角色只用一个值;圆角嵌套时内层 = 外层 − 内边距;控件高度 6 档。">+ ${prim && html`<h3 class="t-label">间距</h3><${ScaleRows} tokens=${group(prim, "间距")} sample=${(t) => html`<div class="gal-bar" style=${{ "--w": `var(${t.name})` }}></div>`} />`}+ ${roles && roles.map((g) => html`<h3 class="t-label">间距角色 · ${g.name}</h3><${ScaleRows} tokens=${g.tokens.map((t) => ({ ...t, src: t.src.replace(/^var\((--[\w-]+)\)$/, "$1") }))} sample=${(t) => html`<div class="gal-bar" style=${{ "--w": `var(${t.name})` }}></div>`} />`)}+ ${prim && html`<h3 class="t-label">圆角</h3><${ScaleRows} tokens=${group(prim, "圆角")} sample=${(t) => html`<div class="gal-radius" style=${{ "--r": `var(${t.name})` }}></div>`} />+ ${radii && html`<h3 class="t-label">圆角角色(同一种面只用一个圆角)</h3><${ScaleRows} tokens=${radii.flatMap((g) => g.tokens).map((t) => ({ ...t, src: t.src.replace(/^var\((--[\w-]+)\)$/, "$1") }))} sample=${(t) => html`<div class="gal-radius" style=${{ "--r": `var(${t.name})` }}></div>`} />`}<h3 class="t-label">控件高度</h3><${ScaleRows} tokens=${group(prim, "控件高度")} sample=${(t) => html`<div class="gal-height" style=${{ "--h": `var(${t.name})` }}></div>`} />`}<//>@@ -470,7 +487,7 @@ const { mounted, leaving } = usePresence(open); /* design/motion.js:退场<//><${Section} id="inputs" title="输入">- <${Demo} col title=".field" note="聚焦:accent 描边 + --ring 光晕" code=${`<input class="field mono err" /> <div class="field-wrap"><input class="field" /><span class="tail">…</span></div>`}>+ <${Demo} col title=".field" note="唯一常驻描边的控件:--ctl-edge 对所在表面 ≥ 3:1;聚焦:accent 描边 + --ring 光晕" code=${`<input class="field mono err" /> <div class="field-wrap"><input class="field" /><span class="tail">…</span></div>`}>${() => html`<${FieldDemo} />`}<//><//>@@ -499,7 +516,7 @@ const { mounted, leaving } = usePresence(open); /* design/motion.js:退场<//><//>- <${Section} id="lists" title="列表行" lead="设置页的基本单元:一张 .list 卡片,每行说明在左、控件在右,改动即保存。">+ <${Section} id="lists" title="列表行" lead="设置页的基本单元:一组 .list(--well 底色、不描边),每行说明在左、控件在右,行与行之间一条细线,改动即保存。"><${Demo} flush>${() => html`<div class="list"><div class="row"><div class="who"><div class="name">外观</div><div class="sub">跟随系统、浅色或深色</div></div><div class="ctl"><${SegDemo} /></div></div>@@ -549,17 +566,17 @@ const { mounted, leaving } = usePresence(open); /* design/motion.js:退场<//><${Section} id="custom" title="定制" lead="不改组件源码:在上下文里覆盖组件变量;需要一块不同主题的区域时,加 data-theme。">- <${Demo} title="覆盖组件变量" code=${`.notice .btn { --btn-h: var(--ctl-sm); --btn-bg: var(--card); } /* 上下文覆盖 */+ <${Demo} title="覆盖组件变量" code=${`.notice .btn { --btn-h: var(--ctl-sm); --btn-px: var(--space-2-5); } /* 上下文覆盖 */<button class="btn" style="--btn-bg: var(--green-soft); --btn-fg: var(--green)">…</button>.thread .badge.count { --badge-bg: var(--amber-soft); --badge-fg: var(--amber); }`}>${() => html`<button type="button" class="btn" style="--btn-bg: var(--green-soft); --btn-fg: var(--green); --btn-bg-hover: var(--green-soft)">绿色按钮</button><button type="button" class="btn primary" style="--btn-r: var(--r-full); --btn-px: var(--space-5)">胶囊主按钮</button>- <span class="badge" style="--badge-bg: var(--accent-soft); --badge-fg: var(--accent)">自定义徽标</span>+ <span class="badge" style="--badge-fg: var(--accent)">自定义状态点</span><div class="seg" style="--seg-thumb: var(--card); --seg-on: var(--fg)"><span class="thumb" style="width:52px;transform:translateX(0)"></span><button type="button" class="on">中性</button><button type="button">分段</button></div>`}<//><${Demo} title="局部主题" code=${`<div data-theme="dark">…</div> /* 子树换一套语义 token */`}>${() => html`<div data-theme="dark" class="cluster" style="padding: var(--space-3); border-radius: var(--r-xl)"><${Button} variant="primary">深色区域<//><${Badge} s="running" /><span class="t-meta">--bg / --fg 自动切换</span></div>- <div data-theme="light" class="cluster" style="padding: var(--space-3); border-radius: var(--r-xl); box-shadow: inset 0 0 0 1px var(--line)"><${Button} variant="primary">浅色区域<//><${Badge} s="running" /></div>`}+ <div data-theme="light" class="cluster" style="padding: var(--space-3); border-radius: var(--r-xl)"><${Button} variant="primary">浅色区域<//><${Badge} s="running" /></div>`}<//><//></div>diff --git a/ui/design/tokens/primitives.css b/ui/design/tokens/primitives.cssindex c294837..d3b850e 100644--- a/ui/design/tokens/primitives.css+++ b/ui/design/tokens/primitives.css@@ -53,7 +53,7 @@--white: #ffffff;--black: #000000;- /* —— 间距:4 的倍数,另有 2/6/10/14 半步 —— */+ /* —— 间距:4 的倍数,另有 2/6/10/14 半步。页面和组件优先用 semantic.css 里按用途命名的间距角色 —— */--space-0-5: 2px;--space-1: 4px;--space-1-5: 6px;@@ -91,8 +91,7 @@--lh-relaxed: 1.55;--tracking-tighter: -.02em;- --tracking-tight: -.01em;- --tracking-caps: .04em;+ --tracking-tight: -.01em; /* 只收紧大字;不给小标签加字距,也不用全大写 *//* —— 圆角:嵌套时内层 = 外层 − 内边距(.seg 8 → thumb 6) —— */--r-xs: 4px;@@ -127,8 +126,7 @@/* —— 毛玻璃:背景模糊半径与饱和度增强。材质的颜色在 semantic.css —— */--blur-sm: 12px; /* 小浮件:回到底部、提示胶囊 */--blur-md: 24px; /* 顶栏、输入框 */- --blur-lg: 40px; /* 菜单、命令面板、对话框 */- --blur-scrim: 6px; /* 对话框后面的遮罩 */+ --blur-lg: 40px; /* 菜单、命令面板、对话框。遮罩只压暗不模糊:对话框自己已经模糊了一层 */--glass-sat: 180%; /* 透出来的颜色更饱满,玻璃才不发灰 */--glass-filter: blur(var(--blur-md)) saturate(var(--glass-sat));--glass-filter-lg: blur(var(--blur-lg)) saturate(var(--glass-sat));@@ -141,5 +139,5 @@--bubble-w: 600px; /* 用户气泡最大宽度 */--head-h: 52px; /* 对话顶栏、信息面板顶栏 */--page-w: 680px; /* 设置页、机器人设置的内容列 */- --pane-gap: 8px; /* 主区、信息面板与窗口边缘的间隙:它们是浮在环境光上的面板 */+ --titlebar-inset: 84px; /* macOS 桌面版:侧栏顶部给红绿灯让出的宽度 */}diff --git a/ui/design/tokens/semantic.css b/ui/design/tokens/semantic.cssindex ba5695f..459d888 100644--- a/ui/design/tokens/semantic.css+++ b/ui/design/tokens/semantic.css@@ -6,6 +6,10 @@主区和信息面板是浮在环境光上的面板;顶栏、输入框、菜单、对话框是盖在内容上的玻璃。所以填充、悬停、描边都是半透明的一层,放在玻璃和实色上都对。+ 容器(见 README「容器与层次」):内容里的一组东西靠底色深一级(--well)和间距成组,不画描边、不加投影,+ 也不在一组里面再套一组;行与行之间需要分开时只用一条细线(--line-2)。描边只留给两种东西:+ 文字输入框(--ctl-edge,对所在表面 ≥ 3:1)和浮在内容上的玻璃(--glass-edge)。+主题可以局部生效:任何元素加 data-theme="light|dark",它的子树就换一套取值。<html data-theme> 总是解析后的值,由 index.html 在首帧前设置、lib/theme.js 保持同步。 */:root, [data-theme="light"] {@@ -31,9 +35,11 @@--glass-hi: rgba(255, 255, 255, .8); /* 玻璃顶边的高光 */--grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)' opacity='.035'/%3E%3C/svg%3E"); /* 磨砂颗粒 */- /* —— 表面:卡片与静默填充。填充都是半透明的一层 —— */- --card: #ffffff; /* 卡片、输入框 */- --card-2: rgba(0, 0, 0, .022); /* 卡片里的次级面、代码块 */+ /* —— 表面:分组的底色与静默填充。填充都是半透明的一层 —— */+ --card: #ffffff; /* 实色面:聚焦的侧栏搜索框、样例页的演示区 */+ --well: rgba(0, 0, 0, .04); /* 内容里的一组(只有这一层):设置分组、对话里的卡片、代码块、行内提示、文件、模板卡 */+ --well-hover: rgba(0, 0, 0, .06); /* 可点的一组:悬停 */+ --well-press: rgba(0, 0, 0, .08); /* 可点的一组:按下 */--pill: rgba(0, 0, 0, .045); /* 次级按钮、标签、静默填充;也是控件的悬停层 */--pill-hover: rgba(0, 0, 0, .075);--pill-press: rgba(0, 0, 0, .1);@@ -51,9 +57,10 @@--scroll-thumb-hover: rgba(0, 0, 0, .3);/* —— 线 —— */- --line: rgba(0, 0, 0, .1); /* 输入框边、卡片边 */- --line-2: rgba(0, 0, 0, .06); /* 卡片内分隔线 */- --line-strong: rgba(0, 0, 0, .2); /* 悬停的输入框、聚焦的对话输入框 */+ --line: rgba(0, 0, 0, .1); /* 表格表头的下沿、正文里的分隔线 hr */+ --line-2: rgba(0, 0, 0, .06); /* 行与行之间的细线:列表行、表格行、菜单里的分隔 */+ --ctl-edge: rgba(0, 0, 0, .44); /* 文字输入框的边:对主区、信息面板、对话框和 --well 都 ≥ 3:1(3.2:1) */+ --ctl-edge-hover: rgba(0, 0, 0, .6);/* —— 文字 —— */--fg: #1a1a1a;@@ -94,6 +101,8 @@--on-danger: var(--white);--amber: var(--amber-700);--amber-soft: var(--amber-50);+ --red-wash: color-mix(in srgb, var(--red-600) 8%, transparent); /* 出错的提示行:只铺一层淡红,字用 --fg,图标用 --red */+ --amber-wash: color-mix(in srgb, var(--amber-700) 8%, transparent); /* 需要注意的提示行 *//* —— 投影:xs/sm 贴面,md 浮起的胶囊,lg 弹出层与对话框,pane 浮在环境光上的面板 —— */--shadow-xs: 0 1px 2px rgba(0, 0, 0, .05);@@ -101,8 +110,8 @@--shadow-md: 0 2px 6px rgba(0, 0, 0, .05), 0 10px 28px rgba(0, 0, 0, .09);--shadow-lg: 0 4px 12px rgba(0, 0, 0, .06), 0 24px 60px rgba(0, 0, 0, .16);--shadow-pane: 0 0 0 .5px rgba(0, 0, 0, .1), 0 1px 3px rgba(0, 0, 0, .04), 0 8px 30px rgba(0, 0, 0, .04);- --shadow-tile: 0 0 0 .5px rgba(0, 0, 0, .07), 0 1px 2px rgba(0, 0, 0, .06); /* 侧栏选中项:浮起的玻璃片 */- --seg-edge: 0 1px 2px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .08);+ --shadow-tile: 0 1px 2px rgba(0, 0, 0, .07); /* 侧栏选中项:浮起的玻璃片(只有投影,不描边) */+ --seg-edge: 0 1px 2px rgba(0, 0, 0, .14); /* 分段 thumb、开关圆钮:只有投影,不描边 *//* —— 机器人头像:角色颜色在 primitives 的 --bot-*,这里只给随主题变的光晕和影子 —— */--avatar-aura: 30%; /* 工作中头像背后的辉光(角色辉光色的混合比例) */@@ -121,6 +130,45 @@--shadow-float: var(--glass-ring), var(--shadow-md); /* 浮在内容上的玻璃:输入框、回到底部、提示 */--shadow-pop: var(--glass-ring), var(--shadow-lg); /* 菜单、命令面板、对话框 */}+/* 间距角色:按用途命名,取值都来自 primitives.css 的 --space-*,与主题无关(见 README「间距」)。+ 一个角色只用一个值,兄弟表面靠它们对齐:侧栏顶部、对话顶栏、信息面板顶栏在同一条中线上;+ 侧栏的行、搜索框、账户落在同一条竖线上;对话列、输入框、设置页、新建页共用同一个居中列的边距。 */+:root {+ /* —— 窗口:浮起的面板与它们的顶栏 —— */+ --pane-gap: var(--space-2); /* 主区、信息面板与窗口边缘的间隙;弹出层离窗口边缘也是这么远 */+ --pane-px: var(--space-4); /* 面板里内容的左右边距:信息面板的标题与行文字、对话顶栏的头像 */+ --head-px: var(--space-2-5); /* 顶栏到首尾按钮;按钮自带 6px 内边距,里面的头像、文字正好落在 --pane-px */+ --bar-gap: var(--space-1); /* 一排图标按钮之间:顶栏、输入框工具栏、消息操作 */++ /* —— 侧栏:行、搜索框、顶部按钮、账户都离侧栏边缘 --side-inset —— */+ --side-inset: var(--pane-gap); /* 和面板间隙一样:侧栏的行与主区之间也是这么宽 */+ --side-row-px: var(--space-2-5); /* 行的左右内边距:头像、导航图标、搜索图标、返回箭头落在同一条竖线上 */+ --side-row-gap: var(--space-0-5); /* 相邻两行 */++ /* —— 页面:居中的内容列(对话列、输入框、设置页、新建页、引导页) —— */+ --page-gutter: var(--space-6); /* 内容列两侧至少留这么多;窗口窄于 1000px 时 16 */+ --page-top: var(--space-12); /* 设置页标题、新建页、引导页离上沿 */+ --page-bottom: var(--space-16); /* 滚到底时下面留的空 */+ --section-gap: var(--space-8); /* 页面里两个分组之间(分组标题的上方) */+ --section-gap-sm: var(--space-5); /* 窄面板里两个分组之间:信息面板、默认的 .list-head */+ --heading-gap: var(--space-2-5); /* 页面分组标题到它下面的内容 */++ /* —— 卡片与浮层 —— */+ --card-pad: var(--space-4); /* 内容卡片:对话里的提问 / 审批卡、引导页卡片、侧栏空状态、模板卡 */+ --sheet-pad: var(--space-5); /* 对话框 */+ --ctl-gap: var(--space-2); /* 一组按钮之间:对话框、卡片、展开编辑区的操作 */+ --float-inset: var(--space-4); /* 提示胶囊、命令面板、对话框离窗口边缘 */+ --pop-offset: var(--space-1-5); /* 弹出层离锚点(ui.js 的 usePopPosition 读它) */+}+@media (max-width: 1000px) {+ :root { --page-gutter: var(--space-4); }+}+/* 圆角角色:同一种面只用一个圆角(见 README「容器与层次」),取值来自 primitives.css 的 --r-* */+:root {+ --r-well: var(--r-xl); /* 内容里的一组:设置分组、对话里的卡片、代码块、行内提示、文件、模板卡、展开编辑区 */+ --r-pane: var(--r-2xl); /* 浮起的面板与浮层:主区、信息面板、对话框、命令面板、引导页卡片 */+ --r-bubble: var(--r-3xl); /* 消息气泡:对话里的用户消息、会话记录里的双方消息 */+}:root.win {--font: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;--code: "Cascadia Mono", Consolas, "Microsoft YaHei UI", "Microsoft YaHei", monospace;@@ -148,7 +196,9 @@--grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)' opacity='.05'/%3E%3C/svg%3E");--card: rgba(255, 255, 255, .045);- --card-2: rgba(255, 255, 255, .025);+ --well: rgba(255, 255, 255, .045);+ --well-hover: rgba(255, 255, 255, .07);+ --well-press: rgba(255, 255, 255, .095);--pill: rgba(255, 255, 255, .065);--pill-hover: rgba(255, 255, 255, .095);--pill-press: rgba(255, 255, 255, .125);@@ -166,7 +216,8 @@--line: rgba(255, 255, 255, .1);--line-2: rgba(255, 255, 255, .065);- --line-strong: rgba(255, 255, 255, .22);+ --ctl-edge: rgba(255, 255, 255, .36); /* 3.2:1 */+ --ctl-edge-hover: rgba(255, 255, 255, .5);--fg: #ececec;--fg-2: #b4b4b4;@@ -202,13 +253,15 @@--on-danger: var(--red-950);--amber: var(--amber-300);--amber-soft: var(--amber-900);+ --red-wash: color-mix(in srgb, var(--red-300) 9%, transparent);+ --amber-wash: color-mix(in srgb, var(--amber-300) 8%, transparent);--shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);--shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 3px 10px rgba(0, 0, 0, .25);--shadow-md: 0 2px 8px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .42);--shadow-lg: 0 4px 14px rgba(0, 0, 0, .35), 0 28px 70px rgba(0, 0, 0, .6);--shadow-pane: 0 0 0 .5px rgba(255, 255, 255, .08), 0 8px 30px rgba(0, 0, 0, .35);- --shadow-tile: inset 0 1px 0 rgba(255, 255, 255, .05), 0 0 0 .5px rgba(255, 255, 255, .06), 0 1px 2px rgba(0, 0, 0, .3);+ --shadow-tile: inset 0 1px 0 rgba(255, 255, 255, .05), 0 1px 2px rgba(0, 0, 0, .3);--seg-edge: inset 0 .5px 0 rgba(255, 255, 255, .1), 0 1px 2px rgba(0, 0, 0, .3);--avatar-aura: 52%;diff --git a/ui/main.js b/ui/main.jsindex 24b5bb0..5189a0d 100644--- a/ui/main.js+++ b/ui/main.js@@ -2,7 +2,7 @@// 未连接 Modelflare → 整页引导;已连接 → 侧栏 + 对话(信息面板按需),设置与机器人设置占满主区。import { render } from "preact";import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks";-import { html, Icon, DialogHost, Toasts } from "./components/ui.js";+import { html, Icon, DialogHost, Notice, Toasts } from "./components/ui.js";import { Sidebar } from "./screens/sidebar.js";import { ChatScreen } from "./screens/chat.js";import { InfoPanel } from "./screens/info-panel.js";@@ -170,7 +170,7 @@ function App() {.then((d) => {const latest = {};for (const c of d.conversations || []) if (!latest[c.botId] || c.updatedAt > latest[c.botId].updatedAt) latest[c.botId] = c;- setPreviews(Object.fromEntries(Object.entries(latest).map(([k, c]) => [k, { text: (c.lastMessage || "").replace(/\s+/g, " "), at: c.updatedAt }])));+ setPreviews(Object.fromEntries(Object.entries(latest).map(([k, c]) => [k, { text: (c.lastMessage || "").replace(/^⚠️\s*/, "").replace(/\s+/g, " "), at: c.updatedAt }])));}).catch(() => {});api("/approvals?status=pending")@@ -273,7 +273,7 @@ function App() {return html`<main class="onboard" data-screen=${mfErr ? "error" : "loading"}>${mfErr? html`<div class="onboard-col"><div class="onboard-hero"><${BotAvatar} char=${MAIN_CHAR} size=${88} state="sleep" lively pokeable /></div>- <div class="notice red"><span class="notice-text">无法连接本机服务:${mfErr}</span><button type="button" class="btn" onClick=${reloadMf}>重试</button></div></div>`+ <${Notice} tone="red" action=${html`<button type="button" class="btn" onClick=${reloadMf}>重试</button>`}>无法连接本机服务:${mfErr}<//></div>`: html`<${BotAvatar} char=${MAIN_CHAR} size=${72} state="thinking" lively />`}</main>`;}diff --git a/ui/screens/chat.js b/ui/screens/chat.jsindex f8dcb2b..15c599c 100644--- a/ui/screens/chat.js+++ b/ui/screens/chat.js@@ -1,7 +1,7 @@// 对话页(参考 Grok Bot 的顶栏、Codex 的对话与输入框):顶栏左侧头像 + 名称,右侧新对话 / 信息面板;// 760 阅读列,用户消息是浅灰气泡,机器人回复是整列正文,上方一行"思考中 / 正在回复 / 用时";底部两行输入框。import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "preact/hooks";-import { html, Icon, IconButton, CopyButton, Menu, Popover, Badge, Skeleton, autoGrow } from "../components/ui.js";+import { html, Icon, IconButton, CopyButton, Menu, Popover, Badge, Notice, Skeleton, autoGrow } from "../components/ui.js";import { BotAvatar } from "../components/avatar.js";import { Markdown, Linkified } from "../components/markdown.js";import { ModelPicker, shortModel, sameModel } from "../components/model-picker.js";@@ -56,7 +56,7 @@ export function PromptCard({ requestId, fallback }) {return () => clearInterval(t);}, [row && row.status]);- if (gone || (!row && !requestId)) return html`<div class="notice"><span class="notice-text pre-wrap">${fallback}</span></div>`;+ if (gone || (!row && !requestId)) return html`<${Notice}><span class="pre-wrap">${fallback}</span><//>`;if (!row) return html`<div class="card"><${Skeleton} w="60%" /><${Skeleton} w="40%" /></div>`;const pending = row.status === "pending";const decide = async (ok) => {@@ -164,11 +164,8 @@ function MsgActions({ text, at }) {function ErrorNotice({ text, onRetry, onFixKey }) {const auth = isAuthError(text);- return html`<div class="notice red" role="alert">- <span class="notice-text">${auth ? "Modelflare 密钥失效或已被撤销。" : text}</span>- ${auth && onFixKey && html`<button type="button" class="btn" onClick=${onFixKey}>去更新</button>`}- ${onRetry && html`<button type="button" class="btn" onClick=${onRetry}>重试</button>`}- </div>`;+ return html`<${Notice} tone="red" action=${html`${auth && onFixKey && html`<button type="button" class="btn" onClick=${onFixKey}>去更新</button>`}+ ${onRetry && html`<button type="button" class="btn" onClick=${onRetry}>重试</button>`}`}>${auth ? "Modelflare 密钥失效或已被撤销。" : text}<//>`;}export function ChatScreen({ bot, models, modelsError, reloadModels, defaultModel, infoOpen, onToggleInfo, onWorking, onOpenSettings, onOpenBotSettings, onBotUpdated, pending = 0 }) {@@ -449,7 +446,7 @@ export function ChatScreen({ bot, models, modelsError, reloadModels, defaultMode</header><div class="chat-scroll" ref=${scroller} onScroll=${onScroll}><div class="chat-col" role="log" aria-live="polite" aria-busy=${generating}>- ${loadErr && html`<div class="notice red"><span class="notice-text">读取历史消息失败:${loadErr}</span><button type="button" class="btn" onClick=${load}>重试</button></div>`}+ ${loadErr && html`<${Notice} tone="red" action=${html`<button type="button" class="btn" onClick=${load}>重试</button>`}>读取历史消息失败:${loadErr}<//>`}${items === null && html`<div class="chat-skel"><${Skeleton} w="40%" /><${Skeleton} w="28%" /></div>`}${empty && html`<div class="chat-empty"><${BotAvatar} bot=${bot} size=${88} state=${face} cue=${cue} lively pokeable greet />diff --git a/ui/screens/info-panel.js b/ui/screens/info-panel.jsindex 8e836d5..5d56e7c 100644--- a/ui/screens/info-panel.js+++ b/ui/screens/info-panel.js@@ -163,7 +163,7 @@ export function InfoPanel({ bot, onClose, onOpenBotSettings, onOpenChat }) {<div class="list-head">待审批${pending.length > 0 && html`<span class="badge count warn">${pending.length}</span>`}</div>${pending.length- ? html`<div class="stack">${pending.map((a) => html`<div key=${a.id} class="stack" style="--gap: var(--space-1)">+ ? html`<div class="stack">${pending.map((a) => html`<div key=${a.id} class="stack approval" style="--gap: var(--space-1)"><span class="hint">${CHANNEL_NAME[a.conversationId.split(":")[1]] || ""} · ${fmtAgo(a.createdAt)} · 截止 ${fmtTime(a.expiresAt).slice(-8, -3)}</span><${PromptCard} requestId=${a.id} fallback="" /></div>`)}@@ -178,7 +178,7 @@ export function InfoPanel({ bot, onClose, onOpenBotSettings, onOpenChat }) {${convs && !convs.conversations.length && html`<div class="row"><span class="hint">还没有会话</span></div>`}${convs && convs.conversations.slice(0, 12).map((c) => html`<div class="row compact clickable" role="button" tabindex="0"onClick=${() => (c.channel === "web" ? onOpenChat() : setViewing(c))} onKeyDown=${(e) => e.key === "Enter" && (c.channel === "web" ? onOpenChat() : setViewing(c))}>- <div class="who"><div class="name">${CHANNEL_NAME[c.channel] || c.channel} · ${c.title || c.peerId}</div><div class="sub">${c.lastMessage || "(空)"}</div></div>+ <div class="who"><div class="name">${CHANNEL_NAME[c.channel] || c.channel} · ${c.title || c.peerId}</div><div class="sub">${(c.lastMessage || "").replace(/^⚠️\s*/, "") || "(空)"}</div></div><span class="hint num">${fmtAgo(c.updatedAt)}</span></div>`)}</div>diff --git a/ui/screens/onboarding.js b/ui/screens/onboarding.jsindex 7d6800b..37292b9 100644--- a/ui/screens/onboarding.js+++ b/ui/screens/onboarding.js@@ -1,6 +1,6 @@// 首次启动 / 断开后:只有一个动作——粘贴 Modelflare API Key。不是向导路由,而是"未连接"时的整页空态。import { useEffect, useMemo, useRef, useState } from "preact/hooks";-import { html, Icon, Seg, Spinner } from "../components/ui.js";+import { html, Icon, Notice, Seg, Spinner } from "../components/ui.js";import { BotAvatar, MAIN_CHAR } from "../components/avatar.js";import { groupModels } from "../components/model-picker.js";import { api } from "../lib/api.js";@@ -130,8 +130,7 @@ function ModelStep({ models, initial, onDone }) {</button>`)}`)}${!groups.length && html`<p class="hint">没有匹配的模型</p>`}</div>`- : html`<div class="notice amber"><span class="notice-text">这个 Key 所在的分组暂无可用模型。可以在控制台给分组开放模型后再回来刷新。</span>- <a class="btn" href=${MF_CONSOLE} target="_blank" rel="noopener noreferrer">去控制台 ↗</a></div>`}+ : html`<${Notice} tone="amber" action=${html`<a class="btn" href=${MF_CONSOLE} target="_blank" rel="noopener noreferrer">去控制台 ↗</a>`}>这个 Key 所在的分组暂无可用模型。可以在控制台给分组开放模型后再回来刷新。<//>`}${err && html`<div class="err-text" role="alert">${err}</div>`}<button type="button" class="btn primary lg block" disabled=${busy} onClick=${start}>${busy ? html`<${Spinner} /> 正在保存…` : models.length ? "开始对话" : "仍然开始"}</button></div>`;@@ -149,7 +148,7 @@ export function Onboarding({ status, gateway, defaultModel, onDone }) {<h1>用 Modelflare 开始</h1><p>粘贴 API Key,GPT、Claude、Grok、Gemini 等模型会自动列出。</p></div>- ${gateway && gateway.mode === "managed" && gateway.state === "failed" && html`<div class="notice red"><span class="notice-text">内置模型网关没有启动:${gateway.lastError || "未知原因"}。修复后重启应用再连接。</span></div>`}+ ${gateway && gateway.mode === "managed" && gateway.state === "failed" && html`<${Notice} tone="red">内置模型网关没有启动:${gateway.lastError || "未知原因"}。修复后重启应用再连接。<//>`}${models === null? html`<${KeyForm} line=${status.line} onFace=${onFace} onConnected=${(r) => (setFace("idle"), setModels(r.models || []))} /><div class="links">