dsh-mermaid-smooth 0.1.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.
- package/LICENSE +21 -0
- package/README.md +62 -0
- package/README.zh.md +46 -0
- package/cordis.patch.yml +6 -0
- package/lib/client.js +3623 -0
- package/lib/index.js +14 -0
- package/package.json +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 gitByteFree
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# dsh-mermaid-smooth
|
|
2
|
+
|
|
3
|
+
English | [中文](README.zh.md)
|
|
4
|
+
|
|
5
|
+
Render mermaid code fences in DeepSeek Harness (dsh) web chat as diagrams by
|
|
6
|
+
default, with smooth zoom and pan, a per-fence diagram/code toggle at each
|
|
7
|
+
card's top-right, a persisted per-fence preference, dark-mode follow, and a
|
|
8
|
+
fully bundled offline engine (zero CDN).
|
|
9
|
+
|
|
10
|
+
- **Default diagram** — fences in assistant messages render as SVG diagrams
|
|
11
|
+
the moment they are complete; non-mermaid code blocks are untouched.
|
|
12
|
+
- **Smooth interaction** — cursor-anchored wheel zoom over one composed
|
|
13
|
+
transform (with a short ease-out), direct pointer drag, double-click to
|
|
14
|
+
fit. Reduced-motion preferences disable all easing.
|
|
15
|
+
- **Toggle at top-right** — every diagram card has a 图/文案 (diagram/code)
|
|
16
|
+
switch; several fences in one message toggle independently.
|
|
17
|
+
- **Per-fence memory** — the toggle state persists in localStorage keyed by
|
|
18
|
+
the fence source, so it survives page reloads and reconnects.
|
|
19
|
+
- **Dark-mode follow** — diagrams re-render with the GUI theme.
|
|
20
|
+
- **Safe and offline** — mermaid runs at securityLevel 'strict' (built-in
|
|
21
|
+
sanitization, no click handlers), the engine is bundled into the plugin
|
|
22
|
+
(zero CDN), and a failed fence keeps its original code with an inline
|
|
23
|
+
error banner. Uninstalling restores the conversation verbatim.
|
|
24
|
+
|
|
25
|
+
## Screenshots
|
|
26
|
+
|
|
27
|
+

|
|
28
|
+
|
|
29
|
+

|
|
30
|
+
|
|
31
|
+

|
|
32
|
+
|
|
33
|
+
## Install
|
|
34
|
+
|
|
35
|
+
Two ways — pick one, then restart DSH Web (the current session ends, but DSH
|
|
36
|
+
sessions are persisted on disk and can be resumed after restart).
|
|
37
|
+
|
|
38
|
+
**1. From GitHub (pinned to a verified commit)**
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
dsh plugin --profile web add 'github:gitByteFree/dsh-mermaid-smooth#<full-commit-sha>'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Pin to the commit you want (e.g. the `main` HEAD shown on the repo's commit
|
|
45
|
+
history page); later changes on `main` will not silently alter installed code.
|
|
46
|
+
The source is installed and built at install time (`prepare` runs the esbuild
|
|
47
|
+
bundle), so git and Node.js ≥ 20 are required.
|
|
48
|
+
|
|
49
|
+
**2. Local clone (for development)**
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
git clone git@github.com:gitByteFree/dsh-mermaid-smooth.git
|
|
53
|
+
cd dsh-mermaid-smooth
|
|
54
|
+
dsh plugin --profile web add .
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Restart the web app (`dsh web`, or your `dsh-web` service) so the new bundle
|
|
58
|
+
layer is composed.
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
MIT
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# dsh-mermaid-smooth
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 中文
|
|
4
|
+
|
|
5
|
+
将 DeepSeek Harness(dsh)Web 对话中的 mermaid 代码围栏**默认渲染为图**:丝滑的缩放与拖拽,每张图右上角提供图/文案切换,偏好按围栏记忆,明暗主题跟随,渲染引擎完全本地打包(零 CDN)。
|
|
6
|
+
|
|
7
|
+
- **默认成图** — 助手消息中的 mermaid 围栏一旦完整立即渲染为 SVG 图;非 mermaid 代码块不受影响。
|
|
8
|
+
- **丝滑交互** — 滚轮缩放以指针为锚点(单一 transform 合成 + 短过渡),拖拽平移 1:1 跟手,双击适应/复位;系统开启「减少动态效果」时全部动画禁用。
|
|
9
|
+
- **右上角切换** — 每张图卡片有「图/文案」切换按钮;一条消息中的多个围栏各自独立。
|
|
10
|
+
- **按围栏记忆** — 切换状态存于 localStorage(以围栏源码为键),刷新页面、重连后保持。
|
|
11
|
+
- **主题跟随** — 图随 GUI 明暗主题重新渲染。
|
|
12
|
+
- **安全离线** — mermaid 以 securityLevel 'strict' 运行(内置消毒、不绑点击事件),引擎打包进插件本体(零 CDN);渲染失败的围栏保留原代码并内联错误条。卸载插件后对话原样还原。
|
|
13
|
+
|
|
14
|
+
## 截图
|
|
15
|
+
|
|
16
|
+

|
|
17
|
+
|
|
18
|
+

|
|
19
|
+
|
|
20
|
+

|
|
21
|
+
|
|
22
|
+
## 安装
|
|
23
|
+
|
|
24
|
+
两种方式任选其一,装完重启 DSH Web 即生效(当前会话会中断,但 DSH 会话有磁盘持久化,重启后可以恢复)。
|
|
25
|
+
|
|
26
|
+
**方式一:从 GitHub 安装(固定到指定提交)**
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
dsh plugin --profile web add 'github:gitByteFree/dsh-mermaid-smooth#<40位commit>'
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
固定到你想装的 commit(如仓库提交历史页显示的 main HEAD),之后 main 的新改动不会静默改变已安装代码。源码安装时会在本机构建(`prepare` 脚本执行 esbuild 打包),需要 git 与 Node.js ≥ 20。
|
|
33
|
+
|
|
34
|
+
**方式二:克隆后从本地路径安装(开发迭代)**
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
git clone git@github.com:gitByteFree/dsh-mermaid-smooth.git
|
|
38
|
+
cd dsh-mermaid-smooth
|
|
39
|
+
dsh plugin --profile web add .
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
安装后重启 web 应用(`dsh web` 或你的 `dsh-web` 服务),使新 bundle 层生效。
|
|
43
|
+
|
|
44
|
+
## 许可
|
|
45
|
+
|
|
46
|
+
MIT
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Bundle patch layer: mounts this package's main entry as the host half (a
|
|
2
|
+
# plain Cordis plugin). The package.json `dsh.client` declaration makes the
|
|
3
|
+
# web app load the ./client bundle as the browser half.
|
|
4
|
+
- insert:
|
|
5
|
+
- id: dsh-mermaid-smooth
|
|
6
|
+
name: dsh-mermaid-smooth
|