dsh-quick-toc 0.4.0 → 0.4.1
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/CHANGELOG.en.md +9 -8
- package/CHANGELOG.md +9 -8
- package/README.en.md +21 -24
- package/README.md +21 -24
- package/lib/client.js +135 -135
- package/package.json +1 -1
package/CHANGELOG.en.md
CHANGED
|
@@ -5,28 +5,29 @@ All notable changes to **dsh-quick-toc** are documented here. Chinese version: [
|
|
|
5
5
|
## [0.4.0] - 2026-09-11
|
|
6
6
|
|
|
7
7
|
### Added
|
|
8
|
+
- **Search result list**: while a query is present the outline becomes a result list — one row per match, showing the matched heading or message with the keyword highlighted, its heading path, the turn time and a repeat count (plus a context snippet in full-text scope). Rows are chronological with the **newest hit at the bottom**, a fresh search starts at the newest hit and you scroll up to reach earlier ones; **clicking a row** makes that hit current, i.e. the same path as Enter stepping — it highlights the keyword in the conversation and scrolls there. `n/N` Enter-stepping is kept.
|
|
8
9
|
- **Sticky group headers**: while scrolling the outline, the header of the turn you are inside stays pinned to the top of the panel, flush against the toolbar above it.
|
|
9
10
|
- **Collapsible level-filter row**: the **层级 (levels)** button at the left of the magnifier hides/shows the `1`–`6` row (the choice is remembered; the filter keeps applying while it is hidden).
|
|
10
11
|
- **Position breadcrumb**: the top of the panel shows the path of the section you are reading; click it to jump there. The rule is "the deepest heading above the viewport's middle line" — the section that fills most of the screen — and since a jump also lands above that line, the breadcrumb still shows the same heading after you click it.
|
|
11
12
|
- **Heading level filter**: the `1`–`6` chips at the top of the panel are independent switches, so any combination works (e.g. H1 and H3 with H2 hidden) and the choice is remembered; switching off the last remaining level restores all six.
|
|
12
|
-
- **Search result list**: while a query is present the outline becomes a result list — one row per match, showing the matched heading or message with the keyword highlighted, its heading path, the turn time and a repeat count (plus a context snippet in full-text scope). Rows are chronological with the **newest hit at the bottom**, a fresh search starts at the newest hit and you scroll up to reach earlier ones; **clicking a row** makes that hit current, i.e. the same path as Enter stepping — it highlights the keyword in the conversation and scrolls there. `n/N` Enter-stepping is kept.
|
|
13
13
|
|
|
14
14
|
### Changed
|
|
15
|
-
- **Compatibility**: verified against and declared for DSH **0.1.5-rc.1 and 0.1.5-rc.2** (`engines.dsh` keeps its floor of `>=0.1.5-rc.1`). The host interface is identical in both — the session-scoped slot `conversation.input.overlay`, the `useChat` hook from `dsh-client-ui-chat` and the client-module seed table were all checked against the installed bundles.
|
|
16
15
|
- **Performance**: heading parsing and text extraction are now cached per node, so a streaming update only re-processes the node that changed instead of the whole history; the cache drops nodes that left the conversation, keeping it bounded.
|
|
16
|
+
- The turn header (the time row) now jumps to the **start of that turn's model reply** (it used to jump to the user message).
|
|
17
|
+
- **Compatibility**: verified against and declared for DSH **0.1.5-rc.1 and 0.1.5-rc.2** (`engines.dsh` keeps its floor of `>=0.1.5-rc.1`). The host interface is identical in both — the session-scoped slot `conversation.input.overlay`, the `useChat` hook from `dsh-client-ui-chat` and the client-module seed table were all checked against the installed bundles.
|
|
17
18
|
- `countOccurrences` now guards an empty needle (an empty query made `indexOf` spin in place — an infinite loop; every current call site is guarded, so this is hardening).
|
|
18
19
|
|
|
19
20
|
### Fixed
|
|
20
21
|
- The outline did not jump to the newest turn when content first appeared: that effect's dependency array was written above the `groups` declaration, so it always evaluated to `0` during render and the effect only ever ran on mount. The effect now sits below `groups` and depends on `groups.length`.
|
|
21
|
-
- Result rows always reported a repeat count of 1 (the `×N` badge never appeared), which also made the "row holding the current match" highlight land on the next row when one heading matched twice. Each row now records its real occurrence count.
|
|
22
22
|
- Dragging the top bar to move the panel persisted the position from **before** the drag (the closure kept the value captured at pointer-down), so the panel jumped back to its old spot after a reload. It now stores the position the drag ended at.
|
|
23
|
-
- In full-text scope, clicking a row whose hit was in a message body only scrolled and never highlighted anything (the click used the jump-only path while highlighting only happened while Enter-stepping). Clicking a result row now shares the stepping path: highlight that hit, scroll to it, and update both `n/N` and the highlighted row.
|
|
24
23
|
- When the same keyword occurred more than once inside one text node, the in-chat highlight wrapped only the FIRST occurrence there, so the later one was neither tinted nor eligible to be marked as the current hit — stepping to it found no current mark and degraded to a plain scroll with no distinct highlight. Every occurrence inside each text node is now wrapped in order, so the in-conversation hit order lines up with `n/N`.
|
|
25
|
-
- Breadcrumb and jump were inconsistent: detection used "the last heading above the viewport top" while a jump puts the heading 20 px below the top, so clicking the breadcrumb switched it to the previous heading. Both now use the viewport's **middle line**, which both reflects the section filling most of the screen and stays consistent with every jump target.
|
|
26
|
-
- The level filter used to be a "show up to level N" prefix that could not skip an intermediate level; it is now a per-level switch.
|
|
27
|
-
- The turn header (the time row) jumped to the turn's **user message**; it now jumps to the **start of that turn's model reply**, and turns without any headings — which have only this row in the panel — are clickable too.
|
|
28
24
|
- `# comment` / `## example` lines inside a ``` fenced code block were treated as headings and leaked into the outline: they have no element to jump to, and they shifted the index of the real headings after them so those jumped to the wrong place. Heading parsing now skips fenced blocks (``` and ~~~, info strings, longer closing fences, up to 3 spaces of indentation).
|
|
29
|
-
|
|
25
|
+
|
|
26
|
+
## [0.4.1] - 2026-09-12
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
- **Heading levels are now a popup**: a round icon button in the header (three lines of decreasing width, hover feedback matching the magnifier) scales the H1–H6 picker out of the **button's center**, right-aligned with an outer shadow; closing shrinks it back into the button with a fade. The picker no longer occupies its own row, the chips are labelled H1–H6, and their selected tint matches the title / full-text toggle.
|
|
30
|
+
- Removed the "you are here" breadcrumb row introduced in 0.4.0 (it felt unnecessary in use).
|
|
30
31
|
|
|
31
32
|
## [0.3.3] - 2026-09-10
|
|
32
33
|
|
package/CHANGELOG.md
CHANGED
|
@@ -5,28 +5,29 @@
|
|
|
5
5
|
## [0.4.0] - 2026-09-11
|
|
6
6
|
|
|
7
7
|
### 新增
|
|
8
|
+
- **搜索结果列表**:有搜索词时大纲切换为结果列表,逐条列出命中(标题关键字高亮、层级路径、回合时间、重复次数,全文模式附上下文片段)。列表按时间排列、**最新的命中在底部**,开始搜索时自动定位到最新命中,向上滚回看更早的命中;点击任一行会把该命中设为当前命中——和回车逐处跳同一条路径,会在对话里高亮并滚过去;`n/N` 回车逐处跳保留
|
|
8
9
|
- **组头吸顶**:滚动大纲时,当前所在回合的组头固定在面板顶部,并与上方工具条紧贴
|
|
9
10
|
- **层级筛选行可收起**:标题栏放大镜左边的 **层级** 按钮收起/展开 `1`–`6` 那一行(选择会记住;收起后筛选设置仍然生效)
|
|
10
11
|
- **位置面包屑**:面板顶部显示你正在读的章节路径,点击可跳到该标题。判定规则是"视口中线之上最深的标题"(画面里占得最多的那一节);跳转落点也在中线之上,所以点完后面包屑显示的仍是同一个标题
|
|
11
12
|
- **标题层级筛选**:面板顶部 `1`–`6` 芯片是各自独立的开关,可任意组合(例如只留 H1 与 H3、关掉中间的 H2),选择会记住;把最后一个亮着的层级也关掉时自动恢复显示全部六级
|
|
12
|
-
- **搜索结果列表**:有搜索词时大纲切换为结果列表,逐条列出命中(标题关键字高亮、层级路径、回合时间、重复次数,全文模式附上下文片段)。列表按时间排列、**最新的命中在底部**,开始搜索时自动定位到最新命中,向上滚回看更早的命中;点击任一行会把该命中设为当前命中——和回车逐处跳同一条路径,会在对话里高亮并滚过去;`n/N` 回车逐处跳保留
|
|
13
13
|
|
|
14
14
|
### 变更
|
|
15
|
-
- **兼容性**:在 DSH **0.1.5-rc.1 与 0.1.5-rc.2** 上验证并声明兼容(`engines.dsh` 下限仍为 `>=0.1.5-rc.1`)。两版的宿主接口一致——会话级槽位 `conversation.input.overlay`、`dsh-client-ui-chat` 的 `useChat` hook 与客户端模块 seed 表都经实测核对相同。
|
|
16
15
|
- **性能**:标题解析与文本提取改为按节点缓存——流式更新只重算真正变化的节点,不再每次重算整段历史;缓存会清理已离开会话的节点,保持有界
|
|
16
|
+
- 回合组头(时间那一行)点击改为跳到**该回合模型回答的开头**(原来跳到用户消息位置)
|
|
17
|
+
- **兼容性**:在 DSH **0.1.5-rc.1 与 0.1.5-rc.2** 上验证并声明兼容(`engines.dsh` 下限仍为 `>=0.1.5-rc.1`)。两版的宿主接口一致——会话级槽位 `conversation.input.overlay`、`dsh-client-ui-chat` 的 `useChat` hook 与客户端模块 seed 表都经实测核对相同。
|
|
17
18
|
- `countOccurrences` 增加空查询守卫(空查询会让 `indexOf` 原地打转导致死循环;现有调用点都有守卫,此举为加固)
|
|
18
19
|
|
|
19
20
|
### 修复
|
|
20
21
|
- 大纲首次载入内容时没有自动定位到最新回合:该副作用的依赖数组写在 `groups` 声明之前,渲染时读到的永远是 `0`,导致副作用只在挂载时执行一次。已把副作用移到 `groups` 之后并直接依赖 `groups.length`。
|
|
21
|
-
- 搜索结果行的重复次数恒为 1(`×N` 从不显示),并连带使"当前命中所属行"在重复命中时定位到下一行。现在每行记录真实的出现次数。
|
|
22
22
|
- 拖动顶部横条调整面板垂直位置后,记录的仍是**拖动前**的位置(写入的是拖动开始时闭包里的旧值),刷新后面板跳回原位。现在写入拖动结束时的实际位置。
|
|
23
|
-
- 全文搜索时,正文命中行点击后只滚动、不高亮(点击走的是"仅跳转"路径,而高亮只在回车逐处跳里做)。现在点击结果行与回车逐处跳共用同一条路径:先高亮该处,再滚过去,同时更新 `n/N` 与当前行高亮。
|
|
24
23
|
- 同一段文本里同一关键字出现多次时,对话内高亮只包住**该文本节点里的第一处**:第二处既不染色,也无法被标成"当前命中",于是跳到第二处时找不到当前标记,退化成"只滚动、没有高亮"。现在每个文本节点内的所有出现都会依次包住,对话内命中序号与 `n/N` 完全对齐。
|
|
25
|
-
- 面包屑与跳转错位:判定用"视口顶部之上最后一个标题",而跳转把标题放在"顶部 +20px",于是点完面包屑就会换成上一个标题。现在统一以**视口中线**为基准(既反映画面里占得最多的那一节,又与所有跳转落点自洽)。
|
|
26
|
-
- 层级筛选原本是"显示到第 N 级"的前缀语义,无法跳过中间层级;现在改为逐级开关。
|
|
27
|
-
- 回合组头(时间那一行)原本跳到该回合的**用户消息**位置;现在跳到**该回合模型回答的开头**,并且没有标题的回合(面板里只剩时间行)也能点。
|
|
28
24
|
- ``` 围栏代码块里的 `# 注释` / `## 示例` 会被当成标题混进大纲(既没有可跳转的目标,又会让它后面那些真标题的序号错位、跳到错误位置)。现在解析标题时会跳过围栏代码块(支持 ``` 与 ~~~、带 info string 的开栏、更长的闭栏、最多 3 空格缩进)。
|
|
29
|
-
|
|
25
|
+
|
|
26
|
+
## [0.4.1] - 2026-09-12
|
|
27
|
+
|
|
28
|
+
### 变更
|
|
29
|
+
- **层级筛选改为弹出选择**:标题栏新增圆形图标按钮(三条递减横线,悬停反馈与放大镜一致),点击后从**按钮中心**放大弹出 H1–H6 选择层(靠右、带外阴影),收回时缩回按钮并渐隐,不再单独占一行;选择芯片标注 H1–H6,选中态配色与搜索的"标题 / 全文"切换一致
|
|
30
|
+
- 移除面板顶部的"当前位置"面包屑行(0.4.0 新增,使用中显得多余)
|
|
30
31
|
|
|
31
32
|
## [0.3.3] - 2026-09-10
|
|
32
33
|
|
package/README.en.md
CHANGED
|
@@ -6,32 +6,29 @@ A conversation TOC plugin for [DeepSeek Harness](https://github.com/deepseek-ai/
|
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- **Turn-grouped outline** — each user message plus its following AI replies form one group; the group header shows the turn's
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
12
|
-
- **
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
15
|
-
- **
|
|
16
|
-
- **
|
|
17
|
-
- **
|
|
18
|
-
- **
|
|
19
|
-
- **
|
|
20
|
-
-
|
|
21
|
-
- **Paging and loading older** — the most recent groups show first; scrolling up inside the outline loads older groups
|
|
22
|
-
- **Markdown-aware titles** — inline markup in headings (`**bold**`, `*italic*`, `` `code` ``, `[links](url)`, `~~strike~~`) is stripped before display
|
|
23
|
-
- **Chat view only** — when the center column switches to another view (trajectory, context, …), the panel and its edge handle fade out
|
|
24
|
-
- When the conversation has no headings at all, the outline lists clickable turn-time entries only; it hides itself when not even a time can be read. It adapts to the dark and light themes (the inner-shadow card follows the theme)
|
|
9
|
+
- **Turn-grouped outline** — each user message plus its following AI replies form one group; the group header shows the turn's time and a first-line preview, and clicking it jumps to the start of that turn's model reply
|
|
10
|
+
- **Search** — the magnifier in the panel header opens a search box: title / full-text scopes, click any result row to locate and highlight that hit, `n/N` Enter stepping, Esc to close
|
|
11
|
+
- **In-chat highlighting** — matched keywords are highlighted in the conversation; the current match is highlighted distinctly
|
|
12
|
+
- **Sticky group headers** — while scrolling the outline, the current turn's header stays pinned at the top of the panel
|
|
13
|
+
- **Heading level filter** — the round levels button in the header pops down H1–H6 switches for any combination
|
|
14
|
+
- **Auto-follow** — the turn being read lights up in the outline while you scroll the conversation; the outline loads and follows on its own
|
|
15
|
+
- **Jumping** — click a heading to jump to its position in the conversation
|
|
16
|
+
- **Dockable and resizable** — drag the top bar to move the panel, ◀ / ▶ to dock left or right, drag an edge to resize, and collapse it into an edge handle; position and size are remembered
|
|
17
|
+
- **Paging** — the most recent groups show first; scroll up to load older turns
|
|
18
|
+
- **Markdown-aware** — inline markup in headings is stripped; `#` lines inside fenced code blocks are not headings
|
|
19
|
+
- **Theme-aware** — adapts to dark and light themes; visible on the chat view only and fades out elsewhere
|
|
20
|
+
- The panel hides itself when the conversation has neither headings nor readable times
|
|
25
21
|
|
|
26
22
|
## Compatibility
|
|
27
23
|
|
|
28
24
|
| Plugin | Supported DSH |
|
|
29
25
|
| --- | --- |
|
|
30
|
-
| **0.4.
|
|
26
|
+
| **0.4.1** (latest) | 0.1.5-rc.1, 0.1.5-rc.2 |
|
|
27
|
+
| 0.4.0 | 0.1.5-rc.1, 0.1.5-rc.2 |
|
|
31
28
|
| 0.3.3 | 0.1.5-rc.1 |
|
|
32
29
|
| 0.3.0 – 0.3.2 | ≥ 0.1.2-rc.1 |
|
|
33
30
|
|
|
34
|
-
`engines.dsh` has a floor of **0.1.5-rc.1** (`>=`): from that release on, the plugin uses the host's session-scoped slot injection. 0.4.0 has been verified against **0.1.5-rc.1 and 0.1.5-rc.2** and declares exactly those; older or newer DSH versions are unverified and therefore not claimed. On an older DSH, the newest usable plugin version is **0.3.2**. On install or update, the DSH market pre-flights host compatibility from `engines.dsh`, `dsh.compatibility.dshReleases` and `peerDependencies` in `package.json`.
|
|
31
|
+
`engines.dsh` has a floor of **0.1.5-rc.1** (`>=`): from that release on, the plugin uses the host's session-scoped slot injection. Since 0.4.0 the plugin has been verified against **0.1.5-rc.1 and 0.1.5-rc.2** and declares exactly those; older or newer DSH versions are unverified and therefore not claimed. On an older DSH, the newest usable plugin version is **0.3.2**. On install or update, the DSH market pre-flights host compatibility from `engines.dsh`, `dsh.compatibility.dshReleases` and `peerDependencies` in `package.json`.
|
|
35
32
|
|
|
36
33
|
## Install
|
|
37
34
|
|
|
@@ -57,12 +54,12 @@ After installing, restart DSH and open the Web UI. The panel starts collapsed; c
|
|
|
57
54
|
|
|
58
55
|
## Usage
|
|
59
56
|
|
|
60
|
-
- **Jumping**: click
|
|
61
|
-
- **Search**:
|
|
62
|
-
- **Level filter**:
|
|
63
|
-
- **Moving and docking**: drag the top bar to move
|
|
64
|
-
- **Resizing**: drag the right edge
|
|
65
|
-
- **Loading older turns**: scroll up inside the outline
|
|
57
|
+
- **Jumping**: click an outline heading or a group header to jump to it
|
|
58
|
+
- **Search**: open the box with the magnifier, click a result to locate and highlight it, Enter to step through matches, Esc to close
|
|
59
|
+
- **Level filter**: click the round levels button in the header to pop down the H1–H6 switches
|
|
60
|
+
- **Moving and docking**: drag the top bar to move, ◀ / ▶ to switch sides
|
|
61
|
+
- **Resizing**: drag the right edge, bottom edge or bottom-right corner
|
|
62
|
+
- **Loading older turns**: scroll up inside the outline
|
|
66
63
|
|
|
67
64
|
## Development
|
|
68
65
|
|
package/README.md
CHANGED
|
@@ -6,32 +6,29 @@
|
|
|
6
6
|
|
|
7
7
|
## 功能
|
|
8
8
|
|
|
9
|
-
- **按回合分组** —— 每条用户消息 + 其后续 AI
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
- **分页与加载更早** —— 默认显示最近的若干组;在大纲中向上滚动(或滚动到顶部)会加载更早的组
|
|
22
|
-
- **Markdown 清理** —— 标题中的行内标记(`**加粗**`、`*斜体*`、`` `代码` ``、`[链接](url)`、`~~删除线~~`)会被剥离后显示
|
|
23
|
-
- **仅对话视图显示** —— 中间列切到轨迹、上下文等其他视图时,面板与边缘把手渐隐
|
|
24
|
-
- 对话中没有任何标题时,大纲只列出可点击跳转的回合时间条目;连时间也识别不到时面板自动隐藏。适配深色与浅色主题(内阴影质感随主题切换)
|
|
9
|
+
- **按回合分组** —— 每条用户消息 + 其后续 AI 回复为一组,组头显示回合时间与首行预览,点击跳到该回合模型回答的开头
|
|
10
|
+
- **搜索** —— 标题栏放大镜打开搜索框:标题 / 全文两种范围,结果列表点击任一条定位并高亮,`n/N` 回车逐处跳,Esc 关闭
|
|
11
|
+
- **对话内高亮** —— 命中的关键字在对话中高亮,当前命中单独标亮
|
|
12
|
+
- **组头吸顶** —— 滚动大纲时,当前回合的组头固定在面板顶部
|
|
13
|
+
- **层级筛选** —— 标题栏的圆形层级按钮弹出 H1–H6 开关,任意组合显示
|
|
14
|
+
- **自动跟随** —— 滚动对话时正在阅读的回合在大纲中自动点亮,其余变暗;大纲自动加载并跟随
|
|
15
|
+
- **跳转** —— 点击标题跳到对话中该标题的位置;面板与对话双向定位
|
|
16
|
+
- **可停靠、可缩放** —— 拖顶部横条移动,◀ / ▶ 切换左右停靠,拖边缘调宽高,收起后成为边缘把手;位置与尺寸会被记住
|
|
17
|
+
- **分页** —— 默认显示最近的若干组,向上滚动加载更早的回合
|
|
18
|
+
- **Markdown 感知** —— 标题中的行内标记会被剥离;围栏代码块里的 `#` 行不算标题
|
|
19
|
+
- **主题适配** —— 深色 / 浅色主题自适应;仅对话视图显示,切到其他视图渐隐
|
|
20
|
+
- 对话中没有标题也没有可识别时间时面板自动隐藏
|
|
25
21
|
|
|
26
22
|
## 兼容性
|
|
27
23
|
|
|
28
24
|
| 插件版本 | 支持的 DSH 版本 |
|
|
29
25
|
| --- | --- |
|
|
30
|
-
| **0.4.
|
|
26
|
+
| **0.4.1**(最新) | 0.1.5-rc.1、0.1.5-rc.2 |
|
|
27
|
+
| 0.4.0 | 0.1.5-rc.1、0.1.5-rc.2 |
|
|
31
28
|
| 0.3.3 | 0.1.5-rc.1 |
|
|
32
29
|
| 0.3.0 – 0.3.2 | ≥ 0.1.2-rc.1 |
|
|
33
30
|
|
|
34
|
-
`engines.dsh` 下限为 **0.1.5-rc.1**(`>=`,该版本起插件改用会话级槽位注入的宿主接口);0.4.0
|
|
31
|
+
`engines.dsh` 下限为 **0.1.5-rc.1**(`>=`,该版本起插件改用会话级槽位注入的宿主接口);0.4.0 起在 **0.1.5-rc.1 与 0.1.5-rc.2** 上验证过并声明兼容,更早或更新的 DSH 版本未经验证,不作声明。在更早的 DSH 上,可安装的最新插件版本是 **0.3.2**。安装或更新时,DSH 市场会依据 `package.json` 中的 `engines.dsh`、`dsh.compatibility.dshReleases` 与 `peerDependencies` 做宿主兼容预检。
|
|
35
32
|
|
|
36
33
|
## 安装
|
|
37
34
|
|
|
@@ -57,12 +54,12 @@ dsh plugin --profile web add <插件目录路径>
|
|
|
57
54
|
|
|
58
55
|
## 使用
|
|
59
56
|
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
57
|
+
- **跳转**:点击大纲标题或组头跳到对应位置
|
|
58
|
+
- **搜索**:放大镜打开搜索框,输入后点结果定位并高亮,回车逐处跳,Esc 关闭
|
|
59
|
+
- **层级筛选**:点标题栏的圆形层级按钮弹出 H1–H6 开关,选择显示的层级
|
|
60
|
+
- **移动与停靠**:拖顶部横条移动,◀ / ▶ 切换左右停靠
|
|
61
|
+
- **调整大小**:拖右边缘、下边缘或右下角
|
|
62
|
+
- **加载更早**:在大纲中向上滚动
|
|
66
63
|
|
|
67
64
|
## 开发
|
|
68
65
|
|
package/lib/client.js
CHANGED
|
@@ -617,27 +617,43 @@ window.__ModuleLoader__.load({
|
|
|
617
617
|
try { localStorage.setItem(LEVELS_KEY, JSON.stringify(next)); } catch (e) {}
|
|
618
618
|
};
|
|
619
619
|
|
|
620
|
-
// ---- level
|
|
621
|
-
//
|
|
622
|
-
//
|
|
623
|
-
var
|
|
624
|
-
var
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
var
|
|
628
|
-
var
|
|
629
|
-
var
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
620
|
+
// ---- heading-level picker popup (transient): opens from the round button
|
|
621
|
+
// next to the search button; closes on an outside pointerdown. Closing
|
|
622
|
+
// plays a short shrink-back animation before unmounting. ----
|
|
623
|
+
var _sLo = react.useState(false);
|
|
624
|
+
var levelsOpen = _sLo[0];
|
|
625
|
+
var setLevelsOpen = _sLo[1];
|
|
626
|
+
var _sLc = react.useState(false);
|
|
627
|
+
var levelsClosing = _sLc[0];
|
|
628
|
+
var setLevelsClosing = _sLc[1];
|
|
629
|
+
var closeLevels = function () {
|
|
630
|
+
if (!levelsOpen || levelsClosing) return;
|
|
631
|
+
setLevelsClosing(true);
|
|
632
|
+
// unmount when the exit animation actually finishes (fallback timer in
|
|
633
|
+
// case animationend never fires, e.g. display:none ancestors)
|
|
634
|
+
var popped = document.querySelector(".dqt-levels-pop");
|
|
635
|
+
var done = false;
|
|
636
|
+
var finish = function () {
|
|
637
|
+
if (done) return;
|
|
638
|
+
done = true;
|
|
639
|
+
if (popped && popped.removeEventListener) popped.removeEventListener("animationend", finish);
|
|
640
|
+
setLevelsOpen(false);
|
|
641
|
+
setLevelsClosing(false);
|
|
642
|
+
};
|
|
643
|
+
if (popped && popped.addEventListener) popped.addEventListener("animationend", finish);
|
|
644
|
+
setTimeout(finish, 220);
|
|
633
645
|
};
|
|
646
|
+
react.useEffect(function () {
|
|
647
|
+
if (!levelsOpen) return;
|
|
648
|
+
var close = function (e) {
|
|
649
|
+
var t = e.target;
|
|
650
|
+
if (t && t.closest && (t.closest(".dqt-levels-pop") || t.closest(".dqt-levels-btn"))) return;
|
|
651
|
+
closeLevels();
|
|
652
|
+
};
|
|
653
|
+
document.addEventListener("pointerdown", close);
|
|
654
|
+
return function () { document.removeEventListener("pointerdown", close); };
|
|
655
|
+
}, [levelsOpen, levelsClosing]);
|
|
634
656
|
|
|
635
|
-
// ---- breadcrumb: the heading the reader is currently inside ----
|
|
636
|
-
var _sCrumb = react.useState(null);
|
|
637
|
-
var crumb = _sCrumb[0];
|
|
638
|
-
var setCrumb = _sCrumb[1];
|
|
639
|
-
var crumbRef = react.useRef(null);
|
|
640
|
-
var headingPathsRef = react.useRef({});
|
|
641
657
|
|
|
642
658
|
// ---- pagination: show the latest N groups; scrolling to the top loads older ----
|
|
643
659
|
var PAGE_SIZE = 6;
|
|
@@ -1004,7 +1020,7 @@ window.__ModuleLoader__.load({
|
|
|
1004
1020
|
return m;
|
|
1005
1021
|
}, [groups]);
|
|
1006
1022
|
|
|
1007
|
-
// ancestor path of every heading occurrence (
|
|
1023
|
+
// ancestor path of every heading occurrence (used by the search result rows):
|
|
1008
1024
|
// id -> { path, title, level, gi }
|
|
1009
1025
|
var headingPaths = react.useMemo(function () {
|
|
1010
1026
|
var byId = {};
|
|
@@ -1076,7 +1092,6 @@ window.__ModuleLoader__.load({
|
|
|
1076
1092
|
}
|
|
1077
1093
|
return rows;
|
|
1078
1094
|
}, [groups, query, searchScope, headingPaths]);
|
|
1079
|
-
headingPathsRef.current = headingPaths;
|
|
1080
1095
|
react.useEffect(function () {
|
|
1081
1096
|
var sp = document.querySelector("[data-conversation-scroll]");
|
|
1082
1097
|
if (!sp) return;
|
|
@@ -1123,43 +1138,6 @@ window.__ModuleLoader__.load({
|
|
|
1123
1138
|
}
|
|
1124
1139
|
}
|
|
1125
1140
|
}
|
|
1126
|
-
// breadcrumb: the heading of the section that occupies most of the
|
|
1127
|
-
// viewport — i.e. the deepest heading above the viewport's MIDDLE line.
|
|
1128
|
-
// Walking backwards lets a heading we cannot map (e.g. one inside a tool
|
|
1129
|
-
// result) fall back to the nearest mapped ancestor heading.
|
|
1130
|
-
//
|
|
1131
|
-
// The middle line is what makes this consistent with every jump: a jump
|
|
1132
|
-
// (outline click, breadcrumb click, match stepping) always lands its
|
|
1133
|
-
// target ABOVE the middle, so clicking the breadcrumb never changes
|
|
1134
|
-
// which heading the breadcrumb shows.
|
|
1135
|
-
var crumbLine = vTop + lr.height * 0.5;
|
|
1136
|
-
var heads = sp.querySelectorAll("h1,h2,h3,h4,h5,h6");
|
|
1137
|
-
var nextCrumb = null;
|
|
1138
|
-
var paths = headingPathsRef.current;
|
|
1139
|
-
for (var hi = heads.length - 1; hi >= 0; hi--) {
|
|
1140
|
-
var hr = heads[hi].getBoundingClientRect();
|
|
1141
|
-
if (hr.top > crumbLine) continue;
|
|
1142
|
-
var rowEl = heads[hi].closest ? heads[hi].closest("[data-chat-anchor-key]") : null;
|
|
1143
|
-
if (!rowEl || !rowEl.dataset) continue;
|
|
1144
|
-
var rowKey = rowEl.dataset.chatAnchorKey;
|
|
1145
|
-
var rowHeads = rowEl.querySelectorAll("h1,h2,h3,h4,h5,h6");
|
|
1146
|
-
var idxInRow = -1;
|
|
1147
|
-
for (var rh = 0; rh < rowHeads.length; rh++) {
|
|
1148
|
-
if (rowHeads[rh] === heads[hi]) { idxInRow = rh; break; }
|
|
1149
|
-
}
|
|
1150
|
-
var meta = idxInRow >= 0 ? paths[rowKey + "#" + idxInRow] : undefined;
|
|
1151
|
-
if (meta !== undefined) {
|
|
1152
|
-
nextCrumb = { path: meta.path, key: rowKey, idx: idxInRow };
|
|
1153
|
-
break;
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
var prev = crumbRef.current;
|
|
1157
|
-
var same = (prev === null && nextCrumb === null) ||
|
|
1158
|
-
(prev !== null && nextCrumb !== null && prev.path === nextCrumb.path && prev.key === nextCrumb.key && prev.idx === nextCrumb.idx);
|
|
1159
|
-
if (!same) {
|
|
1160
|
-
crumbRef.current = nextCrumb;
|
|
1161
|
-
setCrumb(nextCrumb);
|
|
1162
|
-
}
|
|
1163
1141
|
};
|
|
1164
1142
|
update();
|
|
1165
1143
|
sp.addEventListener("scroll", update, { passive: true });
|
|
@@ -1540,28 +1518,54 @@ window.__ModuleLoader__.load({
|
|
|
1540
1518
|
react_jsx_runtime.jsx("div", {
|
|
1541
1519
|
style: { display: "flex", alignItems: "center", gap: 6, flex: "none" },
|
|
1542
1520
|
children: [
|
|
1543
|
-
//
|
|
1544
|
-
//
|
|
1521
|
+
// heading-level filter: a round icon button (directly left
|
|
1522
|
+
// of the search button) that pops down the H1–H6 picker.
|
|
1523
|
+
// Icon: three lines of decreasing width = outline levels.
|
|
1524
|
+
// Hover behaviour matches the magnifier: background + icon
|
|
1525
|
+
// tint change; the resting look never shifts when open.
|
|
1545
1526
|
react_jsx_runtime.jsx("button", {
|
|
1546
|
-
|
|
1547
|
-
|
|
1527
|
+
className: "dqt-levels-btn",
|
|
1528
|
+
onClick: function () { levelsOpen ? closeLevels() : setLevelsOpen(true); },
|
|
1529
|
+
title: "标题层级筛选",
|
|
1548
1530
|
style: {
|
|
1549
|
-
|
|
1550
|
-
|
|
1531
|
+
width: 24,
|
|
1532
|
+
height: 24,
|
|
1533
|
+
padding: 0,
|
|
1551
1534
|
border: "none",
|
|
1552
|
-
borderRadius:
|
|
1535
|
+
borderRadius: "50%",
|
|
1553
1536
|
cornerShape: "round",
|
|
1554
|
-
fontFamily: "inherit",
|
|
1555
|
-
fontSize: 11,
|
|
1556
|
-
lineHeight: "20px",
|
|
1557
1537
|
cursor: "pointer",
|
|
1558
1538
|
flex: "none",
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1539
|
+
display: "flex",
|
|
1540
|
+
alignItems: "center",
|
|
1541
|
+
justifyContent: "center",
|
|
1542
|
+
background: "var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,0.16))",
|
|
1543
|
+
color: C.muted,
|
|
1544
|
+
transition: "background 0.15s ease, color 0.15s ease"
|
|
1563
1545
|
},
|
|
1564
|
-
|
|
1546
|
+
onMouseEnter: function (e) {
|
|
1547
|
+
e.currentTarget.style.background = "var(--dsw-alias-interactive-bg-active, rgba(79,140,255,0.24))";
|
|
1548
|
+
e.currentTarget.style.color = "var(--dsw-alias-brand-primary, #4f8cff)";
|
|
1549
|
+
},
|
|
1550
|
+
onMouseLeave: function (e) {
|
|
1551
|
+
e.currentTarget.style.background = "var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,0.16))";
|
|
1552
|
+
e.currentTarget.style.color = C.muted;
|
|
1553
|
+
},
|
|
1554
|
+
children: react_jsx_runtime.jsx("svg", {
|
|
1555
|
+
width: 14,
|
|
1556
|
+
height: 14,
|
|
1557
|
+
viewBox: "0 0 14 14",
|
|
1558
|
+
fill: "none",
|
|
1559
|
+
stroke: "currentColor",
|
|
1560
|
+
strokeWidth: 1.8,
|
|
1561
|
+
strokeLinecap: "round",
|
|
1562
|
+
style: { display: "block" },
|
|
1563
|
+
children: [
|
|
1564
|
+
react_jsx_runtime.jsx("line", { x1: 1.5, y1: 3, x2: 12.5, y2: 3 }),
|
|
1565
|
+
react_jsx_runtime.jsx("line", { x1: 1.5, y1: 7, x2: 9, y2: 7 }),
|
|
1566
|
+
react_jsx_runtime.jsx("line", { x1: 1.5, y1: 11, x2: 5.5, y2: 11 })
|
|
1567
|
+
]
|
|
1568
|
+
})
|
|
1565
1569
|
}),
|
|
1566
1570
|
// magnifier button (SVG, matches the other buttons' style)
|
|
1567
1571
|
react_jsx_runtime.jsx("button", {
|
|
@@ -1654,67 +1658,6 @@ window.__ModuleLoader__.load({
|
|
|
1654
1658
|
})
|
|
1655
1659
|
]
|
|
1656
1660
|
}),
|
|
1657
|
-
// level filter row (H1–H6): can be collapsed away with the 层级 button
|
|
1658
|
-
// in the panel header
|
|
1659
|
-
showLevelsRow ? react_jsx_runtime.jsx("div", {
|
|
1660
|
-
style: {
|
|
1661
|
-
flex: "none",
|
|
1662
|
-
display: "flex",
|
|
1663
|
-
alignItems: "center",
|
|
1664
|
-
justifyContent: "space-between",
|
|
1665
|
-
flexWrap: "wrap",
|
|
1666
|
-
rowGap: 2,
|
|
1667
|
-
gap: 6,
|
|
1668
|
-
padding: "3px 10px 3px",
|
|
1669
|
-
borderBottom: crumb ? "none" : "1px solid " + C.panelBorder
|
|
1670
|
-
},
|
|
1671
|
-
children: [
|
|
1672
|
-
react_jsx_runtime.jsx("div", {
|
|
1673
|
-
style: { display: "flex", alignItems: "center", gap: 2, flex: "none" },
|
|
1674
|
-
children: [1, 2, 3, 4, 5, 6].map(function (lv) {
|
|
1675
|
-
var active = !!levelSet[lv];
|
|
1676
|
-
return react_jsx_runtime.jsx("button", {
|
|
1677
|
-
onClick: function () { toggleLevel(lv); },
|
|
1678
|
-
title: active ? "隐藏 H" + lv : "显示 H" + lv,
|
|
1679
|
-
style: {
|
|
1680
|
-
width: 17,
|
|
1681
|
-
height: 17,
|
|
1682
|
-
padding: 0,
|
|
1683
|
-
border: "none",
|
|
1684
|
-
borderRadius: 4,
|
|
1685
|
-
cornerShape: "round",
|
|
1686
|
-
cursor: "pointer",
|
|
1687
|
-
fontSize: 10,
|
|
1688
|
-
lineHeight: "17px",
|
|
1689
|
-
background: active
|
|
1690
|
-
? "rgba(79,140,255,0.22)"
|
|
1691
|
-
: "var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,0.14))",
|
|
1692
|
-
color: active ? "var(--dsw-alias-brand-primary, #4f8cff)" : C.muted,
|
|
1693
|
-
fontWeight: active ? 600 : 400
|
|
1694
|
-
},
|
|
1695
|
-
children: lv
|
|
1696
|
-
}, "lv" + lv);
|
|
1697
|
-
})
|
|
1698
|
-
})
|
|
1699
|
-
]
|
|
1700
|
-
}) : null,
|
|
1701
|
-
// breadcrumb: the heading path you are currently reading
|
|
1702
|
-
crumb ? react_jsx_runtime.jsx("div", {
|
|
1703
|
-
onClick: function () { jump(crumb.key, crumb.idx); },
|
|
1704
|
-
title: crumb.path,
|
|
1705
|
-
style: {
|
|
1706
|
-
flex: "none",
|
|
1707
|
-
padding: "0 10px 4px",
|
|
1708
|
-
borderBottom: "1px solid " + C.panelBorder,
|
|
1709
|
-
fontSize: 10,
|
|
1710
|
-
color: C.muted,
|
|
1711
|
-
whiteSpace: "nowrap",
|
|
1712
|
-
overflow: "hidden",
|
|
1713
|
-
textOverflow: "ellipsis",
|
|
1714
|
-
cursor: "pointer"
|
|
1715
|
-
},
|
|
1716
|
-
children: crumb.path
|
|
1717
|
-
}) : null,
|
|
1718
1661
|
// search input row: outer grid row animates 0fr<->1fr so the row
|
|
1719
1662
|
// collapses/expands to its EXACT natural height (no max-height
|
|
1720
1663
|
// overshoot stutter); the outline below moves smoothly with it
|
|
@@ -1934,7 +1877,58 @@ window.__ModuleLoader__.load({
|
|
|
1934
1877
|
},
|
|
1935
1878
|
onPointerDown: onResizeCornerDown,
|
|
1936
1879
|
title: "拖拽同时调整宽高"
|
|
1937
|
-
})
|
|
1880
|
+
}),
|
|
1881
|
+
// heading-level picker: pops down from the round header button,
|
|
1882
|
+
// right-aligned, with an outer shadow so it reads as a floating layer.
|
|
1883
|
+
// Open/close animate from the button's center: the animation lives in
|
|
1884
|
+
// the injected stylesheet (classes, not inline animation) so React
|
|
1885
|
+
// re-renders never restart or cancel it — an inline `animation` set on
|
|
1886
|
+
// every render made the entrance invisible and the exit never play.
|
|
1887
|
+
(levelsOpen || levelsClosing) ? react_jsx_runtime.jsx("div", {
|
|
1888
|
+
className: "dqt-levels-pop" + (levelsClosing ? " dqt-levels-pop-closing" : ""),
|
|
1889
|
+
style: {
|
|
1890
|
+
position: "absolute",
|
|
1891
|
+
top: 40,
|
|
1892
|
+
right: 8,
|
|
1893
|
+
zIndex: 30,
|
|
1894
|
+
display: "flex",
|
|
1895
|
+
alignItems: "center",
|
|
1896
|
+
flexWrap: "wrap",
|
|
1897
|
+
gap: 4,
|
|
1898
|
+
padding: 8,
|
|
1899
|
+
background: C.panelBg,
|
|
1900
|
+
border: "1px solid " + C.panelBorder,
|
|
1901
|
+
borderRadius: 10,
|
|
1902
|
+
cornerShape: "round",
|
|
1903
|
+
boxShadow: "0 6px 20px rgba(0, 0, 0, 0.28), 0 2px 6px rgba(0, 0, 0, 0.18)",
|
|
1904
|
+
maxWidth: "calc(100% - 16px)",
|
|
1905
|
+
transformOrigin: "calc(50% + 12px) top"
|
|
1906
|
+
},
|
|
1907
|
+
children: [1, 2, 3, 4, 5, 6].map(function (lv) {
|
|
1908
|
+
var active = !!levelSet[lv];
|
|
1909
|
+
return react_jsx_runtime.jsx("button", {
|
|
1910
|
+
onClick: function () { toggleLevel(lv); },
|
|
1911
|
+
title: active ? "隐藏 H" + lv : "显示 H" + lv,
|
|
1912
|
+
style: {
|
|
1913
|
+
height: 22,
|
|
1914
|
+
padding: "0 7px",
|
|
1915
|
+
border: "none",
|
|
1916
|
+
borderRadius: 6,
|
|
1917
|
+
cornerShape: "round",
|
|
1918
|
+
cursor: "pointer",
|
|
1919
|
+
fontSize: 11,
|
|
1920
|
+
lineHeight: "22px",
|
|
1921
|
+
fontFamily: "inherit",
|
|
1922
|
+
background: active
|
|
1923
|
+
? "rgba(79,140,255,0.18)"
|
|
1924
|
+
: "var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,0.14))",
|
|
1925
|
+
color: active ? "var(--dsw-alias-brand-primary, #4f8cff)" : C.muted,
|
|
1926
|
+
fontWeight: active ? 600 : 400
|
|
1927
|
+
},
|
|
1928
|
+
children: "H" + lv
|
|
1929
|
+
}, "lv" + lv);
|
|
1930
|
+
})
|
|
1931
|
+
}) : null
|
|
1938
1932
|
]
|
|
1939
1933
|
});
|
|
1940
1934
|
|
|
@@ -2269,6 +2263,12 @@ window.__ModuleLoader__.load({
|
|
|
2269
2263
|
var s = document.createElement("style");
|
|
2270
2264
|
s.id = "dsh-quick-toc-css";
|
|
2271
2265
|
s.textContent = "@keyframes dqt-spin{to{transform:rotate(360deg)}}@keyframes dqt-fade-in{from{opacity:0}to{opacity:1}}@keyframes dqt-fade-out{from{opacity:1}to{opacity:0}}" +
|
|
2266
|
+
"@keyframes dqt-pop-in{from{opacity:0;transform:scale(0.7)}to{opacity:1;transform:scale(1)}}@keyframes dqt-pop-out{from{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(0.7)}}" +
|
|
2267
|
+
// the level picker's enter/exit animations live here as classes so React
|
|
2268
|
+
// re-renders (which rewrite inline styles) cannot restart or cancel them
|
|
2269
|
+
".dqt-levels-pop{animation:dqt-pop-in 0.22s cubic-bezier(0.22, 0.9, 0.3, 1) both;will-change:transform,opacity}" +
|
|
2270
|
+
// exit: starts moving immediately (fast attack), so the dismiss feels snappy
|
|
2271
|
+
".dqt-levels-pop-closing{animation:dqt-pop-out 0.14s cubic-bezier(0.2, 0.9, 0.3, 1) both;will-change:transform,opacity}" +
|
|
2272
2272
|
// Hide the native scrollbar entirely (no arrow buttons, no grey bar) —
|
|
2273
2273
|
// custom webkit scrollbar styling was not reliably suppressing the
|
|
2274
2274
|
// default arrows, so a hidden native bar + the panel's inner shadow gives
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-quick-toc",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Conversation TOC for DeepSeek Harness (DSH): turn-grouped Markdown heading outline with keyword search (title/full-text scope), in-chat match highlighting, per-level heading filtering, auto-follow and smooth jump navigation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|