Skip to content

armgit / peach

Public Imported from GitHub
0

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

feat(web): 资料页筛选浮层改挂 entity-filter 岛

longmeidao20d9b67351f7
diff --git a/frontend/e2e/code-samples.test.ts b/frontend/e2e/code-samples.test.ts
index 7326c0328..31f199f1a 100644
--- a/frontend/e2e/code-samples.test.ts
+++ b/frontend/e2e/code-samples.test.ts
@@ -60,7 +60,8 @@ async function openPhotos(browser: Browser, search: string, local?: Local): Prom
const offsets = await serveProfile(opened.page, local);
await opened.page.goto(new URL(`/performers/${encodeURIComponent(NAME)}?${search}`, opened.page.url()).href,
{ waitUntil: 'load' });
- await opened.page.locator('#index .photohead').waitFor({ state: 'visible', timeout: 15_000 });
+ await opened.page.locator('#index [data-entity-readout]', { hasText: '照片' })
+ .waitFor({ state: 'visible', timeout: 15_000 });
await settle(opened.page);
return { ...opened, offsets };
}
@@ -92,13 +93,17 @@ describe('番号样张', () => {
const opened = await openPhotos(browser, 'media=photos');
const { page } = opened;
try {
- assert.equal(await page.locator('.entitymediaview [data-media-view="photos"]').getAttribute('aria-pressed'),
+ assert.equal(await page.locator('[data-entity-media] [data-media-view="photos"]').getAttribute('aria-pressed'),
'true');
assert.deepEqual(await groups(page), [['SSIS-057', 3], ['SSIS-001', 2]]);
+ // 第一段的 28px 段距与筛选浮层 22px 的下边距合并成一段,不叠加。
+ const gap = await page.evaluate(() => document.querySelector('.photogroup')!.getBoundingClientRect().top
+ - document.querySelector('[data-entity-filter-glass]')!.getBoundingClientRect().bottom);
+ assert.ok(Math.abs(gap - 28) <= 1, `第一段离浮层 ${gap}px`);
assert.match(await page.locator('.photogroup').first().innerText(), /雨の日[\s\S]*DMM 样张 · 2021-05-18 · 3 张/);
- assert.match(await page.locator('.photohead h3').innerText(), /样张 5 张 · 2 部作品/);
- assert.equal(await page.locator('.photohead .entitybatch').count(), 0, '没有本地图可换一批');
- assert.equal(await page.locator('.photoback').count(), 0, '样张不另开一层');
+ assert.match(await page.locator('[data-entity-readout]').innerText(), /样张 5 张 · 2 部作品/);
+ assert.equal(await page.locator('[data-entity-batch]').count(), 0, '没有本地图可换一批');
+ assert.equal(await page.locator('[data-photo-back]').count(), 0, '样张不另开一层');
assert.deepEqual(unexpected(opened.problems), [], JSON.stringify(opened.problems));
} finally {
await opened.close();
@@ -144,7 +149,7 @@ describe('番号样张', () => {
const { page } = opened;
try {
assert.equal(await page.locator('.photowall .photocell').count(), 5);
- assert.equal(await page.locator('.photoback').count(), 0);
+ assert.equal(await page.locator('[data-photo-back]').count(), 0);
assert.deepEqual(unexpected(opened.problems), [], JSON.stringify(opened.problems));
} finally {
await opened.close();
diff --git a/frontend/e2e/entity-filter.test.ts b/frontend/e2e/entity-filter.test.ts
new file mode 100644
index 000000000..87ad24852
--- /dev/null
+++ b/frontend/e2e/entity-filter.test.ts
@@ -0,0 +1,339 @@
+/* 实体资料页资料卡下面那一整块:交集条与两排的玻璃浮层(`entity-filter` 岛,ADR-0031)。
+ *
+ * 演示库没有人物实体:资料、作品与照片都照接口的形状在这里给,页面自己的路由、渲染和动作照常跑。
+ * 验的是行为:骨架换成真浮层时不跳、按下去的反馈不等请求、视图之间切换时哪些东西该收起来、
+ * 吸顶与窄屏横滚。外观对照另有截图,不在这里比像素。 */
+import assert from 'node:assert/strict';
+import { after, before, describe, it } from 'node:test';
+
+import type { Browser, Page } from 'playwright-core';
+
+import { launch, settle, visit, VIEWPORTS, type Visit } from './harness.ts';
+
+const DESKTOP = VIEWPORTS.find((viewport) => !viewport.mobile)!;
+const PHONE = VIEWPORTS.find((viewport) => viewport.mobile)!;
+const NAME = '篠田ゆう';
+const PATH = `/performers/${encodeURIComponent(NAME)}`;
+const THUMB = '<svg xmlns="http://www.w3.org/2000/svg" width="640" height="360"><rect width="640" height="360" fill="#456"/></svg>';
+const TAGS = ['巨乳', '美乳', '中出', '单体作品', '高画质', '痴女', '口交', '姐姐', '苗条', '制服', '潮吹', '美腿'];
+
+const ENTITY = {
+ id: 90_101, kind: 'performer', canonical_name: NAME, aliases: [], display_aliases: [], user_aliases: [],
+ asset_count: 24, tags: TAGS.map((k, at) => ({ k, n: 40 - at * 2 })), related_performers: [], links: [],
+ metadata: {}, has_image: false, has_avatar: false, avatar_focus: null, representative_asset_id: null,
+ entry_links: [], feed: null,
+};
+const costar = (id: number, k: string) => ({ id, k, n: 3, rep: null, has_image: false, has_avatar: false, avatar_focus: null });
+const AGENCY = {
+ ...ENTITY, id: 90_701, kind: 'agency', canonical_name: 'New Actor eXperience', member_count: 3, feed: undefined,
+ tags: ENTITY.tags.slice(0, 6),
+ related_performers: [costar(90_710, NAME), costar(90_711, '河北彩伽'), costar(90_712, '三上悠亜')],
+};
+type Entity = typeof ENTITY | typeof AGENCY;
+const items = (jav: boolean) => Array.from({ length: 24 }, (_, at) => ({
+ id: 91_000 + at, name: jav ? `SSIS-${100 + at} 演示作品 ${at + 1}` : `演示作品 ${at + 1}`, code: jav ? `SSIS-${100 + at}` : '',
+ is_jav: jav, has_thumb: true, duration: 7200, studio: 'S1 NO.1 STYLE', tags: [],
+}));
+const PHOTOS = { total: 18, sample_total: 0, sets: [], has_more: false, seed: '',
+ items: Array.from({ length: 18 }, (_, at) => ({ id: 92_000 + at, name: `${String(at + 1).padStart(3, '0')}.jpg` })) };
+const NO_PHOTOS = { total: 0, sample_total: 0, sets: [], items: [], has_more: false, seed: '' };
+
+/** 资料、作品、照片与图都在这里给;事务所旗下不是 JAV 语境,只有女优有照片。
+ * `/api/items` 可以挂住:`hold()` 之后的那一趟等 `release()` 才回。 */
+async function serve(page: Page, entity: Entity = ENTITY) {
+ let gate: Promise<void> | null = null;
+ let open = () => {};
+ const itemQueries: string[] = [];
+ const list = items(entity.kind !== 'agency');
+ await page.route(/\/api\/entity\?/, (route) => route.fulfill({ json: entity }));
+ await page.route((url) => url.pathname === '/api/items', async (route) => {
+ const url = new URL(route.request().url());
+ itemQueries.push(url.search);
+ if (gate) await gate;
+ const offset = Number(url.searchParams.get('offset') || 0);
+ await route.fulfill({ json: { items: offset ? [] : list, total: list.length, has_more: false } });
+ });
+ await page.route((url) => url.pathname === '/api/photos', (route) =>
+ route.fulfill({ json: entity.kind === 'performer' ? PHOTOS : NO_PHOTOS }));
+ await page.route((url) => url.pathname === '/api/feeds/discoveries', (route) =>
+ route.fulfill({ json: { ok: true, more: false, items: [] } }));
+ await page.route(/\/(?:thumb|poster|photo-thumb|cover)\?/, (route) =>
+ route.fulfill({ contentType: 'image/svg+xml', body: THUMB }));
+ return {
+ itemQueries,
+ hold() { gate = new Promise<void>((resolve) => { open = resolve; }); },
+ release() { open(); gate = null; },
+ };
+}
+
+async function openPerformer(browser: Browser, viewport = DESKTOP, search = '', entity: Entity = ENTITY) {
+ const opened = await visit(browser, '/', viewport);
+ const stubs = await serve(opened.page, entity);
+ const path = entity.kind === 'agency' ? `/agencies/${encodeURIComponent(entity.canonical_name)}` : PATH;
+ await opened.page.goto(new URL(path + search, opened.page.url()).href, { waitUntil: 'load' });
+ await opened.page.locator('[data-entity-filter-glass] [data-entity-readout]', { hasText: /\S/ })
+ .waitFor({ timeout: 15_000 });
+ await settle(opened.page);
+ return { ...opened, stubs };
+}
+
+/** 滑动玻璃与它该垫着的那一枚键:两者的外框,玻璃收起时为 null。 */
+const glideOver = (page: Page, glide: string, key: string) => page.evaluate(([glideSelector, keySelector]) => {
+ const rect = (node: Element | null) => {
+ if (!node || (node as HTMLElement).hidden) return null;
+ const box = node.getBoundingClientRect();
+ return { left: box.left, top: box.top, width: box.width, height: box.height };
+ };
+ return { glide: rect(document.querySelector(glideSelector)), key: rect(document.querySelector(keySelector)) };
+}, [glide, key] as const);
+
+function assertCovers(pair: Awaited<ReturnType<typeof glideOver>>, what: string) {
+ assert.ok(pair.glide && pair.key, `${what}:玻璃或键不在屏幕上 ${JSON.stringify(pair)}`);
+ for (const side of ['left', 'top', 'width', 'height'] as const) {
+ assert.ok(Math.abs(pair.glide![side] - pair.key![side]) <= 1,
+ `${what}:玻璃的 ${side} 是 ${pair.glide![side]},键是 ${pair.key![side]}`);
+ }
+}
+
+const unexpected = (opened: Visit) => opened.problems;
+
+/** 分段开关里的一格:点得到的是整格 label,单选框本身是藏起来的。 */
+const segment = (page: Page, group: string, value: string) =>
+ page.locator(`[data-entity-layout][aria-label="${group}"] label:has(input[value="${value}"])`);
+
+describe('实体页筛选浮层', () => {
+ let browser: Browser;
+ before(async () => { browser = await launch(); });
+ after(async () => { await browser?.close(); });
+
+ it('骨架里那块浮层换成真浮层时不跳:大小、离资料卡的距离与作品网格的上沿都留在原位', { timeout: 60_000 }, async () => {
+ const opened = await visit(browser, '/', DESKTOP);
+ try {
+ const { page } = opened;
+ await serve(page);
+ let release = () => {};
+ const held = new Promise<void>((resolve) => { release = resolve; });
+ await page.route(/\/api\/entity\?/, async (route) => { await held; await route.fallback(); });
+ await page.goto(new URL(PATH, page.url()).href, { waitUntil: 'load' });
+ await page.locator('#index [data-skeleton="entity/performer"] .board-filter-frame').waitFor({ timeout: 15_000 });
+ /* 资料卡是另一座岛,骨架与真卡的高度差不归这一块管:浮层的位置按它离资料卡下沿的距离量。 */
+ const measure = (hero: string, glass: string, grid: string) => page.evaluate(([heroSelector, glassSelector, gridSelector]) => {
+ const heroBox = document.querySelector(heroSelector)!.getBoundingClientRect();
+ const glassBox = document.querySelector(glassSelector)!.getBoundingClientRect();
+ const gridBox = document.querySelector(gridSelector)!.getBoundingClientRect();
+ return { gap: glassBox.top - heroBox.bottom, left: glassBox.left, width: glassBox.width,
+ height: glassBox.height, grid: gridBox.top - glassBox.bottom };
+ }, [hero, glass, grid] as const);
+ const skeleton = await measure('#index [data-skeleton] .entityhero', '#index [data-skeleton] .board-filter-frame',
+ '#index [data-skeleton] .entitysection');
+ release();
+ await page.locator('[data-entity-filter-glass] [data-entity-readout]', { hasText: '视频' }).waitFor({ timeout: 15_000 });
+ await settle(page);
+ const live = await measure('#index [data-entity-card]', '#index [data-entity-filter-glass]', '#index .entitysection');
+ for (const key of ['gap', 'left', 'width', 'height', 'grid'] as const) {
+ assert.ok(Math.abs(skeleton[key] - live[key]) <= 1,
+ `浮层的 ${key} 接管时跳了:骨架 ${skeleton[key]},接管后 ${live[key]}`);
+ }
+ assert.deepEqual(unexpected(opened), []);
+ } finally {
+ await opened.close();
+ }
+ });
+
+ it('进页时两块滑动玻璃就垫在当前视图与观看状态下面,换观看状态时玻璃当场滑过去、读数等这一趟', { timeout: 60_000 }, async () => {
+ const opened = await openPerformer(browser);
+ try {
+ const { page, stubs } = opened;
+ assertCovers(await glideOver(page, '[data-view-glide="round"]', '[data-media-view][aria-pressed="true"]'), '视图键');
+ assertCovers(await glideOver(page, '[data-view-glide=""]', '[data-entity-state][aria-pressed="true"]'), '观看状态');
+ stubs.hold();
+ await page.locator('[data-entity-state="fresh"]').click();
+ const pressed = await page.evaluate(() => ({
+ state: document.querySelector('[data-entity-state="fresh"]')?.getAttribute('aria-pressed'),
+ busy: document.querySelector('[data-entity-filter-glass] [data-filter-row="bottom"]')?.getAttribute('aria-busy'),
+ shimmer: !!document.querySelector('[data-entity-readout] [data-skeleton="count"]'),
+ }));
+ assert.deepEqual(pressed, { state: 'true', busy: 'true', shimmer: true }, '按下态要等请求回来才到位');
+ assertCovers(await glideOver(page, '[data-view-glide=""]', '[data-entity-state="fresh"]'), '换过去的观看状态');
+ stubs.release();
+ await page.locator('[data-entity-readout]', { hasText: '视频 · 24' }).waitFor({ timeout: 15_000 });
+ assert.match(page.url(), /[?&]state=fresh/);
+ assert.match(stubs.itemQueries.at(-1)!, /state=fresh/);
+ assert.deepEqual(unexpected(opened), []);
+ } finally {
+ await opened.close();
+ }
+ });
+
+ it('换排序当场按下并画出方向箭头,再点一次翻方向,JAV 版式切换不发请求', { timeout: 60_000 }, async () => {
+ const opened = await openPerformer(browser);
+ try {
+ const { page, stubs } = opened;
+ stubs.hold();
+ await page.locator('[data-entity-sort="rating"]').click();
+ assert.equal(await page.locator('[data-entity-sort="rating"]').getAttribute('aria-pressed'), 'true');
+ assert.equal(await page.locator('[data-entity-sort="new"]').getAttribute('aria-pressed'), 'false');
+ assert.equal(await page.locator('[data-entity-sort="rating"] svg').count(), 1, '选中的排序键没有方向箭头');
+ stubs.release();
+ await page.locator('[data-entity-readout]', { hasText: '视频 · 24' }).waitFor({ timeout: 15_000 });
+ assert.equal(await page.locator('[data-entity-sort="rating"]').getAttribute('aria-label'), '按评分从低到高排序');
+ await page.locator('[data-entity-sort="rating"]').click();
+ await page.locator('[data-entity-readout]', { hasText: '视频 · 24' }).waitFor({ timeout: 15_000 });
+ assert.match(page.url(), /[?&]dir=asc/);
+ const before = stubs.itemQueries.length;
+ const small = segment(page, 'JAV 卡片版式', 'small');
+ assert.equal(await small.getAttribute('data-selected'), null);
+ await small.click();
+ await page.waitForFunction(() => document.querySelector(
+ '[data-entity-layout][aria-label="JAV 卡片版式"] label:has(input[value="small"])')?.hasAttribute('data-selected'));
+ await segment(page, 'JAV 卡片版式', 'big').click();
+ assert.equal(stubs.itemQueries.length, before, '切版式重新取了一次作品');
+ assert.deepEqual(unexpected(opened), []);
+ } finally {
+ await opened.close();
+ }
+ });
+
+ it('点标签加进交集条,交集条上撤掉它、标签跟着弹起;地址栏同步', { timeout: 60_000 }, async () => {
+ const opened = await openPerformer(browser);
+ try {
+ const { page } = opened;
+ assert.equal(await page.locator('[data-entity-combo] [data-combo-chip]').count(), 0);
+ // 标签跟首页筛选条上那枚同一张脸:30px 高、`--tag-radius` 那一档 8px 圆角、一圈 1px 实线。
+ const face = await page.locator('[data-entity-tag="中出"]').evaluate((el) => {
+ const css = getComputedStyle(el);
+ return [el.getBoundingClientRect().height, css.borderTopLeftRadius, css.borderTopWidth, css.borderTopStyle];
+ });
+ assert.deepEqual(face, [30, '8px', '1px', 'solid']);
+ await page.locator('[data-entity-tag="中出"]').click();
+ assert.equal(await page.locator('[data-entity-tag="中出"]').getAttribute('aria-pressed'), 'true');
+ await page.locator('[data-entity-combo] [data-combo-chip]', { hasText: '中出' }).waitFor();
+ await page.locator('[data-entity-readout]', { hasText: '视频 · 24 · 中出' }).waitFor({ timeout: 15_000 });
+ assert.match(decodeURIComponent(page.url()), /[?&]tag=中出/);
+ await page.getByRole('button', { name: '撤掉 中出' }).click();
+ await page.locator('[data-entity-readout]', { hasText: /^视频 · 24$/ }).waitFor({ timeout: 15_000 });
+ assert.equal(await page.locator('[data-entity-tag="中出"]').getAttribute('aria-pressed'), 'false');
+ assert.equal(await page.locator('[data-entity-combo] [data-combo-chip]').count(), 0);
+ assert.doesNotMatch(page.url(), /[?&]tag=/);
+ assert.deepEqual(unexpected(opened), []);
+ } finally {
+ await opened.close();
+ }
+ });
+
+ it('切到照片:视图键当场换过去,观看状态、标签与交集条收起,下排换成照片那一排;切回视频都回来', { timeout: 60_000 }, async () => {
+ const opened = await openPerformer(browser, DESKTOP, `?tag=${encodeURIComponent('中出')}`);
+ try {
+ const { page } = opened;
+ await page.locator('[data-media-view="photos"]').click();
+ await page.locator('[data-entity-readout]', { hasText: /^照片/ }).waitFor({ timeout: 15_000 });
+ const photos = await page.evaluate(() => ({
+ pressed: document.querySelector('[data-media-view="photos"]')?.getAttribute('aria-pressed'),
+ states: (document.querySelector('[data-entity-states]') as HTMLElement | null)?.hidden,
+ tags: document.querySelectorAll('[data-entity-tag]').length,
+ combo: (document.querySelector('[data-entity-combo]') as HTMLElement | null)?.hidden,
+ sorts: document.querySelectorAll('[data-entity-sort]').length,
+ batch: document.querySelectorAll('[data-entity-batch]').length,
+ }));
+ assert.deepEqual(photos, { pressed: 'true', states: true, tags: 0, combo: true, sorts: 0, batch: 1 });
+ assertCovers(await glideOver(page, '[data-view-glide="round"]', '[data-media-view="photos"]'), '照片键');
+ assert.equal(await page.locator('[data-view-glide=""]').evaluate((node) => (node as HTMLElement).hidden), true,
+ '观看状态收起了,那块玻璃还亮着');
+ await segment(page, '图片布局', 'fixed').click();
+ await page.waitForFunction(() => document.querySelector('[data-local-wall]')?.getAttribute('data-layout') === 'fixed');
+ await segment(page, '图片布局', 'masonry').click();
+ await page.locator('[data-media-view="videos"]').click();
+ await page.locator('[data-entity-readout]', { hasText: '视频 · 24 · 中出' }).waitFor({ timeout: 15_000 });
+ assert.equal(await page.locator('[data-entity-tag]').count(), TAGS.length);
+ assert.equal(await page.locator('[data-entity-combo] [data-combo-chip]').count(), 1);
+ assert.deepEqual(unexpected(opened), []);
+ } finally {
+ await opened.close();
+ }
+ });
+
+ it('浮层吸在顶栏下沿,吸住时标 data-stuck,玻璃跟着键不走位', { timeout: 60_000 }, async () => {
+ const opened = await openPerformer(browser);
+ try {
+ const { page } = opened;
+ await page.evaluate(() => window.scrollTo(0, 700));
+ await page.waitForFunction(() => document.querySelector('[data-entity-filter-glass]')!.hasAttribute('data-stuck'),
+ undefined, { timeout: 5_000 });
+ const pinned = await page.evaluate(() => {
+ const glass = document.querySelector('[data-entity-filter-glass]')!;
+ return { top: glass.getBoundingClientRect().top, sticky: parseFloat(getComputedStyle(glass).top) };
+ });
+ assert.ok(Math.abs(pinned.top - pinned.sticky) <= 1, `浮层没有吸住:上沿 ${pinned.top},吸顶位置 ${pinned.sticky}`);
+ assertCovers(await glideOver(page, '[data-view-glide="round"]', '[data-media-view][aria-pressed="true"]'), '吸顶时的视图键');
+ await page.evaluate(() => window.scrollTo(0, 0));
+ await page.waitForFunction(() => !document.querySelector('[data-entity-filter-glass]')!.hasAttribute('data-stuck'),
+ undefined, { timeout: 5_000 });
+ assert.deepEqual(unexpected(opened), []);
+ } finally {
+ await opened.close();
+ }
+ });
+
+ it('事务所进页落在旗下艺人名册,下排只有读数;切到视频出排序与标签,没有 JAV 版式', { timeout: 60_000 }, async () => {
+ const opened = await openPerformer(browser, DESKTOP, '', AGENCY);
+ try {
+ const { page } = opened;
+ const roster = await page.evaluate(() => ({
+ readout: document.querySelector('[data-entity-readout]')?.textContent,
+ pressed: document.querySelector('[data-media-view][aria-pressed="true"]')?.getAttribute('data-media-view'),
+ views: [...document.querySelectorAll('[data-media-view]')].map((node) => node.getAttribute('data-media-view')),
+ sorts: document.querySelectorAll('[data-entity-sort]').length,
+ tags: document.querySelectorAll('[data-entity-tag]').length,
+ cards: document.querySelectorAll('#index .entitysection .igrid > *').length,
+ }));
+ assert.deepEqual(roster, { readout: '艺人 · 3', pressed: 'people', views: ['people', 'videos'], sorts: 0, tags: 0, cards: 3 });
+ await page.locator('[data-media-view="videos"]').click();
+ await page.locator('[data-entity-readout]', { hasText: '视频 · 24' }).waitFor({ timeout: 15_000 });
+ assert.equal(await page.locator('[data-entity-tag]').count(), AGENCY.tags.length);
+ assert.ok(await page.locator('[data-entity-sort]').count() > 0);
+ assert.equal(await page.locator('[data-entity-layout][aria-label="JAV 卡片版式"]').count(), 0);
+ assertCovers(await glideOver(page, '[data-view-glide="round"]', '[data-media-view="videos"]'), '视频键');
+ await page.locator('[data-media-view="people"]').click();
+ await page.locator('[data-entity-readout]', { hasText: '艺人 · 3' }).waitFor({ timeout: 15_000 });
+ assert.deepEqual(unexpected(opened), []);
+ } finally {
+ await opened.close();
+ }
+ });
+
+ it('手机宽度下观看状态与标签整段横滚、视图键钉住;往下滚浮层让出顶栏,往回滚落下来', { timeout: 60_000 }, async () => {
+ const opened = await openPerformer(browser, PHONE);
+ try {
+ const { page } = opened;
+ const scroller = page.locator('[data-entity-scroll]');
+ const overflow = await scroller.evaluate((node) => node.scrollWidth - node.clientWidth);
+ assert.ok(overflow > 100, `窄屏下这一段没有横向溢出(${overflow}px),横滚的判据没生效`);
+ const keyBefore = await page.locator('[data-media-view="videos"]').boundingBox();
+ await scroller.evaluate((node) => { node.scrollLeft = 220; node.dispatchEvent(new Event('scroll')); });
+ await page.waitForFunction(() => document.querySelector('[data-entity-scroll]')!.scrollLeft > 0);
+ const keyAfter = await page.locator('[data-media-view="videos"]').boundingBox();
+ assert.equal(keyAfter?.x, keyBefore?.x, '视图键跟着横滚走了');
+ await page.waitForFunction(() => (document.querySelector('[data-view-glide=""]') as HTMLElement).hidden,
+ undefined, { timeout: 5_000 });
+ const glass = '[data-entity-filter-glass]';
+ await page.evaluate(() => window.scrollTo(0, 300));
+ await page.waitForTimeout(100);
+ await page.evaluate(() => window.scrollTo(0, 700));
+ await page.waitForFunction((selector) => document.querySelector(selector)!.hasAttribute('data-filter-free'),
+ glass, { timeout: 5_000 });
+ const bottom = (selector: string) => page.evaluate((s) => document.querySelector(s)!.getBoundingClientRect().bottom, selector);
+ assert.ok(await bottom(glass) <= 0, `让位后浮层还压在屏幕上沿:下沿 ${await bottom(glass)}`);
+ await page.evaluate(() => window.scrollTo(0, 500));
+ await page.waitForFunction((selector) => !document.querySelector(selector)!.hasAttribute('data-filter-free'),
+ glass, { timeout: 5_000 });
+ const top = await page.evaluate((s) => {
+ const node = document.querySelector(s)!;
+ return { at: node.getBoundingClientRect().top, sticky: parseFloat(getComputedStyle(node).top) };
+ }, glass);
+ assert.ok(Math.abs(top.at - top.sticky) <= 1, `往回滚后浮层没有落回顶栏下沿:${JSON.stringify(top)}`);
+ assert.deepEqual(unexpected(opened), []);
+ } finally {
+ await opened.close();
+ }
+ });
+});
diff --git a/frontend/src/entity-skeleton.ts b/frontend/src/entity-skeleton.ts
index 2f38f09cc..b55ee3c2f 100644
--- a/frontend/src/entity-skeleton.ts
+++ b/frontend/src/entity-skeleton.ts
@@ -1,9 +1,9 @@
/** 实体资料的等待态使用资料头、标签条和对应正文布局。
*
- * 筛选条和作品抬头在这一页是同一块浮层的上下两格,等待态也得是一块:这两条各自都
- * 带着玻璃材质和 22px 圆角,不套进外框就被当成两块独立浮层画出来,中间一道缝、四个
- * 角各一道弧,等内容回来又并成一块。`mountFilterFrame` 是运行时才建外框的,骨架进不了
- * 那条路径,所以自己把外框和两个槽位的标记写全。
+ * 筛选条和作品抬头在这一页是同一块浮层的上下两格(`entity-filter` 岛),等待态也得是
+ * 一块:这两条各自都带着玻璃材质和 22px 圆角,不套进外框就被当成两块独立浮层画出来,
+ * 中间一道缝、四个角各一道弧。骨架是一段字符串,所以自己把外框和两个槽位的标记写全,
+ * 几何与岛的浮层一一对齐,接管时不跳。
*/
export function entitySkeletonHtml(kind: string, head: string, body: string) {
const square = kind === 'studio' || kind === 'agency';
diff --git a/tests/test_source_assertion_ratchet.py b/tests/test_source_assertion_ratchet.py
index 3f83b342a..6bead9adf 100644
--- a/tests/test_source_assertion_ratchet.py
+++ b/tests/test_source_assertion_ratchet.py
@@ -53,7 +53,7 @@ BASELINE: dict[str, int] = {
"test_web_e2e.py": 2,
"test_web_js.py": 1,
"test_web_settings.py": 8,
- "test_web_ui.py": 3944,
+ "test_web_ui.py": 3891,
"test_windows_update.py": 3,
}
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.py
index 1d4a72928..90e21eb95 100644
--- a/tests/test_web_ui.py
+++ b/tests/test_web_ui.py
@@ -905,11 +905,11 @@ class WebUiSourceTests(unittest.TestCase):
board = (Path(__file__).resolve().parents[1] / "web" / "board.css").read_text(encoding="utf-8")
self.assertIn(":root{--tag-radius:8px}", board)
self.assertNotIn(".detailtag{", board, "基底那颗的脸归 --tag-fill 与 --tag-radius 管")
- # 筛选条与资料页那两排也从同一个 token 取形状,只有描边换成玻璃上的那一档。
+ # 筛选条那一排也从同一个 token 取形状,只有描边换成玻璃上的那一档;资料页那排由
+ # e2e `entity-filter.test.ts` 量。
self.assertIn(".board-filter-frame.board-filter-frame .tagbar .pill"
":is([data-tag],[data-follow-tag],[data-follow-provider])"
"{border-radius:var(--tag-radius);border-color:var(--glass-low)}", board)
- self.assertIn("border-radius:var(--tag-radius);border:1px solid var(--glass-low)", board)
def test_the_video_area_has_no_frame_and_the_portrait_strip_shares_the_card_face(self):
"""视频网格不画框:卡片直接摆在页面上,竖屏带和卡片同一张面。
@@ -1434,7 +1434,7 @@ class WebUiSourceTests(unittest.TestCase):
source = (Path(__file__).resolve().parents[1] / "web/app.js").read_text(
encoding="utf-8")
labels = re.findall(r"spinnerHtml\('([^']+)'\)", source)
- self.assertGreaterEqual(len(labels), 9, "调用点少得不像全站都在用")
+ self.assertGreaterEqual(len(labels), 8, "调用点少得不像全站都在用")
ongoing = ("正在", "中", "…")
for label in labels:
self.assertTrue(label.endswith(ongoing) or label.startswith("正在"),
@@ -2755,7 +2755,7 @@ class WebUiSourceTests(unittest.TestCase):
"""归类要能被地址栏记住、在筛选条上出现、被「全部清除」清掉。"""
self.assertPageContains("const HOME_QUERY_KEYS=['loc','creator','studio','owner',")
self.assertPageContains("owner:initialParam('owner')==='none'?'none':'',")
- self.assertPageContains("if(filters.owner==='none')extra.push(['owner','未归属']);")
+ self.assertPageContains("if(filters.owner==='none')items.push({kind:'clear',key:'owner',label:`${COMBO_LABELS.owner} 未归属`});")
self.assertPageContains("const COMBO_LABELS={creator:'创作者',studio:'厂牌',owner:'归属'};")
self.assertPageContains("filters.tag='';filters.creator='';filters.studio='';filters.owner=''")
@@ -2795,9 +2795,9 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains("const active=frames.find(frame=>frame.offsetParent!==null);")
self.assertPageContains("mobileFilterScroll=filterScrollState(mobileFilterScroll,y,innerWidth<=760,hold);")
# 收起和放出时 `top` 一步到位,滑动交给合成线程上的 translate;`top` 不进过渡,逐帧重排会卡。
- self.assertIn(".board-filter-frame.board-filter-frame.mobile-filter-free{top:var(--filter-free-top)}", board)
+ self.assertIn(".board-filter-frame.board-filter-frame[data-filter-free]{top:var(--filter-free-top)}", board)
self.assertNotIn("transition:top var(--board-motion)", board)
- self.assertPageContains("if(free===frame.classList.contains('mobile-filter-free'))continue;")
+ self.assertPageContains("if(free===frame.hasAttribute('data-filter-free'))continue;")
self.assertPageContains("frame.getAnimations().forEach(a=>a.id==='filter-slide'&&a.cancel());")
self.assertPageContains("frame.animate([{translate:`0 ${shift}px`},{translate:'0 0'}],{id:'filter-slide',duration:parseFloat(duration)*1000,easing});")
self.assertPageContains("el.getBoundingClientRect().top-(parseFloat(css.translate.split(' ')[1])||0)<=top+1;")
@@ -2865,7 +2865,7 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains("if(!words[key])return null;")
self.assertPageContains("return{sort:key,dir:dir==='asc'?'desc':'asc'};")
self.assertPageContains("const next=nextSortState(b.dataset.sort,state.sort,state.dir);")
- self.assertPageContains("const next=nextSortState(button.dataset.entitySort,filters.sort||'new',filters.dir);")
+ self.assertPageContains("const filters=live(),next=nextSortState(key,filters.sort||'new',filters.dir);")
def test_sort_direction_arrow_is_decorative_and_the_name_announces_the_next_state(self):
"""箭头装饰、aria-pressed 表达当前项、无障碍名称播报下一步。
@@ -2962,7 +2962,6 @@ class WebUiSourceTests(unittest.TestCase):
".countskeleton{display:inline-block;width:150px;height:14px;"
"border-radius:var(--control-radius);\n"
" background:var(--hover)}")
- self.assertPageContains(".entitycollectionhead h3 .countskeleton{width:96px}")
self.assertPageContains(" min-height:var(--sortH);color:var(--ink-2);margin:0 -16px 16px;padding:8px 16px;")
self.assertPageContains(" min-height:var(--sortH);margin:0 -16px 12px;padding:8px 16px;min-width:0;")
# 图标拆成两条线,各自 pathLength 归一到 100,dash 的算法就与真实弧长无关了。
@@ -2992,8 +2991,7 @@ class WebUiSourceTests(unittest.TestCase):
"#i-shuffle .strand-b{animation-name:peach-strand-draw-late}")
self.assertPageContains(
'.count[aria-busy="true"] :is(#batchAction,#followShuffle) svg,\n'
- 'body.refreshing #batchAction svg,\n'
- '.entitycollectionhead[aria-busy="true"] .entitybatch svg{\n'
+ 'body.refreshing #batchAction svg{\n'
" --strand-dash:100;--strand-cycle:2.2s}")
def test_data_page_scan_button_animates_its_own_glyph_while_busy(self):
@@ -3348,23 +3346,6 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains(".postercard-skeleton .skeletoncard s{display:block;")
self.assertPageContains(".postercard-skeleton .skeletoncard u{display:block;")
- def test_the_profile_collection_head_switches_sort_before_the_request_returns(self):
- """资料页表头与首页同规矩:排序条立刻到位,只有 `视频 · N` 换成骨架。
-
- 换列和翻方向在点下的那一刻就已确定,等一次请求才生效等于让选中态迟到一整
- 个网络往返。标题两侧的标签条和已经铺好的网格不属于这次变化,一律不动。
- """
- self.assertPageContains(
- " markEntityCollectionBusy(kind,name,filters);\n"
- " const items=await fetchEntityItems(kind,name,filters);")
- self.assertPageContains("head.setAttribute('aria-busy','true');")
- self.assertPageContains("head.querySelector('.sorts').outerHTML=entityCollectionSortsHtml(filters);")
- self.assertPageContains(
- "head.querySelector('h3').innerHTML='<span class=\"countskeleton\"></span>';")
- # 表头只有一份写法和一处接线,重画忙碌态和重画结果不会走岔。
- self.assertPageContains(
- 'section.innerHTML=`${collectionHeaderHtml({controls:entityCollectionSortsHtml(filters)})}')
- self.assertPageContains(" wireEntityCollectionHead(section,kind,name,filters);\n const host=section.querySelector('[data-entity-grid]');")
def test_offline_sources_drop_out_of_the_default_filter(self):
"""脱盘的来源要从默认筛选里摘掉。
@@ -6322,15 +6303,12 @@ class WebUiSourceTests(unittest.TestCase):
def test_entity_profile_hides_home_facets_and_renders_context(self):
self.assertPageContains("body.entity-open #tiers,body.entity-open #tagbar,")
self.assertPageContains("logo:company&&d.has_logo?d.canonical_name:'',")
- self.assertPageContains('class="tagscroll entitytags"')
- self.assertPageContains("filterChipHtml(tagLabel(x.k),{attr:'data-entity-tag'")
profile = self.page[self.page.index("async function openEntity("):]
- # 资料卡(连同卡底的同台艺人)是 entity-hero island,宿主排在筛选条之前;同台艺人
- # 收在卡底那条带里、由 aria-label 说是谁,由 e2e 设计用例量。
+ # 资料卡(连同卡底的同台艺人)是 entity-hero island,筛选浮层是 entity-filter
+ # island,宿主排在资料卡之后;两块的外观由 e2e 设计用例量。
self.assertLess(profile.index('<div data-entity-hero="'),
- profile.index('class="tagscroll entitytags"'))
+ profile.index('<div data-entity-filter>'))
self.assertPageLacks("entityfootlabel")
- self.assertPageContains('class="entitytagbar" aria-label="媒体与标签"')
self.assertNotIn("关联艺人", profile)
self.assertNotIn("相关标签", profile)
# 资料页只渲染可核对的身份、计数与链接,没有散文简介块,样式表里也不该
@@ -6366,8 +6344,7 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains("ENTITY_FILTER_KEYS.forEach(key=>{if(filters[key]&&key!==kind&&key!=='sort')p.set(key,filters[key])})")
self.assertPageContains("async function updateEntityCollection")
# 资料页的标签走全站共用的那个开关,落在这一页的筛选上,不重开页面。
- self.assertCode("$('#index').querySelectorAll('[data-entity-tag]').forEach(b=>b.onclick=()=>\n"
- " toggleTag(b.dataset.entityTag));")
+ self.assertPageContains("toggleTag:tag=>toggleTag(tag),")
self.assertPageContains("updateEntityCollection(barsContext.kind,barsContext.name,filters,true)")
self.assertPageContains("renderEntityCollection(kind,name,items,filters)")
self.assertPageLacks("openEntity(kind,name,true,next)")
@@ -6376,8 +6353,6 @@ class WebUiSourceTests(unittest.TestCase):
)
def test_every_entity_video_collection_reuses_applicable_sort_controls(self):
- self.assertPageContains("shuffleClass='entitybatch'")
- self.assertPageContains("filters.sort||'new',filters.dir,'data-entity-sort')")
self.assertPageContains("p.set('sort',filters.sort||'new')")
self.assertPageContains("if(filters.sort==='seed')p.set('seed',state.seed)")
self.assertPageContains("const JAV_RELEASE_SORT=['release','发行时间']")
@@ -6388,19 +6363,12 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains(
"if(state.jav!=='1'&&state.sort==='release'){state.sort='seed';state.dir=''}")
self.assertPageContains(
- "if(next)updateEntityCollection(kind,name,{...filters,...next},true)")
+ "if(next)void updateEntityCollection(kind,name,{...filters,...next},true)")
self.assertPageContains("key==='sort'&&filters[key]==='new'")
- self.assertPageContains(".entitycollectionhead .sorts")
- self.assertPageContains(".entitytagbar{position:sticky;top:var(--topH);z-index:61")
self.assertPageContains("height:var(--filterH);margin:0 -16px;padding:9px 16px")
- self.assertPageContains(".entitytags .pill{flex:none}")
- self.assertPageLacks(".entitytags button{height:34px")
self.assertPageContains("mountFilterFrame(top,bottom,")
- self.assertPageContains(".entitycollectionhead{position:sticky;top:var(--topH);z-index:60")
- self.assertPageContains(
- ".tagbar.is-stuck,.count.is-stuck,.entitytagbar.is-stuck,.entitycollectionhead.is-stuck"
- )
- self.assertPageContains("['.board-filter-frame','#tagbar','#count','.entitytagbar','.entitycollectionhead']")
+ self.assertPageContains(".tagbar.is-stuck,.count.is-stuck{")
+ self.assertPageContains("['.board-filter-frame','#tagbar','#count']")
self.assertPageContains("scheduleStickySurfaces();")
# 照片墙没有视频排序语义,切换后直接渲染照片,不复用作品头。
self.assertPageContains("if(media==='photos'){renderPhotoWall(kind,name,filters,entityPhotos);return}")
@@ -6492,31 +6460,18 @@ class WebUiSourceTests(unittest.TestCase):
'repeat(auto-fill,minmax(150px,1fr))}\n}')
def test_the_roster_and_the_media_keys_are_one_button_group(self):
- """三个键问的是同一件事——这一页现在显示什么,所以在同一组里、同一个尺寸。"""
- self.assertCode(
- "${peopleValue?control(peopleValue,peopleLabel,peopleCount,peopleIcon,'people'):''}")
- self.assertPageContains("peopleValue:roster.length?'people':'',peopleCount:roster.length,")
+ """三个键问的是同一件事——这一页现在显示什么,所以在同一组里、同一个尺寸。
+
+ 那一组由 entity-filter island 画,同组同尺寸由 e2e `entity-filter.test.ts` 量。"""
+ self.assertPageContains("people:roster.length?{label:kind==='studio'?'厂牌':'艺人',count:roster.length,")
# 当前视图只有一个来源,按下哪个键、下面画什么都读它。
self.assertPageContains("function entityViewNow(kind){return (kind==='agency'||kind==='studio')"
"&&entityRosterView==='people'&&entityRoster.length")
- self.assertCode("button.setAttribute('aria-pressed',String(now===media));")
# 没有照片的实体不出照片键,不是出一个按下去什么都不显示的键。
- self.assertPageContains("imageValue:photoCount?'photos':'',imageLabel:'照片',")
+ self.assertPageContains("photos:photoCount?{count:photoCount}:null}:null;")
# 标签筛的是作品,点了就回到视频视图,否则开关和内容各说各的。
self.assertCode("entityRosterView='videos';")
- def test_the_profile_rows_that_overflow_get_the_shared_drag_and_wheel(self):
- """同台艺人和标签这两行没有滚动条,不接拖动就是看得见够不着。
-
- 同台艺人与外链那排在资料卡岛里,经 `helpers.wireScroller` 接同一套(entity-hero.test.tsx)。
- """
- self.assertPageContains("wireDrag($('#index').querySelector('.entitytags'));")
- # 作品集表头窄屏下整条横滚,390px 实测溢出 338px,不登记就只有滚动条被藏掉、
- # 滚轮又是竖向的那种死局。
- self.assertPageContains("wireDrag(section.closest('.entitycollectionhead')"
- "||section.querySelector('.entitycollectionhead'));")
- # 横向滚动行里的开关不能被压扁。
- self.assertPageContains(".entitytags .iconswitch{flex:none}")
def test_the_maker_index_switch_moves_between_two_routes(self):
"""厂牌出片、事务所出人,是两种实体:开关切的是路径,不是同一批数据再筛一次。"""
@@ -6796,13 +6751,11 @@ class WebUiSourceTests(unittest.TestCase):
self.assertIn(".insightswitch[data-board-segments]{position:relative;display:inline-flex;align-items:center;gap:2px;padding:4px;"
"border:0;border-radius:10px;background:var(--color-background-tertiary-default);box-shadow:none}", board)
# 浮层上的分段器滑块就是整枚选项:30px 见方、8px 圆角,跟旁边那块滑动玻璃同一副尺寸。
- self.assertIn(".board-filter-frame.board-filter-frame .iconswitch[data-board-segments]>label,\n"
- ".entitytagbar.entitytagbar .iconswitch[data-board-segments]>label,\n"
- ".entitycollectionhead.entitycollectionhead .iconswitch[data-board-segments]>label"
+ self.assertIn(".board-filter-frame.board-filter-frame .iconswitch[data-board-segments]>label"
"{height:30px;min-height:30px;width:30px;padding:0;border-radius:8px}", board)
self.assertNotIn("{padding:3px;border-radius:8px;gap:2px}", board)
# 横滚容器会裁掉滑块与玻璃的落影:上下各留 14px 再用负外边距收回,行高不变。
- self.assertIn(".count .sorts,.entitycollectionhead .sorts{padding:14px 2px;margin-block:-14px}", board)
+ self.assertIn(".count .sorts{padding:14px 2px;margin-block:-14px}", board)
# 下划线只归管理导航与设置分区;两套证据的切换是分段控件,判据在
# test_the_two_bodies_of_evidence_switch_as_a_segmented_control。
self.assertIn(".insightpanel>header h3,.insightcopy>span{margin:0;font:var(--board-heading);color:var(--color-text-primary)}", board)
@@ -6993,11 +6946,9 @@ class WebUiSourceTests(unittest.TestCase):
self.assertCode(
" applyFilterStateInPlace(filters);refreshFacetCounts(barsContext);\n"
" updateEntityCollection(barsContext.kind,barsContext.name,filters,true);return")
- # 三处按下态:筛选条的药丸、卡片和资料页上的标签、侧栏那些芯片。
+ # 两处按下态:筛选条与卡片上的标签、侧栏那些芯片;资料页那排由岛照推过去的 props 画。
self.assertPageContains(
" b.setAttribute('aria-pressed',String(tagPressed(filters.tag,b.dataset.tag))));")
- self.assertPageContains(
- " b.setAttribute('aria-pressed',String(tagPressed(filters.tag,b.dataset.entityTag))));")
self.assertPageContains("$('#drawer').querySelectorAll('.chip[data-key]')")
# 轨道上那截填充由 oninput 算,改 value 不会自己触发。
self.assertPageContains(" durMin.dispatchEvent(new Event('input'));")
@@ -7165,8 +7116,8 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains("const tagPillHtml=t=>filterChipHtml(tagLabel(t.k),{attr:'data-tag',value:t.k,\n"
" selected:tagPressed(filterState.tag,t.k),"
"count:t.n==null?undefined:t.n.toLocaleString()});")
- self.assertPageContains("filterChipHtml(tagLabel(x.k),{attr:'data-entity-tag',value:x.k,"
- "selected:tagPressed(filters.tag,x.k),count:x.n.toLocaleString()})")
+ # 资料页那排的数由 entity-filter island 印,壳只把每枚的 n 照推过去。
+ self.assertPageContains("({k:x.k,label:tagLabel(x.k),n:x.n,selected:tagPressed(filters.tag,x.k)})")
def test_the_count_behind_a_tag_reads_as_a_footnote_not_part_of_the_name(self):
"""计数与标签之间要有间隔,字号和颜色也各降一档。
@@ -7203,7 +7154,7 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains(" document.body.classList.add('refreshing');")
self.assertPageContains(" try{await Promise.all([loadCatalog(),buildBars()])}")
self.assertPageContains(" finally{document.body.classList.remove('refreshing')}")
- self.assertPageContains("body.refreshing #batchAction svg,")
+ self.assertPageContains("body.refreshing #batchAction svg{")
# 标签条和顶部三层照旧留着旧内容等新内容,不进骨架。
self.assertPageLacks("tagbarSkeleton", "有内容在屏幕上时不铺骨架")
@@ -7325,8 +7276,7 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains("border-bottom:1px solid transparent;background:transparent")
self.assertPageContains("background:transparent;border-bottom:1px solid transparent")
self.assertPageContains(
- ".tagbar.is-stuck,.count.is-stuck,.entitytagbar.is-stuck,.entitycollectionhead.is-stuck"
- "{background:color-mix(in srgb,var(--ground) 84%,transparent)"
+ ".tagbar.is-stuck,.count.is-stuck{background:color-mix(in srgb,var(--ground) 84%,transparent)"
)
self.assertPageLacks("color-mix(in srgb,#080A0D 84%,transparent)",
"吸顶条跟着 --ground 走,浅色主题下不许铺出一条黑带")
@@ -7361,7 +7311,6 @@ class WebUiSourceTests(unittest.TestCase):
def test_entity_collection_posters_and_titles_open_item_details(self):
self.assertPageContains(".cardopenhit{position:absolute;inset:0;z-index:1")
self.assertPageContains(".hovertools button{pointer-events:none")
- self.assertPageContains("section.querySelector('h3').textContent=`视频 ·")
self.assertPageLacks("的馆藏作品 ·")
def test_hover_seek_controls_wear_the_watch_later_button_skin(self):
@@ -7800,7 +7749,8 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains(".edge button[data-nav],#drawer .dnav button[data-nav]")
# 组合标签:pill 按按下态逐个命中;combo 芯片显示显示名、操作用原始 key。
self.assertPageContains("tagPressed(filterState.tag,t.k)")
- self.assertPageContains("${esc(tagLabel(t))} <b data-untag=\"${esc(t)}\">✕</b>")
+ self.assertPageContains("tagList(filters.tag).forEach(t=>items.push({kind:'untag',key:t,label:tagLabel(t)}));")
+ self.assertPageContains("${esc(item.label)} <b data-untag=\"${esc(item.key)}\">✕</b>")
# fwarn 提供 dismiss(会话内记忆),关闭钮样式与 toast 关闭钮同量纲。
self.assertPageLacks("data-fwarn-dismiss")
self.assertPageContains(".fwarn{grid-template-columns:16px minmax(0,1fr);")
@@ -8411,9 +8361,8 @@ class WebUiSourceTests(unittest.TestCase):
def test_entity_and_follow_pages_share_round_video_image_buttons(self):
"""资料页切视频、照片、名册和关注页切视频、图片是同一组圆键。
- 资料页那一组住在筛选浮层最左端,隔一道竖杠再是四枚观看状态:它换掉的是整页内容,
- 夹在视图和标签中间会被读成标签那排的第一枚。只有多于一档时才出——一枚孤零零的键
- 没有可切的对象。关注页那两枚是浮层下排右端的控件,跟首页下排右端的排序键同一个位置。
+ 资料页那一组住在筛选浮层最左端(`entity-filter` 岛,只有多于一档时才出,行为见
+ `frontend/e2e/entity-filter.test.ts`)。关注页那两枚在上排最左,字形、圆形与大小同那一组。
索引页的下划线 Tabs 是另一个控件,切的是地址。
"""
self.assertPageContains('id="i-pics" viewBox="-1.6 -1.6 19.2 19.2" fill="currentColor" stroke="none"')
@@ -8422,15 +8371,7 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains("export function boardTabsHtml(items,{active='',attr='data-tab',label='页面视图',className='',panel=''}={}){")
self.assertPageContains('<span class="board-tab-count">${esc(Number(count).toLocaleString())}</span>')
self.assertPageContains('<div class="board-local-nav board-tabs${className?` ${esc(className)}`:\'\'}" role="tablist" aria-label="${esc(label)}">')
- self.assertCode("const mediaToggle=(photoCount||roster.length)?mediaViewButtonsHtml({\n"
- " active:entityViewNow(kind),")
- self.assertPageContains("videoCount:d.asset_count,imageCount:photoCount,")
self.assertPageLacks("entitytabs")
- # 这一组是整条上唯一住在滚动层外面的东西——余下两格用的就是首页那两个类名,同一份摆法两页共一处。
- self.assertPageContains('<section class="entitytagbar" aria-label="媒体与标签">${mediaToggle}'
- """${mediaToggle?'<span class="sep" aria-hidden="true"></span>':''}"""
- '<div class="filterscroll"><div class="viewpills entityviews"')
- self.assertPageContains('<div class="tagscroll entitytags">${tags}</div></div></section>')
# 关注页的读数照首页那条写,右端是这一页的动作键与排序键;媒体类型不在这一排,
# 它跟资料页一样住在上排最左。
self.assertPageContains('<div class="count followcount"><span class="mono">${total.toLocaleString()} 项更新 · 显示 ${visible.length.toLocaleString()}</span>'
@@ -8797,7 +8738,8 @@ class WebUiSourceTests(unittest.TestCase):
# 选中那枚的填充只有一处,就是那块玻璃自己。
self.assertNotIn('.board-filter-frame #tagbar .pill[data-state][aria-pressed="true"]{'
'background:var(--picked)', board)
- self.assertIn(".viewglide.viewglide,.drawer.drawer>.navglide,.board-local-nav>.navglide{"
+ self.assertIn(".viewglide.viewglide,[data-view-glide][data-view-glide],.drawer.drawer>.navglide,"
+ ".board-local-nav>.navglide{"
"position:absolute;left:0;top:0;z-index:0;pointer-events:none;", board)
self.assertIn("backdrop-filter:var(--glass-pick);", board)
self.assertIn("pills.forEach(b=>b.onpointerenter=e=>"
@@ -8815,74 +8757,28 @@ class WebUiSourceTests(unittest.TestCase):
"backdrop-filter:none;border:0}", board)
self.assertNotIn(".top.top::before", board)
- def test_the_entity_view_row_shares_the_home_sliding_pane(self):
- """资料页那四枚跟首页那四枚共用同一块滑动玻璃。
-
- 在人眼里这两排就是同一个控件——同一套词、同一个位置、同一件事——「跟着指针滑
- 过去」没有理由只在其中一页成立。
-
- 两边的 DOM 对不上:首页那排是 `#viewPills` 里的链接,选中记在 `data-state` 上;
- 资料页是 `.entityviews` 里的按钮,记在 `data-entity-state` 上。所以按结构找,
- 不按 id 找。判据还得是「此刻量得出宽度」而不是「存在」:两排在同一份文档里一直
- 都在,资料页开着的时候首页那排只是被祖先收起来了,`hidden` 上看不出来,写死
- `#viewPills` 于是一直取到那一排——资料页从来没有过玻璃,这就是原样。零宽度把
- 这一种连同 `display:none` 和照片视图下那一排自己的 `hidden` 一起挡住。
-
- 选中态的填充只有一处,就是那块玻璃自己,两排各自都不铺底:两边都铺的话,静止态
- 是一块不透明的填充压在玻璃上面,切换时也只看得见它瞬间换位置,滑动的那块从头到
- 尾被盖在下面。首页那四枚是同一个写法。
- """
- board = (Path(__file__).resolve().parents[1] / "web/board.css").read_text(encoding="utf-8")
- self.assertPageContains("views:{selector:'#viewPills,.entityviews,.followviews',")
- self.assertPageContains("if(row.offsetWidth&&row.closest('.board-filter-frame'))return row;")
- self.assertPageContains(
- "'[data-state][aria-pressed=\"true\"],[data-entity-state][aria-pressed=\"true\"],")
- # 两页共用同一段接线;玻璃要等外框搭好才量得到位置。
- self.assertPageContains("function wireViewGlideRow(row,pills,kind='views'){")
- self.assertPageContains("wireViewGlideRow(controls,buttons);")
- self.assertPageContains(" syncViewGlide(false);\n scheduleStickySurfaces();")
- self.assertPageLacks("const tagbar=$('#tagbar'),views=$('#viewPills');if(!tagbar||!views)return;",
- "写死首页那两个 id 就是资料页没有玻璃的原因")
- # 资料页那四枚跟左端两枚媒体圆键都不自己铺底,选中和悬停都只提字色。
- self.assertIn('.entitytagbar.entitytagbar .pill[data-entity-state],\n'
- '.entitytagbar.entitytagbar .pill[data-entity-state]:hover,\n'
- '.entitytagbar.entitytagbar .pill[data-entity-state][aria-pressed="true"],\n'
- '.entitytagbar.entitytagbar .mediaviewbutton,\n'
- '.entitytagbar.entitytagbar .mediaviewbutton:hover,\n'
- '.entitytagbar.entitytagbar .mediaviewbutton[aria-pressed="true"]{\n'
- ' border:0;background:none;backdrop-filter:none;'
- '-webkit-backdrop-filter:none;box-shadow:none}', board)
-
def test_the_view_pane_is_the_only_pane_and_the_follow_row_rides_it_too(self):
- """观看状态那一排的玻璃是一块,首页、资料页、关注页三处共用;资料页左端那一组
- 媒体圆键另有一块圆的。
+ """观看状态那一排的玻璃是一块,首页与关注页共用;关注页左端那一组媒体圆键另有一块
+ 圆的。资料页那两排是同一块料,由 entity-filter island 自己挪(`use-view-glide.ts`)。
两排问的不是同一件事,共用一块的话点一下照片,玻璃从「没看过」那儿飞过来,读出来
是两排在抢同一个当前项。圆角跟着按钮走:那几枚是正圆,一块 8px 圆角的方玻璃扣上去,
四个角先露出来。
- 玻璃按用途存,不按元素存:资料页每换一次筛选就把整条重画一遍,拿节点当键等于
+ 玻璃按用途存,不按元素存:关注页每换一次筛选就把整条重画一遍,拿节点当键等于
每重画一次就新建一块,动画从头起跑,看到的只是瞬移。
"""
board = (Path(__file__).resolve().parents[1] / "web/board.css").read_text(encoding="utf-8")
- self.assertPageContains("views:{selector:'#viewPills,.entityviews,.followviews',")
- self.assertPageContains("pressed:'[data-state][aria-pressed=\"true\"],[data-entity-state][aria-pressed=\"true\"],"
+ self.assertPageContains("views:{selector:'#viewPills,.followviews',")
+ self.assertPageContains("pressed:'[data-state][aria-pressed=\"true\"],"
"[data-follow-filter][aria-pressed=\"true\"]'},")
- # 资料页和关注页的媒体那一组同形,共用这一块玻璃:选择器写在一处,不是两页各一份。
- self.assertPageContains("media:{selector:'.entitymediaview,.followmediaview',"
+ self.assertPageContains("media:{selector:'.followmediaview',"
"pressed:'[data-media-view][aria-pressed=\"true\"]',")
self.assertPageContains("className:'viewglide-round'")
- self.assertIn('.viewglide.viewglide-round{border-radius:50%}', board)
+ self.assertIn('.viewglide.viewglide-round,[data-view-glide="round"][data-view-glide]{border-radius:50%}', board)
self.assertPageContains("const viewGlides=new Map();")
self.assertPageContains("function syncViewGlide(animate,target,kind='views'){")
self.assertPageContains("let glide=viewGlides.get(kind);")
- # 按下去那一下玻璃就滑过去,不等换视图的活干完。
- self.assertPageContains("syncViewGlide(true,button,'media');\n"
- " switchEntityMedia(kind,name,filters,media);")
- self.assertPageContains("wireViewGlideRow(controls,buttons,'media');")
- self.assertPageContains("const controls=$('#index').querySelector('.entitymediaview');if(!controls)return;")
- # 照片视图下这条只剩左端那一组,分隔线没有东西可隔。
- self.assertIn('.entitytagbar[data-media-only] .sep{display:none}', board)
# 关注页:先搭外框再量玻璃,点下去玻璃先走、数据后到。
self.assertPageContains("wireViewGlideRow(filterRow.querySelector('.followviews'),statusPills);")
self.assertPageContains("statusPills.forEach(p=>p.setAttribute('aria-pressed',String(p===button)));syncViewGlide(true,button);")
@@ -9168,17 +9064,10 @@ class WebUiSourceTests(unittest.TestCase):
一点。
"""
board = (Path(__file__).resolve().parents[1] / "web/board.css").read_text(encoding="utf-8")
- self.assertIn('.entitytagbar.entitytagbar .pill[aria-pressed="true"]{\n'
- " background:linear-gradient(180deg,var(--glass-sheen),transparent 62%),"
- "var(--glass-pick-fill);\n"
- " backdrop-filter:var(--glass-pick);-webkit-backdrop-filter:var(--glass-pick);\n"
- " color:var(--glass-text);border-color:transparent;\n"
- " box-shadow:inset 0 0 0 1px var(--glass-rim),var(--glass-pick-shadow)}", board)
- self.assertIn(".entitycollectionhead.entitycollectionhead .sorts button:not(.batchaction),\n"
- ".board-filter-frame.board-filter-frame .sorts button:not(.batchaction){\n"
+ # 资料页标签按下那块玻璃与那一排排序键由 entity-filter island 画,外观由 e2e 对照量。
+ self.assertIn(".board-filter-frame.board-filter-frame .sorts button:not(.batchaction){\n"
" color:color-mix(in srgb,var(--glass-text) 62%,transparent)}", board)
- self.assertIn('.entitycollectionhead.entitycollectionhead .sorts button[aria-pressed="true"],\n'
- '.board-filter-frame.board-filter-frame .sorts button[aria-pressed="true"]{\n'
+ self.assertIn('.board-filter-frame.board-filter-frame .sorts button[aria-pressed="true"]{\n'
" background:none;backdrop-filter:none;-webkit-backdrop-filter:none;\n"
" color:var(--glass-text);border-color:transparent;box-shadow:none;"
"font-weight:500}", board)
@@ -9794,43 +9683,26 @@ class WebUiSourceTests(unittest.TestCase):
"""换一批走强调档:这一排其余的是排序开关,只有它是动作。
面色取全站那两个 token,压上去提亮一档;圆角随这一条上的按钮取 7px。排序键那条
- 字色规则要把它排除掉,否则首页那枚读到白、资料页那枚读到六成的玻璃字色。
+ 字色规则要把它排除掉,否则它读到六成的玻璃字色。资料页那一枚在 entity-filter
+ island 里,由 e2e `entity-filter.test.ts` 对照量。
"""
board = (Path(__file__).resolve().parents[1] / "web/board.css").read_text(encoding="utf-8")
- self.assertIn(".board-filter-frame.board-filter-frame .sorts .batchaction,"
- ".entitycollectionhead.entitycollectionhead .sorts .batchaction"
+ self.assertIn(".board-filter-frame.board-filter-frame .sorts .batchaction"
"{color:#fff;background:var(--board-blue);border:0;border-radius:7px;"
"box-shadow:var(--elevation-xs)}", board)
# 选中态归排序键,换一批只有悬停。
- self.assertIn(".board-filter-frame.board-filter-frame .sorts .batchaction:hover,"
- ".entitycollectionhead.entitycollectionhead .sorts .batchaction:hover"
+ self.assertIn(".board-filter-frame.board-filter-frame .sorts .batchaction:hover"
"{background:var(--board-blue-hover);color:#fff}", board)
- for selector in (".entitycollectionhead.entitycollectionhead .sorts button:not(.batchaction),",
- ".board-filter-frame.board-filter-frame .sorts button:not(.batchaction){",
- ".entitycollectionhead.entitycollectionhead .sorts button:not(.batchaction):hover,",
+ for selector in (".board-filter-frame.board-filter-frame .sorts button:not(.batchaction){",
".board-filter-frame.board-filter-frame .sorts button:not(.batchaction):hover{"):
self.assertIn(selector, board, "排序键的字色不能再盖到换一批身上")
- def test_profile_tags_are_the_same_pill_as_the_ones_on_the_home_filter_bar(self):
- """资料页的标签跟首页筛选条上的标签是同一个控件,只是换了个位置。
-
- 它现在坐在玻璃上,描边和字色跟着玻璃那套读数走:`--line` 与 `--ink-2` 是配着
- 页面底色调的,压到半透明的玻璃上比周围重一档。
- """
- board = (Path(__file__).resolve().parents[1] / "web/board.css").read_text(encoding="utf-8")
- self.assertIn(".entitytags .pill{height:30px;padding:0 10px;font-size:13px;line-height:20px;"
- "border-radius:var(--tag-radius);border:1px solid var(--glass-low);"
- "color:var(--glass-text)}", board)
- self.assertIn(".board-filter-frame .tagbar .pill{height:30px;padding:0 10px;font-size:13px;", board)
-
def test_the_profile_floating_panel_is_one_pane_measured_off_the_home_one(self):
- """资料页顶上那块浮层是一块玻璃,尺寸照首页那块量。
+ """资料页骨架里那块浮层尺寸照首页那块量,真浮层(entity-filter island)接管时不跳。
- 标签行和排序行是两个兄弟,一个挂在 `.index` 上、一个在 `.entitysection` 里,
- 而那一段的 innerHTML 每次重画都整块换掉,套不进首页那个 `.board-filter-frame`。
- 所以两行自己都不铺底,整块玻璃由下半的 ::before 一次画完,圆角是整块的 22px。
- 下半的吸顶位置是上半的下沿,那个高度只归这块浮层——基础层的 `--filterH` 是
- 没有浮层时贴着顶栏的老尺寸,拿它算会差 10px。
+ 骨架是一段字符串,上下两排自己写全;两排的高度只归这块浮层——基础层的
+ `--filterH` 是没有浮层时贴着顶栏的老尺寸,拿它算会差 10px。接管时的几何由 e2e
+ `entity-filter.test.ts` 量。
"""
root = Path(__file__).resolve().parents[1]
board = (root / "web/board.css").read_text(encoding="utf-8")
@@ -9852,8 +9724,6 @@ class WebUiSourceTests(unittest.TestCase):
# 读数和排序键照首页那条 `10,471 个符合` 与它旁边那排写。
self.assertIn(".entitycollectionhead h3{font-size:12px;font-weight:400;letter-spacing:normal;"
"color:var(--ink-2)}", board)
- self.assertIn(".entitycollectionhead .sorts button{height:30px;min-height:30px;font-size:12px;"
- "padding:0 8px;border:0;border-radius:7px;background:transparent}", board)
self.assertIn(".board-filter-frame .sorts button{height:30px;min-height:30px;font-size:12px;"
"padding:0 8px;border:0;border-radius:7px;background:transparent}", board)
@@ -9888,17 +9758,11 @@ class WebUiSourceTests(unittest.TestCase):
self.assertIn(selector, contrast, "高对比那条少了一个面")
def test_a_horizontal_tag_row_fades_at_both_ends(self):
- """横着滚的标签行两端要渐隐,资料页和首页用同一段。
+ """横着滚的标签行两端要渐隐,资料页那排由 `entity-filter` 岛登记同一段。
不渐隐的话,浮层圆角那儿最后一个标签被直角硬切掉半个字,也看不出右边还有。
"""
self.assertPageContains("function wireHorizontalScroller(el,")
- self.assertPageContains("wireDrag($('#index').querySelector('.entitytags'));")
- # 窄屏下滚的是外面那层,四枚观看状态跟着标签一起走;两层都登记,登记在不滚的
- # 那层上是空转,少登记一层就会在某一个宽度上滚不动。
- self.assertPageContains(
- "wireHorizontalScroller($('#index').querySelector('.entitytags'));"
- "\n wireHorizontalScroller($('#index').querySelector('.entitytagbar .filterscroll'));")
self.assertPageContains(
"if(filterFrame)[boardTagbar,countbar.querySelector('.sorts')].forEach(el=>wireHorizontalScroller(el));")
@@ -10430,13 +10294,9 @@ class WebUiSourceTests(unittest.TestCase):
combo = self._js_function("renderCombo")
self.assertIn("if(!catalogOnScreen()){$('#combo').innerHTML='';return}", combo,
"芯片必须先问过屏幕再画,否则每加一个整页视图就复发一次")
- # 资料页那条是它自己的,读的是这一页的筛选,不是目录的 `state`。
- self.assertIn("entityCombo.innerHTML=comboHtml(barsContext.filters);wireCombo(entityCombo)", combo)
- self.assertPageContains('<div class="combo entitycombo"></div>\n'
- ' <section class="entitytagbar"',
- "资料页的交集条挂在标签条正上方,跟首页那条挂在浮层上方是同一个位置")
- self.assertPageContains(".entitycombo:has(+.board-filter-frame .entitytagbar[data-media-only]){display:none}",
- "交集条列的是作品筛选,照片视图下不成立")
+ # 资料页那条是它自己的,读的是这一页的筛选,不是目录的 `state`;由 entity-filter
+ # island 画在浮层正上方,照片视图下收起,由 e2e 量。
+ self.assertIn("pushEntityFilter({combo:comboItems(barsContext.filters)});", combo)
self.assertLess(combo.index("catalogOnScreen()"), combo.index("$('#combo').innerHTML=\n"),
"判据要在拼 HTML 之前,不能画完再擦")
# 铺开索引页/资料页与进入管理页是同一件事的两侧,各自的共用函数都要收掉芯片。
@@ -10472,8 +10332,7 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains("wireTagPills($('#tagScroll'));")
self.assertPageContains("root.querySelectorAll('[data-tag]')"
".forEach(b=>b.onclick=()=>{toggleTag(b.dataset.tag)});")
- self.assertCode("$('#index').querySelectorAll('[data-entity-tag]').forEach(b=>b.onclick=()=>\n"
- " toggleTag(b.dataset.entityTag));")
+ self.assertPageContains("toggleTag:tag=>toggleTag(tag),")
self.assertPageContains("commitContextFilter(filters=>{filters.tag=tagPressed(filters.tag,tag)?'':tag});")
self.assertPageContains("$('#index').dataset.entityKind=kind;$('#index').dataset.entityName=name;")
self.assertPageContains("root.querySelectorAll('[data-untag]')"
@@ -10483,8 +10342,6 @@ class WebUiSourceTests(unittest.TestCase):
# 按下态与表头也读同一份判据,资料页的标签因此和目录一样能叠加。
self.assertPageContains("tagPressed(filterState.tag,t.k)")
self.assertPageContains("selected:tagPressed(filters.tag,x.k)")
- self.assertPageContains(
- "b.setAttribute('aria-pressed',String(tagPressed(filters.tag,b.dataset.entityTag)))")
self.assertPageContains("const entityTags=tagList(filters.tag).map(tagLabel);")
def test_the_follow_url_is_the_only_source_of_truth_for_its_filters(self):
@@ -10821,7 +10678,7 @@ class WebUiSourceTests(unittest.TestCase):
def test_photo_tab_opens_the_flat_wall_without_album_cover_cards(self):
self.assertPageContains("if(media==='photos'){renderPhotoWall(kind,name,filters,entityPhotos);return}")
- self.assertPageContains("readout:back?`${esc(data.title)} · ${(data.total||0).toLocaleString()} 张`:photoReadout(data,codeSets)")
+ self.assertPageContains("readout:back?`${data.title} · ${(data.total||0).toLocaleString()} 张`:photoReadout(data,codeSets)")
self.assertPageContains("/api/photos?kind=${encodeURIComponent(kind)}&name=${encodeURIComponent(name)}&limit=120&offset=${localPhotoCount()}")
self.assertPageLacks("renderPhotoSets")
self.assertPageLacks(".photosetcover{display:block;aspect-ratio:3/4")
@@ -10832,11 +10689,13 @@ class WebUiSourceTests(unittest.TestCase):
账本里图片只有文件名、体积和来源,视频那排排序键在这里没有对应的数。换一批跟
视频那一排同一枚键、同一个位置;大小是列数,一次请求都不发。那排标签数的是视频,
照片视图下收起来。等着的那一下骨架也带着下半,浮层不会缺一截。"""
- self.assertPageContains("const photoHeadHtml=(data,{back=false,codeSets=[]}={})=>collectionHeaderHtml({className:'photohead'")
+ # 那一排由 entity-filter island 画,壳只给读数与这几样的现值。
+ self.assertPageContains("const photoHead=(data,{back=false,codeSets=[]}={})=>({")
self.assertPageContains(
- "controls:sortControlsHtml({extra:photoControlsHtml()")
+ "photo:{back,shuffle:!!data.total,layout:photoLayout(),layouts:PHOTO_LAYOUTS,setId:back?Number(data.id):0}});")
self.assertPageLacks("photorefresh")
- self.assertPageContains("shufflePhotos(kind,name,filters,entityWide?0:data.id,event.currentTarget)")
+ self.assertPageContains(
+ "if(entityViewNow(kind)==='photos')return shufflePhotos(kind,name,live(),entityMediaView.set||0);")
# 换过一批,后面几页沿用同一粒种子。
self.assertPageContains("seed=data.seed?`&seed=${encodeURIComponent(data.seed)}`:'';")
self.assertPageContains("offset=${localPhotoCount()}${seed}`")
@@ -10851,9 +10710,7 @@ class WebUiSourceTests(unittest.TestCase):
'.photowall[data-size="big"]{grid-template-columns:repeat(3,minmax(0,1fr))}')
self.assertPageContains(
' .photowall[data-size="big"]{grid-template-columns:repeat(1,minmax(0,1fr))}')
- # 标签只在视频视图里露面。
- self.assertPageContains("toggleAttribute('data-media-only',now!=='videos')")
- self.assertPageContains(".entitytagbar[data-media-only] .entitytags .pill{display:none}")
+ # 标签只在视频视图里露面,由 e2e `entity-filter.test.ts` 量。
self.assertPageContains(
"const head=collectionHeaderHtml({readout:'&nbsp;',loading:true,filterRow:'bottom'});")
@@ -10879,7 +10736,7 @@ class WebUiSourceTests(unittest.TestCase):
self.assertIn(" .board-filter-frame .count,.entitycollectionhead{display:flex;"
"flex-wrap:nowrap;align-items:center;gap:10px;\n", board)
self.assertIn(" overflow-x:auto;overflow-y:hidden;scrollbar-width:none;\n", board)
- self.assertIn(" .board-filter-frame .count .sorts,.entitycollectionhead .sorts{flex:none;"
+ self.assertIn(" .board-filter-frame .count .sorts{flex:none;"
"width:max-content;max-width:none;min-width:0;\n margin-left:auto;"
"overflow:visible;padding:0;margin-block:0}}", board)
for lacking, why in (
@@ -10908,7 +10765,7 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains('mountFilterFrame(top,bottom,')
self.assertPageContains('mountFilterFrame(boardTagbar,countbar,')
self.assertPageContains("'tag','state','dur_min'")
- self.assertPageContains("state:button.dataset.entityState")
+ self.assertPageContains("setState:value=>void updateEntityCollection(kind,name,{...live(),state:value},true),")
self.assertNotIn(".entitytagbar.is-stuck::before{", board)
self.assertNotIn(".entitytagbar.entitytagbar.entitytagbar,body .review .reviewbulktoolbar{", board)
self.assertNotIn("body .review .reviewbulktoolbar{clip-path:", board)
@@ -10919,16 +10776,13 @@ class WebUiSourceTests(unittest.TestCase):
self.assertNotIn("var(--glass-rim),0 1px 2px #00000024", board)
# 版式、大小这类分段开关在浮层上换材质:壳透明,滑块是选中态那块玻璃。
self.assertIn(".board-filter-frame.board-filter-frame .iconswitch[data-board-segments]{background:none}", board)
- self.assertIn(".entitycollectionhead.entitycollectionhead.entitycollectionhead "
- ".iconswitch[data-board-segments]>.board-segment-thumb,", board)
def test_jav_entity_pages_render_and_wire_the_same_layout_buttons(self):
- self.assertPageContains(
- 'section.innerHTML=`${collectionHeaderHtml({controls:entityCollectionSortsHtml(filters)})}')
- self.assertPageContains('entityCollectionSortsHtml=filters=>sortControlsHtml(')
- self.assertPageContains("extra:javActive()?javLayoutButtons():''")
- self.assertPageContains("wireJavLayoutButtons(section)")
- # 版式开关和关注列表的紧凑开关是同一个控件:共用 iconSwitchHtml 与 .iconswitch
+ # 资料页那一格由 entity-filter island 画,壳给同一份选项与现值,按下回同一个 setJavLayout。
+ self.assertPageContains("jav:javActive()?{layout:javLayout(),options:JAV_LAYOUTS}:null")
+ self.assertPageContains("setJavLayout:value=>{setJavLayout(value);")
+ self.assertPageContains("extra:javActive()?javLayoutButtons():homeLayoutActive()")
+ # 首页的版式开关和关注列表的紧凑开关是同一个控件:共用 iconSwitchHtml 与 .iconswitch
# 样式,.javlayout 只留排序行里的位置微调。
self.assertPageContains("iconSwitchHtml('jav-layout','JAV 卡片版式',JAV_LAYOUTS,javLayout(),")
self.assertPageContains("{attr:'data-jav-layout',className:'javlayout'}")
@@ -11040,11 +10894,8 @@ class WebUiSourceTests(unittest.TestCase):
fill:black/stroke:none 画成黑块——深色底上等于看不见,`i-x` 这种纯开放
路径则整个消失(关闭按钮上「没有 x」就是这么来的)。
"""
- for rule in (
- ".photoback svg{width:15px;height:15px;stroke:currentColor;fill:none",
- ".media-circle svg{display:block;width:24px;height:24px;flex:none;stroke:currentColor;fill:none",
- ):
- self.assertPageContains(rule)
+ self.assertPageContains(
+ ".media-circle svg{display:block;width:24px;height:24px;flex:none;stroke:currentColor;fill:none")
def test_photo_navigation_reuses_one_overlay_button_treatment(self):
self.assertPageContains(
diff --git a/web/app.js b/web/app.js
index aa8479f33..23d0a8ddd 100644
--- a/web/app.js
+++ b/web/app.js
@@ -3742,8 +3742,7 @@ function applyFilterStateInPlace(filters){
const bar=$('#tagScroll');
if(bar)bar.querySelectorAll('.pill[data-tag]').forEach(b=>
b.setAttribute('aria-pressed',String(tagPressed(filters.tag,b.dataset.tag))));
- $('#index').querySelectorAll('[data-entity-tag]').forEach(b=>
- b.setAttribute('aria-pressed',String(tagPressed(filters.tag,b.dataset.entityTag))));
+ if(barsContext.type==='entity')pushEntityFilter({tags:entityFilterTags(filters)});
$('#drawer').querySelectorAll('.chip[data-key]').forEach(b=>
b.setAttribute('aria-pressed',String(String(filters[b.dataset.key]||'')
.split(',').filter(Boolean).includes(b.dataset.val))));
@@ -3832,27 +3831,24 @@ function viewGlideGeometry(pill,within='.board-filter-frame'){
}
return {host,x,w:pill.offsetWidth,y,h:pill.offsetHeight};
}
-/* 首页和资料页各有一排四选一,玻璃是同一块:在人眼里这两排就是同一个控件,「跟着指针
+/* 首页和关注页各有一排几选一,玻璃是同一块:在人眼里这几排就是同一个控件,「跟着指针
滑过去」没有理由只在其中一页成立。两边的 DOM 对不上——首页那排是 `#viewPills` 里的
- 链接,选中记在 `data-state` 上;资料页是 `.entityviews` 里的按钮,记在
- `data-entity-state` 上——所以按结构找,不按 id 找,这一页有哪一排就管哪一排。
- 判据是「此刻量得出宽度」,不是「存在」也不是自己那个 `hidden`:两排在同一份文档里
- 一直都在,资料页开着的时候首页那排只是被祖先收起来了,`hidden` 上看不出来。零宽度
- 把这一种连同 `display:none` 和资料页照片视图下那一排自己的 `hidden` 一起挡住——玻璃
- 留在一排收起来的按钮上,就是在一块空玻璃上亮着。
-
- 关注页那排状态是同一个控件的第三处:五枚里恒有一枚生效,选中记在 `data-follow-filter`
- 上。
-
- 资料页那条上有两排都在回答「你在哪儿」:左端那一档媒体类型,和四枚观看状态。它们
- 问的不是同一件事,所以各有一块玻璃——共用一块的话,点一下照片,玻璃从「没看过」那儿
- 飞过来,读出来是这两排在抢同一个当前项。 */
+ 链接,选中记在 `data-state` 上;关注页那排五枚里恒有一枚生效,选中记在
+ `data-follow-filter` 上——所以按结构找,不按 id 找,这一页有哪一排就管哪一排。
+ 判据是「此刻量得出宽度」,不是「存在」也不是自己那个 `hidden`:几排在同一份文档里
+ 一直都在,别的页面开着的时候首页那排只是被祖先收起来了,`hidden` 上看不出来。零宽度
+ 把这一种连同 `display:none` 一起挡住——玻璃留在一排收起来的按钮上,就是在一块空玻璃上亮着。
+ 资料页那两排是同一块料,由 `entity-filter` 岛自己挪(`use-view-glide.ts`)。
+
+ 关注页那条上有两排都在回答「你在哪儿」:左端那一档媒体类型,和五枚状态。它们问的不是
+ 同一件事,所以各有一块玻璃——共用一块的话,点一下图片,玻璃从状态那排飞过来,读出来是
+ 这两排在抢同一个当前项。 */
const GLIDE_ROWS={
- views:{selector:'#viewPills,.entityviews,.followviews',
- pressed:'[data-state][aria-pressed="true"],[data-entity-state][aria-pressed="true"],[data-follow-filter][aria-pressed="true"]'},
+ views:{selector:'#viewPills,.followviews',
+ pressed:'[data-state][aria-pressed="true"],[data-follow-filter][aria-pressed="true"]'},
/* 媒体那几枚是圆的,玻璃跟着它们的圆角走:一块 8px 圆角的方玻璃扣在一枚圆按钮上,
四个角先露出来,读起来是玻璃底下还垫着别的东西。 */
- media:{selector:'.entitymediaview,.followmediaview',pressed:'[data-media-view][aria-pressed="true"]',
+ media:{selector:'.followmediaview',pressed:'[data-media-view][aria-pressed="true"]',
className:'viewglide-round'},
/* 图片墙上「仅显示图片」那枚开关开着时垫的也是这块玻璃:它跟版式分段器一样答的是
「你在哪儿」,料就该是同一块,不另写一份材质。它只有一枚,玻璃只有出现和收起两态。
@@ -4323,14 +4319,22 @@ function toggleTag(t){commitContextFilter(filters=>{filters.tag=t?withTagToggled
清一次——绘制侧无条件画,清除侧就得在每个新入口补一遍,补漏一个就复发。 */
const catalogOnScreen=()=>$('#index').hidden&&$('#stats').hidden;
const COMBO_LABELS={creator:'创作者',studio:'厂牌',owner:'归属'};
+/* 生效的筛选一颗一颗列出来:先是创作者、厂牌与归属这几条整项的,再是叠加的标签。目录那条
+ 拼成 HTML,资料页那条(`entity-filter` 岛)直接拿这份清单画。 */
+function comboItems(filters){
+ const items=[];
+ if(filters.creator)items.push({kind:'clear',key:'creator',label:`${COMBO_LABELS.creator} ${filters.creator}`});
+ if(filters.studio)items.push({kind:'clear',key:'studio',label:`${COMBO_LABELS.studio} ${filters.studio}`});
+ if(filters.owner==='none')items.push({kind:'clear',key:'owner',label:`${COMBO_LABELS.owner} 未归属`});
+ tagList(filters.tag).forEach(t=>items.push({kind:'untag',key:t,label:tagLabel(t)}));
+ return items;
+}
function comboHtml(filters){
- const cur=tagList(filters.tag); const extra=[];
- if(filters.creator)extra.push(['creator',filters.creator]);
- if(filters.studio)extra.push(['studio',filters.studio]);
- if(filters.owner==='none')extra.push(['owner','未归属']);
- if(!cur.length&&!extra.length)return '';
- return extra.map(([k,v])=>`<span class="cb">${COMBO_LABELS[k]} ${esc(v)}<b data-clear="${k}">✕</b></span>`).join('')
- +cur.map(t=>`<span class="cb">${esc(tagLabel(t))} <b data-untag="${esc(t)}">✕</b></span>`).join('')
+ const items=comboItems(filters);
+ if(!items.length)return '';
+ return items.map(item=>item.kind==='clear'
+ ?`<span class="cb">${esc(item.label)}<b data-clear="${item.key}">✕</b></span>`
+ :`<span class="cb">${esc(item.label)} <b data-untag="${esc(item.key)}">✕</b></span>`).join('')
+`<button class="clr" type="button">全部清除</button>`;
}
function wireCombo(root){
@@ -4341,12 +4345,10 @@ function wireCombo(root){
if(clear)clear.onclick=()=>commitContextFilter(filters=>{
filters.tag='';filters.creator='';filters.studio='';filters.owner=''});
}
-/* 资料页有自己的一条,挂在这一页的标签条正上方,所指的是这一页的筛选;目录那条这时
- 跟目录一起被盖住。两条是同一样东西,拼法和落点都共用。 */
+/* 资料页有自己的一条,挂在这一页的玻璃浮层正上方,所指的是这一页的筛选;目录那条这时
+ 跟目录一起被盖住。两条是同一样东西,清单和落点都共用。 */
function renderCombo(){
- const entityCombo=$('#index').querySelector('.entitycombo');
- if(entityCombo&&barsContext.type==='entity'){
- entityCombo.innerHTML=comboHtml(barsContext.filters);wireCombo(entityCombo)}
+ if(barsContext.type==='entity')pushEntityFilter({combo:comboItems(barsContext.filters)});
if(!catalogOnScreen()){$('#combo').innerHTML='';return}
$('#combo').innerHTML=
comboHtml(state);
@@ -6337,65 +6339,59 @@ let entityGridRevision=0;
function releaseEntityGrid(){
$('#index').querySelectorAll('[data-entity-grid]').forEach(host=>{releaseHoverPreviews(host);unmountIsland(host)});
}
-function syncEntityFilterFrame(){
- const root=$('#index'),top=root.querySelector('.entitytagbar');
- const bottom=root.querySelector('.entitysection>.entitycollectionhead');
- if(!top||!bottom)return;
- mountFilterFrame(top,bottom,{views:top.querySelector('.entityviews'),
- tags:top.querySelector('.entitytags'),readout:bottom.querySelector('h3'),
- controls:bottom.querySelector('.sorts')});
- /* 玻璃的坐标基准是这块外框,所以要等框搭好才量得到位置。两排本身在框搭好之前就
- 接过了,那一次量到的是 null。 */
- syncViewGlide(false);
- scheduleStickySurfaces();
+/* 资料卡下面那一整块(交集条、两排玻璃浮层)归 React(`entity-filter`,ADR-0031 第 10d 步)。
+ 壳取数、岛只画:这一页的筛选、当前视图、排序与读数都经 `pushEntityFilter` 推过去,点下去的
+ 动作回壳。按下态在发请求之前就推,`aria-pressed` 与滑动玻璃当场到位,读数换成微光等这一趟。
+ 宿主 `[data-entity-filter]` 记在这里:换一页时先卸掉旧的那棵根,它在窗口上登记着重量玻璃的监听。 */
+let entityFilterHost=null,entityFilterTagRows=[],entityPhotoHeadNow=null;
+const entityFilterCurrent=()=>!!entityFilterHost?.isConnected&&islandMounted(entityFilterHost);
+function pushEntityFilter(patch){if(entityFilterCurrent())updateIsland(entityFilterHost,patch)}
+/* 标签按资料里的顺序摆,选中的不往前挪:刚点的那枚就在指针底下,这一下把它抽走反倒是替人
+ 决定现在该看哪儿。数的是这个人/厂牌名下带这个标签的视频。 */
+function entityFilterTags(filters){
+ return entityFilterTagRows.map(x=>({k:x.k,label:tagLabel(x.k),n:x.n,selected:tagPressed(filters.tag,x.k)}))}
+/* 排序键同首页那一排:箭头只画在选中那一枚上,无障碍名称播报的是点下去会得到什么。 */
+const entitySortKeys=filters=>sortOptions().map(([key,label])=>{
+ const current=filters.sort||'new',pressed=current===key,next=nextSortState(key,current,filters.dir);
+ return {key,label,pressed,dir:pressed&&sortDirWord(key,filters.dir)?(filters.dir==='asc'?'asc':'desc'):'',
+ ariaLabel:next?`按${label}${next.dir?sortDirWord(next.sort,next.dir):''}排序`:''}});
+const entityVideoHead=filters=>({sorts:entitySortKeys(filters),
+ jav:javActive()?{layout:javLayout(),options:JAV_LAYOUTS}:null});
+/* 这一页的写操作都回到壳里同一套落点:筛选走 `commitContextFilter`/`updateEntityCollection`,
+ 视图走 `switchEntityMedia`。筛选现读 `barsContext`,不捕获挂载那一刻的那一份。 */
+function entityFilterActions(kind,name,initial){
+ const live=()=>barsContext.type==='entity'&&barsContext.kind===kind&&barsContext.name===name
+ ?barsContext.filters:initial;
+ return {
+ setView:view=>void switchEntityMedia(kind,name,live(),view),
+ setState:value=>void updateEntityCollection(kind,name,{...live(),state:value},true),
+ toggleTag:tag=>toggleTag(tag),
+ clearFilter:key=>commitContextFilter(filters=>{filters[key]=''}),
+ clearAll:()=>commitContextFilter(filters=>{
+ filters.tag='';filters.creator='';filters.studio='';filters.owner=''}),
+ setSort:key=>{
+ const filters=live(),next=nextSortState(key,filters.sort||'new',filters.dir);
+ if(next)void updateEntityCollection(kind,name,{...filters,...next},true)},
+ reshuffle:()=>{
+ if(entityViewNow(kind)==='photos')return shufflePhotos(kind,name,live(),entityMediaView.set||0);
+ state.seed=rollSeed();return updateEntityCollection(kind,name,{...live(),sort:'seed'},true)},
+ setJavLayout:value=>{setJavLayout(value);pushEntityFilter({video:entityVideoHead(live())})},
+ setPhotoLayout:value=>{
+ appSettings.photoLayout=allowedSetting(value,['fixed','masonry'],'masonry');saveSettings();syncPhotoWalls();
+ if(entityPhotoHeadNow)pushEntityFilter({photo:entityPhotoHeadNow={...entityPhotoHeadNow,layout:photoLayout()}})},
+ photoBack:()=>showAllPhotos(kind,name,live()),
+ };
}
-function syncEntityStateControls(kind,name,filters){
- const controls=$('#index').querySelector('.entityviews');if(!controls)return;
- controls.hidden=entityViewNow(kind)!=='videos';
- const buttons=[...controls.querySelectorAll('[data-entity-state]')];
- buttons.forEach(button=>{
- button.setAttribute('aria-pressed',String(button.dataset.entityState===(filters.state||'')));
- /* 玻璃先滑过去,再去取数:这一下的结果要等一个请求,而按下去的反馈不该跟着等。 */
- button.onclick=()=>{
- buttons.forEach(other=>other.setAttribute('aria-pressed',String(other===button)));
- syncViewGlide(true,button);
- updateEntityCollection(kind,name,{...filters,state:button.dataset.entityState},true);
- };
- });
- wireViewGlideRow(controls,buttons);
-}
-/* 资料页作品集的表头与首页计数行同源:排序条由 filters 决定,`视频 · N` 由响应决定。 */
-const entityCollectionSortsHtml=filters=>sortControlsHtml({extra:javActive()?javLayoutButtons():'',items:sortOptions(),
- renderItem:([key,label])=>sortButtonHtml(key,label,filters.sort||'new',filters.dir,'data-entity-sort')});
-function wireEntityCollectionHead(section,kind,name,filters){
- wireJavLayoutButtons(section);
- section.querySelector('.entitybatch').onclick=()=>{
- state.seed=rollSeed();updateEntityCollection(kind,name,{...filters,sort:'seed'},true)};
- section.querySelectorAll('[data-entity-sort]').forEach(button=>button.onclick=()=>{
- const next=nextSortState(button.dataset.entitySort,filters.sort||'new',filters.dir);
- if(next)updateEntityCollection(kind,name,{...filters,...next},true)});
- /* 窄屏下这一整条自己横滚(board.css 的 760px 断点),跟首页那条 `#count` 是同一件事,
- 登记的也是同一套。390px 实测溢出 338px,不登记就是最后两枚排序键露半个在右边、
- 鼠标够不着。每次重画都要重登记:`.sorts` 是整块 outerHTML 换掉的。
- 两个调用点传进来的一个是这一条本身、一个是它外面的 `.entitysection`。 */
- wireDrag(section.closest('.entitycollectionhead')||section.querySelector('.entitycollectionhead'));
-}
-/* 换列和翻方向此刻就已确定,用不着等一次请求才在界面上生效:先把排序条重画成
- 最终样子,只让会变的 `视频 · N` 换成骨架。标题、标签条和已经铺好的网格不动。 */
-function markEntityCollectionBusy(kind,name,filters){
- const section=$('#index').querySelector('.entitysection');
- const head=$('#index').querySelector('.entitycollectionhead');
- if(!head)return;
- head.setAttribute('aria-busy','true');
- const focused=head.contains(document.activeElement)?document.activeElement.getAttribute('data-entity-sort'):null;
- head.querySelector('.sorts').outerHTML=entityCollectionSortsHtml(filters);
- if(focused)head.querySelector(`[data-entity-sort="${focused}"]`)?.focus({preventScroll:true});
- head.querySelector('h3').innerHTML='<span class="countskeleton"></span>';
- wireEntityCollectionHead(head,kind,name,filters);
- /* 名单已经不是刚才那一份了。把旧卡片留在屏幕上等新的回来,等的这一下人读到的是一份
- 跟头上的筛选对不上的列表——数字在转圈,底下那几十张却还是上一次的答案。 */
- const host=section.querySelector('[data-entity-grid]');
- if(host){releaseEntityGrid();host.innerHTML=catalogSkeletonHtml();fitSkeleton(section)}
+/* 浮层里仍由遗留层接的那几样:横向行的拖动与滚轮,图集那两枚源文件键(照片详情里复用的是
+ 同一对)。对账后整组数量都变了,重开这一组比逐格摘除简单也更不容易错。 */
+function entityFilterHelpers(kind,name,initial){
+ const live=()=>barsContext.type==='entity'?barsContext.filters:initial;
+ return {
+ wireDrag:row=>{if(row)wireDrag(row)},
+ wireScroller:row=>{if(row)wireHorizontalScroller(row)},
+ sourceToolsHtml:id=>sourceTools(id),
+ wireSourceTools:root=>wireSourceTools(root,()=>openPhotoSet(kind,name,live(),entityMediaView.set,false)),
+ };
}
/* 名册:事务所页是艺人,片商页是旗下 label。和对应的索引页摆的是同一格、同一套版式
设置,只是这批随资料页一起下来了,不再单独请求;读数写的是这一格有多少视频。 */
@@ -6404,25 +6400,24 @@ function renderEntityRoster(people){
releaseEntityGrid();
const cellKind=entityRosterKind;
const cells=cellKind==='studio'?'company':'people';
- section.innerHTML=`${collectionHeaderHtml({readout:(cellKind==='studio'?'厂牌':'艺人')+' · '+people.length.toLocaleString()})}
- <div class="igrid" data-cells="${cells}" data-layout="${peopleIndexLayout()}">${
+ section.innerHTML=`<div class="igrid" data-cells="${cells}" data-layout="${peopleIndexLayout()}">${
people.map(x=>personCellHtml(x,cellKind,x.n.toLocaleString())).join('')}</div>`;
section.querySelectorAll('[data-k]').forEach(button=>button.onclick=()=>
openEntity(cellKind,button.dataset.k));
- syncEntityFilterFrame();
+ pushEntityFilter({view:'people',busy:false,
+ readout:(cellKind==='studio'?'厂牌':'艺人')+' · '+people.length.toLocaleString()});
scheduleStickySurfaces();
}
function renderEntityCollection(kind,name,items,filters){
- // 资料页的标签同样可以叠加,表头把生效的几个都写出来。
+ // 资料页的标签同样可以叠加,读数把生效的几个都写出来。
const entityTags=tagList(filters.tag).map(tagLabel);
const section=$('#index').querySelector('.entitysection');if(!section)return;
releaseEntityGrid();
/* 宿主里先铺一份骨架:React 产物头一次装载要等一个来回,这期间不留一块空白。 */
- section.innerHTML=`${collectionHeaderHtml({controls:entityCollectionSortsHtml(filters)})}
- <div data-entity-grid>${catalogSkeletonHtml()}</div>`;
+ section.innerHTML=`<div data-entity-grid>${catalogSkeletonHtml()}</div>`;
section.dataset.total=String(items.total||0);
- section.querySelector('h3').textContent=`视频 · ${(items.total||0).toLocaleString()}${entityTags.length?' · '+entityTags.join(' · '):''}`;
- wireEntityCollectionHead(section,kind,name,filters);
+ pushEntityFilter({view:'videos',busy:false,video:entityVideoHead(filters),
+ readout:`视频 · ${(items.total||0).toLocaleString()}${entityTags.length?' · '+entityTags.join(' · '):''}`});
const host=section.querySelector('[data-entity-grid]');
mountIsland('catalog-grid',host,{
mode:'entity',entityKey:`${kind}:${name}`,revision:++entityGridRevision,initial:items,
@@ -6432,7 +6427,6 @@ function renderEntityCollection(kind,name,items,filters){
cache,wireDrag,skeletonHtml:()=>catalogSkeletonHtml(),groupCollapse:appSettings.groupCollapse,
canLoadMore:()=>!$('#index').hidden&&$('#stats').hidden,
},{isCurrent:()=>section.contains(host)}).catch(error=>console.error(error));
- syncEntityFilterFrame();
scheduleStickySurfaces();
}
async function updateEntityCollection(kind,name,filters,push=true){
@@ -6442,14 +6436,18 @@ async function updateEntityCollection(kind,name,filters,push=true){
const search=entityFilterSearch(filters);
if(push)route(entityPath(kind,name)+(search?'?'+search:''));
barsContext={type:'entity',kind,name,filters:{...filters}};
- syncEntityStateControls(kind,name,filters);
const seq=++entityRequestSeq;
- markEntityCollectionBusy(kind,name,filters);
+ /* 换列、翻方向、换观看状态和加减标签此刻就已确定,用不着等一次请求才在界面上生效:先把
+ 按下态推成最终样子,只让会变的 `视频 · N` 换成微光。 */
+ pushEntityFilter({view:'videos',busy:true,state:filters.state||'',video:entityVideoHead(filters),
+ tags:entityFilterTags(filters),combo:comboItems(filters)});
+ /* 名单已经不是刚才那一份了。把旧卡片留在屏幕上等新的回来,等的这一下人读到的是一份
+ 跟头上的筛选对不上的列表——数字在转圈,底下那几十张却还是上一次的答案。 */
+ const section=$('#index').querySelector('.entitysection');
+ const host=section?.querySelector('[data-entity-grid]');
+ if(host){releaseEntityGrid();host.innerHTML=catalogSkeletonHtml();fitSkeleton(section)}
const items=await fetchEntityItems(kind,name,filters);
if(seq!==entityRequestSeq)return;
- renderEntityMediaToggle(kind,name,filters);
- $('#index').querySelectorAll('[data-entity-tag]').forEach(b=>
- b.setAttribute('aria-pressed',String(tagPressed(filters.tag,b.dataset.entityTag))));
renderEntityCollection(kind,name,items,filters)
}
/* ── 资料页的照片 ─────────────────────────────────────────────────────────────
@@ -6482,45 +6480,21 @@ const photosAvailable=()=>photoTotalOf()>0||codeSetsOf().length>0;
function entityViewNow(kind){return (kind==='agency'||kind==='studio')&&entityRosterView==='people'&&entityRoster.length
?'people':(entityMediaView.media==='photos'?'photos':'videos')}
-function renderEntityMediaToggle(kind,name,filters){
- syncEntityStateControls(kind,name,filters);
- const controls=$('#index').querySelector('.entitymediaview');if(!controls)return;
- const now=entityViewNow(kind);
- const buttons=[...controls.querySelectorAll('[data-media-view]')];
- buttons.forEach(button=>{
- const media=button.dataset.mediaView;
- button.setAttribute('aria-pressed',String(now===media));
- /* 按下去那一下玻璃就滑过去,不等换视图的活干完:切到照片要取一次图墙,反馈跟着
- 等就是点完先僵一下再亮。`aria-pressed` 由这里当场改齐——`switchEntityMedia`
- 末尾会重画这一排再对一次,中间那段空档没人写它,玻璃会被下一次同步拽回原处。 */
- button.onclick=()=>{
- buttons.forEach(other=>other.setAttribute('aria-pressed',String(other===button)));
- syncViewGlide(true,button,'media');
- switchEntityMedia(kind,name,filters,media);
- };
- });
- wireViewGlideRow(controls,buttons,'media');
- /* 那排标签数的是视频,照片和名册上一个都对不上——「痴女 23」在这一屏指的是二十三个
- 视频,而屏幕上摆着的是照片。点下去也不留在这儿:标签是作品筛选,`toggleTag` 会把
- 视图拨回视频。一排点了就走人、数字又对不上当前内容的东西,摆在这儿只会让人以为
- 照片能这么筛。切回视频它们照旧在。 */
- $('#index').querySelector('.entitytagbar')?.toggleAttribute('data-media-only',now!=='videos');
-}
-
+/* 按下去那一下视图键就换过去,玻璃跟着滑,不等换视图的活干完:切到视频要取一次作品,
+ 反馈跟着等就是点完先僵一下再亮。等的这一下读数换成微光,排序键已经是视频那一排。 */
async function switchEntityMedia(kind,name,filters,media){
if(entityViewNow(kind)===media&&!entityMediaView.set)return;
entityRosterView=media==='people'?'people':'videos';
if(media==='people'){
entityMediaView=emptyMediaView();
routeEntityView(kind,name,entityMediaView);
- renderEntityMediaToggle(kind,name,filters);
renderEntityRoster(entityRoster);
return;
}
entityMediaView=media==='photos'?{media:'photos',set:0}:emptyMediaView();
routeEntityView(kind,name,entityMediaView);
- renderEntityMediaToggle(kind,name,filters);
if(media==='photos'){renderPhotoWall(kind,name,filters,entityPhotos);return}
+ pushEntityFilter({view:'videos',busy:true,video:entityVideoHead(filters)});
const seq=++entityRequestSeq;
const items=await fetchEntityItems(kind,name,filters);
if(seq!==entityRequestSeq)return;
@@ -6533,7 +6507,6 @@ async function openPhotoSet(kind,name,filters,setId,push=true){
if(seq!==entityRequestSeq||data.error)return;
entityMediaView={media:'photos',set:setId};
if(push)routeEntityView(kind,name,entityMediaView);
- renderEntityMediaToggle(kind,name,filters);
renderPhotoWall(kind,name,filters,data);
}
function showAllPhotos(kind,name,filters,push=true){
@@ -6548,19 +6521,16 @@ const codeSetItems=set=>Array.from({length:set.n},(_,i)=>({sample:true,code:set.
total:set.n,name:`${set.code} 样张 ${i+1}`,source:set.site_label||'官方样张'}));
/* 换一批:换一粒种子把这一屏重排一遍,整组照片或单个图集都是。翻页沿用回话里带回的
- 那一粒。等的这一下键上转圈,跟首页那枚一样;新的一面墙回来时整排连它一起重画。 */
-async function shufflePhotos(kind,name,filters,setId,button){
- if(button?.getAttribute('aria-busy')==='true')return;
- const seq=++entityRequestSeq,seed=encodeURIComponent(rollSeed()),old=button?.innerHTML;
- if(button){setActionBusy(button);button.innerHTML=spinnerHtml('正在换一批')}
- try{
- const data=await api(setId
- ?`/api/photo-set?id=${setId}&limit=120&seed=${seed}`
- :`/api/photos?kind=${encodeURIComponent(kind)}&name=${encodeURIComponent(name)}&limit=120&seed=${seed}`);
- if(seq!==entityRequestSeq||data.error)return;
- if(!setId)entityPhotos=data;
- renderPhotoWall(kind,name,filters,data);
- }finally{if(button?.isConnected){setActionBusy(button,false);button.innerHTML=old}}
+ 那一粒。等的这一下键上转圈,跟首页那枚一样:转圈归浮层那枚键自己,它等的就是这个
+ Promise 落定。 */
+async function shufflePhotos(kind,name,filters,setId){
+ const seq=++entityRequestSeq,seed=encodeURIComponent(rollSeed());
+ const data=await api(setId
+ ?`/api/photo-set?id=${setId}&limit=120&seed=${seed}`
+ :`/api/photos?kind=${encodeURIComponent(kind)}&name=${encodeURIComponent(name)}&limit=120&seed=${seed}`);
+ if(seq!==entityRequestSeq||data.error)return;
+ if(!setId)entityPhotos=data;
+ renderPhotoWall(kind,name,filters,data);
}
function photoSize(){
return allowedSetting(appSettings.photoSize,PHOTO_SIZES.map(([key])=>key),'small');
@@ -6622,18 +6592,14 @@ const photoReadout=(data,codeSets)=>'照片 · '+[
codeSets.length?`样张 ${(data.sample_total||0).toLocaleString()} 张 · ${codeSets.length} 部作品`:'']
.filter(Boolean).join(' · ');
-/* 照片这一栏跟视频那一栏是同一块浮层的下半,所以用同一个壳。换成别的容器的话,切一下
- 媒体类型,浮层的下半就整块消失——上半的下沿留着两个直角,底下接着页面底色。
-
- 壳一样,里面装的不一样:这一排不给排序键。排序读的是每条记录上的值,而账本里图片只
- 有文件名、体积和来源三样,视频那八个键有七个在这里没有对应的数。这一排只放三样:
- 张数、换一批、大小。换一批跟首页和视频那一排是同一枚键、同一个位置、同一个意思。
- 不点它时按文件名排:`001.jpg` 这类编号本来就是一套图的顺序。换一批只打散本地图片,
- 样张的顺序就是官方给的顺序,文件也不在本机。 */
-const photoHeadHtml=(data,{back=false,codeSets=[]}={})=>collectionHeaderHtml({className:'photohead',
- before:back?`<button class="photoback" type="button">${icon('chevron-left')}<span>全部照片</span></button>`:'',
- readout:back?`${esc(data.title)} · ${(data.total||0).toLocaleString()} 张`:photoReadout(data,codeSets),
- controls:sortControlsHtml({extra:photoControlsHtml()+(back?sourceTools(data.id):'')})});
+/* 照片这一栏跟视频那一栏是同一块浮层的下半(`entity-filter` 岛),这一排不给排序键:排序
+ 读的是每条记录上的值,而账本里图片只有文件名、体积和来源三样。这一排只放张数、换一批与
+ 图片布局,图集里再加那两枚源文件键。不点换一批时按文件名排:`001.jpg` 这类编号本来就是
+ 一套图的顺序。换一批只打散本地图片,样张的顺序就是官方给的顺序,文件也不在本机。 */
+const photoHead=(data,{back=false,codeSets=[]}={})=>({
+ readout:back?`${data.title} · ${(data.total||0).toLocaleString()} 张`:photoReadout(data,codeSets),
+ // 只有样张时没有本地图可换,换一批那枚键不出。
+ photo:{back,shuffle:!!data.total,layout:photoLayout(),layouts:PHOTO_LAYOUTS,setId:back?Number(data.id):0}});
/* 样张各段在前、本地图片那一面墙在后,翻页只数本地图片:样张一次铺完,不走分页。 */
const localPhotoCount=()=>photoWallItems.filter(item=>!item.sample).length;
function renderPhotoWall(kind,name,filters,data,append=false){
@@ -6650,21 +6616,13 @@ function renderPhotoWall(kind,name,filters,data,append=false){
// 只有本地图片时不出段头,墙和目录图集那一屏一样直接开始。
const localHead=codeSets.length&&data.total
?photoGroupHead('本地图片','',`${data.total.toLocaleString()} 张`):'';
- section.innerHTML=photoHeadHtml(data,{back:!entityWide,codeSets})+groups+localHead
+ section.innerHTML=groups+localHead
+`<div class="photowall" data-local-wall data-size="${photoSize()}"></div>
<button class="entitymore" type="button">载入更多</button>`;
- const head=section.querySelector('.photohead');
- wirePhotoControls(head);syncPhotoWalls();
- // 只有样张时没有本地图可换,换一批那枚键不出。
- if(data.total)head.querySelector('.entitybatch').onclick=event=>
- shufflePhotos(kind,name,filters,entityWide?0:data.id,event.currentTarget);
- else head.querySelector('.entitybatch').remove();
- if(!entityWide){
- head.querySelector('.photoback').onclick=()=>showAllPhotos(kind,name,filters);
- // 对账后整组数量都变了,重开这一组比逐格摘除简单也更不容易错。
- wireSourceTools(head,()=>openPhotoSet(kind,name,filters,data.id,false));
- }
- syncEntityFilterFrame();
+ syncPhotoWalls();
+ const head=photoHead(data,{back:!entityWide,codeSets});
+ entityPhotoHeadNow=head.photo;
+ pushEntityFilter({view:'photos',busy:false,...head});
}
const wall=section.querySelector('[data-local-wall]');
const start=photoWallItems.length;
@@ -7153,7 +7111,7 @@ async function openEntity(kind,name,push=true){
document.body.classList.add('entity-open');
$('#index').hidden=false;clearCatalogGrid();$('#count').textContent='';
$('#loadSentinel').hidden=true;
- const tags=(d.tags||[]).map(x=>filterChipHtml(tagLabel(x.k),{attr:'data-entity-tag',value:x.k,selected:tagPressed(filters.tag,x.k),count:x.n.toLocaleString()})).join('');
+ entityFilterTagRows=d.tags||[];
/* 事务所名下的这批人不摆在资料卡底那排小圆头像里:那是「同台艺人」,一条附注;名册是
这一页的正文,占的是下面那整块。所以同一份 `related_performers` 在事务所页走另一条路。
片商页的名册是旗下 label(`d.labels`),同台艺人那排照旧留在卡底。 */
@@ -7169,44 +7127,39 @@ async function openEntity(kind,name,push=true){
由粗到细:先定这一页现在摆的是哪一类东西,再定这一类里看哪一档,最后才是可加可
不加的筛选。夹在视图和标签中间时它读起来像标签那排的第一枚,而它换掉的是整页
内容,不是给当前这批加一条筛选。只有一类东西时不出这一组:一枚孤零零的键没有可切的对象。 */
- const mediaToggle=(photoCount||roster.length)?mediaViewButtonsHtml({
- active:entityViewNow(kind),
- peopleValue:roster.length?'people':'',peopleCount:roster.length,
- ...(kind==='studio'?{peopleLabel:'厂牌',peopleIcon:'clapperboard'}:{}),
- imageValue:photoCount?'photos':'',imageLabel:'照片',
- videoCount:d.asset_count,imageCount:photoCount,
- label:roster.length?'页面视图':'媒体类型',className:'entitymediaview'}):'';
+ const views=(photoCount||roster.length)?{label:roster.length?'页面视图':'媒体类型',
+ people:roster.length?{label:kind==='studio'?'厂牌':'艺人',count:roster.length,
+ icon:kind==='studio'?'clapperboard':'user-round'}:null,
+ videos:{count:d.asset_count||0},photos:photoCount?{count:photoCount}:null}:null;
+ entityPhotos=photos&&!photos.error?photos:null;
+ if(entityMediaView.media==='photos'&&!photosAvailable())entityMediaView=emptyMediaView();
$('#index').dataset.entityKind=kind;$('#index').dataset.entityName=name;
- /* 资料卡与新作那一行归 React(`entity-hero`):宿主排在最前,新作那一行的容器留在筛选条
- 和内容区之间,由岛接管。卡外面依次是交集条、玻璃筛选条、新作和内容区,顶到底一条线。
- 岛挂上之前宿主是空的:React 包已随取数预载好,挂载里剩下的都是微任务,换掉骨架与画出
- 资料卡落在同一帧。 */
+ /* 资料卡与新作那一行归 React(`entity-hero`),资料卡下面的交集条与玻璃浮层也是
+ (`entity-filter`)。卡外面依次是交集条、玻璃筛选条、新作和内容区,顶到底一条线;新作
+ 那一行的容器留在筛选条和内容区之间,由资料卡那座岛接管。两座岛挂上之前宿主都是空的:
+ React 包已随取数预载好,挂载里剩下的都是微任务,换掉骨架与画出整页落在同一帧。 */
+ if(entityFilterHost)unmountIsland(entityFilterHost);
$('#index').innerHTML=`<div data-entity-hero="${d.id?Number(d.id):''}"></div>
- <div class="combo entitycombo"></div>
- <section class="entitytagbar" aria-label="媒体与标签">${mediaToggle}${mediaToggle?'<span class="sep" aria-hidden="true"></span>':''}<div class="filterscroll"><div class="viewpills entityviews" role="group" aria-label="观看状态">${VIEW_PILLS.map(v=>`<button type="button" class="pill" data-entity-state="${v.k}" aria-pressed="${(filters.state||'')===v.k}">${v.label}</button>`).join('')}<span class="sep" aria-hidden="true"></span></div><div class="tagscroll entitytags">${tags}</div></div></section>
+ <div data-entity-filter></div>
<section class="feednew" data-feed-new aria-label="未入库的新作" hidden></section>
<div class="entitysection"></div>`;
const heroHost=$('#index').querySelector('[data-entity-hero]');
- entityHeroHost=heroHost;
- await mountIsland('entity-hero',heroHost,{kind,name,entity:d,feedNew:d.feedNew||null,
- feedHost:d.id?$('#index').querySelector('[data-feed-new]'):null,jav:entityJavLayout,
- actions:entityHeroActions(kind,name,d,heroHost),helpers:entityHeroHelpers(kind,d)},
- {isCurrent:()=>seq===entityRequestSeq&&heroHost.isConnected});
+ const filterHost=$('#index').querySelector('[data-entity-filter]');
+ entityHeroHost=heroHost;entityFilterHost=filterHost;entityPhotoHeadNow=null;
+ const onPage=host=>()=>seq===entityRequestSeq&&host.isConnected;
+ await Promise.all([
+ mountIsland('entity-hero',heroHost,{kind,name,entity:d,feedNew:d.feedNew||null,
+ feedHost:d.id?$('#index').querySelector('[data-feed-new]'):null,jav:entityJavLayout,
+ actions:entityHeroActions(kind,name,d,heroHost),helpers:entityHeroHelpers(kind,d)},
+ {isCurrent:onPage(heroHost)}),
+ /* 读数由下面那一格画完时推过来;深链直达一个图集时要先取这一组,读数先是微光。 */
+ mountIsland('entity-filter',filterHost,{kind,name,view:entityViewNow(kind),views,
+ state:filters.state||'',states:VIEW_PILLS,tags:entityFilterTags(filters),combo:comboItems(filters),
+ readout:'',busy:!!(entityMediaView.media==='photos'&&entityMediaView.set),
+ video:entityVideoHead(filters),photo:null,
+ actions:entityFilterActions(kind,name,filters),helpers:entityFilterHelpers(kind,name,filters)},
+ {isCurrent:onPage(filterHost)})]);
if(seq!==entityRequestSeq||!heroHost.isConnected)return;
- // 资料页的标签和顶部标签条是同一个开关,读的写的都是这一页的筛选。
- $('#index').querySelectorAll('[data-entity-tag]').forEach(b=>b.onclick=()=>
- toggleTag(b.dataset.entityTag));
- /* 标签那一格是 `overflow-x:auto` 加隐藏滚动条:能滚,但鼠标没有一个够得着的入口——滚轮
- 是竖向的,滚动条不画出来。全站横向行的那套拖动加滚轮映射就是为这个写的,登记上即可。 */
- wireDrag($('#index').querySelector('.entitytags'));
- /* 窄屏下滚的不是标签那一格而是它外面那层——四枚观看状态那时也跟着一起走。两层都
- 登记:登记在不滚的那一层上是空转,`wireHorizontalScroller` 量得出没有溢出就不接
- 滚轮,而少登记一层就会在某一个宽度上滚不动。 */
- wireHorizontalScroller($('#index').querySelector('.entitytags'));
- wireHorizontalScroller($('#index').querySelector('.entitytagbar .filterscroll'));
- entityPhotos=photos&&!photos.error?photos:null;
- if(entityMediaView.media==='photos'&&!photosAvailable())entityMediaView=emptyMediaView();
- renderEntityMediaToggle(kind,name,filters);
if(entityViewNow(kind)==='people')renderEntityRoster(roster);
else if(entityMediaView.media!=='photos')renderEntityCollection(kind,name,items,filters);
else if(entityMediaView.set)await openPhotoSet(kind,name,filters,entityMediaView.set,false);
@@ -7768,12 +7721,13 @@ function updateMobileFilterScroll(){
for(const frame of frames){
const free=frame===active&&mobileFilterScroll.free;
if(free)frame.style.setProperty('--filter-free-top',`${-frame.offsetHeight-12}px`);
- if(free===frame.classList.contains('mobile-filter-free'))continue;
+ /* 标记写成属性不写类:资料页那块浮层是 React 画的,className 归它管。 */
+ if(free===frame.hasAttribute('data-filter-free'))continue;
/* `top` 一步到位,再用 translate 从量到的起点滑到落点:逐帧改 `top` 每一帧都要重排,滚动中主线程一忙
就一顿一顿,translate 走合成线程。起点量的是连着上一段滑动的实际位置,半路反向也接得上。 */
const from=frame.getBoundingClientRect().top;
frame.getAnimations().forEach(a=>a.id==='filter-slide'&&a.cancel());
- frame.classList.toggle('mobile-filter-free',free);
+ frame.toggleAttribute('data-filter-free',free);
const shift=from-frame.getBoundingClientRect().top;
const [duration,easing]=getComputedStyle(document.documentElement).getPropertyValue('--board-motion').trim().split(' ');
if(Math.abs(shift)>=1&&parseFloat(duration)>0)
@@ -7782,7 +7736,7 @@ function updateMobileFilterScroll(){
}
function updateStickySurfaces(){
updateMobileFilterScroll();
- ['.board-filter-frame','#tagbar','#count','.entitytagbar','.entitycollectionhead'].forEach(selector=>{
+ ['.board-filter-frame','#tagbar','#count'].forEach(selector=>{
const el=$(selector),css=el&&getComputedStyle(el),top=css?parseFloat(css.top):NaN;
const stuck=!!el&&css.position==='sticky'&&el.offsetParent!==null&&window.scrollY>0&&
Number.isFinite(top)&&el.getBoundingClientRect().top-(parseFloat(css.translate.split(' ')[1])||0)<=top+1;
diff --git a/web/board.css b/web/board.css
index 6ee029634..0252f0261 100644
--- a/web/board.css
+++ b/web/board.css
@@ -168,7 +168,7 @@
/* 搜索框使用浏览器原生模糊,尺寸变化不依赖异步 SVG 位移贴图。 */
.top .search.search.search{--glass-optic:blur(22px)}
/* 快照里的玻璃使用实底承接光晕;实时页面恢复后再采样背景。 */
-html[data-theme-snapshot] :is(.board-filter-frame,.entitytagbar,.entitycollectionhead,.drawer,.edge,.search,.top>.ib,.board-library-menu,.board-glow-menu,.viewglide,.navglide,.settingscard>.board-local-nav,.selectiondock,.batchbar,[data-glass-pane]){backdrop-filter:none!important;-webkit-backdrop-filter:none!important;background-color:var(--ground)!important;transition:none!important}
+html[data-theme-snapshot] :is(.board-filter-frame,.entitytagbar,.entitycollectionhead,.drawer,.edge,.search,.top>.ib,.board-library-menu,.board-glow-menu,.viewglide,[data-view-glide],.navglide,.settingscard>.board-local-nav,.selectiondock,.batchbar,[data-glass-pane]){backdrop-filter:none!important;-webkit-backdrop-filter:none!important;background-color:var(--ground)!important;transition:none!important}
/* 快照撤掉那一下,材质要淡回来:揭示动画刚停,浮层从实底「啪」地跳成毛玻璃,读起来
像主题又切了第二次。过渡只写在常态上——进快照那一下正在拍旧状态的快照,拍到一半
路上的颜色就会闪,所以上面那条规则自己把过渡关掉。 */
@@ -182,16 +182,8 @@ html[data-theme-snapshot] :is(.board-filter-frame,.entitytagbar,.entitycollectio
width:auto;margin:0;min-width:0;z-index:auto;border:0;box-shadow:none;background:none;
backdrop-filter:none;-webkit-backdrop-filter:none;animation:none}
.board-filter-frame>[data-filter-row]::before,.board-filter-frame>[data-filter-row]::after{display:none}
-.board-filter-frame .entityviews{display:flex;flex:none;gap:6px}
-.board-filter-frame .entityviews[hidden]{display:none}
-/* 玻璃层只把这三格之间的间距收一档,不动它们谁滚谁不滚:整条一起滚的话左端那一档
- 也跟着走,而它正是这条筛选条上唯一离开就读不懂的东西。 */
+/* 资料页骨架那块浮层的上排:微光药丸之间的间距同真浮层上排。 */
.board-filter-frame .entitytagbar .filterscroll{gap:6px}
-.board-filter-frame .entityviews .pill{height:30px;padding:0 10px;font-size:13px;white-space:nowrap}
-/* 相接的复核横条由页面的单层玻璃承接;独立横条和骨架使用共享玻璃材质。 */
-.entitytagbar .pill,.entitycollectionhead h3{color:var(--glass-text)}
-.entitytagbar .pill[data-tag]:not([aria-pressed="true"]){border-color:var(--glass-low);border-style:dashed}
-.entitytagbar .pill[data-tag]:not([aria-pressed="true"]):hover{border-style:solid}
/* 标签后面那个数在这块玻璃上要自己降一档。flat 层那条降的是 --muted,而在这一层里
--muted 和 --ink-2 都映射到 --color-text-secondary,是同一个值——照搬过来,计数
和标签仍然一样亮。按这一排自己的文字色降档,口径跟未选中的视图胶囊那一档同源。
@@ -201,51 +193,13 @@ html[data-theme-snapshot] :is(.board-filter-frame,.entitytagbar,.entitycollectio
.board-filter-frame.board-filter-frame .pill:hover .n,
.board-filter-frame.board-filter-frame .pill[aria-pressed="true"] .n{
color:color-mix(in srgb,var(--glass-text) 80%,transparent)}
-/* 这块玻璃回答的是「你在哪儿」:侧栏的当前项、四枚视图里生效的那一枚、实体页正在看
- 的那一档媒体,都是位置。白填充垫底、在已经合成好的底子上再提一档亮度、整圈 rim
- 描边。铺一层墨色灰是另一种东西——它在亮内容上是块脏斑,浅色下又是整条里唯一发灰的
- 地方。 */
-.entitytagbar.entitytagbar .pill[aria-pressed="true"]{
- background:linear-gradient(180deg,var(--glass-sheen),transparent 62%),var(--glass-pick-fill);
- backdrop-filter:var(--glass-pick);-webkit-backdrop-filter:var(--glass-pick);
- color:var(--glass-text);border-color:transparent;
- box-shadow:inset 0 0 0 1px var(--glass-rim),var(--glass-pick-shadow)}
-/* 上面那条对四枚视图和左端那一档媒体类型都不适用:这两排的填充各由一块 `.viewglide`
- 滑过去的玻璃给,四枚视图那块跟首页是同一块。两边都铺的话,静止态是一块不透明的
- 填充压在玻璃上面,切换时也只看得见它瞬间换位置,滑动的那块从头到尾被盖在下面。
- 选中和悬停都只提字色。 */
-.entitytagbar.entitytagbar .pill[data-entity-state],
-.entitytagbar.entitytagbar .pill[data-entity-state]:hover,
-.entitytagbar.entitytagbar .pill[data-entity-state][aria-pressed="true"],
-.entitytagbar.entitytagbar .mediaviewbutton,
-.entitytagbar.entitytagbar .mediaviewbutton:hover,
-.entitytagbar.entitytagbar .mediaviewbutton[aria-pressed="true"]{
- border:0;background:none;backdrop-filter:none;-webkit-backdrop-filter:none;box-shadow:none}
-.entitytagbar.entitytagbar .pill[data-entity-state],
-.entitytagbar.entitytagbar .mediaviewbutton{color:color-mix(in srgb,var(--glass-text) 60%,transparent)}
-.entitytagbar.entitytagbar .pill[data-entity-state]:hover,
-.entitytagbar.entitytagbar .pill[data-entity-state][aria-pressed="true"],
-.entitytagbar.entitytagbar .mediaviewbutton:hover,
-.entitytagbar.entitytagbar .mediaviewbutton[aria-pressed="true"]{color:var(--glass-text)}
-/* 那几枚字形要压在玻璃上面,不然滑过去的时候被盖住一路暗过去——跟首页四枚视图同一条。 */
-.entitytagbar.entitytagbar .mediaviewbutton{position:relative;z-index:1}
-/* 照片视图下这条只剩左端那一组,后面没有东西可隔;分隔线留着就是一条指向空白的竖线。 */
-.entitytagbar[data-media-only] .sep{display:none}
/* 版式、大小这类分段开关问的也是「你在哪儿」。滑块的位置和几何归分段器自己管,这里
只换材质与配色:那一套是给 flat 面配的,一块灰底衬一枚不透明的白滑块,摆到浮层上
就是整条里唯一一块实心的面,读起来像贴上去的另一个控件;字色取的也是 flat 面的
--muted/--ink,跟旁边同一排的排序键差一档。壳撤掉,滑块换成选中态那块玻璃。 */
-.entitytagbar.entitytagbar .iconswitch[data-board-segments],
-.entitycollectionhead.entitycollectionhead .iconswitch[data-board-segments],
.board-filter-frame.board-filter-frame .iconswitch[data-board-segments]{background:none}
-.entitytagbar.entitytagbar .iconswitch>label,
-.entitycollectionhead.entitycollectionhead .iconswitch>label,
.board-filter-frame.board-filter-frame .iconswitch>label{
color:color-mix(in srgb,var(--glass-text) 62%,transparent)}
-.entitytagbar.entitytagbar .iconswitch>label:hover,
-.entitytagbar.entitytagbar .iconswitch>label:has(input:checked),
-.entitycollectionhead.entitycollectionhead .iconswitch>label:hover,
-.entitycollectionhead.entitycollectionhead .iconswitch>label:has(input:checked),
.board-filter-frame.board-filter-frame .iconswitch>label:hover,
.board-filter-frame.board-filter-frame .iconswitch>label:has(input:checked){color:var(--glass-text)}
/* 排序键回答的是「这一列按什么排」——一个参数的当前值,不是一个位置,所以不占那块
@@ -253,12 +207,9 @@ html[data-theme-snapshot] :is(.board-filter-frame,.entitytagbar,.entitycollectio
八九个候选都退到六成,生效的那枚回到满值再加半档字重。只差字重不够——一排等亮度的
字里,扫一眼看不出哪个粗一点。这一排里的「换一批」不在其中:它是动作不是参数,走下面
那条强调档,字色由它自己给。 */
-.entitycollectionhead.entitycollectionhead .sorts button:not(.batchaction),
.board-filter-frame.board-filter-frame .sorts button:not(.batchaction){
color:color-mix(in srgb,var(--glass-text) 62%,transparent)}
-.entitycollectionhead.entitycollectionhead .sorts button:not(.batchaction):hover,
.board-filter-frame.board-filter-frame .sorts button:not(.batchaction):hover{color:var(--glass-text)}
-.entitycollectionhead.entitycollectionhead .sorts button[aria-pressed="true"],
.board-filter-frame.board-filter-frame .sorts button[aria-pressed="true"]{
background:none;backdrop-filter:none;-webkit-backdrop-filter:none;
color:var(--glass-text);border-color:transparent;box-shadow:none;font-weight:500}
@@ -286,7 +237,8 @@ html[data-theme-snapshot] :is(.board-filter-frame,.entitytagbar,.entitycollectio
代价是描边和圆角跟着缩放变形——被拉长的那一瞬圆角扁一点、边细一点。这一下恰好就是
要的:一块软东西被拽着走,本来就该在跑的方向上抻开。
缩放的原点留在正中,两端一起外扩;位移写在 `translate` 属性上,不看这个原点。 */
-.viewglide.viewglide,.drawer.drawer>.navglide,.board-local-nav>.navglide{position:absolute;left:0;top:0;z-index:0;pointer-events:none;
+/* 资料页浮层那两块由 `entity-filter` 岛画成 `[data-view-glide]`,形状与材质同这一条。 */
+.viewglide.viewglide,[data-view-glide][data-view-glide],.drawer.drawer>.navglide,.board-local-nav>.navglide{position:absolute;left:0;top:0;z-index:0;pointer-events:none;
border-radius:8px;will-change:translate,scale;
/* 高光从上往下,不走那道 125° 对角线:对角线是按盒子自己的长边铺的,在一枚
三十来像素高的药丸上,转折点正好落在中间,静止看是左右两块拼起来的。 */
@@ -299,7 +251,7 @@ html[data-theme-snapshot] :is(.board-filter-frame,.entitytagbar,.entitycollectio
box-shadow:inset 0 0 0 1px var(--glass-rim),var(--glass-pick-shadow)}
.viewglide.viewglide[hidden],.drawer.drawer>.navglide[hidden],.board-local-nav>.navglide[hidden]{display:none}
/* 媒体那一档的按钮是正圆,这块跟着它走:方玻璃扣在圆按钮上,四个角先露出来。 */
-.viewglide.viewglide-round{border-radius:50%}
+.viewglide.viewglide-round,[data-view-glide="round"][data-view-glide]{border-radius:50%}
/* 侧栏那一列是竖排,圆角照按钮自己的 10px 走,不跟着那一排药丸的 8px。
它住在滚动容器外面、抽屉这块玻璃里面,`z-index:-1` 把它压回内容底下:抽屉自己带
`backdrop-filter`,那一层已经是个层叠上下文,负层号只会落到抽屉的面之上、那一列
@@ -319,7 +271,7 @@ html[data-theme-snapshot] :is(.board-filter-frame,.entitytagbar,.entitycollectio
/* 换一批和实体批量键走强调档:这一排其余的是排序开关,它们只是同一份列表的看法,
而这两枚是动作。面色取全站那两个 token,压上去跟每一颗主按钮一样提亮一档;圆角随这
一条上的按钮取 7px,不取强调档那副文字键的盒子。选中态归排序键,这两枚只有悬停。 */
-.board-filter-frame.board-filter-frame .sorts .batchaction,.entitycollectionhead.entitycollectionhead .sorts .batchaction{color:#fff;background:var(--board-blue);border:0;border-radius:7px;box-shadow:var(--elevation-xs)}
+.board-filter-frame.board-filter-frame .sorts .batchaction{color:#fff;background:var(--board-blue);border:0;border-radius:7px;box-shadow:var(--elevation-xs)}
.top.top,body.board-scrolled .top.top{background:transparent;box-shadow:none;backdrop-filter:none;border:0}
/* 顶栏这一条本身不铺任何底:玻璃是搜索框和右边那几个图标钮各自一块,它们中间的空处
直接通到内容。往那片空处垫一条压制带能让滚上来的字不那么碎,代价是整条顶栏成了一块
@@ -534,7 +486,7 @@ body :is(#manageTitle,#manageCrumb,#manageLede){max-width:var(--board-content);w
8px 还被 `.combo` 的下边距吃掉,加起来 32px,下面却只有 20px,同一块浮层上下差出 12px。
上面这 22px 改不动(两处都是别的页面共用的),所以自己不再加,下面照同一个数写。 */
.board-filter-frame{position:sticky;top:calc(var(--topH) + 8px);z-index:60;border:0;border-radius:16px;background:var(--ground);margin:0 0 22px;box-shadow:0 2px 14px light-dark(#00000014,#00000066)}
-@media(max-width:760px){.board-filter-frame.board-filter-frame.mobile-filter-free{top:var(--filter-free-top)}}
+@media(max-width:760px){.board-filter-frame.board-filter-frame[data-filter-free]{top:var(--filter-free-top)}}
/* 首页那块住在 `body` 底下,两侧没有任何东西给它留白,22px 的圆角直接切在屏幕边沿上;
资料页那块在 `#index` 里,`main` 的 16px 已经把它让开了。这里补的就是那 16px,取的
也是 `main` 自己的那个数,所以两页的浮层和底下的网格对在同一条竖线上。 */
@@ -549,20 +501,10 @@ body>.board-filter-frame{margin-inline:16px}
它自己就是整块,回到顶栏下 8px。 */
:root{--board-filterH:48px}
.entitytagbar{position:sticky;top:calc(var(--topH) + 8px);margin:0;height:var(--board-filterH);gap:6px;padding:8px 12px}
-.entitytagbar .entitytags{gap:6px}
-.entitytagbar .mediaviewbuttons .mediaviewbutton{flex:0 0 30px;width:30px;height:30px}
+/* 资料页骨架里那块浮层的下排:读数一格,几何同真浮层下排。 */
.entitycollectionhead{position:sticky;top:calc(var(--topH) + 8px);margin:0 0 22px;padding:8px 12px;min-height:var(--board-filterH);gap:12px}
-.entitycollectionhead.is-stuck::after{content:'';position:absolute;inset:0;z-index:-1;border-radius:inherit;
- box-shadow:0 0 24px 4px #00000038,0 8px 20px #00000026;pointer-events:none}
-/* 两行合成一块时,吸顶那一档影由整块玻璃自己换成 --glass-lift,这一层不再叠。 */
-/* 读数照首页那条 `10,471 个符合` 写:12px、常规字重、不加字距,颜色比标签低一档。
- 排序键也跟那边同一套——30px 高、12px 字、7px 圆角,选中态那块玻璃在上面统一给。 */
+/* 读数照首页那条 `10,471 个符合` 写:12px、常规字重、不加字距,颜色比标签低一档。 */
.entitycollectionhead h3{font-size:12px;font-weight:400;letter-spacing:normal;color:var(--ink-2)}
-/* 返回键在这块玻璃上,那圈线和字色都得跟着玻璃取,不然是浮层里唯一一处用 flat 面
- 配色的东西;高度跟同一排的排序键对齐。 */
-.entitycollectionhead .photoback{height:30px;border-color:var(--glass-low);color:var(--glass-text)}
-.entitycollectionhead .sorts{gap:4px}
-.entitycollectionhead .sorts button{height:30px;min-height:30px;font-size:12px;padding:0 8px;border:0;border-radius:7px;background:transparent}
/* 浮层下半在手机上仍是一横条:读数在左,控件跟在右边,装不下就整条往右滚。让读数
和控件各占一行的话,这块玻璃要吃掉三行高度——上半那排标签本来就是横滚的,同一块
玻璃上一半横滚、一半换行,读起来是两个不同的东西。滚动开在这一条自己身上而不是
@@ -574,8 +516,8 @@ body>.board-filter-frame{margin-inline:16px}
overflow-x:auto;overflow-y:hidden;scrollbar-width:none;
overscroll-behavior-inline:contain;touch-action:pan-x pan-y}
.board-filter-frame .count::-webkit-scrollbar,.entitycollectionhead::-webkit-scrollbar{display:none}
- .board-filter-frame .count>.mono,.entitycollectionhead>h3,.entitycollectionhead>.photoback{flex:none;white-space:nowrap}
- .board-filter-frame .count .sorts,.entitycollectionhead .sorts{flex:none;width:max-content;max-width:none;min-width:0;
+ .board-filter-frame .count>.mono,.entitycollectionhead>h3{flex:none;white-space:nowrap}
+ .board-filter-frame .count .sorts{flex:none;width:max-content;max-width:none;min-width:0;
margin-left:auto;overflow:visible;padding:0;margin-block:0}}
[data-overflow-right="true"]{mask-image:linear-gradient(to right,#000 calc(100% - 18px),transparent)}
[data-overflow-left="true"]{mask-image:linear-gradient(to right,transparent,#000 18px)}
@@ -616,11 +558,6 @@ body>.board-filter-frame{margin-inline:16px}
筛选条上不换一套。 */
.board-filter-frame.board-filter-frame .followfilters .pill[class*="r34-"][aria-pressed="true"]{
border-color:color-mix(in srgb,var(--r34-tag) 72%,transparent);background:color-mix(in srgb,var(--r34-tag) 22%,transparent)}
-/* 资料页的标签跟首页筛选条上的标签是同一个控件,只是换了个位置:那边 30px 高、13px
- 字,这边还留着 40px 高的大药丸,同一个人的标签在两页上大一圈小一圈。
- 计数跟着缩到 Caption。 */
-.entitytags .pill{height:30px;padding:0 10px;font-size:13px;line-height:20px;border-radius:var(--tag-radius);border:1px solid var(--glass-low);color:var(--glass-text)}
-.entitytags .pill small{margin-left:5px;font:var(--board-caption)}
.board-filter-frame .count{padding:8px 12px;min-height:46px;gap:12px}
.board-filter-frame .sorts{gap:4px}.board-filter-frame .sorts button{height:30px;min-height:30px;font-size:12px;padding:0 8px;border:0;border-radius:7px;background:transparent}
/* 关注页上排最左那两枚是视频/图片,跟资料页那一组同形:自己不铺底,选中那一枚的填充
@@ -1026,7 +963,7 @@ html.board-high-contrast .settingscard.settingscard>.board-local-nav{background:
.sidecontent .obtn svg{width:20px;height:20px;color:#ff669d}
.sidecontent .obtn b{font-size:12px;line-height:18px;padding:1px 6px;border-radius:5px;background:var(--picked);font-weight:500}
.sidecontent .obtn:hover{background:var(--hover)}
-.board-filter-frame.board-filter-frame .sorts .batchaction:hover,.entitycollectionhead.entitycollectionhead .sorts .batchaction:hover{background:var(--board-blue-hover);color:#fff}
+.board-filter-frame.board-filter-frame .sorts .batchaction:hover{background:var(--board-blue-hover);color:#fff}
.board-job-progress{display:flex;align-items:center;gap:12px;padding:12px 0;font-size:14px;line-height:20px}
.board-job-progress svg{flex:none}.board-job-progress circle{fill:none;stroke-width:2.5;stroke-linecap:round}
.board-job-track{stroke:var(--line-soft)}.board-job-fill{stroke:var(--tungsten);transition:stroke-dasharray .3s ease-out}
@@ -1366,26 +1303,16 @@ html.board-high-contrast :is(.selectiondock,.batchbar,.card .badge,[data-glass-p
(30px),滑块就是整枚选项:轨道不留内边距,选项 30px 见方、图标 16px,圆角跟那块滑动
玻璃同一个 8px。轨道留 3px 的话滑块比旁边那块玻璃矮一圈、圆角也小一档,同一块料在
同一排里出现两种尺寸。筛选行与排序行上下留白都是 8px,排序滚动容器不再自己多垫。 */
-.board-filter-frame.board-filter-frame .iconswitch[data-board-segments],
-.entitytagbar.entitytagbar .iconswitch[data-board-segments],
-.entitycollectionhead.entitycollectionhead .iconswitch[data-board-segments]{padding:0;border-radius:8px;gap:2px}
-.board-filter-frame.board-filter-frame .iconswitch[data-board-segments]>label,
-.entitytagbar.entitytagbar .iconswitch[data-board-segments]>label,
-.entitycollectionhead.entitycollectionhead .iconswitch[data-board-segments]>label{height:30px;min-height:30px;width:30px;padding:0;border-radius:8px}
-.board-filter-frame.board-filter-frame .iconswitch[data-board-segments] svg,
-.entitytagbar.entitytagbar .iconswitch[data-board-segments] svg,
-.entitycollectionhead.entitycollectionhead .iconswitch[data-board-segments] svg{width:16px;height:16px}
-.board-filter-frame.board-filter-frame .iconswitch[data-board-segments]>.board-segment-thumb,
-.entitytagbar.entitytagbar .iconswitch[data-board-segments]>.board-segment-thumb,
-.entitycollectionhead.entitycollectionhead .iconswitch[data-board-segments]>.board-segment-thumb{border-radius:8px}
+.board-filter-frame.board-filter-frame .iconswitch[data-board-segments]{padding:0;border-radius:8px;gap:2px}
+.board-filter-frame.board-filter-frame .iconswitch[data-board-segments]>label{height:30px;min-height:30px;width:30px;padding:0;border-radius:8px}
+.board-filter-frame.board-filter-frame .iconswitch[data-board-segments] svg{width:16px;height:16px}
+.board-filter-frame.board-filter-frame .iconswitch[data-board-segments]>.board-segment-thumb{border-radius:8px}
/* 这一组是横滚容器,会把里面东西的落影从上下两边裁掉——版式分段器的滑块和「仅显示图片」
那块玻璃最远那层影落在 14px 外,贴着容器边就只剩一条平切的底。上下各留出这 14px 再
用负外边距收回,排在行里还是 30px 高,影和聚焦环都露得出来。 */
-.count .sorts,.entitycollectionhead .sorts{padding:14px 2px;margin-block:-14px}
+.count .sorts{padding:14px 2px;margin-block:-14px}
/* 浮层上的滑块。深色那两条按主题给的填充和影写在上面,特指度到 0-5-0,所以这里也得
数够——`[data-board-segments]` 那一节的几何照旧,换掉的只有材质。 */
-.entitytagbar.entitytagbar.entitytagbar .iconswitch[data-board-segments]>.board-segment-thumb,
-.entitycollectionhead.entitycollectionhead.entitycollectionhead .iconswitch[data-board-segments]>.board-segment-thumb,
.board-filter-frame.board-filter-frame.board-filter-frame .iconswitch[data-board-segments]>.board-segment-thumb{
background:linear-gradient(180deg,var(--glass-sheen),transparent 62%),var(--glass-pick-fill);
backdrop-filter:var(--glass-pick);-webkit-backdrop-filter:var(--glass-pick);
diff --git a/web/css/07-entity.css b/web/css/07-entity.css
index 3f9b142b5..14b94646d 100644
--- a/web/css/07-entity.css
+++ b/web/css/07-entity.css
@@ -51,19 +51,10 @@
.entitytagbar{position:sticky;top:var(--topH);z-index:61;display:flex;align-items:center;
height:var(--filterH);margin:0 -16px;padding:9px 16px;background:transparent;
border-bottom:1px solid transparent}
-/* 这一格在筛选条里就是首页那条的标签区,横滚、滚动条和窄屏让位都归 `.tagscroll`。
- 这里只补一件这一页独有的事:标签不折行,装不下的滑出去。`.entitytags` 这个类名
- 在骨架里单独用到,所以它自己那份摆法留着。 */
-.entitytagbar .entitytags{flex-wrap:nowrap}
-.entitytags{display:flex;align-items:center;flex-wrap:wrap;gap:7px}.entitytags .pill{flex:none}
-/* 这条是横向滚动行,里面每一项都得拒绝被压扁——挤瘪的开关点不准,也读不出图标。 */
-.entitytags .iconswitch{flex:none}
-.entitytags small{color:var(--muted);margin-left:4px}
-/* 那排标签数的是视频。看照片或名册时它们一个都对不上屏幕上摆着的东西,点下去还会把
- 视图拨回视频,所以那两档只留媒体开关。切回视频它们照旧在。 */
-.entitytagbar[data-media-only] .entitytags .pill{display:none}
-/* 交集条列的也是作品筛选,照片视图下同样不成立。 */
-.entitycombo:has(+.board-filter-frame .entitytagbar[data-media-only]){display:none}
+/* 资料卡下面的交集条与玻璃浮层是 `entity-filter` 岛。宿主和 React 根那一层都不生成盒子:
+ 浮层吸顶的范围是它父元素的盒子,只裹着它自己的父元素一格都走不动;两层让开,父元素就是
+ `#index`。 */
+[data-entity-filter],[data-entity-filter]>.peach-react{display:contents}
.mediaviewbuttons{display:inline-flex;align-items:center;gap:2px;flex:none}
.mediaviewbuttons .mediaviewbutton{display:grid;place-items:center;flex:0 0 var(--filterItemH);width:var(--filterItemH);height:var(--filterItemH);padding:0;
border:0;border-radius:50%;background:transparent;color:var(--muted);cursor:pointer}
@@ -79,9 +70,4 @@
.entitycollectionhead{position:sticky;top:var(--topH);z-index:60;display:flex;align-items:center;gap:10px;
min-height:var(--sortH);margin:0 -16px 12px;padding:8px 16px;min-width:0;
background:transparent;border-bottom:1px solid transparent}
-.entitycollectionhead h3{margin:0;flex:0 0 auto}.entitycollectionhead .javlayout{display:inline-flex;gap:2px}
-/* 照片这一栏的抬头就是 `.entitycollectionhead`,横向排布、间距和吸顶都归那一条管;
- `.photohead` 只是个记号,给这一屏特有的返回键认门;换一批那枚键跟视频那一排共用
- `.entitybatch`。 */
-.photoback{display:flex;align-items:center;gap:4px;height:28px;padding:0 10px 0 6px;border:1px solid var(--line);
- border-radius:var(--control-radius);background:transparent;color:var(--ink-2);font-size:var(--fs-xs);cursor:pointer}
+.entitycollectionhead h3{margin:0;flex:0 0 auto}
diff --git a/web/css/08-photos.css b/web/css/08-photos.css
index dbce8d5ef..6ed3df8fd 100644
--- a/web/css/08-photos.css
+++ b/web/css/08-photos.css
@@ -1,7 +1,3 @@
-/* 图标是 Lucide 的描边路径,`stroke:currentColor;fill:none` 少一样就会被浏览器
- 按默认的 fill:black/stroke:none 画成黑块——深色底上等于看不见。 */
-.photoback svg{width:15px;height:15px;stroke:currentColor;fill:none;stroke-width:2}
-.photoback:hover{background:var(--overlay-5);color:var(--ink)}
/* 固定比例视图使用方框和 cover;瀑布流、响应式列数与关注图片墙共用 21-online.css。
两种视图在缩略图懒加载前都有非零高度,灯箱使用全图。 */
.photowall{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px}
@@ -21,10 +17,10 @@
官方样张最常见的横幅比例撑住那块 `--sunk` 底。 */
[data-layout="masonry"]>.photocell:not(:has(img)){aspect-ratio:3/2}
/* 照片档按作品分段的段头:番号、标题、右端「来源 样张 · 发行日 · 张数」一行排开,标题
- 过长省略,右端不让。第一段紧贴抬头,之后每段上方留出段距,看得出是新的一部。 */
+ 过长省略,右端不让。每段上方留出段距,看得出是新的一部;第一段的段距与上面那块筛选浮层
+ 的下边距合并,不叠加。 */
.photogroup{display:flex;align-items:baseline;gap:10px;min-width:0;margin:28px 2px 10px;
font-size:var(--fs-sm);color:var(--muted)}
-.photohead+.photogroup{margin-top:4px}
.photogroup>b{flex:none;color:var(--ink);font-size:var(--fs-md)}
.photogrouptitle{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.photogroupmeta{flex:none;margin-left:auto}
diff --git a/web/css/09-skeleton.css b/web/css/09-skeleton.css
index f80f52cb9..24377bfe6 100644
--- a/web/css/09-skeleton.css
+++ b/web/css/09-skeleton.css
@@ -189,10 +189,9 @@ body.refreshing #tiers .av .ring.imgdone::after{opacity:1;filter:none;visibility
/* 计数骨架的宽高定死:跟着真实文本走的话,数字回来那一刻整行会横向弹一下。
14px 远低于筛选条按钮的 32px,而 `.count` 有 min-height 兜底,所以换成真数字
- 不改变行高。`视频 · N` 用的是同一枚。 */
+ 不改变行高。 */
.countskeleton{display:inline-block;width:150px;height:14px;border-radius:var(--control-radius);
background:var(--hover)}
-.entitycollectionhead h3 .countskeleton{width:96px}
/* 索引页这一枚等的是「118 项」,四五个字。150px 是照筛选条那句长读数定的,摆到
标题右边就是一条明显长过答案的灰条,看着像还有一整句没回来。 */
.index .ihead .countskeleton{width:54px}
diff --git a/web/css/12-cards.css b/web/css/12-cards.css
index 994edd394..9bd1127e3 100644
--- a/web/css/12-cards.css
+++ b/web/css/12-cards.css
@@ -41,10 +41,10 @@ main{position:relative;z-index:1;padding:14px 16px 90px}
.count.count-actions-only:empty{display:none}
.resourcesync{scroll-margin-top:calc(var(--topH) + 18px);display:grid;gap:16px}.resourcesync>h2{margin:0;font-size:var(--fs-xl)}
.resourcesyncbox{overflow:clip;border:1px solid var(--field-ring);border-radius:var(--floating-radius);background:var(--ground)}.resourcesyncbody{padding:20px}.resourcesyncbody p{max-width:760px;margin:0;color:var(--muted);font-size:var(--fs-sm);line-height:1.55}.resourcesyncfooter{box-sizing:border-box;min-height:var(--fieldset-bar-h);display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:12px 20px;border-top:1px solid var(--line-soft);background:var(--overlay-5)}.resourcesyncfooter p{margin:0;color:var(--muted);font-size:var(--fs-xs);line-height:1.5}.resourceaction{box-sizing:border-box;height:36px;padding:0 12px;border:0;border-radius:var(--control-radius);box-shadow:0 0 0 1px var(--line-soft);background:var(--ground);color:var(--ink-2);display:inline-flex;align-items:center;justify-content:center;gap:8px;flex:none;font:inherit;font-size:var(--fs-sm);font-weight:500;cursor:pointer;transition:background-color .12s,color .12s}.resourceaction:hover:not(:disabled){background:color-mix(in srgb,var(--ink) 8%,var(--ground));color:var(--ink)}.resourceaction:focus-visible{outline:2px solid var(--tungsten);outline-offset:2px}.resourceaction:disabled{background:var(--sunk);color:var(--muted);cursor:not-allowed}.resourceaction svg{width:16px;height:16px;stroke:currentColor;fill:none}
-.tagbar,.count,.entitytagbar,.entitycollectionhead{transition:background-color .16s ease,border-color .16s ease}
+.tagbar,.count{transition:background-color .16s ease,border-color .16s ease}
/* 吸顶那条是底色的半透明版,配方跟着 --ground 走:写死深色底会在浅色主题下
变成一条黑带压在白底内容上。 */
-.tagbar.is-stuck,.count.is-stuck,.entitytagbar.is-stuck,.entitycollectionhead.is-stuck{background:color-mix(in srgb,var(--ground) 84%,transparent);
+.tagbar.is-stuck,.count.is-stuck{background:color-mix(in srgb,var(--ground) 84%,transparent);
border-bottom-color:var(--line-soft);backdrop-filter:saturate(1.35) blur(16px);
-webkit-backdrop-filter:saturate(1.35) blur(16px)}
.count:empty{display:none}
@@ -67,8 +67,7 @@ main{position:relative;z-index:1;padding:14px 16px 90px}
animation:peach-strand-draw var(--strand-cycle,0s) linear infinite}
#i-shuffle .strand-b{animation-name:peach-strand-draw-late}
.count[aria-busy="true"] :is(#batchAction,#followShuffle) svg,
-body.refreshing #batchAction svg,
-.entitycollectionhead[aria-busy="true"] .entitybatch svg{
+body.refreshing #batchAction svg{
--strand-dash:100;--strand-cycle:2.2s}
/* 资源同步的「检查文件」键适配自己的忙态,不统一转圈:git-compare 照 lucide-animated 的
GitCompare 逐笔描画(右下圆→两条枝→左上圆,画完停住再一起淡出)。
@@ -92,26 +91,26 @@ body.refreshing #batchAction svg,
#i-git-compare .gc-line-a,#i-git-compare .gc-line-b{animation-name:var(--gc-anim-b,none)}
#i-git-compare .gc-end-b{animation-name:var(--gc-anim-c,none)}
[data-resource-scan][aria-busy="true"] svg{--gc-dash:100;--gc-anim:peach-gc-draw-a;--gc-anim-b:peach-gc-draw-b;--gc-anim-c:peach-gc-draw-c}
-.count .sorts,.entitycollectionhead .sorts{display:flex;gap:5px;margin-left:auto;flex-wrap:nowrap;
+.count .sorts{display:flex;gap:5px;margin-left:auto;flex-wrap:nowrap;
overflow-x:auto;scrollbar-width:none;min-width:0}
-.count .sorts::-webkit-scrollbar,.entitycollectionhead .sorts::-webkit-scrollbar{display:none}
-.count .sorts button,.entitycollectionhead .sorts button{min-height:32px;padding:0 11px;display:inline-flex;align-items:center;
+.count .sorts::-webkit-scrollbar{display:none}
+.count .sorts button{min-height:32px;padding:0 11px;display:inline-flex;align-items:center;
border:1px solid var(--border-15);border-radius:var(--control-radius);
background:transparent;cursor:pointer;font-size:var(--fs-xs);color:var(--muted);
flex:0 0 auto;white-space:nowrap}
-.count .sorts button:hover,.entitycollectionhead .sorts button:hover{color:var(--ink)}
-.count .sorts button[aria-pressed="true"],.entitycollectionhead .sorts button[aria-pressed="true"]{background:var(--picked);color:var(--ink)}
+.count .sorts button:hover{color:var(--ink)}
+.count .sorts button[aria-pressed="true"]{background:var(--picked);color:var(--ink)}
/* 方向箭头只画在选中的那一枚里,跟着它的文字色走。自带 class 而不是选 `button>svg`:
同一排里的批量键是 36px 方形图标键,那条规则会给它的图标也加上左边距。 */
.sortdir{width:14px;height:14px;flex:none;margin-left:5px;stroke:currentColor;fill:none;stroke-width:2;
stroke-linecap:round;stroke-linejoin:round}
/* 这一排里的批量键是强调档,面色连同悬停归 `board.css` 一处:那一层按这条工具带的形状
重排过它们,在这里再写一份,算出来生效的仍是那一层。 */
-/* 形状按类写,不按 id:这一排在首页、资料页和关注页各有一枚同样的换一批键,挂在 id 上
+/* 形状按类写,不按 id:这一排在首页和关注页各有一枚同样的换一批键,挂在 id 上
的话每多一页就要在这里补一个选择器,而漏掉的那一页不是报错——是图标算出 0×0,
按钮变成一块纯色方块。 */
-.count .sorts .batchaction,.entitycollectionhead .sorts .batchaction{font-weight:600;width:36px;padding:0;display:inline-grid;place-items:center}
-.count .sorts .batchaction svg,.entitycollectionhead .sorts .batchaction svg{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:2}
+.count .sorts .batchaction{font-weight:600;width:36px;padding:0;display:inline-grid;place-items:center}
+.count .sorts .batchaction svg{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:2}
/* 「仅显示图片」是一枚 30px 见方的图标开关,跟旁边版式分段器的每一枚选项同一副身量;
开着时垫的玻璃由筛选条那块滑动玻璃给(GLIDE_ROWS.imagesonly),这里只管形状。那块
玻璃挂在这枚键自己身上,键是它的定位基准,字形要压在它上面,跟媒体那几枚圆键同一条。 */
diff --git a/web/css/15-detail.css b/web/css/15-detail.css
index 08b1e13cf..71fbd8986 100644
--- a/web/css/15-detail.css
+++ b/web/css/15-detail.css
@@ -30,11 +30,6 @@
.detailtitletools:not(:has(button:not([hidden]))){display:none}
.detailtitlestate{display:block;margin:-4px 0 10px}
.detailtitlestate:empty{display:none}
-/* 来源那两个键跟大小、刷新排在同一组里,靠 `.sorts` 自己的 `margin-left:auto` 一起推到
- 右边;再给它加一次 auto 会把它从那组里推开,中间空出一截。下边距同理,这一排是横着的。
- `.srcstate` 默认独占一整行,而这一排不换行,占满行等于把它右边的东西挤到看不见。 */
-.photohead .srctools{margin:0}
-.photohead .srcstate{flex:none}
.smeta{display:flex;gap:9px;flex-wrap:wrap;color:var(--muted);margin-bottom:18px}
.detailmetaitem{display:inline-flex;align-items:center;gap:5px}.detailmetaitem svg{width:15px;height:15px;
flex:none;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}