mind-elixir 4.1.3 → 4.1.5
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 +7 -7
- package/dist/MindElixir.js +482 -489
- package/dist/MindElixirLite.iife.js +5 -5
- package/dist/MindElixirLite.js +388 -395
- package/dist/types/arrow.d.ts +31 -0
- package/dist/types/const.d.ts +8 -0
- package/dist/types/dev.d.ts +1 -0
- package/dist/types/docs.d.ts +9 -0
- package/dist/types/exampleData/1.cn.d.ts +125 -0
- package/dist/types/exampleData/1.d.ts +3 -0
- package/dist/types/exampleData/2.d.ts +3 -0
- package/dist/types/exampleData/3.d.ts +3 -0
- package/dist/types/exampleData/htmlText.d.ts +3 -0
- package/dist/types/i18n.d.ts +16 -0
- package/dist/types/index.d.ts +107 -0
- package/dist/types/interact.d.ts +132 -0
- package/dist/types/linkDiv.d.ts +15 -0
- package/dist/types/methods.d.ts +86 -0
- package/dist/types/mouse.d.ts +2 -0
- package/dist/types/nodeOperation.d.ts +18 -0
- package/dist/types/plugin/contextMenu.d.ts +3 -0
- package/dist/types/plugin/exportImage.d.ts +3 -0
- package/dist/types/plugin/keypress.d.ts +2 -0
- package/dist/types/plugin/mobileMenu.d.ts +3 -0
- package/dist/types/plugin/nodeDraggable.d.ts +2 -0
- package/dist/types/plugin/operationHistory.d.ts +2 -0
- package/dist/types/plugin/selection.d.ts +2 -0
- package/dist/types/plugin/toolBar.d.ts +3 -0
- package/dist/types/summary.d.ts +18 -0
- package/dist/types/types/dom.d.ts +50 -0
- package/dist/types/types/global.d.ts +7 -0
- package/dist/types/types/index.d.ts +169 -0
- package/dist/types/utils/LinkDragMoveHelper.d.ts +28 -0
- package/dist/types/utils/dom.d.ts +18 -0
- package/dist/types/utils/domManipulation.d.ts +5 -0
- package/dist/types/utils/dragMoveHelper.d.ts +7 -0
- package/dist/types/utils/generateBranch.d.ts +27 -0
- package/dist/types/utils/index.d.ts +30 -0
- package/dist/types/utils/layout.d.ts +4 -0
- package/dist/types/utils/objectManipulation.d.ts +7 -0
- package/dist/types/utils/pubsub.d.ts +80 -0
- package/dist/types/utils/svg.d.ts +7 -0
- package/dist/types/utils/theme.d.ts +4 -0
- package/package.json +2 -2
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { MindElixirInstance } from '.';
|
|
2
|
+
export type Summary = {
|
|
3
|
+
id: string;
|
|
4
|
+
text: string;
|
|
5
|
+
parent: string;
|
|
6
|
+
start: number;
|
|
7
|
+
end: number;
|
|
8
|
+
};
|
|
9
|
+
export type SummarySvgGroup = SVGGElement & {
|
|
10
|
+
children: [SVGPathElement, SVGTextElement];
|
|
11
|
+
summaryObj: Summary;
|
|
12
|
+
};
|
|
13
|
+
export declare const createSummary: (this: MindElixirInstance) => void;
|
|
14
|
+
export declare const removeSummary: (this: MindElixirInstance, id: string) => void;
|
|
15
|
+
export declare const selectSummary: (this: MindElixirInstance, el: SummarySvgGroup) => void;
|
|
16
|
+
export declare const unselectSummary: (this: MindElixirInstance) => void;
|
|
17
|
+
export declare const renderSummary: (this: MindElixirInstance) => void;
|
|
18
|
+
export declare const editSummary: (this: MindElixirInstance, el: SummarySvgGroup) => void;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Arrow } from '../arrow';
|
|
2
|
+
import type { NodeObj } from './index';
|
|
3
|
+
export interface Wrapper extends HTMLElement {
|
|
4
|
+
firstChild: Parent;
|
|
5
|
+
children: HTMLCollection & [Parent, Children];
|
|
6
|
+
parentNode: Children;
|
|
7
|
+
parentElement: Children;
|
|
8
|
+
offsetParent: Wrapper;
|
|
9
|
+
previousSibling: Wrapper | null;
|
|
10
|
+
nextSibling: Wrapper | null;
|
|
11
|
+
}
|
|
12
|
+
export interface Parent extends HTMLElement {
|
|
13
|
+
firstChild: Topic;
|
|
14
|
+
children: HTMLCollection & [Topic, Expander | undefined];
|
|
15
|
+
parentNode: Wrapper;
|
|
16
|
+
parentElement: Wrapper;
|
|
17
|
+
nextSibling: Children;
|
|
18
|
+
offsetParent: Wrapper;
|
|
19
|
+
}
|
|
20
|
+
export interface Children extends HTMLElement {
|
|
21
|
+
parentNode: Wrapper;
|
|
22
|
+
children: HTMLCollection & Wrapper[];
|
|
23
|
+
parentElement: Wrapper;
|
|
24
|
+
firstChild: Wrapper;
|
|
25
|
+
previousSibling: Parent;
|
|
26
|
+
}
|
|
27
|
+
export interface Topic extends HTMLElement {
|
|
28
|
+
nodeObj: NodeObj;
|
|
29
|
+
parentNode: Parent;
|
|
30
|
+
parentElement: Parent;
|
|
31
|
+
offsetParent: Parent;
|
|
32
|
+
text: HTMLSpanElement;
|
|
33
|
+
expander?: Expander;
|
|
34
|
+
linkContainer?: HTMLElement;
|
|
35
|
+
image?: HTMLImageElement;
|
|
36
|
+
icons?: HTMLSpanElement;
|
|
37
|
+
tags?: HTMLDivElement;
|
|
38
|
+
}
|
|
39
|
+
export interface Expander extends HTMLElement {
|
|
40
|
+
expanded?: boolean;
|
|
41
|
+
parentNode: Parent;
|
|
42
|
+
parentElement: Parent;
|
|
43
|
+
previousSibling: Topic;
|
|
44
|
+
}
|
|
45
|
+
export type CustomLine = SVGPathElement;
|
|
46
|
+
export type CustomArrow = SVGPathElement;
|
|
47
|
+
export interface CustomSvg extends SVGGElement {
|
|
48
|
+
arrowObj: Arrow;
|
|
49
|
+
children: HTMLCollection & [CustomLine, CustomArrow, SVGTextElement];
|
|
50
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type Bus from '../utils/pubsub';
|
|
2
|
+
import type { Topic, CustomSvg } from './dom';
|
|
3
|
+
import type { EventMap, Operation } from '../utils/pubsub';
|
|
4
|
+
import type { MindElixirMethods, OperationMap, Operations } from '../methods';
|
|
5
|
+
import type { LinkDragMoveHelperInstance } from '../utils/LinkDragMoveHelper';
|
|
6
|
+
import type { Arrow } from '../arrow';
|
|
7
|
+
import type { Summary, SummarySvgGroup } from '../summary';
|
|
8
|
+
import type SelectionArea from '@viselect/vanilla';
|
|
9
|
+
import type { MainLineParams, SubLineParams } from '../utils/generateBranch';
|
|
10
|
+
import type { Locale } from '../i18n';
|
|
11
|
+
export * from '../methods';
|
|
12
|
+
type Before = Partial<{
|
|
13
|
+
[K in Operations]: (...args: Parameters<OperationMap[K]>) => Promise<boolean> | boolean;
|
|
14
|
+
}>;
|
|
15
|
+
export type Theme = {
|
|
16
|
+
name: string;
|
|
17
|
+
palette: string[];
|
|
18
|
+
cssVar: Partial<{
|
|
19
|
+
'--main-color': string;
|
|
20
|
+
'--main-bgcolor': string;
|
|
21
|
+
'--color': string;
|
|
22
|
+
'--bgcolor': string;
|
|
23
|
+
'--selected': string;
|
|
24
|
+
'--panel-color': string;
|
|
25
|
+
'--panel-bgcolor': string;
|
|
26
|
+
'--root-color': string;
|
|
27
|
+
'--root-bgcolor': string;
|
|
28
|
+
'--root-radius': string;
|
|
29
|
+
'--main-radius': string;
|
|
30
|
+
'--topic-padding': string;
|
|
31
|
+
'--panel-border-color': string;
|
|
32
|
+
}>;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* The MindElixir instance
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
export interface MindElixirInstance extends MindElixirMethods {
|
|
40
|
+
disposable: Array<() => void>;
|
|
41
|
+
isFocusMode: boolean;
|
|
42
|
+
nodeDataBackup: NodeObj;
|
|
43
|
+
mindElixirBox: HTMLElement;
|
|
44
|
+
nodeData: NodeObj;
|
|
45
|
+
arrows: Arrow[];
|
|
46
|
+
summaries: Summary[];
|
|
47
|
+
currentNode: Topic | null;
|
|
48
|
+
currentNodes: Topic[] | null;
|
|
49
|
+
currentSummary: SummarySvgGroup | null;
|
|
50
|
+
currentArrow: CustomSvg | null;
|
|
51
|
+
waitCopy: Topic[] | null;
|
|
52
|
+
scaleVal: number;
|
|
53
|
+
tempDirection: number | null;
|
|
54
|
+
theme: Theme;
|
|
55
|
+
userTheme?: Theme;
|
|
56
|
+
direction: number;
|
|
57
|
+
locale: Locale;
|
|
58
|
+
draggable: boolean;
|
|
59
|
+
editable: boolean;
|
|
60
|
+
contextMenu: boolean;
|
|
61
|
+
contextMenuOption: object;
|
|
62
|
+
toolBar: boolean;
|
|
63
|
+
keypress: boolean;
|
|
64
|
+
mouseSelectionButton: 0 | 2;
|
|
65
|
+
before: Before;
|
|
66
|
+
newTopicName: string;
|
|
67
|
+
allowUndo: boolean;
|
|
68
|
+
overflowHidden: boolean;
|
|
69
|
+
mainBranchStyle: number;
|
|
70
|
+
subBranchStyle: number;
|
|
71
|
+
mobileMenu: boolean;
|
|
72
|
+
generateMainBranch: (params: MainLineParams) => PathString;
|
|
73
|
+
generateSubBranch: (params: SubLineParams) => PathString;
|
|
74
|
+
container: HTMLElement;
|
|
75
|
+
map: HTMLElement;
|
|
76
|
+
root: HTMLElement;
|
|
77
|
+
nodes: HTMLElement;
|
|
78
|
+
lines: SVGElement;
|
|
79
|
+
summarySvg: SVGElement;
|
|
80
|
+
linkController: SVGElement;
|
|
81
|
+
P2: HTMLElement;
|
|
82
|
+
P3: HTMLElement;
|
|
83
|
+
line1: SVGElement;
|
|
84
|
+
line2: SVGElement;
|
|
85
|
+
linkSvgGroup: SVGElement;
|
|
86
|
+
/**
|
|
87
|
+
* @internal
|
|
88
|
+
*/
|
|
89
|
+
helper1?: LinkDragMoveHelperInstance;
|
|
90
|
+
/**
|
|
91
|
+
* @internal
|
|
92
|
+
*/
|
|
93
|
+
helper2?: LinkDragMoveHelperInstance;
|
|
94
|
+
bus: ReturnType<typeof Bus.create<EventMap>>;
|
|
95
|
+
history: Operation[];
|
|
96
|
+
undo: () => void;
|
|
97
|
+
redo: () => void;
|
|
98
|
+
selection: SelectionArea;
|
|
99
|
+
}
|
|
100
|
+
type PathString = string;
|
|
101
|
+
/**
|
|
102
|
+
* The MindElixir options
|
|
103
|
+
*
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
export type Options = {
|
|
107
|
+
el: string | HTMLElement;
|
|
108
|
+
direction?: number;
|
|
109
|
+
locale?: Locale;
|
|
110
|
+
draggable?: boolean;
|
|
111
|
+
editable?: boolean;
|
|
112
|
+
contextMenu?: boolean;
|
|
113
|
+
contextMenuOption?: any;
|
|
114
|
+
toolBar?: boolean;
|
|
115
|
+
keypress?: boolean;
|
|
116
|
+
mouseSelectionButton?: 0 | 2;
|
|
117
|
+
before?: Before;
|
|
118
|
+
newTopicName?: string;
|
|
119
|
+
allowUndo?: boolean;
|
|
120
|
+
overflowHidden?: boolean;
|
|
121
|
+
generateMainBranch?: (this: MindElixirInstance, params: MainLineParams) => PathString;
|
|
122
|
+
generateSubBranch?: (this: MindElixirInstance, params: SubLineParams) => PathString;
|
|
123
|
+
mobileMenu?: boolean;
|
|
124
|
+
theme?: Theme;
|
|
125
|
+
nodeMenu?: boolean;
|
|
126
|
+
};
|
|
127
|
+
export type Uid = string;
|
|
128
|
+
/**
|
|
129
|
+
* MindElixir node object
|
|
130
|
+
*
|
|
131
|
+
* @public
|
|
132
|
+
*/
|
|
133
|
+
export type NodeObj = {
|
|
134
|
+
topic: string;
|
|
135
|
+
id: Uid;
|
|
136
|
+
style?: {
|
|
137
|
+
fontSize?: string;
|
|
138
|
+
color?: string;
|
|
139
|
+
background?: string;
|
|
140
|
+
fontWeight?: string;
|
|
141
|
+
};
|
|
142
|
+
children?: NodeObj[];
|
|
143
|
+
tags?: string[];
|
|
144
|
+
icons?: string[];
|
|
145
|
+
hyperLink?: string;
|
|
146
|
+
expanded?: boolean;
|
|
147
|
+
direction?: number;
|
|
148
|
+
image?: {
|
|
149
|
+
url: string;
|
|
150
|
+
width: number;
|
|
151
|
+
height: number;
|
|
152
|
+
};
|
|
153
|
+
branchColor?: string;
|
|
154
|
+
parent?: NodeObj;
|
|
155
|
+
dangerouslySetInnerHTML?: string;
|
|
156
|
+
};
|
|
157
|
+
export type NodeObjExport = Omit<NodeObj, 'parent'>;
|
|
158
|
+
/**
|
|
159
|
+
* The exported data of MindElixir
|
|
160
|
+
*
|
|
161
|
+
* @public
|
|
162
|
+
*/
|
|
163
|
+
export type MindElixirData = {
|
|
164
|
+
nodeData: NodeObj;
|
|
165
|
+
arrows?: Arrow[];
|
|
166
|
+
summaries?: Summary[];
|
|
167
|
+
direction?: number;
|
|
168
|
+
theme?: Theme;
|
|
169
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare const create: (dom: HTMLElement) => {
|
|
2
|
+
dom: HTMLElement;
|
|
3
|
+
moved: boolean;
|
|
4
|
+
mousedown: boolean;
|
|
5
|
+
handleMouseMove(e: MouseEvent): void;
|
|
6
|
+
handleMouseDown(e: MouseEvent): void;
|
|
7
|
+
handleClear(e: MouseEvent): void;
|
|
8
|
+
cb: ((deltaX: number, deltaY: number) => void) | null;
|
|
9
|
+
init(map: HTMLElement, cb: (deltaX: number, deltaY: number) => void): void;
|
|
10
|
+
destory(map: HTMLElement): void;
|
|
11
|
+
clear(): void;
|
|
12
|
+
};
|
|
13
|
+
declare const LinkDragMoveHelper: {
|
|
14
|
+
create: (dom: HTMLElement) => {
|
|
15
|
+
dom: HTMLElement;
|
|
16
|
+
moved: boolean;
|
|
17
|
+
mousedown: boolean;
|
|
18
|
+
handleMouseMove(e: MouseEvent): void;
|
|
19
|
+
handleMouseDown(e: MouseEvent): void;
|
|
20
|
+
handleClear(e: MouseEvent): void;
|
|
21
|
+
cb: ((deltaX: number, deltaY: number) => void) | null;
|
|
22
|
+
init(map: HTMLElement, cb: (deltaX: number, deltaY: number) => void): void;
|
|
23
|
+
destory(map: HTMLElement): void;
|
|
24
|
+
clear(): void;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export type LinkDragMoveHelperInstance = ReturnType<typeof create>;
|
|
28
|
+
export default LinkDragMoveHelper;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Topic, Wrapper, Parent, Children, Expander } from '../types/dom';
|
|
2
|
+
import type { MindElixirInstance, NodeObj } from '../types/index';
|
|
3
|
+
export declare const findEle: (id: string, instance?: MindElixirInstance) => Topic;
|
|
4
|
+
export declare const shapeTpc: (tpc: Topic, nodeObj: NodeObj) => void;
|
|
5
|
+
export declare const createWrapper: (this: MindElixirInstance, nodeObj: NodeObj, omitChildren?: boolean) => {
|
|
6
|
+
grp: Wrapper;
|
|
7
|
+
top: Parent;
|
|
8
|
+
tpc: Topic;
|
|
9
|
+
};
|
|
10
|
+
export declare const createParent: (this: MindElixirInstance, nodeObj: NodeObj) => {
|
|
11
|
+
p: Parent;
|
|
12
|
+
tpc: Topic;
|
|
13
|
+
};
|
|
14
|
+
export declare const createChildren: (this: MindElixirInstance, wrappers: Wrapper[]) => Children;
|
|
15
|
+
export declare const createTopic: (this: MindElixirInstance, nodeObj: NodeObj) => Topic;
|
|
16
|
+
export declare function selectText(div: HTMLElement): void;
|
|
17
|
+
export declare const editTopic: (this: MindElixirInstance, el: Topic) => void;
|
|
18
|
+
export declare const createExpander: (expanded: boolean | undefined) => Expander;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { MindElixirInstance, NodeObj } from '../types';
|
|
2
|
+
import type { Topic, Wrapper } from '../types/dom';
|
|
3
|
+
export declare const judgeDirection: (direction: number, obj: NodeObj) => 0 | 1 | undefined;
|
|
4
|
+
export declare const addChildDom: (mei: MindElixirInstance, to: Topic, wrapper: Wrapper) => void;
|
|
5
|
+
export declare const removeNodeDom: (tpc: Topic, siblingLength: number) => void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { MindElixirInstance } from '..';
|
|
2
|
+
export type MainLineParams = {
|
|
3
|
+
pT: number;
|
|
4
|
+
pL: number;
|
|
5
|
+
pW: number;
|
|
6
|
+
pH: number;
|
|
7
|
+
cT: number;
|
|
8
|
+
cL: number;
|
|
9
|
+
cW: number;
|
|
10
|
+
cH: number;
|
|
11
|
+
direction: 'lhs' | 'rhs';
|
|
12
|
+
containerHeight: number;
|
|
13
|
+
};
|
|
14
|
+
export type SubLineParams = {
|
|
15
|
+
pT: number;
|
|
16
|
+
pL: number;
|
|
17
|
+
pW: number;
|
|
18
|
+
pH: number;
|
|
19
|
+
cT: number;
|
|
20
|
+
cL: number;
|
|
21
|
+
cW: number;
|
|
22
|
+
cH: number;
|
|
23
|
+
direction: 'lhs' | 'rhs';
|
|
24
|
+
isFirst: boolean | undefined;
|
|
25
|
+
};
|
|
26
|
+
export declare function main({ pT, pL, pW, pH, cT, cL, cW, cH, direction, containerHeight }: MainLineParams): string;
|
|
27
|
+
export declare function sub(this: MindElixirInstance, { pT, pL, pW, pH, cT, cL, cW, cH, direction, isFirst }: SubLineParams): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Topic } from '../types/dom';
|
|
2
|
+
import type { NodeObj, MindElixirInstance, NodeObjExport } from '../types/index';
|
|
3
|
+
export declare function encodeHTML(s: string): string;
|
|
4
|
+
export declare const isMobile: () => boolean;
|
|
5
|
+
export declare const getObjById: (id: string, data: NodeObj) => NodeObj | null;
|
|
6
|
+
/**
|
|
7
|
+
* Add parent property to every node
|
|
8
|
+
*/
|
|
9
|
+
export declare const fillParent: (data: NodeObj, parent?: NodeObj) => void;
|
|
10
|
+
export declare function refreshIds(data: NodeObj): void;
|
|
11
|
+
export declare const throttle: <T extends (...args: never[]) => void>(fn: T, wait: number) => (...args: Parameters<T>) => void;
|
|
12
|
+
export declare function getArrowPoints(p3x: number, p3y: number, p4x: number, p4y: number): {
|
|
13
|
+
x1: number;
|
|
14
|
+
y1: number;
|
|
15
|
+
x2: number;
|
|
16
|
+
y2: number;
|
|
17
|
+
};
|
|
18
|
+
export declare function generateUUID(): string;
|
|
19
|
+
export declare const generateNewObj: (this: MindElixirInstance) => NodeObjExport;
|
|
20
|
+
export declare function checkMoveValid(from: NodeObj, to: NodeObj): boolean;
|
|
21
|
+
export declare function deepClone(obj: NodeObj): any;
|
|
22
|
+
export declare const getOffsetLT: (parent: HTMLElement, child: HTMLElement) => {
|
|
23
|
+
offsetLeft: number;
|
|
24
|
+
offsetTop: number;
|
|
25
|
+
};
|
|
26
|
+
export declare const setAttributes: (el: HTMLElement | SVGElement, attrs: {
|
|
27
|
+
[key: string]: string;
|
|
28
|
+
}) => void;
|
|
29
|
+
export declare const isTopic: (target?: HTMLElement) => target is Topic;
|
|
30
|
+
export declare const unionTopics: (nodes: Topic[]) => Topic[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Children } from '../types/dom';
|
|
2
|
+
import type { MindElixirInstance, NodeObj } from '../types/index';
|
|
3
|
+
export declare const layout: (this: MindElixirInstance) => void;
|
|
4
|
+
export declare const layoutChildren: (mei: MindElixirInstance, data: NodeObj[]) => Children;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NodeObj } from '../types';
|
|
2
|
+
export declare function moveUpObj(obj: NodeObj): void;
|
|
3
|
+
export declare function moveDownObj(obj: NodeObj): void;
|
|
4
|
+
export declare function removeNodeObj(obj: NodeObj): number;
|
|
5
|
+
export declare function insertNodeObj(newObj: NodeObj, type: 'before' | 'after', obj: NodeObj): void;
|
|
6
|
+
export declare function insertParentNodeObj(obj: NodeObj, newObj: NodeObj): void;
|
|
7
|
+
export declare function moveNodeObj(type: 'in' | 'before' | 'after', from: NodeObj, to: NodeObj): void;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { Arrow } from '../arrow';
|
|
2
|
+
import type { Summary } from '../summary';
|
|
3
|
+
import type { NodeObj } from '../types/index';
|
|
4
|
+
type NodeOperation = {
|
|
5
|
+
name: 'moveNodeIn' | 'moveDownNode' | 'moveUpNode' | 'copyNode' | 'addChild' | 'insertParent' | 'insertBefore' | 'beginEdit';
|
|
6
|
+
obj: NodeObj;
|
|
7
|
+
} | {
|
|
8
|
+
name: 'insertSibling';
|
|
9
|
+
type: 'before' | 'after';
|
|
10
|
+
obj: NodeObj;
|
|
11
|
+
} | {
|
|
12
|
+
name: 'reshapeNode';
|
|
13
|
+
obj: NodeObj;
|
|
14
|
+
origin: NodeObj;
|
|
15
|
+
} | {
|
|
16
|
+
name: 'finishEdit';
|
|
17
|
+
obj: NodeObj;
|
|
18
|
+
origin: string;
|
|
19
|
+
} | {
|
|
20
|
+
name: 'moveNodeAfter' | 'moveNodeBefore' | 'moveNodeIn';
|
|
21
|
+
objs: NodeObj[];
|
|
22
|
+
toObj: NodeObj;
|
|
23
|
+
} | {
|
|
24
|
+
name: 'removeNode';
|
|
25
|
+
obj: NodeObj;
|
|
26
|
+
originIndex?: number;
|
|
27
|
+
originParentId?: string;
|
|
28
|
+
};
|
|
29
|
+
type MultipleNodeOperation = {
|
|
30
|
+
name: 'removeNodes';
|
|
31
|
+
objs: NodeObj[];
|
|
32
|
+
} | {
|
|
33
|
+
name: 'copyNodes';
|
|
34
|
+
objs: NodeObj[];
|
|
35
|
+
};
|
|
36
|
+
export type SummaryOperation = {
|
|
37
|
+
name: 'createSummary';
|
|
38
|
+
obj: Summary;
|
|
39
|
+
} | {
|
|
40
|
+
name: 'removeSummary';
|
|
41
|
+
obj: {
|
|
42
|
+
id: string;
|
|
43
|
+
};
|
|
44
|
+
} | {
|
|
45
|
+
name: 'finishEditSummary';
|
|
46
|
+
obj: Summary;
|
|
47
|
+
};
|
|
48
|
+
export type ArrowOperation = {
|
|
49
|
+
name: 'createArrow';
|
|
50
|
+
obj: Arrow;
|
|
51
|
+
} | {
|
|
52
|
+
name: 'removeArrow';
|
|
53
|
+
obj: {
|
|
54
|
+
id: string;
|
|
55
|
+
};
|
|
56
|
+
} | {
|
|
57
|
+
name: 'finishEditArrowLabel';
|
|
58
|
+
obj: Arrow;
|
|
59
|
+
};
|
|
60
|
+
export type Operation = NodeOperation | MultipleNodeOperation | SummaryOperation | ArrowOperation;
|
|
61
|
+
export type OperationType = Operation['name'];
|
|
62
|
+
export type EventMap = {
|
|
63
|
+
operation: (info: Operation) => void;
|
|
64
|
+
selectNode: (nodeObj: NodeObj, e?: MouseEvent) => void;
|
|
65
|
+
selectNewNode: (nodeObj: NodeObj) => void;
|
|
66
|
+
selectNodes: (nodeObj: NodeObj[]) => void;
|
|
67
|
+
unselectNode: () => void;
|
|
68
|
+
unselectNodes: () => void;
|
|
69
|
+
expandNode: (nodeObj: NodeObj) => void;
|
|
70
|
+
};
|
|
71
|
+
declare const Bus: {
|
|
72
|
+
create<T extends Record<string, (...args: any[]) => void> = EventMap>(): {
|
|
73
|
+
handlers: Record<keyof T, ((...arg: any[]) => void)[]>;
|
|
74
|
+
showHandler: () => void;
|
|
75
|
+
addListener: <K extends keyof T>(type: K, handler: T[K]) => void;
|
|
76
|
+
fire: <K extends keyof T>(type: K, ...payload: Parameters<T[K]>) => void;
|
|
77
|
+
removeListener: <K extends keyof T>(type: K, handler: T[K]) => void;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
export default Bus;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MindElixirInstance } from '../types';
|
|
2
|
+
import type { CustomSvg } from '../types/dom';
|
|
3
|
+
export declare const createPath: (d: string, color: string, width: string) => SVGPathElement;
|
|
4
|
+
export declare const createLinkSvg: (klass: string) => SVGSVGElement;
|
|
5
|
+
export declare const createLine: () => SVGLineElement;
|
|
6
|
+
export declare const createSvgGroup: (d: string, arrowd: string) => CustomSvg;
|
|
7
|
+
export declare const editSvgText: (mei: MindElixirInstance, textEl: SVGTextElement, onblur: (div: HTMLDivElement) => void) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mind-elixir",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Mind elixir is a free open source mind map core.",
|
|
6
6
|
"keywords": [
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"prepare": "husky install",
|
|
14
14
|
"lint": "eslint --cache --max-warnings 0 \"src/**/*.{js,json,ts}\" --fix",
|
|
15
15
|
"dev": "vite",
|
|
16
|
-
"build": "
|
|
16
|
+
"build": "node build.js && tsc",
|
|
17
17
|
"tsc": "tsc",
|
|
18
18
|
"preview": "vite preview",
|
|
19
19
|
"test": "playwright test",
|