Skip to content

Commit 3a5f5ca

Browse files
authored
📝 update readme file (#17)
1 parent efae7f4 commit 3a5f5ca

File tree

3 files changed

+93
-37
lines changed

3 files changed

+93
-37
lines changed

README.md

Lines changed: 93 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,100 @@
1-
# webpack4-starter-kit
2-
A webpack starter kit for frontend development
1+
# Mindtree
32

4-
## Install
5-
```
6-
npm install
3+
`Mindtree` is a library which helps to visualize your text content as a mind map. Currently, Mindtree support indented text, markdown support is on the road map.
4+
5+
- [Home page]()
6+
- [Installation]()
7+
- [Basic usage]()
8+
- Document - comming soon
9+
10+
11+
## Installation
12+
- Install from npm
13+
14+
`yarn add mintree`
15+
16+
- Add to your project assets
17+
Just copy `mindtree.js` to your assets directory
18+
19+
## Basic usage
20+
You have to follow these steps to render a mindmap:
21+
1. Build mind map data represented as a hierarchy tree
22+
2. Which layout you want to render as
23+
3. Build a `Mindmap` object from `data` and `layout`
24+
4. Bind a `Viewer` to a DOM element and render `Mindmap`
25+
26+
### 1. Vanilla javascript
27+
28+
Add this to your html
29+
```html
30+
<script src="mindtree.js"></script>
731
```
8-
or using yarn
932

33+
34+
```javascript
35+
var text = `
36+
Root
37+
38+
- branch 1
39+
+branch 1.1
40+
41+
- branch 2
42+
branch 2.1
43+
* branch 2.2
44+
branch 2.2.1
45+
46+
-Branch 3
47+
- alo
48+
- ola
49+
- ollala
50+
51+
-Branch 4
52+
- Branch 4.1
53+
- Branch 4.1.1
54+
- Branch 4.2
55+
- Branch 4.3`;
56+
57+
// parse indented text to hierarchy tree
58+
var data = mindtree.Parsers.TextParser.parse(text);
59+
// choose a layout
60+
var MindmapLayout = mindtree.MindmapLayouts.Standard;
61+
62+
// build Mindmap object
63+
var mindMap = new mindtree.MindMap(data.root, MindmapLayout, {});
64+
mindMap.build();
65+
66+
// binding viewer and render
67+
var viewer = new mindtree.Viewer("#drawing", {});
68+
viewer.render(mindMap);
1069
```
11-
yarn install
70+
71+
### 2. With ES6
72+
Import required classes
73+
74+
```javascript
75+
import {MindMap, Viewer, Parsers, MindmapLayout} from 'mindtree'
1276
```
1377

14-
## Command
78+
And then follows the same steps as above
79+
80+
81+
## Features
82+
83+
- **Parser**
84+
- Indented text
85+
86+
- **Layout**
87+
- Standard
88+
- RightLogical
89+
- DownwardOrganizational
90+
- UpwardOrganizational
91+
- LeftLogical
92+
93+
94+
## Credits
95+
- Thanks [leungwensen](https://github.com/leungwensen), This library is inspired by his repo [Mindmap layouts](https://github.com/leungwensen/mindmap-layouts). And I still copy the layout code from his source
96+
97+
- Thanks @stetrevor for his library [non-layered-tidy-tree-layout](https://github.com/stetrevor/non-layered-tidy-tree-layout)
98+
99+
- This project use [two.js](https://two.js.org/) for the rendering mindmap.
15100

16-
- `yarn watch` : watch for changes
17-
- `yarn start` : start dev server
18-
- `yarn dev` : build dev
19-
- `yarn build` : build production
20-
- `yarn clean` : clean build directory

package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@
3434
"webpack-dev-server": "^3.11.0"
3535
},
3636
"dependencies": {
37-
"@svgdotjs/svg.js": "^3.0.16",
38-
"hyperactiv": "^0.8.2",
39-
"jquery": "^3.5.1",
4037
"non-layered-tidy-tree-layout": "^2.0.2",
41-
"svg.js": "^2.7.1",
4238
"two.js": "^0.7.0-stable.1"
4339
},
4440
"prettier": {

yarn.lock

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -873,11 +873,6 @@
873873
remark "^12.0.0"
874874
unist-util-find-all-after "^3.0.1"
875875

876-
"@svgdotjs/svg.js@^3.0.16":
877-
version "3.0.16"
878-
resolved "https://registry.yarnpkg.com/@svgdotjs/svg.js/-/svg.js-3.0.16.tgz#7044754e45daf62c8e2b115c45ca33ca5b967aff"
879-
integrity sha512-yZ4jfP/SeLHEnCi9PIrzienKCrA4vW9+jm5uUV3N5DG2e9zgXLY5FgywK2u8/gMFIeKO0HuqTLFFfWJj+MfMLA==
880-
881876
"@types/color-name@^1.1.1":
882877
version "1.1.1"
883878
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
@@ -3202,11 +3197,6 @@ https-browserify@^1.0.0:
32023197
resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73"
32033198
integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=
32043199

3205-
hyperactiv@^0.8.2:
3206-
version "0.8.2"
3207-
resolved "https://registry.yarnpkg.com/hyperactiv/-/hyperactiv-0.8.2.tgz#8aaf361815359f4950a813723adc03c136b10ad6"
3208-
integrity sha512-WviGi/PnIQQqGl/fRLtkWlQbhgYnDowpPSOfD/s3W5JWVU4aKnT/xemZD7syAMi1NsdqlYpz3e4ETIpldH1hkQ==
3209-
32103200
iconv-lite@0.4.24:
32113201
version "0.4.24"
32123202
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
@@ -3650,11 +3640,6 @@ isobject@^3.0.0, isobject@^3.0.1:
36503640
resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
36513641
integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8=
36523642

3653-
jquery@^3.5.1:
3654-
version "3.5.1"
3655-
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.5.1.tgz#d7b4d08e1bfdb86ad2f1a3d039ea17304717abb5"
3656-
integrity sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg==
3657-
36583643
"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:
36593644
version "4.0.0"
36603645
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
@@ -5967,11 +5952,6 @@ svg-tags@^1.0.0:
59675952
resolved "https://registry.yarnpkg.com/svg-tags/-/svg-tags-1.0.0.tgz#58f71cee3bd519b59d4b2a843b6c7de64ac04764"
59685953
integrity sha1-WPcc7jvVGbWdSyqEO2x95krAR2Q=
59695954

5970-
svg.js@^2.7.1:
5971-
version "2.7.1"
5972-
resolved "https://registry.yarnpkg.com/svg.js/-/svg.js-2.7.1.tgz#eb977ed4737001eab859949b4a398ee1bb79948d"
5973-
integrity sha512-ycbxpizEQktk3FYvn/8BH+6/EuWXg7ZpQREJvgacqn46gIddG24tNNe4Son6omdXCnSOaApnpZw6MPCBA1dODA==
5974-
59755955
table@^5.4.6:
59765956
version "5.4.6"
59775957
resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e"

0 commit comments

Comments
 (0)