diff --git a/sidecars/panel/app.js b/sidecars/panel/app.js index 69b0ea2..0df15b1 100644 --- a/sidecars/panel/app.js +++ b/sidecars/panel/app.js @@ -1558,8 +1558,15 @@ const THEME_ACCENT_PRESETS = Object.freeze([ const FONT_SCALE_FACTORS = Object.freeze({ sm: 0.92, md: 1, - lg: 1.08, - xl: 1.15, + lg: 1.14, + xl: 1.28, +}); + +const PANEL_SCALE_FACTORS = Object.freeze({ + sm: 1, + md: 1, + lg: 1.09, + xl: 1.18, }); function normalizeClientThemeAccent(raw) { @@ -1611,10 +1618,13 @@ function applyAppearanceToRoot(targetEl, settings, { includeFontScale = true } = if (includeFontScale) { const scaleKey = normalizeClientFontScale(settings?.fontScale); const factor = FONT_SCALE_FACTORS[scaleKey] ?? 1; + const panelFactor = PANEL_SCALE_FACTORS[scaleKey] ?? 1; setOrClearStyleVar(targetEl, '--ui-font-scale', factor === 1 ? '' : String(factor)); + setOrClearStyleVar(targetEl, '--ui-panel-scale', panelFactor === 1 ? '' : String(panelFactor)); targetEl.setAttribute?.('data-font-scale', scaleKey); } else { setOrClearStyleVar(targetEl, '--ui-font-scale', ''); + setOrClearStyleVar(targetEl, '--ui-panel-scale', ''); if (typeof targetEl.removeAttribute === 'function') { targetEl.removeAttribute('data-font-scale'); } @@ -10882,7 +10892,7 @@ const STEP_COLUMN_REGISTRY = Object.freeze({ if (reason && !refs.speedReason) { refs.speedReason = h('div', { className: 'text-muted', - style: 'font-size: var(--fs-2xs);', + style: 'font-size: var(--fs-xs);', }); refs.wrapEl.appendChild(refs.speedReason); } @@ -19384,8 +19394,6 @@ function mountWindowOverlay() { portalShadow.appendChild(portalStyleEl); const initialSettings = telemetryStore.getState().telemetry?.settings; - applyAppearanceToRoot(capsuleHost, initialSettings, { includeFontScale: false }); - applyAppearanceToRoot(portalHost, initialSettings, { includeFontScale: true }); // 悬停全景概览浮层(完全解耦至 widgetRegistry,由 hoverModules 动态驱动 0..4 个独立组件,零硬编码) const hoverUpdateVerText = h('span', { text: t('capsule.hoverNewVerGeneric') }); @@ -19594,9 +19602,19 @@ function mountWindowOverlay() { [appInstance.el] ); + function syncPortalAppearance(settings) { + applyAppearanceToRoot(capsuleHost, settings, { includeFontScale: false }); + applyAppearanceToRoot(portalHost, settings, { includeFontScale: true }); + const scaleKey = normalizeClientFontScale(settings?.fontScale); + popoverEl.setAttribute?.('data-font-scale', scaleKey); + hoverTipEl.setAttribute?.('data-font-scale', scaleKey); + multiPanelEl.setAttribute?.('data-font-scale', scaleKey); + } + portalShadow.appendChild(multiPanelEl); portalShadow.appendChild(hoverTipEl); portalShadow.appendChild(popoverEl); + syncPortalAppearance(initialSettings); (document.body || document.documentElement).appendChild(portalHost); // --- 3. 几何测量、IDE 主题桥接、顶栏停靠与防溢出定位 --- @@ -19935,8 +19953,17 @@ function mountWindowOverlay() { const vh = Number(window.innerHeight || 800); const navRight = getLeftSidebarRightEdge(vw); const minLeft = navRight > 0 ? Math.max(12, navRight + 12) : 12; - const defaultCardW = Math.min(FLOATING_CARD_WIDTH, Math.max(280, vw - 24)); - const defaultMultiW = Math.min(MULTI_PANEL_WIDTH, Math.max(280, vw - 24)); + const curSettings = telemetryStore.getState().telemetry?.settings; + const panelScale = + PANEL_SCALE_FACTORS[normalizeClientFontScale(curSettings?.fontScale)] ?? 1; + const defaultCardW = Math.min( + Math.round(FLOATING_CARD_WIDTH * panelScale), + Math.max(280, vw - 24) + ); + const defaultMultiW = Math.min( + Math.round(MULTI_PANEL_WIDTH * panelScale), + Math.max(280, vw - 24) + ); const isDockComposer = capsuleHost.getAttribute('data-dock') === 'composer'; if (multiOpen) { @@ -19984,9 +20011,8 @@ function mountWindowOverlay() { if (popoverOpen) { const maxPopCardW = Math.max(280, vw - minLeft - 12); - const curSettings = telemetryStore.getState().telemetry?.settings; const popWidthMode = normalizeClientPopoverWidthMode(curSettings?.popoverWidthMode); - let desiredPopW = Math.min(POPOVER_BASE_WIDTH, maxPopCardW); + let desiredPopW = Math.min(Math.round(POPOVER_BASE_WIDTH * panelScale), maxPopCardW); if (popWidthMode === 'custom') { desiredPopW = Math.min( normalizeClientPopoverWidth(curSettings?.popoverWidth), @@ -20634,8 +20660,7 @@ function mountWindowOverlay() { const telemetry = telSt.telemetry; setI18nLanguage(telemetry?.settings?.language); - applyAppearanceToRoot(capsuleHost, telemetry?.settings, { includeFontScale: false }); - applyAppearanceToRoot(portalHost, telemetry?.settings, { includeFontScale: true }); + syncPortalAppearance(telemetry?.settings); const showMulti = telemetry?.settings?.showTopbarMultiSession !== false; patchAttr(multiBtn, 'hidden', !showMulti); @@ -21235,14 +21260,17 @@ async function bootstrapApp(mountTarget = document.getElementById('app-root')) { const appInstance = App(); mountTarget.appendChild(appInstance.el); + const syncDocAppearance = (settings) => { + setI18nLanguage(settings?.language); + if (typeof document !== 'undefined' && document.documentElement) { + applyAppearanceToRoot(document.documentElement, settings, { includeFontScale: true }); + } + }; + syncDocAppearance(telemetryStore.getState().telemetry?.settings); + const unsubAppearance = telemetryStore.subscribe( (st) => st.telemetry?.settings, - (settings) => { - setI18nLanguage(settings?.language); - if (typeof document !== 'undefined' && document.documentElement) { - applyAppearanceToRoot(document.documentElement, settings, { includeFontScale: true }); - } - } + syncDocAppearance ); const stopPolling = startAsyncTelemetryLoop(2000); diff --git a/sidecars/panel/index.html b/sidecars/panel/index.html index ccef142..676a1e4 100644 --- a/sidecars/panel/index.html +++ b/sidecars/panel/index.html @@ -4,11 +4,11 @@ 用量监控 - +
- + diff --git a/sidecars/panel/src/components/layout/WindowOverlayShell.js b/sidecars/panel/src/components/layout/WindowOverlayShell.js index ed008d5..a6d5549 100644 --- a/sidecars/panel/src/components/layout/WindowOverlayShell.js +++ b/sidecars/panel/src/components/layout/WindowOverlayShell.js @@ -15,7 +15,11 @@ import { readInjectedWindowBridge, } from '../../../shared/window-bridge-protocol.mjs'; import { App } from '../../App.js'; -import { applyAppearanceToRoot } from '../../core/appearance.js'; +import { + PANEL_SCALE_FACTORS, + applyAppearanceToRoot, + normalizeClientFontScale, +} from '../../core/appearance.js'; import { h, isEventInside, @@ -1380,8 +1384,6 @@ export function mountWindowOverlay() { portalShadow.appendChild(portalStyleEl); const initialSettings = telemetryStore.getState().telemetry?.settings; - applyAppearanceToRoot(capsuleHost, initialSettings, { includeFontScale: false }); - applyAppearanceToRoot(portalHost, initialSettings, { includeFontScale: true }); // 悬停全景概览浮层(完全解耦至 widgetRegistry,由 hoverModules 动态驱动 0..4 个独立组件,零硬编码) const hoverUpdateVerText = h('span', { text: t('capsule.hoverNewVerGeneric') }); @@ -1590,9 +1592,19 @@ export function mountWindowOverlay() { [appInstance.el] ); + function syncPortalAppearance(settings) { + applyAppearanceToRoot(capsuleHost, settings, { includeFontScale: false }); + applyAppearanceToRoot(portalHost, settings, { includeFontScale: true }); + const scaleKey = normalizeClientFontScale(settings?.fontScale); + popoverEl.setAttribute?.('data-font-scale', scaleKey); + hoverTipEl.setAttribute?.('data-font-scale', scaleKey); + multiPanelEl.setAttribute?.('data-font-scale', scaleKey); + } + portalShadow.appendChild(multiPanelEl); portalShadow.appendChild(hoverTipEl); portalShadow.appendChild(popoverEl); + syncPortalAppearance(initialSettings); (document.body || document.documentElement).appendChild(portalHost); // --- 3. 几何测量、IDE 主题桥接、顶栏停靠与防溢出定位 --- @@ -1931,8 +1943,17 @@ export function mountWindowOverlay() { const vh = Number(window.innerHeight || 800); const navRight = getLeftSidebarRightEdge(vw); const minLeft = navRight > 0 ? Math.max(12, navRight + 12) : 12; - const defaultCardW = Math.min(FLOATING_CARD_WIDTH, Math.max(280, vw - 24)); - const defaultMultiW = Math.min(MULTI_PANEL_WIDTH, Math.max(280, vw - 24)); + const curSettings = telemetryStore.getState().telemetry?.settings; + const panelScale = + PANEL_SCALE_FACTORS[normalizeClientFontScale(curSettings?.fontScale)] ?? 1; + const defaultCardW = Math.min( + Math.round(FLOATING_CARD_WIDTH * panelScale), + Math.max(280, vw - 24) + ); + const defaultMultiW = Math.min( + Math.round(MULTI_PANEL_WIDTH * panelScale), + Math.max(280, vw - 24) + ); const isDockComposer = capsuleHost.getAttribute('data-dock') === 'composer'; if (multiOpen) { @@ -1980,9 +2001,8 @@ export function mountWindowOverlay() { if (popoverOpen) { const maxPopCardW = Math.max(280, vw - minLeft - 12); - const curSettings = telemetryStore.getState().telemetry?.settings; const popWidthMode = normalizeClientPopoverWidthMode(curSettings?.popoverWidthMode); - let desiredPopW = Math.min(POPOVER_BASE_WIDTH, maxPopCardW); + let desiredPopW = Math.min(Math.round(POPOVER_BASE_WIDTH * panelScale), maxPopCardW); if (popWidthMode === 'custom') { desiredPopW = Math.min( normalizeClientPopoverWidth(curSettings?.popoverWidth), @@ -2630,8 +2650,7 @@ export function mountWindowOverlay() { const telemetry = telSt.telemetry; setI18nLanguage(telemetry?.settings?.language); - applyAppearanceToRoot(capsuleHost, telemetry?.settings, { includeFontScale: false }); - applyAppearanceToRoot(portalHost, telemetry?.settings, { includeFontScale: true }); + syncPortalAppearance(telemetry?.settings); const showMulti = telemetry?.settings?.showTopbarMultiSession !== false; patchAttr(multiBtn, 'hidden', !showMulti); diff --git a/sidecars/panel/src/core/appearance.js b/sidecars/panel/src/core/appearance.js index 06c4c76..2ff0a5e 100644 --- a/sidecars/panel/src/core/appearance.js +++ b/sidecars/panel/src/core/appearance.js @@ -17,8 +17,15 @@ export const THEME_ACCENT_PRESETS = Object.freeze([ export const FONT_SCALE_FACTORS = Object.freeze({ sm: 0.92, md: 1, - lg: 1.08, - xl: 1.15, + lg: 1.14, + xl: 1.28, +}); + +export const PANEL_SCALE_FACTORS = Object.freeze({ + sm: 1, + md: 1, + lg: 1.09, + xl: 1.18, }); export function normalizeClientThemeAccent(raw) { @@ -70,10 +77,13 @@ export function applyAppearanceToRoot(targetEl, settings, { includeFontScale = t if (includeFontScale) { const scaleKey = normalizeClientFontScale(settings?.fontScale); const factor = FONT_SCALE_FACTORS[scaleKey] ?? 1; + const panelFactor = PANEL_SCALE_FACTORS[scaleKey] ?? 1; setOrClearStyleVar(targetEl, '--ui-font-scale', factor === 1 ? '' : String(factor)); + setOrClearStyleVar(targetEl, '--ui-panel-scale', panelFactor === 1 ? '' : String(panelFactor)); targetEl.setAttribute?.('data-font-scale', scaleKey); } else { setOrClearStyleVar(targetEl, '--ui-font-scale', ''); + setOrClearStyleVar(targetEl, '--ui-panel-scale', ''); if (typeof targetEl.removeAttribute === 'function') { targetEl.removeAttribute('data-font-scale'); } diff --git a/sidecars/panel/src/main.js b/sidecars/panel/src/main.js index 63c924f..a4dede6 100644 --- a/sidecars/panel/src/main.js +++ b/sidecars/panel/src/main.js @@ -16,14 +16,17 @@ async function bootstrapApp(mountTarget = document.getElementById('app-root')) { const appInstance = App(); mountTarget.appendChild(appInstance.el); + const syncDocAppearance = (settings) => { + setI18nLanguage(settings?.language); + if (typeof document !== 'undefined' && document.documentElement) { + applyAppearanceToRoot(document.documentElement, settings, { includeFontScale: true }); + } + }; + syncDocAppearance(telemetryStore.getState().telemetry?.settings); + const unsubAppearance = telemetryStore.subscribe( (st) => st.telemetry?.settings, - (settings) => { - setI18nLanguage(settings?.language); - if (typeof document !== 'undefined' && document.documentElement) { - applyAppearanceToRoot(document.documentElement, settings, { includeFontScale: true }); - } - } + syncDocAppearance ); const stopPolling = startAsyncTelemetryLoop(2000); diff --git a/sidecars/panel/src/registries/stepColumnRegistry.js b/sidecars/panel/src/registries/stepColumnRegistry.js index b667e3e..9ef1762 100644 --- a/sidecars/panel/src/registries/stepColumnRegistry.js +++ b/sidecars/panel/src/registries/stepColumnRegistry.js @@ -224,7 +224,7 @@ export const STEP_COLUMN_REGISTRY = Object.freeze({ if (reason && !refs.speedReason) { refs.speedReason = h('div', { className: 'text-muted', - style: 'font-size: var(--fs-2xs);', + style: 'font-size: var(--fs-xs);', }); refs.wrapEl.appendChild(refs.speedReason); } diff --git a/sidecars/panel/src/styles/base.css b/sidecars/panel/src/styles/base.css index c6057d1..6a67606 100644 --- a/sidecars/panel/src/styles/base.css +++ b/sidecars/panel/src/styles/base.css @@ -37,7 +37,12 @@ body { } button, -input { +input, +select, +textarea, +table, +th, +td { font-family: inherit; font-size: inherit; font-stretch: inherit; diff --git a/sidecars/panel/src/styles/controls.css b/sidecars/panel/src/styles/controls.css index ce09e3a..c4ae4a8 100644 --- a/sidecars/panel/src/styles/controls.css +++ b/sidecars/panel/src/styles/controls.css @@ -149,14 +149,14 @@ align-items: center; justify-content: center; gap: 5px; - height: 26px; - padding: 0 var(--space-2); + min-height: calc(26px * var(--ui-font-scale, 1)); + padding: 2px var(--space-2); border: none; background: transparent; color: var(--text-secondary); font-size: var(--fs-base); font-weight: 500; - line-height: 1; + line-height: 1.15; border-radius: var(--radius-pill); cursor: pointer; white-space: nowrap; @@ -175,8 +175,8 @@ .pill-tab-badge { display: inline-flex; align-items: center; - height: 14px; - line-height: 1; + min-height: 14px; + line-height: 1.15; } .pill-tab-badge { @@ -223,8 +223,8 @@ justify-content: space-between; gap: var(--space-2); width: 100%; - height: 24px; - padding: 0 6px; + min-height: calc(24px * var(--ui-font-scale, 1)); + padding: 2px 6px; background: transparent; color: var(--text-primary); border: none; @@ -350,7 +350,7 @@ .number-input { display: inline-flex; align-items: stretch; - height: 28px; + min-height: calc(28px * var(--ui-font-scale, 1)); background: var(--surface-panel); border: 1px solid var(--border-hairline); border-radius: var(--radius-xs); @@ -410,8 +410,8 @@ justify-content: space-between; gap: var(--space-2); width: 100%; - height: 26px; - padding: 0 var(--space-2); + min-height: calc(26px * var(--ui-font-scale, 1)); + padding: 2px var(--space-2); background: var(--surface-panel); color: var(--text-primary); border: 1px solid var(--border-hairline); @@ -464,7 +464,7 @@ } .dt-day { - height: 22px; + min-height: calc(22px * var(--ui-font-scale, 1)); border: none; background: transparent; color: var(--text-primary); @@ -540,8 +540,8 @@ align-items: center; justify-content: center; gap: 4px; - height: 22px; - padding: 0 7px; + min-height: calc(22px * var(--ui-font-scale, 1)); + padding: 2px 7px; border: none; background: transparent; color: var(--text-secondary); @@ -650,8 +650,8 @@ align-items: center; justify-content: center; gap: 6px; - height: 28px; - padding: 0 var(--space-5); + min-height: calc(28px * var(--ui-font-scale, 1)); + padding: 3px var(--space-5); background: var(--accent-primary); color: var(--text-inverse); border: 1px solid var(--accent-primary); @@ -675,8 +675,8 @@ align-items: center; justify-content: center; gap: 6px; - height: 28px; - padding: 0 var(--space-4); + min-height: calc(28px * var(--ui-font-scale, 1)); + padding: 3px var(--space-4); background: var(--surface-panel); color: var(--text-primary); border: 1px solid var(--border-strong); @@ -714,8 +714,8 @@ display: inline-flex; align-items: center; gap: 4px; - height: 22px; - padding: 0 7px; + min-height: calc(22px * var(--ui-font-scale, 1)); + padding: 2px 7px; font-size: var(--fs-md); font-weight: 600; border-radius: var(--radius-xs); @@ -748,8 +748,8 @@ display: inline-flex; align-items: center; justify-content: center; - height: 20px; - padding: 0 6px; + min-height: calc(20px * var(--ui-font-scale, 1)); + padding: 1px 6px; font-size: var(--fs-md); font-weight: 500; color: var(--text-secondary); @@ -779,8 +779,9 @@ display: inline-flex; align-items: center; justify-content: center; - width: 16px; - height: 16px; + min-width: calc(16px * var(--ui-font-scale, 1)); + min-height: calc(16px * var(--ui-font-scale, 1)); + padding: 0 3px; font-size: var(--fs-sm); font-weight: 600; font-variant-numeric: tabular-nums; diff --git a/sidecars/panel/src/styles/overlay.css b/sidecars/panel/src/styles/overlay.css index 5b52ca9..b8a24c0 100644 --- a/sidecars/panel/src/styles/overlay.css +++ b/sidecars/panel/src/styles/overlay.css @@ -5,7 +5,7 @@ /* --- 1. 顶栏胶囊宿主容器 (Titlebar Capsule Host) --- */ :host(.wm-capsule-host) { - --ui-font-scale: 1; + --ui-font-scale: 1 !important; display: inline-flex; align-items: center; gap: 6px; @@ -581,7 +581,7 @@ position: fixed; top: 42px; left: 12px; - width: min(522px, calc(100vw - 24px)); + width: min(calc(522px * var(--ui-panel-scale, 1)), calc(100vw - 24px)); max-height: calc(100vh - 54px); padding: var(--space-3) var(--space-4); display: flex; @@ -605,7 +605,7 @@ position: fixed; top: 42px; left: 12px; - width: min(464px, calc(100vw - 24px)); + width: min(calc(464px * var(--ui-panel-scale, 1)), calc(100vw - 24px)); max-height: calc(100vh - 54px); padding: 14px 16px; display: flex; @@ -711,8 +711,8 @@ .wm-pin-badge { display: inline-flex; align-items: center; - height: 16px; - padding: 0 5px; + min-height: calc(16px * var(--ui-font-scale, 1)); + padding: 1px 5px; font-size: var(--fs-xs); font-weight: 600; color: var(--accent-primary); @@ -724,8 +724,8 @@ .wm-session-tag { display: inline-flex; align-items: center; - height: 16px; - padding: 0 4px; + min-height: calc(16px * var(--ui-font-scale, 1)); + padding: 1px 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-secondary); diff --git a/sidecars/panel/src/styles/tokens.css b/sidecars/panel/src/styles/tokens.css index c8ab516..b328e68 100644 --- a/sidecars/panel/src/styles/tokens.css +++ b/sidecars/panel/src/styles/tokens.css @@ -43,16 +43,15 @@ --border-strong: color-mix(in srgb, var(--border-hairline) 72%, var(--text-primary) 28%); /* Typography Hierarchy & Scalable Font Tokens */ - --ui-font-scale: 1; - --fs-2xs: calc(9.5px * var(--ui-font-scale, 1)); - --fs-xs: calc(10px * var(--ui-font-scale, 1)); - --fs-sm: calc(10.5px * var(--ui-font-scale, 1)); - --fs-md: calc(11px * var(--ui-font-scale, 1)); - --fs-base-sm: calc(11.5px * var(--ui-font-scale, 1)); - --fs-base: calc(12px * var(--ui-font-scale, 1)); - --fs-body: calc(12.5px * var(--ui-font-scale, 1)); - --fs-lg: calc(14.5px * var(--ui-font-scale, 1)); - --fs-hero: calc(17px * var(--ui-font-scale, 1)); + --fs-2xs: calc(10.5px * var(--ui-font-scale, 1)); + --fs-xs: calc(11px * var(--ui-font-scale, 1)); + --fs-sm: calc(11.5px * var(--ui-font-scale, 1)); + --fs-md: calc(12px * var(--ui-font-scale, 1)); + --fs-base-sm: calc(12.5px * var(--ui-font-scale, 1)); + --fs-base: calc(13px * var(--ui-font-scale, 1)); + --fs-body: calc(13px * var(--ui-font-scale, 1)); + --fs-lg: calc(15px * var(--ui-font-scale, 1)); + --fs-hero: calc(18px * var(--ui-font-scale, 1)); --text-primary: var(--foreground, var(--vscode-foreground, var(--vscode-editor-foreground, hsl(215 22% 15%)))); --text-secondary: var(--muted-foreground, var(--vscode-descriptionForeground, hsl(215 12% 44%))); @@ -120,6 +119,46 @@ --space-5: 12px; } +:root[data-font-scale="sm"], +:host([data-font-scale="sm"]), +[data-font-scale="sm"] { + --ui-font-scale: 0.92; + --ui-panel-scale: 1; +} + +:root[data-font-scale="md"], +:host([data-font-scale="md"]), +[data-font-scale="md"] { + --ui-font-scale: 1; + --ui-panel-scale: 1; +} + +:root[data-font-scale="lg"], +:host([data-font-scale="lg"]), +[data-font-scale="lg"] { + --ui-font-scale: 1.14; + --ui-panel-scale: 1.09; +} + +:root[data-font-scale="xl"], +:host([data-font-scale="xl"]), +[data-font-scale="xl"] { + --ui-font-scale: 1.28; + --ui-panel-scale: 1.18; +} + +[data-font-scale] { + --fs-2xs: calc(10.5px * var(--ui-font-scale, 1)); + --fs-xs: calc(11px * var(--ui-font-scale, 1)); + --fs-sm: calc(11.5px * var(--ui-font-scale, 1)); + --fs-md: calc(12px * var(--ui-font-scale, 1)); + --fs-base-sm: calc(12.5px * var(--ui-font-scale, 1)); + --fs-base: calc(13px * var(--ui-font-scale, 1)); + --fs-body: calc(13px * var(--ui-font-scale, 1)); + --fs-lg: calc(15px * var(--ui-font-scale, 1)); + --fs-hero: calc(18px * var(--ui-font-scale, 1)); +} + @media (prefers-color-scheme: dark) { html[data-standalone="true"] { color-scheme: dark; diff --git a/sidecars/panel/src/styles/views-consumption.css b/sidecars/panel/src/styles/views-consumption.css index cb5b3b2..7cc1cab 100644 --- a/sidecars/panel/src/styles/views-consumption.css +++ b/sidecars/panel/src/styles/views-consumption.css @@ -166,8 +166,8 @@ .cons-row-title { display: inline-flex; align-items: center; - height: 20px; - line-height: 20px; + min-height: calc(20px * var(--ui-font-scale, 1)); + line-height: 1.3; font-size: var(--fs-base); font-weight: 600; color: var(--text-primary); @@ -177,16 +177,16 @@ display: inline-flex; align-items: center; gap: 8px; - height: 20px; + min-height: calc(20px * var(--ui-font-scale, 1)); } .cons-share-pill { display: inline-flex; align-items: center; justify-content: center; - height: 20px; - line-height: 1; - padding: 0 6px; + min-height: calc(20px * var(--ui-font-scale, 1)); + line-height: 1.2; + padding: 1px 6px; font-size: var(--fs-base); font-weight: 600; color: var(--metric-ok); @@ -199,8 +199,8 @@ .cons-row-tok { display: inline-flex; align-items: center; - height: 20px; - line-height: 1; + min-height: calc(20px * var(--ui-font-scale, 1)); + line-height: 1.25; font-size: var(--fs-base); font-weight: 500; color: var(--text-secondary); @@ -209,8 +209,8 @@ .cons-row-cost { display: inline-flex; align-items: center; - height: 20px; - line-height: 1; + min-height: calc(20px * var(--ui-font-scale, 1)); + line-height: 1.25; font-size: var(--fs-base); font-weight: 700; color: var(--text-primary); @@ -287,7 +287,7 @@ top: 2px; left: var(--peak-x, 50%); transform: translateX(-50%); - font-size: 10px; + font-size: var(--fs-xs); font-weight: 600; padding: 1px 6px; color: var(--text-primary); @@ -306,7 +306,7 @@ transform: translateX(var(--tip-shift, -50%)); width: max-content; min-width: 152px; - max-width: min(300px, calc(100% - 8px)); + max-width: min(320px, calc(100% - 8px)); padding: 5px 9px; background: var(--surface-panel); border: 1px solid var(--border-strong); @@ -324,7 +324,7 @@ align-items: center; justify-content: space-between; gap: 10px; - font-size: 10.5px; + font-size: var(--fs-sm); color: var(--text-secondary); } @@ -336,7 +336,7 @@ } .trend-tip-calls { - font-size: 10px; + font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; max-width: 190px; @@ -352,7 +352,7 @@ } .trend-tip-tokens { - font-size: 12px; + font-size: var(--fs-base); font-weight: 700; color: var(--accent-primary); white-space: nowrap; @@ -360,7 +360,7 @@ } .trend-tip-cost { - font-size: 11px; + font-size: var(--fs-md); font-weight: 600; color: var(--text-primary); white-space: nowrap; @@ -368,7 +368,7 @@ } .trend-tip-sub { - font-size: 10px; + font-size: var(--fs-xs); color: var(--text-secondary); white-space: nowrap; overflow: hidden; @@ -391,7 +391,7 @@ .trend-x-axis { position: relative; width: 100%; - height: 18px; + min-height: calc(18px * var(--ui-font-scale, 1)); user-select: none; } @@ -400,10 +400,10 @@ top: 0; left: var(--tick-x, 0%); transform: translateX(-50%); - font-size: 10px; + font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; - line-height: 16px; + line-height: 1.35; cursor: pointer; transition: color var(--dur-instant) var(--ease-fast); } @@ -455,21 +455,21 @@ .trend-hm-weekdays { display: grid; - grid-template-rows: 15px repeat(7, var(--hm-cell)); + grid-template-rows: calc(15px * var(--ui-font-scale, 1)) repeat(7, var(--hm-cell)); row-gap: var(--hm-gap); - width: 14px; + width: calc(15px * var(--ui-font-scale, 1)); flex-shrink: 0; } .trend-hm-month-spacer { - height: 15px; + height: calc(15px * var(--ui-font-scale, 1)); } .trend-hm-wday { display: flex; align-items: center; justify-content: flex-start; - font-size: 9px; + font-size: var(--fs-2xs); line-height: 1; color: var(--text-muted); } @@ -490,7 +490,7 @@ .trend-hm-months { position: relative; - height: 15px; + height: calc(15px * var(--ui-font-scale, 1)); width: 100%; } @@ -498,8 +498,8 @@ position: absolute; top: 0; left: calc(var(--hm-col, 0) * (var(--hm-cell) + var(--hm-gap))); - font-size: 9.5px; - line-height: 14px; + font-size: var(--fs-2xs); + line-height: 1.25; color: var(--text-muted); white-space: nowrap; pointer-events: none; @@ -564,7 +564,7 @@ align-items: center; justify-content: space-between; gap: 8px; - font-size: 10px; + font-size: var(--fs-xs); color: var(--text-muted); min-height: 16px; } @@ -581,7 +581,7 @@ align-items: center; gap: 3px; flex-shrink: 0; - font-size: 9.5px; + font-size: var(--fs-2xs); color: var(--text-muted); } @@ -642,7 +642,7 @@ } .month-cost { - font-size: 9.5px; + font-size: var(--fs-2xs); color: var(--text-secondary); min-height: 14px; white-space: nowrap; @@ -686,7 +686,7 @@ } .month-label { - font-size: 10px; + font-size: var(--fs-xs); color: var(--text-secondary); padding: 1px 3px; border-radius: var(--radius-xs); @@ -700,7 +700,7 @@ } .month-tok { - font-size: 9px; + font-size: var(--fs-2xs); color: var(--text-muted); min-height: 12px; white-space: nowrap; diff --git a/sidecars/panel/src/styles/views-overview.css b/sidecars/panel/src/styles/views-overview.css index ac4d82e..a720501 100644 --- a/sidecars/panel/src/styles/views-overview.css +++ b/sidecars/panel/src/styles/views-overview.css @@ -156,8 +156,8 @@ display: inline-flex; align-items: center; gap: 3px; - height: 18px; - padding: 0 6px; + min-height: calc(18px * var(--ui-font-scale, 1)); + padding: 1px 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary); @@ -547,8 +547,8 @@ display: inline-flex; align-items: center; gap: 4px; - height: 20px; - padding: 0 6px; + min-height: calc(20px * var(--ui-font-scale, 1)); + padding: 1px 6px; border: 1px solid var(--border-hairline); background: var(--surface-panel); color: var(--text-secondary); diff --git a/sidecars/panel/src/styles/views-settings.css b/sidecars/panel/src/styles/views-settings.css index 636b229..44d082a 100644 --- a/sidecars/panel/src/styles/views-settings.css +++ b/sidecars/panel/src/styles/views-settings.css @@ -37,7 +37,7 @@ } .settings-subnav-bar .seg-btn { - height: 24px; + min-height: calc(24px * var(--ui-font-scale, 1)); font-size: var(--fs-base-sm); font-weight: 500; } @@ -55,9 +55,9 @@ align-items: center; justify-content: center; gap: 4px; - height: 25px; + min-height: calc(25px * var(--ui-font-scale, 1)); min-width: 0; - padding: 0 6px; + padding: 2px 6px; border: 1px solid var(--border-hairline); border-radius: var(--radius-xs); background: var(--surface-subtle); @@ -116,8 +116,8 @@ display: inline-flex; align-items: center; gap: 5px; - height: 24px; - padding: 0 9px; + min-height: calc(24px * var(--ui-font-scale, 1)); + padding: 2px 9px; font-size: var(--fs-md); font-weight: 500; color: var(--text-secondary); @@ -240,7 +240,7 @@ } .structure-preview-canvas.is-scaled { - zoom: 0.86; + zoom: 0.9; } .wm-hover-tip.is-preview { @@ -286,6 +286,7 @@ } .preview-capsule-bar { + --ui-font-scale: 1; display: flex; align-items: center; justify-content: space-between; @@ -431,8 +432,8 @@ .collapsible-badge { display: inline-flex; align-items: center; - height: 18px; - padding: 0 6px; + min-height: calc(18px * var(--ui-font-scale, 1)); + padding: 1px 6px; font-size: var(--fs-sm); font-weight: 500; color: var(--text-secondary); @@ -577,8 +578,8 @@ align-items: center; justify-content: center; gap: 5px; - height: 24px; - padding: 0 9px; + min-height: calc(24px * var(--ui-font-scale, 1)); + padding: 2px 9px; font-size: var(--fs-md); font-weight: 500; color: var(--accent-primary); @@ -711,8 +712,8 @@ .settings-text-input { width: 100%; min-width: 0; - height: 28px; - padding: 0 8px; + min-height: calc(28px * var(--ui-font-scale, 1)); + padding: 2px 8px; background: var(--surface-subtle); border: 1px solid var(--border-hairline); border-radius: var(--radius-xs); @@ -738,7 +739,7 @@ } .settings-number-wrap .number-input { - height: 24px; + min-height: calc(24px * var(--ui-font-scale, 1)); background: var(--surface-subtle); } @@ -831,7 +832,7 @@ .ctx-risk-accept-btn { margin-top: 2px; - height: 26px; - padding: 0 var(--space-3); + min-height: calc(26px * var(--ui-font-scale, 1)); + padding: 2px var(--space-3); font-size: var(--fs-md); } diff --git a/sidecars/panel/src/styles/views-tables.css b/sidecars/panel/src/styles/views-tables.css index 39050ca..0f8f3fa 100644 --- a/sidecars/panel/src/styles/views-tables.css +++ b/sidecars/panel/src/styles/views-tables.css @@ -35,13 +35,14 @@ .data-table { width: 100%; border-collapse: collapse; - font-size: var(--fs-md); + font-size: var(--fs-base-sm); } .data-table th, .data-table td { - padding: 5px 4px; + padding: calc(5px * var(--ui-font-scale, 1)) calc(4px * var(--ui-font-scale, 1)); text-align: left; + font-size: var(--fs-base-sm); border-bottom: 1px solid var(--border-hairline); white-space: nowrap; } @@ -78,7 +79,7 @@ .step-model-cell { display: inline-flex; align-items: baseline; - max-width: var(--step-model-max-w, 176px); + max-width: calc(var(--step-model-max-w, 176px) * var(--ui-font-scale, 1)); min-width: 0; vertical-align: bottom; } @@ -133,8 +134,9 @@ .steps-inline-scope-select .select-trigger, .steps-inline-model-select .select-trigger { - height: 22px; - padding: 0 6px; + min-height: calc(22px * var(--ui-font-scale, 1)); + height: auto; + padding: 2px 6px; gap: 4px; min-width: 0; overflow: hidden; @@ -320,8 +322,9 @@ } .sstep-fit-model-select .select-trigger { - height: 22px; - padding: 0 6px; + min-height: calc(22px * var(--ui-font-scale, 1)); + height: auto; + padding: 2px 6px; gap: 4px; min-width: 0; overflow: hidden; @@ -377,7 +380,7 @@ .sstep-axis-label { fill: var(--text-muted); font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); - font-size: 9.5px; + font-size: var(--fs-2xs); user-select: none; pointer-events: none; } @@ -485,7 +488,7 @@ display: flex; align-items: center; justify-content: center; - font-size: 11px; + font-size: var(--fs-md); pointer-events: none; z-index: 2; } @@ -496,7 +499,7 @@ flex-wrap: wrap; gap: 4px 10px; padding-top: 2px; - font-size: 10px; + font-size: var(--fs-xs); color: var(--text-secondary); } @@ -535,7 +538,7 @@ flex-wrap: wrap; gap: 4px 8px; padding-top: 2px; - font-size: 10px; + font-size: var(--fs-xs); color: var(--text-muted); } @@ -595,7 +598,7 @@ } .sstep-fit-delta { - font-size: 10px; + font-size: var(--fs-xs); } /* --- 4. 极简高密度模型总览列表 (Minimalist Session Model Summary Cards) --- */ diff --git a/sidecars/panel/styles.css b/sidecars/panel/styles.css index 881d7c7..19dffbf 100644 --- a/sidecars/panel/styles.css +++ b/sidecars/panel/styles.css @@ -44,16 +44,15 @@ --border-strong: color-mix(in srgb, var(--border-hairline) 72%, var(--text-primary) 28%); /* Typography Hierarchy & Scalable Font Tokens */ - --ui-font-scale: 1; - --fs-2xs: calc(9.5px * var(--ui-font-scale, 1)); - --fs-xs: calc(10px * var(--ui-font-scale, 1)); - --fs-sm: calc(10.5px * var(--ui-font-scale, 1)); - --fs-md: calc(11px * var(--ui-font-scale, 1)); - --fs-base-sm: calc(11.5px * var(--ui-font-scale, 1)); - --fs-base: calc(12px * var(--ui-font-scale, 1)); - --fs-body: calc(12.5px * var(--ui-font-scale, 1)); - --fs-lg: calc(14.5px * var(--ui-font-scale, 1)); - --fs-hero: calc(17px * var(--ui-font-scale, 1)); + --fs-2xs: calc(10.5px * var(--ui-font-scale, 1)); + --fs-xs: calc(11px * var(--ui-font-scale, 1)); + --fs-sm: calc(11.5px * var(--ui-font-scale, 1)); + --fs-md: calc(12px * var(--ui-font-scale, 1)); + --fs-base-sm: calc(12.5px * var(--ui-font-scale, 1)); + --fs-base: calc(13px * var(--ui-font-scale, 1)); + --fs-body: calc(13px * var(--ui-font-scale, 1)); + --fs-lg: calc(15px * var(--ui-font-scale, 1)); + --fs-hero: calc(18px * var(--ui-font-scale, 1)); --text-primary: var(--foreground, var(--vscode-foreground, var(--vscode-editor-foreground, hsl(215 22% 15%)))); --text-secondary: var(--muted-foreground, var(--vscode-descriptionForeground, hsl(215 12% 44%))); @@ -121,6 +120,46 @@ --space-5: 12px; } +:root[data-font-scale="sm"], +:host([data-font-scale="sm"]), +[data-font-scale="sm"] { + --ui-font-scale: 0.92; + --ui-panel-scale: 1; +} + +:root[data-font-scale="md"], +:host([data-font-scale="md"]), +[data-font-scale="md"] { + --ui-font-scale: 1; + --ui-panel-scale: 1; +} + +:root[data-font-scale="lg"], +:host([data-font-scale="lg"]), +[data-font-scale="lg"] { + --ui-font-scale: 1.14; + --ui-panel-scale: 1.09; +} + +:root[data-font-scale="xl"], +:host([data-font-scale="xl"]), +[data-font-scale="xl"] { + --ui-font-scale: 1.28; + --ui-panel-scale: 1.18; +} + +[data-font-scale] { + --fs-2xs: calc(10.5px * var(--ui-font-scale, 1)); + --fs-xs: calc(11px * var(--ui-font-scale, 1)); + --fs-sm: calc(11.5px * var(--ui-font-scale, 1)); + --fs-md: calc(12px * var(--ui-font-scale, 1)); + --fs-base-sm: calc(12.5px * var(--ui-font-scale, 1)); + --fs-base: calc(13px * var(--ui-font-scale, 1)); + --fs-body: calc(13px * var(--ui-font-scale, 1)); + --fs-lg: calc(15px * var(--ui-font-scale, 1)); + --fs-hero: calc(18px * var(--ui-font-scale, 1)); +} + @media (prefers-color-scheme: dark) { html[data-standalone="true"] { color-scheme: dark; @@ -173,7 +212,12 @@ body { } button, -input { +input, +select, +textarea, +table, +th, +td { font-family: inherit; font-size: inherit; font-stretch: inherit; @@ -471,14 +515,14 @@ html[data-standalone="true"] .app-shell { align-items: center; justify-content: center; gap: 5px; - height: 26px; - padding: 0 var(--space-2); + min-height: calc(26px * var(--ui-font-scale, 1)); + padding: 2px var(--space-2); border: none; background: transparent; color: var(--text-secondary); font-size: var(--fs-base); font-weight: 500; - line-height: 1; + line-height: 1.15; border-radius: var(--radius-pill); cursor: pointer; white-space: nowrap; @@ -497,8 +541,8 @@ html[data-standalone="true"] .app-shell { .pill-tab-badge { display: inline-flex; align-items: center; - height: 14px; - line-height: 1; + min-height: 14px; + line-height: 1.15; } .pill-tab-badge { @@ -545,8 +589,8 @@ html[data-standalone="true"] .app-shell { justify-content: space-between; gap: var(--space-2); width: 100%; - height: 24px; - padding: 0 6px; + min-height: calc(24px * var(--ui-font-scale, 1)); + padding: 2px 6px; background: transparent; color: var(--text-primary); border: none; @@ -672,7 +716,7 @@ html[data-standalone="true"] .app-shell { .number-input { display: inline-flex; align-items: stretch; - height: 28px; + min-height: calc(28px * var(--ui-font-scale, 1)); background: var(--surface-panel); border: 1px solid var(--border-hairline); border-radius: var(--radius-xs); @@ -732,8 +776,8 @@ html[data-standalone="true"] .app-shell { justify-content: space-between; gap: var(--space-2); width: 100%; - height: 26px; - padding: 0 var(--space-2); + min-height: calc(26px * var(--ui-font-scale, 1)); + padding: 2px var(--space-2); background: var(--surface-panel); color: var(--text-primary); border: 1px solid var(--border-hairline); @@ -786,7 +830,7 @@ html[data-standalone="true"] .app-shell { } .dt-day { - height: 22px; + min-height: calc(22px * var(--ui-font-scale, 1)); border: none; background: transparent; color: var(--text-primary); @@ -862,8 +906,8 @@ html[data-standalone="true"] .app-shell { align-items: center; justify-content: center; gap: 4px; - height: 22px; - padding: 0 7px; + min-height: calc(22px * var(--ui-font-scale, 1)); + padding: 2px 7px; border: none; background: transparent; color: var(--text-secondary); @@ -972,8 +1016,8 @@ html[data-standalone="true"] .app-shell { align-items: center; justify-content: center; gap: 6px; - height: 28px; - padding: 0 var(--space-5); + min-height: calc(28px * var(--ui-font-scale, 1)); + padding: 3px var(--space-5); background: var(--accent-primary); color: var(--text-inverse); border: 1px solid var(--accent-primary); @@ -997,8 +1041,8 @@ html[data-standalone="true"] .app-shell { align-items: center; justify-content: center; gap: 6px; - height: 28px; - padding: 0 var(--space-4); + min-height: calc(28px * var(--ui-font-scale, 1)); + padding: 3px var(--space-4); background: var(--surface-panel); color: var(--text-primary); border: 1px solid var(--border-strong); @@ -1036,8 +1080,8 @@ html[data-standalone="true"] .app-shell { display: inline-flex; align-items: center; gap: 4px; - height: 22px; - padding: 0 7px; + min-height: calc(22px * var(--ui-font-scale, 1)); + padding: 2px 7px; font-size: var(--fs-md); font-weight: 600; border-radius: var(--radius-xs); @@ -1070,8 +1114,8 @@ html[data-standalone="true"] .app-shell { display: inline-flex; align-items: center; justify-content: center; - height: 20px; - padding: 0 6px; + min-height: calc(20px * var(--ui-font-scale, 1)); + padding: 1px 6px; font-size: var(--fs-md); font-weight: 500; color: var(--text-secondary); @@ -1101,8 +1145,9 @@ html[data-standalone="true"] .app-shell { display: inline-flex; align-items: center; justify-content: center; - width: 16px; - height: 16px; + min-width: calc(16px * var(--ui-font-scale, 1)); + min-height: calc(16px * var(--ui-font-scale, 1)); + padding: 0 3px; font-size: var(--fs-sm); font-weight: 600; font-variant-numeric: tabular-nums; @@ -1309,8 +1354,8 @@ html[data-standalone="true"] .app-shell { display: inline-flex; align-items: center; gap: 3px; - height: 18px; - padding: 0 6px; + min-height: calc(18px * var(--ui-font-scale, 1)); + padding: 1px 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary); @@ -1700,8 +1745,8 @@ html[data-standalone="true"] .app-shell { display: inline-flex; align-items: center; gap: 4px; - height: 20px; - padding: 0 6px; + min-height: calc(20px * var(--ui-font-scale, 1)); + padding: 1px 6px; border: 1px solid var(--border-hairline); background: var(--surface-panel); color: var(--text-secondary); @@ -1971,8 +2016,8 @@ html[data-standalone="true"] .app-shell { .cons-row-title { display: inline-flex; align-items: center; - height: 20px; - line-height: 20px; + min-height: calc(20px * var(--ui-font-scale, 1)); + line-height: 1.3; font-size: var(--fs-base); font-weight: 600; color: var(--text-primary); @@ -1982,16 +2027,16 @@ html[data-standalone="true"] .app-shell { display: inline-flex; align-items: center; gap: 8px; - height: 20px; + min-height: calc(20px * var(--ui-font-scale, 1)); } .cons-share-pill { display: inline-flex; align-items: center; justify-content: center; - height: 20px; - line-height: 1; - padding: 0 6px; + min-height: calc(20px * var(--ui-font-scale, 1)); + line-height: 1.2; + padding: 1px 6px; font-size: var(--fs-base); font-weight: 600; color: var(--metric-ok); @@ -2004,8 +2049,8 @@ html[data-standalone="true"] .app-shell { .cons-row-tok { display: inline-flex; align-items: center; - height: 20px; - line-height: 1; + min-height: calc(20px * var(--ui-font-scale, 1)); + line-height: 1.25; font-size: var(--fs-base); font-weight: 500; color: var(--text-secondary); @@ -2014,8 +2059,8 @@ html[data-standalone="true"] .app-shell { .cons-row-cost { display: inline-flex; align-items: center; - height: 20px; - line-height: 1; + min-height: calc(20px * var(--ui-font-scale, 1)); + line-height: 1.25; font-size: var(--fs-base); font-weight: 700; color: var(--text-primary); @@ -2092,7 +2137,7 @@ html[data-standalone="true"] .app-shell { top: 2px; left: var(--peak-x, 50%); transform: translateX(-50%); - font-size: 10px; + font-size: var(--fs-xs); font-weight: 600; padding: 1px 6px; color: var(--text-primary); @@ -2111,7 +2156,7 @@ html[data-standalone="true"] .app-shell { transform: translateX(var(--tip-shift, -50%)); width: max-content; min-width: 152px; - max-width: min(300px, calc(100% - 8px)); + max-width: min(320px, calc(100% - 8px)); padding: 5px 9px; background: var(--surface-panel); border: 1px solid var(--border-strong); @@ -2129,7 +2174,7 @@ html[data-standalone="true"] .app-shell { align-items: center; justify-content: space-between; gap: 10px; - font-size: 10.5px; + font-size: var(--fs-sm); color: var(--text-secondary); } @@ -2141,7 +2186,7 @@ html[data-standalone="true"] .app-shell { } .trend-tip-calls { - font-size: 10px; + font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; max-width: 190px; @@ -2157,7 +2202,7 @@ html[data-standalone="true"] .app-shell { } .trend-tip-tokens { - font-size: 12px; + font-size: var(--fs-base); font-weight: 700; color: var(--accent-primary); white-space: nowrap; @@ -2165,7 +2210,7 @@ html[data-standalone="true"] .app-shell { } .trend-tip-cost { - font-size: 11px; + font-size: var(--fs-md); font-weight: 600; color: var(--text-primary); white-space: nowrap; @@ -2173,7 +2218,7 @@ html[data-standalone="true"] .app-shell { } .trend-tip-sub { - font-size: 10px; + font-size: var(--fs-xs); color: var(--text-secondary); white-space: nowrap; overflow: hidden; @@ -2196,7 +2241,7 @@ html[data-standalone="true"] .app-shell { .trend-x-axis { position: relative; width: 100%; - height: 18px; + min-height: calc(18px * var(--ui-font-scale, 1)); user-select: none; } @@ -2205,10 +2250,10 @@ html[data-standalone="true"] .app-shell { top: 0; left: var(--tick-x, 0%); transform: translateX(-50%); - font-size: 10px; + font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; - line-height: 16px; + line-height: 1.35; cursor: pointer; transition: color var(--dur-instant) var(--ease-fast); } @@ -2260,21 +2305,21 @@ html[data-standalone="true"] .app-shell { .trend-hm-weekdays { display: grid; - grid-template-rows: 15px repeat(7, var(--hm-cell)); + grid-template-rows: calc(15px * var(--ui-font-scale, 1)) repeat(7, var(--hm-cell)); row-gap: var(--hm-gap); - width: 14px; + width: calc(15px * var(--ui-font-scale, 1)); flex-shrink: 0; } .trend-hm-month-spacer { - height: 15px; + height: calc(15px * var(--ui-font-scale, 1)); } .trend-hm-wday { display: flex; align-items: center; justify-content: flex-start; - font-size: 9px; + font-size: var(--fs-2xs); line-height: 1; color: var(--text-muted); } @@ -2295,7 +2340,7 @@ html[data-standalone="true"] .app-shell { .trend-hm-months { position: relative; - height: 15px; + height: calc(15px * var(--ui-font-scale, 1)); width: 100%; } @@ -2303,8 +2348,8 @@ html[data-standalone="true"] .app-shell { position: absolute; top: 0; left: calc(var(--hm-col, 0) * (var(--hm-cell) + var(--hm-gap))); - font-size: 9.5px; - line-height: 14px; + font-size: var(--fs-2xs); + line-height: 1.25; color: var(--text-muted); white-space: nowrap; pointer-events: none; @@ -2369,7 +2414,7 @@ html[data-standalone="true"] .app-shell { align-items: center; justify-content: space-between; gap: 8px; - font-size: 10px; + font-size: var(--fs-xs); color: var(--text-muted); min-height: 16px; } @@ -2386,7 +2431,7 @@ html[data-standalone="true"] .app-shell { align-items: center; gap: 3px; flex-shrink: 0; - font-size: 9.5px; + font-size: var(--fs-2xs); color: var(--text-muted); } @@ -2447,7 +2492,7 @@ html[data-standalone="true"] .app-shell { } .month-cost { - font-size: 9.5px; + font-size: var(--fs-2xs); color: var(--text-secondary); min-height: 14px; white-space: nowrap; @@ -2491,7 +2536,7 @@ html[data-standalone="true"] .app-shell { } .month-label { - font-size: 10px; + font-size: var(--fs-xs); color: var(--text-secondary); padding: 1px 3px; border-radius: var(--radius-xs); @@ -2505,7 +2550,7 @@ html[data-standalone="true"] .app-shell { } .month-tok { - font-size: 9px; + font-size: var(--fs-2xs); color: var(--text-muted); min-height: 12px; white-space: nowrap; @@ -2559,13 +2604,14 @@ html[data-standalone="true"] .app-shell { .data-table { width: 100%; border-collapse: collapse; - font-size: var(--fs-md); + font-size: var(--fs-base-sm); } .data-table th, .data-table td { - padding: 5px 4px; + padding: calc(5px * var(--ui-font-scale, 1)) calc(4px * var(--ui-font-scale, 1)); text-align: left; + font-size: var(--fs-base-sm); border-bottom: 1px solid var(--border-hairline); white-space: nowrap; } @@ -2602,7 +2648,7 @@ html[data-standalone="true"] .app-shell { .step-model-cell { display: inline-flex; align-items: baseline; - max-width: var(--step-model-max-w, 176px); + max-width: calc(var(--step-model-max-w, 176px) * var(--ui-font-scale, 1)); min-width: 0; vertical-align: bottom; } @@ -2657,8 +2703,9 @@ html[data-standalone="true"] .app-shell { .steps-inline-scope-select .select-trigger, .steps-inline-model-select .select-trigger { - height: 22px; - padding: 0 6px; + min-height: calc(22px * var(--ui-font-scale, 1)); + height: auto; + padding: 2px 6px; gap: 4px; min-width: 0; overflow: hidden; @@ -2844,8 +2891,9 @@ html[data-standalone="true"] .app-shell { } .sstep-fit-model-select .select-trigger { - height: 22px; - padding: 0 6px; + min-height: calc(22px * var(--ui-font-scale, 1)); + height: auto; + padding: 2px 6px; gap: 4px; min-width: 0; overflow: hidden; @@ -2901,7 +2949,7 @@ html[data-standalone="true"] .app-shell { .sstep-axis-label { fill: var(--text-muted); font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); - font-size: 9.5px; + font-size: var(--fs-2xs); user-select: none; pointer-events: none; } @@ -3009,7 +3057,7 @@ html[data-standalone="true"] .app-shell { display: flex; align-items: center; justify-content: center; - font-size: 11px; + font-size: var(--fs-md); pointer-events: none; z-index: 2; } @@ -3020,7 +3068,7 @@ html[data-standalone="true"] .app-shell { flex-wrap: wrap; gap: 4px 10px; padding-top: 2px; - font-size: 10px; + font-size: var(--fs-xs); color: var(--text-secondary); } @@ -3059,7 +3107,7 @@ html[data-standalone="true"] .app-shell { flex-wrap: wrap; gap: 4px 8px; padding-top: 2px; - font-size: 10px; + font-size: var(--fs-xs); color: var(--text-muted); } @@ -3119,7 +3167,7 @@ html[data-standalone="true"] .app-shell { } .sstep-fit-delta { - font-size: 10px; + font-size: var(--fs-xs); } /* --- 4. 极简高密度模型总览列表 (Minimalist Session Model Summary Cards) --- */ @@ -3292,7 +3340,7 @@ html[data-standalone="true"] .app-shell { } .settings-subnav-bar .seg-btn { - height: 24px; + min-height: calc(24px * var(--ui-font-scale, 1)); font-size: var(--fs-base-sm); font-weight: 500; } @@ -3310,9 +3358,9 @@ html[data-standalone="true"] .app-shell { align-items: center; justify-content: center; gap: 4px; - height: 25px; + min-height: calc(25px * var(--ui-font-scale, 1)); min-width: 0; - padding: 0 6px; + padding: 2px 6px; border: 1px solid var(--border-hairline); border-radius: var(--radius-xs); background: var(--surface-subtle); @@ -3371,8 +3419,8 @@ html[data-standalone="true"] .app-shell { display: inline-flex; align-items: center; gap: 5px; - height: 24px; - padding: 0 9px; + min-height: calc(24px * var(--ui-font-scale, 1)); + padding: 2px 9px; font-size: var(--fs-md); font-weight: 500; color: var(--text-secondary); @@ -3495,7 +3543,7 @@ html[data-standalone="true"] .app-shell { } .structure-preview-canvas.is-scaled { - zoom: 0.86; + zoom: 0.9; } .wm-hover-tip.is-preview { @@ -3541,6 +3589,7 @@ html[data-standalone="true"] .app-shell { } .preview-capsule-bar { + --ui-font-scale: 1; display: flex; align-items: center; justify-content: space-between; @@ -3686,8 +3735,8 @@ html[data-standalone="true"] .app-shell { .collapsible-badge { display: inline-flex; align-items: center; - height: 18px; - padding: 0 6px; + min-height: calc(18px * var(--ui-font-scale, 1)); + padding: 1px 6px; font-size: var(--fs-sm); font-weight: 500; color: var(--text-secondary); @@ -3832,8 +3881,8 @@ html[data-standalone="true"] .app-shell { align-items: center; justify-content: center; gap: 5px; - height: 24px; - padding: 0 9px; + min-height: calc(24px * var(--ui-font-scale, 1)); + padding: 2px 9px; font-size: var(--fs-md); font-weight: 500; color: var(--accent-primary); @@ -3966,8 +4015,8 @@ html[data-standalone="true"] .app-shell { .settings-text-input { width: 100%; min-width: 0; - height: 28px; - padding: 0 8px; + min-height: calc(28px * var(--ui-font-scale, 1)); + padding: 2px 8px; background: var(--surface-subtle); border: 1px solid var(--border-hairline); border-radius: var(--radius-xs); @@ -3993,7 +4042,7 @@ html[data-standalone="true"] .app-shell { } .settings-number-wrap .number-input { - height: 24px; + min-height: calc(24px * var(--ui-font-scale, 1)); background: var(--surface-subtle); } @@ -4086,8 +4135,8 @@ html[data-standalone="true"] .app-shell { .ctx-risk-accept-btn { margin-top: 2px; - height: 26px; - padding: 0 var(--space-3); + min-height: calc(26px * var(--ui-font-scale, 1)); + padding: 2px var(--space-3); font-size: var(--fs-md); } @@ -4099,7 +4148,7 @@ html[data-standalone="true"] .app-shell { /* --- 1. 顶栏胶囊宿主容器 (Titlebar Capsule Host) --- */ :host(.wm-capsule-host) { - --ui-font-scale: 1; + --ui-font-scale: 1 !important; display: inline-flex; align-items: center; gap: 6px; @@ -4675,7 +4724,7 @@ html[data-standalone="true"] .app-shell { position: fixed; top: 42px; left: 12px; - width: min(522px, calc(100vw - 24px)); + width: min(calc(522px * var(--ui-panel-scale, 1)), calc(100vw - 24px)); max-height: calc(100vh - 54px); padding: var(--space-3) var(--space-4); display: flex; @@ -4699,7 +4748,7 @@ html[data-standalone="true"] .app-shell { position: fixed; top: 42px; left: 12px; - width: min(464px, calc(100vw - 24px)); + width: min(calc(464px * var(--ui-panel-scale, 1)), calc(100vw - 24px)); max-height: calc(100vh - 54px); padding: 14px 16px; display: flex; @@ -4805,8 +4854,8 @@ html[data-standalone="true"] .app-shell { .wm-pin-badge { display: inline-flex; align-items: center; - height: 16px; - padding: 0 5px; + min-height: calc(16px * var(--ui-font-scale, 1)); + padding: 1px 5px; font-size: var(--fs-xs); font-weight: 600; color: var(--accent-primary); @@ -4818,8 +4867,8 @@ html[data-standalone="true"] .app-shell { .wm-session-tag { display: inline-flex; align-items: center; - height: 16px; - padding: 0 4px; + min-height: calc(16px * var(--ui-font-scale, 1)); + padding: 1px 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-secondary); diff --git a/sidecars/panel/test/cross-module-regressions.test.mjs b/sidecars/panel/test/cross-module-regressions.test.mjs index 1890505..056adad 100644 --- a/sidecars/panel/test/cross-module-regressions.test.mjs +++ b/sidecars/panel/test/cross-module-regressions.test.mjs @@ -616,3 +616,29 @@ test('Compaction liveActivity: detects in-progress & completed CHECKPOINT over p assert.equal(pTranscriptOnly.activeConversation.liveActivity.phase, 'compacting'); assert.equal(pTranscriptOnly.activeConversation.liveActivity.label, '上下文压缩'); }); + +test('panel typography scales all view/table/chart CSS rules via --fs-* tokens without hardcoded px sizes', () => { + const stylesDir = fileURLToPath(new URL('../src/styles', import.meta.url)); + const viewCssFiles = [ + 'controls.css', + 'views-overview.css', + 'views-tables.css', + 'views-consumption.css', + 'views-settings.css', + ]; + for (const file of viewCssFiles) { + const css = fs.readFileSync(join(stylesDir, file), 'utf8'); + const rawFontLines = css + .split(/\r?\n/) + .filter((line) => /font-size\s*:/.test(line) && !/var\(--fs-/.test(line)); + assert.deepEqual( + rawFontLines, + [], + `${file} must route every font-size declaration through scalable --fs-* tokens` + ); + } + const tokensCss = fs.readFileSync(join(stylesDir, 'tokens.css'), 'utf8'); + assert.match(tokensCss, /:host\(\[data-font-scale="xl"\]\)/); + assert.match(tokensCss, /\[data-font-scale\]\s*\{[\s\S]*?--fs-base-sm:/); + assert.doesNotMatch(tokensCss, /:root,\s*:host\s*\{[^}]*--ui-font-scale\s*:\s*1\s*;/); +}); diff --git a/sidecars/panel/test/window-bridge.test.mjs b/sidecars/panel/test/window-bridge.test.mjs index 150a60d..35073fc 100644 --- a/sidecars/panel/test/window-bridge.test.mjs +++ b/sidecars/panel/test/window-bridge.test.mjs @@ -1422,7 +1422,11 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/ routes, pro assert.equal(liveDotSvg.attributes.get('width'), '11', 'Enlarged live activity SVG dot size is 11'); assert.equal(liveDotSvg.children[0].attributes.get('r'), '5', 'Enlarged dot circle radius is 5'); assert.match(stylesCss, /\.wm-multi-dot\s*\{\s*width:\s*8px;\s*height:\s*8px;/, 'Topbar multi-session dot enlarged to 8px'); - assert.match(stylesCss, /\.wm-hover-tip\s*\{[^}]*width:\s*min\(522px,\s*calc\(100vw - 24px\)\);/, 'Hover floating card width is 522px'); + assert.match( + stylesCss, + /\.wm-hover-tip\s*\{[^}]*width:\s*min\(calc\(522px \* var\(--ui-panel-scale, 1\)\),\s*calc\(100vw - 24px\)\);/, + 'Hover floating card base width is 522px and scales with --ui-panel-scale' + ); assert.equal(multiPanelEl.querySelector('.wm-recent-list'), null, 'Recent sessions list removed so panel shows online sessions only'); assert.equal(multiPanelEl.querySelector('.panel'), null, 'Single-layer multi-session panel without nested .panel box'); @@ -1563,19 +1567,25 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/ routes, pro assert.equal(mockSettings.themeAccent, 'host'); assert.equal(portalHost.style.getPropertyValue('--user-accent-primary'), '', 'Host accent clears override'); - // Font scale: switch to xl (1.15), verify portalHost scales while capsuleHost NEVER scales + // Font scale: switch to xl (1.28), verify portalHost and inner panels scale while capsuleHost NEVER scales assert.equal(fontScaleBtns.length, 4, 'Font scale segmented control has sm / md / lg / xl'); fontScaleBtns[3].dispatchEvent({ type: 'click', stopPropagation() {} }); await new Promise((r) => setTimeout(r, 30)); assert.equal(mockSettings.fontScale, 'xl'); - assert.equal(portalHost.style.getPropertyValue('--ui-font-scale'), '1.15', 'Portal host scales to 1.15'); + assert.equal(portalHost.style.getPropertyValue('--ui-font-scale'), '1.28', 'Portal host scales to 1.28'); + assert.equal(portalHost.style.getPropertyValue('--ui-panel-scale'), '1.18', 'Portal host panel width scales to 1.18'); + assert.equal(popoverEl.getAttribute('data-font-scale'), 'xl', 'Popover panel receives data-font-scale'); + assert.equal(hoverTipEl.getAttribute('data-font-scale'), 'xl', 'Hover card receives data-font-scale'); + assert.equal(multiPanelEl.getAttribute('data-font-scale'), 'xl', 'Multi-session panel receives data-font-scale'); assert.equal(capsuleHost.style.getPropertyValue('--ui-font-scale'), '', 'Capsule host strictly excludes font scale'); assert.equal(capsuleHost.hasAttribute('data-font-scale'), false); fontScaleBtns[1].dispatchEvent({ type: 'click', stopPropagation() {} }); await new Promise((r) => setTimeout(r, 30)); assert.equal(mockSettings.fontScale, 'md'); assert.equal(portalHost.style.getPropertyValue('--ui-font-scale'), ''); + assert.equal(portalHost.style.getPropertyValue('--ui-panel-scale'), ''); assert.equal(portalHost.getAttribute('data-font-scale'), 'md'); + assert.equal(popoverEl.getAttribute('data-font-scale'), 'md'); // Live i18n switch: zh-CN -> en-US -> zh-CN without page reload langBtns[1].dispatchEvent({ type: 'click', stopPropagation() {} });