jsmind 0.9.0 → 2.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.
Files changed (40) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +78 -67
  3. package/README.zh.md +81 -0
  4. package/dist/cli.js +4482 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/jsmind.cjs +4101 -0
  7. package/dist/jsmind.cjs.map +1 -0
  8. package/dist/jsmind.d.ts +1269 -0
  9. package/dist/jsmind.js +4099 -0
  10. package/dist/jsmind.js.map +1 -0
  11. package/dist/jsmind.umd.js +4107 -0
  12. package/dist/jsmind.umd.js.map +1 -0
  13. package/package.json +65 -52
  14. package/es6/README-en.md +0 -37
  15. package/es6/README.md +0 -34
  16. package/es6/jsmind.draggable-node.js +0 -9
  17. package/es6/jsmind.draggable-node.js.map +0 -1
  18. package/es6/jsmind.js +0 -9
  19. package/es6/jsmind.js.map +0 -1
  20. package/es6/jsmind.screenshot.js +0 -9
  21. package/es6/jsmind.screenshot.js.map +0 -1
  22. package/style/jsmind.css +0 -408
  23. package/types/generated/index.d.ts +0 -8
  24. package/types/generated/jsmind.common.d.ts +0 -66
  25. package/types/generated/jsmind.d.ts +0 -343
  26. package/types/generated/jsmind.data_provider.d.ts +0 -56
  27. package/types/generated/jsmind.dom.d.ts +0 -59
  28. package/types/generated/jsmind.format.d.ts +0 -100
  29. package/types/generated/jsmind.graph.d.ts +0 -180
  30. package/types/generated/jsmind.layout_provider.d.ts +0 -182
  31. package/types/generated/jsmind.mind.d.ts +0 -121
  32. package/types/generated/jsmind.node.d.ts +0 -62
  33. package/types/generated/jsmind.option.d.ts +0 -64
  34. package/types/generated/jsmind.plugin.d.ts +0 -21
  35. package/types/generated/jsmind.shortcut_provider.d.ts +0 -52
  36. package/types/generated/jsmind.util.d.ts +0 -26
  37. package/types/generated/jsmind.view_provider.d.ts +0 -347
  38. package/types/generated/plugins/jsmind.draggable-node.d.ts +0 -229
  39. package/types/generated/plugins/jsmind.screenshot.d.ts +0 -83
  40. package/types/tsconfig.declaration.json +0 -19
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014-2025, ZHANG ZHIGANG <hizzgdev@163.com>
1
+ Copyright (c) 2024-2026, ZHANG ZHIGANG <hizzgdev@163.com>
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
@@ -11,7 +11,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
11
11
 
12
12
 
13
13
 
14
- 版权所有 (c) 2014-2025, 张志刚 <hizzgdev@163.com>
14
+ 版权所有 (c) 2024-2026, 张志刚 <hizzgdev@163.com>
15
15
  保留一切权利。
16
16
 
17
17
  在满足下列条件的前提下,授予使用者使用及再发布本软件的源代码或二进制形式的权利,无论是否修改皆然:
package/README.md CHANGED
@@ -1,74 +1,85 @@
1
- # jsMind
2
-
3
- [![npm version](https://badge.fury.io/js/jsmind.svg)](https://www.npmjs.com/package/jsmind)
4
- ![build-test](https://github.com/hizzgdev/jsmind/actions/workflows/node.js.yml/badge.svg)
5
-
6
- jsMind 是一个显示/编辑思维导图的纯 javascript 类库,其基于 html5 canvas 和 svg 进行设计。jsMind 以 [BSD 协议开源](LICENSE),在此基础上你可以在你的项目上任意使用。
7
-
8
- jsMind is mind map library built by javascript, it base on html5 canvas and svg. jsMind is released under [the BSD license](LICENSE), you can embed it in any project as long as you abide by the license.
9
-
10
- ## Project Home
11
-
12
- - [jsMind on Github](https://github.com/hizzgdev/jsmind)
13
- - [国内镜像 - Gitee](https://gitee.com/hizzgdev/jsmind)
14
-
15
- ## Get Started
16
-
17
- ```html
18
- <html>
19
- <head>
20
- <link
21
- type="text/css"
22
- rel="stylesheet"
23
- href="//cdn.jsdelivr.net/npm/jsmind@0.9.0/style/jsmind.css"
24
- />
25
- <script
26
- type="text/javascript"
27
- src="//cdn.jsdelivr.net/npm/jsmind@0.9.0/es6/jsmind.js"
28
- ></script>
29
- </head>
30
- <body>
31
- <div id="jsmind_container"></div>
32
-
33
- <script type="text/javascript">
34
- var mind = {
35
- // 3 data formats were supported ...
36
- // see documents for more information
37
- };
38
- var options = {
39
- container: 'jsmind_container',
40
- theme: 'orange',
41
- editable: true,
42
- };
43
- var jm = new jsMind(options);
44
- jm.show(mind);
45
- </script>
46
- </body>
47
- </html>
1
+ # jsMind V2
2
+
3
+ A mind-map kernel designed for AI agents — agents can reliably create, read, and modify structured maps; people can view, edit, and export them.
4
+
5
+ [Documentation](https://github.com/hizzgdev/jsmind-v2/blob/master/docs/README.md) · [Playground](https://hizzgdev.github.io/jsmind-v2/playground.html) · [Skill](skills/jsmind/SKILL.md)
6
+
7
+ 中文说明见 [README.zh.md](README.zh.md)。
8
+
9
+ <!-- Both the documentation and playground links are absolute, and both leave
10
+ the repository.
11
+ Docs stay on GitHub rather than being published as a site: they can be
12
+ searched, blamed and edited there, and rendering them to HTML would mean
13
+ maintaining a markdown build step for a project whose site is one page.
14
+ The documentation link points at docs/README.md, the public docs index,
15
+ not the whole historical docs/ tree.
16
+ The playground only exists on the published site - it is copied there from
17
+ example/ with its script path rewritten during deployment - so a relative
18
+ link would 404 when this README is read on GitHub. -->
19
+
20
+ ## Install
21
+
22
+ ```bash
23
+ npm i jsmind@2
24
+ ```
25
+
26
+ This is the 2.x line (npm tag `v2-preview`), a rewrite. It is not a drop-in replacement for v1 yet. `npm i jsmind` still installs v1 (0.9.x).
27
+
28
+ To build and run the CLI from this repository you need Node.js >= 22.12.0:
29
+
30
+ ```bash
31
+ git clone https://github.com/hizzgdev/jsmind-v2.git
32
+ cd jsmind-v2
33
+ npm install
34
+ npm run build
35
+ ```
36
+
37
+ From the repository root, run the local CLI with `npx jsmind` or `node dist/cli.js`. The commands below use `npx jsmind`; `node dist/cli.js` is equivalent.
38
+
39
+ ## Quick start
40
+
41
+ Create a map, read the root id from `context`, add a child, validate, and export a PNG:
42
+
43
+ ```
44
+ $ npx jsmind create tmp/hello.json --title "Hello"
45
+ created tmp/hello.json
46
+
47
+ $ npx jsmind context tmp/hello.json
48
+ root Hello {side=center}
49
+
50
+ $ npx jsmind mind add-child tmp/hello.json --parent-id root --text "World"
51
+ added jm-mwh96wk6 under root
52
+
53
+ $ npx jsmind validate tmp/hello.json
54
+ tmp/hello.json: valid
55
+
56
+ $ npx jsmind export tmp/hello.json tmp/hello.png
57
+ tmp/hello.png: 2400x1600 (85.0 KB)
48
58
  ```
49
59
 
50
- ## Links
60
+ The root id in this example is `root`. Child ids are generated; when you run these commands, use the ids from your current `context` output, and do not copy example ids.
61
+
62
+ ## Documentation
63
+
64
+ Public product docs are in [`docs/`](https://github.com/hizzgdev/jsmind-v2/blob/master/docs/README.md):
65
+
66
+ - Features — [serialization](docs/features/serialization.md), [image export](docs/features/image-export.md), [node content](docs/features/node-content.md), and [node move](docs/features/node-move.md)
67
+ - [Architecture](docs/architecture/architecture-overview.md) — design notes on why the system is built this way, **not** a getting-started handbook
68
+ - [Data format](docs/requirements/v2-data-format.md) — on-disk schema, validation rules, and error codes
69
+ - [CLI](docs/requirements/v2-cli.md) — command structure and exit-code contract
70
+
71
+ ## Playground
72
+
73
+ Try the library in the [Playground](https://hizzgdev.github.io/jsmind-v2/playground.html).
74
+
75
+ ## Skill
51
76
 
52
- - Resources:
53
- - [文档 - Documents](https://hizzgdev.github.io/jsmind/docs)
54
- - [NPM - jsmind](https://www.npmjs.com/package/jsmind)
55
- - CDN - [用法](docs/zh/1.usage.md) [Usage](docs/en/1.usage.md)
56
- - [UNPKG](https://unpkg.com/browse/jsmind/)
57
- - [jsDelivr](https://www.jsdelivr.com/package/npm/jsmind/)
58
- - [jsDelivr 国内镜像](https://jsd.onmicrosoft.cn/npm/jsmind/)
59
- - Apps :
60
- - <https://jsmind.online>
61
- - Demo :
62
- - [显示一个脑图 Render a mindmap](https://hizzgdev.github.io/jsmind/example/1_basic.html) [[国内版](https://hizzgdev.github.io/jsmind/example/1_basic_cn.html)]
63
- - [试用所有功能 Try all features](https://hizzgdev.github.io/jsmind/example/2_features.html) [[国内版](https://hizzgdev.github.io/jsmind/example/2_features_cn.html)]
64
- - [requirejs + jsMind](https://hizzgdev.github.io/jsmind/example/3_requirejs.html)
65
- - [更多示例 - More samples](https://github.com/hizzgdev/jsmind-samples) [[国内版](https://gitee.com/hizzgdev/jsmind-samples)]
77
+ The jsmind skill for drawing or editing a map with the CLI: [`skills/jsmind/SKILL.md`](skills/jsmind/SKILL.md). A Chinese copy is in [`SKILL.zh.md`](skills/jsmind/SKILL.zh.md).
66
78
 
67
- ## Funding
79
+ ## Development
68
80
 
69
- - [致谢 - Acknowledgement](https://hizzgdev.github.io/acknowledgement.html)
70
- - [资助 - Sponsor](https://hizzgdev.github.io/sponsor.html)
81
+ How to work in this repository — environment, layout, branch and PR conventions, and commands — is in [`AGENTS.md`](AGENTS.md).
71
82
 
72
- ## Maintainer
83
+ ## License
73
84
 
74
- - [张志刚 - Zhigang Zhang](https://hizzgdev.github.io)
85
+ This project is open source under the [BSD 3-Clause License](LICENSE).
package/README.zh.md ADDED
@@ -0,0 +1,81 @@
1
+ # jsMind V2
2
+
3
+ 为 AI agent 设计的思维导图内核 —— agent 能可靠地生成、读取、修改结构化的脑图数据,人能查看、编辑、导出。
4
+
5
+ [文档](https://github.com/hizzgdev/jsmind-v2/blob/master/docs/README.md) · [Playground](https://hizzgdev.github.io/jsmind-v2/playground.html) · [Skill](skills/jsmind/SKILL.zh.md)
6
+
7
+ English version: [README.md](README.md).
8
+
9
+ <!-- 文档和 Playground 都使用绝对链接,都会离开本仓库。
10
+ 文档留在 GitHub 上,不单独做成站点:方便在仓库里搜索、blame 和编辑;
11
+ 为只有一页的项目维护一套 markdown 构建流程并不值得。
12
+ 文档链接指向 docs/README.md(对外文档索引),而不是历史上整棵混杂的 docs/ 目录。
13
+ Playground 只存在于发布后的站点 —— 部署时从 example/ 复制并改写脚本路径 ——
14
+ 所以本 README 在 GitHub 上阅读时,相对链接会 404。 -->
15
+
16
+ ## 安装
17
+
18
+ ```bash
19
+ npm i jsmind@2
20
+ ```
21
+
22
+ 这是 2.x 预览线(npm tag 为 `v2-preview`),是一次重写,目前还不是 v1 的替代品。`npm i jsmind` 仍然会安装 v1(0.9.x)。
23
+
24
+ 从本仓库构建并运行 CLI 需要 Node.js >= 22.12.0:
25
+
26
+ ```bash
27
+ git clone https://github.com/hizzgdev/jsmind-v2.git
28
+ cd jsmind-v2
29
+ npm install
30
+ npm run build
31
+ ```
32
+
33
+ 在仓库根目录,用 `npx jsmind` 或 `node dist/cli.js` 运行本地 CLI。下面的命令使用 `npx jsmind`;`node dist/cli.js` 效果相同。
34
+
35
+ ## 快速上手
36
+
37
+ 创建一张图,用 `context` 拿到根节点 id,添加子节点,校验,再导出 PNG:
38
+
39
+ ```
40
+ $ npx jsmind create tmp/hello.json --title "Hello"
41
+ created tmp/hello.json
42
+
43
+ $ npx jsmind context tmp/hello.json
44
+ root Hello {side=center}
45
+
46
+ $ npx jsmind mind add-child tmp/hello.json --parent-id root --text "World"
47
+ added jm-mwh96wk6 under root
48
+
49
+ $ npx jsmind validate tmp/hello.json
50
+ tmp/hello.json: valid
51
+
52
+ $ npx jsmind export tmp/hello.json tmp/hello.png
53
+ tmp/hello.png: 2400x1600 (85.0 KB)
54
+ ```
55
+
56
+ 这个示例里的根节点 id 是 `root`。子节点 id 是生成的;执行时请使用当前 `context` 输出的 id,不要照抄示例 id。
57
+
58
+ ## 文档
59
+
60
+ 对外产品文档在 [`docs/`](https://github.com/hizzgdev/jsmind-v2/blob/master/docs/README.md):
61
+
62
+ - 功能说明 — [序列化](docs/features/serialization.md)、[图片导出](docs/features/image-export.md)、[节点内容](docs/features/node-content.md)、[节点移动](docs/features/node-move.md)
63
+ - [设计说明](docs/architecture/architecture-overview.md) — 解释系统为什么是现在这样,**不是**上手手册
64
+ - [数据格式](docs/requirements/v2-data-format.md) — 磁盘格式、校验规则与错误码
65
+ - [CLI](docs/requirements/v2-cli.md) — 命令结构与退出码契约
66
+
67
+ ## Playground
68
+
69
+ 在 [Playground](https://hizzgdev.github.io/jsmind-v2/playground.html) 里试用。
70
+
71
+ ## Skill
72
+
73
+ 用 CLI 画图或改图时使用的 jsmind skill:[`skills/jsmind/SKILL.zh.md`](skills/jsmind/SKILL.zh.md)。英文版见 [`SKILL.md`](skills/jsmind/SKILL.md)。
74
+
75
+ ## 开发
76
+
77
+ 如何改这个仓库(环境、目录、分支与 PR 约定、常用命令)见 [`AGENTS.md`](AGENTS.md)。
78
+
79
+ ## 开源协议
80
+
81
+ 本项目以 [BSD 3-Clause License](LICENSE) 开源。