# Xmind
**Repository Path**: icorecool/Xmind
## Basic Information
- **Project Name**: Xmind
- **Description**: XMind 是跨平台的免费思维导图软件,在功能上一点也不逊色于 FreeMind,某些方面,XMind 甚至更加具有优势
- **Primary Language**: Java
- **License**: MIT
- **Default Branch**: master
- **Homepage**: https://www.oschina.net/p/xmind
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 5
- **Created**: 2024-10-03
- **Last Updated**: 2024-10-03
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# 📦 📦 📦 
[](https://github.com/xmindltd/xmind-sdk-js/actions/workflows/codeql.yml)
[](https://ci.appveyor.com/project/danielsss/xmind-sdk-js/branch/master)
[](https://www.codacy.com/gh/xmindltd/xmind-sdk-js/dashboard?utm_source=github.com&utm_medium=referral&utm_content=xmindltd/xmind-sdk-js&utm_campaign=Badge_Grade)


[](https://xmind.app)
This project is a lightweight official software development kit for JavaScript/Typescript which is available for browsers and Node.js.
This library implements various functions which are similar to our UI applications, and You might know the basic concepts of this library if you've used the application before.
In order to use it conveniently, an essential concept you should know is that everything is a component and each one of them has a unique component ID. You can add a child node under the components, however, the Markers and Notes can only be attached to the components.
Eventually, Our UI apps could be used to open the `*.xmind` file generated by this tool.
## Recommendations
* [Xmind AI](https://xmind.works) - It's a lightweight online `Mind-Map` tool comes with AI features which helps you to build everything you wanted.
* [Xmind-generator](https://github.com/xmindltd/xmind-generator) — If you are looking for a tool specifically designed for `Mind-Map` generation, `Xmind Generator` is an official package that prioritizes this functionality, featuring a modern and lightweight API.
## Supported Platforms
* Linux
* Win32
* Browser (Not Fully Supported)
## Usage and Getting Started
### Node.js
```shell
$ npm i --save xmind
```
> NOTICE: The `xmind-sdk` is renamed to `xmind` from the version: 2.0.0
>
> Please, use `npm i --save xmind` to replace with it if you were using the `xmind-sdk`.
```js
const { Workbook, Topic, Marker } = require('xmind');
```
### Browser or Vue.js
```jsx harmony
import { Workbook, Topic, Marker } from 'xmind';
```
```html
// HTML
// Latest version
// Specify version
```
### More Examples
See [example directory](./example).
```js
const { Workbook, Topic, Marker, Zipper } = require('xmind');
const [ workbook, marker ] = [new Workbook(), new Marker()];
const topic = new Topic({sheet: workbook.createSheet('sheet title', 'Central Topic')});
const zipper = new Zipper({path: '/tmp', workbook, filename: 'MyFirstMap'});
// topic.on() default: `central topic`
topic.add({title: 'main topic 1'});
topic
.on(topic.cid(/*In default, the componentId is last element*/))
// add subtopics under `main topic 1`
.add({title: 'subtopic 1'})
.add({title: 'subtopic 2'})
// attach text note to `main topic 1`
.note('This is a note attached on main topic 1')
// attach a marker flag to `subtopic 1`
.on(topic.cid('subtopic 1'))
.marker(marker.week('fri'))
// add a component of the summary that contains two sub topics
.summary({title: 'subtopic summary', edge: topic.cid('subtopic 2')})
zipper.save().then(status => status && console.log('Saved /tmp/MyFirstMap.xmind'));
```
## Workbook
The workbook is a temporary storage where all the data are written.
### Methods
#### .createSheet(sheetTitle, topicTitle?) => `Sheet`
Once the workbook is created, then there's a way to build a sheet containing a `root topic`.
In addition, you can customize their titles by parameters.
| Name | Type | Default | Required |
|:---- |:----:|:-------:|:--------:|
| sheetTitle | String | `-` | Y |
| topicTitle | String | `Central Topic` | N |
#### .createSheets(options: Object[]) => `Object[]`
You can use this method to create sheets in bulk.
| Name | Type | Default | Required |
|:---- |:----:|:-------:|:--------:|
| sheetTitle | String | `-` | Y |
| topicTitle | String | `Central Topic` | N |
It returns an object of sheet identifier([Click here to check how it uses](./example/example.fully.js)).
```typescript
const sheets = workbook.createSheets([
{s: 'SheetTitle1', t: 'RootTopicTitle1'},
{s: 'SheetTitle2', t: 'RootTopicTitle2'}
]);
console.info(sheets);
// [
// { id: string, title: string },
// { id: string, title: string }
// ...
// ]
```
#### .getSheets() => `Object[]`
It allows you to get back the identifier of the sheet anytime and anywhere.
#### .getSheet(id: string) => `Sheet`
You can get an instance of the sheet with an existed sheet ID.
#### .theme(sheetTitle, themeName) => Boolean
The `UI client` has many theme styles and this library also offers some of them, such as `robust / snowbrush / business`.
| Name | Type | Default | Required |
|:---- |:----:|:-------:|:--------:|
| sheetTitle | String | null | Y |
| themeName | String | null | Y |
#### .toJSON()
Get component's data from the workbook in the form of `JSON`.
#### .toString()
Get component's data from the workbook in the form of `STRING`.
#### .validate() => `{status: Boolean, errors: Array