@gongfpp/dsh-novel-fish 0.1.6 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,13 +15,13 @@ DSH `0.2.1-rc.2` 的市场由用户信任并添加的静态 JSON 索引提供,
15
15
  1. 在设置中的实验性功能启用「自定义插件市场」(若「发现」页尚未出现)。
16
16
  2. 打开插件的「发现」页,通过索引源管理添加上面的 HTTPS 地址。
17
17
  3. 选择该索引,找到「小说摸鱼 / Novel Fish」,查看版本、来源和兼容范围后安装。
18
- 4. 选择最新的 **0.1.4**。按 [README](../README.md#开始读) 导入书籍并勾选原生区域类型。先停用其他接管思考区域的阅读插件;新版本不依赖旧阅读插件。
18
+ 4. 选择最新的 **0.2.1**。按 [README](../README.md#开始读) 导入书籍并勾选原生区域类型。先停用其他接管思考区域的阅读插件;新版本不依赖旧阅读插件。
19
19
 
20
- 已添加本索引的用户刷新索引后查看 0.1.4;若显示旧版本,请核对索引 URL 和网络缓存,再刷新插件页面。0.1.0 保留供明确选择旧版本,不作为最新推荐版本。
20
+ 已添加本索引的用户刷新索引后查看 0.2.1;若显示旧版本,请核对索引 URL 和网络缓存,再刷新插件页面。0.1.0 保留供明确选择旧版本,不作为最新推荐版本。
21
21
 
22
22
  目标 DSH 的发现页尚不提供原地升级:已安装旧版可用 README 的固定版本命令替换,或先卸载插件再从发现页安装。书库和进度属于当前站点的 IndexedDB,勿清除站点数据。
23
23
 
24
- 0.1.4 的远端索引已通过目标宿主官方解析器验证,推荐版本为 `0.1.4`;固定提交安装、README 标签和公开 tarball 三条隔离安装均通过,见 [发布实测](release.md) 和 [分发结果](evidence/public-release-014-result.json)。本轮没有新版真实市场卡片截图或可信展开全流程复验。
24
+ 自建索引现在包含 0.2.1;0.1.4 的远端索引曾通过目标宿主官方解析器验证,推荐版本为 `0.1.4` 是当时的记录;固定提交安装、README 标签和公开 tarball 三条隔离安装均通过,见 [发布实测](release.md) 和 [分发结果](evidence/public-release-014-result.json)。本轮没有新版真实市场卡片截图或可信展开全流程复验。
25
25
 
26
26
  索引里的 Git 来源固定为完整提交 SHA,不使用浮动分支或可移动 tag。索引可随发布追加版本,但已有版本的源码提交不会悄悄替换。GitHub 安装不要求 npm scope 所有权,也不需要先发布 npm 包。
27
27
 
@@ -29,7 +29,7 @@
29
29
 
30
30
  截图来自实际运行页面,只做裁切,没有重绘。文件 SHA-256:`e46f8dc81533f7b09e6d96aabf4c1697457659d47462906b3af31cd991fdda2d`。
31
31
 
32
- 可用本仓库原创的 [三章示例书](evidence/native-settings-sample.md) 手动补验文件导入、当前书籍菜单及删除取消,避免使用私人小说。
32
+ 可用本仓库的 [经典著作示例书](evidence/native-settings-sample.md)(老舍《骆驼祥子》第一章节选,拆为三节便于验证)手动补验文件导入、当前书籍菜单及删除取消,避免使用私人小说。
33
33
 
34
34
  ## 自动验证
35
35
 
@@ -18,11 +18,11 @@
18
18
  | 本插件详情页出现设置 | 已确认;书籍、类型、主标题及补充文字控件可见,配置位于组件列表前。 |
19
19
  | 原生圆角开关 | 已确认实际外观与 `switch` 语义;不是设置预览或模拟组件。 |
20
20
  | 关闭并刷新 | 关闭后读取到 `checked=false`;重新加载页面并进入详情,仍为关闭。 |
21
- | 新入口导入文件 | 实际通过文件输入导入原创示例 MD,显示 3 段、进度 `0 / 3`。 |
21
+ | 新入口导入文件 | 实际通过文件输入导入示例 MD(老舍《骆驼祥子》节选),显示 3 段、进度 `0 / 3`。 |
22
22
  | 再次开启 | 开关恢复 `checked=true`,示例书仍选中、进度仍为 `0 / 3`。 |
23
23
  | 通用设置 | 打开真实通用设置对话框,框内未出现小说阅读设置;旧入口注册也由构建产物测试禁止。 |
24
24
 
25
- ![真实插件详情页:原生阅读开关和原创示例书籍](evidence/plugin-settings-details.png)
25
+ ![真实插件详情页:原生阅读开关和示例书籍](evidence/plugin-settings-details.png)
26
26
 
27
27
  图片是上述真实界面的裁剪,去掉侧栏、账号、工作区、来源路径及下部内容;没有重绘界面。截图内仍为开发包的 `0.1.4`,不表示相同 npm 版本已获得此改动。
28
28
 
package/docs/release.md CHANGED
@@ -1,5 +1,44 @@
1
1
  # 公开发布记录
2
2
 
3
+ ## 0.2.1:修正插件图标元信息(2026-11-04)
4
+
5
+ - 修复 0.2.0 插件管理页的「包元信息错误」:`assets/icon.png` 为 380984 字节(372 KiB),超过宿主 `MAX_ICON_BYTES`(256 KiB)上限;`package.json` 也没有显式 `icon` 字段,只有 `./icon` 导出。宿主读取元信息时会因超限或旧路径失效报错,插件卡片回退到默认图标。
6
+ - 0.2.1 把图标重采样为 512×512 调色板 PNG(保留透明圆角,62056 字节),并在 `package.json` 增加 `"icon": "./assets/icon.png"`;`lib/client.js` 与阅读行为、宿主范围均与 0.2.0 相同。
7
+ - `pnpm verify`:110 项测试、109 通过、0 失败、1 跳过(HOST_ROOT 缺省时跳过真实宿主集成)。`HOST_ROOT` 探针:`ok=true`、7 项检查、claims=0(宿主 DSH 0.2.2-alpha.2)。细节与宿主实现依据见 [图标元信息修正记录](icon-metadata-021.md)。
8
+ - 真实页面:在运行中的 `127.0.0.1:3080` 实例上把 0.2.0 替换为 0.2.1,插件详情页显示版本 0.2.1、图标为鲸鱼读书图,包元信息错误消失;宿主进程未重启。
9
+ - [GitHub Release v0.2.1](https://github.com/gongfpp/dsh-novel-fish/releases/tag/v0.2.1) 于 `2026-11-04T08:17:32Z` 公开(tag 指向源码提交 `a88f119f2eaf7e6b9cf6b1cb1f2bc4ffd0ef9e2e`,非 prerelease)。附件:安装包 `gongfpp-dsh-novel-fish-0.2.1.tgz`(SHA-256 `bb45a9ad10a965f9d7f6dd20ffa021613f1134da9061aa190e105ab7ff34ae66`,1483460 字节)、源码 ZIP `dsh-novel-fish-source-0.2.1.zip`(SHA-256 `ef0885f94eb10f4b641abf964c74b04e9b713adb4796471d49725d148e4d1c00`)、`SHA256SUMS.txt`;附件匿名下载均 HTTP 200。
10
+ - 索引条目 `source.commit` 固定为 `a88f119f2eaf7e6b9cf6b1cb1f2bc4ffd0ef9e2e`。**npm 未发布 0.2.1**,`latest` 仍为 `0.1.6`。安装包在本节发布事实写入前打包,因此包内 `docs/**` 是修复提交的内容,不含最后几行;对应关系以 SHA-256 为准。
11
+
12
+ ## 0.2.0:1.0 功能定稿(2026-11-04)
13
+
14
+ - 范围:合并 0.1.6 的兼容声明与发布记录、0.1.7 的兼容候选和 0.1.8 的阅读行为,作为 1.0 的功能基线;此后只做数据安全、验证覆盖和发布流程收敛,不再改阅读功能。0.1.7 与 0.1.8 均未单独发布,随本版一起发布。
15
+ - 兼容声明从 0.1.6 的 `>=0.2.1-rc.2 <0.3.0-0` 收紧为 `>=0.2.1-rc.2 <=0.2.2-alpha.2`:区间是准入策略,不是验收结论;真实页面验收只在 alpha.2 完成,rc.3–rc.5 为宿主契约探针结果。收紧后未知 alpha 版本失败关闭,不静默降级。
16
+ - 新增设置「同一区域再次展开续读」(默认关闭,关闭时行为与 0.1.6 相同);聊天 DOM 观察合并到一帧;宿主契约探针增至 7 项(标题 shimmer 层、DisclosureRow、会话身份、turn-process 折叠锚点)。
17
+ - `pnpm verify`:110 项测试、109 通过、0 失败、1 跳过(HOST_ROOT 缺省时跳过真实宿主集成)。`HOST_ROOT` 探针:ok=true、7 项通过、claims=0(宿主 DSH 0.2.2-alpha.2)。
18
+ - 真实页面验收:在运行中的 127.0.0.1:3080 实例上,用独立临时浏览器 profile 先以 0.1.7 得到第 1 段基线,再安装 0.2.0 候选包;页面未刷新即完成客户端热更新(timeOrigin、会话与展开状态不变),插件详情页版本更新,服务 PID 97856 未重启。续读开关默认关闭,开启后同一区域依次得到第 2、3、4 段;关闭后重复展开保持第 4 段;另一区域读到第 5 段;进度保留。证据见 [0.2.0 验收证据](evidence/continuous-reading-020-result.json)。
19
+ - 尚未验证:真实聊天中的键盘、悬停、触屏展开路径,展示模式切换与 turn-process 折叠 reset,虚拟化重挂载,以及用户已打开的浏览器标签页。
20
+
21
+ - [GitHub Release v0.2.0](https://github.com/gongfpp/dsh-novel-fish/releases/tag/v0.2.0) 于 `2026-11-04T02:33:32Z` 公开(tag 指向源码提交 `e4fd3675bc6629cd7da141d036389d41270be9d2`,非 prerelease)。附件:安装包 `gongfpp-dsh-novel-fish-0.2.0.tgz`(SHA-256 `739073aa3810066ba68a71083d0e8001c58c62469160fe7979774147939752b6`,1802222 字节)、源码 ZIP `dsh-novel-fish-source-0.2.0.zip`(SHA-256 `c857e1b6ae802cc5ddfec1f34bb35bf0792cd77db673843d589779cc8b03a405`)、`SHA256SUMS.txt`;三个附件匿名下载均 HTTP 200。
22
+ - 索引条目 `source.commit` 固定为 `e4fd3675bc6629cd7da141d036389d41270be9d2`;0.2.0 条目的 `engines.dsh` 与包内声明一致(`>=0.2.1-rc.2 <=0.2.2-alpha.2`),已发布的历史条目保留各自当时的声明,不追溯改写。
23
+ - **npm 未发布 0.2.0。** 本机没有 npm 登录态;账号 2FA 下发布需要上一版记录的 90 天 Bypass 2FA granular token。npm `latest` 仍为 `0.1.6`。补发时需在源码提交 `e4fd367` 上 `npm publish`,再同步更新 `index.json` 的 `publishTimestamp` 与本节记录。
24
+ - 安装包在本节记录写入前打包,因此包内 `docs/**` 是 `e4fd367` 工作树的内容,不含最后几行发布事实;安装包与 registry/附件对应关系以 SHA-256 为准。
25
+
26
+ ## 0.1.6 宿主兼容区间与 npm 同步(2026-11-03)
27
+
28
+ - 改动只有兼容声明:`engines.dsh` 从精确 `0.2.1-rc.2` 改为区间 `>=0.2.1-rc.2 <0.3.0-0`,使 rc.3 及之后的 0.2.x 宿主能通过 preflight。阅读行为、书库、进度和浏览器 bundle 未变。
29
+ - npm 上此前只有 `0.1.4`(`0.1.5` 当时没有 npm 登录态,只走了 GitHub Release)。本次直接发 `0.1.6`,一次包含 0.1.5 的原生设置和本版兼容区间;没有单独补发 `0.1.5`,因为商店按 `latest` 取包,补一个只差兼容声明的中间版本只会让用户装到旧行为。`npm view` 现有版本为 `0.0.0-stage`、`0.1.4`、`0.1.6`。
30
+ - **区间是准入策略,不是验收结论。** 真实宿主上完整跑过的仍只有 DSH Web `0.2.1-rc.2`;`0.2.1-rc.3` 及之后的 GUI 行为未实测,不以后续版本的真实表现为默认成立。
31
+ - `pnpm verify`:`pnpm run build` 重建后 `lib/client.js` 与 HEAD 逐字一致(先用 npm 装依赖时出现过 `node_modules/.pnpm/...` 路径差异,已回滚并改用 pnpm 重装后重建,确认可复现),`pnpm test` **100/100** 通过。
32
+ - 发布契约测试同步更新:清单断言改为新区间;索引契约从「每个历史条目都必须等于当前清单」改为「最新条目必须等于清单,历史条目保留各自声明」,否则 0.1.0/0.1.4 的精确声明会被追溯篡改。
33
+ - npm 已发布 [@gongfpp/dsh-novel-fish@0.1.6](https://www.npmjs.com/package/@gongfpp/dsh-novel-fish),registry 时间 `2026-11-03T07:29:09.855Z`,`dist-tags.latest` 指向 `0.1.6`,75 个文件。
34
+ - shasum(SHA-1)`2365afae37252ecc84e1ec6aa67b41765021eede`
35
+ - integrity `sha512-VUqcMZEar18bEvsHe48/CC+Hv2FERo8nXdQn0J7PBzMe87x+OkQ4tKaCa8sALwvVrOheX/+0uHa0wgdYIz4DBA==`
36
+ - 本地 `npm pack @gongfpp/dsh-novel-fish@0.1.6` 取得的 tarball 与 registry shasum 一致,作为本次 Release 附件;该文件 SHA-256 为 `07e045ae43695cb82014cd25c00261ca52b361a321f311bfcff8a3ec1aa08d7e`(早前一次 npm 装依赖产出的本地包 SHA-256 为 `9ca23410…`,已废弃,不要用)。
37
+ - 账号启用了 2FA,`npm publish` 首次返回 `EOTP`;改用带 `Bypass 2FA` 的 granular access token(权限 `Read and write (publish and stage)`、仅限本包、90 天)完成发布,未关闭账号 2FA。
38
+ - [GitHub Release v0.1.6](https://github.com/gongfpp/dsh-novel-fish/releases/tag/v0.1.6) 于 `2026-11-03T07:34:50Z` 公开(tag 指向 `16f7c31`,非 prerelease)。附件:安装包、源码 ZIP(`git archive` 取自标签,91 项、无不安全路径)、`SHA256SUMS`。三个附件匿名下载均 HTTP 200,下载后 `sha256sum -c SHA256SUMS` 两项 OK。
39
+ - 索引条目 `source.commit` 固定为 `16f7c31e7747395af4dbc527f2717b759833b098`(源码提交)。**注意:`index.json` 和 `docs/**` 都在 `package.json` 的发布文件列表里**,所以已发布 tarball 内的 `index.json` 只到 `0.1.5`、`docs/release.md` 也没有本节。追加记录本身会改变包内容,因此不在本版内回填——tarball 与 registry 的对应关系以 shasum 为准,仓库主干另行补记。
40
+ - `index.json` 的 `versions` 是「公开发布目录」,来源可以是 npm 也可以是 GitHub Release,**不等价于 npm 上存在该版本**:`0.1.0`、`0.1.5` 都从未出现在 npm。因此不能用它去校验 npm 安装能力。
41
+
3
42
  ## 0.1.5 原生设置(2026-10-29)
4
43
 
5
44
  - 设置统一使用宿主 Button、Switch、Input、Menu 和 Modal;移至本插件详情页,去掉浏览器默认文件按钮和重复外框,不改书库、进度或阅读逻辑。
package/index.json CHANGED
@@ -11,21 +11,71 @@
11
11
  "plugins": [
12
12
  {
13
13
  "name": "@gongfpp/dsh-novel-fish",
14
- "title": { "en": "Novel Fish", "zh": "小说摸鱼" },
14
+ "title": {
15
+ "en": "Novel Fish",
16
+ "zh": "小说摸鱼"
17
+ },
15
18
  "description": {
16
19
  "en": "Append a local novel passage after selected native thought or tool content on active expansion. Multi-select region types; no model requests.",
17
20
  "zh": "多选原生思考与工具区域,主动展开时保留原文,以分隔线追加章节和本地小说;不改会话、不发送给模型。"
18
21
  },
19
- "icon": "./assets/icon.svg",
22
+ "icon": "./assets/icon.png",
20
23
  "author": "gongfpp",
21
24
  "homepage": "https://github.com/gongfpp/dsh-novel-fish#readme",
22
- "repository": { "url": "https://github.com/gongfpp/dsh-novel-fish" },
23
- "metadata": { "keywords": ["dsh-plugin", "novel", "epub", "local-reading"] },
25
+ "repository": {
26
+ "url": "https://github.com/gongfpp/dsh-novel-fish"
27
+ },
28
+ "metadata": {
29
+ "keywords": [
30
+ "dsh-plugin",
31
+ "novel",
32
+ "epub",
33
+ "local-reading"
34
+ ]
35
+ },
24
36
  "versions": [
37
+ {
38
+ "version": "0.2.1",
39
+ "publishTimestamp": 1793780252,
40
+ "engines": {
41
+ "dsh": ">=0.2.1-rc.2 <=0.2.2-alpha.2"
42
+ },
43
+ "source": {
44
+ "type": "git",
45
+ "url": "https://github.com/gongfpp/dsh-novel-fish",
46
+ "commit": "a88f119f2eaf7e6b9cf6b1cb1f2bc4ffd0ef9e2e"
47
+ }
48
+ },
49
+ {
50
+ "version": "0.2.0",
51
+ "publishTimestamp": 1793759612,
52
+ "engines": {
53
+ "dsh": ">=0.2.1-rc.2 <=0.2.2-alpha.2"
54
+ },
55
+ "source": {
56
+ "type": "git",
57
+ "url": "https://github.com/gongfpp/dsh-novel-fish",
58
+ "commit": "e4fd3675bc6629cd7da141d036389d41270be9d2"
59
+ }
60
+ },
61
+ {
62
+ "version": "0.1.6",
63
+ "publishTimestamp": 1793690949,
64
+ "engines": {
65
+ "dsh": ">=0.2.1-rc.2 <0.3.0-0"
66
+ },
67
+ "source": {
68
+ "type": "git",
69
+ "url": "https://github.com/gongfpp/dsh-novel-fish",
70
+ "commit": "16f7c31e7747395af4dbc527f2717b759833b098"
71
+ }
72
+ },
25
73
  {
26
74
  "version": "0.1.5",
27
75
  "publishTimestamp": 1793282793,
28
- "engines": { "dsh": "0.2.1-rc.2" },
76
+ "engines": {
77
+ "dsh": "0.2.1-rc.2"
78
+ },
29
79
  "source": {
30
80
  "type": "git",
31
81
  "url": "https://github.com/gongfpp/dsh-novel-fish",
@@ -35,7 +85,9 @@
35
85
  {
36
86
  "version": "0.1.4",
37
87
  "publishTimestamp": 1793021943,
38
- "engines": { "dsh": "0.2.1-rc.2" },
88
+ "engines": {
89
+ "dsh": "0.2.1-rc.2"
90
+ },
39
91
  "source": {
40
92
  "type": "git",
41
93
  "url": "https://github.com/gongfpp/dsh-novel-fish",
@@ -45,7 +97,9 @@
45
97
  {
46
98
  "version": "0.1.0",
47
99
  "publishTimestamp": 1792668400,
48
- "engines": { "dsh": "0.2.1-rc.2" },
100
+ "engines": {
101
+ "dsh": "0.2.1-rc.2"
102
+ },
49
103
  "source": {
50
104
  "type": "git",
51
105
  "url": "https://github.com/gongfpp/dsh-novel-fish",
package/lib/client.js CHANGED
@@ -15558,7 +15558,8 @@ ${part}` : part;
15558
15558
  currentBookId: null,
15559
15559
  targetTypes: Object.freeze(["reasoning"]),
15560
15560
  mainTitle: "",
15561
- extraTitle: ""
15561
+ extraTitle: "",
15562
+ continueOnReopen: false
15562
15563
  });
15563
15564
  var EMPTY_STATUS = Object.freeze({ kind: "empty" });
15564
15565
  function passageSnapshotKey(bookId, stepKey) {
@@ -15615,15 +15616,17 @@ ${part}` : part;
15615
15616
  this.#emitUi();
15616
15617
  }
15617
15618
  async setOption(key, value) {
15618
- if (!["enabled", "targetTypes", "mainTitle", "extraTitle"].includes(key)) throw new Error("\u672A\u77E5\u8BBE\u7F6E\u9879");
15619
+ if (!["enabled", "targetTypes", "mainTitle", "extraTitle", "continueOnReopen"].includes(key)) throw new Error("\u672A\u77E5\u8BBE\u7F6E\u9879");
15619
15620
  let normalized;
15620
15621
  if (key === "targetTypes") {
15621
15622
  if (!Array.isArray(value) || value.some((type) => !TARGET_TYPES.includes(type)) || new Set(value).size !== value.length) {
15622
15623
  throw new Error("\u9605\u8BFB\u7C7B\u578B\u5FC5\u987B\u662F\u6709\u6548\u4E14\u4E0D\u91CD\u590D\u7684\u7C7B\u578B\u6570\u7EC4");
15623
15624
  }
15624
15625
  normalized = Object.freeze([...value]);
15626
+ } else if (key === "enabled" || key === "continueOnReopen") {
15627
+ normalized = Boolean(value);
15625
15628
  } else {
15626
- normalized = key === "enabled" ? Boolean(value) : String(value);
15629
+ normalized = String(value);
15627
15630
  }
15628
15631
  if (key === "enabled" && !normalized || key === "targetTypes") this.#cancelPendingReads();
15629
15632
  return this.#updateSettings(() => ({ [key]: normalized }));
@@ -15672,7 +15675,20 @@ ${part}` : part;
15672
15675
  if (settings.currentBookId !== previousSettings.currentBookId) this.#clearPassages(false);
15673
15676
  });
15674
15677
  }
15678
+ /** Reopening a region shows the passage it already holds; a first expansion reads the next one. */
15675
15679
  async claimPassage(stepKey, targetType = "reasoning") {
15680
+ return this.#readPassage(stepKey, targetType, false);
15681
+ }
15682
+ /**
15683
+ * Same contract as claimPassage, except a region that already shows a passage
15684
+ * advances to the next one. Only an explicit reopen can reach this path, so a
15685
+ * repeated expansion still cannot paginate by accident while long reads
15686
+ * continue inside the same native row.
15687
+ */
15688
+ async continuePassage(stepKey, targetType = "reasoning") {
15689
+ return this.#readPassage(stepKey, targetType, true);
15690
+ }
15691
+ async #readPassage(stepKey, targetType, advance) {
15676
15692
  if (this.disposed) return EMPTY_STATUS;
15677
15693
  const generation = this.cacheGeneration;
15678
15694
  const requestKey = `${generation}\0${targetType}\0${stepKey}`;
@@ -15685,7 +15701,8 @@ ${part}` : part;
15685
15701
  bookId = this.state.settings.currentBookId;
15686
15702
  if (!bookId) return EMPTY_STATUS;
15687
15703
  const existing = this.getPassageStatus(bookId, stepKey);
15688
- if (existing.kind === "ready" || existing.kind === "end") return existing;
15704
+ if (existing.kind === "end") return existing;
15705
+ if (!advance && existing.kind === "ready") return existing;
15689
15706
  const book = this.state.books.find((item) => item.id === bookId);
15690
15707
  if (!book || book.progress >= book.segmentCount) {
15691
15708
  return this.#writePassageStatus(bookId, stepKey, { kind: "end", bookId });
@@ -15976,6 +15993,19 @@ ${part}` : part;
15976
15993
  }
15977
15994
  }
15978
15995
  };
15996
+ let queued = null;
15997
+ const coalescedRefresh = () => {
15998
+ if (!queued) return;
15999
+ queued = null;
16000
+ if (!disposed) refresh();
16001
+ };
16002
+ const scheduleRefresh = () => {
16003
+ if (queued) return;
16004
+ const entry = { frame: null };
16005
+ queued = entry;
16006
+ if (view?.requestAnimationFrame) entry.frame = view.requestAnimationFrame(coalescedRefresh);
16007
+ else queueMicrotask(coalescedRefresh);
16008
+ };
15979
16009
  const activate = (event) => {
15980
16010
  if (!event.isTrusted || event.defaultPrevented) return;
15981
16011
  if (event.type === "keydown" && (event.repeat || !["Enter", " "].includes(event.key))) return;
@@ -16001,13 +16031,14 @@ ${part}` : part;
16001
16031
  const current = store.getSettingsSnapshot();
16002
16032
  const currentId = identityOf(root);
16003
16033
  if (!disposed && toggle.isConnected && toggle.getAttribute("aria-expanded") === "true" && current.enabled && current.currentBookId === bookId && isTarget(current, currentId) && store.cacheGeneration === intent.generation && readingKey(currentId) === intent.key) {
16004
- void store.claimPassage(readingKey(id), id.type);
16034
+ if (current.continueOnReopen === true) void store.continuePassage(readingKey(id), id.type);
16035
+ else void store.claimPassage(readingKey(id), id.type);
16005
16036
  }
16006
16037
  };
16007
16038
  if (view?.requestAnimationFrame) intent.frame = view.requestAnimationFrame(verify);
16008
16039
  else queueMicrotask(verify);
16009
16040
  };
16010
- const observer = new MutationObserver(refresh);
16041
+ const observer = new MutationObserver(scheduleRefresh);
16011
16042
  observer.observe(document.body, {
16012
16043
  childList: true,
16013
16044
  subtree: true,
@@ -16027,6 +16058,8 @@ ${part}` : part;
16027
16058
  stopPassages();
16028
16059
  document.removeEventListener("click", activate, true);
16029
16060
  document.removeEventListener("keydown", activate, true);
16061
+ if (queued && queued.frame !== null && view?.cancelAnimationFrame) view.cancelAnimationFrame(queued.frame);
16062
+ queued = null;
16030
16063
  for (const intent of pending.values()) if (intent.frame !== null) view.cancelAnimationFrame(intent.frame);
16031
16064
  pending.clear();
16032
16065
  for (const root of decorated.keys()) restore(root);
@@ -16216,9 +16249,11 @@ ${part}` : part;
16216
16249
  const [busy, setBusy] = React.useState(false);
16217
16250
  const [savingTypes, setSavingTypes] = React.useState(false);
16218
16251
  const [savingEnabled, setSavingEnabled] = React.useState(false);
16252
+ const [savingContinue, setSavingContinue] = React.useState(false);
16219
16253
  const [removeBook, setRemoveBook] = React.useState(null);
16220
16254
  const [removeError, setRemoveError] = React.useState(null);
16221
16255
  const enabling = React.useRef(false);
16256
+ const continuing = React.useRef(false);
16222
16257
  const changingTypes = React.useRef(false);
16223
16258
  const importing = React.useRef(false);
16224
16259
  const removing = React.useRef(false);
@@ -16245,6 +16280,17 @@ ${part}` : part;
16245
16280
  setSavingEnabled(false);
16246
16281
  }
16247
16282
  };
16283
+ const setContinue = async (enabled) => {
16284
+ if (disabled || continuing.current) return;
16285
+ continuing.current = true;
16286
+ setSavingContinue(true);
16287
+ try {
16288
+ await perform(() => onSetOption("continueOnReopen", enabled));
16289
+ } finally {
16290
+ continuing.current = false;
16291
+ setSavingContinue(false);
16292
+ }
16293
+ };
16248
16294
  const setTypes = async (types) => {
16249
16295
  if (disabled || changingTypes.current) return;
16250
16296
  changingTypes.current = true;
@@ -16367,7 +16413,16 @@ ${part}` : part;
16367
16413
  }
16368
16414
  }),
16369
16415
  h("p", { className: "novel-fish-hint" }, t("settings.typeHint"))
16370
- )
16416
+ ),
16417
+ h(
16418
+ "div",
16419
+ { className: "novel-fish-row" },
16420
+ h("span", null, t("settings.continueOnReopen")),
16421
+ h(Switch, { checked: state.settings.continueOnReopen === true, disabled: disabled || savingContinue, label: t("settings.continueOnReopen"), onChange: (enabled) => {
16422
+ void setContinue(enabled);
16423
+ } })
16424
+ ),
16425
+ h("p", { className: "novel-fish-hint" }, t("settings.continueOnReopenHint"))
16371
16426
  ),
16372
16427
  h(
16373
16428
  "section",
@@ -16453,6 +16508,8 @@ ${part}` : part;
16453
16508
  allTypes: "\u5168\u9009",
16454
16509
  clearTypes: "\u53D6\u6D88\u5168\u9009",
16455
16510
  typeHint: "\u9996\u6B21\u4E3B\u52A8\u5C55\u5F00\u53E6\u4E00\u4E2A\u533A\u57DF\u624D\u7EED\u8BFB\uFF1B\u7A7A\u9009\u65F6\u4E0D\u8BFB\u53D6\u3002",
16511
+ continueOnReopen: "\u540C\u4E00\u533A\u57DF\u518D\u6B21\u5C55\u5F00\u7EED\u8BFB",
16512
+ continueOnReopenHint: "\u5F00\u542F\u540E\uFF0C\u6536\u8D77\u518D\u4E3B\u52A8\u5C55\u5F00\u540C\u4E00\u533A\u57DF\u4F1A\u63A5\u7740\u8BFB\u4E0B\u4E00\u6BB5\uFF1B\u5173\u95ED\u65F6\u91CD\u590D\u5C55\u5F00\u53EA\u663E\u793A\u8FD9\u4E00\u6BB5\u3002",
16456
16513
  books: "\u4E66\u7C4D",
16457
16514
  importBook: "\u5BFC\u5165\u4E66\u7C4D",
16458
16515
  reading: "\u804A\u5929\u5185\u9605\u8BFB",
@@ -16518,6 +16575,8 @@ ${part}` : part;
16518
16575
  allTypes: "Select all",
16519
16576
  clearTypes: "Deselect all",
16520
16577
  typeHint: "A different region\u2019s first active expansion continues reading. Select none to stop reading.",
16578
+ continueOnReopen: "Continue in the same region",
16579
+ continueOnReopenHint: "When on, collapsing and actively reopening the same region reads the next passage; when off, reopening only shows the passage already there.",
16521
16580
  books: "Books",
16522
16581
  importBook: "Import book",
16523
16582
  reading: "Reading in chat",
package/locale/en.json CHANGED
@@ -34,6 +34,8 @@
34
34
  "allTypes": "Select all",
35
35
  "clearTypes": "Deselect all",
36
36
  "typeHint": "A different region’s first active expansion continues reading. Select none to stop reading.",
37
+ "continueOnReopen": "Continue in the same region",
38
+ "continueOnReopenHint": "When on, collapsing and actively reopening the same region reads the next passage; when off, reopening only shows the passage already there.",
37
39
  "books": "Books",
38
40
  "importBook": "Import book",
39
41
  "reading": "Reading in chat",
package/locale/zh.json CHANGED
@@ -34,6 +34,8 @@
34
34
  "allTypes": "全选",
35
35
  "clearTypes": "取消全选",
36
36
  "typeHint": "首次主动展开另一个区域才续读;空选时不读取。",
37
+ "continueOnReopen": "同一区域再次展开续读",
38
+ "continueOnReopenHint": "开启后,收起再主动展开同一区域会接着读下一段;关闭时重复展开只显示这一段。",
37
39
  "books": "书籍",
38
40
  "importBook": "导入书籍",
39
41
  "reading": "聊天内阅读",
package/package.json CHANGED
@@ -1,81 +1,83 @@
1
- {
2
- "name": "@gongfpp/dsh-novel-fish",
3
- "version": "0.1.6",
4
- "repository": {
5
- "type": "git",
6
- "url": "https://github.com/gongfpp/dsh-novel-fish.git"
7
- },
8
- "homepage": "https://github.com/gongfpp/dsh-novel-fish#readme",
9
- "bugs": {
10
- "url": "https://github.com/gongfpp/dsh-novel-fish/issues"
11
- },
12
- "keywords": [
13
- "dsh",
14
- "dsh-plugin",
15
- "novel",
16
- "epub",
17
- "local-reading"
18
- ],
19
- "author": "gongfpp",
20
- "description": "多选原生思考与工具区域,主动展开时保留原文并以分隔线追加本地小说;不改会话、不发送给模型。",
21
- "type": "module",
22
- "exports": {
23
- ".": "./index.js",
24
- "./client": "./lib/client.js",
25
- "./icon": "./assets/icon.svg",
26
- "./locale/*.json": "./locale/*.json",
27
- "./package.json": "./package.json"
28
- },
29
- "files": [
30
- "index.js",
31
- "index.json",
32
- "cordis.patch.yml",
33
- "lib/client.js",
34
- "src/**",
35
- "scripts/**",
36
- "test/**",
37
- "assets/icon.svg",
38
- "locale/*.json",
39
- "docs/**",
40
- "pnpm-lock.yaml",
41
- "pnpm-workspace.yaml",
42
- "README.md",
43
- "THIRD-PARTY-NOTICES.txt",
44
- "LICENSE"
45
- ],
46
- "scripts": {
47
- "build": "node scripts/build.mjs",
48
- "test": "node --test test/*.test.js",
49
- "verify": "pnpm run build && pnpm test",
50
- "pack": "pnpm pack"
51
- },
52
- "devDependencies": {
53
- "@xmldom/xmldom": "^0.9.12",
54
- "crc-32": "1.2.2",
55
- "epubjs": "0.3.93",
56
- "esbuild": "^0.25.12",
57
- "fake-indexeddb": "^6.2.5",
58
- "jsdom": "^30.1.3",
59
- "jszip": "^3.10.1",
60
- "react": "18.3.1",
61
- "react-test-renderer": "18.3.1"
62
- },
63
- "engines": {
64
- "node": ">=22",
65
- "dsh": ">=0.2.1-rc.2 <0.3.0-0"
66
- },
67
- "license": "MIT",
68
- "dsh": {
69
- "bundle": {
70
- "patch": "./cordis.patch.yml"
71
- },
72
- "client": {
73
- "platform": "web",
74
- "inject": [
75
- "@deepseek-ai/dsh-client-ui-chat",
76
- "@deepseek-ai/dsh-client-ui-plugin-manager",
77
- "@deepseek-ai/dsh-client-locale"
78
- ]
79
- }
80
- }
81
- }
1
+ {
2
+ "name": "@gongfpp/dsh-novel-fish",
3
+ "version": "1.0.0",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/gongfpp/dsh-novel-fish.git"
7
+ },
8
+ "homepage": "https://github.com/gongfpp/dsh-novel-fish#readme",
9
+ "bugs": {
10
+ "url": "https://github.com/gongfpp/dsh-novel-fish/issues"
11
+ },
12
+ "keywords": [
13
+ "dsh",
14
+ "dsh-plugin",
15
+ "novel",
16
+ "epub",
17
+ "local-reading"
18
+ ],
19
+ "author": "gongfpp",
20
+ "description": "多选原生思考与工具区域,主动展开时保留原文并以分隔线追加本地小说;不改会话、不发送给模型。",
21
+ "icon": "./assets/icon.png",
22
+ "type": "module",
23
+ "exports": {
24
+ ".": "./index.js",
25
+ "./client": "./lib/client.js",
26
+ "./icon": "./assets/icon.png",
27
+ "./locale/*.json": "./locale/*.json",
28
+ "./package.json": "./package.json"
29
+ },
30
+ "files": [
31
+ "index.js",
32
+ "index.json",
33
+ "cordis.patch.yml",
34
+ "lib/client.js",
35
+ "src/**",
36
+ "scripts/**",
37
+ "test/**",
38
+ "assets/icon.png",
39
+ "locale/*.json",
40
+ "docs/**",
41
+ "pnpm-lock.yaml",
42
+ "pnpm-workspace.yaml",
43
+ "README.md",
44
+ "THIRD-PARTY-NOTICES.txt",
45
+ "LICENSE"
46
+ ],
47
+ "devDependencies": {
48
+ "@xmldom/xmldom": "^0.9.12",
49
+ "crc-32": "1.2.2",
50
+ "epubjs": "0.3.93",
51
+ "esbuild": "^0.25.12",
52
+ "fake-indexeddb": "^6.2.5",
53
+ "jsdom": "^30.1.3",
54
+ "jszip": "^3.10.1",
55
+ "react": "18.3.1",
56
+ "react-test-renderer": "18.3.1",
57
+ "semver": "7.7.2"
58
+ },
59
+ "engines": {
60
+ "node": ">=22",
61
+ "dsh": ">=0.2.1-rc.2 <=0.2.2-alpha.2"
62
+ },
63
+ "license": "MIT",
64
+ "dsh": {
65
+ "bundle": {
66
+ "patch": "./cordis.patch.yml"
67
+ },
68
+ "client": {
69
+ "platform": "web",
70
+ "inject": [
71
+ "@deepseek-ai/dsh-client-ui-chat",
72
+ "@deepseek-ai/dsh-client-ui-plugin-manager",
73
+ "@deepseek-ai/dsh-client-locale"
74
+ ]
75
+ }
76
+ },
77
+ "scripts": {
78
+ "build": "node scripts/build.mjs",
79
+ "test": "node --test test/*.test.js",
80
+ "verify": "pnpm run build && pnpm test",
81
+ "pack": "pnpm pack"
82
+ }
83
+ }