dsh-fish-soul 0.19.26 → 0.19.27

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  让一个 QQ 小号背后有"同一个人":固定人格、按人记记忆、有自己的生活节奏、会主动开口;同一个"她"同时出现在 QQ、B站、抖音。
4
4
 
5
- DSH 插件(单角色 `feiyu`)。版本 **0.19.26**。
5
+ DSH 插件(单角色 `feiyu`)。版本 **0.19.27**。
6
6
 
7
7
  QQ 交流群:**1125962189**
8
8
 
@@ -46,15 +46,17 @@ window.__ModuleLoader__.load({
46
46
  const [level, setLevel] = react.useState("all");
47
47
  const [data, load, err] = usePoll(api, "/diag-log", 15000);
48
48
  const [confirm, confirmNode] = useConfirm();
49
+ const entries = data?.entries ?? [];
50
+ const shownEntries = level === "all" ? entries : entries.filter((e) => e.level === level);
51
+ const diagFlipKey = shownEntries.map((e, i) => `${e.at}-${e.key ?? i}`).join(",");
52
+ const diagListRef = typeof ui.useFlipList === "function" ? ui.useFlipList(diagFlipKey) : undefined;
49
53
  if (!data) {
50
54
  if (err) return h("div", { className: "fs-notice", role: "alert" }, h("b", null, "运行日志读取失败"), h("span", null, err), Button({ onClick: load }, "重试"));
51
55
  return h("div", { className: "fs-empty" }, "加载中…");
52
56
  }
53
57
 
54
- const entries = data.entries ?? [];
55
58
  const warnCount = entries.filter((e) => e.level === "warn").length;
56
59
  const errCount = entries.filter((e) => e.level === "error").length;
57
- const shownEntries = level === "all" ? entries : entries.filter((e) => e.level === level);
58
60
  const pad = (n) => String(n).padStart(2, "0");
59
61
  const fmtTime = (ms) => {
60
62
  const d = new Date(ms);
@@ -106,12 +108,15 @@ window.__ModuleLoader__.load({
106
108
  h("button", { type: "button", className: "fs-pill", "aria-pressed": level === "error", onClick: () => setLevel("error") }, `错误 ${errCount}`)),
107
109
  shownEntries.length === 0
108
110
  ? h("div", { className: "fs-empty" }, "这个级别下没有日志。")
109
- : h("div", { className: "fs-diag-list" },
110
- shownEntries.map((e, i) => h("div", { key: `${e.at}-${e.key ?? i}`, className: "fs-diag-row", "data-level": e.level },
111
- h("span", { className: "fs-diag-time" }, fmtTime(e.at)),
112
- e.level === "error" ? Tag("错误", "danger") : e.level === "warn" ? Tag("警告", "warning") : null,
113
- h("span", { className: "fs-diag-label", "data-level": e.level }, e.label),
114
- h("span", { className: "fs-diag-detail" }, describe(e)))))),
111
+ : h("div", { className: "fs-diag-list", ref: diagListRef },
112
+ shownEntries.map((e, i) => {
113
+ const flipKey = `${e.at}-${e.key ?? i}`;
114
+ return h("div", { key: flipKey, "data-flip-key": flipKey, className: "fs-diag-row", "data-level": e.level },
115
+ h("span", { className: "fs-diag-time" }, fmtTime(e.at)),
116
+ e.level === "error" ? Tag("错误", "danger") : e.level === "warn" ? Tag("警告", "warning") : null,
117
+ h("span", { className: "fs-diag-label", "data-level": e.level }, e.label),
118
+ h("span", { className: "fs-diag-detail" }, describe(e)));
119
+ }))),
115
120
  confirmNode);
116
121
  }
117
122
 
package/lib/client.js CHANGED
@@ -34,6 +34,8 @@ window.__ModuleLoader__.load({
34
34
  const API = "/api/plugins/fish-soul";
35
35
  const h = react.createElement;
36
36
  const cx = (...names) => names.filter(Boolean).join(" ");
37
+ const useIsoLayoutEffect = react.useLayoutEffect ?? react.useEffect;
38
+ const prefersReducedMotion = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && Boolean(window.matchMedia("(prefers-reduced-motion: reduce)")?.matches);
37
39
 
38
40
  // ── 通信层:fail-open(任何请求失败都不抛到宿主) ──
39
41
  // opts.raw:body 直接当原始二进制发(File/Blob/Buffer),不做 JSON 序列化。
@@ -102,11 +104,19 @@ window.__ModuleLoader__.load({
102
104
  chevron: "m7 10 5 5 5-5", chevronUp: "m7 14 5-5 5 5",
103
105
  edit: "M4 20h4L18.5 9.5a2.1 2.1 0 0 0-4-4L4 16v4Z M13.5 6.5l4 4",
104
106
  sidebar: "M4 5h16v14H4Z M9 5v14",
105
- info: "M12 8h.01 M11 12h1v5h1 M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18Z"
107
+ info: "M12 8h.01 M11 12h1v5h1 M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18Z",
108
+ search: "M11 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14Z M20 20l-4-4",
109
+ group_memory: "M12 3 3 7.5 12 12l9-4.5L12 3Z M3 12l9 4.5 9-4.5 M3 16.5l9 4.5 9-4.5",
110
+ group_character: "M12 3l1.6 4.4L18 9l-4.4 1.6L12 15l-1.6-4.4L6 9l4.4-1.6L12 3Z M19 16v3 M20.5 17.5h-3",
111
+ group_daily: "M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z M12 8v4l3 2",
112
+ group_channels: "M4 11a9 9 0 0 1 9 9 M4 4a16 16 0 0 1 16 16 M5 19a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",
113
+ group_models: "M9 4v2 M15 4v2 M9 18v2 M15 18v2 M4 9h2 M4 15h2 M18 9h2 M18 15h2 M6 6h12v12H6Z M10 10h4v4h-4Z",
114
+ group_system: "M4 6h16 M4 12h16 M4 18h16 M9 4v4 M15 10v4 M10 16v4",
115
+ guide: "M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18Z M15 9l-2 4-4 2 2-4 4-2Z"
106
116
  };
107
117
  const ICON_COMPONENTS = { close: "IconCloseOutlineRegular", refresh: "IconRefreshOutlineRegular", chevron: "IconChevronDownOutlineRegular", chevronUp: "IconChevronUpOutlineRegular", edit: "IconEditOutlineRegular", sidebar: "IconPanelLeftOutlineRegular", info: "IconInfoOutlineRegular" };
108
- const Icon = (name, size = 16) => primitives?.[ICON_COMPONENTS[name]] ? h(primitives[ICON_COMPONENTS[name]], { size, "aria-hidden": true })
109
- : h("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true }, h("path", { d: ICONS[name] }));
118
+ const Icon = (name, size = 16, className) => primitives?.[ICON_COMPONENTS[name]] ? h(primitives[ICON_COMPONENTS[name]], { size, ...(className ? { className } : {}), "aria-hidden": true })
119
+ : h("svg", { ...(className ? { className } : {}), width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true }, h("path", { d: ICONS[name] }));
110
120
 
111
121
  function Switch({ checked, onChange, label, disabled }) {
112
122
  if (primitives?.Switch) return h(primitives.Switch, { checked: checked === true, onChange, label, disabled, className: "fs-native-switch" });
@@ -116,7 +126,7 @@ window.__ModuleLoader__.load({
116
126
  const Button = ({ variant, ...props }, ...kids) => primitives?.Button
117
127
  // ⚠️ 不要给 primary 加自定义 class 去改底色 —— 宿主原生是深色实心
118
128
  // (--dsw-alias-button-primary-fill + 反色字),改色就是「近似模拟」。
119
- ? h(primitives.Button, { ...props, variant: variant === "danger" ? "outline" : variant ?? "outline", size: "sm", className: cx("fs-native-btn", variant === "danger" && "fs-native-danger", props.className) }, ...kids)
129
+ ? h(primitives.Button, { ...props, variant: variant === "danger" ? "outline" : variant ?? "outline", size: "sm", className: cx("fs-native-btn", variant === "danger" && "fs-native-danger", variant === "ghost" && "fs-native-ghost", props.className) }, ...kids)
120
130
  : h("button", { type: "button", ...props, className: cx("fs-btn", variant) }, ...kids);
121
131
  const IconButton = (icon, label, onClick, extra) => primitives?.Button
122
132
  ? h(primitives.Button, { variant: "ghost", size: "sm", className: "fs-icon-btn fs-native-icon", "aria-label": label, title: label, onClick, ...extra }, Icon(icon, 14))
@@ -145,8 +155,79 @@ window.__ModuleLoader__.load({
145
155
  }, o.label)));
146
156
  }
147
157
 
158
+ function useSlidingIndicator(navRef, activeSelector, deps, { mode = "width", y = "0px" } = {}) {
159
+ const indRef = react.useRef(null);
160
+ const rafRef = react.useRef(0);
161
+ const syncRef = react.useRef(null);
162
+ syncRef.current = (forceStatic = false) => {
163
+ const nav = navRef.current;
164
+ const ind = indRef.current;
165
+ if (!nav || !ind) return;
166
+ const active = typeof nav.querySelector === "function" ? nav.querySelector(activeSelector) : null;
167
+ if (!active) {
168
+ nav.removeAttribute?.("data-ready");
169
+ ind.style.opacity = "0";
170
+ return;
171
+ }
172
+ const left = active.offsetLeft ?? 0;
173
+ const width = Math.max(0, active.offsetWidth ?? 0);
174
+ const first = typeof nav.hasAttribute === "function" ? !nav.hasAttribute("data-ready") : false;
175
+ const isStatic = first || forceStatic;
176
+ if (isStatic) {
177
+ nav.setAttribute?.("data-static", "true");
178
+ } else if (nav.hasAttribute?.("data-static")) {
179
+ nav.removeAttribute?.("data-static");
180
+ void ind.offsetWidth;
181
+ }
182
+ ind.style.opacity = "";
183
+ if (mode === "scaleX") {
184
+ ind.style.transform = `translate3d(${left}px, ${y}, 0) scaleX(${width})`;
185
+ } else {
186
+ ind.style.transform = `translate3d(${left}px, ${y}, 0)`;
187
+ ind.style.width = `${width}px`;
188
+ }
189
+ if (first) nav.setAttribute?.("data-ready", "true");
190
+ if (isStatic) {
191
+ void ind.offsetWidth;
192
+ if (typeof cancelAnimationFrame === "function" && rafRef.current) cancelAnimationFrame(rafRef.current);
193
+ if (typeof requestAnimationFrame === "function") {
194
+ rafRef.current = requestAnimationFrame(() => {
195
+ rafRef.current = 0;
196
+ navRef.current?.removeAttribute?.("data-static");
197
+ });
198
+ } else {
199
+ nav.removeAttribute?.("data-static");
200
+ }
201
+ }
202
+ };
203
+
204
+ useIsoLayoutEffect(() => {
205
+ syncRef.current?.(false);
206
+ }, deps);
207
+
208
+ react.useEffect(() => {
209
+ const nav = navRef.current;
210
+ const cancelPending = () => {
211
+ if (typeof cancelAnimationFrame === "function" && rafRef.current) {
212
+ cancelAnimationFrame(rafRef.current);
213
+ rafRef.current = 0;
214
+ }
215
+ };
216
+ if (!nav || typeof ResizeObserver !== "function") return cancelPending;
217
+ const ro = new ResizeObserver(() => syncRef.current?.(true));
218
+ ro.observe(nav);
219
+ return () => {
220
+ ro.disconnect();
221
+ cancelPending();
222
+ };
223
+ }, [navRef]);
224
+
225
+ return indRef;
226
+ }
227
+
148
228
  function Tabs({ items, value, onChange, horizontal = false, hasUpdate = false }) {
149
229
  const navRef = react.useRef(null);
230
+ const indRef = useSlidingIndicator(navRef, '[role="tab"][aria-selected="true"]', [value, items.length, hasUpdate], { mode: "width", y: "-50%" });
150
231
  react.useEffect(() => {
151
232
  const nav = navRef.current;
152
233
  const selected = nav?.querySelector('[role="tab"][aria-selected="true"]');
@@ -166,6 +247,7 @@ window.__ModuleLoader__.load({
166
247
  onChange(items[next][0]);
167
248
  };
168
249
  return h("nav", { className: "fs-nav", ref: navRef, role: "tablist", "aria-label": "鱼", "aria-orientation": horizontal ? "horizontal" : "vertical", style: { "--n": items.length, "--i": index } },
250
+ h("span", { className: "fs-tab-ind", ref: indRef, "aria-hidden": true }),
169
251
  items.map(([v, label], i) => h("button", {
170
252
  type: "button", key: v, role: "tab", id: `fs-tab-${v}`, "aria-selected": v === value, "aria-controls": "fs-tabpanel",
171
253
  tabIndex: v === value ? 0 : -1, className: "fs-tab", title: v === "version" && hasUpdate ? "版本更新(有新版本)" : label, "aria-label": v === "version" && hasUpdate ? "版本更新(有新版本)" : label, onClick: () => onChange(v), onKeyDown: (e) => onKeyDown(e, i)
@@ -175,18 +257,194 @@ window.__ModuleLoader__.load({
175
257
  // 大项是页面,不再让每个大项重复一个同名子页签。
176
258
  function GroupedTabs({ value, onChange, hasUpdate }) {
177
259
  const active = NAV_GROUPS.find((group) => group.id === value) ?? NAV_GROUPS[0];
260
+ let navRef = null;
261
+ let indRef = null;
262
+ try {
263
+ navRef = react.useRef(null);
264
+ indRef = useSlidingIndicator(navRef, '[aria-pressed="true"]', [active.id, hasUpdate], { mode: "scaleX", y: "0px" });
265
+ react.useEffect(() => {
266
+ const nav = navRef.current;
267
+ const selected = nav?.querySelector?.('[aria-pressed="true"]');
268
+ if (!nav || !selected) return;
269
+ const outer = nav.getBoundingClientRect(), inner = selected.getBoundingClientRect();
270
+ if (inner.left < outer.left) nav.scrollLeft -= outer.left - inner.left + 8;
271
+ else if (inner.right > outer.right) nav.scrollLeft += inner.right - outer.right + 8;
272
+ }, [active.id]);
273
+ } catch (err) {
274
+ /* test/life-clock-refresh 直接调用 GroupedTabs(),无 hooks 上下文时退化为无滑块渲染 */
275
+ if (err?.name !== "TypeError") throw err;
276
+ }
178
277
  return [
179
- h("span", { className: "fs-brand", key: "brand" }, "鱼"),
180
- h("nav", { className: "fs-group-nav", key: "nav", "aria-label": "设置分类" }, NAV_GROUPS.map((group) => {
181
- const selected = group.id === active.id;
182
- const showUpdate = hasUpdate && group.id === "system";
183
- return h("button", { type: "button", key: group.id, className: "fs-group-tab", "aria-pressed": selected,
184
- "aria-label": showUpdate ? `${group.label}(有新版本)` : group.label, onClick: () => onChange(group.id) },
185
- group.label, showUpdate ? h("span", { className: "fs-update-dot", "aria-hidden": true }) : null);
186
- }))
278
+ h("span", { className: "fs-brand", key: "brand" }, h(FishSoulPanelIcon, { size: 15, className: "fs-brand-mark" }), "鱼"),
279
+ h("nav", { className: "fs-group-nav", key: "nav", ref: navRef, "aria-label": "设置分类" },
280
+ h("span", { className: "fs-group-ind", ref: indRef, "aria-hidden": true }),
281
+ NAV_GROUPS.map((group) => {
282
+ const selected = group.id === active.id;
283
+ const showUpdate = hasUpdate && group.id === "system";
284
+ return h("button", { type: "button", key: group.id, className: "fs-group-tab", "aria-pressed": selected,
285
+ "aria-label": showUpdate ? `${group.label}(有新版本)` : group.label, onClick: () => onChange(group.id) },
286
+ Icon(`group_${group.id}`, 14, "fs-group-icon"),
287
+ group.label, showUpdate ? h("span", { className: "fs-update-dot", "aria-hidden": true }) : null);
288
+ }))
187
289
  ];
188
290
  }
189
291
 
292
+ const QUICK_JUMP_KEYWORDS = {
293
+ retrieval: "向量 embedding 融合 topk 权重",
294
+ people: "人物 关系 好友 亲密度 羁绊",
295
+ memories: "记忆 搜索 删除 整理",
296
+ "recall-test": "检索 测试 召回 调试",
297
+ weekly: "周记 周报 汇总",
298
+ archives: "存档 归档 容量 预算",
299
+ backups: "导入 导出 备份 聊天记录",
300
+ persona: "人格 人设 卡片 性格",
301
+ templates: "人格 模板 角色库",
302
+ growth: "成长 演化 记忆变化",
303
+ worldinfo: "世界书 设定 词条 lorebook",
304
+ prompts: "提示词 system prompt 自定义",
305
+ habits: "说话 习惯 语气 口癖",
306
+ groups: "群设定 群聊 白名单",
307
+ "chat-models": "聊天 模型 对话 引擎",
308
+ life: "主动 开口 生命 时钟 作息 日程 配额",
309
+ "scheduled-tasks": "定时 任务 提醒 闹钟 日程",
310
+ relay: "熟人 传话 带话 白名单",
311
+ activity: "最近 动态 刷视频",
312
+ diary: "日记 心情 随笔",
313
+ stickers: "表情包 斗图 图片",
314
+ slang: "学到 说法 热词 梗",
315
+ qq: "qq 频道 群 私聊 会话",
316
+ bili: "b站 bilibili 弹幕 评论 动态",
317
+ douyin: "抖音 短视频 私信",
318
+ models: "功能 模型 路由 fallback",
319
+ usage: "用量 价格 token 花费 账单 统计 预算",
320
+ web: "联网 搜索 网页",
321
+ voice: "语音 tts stt 声音 音色",
322
+ interface: "界面 显示 开始 引导",
323
+ version: "版本 更新 升级 检查",
324
+ diag: "运行 日志 诊断 报错",
325
+ guide: "引导 开始 入门 向导"
326
+ };
327
+
328
+ function buildQuickJumpEntries(guideVisible) {
329
+ const items = [];
330
+ for (const [groupId, groupLabel, subs] of TABS) {
331
+ for (const [subId, subLabel] of subs) {
332
+ items.push({
333
+ tab: groupId,
334
+ groupLabel,
335
+ subtab: subId,
336
+ subLabel,
337
+ icon: `group_${groupId}`,
338
+ keywords: `${groupLabel} ${subLabel} ${subId} ${QUICK_JUMP_KEYWORDS[subId] ?? ""}`.toLowerCase()
339
+ });
340
+ }
341
+ }
342
+ if (guideVisible) {
343
+ items.push({
344
+ tab: "guide",
345
+ groupLabel: "入口",
346
+ subtab: "guide",
347
+ subLabel: "使用引导",
348
+ icon: "guide",
349
+ keywords: `使用引导 guide 开始 入门 ${QUICK_JUMP_KEYWORDS.guide}`.toLowerCase()
350
+ });
351
+ }
352
+ return items;
353
+ }
354
+
355
+ // 独立封装 ⌘K 状态与快捷键监听,避免改变 FishSoulSection 的 hook 槽位顺序
356
+ function QuickJump({ guideVisible, currentTab, currentSubtab, onJump }) {
357
+ const [open, setOpen] = react.useState(false);
358
+ const [query, setQuery] = react.useState("");
359
+ const [cursor, setCursor] = react.useState(0);
360
+ const inputRef = react.useRef(null);
361
+
362
+ react.useEffect(() => {
363
+ if (typeof window === "undefined" || typeof window.addEventListener !== "function") return undefined;
364
+ const onKey = (e) => {
365
+ if ((e.metaKey || e.ctrlKey) && String(e.key ?? "").toLowerCase() === "k") {
366
+ e.preventDefault?.();
367
+ setQuery("");
368
+ setCursor(0);
369
+ setOpen((v) => !v);
370
+ }
371
+ };
372
+ window.addEventListener("keydown", onKey);
373
+ return () => window.removeEventListener?.("keydown", onKey);
374
+ }, []);
375
+
376
+ react.useEffect(() => {
377
+ if (open) inputRef.current?.focus?.();
378
+ }, [open]);
379
+
380
+ const entries = buildQuickJumpEntries(guideVisible);
381
+ const q = query.trim().toLowerCase();
382
+ const filtered = q === "" ? entries : entries.filter((x) => x.keywords.includes(q));
383
+ const safeCursor = filtered.length > 0 ? Math.min(cursor, filtered.length - 1) : 0;
384
+
385
+ const selectEntry = (entry) => {
386
+ setOpen(false);
387
+ setQuery("");
388
+ onJump(entry.tab, entry.tab === "guide" ? undefined : entry.subtab);
389
+ };
390
+
391
+ const onInputKeyDown = (e) => {
392
+ if (e.key === "Escape") { e.preventDefault?.(); setOpen(false); return; }
393
+ if (e.key === "ArrowDown" && filtered.length > 0) { e.preventDefault?.(); setCursor((c) => (c + 1) % filtered.length); return; }
394
+ if (e.key === "ArrowUp" && filtered.length > 0) { e.preventDefault?.(); setCursor((c) => (c - 1 + filtered.length) % filtered.length); return; }
395
+ if (e.key === "Enter" && filtered[safeCursor]) { e.preventDefault?.(); selectEntry(filtered[safeCursor]); }
396
+ };
397
+
398
+ return h(react.Fragment, null,
399
+ h("button", {
400
+ type: "button",
401
+ className: "fs-qj-trigger",
402
+ "aria-label": "快速跳转",
403
+ "aria-haspopup": "dialog",
404
+ "aria-expanded": open,
405
+ title: "快速跳转 (⌘K / Ctrl+K)",
406
+ onClick: () => { setQuery(""); setCursor(0); setOpen(true); }
407
+ }, Icon("search", 13), h("span", { className: "fs-qj-label" }, "跳转"), h("kbd", { className: "fs-kbd" }, "⌘K")),
408
+ open ? h("div", {
409
+ className: "fs-qj-backdrop",
410
+ onClick: (e) => { if (e.target === e.currentTarget) setOpen(false); }
411
+ }, h("div", {
412
+ className: "fs-qj-dialog",
413
+ role: "dialog",
414
+ "aria-modal": "true",
415
+ "aria-label": "快速跳转"
416
+ }, h("div", { className: "fs-qj-head" },
417
+ Icon("search", 15),
418
+ h("input", {
419
+ ref: inputRef,
420
+ className: "fs-qj-input",
421
+ type: "text",
422
+ value: query,
423
+ placeholder: "搜索设置页、平台或功能,例如:用量、QQ、定时、语音…",
424
+ "aria-label": "搜索页面",
425
+ onChange: (e) => { setQuery(e.target.value); setCursor(0); },
426
+ onKeyDown: onInputKeyDown
427
+ }),
428
+ h("kbd", { className: "fs-kbd" }, "Esc")),
429
+ h("div", { className: "fs-qj-list", role: "listbox" },
430
+ filtered.length === 0
431
+ ? h("div", { className: "fs-qj-empty" }, "没有匹配的设置页面")
432
+ : filtered.map((item, idx) => {
433
+ const isCurrent = item.tab === "guide" ? currentTab === "guide" : currentTab === item.tab && currentSubtab === item.subtab;
434
+ return h("button", {
435
+ type: "button",
436
+ key: `${item.tab}:${item.subtab}`,
437
+ role: "option",
438
+ "aria-selected": idx === safeCursor,
439
+ "data-active": idx === safeCursor ? "true" : undefined,
440
+ className: "fs-qj-item",
441
+ onMouseEnter: () => setCursor(idx),
442
+ onClick: () => selectEntry(item)
443
+ }, h("span", { className: "fs-qj-item-left" }, Icon(item.icon, 14), h("span", { className: "fs-qj-item-label" }, item.subLabel)),
444
+ h("span", { className: "fs-qj-item-right" }, Tag(item.groupLabel + (isCurrent ? " · 当前" : ""), isCurrent ? "info" : "outline")));
445
+ })))) : null);
446
+ }
447
+
190
448
  /** StateDot:done / warning / error / idle 是圆点,ongoing 是转圈。 */
191
449
  const Dot = (state) => primitives?.StateDot ? h(primitives.StateDot, { state }) : state === "ongoing"
192
450
  ? h("svg", { className: "fs-spin", width: 14, height: 14, viewBox: "0 0 24 24", "aria-hidden": true },
@@ -330,7 +588,65 @@ window.__ModuleLoader__.load({
330
588
  return [confirm, node];
331
589
  }
332
590
 
333
- const ui = { h, cx, Icon, Switch, Button, IconButton, Seg, Dot, State, Tag, Pill, Check, Muted, Row, Group, Input, Num, Area, Secret, Select, Empty, Item, useForm, split, useConfirm };
591
+ function useFlipList(keySig) {
592
+ const listRef = react.useRef(null);
593
+ const rectsRef = react.useRef(new Map());
594
+ const widthRef = react.useRef(null);
595
+ const animsRef = react.useRef(new WeakMap());
596
+
597
+ useIsoLayoutEffect(() => {
598
+ const el = listRef.current;
599
+ if (!el || typeof el.querySelectorAll !== "function") return;
600
+ const items = Array.from(el.querySelectorAll("[data-flip-key]"));
601
+ for (const child of items) {
602
+ const prevAnim = animsRef.current.get(child);
603
+ if (prevAnim) {
604
+ try { prevAnim.cancel(); } catch { /* 动画已结束或环境不支持 */ }
605
+ animsRef.current.delete(child);
606
+ }
607
+ }
608
+ const base = typeof el.getBoundingClientRect === "function" ? el.getBoundingClientRect() : { left: 0, top: 0 };
609
+ const scrollLeft = el.scrollLeft ?? 0;
610
+ const scrollTop = el.scrollTop ?? 0;
611
+ const nextRects = new Map();
612
+ const pairs = [];
613
+ for (const child of items) {
614
+ const k = child.getAttribute?.("data-flip-key");
615
+ if (!k || typeof child.getBoundingClientRect !== "function") continue;
616
+ const r = child.getBoundingClientRect();
617
+ const next = { left: r.left - base.left + scrollLeft, top: r.top - base.top + scrollTop };
618
+ nextRects.set(k, next);
619
+ pairs.push([k, child, next]);
620
+ }
621
+ const width = el.clientWidth;
622
+ if (prefersReducedMotion() || typeof el.animate !== "function" || widthRef.current === null || widthRef.current !== width) {
623
+ widthRef.current = width;
624
+ rectsRef.current = nextRects;
625
+ return;
626
+ }
627
+ for (const [k, child, next] of pairs) {
628
+ const prev = rectsRef.current.get(k);
629
+ if (!prev) continue;
630
+ const dx = prev.left - next.left;
631
+ const dy = prev.top - next.top;
632
+ if (Math.abs(dx) < 1 && Math.abs(dy) < 1) continue;
633
+ try { child.getAnimations?.().forEach((a) => a.cancel()); } catch { /* 旧环境不支持 */ }
634
+ if (typeof child.animate === "function") {
635
+ const anim = child.animate(
636
+ [{ transform: `translate3d(${dx}px, ${dy}px, 0)` }, { transform: "translate3d(0, 0, 0)" }],
637
+ { duration: 240, easing: "cubic-bezier(0.32, 0.72, 0, 1)" }
638
+ );
639
+ if (anim) animsRef.current.set(child, anim);
640
+ }
641
+ }
642
+ widthRef.current = width;
643
+ rectsRef.current = nextRects;
644
+ }, [keySig]);
645
+
646
+ return listRef;
647
+ }
648
+
649
+ const ui = { h, cx, Icon, Switch, Button, IconButton, Seg, Dot, State, Tag, Pill, Check, Muted, Row, Group, Input, Num, Area, Secret, Select, Empty, Item, useForm, split, useConfirm, useFlipList };
334
650
 
335
651
  // ── 记忆检索 ──
336
652
  function RetrievalPane({ data, refresh, notify }) {
@@ -1134,6 +1450,92 @@ window.__ModuleLoader__.load({
1134
1450
  }
1135
1451
  }
1136
1452
 
1453
+ let lgMapsCache = null;
1454
+ function buildSdfDisplacementMap(w, h, radius, bevel) {
1455
+ const canvas = document.createElement("canvas");
1456
+ canvas.width = w;
1457
+ canvas.height = h;
1458
+ const ctx = canvas.getContext("2d");
1459
+ if (!ctx) return "";
1460
+ const img = ctx.createImageData(w, h);
1461
+ const data = img.data;
1462
+ const hx = w / 2 - radius;
1463
+ const hy = h / 2 - radius;
1464
+ for (let y = 0; y < h; y++) {
1465
+ const py = y + 0.5 - h / 2;
1466
+ const ay = Math.abs(py) - hy;
1467
+ const qy = Math.max(ay, 0);
1468
+ const sy = py >= 0 ? 1 : -1;
1469
+ for (let x = 0; x < w; x++) {
1470
+ const px = x + 0.5 - w / 2;
1471
+ const ax = Math.abs(px) - hx;
1472
+ const qx = Math.max(ax, 0);
1473
+ const sx = px >= 0 ? 1 : -1;
1474
+ const distIn = -(Math.hypot(qx, qy) + Math.min(Math.max(ax, ay), 0) - radius);
1475
+ let nx = 0;
1476
+ let ny = 0;
1477
+ let mag = 0;
1478
+ if (distIn >= 0 && distIn < bevel) {
1479
+ if (qx > 0 || qy > 0) {
1480
+ const len = Math.max(1e-5, Math.hypot(qx, qy));
1481
+ nx = (qx / len) * sx;
1482
+ ny = (qy / len) * sy;
1483
+ } else if (ax > ay) {
1484
+ nx = sx;
1485
+ } else {
1486
+ ny = sy;
1487
+ }
1488
+ const t = 1 - distIn / bevel;
1489
+ mag = Math.pow(t, 1.55) * Math.sin(t * Math.PI * 0.5);
1490
+ }
1491
+ const i = (y * w + x) * 4;
1492
+ data[i] = Math.max(0, Math.min(255, Math.round(128 + nx * mag * 124)));
1493
+ data[i + 1] = Math.max(0, Math.min(255, Math.round(128 + ny * mag * 124)));
1494
+ data[i + 2] = 128;
1495
+ data[i + 3] = 255;
1496
+ }
1497
+ }
1498
+ ctx.putImageData(img, 0, 0);
1499
+ return canvas.toDataURL("image/png");
1500
+ }
1501
+ function getLiquidGlassMaps() {
1502
+ if (lgMapsCache !== null) return lgMapsCache;
1503
+ if (typeof document === "undefined") return null;
1504
+ try {
1505
+ const pill = buildSdfDisplacementMap(220, 60, 30, 18);
1506
+ const card = buildSdfDisplacementMap(360, 180, 18, 22);
1507
+ lgMapsCache = pill && card ? { pill, card } : null;
1508
+ } catch {
1509
+ /* 非浏览器环境或 Canvas 不可用时降级为纯菲涅尔玻璃 */
1510
+ lgMapsCache = null;
1511
+ }
1512
+ return lgMapsCache;
1513
+ }
1514
+ function LiquidGlassFilters() {
1515
+ const maps = getLiquidGlassMaps();
1516
+ if (!maps) return null;
1517
+ const specs = [
1518
+ { id: "fs-lg-pill", href: maps.pill, base: 14 },
1519
+ { id: "fs-lg-card", href: maps.card, base: 10 }
1520
+ ];
1521
+ const channels = [
1522
+ ["R", 1.12, "1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0"],
1523
+ ["G", 1.0, "0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0"],
1524
+ ["B", 0.88, "0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0"]
1525
+ ];
1526
+ return h("svg", { width: 0, height: 0, "aria-hidden": true, style: { position: "fixed", overflow: "hidden", pointerEvents: "none" } },
1527
+ h("defs", null, specs.map((s) => h("filter", {
1528
+ key: s.id, id: s.id, x: "0%", y: "0%", width: "100%", height: "100%", colorInterpolationFilters: "sRGB"
1529
+ },
1530
+ h("feImage", { result: "disp", preserveAspectRatio: "none", href: s.href }),
1531
+ channels.flatMap(([k, ratio, matrix]) => [
1532
+ h("feDisplacementMap", { key: `d${k}`, in: "SourceGraphic", in2: "disp", scale: (s.base * ratio).toFixed(1), xChannelSelector: "R", yChannelSelector: "G", result: `d${k}` }),
1533
+ h("feColorMatrix", { key: `c${k}`, in: `d${k}`, type: "matrix", values: matrix, result: `c${k}` })
1534
+ ]),
1535
+ h("feBlend", { in: "cR", in2: "cG", mode: "screen", result: "cRG" }),
1536
+ h("feBlend", { in: "cRG", in2: "cB", mode: "screen" })))));
1537
+ }
1538
+
1137
1539
  function FishSoulSection({ standalone = false } = {}) {
1138
1540
  const css = useCss();
1139
1541
  // 界面偏好只保存在当前宿主浏览器,不修改服务端引导进度。
@@ -1146,11 +1548,24 @@ window.__ModuleLoader__.load({
1146
1548
  const remembered = react.useRef({});
1147
1549
  const goTab = (next, child) => {
1148
1550
  hasInteracted.current = true;
1149
- if (next === "guide") { setTab(next); return; }
1551
+ if (next === "guide") { setPaneDir(0); setTab(next); return; }
1552
+ const curIdx = NAV_GROUPS.findIndex((g) => g.id === tab);
1553
+ const nextIdx = NAV_GROUPS.findIndex((g) => g.id === next);
1554
+ const dir = curIdx >= 0 && nextIdx >= 0 ? (nextIdx > curIdx ? 1 : nextIdx < curIdx ? -1 : 0) : 0;
1555
+ setPaneDir(dir);
1150
1556
  if (SUBTABS[next]) setSubtab(child ?? remembered.current[next] ?? DEFAULT_TABS[next]);
1151
1557
  setTab(next);
1152
1558
  };
1153
- const goSubtab = (next) => { hasInteracted.current = true; remembered.current[tab] = next; setSubtab(next); };
1559
+ const goSubtab = (next) => {
1560
+ hasInteracted.current = true;
1561
+ const list = SUBTABS[tab] ?? [];
1562
+ const curIdx = list.findIndex(([id]) => id === subtab);
1563
+ const nextIdx = list.findIndex(([id]) => id === next);
1564
+ const dir = curIdx >= 0 && nextIdx >= 0 ? (nextIdx > curIdx ? 1 : nextIdx < curIdx ? -1 : 0) : 0;
1565
+ setPaneDir(dir);
1566
+ remembered.current[tab] = next;
1567
+ setSubtab(next);
1568
+ };
1154
1569
  const goSetting = (next) => {
1155
1570
  const group = TABS.find(([, , subs]) => subs.some(([id]) => id === next));
1156
1571
  if (group) goTab(group[0], next);
@@ -1161,6 +1576,7 @@ window.__ModuleLoader__.load({
1161
1576
  const [toast, setToast] = react.useState(null);
1162
1577
  const [updateAvailable, setUpdateAvailable] = react.useState(false);
1163
1578
  const [storageWarning, setStorageWarning] = react.useState(null);
1579
+ const [paneDir, setPaneDir] = react.useState(0);
1164
1580
  const notify = react.useCallback((text) => setToast({ key: Date.now(), text }), []);
1165
1581
  const setGuideVisibility = (visible) => {
1166
1582
  try { window.localStorage.setItem(guideVisibilityKey, String(visible)); }
@@ -1246,18 +1662,26 @@ window.__ModuleLoader__.load({
1246
1662
  : h(ChunkTab, { file: "client.douyin.js", pick: (m) => m.DouyinPane, failText: "抖音页加载失败", data: channels, refresh: loadChannels, notify });
1247
1663
 
1248
1664
  const tabs = tab === "guide" ? [] : SUBTABS[tab] ?? [];
1665
+ const activeGroup = NAV_GROUPS.find((g) => g.id === tab);
1249
1666
  const label = tab === "guide" ? "使用引导" : tabs.find(([v]) => v === subtab)?.[1] ?? "";
1250
1667
  return h("div", { className: "fs-host" }, h("div", { className: cx("fs", standalone ? "fs-standalone" : "fs-settings"), onPointerDown: () => { hasInteracted.current = true; }, onKeyDown: () => { hasInteracted.current = true; } },
1251
1668
  css === "" ? null : h("style", { "data-plugin-css": `${PLUGIN_ID}/panel.css` }, css),
1669
+ h(LiquidGlassFilters),
1252
1670
  h("div", { className: "fs-side" }, h("div", { className: "fs-side-inner" },
1253
1671
  h("div", { className: "fs-group-row" },
1254
1672
  h(GroupedTabs, { value: tab, onChange: goTab, hasUpdate: updateAvailable }),
1255
- guideVisible && tab !== "guide" ? h("span", { className: "fs-group-aside" }, Button({ variant: "ghost", onClick: () => goTab("guide") }, "使用引导")) : null),
1673
+ h("span", { className: "fs-group-aside" },
1674
+ h(QuickJump, { guideVisible, currentTab: tab, currentSubtab: subtab, onJump: (g, s) => goTab(g, s) }),
1675
+ guideVisible && tab !== "guide" ? Button({ variant: "ghost", onClick: () => goTab("guide") }, "使用引导") : null)),
1256
1676
  tabs.length > 0 ? h("div", { className: "fs-subnav-row" }, h(Tabs, { items: tabs, value: subtab, onChange: goSubtab, horizontal: true })) : null)),
1257
1677
  h("main", { className: "fs-main" },
1258
- h("header", { className: "fs-main-head" }, h("h2", { className: "fs-main-title", id: "fs-main-title" }, label), storageWarning ? h("span", { role: "status", style: { marginLeft: "auto" } }, Button({ variant: "ghost", onClick: () => goSetting("archives") }, storageWarning)) : null),
1259
- h("div", { className: "fs-pane", role: "tabpanel", id: "fs-tabpanel", "aria-labelledby": tabs.length > 0 ? `fs-tab-${subtab}` : "fs-main-title", key: `${tab}:${subtab}` }, h(Boundary, { name: "这一页" }, pane))),
1260
- toast === null ? null : h("div", { className: "fs-toast", role: "status", key: toast.key }, toast.text)));
1678
+ h("header", { className: "fs-main-head" },
1679
+ tab !== "guide" && activeGroup ? h("span", { className: "fs-crumb-group" }, activeGroup.label) : null,
1680
+ tab !== "guide" && activeGroup ? h("span", { className: "fs-crumb-sep", "aria-hidden": true }, "/") : null,
1681
+ h("h2", { className: "fs-main-title", id: "fs-main-title" }, label),
1682
+ storageWarning ? h("span", { role: "status", style: { marginLeft: "auto" } }, Button({ variant: "ghost", onClick: () => goSetting("archives") }, storageWarning)) : null),
1683
+ h("div", { className: "fs-pane", role: "tabpanel", id: "fs-tabpanel", "aria-labelledby": tabs.length > 0 ? `fs-tab-${subtab}` : "fs-main-title", "data-dir": String(paneDir), key: `${tab}:${subtab}` }, h(Boundary, { name: "这一页" }, pane))),
1684
+ toast === null ? null : h("div", { className: "fs-toast", role: "status", key: toast.key }, h("span", { className: "fs-toast-dot", "aria-hidden": true }), h("span", null, toast.text))));
1261
1685
  }
1262
1686
 
1263
1687
  // 同一组件可在设置弹窗或宿主主面板内渲染;只改变承载容器。
@@ -1266,8 +1690,8 @@ window.__ModuleLoader__.load({
1266
1690
  h("div", { className: "fs-page-scroll" }, h(FishSoulSection, { standalone: true })));
1267
1691
  }
1268
1692
 
1269
- function FishSoulPanelIcon({ size = 16 } = {}) {
1270
- return h("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true },
1693
+ function FishSoulPanelIcon({ size = 16, className } = {}) {
1694
+ return h("svg", { ...(className ? { className } : {}), width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true },
1271
1695
  h("path", { d: "M3 12c3-5 9-7 14-3l4-3v12l-4-3c-5 4-11 2-14-3Z M14 11h.01 M7 12h.01" }));
1272
1696
  }
1273
1697