mind-elixir 4.5.1 → 5.0.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/LICENSE +21 -21
- package/dist/MindElixir.iife.js +7 -7
- package/dist/MindElixir.js +511 -518
- package/dist/MindElixirLite.iife.js +7 -7
- package/dist/MindElixirLite.js +373 -390
- package/dist/mind-elixir.d.ts +663 -0
- package/dist/types/docs.d.ts +2 -2
- package/dist/types/index.d.ts +13 -16
- package/dist/types/interact.d.ts +0 -4
- package/dist/types/methods.d.ts +9 -11
- package/dist/types/nodeOperation.d.ts +1 -1
- package/dist/types/summary.d.ts +0 -1
- package/dist/types/tsdoc-metadata.json +11 -0
- package/dist/types/types/index.d.ts +4 -22
- package/dist/types/utils/domManipulation.d.ts +1 -1
- package/dist/types/utils/dragMoveHelper.d.ts +1 -2
- package/dist/types/utils/pubsub.d.ts +2 -2
- package/package.json +92 -92
- package/readme.md +430 -430
|
@@ -0,0 +1,663 @@
|
|
|
1
|
+
import type SelectionArea from '@viselect/vanilla';
|
|
2
|
+
|
|
3
|
+
declare const addChild: (this: MindElixirInstance, el?: Topic, node?: NodeObj) => void;
|
|
4
|
+
|
|
5
|
+
export declare interface Arrow {
|
|
6
|
+
id: string;
|
|
7
|
+
/**
|
|
8
|
+
* label of arrow
|
|
9
|
+
*/
|
|
10
|
+
label: string;
|
|
11
|
+
/**
|
|
12
|
+
* id of start node
|
|
13
|
+
*/
|
|
14
|
+
from: Uid;
|
|
15
|
+
/**
|
|
16
|
+
* id of end node
|
|
17
|
+
*/
|
|
18
|
+
to: Uid;
|
|
19
|
+
/**
|
|
20
|
+
* offset of control point from start point
|
|
21
|
+
*/
|
|
22
|
+
delta1: {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* offset of control point from end point
|
|
28
|
+
*/
|
|
29
|
+
delta2: {
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* whether the arrow is bidirectional
|
|
35
|
+
*/
|
|
36
|
+
bidirectional?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare namespace arrow {
|
|
40
|
+
export {
|
|
41
|
+
renderArrow,
|
|
42
|
+
editArrowLabel,
|
|
43
|
+
tidyArrow,
|
|
44
|
+
Arrow,
|
|
45
|
+
DivData,
|
|
46
|
+
ArrowOptions,
|
|
47
|
+
createArrow,
|
|
48
|
+
removeArrow,
|
|
49
|
+
selectArrow,
|
|
50
|
+
unselectArrow
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export declare type ArrowOperation = {
|
|
55
|
+
name: 'createArrow';
|
|
56
|
+
obj: Arrow;
|
|
57
|
+
} | {
|
|
58
|
+
name: 'removeArrow';
|
|
59
|
+
obj: {
|
|
60
|
+
id: string;
|
|
61
|
+
};
|
|
62
|
+
} | {
|
|
63
|
+
name: 'finishEditArrowLabel';
|
|
64
|
+
obj: Arrow;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
declare type ArrowOptions = {
|
|
68
|
+
bidirectional?: boolean;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
declare type Before = Partial<{
|
|
72
|
+
[K in Operations]: (...args: Parameters<OperationMap[K]>) => Promise<boolean> | boolean;
|
|
73
|
+
}>;
|
|
74
|
+
|
|
75
|
+
declare const beginEdit: (this: MindElixirInstance, el?: Topic) => void;
|
|
76
|
+
|
|
77
|
+
declare const Bus: {
|
|
78
|
+
create<T extends Record<string, (...args: any[]) => void> = EventMap>(): {
|
|
79
|
+
handlers: Record<keyof T, ((...arg: any[]) => void)[]>;
|
|
80
|
+
showHandler: () => void;
|
|
81
|
+
addListener: <K extends keyof T>(type: K, handler: T[K]) => void;
|
|
82
|
+
fire: <K_1 extends keyof T>(type: K_1, ...payload: Parameters<T[K_1]>) => void;
|
|
83
|
+
removeListener: <K_2 extends keyof T>(type: K_2, handler: T[K_2]) => void;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export declare interface Children extends HTMLElement {
|
|
88
|
+
parentNode: Wrapper;
|
|
89
|
+
children: HTMLCollection & Wrapper[];
|
|
90
|
+
parentElement: Wrapper;
|
|
91
|
+
firstChild: Wrapper;
|
|
92
|
+
previousSibling: Parent;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
declare type ContextMenuOption = {
|
|
96
|
+
focus?: boolean;
|
|
97
|
+
link?: boolean;
|
|
98
|
+
extend?: {
|
|
99
|
+
name: string;
|
|
100
|
+
key?: string;
|
|
101
|
+
onclick: (e: MouseEvent) => void;
|
|
102
|
+
}[];
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
declare const copyNode: (this: MindElixirInstance, node: Topic, to: Topic) => void;
|
|
106
|
+
|
|
107
|
+
declare const copyNodes: (this: MindElixirInstance, tpcs: Topic[], to: Topic) => void;
|
|
108
|
+
|
|
109
|
+
declare const create: (dom: HTMLElement) => {
|
|
110
|
+
dom: HTMLElement;
|
|
111
|
+
moved: boolean;
|
|
112
|
+
mousedown: boolean;
|
|
113
|
+
handleMouseMove(e: MouseEvent): void;
|
|
114
|
+
handleMouseDown(e: MouseEvent): void;
|
|
115
|
+
handleClear(e: MouseEvent): void;
|
|
116
|
+
cb: ((deltaX: number, deltaY: number) => void) | null;
|
|
117
|
+
init(map: HTMLElement, cb: (deltaX: number, deltaY: number) => void): void;
|
|
118
|
+
destory(map: HTMLElement): void;
|
|
119
|
+
clear(): void;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
declare const createArrow: (this: MindElixirInstance, from: Topic, to: Topic, options?: ArrowOptions) => void;
|
|
123
|
+
|
|
124
|
+
declare const createSummary: (this: MindElixirInstance) => void;
|
|
125
|
+
|
|
126
|
+
export declare type CustomArrow = SVGPathElement;
|
|
127
|
+
|
|
128
|
+
export declare type CustomLine = SVGPathElement;
|
|
129
|
+
|
|
130
|
+
export declare interface CustomSvg extends SVGGElement {
|
|
131
|
+
arrowObj: Arrow;
|
|
132
|
+
children: HTMLCollection & [CustomLine, CustomArrow, CustomArrow, SVGTextElement];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
declare enum DirectionClass {
|
|
136
|
+
LHS = "lhs",
|
|
137
|
+
RHS = "rhs"
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
declare type DivData = {
|
|
141
|
+
cx: number;
|
|
142
|
+
cy: number;
|
|
143
|
+
w: number;
|
|
144
|
+
h: number;
|
|
145
|
+
ctrlX: number;
|
|
146
|
+
ctrlY: number;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
declare function editArrowLabel(this: MindElixirInstance, el: CustomSvg): void;
|
|
150
|
+
|
|
151
|
+
declare const editSummary: (this: MindElixirInstance, el: SummarySvgGroup) => void;
|
|
152
|
+
|
|
153
|
+
export declare type EventMap = {
|
|
154
|
+
operation: (info: Operation) => void;
|
|
155
|
+
selectNode: (nodeObj: NodeObj, e?: MouseEvent) => void;
|
|
156
|
+
selectNewNode: (nodeObj: NodeObj) => void;
|
|
157
|
+
selectNodes: (nodeObj: NodeObj[]) => void;
|
|
158
|
+
unselectNode: () => void;
|
|
159
|
+
unselectNodes: () => void;
|
|
160
|
+
expandNode: (nodeObj: NodeObj) => void;
|
|
161
|
+
linkDiv: () => void;
|
|
162
|
+
scale: (scale: number) => void;
|
|
163
|
+
/**
|
|
164
|
+
* please use throttling to prevent performance degradation
|
|
165
|
+
*/
|
|
166
|
+
updateArrowDelta: (arrow: Arrow) => void;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export declare interface Expander extends HTMLElement {
|
|
170
|
+
expanded?: boolean;
|
|
171
|
+
parentNode: Parent;
|
|
172
|
+
parentElement: Parent;
|
|
173
|
+
previousSibling: Topic;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
declare const insertParent: (this: MindElixirInstance, el?: Topic, node?: NodeObj) => void;
|
|
177
|
+
|
|
178
|
+
declare const insertSibling: (this: MindElixirInstance, type: 'before' | 'after', el?: Topic, node?: NodeObj) => void;
|
|
179
|
+
|
|
180
|
+
declare type Left = 0;
|
|
181
|
+
|
|
182
|
+
declare type LinkDragMoveHelperInstance = ReturnType<typeof create>;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* @public
|
|
186
|
+
*/
|
|
187
|
+
export declare type Locale = 'cn' | 'zh_CN' | 'zh_TW' | 'en' | 'ru' | 'ja' | 'pt' | 'it' | 'es' | 'fr' | 'ko';
|
|
188
|
+
|
|
189
|
+
export declare interface MainLineParams {
|
|
190
|
+
pT: number;
|
|
191
|
+
pL: number;
|
|
192
|
+
pW: number;
|
|
193
|
+
pH: number;
|
|
194
|
+
cT: number;
|
|
195
|
+
cL: number;
|
|
196
|
+
cW: number;
|
|
197
|
+
cH: number;
|
|
198
|
+
direction: DirectionClass;
|
|
199
|
+
containerHeight: number;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Methods that mind-elixir instance can use
|
|
204
|
+
*
|
|
205
|
+
* @public
|
|
206
|
+
*/
|
|
207
|
+
export declare const methods: {
|
|
208
|
+
init(this: MindElixirInstance, data: MindElixirData): Error | undefined;
|
|
209
|
+
destroy(this: Partial<MindElixirInstance>): void;
|
|
210
|
+
exportSvg: (this: MindElixirInstance, noForeignObject?: boolean, injectCss?: string | undefined) => Blob;
|
|
211
|
+
exportPng: (this: MindElixirInstance, noForeignObject?: boolean, injectCss?: string | undefined) => Promise<Blob | null>;
|
|
212
|
+
createSummary: (this: MindElixirInstance) => void;
|
|
213
|
+
removeSummary: (this: MindElixirInstance, id: string) => void;
|
|
214
|
+
selectSummary: (this: MindElixirInstance, el: summary.SummarySvgGroup) => void;
|
|
215
|
+
unselectSummary: (this: MindElixirInstance) => void;
|
|
216
|
+
renderSummary: (this: MindElixirInstance) => void;
|
|
217
|
+
editSummary: (this: MindElixirInstance, el: summary.SummarySvgGroup) => void;
|
|
218
|
+
renderArrow(this: MindElixirInstance): void;
|
|
219
|
+
editArrowLabel(this: MindElixirInstance, el: CustomSvg): void;
|
|
220
|
+
tidyArrow(this: MindElixirInstance): void;
|
|
221
|
+
createArrow: (this: MindElixirInstance, from: Topic, to: Topic, options?: arrow.ArrowOptions) => void;
|
|
222
|
+
removeArrow: (this: MindElixirInstance, linkSvg?: CustomSvg | undefined) => void;
|
|
223
|
+
selectArrow: (this: MindElixirInstance, link: CustomSvg) => void;
|
|
224
|
+
unselectArrow: (this: MindElixirInstance) => void;
|
|
225
|
+
rmSubline: (this: MindElixirInstance, tpc: Topic) => Promise<void>;
|
|
226
|
+
reshapeNode: (this: MindElixirInstance, tpc: Topic, patchData: Partial<NodeObj>) => Promise<void>;
|
|
227
|
+
insertSibling: (this: MindElixirInstance, type: "before" | "after", el?: Topic | undefined, node?: NodeObj | undefined) => Promise<void>;
|
|
228
|
+
insertParent: (this: MindElixirInstance, el?: Topic | undefined, node?: NodeObj | undefined) => Promise<void>;
|
|
229
|
+
addChild: (this: MindElixirInstance, el?: Topic | undefined, node?: NodeObj | undefined) => Promise<void>;
|
|
230
|
+
copyNode: (this: MindElixirInstance, node: Topic, to: Topic) => Promise<void>;
|
|
231
|
+
copyNodes: (this: MindElixirInstance, tpcs: Topic[], to: Topic) => Promise<void>;
|
|
232
|
+
moveUpNode: (this: MindElixirInstance, el?: Topic | undefined) => Promise<void>;
|
|
233
|
+
moveDownNode: (this: MindElixirInstance, el?: Topic | undefined) => Promise<void>;
|
|
234
|
+
removeNode: (this: MindElixirInstance, el?: Topic | undefined) => Promise<void>;
|
|
235
|
+
removeNodes: (this: MindElixirInstance, tpcs: Topic[]) => Promise<void>;
|
|
236
|
+
moveNodeIn: (this: MindElixirInstance, from: Topic[], to: Topic) => Promise<void>;
|
|
237
|
+
moveNodeBefore: (this: MindElixirInstance, from: Topic[], to: Topic) => Promise<void>;
|
|
238
|
+
moveNodeAfter: (this: MindElixirInstance, from: Topic[], to: Topic) => Promise<void>;
|
|
239
|
+
beginEdit: (this: MindElixirInstance, el?: Topic | undefined) => Promise<void>;
|
|
240
|
+
setNodeTopic: (this: MindElixirInstance, el: Topic, topic: string) => Promise<void>;
|
|
241
|
+
selectNode: (this: MindElixirInstance, targetElement: Topic, isNewNode?: boolean | undefined, e?: MouseEvent | undefined) => void;
|
|
242
|
+
unselectNode: (this: MindElixirInstance) => void;
|
|
243
|
+
selectNodes: (this: MindElixirInstance, tpc: Topic[]) => void;
|
|
244
|
+
unselectNodes: (this: MindElixirInstance) => void;
|
|
245
|
+
clearSelection: (this: MindElixirInstance) => void;
|
|
246
|
+
getDataString: (this: MindElixirInstance) => string;
|
|
247
|
+
getData: (this: MindElixirInstance) => MindElixirData;
|
|
248
|
+
getDataMd: (this: MindElixirInstance) => string;
|
|
249
|
+
enableEdit: (this: MindElixirInstance) => void;
|
|
250
|
+
disableEdit: (this: MindElixirInstance) => void;
|
|
251
|
+
scale: (this: MindElixirInstance, scaleVal: number) => void;
|
|
252
|
+
toCenter: (this: MindElixirInstance) => void;
|
|
253
|
+
install: (this: MindElixirInstance, plugin: (instance: MindElixirInstance) => void) => void;
|
|
254
|
+
focusNode: (this: MindElixirInstance, el: Topic) => void;
|
|
255
|
+
cancelFocus: (this: MindElixirInstance) => void;
|
|
256
|
+
initLeft: (this: MindElixirInstance) => void;
|
|
257
|
+
initRight: (this: MindElixirInstance) => void;
|
|
258
|
+
initSide: (this: MindElixirInstance) => void;
|
|
259
|
+
setLocale: (this: MindElixirInstance, locale: Locale) => void;
|
|
260
|
+
expandNode: (this: MindElixirInstance, el: Topic, isExpand?: boolean | undefined) => void;
|
|
261
|
+
refresh: (this: MindElixirInstance, data?: MindElixirData | undefined) => void;
|
|
262
|
+
getObjById: (id: string, data: NodeObj) => NodeObj | null;
|
|
263
|
+
generateNewObj: (this: MindElixirInstance) => NodeObjExport;
|
|
264
|
+
layout: (this: MindElixirInstance) => void;
|
|
265
|
+
linkDiv: (this: MindElixirInstance, mainNode?: Wrapper | undefined) => void;
|
|
266
|
+
editTopic: (this: MindElixirInstance, el: Topic) => void;
|
|
267
|
+
createWrapper: (this: MindElixirInstance, nodeObj: NodeObj, omitChildren?: boolean | undefined) => {
|
|
268
|
+
grp: Wrapper;
|
|
269
|
+
top: Parent;
|
|
270
|
+
tpc: Topic;
|
|
271
|
+
};
|
|
272
|
+
createParent: (this: MindElixirInstance, nodeObj: NodeObj) => {
|
|
273
|
+
p: Parent;
|
|
274
|
+
tpc: Topic;
|
|
275
|
+
};
|
|
276
|
+
createChildren: (this: MindElixirInstance, wrappers: Wrapper[]) => Children;
|
|
277
|
+
createTopic: (this: MindElixirInstance, nodeObj: NodeObj) => Topic;
|
|
278
|
+
findEle: (id: string, instance?: MindElixirInstance | undefined) => Topic;
|
|
279
|
+
changeTheme: (this: MindElixirInstance, theme: Theme, shouldRefresh?: boolean) => void;
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* The exported data of MindElixir
|
|
284
|
+
*
|
|
285
|
+
* @public
|
|
286
|
+
*/
|
|
287
|
+
export declare type MindElixirData = {
|
|
288
|
+
nodeData: NodeObj;
|
|
289
|
+
arrows?: Arrow[];
|
|
290
|
+
summaries?: Summary[];
|
|
291
|
+
direction?: number;
|
|
292
|
+
theme?: Theme;
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* The MindElixir instance
|
|
297
|
+
*
|
|
298
|
+
* @public
|
|
299
|
+
*/
|
|
300
|
+
export declare interface MindElixirInstance extends MindElixirMethods_2 {
|
|
301
|
+
disposable: Array<() => void>;
|
|
302
|
+
isFocusMode: boolean;
|
|
303
|
+
nodeDataBackup: NodeObj;
|
|
304
|
+
mindElixirBox: HTMLElement;
|
|
305
|
+
nodeData: NodeObj;
|
|
306
|
+
arrows: Arrow[];
|
|
307
|
+
summaries: Summary[];
|
|
308
|
+
currentNode: Topic | null;
|
|
309
|
+
currentNodes: Topic[] | null;
|
|
310
|
+
currentSummary: SummarySvgGroup | null;
|
|
311
|
+
currentArrow: CustomSvg | null;
|
|
312
|
+
waitCopy: Topic[] | null;
|
|
313
|
+
scaleVal: number;
|
|
314
|
+
tempDirection: number | null;
|
|
315
|
+
theme: Theme;
|
|
316
|
+
userTheme?: Theme;
|
|
317
|
+
direction: number;
|
|
318
|
+
locale: Locale;
|
|
319
|
+
draggable: boolean;
|
|
320
|
+
editable: boolean;
|
|
321
|
+
contextMenu: boolean;
|
|
322
|
+
contextMenuOption?: ContextMenuOption;
|
|
323
|
+
toolBar: boolean;
|
|
324
|
+
keypress: boolean;
|
|
325
|
+
mouseSelectionButton: 0 | 2;
|
|
326
|
+
before: Before;
|
|
327
|
+
newTopicName: string;
|
|
328
|
+
allowUndo: boolean;
|
|
329
|
+
overflowHidden: boolean;
|
|
330
|
+
mainBranchStyle: number;
|
|
331
|
+
subBranchStyle: number;
|
|
332
|
+
generateMainBranch: (params: MainLineParams) => PathString;
|
|
333
|
+
generateSubBranch: (params: SubLineParams) => PathString;
|
|
334
|
+
container: HTMLElement;
|
|
335
|
+
map: HTMLElement;
|
|
336
|
+
root: HTMLElement;
|
|
337
|
+
nodes: HTMLElement;
|
|
338
|
+
lines: SVGElement;
|
|
339
|
+
summarySvg: SVGElement;
|
|
340
|
+
linkController: SVGElement;
|
|
341
|
+
P2: HTMLElement;
|
|
342
|
+
P3: HTMLElement;
|
|
343
|
+
line1: SVGElement;
|
|
344
|
+
line2: SVGElement;
|
|
345
|
+
linkSvgGroup: SVGElement;
|
|
346
|
+
/**
|
|
347
|
+
* @internal
|
|
348
|
+
*/
|
|
349
|
+
helper1?: LinkDragMoveHelperInstance;
|
|
350
|
+
/**
|
|
351
|
+
* @internal
|
|
352
|
+
*/
|
|
353
|
+
helper2?: LinkDragMoveHelperInstance;
|
|
354
|
+
bus: ReturnType<typeof Bus.create<EventMap>>;
|
|
355
|
+
history: Operation[];
|
|
356
|
+
undo: () => void;
|
|
357
|
+
redo: () => void;
|
|
358
|
+
selection: SelectionArea;
|
|
359
|
+
selectionContainer?: string | HTMLElement;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export declare type MindElixirMethods = typeof methods;
|
|
363
|
+
|
|
364
|
+
declare type MindElixirMethods_2 = typeof methods;
|
|
365
|
+
|
|
366
|
+
declare const moveDownNode: (this: MindElixirInstance, el?: Topic) => void;
|
|
367
|
+
|
|
368
|
+
declare const moveNodeAfter: (this: MindElixirInstance, from: Topic[], to: Topic) => void;
|
|
369
|
+
|
|
370
|
+
declare const moveNodeBefore: (this: MindElixirInstance, from: Topic[], to: Topic) => void;
|
|
371
|
+
|
|
372
|
+
declare const moveNodeIn: (this: MindElixirInstance, from: Topic[], to: Topic) => void;
|
|
373
|
+
|
|
374
|
+
declare const moveUpNode: (this: MindElixirInstance, el?: Topic) => void;
|
|
375
|
+
|
|
376
|
+
declare type MultipleNodeOperation = {
|
|
377
|
+
name: 'removeNodes';
|
|
378
|
+
objs: NodeObj[];
|
|
379
|
+
} | {
|
|
380
|
+
name: 'copyNodes';
|
|
381
|
+
objs: NodeObj[];
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* MindElixir node object
|
|
386
|
+
*
|
|
387
|
+
* @public
|
|
388
|
+
*/
|
|
389
|
+
export declare type NodeObj = {
|
|
390
|
+
topic: string;
|
|
391
|
+
id: Uid;
|
|
392
|
+
style?: {
|
|
393
|
+
fontSize?: string;
|
|
394
|
+
color?: string;
|
|
395
|
+
background?: string;
|
|
396
|
+
fontWeight?: string;
|
|
397
|
+
};
|
|
398
|
+
children?: NodeObj[];
|
|
399
|
+
tags?: string[];
|
|
400
|
+
icons?: string[];
|
|
401
|
+
hyperLink?: string;
|
|
402
|
+
expanded?: boolean;
|
|
403
|
+
direction?: Left | Right;
|
|
404
|
+
image?: {
|
|
405
|
+
url: string;
|
|
406
|
+
width: number;
|
|
407
|
+
height: number;
|
|
408
|
+
fit?: 'fill' | 'contain' | 'cover';
|
|
409
|
+
};
|
|
410
|
+
branchColor?: string;
|
|
411
|
+
parent?: NodeObj;
|
|
412
|
+
dangerouslySetInnerHTML?: string;
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
export declare type NodeObjExport = Omit<NodeObj, 'parent'>;
|
|
416
|
+
|
|
417
|
+
declare type NodeOperation = {
|
|
418
|
+
name: 'moveNodeIn' | 'moveDownNode' | 'moveUpNode' | 'copyNode' | 'addChild' | 'insertParent' | 'insertBefore' | 'beginEdit';
|
|
419
|
+
obj: NodeObj;
|
|
420
|
+
} | {
|
|
421
|
+
name: 'insertSibling';
|
|
422
|
+
type: 'before' | 'after';
|
|
423
|
+
obj: NodeObj;
|
|
424
|
+
} | {
|
|
425
|
+
name: 'reshapeNode';
|
|
426
|
+
obj: NodeObj;
|
|
427
|
+
origin: NodeObj;
|
|
428
|
+
} | {
|
|
429
|
+
name: 'finishEdit';
|
|
430
|
+
obj: NodeObj;
|
|
431
|
+
origin: string;
|
|
432
|
+
} | {
|
|
433
|
+
name: 'moveNodeAfter' | 'moveNodeBefore' | 'moveNodeIn';
|
|
434
|
+
objs: NodeObj[];
|
|
435
|
+
toObj: NodeObj;
|
|
436
|
+
} | {
|
|
437
|
+
name: 'removeNode';
|
|
438
|
+
obj: NodeObj;
|
|
439
|
+
originIndex?: number;
|
|
440
|
+
originParentId?: string;
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
declare namespace nodeOperation {
|
|
444
|
+
export {
|
|
445
|
+
rmSubline,
|
|
446
|
+
reshapeNode,
|
|
447
|
+
insertSibling,
|
|
448
|
+
insertParent,
|
|
449
|
+
addChild,
|
|
450
|
+
copyNode,
|
|
451
|
+
copyNodes,
|
|
452
|
+
moveUpNode,
|
|
453
|
+
moveDownNode,
|
|
454
|
+
removeNode,
|
|
455
|
+
removeNodes,
|
|
456
|
+
moveNodeIn,
|
|
457
|
+
moveNodeBefore,
|
|
458
|
+
moveNodeAfter,
|
|
459
|
+
beginEdit,
|
|
460
|
+
setNodeTopic
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
export declare type Operation = NodeOperation | MultipleNodeOperation | SummaryOperation | ArrowOperation;
|
|
465
|
+
|
|
466
|
+
declare type OperationMap = typeof nodeOperation;
|
|
467
|
+
|
|
468
|
+
declare type Operations = keyof OperationMap;
|
|
469
|
+
|
|
470
|
+
export declare type OperationType = Operation['name'];
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* The MindElixir options
|
|
474
|
+
*
|
|
475
|
+
* @public
|
|
476
|
+
*/
|
|
477
|
+
export declare type Options = {
|
|
478
|
+
el: string | HTMLElement;
|
|
479
|
+
direction?: number;
|
|
480
|
+
locale?: Locale;
|
|
481
|
+
draggable?: boolean;
|
|
482
|
+
editable?: boolean;
|
|
483
|
+
contextMenu?: boolean;
|
|
484
|
+
contextMenuOption?: ContextMenuOption;
|
|
485
|
+
toolBar?: boolean;
|
|
486
|
+
keypress?: boolean;
|
|
487
|
+
mouseSelectionButton?: 0 | 2;
|
|
488
|
+
before?: Before;
|
|
489
|
+
newTopicName?: string;
|
|
490
|
+
allowUndo?: boolean;
|
|
491
|
+
overflowHidden?: boolean;
|
|
492
|
+
generateMainBranch?: (this: MindElixirInstance, params: MainLineParams) => PathString;
|
|
493
|
+
generateSubBranch?: (this: MindElixirInstance, params: SubLineParams) => PathString;
|
|
494
|
+
theme?: Theme;
|
|
495
|
+
nodeMenu?: boolean;
|
|
496
|
+
selectionContainer?: string | HTMLElement;
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
export declare interface Parent extends HTMLElement {
|
|
500
|
+
firstChild: Topic;
|
|
501
|
+
children: HTMLCollection & [Topic, Expander | undefined];
|
|
502
|
+
parentNode: Wrapper;
|
|
503
|
+
parentElement: Wrapper;
|
|
504
|
+
nextSibling: Children;
|
|
505
|
+
offsetParent: Wrapper;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
declare type PathString = string;
|
|
509
|
+
|
|
510
|
+
declare const removeArrow: (this: MindElixirInstance, linkSvg?: CustomSvg) => void;
|
|
511
|
+
|
|
512
|
+
declare const removeNode: (this: MindElixirInstance, el?: Topic) => void;
|
|
513
|
+
|
|
514
|
+
declare const removeNodes: (this: MindElixirInstance, tpcs: Topic[]) => void;
|
|
515
|
+
|
|
516
|
+
declare const removeSummary: (this: MindElixirInstance, id: string) => void;
|
|
517
|
+
|
|
518
|
+
declare function renderArrow(this: MindElixirInstance): void;
|
|
519
|
+
|
|
520
|
+
declare const renderSummary: (this: MindElixirInstance) => void;
|
|
521
|
+
|
|
522
|
+
declare const reshapeNode: (this: MindElixirInstance, tpc: Topic, patchData: Partial<NodeObj>) => void;
|
|
523
|
+
|
|
524
|
+
declare type Right = 1;
|
|
525
|
+
|
|
526
|
+
declare const rmSubline: (tpc: Topic) => void;
|
|
527
|
+
|
|
528
|
+
declare const selectArrow: (this: MindElixirInstance, link: CustomSvg) => void;
|
|
529
|
+
|
|
530
|
+
declare const selectSummary: (this: MindElixirInstance, el: SummarySvgGroup) => void;
|
|
531
|
+
|
|
532
|
+
declare const setNodeTopic: (this: MindElixirInstance, el: Topic, topic: string) => void;
|
|
533
|
+
|
|
534
|
+
export declare interface SubLineParams {
|
|
535
|
+
pT: number;
|
|
536
|
+
pL: number;
|
|
537
|
+
pW: number;
|
|
538
|
+
pH: number;
|
|
539
|
+
cT: number;
|
|
540
|
+
cL: number;
|
|
541
|
+
cW: number;
|
|
542
|
+
cH: number;
|
|
543
|
+
direction: DirectionClass;
|
|
544
|
+
isFirst: boolean | undefined;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* @public
|
|
549
|
+
*/
|
|
550
|
+
export declare interface Summary {
|
|
551
|
+
id: string;
|
|
552
|
+
text: string;
|
|
553
|
+
/**
|
|
554
|
+
* parent node id of the summary
|
|
555
|
+
*/
|
|
556
|
+
parent: string;
|
|
557
|
+
/**
|
|
558
|
+
* start index of the summary
|
|
559
|
+
*/
|
|
560
|
+
start: number;
|
|
561
|
+
/**
|
|
562
|
+
* end index of the summary
|
|
563
|
+
*/
|
|
564
|
+
end: number;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
declare namespace summary {
|
|
568
|
+
export {
|
|
569
|
+
Summary,
|
|
570
|
+
SummarySvgGroup,
|
|
571
|
+
createSummary,
|
|
572
|
+
removeSummary,
|
|
573
|
+
selectSummary,
|
|
574
|
+
unselectSummary,
|
|
575
|
+
renderSummary,
|
|
576
|
+
editSummary
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
export declare type SummaryOperation = {
|
|
581
|
+
name: 'createSummary';
|
|
582
|
+
obj: Summary;
|
|
583
|
+
} | {
|
|
584
|
+
name: 'removeSummary';
|
|
585
|
+
obj: {
|
|
586
|
+
id: string;
|
|
587
|
+
};
|
|
588
|
+
} | {
|
|
589
|
+
name: 'finishEditSummary';
|
|
590
|
+
obj: Summary;
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
export declare type SummarySvgGroup = SVGGElement & {
|
|
594
|
+
children: [SVGPathElement, SVGTextElement];
|
|
595
|
+
summaryObj: Summary;
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* MindElixir Theme
|
|
600
|
+
*
|
|
601
|
+
* @public
|
|
602
|
+
*/
|
|
603
|
+
export declare type Theme = {
|
|
604
|
+
name: string;
|
|
605
|
+
/**
|
|
606
|
+
* Hint for developers to use the correct theme
|
|
607
|
+
*/
|
|
608
|
+
type?: 'light' | 'dark';
|
|
609
|
+
/**
|
|
610
|
+
* Color palette for main branches
|
|
611
|
+
*/
|
|
612
|
+
palette: string[];
|
|
613
|
+
cssVar: Partial<{
|
|
614
|
+
'--gap': string;
|
|
615
|
+
'--main-color': string;
|
|
616
|
+
'--main-bgcolor': string;
|
|
617
|
+
'--color': string;
|
|
618
|
+
'--bgcolor': string;
|
|
619
|
+
'--selected': string;
|
|
620
|
+
'--root-color': string;
|
|
621
|
+
'--root-bgcolor': string;
|
|
622
|
+
'--root-border-color': string;
|
|
623
|
+
'--root-radius': string;
|
|
624
|
+
'--main-radius': string;
|
|
625
|
+
'--topic-padding': string;
|
|
626
|
+
'--panel-color': string;
|
|
627
|
+
'--panel-bgcolor': string;
|
|
628
|
+
'--panel-border-color': string;
|
|
629
|
+
}>;
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
declare function tidyArrow(this: MindElixirInstance): void;
|
|
633
|
+
|
|
634
|
+
export declare interface Topic extends HTMLElement {
|
|
635
|
+
nodeObj: NodeObj;
|
|
636
|
+
parentNode: Parent;
|
|
637
|
+
parentElement: Parent;
|
|
638
|
+
offsetParent: Parent;
|
|
639
|
+
text: HTMLSpanElement;
|
|
640
|
+
expander?: Expander;
|
|
641
|
+
link?: HTMLElement;
|
|
642
|
+
image?: HTMLImageElement;
|
|
643
|
+
icons?: HTMLSpanElement;
|
|
644
|
+
tags?: HTMLDivElement;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
declare type Uid = string;
|
|
648
|
+
|
|
649
|
+
declare const unselectArrow: (this: MindElixirInstance) => void;
|
|
650
|
+
|
|
651
|
+
declare const unselectSummary: (this: MindElixirInstance) => void;
|
|
652
|
+
|
|
653
|
+
export declare interface Wrapper extends HTMLElement {
|
|
654
|
+
firstChild: Parent;
|
|
655
|
+
children: HTMLCollection & [Parent, Children];
|
|
656
|
+
parentNode: Children;
|
|
657
|
+
parentElement: Children;
|
|
658
|
+
offsetParent: Wrapper;
|
|
659
|
+
previousSibling: Wrapper | null;
|
|
660
|
+
nextSibling: Wrapper | null;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
export { }
|
package/dist/types/docs.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Arrow } from './arrow';
|
|
2
2
|
import type methods from './methods';
|
|
3
|
-
import type { MindElixirMethods } from './methods';
|
|
4
3
|
import type { Summary, SummarySvgGroup } from './summary';
|
|
5
4
|
import type { MindElixirData, MindElixirInstance, NodeObj, NodeObjExport, Options, Theme } from './types';
|
|
6
5
|
import type { MainLineParams, SubLineParams } from './utils/generateBranch';
|
|
7
6
|
import type { Locale } from './i18n';
|
|
8
|
-
export { methods, Theme, Options,
|
|
7
|
+
export { methods, Theme, Options, MindElixirInstance, MindElixirData, NodeObj, NodeObjExport, Summary, SummarySvgGroup, Arrow, MainLineParams, SubLineParams, Locale, };
|
|
8
|
+
export type MindElixirMethods = typeof methods;
|
|
9
9
|
export type * from './types/dom';
|
|
10
10
|
export type * from './utils/pubsub';
|