From 90928d3aeb3368309164d35b93d1524a26587b66 Mon Sep 17 00:00:00 2001 From: Yule Date: Thu, 10 Sep 2026 09:29:49 +0800 Subject: [PATCH] =?UTF-8?q?refactor(webui)!:=20=E5=85=A8=E9=87=8F=E9=87=8D?= =?UTF-8?q?=E5=86=99=E4=B8=BA=20Material=20Design=203=EF=BC=88@material/we?= =?UTF-8?q?b=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 组件层改为 Material Web Components:按钮/输入/开关/滑条/复选/下拉/对话框/ 菜单/导航栏/过滤芯片,移除 shadcn 风格组件与 Tailwind 全家桶 - 新增完整 MD3 token 体系(颜色全角色、字阶、形状、动效、状态层), 颜色沿用既有 Google Blue;字体保持 Geist 不变 - 壳层重构:M3 固定顶栏(滚动加容器色)+ 标准导航栏(去掉拖拽手势)、 toast 改为 M3 snackbar、原生 confirm/prompt 改为 md-dialog - 数据层改走 Go JSON API(status/oplock/brightness/config/log/focus), 一次调用取代多条 shell 命令;命令参数统一 shellQuote,不再拼接未校验输入 - 懒加载 markdown-it 与拼音库;删除 apps.js 等死代码 - 体积:JS 454KB(gzip 115KB) + CSS 30KB(原 318KB+58KB),懒加载分块另计 --- go/cmd/luminpro/main.go | 17 +- package.json | 8 +- pnpm-lock.yaml | 322 ++-------- webui/components.json | 20 - webui/src/App.vue | 311 ++++----- webui/src/about.css | 330 ---------- webui/src/api/devMock.js | 80 +++ webui/src/api/ksu.js | 51 ++ webui/src/api/luminpro.js | 85 +++ webui/src/apps.css | 562 ----------------- webui/src/apps.js | 734 ---------------------- webui/src/components.css | 663 -------------------- webui/src/components/ActionMenu.vue | 40 ++ webui/src/components/AppBottomNav.vue | 31 + webui/src/components/AppSwitch.vue | 28 + webui/src/components/AppTextField.vue | 36 ++ webui/src/components/AppTopBar.vue | 59 ++ webui/src/components/BottomNav.vue | 143 ----- webui/src/components/ConfirmDialog.vue | 54 ++ webui/src/components/OpLockBanner.vue | 17 + webui/src/components/PromptDialog.vue | 68 ++ webui/src/components/SnackbarHost.vue | 15 + webui/src/components/ui/Badge.vue | 32 - webui/src/components/ui/Button.vue | 53 -- webui/src/components/ui/Card.vue | 17 - webui/src/components/ui/Input.vue | 38 -- webui/src/components/ui/Label.vue | 22 - webui/src/components/ui/Separator.vue | 21 - webui/src/components/ui/Switch.vue | 43 -- webui/src/components/ui/Textarea.vue | 30 - webui/src/composables/useApps.js | 133 ++-- webui/src/composables/useConfig.js | 392 ++++-------- webui/src/composables/useLog.js | 90 +-- webui/src/composables/useOplock.js | 23 - webui/src/composables/useSnackbar.js | 70 +++ webui/src/composables/useStatus.js | 202 +++--- webui/src/header.css | 220 ------- webui/src/index.css | 175 ------ webui/src/lib/utils.js | 6 - webui/src/log.css | 265 -------- webui/src/main.js | 14 +- webui/src/mwc.js | 31 + webui/src/style.css | 131 ---- webui/src/theme/app.css | 274 ++++++++ webui/src/theme/base.css | 214 +++++++ webui/src/theme/components.css | 160 +++++ webui/src/theme/tokens.css | 286 +++++++++ webui/src/utils.js | 113 ---- webui/src/views/AboutView.vue | 312 ++++++--- webui/src/views/AppsView.vue | 836 ++++++++++++++----------- webui/src/views/ConfigView.vue | 749 +++++++++++----------- webui/src/views/LogView.vue | 187 +++--- webui/src/views/StatusView.vue | 216 ++++--- webui/vite.config.js | 12 +- 54 files changed, 3400 insertions(+), 5641 deletions(-) delete mode 100644 webui/components.json delete mode 100644 webui/src/about.css create mode 100644 webui/src/api/devMock.js create mode 100644 webui/src/api/ksu.js create mode 100644 webui/src/api/luminpro.js delete mode 100644 webui/src/apps.css delete mode 100644 webui/src/apps.js delete mode 100644 webui/src/components.css create mode 100644 webui/src/components/ActionMenu.vue create mode 100644 webui/src/components/AppBottomNav.vue create mode 100644 webui/src/components/AppSwitch.vue create mode 100644 webui/src/components/AppTextField.vue create mode 100644 webui/src/components/AppTopBar.vue delete mode 100644 webui/src/components/BottomNav.vue create mode 100644 webui/src/components/ConfirmDialog.vue create mode 100644 webui/src/components/OpLockBanner.vue create mode 100644 webui/src/components/PromptDialog.vue create mode 100644 webui/src/components/SnackbarHost.vue delete mode 100644 webui/src/components/ui/Badge.vue delete mode 100644 webui/src/components/ui/Button.vue delete mode 100644 webui/src/components/ui/Card.vue delete mode 100644 webui/src/components/ui/Input.vue delete mode 100644 webui/src/components/ui/Label.vue delete mode 100644 webui/src/components/ui/Separator.vue delete mode 100644 webui/src/components/ui/Switch.vue delete mode 100644 webui/src/components/ui/Textarea.vue delete mode 100644 webui/src/composables/useOplock.js create mode 100644 webui/src/composables/useSnackbar.js delete mode 100644 webui/src/header.css delete mode 100644 webui/src/index.css delete mode 100644 webui/src/lib/utils.js delete mode 100644 webui/src/log.css create mode 100644 webui/src/mwc.js delete mode 100644 webui/src/style.css create mode 100644 webui/src/theme/app.css create mode 100644 webui/src/theme/base.css create mode 100644 webui/src/theme/components.css create mode 100644 webui/src/theme/tokens.css delete mode 100644 webui/src/utils.js diff --git a/go/cmd/luminpro/main.go b/go/cmd/luminpro/main.go index e0e67aa..de54a6f 100644 --- a/go/cmd/luminpro/main.go +++ b/go/cmd/luminpro/main.go @@ -63,6 +63,9 @@ func run(args []string) error { return runStatus(paths, args[1:]) case "oplock": return emitJSON(api.ReadOplock(paths.Oplock)) + case "focus": + focus := system.Focus{Runner: system.ExecRunner{}} + return emitJSON(map[string]any{"focus": focus.CurrentFocus()}) case "brightness": return runBrightness(paths, args[1:]) case "config": @@ -86,6 +89,7 @@ func usage() error { luminpro status [--no-display] 聚合状态(JSON) luminpro oplock 操作锁状态(JSON) + luminpro focus 当前前台 Activity(JSON) luminpro brightness set <值> 设置亮度(JSON) luminpro config <操作> 配置管理(JSON) @@ -245,9 +249,16 @@ func runConfig(paths api.Paths, args []string) error { _, err = os.Stdout.Write(append(data, '\n')) return err case "patch": - input, err := io.ReadAll(os.Stdin) - if err != nil { - return err + // 支持两种传参:命令行参数(WebUI 用,exec 无 stdin)或标准输入(脚本用) + var input []byte + var err error + if len(args) >= 2 { + input = []byte(args[1]) + } else { + input, err = io.ReadAll(os.Stdin) + if err != nil { + return err + } } var patch map[string]json.RawMessage if err := json.Unmarshal(input, &patch); err != nil { diff --git a/package.json b/package.json index 494dd0f..1b5a488 100644 --- a/package.json +++ b/package.json @@ -14,25 +14,19 @@ "fmt:check": "oxfmt webui/ --check" }, "devDependencies": { - "@tailwindcss/vite": "^4.2.2", "archiver": "^7.0.1", "kernelsu": "^3.0.2", "oxfmt": "^0.44.0", "oxlint": "^1.59.0", - "tailwindcss": "^4.2.2", - "tw-animate-css": "^1.4.0", "vite": "^8.0.3" }, "dependencies": { + "@material/web": "^2.5.0", "@tanstack/vue-virtual": "^3.13.37", "@vitejs/plugin-vue": "^6.0.5", - "class-variance-authority": "^0.7.1", - "clsx": "^2.1.1", - "lucide": "^1.7.0", "lucide-vue-next": "^1.0.0", "markdown-it": "^14.1.1", "pinyin-match": "^1.2.10", - "tailwind-merge": "^3.5.0", "vue": "^3.5.32" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0694a99..fa728db 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,21 +8,15 @@ importers: .: dependencies: + '@material/web': + specifier: ^2.5.0 + version: 2.5.0 '@tanstack/vue-virtual': specifier: ^3.13.37 version: 3.13.37(vue@3.5.32) '@vitejs/plugin-vue': specifier: ^6.0.5 version: 6.0.5(vite@8.0.3(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2)(jiti@2.6.1))(vue@3.5.32) - class-variance-authority: - specifier: ^0.7.1 - version: 0.7.1 - clsx: - specifier: ^2.1.1 - version: 2.1.1 - lucide: - specifier: ^1.7.0 - version: 1.7.0 lucide-vue-next: specifier: ^1.0.0 version: 1.0.0(vue@3.5.32) @@ -32,16 +26,10 @@ importers: pinyin-match: specifier: ^1.2.10 version: 1.2.10 - tailwind-merge: - specifier: ^3.5.0 - version: 3.5.0 vue: specifier: ^3.5.32 version: 3.5.32 devDependencies: - '@tailwindcss/vite': - specifier: ^4.2.2 - version: 4.2.2(vite@8.0.3(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2)(jiti@2.6.1)) archiver: specifier: ^7.0.1 version: 7.0.1 @@ -54,12 +42,6 @@ importers: oxlint: specifier: ^1.59.0 version: 1.59.0 - tailwindcss: - specifier: ^4.2.2 - version: 4.2.2 - tw-animate-css: - specifier: ^1.4.0 - version: 1.4.0 vite: specifier: ^8.0.3 version: 8.0.3(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2)(jiti@2.6.1) @@ -96,21 +78,20 @@ packages: resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} engines: {node: '>=12'} - '@jridgewell/gen-mapping@0.3.13': - resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==} - - '@jridgewell/remapping@2.3.5': - resolution: {integrity: sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==} - - '@jridgewell/resolve-uri@3.1.2': - resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} - engines: {node: '>=6.0.0'} - '@jridgewell/sourcemap-codec@1.5.5': resolution: {integrity: sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==} - '@jridgewell/trace-mapping@0.3.31': - resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==} + '@lit-labs/ssr-dom-shim@1.6.0': + resolution: {integrity: sha512-VHb0ALPMTlgKjM6yIxxoQNnpKyUKLD04VzeQdsiXkMqkvYlAHxq9glGLmgbb889/1GsohSOAjvQYoiBppXFqrQ==} + + '@lit/context@1.1.6': + resolution: {integrity: sha512-M26qDE6UkQbZA2mQ3RjJ3Gzd8TxP+/0obMgE5HfkfLhEEyYE3Bui4A5XHiGPjy0MUGAyxB3QgVuw2ciS0kHn6A==} + + '@lit/reactive-element@2.1.2': + resolution: {integrity: sha512-pbCDiVMnne1lYUIaYNN5wrwQXDtHaYtg7YEFPeW+hws6U47WeFvISGUWekPGKWOP1ygrs0ef0o1VJMk1exos5A==} + + '@material/web@2.5.0': + resolution: {integrity: sha512-x2Uovyq8E/Zc1xHXd9s1eBMXF5pMHVAt70pISKd0fL3Ajj4L6zQaQUY/awcfR2RDAMKXC7i4+vr0arv1YaOR/g==} '@napi-rs/wasm-runtime@1.1.2': resolution: {integrity: sha512-sNXv5oLJ7ob93xkZ1XnxisYhGYXfaG9f65/ZgYuAu3qt7b3NadcOEhLvx28hv31PgX8SZJRYrAIPQilQmFpLVw==} @@ -470,100 +451,6 @@ packages: '@rolldown/pluginutils@1.0.0-rc.2': resolution: {integrity: sha512-izyXV/v+cHiRfozX62W9htOAvwMo4/bXKDrQ+vom1L1qRuexPock/7VZDAhnpHCLNejd3NJ6hiab+tO0D44Rgw==} - '@tailwindcss/node@4.2.2': - resolution: {integrity: sha512-pXS+wJ2gZpVXqFaUEjojq7jzMpTGf8rU6ipJz5ovJV6PUGmlJ+jvIwGrzdHdQ80Sg+wmQxUFuoW1UAAwHNEdFA==} - - '@tailwindcss/oxide-android-arm64@4.2.2': - resolution: {integrity: sha512-dXGR1n+P3B6748jZO/SvHZq7qBOqqzQ+yFrXpoOWWALWndF9MoSKAT3Q0fYgAzYzGhxNYOoysRvYlpixRBBoDg==} - engines: {node: '>= 20'} - cpu: [arm64] - os: [android] - - '@tailwindcss/oxide-darwin-arm64@4.2.2': - resolution: {integrity: sha512-iq9Qjr6knfMpZHj55/37ouZeykwbDqF21gPFtfnhCCKGDcPI/21FKC9XdMO/XyBM7qKORx6UIhGgg6jLl7BZlg==} - engines: {node: '>= 20'} - cpu: [arm64] - os: [darwin] - - '@tailwindcss/oxide-darwin-x64@4.2.2': - resolution: {integrity: sha512-BlR+2c3nzc8f2G639LpL89YY4bdcIdUmiOOkv2GQv4/4M0vJlpXEa0JXNHhCHU7VWOKWT/CjqHdTP8aUuDJkuw==} - engines: {node: '>= 20'} - cpu: [x64] - os: [darwin] - - '@tailwindcss/oxide-freebsd-x64@4.2.2': - resolution: {integrity: sha512-YUqUgrGMSu2CDO82hzlQ5qSb5xmx3RUrke/QgnoEx7KvmRJHQuZHZmZTLSuuHwFf0DJPybFMXMYf+WJdxHy/nQ==} - engines: {node: '>= 20'} - cpu: [x64] - os: [freebsd] - - '@tailwindcss/oxide-linux-arm-gnueabihf@4.2.2': - resolution: {integrity: sha512-FPdhvsW6g06T9BWT0qTwiVZYE2WIFo2dY5aCSpjG/S/u1tby+wXoslXS0kl3/KXnULlLr1E3NPRRw0g7t2kgaQ==} - engines: {node: '>= 20'} - cpu: [arm] - os: [linux] - - '@tailwindcss/oxide-linux-arm64-gnu@4.2.2': - resolution: {integrity: sha512-4og1V+ftEPXGttOO7eCmW7VICmzzJWgMx+QXAJRAhjrSjumCwWqMfkDrNu1LXEQzNAwz28NCUpucgQPrR4S2yw==} - engines: {node: '>= 20'} - cpu: [arm64] - os: [linux] - libc: [glibc] - - '@tailwindcss/oxide-linux-arm64-musl@4.2.2': - resolution: {integrity: sha512-oCfG/mS+/+XRlwNjnsNLVwnMWYH7tn/kYPsNPh+JSOMlnt93mYNCKHYzylRhI51X+TbR+ufNhhKKzm6QkqX8ag==} - engines: {node: '>= 20'} - cpu: [arm64] - os: [linux] - libc: [musl] - - '@tailwindcss/oxide-linux-x64-gnu@4.2.2': - resolution: {integrity: sha512-rTAGAkDgqbXHNp/xW0iugLVmX62wOp2PoE39BTCGKjv3Iocf6AFbRP/wZT/kuCxC9QBh9Pu8XPkv/zCZB2mcMg==} - engines: {node: '>= 20'} - cpu: [x64] - os: [linux] - libc: [glibc] - - '@tailwindcss/oxide-linux-x64-musl@4.2.2': - resolution: {integrity: sha512-XW3t3qwbIwiSyRCggeO2zxe3KWaEbM0/kW9e8+0XpBgyKU4ATYzcVSMKteZJ1iukJ3HgHBjbg9P5YPRCVUxlnQ==} - engines: {node: '>= 20'} - cpu: [x64] - os: [linux] - libc: [musl] - - '@tailwindcss/oxide-wasm32-wasi@4.2.2': - resolution: {integrity: sha512-eKSztKsmEsn1O5lJ4ZAfyn41NfG7vzCg496YiGtMDV86jz1q/irhms5O0VrY6ZwTUkFy/EKG3RfWgxSI3VbZ8Q==} - engines: {node: '>=14.0.0'} - cpu: [wasm32] - bundledDependencies: - - '@napi-rs/wasm-runtime' - - '@emnapi/core' - - '@emnapi/runtime' - - '@tybys/wasm-util' - - '@emnapi/wasi-threads' - - tslib - - '@tailwindcss/oxide-win32-arm64-msvc@4.2.2': - resolution: {integrity: sha512-qPmaQM4iKu5mxpsrWZMOZRgZv1tOZpUm+zdhhQP0VhJfyGGO3aUKdbh3gDZc/dPLQwW4eSqWGrrcWNBZWUWaXQ==} - engines: {node: '>= 20'} - cpu: [arm64] - os: [win32] - - '@tailwindcss/oxide-win32-x64-msvc@4.2.2': - resolution: {integrity: sha512-1T/37VvI7WyH66b+vqHj/cLwnCxt7Qt3WFu5Q8hk65aOvlwAhs7rAp1VkulBJw/N4tMirXjVnylTR72uI0HGcA==} - engines: {node: '>= 20'} - cpu: [x64] - os: [win32] - - '@tailwindcss/oxide@4.2.2': - resolution: {integrity: sha512-qEUA07+E5kehxYp9BVMpq9E8vnJuBHfJEC0vPC5e7iL/hw7HR61aDKoVoKzrG+QKp56vhNZe4qwkRmMC0zDLvg==} - engines: {node: '>= 20'} - - '@tailwindcss/vite@4.2.2': - resolution: {integrity: sha512-mEiF5HO1QqCLXoNEfXVA1Tzo+cYsrqV7w9Juj2wdUFyW07JRenqMG225MvPwr3ZD9N1bFQj46X7r33iHxLUW0w==} - peerDependencies: - vite: ^5.2.0 || ^6 || ^7 || ^8 - '@tanstack/virtual-core@3.17.9': resolution: {integrity: sha512-M8Bzy7CCMvUjRiuoHVH9mRjyUVczRs8v8RcUEphLFGc445ZP4KQ15Y1sLqhQqJi/HgGJrxfCHnEnIX0x9mVrBg==} @@ -575,6 +462,9 @@ packages: '@tybys/wasm-util@0.10.1': resolution: {integrity: sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==} + '@types/trusted-types@2.0.7': + resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==} + '@vitejs/plugin-vue@6.0.5': resolution: {integrity: sha512-bL3AxKuQySfk1iGcBsQnoRVexTPJq0Z/ixFVM8OhVJAP6ZXXXLtM7NFKWhLl30Kg7uTBqIaPXbh+nuQCuBDedg==} engines: {node: ^20.19.0 || >=22.12.0} @@ -710,13 +600,6 @@ packages: buffer@6.0.3: resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} - class-variance-authority@0.7.1: - resolution: {integrity: sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg==} - - clsx@2.1.1: - resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==} - engines: {node: '>=6'} - color-convert@2.0.1: resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} engines: {node: '>=7.0.0'} @@ -760,10 +643,6 @@ packages: emoji-regex@9.2.2: resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} - enhanced-resolve@5.20.1: - resolution: {integrity: sha512-Qohcme7V1inbAfvjItgw0EaxVX5q2rdVEZHRBrEQdRZTssLDGsL8Lwrznl8oQ/6kuTJONLaDcGjkNP247XEhcA==} - engines: {node: '>=10.13.0'} - entities@4.5.0: resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} engines: {node: '>=0.12'} @@ -925,6 +804,15 @@ packages: linkify-it@5.0.0: resolution: {integrity: sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==} + lit-element@4.2.2: + resolution: {integrity: sha512-aFKhNToWxoyhkNDmWZwEva2SlQia+jfG0fjIWV//YeTaWrVnOxD89dPKfigCUspXFmjzOEUQpOkejH5Ly6sG0w==} + + lit-html@3.3.3: + resolution: {integrity: sha512-el8M6jK2o3RXBnrSHX3ZKrsN8zEV63pSExTO1wYJz7QndGYZ8353e2a5PPX+qHe2aGayfnchQmkAojaWAREOIA==} + + lit@3.3.3: + resolution: {integrity: sha512-fycuvZg/hkpozL00lm1pEJH5nN/lr9ZXd6mJI2HSN4+Bzc+LDNdEApJ6HFbPkdFNHLvOplIIuJvxkS4XUxqirw==} + lodash@4.18.1: resolution: {integrity: sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==} @@ -937,9 +825,6 @@ packages: peerDependencies: vue: '>=3.0.1' - lucide@1.7.0: - resolution: {integrity: sha512-aYNogbuIxea3a8offpKjdMGf2FsUk9GECFh0B4iJgXlJOX41+7/ncvLVluKki8477SoybEdyGGf+qGYLBDiEsA==} - magic-string@0.30.21: resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==} @@ -1084,16 +969,6 @@ packages: resolution: {integrity: sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==} engines: {node: '>=12'} - tailwind-merge@3.5.0: - resolution: {integrity: sha512-I8K9wewnVDkL1NTGoqWmVEIlUcB9gFriAEkXkfCjX5ib8ezGxtR3xD7iZIxrfArjEsH7F1CHD4RFUtxefdqV/A==} - - tailwindcss@4.2.2: - resolution: {integrity: sha512-KWBIxs1Xb6NoLdMVqhbhgwZf2PGBpPEiwOqgI4pFIYbNTfBXiKYyWoTsXgBQ9WFg/OlhnvHaY+AEpW7wSmFo2Q==} - - tapable@2.3.2: - resolution: {integrity: sha512-1MOpMXuhGzGL5TTCZFItxCc0AARf1EZFQkGqMm7ERKj8+Hgr5oLvJOVFcC+lRmR8hCe2S3jC4T5D7Vg/d7/fhA==} - engines: {node: '>=6'} - tar-stream@3.1.8: resolution: {integrity: sha512-U6QpVRyCGHva435KoNWy9PRoi2IFYCgtEhq9nmrPPpbRacPs9IH4aJ3gbrFC8dPcXvdSZ4XXfXT5Fshbp2MtlQ==} @@ -1114,9 +989,6 @@ packages: tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} - tw-animate-css@1.4.0: - resolution: {integrity: sha512-7bziOlRqH0hJx80h/3mbicLW7o8qLsH5+RaLR2t+OHM3D0JlWGODQKQ4cxbK7WlvmUxpcj6Kgu6EKqjrGFe3QQ==} - uc.micro@2.1.0: resolution: {integrity: sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==} @@ -1231,24 +1103,23 @@ snapshots: wrap-ansi: 8.1.0 wrap-ansi-cjs: wrap-ansi@7.0.0 - '@jridgewell/gen-mapping@0.3.13': - dependencies: - '@jridgewell/sourcemap-codec': 1.5.5 - '@jridgewell/trace-mapping': 0.3.31 - - '@jridgewell/remapping@2.3.5': - dependencies: - '@jridgewell/gen-mapping': 0.3.13 - '@jridgewell/trace-mapping': 0.3.31 - - '@jridgewell/resolve-uri@3.1.2': {} - '@jridgewell/sourcemap-codec@1.5.5': {} - '@jridgewell/trace-mapping@0.3.31': + '@lit-labs/ssr-dom-shim@1.6.0': {} + + '@lit/context@1.1.6': dependencies: - '@jridgewell/resolve-uri': 3.1.2 - '@jridgewell/sourcemap-codec': 1.5.5 + '@lit/reactive-element': 2.1.2 + + '@lit/reactive-element@2.1.2': + dependencies: + '@lit-labs/ssr-dom-shim': 1.6.0 + + '@material/web@2.5.0': + dependencies: + '@lit/context': 1.1.6 + lit: 3.3.3 + tslib: 2.8.1 '@napi-rs/wasm-runtime@1.1.2(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2)': dependencies: @@ -1430,74 +1301,6 @@ snapshots: '@rolldown/pluginutils@1.0.0-rc.2': {} - '@tailwindcss/node@4.2.2': - dependencies: - '@jridgewell/remapping': 2.3.5 - enhanced-resolve: 5.20.1 - jiti: 2.6.1 - lightningcss: 1.32.0 - magic-string: 0.30.21 - source-map-js: 1.2.1 - tailwindcss: 4.2.2 - - '@tailwindcss/oxide-android-arm64@4.2.2': - optional: true - - '@tailwindcss/oxide-darwin-arm64@4.2.2': - optional: true - - '@tailwindcss/oxide-darwin-x64@4.2.2': - optional: true - - '@tailwindcss/oxide-freebsd-x64@4.2.2': - optional: true - - '@tailwindcss/oxide-linux-arm-gnueabihf@4.2.2': - optional: true - - '@tailwindcss/oxide-linux-arm64-gnu@4.2.2': - optional: true - - '@tailwindcss/oxide-linux-arm64-musl@4.2.2': - optional: true - - '@tailwindcss/oxide-linux-x64-gnu@4.2.2': - optional: true - - '@tailwindcss/oxide-linux-x64-musl@4.2.2': - optional: true - - '@tailwindcss/oxide-wasm32-wasi@4.2.2': - optional: true - - '@tailwindcss/oxide-win32-arm64-msvc@4.2.2': - optional: true - - '@tailwindcss/oxide-win32-x64-msvc@4.2.2': - optional: true - - '@tailwindcss/oxide@4.2.2': - optionalDependencies: - '@tailwindcss/oxide-android-arm64': 4.2.2 - '@tailwindcss/oxide-darwin-arm64': 4.2.2 - '@tailwindcss/oxide-darwin-x64': 4.2.2 - '@tailwindcss/oxide-freebsd-x64': 4.2.2 - '@tailwindcss/oxide-linux-arm-gnueabihf': 4.2.2 - '@tailwindcss/oxide-linux-arm64-gnu': 4.2.2 - '@tailwindcss/oxide-linux-arm64-musl': 4.2.2 - '@tailwindcss/oxide-linux-x64-gnu': 4.2.2 - '@tailwindcss/oxide-linux-x64-musl': 4.2.2 - '@tailwindcss/oxide-wasm32-wasi': 4.2.2 - '@tailwindcss/oxide-win32-arm64-msvc': 4.2.2 - '@tailwindcss/oxide-win32-x64-msvc': 4.2.2 - - '@tailwindcss/vite@4.2.2(vite@8.0.3(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2)(jiti@2.6.1))': - dependencies: - '@tailwindcss/node': 4.2.2 - '@tailwindcss/oxide': 4.2.2 - tailwindcss: 4.2.2 - vite: 8.0.3(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2)(jiti@2.6.1) - '@tanstack/virtual-core@3.17.9': {} '@tanstack/vue-virtual@3.13.37(vue@3.5.32)': @@ -1510,6 +1313,8 @@ snapshots: tslib: 2.8.1 optional: true + '@types/trusted-types@2.0.7': {} + '@vitejs/plugin-vue@6.0.5(vite@8.0.3(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2)(jiti@2.6.1))(vue@3.5.32)': dependencies: '@rolldown/pluginutils': 1.0.0-rc.2 @@ -1661,12 +1466,6 @@ snapshots: base64-js: 1.5.1 ieee754: 1.2.1 - class-variance-authority@0.7.1: - dependencies: - clsx: 2.1.1 - - clsx@2.1.1: {} - color-convert@2.0.1: dependencies: color-name: 1.1.4 @@ -1706,11 +1505,6 @@ snapshots: emoji-regex@9.2.2: {} - enhanced-resolve@5.20.1: - dependencies: - graceful-fs: 4.2.11 - tapable: 2.3.2 - entities@4.5.0: {} entities@7.0.1: {} @@ -1770,7 +1564,8 @@ snapshots: optionalDependencies: '@pkgjs/parseargs': 0.11.0 - jiti@2.6.1: {} + jiti@2.6.1: + optional: true kernelsu@3.0.2: {} @@ -1831,6 +1626,22 @@ snapshots: dependencies: uc.micro: 2.1.0 + lit-element@4.2.2: + dependencies: + '@lit-labs/ssr-dom-shim': 1.6.0 + '@lit/reactive-element': 2.1.2 + lit-html: 3.3.3 + + lit-html@3.3.3: + dependencies: + '@types/trusted-types': 2.0.7 + + lit@3.3.3: + dependencies: + '@lit/reactive-element': 2.1.2 + lit-element: 4.2.2 + lit-html: 3.3.3 + lodash@4.18.1: {} lru-cache@10.4.3: {} @@ -1839,8 +1650,6 @@ snapshots: dependencies: vue: 3.5.32 - lucide@1.7.0: {} - magic-string@0.30.21: dependencies: '@jridgewell/sourcemap-codec': 1.5.5 @@ -2040,12 +1849,6 @@ snapshots: dependencies: ansi-regex: 6.2.2 - tailwind-merge@3.5.0: {} - - tailwindcss@4.2.2: {} - - tapable@2.3.2: {} - tar-stream@3.1.8: dependencies: b4a: 1.8.0 @@ -2077,10 +1880,7 @@ snapshots: tinypool@2.1.0: {} - tslib@2.8.1: - optional: true - - tw-animate-css@1.4.0: {} + tslib@2.8.1: {} uc.micro@2.1.0: {} diff --git a/webui/components.json b/webui/components.json deleted file mode 100644 index fbaeef5..0000000 --- a/webui/components.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "$schema": "https://shadcn-vue.com/schema.json", - "style": "default", - "typescript": false, - "tailwind": { - "config": "", - "css": "src/index.css", - "baseColor": "slate", - "cssVariables": true, - "prefix": "" - }, - "aliases": { - "components": "@/components", - "utils": "@/lib/utils", - "ui": "@/components/ui", - "lib": "@/lib", - "composables": "@/composables" - }, - "registries": [] -} diff --git a/webui/src/App.vue b/webui/src/App.vue index 48b9184..aa58506 100644 --- a/webui/src/App.vue +++ b/webui/src/App.vue @@ -1,12 +1,17 @@ diff --git a/webui/src/about.css b/webui/src/about.css deleted file mode 100644 index bae008a..0000000 --- a/webui/src/about.css +++ /dev/null @@ -1,330 +0,0 @@ -/* ========================================== - About View Styles - ========================================== */ -.about-hero { - display: flex; - flex-direction: column; - align-items: center; - padding: var(--spacing-l) 0 var(--spacing-m); - gap: 8px; -} -.about-logo { - width: 72px; - height: 72px; - border-radius: 20px; - background: linear-gradient( - 135deg, - var(--md-sys-color-primary-container), - var(--md-sys-color-secondary-container) - ); - display: flex; - align-items: center; - justify-content: center; - color: var(--md-sys-color-primary); - margin-bottom: 4px; -} -.about-name { - margin: 0; - font-size: 1.5rem; - font-weight: 700; - color: var(--md-sys-color-on-surface); -} -.about-desc { - margin: 0; - font-size: 0.875rem; - color: var(--md-sys-color-on-surface-variant); -} -.about-version-badge { - display: inline-block; - padding: 2px 10px; - background-color: var(--md-sys-color-primary-container); - color: var(--md-sys-color-on-primary-container); - border-radius: 100px; - font-size: 0.75rem; - font-weight: 600; - letter-spacing: 0.3px; -} -.about-section-title { - font-size: 0.75rem; - font-weight: 600; - color: var(--md-sys-color-primary); - text-transform: uppercase; - letter-spacing: 1px; - margin: var(--spacing-l) 0 var(--spacing-s); -} -.about-list { - display: flex; - flex-direction: column; - gap: 2px; - background-color: var(--md-sys-color-surface-container); - border-radius: var(--border-radius-m); - overflow: hidden; -} -.about-list-item { - display: flex; - align-items: center; - gap: 12px; - padding: 14px 16px; - background: transparent; - border: none; - color: var(--md-sys-color-on-surface); - font-size: 0.9375rem; - font-family: inherit; - cursor: pointer; - text-decoration: none; - transition: background-color 0.15s; - text-align: left; - width: 100%; -} -.about-list-item + .about-list-item { - border-top: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0, 0, 0), 0.06); -} -.about-list-item:active { - background-color: var(--md-sys-color-surface-container-high); -} -.about-list-icon { - color: var(--md-sys-color-primary); - flex-shrink: 0; -} -.about-list-chevron { - margin-left: auto; - color: var(--md-sys-color-on-surface-variant); - opacity: 0.5; - flex-shrink: 0; -} -.about-footer { - text-align: center; - color: var(--md-sys-color-on-surface-variant); - font-size: 0.8125rem; - margin-top: var(--spacing-l); - padding-top: var(--spacing-m); - border-top: 1px solid rgba(var(--md-sys-color-outline-variant-rgb, 142, 144, 153), 0.15); -} - -/* ========================================== - Doc Sheet (Bottom drawer) - ========================================== */ -.doc-sheet-backdrop { - position: fixed; - inset: 0; - background: rgba(0, 0, 0, 0.5); - backdrop-filter: blur(4px); - z-index: 1999; - opacity: 0; - pointer-events: none; - transition: opacity 0.3s ease; -} -.doc-sheet-backdrop.show { - opacity: 1; - pointer-events: auto; -} -.doc-sheet { - position: fixed; - left: 0; - right: 0; - bottom: 0; - max-height: 90vh; - background-color: var(--md-sys-color-surface-container-high); - border-radius: 28px 28px 0 0; - z-index: 2000; - display: flex; - flex-direction: column; - transform: translateY(100%); - transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1); - box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3); - overflow: hidden; -} -.doc-sheet.show { - transform: translateY(0); -} -.doc-sheet-header { - display: flex; - align-items: center; - padding: 16px 16px 12px; - border-bottom: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0, 0, 0), 0.07); - gap: 12px; - flex-shrink: 0; -} -.doc-sheet-title { - font-size: 1.0625rem; - font-weight: 600; - color: var(--md-sys-color-on-surface); - flex: 1; -} -.doc-sheet-close { - display: flex; - align-items: center; - justify-content: center; - width: 32px; - height: 32px; - border-radius: 50%; - border: none; - background: transparent; - color: var(--md-sys-color-on-surface-variant); - cursor: pointer; - transition: background-color 0.15s; -} -.doc-sheet-close:active { - background-color: var(--md-sys-color-surface-container); -} -.doc-sheet-body { - flex: 1; - overflow-y: auto; - padding: 20px 20px 48px; - scrollbar-width: none; -} -.doc-sheet-body::-webkit-scrollbar { - display: none; -} -.doc-sheet-loading { - text-align: center; - padding: 48px 20px; - color: var(--md-sys-color-on-surface-variant); -} -.doc-sheet-content { - font-size: 0.9rem; - line-height: 1.75; - color: var(--md-sys-color-on-surface); - word-break: break-word; -} -.doc-sheet-content h1, -.doc-sheet-content h2 { - color: var(--md-sys-color-primary); - margin-top: 1.4em; - margin-bottom: 0.4em; -} -.doc-sheet-content h3, -.doc-sheet-content h4 { - color: var(--md-sys-color-on-primary-container); - margin-top: 1.2em; - margin-bottom: 0.3em; -} -.doc-sheet-content p { - margin: 0.6em 0; -} -.doc-sheet-content a { - color: var(--md-sys-color-primary); - text-decoration: underline; - word-break: break-all; -} -.doc-sheet-content ul, -.doc-sheet-content ol { - padding-left: 1.4em; - margin: 0.5em 0; -} -.doc-sheet-content li { - margin: 0.25em 0; -} -.doc-sheet-content code { - background-color: var(--md-sys-color-surface-container); - padding: 2px 6px; - border-radius: 4px; - font-family: 'Geist Mono', monospace; - font-size: 0.85em; -} -.doc-sheet-content pre { - background-color: var(--md-sys-color-surface-container); - border-radius: 8px; - padding: 12px 14px; - overflow-x: auto; - margin: 0.75em 0; -} -.doc-sheet-content pre code { - background: none; - padding: 0; - border-radius: 0; - font-size: 0.82em; - line-height: 1.6; -} -.doc-sheet-content blockquote { - border-left: 3px solid var(--md-sys-color-primary-container); - margin: 0.75em 0; - padding: 0.2em 0.75em; - color: var(--md-sys-color-on-surface-variant); - background-color: rgba(var(--md-sys-color-primary-rgb), 0.06); - border-radius: 0 4px 4px 0; -} -.doc-sheet-content hr { - border: none; - border-top: 1px solid var(--md-sys-color-outline-variant); - margin: 1.2em 0; -} -.doc-sheet-content table { - border-collapse: collapse; - width: 100%; - margin: 0.75em 0; - font-size: 0.85em; -} -.doc-sheet-content th, -.doc-sheet-content td { - border: 1px solid var(--md-sys-color-outline-variant); - padding: 6px 10px; - text-align: left; -} -.doc-sheet-content th { - background-color: var(--md-sys-color-surface-container); - font-weight: 600; -} - -/* ========================================== - Log Filter Tabs - ========================================== */ -.log-filter-container { - display: flex; - align-items: center; - gap: var(--spacing-s); -} -.log-filter-tabs { - display: flex; - gap: 4px; - background-color: var(--md-sys-color-surface-container); - padding: 4px; - border-radius: var(--border-radius-s); -} -.log-filter-tab { - padding: 4px 12px; - border-radius: calc(var(--border-radius-s) - 2px); - border: none; - background: transparent; - color: var(--md-sys-color-on-surface-variant); - font-size: 0.8125rem; - font-weight: 500; - font-family: inherit; - cursor: pointer; - transition: all 0.2s; -} -.log-filter-tab.active { - background-color: var(--md-sys-color-surface-container-high); - color: var(--md-sys-color-primary); - font-weight: 600; -} - -/* ========================================== - Theme Segmented Button - ========================================== */ -.theme-seg { - display: flex; - gap: 2px; - background-color: var(--md-sys-color-surface-container); - padding: 3px; - border-radius: var(--border-radius-s); - flex-shrink: 0; -} -.theme-seg-btn { - padding: 4px 12px; - border-radius: calc(var(--border-radius-s) - 2px); - border: none; - background: transparent; - color: var(--md-sys-color-on-surface-variant); - font-size: 0.8125rem; - font-weight: 500; - font-family: inherit; - cursor: pointer; - transition: all 0.18s ease; - white-space: nowrap; -} -.theme-seg-btn.active { - background-color: var(--md-sys-color-primary-container); - color: var(--md-sys-color-on-primary-container); - font-weight: 600; -} diff --git a/webui/src/api/devMock.js b/webui/src/api/devMock.js new file mode 100644 index 0000000..8b9c504 --- /dev/null +++ b/webui/src/api/devMock.js @@ -0,0 +1,80 @@ +/** + * 开发环境(浏览器直开、无 KernelSU bridge)下返回模拟数据, + * 便于在电脑上调试界面。真机永远不会走到这里。 + */ + +const mockStatus = (display) => ({ + module: { id: 'LuminPro', name: 'LuminPro', version: 'V2.5.0-beta.2', versionCode: 2050052, channel: 'beta' }, + daemon: { pid: 12345, running: true, state: 'S', mode: 'event', paused: false, uptimeSec: 3620 }, + brightness: { current: 1200, max: 4095, percent: 29, node: '/sys/mock/brightness', maxNode: '/sys/mock/max_brightness' }, + display: display + ? { hdrRatio: 1.02, hdrKnown: true, hdrStale: false, hdrSleep: false, autoBrightness: false } + : undefined, + sleep: { window: '2300-0700', active: false }, + oplock: { locked: false, seconds: 0 }, + config: { + uiMaxBri: 1000, + maxBri: 3500, + stepsNum: 50, + sleepTime: '2300-0700', + autoBriSleep: 1, + displayHdrSleep: 0, + hdrEnterRatio: 1.15, + hdrExitRatio: 1.05, + compatibilityMode: 0, + logLevel: 'info', + logMaxSize: 512, + debugMode: 0, + nowBriFile: '/sys/class/backlight/panel0-backlight/brightness', + maxBriFile: '/sys/class/backlight/panel0-backlight/max_brightness', + blacklistCount: 3, + }, + log: { path: '/data/adb/modules/LuminPro/service.log', sizeKB: 12 }, +}) + +const mockConfig = () => ({ + ui_max_bri: 1000, + max_bri: 3500, + steps_num: 50, + log_max_size: 512, + auto_bri_sleep: 1, + display_hdr_sleep: 0, + hdr_enter_ratio: 1.15, + hdr_exit_ratio: 1.05, + compatibility_mode: 0, + sleep_time: '2300-0700', + inotify_events: 'c', + now_bri_file: '/sys/mock/brightness', + max_bri_file: '/sys/mock/max_brightness', + log_level: 'info', + debug_mode: 0, + blacklist_apps: ['com.example.video'], +}) + +const mockLogEntries = [ + { time: '09-10 12:00:01', tag: 'luminpro', level: 'INFO', message: '守护进程已启动' }, + { time: '09-10 12:00:03', tag: 'luminpro', level: 'INFO', message: '正在监听: /sys/mock/brightness, 事件: c' }, + { time: '09-10 12:01:12', tag: 'luminpro', level: 'INFO', message: '触发提升: 当前亮度 1200 ≥ 阈值 1000,目标 3500' }, + { time: '09-10 12:01:12', tag: 'luminpro', level: 'WARN', message: 'HDR 比率读取为空,使用缓存值: 1.02' }, + { time: '09-10 12:01:13', tag: 'luminpro', level: 'SUCCESS', message: '亮度提升完成 (3500)' }, +] + +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')) { + 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')) { + return { ok: true, errno: 0, stdout: 'LuminPro: 服务已启用', stderr: '' } + } + return null +} diff --git a/webui/src/api/ksu.js b/webui/src/api/ksu.js new file mode 100644 index 0000000..8f4500c --- /dev/null +++ b/webui/src/api/ksu.js @@ -0,0 +1,51 @@ +import { exec, moduleInfo } from 'kernelsu' +import { devMock } from './devMock.js' + +export const MODULE_DIR = '/data/adb/modules/LuminPro' +export const BIN = `${MODULE_DIR}/bin/luminpro` + +/** 是否为 KernelSU 环境(exec 可用) */ +let available = true + +export function isKsuAvailable() { + return available +} + +/** + * 执行 shell 命令。所有命令都是固定字符串或经 shellQuote 处理过的参数, + * 不把未校验的用户输入直接拼进命令。 + */ +export async function runCmd(command) { + try { + const res = await exec(command) + available = true + return { + ok: res.errno === 0, + errno: res.errno, + stdout: res.stdout ?? '', + stderr: res.stderr ?? '', + } + } catch (err) { + available = false + // 仅开发环境回退到模拟数据,真机上失败就是失败 + if (import.meta.env.DEV) { + const mocked = devMock(command) + if (mocked) return mocked + } + return { ok: false, errno: -1, stdout: '', stderr: String(err) } + } +} + +/** 把任意字符串安全地包成 shell 单引号参数 */ +export function shellQuote(value) { + return `'${String(value).replace(/'/g, "'\\''")}'` +} + +/** 读取模块版本(module.prop 的 version) */ +export function moduleVersion() { + try { + return JSON.parse(moduleInfo()).version || '' + } catch { + return import.meta.env.DEV ? 'V2.5.0-dev.0' : '' + } +} diff --git a/webui/src/api/luminpro.js b/webui/src/api/luminpro.js new file mode 100644 index 0000000..c945bda --- /dev/null +++ b/webui/src/api/luminpro.js @@ -0,0 +1,85 @@ +/** + * Go 侧 JSON API 客户端。所有读写都经由 `luminpro` 子命令: + * 一次调用拿回结构化数据,避免前端拼多条 shell 命令与字符串转义。 + */ +import { BIN, MODULE_DIR, runCmd, shellQuote } from './ksu.js' + +/** 调用返回 JSON 的子命令 */ +async function callJSON(subcommand, args = []) { + const command = [BIN, subcommand, ...args.map(shellQuote)].join(' ') + const res = await runCmd(command) + if (!res.ok) { + throw new Error(res.stderr.trim() || `命令执行失败: luminpro ${subcommand}`) + } + try { + return JSON.parse(res.stdout) + } catch { + throw new Error(`输出不是合法 JSON: luminpro ${subcommand}`) + } +} + +/** 聚合状态;display=false 时跳过 dumpsys/settings 读取 */ +export function fetchStatus({ display = true } = {}) { + return callJSON('status', display ? [] : ['--no-display']) +} + +/** 操作锁状态(轻量,供高频轮询) */ +export function fetchOplock() { + return callJSON('oplock') +} + +/** 当前前台 Activity(活动抓取向导用) */ +export function fetchFocus() { + return callJSON('focus') +} + +/** 设置亮度 */ +export function setBrightness(value) { + return callJSON('brightness', ['set', String(value)]) +} + +/** 读取完整配置 */ +export function fetchConfig() { + return callJSON('config', ['read']) +} + +/** 浅合并写入配置(只传变化字段) */ +export function patchConfig(patch) { + return callJSON('config', ['patch', JSON.stringify(patch)]) +} + +/** 读取日志 */ +export function fetchLog(lines = 200) { + return callJSON('log', ['tail', '-n', String(lines)]) +} + +/** 清空日志 */ +export function clearLog() { + return callJSON('log', ['clear']) +} + +/** 导出日志到 /sdcard */ +export function exportLog(dir = '/sdcard') { + return callJSON('log', ['export', dir]) +} + +/** 一键提升 / 恢复 */ +export function boost() { + return runCmd(`${BIN} boost`) +} + +/** 重启模块 */ +export function restart() { + return runCmd(`${BIN} restart`) +} + +/** 启停切换(沿用 action.sh,管理器「操作」按钮与之共用同一实现) */ +export function toggleService() { + return runCmd(`sh ${MODULE_DIR}/action.sh`) +} + +/** 模块文档内容(关于页) */ +export async function readModuleFile(name) { + const res = await runCmd(`cat ${shellQuote(`${MODULE_DIR}/${name}`)} 2>/dev/null`) + return res.ok ? res.stdout : '' +} diff --git a/webui/src/apps.css b/webui/src/apps.css deleted file mode 100644 index be2b7e3..0000000 --- a/webui/src/apps.css +++ /dev/null @@ -1,562 +0,0 @@ -.app-list-hint { - font-size: 0.8125rem; - color: var(--md-sys-color-on-surface-variant); - margin-top: 0; - margin-bottom: var(--spacing-m); -} - -/* App Search */ -.app-search-container { - display: flex; - align-items: center; - background-color: var(--md-sys-color-surface-container-high); - border: 1px solid var(--md-sys-color-outline-variant); - border-radius: var(--border-radius-m); - padding: 8px 12px; - margin-bottom: var(--spacing-m); - transition: - border-color 0.2s, - box-shadow 0.2s; -} - -.app-search-container:focus-within { - border-color: var(--md-sys-color-primary); - box-shadow: 0 0 0 2px rgba(168, 199, 250, 0.3); -} - -.search-icon { - width: 18px; - height: 18px; - color: var(--md-sys-color-on-surface-variant); - margin-right: 8px; -} - -.app-search-input { - flex: 1; - width: 100%; - min-width: 0; - background: transparent; - border: none; - color: var(--md-sys-color-on-surface); - font-size: 0.875rem; - outline: none; - font-family: inherit; -} - -.app-search-input::placeholder { - color: var(--md-sys-color-on-surface-variant); -} - -.count-badge { - background-color: var(--md-sys-color-primary-container); - color: var(--md-sys-color-on-primary-container); - font-size: 0.75rem; - font-weight: 600; - padding: 2px 8px; - border-radius: 20px; - margin-left: 8px; - white-space: nowrap; - opacity: 0.85; -} - -/* App List */ -.app-list-container { - max-height: 60vh; - overflow-y: auto; - border-radius: var(--border-radius-m); - padding: 0; -} - -.app-list-container::-webkit-scrollbar { - display: none; -} - -/* 虚拟滚动:spacer 撑起总高度,行绝对定位; - 行间距由 item 的 padding-bottom 提供,保证测量行高包含间距 */ -.app-virtual-spacer { - position: relative; - width: 100%; -} - -.app-virtual-item { - position: absolute; - top: 0; - left: 0; - width: 100%; - padding-bottom: var(--spacing-s); -} - -.app-list-item { - display: flex; - flex-direction: column; - background-color: var(--md-sys-color-surface-container-high); - border-radius: var(--border-radius-s); - transition: background-color 0.2s; - overflow: hidden; - flex-shrink: 0; -} - -.app-item-main-row { - display: flex; - align-items: center; - gap: var(--spacing-m); - padding: var(--spacing-s) var(--spacing-m); -} - -.app-item-main-row:active { - background-color: var(--md-sys-color-surface-container); -} - -.app-checkbox-label { - display: flex; - align-items: center; - cursor: pointer; - position: relative; -} - -.app-checkbox { - opacity: 0; - position: absolute; - width: 0; - height: 0; -} - -.app-checkbox-custom { - width: 20px; - height: 20px; - border: 2px solid var(--md-sys-color-outline); - border-radius: 4px; - display: flex; - align-items: center; - justify-content: center; - transition: all 0.2s; -} - -.app-checkbox:checked + .app-checkbox-custom { - background-color: var(--md-sys-color-primary); - border-color: var(--md-sys-color-primary); -} - -.app-checkbox.unsaved:checked + .app-checkbox-custom { - background-color: #4caf50; - border-color: #4caf50; -} - -.app-checkbox:checked + .app-checkbox-custom::after { - content: ''; - width: 5px; - height: 10px; - border: solid var(--md-sys-color-on-primary); - border-width: 0 2px 2px 0; - transform: rotate(45deg); - margin-bottom: 2px; -} - -.app-info { - display: flex; - flex-direction: column; - flex: 1; - overflow: hidden; -} - -.app-name { - font-size: 1rem; - font-weight: 500; - color: var(--md-sys-color-on-surface); - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.app-pkg { - font-size: 0.8125rem; - color: var(--md-sys-color-on-surface-variant); - font-family: 'Geist Mono', monospace; - display: flex; - flex-wrap: wrap; - align-items: center; - gap: 6px; - word-break: break-all; - line-height: 1.4; -} - -.app-badge { - background-color: var(--md-sys-color-primary-container); - color: var(--md-sys-color-on-primary-container); - padding: 0 4px; - border-radius: 4px; - font-size: 0.65rem; - font-weight: bold; -} - -.app-icon { - width: 40px; - height: 40px; - border-radius: 8px; - object-fit: cover; - flex-shrink: 0; - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); -} - -.app-icon-fallback { - width: 40px; - height: 40px; - border-radius: 8px; - background: linear-gradient( - 135deg, - var(--md-sys-color-primary-container), - rgba(168, 199, 250, 0.5) - ); - color: var(--md-sys-color-on-primary-container); - display: flex; - align-items: center; - justify-content: center; - font-size: 1.25rem; - font-weight: bold; - flex-shrink: 0; - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); -} - -.app-uid { - font-size: 0.65rem; - color: var(--md-sys-color-on-surface-variant); - background-color: var(--md-sys-color-surface-container-high); - border: 1px solid var(--md-sys-color-outline-variant); - padding: 0 4px; - border-radius: 4px; - font-family: 'Geist Mono', monospace; - margin-left: 6px; - vertical-align: middle; -} - -/* 部分选中状态(有活动条目但包未完全选中)*/ -.app-checkbox-custom.partial { - background-color: var(--md-sys-color-primary-container); - border-color: var(--md-sys-color-primary); -} - -.app-checkbox-custom.partial::after { - content: ''; - display: block; - width: 8px; - height: 8px; - background-color: var(--md-sys-color-primary); - border-radius: 1px; -} - -/* 活动列表展开箭头 */ -.app-activities-chevron { - flex-shrink: 0; - display: flex; - align-items: center; - justify-content: center; - width: 28px; - height: 28px; - background: none; - border: none; - border-radius: var(--border-radius-s); - color: var(--md-sys-color-on-surface-variant); - cursor: pointer; - transition: - transform 0.2s, - background-color 0.2s; - padding: 0; -} - -.app-activities-chevron:hover { - background-color: var(--md-sys-color-surface-container); -} - -.app-activities-chevron.expanded { - transform: rotate(180deg); -} - -/* 活动列表容器 */ -.app-activities-list { - display: none; - flex-direction: column; - padding: 0 var(--spacing-m) var(--spacing-s); - border-top: 1px solid var(--md-sys-color-outline-variant); - gap: 2px; -} - -.app-activities-list.show { - display: flex; -} - -/* 单条活动条目 */ -.activity-entry-item { - display: flex; - align-items: center; - gap: 8px; - padding: 5px 4px; - border-radius: var(--border-radius-s); -} - -.activity-entry-path { - flex: 1; - font-family: 'Geist Mono', 'Roboto Mono', monospace; - font-size: 0.75rem; - color: var(--md-sys-color-on-surface-variant); - word-break: break-all; - line-height: 1.4; -} - -.activity-entry-delete { - flex-shrink: 0; - display: flex; - align-items: center; - justify-content: center; - width: 24px; - height: 24px; - background: none; - border: none; - border-radius: 50%; - color: var(--md-sys-color-error); - cursor: pointer; - padding: 0; - transition: background-color 0.2s; -} - -.activity-entry-delete:hover { - background-color: var(--md-sys-color-error-container); -} - -/* 按活动屏蔽输入卡片 */ -.activity-block-card { - background-color: var(--md-sys-color-surface-container-high); - border-radius: var(--border-radius-m); - padding: var(--spacing-s) var(--spacing-m); - margin-bottom: var(--spacing-m); - display: flex; - flex-direction: column; - gap: 8px; -} - -.activity-block-header { - display: flex; - align-items: center; - justify-content: space-between; -} - -.activity-block-label { - font-size: 0.8125rem; - font-weight: 500; - color: var(--md-sys-color-on-surface); -} - -.btn-picker-trigger { - display: flex; - align-items: center; - gap: 4px; - background: none; - border: 1px solid var(--md-sys-color-outline-variant); - border-radius: var(--border-radius-s); - color: var(--md-sys-color-primary); - font-size: 0.75rem; - font-weight: 500; - padding: 3px 8px; - cursor: pointer; - transition: - background-color 0.2s, - border-color 0.2s; - white-space: nowrap; - font-family: inherit; -} - -.btn-picker-trigger:hover { - background-color: var(--md-sys-color-primary-container); - border-color: var(--md-sys-color-primary); -} - -.activity-block-row { - display: flex; - gap: 8px; - align-items: stretch; -} - -.activity-block-input { - flex: 1; - background: var(--md-sys-color-surface-container); - border: 1px solid var(--md-sys-color-outline-variant); - border-radius: var(--border-radius-s); - padding: 7px 10px; - font-family: 'Geist Mono', 'Roboto Mono', monospace; - font-size: 0.8125rem; - color: var(--md-sys-color-on-surface); - outline: none; - transition: - border-color 0.2s, - box-shadow 0.2s; -} - -.activity-block-input:focus { - border-color: var(--md-sys-color-primary); - box-shadow: 0 0 0 2px rgba(168, 199, 250, 0.3); -} - -/* ======================== - 获取活动名向导覆盖层 - ======================== */ -.activity-picker-overlay { - position: fixed; - inset: 0; - background: var(--md-sys-color-background); - z-index: 950; - display: flex; - flex-direction: column; - transform: translateX(100%); - transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1); -} - -.activity-picker-overlay.show { - transform: translateX(0); -} - -.activity-picker-header { - display: flex; - align-items: center; - gap: 12px; - padding: calc(var(--safe-area-inset-top, 0px) + 16px) 16px 12px; - border-bottom: 1px solid var(--md-sys-color-outline-variant); - flex-shrink: 0; -} - -.picker-back-btn { - display: flex; - align-items: center; - justify-content: center; - width: 36px; - height: 36px; - background: none; - border: none; - border-radius: 50%; - color: var(--md-sys-color-on-surface); - cursor: pointer; - transition: background-color 0.2s; - flex-shrink: 0; -} - -.picker-back-btn:hover { - background-color: var(--md-sys-color-surface-container); -} - -.picker-title { - font-size: 1.0625rem; - font-weight: 600; - color: var(--md-sys-color-on-surface); -} - -.picker-steps-indicator { - display: flex; - justify-content: center; - align-items: center; - gap: 8px; - padding: 16px 0 0; - flex-shrink: 0; -} - -.picker-step-dot { - width: 6px; - height: 6px; - border-radius: 50%; - background-color: var(--md-sys-color-outline-variant); - transition: - background-color 0.3s, - transform 0.3s, - width 0.3s; -} - -.picker-step-dot.active { - background-color: var(--md-sys-color-primary); - transform: scale(1.2); - width: 18px; - border-radius: 4px; -} - -.activity-picker-body { - flex: 1; - overflow-y: auto; - display: flex; - flex-direction: column; -} - -.picker-step { - flex: 1; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - padding: 32px 32px calc(var(--safe-area-inset-bottom, 0px) + 48px); - text-align: center; - gap: 14px; -} - -.picker-step-icon { - color: var(--md-sys-color-primary); - opacity: 0.9; - margin-bottom: 4px; -} - -.picker-step-title { - font-size: 1.25rem; - font-weight: 600; - color: var(--md-sys-color-on-background); - margin: 0; -} - -.picker-step-desc { - font-size: 0.9375rem; - color: var(--md-sys-color-on-surface-variant); - line-height: 1.65; - max-width: 300px; - margin: 0; -} - -.picker-action-btn { - margin-top: 12px; - padding: 12px 32px; - border-radius: 24px; - font-size: 0.9375rem; -} - -.picker-status-text { - display: inline-block; - font-weight: 500; - color: var(--md-sys-color-primary); -} - -.picker-status-text.polling { - animation: picker-pulse 1.2s ease-in-out infinite; -} - -@keyframes picker-pulse { - 0%, - 100% { - opacity: 1; - } - 50% { - opacity: 0.35; - } -} - -.picker-result-box { - background: var(--md-sys-color-surface-container-high); - border: 1.5px solid var(--md-sys-color-primary); - border-radius: var(--border-radius-m); - padding: 14px 18px; - font-family: 'Geist Mono', 'Roboto Mono', monospace; - font-size: 0.875rem; - color: var(--md-sys-color-on-surface); - word-break: break-all; - line-height: 1.55; - max-width: 320px; - width: 100%; - text-align: left; -} - -.picker-result-actions { - display: flex; - gap: 12px; - margin-top: 4px; -} diff --git a/webui/src/apps.js b/webui/src/apps.js deleted file mode 100644 index 5903129..0000000 --- a/webui/src/apps.js +++ /dev/null @@ -1,734 +0,0 @@ -// oxlint-disable no-unused-expressions -import { listPackages, getPackagesInfo } from 'kernelsu' -import { createIcons, Eye, EyeOff } from 'lucide' -import PinyinMatch from 'pinyin-match' -import { showToast, runCmd, readConfig, updateConfig } from './utils.js' - -let showingSystemApps = true -let savedBlacklist = new Set() -let activityEntries = new Set() // 活动级黑名单条目(格式:pkg/ActivityClass) - -export function updateUnsavedStyling() { - const items = document.querySelectorAll('.app-list-item') - items.forEach((item) => { - const cb = item.querySelector('.app-checkbox') - const custom = item.querySelector('.app-checkbox-custom') - if (!cb || !custom) return - const pkg = cb.dataset.pkg - const hasActivities = pkg && [...activityEntries].some((e) => e.startsWith(pkg + '/')) - // 部分选中:有活动条目但包名未完全选中 - if (!cb.checked && hasActivities) { - custom.classList.add('partial') - } else { - custom.classList.remove('partial') - } - // 未保存高亮 - if (cb.checked && !savedBlacklist.has(pkg)) { - cb.classList.add('unsaved') - } else { - cb.classList.remove('unsaved') - } - // 箭头可见性 - const chevron = item.querySelector('.app-activities-chevron') - if (chevron) { - chevron.style.display = hasActivities ? '' : 'none' - if (!hasActivities) { - const actList = item.querySelector('.app-activities-list') - if (actList) { - actList.classList.remove('show') - chevron.classList.remove('expanded') - } - } - } - }) -} - -export function reorderDOMApps() { - const container = document.getElementById('app-list-container') - if (!container) return - const items = Array.from(container.children) - const getState = (item) => { - const cb = item.querySelector('.app-checkbox') - if (cb?.checked) return 2 // 完全选中 - const pkg = cb?.dataset.pkg - if (pkg && [...activityEntries].some((e) => e.startsWith(pkg + '/'))) return 1 // 部分选中 - return 0 - } - items.sort((a, b) => getState(b) - getState(a)) - items.forEach((item) => container.appendChild(item)) -} - -export function renderActivityList(pkg, container) { - const entries = [...activityEntries].filter((e) => e.startsWith(pkg + '/')) - container.innerHTML = '' - entries.forEach((entry) => { - const entryDiv = document.createElement('div') - entryDiv.className = 'activity-entry-item' - const actPath = document.createElement('span') - actPath.className = 'activity-entry-path' - actPath.textContent = entry.slice(pkg.length + 1) - const delBtn = document.createElement('button') - delBtn.className = 'activity-entry-delete' - delBtn.innerHTML = - '' - delBtn.addEventListener('click', (e) => { - e.stopPropagation() - activityEntries.delete(entry) - renderActivityList(pkg, container) - const actItem = container.closest('.app-list-item') - if (actItem) { - const chevron = actItem.querySelector('.app-activities-chevron') - const remaining = [...activityEntries].filter((e) => e.startsWith(pkg + '/')) - if (chevron) chevron.style.display = remaining.length > 0 ? '' : 'none' - if (remaining.length === 0) { - container.classList.remove('show') - if (chevron) chevron.classList.remove('expanded') - } - } - updateUnsavedStyling() - reorderDOMApps() - }) - entryDiv.appendChild(actPath) - entryDiv.appendChild(delBtn) - container.appendChild(entryDiv) - }) -} - -export async function loadApps() { - const container = document.getElementById('app-list-container') - if (!container) return - container.innerHTML = - '
加载中...
' - - try { - // 读取已保存的黑名单(从 JSON 配置读取) - const cfg = await readConfig() - const allSaved = Array.isArray(cfg.blacklist_apps) ? cfg.blacklist_apps : [] - savedBlacklist = new Set(allSaved) - const savedPkgEntries = new Set(allSaved.filter((e) => !e.includes('/'))) - activityEntries = new Set(allSaved.filter((e) => e.includes('/'))) - - let infoList = [] - try { - const pkgs = await listPackages() - if (pkgs && pkgs.length > 0) { - infoList = await getPackagesInfo(pkgs) - } else { - throw new Error('No packages found') - } - } catch { - // 模拟 150 个应用包数据用于调试 - console.log('[DEBUG] 使用模拟应用列表数据') - infoList = Array.from({ length: 150 }, (_, i) => ({ - packageName: `com.mock.app${i}`, - appLabel: i % 10 === 0 ? `测试应用 ${i} (含抖音关键字)` : `模拟应用 ${i}`, - isSystem: i % 5 === 0, - uid: 10000 + i, - })) - } - - // 过滤系统应用 - if (!showingSystemApps) { - infoList = infoList.filter((app) => !app.isSystem) - } - - container.innerHTML = '' - - // 排序:非系统优先,按名称 - infoList.sort((a, b) => { - if (a.isSystem !== b.isSystem) return a.isSystem ? 1 : -1 - return (a.appLabel || '').localeCompare(b.appLabel || '') - }) - - if (infoList.length === 0) { - infoList.push( - { - packageName: 'com.example.app1', - appLabel: '示例 1', - isSystem: false, - uid: 10123, - }, - { - packageName: 'com.example.app2', - appLabel: '示例 2', - isSystem: false, - uid: 10124, - }, - { - packageName: 'com.example.sys1', - appLabel: '系统示例 1', - isSystem: true, - uid: 1000, - }, - { - packageName: 'com.example.sys2', - appLabel: '系统示例 2', - isSystem: true, - uid: 1001, - }, - ) - if (!showingSystemApps) { - infoList = infoList.filter((app) => !app.isSystem) - } - } - - // uid 去重 - const seenUids = new Set() - infoList = infoList.filter((app) => { - if (app.uid === undefined || app.uid === null) return true - if (seenUids.has(app.uid)) return false - seenUids.add(app.uid) - return true - }) - - infoList.forEach((app) => { - const item = document.createElement('div') - item.className = 'app-list-item' - - const checkboxLabel = document.createElement('label') - checkboxLabel.className = 'app-checkbox-label' - - const checkbox = document.createElement('input') - checkbox.type = 'checkbox' - checkbox.className = 'app-checkbox' - checkbox.dataset.pkg = app.packageName - - // 依据已保存包名条目勾选(不含活动条目) - checkbox.checked = savedPkgEntries.has(app.packageName) - checkbox.addEventListener('change', () => { - updateUnsavedStyling() - reorderDOMApps() - }) - - const customCheckbox = document.createElement('span') - customCheckbox.className = 'app-checkbox-custom' - checkboxLabel.appendChild(checkbox) - checkboxLabel.appendChild(customCheckbox) - - const infoDiv = document.createElement('div') - infoDiv.className = 'app-info' - - const nameSpan = document.createElement('span') - nameSpan.className = 'app-name' - nameSpan.appendChild(document.createTextNode(app.appLabel || 'Unknown')) - - if (app.uid !== undefined) { - const uidBadge = document.createElement('span') - uidBadge.className = 'app-uid' - uidBadge.textContent = String(app.uid) - nameSpan.appendChild(uidBadge) - } - - const pkgSpan = document.createElement('span') - pkgSpan.className = 'app-pkg' - pkgSpan.textContent = app.packageName || '' - - if (app.isSystem) { - const sysBadge = document.createElement('span') - sysBadge.className = 'app-badge' - sysBadge.textContent = '系统' - pkgSpan.appendChild(sysBadge) - } - - infoDiv.appendChild(nameSpan) - infoDiv.appendChild(pkgSpan) - - // 活动展开箭头 - const chevronBtn = document.createElement('button') - chevronBtn.className = 'app-activities-chevron' - chevronBtn.innerHTML = - '' - const pkgActivities = [...activityEntries].filter((e) => e.startsWith(app.packageName + '/')) - chevronBtn.style.display = pkgActivities.length > 0 ? '' : 'none' - - const mainRow = document.createElement('div') - mainRow.className = 'app-item-main-row' - mainRow.appendChild(checkboxLabel) - mainRow.appendChild(infoDiv) - mainRow.appendChild(chevronBtn) - - // 活动列表(初始折叠) - const actListDiv = document.createElement('div') - actListDiv.className = 'app-activities-list' - actListDiv.dataset.pkg = app.packageName - renderActivityList(app.packageName, actListDiv) - - chevronBtn.addEventListener('click', (e) => { - e.stopPropagation() - actListDiv.classList.toggle('show') - chevronBtn.classList.toggle('expanded') - }) - - item.appendChild(mainRow) - item.appendChild(actListDiv) - container.appendChild(item) - }) - - updateUnsavedStyling() - reorderDOMApps() - - const badge = document.getElementById('app-count-badge') - if (badge) badge.textContent = infoList.length - - if (infoList.length === 0) { - container.innerHTML = - '
无应用
' - } - } catch (e) { - container.innerHTML = `
加载失败: ${e.message || String(e)}
` - } -} - -export function setupAppsEvents() { - // 下拉菜单控制 - const btnAppsMenu = document.getElementById('btn-apps-menu') - const appsDropdownMenu = document.getElementById('apps-dropdown-menu') - - if (btnAppsMenu && appsDropdownMenu) { - btnAppsMenu.addEventListener('click', (e) => { - e.stopPropagation() - appsDropdownMenu.classList.toggle('show') - }) - document.addEventListener('click', (e) => { - if (!btnAppsMenu.contains(e.target) && !appsDropdownMenu.contains(e.target)) { - appsDropdownMenu.classList.remove('show') - } - }) - } - - // 切换系统应用显示 - const btnToggleSysApps = document.getElementById('btn-toggle-sys-apps') - if (btnToggleSysApps) { - btnToggleSysApps.addEventListener('click', () => { - showingSystemApps = !showingSystemApps - - const textSpan = document.getElementById('sys-apps-text') - const iconWrap = document.getElementById('sys-apps-icon') - - if (textSpan) textSpan.textContent = showingSystemApps ? '隐藏系统应用' : '显示系统应用' - - if (iconWrap) { - const p = iconWrap.parentNode - const newIcon = document.createElement('i') - newIcon.setAttribute('data-lucide', showingSystemApps ? 'eye-off' : 'eye') - newIcon.id = 'sys-apps-icon' - p.replaceChild(newIcon, iconWrap) - createIcons({ icons: { Eye, EyeOff }, nameAttr: 'data-lucide' }) - } - - loadApps() - appsDropdownMenu && appsDropdownMenu.classList.remove('show') - }) - } - - // 智能选择 - const btnSmartSelect = document.getElementById('btn-smart-select') - if (btnSmartSelect) { - const smartKeywords = [ - '相册', - '抖音', - '快手', - '视频', - '哔哩哔哩', - 'bili', - 'pili', - 'netflix', - 'youtube', - 'tiktok', - 'x', - ] - btnSmartSelect.addEventListener('click', () => { - const items = document.querySelectorAll('.app-list-item') - items.forEach((item) => { - const name = item.querySelector('.app-name').textContent.toLowerCase() - const checkbox = item.querySelector('.app-checkbox') - let match = false - for (const kw of smartKeywords) { - if (kw === 'x') { - if (name === 'x' || name === 'x (twitter)') { - match = true - break - } - } else if (name.includes(kw)) { - match = true - break - } - } - if (match) checkbox.checked = true - }) - updateUnsavedStyling() - reorderDOMApps() - appsDropdownMenu && appsDropdownMenu.classList.remove('show') - }) - } - - // 手动添加包名 - const btnManualAdd = document.getElementById('btn-manual-add') - if (btnManualAdd) { - btnManualAdd.addEventListener('click', async () => { - appsDropdownMenu && appsDropdownMenu.classList.remove('show') - const pkg = prompt('请输入你要彻底屏蔽的完整应用包名(例如: com.example.app):') - if (!pkg || !pkg.trim()) return - - const realPkg = pkg.trim() - const existing = document.querySelector(`.app-checkbox[data-pkg="${realPkg}"]`) - if (existing) { - existing.checked = true - updateUnsavedStyling() - reorderDOMApps() - showToast('该应用已在列表中,已为你自动勾选并置顶') - return - } - - showToast('正在尝试获取应用信息...') - let appData = { - packageName: realPkg, - appLabel: '未知 (手动添加)', - isSystem: false, - uid: '自定义', - } - try { - const info = await getPackagesInfo([realPkg]) - if (info && info.length > 0) appData = info[0] - } catch { - /* ignore */ - } - - const container = document.getElementById('app-list-container') - const item = document.createElement('div') - item.className = 'app-list-item' - - const checkboxLabel = document.createElement('label') - checkboxLabel.className = 'app-checkbox-label' - - const checkbox = document.createElement('input') - checkbox.type = 'checkbox' - checkbox.className = 'app-checkbox' - checkbox.dataset.pkg = realPkg - checkbox.checked = true - checkbox.addEventListener('change', () => { - updateUnsavedStyling() - reorderDOMApps() - }) - - const customCheckbox = document.createElement('span') - customCheckbox.className = 'app-checkbox-custom' - checkboxLabel.appendChild(checkbox) - checkboxLabel.appendChild(customCheckbox) - - const infoDiv = document.createElement('div') - infoDiv.className = 'app-info' - - const nameSpan = document.createElement('span') - nameSpan.className = 'app-name' - nameSpan.appendChild(document.createTextNode(appData.appLabel || 'Unknown')) - - if (appData.uid !== undefined) { - const uidBadge = document.createElement('span') - uidBadge.className = 'app-uid' - uidBadge.textContent = String(appData.uid) - nameSpan.appendChild(uidBadge) - } - - const pkgSpan = document.createElement('span') - pkgSpan.className = 'app-pkg' - pkgSpan.textContent = realPkg - - if (appData.isSystem) { - const sysBadge = document.createElement('span') - sysBadge.className = 'app-badge' - sysBadge.textContent = '系统' - pkgSpan.appendChild(sysBadge) - } - - infoDiv.appendChild(nameSpan) - infoDiv.appendChild(pkgSpan) - - const chevronBtn = document.createElement('button') - chevronBtn.className = 'app-activities-chevron' - chevronBtn.innerHTML = - '' - chevronBtn.style.display = 'none' - - const mainRow = document.createElement('div') - mainRow.className = 'app-item-main-row' - mainRow.appendChild(checkboxLabel) - mainRow.appendChild(infoDiv) - mainRow.appendChild(chevronBtn) - - const actListDiv = document.createElement('div') - actListDiv.className = 'app-activities-list' - actListDiv.dataset.pkg = realPkg - - chevronBtn.addEventListener('click', (e) => { - e.stopPropagation() - actListDiv.classList.toggle('show') - chevronBtn.classList.toggle('expanded') - }) - - item.appendChild(mainRow) - item.appendChild(actListDiv) - container.appendChild(item) - - updateUnsavedStyling() - reorderDOMApps() - showToast('已成功添加并勾选') - }) - } - - // 全选 - const btnSelectAll = document.getElementById('btn-select-all') - if (btnSelectAll) { - btnSelectAll.addEventListener('click', () => { - document.querySelectorAll('.app-checkbox').forEach((cb) => { - cb.checked = true - }) - updateUnsavedStyling() - appsDropdownMenu && appsDropdownMenu.classList.remove('show') - }) - } - - // 全不选 - const btnSelectNone = document.getElementById('btn-select-none') - if (btnSelectNone) { - btnSelectNone.addEventListener('click', () => { - document.querySelectorAll('.app-checkbox').forEach((cb) => { - cb.checked = false - }) - updateUnsavedStyling() - appsDropdownMenu && appsDropdownMenu.classList.remove('show') - }) - } - - // 反选 - const btnInvertSelection = document.getElementById('btn-invert-selection') - if (btnInvertSelection) { - btnInvertSelection.addEventListener('click', () => { - document.querySelectorAll('.app-checkbox').forEach((cb) => { - cb.checked = !cb.checked - }) - updateUnsavedStyling() - appsDropdownMenu && appsDropdownMenu.classList.remove('show') - }) - } - - // 刷新(重排) - const btnAppsRefresh = document.getElementById('btn-apps-refresh') - if (btnAppsRefresh) { - btnAppsRefresh.addEventListener('click', () => { - reorderDOMApps() - }) - } - - // 保存黑名单 - const btnSaveBlacklist = document.getElementById('btn-save-blacklist') - if (btnSaveBlacklist) { - btnSaveBlacklist.addEventListener('click', async () => { - showToast('保存中...') - const selectedPkgs = [] - document.querySelectorAll('.app-checkbox').forEach((cb) => { - if (cb.checked) selectedPkgs.push(cb.dataset.pkg) - }) - const allEntries = [...selectedPkgs, ...activityEntries] - const res = await updateConfig({ blacklist_apps: allEntries }) - if (res.errno === 0 || res.stdout?.includes('OK')) { - showToast('黑名单保存成功') - savedBlacklist = new Set(allEntries) - updateUnsavedStyling() - reorderDOMApps() - } else { - showToast('保存失败: ' + res.stderr) - } - }) - } - - // 按活动屏蔽 - const btnAddActivity = document.getElementById('btn-add-activity') - const inputActivityEntry = document.getElementById('input-activity-entry') - if (btnAddActivity && inputActivityEntry) { - const doAddActivity = () => { - const val = inputActivityEntry.value.trim() - if (!val) return - const parts = val.split('/') - if (parts.length !== 2 || !parts[0] || !parts[1]) { - showToast('格式错误,请输入 包名/完整活动类名') - return - } - activityEntries.add(val) - inputActivityEntry.value = '' - const pkg = parts[0] - document.querySelectorAll('.app-list-item').forEach((appItem) => { - const cb = appItem.querySelector('.app-checkbox') - if (cb && cb.dataset.pkg === pkg) { - const actList = appItem.querySelector('.app-activities-list') - const chevron = appItem.querySelector('.app-activities-chevron') - if (actList) { - renderActivityList(pkg, actList) - actList.classList.add('show') - } - if (chevron) { - chevron.style.display = '' - chevron.classList.add('expanded') - } - } - }) - updateUnsavedStyling() - reorderDOMApps() - showToast(`已添加: ${val}`) - } - btnAddActivity.addEventListener('click', doAddActivity) - inputActivityEntry.addEventListener('keydown', (e) => { - if (e.key === 'Enter') doAddActivity() - }) - } - - // 搜索 - const inputAppSearch = document.getElementById('input-app-search') - if (inputAppSearch) { - inputAppSearch.addEventListener('input', (e) => { - const keyword = e.target.value.trim().toLowerCase() - const items = document.querySelectorAll('.app-list-item') - let visibleCount = 0 - items.forEach((item) => { - const name = item.querySelector('.app-name').textContent - const pkg = item.querySelector('.app-pkg').textContent.toLowerCase() - if (!keyword || pkg.includes(keyword) || PinyinMatch.match(name, keyword)) { - item.style.display = 'flex' - visibleCount++ - } else { - item.style.display = 'none' - } - }) - const badge = document.getElementById('app-count-badge') - if (badge) badge.textContent = visibleCount - }) - } - - setupActivityPicker() -} - -function setupActivityPicker() { - const overlay = document.getElementById('activity-picker-overlay') - if (!overlay) return - - const btnPickActivity = document.getElementById('btn-pick-activity') - const btnPickerBack = document.getElementById('btn-picker-back') - const step1 = document.getElementById('picker-step-1') - const step2 = document.getElementById('picker-step-2') - const step3 = document.getElementById('picker-step-3') - const dots = [ - document.getElementById('picker-dot-1'), - document.getElementById('picker-dot-2'), - document.getElementById('picker-dot-3'), - ] - const btnStep1Next = document.getElementById('btn-picker-step1-next') - const btnPickerStart = document.getElementById('btn-picker-start') - const btnPickerRetry = document.getElementById('btn-picker-retry') - const btnPickerConfirm = document.getElementById('btn-picker-confirm') - const pickerStatusText = document.getElementById('picker-status-text') - const pickerResultText = document.getElementById('picker-result-text') - - let pollingTimer = null - let detectedActivity = null - - function showStep(n) { - ;[step1, step2, step3].forEach((s, i) => { - if (s) s.style.display = i + 1 === n ? 'flex' : 'none' - }) - dots.forEach((d, i) => { - d?.classList.toggle('active', i + 1 === n) - }) - } - - function stopPolling() { - if (pollingTimer) { - clearInterval(pollingTimer) - pollingTimer = null - } - } - - function openPicker() { - stopPolling() - detectedActivity = null - if (btnPickerStart) btnPickerStart.disabled = false - if (pickerStatusText) { - pickerStatusText.textContent = '等待中...' - pickerStatusText.classList.remove('polling') - } - showStep(1) - overlay.classList.add('show') - } - - function closePicker() { - stopPolling() - overlay.classList.remove('show') - } - - btnPickActivity?.addEventListener('click', openPicker) - btnPickerBack?.addEventListener('click', closePicker) - btnStep1Next?.addEventListener('click', () => showStep(2)) - - btnPickerStart?.addEventListener('click', () => { - btnPickerStart.disabled = true - if (pickerStatusText) { - pickerStatusText.textContent = '检测中,请切换到目标界面...' - pickerStatusText.classList.add('polling') - } - stopPolling() - pollingTimer = setInterval(async () => { - try { - const res = await runCmd( - `dumpsys window 2>/dev/null | grep mCurrentFocus | sed 's/.*u[0-9][0-9]* //' | sed 's/}.*//'`, - ) - if (res.errno !== 0) return - const activity = res.stdout.trim() - // 空值或仍在 WebUI 内则继续等待 - if (!activity || activity.toLowerCase().includes('webui')) return - stopPolling() - detectedActivity = activity - if (pickerStatusText) pickerStatusText.classList.remove('polling') - if (pickerResultText) pickerResultText.textContent = activity - if (btnPickerStart) btnPickerStart.disabled = false - showStep(3) - } catch { - /* 忽略,继续轮询 */ - } - }, 600) - }) - - btnPickerRetry?.addEventListener('click', () => { - stopPolling() - detectedActivity = null - if (btnPickerStart) btnPickerStart.disabled = false - if (pickerStatusText) { - pickerStatusText.textContent = '等待中...' - pickerStatusText.classList.remove('polling') - } - showStep(2) - }) - - btnPickerConfirm?.addEventListener('click', () => { - if (!detectedActivity) return - activityEntries.add(detectedActivity) - const pkg = detectedActivity.split('/')[0] - document.querySelectorAll('.app-list-item').forEach((appItem) => { - const cb = appItem.querySelector('.app-checkbox') - if (cb && cb.dataset.pkg === pkg) { - const actList = appItem.querySelector('.app-activities-list') - const chevron = appItem.querySelector('.app-activities-chevron') - if (actList) { - renderActivityList(pkg, actList) - actList.classList.add('show') - } - if (chevron) { - chevron.style.display = '' - chevron.classList.add('expanded') - } - } - }) - updateUnsavedStyling() - reorderDOMApps() - showToast(`已添加: ${detectedActivity}`) - closePicker() - }) -} diff --git a/webui/src/components.css b/webui/src/components.css deleted file mode 100644 index 26af26f..0000000 --- a/webui/src/components.css +++ /dev/null @@ -1,663 +0,0 @@ -/* Cards */ -.card { - background-color: var(--md-sys-color-surface); - border-radius: var(--border-radius-m); - padding: var(--spacing-l); - box-shadow: - 0 1px 3px 0 rgba(0, 0, 0, 0.3), - 0 4px 8px 3px rgba(0, 0, 0, 0.15); - display: flex; - flex-direction: column; -} - -/* Collapsible card header */ -.card-header-toggle { - cursor: pointer; - user-select: none; - -webkit-user-select: none; - border-radius: var(--border-radius-s); - transition: background-color 0.15s; - margin: calc(-1 * var(--spacing-l)); - padding: var(--spacing-l); -} -.card-header-toggle:active { - background-color: rgba(var(--md-sys-color-primary-rgb), 0.06); -} -.collapse-chevron { - color: var(--md-sys-color-on-surface-variant); - transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1); - flex-shrink: 0; -} -.collapse-chevron.open { - transform: rotate(180deg); -} - -/* grid-template-rows collapse animation */ -.collapsible-body { - display: grid; - grid-template-rows: 0fr; - transition: grid-template-rows 0.35s cubic-bezier(0.25, 1, 0.5, 1); -} -.collapsible-body.open { - grid-template-rows: 1fr; -} -.collapsible-body > div { - overflow: hidden; - padding-top: 0; - transition: padding-top 0.35s cubic-bezier(0.25, 1, 0.5, 1); -} -.collapsible-body.open > div { - padding-top: var(--spacing-l); - overflow: visible; -} - -/* Page Transitions */ -.card-animate-in { - animation: cardFadeIn 0.4s cubic-bezier(0.2, 0, 0, 1) forwards; -} - -.navbar-slider { - left: 0; -} - -@keyframes cardFadeIn { - from { - opacity: 0; - transform: translateY(12px) scale(0.985); - } - to { - opacity: 1; - transform: translateY(0) scale(1); - } -} - -#log-section { - flex: 1; - min-height: calc(100vh - 220px); -} - -.card-header { - display: flex; - align-items: center; - gap: var(--spacing-s); -} - -.card-header h2 { - margin: 0; - font-size: 1.125rem; - font-weight: 500; - color: var(--md-sys-color-on-surface); - flex-grow: 1; -} - -/* Config Items */ -.config-group { - margin-top: 12px; - margin-bottom: 0; - padding: 12px; - background-color: var(--md-sys-color-surface-container); - border-radius: var(--border-radius-m); - border: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0, 0, 0), 0.05); -} - -.group-title { - margin: 0 0 10px 0; - color: var(--md-sys-color-primary); - font-size: 0.875rem; - font-weight: 600; - display: flex; - align-items: center; - gap: 8px; -} - -.group-title i, -.group-title svg { - width: 16px; - height: 16px; -} - -.config-item { - display: flex; - justify-content: space-between; - align-items: center; - padding: 4px 0; -} - -#advanced-section .config-item { - flex-direction: column; - align-items: flex-start; - gap: 12px; - width: 100%; -} - -#advanced-section .config-value { - width: 100%; -} - -.config-item + .config-item { - margin-top: 10px; - border-top: 1px solid rgba(var(--md-sys-color-outline-variant-rgb, 142, 144, 153), 0.1); - padding-top: 10px; -} - -.config-label { - display: flex; - flex-direction: column; -} - -.config-name { - font-size: 1rem; - color: var(--md-sys-color-on-surface); -} - -.config-desc { - font-size: 0.875rem; - color: var(--md-sys-color-on-surface-variant); -} - -.config-input { - width: 100px; - padding: 8px 12px; - background-color: var(--md-sys-color-surface-container-high); - border: 1px solid var(--md-sys-color-outline-variant); - border-radius: var(--border-radius-s); - color: var(--md-sys-color-on-surface); - font-size: 1rem; - font-family: inherit; - text-align: right; - outline: none; - transition: all 0.2s ease; -} - -.config-input:focus { - border-color: var(--md-sys-color-primary); - box-shadow: 0 0 0 2px rgba(var(--md-sys-color-primary-rgb), 0.2); - background-color: var(--md-sys-color-surface); -} - -.config-select { - padding: 8px 12px; - background-color: var(--md-sys-color-surface-container-high); - border: 1px solid var(--md-sys-color-outline-variant); - border-radius: var(--border-radius-s); - color: var(--md-sys-color-on-surface); - font-size: 1rem; - font-family: inherit; - outline: none; - cursor: pointer; - transition: all 0.2s ease; -} - -.config-select:focus { - border-color: var(--md-sys-color-primary); - box-shadow: 0 0 0 2px rgba(var(--md-sys-color-primary-rgb), 0.2); - background-color: var(--md-sys-color-surface); -} - -#advanced-section .config-input { - width: 100%; - text-align: left; -} - -.config-textarea { - background-color: var(--md-sys-color-surface-container-high); - width: 100%; - min-height: 60px; - max-height: 300px; - color: var(--md-sys-color-on-surface); - border: 1px solid var(--md-sys-color-outline-variant); - border-radius: var(--border-radius-m); - resize: vertical; - padding: 10px 14px; - font-family: 'Geist Mono', system-ui, monospace; - font-size: 0.875rem; - line-height: 1.4; - transition: all 0.2s ease; - outline: none; -} - -.config-textarea:focus { - border-color: var(--md-sys-color-primary); - box-shadow: 0 0 0 2px rgba(var(--md-sys-color-primary-rgb), 0.2); - background-color: var(--md-sys-color-surface); -} - -.config-input-wide { - width: 140px; -} - -.config-item-expand { - display: flex; - justify-content: flex-end; - margin-top: var(--spacing-s); - max-height: 0; - overflow: hidden; - opacity: 0; - transition: all 0.3s ease; -} - -.config-item-expand.show { - max-height: 100px; /* 调整为适合内容的高度 */ - opacity: 1; - margin-bottom: var(--spacing-m); -} - -/* Custom Time Picker Styles */ -.custom-time-picker { - display: flex; - align-items: center; - gap: 8px; -} - -.time-unit { - display: flex; - align-items: center; - gap: 2px; - background-color: var(--md-sys-color-surface-container-high); - padding: 2px 6px; - border-radius: var(--border-radius-s); - border: 1px solid var(--md-sys-color-outline); -} - -.time-input { - width: 32px; - background-color: transparent; - color: var(--md-sys-color-on-surface); - border: none; - font-size: 0.875rem; - text-align: center; - font-family: 'Geist Mono', monospace; - outline: none; - -moz-appearance: textfield; -} - -.time-input-wide { - width: 48px; -} - -.time-input::-webkit-outer-spin-button, -.time-input::-webkit-inner-spin-button { - -webkit-appearance: none; - margin: 0; -} - -.time-sep { - color: var(--md-sys-color-on-surface-variant); - font-size: 0.875rem; -} - -/* Switch Styles */ -.switch { - position: relative; - display: inline-block; - width: 52px; - height: 32px; -} - -.switch input { - opacity: 0; - width: 0; - height: 0; -} - -.slider { - position: absolute; - cursor: pointer; - top: 0; - left: 0; - right: 0; - bottom: 0; - background-color: var(--md-sys-color-surface-container-high); - transition: 0.4s; - border-radius: 34px; - border: 2px solid var(--md-sys-color-outline); -} - -.slider:before { - position: absolute; - content: ''; - height: 24px; - width: 24px; - left: 2px; - bottom: 2px; - background-color: var(--md-sys-color-outline); - transition: 0.4s; - border-radius: 50%; -} - -input:checked + .slider { - background-color: var(--md-sys-color-primary-container); - border-color: var(--md-sys-color-primary); -} - -input:checked + .slider:before { - transform: translateX(20px); - background-color: var(--md-sys-color-primary); -} - -/* Status Grid */ -.status-grid { - display: grid; - grid-template-columns: 1fr 1fr; - gap: var(--spacing-m); - margin-top: var(--spacing-m); -} - -.status-item { - background-color: var(--md-sys-color-surface-container); - padding: var(--spacing-m); - border-radius: var(--border-radius-m); - display: flex; - flex-direction: column; - gap: 8px; - border: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0, 0, 0), 0.04); - transition: transform 0.2s ease; -} - -.status-item:active { - transform: scale(0.98); -} - -.status-item-header { - display: flex; - align-items: center; - gap: 6px; - color: var(--md-sys-color-on-surface-variant); -} - -.status-item-header svg { - width: 14px; - height: 14px; - opacity: 0.7; -} - -.status-label { - font-size: 0.75rem; - font-weight: 500; -} - -.status-value { - font-size: 1.125rem; - font-weight: 600; - color: var(--md-sys-color-primary); - word-break: break-all; -} - -/* Brightness Section */ -.brightness-section { - margin-top: var(--spacing-l); - padding: var(--spacing-m); - background: linear-gradient( - 135deg, - var(--md-sys-color-surface-container-high) 0%, - var(--md-sys-color-surface-container) 100% - ); - border-radius: var(--border-radius-m); - border: 1px solid var(--md-sys-color-outline-variant); -} - -.brightness-header { - display: flex; - justify-content: space-between; - align-items: center; - margin-bottom: var(--spacing-m); -} - -.brightness-title { - font-size: 1rem; - font-weight: 600; - color: var(--md-sys-color-on-surface); - letter-spacing: 0.5px; -} - -.brightness-percent { - font-size: 1.25rem; - font-weight: 700; - color: var(--md-sys-color-primary); - min-width: 50px; - text-align: right; -} - -/* Brightness Slider Container */ -.brightness-container { - position: relative; - display: flex; - align-items: center; - gap: 8px; - margin-bottom: var(--spacing-m); - padding: var(--spacing-s) 0; -} - -.brightness-label { - font-size: 0.75rem; - color: var(--md-sys-color-on-surface-variant); - min-width: 24px; - text-align: center; - font-weight: 500; -} - -/* Brightness Slider (Progress Bar Style) */ -.brightness-slider { - flex: 1; - height: 24px; - border-radius: 12px; - /* 背景将由 JS 通过 linear-gradient 动态更新实现进度条效果 */ - background: var(--md-sys-color-surface-container-high); - outline: none; - -webkit-appearance: none; - appearance: none; - cursor: grab; - transition: - background 0.35s ease, - height 0.2s, - box-shadow 0.2s; - border: 1px solid rgba(255, 255, 255, 0.03); - box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2); - overflow: hidden; /* 确保进度条颜色不溢出圆角 */ -} - -.brightness-slider:hover { - height: 28px; -} - -.brightness-slider:disabled { - opacity: 0.5; - cursor: not-allowed; -} - -.brightness-slider:disabled:hover { - height: 24px; -} - -.brightness-slider::-webkit-slider-thumb { - -webkit-appearance: none; - appearance: none; - width: 0; - height: 0; - background: transparent; - cursor: grab; - border: none; -} - -.brightness-slider::-webkit-slider-thumb:active { - cursor: grabbing; -} - -.brightness-slider::-moz-range-thumb { - width: 28px; - height: 28px; - border-radius: 50%; - background: var(--md-sys-color-primary); - cursor: grab; - border: 2px solid var(--md-sys-color-surface); - box-shadow: - 0 2px 8px rgba(0, 0, 0, 0.4), - inset 0 1px 2px rgba(255, 255, 255, 0.3); - transition: all 0.2s; -} - -.brightness-slider::-moz-range-thumb:hover { - box-shadow: - 0 4px 12px rgba(0, 0, 0, 0.5), - inset 0 1px 2px rgba(255, 255, 255, 0.3); - transform: scale(1.1); -} - -.brightness-slider::-moz-range-thumb:active { - cursor: grabbing; - box-shadow: 0 0 0 10px rgba(168, 199, 250, 0.2); -} - -.brightness-slider::-moz-range-track { - background: transparent; - border: none; -} - -/* Actions */ -.save-badge { - margin-left: auto; - flex-shrink: 0; - padding: 2px 10px; - border-radius: 999px; - font-size: 0.75rem; - font-weight: 600; - line-height: 1.5; -} - -.save-badge.unsaved { - color: var(--color-warning); - background: color-mix(in srgb, var(--color-warning) 15%, transparent); -} - -.save-badge.saved { - color: #2f9e63; - background: rgba(47, 158, 99, 0.14); -} - -.card-actions { - display: flex; - justify-content: flex-end; - gap: 12px; - margin-top: 16px; - padding-top: 12px; - border-top: 1px solid var(--md-sys-color-outline-variant); -} - -/* Buttons */ -.btn { - display: inline-flex; - align-items: center; - justify-content: center; - gap: 8px; - padding: 10px 24px; - border-radius: 100px; - border: none; - font-size: 0.875rem; - font-weight: 500; - font-family: inherit; - cursor: pointer; - transition: - background-color 0.2s, - opacity 0.2s; -} - -.btn:active { - opacity: 0.8; -} - -.btn-primary { - background-color: var(--md-sys-color-primary); - color: var(--md-sys-color-on-primary); -} - -.btn-outline { - background-color: transparent; - border: 1px solid var(--md-sys-color-outline); - color: var(--md-sys-color-primary); -} - -.btn-outline-s, -.btn-text-s { - background-color: transparent; - border: 1px solid var(--md-sys-color-outline-variant); - color: var(--md-sys-color-primary); - padding: 4px 10px; - min-width: 50px; - height: 28px; - font-size: 0.75rem; - border-radius: var(--border-radius-s); - cursor: pointer; - display: inline-flex; - align-items: center; - justify-content: center; - transition: all 0.2s; - white-space: nowrap; -} - -.btn-text-s:active { - background-color: var(--md-sys-color-surface-container-high); -} - -.btn-danger { - background-color: var(--md-sys-color-error) !important; - color: var(--md-sys-color-on-error) !important; - border: none !important; -} - -/* Header Actions container */ -.header-actions { - display: flex; - align-items: center; - gap: 8px; -} - -.btn-icon-only { - background: transparent; - border: none; - color: var(--md-sys-color-on-surface-variant); - font-size: 1.25rem; - cursor: pointer; - padding: 4px; - border-radius: 50%; - display: flex; - align-items: center; - justify-content: center; -} - -.btn-icon-only-s { - display: flex; - align-items: center; - justify-content: center; - width: 32px; - height: 32px; - border-radius: 8px; - border: none; - background-color: var(--md-sys-color-surface-container-high); - color: var(--md-sys-color-primary); - cursor: pointer; - transition: all 0.2s ease; -} - -.btn-icon-only-s:active { - background-color: var(--md-sys-color-primary-container); - transform: scale(0.9); -} - -.btn-icon-only-s i, -.btn-icon-only-s svg { - width: 16px; - height: 16px; -} - -.animate-spin { - animation: spin 1s linear infinite; -} - -@keyframes spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} diff --git a/webui/src/components/ActionMenu.vue b/webui/src/components/ActionMenu.vue new file mode 100644 index 0000000..2dc8317 --- /dev/null +++ b/webui/src/components/ActionMenu.vue @@ -0,0 +1,40 @@ + + + diff --git a/webui/src/components/AppBottomNav.vue b/webui/src/components/AppBottomNav.vue new file mode 100644 index 0000000..67fb7cc --- /dev/null +++ b/webui/src/components/AppBottomNav.vue @@ -0,0 +1,31 @@ + + + diff --git a/webui/src/components/AppSwitch.vue b/webui/src/components/AppSwitch.vue new file mode 100644 index 0000000..d3c8a0c --- /dev/null +++ b/webui/src/components/AppSwitch.vue @@ -0,0 +1,28 @@ + + + diff --git a/webui/src/components/AppTextField.vue b/webui/src/components/AppTextField.vue new file mode 100644 index 0000000..35a59e1 --- /dev/null +++ b/webui/src/components/AppTextField.vue @@ -0,0 +1,36 @@ + + + diff --git a/webui/src/components/AppTopBar.vue b/webui/src/components/AppTopBar.vue new file mode 100644 index 0000000..a980a77 --- /dev/null +++ b/webui/src/components/AppTopBar.vue @@ -0,0 +1,59 @@ + + + diff --git a/webui/src/components/BottomNav.vue b/webui/src/components/BottomNav.vue deleted file mode 100644 index 102dbc6..0000000 --- a/webui/src/components/BottomNav.vue +++ /dev/null @@ -1,143 +0,0 @@ - - - diff --git a/webui/src/components/ConfirmDialog.vue b/webui/src/components/ConfirmDialog.vue new file mode 100644 index 0000000..0b85872 --- /dev/null +++ b/webui/src/components/ConfirmDialog.vue @@ -0,0 +1,54 @@ + + + + + diff --git a/webui/src/components/OpLockBanner.vue b/webui/src/components/OpLockBanner.vue new file mode 100644 index 0000000..251b2f7 --- /dev/null +++ b/webui/src/components/OpLockBanner.vue @@ -0,0 +1,17 @@ + + + diff --git a/webui/src/components/PromptDialog.vue b/webui/src/components/PromptDialog.vue new file mode 100644 index 0000000..d8dc531 --- /dev/null +++ b/webui/src/components/PromptDialog.vue @@ -0,0 +1,68 @@ + + + + + diff --git a/webui/src/components/SnackbarHost.vue b/webui/src/components/SnackbarHost.vue new file mode 100644 index 0000000..97fd6fc --- /dev/null +++ b/webui/src/components/SnackbarHost.vue @@ -0,0 +1,15 @@ + + + diff --git a/webui/src/components/ui/Badge.vue b/webui/src/components/ui/Badge.vue deleted file mode 100644 index c08a6b0..0000000 --- a/webui/src/components/ui/Badge.vue +++ /dev/null @@ -1,32 +0,0 @@ - - - diff --git a/webui/src/components/ui/Button.vue b/webui/src/components/ui/Button.vue deleted file mode 100644 index b0b5170..0000000 --- a/webui/src/components/ui/Button.vue +++ /dev/null @@ -1,53 +0,0 @@ - - - diff --git a/webui/src/components/ui/Card.vue b/webui/src/components/ui/Card.vue deleted file mode 100644 index 3e69509..0000000 --- a/webui/src/components/ui/Card.vue +++ /dev/null @@ -1,17 +0,0 @@ - - - diff --git a/webui/src/components/ui/Input.vue b/webui/src/components/ui/Input.vue deleted file mode 100644 index bb4aa74..0000000 --- a/webui/src/components/ui/Input.vue +++ /dev/null @@ -1,38 +0,0 @@ - - - diff --git a/webui/src/components/ui/Label.vue b/webui/src/components/ui/Label.vue deleted file mode 100644 index ce49f42..0000000 --- a/webui/src/components/ui/Label.vue +++ /dev/null @@ -1,22 +0,0 @@ - - - diff --git a/webui/src/components/ui/Separator.vue b/webui/src/components/ui/Separator.vue deleted file mode 100644 index ff4bb30..0000000 --- a/webui/src/components/ui/Separator.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - diff --git a/webui/src/components/ui/Switch.vue b/webui/src/components/ui/Switch.vue deleted file mode 100644 index 091c64c..0000000 --- a/webui/src/components/ui/Switch.vue +++ /dev/null @@ -1,43 +0,0 @@ - - - diff --git a/webui/src/components/ui/Textarea.vue b/webui/src/components/ui/Textarea.vue deleted file mode 100644 index d16e7fc..0000000 --- a/webui/src/components/ui/Textarea.vue +++ /dev/null @@ -1,30 +0,0 @@ - - -