Skip to content

Spot it. Save it. Free, local-first Chrome extension for images, videos and prompts. Explore 2,000+ curated cases and connect your library to AI Agents via MCP. 提示词导演

Unify PromptDirector visual library experience and release packaging

MigenAI647f39233106
diff --git a/README.md b/README.md
index 31b868d..49730d1 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,6 @@
-# PromptDirector|视觉创作资料库
+# PromptDirector|视觉创作灵感库
+
+提示词导演,你的视觉创作私人灵感库。
PromptDirector 是一个免费、开源、本地优先的 Chrome 扩展。它把网页文字、图片、视频和文档保存为可检索的创作资料,在下一次图片、视频、广告或分镜创作时快速找回和复用。
diff --git a/_locales/en/messages.json b/_locales/en/messages.json
index d1417fb..1ed7f9e 100644
--- a/_locales/en/messages.json
+++ b/_locales/en/messages.json
@@ -1,7 +1,7 @@
{
- "extensionName": { "message": "PromptDirector — Visual Creative Archive" },
- "extensionDescription": { "message": "Save web visuals with their prompts, then organize, back up, share, and reuse them in a local visual archive." },
- "actionTitle": { "message": "Visual Prompt Archive: capture and create" },
+ "extensionName": { "message": "PromptDirector" },
+ "extensionDescription": { "message": "PromptDirector, your private visual inspiration library. Save web visuals and prompts; organize, back up, and reuse them locally." },
+ "actionTitle": { "message": "PromptDirector: capture and create" },
"saveSelectionCommand": { "message": "Add highlighted text to the current capture draft" },
"menuSaveSelectionToPromptDirector": { "message": "Save selection to PromptDirector" },
"menuSmartVisualsToPromptDirector": { "message": "Smart-select with PromptDirector" },
diff --git a/_locales/zh_CN/messages.json b/_locales/zh_CN/messages.json
index b095727..7ae6098 100644
--- a/_locales/zh_CN/messages.json
+++ b/_locales/zh_CN/messages.json
@@ -1,7 +1,7 @@
{
- "extensionName": { "message": "提示词导演 - 视觉创作资料库" },
- "extensionDescription": { "message": "收藏网页画面与提示词,在本地视觉案例库中检索、整理、备份和分享创作灵感。" },
- "actionTitle": { "message": "提示词导演:收藏与创作提示词" },
+ "extensionName": { "message": "PromptDirector" },
+ "extensionDescription": { "message": "提示词导演,你的视觉创作私人灵感库。收藏网页画面与提示词,在本地检索、整理、备份和复用创作灵感。" },
+ "actionTitle": { "message": "提示词导演:采集与视觉创作" },
"saveSelectionCommand": { "message": "把当前高亮文字加入采集草稿" },
"menuSaveSelectionToPromptDirector": { "message": "保存高亮到 PromptDirector" },
"menuSmartVisualsToPromptDirector": { "message": "用 PromptDirector 智能选图" },
diff --git a/background.js b/background.js
index d210aac..ce9073d 100644
--- a/background.js
+++ b/background.js
@@ -157,6 +157,7 @@ import {
cancelLibraryMaintenance,
completeLibraryMaintenanceItem,
createLibraryMaintenanceJob,
+ extendLibraryMaintenanceJob,
libraryMaintenanceSummary,
mergeLibraryMaintenanceProgress,
nextLibraryMaintenanceItem,
@@ -984,15 +985,16 @@ async function captureWorkspace() {
text: part.text, title: part.sourceTitle, url: part.sourceUrl, visuals: part.visuals
}, state.classificationRules, state.taxonomy);
const id = classification?.pathIds?.[0] || "";
- const name = state.taxonomy.nodes.find((item) => item.id === id)?.name || "待确认";
- return [part.sourceUrl || "source:unknown", { id, name }];
+ const contentType = state.taxonomy.nodes.find((item) => item.id === id);
+ const name = contentType?.name || "待确认";
+ return [part.sourceUrl || "source:unknown", { id, name, customized: contentType?.customized === true }];
}));
return {
ok: true,
draft,
targetEntry,
suggestedContentTypeId: suggested?.pathIds?.[0] || "",
- contentTypes: state.taxonomy.nodes.map((item) => ({ id: item.id, name: item.name })),
+ contentTypes: state.taxonomy.nodes.map((item) => ({ id: item.id, name: item.name, customized: item.customized === true })),
collections: state.organizerState.collections.map((item) => ({ id: item.id, name: item.name })),
partContentTypes,
activeCreativeResult: state.activeCreativeResult,
@@ -2115,6 +2117,7 @@ async function createMediaCase(assetValue, posterValue, titleValue, textValue =
[STORAGE_KEYS.entries]: entries,
[STORAGE_KEYS.lastSaveUndo]: createEntrySaveUndo(entry.id)
});
+ await enqueueAutomaticLibraryMaintenance([entry]);
await notifySaved(entries.length);
if (assetValue?.kind === "image") await queueAutomaticVisionAnalysis([entry.id]);
return { ok: true, message: "资料已保存", entry };
@@ -3479,6 +3482,7 @@ async function importStagedItem(job, item) {
[STORAGE_KEYS.importJobs]: finished.state,
[STORAGE_KEYS.importStaging]: removed.state
});
+ await enqueueAutomaticLibraryMaintenance([entry]);
await notifySaved(entries.length);
await queueImportJobAnalysis(finished.job);
}
@@ -5761,6 +5765,20 @@ async function startLibraryMaintenance() {
};
}
+async function enqueueAutomaticLibraryMaintenance(entriesValue) {
+ const [derivedMetadata, stored] = await Promise.all([
+ getAllDerivedMetadata(),
+ chrome.storage.local.get(STORAGE_KEYS.libraryMaintenanceJob)
+ ]);
+ const targets = libraryMaintenanceTargets(entriesValue, derivedMetadata);
+ if (!targets.classificationEntryIds.length && !targets.paletteAssetIds.length) return null;
+ const job = extendLibraryMaintenanceJob(stored[STORAGE_KEYS.libraryMaintenanceJob], targets);
+ await commitLocalChanges({ [STORAGE_KEYS.libraryMaintenanceJob]: job });
+ await ensureLibraryMaintenanceAlarm(job.status === "running");
+ if (job.status === "running") scheduleLibraryMaintenanceRunner();
+ return libraryMaintenanceSummary(job);
+}
+
async function libraryMaintenanceStatus() {
const stored = await chrome.storage.local.get(STORAGE_KEYS.libraryMaintenanceJob);
return { ok: true, maintenanceJob: libraryMaintenanceSummary(stored[STORAGE_KEYS.libraryMaintenanceJob]) };
@@ -6366,6 +6384,10 @@ async function applyLibraryImport(state, message) {
[STORAGE_KEYS.creativeSkills]: normalizeCreativeSkillsState(result.state.creativeSkills ?? state.creativeSkills)
});
const importedEntryIds = Object.values(result.entryIdMap);
+ if (importedEntryIds.length) {
+ const importedEntryIdSet = new Set(importedEntryIds);
+ await enqueueAutomaticLibraryMaintenance(result.state.entries.filter((entry) => importedEntryIdSet.has(entry.id)));
+ }
if (importedEntryIds.length) await queueAutomaticVisionAnalysis(importedEntryIds);
return {
ok: true,
@@ -6413,6 +6435,10 @@ async function applyCuratedImport(state, message) {
[STORAGE_KEYS.creativeRuns]: normalizeCreativeRuns(result.state.creativeRuns ?? state.creativeRuns),
[STORAGE_KEYS.creativeSkills]: normalizeCreativeSkillsState(result.state.creativeSkills ?? state.creativeSkills)
});
+ if (result.importedEntryIds.length) {
+ const importedEntryIdSet = new Set(result.importedEntryIds);
+ await enqueueAutomaticLibraryMaintenance(result.state.entries.filter((entry) => importedEntryIdSet.has(entry.id)));
+ }
if (result.importedEntryIds.length) await queueAutomaticVisionAnalysis(result.importedEntryIds);
return curatedImportResponse(result);
}
diff --git a/collector.css b/collector.css
index 402eb3c..9199517 100644
--- a/collector.css
+++ b/collector.css
@@ -20,14 +20,14 @@ main {
.brand { display: flex; align-items: center; gap: 9px; }
.brand img { width: 34px; height: 34px; }
-.brand p {
+.brand .product-brand-name {
margin: 0;
color: var(--ink);
font-size: 13px;
font-weight: 780;
letter-spacing: 0;
}
-.brand h1 { margin: 1px 0 0; color: var(--muted); font-size: 10px; font-weight: 550; }
+.brand .product-brand-tagline { margin: 1px 0 0; color: var(--muted); font-size: 10px; font-weight: 550; }
.library-entry {
display: flex;
@@ -101,7 +101,7 @@ main {
background: transparent;
font-size: 11px;
}
-.switch-task:hover { color: var(--accent); }
+.switch-task:hover { color: var(--accent-ink); }
.start-copy { max-width: 340px; text-align: center; margin: 0 auto; }
.start-copy h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.start-copy p { margin: 7px 0 0; color: var(--muted); }
@@ -130,21 +130,31 @@ main {
border: 0;
background: transparent;
}
+.normal-start .capture-actions { grid-template-columns: minmax(0, 1fr); }
+.normal-start .capture-actions > button {
+ min-height: 58px;
+ justify-content: flex-start;
+ padding: 12px 16px;
+ text-align: left;
+}
+.normal-start .capture-actions > button .ui-icon { width: 20px; height: 20px; }
.page-capture { display: grid; gap: 12px; border: 1px solid var(--line); border-radius: var(--ui-container-radius); padding: 14px; background: var(--card); }
.page-capture > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-capture h2 { margin: 2px 0 0; font-size: 16px; }
.page-capture small, .page-capture > p { color: var(--muted); font-size: 11px; }
.page-capture > p { margin: 0; line-height: 1.5; }
-.page-capture .page-capture-session-note { padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: var(--paper); }
+.page-capture-tools { border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
+.page-capture-tools > summary { padding: 9px 10px; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 800; }
.page-capture-bulk-actions { display: flex; flex-wrap: wrap; gap: 6px; }
+.page-capture-tools .page-capture-bulk-actions { padding: 0 9px 9px; }
.page-capture-bulk-actions button { width: auto; }
.page-capture-list-setup, .page-capture-list-result { border: 1px solid var(--line); border-radius: 6px; padding: 9px; background: var(--paper); }
.page-capture-list-setup summary { cursor: pointer; font-size: 12px; font-weight: 800; }
.page-capture-list-setup > p, .page-capture-list-result > p { margin: 7px 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.page-capture-list-setup label, .page-capture-list-result label { display: grid; gap: 5px; margin: 8px 0; color: var(--muted); font-size: 11px; }
.page-capture-list-setup input, .page-capture-list-result input, .page-capture-list-result select { width: 100%; }
-.page-capture-list { display: grid; max-height: min(56vh, 560px); overflow: auto; gap: 8px; }
+.page-capture-list { display: grid; gap: 8px; }
.page-capture-item { display: grid; gap: 9px; border: 1px solid var(--line); border-radius: 6px; padding: 10px; background: var(--paper); }
.page-capture-item.confirmed { border-color: var(--selection-edge); box-shadow: inset 3px 0 var(--selection-indicator); }
.page-capture-item.structure-review { border-style: dashed; border-color: var(--warning, #b98a2e); }
@@ -155,7 +165,7 @@ main {
.page-capture-component:hover { border-color: var(--line-strong); }
.page-capture-text-section { display: grid; gap: 6px; }
.page-capture-text-section > header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 0 2px; }
-.page-capture-text-list { display: grid; max-height: 260px; overflow: auto; gap: 6px; }
+.page-capture-text-list { display: grid; gap: 6px; }
.page-capture-text { grid-template-columns: minmax(0, 1fr); cursor: default; }
.page-capture-text > span { display: grid; min-width: 0; gap: 3px; }
.page-capture-text p { display: -webkit-box; margin: 2px 0 0; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
@@ -173,8 +183,7 @@ main {
.page-capture-media-review { display: grid; gap: 9px; border: 1px solid var(--selection-edge); border-radius: 6px; padding: 10px; background: var(--paper); }
.page-capture-media-review[hidden] { display: none; }
.page-capture-media-review > header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
-.page-capture-media-review > p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
-.page-capture-media-review-list { display: grid; max-height: 240px; overflow: auto; gap: 6px; }
+.page-capture-media-review-list { display: grid; gap: 6px; }
.page-capture-media-review-item { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 5px; padding: 6px; }
.page-capture-media-review-item.media-excluded { opacity: .55; }
.page-capture-media-review-preview { display: grid; width: 72px; height: 54px; overflow: hidden; place-items: center; border: 0; border-radius: 4px; padding: 0; background: var(--raised); }
@@ -195,16 +204,19 @@ main {
.page-capture-media-viewer > footer { display: grid; grid-template-columns: 1fr 1fr; }
.page-capture-media-stage { display: grid; min-height: 280px; max-height: 72vh; margin-top: 10px; overflow: hidden; place-items: center; border-radius: 7px; background: #090a0b; }
.page-capture-media-stage img, .page-capture-media-stage video { display: block; max-width: 100%; max-height: 72vh; object-fit: contain; }
-.page-capture-article { display: grid; max-height: 420px; overflow: auto; gap: 10px; border: 1px solid var(--line); border-radius: 6px; padding: 12px; background: var(--card); }
+.page-capture-preview-details { border: 1px solid var(--line); border-radius: 6px; background: var(--card); }
+.page-capture-preview-details > summary { padding: 9px 10px; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 800; }
+.page-capture-preview-details .page-capture-article { border-top: 1px solid var(--line); }
+.page-capture-article { display: grid; gap: 10px; padding: 12px; }
.page-capture-article > header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.page-capture-article h1, .page-capture-article h2, .page-capture-article h3, .page-capture-article h4, .page-capture-article h5, .page-capture-article h6 { margin: 4px 0 0; white-space: normal; }
.page-capture-article p, .page-capture-article blockquote, .page-capture-article pre { margin: 0; color: var(--ink); font-size: 11px; line-height: 1.6; white-space: pre-wrap; }
.page-capture-article blockquote { border-left: 3px solid var(--line-strong); padding-left: 9px; color: var(--muted); }
-.page-capture-article pre { overflow: auto; border-radius: 5px; padding: 8px; background: var(--raised); }
+.page-capture-article pre { overflow-wrap: anywhere; border-radius: 5px; padding: 8px; background: var(--raised); }
.page-capture-article-media { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 9px; width: 100%; color: inherit; text-align: left; }
.page-capture-article-media .page-capture-media-preview { width: 96px; height: 72px; }
.page-capture-article-resource { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 5px; padding: 9px; color: inherit; background: var(--paper); text-align: left; }
-.page-capture-article-resource > span:first-child { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 5px; color: var(--accent); background: var(--accent-soft); font-size: 10px; font-weight: 850; }
+.page-capture-article-resource > span:first-child { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 5px; color: var(--accent-ink); background: var(--accent-soft); font-size: 10px; font-weight: 850; }
.capture-actions .other-capture-methods > button {
width: 100%;
height: 30px;
@@ -265,7 +277,7 @@ main {
height: 38px;
place-items: center;
border-radius: 10px;
- color: var(--accent);
+ color: var(--accent-ink);
background: var(--accent-soft);
font-size: 13px;
}
@@ -389,7 +401,7 @@ main {
background: transparent;
font-size: 11px;
}
-.organize-toggle:hover { color: var(--accent); }
+.organize-toggle:hover { color: var(--accent-ink); }
.organizer {
display: grid;
diff --git a/collector.html b/collector.html
index 79d7fc6..9a8c68d 100644
--- a/collector.html
+++ b/collector.html
@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
- <title>提示词导演采集台</title>
+ <title data-i18n="提示词导演采集台">提示词导演采集台</title>
<script src="theme-bootstrap.js"></script>
<link rel="stylesheet" href="ui-foundation.css" />
<link rel="stylesheet" href="collector.css" />
@@ -11,7 +11,7 @@
<body>
<main>
<header class="collector-header">
- <div class="brand"><img src="assets/icons/icon-source.svg" alt="" /><div><p>PromptDirector</p><h1>采集灵感</h1></div></div>
+ <div class="brand product-brand"><img class="product-brand-mark" src="assets/icons/icon-source.svg" alt="" /><div class="product-brand-copy"><p class="product-brand-name">PromptDirector</p><h1 class="product-brand-tagline" data-i18n="视觉创作灵感库">视觉创作灵感库</h1></div></div>
</header>
<button id="open-library" class="library-entry" type="button">
@@ -20,36 +20,28 @@
</button>
<section id="target-banner" class="target-banner" hidden>
- <div><small>目标案例</small><strong id="target-label"></strong></div>
- <button id="exit-target" class="quiet compact" type="button">退出</button>
+ <div><small data-i18n="目标案例">目标案例</small><strong id="target-label"></strong></div>
+ <button id="exit-target" class="quiet compact" type="button" data-i18n="退出">退出</button>
</section>
<dialog id="capture-permission-onboarding" class="app-dialog" aria-labelledby="capture-permission-title">
<form id="capture-permission-form" class="app-dialog-form" method="dialog">
<header>
<div>
- <h2 id="capture-permission-title">一次说明,之后直接采集</h2>
- <p>只在你主动选择采集方式时使用这些能力;授权完成后会继续刚才的操作,不会自动保存案例。</p>
+ <h2 id="capture-permission-title" data-i18n="一次授权,之后直接采集">一次授权,之后直接采集</h2>
+ <p data-i18n="本次统一开启网页读取与截图能力,只在你主动采集时使用;不会自动保存案例。">本次统一开启网页读取与截图能力,只在你主动采集时使用;不会自动保存案例。</p>
</div>
</header>
<div class="app-dialog-body">
- <div>
- <strong>网页采集</strong>
- <p>读取你主动采集的普通网页内容,用于智能选图、文字提取和整页采集。</p>
- </div>
- <div>
- <strong>截图</strong>
- <p>只在你点击智能选图或框选截图后,读取当前网页的可见画面。</p>
- </div>
<label class="app-dialog-check">
<input id="capture-permission-clipboard" type="checkbox" checked />
- <span><strong>剪贴板读取(默认开启,可取消)</strong><br /><small>仅当你点击“提取文字/图片”且网页没有可提取的高亮时读取;打开侧栏、点击网页或高亮文字都不会读取剪贴板。</small></span>
+ <span><strong data-i18n="同时开启剪贴板提取">同时开启剪贴板提取</strong><br /><small data-i18n="可取消;仅在你主动点击“提取文字/图片”且网页没有高亮内容时读取。">可取消;仅在你主动点击“提取文字/图片”且网页没有高亮内容时读取。</small></span>
</label>
<p id="capture-permission-status" class="app-dialog-status" role="status" aria-live="polite"></p>
</div>
<footer>
- <button id="capture-permission-cancel" class="button-secondary" type="button">暂不授权</button>
- <button id="capture-permission-confirm" class="primary" type="submit">授权并继续</button>
+ <button id="capture-permission-cancel" class="button-secondary" type="button" data-i18n="暂不授权">暂不授权</button>
+ <button id="capture-permission-confirm" class="primary" type="submit" data-i18n="授权并继续">授权并继续</button>
</footer>
</form>
</dialog>
@@ -58,17 +50,17 @@
<form id="clipboard-permission-form" class="app-dialog-form" method="dialog">
<header>
<div>
- <h2 id="clipboard-permission-title">启用剪贴板提取?</h2>
- <p>你首次授权时取消了剪贴板读取。只有确认此操作后,才会读取当前剪贴板中的文字或图片。</p>
+ <h2 id="clipboard-permission-title" data-i18n="启用剪贴板提取?">启用剪贴板提取?</h2>
+ <p data-i18n="你首次授权时取消了剪贴板读取。只有确认此操作后,才会读取当前剪贴板中的文字或图片。">你首次授权时取消了剪贴板读取。只有确认此操作后,才会读取当前剪贴板中的文字或图片。</p>
</div>
</header>
<div class="app-dialog-body">
- <p>启用后仍只会在你主动点击“提取文字/图片”且网页没有可用高亮时读取;打开侧栏、浏览或点击网页不会触发读取。</p>
+ <p data-i18n="启用后仍只会在你主动点击“提取文字/图片”且网页没有可用高亮时读取;打开侧栏、浏览或点击网页不会触发读取。">启用后仍只会在你主动点击“提取文字/图片”且网页没有可用高亮时读取;打开侧栏、浏览或点击网页不会触发读取。</p>
<p id="clipboard-permission-status" class="app-dialog-status" role="status" aria-live="polite"></p>
</div>
<footer>
- <button id="clipboard-permission-cancel" class="button-secondary" type="button">保持关闭</button>
- <button id="clipboard-permission-confirm" class="primary" type="submit">启用并提取</button>
+ <button id="clipboard-permission-cancel" class="button-secondary" type="button" data-i18n="保持关闭">保持关闭</button>
+ <button id="clipboard-permission-confirm" class="primary" type="submit" data-i18n="启用并提取">启用并提取</button>
</footer>
</form>
</dialog>
@@ -86,10 +78,10 @@
<button id="save-other-inspiration" class="switch-task" type="button" data-i18n="保存其他灵感">保存其他灵感</button>
</div>
<div id="normal-start" class="normal-start">
- <div class="capture-actions" aria-label="从当前网页采集">
+ <div class="capture-actions" aria-label="从当前网页采集" data-i18n-aria-label="从当前网页采集">
<button id="start-smart-visuals" class="primary smart-visuals" type="button"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-image"></use></svg><strong data-i18n="智能选图">智能选图</strong></button>
<button id="start-selection" class="direct-selection" type="button"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-file-text"></use></svg><strong data-i18n="提取文字/图片">提取文字/图片</strong></button>
- <button id="start-page-capture" type="button"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-library"></use></svg><strong>网页采集</strong></button>
+ <button id="start-page-capture" type="button"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-library"></use></svg><strong data-i18n="网页采集">网页采集</strong></button>
<div id="other-capture-methods" class="other-capture-methods">
<button id="start-screenshot" class="button-secondary" type="button"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-maximize-2"></use></svg><strong data-i18n="框选截图">框选截图</strong></button>
</div>
@@ -99,137 +91,138 @@
<section id="page-capture" class="page-capture" hidden aria-live="polite">
<header>
- <div><small>网页采集预检</small><h2 id="page-capture-title">已识别 0 个主体方案</h2></div>
- <button id="page-capture-scan" class="button-secondary compact" type="button">扫描整页</button>
+ <div><small data-i18n="网页采集">网页采集</small><h2 id="page-capture-title" data-i18n="选择要保存的内容">选择要保存的内容</h2></div>
+ <button id="page-capture-scan" class="button-secondary compact" type="button" data-i18n="重新扫描">重新扫描</button>
</header>
- <p id="page-capture-help">先查看并修正网页区域,再确认一个创作主体。确认后会按原始顺序保存完整文章和相关资源。</p>
- <p class="page-capture-session-note" data-i18n="公开原图失败时,只会使用当前网页已有登录状态读取已确认主体内的相关媒体;不会读取或保存登录信息。">公开原图失败时,只会使用当前网页已有登录状态读取已确认主体内的相关媒体;不会读取或保存登录信息。</p>
- <div class="page-capture-bulk-actions" aria-label="主体区域确认">
- <button id="page-capture-clear" class="button-secondary compact" type="button">取消主体确认</button>
- <button id="page-capture-add-region" class="button-secondary compact" type="button">添加遗漏区域</button>
- <button id="page-capture-exclude-region" class="button-secondary compact" type="button">排除错误区域</button>
- <button id="page-capture-undo-region" class="button-secondary compact" type="button">撤销修正</button>
- <button id="page-capture-reset-region" class="button-secondary compact" type="button">恢复自动识别</button>
- </div>
+ <p id="page-capture-help" data-i18n="确认一个主体后即可保存;需要时再展开预览或修正识别结果。">确认一个主体后即可保存;需要时再展开预览或修正识别结果。</p>
+ <details class="page-capture-tools">
+ <summary data-i18n="修正识别结果">修正识别结果</summary>
+ <div class="page-capture-bulk-actions" aria-label="主体区域确认" data-i18n-aria-label="主体区域确认">
+ <button id="page-capture-clear" class="button-secondary compact" type="button" data-i18n="取消确认">取消确认</button>
+ <button id="page-capture-add-region" class="button-secondary compact" type="button" data-i18n="添加遗漏">添加遗漏</button>
+ <button id="page-capture-exclude-region" class="button-secondary compact" type="button" data-i18n="排除错误">排除错误</button>
+ <button id="page-capture-undo-region" class="button-secondary compact" type="button" data-i18n="撤销">撤销</button>
+ <button id="page-capture-reset-region" class="button-secondary compact" type="button" data-i18n="恢复识别">恢复识别</button>
+ </div>
+ </details>
<details id="page-capture-list-setup" class="page-capture-list-setup">
- <summary>同一列表批量采集</summary>
- <p>先确认上方一个代表案例,再输入目标数量。只滚动、加载当前列表或沿列表翻页,不进入详情页。</p>
- <label><span>目标案例数</span><input id="page-capture-target-count" type="number" min="1" inputmode="numeric" placeholder="请输入数量" /></label>
- <button id="page-capture-list-run" class="primary" type="button">按这个样本继续采集</button>
+ <summary data-i18n="同一列表批量采集">同一列表批量采集</summary>
+ <p data-i18n="先确认上方一个代表案例,再输入目标数量。只滚动、加载当前列表或沿列表翻页,不进入详情页。">先确认上方一个代表案例,再输入目标数量。只滚动、加载当前列表或沿列表翻页,不进入详情页。</p>
+ <label><span data-i18n="目标案例数">目标案例数</span><input id="page-capture-target-count" type="number" min="1" inputmode="numeric" placeholder="请输入数量" data-i18n-placeholder="请输入数量" /></label>
+ <button id="page-capture-list-run" class="primary" type="button" data-i18n="按这个样本继续采集">按这个样本继续采集</button>
</details>
<section id="page-capture-list-result" class="page-capture-list-result" hidden>
- <strong>批量保存方式</strong>
+ <strong data-i18n="批量保存方式">批量保存方式</strong>
<p id="page-capture-list-summary"></p>
- <label><span>保存形态</span><select id="page-capture-save-mode"><option value="">请选择</option><option value="multiple">分别保存多个案例</option><option value="combined">合并为一个案例</option></select></label>
- <label id="page-capture-combined-title-row" hidden><span>合并案例标题</span><input id="page-capture-combined-title" autocomplete="off" placeholder="默认使用列表页标题" /></label>
+ <label><span data-i18n="保存形态">保存形态</span><select id="page-capture-save-mode"><option value="" data-i18n="请选择">请选择</option><option value="multiple" data-i18n="分别保存多个案例">分别保存多个案例</option><option value="combined" data-i18n="合并为一个案例">合并为一个案例</option></select></label>
+ <label id="page-capture-combined-title-row" hidden><span data-i18n="合并案例标题">合并案例标题</span><input id="page-capture-combined-title" autocomplete="off" placeholder="默认使用列表页标题" data-i18n-placeholder="默认使用列表页标题" /></label>
</section>
<div id="page-capture-list" class="page-capture-list"></div>
<section id="page-capture-media-review" class="page-capture-media-review" hidden>
- <header><strong>检查本次保存的媒体</strong><small id="page-capture-media-review-status">当前方案 0 项</small></header>
- <p>正文内已定位媒体默认纳入;保存按钮就是最终授权。位置不确定的素材默认不选。</p>
+ <header><strong data-i18n="保存的图片与视频">保存的图片与视频</strong><small id="page-capture-media-review-status" data-i18n="当前方案 0 项">当前方案 0 项</small></header>
<div id="page-capture-media-review-list" class="page-capture-media-review-list"></div>
</section>
<div id="page-capture-actions" class="page-capture-actions">
- <button id="page-capture-cancel" class="button-secondary" type="button">取消</button>
- <button id="page-capture-save-text-only" class="button-secondary" type="button" hidden>只保存正文</button>
- <button id="page-capture-save" class="primary" type="button">保存为一个案例</button>
+ <button id="page-capture-cancel" class="button-secondary" type="button" data-i18n="取消">取消</button>
+ <button id="page-capture-save-text-only" class="button-secondary" type="button" hidden data-i18n="只保存正文">只保存正文</button>
+ <button id="page-capture-save" class="primary" type="button" data-i18n="保存为一个案例">保存为一个案例</button>
</div>
</section>
<dialog id="page-capture-media-viewer" class="page-capture-media-viewer">
<header>
- <div><small id="page-capture-media-position">媒体 0 / 0</small><strong id="page-capture-media-title">媒体预览</strong></div>
- <button id="page-capture-media-close" class="quiet compact" type="button" aria-label="关闭媒体预览">关闭</button>
+ <div><small id="page-capture-media-position" data-i18n="媒体 0 / 0">媒体 0 / 0</small><strong id="page-capture-media-title" data-i18n="媒体预览">媒体预览</strong></div>
+ <button id="page-capture-media-close" class="quiet compact" type="button" aria-label="关闭媒体预览" data-i18n-aria-label="关闭媒体预览" data-i18n="关闭">关闭</button>
</header>
<div id="page-capture-media-stage" class="page-capture-media-stage"></div>
<p id="page-capture-media-meta"></p>
<footer>
- <button id="page-capture-media-prev" class="button-secondary" type="button">上一项</button>
- <button id="page-capture-media-next" class="button-secondary" type="button">下一项</button>
+ <button id="page-capture-media-prev" class="button-secondary" type="button" data-i18n="上一项">上一项</button>
+ <button id="page-capture-media-next" class="button-secondary" type="button" data-i18n="下一项">下一项</button>
</footer>
</dialog>
<section id="region-capture-status" class="smart-selection region-capture-status" hidden aria-live="polite">
- <div><small>框选截图</small><h2 id="region-capture-title">正在启动框选…</h2><p id="region-capture-help">请在网页中拖动选择画面;操作状态会持续显示在这里。</p></div>
- <div class="smart-selection-actions"><button id="region-capture-cancel" class="button-secondary" type="button">取消框选</button></div>
+ <div><small data-i18n="框选截图">框选截图</small><h2 id="region-capture-title" data-i18n="正在启动框选…">正在启动框选…</h2><p id="region-capture-help" data-i18n="请在网页中拖动选择画面;操作状态会持续显示在这里。">请在网页中拖动选择画面;操作状态会持续显示在这里。</p></div>
+ <div class="smart-selection-actions"><button id="region-capture-cancel" class="button-secondary" type="button" data-i18n="取消框选">取消框选</button></div>
</section>
<section id="smart-selection" class="smart-selection" hidden aria-live="polite">
<div>
- <small>智能选图进行中</small>
- <h2 id="smart-selection-count">已选 0 张</h2>
- <p id="smart-selection-help">直接点击网页中的画面,可多选;确认操作留在这里。</p>
+ <small data-i18n="智能选图进行中">智能选图进行中</small>
+ <h2 id="smart-selection-count" data-i18n="已选 0 张">已选 0 张</h2>
+ <p id="smart-selection-help" data-i18n="直接点击网页中的画面,可多选;确认操作留在这里。">直接点击网页中的画面,可多选;确认操作留在这里。</p>
</div>
<p id="smart-selection-warning" class="smart-selection-warning" hidden></p>
<div class="smart-selection-actions">
- <button id="smart-selection-cancel" class="button-secondary" type="button">取消</button>
- <button id="smart-selection-confirm" class="primary" type="button" disabled>加入素材</button>
+ <button id="smart-selection-cancel" class="button-secondary" type="button" data-i18n="取消">取消</button>
+ <button id="smart-selection-confirm" class="primary" type="button" disabled data-i18n="加入素材">加入素材</button>
</div>
</section>
<section id="preview-state" class="preview-state" hidden>
<header class="preview-heading">
- <div><small>待保存内容</small><h2 id="content-summary"></h2></div>
+ <div><small data-i18n="待保存内容">待保存内容</small><h2 id="content-summary"></h2></div>
</header>
<div id="quick-preview" class="quick-preview"></div>
- <section id="capture-metadata" class="save-metadata" aria-label="保存设置">
+ <section id="capture-metadata" class="save-metadata" aria-label="保存设置" data-i18n-aria-label="保存设置">
<label>
- <span>项目</span>
+ <span data-i18n="项目">项目</span>
<select id="capture-collection"></select>
</label>
<label id="capture-new-collection-row" hidden>
- <span>新项目名称</span>
- <input id="capture-new-collection-name" autocomplete="off" placeholder="输入后会在保存案例时创建" />
+ <span data-i18n="新项目名称">新项目名称</span>
+ <input id="capture-new-collection-name" autocomplete="off" placeholder="输入后会在保存案例时创建" data-i18n-placeholder="输入后会在保存案例时创建" />
</label>
<label>
<span data-i18n="一级分类">一级分类</span>
<select id="content-type"></select>
</label>
<div class="custom-label-editor">
- <span>添加标签</span>
+ <span data-i18n="添加标签">添加标签</span>
<div id="custom-labels"></div>
</div>
</section>
<div id="capture-add-more-actions" class="add-more-actions">
- <button id="add-smart-visuals" class="quiet" type="button">+ 智能选图</button>
+ <button id="add-smart-visuals" class="quiet" type="button" data-i18n="+ 智能选图">+ 智能选图</button>
<button id="add-selection" class="quiet" type="button" data-i18n="+ 提取文字/图片">+ 提取文字/图片</button>
- <button id="add-page-capture" class="quiet" type="button">+ 网页采集</button>
+ <button id="add-page-capture" class="quiet" type="button" data-i18n="+ 网页采集">+ 网页采集</button>
<details id="add-other-capture-methods" class="other-capture-methods compact-capture-methods">
- <summary>智能选图无法识别?</summary>
+ <summary data-i18n="智能选图无法识别?">智能选图无法识别?</summary>
<div>
- <button id="add-screenshot" class="quiet" type="button">+ 框选截图</button>
+ <button id="add-screenshot" class="quiet" type="button" data-i18n="+ 框选截图">+ 框选截图</button>
</div>
</details>
</div>
- <button id="organize-toggle" class="organize-toggle" type="button" aria-expanded="false">编辑与整理</button>
+ <button id="organize-toggle" class="organize-toggle" type="button" aria-expanded="false" data-i18n="编辑与整理">编辑与整理</button>
<div id="organizer" class="organizer" hidden>
<details class="title-editor">
- <summary>修改案例标题</summary>
- <label><span class="sr-only">案例标题</span><input id="draft-title" autocomplete="off" placeholder="默认使用来源网页标题" /></label>
+ <summary data-i18n="修改案例标题">修改案例标题</summary>
+ <label><span class="sr-only" data-i18n="案例标题">案例标题</span><input id="draft-title" autocomplete="off" placeholder="默认使用来源网页标题" data-i18n-placeholder="默认使用来源网页标题" /></label>
</details>
<section id="fragment-section" class="draft-section" hidden>
- <header><h3>文字内容</h3><small id="fragment-help"></small></header>
+ <header><h3 data-i18n="文字内容">文字内容</h3><small id="fragment-help"></small></header>
<div id="fragment-list" class="draft-list"></div>
</section>
<section id="visual-section" class="draft-section" hidden>
- <header><h3>图片内容</h3><small id="visual-help"></small></header>
+ <header><h3 data-i18n="图片内容">图片内容</h3><small id="visual-help"></small></header>
<div id="visual-list" class="visual-list"></div>
</section>
</div>
<section id="duplicate-panel" class="duplicate-panel" hidden>
- <strong>这个来源已经保存过</strong>
+ <strong data-i18n="这个来源已经保存过">这个来源已经保存过</strong>
<p id="duplicate-title"></p>
- <div><button id="merge-duplicate" type="button">添加到原案例</button><button id="save-separate" class="quiet" type="button">仍然新建</button></div>
+ <div><button id="merge-duplicate" type="button" data-i18n="添加到原案例">添加到原案例</button><button id="save-separate" class="quiet" type="button" data-i18n="仍然新建">仍然新建</button></div>
</section>
</section>
<p id="feedback" class="ui-feedback-toast" role="status" aria-live="polite"></p>
<footer id="collector-footer" class="collector-footer" hidden>
- <button id="discard-draft" class="quiet" type="button">清空</button>
- <button id="save-draft" class="primary" type="button">保存案例</button>
+ <button id="discard-draft" class="quiet" type="button" data-i18n="清空">清空</button>
+ <button id="save-draft" class="primary" type="button" data-i18n="保存案例">保存案例</button>
</footer>
</main>
<script type="module" src="collector.js"></script>
diff --git a/collector.js b/collector.js
index bd3bb69..c122287 100644
--- a/collector.js
+++ b/collector.js
@@ -21,7 +21,7 @@ import {
RESTRICTED_PAGE_MESSAGE,
resolveActivePage
} from "./capture-permissions.js";
-import { initializeUi, t } from "./i18n.js";
+import { initializeUi, t, translateUiMessage } from "./i18n.js";
import { confirmAppAction } from "./ui-dialogs.js";
import { createUiIcon } from "./ui-icons.js";
import { ingestHtmlDocument } from "./document-ingestion.js";
@@ -283,7 +283,7 @@ async function confirmCapturePermissionOnboarding(event) {
const includeClipboard = elements.capturePermissionClipboard.checked;
elements.capturePermissionConfirm.disabled = true;
elements.capturePermissionCancel.disabled = true;
- elements.capturePermissionStatus.textContent = "正在等待 Chrome 确认…";
+ elements.capturePermissionStatus.textContent = t("正在等待 Chrome 确认…");
elements.capturePermissionStatus.classList.remove("error");
let permissionGranted = false;
try {
@@ -292,7 +292,7 @@ async function confirmCapturePermissionOnboarding(event) {
current: pending.permissionStatus
});
if (!permission.granted) {
- elements.capturePermissionStatus.textContent = "未获得所选权限,待保存内容没有改变。你可以调整选择后重试。";
+ elements.capturePermissionStatus.textContent = t("未获得所选权限,待保存内容没有改变。你可以调整选择后重试。");
elements.capturePermissionStatus.classList.add("error");
return;
}
@@ -403,11 +403,11 @@ async function confirmClipboardPermissionEnable(event) {
if (!button) return elements.clipboardPermissionDialog.close();
elements.clipboardPermissionConfirm.disabled = true;
elements.clipboardPermissionCancel.disabled = true;
- elements.clipboardPermissionStatus.textContent = "正在等待 Chrome 确认…";
+ elements.clipboardPermissionStatus.textContent = t("正在等待 Chrome 确认…");
elements.clipboardPermissionStatus.classList.remove("error");
try {
if (!await ensureClipboardReadPermission(chrome.permissions)) {
- elements.clipboardPermissionStatus.textContent = "未获得剪贴板读取权限,未读取任何内容。";
+ elements.clipboardPermissionStatus.textContent = t("未获得剪贴板读取权限,未读取任何内容。");
elements.clipboardPermissionStatus.classList.add("error");
return;
}
@@ -516,27 +516,27 @@ function render() {
elements.previewState.hidden = Boolean(smartVisualSession || pageCaptureBatch || regionCaptureState) || !view.showPreview;
elements.collectorFooter.hidden = Boolean(smartVisualSession || pageCaptureBatch || regionCaptureState) || !view.showFooter;
if (regionCaptureState) {
- elements.regionCaptureTitle.textContent = regionCaptureMessage(regionCaptureState.phase);
+ elements.regionCaptureTitle.textContent = t(regionCaptureMessage(regionCaptureState.phase));
elements.regionCaptureHelp.textContent = regionCaptureState.phase === "selecting"
- ? "请切回网页拖动选择画面;按 Esc 或在这里取消。"
- : "请保持当前网页与侧边栏打开,完成后会自动回到待保存内容。";
+ ? t("请切回网页拖动选择画面;按 Esc 或在这里取消。")
+ : t("请保持当前网页与侧边栏打开,完成后会自动回到待保存内容。");
elements.regionCaptureCancel.disabled = !regionCaptureState.sessionId || ["capturing"].includes(regionCaptureState.phase);
}
if (pageCaptureBatch) renderPageCapture();
if (smartVisualSession) {
- elements.smartSelectionCount.textContent = `已选 ${smartVisualSession.selectedCount || 0} 张`;
- elements.smartSelectionHelp.textContent = `网页中识别到 ${smartVisualSession.candidateCount || 0} 个候选;点击画面选择,页面滚动或布局变化后会自动重新对齐。`;
+ elements.smartSelectionCount.textContent = t("已选 {count} 张", { count: smartVisualSession.selectedCount || 0 });
+ elements.smartSelectionHelp.textContent = t("网页中识别到 {count} 个候选;点击画面选择,页面滚动或布局变化后会自动重新对齐。", { count: smartVisualSession.candidateCount || 0 });
elements.smartSelectionConfirm.disabled = !(smartVisualSession.selectedCount > 0);
const overlayUnavailable = smartVisualSession.overlayReady === false;
elements.smartSelectionWarning.hidden = !overlayUnavailable;
elements.smartSelectionWarning.textContent = overlayUnavailable
- ? "当前页面没有成功显示选图层,请退出网页元素全屏后重试。"
+ ? t("当前页面没有成功显示选图层,请退出网页元素全屏后重试。")
: "";
}
elements.targetBanner.hidden = !targetEntry;
- elements.targetLabel.textContent = view.targetLabel;
- elements.contentSummary.textContent = view.summary;
- elements.saveDraft.textContent = view.saveLabel;
+ elements.targetLabel.textContent = translateUiMessage(view.targetLabel);
+ elements.contentSummary.textContent = translateUiMessage(view.summary);
+ elements.saveDraft.textContent = t(view.saveLabel);
elements.saveDraft.disabled = saving || !view.hasContent;
elements.draftTitle.disabled = saving;
elements.contentType.disabled = saving;
@@ -562,11 +562,11 @@ function render() {
}
elements.organizer.hidden = !view.showOrganizer;
elements.organizeToggle.setAttribute("aria-expanded", String(view.showOrganizer));
- elements.organizeToggle.textContent = view.showOrganizer ? "收起整理" : "编辑与整理";
+ elements.organizeToggle.textContent = t(view.showOrganizer ? "收起整理" : "编辑与整理");
elements.fragmentSection.hidden = !view.showOrganizer || !draft.fragments.length;
elements.visualSection.hidden = !view.showOrganizer || !draft.visuals.length;
- elements.fragmentHelp.textContent = view.canReorderFragments ? "使用箭头调整段落顺序" : "";
- elements.visualHelp.textContent = view.canReorderVisuals ? "使用箭头调整图片顺序" : "";
+ elements.fragmentHelp.textContent = view.canReorderFragments ? t("使用箭头调整段落顺序") : "";
+ elements.visualHelp.textContent = view.canReorderVisuals ? t("使用箭头调整图片顺序") : "";
if (document.activeElement !== elements.draftTitle) {
elements.draftTitle.value = draft.title || targetEntry?.title || "";
}
@@ -574,14 +574,14 @@ function render() {
elements.contentType.replaceChildren(...contentTypes.map((item) => {
const option = document.createElement("option");
option.value = item.id;
- option.textContent = item.name;
+ option.textContent = item.customized ? item.name : t(item.name);
option.selected = item.id === selectedContentType;
return option;
}));
if (!selectedContentType || !contentTypes.some((item) => item.id === selectedContentType)) {
const option = document.createElement("option");
option.value = "";
- option.textContent = "待确认";
+ option.textContent = t("待确认");
option.selected = true;
elements.contentType.prepend(option);
}
@@ -590,9 +590,9 @@ function render() {
: "";
creatingCollection = creatingCollection || Boolean(draft.newCollectionName);
elements.captureCollection.replaceChildren(
- optionElement("", "不分组", !creatingCollection && !selectedCollectionId),
+ optionElement("", t("不分组"), !creatingCollection && !selectedCollectionId),
...collections.map((item) => optionElement(item.id, item.name, !creatingCollection && item.id === selectedCollectionId)),
- optionElement(NEW_COLLECTION_OPTION_VALUE, "+ 新建项目", creatingCollection)
+ optionElement(NEW_COLLECTION_OPTION_VALUE, t("+ 新建项目"), creatingCollection)
);
elements.captureNewCollectionRow.hidden = !creatingCollection;
if (document.activeElement !== elements.captureNewCollectionName) {
@@ -641,10 +641,10 @@ function renderPageCapture() {
const selections = new Map(pageCaptureBatch.selections.map((selection) => [selection.candidateId, selection]));
const selectedCount = pageCaptureBatch.selections.length;
const listMode = pageCaptureBatch.captureMode === "list";
- elements.pageCaptureTitle.textContent = t("已识别 {count} 个主体方案 · 已确认 {selected} 个", { count: pageCaptureBatch.candidates.length, selected: selectedCount });
+ elements.pageCaptureTitle.textContent = t("识别到 {count} 个可保存区域 · 已选 {selected} 个", { count: pageCaptureBatch.candidates.length, selected: selectedCount });
elements.pageCaptureHelp.textContent = pageCaptureBatch.status === "scanning"
? t("正在扫描已加载内容;可随时停止,结束后会恢复原滚动位置。")
- : t("先查看并修正网页区域,再确认一个创作主体。确认后会按原始顺序保存完整文章和相关资源。");
+ : t("确认一个主体后即可保存;需要时再展开预览或修正识别结果。");
const selectedMediaCount = pageCaptureBatch.selections.reduce((count, selection) => count + selection.selectedMediaIds.length, 0);
const saveBlocked = !selectedCount || pageCaptureBatch.status === "saving" || (listMode && !["multiple", "combined"].includes(pageCaptureBatch.saveMode));
elements.pageCaptureSave.disabled = saveBlocked;
@@ -690,7 +690,12 @@ function renderPageCapture() {
heading.append(copy);
if (!listMode) heading.append(inspect);
card.append(heading);
- card.append(createPageCaptureArticlePreview(candidate, selections.get(candidate.id)));
+ const previewDetails = document.createElement("details");
+ previewDetails.className = "page-capture-preview-details";
+ const previewSummary = document.createElement("summary");
+ previewSummary.textContent = t("预览完整内容");
+ previewDetails.append(previewSummary, createPageCaptureArticlePreview(candidate, selections.get(candidate.id)));
+ card.append(previewDetails);
if (candidate.possibleOmissions?.length) {
const omissions = document.createElement("details");
omissions.className = "page-capture-omissions";
@@ -1109,7 +1114,7 @@ function createQuickPreview() {
const card = div("quick-item quick-text");
const marker = text("Aa", "strong");
const copy = div("quick-copy");
- copy.append(text(fragment.text, "p"), text(fragment.sourceTitle || hostname(fragment.sourceUrl) || "当前网页", "small"));
+ copy.append(text(fragment.text, "p"), text(fragment.sourceTitle || hostname(fragment.sourceUrl) || t("当前网页"), "small"));
const remove = createQuickRemoveButton(`删除第 ${index + 1} 段文字`, (button) =>
sendDraftAction(button, "REMOVE_CAPTURE_FRAGMENT", { fragmentId: fragment.id }));
card.append(marker, copy, remove);
@@ -1129,7 +1134,7 @@ function createQuickPreview() {
strip.append(item);
});
const copy = div("quick-copy");
- copy.append(text(`${draft.visuals.length} 张图片`, "strong"), text(draft.visuals[0].sourceTitle || hostname(draft.visuals[0].sourceUrl) || "当前网页", "small"));
+ copy.append(text(t("{count} 张图片", { count: draft.visuals.length }), "strong"), text(draft.visuals[0].sourceTitle || hostname(draft.visuals[0].sourceUrl) || t("当前网页"), "small"));
card.append(strip, copy);
nodes.push(card);
}
@@ -1152,8 +1157,9 @@ function createFragmentCard(fragment, index, canReorder) {
textarea.addEventListener("change", () =>
sendDraftAction(null, "UPDATE_CAPTURE_FRAGMENT", { fragmentId: fragment.id, text: textarea.value }));
const meta = div("item-meta");
- const source = text(fragment.sourceTitle || hostname(fragment.sourceUrl) || "当前网页");
- const partType = text(partContentTypes[fragment.sourceUrl || "source:unknown"]?.name || "待确认", "small");
+ const source = text(fragment.sourceTitle || hostname(fragment.sourceUrl) || t("当前网页"));
+ const partContentType = partContentTypes[fragment.sourceUrl || "source:unknown"];
+ const partType = text(partContentType?.customized ? partContentType.name : t(partContentType?.name || "待确认"), "small");
meta.append(source, partType);
const actions = div("item-actions");
if (canReorder) {
@@ -1177,8 +1183,8 @@ function createVisualCard(visual, index, view) {
loadVisual(image, visual.id);
const copy = div("visual-copy");
copy.append(
- text(draft.primaryVisualId === visual.id ? "主图" : `图片 ${index + 1}`, "strong"),
- text(visual.sourceTitle || hostname(visual.sourceUrl) || "当前网页", "small")
+ text(draft.primaryVisualId === visual.id ? t("主图") : t("图片 {count}", { count: index + 1 }), "strong"),
+ text(visual.sourceTitle || hostname(visual.sourceUrl) || t("当前网页"), "small")
);
const actions = div("item-actions");
if (view.canChoosePrimary && draft.primaryVisualId !== visual.id) {
@@ -1584,7 +1590,7 @@ async function withButton(button, task) {
function showFeedback(message, error = false) {
if (feedbackTimer) window.clearTimeout(feedbackTimer);
feedbackTimer = 0;
- const value = message || "";
+ const value = translateUiMessage(message || "");
elements.feedback.textContent = value;
elements.feedback.classList.toggle("error", error);
if (value) {
@@ -1597,11 +1603,11 @@ function showFeedback(message, error = false) {
}
function action(label, handler, disabled = false, className = "", ariaLabel = "") {
- const button = text(label, "button");
+ const button = text(translateUiMessage(label), "button");
button.type = "button";
button.disabled = disabled;
button.className = className;
- if (ariaLabel) button.setAttribute("aria-label", ariaLabel);
+ if (ariaLabel) button.setAttribute("aria-label", translateUiMessage(ariaLabel));
button.addEventListener("click", () => handler(button));
return button;
}
diff --git a/composer-page.css b/composer-page.css
index 8f635fd..f8750cc 100644
--- a/composer-page.css
+++ b/composer-page.css
@@ -6,11 +6,11 @@
.composer-brand-link { display: flex; min-width: 0; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.composer-brand-link img { width: 34px; height: 34px; border-radius: 9px; }
.composer-brand-link span { display: grid; min-width: 0; }
-.composer-brand-link small { color: var(--accent-ink); font-size: 9px; font-weight: 900; letter-spacing: .14em; }
-.composer-brand-link strong { font-size: 15px; }
+.composer-brand-link .product-brand-name { color: var(--ink); font-size: 14px; font-weight: 750; letter-spacing: 0; line-height: 17px; }
+.composer-brand-link .product-brand-tagline { color: var(--muted); font-size: 10px; font-weight: 550; line-height: 13px; }
.composer-new { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 42px; justify-content: flex-start; border: 1px solid color-mix(in srgb, var(--ink) 18%, var(--line)); border-radius: 10px; padding: 9px 12px; color: var(--ink); background: var(--card); }
.composer-new:hover:not(:disabled) { background: var(--hover); }
-.composer-new span:first-child { color: var(--accent); font-size: 19px; font-weight: 400; line-height: 1; }
+.composer-new span:first-child { color: var(--accent-ink); font-size: 19px; font-weight: 400; line-height: 1; }
.composer-nav-section { min-height: 0; overflow: hidden; padding-top: 20px; }
.composer-nav-heading { padding: 0 9px 8px; color: var(--muted); font-size: 11px; }
.composer-session-list { display: grid; align-content: start; gap: 14px; max-height: 100%; overflow: auto; }
@@ -33,9 +33,8 @@
.composer-session-item[aria-current="true"] .composer-session-menu > summary,
.composer-session-menu[open] > summary { opacity: 1; pointer-events: auto; }
.composer-session-menu > summary:hover { color: var(--ink); background: var(--hover); }
-.composer-session-menu-panel { position: absolute; z-index: 18; top: calc(100% + 3px); right: 0; min-width: 112px; border: 1px solid var(--line); border-radius: 7px; padding: 4px; background: var(--card); box-shadow: 0 10px 30px color-mix(in srgb, var(--ink) 18%, transparent); }
-.composer-session-menu-panel button { width: 100%; min-height: 31px; border: 0; border-radius: 5px; padding: 5px 8px; color: var(--danger); background: transparent; text-align: left; font-size: 10px; }
-.composer-session-menu-panel button:hover:not(:disabled) { background: var(--hover); }
+.composer-session-menu-panel { position: absolute; z-index: 18; top: calc(100% + 3px); right: 0; min-width: 84px; border: 1px solid var(--line); border-radius: 7px; padding: 3px; background: var(--card); box-shadow: 0 10px 30px color-mix(in srgb, var(--ink) 18%, transparent); }
+.composer-session-menu-panel .quiet-danger { width: 100%; min-height: 30px; border: 0; border-radius: 5px; padding: 5px 8px; text-align: left; }
.composer-session-menu-panel button:disabled { color: var(--muted); }
.composer-session-running { color: var(--accent-ink) !important; }
.composer-nav-footer { border-top: 1px solid var(--line); padding: 12px 7px 0; }
@@ -111,7 +110,7 @@
.composer-result-judgment-feedback { color: var(--muted); font-size: 10px; }
.composer-checks { display: grid; gap: 5px; margin-top: 10px; }
.composer-check { border-radius: 9px; padding: 7px 9px; color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, var(--card)); font-size: 10px; }
-.composer-streaming-caret::after { content: ""; display: inline-block; width: 7px; height: 15px; margin-left: 3px; vertical-align: -2px; background: var(--accent); animation: composer-blink 900ms steps(1) infinite; }
+.composer-streaming-caret::after { content: ""; display: inline-block; width: 7px; height: 15px; margin-left: 3px; vertical-align: -2px; background: var(--accent-emphasis); animation: composer-blink 900ms steps(1) infinite; }
@keyframes composer-blink { 50% { opacity: 0; } }
.composer-question-recommendation { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
@@ -222,14 +221,15 @@
.composer-model-control { position: relative; min-width: 0; }
.composer-model-trigger { display: flex; min-width: 0; max-width: 150px; min-height: 36px; align-items: center; gap: 5px; border-color: var(--line); padding: 5px 9px; font-size: 10px; font-weight: 850; }
.composer-model-trigger > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
-.composer-model-menu { position: absolute; z-index: 15; right: 0; bottom: calc(100% + 9px); display: grid; width: 260px; border: 1px solid var(--line); border-radius: 14px; padding: 9px; background: var(--card); box-shadow: 0 14px 42px color-mix(in srgb, var(--ink) 20%, transparent); }
+.composer-model-menu { position: absolute; z-index: 15; right: 0; bottom: calc(100% + 9px); display: grid; width: min(260px, calc(100vw - 20px)); min-width: 0; max-width: calc(100vw - 20px); border: 1px solid var(--line); border-radius: 14px; padding: 9px; background: var(--card); box-shadow: 0 14px 42px color-mix(in srgb, var(--ink) 20%, transparent); }
.composer-model-menu[hidden] { display: none; }
.composer-model-menu > strong { padding: 5px 7px 8px; font-size: 11px; }
-.composer-model-menu > button { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 12px; border: 0; border-radius: 9px; padding: 8px; color: var(--ink); background: transparent; text-align: left; }
+.composer-model-menu > button { display: flex; width: 100%; min-width: 0; max-width: 100%; min-height: 48px; align-items: center; justify-content: space-between; gap: 12px; border: 0; border-radius: 9px; padding: 8px; color: var(--ink); background: transparent; text-align: left; white-space: normal; }
.composer-model-menu > button:hover:not(:disabled) { background: var(--hover); }
-.composer-model-menu > button > span:first-child { display: grid; gap: 2px; }
-.composer-model-menu b { font-size: 11px; }
-.composer-model-menu small, .composer-model-menu > p { color: var(--muted); font-size: 9px; line-height: 1.45; }
+.composer-model-menu > button > span:first-child { display: grid; min-width: 0; gap: 2px; }
+.composer-model-menu > button > span:last-child { flex: none; }
+.composer-model-menu b { min-width: 0; font-size: 11px; overflow-wrap: anywhere; white-space: normal; }
+.composer-model-menu small, .composer-model-menu > p { min-width: 0; color: var(--muted); font-size: 9px; line-height: 1.45; overflow-wrap: anywhere; white-space: normal; }
.composer-model-menu > button[aria-checked="false"] > span:last-child { visibility: hidden; }
.composer-model-menu > p { margin: 7px 7px 3px; border-top: 1px solid var(--line); padding-top: 9px; }
.composer-status-line { display: flex; width: min(920px, 100%); min-height: 20px; align-items: start; justify-content: space-between; gap: 14px; margin: 7px auto 0; }
@@ -274,12 +274,12 @@
.composer-skill-card > header > div { display: grid; gap: 2px; }
.composer-skill-card code { color: var(--accent-ink); font-size: 12px; }
.composer-skill-card small { color: var(--muted); font-size: 11px; }
-.composer-skill-card .composer-project-active { border-color: var(--selection-edge); color: var(--ink); background: var(--selection); box-shadow: inset 2px 0 var(--accent); }
+.composer-skill-card .composer-project-active { border-color: var(--selection-edge); color: var(--ink); background: var(--selection); box-shadow: inset 2px 0 var(--accent-emphasis); }
.composer-case-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); align-content: start; gap: 14px; }
.composer-case-option { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.composer-case-option:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); box-shadow: 0 8px 24px color-mix(in srgb, var(--ink) 10%, transparent); }
.composer-case-option[data-selected="true"] { border-color: var(--selection-edge); background: var(--selection); box-shadow: inset 0 0 0 1px var(--selection-edge); }
-.composer-case-option input { position: absolute; z-index: 2; top: 10px; right: 10px; width: 18px; min-height: 18px; margin: 0; accent-color: var(--accent); }
+.composer-case-option input { position: absolute; z-index: 2; top: 10px; right: 10px; width: 18px; min-height: 18px; margin: 0; accent-color: var(--accent-emphasis); }
.composer-case-visual { position: relative; display: grid; min-height: 150px; place-items: center; overflow: hidden; border-bottom: 1px solid var(--line); background: var(--raised); color: var(--muted); font-size: 10px; }
.composer-case-select-preview { display: grid; width: 100%; min-height: 150px; overflow: hidden; place-items: center; border: 0; border-radius: 0; padding: 0; color: inherit; background: transparent; cursor: pointer; }
.composer-case-select-preview:hover { background: var(--hover); }
@@ -419,8 +419,8 @@
.composer-brand { min-height: 48px; padding: 0 3px 10px; }
.composer-brand-link { gap: 9px; }
.composer-brand-link img { width: 36px; height: 36px; border-radius: 7px; }
-.composer-brand-link small { color: var(--ink); font-size: 14px; font-weight: 750; letter-spacing: 0; line-height: 17px; }
-.composer-brand-link strong { color: var(--muted); font-size: 10px; font-weight: 550; line-height: 13px; }
+.composer-brand-link .product-brand-name { color: var(--ink); font-size: 14px; font-weight: 750; letter-spacing: 0; line-height: 17px; }
+.composer-brand-link .product-brand-tagline { color: var(--muted); font-size: 10px; font-weight: 550; line-height: 13px; }
.composer-new { min-height: 38px; border-color: transparent; border-radius: 6px; background: var(--raised); }
.composer-new span:first-child { color: var(--accent-ink); }
.composer-nav-heading { padding-inline: 9px; color: var(--muted); font-size: 10px; }
@@ -446,8 +446,8 @@
.composer-message .markdown-reader h2 { font-size: 1.25em; }
.composer-message .markdown-reader h3 { font-size: 1.1em; }
.composer-message .markdown-reader p, .composer-message .markdown-reader ul, .composer-message .markdown-reader ol, .composer-message .markdown-reader blockquote, .composer-message .markdown-reader pre, .composer-message .markdown-reader table { margin: .7em 0; }
-.composer-message .markdown-reader blockquote { border-left: 3px solid var(--accent); padding-left: 10px; color: var(--muted); }
-.composer-message .markdown-reader pre { max-width: 100%; overflow: auto; border-radius: 6px; padding: 11px; color: #edf2f4; background: #11161b; }
+.composer-message .markdown-reader blockquote { border-left: 3px solid var(--accent-emphasis); padding-left: 10px; color: var(--muted); }
+.composer-message .markdown-reader pre { max-width: 100%; overflow: auto; border-radius: 6px; padding: 11px; color: var(--ui-code-text); background: var(--ui-code-bg); }
.composer-message .markdown-reader code { border-radius: 4px; padding: 1px 4px; background: var(--panel); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.composer-message .markdown-reader pre code { padding: 0; background: transparent; }
.composer-message .markdown-reader table { width: 100%; border-collapse: collapse; }
diff --git a/composer-page.js b/composer-page.js
index 1dfd805..bae4f89 100644
--- a/composer-page.js
+++ b/composer-page.js
@@ -454,20 +454,20 @@ function tempReferenceCard(reference) {
preview.append(rawTextEl("span", "", tempReferenceTypeLabel(asset)));
}
const copy = el("span", "composer-temp-reference-copy");
- copy.append(rawTextEl("small", "", reference.alias), rawTextEl("strong", "", reference.title || "未命名文件"));
+ copy.append(rawTextEl("small", "", reference.alias), rawTextEl("strong", "", reference.title || t("未命名文件")));
insert.append(preview, copy);
const actions = el("span", "composer-temp-reference-actions");
const save = el("button", "icon-button");
save.type = "button";
save.disabled = Boolean(activeOperation);
- save.title = "保存到案例库";
+ save.title = t("保存到案例库");
save.setAttribute("aria-label", `保存到案例库:${reference.title}`);
save.append(createUiIcon("save"));
save.addEventListener("click", () => safely(() => saveTempReferenceAsCase(reference.entryId))());
const remove = el("button", "icon-button");
remove.type = "button";
remove.disabled = Boolean(activeOperation);
- remove.title = "移除临时附件";
+ remove.title = t("移除临时附件");
remove.setAttribute("aria-label", `移除临时附件:${reference.title}`);
remove.append(createUiIcon("x"));
remove.addEventListener("click", () => safely(() => removeTempReference(reference.entryId))());
@@ -597,17 +597,17 @@ function renderAppliedSkills() {
chip.append(rawTextEl("strong", "", `/${skill.callName}`));
const up = rawTextEl("button", "", "↑");
up.type = "button";
- up.title = "提高 Skill 优先级";
+ up.title = t("提高 Skill 优先级");
up.disabled = index === 0;
up.addEventListener("click", () => safely(() => moveAppliedSkill(skill.skillId, -1))());
const down = rawTextEl("button", "", "↓");
down.type = "button";
- down.title = "降低 Skill 优先级";
+ down.title = t("降低 Skill 优先级");
down.disabled = index === skills.length - 1;
down.addEventListener("click", () => safely(() => moveAppliedSkill(skill.skillId, 1))());
const remove = rawTextEl("button", "", "×");
remove.type = "button";
- remove.title = `移除 /${skill.callName}`;
+ remove.title = t("移除 /{callName}", { callName: skill.callName });
remove.addEventListener("click", () => safely(() => removeAppliedSkill(skill.skillId))());
chip.append(up, down, remove);
return chip;
@@ -654,7 +654,7 @@ function renderSlashSkillMenu() {
button.dataset.skillId = skill.id;
button.setAttribute("aria-selected", String(index === 0));
const copy = el("span");
- copy.append(rawTextEl("strong", "", `/${skill.callName}`), rawTextEl("small", "", skill.description || "创作 Skill"));
+ copy.append(rawTextEl("strong", "", `/${skill.callName}`), rawTextEl("small", "", skill.description || t("创作 Skill")));
button.append(copy, rawTextEl("small", "", `v${skill.versions.findIndex((item) => item.id === skill.currentVersionId) + 1}`));
button.addEventListener("mousedown", (event) => event.preventDefault());
button.addEventListener("click", () => safely(() => selectSlashSkill(skill))());
@@ -730,6 +730,7 @@ function renderSessionRow(summary) {
row.setAttribute("aria-current", String(summary.id === composerSession?.id));
const load = document.createElement("button");
load.type = "button";
+ load.className = "ui-content-row";
const running = activeOperation?.kind === "compose" && activeOperation.sessionId === summary.id;
load.append(rawTextEl("strong", "", summary.title));
if (running) load.append(rawTextEl("small", "composer-session-running", operationLabel(activeOperation.phase)));
@@ -739,7 +740,7 @@ function renderSessionRow(summary) {
trigger.setAttribute("aria-label", t("更多操作:{title}", { title: summary.title }));
const panel = el("div", "composer-session-menu-panel");
panel.setAttribute("role", "menu");
- const remove = rawTextEl("button", "composer-session-delete", t("删除"));
+ const remove = rawTextEl("button", "composer-session-delete quiet-danger", t("删除"));
remove.type = "button";
remove.disabled = running;
remove.setAttribute("role", "menuitem");
@@ -1016,7 +1017,7 @@ function showImageTempReferenceBlock() {
const block = imageTempReferenceBlock(composerSession.referenceSnapshots, service);
if (!block.blocked) return false;
const serviceLabel = currentImageAnalysisServiceLabel();
- elements.composerImageBlockerDescription.textContent = `本轮有 ${block.imageCount} 张尚未分析的参考图片,但 ${service.shortLabel} 只能读取文字。可切换到视觉创作服务;也可调用当前图片分析服务(${serviceLabel}),预计发起 ${block.imageCount} 次额外请求,费用由服务商按你的账号计费。`;
+ elements.composerImageBlockerDescription.textContent = t("本轮有 {count} 张尚未分析的参考图片,但 {service} 只能读取文字。可切换到视觉创作服务;也可调用当前图片分析服务({analysisService}),预计发起 {count} 次额外请求,费用由服务商按你的账号计费。", { count: block.imageCount, service: service.shortLabel, analysisService: serviceLabel });
elements.composerImageBlocker.showModal();
return true;
}
@@ -1056,7 +1057,7 @@ async function analyzeBlockedTempReferences() {
}
imageAnalysisPending = true;
setImageBlockerPending(true);
- elements.composerImageBlockerDescription.textContent = `正在通过当前图片分析服务处理 ${references.length} 张图片。完成前不会发送本轮消息,也不会更换创作模型。`;
+ elements.composerImageBlockerDescription.textContent = t("正在通过当前图片分析服务处理 {count} 张图片。完成前不会发送本轮消息,也不会更换创作模型。", { count: references.length });
try {
const response = await chrome.runtime.sendMessage({
type: "ANALYZE_TEMP_REFERENCES",
@@ -1395,12 +1396,12 @@ function renderComposerAiProfile() {
const catalog = composerServiceCatalog(composerAiSettings, composerVisionSettings);
const service = selectedComposerService(profile, composerAiSettings, composerVisionSettings);
const reasoningAvailable = service.reasoning === true;
- const name = service.shortLabel || service.label;
+ const name = translateUiMessage(service.shortLabel || service.label).replace("未选择模型", t("未选择模型"));
elements.composerModelLabel.textContent = composerSession?.outputMode === "create_image"
- ? `${name} · 生图`
- : composerSession?.outputMode === "create_video" ? `${name} · 视频`
+ ? `${name} · ${t("生图")}`
+ : composerSession?.outputMode === "create_video" ? `${name} · ${t("视频")}`
: reasoningAvailable && profile.thinking ? `${name} · ${t("思考")}` : name;
- elements.composerModelLabel.title = service.label;
+ elements.composerModelLabel.title = translateUiMessage(service.label).replace("未选择模型", t("未选择模型"));
const selected = (serviceId, model) => profile.serviceId === serviceId && (!model || profile.model === model);
elements.composerModelFlash.setAttribute("aria-checked", String(selected("deepseek", "deepseek-v4-flash")));
elements.composerModelPro.setAttribute("aria-checked", String(selected("deepseek", "deepseek-v4-pro")));
@@ -1410,14 +1411,16 @@ function renderComposerAiProfile() {
const openai = catalog.find((item) => item.serviceId === "openai");
const compatible = catalog.find((item) => item.serviceId === "compatible");
const xai = catalog.find((item) => item.serviceId === "xai");
- elements.composerModelOpenaiLabel.textContent = openai?.label || "OpenAI";
- elements.composerModelCompatibleLabel.textContent = compatible?.label || "兼容视觉服务";
- elements.composerModelXaiLabel.textContent = xai?.label || "xAI";
- elements.composerModelOpenai.querySelector("small").textContent = openai?.configured ? "读取手选原图与对应提示词" : "未配置,前往分析设置";
- elements.composerModelCompatible.querySelector("small").textContent = compatible?.configured ? "读取手选原图与对应提示词" : "未配置,前往分析设置";
+ elements.composerModelOpenaiLabel.textContent = translateUiMessage(openai?.label || "OpenAI").replace("未选择模型", t("未选择模型"));
+ elements.composerModelCompatibleLabel.textContent = translateUiMessage(compatible?.label || t("兼容视觉服务"))
+ .replace("兼容服务", t("兼容服务"))
+ .replace("未选择模型", t("未选择模型"));
+ elements.composerModelXaiLabel.textContent = translateUiMessage(xai?.label || "xAI").replace("未选择模型", t("未选择模型"));
+ elements.composerModelOpenai.querySelector("small").textContent = t(openai?.configured ? "读取手选原图与对应提示词" : "未配置,前往分析设置");
+ elements.composerModelCompatible.querySelector("small").textContent = t(compatible?.configured ? "读取手选原图与对应提示词" : "未配置,前往分析设置");
elements.composerModelXai.querySelector("small").textContent = xai?.configured
- ? "读取文字与手选原图,并按已配置能力创建图片或视频"
- : "未配置,前往 AI 服务与任务分工";
+ ? t("读取文字与手选原图,并按已配置能力创建图片或视频")
+ : t("未配置,前往 AI 服务与任务分工");
renderGenerationModelChoices(profile);
elements.composerThinking.checked = reasoningAvailable && profile.thinking;
elements.composerModelTrigger.disabled = Boolean(activeOperation);
@@ -1435,7 +1438,7 @@ function renderComposerAiProfile() {
elements.composerCreateMediaLabel.textContent = t(videoTask ? "创建视频" : "创建图片");
elements.composerCreateImage.checked = composerSession?.outputMode === (videoTask ? "create_video" : "create_image");
elements.composerCreateImage.disabled = Boolean(activeOperation) || !mediaAvailability.available;
- elements.composerCreateImageNote.textContent = mediaAvailability.message;
+ elements.composerCreateImageNote.textContent = translateUiMessage(mediaAvailability.message);
elements.composerProductionReview.disabled = Boolean(activeOperation) || !["auto", "compose"].includes(composerSession?.routeMode);
renderImageGenerationSettings();
}
@@ -1467,7 +1470,7 @@ function renderGenerationModelChoices(selectedProfile) {
button.addEventListener("click", () => safely(() => updateComposerAiProfile(candidate))());
return button;
}));
- if (!choices.length) elements.composerModelDynamic.append(rawTextEl("p", "composer-model-empty", "没有已连接且支持当前生成任务的模型"));
+ if (!choices.length) elements.composerModelDynamic.append(rawTextEl("p", "composer-model-empty", t("没有已连接且支持当前生成任务的模型")));
}
function renderImageGenerationSettings() {
@@ -1545,7 +1548,7 @@ function renderGenerationParameterField(field, select, capability, key, selected
const parameter = capability.parameters.find((item) => item.key === key);
field.dataset.parameterKey = key;
const label = field.querySelector("span");
- if (label) label.textContent = t(parameter?.label || fallbackLabel);
+ if (label) label.textContent = translateUiMessage(parameter?.label || fallbackLabel);
field.hidden = !parameter && !showAutomatic;
const supportedOptions = parameter?.options?.length
? parameter.options
@@ -1558,7 +1561,7 @@ function renderGenerationParameterField(field, select, capability, key, selected
select.replaceChildren(...options.map((item) => {
const option = document.createElement("option");
option.value = item.value;
- option.textContent = t(item.label);
+ option.textContent = translateUiMessage(item.label);
option.dataset.incompatible = String(item.incompatible === true);
return option;
}));
@@ -1851,7 +1854,7 @@ function renderReferencePicker() {
elements.composerWorkspaceTitle.textContent = t("本次参考");
elements.composerWorkspaceDescription.textContent = referencesMode
? t("只选择本次对话需要借鉴的案例。")
- : "可同时应用多个 Skill;列表顺序就是本轮装配顺序。";
+ : t("可同时应用多个 Skill;列表顺序就是本轮装配顺序。");
if (referencesMode) {
renderProjectFilter();
renderCasePicker();
@@ -1878,7 +1881,7 @@ function renderSkills() {
const open = textEl("button", "button-secondary", "打开 Skill 中心");
open.addEventListener("click", () => safely(openSkillCenter)());
empty.append(
- rawTextEl("p", "", "还没有已保存的创作 Skill。"),
+ rawTextEl("p", "", t("还没有已保存的创作 Skill。")),
open
);
elements.composerProjectList.replaceChildren(empty);
@@ -1891,7 +1894,7 @@ function renderSkills() {
const title = el("div", "");
title.append(rawTextEl("h2", "ui-skill-card-title", skill.callName), rawTextEl("code", "", `/${skill.callName}`));
header.append(title, rawTextEl("small", "", `v${skill.versions.findIndex((item) => item.id === skill.currentVersionId) + 1}`));
- card.append(header, rawTextEl("p", "ui-skill-card-summary composer-project-state", skill.description || "暂无说明"));
+ card.append(header, rawTextEl("p", "ui-skill-card-summary composer-project-state", skill.description || t("暂无说明")));
const actions = el("div", "ui-skill-card-actions");
const edit = textEl("button", "button-secondary", "查看与编辑");
edit.addEventListener("click", () => safely(() => openSkillCenter(skill.id))());
@@ -2134,7 +2137,7 @@ function renderReferenceSelection() {
);
elements.composerReferenceApply.disabled = limit.exceeded;
if (limit.exceeded) {
- elements.composerReferenceFeedback.textContent = `所选模型最多接收 ${limit.maximum} 张参考图;当前 ${limit.imageCount} 张。选择已保留,请减少后再应用。`;
+ elements.composerReferenceFeedback.textContent = t("所选模型最多接收 {maximum} 张参考图;当前 {count} 张。选择已保留,请减少后再应用。", { maximum: limit.maximum, count: limit.imageCount });
elements.composerReferenceFeedback.classList.add("error");
} else if (elements.composerReferenceFeedback.textContent.includes("最多接收")) {
elements.composerReferenceFeedback.textContent = "";
@@ -2410,34 +2413,34 @@ function creativeOutputCard(run, output) {
const primaryActions = el("div", "composer-result-primary-actions");
const secondaryActions = el("div", "composer-result-secondary-actions");
const saved = entries.some((entry) => entryMediaAssets(entry).some((asset) => asset.id === output.visual.id));
- const save = textEl("button", saved ? "button-secondary" : "", t(saved ? "已保存到灵感库" : "保存到灵感库"));
+ const save = textEl("button", saved ? "button-secondary" : "", saved ? "已保存到灵感库" : "保存到灵感库");
save.disabled = saved;
save.addEventListener("click", () => safely(() => saveCreativeOutput(run.id, output.visual.id, save))());
- const reroll = textEl("button", "button-secondary", t("再生成"));
+ const reroll = textEl("button", "button-secondary", "再生成");
reroll.addEventListener("click", () => safely(() => rerollCreativeOutput(run, output))());
primaryActions.append(save, reroll);
if (!videoOutput) {
- const reuse = textEl("button", "button-secondary", t("作为参考继续"));
+ const reuse = textEl("button", "button-secondary", "作为参考继续");
reuse.addEventListener("click", () => safely(() => useCreativeOutputAsReference(run, output))());
primaryActions.insertBefore(reuse, reroll);
const editCapabilities = composerImageEditCapabilities(composerSession?.generationAiProfile, composerVisionSettings);
- const edit = textEl("button", "button-secondary", t("编辑"));
+ const edit = textEl("button", "button-secondary", "编辑");
edit.disabled = !editCapabilities.whole;
edit.title = edit.disabled ? "请切换到已验证支持图片编辑的 OpenAI 或米醋服务" : "";
edit.addEventListener("click", () => openCreativeImageWorkspace(run.id, output.visual.id, true));
secondaryActions.append(edit);
}
if (!videoOutput && creativeExperimentSettings.enabled && !output.evaluation) {
- const analyze = textEl("button", "button-secondary", t("分析对照"));
+ const analyze = textEl("button", "button-secondary", "分析对照");
analyze.addEventListener("click", () => safely(() => analyzeCreativeOutput(run.id, output.visual.id, analyze))());
secondaryActions.append(analyze);
}
if (!videoOutput && output.evaluation?.primaryDeviation) {
- const revise = textEl("button", "", t("继续优化"));
+ const revise = textEl("button", "", "继续优化");
revise.addEventListener("click", () => safely(() => continueFromCreativeOutput(run, output))());
primaryActions.append(revise);
}
- const remove = textEl("button", "button-danger composer-result-delete", t("删除"));
+ const remove = textEl("button", "button-danger composer-result-delete", "删除");
remove.title = t(videoOutput ? "删除这个生成视频" : "删除这张生成结果");
remove.addEventListener("click", () => safely(() => deleteCreativeOutput(run.id, output.visual.id, remove))());
secondaryActions.append(remove);
@@ -2468,8 +2471,8 @@ function creativeJudgmentEditor(run, output) {
improve.value = output.judgment?.improve ?? "";
const feedback = rawTextEl("span", "composer-result-judgment-feedback", judgmentFeedbackById.get(judgmentId) || "");
const actions = el("div", "composer-result-judgment-actions");
- const save = textEl("button", "", t(output.judgment ? "保存修改" : "保存判断"));
- const clear = textEl("button", "button-secondary", t("清空"));
+ const save = textEl("button", "", output.judgment ? "保存修改" : "保存判断");
+ const clear = textEl("button", "button-secondary", "清空");
clear.disabled = !output.judgment;
const persist = async (judgment) => {
save.disabled = true;
diff --git a/composer.html b/composer.html
index 8b1c2a5..73fbdd8 100644
--- a/composer.html
+++ b/composer.html
@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
- <title>私人提示词创作台</title>
+ <title data-i18n="私人提示词创作台">私人提示词创作台</title>
<script src="theme-bootstrap.js"></script>
<link rel="stylesheet" href="ui-foundation.css" />
<link rel="stylesheet" href="library.css" />
@@ -13,11 +13,11 @@
<div id="composer-shell" class="composer-shell">
<aside id="composer-nav" class="composer-nav" aria-label="创作导航" data-i18n-aria-label="创作导航">
<header class="composer-brand">
- <a href="library.html" class="composer-brand-link" aria-label="返回视觉灵感库" data-i18n-aria-label="返回视觉灵感库">
- <img src="assets/icons/icon-source.svg" alt="" />
- <span><small>PromptDirector</small><strong data-i18n="创作台">创作台</strong></span>
+ <a href="library.html" class="composer-brand-link product-brand" aria-label="返回视觉创作灵感库" data-i18n-aria-label="返回视觉创作灵感库">
+ <img class="product-brand-mark" src="assets/icons/icon-source.svg" alt="" />
+ <span class="product-brand-copy"><small class="product-brand-name">PromptDirector</small><strong class="product-brand-tagline" data-i18n="视觉创作灵感库">视觉创作灵感库</strong></span>
</a>
- <button id="composer-nav-close" class="icon-button composer-mobile-only" type="button" aria-label="关闭导航" data-i18n-aria-label="关闭导航" title="关闭导航"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button>
+ <button id="composer-nav-close" class="icon-button composer-mobile-only" type="button" aria-label="关闭导航" data-i18n-aria-label="关闭导航" title="关闭导航" data-i18n-title="关闭导航"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button>
</header>
<button id="composer-new" class="composer-new" type="button"><span aria-hidden="true">+</span><span data-i18n="新对话">新对话</span></button>
<nav class="composer-nav-section" aria-labelledby="drafts-heading">
@@ -31,9 +31,9 @@
<main class="composer-chat">
<header class="composer-toolbar">
- <button id="composer-nav-open" class="icon-button composer-mobile-only" type="button" aria-label="打开导航" data-i18n-aria-label="打开导航" title="打开导航"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-menu"></use></svg></button>
+ <button id="composer-nav-open" class="icon-button composer-mobile-only" type="button" aria-label="打开导航" data-i18n-aria-label="打开导航" title="打开导航" data-i18n-title="打开导航"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-menu"></use></svg></button>
<div class="composer-title-wrap">
- <strong id="composer-title">未命名图片提示词</strong>
+ <strong id="composer-title" data-i18n="未命名图片提示词">未命名图片提示词</strong>
<span id="composer-save-state" data-i18n="已自动保存">已自动保存</span>
</div>
<div class="composer-toolbar-actions">
@@ -46,15 +46,15 @@
<footer class="composer-input-area">
<div id="composer-aliases" class="composer-aliases composer-input-aliases" aria-label="插入案例编号" data-i18n-aria-label="插入案例编号"></div>
- <div id="composer-applied-skills" class="composer-applied-skills" aria-label="已应用 Skill" hidden></div>
- <div id="composer-retrieval-sources" class="composer-retrieval-sources" aria-label="本轮检索来源" hidden></div>
+ <div id="composer-applied-skills" class="composer-applied-skills" aria-label="已应用 Skill" hidden data-i18n-aria-label="已应用 Skill"></div>
+ <div id="composer-retrieval-sources" class="composer-retrieval-sources" aria-label="本轮检索来源" hidden data-i18n-aria-label="本轮检索来源"></div>
<div class="composer-input-box">
<div id="composer-temp-reference-row" class="composer-temp-reference-row" hidden>
- <div id="composer-temp-references" class="composer-temp-references" aria-label="临时附件"></div>
- <button id="composer-temp-reference-save-all" class="button-secondary composer-temp-reference-save-all" type="button">全部保存</button>
+ <div id="composer-temp-references" class="composer-temp-references" aria-label="临时附件" data-i18n-aria-label="临时附件"></div>
+ <button id="composer-temp-reference-save-all" class="button-secondary composer-temp-reference-save-all" type="button" data-i18n="全部保存">全部保存</button>
</div>
<textarea id="composer-instruction" rows="2" placeholder="生成提示词、分析资料、提炼方法,或直接讨论…" data-i18n-placeholder="生成提示词、分析资料、提炼方法,或直接讨论…"></textarea>
- <div id="composer-skill-menu" class="composer-skill-menu" role="listbox" aria-label="选择创作 Skill" hidden></div>
+ <div id="composer-skill-menu" class="composer-skill-menu" role="listbox" aria-label="选择创作 Skill" hidden data-i18n-aria-label="选择创作 Skill"></div>
<div class="composer-input-footer">
<div class="composer-input-tools">
<button id="composer-attachment-local" class="button-secondary icon-button composer-attachment-local" type="button" aria-label="添加本机文件" data-i18n-aria-label="添加本机文件" title="添加本机文件" data-i18n-title="添加本机文件"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-paperclip"></use></svg></button>
@@ -69,11 +69,11 @@
<div class="composer-options-panel">
<strong data-i18n="创作设置">创作设置</strong>
<label class="composer-option-field"><span data-i18n="任务">任务</span><select id="composer-route"><option value="auto" data-i18n="自动判断">自动判断</option><option value="compose" data-i18n="生成提示词">生成提示词</option><option value="analyze_materials" data-i18n="分析资料">分析资料</option><option value="chat" data-i18n="普通对话">普通对话</option></select></label>
- <label class="composer-option-field"><span data-i18n="目标模型">目标模型</span><input id="composer-platform" placeholder="通用" /></label>
- <label class="composer-option-field"><span data-i18n="输出语言">输出语言</span><select id="composer-output-language"><option value="auto" data-i18n="自动">自动</option><option value="zh-CN">中文</option><option value="en">English</option></select></label>
+ <label class="composer-option-field"><span data-i18n="目标模型">目标模型</span><input id="composer-platform" placeholder="通用" data-i18n-placeholder="通用" /></label>
+ <label class="composer-option-field"><span data-i18n="输出语言">输出语言</span><select id="composer-output-language"><option value="auto" data-i18n="自动">自动</option><option value="zh-CN" data-i18n="中文">中文</option><option value="en">English</option></select></label>
<label class="composer-option-toggle" title="在原有两次请求中检查常见平台拒绝风险,并在保持创作核心的前提下修复" data-i18n-title="在原有两次请求中检查常见平台拒绝风险,并在保持创作核心的前提下修复"><span><b data-i18n="审核修复">审核修复</b><small data-i18n="保持创作核心,检查常见拒绝风险">保持创作核心,检查常见拒绝风险</small></span><input id="composer-production-review" type="checkbox" role="switch" checked /></label>
<label class="composer-option-toggle"><span><b data-i18n="思考模式">思考模式</b><small data-i18n="更慢且消耗更多输出 token">更慢且消耗更多输出 token</small></span><input id="composer-thinking" type="checkbox" role="switch" /></label>
- <label class="composer-option-toggle"><span><b id="composer-create-media-label">创建图片</b><small id="composer-create-image-note">使用当前创作服务直接生成图片</small></span><input id="composer-create-image" type="checkbox" role="switch" /></label>
+ <label class="composer-option-toggle"><span><b id="composer-create-media-label" data-i18n="创建图片">创建图片</b><small id="composer-create-image-note" data-i18n="使用当前创作服务直接生成图片">使用当前创作服务直接生成图片</small></span><input id="composer-create-image" type="checkbox" role="switch" /></label>
<section id="composer-generation-settings" class="composer-generation-settings" hidden>
<strong id="composer-generation-settings-title" data-i18n="本轮图片参数">本轮图片参数</strong>
<label id="composer-image-size-field" class="composer-option-field"><span data-i18n="画幅与分辨率">画幅与分辨率</span><select id="composer-image-size"></select></label>
@@ -93,11 +93,11 @@
<strong data-i18n="创作模型">创作模型</strong>
<button id="composer-model-flash" type="button" role="menuitemradio" aria-checked="true"><span><b>DeepSeek Flash</b><small data-i18n="响应更快,默认推荐">响应更快,默认推荐</small></span><span aria-hidden="true">✓</span></button>
<button id="composer-model-pro" type="button" role="menuitemradio" aria-checked="false"><span><b>DeepSeek Pro</b><small data-i18n="质量优先,等待更久">质量优先,等待更久</small></span><span aria-hidden="true">✓</span></button>
- <button id="composer-model-openai" type="button" role="menuitemradio" aria-checked="false"><span><b id="composer-model-openai-label">OpenAI</b><small>读取手选原图与对应提示词</small></span><span aria-hidden="true">✓</span></button>
- <button id="composer-model-compatible" type="button" role="menuitemradio" aria-checked="false"><span><b id="composer-model-compatible-label">兼容视觉服务</b><small>读取手选原图与对应提示词</small></span><span aria-hidden="true">✓</span></button>
- <button id="composer-model-xai" type="button" role="menuitemradio" aria-checked="false"><span><b id="composer-model-xai-label">xAI</b><small>使用已配置的 xAI 文字与图片能力</small></span><span aria-hidden="true">✓</span></button>
+ <button id="composer-model-openai" type="button" role="menuitemradio" aria-checked="false"><span><b id="composer-model-openai-label">OpenAI</b><small data-i18n="读取手选原图与对应提示词">读取手选原图与对应提示词</small></span><span aria-hidden="true">✓</span></button>
+ <button id="composer-model-compatible" type="button" role="menuitemradio" aria-checked="false"><span><b id="composer-model-compatible-label" data-i18n="兼容视觉服务">兼容视觉服务</b><small data-i18n="读取手选原图与对应提示词">读取手选原图与对应提示词</small></span><span aria-hidden="true">✓</span></button>
+ <button id="composer-model-xai" type="button" role="menuitemradio" aria-checked="false"><span><b id="composer-model-xai-label">xAI</b><small data-i18n="使用已配置的 xAI 文字与图片能力">使用已配置的 xAI 文字与图片能力</small></span><span aria-hidden="true">✓</span></button>
<div id="composer-model-dynamic" class="composer-model-dynamic" hidden></div>
- <p>规划不发送图片;多模态服务仅在最终装配时读取手选内容图。</p>
+ <p data-i18n="规划不发送图片;多模态服务仅在最终装配时读取手选内容图。">规划不发送图片;多模态服务仅在最终装配时读取手选内容图。</p>
</div>
</div>
<button id="composer-action" class="composer-action" type="button" aria-label="发送" data-i18n-aria-label="发送"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-send"></use></svg></button>
@@ -112,19 +112,19 @@
<header class="composer-reference-header">
<div class="composer-reference-title">
<strong id="composer-workspace-title" data-i18n="本次参考">本次参考</strong>
- <nav class="composer-reference-tabs ui-segmented" aria-label="参考类型">
+ <nav class="composer-reference-tabs ui-segmented" aria-label="参考类型" data-i18n-aria-label="参考类型">
<button id="composer-reference-tab-cases" class="ui-segmented-item" type="button" aria-pressed="true" data-i18n="案例">案例</button>
<button id="composer-reference-tab-skills" class="ui-segmented-item" type="button" aria-pressed="false">Skill</button>
</nav>
- <p id="composer-workspace-description">只选择本次对话需要借鉴的案例,不会修改案例库或 Skill。</p>
+ <p id="composer-workspace-description" data-i18n="只选择本次对话需要借鉴的案例,不会修改案例库或 Skill。">只选择本次对话需要借鉴的案例,不会修改案例库或 Skill。</p>
</div>
- <button id="composer-reference-close" class="icon-button" type="button" aria-label="关闭参考资料" data-i18n-aria-label="关闭参考资料" title="关闭参考资料"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button>
+ <button id="composer-reference-close" class="icon-button" type="button" aria-label="关闭参考资料" data-i18n-aria-label="关闭参考资料" title="关闭参考资料" data-i18n-title="关闭参考资料"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button>
</header>
<div class="composer-reference-body">
<aside id="composer-projects-panel" class="composer-projects-panel" hidden>
<div class="composer-reference-heading">
- <div><strong>已保存的创作 Skill</strong><span>可同时应用多个,并按当前顺序执行。</span></div>
+ <div><strong data-i18n="已保存的创作 Skill">已保存的创作 Skill</strong><span data-i18n="可同时应用多个,并按当前顺序执行。">可同时应用多个,并按当前顺序执行。</span></div>
</div>
<div id="composer-project-list" class="composer-project-list"></div>
</aside>
@@ -149,20 +149,20 @@
</div>
<dialog id="composer-assembly-dialog" class="composer-assembly-dialog" aria-labelledby="composer-assembly-title">
- <header><div><strong id="composer-assembly-title" data-i18n="本次装配">本次装配</strong><p>这里显示本轮实际采用的 Agent、任务方法和资料。</p></div><button id="composer-assembly-close" class="icon-button" type="button" aria-label="关闭本次装配" data-i18n-aria-label="关闭本次装配" title="关闭本次装配"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button></header>
+ <header><div><strong id="composer-assembly-title" data-i18n="本次装配">本次装配</strong><p data-i18n="这里显示本轮实际采用的 Agent、任务方法和资料。">这里显示本轮实际采用的 Agent、任务方法和资料。</p></div><button id="composer-assembly-close" class="icon-button" type="button" aria-label="关闭本次装配" data-i18n-aria-label="关闭本次装配" title="关闭本次装配" data-i18n-title="关闭本次装配"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button></header>
<div id="composer-assembly-content" class="composer-assembly-content"></div>
</dialog>
<dialog id="composer-image-blocker" class="composer-image-blocker" aria-labelledby="composer-image-blocker-title">
<form method="dialog">
<header>
- <strong id="composer-image-blocker-title">当前模型无法读取图片</strong>
- <button id="composer-image-blocker-cancel" class="icon-button" type="submit" value="cancel" aria-label="取消本轮" title="取消本轮"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button>
+ <strong id="composer-image-blocker-title" data-i18n="当前模型无法读取图片">当前模型无法读取图片</strong>
+ <button id="composer-image-blocker-cancel" class="icon-button" type="submit" value="cancel" aria-label="取消本轮" title="取消本轮" data-i18n-aria-label="取消本轮" data-i18n-title="取消本轮"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button>
</header>
- <p id="composer-image-blocker-description">本轮包含尚未分析的临时图片。请选择视觉创作服务,或明确调用当前图片分析服务后继续。</p>
+ <p id="composer-image-blocker-description" data-i18n="本轮包含尚未分析的临时图片。请选择视觉创作服务,或明确调用当前图片分析服务后继续。">本轮包含尚未分析的临时图片。请选择视觉创作服务,或明确调用当前图片分析服务后继续。</p>
<div class="composer-image-blocker-actions">
- <button id="composer-image-blocker-choose-service" type="button">选择视觉创作服务</button>
- <button id="composer-image-blocker-analyze" class="button-secondary" type="button">调用图片分析并继续</button>
- <button class="button-secondary" type="submit" value="cancel">取消本轮</button>
+ <button id="composer-image-blocker-choose-service" type="button" data-i18n="选择视觉创作服务">选择视觉创作服务</button>
+ <button id="composer-image-blocker-analyze" class="button-secondary" type="button" data-i18n="调用图片分析并继续">调用图片分析并继续</button>
+ <button class="button-secondary" type="submit" value="cancel" data-i18n="取消本轮">取消本轮</button>
</div>
</form>
</dialog>
diff --git a/curated-skills.html b/curated-skills.html
index 563be53..e09a55e 100644
--- a/curated-skills.html
+++ b/curated-skills.html
@@ -3,17 +3,16 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
- <title>精选 Skill</title>
+ <title data-i18n="精选 Skill">精选 Skill</title>
<script src="theme-bootstrap.js"></script>
<link rel="stylesheet" href="ui-foundation.css" />
<link rel="stylesheet" href="curated.css" />
<link rel="stylesheet" href="curated-skill-page.css" />
</head>
<body>
- <header class="curated-header">
+ <header class="curated-header curated-header--skills">
<div class="curated-title-group">
- <img class="curated-brand-mark" src="assets/icons/icon-source.svg" alt="" />
- <h1 data-i18n="精选 Skill">精选 Skill</h1>
+ <a class="curated-brand-home product-brand" href="library.html" aria-label="返回视觉创作灵感库" data-i18n-aria-label="返回视觉创作灵感库" title="返回视觉创作灵感库" data-i18n-title="返回视觉创作灵感库"><img class="curated-brand-mark product-brand-mark" src="assets/icons/icon-source.svg" alt="" /><span class="product-brand-copy"><strong class="product-brand-name">PromptDirector</strong><span class="product-brand-tagline" data-i18n="视觉创作灵感库">视觉创作灵感库</span></span></a>
<nav class="curated-sections ui-segmented" aria-label="精选内容" data-i18n-aria-label="精选内容">
<a class="ui-segmented-item" href="curated.html" data-i18n="精选案例">精选案例</a>
<a class="ui-segmented-item" href="curated-skills.html" aria-current="page" data-i18n="精选 Skill">精选 Skill</a>
diff --git a/curated.css b/curated.css
index 0d6f1eb..866cbfc 100644
--- a/curated.css
+++ b/curated.css
@@ -1,5 +1,5 @@
:root {
- --curated-max-width: 1500px;
+ --curated-max-width: var(--ui-browse-max-width);
--curated-gap: 8px;
--curated-radius: var(--ui-container-radius);
}
@@ -8,17 +8,20 @@ html.detail-open, html.detail-open body { overflow: hidden; }
body { min-width: 320px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
-.curated-header { position: sticky; z-index: 20; top: 0; display: grid; min-height: 58px; grid-template-columns: auto minmax(260px, 720px) auto; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--ui-border); padding: 9px max(12px, calc((100vw - var(--curated-max-width)) / 2)); background: var(--bar); }
-.curated-header h1 { margin: 0; font-size: 17px; line-height: 1.2; }
-.curated-title-group { display: flex; min-width: 0; align-items: center; gap: 14px; }
+.curated-header { position: sticky; z-index: 20; top: 0; display: grid; min-height: 64px; grid-template-areas: "title search actions"; grid-template-columns: minmax(0, 1fr) minmax(260px, 720px) minmax(0, 1fr); align-items: center; gap: 12px; border-bottom: 1px solid var(--ui-border); padding: 10px var(--ui-browse-gutter); background: var(--bar); }
+.curated-title-group { grid-area: title; display: flex; min-width: 0; align-items: center; gap: 14px; }
+.curated-brand-home { display: flex; min-width: 0; flex: 0 1 auto; border-radius: var(--ui-control-radius); }
+.curated-brand-home:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: 3px; }
.curated-brand-mark { width: 28px; height: 28px; flex: none; }
.curated-sections { flex: none; }
-.curated-search { display: grid; min-width: 0; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; border: 1px solid var(--ui-border); border-radius: var(--curated-radius); padding: 0 10px; background: var(--ui-raised); }
+.curated-search { grid-area: search; display: grid; width: 100%; min-width: 0; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; border: 1px solid var(--ui-border); border-radius: var(--curated-radius); padding: 0 10px; background: var(--ui-raised); }
.curated-search:focus-within { border-color: var(--ui-border-strong); }
.curated-search .ui-icon { width: 15px; height: 15px; color: var(--ui-muted); }
.curated-search input { min-width: 0; min-height: 34px; border: 0; padding: 0; outline: 0; background: transparent; box-shadow: none; }
-.curated-header-actions { display: flex; align-items: center; gap: 7px; }
-.curated-header-actions button { min-height: 34px; }
+.curated-header-actions { grid-area: actions; display: flex; min-width: 0; max-width: 100%; align-items: center; justify-self: end; gap: 7px; }
+.curated-header-tools { display: flex; min-width: 0; max-width: 100%; align-items: center; gap: 7px; }
+.curated-header-tools button { min-height: 34px; }
+.page-back-action { min-height: 34px; }
.tool-button, .page-back-action { display: inline-flex; align-items: center; gap: 7px; }
.tool-button .ui-icon, .page-back-action .ui-icon { width: 15px; height: 15px; }
.filter-wrap { position: relative; }
@@ -27,15 +30,16 @@ body { min-width: 320px; }
.filter-panel { width: 210px; gap: 4px; padding: 9px; }
.filter-panel strong { padding: 2px 3px 5px; font-size: var(--ui-meta-size); }
.filter-panel label { display: flex; min-height: 32px; align-items: center; gap: 8px; font-size: var(--ui-button-size); }
-.filter-panel input { width: 15px; min-height: 15px; accent-color: var(--ui-accent); }
+.filter-panel input { width: 15px; min-height: 15px; accent-color: var(--ui-accent-emphasis); }
.filter-panel button { margin-top: 4px; }
-.curated-sort select { width: 110px; min-height: 34px; padding-block: 5px; font-size: var(--ui-button-size); font-weight: 750; }
+.curated-sort { min-width: 0; max-width: 100%; }
+.curated-sort select { width: 110px; min-width: 0; max-width: 100%; min-height: 34px; padding-block: 5px; font-size: var(--ui-button-size); font-weight: 750; }
-.curated-status-bar { position: sticky; z-index: 15; top: 58px; display: flex; min-height: 38px; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--ui-border); padding: 5px max(12px, calc((100vw - var(--curated-max-width)) / 2)); color: var(--ui-muted); background: var(--ui-raised); font-size: var(--ui-meta-size); }
+.curated-status-bar { position: sticky; z-index: 15; top: 64px; display: flex; min-height: 38px; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--ui-border); padding: 5px var(--ui-browse-gutter); color: var(--ui-muted); background: var(--ui-raised); font-size: var(--ui-meta-size); }
.curated-status-bar[hidden] { display: none; }
.curated-status-bar.error { color: var(--danger); }
.curated-status-bar button { min-height: 28px; padding: 4px 8px; }
-.curated-app { width: calc(100% - 12px); max-width: var(--curated-max-width); min-height: calc(100dvh - 58px); margin: 8px auto 48px; }
+.curated-app { width: min(calc(100% - 24px), var(--curated-max-width)); min-height: calc(100dvh - 64px); margin: 8px auto 48px; }
.pack-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--curated-gap); }
.pack-card { min-width: 0; overflow: hidden; border: 1px solid var(--ui-border); border-radius: var(--curated-radius); background: var(--ui-surface); cursor: pointer; }
.pack-card:hover { border-color: var(--ui-border-strong); box-shadow: 0 8px 20px color-mix(in srgb, var(--ui-text) 10%, transparent); }
@@ -70,7 +74,7 @@ body { min-width: 320px; }
.detail-actions .ui-icon { width: 15px; height: 15px; }
.download-action { color: var(--ui-accent-contrast); background: var(--ui-accent); }
.download-action .ui-icon { width: 16px; height: 16px; }
-.follow-action.is-active { color: var(--ui-accent); border-color: var(--ui-border-strong); }
+.follow-action.is-active { color: var(--ui-text); border-color: var(--ui-accent); background: var(--ui-accent-subtle); }
.case-section { width: calc(100% - 16px); max-width: var(--curated-max-width); margin: 18px auto 0; }
.case-section > h2 { display: flex; align-items: baseline; gap: 7px; margin: 0 2px 9px; font-size: var(--ui-section-title-size); }
.case-section > h2 span { color: var(--ui-muted); font-size: var(--ui-meta-size); font-weight: 500; }
@@ -83,7 +87,7 @@ body { min-width: 320px; }
.case-video-preview { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.case-image-wrap.is-video-playing .case-video-badge { opacity: 0; }
.case-video-badge { position: absolute; right: 8px; bottom: 8px; display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid rgba(255, 255, 255, .25); border-radius: 50%; color: white; background: rgba(5, 7, 11, .7); font-size: 10px; }
-.case-card.is-saved::after { content: "✓"; position: absolute; z-index: 2; top: 8px; right: 8px; display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; color: var(--ui-accent-contrast); background: var(--ui-accent); font-size: 12px; font-weight: 800; }
+.case-card.is-saved::after { content: "✓"; position: absolute; z-index: 2; top: 8px; right: 8px; display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; color: var(--ui-accent-emphasis-contrast); background: var(--ui-accent-emphasis); font-size: 12px; font-weight: 800; }
.case-load-sentinel { height: 2px; }
.case-loading { min-height: 160px; border: 1px solid var(--ui-border); border-radius: var(--curated-radius); background: var(--ui-raised); }
.preview-failure { display: flex; min-height: 160px; align-items: center; justify-content: center; gap: 10px; border: 1px solid var(--ui-border); border-radius: var(--curated-radius); color: var(--ui-muted); background: var(--ui-raised); font-size: var(--ui-meta-size); }
@@ -119,9 +123,9 @@ body { min-width: 320px; }
.case-detail-actions button { position: relative; display: inline-flex; min-width: 0; align-items: center; justify-content: center; gap: 6px; overflow: hidden; }
.case-detail-actions .ui-icon { width: 15px; height: 15px; }
.case-save-action { color: var(--ui-accent-contrast); background: var(--ui-accent); }
-.case-save-action.is-saved, .case-detail-actions .is-success { color: var(--ui-accent); border-color: var(--ui-border-strong); background: var(--ui-raised); }
-.is-progressing::after { content: ""; position: absolute; right: 0; bottom: 0; left: 0; height: 2px; background: linear-gradient(90deg, var(--ui-accent) calc(var(--progress) * 100%), transparent 0); }
-.is-progressing[style*="--progress: 0"]::after { width: 38%; background: var(--ui-accent); animation: curated-progress 1.1s ease-in-out infinite alternate; }
+.case-save-action.is-saved, .case-detail-actions .is-success { color: var(--ui-text); border-color: var(--ui-accent); background: var(--ui-accent-subtle); }
+.is-progressing::after { content: ""; position: absolute; right: 0; bottom: 0; left: 0; height: 2px; background: linear-gradient(90deg, var(--ui-accent-emphasis) calc(var(--progress) * 100%), transparent 0); }
+.is-progressing[style*="--progress: 0"]::after { width: 38%; background: var(--ui-accent-emphasis); animation: curated-progress 1.1s ease-in-out infinite alternate; }
.pack-save-dialog { width: min(420px, calc(100vw - 28px)); border: 1px solid var(--ui-border-strong); border-radius: var(--curated-radius); padding: 20px; color: var(--ui-text); background: var(--ui-surface); box-shadow: var(--ui-shadow); }
.pack-save-dialog::backdrop { background: rgba(4,6,9,.76); }
@@ -136,12 +140,24 @@ body { min-width: 320px; }
.case-list { --masonry-card-min-width: 220px; }
}
-@media (max-width: 760px) {
- .curated-header { grid-template-columns: auto 1fr; padding: 8px 10px; }
- .curated-header-actions { justify-self: end; }
- .curated-search { grid-column: 1 / -1; grid-row: 2; }
+@media (max-width: 1100px) {
+ .curated-header { grid-template-areas: "title back" "search search" "tools tools"; grid-template-columns: minmax(0, 1fr) auto; padding: 8px 12px; }
+ .curated-header--skills { grid-template-areas: "title back" "search search"; }
+ .curated-header-actions { display: contents; }
+ .curated-header-tools { width: 100%; flex-wrap: wrap; justify-self: stretch; justify-content: flex-end; }
+ .page-back-action { grid-area: back; justify-self: end; }
+ .curated-header-tools { grid-area: tools; }
.page-back-action span { display: none; }
- .curated-app { width: min(100% - 8px, var(--curated-max-width)); }
+ .curated-status-bar { position: static; }
+}
+
+@media (max-width: 760px) {
+ .curated-header { grid-template-areas: "title back" "sections sections" "search search" "tools tools"; }
+ .curated-header--skills { grid-template-areas: "title back" "sections sections" "search search"; }
+ .curated-title-group { display: contents; }
+ .curated-brand-home { grid-area: title; }
+ .curated-sections { grid-area: sections; justify-self: start; }
+ .curated-app { width: min(100% - 24px, var(--curated-max-width)); }
.pack-grid, .curated-loading { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.case-list { --masonry-card-min-width: 155px; --masonry-gap: 6px; }
.detail-hero { height: auto; min-height: 0; grid-template-columns: 1fr; }
@@ -161,11 +177,9 @@ body { min-width: 320px; }
.case-detail-actions { padding: 10px 14px 14px; }
}
-@media (max-width: 580px) {
- .curated-title-group { align-items: flex-start; flex-direction: column; gap: 8px; }
-}
-
@media (max-width: 460px) {
+ .curated-header-tools { gap: 5px; }
+ .curated-header-tools > * { min-width: 0; }
.tool-button > span:not(#filter-count) { display: none; }
.detail-info { gap: 12px; }
.detail-actions { flex-wrap: wrap; }
diff --git a/curated.html b/curated.html
index 01152c5..7b4122a 100644
--- a/curated.html
+++ b/curated.html
@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
- <title>精选案例</title>
+ <title data-i18n="精选案例">精选案例</title>
<script src="theme-bootstrap.js"></script>
<link rel="stylesheet" href="ui-foundation.css" />
<link rel="stylesheet" href="curated.css" />
@@ -11,8 +11,7 @@
<body>
<header class="curated-header">
<div class="curated-title-group">
- <img class="curated-brand-mark" src="assets/icons/icon-source.svg" alt="" />
- <h1 data-i18n="精选案例">精选案例</h1>
+ <a class="curated-brand-home product-brand" href="library.html" aria-label="返回视觉创作灵感库" data-i18n-aria-label="返回视觉创作灵感库" title="返回视觉创作灵感库" data-i18n-title="返回视觉创作灵感库"><img class="curated-brand-mark product-brand-mark" src="assets/icons/icon-source.svg" alt="" /><span class="product-brand-copy"><strong class="product-brand-name">PromptDirector</strong><span class="product-brand-tagline" data-i18n="视觉创作灵感库">视觉创作灵感库</span></span></a>
<nav class="curated-sections ui-segmented" aria-label="精选内容" data-i18n-aria-label="精选内容">
<a class="ui-segmented-item" href="curated.html" aria-current="page" data-i18n="精选案例">精选案例</a>
<a class="ui-segmented-item" href="curated-skills.html" data-i18n="精选 Skill">精选 Skill</a>
@@ -24,17 +23,19 @@
<input id="curated-search" type="search" autocomplete="off" placeholder="搜索创作包或包内案例" data-i18n-placeholder="搜索创作包或包内案例" />
</label>
<div class="curated-header-actions">
- <div class="filter-wrap">
- <button id="filter-button" class="button-secondary tool-button" type="button" aria-expanded="false"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true"><use href="assets/ui-icons.svg#icon-sliders-horizontal"></use></svg><span data-i18n="筛选">筛选</span><span id="filter-count"></span></button>
- <div id="filter-popover" class="menu-panel filter-panel" hidden>
- <strong data-i18n="内容类型">内容类型</strong>
- <label><input type="checkbox" value="image_prompt" /><span data-i18n="图片案例">图片案例</span></label>
- <label><input type="checkbox" value="video_prompt" /><span data-i18n="视频案例">视频案例</span></label>
- <label><input type="checkbox" value="followed" /><span data-i18n="已关注">已关注</span></label>
- <button id="clear-filters" type="button" data-i18n="清除筛选">清除筛选</button>
+ <div class="curated-header-tools">
+ <div class="filter-wrap">
+ <button id="filter-button" class="button-secondary tool-button" type="button" aria-expanded="false"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true"><use href="assets/ui-icons.svg#icon-sliders-horizontal"></use></svg><span data-i18n="筛选">筛选</span><span id="filter-count"></span></button>
+ <div id="filter-popover" class="menu-panel filter-panel" hidden>
+ <strong data-i18n="内容类型">内容类型</strong>
+ <label><input type="checkbox" value="image_prompt" /><span data-i18n="图片案例">图片案例</span></label>
+ <label><input type="checkbox" value="video_prompt" /><span data-i18n="视频案例">视频案例</span></label>
+ <label><input type="checkbox" value="followed" /><span data-i18n="已关注">已关注</span></label>
+ <button id="clear-filters" type="button" data-i18n="清除筛选">清除筛选</button>
+ </div>
</div>
+ <label class="curated-sort"><span class="visually-hidden" data-i18n="精选案例排序">精选案例排序</span><select id="sort-menu" aria-label="精选案例排序" data-i18n-aria-label="精选案例排序"><option value="recommended" data-i18n="推荐">推荐</option><option value="latest" data-i18n="最新">最新</option><option id="sort-downloads" value="downloads" data-i18n="下载" disabled>下载</option></select></label>
</div>
- <label class="curated-sort"><span class="visually-hidden">精选案例排序</span><select id="sort-menu" aria-label="精选案例排序"><option value="recommended" data-i18n="推荐">推荐</option><option value="latest" data-i18n="最新">最新</option><option id="sort-downloads" value="downloads" data-i18n="下载" disabled>下载</option></select></label>
<button id="return-library" class="button-secondary page-back-action" type="button"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true"><use href="assets/ui-icons.svg#icon-arrow-left"></use></svg><span data-i18n="返回案例库">返回案例库</span></button>
</div>
</header>
diff --git a/design-qa.md b/design-qa.md
new file mode 100644
index 0000000..4e4b99f
--- /dev/null
+++ b/design-qa.md
@@ -0,0 +1,159 @@
+# PromptDirector UX visual QA
+
+## Evidence
+
+- Source visual truth:
+ - External attachment `截屏2026-08-23 下午4.05.33.png`
+ - External attachment `截屏2026-08-23 下午4.05.43.png`
+- Rendered implementation:
+ - `<local-temp>/promptdirector-curated-list-1905.png`
+ - `<local-temp>/promptdirector-skills-list-1911.png`
+ - `<local-temp>/promptdirector-curated-list-390.png`
+ - `<local-temp>/promptdirector-skills-list-390.png`
+- Desktop viewport and pixels:
+ - Curated source and implementation: `1905 x 810` CSS px and image px.
+ - Skill source and implementation: `1911 x 810` CSS px and image px.
+- Narrow viewport and pixels: both implementations `390 x 844` CSS px and image px.
+- Density normalization: device scale factor `1`; no resampling required.
+- State: dark theme, Chinese locale, top-level curated pack wall and top-level Skill list.
+
+## Full-view comparison
+
+The exact-size desktop comparison confirms that both top-level pages now use the same 1500 px outer frame, 64 px top bar, centered search track, and right-aligned return action. At the supplied desktop widths, the curated and Skill left anchors are respectively `202.5 px` and `205.5 px`, which is the expected difference from their 6 px viewport-width difference. The Skill list no longer shifts its identity to the browser edge while its content remains centered.
+
+The existing page content was retained: curated keeps its pack wall, and the Skill page keeps its heading, actions, and card grid. The test fixture uses solid-color media responses, so fixture image content is excluded from asset-fidelity judgment; production media rendering code and source assets were not changed.
+
+## Focused region comparison
+
+The focused check covered the two top bars and main-content left edges because those were the reported jump points. Measured implementation anchors:
+
+- Curated at 1905 px: brand `202.5`, search `592.5–1312.5`, return `1594.5–1702.5`, main `202.5–1702.5`.
+- Skill at 1911 px: brand `205.5`, search `595.5–1315.5`, return `1597.5–1705.5`, main `205.5–1705.5`.
+
+No additional image crop or card-detail comparison was needed because this change does not alter those components.
+
+## Required fidelity surfaces
+
+- Fonts and typography: existing families, weights, sizes, line heights, truncation, and hierarchy are unchanged.
+- Spacing and layout rhythm: the two top-level pages now share the same frame, header height, search width, content edge, and responsive gutters. Existing card gaps and radii are unchanged.
+- Colors and visual tokens: existing dark/light tokens are unchanged; the shared frame adds layout tokens only.
+- Image quality and asset fidelity: no product image, logo, icon, crop, or media renderer was replaced. Existing brand and UI icon assets are reused.
+- Copy and content: visible labels and page content are unchanged. Only accessible return labels were added to the clickable brand shortcuts.
+
+## Findings
+
+- No remaining P0, P1, or P2 visual mismatch in the approved scope.
+- P3: curated uses a three-row narrow header so search and tools never compete for width. This is an intentional responsive reflow, not a desktop redesign.
+
+## Comparison history
+
+1. Initial 390 px resize check reported a 411 px document width in the Skill list.
+2. The search and header grid items were given explicit zero minimum widths so their intrinsic text width cannot force horizontal expansion.
+3. Post-fix Chrome checks passed both live resize from 1911 px to 390 px and a fresh 390 px load: document width `390`, no overflowing elements, brand and return on row one, search on row two.
+4. Curated Chrome checks passed at 1905 px and 390 px: document width equals viewport, brand and return stay on row one, search and tools reflow below without nested scrolling.
+
+## Interactions and console
+
+- Existing right-side return paths passed their navigation regression coverage.
+- The added brand shortcuts are native links to `library.html` and retain visible keyboard focus.
+- Both extension sessions completed without page errors.
+
+final result: passed
+
+---
+
+## Case selection toolbar QA
+
+### Evidence
+
+- Source visual truth: external attachment `截屏2026-08-23 下午5.49.55.png` (`1653 x 251` px), dark Chinese zero-selection state before this change.
+- Approved interaction target: the user-confirmed stable top-row plan in this task; the source screenshot is the problem evidence rather than a visual clone target.
+- Rendered desktop implementation at device scale factor `1`:
+ - `/private/var/folders/mc/sjmh6ky52v76h0h_ymmjhysm0000gn/T/promptdirector-selection-toolbar-empty.png` (`1658 x 900` CSS px and image px).
+ - `/private/var/folders/mc/sjmh6ky52v76h0h_ymmjhysm0000gn/T/promptdirector-selection-toolbar-active.png` (`1658 x 900` CSS px and image px).
+- Focused desktop crops: `promptdirector-selection-toolbar-empty-top.png` and `promptdirector-selection-toolbar-active-top.png` (`1653 x 251` px), kept as local QA artifacts rather than public source paths.
+- Rendered narrow implementation at device scale factor `1`:
+ - `/private/var/folders/mc/sjmh6ky52v76h0h_ymmjhysm0000gn/T/promptdirector-selection-toolbar-mobile-empty.png` (`390 x 844` CSS px and image px).
+ - `/private/var/folders/mc/sjmh6ky52v76h0h_ymmjhysm0000gn/T/promptdirector-selection-toolbar-mobile-active.png` (`390 x 844` CSS px and image px).
+- Density normalization: source and implementation are both 1x; the focused desktop crops normalize the original screenshot height and width without resampling.
+
+### Full-view and focused comparison
+
+The original zero-selection bar exposed the complete batch-edit form in a bordered container. The implementation keeps the existing gallery row height and shows only the selected count, select-current action, and cancel action. After a selection exists, the same row swaps to clear, labels, project, share, more, and cancel without adding a row or moving the gallery.
+
+The focused comparison confirms that the batch bar no longer looks like a second page header: the outer box, inline tag field, inline project field, duplicate confirmation buttons, destructive action, and analysis action are absent from the zero-selection state. The selected state uses existing PromptDirector button, icon, menu, focus, and accent tokens. The fixture uses intentionally minimal black media blobs, so card imagery is excluded from fidelity judgment; production media rendering was not changed.
+
+### Required fidelity surfaces
+
+- Fonts and typography: existing PromptDirector UI family, 12 px action scale, weights, line height, and Chinese copy hierarchy are retained. Mobile icon-only actions keep accessible names.
+- Spacing and layout rhythm: entering selection mode preserves the first card at the same vertical coordinate; the automated measurement was `114 px` before and after. Desktop actions stay on one 34 px row. The 390 px toolbar floats at the bottom without changing document width.
+- Colors and visual tokens: existing dark/light surfaces, restrained borders, lime primary action, danger action, and focus ring are reused. No new palette or gradient was introduced.
+- Image and icon fidelity: existing local UI sprite icons are reused. Selection circles were normalized to 24 px with one restrained edge and the existing lime checked state; no replacement image assets were required.
+- Copy and content: zero-selection copy is reduced to `已选 0`, `全选当前(数量)`, and `取消`. Selected-only actions are grouped under `加标签`, `加入项目`, `分享`, and `更多` while all prior capabilities remain available.
+
+### Findings
+
+- No remaining P0, P1, or P2 mismatch in the approved scope.
+- P3: the desktop test fixture contains only two black placeholder cards. This affects fixture imagery only, not the selection toolbar or production asset pipeline.
+
+### Comparison history
+
+1. The first implementation still moved the gallery from `114 px` to `116 px` when selection mode opened.
+2. The selection row was reduced from 36 px to the existing 34 px gallery-row height.
+3. The post-fix browser measurement is `114 px` before and after, satisfying the at-most-1-pixel acceptance threshold.
+4. Desktop and mobile active-state captures showed every persistent action inside its container. Button `scrollWidth` is no larger than `clientWidth`, and the 390 px page reports no horizontal overflow.
+
+### Interactions and console
+
+- Verified 0, 1, and 2 selected cases; combine is unavailable for one case and available for two.
+- Verified label, project, and more menus open; `Escape` closes a menu and restores focus to its trigger.
+- Verified project target selection enables the join action; share, analyze, trash, and combination retain their existing state rules.
+- Related isolated Chromium tests passed for library navigation, project combination, and a 6500-case library.
+- No page errors were reported by the isolated extension runs.
+- The user-installed Chrome page could not be opened by the browser-control security policy, so installed-Chrome acceptance remains a separate manual gate.
+
+final result: passed
+
+---
+
+## Collector, page capture, and stable filter QA
+
+### Evidence
+
+- Source visual truth:
+ - `截屏2026-08-23 下午3.07.02.png` (`539 x 248`) for the original horizontal capture entrance.
+ - `截屏2026-08-23 下午3.07.15.png` (`527 x 763`) for the original dense page-capture state.
+ - `截屏2026-08-23 下午3.10.45.png` for the original dynamic project-filter row.
+- Rendered implementation at device scale factor `1`:
+ - `<local-temp>/promptdirector-collector-entry-390.png` (`390 x 844`).
+ - `<local-temp>/promptdirector-capture-permission-390.png` (`390 x 844`).
+ - `<local-temp>/promptdirector-page-capture-390.png` (`390 x 1072`, full page).
+ - `<local-temp>/promptdirector-step2-library-mobile.png` (`390 x 888`, full page).
+- State: dark theme, Chinese locale, empty collector, first-use permission dialog, real injected page-capture fixture, and active project filter.
+
+### Full-view comparison
+
+The capture entrance keeps the existing brand, library entry, color system, icons, and secondary screenshot path. Only the three common actions changed from a compressed horizontal row into three full-width 58 px rows. Their labels no longer compete for width, and all three remain above the secondary screenshot action.
+
+The first-use dialog now fits within `263.3 px` of an `844 px` viewport. It retains one authorization action, one cancel action, and one optional clipboard checkbox. There are no per-feature authorization controls.
+
+The page-capture state retains candidate inspection, region correction, batch capture, metadata, media review, text-only save, and full save. Correction controls and full article previews are collapsed by default. Compared with the source screenshot, the always-visible policy paragraph, five correction buttons, and full nested article reader no longer occupy the initial decision surface.
+
+### Focused interaction and layout checks
+
+- The three primary capture entrances measured at least `58 px` high and had strictly increasing vertical positions at `390 px`.
+- First-use authorization showed exactly two footer actions and did not overflow the viewport.
+- The candidate list, media-review list, and article preview all computed to `overflow-y: visible`; the collector page owns vertical scrolling.
+- A real page-capture run saved six media items, preserved article ordering, supported region include/exclude/undo, and completed list-mode capture.
+- Selecting a project left the first content-filter section at the exact same vertical coordinate. The clear-filter control changed enabled state in the fixed project heading; no status row was inserted.
+- The `390 px` library drawer remained within the viewport (`0–310 px`) and created no horizontal overflow.
+- The project heading now contains only `+ 新建` and project ordering. The ambiguous boxed clear icon was removed; clicking the selected project again clears that project filter without inserting or shifting any row.
+- A real image import produced local palette `#E84838`; no automatic AI job was created.
+
+### Findings
+
+- No P0, P1, or P2 visual or interaction issue remains in this scope.
+- P3: page-capture metadata remains visible below candidates because project, type, and tags affect the saved case. It is one shared save form, not a second scrolling page.
+- Installed user-Chrome acceptance remains separate from the isolated extension E2E evidence above.
+
+final result: passed
diff --git a/facets.js b/facets.js
index e90ff79..e2b28aa 100644
--- a/facets.js
+++ b/facets.js
@@ -135,6 +135,7 @@ export function applyFacetChange(state = {}, preview = {}) {
const target = next.facetCatalog.facets.find((item) => item.id === change.facetId);
target.aliases = uniqueNames([...target.aliases, target.name]);
target.name = change.name;
+ delete target.names;
} else if (change.type === "archive_facet") {
next.facetCatalog.facets.find((item) => item.id === change.facetId).status = "archived";
} else if (change.type === "rename") {
@@ -142,6 +143,7 @@ export function applyFacetChange(state = {}, preview = {}) {
ensureUnique(next.facetCatalog, target.facetId, change.name, target.id);
target.aliases = uniqueNames([...target.aliases, target.name]);
target.name = change.name;
+ delete target.names;
} else if (change.type === "archive") {
const ids = facetDescendants(next.facetCatalog, change.nodeId);
for (const item of next.facetCatalog.nodes) if (ids.has(item.id)) item.status = "archived";
diff --git a/i18n.js b/i18n.js
index be05beb..2c4d6ac 100644
--- a/i18n.js
+++ b/i18n.js
@@ -1,6 +1,466 @@
import { normalizeUiPreferences, resolveLocale } from "./preferences.js";
const EN = Object.freeze({
+ "PromptDirector|视觉创作灵感库": "PromptDirector | Visual Inspiration Library",
+ "视觉创作灵感库": "Visual Inspiration Library",
+ "返回视觉创作灵感库": "Back to Visual Inspiration Library",
+ "提示词导演,你的视觉创作私人灵感库。": "PromptDirector, your private visual inspiration library.",
+ "选择文件或文件夹,统一确认后导入": "Choose files or a folder, then review before importing",
+ "保存 YouTube、Vimeo 或来源网页": "Save a YouTube, Vimeo, or source page link",
+ "立即记下一段创作想法": "Quickly save a creative note",
+ "案例排序": "Sort cases",
+ "最近加入": "Recently added",
+ "标题": "Title",
+ "手动排序": "Manual order",
+ "回收站": "Recycle bin",
+ "关闭回收站": "Close recycle bin",
+ "全部恢复": "Restore all",
+ "清空回收站": "Empty recycle bin",
+ "回收站为空": "Recycle bin is empty",
+ "资料库名称": "Library name",
+ "资料库名称用于工作空间和导出文件,不会改变 PromptDirector 品牌名称。": "The library name is used for the workspace and exports. It does not change the PromptDirector brand name.",
+ "仅分类": "Category only",
+ "保存": "Save",
+ "AI 标签": "AI tags",
+ "已有 AI 标签": "Existing AI tags",
+ "添加 AI 标签": "Add an AI tag",
+ "媒体与来源": "Media and source",
+ "确认操作": "Confirm action",
+ "内容": "Content",
+ "操作失败,请重试": "The action failed. Try again.",
+ "仅项目": "Project only",
+ "资料库可见": "Show in library",
+ "仅项目可见": "Show only in project",
+ "仅删除项目": "Move project to recycle bin",
+ "删除项目及案例": "Move project and cases to recycle bin",
+ "在资料库中显示": "Show in library",
+ "仅在分类内显示": "Show only in category",
+ "{count} 项媒体": "{count} media items",
+ "还没有媒体": "No media yet",
+ "从本机添加图片、视频或文档": "Add images, videos, or documents from this device",
+ "从本机添加媒体": "Add media from this device",
+ "等待导入": "Waiting to import",
+ "导入完成": "Import complete",
+ "部分导入失败": "Some imports failed",
+ "导入已取消": "Import canceled",
+ "取消剩余项": "Cancel remaining items",
+ "编辑提示词": "Edit prompt",
+ "编辑当前图片提示词": "Edit current image prompt",
+ "编辑案例共享提示词": "Edit shared case prompt",
+ "当前图片提示词": "Current image prompt",
+ "当前图片 · 使用共享提示词": "Current image · Using shared prompt",
+ "完善分析": "Complete analysis",
+ "批量图片分析": "Analyze image set",
+ "选择项目": "Choose projects",
+ "已加入 {count} 个项目": "Added to {count} projects",
+ "未选择模型": "No model selected",
+ "兼容服务": "Compatible service",
+ "没有已连接且支持当前生成任务的模型": "No connected model supports this generation task",
+ "可同时应用多个 Skill;列表顺序就是本轮装配顺序。": "Apply multiple Skills together. Their list order is the assembly order for this run.",
+ "打开 Skill 中心": "Open Skill Center",
+ "还没有已保存的创作 Skill。": "No saved creative Skills yet.",
+ "查看与编辑": "View and edit",
+ "已应用": "Applied",
+ "应用 Skill": "Apply Skill",
+ "支持 YouTube、Vimeo、Bilibili、抖音和 X。这里只保存来源引用卡,不下载视频文件。": "Supports YouTube, Vimeo, Bilibili, Douyin, and X. This saves a source reference card without downloading the video file.",
+ "解析并保存": "Resolve and save",
+ "正在解析链接并保存…": "Resolving the link and saving…",
+ "视频网页地址": "Video page URL",
+ "标题和正文一次填写,保存后会作为资料文档显示在案例库。": "Add a title and body. The saved note appears in your library as a reference document.",
+ "保存笔记": "Save note",
+ "标题(可留空)": "Title (optional)",
+ "笔记正文": "Note",
+ "写下创作想法、判断或待办…": "Write down a creative idea, decision, or task…",
+ "例如:风格不错,很喜欢": "For example: strong style, favorite",
+ "下载本机副本": "Download local copy",
+ "保存当前帧": "Save current frame",
+ "保存文字": "Save text",
+ "全选": "Select all",
+ "分析视频": "Analyze video",
+ "复制文字": "Copy text",
+ "尚无分析记录。每次重跑都会保存为新版本。": "No analysis records yet. Each rerun is saved as a new version.",
+ "帖子文字": "Post text",
+ "打开来源": "Open source",
+ "提示词已修改,需要重新分析标签": "The prompt changed. Analyze its tags again.",
+ "播放器正在加载…": "Loading player…",
+ "无媒体": "No media",
+ "无法解码时用系统播放器打开": "Open in the system player if decoding fails",
+ "时间点笔记": "Timestamp notes",
+ "更多记录选项": "More note options",
+ "更新为 V2 提示词": "Update to V2 prompt",
+ "未定位媒体": "Unplaced media",
+ "未导入": "Not imported",
+ "本地媒体文件缺失;请从完整备份恢复": "The local media file is missing. Restore it from a complete backup.",
+ "来源信息": "Source details",
+ "查看": "View",
+ "添加时间笔记": "Add timestamp note",
+ "编辑文字": "Edit text",
+ "设为主要媒体": "Set as primary media",
+ "这个复合案例没有媒体": "This compound case has no media",
+ "这些媒体由你明确保存,但无法确认它们在原文中的位置。": "You explicitly saved this media, but its position in the source could not be confirmed.",
+ "这条案例还没有内容": "This case has no content yet",
+ "选择缺失/过期": "Select missing or outdated",
+ "保留本机链接": "Keep local link",
+ "创作源文件": "Creative source file",
+ "尚无本次分析事件": "No analysis events for this run",
+ "已移除案例": "Removed case",
+ "强制导入": "Import anyway",
+ "打开原帖观看视频": "Open the original post to watch the video",
+ "打开文档来源": "Open document source",
+ "打开查看文档内容": "Open to view document content",
+ "打开查看视频来源": "Open to view video source",
+ "打开视频来源": "Open video source",
+ "文章资源": "Article resource",
+ "未知服务": "Unknown service",
+ "未知模型": "Unknown model",
+ "未记录相对路径": "Relative path not recorded",
+ "本地副本已保存在案例媒体中": "A local copy is saved in the case media",
+ "本机源文件": "Local source file",
+ "本机链接": "Local link",
+ "来源暂时不可用": "Source temporarily unavailable",
+ "这个文档没有可显示的文字": "This document has no displayable text",
+ "这是归档源文件。PromptDirector 不会执行或内嵌打开它。": "This is an archived source file. PromptDirector will not execute it or open it inline.",
+ "这条帖子没有可显示的文字": "This post has no displayable text",
+ "这里只保存文件信息与本机授权。不会自动读取、上传、执行或内嵌源文件;导出分享包时会再次明确检查权限。": "Only file information and local authorization are saved. Source files are not read, uploaded, executed, or opened inline automatically. Permission is checked again when exporting a share package.",
+ "重新授权读取": "Authorize access again",
+ "重新链接源文件": "Relink source file",
+ "链接状态未知": "Link status unknown",
+ "链接可用": "Link available",
+ "源文件已变化,请确认后重新链接": "The source file changed. Confirm and relink it.",
+ "需要你重新授权读取": "Access authorization required",
+ "源文件已移动、改名或链接缺失": "The source file was moved, renamed, or is no longer linked",
+ "音频": "Audio",
+ "未命名文件": "Untitled file",
+ "“{source}”依赖 {dependencies}。PromptDirector 不会执行这些程序或工具,只能使用可读取的文字方法。": "“{source}” depends on {dependencies}. PromptDirector will not execute these programs or tools and can only use readable text instructions.",
+ "仍要导入": "Import anyway",
+ "以文字模式导入?": "Import in text-only mode?",
+ "分批提炼后汇总": "Extract in batches, then consolidate",
+ "删除 /{name}?": "Delete /{name}?",
+ "开始提炼": "Start extraction",
+ "恢复不会删除现有历史,而是复制为新的当前版本。": "Restoring keeps the existing history and copies this version into a new current version.",
+ "恢复这个版本?": "Restore this version?",
+ "提炼失败": "Extraction failed",
+ "文字服务": "Text service",
+ "无法读取 Skill 服务配置": "Could not read the Skill service configuration",
+ "服务错误": "Service error",
+ "未读取": "Not read",
+ "未配置": "Not configured",
+ "确认 Skill 提炼": "Confirm Skill extraction",
+ "视觉分析需要至少一张已选择的内容图": "Visual analysis requires at least one selected content image",
+ "请减少所选来源后再开始,当前没有发送任何内容": "Reduce the selected sources before starting. Nothing has been sent.",
+ "超量处理": "Over-limit handling",
+ "返回减少选择": "Go back and reduce selection",
+ "这个 Skill 及其版本会被永久删除。": "This Skill and all its versions will be permanently deleted.",
+ "提示词": "Prompt",
+ "分析主图": "Analyze primary image",
+ "重新分析主图": "Reanalyze primary image",
+ "编辑当前图片": "Edit current image",
+ "编辑共享提示词": "Edit shared prompt",
+ "添加视频链接": "Add video link",
+ "此媒体移入回收站": "Move this media to recycle bin",
+ "完整分析": "Complete analysis",
+ "分析主题": "Analyze subject",
+ "创建图片": "Create image",
+ "使用当前创作服务直接生成图片": "Create an image directly with the current creation service",
+ "读取手选原图与对应提示词": "Read selected original images and their prompts",
+ "未配置,前往分析设置": "Not configured. Open analysis settings",
+ "读取文字与手选原图,并按已配置能力创建图片或视频": "Read text and selected original images, then create an image or video with the configured capabilities",
+ "未配置,前往 AI 服务与任务分工": "Not configured. Open AI services and task assignments",
+ "使用已配置的 xAI 文字与图片能力": "Use the configured xAI text and image capabilities",
+ "规划不发送图片;多模态服务仅在最终装配时读取手选内容图。": "Planning does not send images. Multimodal services read selected content images only during final assembly.",
+ "生图": "Image",
+ "输入标签,按回车或逗号添加": "Enter a tag, then press Enter or comma",
+ "删除标签:{value}": "Remove tag: {value}",
+ "松开以检查本机资料": "Release to review local files",
+ "导入前可确认项目、重复项和画面分析": "Review projects, duplicates, and visual analysis before importing",
+ "拖入文件或文件夹": "Drop files or a folder",
+ "自动识别图片、视频、音频、字幕、文档和常用创作源文件;不支持的格式仍可保留本机链接": "Automatically recognize images, videos, audio, subtitles, documents, and common creative source files. Unsupported formats can still keep a local link.",
+ "导入后自动画面分析": "Analyze visuals automatically after import",
+ "采集权限": "Capture permissions",
+ "仅在你主动截图、采集网页或提取剪贴板时使用。": "Used only when you actively capture a screenshot, collect a page, or extract from the clipboard.",
+ "网页采集与截图": "Page capture and screenshots",
+ "剪贴板提取": "Clipboard extraction",
+ "备份、恢复或连接自己的同步文件夹。": "Back up, restore, or connect your own sync folder.",
+ "导入分享包": "Import share package",
+ "添加别人分享的案例或项目,不覆盖现有资料": "Add cases or projects shared by others without overwriting existing content",
+ "免费、开源、本地优先 · Apache-2.0": "Free, open source, and local-first · Apache-2.0",
+ "批量文字分析": "Batch text analysis",
+ "使用“文字工作”中已分配的供应商和模型;只处理未分析或原文已变化的文字案例。": "Use the provider and model assigned to Text Tasks. Only unanalyzed text cases or cases whose source text changed are processed.",
+ "分析诊断": "Analysis diagnostics",
+ "仅记录运行版本、阶段、标签数量、耗时和错误类别;不记录案例原文、API Key 或模型完整输出。": "Records only runtime version, stage, tag count, duration, and error category. Case text, API keys, and complete model output are never recorded.",
+ "重建标签系统": "Rebuild tag system",
+ "付费重跑全部文字案例;结果先暂存,全部成功后一次切换,并可完整撤回。": "Rerun all text cases as a paid operation. Results are staged, switched only after all succeed, and can be fully rolled back.",
+ "资料索引自动补全": "Automatic library index completion",
+ "每次导入后会在本机自动补齐内容类型和图片色卡,不调用 AI。这里可查看状态或重试失败项。": "After each import, content types and image palettes are completed locally without AI. View status or retry failed items here.",
+ "已保存的创作 Skill": "Saved creative Skills",
+ "可同时应用多个,并按当前顺序执行。": "Apply multiple Skills together in the current order.",
+ "这里显示本轮实际采用的 Agent、任务方法和资料。": "Shows the Agent, task method, and sources actually used for this run.",
+ "公开投稿": "Public submission",
+ "投稿与普通导出相互独立。这里只生成可公开审核的纯文本快照,不包含脚本、二进制文件或默认的私人来源记录。": "Submission is separate from regular export. This creates only a publicly reviewable text snapshot, without scripts, binary files, or private source records by default.",
+ "公开署名": "Public attribution",
+ "公开摘要": "Public summary",
+ "允许其他用户在保留署名的前提下保存、使用和修改。": "Allow others to save, use, and modify it while retaining attribution.",
+ "了解公开使用规则": "Learn about public-use terms",
+ "投稿采用 CC BY 4.0:其他用户必须保留你的公开署名,并可保存、使用和修改这份 Skill。": "Submissions use CC BY 4.0. Others must retain your public attribution and may save, use, and modify this Skill.",
+ "需要先处理的隐私风险": "Privacy risks to resolve first",
+ "最终投稿文件与全文": "Final submission files and full text",
+ "提示词导演采集台": "PromptDirector Collector",
+ "目标案例": "Target case",
+ "本次统一开启网页读取与截图能力,只在你主动采集时使用;不会自动保存案例。": "This enables page reading and screenshots together for active capture only. Cases are never saved automatically.",
+ "同时开启剪贴板提取": "Also enable clipboard extraction",
+ "可取消;仅在你主动点击“提取文字/图片”且网页没有高亮内容时读取。": "Optional. The clipboard is read only when you actively choose Extract text/image and the page has no highlighted content.",
+ "你首次授权时取消了剪贴板读取。只有确认此操作后,才会读取当前剪贴板中的文字或图片。": "You declined clipboard access during initial permission. Current clipboard text or images are read only after you confirm this action.",
+ "启用后仍只会在你主动点击“提取文字/图片”且网页没有可用高亮时读取;打开侧栏、浏览或点击网页不会触发读取。": "After enabling, the clipboard is still read only when you actively choose Extract text/image and no usable highlight exists. Opening the panel, browsing, or clicking the page never triggers a read.",
+ "修正识别结果": "Correct detection",
+ "同一列表批量采集": "Batch capture from the same list",
+ "先确认上方一个代表案例,再输入目标数量。只滚动、加载当前列表或沿列表翻页,不进入详情页。": "Confirm one representative case above, then enter a target count. PromptDirector only scrolls, loads the current list, or follows list pagination without opening detail pages.",
+ "目标案例数": "Target case count",
+ "批量保存方式": "Batch save method",
+ "保存形态": "Save format",
+ "合并案例标题": "Combined case title",
+ "保存的图片与视频": "Images and videos to save",
+ "智能选图进行中": "Smart visual selection in progress",
+ "待保存内容": "Content to save",
+ "新项目名称": "New project name",
+ "智能选图无法识别?": "Smart visual selection missed something?",
+ "修改案例标题": "Edit case title",
+ "文字内容": "Text content",
+ "图片内容": "Image content",
+ "这个来源已经保存过": "This source has already been saved",
+ "有可用更新": "Update available",
+ "管理项目顺序": "Manage project order",
+ "调整项目侧栏宽度": "Resize project sidebar",
+ "管理案例顺序": "Manage case order",
+ "关闭分享": "Close sharing",
+ "关闭导入": "Close import",
+ "导入摘要": "Import summary",
+ "选择已有项目或输入新项目名": "Choose an existing project or enter a new project name",
+ "待导入文件": "Files to import",
+ "切换案例": "Navigate cases",
+ "设置视图": "Settings view",
+ "AI 配置视图": "AI configuration view",
+ "已应用 Skill": "Applied Skills",
+ "本轮检索来源": "Sources retrieved for this run",
+ "临时附件": "Temporary attachments",
+ "选择创作 Skill": "Choose creative Skills",
+ "参考类型": "Reference type",
+ "取消本轮": "Cancel this run",
+ "精选案例排序": "Sort curated cases",
+ "从当前网页采集": "Capture from current page",
+ "主体区域确认": "Primary-region confirmation",
+ "请输入数量": "Enter a quantity",
+ "默认使用列表页标题": "Use the list page title by default",
+ "关闭媒体预览": "Close media preview",
+ "输入后会在保存案例时创建": "Created when the case is saved",
+ "默认使用来源网页标题": "Use the source page title by default",
+ "已选 0": "0 selected",
+ "全选筛选结果": "Select all filtered results",
+ "选择文件": "Choose files",
+ "选择整个文件夹": "Choose entire folder",
+ "上次导入 · 查看": "Last import · View",
+ "正在检查文件…": "Checking files…",
+ "正在导入": "Importing",
+ "撤销本次导入": "Undo this import",
+ "查看导入项目": "View imported project",
+ "开始导入": "Start import",
+ "正在检查…": "Checking…",
+ "这里不会读取剪贴板。撤销后,下次主动使用对应采集功能时会重新说明用途并由你确认。": "The clipboard is not read here. After revoking access, the next active use of the related capture feature will explain its purpose and ask for confirmation again.",
+ "0 个案例 · 0 张图片": "0 cases · 0 images",
+ "备份资料库": "Back up library",
+ "恢复资料库": "Restore library",
+ "备份会把案例和本地媒体逐项写入资料夹;恢复前会先检查内容,不会覆盖现有资料。": "Backup writes cases and local media to a folder one item at a time. Restore checks contents first and never overwrites existing material.",
+ "连接和解锁只验证文件夹与密码,不会读取、合并或上传资料。只有你再次确认“立即同步”后,才会执行一次同步。": "Connect and unlock only verify the folder and password; they do not read, merge, or upload content. A one-time sync runs only after you confirm Sync now.",
+ "停止同步": "Stop sync",
+ "正在确认安装方式…": "Checking installation method…",
+ "最近检查:—": "Last checked: —",
+ "可用版本:—": "Available version: —",
+ "商店版由 Chrome 自动更新;本地开发版可安全重载当前目录。": "Chrome updates the store version automatically. A local development build can safely reload the current directory.",
+ "下载新版本": "Download new version",
+ "复制诊断日志": "Copy diagnostic log",
+ "预览重建费用": "Preview rebuild cost",
+ "确认付费并重建": "Confirm charge and rebuild",
+ "开始补全": "Start completion",
+ "先按任务选择默认服务;API Key 只需在连接服务时填写一次。": "Choose the default service by task. Enter an API key only once when connecting a service.",
+ "0 个案例 · 0 次图片请求": "0 cases · 0 image requests",
+ "一键整理三级标签": "Organize three-level tags",
+ "一级维度固定;可在下方维护二级分组和三级标签。": "Top-level dimensions are fixed. Maintain second-level groups and third-level tags below.",
+ "兼容视觉服务": "Compatible visual service",
+ "只选择本次对话需要借鉴的案例,不会修改案例库或 Skill。": "Choose only the cases needed for this conversation. The library and Skills are not modified.",
+ "当前模型无法读取图片": "The current model cannot read images",
+ "本轮包含尚未分析的临时图片。请选择视觉创作服务,或明确调用当前图片分析服务后继续。": "This run contains temporary images that have not been analyzed. Choose a visual creation service, or explicitly run the current image-analysis service before continuing.",
+ "选择视觉创作服务": "Choose visual creation service",
+ "调用图片分析并继续": "Analyze images and continue",
+ "生成并检查公开快照": "Generate and review public snapshot",
+ "下载投稿包并打开 GitHub": "Download submission package and open GitHub",
+ "退出": "Exit",
+ "暂不授权": "Not now",
+ "授权并继续": "Allow and continue",
+ "保持关闭": "Keep disabled",
+ "启用并提取": "Enable and extract",
+ "重新扫描": "Scan again",
+ "确认一个主体后即可保存;需要时再展开预览或修正识别结果。": "Confirm one primary item to save. Expand the preview or correct detection only when needed.",
+ "取消确认": "Clear confirmation",
+ "添加遗漏": "Add missed content",
+ "排除错误": "Exclude incorrect content",
+ "恢复识别": "Restore detection",
+ "按这个样本继续采集": "Continue capturing from this sample",
+ "请选择": "Choose",
+ "分别保存多个案例": "Save as separate cases",
+ "合并为一个案例": "Combine into one case",
+ "当前方案 0 项": "0 items in current plan",
+ "保存为一个案例": "Save as one case",
+ "媒体 0 / 0": "Media 0 / 0",
+ "媒体预览": "Media preview",
+ "上一项": "Previous item",
+ "下一项": "Next item",
+ "请在网页中拖动选择画面;操作状态会持续显示在这里。": "Drag on the page to select a visual. Progress remains visible here.",
+ "取消框选": "Cancel region capture",
+ "直接点击网页中的画面,可多选;确认操作留在这里。": "Click visuals on the page to select multiple items. Confirm the selection here.",
+ "+ 智能选图": "+ Smart visual selection",
+ "+ 框选截图": "+ Region screenshot",
+ "编辑与整理": "Edit and organize",
+ "添加到原案例": "Add to existing case",
+ "仍然新建": "Create separately",
+ "确认导入": "Review import",
+ "可导入": "Importable",
+ "跳过": "Skipped",
+ "重复": "Duplicates",
+ "预计占用": "Estimated size",
+ "一次授权,之后直接采集": "Allow once, then capture directly",
+ "启用剪贴板提取?": "Enable clipboard extraction?",
+ "已选 0 张": "0 images selected",
+ "已选 {count} 张": "{count} images selected",
+ "导入本机资料": "Import local materials",
+ "导入任务": "Import job",
+ "选择要保存的内容": "Choose content to save",
+ "正在启动框选…": "Starting region capture…",
+ "断开同步文件夹?": "Disconnect sync folder?",
+ "本地案例不会删除。": "Local cases will not be deleted.",
+ "断开": "Disconnect",
+ "{count} 页": "{count} pages",
+ "上移案例:{title}": "Move case up: {title}",
+ "下移案例:{title}": "Move case down: {title}",
+ "已将 {project} 移动到第 {position} 位": "Moved {project} to position {position}",
+ "重命名项目": "Rename project",
+ "其中案例仍会保留在资料库,可从回收站恢复项目。": "Its cases remain in the library, and the project can be restored from the recycle bin.",
+ "以所选案例新建项目": "Create project from selected cases",
+ "新建并加入": "Create and add",
+ "安装方式暂不可用": "Installation method unavailable",
+ "重新打开设置时会再次读取更新状态。": "Update status will be checked again when Settings is reopened.",
+ "最近检查:{time}": "Last checked: {time}",
+ "可用版本:{version}": "Available version: {version}",
+ "管理分类": "Manage categories",
+ "由你选择新的本机文件;确认后更新文件名、大小、格式与修改时间": "Choose a new local file. After confirmation, its name, size, format, and modification time will be updated.",
+ "{provider} 外部视频播放器": "{provider} external video player",
+ "播放器响应超时,可重试或打开来源": "The player timed out. Retry or open the source.",
+ "可以播放": "Ready to play",
+ "{provider} 播放器响应超时,可打开来源": "The {provider} player timed out. Open the source instead.",
+ "播放器已加载": "Player loaded",
+ "记录这个画面、动作变化或提示词用法": "Note this visual, action change, or prompt technique",
+ "时间(秒)": "Time (seconds)",
+ "片段结束秒数(可选)": "Clip end time in seconds (optional)",
+ "输入新项目名称": "Enter a new project name",
+ "只保存文件信息与授权句柄,不复制或执行源文件;分享时才读取源文件": "Save only file metadata and the permission handle. The source file is not copied or executed and is read only when sharing.",
+ "忽略这项限制并再次检查;可能占用更多本机空间": "Ignore this limit and check again. This may use more local storage.",
+ "{imported} 已导入 · {skipped} 已跳过 · {failed} 失败": "{imported} imported · {skipped} skipped · {failed} failed",
+ "将发送 {count} 次图片分析请求 · {summary}": "Will send {count} image-analysis requests · {summary}",
+ "1 次纯文字总结": "1 text-only summary",
+ "不生成整组总结": "No group summary",
+ "正在分析…": "Analyzing…",
+ "本次已完成": "Completed this run",
+ "失败 · {message}": "Failed · {message}",
+ "{failed} 张失败,已成功 {completed} 张且不会重复请求。可直接重试失败项。": "{failed} images failed. {completed} succeeded and will not be requested again. You can retry only the failed items.",
+ "待确认 {count}": "{count} to review",
+ "归档这些标签?": "Archive these tags?",
+ "确认归档": "Archive",
+ "当前没有需要整理的三级标签组。": "There are no third-level tag groups to organize.",
+ "正在整理 {current}/{total}…": "Organizing {current}/{total}…",
+ "{message} · 输入 {input} / 输出 {output} tokens": "{message} · input {input} / output {output} tokens",
+ "正在检查本机资料…": "Checking local library…",
+ "资料索引已完整": "Library index is complete",
+ "{status} · 已处理 {processed}/{total} · 成功 {succeeded} · 失败 {failed}": "{status} · processed {processed}/{total} · {succeeded} succeeded · {failed} failed",
+ "永久删除": "Delete permanently",
+ "正在撤销权限…": "Revoking permission…",
+ "移除临时附件": "Remove temporary attachment",
+ "提高 Skill 优先级": "Increase Skill priority",
+ "降低 Skill 优先级": "Decrease Skill priority",
+ "移除 /{callName}": "Remove /{callName}",
+ "本轮有 {count} 张尚未分析的参考图片,但 {service} 只能读取文字。可切换到视觉创作服务;也可调用当前图片分析服务({analysisService}),预计发起 {count} 次额外请求,费用由服务商按你的账号计费。": "This run has {count} unanalyzed reference images, but {service} can read only text. Switch to a visual creation service, or use the current image-analysis service ({analysisService}). This is expected to send {count} additional requests billed by the provider to your account.",
+ "正在通过当前图片分析服务处理 {count} 张图片。完成前不会发送本轮消息,也不会更换创作模型。": "Processing {count} images with the current image-analysis service. This message will not be sent and the creation model will not change until analysis finishes.",
+ "重新发起付费请求?": "Retry paid request?",
+ "上一次请求可能已经产生费用。重试会创建一个新任务,并可能再次计费。": "The previous request may already have incurred a charge. Retrying creates a new task and may charge again.",
+ "继续重试": "Retry anyway",
+ "所选模型最多接收 {maximum} 张参考图;当前 {count} 张。选择已保留,请减少后再应用。": "The selected model accepts up to {maximum} reference images; {count} are selected. Your selection is preserved. Remove some images before applying.",
+ "导出对话诊断?": "Export conversation diagnostics?",
+ "诊断包会包含当前对话、所选参考文字和输出结果,但不会包含 API Key。": "The diagnostic package includes the current conversation, selected reference text, and outputs, but never API keys.",
+ "导出": "Export",
+ "删除生成结果?": "Delete generated result?",
+ "正在等待 Chrome 确认…": "Waiting for Chrome confirmation…",
+ "未获得所选权限,待保存内容没有改变。你可以调整选择后重试。": "The selected permissions were not granted. Content waiting to be saved is unchanged; adjust the selection and retry.",
+ "未获得剪贴板读取权限,未读取任何内容。": "Clipboard read permission was not granted, and no content was read.",
+ "重新检查": "Check again",
+ "清空待保存内容?": "Clear unsaved content?",
+ "当前尚未保存的文字和图片会被移除,这项操作无法撤回。": "Unsaved text and images will be removed. This cannot be undone.",
+ "待保存内容已清空": "Unsaved content cleared",
+ "无法清空": "Could not clear unsaved content",
+ "请切回网页拖动选择画面;按 Esc 或在这里取消。": "Return to the page and drag to select an area. Press Esc or cancel here.",
+ "请保持当前网页与侧边栏打开,完成后会自动回到待保存内容。": "Keep the current page and side panel open. You will return to the unsaved content when capture finishes.",
+ "框选已启动,请在网页中拖拽选择画面;按 Esc 取消。": "Region capture is active. Drag on the page to select an area; press Esc to cancel.",
+ "正在申请截图权限…": "Requesting screenshot permission…",
+ "正在截取并保存所选画面…": "Capturing and saving the selected area…",
+ "截图已保存": "Screenshot saved",
+ "已取消框选截图": "Region capture canceled",
+ "框选截图失败": "Region capture failed",
+ "正在准备框选截图…": "Preparing region capture…",
+ "当前页面没有成功显示选图层,请退出网页元素全屏后重试。": "The selection overlay could not be shown. Exit element fullscreen on the page and try again.",
+ "不分组": "No project",
+ "+ 新建项目": "+ New project",
+ "收起整理": "Collapse organization",
+ "使用箭头调整段落顺序": "Use the arrows to reorder text",
+ "使用箭头调整图片顺序": "Use the arrows to reorder images",
+ "当前网页": "Current page",
+ "主图": "Primary image",
+ "图片 {count}": "Image {count}",
+ "{count} 张图片": "{count} images",
+ "米醋": "Micu",
+ "网页中识别到 {count} 个候选;点击画面选择,页面滚动或布局变化后会自动重新对齐。": "Found {count} candidates on the page. Click visuals to select them; alignment updates automatically after scrolling or layout changes.",
+ "识别到 {count} 个可保存区域 · 已选 {selected} 个": "Found {count} savable regions · {selected} selected",
+ " · {count} 个结构不同的案例未自动加入,请单独确认。": " · {count} structurally different cases were not added automatically. Review them separately.",
+ "结构需复核": "Structure needs review",
+ "预览完整内容": "Preview full content",
+ "页面截图": "Page screenshot",
+ "排除": "Exclude",
+ "视频生成只在视频任务中显示": "Video generation is available only for video tasks",
+ "当前服务没有声明可用的视频生成能力": "The current service does not declare video-generation capability",
+ "当前服务未声明可用的视频生成能力": "The current service does not declare video-generation capability",
+ "当前视频模型不接收原图": "The current video model does not accept original images",
+ "将首张参考图作为视频起始参考": "Use the first reference image as the video's starting reference",
+ "由当前视频服务直接生成并下载到本机临时结果": "Generate directly with the current video service and download to temporary local results",
+ "视频创作只输出提示词": "Video creation outputs prompts only",
+ "当前服务只输出文字提示词": "The current service outputs text prompts only",
+ "xAI 创建图片还缺少 API Key、文字模型或图片模型": "xAI image creation still needs an API key, text model, or image model",
+ "当前 xAI 生图接口未声明参考图输入;请移除图片参考或改用其他服务": "The current xAI image API does not declare reference-image input. Remove image references or use another service.",
+ "由 xAI 直接创建图片并保存到本轮结果": "Create directly with xAI and save to this run",
+ "OpenRouter 生图还缺少已声明图片输出能力的模型、API Key 或发送授权": "OpenRouter image generation still needs a model with declared image output, an API key, or send permission",
+ "当前 OpenRouter 独立图片接口不能在整理提示词阶段读取原图;请选择带图生成或全程纯文字": "The current standalone OpenRouter image API cannot read originals while preparing the prompt. Choose generation with original images or an entirely text-only flow.",
+ "所选 OpenRouter 模型未声明参考图输入能力": "The selected OpenRouter model does not declare reference-image input",
+ "由 OpenRouter 独立图片接口生成;不会静默改用其他模型": "Generate through OpenRouter's standalone image API without silently switching models",
+ "Gemini 生图还缺少已分配的 Nano Banana 模型、API Key 或发送授权": "Gemini image generation still needs an assigned Nano Banana model, an API key, or send permission",
+ "所选 Gemini 图片模型未声明参考图输入能力": "The selected Gemini image model does not declare reference-image input",
+ "由 Google Gemini 官方 Interactions 接口直接生成;不会静默改用其他模型": "Generate directly through Google's official Gemini Interactions API without silently switching models",
+ "所选 OpenAI 模型明确不支持原图参考;请选择最终生图不垫图或全程纯文字": "The selected OpenAI model explicitly does not support original-image references. Choose final generation without reference images or an entirely text-only flow.",
+ "由 OpenAI 直接生成并保存到本轮结果": "Generate directly with OpenAI and save to this run",
+ "创建图片还缺少 OpenAI API Key 或模型": "Image creation still needs an OpenAI API key or model",
+ "创建图片还缺少兼容服务的接口、模型或 API Key": "Image creation still needs a compatible-service endpoint, model, or API key",
+ "当前图片模型明确不接收原图;请选择最终生图不垫图或全程纯文字": "The current image model explicitly does not accept original images. Choose final generation without reference images or an entirely text-only flow.",
+ "带参考图创建还缺少图片编辑接口": "Reference-image creation still needs an image-editing endpoint",
+ "米醋参考图模式最高支持 2K,请调整本轮输出尺寸": "Micu reference-image mode supports up to 2K. Adjust this run's output size.",
+ "当前服务没有配置可用的生图协议": "The current service has no usable image-generation protocol configured",
+ "创建图片还缺少生图接口": "Image creation still needs an image-generation endpoint",
+ "创建图片还缺少生图 API Key": "Image creation still needs an image-generation API key",
+ "创建图片还缺少生图模型": "Image creation still needs an image-generation model",
+ "创建图片还缺少服务支持的尺寸选项": "Image creation still needs size options supported by the service",
+ "当前服务未声明可用的图片生成能力": "The current service does not declare image-generation capability",
"创作 Skill 中心": "Creative Skill Center",
"创作 Skill": "Creative Skills",
"搜索 Skill": "Search Skills",
@@ -295,15 +755,10 @@ const EN = Object.freeze({
"网页内容保存失败": "Web content could not be saved",
"{message};{count} 项存在媒体下载问题": "{message}; {count} items have media download issues",
"跨网页截图权限没有生效,请返回侧边栏重新授权;当前草稿没有改变。": "Cross-page screenshot access is not active. Return to the side panel and grant access again. Your draft has not changed.",
- "视觉提示词灵感库": "Visual Prompt Archive",
- "视觉灵感库": "Visual Archive",
- "提示词导演灵感库": "PromptDirector Visual Archive",
- "收藏网页画面和提示词,整理成可复用的本地灵感库。": "Save web visuals with their prompts in a reusable local archive.",
"本地案例": "Local cases",
"最近保存": "Latest save",
"从当前网页收藏": "Save from this page",
"图片仅保存在本机": "Images stay on this device",
- "打开视觉灵感库": "Open visual archive",
"撤回刚才保存": "Undo recent save",
"本地资料库": "Local library",
"资料库标题": "Library title",
@@ -328,6 +783,7 @@ const EN = Object.freeze({
"搜索画面、提示词,或输入 type:video…": "Search visuals or prompts, or enter type:video...",
"选择后再决定如何使用": "Choose an action after selecting",
"选择目标项目": "Choose a target project",
+ "加入项目": "Add to project",
"加入项目…": "Add to project...",
"加入": "Add",
"组合": "Combine",
@@ -353,6 +809,7 @@ const EN = Object.freeze({
"选中当前筛选": "Select filtered",
"选中全部可分析": "Select all analyzable",
"清空已选": "Clear selection",
+ "移入回收站": "Move to recycle bin",
"界面与资料库": "Interface and library",
"任务与维护": "Tasks and maintenance",
"AI 服务": "AI services",
@@ -369,6 +826,8 @@ const EN = Object.freeze({
"分享案例": "Share cases",
"从图片墙选择几个案例": "Select cases from the visual wall",
"组合案例": "Combine cases",
+ "至少选择 2 个案例": "Select at least 2 cases",
+ "所选案例中没有可分析的图片": "The selected cases contain no analyzable images",
"把多个步骤整理成一个可拆分案例": "Organize multiple steps as one reversible case",
"整理内容": "Organize content",
"回来源继续采集": "Return to source and continue capturing",
@@ -538,6 +997,29 @@ const EN = Object.freeze({
"正在保存": "Saving",
"浏览器未允许复制,请选中文本后复制": "Clipboard access was not granted. Select the text and copy it manually.",
"检查更新": "Check for updates",
+ "状态不可用": "Status unavailable",
+ "本地开发版 · 手动替换代码": "Local development build · Replace files manually",
+ "商店版 · Chrome 自动更新": "Chrome Web Store build · Automatic updates",
+ "重新载入目录": "Reload directory",
+ "应用更新并重启": "Apply update and restart",
+ "设置,有可用更新": "Settings, update available",
+ "设置 · {status}": "Settings · {status}",
+ "已下载,可应用": "Downloaded, ready to apply",
+ "发现新版本": "New version available",
+ "检查失败": "Check failed",
+ "已是最新": "Up to date",
+ "刚刚检查过": "Just checked",
+ "自动更新": "Automatic updates",
+ "发现新的 GitHub Release。扩展无法自行覆盖本机目录;请从链接下载并替换代码,再安全重载。固定 ID 升级无需导出、导入案例。": "A new GitHub Release is available. The extension cannot overwrite its local directory. Download and replace the files, then reload safely. A fixed-ID upgrade does not require exporting or importing cases.",
+ "本地开发版不会被扩展自行覆盖。安全重载只会重新载入当前目录,不会下载或安装新版本;固定 ID 升级无需导出、导入案例。": "A local development build cannot overwrite itself. Safe reload only reloads the current directory; it does not download or install a new version. A fixed-ID upgrade does not require exporting or importing cases.",
+ "新版本已由 Chrome 下载。立即应用会关闭当前资料库页面并重启扩展;案例和素材不会丢失。": "Chrome has downloaded the new version. Applying it now will close this library page and restart the extension. Your cases and materials will remain safe.",
+ "商店版由 Chrome 自动更新,无需反复下载插件;更新下载完成后也可以在这里立即应用。": "Chrome updates the Web Store build automatically, so you do not need to download the extension repeatedly. Once an update is downloaded, you can apply it here immediately.",
+ "发现新版本,可打开 Release 下载。": "A new version is available. Open the Release page to download it.",
+ "新版本已下载,可以立即应用。": "The new version is downloaded and ready to apply.",
+ "刚刚检查过,已保留最近结果。": "Just checked. The latest result is shown.",
+ "已是最新版本。": "You are using the latest version.",
+ "已授权": "Allowed",
+ "未授权": "Not allowed",
"人工筛选的高价值视觉案例": "High-value visual cases selected by editors",
"安装后可在资料库中编辑。": "Edit installed cases in your library.",
"相似资料": "Similar cases",
@@ -1507,7 +1989,32 @@ export function translateUiMessage(value) {
const source = String(value ?? "");
if (activeLocale !== "en" || !source) return source;
if (EN[source]) return EN[source];
+ if (source.includes(";")) return source.split(";").map((part) => translateUiMessage(part)).join("; ");
const rules = [
+ [/^米醋( · .+)?$/, "Micu$1"],
+ [/^1 段文字$/, "1 text excerpt"],
+ [/^(\d+) 段文字$/, "$1 text excerpts"],
+ [/^1 张图片$/, "1 image"],
+ [/^(\d+) 张图片$/, "$1 images"],
+ [/^(\d+) 段文字 · (\d+) 张图片$/, "$1 text excerpts · $2 images"],
+ [/^已加入 · 共 (\d+) 段文字 \/ (\d+) 张图片$/, "Added · $1 text excerpts / $2 images"],
+ [/^正在补充《(.+)》$/, "Adding to “$1”"],
+ [/^删除第 (\d+) 段文字$/, "Remove text excerpt $1"],
+ [/^删除第 (\d+) 张图片$/, "Remove image $1"],
+ [/^上移第 (\d+) 段文字$/, "Move text excerpt $1 up"],
+ [/^下移第 (\d+) 段文字$/, "Move text excerpt $1 down"],
+ [/^上移第 (\d+) 张图片$/, "Move image $1 up"],
+ [/^下移第 (\d+) 张图片$/, "Move image $1 down"],
+ [/^设第 (\d+) 张图片为主图$/, "Set image $1 as primary"],
+ [/^由 米醋 直接生成并保存到本轮结果$/, "Generate directly with Micu and save to this run"],
+ [/^方形 · (.+)$/, "Square · $1"],
+ [/^横向 · (.+)$/, "Landscape · $1"],
+ [/^纵向 · (.+)$/, "Portrait · $1"],
+ [/^当前视频服务最多接收 (\d+) 张首帧参考图$/, "The current video service accepts at most $1 first-frame reference images"],
+ [/^当前有 (\d+) 张参考图,所选 Gemini 模型最多读取 (\d+) 张,请先减少参考$/, "There are $1 reference images, but the selected Gemini model accepts at most $2. Remove some references first."],
+ [/^当前有 (\d+) 张参考图,所选模型最多读取 (\d+) 张,请先减少参考$/, "There are $1 reference images, but the selected model accepts at most $2. Remove some references first."],
+ [/^由 (.+) 直接生成并保存到本轮结果$/, "Generate directly with $1 and save to this run"],
+ [/^(.+)“(.+)”不受当前服务支持$/, "$1 “$2” is not supported by the current service"],
[/^(\d+) 个案例$/, "$1 cases"],
[/^筛选 (\d+)$/, "$1 filters"],
[/^选中当前筛选((\d+))$/, "Select filtered ($1)"],
diff --git a/lib.js b/lib.js
index db7cc27..ad9f648 100644
--- a/lib.js
+++ b/lib.js
@@ -18,19 +18,48 @@ import { normalizeCompoundCases } from "./compound-cases.js";
import { CURRENT_LIBRARY_PACKAGE_VERSION, LIBRARY_PACKAGE_FORMAT } from "./library-package-format.js";
export const DEFAULT_SETTINGS = Object.freeze({
- libraryTitle: "我的视觉灵感库",
+ libraryTitle: "视觉创作灵感库",
outputPath: "提示词导演/提示词导演-灵感库.zip"
});
export const DEFAULT_SETTINGS_EN = Object.freeze({
- libraryTitle: "My Visual Archive",
+ libraryTitle: "Visual Inspiration Library",
outputPath: "PromptDirector/PromptDirector-Visual-Archive.zip"
});
+const LEGACY_DEFAULT_LIBRARY_TITLES = new Set([
+ "优秀提示词案例库",
+ "视觉创作资料库",
+ "视觉提示词灵感库",
+ "提示词导演灵感库",
+ "Visual Creative Archive",
+ "Visual Creation Library",
+ "My Visual Archive"
+]);
+
+const SYSTEM_DEFAULT_LIBRARY_TITLES = new Set([
+ DEFAULT_SETTINGS.libraryTitle,
+ DEFAULT_SETTINGS_EN.libraryTitle,
+ ...LEGACY_DEFAULT_LIBRARY_TITLES
+]);
+
export function defaultSettingsForLocale(locale) {
return locale === "en" ? DEFAULT_SETTINGS_EN : DEFAULT_SETTINGS;
}
+export function libraryTitleForLocale(value, locale) {
+ const title = String(value ?? "").trim();
+ return !title || SYSTEM_DEFAULT_LIBRARY_TITLES.has(title)
+ ? defaultSettingsForLocale(locale).libraryTitle
+ : title;
+}
+
+export function libraryTitleForStorage(displayValue, storedValue, locale) {
+ const displayedTitle = String(displayValue ?? "").trim();
+ const storedTitle = String(storedValue ?? "").trim();
+ return displayedTitle === libraryTitleForLocale(storedTitle, locale) ? storedTitle : displayedTitle;
+}
+
export const SCREENSHOT_SETTINGS = Object.freeze({
maxOutputWidth: 1600,
mimeType: "image/webp",
@@ -67,7 +96,8 @@ export function normalizeOutputPath(value, fallback = DEFAULT_SETTINGS.outputPat
}
export function normalizeSettings(value = {}, defaults = DEFAULT_SETTINGS) {
- const title = String(value.libraryTitle ?? "").trim();
+ const storedTitle = String(value.libraryTitle ?? "").trim();
+ const title = LEGACY_DEFAULT_LIBRARY_TITLES.has(storedTitle) ? defaults.libraryTitle : storedTitle;
return {
libraryTitle: title || defaults.libraryTitle,
outputPath: normalizeOutputPath(value.outputPath, defaults.outputPath)
@@ -178,12 +208,13 @@ export function renderMarkdown(
) {
const locale = options.locale === "en" ? "en" : "zh-CN";
const normalizedSettings = normalizeSettings(settings);
+ const libraryTitle = libraryTitleForLocale(normalizedSettings.libraryTitle, locale);
const normalizedTaxonomy = normalizeTaxonomy(taxonomy);
const normalizedFacets = normalizeFacetCatalog(facetCatalog);
const sections = entries.map((entry, index) => renderEntry(entry, index, normalizedTaxonomy, normalizedFacets, locale));
const introduction = locale === "en"
- ? [`# ${escapeHeading(normalizedSettings.libraryTitle)}`, "", `${entries.length} cases.`]
- : [`# ${escapeHeading(normalizedSettings.libraryTitle)}`, "", `共 ${entries.length} 条案例。`];
+ ? [`# ${escapeHeading(libraryTitle)}`, "", `${entries.length} cases.`]
+ : [`# ${escapeHeading(libraryTitle)}`, "", `共 ${entries.length} 条案例。`];
return `${[...introduction, ...sections].join("\n")}\n`;
}
diff --git a/library-maintenance.js b/library-maintenance.js
index 567f403..f724c63 100644
--- a/library-maintenance.js
+++ b/library-maintenance.js
@@ -51,6 +51,25 @@ export function normalizeLibraryMaintenanceJob(value) {
return job;
}
+export function extendLibraryMaintenanceJob(currentValue, targets = {}, options = {}) {
+ const current = normalizeLibraryMaintenanceJob(currentValue);
+ if (!current || ["completed", "canceled"].includes(current.status)) {
+ return createLibraryMaintenanceJob({ ...targets, id: options.id, now: options.now });
+ }
+ const processedClassifications = new Set(current.classificationEntryIds.slice(0, current.classificationCursor));
+ const processedPalettes = new Set(current.paletteAssetIds.slice(0, current.paletteCursor));
+ current.classificationEntryIds = uniqueIds([
+ ...current.classificationEntryIds,
+ ...uniqueIds(targets.classificationEntryIds).filter((id) => !processedClassifications.has(id))
+ ]);
+ current.paletteAssetIds = uniqueIds([
+ ...current.paletteAssetIds,
+ ...uniqueIds(targets.paletteAssetIds).filter((id) => !processedPalettes.has(id))
+ ]);
+ current.updatedAt = validDate(options.now) || new Date().toISOString();
+ return current;
+}
+
export function nextLibraryMaintenanceItem(value) {
const job = requireJob(value);
if (job.status !== "running") return null;
@@ -114,7 +133,10 @@ export function mergeLibraryMaintenanceProgress(currentValue, progressValue) {
const current = normalizeLibraryMaintenanceJob(currentValue);
const progress = normalizeLibraryMaintenanceJob(progressValue);
if (!progress || !current || current.id !== progress.id) return current;
+ progress.classificationEntryIds = uniqueIds([...progress.classificationEntryIds, ...current.classificationEntryIds]);
+ progress.paletteAssetIds = uniqueIds([...progress.paletteAssetIds, ...current.paletteAssetIds]);
if (current.status !== "running") progress.status = current.status;
+ else if (maintenanceProcessed(progress) < maintenanceTotal(progress)) progress.status = "running";
return progress;
}
diff --git a/library.css b/library.css
index fbac37d..9c4f65f 100644
--- a/library.css
+++ b/library.css
@@ -3,6 +3,7 @@
--visual-card-radius: 2px;
}
+html { scrollbar-gutter: stable; }
html.detail-open, html.detail-open body { overflow: hidden; }
.library-loading { position: fixed; z-index: 100; inset: 0; min-height: 100vh; overflow: hidden; color: var(--muted); background: var(--paper); }
@@ -16,7 +17,7 @@ body[data-library-state="loading"] > :not(.library-loading) { visibility: hidden
body[data-library-state="loading"] { overflow: hidden; }
body[data-library-state="ready"] > .library-loading { display: none; }
-.eyebrow { margin: 0 0 4px; color: var(--accent); font-size: 10px; font-weight: 850; letter-spacing: 0.17em; }
+.eyebrow { margin: 0 0 4px; color: var(--accent-ink); font-size: 10px; font-weight: 850; letter-spacing: 0.17em; }
.topbar {
position: sticky;
@@ -34,17 +35,16 @@ body[data-library-state="ready"] > .library-loading { display: none; }
}
.topbar > #toggle-filters { position: relative; grid-area: toggle; }
-#toggle-filters[data-filter-count]::after { content: attr(data-filter-count); position: absolute; top: -4px; right: -4px; display: grid; min-width: 17px; height: 17px; place-items: center; border: 2px solid var(--bar); border-radius: 50%; padding: 0 3px; color: var(--accent-contrast); background: var(--accent); font-size: 9px; font-weight: 800; line-height: 1; pointer-events: none; }
+#toggle-filters[data-filter-count]::after { content: attr(data-filter-count); position: absolute; top: -4px; right: -4px; display: grid; min-width: 17px; height: 17px; place-items: center; border: 2px solid var(--bar); border-radius: 50%; padding: 0 3px; color: var(--accent-emphasis-contrast); background: var(--accent-emphasis); font-size: 9px; font-weight: 800; line-height: 1; pointer-events: none; }
.topbar > .brand { grid-area: brand; }
.topbar > .global-search { grid-area: search; min-width: 0; }
.topbar > .top-actions { grid-area: actions; min-width: 0; justify-self: end; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 38px; height: 38px; border-radius: 50%; }
-.brand h1 { margin: 0; font-size: 17px; line-height: 1.1; letter-spacing: -0.02em; }
.global-search input { padding-inline: 16px; background: var(--raised); }
.top-actions { display: flex; gap: 8px; }
.settings-entry-button { position: relative; }
-.settings-update-badge { position: absolute; top: -2px; right: -2px; width: 9px; height: 9px; border: 2px solid var(--bar); border-radius: 50%; background: var(--accent); pointer-events: none; }
+.settings-update-badge { position: absolute; top: -2px; right: -2px; width: 9px; height: 9px; border: 2px solid var(--bar); border-radius: 50%; background: var(--accent-emphasis); pointer-events: none; }
.package-menu { position: relative; }
.top-actions .package-menu { position: static; }
@@ -131,7 +131,7 @@ details:not([open]) > .detail-project-popover { display: none; }
.share-dialog-options button { display: inline-flex; min-width: 0; align-items: center; justify-content: center; gap: 7px; }
.share-dialog-options .ui-icon { width: 16px; height: 16px; }
.share-dialog-disclosure { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--ui-meta-size); }
-.share-dialog-disclosure input { width: 16px; height: 16px; accent-color: var(--ui-accent); }
+.share-dialog-disclosure input { width: 16px; height: 16px; accent-color: var(--ui-accent-emphasis); }
.share-dialog-result { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.share-dialog-result > div { display: flex; gap: 8px; }
.data-safety-header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 16px 18px; }
@@ -169,12 +169,12 @@ details:not([open]) > .detail-project-popover { display: none; }
.import-source { display: grid; gap: 10px; }
.import-source[hidden], .import-actions[hidden] { display: none; }
.import-drop-zone { display: grid; min-height: 224px; place-content: center; justify-items: center; gap: 8px; border: 1px dashed var(--selection-edge); border-radius: var(--ui-container-radius); padding: 22px; background: var(--raised); text-align: center; }
-.import-drop-zone > .ui-icon { width: 24px; height: 24px; color: var(--accent); }
+.import-drop-zone > .ui-icon { width: 24px; height: 24px; color: var(--accent-ink); }
.import-drop-zone > strong { font-size: 16px; }
.import-drop-zone > span { max-width: 420px; color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.5; }
.import-drop-zone #import-choose-files { min-width: 156px; margin-top: 6px; }
.import-drop-zone .import-folder-link { min-height: 26px; border: 0; padding: 2px 6px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 650; }
-.import-drop-zone .import-folder-link:hover { color: var(--accent); }
+.import-drop-zone .import-folder-link:hover { color: var(--accent-ink); }
.import-source > .import-last-job { grid-column: 1 / -1; min-height: 34px; justify-items: center; padding: 7px 10px; }
.import-preparing { min-height: 180px; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.import-preparing[hidden], .import-confirmation[hidden], .import-job-panel[hidden] { display: none; }
@@ -188,7 +188,7 @@ details:not([open]) > .detail-project-popover { display: none; }
.import-project-field small, .import-label-field > small { min-height: 1.4em; color: var(--muted); font-size: 10px; font-weight: 500; line-height: 1.4; }
.import-project-field small:empty, .import-label-field > small:empty { display: none; }
.import-check { display: flex; min-height: 36px; align-items: center; gap: 7px; color: var(--ink); font-size: 12px; }
-.import-check input, .import-file-row input { width: auto; min-height: auto; accent-color: var(--accent); }
+.import-check input, .import-file-row input { width: auto; min-height: auto; accent-color: var(--accent-emphasis); }
.import-label-field { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.import-label-editor { min-width: 0; }
.import-file-list { display: grid; max-height: 280px; overflow: auto; border-top: 1px solid var(--line); }
@@ -209,17 +209,31 @@ details:not([open]) > .detail-project-popover { display: none; }
.import-actions #import-cancel { margin-right: auto; }
.import-job-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.import-job-summary span { color: var(--muted); font-size: 11px; }
-.import-job-panel progress { width: 100%; height: 8px; accent-color: var(--accent); }
+.import-job-panel progress { width: 100%; height: 8px; accent-color: var(--accent-emphasis); }
button[aria-busy="true"] { cursor: progress; }
.advanced-reanalysis { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.advanced-reanalysis > summary { color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 700; }
.advanced-reanalysis > p { color: var(--muted); font-size: 12px; }
-.share-bar { display: flex; flex: 1 1 100%; min-width: 0; align-items: center; gap: 8px 12px; border: 1px solid var(--selection-edge); border-radius: var(--ui-container-radius); padding: 6px 8px; background: var(--selection); }
+.share-bar { display: flex; min-width: 0; min-height: 34px; flex: 1 1 100%; align-items: center; gap: 10px; background: transparent; }
.share-bar > strong { flex: none; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
-.share-bar > div { display: flex; min-width: 0; flex: 1 1 auto; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px; }
-.share-bar select { width: min(180px, 24vw); min-height: 34px; }
-.selection-label-field input { width: min(150px, 20vw); min-height: 34px; }
+.selection-simple-actions, .selection-selected-actions { display: flex; min-width: 0; align-items: center; gap: 6px; }
+.selection-simple-actions { flex: 1 1 auto; justify-content: flex-end; }
+.selection-simple-actions > button, .selection-selected-actions > button, .selection-menu { flex: 0 0 auto; }
+.selection-selected-actions[hidden] { display: none; }
+.selection-compact-action, .selection-menu > summary { display: flex; min-height: 32px; align-items: center; justify-content: center; gap: 5px; padding: 5px 9px; white-space: nowrap; }
+.selection-compact-action .ui-icon, .selection-menu > summary .ui-icon { width: 15px; height: 15px; }
+.selection-menu { position: relative; }
+.selection-menu > summary { color: var(--ink); border: 1px solid var(--line); border-radius: var(--ui-control-radius); background: var(--raised); cursor: pointer; font-size: 12px; font-weight: 700; list-style: none; }
+.selection-menu > summary::-webkit-details-marker { display: none; }
+.selection-menu > summary:hover, .selection-menu > summary:focus-visible, .selection-menu[open] > summary { border-color: var(--selection-edge); background: var(--hover); }
+.selection-menu > summary:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
+details:not([open]) > .selection-menu-panel { display: none; }
+.selection-menu-panel { z-index: 26; width: min(276px, calc(100vw - 32px)); }
+.selection-menu-panel label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
+.selection-menu-panel input, .selection-menu-panel select { width: 100%; min-height: 36px; }
+.selection-menu-panel button { width: 100%; }
+.selection-more-panel { width: min(220px, calc(100vw - 32px)); }
.workspace-navigation-count { display: grid; min-width: 18px; height: 18px; margin-left: auto; place-items: center; border-radius: 999px; padding-inline: 5px; color: var(--muted); background: var(--raised); font-size: 9px; }
.compact-select select { width: 92px; min-height: 28px; border-color: transparent; padding: 3px 22px 3px 6px; color: var(--muted); background-color: transparent; font-size: 10px; }
.sidebar-trash-section { margin-bottom: 18px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
@@ -235,14 +249,14 @@ button[aria-busy="true"] { cursor: progress; }
.case-card.manual-project-order .case-reorder-controls { display: flex; }
.case-reorder-controls button { display: grid; width: 36px; min-height: 36px; place-items: center; border-color: rgba(255, 255, 255, .3); padding: 0; color: white; background: rgba(9, 11, 16, .72); font-size: 14px; }
.case-reorder-controls button:disabled { opacity: .38; }
-.gallery-heading.selection-mode { align-items: center; }
+.gallery-heading.selection-mode { min-height: 34px; align-items: center; }
.project-selection-actions button { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.workspace { display: grid; grid-template-columns: var(--sidebar-width, 244px) 6px minmax(0, 1fr); min-height: calc(100vh - 74px); }
.workspace.filters-collapsed { grid-template-columns: 0 0 minmax(0, 1fr); }
.sidebar-resizer { position: relative; z-index: 4; width: 6px; cursor: col-resize; touch-action: none; }
.sidebar-resizer::after { position: absolute; inset: 0 2px; content: ""; background: transparent; transition: background 120ms ease; }
-.sidebar-resizer:hover::after, .sidebar-resizer:focus-visible::after, .sidebar-resizer.is-resizing::after { background: var(--accent); }
+.sidebar-resizer:hover::after, .sidebar-resizer:focus-visible::after, .sidebar-resizer.is-resizing::after { background: var(--accent-emphasis); }
.filters-collapsed .sidebar-resizer { pointer-events: none; opacity: 0; }
.filter-sidebar {
position: sticky;
@@ -255,10 +269,6 @@ button[aria-busy="true"] { cursor: progress; }
transition: transform 150ms ease, opacity 150ms ease;
}
.filters-collapsed .filter-sidebar { pointer-events: none; transform: translateX(-100%); opacity: 0; }
-.sidebar-filter-tools { display: none; min-height: 32px; align-items: center; gap: 8px; margin-bottom: 14px; padding-inline: 2px; }
-.sidebar-filter-tools:has(#active-filter-badge:not([hidden])) { display: flex; }
-.filter-count-badge { display: inline-flex; min-height: 24px; align-items: center; padding: 0 8px; color: var(--accent-ink); border-radius: 999px; background: var(--accent-soft); font-size: 10px; font-weight: 800; white-space: nowrap; }
-.sidebar-filter-tools #clear-filters { min-height: 30px; margin-left: auto; padding: 5px 9px; font-size: 11px; white-space: nowrap; }
.workspace-navigation { display: grid; gap: 2px; margin-bottom: 16px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.workspace-navigation .filter-heading { margin-bottom: 4px; }
.workspace-navigation-item {
@@ -274,8 +284,8 @@ button[aria-busy="true"] { cursor: progress; }
text-align: left;
}
.workspace-navigation-item:hover:not(:disabled) { color: var(--ink); background: var(--hover); }
-.workspace-navigation-item[aria-current="page"] { color: var(--ink); background: var(--selection); box-shadow: inset 2px 0 var(--accent); }
-.workspace-navigation-item[aria-current="page"] .ui-icon { color: var(--accent); }
+.workspace-navigation-item[aria-current="page"] { color: var(--ink); background: var(--selection); box-shadow: inset 2px 0 var(--accent-emphasis); }
+.workspace-navigation-item[aria-current="page"] .ui-icon { color: var(--accent-ink); }
.filter-section, .project-section { display: grid; gap: 10px; min-width: 0; }
.project-section { margin-bottom: 18px; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.tag-navigation-section { margin-top: 18px; }
@@ -295,7 +305,7 @@ button[aria-busy="true"] { cursor: progress; }
.project-row.project-ordering.is-dragging { cursor: grabbing; }
.project-row.project-ordering.is-dragging {
z-index: 4;
- border-color: var(--accent);
+ border-color: var(--accent-emphasis);
background: var(--card);
box-shadow: var(--shadow);
opacity: .94;
@@ -307,25 +317,27 @@ button[aria-busy="true"] { cursor: progress; }
.project-filter-meta, .content-filter-meta { display: flex; align-items: center; justify-content: flex-end; gap: 5px; white-space: nowrap; }
.project-filter-count { color: var(--muted); font-variant-numeric: tabular-nums; }
.project-filter:hover:not(:disabled) { color: var(--ink); background: var(--selection-hover); }
-.project-filter[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent-soft); box-shadow: inset 2px 0 var(--accent); }
+.project-filter[aria-pressed="true"] { color: var(--accent-ink); background: var(--ui-project-active-surface); box-shadow: inset 2px 0 var(--accent-emphasis); }
.project-menu { position: relative; }
.project-menu > summary { display: grid; width: 30px; min-height: 30px; place-items: center; color: var(--muted); cursor: pointer; list-style: none; }
.project-menu > summary::-webkit-details-marker { display: none; }
-.project-menu-panel { position: absolute; z-index: 12; top: calc(100% + 5px); right: 0; display: grid; width: min(228px, calc(100vw - 32px)); gap: 6px; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: var(--card); box-shadow: var(--shadow); }
-.project-menu-panel button { min-height: 40px; border-radius: 8px; padding: 8px 11px; font-size: 12px; line-height: 1.35; text-align: left; }
+.project-menu-panel { position: absolute; z-index: 12; top: calc(100% + 5px); right: 0; display: grid; width: min(228px, calc(100vw - 32px)); min-width: 0; max-width: calc(100vw - 32px); gap: 6px; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: var(--card); box-shadow: var(--shadow); }
+.project-menu-panel button { width: 100%; min-width: 0; max-width: 100%; min-height: 40px; border-radius: 8px; padding: 8px 11px; font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; white-space: normal; }
.project-menu-panel .project-menu-primary { color: var(--accent-contrast); border-color: var(--accent); background: var(--accent); }
.project-menu-panel .quiet-danger { border-color: color-mix(in srgb, var(--danger) 18%, var(--line)); background: color-mix(in srgb, var(--danger) 5%, var(--card)); }
.project-menu-panel .button-secondary + .quiet-danger { margin-top: 4px; }
.filter-heading { display: flex; align-items: center; justify-content: space-between; font-size: 11px; }
.filter-heading > span { display: flex; gap: 2px; }
.filter-heading button { min-height: 30px; padding: 3px 6px; color: var(--muted); background: transparent; font-size: 11px; }
+.filter-heading #create-collection { display: inline-flex; align-items: center; gap: 3px; }
+.filter-heading #create-collection .ui-icon { width: 14px; height: 14px; }
.filter-heading #manage-project-order, .gallery-heading #manage-case-order { width: 36px; min-height: 36px; padding: 0; }
.filter-options { display: grid; gap: 2px; }
.content-filter-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px; }
.content-filter-option { display: grid; min-height: 36px; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 7px 9px; color: var(--muted); border-color: transparent; background: transparent; text-align: left; }
.content-filter-option:hover:not(:disabled) { color: var(--ink); background: var(--hover); }
-.content-filter-option[aria-pressed="true"] { color: var(--ink); background: var(--selection); box-shadow: inset 2px 0 var(--selection-indicator); }
-.content-filter-option[aria-pressed="true"] .ui-icon { color: var(--accent); }
+.content-filter-option[aria-pressed="true"] { color: var(--ink); background: var(--ui-content-active-surface); box-shadow: inset 2px 0 var(--selection-indicator); }
+.content-filter-option[aria-pressed="true"] .ui-icon { color: var(--accent-ink); }
.content-filter-name { overflow-wrap: anywhere; white-space: normal; }
.content-filter-count, .facet-option-count { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.content-visibility, .project-visibility { border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
@@ -345,9 +357,9 @@ button[aria-busy="true"] { cursor: progress; }
.facet-group-title { display: grid; color: var(--muted); font-size: 11px; }
.facet-children { display: grid; gap: 2px; padding-left: 12px; }
.facet-option-row { display: grid; width: 100%; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: 7px; text-align: left; }
-.facet-option-check { display: grid; width: 15px; height: 15px; place-items: center; border: 1px solid var(--selection-edge); border-radius: 3px; color: var(--accent-contrast); background: transparent; }
+.facet-option-check { display: grid; width: 15px; height: 15px; place-items: center; border: 1px solid var(--selection-edge); border-radius: 3px; color: var(--accent-emphasis-contrast); background: transparent; }
.facet-option-check .ui-icon { width: 11px; height: 11px; opacity: 0; }
-.facet-option-row[aria-pressed="true"] .facet-option-check { border-color: var(--accent); background: var(--accent); }
+.facet-option-row[aria-pressed="true"] .facet-option-check { border-color: var(--accent-emphasis); background: var(--accent-emphasis); }
.facet-option-row[aria-pressed="true"] .facet-option-check .ui-icon { opacity: 1; }
.facet-option-name { overflow-wrap: anywhere; white-space: normal; }
.facet-filter-overflow { border-top: 1px solid var(--line); }
@@ -356,6 +368,9 @@ button[aria-busy="true"] { cursor: progress; }
.gallery-shell { min-width: 0; padding: 8px 6px 60px; }
.gallery-heading { display: flex; min-height: 30px; align-items: center; justify-content: space-between; margin: 0 2px 8px; color: var(--muted); font-size: 11px; }
+.gallery-heading-copy { display: flex; min-width: 0; align-items: baseline; gap: 8px; }
+.gallery-heading-copy h1 { min-width: 0; overflow: hidden; margin: 0; color: var(--ink); font-size: 14px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
+.gallery-heading-copy strong { flex: none; }
.gallery-heading.project-selection-mode { position: sticky; z-index: 24; top: 64px; flex-wrap: wrap; gap: 8px; margin-top: -8px; margin-inline: -4px; border-bottom: 1px solid var(--line); padding: 6px 4px; background: var(--paper); }
.gallery-heading button { min-height: 32px; padding: 5px 9px; font-size: 12px; }
.gallery-heading strong { color: var(--ink); }
@@ -363,14 +378,16 @@ button[aria-busy="true"] { cursor: progress; }
.project-selection-count { margin-right: auto; color: var(--muted); font-size: 11px; font-weight: 700; }
.masonry { position: relative; width: 100%; overflow-anchor: none; --masonry-card-min-width: 270px; --masonry-gap: var(--visual-wall-gap); }
.case-card { position: absolute; display: block; margin: 0; overflow: hidden; color: var(--ink); border: 0; border-radius: var(--visual-card-radius); background: var(--card); cursor: pointer; }
-.case-card:hover { box-shadow: 0 8px 20px color-mix(in srgb, var(--ink) 10%, transparent); }
-.case-card:focus-visible { outline: 0; box-shadow: inset 0 0 0 2px var(--focus-ring); }
+.case-card::after { position: absolute; z-index: 3; inset: 0; border: 1px solid transparent; border-radius: inherit; content: ""; pointer-events: none; }
+.case-card:hover::after { border-color: var(--selection-edge); }
+.case-card:focus-visible { outline: 0; }
+.case-card:focus-visible::after { border-width: 2px; border-color: var(--focus-ring); }
.case-card.share-selectable { user-select: none; }
-.case-card.selected-for-share { box-shadow: inset 0 0 0 1px var(--selection-indicator); }
+.case-card.selected-for-share::after { border-color: var(--selection-indicator); }
.case-card.selection-ineligible { opacity: .52; }
-.share-check { position: absolute; z-index: 4; top: 10px; right: 10px; display: none; width: 25px; height: 25px; place-items: center; color: transparent; border: 2px solid white; border-radius: 50%; background: rgba(9, 11, 16, 0.68); }
+.share-check { position: absolute; z-index: 4; top: 10px; right: 10px; display: none; width: 24px; height: 24px; place-items: center; color: transparent; border: 1.5px solid rgba(255, 255, 255, .92); border-radius: 50%; background: rgba(9, 11, 16, .68); box-shadow: 0 0 0 1px rgba(9, 11, 16, .28); }
.share-selectable .share-check { display: grid; }
-.selected-for-share .share-check { color: var(--accent-contrast); background: var(--accent); }
+.selected-for-share .share-check { color: var(--accent-emphasis-contrast); border-color: var(--accent-emphasis); background: var(--accent-emphasis); box-shadow: 0 0 0 1px rgba(9, 11, 16, .32); }
.case-image-wrap { position: relative; min-height: 110px; overflow: hidden; background: #151922; }
.case-shot { display: block; width: 100%; height: auto; background: #151922; }
.case-image-wrap-fixed .case-shot { height: 100%; object-fit: cover; }
@@ -395,11 +412,11 @@ button[aria-busy="true"] { cursor: progress; }
.empty-state { padding: 80px 20px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--ink); font-size: 21px; }
.onboarding { width: min(720px, 100%); margin: 0 auto; text-align: left; }
-.onboarding > .eyebrow { color: var(--accent); font-size: 11px; }
+.onboarding > .eyebrow { color: var(--accent-ink); font-size: 11px; }
.onboarding > p:not(.eyebrow) { max-width: 600px; margin: 12px 0 24px; line-height: 1.7; }
.onboarding ol { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 18px; padding: 0; list-style: none; counter-reset: onboarding; }
.onboarding li { display: grid; gap: 7px; min-height: 112px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); counter-increment: onboarding; }
-.onboarding li::before { content: "0" counter(onboarding); color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .1em; }
+.onboarding li::before { content: "0" counter(onboarding); color: var(--accent-ink); font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.onboarding li b { color: var(--ink); font-size: 13px; }
.onboarding li span { font-size: 11px; line-height: 1.55; }
.onboarding small { font-size: 11px; }
@@ -496,7 +513,7 @@ button[aria-busy="true"] { cursor: progress; }
.detail-header-section { position: relative; }
.detail-header-section > .detail-title { padding-right: 132px; }
.entry-editor-inline > summary { position: absolute; top: 16px; right: 72px; }
-.entry-editor-inline[open] > summary { color: var(--accent); }
+.entry-editor-inline[open] > summary { color: var(--accent-ink); }
.entry-editor-inline > .entry-editor-body { padding-top: 14px; }
.pending-review-panel { background: color-mix(in srgb, var(--warning) 6%, var(--card)); }
.pending-review-panel > h3 { color: var(--warning); }
@@ -519,7 +536,7 @@ button[aria-busy="true"] { cursor: progress; }
.detail-project-list { display: grid; gap: 5px; }
.detail-project-option { display: flex; min-width: 0; min-height: 34px; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: var(--ui-control-radius); padding: 6px 8px; color: var(--ink); background: var(--raised); cursor: pointer; font-size: 11px; }
.detail-project-option:hover { border-color: var(--ui-border-strong); }
-.detail-project-option input { width: 16px; min-height: 16px; flex: 0 0 auto; accent-color: var(--accent); }
+.detail-project-option input { width: 16px; min-height: 16px; flex: 0 0 auto; accent-color: var(--accent-emphasis); }
.detail-project-option span { overflow-wrap: anywhere; white-space: normal; }
.detail-new-project { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.detail-new-project input { min-width: 0; }
@@ -582,7 +599,7 @@ button[aria-busy="true"] { cursor: progress; }
.compound-part-heading h3 { margin: 3px 0 5px; overflow-wrap: anywhere; font-size: 14px; }
.compound-part-heading-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 7px; white-space: nowrap; }
.compound-primary-badge { padding: 5px 8px; color: var(--accent-ink); border-radius: 999px; background: var(--accent-soft); font-size: 11px; font-weight: 800; }
-.compound-part-index { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
+.compound-part-index { color: var(--accent-ink); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.compound-case-actions { display: flex; justify-content: flex-end; padding: 10px 22px; border-bottom: 1px solid var(--line); background: var(--subtle-card); }
.compound-case-actions button { min-height: 32px; font-size: 12px; }
.compound-organizer > summary { cursor: pointer; font-size: 12px; font-weight: 800; }
@@ -618,13 +635,11 @@ button[aria-busy="true"] { cursor: progress; }
.inline-form { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)) auto; align-items: end; gap: 9px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.inline-form label, .facet-name-form label, .tag-create-form label, .compact-settings-form label, .node-actions label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.ai-consent { grid-column: 1 / -2; grid-template-columns: auto 1fr; align-items: center; }
-.ai-consent input { width: 16px; min-height: 16px; accent-color: var(--accent); }
+.ai-consent input { width: 16px; min-height: 16px; accent-color: var(--accent-emphasis); }
.vocabulary-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.dimension-picker { display: grid; width: min(360px, 100%); gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.vocabulary-workspace { border-top: 1px solid var(--line); }
.facet-name-form { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; align-items: end; gap: 8px; padding: 16px 0; border-bottom: 1px solid var(--line); }
-.quiet-danger { color: var(--danger); background: transparent; font-size: 11px; }
-.quiet-danger:hover:not(:disabled) { background: rgba(255, 101, 114, 0.1); }
.quiet-archive { color: var(--muted); border-color: var(--line); background: transparent; }
.archived-vocabulary { margin-top: 20px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--muted); }
.archived-vocabulary > summary { cursor: pointer; font-size: 11px; font-weight: 700; }
@@ -705,7 +720,7 @@ button[aria-busy="true"] { cursor: progress; }
.analysis-diagnostics-empty { color: var(--muted); }
.reanalyze-preview { margin-top: 12px; color: var(--muted); font-size: 11px; }
.maintenance-progress { margin-top: 12px; }
-.maintenance-progress progress { display: block; width: 100%; height: 8px; overflow: hidden; border: 0; border-radius: 999px; background: var(--raised); accent-color: var(--accent); }
+.maintenance-progress progress { display: block; width: 100%; height: 8px; overflow: hidden; border: 0; border-radius: 999px; background: var(--raised); accent-color: var(--accent-emphasis); }
.reanalyze-case-list { max-height: 260px; overflow: auto; margin-top: 8px; }
.analysis-settings-card { max-width: 820px; margin-inline: auto; }
@@ -751,8 +766,8 @@ button[aria-busy="true"] { cursor: progress; }
.visual-analysis-card { position: relative; display: grid; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-raised); }
.visual-analysis-card[data-state="completed"] { border-color: color-mix(in srgb, var(--success) 58%, var(--line)); }
.visual-analysis-card[data-state="failed"] { border-color: color-mix(in srgb, var(--danger) 65%, var(--line)); }
-.visual-analysis-card[data-state="processing"] { border-color: var(--accent); }
-.visual-analysis-card > input { position: absolute; z-index: 3; top: 8px; right: 8px; width: 18px; min-height: 18px; accent-color: var(--accent); }
+.visual-analysis-card[data-state="processing"] { border-color: var(--accent-emphasis); }
+.visual-analysis-card > input { position: absolute; z-index: 3; top: 8px; right: 8px; width: 18px; min-height: 18px; accent-color: var(--accent-emphasis); }
.visual-analysis-card > label { display: grid; min-width: 0; cursor: pointer; }
.visual-analysis-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #0b0d0f; }
.visual-analysis-card-meta { display: grid; min-height: 54px; gap: 3px; padding: 8px 9px; }
@@ -805,7 +820,7 @@ button[aria-busy="true"] { cursor: progress; }
.vision-compatible-help button { flex: none; }
.analysis-settings-form .ai-consent { display: grid; grid-template-columns: auto 1fr; }
.task-option { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 10px; border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; color: var(--ink); background: var(--subtle-card); }
-.task-option input { width: auto; min-height: auto; margin-top: 2px; accent-color: var(--accent); }
+.task-option input { width: auto; min-height: auto; margin-top: 2px; accent-color: var(--accent-emphasis); }
.privacy-note { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.vision-description { display: grid; gap: 10px; }
.vision-description-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
@@ -869,6 +884,11 @@ button[aria-busy="true"] { cursor: progress; }
.ai-routing-regions { grid-template-columns: 1fr; }
}
+@media (min-width: 641px) and (max-width: 900px) {
+ .selection-action-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
+ .selection-compact-action, .selection-menu > summary { width: 36px; padding: 0; }
+}
+
.project-selection-actions button,
.project-menu-panel button,
.gallery-heading button,
@@ -904,14 +924,17 @@ button[aria-busy="true"] { cursor: progress; }
padding: 10px 12px;
gap: 8px;
}
- .brand { display: none; }
+ .brand { display: flex; }
.top-actions { gap: 5px; }
.top-actions button, .package-menu > summary { min-height: 38px; padding: 7px 9px; font-size: 12px; white-space: nowrap; }
.top-actions .package-menu-panel,
.top-actions .add-menu .package-menu-panel { position: fixed; top: 118px; right: 12px; left: 12px; width: auto; max-height: calc(100dvh - 130px); }
- .share-bar { position: fixed; z-index: 44; top: auto; right: 10px; bottom: 10px; left: 10px; min-height: 62px; border: 1px solid var(--selection-edge); border-radius: 11px; padding: 8px 10px; box-shadow: var(--shadow); }
- .share-bar > span { display: none; }
- .share-bar > div { margin-left: auto; }
+ .gallery-heading.selection-mode { min-height: 34px; }
+ .share-bar { position: fixed; z-index: 44; top: auto; right: 10px; bottom: 10px; left: 10px; min-height: 56px; gap: 7px; border: 1px solid var(--selection-edge); border-radius: 11px; padding: 7px 9px; background: var(--bar); box-shadow: var(--shadow); }
+ .selection-simple-actions, .selection-selected-actions { gap: 4px; }
+ .selection-action-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
+ .selection-compact-action, .selection-menu > summary { width: 36px; min-height: 36px; padding: 0; }
+ .selection-menu-panel { position: fixed; top: auto; right: 10px; bottom: 74px; left: 10px; width: auto; max-height: calc(100dvh - 96px); overflow: auto; }
.workspace, .workspace.filters-collapsed { display: block; }
.filter-sidebar { position: fixed; z-index: 35; top: 0; left: 0; width: min(310px, 88vw); height: 100vh; padding-top: 20px; box-shadow: var(--shadow); transform: translateX(-105%); opacity: 0; }
.workspace:not(.filters-collapsed) .filter-sidebar { transform: translateX(0); opacity: 1; }
@@ -1007,7 +1030,7 @@ button[aria-busy="true"] { cursor: progress; }
.article-document-media figcaption { color: var(--muted); font-size: 11px; line-height: 1.5; }
.article-document-video .detail-video-wrap, .article-document-video .detail-video { width: 100%; }
.article-document-resource { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--raised); }
-.article-document-resource-type { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 7px; color: var(--accent); background: var(--accent-soft); font-size: 10px; font-weight: 850; }
+.article-document-resource-type { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 7px; color: var(--accent-ink); background: var(--accent-soft); font-size: 10px; font-weight: 850; }
.article-document-resource small { grid-column: 2 / -1; color: var(--muted); }
.article-media-library { padding: 16px 22px; border-bottom: 1px solid var(--line); }
.article-media-library > summary { cursor: pointer; font-size: 12px; font-weight: 800; }
@@ -1035,8 +1058,8 @@ button[aria-busy="true"] { cursor: progress; }
.markdown-reader h2 { font-size: 1.42em; }
.markdown-reader h3 { font-size: 1.2em; }
.markdown-reader p, .markdown-reader ul, .markdown-reader ol, .markdown-reader blockquote, .markdown-reader pre, .markdown-reader table { margin: .8em 0; }
-.markdown-reader blockquote { border-left: 3px solid var(--accent); padding: 2px 0 2px 12px; color: var(--muted); }
-.markdown-reader pre { overflow: auto; border-radius: 9px; padding: 12px; color: #edf2f4; background: #11161b; }
+.markdown-reader blockquote { border-left: 3px solid var(--accent-emphasis); padding: 2px 0 2px 12px; color: var(--muted); }
+.markdown-reader pre { overflow: auto; border-radius: 9px; padding: 12px; color: var(--ui-code-text); background: var(--ui-code-bg); }
.markdown-reader code { border-radius: 4px; padding: 1px 4px; background: var(--panel); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.markdown-reader pre code { padding: 0; background: transparent; }
.markdown-reader table { width: 100%; border-collapse: collapse; }
@@ -1101,7 +1124,7 @@ button[aria-busy="true"] { cursor: progress; }
.eyebrow { margin-bottom: 3px; letter-spacing: .08em; }
.topbar {
- grid-template-columns: auto minmax(176px, 214px) minmax(260px, 1fr) auto auto;
+ grid-template-columns: auto minmax(190px, 214px) minmax(260px, 1fr) auto auto;
min-height: 64px;
padding: 8px 14px;
gap: 10px;
@@ -1111,8 +1134,10 @@ button[aria-busy="true"] { cursor: progress; }
.brand { gap: 9px; }
.brand-mark { width: 36px; height: 36px; border-radius: 7px; }
.brand > div { display: grid; min-width: 0; gap: 1px; }
-.brand-wordmark { overflow: hidden; font-size: 14px; line-height: 17px; text-overflow: ellipsis; white-space: nowrap; }
-.brand h1 { overflow: hidden; color: var(--muted); font-size: 10px; font-weight: 550; line-height: 13px; letter-spacing: 0; text-overflow: ellipsis; white-space: nowrap; }
+.brand-wordmark { overflow: visible; font-size: 14px; line-height: 17px; text-overflow: clip; white-space: nowrap; }
+.brand .product-brand-tagline { overflow: visible; color: var(--muted); font-size: 10px; font-weight: 550; line-height: 13px; letter-spacing: -.01em; text-overflow: clip; white-space: nowrap; }
+.library-name-note { grid-column: 1 / -1; margin: -2px 0 4px; color: var(--muted); font-size: 10px; line-height: 1.45; }
+.settings-brand-slogan { margin: 0 0 10px; color: var(--ink); font-size: 12px; font-weight: 750; }
.global-search input { padding-inline: 14px; background: var(--input); }
.top-actions { align-items: center; gap: 6px; }
.top-actions > button, .top-actions .package-menu > summary { min-height: 36px; padding: 7px 11px; }
@@ -1120,7 +1145,6 @@ button[aria-busy="true"] { cursor: progress; }
.package-menu-panel { border-radius: var(--ui-container-radius); }
.package-menu-panel button { border-radius: var(--ui-control-radius); }
-.share-bar { background: var(--bar); }
.workspace { grid-template-columns: var(--sidebar-width, 244px) 6px minmax(0, 1fr); min-height: calc(100vh - 64px); }
.filter-sidebar {
top: 64px;
@@ -1134,7 +1158,7 @@ button[aria-busy="true"] { cursor: progress; }
.project-list { gap: 2px; }
.project-row { gap: 2px; }
.project-filter { min-height: 36px; border-radius: 6px; padding: 7px 9px; font-size: 12px; }
-.project-filter[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent-soft); box-shadow: inset 2px 0 var(--accent); }
+.project-filter[aria-pressed="true"] { color: var(--accent-ink); background: var(--ui-project-active-surface); box-shadow: inset 2px 0 var(--accent-emphasis); }
.project-menu > summary { width: 28px; min-height: 28px; border-radius: 5px; }
.project-visibility { margin-left: 0; }
.filter-section { padding-inline: 2px; }
@@ -1212,11 +1236,11 @@ button[aria-busy="true"] { cursor: progress; }
}
@media (max-width: 640px) {
- .topbar { min-height: 108px; grid-template-areas: "toggle actions" "search search"; }
+ .topbar { grid-template-columns: auto minmax(168px, 1fr) auto; min-height: 108px; grid-template-areas: "toggle brand actions" "search search search"; }
+ .topbar > .brand { max-width: 100%; }
.top-actions .package-menu-panel, .top-actions .add-menu .package-menu-panel { top: 108px; }
.gallery-heading.project-selection-mode { top: 108px; }
.filter-sidebar { top: 0; height: 100dvh; }
- .sidebar-filter-tools { padding-right: 8px; }
.manager-dialog { display: block; width: 100vw; height: 100dvh; border-radius: 0; }
.settings-dialog { width: 100vw; height: 100dvh; border-radius: 0; }
.manager-tabs { display: flex; min-height: 48px; overflow-x: auto; flex-direction: row; gap: 14px; border-right: 0; border-bottom: 1px solid var(--line); padding: 0 12px; }
diff --git a/library.html b/library.html
index f159775..678dc58 100644
--- a/library.html
+++ b/library.html
@@ -1,9 +1,9 @@
<!doctype html>
-<html lang="zh-CN" data-i18n-title="提示词导演灵感库">
+<html lang="zh-CN" data-i18n-title="PromptDirector|视觉创作灵感库">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
- <title>提示词导演灵感库</title>
+ <title data-i18n="PromptDirector|视觉创作灵感库">PromptDirector|视觉创作灵感库</title>
<script src="theme-bootstrap.js"></script>
<link rel="stylesheet" href="ui-foundation.css" />
<link rel="stylesheet" href="library.css" />
@@ -18,9 +18,9 @@
</div>
<header class="topbar">
<button id="toggle-filters" class="icon-button" type="button" aria-label="展开或收起筛选" data-i18n-aria-label="展开或收起筛选" title="展开或收起筛选" data-i18n-title="展开或收起筛选"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-menu"></use></svg></button>
- <div class="brand">
- <img class="brand-mark" src="assets/icons/icon-source.svg" alt="" />
- <div><strong class="brand-wordmark">PromptDirector</strong><h1 id="library-title">视觉创作资料库</h1></div>
+ <div class="brand product-brand">
+ <img class="brand-mark product-brand-mark" src="assets/icons/icon-source.svg" alt="" />
+ <div class="product-brand-copy"><strong class="brand-wordmark product-brand-name">PromptDirector</strong><span class="product-brand-tagline" data-i18n="视觉创作灵感库">视觉创作灵感库</span></div>
</div>
<label class="global-search">
<span class="sr-only" data-i18n="搜索提示词、来源或 AI 标签">搜索提示词、来源或 AI 标签</span>
@@ -30,13 +30,13 @@
<details id="add-menu" class="package-menu add-menu">
<summary class="button-secondary" data-i18n="添加">添加</summary>
<div class="package-menu-panel">
- <button id="add-media" type="button"><strong data-i18n="导入本机资料">导入本机资料</strong><span>选择文件或文件夹,统一确认后导入</span></button>
- <button id="add-video-reference" class="button-secondary" type="button"><strong data-i18n="视频链接">视频链接</strong><span>保存 YouTube、Vimeo 或来源网页</span></button>
- <button id="add-quick-note" class="button-secondary" type="button"><strong data-i18n="快速笔记">快速笔记</strong><span>立即记下一段创作想法</span></button>
+ <button id="add-media" class="ui-content-row" type="button"><strong data-i18n="导入本机资料">导入本机资料</strong><span data-i18n="选择文件或文件夹,统一确认后导入">选择文件或文件夹,统一确认后导入</span></button>
+ <button id="add-video-reference" class="button-secondary ui-content-row" type="button"><strong data-i18n="视频链接">视频链接</strong><span data-i18n="保存 YouTube、Vimeo 或来源网页">保存 YouTube、Vimeo 或来源网页</span></button>
+ <button id="add-quick-note" class="button-secondary ui-content-row" type="button"><strong data-i18n="快速笔记">快速笔记</strong><span data-i18n="立即记下一段创作想法">立即记下一段创作想法</span></button>
</div>
</details>
<button id="start-compose" type="button" data-i18n="开始创作">开始创作</button>
- <button id="open-settings" class="icon-button settings-entry-button" type="button" aria-label="设置" data-i18n-aria-label="设置" title="设置"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-settings"></use></svg><span id="settings-update-badge" class="settings-update-badge" aria-label="有可用更新" hidden></span></button>
+ <button id="open-settings" class="icon-button settings-entry-button" type="button" aria-label="设置" data-i18n-aria-label="设置" title="设置" data-i18n-title="设置"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-settings"></use></svg><span id="settings-update-badge" class="settings-update-badge" aria-label="有可用更新" hidden data-i18n-aria-label="有可用更新"></span></button>
<input id="media-file" class="sr-only" type="file" multiple />
<input id="media-folder" class="sr-only" type="file" multiple webkitdirectory />
</div>
@@ -50,17 +50,13 @@
<button id="open-curated" class="workspace-navigation-item" type="button"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-sparkles"></use></svg><span data-i18n="精选案例">精选案例</span></button>
<button id="open-skills" class="workspace-navigation-item" type="button"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-wand-sparkles"></use></svg><span data-i18n="创作 Skill">创作 Skill</span></button>
</nav>
- <div class="sidebar-filter-tools">
- <strong id="active-filter-badge" class="filter-count-badge" hidden></strong>
- <button id="clear-filters" class="button-secondary" type="button" disabled data-i18n="清除全部筛选">清除全部筛选</button>
- </div>
<section id="project-section" class="project-section">
- <div class="filter-heading"><strong data-i18n="项目">项目</strong><span><button id="create-collection" type="button" data-i18n="新建项目">新建项目</button><button id="manage-project-order" class="icon-button" type="button" aria-label="管理项目顺序" title="管理项目顺序"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-sliders-horizontal"></use></svg></button></span></div>
+ <div class="filter-heading"><strong data-i18n="项目">项目</strong><span><button id="create-collection" type="button"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-plus"></use></svg><span data-i18n="新建">新建</span></button><button id="manage-project-order" class="icon-button" type="button" aria-label="管理项目顺序" title="管理项目顺序" data-i18n-aria-label="管理项目顺序" data-i18n-title="管理项目顺序"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-sliders-horizontal"></use></svg></button></span></div>
<div id="collection-filters" class="project-list" role="list"></div>
<p id="project-order-status" class="sr-only" role="status" aria-live="polite"></p>
</section>
<section class="sidebar-trash-section">
- <button id="open-trash" class="workspace-navigation-item" type="button"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-trash-2"></use></svg><span>回收站</span><strong id="trash-count" class="workspace-navigation-count" hidden></strong></button>
+ <button id="open-trash" class="workspace-navigation-item" type="button"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-trash-2"></use></svg><span data-i18n="回收站">回收站</span><strong id="trash-count" class="workspace-navigation-count" hidden></strong></button>
</section>
<section class="filter-section">
<div class="filter-heading"><strong data-i18n="内容类型">内容类型</strong><button id="manage-facets" type="button" data-i18n="分类与标签">整理</button></div>
@@ -72,30 +68,47 @@
<div id="facet-filters" class="facet-filters"></div>
</section>
</aside>
- <div id="sidebar-resizer" class="sidebar-resizer" role="separator" tabindex="0" aria-label="调整项目侧栏宽度" aria-orientation="vertical" aria-valuemin="216" aria-valuemax="420" aria-valuenow="244"></div>
+ <div id="sidebar-resizer" class="sidebar-resizer" role="separator" tabindex="0" aria-label="调整项目侧栏宽度" aria-orientation="vertical" aria-valuemin="216" aria-valuemax="420" aria-valuenow="244" data-i18n-aria-label="调整项目侧栏宽度"></div>
<main class="gallery-shell">
<div id="gallery-heading" class="gallery-heading">
- <strong id="result-count"></strong>
+ <div class="gallery-heading-copy"><h1 id="library-title"></h1><strong id="result-count"></strong></div>
<div id="gallery-view-controls" class="gallery-view-controls">
- <label class="gallery-sort-field"><span class="sr-only">案例排序</span><select id="gallery-sort" aria-label="案例排序"><option value="added-desc">最近加入</option><option value="updated-desc">最近更新</option><option value="title">标题</option><option id="project-manual-sort-option" value="project-manual" hidden>手动排序</option></select></label>
- <button id="manage-case-order" class="icon-button" type="button" aria-label="管理案例顺序" title="管理案例顺序" hidden><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-sliders-horizontal"></use></svg></button>
- <button id="select-cases" class="icon-button gallery-select-button" type="button" aria-label="选择案例" data-i18n-aria-label="选择案例" title="选择案例"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-square-check-big"></use></svg></button>
+ <label class="gallery-sort-field"><span class="sr-only" data-i18n="案例排序">案例排序</span><select id="gallery-sort" aria-label="案例排序" data-i18n-aria-label="案例排序"><option value="added-desc" data-i18n="最近加入">最近加入</option><option value="updated-desc" data-i18n="最近更新">最近更新</option><option value="title" data-i18n="标题">标题</option><option id="project-manual-sort-option" value="project-manual" hidden data-i18n="手动排序">手动排序</option></select></label>
+ <button id="manage-case-order" class="icon-button" type="button" aria-label="管理案例顺序" title="管理案例顺序" hidden data-i18n-aria-label="管理案例顺序" data-i18n-title="管理案例顺序"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-sliders-horizontal"></use></svg></button>
+ <button id="select-cases" class="icon-button gallery-select-button" type="button" aria-label="选择案例" data-i18n-aria-label="选择案例" title="选择案例" data-i18n-title="选择案例"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-square-check-big"></use></svg></button>
</div>
<div id="share-bar" class="share-bar" hidden>
- <strong id="share-count">已选 0</strong>
- <div id="selection-simple-actions">
- <button id="selection-select-filtered" class="button-secondary" type="button">全选筛选结果</button>
- <button id="selection-clear" class="button-secondary" type="button" disabled>清空</button>
- <label class="selection-label-field"><span class="sr-only">批量添加标签</span><input id="selection-label-input" type="text" placeholder="添加标签" autocomplete="off" /></label>
- <button id="selection-add-labels" class="button-secondary" type="button" disabled>添加标签</button>
- <select id="selection-project-target" aria-label="选择目标项目" data-i18n-aria-label="选择目标项目"><option value="" data-i18n="加入项目…">加入项目…</option></select>
- <button id="selection-add-project" class="button-secondary" type="button" disabled data-i18n="加入">加入</button>
- <button id="selection-new-project" class="button-secondary" type="button" disabled data-i18n="新建项目">新建项目</button>
- <button id="selection-combine" class="button-secondary" type="button" disabled data-i18n="组合">组合</button>
- <button id="selection-analyze" class="button-secondary" type="button" disabled data-i18n="批量分析画面">批量分析画面</button>
- <button id="share-export" type="button" disabled data-i18n="分享">分享</button>
- <button id="selection-trash" class="quiet-danger" type="button" disabled>移入回收站</button>
+ <strong id="share-count" data-i18n="已选 0">已选 0</strong>
+ <div id="selection-simple-actions" class="selection-simple-actions">
+ <button id="selection-select-filtered" class="button-secondary" type="button" data-i18n="全选筛选结果">全选筛选结果</button>
+ <div id="selection-selected-actions" class="selection-selected-actions" hidden>
+ <button id="selection-clear" class="button-secondary selection-compact-action" type="button" disabled aria-label="清空已选" data-i18n-aria-label="清空已选" title="清空已选" data-i18n-title="清空已选"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg><span class="selection-action-label" data-i18n="清空">清空</span></button>
+ <details id="selection-label-menu" class="selection-menu">
+ <summary aria-label="添加标签" data-i18n-aria-label="添加标签"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-tag"></use></svg><span class="selection-action-label" data-i18n="添加标签">添加标签</span></summary>
+ <div class="project-menu-panel selection-menu-panel selection-label-panel">
+ <label class="selection-label-field"><span data-i18n="添加标签">添加标签</span><input id="selection-label-input" type="text" placeholder="输入标签名" data-i18n-placeholder="输入标签名" autocomplete="off" /></label>
+ <button id="selection-add-labels" class="project-menu-primary" type="button" disabled data-i18n="添加标签">添加标签</button>
+ </div>
+ </details>
+ <details id="selection-project-menu" class="selection-menu">
+ <summary aria-label="加入项目" data-i18n-aria-label="加入项目"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-folder"></use></svg><span class="selection-action-label" data-i18n="加入项目">加入项目</span></summary>
+ <div class="project-menu-panel selection-menu-panel selection-project-panel">
+ <label><span data-i18n="选择目标项目">选择目标项目</span><select id="selection-project-target" aria-label="选择目标项目" data-i18n-aria-label="选择目标项目"><option value="" data-i18n="加入项目…">加入项目…</option></select></label>
+ <button id="selection-add-project" class="project-menu-primary" type="button" disabled data-i18n="加入">加入</button>
+ <button id="selection-new-project" class="button-secondary" type="button" disabled data-i18n="新建项目">新建项目</button>
+ </div>
+ </details>
+ <button id="share-export" type="button" disabled data-i18n="分享">分享</button>
+ <details id="selection-more-menu" class="selection-menu">
+ <summary aria-label="更多" data-i18n-aria-label="更多"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-ellipsis"></use></svg><span class="selection-action-label" data-i18n="更多">更多</span></summary>
+ <div class="project-menu-panel selection-menu-panel selection-more-panel">
+ <button id="selection-combine" class="button-secondary" type="button" disabled data-i18n="组合案例">组合案例</button>
+ <button id="selection-analyze" class="button-secondary" type="button" disabled data-i18n="批量分析画面">批量分析画面</button>
+ <button id="selection-trash" class="quiet-danger" type="button" disabled data-i18n="移入回收站">移入回收站</button>
+ </div>
+ </details>
+ </div>
<button id="share-cancel" class="button-secondary" type="button" data-i18n="取消">取消</button>
</div>
</div>
@@ -130,13 +143,13 @@
</div>
<div id="library-drop-target" class="library-drop-target" hidden aria-hidden="true">
- <div><strong>松开以检查本机资料</strong><span>导入前可确认项目、重复项和画面分析</span></div>
+ <div><strong data-i18n="松开以检查本机资料">松开以检查本机资料</strong><span data-i18n="导入前可确认项目、重复项和画面分析">导入前可确认项目、重复项和画面分析</span></div>
</div>
<dialog id="share-dialog" class="data-safety-dialog share-dialog" aria-labelledby="share-dialog-title">
<header class="data-safety-header">
<div><p class="eyebrow">SHARE CASES</p><h2 id="share-dialog-title" data-i18n="分享案例">分享案例</h2></div>
- <button id="share-dialog-close" class="icon-button" type="button" aria-label="关闭分享" title="关闭分享"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button>
+ <button id="share-dialog-close" class="icon-button" type="button" aria-label="关闭分享" title="关闭分享" data-i18n-aria-label="关闭分享" data-i18n-title="关闭分享"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button>
</header>
<div class="data-safety-body share-dialog-body">
<p id="share-dialog-meta" class="share-dialog-meta"></p>
@@ -154,87 +167,87 @@
<dialog id="trash-dialog" class="data-safety-dialog trash-dialog" aria-labelledby="trash-dialog-title">
<header class="data-safety-header">
- <div><h2 id="trash-dialog-title">回收站</h2></div>
- <button id="trash-close" class="icon-button" type="button" aria-label="关闭回收站" title="关闭回收站"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button>
+ <div><h2 id="trash-dialog-title" data-i18n="回收站">回收站</h2></div>
+ <button id="trash-close" class="icon-button" type="button" aria-label="关闭回收站" data-i18n-aria-label="关闭回收站" title="关闭回收站" data-i18n-title="关闭回收站"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button>
</header>
<div class="data-safety-body trash-dialog-body">
<div id="trash-list" class="trash-list" aria-live="polite"></div>
<p id="trash-feedback" class="data-safety-feedback" role="status" aria-live="polite"></p>
</div>
<footer class="data-safety-actions trash-actions">
- <button id="trash-restore-all" class="button-secondary" type="button">全部恢复</button>
- <button id="trash-empty" class="quiet-danger" type="button" disabled>清空回收站</button>
+ <button id="trash-restore-all" class="button-secondary" type="button" data-i18n="全部恢复">全部恢复</button>
+ <button id="trash-empty" class="quiet-danger" type="button" disabled data-i18n="清空回收站">清空回收站</button>
</footer>
</dialog>
<dialog id="import-dialog" class="data-safety-dialog import-dialog" aria-labelledby="import-dialog-title">
<header class="data-safety-header">
- <div><p class="eyebrow">LOCAL IMPORT</p><h2 id="import-dialog-title">确认导入</h2></div>
- <button id="import-close" class="icon-button" type="button" aria-label="关闭导入" title="关闭导入"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button>
+ <div><p class="eyebrow">LOCAL IMPORT</p><h2 id="import-dialog-title" data-i18n="确认导入">确认导入</h2></div>
+ <button id="import-close" class="icon-button" type="button" aria-label="关闭导入" title="关闭导入" data-i18n-aria-label="关闭导入" data-i18n-title="关闭导入"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button>
</header>
<div class="data-safety-body import-dialog-body">
<section id="import-source" class="import-source">
<div class="import-drop-zone">
<svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-upload"></use></svg>
- <strong>拖入文件或文件夹</strong>
- <span>自动识别图片、视频、音频、字幕、文档和常用创作源文件;不支持的格式仍可保留本机链接</span>
- <button id="import-choose-files" type="button">选择文件</button>
- <button id="add-folder" class="import-folder-link" type="button">选择整个文件夹</button>
+ <strong data-i18n="拖入文件或文件夹">拖入文件或文件夹</strong>
+ <span data-i18n="自动识别图片、视频、音频、字幕、文档和常用创作源文件;不支持的格式仍可保留本机链接">自动识别图片、视频、音频、字幕、文档和常用创作源文件;不支持的格式仍可保留本机链接</span>
+ <button id="import-choose-files" type="button" data-i18n="选择文件">选择文件</button>
+ <button id="add-folder" class="import-folder-link" type="button" data-i18n="选择整个文件夹">选择整个文件夹</button>
</div>
- <button id="import-last-job" class="import-last-job button-secondary" type="button" hidden>上次导入 · 查看</button>
+ <button id="import-last-job" class="import-last-job button-secondary" type="button" hidden data-i18n="上次导入 · 查看">上次导入 · 查看</button>
</section>
- <div id="import-preparing" class="import-preparing" role="status" aria-live="polite" hidden>正在检查文件…</div>
+ <div id="import-preparing" class="import-preparing" role="status" aria-live="polite" hidden data-i18n="正在检查文件…">正在检查文件…</div>
<section id="import-confirmation" class="import-confirmation" hidden>
- <div class="import-summary" aria-label="导入摘要">
- <span><strong id="import-supported-count">0</strong> 可导入</span>
- <span><strong id="import-skipped-count">0</strong> 跳过</span>
- <span><strong id="import-duplicate-count">0</strong> 重复</span>
- <span><strong id="import-byte-size">0 B</strong> 预计占用</span>
+ <div class="import-summary" aria-label="导入摘要" data-i18n-aria-label="导入摘要">
+ <span><strong id="import-supported-count">0</strong> <span data-i18n="可导入">可导入</span></span>
+ <span><strong id="import-skipped-count">0</strong> <span data-i18n="跳过">跳过</span></span>
+ <span><strong id="import-duplicate-count">0</strong> <span data-i18n="重复">重复</span></span>
+ <span><strong id="import-byte-size">0 B</strong> <span data-i18n="预计占用">预计占用</span></span>
</div>
<div class="import-options">
- <label class="import-project-field"><span>项目</span><input id="import-project" autocomplete="off" placeholder="选择已有项目或输入新项目名" /><small id="import-project-hint"></small></label>
- <label class="import-check"><input id="import-auto-analyze" type="checkbox" /><span>导入后自动画面分析</span></label>
+ <label class="import-project-field"><span data-i18n="项目">项目</span><input id="import-project" autocomplete="off" placeholder="选择已有项目或输入新项目名" data-i18n-placeholder="选择已有项目或输入新项目名" /><small id="import-project-hint"></small></label>
+ <label class="import-check"><input id="import-auto-analyze" type="checkbox" /><span data-i18n="导入后自动画面分析">导入后自动画面分析</span></label>
</div>
<div class="import-label-field">
- <span>添加标签</span>
+ <span data-i18n="添加标签">添加标签</span>
<div id="import-label-editor" class="import-label-editor"></div>
</div>
- <div id="import-file-list" class="import-file-list" aria-label="待导入文件"></div>
+ <div id="import-file-list" class="import-file-list" aria-label="待导入文件" data-i18n-aria-label="待导入文件"></div>
<p id="import-feedback" class="import-feedback" role="status" aria-live="polite"></p>
</section>
<section id="import-job-panel" class="import-job-panel" hidden>
- <div class="import-job-summary"><strong id="import-job-title">正在导入</strong><span id="import-job-count"></span></div>
+ <div class="import-job-summary"><strong id="import-job-title" data-i18n="正在导入">正在导入</strong><span id="import-job-count"></span></div>
<progress id="import-job-progress" max="1" value="0"></progress>
<p id="import-job-feedback" class="import-feedback" role="status" aria-live="polite"></p>
</section>
</div>
<footer id="import-actions" class="data-safety-actions import-actions" hidden>
- <button id="import-cancel" class="button-secondary" type="button">取消</button>
- <button id="import-retry" class="button-secondary" type="button" hidden>重试失败项</button>
- <button id="import-undo" class="button-secondary quiet-danger" type="button" hidden>撤销本次导入</button>
- <button id="import-view-project" class="button-secondary" type="button" hidden>查看导入项目</button>
- <button id="import-start" type="button">开始导入</button>
+ <button id="import-cancel" class="button-secondary" type="button" data-i18n="取消">取消</button>
+ <button id="import-retry" class="button-secondary" type="button" hidden data-i18n="重试失败项">重试失败项</button>
+ <button id="import-undo" class="button-secondary quiet-danger" type="button" hidden data-i18n="撤销本次导入">撤销本次导入</button>
+ <button id="import-view-project" class="button-secondary" type="button" hidden data-i18n="查看导入项目">查看导入项目</button>
+ <button id="import-start" type="button" data-i18n="开始导入">开始导入</button>
</footer>
</dialog>
<div id="drawer-backdrop" class="drawer-backdrop" hidden></div>
<aside id="detail-drawer" class="detail-drawer" role="dialog" aria-modal="true" aria-label="案例详情" data-i18n-aria-label="案例详情" aria-hidden="true">
<header id="drawer-toolbar" class="drawer-toolbar">
- <nav id="detail-navigation" class="detail-navigation" aria-label="切换案例"><button id="detail-prev" class="icon-button" type="button" aria-label="上一条" data-i18n-aria-label="上一条" title="上一条"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-chevron-left"></use></svg></button><button id="detail-next" class="icon-button" type="button" aria-label="下一条" data-i18n-aria-label="下一条" title="下一条"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-chevron-right"></use></svg></button></nav>
- <button id="detail-close" class="icon-button" type="button" aria-label="关闭详情" data-i18n-aria-label="关闭详情" title="关闭详情"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button>
+ <nav id="detail-navigation" class="detail-navigation" aria-label="切换案例" data-i18n-aria-label="切换案例"><button id="detail-prev" class="icon-button" type="button" aria-label="上一条" data-i18n-aria-label="上一条" title="上一条" data-i18n-title="上一条"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-chevron-left"></use></svg></button><button id="detail-next" class="icon-button" type="button" aria-label="下一条" data-i18n-aria-label="下一条" title="下一条" data-i18n-title="下一条"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-chevron-right"></use></svg></button></nav>
+ <button id="detail-close" class="icon-button" type="button" aria-label="关闭详情" data-i18n-aria-label="关闭详情" title="关闭详情" data-i18n-title="关闭详情"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button>
</header>
<div id="detail-content" class="detail-content"></div>
</aside>
<dialog id="image-lightbox" class="image-lightbox" aria-label="查看原图" data-i18n-aria-label="查看原图">
- <button id="image-lightbox-close" class="icon-button" type="button" aria-label="关闭原图" data-i18n-aria-label="关闭原图" title="关闭原图"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button>
+ <button id="image-lightbox-close" class="icon-button" type="button" aria-label="关闭原图" data-i18n-aria-label="关闭原图" title="关闭原图" data-i18n-title="关闭原图"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button>
<img id="image-lightbox-image" alt="" />
</dialog>
<dialog id="settings-dialog" class="data-safety-dialog settings-dialog">
- <header class="data-safety-header"><div><p class="eyebrow">PROMPTDIRECTOR</p><h2 data-i18n="设置">设置</h2></div><button id="settings-close" class="icon-button" type="button" aria-label="关闭设置" data-i18n-aria-label="关闭设置" title="关闭设置"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button></header>
+ <header class="data-safety-header"><div><p class="eyebrow">PROMPTDIRECTOR</p><h2 data-i18n="设置">设置</h2></div><button id="settings-close" class="icon-button" type="button" aria-label="关闭设置" data-i18n-aria-label="关闭设置" title="关闭设置" data-i18n-title="关闭设置"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button></header>
<div class="data-safety-body settings-shell">
- <nav class="settings-tabs" aria-label="设置视图">
+ <nav class="settings-tabs" aria-label="设置视图" data-i18n-aria-label="设置视图">
<button type="button" data-settings-tab="general" aria-selected="true" data-i18n="界面与资料库">界面与资料库</button>
<button type="button" data-settings-tab="ai" aria-selected="false" data-i18n="AI 配置">AI 配置</button>
<button type="button" data-settings-tab="tasks" aria-selected="false" data-i18n="任务与维护">任务与维护</button>
@@ -244,85 +257,87 @@
<label><span data-i18n="主题">主题</span><select id="ui-theme"><option value="system" data-i18n="跟随系统">跟随系统</option><option value="light" data-i18n="浅色">浅色</option><option value="dark" data-i18n="深色">深色</option></select></label>
<label><span data-i18n="动态效果">动态效果</span><select id="ui-motion"><option value="system" data-i18n="跟随系统">跟随系统</option><option value="reduced" data-i18n="减少动态效果">减少动态效果</option></select></label>
<section class="library-storage-settings">
- <label><span data-i18n="资料库标题">资料库标题</span><input id="library-name-setting" autocomplete="off" /></label>
+ <label><span data-i18n="资料库名称">资料库名称</span><input id="library-name-setting" autocomplete="off" /></label>
+ <p class="library-name-note" data-i18n="资料库名称用于工作空间和导出文件,不会改变 PromptDirector 品牌名称。">资料库名称用于工作空间和导出文件,不会改变 PromptDirector 品牌名称。</p>
<label><span data-i18n="分享包下载路径">分享包下载路径</span><input id="export-path-setting" autocomplete="off" /></label>
<div><button id="save-library-settings" class="button-secondary" type="button" disabled data-i18n="保存设置">保存设置</button></div>
</section>
<section class="settings-general-section capture-permission-settings">
- <div class="section-heading section-heading-tight"><div><h3>采集权限</h3><p>仅在你主动截图、采集网页或提取剪贴板时使用。</p></div></div>
+ <div class="section-heading section-heading-tight"><div><h3 data-i18n="采集权限">采集权限</h3><p data-i18n="仅在你主动截图、采集网页或提取剪贴板时使用。">仅在你主动截图、采集网页或提取剪贴板时使用。</p></div></div>
<div class="capture-permission-list">
<div class="capture-permission-row">
- <div><strong>网页采集与截图</strong><span id="capture-web-permission-status">正在检查…</span></div>
- <button id="revoke-capture-web-permission" class="button-secondary" type="button" disabled>撤销</button>
+ <div><strong data-i18n="网页采集与截图">网页采集与截图</strong><span id="capture-web-permission-status" data-i18n="正在检查…">正在检查…</span></div>
+ <button id="revoke-capture-web-permission" class="button-secondary" type="button" disabled data-i18n="撤销">撤销</button>
</div>
<div class="capture-permission-row">
- <div><strong>剪贴板提取</strong><span id="capture-clipboard-permission-status">正在检查…</span></div>
- <button id="revoke-capture-clipboard-permission" class="button-secondary" type="button" disabled>撤销</button>
+ <div><strong data-i18n="剪贴板提取">剪贴板提取</strong><span id="capture-clipboard-permission-status" data-i18n="正在检查…">正在检查…</span></div>
+ <button id="revoke-capture-clipboard-permission" class="button-secondary" type="button" disabled data-i18n="撤销">撤销</button>
</div>
</div>
<p id="capture-permission-settings-feedback" class="data-safety-feedback" role="status" aria-live="polite"></p>
- <p class="data-safety-note">这里不会读取剪贴板。撤销后,下次主动使用对应采集功能时会重新说明用途并由你确认。</p>
+ <p class="data-safety-note" data-i18n="这里不会读取剪贴板。撤销后,下次主动使用对应采集功能时会重新说明用途并由你确认。">这里不会读取剪贴板。撤销后,下次主动使用对应采集功能时会重新说明用途并由你确认。</p>
</section>
<section id="data-safety-dialog" class="settings-general-section settings-data-safety">
- <div class="section-heading section-heading-tight"><div><h3 data-i18n="备份与同步">备份与同步</h3><p>备份、恢复或连接自己的同步文件夹。</p></div></div>
+ <div class="section-heading section-heading-tight"><div><h3 data-i18n="备份与同步">备份与同步</h3><p data-i18n="备份、恢复或连接自己的同步文件夹。">备份、恢复或连接自己的同步文件夹。</p></div></div>
<section class="data-safety-summary">
- <strong id="data-safety-count">0 个案例 · 0 张图片</strong>
+ <strong id="data-safety-count" data-i18n="0 个案例 · 0 张图片">0 个案例 · 0 张图片</strong>
<span id="data-safety-status" data-i18n="尚未连接同步文件夹">尚未连接同步文件夹</span>
</section>
<p id="data-safety-feedback" class="data-safety-feedback" role="status" aria-live="polite"></p>
<section class="share-package-import">
- <div><strong>导入分享包</strong><span>添加别人分享的案例或项目,不覆盖现有资料</span></div>
- <button id="import-library-package" class="button-secondary" type="button">选择 ZIP</button>
+ <div><strong data-i18n="导入分享包">导入分享包</strong><span data-i18n="添加别人分享的案例或项目,不覆盖现有资料">添加别人分享的案例或项目,不覆盖现有资料</span></div>
+ <button id="import-library-package" class="button-secondary" type="button" data-i18n="选择 ZIP">选择 ZIP</button>
<input id="library-package-file" type="file" accept=".zip,application/zip" hidden />
</section>
<div class="data-safety-primary-actions">
- <button id="create-folder-backup" type="button">备份资料库</button>
- <button id="restore-folder-backup" class="button-secondary" type="button">恢复资料库</button>
+ <button id="create-folder-backup" type="button" data-i18n="备份资料库">备份资料库</button>
+ <button id="restore-folder-backup" class="button-secondary" type="button" data-i18n="恢复资料库">恢复资料库</button>
</div>
- <p class="data-safety-note">备份会把案例和本地媒体逐项写入资料夹;恢复前会先检查内容,不会覆盖现有资料。</p>
+ <p class="data-safety-note" data-i18n="备份会把案例和本地媒体逐项写入资料夹;恢复前会先检查内容,不会覆盖现有资料。">备份会把案例和本地媒体逐项写入资料夹;恢复前会先检查内容,不会覆盖现有资料。</p>
<details id="sync-settings" class="sync-settings">
<summary data-i18n="跨设备同步">跨设备同步</summary>
<div class="sync-settings-body">
<p class="data-safety-note" data-i18n="同一台电脑可选择普通本地文件夹;跨设备请选择已登录的 iCloud Drive、Dropbox 或 OneDrive 文件夹。两端选择同一个父文件夹并使用相同密码。插件会在其中创建 PromptDirector-Sync,请勿手动修改。">同一台电脑可选择普通本地文件夹;跨设备请选择已登录的 iCloud Drive、Dropbox 或 OneDrive 文件夹。两端选择同一个父文件夹并使用相同密码。插件会在其中创建 PromptDirector-Sync,请勿手动修改。</p>
- <p class="data-safety-note">连接和解锁只验证文件夹与密码,不会读取、合并或上传资料。只有你再次确认“立即同步”后,才会执行一次同步。</p>
+ <p class="data-safety-note" data-i18n="连接和解锁只验证文件夹与密码,不会读取、合并或上传资料。只有你再次确认“立即同步”后,才会执行一次同步。">连接和解锁只验证文件夹与密码,不会读取、合并或上传资料。只有你再次确认“立即同步”后,才会执行一次同步。</p>
<label id="data-safety-password" class="data-safety-password"><span data-i18n="同步密码">同步密码</span><input id="sync-password" type="password" minlength="8" autocomplete="off" placeholder="至少 8 个字符" data-i18n-placeholder="至少 8 个字符" /></label>
<div class="data-safety-secondary-actions">
<button id="connect-sync-folder" type="button" data-i18n="连接同步文件夹">连接同步文件夹</button>
<button id="unlock-sync-vault" type="button" data-i18n="解锁同步库">解锁同步库</button>
<button id="sync-now" type="button" data-i18n="立即同步">立即同步</button>
- <button id="cancel-sync" class="button-secondary" type="button" hidden>停止同步</button>
+ <button id="cancel-sync" class="button-secondary" type="button" hidden data-i18n="停止同步">停止同步</button>
<button id="disconnect-sync-folder" class="quiet-danger" type="button" data-i18n="断开同步">断开同步</button>
</div>
</div>
</details>
</section>
<footer class="settings-about">
+ <p class="settings-brand-slogan" data-i18n="提示词导演,你的视觉创作私人灵感库。">提示词导演,你的视觉创作私人灵感库。</p>
<div class="settings-about-heading">
- <div><strong id="about-version">PromptDirector</strong><span id="update-channel">正在确认安装方式…</span></div>
- <strong id="update-status" class="update-status-badge">正在检查</strong>
+ <div><strong id="about-version">PromptDirector</strong><span id="update-channel" data-i18n="正在确认安装方式…">正在确认安装方式…</span></div>
+ <strong id="update-status" class="update-status-badge" data-i18n="正在检查">正在检查</strong>
</div>
<div class="settings-update-details">
- <span id="update-checked-at">最近检查:—</span>
- <span id="update-available-version">可用版本:—</span>
+ <span id="update-checked-at" data-i18n="最近检查:—">最近检查:—</span>
+ <span id="update-available-version" data-i18n="可用版本:—">可用版本:—</span>
</div>
- <p id="update-explanation" class="settings-update-explanation">商店版由 Chrome 自动更新;本地开发版可安全重载当前目录。</p>
+ <p id="update-explanation" class="settings-update-explanation" data-i18n="商店版由 Chrome 自动更新;本地开发版可安全重载当前目录。">商店版由 Chrome 自动更新;本地开发版可安全重载当前目录。</p>
<div class="settings-update-actions">
- <button id="check-extension-update" class="button-secondary" type="button">检查更新</button>
+ <button id="check-extension-update" class="button-secondary" type="button" data-i18n="检查更新">检查更新</button>
<button id="apply-extension-update" type="button" hidden></button>
- <a id="update-release-link" class="button-primary update-download-action" href="https://github.com/wchao6891/PromptDirector/releases" target="_blank" rel="noopener noreferrer" hidden>下载新版本</a>
+ <a id="update-release-link" class="button-primary update-download-action" href="https://github.com/wchao6891/PromptDirector/releases" target="_blank" rel="noopener noreferrer" hidden data-i18n="下载新版本">下载新版本</a>
</div>
<p id="update-feedback" class="data-safety-feedback" role="status" aria-live="polite"></p>
- <span>免费、开源、本地优先 · Apache-2.0</span>
+ <span data-i18n="免费、开源、本地优先 · Apache-2.0">免费、开源、本地优先 · Apache-2.0</span>
<a class="source-link" href="https://github.com/wchao6891/PromptDirector" target="_blank" rel="noopener noreferrer">github.com/wchao6891/PromptDirector</a>
</footer>
</section>
<section id="settings-tasks-panel" class="settings-panel settings-tasks-panel" data-settings-panel="tasks" hidden>
<div class="batch-card batch-primary">
- <div class="batch-card-heading"><div><h3>批量文字分析</h3><p>使用“文字工作”中已分配的供应商和模型;只处理未分析或原文已变化的文字案例。</p></div><span id="batch-status-badge" data-i18n="尚未开始">尚未开始</span></div>
+ <div class="batch-card-heading"><div><h3 data-i18n="批量文字分析">批量文字分析</h3><p data-i18n="使用“文字工作”中已分配的供应商和模型;只处理未分析或原文已变化的文字案例。">使用“文字工作”中已分配的供应商和模型;只处理未分析或原文已变化的文字案例。</p></div><span id="batch-status-badge" data-i18n="尚未开始">尚未开始</span></div>
<div id="analysis-batch-summary" class="batch-summary" data-i18n="先生成预览,不会直接产生 API 请求。">先生成预览,不会直接产生 API 请求。</div>
<details id="analysis-diagnostics" class="analysis-diagnostics" hidden>
- <summary><span>分析诊断</span><span id="analysis-runtime-version"></span></summary>
- <div class="analysis-diagnostics-heading"><p>仅记录运行版本、阶段、标签数量、耗时和错误类别;不记录案例原文、API Key 或模型完整输出。</p><button id="copy-analysis-diagnostics" class="button-secondary" type="button">复制诊断日志</button></div>
+ <summary><span data-i18n="分析诊断">分析诊断</span><span id="analysis-runtime-version"></span></summary>
+ <div class="analysis-diagnostics-heading"><p data-i18n="仅记录运行版本、阶段、标签数量、耗时和错误类别;不记录案例原文、API Key 或模型完整输出。">仅记录运行版本、阶段、标签数量、耗时和错误类别;不记录案例原文、API Key 或模型完整输出。</p><button id="copy-analysis-diagnostics" class="button-secondary" type="button" data-i18n="复制诊断日志">复制诊断日志</button></div>
<ol id="analysis-diagnostic-events"></ol>
</details>
<div id="analysis-progress" class="maintenance-progress" hidden><progress id="analysis-progress-bar" max="1" value="0"></progress></div>
@@ -332,18 +347,18 @@
<button id="pause-analysis-batch" class="button-secondary" type="button" hidden data-i18n="暂停">暂停</button>
<button id="resume-analysis-batch" type="button" hidden data-i18n="继续">继续</button>
<button id="retry-analysis-failures" class="button-secondary" type="button" hidden data-i18n="重试失败项">重试失败项</button>
- <button id="apply-staged-analysis-rebuild" type="button" hidden>应用已成功结果</button>
+ <button id="apply-staged-analysis-rebuild" type="button" hidden data-i18n="应用已成功结果">应用已成功结果</button>
<button id="cancel-analysis-batch" class="quiet-danger" type="button" hidden data-i18n="取消">取消</button>
<button id="undo-analysis-batch" class="button-secondary" type="button" hidden data-i18n="撤回本次分析">撤回本次分析</button>
</div>
- <details class="advanced-reanalysis"><summary>重建标签系统</summary><p>付费重跑全部文字案例;结果先暂存,全部成功后一次切换,并可完整撤回。</p><div class="batch-actions"><button id="preview-analysis-reanalyze" class="button-secondary" type="button">预览重建费用</button><button id="start-analysis-reanalyze" type="button" disabled hidden>确认付费并重建</button></div></details>
+ <details class="advanced-reanalysis"><summary data-i18n="重建标签系统">重建标签系统</summary><p data-i18n="付费重跑全部文字案例;结果先暂存,全部成功后一次切换,并可完整撤回。">付费重跑全部文字案例;结果先暂存,全部成功后一次切换,并可完整撤回。</p><div class="batch-actions"><button id="preview-analysis-reanalyze" class="button-secondary" type="button" data-i18n="预览重建费用">预览重建费用</button><button id="start-analysis-reanalyze" type="button" disabled hidden data-i18n="确认付费并重建">确认付费并重建</button></div></details>
</div>
<div class="batch-card local-index-card">
- <h3>补全资料索引</h3>
- <p>补齐导入案例的内容类型和图片色卡,用于分类筛选、颜色展示和相似资料匹配;全程在本机运行,不调用 AI。</p>
+ <h3 data-i18n="资料索引自动补全">资料索引自动补全</h3>
+ <p data-i18n="每次导入后会在本机自动补齐内容类型和图片色卡,不调用 AI。这里可查看状态或重试失败项。">每次导入后会在本机自动补齐内容类型和图片色卡,不调用 AI。这里可查看状态或重试失败项。</p>
<div class="batch-actions">
<button id="preview-reanalyze" type="button" data-i18n="检查缺失项">检查缺失项</button>
- <button id="apply-reanalyze" type="button" hidden>开始补全</button>
+ <button id="apply-reanalyze" type="button" hidden data-i18n="开始补全">开始补全</button>
<button id="pause-library-maintenance" class="button-secondary" type="button" hidden data-i18n="暂停">暂停</button>
<button id="resume-library-maintenance" type="button" hidden data-i18n="继续">继续</button>
<button id="retry-library-maintenance" class="button-secondary" type="button" hidden data-i18n="重试失败项">重试失败项</button>
@@ -355,8 +370,8 @@
</section>
<section id="settings-ai-panel" class="settings-panel settings-ai-panel" data-settings-panel="ai" hidden>
<section class="ai-routing-card">
- <div class="ai-routing-heading"><h3 data-i18n="AI 配置">AI 配置</h3><p id="ai-routing-summary">先按任务选择默认服务;API Key 只需在连接服务时填写一次。</p></div>
- <nav class="ai-routing-tabs" role="tablist" aria-label="AI 配置视图">
+ <div class="ai-routing-heading"><h3 data-i18n="AI 配置">AI 配置</h3><p id="ai-routing-summary" data-i18n="先按任务选择默认服务;API Key 只需在连接服务时填写一次。">先按任务选择默认服务;API Key 只需在连接服务时填写一次。</p></div>
+ <nav class="ai-routing-tabs" role="tablist" aria-label="AI 配置视图" data-i18n-aria-label="AI 配置视图">
<button type="button" data-ai-routing-tab="tasks" aria-selected="true" data-i18n="任务默认">任务默认</button>
<button type="button" data-ai-routing-tab="providers" aria-selected="false" data-i18n="服务连接">服务连接</button>
</nav>
@@ -436,11 +451,11 @@
<dialog id="vision-batch-dialog" class="data-safety-dialog vision-batch-dialog">
<header class="data-safety-header">
<div><p class="eyebrow">VISION TASK</p><h2 data-i18n="批量分析画面">批量分析画面</h2></div>
- <button id="vision-batch-close" class="icon-button" type="button" aria-label="关闭批量画面分析" data-i18n-aria-label="关闭批量画面分析" title="关闭批量画面分析"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button>
+ <button id="vision-batch-close" class="icon-button" type="button" aria-label="关闭批量画面分析" data-i18n-aria-label="关闭批量画面分析" title="关闭批量画面分析" data-i18n-title="关闭批量画面分析"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button>
</header>
<div class="data-safety-body">
<section class="data-safety-summary">
- <strong id="vision-batch-summary">0 个案例 · 0 次图片请求</strong>
+ <strong id="vision-batch-summary" data-i18n="0 个案例 · 0 次图片请求">0 个案例 · 0 次图片请求</strong>
<span id="vision-batch-service"></span>
</section>
<label class="task-option"><input id="vision-batch-all-images" type="checkbox" /><span data-i18n="分析所选案例中的全部未分析图片">分析所选案例中的全部未分析图片</span></label>
@@ -460,7 +475,7 @@
<dialog id="manager-dialog" class="manager-dialog">
<header class="manager-header">
<div><p class="eyebrow">ORGANIZE LIBRARY</p><h2 data-i18n="分类与标签">分类与标签</h2></div>
- <button id="manager-close" class="icon-button" type="button" aria-label="关闭管理" data-i18n-aria-label="关闭管理" title="关闭管理"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button>
+ <button id="manager-close" class="icon-button" type="button" aria-label="关闭管理" data-i18n-aria-label="关闭管理" title="关闭管理" data-i18n-title="关闭管理"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button>
</header>
<nav class="manager-tabs" aria-label="管理视图" data-i18n-aria-label="管理视图">
<button type="button" data-manager-tab="pending" aria-selected="false" data-i18n="待确认">待确认</button>
@@ -493,13 +508,13 @@
<section id="manager-vocabulary" class="manager-panel" hidden>
<div class="vocabulary-toolbar">
<label class="dimension-picker"><span data-i18n="当前维度">当前维度</span><select id="vocabulary-facet"></select></label>
- <button id="organize-detail-tags" class="button-secondary" type="button">一键整理三级标签</button>
+ <button id="organize-detail-tags" class="button-secondary" type="button" data-i18n="一键整理三级标签">一键整理三级标签</button>
<button id="undo-facet" class="button-secondary" type="button" hidden data-i18n="撤回刚才修改">撤回刚才修改</button>
</div>
<p id="organize-detail-status" class="field-note"></p>
<section class="vocabulary-workspace">
- <p class="field-note">一级维度固定;可在下方维护二级分组和三级标签。</p>
+ <p class="field-note" data-i18n="一级维度固定;可在下方维护二级分组和三级标签。">一级维度固定;可在下方维护二级分组和三级标签。</p>
<div class="section-heading">
<div><h3 data-i18n="标签">标签</h3><p data-i18n="点击标签可改名、移动、合并或维护识别词。">点击标签可改名、移动、合并或维护识别词。</p></div>
diff --git a/library.js b/library.js
index e5ba1e7..5a41b82 100644
--- a/library.js
+++ b/library.js
@@ -1,4 +1,4 @@
-import { renderLibraryJson, screenshotStorageKey } from "./lib.js";
+import { libraryTitleForLocale, libraryTitleForStorage, renderLibraryJson, screenshotStorageKey } from "./lib.js";
import { readImageDimensions } from "./image-metadata.js";
import { deleteScreenshotBlob, getScreenshotBlob, saveScreenshotBlob } from "./image-store.js";
import {
@@ -159,12 +159,12 @@ import { SIDEBAR_WIDTH_LIMITS, normalizeSidebarWidth } from "./preferences.js";
let uiPreferences = await initializeUi();
bindUiPreferenceReload();
-bindTransientMenus(document, ".package-menu, .project-menu, .detail-analysis-menu, .detail-project-menu");
+bindTransientMenus(document, ".package-menu, .project-menu, .detail-analysis-menu, .detail-project-menu, .selection-menu");
const libraryWindowId = (await chrome.windows.getCurrent()).id;
const elements = Object.fromEntries([
- "about-version", "active-filter-badge", "add-folder", "add-media", "add-video-reference", "ai-settings-form", "ai-settings-status", "ai-routing-summary", "ai-provider-list", "ai-assignment-list", "open-ai-routing", "analysis-instructions-en", "analysis-instructions-zh", "analysis-protocol", "apply-reanalyze", "case-list", "cancel-library-maintenance",
- "clear-filters", "content-filters", "content-type-count", "content-type-name", "content-type-replacement", "content-type-replacement-field", "content-type-role", "content-type-role-help",
+ "about-version", "add-folder", "add-media", "add-video-reference", "ai-settings-form", "ai-settings-status", "ai-routing-summary", "ai-provider-list", "ai-assignment-list", "open-ai-routing", "analysis-instructions-en", "analysis-instructions-zh", "analysis-protocol", "apply-reanalyze", "case-list", "cancel-library-maintenance",
+ "content-filters", "content-type-count", "content-type-name", "content-type-replacement", "content-type-replacement-field", "content-type-role", "content-type-role-help",
"content-type-list", "content-type-editor", "content-type-editor-title", "content-type-delete-transfer", "content-type-delete-message",
"add-content-type", "cancel-content-type-edit", "cancel-delete-content-type", "confirm-delete-content-type", "save-content-type",
"collection-filters", "create-collection",
@@ -181,7 +181,7 @@ const elements = Object.fromEntries([
"project-selection-actions", "project-selection-cancel", "project-selection-clear", "project-selection-count", "project-selection-save", "project-selection-select-all", "project-selection-select-filtered", "project-selection-title", "project-order-status", "restore-analysis-default", "search-input", "share-bar", "share-cancel", "share-count", "share-export", "start-analysis-batch", "start-compose", "toggle-filters", "undo-analysis-batch", "undo-facet", "vocabulary-facet", "workspace-library",
"share-dialog", "share-dialog-close", "share-dialog-title", "share-dialog-meta", "share-dialog-options", "share-dialog-export", "share-dialog-submit", "share-dialog-disclosure", "share-dialog-result", "share-dialog-result-text", "share-dialog-show-files", "share-dialog-open-form",
"add-menu", "export-path-setting", "media-file", "media-folder", "library-name-setting", "save-library-settings", "select-cases", "selection-select-filtered", "selection-clear", "selection-label-input", "selection-add-labels", "selection-add-project", "selection-new-project", "selection-combine", "selection-analyze", "selection-project-target", "selection-trash", "open-settings", "settings-dialog", "settings-close", "settings-update-badge", "update-channel", "update-status", "update-checked-at", "update-available-version", "update-explanation", "check-extension-update", "apply-extension-update", "update-release-link", "update-feedback",
- "project-section", "manage-project-order", "selection-simple-actions", "show-analysis-diagnostics", "ui-locale", "ui-theme", "ui-motion", "vocabulary-tree",
+ "project-section", "manage-project-order", "selection-simple-actions", "selection-selected-actions", "show-analysis-diagnostics", "ui-locale", "ui-theme", "ui-motion", "vocabulary-tree",
"vision-instructions-en", "vision-instructions-zh", "vision-protocol", "vision-settings-form", "vision-settings-status", "restore-vision-default",
"open-curated", "open-skills", "open-trash", "trash-count", "trash-dialog", "trash-close", "trash-list", "trash-feedback", "trash-restore-all", "trash-empty", "data-safety-dialog", "data-safety-count", "data-safety-status", "data-safety-feedback",
"sync-settings", "data-safety-password", "sync-password", "connect-sync-folder", "unlock-sync-vault", "sync-now", "cancel-sync", "create-folder-backup", "restore-folder-backup", "import-library-package", "library-package-file", "disconnect-sync-folder", "capture-web-permission-status", "capture-clipboard-permission-status", "revoke-capture-web-permission", "revoke-capture-clipboard-permission", "capture-permission-settings-feedback",
@@ -563,7 +563,6 @@ function bindEvents() {
renderAiRoutingView();
}));
aiAdvancedSettingsSummary?.addEventListener("click", () => preserveSettingsAnchor(aiAdvancedSettingsSummary));
- elements.clearFilters.addEventListener("click", clearFilters);
elements.createCollection.addEventListener("click", () => createProjectCollection(elements.createCollection));
elements.gallerySort.addEventListener("change", () => {
caseSortMode = elements.gallerySort.value;
@@ -887,10 +886,12 @@ async function refreshLibrary() {
visionBatchJob = response.visionBatchJob ?? null;
canUndoAnalysisBatch = Boolean(response.canUndoAnalysisBatch);
restoreLibraryReturnSnapshot();
- elements.libraryTitle.textContent = settings.libraryTitle || (currentLocale() === "en" ? "Visual Creation Library" : "视觉创作资料库");
- if (document.activeElement !== elements.libraryNameSetting) elements.libraryNameSetting.value = settings.libraryTitle || "";
+ const displayedLibraryTitle = libraryTitleForLocale(settings.libraryTitle, currentLocale());
+ elements.libraryTitle.textContent = displayedLibraryTitle;
+ if (document.activeElement !== elements.libraryNameSetting) elements.libraryNameSetting.value = displayedLibraryTitle;
if (document.activeElement !== elements.exportPathSetting) elements.exportPathSetting.value = settings.outputPath || "";
- elements.libraryNameSetting.dataset.savedValue = settings.libraryTitle || "";
+ elements.libraryNameSetting.dataset.savedValue = displayedLibraryTitle;
+ elements.libraryNameSetting.dataset.storedValue = settings.libraryTitle || "";
elements.exportPathSetting.dataset.savedValue = settings.outputPath || "";
updateLibrarySettingsSaveState();
if (selectedCollectionId && !organizerState.collections.some((item) => item.id === selectedCollectionId)) selectedCollectionId = "";
@@ -953,7 +954,7 @@ function updateCachedDocumentCards() {
for (const image of elements.caseList.querySelectorAll("img[data-document-id]")) {
const derived = documentDerived.get(image.dataset.documentId);
const pages = image.parentElement?.querySelector(".pdf-cover-label span");
- if (pages && derived?.pageCount) pages.textContent = `${derived.pageCount} 页`;
+ if (pages && derived?.pageCount) pages.textContent = t("{count} 页", { count: derived.pageCount });
}
}
@@ -1309,8 +1310,8 @@ function createCaseCard(entry) {
moveUp.type = moveDown.type = "button";
moveUp.setAttribute("aria-label", `上移案例:${entry.title}`);
moveDown.setAttribute("aria-label", `下移案例:${entry.title}`);
- moveUp.title = `上移案例:${entry.title}`;
- moveDown.title = `下移案例:${entry.title}`;
+ moveUp.title = t("上移案例:{title}", { title: entry.title });
+ moveDown.title = t("下移案例:{title}", { title: entry.title });
moveUp.addEventListener("click", (event) => {
event.stopPropagation();
void reorderProjectCase(entry, "up", moveUp);
@@ -1348,10 +1349,10 @@ function createTextCaseCover(entry, asset = null) {
? `${assetFormatLabel(asset)} 字幕`
: mimeLabels[asset.mimeType] || assetFormatLabel(asset) || "DOC") : "NOTE";
const cover = el("div", "case-text-cover");
- cover.append(rawTextEl("span", "case-text-kind", label), rawTextEl("strong", "case-text-title", entry.title || (asset ? asset.sourceTitle : "快速笔记")));
+ cover.append(rawTextEl("span", "case-text-kind", t(label)), rawTextEl("strong", "case-text-title", entry.title || (asset ? asset.sourceTitle : t("快速笔记"))));
const source = String(entry.text ?? "").trim();
const summary = asset?.mimeType === "text/markdown" ? markdownPlainText(source) : source;
- cover.append(rawTextEl("p", "case-text-excerpt", summary || "打开查看文档内容"));
+ cover.append(rawTextEl("p", "case-text-excerpt", summary || t("打开查看文档内容")));
return cover;
}
@@ -1360,7 +1361,7 @@ function createAudioCaseCover(entry, asset) {
const format = assetFormatLabel(asset);
cover.append(
rawTextEl("span", "case-text-kind", `AUDIO · ${format}`),
- rawTextEl("strong", "case-text-title", asset.sourceTitle || entry.title || "音频")
+ rawTextEl("strong", "case-text-title", asset.sourceTitle || entry.title || t("音频"))
);
const metadata = rawTextEl("p", "case-asset-meta", mediaMetadataText(asset));
const audio = document.createElement("audio");
@@ -1383,12 +1384,12 @@ function createSourceFileCaseCover(entry, asset) {
const cover = el("div", "case-asset-cover case-source-file-cover");
cover.append(
rawTextEl("span", "case-text-kind", `${assetCategoryLabel(asset)} · ${assetFormatLabel(asset)}`),
- rawTextEl("strong", "case-text-title", asset.sourceTitle || entry.title || "创作源文件"),
- rawTextEl("p", "case-asset-path", asset.relativePath || "本机资料"),
+ rawTextEl("strong", "case-text-title", asset.sourceTitle || entry.title || t("创作源文件")),
+ rawTextEl("p", "case-asset-path", asset.relativePath || t("本机资料")),
rawTextEl("p", "case-asset-meta", mediaMetadataText(asset))
);
if (asset.recordType === "local-asset-reference") {
- cover.append(rawTextEl("span", "case-local-link-badge", "本机链接"));
+ cover.append(rawTextEl("span", "case-local-link-badge", t("本机链接")));
}
return cover;
}
@@ -1429,7 +1430,7 @@ function createVideoLinkCover(entry, asset) {
const cover = el("div", "case-video-link-cover");
cover.append(rawTextEl("span", "case-text-kind", provider), rawTextEl("strong", "case-text-title", entry.title || asset.sourceTitle || provider));
const source = safeHttpUrl(asset.reference?.url || asset.sourceUrl);
- cover.append(rawTextEl("p", "case-text-excerpt", source ? new URL(source).hostname : "打开查看视频来源"));
+ cover.append(rawTextEl("p", "case-text-excerpt", source ? new URL(source).hostname : t("打开查看视频来源")));
return cover;
}
@@ -1468,7 +1469,7 @@ async function hydrateDocumentPreview(image) {
}
image.src = url;
const pages = image.parentElement?.querySelector(".pdf-cover-label span");
- if (pages && derived.pageCount) pages.textContent = `${derived.pageCount} 页`;
+ if (pages && derived.pageCount) pages.textContent = t("{count} 页", { count: derived.pageCount });
}
} catch (error) {
image.hidden = true;
@@ -1695,7 +1696,7 @@ async function persistProjectCollectionOrder(collectionIds, focusCollectionId) {
const ordered = sortProjects(organizerState.collections, "manual");
const project = ordered.find((item) => item.id === focusCollectionId);
const position = ordered.findIndex((item) => item.id === focusCollectionId) + 1;
- elements.projectOrderStatus.textContent = `已将${project?.name || "项目"}移动到第 ${position} 位`;
+ elements.projectOrderStatus.textContent = t("已将 {project} 移动到第 {position} 位", { project: project?.name || t("项目"), position });
renderProjectFilters();
queueMicrotask(() => elements.collectionFilters.querySelector(`[data-collection-id="${CSS.escape(focusCollectionId)}"]`)?.focus());
} catch (error) {
@@ -1822,6 +1823,7 @@ function exitSelectionMode() {
elements.selectionLabelInput.value = "";
updateSelectionBar();
renderGallery();
+ requestAnimationFrame(() => elements.selectCases.focus());
}
function exitProjectSelection() {
@@ -1848,6 +1850,7 @@ function selectAllFilteredCases() {
function clearSelectedCases() {
replaceSelectedCaseIds(clearLibrarySelection());
renderGallery();
+ requestAnimationFrame(() => elements.selectionSelectFiltered.focus());
}
function replaceSelectedCaseIds(values) {
@@ -1902,19 +1905,27 @@ function updateSelectionBar() {
elements.selectionProjectTarget.value = organizerState.collections.some((item) => item.id === selectedProject) ? selectedProject : "";
elements.selectionAddProject.disabled = !selectedCaseIds.size || !elements.selectionProjectTarget.value;
elements.selectionSelectFiltered.disabled = selectionMode !== "select" || visibleEntries.length === 0;
+ elements.selectionSelectFiltered.hidden = selectedCaseIds.size > 0;
elements.selectionSelectFiltered.textContent = currentLocale() === "en" ? `Select current (${visibleEntries.length})` : `全选当前(${visibleEntries.length})`;
elements.selectionSelectFiltered.setAttribute("aria-label", currentLocale() === "en"
? `Select all ${visibleEntries.length} cases in the current filtered results`
: `全选当前筛选结果,共 ${visibleEntries.length} 个案例`);
elements.selectionClear.disabled = selectedCaseIds.size === 0;
+ elements.selectionSelectedActions.hidden = selectedCaseIds.size === 0;
elements.selectionAddLabels.disabled = !selectedCaseIds.size || !splitInput(elements.selectionLabelInput.value).length;
elements.selectionCombine.disabled = selectedCaseIds.size < 2;
+ elements.selectionCombine.title = selectedCaseIds.size < 2 ? t("至少选择 2 个案例") : "";
elements.selectionNewProject.disabled = !selectedCaseIds.size;
- elements.selectionAnalyze.disabled = ![...selectedCaseIds]
+ const selectionHasAnalyzableImage = [...selectedCaseIds]
.some((id) => isVisionSelectableEntry(logicalCases.find((entry) => entry.id === id)));
+ elements.selectionAnalyze.disabled = !selectionHasAnalyzableImage;
+ elements.selectionAnalyze.title = selectionHasAnalyzableImage ? "" : t("所选案例中没有可分析的图片");
elements.shareExport.textContent = t("分享");
elements.shareExport.disabled = !selectedCaseIds.size;
elements.selectionTrash.disabled = !selectedCaseIds.size;
+ if (!selectedCaseIds.size) {
+ for (const menu of document.querySelectorAll(".selection-menu[open]")) menu.open = false;
+ }
elements.createCollection.disabled = taskSelecting;
}
@@ -2632,26 +2643,26 @@ function renderExtensionUpdateStatus(nextStatus, fallbackError = "") {
const currentVersion = status?.currentVersion || chrome.runtime.getManifest().version;
elements.aboutVersion.textContent = `PromptDirector ${currentVersion}`;
if (!status) {
- elements.updateChannel.textContent = "安装方式暂不可用";
- elements.updateStatus.textContent = fallbackError ? "状态不可用" : "正在检查";
+ elements.updateChannel.textContent = t("安装方式暂不可用");
+ elements.updateStatus.textContent = t(fallbackError ? "状态不可用" : "正在检查");
elements.updateStatus.className = `update-status-badge${fallbackError ? " is-error" : ""}`;
- elements.updateCheckedAt.textContent = "最近检查:—";
- elements.updateAvailableVersion.textContent = "可用版本:—";
- elements.updateExplanation.textContent = "重新打开设置时会再次读取更新状态。";
- showUpdateFeedback(fallbackError, Boolean(fallbackError));
+ elements.updateCheckedAt.textContent = t("最近检查:—");
+ elements.updateAvailableVersion.textContent = t("可用版本:—");
+ elements.updateExplanation.textContent = t("重新打开设置时会再次读取更新状态。");
+ showUpdateFeedback(translateUiMessage(fallbackError), Boolean(fallbackError));
return;
}
const development = status.channel === "development";
- elements.updateChannel.textContent = development ? "本地开发版 · 手动替换代码" : "商店版 · Chrome 自动更新";
+ elements.updateChannel.textContent = t(development ? "本地开发版 · 手动替换代码" : "商店版 · Chrome 自动更新");
const updateVersion = status.pendingVersion || status.latestVersion || "—";
- elements.updateCheckedAt.textContent = `最近检查:${formatUpdateCheckTime(status.checkedAt)}`;
- elements.updateAvailableVersion.textContent = `可用版本:${updateVersion}`;
+ elements.updateCheckedAt.textContent = t("最近检查:{time}", { time: formatUpdateCheckTime(status.checkedAt) });
+ elements.updateAvailableVersion.textContent = t("可用版本:{version}", { version: updateVersion });
const display = updateStatusDisplay(status);
- elements.updateStatus.textContent = display.label;
+ elements.updateStatus.textContent = t(display.label);
elements.updateStatus.className = `update-status-badge ${display.className}`.trim();
- elements.updateExplanation.textContent = updateExplanation(status);
+ elements.updateExplanation.textContent = t(updateExplanation(status));
const releaseUrl = development && status.updateAvailable ? safeHttpUrl(status.releaseUrl) : "";
elements.updateReleaseLink.hidden = !releaseUrl;
@@ -2662,15 +2673,15 @@ function renderExtensionUpdateStatus(nextStatus, fallbackError = "") {
elements.applyExtensionUpdate.disabled = false;
elements.applyExtensionUpdate.removeAttribute("aria-busy");
elements.applyExtensionUpdate.classList.toggle("button-secondary", development);
- elements.applyExtensionUpdate.textContent = status.applyBehavior === "reload_development_directory"
+ elements.applyExtensionUpdate.textContent = t(status.applyBehavior === "reload_development_directory"
? "重新载入目录"
- : "应用更新并重启";
+ : "应用更新并重启");
const hasUpdate = Boolean(status.updateAvailable);
elements.settingsUpdateBadge.hidden = !hasUpdate;
- elements.openSettings.setAttribute("aria-label", hasUpdate ? "设置,有可用更新" : "设置");
- elements.openSettings.title = hasUpdate ? `设置 · ${display.label}` : "设置";
- showUpdateFeedback(status.lastError || "", Boolean(status.lastError));
+ elements.openSettings.setAttribute("aria-label", t(hasUpdate ? "设置,有可用更新" : "设置"));
+ elements.openSettings.title = hasUpdate ? t("设置 · {status}", { status: t(display.label) }) : t("设置");
+ showUpdateFeedback(translateUiMessage(status.lastError || ""), Boolean(status.lastError));
}
function updateStatusDisplay(status) {
@@ -2694,15 +2705,15 @@ function updateExplanation(status) {
}
function updateCheckFeedback(status) {
- if (status?.updateAvailable) return status.channel === "development" ? "发现新版本,可打开 Release 下载。" : "新版本已下载,可以立即应用。";
- if (status?.checkStatus === "throttled") return "刚刚检查过,已保留最近结果。";
- return "已是最新版本。";
+ if (status?.updateAvailable) return t(status.channel === "development" ? "发现新版本,可打开 Release 下载。" : "新版本已下载,可以立即应用。");
+ if (status?.checkStatus === "throttled") return t("刚刚检查过,已保留最近结果。");
+ return t("已是最新版本。");
}
function formatUpdateCheckTime(value) {
- if (!value) return "尚未检查";
+ if (!value) return t("尚未检查");
const date = new Date(value);
- if (Number.isNaN(date.getTime())) return "尚未检查";
+ if (Number.isNaN(date.getTime())) return t("尚未检查");
return date.toLocaleString(currentLocale() === "en" ? "en" : "zh-CN");
}
@@ -3365,7 +3376,7 @@ function renderFacetFilters(sourceEntries = entries) {
details.style.setProperty("--facet-color", facet.color);
details.open = Boolean(selected.size);
const summary = el("summary", "");
- summary.append(rawTextEl("span", "", facet.name), rawTextEl("span", "facet-filter-count", selected.size ? translateUiMessage(`已选 ${selected.size}`) : `${usageCount}`));
+ summary.append(rawTextEl("span", "", facetDisplayName(facet)), rawTextEl("span", "facet-filter-count", selected.size ? translateUiMessage(`已选 ${selected.size}`) : `${usageCount}`));
details.append(summary);
const body = el("div", "facet-filter-body");
for (const parent of nodes.filter((item) => !item.parentId)) {
@@ -3395,10 +3406,11 @@ function createFacetFilterButton(node, selected, count, facet) {
button.dataset.facetNodeId = node.id;
button.style.setProperty("--facet-color", facet.color);
button.setAttribute("aria-pressed", String(selected.has(node.id)));
- button.setAttribute("aria-label", `${node.name} ${count}`);
+ const displayName = facetDisplayName(node);
+ button.setAttribute("aria-label", `${displayName} ${count}`);
const check = el("span", "facet-option-check");
check.append(createUiIcon("check"));
- button.append(check, rawTextEl("span", "facet-option-name", node.name), rawTextEl("span", "facet-option-count", String(count)));
+ button.append(check, rawTextEl("span", "facet-option-name", displayName), rawTextEl("span", "facet-option-count", String(count)));
button.addEventListener("click", () => {
const next = new Set(selectedFacets.get(facet.id) ?? []);
next.has(node.id) ? next.delete(node.id) : next.add(node.id);
@@ -3432,9 +3444,6 @@ function renderActiveFilters() {
[...selectedFacets.values()].reduce((count, ids) => count + ids.size, 0) +
Number(elements.pendingFilter.checked) +
Number(Boolean(elements.searchInput.value.trim()));
- elements.activeFilterBadge.hidden = activeFilterCount === 0;
- elements.activeFilterBadge.textContent = activeFilterCount ? translateUiMessage(`筛选 ${activeFilterCount}`) : "";
- elements.clearFilters.disabled = activeFilterCount === 0;
renderFilterToggleState();
}
@@ -3808,7 +3817,7 @@ function createCompoundOrganizer(entry) {
order.replaceChildren(...memberIds.map((id, index) => {
const member = entries.find((item) => item.id === id);
const row = el("div", "compound-member-row");
- row.append(rawTextEl("span", "", `${index + 1}. ${member?.title || "已移除案例"}`));
+ row.append(rawTextEl("span", "", `${index + 1}. ${member?.title || t("已移除案例")}`));
const actions = el("span", "item-actions");
const up = rawTextEl("button", "button-secondary", "↑");
const down = rawTextEl("button", "button-secondary", "↓");
@@ -3898,7 +3907,7 @@ async function createCapturedPostView(entryValue) {
section.append(textarea, actions);
queueMicrotask(() => textarea.focus());
} else {
- section.append(rawTextEl("p", "captured-post-text", entry.text || "这条帖子没有可显示的文字"));
+ section.append(rawTextEl("p", "captured-post-text", entry.text || t("这条帖子没有可显示的文字")));
const actions = el("div", "captured-post-actions");
const copy = textEl("button", "button-secondary", "复制文字");
const edit = textEl("button", "button-secondary", "编辑文字");
@@ -3955,10 +3964,10 @@ async function createCompactCapturedMedia(entry, asset, { post = false } = {}) {
image.alt = `${entry.title} 视频封面`;
link.append(image);
}
- link.append(rawTextEl("strong", "", post ? "打开原帖观看视频" : "打开视频来源"));
+ link.append(rawTextEl("strong", "", t(post ? "打开原帖观看视频" : "打开视频来源")));
card.append(link);
} else {
- const link = rawTextEl("a", "compact-media-link compact-document-link", asset.sourceTitle || "打开文档来源");
+ const link = rawTextEl("a", "compact-media-link compact-document-link", asset.sourceTitle || t("打开文档来源"));
link.href = asset.sourceUrl || entry.url || "#";
link.target = "_blank";
link.rel = "noopener noreferrer";
@@ -4011,11 +4020,11 @@ async function createArticleDocumentReader(entryValue) {
const card = el("div", "article-document-resource");
card.append(
rawTextEl("span", "article-document-resource-type", block.kind === "document" ? "DOC" : "LINK"),
- rawTextEl("strong", "", block.label || asset?.sourceTitle || "文章资源")
+ rawTextEl("strong", "", block.label || asset?.sourceTitle || t("文章资源"))
);
const sourceUrl = block.sourceUrl || asset?.sourceUrl || "";
if (sourceUrl) card.append(articleSourceLink(sourceUrl, asset ? "打开来源" : "打开链接"));
- if (asset?.kind === "document" && asset.storageMode === "managed") card.append(rawTextEl("small", "", "本地副本已保存在案例媒体中"));
+ if (asset?.kind === "document" && asset.storageMode === "managed") card.append(rawTextEl("small", "", t("本地副本已保存在案例媒体中")));
reader.append(card);
}
}
@@ -4024,7 +4033,7 @@ async function createArticleDocumentReader(entryValue) {
function articleSourceLink(urlValue, label) {
const url = String(urlValue || "");
- if (!url) return rawTextEl("span", "detail-placeholder", "来源暂时不可用");
+ if (!url) return rawTextEl("span", "detail-placeholder", t("来源暂时不可用"));
const link = rawTextEl("a", "button-secondary media-open-link", label);
link.href = url;
link.target = "_blank";
@@ -4257,7 +4266,7 @@ function renderVideoAnalysisPanel(container, entry, asset, getController) {
const heading = el("header", "");
heading.append(
rawTextEl("strong", "", `${videoAnalysisModeLabel(record.mode)} · 版本 ${records.length - index}`),
- rawTextEl("span", "", `${record.provider || "未知服务"} · ${record.model || "未知模型"} · ${formatDate(record.createdAt)}`)
+ rawTextEl("span", "", `${record.provider || t("未知服务")} · ${record.model || t("未知模型")} · ${formatDate(record.createdAt)}`)
);
item.append(heading, renderTimestampedAnalysis(record.text, entry, asset, getController));
if (record.usage?.totalTokens) item.append(rawTextEl("small", "", `本次用量:${record.usage.totalTokens} tokens`));
@@ -4399,7 +4408,7 @@ async function createMediaViewer(asset, imageUrl, entry) {
});
wrap.append(
rawTextEl("span", "asset-kind-badge", `音频 · ${assetFormatLabel(asset)}`),
- rawTextEl("strong", "asset-file-title", asset.sourceTitle || entry.title || "音频"),
+ rawTextEl("strong", "asset-file-title", asset.sourceTitle || entry.title || t("音频")),
metadata,
audio,
managedAssetDownloadLink(asset, url)
@@ -4428,7 +4437,7 @@ async function createMediaViewer(asset, imageUrl, entry) {
} else {
const text = String(entry.text ?? "").trim() || await readDocumentText(blob, asset.mimeType);
const reader = el("article", "document-text-reader");
- reader.append(rawTextEl("div", "document-type-badge", documentTypeLabel(asset.mimeType, asset.sourceFormat)), rawTextEl("pre", "", text || "这个文档没有可显示的文字"));
+ reader.append(rawTextEl("div", "document-type-badge", documentTypeLabel(asset.mimeType, asset.sourceFormat)), rawTextEl("pre", "", text || t("这个文档没有可显示的文字")));
wrap.append(reader);
}
wrap.append(open);
@@ -4436,7 +4445,7 @@ async function createMediaViewer(asset, imageUrl, entry) {
}
function managedAssetDownloadLink(asset, url) {
- const download = rawTextEl("a", "button-secondary media-open-link", "下载本机副本");
+ const download = rawTextEl("a", "button-secondary media-open-link", t("下载本机副本"));
download.href = url;
download.download = asset.sourceTitle || `source-${asset.id}`;
return download;
@@ -4446,8 +4455,8 @@ function createManagedSourceFileViewer(asset, url) {
const panel = el("div", "detail-source-file");
panel.append(
rawTextEl("span", "asset-kind-badge", `${assetCategoryLabel(asset)} · ${assetFormatLabel(asset)}`),
- rawTextEl("strong", "asset-file-title", asset.sourceTitle || "创作源文件"),
- rawTextEl("p", "asset-file-path", asset.relativePath || "本机资料"),
+ rawTextEl("strong", "asset-file-title", asset.sourceTitle || t("创作源文件")),
+ rawTextEl("p", "asset-file-path", asset.relativePath || t("本机资料")),
rawTextEl("p", "asset-file-meta", mediaMetadataText(asset)),
rawTextEl("p", "asset-inert-note", "这是归档源文件。PromptDirector 不会执行或内嵌打开它。"),
managedAssetDownloadLink(asset, url)
@@ -4474,26 +4483,26 @@ async function createLocalAssetReferenceViewer(asset, entry) {
};
panel.dataset.linkStatus = inspection.status;
panel.append(
- rawTextEl("span", "asset-kind-badge", `本机链接 · ${assetFormatLabel(asset)}`),
- rawTextEl("strong", "asset-file-title", asset.sourceTitle || "本机源文件"),
- rawTextEl("p", "asset-file-path", asset.relativePath || asset.sourceTitle || "未记录相对路径"),
+ rawTextEl("span", "asset-kind-badge", `${t("本机链接")} · ${assetFormatLabel(asset)}`),
+ rawTextEl("strong", "asset-file-title", asset.sourceTitle || t("本机源文件")),
+ rawTextEl("p", "asset-file-path", asset.relativePath || asset.sourceTitle || t("未记录相对路径")),
rawTextEl("p", "asset-file-meta", mediaMetadataText(asset)),
- rawTextEl("p", "asset-link-status", statusLabels[inspection.status] || "链接状态未知"),
- rawTextEl("p", "asset-inert-note", "这里只保存文件信息与本机授权。不会自动读取、上传、执行或内嵌源文件;导出分享包时会再次明确检查权限。")
+ rawTextEl("p", "asset-link-status", t(statusLabels[inspection.status] || "链接状态未知")),
+ rawTextEl("p", "asset-inert-note", t("这里只保存文件信息与本机授权。不会自动读取、上传、执行或内嵌源文件;导出分享包时会再次明确检查权限。"))
);
const actions = el("div", "asset-file-actions");
if (inspection.status === LOCAL_ASSET_LINK_STATUS.NEEDS_PERMISSION) {
- const authorize = rawTextEl("button", "button-secondary", "重新授权读取");
+ const authorize = rawTextEl("button", "button-secondary", t("重新授权读取"));
authorize.addEventListener("click", () => void authorizeLocalAssetReference(asset, record, authorize));
actions.append(authorize);
}
if (inspection.status === LOCAL_ASSET_LINK_STATUS.READY) {
- const download = rawTextEl("button", "button-secondary", "下载本机副本");
+ const download = rawTextEl("button", "button-secondary", t("下载本机副本"));
download.addEventListener("click", () => void downloadLocalAssetReference(asset, record, download));
actions.append(download);
}
- const relink = rawTextEl("button", "button-secondary", "重新链接源文件");
- relink.title = "由你选择新的本机文件;确认后更新文件名、大小、格式与修改时间";
+ const relink = rawTextEl("button", "button-secondary", t("重新链接源文件"));
+ relink.title = t("由你选择新的本机文件;确认后更新文件名、大小、格式与修改时间");
relink.addEventListener("click", () => void relinkLocalAssetReference(entry, asset, relink));
actions.append(relink);
panel.append(actions);
@@ -4621,7 +4630,7 @@ async function createReferencedMediaViewer(asset, entry) {
const status = textEl("p", "media-playback-status", "播放器正在加载…");
const frame = document.createElement("iframe");
frame.className = "detail-video detail-video-embed";
- frame.title = `${providerLabel} 外部视频播放器`;
+ frame.title = t("{provider} 外部视频播放器", { provider: providerLabel });
frame.src = provider === "vimeo" ? `${embedUrl}${embedUrl.includes("?") ? "&" : "?"}api=1&player_id=${encodeURIComponent(asset.id)}` : embedUrl;
frame.allow = "autoplay; encrypted-media; fullscreen; picture-in-picture";
frame.allowFullscreen = true;
@@ -4685,7 +4694,7 @@ function youtubeMediaController(frame, status, playerId) {
let ready = false;
const origin = "https://www.youtube-nocookie.com";
const timeoutId = setTimeout(() => {
- if (!ready) status.textContent = "播放器响应超时,可重试或打开来源";
+ if (!ready) status.textContent = t("播放器响应超时,可重试或打开来源");
}, 8000);
const onMessage = (event) => {
if (event.origin !== origin || event.source !== frame.contentWindow) return;
@@ -4693,7 +4702,7 @@ function youtubeMediaController(frame, status, playerId) {
if (payload?.event === "onReady") {
ready = true;
clearTimeout(timeoutId);
- status.textContent = "可以播放";
+ status.textContent = t("可以播放");
} else if (payload?.event === "onError") {
const failure = youtubePlaybackError(payload.info);
clearTimeout(timeoutId);
@@ -4724,12 +4733,12 @@ function youtubeMediaController(frame, status, playerId) {
function basicEmbedController(frame, status, providerLabel) {
let timeoutId = setTimeout(() => {
- status.textContent = `${providerLabel} 播放器响应超时,可打开来源`;
+ status.textContent = t("{provider} 播放器响应超时,可打开来源", { provider: providerLabel });
}, 8000);
const loaded = () => {
clearTimeout(timeoutId);
timeoutId = null;
- status.textContent = "播放器已加载";
+ status.textContent = t("播放器已加载");
};
frame.addEventListener("load", loaded, { once: true });
return {
@@ -4771,12 +4780,12 @@ function renderTimeNotes(container, entry, asset, getController) {
form.hidden = true;
const text = document.createElement("textarea");
text.rows = 2;
- text.placeholder = "记录这个画面、动作变化或提示词用法";
+ text.placeholder = t("记录这个画面、动作变化或提示词用法");
const start = document.createElement("input");
start.type = "number";
start.min = "0";
start.step = "0.1";
- start.placeholder = "时间(秒)";
+ start.placeholder = t("时间(秒)");
const save = textEl("button", "", "保存笔记");
const cancel = textEl("button", "button-secondary", "取消");
const advanced = el("details", "time-note-advanced");
@@ -4786,7 +4795,7 @@ function renderTimeNotes(container, entry, asset, getController) {
end.type = "number";
end.min = "0";
end.step = "0.1";
- end.placeholder = "片段结束秒数(可选)";
+ end.placeholder = t("片段结束秒数(可选)");
advancedBody.append(end);
const controller = getController();
if (controller?.video) {
@@ -4994,18 +5003,18 @@ function createDetailQuickOrganization(entry) {
"span",
"detail-project-summary-text",
selectedProjects.length === 0
- ? "选择项目"
+ ? t("选择项目")
: selectedProjects.length === 1
? selectedProjects[0].name
- : `已加入 ${selectedProjects.length} 个项目`
+ : t("已加入 {count} 个项目", { count: selectedProjects.length })
);
const syncProjectSummary = () => {
const selected = selectedProjectsForEntry();
projectSummaryText.textContent = selected.length === 0
- ? "选择项目"
+ ? t("选择项目")
: selected.length === 1
? selected[0].name
- : `已加入 ${selected.length} 个项目`;
+ : t("已加入 {count} 个项目", { count: selected.length });
};
projectSummary.append(projectSummaryText, createUiIcon("chevron-down"));
const projectPopover = el("div", "detail-project-popover");
@@ -5042,7 +5051,7 @@ function createDetailQuickOrganization(entry) {
}
const newProject = el("div", "detail-new-project");
const newProjectName = document.createElement("input");
- newProjectName.placeholder = "输入新项目名称";
+ newProjectName.placeholder = t("输入新项目名称");
newProjectName.setAttribute("aria-label", "新项目名称");
const createProject = textEl("button", "button-secondary", "新建并加入");
const submitProject = async () => {
@@ -5352,7 +5361,7 @@ function createMediaActions(entryValue) {
const entry = normalizeEntryMedia(entryValue);
const wrap = el("div", "screenshot-actions");
const contentCount = entry.mediaAssets.filter((asset) => asset.usage !== "poster").length;
- wrap.append(textEl("strong", "", contentCount ? `${contentCount} 项媒体` : "还没有媒体"));
+ wrap.append(rawTextEl("strong", "", contentCount ? t("{count} 项媒体", { count: contentCount }) : t("还没有媒体")));
const uploadControl = createLocalMediaUploadControl(entry, { label: "从本机添加图片、视频或文档" });
const addLink = textEl("button", "button-secondary", "添加视频链接");
addLink.addEventListener("click", () => addVideoReference(entry.id));
@@ -5445,7 +5454,7 @@ async function openLocalImportSource() {
}
function renderImportSource() {
- elements.importDialogTitle.textContent = "导入本机资料";
+ elements.importDialogTitle.textContent = t("导入本机资料");
elements.importSource.hidden = false;
elements.importPreparing.hidden = true;
elements.importConfirmation.hidden = true;
@@ -5524,7 +5533,7 @@ async function prepareLocalImport(fileItems, { source = "files" } = {}) {
const rootName = source === "folder" ? commonImportRoot(fileItems) : "";
const draft = { source, rootName, browsingScrollY, customLabels: [], stagedAssets: [], skipped: [] };
pendingLocalImport = draft;
- elements.importDialogTitle.textContent = "确认导入";
+ elements.importDialogTitle.textContent = t("确认导入");
elements.importSource.hidden = true;
elements.importActions.hidden = false;
renderImportProjectOptions(rootName);
@@ -5537,7 +5546,7 @@ async function prepareLocalImport(fileItems, { source = "files" } = {}) {
elements.importConfirmation.hidden = true;
elements.importJobPanel.hidden = true;
elements.importStart.hidden = false;
- elements.importCancel.textContent = "取消";
+ elements.importCancel.textContent = t("取消");
elements.importRetry.hidden = true;
elements.importUndo.hidden = true;
elements.importViewProject.hidden = true;
@@ -5705,16 +5714,16 @@ function createSkippedImportRow(item) {
return row;
}
if (canKeepLocalLink) {
- const keepLink = rawTextEl("button", "button-secondary import-file-force", "保留本机链接");
+ const keepLink = rawTextEl("button", "button-secondary import-file-force", t("保留本机链接"));
keepLink.type = "button";
- keepLink.title = "只保存文件信息与授权句柄,不复制或执行源文件;分享时才读取源文件";
+ keepLink.title = t("只保存文件信息与授权句柄,不复制或执行源文件;分享时才读取源文件");
keepLink.addEventListener("click", () => void preserveUnsupportedImportReference(item, keepLink));
row.append(spacer, details, keepLink);
return row;
}
- const force = rawTextEl("button", "button-secondary import-file-force", "强制导入");
+ const force = rawTextEl("button", "button-secondary import-file-force", t("强制导入"));
force.type = "button";
- force.title = "忽略这项限制并再次检查;可能占用更多本机空间";
+ force.title = t("忽略这项限制并再次检查;可能占用更多本机空间");
force.addEventListener("click", () => void forcePrepareSkippedImport(item, force));
row.append(spacer, details, force);
return row;
@@ -5833,7 +5842,7 @@ async function startLocalImportJob() {
function renderImportJob() {
const job = activeImportJob;
if (!job) return;
- elements.importDialogTitle.textContent = "导入任务";
+ elements.importDialogTitle.textContent = t("导入任务");
elements.importSource.hidden = true;
elements.importActions.hidden = false;
elements.importPreparing.hidden = true;
@@ -5846,12 +5855,12 @@ function renderImportJob() {
const finished = imported + skipped + failed;
const active = ["queued", "running"].includes(job.status);
const labels = { queued: "等待导入", running: "正在导入", completed: "导入完成", failed: "部分导入失败", canceled: "导入已取消" };
- elements.importJobTitle.textContent = labels[job.status] || "导入任务";
+ elements.importJobTitle.textContent = t(labels[job.status] || "导入任务");
elements.importJobCount.textContent = `${finished}/${job.items.length}`;
elements.importJobProgress.max = Math.max(1, job.items.length);
elements.importJobProgress.value = finished;
- elements.importJobFeedback.textContent = `${imported} 已导入 · ${skipped} 已跳过 · ${failed} 失败`;
- elements.importCancel.textContent = active ? "取消剩余项" : "关闭";
+ elements.importJobFeedback.textContent = t("{imported} 已导入 · {skipped} 已跳过 · {failed} 失败", { imported, skipped, failed });
+ elements.importCancel.textContent = t(active ? "取消剩余项" : "关闭");
elements.importRetry.hidden = active || !failed;
elements.importUndo.hidden = active || !job.createdEntryIds?.length || Boolean(job.undoneAt);
elements.importViewProject.hidden = !job.collectionId || !job.createdEntryIds?.length || Boolean(job.undoneAt);
@@ -6485,7 +6494,7 @@ function createPromptSection(entry, options = {}) {
const textarea = document.createElement("textarea");
textarea.className = "prompt-text prompt-editor";
textarea.value = promptEditState.draftText;
- textarea.setAttribute("aria-label", "编辑提示词");
+ textarea.setAttribute("aria-label", t("编辑提示词"));
textarea.addEventListener("input", () => {
promptEditState.draftText = textarea.value;
promptEditState.dirty = textarea.value !== promptEditState.originalText;
@@ -6588,7 +6597,7 @@ function createPromptSection(entry, options = {}) {
analysisMenu.append(analysisActions);
section.append(
heading,
- rawTextEl("pre", `prompt-text${displayedPrompt ? "" : " is-empty"}`, displayedPrompt || "暂无提示词"),
+ rawTextEl("pre", `prompt-text${displayedPrompt ? "" : " is-empty"}`, displayedPrompt || t("暂无提示词")),
coreActions,
analysisMenu
);
@@ -6670,8 +6679,8 @@ async function analyzeEntryVisualSet(entry, button) {
const requestSummary = rawTextEl("p", "visual-analysis-request-summary", "");
updateSelectionSummary = () => {
const selectedCount = assets.filter((asset, index) => controls.get(`asset_${index}`)?.checked).length;
- count.textContent = `已选 ${selectedCount}/${assets.length}`;
- requestSummary.textContent = `将发送 ${selectedCount} 次图片分析请求 · ${controls.get("includeSummary")?.checked ? "1 次纯文字总结" : "不生成整组总结"}`;
+ count.textContent = t("已选 {selected}/{total}", { selected: selectedCount, total: assets.length });
+ requestSummary.textContent = t("将发送 {count} 次图片分析请求 · {summary}", { count: selectedCount, summary: controls.get("includeSummary")?.checked ? t("1 次纯文字总结") : t("不生成整组总结") });
};
const setChecks = (predicate) => {
assets.forEach((asset, index) => {
@@ -6717,7 +6726,7 @@ async function analyzeEntryVisualSet(entry, button) {
const card = cardByAssetId.get(asset.id);
const statusLabel = card?.querySelector(".visual-analysis-card-status");
if (card) card.dataset.state = "processing";
- if (statusLabel) statusLabel.textContent = "正在分析…";
+ if (statusLabel) statusLabel.textContent = t("正在分析…");
try {
const response = await chrome.runtime.sendMessage({ type: "ANALYZE_ENTRY_IMAGE", entryId: entry.id, visualId: asset.id, outputLocale: currentLocale() });
if (!response?.ok) throw new Error(response?.message || "逐图分析失败");
@@ -6728,7 +6737,7 @@ async function analyzeEntryVisualSet(entry, button) {
input.disabled = true;
}
if (card) card.dataset.state = "completed";
- if (statusLabel) statusLabel.textContent = "本次已完成";
+ if (statusLabel) statusLabel.textContent = t("本次已完成");
updateSelectionSummary();
const replacement = visualAnalysisPromptReplacement(response.entry, asset.id);
if (replacement) savedPromptSuggestions.set(asset.id, { ...replacement, index: imageIndex + 1 });
@@ -6736,13 +6745,13 @@ async function analyzeEntryVisualSet(entry, button) {
const message = error.message || "请重试";
failures.push({ index: imageIndex + 1, message });
if (card) card.dataset.state = "failed";
- if (statusLabel) statusLabel.textContent = `失败 · ${message}`;
+ if (statusLabel) statusLabel.textContent = t("失败 · {message}", { message });
}
}
if (failures.length) {
const statusLine = status();
statusLine.classList.add("error");
- statusLine.textContent = `${failures.length} 张失败,已成功 ${completedAssetIds.size} 张且不会重复请求。可直接重试失败项。`;
+ statusLine.textContent = t("{failed} 张失败,已成功 {completed} 张且不会重复请求。可直接重试失败项。", { failed: failures.length, completed: completedAssetIds.size });
await refreshLibrary();
return false;
}
@@ -6815,9 +6824,9 @@ function createEntryEditor(entry, options = {}) {
const selected = el("div", "selected-edit-tags");
for (const facet of facetCatalog.facets.filter((item) => item.status === "active").sort((a, b) => a.order - b.order)) {
for (const item of grouped.get(facet.id) ?? []) {
- const remove = rawTextEl("button", "", `${item.path} ×`);
+ const remove = rawTextEl("button", "", `${facetNodeDisplayPath(item.nodeId)} ×`);
remove.style.setProperty("--facet-color", facet.color);
- remove.title = facet.name;
+ remove.title = facetDisplayName(facet);
remove.addEventListener("click", () => perform(remove, { type: "SET_ENTRY_FACET", entryId: entry.id, facetId: facet.id, nodeId: item.nodeId, selected: false }));
selected.append(remove);
}
@@ -6827,18 +6836,18 @@ function createEntryEditor(entry, options = {}) {
if (activeFacets.length) {
const addRow = el("div", "entry-tag-add");
const facetSelect = document.createElement("select");
- facetSelect.setAttribute("aria-label", "选择创作维度");
- facetSelect.append(option("", "选择维度"), ...activeFacets.map((facet) => option(facet.id, facet.name)));
+ facetSelect.setAttribute("aria-label", t("选择创作维度"));
+ facetSelect.append(option("", t("选择维度")), ...activeFacets.map((facet) => option(facet.id, facetDisplayName(facet))));
const tagSelect = document.createElement("select");
- tagSelect.setAttribute("aria-label", "选择创作标签");
+ tagSelect.setAttribute("aria-label", t("选择创作标签"));
tagSelect.disabled = true;
- tagSelect.append(option("", "先选择维度"));
+ tagSelect.append(option("", t("先选择维度")));
const add = textEl("button", "", "添加标签");
add.disabled = true;
facetSelect.addEventListener("change", () => {
const facetId = facetSelect.value;
const nodes = facetId ? facetNodes(facetCatalog, facetId) : [];
- tagSelect.replaceChildren(option("", facetId ? "选择标签" : "先选择维度"), ...nodes.map((node) => option(node.id, formatFacetNodePath(facetCatalog, node.id))));
+ tagSelect.replaceChildren(option("", t(facetId ? "选择标签" : "先选择维度")), ...nodes.map((node) => option(node.id, facetNodeDisplayPath(node.id))));
tagSelect.disabled = !nodes.length;
add.disabled = true;
});
@@ -6863,7 +6872,7 @@ function renderManager() {
const pendingCount = entries.filter(isEntryPending).length;
const pendingTab = managerTabs.find((button) => button.dataset.managerTab === "pending");
pendingTab.hidden = !pendingCount;
- pendingTab.textContent = `待确认 ${pendingCount}`;
+ pendingTab.textContent = t("待确认 {count}", { count: pendingCount });
if (!pendingCount && activeManagerTab === "pending") activeManagerTab = "content-types";
managerTabs.forEach((button) => button.setAttribute("aria-selected", String(button.dataset.managerTab === activeManagerTab)));
Object.entries(managerPanels).forEach(([name, panel]) => { panel.hidden = name !== activeManagerTab; });
@@ -7173,7 +7182,7 @@ function renderBatchManager() {
reanalysisPreview.confirmed || reanalysisPreview.suggested || reanalysisPreview.paletteCount
));
elements.previewReanalyze.hidden = maintenanceActive;
- elements.previewReanalyze.textContent = reanalysisPreview || maintenanceJob ? "重新检查" : "检查缺失项";
+ elements.previewReanalyze.textContent = t(reanalysisPreview || maintenanceJob ? "重新检查" : "检查缺失项");
elements.previewReanalyze.classList.toggle("button-secondary", Boolean(reanalysisPreview || maintenanceJob));
elements.applyReanalyze.hidden = maintenanceActive || !maintenanceMissing;
elements.applyReanalyze.disabled = !maintenanceMissing;
@@ -7228,10 +7237,10 @@ function renderAiRoutingSummary() {
const row = el("div", "ai-provider-row");
row.dataset.providerId = profile.id;
const status = `${providerConnectionLabel(profile)} · ${providerCatalogLabel(profile)}`;
- const configure = textEl("button", "button-secondary", t(profile.credentialConfigured ? "编辑配置" : "配置"));
+ const configure = textEl("button", "button-secondary", profile.credentialConfigured ? "编辑配置" : "配置");
configure.type = "button";
configure.addEventListener("click", () => openAiProviderDialog(profile.id));
- const refresh = textEl("button", "button-secondary", t("刷新模型"));
+ const refresh = textEl("button", "button-secondary", "刷新模型");
refresh.type = "button";
refresh.disabled = !profile.credentialConfigured;
refresh.addEventListener("click", () => refreshAiProviderModels(profile.id, refresh));
@@ -7246,7 +7255,7 @@ function renderAiRoutingSummary() {
const profile = aiProviderRegistry.providers?.[assignment.providerId];
const row = el("div", "ai-assignment-row");
const modelState = assignedModelState(profile, assignment.model);
- const change = textEl("button", "button-secondary", t(assignment.providerId ? "更换" : "配置"));
+ const change = textEl("button", "button-secondary", assignment.providerId ? "更换" : "配置");
change.type = "button";
change.addEventListener("click", () => openAiTaskAssignmentDialog(task.id));
row.append(
@@ -7477,7 +7486,7 @@ async function openAiProviderDialog(initialProviderId = "") {
summary.append(title, description);
const advancedBody = document.createElement("div");
advancedBody.className = "ai-advanced-settings-body";
- const micuPreset = textEl("button", "button-secondary", t("填入米醋个人中转预设"));
+ const micuPreset = textEl("button", "button-secondary", "填入米醋个人中转预设");
micuPreset.type = "button";
micuPreset.dataset.providerPreset = "micu-personal";
micuPreset.hidden = true;
@@ -7914,7 +7923,7 @@ async function startDeepSeekAnalysisBatch() {
async function organizeDetailTags() {
const chunks = createDetailOrganizationChunks(facetCatalog, entries);
if (!chunks.length) {
- elements.organizeDetailStatus.textContent = "当前没有需要整理的三级标签组。";
+ elements.organizeDetailStatus.textContent = t("当前没有需要整理的三级标签组。");
return;
}
const tagCount = chunks.reduce((sum, chunk) => sum + chunk.d.length, 0);
@@ -7929,14 +7938,14 @@ async function organizeDetailTags() {
try {
const settings = await privateAiSettings();
for (let index = 0; index < chunks.length; index += 1) {
- elements.organizeDetailStatus.textContent = `正在整理 ${index + 1}/${chunks.length}…`;
+ elements.organizeDetailStatus.textContent = t("正在整理 {current}/{total}…", { current: index + 1, total: chunks.length });
const result = await organizeDetailTagsWithDeepSeek(chunks[index], settings);
mappings.push(...result.mappings);
for (const key of Object.keys(usage)) usage[key] += Math.max(0, Number(result.usage?.[key]) || 0);
}
const response = await chrome.runtime.sendMessage({ type: "APPLY_DETAIL_TAG_ORGANIZATION", mappings });
if (!response?.ok) throw new Error(response?.message || "无法应用三级标签整理结果");
- elements.organizeDetailStatus.textContent = `${response.message} · 输入 ${usage.promptTokens} / 输出 ${usage.completionTokens} tokens`;
+ elements.organizeDetailStatus.textContent = t("{message} · 输入 {input} / 输出 {output} tokens", { message: translateUiMessage(response.message), input: usage.promptTokens, output: usage.completionTokens });
await refreshLibrary();
} catch (error) {
elements.organizeDetailStatus.textContent = error.message || "三级标签整理失败,正式标签库没有改变";
@@ -8197,7 +8206,7 @@ function wait(milliseconds, signal) {
async function previewReanalysis() {
elements.previewReanalyze.disabled = true;
- elements.reanalyzePreview.textContent = "正在检查本机资料…";
+ elements.reanalyzePreview.textContent = t("正在检查本机资料…");
try {
const response = await chrome.runtime.sendMessage({ type: "PREVIEW_REANALYZE" });
if (!response?.ok) throw new Error(response?.message || "无法检查资料");
@@ -8281,11 +8290,11 @@ function handleLibraryMaintenanceMessage(message) {
function renderReanalysisPreview() {
if (maintenanceJob?.total) {
if (maintenanceJob.status === "completed" && !maintenanceJob.failed) {
- elements.reanalyzePreview.textContent = "资料索引已完整";
+ elements.reanalyzePreview.textContent = t("资料索引已完整");
return;
}
const status = ({ running: "补全中", paused: "已暂停", completed: "补全完成", canceled: "已取消" })[maintenanceJob.status] || maintenanceJob.status;
- elements.reanalyzePreview.textContent = `${status} · 已处理 ${maintenanceJob.processed}/${maintenanceJob.total} · 成功 ${maintenanceJob.succeeded} · 失败 ${maintenanceJob.failed}`;
+ elements.reanalyzePreview.textContent = t("{status} · 已处理 {processed}/{total} · 成功 {succeeded} · 失败 {failed}", { status: translateUiMessage(status), processed: maintenanceJob.processed, total: maintenanceJob.total, succeeded: maintenanceJob.succeeded, failed: maintenanceJob.failed });
return;
}
if (!reanalysisPreview) {
@@ -8310,15 +8319,23 @@ function updateLibrarySettingsSaveState() {
}
async function saveLibrarySettings() {
+ const libraryTitle = libraryTitleForStorage(
+ elements.libraryNameSetting.value,
+ elements.libraryNameSetting.dataset.storedValue,
+ currentLocale()
+ );
const response = await perform(elements.saveLibrarySettings, {
type: "UPDATE_SETTINGS",
settings: {
- libraryTitle: elements.libraryNameSetting.value,
+ libraryTitle,
outputPath: elements.exportPathSetting.value
}
}, false);
if (!response?.ok) return;
- elements.libraryNameSetting.dataset.savedValue = elements.libraryNameSetting.value;
+ const displayedLibraryTitle = libraryTitleForLocale(response.settings.libraryTitle, currentLocale());
+ elements.libraryNameSetting.value = displayedLibraryTitle;
+ elements.libraryNameSetting.dataset.savedValue = displayedLibraryTitle;
+ elements.libraryNameSetting.dataset.storedValue = response.settings.libraryTitle || "";
elements.exportPathSetting.dataset.savedValue = elements.exportPathSetting.value;
updateLibrarySettingsSaveState();
}
@@ -8447,12 +8464,12 @@ function renderTrashItems() {
const restore = el("button", "icon-button button-secondary");
restore.type = "button";
restore.setAttribute("aria-label", `恢复:${preview.title}`);
- restore.title = "恢复";
+ restore.title = t("恢复");
restore.append(createUiIcon("refresh-cw"));
const remove = el("button", "icon-button quiet-danger");
remove.type = "button";
remove.setAttribute("aria-label", `永久删除:${preview.title}`);
- remove.title = "永久删除";
+ remove.title = t("永久删除");
remove.append(createUiIcon("trash-2"));
restore.addEventListener("click", () => restoreTrashItem(item, restore));
remove.addEventListener("click", () => permanentlyDeleteTrashItem(item, remove));
@@ -8700,7 +8717,7 @@ async function renderCapturePermissionStatus() {
}
function renderCapturePermissionItem(statusElement, button, granted) {
- statusElement.textContent = granted ? "已授权" : "未授权";
+ statusElement.textContent = t(granted ? "已授权" : "未授权");
statusElement.classList.toggle("is-granted", granted);
button.disabled = !granted;
}
@@ -8712,7 +8729,7 @@ async function revokeCapturePermission(kind) {
? { origins: [...CONTINUOUS_CAPTURE_ORIGINS] }
: { permissions: [...CLIPBOARD_READ_PERMISSIONS] };
button.disabled = true;
- elements.capturePermissionSettingsFeedback.textContent = "正在撤销权限…";
+ elements.capturePermissionSettingsFeedback.textContent = t("正在撤销权限…");
elements.capturePermissionSettingsFeedback.classList.remove("error");
try {
const removed = await chrome.permissions.remove(request);
@@ -9027,6 +9044,22 @@ function contentLabel(id) {
return node ? (node.customized ? node.name : t(node.name)) : t("待确认");
}
+function facetDisplayName(item) {
+ return item?.names?.[currentLocale()] || item?.name || "";
+}
+
+function facetNodeDisplayPath(nodeId) {
+ const parts = [];
+ const visited = new Set();
+ let node = nodeById(nodeId);
+ while (node && !visited.has(node.id)) {
+ visited.add(node.id);
+ parts.unshift(facetDisplayName(node));
+ node = node.parentId ? nodeById(node.parentId) : null;
+ }
+ return parts.join(" / ");
+}
+
function facetById(id) { return facetCatalog.facets.find((item) => item.id === id); }
function nodeById(id) { return facetCatalog.nodes.find((item) => item.id === id); }
@@ -9103,7 +9136,7 @@ function renderAnalysisDiagnostics() {
elements.analysisRuntimeVersion.textContent = `PromptDirector ${chrome.runtime.getManifest().version} / Analysis v${ANALYSIS_PROMPT_VERSION}`;
elements.analysisDiagnosticEvents.replaceChildren();
if (!analysisDiagnostics.length) {
- elements.analysisDiagnosticEvents.append(rawTextEl("li", "analysis-diagnostics-empty", "尚无本次分析事件"));
+ elements.analysisDiagnosticEvents.append(rawTextEl("li", "analysis-diagnostics-empty", t("尚无本次分析事件")));
return;
}
for (const event of analysisDiagnostics) {
diff --git a/project-combobox.js b/project-combobox.js
index 9d316bf..6df44e1 100644
--- a/project-combobox.js
+++ b/project-combobox.js
@@ -47,29 +47,47 @@ export function attachProjectCombobox(input, options = {}) {
let activeIndex = -1;
const controller = new AbortController();
const eventOptions = { signal: controller.signal };
- const boundary = input.closest(".app-dialog-body, .import-dialog-body") || input.closest("dialog") || document.documentElement;
+ const scrollBoundary = input.closest(".app-dialog-body, .import-dialog-body") || input.closest("dialog") || document.documentElement;
+ const dialog = input.closest("dialog");
function positionListbox() {
if (listbox.hidden || !input.isConnected) return;
+ if (dialog && !dialog.open) return close();
listbox.dataset.placement = "bottom";
listbox.style.removeProperty("--project-combobox-available-height");
const styles = getComputedStyle(listbox);
const gap = Number.parseFloat(styles.getPropertyValue("--ui-popover-gap")) || 0;
- const configuredMaxHeight = Number.parseFloat(styles.getPropertyValue("--ui-combobox-max-height"));
- const contentHeight = Math.min(listbox.scrollHeight, configuredMaxHeight || listbox.scrollHeight);
- const anchor = listbox.offsetParent instanceof HTMLElement ? listbox.offsetParent : input;
- const inputBounds = anchor.getBoundingClientRect();
- const boundaryBounds = boundary.getBoundingClientRect();
+ const viewportInset = Number.parseFloat(styles.getPropertyValue("--ui-popover-viewport-inset")) || 0;
+ const inputBounds = input.getBoundingClientRect();
+ const footer = dialog?.querySelector(":scope > footer, :scope > .app-dialog-form > footer");
+ const footerBounds = footer && !footer.hidden ? footer.getBoundingClientRect() : null;
+ const boundaryTop = viewportInset;
+ const boundaryBottom = Math.max(boundaryTop, Math.min(
+ window.innerHeight - viewportInset,
+ footerBounds && footerBounds.top > inputBounds.bottom ? footerBounds.top - gap : window.innerHeight - viewportInset
+ ));
+ const availableWidth = Math.max(1, window.innerWidth - viewportInset * 2);
+ const width = Math.min(inputBounds.width, availableWidth);
+ const left = Math.min(
+ Math.max(inputBounds.left, viewportInset),
+ window.innerWidth - viewportInset - width
+ );
+ listbox.style.left = `${left}px`;
+ listbox.style.width = `${width}px`;
const placement = projectComboboxPlacement({
inputTop: inputBounds.top,
inputBottom: inputBounds.bottom,
- boundaryTop: boundaryBounds.top,
- boundaryBottom: boundaryBounds.bottom,
- contentHeight,
+ boundaryTop,
+ boundaryBottom,
+ contentHeight: listbox.scrollHeight,
gap
});
listbox.dataset.placement = placement.placement;
- listbox.style.setProperty("--project-combobox-available-height", `${placement.maxHeight}px`);
+ listbox.style.setProperty("--project-combobox-available-height", `${Math.max(1, placement.maxHeight)}px`);
+ const listboxHeight = listbox.getBoundingClientRect().height;
+ listbox.style.top = `${placement.placement === "top"
+ ? inputBounds.top - gap - listboxHeight
+ : inputBounds.bottom + gap}px`;
}
function matching() {
@@ -83,7 +101,7 @@ export function attachProjectCombobox(input, options = {}) {
listbox.replaceChildren(...matches.map((project, index) => {
const option = document.createElement("button");
option.type = "button";
- option.className = "project-combobox-option";
+ option.className = "project-combobox-option ui-content-row";
option.setAttribute("role", "option");
option.setAttribute("aria-selected", String(index === activeIndex));
option.dataset.value = project.value;
@@ -155,10 +173,10 @@ export function attachProjectCombobox(input, options = {}) {
input.addEventListener("blur", () => queueMicrotask(() => {
if (!listbox.contains(document.activeElement)) close();
}), eventOptions);
- boundary.addEventListener("scroll", positionListbox, { ...eventOptions, passive: true });
+ scrollBoundary.addEventListener("scroll", positionListbox, { ...eventOptions, passive: true });
window.addEventListener("resize", positionListbox, { ...eventOptions, passive: true });
- const dialog = input.closest("dialog");
+ dialog?.addEventListener("close", close, eventOptions);
if (options.destroyOnDialogClose) dialog?.addEventListener("close", () => controller.abort(), { once: true });
return {
diff --git a/share-preview.js b/share-preview.js
index 6981d15..21e8486 100644
--- a/share-preview.js
+++ b/share-preview.js
@@ -1,4 +1,4 @@
-import { normalizeSettings } from "./lib.js";
+import { libraryTitleForLocale, normalizeSettings } from "./lib.js";
import { entryAttributeSummary } from "./library-model.js";
import { normalizeTaxonomy } from "./taxonomy.js";
import { normalizeFacetCatalog } from "./facets.js";
@@ -35,6 +35,7 @@ export function renderSharePreviewHtml(
const facetCatalog = normalizeFacetCatalog(facetCatalogValue);
const installUrl = safeWebUrl(options.installUrl);
const locale = options.locale === "en" ? "en" : "zh-CN";
+ const libraryTitle = libraryTitleForLocale(settingsValue.libraryTitle, locale);
const theme = ["system", "light", "dark"].includes(options.theme) ? options.theme : "dark";
const iconSprite = inlineIconSprite(options.iconSprite);
const relatedById = relatedEntriesById(normalizedEntries, facetCatalog);
@@ -61,7 +62,7 @@ export function renderSharePreviewHtml(
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src 'self' data:; media-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self'; connect-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'" />
- <title>${escapeHtml(settingsValue.libraryTitle)} | ${locale === "en" ? "Shared cases" : "分享案例"}</title>
+ <title>${escapeHtml(libraryTitle)} | ${locale === "en" ? "Shared cases" : "分享案例"}</title>
<link rel="stylesheet" href="${SHARE_PREVIEW_FOUNDATION_FILENAME}" />
<style>${sharePreviewStyles()}</style>
</head>
@@ -69,8 +70,9 @@ export function renderSharePreviewHtml(
${iconSprite}
<header class="app-header">
<div class="brand-block">
- <p class="eyebrow">PROMPTDIRECTOR</p>
- <h1>${escapeHtml(settingsValue.libraryTitle)}</h1>
+ <p class="eyebrow">PromptDirector</p>
+ <p class="product-tagline" data-zh="视觉创作灵感库" data-en="Visual Inspiration Library">${locale === "en" ? "Visual Inspiration Library" : "视觉创作灵感库"}</p>
+ <h1>${escapeHtml(libraryTitle)}</h1>
<p class="package-count"><span id="visible-count">${normalizedEntries.length}</span><span data-zh=" 个案例" data-en=" cases">${locale === "en" ? " cases" : " 个案例"}</span></p>
</div>
<div class="header-tools">
@@ -91,6 +93,8 @@ export function renderSharePreviewHtml(
<section id="empty-state" class="empty-state" hidden><strong data-zh="没有匹配的案例" data-en="No matching cases">${locale === "en" ? "No matching cases" : "没有匹配的案例"}</strong><p data-zh="调整搜索或内容类型。" data-en="Adjust the search or content type.">${locale === "en" ? "Adjust the search or content type." : "调整搜索或内容类型。"}</p></section>
</main>
+ <footer class="app-footer"><strong>PromptDirector</strong><span data-zh="提示词导演,你的视觉创作私人灵感库。" data-en="PromptDirector, your private visual inspiration library.">${locale === "en" ? "PromptDirector, your private visual inspiration library." : "提示词导演,你的视觉创作私人灵感库。"}</span></footer>
+
<section id="detail-view" class="detail-view" aria-hidden="true" hidden>
<nav class="detail-toolbar" aria-label="Case navigation">
<div class="detail-navigation">
@@ -562,7 +566,8 @@ function escapeAttribute(value) {
function sharePreviewStyles() {
return `
- :root{--visual-wall-gap:2px;--visual-card-radius:2px}.share-icon-sprite{position:absolute;width:0;height:0;overflow:hidden}body{min-width:0;background:var(--ui-page)}body.detail-open{overflow:hidden}.app-header{position:sticky;z-index:20;top:0;display:flex;min-height:64px;align-items:center;gap:24px;border-bottom:1px solid var(--ui-border);padding:8px 12px;background:var(--bar);backdrop-filter:blur(16px)}.brand-block{display:grid;min-width:190px;gap:1px}.eyebrow{margin:0;color:var(--ui-accent);font-size:11px;font-weight:800;letter-spacing:.12em}.brand-block h1{max-width:340px;overflow:hidden;margin:0;color:var(--ui-text);font-size:18px;line-height:1.2;text-overflow:ellipsis;white-space:nowrap}.package-count{margin:0;color:var(--ui-muted);font-size:11px}.header-tools{display:flex;min-width:0;flex:1;align-items:center;justify-content:flex-end;gap:8px}.search-field{width:min(360px,32vw)}.type-field{width:min(180px,18vw)}.compact-setting{display:flex;align-items:center;gap:6px;color:var(--ui-muted);font-size:11px}.compact-setting select{width:auto;min-width:92px}.import-guide{display:flex;align-items:center;justify-content:space-between;gap:16px;border-bottom:1px solid var(--ui-border);padding:10px 14px;background:var(--ui-surface)}.import-guide p{margin:0;color:var(--ui-muted);font-size:11px;line-height:1.55}.import-guide strong{color:var(--ui-text)}.product-actions{display:flex;align-items:center;gap:7px}.install-action,.source-action{display:inline-flex;min-height:30px;align-items:center;padding:5px 9px;text-decoration:none;white-space:nowrap}.gallery-shell{padding:8px 6px 60px}.case-grid,.related-grid{position:relative;width:100%;overflow-anchor:none;--masonry-card-min-width:270px;--masonry-gap:var(--visual-wall-gap)}.case-card,.related-card{position:absolute;display:block;width:100%;min-height:0;overflow:hidden;border:0;border-radius:var(--visual-card-radius);padding:0;color:var(--ui-text);background:var(--ui-surface);cursor:pointer;vertical-align:top;white-space:normal}.case-card:hover,.related-card:hover{background:var(--ui-hover);box-shadow:0 8px 20px color-mix(in srgb,var(--ui-text) 10%,transparent)}.tile-media{position:relative;display:block;min-height:110px;overflow:hidden;background:var(--viewer-bg)}.tile-media img{display:block;width:100%;height:auto}.tile-media[style] img{height:100%;object-fit:cover}.video-cue{position:absolute;top:50%;left:50%;display:grid;width:38px;height:38px;place-items:center;border-radius:50%;color:white;background:rgba(7,9,11,.68);transform:translate(-50%,-50%)}.video-duration,.media-count{position:absolute;right:7px;bottom:7px;border-radius:3px;padding:2px 5px;color:white;background:rgba(7,9,11,.72);font-size:11px}.media-count{top:7px;bottom:auto}.fallback-cover{display:grid;min-height:190px;align-content:space-between;gap:18px;padding:16px;color:var(--ui-text);background:var(--ui-raised);text-align:left}.fallback-cover.document,.fallback-cover.attachment{background:linear-gradient(160deg,var(--ui-raised),var(--ui-surface))}.fallback-cover.audio{background:linear-gradient(160deg,var(--viewer-bg),var(--ui-raised))}.fallback-cover small{color:var(--ui-accent);font-size:11px;font-weight:800;letter-spacing:.12em}.fallback-cover strong{font-size:16px;line-height:1.35}.empty-state{padding:80px 20px;color:var(--ui-muted);text-align:center}.empty-state strong{color:var(--ui-text);font-size:18px}.detail-view{position:fixed;z-index:50;inset:0;overflow:auto;background:var(--viewer-bg)}.detail-toolbar{position:fixed;z-index:55;inset:0 0 auto;height:0;pointer-events:none}.detail-toolbar .icon-button{color:white;border-color:rgba(255,255,255,.22);background:rgba(15,17,19,.82);box-shadow:0 4px 18px rgba(0,0,0,.24);pointer-events:auto}.detail-toolbar>.icon-button{position:absolute;top:14px;right:14px}.detail-navigation{position:absolute;top:50dvh;right:clamp(380px,34vw,480px);left:0;display:flex;justify-content:space-between;padding:0 16px;transform:translateY(-50%)}.detail-stack{min-height:100%}.case-detail{min-height:100%;background:var(--ui-surface)}.detail-primary{display:grid;min-height:100dvh;grid-template-columns:minmax(0,1fr) clamp(380px,34vw,480px)}.detail-primary:not(.has-media){display:block}.detail-gallery{display:grid;min-width:0;min-height:100dvh;align-content:center;background:var(--viewer-bg)}.detail-media-stage{display:grid;min-height:0}.detail-media-panel{min-width:0}.detail-media-panel>video{display:block;width:100%;max-height:calc(100dvh - 88px);margin:auto;background:#06080c}.detail-image-frame{display:block;width:100%;min-height:0;margin:0;background:#06080c}.detail-image-frame img{display:block;width:100%;height:calc(100dvh - 88px);object-fit:contain}.detail-media-rail{display:flex;gap:7px;overflow-x:auto;padding:8px 10px 10px;background:var(--viewer-bg)}.detail-media-thumb{display:grid;width:76px;min-width:76px;min-height:58px;place-items:center;overflow:hidden;border:1px solid transparent;border-radius:6px;padding:0;color:white;background:#06080c;opacity:.72}.detail-media-thumb[aria-pressed="true"]{border-color:rgba(255,255,255,.62);opacity:1}.detail-media-thumb img{display:block;width:100%;height:56px;object-fit:cover}.media-caption{display:grid;gap:6px;padding:10px 12px;color:rgba(255,255,255,.82);background:color-mix(in srgb,var(--viewer-bg) 92%,white);font-size:11px}.media-caption p{margin:0}.media-caption strong{display:block;margin-bottom:2px;color:white}.document-panel,.audio-panel,.detail-placeholder{display:grid;min-height:360px;place-items:center;align-content:center;gap:14px;padding:24px;color:var(--ui-muted);background:var(--ui-surface);text-align:center}.document-panel strong,.audio-panel>strong{color:var(--ui-accent);font-size:46px}.audio-panel>strong{font-size:18px}.audio-panel audio{width:min(520px,90%)}.document-panel .button-primary,.audio-panel .button-secondary{display:inline-flex;align-items:center;text-decoration:none}.detail-body{min-width:0;border-left:1px solid var(--ui-border);background:var(--ui-surface)}.detail-section{border-bottom:1px solid var(--ui-border);padding:16px 22px}.detail-section h2{margin:4px 0 8px;font-size:17px;line-height:1.35}.detail-section h3{margin:0 0 10px;font-size:11px}.detail-meta{display:flex;flex-wrap:wrap;gap:8px 14px;color:var(--ui-muted);font-size:11px}.palette{display:flex;height:16px;overflow:hidden;margin-top:12px;border-radius:4px}.palette i{flex:1}.detail-tags{display:flex;flex-wrap:wrap;gap:5px}.detail-tags span{padding:4px 7px;border-radius:999px;color:var(--ui-text);background:var(--ui-raised);font-size:11px;font-weight:700}.section-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}.section-heading h3{margin:0}.prompt-text{max-height:360px;overflow:auto;margin:0;border-radius:6px;padding:14px;color:var(--prompt-ink);background:var(--prompt-bg);font:12px/1.7 ui-monospace,SFMono-Regular,Menlo,monospace;white-space:pre-wrap;overflow-wrap:anywhere}.compose-guide,.visual-description{margin:10px 0 0;color:var(--ui-muted);font-size:11px;line-height:1.55}.source-open-action{display:inline-flex;min-height:30px;align-items:center;border:1px solid var(--ui-border);border-radius:4px;padding:5px 9px;color:var(--ui-text);font-size:11px;font-weight:700;text-decoration:none}.metadata-list{display:grid;margin:0}.metadata-row{display:grid;grid-template-columns:minmax(72px,104px) minmax(0,1fr);gap:12px;border-top:1px solid var(--ui-border);padding:7px 0}.metadata-row:first-child{border-top:0}.metadata-row dt{color:var(--ui-muted);font-size:11px;font-weight:700}.metadata-row dd{margin:0;overflow-wrap:anywhere;font-size:12px}.time-notes{display:grid;gap:8px;margin:0;padding:0;list-style:none}.time-notes li{display:grid;grid-template-columns:72px 1fr;gap:10px}.time-notes time{color:var(--ui-accent);font:11px ui-monospace,monospace}.time-notes span{font-size:12px}.related-section{border-top:1px solid var(--ui-border);padding:20px 6px 60px;background:var(--ui-page)}.related-section>header{display:flex;align-items:center;justify-content:space-between;margin:0 2px 10px}.related-section h3{margin:0;font-size:16px}.related-section header span{color:var(--ui-muted);font-size:11px}#feedback{position:fixed;z-index:90;right:18px;bottom:18px;max-width:min(360px,calc(100vw - 36px));margin:0;border:1px solid var(--ui-border-strong);border-radius:6px;padding:9px 12px;color:var(--ui-text);background:var(--ui-surface);box-shadow:var(--ui-shadow);font-size:12px;pointer-events:none}#feedback:empty{display:none}select,select::picker(select){appearance:base-select}select::picker(select){max-height:min(360px,calc(100dvh - 32px));overflow:auto;border:1px solid var(--ui-border-strong);border-radius:var(--ui-container-radius);padding:6px;color:var(--ui-text);background:var(--ui-surface);box-shadow:var(--ui-shadow)}select option{min-height:36px;border-radius:var(--ui-control-radius);padding:7px 10px;color:var(--ui-text);background:var(--ui-surface)}select option:hover,select option:focus-visible{background:var(--ui-hover)}select option:checked{color:var(--ui-accent-contrast);background:var(--ui-accent);font-weight:750}
+ :root{--visual-wall-gap:2px;--visual-card-radius:2px}.share-icon-sprite{position:absolute;width:0;height:0;overflow:hidden}body{min-width:0;background:var(--ui-page)}body.detail-open{overflow:hidden}.app-header{position:sticky;z-index:20;top:0;display:flex;min-height:64px;align-items:center;gap:24px;border-bottom:1px solid var(--ui-border);padding:8px 12px;background:var(--bar);backdrop-filter:blur(16px)}.brand-block{display:grid;min-width:190px;gap:1px}.eyebrow{margin:0;color:var(--ui-text);font-size:11px;font-weight:800;letter-spacing:.02em}.product-tagline{overflow:hidden;margin:0;color:var(--ui-muted);font-size:10px;line-height:13px;text-overflow:ellipsis;white-space:nowrap}.brand-block h1{max-width:340px;overflow:hidden;margin:0;color:var(--ui-text);font-size:18px;line-height:1.2;text-overflow:ellipsis;white-space:nowrap}.package-count{margin:0;color:var(--ui-muted);font-size:11px}.header-tools{display:flex;min-width:0;flex:1;align-items:center;justify-content:flex-end;gap:8px}.search-field{width:min(360px,32vw)}.type-field{width:min(180px,18vw)}.compact-setting{display:flex;align-items:center;gap:6px;color:var(--ui-muted);font-size:11px}.compact-setting select{width:auto;min-width:92px}.import-guide{display:flex;align-items:center;justify-content:space-between;gap:16px;border-bottom:1px solid var(--ui-border);padding:10px 14px;background:var(--ui-surface)}.import-guide p{margin:0;color:var(--ui-muted);font-size:11px;line-height:1.55}.import-guide strong{color:var(--ui-text)}.product-actions{display:flex;align-items:center;gap:7px}.install-action,.source-action{display:inline-flex;min-height:30px;align-items:center;padding:5px 9px;text-decoration:none;white-space:nowrap}.app-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;border-top:1px solid var(--ui-border);padding:14px;color:var(--ui-muted);font-size:11px}.app-footer strong{color:var(--ui-text)}.gallery-shell{padding:8px 6px 60px}.case-grid,.related-grid{position:relative;width:100%;overflow-anchor:none;--masonry-card-min-width:270px;--masonry-gap:var(--visual-wall-gap)}.case-card,.related-card{position:absolute;display:block;width:100%;min-height:0;overflow:hidden;border:0;border-radius:var(--visual-card-radius);padding:0;color:var(--ui-text);background:var(--ui-surface);cursor:pointer;vertical-align:top;white-space:normal}.case-card:hover,.related-card:hover{background:var(--ui-hover);box-shadow:0 8px 20px color-mix(in srgb,var(--ui-text) 10%,transparent)}.tile-media{position:relative;display:block;min-height:110px;overflow:hidden;background:var(--viewer-bg)}.tile-media img{display:block;width:100%;height:auto}.tile-media[style] img{height:100%;object-fit:cover}.video-cue{position:absolute;top:50%;left:50%;display:grid;width:38px;height:38px;place-items:center;border-radius:50%;color:white;background:rgba(7,9,11,.68);transform:translate(-50%,-50%)}.video-duration,.media-count{position:absolute;right:7px;bottom:7px;border-radius:3px;padding:2px 5px;color:white;background:rgba(7,9,11,.72);font-size:11px}.media-count{top:7px;bottom:auto}.fallback-cover{display:grid;min-height:190px;align-content:space-between;gap:18px;padding:16px;color:var(--ui-text);background:var(--ui-raised);text-align:left}.fallback-cover.document,.fallback-cover.attachment{background:linear-gradient(160deg,var(--ui-raised),var(--ui-surface))}.fallback-cover.audio{background:linear-gradient(160deg,var(--viewer-bg),var(--ui-raised))}.fallback-cover small{color:var(--ui-accent);font-size:11px;font-weight:800;letter-spacing:.12em}.fallback-cover strong{font-size:16px;line-height:1.35}.empty-state{padding:80px 20px;color:var(--ui-muted);text-align:center}.empty-state strong{color:var(--ui-text);font-size:18px}.detail-view{position:fixed;z-index:50;inset:0;overflow:auto;background:var(--viewer-bg)}.detail-toolbar{position:fixed;z-index:55;inset:0 0 auto;height:0;pointer-events:none}.detail-toolbar .icon-button{color:white;border-color:rgba(255,255,255,.22);background:rgba(15,17,19,.82);box-shadow:0 4px 18px rgba(0,0,0,.24);pointer-events:auto}.detail-toolbar>.icon-button{position:absolute;top:14px;right:14px}.detail-navigation{position:absolute;top:50dvh;right:clamp(380px,34vw,480px);left:0;display:flex;justify-content:space-between;padding:0 16px;transform:translateY(-50%)}.detail-stack{min-height:100%}.case-detail{min-height:100%;background:var(--ui-surface)}.detail-primary{display:grid;min-height:100dvh;grid-template-columns:minmax(0,1fr) clamp(380px,34vw,480px)}.detail-primary:not(.has-media){display:block}.detail-gallery{display:grid;min-width:0;min-height:100dvh;align-content:center;background:var(--viewer-bg)}.detail-media-stage{display:grid;min-height:0}.detail-media-panel{min-width:0}.detail-media-panel>video{display:block;width:100%;max-height:calc(100dvh - 88px);margin:auto;background:#06080c}.detail-image-frame{display:block;width:100%;min-height:0;margin:0;background:#06080c}.detail-image-frame img{display:block;width:100%;height:calc(100dvh - 88px);object-fit:contain}.detail-media-rail{display:flex;gap:7px;overflow-x:auto;padding:8px 10px 10px;background:var(--viewer-bg)}.detail-media-thumb{display:grid;width:76px;min-width:76px;min-height:58px;place-items:center;overflow:hidden;border:1px solid transparent;border-radius:6px;padding:0;color:white;background:#06080c;opacity:.72}.detail-media-thumb[aria-pressed="true"]{border-color:rgba(255,255,255,.62);opacity:1}.detail-media-thumb img{display:block;width:100%;height:56px;object-fit:cover}.media-caption{display:grid;gap:6px;padding:10px 12px;color:rgba(255,255,255,.82);background:color-mix(in srgb,var(--viewer-bg) 92%,white);font-size:11px}.media-caption p{margin:0}.media-caption strong{display:block;margin-bottom:2px;color:white}.document-panel,.audio-panel,.detail-placeholder{display:grid;min-height:360px;place-items:center;align-content:center;gap:14px;padding:24px;color:var(--ui-muted);background:var(--ui-surface);text-align:center}.document-panel strong,.audio-panel>strong{color:var(--ui-accent);font-size:46px}.audio-panel>strong{font-size:18px}.audio-panel audio{width:min(520px,90%)}.document-panel .button-primary,.audio-panel .button-secondary{display:inline-flex;align-items:center;text-decoration:none}.detail-body{min-width:0;border-left:1px solid var(--ui-border);background:var(--ui-surface)}.detail-section{border-bottom:1px solid var(--ui-border);padding:16px 22px}.detail-section h2{margin:4px 0 8px;font-size:17px;line-height:1.35}.detail-section h3{margin:0 0 10px;font-size:11px}.detail-meta{display:flex;flex-wrap:wrap;gap:8px 14px;color:var(--ui-muted);font-size:11px}.palette{display:flex;height:16px;overflow:hidden;margin-top:12px;border-radius:4px}.palette i{flex:1}.detail-tags{display:flex;flex-wrap:wrap;gap:5px}.detail-tags span{padding:4px 7px;border-radius:999px;color:var(--ui-text);background:var(--ui-raised);font-size:11px;font-weight:700}.section-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}.section-heading h3{margin:0}.prompt-text{max-height:360px;overflow:auto;margin:0;border-radius:6px;padding:14px;color:var(--prompt-ink);background:var(--prompt-bg);font:12px/1.7 ui-monospace,SFMono-Regular,Menlo,monospace;white-space:pre-wrap;overflow-wrap:anywhere}.compose-guide,.visual-description{margin:10px 0 0;color:var(--ui-muted);font-size:11px;line-height:1.55}.source-open-action{display:inline-flex;min-height:30px;align-items:center;border:1px solid var(--ui-border);border-radius:4px;padding:5px 9px;color:var(--ui-text);font-size:11px;font-weight:700;text-decoration:none}.metadata-list{display:grid;margin:0}.metadata-row{display:grid;grid-template-columns:minmax(72px,104px) minmax(0,1fr);gap:12px;border-top:1px solid var(--ui-border);padding:7px 0}.metadata-row:first-child{border-top:0}.metadata-row dt{color:var(--ui-muted);font-size:11px;font-weight:700}.metadata-row dd{margin:0;overflow-wrap:anywhere;font-size:12px}.time-notes{display:grid;gap:8px;margin:0;padding:0;list-style:none}.time-notes li{display:grid;grid-template-columns:72px 1fr;gap:10px}.time-notes time{color:var(--ui-accent);font:11px ui-monospace,monospace}.time-notes span{font-size:12px}.related-section{border-top:1px solid var(--ui-border);padding:20px 6px 60px;background:var(--ui-page)}.related-section>header{display:flex;align-items:center;justify-content:space-between;margin:0 2px 10px}.related-section h3{margin:0;font-size:16px}.related-section header span{color:var(--ui-muted);font-size:11px}#feedback{position:fixed;z-index:90;right:18px;bottom:18px;max-width:min(360px,calc(100vw - 36px));margin:0;border:1px solid var(--ui-border-strong);border-radius:6px;padding:9px 12px;color:var(--ui-text);background:var(--ui-surface);box-shadow:var(--ui-shadow);font-size:12px;pointer-events:none}#feedback:empty{display:none}select,select::picker(select){appearance:base-select}select::picker(select){max-height:min(360px,calc(100dvh - 32px));overflow:auto;border:1px solid var(--ui-border-strong);border-radius:var(--ui-container-radius);padding:6px;color:var(--ui-text);background:var(--ui-surface);box-shadow:var(--ui-shadow)}select option{min-height:36px;border-radius:var(--ui-control-radius);padding:7px 10px;color:var(--ui-text);background:var(--ui-surface)}select option:hover,select option:focus-visible{background:var(--ui-hover)}select option:checked{color:var(--ui-accent-contrast);background:var(--ui-accent);font-weight:750}
+ .case-card:hover,.related-card:hover{box-shadow:none}.case-card::after,.related-card::after{position:absolute;z-index:3;inset:0;border:1px solid transparent;border-radius:inherit;content:"";pointer-events:none}.case-card:hover::after,.related-card:hover::after{border-color:var(--ui-border-strong)}.case-card:focus-visible,.related-card:focus-visible{outline:0}.case-card:focus-visible::after,.related-card:focus-visible::after{border-width:2px;border-color:var(--ui-focus)}.eyebrow,.fallback-cover small,.document-panel strong,.audio-panel>strong,.time-notes time{color:var(--ui-text)}.fallback-cover.audio{background:linear-gradient(160deg,var(--ui-raised),var(--ui-surface))}select option:checked{color:var(--ui-accent-emphasis-contrast);background:var(--ui-accent-emphasis)}
@media(max-width:860px){.app-header{align-items:flex-start;flex-direction:column;gap:8px}.header-tools{width:100%;flex-wrap:wrap;justify-content:flex-start}.search-field{flex:1 1 220px;width:auto}.type-field{flex:1 1 150px;width:auto}.compact-setting{flex:1 1 130px}.compact-setting select{flex:1}.import-guide{align-items:flex-start}.detail-primary{display:block}.detail-gallery{min-height:auto}.detail-image-frame img{height:min(62dvh,640px)}.detail-body{border-top:1px solid var(--ui-border);border-left:0}.detail-navigation{top:32dvh;right:0}.related-section{padding-bottom:28px}}
@media(max-width:520px){.app-header{position:static;padding:10px}.brand-block{min-width:0}.header-tools{display:grid;grid-template-columns:1fr 1fr}.search-field{grid-column:1/-1}.type-field{width:auto}.compact-setting{display:grid}.import-guide{flex-direction:column;padding:10px}.case-grid,.related-grid{--masonry-card-min-width:155px;--masonry-gap:var(--visual-wall-gap)}.detail-toolbar>.icon-button{top:10px;right:10px}.detail-navigation{top:31dvh;padding:0 10px}.detail-section{padding:14px 16px}.related-section{padding-inline:2px}.related-section>header{padding-inline:8px}.related-section header span{display:none}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}
diff --git a/skills-page.css b/skills-page.css
index 94ea30d..a412b40 100644
--- a/skills-page.css
+++ b/skills-page.css
@@ -8,17 +8,19 @@
.skills-top-actions { align-items: center; }
.skill-context-back { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.skill-context-back .ui-icon { width: 15px; height: 15px; }
-.skills-topbar { position: sticky; top: 0; z-index: 20; min-height: 64px; display: grid; grid-template-columns: minmax(180px, 260px) minmax(220px, 560px) auto; align-items: center; gap: 16px; padding: 10px clamp(14px, 3vw, 40px); border-bottom: 1px solid var(--skill-line); background: color-mix(in srgb, var(--bar) 92%, transparent); backdrop-filter: blur(18px); }
+.skills-topbar { position: sticky; top: 0; z-index: 20; min-width: 0; min-height: 64px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 720px) minmax(0, 1fr); align-items: center; gap: 12px; padding: 10px var(--ui-browse-gutter); border-bottom: 1px solid var(--skill-line); background: color-mix(in srgb, var(--bar) 92%, transparent); backdrop-filter: blur(18px); }
.skills-page:not([data-skill-view="list"]) .skills-topbar { grid-template-columns: minmax(0, 1fr) auto; }
.skills-brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
+.skills-brand:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: 3px; }
.skills-brand img { width: 34px; height: 34px; border-radius: 7px; }
-.skills-brand span { display: grid; min-width: 0; }
-.skills-brand small { font-size: 10px; color: var(--muted, #697069); }
-.skills-brand strong { color: var(--ink); }
-.skills-search input { width: 100%; }
+.skills-brand .product-brand-copy { display: grid; min-width: 0; }
+.skills-brand .product-brand-name { color: var(--ink); }
+.skills-search { min-width: 0; }
+.skills-search input { width: 100%; min-width: 0; }
.skills-top-actions, .skill-step-actions, .skill-import-dialog > div { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.skills-top-actions > button, .skill-detail-actions button { min-height: 36px; }
.skills-main { max-width: 1520px; margin: 0 auto; padding: clamp(20px, 3vw, 44px); }
+.skills-page[data-skill-view="list"] .skills-main { width: min(calc(100% - 24px), var(--ui-browse-max-width)); max-width: none; padding-inline: 0; }
body:not([data-skill-view="list"]) .skills-main { padding-top: 20px; }
.skills-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.skills-heading > div:first-child { display: grid; gap: 5px; }
@@ -26,13 +28,14 @@ body:not([data-skill-view="list"]) .skills-main { padding-top: 20px; }
.skills-heading p { margin: 0; color: var(--muted, #697069); }
.skills-heading-actions { display: flex; gap: 8px; }
.skill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); align-content: start; align-items: start; gap: 8px; }
-.skill-card { min-height: 152px; display: flex; flex-direction: column; align-items: stretch; padding: 16px; text-align: left; border: 1px solid var(--skill-line); border-radius: var(--ui-container-radius); background: var(--skill-panel); color: var(--ink); box-shadow: none; }
-.skill-card:hover:not(:disabled) { border-color: var(--selection-edge); background: var(--raised); }
+.skill-card { min-height: 152px; display: flex; flex-direction: column; align-items: stretch; padding: 16px; text-align: left; border: 1px solid var(--ui-card-border); border-radius: var(--ui-container-radius); background: var(--skill-panel); color: var(--ink); box-shadow: none; font-weight: 400; }
+.skill-card:hover:not(:disabled) { border-color: var(--ui-border); background: var(--raised); }
.skill-card header { display: flex; justify-content: space-between; gap: 12px; }
-.skill-card h2 { margin: 0; font-size: 17px; letter-spacing: 0; overflow-wrap: anywhere; }
-.skill-card code { color: var(--accent, #39784d); font-size: 12px; }
-.skill-card p { display: -webkit-box; flex: 1; overflow: hidden; margin: 10px 0; color: var(--muted, #697069); font-size: 12px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
-.skill-card footer { display: flex; justify-content: space-between; color: var(--muted, #697069); font-size: 12px; }
+.skill-card h2 { margin: 0; font-size: 17px; font-weight: 750; letter-spacing: 0; overflow-wrap: anywhere; }
+.skill-card header > strong { font-weight: 750; }
+.skill-card code { color: var(--muted, #697069); font-size: 12px; font-weight: 600; }
+.skill-card p { display: -webkit-box; flex: 1; overflow: hidden; margin: 10px 0; color: var(--muted, #697069); font-size: 12px; font-weight: 450; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
+.skill-card footer { display: flex; justify-content: space-between; color: var(--muted, #697069); font-size: 12px; font-weight: 600; }
.skill-empty { max-width: 520px; margin: 12vh auto; text-align: center; }
.skill-empty strong { font-size: 24px; }
.skill-empty p { color: var(--muted, #697069); }
@@ -53,7 +56,7 @@ body:not([data-skill-view="list"]) .skills-main { padding-top: 20px; }
.skill-project-picker[open] > summary .ui-icon { transform: rotate(180deg); }
.skill-project-filter { position: absolute; z-index: 12; top: calc(100% + 5px); right: 0; left: 0; display: grid; gap: 2px; max-height: 240px; overflow: auto; border: 1px solid var(--skill-line); border-radius: var(--ui-container-radius); padding: 5px; background: var(--raised); box-shadow: var(--shadow); }
.skill-project-filter button { width: 100%; min-height: 32px; justify-content: flex-start; border-color: transparent; padding: 6px 8px; color: var(--muted); background: transparent; text-align: left; }
-.skill-project-filter button[aria-selected="true"] { color: var(--ink); border-color: var(--selection-edge); background: var(--selection); box-shadow: inset 2px 0 var(--accent); }
+.skill-project-filter button[aria-selected="true"] { color: var(--ink); border-color: var(--selection-edge); background: var(--selection); box-shadow: inset 2px 0 var(--accent-emphasis); }
#skill-clear-selection { width: 100%; }
.skill-builder-content { display: grid; gap: 12px; min-width: 0; }
.skill-step { padding: clamp(14px, 1.6vw, 20px); border: 1px solid var(--skill-line); border-radius: var(--ui-container-radius); background: var(--skill-panel); }
@@ -77,8 +80,8 @@ body:not([data-skill-view="list"]) .skills-main { padding-top: 20px; }
.skill-case-copy strong, .skill-case-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skill-case-copy strong { font-size: 12px; line-height: 1.25; }
.skill-case-copy small { color: var(--muted); font-size: 10px; font-weight: 500; }
-.skill-case-state { position: absolute; z-index: 2; top: 9px; right: 9px; width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--accent) 75%, white); border-radius: 50%; color: var(--accent-contrast); background: var(--accent); font-size: 12px; font-weight: 850; line-height: 1; pointer-events: none; }
-.skill-case[data-selected="true"] .skill-case-state { background: var(--accent); }
+.skill-case-state { position: absolute; z-index: 2; top: 9px; right: 9px; width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--accent-emphasis) 75%, white); border-radius: 50%; color: var(--accent-emphasis-contrast); background: var(--accent-emphasis); font-size: 12px; font-weight: 850; line-height: 1; pointer-events: none; }
+.skill-case[data-selected="true"] .skill-case-state { background: var(--accent-emphasis); }
.skill-case-state[hidden] { display: none; }
.skill-case-detail { position: absolute; z-index: 3; right: 7px; bottom: 10px; min-height: 26px; max-width: 70px; overflow: hidden; border-color: var(--skill-line); padding: 4px 7px; color: var(--muted); background: var(--raised); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.skill-case-load-more { display: flex; margin: 12px auto 2px; }
@@ -90,7 +93,7 @@ body:not([data-skill-view="list"]) .skills-main { padding-top: 20px; }
.skill-run-evidence small { color: var(--muted, #697069); font-size: 11px; line-height: 1.45; }
.skill-target-step textarea { width: 100%; resize: vertical; }
.skill-vision-toggle { display: flex; align-items: start; gap: 10px; margin: 10px 0; border: 1px solid var(--skill-line); border-radius: var(--ui-container-radius); padding: 10px 12px; background: var(--subtle-card); cursor: pointer; }
-.skill-vision-toggle input { width: auto; min-height: 0; margin-top: 2px; accent-color: var(--accent); }
+.skill-vision-toggle input { width: auto; min-height: 0; margin-top: 2px; accent-color: var(--accent-emphasis); }
.skill-vision-toggle span { display: grid; gap: 2px; }
.skill-vision-toggle small { color: var(--muted); font-size: 11px; }
.skill-vision-preview { margin: 10px 0; border: 1px solid var(--selection-edge); border-radius: var(--ui-container-radius); padding: 10px 12px; background: var(--raised); color: var(--muted); font-size: 11px; line-height: 1.5; }
@@ -113,11 +116,11 @@ body:not([data-skill-view="list"]) .skills-main { padding-top: 20px; }
.skill-run-heading span { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.skill-run-heading strong.error { color: var(--danger); }
.skill-run-track { height: 3px; overflow: hidden; border-radius: 2px; background: var(--line); }
-.skill-run-track span { display: block; width: 0; height: 100%; background: var(--accent); transition: width 180ms ease; }
+.skill-run-track span { display: block; width: 0; height: 100%; background: var(--accent-emphasis); transition: width 180ms ease; }
.skill-run-stages { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin: 0; padding: 0; list-style: none; }
.skill-run-stages li { border: 1px solid var(--skill-line); border-radius: var(--ui-control-radius); padding: 6px 7px; color: var(--muted); font-size: 10px; text-align: center; }
.skill-run-stages li[data-state="active"] { color: var(--ink); border-color: var(--selection-edge); background: var(--subtle-card); }
-.skill-run-stages li[data-state="done"] { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 32%, var(--line)); }
+.skill-run-stages li[data-state="done"] { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent-emphasis) 32%, var(--line)); }
.skill-run-log > summary { color: var(--muted); cursor: pointer; font-size: 11px; }
.skill-run-log > div { display: grid; gap: 5px; max-height: 150px; overflow: auto; margin-top: 8px; color: var(--muted); font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
.skill-run-log p { margin: 0; }
@@ -142,14 +145,14 @@ body:not([data-skill-view="list"]) .skills-main { padding-top: 20px; }
.skill-submission-dialog { width: min(900px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); border: 1px solid var(--ui-border-strong); border-radius: var(--ui-container-radius); padding: 24px; color: var(--ui-text); background: var(--ui-surface); }
.skill-submission-dialog::backdrop { background: rgba(0,0,0,.72); }
.skill-submission-dialog header { display: flex; justify-content: space-between; align-items: start; }
-.skill-submission-dialog header small { color: var(--ui-accent); }
+.skill-submission-dialog header small { color: var(--ui-muted); }
.skill-submission-dialog h2 { margin: 4px 0 0; }
.skill-submission-dialog > p { color: var(--ui-muted); }
.skill-submission-fields { display: grid; gap: 14px; }
.skill-submission-fields label:not(.skill-submission-rights) { display: grid; gap: 6px; }
.skill-submission-summary textarea { min-height: 90px; resize: vertical; }
.skill-submission-rights { display: flex; align-items: flex-start; gap: 9px; border: 1px solid var(--ui-border); border-radius: var(--ui-container-radius); padding: 12px; background: var(--ui-raised); }
-.skill-submission-rights input { width: 16px; min-height: 16px; margin: 2px 0 0; accent-color: var(--ui-accent); }
+.skill-submission-rights input { width: 16px; min-height: 16px; margin: 2px 0 0; accent-color: var(--ui-accent-emphasis); }
.skill-submission-field-error { color: var(--ui-danger); font-size: var(--ui-meta-size); }
.skill-submission-rights-error { margin-top: -9px; }
.skill-submission-license-details { color: var(--ui-muted); font-size: var(--ui-meta-size); }
@@ -162,7 +165,7 @@ body:not([data-skill-view="list"]) .skills-main { padding-top: 20px; }
.skill-detail-header { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.skill-detail-header h1 { margin: 3px 0 0; font-size: clamp(24px, 3vw, 38px); letter-spacing: 0; }
-.skill-detail-header code { color: var(--accent-ink); font-size: 12px; }
+.skill-detail-header code { color: var(--muted); font-size: 12px; font-weight: 600; }
.skill-detail-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.skill-detail-more { position: relative; }
.skill-detail-more > summary { display: flex; min-height: 36px; align-items: center; list-style: none; border: 1px solid var(--line); border-radius: var(--ui-control-radius); padding: 7px 12px; cursor: pointer; font-size: 12px; font-weight: 750; }
@@ -192,7 +195,7 @@ body:not([data-skill-view="list"]) .skills-main { padding-top: 20px; }
.skill-source-inspector-actions { display: flex; gap: 7px; border-bottom: 1px solid var(--skill-line); padding: 9px 14px; }
.skill-source-inspector-actions #skill-source-clear { margin-left: auto; color: var(--danger); }
.skill-source-text-option { display: flex; align-items: center; gap: 9px; border-bottom: 1px solid var(--skill-line); padding: 11px 14px; font-size: 12px; }
-.skill-source-text-option input { width: auto; min-height: 0; accent-color: var(--accent); }
+.skill-source-text-option input { width: auto; min-height: 0; accent-color: var(--accent-emphasis); }
.skill-source-asset-list { display: grid; align-content: start; gap: 3px; overflow: auto; padding: 10px; }
.skill-source-asset { display: grid; grid-template-columns: 76px minmax(0,1fr) auto; align-items: center; gap: 10px; min-height: 70px; border: 1px solid var(--skill-line); border-radius: var(--ui-container-radius); padding: 6px; background: var(--subtle-card); }
.skill-source-asset[data-selected="true"] { border-color: var(--selection-indicator); }
@@ -201,7 +204,7 @@ body:not([data-skill-view="list"]) .skills-main { padding-top: 20px; }
.skill-source-asset-copy { display: grid; gap: 3px; min-width: 0; }
.skill-source-asset-copy strong { font-size: 12px; }
.skill-source-asset-copy small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
-.skill-source-asset input { width: auto; min-height: 0; accent-color: var(--accent); }
+.skill-source-asset input { width: auto; min-height: 0; accent-color: var(--accent-emphasis); }
.skill-source-inspector-footer { display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--skill-line); padding: 12px 14px; background: var(--bar); }
@media (max-width: 1320px) {
@@ -214,10 +217,14 @@ body:not([data-skill-view="list"]) .skills-main { padding-top: 20px; }
.skill-source-sidebar .skill-section-heading { grid-column: 1 / -1; }
}
-@media (max-width: 760px) {
+@media (max-width: 1100px) {
.skills-topbar { grid-template-columns: 1fr auto; }
.skills-search { grid-column: 1 / -1; grid-row: 2; }
+}
+
+@media (max-width: 760px) {
.skills-main { padding: 14px; }
+ .skills-page[data-skill-view="list"] .skills-main { padding: 14px 0; }
.skills-heading { align-items: start; flex-direction: column; }
.skills-heading-actions { width: 100%; }
.skills-heading-actions button { flex: 1; }
@@ -243,7 +250,7 @@ body:not([data-skill-view="list"]) .skills-main { padding-top: 20px; }
@media (max-width: 480px) {
.skills-topbar { gap: 8px; padding-inline: 12px; }
.skills-brand { min-width: 0; gap: 8px; }
- .skills-brand small { display: none; }
+ .skills-brand .product-brand-tagline { display: block; }
.skills-top-actions { gap: 6px; }
.skills-top-actions > button { padding-inline: 9px; }
}
diff --git a/skills.html b/skills.html
index 7dd706e..0d65eba 100644
--- a/skills.html
+++ b/skills.html
@@ -3,18 +3,18 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
- <title>创作 Skill 中心</title>
+ <title data-i18n="创作 Skill 中心">创作 Skill 中心</title>
<script src="theme-bootstrap.js"></script>
<link rel="stylesheet" href="ui-foundation.css" />
<link rel="stylesheet" href="library.css" />
<link rel="stylesheet" href="skills-page.css" />
</head>
- <body class="skills-page">
+ <body class="skills-page" data-skill-view="list">
<header class="skills-topbar">
- <a class="skills-brand" href="library.html"><img src="assets/icons/icon-source.svg" alt="" /><span><small>PromptDirector</small><strong data-i18n="创作 Skill">创作 Skill</strong></span></a>
+ <a class="skills-brand product-brand" href="library.html" aria-label="返回视觉创作灵感库" data-i18n-aria-label="返回视觉创作灵感库" title="返回视觉创作灵感库" data-i18n-title="返回视觉创作灵感库"><img class="product-brand-mark" src="assets/icons/icon-source.svg" alt="" /><span class="product-brand-copy"><strong class="product-brand-name">PromptDirector</strong><span class="product-brand-tagline" data-i18n="视觉创作灵感库">视觉创作灵感库</span></span></a>
<label class="skills-search"><span class="sr-only" data-i18n="搜索 Skill">搜索 Skill</span><input id="skill-search" type="search" placeholder="搜索调用名或说明" data-i18n-placeholder="搜索调用名或说明" /></label>
<div class="skills-top-actions">
- <button id="skill-context-back" class="button-secondary skill-context-back" type="button" aria-label="返回案例库" title="返回案例库"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-arrow-left"></use></svg><span>返回案例库</span></button>
+ <button id="skill-context-back" class="button-secondary skill-context-back" type="button" aria-label="返回案例库" title="返回案例库" data-i18n-aria-label="返回案例库" data-i18n-title="返回案例库"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-arrow-left"></use></svg><span data-i18n="返回案例库">返回案例库</span></button>
</div>
<input id="skill-zip-file" class="sr-only" type="file" accept=".zip,application/zip" />
<input id="skill-folder-files" class="sr-only" type="file" webkitdirectory multiple />
@@ -22,7 +22,7 @@
<main class="skills-main">
<section id="skill-library" class="skill-library">
- <div class="skills-heading"><div><h1 data-i18n="创作 Skill 中心">创作 Skill 中心</h1><p id="skill-summary"></p></div><div class="skills-heading-actions"><a class="button-secondary" href="curated-skills.html">精选 Skill</a><button id="skill-import" class="button-secondary" type="button" data-i18n="导入">导入</button><button id="skill-create" type="button" data-i18n="新建 Skill">新建 Skill</button></div></div>
+ <div class="skills-heading"><div><h1 data-i18n="创作 Skill 中心">创作 Skill 中心</h1><p id="skill-summary"></p></div><div class="skills-heading-actions"><a class="button-secondary" href="curated-skills.html" data-i18n="精选 Skill">精选 Skill</a><button id="skill-import" class="button-secondary" type="button" data-i18n="导入">导入</button><button id="skill-create" type="button" data-i18n="新建 Skill">新建 Skill</button></div></div>
<p id="skill-feedback" class="skill-feedback" role="status"></p>
<div id="skill-list" class="skill-grid"></div>
<div id="skill-empty" class="skill-empty" hidden><strong data-i18n="还没有创作 Skill">还没有创作 Skill</strong><p data-i18n="从你真正喜欢的案例中,按明确目标提炼一份可重复调用的方法。">从你真正喜欢的案例中,按明确目标提炼一份可重复调用的方法。</p><button id="skill-empty-create" type="button" data-i18n="创建第一份 Skill">创建第一份 Skill</button></div>
@@ -64,7 +64,7 @@
<div id="skill-builder" class="skill-builder">
<aside id="skill-source-sidebar" class="skill-source-sidebar">
<div class="skill-section-heading"><div><small>01</small><strong data-i18n="选择来源案例">选择来源案例</strong></div><span id="skill-selected-count">0</span></div>
- <div><span class="skill-field-label" data-i18n="按项目筛选">按项目筛选</span><details id="skill-project-picker" class="skill-project-picker"><summary><span id="skill-project-label" data-i18n="全部项目">全部项目</span><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-chevron-down"></use></svg></summary><div id="skill-project-filter" class="skill-project-filter" role="listbox" aria-label="按项目筛选"></div></details></div>
+ <div><span class="skill-field-label" data-i18n="按项目筛选">按项目筛选</span><details id="skill-project-picker" class="skill-project-picker"><summary><span id="skill-project-label" data-i18n="全部项目">全部项目</span><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-chevron-down"></use></svg></summary><div id="skill-project-filter" class="skill-project-filter" role="listbox" aria-label="按项目筛选" data-i18n-aria-label="按项目筛选"></div></details></div>
<label><span data-i18n="搜索案例">搜索案例</span><input id="skill-case-search" type="search" placeholder="搜索提示词或标题" data-i18n-placeholder="搜索提示词或标题" /></label>
<button id="skill-clear-selection" class="button-secondary" type="button" disabled data-i18n="清空全部案例">清空全部案例</button>
</aside>
@@ -132,7 +132,7 @@
<div id="skill-source-inspector-backdrop" class="skill-source-inspector-backdrop" hidden></div>
<aside id="skill-source-inspector" class="skill-source-inspector" hidden role="dialog" aria-modal="true" aria-labelledby="skill-source-inspector-title">
- <header><div><small data-i18n="精确选择">精确选择</small><h2 id="skill-source-inspector-title"></h2></div><button id="skill-source-inspector-close" class="icon-button" type="button" aria-label="关闭" title="关闭"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button></header>
+ <header><div><small data-i18n="精确选择">精确选择</small><h2 id="skill-source-inspector-title"></h2></div><button id="skill-source-inspector-close" class="icon-button" type="button" aria-label="关闭" title="关闭" data-i18n-aria-label="关闭" data-i18n-title="关闭"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button></header>
<div class="skill-source-inspector-actions"><button id="skill-source-select-all" class="button-secondary" type="button" data-i18n="全选可用内容">全选可用内容</button><button id="skill-source-clear" class="button-secondary" type="button" data-i18n="清空本案例">清空本案例</button></div>
<label id="skill-source-text-option" class="skill-source-text-option"><input id="skill-source-include-text" type="checkbox" /><span data-i18n="包含案例文字">包含案例文字</span></label>
<div id="skill-source-asset-list" class="skill-source-asset-list"></div>
@@ -140,24 +140,24 @@
</aside>
<dialog id="skill-import-dialog" class="skill-import-dialog">
- <header><h2 data-i18n="导入外部 Skill">导入外部 Skill</h2><button id="skill-import-close" class="icon-button" type="button" aria-label="关闭" data-i18n-aria-label="关闭" title="关闭"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button></header>
+ <header><h2 data-i18n="导入外部 Skill">导入外部 Skill</h2><button id="skill-import-close" class="icon-button" type="button" aria-label="关闭" data-i18n-aria-label="关闭" title="关闭" data-i18n-title="关闭"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button></header>
<p data-i18n="完整包会随私人备份保留;PromptDirector 只读取 SKILL.md 和 Markdown references,不执行脚本、程序、MCP 或二进制文件。">完整包会随私人备份保留;PromptDirector 只读取 SKILL.md 和 Markdown references,不执行脚本、程序、MCP 或二进制文件。</p>
<div><button id="skill-import-zip" type="button" data-i18n="选择 ZIP">选择 ZIP</button><button id="skill-import-folder" class="button-secondary" type="button" data-i18n="选择目录">选择目录</button></div>
</dialog>
<dialog id="skill-submission-dialog" class="skill-submission-dialog">
- <header><div><small>公开投稿</small><h2>投稿到精选 Skill</h2></div><button id="skill-submission-close" class="icon-button" type="button" aria-label="关闭" title="关闭"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button></header>
- <p>投稿与普通导出相互独立。这里只生成可公开审核的纯文本快照,不包含脚本、二进制文件或默认的私人来源记录。</p>
+ <header><div><small data-i18n="公开投稿">公开投稿</small><h2 data-i18n="投稿到精选 Skill">投稿到精选 Skill</h2></div><button id="skill-submission-close" class="icon-button" type="button" aria-label="关闭" title="关闭" data-i18n-aria-label="关闭" data-i18n-title="关闭"><svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><use href="assets/ui-icons.svg#icon-x"></use></svg></button></header>
+ <p data-i18n="投稿与普通导出相互独立。这里只生成可公开审核的纯文本快照,不包含脚本、二进制文件或默认的私人来源记录。">投稿与普通导出相互独立。这里只生成可公开审核的纯文本快照,不包含脚本、二进制文件或默认的私人来源记录。</p>
<div class="skill-submission-fields">
- <label><span>公开署名</span><input id="skill-submission-author" autocomplete="name" aria-describedby="skill-submission-author-error" /><small id="skill-submission-author-error" class="skill-submission-field-error" hidden></small></label>
- <label class="skill-submission-summary"><span>公开摘要</span><textarea id="skill-submission-summary" rows="3" aria-describedby="skill-submission-summary-error"></textarea><small id="skill-submission-summary-error" class="skill-submission-field-error" hidden></small></label>
- <label class="skill-submission-rights"><input id="skill-submission-rights" type="checkbox" aria-describedby="skill-submission-rights-error" /><span>允许其他用户在保留署名的前提下保存、使用和修改。</span></label>
+ <label><span data-i18n="公开署名">公开署名</span><input id="skill-submission-author" autocomplete="name" aria-describedby="skill-submission-author-error" /><small id="skill-submission-author-error" class="skill-submission-field-error" hidden></small></label>
+ <label class="skill-submission-summary"><span data-i18n="公开摘要">公开摘要</span><textarea id="skill-submission-summary" rows="3" aria-describedby="skill-submission-summary-error"></textarea><small id="skill-submission-summary-error" class="skill-submission-field-error" hidden></small></label>
+ <label class="skill-submission-rights"><input id="skill-submission-rights" type="checkbox" aria-describedby="skill-submission-rights-error" /><span data-i18n="允许其他用户在保留署名的前提下保存、使用和修改。">允许其他用户在保留署名的前提下保存、使用和修改。</span></label>
<small id="skill-submission-rights-error" class="skill-submission-field-error skill-submission-rights-error" hidden></small>
- <details class="skill-submission-license-details"><summary>了解公开使用规则</summary><p>投稿采用 CC BY 4.0:其他用户必须保留你的公开署名,并可保存、使用和修改这份 Skill。</p></details>
+ <details class="skill-submission-license-details"><summary data-i18n="了解公开使用规则">了解公开使用规则</summary><p data-i18n="投稿采用 CC BY 4.0:其他用户必须保留你的公开署名,并可保存、使用和修改这份 Skill。">投稿采用 CC BY 4.0:其他用户必须保留你的公开署名,并可保存、使用和修改这份 Skill。</p></details>
</div>
- <div class="skill-submission-actions"><button id="skill-submission-refresh" class="button-secondary" type="button">生成并检查公开快照</button><button id="skill-submission-open" type="button" disabled>下载投稿包并打开 GitHub</button></div>
+ <div class="skill-submission-actions"><button id="skill-submission-refresh" class="button-secondary" type="button" data-i18n="生成并检查公开快照">生成并检查公开快照</button><button id="skill-submission-open" type="button" disabled data-i18n="下载投稿包并打开 GitHub">下载投稿包并打开 GitHub</button></div>
<p id="skill-submission-feedback" class="skill-feedback" role="status"></p>
- <section id="skill-submission-findings" class="skill-submission-findings" hidden><h3>需要先处理的隐私风险</h3><ul></ul></section>
- <section class="skill-submission-preview-shell"><h3>最终投稿文件与全文</h3><div id="skill-submission-preview" class="skill-submission-preview"></div></section>
+ <section id="skill-submission-findings" class="skill-submission-findings" hidden><h3 data-i18n="需要先处理的隐私风险">需要先处理的隐私风险</h3><ul></ul></section>
+ <section class="skill-submission-preview-shell"><h3 data-i18n="最终投稿文件与全文">最终投稿文件与全文</h3><div id="skill-submission-preview" class="skill-submission-preview"></div></section>
</dialog>
<script type="module" src="skills-page.js"></script>
</body>
diff --git a/stable-masonry.js b/stable-masonry.js
index b298a23..37b26f5 100644
--- a/stable-masonry.js
+++ b/stable-masonry.js
@@ -13,6 +13,7 @@ export function createStableMasonry(container, options = {}) {
let anchorTimer = 0;
let cardResizeFrame = 0;
let resizeFrame = 0;
+ let widthCommitFrame = 0;
let dependencyFrame = 0;
let scrollFrame = 0;
let viewportAnchor = null;
@@ -96,7 +97,10 @@ export function createStableMasonry(container, options = {}) {
const scheduleReflow = () => {
const width = container.clientWidth;
if (!geometry || Math.abs(width - geometry.containerWidth) <= 1) return;
- if (isScrollbarWidthChange(container, geometry, scrollContainer)) return;
+ if (isScrollbarWidthChange(container, geometry, scrollContainer)) {
+ scheduleCommittedWidthCheck();
+ return;
+ }
if (!resizeGestureAnchor?.card?.isConnected) resizeGestureAnchor = null;
// CSS responds before the resize event is delivered. Prefer the anchor captured
// by the preceding scroll event so header wrapping cannot redefine the user's
@@ -136,11 +140,13 @@ export function createStableMasonry(container, options = {}) {
if (anchorTimer) clearTimeout(anchorTimer);
cancelCardResize();
if (resizeFrame) cancelAnimationFrame(resizeFrame);
+ if (widthCommitFrame) cancelAnimationFrame(widthCommitFrame);
if (dependencyFrame) cancelAnimationFrame(dependencyFrame);
if (scrollFrame) cancelAnimationFrame(scrollFrame);
anchorFrame = 0;
anchorTimer = 0;
resizeFrame = 0;
+ widthCommitFrame = 0;
dependencyFrame = 0;
scrollFrame = 0;
cardObserver.disconnect();
@@ -151,7 +157,9 @@ export function createStableMasonry(container, options = {}) {
scheduledResizeAnchor = null;
resizeGestureAnchor = null;
delete container.dataset.masonryAnchorEntryId;
- container.style.height = "0px";
+ // Keep the committed height until the replacement layout is ready. Collapsing
+ // the wall here can temporarily remove the page scrollbar and make the next
+ // width measurement wider than the width that will actually contain the cards.
}
function append(cards) {
@@ -162,11 +170,16 @@ export function createStableMasonry(container, options = {}) {
}
flushCardResizes();
const widthChanged = Math.abs(container.clientWidth - geometry.containerWidth) > 1;
- if (widthChanged && cardMetadata.size && !isScrollbarWidthChange(container, geometry, scrollContainer)) reflowAll({ preserveAnchor: true });
- else if (widthChanged) geometry = readGeometry(container, scrollContainer);
+ if (widthChanged && cardMetadata.size) {
+ if (isScrollbarWidthChange(container, geometry, scrollContainer)) scheduleCommittedWidthCheck();
+ else reflowAll({ preserveAnchor: true });
+ } else if (widthChanged) {
+ geometry = readGeometry(container, scrollContainer);
+ }
for (const card of cards) placeCard(card);
updateContainerHeight();
+ scheduleCommittedWidthCheck();
}
function destroy() {
@@ -174,6 +187,7 @@ export function createStableMasonry(container, options = {}) {
if (anchorTimer) clearTimeout(anchorTimer);
cancelCardResize();
if (resizeFrame) cancelAnimationFrame(resizeFrame);
+ if (widthCommitFrame) cancelAnimationFrame(widthCommitFrame);
if (dependencyFrame) cancelAnimationFrame(dependencyFrame);
if (scrollFrame) cancelAnimationFrame(scrollFrame);
cardObserver.disconnect();
@@ -223,7 +237,7 @@ export function createStableMasonry(container, options = {}) {
cardObserver.observe(card);
}
- function reflowAll({ preserveAnchor = false, anchorOverride = null } = {}) {
+ function reflowAll({ preserveAnchor = false, anchorOverride = null, verifyCommittedWidth = true } = {}) {
if (anchorFrame) cancelAnimationFrame(anchorFrame);
if (anchorTimer) clearTimeout(anchorTimer);
cancelCardResize();
@@ -237,6 +251,7 @@ export function createStableMasonry(container, options = {}) {
columns = Array.from({ length: geometry.columnCount }, () => []);
for (const card of cards) placeCard(card);
updateContainerHeight();
+ if (verifyCommittedWidth) scheduleCommittedWidthCheck();
restoreTrackedScrollAnchor(anchor);
anchorFrame = requestAnimationFrame(() => {
restoreTrackedScrollAnchor(anchor);
@@ -260,6 +275,16 @@ export function createStableMasonry(container, options = {}) {
pendingCardResizeAnchor = null;
}
+ function scheduleCommittedWidthCheck() {
+ if (!geometry || Math.abs(container.clientWidth - geometry.containerWidth) <= 1) return;
+ if (widthCommitFrame) cancelAnimationFrame(widthCommitFrame);
+ widthCommitFrame = requestAnimationFrame(() => {
+ widthCommitFrame = 0;
+ if (!geometry || Math.abs(container.clientWidth - geometry.containerWidth) <= 1) return;
+ reflowAll({ preserveAnchor: true, verifyCommittedWidth: false });
+ });
+ }
+
function flushCardResizes() {
if (!pendingCardResizeColumns.size) return;
const changedColumns = [...pendingCardResizeColumns];
diff --git a/store/LISTING_EN.md b/store/LISTING_EN.md
index 5934a8a..9057e7a 100644
--- a/store/LISTING_EN.md
+++ b/store/LISTING_EN.md
@@ -2,7 +2,7 @@
## Name
-PromptDirector — Visual Creative Archive
+PromptDirector
## Short description
@@ -10,7 +10,7 @@ Save web visuals, prompts, and creative references together for reuse.
## Detailed description
-PromptDirector is a local-first creative reference library for AI image and video creators, filmmakers, art directors, photographers, illustrators, and designers.
+PromptDirector, your private visual inspiration library. It is local-first and built for AI image and video creators, filmmakers, art directors, photographers, illustrators, and designers.
Use it to:
diff --git a/store/LISTING_ZH_CN.md b/store/LISTING_ZH_CN.md
index 6bbd03b..0f9d73c 100644
--- a/store/LISTING_ZH_CN.md
+++ b/store/LISTING_ZH_CN.md
@@ -2,7 +2,7 @@
## 名称
-提示词导演 - 视觉创作资料库
+PromptDirector
## 一句话说明
@@ -10,7 +10,7 @@
## 详细说明
-提示词导演是本地优先的视觉创作资料库,适用于 AI 图片、AI 视频、广告、影视分镜、摄影、插画和设计参考。
+提示词导演,你的视觉创作私人灵感库。它采用本地优先方式,适用于 AI 图片、AI 视频、广告、影视分镜、摄影、插画和设计参考。
你可以:
diff --git a/tag-editor.js b/tag-editor.js
index 8467997..26de49c 100644
--- a/tag-editor.js
+++ b/tag-editor.js
@@ -1,3 +1,5 @@
+import { t } from "./i18n.js";
+
export function normalizeTagValue(value) {
return String(value ?? "").normalize("NFKC")
.replace(/[\u0000-\u001f\u007f]/gu, "")
@@ -38,12 +40,12 @@ export function createTagEditor(options = {}) {
const input = document.createElement("input");
input.type = "text";
input.autocomplete = "off";
- input.placeholder = options.placeholder || "输入标签,按回车或逗号添加";
- input.setAttribute("aria-label", options.inputLabel || "添加标签");
+ input.placeholder = options.placeholder || t("输入标签,按回车或逗号添加");
+ input.setAttribute("aria-label", options.inputLabel || t("添加标签"));
const add = document.createElement("button");
add.type = "button";
add.className = "button-secondary";
- add.textContent = options.addLabel || "添加";
+ add.textContent = options.addLabel || t("添加");
row.append(input, add);
root.append(chips, row);
@@ -61,7 +63,7 @@ export function createTagEditor(options = {}) {
const remove = document.createElement("button");
remove.type = "button";
remove.textContent = "×";
- remove.setAttribute("aria-label", `删除标签:${value}`);
+ remove.setAttribute("aria-label", t("删除标签:{value}", { value }));
remove.addEventListener("click", () => void applyValues(values.filter((item) => item !== value), remove));
chip.append(text, remove);
return chip;
diff --git a/test/ai_provider_registry_e2e.py b/test/ai_provider_registry_e2e.py
index 48758e2..592e65f 100644
--- a/test/ai_provider_registry_e2e.py
+++ b/test/ai_provider_registry_e2e.py
@@ -533,6 +533,10 @@ def main() -> None:
"after": saved_preferences["aiTaskAssignments"],
}
+ library.wait_for_function(
+ """() => chrome.runtime.sendMessage({type: 'GET_AI_TASK_RUNTIME', taskId: 'imageAnalysis'})
+ .then(runtime => runtime.assignment?.evidence === 'manual_unverified')"""
+ )
image_runtime = library.evaluate("() => chrome.runtime.sendMessage({type: 'GET_AI_TASK_RUNTIME', taskId: 'imageAnalysis'})")
assert image_runtime["ok"] is True, image_runtime
assert assignment_routes({"imageAnalysis": image_runtime["assignment"]})["imageAnalysis"] == {
diff --git a/test/brand_i18n_e2e.py b/test/brand_i18n_e2e.py
new file mode 100644
index 0000000..dfd37c8
--- /dev/null
+++ b/test/brand_i18n_e2e.py
@@ -0,0 +1,145 @@
+from __future__ import annotations
+
+import re
+
+from playwright.sync_api import expect
+
+from e2e_support import extension_session
+
+
+PRODUCT_PAGES = (
+ "library.html",
+ "composer.html",
+ "skills.html",
+ "curated.html",
+ "curated-skills.html",
+ "collector.html",
+)
+CHINESE = re.compile(r"[\u3400-\u9fff]")
+
+
+def assert_no_visible_chinese(locator, state: str) -> None:
+ lines = sorted({line.strip() for line in locator.inner_text().splitlines() if CHINESE.search(line)})
+ assert not lines, (state, lines)
+
+
+def main() -> None:
+ with extension_session("prompt-director-brand-i18n-", viewport={"width": 390, "height": 844}) as session:
+ setup = session.open_page("collector.html", wait_until="networkidle")
+ session.seed_storage(setup, {
+ "schemaVersion": 24,
+ "entries": [],
+ "settings": {"libraryTitle": "视觉创作灵感库"},
+ "uiPreferences": {"locale": "en", "theme": "dark", "motion": "reduced"},
+ })
+ setup.close()
+
+ visible_chinese = {}
+ for path in PRODUCT_PAGES:
+ page = session.open_page(path, wait_until="networkidle")
+ expect(page.locator("html")).to_have_attribute("lang", "en")
+ if path == "composer.html":
+ page.locator("#composer-shell").evaluate("node => node.classList.add('nav-open')")
+ page.wait_for_timeout(250)
+ brand = page.locator(".product-brand").first
+ expect(brand).to_be_visible()
+ expect(brand.locator(".product-brand-name")).to_have_text("PromptDirector")
+ expect(brand.locator(".product-brand-tagline")).to_have_text("Visual Inspiration Library")
+ metrics = brand.evaluate(
+ """node => {
+ const rect = node.getBoundingClientRect();
+ const name = node.querySelector('.product-brand-name');
+ const tagline = node.querySelector('.product-brand-tagline');
+ return {
+ left: rect.left,
+ right: rect.right,
+ viewport: innerWidth,
+ nameWhiteSpace: getComputedStyle(name).whiteSpace,
+ taglineWhiteSpace: getComputedStyle(tagline).whiteSpace,
+ nameHeight: name.getBoundingClientRect().height,
+ taglineHeight: tagline.getBoundingClientRect().height,
+ nameLineHeight: parseFloat(getComputedStyle(name).lineHeight),
+ taglineLineHeight: parseFloat(getComputedStyle(tagline).lineHeight),
+ nameClientWidth: name.clientWidth,
+ nameScrollWidth: name.scrollWidth,
+ taglineClientWidth: tagline.clientWidth,
+ taglineScrollWidth: tagline.scrollWidth,
+ };
+ }"""
+ )
+ assert metrics["left"] >= 0 and metrics["right"] <= metrics["viewport"] + 1, (path, metrics)
+ assert metrics["nameWhiteSpace"] == "nowrap" and metrics["taglineWhiteSpace"] == "nowrap", (path, metrics)
+ assert metrics["nameHeight"] <= metrics["nameLineHeight"] + 1, (path, metrics)
+ assert metrics["taglineHeight"] <= metrics["taglineLineHeight"] + 1, (path, metrics)
+ assert metrics["nameScrollWidth"] <= metrics["nameClientWidth"] + 1, (path, metrics)
+ assert metrics["taglineScrollWidth"] <= metrics["taglineClientWidth"] + 1, (path, metrics)
+ if path in {"library.html", "composer.html", "skills.html", "collector.html"}:
+ matches = sorted({line.strip() for line in page.locator("body").inner_text().splitlines() if CHINESE.search(line)})
+ if matches:
+ visible_chinese[path] = matches
+ page.close()
+
+ assert not visible_chinese, visible_chinese
+
+ collector = session.open_page("collector.html", wait_until="networkidle")
+ collector.set_viewport_size({"width": 372, "height": 800})
+ collector.evaluate(
+ """async () => chrome.runtime.sendMessage({
+ type: 'UPDATE_CAPTURE_DRAFT',
+ draft: {
+ title: 'English draft',
+ fragments: [{id: 'fragment-en', text: 'A captured paragraph.', sourceUrl: 'https://fixture.invalid/source', sourceTitle: 'English source'}],
+ visuals: []
+ }
+ })"""
+ )
+ collector.reload(wait_until="networkidle")
+ expect(collector.locator("#content-summary")).to_have_text("1 text excerpt")
+ expect(collector.locator("#save-draft")).to_have_text("Save case")
+ expect(collector.locator("#capture-collection option").first).to_have_text("No project")
+ assert_no_visible_chinese(collector.locator("body"), "collector text draft at 372px")
+ assert collector.evaluate("() => document.documentElement.scrollWidth <= document.documentElement.clientWidth + 1")
+
+ worker = session.context.service_workers[0]
+ worker.evaluate("() => chrome.runtime.sendMessage({type: 'REGION_CAPTURE_CHANGED', sessionId: 'region-en', phase: 'selecting'})")
+ expect(collector.locator("#region-capture-status")).to_be_visible()
+ expect(collector.locator("#region-capture-title")).to_have_text("Region capture is active. Drag on the page to select an area; press Esc to cancel.")
+ assert_no_visible_chinese(collector.locator("#region-capture-status"), "collector region state")
+ worker.evaluate("() => chrome.runtime.sendMessage({type: 'REGION_CAPTURE_CHANGED', sessionId: 'region-en', phase: 'cancelled'})")
+
+ collector.locator("#discard-draft").click()
+ dialog = collector.locator("#promptdirector-app-dialog")
+ expect(dialog.get_by_role("heading")).to_have_text("Clear unsaved content?")
+ assert_no_visible_chinese(dialog, "collector clear dialog")
+ dialog.get_by_role("button", name="Clear", exact=True).click()
+ expect(collector.locator("#feedback")).to_have_text("Unsaved content cleared")
+ collector.close()
+
+ for width in (320, 390, 640, 1440):
+ curated = session.open_page("curated.html", wait_until="networkidle")
+ curated.set_viewport_size({"width": width, "height": 800})
+ metrics = curated.evaluate(
+ """() => {
+ const header = document.querySelector('.curated-header').getBoundingClientRect();
+ const controls = [...document.querySelectorAll('.curated-header-tools, .curated-header-tools > *, .page-back-action')]
+ .filter(node => getComputedStyle(node).display !== 'none')
+ .map(node => ({name: node.className, rect: node.getBoundingClientRect().toJSON()}));
+ return {
+ header: header.toJSON(), controls,
+ viewport: innerWidth,
+ overflow: document.documentElement.scrollWidth - document.documentElement.clientWidth
+ };
+ }"""
+ )
+ assert metrics["overflow"] <= 1, (width, metrics)
+ for control in metrics["controls"]:
+ rect = control["rect"]
+ assert rect["left"] >= metrics["header"]["left"] - 1, (width, control, metrics)
+ assert rect["right"] <= metrics["header"]["right"] + 1, (width, control, metrics)
+ curated.close()
+
+ print({"brand_pages": len(PRODUCT_PAGES), "viewport": 390, "collector_dynamic_states": 3, "curated_widths": 4, "visible_chinese": False})
+
+
+if __name__ == "__main__":
+ main()
diff --git a/test/browse-frame.test.js b/test/browse-frame.test.js
new file mode 100644
index 0000000..9afc6f3
--- /dev/null
+++ b/test/browse-frame.test.js
@@ -0,0 +1,48 @@
+import test from "node:test";
+import assert from "node:assert/strict";
+import { readFile } from "node:fs/promises";
+
+async function sources() {
+ const [curatedHtml, curatedSkillsHtml, skillsHtml, curatedCss, skillsCss, foundation, libraryCss] = await Promise.all([
+ readFile(new URL("../curated.html", import.meta.url), "utf8"),
+ readFile(new URL("../curated-skills.html", import.meta.url), "utf8"),
+ readFile(new URL("../skills.html", import.meta.url), "utf8"),
+ readFile(new URL("../curated.css", import.meta.url), "utf8"),
+ readFile(new URL("../skills-page.css", import.meta.url), "utf8"),
+ readFile(new URL("../ui-foundation.css", import.meta.url), "utf8"),
+ readFile(new URL("../library.css", import.meta.url), "utf8")
+ ]);
+ return { curatedHtml, curatedSkillsHtml, skillsHtml, curatedCss, skillsCss, foundation, libraryCss };
+}
+
+test("discovery pages keep the visible back action and add a logo shortcut to the library", async () => {
+ const { curatedHtml, curatedSkillsHtml, skillsHtml } = await sources();
+ for (const html of [curatedHtml, curatedSkillsHtml]) {
+ assert.match(html, /class="curated-brand-home product-brand" href="library\.html" aria-label="返回视觉创作灵感库"/);
+ assert.match(html, /class="product-brand-name">PromptDirector<\/strong><span class="product-brand-tagline" data-i18n="视觉创作灵感库"/);
+ assert.match(html, /id="return-library"/);
+ }
+ assert.match(skillsHtml, /class="skills-brand product-brand" href="library\.html" aria-label="返回视觉创作灵感库"/);
+ assert.match(skillsHtml, /class="product-brand-name">PromptDirector<\/strong><span class="product-brand-tagline" data-i18n="视觉创作灵感库"/);
+ assert.match(skillsHtml, /id="skill-context-back"/);
+});
+
+test("curated cases and the Skill list share one stable responsive frame", async () => {
+ const { curatedCss, skillsCss, foundation } = await sources();
+ assert.match(foundation, /--ui-browse-max-width:\s*1500px/);
+ assert.match(foundation, /--ui-browse-gutter:\s*max\(12px,/);
+ assert.match(curatedCss, /min-height:\s*64px;[^}]*padding:\s*10px var\(--ui-browse-gutter\)/);
+ assert.match(skillsCss, /min-height:\s*64px;[^}]*padding:\s*10px var\(--ui-browse-gutter\)/);
+ assert.match(skillsCss, /\.skills-topbar\s*\{[^}]*min-width:\s*0;/);
+ assert.match(skillsCss, /\.skills-search\s*\{\s*min-width:\s*0;/);
+ assert.match(curatedCss, /grid-template-areas:\s*"title search actions"/);
+ assert.match(curatedCss, /grid-template-areas:\s*"title back" "search search" "tools tools"/);
+ assert.match(skillsCss, /\.skills-search\s*\{\s*grid-column:\s*1 \/ -1;\s*grid-row:\s*2;/);
+ assert.match(curatedCss, /\.curated-status-bar\s*\{\s*position:\s*static;/);
+});
+
+test("the shared product lockup stays fully visible on one line and keeps its mobile grid slot", async () => {
+ const { foundation, libraryCss } = await sources();
+ assert.match(foundation, /\.product-brand-name,\s*\.product-brand-tagline\s*\{[^}]*overflow:\s*visible;[^}]*text-overflow:\s*clip;[^}]*white-space:\s*nowrap;/);
+ assert.match(libraryCss, /grid-template-areas:\s*"toggle brand actions" "search search search";/);
+});
diff --git a/test/capture-permission-flow.test.js b/test/capture-permission-flow.test.js
index 48f8bcd..2328e95 100644
--- a/test/capture-permission-flow.test.js
+++ b/test/capture-permission-flow.test.js
@@ -215,16 +215,16 @@ test("first-use capture onboarding can omit clipboard without adding another req
assert.deepEqual(requests, [{ origins: [...CONTINUOUS_CAPTURE_ORIGINS] }]);
});
-test("collector explains every first-use capability and resumes only the pending capture action", async () => {
+test("collector presents one compact first-use authorization and resumes only the pending capture action", async () => {
const [source, html] = await Promise.all([
readFile(new URL("collector.js", projectRoot), "utf8"),
readFile(new URL("collector.html", projectRoot), "utf8")
]);
assert.match(html, /id="capture-permission-onboarding"/);
- assert.match(html, /网页采集/);
- assert.match(html, /截图/);
+ assert.match(html, /一次授权,之后直接采集/);
+ assert.match(html, /统一开启网页读取与截图能力/);
assert.match(html, /id="capture-permission-clipboard"[^>]*checked/);
- assert.match(html, /打开侧栏、点击网页或高亮文字都不会读取剪贴板/);
+ assert.match(html, /仅在你主动点击“提取文字\/图片”且网页没有高亮内容时读取/);
assert.match(html, /不会自动保存案例/);
assert.match(source, /pendingCaptureAction = \{ action, permissionStatus \}/);
assert.match(source, /await pending\.action\(\{ clipboardPreferenceJustDeclined: !includeClipboard \}\)/);
diff --git a/test/case-management-ui.test.js b/test/case-management-ui.test.js
index fadf902..4b04a05 100644
--- a/test/case-management-ui.test.js
+++ b/test/case-management-ui.test.js
@@ -20,6 +20,10 @@ test("selection mode exposes all filtered results, user tags, projects, sharing,
"share-export",
"selection-trash"
]) assert.match(bar, new RegExp(`id="${id}"`));
+ assert.match(bar, /id="selection-selected-actions"[^>]*hidden/);
+ assert.match(bar, /id="selection-label-menu"[\s\S]*id="selection-label-input"[\s\S]*id="selection-add-labels"/);
+ assert.match(bar, /id="selection-project-menu"[\s\S]*id="selection-project-target"[\s\S]*id="selection-new-project"/);
+ assert.match(bar, /id="selection-more-menu"[\s\S]*id="selection-combine"[\s\S]*id="selection-analyze"[\s\S]*id="selection-trash"/);
const selectAll = source.slice(source.indexOf("function selectAllFilteredCases"), source.indexOf("function clearSelectedCases"));
assert.match(selectAll, /visibleEntries\.map\(\(entry\) => entry\.id\)/);
@@ -30,6 +34,8 @@ test("selection mode exposes all filtered results, user tags, projects, sharing,
assert.match(source, /LIBRARY_BATCH_ACTIONS\.addCustomLabels/);
assert.match(source, /LIBRARY_BATCH_ACTIONS\.setProject/);
assert.match(source, /LIBRARY_BATCH_ACTIONS\.moveToTrash/);
+ assert.match(source, /elements\.selectionSelectFiltered\.hidden = selectedCaseIds\.size > 0/);
+ assert.match(source, /elements\.selectionSelectedActions\.hidden = selectedCaseIds\.size === 0/);
});
test("recycle bin is a first-class workspace action with restore and explicit permanent cleanup", () => {
diff --git a/test/chrome-store-manifest.test.js b/test/chrome-store-manifest.test.js
index 831349c..cbcf8b9 100644
--- a/test/chrome-store-manifest.test.js
+++ b/test/chrome-store-manifest.test.js
@@ -5,11 +5,11 @@ import { validateChromeStoreManifest } from "../tools/chrome-store-manifest.mjs"
const locales = {
zh_CN: {
- extensionName: { message: "提示词导演 - 视觉提示词灵感库" },
+ extensionName: { message: "PromptDirector" },
extensionDescription: { message: "收藏网页画面与提示词。" }
},
en: {
- extensionName: { message: "PromptDirector — Visual Creative Archive" },
+ extensionName: { message: "PromptDirector" },
extensionDescription: { message: "Save web visuals with their prompts." }
}
};
@@ -37,7 +37,7 @@ test("localized short names cannot exceed Chrome's twelve-character limit", () =
},
locales: {
...locales,
- en: { ...locales.en, extensionShortName: { message: "Visual Prompt Archive" } },
+ en: { ...locales.en, extensionShortName: { message: "Visual Inspiration Library" } },
zh_CN: { ...locales.zh_CN, extensionShortName: { message: "提示词导演" } }
}
}), /short_name.*12/);
diff --git a/test/collector-view.test.js b/test/collector-view.test.js
index 13f897c..21f83f3 100644
--- a/test/collector-view.test.js
+++ b/test/collector-view.test.js
@@ -70,7 +70,7 @@ test("page capture replaces failed remote thumbnails with an explicit unavailabl
assert.match(pageCaptureRenderer, /preview\.replaceChildren\(textNode\("span", t\("预览不可用"\)\)\)/);
assert.match(pageCaptureRenderer, /pageCaptureMediaSourceLabel\(media\.sourceKind, media\.captureMethod\)/);
const collectorHtml = await readFile(new URL("../collector.html", import.meta.url), "utf8");
- assert.match(collectorHtml, /公开原图失败时,只会使用当前网页已有登录状态读取已确认主体内的相关媒体;不会读取或保存登录信息。/);
+ assert.match(collectorHtml, /id="page-capture-help"[^>]*>确认一个主体后即可保存/);
});
test("page capture uses the final save as media authorization and keeps uncertain media separate", async () => {
@@ -99,6 +99,7 @@ test("page capture uses the final save as media authorization and keeps uncertai
assert.match(collectorHtml, /id="page-capture-save-text-only"/);
assert.match(collectorHtml, /id="page-capture-media-viewer"/);
assert.match(collectorHtml, /id="page-capture-media-stage"/);
+ assert.match(pageCaptureRenderer, /page-capture-preview-details/);
assert.doesNotMatch(collectorHtml, /page-capture-select-text|page-capture-select-images/);
assert.match(backgroundSource, /case "PREVIEW_PAGE_CAPTURE_REGION"/);
assert.match(backgroundSource, /previewPageCaptureRegion/);
@@ -158,6 +159,16 @@ test("continuing an existing case keeps the target explicit at the final action"
assert.equal(view.saveLabel, "保存到这个案例");
});
+test("collector translates only built-in capture content types", async () => {
+ const [collectorSource, backgroundSource] = await Promise.all([
+ readFile(new URL("../collector.js", import.meta.url), "utf8"),
+ readFile(new URL("../background.js", import.meta.url), "utf8")
+ ]);
+ assert.match(collectorSource, /item\.customized \? item\.name : t\(item\.name\)/);
+ assert.match(collectorSource, /partContentType\?\.customized \? partContentType\.name : t\(partContentType\?\.name \|\| "待确认"\)/);
+ assert.match(backgroundSource, /customized: item\.customized === true/);
+});
+
test("the collector auto-reads only highlights and reserves clipboard access for the extract buttons", async () => {
const [collectorSource, collectorHtml, backgroundSource] = await Promise.all([
readFile(new URL("../collector.js", import.meta.url), "utf8"),
diff --git a/test/composer-page.test.js b/test/composer-page.test.js
index db7f238..1faf6d5 100644
--- a/test/composer-page.test.js
+++ b/test/composer-page.test.js
@@ -114,7 +114,7 @@ test("composer reference selection is visual while Skill management stays on its
assert.match(generationSettings, /generationParameterKey\(capability, \["size", "aspectRatio"\]\)/);
assert.match(generationSettings, /generationParameterKey\(capability, \["quality", "imageSize"\]\)/);
assert.match(generationSettings, /field\.dataset\.parameterKey = key/);
- assert.match(generationSettings, /label\.textContent = t\(parameter\?\.label \|\| fallbackLabel\)/);
+ assert.match(generationSettings, /label\.textContent = translateUiMessage\(parameter\?\.label \|\| fallbackLabel\)/);
const updateGenerationParameters = composerJs.slice(
composerJs.indexOf("async function updateImageGenerationParameters"),
composerJs.indexOf("async function updateComposerPreferences")
diff --git a/test/composer_session_layout_e2e.py b/test/composer_session_layout_e2e.py
index 12130dd..8bdec8b 100644
--- a/test/composer_session_layout_e2e.py
+++ b/test/composer_session_layout_e2e.py
@@ -73,11 +73,37 @@ def main() -> None:
expect(composer.locator(".composer-session-group-label")).to_have_text(["今天", "昨天", "近 7 天", "更早"])
long_title = composer.locator('.composer-session-item[data-session-id="layout-session-0"] strong')
assert long_title.evaluate("node => node.scrollWidth > node.clientWidth")
+ session_alignment = composer.locator('.composer-session-item[data-session-id="layout-session-0"] > button:first-child').evaluate(
+ """node => {
+ const button = node.getBoundingClientRect();
+ const title = node.querySelector('strong').getBoundingClientRect();
+ const style = getComputedStyle(node);
+ return {justifyContent: style.justifyContent, textAlign: style.textAlign, buttonLeft: button.left, titleLeft: title.left, paddingLeft: parseFloat(style.paddingLeft)};
+ }"""
+ )
+ assert session_alignment["justifyContent"] in {"start", "flex-start"}, session_alignment
+ assert session_alignment["textAlign"] == "left", session_alignment
+ assert abs(session_alignment["titleLeft"] - session_alignment["buttonLeft"] - session_alignment["paddingLeft"]) <= 1, session_alignment
menu = composer.locator('.composer-session-item[data-session-id="layout-session-1"] .composer-session-menu')
menu.locator("xpath=..").hover()
menu.locator("summary").click()
- expect(menu.get_by_role("menuitem", name="删除", exact=True)).to_be_visible()
- menu.get_by_role("menuitem", name="删除", exact=True).click()
+ delete_item = menu.get_by_role("menuitem", name="删除", exact=True)
+ expect(delete_item).to_be_visible()
+ delete_metrics = delete_item.evaluate(
+ """node => {
+ const action = node.getBoundingClientRect();
+ const panel = node.closest('.composer-session-menu-panel').getBoundingClientRect();
+ const style = getComputedStyle(node);
+ return {actionHeight: action.height, panelWidth: panel.width, color: style.color, background: style.backgroundColor, danger: getComputedStyle(document.documentElement).getPropertyValue('--ui-danger').trim()};
+ }"""
+ )
+ assert abs(delete_metrics["actionHeight"] - 30) <= 1, delete_metrics
+ assert 84 <= delete_metrics["panelWidth"] <= 96, delete_metrics
+ assert delete_metrics["background"] == "rgba(0, 0, 0, 0)", delete_metrics
+ delete_item.hover()
+ hovered_background = delete_item.evaluate("node => getComputedStyle(node).backgroundColor")
+ assert hovered_background != "rgba(0, 0, 0, 0)", hovered_background
+ delete_item.click()
delete_dialog = composer.locator("#promptdirector-app-dialog")
expect(delete_dialog).to_contain_text("删除这段对话?")
delete_dialog.get_by_role("button", name="取消", exact=True).click()
diff --git a/test/creative_feedback_e2e.py b/test/creative_feedback_e2e.py
index d74230b..9e8716c 100644
--- a/test/creative_feedback_e2e.py
+++ b/test/creative_feedback_e2e.py
@@ -88,15 +88,16 @@ def main() -> None:
pageWidth: document.documentElement.scrollWidth,
smart: {height: smart.height, top: smart.top, right: smart.right},
text: {height: text.height, top: text.top, right: text.right},
- backup: {height: backup.height, right: backup.right},
+ backup: {height: backup.height, top: backup.top, right: backup.right},
};
}"""
)
assert normal_geometry["pageWidth"] == 390
- assert normal_geometry["smart"]["height"] == 52
- assert normal_geometry["text"]["height"] == 52
- assert normal_geometry["smart"]["top"] == normal_geometry["text"]["top"]
+ assert normal_geometry["smart"]["height"] == 58
+ assert normal_geometry["text"]["height"] == 58
+ assert normal_geometry["text"]["top"] >= normal_geometry["smart"]["top"] + normal_geometry["smart"]["height"]
assert normal_geometry["backup"]["height"] == 30, normal_geometry
+ assert normal_geometry["backup"]["top"] >= normal_geometry["text"]["top"] + normal_geometry["text"]["height"]
assert max(normal_geometry[key]["right"] for key in ("smart", "text", "backup")) <= 390
collector.screenshot(path=str(screenshots / "promptdirector-step5-collector-normal.png"), full_page=True)
diff --git a/test/curated-skill-navigation.test.js b/test/curated-skill-navigation.test.js
index 9ee873c..51b1084 100644
--- a/test/curated-skill-navigation.test.js
+++ b/test/curated-skill-navigation.test.js
@@ -23,7 +23,7 @@ test("curated cases and curated Skills are independent sibling pages", async ()
assert.match(skillsHtml, /aria-current="page"[^>]*>精选 Skill</);
assert.match(skillsHtml, /id="return-library"/);
assert.match(skillsHtml, /src="curated-skill-page\.js"/);
- assert.match(skillsCenter, /href="curated-skills\.html">精选 Skill</);
+ assert.match(skillsCenter, /href="curated-skills\.html"[^>]*>精选 Skill</);
});
test("ordinary lossless export and curated submission are separate Skill detail actions", async () => {
diff --git a/test/curated_workflow_e2e.py b/test/curated_workflow_e2e.py
index f44eb2c..6782c0d 100644
--- a/test/curated_workflow_e2e.py
+++ b/test/curated_workflow_e2e.py
@@ -322,7 +322,7 @@ def main() -> None:
localStorage.setItem('promptDirectorMotion', 'reduced');
}""")
curated.reload(wait_until="networkidle")
- expect(curated.locator(".curated-header h1")).to_have_text("Curated cases")
+ expect(curated.locator('.curated-sections [aria-current="page"]')).to_have_text("Curated cases")
expect(curated.locator("#curated-search")).to_have_attribute("placeholder", "Search packs or cases")
expect(curated.locator("#return-library")).to_have_text("Back to library")
diff --git a/test/custom-select-ui.test.js b/test/custom-select-ui.test.js
index d91f8b0..4641332 100644
--- a/test/custom-select-ui.test.js
+++ b/test/custom-select-ui.test.js
@@ -12,7 +12,8 @@ test("Chrome 134 customizable selects use the shared PromptDirector surface", ()
assert.equal(JSON.parse(manifest).minimum_chrome_version, "134");
assert.match(foundation, /select,\s*select::picker\(select\)\s*\{\s*appearance: base-select/);
assert.match(foundation, /select::picker\(select\)[\s\S]*background: var\(--ui-surface\)/);
- assert.match(foundation, /select option:checked[\s\S]*background: var\(--ui-accent\)/);
+ assert.match(foundation, /select option:checked[\s\S]*background: var\(--ui-accent-emphasis\)/);
assert.match(foundation, /select:open::picker-icon/);
assert.match(sharePreview, /appearance:base-select/);
+ assert.match(sharePreview, /select option:checked\{color:var\(--ui-accent-emphasis-contrast\);background:var\(--ui-accent-emphasis\)\}/);
});
diff --git a/test/detail-quick-organize-ui.test.js b/test/detail-quick-organize-ui.test.js
index c80b253..f68d9a4 100644
--- a/test/detail-quick-organize-ui.test.js
+++ b/test/detail-quick-organize-ui.test.js
@@ -37,7 +37,7 @@ test("detail organization follows prompt and AI tags without an extra section ti
test("detail projects use a compact multi-project dropdown and can be created in place", () => {
assert.match(quickOrganizer, /detail-project-menu/);
assert.match(quickOrganizer, /"选择项目"/);
- assert.match(quickOrganizer, /`已加入 \$\{selectedProjects\.length\} 个项目`/);
+ assert.match(quickOrganizer, /t\("已加入 \{count\} 个项目", \{ count: selectedProjects\.length \}\)/);
assert.match(quickOrganizer, /checkbox\.type = "checkbox"/);
assert.match(quickOrganizer, /type: "REPLACE_COLLECTION_ENTRIES"/);
assert.match(quickOrganizer, /type: "CREATE_COLLECTION"/);
diff --git a/test/english_interaction_states_e2e.py b/test/english_interaction_states_e2e.py
new file mode 100644
index 0000000..4a2fcaf
--- /dev/null
+++ b/test/english_interaction_states_e2e.py
@@ -0,0 +1,207 @@
+from __future__ import annotations
+
+import re
+
+from playwright.sync_api import expect
+
+from e2e_support import ai_configuration_fixture, base_entry, extension_session
+
+
+CHINESE = re.compile(r"[\u3400-\u9fff]")
+
+
+def assert_no_visible_chinese(locator, state: str) -> None:
+ lines = sorted({line.strip() for line in locator.inner_text().splitlines() if CHINESE.search(line)})
+ assert not lines, (state, lines)
+
+
+def assert_panel_contains_children(panel, state: str) -> None:
+ geometry = panel.evaluate(
+ """node => {
+ const panelRect = node.getBoundingClientRect();
+ const outside = [...node.querySelectorAll('*')]
+ .filter(child => {
+ const style = getComputedStyle(child);
+ if (style.display === 'none' || style.visibility === 'hidden') return false;
+ const rect = child.getBoundingClientRect();
+ return rect.left < panelRect.left - 1 || rect.right > panelRect.right + 1
+ || rect.top < panelRect.top - 1 || rect.bottom > panelRect.bottom + 1;
+ })
+ .map(child => ({tag: child.tagName, text: child.textContent.trim().slice(0, 80), rect: child.getBoundingClientRect().toJSON()}));
+ return {
+ outside,
+ panel: panelRect.toJSON(),
+ viewport: innerWidth,
+ pageOverflow: document.documentElement.scrollWidth - document.documentElement.clientWidth
+ };
+ }"""
+ )
+ assert not geometry["outside"], (state, geometry)
+ assert geometry["panel"]["left"] >= -1 and geometry["panel"]["right"] <= geometry["viewport"] + 1, (state, geometry)
+ assert geometry["pageOverflow"] <= 1, (state, geometry)
+
+
+def main() -> None:
+ entry = base_entry("english-video-case", "English video reference", "", "content:prompt:video")
+ entry["mediaAssets"] = [{
+ "id": "english-video",
+ "kind": "video",
+ "usage": "content",
+ "storageMode": "reference",
+ "sourceUrl": "https://www.youtube.com/watch?v=fixture",
+ "sourceTitle": "English source video",
+ "reviewStatus": "verified",
+ "reference": {"url": "https://www.youtube.com/watch?v=fixture", "provider": "youtube", "playbackMode": "external"},
+ }]
+ entry["primaryMediaId"] = "english-video"
+ project = {"id": "collection:english", "name": "English project", "order": 0, "entryIds": [entry["id"]], "visibility": "library"}
+ import_job = {
+ "version": 1,
+ "items": [{
+ "id": "import-job:english",
+ "importBatchId": "import-job:english",
+ "status": "completed",
+ "createdAt": "2026-08-23T12:00:00.000Z",
+ "updatedAt": "2026-08-23T12:00:01.000Z",
+ "createdEntryIds": [entry["id"]],
+ "items": [{
+ "id": "import-item:english",
+ "stagedAssetId": "staged:english",
+ "status": "imported",
+ "entryId": entry["id"],
+ }],
+ }],
+ }
+
+ with extension_session("prompt-director-english-states-", viewport={"width": 1440, "height": 900}) as session:
+ setup = session.open_page("collector.html", wait_until="networkidle")
+ session.seed_storage(setup, {
+ "schemaVersion": 25,
+ "entries": [entry],
+ "organizerState": {"version": 6, "collections": [project]},
+ "importJobs": import_job,
+ "uiPreferences": {"locale": "en", "theme": "light", "motion": "reduced"},
+ **ai_configuration_fixture(
+ providers={
+ "openai": {
+ "apiKey": "english-ui-key",
+ "consent": True,
+ "models": {
+ "creativePlanning": "gpt-5-mini",
+ "imageAnalysis": "gpt-5-mini",
+ "imageGeneration": "gpt-5-mini",
+ },
+ },
+ "custom-media": {
+ "endpoint": "https://www.micuapi.ai/v1/responses",
+ "protocol": "responses",
+ "apiKey": "english-compatible-key",
+ "consent": True,
+ "models": {"imageAnalysis": "gpt-5.6-terra", "imageGeneration": "gpt-image-2"},
+ "imageGeneration": {
+ "protocol": "images_generations",
+ "endpoint": "https://www.micuapi.ai/v1/images/generations",
+ "editsEndpoint": "https://www.micuapi.ai/v1/images/edits",
+ "apiKey": "english-compatible-image-key",
+ "model": "gpt-image-2",
+ },
+ },
+ },
+ assignments={
+ "creativePlanning": {"providerId": "openai", "model": "gpt-5-mini"},
+ "imageAnalysis": {"providerId": "custom-media", "model": "gpt-5.6-terra"},
+ "imageGeneration": {"providerId": "custom-media", "model": "gpt-image-2"},
+ },
+ ),
+ })
+ setup.evaluate(
+ """async () => {
+ const skills = await import(chrome.runtime.getURL('creative-skills.js'));
+ const created = skills.createCreativeSkill(skills.createCreativeSkillsState(), {
+ callName: 'english-layout',
+ description: 'An English-only composition method.',
+ skillMarkdown: `# English layout\n\nKeep the subject hierarchy clear.`,
+ source: 'generated'
+ }, {id: 'skill:english', versionId: 'skill-version:english', now: '2026-08-23T12:00:00.000Z'});
+ await chrome.storage.local.set({creativeSkills: created.state});
+ }"""
+ )
+
+ library = session.open_page("library.html", wait_until="networkidle")
+
+ library.locator("#add-menu > summary").click()
+ library.locator("#add-quick-note").click()
+ quick_note = library.locator("#promptdirector-app-dialog")
+ expect(quick_note.get_by_role("heading")).to_have_text("Quick note")
+ assert_no_visible_chinese(quick_note, "quick note dialog")
+ quick_note.get_by_role("button", name="Cancel", exact=True).click()
+
+ library.locator("#add-menu > summary").click()
+ library.locator("#add-video-reference").click()
+ video_link = library.locator("#promptdirector-app-dialog")
+ expect(video_link.get_by_role("heading")).to_have_text("Add video link")
+ assert_no_visible_chinese(video_link, "video link dialog")
+ video_link.get_by_role("button", name="Cancel", exact=True).click()
+
+ library.locator("#create-collection").click()
+ new_project = library.locator("#promptdirector-app-dialog")
+ expect(new_project.get_by_role("heading")).to_have_text("New project")
+ assert_no_visible_chinese(new_project, "new project dialog")
+ new_project.get_by_role("button", name="Cancel", exact=True).click()
+
+ project_menu = library.locator(".project-row .project-menu").first
+ library.set_viewport_size({"width": 390, "height": 800})
+ library.locator("#toggle-filters").click()
+ expect(library.locator("#filter-sidebar")).to_be_visible()
+ project_menu.locator(":scope > summary").click()
+ assert_no_visible_chinese(project_menu.locator(".project-menu-panel"), "project menu")
+ assert_panel_contains_children(project_menu.locator(".project-menu-panel"), "project menu at 390px")
+ project_menu.locator(":scope > summary").click()
+
+ category_menu = library.locator(".content-filter-menu").first
+ category_menu.locator(":scope > summary").click()
+ assert_no_visible_chinese(category_menu.locator(".project-menu-panel"), "category menu")
+ assert_panel_contains_children(category_menu.locator(".project-menu-panel"), "category menu at 390px")
+ category_menu.locator(":scope > summary").click()
+
+ library.set_viewport_size({"width": 1440, "height": 900})
+
+ library.locator(f'.case-card[data-entry-id="{entry["id"]}"]').click()
+ expect(library.locator("#detail-drawer")).to_have_class(re.compile(r"\bopen\b"))
+ assert_no_visible_chinese(library.locator("#detail-drawer"), "case details")
+ library.locator("#detail-close").click()
+
+ library.locator("#add-menu > summary").click()
+ library.locator("#add-media").click()
+ expect(library.locator("#import-last-job")).to_be_visible()
+ library.locator("#import-last-job").click()
+ import_dialog = library.locator("#import-dialog")
+ expect(import_dialog.locator("#import-job-title")).to_have_text("Import complete")
+ assert_no_visible_chinese(import_dialog, "completed import job")
+ library.locator("#import-close").click()
+
+ composer = session.open_page("composer.html", wait_until="networkidle")
+ composer.set_viewport_size({"width": 390, "height": 800})
+ composer.locator("#composer-model-trigger").click()
+ assert_no_visible_chinese(composer.locator("#composer-model-menu"), "composer model menu")
+ expect(composer.locator("#composer-model-compatible-label")).to_contain_text("Micu")
+ assert_panel_contains_children(composer.locator("#composer-model-menu"), "composer model menu at 390px")
+ composer.locator("#composer-model-trigger").click()
+
+ composer.set_viewport_size({"width": 1440, "height": 900})
+
+ composer.locator("#composer-options > summary").click()
+ expect(composer.locator("#composer-generation-settings")).to_be_visible()
+ assert_no_visible_chinese(composer.locator("#composer-options"), "composer creation settings")
+ composer.locator("#composer-options > summary").click()
+
+ composer.locator("#composer-reference-open").click()
+ composer.locator("#composer-reference-tab-skills").click()
+ expect(composer.locator(".composer-skill-card")).to_have_count(1)
+ assert_no_visible_chinese(composer.locator("#composer-reference-workspace"), "composer Skill references")
+
+ print({"english_interaction_states": 10, "visible_chinese": False})
+
+
+if __name__ == "__main__":
+ main()
diff --git a/test/extension-update-ui.test.js b/test/extension-update-ui.test.js
index 194bde5..0e6d39b 100644
--- a/test/extension-update-ui.test.js
+++ b/test/extension-update-ui.test.js
@@ -20,7 +20,7 @@ test("about settings expose status and state-specific update actions", () => {
assert.match(about, /id="update-release-link"/);
assert.match(source, /"应用更新并重启"/);
assert.match(source, /"重新载入目录"/);
- assert.match(about, /class="button-primary update-download-action"[^>]*hidden>下载新版本/);
+ assert.match(about, /class="button-primary update-download-action"[^>]*hidden[^>]*>下载新版本/);
assert.match(css, /\.settings-update-actions/);
});
diff --git a/test/facets.test.js b/test/facets.test.js
index 74e7ed6..ea8c07e 100644
--- a/test/facets.test.js
+++ b/test/facets.test.js
@@ -32,6 +32,17 @@ test("generic facet operations remain testable without changing the fixed produc
assert.deepEqual(result.state.facetCatalog.facets[0].aliases, ["视觉语言"]);
});
+test("renaming a localized system tag makes the user name authoritative in every locale", () => {
+ const catalog = createDefaultFacetCatalog();
+ const facet = catalog.facets[0];
+ const node = catalog.nodes.find((item) => item.facetId === facet.id);
+ const state = { facetCatalog: catalog, entries: [] };
+ const renamedNode = applyFacetChange(state, previewFacetChange(state, {
+ type: "rename", nodeId: node.id, name: "我的标签"
+ })).state;
+ assert.equal(renamedNode.facetCatalog.nodes.find((item) => item.id === node.id).names, undefined);
+});
+
test("archiving a dimension does not erase historical assignments", () => {
let catalog = createFacet(createEmptyFacetCatalog(), { id: "facet:mood", name: "情绪" });
catalog = createFacet(catalog, { id: "facet:light", name: "灯光" });
diff --git a/test/i18n.test.js b/test/i18n.test.js
index d6a4412..f5e367b 100644
--- a/test/i18n.test.js
+++ b/test/i18n.test.js
@@ -21,6 +21,47 @@ test("every static HTML i18n marker has an English translation", async () => {
}
});
+test("product pages do not leave Chinese interface text outside the translation system", async () => {
+ for (const path of ["../collector.html", "../library.html", "../composer.html", "../skills.html", "../curated.html", "../curated-skills.html"]) {
+ const html = await readFile(new URL(path, import.meta.url), "utf8");
+ const unmarkedText = [];
+ for (const match of html.matchAll(/>([^<>]*[\p{Script=Han}][^<>]*)</gu)) {
+ const openingStart = html.lastIndexOf("<", match.index);
+ const opening = html.slice(openingStart, match.index + 1);
+ if (!opening.startsWith("<title") && !opening.includes("data-i18n=")) unmarkedText.push(match[1].trim());
+ }
+ const unmarkedAttributes = [];
+ for (const tag of html.match(/<[^>]+>/gu) || []) {
+ for (const [attribute, marker] of [["placeholder", "data-i18n-placeholder"], ["aria-label", "data-i18n-aria-label"], ["title", "data-i18n-title"]]) {
+ const value = tag.match(new RegExp(`\\b${attribute}="([^"]*[\\u3400-\\u9fff][^"]*)"`, "u"))?.[1];
+ if (value && !tag.includes(`${marker}=`)) unmarkedAttributes.push(`${attribute}: ${value}`);
+ }
+ }
+ assert.deepEqual([...new Set(unmarkedText.filter(Boolean))], [], `${path} has unmarked Chinese text`);
+ assert.deepEqual([...new Set(unmarkedAttributes)], [], `${path} has unmarked Chinese attributes`);
+ }
+});
+
+test("dynamic interface helpers only receive Chinese copy with an English translation", async () => {
+ const paths = ["../library.js", "../composer-page.js", "../skills-page.js", "../collector.js", "../curated-page.js", "../ui-dialogs.js", "../tag-editor.js"];
+ const missing = [];
+ for (const path of paths) {
+ const source = await readFile(new URL(path, import.meta.url), "utf8");
+ for (const match of source.matchAll(/\bt\(\s*"((?:[^"\\]|\\.)*)"/gu)) {
+ const key = JSON.parse(`"${match[1]}"`);
+ if (/\p{Script=Han}/u.test(key) && !hasEnglishTranslation(key)) missing.push(`${path}: ${key}`);
+ }
+ if (!["../library.js", "../composer-page.js"].includes(path)) continue;
+ for (const line of source.split("\n").filter((value) => value.includes("textEl("))) {
+ for (const match of line.matchAll(/"((?:[^"\\]|\\.)*)"/gu)) {
+ const key = JSON.parse(`"${match[1]}"`);
+ if (/\p{Script=Han}/u.test(key) && !hasEnglishTranslation(key)) missing.push(`${path}: ${key}`);
+ }
+ }
+ }
+ assert.deepEqual([...new Set(missing)], []);
+});
+
test("missing sync folders have localized recovery guidance", () => {
assert.equal(
translateForLocale("同步文件夹中的文件或目录不存在,请重新选择同步文件夹后再同步", "en"),
@@ -38,6 +79,34 @@ test("composer reference-image modes explain the real image and token behavior i
);
});
+test("collector runtime states and destructive draft actions have English copy", () => {
+ const expected = new Map([
+ ["清空待保存内容?", "Clear unsaved content?"],
+ ["当前尚未保存的文字和图片会被移除,这项操作无法撤回。", "Unsaved text and images will be removed. This cannot be undone."],
+ ["待保存内容已清空", "Unsaved content cleared"],
+ ["框选已启动,请在网页中拖拽选择画面;按 Esc 取消。", "Region capture is active. Drag on the page to select an area; press Esc to cancel."],
+ ["请切回网页拖动选择画面;按 Esc 或在这里取消。", "Return to the page and drag to select an area. Press Esc or cancel here."],
+ ["不分组", "No project"],
+ ["+ 新建项目", "+ New project"],
+ ["重新检查", "Check again"],
+ ["米醋", "Micu"]
+ ]);
+ for (const [source, translation] of expected) assert.equal(translateForLocale(source, "en"), translation);
+});
+
+test("collector routes dynamic system text through the shared translation boundary", async () => {
+ const [collector, background, library] = await Promise.all([
+ readFile(new URL("../collector.js", import.meta.url), "utf8"),
+ readFile(new URL("../background.js", import.meta.url), "utf8"),
+ readFile(new URL("../library.js", import.meta.url), "utf8")
+ ]);
+ assert.match(collector, /const value = translateUiMessage\(message \|\| ""\)/);
+ assert.match(collector, /item\.customized \? item\.name : t\(item\.name\)/);
+ assert.match(collector, /translateUiMessage\(view\.summary\)/);
+ assert.match(background, /name: item\.name, customized: item\.customized === true/);
+ assert.match(library, /t\(reanalysisPreview \|\| maintenanceJob \? "重新检查" : "检查缺失项"\)/);
+});
+
async function readJson(path) {
return JSON.parse(await readFile(new URL(path, import.meta.url), "utf8"));
}
diff --git a/test/import_job_lifecycle_e2e.py b/test/import_job_lifecycle_e2e.py
index 5cf98df..bb0d0ca 100644
--- a/test/import_job_lifecycle_e2e.py
+++ b/test/import_job_lifecycle_e2e.py
@@ -19,6 +19,23 @@ def wait_for_job(page, job_id: str, statuses: set[str], timeout_seconds: float =
raise AssertionError(f"导入任务没有在期限内进入 {statuses}:{response}")
+def wait_for_local_palette(page, asset_id: str, timeout_seconds: float = 8) -> dict:
+ deadline = time.monotonic() + timeout_seconds
+ metadata = None
+ while time.monotonic() < deadline:
+ metadata = page.evaluate(
+ """async (assetId) => {
+ const store = await import(chrome.runtime.getURL('media-store.js'));
+ return store.getDerivedMetadata(assetId);
+ }""",
+ asset_id,
+ )
+ if metadata and metadata.get("palette", {}).get("colors"):
+ return metadata
+ page.wait_for_timeout(100)
+ raise AssertionError(f"导入图片没有自动生成本地色卡:{metadata}")
+
+
def main() -> None:
with extension_session("prompt-director-import-jobs-", viewport={"width": 1280, "height": 900}) as run:
starter = run.open_page("collector.html")
@@ -27,6 +44,11 @@ def main() -> None:
started = starter.evaluate(
"""async () => {
const media = await import(chrome.runtime.getURL('media-store.js'));
+ const canvas = new OffscreenCanvas(64, 64);
+ const context = canvas.getContext('2d');
+ context.fillStyle = '#e24b32';
+ context.fillRect(0, 0, 64, 64);
+ const colorBlob = await canvas.convertToBlob({type: 'image/png'});
const assets = [
{
id: 'staged:first', assetId: 'asset:first', name: 'first.txt',
@@ -37,10 +59,16 @@ def main() -> None:
id: 'staged:second', assetId: 'asset:second', name: 'second.md',
relativePath: 'notes/second.md', kind: 'document', mimeType: 'text/markdown',
byteSize: 11, contentText: 'Second note'
+ },
+ {
+ id: 'staged:color', assetId: 'asset:color', name: 'color.png',
+ relativePath: 'images/color.png', kind: 'image', mimeType: 'image/png',
+ byteSize: colorBlob.size, width: 64, height: 64
}
];
await media.saveMediaBlob('asset:first', new Blob(['First note'], {type: 'text/plain'}));
await media.saveMediaBlob('asset:second', new Blob(['Second note'], {type: 'text/markdown'}));
+ await media.saveMediaBlob('asset:color', colorBlob);
return chrome.runtime.sendMessage({
type: 'START_IMPORT_JOB',
stagedAssets: assets,
@@ -55,9 +83,12 @@ def main() -> None:
observer = run.open_page("collector.html")
completed = wait_for_job(observer, first_job_id, {"completed"})
- assert [item["status"] for item in completed["items"]] == ["imported", "imported"], completed
+ assert [item["status"] for item in completed["items"]] == ["imported", "imported", "imported"], completed
imported_ids = completed["createdEntryIds"]
- assert len(imported_ids) == 2, completed
+ assert len(imported_ids) == 3, completed
+ palette = wait_for_local_palette(observer, "asset:color")
+ automatic_ai_job = observer.evaluate("() => chrome.storage.local.get('automaticVisionBatchJob').then(value => value.automaticVisionBatchJob || null)")
+ assert automatic_ai_job is None, automatic_ai_job
undo = observer.evaluate(
"(jobId) => chrome.runtime.sendMessage({type: 'UNDO_IMPORT_JOB', jobId})",
@@ -143,6 +174,8 @@ def main() -> None:
print({
"continuedAfterPageClose": True,
"multiFileImported": len(imported_ids),
+ "automaticLocalPalette": palette["palette"]["colors"][0],
+ "automaticAiJob": automatic_ai_job,
"canceledRemaining": len(canceled["job"]["items"]),
"retriedFailedOnly": len(retry["job"]["items"]),
"undoScopedToJob": True,
diff --git a/test/large_library_e2e.py b/test/large_library_e2e.py
index 6ff5224..366f364 100644
--- a/test/large_library_e2e.py
+++ b/test/large_library_e2e.py
@@ -164,11 +164,17 @@ def main() -> None:
assert tag_filter_ms < 250, f"6500-case tag category switch took {tag_filter_ms}ms"
style_category.click()
- library.locator("#select-cases").click()
+ browse_wall = wall_geometry(library)
+ assert_wall_transition_stable(library, sample_wall_transition(library, "#select-cases"))
+ assert_wall_stable(library, browse_wall, wall_geometry(library))
assert library.locator("#result-count").is_hidden()
assert library.locator("#gallery-view-controls").is_hidden()
assert library.locator("#share-count").inner_text() == "已选 0"
assert library.locator("#selection-select-filtered").inner_text() == "全选当前(6500)"
+ assert_wall_transition_stable(library, sample_wall_transition(library, "#share-cancel"))
+ assert_wall_stable(library, browse_wall, wall_geometry(library))
+ assert_wall_transition_stable(library, sample_wall_transition(library, "#select-cases"))
+ assert_wall_stable(library, browse_wall, wall_geometry(library))
library.locator("#selection-select-filtered").click()
assert library.locator("#share-count").inner_text() == "已选 6500"
assert library.locator("#selection-clear").is_enabled()
@@ -207,8 +213,22 @@ def main() -> None:
library.locator("#selection-clear").click()
assert library.locator("#share-count").inner_text() == "已选 0"
library.locator("#share-cancel").click()
-
+ settle_layout(library)
+ post_resize_wall = wall_geometry(library)
assert_columns_fill_width(library)
+ library.locator("#select-cases").click()
+ settle_layout(library)
+ assert_wall_stable(library, post_resize_wall, wall_geometry(library))
+ library.locator("#share-cancel").click()
+ settle_layout(library)
+ assert_wall_stable(library, post_resize_wall, wall_geometry(library))
+
+ for width in (1666, 1440, 900, 640, 390):
+ library.set_viewport_size({"width": width, "height": 900 if width > 390 else 844})
+ settle_layout(library)
+ assert_columns_fill_width(library)
+ library.set_viewport_size({"width": 1666, "height": 900})
+ settle_layout(library)
before_toggle = library.evaluate("document.querySelectorAll('.case-card').length")
library.locator("#toggle-filters").click()
library.wait_for_timeout(260)
@@ -275,16 +295,95 @@ def assert_columns_fill_width(page) -> None:
const gap = parseFloat(styles.getPropertyValue('--masonry-gap'));
const cards = [...container.querySelectorAll(':scope > .case-card')];
const lefts = [...new Set(cards.map((card) => Math.round(card.getBoundingClientRect().left)))].sort((a, b) => a - b);
+ const left = Math.min(...cards.map((card) => card.getBoundingClientRect().left));
const right = Math.max(...cards.map((card) => card.getBoundingClientRect().right));
return {
expected: Math.max(1, Math.floor((rect.width + gap) / (minimum + gap))),
actual: lefts.length,
- rightGap: Math.round(rect.right - right)
+ leftGap: rect.left - left,
+ rightGap: rect.right - right,
+ overflow: document.documentElement.scrollWidth > document.documentElement.clientWidth,
+ outOfBounds: cards.some(card => {
+ const cardRect = card.getBoundingClientRect();
+ return cardRect.left < rect.left - 1 || cardRect.right > rect.right + 1;
+ })
};
}"""
)
assert geometry["actual"] == geometry["expected"], geometry
- assert abs(geometry["rightGap"]) <= 2, geometry
+ assert abs(geometry["leftGap"]) <= 1 and abs(geometry["rightGap"]) <= 1, geometry
+ assert geometry["overflow"] is False and geometry["outOfBounds"] is False, geometry
+
+
+def settle_layout(page) -> None:
+ page.evaluate(
+ """() => new Promise(resolve => requestAnimationFrame(
+ () => requestAnimationFrame(() => resolve())
+ ))"""
+ )
+
+
+def sample_wall_transition(page, selector: str) -> list[dict]:
+ return page.evaluate(
+ """selector => new Promise(resolve => {
+ const capture = () => ({
+ scrollY,
+ cards: Object.fromEntries([...document.querySelectorAll('#case-list > .case-card')].map(card => {
+ const rect = card.getBoundingClientRect();
+ return [card.dataset.entryId, {left: rect.left, top: rect.top, width: rect.width}];
+ }))
+ });
+ const samples = [capture()];
+ document.querySelector(selector).click();
+ samples.push(capture());
+ requestAnimationFrame(() => {
+ samples.push(capture());
+ requestAnimationFrame(() => {
+ samples.push(capture());
+ resolve(samples);
+ });
+ });
+ })""",
+ selector,
+ )
+
+
+def assert_wall_transition_stable(page, samples: list[dict]) -> None:
+ reference = samples[0]
+ for current in samples[1:]:
+ assert abs(current["scrollY"] - reference["scrollY"]) <= 1, samples
+ shared = reference["cards"].keys() & current["cards"].keys()
+ assert shared, samples
+ drift = [
+ current["cards"][entry_id][key] - reference["cards"][entry_id][key]
+ for entry_id in shared
+ for key in ("left", "top", "width")
+ ]
+ assert max(abs(delta) for delta in drift) <= 1, samples
+ assert_columns_fill_width(page)
+
+
+def wall_geometry(page) -> dict:
+ return page.evaluate(
+ """() => Object.fromEntries([...document.querySelectorAll('#case-list > .case-card')].map(card => {
+ const rect = card.getBoundingClientRect();
+ return [card.dataset.entryId, {left: rect.left, top: rect.top, width: rect.width}];
+ }))"""
+ )
+
+
+def assert_wall_stable(page, reference: dict, current: dict) -> None:
+ shared = reference.keys() & current.keys()
+ assert shared, {"reference": reference, "current": current}
+ drift = {
+ entry_id: {
+ key: current[entry_id][key] - reference[entry_id][key]
+ for key in ("left", "top", "width")
+ }
+ for entry_id in shared
+ }
+ assert max(abs(delta) for values in drift.values() for delta in values.values()) <= 1, drift
+ assert_columns_fill_width(page)
if __name__ == "__main__":
diff --git a/test/lib.test.js b/test/lib.test.js
index 3d85409..79e7e91 100644
--- a/test/lib.test.js
+++ b/test/lib.test.js
@@ -7,7 +7,10 @@ import {
buildEntry,
calculateCropGeometry,
findDuplicate,
+ libraryTitleForLocale,
+ libraryTitleForStorage,
normalizeOutputPath,
+ normalizeSettings,
normalizeSelection,
renderLibraryJson,
renderMarkdown
@@ -34,6 +37,24 @@ test("normalizeOutputPath keeps a safe relative markdown path", () => {
);
});
+test("legacy default library names migrate without overwriting genuine custom names", () => {
+ assert.equal(normalizeSettings({ libraryTitle: "优秀提示词案例库" }).libraryTitle, "视觉创作灵感库");
+ assert.equal(normalizeSettings({ libraryTitle: "Visual Creative Archive" }, DEFAULT_SETTINGS_EN).libraryTitle, "Visual Inspiration Library");
+ assert.equal(normalizeSettings({ libraryTitle: "我的导演项目" }).libraryTitle, "我的导演项目");
+});
+
+test("system library titles follow the interface language without rewriting custom titles", () => {
+ assert.equal(libraryTitleForLocale("视觉创作灵感库", "en"), "Visual Inspiration Library");
+ assert.equal(libraryTitleForLocale("Visual Inspiration Library", "zh-CN"), "视觉创作灵感库");
+ assert.equal(libraryTitleForLocale("优秀提示词案例库", "en"), "Visual Inspiration Library");
+ assert.equal(libraryTitleForLocale("我的导演项目", "en"), "我的导演项目");
+});
+
+test("saving another library setting does not rewrite a localized system title", () => {
+ assert.equal(libraryTitleForStorage("Visual Inspiration Library", "视觉创作灵感库", "en"), "视觉创作灵感库");
+ assert.equal(libraryTitleForStorage("Director archive", "视觉创作灵感库", "en"), "Director archive");
+});
+
test("renderMarkdown keeps source metadata and does not break on code fences", () => {
const taxonomy = createDefaultTaxonomy();
let facets = createFacet(createEmptyFacetCatalog(), { id: "facet:visual", name: "视觉风格" });
@@ -70,7 +91,7 @@ test("renderMarkdown keeps source metadata and does not break on code fences", (
facets
);
- assert.match(markdown, /^# 我的视觉灵感库/m);
+ assert.match(markdown, /^# 视觉创作灵感库/m);
assert.match(markdown, /共 1 条案例/);
assert.match(markdown, /- 截图 1(主图):!\[对应画面\]\(images\/entry-1.webp\)/);
assert.ok(
@@ -115,12 +136,17 @@ test("English export localizes system headings but preserves creator content", (
savedAt: "2026-07-19T10:00:00.000Z",
classification: { pathIds: [CONTENT_IDS.promptImage], status: "confirmed" }
}], DEFAULT_SETTINGS_EN, createDefaultTaxonomy(), createDefaultFacetCatalog(), { locale: "en" });
- assert.match(markdown, /^# My Visual Archive/m);
+ assert.match(markdown, /^# Visual Inspiration Library/m);
assert.match(markdown, /## Case 01 \| 用户标题/);
assert.match(markdown, /- Content type: Image prompt/);
assert.match(markdown, /### Original prompt[\s\S]*用户提示词/);
});
+test("English export resolves a stored Chinese system library title", () => {
+ const markdown = renderMarkdown([], { ...DEFAULT_SETTINGS, libraryTitle: "视觉创作灵感库" }, undefined, undefined, { locale: "en" });
+ assert.match(markdown, /^# Visual Inspiration Library/m);
+});
+
test("calculateCropGeometry maps CSS pixels to screenshot pixels and caps output width", () => {
assert.deepEqual(
calculateCropGeometry({
diff --git a/test/library-interaction-regressions.test.js b/test/library-interaction-regressions.test.js
index ccb912a..b9ec732 100644
--- a/test/library-interaction-regressions.test.js
+++ b/test/library-interaction-regressions.test.js
@@ -43,7 +43,7 @@ test("developer analysis import remains supported without appearing in the norma
test("detail panels and selected projects use the themed surface and product accent", () => {
assert.match(css, /\.detail-primary > \.detail-body\s*\{[^}]*min-height:\s*100dvh[^}]*align-self:\s*stretch/);
- assert.match(css, /\.project-filter\[aria-pressed="true"\]\s*\{[^}]*color:\s*var\(--accent-ink\)[^}]*background:\s*var\(--accent-soft\)[^}]*var\(--accent\)/);
+ assert.match(css, /\.project-filter\[aria-pressed="true"\]\s*\{[^}]*color:\s*var\(--accent-ink\)[^}]*background:\s*var\(--ui-project-active-surface\)[^}]*var\(--accent-emphasis\)/);
});
test("library refresh waits for detail rebuilding before returning control", () => {
diff --git a/test/library-maintenance.test.js b/test/library-maintenance.test.js
index 348d5b4..4c3dafc 100644
--- a/test/library-maintenance.test.js
+++ b/test/library-maintenance.test.js
@@ -5,6 +5,7 @@ import {
cancelLibraryMaintenance,
completeLibraryMaintenanceItem,
createLibraryMaintenanceJob,
+ extendLibraryMaintenanceJob,
libraryMaintenanceSummary,
mergeLibraryMaintenanceProgress,
nextLibraryMaintenanceItem,
@@ -63,3 +64,36 @@ test("background progress cannot overwrite a user pause or a replacement job", (
assert.equal(mergeLibraryMaintenanceProgress(replacement, progress).id, replacement.id);
assert.equal(mergeLibraryMaintenanceProgress(replacement, progress).paletteCursor, 0);
});
+
+test("automatic maintenance adds imported targets without repeating processed work or overriding pause", () => {
+ let job = createLibraryMaintenanceJob({
+ id: "maintenance:auto",
+ now: "2026-08-02T00:00:00.000Z",
+ classificationEntryIds: ["case-done", "case-pending"],
+ paletteAssetIds: ["asset-pending"]
+ });
+ job = completeLibraryMaintenanceItem(job, { ok: true });
+ job = pauseLibraryMaintenance(job);
+ const extended = extendLibraryMaintenanceJob(job, {
+ classificationEntryIds: ["case-done", "case-new"],
+ paletteAssetIds: ["asset-pending", "asset-new"]
+ }, { now: "2026-08-02T00:01:00.000Z" });
+
+ assert.equal(extended.status, "paused");
+ assert.deepEqual(extended.classificationEntryIds, ["case-done", "case-pending", "case-new"]);
+ assert.deepEqual(extended.paletteAssetIds, ["asset-pending", "asset-new"]);
+ assert.deepEqual(nextLibraryMaintenanceItem(resumeLibraryMaintenance(extended)), { kind: "classification", id: "case-pending" });
+});
+
+test("in-flight progress keeps targets appended by a later import", () => {
+ const running = createLibraryMaintenanceJob({
+ id: "maintenance:active",
+ paletteAssetIds: ["asset-running"]
+ });
+ const extended = extendLibraryMaintenanceJob(running, { paletteAssetIds: ["asset-imported"] });
+ const progress = completeLibraryMaintenanceItem(running, { ok: true });
+ const merged = mergeLibraryMaintenanceProgress(extended, progress);
+
+ assert.deepEqual(merged.paletteAssetIds, ["asset-running", "asset-imported"]);
+ assert.deepEqual(nextLibraryMaintenanceItem(merged), { kind: "palette", id: "asset-imported" });
+});
diff --git a/test/library-navigation.test.js b/test/library-navigation.test.js
index b05e1b7..29463bf 100644
--- a/test/library-navigation.test.js
+++ b/test/library-navigation.test.js
@@ -70,16 +70,20 @@ test("share and combine are contextual actions after entering selection mode", (
assert.match(selection, /id="selection-combine"/);
assert.match(selection, /id="selection-analyze"/);
assert.match(selection, /id="share-export"/);
+ assert.match(selection, /id="selection-label-menu"/);
+ assert.match(selection, /id="selection-project-menu"/);
+ assert.match(selection, /id="selection-more-menu"/);
});
-test("global filter clearing lives in the fixed sidebar tools instead of a document-flow filter bar", () => {
+test("project heading keeps only creation and ordering while selected projects toggle off in place", () => {
const sidebar = html.slice(html.indexOf('<aside id="filter-sidebar"'), html.indexOf('</aside>'));
assert.doesNotMatch(html, /id="active-filter-bar"|id="active-filters"/);
- assert.match(sidebar, /id="clear-filters"/);
- assert.match(sidebar, /id="active-filter-badge"/);
- assert.match(sidebar, /清除全部筛选/);
- assert.match(sidebar, /id="clear-filters"[^>]*disabled/);
- assert.match(source, /elements\.clearFilters\.disabled = activeFilterCount === 0/);
+ assert.doesNotMatch(sidebar, /id="clear-filters"|id="active-filter-badge"|sidebar-filter-tools|清除全部筛选/);
+ const projectHeading = sidebar.slice(sidebar.indexOf('id="project-section"'), sidebar.indexOf('id="collection-filters"'));
+ assert.match(projectHeading, /id="create-collection"[\s\S]*icon-plus[\s\S]*data-i18n="新建"/);
+ assert.match(projectHeading, /id="manage-project-order"/);
+ assert.ok(projectHeading.indexOf('id="create-collection"') < projectHeading.indexOf('id="manage-project-order"'));
+ assert.match(source, /selectedCollectionId = selectedCollectionId === collection\.id \? "" : collection\.id/);
assert.match(source, /toggleFilters\.dataset\.filterCount/);
});
diff --git a/test/library-sorting-ui.test.js b/test/library-sorting-ui.test.js
index b66edd4..8c8d48c 100644
--- a/test/library-sorting-ui.test.js
+++ b/test/library-sorting-ui.test.js
@@ -10,10 +10,10 @@ const [html, source, css] = await Promise.all([
test("library exposes four case sorts and keeps project ordering as an on-demand action", () => {
const gallerySort = html.slice(html.indexOf('id="gallery-sort"'), html.indexOf("</select>", html.indexOf('id="gallery-sort"')));
- assert.match(gallerySort, /value="added-desc">最近加入/);
- assert.match(gallerySort, /value="updated-desc">最近更新/);
- assert.match(gallerySort, /value="title">标题/);
- assert.match(gallerySort, /value="project-manual"[^>]*hidden>手动排序/);
+ assert.match(gallerySort, /value="added-desc"[^>]*>最近加入/);
+ assert.match(gallerySort, /value="updated-desc"[^>]*>最近更新/);
+ assert.match(gallerySort, /value="title"[^>]*>标题/);
+ assert.match(gallerySort, /value="project-manual"[^>]*hidden[^>]*>手动排序/);
assert.doesNotMatch(gallerySort, /最早加入|项目手动顺序/);
assert.match(html, /id="manage-case-order"[^>]*aria-label="管理案例顺序"/);
diff --git a/test/library_132_e2e.py b/test/library_132_e2e.py
index 6ce871a..a2f0245 100644
--- a/test/library_132_e2e.py
+++ b/test/library_132_e2e.py
@@ -166,24 +166,22 @@ def main() -> None:
library.wait_for_load_state("networkidle")
library.locator("#search-input").fill("Prompt")
wait_for_initial_gallery_batch(library, 103)
- expect(library.locator("#active-filter-badge")).to_have_text("筛选 1")
gallery_top_before_filter = library.locator(".gallery-shell").evaluate(
"element => element.getBoundingClientRect().top"
)
- library.locator("#content-filters").get_by_role("button", name="图片案例 100", exact=True).click()
- expect(library.locator("#active-filter-badge")).to_have_text("筛选 2")
- expect(library.locator("#clear-filters")).to_be_visible()
- expect(library.locator("#clear-filters")).to_be_enabled()
+ image_filter = library.locator("#content-filters").get_by_role("button", name="图片案例 100", exact=True)
+ image_filter.click()
+ expect(image_filter).to_have_attribute("aria-pressed", "true")
gallery_top_after_filter = library.locator(".gallery-shell").evaluate(
"element => element.getBoundingClientRect().top"
)
assert abs(gallery_top_after_filter - gallery_top_before_filter) <= 1
- library.locator("#content-filters").get_by_role("button", name="图片案例 100", exact=True).click()
- expect(library.locator("#active-filter-badge")).to_have_text("筛选 1")
+ image_filter.click()
+ expect(image_filter).to_have_attribute("aria-pressed", "false")
library.locator("#pending-filter").check()
- expect(library.locator("#active-filter-badge")).to_have_text("筛选 2")
+ expect(library.locator("#pending-filter")).to_be_checked()
library.locator("#pending-filter").uncheck()
- expect(library.locator("#active-filter-badge")).to_have_text("筛选 1")
+ expect(library.locator("#pending-filter")).not_to_be_checked()
initial_layout = library.evaluate(
"""() => {
window.__promptDirectorInitialCards = new Map();
diff --git a/test/library_core_e2e.py b/test/library_core_e2e.py
index 4878fdd..03b483f 100644
--- a/test/library_core_e2e.py
+++ b/test/library_core_e2e.py
@@ -51,8 +51,6 @@ def main() -> None:
expect(library.locator(".case-card")).to_have_count(3)
style_filter.get_by_role("button", name=re.compile(r"^渲染方式 3$")).click()
expect(library.locator(".case-card")).to_have_count(3)
- library.locator("#clear-filters").click()
-
library.locator("#search-input").fill("单次渲染词")
expect(library.locator(".case-card")).to_have_count(1)
expect(library.locator(".case-card")).to_contain_text("推镜视频")
diff --git a/test/library_detail_actions_e2e.py b/test/library_detail_actions_e2e.py
index 8c8739d..2de7623 100644
--- a/test/library_detail_actions_e2e.py
+++ b/test/library_detail_actions_e2e.py
@@ -160,8 +160,11 @@ def main() -> None:
library.set_viewport_size({"width": 390, "height": 844})
mobile_project_menu = library.locator(".detail-project-menu")
mobile_project_popover = library.locator(".detail-project-popover")
- if mobile_project_menu.get_attribute("open") is None:
+ for _ in range(5):
+ if mobile_project_menu.get_attribute("open") is not None and mobile_project_popover.is_visible():
+ break
mobile_project_menu.locator(":scope > summary").click()
+ library.wait_for_timeout(150)
expect(mobile_project_menu).to_have_attribute("open", "")
expect(mobile_project_popover).to_be_visible()
library.locator(".prompt-section").scroll_into_view_if_needed()
diff --git a/test/library_import_ui_e2e.py b/test/library_import_ui_e2e.py
index 7f5624f..cf37759 100644
--- a/test/library_import_ui_e2e.py
+++ b/test/library_import_ui_e2e.py
@@ -88,7 +88,13 @@ def main() -> None:
"order": 0,
"entryIds": [],
"visibility": "library",
- }],
+ }] + [{
+ "id": f"collection:fixture:{index}",
+ "name": "用于验证完整换行显示的特别长项目名称" if index == 11 else f"Import Project {index:02d}",
+ "order": index,
+ "entryIds": [],
+ "visibility": "library",
+ } for index in range(1, 12)],
},
**ai_configuration_fixture(
providers={
@@ -156,18 +162,20 @@ def main() -> None:
expect(library.locator("#import-auto-analyze")).to_be_checked()
expect(library.locator("#import-project")).to_have_attribute("role", "combobox")
library.locator("#import-project").click()
- expect(library.locator(".project-combobox-option")).to_have_count(1)
+ expect(library.locator(".project-combobox-option")).to_have_count(12)
import_project_menu = library.locator(".project-combobox-listbox").evaluate(
"""node => {
const menu = node.getBoundingClientRect();
- const boundary = node.closest('.import-dialog-body').getBoundingClientRect();
- return {background: getComputedStyle(node).backgroundColor, visible: !node.hidden, top: menu.top, bottom: menu.bottom, boundaryTop: boundary.top, boundaryBottom: boundary.bottom};
+ const footer = node.closest('dialog').querySelector(':scope > footer').getBoundingClientRect();
+ return {background: getComputedStyle(node).backgroundColor, position: getComputedStyle(node).position, visible: !node.hidden, top: menu.top, bottom: menu.bottom, left: menu.left, right: menu.right, viewportWidth: innerWidth, viewportHeight: innerHeight, footerTop: footer.top, clientHeight: node.clientHeight, scrollHeight: node.scrollHeight};
}"""
)
assert import_project_menu["visible"] is True
assert import_project_menu["background"] not in {"rgb(255, 255, 255)", "rgba(0, 0, 0, 0)"}, import_project_menu
- assert import_project_menu["top"] >= import_project_menu["boundaryTop"] - 1, import_project_menu
- assert import_project_menu["bottom"] <= import_project_menu["boundaryBottom"] + 1, import_project_menu
+ assert import_project_menu["position"] == "fixed", import_project_menu
+ assert import_project_menu["top"] >= 11 and import_project_menu["bottom"] <= import_project_menu["footerTop"] + 1, import_project_menu
+ assert import_project_menu["left"] >= 11 and import_project_menu["right"] <= import_project_menu["viewportWidth"] - 11, import_project_menu
+ assert import_project_menu["clientHeight"] <= import_project_menu["scrollHeight"], import_project_menu
library.locator("#import-project").press("Escape")
expect(library.locator("#import-project")).to_have_attribute("aria-expanded", "false")
library.locator("#import-project").fill("Import Review")
diff --git a/test/library_navigation_e2e.py b/test/library_navigation_e2e.py
index f7ee3ef..7aa7f79 100644
--- a/test/library_navigation_e2e.py
+++ b/test/library_navigation_e2e.py
@@ -68,6 +68,15 @@ def main() -> None:
expect(library.locator("#collection-filters .project-filter")).to_have_count(1)
expect(library.locator("#collection-filters .project-filter-name")).to_have_text("导航验收项目")
expect(library.locator("#collection-filters .project-filter-count")).to_have_text("1")
+ expect(library.locator("#clear-filters, #active-filter-badge, .sidebar-filter-tools")).to_have_count(0)
+ content_heading_top = library.locator(".filter-section").first.evaluate("node => node.getBoundingClientRect().top")
+ project_filter = library.locator("#collection-filters .project-filter")
+ project_filter.click()
+ expect(project_filter).to_have_attribute("aria-pressed", "true")
+ filtered_content_heading_top = library.locator(".filter-section").first.evaluate("node => node.getBoundingClientRect().top")
+ assert filtered_content_heading_top == content_heading_top, {"before": content_heading_top, "after": filtered_content_heading_top}
+ project_filter.click()
+ expect(project_filter).to_have_attribute("aria-pressed", "false")
expect(library.locator("#project-sort")).to_have_count(0)
expect(library.locator(".project-row.project-ordering")).to_have_count(0)
library.locator("#manage-project-order").click()
@@ -108,19 +117,102 @@ def main() -> None:
})"""
)
assert wall == {"gap": "2px", "cardRadius": "2px"}, wall
+ first_card = library.locator("#case-list > .case-card").first
+ hover_states = {}
+ for theme in ["dark", "light"]:
+ library.evaluate(
+ """theme => {
+ document.documentElement.dataset.theme = theme;
+ document.documentElement.dataset.resolvedTheme = theme;
+ }""",
+ theme,
+ )
+ before_hover = first_card.evaluate(
+ "node => { const rect = node.getBoundingClientRect(); return {left: rect.left, top: rect.top, width: rect.width, height: rect.height, scrollY}; }"
+ )
+ first_card.hover()
+ after_hover = first_card.evaluate(
+ """node => {
+ const rect = node.getBoundingClientRect();
+ const style = getComputedStyle(node);
+ const overlay = getComputedStyle(node, '::after');
+ return {left: rect.left, top: rect.top, width: rect.width, height: rect.height, scrollY, shadow: style.boxShadow, overlayBorder: overlay.borderTopWidth, overlayColor: overlay.borderTopColor};
+ }"""
+ )
+ assert all(abs(after_hover[key] - before_hover[key]) <= 1 for key in ["left", "top", "width", "height", "scrollY"]), {"theme": theme, "before": before_hover, "after": after_hover}
+ assert after_hover["shadow"] == "none", {"theme": theme, "after": after_hover}
+ assert after_hover["overlayBorder"] == "1px", {"theme": theme, "after": after_hover}
+ assert after_hover["overlayColor"] != "rgba(0, 0, 0, 0)", {"theme": theme, "after": after_hover}
+ hover_states[theme] = after_hover
+ library.evaluate(
+ """() => {
+ document.documentElement.dataset.theme = 'dark';
+ document.documentElement.dataset.resolvedTheme = 'dark';
+ }"""
+ )
+ first_card_top = library.locator("#case-list > .case-card").first.evaluate("node => node.getBoundingClientRect().top")
library.locator("#select-cases").click()
expect(library.locator("#result-count")).to_be_hidden()
expect(library.locator("#gallery-view-controls")).to_be_hidden()
expect(library.locator("#manage-project-order")).to_be_visible()
expect(library.locator("#manage-project-order")).to_be_disabled()
expect(library.locator("#share-count")).to_have_text("已选 0")
+ expect(library.locator("#selection-selected-actions")).to_be_hidden()
+ selection_first_card_top = library.locator("#case-list > .case-card").first.evaluate("node => node.getBoundingClientRect().top")
+ assert abs(selection_first_card_top - first_card_top) <= 1, {"before": first_card_top, "after": selection_first_card_top}
+ library.set_viewport_size({"width": 1658, "height": 900})
+ library.screenshot(path=str(screenshots / "promptdirector-selection-toolbar-empty.png"))
+ library.set_viewport_size({"width": 1440, "height": 900})
library.locator("#selection-select-filtered").click()
expect(library.locator("#selection-clear")).to_be_enabled()
expect(library.locator("#share-count")).to_have_text("已选 2")
- expect(library.locator("#selection-select-filtered")).to_have_text("全选当前(2)")
+ expect(library.locator("#selection-select-filtered")).to_be_hidden()
+ expect(library.locator("#selection-selected-actions")).to_be_visible()
+ expect(library.locator("#selection-label-menu")).to_be_visible()
+ expect(library.locator("#selection-project-menu")).to_be_visible()
+ expect(library.locator("#selection-more-menu")).to_be_visible()
+ library.locator("#case-list > .case-card").first.click()
+ expect(library.locator("#share-count")).to_have_text("已选 1")
+ library.locator("#selection-more-menu > summary").click()
+ expect(library.locator("#selection-combine")).to_be_disabled()
+ expect(library.locator("#selection-analyze")).to_be_enabled()
+ expect(library.locator("#selection-trash")).to_be_enabled()
+ library.locator("#selection-more-menu > summary").press("Escape")
+ library.locator("#case-list > .case-card").first.click()
+ expect(library.locator("#share-count")).to_have_text("已选 2")
+ label_menu = library.locator("#selection-label-menu")
+ label_menu.locator(":scope > summary").click()
+ expect(library.locator("#selection-label-input")).to_be_visible()
+ library.locator("#selection-label-input").press("Escape")
+ expect(label_menu).not_to_have_attribute("open", "")
+ expect(label_menu.locator(":scope > summary")).to_be_focused()
+ library.locator("#selection-project-menu > summary").click()
+ expect(library.locator("#selection-project-target")).to_be_visible()
+ library.locator("#selection-project-target").select_option("collection:navigation")
+ expect(library.locator("#selection-add-project")).to_be_enabled()
+ library.locator("#selection-project-menu > summary").press("Escape")
+ library.locator("#selection-more-menu > summary").click()
+ expect(library.locator("#selection-combine")).to_be_enabled()
+ expect(library.locator("#selection-analyze")).to_be_enabled()
+ expect(library.locator("#selection-trash")).to_be_enabled()
+ library.locator("#selection-more-menu > summary").press("Escape")
+ library.set_viewport_size({"width": 700, "height": 900})
+ compact_desktop = library.locator("#share-bar").evaluate(
+ "node => { const rect = node.getBoundingClientRect(); return {left: rect.left, right: rect.right, height: rect.height, viewport: innerWidth, overflow: document.documentElement.scrollWidth > document.documentElement.clientWidth}; }"
+ )
+ assert compact_desktop["left"] >= 0 and compact_desktop["right"] <= compact_desktop["viewport"], compact_desktop
+ assert compact_desktop["height"] <= 34 and compact_desktop["overflow"] is False, compact_desktop
+ library.set_viewport_size({"width": 1658, "height": 900})
+ cancel_metrics = library.locator("#share-cancel").evaluate(
+ "node => { const rect = node.getBoundingClientRect(); const style = getComputedStyle(node); return {text: node.textContent, left: rect.left, right: rect.right, width: rect.width, clientWidth: node.clientWidth, scrollWidth: node.scrollWidth, flexShrink: style.flexShrink, paddingLeft: style.paddingLeft, paddingRight: style.paddingRight}; }"
+ )
+ assert cancel_metrics["scrollWidth"] <= cancel_metrics["clientWidth"], cancel_metrics
+ library.screenshot(path=str(screenshots / "promptdirector-selection-toolbar-active.png"))
+ library.set_viewport_size({"width": 1440, "height": 900})
library.locator("#selection-clear").click()
- expect(library.locator("#selection-clear")).to_be_disabled()
expect(library.locator("#share-count")).to_have_text("已选 0")
+ expect(library.locator("#selection-selected-actions")).to_be_hidden()
+ expect(library.locator("#selection-select-filtered")).to_be_visible()
expect(library.locator(".case-card.selected-for-share")).to_have_count(0)
library.locator("#share-cancel").click()
expect(library.locator("#manage-project-order")).to_be_enabled()
@@ -163,6 +255,23 @@ def main() -> None:
)
assert overflow is False, overflow_nodes
library.screenshot(path=str(screenshots / "promptdirector-step2-library-mobile.png"), full_page=True)
+ library.evaluate("document.querySelector('#toggle-filters').click()")
+ expect(library.locator(".workspace")).to_have_class("workspace filters-collapsed")
+ library.locator("#select-cases").click()
+ expect(library.locator("#selection-selected-actions")).to_be_hidden()
+ mobile_empty_bar = library.locator("#share-bar").evaluate(
+ "node => { const rect = node.getBoundingClientRect(); return {left: rect.left, right: rect.right, bottom: rect.bottom, viewportWidth: innerWidth, viewportHeight: innerHeight}; }"
+ )
+ assert mobile_empty_bar["left"] >= 0 and mobile_empty_bar["right"] <= mobile_empty_bar["viewportWidth"], mobile_empty_bar
+ assert mobile_empty_bar["bottom"] <= mobile_empty_bar["viewportHeight"], mobile_empty_bar
+ library.screenshot(path=str(screenshots / "promptdirector-selection-toolbar-mobile-empty.png"))
+ library.locator("#case-list > .case-card").first.click()
+ expect(library.locator("#selection-selected-actions")).to_be_visible()
+ expect(library.locator("#selection-select-filtered")).to_be_hidden()
+ mobile_overflow = library.evaluate("document.documentElement.scrollWidth > document.documentElement.clientWidth")
+ assert mobile_overflow is False
+ library.screenshot(path=str(screenshots / "promptdirector-selection-toolbar-mobile-active.png"))
+ library.locator("#share-cancel").click()
print({
"workspace_items": 3,
@@ -171,7 +280,12 @@ def main() -> None:
"mobile_drawer": drawer,
"mobile_overflow": overflow,
"wall": wall,
+ "hover_states": hover_states,
"screenshots": [
+ str(screenshots / "promptdirector-selection-toolbar-empty.png"),
+ str(screenshots / "promptdirector-selection-toolbar-active.png"),
+ str(screenshots / "promptdirector-selection-toolbar-mobile-empty.png"),
+ str(screenshots / "promptdirector-selection-toolbar-mobile-active.png"),
str(screenshots / "promptdirector-step2-library-desktop.png"),
str(screenshots / "promptdirector-step2-library-mobile.png"),
],
diff --git a/test/local-index-maintenance-ui.test.js b/test/local-index-maintenance-ui.test.js
index 218a0c2..523e2fe 100644
--- a/test/local-index-maintenance-ui.test.js
+++ b/test/local-index-maintenance-ui.test.js
@@ -2,27 +2,42 @@ import test from "node:test";
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
-const [html, source] = await Promise.all([
+const [html, source, background] = await Promise.all([
readFile(new URL("../library.html", import.meta.url), "utf8"),
- readFile(new URL("../library.js", import.meta.url), "utf8")
+ readFile(new URL("../library.js", import.meta.url), "utf8"),
+ readFile(new URL("../background.js", import.meta.url), "utf8")
]);
-test("local index maintenance explains its result and has no decorative progress bar", () => {
+test("local index maintenance explains automatic local completion and has no decorative progress bar", () => {
const card = html.slice(html.indexOf('<div class="batch-card local-index-card">'), html.indexOf('id="legacy-candidates"'));
- assert.match(card, /补全资料索引/);
- assert.match(card, /补齐导入案例的内容类型和图片色卡,用于分类筛选、颜色展示和相似资料匹配;全程在本机运行,不调用 AI。/);
+ assert.match(card, /资料索引自动补全/);
+ assert.match(card, /每次导入后会在本机自动补齐内容类型和图片色卡,不调用 AI/);
assert.match(card, /id="preview-reanalyze"[^>]*>检查缺失项/);
- assert.match(card, /id="apply-reanalyze"[^>]*hidden>开始补全/);
+ assert.match(card, /id="apply-reanalyze"[^>]*hidden[^>]*>开始补全/);
assert.doesNotMatch(card, /<progress|maintenance-progress/);
});
test("local index maintenance exposes checked, running, complete, and failed text states", () => {
const manager = source.slice(source.indexOf("function renderBatchManager"), source.indexOf("function renderAnalysisSettings"));
const status = source.slice(source.indexOf("function renderReanalysisPreview"), source.indexOf("function updateLibrarySettingsSaveState"));
- assert.match(manager, /reanalysisPreview \|\| maintenanceJob \? "重新检查" : "检查缺失项"/);
+ assert.match(manager, /t\(reanalysisPreview \|\| maintenanceJob \? "重新检查" : "检查缺失项"\)/);
assert.match(manager, /elements\.applyReanalyze\.hidden = maintenanceActive \|\| !maintenanceMissing/);
assert.match(status, /资料索引已完整/);
assert.match(status, /待补全:\$\{reanalysisPreview\.confirmed\} 条内容类型,\$\{reanalysisPreview\.paletteCount\} 张图片色卡/);
- assert.match(status, /已处理 \$\{maintenanceJob\.processed\}\/\$\{maintenanceJob\.total\}/);
- assert.match(status, /成功 \$\{maintenanceJob\.succeeded\} · 失败 \$\{maintenanceJob\.failed\}/);
+ assert.match(status, /t\("\{status\} · 已处理 \{processed\}\/\{total\} · 成功 \{succeeded\} · 失败 \{failed\}"/);
+ assert.match(status, /processed: maintenanceJob\.processed/);
+ assert.match(status, /succeeded: maintenanceJob\.succeeded/);
+});
+
+test("every material import queues local index completion without coupling it to AI", () => {
+ const localImport = background.slice(background.indexOf("async function importStagedItem"), background.indexOf("function importedEntryFromStagedAsset"));
+ const packageImport = background.slice(background.indexOf("async function applyLibraryImport"), background.indexOf("function previewCuratedImport"));
+ const curatedImport = background.slice(background.indexOf("async function applyCuratedImport"), background.indexOf("function curatedImportResponse"));
+ const automaticCompletion = background.slice(background.indexOf("async function enqueueAutomaticLibraryMaintenance"), background.indexOf("async function libraryMaintenanceStatus"));
+
+ assert.match(localImport, /enqueueAutomaticLibraryMaintenance\(\[entry\]\)/);
+ assert.match(packageImport, /enqueueAutomaticLibraryMaintenance/);
+ assert.match(curatedImport, /enqueueAutomaticLibraryMaintenance/);
+ assert.match(automaticCompletion, /libraryMaintenanceTargets/);
+ assert.doesNotMatch(automaticCompletion, /Vision|AI|queueAutomaticVisionAnalysis/);
});
diff --git a/test/page-shell-layout.test.js b/test/page-shell-layout.test.js
index 3e266c6..6d611c9 100644
--- a/test/page-shell-layout.test.js
+++ b/test/page-shell-layout.test.js
@@ -10,10 +10,10 @@ function rule(source, selector) {
return source.match(new RegExp(`(?:^|\\n)\\s*${escaped}\\s*\\{([^}]+)\\}`))?.[1] ?? "";
}
-test("hidden sidebar filter tools fully collapse and project selection mode closes its top gap", () => {
- assert.match(libraryCss, /\.sidebar-filter-tools\s*\{[^}]*display:\s*none/);
- assert.match(libraryCss, /\.sidebar-filter-tools:has\(#active-filter-badge:not\(\[hidden\]\)\)\s*\{[^}]*display:\s*flex/);
- assert.doesNotMatch(libraryCss, /sidebar-filter-tools:has\(#clear-filters/);
+test("project filters keep a stable heading and project selection mode closes its top gap", () => {
+ assert.doesNotMatch(libraryCss, /sidebar-filter-tools|active-filter-badge/);
+ assert.doesNotMatch(libraryCss, /\.filter-heading #clear-filters/);
+ assert.match(libraryCss, /\.filter-heading #create-collection[^}]*display:\s*inline-flex/);
const selectionRule = rule(libraryCss, ".gallery-heading.project-selection-mode");
assert.match(selectionRule, /top:\s*64px/);
assert.match(selectionRule, /margin-top:\s*-8px/);
diff --git a/test/page_capture_e2e.py b/test/page_capture_e2e.py
index 34e1e33..01646e3 100644
--- a/test/page_capture_e2e.py
+++ b/test/page_capture_e2e.py
@@ -1,5 +1,8 @@
from __future__ import annotations
+import tempfile
+from pathlib import Path
+
from playwright.sync_api import expect
from e2e_support import extension_session
@@ -55,6 +58,7 @@ def list_page(page: int) -> bytes:
def main() -> None:
with extension_session("prompt-director-page-capture-") as run:
+ screenshots = Path(tempfile.gettempdir())
fixture_url = f"{FIXTURE_ORIGIN}/promptdirector-capture-fixture"
def route_fixture(route) -> None:
request_url = route.request.url
@@ -81,6 +85,7 @@ def main() -> None:
run.context.route(f"{FIXTURE_ORIGIN}/**", route_fixture)
collector = run.open_page("collector.html", wait_until="networkidle")
+ collector.set_viewport_size({"width": 390, "height": 844})
run.seed_storage(collector, {
"schemaVersion": 24,
"entries": [],
@@ -94,9 +99,35 @@ def main() -> None:
fixture.goto(fixture_url, wait_until="networkidle")
fixture.bring_to_front()
+ capture_entry_boxes = collector.locator("#normal-start .capture-actions > button").evaluate_all(
+ "nodes => nodes.map(node => ({top: node.getBoundingClientRect().top, height: node.getBoundingClientRect().height}))"
+ )
+ assert len(capture_entry_boxes) == 3, capture_entry_boxes
+ assert all(item["height"] >= 58 for item in capture_entry_boxes), capture_entry_boxes
+ assert capture_entry_boxes[0]["top"] < capture_entry_boxes[1]["top"] < capture_entry_boxes[2]["top"], capture_entry_boxes
+ collector.screenshot(path=str(screenshots / "promptdirector-collector-entry-390.png"), full_page=True)
+ collector.evaluate("() => document.querySelector('#capture-permission-onboarding').showModal()")
+ permission_layout = collector.locator("#capture-permission-onboarding").evaluate(
+ "node => ({height: node.getBoundingClientRect().height, viewport: innerHeight, buttons: node.querySelectorAll('footer button').length})"
+ )
+ assert permission_layout["height"] <= permission_layout["viewport"] and permission_layout["buttons"] == 2, permission_layout
+ collector.screenshot(path=str(screenshots / "promptdirector-capture-permission-390.png"), full_page=True)
+ collector.evaluate("() => document.querySelector('#capture-permission-onboarding').close()")
+
collector.evaluate("() => document.querySelector('#start-page-capture').click()")
expect(collector.locator("#page-capture")).to_be_visible(timeout=8000)
+ expect(collector.locator("#preview-state")).to_be_hidden()
+ assert collector.locator("#page-capture > #capture-metadata").count() == 1
expect(collector.locator(".page-capture-item")).to_have_count(2)
+ expect(collector.locator(".page-capture-preview-details").first).not_to_have_attribute("open", "")
+ scroll_owners = collector.evaluate(
+ """() => Object.fromEntries(['#page-capture-list', '#page-capture-media-review-list', '.page-capture-article'].map(selector => {
+ const node = document.querySelector(selector);
+ return [selector, node ? getComputedStyle(node).overflowY : 'missing'];
+ }))"""
+ )
+ assert all(value not in {"missing", "auto", "scroll"} for value in scroll_owners.values()), scroll_owners
+ collector.screenshot(path=str(screenshots / "promptdirector-page-capture-390.png"), full_page=True)
media_labels = collector.locator(".page-capture-article-media").all_text_contents()
media_sources = collector.locator(".page-capture-article-media img").evaluate_all("nodes => nodes.map(node => node.src)")
assert len(media_labels) == 5, {"labels": media_labels, "sources": media_sources}
@@ -113,6 +144,7 @@ def main() -> None:
assert collector.evaluate("() => chrome.storage.local.get('entries').then(({entries}) => entries.length)") == 0
expect(collector.locator("#page-capture-save")).to_be_disabled()
+ collector.locator(".page-capture-preview-details").first.locator(":scope > summary").click()
collector.locator(".page-capture-article-media").first.click()
expect(collector.locator("#page-capture-media-viewer")).to_be_visible()
expect(collector.locator("#page-capture-media-stage img")).to_be_visible()
@@ -130,6 +162,7 @@ def main() -> None:
expect(collector.locator(".page-capture-media-review-group")).to_contain_text("可能遗漏媒体(1)")
expect(collector.locator("#page-capture-save")).to_have_text("保存案例 · 含 5 项媒体")
expect(collector.locator("#page-capture-save")).to_be_enabled()
+ collector.locator(".page-capture-tools > summary").click()
collector.locator("#page-capture-add-region").click()
fixture.bring_to_front()
expect(fixture.locator("#promptdirector-page-capture-region-editor")).to_be_visible(timeout=8000)
@@ -255,7 +288,7 @@ def main() -> None:
assert {asset.get("originalWorkUrl") for asset in combined_saved[0]["mediaAssets"]} == {
f"{FIXTURE_ORIGIN}/work/1", f"{FIXTURE_ORIGIN}/work/2", f"{FIXTURE_ORIGIN}/work/3"
}, combined_saved[0]
- print({"previewCandidates": 2, "mediaViewerItems": 5, "confirmedSubjects": 1, "savedWholeCaseMedia": 6, "savedLiveSelectionMedia": 0, "paginatedCases": 3, "combinedCases": 1, "clearedPageMarkers": 1})
+ print({"previewCandidates": 2, "mediaViewerItems": 5, "confirmedSubjects": 1, "savedWholeCaseMedia": 6, "savedLiveSelectionMedia": 0, "paginatedCases": 3, "combinedCases": 1, "clearedPageMarkers": 1, "permissionLayout": permission_layout, "scrollOwners": scroll_owners, "screenshots": [str(screenshots / "promptdirector-collector-entry-390.png"), str(screenshots / "promptdirector-capture-permission-390.png"), str(screenshots / "promptdirector-page-capture-390.png")]})
if __name__ == "__main__":
diff --git a/test/projects_and_categories_e2e.py b/test/projects_and_categories_e2e.py
index 7155609..2bc8c95 100644
--- a/test/projects_and_categories_e2e.py
+++ b/test/projects_and_categories_e2e.py
@@ -121,6 +121,7 @@ def main() -> None:
expect(library.locator("#manage-project-order")).to_have_attribute("title", "结束案例选择后可排序项目")
library.locator(".case-card").nth(0).click()
library.locator(".case-card").nth(1).click()
+ library.locator("#selection-more-menu > summary").click()
library.locator("#selection-combine").click()
combine_dialog = library.locator("#promptdirector-app-dialog")
expect(combine_dialog).to_be_visible()
diff --git a/test/run_e2e.py b/test/run_e2e.py
index 430fbe6..d31de2f 100644
--- a/test/run_e2e.py
+++ b/test/run_e2e.py
@@ -51,6 +51,8 @@ SCRIPTS = [
"material_management_regressions_e2e.py",
"ui_regressions_e2e.py",
"settings_visual_anchor_e2e.py",
+ "brand_i18n_e2e.py",
+ "english_interaction_states_e2e.py",
]
diff --git a/test/settings_visual_anchor_e2e.py b/test/settings_visual_anchor_e2e.py
index a1efe9c..cabc6f6 100644
--- a/test/settings_visual_anchor_e2e.py
+++ b/test/settings_visual_anchor_e2e.py
@@ -75,8 +75,8 @@ def exercise_settings(page, viewport: dict) -> None:
page.locator('[data-settings-tab="tasks"]').click()
local_index = page.locator(".local-index-card")
- expect(local_index).to_contain_text("补全资料索引")
- expect(local_index).to_contain_text("全程在本机运行,不调用 AI")
+ expect(local_index).to_contain_text("资料索引自动补全")
+ expect(local_index).to_contain_text("会在本机自动补齐内容类型和图片色卡,不调用 AI")
expect(local_index.locator("progress")).to_have_count(0)
expect(local_index.locator("#apply-reanalyze")).to_be_hidden()
page.locator("#preview-reanalyze").click()
diff --git a/test/share-preview.test.js b/test/share-preview.test.js
index 877e60f..2b096f3 100644
--- a/test/share-preview.test.js
+++ b/test/share-preview.test.js
@@ -47,7 +47,15 @@ test("share preview uses the current visual foundation and exposes the read-only
assert.match(html, /<symbol id="icon-x"/);
assert.match(html, /<use href="#icon-x">/);
assert.match(html, /--visual-wall-gap:2px;--visual-card-radius:2px/);
+ assert.match(html, /\.case-card:hover,\.related-card:hover\{box-shadow:none\}/);
+ assert.match(html, /\.case-card::after,\.related-card::after\{[^}]*border:1px solid transparent/);
+ assert.match(html, /\.case-card:focus-visible::after,\.related-card:focus-visible::after\{[^}]*border-width:2px/);
+ assert.match(html, /\.fallback-cover\.audio\{background:linear-gradient\(160deg,var\(--ui-raised\),var\(--ui-surface\)\)\}/);
+ assert.match(html, /\.eyebrow,\.fallback-cover small,[^}]*\{color:var\(--ui-text\)\}/);
assert.match(html, /设置 → 界面与资料库 → 导入分享包/);
+ assert.match(html, /data-zh="视觉创作灵感库" data-en="Visual Inspiration Library"/);
+ assert.match(html, /提示词导演,你的视觉创作私人灵感库。/);
+ assert.match(html, /class="app-footer"/);
assert.match(html, /安装到 Chrome/);
assert.match(html, /chromewebstore\.google\.com\/detail\/iahakaahijddcjjldidbclicedibgpjm/);
assert.match(html, /查看源码/);
@@ -89,10 +97,19 @@ test("share preview can start in English dark mode without changing case text",
], { libraryTitle: "私人项目" }, createDefaultTaxonomy(), createDefaultFacetCatalog(), { ...previewOptions, locale: "en", theme: "dark" });
assert.match(html, /<html lang="en" data-locale="en" data-theme="dark">/);
assert.match(html, /This is a read-only package that works offline/);
+ assert.match(html, />Visual Inspiration Library</);
+ assert.match(html, />PromptDirector, your private visual inspiration library\.</);
assert.match(html, /用户标题/);
assert.match(html, /用户提示词/);
});
+test("English share preview resolves only system library titles", () => {
+ const systemHtml = renderSharePreviewHtml([], { libraryTitle: "视觉创作灵感库" }, createDefaultTaxonomy(), createDefaultFacetCatalog(), { ...previewOptions, locale: "en" });
+ const customHtml = renderSharePreviewHtml([], { libraryTitle: "我的导演项目" }, createDefaultTaxonomy(), createDefaultFacetCatalog(), { ...previewOptions, locale: "en" });
+ assert.match(systemHtml, /<h1>Visual Inspiration Library<\/h1>/);
+ assert.match(customHtml, /<h1>我的导演项目<\/h1>/);
+});
+
test("share preview renders every portable media kind and its time notes", () => {
const html = renderSharePreviewHtml([{
id: "mixed",
diff --git a/test/stable-masonry.test.js b/test/stable-masonry.test.js
index 19f92ea..ef0a81c 100644
--- a/test/stable-masonry.test.js
+++ b/test/stable-masonry.test.js
@@ -221,3 +221,150 @@ test("custom scroll container owns visibility tracking and anchor restoration",
Object.assign(globalThis, originals);
}
});
+
+test("reset keeps the committed wall height while replacement cards are measured", () => {
+ const originals = {
+ HTMLElement: globalThis.HTMLElement,
+ ResizeObserver: globalThis.ResizeObserver,
+ cancelAnimationFrame: globalThis.cancelAnimationFrame,
+ getComputedStyle: globalThis.getComputedStyle,
+ requestAnimationFrame: globalThis.requestAnimationFrame,
+ window: globalThis.window
+ };
+ const frames = [];
+
+ class FakeElement {
+ constructor(height = 0) {
+ this.height = height;
+ this.dataset = {};
+ this.style = {};
+ this.isConnected = true;
+ }
+ getBoundingClientRect() {
+ const top = Number.parseFloat(this.style.top || "0");
+ return { top, bottom: top + this.height, height: this.height };
+ }
+ }
+
+ const cards = [new FakeElement(120), new FakeElement(140)];
+ const container = new FakeElement();
+ container.style.height = "260px";
+ Object.defineProperty(container, "clientWidth", {
+ get() { return container.style.height === "0px" ? 615 : 600; }
+ });
+ container.querySelectorAll = () => cards;
+
+ globalThis.HTMLElement = FakeElement;
+ globalThis.ResizeObserver = class { observe() {} disconnect() {} };
+ globalThis.requestAnimationFrame = (callback) => {
+ frames.push(callback);
+ return frames.length;
+ };
+ globalThis.cancelAnimationFrame = () => undefined;
+ globalThis.getComputedStyle = () => ({
+ getPropertyValue: (name) => name === "--masonry-card-min-width" ? "270" : "12"
+ });
+ globalThis.window = {
+ addEventListener() {}, removeEventListener() {}, innerHeight: 800, innerWidth: 1000,
+ scrollBy() {}, scrollY: 0
+ };
+
+ try {
+ const masonry = createStableMasonry(container);
+ masonry.reset();
+ assert.equal(container.style.height, "260px");
+ masonry.append(cards);
+ assert.equal(cards[0].style.width, "294px");
+ assert.equal(cards[1].style.left, "306px");
+ assert.equal(cards[1].style.width, "294px");
+ assert.equal(container.style.height, "140px");
+ frames.shift()?.();
+ assert.equal(cards[1].style.width, "294px");
+ masonry.destroy();
+ } finally {
+ Object.assign(globalThis, originals);
+ }
+});
+
+test("scrollbar-sized container width changes are rechecked and corrected on the next frame", () => {
+ const originals = {
+ HTMLElement: globalThis.HTMLElement,
+ ResizeObserver: globalThis.ResizeObserver,
+ cancelAnimationFrame: globalThis.cancelAnimationFrame,
+ getComputedStyle: globalThis.getComputedStyle,
+ requestAnimationFrame: globalThis.requestAnimationFrame,
+ window: globalThis.window
+ };
+ const frames = [];
+ const observers = [];
+ let width = 600;
+
+ class FakeElement {
+ constructor(height = 0) {
+ this.height = height;
+ this.dataset = {};
+ this.style = {};
+ this.isConnected = true;
+ }
+ getBoundingClientRect() {
+ const top = Number.parseFloat(this.style.top || "0");
+ return { top, bottom: top + this.height, height: this.height };
+ }
+ }
+
+ const cards = [new FakeElement(120), new FakeElement(140)];
+ const container = new FakeElement();
+ Object.defineProperty(container, "clientWidth", { get: () => width });
+ container.querySelectorAll = () => cards;
+
+ globalThis.HTMLElement = FakeElement;
+ globalThis.ResizeObserver = class {
+ constructor(callback) {
+ this.callback = callback;
+ this.targets = new Set();
+ observers.push(this);
+ }
+ observe(target) { this.targets.add(target); }
+ unobserve(target) { this.targets.delete(target); }
+ disconnect() { this.targets.clear(); }
+ };
+ globalThis.requestAnimationFrame = (callback) => {
+ frames.push(callback);
+ return frames.length;
+ };
+ globalThis.cancelAnimationFrame = () => undefined;
+ globalThis.getComputedStyle = () => ({
+ getPropertyValue: (name) => name === "--masonry-card-min-width" ? "270" : "12"
+ });
+ globalThis.window = {
+ addEventListener() {}, removeEventListener() {}, innerHeight: 800, innerWidth: 1000,
+ scrollBy() {}, scrollY: 0
+ };
+
+ try {
+ const masonry = createStableMasonry(container);
+ masonry.append(cards);
+ while (frames.length) frames.shift()?.();
+ const containerObserver = observers.find((observer) => observer.targets.has(container));
+ assert.ok(containerObserver);
+ assert.equal(cards[0].style.width, "294px");
+
+ width = 615;
+ containerObserver.callback([{ target: container }]);
+ assert.equal(cards[0].style.width, "294px");
+ width = 600;
+ frames.shift()?.();
+ assert.equal(cards[0].style.width, "294px");
+
+ width = 615;
+ containerObserver.callback([{ target: container }]);
+ assert.equal(cards[0].style.width, "294px");
+ frames.shift()?.();
+ assert.equal(cards[0].style.width, "301.5px");
+ assert.equal(cards[1].style.left, "313.5px");
+ assert.equal(Number.parseFloat(cards[1].style.left) + Number.parseFloat(cards[1].style.width), 615);
+ masonry.destroy();
+ } finally {
+ Object.assign(globalThis, originals);
+ }
+});
diff --git a/test/theme-bootstrap.test.js b/test/theme-bootstrap.test.js
index 2a2a49a..e1263c6 100644
--- a/test/theme-bootstrap.test.js
+++ b/test/theme-bootstrap.test.js
@@ -24,6 +24,7 @@ test("theme bootstrap resolves a real first-paint background and color scheme be
assert.match(bootstrap, /root\.dataset\.theme !== theme/);
assert.match(bootstrap, /: "dark"/);
assert.match(bootstrap, /"#0f1113"/);
+ assert.match(bootstrap, /"#e2e6e3"/);
assert.match(bootstrap, /storedMotion === "none"[\s\S]*?"reduced"/);
});
diff --git a/test/transient-menu.test.js b/test/transient-menu.test.js
index 58210c3..d53e89a 100644
--- a/test/transient-menu.test.js
+++ b/test/transient-menu.test.js
@@ -13,7 +13,7 @@ test("transient menus share outside-click, action, peer-open, and Escape dismiss
assert.match(source, /event\.key !== "Escape"/);
assert.match(source, /closest\("button, a\[href\]"\)/);
assert.match(source, /!action\.closest\("\.package-preferences"\)/);
- assert.match(library, /bindTransientMenus\(document, "\.package-menu, \.project-menu, \.detail-analysis-menu, \.detail-project-menu"\)/);
+ assert.match(library, /bindTransientMenus\(document, "\.package-menu, \.project-menu, \.detail-analysis-menu, \.detail-project-menu, \.selection-menu"\)/);
assert.match(composer, /bindTransientMenus\(document, "\.composer-options, \.composer-session-menu"\)/);
assert.doesNotMatch(composer, /\.composer-result-more/);
});
diff --git a/test/ui-foundation.test.js b/test/ui-foundation.test.js
index 6ff6132..2403379 100644
--- a/test/ui-foundation.test.js
+++ b/test/ui-foundation.test.js
@@ -5,6 +5,26 @@ import { readFile } from "node:fs/promises";
const foundation = await readFile(new URL("../ui-foundation.css", import.meta.url), "utf8");
const sprite = await readFile(new URL("../assets/ui-icons.svg", import.meta.url), "utf8");
+function relativeLuminance(hex) {
+ const channels = hex.match(/[a-f\d]{2}/gi).map((value) => parseInt(value, 16) / 255);
+ const linear = channels.map((value) => value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4);
+ return (0.2126 * linear[0]) + (0.7152 * linear[1]) + (0.0722 * linear[2]);
+}
+
+function contrast(foreground, background) {
+ const values = [relativeLuminance(foreground), relativeLuminance(background)].sort((a, b) => b - a);
+ return (values[0] + 0.05) / (values[1] + 0.05);
+}
+
+function mix(foreground, background, foregroundWeight) {
+ const parse = (hex) => hex.match(/[a-f\d]{2}/gi).map((value) => parseInt(value, 16));
+ const foregroundChannels = parse(foreground);
+ const backgroundChannels = parse(background);
+ return `#${foregroundChannels.map((value, index) => Math.round(
+ (value * foregroundWeight) + (backgroundChannels[index] * (1 - foregroundWeight))
+ ).toString(16).padStart(2, "0")).join("")}`;
+}
+
test("shared visual foundation owns the locked dark theme and control scale", () => {
assert.match(foundation, /--ui-browser:\s*#0f1113/);
assert.match(foundation, /--ui-page:\s*#131416/);
@@ -23,6 +43,46 @@ test("shared visual foundation owns the locked dark theme and control scale", ()
assert.match(foundation, /text-decoration:\s*none/);
});
+test("light theme uses the calibrated neutral surfaces and semantic green hierarchy", () => {
+ for (const [token, value] of Object.entries({
+ "ui-browser": "#e2e6e3",
+ "ui-page": "#edf0ed",
+ "ui-surface": "#f8f9f8",
+ "ui-raised": "#e5e9e6",
+ "ui-hover": "#dce2de",
+ "ui-text": "#121714",
+ "ui-muted": "#5b645e",
+ "ui-accent": "#d1fe17"
+ })) {
+ assert.match(foundation, new RegExp(`--${token}:\\s*${value}`));
+ }
+ assert.ok(contrast("#121714", "#edf0ed") >= 4.5);
+ assert.ok(contrast("#5b645e", "#dce2de") >= 4.5);
+ assert.ok(contrast("#0f1113", "#d1fe17") >= 4.5);
+ assert.ok(contrast("#121714", mix("#d1fe17", "#f8f9f8", 0.16)) >= 4.5);
+ assert.match(foundation, /--ui-accent-emphasis:\s*var\(--ui-accent\)/);
+ assert.match(foundation, /--ui-accent-emphasis-contrast:\s*var\(--ui-accent-contrast\)/);
+ assert.match(foundation, /--ui-selected-surface:\s*color-mix\(in srgb, var\(--ui-accent\) 16%, var\(--ui-surface\)\)/);
+ assert.match(foundation, /--ui-project-active-surface:\s*var\(--ui-selected-surface\)/);
+ assert.match(foundation, /--ui-content-active-surface:\s*var\(--ui-selected-surface\)/);
+ assert.match(foundation, /--ui-card-border:\s*var\(--ui-border-weak\)/);
+ assert.match(foundation, /--accent-ink:\s*var\(--ui-text\)/);
+ assert.match(foundation, /--ui-focus:\s*var\(--ui-accent-emphasis\)/);
+ assert.match(foundation, /--ui-primary-border:\s*transparent/);
+ assert.match(foundation, /button,\s*\.button-primary,\s*\.button-secondary\s*\{[\s\S]*?border:\s*1px solid transparent/);
+ assert.doesNotMatch(foundation, /#526900/i);
+ assert.match(foundation, /:root\[data-theme="dark"\][\s\S]*--ui-accent-emphasis:\s*var\(--ui-accent\)/);
+ assert.match(foundation, /\.quiet-danger\s*\{[\s\S]*color:\s*var\(--ui-danger\)[\s\S]*background:\s*transparent/);
+});
+
+test("light fields use one neutral edge with a soft branded halo while dark focus stays unchanged", () => {
+ assert.match(foundation, /--ui-field-focus-border:\s*var\(--ui-border-strong\)/);
+ assert.match(foundation, /--ui-field-focus-outline:\s*none/);
+ assert.match(foundation, /--ui-field-focus-shadow:\s*0 0 0 2px var\(--ui-accent-subtle\)/);
+ assert.match(foundation, /input:focus-visible,\s*select:focus-visible,\s*textarea:focus-visible\s*\{[\s\S]*?border-color:\s*var\(--ui-field-focus-border\)[\s\S]*?outline:\s*var\(--ui-field-focus-outline\)[\s\S]*?box-shadow:\s*var\(--ui-field-focus-shadow\)/);
+ assert.match(foundation, /:root\[data-theme="dark"\][\s\S]*?--ui-field-focus-border:\s*var\(--ui-border\)[\s\S]*?--ui-field-focus-outline:\s*2px solid var\(--ui-focus\)[\s\S]*?--ui-field-focus-shadow:\s*none/);
+});
+
test("page styles keep domain layout without redefining shared theme roles", async () => {
for (const pageStyle of ["library.css", "curated.css", "collector.css", "skills-page.css", "composer-page.css"]) {
const source = await readFile(new URL(`../${pageStyle}`, import.meta.url), "utf8");
@@ -32,6 +92,13 @@ test("page styles keep domain layout without redefining shared theme roles", asy
}
});
+test("brand green is reserved for fills and indicators instead of light-theme copy", async () => {
+ for (const sourceFile of ["ui-foundation.css", "library.css", "curated.css", "collector.css", "skills-page.css", "composer-page.css", "share-preview.js"]) {
+ const source = await readFile(new URL(`../${sourceFile}`, import.meta.url), "utf8");
+ assert.doesNotMatch(source, /(?:^|[;{])\s*color:\s*var\(--(?:ui-)?accent-emphasis\)/m, `${sourceFile} 不应把品牌荧光绿直接用于文字`);
+ }
+});
+
test("local Lucide sprite contains the shared navigation and action icons", () => {
assert.match(sprite, /lucide-static/);
for (const name of ["arrow-left", "chevron-left", "chevron-right", "check", "menu", "settings", "x"]) {
diff --git a/test/ui_foundation_e2e.py b/test/ui_foundation_e2e.py
index 9468081..97d92b0 100644
--- a/test/ui_foundation_e2e.py
+++ b/test/ui_foundation_e2e.py
@@ -99,20 +99,38 @@ def main() -> None:
"""async () => chrome.storage.local.set({
organizerState: {version: 5, collections: [
{id: 'collection:combobox-one', name: '优质精选', order: 0, entryIds: [], visibility: 'library'},
- {id: 'collection:combobox-two', name: 'AIArtWorks · MJ 精选', order: 1, entryIds: [], visibility: 'library'}
+ {id: 'collection:combobox-two', name: 'AIArtWorks · MJ 精选', order: 1, entryIds: [], visibility: 'library'},
+ ...Array.from({length: 8}, (_, index) => ({
+ id: `collection:combobox-${index + 3}`,
+ name: index === 7 ? '用于验证完整换行显示的特别长项目名称' : `导演项目 ${index + 3}`,
+ order: index + 2,
+ entryIds: [],
+ visibility: 'library'
+ }))
]}
})"""
)
library.reload(wait_until="networkidle")
- library.set_viewport_size({"width": 560, "height": 620})
+ library.set_viewport_size({"width": 560, "height": 800})
library.locator("#add-menu > summary").click()
+ add_note_alignment = library.locator("#add-quick-note").evaluate(
+ """node => {
+ const button = node.getBoundingClientRect();
+ const title = node.querySelector('strong').getBoundingClientRect();
+ const style = getComputedStyle(node);
+ return {justifyContent: style.justifyContent, textAlign: style.textAlign, buttonLeft: button.left, titleLeft: title.left, paddingLeft: parseFloat(style.paddingLeft)};
+ }"""
+ )
+ assert add_note_alignment["justifyContent"] in {"start", "flex-start"}, add_note_alignment
+ assert add_note_alignment["textAlign"] == "left", add_note_alignment
+ assert abs(add_note_alignment["titleLeft"] - add_note_alignment["buttonLeft"] - add_note_alignment["paddingLeft"]) <= 1, add_note_alignment
library.locator("#add-quick-note").click()
project_input = library.locator("#promptdirector-app-dialog-projectName")
expect(project_input).to_have_attribute("role", "combobox")
expect(project_input).to_have_attribute("aria-autocomplete", "list")
project_input.click()
dialog = library.locator("#promptdirector-app-dialog")
- expect(dialog.locator(".project-combobox-option")).to_have_count(2)
+ expect(dialog.locator(".project-combobox-option")).to_have_count(10)
menu_style = dialog.locator(".project-combobox-listbox").evaluate(
"node => ({background: getComputedStyle(node).backgroundColor, border: getComputedStyle(node).borderColor})"
)
@@ -120,14 +138,18 @@ def main() -> None:
quick_note_menu = dialog.locator(".project-combobox-listbox").evaluate(
"""node => {
const menu = node.getBoundingClientRect();
- const boundary = node.closest('.app-dialog-body').getBoundingClientRect();
+ const option = node.querySelector('.project-combobox-option');
const footer = node.closest('form').querySelector('footer').getBoundingClientRect();
- return {placement: node.dataset.placement, top: menu.top, bottom: menu.bottom, boundaryTop: boundary.top, boundaryBottom: boundary.bottom, footerTop: footer.top};
+ const hit = document.elementFromPoint(menu.left + 12, menu.top + 12);
+ return {placement: node.dataset.placement, position: getComputedStyle(node).position, top: menu.top, bottom: menu.bottom, left: menu.left, right: menu.right, viewportWidth: innerWidth, viewportHeight: innerHeight, footerTop: footer.top, optionJustify: getComputedStyle(option).justifyContent, optionTextAlign: getComputedStyle(option).textAlign, hitIsOption: Boolean(hit?.closest?.('.project-combobox-option'))};
}"""
)
assert quick_note_menu["placement"] == "top", quick_note_menu
- assert quick_note_menu["top"] >= quick_note_menu["boundaryTop"] - 1, quick_note_menu
- assert quick_note_menu["bottom"] <= min(quick_note_menu["boundaryBottom"], quick_note_menu["footerTop"]) + 1, quick_note_menu
+ assert quick_note_menu["position"] == "fixed", quick_note_menu
+ assert quick_note_menu["top"] >= 11 and quick_note_menu["bottom"] <= quick_note_menu["footerTop"] + 1, quick_note_menu
+ assert quick_note_menu["left"] >= 11 and quick_note_menu["right"] <= quick_note_menu["viewportWidth"] - 11, quick_note_menu
+ assert quick_note_menu["optionJustify"] in {"start", "flex-start"} and quick_note_menu["optionTextAlign"] == "left", quick_note_menu
+ assert quick_note_menu["hitIsOption"] is True, quick_note_menu
project_input.press("ArrowDown")
project_input.press("Enter")
expect(project_input).to_have_value("优质精选")
@@ -147,14 +169,30 @@ def main() -> None:
video_menu = video_dialog.locator(".project-combobox-listbox").evaluate(
"""node => {
const menu = node.getBoundingClientRect();
- const boundary = node.closest('.app-dialog-body').getBoundingClientRect();
const footer = node.closest('form').querySelector('footer').getBoundingClientRect();
- return {top: menu.top, bottom: menu.bottom, boundaryTop: boundary.top, boundaryBottom: boundary.bottom, footerTop: footer.top};
+ return {top: menu.top, bottom: menu.bottom, left: menu.left, right: menu.right, viewportWidth: innerWidth, footerTop: footer.top};
}"""
)
- assert video_menu["top"] >= video_menu["boundaryTop"] - 1, video_menu
- assert video_menu["bottom"] <= min(video_menu["boundaryBottom"], video_menu["footerTop"]) + 1, video_menu
+ assert video_menu["top"] >= 11 and video_menu["bottom"] <= video_menu["footerTop"] + 1, video_menu
+ assert video_menu["left"] >= 11 and video_menu["right"] <= video_menu["viewportWidth"] - 11, video_menu
video_dialog.get_by_role("button", name="取消", exact=True).click()
+
+ library.set_viewport_size({"width": 390, "height": 844})
+ library.locator("#add-menu > summary").click()
+ library.locator("#add-quick-note").click()
+ mobile_dialog = library.locator("#promptdirector-app-dialog")
+ mobile_dialog.locator("#promptdirector-app-dialog-projectName").click()
+ mobile_menu = mobile_dialog.locator(".project-combobox-listbox").evaluate(
+ """node => {
+ const menu = node.getBoundingClientRect();
+ const footer = node.closest('form').querySelector('footer').getBoundingClientRect();
+ return {top: menu.top, bottom: menu.bottom, left: menu.left, right: menu.right, viewportWidth: innerWidth, viewportHeight: innerHeight, footerTop: footer.top, overflow: document.documentElement.scrollWidth > document.documentElement.clientWidth};
+ }"""
+ )
+ assert mobile_menu["top"] >= 11 and mobile_menu["bottom"] <= min(mobile_menu["footerTop"], mobile_menu["viewportHeight"] - 11) + 1, mobile_menu
+ assert mobile_menu["left"] >= 11 and mobile_menu["right"] <= mobile_menu["viewportWidth"] - 11, mobile_menu
+ assert mobile_menu["overflow"] is False, mobile_menu
+ mobile_dialog.get_by_role("button", name="取消", exact=True).click()
library.set_viewport_size({"width": 1440, "height": 900})
first_page.evaluate(
@@ -182,6 +220,62 @@ def main() -> None:
"selectedMotion": "reduced",
}, migrated
+ light_tokens = light_page.evaluate(
+ """() => {
+ const style = getComputedStyle(document.documentElement);
+ const primary = getComputedStyle(document.querySelector('#start-compose'));
+ const secondary = getComputedStyle(document.querySelector('#add-menu > summary'));
+ return {
+ browser: style.getPropertyValue('--ui-browser').trim(),
+ page: style.getPropertyValue('--ui-page').trim(),
+ surface: style.getPropertyValue('--ui-surface').trim(),
+ raised: style.getPropertyValue('--ui-raised').trim(),
+ hover: style.getPropertyValue('--ui-hover').trim(),
+ text: style.getPropertyValue('--ui-text').trim(),
+ muted: style.getPropertyValue('--ui-muted').trim(),
+ accent: style.getPropertyValue('--ui-accent').trim(),
+ emphasis: style.getPropertyValue('--ui-accent-emphasis').trim(),
+ bodyBackground: getComputedStyle(document.body).backgroundColor,
+ primaryBackground: primary.backgroundColor,
+ primaryBorder: primary.borderColor,
+ secondaryBackground: secondary.backgroundColor
+ };
+ }"""
+ )
+ expected_light_tokens = {
+ "browser": "#e2e6e3",
+ "page": "#edf0ed",
+ "surface": "#f8f9f8",
+ "raised": "#e5e9e6",
+ "hover": "#dce2de",
+ "text": "#121714",
+ "muted": "#5b645e",
+ "accent": "#d1fe17",
+ "emphasis": "#d1fe17",
+ "bodyBackground": "rgb(237, 240, 237)",
+ "primaryBackground": "rgb(209, 254, 23)",
+ "secondaryBackground": "rgb(229, 233, 230)",
+ }
+ for key, expected in expected_light_tokens.items():
+ assert light_tokens[key] == expected, (key, light_tokens)
+ assert light_tokens["primaryBorder"] == "rgba(0, 0, 0, 0)", light_tokens
+ assert light_tokens["secondaryBackground"] != light_tokens["primaryBackground"], light_tokens
+
+ for path in PAGES:
+ page = light_page if path == "library.html" else session.open_page(path, wait_until="networkidle")
+ light_surface = page.evaluate(
+ """() => ({
+ theme: document.documentElement.dataset.theme,
+ bodyBackground: getComputedStyle(document.body).backgroundColor,
+ browserBackground: getComputedStyle(document.documentElement).backgroundColor,
+ horizontalOverflow: document.documentElement.scrollWidth > document.documentElement.clientWidth
+ })"""
+ )
+ assert light_surface["theme"] == "light", (path, light_surface)
+ assert light_surface["bodyBackground"] == "rgb(237, 240, 237)", (path, light_surface)
+ assert light_surface["browserBackground"] == "rgb(226, 230, 227)", (path, light_surface)
+ assert light_surface["horizontalOverflow"] is False, (path, light_surface)
+
light_page.evaluate(
"""async () => {
await chrome.storage.local.set({uiPreferences: {locale: 'system', theme: 'system', motion: 'system'}});
@@ -199,6 +293,7 @@ def main() -> None:
"wall": wall_metrics,
"project_combobox": menu_style,
"migrated": migrated,
+ "light_tokens": light_tokens,
})
diff --git a/test/visual-interaction.test.js b/test/visual-interaction.test.js
index 7d8f47d..59e909d 100644
--- a/test/visual-interaction.test.js
+++ b/test/visual-interaction.test.js
@@ -12,25 +12,45 @@ test("the current project uses the product accent while other library selections
const foundation = await readFile(new URL("../ui-foundation.css", import.meta.url), "utf8");
assert.match(foundation, /--selection:\s*color-mix\(in srgb, var\(--ui-text\) 6%, var\(--ui-surface\)\)/);
- assert.match(foundation, /--selection-indicator:\s*color-mix\(in srgb, var\(--ui-text\) 40%, transparent\)/);
+ assert.match(foundation, /--selection-indicator:\s*var\(--ui-accent-emphasis\)/);
assert.match(foundation, /--focus-ring:\s*var\(--ui-focus\)/);
assert.match(rule(source, '.project-filter[aria-pressed="true"]'), /color:\s*var\(--accent-ink\)/);
- assert.match(rule(source, '.project-filter[aria-pressed="true"]'), /background:\s*var\(--accent-soft\)/);
- assert.match(rule(source, '.project-filter[aria-pressed="true"]'), /box-shadow:\s*inset 2px 0 var\(--accent\)/);
+ assert.match(rule(source, '.project-filter[aria-pressed="true"]'), /background:\s*var\(--ui-project-active-surface\)/);
+ assert.match(rule(source, '.project-filter[aria-pressed="true"]'), /box-shadow:\s*inset 2px 0 var\(--accent-emphasis\)/);
+ assert.doesNotMatch(rule(source, ".project-filter"), /border(?:-color)?:\s*(?!transparent)/);
+ assert.match(rule(source, '.content-filter-option[aria-pressed="true"]'), /background:\s*var\(--ui-content-active-surface\)/);
assert.match(rule(source, '.filter-option[aria-pressed="true"]'), /background:\s*var\(--selection\)/);
- assert.match(rule(source, '.facet-option-row[aria-pressed="true"] .facet-option-check'), /background:\s*var\(--accent\)/);
- assert.match(rule(source, ".case-card.selected-for-share"), /box-shadow:\s*inset 0 0 0 1px var\(--selection-indicator\)/);
- assert.match(rule(source, ".case-card:focus-visible"), /box-shadow:\s*inset 0 0 0 2px var\(--focus-ring\)/);
- assert.doesNotMatch(rule(source, ".case-card:focus-visible"), /outline-offset/);
+ assert.match(rule(source, '.facet-option-row[aria-pressed="true"] .facet-option-check'), /background:\s*var\(--accent-emphasis\)/);
+ assert.match(rule(source, ".case-card::after"), /inset:\s*0/);
+ assert.match(rule(source, ".case-card:hover::after"), /border-color:\s*var\(--selection-edge\)/);
+ assert.doesNotMatch(rule(source, ".case-card:hover"), /box-shadow/);
+ assert.match(rule(source, ".case-card.selected-for-share::after"), /border-color:\s*var\(--selection-indicator\)/);
+ assert.match(rule(source, ".case-card:focus-visible::after"), /border-width:\s*2px/);
+ assert.match(rule(source, ".case-card:focus-visible::after"), /border-color:\s*var\(--focus-ring\)/);
assert.match(rule(source, ".detail-visual-thumb"), /border:\s*1px solid transparent/);
assert.match(rule(source, '.manager-tabs button[aria-selected="true"]::after'), /height:\s*1px/);
assert.match(rule(source, '.analysis-kind-tabs button[aria-selected="true"]'), /background:\s*var\(--selection\)/);
assert.match(rule(source, ".share-package-import"), /background:\s*var\(--raised\)/);
assert.match(rule(source, ".share-package-import"), /border:\s*1px solid var\(--line\)/);
assert.match(rule(source, ".share-package-import"), /box-shadow:\s*none/);
+ assert.match(rule(source, "html"), /scrollbar-gutter:\s*stable/);
assert.doesNotMatch(source, /0 0 0 (?:2px|3px) color-mix\(in srgb, var\(--accent\)/);
});
+test("Skill cards keep emphasis in titles and mute paths, body copy, and idle borders", async () => {
+ const skills = await readFile(new URL("../skills-page.css", import.meta.url), "utf8");
+
+ assert.match(rule(skills, ".skill-card"), /border:\s*1px solid var\(--ui-card-border\)/);
+ assert.match(rule(skills, ".skill-card"), /font-weight:\s*400/);
+ assert.match(rule(skills, ".skill-card:hover:not(:disabled)"), /border-color:\s*var\(--ui-border\)/);
+ assert.match(rule(skills, ".skill-card h2"), /font-weight:\s*750/);
+ assert.match(rule(skills, ".skill-card code"), /color:\s*var\(--muted/);
+ assert.match(rule(skills, ".skill-card code"), /font-weight:\s*600/);
+ assert.match(rule(skills, ".skill-card p"), /font-weight:\s*450/);
+ assert.match(rule(skills, ".skill-card footer"), /font-weight:\s*600/);
+ assert.match(rule(skills, ".skill-detail-header code"), /color:\s*var\(--muted\)/);
+});
+
test("composer and Skill selections avoid oversized green outer rings", async () => {
const [composer, skills] = await Promise.all([
readFile(new URL("../composer-page.css", import.meta.url), "utf8"),
@@ -42,10 +62,25 @@ test("composer and Skill selections avoid oversized green outer rings", async ()
assert.match(rule(composer, ".composer-project-card .composer-project-active"), /box-shadow:\s*inset 2px 0 var\(--selection-indicator\)/);
assert.doesNotMatch(composer, /0 0 0 (?:2px|3px) color-mix\(in srgb, var\(--accent\)/);
assert.match(rule(skills, '.skill-case[data-selected="true"]'), /border-color:\s*var\(--selection-indicator\)/);
- assert.match(rule(skills, '.skill-case[data-selected="true"] .skill-case-state'), /background:\s*var\(--accent\)/);
+ assert.match(rule(skills, '.skill-case[data-selected="true"] .skill-case-state'), /background:\s*var\(--accent-emphasis\)/);
assert.doesNotMatch(skills, /box-shadow:\s*0 0 0 (?:2px|3px) color-mix\(in srgb, var\(--accent\)/);
});
+test("composer session delete menu reuses the compact shared danger action", async () => {
+ const [foundation, composer, runtime] = await Promise.all([
+ readFile(new URL("../ui-foundation.css", import.meta.url), "utf8"),
+ readFile(new URL("../composer-page.css", import.meta.url), "utf8"),
+ readFile(new URL("../composer-page.js", import.meta.url), "utf8")
+ ]);
+ assert.match(runtime, /composer-session-delete quiet-danger/);
+ assert.match(rule(composer, ".composer-session-menu-panel"), /min-width:\s*84px/);
+ assert.match(rule(composer, ".composer-session-menu-panel .quiet-danger"), /min-height:\s*30px/);
+ assert.match(rule(foundation, ".quiet-danger"), /color:\s*var\(--ui-danger\)/);
+ assert.match(rule(foundation, ".quiet-danger"), /background:\s*transparent/);
+ assert.match(rule(foundation, ".quiet-danger:hover:not(:disabled)"), /var\(--ui-danger\) 10%/);
+ assert.match(rule(composer, ".composer-session-menu-panel button:disabled"), /color:\s*var\(--muted\)/);
+});
+
test("collector highlights use the shared restrained interaction language", async () => {
const source = await readFile(new URL("../collector.css", import.meta.url), "utf8");
const targetBannerSource = source.slice(source.lastIndexOf("\n.target-banner {"));
diff --git a/theme-bootstrap.js b/theme-bootstrap.js
index 4eee2d1..971048f 100644
--- a/theme-bootstrap.js
+++ b/theme-bootstrap.js
@@ -24,7 +24,7 @@
: null;
const prefersDark = prefersDarkQuery?.matches === true;
const resolvedTheme = theme === "system" ? (prefersDark ? "dark" : "light") : theme;
- const backgroundColor = resolvedTheme === "dark" ? "#0f1113" : "#eef0ef";
+ const backgroundColor = resolvedTheme === "dark" ? "#0f1113" : "#e2e6e3";
const colorScheme = resolvedTheme === "dark" ? "dark" : "light";
root.dataset.theme = theme;
diff --git a/ui-dialogs.js b/ui-dialogs.js
index 240daf0..6a539fd 100644
--- a/ui-dialogs.js
+++ b/ui-dialogs.js
@@ -1,3 +1,5 @@
+import { t, translateUiMessage } from "./i18n.js";
+
const DIALOG_ID = "promptdirector-app-dialog";
export async function showAppDialog(options = {}) {
@@ -13,18 +15,18 @@ export async function showAppDialog(options = {}) {
const heading = document.createElement("div");
const title = document.createElement("h2");
title.id = `${DIALOG_ID}-title`;
- title.textContent = clean(options.title) || "确认操作";
+ title.textContent = uiText(options.title) || t("确认操作");
heading.append(title);
if (clean(options.description)) {
const description = document.createElement("p");
- description.textContent = clean(options.description);
+ description.textContent = uiText(options.description);
heading.append(description);
}
const close = document.createElement("button");
close.type = "button";
close.className = "icon-button app-dialog-close";
- close.setAttribute("aria-label", "关闭");
- close.title = "关闭";
+ close.setAttribute("aria-label", t("关闭"));
+ close.title = t("关闭");
close.textContent = "×";
header.append(heading, close);
const body = document.createElement("div");
@@ -52,11 +54,11 @@ export async function showAppDialog(options = {}) {
const cancel = document.createElement("button");
cancel.type = "button";
cancel.className = "button-secondary";
- cancel.textContent = clean(options.cancelLabel) || "取消";
+ cancel.textContent = uiText(options.cancelLabel) || t("取消");
const confirm = document.createElement("button");
confirm.type = "submit";
confirm.className = options.danger ? "button-danger" : "";
- confirm.textContent = clean(options.confirmLabel) || "确认";
+ confirm.textContent = uiText(options.confirmLabel) || t("确认");
footer.append(cancel, confirm);
form.append(header);
if (controls.size || body.childElementCount) form.append(body);
@@ -82,7 +84,7 @@ export async function showAppDialog(options = {}) {
const resetDismissConfirmation = () => {
if (!dismissConfirmationArmed) return;
dismissConfirmationArmed = false;
- cancel.textContent = clean(options.cancelLabel) || "取消";
+ cancel.textContent = uiText(options.cancelLabel) || t("取消");
if (status && !status.classList.contains("error")) status.textContent = "";
};
const dismiss = () => {
@@ -91,8 +93,8 @@ export async function showAppDialog(options = {}) {
dismissConfirmationArmed = true;
const statusLine = ensureStatus();
statusLine.classList.remove("error");
- statusLine.textContent = clean(options.dirtyDismissMessage) || "有未保存的更改,再次关闭或取消将放弃这些更改";
- cancel.textContent = clean(options.discardLabel) || "确认放弃";
+ statusLine.textContent = uiText(options.dirtyDismissMessage) || t("有未保存的更改,再次关闭或取消将放弃这些更改");
+ cancel.textContent = uiText(options.discardLabel) || t("确认放弃");
};
close.addEventListener("click", dismiss);
cancel.addEventListener("click", dismiss);
@@ -115,7 +117,7 @@ export async function showAppDialog(options = {}) {
if (clean(options.pendingLabel)) {
const statusLine = ensureStatus();
statusLine.classList.remove("error");
- statusLine.textContent = clean(options.pendingLabel);
+ statusLine.textContent = uiText(options.pendingLabel);
}
try {
const result = typeof options.onSubmit === "function"
@@ -125,7 +127,7 @@ export async function showAppDialog(options = {}) {
finish(result === undefined ? values : result);
} catch (error) {
const statusLine = ensureStatus();
- statusLine.textContent = clean(error?.message) || "操作失败,请重试";
+ statusLine.textContent = uiText(error?.message) || t("操作失败,请重试");
statusLine.classList.add("error");
} finally {
if (!settled) { confirm.disabled = false; cancel.disabled = false; close.disabled = false; }
@@ -152,7 +154,7 @@ export async function promptAppText(options = {}) {
const id = clean(options.id) || "value";
const result = await showAppDialog({
...options,
- fields: [{ id, label: clean(options.label) || clean(options.title) || "内容", type: options.multiline ? "textarea" : clean(options.type) || "text", value: options.value ?? "", placeholder: options.placeholder, required: options.required !== false, autocomplete: options.autocomplete }]
+ fields: [{ id, label: uiText(options.label) || uiText(options.title) || t("内容"), type: options.multiline ? "textarea" : clean(options.type) || "text", value: options.value ?? "", placeholder: uiText(options.placeholder), required: options.required !== false, autocomplete: options.autocomplete }]
});
return result === null ? null : String(result[id] ?? "");
}
@@ -164,7 +166,7 @@ function createField(field = {}) {
wrapper.className = `app-dialog-field${field.type === "checkbox" ? " app-dialog-check" : ""}`;
wrapper.dataset.fieldId = id;
const label = document.createElement("span");
- label.textContent = clean(field.label) || id;
+ label.textContent = uiText(field.label) || id;
let input;
if (field.type === "textarea") {
input = document.createElement("textarea");
@@ -174,7 +176,7 @@ function createField(field = {}) {
for (const item of Array.isArray(field.options) ? field.options : []) {
const option = document.createElement("option");
option.value = String(item?.value ?? "");
- option.textContent = String(item?.label ?? item?.value ?? "");
+ option.textContent = uiText(item?.label ?? item?.value ?? "");
option.selected = option.value === String(field.value ?? "");
input.append(option);
}
@@ -201,7 +203,7 @@ function createField(field = {}) {
}
if (field.type === "checkbox") input.checked = field.value === true;
else if (field.type !== "select") input.value = String(field.value ?? "");
- if (clean(field.placeholder)) input.placeholder = clean(field.placeholder);
+ if (clean(field.placeholder)) input.placeholder = uiText(field.placeholder);
if (field.type !== "secret" && clean(field.autocomplete)) input.autocomplete = clean(field.autocomplete);
if (field.required === true) input.required = true;
if (clean(field.pattern)) input.pattern = clean(field.pattern);
@@ -211,7 +213,7 @@ function createField(field = {}) {
else wrapper.append(label, input);
if (clean(field.help)) {
const help = document.createElement("small");
- help.textContent = clean(field.help);
+ help.textContent = uiText(field.help);
wrapper.append(help);
}
return { wrapper, input };
@@ -220,3 +222,7 @@ function createField(field = {}) {
function clean(value) {
return String(value ?? "").replace(/[\u0000-\u001f\u007f]/g, " ").trim();
}
+
+function uiText(value) {
+ return translateUiMessage(clean(value));
+}
diff --git a/ui-foundation.css b/ui-foundation.css
index fdd64d4..84d14ba 100644
--- a/ui-foundation.css
+++ b/ui-foundation.css
@@ -1,23 +1,36 @@
:root {
color-scheme: light;
- --ui-browser: #eef0ef;
- --ui-page: #f5f6f5;
- --ui-surface: #ffffff;
- --ui-raised: #e9ecea;
- --ui-hover: #e1e5e2;
+ --ui-browser: #e2e6e3;
+ --ui-page: #edf0ed;
+ --ui-surface: #f8f9f8;
+ --ui-raised: #e5e9e6;
+ --ui-hover: #dce2de;
--ui-text: #121714;
- --ui-muted: #606963;
+ --ui-muted: #5b645e;
--ui-border-weak: rgba(18, 23, 20, .05);
--ui-border: rgba(18, 23, 20, .10);
--ui-border-strong: rgba(18, 23, 20, .20);
--ui-accent: #d1fe17;
--ui-accent-hover: #c2ed12;
--ui-accent-contrast: #0f1113;
+ --ui-accent-emphasis: var(--ui-accent);
+ --ui-accent-emphasis-contrast: var(--ui-accent-contrast);
+ --ui-accent-subtle: color-mix(in srgb, var(--ui-accent) 10%, var(--ui-surface));
+ --ui-selected-surface: color-mix(in srgb, var(--ui-accent) 16%, var(--ui-surface));
+ --ui-project-active-surface: var(--ui-selected-surface);
+ --ui-content-active-surface: var(--ui-selected-surface);
+ --ui-card-border: var(--ui-border-weak);
+ --ui-field-focus-border: var(--ui-border-strong);
+ --ui-field-focus-outline: none;
+ --ui-field-focus-shadow: 0 0 0 2px var(--ui-accent-subtle);
+ --ui-primary-border: transparent;
--ui-success: #2f8257;
--ui-warning: #9a6300;
--ui-danger: #b4232f;
- --ui-focus: color-mix(in srgb, var(--ui-accent) 78%, #557000);
+ --ui-focus: var(--ui-accent-emphasis);
--ui-shadow: 0 18px 52px rgba(22, 34, 27, .14);
+ --ui-code-bg: #e5e9e6;
+ --ui-code-text: #1e2822;
--ui-control-height: 36px;
--ui-compact-height: 30px;
--ui-icon-size: 36px;
@@ -34,7 +47,9 @@
--ui-motion-fast: 120ms;
--ui-motion-normal: 160ms;
--ui-popover-gap: 5px;
- --ui-combobox-max-height: 320px;
+ --ui-popover-viewport-inset: 12px;
+ --ui-browse-max-width: 1500px;
+ --ui-browse-gutter: max(12px, calc((100vw - var(--ui-browse-max-width)) / 2));
/* Compatibility aliases while page-specific layout styles are migrated. */
--ink: var(--ui-text);
@@ -47,11 +62,13 @@
--line: var(--ui-border);
--accent: var(--ui-accent);
--accent-hover: var(--ui-accent-hover);
- --accent-ink: #526900;
- --accent-bright: var(--ui-accent);
+ --accent-ink: var(--ui-text);
+ --accent-bright: var(--ui-accent-emphasis);
+ --accent-emphasis: var(--ui-accent-emphasis);
+ --accent-emphasis-contrast: var(--ui-accent-emphasis-contrast);
--accent-contrast: var(--ui-accent-contrast);
--button-ink: var(--ui-accent-contrast);
- --accent-soft: color-mix(in srgb, var(--ui-accent) 16%, transparent);
+ --accent-soft: var(--ui-accent-subtle);
--warning: var(--ui-warning);
--danger: var(--ui-danger);
--shadow: var(--ui-shadow);
@@ -62,7 +79,7 @@
--selection: color-mix(in srgb, var(--ui-text) 6%, var(--ui-surface));
--selection-hover: color-mix(in srgb, var(--ui-text) 9%, var(--ui-surface));
--selection-edge: var(--ui-border-strong);
- --selection-indicator: color-mix(in srgb, var(--ui-text) 40%, transparent);
+ --selection-indicator: var(--ui-accent-emphasis);
--focus-ring: var(--ui-focus);
--subtle-card: color-mix(in srgb, var(--ui-page) 62%, var(--ui-surface));
--editor: var(--ui-raised);
@@ -91,7 +108,19 @@
--ui-warning: #f0b94f;
--ui-danger: #ff717a;
--ui-focus: var(--ui-accent);
+ --ui-accent-emphasis: var(--ui-accent);
+ --ui-accent-emphasis-contrast: var(--ui-accent-contrast);
+ --ui-accent-subtle: color-mix(in srgb, var(--ui-accent) 16%, transparent);
+ --ui-project-active-surface: var(--ui-accent-subtle);
+ --ui-content-active-surface: color-mix(in srgb, var(--ui-text) 6%, var(--ui-surface));
+ --ui-card-border: var(--ui-border);
+ --ui-field-focus-border: var(--ui-border);
+ --ui-field-focus-outline: 2px solid var(--ui-focus);
+ --ui-field-focus-shadow: none;
+ --ui-primary-border: transparent;
--ui-shadow: 0 18px 52px rgba(0, 0, 0, .38);
+ --ui-code-bg: #11161b;
+ --ui-code-text: #edf2f4;
--accent-ink: var(--ui-accent);
--bar: var(--ui-page);
--subtle-card: color-mix(in srgb, var(--ui-page) 55%, var(--ui-surface));
@@ -117,7 +146,19 @@
--ui-warning: #f0b94f;
--ui-danger: #ff717a;
--ui-focus: var(--ui-accent);
+ --ui-accent-emphasis: var(--ui-accent);
+ --ui-accent-emphasis-contrast: var(--ui-accent-contrast);
+ --ui-accent-subtle: color-mix(in srgb, var(--ui-accent) 16%, transparent);
+ --ui-project-active-surface: var(--ui-accent-subtle);
+ --ui-content-active-surface: color-mix(in srgb, var(--ui-text) 6%, var(--ui-surface));
+ --ui-card-border: var(--ui-border);
+ --ui-field-focus-border: var(--ui-border);
+ --ui-field-focus-outline: 2px solid var(--ui-focus);
+ --ui-field-focus-shadow: none;
+ --ui-primary-border: transparent;
--ui-shadow: 0 18px 52px rgba(0, 0, 0, .38);
+ --ui-code-bg: #11161b;
+ --ui-code-text: #edf2f4;
--accent-ink: var(--ui-accent);
--bar: var(--ui-page);
--subtle-card: color-mix(in srgb, var(--ui-page) 55%, var(--ui-surface));
@@ -168,6 +209,12 @@ button:active:not(:disabled) { transform: none; }
button:disabled { cursor: not-allowed; opacity: .48; }
button[aria-busy="true"] { cursor: progress; }
+.ui-content-row {
+ justify-content: flex-start;
+ text-align: left;
+ white-space: normal;
+}
+
.button-secondary,
.icon-button,
button.quiet {
@@ -182,6 +229,15 @@ button.quiet:hover:not(:disabled) {
color: var(--ui-text);
background: var(--ui-hover);
}
+.quiet-danger {
+ color: var(--ui-danger);
+ background: transparent;
+ font-size: var(--ui-meta-size);
+}
+.quiet-danger:hover:not(:disabled) {
+ color: var(--ui-danger);
+ background: color-mix(in srgb, var(--ui-danger) 10%, transparent);
+}
.button-compact,
button.compact {
min-height: var(--ui-compact-height);
@@ -223,7 +279,7 @@ button.compact {
.ui-segmented-item[aria-pressed="true"] {
color: var(--ui-text);
background: var(--ui-raised);
- box-shadow: inset 0 0 0 1px var(--ui-accent);
+ box-shadow: inset 0 0 0 1px var(--ui-accent-emphasis);
}
.ui-skill-card {
display: flex;
@@ -240,7 +296,7 @@ button.compact {
.ui-skill-card:hover {
border-color: var(--ui-border-strong);
background: var(--ui-raised);
- box-shadow: inset 2px 0 var(--ui-accent);
+ box-shadow: inset 2px 0 var(--ui-accent-emphasis);
}
.ui-skill-card-title {
margin: 0;
@@ -320,8 +376,8 @@ select option {
select option:hover,
select option:focus-visible { background: var(--ui-hover); }
select option:checked {
- color: var(--ui-accent-contrast);
- background: var(--ui-accent);
+ color: var(--ui-accent-emphasis-contrast);
+ background: var(--ui-accent-emphasis);
font-weight: 750;
}
select::picker-icon {
@@ -331,14 +387,14 @@ select::picker-icon {
select:open::picker-icon { rotate: 180deg; }
select:disabled { cursor: not-allowed; }
.project-combobox-listbox {
- position: absolute;
+ position: fixed;
z-index: 80;
- top: calc(100% + var(--ui-popover-gap));
- right: 0;
+ top: 0;
+ right: auto;
left: 0;
display: grid;
min-height: 0;
- max-height: min(var(--ui-combobox-max-height), var(--project-combobox-available-height, calc(100dvh - 32px)));
+ max-height: var(--project-combobox-available-height, calc(100dvh - 32px));
overflow: auto;
gap: 2px;
border: 1px solid var(--ui-border-strong);
@@ -348,10 +404,6 @@ select:disabled { cursor: not-allowed; }
background: var(--ui-surface);
box-shadow: var(--ui-shadow);
}
-.project-combobox-listbox[data-placement="top"] {
- top: auto;
- bottom: calc(100% + var(--ui-popover-gap));
-}
.project-combobox-option {
min-height: var(--ui-control-height);
border: 0;
@@ -360,24 +412,31 @@ select:disabled { cursor: not-allowed; }
color: var(--ui-text);
background: transparent;
font-weight: 600;
+ overflow-wrap: anywhere;
text-align: left;
+ white-space: normal;
}
.project-combobox-option:hover:not(:disabled),
.project-combobox-option[aria-selected="true"] {
- color: var(--ui-accent-contrast);
- background: var(--ui-accent);
+ color: var(--ui-accent-emphasis-contrast);
+ background: var(--ui-accent-emphasis);
}
.app-dialog-field:has(> input[role="combobox"]),
.import-project-field:has(> input[role="combobox"]) { position: relative; }
button:focus-visible,
-input:focus-visible,
-select:focus-visible,
-textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
outline: 2px solid var(--ui-focus);
outline-offset: 2px;
}
+input:focus-visible,
+select:focus-visible,
+textarea:focus-visible {
+ border-color: var(--ui-field-focus-border);
+ outline: var(--ui-field-focus-outline);
+ outline-offset: 2px;
+ box-shadow: var(--ui-field-focus-shadow);
+}
.ui-icon {
display: block;
@@ -394,6 +453,14 @@ summary:focus-visible,
pointer-events: none;
}
.ui-icon use { pointer-events: none; }
+.product-brand { display: flex; min-width: 0; align-items: center; gap: 9px; color: inherit; text-decoration: none; }
+.product-brand-mark { width: 36px; height: 36px; flex: none; border-radius: 7px; }
+.product-brand-copy { display: grid; width: max-content; min-width: 0; max-width: 100%; gap: 1px; }
+.product-brand-name,
+.product-brand-tagline { display: block; min-width: 0; overflow: visible; text-overflow: clip; white-space: nowrap; }
+.product-brand-name { color: var(--ui-text); font-size: 14px; font-weight: 780; line-height: 17px; }
+.product-brand-tagline { margin: 0; color: var(--ui-muted); font-size: 10px; font-weight: 550; line-height: 13px; letter-spacing: 0; }
+.product-brand:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: 3px; }
.sr-only {
position: absolute;
width: 1px;
@@ -420,7 +487,7 @@ summary:focus-visible,
border-radius: 999px;
padding: 3px 4px 3px 9px;
color: var(--ui-text);
- background: color-mix(in srgb, var(--ui-accent) 16%, transparent);
+ background: var(--ui-accent-subtle);
font-size: var(--ui-meta-size);
font-weight: 700;
}
@@ -488,7 +555,7 @@ summary:focus-visible,
.app-dialog-field small { color: var(--ui-muted); font-weight: 400; line-height: 1.5; }
.app-dialog-check { display: flex; align-items: flex-start; gap: 9px; color: var(--ui-text); }
.app-dialog-check input { width: 16px; min-height: 16px; margin-top: 2px; }
-.app-dialog-status { margin: 0; color: var(--ui-accent); font-size: var(--ui-meta-size); }
+.app-dialog-status { margin: 0; color: var(--ui-text); font-size: var(--ui-meta-size); }
.app-dialog-status.error { color: var(--ui-danger); }
.app-dialog-form > footer { display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--ui-border); padding: 12px 16px; background: var(--ui-page); }
.button-danger { border-color: color-mix(in srgb, var(--ui-danger) 52%, transparent); color: #fff; background: var(--ui-danger); }