mind-elixir 4.1.5 → 4.2.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/dist/MindElixir.iife.js +6 -6
- package/dist/MindElixir.js +158 -132
- package/dist/MindElixirLite.iife.js +5 -5
- package/dist/MindElixirLite.js +119 -120
- package/dist/types/i18n.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/plugin/contextMenu.d.ts +11 -1
- package/dist/types/types/index.d.ts +2 -0
- package/dist/types/utils/pubsub.d.ts +1 -0
- package/package.json +2 -4
- package/readme.md +34 -1
package/dist/types/i18n.d.ts
CHANGED
|
@@ -11,6 +11,6 @@ type LangPack = {
|
|
|
11
11
|
clickTips: string;
|
|
12
12
|
summary: string;
|
|
13
13
|
};
|
|
14
|
-
export type Locale = 'cn' | 'zh_CN' | 'zh_TW' | 'en' | 'ru' | 'ja' | 'pt' | 'it' | 'es';
|
|
14
|
+
export type Locale = 'cn' | 'zh_CN' | 'zh_TW' | 'en' | 'ru' | 'ja' | 'pt' | 'it' | 'es' | 'fr' | 'ko';
|
|
15
15
|
declare const i18n: Record<Locale, LangPack>;
|
|
16
16
|
export default i18n;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { findEle } from './utils/dom';
|
|
|
5
5
|
export * from './types/index';
|
|
6
6
|
export * from './types/dom';
|
|
7
7
|
import type { MindElixirData, MindElixirInstance, MindElixirMethods, Options } from './types/index';
|
|
8
|
-
declare function MindElixir(this: MindElixirInstance, { el, direction, locale, draggable, editable, contextMenu, contextMenuOption, toolBar, keypress, mouseSelectionButton, before, newTopicName, allowUndo, generateMainBranch, generateSubBranch, overflowHidden, mobileMenu, theme, }: Options): void;
|
|
8
|
+
declare function MindElixir(this: MindElixirInstance, { el, direction, locale, draggable, editable, contextMenu, contextMenuOption, toolBar, keypress, mouseSelectionButton, selectionContainer, before, newTopicName, allowUndo, generateMainBranch, generateSubBranch, overflowHidden, mobileMenu, theme, }: Options): void;
|
|
9
9
|
declare namespace MindElixir {
|
|
10
10
|
export var prototype: {
|
|
11
11
|
init(this: MindElixirInstance, data: MindElixirData): Error | undefined;
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
import type { MindElixirInstance } from '../types/index';
|
|
2
2
|
import './contextMenu.less';
|
|
3
|
-
|
|
3
|
+
type Options = {
|
|
4
|
+
focus?: boolean;
|
|
5
|
+
link?: boolean;
|
|
6
|
+
extend?: {
|
|
7
|
+
name: string;
|
|
8
|
+
key?: string;
|
|
9
|
+
onclick: (e: MouseEvent) => void;
|
|
10
|
+
}[];
|
|
11
|
+
};
|
|
12
|
+
export default function (mind: MindElixirInstance, option: Options): () => void;
|
|
13
|
+
export {};
|
|
@@ -96,6 +96,7 @@ export interface MindElixirInstance extends MindElixirMethods {
|
|
|
96
96
|
undo: () => void;
|
|
97
97
|
redo: () => void;
|
|
98
98
|
selection: SelectionArea;
|
|
99
|
+
selectionContainer?: string | HTMLElement;
|
|
99
100
|
}
|
|
100
101
|
type PathString = string;
|
|
101
102
|
/**
|
|
@@ -123,6 +124,7 @@ export type Options = {
|
|
|
123
124
|
mobileMenu?: boolean;
|
|
124
125
|
theme?: Theme;
|
|
125
126
|
nodeMenu?: boolean;
|
|
127
|
+
selectionContainer?: string | HTMLElement;
|
|
126
128
|
};
|
|
127
129
|
export type Uid = string;
|
|
128
130
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mind-elixir",
|
|
3
|
-
"version": "4.1
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Mind elixir is a free open source mind map core.",
|
|
6
6
|
"keywords": [
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@commitlint/cli": "^17.8.1",
|
|
72
72
|
"@commitlint/config-conventional": "^17.8.1",
|
|
73
|
+
"@microsoft/api-documenter": "^7.25.14",
|
|
73
74
|
"@microsoft/api-extractor": "^7.47.0",
|
|
74
75
|
"@playwright/test": "^1.44.1",
|
|
75
76
|
"@rollup/plugin-strip": "^3.0.4",
|
|
@@ -87,8 +88,5 @@
|
|
|
87
88
|
"typescript": "^5.4.5",
|
|
88
89
|
"vite": "^4.5.3",
|
|
89
90
|
"vite-plugin-css-injected-by-js": "^3.5.1"
|
|
90
|
-
},
|
|
91
|
-
"dependencies": {
|
|
92
|
-
"@microsoft/api-documenter": "^7.25.14"
|
|
93
91
|
}
|
|
94
92
|
}
|
package/readme.md
CHANGED
|
@@ -25,7 +25,9 @@
|
|
|
25
25
|
|
|
26
26
|
[中文 README](https://github.com/ssshooter/mind-elixir-core/blob/master/readme.cn.md)
|
|
27
27
|
|
|
28
|
-
Mind elixir is a
|
|
28
|
+
Mind elixir is a open source JavaScript mind map core. You can use it with any frontend framework you like.
|
|
29
|
+
|
|
30
|
+
Features:
|
|
29
31
|
|
|
30
32
|
- Lightweight
|
|
31
33
|
- High performance
|
|
@@ -55,6 +57,8 @@ Mind elixir is a free open source mind map core.
|
|
|
55
57
|
- [Data Export And Import](#data-export-and-import)
|
|
56
58
|
- [Operation Guards](#operation-guards)
|
|
57
59
|
- [Export as a Image](#export-as-a-image)
|
|
60
|
+
- [Solution 1](#solution-1)
|
|
61
|
+
- [Solution 2](#solution-2)
|
|
58
62
|
- [APIs](#apis)
|
|
59
63
|
- [Theme](#theme)
|
|
60
64
|
- [Shortcuts](#shortcuts)
|
|
@@ -265,6 +269,8 @@ let mind = new MindElixir({
|
|
|
265
269
|
|
|
266
270
|
## Export as a Image
|
|
267
271
|
|
|
272
|
+
### Solution 1
|
|
273
|
+
|
|
268
274
|
```typescript
|
|
269
275
|
const mind = {
|
|
270
276
|
/** mind elixir instance */
|
|
@@ -281,6 +287,33 @@ const downloadPng = async () => {
|
|
|
281
287
|
}
|
|
282
288
|
```
|
|
283
289
|
|
|
290
|
+
### Solution 2
|
|
291
|
+
|
|
292
|
+
Install `@ssshooter/modern-screenshot`, then:
|
|
293
|
+
|
|
294
|
+
```typescript
|
|
295
|
+
import { domToPng } from '@ssshooter/modern-screenshot'
|
|
296
|
+
|
|
297
|
+
const download = async () => {
|
|
298
|
+
const dataUrl = await domToPng(mind.nodes, {
|
|
299
|
+
onCloneNode: node => {
|
|
300
|
+
const n = node as HTMLDivElement
|
|
301
|
+
n.style.position = ''
|
|
302
|
+
n.style.top = ''
|
|
303
|
+
n.style.left = ''
|
|
304
|
+
n.style.bottom = ''
|
|
305
|
+
n.style.right = ''
|
|
306
|
+
},
|
|
307
|
+
padding: 300,
|
|
308
|
+
quality: 1,
|
|
309
|
+
})
|
|
310
|
+
const link = document.createElement('a')
|
|
311
|
+
link.download = 'screenshot.png'
|
|
312
|
+
link.href = dataUrl
|
|
313
|
+
link.click()
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
284
317
|
## APIs
|
|
285
318
|
|
|
286
319
|
https://github.com/ssshooter/mind-elixir-core/blob/master/api/mind-elixir.api.md
|