@alexpeng/dsh-custom-plugin 0.9.0 → 0.9.2
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.md +53 -0
- package/README.i18n.yaml +2 -2
- package/README.md +3 -1
- package/README.zh.md +2 -1
- package/lib/client.js +454 -262
- package/lib/client.js.map +1 -1
- package/lib/types/client/mermaid-render.d.ts +36 -0
- package/lib/types/client/mermaid-scan.d.ts +21 -0
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,59 @@ All notable changes to this project are documented here. The format loosely
|
|
|
4
4
|
follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions
|
|
5
5
|
follow [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## 0.9.2 — 2026-10-26
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- **无障碍与电池**:天气特效尊重 `prefers-reduced-motion`(减少动态时不启动
|
|
12
|
+
动画帧),装饰画布加 `aria-hidden`;余额 60 秒轮询在页面隐藏时暂停、回到前台
|
|
13
|
+
立即刷新;6 个浮层补齐 `role="dialog"` / `aria-modal`、焦点进入、Tab 陷阱、
|
|
14
|
+
Escape 关闭与关闭后的焦点恢复;余额入口改为可键盘操作的 `role="button"` 并带
|
|
15
|
+
`aria-expanded` / `aria-haspopup`,关键图标按钮补 `aria-label`。
|
|
16
|
+
- **顶栏重渲染**:`HeaderBalance` 从整店订阅改为只选余额、今日用量行与面板开关,
|
|
17
|
+
并对今日次数/费用做 `useMemo`;流式回合的 store 写入不再重渲染顶栏或重算台账。
|
|
18
|
+
- **常驻组件订阅收窄**:`MermaidInPlace`、`QuoteDock`、`QuoteButton`、`Toasts`
|
|
19
|
+
同样改为 `useSSelector`;它们大多时候渲染 null 或很小,不再被流式/用量写入唤醒。
|
|
20
|
+
剩余 19 个 `useS()` 多为打开时才挂载的面板,待逐项 profile。
|
|
21
|
+
|
|
22
|
+
### Tests
|
|
23
|
+
|
|
24
|
+
- Mermaid 渲染从 `src/client/custom.tsx` 抽到独立的 `src/client/mermaid-render.ts`;
|
|
25
|
+
`pnpm smoke` 现在用真实 Mermaid 引擎在无头 Edge 中覆盖失败路径(无效代码不残留
|
|
26
|
+
`body > div#dvx-mmd-*`、有效图渲染、旧错误卡清理、引擎缺失干净失败),并新增
|
|
27
|
+
`tests/mermaid-render.spec.ts` 9 个单测。反证:撤掉 `suppressErrorRendering` 与
|
|
28
|
+
清理后 smoke 恰好红 2 项,还原后全绿。
|
|
29
|
+
- 扫描逻辑抽到 `src/client/mermaid-scan.ts`,smoke 增加 5 项 wrapper / 失败回退 /
|
|
30
|
+
切换 / 主题翻转 / restore 断言;新增 `pnpm bench:mermaid` 合成长回合基准。
|
|
31
|
+
结论:1000 块时 warm p95 ≈2.8 ms,扫描收窄收益可忽略;真实 Mermaid ≈10 ms/图,
|
|
32
|
+
懒渲染只在单回合大量图时有意义,暂不引入。
|
|
33
|
+
|
|
34
|
+
### Verified
|
|
35
|
+
|
|
36
|
+
- 0.9.2 tarball 装进隔离的 dsh 0.2.1-rc.3 profile(无兼容豁免)并冷启动;活体探针
|
|
37
|
+
全部通过,1 项因无会话跳过(时间线/导出/搜索,由单测覆盖)。
|
|
38
|
+
- `pnpm check:readme`、`pnpm typecheck`、`pnpm test`(214)、`pnpm build`、`pnpm smoke`
|
|
39
|
+
全绿。
|
|
40
|
+
|
|
41
|
+
## 0.9.1 — 2026-10-25
|
|
42
|
+
|
|
43
|
+
### Fixed
|
|
44
|
+
|
|
45
|
+
- **Mermaid 解析失败不再在页面底部留下错误图**:Mermaid 默认会在
|
|
46
|
+
`render()` 抛错前把一个全宽炸弹图追加到 `<body>`(`div#dvx-mmd-*`)并留在
|
|
47
|
+
那里。现在 `mermaid.initialize` 打开 `suppressErrorRendering`,并在
|
|
48
|
+
`finally` 中清理 `#id` / `#d<id>` / `#i<id>` 三个临时节点;扫描时也会移除
|
|
49
|
+
旧版本遗留的同名节点。失败代码块按既有设计回退为原始代码,不再出现
|
|
50
|
+
“Syntax error in text / mermaid version …” 卡片。
|
|
51
|
+
|
|
52
|
+
### Verified
|
|
53
|
+
|
|
54
|
+
- 无头 Edge 复现旧行为(`body > div#dvx-mmd-*` 残留 + “Syntax error in text”),
|
|
55
|
+
并验证 `suppressErrorRendering` 与 `finally` 清理两条路径都能清除;合法
|
|
56
|
+
flowchart 仍正常渲染。
|
|
57
|
+
- `pnpm check:readme`、`pnpm typecheck`、`pnpm test`(205)、`pnpm build`、
|
|
58
|
+
`pnpm smoke` 全绿。
|
|
59
|
+
|
|
7
60
|
## 0.9.0 — 2026-10-25
|
|
8
61
|
|
|
9
62
|
兼容策略改为开放式下限:宿主不再因为 dsh 更新而把插件判为“不支持”。
|
package/README.i18n.yaml
CHANGED
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
# after editing either side, bring the other along and re-record the hashes:
|
|
4
4
|
# git hash-object --path README.md README.md
|
|
5
5
|
# git hash-object --path README.zh.md README.zh.md
|
|
6
|
-
README.md:
|
|
7
|
-
README.zh.md:
|
|
6
|
+
README.md: 4c5fbe086924635e8f9020244fd8d18e2e80ed01
|
|
7
|
+
README.zh.md: ead137acecc97e504b48ea2535d20e501de0b91f
|
package/README.md
CHANGED
|
@@ -266,9 +266,11 @@ pnpm test # vitest unit tests
|
|
|
266
266
|
pnpm build # build the node ESM library and the browser bundle into lib/
|
|
267
267
|
pnpm check:readme # bilingual README hash consistency
|
|
268
268
|
pnpm smoke # post-build contract checks: loader handshake, manifest
|
|
269
|
-
# fields dsh reads, patch row, local Mermaid engine
|
|
269
|
+
# fields dsh reads, patch row, local Mermaid engine,
|
|
270
|
+
# real-engine Mermaid error-path DOM regression
|
|
270
271
|
pnpm canary # published plugin against the newest dsh from npm latest/next
|
|
271
272
|
# (needs npm, bash and curl; --plugin <tgz> tests a local build)
|
|
273
|
+
pnpm bench:mermaid # synthetic long-turn Mermaid scan/render benchmark (headless Edge)
|
|
272
274
|
```
|
|
273
275
|
|
|
274
276
|
`scripts/live-dsh-check.sh` is a separate, manual probe against a **running**
|
package/README.zh.md
CHANGED
|
@@ -251,9 +251,10 @@ pnpm test # vitest 单元测试
|
|
|
251
251
|
pnpm build # 构建 node ESM 库与浏览器 bundle 到 lib/
|
|
252
252
|
pnpm check:readme # 双语 README 哈希一致性
|
|
253
253
|
pnpm smoke # 构建后契约自检:加载器握手、dsh 会读的清单字段、
|
|
254
|
-
# patch 行、本地 Mermaid
|
|
254
|
+
# patch 行、本地 Mermaid 引擎与真实引擎的失败路径 DOM 回归
|
|
255
255
|
pnpm canary # 已发布插件对 npm latest/next 里最新的 dsh(需要 npm、bash、
|
|
256
256
|
# curl;--plugin <tgz> 可测本地构建)
|
|
257
|
+
pnpm bench:mermaid # 合成长回合的 Mermaid 扫描/渲染基准(无头 Edge)
|
|
257
258
|
```
|
|
258
259
|
|
|
259
260
|
`scripts/live-dsh-check.sh` 是另一条**手动**探针,对着一个正在运行的隔离 dsh profile
|