diff --git a/webui/src/api/devMock.js b/webui/src/api/devMock.js index 8b9c504..4e32655 100644 --- a/webui/src/api/devMock.js +++ b/webui/src/api/devMock.js @@ -63,17 +63,19 @@ const ok = (obj) => ({ ok: true, errno: 0, stdout: JSON.stringify(obj), stderr: /** 依据命令内容返回模拟响应;无法识别时返回 null */ export function devMock(command) { - if (command.includes(' config read')) return ok(mockConfig()) - if (command.includes(' config patch') || command.includes(' config set')) return ok({ ok: true }) - if (command.includes(' status')) return ok(mockStatus(!command.includes('--no-display'))) - if (command.includes(' oplock')) return ok({ locked: false, seconds: 0 }) - if (command.includes(' focus')) return ok({ focus: 'com.example.video/.MainActivity' }) - if (command.includes(' brightness set')) return ok({ ok: true, value: 2000 }) - if (command.includes(' log tail')) { + // 参数经 shellQuote 包装过,比较前先去掉单引号 + const plain = command.replace(/'/g, '') + if (plain.includes(' config read')) return ok(mockConfig()) + if (plain.includes(' config patch') || plain.includes(' config set')) return ok({ ok: true }) + if (plain.includes(' status')) return ok(mockStatus(!plain.includes('--no-display'))) + if (plain.includes(' oplock')) return ok({ locked: false, seconds: 0 }) + if (plain.includes(' focus')) return ok({ focus: 'com.example.video/.MainActivity' }) + if (plain.includes(' brightness set')) return ok({ ok: true, value: 2000 }) + if (plain.includes(' log tail')) { return ok({ entries: mockLogEntries, sizeKB: 12, total: mockLogEntries.length }) } - if (command.includes(' log clear') || command.includes(' log export')) return ok({ ok: true }) - if (command.includes('boost') || command.includes('restart') || command.includes('action.sh')) { + if (plain.includes(' log clear') || plain.includes(' log export')) return ok({ ok: true }) + if (plain.includes('boost') || plain.includes('restart') || plain.includes('action.sh')) { return { ok: true, errno: 0, stdout: 'LuminPro: 服务已启用', stderr: '' } } return null diff --git a/webui/src/components/ActionMenu.vue b/webui/src/components/ActionMenu.vue index 2dc8317..0ceaeea 100644 --- a/webui/src/components/ActionMenu.vue +++ b/webui/src/components/ActionMenu.vue @@ -1,8 +1,8 @@ diff --git a/webui/src/composables/useConfig.js b/webui/src/composables/useConfig.js index d3e8883..86b7c1d 100644 --- a/webui/src/composables/useConfig.js +++ b/webui/src/composables/useConfig.js @@ -89,6 +89,21 @@ export function useConfig() { return patch } + /** 整型开关字段(0/1)与布尔值之间的桥接:md-switch 给出的是布尔值 */ + function intBool(key) { + return computed({ + get: () => Number(form[key]) === 1, + set: (on) => { + form[key] = on ? '1' : '0' + }, + }) + } + + const autoBriSleep = intBool('auto_bri_sleep') + const displayHdrSleep = intBool('display_hdr_sleep') + const compatibilityMode = intBool('compatibility_mode') + const debugMode = intBool('debug_mode') + const diffMain = computed(() => changedKeys(MAIN_KEYS)) const diffAdvanced = computed(() => changedKeys(ADVANCED_KEYS)) const dirtyMain = computed(() => Object.keys(diffMain.value).length > 0) @@ -157,6 +172,10 @@ export function useConfig() { error, dirtyMain, dirtyAdvanced, + autoBriSleep, + displayHdrSleep, + compatibilityMode, + debugMode, load, saveMain, saveAdvanced, diff --git a/webui/src/theme/app.css b/webui/src/theme/app.css index 3ae6b70..dc4621b 100644 --- a/webui/src/theme/app.css +++ b/webui/src/theme/app.css @@ -22,9 +22,9 @@ align-items: center; gap: var(--md-sys-spacing-1); min-height: 64px; - padding: var(--md-sys-spacing-2) var(--md-sys-spacing-1) var(--md-sys-spacing-2) - var(--md-sys-spacing-4); - background-color: var(--md-sys-color-surface); + padding: calc(var(--md-sys-spacing-2) + var(--safe-area-inset-top, var(--window-inset-top, 0px))) + var(--md-sys-spacing-1) var(--md-sys-spacing-2) var(--md-sys-spacing-4); + background-color: var(--md-sys-color-background); transition: background-color var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard); } @@ -49,10 +49,35 @@ gap: var(--md-sys-spacing-2); } -.app-bar__subtitle { +.app-bar__meta { + display: flex; + align-items: center; + gap: 6px; color: var(--md-sys-color-on-surface-variant); } +.status-dot { + flex: 0 0 auto; + width: 8px; + height: 8px; + border-radius: 50%; + background-color: var(--md-sys-color-outline); +} + +.status-dot.running { + background-color: var(--lp-color-success); + animation: status-pulse 2.4s var(--md-sys-motion-easing-standard) infinite; +} + +.status-dot.paused { + background-color: var(--lp-color-warning); +} + +.status-dot.stopped { + background-color: var(--md-sys-color-error); + animation: status-pulse 2s var(--md-sys-motion-easing-standard) infinite; +} + /* 发布通道徽标(Beta / Dev) */ .channel-badge { flex: 0 0 auto; @@ -66,42 +91,6 @@ text-transform: uppercase; } -/* 守护进程状态胶囊 */ -.status-pill { - flex: 0 0 auto; - display: inline-flex; - align-items: center; - gap: 6px; - padding: 4px 10px; - border-radius: var(--md-sys-shape-corner-full); - background-color: var(--md-sys-color-surface-container-high); - color: var(--md-sys-color-on-surface-variant); - font-size: var(--md-sys-typescale-label-small-size); - font-weight: 600; -} - -.status-pill__dot { - width: 8px; - height: 8px; - border-radius: 50%; - background-color: var(--md-sys-color-outline); -} - -.status-pill.running .status-pill__dot { - background-color: var(--lp-color-success); - box-shadow: 0 0 8px var(--lp-color-success-container); - animation: status-pulse 2.4s var(--md-sys-motion-easing-standard) infinite; -} - -.status-pill.paused .status-pill__dot { - background-color: var(--lp-color-warning); -} - -.status-pill.stopped .status-pill__dot { - background-color: var(--md-sys-color-error); - animation: status-pulse 2s var(--md-sys-motion-easing-standard) infinite; -} - @keyframes status-pulse { 0%, 100% { @@ -144,14 +133,15 @@ display: flex; flex-direction: column; gap: var(--md-sys-spacing-3); - padding: var(--md-sys-spacing-3) var(--md-sys-spacing-3) - calc(var(--md-sys-spacing-5) + var(--safe-area-inset-bottom, 0px)); + padding: var(--md-sys-spacing-3) var(--md-sys-spacing-3) var(--md-sys-spacing-5); scrollbar-width: none; } /* ── M3 导航栏 ────────────────────────────────────────────────────── */ md-navigation-bar { flex: 0 0 auto; + /* 背景延伸到屏幕底部,内容抬到手势条之上 */ + padding-bottom: var(--safe-area-inset-bottom, var(--window-inset-bottom, 0px)); --md-navigation-bar-container-color: var(--md-sys-color-surface-container); --md-navigation-bar-active-indicator-color: var(--md-sys-color-secondary-container); --md-navigation-bar-active-icon-color: var(--md-sys-color-on-secondary-container); @@ -166,11 +156,9 @@ md-navigation-tab { /* ── 操作锁横幅 ───────────────────────────────────────────────────── */ .oplock-banner { - position: absolute; - top: 0; - left: 0; - right: 0; - z-index: 5; + /* 参与正常流(并排在顶栏之前):出现时把内容整体下推,而不是盖住顶栏 */ + order: -1; + flex: 0 0 auto; display: flex; align-items: center; gap: var(--md-sys-spacing-2); @@ -228,7 +216,7 @@ md-navigation-tab { position: absolute; left: var(--md-sys-spacing-3); right: var(--md-sys-spacing-3); - bottom: calc(96px + var(--safe-area-inset-bottom, 0px)); + bottom: calc(96px + var(--safe-area-inset-bottom, var(--window-inset-bottom, 0px))); z-index: 7; display: flex; flex-direction: column; diff --git a/webui/src/theme/base.css b/webui/src/theme/base.css index f6c5239..9fca17d 100644 --- a/webui/src/theme/base.css +++ b/webui/src/theme/base.css @@ -33,8 +33,8 @@ body { body { /* 全局 0.95 视觉缩放;用户自定义缩放叠加在 html 上(沿用既有策略) */ zoom: 0.95; - padding-top: var(--safe-area-inset-top, 0); - padding-bottom: var(--safe-area-inset-bottom, 0); + /* edge-to-edge:安全区由顶栏/底部导航栏各自内缩处理, + 这样系统栏区域的背景色能延伸到屏幕边缘(参考 FontMM) */ background-color: var(--md-sys-color-background); color: var(--md-sys-color-on-background); font-family: var(--md-sys-typescale-font); @@ -132,6 +132,11 @@ body::-webkit-scrollbar, font-variant-numeric: tabular-nums; } +/* 中英混排的数值:用页面字体 + 等宽数字,避免中文落到等宽栈的 CJK 兜底字体 */ +.tabular { + font-variant-numeric: tabular-nums; +} + /* ── 表面:MD3 用色调层级而非阴影表达层级 ─────────────────────────── */ .section { background-color: var(--md-sys-color-surface-container-low); diff --git a/webui/src/theme/components.css b/webui/src/theme/components.css index 2e73f59..613544d 100644 --- a/webui/src/theme/components.css +++ b/webui/src/theme/components.css @@ -70,8 +70,11 @@ .collapse { display: grid; grid-template-rows: 0fr; - transition: grid-template-rows var(--md-sys-motion-duration-medium2) - var(--md-sys-motion-easing-emphasized); + margin-top: 0; + transition: + grid-template-rows var(--md-sys-motion-duration-medium2) + var(--md-sys-motion-easing-emphasized), + margin-top var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized); } .collapse.open { @@ -92,6 +95,11 @@ padding-bottom: var(--collapse-gap, 0px); } +/* 收起时高度为 0 但仍参与父容器 gap,会多留一段空白;抵消其中一次间距 */ +.collapse:not(.open) { + margin-top: calc(-1 * var(--md-sys-spacing-3)); +} + .collapse--gap { --collapse-gap: var(--md-sys-spacing-3); } diff --git a/webui/src/theme/tokens.css b/webui/src/theme/tokens.css index 3f20719..a82eaa3 100644 --- a/webui/src/theme/tokens.css +++ b/webui/src/theme/tokens.css @@ -66,7 +66,17 @@ --md-sys-typescale-label-small-tracking: 0.0313em; --md-sys-typescale-font: 'Geist', system-ui, -apple-system, sans-serif; - --md-sys-typescale-font-mono: 'Geist Mono', ui-monospace, monospace; + /* 等宽栈要带上 CJK 无衬线兜底:Geist Mono 无中文字形,直接落到通用 monospace + 会在 Windows 上显示为宋体 */ + --md-sys-typescale-font-mono: + 'Geist Mono', ui-monospace, 'Microsoft YaHei', 'PingFang SC', 'Noto Sans CJK SC', monospace; + + /* @material/web 组件内部的字体族取自 ref typeface(默认回退 Roboto), + 必须显式指向项目字体,否则组件内文字与页面字体不一致 */ + --md-ref-typeface-brand: 'Geist', system-ui, -apple-system, sans-serif; + --md-ref-typeface-plain: 'Geist', system-ui, -apple-system, sans-serif; + --md-ref-typeface-weight-regular: 400; + --md-ref-typeface-weight-medium: 500; /* ── 形状 shape ─────────────────────────────────────────────────── */ --md-sys-shape-corner-none: 0; diff --git a/webui/src/views/AppsView.vue b/webui/src/views/AppsView.vue index c8a58aa..0905c97 100644 --- a/webui/src/views/AppsView.vue +++ b/webui/src/views/AppsView.vue @@ -264,9 +264,13 @@ onUnmounted(stopPolling)
-
+
{{ row.app.appLabel }} {{ row.app.uid }} @@ -432,16 +436,33 @@ onUnmounted(stopPolling) display: flex; align-items: center; gap: var(--md-sys-spacing-2); - padding: var(--md-sys-spacing-2) var(--md-sys-spacing-3) var(--md-sys-spacing-2) 0; + padding: var(--md-sys-spacing-2) var(--md-sys-spacing-3); min-height: 64px; } +/* 选中但尚未保存:绿色提示;保存后回到默认主色 */ +md-checkbox.is-unsaved { + --md-checkbox-selected-container-color: var(--lp-color-success); + --md-checkbox-selected-hover-container-color: var(--lp-color-success); + --md-checkbox-selected-focus-container-color: var(--lp-color-success); + --md-checkbox-selected-pressed-container-color: var(--lp-color-success); + --md-checkbox-selected-hover-state-layer-color: var(--lp-color-success); + --md-checkbox-selected-pressed-state-layer-color: var(--lp-color-success); + --md-checkbox-selected-icon-color: var(--md-sys-color-surface); + --md-checkbox-selected-hover-icon-color: var(--md-sys-color-surface); + --md-checkbox-selected-focus-icon-color: var(--md-sys-color-surface); + --md-checkbox-selected-pressed-icon-color: var(--md-sys-color-surface); +} + +/* 名称/包名区域也可点击切换(复选框本身只有 18px,触控偏小) */ .app-row__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; + cursor: pointer; + padding: var(--md-sys-spacing-1) 0; } .app-row__name { diff --git a/webui/src/views/ConfigView.vue b/webui/src/views/ConfigView.vue index 875c332..7de5dde 100644 --- a/webui/src/views/ConfigView.vue +++ b/webui/src/views/ConfigView.vue @@ -127,13 +127,13 @@ async function confirmReset() { />
- + -
+
`log-line--${(level || 'plain').toLowerCase()}` line-height: 1.55; } +/* UA 样式表给 code 单独设了 font-family: monospace(不继承 pre), + 必须显式 inherit,否则中文回落到宋体 */ +.log-output code { + font-family: inherit; + font-size: inherit; +} + .log-line { display: block; white-space: pre-wrap; diff --git a/webui/src/views/StatusView.vue b/webui/src/views/StatusView.vue index 175b34a..c23a2e0 100644 --- a/webui/src/views/StatusView.vue +++ b/webui/src/views/StatusView.vue @@ -1,6 +1,6 @@