diff --git a/changelog.md b/changelog.md index f350866..b2ab26c 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,5 @@ ## V2.2-2204 + - 新增: `boost.sh` 脚本,支持一键将亮度提升至峰值极限 - 新增: 对于部分设备,支持在刷入时建议更改配置文件以适配 - 新增: inotifyd 的进程守护脚本,确保 inotifyd 进程的稳定性 diff --git a/config/blacklist_apps.txt b/config/blacklist_apps.txt new file mode 100644 index 0000000..e69de29 diff --git a/package.json b/package.json index 8333db3..b3c78d4 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,8 @@ "vite": "^8.0.3" }, "dependencies": { - "lucide": "^1.7.0" + "lucide": "^1.7.0", + "markdown-it": "^14.1.1", + "pinyin-match": "^1.2.10" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b08981d..4e6bb88 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,12 @@ importers: lucide: specifier: ^1.7.0 version: 1.7.0 + markdown-it: + specifier: ^14.1.1 + version: 14.1.1 + pinyin-match: + specifier: ^1.2.10 + version: 1.2.10 devDependencies: archiver: specifier: ^7.0.1 @@ -179,6 +185,9 @@ packages: resolution: {integrity: sha512-ZcbTaIqJOfCc03QwD468Unz/5Ir8ATtvAHsK+FdXbDIbGfihqh9mrvdcYunQzqn4HrvWWaFyaxJhGZagaJJpPQ==} engines: {node: '>= 14'} + argparse@2.0.1: + resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + async@3.2.6: resolution: {integrity: sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==} @@ -287,6 +296,10 @@ packages: emoji-regex@9.2.2: resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} + entities@4.5.0: + resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} + engines: {node: '>=0.12'} + event-target-shim@5.0.1: resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==} engines: {node: '>=6'} @@ -430,6 +443,9 @@ packages: resolution: {integrity: sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==} engines: {node: '>= 12.0.0'} + linkify-it@5.0.0: + resolution: {integrity: sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==} + lodash@4.18.1: resolution: {integrity: sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==} @@ -439,6 +455,13 @@ packages: lucide@1.7.0: resolution: {integrity: sha512-aYNogbuIxea3a8offpKjdMGf2FsUk9GECFh0B4iJgXlJOX41+7/ncvLVluKki8477SoybEdyGGf+qGYLBDiEsA==} + markdown-it@14.1.1: + resolution: {integrity: sha512-BuU2qnTti9YKgK5N+IeMubp14ZUKUUw7yeJbkjtosvHiP0AZ5c8IAgEMk79D0eC8F23r4Ac/q8cAIFdm2FtyoA==} + hasBin: true + + mdurl@2.0.0: + resolution: {integrity: sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==} + minimatch@5.1.9: resolution: {integrity: sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==} engines: {node: '>=10'} @@ -478,6 +501,9 @@ packages: resolution: {integrity: sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==} engines: {node: '>=12'} + pinyin-match@1.2.10: + resolution: {integrity: sha512-Xo1uMd9n56/xP2EAn7yfApnTmAGCLGqxFIm1fuOnSMty0xhqRF3+ZwVjp2yWFD/alv60RUWa/cZoQSeTSp1HxA==} + postcss@8.5.8: resolution: {integrity: sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==} engines: {node: ^10 || ^12 || >=14} @@ -489,6 +515,10 @@ packages: resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==} engines: {node: '>= 0.6.0'} + punycode.js@2.3.1: + resolution: {integrity: sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==} + engines: {node: '>=6'} + readable-stream@2.3.8: resolution: {integrity: sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==} @@ -567,6 +597,9 @@ packages: tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + uc.micro@2.1.0: + resolution: {integrity: sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==} + util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} @@ -764,6 +797,8 @@ snapshots: - bare-buffer - react-native-b4a + argparse@2.0.1: {} + async@3.2.6: {} b4a@1.8.0: {} @@ -852,6 +887,8 @@ snapshots: emoji-regex@9.2.2: {} + entities@4.5.0: {} + event-target-shim@5.0.1: {} events-universal@1.0.1: @@ -960,12 +997,27 @@ snapshots: lightningcss-win32-arm64-msvc: 1.32.0 lightningcss-win32-x64-msvc: 1.32.0 + linkify-it@5.0.0: + dependencies: + uc.micro: 2.1.0 + lodash@4.18.1: {} lru-cache@10.4.3: {} lucide@1.7.0: {} + markdown-it@14.1.1: + dependencies: + argparse: 2.0.1 + entities: 4.5.0 + linkify-it: 5.0.0 + mdurl: 2.0.0 + punycode.js: 2.3.1 + uc.micro: 2.1.0 + + mdurl@2.0.0: {} + minimatch@5.1.9: dependencies: brace-expansion: 2.0.3 @@ -993,6 +1045,8 @@ snapshots: picomatch@4.0.4: {} + pinyin-match@1.2.10: {} + postcss@8.5.8: dependencies: nanoid: 3.3.11 @@ -1003,6 +1057,8 @@ snapshots: process@0.11.10: {} + punycode.js@2.3.1: {} + readable-stream@2.3.8: dependencies: core-util-is: 1.0.3 @@ -1132,6 +1188,8 @@ snapshots: tslib@2.8.1: optional: true + uc.micro@2.1.0: {} + util-deprecate@1.0.2: {} vite@8.0.3(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2): diff --git a/webroot/index.html b/webroot/index.html index e754816..eea0f12 100644 --- a/webroot/index.html +++ b/webroot/index.html @@ -6,11 +6,14 @@ LuminPro - - + + + +
+
@@ -18,12 +21,19 @@

LuminPro

日用屏幕亮度强化

-

V2.2-2203

+

V2.2-2204

-
- - 运行中 +
+
+ + 运行中 +
+
+ + + +
@@ -31,28 +41,35 @@

实时状态

-
- - - -
- 当前亮度 +
+ + 当前亮度 +
—
- 系统最大亮度 +
+ + 系统最大亮度 +
—
- inotifyd PID +
+ + inotifyd PID +
—
- 休眠状态 +
+ + 休眠状态 +
—
@@ -86,7 +103,7 @@
-

亮度调节

+

亮度调节

前台最大亮度 @@ -118,7 +135,7 @@
-

执行策略

+

执行策略

自动亮度时休眠 @@ -162,7 +179,7 @@
-

系统管理

+

系统管理

日志大小限制 @@ -191,6 +208,7 @@
+

运行环境

inotifyd 监听事件 @@ -235,6 +253,7 @@
+

界面设置

状态/日志刷新间隔 @@ -262,6 +281,65 @@
+ + +
@@ -280,6 +358,67 @@
加载中...
+ +
+
+

关于项目

+
+ + + +
+

相关文档

+
+
+ + README +
+
+ + README (English) +
+
+ + 更新日志 +
+
+ + 声明与注意事项 +
+
+
+
+ + +
+
+
+
+

文档查看

+ +
+
+ +
+
+
@@ -294,10 +433,18 @@ 配置 + +
diff --git a/webui/index.html b/webui/index.html index b91d4d7..5d886e9 100644 --- a/webui/index.html +++ b/webui/index.html @@ -10,6 +10,9 @@ + +
+
@@ -17,12 +20,19 @@

LuminPro

日用屏幕亮度强化

-

V2.2-2203

+

V2.2-2204

-
- - 运行中 +
+
+ + 运行中 +
+
+ + + +
@@ -30,28 +40,35 @@

实时状态

-
- - - -
- 当前亮度 +
+ + 当前亮度 +
—
- 系统最大亮度 +
+ + 系统最大亮度 +
—
- inotifyd PID +
+ + inotifyd PID +
—
- 休眠状态 +
+ + 休眠状态 +
—
@@ -85,7 +102,7 @@
-

亮度调节

+

亮度调节

前台最大亮度 @@ -117,7 +134,7 @@
-

执行策略

+

执行策略

自动亮度时休眠 @@ -161,7 +178,7 @@
-

系统管理

+

系统管理

日志大小限制 @@ -190,6 +207,7 @@
+

运行环境

inotifyd 监听事件 @@ -234,6 +252,7 @@
+

界面设置

状态/日志刷新间隔 @@ -261,6 +280,65 @@
+ + +
@@ -279,6 +357,67 @@
加载中...
+ +
+
+

关于项目

+
+ + + +
+

相关文档

+
+
+ + README +
+
+ + README (English) +
+
+ + 更新日志 +
+
+ + 声明与注意事项 +
+
+
+
+ + +
+
+
+
+

文档查看

+ +
+
+ +
+
+
@@ -293,10 +432,18 @@ 配置 + +
diff --git a/webui/src/main.js b/webui/src/main.js index 7e3ad3d..abc3579 100644 --- a/webui/src/main.js +++ b/webui/src/main.js @@ -1,5 +1,7 @@ -import { exec } from 'kernelsu'; -import { createIcons, Sun, Settings, Save, Activity, RefreshCw, FileText } from 'lucide'; +import { exec, listPackages, getPackagesInfo } from 'kernelsu'; +import { createIcons, Sun, Settings, Settings2, Save, Activity, RefreshCw, FileText, Smartphone, MoreVertical, Eye, EyeOff, CheckSquare, CheckCheck, Square, Search, Sparkles, Plus, ShieldCheck, Moon, Play, RotateCcw, Monitor, Info, Code, User, BookOpen, X, Globe } from 'lucide'; +import MarkdownIt from 'markdown-it'; +import PinyinMatch from 'pinyin-match'; const CONFIG_DIR = '/data/adb/modules/LuminPro/config'; const PATH_CONFIG_DIR = '/data/adb/modules/LuminPro/config/path'; @@ -454,6 +456,8 @@ async function restartService() { }, 1000); } +let confirmedLowBri = false; + async function handleBrightnessChange(e) { try { const newBri = parseInt(e.target.value, 10); @@ -461,6 +465,25 @@ async function handleBrightnessChange(e) { const sysMaxBri = parseInt(brightnessSlider.max, 10); const percentage = Math.round((newBri / sysMaxBri) * 100); + // 如果试图调低到 5% 以下且未确认过 + if (percentage < 5 && !confirmedLowBri) { + const ok = confirm("⚠️ 警告:亮度低于 5% 可能会导致屏幕近似黑屏,存在操作困难且难以自动恢复的风险。\n\n确定要继续调整到该极低亮度吗?"); + if (ok) { + confirmedLowBri = true; + } else { + // 回退到 5% + const safeVal = Math.ceil(sysMaxBri * 0.05); + e.target.value = safeVal; + handleBrightnessChange(e); // 重新处理 + return; + } + } + + // 如果用户又回到了 5% 以上,重置确认状态,下次再低时再提醒 + if (percentage >= 5) { + confirmedLowBri = false; + } + // 立即更新 UI(不等待文件 IO) document.getElementById('brightness-display').textContent = percentage + '%'; cachedCurrentBri = String(newBri); @@ -622,34 +645,56 @@ async function startAutoRefresh() { // 底栏导航逻辑 function setupNavbar() { + const navbar = document.querySelector('.floating-navbar'); const navbarBtns = document.querySelectorAll('.navbar-btn'); const sections = document.querySelectorAll('.card'); const navbarSlider = document.querySelector('.navbar-slider'); - let sliderFixedWidth = 0; // 固定滑块宽度 - // 更新滑块位置 - function updateSliderPosition(activeBtn) { + let isDragging = false; + let startX = 0; + let currentActiveBtn = null; + let startSliderX = 0; + + // 更新滑块位置 (带平滑过渡) + function updateSliderPosition(activeBtn, useTransition = true) { if (!navbarSlider || !activeBtn) return; - const navbarRect = activeBtn.closest('.floating-navbar').getBoundingClientRect(); - const btnRect = activeBtn.getBoundingClientRect(); + currentActiveBtn = activeBtn; + const sliderLeft = activeBtn.offsetLeft; + const sliderWidth = activeBtn.offsetWidth; - const sliderLeft = btnRect.left - navbarRect.left; - - // 首次设置固定宽度 - if (sliderFixedWidth === 0) { - sliderFixedWidth = btnRect.width; - navbarSlider.style.width = sliderFixedWidth + 'px'; + if (useTransition) { + navbarSlider.style.transition = 'transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), width 0.3s ease'; + } else { + navbarSlider.style.transition = 'none'; } - navbarSlider.style.left = sliderLeft + 'px'; + navbarSlider.style.pointerEvents = 'auto'; + navbarSlider.style.zIndex = '0'; + navbarSlider.style.cursor = 'grab'; + navbarSlider.style.border = '1px solid rgba(var(--md-sys-color-primary-rgb, 168, 199, 250), 0.4)'; + navbarSlider.style.boxShadow = '0 2px 8px rgba(0, 0, 0, 0.1)'; + + navbarSlider.style.width = sliderWidth + 'px'; + navbarSlider.style.transform = `translateX(${sliderLeft}px)`; } // 根据分组显示卡片 function showGroup(groupName) { sections.forEach(section => { const sectionGroup = section.getAttribute('data-nav-group'); - section.style.display = sectionGroup === groupName ? 'block' : 'none'; + if (sectionGroup) { + if (sectionGroup === groupName) { + section.style.display = 'flex'; + // 触发入场动画 + section.classList.remove('card-animate-in'); + void section.offsetWidth; // 强制重绘 + section.classList.add('card-animate-in'); + } else { + section.style.display = 'none'; + section.classList.remove('card-animate-in'); + } + } }); } @@ -660,12 +705,103 @@ function setupNavbar() { updateSliderPosition(btn); } + let hasLoadedApps = false; + + // 拖拽逻辑实现 + if (navbarSlider && navbar) { + let isActuallyDragging = false; + + navbar.addEventListener('pointerdown', (e) => { + // 记录起始位置 + isDragging = true; + isActuallyDragging = false; + startX = e.clientX; + startSliderX = currentActiveBtn ? currentActiveBtn.offsetLeft : 0; + + // 长按时略微放大滑块 + navbarSlider.style.transition = 'transform 0.2s cubic-bezier(0.2, 0, 0, 1), width 0.3s ease'; + const currentX = currentActiveBtn ? currentActiveBtn.offsetLeft : 0; + navbarSlider.style.transform = `translateX(${currentX}px) scale(1.04)`; + }); + + navbar.addEventListener('pointermove', (e) => { + if (!isDragging) return; + const dx = e.clientX - startX; + + // 开启拖拽阈值判断 (防止点击时误触拖动) + if (!isActuallyDragging && Math.abs(dx) > 10) { + isActuallyDragging = true; + // 赋予轻微阻尼感 + navbarSlider.style.transition = 'transform 0.1s cubic-bezier(0.2, 0, 0, 1), width 0.3s ease'; + navbar.setPointerCapture(e.pointerId); + } + + if (!isActuallyDragging) return; + + const targetX = startSliderX + dx; + + // 区域边界限制与阻尼回弹 (Rubber Banding) + const minX = navbarBtns[0].offsetLeft; + const maxX = navbarBtns[navbarBtns.length - 1].offsetLeft; + + let clampedX = targetX; + if (targetX < minX) { + clampedX = minX + (targetX - minX) * 0.3; + } else if (targetX > maxX) { + clampedX = maxX + (targetX - maxX) * 0.3; + } + + navbarSlider.style.transform = `translateX(${clampedX}px) scale(1.04)`; + }); + + navbar.addEventListener('pointerup', (e) => { + if (!isDragging) return; + const wasDragging = isActuallyDragging; + isDragging = false; + isActuallyDragging = false; + + // 恢复正常大小 + navbarSlider.style.transition = 'transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), width 0.3s ease'; + + if (wasDragging) { + navbar.releasePointerCapture(e.pointerId); + + const sliderRect = navbarSlider.getBoundingClientRect(); + const navRect = navbar.getBoundingClientRect(); + const currentX = sliderRect.left - navRect.left; + + let closestBtn = navbarBtns[0]; + let minDist = Infinity; + + navbarBtns.forEach(btn => { + const dist = Math.abs(btn.offsetLeft - currentX); + if (dist < minDist) { + minDist = dist; + closestBtn = btn; + } + }); + + closestBtn.click(); + } else if (currentActiveBtn) { + // 如果没拖动,点击后滑块也会通过 setActiveBtn 正常回缩 + updateSliderPosition(currentActiveBtn); + } + }); + } + // 为每个按钮添加点击监听 navbarBtns.forEach(btn => { btn.addEventListener('click', () => { const groupName = btn.getAttribute('data-section'); showGroup(groupName); setActiveBtn(btn); + + if (groupName === 'apps' && !hasLoadedApps) { + hasLoadedApps = true; + if (typeof loadApps === 'function') { + loadApps(); + } + } }); }); @@ -683,6 +819,175 @@ function setupNavbar() { }); } +let showingSystemApps = true; +let savedBlacklist = new Set(); + +function updateUnsavedStyling() { + const checkboxes = document.querySelectorAll('.app-checkbox'); + checkboxes.forEach(cb => { + if (cb.checked && !savedBlacklist.has(cb.dataset.pkg)) { + cb.classList.add('unsaved'); + } else { + cb.classList.remove('unsaved'); + } + }); +} + +function reorderDOMApps() { + const container = document.getElementById('app-list-container'); + if (!container) return; + const items = Array.from(container.children); + + items.sort((a, b) => { + const aChecked = a.querySelector('.app-checkbox')?.checked || false; + const bChecked = b.querySelector('.app-checkbox')?.checked || false; + if (aChecked && !bChecked) return -1; + if (!aChecked && bChecked) return 1; + return 0; + }); + + items.forEach(item => container.appendChild(item)); +} + +async function loadApps() { + const container = document.getElementById('app-list-container'); + if (!container) return; + container.innerHTML = '
加载中...
'; + + try { + // 读取已保存的黑名单 + const blRes = await runCmd(`cat "${CONFIG_DIR}/blacklist_apps.txt"`); + if (blRes.errno === 0) { + savedBlacklist = new Set(blRes.stdout.trim().split('\n').filter(Boolean)); + } else { + savedBlacklist = new Set(); + } + + const type = showingSystemApps ? "all" : "user"; + const pkgs = await listPackages(type); + let infoList = await getPackagesInfo(pkgs); + + 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) { + // 在无数据时展示一些示例数据,方便在 PC/浏览器中预览样式 + 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 = savedBlacklist.has(app.packageName); + + checkbox.addEventListener('change', () => { + updateUnsavedStyling(); + }); + + const customCheckbox = document.createElement('span'); + customCheckbox.className = 'app-checkbox-custom'; + + checkboxLabel.appendChild(checkbox); + checkboxLabel.appendChild(customCheckbox); + + const iconImg = document.createElement('img'); + iconImg.className = 'app-icon'; + iconImg.src = `ksu://icon/${app.packageName}`; + iconImg.loading = 'lazy'; // 性能优化 + iconImg.onerror = () => { + const fallback = document.createElement('div'); + fallback.className = 'app-icon-fallback'; + fallback.textContent = (app.appLabel || app.packageName || '?').charAt(0).toUpperCase(); + iconImg.replaceWith(fallback); + }; + + const infoDiv = document.createElement('div'); + infoDiv.className = 'app-info'; + + const nameSpan = document.createElement('span'); + nameSpan.className = 'app-name'; + + const nameNode = document.createTextNode(app.appLabel || 'Unknown'); + nameSpan.appendChild(nameNode); + + 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); + + item.appendChild(checkboxLabel); + item.appendChild(iconImg); + item.appendChild(infoDiv); + + 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)}
`; + } +} + async function init() { // 初始化 Lucide 图标 @@ -690,10 +995,28 @@ async function init() { icons: { Sun, Settings, + Settings2, Save, Activity, RefreshCw, - FileText + FileText, + Smartphone, + MoreVertical, + Eye, + EyeOff, + CheckSquare, + CheckCheck, + Square, + Search, + Sparkles, + Plus, + ShieldCheck, + Moon, + Play, + RotateCcw, + Monitor, + Info, + Code, User, BookOpen, X, Globe } }); @@ -775,10 +1098,399 @@ async function init() { setTimeout(autoResize, 0); }); + // 应用列表-下拉菜单控制 + 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 ? '隐藏系统应用' : '显示系统应用'; + + // 更新 Lucide 图标 + 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.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) { + // 对 x 采用更严格的匹配以防误伤字母 x 结尾的应用 + 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.classList.remove('show'); + }); + } + + // 手动添加包名功能 + const btnManualAdd = document.getElementById('btn-manual-add'); + if (btnManualAdd) { + btnManualAdd.addEventListener('click', async () => { + 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 { + // failed to fetch, use default + } + + 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); + + const customCheckbox = document.createElement('span'); + customCheckbox.className = 'app-checkbox-custom'; + + checkboxLabel.appendChild(checkbox); + checkboxLabel.appendChild(customCheckbox); + + const iconImg = document.createElement('img'); + iconImg.className = 'app-icon'; + iconImg.src = `ksu://icon/${realPkg}`; + iconImg.loading = 'lazy'; + iconImg.onerror = () => { + const fallback = document.createElement('div'); + fallback.className = 'app-icon-fallback'; + fallback.textContent = (appData.appLabel || appData.packageName || '?').charAt(0).toUpperCase(); + iconImg.replaceWith(fallback); + }; + + const infoDiv = document.createElement('div'); + infoDiv.className = 'app-info'; + + const nameSpan = document.createElement('span'); + nameSpan.className = 'app-name'; + + const nameNode = document.createTextNode(appData.appLabel || 'Unknown'); + nameSpan.appendChild(nameNode); + + 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); + + item.appendChild(checkboxLabel); + item.appendChild(iconImg); + item.appendChild(infoDiv); + + container.appendChild(item); + + updateUnsavedStyling(); + reorderDOMApps(); + showToast('已成功添加并勾选'); + }); + } + + // 全选功能 + const btnSelectAll = document.getElementById('btn-select-all'); + if (btnSelectAll) { + btnSelectAll.addEventListener('click', () => { + const checkboxes = document.querySelectorAll('.app-checkbox'); + checkboxes.forEach(cb => { + cb.checked = true; + }); + updateUnsavedStyling(); + appsDropdownMenu.classList.remove('show'); + }); + } + + // 全不选功能 + const btnSelectNone = document.getElementById('btn-select-none'); + if (btnSelectNone) { + btnSelectNone.addEventListener('click', () => { + const checkboxes = document.querySelectorAll('.app-checkbox'); + checkboxes.forEach(cb => { + cb.checked = false; + }); + updateUnsavedStyling(); + appsDropdownMenu.classList.remove('show'); + }); + } + + // 反选功能 + const btnInvertSelection = document.getElementById('btn-invert-selection'); + if (btnInvertSelection) { + btnInvertSelection.addEventListener('click', () => { + const checkboxes = document.querySelectorAll('.app-checkbox'); + checkboxes.forEach(cb => { + cb.checked = !cb.checked; + }); + updateUnsavedStyling(); + 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 checkboxes = document.querySelectorAll('.app-checkbox'); + const selectedPkgs = []; + + checkboxes.forEach(cb => { + if (cb.checked) { + selectedPkgs.push(cb.dataset.pkg); + } + }); + + const content = selectedPkgs.join('\n'); + const res = await writeFile(`${CONFIG_DIR}/blacklist_apps.txt`, content); + + if (res.errno === 0 || res.stdout.includes('OK')) { + showToast('黑名单保存成功'); + savedBlacklist = new Set(selectedPkgs); + updateUnsavedStyling(); + reorderDOMApps(); + } else { + showToast('保存失败: ' + res.stderr); + } + }); + } + + // 搜索功能 + 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; + }); + } + + // 全局拦截链接点击,调用系统浏览器 + document.addEventListener('click', async (e) => { + const link = e.target.closest('a'); + if (link && link.getAttribute('href')) { + const url = link.getAttribute('href'); + // 只拦截外部网页链接 + if (url.startsWith('http')) { + e.preventDefault(); + try { + await runCmd(`am start -a android.intent.action.VIEW -d "${url}"`); + } catch (error) { + console.error('Failed to open link:', error); + // 降级原样打开 + window.location.href = url; + } + } + } + }); + + // 文档抽屉面板逻辑 + const md = new MarkdownIt({ + html: true, + linkify: true, + typographer: true + }); + + const docDrawer = document.getElementById('doc-drawer'); + const docBackdrop = document.getElementById('doc-drawer-backdrop'); + const btnCloseDrawer = document.getElementById('btn-close-drawer'); + const drawerTitle = document.getElementById('drawer-title'); + const drawerContent = document.getElementById('drawer-content'); + + // 绑定文档列表项点击 + const docItems = document.querySelectorAll('.about-doc-item'); + docItems.forEach(item => { + item.addEventListener('click', () => { + const fileName = item.dataset.doc; + const label = item.querySelector('span').textContent; + if (drawerTitle) drawerTitle.textContent = label; + openDrawer(fileName); + }); + }); + + if (btnCloseDrawer) { + btnCloseDrawer.addEventListener('click', closeDrawer); + } + + if (docBackdrop) { + docBackdrop.addEventListener('click', closeDrawer); + } + + function openDrawer(fileName) { + if (!docDrawer) return; + docDrawer.classList.add('show'); + if (docBackdrop) docBackdrop.classList.add('show'); + document.body.style.overflow = 'hidden'; // 禁止底层滚动 + loadDoc(fileName); + } + + function closeDrawer() { + if (!docDrawer) return; + docDrawer.classList.remove('show'); + if (docBackdrop) docBackdrop.classList.remove('show'); + document.body.style.overflow = ''; + } + + async function loadDoc(fileName) { + if (!drawerContent) return; + drawerContent.innerHTML = '
正在载入文档...
'; + + try { + const filePath = `/data/adb/modules/LuminPro/${fileName}`; + const res = await runCmd(`cat "${filePath}"`); + + if (res.errno === 0) { + let content = res.stdout; + if (fileName.endsWith('.md')) { + drawerContent.innerHTML = `
${md.render(content)}
`; + } else { + drawerContent.innerHTML = `
${content}
`; + } + drawerContent.scrollTop = 0; + } else { + drawerContent.innerHTML = `
无法读取文件: ${fileName}
(可能模块未安装在默认路径)
`; + } + } catch (e) { + drawerContent.innerHTML = `
解析出错: ${e.message}
`; + } + } + // 初次加载配置 await loadConfig(); // 开启自动刷新状态和日志 (内置了已包含 loadStatus 和 loadLogs) startAutoRefresh(); + + // 页面滚动监听:动态显示顶部模糊 + window.addEventListener('scroll', () => { + const topBlur = document.querySelector('.top-blur'); + if (topBlur) { + if (window.scrollY > 10) { + topBlur.classList.add('scrolled'); + } else { + topBlur.classList.remove('scrolled'); + } + } + }, { passive: true }); } // DOM 加载完成后运行 diff --git a/webui/src/style.css b/webui/src/style.css index 5a33acb..80cd58f 100644 --- a/webui/src/style.css +++ b/webui/src/style.css @@ -1,12 +1,15 @@ :root { --md-sys-color-background: #111318; + --md-sys-color-background-rgb: 17, 19, 24; --md-sys-color-on-background: #e2e2e9; --md-sys-color-surface: #1e1f25; --md-sys-color-surface-container: #212429; --md-sys-color-surface-container-high: #2b2930; + --md-sys-color-surface-container-high-rgb: 43, 41, 48; --md-sys-color-on-surface: #e2e2e9; --md-sys-color-on-surface-variant: #c4c6d0; --md-sys-color-primary: #a8c7fa; + --md-sys-color-primary-rgb: 168, 199, 250; --md-sys-color-on-primary: #062e6f; --md-sys-color-primary-container: #1b4b9b; --md-sys-color-on-primary-container: #d3e3fd; @@ -137,6 +140,13 @@ body::-webkit-scrollbar { text-transform: uppercase; } +.header-status-container { + display: flex; + flex-direction: column; + align-items: flex-end; + gap: 12px; +} + .header-status { display: flex; align-items: center; @@ -144,13 +154,36 @@ body::-webkit-scrollbar { background: var(--md-sys-color-surface-container-high); padding: 8px 16px; border-radius: 12px; - font-size: 0.875rem; + font-size: 0.8125rem; color: var(--md-sys-color-on-surface); font-weight: 500; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08); border: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0, 0, 0), 0.08); } +.header-status-actions { + display: flex; + gap: 16px; +} + +.btn-status-action { + background: transparent; + border: none; + color: var(--md-sys-color-primary); + font-size: 0.8125rem; + font-weight: 600; + cursor: pointer; + padding: 2px 4px; + border-radius: 4px; + transition: all 0.2s; + opacity: 0.9; +} + +.btn-status-action:active { + background-color: var(--md-sys-color-primary-container); + opacity: 1; +} + .status-dot { width: 10px; height: 10px; @@ -197,6 +230,26 @@ body::-webkit-scrollbar { flex-direction: column; } +/* 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); @@ -222,22 +275,30 @@ body::-webkit-scrollbar { margin-bottom: var(--spacing-l); padding: var(--spacing-m); background-color: var(--md-sys-color-surface-container); - border-radius: var(--border-radius-s); + 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 var(--spacing-m) 0; - font-size: 0.875rem; - font-weight: 600; color: var(--md-sys-color-primary); - text-transform: uppercase; - letter-spacing: 0.5px; + font-size: 0.9rem; + 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 { @@ -253,6 +314,8 @@ body::-webkit-scrollbar { .config-item + .config-item { margin-top: var(--spacing-m); + border-top: 1px solid rgba(var(--md-sys-color-outline-variant-rgb, 142, 144, 153), 0.1); + padding-top: var(--spacing-m); } .config-label { @@ -271,17 +334,23 @@ body::-webkit-scrollbar { } .config-input { - background-color: var(--md-sys-color-surface-container-high); - color: var(--md-sys-color-on-surface); - border: 1px solid var(--md-sys-color-outline); - border-radius: var(--border-radius-s); - padding: 8px 12px; - font-size: 1rem; width: 100px; - text-align: right; + 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: border-color 0.2s, box-shadow 0.2s; + 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); } #advanced-section .config-input { @@ -290,30 +359,26 @@ body::-webkit-scrollbar { } .config-textarea { + background-color: var(--md-sys-color-surface-container-high); width: 100%; min-height: 60px; max-height: 300px; - padding: 8px 12px; - font-family: 'Geist', system-ui, monospace; - font-size: 0.875rem; - background-color: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface); - border: 1px solid var(--md-sys-color-outline); - border-radius: var(--border-radius-s); + border: 1px solid var(--md-sys-color-outline-variant); + border-radius: var(--border-radius-m); resize: vertical; + padding: 10px 14px; + font-family: 'Google Sans Code', system-ui, monospace; + font-size: 0.875rem; line-height: 1.4; - transition: border-color 0.2s, box-shadow 0.2s; + transition: all 0.2s ease; + outline: none; } .config-textarea:focus { - outline: none; border-color: var(--md-sys-color-primary); - box-shadow: 0 0 0 2px rgba(168, 199, 250, 0.3); -} - -.config-input:focus { - border-color: var(--md-sys-color-primary); - box-shadow: 0 0 0 2px rgba(168, 199, 250, 0.3); + 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 { @@ -433,22 +498,41 @@ input:checked + .slider:before { } .status-item { - display: flex; - flex-direction: column; background-color: var(--md-sys-color-surface-container); padding: var(--spacing-m); - border-radius: var(--border-radius-s); + 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; - color: var(--md-sys-color-on-surface-variant); - margin-bottom: 4px; + font-weight: 500; } .status-value { font-size: 1.125rem; - font-weight: 500; + font-weight: 600; color: var(--md-sys-color-primary); word-break: break-all; } @@ -575,7 +659,7 @@ input:checked + .slider:before { justify-content: space-between; align-items: center; padding: var(--spacing-s) var(--spacing-m); - background-color: rgba(168, 199, 250, 0.08); + background-color: rgba(var(--md-sys-color-primary-rgb), 0.08); border-radius: var(--border-radius-s); } @@ -673,14 +757,251 @@ input:checked + .slider:before { justify-content: center; } -.btn-icon-only:active { +.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; } +/* About section */ +.about-links { + display: flex; + flex-direction: column; + gap: var(--spacing-m); +} + +.about-link-item { + background-color: var(--md-sys-color-surface-container); + padding: 16px; + border-radius: var(--border-radius-m); + display: flex; + align-items: center; + gap: 16px; + text-decoration: none; + color: var(--md-sys-color-on-surface); + border: 1px solid rgba(var(--md-sys-color-primary-rgb), 0.05); + transition: all 0.2s; +} + +.about-link-item:active { + background-color: var(--md-sys-color-surface-container-high); + transform: scale(0.98); +} + +.about-link-item svg { + color: var(--md-sys-color-primary); + width: 24px; + height: 24px; +} + +.link-info { + display: flex; + flex-direction: column; +} + +.link-label { + font-weight: 600; + font-size: 0.9375rem; +} + +.link-url { + font-size: 0.75rem; + color: var(--md-sys-color-on-surface-variant); +} + +.about-doc-list { + display: grid; + grid-template-columns: 1fr 1fr; + gap: var(--spacing-m); +} + +.about-doc-item { + background-color: var(--md-sys-color-surface-container-high); + padding: 16px; + border-radius: var(--border-radius-m); + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 8px; + cursor: pointer; + border: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0,0,0), 0.05); + transition: all 0.2s; + text-align: center; +} + +.about-doc-item:active { + background-color: var(--md-sys-color-primary-container); + transform: scale(0.95); +} + +.about-doc-item svg { + color: var(--md-sys-color-primary); + opacity: 0.8; +} + +.about-doc-item span { + font-size: 0.8125rem; + font-weight: 600; + color: var(--md-sys-color-on-surface); +} + +/* Document Drawer (Bottom Sheet) */ +.doc-drawer { + position: fixed; + left: 0; + right: 0; + bottom: 0; + height: 90vh; + background-color: var(--md-sys-color-surface-container-high); + z-index: 2000; + display: flex; + flex-direction: column; + transform: translateY(100%); + transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1); + border-radius: 28px 28px 0 0; + box-shadow: 0 -8px 32px rgba(0,0,0,0.3); + overflow: hidden; +} + +.doc-drawer.show { + transform: translateY(0); +} + +.drawer-backdrop { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: rgba(0,0,0,0.5); + backdrop-filter: blur(4px); + z-index: 1999; + opacity: 0; + pointer-events: none; + transition: opacity 0.3s ease; +} + +.drawer-backdrop.show { + opacity: 1; + pointer-events: auto; +} + +.drawer-handle { + width: 32px; + height: 4px; + background-color: var(--md-sys-color-outline-variant); + border-radius: 2px; + margin: 12px auto 4px auto; + opacity: 0.5; +} + +.drawer-header { + height: 56px; + padding: 0 16px; + display: flex; + align-items: center; + gap: 16px; + background-color: transparent; + border-bottom: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0,0,0), 0.05); +} + +.drawer-header h2 { + font-size: 1.125rem; + font-weight: 600; + color: var(--md-sys-color-on-surface); + margin: 0; + flex: 1; +} + +.drawer-content { + flex: 1; + overflow-y: auto; + padding: 32px 24px 64px 24px; + line-height: 1.7; +} + +.doc-loading { + text-align: center; + padding: 64px 20px; + color: var(--md-sys-color-on-surface-variant); +} + +/* Markdown Rendering */ +.markdown-body { + color: var(--md-sys-color-on-surface); +} + +.markdown-body h1, .markdown-body h2, .markdown-body h3 { + color: var(--md-sys-color-primary); + margin-top: 1.5em; + margin-bottom: 0.5em; +} + +.markdown-body p { + margin-bottom: 1em; +} + +.markdown-body code { + background-color: var(--md-sys-color-surface-container-high); + padding: 2px 6px; + border-radius: 4px; + font-family: 'Google Sans Code', monospace; + font-size: 0.9em; +} + +.markdown-body pre { + background-color: #0d0e12; + padding: 16px; + border-radius: 12px; + overflow-x: auto; + margin-bottom: 1.5em; + border: 1px solid rgba(255,255,255,0.05); +} + +.markdown-body pre code { + background: transparent; + padding: 0; + font-size: 0.8125rem; +} + +.markdown-body ul, .markdown-body ol { + padding-left: 1.5em; + margin-bottom: 1em; +} + +.markdown-body blockquote { + border-left: 4px solid var(--md-sys-color-primary); + padding-left: 16px; + margin: 0 0 16px 0; + color: var(--md-sys-color-on-surface-variant); + background-color: var(--md-sys-color-surface-container); + padding: 12px 16px; + border-radius: 0 8px 8px 0; +} + @keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } @@ -688,41 +1009,50 @@ input:checked + .slider:before { /* Logs */ .log-output { - font-family: 'Google Sans Code', 'Consolas', 'Courier New', monospace; - font-size: 0.75rem; - padding: var(--spacing-s); - border-radius: var(--border-radius-s); + font-family: 'Google Sans Code', 'JetBrains Mono', 'Consolas', monospace; + font-size: 0.8125rem; + padding: var(--spacing-m); + background-color: #0d0e12; + color: #e3e3e3; + border-radius: var(--border-radius-m); + border: 1px solid rgba(255, 255, 255, 0.05); flex: 1; - min-height: 300px; + max-height: 60vh; overflow-y: auto; margin: 0; white-space: pre-wrap; word-wrap: break-word; - scrollbar-width: none; /* Firefox */ - -ms-overflow-style: none; /* IE/Edge */ + line-height: 1.5; + scrollbar-width: thin; + scrollbar-color: var(--md-sys-color-outline-variant) transparent; +} + +.log-output::-webkit-scrollbar { + width: 4px; +} + +.log-output::-webkit-scrollbar-thumb { + background-color: var(--md-sys-color-outline-variant); + border-radius: 4px; } .log-filter-select { - padding: 4px 10px; + padding: 0 12px; border: 1px solid var(--md-sys-color-outline-variant); - border-radius: var(--border-radius-s); - background-color: var(--md-sys-color-surface); + border-radius: 8px; + background-color: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface); font-family: inherit; - font-size: 0.75rem; - height: 28px; + font-size: 0.8125rem; + height: 32px; cursor: pointer; - transition: border-color 0.2s; -} - -.log-filter-select:hover { - border-color: var(--md-sys-color-on-surface); + outline: none; + transition: all 0.22s ease; } .log-filter-select:focus { - outline: none; border-color: var(--md-sys-color-primary); - box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2); + box-shadow: 0 0 0 2px rgba(var(--md-sys-color-primary-rgb), 0.2); } .log-output::-webkit-scrollbar { @@ -730,6 +1060,45 @@ input:checked + .slider:before { } /* Simple Toast */ +.top-blur { + position: fixed; + top: 0; + left: 0; + right: 0; + height: calc(85px + var(--safe-area-inset-top, 0px)); + z-index: 998; + pointer-events: none; + /* 基础暗色背景,增强状态栏文字可读性 */ + background: linear-gradient(to bottom, + rgba(var(--md-sys-color-background-rgb, 17, 19, 24), 0.85) 0%, + rgba(var(--md-sys-color-background-rgb, 17, 19, 24), 0.4) 40%, + rgba(var(--md-sys-color-background-rgb, 17, 19, 24), 0) 100% + ); + /* 核心:毛玻璃滤镜 */ + -webkit-backdrop-filter: blur(16px); + backdrop-filter: blur(16px); + /* 梯度蒙版:越往上越模糊的核心逻辑 */ + -webkit-mask-image: linear-gradient(to bottom, + rgba(0,0,0,1) 0%, + rgba(0,0,0,1) 30%, + rgba(0,0,0,0.7) 60%, + rgba(0,0,0,0) 100% + ); + mask-image: linear-gradient(to bottom, + rgba(0,0,0,1) 0%, + rgba(0,0,0,1) 30%, + rgba(0,0,0,0.7) 60%, + rgba(0,0,0,0) 100% + ); + transform: translateZ(0); /* 开启 GPU 加速 */ + opacity: 0; + transition: opacity 0.3s ease; +} + +.top-blur.scrolled { + opacity: 1; +} + .toast { position: fixed; bottom: 24px; @@ -755,33 +1124,46 @@ input:checked + .slider:before { /* Floating Navigation Bar */ .floating-navbar { position: fixed; - bottom: 16px; + bottom: calc(18px + var(--safe-area-inset-bottom, 0px)); left: 50%; - transform: translateX(-50%); + transform: translateX(-50%) translateZ(0); /* 居中并开启硬件加速 */ display: flex; justify-content: center; align-items: center; - gap: 12px; - background-color: var(--md-sys-color-surface-container-high); - backdrop-filter: blur(10px); - padding: 12px 20px; + gap: 8px; + background: rgba(var(--md-sys-color-surface-container-high-rgb, 43, 41, 48), 0.6); + -webkit-backdrop-filter: blur(20px) saturate(180%); + backdrop-filter: blur(20px) saturate(180%); + will-change: backdrop-filter; + padding: 8px 16px; border-radius: 28px; - box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 8px 24px rgba(0, 0, 0, 0.2); + border: 1px solid rgba(255, 255, 255, 0.08); + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 8px 32px rgba(0, 0, 0, 0.3); z-index: 999; width: fit-content; max-width: calc(100% - 32px); + user-select: none; + -webkit-user-select: none; + -webkit-tap-highlight-color: transparent; + touch-action: none; /* Prevents browser scroll during drag */ } .navbar-slider { position: absolute; - height: 32px; - border-radius: 12px; - background-color: rgba(var(--md-sys-color-primary-rgb, 103, 58, 183), 0.2); - border: 1px solid rgba(var(--md-sys-color-primary-rgb, 103, 58, 183), 0.3); - transition: left 0.35s ease-out, width 0.35s ease-out, background-color 0.35s ease-out, box-shadow 0.35s ease-out; + left: 0; + top: 8px; + bottom: 8px; + height: auto; + background: rgba(var(--md-sys-color-primary-rgb, 168, 199, 250), 0.35); + -webkit-backdrop-filter: blur(8px) saturate(120%); + backdrop-filter: blur(8px) saturate(120%); + transform: translateZ(0); + border-radius: 20px; + transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), width 0.3s ease; pointer-events: none; - z-index: -1; - box-shadow: inset 0 2px 4px rgba(var(--md-sys-color-primary-rgb, 103, 58, 183), 0.15), 0 1px 3px rgba(var(--md-sys-color-primary-rgb, 103, 58, 183), 0.1); + z-index: 0; + border: 1px solid rgba(var(--md-sys-color-primary-rgb, 168, 199, 250), 0.4); + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); } .navbar-btn { @@ -789,8 +1171,8 @@ input:checked + .slider:before { flex-direction: column; align-items: center; justify-content: center; - gap: 4px; - padding: 10px 20px; + gap: 5px; + padding: 6px 12px; background-color: transparent; border: none; color: var(--md-sys-color-on-surface-variant); @@ -801,20 +1183,289 @@ input:checked + .slider:before { flex: 1; max-width: 90px; white-space: nowrap; + position: relative; + z-index: 1; } -.navbar-btn i { - font-size: 1.25rem; +.navbar-btn i, .navbar-btn svg { + width: 20px; + height: 20px; display: flex; align-items: center; justify-content: center; } +.navbar-btn span { + font-size: 0.75rem; +} + .navbar-btn:active { - background-color: var(--md-sys-color-surface-container); + /* No scaling here, we rely on the slider feedback */ } .navbar-btn.active { - background-color: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); } + +/* Dropdown Menu */ +.dropdown-container { + position: relative; +} + +.dropdown-menu { + position: absolute; + top: 100%; + right: 0; + margin-top: 8px; + background-color: var(--md-sys-color-surface-container-high); + border: 1px solid var(--md-sys-color-outline-variant); + border-radius: var(--border-radius-s); + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); + min-width: 160px; + opacity: 0; + visibility: hidden; + transform: translateY(-8px); + transition: all 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28); + z-index: 100; + display: flex; + flex-direction: column; + padding: 4px; +} + +.dropdown-menu.show { + opacity: 1; + visibility: visible; + transform: translateY(0); +} + +.dropdown-item { + display: flex; + align-items: center; + gap: 12px; + padding: 10px 12px; + border-radius: 4px; + cursor: pointer; + color: var(--md-sys-color-on-surface); + font-size: 0.875rem; + transition: background-color 0.2s; +} + +.dropdown-item:hover { + background-color: var(--md-sys-color-surface-container); +} + +.dropdown-item:active { + background-color: var(--md-sys-color-surface); +} + +.dropdown-item svg { + color: var(--md-sys-color-primary); + width: 18px; + height: 18px; +} + +.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 { + display: flex; + flex-direction: column; + gap: var(--spacing-s); + max-height: 60vh; + overflow-y: auto; + border-radius: var(--border-radius-m); + padding: 0; +} + +.app-list-container::-webkit-scrollbar { + display: none; +} + +.app-list-item { + display: flex; + align-items: center; + gap: var(--spacing-m); + padding: var(--spacing-s) var(--spacing-m); + background-color: var(--md-sys-color-surface-container-high); + border-radius: var(--border-radius-s); + transition: background-color 0.2s; +} + +.app-list-item: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: 'Google Sans Code', 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: 'Google Sans Code', monospace; + margin-left: 6px; + vertical-align: middle; +}