diff --git a/docs/standards/design-tokens.md b/docs/standards/design-tokens.md index bc81faf..8c45aef 100644 --- a/docs/standards/design-tokens.md +++ b/docs/standards/design-tokens.md @@ -772,6 +772,7 @@ L3 Contract ── 组件整体换肤时才加,能不建就不建 - 组内容容器用 `--iwb-set-group-bg` + `--iwb-set-group-radius`,不加外边框 - 容器内行间用 `--iwb-set-divider`;首行不画线 - 说明对齐控件列(缩进 = label-w + col-gap),颜色用 hint-color,不得私自调淡 +- 通用 / 外观 / 生图服务等所有设置页统一使用这些分组(不允许各页自写卡片或行样式) - 新增设置 token 需按 §5.1 提 RFC --- diff --git a/src/ui-appearance.js b/src/ui-appearance.js index 3337e94..86fa002 100644 --- a/src/ui-appearance.js +++ b/src/ui-appearance.js @@ -444,11 +444,10 @@ el('span', { className: 'iwb-appear-note' }, String(value.sizes[key]) + (unit || ''))) } const Group = function (title, rows, note) { - return el('section', { className: 'iwb-appear-group' }, - el('div', { className: 'iwb-appear-ghead' }, - el('span', { className: 'iwb-appear-gtitle' }, title), - note ? el('span', { className: 'iwb-appear-gnote' }, note) : null), - rows) + return el('section', { className: 'iwb-gset-group' }, + el('div', { className: 'iwb-gset-group-h' }, title), + note ? el('div', { className: 'iwb-gset-group-desc' }, note) : null, + el('div', { className: 'iwb-gset-group-body' }, rows)) } const Seg = function (val, onChange, items) { return el('div', { className: 'iwb-seg' }, (items || []).map((item) => el('button', { @@ -530,11 +529,15 @@ ] return el('div', { className: 'iwb-appear' }, - el('div', { className: 'iwb-appear-mode' }, - Seg(theme, (v) => { setTheme(v); applyTheme(v) }, [ - { value: 'light', label: '亮色' }, { value: 'dark', label: '暗色' }, { value: 'system', label: '跟随系统' }, - ]), - el('span', { className: 'iwb-appear-modehint' }, '正在微调:' + (isDark ? '暗色' : '亮色'))), + Group('主题', [ + el('div', { className: 'iwb-appear-row' }, + el('span', { className: 'iwb-appear-label' }, '外观模式'), + el('div', { className: 'iwb-appear-ctrl' }, + Seg(theme, (v) => { setTheme(v); applyTheme(v) }, [ + { value: 'light', label: '亮色' }, { value: 'dark', label: '暗色' }, { value: 'system', label: '跟随系统' }, + ])), + el('span', { className: 'iwb-appear-note' }, '正在微调:' + (isDark ? '暗色' : '亮色'))), + ]), Group('配色来源', [ el('div', { className: 'iwb-appear-row' }, diff --git a/src/ui-settings-sections.js b/src/ui-settings-sections.js index 2a0027f..514953a 100644 --- a/src/ui-settings-sections.js +++ b/src/ui-settings-sections.js @@ -1091,14 +1091,15 @@ function GSetGroup (props) { : el('span', { className: 'iwb-hint', title: '内置分层模型:唯一实测可用的图层分离模型,不可删除也不可隐藏' }, '内置'), )) provCards.push(el('div', { key: p.id, className: 'iwb-provider-card' }, + el(GSetGroup, { title: '服务' }, el('div', { className: 'iwb-prov-head' }, el('input', { className: 'iwb-input iwb-prov-name', value: p.name || '', placeholder: '服务名称', 'aria-label': '服务名称', onChange: (e) => setProv(pi, { name: e.target.value }) }), el('span', { className: 'iwb-prov-badge' }, pi === 0 ? '主服务' : '备用服务'), el('span', { className: 'iwb-prov-sum' }, (1 + (p.fallbacks || []).length) + ' 地址 · ' + (p.models || []).length + ' 模型'), pi > 0 ? el('button', { className: 'iwb-btn iwb-btn-sm', title: '移到第一位,作为默认服务', onClick: () => makeProviderDefault && makeProviderDefault(pi) }, '设为默认') : null, el('button', { className: 'iwb-btn iwb-btn-sm iwb-btn-danger', onClick: () => delProv(pi) }, '删除服务'), - ), - el('div', { className: 'iwb-section-sub' }, '服务器地址(多条自动切换)'), + )), + el(GSetGroup, { title: '服务器地址', desc: '多条自动切换' }, addrRows, el('div', { className: 'iwb-row' }, el('button', { className: 'iwb-btn iwb-btn-sm', onClick: () => addAddr(pi) }, '+ 添加地址'), @@ -1117,30 +1118,37 @@ function GSetGroup (props) { sp.results.some((r) => r.ok && r.cors === false) ? el('div', { className: 'iwb-hint' }, '有地址未开放跨域读状态码:显示的耗时是「连得上」的估算值,按它排序选最快即可,不影响生图。') : null, sp.results.length && sp.results.every((r) => !r.ok) && sp.results[0].error ? el('div', { className: 'iwb-hint' }, '全部失败 · ' + String(sp.results[0].error)) : null, ) : null, - el('div', { className: 'iwb-section-sub' }, '接口路径'), - el('div', { className: 'iwb-row' }, + ), + el(GSetGroup, { title: '接口路径' }, + el('div', { className: 'iwb-gset-row' }, + el('div', { className: 'iwb-gset-row-label' }, '生图 / 编辑'), + el('div', { className: 'iwb-gset-row-ctl' }, el('input', { className: 'iwb-input iwb-grow', value: p.genPath || '', placeholder: '生图路径,默认 /images/generations', onChange: (e) => setProv(pi, { genPath: e.target.value }) }), el('input', { className: 'iwb-input iwb-grow', value: p.editPath || '', placeholder: '编辑路径,默认 /images/edits', onChange: (e) => setProv(pi, { editPath: e.target.value }) }), + )), ), - el('div', { className: 'iwb-label' }, 'API Key 分组'), + el(GSetGroup, { title: 'API Key' }, keyRows, el('button', { className: 'iwb-btn iwb-btn-sm', onClick: () => addKey(pi) }, '+ 添加 Key 分组'), - el('div', { className: 'iwb-section-sub' }, '厂商分类(决定请求体怎么发尺寸)'), + ), + el(GSetGroup, { title: '请求分类', desc: '决定请求体怎么发尺寸' }, shapeBox, - el('div', { className: 'iwb-section-sub' }, '模型显隐(生图节点下拉只显示可见项)'), + ), + el(GSetGroup, { title: '模型', desc: '生图节点下拉只显示可见项' }, el('div', { className: 'iwb-modellist' }, modelRows.length ? modelRows : el('div', { className: 'iwb-hint' }, '暂无模型 · 手动添加')), el('div', { className: 'iwb-row' }, el('input', { className: 'iwb-input iwb-grow', placeholder: '手动添加模型名', value: modelInput[pi] || '', onChange: (e) => setModelInput((m) => ({ ...m, [pi]: e.target.value })) }), el('button', { className: 'iwb-btn iwb-btn-sm', onClick: () => { addModel(pi, (modelInput[pi] || '').trim()); setModelInput((m) => ({ ...m, [pi]: '' })) } }, '+ 添加'), ), + ), // 分层模型区块属于私有功能:开关关闭时整段不渲染(普通用户看不到任何痕迹) ...(wPrivateToolsOn ? [ - el('div', { className: 'iwb-section-sub' }, '分层模型(分层节点下拉只显示可见项,与生图模型清单互不影响)'), + el(GSetGroup, { title: '分层模型', desc: '分层节点下拉只显示可见项,与生图模型清单互不影响' }, el('div', { className: 'iwb-modellist' }, layerModelRows.length ? layerModelRows : el('div', { className: 'iwb-hint' }, '暂无分层模型')), el('div', { className: 'iwb-row' }, el('input', { className: 'iwb-input iwb-grow', placeholder: '手动添加分层模型名(如 doubao-seedream-5-0-pro-260628)', value: layerModelInput[pi] || '', onChange: (e) => setLayerModelInput((m) => ({ ...m, [pi]: e.target.value })) }), el('button', { className: 'iwb-btn iwb-btn-sm', onClick: () => { addLayerModel(pi, (layerModelInput[pi] || '').trim()); setLayerModelInput((m) => ({ ...m, [pi]: '' })) } }, '+ 添加'), - ), + )), ] : []), )) } diff --git a/style.css b/style.css index 82cc576..367c411 100644 --- a/style.css +++ b/style.css @@ -2356,3 +2356,14 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s /* 组标题与内容容器内的文字左对齐 */ .iwb-gset-group-h,.iwb-gset-group-desc{padding-left:var(--iwb-set-group-pad-x,var(--iwb-space-20))} + +/* 外观页:沿用设置面板分组 token */ +.iwb-appear{display:flex;flex-direction:column;gap:var(--iwb-set-group-gap)} +.iwb-appear .iwb-gset-group-body .iwb-appear-row{display:grid;grid-template-columns:var(--iwb-set-label-w,180px) minmax(0,1fr) auto;gap:var(--iwb-set-col-gap,var(--iwb-space-16));align-items:center;min-height:var(--iwb-set-row-h,40px);padding:var(--iwb-set-row-pad-y,var(--iwb-space-8)) 0;border-top:1px solid var(--iwb-set-divider);margin:0} +.iwb-appear .iwb-gset-group-body .iwb-appear-row:first-child{border-top:0} +.iwb-appear-label{font-size:var(--iwb-font-md);color:var(--iwb-text);text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis} + +/* 生图服务:详情不再用卡片,改为多组 gray body */ +.iwb-provider-card{background:transparent!important;border:0!important;border-radius:0!important;padding:0!important;display:flex;flex-direction:column;gap:var(--iwb-set-group-gap)} +.iwb-provider-card .iwb-gset-group-body > .iwb-row{padding:var(--iwb-set-row-pad-y,var(--iwb-space-8)) 0;margin:0} +.iwb-provider-card .iwb-gset-group-body > .iwb-row .iwb-addr-tag{min-width:42px} diff --git a/tests/_visual-tokens.spec.js-snapshots/11-provider-settings-dark-darwin.png b/tests/_visual-tokens.spec.js-snapshots/11-provider-settings-dark-darwin.png index c0868e9..5e2e367 100644 Binary files a/tests/_visual-tokens.spec.js-snapshots/11-provider-settings-dark-darwin.png and b/tests/_visual-tokens.spec.js-snapshots/11-provider-settings-dark-darwin.png differ diff --git a/tests/_visual-tokens.spec.js-snapshots/11-provider-settings-light-darwin.png b/tests/_visual-tokens.spec.js-snapshots/11-provider-settings-light-darwin.png index b0e778d..abb9037 100644 Binary files a/tests/_visual-tokens.spec.js-snapshots/11-provider-settings-light-darwin.png and b/tests/_visual-tokens.spec.js-snapshots/11-provider-settings-light-darwin.png differ