fix(webui): 手势导航条改用色块填充(背景延伸到屏幕底部)

- 底栏外层容器承载背景色与安全区内边距:手势条区域与导航栏同色,
  内容抬到手势条之上(FontMM 同款做法)
- md-navigation-bar 保持自身固定高度,避免直接加 padding 被内部布局吃掉
- edge-to-edge 改为探测全局 ksu 对象并兼容 enableInsets 命名:
  npm 包导出的绑定始终存在,不支持时抛错在包内部,会打断后续脚本
This commit is contained in:
YuleBest committed 2026-09-11 19:00:41 +08:00
1 parent f8d453b9fb
commit c80c92135b
3 files changed
+34 -20

No files matched your search

+11 -5
View File
@@ -1,4 +1,4 @@
import { exec, moduleInfo, enableEdgeToEdge } from 'kernelsu'
import { exec, moduleInfo } from 'kernelsu'
import { devMock } from './devMock.js'
export const MODULE_DIR = '/data/adb/modules/LuminPro'
@@ -42,13 +42,19 @@ export function shellQuote(value) {
}
/**
* 启用 edge-to-edge:内容延伸至状态栏/手势条区域,
* insets.css 的 --window-inset-* 随之生效,顶栏/底栏据此避让。
* 不同 KernelSU 版本的命名不同,逐个尝试,全部不可用则忽略。
* 启用 edge-to-edge:内容延伸至状态栏/手势条区域,insets.css 的
* --window-inset-* / --safe-area-inset-* 随之生效。
*
* 注意:不能直接调用从 npm 包 import 的 enableEdgeToEdge——该绑定总是存在,
* 不支持时是包内部调用 ksu 对象时抛错,会打断后续脚本(FontMM 踩过同样的坑)。
* 这里改为探测全局 ksu 对象,并兼容 KernelSU-Next 的 enableInsets 命名。
*/
export function applyEdgeToEdge() {
try {
enableEdgeToEdge(true)
const ksuApi = globalThis.ksu
if (!ksuApi) return
const fn = ksuApi.enableEdgeToEdge ?? ksuApi.enableInsets
if (typeof fn === 'function') fn.call(ksuApi, true)
} catch {
/* 老版本没有该 API:布局仍可用,只是安全区取 0 */
}
+14 -12
View File
@@ -16,16 +16,18 @@ const tabs = [
</script>
<template>
<md-navigation-bar>
<md-navigation-tab
v-for="tab in tabs"
:key="tab.key"
:label="tab.label"
:active="modelValue === tab.key"
@click="emit('update:modelValue', tab.key)"
>
<component :is="tab.icon" slot="active-icon" :size="24" />
<component :is="tab.icon" slot="inactive-icon" :size="24" />
</md-navigation-tab>
</md-navigation-bar>
<nav class="bottom-nav">
<md-navigation-bar>
<md-navigation-tab
v-for="tab in tabs"
:key="tab.key"
:label="tab.label"
:active="modelValue === tab.key"
@click="emit('update:modelValue', tab.key)"
>
<component :is="tab.icon" slot="active-icon" :size="24" />
<component :is="tab.icon" slot="inactive-icon" :size="24" />
</md-navigation-tab>
</md-navigation-bar>
</nav>
</template>
+9 -3
View File
@@ -138,10 +138,16 @@
}
/* ── M3 导航栏 ────────────────────────────────────────────────────── */
md-navigation-bar {
/* 底栏容器:色块填充法——容器背景延伸至屏幕最底部,手势导航条区域
与导航栏同色;内边距把导航内容抬到手势条之上。
安全区变量在不同 KernelSU 版本命名不同,最后兜底 env()。 */
.bottom-nav {
flex: 0 0 auto;
/* 背景延伸到屏幕底部,内容抬到手势条之上 */
padding-bottom: var(--safe-area-inset-bottom, var(--window-inset-bottom, 0px));
background-color: var(--md-sys-color-surface-container);
padding-bottom: var(--safe-area-inset-bottom, var(--window-inset-bottom, env(safe-area-inset-bottom, 0px)));
}
md-navigation-bar {
--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);