Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

feat(web): 分类切换条按 Geist secondary Tabs 对齐,垃圾文件回到骨架

longmeidao51450799f547
diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md
index 1ed9ae7b0..1052453d4 100644
--- a/docs/HANDOFF.md
+++ b/docs/HANDOFF.md
@@ -1,7 +1,7 @@
# Peach 交接与长期工作约定
本文件只保存跨任务长期有效的事实和工作规则,不记录逐次聊天流水。每条判据只写一句,
-展开的测量值、像素、命令和事故过程放在对应的技能、参考快照、L2 文档、代码注释和测试里。
+展开的测量值、命令和事故过程放在技能、参考快照、L2 文档和测试里。
## 界面、媒体与复核的既定判据
@@ -72,12 +72,12 @@
快照、URL、版本、SHA、未取得面与 Peach 的有意差异统一登记在 `docs/reference-sources.json` 和
`docs/reference-snapshots/`,每份快照自带「Peach 采用与差异」一节;获取、失效复核与接受更新的流程见
`.claude/skills/peach-reference-evidence/SKILL.md`。本文件不复制会随上游变化的测量值,只登记哪件事看哪份快照。
-登记表的契约是「快照文件 + 可重抓 URL」,所以 React 渲染的规格页、用户截图和「哪个主机还能取到图」这类实测不进登记表,
-但必须在快照正文里写明为什么不进——`tests/test_reference_updates.py` 会拒绝既没登记也没说明的快照。
+React 渲染的规格页、用户截图这类给不出可重抓字节的实测不进登记表,但要在快照正文写明理由——`tests/test_reference_updates.py` 会拒绝既没登记也没说明的快照。
- 相关推荐算法:`openaver-related-ranking`,固定 revision,只参考 Tag IDF 与结构化共同点,MMR 和稳定破同分是 Peach 自加,不复制上游界面或源码。
- 网格、控件半径、语义 token 与中间省略:`vercel-geist-grid`、`vercel-geist-controls-measured`、`vercel-geist-middle-truncate`;中间省略只用于路径、URL、ID、SHA 这类首尾都有信息的值,必须显式 `data-middle-truncate`,标题、说明、人名和标签保留末尾省略。
- 统计与口味两页的层级,Note/Progress/Switch/Fieldset/Scroller/Empty State 的语义,按钮的尺寸档与三态:`vercel-geist-semantics-measured`、`vercel-geist-note-progress-switch-analytics`、`vercel-geist-fieldset-scroller-empty-state`。
+- 分类切换条属于 Tabs 的 secondary 变体而不是分段器:`vercel-geist-tabs-secondary-measured`。
- 表格、排行与面包屑:`vercel-geist-table-ranking`、`vercel-geist-breadcrumbs`;同形可比较数据才用语义 `table` 并保持 tabular numerals,内容标签是固定 Top 排行和直接筛选,不伪装成可排序数据表。
- 设置 Dialog 动效、搜索期 Spinner、后台 Loading Dots 与 busy 按钮:`vercel-geist-command-search-loading`;中性说明 Note:`vercel-notifications-note`;具名动作 Toast:`vercel-geist-toast`。用户直接触发的动作用 Spinner,后台扫描用 Loading Dots,等待按钮经共享 busy 状态变灰但不用原生 `disabled`。
- 资料页阅读顺序与照片入口:`beeg-profile-layout`;JAV 标题显示语义:`jav-title-user-screenshot`,只在 `is_jav` 项目上应用,不改真实文件名,也不在账本只有番号时伪造官方标题。
diff --git a/docs/reference-snapshots/upstream/vercel-geist-switch.md b/docs/reference-snapshots/upstream/vercel-geist-switch.md
new file mode 100644
index 000000000..ea661ce37
--- /dev/null
+++ b/docs/reference-snapshots/upstream/vercel-geist-switch.md
@@ -0,0 +1,193 @@
+# Switch
+
+Choose between a set of options.
+
+---
+
+## Default
+
+Ensure the width of each item is wide enough to prevent jumping when active.
+
+```tsx
+import { Switch, SwitchControl } from '@vercel/geistcn/components';
+import type { JSX } from 'react';
+
+export function Component(): JSX.Element {
+ return (
+ <div className="flex relative min-w-px max-w-full flex-col items-start flex-1">
+ <Switch name="default">
+ <SwitchControl defaultChecked label="Source" value="source" />
+ <SwitchControl label="Output" value="output" />
+ </Switch>
+ </div>
+ );
+}
+```
+
+## Disabled
+
+```tsx
+import { Switch, SwitchControl } from '@vercel/geistcn/components';
+import type { JSX } from 'react';
+
+export function Component(): JSX.Element {
+ return (
+ <div className="flex relative min-w-px max-w-full flex-col items-start flex-1">
+ <Switch name="view-mode">
+ <SwitchControl defaultChecked disabled label="Source" value="source" />
+ <SwitchControl disabled label="Output" value="output" />
+ </Switch>
+ </div>
+ );
+}
+```
+
+## Sizes
+
+```tsx
+import { Switch, SwitchControl } from '@vercel/geistcn/components';
+import type { JSX } from 'react';
+
+export function Component(): JSX.Element {
+ return (
+ <div className="flex relative min-w-px max-w-full flex-col lg:flex-row lg:flex-wrap flex-1">
+ <div className="flex relative min-w-px max-w-full flex-col items-start flex-1">
+ <Switch name="sizes-small" size="small">
+ <SwitchControl defaultChecked label="Source" value="source" />
+ <SwitchControl label="Output" value="output" />
+ </Switch>
+ </div>
+
+ <div className="flex relative min-w-px max-w-full flex-col items-start flex-1">
+ <Switch name="sizes-default">
+ <SwitchControl defaultChecked label="Source" value="source" />
+ <SwitchControl label="Output" value="output" />
+ </Switch>
+ </div>
+
+ <div className="flex relative min-w-px max-w-full flex-col items-start flex-1">
+ <Switch name="sizes-large" size="large">
+ <SwitchControl defaultChecked label="Source" value="source" />
+ <SwitchControl label="Output" value="output" />
+ </Switch>
+ </div>
+ </div>
+ );
+}
+```
+
+## Full width
+
+```tsx
+import { Switch, SwitchControl } from '@vercel/geistcn/components';
+import type { JSX } from 'react';
+
+export function Component(): JSX.Element {
+ return (
+ <Switch name="full-width" style={{ width: '100%' }}>
+ <SwitchControl
+ defaultChecked
+ label="Source"
+ size="large"
+ value="source"
+ />
+ <SwitchControl label="Output" size="large" value="output" />
+ </Switch>
+ );
+}
+```
+
+## Tooltip
+
+```tsx
+import { Switch, Tooltip, SwitchControl } from '@vercel/geistcn/components';
+import type { JSX } from 'react';
+
+export function Component(): JSX.Element {
+ return (
+ <div className="flex relative min-w-px max-w-full flex-col items-start flex-1">
+ <Switch name="view-mode">
+ <Tooltip desktopOnly text="View Source">
+ <SwitchControl
+ defaultChecked
+ label="Source"
+ name="tooltip"
+ size="large"
+ value="source"
+ />
+ </Tooltip>
+ <Tooltip desktopOnly text="View Output">
+ <SwitchControl
+ label="Output"
+ name="tooltip"
+ size="large"
+ value="output"
+ />
+ </Tooltip>
+ </Switch>
+ </div>
+ );
+}
+```
+
+## Icon
+
+```tsx
+import { Switch, SwitchControl } from '@vercel/geistcn/components';
+import type { JSX } from 'react';
+import {
+ IconGridSquare,
+ IconListUnordered,
+} from '@vercel/geistcn-assets/icons';
+
+export function Component(): JSX.Element {
+ return (
+ <div className="flex relative min-w-px max-w-full flex-col lg:flex-row lg:flex-wrap flex-1">
+ <div className="flex relative min-w-px max-w-full flex-col items-start flex-1">
+ <Switch name="icons-small" size="small">
+ <SwitchControl
+ defaultChecked
+ icon={<IconGridSquare />}
+ value="source"
+ />
+ <SwitchControl icon={<IconListUnordered />} value="output" />
+ </Switch>
+ </div>
+
+ <div className="flex relative min-w-px max-w-full flex-col items-start flex-1">
+ <Switch name="icons-default">
+ <SwitchControl
+ defaultChecked
+ icon={<IconGridSquare />}
+ value="source"
+ />
+ <SwitchControl icon={<IconListUnordered />} value="output" />
+ </Switch>
+ </div>
+
+ <div className="flex relative min-w-px max-w-full flex-col items-start flex-1">
+ <Switch name="icons-large" size="large">
+ <SwitchControl
+ defaultChecked
+ icon={<IconGridSquare />}
+ value="source"
+ />
+ <SwitchControl icon={<IconListUnordered />} value="output" />
+ </Switch>
+ </div>
+ </div>
+ );
+}
+```
+
+## Best Practices
+
+* Use Switch as a segmented selector for 2–3 mutually exclusive options that show different views of the same surface, like `Source` vs `Output`.
+* For a boolean on/off setting, use `Toggle`. Switch implements radio semantics, so two options stay mutually exclusive rather than reading as a checkbox.
+* Past 3 options or when labels grow beyond a couple of words, switch to `Tabs` or a `Select`.
+* Pass a `name` so the underlying radios are grouped; without it, more than one option can appear selected at once.
+* Set `defaultChecked` (or controlled `checked`) on exactly one `Switch.Control` so the group has a defined initial state.
+* Pad each `Switch.Control` so the widest label fits without the active pill resizing on selection. Test with the longest copy in the set.
+* Title Case each `Switch.Control` label. Keep labels to one or two words and parallel: `Source` / `Output`, not `Source` / `Show output`.
+* Always provide a `label` on every `Switch.Control`, even when an `icon` carries the meaning, so screen readers announce the option. The component renders it as `geist-sr-only` for icon-only controls.
+* Pair an icon-only Switch with a `Tooltip` on each control so sighted users get the same label assistive tech receives.
diff --git a/docs/reference-snapshots/upstream/vercel-geist-tabs.md b/docs/reference-snapshots/upstream/vercel-geist-tabs.md
new file mode 100644
index 000000000..1c55c2a8c
--- /dev/null
+++ b/docs/reference-snapshots/upstream/vercel-geist-tabs.md
@@ -0,0 +1,162 @@
+# Tabs
+
+Display tab content.
+
+---
+
+## Default
+
+```tsx
+import { Tabs } from '@vercel/geistcn/components';
+import { useState, type JSX } from 'react';
+
+export function Component(): JSX.Element {
+ const [selected, setSelected] = useState('apple');
+
+ return (
+ <Tabs
+ selected={selected}
+ setSelected={(t) => setSelected(t)}
+ tabs={[
+ { title: 'Apple', value: 'apple' },
+ { title: 'Orange', value: 'orange' },
+ { title: 'Mango', value: 'mango' },
+ ]}
+ />
+ );
+}
+```
+
+## Disabled
+
+```tsx
+import { Tabs } from '@vercel/geistcn/components';
+import { useState, type JSX } from 'react';
+
+export function Component(): JSX.Element {
+ const [selected, setSelected] = useState('apple');
+
+ return (
+ <Tabs
+ disabled
+ selected={selected}
+ setSelected={(t) => setSelected(t)}
+ tabs={[
+ { title: 'Apple', value: 'apple' },
+ { title: 'Orange', value: 'orange' },
+ { title: 'Mango', value: 'mango' },
+ ]}
+ />
+ );
+}
+```
+
+## Disable specific tabs
+
+```tsx
+import { Tabs } from '@vercel/geistcn/components';
+import { useState, type JSX } from 'react';
+
+export function Component(): JSX.Element {
+ const [selected, setSelected] = useState('apple');
+
+ return (
+ <Tabs
+ selected={selected}
+ setSelected={(t) => setSelected(t)}
+ tabs={[
+ { title: 'Apple', value: 'apple' },
+ { title: 'Orange', value: 'orange' },
+ {
+ title: 'Mango',
+ value: 'mango',
+ disabled: true,
+ tooltip: 'Mangos are not allowed',
+ },
+ ]}
+ />
+ );
+}
+```
+
+## With icons
+
+```tsx
+import { Tabs } from '@vercel/geistcn/components';
+import {
+ LogoIconBitbucket,
+ LogoIconGithubSvg,
+ LogoIconGitlabSvg,
+} from '@vercel/geistcn-assets/logos';
+import { useState, type JSX } from 'react';
+
+export function Component(): JSX.Element {
+ const [git, setGit] = useState('github');
+
+ return (
+ <Tabs
+ selected={git}
+ setSelected={(t) => setGit(t)}
+ tabs={[
+ { title: 'GitHub', value: 'github', icon: <LogoIconGithubSvg /> },
+ { title: 'GitLab', value: 'gitlab', icon: <LogoIconGitlabSvg /> },
+ {
+ title: 'Bitbucket',
+ value: 'bitbucket',
+ icon: <LogoIconBitbucket colored />,
+ },
+ ]}
+ />
+ );
+}
+```
+
+## Secondary
+
+```tsx
+import { Tabs } from '@vercel/geistcn/components';
+import { useState, type JSX } from 'react';
+
+export function Component(): JSX.Element {
+ const [git, setGit] = useState('github');
+
+ return (
+ <Tabs
+ selected={git}
+ setSelected={(t) => setGit(t)}
+ tabs={[
+ { title: 'GitHub', value: 'github' },
+ { title: 'GitLab', value: 'gitlab' },
+ { title: 'Bitbucket', value: 'bitbucket', disabled: true },
+ ]}
+ variant="secondary"
+ />
+ );
+}
+```
+
+## Best Practices
+
+### When to use
+
+* Use Tabs to switch between sibling views inside a single page (`Overview`, `Logs`, `Settings`).
+* For navigation between unrelated pages, use a sub-menu, not Tabs. Tabs imply the views share scope, URL parent, and data model.
+* Cap a Tabs row at 5–7 entries on desktop and 3–4 on mobile. Past that, consolidate or move secondary views behind a `Menu`.
+
+### Behavior
+
+* Selecting a tab is instant; don’t trigger network confirmation or toast on tab change.
+* Reflect the active tab in the URL (query param or path) so deep-links and refresh restore state.
+* Disable individual tabs only for permission or empty-state reasons; pair the disabled tab with a `tooltip` that names the constraint.
+
+### Content
+
+* `tabs[].title` is Title Case, 1–2 words, and names the destination noun (`Overview`, `Logs`, `Settings`). Verbs belong on buttons; `View Logs` is wrong on a tab.
+* `tabs[].tooltip` is sentence case and explains the constraint (`Only visible to project owners.`), not the tab’s purpose.
+* Don’t append a count to the title (`Logs (12)`); use a badge slot instead and drop the badge at zero.
+
+### Accessibility
+
+* Keep Left/Right arrows moving focus across tabs and Enter/Space activating; don’t hijack with global shortcuts.
+* Label the tablist with `aria-label` when no visible heading sits above it (`aria-label="Sections"`).
+* Maintain a visible focus ring on the active tab; don’t suppress focus styles for visual polish.
diff --git a/docs/reference-snapshots/vercel-geist-tabs-secondary-measured.md b/docs/reference-snapshots/vercel-geist-tabs-secondary-measured.md
new file mode 100644
index 000000000..f9b68b27c
--- /dev/null
+++ b/docs/reference-snapshots/vercel-geist-tabs-secondary-measured.md
@@ -0,0 +1,48 @@
+# Geist Tabs 的两个变体与分段器的分界(实测)
+
+不登记进 `docs/reference-sources.json`:这里是浏览器实测的 DOM 计算值,给不出可重抓的上游字节。
+对应的上游正文已登记,见 `docs/reference-snapshots/upstream/vercel-geist-tabs.md`
+(来源 id `vercel-geist-tabs-secondary`)与 `docs/reference-snapshots/upstream/vercel-geist-switch.md`
+(来源 id `vercel-geist-switch-segmented`)。
+
+取证方式:2026-09-03 在浏览器打开 `https://vercel.com/geist/tabs` 与 `https://vercel.com/geist/switch`,
+对 `[role="tablist"]` 及其 `[role="tab"]` 逐个读 `getComputedStyle` 与 `getBoundingClientRect`。
+页面是深色主题,下面的 RGB 都是深色下的实测值。
+
+## Tabs:primary(默认)
+
+| 部位 | 实测 |
+| --- | --- |
+| tablist | `display:flex`、`gap:24px`、高 50px、`box-shadow:0 -1px 0 rgb(51,51,51) inset`(整条底线) |
+| tab | `padding:14px 2px`、`font-size:14px`、`font-weight:400`、无圆角、无底色 |
+| 选中 | 文字 `rgb(237,237,237)`,`border-bottom:2px solid rgb(237,237,237)` |
+| 未选中 | 文字 `rgb(161,161,161)`,`border-bottom:2px solid transparent` |
+
+## Tabs:secondary(`variant="secondary"`)
+
+| 部位 | 实测 |
+| --- | --- |
+| tablist | `display:flex`、`gap:normal`(即 0)、高 32px、`!shadow-none`(不画底线) |
+| tab | 高 32px、`padding:0 12px`、`border-radius:6px`、`font-size:13px`、`font-weight:400`、无边框 |
+| 选中 | 底 `rgb(31,31,31)`(`--accents-2` 那一级),文字 `rgb(237,237,237)` |
+| 未选中 | 底透明,文字 `rgb(161,161,161)` |
+
+## Switch(分段器)
+
+上游 Best Practices 原文见已登记的 upstream 文件。判据只有三条:分段器用于 2–3 个互斥选项、
+两三个字的短标签、同一表面的不同视图;超过 3 项或标签变长就改用 Tabs 或 Select;布尔开关用 Toggle。
+容器与选中块的实测数值早前已记在 `docs/reference-snapshots/vercel-geist-note-progress-switch-analytics.md`。
+
+## Peach 的落点与保留的差异
+
+- 人工复核分类 10 项、垃圾文件分类 7 项,都越过分段器的 2–3 项上限,所以这两条是 Tabs 不是 Switch。
+ 两条现有的 pill 外观本来就对应 secondary 变体,不改成下划线式,只把数值对齐 secondary。
+- 浅色主题里选中底色取 `--hover`:深色实测的 `rgb(31,31,31)` 是「比页面底色高一级的中性面」,
+ Peach 浅色下同一语义的变量是 `--hover`,不是墨色反相。原先两条都用 `--ink-2` 反相 + 600 字重,
+ 比规范重了一整级。
+- 计数按规范当徽标处理,为 0 时整枚去掉,不留 `0` 占位。
+- 垃圾文件那条仍是 `<a href>` 导航而不是 `role="tab"`:规范要求当前项反映在 URL 上可深链,
+ Peach 这里就是靠 `?type=` 做的;同一条里的「已排除」是另一根轴(视图切换),
+ 用分隔符隔开,也不进 tablist。复核分类没有独立 URL,升级成了真正的 `role="tablist"`
+ 加左右方向键漫游焦点。
+- Peach 保留每项前的图标(上游 `With icons` 示例支持 icon slot)与 40em 以下 44px 触摸高度。
diff --git a/docs/reference-sources.json b/docs/reference-sources.json
index fd65b5143..151d7e3e4 100644
--- a/docs/reference-sources.json
+++ b/docs/reference-sources.json
@@ -245,6 +245,34 @@
"web/app.js",
"tests/test_web_ui.py"
]
+ },
+ {
+ "id": "vercel-geist-tabs-secondary",
+ "name": "Vercel Geist Tabs 规范与 secondary 变体",
+ "url": "https://vercel.com/geist/tabs",
+ "snapshot": "docs/reference-snapshots/upstream/vercel-geist-tabs.md",
+ "checked_on": "2026-09-03",
+ "sha256": "41d0602d64c6a941e350d01b3c70b86e6a57a3f55d621ba43af26e081b46e347",
+ "role": "分类切换条的组件归属、条数上限、计数徽标与可访问性语义;secondary 变体是 Peach 现有 chip 条的规范原型。",
+ "consumers": [
+ "web/app.css",
+ "web/app.js",
+ "tests/test_web_ui.py"
+ ]
+ },
+ {
+ "id": "vercel-geist-switch-segmented",
+ "name": "Vercel Geist Switch 分段器取舍",
+ "url": "https://vercel.com/geist/switch",
+ "snapshot": "docs/reference-snapshots/upstream/vercel-geist-switch.md",
+ "checked_on": "2026-09-03",
+ "sha256": "20e383d97024c9a0ff7a26fcdcd120a1bc0904bdfb10ffe96a6e03f8dd758849",
+ "role": "判定分段器只用于 2–3 项互斥视图、超过 3 项或长标签改用 Tabs 的分界线。",
+ "consumers": [
+ "web/app.css",
+ "web/app.js",
+ "tests/test_web_ui.py"
+ ]
}
]
}
diff --git a/tests/test_reference_updates.py b/tests/test_reference_updates.py
index ca153f109..81773cdb0 100644
--- a/tests/test_reference_updates.py
+++ b/tests/test_reference_updates.py
@@ -38,6 +38,8 @@ class ReferenceUpdateTests(unittest.TestCase):
"vercel-notifications-note",
"youtube-player-controls-user-screenshot",
"openaver-related-ranking",
+ "vercel-geist-tabs-secondary",
+ "vercel-geist-switch-segmented",
"youtube-stats-buffer-20260829"},
)
self.assertNotEqual(
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.py
index e105557fd..71d2e128b 100644
--- a/tests/test_web_ui.py
+++ b/tests/test_web_ui.py
@@ -2126,12 +2126,73 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains("kind==='dispose'&&r.disposal==='trash'&&state.state==='ads'")
def test_junk_empty_state_only_appears_after_the_loading_request_finishes(self):
- """待判断为空是请求终态;加载期间只能显示 Loading Dots,不能先闪空态。"""
+ """待判断为空是请求终态;加载期间显示的是骨架,不能先闪空态。"""
branch = self.app_js.split("if(state.state==='ads'){", 1)[1].split("adsBatch=null;", 1)[0]
request = "const nextAds=await surfaceApi(surface,'/api/ads?'+junkQuery)"
- self.assertLess(branch.index("loadingDotsHtml('正在读取垃圾文件…')"), branch.index(request))
+ self.assertLess(branch.index("if(reset)$('#loadSentinel').hidden=true;"), branch.index(request))
self.assertLess(branch.index(request), branch.index("emptyState('check'"))
- self.assertPageContains("$('#loadSentinel').hidden=true")
+
+ def test_junk_files_wait_on_a_structural_skeleton_not_loading_dots(self):
+ """垃圾文件页等的是一屏同质卡片,不是后台任务的进度。
+
+ `.claude/skills/peach-web-ui/SKILL.md` 的判据:整页或大区块首次等待内容结构用
+ Skeleton,后台任务仍在推进才用 Loading Dots。垃圾文件页的正文就是一格一格的
+ `.junkcard`,跟目录网格同形;这里画 Loading Dots 等于把「等下会出现几张什么形状
+ 的卡」换成了「还在跑」。两条进入路径——深链首屏和路由后的 `load(true)`——必须
+ 说同一句话,否则整页刷新会连播两段动画:先骨架,再 dots。
+ """
+ self.assertPageContains("renderCatalogLoading('正在读取垃圾文件');")
+ self.assertPageContains("renderCatalogLoading(state.state==='ads'?'正在读取垃圾文件':'正在读取作品')")
+ self.assertPageLacks("loadingDotsHtml('正在读取垃圾文件…')")
+ self.assertPageLacks("junkloading")
+
+ def test_category_switchers_are_geist_secondary_tabs_not_a_segmented_control(self):
+ """复核分类和垃圾文件分类是同一个控件:Geist Tabs 的 secondary 变体。
+
+ 证据:`docs/reference-snapshots/vercel-geist-tabs-secondary-measured.md`,上游正文锁在
+ `docs/reference-snapshots/upstream/vercel-geist-tabs.md` 与 `.../vercel-geist-switch.md`。
+ 分段器(Switch)只承担 2–3 项互斥视图,标签超过两三个字就要换 Tabs;复核分类 10 项、
+ 垃圾文件分类 7 项都在界外,所以这两条是 Tabs 不是分段器。secondary 变体实测是无边框
+ pill:高 32px、左右 12px、6px 圆角、13px/400,选中只换底色。原先那套 `--ink-2` 反相加
+ 600 字重比规范重了一整级,而且两条各画各的,同一个控件在两页长得不一样。
+ """
+ self.assertPageContains(
+ ".reviewtabs,.junkfilters{display:flex;align-items:center;gap:0;min-width:0;"
+ "overflow-x:auto;scrollbar-width:none}")
+ self.assertCode(
+ ".reviewtabs button,.junkfilters a{box-sizing:border-box;height:32px;padding:0 12px;flex:none;"
+ "display:inline-flex;align-items:center;gap:6px;border:0;border-radius:var(--control-radius);"
+ "background:transparent;color:var(--muted);text-decoration:none;font:inherit;"
+ "font-size:var(--fs-sm);font-weight:400;white-space:nowrap;cursor:pointer}")
+ self.assertPageContains(
+ '.reviewtabs button[aria-selected="true"],.junkfilters a[aria-current="page"]'
+ '{background:var(--hover);color:var(--ink)}')
+ # 反相和边框都得真的消失,否则规范只落在注释里。
+ self.assertPageLacks('.reviewtabs button[aria-pressed="true"]{background:var(--ink-2)')
+ self.assertPageLacks('.junkfilters a[aria-current="page"]{border-color:var(--ink-2)')
+ # 复核那条没有独立 URL,升级成真 tablist:方向键漫游焦点,tabindex 只留在选中项上。
+ self.assertPageContains('<div class="reviewtabs" role="tablist" aria-label="复核分类">')
+ self.assertPageContains('<button role="tab" id="reviewtab-${key}" aria-controls="reviewpanel"')
+ self.assertPageContains('aria-selected="${on}" tabindex="${on?' + repr('0') + ':' + repr('-1') + '}"')
+ self.assertPageContains('<section class="reviewsection" id="reviewpanel" role="tabpanel" '
+ 'aria-labelledby="reviewtab-${reviewCategory}">')
+ self.assertPageLacks('<button data-review-tab="${key}" aria-pressed=')
+ self.assertPageContains("const step=event.key==='ArrowRight'?1:event.key==='ArrowLeft'?-1:0;")
+ self.assertPageContains(
+ ":event.key==='Home'?reviewTabs[0]:event.key==='End'?reviewTabs[reviewTabs.length-1]:null;")
+ # 垃圾文件那条仍是链接:规范要求当前项落在 URL 上,可深链、刷新可恢复。
+ self.assertPageContains('<nav class="junkfilters" aria-label="垃圾文件分类">')
+ self.assertPageContains('data-junk-kind-link="${esc(key)}"${current?' + repr(' aria-current="page"'))
+ # 计数是徽标不是标题的一部分,为 0 时整枚去掉,两条一个口径。
+ self.assertPageContains(
+ 'count?` <span class="n mono">${count.toLocaleString()}</span>`:' + repr(''))
+ self.assertPageContains(
+ 'dismissedTotal?` <span class="n mono">${dismissedTotal.toLocaleString()}</span>`:' + repr(''))
+ self.assertPageLacks(" <span>${countFor(key).toLocaleString()}</span>")
+ self.assertPageContains(".reviewtabs .n,.junkfilters .n{color:var(--muted);"
+ "font-size:var(--fs-xs);font-variant-numeric:tabular-nums}")
+ # 40em 以下要抬高触摸目标;控件现在是定高,min-height 压不动它,两条 tab 一起抬。
+ self.assertPageContains(".reviewtabs button,.junkfilters a{height:44px}")
def test_junk_review_and_trash_render_every_physical_resource_type(self):
"""图片、网址快捷方式等不能复用视频播放器,但必须可预览、回收和还原。"""
@@ -2214,10 +2275,51 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains('class="pagelede mono" id="manageLede" hidden')
self.assertPageContains(".pagelede{margin:0 0 16px;color:var(--muted);font-size:var(--fs-sm);line-height:1.5}")
self.assertPageContains("paintManageLede(`${d.total} 组 · ${d.files} 个文件 · 可回收 ${fmtSize(d.reclaimable)}`)")
- self.assertPageContains("if(trash)paintManageLede(`${total.toLocaleString()} 个符合 · 显示 ${n}`)")
+ self.assertPageContains("if(trash)paintManageLede(`${total.toLocaleString()} 个符合 · 显示 ${n}`,")
self.assertPageContains(".count.count-actions-only:empty{display:none}")
self.assertPageLacks('class="dupsum mono"')
+ def test_empty_trash_shares_the_lede_row_instead_of_taking_one_of_its_own(self):
+ """「清空回收站」和它左边那句计数说的是同一批文件,同属说明行。
+
+ 回收站的说明搬进 `#manageLede` 之后,计数栏里就只剩这一个按钮:标题和网格之间
+ 因此空出一条只放一个按钮的带子。说明行支持右端动作后两者并成一行。`hidden` 的
+ 判据要同时看文本和动作——只看文本的话,总数为 0 时那句说明还在,判据却没变;
+ 真正的风险是反过来:有动作没文本时整行被藏掉,按钮跟着消失。
+ """
+ self.assertPageContains("function paintManageLede(text='',actionsHtml='')")
+ self.assertPageContains("el.hidden=!text&&!actionsHtml;")
+ self.assertPageContains("el.classList.toggle('pagelede-actions',!!actionsHtml);")
+ self.assertPageContains("if(actionsHtml)el.insertAdjacentHTML('beforeend',actionsHtml);")
+ lede = self.app_js.split("if(trash)paintManageLede(", 1)[1].split("$('#count')", 1)[0]
+ self.assertIn('class="batchaction danger" id="emptyTrash"', lede,
+ "清空回收站要挂在说明行上,不是自己占一行")
+ # 计数栏在回收站页只剩空壳,靠 :empty 收掉;按钮不能同时还留在 .sorts 里。
+ sorts = self.app_js.split('<span class="sorts">', 1)[1].split('</span>', 1)[0]
+ self.assertNotIn('id="emptyTrash"', sorts)
+ self.assertPageContains(
+ ".pagelede-actions{display:flex;align-items:center;justify-content:space-between;gap:16px}")
+ self.assertPageContains(
+ ".pagelede-actions .batchaction.danger{background:var(--drop);border-color:var(--drop);color:#fff}")
+ self.assertPageLacks(".count .sorts .batchaction.danger{")
+ # 桌面 32px 是 Geist 的控件高度,手机要回到本项目的 44px 命中区。
+ self.assertPageContains(".pagelede-actions .batchaction{height:44px;padding-inline:16px}")
+
+ def test_only_the_data_cleanup_hub_narrows_its_title_column(self):
+ """812px 窄列是数据管理 hub 自己的正文宽度,不是整个数据管理区的。
+
+ `.cleanuppage` 把 hub 那一页收进 812px,标题和面包屑跟着收才对得齐。但同一个
+ section 底下的垃圾文件、重复文件正文都是全宽网格:跟着收就是宽屏上标题凭空左缩
+ 一截,标题左边缘和第一张卡的左边缘对不上。判据必须是路径,不是 section。
+ """
+ self.assertCode("document.body.classList.toggle('cleanup-layout',"
+ "current==='cleanup'&&decodeURIComponent(location.pathname)==='/data-cleanup')")
+ self.assertPageLacks("document.body.classList.toggle('cleanup-layout',current==='cleanup')")
+ # 窄列本体仍在 hub 上,这两条规则本身不动。
+ self.assertPageContains(".cleanuppage{width:min(812px,100%);margin:0 auto}")
+ self.assertPageContains(
+ ".cleanup-layout .geist-breadcrumb,.cleanup-layout .managetitle,.cleanup-layout .pagelede")
+
def test_returning_home_from_any_surface_moves_the_highlight(self):
"""Logo、侧栏和沉浸关闭都必须清掉隐藏筛选,不能让 `/` 继续请求 JAV。"""
self.assertPageContains("function resetHomeState(){")
@@ -2952,7 +3054,7 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains(".sbadge.error i{background:var(--drop)}")
# 清空回收站:danger 语义色。
self.assertPageContains('class="batchaction danger" id="emptyTrash"')
- self.assertPageContains(".count .sorts .batchaction.danger{background:var(--drop);border-color:var(--drop);color:#fff;font-weight:500}")
+ self.assertPageContains(".pagelede-actions .batchaction.danger{background:var(--drop);border-color:var(--drop);color:#fff}")
# Geist 菜单:触发器和每个选项都有入口图标,菜单内部滚动且不加猜测动画。
self.assertPageContains('data-sidebar-add-trigger aria-haspopup="listbox" aria-expanded="false"')
self.assertPageContains('role="option" data-sidebar-add-option=')
diff --git a/web/app.css b/web/app.css
index ee62be2a1..4d5bfb72b 100644
--- a/web/app.css
+++ b/web/app.css
@@ -225,6 +225,16 @@ button[aria-busy="true"],[role="button"][aria-busy="true"]{
/* 管理页标题下的说明只用这一种字形和间距;不要再让统计容器或吸顶计数栏各画一份。 */
.pagelede{margin:0 0 16px;color:var(--muted);font-size:var(--fs-sm);line-height:1.5}
.pagelede[hidden]{display:none}
+/* 页面动作挂在说明行右端:它和左边那句说的是同一批文件,自己占一整行时,标题和
+ 内容之间会空出一条只放一个按钮的带子。 */
+.pagelede-actions{display:flex;align-items:center;justify-content:space-between;gap:16px}
+.pagelede-actions .batchaction{box-sizing:border-box;min-height:32px;padding:0 14px;flex:none;
+ display:inline-flex;align-items:center;border:1px solid transparent;border-radius:var(--control-radius);
+ background:var(--ink);color:var(--ground);font:inherit;font-size:var(--fs-xs);font-weight:500;cursor:pointer}
+.pagelede-actions .batchaction.danger{background:var(--drop);border-color:var(--drop);color:#fff}
+.pagelede-actions .batchaction.danger:hover{background:color-mix(in srgb,var(--drop) 82%,#000);
+ border-color:color-mix(in srgb,var(--drop) 82%,#000);color:#fff}
+.pagelede-actions .batchaction:focus-visible{outline:2px solid var(--tungsten);outline-offset:2px}
/* 统计页 */
.stats{padding:0 0 42px}
.playlistpage{padding:4px 0 42px}.playlistpage>header{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;margin-bottom:16px}.playlistpage h2{margin:0 0 5px}.playlistpage p{margin:0;color:var(--muted);font-size:var(--fs-sm)}
@@ -232,7 +242,7 @@ button[aria-busy="true"],[role="button"][aria-busy="true"]{
.playlistcards{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:14px}.playlistcard{display:grid;grid-template-columns:112px minmax(0,1fr);gap:12px;padding:12px;border:1px solid var(--line-soft);border-radius:var(--floating-radius);background:var(--surface);min-width:0}.playlistcover{position:relative;aspect-ratio:16/10;border:0;border-radius:var(--surface-radius);background:#000;overflow:hidden;padding:0;cursor:pointer}.playlistcover:disabled{cursor:default}.playlistcover img{width:100%;height:100%;object-fit:cover}.playlistcover span{position:absolute;right:5px;bottom:5px;border-radius:var(--badge-radius);background:#000b;color:#fff;padding:3px 6px;font-size:var(--fs-xs)}.playlistmeta{display:grid;align-content:center;gap:6px;min-width:0}.playlistmeta input{min-width:0;width:100%;font-weight:600}.playlistmeta small{color:var(--muted)}.playlistactions{grid-column:1/-1;display:flex;gap:7px;justify-content:flex-end}.playlistactions .danger{color:var(--drop)}
.playlistdialog{width:min(520px,calc(100vw - 28px));border:1px solid var(--line);border-radius:var(--floating-radius);background:var(--surface);color:var(--ink);padding:0;box-shadow:0 2px 4px #0003,0 24px 80px #000b}.playlistdialog::backdrop{background:#000a;backdrop-filter:blur(5px)}.playlistdialoghead{display:flex;align-items:center;justify-content:space-between;padding:16px 17px;border-bottom:1px solid var(--line-soft)}.playlistdialoghead h2{margin:0;font-size:var(--fs-xl)}.playlistdialoghead button{width:34px;height:34px;border:0;border-radius:var(--control-radius);background:transparent;color:var(--ink);display:grid;place-items:center;cursor:pointer}.playlistdialoghead button:hover{background:var(--hover)}.playlistdialoghead svg{width:19px;height:19px;stroke:currentColor;fill:none}.playlistdialogbody{padding:17px}.playlistpicklist{display:grid;gap:7px;margin-top:16px;max-height:320px;overflow-y:auto;overscroll-behavior:contain}.playlistpickrow{display:flex;align-items:center;justify-content:space-between;gap:10px;border:1px solid var(--border-10);border-radius:var(--control-radius);background:var(--overlay-5);color:var(--ink);padding:11px 12px;text-align:left;cursor:pointer}.playlistpickrow:hover{background:var(--hover)}.playlistpickrow small{color:var(--muted)}
.runtimegate{display:grid;grid-template-columns:16px minmax(0,1fr) auto;align-items:center;gap:12px;margin:0 0 12px;padding:10px 12px;border:1px solid color-mix(in srgb,var(--meter) 35%,var(--line));border-radius:var(--control-radius);background:color-mix(in srgb,var(--meter) 8%,var(--surface));color:var(--ink);font-size:var(--fs-sm)}.runtimegate>svg{width:16px;height:16px;flex:none;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.runtimegate span{min-width:0}.runtimegate a{color:var(--ink);font-weight:600;text-decoration:none}.runtimegate a:hover{color:var(--ink-2)}
-.review{--review-fieldset-height:440px;padding:0 0 42px}.reviewtabs{display:flex;gap:6px;overflow-x:auto;margin-bottom:16px;scrollbar-width:none}.reviewtabs::-webkit-scrollbar{display:none}.reviewtabs button{display:inline-flex;align-items:center;gap:7px;border:1px solid var(--border-15);border-radius:var(--control-radius);background:transparent;color:var(--ink-2);padding:7px 14px;cursor:pointer;font-size:var(--fs-sm);white-space:nowrap}.reviewtabs button:hover{background:var(--hover);color:var(--ink)}.reviewtabs button[aria-pressed="true"]{background:var(--hover);color:var(--ink);border-color:color-mix(in srgb,var(--ink) 28%,transparent);font-weight:600}.reviewtabs .n{color:var(--muted);font-size:var(--fs-xs)}.reviewsection{margin-bottom:20px}.reviewsection h3{margin:0 0 9px;font-size:var(--fs-lg)}.reviewlist{display:grid;grid-template-columns:repeat(auto-fill,minmax(360px,1fr));gap:14px;align-items:start}
+.review{--review-fieldset-height:440px;padding:0 0 42px}.reviewsection{margin-bottom:20px}.reviewsection h3{margin:0 0 9px;font-size:var(--fs-lg)}.reviewlist{display:grid;grid-template-columns:repeat(auto-fill,minmax(360px,1fr));gap:14px;align-items:start}
/* 判定状态用左侧色条表达:整卡描边在一列里扫过去时反而认不出来 */
.reviewitem{position:relative;display:flex;flex-direction:column;box-sizing:border-box;height:var(--review-fieldset-height);margin:0;padding:0;min-width:0;overflow:hidden;background:var(--surface);border:1px solid var(--line-soft);border-radius:var(--floating-radius)}.reviewitem::before{content:'';position:absolute;z-index:3;left:0;top:0;bottom:0;width:3px;background:transparent}.reviewitem[data-decision="approved"]::before{background:var(--keep)}.reviewitem[data-decision="rejected"]::before{background:var(--drop)}.reviewitem[data-decision="skipped"]::before{background:var(--muted)}.reviewitem[data-decision="rejected"],.reviewitem[data-decision="skipped"]{opacity:.6}.reviewitem h4{margin:0 0 6px;font-size:var(--fs-lg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.reviewitem p{margin:4px 0;color:var(--muted);font-size:var(--fs-xs);line-height:1.55;overflow-wrap:anywhere}
.reviewitem>.geist-fieldset-content{flex:1;min-height:0;padding:20px}.reviewcontent{height:100%}
@@ -256,7 +266,6 @@ button[aria-busy="true"],[role="button"][aria-busy="true"]{
.reviewstate:empty{display:none}
.reviewalias{margin:2px 0 0;font-size:var(--fs-xs);color:var(--muted)}
.reviewactions button{box-sizing:border-box;height:32px;border:1px solid var(--border-15);border-radius:var(--control-radius);background:transparent;color:var(--ink-2);padding:0 12px;font-size:var(--fs-sm);cursor:pointer}.reviewactions button:hover{background:var(--hover);color:var(--ink)}.reviewactions .approve{background:var(--ink);border-color:var(--ink);color:var(--ground);font-weight:600}.reviewactions .approve:hover{background:color-mix(in srgb,var(--ink) 88%,var(--ground));border-color:color-mix(in srgb,var(--ink) 88%,var(--ground));color:var(--ground)}.reviewactions .skip{color:var(--meter)}.reviewactions .skip:hover{background:var(--meter);border-color:var(--meter);color:#fff}.reviewactions .reject{color:var(--drop)}.reviewactions .reject:hover{background:var(--drop);border-color:var(--drop);color:#fff}
-.junkloading{grid-column:1/-1;min-height:280px;display:grid;place-items:center}
/* 数据管理整页收进一条窄列(vercel.com/geist/fieldset 实测示例块宽 812px),
fieldset 一行一个,不再拼三列。 */
.cleanuppage{width:min(812px,100%);margin:0 auto}
@@ -839,8 +848,6 @@ main{position:relative;z-index:1;padding:14px 16px 90px}
.count .sorts #batchAction,.entitycollectionhead .sorts .entitybatch{width:36px;padding:0;display:inline-grid;place-items:center}
.count .sorts #batchAction svg,.entitycollectionhead .sorts .entitybatch svg{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:2}
.count .sorts .batchaction:hover,.entitycollectionhead .sorts .batchaction:hover{background:color-mix(in srgb,var(--ink) 88%,var(--ground));border-color:color-mix(in srgb,var(--ink) 88%,var(--ground));color:var(--ground)}
-.count .sorts .batchaction.danger{background:var(--drop);border-color:var(--drop);color:#fff;font-weight:500}
-.count .sorts .batchaction.danger:hover{background:color-mix(in srgb,var(--drop) 82%,#000);border-color:color-mix(in srgb,var(--drop) 82%,#000);color:#fff}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(var(--tile),1fr));gap:16px 8px}
.shorts-inline{grid-column:1/-1;margin:28px 0 8px;padding-top:0}
.shorts-inline h2{margin:0 0 10px;font-size:var(--fs-lg);display:flex;align-items:center;gap:10px}
@@ -952,17 +959,25 @@ body.select-mode .selectionMark,.card.selected .selectionMark{display:grid}
.resourcecardtitle{cursor:default}
.junkcount{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:48px}
.junksummary{flex:none;font-size:var(--fs-sm);color:var(--muted);white-space:nowrap}
-.junkfilters{display:flex;align-items:center;gap:6px;min-width:0;overflow-x:auto;scrollbar-width:none}
-.junkfilters::-webkit-scrollbar{display:none}.junkfilters i{width:1px;height:22px;background:var(--line-soft);flex:none;margin:0 3px}
-.junkfilters a{box-sizing:border-box;min-height:34px;padding:0 11px;display:inline-flex;align-items:center;gap:6px;flex:none;
- border:1px solid var(--border-15);border-radius:var(--control-radius);background:transparent;color:var(--ink-2);
- text-decoration:none;font-size:var(--fs-xs);white-space:nowrap}
+/* Geist Tabs 的 secondary 变体(vercel.com/geist/tabs 实测 2026-09-03):无边框的 pill,
+ 高 32px、左右 12px、6px 圆角、13px/400;选中只换底(深色实测是 --accents-2 这一级的
+ 浅灰,Peach 浅色里对应 --hover)加前景色,未选中只有 --muted 文字,整条不画底线。
+ 复核分类 10 项、垃圾文件分类 7 项都越过 Switch「2–3 项互斥选项」的上限,规范落点
+ 就是 Tabs 而不是分段器,所以两条共用同一套外观。 */
+.reviewtabs,.junkfilters{display:flex;align-items:center;gap:0;min-width:0;overflow-x:auto;scrollbar-width:none}
+.reviewtabs::-webkit-scrollbar,.junkfilters::-webkit-scrollbar{display:none}
+.reviewtabs{margin-bottom:16px}
+.reviewtabs button,.junkfilters a{box-sizing:border-box;height:32px;padding:0 12px;flex:none;
+ display:inline-flex;align-items:center;gap:6px;border:0;border-radius:var(--control-radius);
+ background:transparent;color:var(--muted);text-decoration:none;font:inherit;font-size:var(--fs-sm);
+ font-weight:400;white-space:nowrap;cursor:pointer}
+.reviewtabs button:hover,.junkfilters a:hover{color:var(--ink)}
+.reviewtabs button[aria-selected="true"],.junkfilters a[aria-current="page"]{background:var(--hover);color:var(--ink)}
+.reviewtabs button:focus-visible,.junkfilters a:focus-visible{outline:2px solid var(--tungsten);outline-offset:2px}
+.reviewtabs .n,.junkfilters .n{color:var(--muted);font-size:var(--fs-xs);font-variant-numeric:tabular-nums}
+.junkfilters i{width:1px;height:20px;background:var(--line-soft);flex:none;margin:0 6px}
.junkfilters a>svg{width:16px;height:16px;flex:none;stroke:currentColor;fill:none;stroke-width:1.8;
stroke-linecap:round;stroke-linejoin:round}
-.junkfilters a:hover{background:var(--hover);color:var(--ink)}
-.junkfilters a:focus-visible{outline:2px solid var(--tungsten);outline-offset:2px}
-.junkfilters a[aria-current="page"]{background:var(--hover);color:var(--ink);border-color:color-mix(in srgb,var(--ink) 28%,transparent);font-weight:500}
-.junkfilters a span{font-variant-numeric:tabular-nums;color:inherit;opacity:.72}
.junkcard{cursor:default;gap:0;overflow:hidden;border:1px solid var(--line-soft);border-radius:var(--floating-radius);background:var(--surface);
content-visibility:auto;contain-intrinsic-size:auto 360px}
.junkcard .pic{border:0;border-radius:0}.junkcard:hover .pic{border:0;box-shadow:none}
@@ -1840,6 +1855,9 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位
.runtimegate a{grid-column:2/-1}
.managebar-menu button{width:100%;min-height:42px;justify-content:flex-start;padding:9px 11px}
.cleanupgrid{grid-template-columns:minmax(0,1fr)}
+ /* 说明行右端的动作在手机上要够手指点:桌面 32px 是 Geist 的控件高度,触摸区按本项目
+ 的 44px 命中区来。 */
+ .pagelede-actions .batchaction{height:44px;padding-inline:16px}
.grid{gap:16px 8px}
.count{align-items:center;flex-direction:row;gap:10px;padding-block:8px;
overflow-x:auto;overflow-y:hidden;scrollbar-width:none;overscroll-behavior-inline:contain}
@@ -1849,7 +1867,7 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位
.count .sorts button{min-height:36px}
.count.junkcount{align-items:stretch;flex-direction:column;overflow:visible;padding-block:8px}
.junkcount .junksummary{line-height:1.4}.junkfilters{width:100%;padding-bottom:2px}
- .junkfilters a{min-height:44px}.junkactions button{min-height:44px;padding-inline:7px}
+ .reviewtabs button,.junkfilters a{height:44px}.junkactions button{min-height:44px;padding-inline:7px}
#batchbar[hidden]{display:none}
.batchbar:has([data-junk-batch]:not([hidden])){left:12px;right:12px;bottom:12px;width:auto;transform:none;
display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;padding:9px 10px}
diff --git a/web/app.js b/web/app.js
index 4f601bba1..312c4b641 100644
--- a/web/app.js
+++ b/web/app.js
@@ -162,8 +162,9 @@ const managementPlaceholder=path=>
function renderInitialSurfaceLoading(){
const path=decodeURIComponent(location.pathname);
if(path==='/junk-files'){
- const count=$('#count');count.setAttribute('aria-busy','true');count.textContent='';
- $('#grid').innerHTML=`<div class="junkloading">${loadingDotsHtml('正在读取垃圾文件…')}</div>`;
+ /* 垃圾文件是一屏同质卡片,等的是内容结构不是后台进度:Loading Dots 说的是
+ 「还在跑」,这里要说的是「等下会出现几张什么形状的卡」,所以用目录骨架。 */
+ renderCatalogLoading('正在读取垃圾文件');
$('#loadSentinel').hidden=true;
return;
}
@@ -1487,14 +1488,17 @@ function wireJunkCards(root){
}
function renderJunkNavigation(data){
const countFor=key=>key?Number(data.counts?.[key]||0):Number(data.all_total||0);
+ const dismissedTotal=Number(data.dismissed_total||0);
const categoryLinks=JUNK_KIND_OPTIONS.map(([key,label,glyph])=>{
- const current=key===junkKind;
- return `<a href="${junkPath(key,junkView)}" data-junk-kind-link="${esc(key)}"${current?' aria-current="page"':''}>${icon(glyph)}${esc(label)} <span>${countFor(key).toLocaleString()}</span></a>`;
+ const current=key===junkKind,count=countFor(key);
+ /* 同一套 Geist Tabs 徽标口径:计数为 0 时整枚去掉。这一条仍用 <a>,因为分类要落到
+ URL 上——规范里 Tabs 的行为条款本身就要求当前项可深链、可刷新恢复。 */
+ return `<a href="${junkPath(key,junkView)}" data-junk-kind-link="${esc(key)}"${current?' aria-current="page"':''}>${icon(glyph)}${esc(label)}${count?` <span class="n mono">${count.toLocaleString()}</span>`:''}</a>`;
}).join('');
$('#count').removeAttribute('aria-busy');
$('#count').innerHTML=`<div class="junksummary" aria-live="polite">显示 ${Number(data.total||0).toLocaleString()} 个</div>
<nav class="junkfilters" aria-label="垃圾文件分类">${categoryLinks}<i aria-hidden="true"></i>
- <a href="${junkPath('',junkView==='dismissed'?'pending':'dismissed')}" data-junk-view-link="${junkView==='dismissed'?'pending':'dismissed'}"${junkView==='dismissed'?' aria-current="page"':''}>${icon(junkView==='dismissed'?'rotate-ccw':'eye-off')}${junkView==='dismissed'?'返回待判断':'已排除'} <span>${Number(data.dismissed_total||0).toLocaleString()}</span></a>
+ <a href="${junkPath('',junkView==='dismissed'?'pending':'dismissed')}" data-junk-view-link="${junkView==='dismissed'?'pending':'dismissed'}"${junkView==='dismissed'?' aria-current="page"':''}>${icon(junkView==='dismissed'?'rotate-ccw':'eye-off')}${junkView==='dismissed'?'返回待判断':'已排除'}${dismissedTotal?` <span class="n mono">${dismissedTotal.toLocaleString()}</span>`:''}</a>
</nav>`;
$('#count').querySelectorAll('[data-junk-kind-link],[data-junk-view-link]').forEach(link=>link.onclick=event=>{
if(event.button!==0||event.metaKey||event.ctrlKey||event.shiftKey||event.altKey)return;
@@ -1943,14 +1947,17 @@ async function buildBars(){
function renderCount(){
const n=$('#grid').querySelectorAll(':scope > .card[data-id]').length; // 竖屏条不计入「显示 N」
const trash=state.state==='trash';
- if(trash)paintManageLede(`${total.toLocaleString()} 个符合 · 显示 ${n}`);
+ /* 「清空回收站」和左边的计数说的是同一批文件,挂在说明行右端。它自己占一行时,
+ 标题和网格之间会空出一条只放一个按钮的带子。 */
+ if(trash)paintManageLede(`${total.toLocaleString()} 个符合 · 显示 ${n}`,
+ total?`<button class="batchaction danger" id="emptyTrash" type="button" title="永久删除回收站内容">清空回收站</button>`:'');
$('#count').classList.toggle('count-actions-only',trash);
$('#count').removeAttribute('aria-busy');
$('#count').innerHTML=
(trash?'':`<span class="mono">${total.toLocaleString()} 个符合 · 显示 ${n}</span>`)
+(trash
// 回收站是待清理队列,不是浏览列表:换一批和排序在这里没有意义。
- ? (total?`<span class="sorts"><button class="batchaction danger" id="emptyTrash" title="永久删除回收站内容">清空回收站</button></span>`:'')
+ ? ''
: `<span class="sorts"><button class="batchaction" id="batchAction" type="button"
title="换一批" aria-label="换一批">${icon('refresh-cw')}</button>`
// JAV 版式紧跟换批动作,和排序连成一条。
@@ -2829,8 +2836,15 @@ async function openReview(push=true){
$('#stats').innerHTML=`<div class="review">
${locked?`<div class="runtimegate">${icon('info')}<span>${esc(mirrorText)}</span>${writer
?`<a href="${esc(writer)}">前往写入端复核</a>`:''}</div>`:''}
- <div class="reviewtabs">${Object.entries(REVIEW_LABELS).map(([key,label])=>`<button data-review-tab="${key}" aria-pressed="${key===reviewCategory}">${label} <span class="n mono">${reviewData.counts[key]||0}</span></button>`).join('')}</div>
- <section class="reviewsection"><div class="reviewlist">${rows.length?rows.map(row=>{
+ <div class="reviewtabs" role="tablist" aria-label="复核分类">${Object.entries(REVIEW_LABELS).map(([key,label])=>{
+ /* Geist Tabs(vercel.com/geist/tabs):计数走独立徽标,为 0 时整枚去掉,不留一个
+ 「0」占位;tabindex 只留在选中项上,方向键负责在同一条里移动焦点。 */
+ const on=key===reviewCategory,count=Number(reviewData.counts[key]||0);
+ return `<button role="tab" id="reviewtab-${key}" aria-controls="reviewpanel" data-review-tab="${key}"
+ aria-selected="${on}" tabindex="${on?'0':'-1'}">${label}${
+ count?` <span class="n mono">${count.toLocaleString()}</span>`:''}</button>`;
+ }).join('')}</div>
+ <section class="reviewsection" id="reviewpanel" role="tabpanel" aria-labelledby="reviewtab-${reviewCategory}"><div class="reviewlist">${rows.length?rows.map(row=>{
const key=row.item_key,decision=row.decision||'pending';
const metadata=reviewCategory==='metadata_fields',candidates=row.candidates||[];
const tags=String(row.tags||'').split('|').filter(Boolean).map(tag=>`<span>${esc(tag)}</span>`).join('');
@@ -2903,7 +2917,19 @@ async function openReview(push=true){
// 没有全局委托,每个界面各自接线(见 #stage 的同类处理)。
$('#stats').querySelectorAll('[data-entity-kind]').forEach(button=>button.onclick=()=>
openEntity(button.dataset.entityKind,button.dataset.entityName));
- $('#stats').querySelectorAll('[data-review-tab]').forEach(button=>button.onclick=()=>{reviewCategory=button.dataset.reviewTab;render()});
+ /* Geist Tabs 的键盘契约:左右方向键在同一条 tab 里移动焦点,Home/End 到两端;
+ 激活仍交给 button 自己的 Enter/Space,不另设快捷键。 */
+ const reviewTabs=[...$('#stats').querySelectorAll('[data-review-tab]')];
+ reviewTabs.forEach((button,index)=>{
+ button.onclick=()=>{reviewCategory=button.dataset.reviewTab;render()};
+ button.onkeydown=event=>{
+ const step=event.key==='ArrowRight'?1:event.key==='ArrowLeft'?-1:0;
+ const target=step?reviewTabs[(index+step+reviewTabs.length)%reviewTabs.length]
+ :event.key==='Home'?reviewTabs[0]:event.key==='End'?reviewTabs[reviewTabs.length-1]:null;
+ if(!target)return;
+ event.preventDefault();target.focus();
+ };
+ });
$('#stats').querySelectorAll('[data-review-status]').forEach(button=>button.onclick=async()=>{
const item=button.closest('[data-review-key]'),row=rows.find(x=>String(x.item_key)===item.dataset.reviewKey);button.disabled=true;
const selectedIds=[...item.querySelectorAll('[data-review-asset][aria-pressed="true"]')].map(cell=>+cell.dataset.reviewAsset);
@@ -5438,7 +5464,9 @@ function paintManageTitle(){
const current=manageSection(),el=$('#manageTitle');
if(!el)return;
document.body.classList.toggle('insight-layout',current==='stats'||current==='taste');
- document.body.classList.toggle('cleanup-layout',current==='cleanup');
+ /* 812px 居中是数据管理 hub 自己的窄列宽度(.cleanuppage)。它下面的垃圾文件、
+ 重复文件正文都是全宽网格,跟着居中就是标题在宽屏上凭空左缩一截、跟内容对不齐。 */
+ document.body.classList.toggle('cleanup-layout',current==='cleanup'&&decodeURIComponent(location.pathname)==='/data-cleanup');
const entry=MANAGE_SECTIONS.find(([k])=>k===current);
el.hidden=!entry;
// 数据管理之下按路径再分一层(MANAGE_CRUMB_PAGES):垃圾文件/重复文件的
@@ -5461,9 +5489,15 @@ function paintManageCrumb(){
event.preventDefault();openDataCleanup();
});
}
-function paintManageLede(text=''){
+/* 说明行可以在右端挂一个属于本页的动作(回收站的「清空回收站」)。左文右动作是
+ 一行,不是两行;没有动作时它仍是一段纯文本。 */
+function paintManageLede(text='',actionsHtml=''){
const el=$('#manageLede');if(!el)return;
- el.hidden=!text;el.textContent=text;
+ el.hidden=!text&&!actionsHtml;
+ el.classList.toggle('pagelede-actions',!!actionsHtml);
+ el.innerHTML='';
+ if(text)el.appendChild(Object.assign(document.createElement('span'),{textContent:text}));
+ if(actionsHtml)el.insertAdjacentHTML('beforeend',actionsHtml);
}
function paintListTitle(){
const el=$('#listTitle');if(!el)return;
@@ -5650,7 +5684,7 @@ async function load(reset){
if(!reset)listLoading=true;
try{
if(reset){barsContext={type:'home',filters:state};detailReturnBarsContext=null;disposeStage(false);
- renderCatalogLoading(state.state==='ads'?'正在读取资源':'正在读取作品')}
+ renderCatalogLoading(state.state==='ads'?'正在读取垃圾文件':'正在读取作品')}
showHomeSurfaces();
if(reset){offset=0;renderedPartGroups.clear();renderedEditionGroups.clear()}
renderCombo();
@@ -5660,10 +5694,9 @@ async function load(reset){
countRow.classList.toggle('junkcount',staticManageCount);
if(staticManageCount)countRow.classList.remove('is-stuck');
if(state.state==='ads'){
- if(reset){
- $('#grid').innerHTML=`<div class="junkloading">${loadingDotsHtml('正在读取垃圾文件…')}</div>`;
- $('#loadSentinel').hidden=true;
- }
+ // 骨架已经由上面的 reset 分支画好;这里再盖一层 Loading Dots 只会连播两段
+ // 动画,还把「等下出现什么」换成了「还在跑」。
+ if(reset)$('#loadSentinel').hidden=true;
if(reset||!adsBatch){const junkQuery=new URLSearchParams({limit:'200',status:junkView});if(junkKind)junkQuery.set('kind',junkKind);
const nextAds=await surfaceApi(surface,'/api/ads?'+junkQuery);
if(requestSeq!==loadRequestSeq||!surfaceCurrent(surface))return;