@umbraci/jsmind 0.10.14 → 0.10.17
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 +24 -24
- package/README.md +116 -116
- package/dist/jsmind.copy-paste.js +9 -0
- package/dist/jsmind.copy-paste.js.map +1 -0
- package/dist/jsmind.draggable-node.js +1 -1
- package/dist/jsmind.draggable-node.js.map +1 -1
- package/dist/jsmind.history.js +1 -1
- package/dist/jsmind.history.js.map +1 -1
- package/dist/jsmind.js +1 -1
- package/dist/jsmind.js.map +1 -1
- package/dist/jsmind.multi-select.js +1 -1
- package/dist/jsmind.multi-select.js.map +1 -1
- package/dist/jsmind.multiline-text.js +1 -1
- package/dist/jsmind.multiline-text.js.map +1 -1
- package/dist/jsmind.screenshot.js +1 -1
- package/dist/jsmind.screenshot.js.map +1 -1
- package/es/jsmind.copy-paste.js +9 -0
- package/es/jsmind.copy-paste.js.map +1 -0
- package/es/jsmind.draggable-node.js +1 -1
- package/es/jsmind.draggable-node.js.map +1 -1
- package/es/jsmind.history.js +1 -1
- package/es/jsmind.history.js.map +1 -1
- package/es/jsmind.js +1 -1
- package/es/jsmind.js.map +1 -1
- package/es/jsmind.multi-select.js +1 -1
- package/es/jsmind.multi-select.js.map +1 -1
- package/es/jsmind.multiline-text.js +1 -1
- package/es/jsmind.multiline-text.js.map +1 -1
- package/es/jsmind.screenshot.js +1 -1
- package/es/jsmind.screenshot.js.map +1 -1
- package/lib/jsmind.copy-paste.js +9 -0
- package/lib/jsmind.copy-paste.js.map +1 -0
- package/lib/jsmind.draggable-node.js +1 -1
- package/lib/jsmind.draggable-node.js.map +1 -1
- package/lib/jsmind.history.js +1 -1
- package/lib/jsmind.history.js.map +1 -1
- package/lib/jsmind.js +1 -1
- package/lib/jsmind.js.map +1 -1
- package/lib/jsmind.multi-select.js +1 -1
- package/lib/jsmind.multi-select.js.map +1 -1
- package/lib/jsmind.multiline-text.js +1 -1
- package/lib/jsmind.multiline-text.js.map +1 -1
- package/lib/jsmind.screenshot.js +1 -1
- package/lib/jsmind.screenshot.js.map +1 -1
- package/package.json +115 -115
- package/style/jsmind.css +408 -408
- package/types/generated/index.d.ts +8 -0
- package/types/generated/jsmind.common.d.ts +68 -0
- package/types/generated/jsmind.d.ts +438 -0
- package/types/generated/jsmind.data_provider.d.ts +56 -0
- package/types/generated/jsmind.dom.d.ts +59 -0
- package/types/generated/jsmind.enhanced-plugin.d.ts +103 -0
- package/types/generated/jsmind.format.d.ts +113 -0
- package/types/generated/jsmind.graph.d.ts +180 -0
- package/types/generated/jsmind.layout_provider.d.ts +182 -0
- package/types/generated/jsmind.mind.d.ts +121 -0
- package/types/generated/jsmind.node.d.ts +69 -0
- package/types/generated/jsmind.option.d.ts +73 -0
- package/types/generated/jsmind.plugin.d.ts +21 -0
- package/types/generated/jsmind.shortcut_provider.d.ts +52 -0
- package/types/generated/jsmind.util.d.ts +26 -0
- package/types/generated/jsmind.view_provider.d.ts +347 -0
- package/types/generated/plugins/history/history-diff.d.ts +297 -0
- package/types/generated/plugins/history/jsmind.history.d.ts +87 -0
- package/types/generated/plugins/jsmind.draggable-node.d.ts +262 -0
- package/types/generated/plugins/jsmind.multi-select.d.ts +238 -0
- package/types/generated/plugins/jsmind.multiline-text-v2.d.ts +58 -0
- package/types/generated/plugins/jsmind.multiline-text.d.ts +43 -0
- package/types/generated/plugins/jsmind.screenshot.d.ts +83 -0
- package/types/tsconfig.declaration.json +19 -19
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default } from './jsmind';
|
|
2
|
+
export { Node } from './jsmind.node';
|
|
3
|
+
export { Mind } from './jsmind.mind';
|
|
4
|
+
export type { JsMindRuntimeOptions as JsMindOptions } from './jsmind.option';
|
|
5
|
+
export type { MindMapMeta, NodeTreeData, NodeTreeFormat, NodeArrayItem, NodeArrayFormat, } from './jsmind.format';
|
|
6
|
+
export { Direction as direction, EventType as event_type } from './jsmind.common';
|
|
7
|
+
export { $ } from './jsmind.dom';
|
|
8
|
+
export { util } from './jsmind.util';
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license BSD
|
|
3
|
+
* @copyright 2014-2025 UmbraCi
|
|
4
|
+
*
|
|
5
|
+
* Project Home:
|
|
6
|
+
* https://github.com/UmbraCi/jsmind/
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Library version string.
|
|
10
|
+
* @type {string}
|
|
11
|
+
*/
|
|
12
|
+
export const __version__: string;
|
|
13
|
+
/**
|
|
14
|
+
* Library author.
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
export const __author__: string;
|
|
18
|
+
/**
|
|
19
|
+
* Direction constants and parser.
|
|
20
|
+
* @typedef {{left:number,center:number,right:number,of:(dir:(string|number))=>number|undefined}} DirectionType
|
|
21
|
+
*/
|
|
22
|
+
/** @type {DirectionType} */
|
|
23
|
+
export const Direction: DirectionType;
|
|
24
|
+
export type EventType = number;
|
|
25
|
+
export namespace EventType {
|
|
26
|
+
let show: number;
|
|
27
|
+
let resize: number;
|
|
28
|
+
let edit: number;
|
|
29
|
+
let select: number;
|
|
30
|
+
let reset: number;
|
|
31
|
+
let history_change: number;
|
|
32
|
+
}
|
|
33
|
+
export type Key = number;
|
|
34
|
+
export namespace Key {
|
|
35
|
+
let meta: number;
|
|
36
|
+
let ctrl: number;
|
|
37
|
+
let alt: number;
|
|
38
|
+
let shift: number;
|
|
39
|
+
}
|
|
40
|
+
export type LogLevel = number;
|
|
41
|
+
export namespace LogLevel {
|
|
42
|
+
let debug: number;
|
|
43
|
+
let info: number;
|
|
44
|
+
let warn: number;
|
|
45
|
+
let error: number;
|
|
46
|
+
let disable: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Logger facade with dynamic level.
|
|
50
|
+
* @type {{level:(lvl:number)=>void,log:Function,debug:Function,info:Function,warn:Function,error:Function}}
|
|
51
|
+
*/
|
|
52
|
+
export let logger: {
|
|
53
|
+
level: (lvl: number) => void;
|
|
54
|
+
log: Function;
|
|
55
|
+
debug: Function;
|
|
56
|
+
info: Function;
|
|
57
|
+
warn: Function;
|
|
58
|
+
error: Function;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Direction constants and parser.
|
|
62
|
+
*/
|
|
63
|
+
export type DirectionType = {
|
|
64
|
+
left: number;
|
|
65
|
+
center: number;
|
|
66
|
+
right: number;
|
|
67
|
+
of: (dir: (string | number)) => number | undefined;
|
|
68
|
+
};
|
|
@@ -0,0 +1,438 @@
|
|
|
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
|
+
declare 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
|
+
reset: number;
|
|
18
|
+
history_change: number;
|
|
19
|
+
};
|
|
20
|
+
static $: {
|
|
21
|
+
w: Window;
|
|
22
|
+
d: Document;
|
|
23
|
+
g: (id: string) => HTMLElement | null;
|
|
24
|
+
c: (tag: string) => HTMLElement;
|
|
25
|
+
t: (n: HTMLElement, t: string) => void;
|
|
26
|
+
h: (n: HTMLElement, t: string | HTMLElement) => void;
|
|
27
|
+
i: (el: unknown) => el is HTMLElement;
|
|
28
|
+
on: (t: HTMLElement, e: string, h: (ev: Event) => void) => void;
|
|
29
|
+
};
|
|
30
|
+
static plugin: typeof Plugin;
|
|
31
|
+
static register_plugin: typeof _register_plugin;
|
|
32
|
+
static util: {
|
|
33
|
+
file: {
|
|
34
|
+
read: (file: File, cb: (result: string, name: string) => void) => void;
|
|
35
|
+
save: (data: string, type: string, name: string) => void;
|
|
36
|
+
};
|
|
37
|
+
json: {
|
|
38
|
+
json2string: (v: unknown) => string;
|
|
39
|
+
string2json: (s: string) => unknown;
|
|
40
|
+
merge: (b: object, a: object) => object;
|
|
41
|
+
};
|
|
42
|
+
uuid: {
|
|
43
|
+
newid: () => string;
|
|
44
|
+
};
|
|
45
|
+
text: {
|
|
46
|
+
is_empty: (s?: string) => boolean;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
static enhanced_plugin: typeof EnhancedPlugin;
|
|
50
|
+
/** @type {Array<import('./jsmind.enhanced-plugin.js').PluginDescriptor>} */
|
|
51
|
+
static enhancedPluginList: Array<import("./jsmind.enhanced-plugin.js").PluginDescriptor>;
|
|
52
|
+
/**
|
|
53
|
+
* Register an enhanced plugin
|
|
54
|
+
* @param {typeof EnhancedPlugin} PluginClass - Plugin class
|
|
55
|
+
* @param {object} [options={}] - Plugin options
|
|
56
|
+
* @returns {typeof jsMind}
|
|
57
|
+
*/
|
|
58
|
+
static usePlugin(PluginClass: typeof EnhancedPlugin, options?: object): typeof jsMind;
|
|
59
|
+
/**
|
|
60
|
+
* Check if an enhanced plugin is registered
|
|
61
|
+
* @param {typeof EnhancedPlugin} PluginClass - Plugin class
|
|
62
|
+
* @returns {boolean}
|
|
63
|
+
*/
|
|
64
|
+
static hasEnhancedPlugin(PluginClass: typeof EnhancedPlugin): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Deprecated: static show constructor helper.
|
|
67
|
+
* @param {import('./jsmind.option.js').JsMindRuntimeOptions} options
|
|
68
|
+
* @param {object | null} mind
|
|
69
|
+
* @returns {jsMind}
|
|
70
|
+
*/
|
|
71
|
+
static show(options: import("./jsmind.option.js").JsMindRuntimeOptions, mind: object | null): jsMind;
|
|
72
|
+
/**
|
|
73
|
+
* Create a jsMind instance.
|
|
74
|
+
* @param {import('./jsmind.option.js').JsMindRuntimeOptions} options
|
|
75
|
+
*/
|
|
76
|
+
constructor(options: import("./jsmind.option.js").JsMindRuntimeOptions);
|
|
77
|
+
options: import("./jsmind.option.js").JsMindRuntimeOptions;
|
|
78
|
+
version: string;
|
|
79
|
+
initialized: boolean;
|
|
80
|
+
mind: Mind;
|
|
81
|
+
/** @type {Array<(type: number, data: EventData) => void>} */
|
|
82
|
+
event_handles: Array<(type: number, data: EventData) => void>;
|
|
83
|
+
/** Initialize sub-systems and plugins. */
|
|
84
|
+
init(): void;
|
|
85
|
+
enhancedPluginManager: EnhancedPluginManager;
|
|
86
|
+
data: DataProvider;
|
|
87
|
+
layout: LayoutProvider;
|
|
88
|
+
view: ViewProvider;
|
|
89
|
+
shortcut: ShortcutProvider;
|
|
90
|
+
/** @returns {boolean} whether current mind map is editable */
|
|
91
|
+
get_editable(): boolean;
|
|
92
|
+
/** enable editing */
|
|
93
|
+
enable_edit(): void;
|
|
94
|
+
/** disable editing */
|
|
95
|
+
disable_edit(): void;
|
|
96
|
+
/** @returns {boolean} whether view is draggable */
|
|
97
|
+
get_view_draggable(): boolean;
|
|
98
|
+
/** enable view dragging */
|
|
99
|
+
enable_view_draggable(): void;
|
|
100
|
+
/** disable view dragging */
|
|
101
|
+
disable_view_draggable(): void;
|
|
102
|
+
/**
|
|
103
|
+
* Enable default event handle.
|
|
104
|
+
* @param {'mousedown'|'click'|'dblclick'|'mousewheel'} event_handle
|
|
105
|
+
*/
|
|
106
|
+
enable_event_handle(event_handle: "mousedown" | "click" | "dblclick" | "mousewheel"): void;
|
|
107
|
+
/**
|
|
108
|
+
* Disable default event handle.
|
|
109
|
+
* @param {'mousedown'|'click'|'dblclick'|'mousewheel'} event_handle
|
|
110
|
+
*/
|
|
111
|
+
disable_event_handle(event_handle: "mousedown" | "click" | "dblclick" | "mousewheel"): void;
|
|
112
|
+
/**
|
|
113
|
+
* Set theme name.
|
|
114
|
+
* @param {string|null=} theme
|
|
115
|
+
*/
|
|
116
|
+
set_theme(theme?: (string | null) | undefined): void;
|
|
117
|
+
/** bind internal DOM events */
|
|
118
|
+
_event_bind(): void;
|
|
119
|
+
/** @param {MouseEvent} e */
|
|
120
|
+
mousedown_handle(e: MouseEvent): void;
|
|
121
|
+
/** @param {MouseEvent} e */
|
|
122
|
+
click_handle(e: MouseEvent): void;
|
|
123
|
+
/** @param {MouseEvent} e */
|
|
124
|
+
dblclick_handle(e: MouseEvent): void;
|
|
125
|
+
/** @param {WheelEvent} e */
|
|
126
|
+
mousewheel_handle(e: WheelEvent): void;
|
|
127
|
+
/**
|
|
128
|
+
* Begin editing a node.
|
|
129
|
+
* @param {string | import('./jsmind.node.js').Node} node
|
|
130
|
+
* @returns {boolean|void}
|
|
131
|
+
*/
|
|
132
|
+
begin_edit(node: string | import("./jsmind.node.js").Node): boolean | void;
|
|
133
|
+
/** End editing */
|
|
134
|
+
end_edit(): void;
|
|
135
|
+
/**
|
|
136
|
+
* Toggle a node's expanded state.
|
|
137
|
+
* @param {string | import('./jsmind.node.js').Node} node
|
|
138
|
+
* @returns {void}
|
|
139
|
+
*/
|
|
140
|
+
toggle_node(node: string | import("./jsmind.node.js").Node): void;
|
|
141
|
+
/**
|
|
142
|
+
* Expand a node.
|
|
143
|
+
* @param {string | import('./jsmind.node.js').Node} node
|
|
144
|
+
* @returns {void}
|
|
145
|
+
*/
|
|
146
|
+
expand_node(node: string | import("./jsmind.node.js").Node): void;
|
|
147
|
+
/**
|
|
148
|
+
* Collapse a node.
|
|
149
|
+
* @param {string | import('./jsmind.node.js').Node} node
|
|
150
|
+
* @returns {void}
|
|
151
|
+
*/
|
|
152
|
+
collapse_node(node: string | import("./jsmind.node.js").Node): void;
|
|
153
|
+
/** Expand all nodes */
|
|
154
|
+
expand_all(): void;
|
|
155
|
+
/** Collapse all nodes */
|
|
156
|
+
collapse_all(): void;
|
|
157
|
+
/**
|
|
158
|
+
* Expand nodes up to a specified depth level.
|
|
159
|
+
* @param {number} depth
|
|
160
|
+
*/
|
|
161
|
+
expand_to_depth(depth: number): void;
|
|
162
|
+
/** reset view/layout/data */
|
|
163
|
+
_reset(): void;
|
|
164
|
+
/**
|
|
165
|
+
* Internal show flow.
|
|
166
|
+
* @param {object | null} mind
|
|
167
|
+
* @param {boolean=} skip_centering
|
|
168
|
+
*/
|
|
169
|
+
_show(mind: object | null, skip_centering?: boolean | undefined): void;
|
|
170
|
+
/**
|
|
171
|
+
* Show a mind (or example) on the canvas.
|
|
172
|
+
* @param {object | null} mind
|
|
173
|
+
* @param {boolean=} skip_centering
|
|
174
|
+
*/
|
|
175
|
+
show(mind: object | null, skip_centering?: boolean | undefined): void;
|
|
176
|
+
/** @returns {{name:string,author:string,version:string}} */
|
|
177
|
+
get_meta(): {
|
|
178
|
+
name: string;
|
|
179
|
+
author: string;
|
|
180
|
+
version: string;
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Serialize current mind to given format.
|
|
184
|
+
* @param {'node_tree'|'node_array'|'freemind'|'text'} [data_format]
|
|
185
|
+
* @returns {object}
|
|
186
|
+
*/
|
|
187
|
+
get_data(data_format?: "node_tree" | "node_array" | "freemind" | "text"): object;
|
|
188
|
+
/** @returns {import('./jsmind.node.js').Node} */
|
|
189
|
+
get_root(): import("./jsmind.node.js").Node;
|
|
190
|
+
/**
|
|
191
|
+
* @param {string | import('./jsmind.node.js').Node} node
|
|
192
|
+
* @returns {import('./jsmind.node.js').Node}
|
|
193
|
+
*/
|
|
194
|
+
get_node(node: string | import("./jsmind.node.js").Node): import("./jsmind.node.js").Node;
|
|
195
|
+
/**
|
|
196
|
+
* Get the level/depth of a node in the mind map.
|
|
197
|
+
* @param {string | import('./jsmind.node.js').Node} node - Node id or Node instance
|
|
198
|
+
* @returns {number} Node level (root node is 0, its children are 1, etc.)
|
|
199
|
+
*/
|
|
200
|
+
get_node_level(node: string | import("./jsmind.node.js").Node): number;
|
|
201
|
+
/**
|
|
202
|
+
* Add node data to the mind map without triggering UI refresh.
|
|
203
|
+
* @private
|
|
204
|
+
* @param {import('./jsmind.node.js').Node} parent_node
|
|
205
|
+
* @param {string} node_id
|
|
206
|
+
* @param {string} topic
|
|
207
|
+
* @param {Record<string, any>=} data
|
|
208
|
+
* @param {('left'|'center'|'right'|'-1'|'0'|'1'|number)=} direction
|
|
209
|
+
* @returns {import('./jsmind.node.js').Node|null}
|
|
210
|
+
*/
|
|
211
|
+
private _add_node_data;
|
|
212
|
+
/**
|
|
213
|
+
* Refresh UI after node changes.
|
|
214
|
+
* @private
|
|
215
|
+
* @param {import('./jsmind.node.js').Node} parent_node
|
|
216
|
+
*/
|
|
217
|
+
private _refresh_node_ui;
|
|
218
|
+
/**
|
|
219
|
+
* Add a new node to the mind map.
|
|
220
|
+
* @param {string | import('./jsmind.node.js').Node} parent_node
|
|
221
|
+
* @param {string} node_id
|
|
222
|
+
* @param {string} topic
|
|
223
|
+
* @param {Record<string, any>=} data
|
|
224
|
+
* @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)
|
|
225
|
+
* @returns {import('./jsmind.node.js').Node|null}
|
|
226
|
+
*/
|
|
227
|
+
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;
|
|
228
|
+
/**
|
|
229
|
+
* Add multiple nodes in batch.
|
|
230
|
+
*
|
|
231
|
+
* This method provides atomic batch node creation with automatic rollback on failure.
|
|
232
|
+
* All nodes are created in a single operation, and if any node fails to create,
|
|
233
|
+
* all previously created nodes in this batch will be automatically removed.
|
|
234
|
+
*
|
|
235
|
+
* **Note**: This is a batch operation API that uses standard field names only.
|
|
236
|
+
* For data import with custom fieldNames, use `show()` instead.
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* // Using standard field names
|
|
240
|
+
* jm.add_nodes('parent_id', [
|
|
241
|
+
* { id: 'node1', topic: 'Node 1', data: { color: 'red' }, children: [
|
|
242
|
+
* { id: 'node1-1', topic: 'Child 1' }
|
|
243
|
+
* ]}
|
|
244
|
+
* ]);
|
|
245
|
+
*
|
|
246
|
+
* @param {string | import('./jsmind.node.js').Node} parent_node - Parent node for all new nodes
|
|
247
|
+
* @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 standard field names (id, topic, children, data, direction)
|
|
248
|
+
* @returns {Array<import('./jsmind.node.js').Node|null>} Array of created nodes (flattened from all levels)
|
|
249
|
+
*/
|
|
250
|
+
add_nodes(parent_node: string | import("./jsmind.node.js").Node, nodes_data: Array<{
|
|
251
|
+
id: string;
|
|
252
|
+
topic: string;
|
|
253
|
+
data?: Record<string, any>;
|
|
254
|
+
direction?: ("left" | "center" | "right" | "-1" | "0" | "1" | number);
|
|
255
|
+
children?: any[];
|
|
256
|
+
}>): Array<import("./jsmind.node.js").Node | null>;
|
|
257
|
+
/**
|
|
258
|
+
* Recursively add nodes using standard field names.
|
|
259
|
+
* This is a batch operation API that uses standard field names only.
|
|
260
|
+
* For data import with custom fieldNames, use `show()` instead.
|
|
261
|
+
* @private
|
|
262
|
+
* @param {import('./jsmind.node.js').Node} parent_node
|
|
263
|
+
* @param {object} node_data - Node data object with standard field names (id, topic, children, data, direction)
|
|
264
|
+
* @returns {Array<import('./jsmind.node.js').Node|null>}
|
|
265
|
+
*/
|
|
266
|
+
private _add_nodes_recursive;
|
|
267
|
+
/**
|
|
268
|
+
* Count expected nodes recursively.
|
|
269
|
+
* Supports custom field names via options.fieldNames configuration.
|
|
270
|
+
* @private
|
|
271
|
+
* @param {Array} nodes_data
|
|
272
|
+
* @returns {number}
|
|
273
|
+
*/
|
|
274
|
+
private _count_expected_nodes;
|
|
275
|
+
/**
|
|
276
|
+
* Clean up partially created nodes without triggering UI refresh for each node.
|
|
277
|
+
* @private
|
|
278
|
+
* @param {Array<import('./jsmind.node.js').Node>} created_nodes
|
|
279
|
+
*/
|
|
280
|
+
private _cleanup_partial_nodes;
|
|
281
|
+
/**
|
|
282
|
+
* Insert a node before target node.
|
|
283
|
+
* @param {string | import('./jsmind.node.js').Node} node_before
|
|
284
|
+
* @param {string} node_id
|
|
285
|
+
* @param {string} topic
|
|
286
|
+
* @param {Record<string, any>=} data
|
|
287
|
+
* @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)
|
|
288
|
+
* @returns {import('./jsmind.node.js').Node|null}
|
|
289
|
+
*/
|
|
290
|
+
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;
|
|
291
|
+
/**
|
|
292
|
+
* Insert a node after target node.
|
|
293
|
+
* @param {string | import('./jsmind.node.js').Node} node_after
|
|
294
|
+
* @param {string} node_id
|
|
295
|
+
* @param {string} topic
|
|
296
|
+
* @param {Record<string, any>=} data
|
|
297
|
+
* @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)
|
|
298
|
+
* @returns {import('./jsmind.node.js').Node|null}
|
|
299
|
+
*/
|
|
300
|
+
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;
|
|
301
|
+
/**
|
|
302
|
+
* Remove a node.
|
|
303
|
+
* @param {string | import('./jsmind.node.js').Node} node
|
|
304
|
+
* @returns {boolean}
|
|
305
|
+
*/
|
|
306
|
+
remove_node(node: string | import("./jsmind.node.js").Node): boolean;
|
|
307
|
+
/**
|
|
308
|
+
* Update node topic text or multiple node properties.
|
|
309
|
+
* @param {string} node_id - The ID of the node to update
|
|
310
|
+
* @param {string|Partial<Pick<import('./jsmind.node.js').Node, 'topic' | 'data' | 'id' | 'index' | 'expanded' | 'direction'>>} topic_or_updates - Topic string for backward compatibility, or partial Node object for comprehensive updates
|
|
311
|
+
*/
|
|
312
|
+
update_node(node_id: string, topic_or_updates: string | Partial<Pick<import("./jsmind.node.js").Node, "topic" | "data" | "id" | "index" | "expanded" | "direction">>): void;
|
|
313
|
+
/**
|
|
314
|
+
* Move a node and optionally change direction.
|
|
315
|
+
* @param {string} node_id
|
|
316
|
+
* @param {string=} before_id - The ID of the node before which to place the moved node. Special values: "_first_", "_last_"
|
|
317
|
+
* @param {string=} parent_id
|
|
318
|
+
* @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.
|
|
319
|
+
*/
|
|
320
|
+
move_node(node_id: string, before_id?: string | undefined, parent_id?: string | undefined, direction?: ("left" | "center" | "right" | "-1" | "0" | "1" | number) | undefined): void;
|
|
321
|
+
/**
|
|
322
|
+
* @param {string | import('./jsmind.node.js').Node} node
|
|
323
|
+
* @returns {void}
|
|
324
|
+
*/
|
|
325
|
+
select_node(node: string | import("./jsmind.node.js").Node): void;
|
|
326
|
+
/**
|
|
327
|
+
* Get the currently selected node.
|
|
328
|
+
*
|
|
329
|
+
* This is a query API that returns the internal Node instance.
|
|
330
|
+
* For data export with custom fieldNames, use `get_data()` instead.
|
|
331
|
+
*
|
|
332
|
+
* @returns {import('./jsmind.node.js').Node|null} Node instance or null
|
|
333
|
+
*/
|
|
334
|
+
get_selected_node(): import("./jsmind.node.js").Node | null;
|
|
335
|
+
/** clear selection */
|
|
336
|
+
select_clear(): void;
|
|
337
|
+
/** @param {string | import('./jsmind.node.js').Node} node */
|
|
338
|
+
is_node_visible(node: string | import("./jsmind.node.js").Node): boolean;
|
|
339
|
+
/**
|
|
340
|
+
* Scroll the mind map to center the specified node.
|
|
341
|
+
* @param {string | import('./jsmind.node.js').Node} node
|
|
342
|
+
*/
|
|
343
|
+
scroll_node_to_center(node: string | import("./jsmind.node.js").Node): void;
|
|
344
|
+
/**
|
|
345
|
+
* Find the previous sibling node of the given node.
|
|
346
|
+
*
|
|
347
|
+
* @param {string | import('./jsmind.node.js').Node} node - Node id or Node instance
|
|
348
|
+
* @returns {import('./jsmind.node.js').Node | null}
|
|
349
|
+
*/
|
|
350
|
+
find_node_before(node: string | import("./jsmind.node.js").Node): import("./jsmind.node.js").Node | null;
|
|
351
|
+
/**
|
|
352
|
+
* Find the next sibling node of the given node.
|
|
353
|
+
* @param {string | import('./jsmind.node.js').Node} node
|
|
354
|
+
* @returns {import('./jsmind.node.js').Node | null}
|
|
355
|
+
*/
|
|
356
|
+
find_node_after(node: string | import("./jsmind.node.js").Node): import("./jsmind.node.js").Node | null;
|
|
357
|
+
/**
|
|
358
|
+
* Set background and foreground colors for a node.
|
|
359
|
+
* @param {string} node_id
|
|
360
|
+
* @param {string=} bg_color
|
|
361
|
+
* @param {string=} fg_color
|
|
362
|
+
* @returns {void}
|
|
363
|
+
*/
|
|
364
|
+
set_node_color(node_id: string, bg_color?: string | undefined, fg_color?: string | undefined): void;
|
|
365
|
+
/**
|
|
366
|
+
* Set font style for a node.
|
|
367
|
+
* @param {string} node_id
|
|
368
|
+
* @param {number=} size
|
|
369
|
+
* @param {string=} weight
|
|
370
|
+
* @param {string=} style
|
|
371
|
+
* @returns {void}
|
|
372
|
+
*/
|
|
373
|
+
set_node_font_style(node_id: string, size?: number | undefined, weight?: string | undefined, style?: string | undefined): void;
|
|
374
|
+
/**
|
|
375
|
+
* Set background image for a node.
|
|
376
|
+
* @param {string} node_id
|
|
377
|
+
* @param {string=} image
|
|
378
|
+
* @param {number=} width
|
|
379
|
+
* @param {number=} height
|
|
380
|
+
* @param {number=} rotation
|
|
381
|
+
* @returns {void}
|
|
382
|
+
*/
|
|
383
|
+
set_node_background_image(node_id: string, image?: string | undefined, width?: number | undefined, height?: number | undefined, rotation?: number | undefined): void;
|
|
384
|
+
/**
|
|
385
|
+
* @param {string} node_id
|
|
386
|
+
* @param {number} rotation
|
|
387
|
+
* @returns {void}
|
|
388
|
+
*/
|
|
389
|
+
set_node_background_rotation(node_id: string, rotation: number): void;
|
|
390
|
+
/** trigger view resize */
|
|
391
|
+
resize(): void;
|
|
392
|
+
/** @param {(type:number, data: EventData)=>void} callback */
|
|
393
|
+
add_event_listener(callback: (type: number, data: EventData) => void): void;
|
|
394
|
+
/** clear event listeners */
|
|
395
|
+
clear_event_listener(): void;
|
|
396
|
+
/** @param {number} type @param {EventData} data */
|
|
397
|
+
invoke_event_handle(type: number, data: EventData): void;
|
|
398
|
+
/** @param {number} type @param {EventData} data */
|
|
399
|
+
_invoke_event_handle(type: number, data: EventData): void;
|
|
400
|
+
/**
|
|
401
|
+
* Remove an enhanced plugin
|
|
402
|
+
* @param {typeof EnhancedPlugin} PluginClass - Plugin class
|
|
403
|
+
*/
|
|
404
|
+
removePlugin(PluginClass: typeof EnhancedPlugin): void;
|
|
405
|
+
removePlugin(PluginClass: typeof EnhancedPlugin): void;
|
|
406
|
+
/**
|
|
407
|
+
* Get an enhanced plugin instance
|
|
408
|
+
* @param {string} instanceName - Plugin instance name
|
|
409
|
+
* @returns {EnhancedPlugin | undefined}
|
|
410
|
+
*/
|
|
411
|
+
getPlugin(instanceName: string): EnhancedPlugin | undefined;
|
|
412
|
+
getPlugin(instanceName: string): EnhancedPlugin | undefined;
|
|
413
|
+
/**
|
|
414
|
+
* Destroy the jsMind instance and clean up resources
|
|
415
|
+
*/
|
|
416
|
+
destroy(): void;
|
|
417
|
+
destroy(): void;
|
|
418
|
+
}
|
|
419
|
+
export default jsMind;
|
|
420
|
+
/**
|
|
421
|
+
* Event callback payload
|
|
422
|
+
*/
|
|
423
|
+
export type EventData = {
|
|
424
|
+
evt?: string;
|
|
425
|
+
data?: unknown[];
|
|
426
|
+
node?: string;
|
|
427
|
+
};
|
|
428
|
+
export namespace jsMind { }
|
|
429
|
+
import { Mind } from './jsmind.mind.js';
|
|
430
|
+
import { EnhancedPluginManager } from './jsmind.enhanced-plugin.js';
|
|
431
|
+
import { DataProvider } from './jsmind.data_provider.js';
|
|
432
|
+
import { LayoutProvider } from './jsmind.layout_provider.js';
|
|
433
|
+
import { ViewProvider } from './jsmind.view_provider.js';
|
|
434
|
+
import { ShortcutProvider } from './jsmind.shortcut_provider.js';
|
|
435
|
+
import { EnhancedPlugin } from './jsmind.enhanced-plugin.js';
|
|
436
|
+
import { Node } from './jsmind.node.js';
|
|
437
|
+
import { Plugin } from './jsmind.plugin.js';
|
|
438
|
+
import { register as _register_plugin } from './jsmind.plugin.js';
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export const $: Dom;
|
|
2
|
+
/**
|
|
3
|
+
* @license BSD
|
|
4
|
+
* @copyright 2014-2025 UmbraCi
|
|
5
|
+
*
|
|
6
|
+
* Project Home:
|
|
7
|
+
* https://github.com/UmbraCi/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 {};
|