dsh-plugin-zotero 0.9.3 → 0.9.5

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/client/client.js CHANGED
@@ -237,8 +237,12 @@ const dicts = {
237
237
  "list.sortDesc": "标题倒序 Z→A(再点恢复原始顺序)",
238
238
  "list.expandAttachments": "展开附件",
239
239
  "list.collapseAttachments": "收起附件",
240
- "list.attachmentCount": "附件 {n}",
241
- "list.openAttachment": "打开附件",
240
+ "list.childKind.pdf": "PDF",
241
+ "list.childKind.snapshot": "网页快照",
242
+ "list.childKind.webpage": "网页链接",
243
+ "list.childKind.note": "笔记",
244
+ "list.childKind.file": "附件",
245
+ "list.openAttachment": "打开附件 / 笔记",
242
246
  "tags.title": "标签",
243
247
  "tags.filterPlaceholder": "筛选标签名称",
244
248
  "tags.empty": "这个文库还没有标签",
@@ -340,6 +344,80 @@ const dicts = {
340
344
  "toast.insertedItems": "已把 {n} 条加入会话草稿",
341
345
  "toast.copied": "已复制",
342
346
  "toast.copyFailed": "复制失败",
347
+ "help.button": "使用帮助",
348
+ "help.buttonTitle": "查看插件使用教程",
349
+ "help.title": "Zotero 使用帮助",
350
+ "help.subtitle": "把文献带进对话,然后试试这些指令",
351
+ "help.pin": "钉住窗口",
352
+ "help.unpin": "取消钉住",
353
+ "help.close": "关闭",
354
+ "help.copy": "复制",
355
+ "help.resize": "拖动调整窗口大小",
356
+ "help.tab.start": "快速上手",
357
+ "help.tab.reading": "精读与理解",
358
+ "help.tab.notes": "笔记整理",
359
+ "help.tab.library": "文库管理",
360
+ "help.tab.shots": "截图与标注",
361
+ "help.start.title": "先把手头的内容加入对话",
362
+ "help.start.desc": "下面七种内容都能变成对话里的引用。点每条的「复制」,把指令粘到对话框,模型就能基于它工作。",
363
+ "help.start.footnote": "说明:文献全文不是单独的引用类型。要让模型读全文,先加入一条摘录定位条目,再说「结合全文回答……」即可(模型会自行读取正文)。",
364
+ "help.reading.title": "读文献、解名词、做对比",
365
+ "help.reading.desc": "加入条目或摘录后,直接下达阅读类指令。",
366
+ "help.notes.title": "把零散内容整理成笔记",
367
+ "help.notes.desc": "把多条摘录、标注、笔记一起加入对话,再让它归纳改写。",
368
+ "help.library.title": "整理分类、导入导出",
369
+ "help.library.desc": "让模型创建 Zotero 分类、加标签、按 DOI 入库、导出参考文献。需要开启写权限。",
370
+ "help.shots.title": "用截图和高亮提问",
371
+ "help.shots.desc": "截图会以图片随对话发送,高亮与划选会带上原文,可据此追问。",
372
+ "help.ex.start.1.label": "单条条目",
373
+ "help.ex.start.1.hint": "文档左上角「加入对话」,或条目行右键「添加条目引用」",
374
+ "help.ex.start.1.prompt": "上面这篇文献的摘要说了什么?用三句话概括。",
375
+ "help.ex.start.2.label": "划选摘录",
376
+ "help.ex.start.2.hint": "在全文里拖选文字 → 浮条「加入对话」",
377
+ "help.ex.start.2.prompt": "逐句解释我刚加入的这段摘录。",
378
+ "help.ex.start.3.label": "高亮标注",
379
+ "help.ex.start.3.hint": "信息浮层「标注」块,每行点「引用」",
380
+ "help.ex.start.3.prompt": "结合这条高亮的批注,说明作者在强调什么。",
381
+ "help.ex.start.4.label": "笔记",
382
+ "help.ex.start.4.hint": "信息浮层「笔记」块,每行点「加入对话」",
383
+ "help.ex.start.4.prompt": "把这条笔记补进我的文献综述,保持原有引用出处。",
384
+ "help.ex.start.5.label": "整个目录",
385
+ "help.ex.start.5.hint": "分类树里右键「添加整目录引用」",
386
+ "help.ex.start.5.prompt": "按年份从新到旧梳理这个目录里的条目,并指出研究主题分布。",
387
+ "help.ex.start.6.label": "划词翻译",
388
+ "help.ex.start.6.hint": "划选 → 浮条「翻译」→ 译文浮层「加入对话」",
389
+ "help.ex.start.6.prompt": "对照原文和译文,指出三处值得注意的术语翻译。",
390
+ "help.ex.start.7.label": "截图",
391
+ "help.ex.start.7.hint": "文档左上角「截图加入对话」→ 框选 →「加入对话」",
392
+ "help.ex.start.7.prompt": "把截图里的表格用文字复述出来。",
393
+ "help.ex.reading.1.label": "精读文献",
394
+ "help.ex.reading.1.prompt": "请精读上面这篇文献,按「研究问题 / 方法 / 主要结论 / 局限」四部分总结,并标出对应页码。",
395
+ "help.ex.reading.2.label": "解释名词",
396
+ "help.ex.reading.2.prompt": "解释上面文献里反复出现的专业名词,列成表格:术语|一句话解释|文中出处。",
397
+ "help.ex.reading.3.label": "逐句翻译",
398
+ "help.ex.reading.3.prompt": "把上面这段摘录逐句翻译为中文,保留术语原文并附在括号里。",
399
+ "help.ex.reading.4.label": "多篇对比",
400
+ "help.ex.reading.4.prompt": "对比上面三篇文献的研究方法和结论,做成一张表,并指出它们的分歧点。",
401
+ "help.ex.notes.1.label": "结构化笔记",
402
+ "help.ex.notes.1.prompt": "把上面这几段摘录和笔记整理成一份结构化中文笔记,按主题分节,每节给出要点和出处。",
403
+ "help.ex.notes.2.label": "提炼要点",
404
+ "help.ex.notes.2.prompt": "用 5 条要点总结上面这篇文献,每条不超过 30 字。",
405
+ "help.ex.notes.3.label": "改写摘录",
406
+ "help.ex.notes.3.prompt": "把上面的摘录改写成我自己的话,保持原意,专有名词请保留。",
407
+ "help.ex.library.1.label": "整理目录(建分类)",
408
+ "help.ex.library.1.prompt": "把上面这几篇文献放进 Zotero 的「机器学习/精读」分类;分类不存在就先创建。",
409
+ "help.ex.library.2.label": "导出参考文献",
410
+ "help.ex.library.2.prompt": "把当前 Zotero 分类的条目按 APA 格式整理成参考文献列表。",
411
+ "help.ex.library.3.label": "按 DOI 导入条目",
412
+ "help.ex.library.3.prompt": "根据 DOI 10.1038/nature14539 把这个条目导入我的 Zotero 文库,并加上标签「待读」。",
413
+ "help.ex.library.4.label": "批量加标签",
414
+ "help.ex.library.4.prompt": "给上面插入的这些条目统一加上标签「精读」,已有标签保留。",
415
+ "help.ex.shots.1.label": "截图提问",
416
+ "help.ex.shots.1.prompt": "根据上面这张截图里的公式,用文字复述每一步推导。",
417
+ "help.ex.shots.2.label": "引用标注",
418
+ "help.ex.shots.2.prompt": "引用我这条高亮里的批注,说明作者为什么这样设计实验。",
419
+ "help.ex.shots.3.label": "划选追问",
420
+ "help.ex.shots.3.prompt": "解释我刚划选的这句话在全文论证中的作用。",
343
421
  "settings.nav": "Zotero文献库",
344
422
  "settings.hint": "这些参数决定面板与模型工具如何连上 Zotero;改完自动保存、即时生效,无需重启。",
345
423
  "group.api": "API 设置",
@@ -667,8 +745,12 @@ const dicts = {
667
745
  "list.sortDesc": "Title Z→A (click again for default order)",
668
746
  "list.expandAttachments": "Expand attachments",
669
747
  "list.collapseAttachments": "Collapse attachments",
670
- "list.attachmentCount": "Attachments: {n}",
671
- "list.openAttachment": "Open attachment",
748
+ "list.childKind.pdf": "PDF",
749
+ "list.childKind.snapshot": "Web snapshot",
750
+ "list.childKind.webpage": "Web link",
751
+ "list.childKind.note": "Note",
752
+ "list.childKind.file": "File",
753
+ "list.openAttachment": "Open attachment or note",
672
754
  "tags.title": "Tags",
673
755
  "tags.filterPlaceholder": "Filter tag names",
674
756
  "tags.empty": "This library has no tags yet",
@@ -770,6 +852,80 @@ const dicts = {
770
852
  "toast.insertedItems": "Added {n} to the conversation draft",
771
853
  "toast.copied": "Copied",
772
854
  "toast.copyFailed": "Copy failed",
855
+ "help.button": "How to Use",
856
+ "help.buttonTitle": "View the plugin tutorial",
857
+ "help.title": "Zotero Help",
858
+ "help.subtitle": "Bring literature into the chat, then try these prompts",
859
+ "help.pin": "Pin window",
860
+ "help.unpin": "Unpin window",
861
+ "help.close": "Close",
862
+ "help.copy": "Copy",
863
+ "help.resize": "Drag to resize the window",
864
+ "help.tab.start": "Quick Start",
865
+ "help.tab.reading": "Read & Understand",
866
+ "help.tab.notes": "Notes",
867
+ "help.tab.library": "Library",
868
+ "help.tab.shots": "Screenshots & Annotations",
869
+ "help.start.title": "First, add something to the conversation",
870
+ "help.start.desc": "All seven kinds of content below become references in the chat. Hit \"Copy\" on any item, paste the prompt into the chat box, and the model will work on it.",
871
+ "help.start.footnote": "Note: full text is not a separate reference type. To have the model read it, first add an excerpt to locate the item, then say \"answer based on the full text…\" (the model reads the body itself).",
872
+ "help.reading.title": "Read papers, explain terms, compare",
873
+ "help.reading.desc": "Once an item or excerpt is added, just give reading instructions.",
874
+ "help.notes.title": "Turn scattered bits into notes",
875
+ "help.notes.desc": "Add several excerpts, annotations and notes together, then ask it to summarize or rewrite.",
876
+ "help.library.title": "Organize, import & export",
877
+ "help.library.desc": "Ask the model to create collections, add tags, import by DOI, or export references. Write permission is required.",
878
+ "help.shots.title": "Ask with screenshots & highlights",
879
+ "help.shots.desc": "Screenshots are sent as images and highlights carry their source text, so you can ask follow-up questions.",
880
+ "help.ex.start.1.label": "Single item",
881
+ "help.ex.start.1.hint": "\"Add to chat\" at the top-left of the document, or right-click an item row",
882
+ "help.ex.start.1.prompt": "What does the abstract of the paper above say? Summarize it in three sentences.",
883
+ "help.ex.start.2.label": "Text excerpt",
884
+ "help.ex.start.2.hint": "Select text in the document, then \"Add to chat\" on the floating bar",
885
+ "help.ex.start.2.prompt": "Explain the excerpt I just added, sentence by sentence.",
886
+ "help.ex.start.3.label": "Highlight annotation",
887
+ "help.ex.start.3.hint": "In the info panel \"Annotations\" block, click \"Cite\" on a row",
888
+ "help.ex.start.3.prompt": "Using the note on this highlight, explain what the author is emphasizing.",
889
+ "help.ex.start.4.label": "Note",
890
+ "help.ex.start.4.hint": "In the info panel \"Notes\" block, click \"Add to chat\" on a row",
891
+ "help.ex.start.4.prompt": "Add this note into my literature review, keeping the original citations.",
892
+ "help.ex.start.5.label": "Whole collection",
893
+ "help.ex.start.5.hint": "Right-click a collection in the tree, \"Add whole collection\"",
894
+ "help.ex.start.5.prompt": "List the items in this collection from newest to oldest and map out the research themes.",
895
+ "help.ex.start.6.label": "Translation",
896
+ "help.ex.start.6.hint": "Select text → \"Translate\" on the floating bar → \"Add to chat\" in the popup",
897
+ "help.ex.start.6.prompt": "Compare the original and the translation, and point out three noteworthy term choices.",
898
+ "help.ex.start.7.label": "Screenshot",
899
+ "help.ex.start.7.hint": "\"Screenshot to chat\" at the top-left of the document → select an area → \"Add to chat\"",
900
+ "help.ex.start.7.prompt": "Restate the table in the screenshot above as text.",
901
+ "help.ex.reading.1.label": "Close reading",
902
+ "help.ex.reading.1.prompt": "Closely read the paper above and summarize it in four parts: research question / method / key findings / limitations, with page numbers.",
903
+ "help.ex.reading.2.label": "Explain terms",
904
+ "help.ex.reading.2.prompt": "Explain the recurring technical terms in the paper above as a table: term | one-line explanation | where it appears.",
905
+ "help.ex.reading.3.label": "Sentence-by-sentence translation",
906
+ "help.ex.reading.3.prompt": "Translate the excerpt above into English sentence by sentence, keeping technical terms in parentheses.",
907
+ "help.ex.reading.4.label": "Compare papers",
908
+ "help.ex.reading.4.prompt": "Compare the methods and findings of the three papers above in a table and point out where they disagree.",
909
+ "help.ex.notes.1.label": "Structured notes",
910
+ "help.ex.notes.1.prompt": "Turn the excerpts and notes above into structured notes in Chinese, grouped by topic with key points and sources for each section.",
911
+ "help.ex.notes.2.label": "Key takeaways",
912
+ "help.ex.notes.2.prompt": "Summarize the paper above in 5 bullet points, no more than 30 words each.",
913
+ "help.ex.notes.3.label": "Rephrase excerpt",
914
+ "help.ex.notes.3.prompt": "Rewrite the excerpt above in my own words, keeping the meaning; keep proper nouns as they are.",
915
+ "help.ex.library.1.label": "Organize (create collection)",
916
+ "help.ex.library.1.prompt": "Put the papers above into the Zotero \"Machine Learning / Reading\" collection; create it first if it does not exist.",
917
+ "help.ex.library.2.label": "Export references",
918
+ "help.ex.library.2.prompt": "Format the items in the current Zotero collection as an APA reference list.",
919
+ "help.ex.library.3.label": "Import by DOI",
920
+ "help.ex.library.3.prompt": "Import the item with DOI 10.1038/nature14539 into my Zotero library and tag it \"to read\".",
921
+ "help.ex.library.4.label": "Bulk tagging",
922
+ "help.ex.library.4.prompt": "Add the tag \"close-read\" to all the items above, keeping existing tags.",
923
+ "help.ex.shots.1.label": "Ask about a screenshot",
924
+ "help.ex.shots.1.prompt": "Based on the formula in the screenshot above, restate each derivation step in words.",
925
+ "help.ex.shots.2.label": "Cite an annotation",
926
+ "help.ex.shots.2.prompt": "Quote the note on my highlight above and explain why the author designed the experiment that way.",
927
+ "help.ex.shots.3.label": "Follow up on a selection",
928
+ "help.ex.shots.3.prompt": "Explain the role of the sentence I just selected in the overall argument of the paper.",
773
929
  "settings.nav": "Zotero Library",
774
930
  "settings.hint": "These parameters decide how the panel and the model tools reach Zotero; edits save automatically and take effect immediately, no restart needed.",
775
931
  "group.api": "API settings",
@@ -2817,6 +2973,23 @@ const SOFT_BUTTON_ACTIVE_STYLE = {
2817
2973
  };
2818
2974
  /** 所有「浅底 + 描边」按钮共用的 class(primary 实心主操作不加)。 */
2819
2975
  const SOFT_BUTTON_CLASS = "dsh-zp-soft-btn";
2976
+ /**
2977
+ * 「使用帮助」按钮:实心蓝底 + 白字,刻意比旁边的浅底描边按钮醒目。
2978
+ *
2979
+ * 蓝底是固定的品牌色、白字压在上面深浅主题都够对比,不需要 light-dark()。
2980
+ * hover / active 的加深写在 {@link THEME_CSS}(内联 style 写不了伪类)。
2981
+ */
2982
+ const HELP_PRIMARY_STYLE = {
2983
+ color: "#ffffff",
2984
+ background: ACCENT,
2985
+ border: `1px solid ${ACCENT}`,
2986
+ boxShadow: "0 1px 3px rgba(31,64,128,0.28)",
2987
+ boxSizing: "border-box",
2988
+ fontWeight: 600,
2989
+ whiteSpace: "nowrap"
2990
+ };
2991
+ /** 帮助按钮的专属 class,供 THEME_CSS 写 hover / active(!important 盖住宿主 primary 默认态)。 */
2992
+ const HELP_BUTTON_CLASS = "dsh-zp-help-btn";
2820
2993
  /** 标题外壳 class;文字色与渐变竖条写在 CSS 里(要做 light/dark 渐进增强)。 */
2821
2994
  const SECTION_TITLE_CLASS = "dsh-zp-title";
2822
2995
  /** 按钮 class:选中 / 激活态多挂 `is-active`,hover 时底色加深得更多。 */
@@ -2878,6 +3051,15 @@ function itemTypeIconClass(family, read = false) {
2878
3051
  if (read) parts.push("is-read");
2879
3052
  return parts.join(" ");
2880
3053
  }
3054
+ /**
3055
+ * 子项(附件 / 笔记)图标的 class:复用条目图标的墨色与 light/dark 处理,
3056
+ * 只多三类特征色。`file` 不进配色表,落回默认墨色。
3057
+ */
3058
+ function childKindIconClass(kind, read = false) {
3059
+ const parts = [ITEM_ICON_CLASS, `is-${kind}`];
3060
+ if (read) parts.push("is-read");
3061
+ return parts.join(" ");
3062
+ }
2881
3063
  /** 全局主题样式:只在入口注入一次,portal / 浮层里的按钮同样生效。 */
2882
3064
  const THEME_CSS = `
2883
3065
  .dsh-zp-soft-btn {
@@ -2914,6 +3096,20 @@ const THEME_CSS = `
2914
3096
  .dsh-zp-tag.is-selected:active {
2915
3097
  background-color: #404040 !important;
2916
3098
  }
3099
+ /* 帮助按钮:宿主 primary 默认色可能不是这支蓝,用 !important 钉住实心蓝底与 hover/active 加深。 */
3100
+ .dsh-zp-help-btn,
3101
+ .dsh-zp-help-btn:hover:not(:disabled),
3102
+ .dsh-zp-help-btn:active:not(:disabled) {
3103
+ color: #ffffff !important;
3104
+ }
3105
+ .dsh-zp-help-btn:hover:not(:disabled) {
3106
+ background-color: #3f7cf0 !important;
3107
+ border-color: #3f7cf0 !important;
3108
+ }
3109
+ .dsh-zp-help-btn:active:not(:disabled) {
3110
+ background-color: #3669d6 !important;
3111
+ border-color: #3669d6 !important;
3112
+ }
2917
3113
  /* 条目类型图标:近黑墨色为主,只有书 / 笔记 / 附件留 Zotero 特征色。
2918
3114
  先给宿主文字色兜底,再用 light-dark() 做深浅两套;老浏览器退成墨色。 */
2919
3115
  .dsh-zp-item-icon {
@@ -2930,6 +3126,16 @@ const THEME_CSS = `
2930
3126
  .dsh-zp-item-icon.is-attachment {
2931
3127
  color: light-dark(#d32f3c, #f0727a);
2932
3128
  }
3129
+ /* 列表子项:与条目图标共用描边与主题色,只给 PDF / 快照 / 网页 / 笔记分支。 */
3130
+ .dsh-zp-item-icon.is-pdf {
3131
+ color: light-dark(#d32f3c, #f0727a);
3132
+ }
3133
+ .dsh-zp-item-icon.is-snapshot {
3134
+ color: light-dark(#4072e5, #8eaef5);
3135
+ }
3136
+ .dsh-zp-item-icon.is-webpage {
3137
+ color: light-dark(#2f9e63, #6ec79a);
3138
+ }
2933
3139
  .dsh-zp-item-icon.is-read {
2934
3140
  opacity: 0.5;
2935
3141
  filter: grayscale(1);
@@ -5177,7 +5383,7 @@ function useFloatingBox(options) {
5177
5383
  draggedRef.current = false;
5178
5384
  setBlockedOutside(false);
5179
5385
  blockedRef.current = false;
5180
- const saved = readPanelBox(itemKey, kind);
5386
+ const saved = optsRef.current.persist === false ? null : readPanelBox(itemKey, kind);
5181
5387
  const nextSize = saved?.size === void 0 ? null : clampSize$1(saved.size, 0, 0, optsRef.current);
5182
5388
  setSize(nextSize);
5183
5389
  const savedPos = lastProbeBlocked ? void 0 : saved?.pos;
@@ -5316,6 +5522,7 @@ function useFloatingBox(options) {
5316
5522
  const node = panelRef.current;
5317
5523
  if (node === null) return;
5318
5524
  const rect = node.getBoundingClientRect();
5525
+ if (optsRef.current.persist === false) return;
5319
5526
  if (drag.kind === "move") {
5320
5527
  writePanelBox(itemKey, kind, { pos: {
5321
5528
  left: Math.round(rect.left),
@@ -5437,6 +5644,50 @@ function itemTypeLabel(t, itemType) {
5437
5644
  const label = t(key);
5438
5645
  return label === "" || label === key ? itemType : label;
5439
5646
  }
5647
+ /**
5648
+ * 子项形态 → 图标(16×16 viewBox)。
5649
+ *
5650
+ * 与条目类型图标同一套单线描边,但形态更具体:PDF 是有角标的纸页并在页内写
5651
+ * `PDF`,网页快照是浏览器窗口,网页链接是地球,笔记是横线纸,其余是普通文档。
5652
+ * 颜色仍在 `styles.ts` 的 `THEME_CSS` 里统一管。
5653
+ */
5654
+ const CHILD_KIND_PATH = {
5655
+ pdf: "M4 2.4h5l3 3v8.2H4z M9 2.4v3h3",
5656
+ snapshot: "M2.4 3.2h11.2v9.6H2.4z M2.4 5.8h11.2 M4 4.5h.6 M5.7 4.5h.6 M4.4 8.3h3.8 M4.4 10.4h5.2",
5657
+ webpage: "M8 2.6c3 0 5.4 2.4 5.4 5.4S11 13.4 8 13.4 2.6 11 2.6 8 5 2.6 8 2.6z M2.9 8h10.2 M8 2.7c1.5 1.6 2.2 3.4 2.2 5.3S9.5 11.8 8 13.3 M8 2.7C6.5 4.3 5.8 6.1 5.8 8s.7 3.9 2.2 5.3",
5658
+ note: "M4.2 2.6h7.6v10.8H4.2z M4.2 5.4h7.6 M6 7.8h4 M6 10.1h4",
5659
+ file: "M4.5 2.5h5l3 3v8h-8z M9.5 2.5v3h3 M6.5 8h4.5 M6.5 10.5h4.5"
5660
+ };
5661
+ /** 条目列表子项(附件 / 笔记)图标;`pdf` 额外在页内印三个字母。 */
5662
+ function ChildKindIcon({ kind, read = false, size = 15 }) {
5663
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
5664
+ width: size,
5665
+ height: size,
5666
+ viewBox: "0 0 16 16",
5667
+ fill: "none",
5668
+ stroke: "currentColor",
5669
+ strokeWidth: 1.2,
5670
+ strokeLinejoin: "round",
5671
+ strokeLinecap: "round",
5672
+ className: childKindIconClass(kind, read),
5673
+ "aria-hidden": true,
5674
+ focusable: "false",
5675
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: CHILD_KIND_PATH[kind] }), kind === "pdf" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("text", {
5676
+ x: 8,
5677
+ y: 11.6,
5678
+ textAnchor: "middle",
5679
+ fontSize: 4.1,
5680
+ fontWeight: 700,
5681
+ fill: "currentColor",
5682
+ stroke: "none",
5683
+ children: "PDF"
5684
+ })]
5685
+ });
5686
+ }
5687
+ /** 子项形态的本地化名称,用于展开行与副标题计数的悬停提示。 */
5688
+ function childKindLabel(t, kind) {
5689
+ return t(`list.childKind.${kind}`);
5690
+ }
5440
5691
  //#endregion
5441
5692
  //#region src/client/NoteEditor.tsx
5442
5693
  /**
@@ -5721,7 +5972,7 @@ const NoteEditor = (0, react.forwardRef)(function NoteEditor({ html, onDirty, on
5721
5972
  "aria-label": ariaLabel ?? t("note.new"),
5722
5973
  "data-placeholder": placeholder ?? "",
5723
5974
  style: {
5724
- ...bodyStyle$3,
5975
+ ...bodyStyle$4,
5725
5976
  minHeight
5726
5977
  },
5727
5978
  onInput: onDirty,
@@ -5795,7 +6046,7 @@ const toolbarStyle = {
5795
6046
  * 夹在中间可以两全:短笔记是一大片能直接写的区域,不缩成一条;长笔记也不会把整块
5796
6047
  * 面板撞飞,超过上限后在框内滚。
5797
6048
  */
5798
- const bodyStyle$3 = {
6049
+ const bodyStyle$4 = {
5799
6050
  padding: "6px 8px",
5800
6051
  fontSize: 12.5,
5801
6052
  lineHeight: 1.75,
@@ -6145,7 +6396,7 @@ function NoteItem({ t, note, canWrite, onInsert, onChanged, onOpenEditor }) {
6145
6396
  ]
6146
6397
  }),
6147
6398
  open && loading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6148
- style: hintStyle$8,
6399
+ style: hintStyle$9,
6149
6400
  children: t("note.loading")
6150
6401
  }),
6151
6402
  open && !loading && raw === null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -6291,7 +6542,7 @@ const anchorHintStyle = {
6291
6542
  color: "#d29922",
6292
6543
  textAlign: "right"
6293
6544
  };
6294
- const hintStyle$8 = {
6545
+ const hintStyle$9 = {
6295
6546
  marginTop: 6,
6296
6547
  fontSize: 11.5,
6297
6548
  opacity: .6
@@ -6384,9 +6635,9 @@ function InfoPanel({ t, detail, currentAttachmentKey, open, onToggle, onClose, o
6384
6635
  anchorRef: rootRef,
6385
6636
  itemKey: detail.key,
6386
6637
  kind: "info",
6387
- width: PANEL_WIDTH$1,
6388
- minWidth: PANEL_MIN_WIDTH$1,
6389
- minHeight: PANEL_MIN_HEIGHT$1
6638
+ width: PANEL_WIDTH$2,
6639
+ minWidth: PANEL_MIN_WIDTH$2,
6640
+ minHeight: PANEL_MIN_HEIGHT$2
6390
6641
  });
6391
6642
  (0, react.useEffect)(() => {
6392
6643
  setComposingNote(false);
@@ -6443,7 +6694,7 @@ function InfoPanel({ t, detail, currentAttachmentKey, open, onToggle, onClose, o
6443
6694
  const notes = detail.notes;
6444
6695
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6445
6696
  ref: rootRef,
6446
- style: rootStyle$7,
6697
+ style: rootStyle$8,
6447
6698
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6448
6699
  ref: rowRef,
6449
6700
  style: rowStyle$3,
@@ -6482,12 +6733,12 @@ function InfoPanel({ t, detail, currentAttachmentKey, open, onToggle, onClose, o
6482
6733
  "aria-label": t("detail.info"),
6483
6734
  ...box.panelProps,
6484
6735
  style: {
6485
- ...panelStyle$1,
6736
+ ...panelStyle$2,
6486
6737
  ...box.style
6487
6738
  },
6488
6739
  children: [
6489
6740
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6490
- style: panelHeaderStyle$1,
6741
+ style: panelHeaderStyle$2,
6491
6742
  ...box.moveProps,
6492
6743
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6493
6744
  style: panelTitleStyle,
@@ -6507,11 +6758,11 @@ function InfoPanel({ t, detail, currentAttachmentKey, open, onToggle, onClose, o
6507
6758
  opacity: pinned ? 1 : .5,
6508
6759
  background: pinHovered ? "rgba(127,127,127,0.16)" : "transparent"
6509
6760
  },
6510
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PinIcon$1, { filled: pinned })
6761
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PinIcon$2, { filled: pinned })
6511
6762
  })]
6512
6763
  }),
6513
6764
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6514
- style: bodyStyle$2,
6765
+ style: bodyStyle$3,
6515
6766
  children: [
6516
6767
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Block, {
6517
6768
  label: t("detail.metadata"),
@@ -6642,15 +6893,15 @@ function InfoPanel({ t, detail, currentAttachmentKey, open, onToggle, onClose, o
6642
6893
  "aria-hidden": "true",
6643
6894
  title: t("detail.resize"),
6644
6895
  ...box.resizeProps,
6645
- style: resizeHandleStyle$2,
6646
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResizeIcon$1, {})
6896
+ style: resizeHandleStyle$3,
6897
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResizeIcon$2, {})
6647
6898
  })
6648
6899
  ]
6649
6900
  })]
6650
6901
  });
6651
6902
  }
6652
6903
  /** 图钉:帽 + 针。钉住时实心(`ACCENT`),未钉住只描边。 */
6653
- function PinIcon$1({ filled }) {
6904
+ function PinIcon$2({ filled }) {
6654
6905
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
6655
6906
  width: "12",
6656
6907
  height: "12",
@@ -6672,7 +6923,7 @@ function PinIcon$1({ filled }) {
6672
6923
  });
6673
6924
  }
6674
6925
  /** 右下角的缩放把手:两条 45° 短线。 */
6675
- function ResizeIcon$1() {
6926
+ function ResizeIcon$2() {
6676
6927
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
6677
6928
  width: "10",
6678
6929
  height: "10",
@@ -6699,7 +6950,7 @@ function ResizeIcon$1() {
6699
6950
  * 消息与粘性输入区;又不该高过宿主的对话框(那类通常 ≥ 1000)。这一层不画东西、
6700
6951
  * `pointerEvents:none`,抬高层级不会挡任何点击。
6701
6952
  */
6702
- const rootStyle$7 = {
6953
+ const rootStyle$8 = {
6703
6954
  position: "absolute",
6704
6955
  inset: 0,
6705
6956
  zIndex: 300,
@@ -6736,15 +6987,15 @@ const triggerStyle$1 = {
6736
6987
  zIndex: 21
6737
6988
  };
6738
6989
  /** 初始宽度;比原来浮在正文里的 320 宽一点,长标题与元数据少折行。 */
6739
- const PANEL_WIDTH$1 = 360;
6740
- const PANEL_MIN_WIDTH$1 = 280;
6741
- const PANEL_MIN_HEIGHT$1 = 240;
6990
+ const PANEL_WIDTH$2 = 360;
6991
+ const PANEL_MIN_WIDTH$2 = 280;
6992
+ const PANEL_MIN_HEIGHT$2 = 240;
6742
6993
  /**
6743
6994
  * 面板本体:`fixed`,几何由 `floatingBox` 注入(`...box.style` 覆盖在最后)。
6744
6995
  *
6745
6996
  * 纵向 flex:标题栏固定、区块区滚动,右下角把手才不会被内容带着跑。
6746
6997
  */
6747
- const panelStyle$1 = {
6998
+ const panelStyle$2 = {
6748
6999
  position: "fixed",
6749
7000
  pointerEvents: "auto",
6750
7001
  display: "flex",
@@ -6761,7 +7012,7 @@ const panelStyle$1 = {
6761
7012
  zIndex: 300
6762
7013
  };
6763
7014
  /** 区块区:自己滚,别把标题栏与把手一起卷走。 */
6764
- const bodyStyle$2 = {
7015
+ const bodyStyle$3 = {
6765
7016
  flex: 1,
6766
7017
  minHeight: 0,
6767
7018
  overflow: "auto",
@@ -6770,7 +7021,7 @@ const bodyStyle$2 = {
6770
7021
  paddingBottom: 6
6771
7022
  };
6772
7023
  /** 标题栏兼拖动把手。 */
6773
- const panelHeaderStyle$1 = {
7024
+ const panelHeaderStyle$2 = {
6774
7025
  display: "flex",
6775
7026
  alignItems: "flex-start",
6776
7027
  gap: 6,
@@ -6797,7 +7048,7 @@ const pinStyle$1 = {
6797
7048
  transition: "background-color 120ms ease"
6798
7049
  };
6799
7050
  /** 缩放把手:贴在右下角,盖在滚动区之上。 */
6800
- const resizeHandleStyle$2 = {
7051
+ const resizeHandleStyle$3 = {
6801
7052
  position: "absolute",
6802
7053
  right: 2,
6803
7054
  bottom: 2,
@@ -6955,9 +7206,9 @@ const attachmentMetaStyle = {
6955
7206
  const INDENT$1 = 13;
6956
7207
  const MAX_INDENT_DEPTH = 6;
6957
7208
  /** 初始宽度;左侧挤不下时由 `floatingBox` 收窄或退回右栏内。 */
6958
- const PANEL_WIDTH = 360;
6959
- const PANEL_MIN_WIDTH = 260;
6960
- const PANEL_MIN_HEIGHT = 200;
7209
+ const PANEL_WIDTH$1 = 360;
7210
+ const PANEL_MIN_WIDTH$1 = 260;
7211
+ const PANEL_MIN_HEIGHT$1 = 200;
6961
7212
  /** 用户自己滚过目录后,这么久之内不再把高亮行带回可视区(别抢滚动)。 */
6962
7213
  const FOLLOW_HOLD_MS = 2500;
6963
7214
  function OutlinePanel({ t, itemKey, items, sourceLabel, activeIndex, open, onToggle, onClose, onJump }) {
@@ -6981,9 +7232,9 @@ function OutlinePanel({ t, itemKey, items, sourceLabel, activeIndex, open, onTog
6981
7232
  anchorRef: rootRef,
6982
7233
  itemKey,
6983
7234
  kind: "outline",
6984
- width: PANEL_WIDTH,
6985
- minWidth: PANEL_MIN_WIDTH,
6986
- minHeight: PANEL_MIN_HEIGHT
7235
+ width: PANEL_WIDTH$1,
7236
+ minWidth: PANEL_MIN_WIDTH$1,
7237
+ minHeight: PANEL_MIN_HEIGHT$1
6987
7238
  });
6988
7239
  useDismiss(open, box.panelRef, onClose, {
6989
7240
  pinned,
@@ -7022,7 +7273,7 @@ function OutlinePanel({ t, itemKey, items, sourceLabel, activeIndex, open, onTog
7022
7273
  ]);
7023
7274
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7024
7275
  ref: rootRef,
7025
- style: rootStyle$6,
7276
+ style: rootStyle$7,
7026
7277
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
7027
7278
  ref: triggerRef,
7028
7279
  type: "button",
@@ -7041,12 +7292,12 @@ function OutlinePanel({ t, itemKey, items, sourceLabel, activeIndex, open, onTog
7041
7292
  "aria-label": t("outline.title"),
7042
7293
  ...box.panelProps,
7043
7294
  style: {
7044
- ...panelStyle,
7295
+ ...panelStyle$1,
7045
7296
  ...box.style
7046
7297
  },
7047
7298
  children: [
7048
7299
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7049
- style: panelHeaderStyle,
7300
+ style: panelHeaderStyle$1,
7050
7301
  ...box.moveProps,
7051
7302
  children: [
7052
7303
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("outline.title") }),
@@ -7069,7 +7320,7 @@ function OutlinePanel({ t, itemKey, items, sourceLabel, activeIndex, open, onTog
7069
7320
  opacity: pinned ? 1 : .5,
7070
7321
  background: pinHovered ? "rgba(127,127,127,0.16)" : "transparent"
7071
7322
  },
7072
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PinIcon, { filled: pinned })
7323
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PinIcon$1, { filled: pinned })
7073
7324
  })
7074
7325
  ]
7075
7326
  }),
@@ -7129,8 +7380,8 @@ function OutlinePanel({ t, itemKey, items, sourceLabel, activeIndex, open, onTog
7129
7380
  "aria-hidden": "true",
7130
7381
  title: t("outline.resize"),
7131
7382
  ...box.resizeProps,
7132
- style: resizeHandleStyle$1,
7133
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResizeIcon, {})
7383
+ style: resizeHandleStyle$2,
7384
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResizeIcon$1, {})
7134
7385
  })
7135
7386
  ]
7136
7387
  })]
@@ -7164,7 +7415,7 @@ function ListIcon() {
7164
7415
  });
7165
7416
  }
7166
7417
  /** 图钉:帽 + 针。钉住时实心(`ACCENT`),未钉住只描边。 */
7167
- function PinIcon({ filled }) {
7418
+ function PinIcon$1({ filled }) {
7168
7419
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
7169
7420
  width: "12",
7170
7421
  height: "12",
@@ -7192,7 +7443,7 @@ function PinIcon({ filled }) {
7192
7443
  * 又不该高过宿主的对话框(那类通常 ≥ 1000)。这一层不画东西、`pointerEvents:none`,
7193
7444
  * 抬高层级不会挡任何点击。
7194
7445
  */
7195
- const rootStyle$6 = {
7446
+ const rootStyle$7 = {
7196
7447
  position: "absolute",
7197
7448
  inset: 0,
7198
7449
  zIndex: 300,
@@ -7219,7 +7470,7 @@ const triggerStyle = {
7219
7470
  zIndex: 21
7220
7471
  };
7221
7472
  /** 右下角的缩放把手:两条 45° 短线,够小、不抢目录的视觉。 */
7222
- function ResizeIcon() {
7473
+ function ResizeIcon$1() {
7223
7474
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
7224
7475
  width: "10",
7225
7476
  height: "10",
@@ -7245,7 +7496,7 @@ function ResizeIcon() {
7245
7496
  * `zIndex` 要压过聊天区(含输入框的粘性层),但不能高到盖住宿主自己的对话框
7246
7497
  * (设置页那类通常 ≥ 1000)。
7247
7498
  */
7248
- const panelStyle = {
7499
+ const panelStyle$1 = {
7249
7500
  position: "fixed",
7250
7501
  pointerEvents: "auto",
7251
7502
  display: "flex",
@@ -7262,7 +7513,7 @@ const panelStyle = {
7262
7513
  zIndex: 300
7263
7514
  };
7264
7515
  /** 标题栏兼拖动把手:`cursor: move` 给个信号,拖动期间别顺手选中标题文字。 */
7265
- const panelHeaderStyle = {
7516
+ const panelHeaderStyle$1 = {
7266
7517
  display: "flex",
7267
7518
  alignItems: "center",
7268
7519
  gap: 6,
@@ -7314,7 +7565,7 @@ const listStyle = {
7314
7565
  paddingBottom: 8
7315
7566
  };
7316
7567
  /** 缩放把手:贴在右下角,盖在列表之上。 */
7317
- const resizeHandleStyle$1 = {
7568
+ const resizeHandleStyle$2 = {
7318
7569
  position: "absolute",
7319
7570
  right: 2,
7320
7571
  bottom: 2,
@@ -30881,7 +31132,7 @@ function AnnotationCard({ t, annotation, style, cardRef, canEdit, onClose, onIns
30881
31132
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
30882
31133
  type: "button",
30883
31134
  onClick: onClose,
30884
- style: iconButtonStyle$1,
31135
+ style: iconButtonStyle$2,
30885
31136
  "aria-label": t("viewer.close"),
30886
31137
  children: "×"
30887
31138
  })
@@ -30914,7 +31165,7 @@ function AnnotationCard({ t, annotation, style, cardRef, canEdit, onClose, onIns
30914
31165
  style: textareaStyle
30915
31166
  }),
30916
31167
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
30917
- style: hintStyle$7,
31168
+ style: hintStyle$8,
30918
31169
  children: t("annotation.commentHint")
30919
31170
  }),
30920
31171
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -31074,7 +31325,7 @@ const swatchStyle$1 = {
31074
31325
  border: "none",
31075
31326
  cursor: "pointer"
31076
31327
  };
31077
- const iconButtonStyle$1 = {
31328
+ const iconButtonStyle$2 = {
31078
31329
  width: 20,
31079
31330
  height: 20,
31080
31331
  padding: 0,
@@ -31100,7 +31351,7 @@ const textareaStyle = {
31100
31351
  fontFamily: "inherit",
31101
31352
  resize: "vertical"
31102
31353
  };
31103
- const hintStyle$7 = {
31354
+ const hintStyle$8 = {
31104
31355
  marginTop: 4,
31105
31356
  fontSize: 10.5,
31106
31357
  lineHeight: 1.5,
@@ -32303,7 +32554,7 @@ function TranslationCard({ t, view, bounds, engine, onEngineChange, onClose, onR
32303
32554
  children: targetLabel
32304
32555
  })]
32305
32556
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
32306
- style: bodyStyle$1,
32557
+ style: bodyStyle$2,
32307
32558
  children: [
32308
32559
  view.status === "loading" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
32309
32560
  style: statusStyle,
@@ -32355,7 +32606,7 @@ function TranslationCard({ t, view, bounds, engine, onEngineChange, onClose, onR
32355
32606
  onPointerMove: onResizeMove,
32356
32607
  onPointerUp: onResizeUp,
32357
32608
  onPointerCancel: onResizeUp,
32358
- style: resizeHandleStyle,
32609
+ style: resizeHandleStyle$1,
32359
32610
  title: t("translate.resizeHint"),
32360
32611
  "aria-label": t("translate.resizeHint"),
32361
32612
  role: "separator"
@@ -32537,7 +32788,7 @@ const dividerStyle = {
32537
32788
  background: "light-dark(#8593a8, #78859a)"
32538
32789
  };
32539
32790
  /** 右栏正文区:吃掉栏目标题之外的全部高度。 */
32540
- const bodyStyle$1 = {
32791
+ const bodyStyle$2 = {
32541
32792
  flex: 1,
32542
32793
  minHeight: 0,
32543
32794
  display: "flex",
@@ -32570,7 +32821,7 @@ const footerStyle = {
32570
32821
  paddingRight: 10
32571
32822
  };
32572
32823
  /** 右下角缩放把手:两条斜线示意「可以拉」,命中区比图形略大。 */
32573
- const resizeHandleStyle = {
32824
+ const resizeHandleStyle$1 = {
32574
32825
  position: "absolute",
32575
32826
  right: 0,
32576
32827
  bottom: 0,
@@ -33888,7 +34139,7 @@ function PdfViewer(props) {
33888
34139
  }
33889
34140
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
33890
34141
  ref: rootRef,
33891
- style: rootStyle$5,
34142
+ style: rootStyle$6,
33892
34143
  children: [
33893
34144
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: PDF_CSS }),
33894
34145
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -33998,7 +34249,7 @@ function PdfViewer(props) {
33998
34249
  ]
33999
34250
  });
34000
34251
  }
34001
- const rootStyle$5 = {
34252
+ const rootStyle$6 = {
34002
34253
  position: "relative",
34003
34254
  height: "100%",
34004
34255
  minHeight: 0
@@ -37269,7 +37520,7 @@ function SnapshotViewer({ t, detail, source, annotations, viewerRef, onReady, on
37269
37520
  const cardAbove = card !== null && card.y > rootHeight * .55;
37270
37521
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
37271
37522
  ref: rootRef,
37272
- style: rootStyle$4,
37523
+ style: rootStyle$5,
37273
37524
  children: [
37274
37525
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("iframe", {
37275
37526
  ref: frameRef,
@@ -37366,7 +37617,7 @@ function barPosition(selection, frame, root) {
37366
37617
  y: Math.max(36, offsetY + selection.rect.top)
37367
37618
  };
37368
37619
  }
37369
- const rootStyle$4 = {
37620
+ const rootStyle$5 = {
37370
37621
  position: "relative",
37371
37622
  height: "100%",
37372
37623
  minHeight: 0,
@@ -37728,7 +37979,7 @@ function TextViewer({ t, detail, annotations, viewerRef, onReady, onInsertExcerp
37728
37979
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
37729
37980
  ref: boxRef,
37730
37981
  onMouseUp: handleMouseUp,
37731
- style: rootStyle$3,
37982
+ style: rootStyle$4,
37732
37983
  children: [
37733
37984
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: TEXT_CSS + NOTE_CSS }),
37734
37985
  !hasContent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
@@ -37785,7 +38036,7 @@ function TextViewer({ t, detail, annotations, viewerRef, onReady, onInsertExcerp
37785
38036
  ]
37786
38037
  });
37787
38038
  }
37788
- const rootStyle$3 = {
38039
+ const rootStyle$4 = {
37789
38040
  position: "relative",
37790
38041
  height: "100%",
37791
38042
  minHeight: 0,
@@ -37861,9 +38112,9 @@ function WebpageViewer(props) {
37861
38112
  const linked = safeHttpUrl(detail.url);
37862
38113
  const hasText = detail.fulltext !== null;
37863
38114
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
37864
- style: rootStyle$2,
38115
+ style: rootStyle$3,
37865
38116
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
37866
- style: hintStyle$6,
38117
+ style: hintStyle$7,
37867
38118
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
37868
38119
  style: hintTextStyle,
37869
38120
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: hasText ? t("detail.noSnapshotHint") : t("detail.noSnapshot") }), !hasText && detail.url !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -37878,18 +38129,18 @@ function WebpageViewer(props) {
37878
38129
  children: t("detail.openOriginal")
37879
38130
  })]
37880
38131
  }), hasText && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
37881
- style: bodyStyle,
38132
+ style: bodyStyle$1,
37882
38133
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextViewer, { ...props })
37883
38134
  })]
37884
38135
  });
37885
38136
  }
37886
- const rootStyle$2 = {
38137
+ const rootStyle$3 = {
37887
38138
  display: "flex",
37888
38139
  flexDirection: "column",
37889
38140
  height: "100%",
37890
38141
  minHeight: 0
37891
38142
  };
37892
- const hintStyle$6 = {
38143
+ const hintStyle$7 = {
37893
38144
  flexShrink: 0,
37894
38145
  display: "flex",
37895
38146
  alignItems: "flex-start",
@@ -37919,7 +38170,7 @@ const linkStyle = {
37919
38170
  textDecoration: "none",
37920
38171
  whiteSpace: "nowrap"
37921
38172
  };
37922
- const bodyStyle = {
38173
+ const bodyStyle$1 = {
37923
38174
  flex: 1,
37924
38175
  minHeight: 0,
37925
38176
  position: "relative"
@@ -38085,7 +38336,7 @@ function ScreenshotOverlay({ t, url, width, height, selection, busy, onSelect, o
38085
38336
  const buttonLeft = shown !== null ? clamp(shown.left, 4, Math.max(4, width - 150)) : 0;
38086
38337
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
38087
38338
  ref: rootRef,
38088
- style: rootStyle$1,
38339
+ style: rootStyle$2,
38089
38340
  onPointerDown,
38090
38341
  onPointerMove,
38091
38342
  onPointerUp,
@@ -38111,7 +38362,7 @@ function ScreenshotOverlay({ t, url, width, height, selection, busy, onSelect, o
38111
38362
  height: shown.height
38112
38363
  } }),
38113
38364
  shown === null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
38114
- style: hintStyle$5,
38365
+ style: hintStyle$6,
38115
38366
  children: t("shot.hint")
38116
38367
  }),
38117
38368
  shown !== null && shown.width > 0 && shown.height > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -38154,7 +38405,7 @@ function ScreenshotOverlay({ t, url, width, height, selection, busy, onSelect, o
38154
38405
  * `zIndex` 要压过左上角那组悬浮按钮(它们在 `zIndex: 300` 的透明层里,为了能画到
38155
38406
  * 右栏外面去),否则定格之后按钮仍浮在图上方、还会挡住正文左上角那一片的框选。
38156
38407
  */
38157
- const rootStyle$1 = {
38408
+ const rootStyle$2 = {
38158
38409
  position: "absolute",
38159
38410
  inset: 0,
38160
38411
  zIndex: 400,
@@ -38187,7 +38438,7 @@ const cutStyle = {
38187
38438
  boxShadow: "0 0 0 9999px rgba(0,0,0,0.42)",
38188
38439
  pointerEvents: "none"
38189
38440
  };
38190
- const hintStyle$5 = {
38441
+ const hintStyle$6 = {
38191
38442
  position: "absolute",
38192
38443
  left: "50%",
38193
38444
  top: "50%",
@@ -38400,14 +38651,14 @@ function DocumentView({ t, detail, source, annotations, viewerRef, onReady, onIn
38400
38651
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
38401
38652
  type: "button",
38402
38653
  onClick: () => viewerRef.current?.zoomOut(),
38403
- style: iconButtonStyle,
38654
+ style: iconButtonStyle$1,
38404
38655
  "aria-label": t("viewer.zoomOut"),
38405
38656
  title: t("viewer.zoomOut"),
38406
38657
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ZoomIcon, { kind: "out" })
38407
38658
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
38408
38659
  type: "button",
38409
38660
  onClick: () => viewerRef.current?.zoomIn(),
38410
- style: iconButtonStyle,
38661
+ style: iconButtonStyle$1,
38411
38662
  "aria-label": t("viewer.zoomIn"),
38412
38663
  title: t("viewer.zoomIn"),
38413
38664
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ZoomIcon, { kind: "in" })
@@ -38553,7 +38804,7 @@ const zoomGroupStyle = {
38553
38804
  gap: 2
38554
38805
  };
38555
38806
  /** 无边框图标按钮:放大镜本身当按钮,不再套一层方框。 */
38556
- const iconButtonStyle = {
38807
+ const iconButtonStyle$1 = {
38557
38808
  flexShrink: 0,
38558
38809
  display: "inline-flex",
38559
38810
  alignItems: "center",
@@ -39363,7 +39614,7 @@ function ItemDetail({ t, detail, onInsertItem, onInsertExcerpt, onInsertTranslat
39363
39614
  }
39364
39615
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
39365
39616
  style: {
39366
- ...rootStyle,
39617
+ ...rootStyle$1,
39367
39618
  "--dsh-zp-topbar-pad": `${topbarPad}px`
39368
39619
  },
39369
39620
  children: [
@@ -39433,7 +39684,7 @@ function ItemDetail({ t, detail, onInsertItem, onInsertExcerpt, onInsertTranslat
39433
39684
  ]
39434
39685
  });
39435
39686
  }
39436
- const rootStyle = {
39687
+ const rootStyle$1 = {
39437
39688
  position: "relative",
39438
39689
  display: "flex",
39439
39690
  flexDirection: "column",
@@ -39716,7 +39967,7 @@ function parseItemKey(info) {
39716
39967
  function errorMessage$1(error) {
39717
39968
  return error instanceof Error ? error.message : String(error);
39718
39969
  }
39719
- const hintStyle$4 = {
39970
+ const hintStyle$5 = {
39720
39971
  padding: "14px 12px",
39721
39972
  opacity: .6,
39722
39973
  fontSize: 12.5
@@ -39799,12 +40050,12 @@ function ZoteroItemPane(props) {
39799
40050
  },
39800
40051
  children: [itemKey === null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
39801
40052
  style: {
39802
- ...hintStyle$4,
40053
+ ...hintStyle$5,
39803
40054
  color: "#d29922"
39804
40055
  },
39805
40056
  children: t("itemTab.invalid")
39806
40057
  }) : loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
39807
- style: hintStyle$4,
40058
+ style: hintStyle$5,
39808
40059
  children: t("status.loading")
39809
40060
  }) : detail === null ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
39810
40061
  style: {
@@ -40212,7 +40463,7 @@ function CollectionTree(props) {
40212
40463
  }, node.key)),
40213
40464
  filtering && !matched && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
40214
40465
  style: {
40215
- ...hintStyle$3,
40466
+ ...hintStyle$4,
40216
40467
  paddingLeft: 22
40217
40468
  },
40218
40469
  children: t("tree.emptyFiltered")
@@ -40220,12 +40471,433 @@ function CollectionTree(props) {
40220
40471
  ] })]
40221
40472
  });
40222
40473
  }
40223
- const hintStyle$3 = {
40474
+ const hintStyle$4 = {
40224
40475
  padding: "6px 8px",
40225
40476
  fontSize: 12,
40226
40477
  opacity: .6
40227
40478
  };
40228
40479
  //#endregion
40480
+ //#region src/client/HelpWindow.tsx
40481
+ /**
40482
+ * 面板头部的「使用帮助」教程浮窗。
40483
+ *
40484
+ * 复用 {@link useFloatingBox} + {@link useDismiss}:默认摆在右栏外侧、可拖位置、
40485
+ * 可拖大小、图钉常驻,Esc / 图钉关闭。与目录 / 信息浮层唯一的区别是
40486
+ * `persist: false`——它是面板级的,没有真实 itemKey,几何只在本会话内存里,
40487
+ * 绝不往 view-state 写假条目键。
40488
+ *
40489
+ * 内容分 5 个 tab:快速上手 / 精读与理解 / 笔记整理 / 文库管理 / 截图与标注。
40490
+ * 每条示例给出入口提示与一段可一键复制的提示词,文案全走 locales.ts(zh/en)。
40491
+ *
40492
+ * 面板根必须挂 `{...box.panelProps}`(WINDOW_DRAG_EXCLUDE):macOS 宿主把整行
40493
+ * chrome 当几何拖拽区,浮层压住那行就会变成拖整个 DSH 窗口。
40494
+ */
40495
+ /** 假 key:`persist: false` 时只作 effect 依赖,不参与几何读写。 */
40496
+ const HELP_BOX_KEY = "__help__";
40497
+ const PANEL_WIDTH = 460;
40498
+ const PANEL_MIN_WIDTH = 340;
40499
+ const PANEL_MIN_HEIGHT = 280;
40500
+ /** 「已复制」显示多久后复位。 */
40501
+ const COPIED_FEEDBACK_MS = 1400;
40502
+ const TABS = [
40503
+ {
40504
+ id: "start",
40505
+ count: 7,
40506
+ withHint: true,
40507
+ footnoteKey: "help.start.footnote"
40508
+ },
40509
+ {
40510
+ id: "reading",
40511
+ count: 4,
40512
+ withHint: false
40513
+ },
40514
+ {
40515
+ id: "notes",
40516
+ count: 3,
40517
+ withHint: false
40518
+ },
40519
+ {
40520
+ id: "library",
40521
+ count: 4,
40522
+ withHint: false
40523
+ },
40524
+ {
40525
+ id: "shots",
40526
+ count: 3,
40527
+ withHint: false
40528
+ }
40529
+ ];
40530
+ function HelpWindow({ t, open, anchorRef, triggerRef, onClose }) {
40531
+ const [activeTab, setActiveTab] = (0, react.useState)("start");
40532
+ const [pinned, setPinned] = (0, react.useState)(false);
40533
+ const [pinHovered, setPinHovered] = (0, react.useState)(false);
40534
+ const [copiedKey, setCopiedKey] = (0, react.useState)(null);
40535
+ const copiedTimerRef = (0, react.useRef)(null);
40536
+ const box = useFloatingBox({
40537
+ open,
40538
+ anchorRef,
40539
+ itemKey: HELP_BOX_KEY,
40540
+ kind: "info",
40541
+ persist: false,
40542
+ width: PANEL_WIDTH,
40543
+ minWidth: PANEL_MIN_WIDTH,
40544
+ minHeight: PANEL_MIN_HEIGHT
40545
+ });
40546
+ useDismiss(open, box.panelRef, onClose, {
40547
+ pinned,
40548
+ extraRef: triggerRef
40549
+ });
40550
+ (0, react.useEffect)(() => () => {
40551
+ if (copiedTimerRef.current !== null) window.clearTimeout(copiedTimerRef.current);
40552
+ }, []);
40553
+ function copyPrompt(key, text) {
40554
+ writeClipboard(text).then((ok) => {
40555
+ if (ok) setCopiedKey(key);
40556
+ else {
40557
+ setCopiedKey(null);
40558
+ showToast(t("toast.copyFailed"));
40559
+ }
40560
+ if (copiedTimerRef.current !== null) window.clearTimeout(copiedTimerRef.current);
40561
+ copiedTimerRef.current = window.setTimeout(() => setCopiedKey(null), COPIED_FEEDBACK_MS);
40562
+ });
40563
+ }
40564
+ const tab = TABS.find((spec) => spec.id === activeTab) ?? TABS[0];
40565
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
40566
+ style: rootStyle,
40567
+ children: open && box.style !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
40568
+ ref: box.panelRef,
40569
+ role: "dialog",
40570
+ "aria-label": t("help.title"),
40571
+ ...box.panelProps,
40572
+ style: {
40573
+ ...panelStyle,
40574
+ ...box.style
40575
+ },
40576
+ children: [
40577
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
40578
+ style: panelHeaderStyle,
40579
+ ...box.moveProps,
40580
+ children: [
40581
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("help.title") }),
40582
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: { flex: 1 } }),
40583
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
40584
+ type: "button",
40585
+ "aria-pressed": pinned,
40586
+ "aria-label": pinned ? t("help.unpin") : t("help.pin"),
40587
+ title: pinned ? t("help.unpin") : t("help.pin"),
40588
+ onClick: () => setPinned((current) => !current),
40589
+ onMouseEnter: () => setPinHovered(true),
40590
+ onMouseLeave: () => setPinHovered(false),
40591
+ style: {
40592
+ ...iconButtonStyle,
40593
+ color: pinned ? "#508cff" : "CanvasText",
40594
+ opacity: pinned ? 1 : .55,
40595
+ background: pinHovered ? "rgba(127,127,127,0.16)" : "transparent"
40596
+ },
40597
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PinIcon, { filled: pinned })
40598
+ }),
40599
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
40600
+ type: "button",
40601
+ "aria-label": t("help.close"),
40602
+ title: t("help.close"),
40603
+ onClick: onClose,
40604
+ style: {
40605
+ ...iconButtonStyle,
40606
+ fontSize: 15,
40607
+ lineHeight: 1
40608
+ },
40609
+ children: "×"
40610
+ })
40611
+ ]
40612
+ }),
40613
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
40614
+ style: subtitleStyle,
40615
+ children: t("help.subtitle")
40616
+ }),
40617
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
40618
+ style: tabBarStyle,
40619
+ role: "tablist",
40620
+ "aria-label": t("help.title"),
40621
+ children: TABS.map((spec) => {
40622
+ const active = spec.id === activeTab;
40623
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
40624
+ type: "button",
40625
+ role: "tab",
40626
+ "aria-selected": active,
40627
+ className: softButtonClass(active),
40628
+ onClick: () => setActiveTab(spec.id),
40629
+ style: {
40630
+ ...active ? SOFT_BUTTON_ACTIVE_STYLE : SOFT_BUTTON_STYLE,
40631
+ boxShadow: active ? `inset 0 -2px 0 #508cff` : "none",
40632
+ ...tabButtonStyle
40633
+ },
40634
+ children: t(`help.tab.${spec.id}`)
40635
+ }, spec.id);
40636
+ })
40637
+ }),
40638
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
40639
+ style: bodyStyle,
40640
+ children: [
40641
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
40642
+ style: sectionTitleStyle,
40643
+ children: t(`help.${tab.id}.title`)
40644
+ }),
40645
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
40646
+ style: sectionDescStyle,
40647
+ children: t(`help.${tab.id}.desc`)
40648
+ }),
40649
+ Array.from({ length: tab.count }, (_, index) => index + 1).map((n) => {
40650
+ const key = `help.ex.${tab.id}.${n}`;
40651
+ const copied = copiedKey === `${tab.id}-${n}`;
40652
+ const hint = tab.withHint ? t(`${key}.hint`) : "";
40653
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
40654
+ style: exampleStyle,
40655
+ children: [
40656
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
40657
+ style: exampleHeadStyle,
40658
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
40659
+ style: exampleLabelStyle,
40660
+ children: t(`${key}.label`)
40661
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
40662
+ type: "button",
40663
+ className: "dsh-zp-soft-btn",
40664
+ onClick: () => copyPrompt(`${tab.id}-${n}`, t(`${key}.prompt`)),
40665
+ style: {
40666
+ ...SOFT_BUTTON_STYLE,
40667
+ ...copied ? SOFT_BUTTON_ACTIVE_STYLE : null,
40668
+ ...copyButtonStyle,
40669
+ color: copied ? "#508cff" : "var(--dsw-alias-label-primary, CanvasText)"
40670
+ },
40671
+ children: copied ? t("toast.copied") : t("help.copy")
40672
+ })]
40673
+ }),
40674
+ hint !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
40675
+ style: hintStyle$3,
40676
+ children: hint
40677
+ }),
40678
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
40679
+ style: promptStyle,
40680
+ children: t(`${key}.prompt`)
40681
+ })
40682
+ ]
40683
+ }, key);
40684
+ }),
40685
+ tab.footnoteKey !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
40686
+ style: footnoteStyle,
40687
+ children: t(tab.footnoteKey)
40688
+ })
40689
+ ]
40690
+ }),
40691
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
40692
+ "aria-hidden": "true",
40693
+ title: t("help.resize"),
40694
+ ...box.resizeProps,
40695
+ style: resizeHandleStyle,
40696
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResizeIcon, {})
40697
+ })
40698
+ ]
40699
+ })
40700
+ });
40701
+ }
40702
+ function PinIcon({ filled }) {
40703
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
40704
+ width: "13",
40705
+ height: "13",
40706
+ viewBox: "0 0 16 16",
40707
+ "aria-hidden": "true",
40708
+ focusable: "false",
40709
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
40710
+ d: "M9.5 1.5 14.5 6.5 11 8l-2 4-1.5-1.5L4 13 3 12l2.5-3.5L4 7l4-2z",
40711
+ fill: filled ? "currentColor" : "none",
40712
+ stroke: "currentColor",
40713
+ strokeWidth: "1.2",
40714
+ strokeLinejoin: "round"
40715
+ })
40716
+ });
40717
+ }
40718
+ function ResizeIcon() {
40719
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
40720
+ width: "10",
40721
+ height: "10",
40722
+ viewBox: "0 0 10 10",
40723
+ "aria-hidden": "true",
40724
+ focusable: "false",
40725
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
40726
+ d: "M4.2 9 9 4.2",
40727
+ stroke: "currentColor",
40728
+ strokeWidth: "1.2",
40729
+ strokeLinecap: "round"
40730
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
40731
+ d: "M7.4 9 9 7.4",
40732
+ stroke: "currentColor",
40733
+ strokeWidth: "1.2",
40734
+ strokeLinecap: "round"
40735
+ })]
40736
+ });
40737
+ }
40738
+ /**
40739
+ * 透明根层:只负责把 zIndex 抬到聊天区 / 输入框之上;自身不画东西、不拦点击。
40740
+ * 层级高于兄弟浮层的 300,低于截图定格 400 与宿主对话框(≥1000)。
40741
+ */
40742
+ const rootStyle = {
40743
+ position: "absolute",
40744
+ inset: 0,
40745
+ zIndex: 320,
40746
+ pointerEvents: "none"
40747
+ };
40748
+ const panelStyle = {
40749
+ position: "fixed",
40750
+ pointerEvents: "auto",
40751
+ display: "flex",
40752
+ flexDirection: "column",
40753
+ padding: "10px 10px 8px",
40754
+ borderRadius: 8,
40755
+ border: "1px solid rgba(127,127,127,0.32)",
40756
+ background: "Canvas",
40757
+ color: "CanvasText",
40758
+ boxShadow: "0 10px 30px rgba(0,0,0,0.3)",
40759
+ fontSize: 12,
40760
+ lineHeight: 1.6,
40761
+ overscrollBehavior: "contain",
40762
+ zIndex: 320
40763
+ };
40764
+ const panelHeaderStyle = {
40765
+ display: "flex",
40766
+ alignItems: "center",
40767
+ gap: 6,
40768
+ flexShrink: 0,
40769
+ padding: "0 2px 8px",
40770
+ marginBottom: 6,
40771
+ borderBottom: "1px solid rgba(127,127,127,0.2)",
40772
+ fontWeight: 700,
40773
+ fontSize: 13,
40774
+ color: ACCENT,
40775
+ cursor: "move",
40776
+ userSelect: "none",
40777
+ touchAction: "none"
40778
+ };
40779
+ const iconButtonStyle = {
40780
+ display: "inline-flex",
40781
+ alignItems: "center",
40782
+ justifyContent: "center",
40783
+ flexShrink: 0,
40784
+ width: 20,
40785
+ height: 20,
40786
+ padding: 0,
40787
+ borderRadius: 4,
40788
+ border: "none",
40789
+ cursor: "pointer",
40790
+ transition: "background-color 120ms ease"
40791
+ };
40792
+ const subtitleStyle = {
40793
+ flexShrink: 0,
40794
+ padding: "0 2px 8px",
40795
+ fontSize: 11.5,
40796
+ opacity: .7
40797
+ };
40798
+ const tabBarStyle = {
40799
+ display: "flex",
40800
+ flexWrap: "wrap",
40801
+ gap: 4,
40802
+ flexShrink: 0,
40803
+ padding: "0 2px 8px"
40804
+ };
40805
+ const tabButtonStyle = {
40806
+ borderRadius: 6,
40807
+ padding: "4px 8px",
40808
+ fontSize: 11.5,
40809
+ lineHeight: "18px",
40810
+ whiteSpace: "nowrap",
40811
+ cursor: "pointer"
40812
+ };
40813
+ const bodyStyle = {
40814
+ flex: 1,
40815
+ minHeight: 0,
40816
+ overflow: "auto",
40817
+ overscrollBehavior: "contain",
40818
+ padding: "0 4px 16px"
40819
+ };
40820
+ const sectionTitleStyle = {
40821
+ fontSize: 12.5,
40822
+ fontWeight: 700,
40823
+ color: ACCENT,
40824
+ margin: "2px 0 4px"
40825
+ };
40826
+ const sectionDescStyle = {
40827
+ margin: "0 0 10px",
40828
+ fontSize: 11.5,
40829
+ opacity: .78
40830
+ };
40831
+ const exampleStyle = {
40832
+ marginBottom: 9,
40833
+ padding: "7px 8px",
40834
+ borderRadius: 6,
40835
+ border: "1px solid rgba(127,127,127,0.18)",
40836
+ background: "rgba(127,127,127,0.06)"
40837
+ };
40838
+ const exampleHeadStyle = {
40839
+ display: "flex",
40840
+ alignItems: "center",
40841
+ gap: 8,
40842
+ marginBottom: 5
40843
+ };
40844
+ const exampleLabelStyle = {
40845
+ flex: 1,
40846
+ minWidth: 0,
40847
+ fontSize: 12,
40848
+ fontWeight: 600
40849
+ };
40850
+ const copyButtonStyle = {
40851
+ padding: "0 7px",
40852
+ fontSize: 11,
40853
+ lineHeight: "18px",
40854
+ borderRadius: 5,
40855
+ cursor: "pointer",
40856
+ whiteSpace: "nowrap"
40857
+ };
40858
+ const hintStyle$3 = {
40859
+ fontSize: 11,
40860
+ opacity: .62,
40861
+ marginBottom: 5
40862
+ };
40863
+ const promptStyle = {
40864
+ fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
40865
+ fontSize: 11.5,
40866
+ lineHeight: 1.6,
40867
+ background: "rgba(127,127,127,0.10)",
40868
+ border: "1px solid rgba(127,127,127,0.22)",
40869
+ borderRadius: 6,
40870
+ padding: "6px 8px",
40871
+ whiteSpace: "pre-wrap",
40872
+ wordBreak: "break-word",
40873
+ color: "CanvasText",
40874
+ userSelect: "text"
40875
+ };
40876
+ const footnoteStyle = {
40877
+ margin: "10px 0 0",
40878
+ padding: "7px 8px",
40879
+ fontSize: 11,
40880
+ lineHeight: 1.6,
40881
+ opacity: .72,
40882
+ borderLeft: `2px solid ${ACCENT}`,
40883
+ background: "rgba(80,140,255,0.06)",
40884
+ borderRadius: "0 4px 4px 0"
40885
+ };
40886
+ const resizeHandleStyle = {
40887
+ position: "absolute",
40888
+ right: 2,
40889
+ bottom: 2,
40890
+ display: "flex",
40891
+ alignItems: "center",
40892
+ justifyContent: "center",
40893
+ width: 16,
40894
+ height: 16,
40895
+ color: "rgba(127,127,127,0.7)",
40896
+ cursor: "nwse-resize",
40897
+ touchAction: "none",
40898
+ userSelect: "none"
40899
+ };
40900
+ //#endregion
40229
40901
  //#region src/client/readState.tsx
40230
40902
  /** 已读条目标题的淡化程度:留一点提示,又不至于看成禁用态。 */
40231
40903
  const READ_TITLE_OPACITY = .75;
@@ -40462,15 +41134,22 @@ const itemMetaYearStyle = {
40462
41134
  flex: "0 0 auto",
40463
41135
  opacity: .85
40464
41136
  };
40465
- /** 第二行末尾的附件数:纸夹 + 数字,固定宽度不参与作者截断。 */
40466
- const itemMetaAttachStyle = {
41137
+ /** 第二行末尾的子项统计:一组「类型图标 + 数字」,靠右且不参与作者截断。 */
41138
+ const itemMetaChildKindsStyle = {
40467
41139
  display: "inline-flex",
40468
41140
  alignItems: "center",
40469
- gap: 2,
41141
+ gap: 6,
40470
41142
  flex: "0 0 auto",
40471
41143
  marginLeft: "auto",
40472
41144
  opacity: .85
40473
41145
  };
41146
+ /** 单种类型的「图标 + 个数」。 */
41147
+ const itemMetaChildKindStyle = {
41148
+ display: "inline-flex",
41149
+ alignItems: "center",
41150
+ gap: 2,
41151
+ flex: "0 0 auto"
41152
+ };
40474
41153
  const itemMetaTextStyle = {
40475
41154
  flex: "1 1 auto",
40476
41155
  minWidth: 0,
@@ -40563,6 +41242,14 @@ const sortButtonStyle = {
40563
41242
  };
40564
41243
  /** 排序生效时的图标颜色(与列表选中态同一支蓝)。 */
40565
41244
  const SORT_ACTIVE_COLOR = "#508cff";
41245
+ /** 副标题统计的固定顺序:先看得到 PDF / 快照,再看笔记与其余文件。 */
41246
+ const CHILD_KIND_ORDER = [
41247
+ "pdf",
41248
+ "snapshot",
41249
+ "webpage",
41250
+ "note",
41251
+ "file"
41252
+ ];
40566
41253
  /**
40567
41254
  * 排序图标:三条长短不一的横线 + 右侧方向箭头。
40568
41255
  *
@@ -40607,22 +41294,6 @@ function DisclosureIcon({ open }) {
40607
41294
  })
40608
41295
  });
40609
41296
  }
40610
- /** 第二行附件数前的纸夹。 */
40611
- function PaperclipIcon() {
40612
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
40613
- width: 10,
40614
- height: 10,
40615
- viewBox: "0 0 16 16",
40616
- fill: "none",
40617
- stroke: "currentColor",
40618
- strokeWidth: 1.4,
40619
- strokeLinecap: "round",
40620
- strokeLinejoin: "round",
40621
- "aria-hidden": true,
40622
- focusable: "false",
40623
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M10.4 4.2 6 8.6a1.8 1.8 0 0 0 2.5 2.5l4.4-4.4a3 3 0 0 0-4.2-4.2L4.3 6.9a4.2 4.2 0 0 0 5.9 5.9l1.1-1.1" })
40624
- });
40625
- }
40626
41297
  /** 排序按钮的提示文案随状态变,点了知道下一步会变成什么。 */
40627
41298
  function sortHint(t, sort) {
40628
41299
  if (sort === "asc") return t("list.sortAsc");
@@ -40656,8 +41327,12 @@ function ItemRow({ t, item, selected, onSelect, onOpen, onInsert }) {
40656
41327
  const [expanded, setExpanded] = (0, react.useState)(false);
40657
41328
  const read = isRead(item);
40658
41329
  const typeLabel = itemTypeLabel(t, item.itemType);
40659
- const attachments = item.attachments;
40660
- const hasAttachments = attachments.length > 0;
41330
+ const children = item.attachments;
41331
+ const hasChildren = children.length > 0;
41332
+ const kindCounts = /* @__PURE__ */ new Map();
41333
+ for (const child of children) kindCounts.set(child.kind, (kindCounts.get(child.kind) ?? 0) + 1);
41334
+ const shownKinds = CHILD_KIND_ORDER.filter((kind) => kindCounts.has(kind));
41335
+ const countTitle = shownKinds.map((kind) => `${childKindLabel(t, kind)} ${kindCounts.get(kind)}`).join(" · ");
40661
41336
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
40662
41337
  className: "dsh-zotero-item-shell",
40663
41338
  style: selected ? {
@@ -40688,7 +41363,7 @@ function ItemRow({ t, item, selected, onSelect, onOpen, onInsert }) {
40688
41363
  },
40689
41364
  style: itemRowStyle,
40690
41365
  children: [
40691
- hasAttachments ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
41366
+ hasChildren ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
40692
41367
  type: "button",
40693
41368
  className: "dsh-zotero-disclosure",
40694
41369
  "aria-expanded": expanded,
@@ -40707,7 +41382,11 @@ function ItemRow({ t, item, selected, onSelect, onOpen, onInsert }) {
40707
41382
  }),
40708
41383
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
40709
41384
  style: itemIconStyle,
40710
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ItemTypeIcon, {
41385
+ children: item.itemType === "attachment" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChildKindIcon, {
41386
+ kind: item.kind,
41387
+ read,
41388
+ size: 22
41389
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ItemTypeIcon, {
40711
41390
  itemType: item.itemType,
40712
41391
  read
40713
41392
  })
@@ -40720,7 +41399,7 @@ function ItemRow({ t, item, selected, onSelect, onOpen, onInsert }) {
40720
41399
  ...readTitleStyle(read)
40721
41400
  },
40722
41401
  children: item.title
40723
- }), (typeLabel !== "" || item.year !== "" || item.creators !== "" || hasAttachments) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
41402
+ }), (typeLabel !== "" || item.year !== "" || item.creators !== "" || hasChildren) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
40724
41403
  style: itemMetaStyle,
40725
41404
  children: [
40726
41405
  typeLabel !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -40735,34 +41414,41 @@ function ItemRow({ t, item, selected, onSelect, onOpen, onInsert }) {
40735
41414
  style: itemMetaTextStyle,
40736
41415
  children: item.creators
40737
41416
  }),
40738
- hasAttachments && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
40739
- style: itemMetaAttachStyle,
40740
- title: tpl(t("list.attachmentCount"), { n: attachments.length }),
40741
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaperclipIcon, {}), attachments.length]
41417
+ hasChildren && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
41418
+ style: itemMetaChildKindsStyle,
41419
+ title: countTitle,
41420
+ children: shownKinds.map((kind) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
41421
+ style: itemMetaChildKindStyle,
41422
+ title: childKindLabel(t, kind),
41423
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChildKindIcon, {
41424
+ kind,
41425
+ size: 12
41426
+ }), kindCounts.get(kind)]
41427
+ }, kind))
40742
41428
  })
40743
41429
  ]
40744
41430
  })]
40745
41431
  })
40746
41432
  ]
40747
41433
  })
40748
- }), expanded && hasAttachments && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
41434
+ }), expanded && hasChildren && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
40749
41435
  style: childListStyle,
40750
- children: attachments.map((attachment) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
41436
+ children: children.map((child) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
40751
41437
  className: "dsh-zotero-child-row",
40752
- title: `${attachment.title}\n${t("list.openAttachment")}`,
40753
- onClick: () => onOpen(attachment.key, attachment.title),
41438
+ title: `${child.title}\n${t("list.openAttachment")}`,
41439
+ onClick: () => onOpen(child.key, child.title),
40754
41440
  style: childRowStyle,
40755
41441
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
40756
41442
  style: childIconStyle,
40757
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ItemTypeIcon, {
40758
- itemType: "attachment",
41443
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChildKindIcon, {
41444
+ kind: child.kind,
40759
41445
  size: 15
40760
41446
  })
40761
41447
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
40762
41448
  style: childTitleStyle,
40763
- children: attachment.title
41449
+ children: child.title
40764
41450
  })]
40765
- }, attachment.key))
41451
+ }, child.key))
40766
41452
  })]
40767
41453
  });
40768
41454
  }
@@ -41372,6 +42058,9 @@ function ZoteroPane({ t, inputActions, sessions, sessionId, onOpenItem }) {
41372
42058
  const [splitHover, setSplitHover] = (0, react.useState)(false);
41373
42059
  const bodyRef = (0, react.useRef)(null);
41374
42060
  const dragRef = (0, react.useRef)(null);
42061
+ /** 「使用帮助」浮窗的开合;包裹触发按钮的 span 作为 useDismiss 的 extraRef。 */
42062
+ const [helpOpen, setHelpOpen] = (0, react.useState)(false);
42063
+ const helpTriggerRef = (0, react.useRef)(null);
41375
42064
  /** 左栏宽度夹在 [TREE_WIDTH_MIN, 容器宽 - DETAIL_WIDTH_MIN] 之间。 */
41376
42065
  function clampTreeWidth(next) {
41377
42066
  const total = bodyRef.current?.clientWidth ?? 0;
@@ -41429,6 +42118,30 @@ function ZoteroPane({ t, inputActions, sessions, sessionId, onOpenItem }) {
41429
42118
  label: t(health?.mcp.running === true ? "status.mcpOn" : "status.mcpOff")
41430
42119
  }),
41431
42120
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: { flex: 1 } }),
42121
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
42122
+ ref: helpTriggerRef,
42123
+ style: {
42124
+ display: "inline-flex",
42125
+ flexShrink: 0
42126
+ },
42127
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Button, {
42128
+ variant: "primary",
42129
+ size: "sm",
42130
+ className: HELP_BUTTON_CLASS,
42131
+ style: HELP_PRIMARY_STYLE,
42132
+ title: t("help.buttonTitle"),
42133
+ "aria-expanded": helpOpen,
42134
+ onClick: () => setHelpOpen((open) => !open),
42135
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
42136
+ "aria-hidden": "true",
42137
+ style: {
42138
+ fontWeight: 700,
42139
+ marginRight: 4
42140
+ },
42141
+ children: "?"
42142
+ }), t("help.button")]
42143
+ })
42144
+ }),
41432
42145
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
41433
42146
  variant: "ghost",
41434
42147
  size: "sm",
@@ -41586,6 +42299,13 @@ function ZoteroPane({ t, inputActions, sessions, sessionId, onOpenItem }) {
41586
42299
  })
41587
42300
  ]
41588
42301
  }),
42302
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HelpWindow, {
42303
+ t,
42304
+ open: helpOpen,
42305
+ anchorRef: bodyRef,
42306
+ triggerRef: helpTriggerRef,
42307
+ onClose: () => setHelpOpen(false)
42308
+ }),
41589
42309
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Toast, {})
41590
42310
  ]
41591
42311
  });