dsh-folia 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -388
- package/lib/capabilities-curated.js +187 -1
- package/lib/client.js +342 -54
- package/lib/curated-personal.js +753 -0
- package/lib/index.js +8 -1
- package/lib/persona-store.js +1 -1
- package/lib/pet-chat-brain.js +30 -2
- package/lib/pet-chat-tools.js +189 -3
- package/lib/routes/pet-chat.js +9 -4
- package/package.json +2 -1
package/lib/client.js
CHANGED
|
@@ -991,13 +991,41 @@ window.__ModuleLoader__.load({
|
|
|
991
991
|
"工作能力": "Work",
|
|
992
992
|
"娱乐": "Fun",
|
|
993
993
|
"详情": "Details",
|
|
994
|
+
"助手可直接调用": "Callable by the assistant",
|
|
995
|
+
"需 DSH 执行": "Runs in DSH",
|
|
996
|
+
"仅说明": "Description only",
|
|
994
997
|
"收起": "Collapse",
|
|
995
998
|
"复制安装命令": "Copy install command",
|
|
996
999
|
"已复制": "Copied",
|
|
997
1000
|
"怎么用:": "How to use: ",
|
|
998
1001
|
"前提:": "Requires: ",
|
|
999
1002
|
"读取失败,重开设置页再试": "Failed to load; reopen settings and retry",
|
|
1000
|
-
"这些是可选插件:装好后能力给 DSH
|
|
1003
|
+
"这些是可选插件:装好后能力给 DSH 助手用,桌宠本身不受影响。不做一键安装,复制命令自行安装。已装插件可由助手交给 DSH 执行,未装只能看说明。": "Optional plugins: they add abilities to the DSH assistant, not the pet. No one-click install — copy the command and install it yourself. Installed plugins can be executed by the assistant through DSH; uninstalled ones are description-only.",
|
|
1004
|
+
"这些是可选的插件与个人工具。安装方式:复制包名命令或 GitHub 地址 → 粘贴到 DSH 对话 → 让助手帮你下载安装(会先确认)。已装插件可由助手交给 DSH 执行;未装的只能看说明。非 DSH 插件的个人工具(Docker/Windows 应用)需要按 README 安装,助手只给步骤。":
|
|
1005
|
+
"Optional plugins and personal tools. To install: copy the package command or GitHub URL → paste it into the DSH chat → let the assistant download and install it (it will confirm first). Installed plugins can be run by the assistant through DSH; uninstalled ones are description-only. Personal tools that are not DSH plugins (Docker/Windows apps) must be installed per their README; the assistant only provides steps.",
|
|
1006
|
+
// pre.79:精选 → 场景组合 / 个人工具
|
|
1007
|
+
"场景组合": "Scenario bundles",
|
|
1008
|
+
"个人工具": "Personal tools",
|
|
1009
|
+
"复制仓库地址": "Copy repo URL",
|
|
1010
|
+
"打开 GitHub": "Open GitHub",
|
|
1011
|
+
"非 DSH 插件": "Not a DSH plugin",
|
|
1012
|
+
"需按 README 安装;助手只给步骤,不盲装。": "Install per the README; the assistant only gives steps and won't blind-install.",
|
|
1013
|
+
"已复制。粘贴到 DSH 对话,让助手帮你安装(会先确认)。": "Copied. Paste it into the DSH chat and let the assistant install it (it will confirm first).",
|
|
1014
|
+
"搜索个人工具": "Search personal tools",
|
|
1015
|
+
"共 {n} 项": "{n} items",
|
|
1016
|
+
"没有匹配的个人工具": "No matching personal tools",
|
|
1017
|
+
"许可:": "License: ",
|
|
1018
|
+
"语音文档": "Speech & documents",
|
|
1019
|
+
"相册影音": "Photos & media",
|
|
1020
|
+
"文档效率": "Document productivity",
|
|
1021
|
+
"笔记阅读": "Notes & reading",
|
|
1022
|
+
"家庭生活": "Home & life",
|
|
1023
|
+
"自动化运维": "Automation & ops",
|
|
1024
|
+
"备份文件": "Backup & files",
|
|
1025
|
+
"隐私安全": "Privacy & security",
|
|
1026
|
+
"财务": "Finance",
|
|
1027
|
+
"创作设计": "Creative & design",
|
|
1028
|
+
"AI": "AI",
|
|
1001
1029
|
// pre.79:能力页精选(20 套组合 / 场景向导 / 筛选 / 导出)
|
|
1002
1030
|
"精选": "Curated",
|
|
1003
1031
|
"场景向导": "Scenario guide",
|
|
@@ -1611,6 +1639,13 @@ window.__ModuleLoader__.load({
|
|
|
1611
1639
|
"Filter by site subtag (new site subtags appear after reopening the panel)",
|
|
1612
1640
|
"「{name}」下没有可播放的壁纸": "No playable wallpapers under \"{name}\"",
|
|
1613
1641
|
"子标签「{name}」下没有可播放的壁纸": "No playable wallpapers with subtag \"{name}\"",
|
|
1642
|
+
// pre.71:子标签计数按其它筛选重算 / 0 张置灰 / 选中变 0 自动回退 / 空态清空筛选。
|
|
1643
|
+
"子标签:{name}": "Subtag: {name}",
|
|
1644
|
+
"搜索「{query}」": "Search \"{query}\"",
|
|
1645
|
+
"当前条件:{summary},共 0 张": "Current filters: {summary} · 0 wallpapers",
|
|
1646
|
+
"清空筛选": "Clear filters",
|
|
1647
|
+
"当前缓存里没有「{name}」的壁纸,已切回全部": "No cached \"{name}\" wallpapers; switched back to All",
|
|
1648
|
+
"当前条件下没有「{name}」的壁纸,已切回全部": "No \"{name}\" wallpapers under the current filters; switched back to All",
|
|
1614
1649
|
"打开设置对话框的「壁纸引擎」分区(外观 / 播放 / 系统与全部配置)": "Open the Wallpaper Engine section of the settings dialog (Appearance / Playback / System and all configuration)",
|
|
1615
1650
|
"壁纸引擎设置 ›": "Wallpaper Engine settings ›",
|
|
1616
1651
|
"壁纸面板分区": "Wallpaper panel sections",
|
|
@@ -5978,6 +6013,8 @@ window.__ModuleLoader__.load({
|
|
|
5978
6013
|
.we-qp__group { flex: 1; min-width: 0; }
|
|
5979
6014
|
.we-qp__search { width: 100%; box-sizing: border-box; }
|
|
5980
6015
|
.we-qp__list { display: flex; flex-direction: column; gap: 2px; }
|
|
6016
|
+
/* 有筛选但 0 张:说清当前条件 + 清空筛选入口(不再只显示一句笼统空态)。 */
|
|
6017
|
+
.we-qp__empty { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 8px 2px; }
|
|
5981
6018
|
/* 视图切换:**确定性两行**(pre.51:三个下拉)。官方右栏最窄 300px(内容 276):
|
|
5982
6019
|
三个筛选下拉 + 视图按钮同排必然挤碎(下拉最短也要 ~70px),而依赖 flex-wrap
|
|
5983
6020
|
的假想折行会在中间宽度碎出"只有视图按钮折下去"的行。故搜索与视图按钮包进
|
|
@@ -17324,8 +17361,14 @@ window.__ModuleLoader__.load({
|
|
|
17324
17361
|
//("要什么"写在签名处),所以这里显式解构出那一个回调。
|
|
17325
17362
|
// 四段的**顺序**是用户的明确口径(致谢压尾),判据按首次出现下标比大小钉住。
|
|
17326
17363
|
function renderAboutTab(ctx) {
|
|
17327
|
-
//
|
|
17328
|
-
|
|
17364
|
+
// 组件可见性门:**只有明确读到 components.about-notice 且它被关**时才隐藏。
|
|
17365
|
+
// inventory 未就绪(components 缺失 / 空对象 / 没有该键)时按可用渲染 —— 关于页是纯静态
|
|
17366
|
+
// 文案,永远画得出来;拿"未知"当"关闭"会让启动早期整页空白(pre.71 的 P0)。
|
|
17367
|
+
const components = ctx.sel && ctx.sel.inventory && ctx.sel.inventory.components;
|
|
17368
|
+
const aboutExplicitlyOff = components && typeof components === "object"
|
|
17369
|
+
&& Object.prototype.hasOwnProperty.call(components, "about-notice")
|
|
17370
|
+
&& !weComponentVisibleOf(components, "about-notice");
|
|
17371
|
+
if (aboutExplicitlyOff) return null;
|
|
17329
17372
|
// 纯静态文案:不发请求、不写设置、不读面板状态(verify-about 的只读契约)。
|
|
17330
17373
|
const section = (title, body) => React.createElement("div", { className: "we-picker__section", key: title },
|
|
17331
17374
|
React.createElement("div", { className: "we-picker__section-head" },
|
|
@@ -17366,7 +17409,7 @@ window.__ModuleLoader__.load({
|
|
|
17366
17409
|
"写文案 / 方案 / 代码 / 诗 / 故事 / 笑话;做计划 / 讲概念 / 角色扮演 / 清唱",
|
|
17367
17410
|
"换壁纸 / 调音量 / 媒体控制 / 提醒 / 通知 / 开应用或网页 / 读写工作区文档 / 剪贴板",
|
|
17368
17411
|
"多步任务:先计划再逐步执行,高危步骤二次确认",
|
|
17369
|
-
"
|
|
17412
|
+
"已安装插件与技能:技能读取说明执行;已装插件交给 DSH 独立 agent 真执行(默认询问、可关权限、写审计)",
|
|
17370
17413
|
"权限:标准 / 宽松 / 自定义三档;allow / ask / deny;写文件、剪贴板、删除等高危动作永远二次确认",
|
|
17371
17414
|
]),
|
|
17372
17415
|
)),
|
|
@@ -22167,13 +22210,52 @@ window.__ModuleLoader__.load({
|
|
|
22167
22210
|
|
|
22168
22211
|
const CAP_META = { fontSize: '11px', opacity: 0.6, marginTop: '2px', wordBreak: 'break-all' };
|
|
22169
22212
|
|
|
22213
|
+
/* ── pre.71:能力/精选卡的"能不能真调用"标记 ───────────────────────────────
|
|
22214
|
+
* direct = 已装的技能类包(capability_call 可读正文并按它执行);
|
|
22215
|
+
* delegate= 已装的插件/组合,交给 delegate_to_dsh 的独立 DSH agent 执行;
|
|
22216
|
+
* manual = 未装 / 宿主没有 agents 服务 ⇒ 只能读说明,必须如实标注。
|
|
22217
|
+
* 这是 UI 提示,不是权限边界;真正的权限/确认/审计在工具层与路由层。 */
|
|
22218
|
+
const CALL_MODE_TONES = { direct: 'ok', delegate: 'medium', manual: undefined };
|
|
22219
|
+
|
|
22220
|
+
/** 包名是否是"技能"类(技能正文可被 capability_call 读取)。 */
|
|
22221
|
+
function isSkillPackage(pkg) {
|
|
22222
|
+
return /(?:^|\/)dsh-skills?(?:-|$)/i.test(String(pkg || ''));
|
|
22223
|
+
}
|
|
22224
|
+
|
|
22225
|
+
/** 单个能力条目的调用方式。 */
|
|
22226
|
+
function capabilityCallMode(item, agentsAvailable) {
|
|
22227
|
+
if (!item || item.installed !== true) return 'manual';
|
|
22228
|
+
if (isSkillPackage(item.pkg)) return 'direct';
|
|
22229
|
+
return agentsAvailable === true ? 'delegate' : 'manual';
|
|
22230
|
+
}
|
|
22231
|
+
|
|
22232
|
+
/** 精选组合的调用方式:全装且全是技能 ⇒ direct;有已装插件且宿主有 agents ⇒ delegate。 */
|
|
22233
|
+
function curatedCallMode(bundle, installed, agentsAvailable) {
|
|
22234
|
+
const steps = Array.isArray(bundle && bundle.steps) ? bundle.steps : [];
|
|
22235
|
+
if (!steps.length) return 'manual';
|
|
22236
|
+
const installedSteps = steps.filter((s) => installed && installed[s.pkg]);
|
|
22237
|
+
if (!installedSteps.length) return 'manual';
|
|
22238
|
+
if (installedSteps.length === steps.length && installedSteps.every((s) => isSkillPackage(s.pkg))) {
|
|
22239
|
+
return 'direct';
|
|
22240
|
+
}
|
|
22241
|
+
return agentsAvailable === true ? 'delegate' : 'manual';
|
|
22242
|
+
}
|
|
22243
|
+
|
|
22244
|
+
function CallModeTag({ mode }) {
|
|
22245
|
+
const label = mode === 'direct'
|
|
22246
|
+
? weT('助手可直接调用')
|
|
22247
|
+
: mode === 'delegate' ? weT('需 DSH 执行') : weT('仅说明');
|
|
22248
|
+
return React.createElement(CuratedTag, { tone: CALL_MODE_TONES[mode] }, label);
|
|
22249
|
+
}
|
|
22250
|
+
|
|
22170
22251
|
/** 作者仓库预览占位块:固定 120px 高,图片失败时仍占位(不塌、不露裂图)。 */
|
|
22171
22252
|
|
|
22172
22253
|
|
|
22173
22254
|
|
|
22174
|
-
function CapabilityCard({ item }) {
|
|
22255
|
+
function CapabilityCard({ item, agentsAvailable }) {
|
|
22175
22256
|
const [open, setOpen] = React.useState(false);
|
|
22176
22257
|
const [copied, setCopied] = React.useState(false);
|
|
22258
|
+
const callMode = capabilityCallMode(item, agentsAvailable);
|
|
22177
22259
|
const copy = () => {
|
|
22178
22260
|
const text = String(item.command || '');
|
|
22179
22261
|
try {
|
|
@@ -22197,7 +22279,9 @@ window.__ModuleLoader__.load({
|
|
|
22197
22279
|
? React.createElement('span', { className: 'we-picker__hint' }, 'v' + item.installedVersion)
|
|
22198
22280
|
: null),
|
|
22199
22281
|
React.createElement('div', { className: 'we-picker__hint', style: { marginTop: '2px' } }, item.summary),
|
|
22200
|
-
React.createElement('div', { style:
|
|
22282
|
+
React.createElement('div', { style: { display: 'flex', alignItems: 'center', gap: '4px', flexWrap: 'wrap', marginTop: '2px' } },
|
|
22283
|
+
React.createElement(CallModeTag, { mode: callMode }),
|
|
22284
|
+
React.createElement('span', { style: CAP_META }, item.pkg + (item.size ? ' · ' + item.size : '')))),
|
|
22201
22285
|
React.createElement('div', {
|
|
22202
22286
|
style: { flex: '0 0 auto', textAlign: 'right', fontSize: '11px', opacity: 0.85, whiteSpace: 'nowrap' },
|
|
22203
22287
|
},
|
|
@@ -22241,7 +22325,7 @@ window.__ModuleLoader__.load({
|
|
|
22241
22325
|
return React.createElement('div', { style: CAP_CARD }, body);
|
|
22242
22326
|
}
|
|
22243
22327
|
|
|
22244
|
-
function CapGroup({ title, hint, items }) {
|
|
22328
|
+
function CapGroup({ title, hint, items, agentsAvailable }) {
|
|
22245
22329
|
// 220 条一次性渲染会卡(每张卡都带状态),先展示 60 条,按需展开。
|
|
22246
22330
|
const PAGE = 60;
|
|
22247
22331
|
const [visibleCount, setVisibleCount] = React.useState(PAGE);
|
|
@@ -22256,7 +22340,7 @@ window.__ModuleLoader__.load({
|
|
|
22256
22340
|
gap: '8px',
|
|
22257
22341
|
marginTop: '8px',
|
|
22258
22342
|
},
|
|
22259
|
-
}, items.slice(0, visibleCount).map((it) => React.createElement(CapabilityCard, { key: it.pkg || it.name, item: it })),
|
|
22343
|
+
}, items.slice(0, visibleCount).map((it) => React.createElement(CapabilityCard, { key: it.pkg || it.name, item: it, agentsAvailable })),
|
|
22260
22344
|
items.length > visibleCount
|
|
22261
22345
|
? React.createElement("button", { key: "more", type: "button", className: "we-picker__btn", style: { marginTop: "8px" }, onClick: () => setVisibleCount((n) => n + PAGE) },
|
|
22262
22346
|
weT("显示更多(还有 {n} 个)", { n: items.length - visibleCount }))
|
|
@@ -22374,6 +22458,11 @@ window.__ModuleLoader__.load({
|
|
|
22374
22458
|
step.optional ? React.createElement(CuratedTag, null, weT('可选')) : null,
|
|
22375
22459
|
step.alt ? React.createElement(CuratedTag, null, weT('可替代')) : null),
|
|
22376
22460
|
React.createElement('div', { className: 'we-picker__hint', style: { marginTop: '2px' } }, step.why || ''),
|
|
22461
|
+
step.detail && step.detail !== step.why
|
|
22462
|
+
? React.createElement('div', { className: 'we-picker__hint', style: { marginTop: '2px' } }, step.detail)
|
|
22463
|
+
: null,
|
|
22464
|
+
step.repo ? React.createElement('div', { style: { marginTop: '2px', fontSize: '10px' } },
|
|
22465
|
+
React.createElement('a', { href: step.repo, target: '_blank', rel: 'noreferrer', style: { color: 'inherit', textDecoration: 'underline' } }, step.repo)) : null,
|
|
22377
22466
|
step.alt ? React.createElement('div', { className: 'we-picker__hint', style: { marginTop: '2px' } },
|
|
22378
22467
|
weT('替代:') + step.alt + '(' + CURATED_PREFIX + step.alt + ')') : null,
|
|
22379
22468
|
React.createElement('div', { style: { display: 'flex', gap: '6px', alignItems: 'center', marginTop: '4px' } },
|
|
@@ -22386,17 +22475,24 @@ window.__ModuleLoader__.load({
|
|
|
22386
22475
|
if (onCopy) onCopy(command);
|
|
22387
22476
|
setTimeout(() => setCopied(false), 1500);
|
|
22388
22477
|
},
|
|
22389
|
-
}, copied ? weT('已复制') : weT('
|
|
22478
|
+
}, copied ? weT('已复制') : weT('复制安装命令')) : null));
|
|
22390
22479
|
}
|
|
22391
22480
|
|
|
22392
|
-
function CuratedCard({ bundle, installed, favorite, recommended, onToggleFavorite, onCopy, onExport }) {
|
|
22481
|
+
function CuratedCard({ bundle, installed, favorite, recommended, agentsAvailable, onToggleFavorite, onCopy, onExport }) {
|
|
22393
22482
|
const [open, setOpen] = React.useState(false);
|
|
22483
|
+
const [copyNote, setCopyNote] = React.useState('');
|
|
22394
22484
|
const steps = Array.isArray(bundle.steps) ? bundle.steps : [];
|
|
22395
22485
|
const installedCount = steps.filter((s) => installed && installed[s.pkg]).length;
|
|
22486
|
+
const callMode = curatedCallMode(bundle, installed, agentsAvailable);
|
|
22396
22487
|
const commands = curatedCommands(bundle);
|
|
22397
22488
|
const risk = CURATED_RISK_LABELS[bundle.risk] || bundle.risk || '';
|
|
22398
22489
|
const budgets = (Array.isArray(bundle.budget) ? bundle.budget : []).map((b) => CURATED_BUDGET_LABELS[b] || b).join(' / ');
|
|
22399
22490
|
const high = bundle.risk === 'high';
|
|
22491
|
+
const copyWithNote = (text) => {
|
|
22492
|
+
onCopy(text);
|
|
22493
|
+
setCopyNote(weT('已复制。粘贴到 DSH 对话,让助手帮你安装(会先确认)。'));
|
|
22494
|
+
setTimeout(() => setCopyNote(''), 3500);
|
|
22495
|
+
};
|
|
22400
22496
|
return React.createElement('div', {
|
|
22401
22497
|
style: {
|
|
22402
22498
|
...CAP_CARD,
|
|
@@ -22414,6 +22510,7 @@ window.__ModuleLoader__.load({
|
|
|
22414
22510
|
React.createElement('div', { style: { display: 'flex', gap: '4px', flexWrap: 'wrap', marginTop: '4px' } },
|
|
22415
22511
|
React.createElement(CuratedTag, { tone: bundle.risk }, risk),
|
|
22416
22512
|
React.createElement(CuratedTag, null, budgets),
|
|
22513
|
+
React.createElement(CallModeTag, { mode: callMode }),
|
|
22417
22514
|
high ? React.createElement(CuratedTag, { tone: 'high' }, weT('第三方 MCP,先 trust-check')) : null)),
|
|
22418
22515
|
React.createElement('button', {
|
|
22419
22516
|
type: 'button', className: 'we-picker__btn', title: favorite ? weT('取消收藏') : weT('收藏'),
|
|
@@ -22437,16 +22534,17 @@ window.__ModuleLoader__.load({
|
|
|
22437
22534
|
weT('冲突:') + bundle.conflicts.join(';'))
|
|
22438
22535
|
: null,
|
|
22439
22536
|
React.createElement('div', { style: { display: 'flex', gap: '6px', flexWrap: 'wrap' } },
|
|
22440
|
-
React.createElement('button', { type: 'button', className: 'we-picker__btn', onClick: () =>
|
|
22537
|
+
React.createElement('button', { type: 'button', className: 'we-picker__btn', onClick: () => copyWithNote(commands.join('\n')) },
|
|
22441
22538
|
weT('复制全部命令')),
|
|
22442
22539
|
React.createElement('button', { type: 'button', className: 'we-picker__btn', onClick: () => setOpen((v) => !v) },
|
|
22443
22540
|
open ? weT('收起步骤') : weT('展开步骤')),
|
|
22444
22541
|
React.createElement('button', { type: 'button', className: 'we-picker__btn', onClick: () => onExport(bundle, 'powershell') }, 'PowerShell'),
|
|
22445
22542
|
React.createElement('button', { type: 'button', className: 'we-picker__btn', onClick: () => onExport(bundle, 'bash') }, 'bash'),
|
|
22446
22543
|
React.createElement('button', { type: 'button', className: 'we-picker__btn', onClick: () => onExport(bundle, 'json') }, 'JSON')),
|
|
22544
|
+
copyNote ? React.createElement('div', { className: 'we-picker__hint', style: { color: '#4caf7d' } }, copyNote) : null,
|
|
22447
22545
|
open ? React.createElement('div', { style: { display: 'flex', flexDirection: 'column', gap: '4px' } },
|
|
22448
22546
|
steps.map((step) => React.createElement(CuratedStep, {
|
|
22449
|
-
key: step.pkg, step, version: installed ? installed[step.pkg] : null, onCopy,
|
|
22547
|
+
key: step.pkg, step, version: installed ? installed[step.pkg] : null, onCopy: copyWithNote,
|
|
22450
22548
|
}))) : null);
|
|
22451
22549
|
}
|
|
22452
22550
|
|
|
@@ -22474,7 +22572,91 @@ window.__ModuleLoader__.load({
|
|
|
22474
22572
|
weT('推荐:') + recommended.map((id) => (bundleById[id] ? bundleById[id].name : id)).join(' / ')) : null);
|
|
22475
22573
|
}
|
|
22476
22574
|
|
|
22477
|
-
|
|
22575
|
+
/* ── 个人工具(Docker/Windows,非 DSH 插件;只给仓库 + README 安装说明)── */
|
|
22576
|
+
|
|
22577
|
+
const PERSONAL_CATEGORY_LABELS = {
|
|
22578
|
+
all: '全部', ai: 'AI', 'speech-doc': '语音文档', media: '相册影音', docs: '文档效率',
|
|
22579
|
+
notes: '笔记阅读', home: '家庭生活', ops: '自动化运维', backup: '备份文件',
|
|
22580
|
+
privacy: '隐私安全', finance: '财务', creative: '创作设计', dev: '开发',
|
|
22581
|
+
};
|
|
22582
|
+
|
|
22583
|
+
function PersonalToolCard({ tool }) {
|
|
22584
|
+
const [open, setOpen] = React.useState(false);
|
|
22585
|
+
const [copied, setCopied] = React.useState(false);
|
|
22586
|
+
const [note, setNote] = React.useState('');
|
|
22587
|
+
const risk = CURATED_RISK_LABELS[tool.risk] || tool.risk || '';
|
|
22588
|
+
const copyRepo = () => {
|
|
22589
|
+
copyPlainText(tool.repo);
|
|
22590
|
+
setCopied(true);
|
|
22591
|
+
setNote(weT('已复制。粘贴到 DSH 对话,让助手帮你安装(会先确认)。'));
|
|
22592
|
+
setTimeout(() => { setCopied(false); setNote(''); }, 3500);
|
|
22593
|
+
};
|
|
22594
|
+
return React.createElement('div', { style: CAP_CARD },
|
|
22595
|
+
React.createElement('div', { style: { display: 'flex', gap: '8px', alignItems: 'flex-start' } },
|
|
22596
|
+
React.createElement('div', { style: CAP_ICON }, '🧰'),
|
|
22597
|
+
React.createElement('div', { style: { flex: 1, minWidth: 0 } },
|
|
22598
|
+
React.createElement('div', { style: { fontWeight: 600, fontSize: '13px', display: 'flex', gap: '6px', flexWrap: 'wrap', alignItems: 'center' } },
|
|
22599
|
+
tool.name,
|
|
22600
|
+
React.createElement(CuratedTag, { tone: tool.risk }, risk),
|
|
22601
|
+
React.createElement(CuratedTag, null, weT('非 DSH 插件'))),
|
|
22602
|
+
React.createElement('div', { className: 'we-picker__hint' }, tool.desc),
|
|
22603
|
+
React.createElement('div', { style: { display: 'flex', gap: '6px', flexWrap: 'wrap', marginTop: '4px' } },
|
|
22604
|
+
React.createElement(CuratedTag, null, tool.license),
|
|
22605
|
+
React.createElement(CuratedTag, null, tool.requires))),
|
|
22606
|
+
React.createElement('span', { style: { fontSize: '10px', opacity: 0.6 } }, PERSONAL_CATEGORY_LABELS[tool.category] || tool.category)),
|
|
22607
|
+
React.createElement('div', { style: { display: 'flex', gap: '6px', flexWrap: 'wrap' } },
|
|
22608
|
+
React.createElement('button', { type: 'button', className: 'we-picker__btn', onClick: copyRepo },
|
|
22609
|
+
copied ? weT('已复制') : weT('复制仓库地址')),
|
|
22610
|
+
React.createElement('a', {
|
|
22611
|
+
className: 'we-picker__btn', href: tool.repo, target: '_blank', rel: 'noreferrer',
|
|
22612
|
+
style: { textDecoration: 'none' },
|
|
22613
|
+
}, weT('打开 GitHub')),
|
|
22614
|
+
React.createElement('button', { type: 'button', className: 'we-picker__btn', onClick: () => setOpen((v) => !v) },
|
|
22615
|
+
open ? weT('收起') : weT('详情'))),
|
|
22616
|
+
note ? React.createElement('div', { className: 'we-picker__hint', style: { color: '#4caf7d' } }, note) : null,
|
|
22617
|
+
React.createElement('div', { className: 'we-picker__hint' },
|
|
22618
|
+
weT('需按 README 安装;助手只给步骤,不盲装。')),
|
|
22619
|
+
open ? React.createElement('div', { style: { display: 'flex', flexDirection: 'column', gap: '4px' } },
|
|
22620
|
+
React.createElement('div', { className: 'we-picker__hint' }, tool.detail),
|
|
22621
|
+
React.createElement('div', { className: 'we-picker__hint' }, weT('前置:') + tool.requires),
|
|
22622
|
+
React.createElement('div', { className: 'we-picker__hint' }, weT('许可:') + tool.license),
|
|
22623
|
+
React.createElement('a', { href: tool.repo, target: '_blank', rel: 'noreferrer', style: { fontSize: '11px', color: 'inherit' } }, tool.repo),
|
|
22624
|
+
(tool.repos || []).length ? React.createElement('div', { style: { display: 'flex', flexDirection: 'column', gap: '2px' } },
|
|
22625
|
+
tool.repos.map((r) => React.createElement('a', {
|
|
22626
|
+
key: r.repo, href: r.repo, target: '_blank', rel: 'noreferrer', style: { fontSize: '11px', color: 'inherit' },
|
|
22627
|
+
}, r.name + ' · ' + r.repo))) : null) : null);
|
|
22628
|
+
}
|
|
22629
|
+
|
|
22630
|
+
function PersonalPanel({ tools }) {
|
|
22631
|
+
const [category, setCategory] = React.useState('all');
|
|
22632
|
+
const [query, setQuery] = React.useState('');
|
|
22633
|
+
const list = (Array.isArray(tools) ? tools : []).filter((t) => {
|
|
22634
|
+
if (category !== 'all' && t.category !== category) return false;
|
|
22635
|
+
const q = String(query || '').trim().toLowerCase();
|
|
22636
|
+
if (!q) return true;
|
|
22637
|
+
return [t.name, t.desc, t.repo, t.category].join(' ').toLowerCase().includes(q);
|
|
22638
|
+
});
|
|
22639
|
+
return React.createElement('div', { style: { marginTop: '8px' } },
|
|
22640
|
+
React.createElement('div', { style: { display: 'flex', gap: '4px', flexWrap: 'wrap' } },
|
|
22641
|
+
Object.keys(PERSONAL_CATEGORY_LABELS).map((id) => React.createElement('button', {
|
|
22642
|
+
key: id, type: 'button',
|
|
22643
|
+
className: 'we-picker__btn' + (category === id ? ' we-picker__btn--primary' : ''),
|
|
22644
|
+
onClick: () => setCategory(id),
|
|
22645
|
+
}, weT(PERSONAL_CATEGORY_LABELS[id])))),
|
|
22646
|
+
React.createElement('div', { style: { display: 'flex', gap: '8px', alignItems: 'center', marginTop: '6px' } },
|
|
22647
|
+
React.createElement('input', {
|
|
22648
|
+
type: 'text', value: query, placeholder: weT('搜索个人工具'),
|
|
22649
|
+
onChange: (e) => setQuery(e.target.value),
|
|
22650
|
+
style: { flex: '1 1 180px', fontSize: '11px', padding: '4px 6px', borderRadius: '6px', border: '1px solid rgba(255,255,255,0.16)', background: 'transparent', color: 'inherit' },
|
|
22651
|
+
}),
|
|
22652
|
+
React.createElement('span', { className: 'we-picker__hint' }, weT('共 {n} 项', { n: list.length }))),
|
|
22653
|
+
list.length ? React.createElement('div', {
|
|
22654
|
+
style: { display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(340px, 1fr))', gap: '8px', marginTop: '8px' },
|
|
22655
|
+
}, list.map((tool) => React.createElement(PersonalToolCard, { key: tool.id, tool })))
|
|
22656
|
+
: React.createElement('div', { className: 'we-picker__hint', style: { marginTop: '10px' } }, weT('没有匹配的个人工具')));
|
|
22657
|
+
}
|
|
22658
|
+
|
|
22659
|
+
function CuratedPanel({ data, favorites, onToggleFavorite, agentsAvailable }) {
|
|
22478
22660
|
const [family, setFamily] = React.useState('all');
|
|
22479
22661
|
const [favOnly, setFavOnly] = React.useState(false);
|
|
22480
22662
|
const [query, setQuery] = React.useState('');
|
|
@@ -22534,6 +22716,7 @@ window.__ModuleLoader__.load({
|
|
|
22534
22716
|
}, list.map((bundle) => React.createElement(CuratedCard, {
|
|
22535
22717
|
key: bundle.id, bundle, installed, favorite: favorites.has(bundle.id),
|
|
22536
22718
|
recommended: recommended.includes(bundle.id),
|
|
22719
|
+
agentsAvailable: data && data.agentsAvailable === true,
|
|
22537
22720
|
onToggleFavorite, onCopy: copyPlainText,
|
|
22538
22721
|
onExport: (b, format) => downloadTextFile(
|
|
22539
22722
|
'folia-curated-' + b.id + '.' + (format === 'json' ? 'json' : format === 'bash' ? 'sh' : 'ps1'),
|
|
@@ -22547,7 +22730,7 @@ window.__ModuleLoader__.load({
|
|
|
22547
22730
|
|
|
22548
22731
|
function CapabilitiesSection() {
|
|
22549
22732
|
// items = 市场快照;curated = 20 套组合;page = 精选/工作能力/娱乐(精选默认)
|
|
22550
|
-
const [state, setState] = React.useState({ items: null, curated: null, page: "curated", error: null });
|
|
22733
|
+
const [state, setState] = React.useState({ items: null, curated: null, page: "curated", curatedTab: "bundles", error: null, agentsAvailable: false });
|
|
22551
22734
|
const [favorites, setFavorites] = React.useState(() => new Set(readCuratedFavorites()));
|
|
22552
22735
|
|
|
22553
22736
|
React.useEffect(() => {
|
|
@@ -22562,6 +22745,7 @@ window.__ModuleLoader__.load({
|
|
|
22562
22745
|
...prev,
|
|
22563
22746
|
items: catDoc && Array.isArray(catDoc.items) ? catDoc.items : prev.items,
|
|
22564
22747
|
curated: curDoc && Array.isArray(curDoc.bundles) ? curDoc : prev.curated,
|
|
22748
|
+
agentsAvailable: Boolean((catDoc && catDoc.agentsAvailable) || (curDoc && curDoc.agentsAvailable) || prev.agentsAvailable),
|
|
22565
22749
|
error: !catDoc && !curDoc ? weT("读取失败,重开设置页再试") : null,
|
|
22566
22750
|
}));
|
|
22567
22751
|
})();
|
|
@@ -22592,7 +22776,7 @@ window.__ModuleLoader__.load({
|
|
|
22592
22776
|
return React.createElement("div", { style: { padding: "4px 2px" } },
|
|
22593
22777
|
React.createElement("div", { style: { fontSize: "14px", fontWeight: 600 } }, weT("能力")),
|
|
22594
22778
|
React.createElement("div", { className: "we-picker__hint", style: { marginTop: "2px" } },
|
|
22595
|
-
weT("
|
|
22779
|
+
weT("这些是可选的插件与个人工具。安装方式:复制包名命令或 GitHub 地址 → 粘贴到 DSH 对话 → 让助手帮你下载安装(会先确认)。已装插件可由助手交给 DSH 执行;未装的只能看说明。非 DSH 插件的个人工具(Docker/Windows 应用)需要按 README 安装,助手只给步骤。")),
|
|
22596
22780
|
// 三个页面之间切换(页内 tab),精选默认打开
|
|
22597
22781
|
React.createElement("div", { style: { display: "flex", gap: "6px", marginTop: "10px" } },
|
|
22598
22782
|
tabs.map((tab) => React.createElement("button", {
|
|
@@ -22603,12 +22787,26 @@ window.__ModuleLoader__.load({
|
|
|
22603
22787
|
}, tab.label))),
|
|
22604
22788
|
page === "curated"
|
|
22605
22789
|
? (state.curated
|
|
22606
|
-
?
|
|
22790
|
+
? [
|
|
22791
|
+
React.createElement("div", { key: "curated-segments", style: { display: "flex", gap: "4px", marginTop: "8px" } },
|
|
22792
|
+
[["bundles", weT("场景组合")], ["personal", weT("个人工具")]].map(([id, label]) => React.createElement("button", {
|
|
22793
|
+
key: id, type: "button",
|
|
22794
|
+
className: "we-picker__btn" + (state.curatedTab === id ? " we-picker__btn--primary" : ""),
|
|
22795
|
+
onClick: () => setState((prev) => ({ ...prev, curatedTab: id })),
|
|
22796
|
+
}, label))),
|
|
22797
|
+
state.curatedTab === "personal"
|
|
22798
|
+
? React.createElement(PersonalPanel, { key: "personal", tools: state.curated.personalTools })
|
|
22799
|
+
: React.createElement(CuratedPanel, {
|
|
22800
|
+
key: "bundles", data: state.curated, favorites, onToggleFavorite: toggleFavorite,
|
|
22801
|
+
agentsAvailable: state.agentsAvailable === true,
|
|
22802
|
+
}),
|
|
22803
|
+
]
|
|
22607
22804
|
: React.createElement("div", { className: "we-picker__hint", style: { marginTop: "10px" } }, weT("精选读取失败,重开设置页再试")))
|
|
22608
22805
|
: React.createElement(CapGroup, {
|
|
22609
22806
|
title: page === "work" ? weT("工作能力") : weT("娱乐"),
|
|
22610
22807
|
hint: page === "work" ? weT("提高日常办事效率") : weT("让界面和对话更有趣"),
|
|
22611
22808
|
items: page === "work" ? workItems : funItems,
|
|
22809
|
+
agentsAvailable: state.agentsAvailable === true,
|
|
22612
22810
|
}));
|
|
22613
22811
|
}
|
|
22614
22812
|
|
|
@@ -27782,6 +27980,43 @@ window.__ModuleLoader__.load({
|
|
|
27782
27980
|
);
|
|
27783
27981
|
}
|
|
27784
27982
|
|
|
27983
|
+
/**
|
|
27984
|
+
* 当前筛选链里"子标签之外"的条件:缓存状态 / 来源 / 搜索。
|
|
27985
|
+
* 抽成纯函数是为了让计数口径能被 test 直接执行(不是抄一遍断言)。
|
|
27986
|
+
*/
|
|
27987
|
+
function qpFilterBase(playable, cacheFilter, sourceFilter, q) {
|
|
27988
|
+
return (Array.isArray(playable) ? playable : []).filter((w) => {
|
|
27989
|
+
const ready = Boolean(w && w.localReady === true);
|
|
27990
|
+
if (cacheFilter === "cached" && !ready) return false;
|
|
27991
|
+
if (cacheFilter === "uncached" && ready) return false;
|
|
27992
|
+
if (sourceFilter !== "all" && ((w.source === "folia") ? "site" : "local") !== sourceFilter) return false;
|
|
27993
|
+
if (q && String(w.title || "").toLowerCase().indexOf(q) === -1) return false;
|
|
27994
|
+
return true;
|
|
27995
|
+
});
|
|
27996
|
+
}
|
|
27997
|
+
|
|
27998
|
+
/** facets 选项 + **按当前其它条件重算**的计数(0 张由渲染器置灰)。 */
|
|
27999
|
+
function qpSubtagOptionsWithCounts(facetOptions, base) {
|
|
28000
|
+
const counts = new Map();
|
|
28001
|
+
for (const w of base || []) {
|
|
28002
|
+
const value = String((w && w.subtag) || "").trim();
|
|
28003
|
+
if (!value) continue;
|
|
28004
|
+
counts.set(value, (counts.get(value) || 0) + 1);
|
|
28005
|
+
}
|
|
28006
|
+
return (Array.isArray(facetOptions) ? facetOptions : []).map((it) => Object.assign({}, it, {
|
|
28007
|
+
count: counts.get(it.value) || 0,
|
|
28008
|
+
}));
|
|
28009
|
+
}
|
|
28010
|
+
|
|
28011
|
+
/** 当前子标签在"其它条件已过滤"的底数里还剩几张;0 张 ⇒ 调用方自动回退「全部」。 */
|
|
28012
|
+
function qpSubtagSelection(rawSubtagFilter, base) {
|
|
28013
|
+
const count = rawSubtagFilter
|
|
28014
|
+
? (base || []).filter((w) => String((w && w.subtag) || "").trim() === rawSubtagFilter).length
|
|
28015
|
+
: (base || []).length;
|
|
28016
|
+
const lost = Boolean(rawSubtagFilter && count === 0);
|
|
28017
|
+
return { count, lost, effective: lost ? "" : rawSubtagFilter };
|
|
28018
|
+
}
|
|
28019
|
+
|
|
27785
28020
|
// 筛选条(pre.51):只有 [缓存][子标签][来源] 三个下拉 + 搜索 + 视图切换。
|
|
27786
28021
|
// 分级 / 类型两档已按用户口径删除(「侧栏快捷键壁纸筛选条改成三个下拉」)。
|
|
27787
28022
|
// 取值与处理器全部经 `filters` 入参进来 —— 本函数是纯渲染器,不读外层 state,
|
|
@@ -27790,6 +28025,8 @@ window.__ModuleLoader__.load({
|
|
|
27790
28025
|
const {
|
|
27791
28026
|
cacheFilter, subtagFilter, subtagOptions, sourceFilter,
|
|
27792
28027
|
onCacheFilterChange, onSubtagFilterChange,
|
|
28028
|
+
// 过滤器交互时清掉"自动回退"提示;提示本身由 QuickPanel 生成本地状态。
|
|
28029
|
+
onFilterInteract, filterNote,
|
|
27793
28030
|
// 本地上传入口的 UI 态与动作也随 `filters` 这一份渲染 ctx 进来(不新开第 5 个形参:
|
|
27794
28031
|
// 该签名被 verify-panel-interactions 的既有判据按字面锚定)。
|
|
27795
28032
|
upload,
|
|
@@ -27803,7 +28040,10 @@ window.__ModuleLoader__.load({
|
|
|
27803
28040
|
value: sel.qpSearch || "",
|
|
27804
28041
|
placeholder: weT("搜索壁纸标题…"),
|
|
27805
28042
|
"aria-label": weT("搜索壁纸标题"),
|
|
27806
|
-
onInput: (e) => {
|
|
28043
|
+
onInput: (e) => {
|
|
28044
|
+
if (onFilterInteract) onFilterInteract();
|
|
28045
|
+
setTransient("qpSearch", e.target.value); emit();
|
|
28046
|
+
},
|
|
27807
28047
|
}),
|
|
27808
28048
|
// 本地上传入口:搜索框右边(用户点名要的位置)。窄侧栏里按钮只显示图标,
|
|
27809
28049
|
// 完整文案在 title / aria-label 里 —— 见 styles-quick.js 的 420px 断点。
|
|
@@ -27842,11 +28082,16 @@ window.__ModuleLoader__.load({
|
|
|
27842
28082
|
),
|
|
27843
28083
|
// 上传状态行:搜索行下方(进度 / 错误 / 重复提示 / 拖拽提示)。
|
|
27844
28084
|
qpRenderUploadStatus(sel, upload && upload.progress, Boolean(upload && upload.dragActive)),
|
|
28085
|
+
// 子标签自动回退提示(例如"当前缓存里没有「原神」的壁纸,已切回全部")。
|
|
28086
|
+
filterNote ? React.createElement("div", { className: "we-picker__note" }, filterNote) : null,
|
|
27845
28087
|
// ① 缓存状态:全部 / 已缓存 / 未缓存(pre.51 新)。
|
|
27846
28088
|
React.createElement("select", {
|
|
27847
28089
|
className: "we-picker__select we-qp__filter we-qp__cache",
|
|
27848
28090
|
value: cacheFilter || "all",
|
|
27849
|
-
onChange:
|
|
28091
|
+
onChange: (e) => {
|
|
28092
|
+
if (onFilterInteract) onFilterInteract();
|
|
28093
|
+
onCacheFilterChange(e);
|
|
28094
|
+
},
|
|
27850
28095
|
"aria-label": weT("缓存状态"),
|
|
27851
28096
|
title: weT("按缓存状态筛选:已缓存 = 本机已有文件,未缓存 = 需要下载"),
|
|
27852
28097
|
},
|
|
@@ -27856,19 +28101,29 @@ window.__ModuleLoader__.load({
|
|
|
27856
28101
|
React.createElement("select", {
|
|
27857
28102
|
className: "we-picker__select we-qp__filter we-qp__subtag",
|
|
27858
28103
|
value: subtagFilter || "",
|
|
27859
|
-
onChange:
|
|
28104
|
+
onChange: (e) => {
|
|
28105
|
+
if (onFilterInteract) onFilterInteract();
|
|
28106
|
+
onSubtagFilterChange(e);
|
|
28107
|
+
},
|
|
27860
28108
|
"aria-label": weT("子标签"),
|
|
27861
28109
|
title: weT("按站点子标签筛选(站点新增子标签后,重开面板即同步)"),
|
|
27862
28110
|
},
|
|
27863
28111
|
React.createElement("option", { value: "" }, weT("全部")),
|
|
27864
28112
|
...(Array.isArray(subtagOptions) ? subtagOptions : []).map((it) =>
|
|
27865
|
-
React.createElement("option", {
|
|
28113
|
+
React.createElement("option", {
|
|
28114
|
+
key: it.value, value: it.value,
|
|
28115
|
+
// 当前缓存/来源/搜索条件下 0 张 ⇒ 置灰,避免"点了只剩空态"的假故障。
|
|
28116
|
+
disabled: Number(it.count) === 0,
|
|
28117
|
+
}, it.label + " (" + Number(it.count || 0) + ")")),
|
|
27866
28118
|
),
|
|
27867
28119
|
// ③ 来源筛选:本机 Wallpaper Engine 库 vs 我们站点(与设置页同一个键)。
|
|
27868
28120
|
React.createElement("select", {
|
|
27869
28121
|
className: "we-picker__select we-qp__filter we-qp__source",
|
|
27870
28122
|
value: sourceFilter || "all",
|
|
27871
|
-
onChange: (e) => {
|
|
28123
|
+
onChange: (e) => {
|
|
28124
|
+
if (onFilterInteract) onFilterInteract();
|
|
28125
|
+
setSetting("sourceFilter", e.target.value); emit();
|
|
28126
|
+
},
|
|
27872
28127
|
"aria-label": weT("来源筛选"),
|
|
27873
28128
|
title: weT("按来源筛选:本机 Wallpaper Engine 库,还是从我们站点拉下来的壁纸"),
|
|
27874
28129
|
},
|
|
@@ -27877,18 +28132,17 @@ window.__ModuleLoader__.load({
|
|
|
27877
28132
|
);
|
|
27878
28133
|
}
|
|
27879
28134
|
|
|
27880
|
-
function qpRenderList(listRef, rows, view, cardsView, vTopH, vBtmH,
|
|
27881
|
-
//
|
|
27882
|
-
|
|
27883
|
-
|
|
27884
|
-
|
|
27885
|
-
|
|
27886
|
-
|
|
27887
|
-
|
|
27888
|
-
|
|
27889
|
-
|
|
27890
|
-
|
|
27891
|
-
}
|
|
28135
|
+
function qpRenderList(listRef, rows, view, cardsView, vTopH, vBtmH, sel, empty) {
|
|
28136
|
+
// 有筛选条件但没有结果:说清"当前条件共 0 张"并给清空入口;没有筛选条件时保持原空态。
|
|
28137
|
+
const emptyNode = empty && empty.hasActiveFilters
|
|
28138
|
+
? React.createElement("div", { className: "we-qp__empty" },
|
|
28139
|
+
React.createElement("span", { className: "we-picker__hint" },
|
|
28140
|
+
weT("当前条件:{summary},共 0 张", { summary: empty.summary || weT("全部") })),
|
|
28141
|
+
React.createElement("button", {
|
|
28142
|
+
type: "button", className: "we-picker__btn",
|
|
28143
|
+
onClick: empty.onClearFilters,
|
|
28144
|
+
}, weT("清空筛选")))
|
|
28145
|
+
: React.createElement("span", { className: "we-picker__hint" }, weT("没有可播放的壁纸"));
|
|
27892
28146
|
return React.createElement("div", {
|
|
27893
28147
|
ref: listRef,
|
|
27894
28148
|
className: "we-qp__list" + (view === "cards" ? " we-qp__list--cards" : ""),
|
|
@@ -27903,7 +28157,7 @@ window.__ModuleLoader__.load({
|
|
|
27903
28157
|
rows.map((w) => qpRenderCardGuarded(w, sel, cardsView)),
|
|
27904
28158
|
vBtmH > 0 ? qpRenderSpacer("we-qp-vbtm", vBtmH) : null,
|
|
27905
28159
|
)
|
|
27906
|
-
:
|
|
28160
|
+
: emptyNode,
|
|
27907
28161
|
);
|
|
27908
28162
|
}
|
|
27909
28163
|
|
|
@@ -27947,8 +28201,7 @@ window.__ModuleLoader__.load({
|
|
|
27947
28201
|
)
|
|
27948
28202
|
: React.createElement(React.Fragment, null,
|
|
27949
28203
|
qpRenderViewBar(sel, view, filters, switchView),
|
|
27950
|
-
qpRenderList(listRef, rows, view, cardsView, vTopH, vBtmH,
|
|
27951
|
-
filters.cacheFilter, filters.subtagFilter, filters.subtagLabel, sel),
|
|
28204
|
+
qpRenderList(listRef, rows, view, cardsView, vTopH, vBtmH, sel, filters.empty),
|
|
27952
28205
|
),
|
|
27953
28206
|
);
|
|
27954
28207
|
}
|
|
@@ -28051,6 +28304,8 @@ window.__ModuleLoader__.load({
|
|
|
28051
28304
|
// 用一条队列按序喂 useState,插在前面会把 fontOpen / glassDetailOpen 那几档的值顶错位。
|
|
28052
28305
|
const [uploadState, setUploadState] = React.useState({ busy: false, done: 0, total: 0 });
|
|
28053
28306
|
const [uploadDragActive, setUploadDragActive] = React.useState(false);
|
|
28307
|
+
// 子标签在当前其它条件下变 0 时,自动回退并留一句提示;下一次筛选项交互时清掉。
|
|
28308
|
+
const [filterNote, setFilterNote] = React.useState("");
|
|
28054
28309
|
// 防连点:state 更新是异步的,同一帧里连按两次会各起一条串行链。
|
|
28055
28310
|
const uploadBusyRef = React.useRef(false);
|
|
28056
28311
|
const runQpUpload = async (filesIn) => {
|
|
@@ -28144,27 +28399,56 @@ window.__ModuleLoader__.load({
|
|
|
28144
28399
|
// 缓存档:持久化键与设置页壁纸库共用;坏值回落「全部」。
|
|
28145
28400
|
const cacheRaw = readPickerCacheFilter();
|
|
28146
28401
|
const cacheFilter = (cacheRaw === "cached" || cacheRaw === "uncached") ? cacheRaw : "all";
|
|
28147
|
-
//
|
|
28148
|
-
|
|
28149
|
-
|
|
28402
|
+
// 子标签:选项来自 facets(站点新增后重开即同步),但**计数按当前其它筛选条件重算**:
|
|
28403
|
+
// 缓存状态 / 来源 / 搜索先过一遍,再看每个子标签还剩几张。否则会显示"全部"的计数,
|
|
28404
|
+
// 用户按它选完却只剩空态(pre.71 的 P0)。
|
|
28405
|
+
const rawSubtagFilter = String(readPickerSubtagFilter() || "").trim();
|
|
28406
|
+
const facetSubtagOptions = (() => {
|
|
28150
28407
|
const groups = tagOptionsFromFacets(sel.inventory && sel.inventory.facets);
|
|
28151
28408
|
const g = groups.find((x) => x && x.group === "subtags");
|
|
28152
28409
|
return g && Array.isArray(g.items) ? g.items : [];
|
|
28153
28410
|
})();
|
|
28154
|
-
const
|
|
28155
|
-
const
|
|
28156
|
-
|
|
28157
|
-
|
|
28158
|
-
|
|
28159
|
-
|
|
28160
|
-
|
|
28161
|
-
|
|
28162
|
-
if (
|
|
28163
|
-
|
|
28164
|
-
|
|
28165
|
-
|
|
28166
|
-
|
|
28167
|
-
|
|
28411
|
+
const subtagBase = qpFilterBase(playable, cacheFilter, sourceFilter, q);
|
|
28412
|
+
const subtagOptions = qpSubtagOptionsWithCounts(facetSubtagOptions, subtagBase);
|
|
28413
|
+
const subtagLabel = (subtagOptions.find((it) => it.value === rawSubtagFilter) || {}).label || rawSubtagFilter;
|
|
28414
|
+
const subtagSelection = qpSubtagSelection(rawSubtagFilter, subtagBase);
|
|
28415
|
+
// 当前选中的子标签在其它条件下变 0 ⇒ 自动回退「全部」,并留一句可读提示。
|
|
28416
|
+
const subtagLost = subtagSelection.lost;
|
|
28417
|
+
const effectiveSubtagFilter = subtagSelection.effective;
|
|
28418
|
+
React.useEffect(() => {
|
|
28419
|
+
if (!subtagLost) return;
|
|
28420
|
+
writePickerSubtagFilter("");
|
|
28421
|
+
setFilterNote(weT(
|
|
28422
|
+
cacheFilter === "cached"
|
|
28423
|
+
? "当前缓存里没有「{name}」的壁纸,已切回全部"
|
|
28424
|
+
: "当前条件下没有「{name}」的壁纸,已切回全部",
|
|
28425
|
+
{ name: subtagLabel || rawSubtagFilter },
|
|
28426
|
+
));
|
|
28427
|
+
}, [subtagLost, rawSubtagFilter, subtagLabel, cacheFilter]);
|
|
28428
|
+
const filtered = subtagBase.filter((w) => (
|
|
28429
|
+
!effectiveSubtagFilter || String((w && w.subtag) || "").trim() === effectiveSubtagFilter
|
|
28430
|
+
));
|
|
28431
|
+
// 空态用:当前所有生效条件 + 清空筛选入口。
|
|
28432
|
+
const conditionParts = [];
|
|
28433
|
+
if (cacheFilter !== "all") conditionParts.push(weT(cacheFilter === "cached" ? "已缓存" : "未缓存"));
|
|
28434
|
+
if (sourceFilter !== "all") conditionParts.push(weT(sourceFilter === "local" ? "本机" : "站点"));
|
|
28435
|
+
if (effectiveSubtagFilter) {
|
|
28436
|
+
conditionParts.push(weT("子标签:{name}", { name: subtagLabel || effectiveSubtagFilter }));
|
|
28437
|
+
}
|
|
28438
|
+
if (q) conditionParts.push(weT("搜索「{query}」", { query: sel.qpSearch }));
|
|
28439
|
+
const clearFilters = () => {
|
|
28440
|
+
writePickerCacheFilter("all");
|
|
28441
|
+
writePickerSubtagFilter("");
|
|
28442
|
+
setTransient("qpSearch", "");
|
|
28443
|
+
setSetting("sourceFilter", "all");
|
|
28444
|
+
setFilterNote("");
|
|
28445
|
+
emit();
|
|
28446
|
+
};
|
|
28447
|
+
const filterEmpty = {
|
|
28448
|
+
hasActiveFilters: conditionParts.length > 0,
|
|
28449
|
+
summary: conditionParts.join(" + "),
|
|
28450
|
+
onClearFilters: clearFilters,
|
|
28451
|
+
};
|
|
28168
28452
|
// 虚拟滚动:列表一行一张、卡片一行 cols 张(列数由测量 effect 实测回填)。搜索 /
|
|
28169
28453
|
// 筛选把列表收窄后旧窗口可能越界 —— 渲染期先钳一道(测量 effect 随 count 变化跟上);
|
|
28170
28454
|
// 换视图瞬间旧窗口是另一档的几何(cards 标记对不上)⇒ 按未测量处理:先画顶部
|
|
@@ -28259,10 +28543,14 @@ window.__ModuleLoader__.load({
|
|
|
28259
28543
|
// 库还没回来 / 扫描失败:**只有这一页**给一句话 —— 外观 / 播放两页不依赖库,
|
|
28260
28544
|
// 照常可用(不能整块替换掉,那样连外观都进不去)。
|
|
28261
28545
|
qpRenderLibrarySection(sel, view, {
|
|
28262
|
-
cacheFilter, subtagFilter, subtagOptions, subtagLabel, sourceFilter,
|
|
28546
|
+
cacheFilter, subtagFilter: effectiveSubtagFilter, subtagOptions, subtagLabel, sourceFilter,
|
|
28263
28547
|
// 两个 handler 直接从同一 bundle 作用域取(client.js 里的
|
|
28264
28548
|
// onCacheFilterChange / onSubtagFilterChange:写持久化键 + emit)。
|
|
28265
28549
|
onCacheFilterChange, onSubtagFilterChange,
|
|
28550
|
+
// 用户一改筛选项就清掉上一句自动回退提示。
|
|
28551
|
+
onFilterInteract: () => { if (filterNote) setFilterNote(""); },
|
|
28552
|
+
filterNote,
|
|
28553
|
+
empty: filterEmpty,
|
|
28266
28554
|
// 本地上传的进度 / 拖拽态 / 动作:渲染器只读这份 ctx。
|
|
28267
28555
|
upload: qpUpload,
|
|
28268
28556
|
}, listRef, rows, cardsView, vTopH, vBtmH, q, switchView),
|