mind-elixir 5.0.0-beta.9 → 5.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.
- package/LICENSE +21 -21
- package/dist/LayoutSsr.iife.js +1 -0
- package/dist/LayoutSsr.js +95 -0
- package/dist/MindElixir.iife.js +7 -10
- package/dist/MindElixir.js +1404 -1300
- package/dist/MindElixirLite.iife.js +7 -10
- package/dist/MindElixirLite.js +785 -1124
- package/dist/example.iife.js +3 -3
- package/dist/example.js +169 -44
- package/dist/style.css +1 -0
- package/dist/types/arrow.d.ts +38 -1
- package/dist/types/exampleData/1.cn.d.ts +3 -125
- package/dist/types/index.d.ts +50 -51
- package/dist/types/interact.d.ts +4 -3
- package/dist/types/linkDiv.d.ts +1 -1
- package/dist/types/methods.d.ts +12 -12
- package/dist/types/mouse.d.ts +1 -1
- package/dist/types/nodeOperation.d.ts +1 -2
- package/dist/types/plugin/contextMenu.d.ts +1 -1
- package/dist/types/plugin/keypress.d.ts +6 -2
- package/dist/types/plugin/nodeDraggable.d.ts +1 -1
- package/dist/types/plugin/operationHistory.d.ts +1 -1
- package/dist/types/summary.d.ts +1 -1
- package/dist/types/types/index.d.ts +31 -39
- package/dist/types/utils/LinkDragMoveHelper.d.ts +14 -10
- package/dist/types/utils/dom.d.ts +1 -1
- package/dist/types/utils/dragMoveHelper.d.ts +1 -1
- package/dist/types/utils/index.d.ts +5 -0
- package/dist/types/utils/layout-ssr.d.ts +90 -0
- package/dist/types/utils/pubsub.d.ts +4 -10
- package/dist/types/utils/svg.d.ts +9 -1
- package/dist/types/utils/theme.d.ts +1 -2
- package/package.json +11 -5
- package/readme.md +21 -43
package/dist/types/index.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import './index.less';
|
|
2
|
-
import './iconfont/iconfont.js';
|
|
3
2
|
import { LEFT, RIGHT, SIDE, DARK_THEME, THEME } from './const';
|
|
4
|
-
import { findEle } from './utils/dom';
|
|
5
3
|
import type { MindElixirData, MindElixirInstance, MindElixirMethods, Options } from './types/index';
|
|
6
|
-
|
|
4
|
+
import type { Topic } from './docs';
|
|
5
|
+
declare function MindElixir(this: MindElixirInstance, { el, direction, locale, draggable, editable, contextMenu, toolBar, keypress, mouseSelectionButton, selectionContainer, before, newTopicName, allowUndo, generateMainBranch, generateSubBranch, overflowHidden, theme, alignment, scaleSensitivity, }: Options): void;
|
|
7
6
|
declare namespace MindElixir {
|
|
8
7
|
export var prototype: {
|
|
9
8
|
init(this: MindElixirInstance, data: MindElixirData): Error | undefined;
|
|
10
9
|
destroy(this: Partial<MindElixirInstance>): void;
|
|
11
|
-
exportSvg: (this: MindElixirInstance, noForeignObject?: boolean, injectCss?: string
|
|
12
|
-
exportPng: (this: MindElixirInstance, noForeignObject?: boolean, injectCss?: string
|
|
10
|
+
exportSvg: (this: MindElixirInstance, noForeignObject?: boolean, injectCss?: string) => Blob;
|
|
11
|
+
exportPng: (this: MindElixirInstance, noForeignObject?: boolean, injectCss?: string) => Promise<Blob | null>;
|
|
13
12
|
createSummary: (this: MindElixirInstance) => void;
|
|
14
13
|
createSummaryFrom: (this: MindElixirInstance, summary: Omit<import("./summary").Summary, "id">) => void;
|
|
15
14
|
removeSummary: (this: MindElixirInstance, id: string) => void;
|
|
@@ -18,33 +17,32 @@ declare namespace MindElixir {
|
|
|
18
17
|
renderSummary: (this: MindElixirInstance) => void;
|
|
19
18
|
editSummary: (this: MindElixirInstance, el: import("./summary").SummarySvgGroup) => void;
|
|
20
19
|
renderArrow(this: MindElixirInstance): void;
|
|
21
|
-
editArrowLabel(this: MindElixirInstance, el: import("./
|
|
20
|
+
editArrowLabel(this: MindElixirInstance, el: import("./docs").CustomSvg): void;
|
|
22
21
|
tidyArrow(this: MindElixirInstance): void;
|
|
23
|
-
createArrow: (this: MindElixirInstance, from:
|
|
22
|
+
createArrow: (this: MindElixirInstance, from: Topic, to: Topic, options?: import("./arrow").ArrowOptions) => void;
|
|
24
23
|
createArrowFrom: (this: MindElixirInstance, arrow: Omit<import("./arrow").Arrow, "id">) => void;
|
|
25
|
-
removeArrow: (this: MindElixirInstance, linkSvg?: import("./
|
|
26
|
-
selectArrow: (this: MindElixirInstance, link: import("./
|
|
24
|
+
removeArrow: (this: MindElixirInstance, linkSvg?: import("./docs").CustomSvg) => void;
|
|
25
|
+
selectArrow: (this: MindElixirInstance, link: import("./docs").CustomSvg) => void;
|
|
27
26
|
unselectArrow: (this: MindElixirInstance) => void;
|
|
28
|
-
rmSubline: (this: MindElixirInstance, tpc:
|
|
29
|
-
reshapeNode: (this: MindElixirInstance, tpc:
|
|
30
|
-
insertSibling: (this: MindElixirInstance, type: "before" | "after", el?:
|
|
31
|
-
insertParent: (this: MindElixirInstance, el?:
|
|
32
|
-
addChild: (this: MindElixirInstance, el?:
|
|
33
|
-
copyNode: (this: MindElixirInstance, node:
|
|
34
|
-
copyNodes: (this: MindElixirInstance, tpcs:
|
|
35
|
-
moveUpNode: (this: MindElixirInstance, el?:
|
|
36
|
-
moveDownNode: (this: MindElixirInstance, el?:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
selectNode: (this: MindElixirInstance,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
unselectNodes: (this: MindElixirInstance) => void;
|
|
27
|
+
rmSubline: (this: MindElixirInstance, tpc: Topic) => Promise<void>;
|
|
28
|
+
reshapeNode: (this: MindElixirInstance, tpc: Topic, patchData: Partial<import("./docs").NodeObj>) => Promise<void>;
|
|
29
|
+
insertSibling: (this: MindElixirInstance, type: "before" | "after", el?: Topic | undefined, node?: import("./docs").NodeObj | undefined) => Promise<void>;
|
|
30
|
+
insertParent: (this: MindElixirInstance, el?: Topic | undefined, node?: import("./docs").NodeObj | undefined) => Promise<void>;
|
|
31
|
+
addChild: (this: MindElixirInstance, el?: Topic | undefined, node?: import("./docs").NodeObj | undefined) => Promise<void>;
|
|
32
|
+
copyNode: (this: MindElixirInstance, node: Topic, to: Topic) => Promise<void>;
|
|
33
|
+
copyNodes: (this: MindElixirInstance, tpcs: Topic[], to: Topic) => Promise<void>;
|
|
34
|
+
moveUpNode: (this: MindElixirInstance, el?: Topic | undefined) => Promise<void>;
|
|
35
|
+
moveDownNode: (this: MindElixirInstance, el?: Topic | undefined) => Promise<void>;
|
|
36
|
+
removeNodes: (this: MindElixirInstance, tpcs: Topic[]) => Promise<void>;
|
|
37
|
+
moveNodeIn: (this: MindElixirInstance, from: Topic[], to: Topic) => Promise<void>;
|
|
38
|
+
moveNodeBefore: (this: MindElixirInstance, from: Topic[], to: Topic) => Promise<void>;
|
|
39
|
+
moveNodeAfter: (this: MindElixirInstance, from: Topic[], to: Topic) => Promise<void>;
|
|
40
|
+
beginEdit: (this: MindElixirInstance, el?: Topic | undefined) => Promise<void>;
|
|
41
|
+
setNodeTopic: (this: MindElixirInstance, el: Topic, topic: string) => Promise<void>;
|
|
42
|
+
scrollIntoView: (this: MindElixirInstance, el: HTMLElement) => void;
|
|
43
|
+
selectNode: (this: MindElixirInstance, tpc: Topic, isNewNode?: boolean, e?: MouseEvent) => void;
|
|
44
|
+
selectNodes: (this: MindElixirInstance, tpc: Topic[]) => void;
|
|
45
|
+
unselectNodes: (this: MindElixirInstance, tpc: Topic[]) => void;
|
|
48
46
|
clearSelection: (this: MindElixirInstance) => void;
|
|
49
47
|
getDataString: (this: MindElixirInstance) => string;
|
|
50
48
|
getData: (this: MindElixirInstance) => MindElixirData;
|
|
@@ -58,46 +56,47 @@ declare namespace MindElixir {
|
|
|
58
56
|
move: (this: MindElixirInstance, dx: number, dy: number) => void;
|
|
59
57
|
toCenter: (this: MindElixirInstance) => void;
|
|
60
58
|
install: (this: MindElixirInstance, plugin: (instance: MindElixirInstance) => void) => void;
|
|
61
|
-
focusNode: (this: MindElixirInstance, el:
|
|
59
|
+
focusNode: (this: MindElixirInstance, el: Topic) => void;
|
|
62
60
|
cancelFocus: (this: MindElixirInstance) => void;
|
|
63
61
|
initLeft: (this: MindElixirInstance) => void;
|
|
64
62
|
initRight: (this: MindElixirInstance) => void;
|
|
65
63
|
initSide: (this: MindElixirInstance) => void;
|
|
66
64
|
setLocale: (this: MindElixirInstance, locale: import("./i18n").Locale) => void;
|
|
67
|
-
expandNode: (this: MindElixirInstance, el:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
expandNode: (this: MindElixirInstance, el: Topic, isExpand?: boolean) => void;
|
|
66
|
+
expandNodeAll: (this: MindElixirInstance, el: Topic, isExpand?: boolean) => void;
|
|
67
|
+
refresh: (this: MindElixirInstance, data?: MindElixirData) => void;
|
|
68
|
+
getObjById: (id: string, data: import("./docs").NodeObj) => import("./docs").NodeObj | null;
|
|
69
|
+
generateNewObj: (this: MindElixirInstance) => import("./docs").NodeObjExport;
|
|
71
70
|
layout: (this: MindElixirInstance) => void;
|
|
72
|
-
linkDiv: (this: MindElixirInstance, mainNode?: import("./
|
|
73
|
-
editTopic: (this: MindElixirInstance, el:
|
|
74
|
-
createWrapper: (this: MindElixirInstance, nodeObj: import("./
|
|
75
|
-
grp: import("./
|
|
76
|
-
top: import("./
|
|
77
|
-
tpc:
|
|
71
|
+
linkDiv: (this: MindElixirInstance, mainNode?: import("./docs").Wrapper) => void;
|
|
72
|
+
editTopic: (this: MindElixirInstance, el: Topic) => void;
|
|
73
|
+
createWrapper: (this: MindElixirInstance, nodeObj: import("./docs").NodeObj, omitChildren?: boolean) => {
|
|
74
|
+
grp: import("./docs").Wrapper;
|
|
75
|
+
top: import("./docs").Parent;
|
|
76
|
+
tpc: Topic;
|
|
78
77
|
};
|
|
79
|
-
createParent: (this: MindElixirInstance, nodeObj: import("./
|
|
80
|
-
p: import("./
|
|
81
|
-
tpc:
|
|
78
|
+
createParent: (this: MindElixirInstance, nodeObj: import("./docs").NodeObj) => {
|
|
79
|
+
p: import("./docs").Parent;
|
|
80
|
+
tpc: Topic;
|
|
82
81
|
};
|
|
83
|
-
createChildren: (this: MindElixirInstance, wrappers: import("./
|
|
84
|
-
createTopic: (this: MindElixirInstance, nodeObj: import("./
|
|
85
|
-
findEle: (id: string,
|
|
86
|
-
changeTheme: (this: MindElixirInstance, theme: import("./
|
|
82
|
+
createChildren: (this: MindElixirInstance, wrappers: import("./docs").Wrapper[]) => import("./docs").Children;
|
|
83
|
+
createTopic: (this: MindElixirInstance, nodeObj: import("./docs").NodeObj) => Topic;
|
|
84
|
+
findEle: (this: MindElixirInstance, id: string, el?: HTMLElement) => Topic;
|
|
85
|
+
changeTheme: (this: MindElixirInstance, theme: import("./docs").Theme, shouldRefresh?: boolean) => void;
|
|
87
86
|
};
|
|
88
87
|
export var LEFT: number;
|
|
89
88
|
export var RIGHT: number;
|
|
90
89
|
export var SIDE: number;
|
|
91
|
-
export var THEME: import("./
|
|
92
|
-
export var DARK_THEME: import("./
|
|
90
|
+
export var THEME: import("./docs").Theme;
|
|
91
|
+
export var DARK_THEME: import("./docs").Theme;
|
|
93
92
|
export var version: any;
|
|
94
|
-
export var E: (id: string,
|
|
93
|
+
export var E: (this: MindElixirInstance, id: string, el?: HTMLElement) => Topic;
|
|
95
94
|
var _a: (topic: string) => MindElixirData;
|
|
96
95
|
export { _a as new };
|
|
97
96
|
}
|
|
98
97
|
export interface MindElixirCtor {
|
|
99
98
|
new (options: Options): MindElixirInstance;
|
|
100
|
-
E:
|
|
99
|
+
E: (id: string, el?: HTMLElement) => Topic;
|
|
101
100
|
new: typeof MindElixir.new;
|
|
102
101
|
version: string;
|
|
103
102
|
LEFT: typeof LEFT;
|
package/dist/types/interact.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Locale } from './i18n';
|
|
2
2
|
import type { Topic } from './types/dom';
|
|
3
3
|
import type { MindElixirData, MindElixirInstance } from './types/index';
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
4
|
+
export declare const scrollIntoView: (this: MindElixirInstance, el: HTMLElement) => void;
|
|
5
|
+
export declare const selectNode: (this: MindElixirInstance, tpc: Topic, isNewNode?: boolean, e?: MouseEvent) => void;
|
|
6
6
|
export declare const selectNodes: (this: MindElixirInstance, tpc: Topic[]) => void;
|
|
7
|
-
export declare const unselectNodes: (this: MindElixirInstance) => void;
|
|
7
|
+
export declare const unselectNodes: (this: MindElixirInstance, tpc: Topic[]) => void;
|
|
8
8
|
export declare const clearSelection: (this: MindElixirInstance) => void;
|
|
9
9
|
/**
|
|
10
10
|
* @function
|
|
@@ -123,6 +123,7 @@ export declare const initSide: (this: MindElixirInstance) => void;
|
|
|
123
123
|
*/
|
|
124
124
|
export declare const setLocale: (this: MindElixirInstance, locale: Locale) => void;
|
|
125
125
|
export declare const expandNode: (this: MindElixirInstance, el: Topic, isExpand?: boolean) => void;
|
|
126
|
+
export declare const expandNodeAll: (this: MindElixirInstance, el: Topic, isExpand?: boolean) => void;
|
|
126
127
|
/**
|
|
127
128
|
* @function
|
|
128
129
|
* @instance
|
package/dist/types/linkDiv.d.ts
CHANGED
package/dist/types/methods.d.ts
CHANGED
|
@@ -13,8 +13,8 @@ export type MindElixirMethods = typeof methods;
|
|
|
13
13
|
declare const methods: {
|
|
14
14
|
init(this: MindElixirInstance, data: MindElixirData): Error | undefined;
|
|
15
15
|
destroy(this: Partial<MindElixirInstance>): void;
|
|
16
|
-
exportSvg: (this: MindElixirInstance, noForeignObject?: boolean, injectCss?: string
|
|
17
|
-
exportPng: (this: MindElixirInstance, noForeignObject?: boolean, injectCss?: string
|
|
16
|
+
exportSvg: (this: MindElixirInstance, noForeignObject?: boolean, injectCss?: string) => Blob;
|
|
17
|
+
exportPng: (this: MindElixirInstance, noForeignObject?: boolean, injectCss?: string) => Promise<Blob | null>;
|
|
18
18
|
createSummary: (this: MindElixirInstance) => void;
|
|
19
19
|
createSummaryFrom: (this: MindElixirInstance, summary: Omit<summary.Summary, "id">) => void;
|
|
20
20
|
removeSummary: (this: MindElixirInstance, id: string) => void;
|
|
@@ -27,7 +27,7 @@ declare const methods: {
|
|
|
27
27
|
tidyArrow(this: MindElixirInstance): void;
|
|
28
28
|
createArrow: (this: MindElixirInstance, from: import("./index").Topic, to: import("./index").Topic, options?: arrow.ArrowOptions) => void;
|
|
29
29
|
createArrowFrom: (this: MindElixirInstance, arrow: Omit<arrow.Arrow, "id">) => void;
|
|
30
|
-
removeArrow: (this: MindElixirInstance, linkSvg?: import("./index").CustomSvg
|
|
30
|
+
removeArrow: (this: MindElixirInstance, linkSvg?: import("./index").CustomSvg) => void;
|
|
31
31
|
selectArrow: (this: MindElixirInstance, link: import("./index").CustomSvg) => void;
|
|
32
32
|
unselectArrow: (this: MindElixirInstance) => void;
|
|
33
33
|
rmSubline: (this: MindElixirInstance, tpc: import("./index").Topic) => Promise<void>;
|
|
@@ -39,17 +39,16 @@ declare const methods: {
|
|
|
39
39
|
copyNodes: (this: MindElixirInstance, tpcs: import("./index").Topic[], to: import("./index").Topic) => Promise<void>;
|
|
40
40
|
moveUpNode: (this: MindElixirInstance, el?: import("./index").Topic | undefined) => Promise<void>;
|
|
41
41
|
moveDownNode: (this: MindElixirInstance, el?: import("./index").Topic | undefined) => Promise<void>;
|
|
42
|
-
removeNode: (this: MindElixirInstance, el?: import("./index").Topic | undefined) => Promise<void>;
|
|
43
42
|
removeNodes: (this: MindElixirInstance, tpcs: import("./index").Topic[]) => Promise<void>;
|
|
44
43
|
moveNodeIn: (this: MindElixirInstance, from: import("./index").Topic[], to: import("./index").Topic) => Promise<void>;
|
|
45
44
|
moveNodeBefore: (this: MindElixirInstance, from: import("./index").Topic[], to: import("./index").Topic) => Promise<void>;
|
|
46
45
|
moveNodeAfter: (this: MindElixirInstance, from: import("./index").Topic[], to: import("./index").Topic) => Promise<void>;
|
|
47
46
|
beginEdit: (this: MindElixirInstance, el?: import("./index").Topic | undefined) => Promise<void>;
|
|
48
47
|
setNodeTopic: (this: MindElixirInstance, el: import("./index").Topic, topic: string) => Promise<void>;
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
scrollIntoView: (this: MindElixirInstance, el: HTMLElement) => void;
|
|
49
|
+
selectNode: (this: MindElixirInstance, tpc: import("./index").Topic, isNewNode?: boolean, e?: MouseEvent) => void;
|
|
51
50
|
selectNodes: (this: MindElixirInstance, tpc: import("./index").Topic[]) => void;
|
|
52
|
-
unselectNodes: (this: MindElixirInstance) => void;
|
|
51
|
+
unselectNodes: (this: MindElixirInstance, tpc: import("./index").Topic[]) => void;
|
|
53
52
|
clearSelection: (this: MindElixirInstance) => void;
|
|
54
53
|
getDataString: (this: MindElixirInstance) => string;
|
|
55
54
|
getData: (this: MindElixirInstance) => MindElixirData;
|
|
@@ -69,14 +68,15 @@ declare const methods: {
|
|
|
69
68
|
initRight: (this: MindElixirInstance) => void;
|
|
70
69
|
initSide: (this: MindElixirInstance) => void;
|
|
71
70
|
setLocale: (this: MindElixirInstance, locale: import("./i18n").Locale) => void;
|
|
72
|
-
expandNode: (this: MindElixirInstance, el: import("./index").Topic, isExpand?: boolean
|
|
73
|
-
|
|
71
|
+
expandNode: (this: MindElixirInstance, el: import("./index").Topic, isExpand?: boolean) => void;
|
|
72
|
+
expandNodeAll: (this: MindElixirInstance, el: import("./index").Topic, isExpand?: boolean) => void;
|
|
73
|
+
refresh: (this: MindElixirInstance, data?: MindElixirData) => void;
|
|
74
74
|
getObjById: (id: string, data: import("./types").NodeObj) => import("./types").NodeObj | null;
|
|
75
75
|
generateNewObj: (this: MindElixirInstance) => import("./types").NodeObjExport;
|
|
76
76
|
layout: (this: MindElixirInstance) => void;
|
|
77
|
-
linkDiv: (this: MindElixirInstance, mainNode?: import("./index").Wrapper
|
|
77
|
+
linkDiv: (this: MindElixirInstance, mainNode?: import("./index").Wrapper) => void;
|
|
78
78
|
editTopic: (this: MindElixirInstance, el: import("./index").Topic) => void;
|
|
79
|
-
createWrapper: (this: MindElixirInstance, nodeObj: import("./types").NodeObj, omitChildren?: boolean
|
|
79
|
+
createWrapper: (this: MindElixirInstance, nodeObj: import("./types").NodeObj, omitChildren?: boolean) => {
|
|
80
80
|
grp: import("./index").Wrapper;
|
|
81
81
|
top: import("./index").Parent;
|
|
82
82
|
tpc: import("./index").Topic;
|
|
@@ -87,7 +87,7 @@ declare const methods: {
|
|
|
87
87
|
};
|
|
88
88
|
createChildren: (this: MindElixirInstance, wrappers: import("./index").Wrapper[]) => import("./index").Children;
|
|
89
89
|
createTopic: (this: MindElixirInstance, nodeObj: import("./types").NodeObj) => import("./index").Topic;
|
|
90
|
-
findEle: (id: string,
|
|
90
|
+
findEle: (this: MindElixirInstance, id: string, el?: HTMLElement) => import("./index").Topic;
|
|
91
91
|
changeTheme: (this: MindElixirInstance, theme: import("./types").Theme, shouldRefresh?: boolean) => void;
|
|
92
92
|
};
|
|
93
93
|
export default methods;
|
package/dist/types/mouse.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { MindElixirInstance } from './types/index';
|
|
2
|
-
export default function (mind: MindElixirInstance): void;
|
|
2
|
+
export default function (mind: MindElixirInstance): () => void;
|
|
@@ -2,14 +2,13 @@ import type { Topic } from './types/dom';
|
|
|
2
2
|
import { type MindElixirInstance, type NodeObj } from './types/index';
|
|
3
3
|
export declare const rmSubline: (tpc: Topic) => void;
|
|
4
4
|
export declare const reshapeNode: (this: MindElixirInstance, tpc: Topic, patchData: Partial<NodeObj>) => void;
|
|
5
|
-
export declare const insertSibling: (this: MindElixirInstance, type:
|
|
5
|
+
export declare const insertSibling: (this: MindElixirInstance, type: "before" | "after", el?: Topic, node?: NodeObj) => void;
|
|
6
6
|
export declare const insertParent: (this: MindElixirInstance, el?: Topic, node?: NodeObj) => void;
|
|
7
7
|
export declare const addChild: (this: MindElixirInstance, el?: Topic, node?: NodeObj) => void;
|
|
8
8
|
export declare const copyNode: (this: MindElixirInstance, node: Topic, to: Topic) => void;
|
|
9
9
|
export declare const copyNodes: (this: MindElixirInstance, tpcs: Topic[], to: Topic) => void;
|
|
10
10
|
export declare const moveUpNode: (this: MindElixirInstance, el?: Topic) => void;
|
|
11
11
|
export declare const moveDownNode: (this: MindElixirInstance, el?: Topic) => void;
|
|
12
|
-
export declare const removeNode: (this: MindElixirInstance, el?: Topic) => void;
|
|
13
12
|
export declare const removeNodes: (this: MindElixirInstance, tpcs: Topic[]) => void;
|
|
14
13
|
export declare const moveNodeIn: (this: MindElixirInstance, from: Topic[], to: Topic) => void;
|
|
15
14
|
export declare const moveNodeBefore: (this: MindElixirInstance, from: Topic[], to: Topic) => void;
|
|
@@ -9,4 +9,4 @@ export type ContextMenuOption = {
|
|
|
9
9
|
onclick: (e: MouseEvent) => void;
|
|
10
10
|
}[];
|
|
11
11
|
};
|
|
12
|
-
export default function (mind: MindElixirInstance, option
|
|
12
|
+
export default function (mind: MindElixirInstance, option: true | ContextMenuOption): () => void;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import type { MindElixirInstance } from '../types/index';
|
|
2
|
-
export
|
|
1
|
+
import type { KeypressOptions, MindElixirInstance } from '../types/index';
|
|
2
|
+
export declare const handleZoom: (mei: MindElixirInstance, direction: "in" | "out", offset?: {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
}) => void;
|
|
6
|
+
export default function (mind: MindElixirInstance, options: boolean | KeypressOptions): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { MindElixirInstance } from '../types/index';
|
|
2
|
-
export default function (mind: MindElixirInstance): void;
|
|
2
|
+
export default function (mind: MindElixirInstance): () => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type MindElixirInstance } from '../index';
|
|
2
|
-
export default function (mei: MindElixirInstance): void;
|
|
2
|
+
export default function (mei: MindElixirInstance): () => void;
|
package/dist/types/summary.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export type SummarySvgGroup = SVGGElement & {
|
|
|
23
23
|
summaryObj: Summary;
|
|
24
24
|
};
|
|
25
25
|
export declare const createSummary: (this: MindElixirInstance) => void;
|
|
26
|
-
export declare const createSummaryFrom: (this: MindElixirInstance, summary: Omit<Summary,
|
|
26
|
+
export declare const createSummaryFrom: (this: MindElixirInstance, summary: Omit<Summary, "id">) => void;
|
|
27
27
|
export declare const removeSummary: (this: MindElixirInstance, id: string) => void;
|
|
28
28
|
export declare const selectSummary: (this: MindElixirInstance, el: SummarySvgGroup) => void;
|
|
29
29
|
export declare const unselectSummary: (this: MindElixirInstance) => void;
|
|
@@ -4,11 +4,11 @@ import type { MindElixirMethods, OperationMap, Operations } from '../methods';
|
|
|
4
4
|
import type { LinkDragMoveHelperInstance } from '../utils/LinkDragMoveHelper';
|
|
5
5
|
import type { Arrow } from '../arrow';
|
|
6
6
|
import type { Summary, SummarySvgGroup } from '../summary';
|
|
7
|
-
import type SelectionArea from '@viselect/vanilla';
|
|
8
7
|
import type { MainLineParams, SubLineParams } from '../utils/generateBranch';
|
|
9
8
|
import type { Locale } from '../i18n';
|
|
10
9
|
import type { ContextMenuOption } from '../plugin/contextMenu';
|
|
11
10
|
import type { createDragMoveHelper } from '../utils/dragMoveHelper';
|
|
11
|
+
import type SelectionArea from '@viselect/vanilla';
|
|
12
12
|
export { type MindElixirMethods } from '../methods';
|
|
13
13
|
export declare enum DirectionClass {
|
|
14
14
|
LHS = "lhs",
|
|
@@ -32,8 +32,11 @@ export type Theme = {
|
|
|
32
32
|
* Color palette for main branches
|
|
33
33
|
*/
|
|
34
34
|
palette: string[];
|
|
35
|
-
cssVar:
|
|
36
|
-
'--gap': string;
|
|
35
|
+
cssVar: {
|
|
36
|
+
'--node-gap-x': string;
|
|
37
|
+
'--node-gap-y': string;
|
|
38
|
+
'--main-gap-x': string;
|
|
39
|
+
'--main-gap-y': string;
|
|
37
40
|
'--main-color': string;
|
|
38
41
|
'--main-bgcolor': string;
|
|
39
42
|
'--color': string;
|
|
@@ -48,46 +51,34 @@ export type Theme = {
|
|
|
48
51
|
'--panel-color': string;
|
|
49
52
|
'--panel-bgcolor': string;
|
|
50
53
|
'--panel-border-color': string;
|
|
51
|
-
|
|
54
|
+
'--map-padding': string;
|
|
55
|
+
};
|
|
52
56
|
};
|
|
53
57
|
export type Alignment = 'root' | 'nodes';
|
|
58
|
+
export interface KeypressOptions {
|
|
59
|
+
[key: string]: (e: KeyboardEvent) => void;
|
|
60
|
+
}
|
|
54
61
|
/**
|
|
55
62
|
* The MindElixir instance
|
|
56
63
|
*
|
|
57
64
|
* @public
|
|
58
65
|
*/
|
|
59
|
-
export interface MindElixirInstance extends MindElixirMethods {
|
|
66
|
+
export interface MindElixirInstance extends Required<Options>, MindElixirMethods {
|
|
67
|
+
dragged: Topic[] | null;
|
|
68
|
+
el: HTMLElement;
|
|
60
69
|
disposable: Array<() => void>;
|
|
61
70
|
isFocusMode: boolean;
|
|
62
71
|
nodeDataBackup: NodeObj;
|
|
63
|
-
mindElixirBox: HTMLElement;
|
|
64
72
|
nodeData: NodeObj;
|
|
65
73
|
arrows: Arrow[];
|
|
66
74
|
summaries: Summary[];
|
|
67
|
-
currentNode: Topic | null;
|
|
68
|
-
currentNodes: Topic[]
|
|
75
|
+
readonly currentNode: Topic | null;
|
|
76
|
+
currentNodes: Topic[];
|
|
69
77
|
currentSummary: SummarySvgGroup | null;
|
|
70
78
|
currentArrow: CustomSvg | null;
|
|
71
79
|
waitCopy: Topic[] | null;
|
|
72
80
|
scaleVal: number;
|
|
73
81
|
tempDirection: number | null;
|
|
74
|
-
theme: Theme;
|
|
75
|
-
userTheme?: Theme;
|
|
76
|
-
direction: number;
|
|
77
|
-
locale: Locale;
|
|
78
|
-
draggable: boolean;
|
|
79
|
-
editable: boolean;
|
|
80
|
-
contextMenu: boolean;
|
|
81
|
-
contextMenuOption?: ContextMenuOption;
|
|
82
|
-
toolBar: boolean;
|
|
83
|
-
keypress: boolean;
|
|
84
|
-
mouseSelectionButton: 0 | 2;
|
|
85
|
-
before: Before;
|
|
86
|
-
newTopicName: string;
|
|
87
|
-
allowUndo: boolean;
|
|
88
|
-
overflowHidden: boolean;
|
|
89
|
-
generateMainBranch: (params: MainLineParams) => PathString;
|
|
90
|
-
generateSubBranch: (params: SubLineParams) => PathString;
|
|
91
82
|
container: HTMLElement;
|
|
92
83
|
map: HTMLElement;
|
|
93
84
|
root: HTMLElement;
|
|
@@ -113,8 +104,6 @@ export interface MindElixirInstance extends MindElixirMethods {
|
|
|
113
104
|
undo: () => void;
|
|
114
105
|
redo: () => void;
|
|
115
106
|
selection: SelectionArea;
|
|
116
|
-
selectionContainer?: string | HTMLElement;
|
|
117
|
-
alignment: Alignment;
|
|
118
107
|
dragMoveHelper: ReturnType<typeof createDragMoveHelper>;
|
|
119
108
|
}
|
|
120
109
|
type PathString = string;
|
|
@@ -123,16 +112,15 @@ type PathString = string;
|
|
|
123
112
|
*
|
|
124
113
|
* @public
|
|
125
114
|
*/
|
|
126
|
-
export
|
|
115
|
+
export interface Options {
|
|
127
116
|
el: string | HTMLElement;
|
|
128
117
|
direction?: number;
|
|
129
118
|
locale?: Locale;
|
|
130
119
|
draggable?: boolean;
|
|
131
120
|
editable?: boolean;
|
|
132
|
-
contextMenu?: boolean;
|
|
133
|
-
contextMenuOption?: ContextMenuOption;
|
|
121
|
+
contextMenu?: boolean | ContextMenuOption;
|
|
134
122
|
toolBar?: boolean;
|
|
135
|
-
keypress?: boolean;
|
|
123
|
+
keypress?: boolean | KeypressOptions;
|
|
136
124
|
mouseSelectionButton?: 0 | 2;
|
|
137
125
|
before?: Before;
|
|
138
126
|
newTopicName?: string;
|
|
@@ -141,10 +129,10 @@ export type Options = {
|
|
|
141
129
|
generateMainBranch?: (this: MindElixirInstance, params: MainLineParams) => PathString;
|
|
142
130
|
generateSubBranch?: (this: MindElixirInstance, params: SubLineParams) => PathString;
|
|
143
131
|
theme?: Theme;
|
|
144
|
-
nodeMenu?: boolean;
|
|
145
132
|
selectionContainer?: string | HTMLElement;
|
|
146
133
|
alignment?: Alignment;
|
|
147
|
-
|
|
134
|
+
scaleSensitivity?: number;
|
|
135
|
+
}
|
|
148
136
|
export type Uid = string;
|
|
149
137
|
export type Left = 0;
|
|
150
138
|
export type Right = 1;
|
|
@@ -156,12 +144,16 @@ export type Right = 1;
|
|
|
156
144
|
export interface NodeObj {
|
|
157
145
|
topic: string;
|
|
158
146
|
id: Uid;
|
|
159
|
-
style?: {
|
|
160
|
-
fontSize
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
147
|
+
style?: Partial<{
|
|
148
|
+
fontSize: string;
|
|
149
|
+
fontFamily: string;
|
|
150
|
+
color: string;
|
|
151
|
+
background: string;
|
|
152
|
+
fontWeight: string;
|
|
153
|
+
width: string;
|
|
154
|
+
border: string;
|
|
155
|
+
textDecoration: string;
|
|
156
|
+
}>;
|
|
165
157
|
children?: NodeObj[];
|
|
166
158
|
tags?: string[];
|
|
167
159
|
icons?: string[];
|
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
declare const create: (dom: HTMLElement) => {
|
|
2
2
|
dom: HTMLElement;
|
|
3
3
|
moved: boolean;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
pointerdown: boolean;
|
|
5
|
+
lastX: number;
|
|
6
|
+
lastY: number;
|
|
7
|
+
handlePointerMove(e: PointerEvent): void;
|
|
8
|
+
handlePointerDown(e: PointerEvent): void;
|
|
9
|
+
handleClear(e: PointerEvent): void;
|
|
8
10
|
cb: ((deltaX: number, deltaY: number) => void) | null;
|
|
9
11
|
init(map: HTMLElement, cb: (deltaX: number, deltaY: number) => void): void;
|
|
10
|
-
|
|
12
|
+
destroy: (() => void) | null;
|
|
11
13
|
clear(): void;
|
|
12
14
|
};
|
|
13
15
|
declare const LinkDragMoveHelper: {
|
|
14
16
|
create: (dom: HTMLElement) => {
|
|
15
17
|
dom: HTMLElement;
|
|
16
18
|
moved: boolean;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
pointerdown: boolean;
|
|
20
|
+
lastX: number;
|
|
21
|
+
lastY: number;
|
|
22
|
+
handlePointerMove(e: PointerEvent): void;
|
|
23
|
+
handlePointerDown(e: PointerEvent): void;
|
|
24
|
+
handleClear(e: PointerEvent): void;
|
|
21
25
|
cb: ((deltaX: number, deltaY: number) => void) | null;
|
|
22
26
|
init(map: HTMLElement, cb: (deltaX: number, deltaY: number) => void): void;
|
|
23
|
-
|
|
27
|
+
destroy: (() => void) | null;
|
|
24
28
|
clear(): void;
|
|
25
29
|
};
|
|
26
30
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Topic, Wrapper, Parent, Children, Expander } from '../types/dom';
|
|
2
2
|
import type { MindElixirInstance, NodeObj } from '../types/index';
|
|
3
|
-
export declare const findEle: (id: string,
|
|
3
|
+
export declare const findEle: (this: MindElixirInstance, id: string, el?: HTMLElement) => Topic;
|
|
4
4
|
export declare const shapeTpc: (tpc: Topic, nodeObj: NodeObj) => void;
|
|
5
5
|
export declare const createWrapper: (this: MindElixirInstance, nodeObj: NodeObj, omitChildren?: boolean) => {
|
|
6
6
|
grp: Wrapper;
|
|
@@ -32,3 +32,8 @@ export declare const getTranslate: (styleText: string) => {
|
|
|
32
32
|
x: number;
|
|
33
33
|
y: number;
|
|
34
34
|
};
|
|
35
|
+
export declare const on: (list: { [K in keyof GlobalEventHandlersEventMap]: {
|
|
36
|
+
dom: EventTarget;
|
|
37
|
+
evt: K;
|
|
38
|
+
func: (this: EventTarget, ev: GlobalEventHandlersEventMap[K]) => void;
|
|
39
|
+
}; }[keyof GlobalEventHandlersEventMap][]) => () => void;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { LEFT, RIGHT } from '../const';
|
|
2
|
+
import { type NodeObj } from '../types/index';
|
|
3
|
+
/**
|
|
4
|
+
* Server-side compatible layout data structure
|
|
5
|
+
*/
|
|
6
|
+
export interface SSRLayoutNode {
|
|
7
|
+
id: string;
|
|
8
|
+
topic: string;
|
|
9
|
+
direction?: typeof LEFT | typeof RIGHT;
|
|
10
|
+
style?: {
|
|
11
|
+
fontSize?: string;
|
|
12
|
+
color?: string;
|
|
13
|
+
background?: string;
|
|
14
|
+
fontWeight?: string;
|
|
15
|
+
};
|
|
16
|
+
children?: SSRLayoutNode[];
|
|
17
|
+
tags?: string[];
|
|
18
|
+
icons?: string[];
|
|
19
|
+
hyperLink?: string;
|
|
20
|
+
expanded?: boolean;
|
|
21
|
+
image?: {
|
|
22
|
+
url: string;
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
fit?: 'fill' | 'contain' | 'cover';
|
|
26
|
+
};
|
|
27
|
+
branchColor?: string;
|
|
28
|
+
dangerouslySetInnerHTML?: string;
|
|
29
|
+
note?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* SSR Layout result structure
|
|
33
|
+
*/
|
|
34
|
+
export interface SSRLayoutResult {
|
|
35
|
+
root: SSRLayoutNode;
|
|
36
|
+
leftNodes: SSRLayoutNode[];
|
|
37
|
+
rightNodes: SSRLayoutNode[];
|
|
38
|
+
direction: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* SSR Layout options
|
|
42
|
+
*/
|
|
43
|
+
export interface SSRLayoutOptions {
|
|
44
|
+
direction?: number;
|
|
45
|
+
newTopicName?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Server-side compatible layout function for SSR
|
|
49
|
+
* This function processes the mind map data structure without DOM manipulation
|
|
50
|
+
*
|
|
51
|
+
* @param nodeData - The root node data
|
|
52
|
+
* @param options - Layout options including direction
|
|
53
|
+
* @returns Structured layout data for server-side rendering
|
|
54
|
+
*/
|
|
55
|
+
export declare const layoutSSR: (nodeData: NodeObj, options?: SSRLayoutOptions) => SSRLayoutResult;
|
|
56
|
+
/**
|
|
57
|
+
* Generate HTML string for server-side rendering
|
|
58
|
+
* This function creates the HTML structure that would be generated by the DOM-based layout
|
|
59
|
+
*
|
|
60
|
+
* @param layoutResult - The result from layoutSSR function
|
|
61
|
+
* @param options - Additional rendering options
|
|
62
|
+
* @returns HTML string for server-side rendering
|
|
63
|
+
*/
|
|
64
|
+
export declare const renderSSRHTML: (layoutResult: SSRLayoutResult, options?: {
|
|
65
|
+
className?: string;
|
|
66
|
+
}) => string;
|
|
67
|
+
/**
|
|
68
|
+
* Generate JSON data structure for client-side hydration
|
|
69
|
+
* This can be used to pass the layout data to the client for hydration
|
|
70
|
+
*
|
|
71
|
+
* @param layoutResult - The result from layoutSSR function
|
|
72
|
+
* @returns JSON-serializable data structure
|
|
73
|
+
*/
|
|
74
|
+
export declare const getSSRData: (layoutResult: SSRLayoutResult) => string;
|
|
75
|
+
/**
|
|
76
|
+
* Hydration data structure for client-side initialization
|
|
77
|
+
*/
|
|
78
|
+
export interface HydrationData {
|
|
79
|
+
nodeData: NodeObj;
|
|
80
|
+
layoutResult: SSRLayoutResult;
|
|
81
|
+
options: {
|
|
82
|
+
direction: number;
|
|
83
|
+
[key: string]: any;
|
|
84
|
+
};
|
|
85
|
+
timestamp: number;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Generate complete hydration data including original nodeData
|
|
89
|
+
*/
|
|
90
|
+
export declare const getHydrationData: (nodeData: NodeObj, layoutResult: SSRLayoutResult, options?: any) => HydrationData;
|