dsh-inkmap 0.3.18 → 0.3.20
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.md +4 -2
- package/README.md +8 -7
- package/README.zh.md +16 -10
- package/client.js +3 -0
- package/host.js +138 -52
- package/locale/en.json +2 -2
- package/locale/zh.json +2 -2
- package/package.json +6 -2
- package/web/assets/{abnfDiagram-S7VZAUFO-BeWFk12I.js → abnfDiagram-S7VZAUFO-CDff-nfM.js} +1 -1
- package/web/assets/{architectureDiagram-YGSQEFNW-B6PQXyas.js → architectureDiagram-YGSQEFNW-CHXLsh_j.js} +1 -1
- package/web/assets/{blockDiagram-APKKGZFW-BdpnwpTu.js → blockDiagram-APKKGZFW-CKs43Kgt.js} +1 -1
- package/web/assets/{c4Diagram-KJ2TOQU5-DdULbhXQ.js → c4Diagram-KJ2TOQU5-DvUUAxWk.js} +1 -1
- package/web/assets/{chunk-2Q5K7J3B-CindsaSw.js → chunk-2Q5K7J3B-DyI8A4tn.js} +1 -1
- package/web/assets/{chunk-5VM5RSS4-C79dZKx7.js → chunk-5VM5RSS4-B0dnM99b.js} +1 -1
- package/web/assets/{chunk-HFQBQIA3-CqKOUc7T.js → chunk-HFQBQIA3-DDZ9lSrv.js} +1 -1
- package/web/assets/{chunk-JWPE2WC7-CthtOpTy.js → chunk-JWPE2WC7-C4rMZ1R2.js} +1 -1
- package/web/assets/{chunk-KQLB2F66-QMDw_8CW.js → chunk-KQLB2F66-J3hxivx4.js} +2 -2
- package/web/assets/{chunk-KS47KZWR-dlJELx0a.js → chunk-KS47KZWR-CsKgfVZN.js} +1 -1
- package/web/assets/{chunk-OY52VR5R-BjONc9x4.js → chunk-OY52VR5R-D9fFQQga.js} +1 -1
- package/web/assets/{chunk-TU62E6Q5-Byh30Z7Z.js → chunk-TU62E6Q5-XxVyMTnB.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-gS2kDCor.js → chunk-XXDRQBXY-BbvvjfGZ.js} +1 -1
- package/web/assets/{classDiagram-v2-L25IHNXF-CC7_Vf-c.js → classDiagram-v2-L25IHNXF-DHpbY3Ha.js} +1 -1
- package/web/assets/{cose-bilkent-JH36ORCC-FIBB2BM8.js → cose-bilkent-JH36ORCC-aa4ly9T2.js} +1 -1
- package/web/assets/{cynefin-EF2NZ3EQ-BtN8psSE.js → cynefin-EF2NZ3EQ-DgJ6M0DF.js} +1 -1
- package/web/assets/{cynefinDiagram-L36ESFBY-COmzEnv6.js → cynefinDiagram-L36ESFBY-D3TCWHjq.js} +1 -1
- package/web/assets/{dagre-SPEB5RXH-DVuTr8T1.js → dagre-SPEB5RXH-B_Py_xy7.js} +1 -1
- package/web/assets/{diagram-3B7GL73J-BP3FZ0g2.js → diagram-3B7GL73J-C2SMM91K.js} +1 -1
- package/web/assets/{diagram-DNEMPZML-PoYt8Dte.js → diagram-DNEMPZML-CANGkbmM.js} +1 -1
- package/web/assets/{diagram-L3MUGCDN-DfFSB2u1.js → diagram-L3MUGCDN-HPqIvMFr.js} +1 -1
- package/web/assets/{diagram-LA4NIPWU-6ZBXAxwo.js → diagram-LA4NIPWU-Sxagj_CS.js} +1 -1
- package/web/assets/{diagram-MHCOC4E2-Sy8k9CJ9.js → diagram-MHCOC4E2-vlYHr50j.js} +1 -1
- package/web/assets/{diagram-XPFHEONP-DnuRcCaP.js → diagram-XPFHEONP-DZ_yTsRp.js} +1 -1
- package/web/assets/{ebnfDiagram-UZSYDL2S-DnvMMi3G.js → ebnfDiagram-UZSYDL2S-CpLiDq7f.js} +1 -1
- package/web/assets/{elk-XV6XMXQE-Dn_YwyW3.js → elk-XV6XMXQE-CZBhnIHv.js} +1 -1
- package/web/assets/{erDiagram-EYBAPDEH-Db_QZvpq.js → erDiagram-EYBAPDEH-D7chtvCB.js} +1 -1
- package/web/assets/{flowDiagram-MALGAFMO-BWX5Y0cz.js → flowDiagram-MALGAFMO-DGNx31L1.js} +1 -1
- package/web/assets/{ganttDiagram-23REXITY-BxsbozMp.js → ganttDiagram-23REXITY-BK_t89FN.js} +1 -1
- package/web/assets/{gitGraphDiagram-STJD7YCW-mL-PotOo.js → gitGraphDiagram-STJD7YCW-BhkaQ9VI.js} +1 -1
- package/web/assets/{index-Bj89aaTR.js → index-CP6siPCL.js} +110 -109
- package/web/assets/{index-B8XueA7g.css → index-DemFlNMm.css} +1 -1
- package/web/assets/{infoDiagram-KBXO4MBG-BJx2jlco.js → infoDiagram-KBXO4MBG-Cky2_WOM.js} +1 -1
- package/web/assets/{ishikawaDiagram-M35NCXHK-UgWdXXui.js → ishikawaDiagram-M35NCXHK-DadDyqQE.js} +1 -1
- package/web/assets/{journeyDiagram-OPLOXDXO-Cf4aMvj1.js → journeyDiagram-OPLOXDXO-9FAeCE-F.js} +1 -1
- package/web/assets/{kanban-definition-BZKZHSQY-DjpVY0LI.js → kanban-definition-BZKZHSQY-Yy3bPAfF.js} +1 -1
- package/web/assets/{mermaid.core-DcPVUkPD.js → mermaid.core-CrixXrk1.js} +4 -4
- package/web/assets/{mindmap-definition-I2QAS2VK-DEdLODZJ.js → mindmap-definition-I2QAS2VK-CH0QuOpy.js} +1 -1
- package/web/assets/{pegDiagram-FD4XPPHP-Bx_NUCtU.js → pegDiagram-FD4XPPHP-DoHHQted.js} +1 -1
- package/web/assets/{pieDiagram-J4AKIIQI-CscA5jlt.js → pieDiagram-J4AKIIQI-DOiM6-pn.js} +1 -1
- package/web/assets/{quadrantDiagram-XTYBLID2-CF6IpdHj.js → quadrantDiagram-XTYBLID2-DMQDBY03.js} +1 -1
- package/web/assets/{railroadDiagram-MRQ6NCDL-v2ixDui3.js → railroadDiagram-MRQ6NCDL-Dp-c_a8-.js} +1 -1
- package/web/assets/{requirementDiagram-Y7LWUY3S-DFvWnGI3.js → requirementDiagram-Y7LWUY3S-CTCb1Y7k.js} +1 -1
- package/web/assets/{sankeyDiagram-WGJFYUXA-BV8qEW5j.js → sankeyDiagram-WGJFYUXA-BuEwrSz3.js} +1 -1
- package/web/assets/{sequenceDiagram-5NDRBG5M-BHbm5ixi.js → sequenceDiagram-5NDRBG5M-DQfayNSv.js} +1 -1
- package/web/assets/{sizeCapture-INFHLROL-C8_KPF__.js → sizeCapture-INFHLROL-G5X8Lc-L.js} +1 -1
- package/web/assets/{stateDiagram-v2-FJ4FJNEA-BDxX4OGC.js → stateDiagram-v2-FJ4FJNEA-DIc07DaK.js} +1 -1
- package/web/assets/{swimlanes-UMQ2AFYF-BrpTjpSL.js → swimlanes-UMQ2AFYF-B73t7PYE.js} +1 -1
- package/web/assets/swimlanesDiagram-OMPLPG4O-Cfb4epZw.js +8 -0
- package/web/assets/{timeline-definition-SEUHKTQE-DKGe62dT.js → timeline-definition-SEUHKTQE-BTTpRlS-.js} +1 -1
- package/web/assets/{usecaseDiagram-AFA6YXN4-BWSqXQGt.js → usecaseDiagram-AFA6YXN4-D0A_r92e.js} +1 -1
- package/web/assets/{vennDiagram-NNMJR3RB-qkD91XqG.js → vennDiagram-NNMJR3RB-KqMxgIKf.js} +1 -1
- package/web/assets/{wardleyDiagram-S7YFUSEH-B7vP2yOx.js → wardleyDiagram-S7YFUSEH-kfWtnK3c.js} +1 -1
- package/web/assets/{xychartDiagram-GGNKY7IX-CELy7PnW.js → xychartDiagram-GGNKY7IX-CC7l5Jki.js} +1 -1
- package/web/index.html +2 -2
- package/web/assets/swimlanesDiagram-OMPLPG4O-BCZcYiel.js +0 -8
package/LICENSE.md
CHANGED
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
|
|
27
27
|
### 5. 隐私
|
|
28
28
|
|
|
29
|
-
-
|
|
29
|
+
- 本软件不收集、不上传你的文档内容、文件名或路径。
|
|
30
|
+
- 为了解各客户端和功能的使用情况,本软件会向 `zhiyuanv.com` 发送匿名使用统计:随机生成的安装标识、软件版本、所在客户端、操作系统类型、界面语言、试用或 Pro 状态,以及打开、编辑和各项功能的使用次数。服务器在收到统计时会记录来源 IP 地址,用于识别重复设备和判断所在地区。
|
|
30
31
|
- 平台会话凭证保存在编辑器的机密存储中,命令行工具保存在 `~/.inkmap/billing-session` 中。
|
|
31
32
|
- 购买时的付款信息由支付平台处理,我们只能看到订单号、商品和联系方式等平台提供的信息,用于确认支付、发放权益和售后。
|
|
32
33
|
|
|
@@ -68,7 +69,8 @@ Within 7 days of purchase you can ask for a full refund through the store, no qu
|
|
|
68
69
|
|
|
69
70
|
### 5. Privacy
|
|
70
71
|
|
|
71
|
-
- The Software never collects or uploads your documents
|
|
72
|
+
- The Software never collects or uploads your documents, their file names or their paths.
|
|
73
|
+
- To understand how each client and feature is used, the Software sends anonymous usage statistics to `zhiyuanv.com`: a randomly generated installation ID, the Software version, the client it runs in, the operating system type, the interface language, whether it is in trial or Pro, and how many times documents were opened or edited and features were used. When it receives them, the server records the source IP address, which is used to recognise duplicate devices and the region.
|
|
72
74
|
- The platform session is stored in the editor’s secret storage or in `~/.inkmap/billing-session` for the CLI.
|
|
73
75
|
- Payments are handled by the payment platform. We only see what it shares — order number, product and contact details — and use it to confirm payments, grant access and provide support.
|
|
74
76
|
|
package/README.md
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
# Inkmap — Two-Way Markdown Mindmap
|
|
1
|
+
# Inkmap — Two-Way Markdown Mindmap, Visual Mermaid & Paste-Image Editor for DeepSeek Harness
|
|
2
2
|
|
|
3
|
-
Render and edit local Markdown (`.md` / `.markmap.md`) files as interactive two-way mind maps (Markmap alternative) and Mermaid flowcharts directly inside the **DeepSeek Harness right sidebar
|
|
3
|
+
Render and edit local Markdown (`.md` / `.markmap.md`) files as interactive two-way mind maps (Markmap alternative) and visual Mermaid flowcharts directly inside the **DeepSeek Harness right sidebar**, with clipboard screenshot paste straight to `<doc>.assets/`.
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
7
|
## Quick Start
|
|
8
8
|
|
|
9
|
-
1. **Open in Right Sidebar**: Preview any `.md` file in DeepSeek Harness and click **Inkmap** in the top-right preview toolbar.
|
|
10
|
-
2. **
|
|
11
|
-
3. **
|
|
9
|
+
1. **Open in Right Sidebar**: Preview any `.md` file in DeepSeek Harness and click **Inkmap Mind Map** in the top-right preview toolbar.
|
|
10
|
+
2. **Paste & Drop Screenshots (`<doc>.assets/`)**: Press `⌘V` / `Ctrl+V` on a selected node (or drag `PNG` / `JPG` / `GIF` / `WebP` files onto a node) to save images into `<document>.assets/` and link them cleanly in Markdown.
|
|
11
|
+
3. **Full-Screen 3-Column Browser IDE**: Click **Open in Browser** in the Inkmap toolbar for a full-screen Project Tree + Markdown + Mind Map workspace.
|
|
12
|
+
4. **Live Browser Playground**: https://www.zhiyuanv.com/inkmap.html?lang=en
|
|
12
13
|
|
|
13
|
-
##
|
|
14
|
+
## Visual Mermaid Flowcharts, 9 Layouts & Presentation Mode
|
|
14
15
|
|
|
15
16
|

|
|
16
17
|
|
|
17
18
|

|
|
18
19
|
|
|
19
|
-
- **Shortcuts**: `Tab` (child), `Enter` (sibling), `Shift+Tab` (parent), `⌘↑/↓` (move), `⌘E` (edit Markdown/Mermaid source), `⌘F` (find & replace), `⌘S` (save).
|
|
20
|
+
- **Shortcuts**: `Tab` (child), `Enter` (sibling), `Shift+Tab` (parent), `⌘V` / `Ctrl+V` (paste screenshot), `⌘↑/↓` (move), `⌘E` (edit Markdown/Mermaid source), `⌘F` (find & replace), `⌘S` (save).
|
|
20
21
|
- **Website**: https://www.zhiyuanv.com/software.html?lang=en
|
package/README.zh.md
CHANGED
|
@@ -1,24 +1,30 @@
|
|
|
1
|
-
# Inkmap 思维导图(DeepSeek Harness
|
|
1
|
+
# Inkmap 思维导图(DeepSeek Harness 原生双向脑图 · 可视化流程图 · 剪贴板贴图工作台)
|
|
2
2
|
|
|
3
|
-
将工作区内的本地 Markdown (`.md` / `.markmap.md`) 文件直接在 **DeepSeek Harness 右侧分栏** 渲染为可交互、可双向拖拽编辑的思维导图(Markmap
|
|
3
|
+
将工作区内的本地 Markdown (`.md` / `.markmap.md`) 文件直接在 **DeepSeek Harness 右侧分栏** 渲染为可交互、可双向拖拽编辑的思维导图(Markmap 增强替代)与可视化 Mermaid 流程图。支持**剪贴板截图一键粘贴落盘**,每一处修改毫秒级逐字节写回原文件,未改动段落 100% 原样保留。
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
7
|
## 🚀 3 秒上手使用指南
|
|
8
8
|
|
|
9
|
-
1. **右侧栏一键打开**:在 DeepSeek Harness 中预览任意 `.md` 文件时,点击右上角预览工具栏的 **「Inkmap
|
|
9
|
+
1. **右侧栏一键打开**:在 DeepSeek Harness 中预览任意 `.md` 文件时,点击右上角预览工具栏的 **「Inkmap 思维导图」** 按钮,即可在右侧并排打开可编辑思维导图。
|
|
10
10
|
2. **全屏三栏工作台**:需要同时对照项目目录树与源码精修时,点击导图工具栏右上角的 **「浏览器打开」** 即可一键展开全屏三栏 IDE 工作台。
|
|
11
11
|
3. **在线免安装体验台**:https://www.zhiyuanv.com/inkmap.html
|
|
12
12
|
|
|
13
13
|
## ✨ 核心特性动态展示
|
|
14
14
|
|
|
15
|
-
### 1.
|
|
16
|
-
|
|
15
|
+
### 1. 剪贴板截图一键粘贴 & 拖拽插图(自动保存至 `<文档名>.assets/`)
|
|
16
|
+
- 选中任意导图节点按 **`⌘V`(`Ctrl+V`)** 粘贴截图(或从文件夹直接拖入 `PNG` / `JPG` / `GIF` / `WebP` 图片),自动作为子图节点插入并渲染;在源码或编辑框内粘贴则直接在光标处插入相对路径链接。
|
|
17
|
+
- 图片自动存入同级 `<文档名>.assets/` 文件夹(保留中文可读路径,不覆盖已有文件),无需外接图床,Git 与标准 Markdown 预览器直接兼容。
|
|
18
|
+
|
|
19
|
+

|
|
20
|
+
|
|
21
|
+
### 2. 节点内嵌可视化 Mermaid 流程图 + LaTeX 公式 + 表格
|
|
22
|
+
在节点下放置 ` ```mermaid ` 代码块,直接在导图节点内高清渲染流程图、时序图、状态图;打开大图预览可直接点击流程图节点或连线原地改名、`Tab` 新增后继节点、连线或切换形状,实时写回源码:
|
|
17
23
|
|
|
18
24
|

|
|
19
25
|
|
|
20
|
-
###
|
|
21
|
-
|
|
26
|
+
### 3. 9 种专业结构 · 夜色护眼主题 · 全屏逐节点放映
|
|
27
|
+
一键切换左右思维导图、逻辑结构图、组织结构图、目录组织图、时间轴、鱼骨图及夜色深色主题;点击 **「演示」** 直接当 PPT 逐节点聚焦汇报,支持导出高清 PNG、矢量 SVG 与离线交互 HTML:
|
|
22
28
|
|
|
23
29
|

|
|
24
30
|
|
|
@@ -26,9 +32,9 @@
|
|
|
26
32
|
|
|
27
33
|
| 操作 | 快捷键 / 方式 | 操作 | 快捷键 / 方式 |
|
|
28
34
|
| :--- | :--- | :--- | :--- |
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
35
|
+
| **新增子节点 / 同级节点** | `Tab` / `Enter` | **粘贴剪贴板截图 / 拖入图片** | **`⌘V` (`Ctrl+V`) 或鼠标拖拽图片** |
|
|
36
|
+
| **新增父级节点** | `Shift + Tab` | **编辑流程图 / 公式 / 表格源码** | 双击节点 或 `⌘E` (`Ctrl+E`) |
|
|
37
|
+
| **上下调整节点顺序** | `⌘↑` / `⌘↓` (`Alt+↑` / `Alt+↓`) | **全图查找与批量替换** | `⌘F` (`Ctrl+F`) |
|
|
32
38
|
| **删除 / 拖拽重组** | `Backspace` / 鼠标拖拽 | **立即保存 / 撤销重做** | `⌘S` / `⌘Z` / `⇧⌘Z` |
|
|
33
39
|
|
|
34
40
|
- **官方网站与全平台支持**:https://www.zhiyuanv.com/software.html
|
package/client.js
CHANGED
|
@@ -41,6 +41,9 @@ function billingFlowUrl(raw, origin, mode, legacy = false) {
|
|
|
41
41
|
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
42
42
|
var TRIAL_MS = 7 * DAY_MS;
|
|
43
43
|
|
|
44
|
+
// packages/core/dist/images.js
|
|
45
|
+
var MAX_IMAGE_BYTES = 10 * 1024 * 1024;
|
|
46
|
+
|
|
44
47
|
// packages/harness/src/shared.mjs
|
|
45
48
|
var packageName = true ? "dsh-inkmap" : "dsh-inkmap";
|
|
46
49
|
var kind = "inkmap-markdown";
|
package/host.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// packages/harness/src/host.mjs
|
|
2
2
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
3
|
-
import { lstat as lstat3, realpath as
|
|
3
|
+
import { lstat as lstat3, realpath as realpath4 } from "node:fs/promises";
|
|
4
4
|
import { isAbsolute as isAbsolute2, relative as relative3, sep as sep3 } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
|
|
@@ -26,6 +26,52 @@ function hasAccess(state, now = Date.now()) {
|
|
|
26
26
|
return state.pro || (state.trialUntil ?? 0) > now;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
// packages/core/dist/images.js
|
|
30
|
+
var MAX_IMAGE_BYTES = 10 * 1024 * 1024;
|
|
31
|
+
var startsWith = (bytes, signature, offset = 0) => [...signature].every((char, i) => bytes[offset + i] === char.charCodeAt(0));
|
|
32
|
+
function sniffImage(bytes) {
|
|
33
|
+
if (startsWith(bytes, "\x89PNG\r\n\n"))
|
|
34
|
+
return "png";
|
|
35
|
+
if (startsWith(bytes, "\xFF\xD8\xFF"))
|
|
36
|
+
return "jpg";
|
|
37
|
+
if (startsWith(bytes, "GIF87a") || startsWith(bytes, "GIF89a"))
|
|
38
|
+
return "gif";
|
|
39
|
+
if (startsWith(bytes, "RIFF") && startsWith(bytes, "WEBP", 8))
|
|
40
|
+
return "webp";
|
|
41
|
+
return void 0;
|
|
42
|
+
}
|
|
43
|
+
function decodeImageDataUrl(dataUrl) {
|
|
44
|
+
const match = typeof dataUrl === "string" ? /^data:[\w.+/-]*;base64,([A-Za-z0-9+/]*={0,2})$/.exec(dataUrl) : null;
|
|
45
|
+
if (!match)
|
|
46
|
+
return { problem: "type" };
|
|
47
|
+
if (match[1].length * 3 / 4 - 2 > MAX_IMAGE_BYTES)
|
|
48
|
+
return { problem: "size" };
|
|
49
|
+
let binary;
|
|
50
|
+
try {
|
|
51
|
+
binary = atob(match[1]);
|
|
52
|
+
} catch {
|
|
53
|
+
return { problem: "type" };
|
|
54
|
+
}
|
|
55
|
+
if (binary.length > MAX_IMAGE_BYTES)
|
|
56
|
+
return { problem: "size" };
|
|
57
|
+
const bytes = Uint8Array.from(binary, (char) => char.charCodeAt(0));
|
|
58
|
+
const extension = sniffImage(bytes);
|
|
59
|
+
return extension ? { bytes, extension } : { problem: "type" };
|
|
60
|
+
}
|
|
61
|
+
function imageFolderName(documentFileName) {
|
|
62
|
+
const stem = documentFileName.replace(/\.(?:md|markdown)$/i, "").trim();
|
|
63
|
+
return `${/^\.*$/.test(stem) ? "images" : stem}.assets`;
|
|
64
|
+
}
|
|
65
|
+
function imageFileName(when, extension, attempt = 1) {
|
|
66
|
+
const two = (n) => String(n).padStart(2, "0");
|
|
67
|
+
const stamp = `${when.getFullYear()}${two(when.getMonth() + 1)}${two(when.getDate())}-${two(when.getHours())}${two(when.getMinutes())}${two(when.getSeconds())}`;
|
|
68
|
+
return `image-${stamp}${attempt > 1 ? `-${attempt}` : ""}.${extension}`;
|
|
69
|
+
}
|
|
70
|
+
function imageLinkPath(folder, file) {
|
|
71
|
+
const encode = (part) => part.replace(/[%\s()<>#?[\]\\"]/g, (char) => encodeURIComponent(char).replace(/\(/g, "%28").replace(/\)/g, "%29"));
|
|
72
|
+
return `${encode(folder)}/${encode(file)}`;
|
|
73
|
+
}
|
|
74
|
+
|
|
29
75
|
// packages/core/dist/index.js
|
|
30
76
|
function sanitizeViewState(raw) {
|
|
31
77
|
if (!raw || typeof raw !== "object")
|
|
@@ -59,7 +105,7 @@ import { homedir, tmpdir } from "node:os";
|
|
|
59
105
|
import { dirname, join } from "node:path";
|
|
60
106
|
|
|
61
107
|
// packages/cli/dist/version.js
|
|
62
|
-
var INKMAP_VERSION = "0.3.
|
|
108
|
+
var INKMAP_VERSION = "0.3.20";
|
|
63
109
|
|
|
64
110
|
// packages/cli/dist/license.js
|
|
65
111
|
var ZH_LOCALE_RE = /^zh(?:[-_.]|$)/i;
|
|
@@ -1137,48 +1183,20 @@ async function localTrialDeadline() {
|
|
|
1137
1183
|
// packages/cli/dist/server.js
|
|
1138
1184
|
import { createHash, randomBytes } from "node:crypto";
|
|
1139
1185
|
import { watch } from "node:fs";
|
|
1140
|
-
import { lstat as lstat2, mkdir as
|
|
1186
|
+
import { lstat as lstat2, mkdir as mkdir3, readFile as readFile3, realpath as realpath3, rename as rename2, rm as rm2, stat, writeFile as writeFile3 } from "node:fs/promises";
|
|
1141
1187
|
import { createServer } from "node:http";
|
|
1142
1188
|
import { homedir as homedir3 } from "node:os";
|
|
1143
|
-
import { basename as basename2, delimiter as delimiter2, dirname as dirname3, extname, join as
|
|
1189
|
+
import { basename as basename2, delimiter as delimiter2, dirname as dirname3, extname, join as join4, normalize, relative as relative2, resolve as resolve2, sep as sep2 } from "node:path";
|
|
1144
1190
|
|
|
1145
|
-
// packages/cli/dist/
|
|
1146
|
-
import {
|
|
1147
|
-
|
|
1148
|
-
return new Promise((done) => {
|
|
1149
|
-
const child = spawn(cmd, args, { stdio: "ignore", detached: true });
|
|
1150
|
-
child.on("error", () => done(false));
|
|
1151
|
-
if (launched)
|
|
1152
|
-
child.on("spawn", () => done(true));
|
|
1153
|
-
else
|
|
1154
|
-
child.on("exit", (code) => done(code === 0));
|
|
1155
|
-
child.unref();
|
|
1156
|
-
});
|
|
1157
|
-
}
|
|
1158
|
-
async function openBrowserWindow(url) {
|
|
1159
|
-
if (process.env.INKMAP_NO_OPEN === "1" || !/^http:\/\/(?:127\.0\.0\.1|localhost|\[::1\]):[0-9]+\//.test(url))
|
|
1160
|
-
return;
|
|
1161
|
-
if (process.platform === "darwin") {
|
|
1162
|
-
if (await run("open", ["-a", "Google Chrome", url]))
|
|
1163
|
-
return;
|
|
1164
|
-
await run("open", [url]);
|
|
1165
|
-
return;
|
|
1166
|
-
}
|
|
1167
|
-
if (process.platform === "win32") {
|
|
1168
|
-
if (await run("cmd", ["/c", "start", "", "chrome", url]))
|
|
1169
|
-
return;
|
|
1170
|
-
await run("cmd", ["/c", "start", "", url]);
|
|
1171
|
-
return;
|
|
1172
|
-
}
|
|
1173
|
-
if (await run("google-chrome", [url], true))
|
|
1174
|
-
return;
|
|
1175
|
-
await run("xdg-open", [url], true);
|
|
1176
|
-
}
|
|
1191
|
+
// packages/cli/dist/image-assets.js
|
|
1192
|
+
import { mkdir as mkdir2, realpath as realpath2, writeFile as writeFile2 } from "node:fs/promises";
|
|
1193
|
+
import { join as join3 } from "node:path";
|
|
1177
1194
|
|
|
1178
1195
|
// packages/cli/dist/workspace-fs.js
|
|
1179
1196
|
import { lstat, readdir, readFile as readFile2, realpath } from "node:fs/promises";
|
|
1180
1197
|
import { homedir as homedir2 } from "node:os";
|
|
1181
1198
|
import { basename, delimiter, dirname as dirname2, isAbsolute, join as join2, posix, relative, resolve, sep, win32 } from "node:path";
|
|
1199
|
+
var say = (zh, en) => detectOsLocale() === "zh" ? zh : en;
|
|
1182
1200
|
var MAX_MARKDOWN_BYTES = 5 * 1024 * 1024;
|
|
1183
1201
|
var SKIP_SCAN_DIRS = /* @__PURE__ */ new Set([
|
|
1184
1202
|
".git",
|
|
@@ -1274,6 +1292,60 @@ async function scanMarkdownFiles(rootDir, { maxFiles = 200, maxDepth = 4, byRece
|
|
|
1274
1292
|
return found;
|
|
1275
1293
|
}
|
|
1276
1294
|
|
|
1295
|
+
// packages/cli/dist/image-assets.js
|
|
1296
|
+
async function saveImageAsset(documentDir, documentFileName, image, when = /* @__PURE__ */ new Date()) {
|
|
1297
|
+
const folder = imageFolderName(documentFileName);
|
|
1298
|
+
const target = join3(documentDir, folder);
|
|
1299
|
+
await mkdir2(target, { recursive: true });
|
|
1300
|
+
if (!insideOrEqual(await realpath2(documentDir), await realpath2(target))) {
|
|
1301
|
+
throw new Error(say("\u56FE\u7247\u76EE\u5F55\u6307\u5411\u6587\u6863\u76EE\u5F55\u4E4B\u5916\uFF0C\u672A\u4FDD\u5B58\u56FE\u7247\u3002", "The pictures folder leads outside the document's folder, so nothing was saved."));
|
|
1302
|
+
}
|
|
1303
|
+
for (let attempt = 1; attempt <= 100; attempt++) {
|
|
1304
|
+
const name2 = imageFileName(when, image.extension, attempt);
|
|
1305
|
+
try {
|
|
1306
|
+
await writeFile2(join3(target, name2), image.bytes, { flag: "wx" });
|
|
1307
|
+
return imageLinkPath(folder, name2);
|
|
1308
|
+
} catch (error) {
|
|
1309
|
+
if (error.code !== "EEXIST")
|
|
1310
|
+
throw error;
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
throw new Error(say("\u65E0\u6CD5\u4E3A\u56FE\u7247\u751F\u6210\u65B0\u7684\u6587\u4EF6\u540D\u3002", "Could not find a free file name for the picture."));
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
// packages/cli/dist/open-browser.js
|
|
1317
|
+
import { spawn } from "node:child_process";
|
|
1318
|
+
function run(cmd, args, launched = false) {
|
|
1319
|
+
return new Promise((done) => {
|
|
1320
|
+
const child = spawn(cmd, args, { stdio: "ignore", detached: true });
|
|
1321
|
+
child.on("error", () => done(false));
|
|
1322
|
+
if (launched)
|
|
1323
|
+
child.on("spawn", () => done(true));
|
|
1324
|
+
else
|
|
1325
|
+
child.on("exit", (code) => done(code === 0));
|
|
1326
|
+
child.unref();
|
|
1327
|
+
});
|
|
1328
|
+
}
|
|
1329
|
+
async function openBrowserWindow(url) {
|
|
1330
|
+
if (process.env.INKMAP_NO_OPEN === "1" || !/^http:\/\/(?:127\.0\.0\.1|localhost|\[::1\]):[0-9]+\//.test(url))
|
|
1331
|
+
return;
|
|
1332
|
+
if (process.platform === "darwin") {
|
|
1333
|
+
if (await run("open", ["-a", "Google Chrome", url]))
|
|
1334
|
+
return;
|
|
1335
|
+
await run("open", [url]);
|
|
1336
|
+
return;
|
|
1337
|
+
}
|
|
1338
|
+
if (process.platform === "win32") {
|
|
1339
|
+
if (await run("cmd", ["/c", "start", "", "chrome", url]))
|
|
1340
|
+
return;
|
|
1341
|
+
await run("cmd", ["/c", "start", "", url]);
|
|
1342
|
+
return;
|
|
1343
|
+
}
|
|
1344
|
+
if (await run("google-chrome", [url], true))
|
|
1345
|
+
return;
|
|
1346
|
+
await run("xdg-open", [url], true);
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1277
1349
|
// packages/cli/dist/server.js
|
|
1278
1350
|
var MAX_BODY = 20 * 1024 * 1024;
|
|
1279
1351
|
var TYPES = {
|
|
@@ -1307,8 +1379,8 @@ function docName(path) {
|
|
|
1307
1379
|
return basename2(path).replace(/\.md$/i, "").replace(/\.markmap$/i, "");
|
|
1308
1380
|
}
|
|
1309
1381
|
function viewStateFile(key) {
|
|
1310
|
-
const base = process.env.INKMAP_HOME ||
|
|
1311
|
-
return
|
|
1382
|
+
const base = process.env.INKMAP_HOME || join4(homedir3(), ".inkmap");
|
|
1383
|
+
return join4(base, "view-state", hash(key) + ".json");
|
|
1312
1384
|
}
|
|
1313
1385
|
async function readDiskViewState(key) {
|
|
1314
1386
|
try {
|
|
@@ -1319,10 +1391,10 @@ async function readDiskViewState(key) {
|
|
|
1319
1391
|
}
|
|
1320
1392
|
async function writeDiskViewState(key, state) {
|
|
1321
1393
|
const target = viewStateFile(key);
|
|
1322
|
-
await
|
|
1394
|
+
await mkdir3(dirname3(target), { recursive: true, mode: 448 });
|
|
1323
1395
|
const temp = `${target}.${process.pid}.${Date.now()}`;
|
|
1324
1396
|
try {
|
|
1325
|
-
await
|
|
1397
|
+
await writeFile3(temp, JSON.stringify(state), { mode: 384 });
|
|
1326
1398
|
await rename2(temp, target);
|
|
1327
1399
|
} finally {
|
|
1328
1400
|
await rm2(temp, { force: true }).catch(() => {
|
|
@@ -1331,7 +1403,7 @@ async function writeDiskViewState(key, state) {
|
|
|
1331
1403
|
}
|
|
1332
1404
|
async function fileSource(file, log = () => {
|
|
1333
1405
|
}) {
|
|
1334
|
-
const path = await
|
|
1406
|
+
const path = await realpath3(resolve2(file)).catch(() => resolve2(file));
|
|
1335
1407
|
if (!(await stat(path)).isFile())
|
|
1336
1408
|
throw new Error(`\u4E0D\u662F\u6587\u4EF6\uFF1A${path}`);
|
|
1337
1409
|
const dir = dirname3(path);
|
|
@@ -1341,7 +1413,7 @@ async function fileSource(file, log = () => {
|
|
|
1341
1413
|
dir,
|
|
1342
1414
|
read: () => readFile3(path, "utf8"),
|
|
1343
1415
|
async write(md) {
|
|
1344
|
-
await
|
|
1416
|
+
await writeFile3(path, md, "utf8");
|
|
1345
1417
|
log(`\u5DF2\u5199\u56DE ${path}`);
|
|
1346
1418
|
},
|
|
1347
1419
|
watch(onChange) {
|
|
@@ -1371,7 +1443,7 @@ function within(root, rel, allowAbsoluteInRoot = false) {
|
|
|
1371
1443
|
}
|
|
1372
1444
|
const resolvedRoot = resolve2(root);
|
|
1373
1445
|
const base = resolvedRoot.endsWith(sep2) ? resolvedRoot : resolvedRoot + sep2;
|
|
1374
|
-
const full = allowAbsoluteInRoot && /^(?:[\\/]|[A-Za-z]:[\\/])/.test(decoded) ? normalize(decoded) : normalize(
|
|
1446
|
+
const full = allowAbsoluteInRoot && /^(?:[\\/]|[A-Za-z]:[\\/])/.test(decoded) ? normalize(decoded) : normalize(join4(resolvedRoot, decoded));
|
|
1375
1447
|
return full.startsWith(base) ? full : null;
|
|
1376
1448
|
}
|
|
1377
1449
|
async function serve({ source: initialSource, webRoot: webRoot2, port = 4377, host = "127.0.0.1", log = () => {
|
|
@@ -1429,17 +1501,17 @@ data: ${JSON.stringify(data)}
|
|
|
1429
1501
|
}), 80);
|
|
1430
1502
|
};
|
|
1431
1503
|
let unwatch = activeSource.watch(scheduleRefresh);
|
|
1432
|
-
const canonicalActiveKey = async () => activeSource.key ? await
|
|
1504
|
+
const canonicalActiveKey = async () => activeSource.key ? await realpath3(activeSource.key).catch(() => activeSource.key) : void 0;
|
|
1433
1505
|
async function collectWorkspaceFiles() {
|
|
1434
1506
|
const roots = /* @__PURE__ */ new Map();
|
|
1435
1507
|
if (activeSource.key && !confineToWorkspaceRoots) {
|
|
1436
|
-
const realKey = await
|
|
1437
|
-
const projRoot = await
|
|
1508
|
+
const realKey = await realpath3(activeSource.key).catch(() => activeSource.key);
|
|
1509
|
+
const projRoot = await realpath3(await findProjectRoot(realKey)).catch(() => dirname3(realKey));
|
|
1438
1510
|
roots.set(projRoot, { path: projRoot, name: basename2(projRoot), active: true });
|
|
1439
1511
|
}
|
|
1440
1512
|
const envRoots = [...workspaceRoots, ...(process.env.INKMAP_WORKSPACES || "").split(delimiter2)].filter(Boolean);
|
|
1441
1513
|
for (const raw of envRoots) {
|
|
1442
|
-
const real = await
|
|
1514
|
+
const real = await realpath3(resolve2(raw)).catch(() => null);
|
|
1443
1515
|
if (real && !roots.has(real)) {
|
|
1444
1516
|
roots.set(real, { path: real, name: basename2(real), active: roots.size === 0 });
|
|
1445
1517
|
}
|
|
@@ -1477,7 +1549,7 @@ data: ${JSON.stringify(data)}
|
|
|
1477
1549
|
throw notMarkdown();
|
|
1478
1550
|
const resolvedCandidate = resolve2(candidatePath);
|
|
1479
1551
|
const rawStat = await lstat2(resolvedCandidate).catch(() => null);
|
|
1480
|
-
const realTarget = await
|
|
1552
|
+
const realTarget = await realpath3(resolvedCandidate).catch(() => null);
|
|
1481
1553
|
const targetStat = realTarget ? await stat(realTarget).catch(() => null) : null;
|
|
1482
1554
|
if (!rawStat || rawStat.isSymbolicLink() && !trustCaller || !realTarget || !targetStat?.isFile() || targetStat.size > MAX_MARKDOWN_BYTES) {
|
|
1483
1555
|
throw new HttpError(403, zh() ? "\u8BF7\u9009\u62E9 5 MiB \u4EE5\u5185\u7684\u666E\u901A Markdown \u6587\u4EF6\u3002" : "Choose a regular Markdown file up to 5 MiB.");
|
|
@@ -1632,6 +1704,20 @@ data: ${JSON.stringify(data)}
|
|
|
1632
1704
|
return json2(res, 200, { version });
|
|
1633
1705
|
});
|
|
1634
1706
|
}
|
|
1707
|
+
if (url.pathname === "/api/image" && req.method === "POST") {
|
|
1708
|
+
if (!sameOriginWrite())
|
|
1709
|
+
return json2(res, 403, { error: "forbidden" });
|
|
1710
|
+
const image = decodeImageDataUrl(JSON.parse(await readBody2(req)).dataUrl);
|
|
1711
|
+
if ("problem" in image) {
|
|
1712
|
+
return json2(res, image.problem === "size" ? 413 : 415, { error: image.problem });
|
|
1713
|
+
}
|
|
1714
|
+
if (!hasAccess(await license?.state() ?? { pro: false }))
|
|
1715
|
+
return json2(res, 403, { error: "Inkmap trial expired" });
|
|
1716
|
+
return await serialized(async () => {
|
|
1717
|
+
const name2 = activeSource.key ? basename2(activeSource.key) : activeSource.name;
|
|
1718
|
+
return json2(res, 200, { path: await saveImageAsset(activeSource.dir, name2, image) });
|
|
1719
|
+
});
|
|
1720
|
+
}
|
|
1635
1721
|
if (url.pathname === "/api/license" && req.method === "GET")
|
|
1636
1722
|
return json2(res, 200, await license?.state({ forUi: true }) ?? { pro: false });
|
|
1637
1723
|
if (url.pathname === "/api/open" && req.method === "POST") {
|
|
@@ -1747,8 +1833,8 @@ data: ${JSON.stringify(data)}
|
|
|
1747
1833
|
if (url.pathname.startsWith("/doc-assets/")) {
|
|
1748
1834
|
let asset = within(activeSource.dir, url.pathname.slice("/doc-assets/".length), true);
|
|
1749
1835
|
if (asset) {
|
|
1750
|
-
const root = await
|
|
1751
|
-
asset = await
|
|
1836
|
+
const root = await realpath3(activeSource.dir).catch(() => null);
|
|
1837
|
+
asset = await realpath3(asset).catch(() => null);
|
|
1752
1838
|
const allowedExt = sidebar ? /\.(?:png|jpe?g|gif|webp|avif|bmp|ico)$/i : /\.(?:png|jpe?g|gif|webp|avif|bmp|ico|svg)$/i;
|
|
1753
1839
|
if (!root || !asset || !insideOrEqual(root, asset) || !allowedExt.test(asset))
|
|
1754
1840
|
asset = null;
|
|
@@ -1842,7 +1928,7 @@ async function workspaceFile(ctx, address) {
|
|
|
1842
1928
|
if (typeof hostPath !== "string") throw new FileUnavailable();
|
|
1843
1929
|
const roundTrip = fs.processPathFromHostPath(hostPath);
|
|
1844
1930
|
if (roundTrip === void 0 || (await fs.resolve(roundTrip)).targetKey !== target.targetKey) throw new FileUnavailable();
|
|
1845
|
-
return
|
|
1931
|
+
return realpath4(hostPath);
|
|
1846
1932
|
};
|
|
1847
1933
|
const [root, path] = await Promise.all([local(header.cwd), local(file.path)]);
|
|
1848
1934
|
const child = relative3(root, path);
|
|
@@ -1853,7 +1939,7 @@ async function workspaceFile(ctx, address) {
|
|
|
1853
1939
|
}
|
|
1854
1940
|
async function assertFile(path) {
|
|
1855
1941
|
const info = await lstat3(path);
|
|
1856
|
-
if (!info.isFile() || info.size > maxBytes || await
|
|
1942
|
+
if (!info.isFile() || info.size > maxBytes || await realpath4(path) !== path) throw new FileUnavailable();
|
|
1857
1943
|
}
|
|
1858
1944
|
async function confinedSource(path) {
|
|
1859
1945
|
const source = await fileSource(path);
|
package/locale/en.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
|
-
"title": "Inkmap — Markdown mind map &
|
|
4
|
-
"description": "Open local Markdown files as interactive two-way mind maps (Markmap) and Mermaid flowcharts in the right sidebar, with
|
|
3
|
+
"title": "Inkmap — Markdown mind map, Mermaid & paste-image editor",
|
|
4
|
+
"description": "Open local Markdown files as interactive two-way mind maps (Markmap) and visual Mermaid flowcharts in the right sidebar, with clipboard screenshot paste (.assets/) and live file sync.",
|
|
5
5
|
"detail": "README.md"
|
|
6
6
|
}
|
|
7
7
|
}
|
package/locale/zh.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
|
-
"title": "Inkmap 思维导图(Markdown
|
|
4
|
-
"description": "在右侧栏将本地 Markdown
|
|
3
|
+
"title": "Inkmap 思维导图(Markdown 双向脑图 · 流程图 · 剪贴板贴图)",
|
|
4
|
+
"description": "在右侧栏将本地 Markdown 实时渲染为可双向编辑的思维导图与可视化 Mermaid 流程图,支持剪贴板截图粘贴落盘 (.assets/) 并自动写回源文件。",
|
|
5
5
|
"detail": "README.zh.md"
|
|
6
6
|
}
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-inkmap",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "Inkmap 思维导图 — 在 DeepSeek Harness 中将本地 Markdown 实时渲染为可双向编辑的思维导图 (Markmap)
|
|
3
|
+
"version": "0.3.20",
|
|
4
|
+
"description": "Inkmap 思维导图 — 在 DeepSeek Harness 中将本地 Markdown 实时渲染为可双向编辑的思维导图 (Markmap)、可视化 Mermaid 流程图与剪贴板贴图工作台 / Interactive two-way Markdown mind map, Mermaid flowchart & paste-image editor for DeepSeek Harness.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"icon": "./icon.svg",
|
|
7
7
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
"markmap",
|
|
25
25
|
"mermaid",
|
|
26
26
|
"markdown",
|
|
27
|
+
"paste-image",
|
|
28
|
+
"markdown-image",
|
|
27
29
|
"outline",
|
|
28
30
|
"flowchart",
|
|
29
31
|
"diagram",
|
|
@@ -40,6 +42,8 @@
|
|
|
40
42
|
"鱼骨图",
|
|
41
43
|
"时间轴",
|
|
42
44
|
"知识库",
|
|
45
|
+
"贴图",
|
|
46
|
+
"截图粘贴",
|
|
43
47
|
"笔记",
|
|
44
48
|
"双向同步",
|
|
45
49
|
"可视化"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as p,r as u,d as a}from"./chunk-OY52VR5R-
|
|
1
|
+
import{g as p,r as u,d as a}from"./chunk-OY52VR5R-D9fFQQga.js";import{p as f}from"./chunk-JWPE2WC7-C4rMZ1R2.js";import{_ as n,l as o}from"./mermaid.core-CrixXrk1.js";import{M as c,b as d}from"./cynefin-EF2NZ3EQ-DgJ6M0DF.js";import"./index-CP6siPCL.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},B={parser:R,db:a,renderer:u,styles:p};export{B as diagram};
|