日常清理+深度清理合并为「空间清理」:一次扫描、分层默认勾选、全程进度

- SpacePage 合并双工作区:扫描先缓存后项目目录(步骤条 A),两类结果按体积并入同一分类卡片与清单;升级安装包/项目产物/开发文件三类默认不勾选(虚线卡+可选角标),勾选后一次确认、两引擎顺序删除、结果合并(删除中步骤条 B)
- 深度扫描设置收进页顶设置栏(目录点击编辑+浏览多选、3/7/30 天、Git 保护)
- 侧边栏删「深度清理」项、日常清理更名空间清理;Ctrl 快捷键重排;托盘菜单同步合并;概览页智能扫描同时触发两阶段并跳转
- useScanWorkspace 新增 setCategorySelection(确定性取消可选类默认勾选)
- 删除 CleanupPage/PurgePage;确认弹窗保留升级包「跳过/只清」双逃逸按钮
- 重新打包(sha256 9ccb814e…)
dev
lijunjie 2026-11-19 15:22:03 +08:00
parent d32d4f64f2
commit ad1b70fe13
14 changed files with 1026 additions and 347 deletions

View File

@ -29,6 +29,12 @@ Squid 0.1.10 更新说明
左键也会弹菜单)。
调整
- 「日常清理」与「深度清理」合并为一个「空间清理」页:一次扫描同时检查缓存
垃圾与项目构建目录,结果汇总为一份清单。默认只勾选日常清理项,「升级安装
包 / 项目产物 / 开发文件」三类为可选(虚线卡片 + 可选角标),勾选后与日常
项合并成一次清理。深度扫描目录、文件年龄(3/7/30 天)、Git 保护收进页面
顶部设置栏;扫描与删除全程有步骤条与实时进度;侧边栏与托盘菜单同步精简,
快捷键重排(Ctrl+2 = 空间清理)。
- 桌面小工具 Win+D 常驻:按下「显示桌面」后小工具约 2 秒内自动回到桌面
(窗口保持桌面层:在壁纸与图标之上、其他软件窗口之下;自己关闭/折叠
不会把它叫回来)。

View File

@ -1,2 +1,2 @@
f259188d2d7f3d1e7fbc4f5851e01a0c9b174f88cb7fb4f95d524aec24437014 *Squid-Setup-0.1.10-win-x64.exe
0525b2225d790001be2f13ff240317b16562b3cce63a2edf9ae889086a7fcfc0 *Squid-0.1.10-portable-win-x64.zip
9ccb814e0e5b59847d650581f2707e7c392b12910e134f0320dac4665d98ce19 *Squid-Setup-0.1.10-win-x64.exe
c0908cb68b9e4b91b5901199217a5fa28624ec7588931f53a2e9318b72f9382e *Squid-0.1.10-portable-win-x64.zip

View File

@ -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- 深度清理:默认检查目录(~/code 等 macOS 风格)在本机全都不存在时不再报\n 「请先选择目录」,自动回退到用户主目录扫描;「要检查的项目目录」旁新增\n 「浏览…」按钮可直接多选文件夹;扫描出错信息此前会被静默吞掉,现在会以\n 红色横幅显示。\n- 托盘交互:左键单击/双击图标 = 直接打开主界面,右键 = 弹出菜单(原先\n 左键也会弹菜单)。\n\n调整\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- 深度清理:默认检查目录(~/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 仍为「废纸篓」。",
"artifacts": {
"windows": {
"file": "Squid-Setup-0.1.10-win-x64.exe",
"sha256": "f259188d2d7f3d1e7fbc4f5851e01a0c9b174f88cb7fb4f95d524aec24437014",
"size": 3569772
"sha256": "9ccb814e0e5b59847d650581f2707e7c392b12910e134f0320dac4665d98ce19",
"size": 3568622
}
}
}

View File

@ -31,9 +31,8 @@ fn navigate_to(app: &AppHandle, page: &'static str) {
fn create_tray(app: &AppHandle) -> tauri::Result<()> {
let open = MenuItem::with_id(app, "open", "打开 Squid", true, None::<&str>)?;
let cleanup = MenuItem::with_id(app, "cleanup", "日常清理", true, None::<&str>)?;
let space = MenuItem::with_id(app, "space", "空间清理", true, None::<&str>)?;
let apps = MenuItem::with_id(app, "applications", "应用卸载", true, None::<&str>)?;
let purge = MenuItem::with_id(app, "purge", "深度清理", true, None::<&str>)?;
let quit = MenuItem::with_id(app, "quit", "退出 Squid", true, None::<&str>)?;
let first_separator = PredefinedMenuItem::separator(app)?;
let last_separator = PredefinedMenuItem::separator(app)?;
@ -45,9 +44,8 @@ fn create_tray(app: &AppHandle) -> tauri::Result<()> {
&[
&open,
&first_separator,
&cleanup,
&space,
&apps,
&purge,
&widget_toggle,
&last_separator,
&quit,
@ -66,9 +64,8 @@ fn create_tray(app: &AppHandle) -> tauri::Result<()> {
.show_menu_on_left_click(false)
.on_menu_event(|app, event| match event.id.as_ref() {
"open" => show_main_window(app),
"cleanup" => navigate_to(app, "cleanup"),
"space" => navigate_to(app, "space"),
"applications" => navigate_to(app, "applications"),
"purge" => navigate_to(app, "purge"),
"widget" => {
if let Err(error) = widget::toggle_from_tray(app) {
eprintln!("widget toggle failed: {error}");

View File

@ -11,7 +11,6 @@ import {
Settings,
ShieldCheck,
Sparkles,
WandSparkles,
} from "lucide-react";
import { useCallback, useEffect, useState, type ReactNode } from "react";
import { useAppsWorkspace } from "./hooks/useAppsWorkspace";
@ -33,12 +32,11 @@ import { useToast } from "./components/ui";
import { SetupPanel } from "./components/SetupPanel";
import appIconUrl from "../src-tauri/icons/128x128.png";
import { ApplicationsPage } from "./pages/ApplicationsPage";
import { CleanupPage } from "./pages/CleanupPage";
import { HistoryPage } from "./pages/HistoryPage";
import { OverviewPage } from "./pages/OverviewPage";
import { PermissionsPage } from "./pages/PermissionsPage";
import { PurgePage } from "./pages/PurgePage";
import { SettingsPage } from "./pages/SettingsPage";
import { SpacePage } from "./pages/SpacePage";
import { StoragePage } from "./pages/StoragePage";
import { SystemPage } from "./pages/SystemPage";
import { WidgetPage } from "./pages/WidgetPage";
@ -64,9 +62,9 @@ const NAV_GROUPS: {
icon: LayoutDashboard,
},
{
id: "cleanup",
labelEn: "Daily cleanup",
labelZh: "日常清理",
id: "space",
labelEn: "Space cleaning",
labelZh: "空间清理",
icon: Eraser,
},
{
@ -75,12 +73,6 @@ const NAV_GROUPS: {
labelZh: "应用卸载",
icon: AppWindow,
},
{
id: "purge",
labelEn: "Deep Clean",
labelZh: "深度清理",
icon: WandSparkles,
},
{
id: "permissions",
labelEn: "Permissions",
@ -123,9 +115,8 @@ const NAV_GROUPS: {
const PAGE_TITLES: Record<PageId, [string, string]> = {
overview: ["Computer overview", "电脑概览"],
cleanup: ["Daily cleanup", "日常清理"],
space: ["Space cleaning", "空间清理"],
applications: ["Uninstall apps", "应用卸载"],
purge: ["Deep Clean", "深度清理"],
permissions: ["Permissions", "权限管理"],
widget: ["Desktop widget", "桌面小工具"],
storage: ["Storage", "存储空间"],
@ -255,17 +246,16 @@ export default function App() {
useEffect(() => {
const order: PageId[] = [
"overview",
"cleanup",
"space",
"applications",
"purge",
"permissions",
"storage",
"system",
"widget",
"history",
"settings",
"widget",
];
// Ctrl/Cmd+1..9 map in order; the 10th (desktop widget) rides on "0".
// Ctrl/Cmd+1..9 map in navigation order.
const onKey = (event: KeyboardEvent) => {
if (!(event.metaKey || event.ctrlKey) || event.altKey || event.shiftKey) return;
const index = event.key === "0" ? 9 : Number(event.key) - 1;
@ -336,12 +326,15 @@ export default function App() {
bootstrap={bootstrap}
snapshot={system.snapshot}
cleanup={cleanup}
purge={purge}
onNavigate={setPage}
/>
) : null}
{page === "cleanup" ? (
<CleanupPage
workspace={cleanup}
{page === "space" ? (
<SpacePage
cleanup={cleanup}
purge={purge}
bootstrap={bootstrap}
deleteMode={deleteMode}
onHistory={() => setPage("history")}
/>
@ -349,14 +342,6 @@ export default function App() {
{page === "applications" ? (
<ApplicationsPage workspace={apps} onHistory={() => setPage("history")} />
) : null}
{page === "purge" ? (
<PurgePage
workspace={purge}
bootstrap={bootstrap}
deleteMode={deleteMode}
onHistory={() => setPage("history")}
/>
) : null}
{page === "permissions" ? <PermissionsPage workspace={permissions} /> : null}
{page === "widget" ? <WidgetPage /> : null}
{page === "storage" ? <StoragePage bootstrap={bootstrap} /> : null}
@ -435,7 +420,7 @@ function AppChrome({
>
<Icon size={18} />
<span>{lang === "zh" ? item.labelZh : item.labelEn}</span>
{item.id === "cleanup" && page !== "cleanup" ? (
{item.id === "space" && page !== "space" ? (
<i className="nav-dot" />
) : null}
</button>

View File

@ -84,7 +84,7 @@ export function CategorySummary({
);
}
function ItemRow({
export function ItemRow({
item,
checked,
onToggle,

View File

@ -35,6 +35,7 @@ export interface ScanWorkspace {
cancel: () => Promise<void>;
toggleItem: (index: number) => void;
toggleCategory: (category: Category) => void;
setCategorySelection: (category: Category, on: boolean) => void;
deselect: (indexes: number[]) => void;
selectAll: () => void;
clearSelection: () => void;
@ -150,6 +151,29 @@ export function useScanWorkspace(kind: ScanKind): ScanWorkspace {
const clearSelection = useCallback(() => setSelected(new Set()), []);
// Deterministic category state: the 空间清理 page uses this to leave the
// optional groups (升级安装包 / 项目产物 / 开发文件) unchecked after a
// scan, wherever the rule defaults happened to point.
const setCategorySelection = useCallback(
(category: Category, on: boolean) => {
if (!result) return;
const indexes = result.items
.map((item, index) => ({ item, index }))
.filter(({ item }) => item.category === category && !item.lock)
.map(({ index }) => index);
if (indexes.length === 0) return;
setSelected((current) => {
const next = new Set(current);
for (const index of indexes) {
if (on) next.add(index);
else next.delete(index);
}
return next;
});
},
[result],
);
const deselect = useCallback((indexes: number[]) => {
if (indexes.length === 0) return;
const drop = new Set(indexes);
@ -230,6 +254,7 @@ export function useScanWorkspace(kind: ScanKind): ScanWorkspace {
cancel,
toggleItem,
toggleCategory,
setCategorySelection,
deselect,
selectAll,
clearSelection,

View File

@ -1,84 +0,0 @@
import { ScanSearch, Sparkles } from "lucide-react";
import { useI18n } from "../i18n";
import { formatBytes } from "../lib/format";
import type { DeleteMode } from "../types";
import type { ScanWorkspace } from "../hooks/useScanWorkspace";
import { CleanupInventory } from "../components/CleanupView";
import { Button, EmptyState, PageHeader } from "../components/ui";
export function CleanupPage({
workspace,
deleteMode,
onHistory,
}: {
workspace: ScanWorkspace;
deleteMode: DeleteMode;
onHistory: () => void;
}) {
const { t } = useI18n();
return (
<div className="page">
<PageHeader
eyebrow={t("Cleanup", "清理")}
title={t("Clutter, without the guesswork.", "清理垃圾,不靠猜。")}
description={t(
"Rebuildable caches, old logs and other safe-to-remove files — always reviewed before deletion.",
"可重建缓存、旧日志与其他可安全删除的文件,删除前始终由您确认。",
)}
actions={
workspace.result ? (
<Button
variant="secondary"
icon={<ScanSearch size={16} />}
onClick={() => void workspace.runScan()}
disabled={workspace.scanning || workspace.deleting}
>
{t("Scan again", "重新扫描")}
</Button>
) : null
}
/>
{workspace.error && !workspace.scanning ? (
<div className="error-banner">{workspace.error}</div>
) : null}
<CleanupInventory
workspace={workspace}
defaultMode={deleteMode}
onHistory={onHistory}
/>
{!workspace.result && !workspace.scanning && !workspace.summary ? (
<EmptyState
icon={<Sparkles size={28} />}
title={t("Ready when you are", "随时可以开始")}
description={t(
"Squid checks known cache and log locations, measures what can be reclaimed, and locks anything it cannot remove safely.",
"Squid 会检查已知缓存与日志位置,统计可释放空间,并锁定任何无法安全删除的项目。",
)}
action={
<Button
variant="primary"
icon={<ScanSearch size={16} />}
onClick={() => void workspace.runScan()}
>
{t("Scan for junk", "扫描系统垃圾")}
</Button>
}
/>
) : null}
{workspace.result && workspace.selectedTotal > 0 ? (
<p className="page-footnote">
<span>
{t(
`${formatBytes(workspace.selectedTotal)} selected. Nothing is removed until you confirm.`,
`已选择 ${formatBytes(workspace.selectedTotal)},在您确认前不会删除任何内容。`,
)}
</span>
</p>
) : null}
</div>
);
}

View File

@ -71,11 +71,13 @@ export function OverviewPage({
bootstrap,
snapshot,
cleanup,
purge,
onNavigate,
}: {
bootstrap: Bootstrap;
snapshot: SystemSnapshot | null;
cleanup: ScanWorkspace;
purge: ScanWorkspace;
onNavigate: (page: PageId) => void;
}) {
const { t, lang } = useI18n();
@ -87,11 +89,33 @@ export function OverviewPage({
const memoryReserved = snapshot
? Math.max(0, memoryInstalled - snapshot.memory.total)
: 0;
const found = cleanup.result
? cleanup.result.items
.filter((item) => !item.lock)
.reduce((sum, item) => sum + item.onDisk, 0)
: 0;
const scanned = Boolean(cleanup.result || purge.result);
const scanning = cleanup.scanning || purge.scanning;
const found = [cleanup, purge].reduce(
(sum, workspace) =>
sum +
(workspace.result
? workspace.result.items
.filter((item) => !item.lock)
.reduce((total, item) => total + item.onDisk, 0)
: 0),
0,
);
// 智能扫描 lives on the 空间清理 page now; the workspaces are app-level so
// kicking both stages from here simply continues on that page. It uses the
// default deep-scan settings — tweak them there and re-scan if needed.
const smartScan = () => {
if (!scanned) {
void cleanup.runScan().then(() =>
purge.runScan({
roots: bootstrap.settings.purgeRoots,
minAgeDays: bootstrap.settings.purgeMinAgeDays || 7,
force: false,
}),
);
}
onNavigate("space");
};
const hardware = bootstrap.hardwareInfo;
const ramBrands = [
@ -151,13 +175,10 @@ export function OverviewPage({
variant="primary"
size="lg"
icon={<Sparkles size={17} />}
onClick={() => {
if (cleanup.result) onNavigate("cleanup");
else void cleanup.runScan();
}}
disabled={cleanup.scanning}
onClick={smartScan}
disabled={scanning}
>
{cleanup.result
{scanned
? t("Review scan", "查看扫描结果")
: t("Smart scan", "智能扫描")}
</Button>
@ -171,7 +192,7 @@ export function OverviewPage({
{t("Smart Care", "智能维护")}
</div>
<h2>
{cleanup.result
{scanned
? t(
`${formatBytes(found)} found safely.`,
`安全发现 ${formatBytes(found)} 可清理空间。`,
@ -179,7 +200,7 @@ export function OverviewPage({
: t("A lighter, faster machine.", "更轻盈,更顺畅。")}
</h2>
<p>
{cleanup.result
{scanned
? t(
"Review each category before anything is removed. Locked files stay untouched.",
"清理前可逐项检查,锁定文件始终不会被处理。",
@ -192,14 +213,11 @@ export function OverviewPage({
<div className="hero-actions">
<Button
variant="primary"
icon={cleanup.result ? <ArrowRight size={16} /> : <ScanSearch size={16} />}
onClick={() => {
if (cleanup.result) onNavigate("cleanup");
else void cleanup.runScan();
}}
disabled={cleanup.scanning}
icon={scanned ? <ArrowRight size={16} /> : <ScanSearch size={16} />}
onClick={smartScan}
disabled={scanning}
>
{cleanup.result
{scanned
? t("Choose what to clean", "选择清理项目")
: t("Start a smart scan", "开始智能扫描")}
</Button>
@ -259,15 +277,15 @@ export function OverviewPage({
</div>
</section>
{cleanup.scanning ? (
{scanning ? (
<ProgressCard
progress={cleanup.progress}
progress={cleanup.progress ?? purge.progress}
title={t("Looking for safe things to clean…", "正在查找可安全清理的项目…")}
onCancel={() => void cleanup.cancel()}
onCancel={() => void (cleanup.scanning ? cleanup.cancel() : purge.cancel())}
/>
) : null}
{cleanup.result && !cleanup.scanning ? (
{scanned && !scanning ? (
<section className="overview-found">
<SectionTitle
title={t("What the scan found", "扫描发现")}
@ -276,18 +294,20 @@ export function OverviewPage({
"不想清理的项目可以随时取消勾选。",
)}
action={
<Button variant="ghost" size="sm" onClick={() => onNavigate("cleanup")}>
{t("Open cleanup", "打开清理")}
<Button variant="ghost" size="sm" onClick={() => onNavigate("space")}>
{t("Open space cleaning", "打开空间清理")}
<ChevronRight size={14} />
</Button>
}
/>
<CategorySummary
result={cleanup.result}
selected={cleanup.selected}
onToggle={cleanup.toggleCategory}
onInspect={() => onNavigate("cleanup")}
/>
{cleanup.result ? (
<CategorySummary
result={cleanup.result}
selected={cleanup.selected}
onToggle={cleanup.toggleCategory}
onInspect={() => onNavigate("space")}
/>
) : null}
</section>
) : null}
@ -426,13 +446,18 @@ export function OverviewPage({
</span>
<ChevronRight size={17} />
</button>
<button className="quick-card tone-violet" onClick={() => onNavigate("purge")}>
<button className="quick-card tone-violet" onClick={smartScan}>
<span className="quick-icon">
<Sparkles size={22} />
</span>
<span className="quick-copy">
<strong>{t("Deep clean", "深度清理")}</strong>
<small>{t("Clear build artefacts safely", "安全清理项目构建产物")}</small>
<strong>{t("Space cleaning", "空间清理")}</strong>
<small>
{t(
"Caches, logs and build artefacts in one scan",
"一次扫描清掉缓存、垃圾与构建产物",
)}
</small>
</span>
<ChevronRight size={17} />
</button>

View File

@ -1,184 +0,0 @@
import {
AlertTriangle,
FolderOpen,
FolderSearch,
GitBranch,
ScanSearch,
ShieldAlert,
} from "lucide-react";
import { open } from "@tauri-apps/plugin-dialog";
import { useState } from "react";
import { useI18n } from "../i18n";
import type { Bootstrap, DeleteMode } from "../types";
import type { ScanWorkspace } from "../hooks/useScanWorkspace";
import { CleanupInventory } from "../components/CleanupView";
import { Button, PageHeader, Toggle } from "../components/ui";
export function PurgePage({
workspace,
bootstrap,
deleteMode,
onHistory,
}: {
workspace: ScanWorkspace;
bootstrap: Bootstrap;
deleteMode: DeleteMode;
onHistory: () => void;
}) {
const { t } = useI18n();
const [roots, setRoots] = useState(bootstrap.settings.purgeRoots.join("\n"));
const [minAge, setMinAge] = useState(bootstrap.settings.purgeMinAgeDays);
const [force, setForce] = useState(false);
const browse = async () => {
const chosen = await open({
directory: true,
multiple: true,
title: t("Choose project folders to inspect", "选择要检查的项目目录"),
});
if (!chosen) return;
const picked = (Array.isArray(chosen) ? chosen : [chosen]).filter(
(path) => !roots.split(/\r?\n/).some((line) => line.trim() === path),
);
if (picked.length > 0) {
setRoots((current) =>
current.trim().length > 0
? `${current.trimEnd()}\n${picked.join("\n")}`
: picked.join("\n"),
);
}
};
const run = () =>
void workspace.runScan({
roots: roots
.split(/\r?\n/)
.map((root) => root.trim())
.filter(Boolean),
minAgeDays: minAge > 0 ? minAge : null,
force,
});
return (
<div className="page">
<PageHeader
eyebrow={t("Deep Clean", "深度清理")}
title={t("Find the space normal cleaning misses.", "找到普通清理遗漏的空间。")}
description={t(
"Search projects for rebuildable build folders and dependency caches. Git history and source files are never selected.",
"在项目中查找可重建的构建目录与依赖缓存。Git 历史和源文件绝不会被选中。",
)}
actions={
<Button variant="primary" icon={<ScanSearch size={16} />} onClick={run}>
{t("Start deep scan", "开始深度扫描")}
</Button>
}
/>
{workspace.error && !workspace.scanning ? (
<div className="error-banner">{workspace.error}</div>
) : null}
<div className="deep-options">
<div className="deep-option-main">
<label className="field-label" htmlFor="purge-roots">
{t("Project folders to inspect", "要检查的项目目录")}
<button
type="button"
className="text-button"
style={{ marginLeft: 10 }}
onClick={() => void browse()}
>
<FolderOpen size={13} />
{t("Browse…", "浏览…")}
</button>
</label>
<textarea
id="purge-roots"
value={roots}
onChange={(event) => setRoots(event.target.value)}
placeholder={t(
"One folder per line. Leave empty to use your home folder.",
"每行一个目录;留空则使用用户主目录。",
)}
rows={3}
/>
<span className="field-help">
{t(
"Squid uses these as search roots, not as delete targets.",
"这些路径只用于查找,不会作为删除目标。",
)}
</span>
</div>
<div className="deep-option-side">
<label className="field-label" htmlFor="purge-age">
{t("Only files older than", "仅处理早于")}
</label>
<div className="number-field">
<input
id="purge-age"
type="number"
min={0}
max={3650}
value={minAge}
onChange={(event) => setMinAge(Math.max(0, Number(event.target.value) || 0))}
/>
<span>{t("days", "天")}</span>
</div>
<div className="option-toggle-row">
<div>
<strong>{t("Force mode", "强制模式")}</strong>
<span>{t("Include folders inside a Git work tree", "包含 Git 工作树内的目录")}</span>
</div>
<Toggle
checked={force}
onChange={setForce}
label={t("Force mode", "强制模式")}
/>
</div>
</div>
</div>
<div className="safety-strip">
<GitBranch size={18} />
<div>
<strong>{t("Git-aware by default", "默认感知 Git 状态")}</strong>
<span>
{t(
"Uncommitted work is protected. Force mode is for throwaway build folders only.",
"存在未提交改动时会自动保护。强制模式仅建议用于可丢弃的构建目录。",
)}
</span>
</div>
<ShieldAlert size={19} />
</div>
<div className="warning-strip">
<AlertTriangle size={18} />
<span>
{t(
"node_modules, target, dist and similar folders can be regenerated, but rebuilding may take time or require network access.",
"node_modules、target、dist 等目录可以重新生成,但重新构建可能需要时间或网络。",
)}
</span>
</div>
<CleanupInventory
workspace={workspace}
defaultMode={deleteMode}
onHistory={onHistory}
/>
{!workspace.result && !workspace.scanning && !workspace.summary ? (
<div className="empty-inline">
<FolderSearch size={22} />
<span>
{t(
"No deep scan yet. Choose your project roots above and start when ready.",
"尚未进行深度扫描。选择项目目录后即可开始。",
)}
</span>
</div>
) : null}
</div>
);
}

View File

@ -0,0 +1,691 @@
/* 空间清理: one page, one scan, one delete pass.
*
* Merges the old 日常清理 (rule-driven caches/logs/…) and 深度清理 (build
* artefacts under project folders) into a single flow: the scan runs the
* quick pass first, then the deep pass, and both result sets share one
* category grid and one item list. Daily categories start selected; the
* three optional groups (升级安装包 / 项目产物 / 开发文件) start untouched
* and join the same delete run when the user checks their card. */
import {
DownloadCloud,
FolderOpen,
ScanSearch,
ShieldCheck,
Trash2,
} from "lucide-react";
import { open } from "@tauri-apps/plugin-dialog";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useI18n } from "../i18n";
import { api } from "../lib/api";
import { formatBytes, formatCount } from "../lib/format";
import type {
Bootstrap,
Category,
CleanupItem,
DeleteMode,
DeleteResult,
} from "../types";
import type { ScanWorkspace } from "../hooks/useScanWorkspace";
import { ItemRow } from "../components/CleanupView";
import {
Button,
CATEGORY_ORDER,
CategoryCard,
ConfirmDialog,
InlineError,
ProgressCard,
SectionTitle,
Toggle,
useToast,
} from "../components/ui";
/* Groups the user opts into by hand; they arrive unchecked. */
export const OPTIONAL_CATEGORIES: Category[] = [
"update-installers",
"project-artifacts",
"developer",
];
type Entry = {
source: ScanWorkspace;
index: number;
item: CleanupItem;
};
const AGE_CHOICES = [3, 7, 30];
export function SpacePage({
cleanup,
purge,
bootstrap,
deleteMode,
onHistory,
}: {
cleanup: ScanWorkspace;
purge: ScanWorkspace;
bootstrap: Bootstrap;
deleteMode: DeleteMode;
onHistory: () => void;
}) {
const { t, lang, bin } = useI18n();
const { push } = useToast();
const [roots, setRoots] = useState(bootstrap.settings.purgeRoots.join("\n"));
const [minAge, setMinAge] = useState(bootstrap.settings.purgeMinAgeDays || 7);
const [force, setForce] = useState(false);
const [confirming, setConfirming] = useState(false);
const [mode, setMode] = useState<DeleteMode>(deleteMode);
const [busy, setBusy] = useState(false);
const [result, setResult] = useState<DeleteResult | null>(null);
const scanning = cleanup.scanning || purge.scanning;
const deleting = cleanup.deleting || purge.deleting;
const inFlight = useRef(false);
useEffect(() => setMode(deleteMode), [deleteMode]);
const runScan = useCallback(async () => {
if (scanning || deleting || inFlight.current) return;
inFlight.current = true;
setResult(null);
const rootList = roots
.split(/\r?\n/)
.map((root) => root.trim())
.filter(Boolean);
try {
await cleanup.runScan();
await purge.runScan({
roots: rootList,
minAgeDays: minAge > 0 ? minAge : null,
force,
});
} finally {
inFlight.current = false;
}
}, [cleanup, deleting, force, minAge, purge, roots, scanning]);
// The optional groups start untouched on every fresh result: the hooks'
// default selection comes from rule metadata, and this page overrides the
// three opt-in categories back to "unchecked" once React has committed.
useEffect(() => {
if (!cleanup.result) return;
for (const category of OPTIONAL_CATEGORIES) {
cleanup.setCategorySelection(category, false);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [cleanup.result]);
useEffect(() => {
if (!purge.result) return;
for (const category of OPTIONAL_CATEGORIES) {
purge.setCategorySelection(category, false);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [purge.result]);
const browse = async () => {
const chosen = await open({
directory: true,
multiple: true,
title: t("Choose project folders to inspect", "选择要检查的项目目录"),
});
if (!chosen) return;
const picked = (Array.isArray(chosen) ? chosen : [chosen]).filter(
(path) => !roots.split(/\r?\n/).some((line) => line.trim() === path),
);
if (picked.length > 0) {
setRoots((current) =>
current.trim().length > 0
? `${current.trimEnd()}\n${picked.join("\n")}`
: picked.join("\n"),
);
}
};
const entries = useMemo<Entry[]>(() => {
const all: Entry[] = [];
for (const source of [cleanup, purge]) {
source.result?.items.forEach((item, index) => {
all.push({ source, index, item });
});
}
return all.sort((a, b) => b.item.onDisk - a.item.onDisk);
}, [cleanup.result, purge.result]);
const groups = useMemo(() => {
const map = new Map<
Category,
{ total: number; count: number; selected: number }
>();
for (const entry of entries) {
const group = map.get(entry.item.category) ?? {
total: 0,
count: 0,
selected: 0,
};
group.total += entry.item.onDisk;
group.count += 1;
if (entry.source.selected.has(entry.index)) group.selected += 1;
map.set(entry.item.category, group);
}
return map;
}, [entries]);
const selectedStats = useMemo(() => {
let count = 0;
let total = 0;
for (const entry of entries) {
if (entry.source.selected.has(entry.index) && !entry.item.lock) {
count += 1;
total += entry.item.onDisk;
}
}
return { count, total };
}, [entries]);
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]);
// 升级安装包 keep the confirm-dialog escape: count them inside the current
// selection so the banner can offer "skip installers, clean the rest".
const selectedUpdaters = useMemo(() => {
let total = 0;
let count = 0;
for (const entry of entries) {
if (
entry.item.category === "update-installers" &&
entry.source.selected.has(entry.index) &&
!entry.item.lock
) {
total += entry.item.onDisk;
count += 1;
}
}
return { count, total };
}, [entries]);
const toggleGroup = (category: Category) => {
for (const source of [cleanup, purge]) {
if (source.result?.items.some((item) => item.category === category)) {
const anyOn = source.result.items.some(
(item, index) =>
item.category === category &&
!item.lock &&
source.selected.has(index),
);
source.setCategorySelection(category, !anyOn);
}
}
};
const groupSelected = (category: string) => {
const group = groups.get(category as Category);
return Boolean(group && group.count > 0 && group.selected === group.count);
};
const groupDisabled = (category: string) => {
const group = groups.get(category as Category);
return !group || group.count === 0 || group.selected === 0;
};
// One delete button, possibly two engines: run whichever halves have a
// selection, in order, and merge the outcome into one summary.
// `installerOnly` / `skipInstallers` drive the confirm-dialog escape so
// the user can split the run: keep installers now, or clean only them.
const cleanSelected = async (
opts: { installerOnly?: boolean; skipInstallers?: boolean } = {},
) => {
const plans: Array<{ source: ScanWorkspace; indexes: number[] }> = [];
for (const source of [cleanup, purge]) {
const indexes = [...source.selected].filter((index) => {
const item = source.result?.items[index];
if (!item || item.lock) return false;
const isInstaller = item.category === "update-installers";
if (opts.installerOnly) return isInstaller;
if (opts.skipInstallers && isInstaller) return false;
return true;
});
if (indexes.length > 0) plans.push({ source, indexes });
}
if (plans.length === 0) {
setConfirming(false);
return;
}
setBusy(true);
const merged: DeleteResult = {
freed: 0,
freedAllocated: 0,
removed: 0,
failed: 0,
errors: [],
mode,
sessionId: null,
skipped: [],
};
try {
for (const plan of plans) {
const outcome = await plan.source.clean(mode, plan.indexes);
if (outcome) {
merged.freed += outcome.freed;
merged.freedAllocated += outcome.freedAllocated;
merged.removed += outcome.removed;
merged.failed += outcome.failed;
merged.errors.push(...outcome.errors);
merged.skipped.push(...outcome.skipped);
if (!merged.sessionId) merged.sessionId = outcome.sessionId;
}
}
} finally {
setBusy(false);
setConfirming(false);
}
setResult(merged);
push(
t(
`${formatBytes(merged.freedAllocated || merged.freed)} cleaned`,
`已清理 ${formatBytes(merged.freedAllocated || merged.freed)}`,
),
"success",
);
};
const progress = cleanup.progress ?? purge.progress;
const stage = cleanup.scanning
? t("Scanning caches and junk", "第一步 · 扫描缓存与垃圾")
: purge.scanning
? t("Scanning project folders", "第二步 · 扫描项目目录")
: t("Collecting results", "正在汇总结果");
const error = cleanup.error ?? purge.error;
if (result) {
return (
<div className="page">
<SectionTitle
title={t("Cleaning finished", "清理完成")}
subtitle={t(
"Everything else on this machine is untouched.",
"机器上的其他内容未被改动。",
)}
/>
<div className="hero">
<div>
<div className="k">{t("Done", "完成")}</div>
<div className="n">
{formatBytes(result.freedAllocated || result.freed)}{" "}
<small>
{t("freed", "已释放")} · {formatCount(result.removed)}{" "}
{t("items", "项")}
{result.failed > 0
? t(` · ${result.failed} failed`, ` · ${result.failed} 项失败`)
: ""}
</small>
</div>
</div>
<div className="acts">
<Button variant="ghost" onClick={() => setResult(null)}>
{t("Back", "返回")}
</Button>
<Button variant="secondary" onClick={onHistory}>
{t("Open history", "查看历史")}
</Button>
<Button variant="primary" icon={<ScanSearch size={15} />} onClick={() => void runScan()}>
{t("Scan again", "再扫一次")}
</Button>
</div>
</div>
</div>
);
}
return (
<div className="page">
<div className="space-head">
<div>
<div className="eyebrow">{t("Space cleaning", "空间清理")}</div>
<h1 className="page-title">
{t("One scan. Every bit of space.", "一次扫描,清掉能清的空间。")}
</h1>
<p className="page-desc">
{t(
"Caches, logs, update installers and rebuildable project artefacts — always reviewed before deletion.",
"缓存、日志、升级安装包与可重建的项目构建目录,删除前始终由您确认。",
)}
</p>
</div>
<Button
variant="primary"
icon={<ScanSearch size={16} />}
onClick={() => void runScan()}
disabled={scanning || deleting}
>
{t("Start scan", "开始扫描")}
</Button>
</div>
<div className="space-config">
<span className="space-config-label">
{t("Deep-scan folders", "深度扫描目录")}
</span>
<button
type="button"
className="space-config-value"
onClick={() => void browse()}
title={roots.replace(/\r?\n/g, "\n")}
>
{roots.trim()
? t(
`${roots.split(/\r?\n/).filter((line) => line.trim()).length} folder(s) · click to edit`,
`共 ${roots.split(/\r?\n/).filter((line) => line.trim()).length} 处 · 点击编辑`,
)
: t("Home folder (default)", "主目录(默认)")}
<FolderOpen size={13} />
</button>
<span className="space-config-label">
{t("Older than", "仅处理早于")}
</span>
<div className="space-seg">
{AGE_CHOICES.map((days) => (
<button
key={days}
type="button"
className={minAge === days ? "is-on" : ""}
onClick={() => setMinAge(days)}
>
{t(`${days} days`, `${days}天`)}
</button>
))}
</div>
<span className="space-config-label">
{t("Git-protected", "Git 保护")}
</span>
<Toggle
checked={!force}
onChange={(on) => setForce(!on)}
label={t("Git protection", "Git 保护")}
/>
<input
className="space-roots-hidden"
value={roots}
onChange={(event) => setRoots(event.target.value)}
aria-label={t("Project folders to inspect", "要检查的项目目录")}
/>
</div>
{scanning ? (
<div className="space-stage-steps">
<span className={`space-step ${cleanup.scanning ? "is-now" : "is-done"}`}>
{cleanup.scanning ? "◌" : "✓"} {t("Scan caches & junk", "扫描缓存与垃圾")}
</span>
<span
className={`space-step ${
purge.scanning ? "is-now" : !cleanup.scanning && cleanup.result ? "is-done" : ""
}`}
>
{purge.scanning ? "◌" : !cleanup.scanning && cleanup.result ? "✓" : "·"}{" "}
{t("Scan project folders", "扫描项目目录")}
</span>
<ProgressCard
progress={progress}
title={stage}
onCancel={() => void (cleanup.scanning ? cleanup.cancel() : purge.cancel())}
/>
</div>
) : null}
{deleting ? (
<div className="space-stage-steps">
<span className="space-step is-done">
✓ {t("Scan complete", "扫描完成")}
</span>
<span className="space-step is-now">
◌ {t("Cleaning", "正在清理")}({formatBytes(selectedStats.total)})
</span>
<ProgressCard
progress={progress}
title={t("Removing selected items", "正在删除已选项目")}
onCancel={() => void (cleanup.deleting ? cleanup.cancel() : purge.cancel())}
/>
</div>
) : null}
{error && !scanning ? (
<InlineError
message={error}
onDismiss={() => {
cleanup.clearError();
purge.clearError();
}}
/>
) : null}
{!scanning && !deleting && !cleanup.result && !purge.result ? (
<div className="empty-inline">
<ScanSearch size={22} />
<span>
{t(
"Not scanned yet. Start scan checks known cache spots and searches the project folders above.",
"尚未扫描。点击「开始扫描」,Squid 会检查已知缓存位置并搜索上方项目目录里的构建产物。",
)}
</span>
</div>
) : null}
{!scanning && !deleting && (cleanup.result || purge.result) ? (
<>
<div className="hero">
<div>
<span className="k">
<ShieldCheck size={13} />{" "}
{t("Scan complete · caches + projects", "扫描完成 · 缓存 + 项目目录")}
</span>
<h2>
{formatBytes(selectedStats.total)}
<small>
{t(" selected", " 已选")} ·{" "}
{formatBytes(
entries
.filter((entry) => !entry.item.lock)
.reduce((sum, entry) => sum + entry.item.onDisk, 0),
)}{" "}
{t("available in total", "全部可清理")}
</small>
</h2>
<p>
{t(
`${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(
entries.filter((entry) => !entry.item.lock).length,
)} 项${
optionalSelected > 0
? ` · 含 ${formatCount(optionalSelected)} 个可选类(升级包/项目产物/开发文件)`
: " · 可选类未勾选(默认只清理日常项)"
}`,
)}
</p>
</div>
<div className="hero-actions">
<Button
variant="ghost"
onClick={() => {
cleanup.clearSelection();
purge.clearSelection();
}}
disabled={selectedStats.count === 0}
>
{t("Deselect all", "取消全选")}
</Button>
<Button
variant="primary"
icon={<Trash2 size={16} />}
disabled={selectedStats.count === 0}
onClick={() => setConfirming(true)}
>
{t(
`Clean ${formatBytes(selectedStats.total)}`,
`清理已选 ${formatBytes(selectedStats.total)}`,
)}
</Button>
</div>
</div>
<div className="hint-strip">
{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.",
"默认只勾选日常清理项;虚线卡片(升级安装包 / 项目产物 / 开发文件)为可选,勾选后将与日常项合并成一次清理。",
)}
</div>
<div className="category-grid">
{CATEGORY_ORDER.filter((category) => groups.has(category)).map(
(category) => {
const group = groups.get(category)!;
const optional = OPTIONAL_CATEGORIES.includes(category);
return (
<div className="category-slot" key={category}>
{optional ? (
<span className="opt-tag">
{t("optional", "可选")}
</span>
) : null}
<CategoryCard
category={category}
total={group.total}
count={group.count}
selected={groupSelected(category)}
focused={false}
disabled={groupDisabled(category)}
onToggle={() => toggleGroup(category)}
onInspect={() => undefined}
/>
</div>
);
},
)}
</div>
<section className="cleanup-list-panel">
<SectionTitle
title={t("Everything found in this scan", "本次扫描的全部项目")}
subtitle={t(
"Only checked items are touched. Protected items stay locked.",
"只会处理已勾选的项目,受保护项目始终保持锁定。",
)}
/>
<div className="cleanup-rows">
{entries.map((entry) => (
<ItemRow
key={`${entry.item.path}-${entry.index}`}
item={entry.item}
checked={entry.source.selected.has(entry.index)}
onToggle={() => entry.source.toggleItem(entry.index)}
/>
))}
</div>
</section>
</>
) : null}
<ConfirmDialog
open={confirming}
title={t("Ready to make room?", "准备释放空间?")}
message={
<span>
{t(
`${formatCount(selectedStats.count)} items · ${formatBytes(selectedStats.total)}`,
`${formatCount(selectedStats.count)} 项 · ${formatBytes(selectedStats.total)}`,
)}
</span>
}
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 cleanSelected()}
onClose={() => setConfirming(false)}
busy={busy}
icon={<Trash2 size={23} />}
>
<div className="mode-picker">
<button
className={mode === "trash" ? "is-active" : ""}
onClick={() => setMode("trash")}
>
<FolderOpen size={17} />
<span>{bin}</span>
</button>
<button
className={mode === "permanent" ? "is-active" : ""}
onClick={() => setMode("permanent")}
>
<Trash2 size={17} />
<span>{t("Permanent", "永久")}</span>
</button>
</div>
{selectedUpdaters.count > 0 ? (
<div className="confirm-updater-banner">
<DownloadCloud size={18} />
<div>
<strong>
{t(
`Includes ${formatCount(selectedUpdaters.count)} update installers (${formatBytes(selectedUpdaters.total)})`,
`其中包含 ${formatCount(selectedUpdaters.count)} 个升级安装包(${formatBytes(selectedUpdaters.total)})`,
)}
</strong>
<span>
{t(
"Apps re-download them when needed. Delete them too?",
"应用需要时会自动重新下载。要一并清理吗?",
)}
</span>
</div>
<div className="confirm-updater-actions">
<Button
variant="ghost"
size="sm"
disabled={busy}
onClick={() => void cleanSelected({ installerOnly: true })}
>
{t("Only installers", "只清升级包")}
</Button>
<Button
variant="ghost"
size="sm"
disabled={busy}
onClick={() => void cleanSelected({ skipInstallers: true })}
>
{t("Skip installers, clean rest", "跳过升级包,只删其余")}
</Button>
</div>
</div>
) : null}
</ConfirmDialog>
</div>
);
}

View File

@ -5271,6 +5271,225 @@ select:focus-visible,
margin-bottom: 9px;
}
/* ---- 空间清理(日常+深度合并页) ---- */
.space-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 24px;
}
.space-head .eyebrow {
color: var(--nex-accent, #e05f21);
font-size: var(--nex-text-2xs);
font-weight: var(--nex-weight-bold);
letter-spacing: 1px;
}
.space-head h1 {
margin-top: 6px;
color: var(--nex-ink-strong, #241d13);
font-size: 30px;
font-weight: 800;
}
.space-head p {
margin-top: 8px;
color: var(--nex-muted);
font-size: var(--nex-text-xs);
}
.space-config {
display: flex;
align-items: center;
gap: 12px;
margin-top: 18px;
padding: 12px 18px;
border: 1px solid #eee1cc;
border-radius: 14px;
background: #fff;
}
.space-config-label {
color: #3a3226;
font-size: var(--nex-text-2xs);
font-weight: var(--nex-weight-bold);
white-space: nowrap;
}
.space-config-value {
display: inline-flex;
align-items: center;
gap: 6px;
min-width: 0;
flex: 1;
border: none;
background: none;
color: var(--nex-muted);
font-size: var(--nex-text-2xs);
text-align: left;
cursor: pointer;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.space-config-value:hover {
color: #e05f21;
}
.space-seg {
display: flex;
gap: 2px;
padding: 3px;
border-radius: 9px;
background: #f4ecdd;
}
.space-seg button {
border: none;
border-radius: 7px;
padding: 4px 12px;
background: transparent;
color: #8a7a60;
font-size: var(--nex-text-2xs);
}
.space-seg button.is-on {
background: #fff;
color: #3a3226;
font-weight: var(--nex-weight-bold);
box-shadow: 0 1px 4px rgba(120, 80, 30, 0.15);
}
.space-roots-hidden {
width: 150px;
padding: 5px 9px;
border: 1px solid #eee1cc;
border-radius: 8px;
background: #fbf6ec;
color: var(--nex-muted);
font-size: var(--nex-text-2xs);
}
.space-stage-steps {
display: flex;
flex-direction: column;
gap: 10px;
margin-top: 16px;
}
.space-step {
align-self: flex-start;
border-radius: 99px;
padding: 5px 14px;
font-size: var(--nex-text-2xs);
color: #b3a288;
background: #f4ecdd;
}
.space-step.is-done {
color: #2c7a5b;
background: #e2f3ea;
}
.space-step.is-now {
color: #e05f21;
background: #fdeadd;
font-weight: var(--nex-weight-bold);
}
.hero {
display: flex;
align-items: center;
justify-content: space-between;
gap: 20px;
margin-top: 16px;
padding: 18px 22px;
border: 1px solid #eee1cc;
border-radius: 14px;
background: #fff;
}
.hero .k {
display: inline-flex;
align-items: center;
gap: 6px;
color: #e05f21;
font-size: var(--nex-text-2xs);
font-weight: var(--nex-weight-bold);
}
.hero h2 {
margin-top: 4px;
color: var(--nex-ink-strong, #241d13);
font-size: 30px;
font-weight: 800;
}
.hero h2 small {
color: var(--nex-muted);
font-size: var(--nex-text-xs);
font-weight: var(--nex-weight-medium);
}
.hero p {
margin-top: 4px;
color: #a08a68;
font-size: var(--nex-text-2xs);
}
.hero-actions {
display: flex;
gap: 8px;
align-items: center;
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);
}
.category-slot {
position: relative;
}
.opt-tag {
position: absolute;
top: -8px;
right: 8px;
z-index: 2;
border-radius: 99px;
padding: 2px 9px;
background: #3f6bbd;
color: #fff;
font-size: 10px;
font-weight: var(--nex-weight-bold);
}
.category-slot .category-card {
height: 100%;
}
.category-slot:has(.opt-tag) .category-card {
border-style: dashed;
border-color: #b9c6e4;
}
.confirm-updater-actions {
display: flex;
flex-direction: column;
gap: 4px;
flex-shrink: 0;
}
/* ---- 桌面小工具 (desktop widget) -------------------------------------- */
/* The widget window reuses this bundle; punch the opaque app background

View File

@ -1,9 +1,8 @@
export type Language = "zh" | "en";
export type PageId =
| "overview"
| "cleanup"
| "space"
| "applications"
| "purge"
| "permissions"
| "widget"
| "storage"