jsmind 0.9.1 → 2.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.
Files changed (40) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +78 -67
  3. package/README.zh.md +81 -0
  4. package/dist/cli.js +4482 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/jsmind.cjs +4101 -0
  7. package/dist/jsmind.cjs.map +1 -0
  8. package/dist/jsmind.d.ts +1269 -0
  9. package/dist/jsmind.js +4099 -0
  10. package/dist/jsmind.js.map +1 -0
  11. package/dist/jsmind.umd.js +4107 -0
  12. package/dist/jsmind.umd.js.map +1 -0
  13. package/package.json +65 -51
  14. package/es6/README-en.md +0 -37
  15. package/es6/README.md +0 -34
  16. package/es6/jsmind.draggable-node.js +0 -9
  17. package/es6/jsmind.draggable-node.js.map +0 -1
  18. package/es6/jsmind.js +0 -9
  19. package/es6/jsmind.js.map +0 -1
  20. package/es6/jsmind.screenshot.js +0 -9
  21. package/es6/jsmind.screenshot.js.map +0 -1
  22. package/style/jsmind.css +0 -408
  23. package/types/generated/index.d.ts +0 -8
  24. package/types/generated/jsmind.common.d.ts +0 -66
  25. package/types/generated/jsmind.d.ts +0 -366
  26. package/types/generated/jsmind.data_provider.d.ts +0 -56
  27. package/types/generated/jsmind.dom.d.ts +0 -59
  28. package/types/generated/jsmind.format.d.ts +0 -100
  29. package/types/generated/jsmind.graph.d.ts +0 -180
  30. package/types/generated/jsmind.layout_provider.d.ts +0 -182
  31. package/types/generated/jsmind.mind.d.ts +0 -121
  32. package/types/generated/jsmind.node.d.ts +0 -62
  33. package/types/generated/jsmind.option.d.ts +0 -64
  34. package/types/generated/jsmind.plugin.d.ts +0 -21
  35. package/types/generated/jsmind.shortcut_provider.d.ts +0 -52
  36. package/types/generated/jsmind.util.d.ts +0 -26
  37. package/types/generated/jsmind.view_provider.d.ts +0 -347
  38. package/types/generated/plugins/jsmind.draggable-node.d.ts +0 -229
  39. package/types/generated/plugins/jsmind.screenshot.d.ts +0 -83
  40. package/types/tsconfig.declaration.json +0 -19
@@ -1,366 +0,0 @@
1
- /**
2
- * Event callback payload
3
- * @typedef {{ evt?: string, data?: unknown[], node?: string }} EventData
4
- */
5
- /**
6
- * jsMind runtime: orchestrates data/layout/view/shortcut and exposes public API.
7
- */
8
- export default class jsMind {
9
- static mind: typeof Mind;
10
- static node: typeof Node;
11
- static direction: import("./jsmind.common.js").DirectionType;
12
- static event_type: {
13
- show: number;
14
- resize: number;
15
- edit: number;
16
- select: number;
17
- };
18
- static $: {
19
- w: Window;
20
- d: Document;
21
- g: (id: string) => HTMLElement | null;
22
- c: (tag: string) => HTMLElement;
23
- t: (n: HTMLElement, t: string) => void;
24
- h: (n: HTMLElement, t: string | HTMLElement) => void;
25
- i: (el: unknown) => el is HTMLElement;
26
- on: (t: HTMLElement, e: string, h: (ev: Event) => void) => void;
27
- };
28
- static plugin: typeof Plugin;
29
- static register_plugin: typeof _register_plugin;
30
- static util: {
31
- file: {
32
- read: (file: File, cb: (result: string, name: string) => void) => void;
33
- save: (data: string, type: string, name: string) => void;
34
- };
35
- json: {
36
- json2string: (v: unknown) => string;
37
- string2json: (s: string) => unknown;
38
- merge: (b: object, a: object) => object;
39
- };
40
- uuid: {
41
- newid: () => string;
42
- };
43
- text: {
44
- is_empty: (s?: string) => boolean;
45
- };
46
- };
47
- /**
48
- * Deprecated: static show constructor helper.
49
- * @param {import('./jsmind.option.js').JsMindRuntimeOptions} options
50
- * @param {object | null} mind
51
- * @returns {jsMind}
52
- */
53
- static show(options: import("./jsmind.option.js").JsMindRuntimeOptions, mind: object | null): jsMind;
54
- /**
55
- * Create a jsMind instance.
56
- * @param {import('./jsmind.option.js').JsMindRuntimeOptions} options
57
- */
58
- constructor(options: import("./jsmind.option.js").JsMindRuntimeOptions);
59
- options: import("./jsmind.option.js").JsMindRuntimeOptions;
60
- version: string;
61
- initialized: boolean;
62
- mind: Mind;
63
- /** @type {Array<(type: number, data: EventData) => void>} */
64
- event_handles: Array<(type: number, data: EventData) => void>;
65
- /** Initialize sub-systems and plugins. */
66
- init(): void;
67
- data: DataProvider;
68
- layout: LayoutProvider;
69
- view: ViewProvider;
70
- shortcut: ShortcutProvider;
71
- /** @returns {boolean} whether current mind map is editable */
72
- get_editable(): boolean;
73
- /** enable editing */
74
- enable_edit(): void;
75
- /** disable editing */
76
- disable_edit(): void;
77
- /** @returns {boolean} whether view is draggable */
78
- get_view_draggable(): boolean;
79
- /** enable view dragging */
80
- enable_view_draggable(): void;
81
- /** disable view dragging */
82
- disable_view_draggable(): void;
83
- /**
84
- * Enable default event handle.
85
- * @param {'mousedown'|'click'|'dblclick'|'mousewheel'} event_handle
86
- */
87
- enable_event_handle(event_handle: "mousedown" | "click" | "dblclick" | "mousewheel"): void;
88
- /**
89
- * Disable default event handle.
90
- * @param {'mousedown'|'click'|'dblclick'|'mousewheel'} event_handle
91
- */
92
- disable_event_handle(event_handle: "mousedown" | "click" | "dblclick" | "mousewheel"): void;
93
- /**
94
- * Set theme name.
95
- * @param {string|null=} theme
96
- */
97
- set_theme(theme?: (string | null) | undefined): void;
98
- /** bind internal DOM events */
99
- _event_bind(): void;
100
- /** @param {MouseEvent} e */
101
- mousedown_handle(e: MouseEvent): void;
102
- /** @param {MouseEvent} e */
103
- click_handle(e: MouseEvent): void;
104
- /** @param {MouseEvent} e */
105
- dblclick_handle(e: MouseEvent): void;
106
- /** @param {WheelEvent} e */
107
- mousewheel_handle(e: WheelEvent): void;
108
- /**
109
- * Begin editing a node.
110
- * @param {string | import('./jsmind.node.js').Node} node
111
- * @returns {boolean|void}
112
- */
113
- begin_edit(node: string | import("./jsmind.node.js").Node): boolean | void;
114
- /** End editing */
115
- end_edit(): void;
116
- /**
117
- * Toggle a node's expanded state.
118
- * @param {string | import('./jsmind.node.js').Node} node
119
- * @returns {void}
120
- */
121
- toggle_node(node: string | import("./jsmind.node.js").Node): void;
122
- /**
123
- * Expand a node.
124
- * @param {string | import('./jsmind.node.js').Node} node
125
- * @returns {void}
126
- */
127
- expand_node(node: string | import("./jsmind.node.js").Node): void;
128
- /**
129
- * Collapse a node.
130
- * @param {string | import('./jsmind.node.js').Node} node
131
- * @returns {void}
132
- */
133
- collapse_node(node: string | import("./jsmind.node.js").Node): void;
134
- /** Expand all nodes */
135
- expand_all(): void;
136
- /** Collapse all nodes */
137
- collapse_all(): void;
138
- /**
139
- * Expand nodes up to a specified depth level.
140
- * @param {number} depth
141
- */
142
- expand_to_depth(depth: number): void;
143
- /** reset view/layout/data */
144
- _reset(): void;
145
- /**
146
- * Internal show flow.
147
- * @param {object | null} mind
148
- * @param {boolean=} skip_centering
149
- */
150
- _show(mind: object | null, skip_centering?: boolean | undefined): void;
151
- /**
152
- * Show a mind (or example) on the canvas.
153
- * @param {object | null} mind
154
- * @param {boolean=} skip_centering
155
- */
156
- show(mind: object | null, skip_centering?: boolean | undefined): void;
157
- /** @returns {{name:string,author:string,version:string}} */
158
- get_meta(): {
159
- name: string;
160
- author: string;
161
- version: string;
162
- };
163
- /**
164
- * Serialize current mind to given format.
165
- * @param {'node_tree'|'node_array'|'freemind'|'text'} [data_format]
166
- * @returns {object}
167
- */
168
- get_data(data_format?: "node_tree" | "node_array" | "freemind" | "text"): object;
169
- /** @returns {import('./jsmind.node.js').Node} */
170
- get_root(): import("./jsmind.node.js").Node;
171
- /**
172
- * @param {string | import('./jsmind.node.js').Node} node
173
- * @returns {import('./jsmind.node.js').Node}
174
- */
175
- get_node(node: string | import("./jsmind.node.js").Node): import("./jsmind.node.js").Node;
176
- /**
177
- * Add node data to the mind map without triggering UI refresh.
178
- * @private
179
- * @param {import('./jsmind.node.js').Node} parent_node
180
- * @param {string} node_id
181
- * @param {string} topic
182
- * @param {Record<string, any>=} data
183
- * @param {('left'|'center'|'right'|'-1'|'0'|'1'|number)=} direction
184
- * @returns {import('./jsmind.node.js').Node|null}
185
- */
186
- private _add_node_data;
187
- /**
188
- * Refresh UI after node changes.
189
- * @private
190
- * @param {import('./jsmind.node.js').Node} parent_node
191
- */
192
- private _refresh_node_ui;
193
- /**
194
- * Add a new node to the mind map.
195
- * @param {string | import('./jsmind.node.js').Node} parent_node
196
- * @param {string} node_id
197
- * @param {string} topic
198
- * @param {Record<string, any>=} data
199
- * @param {('left'|'center'|'right'|'-1'|'0'|'1'|number)=} direction - Direction for node placement. Supports string values ('left', 'center', 'right'), numeric strings ('-1', '0', '1'), and numbers (-1, 0, 1)
200
- * @returns {import('./jsmind.node.js').Node|null}
201
- */
202
- add_node(parent_node: string | import("./jsmind.node.js").Node, node_id: string, topic: string, data?: Record<string, any> | undefined, direction?: ("left" | "center" | "right" | "-1" | "0" | "1" | number) | undefined): import("./jsmind.node.js").Node | null;
203
- /**
204
- * Add multiple nodes to the mind map with optimized performance.
205
- * Supports standard jsMind formats: node_tree, node_array, and freemind with nested children structure.
206
- * @param {string | import('./jsmind.node.js').Node} parent_node - Parent node for all new nodes
207
- * @param {Array<{id: string, topic: string, data?: Record<string, any>, direction?: ('left'|'center'|'right'|'-1'|'0'|'1'|number), children?: Array}>} nodes_data - Array of node data objects with same format as add_node
208
- * @returns {Array<import('./jsmind.node.js').Node|null>} Array of created nodes (flattened from all levels)
209
- */
210
- add_nodes(parent_node: string | import("./jsmind.node.js").Node, nodes_data: Array<{
211
- id: string;
212
- topic: string;
213
- data?: Record<string, any>;
214
- direction?: ("left" | "center" | "right" | "-1" | "0" | "1" | number);
215
- children?: any[];
216
- }>): Array<import("./jsmind.node.js").Node | null>;
217
- /**
218
- * Recursively add nodes using existing format processors.
219
- * @private
220
- * @param {import('./jsmind.node.js').Node} parent_node
221
- * @param {object} node_data
222
- * @returns {Array<import('./jsmind.node.js').Node|null>}
223
- */
224
- private _add_nodes_recursive;
225
- /**
226
- * Count expected nodes recursively.
227
- * @private
228
- * @param {Array} nodes_data
229
- * @returns {number}
230
- */
231
- private _count_expected_nodes;
232
- /**
233
- * Clean up partially created nodes without triggering UI refresh for each node.
234
- * @private
235
- * @param {Array<import('./jsmind.node.js').Node>} created_nodes
236
- */
237
- private _cleanup_partial_nodes;
238
- /**
239
- * Insert a node before target node.
240
- * @param {string | import('./jsmind.node.js').Node} node_before
241
- * @param {string} node_id
242
- * @param {string} topic
243
- * @param {Record<string, any>=} data
244
- * @param {('left'|'center'|'right'|'-1'|'0'|'1'|number)=} direction - Direction for node placement. Supports string values ('left', 'center', 'right'), numeric strings ('-1', '0', '1'), and numbers (-1, 0, 1)
245
- * @returns {import('./jsmind.node.js').Node|null}
246
- */
247
- insert_node_before(node_before: string | import("./jsmind.node.js").Node, node_id: string, topic: string, data?: Record<string, any> | undefined, direction?: ("left" | "center" | "right" | "-1" | "0" | "1" | number) | undefined): import("./jsmind.node.js").Node | null;
248
- /**
249
- * Insert a node after target node.
250
- * @param {string | import('./jsmind.node.js').Node} node_after
251
- * @param {string} node_id
252
- * @param {string} topic
253
- * @param {Record<string, any>=} data
254
- * @param {('left'|'center'|'right'|'-1'|'0'|'1'|number)=} direction - Direction for node placement. Supports string values ('left', 'center', 'right'), numeric strings ('-1', '0', '1'), and numbers (-1, 0, 1)
255
- * @returns {import('./jsmind.node.js').Node|null}
256
- */
257
- insert_node_after(node_after: string | import("./jsmind.node.js").Node, node_id: string, topic: string, data?: Record<string, any> | undefined, direction?: ("left" | "center" | "right" | "-1" | "0" | "1" | number) | undefined): import("./jsmind.node.js").Node | null;
258
- /**
259
- * Remove a node.
260
- * @param {string | import('./jsmind.node.js').Node} node
261
- * @returns {boolean}
262
- */
263
- remove_node(node: string | import("./jsmind.node.js").Node): boolean;
264
- /**
265
- * Update the topic (text content) of a node.
266
- * @param {string} node_id
267
- * @param {string} topic
268
- */
269
- update_node(node_id: string, topic: string): void;
270
- /**
271
- * Move a node and optionally change direction.
272
- * @param {string} node_id
273
- * @param {string=} before_id - The ID of the node before which to place the moved node. Special values: "_first_", "_last_"
274
- * @param {string=} parent_id
275
- * @param {('left'|'center'|'right'|'-1'|'0'|'1'|number)=} direction - Direction for node placement. Supports string values ('left', 'center', 'right'), numeric strings ('-1', '0', '1'), and numbers (-1, 0, 1). Only effective for second-level nodes (children of root). If not provided, direction will be determined automatically.
276
- */
277
- move_node(node_id: string, before_id?: string | undefined, parent_id?: string | undefined, direction?: ("left" | "center" | "right" | "-1" | "0" | "1" | number) | undefined): void;
278
- /**
279
- * @param {string | import('./jsmind.node.js').Node} node
280
- * @returns {void}
281
- */
282
- select_node(node: string | import("./jsmind.node.js").Node): void;
283
- /** @returns {import('./jsmind.node.js').Node|null} */
284
- get_selected_node(): import("./jsmind.node.js").Node | null;
285
- /** clear selection */
286
- select_clear(): void;
287
- /** @param {string | import('./jsmind.node.js').Node} node */
288
- is_node_visible(node: string | import("./jsmind.node.js").Node): boolean;
289
- /**
290
- * Scroll the mind map to center the specified node.
291
- * @param {string | import('./jsmind.node.js').Node} node
292
- */
293
- scroll_node_to_center(node: string | import("./jsmind.node.js").Node): void;
294
- /**
295
- * Find the previous sibling node of the given node.
296
- *
297
- * @param {string | import('./jsmind.node.js').Node} node - Node id or Node instance
298
- * @returns {import('./jsmind.node.js').Node | null}
299
- */
300
- find_node_before(node: string | import("./jsmind.node.js").Node): import("./jsmind.node.js").Node | null;
301
- /**
302
- * Find the next sibling node of the given node.
303
- * @param {string | import('./jsmind.node.js').Node} node
304
- * @returns {import('./jsmind.node.js').Node | null}
305
- */
306
- find_node_after(node: string | import("./jsmind.node.js").Node): import("./jsmind.node.js").Node | null;
307
- /**
308
- * Set background and foreground colors for a node.
309
- * @param {string} node_id
310
- * @param {string=} bg_color
311
- * @param {string=} fg_color
312
- * @returns {void}
313
- */
314
- set_node_color(node_id: string, bg_color?: string | undefined, fg_color?: string | undefined): void;
315
- /**
316
- * Set font style for a node.
317
- * @param {string} node_id
318
- * @param {number=} size
319
- * @param {string=} weight
320
- * @param {string=} style
321
- * @returns {void}
322
- */
323
- set_node_font_style(node_id: string, size?: number | undefined, weight?: string | undefined, style?: string | undefined): void;
324
- /**
325
- * Set background image for a node.
326
- * @param {string} node_id
327
- * @param {string=} image
328
- * @param {number=} width
329
- * @param {number=} height
330
- * @param {number=} rotation
331
- * @returns {void}
332
- */
333
- set_node_background_image(node_id: string, image?: string | undefined, width?: number | undefined, height?: number | undefined, rotation?: number | undefined): void;
334
- /**
335
- * @param {string} node_id
336
- * @param {number} rotation
337
- * @returns {void}
338
- */
339
- set_node_background_rotation(node_id: string, rotation: number): void;
340
- /** trigger view resize */
341
- resize(): void;
342
- /** @param {(type:number, data: EventData)=>void} callback */
343
- add_event_listener(callback: (type: number, data: EventData) => void): void;
344
- /** clear event listeners */
345
- clear_event_listener(): void;
346
- /** @param {number} type @param {EventData} data */
347
- invoke_event_handle(type: number, data: EventData): void;
348
- /** @param {number} type @param {EventData} data */
349
- _invoke_event_handle(type: number, data: EventData): void;
350
- }
351
- /**
352
- * Event callback payload
353
- */
354
- export type EventData = {
355
- evt?: string;
356
- data?: unknown[];
357
- node?: string;
358
- };
359
- import { Mind } from './jsmind.mind.js';
360
- import { DataProvider } from './jsmind.data_provider.js';
361
- import { LayoutProvider } from './jsmind.layout_provider.js';
362
- import { ViewProvider } from './jsmind.view_provider.js';
363
- import { ShortcutProvider } from './jsmind.shortcut_provider.js';
364
- import { Node } from './jsmind.node.js';
365
- import { Plugin } from './jsmind.plugin.js';
366
- import { register as _register_plugin } from './jsmind.plugin.js';
@@ -1,56 +0,0 @@
1
- export class DataProvider {
2
- /**
3
- * Data provider: loads and serializes mind data by format.
4
- * @param {import('./jsmind.js').default} jm - jsMind instance
5
- */
6
- constructor(jm: import("./jsmind.js").default);
7
- jm: import("./jsmind.js").default;
8
- /** Initialize data provider. */
9
- init(): void;
10
- /** Reset data provider state. */
11
- reset(): void;
12
- /**
13
- * Load a Mind from mixed source.
14
- * @param {import('./jsmind.format.js').NodeTreeFormat|import('./jsmind.format.js').NodeArrayFormat|{meta?:{name:string,author:string,version:string},format:'freemind',data:string}|{meta?:{name:string,author:string,version:string},format:'text',data:string}} mind_data - object with {format,data} or a format-specific payload
15
- * @returns {import('./jsmind.mind.js').Mind|null}
16
- */
17
- load(mind_data: import("./jsmind.format.js").NodeTreeFormat | import("./jsmind.format.js").NodeArrayFormat | {
18
- meta?: {
19
- name: string;
20
- author: string;
21
- version: string;
22
- };
23
- format: "freemind";
24
- data: string;
25
- } | {
26
- meta?: {
27
- name: string;
28
- author: string;
29
- version: string;
30
- };
31
- format: "text";
32
- data: string;
33
- }): import("./jsmind.mind.js").Mind | null;
34
- /**
35
- * Serialize current mind to target format.
36
- * @param {'node_tree'|'node_array'|'freemind'|'text'} data_format
37
- * @returns {import('./jsmind.format.js').NodeTreeFormat|import('./jsmind.format.js').NodeArrayFormat|{meta:{name:string,author:string,version:string},format:'freemind',data:string}|{meta:{name:string,author:string,version:string},format:'text',data:string}}
38
- */
39
- get_data(data_format: "node_tree" | "node_array" | "freemind" | "text"): import("./jsmind.format.js").NodeTreeFormat | import("./jsmind.format.js").NodeArrayFormat | {
40
- meta: {
41
- name: string;
42
- author: string;
43
- version: string;
44
- };
45
- format: "freemind";
46
- data: string;
47
- } | {
48
- meta: {
49
- name: string;
50
- author: string;
51
- version: string;
52
- };
53
- format: "text";
54
- data: string;
55
- };
56
- }
@@ -1,59 +0,0 @@
1
- export const $: Dom;
2
- /**
3
- * @license BSD
4
- * @copyright 2014-2025 hizzgdev@163.com
5
- *
6
- * Project Home:
7
- * https://github.com/hizzgdev/jsmind/
8
- */
9
- /**
10
- * Lightweight DOM helpers bound to a window.
11
- */
12
- declare class Dom {
13
- /**
14
- * @param {Window} w
15
- */
16
- constructor(w: Window);
17
- /** @type {Window} */
18
- w: Window;
19
- /** @type {Document} */
20
- d: Document;
21
- /**
22
- * Get element by id.
23
- * @param {string} id
24
- * @returns {HTMLElement|null}
25
- */
26
- g: (id: string) => HTMLElement | null;
27
- /**
28
- * Create element with given tag.
29
- * @param {string} tag
30
- * @returns {HTMLElement}
31
- */
32
- c: (tag: string) => HTMLElement;
33
- /**
34
- * Set text content for element.
35
- * @param {HTMLElement} n
36
- * @param {string} t
37
- */
38
- t: (n: HTMLElement, t: string) => void;
39
- /**
40
- * Set inner HTML or append element.
41
- * @param {HTMLElement} n
42
- * @param {string|HTMLElement} t
43
- */
44
- h: (n: HTMLElement, t: string | HTMLElement) => void;
45
- /**
46
- * Runtime check for HTMLElement.
47
- * @param {unknown} el
48
- * @returns {el is HTMLElement}
49
- */
50
- i: (el: unknown) => el is HTMLElement;
51
- /**
52
- * Add event listener with legacy fallback.
53
- * @param {HTMLElement} t
54
- * @param {string} e
55
- * @param {(ev:Event)=>void} h
56
- */
57
- on: (t: HTMLElement, e: string, h: (ev: Event) => void) => void;
58
- }
59
- export {};
@@ -1,100 +0,0 @@
1
- /**
2
- * Mind data format handlers.
3
- * @type {{
4
- * node_tree: { example:NodeTreeFormat, get_mind:(src:NodeTreeFormat)=>Mind, get_data:(mind:Mind)=>NodeTreeFormat },
5
- * node_array: { example:NodeArrayFormat, get_mind:(src:NodeArrayFormat)=>Mind, get_data:(mind:Mind)=>NodeArrayFormat },
6
- * freemind: { example:{meta:MindMapMeta,format:'freemind',data:string}, get_mind:(src:{meta?:MindMapMeta,format:'freemind',data:string})=>Mind, get_data:(mind:Mind)=>{meta:MindMapMeta,format:'freemind',data:string} },
7
- * text: { example:{meta:MindMapMeta,format:'text',data:string}, get_mind:(src:{meta?:MindMapMeta,format:'text',data:string})=>Mind, get_data:(mind:Mind)=>{meta:MindMapMeta,format:'text',data:string} }
8
- * }}
9
- */
10
- export const format: {
11
- node_tree: {
12
- example: NodeTreeFormat;
13
- get_mind: (src: NodeTreeFormat) => Mind;
14
- get_data: (mind: Mind) => NodeTreeFormat;
15
- };
16
- node_array: {
17
- example: NodeArrayFormat;
18
- get_mind: (src: NodeArrayFormat) => Mind;
19
- get_data: (mind: Mind) => NodeArrayFormat;
20
- };
21
- freemind: {
22
- example: {
23
- meta: MindMapMeta;
24
- format: "freemind";
25
- data: string;
26
- };
27
- get_mind: (src: {
28
- meta?: MindMapMeta;
29
- format: "freemind";
30
- data: string;
31
- }) => Mind;
32
- get_data: (mind: Mind) => {
33
- meta: MindMapMeta;
34
- format: "freemind";
35
- data: string;
36
- };
37
- };
38
- text: {
39
- example: {
40
- meta: MindMapMeta;
41
- format: "text";
42
- data: string;
43
- };
44
- get_mind: (src: {
45
- meta?: MindMapMeta;
46
- format: "text";
47
- data: string;
48
- }) => Mind;
49
- get_data: (mind: Mind) => {
50
- meta: MindMapMeta;
51
- format: "text";
52
- data: string;
53
- };
54
- };
55
- };
56
- export type MindMapMeta = {
57
- name: string;
58
- author: string;
59
- version: string;
60
- };
61
- /**
62
- * Node tree data item
63
- */
64
- export type NodeTreeData = {
65
- id: string;
66
- topic: string;
67
- data?: Record<string, any>;
68
- direction?: (number | string);
69
- expanded?: boolean;
70
- children?: NodeTreeData[];
71
- };
72
- /**
73
- * Node tree formatted payload
74
- */
75
- export type NodeTreeFormat = {
76
- meta?: MindMapMeta;
77
- format: "node_tree";
78
- data: NodeTreeData;
79
- };
80
- /**
81
- * Node array data item
82
- */
83
- export type NodeArrayItem = {
84
- id: string;
85
- topic: string;
86
- parentid?: string;
87
- data?: Record<string, any>;
88
- direction?: (number | string);
89
- expanded?: boolean;
90
- isroot?: boolean;
91
- };
92
- /**
93
- * Node array formatted payload
94
- */
95
- export type NodeArrayFormat = {
96
- meta?: MindMapMeta;
97
- format: "node_array";
98
- data: NodeArrayItem[];
99
- };
100
- import { Mind } from './jsmind.mind.js';