dsh-tiddlywiki 0.16.21 → 0.16.23

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/lib/index.js CHANGED
@@ -2568,6 +2568,11 @@ function registerAdminRoutes(ctx, deps) {
2568
2568
  const DOC_NOTE_TITLE = "dsh-tiddlywiki 插件说明";
2569
2569
  /** Tag that makes the note easy to find via `tiddlywiki_search tag=docs`. */
2570
2570
  const DOC_NOTE_TAG = "docs";
2571
+ /**
2572
+ * Shared tag that collects every plugin-seeded doc into the seeded home's
2573
+ *「📚 插件文档」tabs strip (see seed-starter-docs.ts DSH_DOCS_TAG).
2574
+ */
2575
+ const DOC_NOTE_DSH_DOCS_TAG = "dsh-docs";
2571
2576
  /** One-time marker: its presence means "the note was offered once — hands off". */
2572
2577
  const SEED_MARKER_TITLE = "$:/plugins/dsh-tiddlywiki/seed-doc-note";
2573
2578
  /** The note body, TiddlyWiki wiki-text. */
@@ -2599,6 +2604,7 @@ const DOC_NOTE_TEXT = `! dsh-tiddlywiki 插件说明
2599
2604
  !! 说明
2600
2605
 
2601
2606
  * 本笔记由插件在**首次启动**时自动写入(一次性:只写一次)。删除后重启 dsh web **不会自动恢复**——它从此归你所有。
2607
+ * 本笔记带 \`dsh-docs\` 标签,会出现在首页「📚 插件文档」栏(与「示例与文档」seed 的教程/模板一起),不需要可自由删除。
2602
2608
  * 更多细节见插件仓库 README。`;
2603
2609
  /**
2604
2610
  * Seed the doc note once per wiki (mirrors the one-shot policy). A marker
@@ -2621,7 +2627,7 @@ async function seedDocNote(client, opts) {
2621
2627
  title: DOC_NOTE_TITLE,
2622
2628
  text: DOC_NOTE_TEXT,
2623
2629
  type: "text/vnd.tiddlywiki",
2624
- tags: [DOC_NOTE_TAG]
2630
+ tags: [DOC_NOTE_TAG, DOC_NOTE_DSH_DOCS_TAG]
2625
2631
  });
2626
2632
  wrote = true;
2627
2633
  }
@@ -2647,6 +2653,243 @@ async function unseedDocNote(client) {
2647
2653
  return { removed };
2648
2654
  }
2649
2655
  //#endregion
2656
+ //#region src/host/seed-starter-docs.ts
2657
+ /** One-time marker: presence means "the docs were offered once — hands off". */
2658
+ const STARTER_DOCS_MARKER_TITLE = "$:/plugins/dsh-tiddlywiki/seed-starter-docs";
2659
+ /** Shared tag that collects every plugin-seeded doc into the home docs tab. */
2660
+ const DSH_DOCS_TAG = "dsh-docs";
2661
+ /** The docs, exactly as seeded (user-owned afterwards, freely deletable). */
2662
+ const STARTER_DOCS_ITEMS = [
2663
+ {
2664
+ title: "主题汇总页·模板",
2665
+ tags: ["索引", "dsh-docs"],
2666
+ type: "text/vnd.tiddlywiki",
2667
+ text: `\\whitespace trim
2668
+
2669
+ !! 📌 主题汇总页
2670
+
2671
+ <div style="color:#888; font-size:0.85em; border:1px dashed rgba(128,128,128,0.35); border-radius:8px; padding:6px 10px; margin-bottom:8px;">【模板】复制本页 → 改名(如「XX主题汇总」)→ 把下面两处 <code>主题A</code> 替换成你的标签名 → 保存。给笔记打上该标签即自动收录,本页无需维护。</div>
2672
+
2673
+ <div class="tc-message-box">自动收集带 <code>主题A</code> 标签的笔记,按最近修改排序,共 <strong>{{{[tag[主题A]!is[system]!has[draft.of]count[]]}}}</strong> 篇。</div>
2674
+
2675
+ <<list-links "[tag[主题A]!is[system]!has[draft.of]] +[!sort[modified]]">>
2676
+
2677
+ ---
2678
+
2679
+ ### 可选:自定义样式的 <$list> 版(想更花哨时用它替换上面的 list-links)
2680
+
2681
+ <ul>
2682
+ <$list filter="[tag[主题A]!is[system]!has[draft.of]] +[!sort[modified]]">
2683
+ <li><$link to=<<currentTiddler>>><$view field="title"/></$link><span style="color:#aaa; font-size:0.85em;"> · <$view field="modified" format="relativedate"/></span></li>
2684
+ </$list>
2685
+ </ul>
2686
+
2687
+ ### 可选:把本页收进「一页多主题」tabs
2688
+
2689
+ 给本页打上 <code>主题页</code> 标签、并加一个 <code>caption</code> 字段(按钮文字),然后在总览页写:<code>&lt;&lt;tabs "[tag[主题页]!is[system]]"&gt;&gt;</code>。详见 [[教程:按主题/标签做汇总页]]。
2690
+ `
2691
+ },
2692
+ {
2693
+ title: "教程:按主题/标签做汇总页",
2694
+ tags: ["教程", "dsh-docs"],
2695
+ type: "text/markdown",
2696
+ text: `# 教程:按主题/标签做汇总页
2697
+
2698
+ > 适用:本 wiki 的 TiddlyWiki 5.3.x 内核。⚠️ 网上大量教程是 5.1/5.2 时代写的,其中 \`<<tabs "筛选器" "标签">>\` 和 \`<<count "筛选器">>\` 两种写法在本版本已**改版/移除**,照抄会报错,注意甄别。
2699
+
2700
+ ## 核心思路(一句话)
2701
+
2702
+ 「汇总页」不是 TW 的特殊功能,而是:**一个普通笔记 + 正文里一段筛选器(filter)**。渲染时 TW 实时从整个 wiki 挑出符合条件的笔记列出来。**新笔记只要打上对应标签,汇总页自动出现,零维护**——不用像手工目录那样每次手动更新。
2703
+
2704
+ ## 方法一:零代码,直接用内置标签页
2705
+
2706
+ - 打开任意笔记,点正文底部的**标签链接**;
2707
+ - 或侧边栏「标签」(标签云)里点某个标签。
2708
+ - TW 会自动生成该标签的页面,列出所有带此标签的笔记。
2709
+ - 优点:一行代码都不用写;缺点:不能加说明文字、不能自定义排序/样式,也做不了「多主题合一」。
2710
+
2711
+ ## 方法二:一页一主题(最常用)
2712
+
2713
+ 新建一个笔记(wikitext),正文写:
2714
+
2715
+ \`\`\`wikitext
2716
+ !! 📔 日志主题汇总
2717
+ <div class="tc-message-box">自动收集带 <code>日志</code> 标签的笔记,共 <strong>{{{[tag[日志]!is[system]!has[draft.of]count[]]}}}</strong> 篇,按最近修改排序。</div>
2718
+
2719
+ <<list-links "[tag[日志]!is[system]!has[draft.of]] +[!sort[modified]]">>
2720
+ \`\`\`
2721
+
2722
+ 各片段含义:
2723
+
2724
+ - \`[tag[日志]]\`:挑出所有带「日志」标签的笔记;
2725
+ - \`!is[system]\`:排除 \`$:/\` 系统页;
2726
+ - \`!has[draft.of]\`:排除未保存的草稿副本;
2727
+ - \`+[!sort[modified]]\`:按修改时间**倒序**(\`sort[modified]\` 为正序);
2728
+ - \`{{{[...count[]]}}}\`:筛选器计数(旧版 \`<<count>>\` 宏已移除,这是 5.3 新写法)。
2729
+
2730
+ 想自定义每行样式(带相对时间、复选框等),用你更熟悉的 \`<$list>\` 写法:
2731
+
2732
+ \`\`\`wikitext
2733
+ <ul>
2734
+ <$list filter="[tag[日志]!is[system]!has[draft.of]] +[!sort[modified]]">
2735
+ <li><$link to=<<currentTiddler>>><$view field="title"/></$link><span style="color:#aaa; font-size:0.85em;"> · <$view field="modified" format="relativedate"/></span></li>
2736
+ </$list>
2737
+ </ul>
2738
+ \`\`\`
2739
+
2740
+ ## 方法三:一页多主题(Dashboard,5.3 新版 tabs)
2741
+
2742
+ 5.3 的 \`tabs\` 宏签名:\`<<tabs "选中标签页的筛选器" "默认选中项">>\`。思路分两步:
2743
+
2744
+ 1. **每个主题各建一个汇总页**(就是方法二那种),全部打上同一个标签(本插件 seed 的示例用 \`主题页\`);要自定义按钮文字,就给该页加一个 \`caption\` 字段(如 \`📔 日志\`)。
2745
+ 2. **建一个总览页**,正文只写一行:
2746
+
2747
+ \`\`\`wikitext
2748
+ <<tabs "[tag[主题页]!is[system]]" "主题页·日志">>
2749
+ \`\`\`
2750
+
2751
+ 效果:页面上方一排按钮,点哪个就内嵌显示哪个主题的汇总。第二个参数是默认展开的页(可省略,省略则初始不展开)。
2752
+
2753
+ > 老教程的 \`<<tabs "筛选器A" "标签A" "筛选器B" "标签B">>\` 在 5.3 已失效,别用。
2754
+
2755
+ 本插件已 seed 了可直接运行的示例:[主题页·日志]、[主题页·决策记录]、[主题页·排障](都带 \`主题页\` 标签),复制改造即可。
2756
+
2757
+ ## 筛选器速查表(背熟这几行就够用)
2758
+
2759
+ | 想要 | 写法 |
2760
+ | --- | --- |
2761
+ | 某标签下的笔记 | \`[tag[主题]]\` |
2762
+ | 排除系统页 / 草稿 | \`[tag[主题]!is[system]!has[draft.of]]\` |
2763
+ | 修改时间倒序 / 正序 | \`+[!sort[modified]]\` / \`+[sort[modified]]\` |
2764
+ | 按标题排序 | \`+[sort[title]]\` |
2765
+ | 交集(同时有两个标签) | \`[tag[A]+tag[B]]\` |
2766
+ | 并集(有任一标签) | \`[tag[A]] [tag[B]]\` |
2767
+ | 差集(有 A 无 B) | \`[tag[A]-tag[B]]\` |
2768
+ | 排除某标签 | \`-[tag[排除项]]\` |
2769
+ | 限定时间段 | \`[tag[主题]modified[2026-09]]\` |
2770
+ | 计数 | \`{{{[tag[主题]!is[system]count[]]}}}\`(或 \`<$count filter="[tag[主题]]"/>\`) |
2771
+ | 整个 wiki 的非系统非草稿 | \`all[tiddlers]!is[system]!has[draft.of]\` |
2772
+
2773
+ ## 进阶玩法
2774
+
2775
+ 1. **按字段筛选**:\`[tag[todo]get[due]compare:date:lt<today>]\` 可列出「到期日早于今天」的笔记(主页的逾期看板就是这么写的)。
2776
+ 2. **树状目录**:\`<<toc tag:"主题">>\` 显示层级目录,适合一个主题下还有子主题的情况。
2777
+ 3. **模板复用**:复制 [主题汇总页·模板] 改标题和标签即可,不用每次重写。
2778
+ 4. **打开直达**:把 \`$:/DefaultTiddlers\` 改成 \`[[主题页·日志]]\`,启动即打开汇总页(当前默认是 [🏠 主页])。
2779
+ 5. **导航收录**:给汇总页打 \`索引\` 标签,它就会从「全部笔记 / 所有文章」里消失、只作为导航页存在;再在 [🏠 主页] 的按钮区加一个入口按钮即可。
2780
+ 6. **标签整理**:控制台 → 工具 → 标签管理器,可重命名/合并标签,改名后所有笔记自动跟随,汇总页筛选器无需改动(筛选器按标签名匹配,自动跟随改名)。
2781
+
2782
+ ## 配套产物清单(插件 seed 提供了什么)
2783
+
2784
+ - [主题页·日志]、[主题页·决策记录]、[主题页·排障] —— 单主题汇总页实例(各自可独立打开,也可作为「一页多主题」tabs 的标签页)
2785
+ - [主题汇总页·模板] —— 空白模板,复制即用
2786
+ - 本教程 —— 就是这一页
2787
+
2788
+ 以上都来自「示例与文档」seed(tag \`dsh-docs\`),不需要可自由删除,删除后不会自动恢复。
2789
+ `
2790
+ },
2791
+ {
2792
+ title: "主题页·日志",
2793
+ tags: [
2794
+ "主题页",
2795
+ "索引",
2796
+ "dsh-docs"
2797
+ ],
2798
+ type: "text/vnd.tiddlywiki",
2799
+ text: `\\whitespace trim
2800
+
2801
+ !! 📔 日志主题汇总
2802
+
2803
+ <div class="tc-message-box">自动收集带 <code>日志</code> 标签的笔记,按最近修改排序,共 <strong>{{{[tag[日志]!is[system]!has[draft.of]count[]]}}}</strong> 篇。给笔记打上「日志」标签即自动收录,本页无需维护(做法见 [[教程:按主题/标签做汇总页]])。</div>
2804
+
2805
+ <<list-links "[tag[日志]!is[system]!has[draft.of]] +[!sort[modified]]">>
2806
+ `
2807
+ },
2808
+ {
2809
+ title: "主题页·决策记录",
2810
+ tags: [
2811
+ "主题页",
2812
+ "索引",
2813
+ "dsh-docs"
2814
+ ],
2815
+ type: "text/vnd.tiddlywiki",
2816
+ text: `\\whitespace trim
2817
+
2818
+ !! 📌 决策记录主题汇总
2819
+
2820
+ <div class="tc-message-box">自动收集带 <code>决策记录</code> 标签的笔记,按最近修改排序,共 <strong>{{{[tag[决策记录]!is[system]!has[draft.of]count[]]}}}</strong> 篇。给笔记打上「决策记录」标签即自动收录,本页无需维护(做法见 [[教程:按主题/标签做汇总页]])。</div>
2821
+
2822
+ <<list-links "[tag[决策记录]!is[system]!has[draft.of]] +[!sort[modified]]">>
2823
+ `
2824
+ },
2825
+ {
2826
+ title: "主题页·排障",
2827
+ tags: [
2828
+ "主题页",
2829
+ "索引",
2830
+ "dsh-docs"
2831
+ ],
2832
+ type: "text/vnd.tiddlywiki",
2833
+ text: `\\whitespace trim
2834
+
2835
+ !! 🔧 排障主题汇总
2836
+
2837
+ <div class="tc-message-box">自动收集带 <code>troubleshooting</code> 标签的笔记,按最近修改排序,共 <strong>{{{[tag[troubleshooting]!is[system]!has[draft.of]count[]]}}}</strong> 篇。给笔记打上「troubleshooting」标签即自动收录,本页无需维护(做法见 [[教程:按主题/标签做汇总页]])。</div>
2838
+
2839
+ <<list-links "[tag[troubleshooting]!is[system]!has[draft.of]] +[!sort[modified]]">>
2840
+ `
2841
+ }
2842
+ ];
2843
+ /**
2844
+ * Seed the starter docs once per wiki (safe-skip: same-named tiddlers already
2845
+ * present are NEVER overwritten — user data stays user data). Marker-gated
2846
+ * ONE-SHOT; with `opts.force` the tiddlers are (re)written and the marker
2847
+ * (re)recorded — the settings page uses this for "重新初始化".
2848
+ * Returns whether anything was written this call. Never throws.
2849
+ */
2850
+ async function seedStarterDocs(client, opts) {
2851
+ const force = opts?.force === true;
2852
+ if (!force) {
2853
+ if (await client.get("$:/plugins/dsh-tiddlywiki/seed-starter-docs").catch(() => void 0) !== void 0) return false;
2854
+ }
2855
+ let wrote = false;
2856
+ for (const item of STARTER_DOCS_ITEMS) {
2857
+ const existing = await client.get(item.title).catch(() => void 0);
2858
+ if (force || existing === void 0) {
2859
+ await client.put({
2860
+ title: item.title,
2861
+ text: item.text,
2862
+ type: item.type,
2863
+ tags: item.tags
2864
+ });
2865
+ wrote = true;
2866
+ }
2867
+ }
2868
+ await client.put({
2869
+ title: STARTER_DOCS_MARKER_TITLE,
2870
+ text: "seeded-once",
2871
+ type: "text/plain",
2872
+ tags: []
2873
+ }).catch(() => void 0);
2874
+ return wrote;
2875
+ }
2876
+ /**
2877
+ * Un-seed (反初始化): remove the starter docs and their marker. Deletion is
2878
+ * idempotent — a tiddler already gone is not listed. Never throws.
2879
+ */
2880
+ async function unseedStarterDocs(client) {
2881
+ const removed = [];
2882
+ for (const item of STARTER_DOCS_ITEMS) if (await client.get(item.title).catch(() => void 0) !== void 0) {
2883
+ await client.delete(item.title);
2884
+ removed.push(item.title);
2885
+ }
2886
+ if (await client.get("$:/plugins/dsh-tiddlywiki/seed-starter-docs").catch(() => void 0) !== void 0) {
2887
+ await client.delete(STARTER_DOCS_MARKER_TITLE);
2888
+ removed.push(STARTER_DOCS_MARKER_TITLE);
2889
+ }
2890
+ return { removed };
2891
+ }
2892
+ //#endregion
2650
2893
  //#region src/host/seed-send-to-agent.ts
2651
2894
  /** The packaged plugin tiddler title (a TW system tiddler, type application/json). */
2652
2895
  const SEND_TO_AGENT_PLUGIN_TITLE = "$:/plugins/dsh/send-to-agent";
@@ -2704,13 +2947,13 @@ const HOME_INDEX_ITEMS = [
2704
2947
  "title": "🏠 主页",
2705
2948
  "tags": ["索引", "TableOfContents"],
2706
2949
  "type": "text/vnd.tiddlywiki",
2707
- "text": "\\whitespace trim\n\n\\define quadrant-board()\n<div style=\"display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:8px;\">\n<div style=\"border:1px solid rgba(128,128,128,0.22); border-radius:10px; padding:8px 12px; background:linear-gradient(135deg,#e74c3c1a,transparent);\">\n<div style=\"font-weight:700; margin-bottom:6px;\">🔴 重要 · 紧急 <span style=\"color:#888; font-weight:400; font-size:0.82em;\">{{{[tag[todo]!tag[done]field:q[q1]count[]]}}} 件</span></div>\n<$list filter=\"[tag[todo]!tag[done]field:q[q1]sort[modified]]\">\n<div style=\"display:flex; gap:6px; align-items:baseline; padding:3px 0; border-bottom:1px dashed rgba(128,128,128,0.15);\">\n<$checkbox tiddler=<<currentTiddler>> tag=\"done\"/>\n<$link to=<<currentTiddler>> style=\"flex:1;\"><$view field=\"title\"/></$link>\n<$list filter=\"[<currentTiddler>get[due]compare:date:lt<today>]\"><span style=\"color:#c0392b; font-size:0.78em;\">逾期</span></$list>\n<$list filter=\"[<currentTiddler>get[due]!is[blank]]\"><span style=\"color:#888; font-size:0.8em;\"><$view field=\"due\" format=\"date\" template=\"MM-DD\"/></span></$list>\n</div>\n</$list>\n<$list filter=\"[tag[todo]!tag[done]field:q[q1]!count[]]\"><div style=\"color:#aaa; font-size:0.85em;\">(暂无)</div></$list>\n</div>\n<div style=\"border:1px solid rgba(128,128,128,0.22); border-radius:10px; padding:8px 12px; background:linear-gradient(135deg,#3498db1a,transparent);\">\n<div style=\"font-weight:700; margin-bottom:6px;\">🔵 重要 · 不紧急 <span style=\"color:#888; font-weight:400; font-size:0.82em;\">{{{[tag[todo]!tag[done]field:q[q2]count[]]}}} 件</span></div>\n<$list filter=\"[tag[todo]!tag[done]field:q[q2]sort[modified]]\">\n<div style=\"display:flex; gap:6px; align-items:baseline; padding:3px 0; border-bottom:1px dashed rgba(128,128,128,0.15);\">\n<$checkbox tiddler=<<currentTiddler>> tag=\"done\"/>\n<$link to=<<currentTiddler>> style=\"flex:1;\"><$view field=\"title\"/></$link>\n<$list filter=\"[<currentTiddler>get[due]compare:date:lt<today>]\"><span style=\"color:#c0392b; font-size:0.78em;\">逾期</span></$list>\n<$list filter=\"[<currentTiddler>get[due]!is[blank]]\"><span style=\"color:#888; font-size:0.8em;\"><$view field=\"due\" format=\"date\" template=\"MM-DD\"/></span></$list>\n</div>\n</$list>\n<$list filter=\"[tag[todo]!tag[done]field:q[q2]!count[]]\"><div style=\"color:#aaa; font-size:0.85em;\">(暂无)</div></$list>\n</div>\n<div style=\"border:1px solid rgba(128,128,128,0.22); border-radius:10px; padding:8px 12px; background:linear-gradient(135deg,#f39c121a,transparent);\">\n<div style=\"font-weight:700; margin-bottom:6px;\">🟠 紧急 · 不重要 <span style=\"color:#888; font-weight:400; font-size:0.82em;\">{{{[tag[todo]!tag[done]field:q[q3]count[]]}}} 件</span></div>\n<$list filter=\"[tag[todo]!tag[done]field:q[q3]sort[modified]]\">\n<div style=\"display:flex; gap:6px; align-items:baseline; padding:3px 0; border-bottom:1px dashed rgba(128,128,128,0.15);\">\n<$checkbox tiddler=<<currentTiddler>> tag=\"done\"/>\n<$link to=<<currentTiddler>> style=\"flex:1;\"><$view field=\"title\"/></$link>\n<$list filter=\"[<currentTiddler>get[due]compare:date:lt<today>]\"><span style=\"color:#c0392b; font-size:0.78em;\">逾期</span></$list>\n<$list filter=\"[<currentTiddler>get[due]!is[blank]]\"><span style=\"color:#888; font-size:0.8em;\"><$view field=\"due\" format=\"date\" template=\"MM-DD\"/></span></$list>\n</div>\n</$list>\n<$list filter=\"[tag[todo]!tag[done]field:q[q3]!count[]]\"><div style=\"color:#aaa; font-size:0.85em;\">(暂无)</div></$list>\n</div>\n<div style=\"border:1px solid rgba(128,128,128,0.22); border-radius:10px; padding:8px 12px; background:linear-gradient(135deg,#95a5a61a,transparent);\">\n<div style=\"font-weight:700; margin-bottom:6px;\">⚪ 不重要 · 不紧急 <span style=\"color:#888; font-weight:400; font-size:0.82em;\">{{{[tag[todo]!tag[done]field:q[q4]count[]]}}} 件</span></div>\n<$list filter=\"[tag[todo]!tag[done]field:q[q4]sort[modified]]\">\n<div style=\"display:flex; gap:6px; align-items:baseline; padding:3px 0; border-bottom:1px dashed rgba(128,128,128,0.15);\">\n<$checkbox tiddler=<<currentTiddler>> tag=\"done\"/>\n<$link to=<<currentTiddler>> style=\"flex:1;\"><$view field=\"title\"/></$link>\n<$list filter=\"[<currentTiddler>get[due]compare:date:lt<today>]\"><span style=\"color:#c0392b; font-size:0.78em;\">逾期</span></$list>\n<$list filter=\"[<currentTiddler>get[due]!is[blank]]\"><span style=\"color:#888; font-size:0.8em;\"><$view field=\"due\" format=\"date\" template=\"MM-DD\"/></span></$list>\n</div>\n</$list>\n<$list filter=\"[tag[todo]!tag[done]field:q[q4]!count[]]\"><div style=\"color:#aaa; font-size:0.85em;\">(暂无)</div></$list>\n</div>\n</div>\n\\end\n\n<$set name=\"today\" value=<<now \"YYYY0MM0DD\">>>\n\n!! 🏠 主页\n\n<div class=\"tc-message-box\">待办看板与知识库入口。</div>\n\n<div style=\"display:flex; gap:8px; flex-wrap:wrap; margin:8px 0;\">\n<$button class=\"tc-btn-invisible tc-tiddlylink\" style=\"padding:6px 16px; border:1px solid rgba(128,128,128,0.35); border-radius:8px; font-weight:600;\">\n<$action-navigate $to=\"所有标签\"/>\n🏷 所有标签\n</$button>\n<$button class=\"tc-btn-invisible tc-tiddlylink\" style=\"padding:6px 16px; border:1px solid rgba(128,128,128,0.35); border-radius:8px; font-weight:600;\">\n<$action-navigate $to=\"所有文章\"/>\n📚 所有文章\n</$button>\n<$button class=\"tc-btn-invisible tc-tiddlylink\" style=\"padding:6px 16px; border:1px solid rgba(128,128,128,0.35); border-radius:8px; font-weight:600;\">\n<$action-navigate $to=\"主题汇总·示例\"/>\n🗂 主题汇总\n</$button>\n</div>\n\n!! ✍️ 快速记笔记(完整编辑器)\n\n<div class=\"tc-message-box\">直接在首页写笔记:填标题、用工具栏写正文(支持 Markdown:**加粗**、*斜体*、# 标题、- 列表、> 引用 等)、加标签,点「💾 保存」即创建新笔记(默认 Markdown,标题留空用当前时间)。勾选「同时加入待办」并选象限,可一并进入下方四象限看板。</div>\n\n<div style=\"border:1px solid rgba(128,128,128,0.22); border-radius:10px; padding:10px 12px; margin:10px 0;\">\n\n<div style=\"display:flex; gap:6px; align-items:center; margin-bottom:6px;\">\n<$edit-text tiddler=\"$:/state/home-note/title\" tag=\"input\" placeholder=\"标题(留空用当前时间)\" style=\"flex:1; min-width:200px; padding:6px 10px; border-radius:6px; border:1px solid rgba(128,128,128,0.3);\"/>\n</div>\n\n<$edit-text tiddler=\"$:/state/home-note/text\" tag=\"textarea\" class=\"tc-edit-texteditor\" autoHeight=\"yes\" minHeight=\"150px\" placeholder=\"正文:支持 **加粗**、*斜体*、# 标题、- 列表、> 引用 等 Markdown 语法\" style=\"width:100%; box-sizing:border-box; padding:6px 10px; border-radius:6px; border:1px solid rgba(128,128,128,0.3);\">\n<$button class=\"tc-btn-invisible\" tooltip=\"加粗\" style=\"padding:2px 8px; font-weight:700;\"><$action-sendmessage $message=\"tm-edit-text-operation\" $param=\"wrap-selection\" prefix=\"**\" suffix=\"**\" trimSelection=\"yes\"/>B</$button>\n<$button class=\"tc-btn-invisible\" tooltip=\"斜体\" style=\"padding:2px 8px; font-style:italic;\"><$action-sendmessage $message=\"tm-edit-text-operation\" $param=\"wrap-selection\" prefix=\"*\" suffix=\"*\" trimSelection=\"yes\"/>I</$button>\n<$button class=\"tc-btn-invisible\" tooltip=\"删除线\" style=\"padding:2px 8px;\"><$action-sendmessage $message=\"tm-edit-text-operation\" $param=\"wrap-selection\" prefix=\"~~\" suffix=\"~~\" trimSelection=\"yes\"/>S</$button>\n<$button class=\"tc-btn-invisible\" tooltip=\"标题\" style=\"padding:2px 8px;\"><$action-sendmessage $message=\"tm-edit-text-operation\" $param=\"prefix-lines\" character=\"#\" count=\"1\"/>H</$button>\n<$button class=\"tc-btn-invisible\" tooltip=\"无序列表\" style=\"padding:2px 8px;\"><$action-sendmessage $message=\"tm-edit-text-operation\" $param=\"prefix-lines\" character=\"-\" count=\"1\"/>•</$button>\n<$button class=\"tc-btn-invisible\" tooltip=\"有序列表\" style=\"padding:2px 8px;\"><$action-sendmessage $message=\"tm-edit-text-operation\" $param=\"prefix-lines\" character=\"1.\" count=\"1\"/>1.</$button>\n<$button class=\"tc-btn-invisible\" tooltip=\"引用\" style=\"padding:2px 8px;\"><$action-sendmessage $message=\"tm-edit-text-operation\" $param=\"prefix-lines\" character=\">\" count=\"1\"/>❝</$button>\n<$button class=\"tc-btn-invisible\" tooltip=\"行内代码\" style=\"padding:2px 8px;\"><$action-sendmessage $message=\"tm-edit-text-operation\" $param=\"wrap-selection\" prefix=\"`\" suffix=\"`\" trimSelection=\"yes\"/>&lt;/&gt;</$button>\n</$edit-text>\n\n<div style=\"display:flex; gap:6px; flex-wrap:wrap; align-items:center; margin-top:6px;\">\n<$edit-text tiddler=\"$:/state/home-note/tags\" tag=\"input\" placeholder=\"标签(逗号分隔,可选)\" style=\"flex:1; min-width:160px; padding:6px 10px; border-radius:6px; border:1px solid rgba(128,128,128,0.3);\"/>\n<$checkbox tiddler=\"$:/state/home-note/todo\" field=\"text\" checked=\"yes\" unchecked=\"no\"> 同时加入待办</$checkbox>\n<$select tiddler=\"$:/state/home-note/quadrant\" default=\"q2\" style=\"padding:6px 10px; border-radius:6px; border:1px solid rgba(128,128,128,0.3);\">\n<option value=\"q1\">Q1 重要·紧急</option>\n<option value=\"q2\">Q2 重要·不紧急</option>\n<option value=\"q3\">Q3 紧急·不重要</option>\n<option value=\"q4\">Q4 不重要·不紧急</option>\n</$select>\n</div>\n\n<div style=\"display:flex; gap:6px; align-items:center; margin-top:8px; flex-wrap:wrap;\">\n<$button class=\"tc-btn-invisible\" style=\"padding:6px 16px; border-radius:6px; border:1px solid rgba(128,128,128,0.35); font-weight:600; background:rgba(128,128,128,0.06);\">\n<$list filter=\"[{$:/state/home-note/title}!is[blank]] [{$:/state/home-note/text}!is[blank]]\">\n<$action-createtiddler\n$basetitle={{{ [{$:/state/home-note/title}!is[blank]then{$:/state/home-note/title}] ~[<now \"YYYY-MM-DD-HHmm\">] }}}\ntext={{{ [{$:/state/home-note/text}] }}}\ntags={{{ [{$:/state/home-note/tags}split[,]split[,]trim[]] [{$:/state/home-note/todo}match[yes]then[[todo]]] +[join[ ]] }}}\nq={{{ [{$:/state/home-note/todo}match[yes]then{$:/state/home-note/quadrant}!is[blank]] ~[{$:/state/home-note/todo}match[yes]then[q2]] }}}\ntype=\"text/markdown\"\n$savetitle=\"$:/state/home-note/last-created\"/>\n<$action-setfield $tiddler=\"$:/state/home-note/title\" text=\"\"/>\n<$action-setfield $tiddler=\"$:/state/home-note/text\" text=\"\"/>\n<$action-setfield $tiddler=\"$:/state/home-note/tags\" text=\"\"/>\n</$list>\n💾 保存\n</$button>\n<$button class=\"tc-btn-invisible\" tooltip=\"清空草稿\" style=\"padding:6px 12px; border-radius:6px; border:1px solid rgba(128,128,128,0.3);\">\n<$action-setfield $tiddler=\"$:/state/home-note/title\" text=\"\"/>\n<$action-setfield $tiddler=\"$:/state/home-note/text\" text=\"\"/>\n<$action-setfield $tiddler=\"$:/state/home-note/tags\" text=\"\"/>\n🗑 清空\n</$button>\n<$list filter=\"[{$:/state/home-note/last-created}!is[blank]]\">\n<span style=\"color:#2e7d32; font-size:0.9em;\">✅ 已保存:<$link to={{{ [{$:/state/home-note/last-created}] }}}>{{{$:/state/home-note/last-created}}}</$link></span>\n</$list>\n</div>\n\n</div>\n\n!! ✅ 待办 · 四象限\n\n<div class=\"tc-message-box\">在上方「快速记笔记」勾选「同时加入待办」即建任务(默认 Q2 重要·不紧急);也可以给任意笔记打上 <code>todo</code> 标签收集到下方。点任务左侧方框即完成(自动加 <code>done</code> 标签并从看板消失)。给任意笔记打上 <code>todo</code> 标签也会被收集到下方「未分类」,补填 <code>q</code> 字段即进入象限。</div>\n\n<div style=\"margin:6px 0; color:#555;\">📅 今日到期 <b>{{{[tag[todo]!tag[done]field:due<today>count[]]}}}</b> 件 · ⏰ 已逾期 <b>{{{[tag[todo]!tag[done]get[due]compare:date:lt<today>count[]]}}}</b> 件</div>\n\n<<quadrant-board>>\n\n<$list filter=\"[tag[todo]!tag[done]!has[q]count[]!match[0]]\">\n<div style=\"margin-top:10px; border:1px dashed rgba(128,128,128,0.35); border-radius:10px; padding:8px 12px;\">\n<div style=\"font-weight:700; margin-bottom:6px;\">📥 未分类待办 <span style=\"color:#888; font-weight:400; font-size:0.82em;\">{{{[tag[todo]!tag[done]!has[q]count[]]}}} 件</span></div>\n<$list filter=\"[tag[todo]!tag[done]!has[q]sort[modified]]\">\n<div style=\"display:flex; gap:6px; align-items:baseline; padding:3px 0; border-bottom:1px dashed rgba(128,128,128,0.15);\">\n<$checkbox tiddler=<<currentTiddler>> tag=\"done\"/>\n<$link to=<<currentTiddler>> style=\"flex:1;\"><$view field=\"title\"/></$link>\n<$list filter=\"[<currentTiddler>get[due]compare:date:lt<today>]\"><span style=\"color:#c0392b; font-size:0.78em;\">逾期</span></$list>\n</div>\n</$list>\n</div>\n</$list>\n\n</$set>"
2950
+ "text": "\\whitespace trim\n\n\\define quadrant-board()\n<div style=\"display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:8px;\">\n<$droppable class=\"tc-quadrant tc-quadrant-q1\" effect=\"move\"\nstyle.border=\"1px solid rgba(128,128,128,0.22)\"\nstyle.border-radius=\"10px\"\nstyle.padding=\"8px 12px\"\nstyle.background=\"linear-gradient(135deg,#e74c3c1a,transparent)\"\nactions=\"\"\"<$action-setfield $tiddler=<<actionTiddler>> $field=\"q\" $value=\"q1\"/>\"\"\">\n<div style=\"font-weight:700; margin-bottom:6px;\">🔴 重要 · 紧急 <span style=\"color:#888; font-weight:400; font-size:0.82em;\">{{{[tag[todo]!tag[done]field:q[q1]count[]]}}} 件</span></div>\n<$list filter=\"[tag[todo]!tag[done]field:q[q1]sort[modified]]\">\n<div style=\"display:flex; gap:6px; align-items:baseline; padding:3px 0; border-bottom:1px dashed rgba(128,128,128,0.15);\">\n<$checkbox tiddler=<<currentTiddler>> tag=\"done\"/>\n<$link to=<<currentTiddler>> style=\"flex:1; cursor:grab;\"><$view field=\"title\"/></$link>\n<$list filter=\"[<currentTiddler>get[due]compare:date:lt<today>]\"><span style=\"color:#c0392b; font-size:0.78em;\">逾期</span></$list>\n<$list filter=\"[<currentTiddler>get[due]!is[blank]]\"><span style=\"color:#888; font-size:0.8em;\"><$view field=\"due\" format=\"date\" template=\"MM-DD\"/></span></$list>\n</div>\n</$list>\n<$list filter=\"[tag[todo]!tag[done]field:q[q1]count[]match[0]]\"><div style=\"color:#aaa; font-size:0.85em;\">(暂无)</div></$list>\n</$droppable>\n<$droppable class=\"tc-quadrant tc-quadrant-q2\" effect=\"move\"\nstyle.border=\"1px solid rgba(128,128,128,0.22)\"\nstyle.border-radius=\"10px\"\nstyle.padding=\"8px 12px\"\nstyle.background=\"linear-gradient(135deg,#3498db1a,transparent)\"\nactions=\"\"\"<$action-setfield $tiddler=<<actionTiddler>> $field=\"q\" $value=\"q2\"/>\"\"\">\n<div style=\"font-weight:700; margin-bottom:6px;\">🔵 重要 · 不紧急 <span style=\"color:#888; font-weight:400; font-size:0.82em;\">{{{[tag[todo]!tag[done]field:q[q2]count[]]}}} 件</span></div>\n<$list filter=\"[tag[todo]!tag[done]field:q[q2]sort[modified]]\">\n<div style=\"display:flex; gap:6px; align-items:baseline; padding:3px 0; border-bottom:1px dashed rgba(128,128,128,0.15);\">\n<$checkbox tiddler=<<currentTiddler>> tag=\"done\"/>\n<$link to=<<currentTiddler>> style=\"flex:1; cursor:grab;\"><$view field=\"title\"/></$link>\n<$list filter=\"[<currentTiddler>get[due]compare:date:lt<today>]\"><span style=\"color:#c0392b; font-size:0.78em;\">逾期</span></$list>\n<$list filter=\"[<currentTiddler>get[due]!is[blank]]\"><span style=\"color:#888; font-size:0.8em;\"><$view field=\"due\" format=\"date\" template=\"MM-DD\"/></span></$list>\n</div>\n</$list>\n<$list filter=\"[tag[todo]!tag[done]field:q[q2]count[]match[0]]\"><div style=\"color:#aaa; font-size:0.85em;\">(暂无)</div></$list>\n</$droppable>\n<$droppable class=\"tc-quadrant tc-quadrant-q3\" effect=\"move\"\nstyle.border=\"1px solid rgba(128,128,128,0.22)\"\nstyle.border-radius=\"10px\"\nstyle.padding=\"8px 12px\"\nstyle.background=\"linear-gradient(135deg,#f39c121a,transparent)\"\nactions=\"\"\"<$action-setfield $tiddler=<<actionTiddler>> $field=\"q\" $value=\"q3\"/>\"\"\">\n<div style=\"font-weight:700; margin-bottom:6px;\">🟠 紧急 · 不重要 <span style=\"color:#888; font-weight:400; font-size:0.82em;\">{{{[tag[todo]!tag[done]field:q[q3]count[]]}}} 件</span></div>\n<$list filter=\"[tag[todo]!tag[done]field:q[q3]sort[modified]]\">\n<div style=\"display:flex; gap:6px; align-items:baseline; padding:3px 0; border-bottom:1px dashed rgba(128,128,128,0.15);\">\n<$checkbox tiddler=<<currentTiddler>> tag=\"done\"/>\n<$link to=<<currentTiddler>> style=\"flex:1; cursor:grab;\"><$view field=\"title\"/></$link>\n<$list filter=\"[<currentTiddler>get[due]compare:date:lt<today>]\"><span style=\"color:#c0392b; font-size:0.78em;\">逾期</span></$list>\n<$list filter=\"[<currentTiddler>get[due]!is[blank]]\"><span style=\"color:#888; font-size:0.8em;\"><$view field=\"due\" format=\"date\" template=\"MM-DD\"/></span></$list>\n</div>\n</$list>\n<$list filter=\"[tag[todo]!tag[done]field:q[q3]count[]match[0]]\"><div style=\"color:#aaa; font-size:0.85em;\">(暂无)</div></$list>\n</$droppable>\n<$droppable class=\"tc-quadrant tc-quadrant-q4\" effect=\"move\"\nstyle.border=\"1px solid rgba(128,128,128,0.22)\"\nstyle.border-radius=\"10px\"\nstyle.padding=\"8px 12px\"\nstyle.background=\"linear-gradient(135deg,#95a5a61a,transparent)\"\nactions=\"\"\"<$action-setfield $tiddler=<<actionTiddler>> $field=\"q\" $value=\"q4\"/>\"\"\">\n<div style=\"font-weight:700; margin-bottom:6px;\">⚪ 不重要 · 不紧急 <span style=\"color:#888; font-weight:400; font-size:0.82em;\">{{{[tag[todo]!tag[done]field:q[q4]count[]]}}} 件</span></div>\n<$list filter=\"[tag[todo]!tag[done]field:q[q4]sort[modified]]\">\n<div style=\"display:flex; gap:6px; align-items:baseline; padding:3px 0; border-bottom:1px dashed rgba(128,128,128,0.15);\">\n<$checkbox tiddler=<<currentTiddler>> tag=\"done\"/>\n<$link to=<<currentTiddler>> style=\"flex:1; cursor:grab;\"><$view field=\"title\"/></$link>\n<$list filter=\"[<currentTiddler>get[due]compare:date:lt<today>]\"><span style=\"color:#c0392b; font-size:0.78em;\">逾期</span></$list>\n<$list filter=\"[<currentTiddler>get[due]!is[blank]]\"><span style=\"color:#888; font-size:0.8em;\"><$view field=\"due\" format=\"date\" template=\"MM-DD\"/></span></$list>\n</div>\n</$list>\n<$list filter=\"[tag[todo]!tag[done]field:q[q4]count[]match[0]]\"><div style=\"color:#aaa; font-size:0.85em;\">(暂无)</div></$list>\n</$droppable>\n</div>\n\\end\n\n<$set name=\"today\" value=<<now \"YYYY0MM0DD\">>>\n\n!! 🏠 主页\n\n<div class=\"tc-message-box\">待办看板与知识库入口。</div>\n\n<div style=\"display:flex; gap:8px; flex-wrap:wrap; margin:8px 0;\">\n<$button class=\"tc-btn-invisible tc-tiddlylink\" style=\"padding:6px 16px; border:1px solid rgba(128,128,128,0.35); border-radius:8px; font-weight:600;\">\n<$action-navigate $to=\"所有标签\"/>\n🏷 所有标签\n</$button>\n<$button class=\"tc-btn-invisible tc-tiddlylink\" style=\"padding:6px 16px; border:1px solid rgba(128,128,128,0.35); border-radius:8px; font-weight:600;\">\n<$action-navigate $to=\"所有文章\"/>\n📚 所有文章\n</$button>\n</div>\n\n!! 📚 插件文档\n\n<div class=\"tc-message-box\">这里收纳插件初始化时 seed 进来的说明 / 教程 / 模板。给新文档打上 <code>dsh-docs</code> 标签即自动出现在本栏;不需要可自由删除(删除后不会自动恢复)。</div>\n\n<<tabs \"[tag[dsh-docs]!is[system]]\" \"dsh-tiddlywiki 插件说明\">>\n\n!! ✍️ 快速记笔记(完整编辑器)\n\n<div class=\"tc-message-box\">直接在首页写笔记:填标题、用工具栏写正文(支持 Markdown:**加粗**、*斜体*、# 标题、- 列表、> 引用 等)、加标签,点「💾 保存」即创建新笔记(默认 Markdown,标题留空用当前时间)。勾选「同时加入待办」并选象限,可一并进入下方四象限看板。</div>\n\n<div style=\"border:1px solid rgba(128,128,128,0.22); border-radius:10px; padding:10px 12px; margin:10px 0;\">\n\n<div style=\"display:flex; gap:6px; align-items:center; margin-bottom:6px;\">\n<$edit-text tiddler=\"$:/state/home-note/title\" tag=\"input\" placeholder=\"标题(留空用当前时间)\" style=\"flex:1; min-width:200px; padding:6px 10px; border-radius:6px; border:1px solid rgba(128,128,128,0.3);\"/>\n</div>\n\n<$edit-text tiddler=\"$:/state/home-note/text\" tag=\"textarea\" class=\"tc-edit-texteditor\" autoHeight=\"yes\" minHeight=\"150px\" placeholder=\"正文:支持 **加粗**、*斜体*、# 标题、- 列表、> 引用 等 Markdown 语法\" style=\"width:100%; box-sizing:border-box; padding:6px 10px; border-radius:6px; border:1px solid rgba(128,128,128,0.3);\">\n<$button class=\"tc-btn-invisible\" tooltip=\"加粗\" style=\"padding:2px 8px; font-weight:700;\"><$action-sendmessage $message=\"tm-edit-text-operation\" $param=\"wrap-selection\" prefix=\"**\" suffix=\"**\" trimSelection=\"yes\"/>B</$button>\n<$button class=\"tc-btn-invisible\" tooltip=\"斜体\" style=\"padding:2px 8px; font-style:italic;\"><$action-sendmessage $message=\"tm-edit-text-operation\" $param=\"wrap-selection\" prefix=\"*\" suffix=\"*\" trimSelection=\"yes\"/>I</$button>\n<$button class=\"tc-btn-invisible\" tooltip=\"删除线\" style=\"padding:2px 8px;\"><$action-sendmessage $message=\"tm-edit-text-operation\" $param=\"wrap-selection\" prefix=\"~~\" suffix=\"~~\" trimSelection=\"yes\"/>S</$button>\n<$button class=\"tc-btn-invisible\" tooltip=\"标题\" style=\"padding:2px 8px;\"><$action-sendmessage $message=\"tm-edit-text-operation\" $param=\"prefix-lines\" character=\"#\" count=\"1\"/>H</$button>\n<$button class=\"tc-btn-invisible\" tooltip=\"无序列表\" style=\"padding:2px 8px;\"><$action-sendmessage $message=\"tm-edit-text-operation\" $param=\"prefix-lines\" character=\"-\" count=\"1\"/>•</$button>\n<$button class=\"tc-btn-invisible\" tooltip=\"有序列表\" style=\"padding:2px 8px;\"><$action-sendmessage $message=\"tm-edit-text-operation\" $param=\"prefix-lines\" character=\"1.\" count=\"1\"/>1.</$button>\n<$button class=\"tc-btn-invisible\" tooltip=\"引用\" style=\"padding:2px 8px;\"><$action-sendmessage $message=\"tm-edit-text-operation\" $param=\"prefix-lines\" character=\">\" count=\"1\"/>❝</$button>\n<$button class=\"tc-btn-invisible\" tooltip=\"行内代码\" style=\"padding:2px 8px;\"><$action-sendmessage $message=\"tm-edit-text-operation\" $param=\"wrap-selection\" prefix=\"`\" suffix=\"`\" trimSelection=\"yes\"/>&lt;/&gt;</$button>\n</$edit-text>\n\n<div style=\"display:flex; gap:6px; flex-wrap:wrap; align-items:center; margin-top:6px;\">\n<$edit-text tiddler=\"$:/state/home-note/tags\" tag=\"input\" placeholder=\"标签(逗号分隔,可选)\" style=\"flex:1; min-width:160px; padding:6px 10px; border-radius:6px; border:1px solid rgba(128,128,128,0.3);\"/>\n<$checkbox tiddler=\"$:/state/home-note/todo\" field=\"text\" checked=\"yes\" unchecked=\"no\"> 同时加入待办</$checkbox>\n<$select tiddler=\"$:/state/home-note/quadrant\" default=\"q2\" style=\"padding:6px 10px; border-radius:6px; border:1px solid rgba(128,128,128,0.3);\">\n<option value=\"q1\">Q1 重要·紧急</option>\n<option value=\"q2\">Q2 重要·不紧急</option>\n<option value=\"q3\">Q3 紧急·不重要</option>\n<option value=\"q4\">Q4 不重要·不紧急</option>\n</$select>\n</div>\n\n<div style=\"display:flex; gap:6px; align-items:center; margin-top:8px; flex-wrap:wrap;\">\n<$button class=\"tc-btn-invisible\" style=\"padding:6px 16px; border-radius:6px; border:1px solid rgba(128,128,128,0.35); font-weight:600; background:rgba(128,128,128,0.06);\">\n<$list filter=\"[{$:/state/home-note/title}!is[blank]] [{$:/state/home-note/text}!is[blank]]\">\n<$action-createtiddler\n$basetitle={{{ [{$:/state/home-note/title}!is[blank]then{$:/state/home-note/title}] ~[<now \"YYYY-MM-DD-HHmm\">] }}}\ntext={{{ [{$:/state/home-note/text}] }}}\ntags={{{ [{$:/state/home-note/tags}split[,]split[,]trim[]] [{$:/state/home-note/todo}match[yes]then[todo]] +[join[ ]] }}}\nq={{{ [{$:/state/home-note/todo}match[yes]then{$:/state/home-note/quadrant}!is[blank]] ~[{$:/state/home-note/todo}match[yes]then[q2]] }}}\ntype=\"text/markdown\"\n$savetitle=\"$:/state/home-note/last-created\"/>\n<$action-setfield $tiddler=\"$:/state/home-note/title\" text=\"\"/>\n<$action-setfield $tiddler=\"$:/state/home-note/text\" text=\"\"/>\n<$action-setfield $tiddler=\"$:/state/home-note/tags\" text=\"\"/>\n</$list>\n💾 保存\n</$button>\n<$button class=\"tc-btn-invisible\" tooltip=\"清空草稿\" style=\"padding:6px 12px; border-radius:6px; border:1px solid rgba(128,128,128,0.3);\">\n<$action-setfield $tiddler=\"$:/state/home-note/title\" text=\"\"/>\n<$action-setfield $tiddler=\"$:/state/home-note/text\" text=\"\"/>\n<$action-setfield $tiddler=\"$:/state/home-note/tags\" text=\"\"/>\n🗑 清空\n</$button>\n<$list filter=\"[{$:/state/home-note/last-created}!is[blank]]\">\n<span style=\"color:#2e7d32; font-size:0.9em;\">✅ 已保存:<$link to={{{ [{$:/state/home-note/last-created}] }}}>{{{$:/state/home-note/last-created}}}</$link></span>\n</$list>\n</div>\n\n</div>\n\n!! ✅ 待办 · 四象限\n\n<div class=\"tc-message-box\">在上方「快速记笔记」勾选「同时加入待办」即建任务(默认 Q2 重要·不紧急);也可以给任意笔记打上 <code>todo</code> 标签收集到下方。点任务左侧方框即完成(自动加 <code>done</code> 标签并从看板消失)。下方「未分类待办」可直接拖动到上方任一象限,拖入即自动写入 <code>q</code> 字段完成分类(象限之间也可互相拖动调整);把象限中的待办拖回「未分类」可取消分类。</div>\n\n<div style=\"margin:6px 0; color:#555;\">📅 今日到期 <b>{{{[tag[todo]!tag[done]field:due<today>count[]]}}}</b> 件 · ⏰ 已逾期 <b>{{{[tag[todo]!tag[done]get[due]compare:date:lt<today>count[]]}}}</b> 件</div>\n\n<<quadrant-board>>\n\n<div style=\"margin-top:10px; border:1px dashed rgba(128,128,128,0.35); border-radius:10px; padding:8px 12px;\">\n<div style=\"font-weight:700; margin-bottom:6px;\">📥 未分类待办 <span style=\"color:#888; font-weight:400; font-size:0.82em;\">{{{[tag[todo]!tag[done]!has[q]count[]]}}} 件</span> <span style=\"color:#aaa; font-weight:400; font-size:0.78em;\">· 拖到上方象限自动分类</span></div>\n<$droppable class=\"tc-todo-inbox\" effect=\"move\" actions=\"\"\"<$action-deletefield $tiddler=<<actionTiddler>> $field=\"q\"/>\"\"\">\n<$list filter=\"[tag[todo]!tag[done]!has[q]sort[modified]]\">\n<div style=\"display:flex; gap:6px; align-items:baseline; padding:3px 0; border-bottom:1px dashed rgba(128,128,128,0.15);\">\n<$checkbox tiddler=<<currentTiddler>> tag=\"done\"/>\n<$link to=<<currentTiddler>> style=\"flex:1; cursor:grab;\"><$view field=\"title\"/></$link>\n<$list filter=\"[<currentTiddler>get[due]compare:date:lt<today>]\"><span style=\"color:#c0392b; font-size:0.78em;\">逾期</span></$list>\n</div>\n</$list>\n<$list filter=\"[tag[todo]!tag[done]!has[q]count[]match[0]]\"><div style=\"color:#aaa; font-size:0.85em;\">(暂无 · 把象限中的待办拖回这里可取消分类)</div></$list>\n</$droppable>\n</div>\n\n</$set>\n"
2708
2951
  },
2709
2952
  {
2710
2953
  "title": "所有标签",
2711
2954
  "tags": ["索引", "TableOfContents"],
2712
2955
  "type": "text/vnd.tiddlywiki",
2713
- "text": "\\whitespace trim\n\n\\define tag-count() [all[tiddlers]!is[system]!tag[agent-written]tag<currentTiddler>count[]]\n\\define tag-list() [all[tiddlers]!is[system]!tag[agent-written]tags[]!prefix[$:/tags/]!match[索引]]\n\n\\define agent-notes-pure() [all[tiddlers]!is[system]tag[agent-written]!tag[human-edited]count[]]\n\\define agent-notes-mixed() [all[tiddlers]!is[system]tag[agent-written]tag[human-edited]count[]]\n\\define agent-tags-pure() [all[tiddlers]!is[system]tag[agent-written]!tag[human-edited]tags[]!prefix[$:/tags/]!match[索引]!match[agent-written]!match[human-edited]]\n\\define agent-tags-mixed() [all[tiddlers]!is[system]tag[agent-written]tag[human-edited]tags[]!prefix[$:/tags/]!match[索引]!match[agent-written]!match[human-edited]]\n\\define agent-count-pure() [all[tiddlers]!is[system]tag[agent-written]!tag[human-edited]tag<currentTiddler>count[]]\n\\define agent-count-mixed() [all[tiddlers]!is[system]tag[agent-written]tag[human-edited]tag<currentTiddler>count[]]\n\n<$button class=\"tc-btn-invisible tc-tiddlylink\" style=\"margin:6px 0; padding:4px 10px; border:1px solid rgba(128,128,128,0.3); border-radius:6px; font-size:0.9em;\">\n<$action-navigate $to=\"🏠 主页\"/>\n← 回主页\n</$button>\n\n!! 🏷 所有标签\n\n<div class=\"tc-message-box\">按笔记数量从多到少排序,仅统计人类笔记(Agent 撰写的笔记已排除,见下方「🤖 Agent 撰写的标签」)。点击标签,查看包含该标签的所有笔记。</div>\n\n<div style=\"margin-top:12px;\">\n<$list filter=\"[subfilter<tag-list>] +[!sortsub:number<tag-count>]\">\n<$set name=\"count\" value={{{ [subfilter<tag-count>] }}}>\n<div style=\"padding:7px 2px; border-bottom:1px solid rgba(128,128,128,0.15);\">\n<$button set=\"$:/state/tag\" setTo=<<currentTiddler>> class=\"tc-btn-invisible tc-tiddlylink\" style=\"width:100%; text-align:left;\">\n<$action-navigate $to=\"标签笔记\"/>\n<span style=\"font-weight:600; font-size:1.05em;\"><<currentTiddler>></span>\n<span style=\"color:#888; font-size:0.85em; margin-left:8px;\"><<count>> 篇</span>\n</$button>\n</div>\n</$set>\n</$list>\n</div>\n\n!! 🤖 Agent 撰写的标签\n\n<div class=\"tc-message-box\">以下标签来自带有 <code>agent-written</code> 标签(由 Agent 撰写)的笔记,与上方主列表分开统计。若某篇 Agent 笔记又被人类编辑过,请给它补打 <code>human-edited</code> 标签,即归入下方「Agent + 人工」档。</div>\n\n<div style=\"font-weight:700; margin:8px 0 4px;\">🦾 纯 Agent <span style=\"color:#888; font-weight:400; font-size:0.82em;\">{{{[subfilter<agent-notes-pure>]}}} 篇</span></div>\n<div style=\"margin-left:10px;\">\n<$list filter=\"[subfilter<agent-tags-pure>] +[!sortsub:number<agent-count-pure>]\">\n<$set name=\"count\" value={{{ [subfilter<agent-count-pure>] }}}>\n<div style=\"padding:7px 2px; border-bottom:1px solid rgba(128,128,128,0.15);\">\n<$button set=\"$:/state/tag\" setTo=<<currentTiddler>> class=\"tc-btn-invisible tc-tiddlylink\" style=\"width:100%; text-align:left;\">\n<$action-navigate $to=\"标签笔记\"/>\n<span style=\"font-weight:600; font-size:1.05em;\"><<currentTiddler>></span>\n<span style=\"color:#888; font-size:0.85em; margin-left:8px;\"><<count>> 篇</span>\n</$button>\n</div>\n</$set>\n</$list>\n<$list filter=\"[subfilter<agent-tags-pure>!count[]]\"><div style=\"color:#aaa; font-size:0.85em;\">(暂无纯 Agent 笔记)</div></$list>\n</div>\n\n<div style=\"font-weight:700; margin:10px 0 4px;\">🤝 Agent + 人工 <span style=\"color:#888; font-weight:400; font-size:0.82em;\">{{{[subfilter<agent-notes-mixed>]}}} 篇</span></div>\n<div style=\"margin-left:10px;\">\n<$list filter=\"[subfilter<agent-tags-mixed>] +[!sortsub:number<agent-count-mixed>]\">\n<$set name=\"count\" value={{{ [subfilter<agent-count-mixed>] }}}>\n<div style=\"padding:7px 2px; border-bottom:1px solid rgba(128,128,128,0.15);\">\n<$button set=\"$:/state/tag\" setTo=<<currentTiddler>> class=\"tc-btn-invisible tc-tiddlylink\" style=\"width:100%; text-align:left;\">\n<$action-navigate $to=\"标签笔记\"/>\n<span style=\"font-weight:600; font-size:1.05em;\"><<currentTiddler>></span>\n<span style=\"color:#888; font-size:0.85em; margin-left:8px;\"><<count>> 篇</span>\n</$button>\n</div>\n</$set>\n</$list>\n<$list filter=\"[subfilter<agent-tags-mixed>!count[]]\"><div style=\"color:#aaa; font-size:0.85em;\">(暂无「Agent + 人工」笔记)</div></$list>\n</div>\n"
2956
+ "text": "\\whitespace trim\n\n\\define tag-count() [all[tiddlers]!is[system]!tag[agent-written]tag<currentTiddler>count[]]\n\\define tag-list() [all[tiddlers]!is[system]!tag[agent-written]tags[]!prefix[$:/tags/]!match[索引]]\n\n\\define agent-notes-pure() [all[tiddlers]!is[system]tag[agent-written]!tag[human-edited]count[]]\n\\define agent-notes-mixed() [all[tiddlers]!is[system]tag[agent-written]tag[human-edited]count[]]\n\\define agent-tags-pure() [all[tiddlers]!is[system]tag[agent-written]!tag[human-edited]tags[]!prefix[$:/tags/]!match[索引]!match[agent-written]!match[human-edited]]\n\\define agent-tags-mixed() [all[tiddlers]!is[system]tag[agent-written]tag[human-edited]tags[]!prefix[$:/tags/]!match[索引]!match[agent-written]!match[human-edited]]\n\\define agent-count-pure() [all[tiddlers]!is[system]tag[agent-written]!tag[human-edited]tag<currentTiddler>count[]]\n\\define agent-count-mixed() [all[tiddlers]!is[system]tag[agent-written]tag[human-edited]tag<currentTiddler>count[]]\n\n<$button class=\"tc-btn-invisible tc-tiddlylink\" style=\"margin:6px 0; padding:4px 10px; border:1px solid rgba(128,128,128,0.3); border-radius:6px; font-size:0.9em;\">\n<$action-navigate $to=\"🏠 主页\"/>\n← 回主页\n</$button>\n\n!! 🏷 所有标签\n\n<div class=\"tc-message-box\">按笔记数量从多到少排序,仅统计人类笔记(Agent 撰写的笔记已排除,见下方「🤖 Agent 撰写的标签」)。点击标签,查看包含该标签的所有笔记。</div>\n\n<div style=\"margin-top:12px;\">\n<$list filter=\"[subfilter<tag-list>] +[!sortsub:number<tag-count>]\">\n<$set name=\"count\" value={{{ [subfilter<tag-count>] }}}>\n<div style=\"padding:7px 2px; border-bottom:1px solid rgba(128,128,128,0.15);\">\n<$button set=\"$:/state/tag\" setTo=<<currentTiddler>> class=\"tc-btn-invisible tc-tiddlylink\" style=\"width:100%; text-align:left;\">\n<$action-navigate $to=\"标签笔记\"/>\n<span style=\"font-weight:600; font-size:1.05em;\"><<currentTiddler>></span>\n<span style=\"color:#888; font-size:0.85em; margin-left:8px;\"><<count>> 篇</span>\n</$button>\n</div>\n</$set>\n</$list>\n</div>\n\n!! 🤖 Agent 撰写的标签\n\n<div class=\"tc-message-box\">以下标签来自带有 <code>agent-written</code> 标签(由 Agent 撰写)的笔记,与上方主列表分开统计。若某篇 Agent 笔记又被人类编辑过,请给它补打 <code>human-edited</code> 标签,即归入下方「Agent + 人工」档。</div>\n\n<div style=\"font-weight:700; margin:8px 0 4px;\">🦾 纯 Agent <span style=\"color:#888; font-weight:400; font-size:0.82em;\">{{{[subfilter<agent-notes-pure>]}}} 篇</span></div>\n<div style=\"margin-left:10px;\">\n<$list filter=\"[subfilter<agent-tags-pure>] +[!sortsub:number<agent-count-pure>]\">\n<$set name=\"count\" value={{{ [subfilter<agent-count-pure>] }}}>\n<div style=\"padding:7px 2px; border-bottom:1px solid rgba(128,128,128,0.15);\">\n<$button set=\"$:/state/tag\" setTo=<<currentTiddler>> class=\"tc-btn-invisible tc-tiddlylink\" style=\"width:100%; text-align:left;\">\n<$action-navigate $to=\"标签笔记\"/>\n<span style=\"font-weight:600; font-size:1.05em;\"><<currentTiddler>></span>\n<span style=\"color:#888; font-size:0.85em; margin-left:8px;\"><<count>> 篇</span>\n</$button>\n</div>\n</$set>\n</$list>\n<$list filter=\"[subfilter<agent-tags-pure>count[]match[0]]\"><div style=\"color:#aaa; font-size:0.85em;\">(暂无纯 Agent 笔记)</div></$list>\n</div>\n\n<div style=\"font-weight:700; margin:10px 0 4px;\">🤝 Agent + 人工 <span style=\"color:#888; font-weight:400; font-size:0.82em;\">{{{[subfilter<agent-notes-mixed>]}}} 篇</span></div>\n<div style=\"margin-left:10px;\">\n<$list filter=\"[subfilter<agent-tags-mixed>] +[!sortsub:number<agent-count-mixed>]\">\n<$set name=\"count\" value={{{ [subfilter<agent-count-mixed>] }}}>\n<div style=\"padding:7px 2px; border-bottom:1px solid rgba(128,128,128,0.15);\">\n<$button set=\"$:/state/tag\" setTo=<<currentTiddler>> class=\"tc-btn-invisible tc-tiddlylink\" style=\"width:100%; text-align:left;\">\n<$action-navigate $to=\"标签笔记\"/>\n<span style=\"font-weight:600; font-size:1.05em;\"><<currentTiddler>></span>\n<span style=\"color:#888; font-size:0.85em; margin-left:8px;\"><<count>> 篇</span>\n</$button>\n</div>\n</$set>\n</$list>\n<$list filter=\"[subfilter<agent-tags-mixed>count[]match[0]]\"><div style=\"color:#aaa; font-size:0.85em;\">(暂无「Agent + 人工」笔记)</div></$list>\n</div>\n"
2714
2957
  },
2715
2958
  {
2716
2959
  "title": "标签笔记",
@@ -2942,6 +3185,91 @@ async function unseedAllArticles(client) {
2942
3185
  return { removed };
2943
3186
  }
2944
3187
  //#endregion
3188
+ //#region src/host/seed-ui-styles.ts
3189
+ /** One-time marker: presence means "the styles were offered once — hands off". */
3190
+ const UI_STYLES_MARKER_TITLE = "$:/plugins/dsh-tiddlywiki/seed-ui-styles";
3191
+ /** The stylesheets, exactly as seeded (user-owned afterwards). */
3192
+ const UI_STYLE_ITEMS = [
3193
+ {
3194
+ "title": "编辑器美化 CSS",
3195
+ "tags": ["$:/tags/Stylesheet"],
3196
+ "type": "text/css",
3197
+ "text": "/* ===== 编辑器美化(TiddlyWiki 5.4 + CodeMirror)===== */\n\n/* 字体 / 字号 / 行高 */\n.tc-editor .CodeMirror {\n font-family: \"Fira Code VF\", Consolas, \"Courier New\", monospace;\n font-size: 14px;\n line-height: 1.7;\n}\n\n/* 编辑区内边距(呼吸感) */\n.tc-editor .CodeMirror-lines {\n padding: 12px 14px;\n}\n\n/* 光标颜色 */\n.tc-editor .CodeMirror-cursor {\n border-left: 2px solid #2e80ff !important;\n}\n\n/* 当前行高亮 */\n.tc-editor .CodeMirror-activeline-background {\n background: rgba(46, 128, 255, 0.08);\n}\n\n/* 行号 */\n.tc-editor .CodeMirror-linenumber {\n color: #9aa0a6;\n padding-right: 10px;\n}\n\n/* 选区配色 */\n.tc-editor .CodeMirror ::selection {\n background: rgba(46, 128, 255, 0.22);\n}\n\n/* 工具栏按钮:圆角 + 间距 */\n.tc-editor-toolbar button {\n border-radius: 6px;\n margin: 0 2px 2px 0;\n}\n\n/* 编辑页标题输入框:vanilla 默认 2.35em 过大,缩小字号与内边距 */\n.tc-tiddler-frame input.tc-edit-texteditor.tc-titlebar,\n.tc-tiddler-frame .tc-titlebar.tc-edit-texteditor {\n font-size: 1.2em !important;\n line-height: 1.35em !important;\n padding: 4px 8px !important;\n}\n\n/* 查看模式标题:vanilla 默认 2.35em 过大,调小一些 */\n.tc-tiddler-frame .tc-tiddler-title .tc-titlebar,\n.tc-tiddler-frame .tc-tiddler-title h2.tc-title {\n font-size: 1.3em !important;\n line-height: 1.1em !important;\n}\n\n/* 侧边栏站点标题(sidebar 顶部的 wiki 站名):vanilla 默认 2.35em 过大,调小 */\n.tc-sidebar .tc-site-title {\n font-size: 1.5em !important;\n line-height: 1.3em !important;\n}\n"
3198
+ },
3199
+ {
3200
+ "title": "标题与按钮区分开",
3201
+ "tags": ["$:/tags/Stylesheet"],
3202
+ "type": "text/css",
3203
+ "text": ".tc-titlebar h2 {\n display: table-header-group;\n word-wrap:break-word;\n word-break:break-all;\n}\n"
3204
+ },
3205
+ {
3206
+ "title": "侧边栏窄屏自动隐藏.css",
3207
+ "tags": ["$:/tags/Stylesheet"],
3208
+ "type": "text/css",
3209
+ "text": "/* ===== 侧边栏窄屏自动隐藏 =====\n 视口(TW 面板/iframe 宽度)< 960px 时自动完全隐藏右侧 TiddlyWiki 侧边栏,\n 正文占满整行;窗口变宽 >= 960px 后自动恢复。\n 断点 959px 对齐主题默认 sidebarbreakpoint=960px(vanilla/snowwhite/starlight)。\n 想改断点:改下面媒体查询里的数值即可。\n 想恢复默认:删除本 tiddler。 */\n\n@media (max-width: 959px) {\n\n /* 侧边栏整栏隐藏(含站点标题、各 sidebar 板块) */\n .tc-sidebar-scrollable {\n display: none !important;\n }\n\n /* 右上角「显示/隐藏侧边栏」chevron 按钮一并隐藏:\n 窄屏下侧边栏已被 CSS 隐藏,此时按钮点击只会改 $:/state/sidebar 状态、\n 界面却看不到变化,反而误导,故隐藏 */\n .tc-hide-sidebar-btn,\n .tc-show-sidebar-btn {\n display: none !important;\n }\n\n}\n"
3210
+ },
3211
+ {
3212
+ "title": "批注弹窗样式",
3213
+ "tags": ["$:/tags/Stylesheet"],
3214
+ "type": "text/css",
3215
+ "text": "/* 批注功能弹窗美化(dsh-ann-*) */\n.dsh-ann-popup {\n border-radius: 12px;\n padding: 14px 16px;\n max-width: 520px;\n width: max-content;\n min-width: 300px;\n box-shadow: 0 10px 30px rgba(0,0,0,.22);\n border: 1px solid rgba(127,127,127,.25);\n}\n.dsh-ann-popup .dsh-ann-head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n font-weight: 700;\n font-size: 1.02em;\n margin-bottom: 8px;\n}\n.dsh-ann-icon-btn {\n border: none;\n background: transparent;\n cursor: pointer;\n font-size: 1em;\n line-height: 1;\n padding: 2px 8px;\n border-radius: 6px;\n opacity: .55;\n}\n.dsh-ann-icon-btn:hover { opacity: 1; background: rgba(127,127,127,.15); }\n.dsh-ann-sub { font-size: .88em; margin: 4px 0; }\n.dsh-ann-quote {\n background: rgba(127,127,127,.14);\n padding: 2px 8px;\n border-radius: 6px;\n font-style: italic;\n}\n.dsh-ann-chip {\n display: inline-block;\n width: 12px;\n height: 12px;\n border-radius: 50%;\n margin: 0 4px 0 8px;\n border: 1px solid rgba(0,0,0,.18);\n vertical-align: -1px;\n}\n.dsh-ann-label { font-size: .9em; margin: 10px 0 4px; }\n.dsh-ann-input {\n width: 100%;\n border-radius: 8px;\n border: 1px solid rgba(127,127,127,.35);\n padding: 6px 9px;\n font-size: .95em;\n resize: vertical;\n}\n.dsh-ann-input:focus {\n outline: none;\n border-color: #4a90d9;\n box-shadow: 0 0 0 2px rgba(74,144,217,.22);\n}\n.dsh-ann-actions {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n gap: 8px;\n margin-top: 12px;\n}\n.dsh-ann-btn {\n display: inline-block;\n border-radius: 8px;\n padding: 5px 14px;\n cursor: pointer;\n border: 1px solid rgba(127,127,127,.35);\n background: rgba(127,127,127,.08);\n font-size: .9em;\n text-decoration: none !important;\n}\n.dsh-ann-btn:hover { background: rgba(127,127,127,.18); }\n.dsh-ann-btn-primary {\n background: #4a90d9;\n border-color: #4a90d9;\n color: #fff !important;\n}\n.dsh-ann-btn-primary:hover { background: #3a80c9; }\n.dsh-ann-colors {\n display: flex;\n gap: 10px;\n margin: 10px 0 12px;\n}\n.dsh-ann-swatch {\n width: 34px;\n height: 34px;\n border-radius: 50%;\n border: 2px solid rgba(0,0,0,.14);\n cursor: pointer;\n padding: 0;\n transition: transform .12s ease, box-shadow .12s ease;\n}\n.dsh-ann-swatch:hover {\n transform: scale(1.18);\n box-shadow: 0 2px 8px rgba(0,0,0,.28);\n}\n.dsh-ann-sel { font-size: .88em; margin-top: 4px; }\n"
3216
+ },
3217
+ {
3218
+ "title": "menubar 顶栏加高样式",
3219
+ "tags": ["$:/tags/Stylesheet"],
3220
+ "type": "text/css",
3221
+ "text": "/* ==== menubar 顶栏加高 ====\n 默认顶栏约 28px(菜单项 padding 0.5em + line-height 1)。\n 想调高度:改 min-height 数值即可(如 40 / 48 / 56px)。\n 想恢复默认:删除本 tiddler。\n flex 布局让菜单项在加高的栏内垂直居中;窄屏汉堡展开时保持纵向堆叠。 */\n\nnav.tc-menubar ul.tc-menubar-list {\n display: flex;\n align-items: center;\n box-sizing: border-box;\n min-height: 44px;\n}\n\nnav.tc-menubar .tc-menubar-narrow ul.tc-menubar-list {\n flex-direction: column;\n align-items: stretch;\n}\n"
3222
+ }
3223
+ ];
3224
+ /**
3225
+ * Seed the custom stylesheet tiddlers once per wiki (mirrors the one-shot
3226
+ * policy). With opts.force the tiddlers are overwritten with the built-in
3227
+ * content and the marker (re)written — the settings page uses this for
3228
+ * "重新初始化". Returns whether anything was written this call. Never throws.
3229
+ */
3230
+ async function seedUiStyles(client, opts) {
3231
+ const force = opts?.force === true;
3232
+ if (!force) {
3233
+ if (await client.get("$:/plugins/dsh-tiddlywiki/seed-ui-styles").catch(() => void 0) !== void 0) return false;
3234
+ }
3235
+ let wrote = false;
3236
+ for (const item of UI_STYLE_ITEMS) {
3237
+ const existing = await client.get(item.title).catch(() => void 0);
3238
+ if (force || existing === void 0) {
3239
+ await client.put({
3240
+ title: item.title,
3241
+ text: item.text,
3242
+ type: item.type,
3243
+ tags: item.tags
3244
+ });
3245
+ wrote = true;
3246
+ }
3247
+ }
3248
+ await client.put({
3249
+ title: UI_STYLES_MARKER_TITLE,
3250
+ text: "seeded-once",
3251
+ type: "text/plain",
3252
+ tags: []
3253
+ }).catch(() => void 0);
3254
+ return wrote;
3255
+ }
3256
+ /**
3257
+ * Un-seed (反初始化): remove the stylesheet tiddlers and their marker.
3258
+ * Deletion is idempotent — a tiddler already gone is not listed. Never throws.
3259
+ */
3260
+ async function unseedUiStyles(client) {
3261
+ const removed = [];
3262
+ for (const item of UI_STYLE_ITEMS) if (await client.get(item.title).catch(() => void 0) !== void 0) {
3263
+ await client.delete(item.title);
3264
+ removed.push(item.title);
3265
+ }
3266
+ if (await client.get("$:/plugins/dsh-tiddlywiki/seed-ui-styles").catch(() => void 0) !== void 0) {
3267
+ await client.delete(UI_STYLES_MARKER_TITLE);
3268
+ removed.push(UI_STYLES_MARKER_TITLE);
3269
+ }
3270
+ return { removed };
3271
+ }
3272
+ //#endregion
2945
3273
  //#region src/host/seed-menubar-theme.ts
2946
3274
  /** One-time marker: presence means "the override was offered once — hands off". */
2947
3275
  const MENUBAR_THEME_MARKER_TITLE = "$:/plugins/dsh-tiddlywiki/seed-menubar-theme";
@@ -3111,7 +3439,7 @@ const removedDetail = (id, removed) => ({
3111
3439
  * - `unseed` → remove the seeded tiddlers + markers (removable seeds).
3112
3440
  */
3113
3441
  function defineSeed(meta, impl) {
3114
- const { id, title, description, core } = meta;
3442
+ const { id, title, description, core, startup } = meta;
3115
3443
  const removable = !core;
3116
3444
  const check = impl.check ?? (async (ctx) => {
3117
3445
  const present = await presentOf(ctx, impl.presentTitle ?? "");
@@ -3159,6 +3487,7 @@ function defineSeed(meta, impl) {
3159
3487
  title,
3160
3488
  description,
3161
3489
  core,
3490
+ ...startup === void 0 ? {} : { startup },
3162
3491
  check,
3163
3492
  run,
3164
3493
  ...remove === void 0 ? {} : { remove }
@@ -3169,13 +3498,36 @@ const SEED_DEFS = [
3169
3498
  defineSeed({
3170
3499
  id: "doc-note",
3171
3500
  title: "插件说明笔记",
3172
- description: "「dsh-tiddlywiki 插件说明」——入门说明笔记(可选,设置页「初始化」手动写入;ONE-SHOT,用户可改可删)。",
3173
- core: false
3501
+ description: "「dsh-tiddlywiki 插件说明」——入门说明笔记(首次安装默认写入;ONE-SHOT,用户可改可删,标记 dsh-docs 自动进首页「📚 插件文档」栏)。",
3502
+ core: false,
3503
+ startup: true
3174
3504
  }, {
3175
3505
  presentTitle: DOC_NOTE_TITLE,
3176
3506
  write: seedDocNote,
3177
3507
  unseed: unseedDocNote
3178
3508
  }),
3509
+ defineSeed({
3510
+ id: "starter-docs",
3511
+ title: "示例与文档(汇总模板 / 教程 / 主题页示例)",
3512
+ description: "新手文档中心起步包:主题汇总页·模板、教程(按主题/标签做汇总页)、三个可直接运行的示例主题页(日志 / 决策记录 / 排障)。全部打 dsh-docs 标签,自动出现在首页「📚 插件文档」栏;纯示例无个人数据,同名 tiddler 已存在则安全跳过,不会覆盖。首次安装默认写入,可反初始化。",
3513
+ core: false,
3514
+ startup: true
3515
+ }, {
3516
+ check: async (ctx) => {
3517
+ const missing = [];
3518
+ for (const item of STARTER_DOCS_ITEMS) if (!await presentOf(ctx, item.title)) missing.push(item.title);
3519
+ return {
3520
+ id: "starter-docs",
3521
+ title: "示例与文档(汇总模板 / 教程 / 主题页示例)",
3522
+ description: "新手文档中心起步包:主题汇总页·模板、教程(按主题/标签做汇总页)、三个可直接运行的示例主题页(日志 / 决策记录 / 排障)。全部打 dsh-docs 标签,自动出现在首页「📚 插件文档」栏;纯示例无个人数据,同名 tiddler 已存在则安全跳过,不会覆盖。首次安装默认写入,可反初始化。",
3523
+ present: missing.length === 0,
3524
+ removable: true,
3525
+ detail: missing.length === 0 ? "已存在" : `缺失:${missing.join("、")}`
3526
+ };
3527
+ },
3528
+ write: seedStarterDocs,
3529
+ unseed: unseedStarterDocs
3530
+ }),
3179
3531
  defineSeed({
3180
3532
  id: "send-to-agent",
3181
3533
  title: "「发送给 Agent」按钮",
@@ -3225,6 +3577,27 @@ const SEED_DEFS = [
3225
3577
  write: seedAllArticles,
3226
3578
  unseed: unseedAllArticles
3227
3579
  }),
3580
+ defineSeed({
3581
+ id: "ui-styles",
3582
+ title: "自定义样式(编辑器美化 / 窄屏侧栏 / menubar 加高 / 批注弹窗)",
3583
+ description: "5 张通用样式表(tag $:/tags/Stylesheet):编辑器美化(CodeMirror 字体/光标/行号)、标题与按钮区分开、侧边栏窄屏自动隐藏(<960px)、menubar 顶栏加高、批注弹窗美化。纯样式无个人数据。",
3584
+ core: false
3585
+ }, {
3586
+ check: async (ctx) => {
3587
+ const missing = [];
3588
+ for (const item of UI_STYLE_ITEMS) if (!await presentOf(ctx, item.title)) missing.push(item.title);
3589
+ return {
3590
+ id: "ui-styles",
3591
+ title: "自定义样式(编辑器美化 / 窄屏侧栏 / menubar 加高 / 批注弹窗)",
3592
+ description: "5 张通用样式表(tag $:/tags/Stylesheet):编辑器美化(CodeMirror 字体/光标/行号)、标题与按钮区分开、侧边栏窄屏自动隐藏(<960px)、menubar 顶栏加高、批注弹窗美化。纯样式无个人数据。",
3593
+ present: missing.length === 0,
3594
+ removable: true,
3595
+ detail: missing.length === 0 ? "已存在" : `缺失:${missing.join("、")}`
3596
+ };
3597
+ },
3598
+ write: seedUiStyles,
3599
+ unseed: unseedUiStyles
3600
+ }),
3228
3601
  defineSeed({
3229
3602
  id: "menubar-theme",
3230
3603
  title: "menubar 顶栏主题自适应",
@@ -3330,24 +3703,27 @@ async function runSeedById(ctx, id, force) {
3330
3703
  return out;
3331
3704
  }
3332
3705
  /**
3333
- * Startup path: seed ONLY the core items (功能必需:发送给 Agent 按钮 +
3334
- * TW 前端 API 基址), non-force (write only what is missing). Optional seeds
3335
- * (说明笔记 / 首页 / 所有文章 / menubar 顶栏主题自适应) are never forced on
3336
- * users — they opt in from the settings page「初始化」section.
3706
+ * Startup path: seed the CORE items (功能必需:发送给 Agent 按钮 + 原生渲染
3707
+ * 路由 + TW 前端 API 基址) AND the STARTER items (首次安装默认:插件说明 +
3708
+ * 示例与文档), all non-force (write only what is missing — a same-named
3709
+ * tiddler already present is NEVER overwritten, so user data stays user data).
3710
+ * Remaining optional seeds (首页 / 所有文章 / 自定义样式 / menubar 顶栏主题自
3711
+ * 适应) are never forced on users — they opt in from the settings page
3712
+ * 「初始化」section.
3337
3713
  */
3338
3714
  async function runAllSeeds(ctx) {
3339
3715
  const out = [];
3340
3716
  for (const def of SEED_DEFS) {
3341
- if (!def.core) continue;
3717
+ if (!def.core && def.startup !== true) continue;
3342
3718
  out.push(await def.run(ctx, false));
3343
3719
  }
3344
3720
  return out;
3345
3721
  }
3346
3722
  /**
3347
- * 反初始化 (remove): delete one optional seed's seeded tiddlers + markers, or
3348
- * all optional seeds when `id` is undefined. Core seeds are functionally
3349
- * required and cannot be removed — a direct request for one returns an error
3350
- * result (and is skipped when removing all).
3723
+ * 反初始化 (remove): delete one non-core seed's (starter 或 optional) seeded
3724
+ * tiddlers + markers, or all non-core seeds when `id` is undefined. Core
3725
+ * seeds are functionally required and cannot be removed — a direct request
3726
+ * for one returns an error result (and is skipped when removing all).
3351
3727
  */
3352
3728
  async function removeSeedById(ctx, id) {
3353
3729
  if (id === void 0) {
@@ -4633,6 +5009,7 @@ const DEFAULTS = {
4633
5009
  tabLabel: "知识库",
4634
5010
  showSessionTab: true,
4635
5011
  showRightbarTab: true,
5012
+ showBetterSidebarTab: true,
4636
5013
  sendToAgent: { enabled: true },
4637
5014
  allArticles: { pageSize: 10 }
4638
5015
  },
@@ -4812,7 +5189,8 @@ function apply(ctx, rawConfig = {}) {
4812
5189
  darkPalette: palette,
4813
5190
  tabLabel,
4814
5191
  showSessionTab: ui.showSessionTab !== false,
4815
- showRightbarTab: ui.showRightbarTab !== false
5192
+ showRightbarTab: ui.showRightbarTab !== false,
5193
+ showBetterSidebarTab: ui.showBetterSidebarTab !== false
4816
5194
  };
4817
5195
  };
4818
5196
  const disposers = [];
@@ -4980,6 +5358,6 @@ function apply(ctx, rawConfig = {}) {
4980
5358
  }, "dsh-tiddlywiki: host teardown");
4981
5359
  }
4982
5360
  //#endregion
4983
- export { ALL_ARTICLES_MARKER_TITLE, ALL_ARTICLES_TEXT, ALL_ARTICLES_TITLE, AutoCommitter, ConfigStore, DOC_NOTE_TAG, DOC_NOTE_TEXT, DOC_NOTE_TITLE, GitFace, HOME_DEFAULT_TIDDLERS, HOME_INDEX_ITEMS, HOME_INDEX_MARKER_TITLE, MENUBAR_THEME_MARKER_TITLE, MENUBAR_THEME_TEXT, MENUBAR_THEME_TIDDLER, PATH_PREFIX, RENDER_BUNDLE_TEXT, RENDER_MARKER_TITLE, RENDER_PLUGIN_TITLE, SEED_DEFS, SEND_TO_AGENT_BUNDLE_TEXT, SEND_TO_AGENT_MARKER_TITLE, SEND_TO_AGENT_PLUGIN_TITLE, SESSION_SUMMARY_PREFIX, TEXT_LIST_FILTER, TW_PROXY_PATH, TW_PROXY_PREFIX, TW_WEB_HOST_DEFAULT, TW_WEB_HOST_TIDDLER, TiddlyWebClient, WikiServer, apply, bundledCatalog, checkAllSeeds, deepMerge, defineTool, dshHomePath, ensureLanguage, ensureTwWebHost, inject, isBinaryType, name, normalizeThemes, openInTwEditor, readWikiInfo, registerAdminRoutes, registerRoutes, registerTiddlywikiTools, removeSeedById, resolveTwRoot, runAllSeeds, runSeedById, seedAllArticles, seedDocNote, seedHomeIndex, seedMenubarTheme, seedRenderRoute, seedSendToAgent, writeSessionSummary, writeWikiInfo };
5361
+ export { ALL_ARTICLES_MARKER_TITLE, ALL_ARTICLES_TEXT, ALL_ARTICLES_TITLE, AutoCommitter, ConfigStore, DOC_NOTE_TAG, DOC_NOTE_TEXT, DOC_NOTE_TITLE, DSH_DOCS_TAG, GitFace, HOME_DEFAULT_TIDDLERS, HOME_INDEX_ITEMS, HOME_INDEX_MARKER_TITLE, MENUBAR_THEME_MARKER_TITLE, MENUBAR_THEME_TEXT, MENUBAR_THEME_TIDDLER, PATH_PREFIX, RENDER_BUNDLE_TEXT, RENDER_MARKER_TITLE, RENDER_PLUGIN_TITLE, SEED_DEFS, SEND_TO_AGENT_BUNDLE_TEXT, SEND_TO_AGENT_MARKER_TITLE, SEND_TO_AGENT_PLUGIN_TITLE, SESSION_SUMMARY_PREFIX, STARTER_DOCS_ITEMS, STARTER_DOCS_MARKER_TITLE, TEXT_LIST_FILTER, TW_PROXY_PATH, TW_PROXY_PREFIX, TW_WEB_HOST_DEFAULT, TW_WEB_HOST_TIDDLER, TiddlyWebClient, UI_STYLES_MARKER_TITLE, UI_STYLE_ITEMS, WikiServer, apply, bundledCatalog, checkAllSeeds, deepMerge, defineTool, dshHomePath, ensureLanguage, ensureTwWebHost, inject, isBinaryType, name, normalizeThemes, openInTwEditor, readWikiInfo, registerAdminRoutes, registerRoutes, registerTiddlywikiTools, removeSeedById, resolveTwRoot, runAllSeeds, runSeedById, seedAllArticles, seedDocNote, seedHomeIndex, seedMenubarTheme, seedRenderRoute, seedSendToAgent, seedStarterDocs, seedUiStyles, writeSessionSummary, writeWikiInfo };
4984
5362
 
4985
5363
  //# sourceMappingURL=index.js.map