diff --git a/release/0.1.10/RELEASE_NOTES.md b/release/0.1.10/RELEASE_NOTES.md index 1059559..fc310f8 100644 --- a/release/0.1.10/RELEASE_NOTES.md +++ b/release/0.1.10/RELEASE_NOTES.md @@ -21,6 +21,8 @@ Squid 0.1.10 更新说明 开着时 Squid 全家 CPU 占用接近 0%。 修复 +- 权限管理:开机启动项每个子行不再重复显示软件图标(图标只在软件分组标题 + 出现一次,子行文字与标题对齐)。 - 空间清理:修复扫描后分类卡片与复选框全部不可点击的问题(勾选状态没有 进入结果列表的派生缓存,点击后视图停留在扫描瞬间);「可选」角标不再 遮挡复选框。 @@ -36,6 +38,11 @@ Squid 0.1.10 更新说明 左键也会弹菜单)。 调整 +- 空间清理改版(参照电脑管家布局):取消「分类卡片 + 下方大列表」双层 + 结构,分类即列表、一屏一层;分「已为你默认勾选 / 需要你手动勾选」两区, + 点击分类行展开该分类子项(再点收起),点击子项整行直接在资源管理器中 + 定位文件位置,只有点小方框才改勾选;顶部常驻「已选中 xxx 可清理文件」 + 汇总条(取消全选 / 立即清理随时可点)。 - 「日常清理」与「深度清理」合并为一个「空间清理」页:一次扫描同时检查缓存 垃圾与项目构建目录,结果汇总为一份清单。默认只勾选日常清理项,「升级安装 包 / 项目产物 / 开发文件」三类为可选(虚线卡片 + 可选角标),勾选后与日常 diff --git a/release/0.1.10/SHA256SUMS.txt b/release/0.1.10/SHA256SUMS.txt index 85c291f..924703e 100644 --- a/release/0.1.10/SHA256SUMS.txt +++ b/release/0.1.10/SHA256SUMS.txt @@ -1,2 +1,2 @@ -eb0d0740f3dcb0faa1f95323195d90d907271572de54481acafbb65550b53d7c Squid-Setup-0.1.10-win-x64.exe -35f68b65cee48b25aef2b9bc20db7bdc34cae8e77bc85e546a406df3c151a525 Squid-0.1.10-portable-win-x64.zip \ No newline at end of file +e921f7596389d76ac5636db348d7b3148f74544aea2e2b1845a14eab5d9f22c8 Squid-Setup-0.1.10-win-x64.exe +3dce7e37d64d9edff0099effa47d3f9ae6f57f6cd3de12703b67ded02323ef1e Squid-0.1.10-portable-win-x64.zip \ No newline at end of file diff --git a/release/0.1.10/Squid-Setup-0.1.10-win-x64.exe b/release/0.1.10/Squid-Setup-0.1.10-win-x64.exe index ed37095..20d6dbd 100644 Binary files a/release/0.1.10/Squid-Setup-0.1.10-win-x64.exe and b/release/0.1.10/Squid-Setup-0.1.10-win-x64.exe differ diff --git a/release/0.1.10/squid-update.json b/release/0.1.10/squid-update.json index 5116662..73b689b 100644 --- a/release/0.1.10/squid-update.json +++ b/release/0.1.10/squid-update.json @@ -2,12 +2,12 @@ "schema": 1, "version": "0.1.10", "date": "2026-11-19", - "notes": "Squid 0.1.10\n\n新增\n- 清理新增「升级安装包」分类:找出应用升级完成后留在 AppData 里的安装包\n (微信、企业微信、WPS、网易邮箱等已知应用精确规则 + AppData 启发式扫描)。\n 只匹配安装包形态(exe/msi/zip/7z 等)且放置超过 7 天的文件,微信运行库组件\n 不会被误删;应用正在运行时相关安装包自动锁定。删除确认时会提示升级包数量\n 与大小,可一键「跳过升级包,只删其余」。\n- 桌面小工具新增「CPU」面板:总体占用率历史曲线 + 整行渐变占用柱,一根柱对应\n 一个逻辑核心;柱色随占用率在绿→黄→橙→红之间连续渐变(含柱内纵向微渐变),\n 悬停显示「核心 N: xx%」(编号与任务管理器一致从 0 开始);核心较多时柱宽自动\n 收窄。管理页与桌面设置弹层可独立开关该面板。\n\n优化\n- 桌面常驻 CPU 占用大幅下降(实测本机构从约 8.5% 全机总占用降至 0.2%):\n 小工具改用轻量采样(跳过全机逐进程枚举,那是旧版每秒最贵的一步)、两个\n 窗口共享同一次采样、小工具折叠或主窗口收进托盘后完全停止采样。实时监控\n 页打开时才有完整进程表,功能不受影响。\n- 修复小工具窗口自身的自适应尺寸回环(尺寸→重锚定→再触发自适应无限循环),\n 该回环会让主进程与小工具渲染进程空转互叫并频繁写配置文件;修复后小工具\n 开着时 Squid 全家 CPU 占用接近 0%。\n\n修复\n- 空间清理:修复扫描后分类卡片与复选框全部不可点击的问题(勾选状态没有进入结果列表的派生缓存,点击后视图停留在扫描瞬间);「可选」角标不再遮挡复选框。\n- 权限管理:修复大量启动项/服务显示通用图标的问题——服务壳程序(如微软 Edge 提权服务、电脑管家 qmbsrv、H3C SpaceAgent)自身不含图标资源,现改为回退读取注册表 App Paths、卸载信息 DisplayIcon 与同目录主程序图标。\n- 深度清理:默认检查目录(~/code 等 macOS 风格)在本机全都不存在时不再报\n 「请先选择目录」,自动回退到用户主目录扫描;「要检查的项目目录」旁新增\n 「浏览…」按钮可直接多选文件夹;扫描出错信息此前会被静默吞掉,现在会以\n 红色横幅显示。\n- 托盘交互:左键单击/双击图标 = 直接打开主界面,右键 = 弹出菜单(原先\n 左键也会弹菜单)。\n\n调整\n- 「日常清理」与「深度清理」合并为一个「空间清理」页:一次扫描同时检查缓存\n 垃圾与项目构建目录,结果汇总为一份清单。默认只勾选日常清理项,「升级安装\n 包 / 项目产物 / 开发文件」三类为可选(虚线卡片 + 可选角标),勾选后与日常\n 项合并成一次清理。深度扫描目录、文件年龄(3/7/30 天)、Git 保护收进页面\n 顶部设置栏;扫描与删除全程有步骤条与实时进度;侧边栏与托盘菜单同步精简,\n 快捷键重排(Ctrl+2 = 空间清理)。\n- 桌面小工具 Win+D 常驻:按下「显示桌面」后小工具约 2 秒内自动回到桌面\n (窗口保持桌面层:在壁纸与图标之上、其他软件窗口之下;自己关闭/折叠\n 不会把它叫回来)。\n- Windows 上所有「废纸篓」文案改为「回收站」(清理、卸载、历史、设置等随系统\n 名称联动);macOS 仍为「废纸篓」。", + "notes": "Squid 0.1.10\n\n新增\n- 清理新增「升级安装包」分类:找出应用升级完成后留在 AppData 里的安装包\n (微信、企业微信、WPS、网易邮箱等已知应用精确规则 + AppData 启发式扫描)。\n 只匹配安装包形态(exe/msi/zip/7z 等)且放置超过 7 天的文件,微信运行库组件\n 不会被误删;应用正在运行时相关安装包自动锁定。删除确认时会提示升级包数量\n 与大小,可一键「跳过升级包,只删其余」。\n- 桌面小工具新增「CPU」面板:总体占用率历史曲线 + 整行渐变占用柱,一根柱对应\n 一个逻辑核心;柱色随占用率在绿→黄→橙→红之间连续渐变(含柱内纵向微渐变),\n 悬停显示「核心 N: xx%」(编号与任务管理器一致从 0 开始);核心较多时柱宽自动\n 收窄。管理页与桌面设置弹层可独立开关该面板。\n\n优化\n- 桌面常驻 CPU 占用大幅下降(实测本机构从约 8.5% 全机总占用降至 0.2%):\n 小工具改用轻量采样(跳过全机逐进程枚举,那是旧版每秒最贵的一步)、两个\n 窗口共享同一次采样、小工具折叠或主窗口收进托盘后完全停止采样。实时监控\n 页打开时才有完整进程表,功能不受影响。\n- 修复小工具窗口自身的自适应尺寸回环(尺寸→重锚定→再触发自适应无限循环),\n 该回环会让主进程与小工具渲染进程空转互叫并频繁写配置文件;修复后小工具\n 开着时 Squid 全家 CPU 占用接近 0%。\n\n修复\n- 权限管理:开机启动项每个子行不再重复显示软件图标(图标只在软件分组标题出现一次,子行文字与标题对齐)。\n- 空间清理:修复扫描后分类卡片与复选框全部不可点击的问题(勾选状态没有进入结果列表的派生缓存,点击后视图停留在扫描瞬间);「可选」角标不再遮挡复选框。\n- 权限管理:修复大量启动项/服务显示通用图标的问题——服务壳程序(如微软 Edge 提权服务、电脑管家 qmbsrv、H3C SpaceAgent)自身不含图标资源,现改为回退读取注册表 App Paths、卸载信息 DisplayIcon 与同目录主程序图标。\n- 深度清理:默认检查目录(~/code 等 macOS 风格)在本机全都不存在时不再报\n 「请先选择目录」,自动回退到用户主目录扫描;「要检查的项目目录」旁新增\n 「浏览…」按钮可直接多选文件夹;扫描出错信息此前会被静默吞掉,现在会以\n 红色横幅显示。\n- 托盘交互:左键单击/双击图标 = 直接打开主界面,右键 = 弹出菜单(原先\n 左键也会弹菜单)。\n\n调整\n- 空间清理改版(参照电脑管家布局):取消「分类卡片 + 下方大列表」双层结构,分类即列表、一屏一层;分「已为你默认勾选 / 需要你手动勾选」两区,点击分类行展开该分类子项(再点收起),点击子项整行直接在资源管理器中定位文件位置,只有点小方框才改勾选;顶部常驻「已选中 xxx 可清理文件」汇总条(取消全选/立即清理随时可点)。\n- 「日常清理」与「深度清理」合并为一个「空间清理」页:一次扫描同时检查缓存\n 垃圾与项目构建目录,结果汇总为一份清单。默认只勾选日常清理项,「升级安装\n 包 / 项目产物 / 开发文件」三类为可选(虚线卡片 + 可选角标),勾选后与日常\n 项合并成一次清理。深度扫描目录、文件年龄(3/7/30 天)、Git 保护收进页面\n 顶部设置栏;扫描与删除全程有步骤条与实时进度;侧边栏与托盘菜单同步精简,\n 快捷键重排(Ctrl+2 = 空间清理)。\n- 桌面小工具 Win+D 常驻:按下「显示桌面」后小工具约 2 秒内自动回到桌面\n (窗口保持桌面层:在壁纸与图标之上、其他软件窗口之下;自己关闭/折叠\n 不会把它叫回来)。\n- Windows 上所有「废纸篓」文案改为「回收站」(清理、卸载、历史、设置等随系统\n 名称联动);macOS 仍为「废纸篓」。", "artifacts": { "windows": { "file": "Squid-Setup-0.1.10-win-x64.exe", - "sha256": "eb0d0740f3dcb0faa1f95323195d90d907271572de54481acafbb65550b53d7c", - "size": 3576785 + "sha256": "e921f7596389d76ac5636db348d7b3148f74544aea2e2b1845a14eab5d9f22c8", + "size": 3578666 } } } \ No newline at end of file diff --git a/src/components/CleanupView.tsx b/src/components/CleanupView.tsx index e622b59..a760cb3 100644 --- a/src/components/CleanupView.tsx +++ b/src/components/CleanupView.tsx @@ -1,33 +1,6 @@ -import { - ArrowUpRight, - DownloadCloud, - FolderOpen, - LockKeyhole, - RotateCcw, - ShieldCheck, - Trash2, -} from "lucide-react"; -import { useEffect, useMemo, useState } from "react"; -import { useI18n } from "../i18n"; -import { api } from "../lib/api"; -import { formatBytes, formatCount, shortPath } from "../lib/format"; -import type { Category, CleanupItem, DeleteMode, ScanResult } from "../types"; -import type { ScanWorkspace } from "../hooks/useScanWorkspace"; -import { - Button, - CATEGORY_META, - CATEGORY_ORDER, - CategoryCard, - Checkbox, - ConfirmDialog, - InlineError, - ProgressCard, - ResultSummary, - SectionTitle, - categoryLabel, - lockLabel, - useToast, -} from "./ui"; +import { useMemo } from "react"; +import type { Category, ScanResult } from "../types"; +import { CATEGORY_ORDER, CategoryCard } from "./ui"; type CategoryGroup = { total: number; count: number; items: number[]; selected: number }; @@ -49,6 +22,7 @@ function grouped(result: ScanResult) { return groups; } +/* Overview 页的分类速览:紧凑卡片一排,点击跳转空间清理页。 */ export function CategorySummary({ result, selected, @@ -83,377 +57,3 @@ export function CategorySummary({ ); } - -export function ItemRow({ - item, - checked, - onToggle, -}: { - item: CleanupItem; - checked: boolean; - onToggle: () => void; -}) { - const { lang, t, bin } = useI18n(); - const Icon = CATEGORY_META[item.category].icon; - return ( -
- - - - - - - {item.label} - {categoryLabel(item.category, lang, bin)} - - - {shortPath(item.displayPath, 90)} - - {item.lock || item.note ? ( - - {item.lock ? : null} - {item.lock ? lockLabel(item.lock, t) : item.note} - - ) : null} - - {formatBytes(item.onDisk)} - -
- ); -} - -export function CleanupInventory({ - workspace, - defaultMode, - onHistory, -}: { - workspace: ScanWorkspace; - defaultMode: DeleteMode; - onHistory: () => void; -}) { - const { t, lang, bin } = useI18n(); - const { push } = useToast(); - const [focus, setFocus] = useState(null); - const [confirming, setConfirming] = useState(false); - const [mode, setMode] = useState(defaultMode); - - useEffect(() => setMode(defaultMode), [defaultMode]); - - const result = workspace.result; - const groups = useMemo( - () => (result ? grouped(result) : new Map()), - [result], - ); - const visibleItems = useMemo(() => { - if (!result) return []; - return result.items - .map((item, index) => ({ item, index })) - .filter(({ item }) => !focus || item.category === focus); - }, [focus, result]); - const removables = result?.items.filter((item) => !item.lock).length ?? 0; - - // 升级安装包:selection may include stale update packages; the confirm - // dialog offers a one-click "delete everything else, keep these" escape. - const selectedUpdaters = useMemo(() => { - if (!result) return { indexes: [] as number[], total: 0 }; - let total = 0; - const indexes: number[] = []; - result.items.forEach((item, index) => { - if (item.category === "update-installers" && workspace.selected.has(index)) { - indexes.push(index); - total += item.onDisk; - } - }); - return { indexes, total }; - }, [result, workspace.selected]); - - if (workspace.scanning) { - return ( - void workspace.cancel()} - /> - ); - } - - if (workspace.summary) { - return ( - void workspace.runScan()} - onHistory={onHistory} - /> - ); - } - - if (!result) return null; - - const confirm = async (indexes?: number[]) => { - const summary = await workspace.clean(mode, indexes); - setConfirming(false); - if (summary) { - push( - t( - `${formatBytes(summary.freedAllocated || summary.freed)} cleaned`, - `已清理 ${formatBytes(summary.freedAllocated || summary.freed)}`, - ), - "success", - ); - } - }; - - return ( - <> -
-
- - - {t("Scan complete", "扫描完成")} - -

- {formatBytes(workspace.selectedTotal)} - {t(" ready to clean", " 可安全清理")} -

-

- {t( - `${formatCount(workspace.selectedCount)} of ${formatCount( - removables, - )} available items selected`, - `已选择 ${formatCount(workspace.selectedCount)} / ${formatCount( - removables, - )} 个可清理项目`, - )} - {result.unreadable > 0 - ? t( - ` · ${formatCount(result.unreadable)} could not be read`, - ` · ${formatCount(result.unreadable)} 项无法读取`, - ) - : ""} -

-
-
- - -
-
- - {workspace.error ? ( - - ) : null} - -
- {CATEGORY_ORDER.filter((category) => groups.has(category)).map((category) => { - const group = groups.get(category); - if (!group) return null; - const indexes = group.items.filter((index) => !result.items[index].lock); - const allSelected = - indexes.length > 0 && indexes.every((index) => workspace.selected.has(index)); - return ( - workspace.toggleCategory(category)} - onInspect={() => setFocus(focus === category ? null : category)} - /> - ); - })} -
- -
- setFocus(null)}> - {t("Show all", "显示全部")} - - ) : ( - - ) - } - /> -
- {visibleItems.map(({ item, index }) => ( - workspace.toggleItem(index)} - /> - ))} -
-
- -
-
- {t("Selected for cleanup", "已选择清理")} - {formatBytes(workspace.selectedTotal)} -
-
- - -
-
- - - {t( - `${formatCount(workspace.selectedCount)} items · ${formatBytes( - workspace.selectedTotal, - )}`, - `${formatCount(workspace.selectedCount)} 项 · ${formatBytes( - workspace.selectedTotal, - )}`, - )} - - } - note={ - mode === "trash" - ? t( - `Items will move to the ${bin}. You can restore them from History.`, - `文件将移入${bin},之后可从历史记录中还原。`, - ) - : t( - "Permanent removal cannot be undone. Squid re-checks every path before deleting it.", - "永久删除无法撤销。Squid 会在删除前重新检查每一个路径。", - ) - } - confirmLabel={ - mode === "trash" - ? t(`Move to ${bin}`, `移入${bin}`) - : t("Remove permanently", "永久删除") - } - cancelLabel={t("Keep files", "保留文件")} - onConfirm={() => void confirm()} - onClose={() => setConfirming(false)} - busy={workspace.deleting} - icon={} - > -
- - -
- {selectedUpdaters.indexes.length > 0 ? ( -
- -
- - {t( - `Includes ${formatCount(selectedUpdaters.indexes.length)} update installers (${formatBytes(selectedUpdaters.total)})`, - `其中包含 ${formatCount(selectedUpdaters.indexes.length)} 个升级安装包(${formatBytes(selectedUpdaters.total)})`, - )} - - - {t( - "Apps re-download them when needed. Delete them too?", - "应用需要时会自动重新下载。要一并清理吗?", - )} - -
- -
- ) : null} -
- - ); -} diff --git a/src/pages/PermissionsPage.tsx b/src/pages/PermissionsPage.tsx index c4e8ea5..3be4fbe 100644 --- a/src/pages/PermissionsPage.tsx +++ b/src/pages/PermissionsPage.tsx @@ -226,8 +226,7 @@ export function PermissionsPage({ workspace }: { workspace: PermissionsWorkspace className={`settings-row ${workspace.busyId === item.id ? "is-busy" : ""}`} key={item.id} > -
- +
{item.name} diff --git a/src/pages/SpacePage.tsx b/src/pages/SpacePage.tsx index e30b031..3d6f08e 100644 --- a/src/pages/SpacePage.tsx +++ b/src/pages/SpacePage.tsx @@ -7,17 +7,24 @@ * three optional groups (升级安装包 / 项目产物 / 开发文件) start untouched * and join the same delete run when the user checks their card. */ import { + ArrowUpRight, + ChevronRight, DownloadCloud, FolderOpen, ScanSearch, - ShieldCheck, Trash2, } from "lucide-react"; import { open } from "@tauri-apps/plugin-dialog"; -import { useCallback, useEffect, useMemo, useRef, useState } from "react"; +import { + useCallback, + useEffect, + useMemo, + useRef, + useState, +} from "react"; import { useI18n } from "../i18n"; import { api } from "../lib/api"; -import { formatBytes, formatCount } from "../lib/format"; +import { formatBytes, formatCount, shortPath } from "../lib/format"; import type { Bootstrap, Category, @@ -26,17 +33,18 @@ import type { DeleteResult, } from "../types"; import type { ScanWorkspace } from "../hooks/useScanWorkspace"; -import { ItemRow } from "../components/CleanupView"; import { Button, + CATEGORY_META, CATEGORY_ORDER, - CategoryCard, + Checkbox, ConfirmDialog, InlineError, ProgressCard, SectionTitle, Toggle, categoryLabel, + lockLabel, useToast, } from "../components/ui"; @@ -55,6 +63,40 @@ type Entry = { const AGE_CHOICES = [3, 7, 30]; +/* One candidate inside an expanded category. The whole row reveals the path + * in Explorer (电脑管家 habit: 点击定位); only the tick box changes the + * selection, so browsing never mis-toggles. */ +function AccItem({ entry }: { entry: Entry }) { + const { t } = useI18n(); + const { item, source, index } = entry; + const checked = source.selected.has(index); + return ( +
void api.revealPath(item.path).catch(() => undefined)} + title={t("Open the location in Explorer", "在资源管理器中打开所在位置")} + > + source.toggleItem(index)} + label={item.label} + /> + {item.label} + + {shortPath(item.displayPath, 96)} + + {item.lock || item.note ? ( + + {item.lock ? lockLabel(item.lock, t) : item.note} + + ) : null} + {formatBytes(item.onDisk)} + +
+ ); +} + export function SpacePage({ cleanup, purge, @@ -74,7 +116,16 @@ export function SpacePage({ const [minAge, setMinAge] = useState(bootstrap.settings.purgeMinAgeDays || 7); const [force, setForce] = useState(false); const [confirming, setConfirming] = useState(false); - const [focus, setFocus] = useState(null); + // Open accordions. On first results we auto-expand the biggest category so + // the list never reads as a dead panel; that initial choice is remembered + // here (null until the first scan lands). + const [expanded, setExpanded] = useState(null); + const toggleExpanded = (category: Category) => + setExpanded((current) => + (current ?? []).includes(category) + ? (current ?? []).filter((item) => item !== category) + : [...(current ?? []), category], + ); const [mode, setMode] = useState(deleteMode); const [busy, setBusy] = useState(false); const [result, setResult] = useState(null); @@ -176,20 +227,6 @@ export function SpacePage({ return { count, total }; }, [entries, cleanup.selected, purge.selected]); - const optionalSelected = useMemo(() => { - let count = 0; - for (const entry of entries) { - if ( - OPTIONAL_CATEGORIES.includes(entry.item.category) && - entry.source.selected.has(entry.index) && - !entry.item.lock - ) { - count += 1; - } - } - return count; - }, [entries, cleanup.selected, purge.selected]); - // 升级安装包 keep the confirm-dialog escape: count them inside the current // selection so the banner can offer "skip installers, clean the rest". const selectedUpdaters = useMemo(() => { @@ -208,6 +245,21 @@ export function SpacePage({ return { count, total }; }, [entries, cleanup.selected, purge.selected]); + // First results in: pre-open the single fattest category so the page never + // looks inert; afterwards the user owns the open set entirely. + useEffect(() => { + if (expanded !== null || entries.length === 0) return; + let biggest: Category | null = null; + let best = 0; + for (const [category, group] of groups) { + if (group.removable > 0 && group.total > best) { + best = group.total; + biggest = category; + } + } + setExpanded(biggest ? [biggest] : []); + }, [entries, expanded, groups]); + const toggleGroup = (category: Category) => { const allOn = groupSelected(category); for (const source of [cleanup, purge]) { @@ -361,7 +413,9 @@ export function SpacePage({ onClick={() => void runScan()} disabled={scanning || deleting} > - {t("Start scan", "开始扫描")} + {cleanup.result || purge.result + ? t("Rescan", "重新扫描") + : t("Start scan", "开始扫描")}
@@ -475,135 +529,160 @@ export function SpacePage({ {!scanning && !deleting && (cleanup.result || purge.result) ? ( <> -
-
- - {" "} - {t("Scan complete · caches + projects", "扫描完成 · 缓存 + 项目目录")} - -

- {formatBytes(selectedStats.total)} - - {t(" selected", " 已选")} ·{" "} - {formatBytes( +
+
+
+ {t("Selected ", "已选中 ")} + {formatBytes(selectedStats.total)} + {t(" ready to clean", " 可清理文件")} +
+
+ {t( + `${formatBytes( entries .filter((entry) => !entry.item.lock) .reduce((sum, entry) => sum + entry.item.onDisk, 0), - )}{" "} - {t("available in total", "全部可清理")} - -

-

- {t( - `${formatCount(selectedStats.count)} of ${formatCount( + )} found in total · ${formatCount(selectedStats.count)} of ${formatCount( entries.filter((entry) => !entry.item.lock).length, - )} items selected${ - optionalSelected > 0 - ? ` · ${formatCount(optionalSelected)} optional (update installers / build artefacts / dev files)` - : " · optional groups untouched" - }`, - `已选 ${formatCount(selectedStats.count)} / ${formatCount( + )} items selected`, + `共发现 ${formatBytes( + entries + .filter((entry) => !entry.item.lock) + .reduce((sum, entry) => sum + entry.item.onDisk, 0), + )} 可清理文件 · 已选 ${formatCount(selectedStats.count)} / ${formatCount( entries.filter((entry) => !entry.item.lock).length, - )} 项${ - optionalSelected > 0 - ? ` · 含 ${formatCount(optionalSelected)} 个可选类(升级包/项目产物/开发文件)` - : " · 可选类未勾选(默认只清理日常项)" - }`, + )} 项`, )} -

-
-
- - +
+ +
-
- {t( - "Daily groups are pre-selected. The dashed cards (update installers, project artefacts, developer files) are opt-in — tick them to join the same clean run.", - "默认只勾选日常清理项;虚线卡片(升级安装包 / 项目产物 / 开发文件)为可选,勾选后将与日常项合并成一次清理。", - )} -
- -
- {CATEGORY_ORDER.filter((category) => groups.has(category)).map( - (category) => { - const group = groups.get(category)!; - const optional = OPTIONAL_CATEGORIES.includes(category); - return ( -
- {optional ? ( - - {t("optional", "可选")} - - ) : null} - toggleGroup(category)} - onInspect={() => setFocus(focus === category ? null : category)} - /> -
- ); - }, - )} -
- -
- setFocus(null)}> - {t("Show all", "显示全部")} - - ) : null - } - /> -
- {entries - .filter((entry) => !focus || entry.item.category === focus) - .map((entry) => ( - entry.source.toggleItem(entry.index)} - /> - ))} -
-
+ {(["daily", "optional"] as const).map((section) => { + const inSection = (category: Category) => + section === "optional" + ? OPTIONAL_CATEGORIES.includes(category) + : !OPTIONAL_CATEGORIES.includes(category); + const cats = CATEGORY_ORDER.filter( + (category) => groups.has(category) && inSection(category), + ); + if (cats.length === 0) return null; + const sectionCount = cats.reduce( + (sum, category) => sum + groups.get(category)!.count, + 0, + ); + const sectionTotal = cats.reduce( + (sum, category) => sum + groups.get(category)!.total, + 0, + ); + return ( +
+
+

+ {section === "daily" + ? t("Pre-selected for you", "已为你默认勾选") + : t("Needs your tick", "需要你手动勾选")} +

+ + {section === "daily" + ? t( + `${formatCount(sectionCount)} items, safe to clean`, + `共 ${formatCount(sectionCount)} 项,可以放心清理`, + ) + : t( + `${formatCount(sectionCount)} items, review before cleaning`, + `共 ${formatCount(sectionCount)} 项,请确认后清理`, + )} + + + {section === "daily" ? t("selected", "已选") : t("optional", "可选")}{" "} + {formatBytes(sectionTotal)} + +
+ {cats.map((category) => { + const group = groups.get(category)!; + const open = (expanded ?? []).includes(category); + const meta = CATEGORY_META[category]; + const Icon = meta.icon; + const optional = OPTIONAL_CATEGORIES.includes(category); + const items = entries + .filter((entry) => entry.item.category === category) + .sort((a, b) => b.item.onDisk - a.item.onDisk); + return ( +
+
toggleExpanded(category)} + onKeyDown={(event) => { + if (event.key === "Enter" || event.key === " ") { + event.preventDefault(); + toggleExpanded(category); + } + }} + > + toggleGroup(category)} + label={categoryLabel(category, lang, bin)} + /> + + + + + {categoryLabel(category, lang, bin)} + + + {lang === "zh" ? meta.blurbZh : meta.blurbEn} + + + {t(`${formatCount(group.count)} items`, `${formatCount(group.count)} 项`)} + + + {optional ? `${t("optional", "可选")} ` : ""} + {formatBytes(group.total)} + +
+ {open ? ( +
+ {items.map((entry) => ( + + ))} +
+ ) : null} +
+ ); + })} +
+ ); + })} ) : null} diff --git a/src/styles.css b/src/styles.css index d9be827..5d7c03e 100644 --- a/src/styles.css +++ b/src/styles.css @@ -4947,9 +4947,9 @@ select:focus-visible, } .perm-group-icon { - width: 20px; - height: 20px; - border-radius: 5px; + width: 22px; + height: 22px; + border-radius: 6px; object-fit: contain; flex: 0 0 auto; } @@ -4979,6 +4979,12 @@ select:focus-visible, min-width: 0; } +/* Startup rows live under a software-group header that already carries the + icon — the icon shows once per group, children just align under its text. */ +.perm-row-noicon { + padding-left: 30px; +} + .perm-row > div { display: flex; min-width: 0; @@ -5447,43 +5453,226 @@ select:focus-visible, flex-shrink: 0; } -.hint-strip { - margin-top: 12px; - padding: 9px 14px; - border: 1px dashed #e3d2b2; - border-radius: 10px; - background: #fbf4e7; - color: #8a7a60; - font-size: var(--nex-text-2xs); +/* ---- 空间清理 v2: sticky summary + category accordions ----------------- */ + +.space-sum { + display: flex; + align-items: center; + gap: 14px; + padding: 13px 20px; + border: 1px solid #f2ddba; + border-radius: 14px; + background: linear-gradient(135deg, #fff7ea, #ffefdb); + box-shadow: 0 10px 24px rgba(150, 106, 40, 0.08); } -.category-slot { - position: relative; +.space-sum .grow { + flex: 1; + min-width: 0; } -.opt-tag { - position: absolute; - top: -8px; - right: 8px; - z-index: 2; - /* Sits over the card corner where the checkbox lives: it is a label, - never a click target, so the tick underneath stays hittable. */ - pointer-events: none; - border-radius: 99px; - padding: 2px 9px; - background: #3f6bbd; - color: #fff; - font-size: 10px; +.space-sum .big { + color: var(--nex-ink); + font-size: 19px; font-weight: var(--nex-weight-bold); } -.category-slot .category-card { - height: 100%; +.space-sum .big em { + font-style: normal; + color: var(--nex-primary); } -.category-slot:has(.opt-tag) .category-card { - border-style: dashed; - border-color: #b9c6e4; +.space-sum .sub { + margin-top: 3px; + color: #9a8a6d; + font-size: var(--nex-text-3xs); +} + +.space-sec { + display: flex; + align-items: baseline; + gap: 10px; + margin: 22px 2px 8px; +} + +.space-sec h2 { + color: var(--nex-ink); + font-size: 14px; + font-weight: var(--nex-weight-bold); +} + +.space-sec .tip { + color: #97a2b0; + font-size: var(--nex-text-3xs); +} + +.space-sec .r { + margin-left: auto; + color: #97a2b0; + font-size: var(--nex-text-3xs); +} + +.space-sec .r b { + color: var(--nex-primary); + font-size: 13px; +} + +.space-sec .r.is-opt b { + color: #2fa06b; +} + +.space-cat { + margin-bottom: 8px; + overflow: hidden; + border: 1px solid rgba(47, 87, 126, 0.08); + border-radius: 12px; + background: rgba(255, 253, 248, 0.92); + box-shadow: var(--shadow-card); +} + +.space-cat-head { + display: flex; + align-items: center; + gap: 11px; + padding: 12px 16px; + cursor: pointer; +} + +.space-cat-head:hover { + background: rgba(255, 248, 235, 0.7); +} + +.space-cat-icon { + display: grid; + flex: 0 0 auto; + place-items: center; + width: 26px; + height: 26px; + border-radius: 8px; + color: #fff; + background: var(--tone); +} + +.space-cat-name { + flex: 0 0 auto; + color: var(--nex-ink); + font-size: var(--nex-text-2xs); + font-weight: var(--nex-weight-semibold); +} + +.space-cat-desc { + overflow: hidden; + flex: 1; + min-width: 0; + color: #99a4b2; + font-size: var(--nex-text-3xs); + text-overflow: ellipsis; + white-space: nowrap; +} + +.space-cat-n { + flex: 0 0 auto; + color: #a5aebb; + font-size: var(--nex-text-3xs); +} + +.space-cat-size { + flex: 0 0 auto; + color: var(--nex-primary); + font-size: 13px; + font-weight: var(--nex-weight-semibold); +} + +.space-cat-size.is-opt { + color: #2fa06b; +} + +.space-cat-chv { + flex: 0 0 auto; + color: #b7bfca; + transition: transform 0.15s ease; +} + +.space-cat.is-open .space-cat-chv { + transform: rotate(90deg); +} + +.space-cat-items { + border-top: 1px dashed #eee0c8; + background: rgba(255, 254, 251, 0.9); +} + +.space-item { + display: flex; + align-items: center; + gap: 11px; + padding: 9px 16px 9px 46px; + border-top: 1px solid #f6efe2; + cursor: pointer; +} + +.space-item:first-child { + border-top: 0; +} + +.space-item:hover { + background: rgba(253, 244, 228, 0.75); +} + +.space-item.is-locked { + cursor: default; +} + +.space-item.is-locked:hover { + background: transparent; +} + +.space-item-name { + flex: 0 1 auto; + overflow: hidden; + color: #42505e; + font-size: var(--nex-text-3xs); + font-weight: var(--nex-weight-semibold); + text-overflow: ellipsis; + white-space: nowrap; +} + +.space-item-path { + flex: 1 1 auto; + overflow: hidden; + min-width: 0; + color: #8b98a8; + font-family: Consolas, "Courier New", monospace; + font-size: var(--nex-text-3xs); + text-overflow: ellipsis; + white-space: nowrap; +} + +.space-item-meta { + flex: 0 0 auto; + padding: 1px 8px; + border: 1px solid #ecd9b4; + border-radius: 99px; + color: #b3854d; + font-size: var(--nex-text-3xs); +} + +.space-item-meta.is-locked { + border-color: #e5c8c8; + color: #a94c52; +} + +.space-item-size { + flex: 0 0 auto; + color: #5a6776; + font-size: var(--nex-text-3xs); + font-weight: var(--nex-weight-semibold); + font-variant-numeric: tabular-nums; +} + +.space-item-go { + flex: 0 0 auto; + color: #c0a06a; } .confirm-updater-actions {