mind-elixir 5.9.2 → 5.10.0-beta.1

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/readme.md CHANGED
@@ -1,466 +1,466 @@
1
- <p align="center">
2
- <a href="https://docs.mind-elixir.com" target="_blank" rel="noopener noreferrer">
3
- <img width="150" src="https://raw.githubusercontent.com/ssshooter/mind-elixir-core/master/images/logo2.png" alt="mindelixir logo2">
4
- </a>
5
- <h1 align="center">Mind Elixir</h1>
6
- </p>
7
-
8
- <p align="center">
9
- <a href="https://trendshift.io/repositories/13049" target="_blank"><img src="https://trendshift.io/api/badge/repositories/13049" alt="SSShooter%2Fmind-elixir-core | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
10
- </p>
11
-
12
- <p align="center">
13
- <a href="https://www.npmjs.com/package/mind-elixir">
14
- <img src="https://img.shields.io/npm/v/mind-elixir" alt="version">
15
- </a>
16
- <a href="https://github.com/ssshooter/mind-elixir-core/blob/master/LICENSE">
17
- <img src="https://img.shields.io/npm/l/mind-elixir" alt="license">
18
- </a>
19
- <a href="https://app.codacy.com/gh/ssshooter/mind-elixir-core?utm_source=github.com&utm_medium=referral&utm_content=ssshooter/mind-elixir-core&utm_campaign=Badge_Grade_Settings">
20
- <img src="https://api.codacy.com/project/badge/Grade/09fadec5bf094886b30cea6aabf3a88b" alt="code quality">
21
- </a>
22
- <a href="https://bundlephobia.com/result?p=mind-elixir">
23
- <img src="https://badgen.net/bundlephobia/dependency-count/mind-elixir" alt="dependency-count">
24
- </a>
25
- <a href="https://dependents.info/SSShooter/mind-elixir-core">
26
- <img src="https://dependents.info/SSShooter/mind-elixir-core/badge" alt="dependents count badge" />
27
- </a>
28
- <a href="https://packagephobia.com/result?p=mind-elixir">
29
- <img src="https://packagephobia.com/badge?p=mind-elixir" alt="package size">
30
- </a>
31
- </p>
32
-
33
- [English](/readme.md) |
34
- [中文](/readme/zh.md) |
35
- [Español](/readme/es.md) |
36
- [Français](/readme/fr.md) |
37
- [Português](/readme/pt.md) |
38
- [Русский](/readme/ru.md) |
39
- [日本語](/readme/ja.md) |
40
- [한국어](/readme/ko.md)
41
-
42
- Mind elixir is a open source JavaScript mind map core. You can use it with any frontend framework you like.
43
-
44
- ## Features
45
-
46
- ### 🎨 **User Experience**
47
-
48
- - **Fluent UX** - Smooth and intuitive interactions
49
- - **Well designed** - Clean and modern interface
50
- - **Mobile friendly** - Touch events for mobile devices
51
- - **Efficient shortcuts** - Keyboard shortcuts for power users
52
-
53
- ### ⚡ **Performance & Architecture**
54
-
55
- - **Lightweight** - Minimal bundle size
56
- - **High performance** - Optimized for large mind maps
57
- - **Framework agnostic** - Works with any frontend framework
58
- - **Pluginable** - Extensible architecture
59
-
60
- ### 🛠️ **Core Features**
61
-
62
- - **Interactive editing** - Built-in drag and drop / node edit capabilities
63
- - **Bulk operations** - Multi-node selection and operations
64
- - **Undo / Redo** - Complete operation history
65
- - **Node connections & summarization** - Custom node linking and content summarization
66
-
67
- ### 📤 **Export & Customization**
68
-
69
- - **Multiple export formats** - SVG / PNG / HTML export
70
- - **Easy styling** - Customize mindmap with CSS variables
71
- - **Theme support** - Built-in themes and custom styling
72
-
73
- [v5 Breaking Changes](https://github.com/SSShooter/mind-elixir-core/wiki/Breaking-Change#500)
74
-
75
- ## Build with AI
76
-
77
- Use `npx skills add` to install guides to your project:
78
-
79
- **Integration Guide**:
80
-
81
- ```bash
82
- npx skills add ssshooter/mind-elixir-core
83
- ```
84
-
85
- ![mind elixir skills](./images/skills.jpg)
86
-
87
- <details>
88
- <summary>Table of Contents</summary>
89
-
90
- - [Used by](#used-by)
91
- - [Features](#features)
92
- - [🎨 **User Experience**](#-user-experience)
93
- - [⚡ **Performance \& Architecture**](#-performance--architecture)
94
- - [🛠️ **Core Features**](#️-core-features)
95
- - [📤 **Export \& Customization**](#-export--customization)
96
- - [Build with AI](#%EF%B8%8F-build-with-ai)
97
- - [Try now](#try-now)
98
- - [Playground](#playground)
99
- - [Documentation](#documentation)
100
- - [Usage](#usage)
101
- - [Install](#install)
102
- - [NPM](#npm)
103
- - [Script tag](#script-tag)
104
- - [Init](#init)
105
- - [Data Structure](#data-structure)
106
- - [Event Handling](#event-handling)
107
- - [Data Export And Import](#data-export-and-import)
108
- - [Markdown Support](#markdown-support)
109
- - [Operation Guards](#operation-guards)
110
- - [Export as a Image](#export-as-a-image)
111
- - [Deprecated API](#deprecated-api)
112
- - [Theme](#theme)
113
- - [Shortcuts](#shortcuts)
114
- - [Who's using](#whos-using)
115
- - [Ecosystem](#ecosystem)
116
- - [Development](#development)
117
- - [Acknowledgments](#acknowledgments)
118
- - [Contributors](#contributors)
119
-
120
- </details>
121
-
122
- ## Used by
123
-
124
- <a href="https://dependents.info/SSShooter/mind-elixir-core">
125
- <img src="https://dependents.info/SSShooter/mind-elixir-core/image" alt="network dependents image" />
126
- </a>
127
-
128
- ## Try now
129
-
130
- ![mindelixir](https://raw.githubusercontent.com/ssshooter/mind-elixir-core/master/images/screenshot5_2.jpg)
131
-
132
- ### Playground
133
-
134
- - Vanilla JS - https://codepen.io/ssshooter/pen/vEOqWjE
135
- - React - https://codesandbox.io/p/devbox/mind-elixir-3-x-react-18-x-forked-f3mtcd
136
- - Vue3 - https://codesandbox.io/p/sandbox/mind-elixir-3-x-vue3-lth484
137
-
138
- ## Documentation
139
-
140
- https://docs.mind-elixir.com/
141
-
142
- ## Usage
143
-
144
- ### Install
145
-
146
- #### NPM
147
-
148
- ```bash
149
- npm i mind-elixir -S
150
- ```
151
-
152
- ```javascript
153
- import MindElixir from 'mind-elixir'
154
- import 'mind-elixir/style.css'
155
- ```
156
-
157
- #### Script tag
158
-
159
- ```html
160
- <script type="module" src="https://cdn.jsdelivr.net/npm/mind-elixir/dist/MindElixir.js"></script>
161
- ```
162
-
163
- And in your CSS file:
164
-
165
- ```css
166
- @import 'https://cdn.jsdelivr.net/npm/mind-elixir/dist/style.css';
167
- ```
168
-
169
- ### Init
170
-
171
- ```html
172
- <div id="map"></div>
173
- <style>
174
- #map {
175
- height: 500px;
176
- width: 100%;
177
- }
178
- </style>
179
- ```
180
-
181
- ```javascript
182
- import MindElixir from 'mind-elixir'
183
- import 'mind-elixir/style.css'
184
- import example from 'mind-elixir/dist/example1'
185
-
186
- let options = {
187
- el: '#map', // or HTMLDivElement
188
- direction: MindElixir.LEFT,
189
- toolBar: true, // default true
190
- keypress: true, // default true
191
- locale: 'en', // [zh_CN,zh_TW,en,ja,pt,ru,ro] waiting for PRs
192
- overflowHidden: false, // default false
193
- mainLinkStyle: 2, // [1,2] default 1
194
- mouseSelectionButton: 0, // 0 for left button, 2 for right button, default 0
195
- contextMenu: {
196
- focus: true,
197
- link: true,
198
- extend: [
199
- {
200
- name: 'Node edit',
201
- onclick: () => {
202
- alert('extend menu')
203
- },
204
- },
205
- ],
206
- }, // default true
207
- before: {
208
- insertSibling(type, obj) {
209
- return true
210
- },
211
- },
212
- // Custom markdown parser (optional)
213
- // markdown: (text) => customMarkdownParser(text), // provide your own markdown parser function
214
- }
215
-
216
- let mind = new MindElixir(options)
217
-
218
- mind.install(plugin) // install your plugin
219
-
220
- // create new map data
221
- const data = MindElixir.new('new topic')
222
- // or `example`
223
- // or the data return from `.getData()`
224
- mind.init(data)
225
-
226
- // get a node
227
- MindElixir.E('node-id')
228
- ```
229
-
230
- ### Data Structure
231
-
232
- ```javascript
233
- // whole node data structure up to now
234
- const nodeData = {
235
- topic: 'node topic',
236
- id: 'bd1c24420cd2c2f5',
237
- style: { fontSize: '32', color: '#3298db', background: '#ecf0f1' },
238
- expanded: true,
239
- parent: null,
240
- tags: ['Tag'],
241
- icons: ['😀'],
242
- hyperLink: 'https://github.com/ssshooter/mind-elixir-core',
243
- image: {
244
- url: 'https://raw.githubusercontent.com/ssshooter/mind-elixir-core/master/images/logo2.png', // required
245
- // you need to query the height and width of the image and calculate the appropriate value to display the image
246
- height: 90, // required
247
- width: 90, // required
248
- },
249
- children: [
250
- {
251
- topic: 'child',
252
- id: 'xxxx',
253
- // ...
254
- },
255
- ],
256
- }
257
- ```
258
-
259
- ### Event Handling
260
-
261
- ```javascript
262
- mind.bus.addListener('operation', operation => {
263
- console.log(operation)
264
- // return {
265
- // name: action name,
266
- // obj: target object
267
- // }
268
-
269
- // name: [insertSibling|addChild|removeNode|beginEdit|finishEdit]
270
- // obj: target
271
-
272
- // name: moveNode
273
- // obj: {from:target1,to:target2}
274
- })
275
-
276
- mind.bus.addListener('selectNodes', nodes => {
277
- console.log(nodes)
278
- })
279
-
280
- mind.bus.addListener('expandNode', node => {
281
- console.log('expandNode: ', node)
282
- })
283
- ```
284
-
285
- ### Data Export And Import
286
-
287
- ```javascript
288
- // data export
289
- const data = mind.getData() // javascript object, see src/example.js
290
- mind.getDataString() // stringify object
291
-
292
- // data import
293
- // initiate
294
- let mind = new MindElixir(options)
295
- mind.init(data)
296
- // data update
297
- mind.refresh(data)
298
- ```
299
-
300
- ### Markdown Support
301
-
302
- Mind Elixir supports custom markdown parsing:
303
-
304
- ```javascript
305
- // Disable markdown (default)
306
- let mind = new MindElixir({
307
- // markdown option omitted - no markdown processing
308
- })
309
-
310
- // Use custom markdown parser
311
- let mind = new MindElixir({
312
- markdown: text => {
313
- // Your custom markdown implementation
314
- return text
315
- .replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')
316
- .replace(/\*(.*?)\*/g, '<em>$1</em>')
317
- .replace(/`(.*?)`/g, '<code>$1</code>')
318
- },
319
- })
320
-
321
- // Use any markdown library (e.g., marked, markdown-it, etc.)
322
- import { marked } from 'marked'
323
- let mind = new MindElixir({
324
- markdown: text => marked(text),
325
- })
326
- ```
327
-
328
- ### Operation Guards
329
-
330
- ```javascript
331
- let mind = new MindElixir({
332
- // ...
333
- before: {
334
- async addChild(el, obj) {
335
- try {
336
- await saveDataToDb()
337
- return true
338
- } catch (err) {
339
- return false
340
- }
341
- },
342
- },
343
- })
344
- ```
345
-
346
- ## Export as a Image
347
-
348
- Install `@zumer/snapdom`, then:
349
-
350
- ```typescript
351
- import { snapdom } from '@zumer/snapdom'
352
-
353
- const download = async () => {
354
- const result = await snapdom(mind.nodes)
355
- await result.download({ format: 'jpg', filename: 'my-capture' })
356
- }
357
- ```
358
-
359
- For other export formats and advanced options, see the [Mind Elixir documentation](https://ssshooter.com/en/how-to-use-mind-elixir/#exporting-images).
360
-
361
- ### Deprecated API
362
-
363
- > ⚠️ **Deprecated**: The `mind.exportSvg()` method is deprecated and will be removed in a future version.
364
-
365
- ```typescript
366
- // DEPRECATED - Do not use in new projects
367
- const svgData = await mind.exportSvg()
368
- ```
369
-
370
- ## Theme
371
-
372
- ```javascript
373
- const options = {
374
- // ...
375
- theme: {
376
- name: 'Dark',
377
- // main lines color palette
378
- palette: ['#848FA0', '#748BE9', '#D2F9FE', '#4145A5', '#789AFA', '#706CF4', '#EF987F', '#775DD5', '#FCEECF', '#DA7FBC'],
379
- // overwrite css variables
380
- cssVar: {
381
- '--main-color': '#ffffff',
382
- '--main-bgcolor': '#4c4f69',
383
- '--color': '#cccccc',
384
- '--bgcolor': '#252526',
385
- '--panel-color': '255, 255, 255',
386
- '--panel-bgcolor': '45, 55, 72',
387
- },
388
- // all variables see /src/index.less
389
- },
390
- // ...
391
- }
392
-
393
- // ...
394
-
395
- mind.changeTheme({
396
- name: 'Latte',
397
- palette: ['#dd7878', '#ea76cb', '#8839ef', '#e64553', '#fe640b', '#df8e1d', '#40a02b', '#209fb5', '#1e66f5', '#7287fd'],
398
- cssVar: {
399
- '--main-color': '#444446',
400
- '--main-bgcolor': '#ffffff',
401
- '--color': '#777777',
402
- '--bgcolor': '#f6f6f6',
403
- },
404
- })
405
- ```
406
-
407
- Be aware that Mind Elixir will not observe the change of `prefers-color-scheme`. Please change the theme **manually** when the scheme changes.
408
-
409
- ## Shortcuts
410
-
411
- See [Shortcuts Guide](https://docs.mind-elixir.com/docs/guides/shortcuts) for detailed information.
412
-
413
- ## Who's using
414
-
415
- - [Mind Elixir Desktop](https://desktop.mind-elixir.com/)
416
- - [ebook-to-mindmap](https://github.com/SSShooter/ebook-to-mindmap)
417
- - [M10C-Video-Summary](https://github.com/SSShooter/M10C-Video-Summary)
418
-
419
- ## Ecosystem
420
-
421
- - [@mind-elixir/node-menu](https://github.com/ssshooter/node-menu)
422
- - [@mind-elixir/node-menu-neo](https://github.com/ssshooter/node-menu-neo)
423
- - [@mind-elixir/export-xmind](https://github.com/ssshooter/export-xmind)
424
- - [@mind-elixir/export-html](https://github.com/ssshooter/export-html)
425
- - [mind-elixir-react](https://github.com/ssshooter/mind-elixir-react)
426
-
427
- PRs are welcome!
428
-
429
- ## Development
430
-
431
- ```
432
- pnpm i
433
- pnpm dev
434
- ```
435
-
436
- Test generated files with `dev.dist.ts`:
437
-
438
- ```
439
- pnpm build
440
- pnpm link ./
441
- ```
442
-
443
- Update docs:
444
-
445
- ```
446
- # Install api-extractor
447
- pnpm install -g @microsoft/api-extractor
448
- # Maintain /src/docs.ts
449
- # Generate docs
450
- pnpm doc
451
- pnpm doc:md
452
- ```
453
-
454
- Use [DeepWiki](https://deepwiki.com/SSShooter/mind-elixir-core) to learn more about Mind Elixir
455
-
456
- ## Acknowledgments
457
-
458
- - [@viselect/vanilla](https://github.com/simonwep/selection/tree/master/packages/vanilla)
459
-
460
- ## Contributors
461
-
462
- Thanks for your contributions to Mind Elixir! Your support and dedication make this project better.
463
-
464
- <a href="https://github.com/SSShooter/mind-elixir-core/graphs/contributors">
465
- <img src="https://contrib.rocks/image?repo=SSShooter/mind-elixir-core" />
466
- </a>
1
+ <p align="center">
2
+ <a href="https://docs.mind-elixir.com" target="_blank" rel="noopener noreferrer">
3
+ <img width="150" src="https://raw.githubusercontent.com/ssshooter/mind-elixir-core/master/images/logo2.png" alt="mindelixir logo2">
4
+ </a>
5
+ <h1 align="center">Mind Elixir</h1>
6
+ </p>
7
+
8
+ <p align="center">
9
+ <a href="https://trendshift.io/repositories/13049" target="_blank"><img src="https://trendshift.io/api/badge/repositories/13049" alt="SSShooter%2Fmind-elixir-core | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
10
+ </p>
11
+
12
+ <p align="center">
13
+ <a href="https://www.npmjs.com/package/mind-elixir">
14
+ <img src="https://img.shields.io/npm/v/mind-elixir" alt="version">
15
+ </a>
16
+ <a href="https://github.com/ssshooter/mind-elixir-core/blob/master/LICENSE">
17
+ <img src="https://img.shields.io/npm/l/mind-elixir" alt="license">
18
+ </a>
19
+ <a href="https://app.codacy.com/gh/ssshooter/mind-elixir-core?utm_source=github.com&utm_medium=referral&utm_content=ssshooter/mind-elixir-core&utm_campaign=Badge_Grade_Settings">
20
+ <img src="https://api.codacy.com/project/badge/Grade/09fadec5bf094886b30cea6aabf3a88b" alt="code quality">
21
+ </a>
22
+ <a href="https://bundlephobia.com/result?p=mind-elixir">
23
+ <img src="https://badgen.net/bundlephobia/dependency-count/mind-elixir" alt="dependency-count">
24
+ </a>
25
+ <a href="https://dependents.info/SSShooter/mind-elixir-core">
26
+ <img src="https://dependents.info/SSShooter/mind-elixir-core/badge" alt="dependents count badge" />
27
+ </a>
28
+ <a href="https://packagephobia.com/result?p=mind-elixir">
29
+ <img src="https://packagephobia.com/badge?p=mind-elixir" alt="package size">
30
+ </a>
31
+ </p>
32
+
33
+ [English](/readme.md) |
34
+ [中文](/readme/zh.md) |
35
+ [Español](/readme/es.md) |
36
+ [Français](/readme/fr.md) |
37
+ [Português](/readme/pt.md) |
38
+ [Русский](/readme/ru.md) |
39
+ [日本語](/readme/ja.md) |
40
+ [한국어](/readme/ko.md)
41
+
42
+ Mind elixir is a open source JavaScript mind map core. You can use it with any frontend framework you like.
43
+
44
+ ## Features
45
+
46
+ ### 🎨 **User Experience**
47
+
48
+ - **Fluent UX** - Smooth and intuitive interactions
49
+ - **Well designed** - Clean and modern interface
50
+ - **Mobile friendly** - Touch events for mobile devices
51
+ - **Efficient shortcuts** - Keyboard shortcuts for power users
52
+
53
+ ### ⚡ **Performance & Architecture**
54
+
55
+ - **Lightweight** - Minimal bundle size
56
+ - **High performance** - Optimized for large mind maps
57
+ - **Framework agnostic** - Works with any frontend framework
58
+ - **Pluginable** - Extensible architecture
59
+
60
+ ### 🛠️ **Core Features**
61
+
62
+ - **Interactive editing** - Built-in drag and drop / node edit capabilities
63
+ - **Bulk operations** - Multi-node selection and operations
64
+ - **Undo / Redo** - Complete operation history
65
+ - **Node connections & summarization** - Custom node linking and content summarization
66
+
67
+ ### 📤 **Export & Customization**
68
+
69
+ - **Multiple export formats** - SVG / PNG / HTML export
70
+ - **Easy styling** - Customize mindmap with CSS variables
71
+ - **Theme support** - Built-in themes and custom styling
72
+
73
+ [v5 Breaking Changes](https://github.com/SSShooter/mind-elixir-core/wiki/Breaking-Change#500)
74
+
75
+ ## Build with AI
76
+
77
+ Use `npx skills add` to install guides to your project:
78
+
79
+ **Integration Guide**:
80
+
81
+ ```bash
82
+ npx skills add ssshooter/mind-elixir-core
83
+ ```
84
+
85
+ ![mind elixir skills](./images/skills.jpg)
86
+
87
+ <details>
88
+ <summary>Table of Contents</summary>
89
+
90
+ - [Used by](#used-by)
91
+ - [Features](#features)
92
+ - [🎨 **User Experience**](#-user-experience)
93
+ - [⚡ **Performance \& Architecture**](#-performance--architecture)
94
+ - [🛠️ **Core Features**](#️-core-features)
95
+ - [📤 **Export \& Customization**](#-export--customization)
96
+ - [Build with AI](#%EF%B8%8F-build-with-ai)
97
+ - [Try now](#try-now)
98
+ - [Playground](#playground)
99
+ - [Documentation](#documentation)
100
+ - [Usage](#usage)
101
+ - [Install](#install)
102
+ - [NPM](#npm)
103
+ - [Script tag](#script-tag)
104
+ - [Init](#init)
105
+ - [Data Structure](#data-structure)
106
+ - [Event Handling](#event-handling)
107
+ - [Data Export And Import](#data-export-and-import)
108
+ - [Markdown Support](#markdown-support)
109
+ - [Operation Guards](#operation-guards)
110
+ - [Export as a Image](#export-as-a-image)
111
+ - [Deprecated API](#deprecated-api)
112
+ - [Theme](#theme)
113
+ - [Shortcuts](#shortcuts)
114
+ - [Who's using](#whos-using)
115
+ - [Ecosystem](#ecosystem)
116
+ - [Development](#development)
117
+ - [Acknowledgments](#acknowledgments)
118
+ - [Contributors](#contributors)
119
+
120
+ </details>
121
+
122
+ ## Used by
123
+
124
+ <a href="https://dependents.info/SSShooter/mind-elixir-core">
125
+ <img src="https://dependents.info/SSShooter/mind-elixir-core/image" alt="network dependents image" />
126
+ </a>
127
+
128
+ ## Try now
129
+
130
+ ![mindelixir](https://raw.githubusercontent.com/ssshooter/mind-elixir-core/master/images/screenshot5_2.jpg)
131
+
132
+ ### Playground
133
+
134
+ - Vanilla JS - https://codepen.io/ssshooter/pen/vEOqWjE
135
+ - React - https://codesandbox.io/p/devbox/mind-elixir-3-x-react-18-x-forked-f3mtcd
136
+ - Vue3 - https://codesandbox.io/p/sandbox/mind-elixir-3-x-vue3-lth484
137
+
138
+ ## Documentation
139
+
140
+ https://docs.mind-elixir.com/
141
+
142
+ ## Usage
143
+
144
+ ### Install
145
+
146
+ #### NPM
147
+
148
+ ```bash
149
+ npm i mind-elixir -S
150
+ ```
151
+
152
+ ```javascript
153
+ import MindElixir from 'mind-elixir'
154
+ import 'mind-elixir/style.css'
155
+ ```
156
+
157
+ #### Script tag
158
+
159
+ ```html
160
+ <script type="module" src="https://cdn.jsdelivr.net/npm/mind-elixir/dist/MindElixir.js"></script>
161
+ ```
162
+
163
+ And in your CSS file:
164
+
165
+ ```css
166
+ @import 'https://cdn.jsdelivr.net/npm/mind-elixir/dist/style.css';
167
+ ```
168
+
169
+ ### Init
170
+
171
+ ```html
172
+ <div id="map"></div>
173
+ <style>
174
+ #map {
175
+ height: 500px;
176
+ width: 100%;
177
+ }
178
+ </style>
179
+ ```
180
+
181
+ ```javascript
182
+ import MindElixir from 'mind-elixir'
183
+ import { en } from 'mind-elixir/i18n'
184
+ import 'mind-elixir/style.css'
185
+ import example from 'mind-elixir/dist/example1'
186
+
187
+ let options = {
188
+ el: '#map', // or HTMLDivElement
189
+ direction: MindElixir.LEFT,
190
+ toolBar: true, // default true
191
+ keypress: true, // default true
192
+ overflowHidden: false, // default false
193
+ mouseSelectionButton: 0, // 0 for left button, 2 for right button, default 0
194
+ contextMenu: {
195
+ locale: en, // [cn,zh_CN,zh_TW,en,ru,ja,pt,it,es,fr,ko,ro,da,fi,de,nl,nb,sv]
196
+ focus: true,
197
+ link: true,
198
+ extend: [
199
+ {
200
+ name: 'Node edit',
201
+ onclick: () => {
202
+ alert('extend menu')
203
+ },
204
+ },
205
+ ],
206
+ }, // default true
207
+ before: {
208
+ insertSibling(type, obj) {
209
+ return true
210
+ },
211
+ },
212
+ // Custom markdown parser (optional)
213
+ // markdown: (text) => customMarkdownParser(text), // provide your own markdown parser function
214
+ }
215
+
216
+ let mind = new MindElixir(options)
217
+
218
+ mind.install(plugin) // install your plugin
219
+
220
+ // create new map data
221
+ const data = MindElixir.new('new topic')
222
+ // or `example`
223
+ // or the data return from `.getData()`
224
+ mind.init(data)
225
+
226
+ // get a node
227
+ MindElixir.E('node-id')
228
+ ```
229
+
230
+ ### Data Structure
231
+
232
+ ```javascript
233
+ // whole node data structure up to now
234
+ const nodeData = {
235
+ topic: 'node topic',
236
+ id: 'bd1c24420cd2c2f5',
237
+ style: { fontSize: '32', color: '#3298db', background: '#ecf0f1' },
238
+ expanded: true,
239
+ parent: null,
240
+ tags: ['Tag'],
241
+ icons: ['😀'],
242
+ hyperLink: 'https://github.com/ssshooter/mind-elixir-core',
243
+ image: {
244
+ url: 'https://raw.githubusercontent.com/ssshooter/mind-elixir-core/master/images/logo2.png', // required
245
+ // you need to query the height and width of the image and calculate the appropriate value to display the image
246
+ height: 90, // required
247
+ width: 90, // required
248
+ },
249
+ children: [
250
+ {
251
+ topic: 'child',
252
+ id: 'xxxx',
253
+ // ...
254
+ },
255
+ ],
256
+ }
257
+ ```
258
+
259
+ ### Event Handling
260
+
261
+ ```javascript
262
+ mind.bus.addListener('operation', operation => {
263
+ console.log(operation)
264
+ // return {
265
+ // name: action name,
266
+ // obj: target object
267
+ // }
268
+
269
+ // name: [insertSibling|addChild|removeNode|beginEdit|finishEdit]
270
+ // obj: target
271
+
272
+ // name: moveNode
273
+ // obj: {from:target1,to:target2}
274
+ })
275
+
276
+ mind.bus.addListener('selectNodes', nodes => {
277
+ console.log(nodes)
278
+ })
279
+
280
+ mind.bus.addListener('expandNode', node => {
281
+ console.log('expandNode: ', node)
282
+ })
283
+ ```
284
+
285
+ ### Data Export And Import
286
+
287
+ ```javascript
288
+ // data export
289
+ const data = mind.getData() // javascript object, see src/example.js
290
+ mind.getDataString() // stringify object
291
+
292
+ // data import
293
+ // initiate
294
+ let mind = new MindElixir(options)
295
+ mind.init(data)
296
+ // data update
297
+ mind.refresh(data)
298
+ ```
299
+
300
+ ### Markdown Support
301
+
302
+ Mind Elixir supports custom markdown parsing:
303
+
304
+ ```javascript
305
+ // Disable markdown (default)
306
+ let mind = new MindElixir({
307
+ // markdown option omitted - no markdown processing
308
+ })
309
+
310
+ // Use custom markdown parser
311
+ let mind = new MindElixir({
312
+ markdown: text => {
313
+ // Your custom markdown implementation
314
+ return text
315
+ .replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')
316
+ .replace(/\*(.*?)\*/g, '<em>$1</em>')
317
+ .replace(/`(.*?)`/g, '<code>$1</code>')
318
+ },
319
+ })
320
+
321
+ // Use any markdown library (e.g., marked, markdown-it, etc.)
322
+ import { marked } from 'marked'
323
+ let mind = new MindElixir({
324
+ markdown: text => marked(text),
325
+ })
326
+ ```
327
+
328
+ ### Operation Guards
329
+
330
+ ```javascript
331
+ let mind = new MindElixir({
332
+ // ...
333
+ before: {
334
+ async addChild(el, obj) {
335
+ try {
336
+ await saveDataToDb()
337
+ return true
338
+ } catch (err) {
339
+ return false
340
+ }
341
+ },
342
+ },
343
+ })
344
+ ```
345
+
346
+ ## Export as a Image
347
+
348
+ Install `@zumer/snapdom`, then:
349
+
350
+ ```typescript
351
+ import { snapdom } from '@zumer/snapdom'
352
+
353
+ const download = async () => {
354
+ const result = await snapdom(mind.nodes)
355
+ await result.download({ format: 'jpg', filename: 'my-capture' })
356
+ }
357
+ ```
358
+
359
+ For other export formats and advanced options, see the [Mind Elixir documentation](https://ssshooter.com/en/how-to-use-mind-elixir/#exporting-images).
360
+
361
+ ### Deprecated API
362
+
363
+ > ⚠️ **Deprecated**: The `mind.exportSvg()` method is deprecated and will be removed in a future version.
364
+
365
+ ```typescript
366
+ // DEPRECATED - Do not use in new projects
367
+ const svgData = await mind.exportSvg()
368
+ ```
369
+
370
+ ## Theme
371
+
372
+ ```javascript
373
+ const options = {
374
+ // ...
375
+ theme: {
376
+ name: 'Dark',
377
+ // main lines color palette
378
+ palette: ['#848FA0', '#748BE9', '#D2F9FE', '#4145A5', '#789AFA', '#706CF4', '#EF987F', '#775DD5', '#FCEECF', '#DA7FBC'],
379
+ // overwrite css variables
380
+ cssVar: {
381
+ '--main-color': '#ffffff',
382
+ '--main-bgcolor': '#4c4f69',
383
+ '--color': '#cccccc',
384
+ '--bgcolor': '#252526',
385
+ '--panel-color': '255, 255, 255',
386
+ '--panel-bgcolor': '45, 55, 72',
387
+ },
388
+ // all variables see /src/index.less
389
+ },
390
+ // ...
391
+ }
392
+
393
+ // ...
394
+
395
+ mind.changeTheme({
396
+ name: 'Latte',
397
+ palette: ['#dd7878', '#ea76cb', '#8839ef', '#e64553', '#fe640b', '#df8e1d', '#40a02b', '#209fb5', '#1e66f5', '#7287fd'],
398
+ cssVar: {
399
+ '--main-color': '#444446',
400
+ '--main-bgcolor': '#ffffff',
401
+ '--color': '#777777',
402
+ '--bgcolor': '#f6f6f6',
403
+ },
404
+ })
405
+ ```
406
+
407
+ Be aware that Mind Elixir will not observe the change of `prefers-color-scheme`. Please change the theme **manually** when the scheme changes.
408
+
409
+ ## Shortcuts
410
+
411
+ See [Shortcuts Guide](https://docs.mind-elixir.com/docs/guides/shortcuts) for detailed information.
412
+
413
+ ## Who's using
414
+
415
+ - [Mind Elixir Desktop](https://desktop.mind-elixir.com/)
416
+ - [ebook-to-mindmap](https://github.com/SSShooter/ebook-to-mindmap)
417
+ - [M10C-Video-Summary](https://github.com/SSShooter/M10C-Video-Summary)
418
+
419
+ ## Ecosystem
420
+
421
+ - [@mind-elixir/node-menu](https://github.com/ssshooter/node-menu)
422
+ - [@mind-elixir/node-menu-neo](https://github.com/ssshooter/node-menu-neo)
423
+ - [@mind-elixir/export-xmind](https://github.com/ssshooter/export-xmind)
424
+ - [@mind-elixir/export-html](https://github.com/ssshooter/export-html)
425
+ - [mind-elixir-react](https://github.com/ssshooter/mind-elixir-react)
426
+
427
+ PRs are welcome!
428
+
429
+ ## Development
430
+
431
+ ```
432
+ pnpm i
433
+ pnpm dev
434
+ ```
435
+
436
+ Test generated files with `dev.dist.ts`:
437
+
438
+ ```
439
+ pnpm build
440
+ pnpm link ./
441
+ ```
442
+
443
+ Update docs:
444
+
445
+ ```
446
+ # Install api-extractor
447
+ pnpm install -g @microsoft/api-extractor
448
+ # Maintain /src/docs.ts
449
+ # Generate docs
450
+ pnpm doc
451
+ pnpm doc:md
452
+ ```
453
+
454
+ Use [DeepWiki](https://deepwiki.com/SSShooter/mind-elixir-core) to learn more about Mind Elixir
455
+
456
+ ## Acknowledgments
457
+
458
+ - [@viselect/vanilla](https://github.com/simonwep/selection/tree/master/packages/vanilla)
459
+
460
+ ## Contributors
461
+
462
+ Thanks for your contributions to Mind Elixir! Your support and dedication make this project better.
463
+
464
+ <a href="https://github.com/SSShooter/mind-elixir-core/graphs/contributors">
465
+ <img src="https://contrib.rocks/image?repo=SSShooter/mind-elixir-core" />
466
+ </a>