jsmind 0.8.8-patch → 0.8.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsmind",
3
- "version": "0.8.8-patch",
3
+ "version": "0.8.8",
4
4
  "description": "jsMind is a pure javascript library for mindmap, it base on html5 canvas. jsMind was released under BSD license, you can embed it in any project, if only you observe the license.",
5
5
  "main": "es6/jsmind.js",
6
6
  "types": "types/generated/index.d.ts",
@@ -92,9 +92,9 @@ export default class jsMind {
92
92
  disable_event_handle(event_handle: "mousedown" | "click" | "dblclick" | "mousewheel"): void;
93
93
  /**
94
94
  * Set theme name.
95
- * @param {string|null=} theme
95
+ * @param {string|null} theme
96
96
  */
97
- set_theme(theme?: (string | null) | undefined): void;
97
+ set_theme(theme: string | null): void;
98
98
  /** bind internal DOM events */
99
99
  _event_bind(): void;
100
100
  /** @param {MouseEvent} e */
@@ -135,10 +135,7 @@ export default class jsMind {
135
135
  expand_all(): void;
136
136
  /** Collapse all nodes */
137
137
  collapse_all(): void;
138
- /**
139
- * Expand nodes up to a specified depth level.
140
- * @param {number} depth
141
- */
138
+ /** @param {number} depth */
142
139
  expand_to_depth(depth: number): void;
143
140
  /** reset view/layout/data */
144
141
  _reset(): void;
@@ -174,55 +171,51 @@ export default class jsMind {
174
171
  */
175
172
  get_node(node: string | import("./jsmind.node.js").Node): import("./jsmind.node.js").Node;
176
173
  /**
177
- * Add a new node to the mind map.
174
+ * Add a node under parent.
178
175
  * @param {string | import('./jsmind.node.js').Node} parent_node
179
176
  * @param {string} node_id
180
177
  * @param {string} topic
181
178
  * @param {Record<string, any>=} data
182
- * @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)
179
+ * @param {number=} direction
183
180
  * @returns {import('./jsmind.node.js').Node|null}
184
181
  */
185
- 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;
182
+ add_node(parent_node: string | import("./jsmind.node.js").Node, node_id: string, topic: string, data?: Record<string, any> | undefined, direction?: number | undefined): import("./jsmind.node.js").Node | null;
186
183
  /**
187
184
  * Insert a node before target node.
188
185
  * @param {string | import('./jsmind.node.js').Node} node_before
189
186
  * @param {string} node_id
190
187
  * @param {string} topic
191
188
  * @param {Record<string, any>=} data
192
- * @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)
189
+ * @param {number=} direction
193
190
  * @returns {import('./jsmind.node.js').Node|null}
194
191
  */
195
- 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;
192
+ insert_node_before(node_before: string | import("./jsmind.node.js").Node, node_id: string, topic: string, data?: Record<string, any> | undefined, direction?: number | undefined): import("./jsmind.node.js").Node | null;
196
193
  /**
197
194
  * Insert a node after target node.
198
195
  * @param {string | import('./jsmind.node.js').Node} node_after
199
196
  * @param {string} node_id
200
197
  * @param {string} topic
201
198
  * @param {Record<string, any>=} data
202
- * @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)
199
+ * @param {number=} direction
203
200
  * @returns {import('./jsmind.node.js').Node|null}
204
201
  */
205
- 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;
202
+ insert_node_after(node_after: string | import("./jsmind.node.js").Node, node_id: string, topic: string, data?: Record<string, any> | undefined, direction?: number | undefined): import("./jsmind.node.js").Node | null;
206
203
  /**
207
204
  * Remove a node.
208
205
  * @param {string | import('./jsmind.node.js').Node} node
209
206
  * @returns {boolean}
210
207
  */
211
208
  remove_node(node: string | import("./jsmind.node.js").Node): boolean;
212
- /**
213
- * Update the topic (text content) of a node.
214
- * @param {string} node_id
215
- * @param {string} topic
216
- */
209
+ /** @param {string} node_id @param {string} topic */
217
210
  update_node(node_id: string, topic: string): void;
218
211
  /**
219
212
  * Move a node and optionally change direction.
220
213
  * @param {string} node_id
221
- * @param {string=} before_id - The ID of the node before which to place the moved node. Special values: "_first_", "_last_"
214
+ * @param {string=} before_id
222
215
  * @param {string=} parent_id
223
- * @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.
216
+ * @param {number=} direction
224
217
  */
225
- move_node(node_id: string, before_id?: string | undefined, parent_id?: string | undefined, direction?: ("left" | "center" | "right" | "-1" | "0" | "1" | number) | undefined): void;
218
+ move_node(node_id: string, before_id?: string | undefined, parent_id?: string | undefined, direction?: number | undefined): void;
226
219
  /**
227
220
  * @param {string | import('./jsmind.node.js').Node} node
228
221
  * @returns {void}
@@ -234,10 +227,7 @@ export default class jsMind {
234
227
  select_clear(): void;
235
228
  /** @param {string | import('./jsmind.node.js').Node} node */
236
229
  is_node_visible(node: string | import("./jsmind.node.js").Node): boolean;
237
- /**
238
- * Scroll the mind map to center the specified node.
239
- * @param {string | import('./jsmind.node.js').Node} node
240
- */
230
+ /** @param {string | import('./jsmind.node.js').Node} node */
241
231
  scroll_node_to_center(node: string | import("./jsmind.node.js").Node): void;
242
232
  /**
243
233
  * Find the previous sibling node of the given node.
@@ -253,7 +243,6 @@ export default class jsMind {
253
243
  */
254
244
  find_node_after(node: string | import("./jsmind.node.js").Node): import("./jsmind.node.js").Node | null;
255
245
  /**
256
- * Set background and foreground colors for a node.
257
246
  * @param {string} node_id
258
247
  * @param {string=} bg_color
259
248
  * @param {string=} fg_color
@@ -261,7 +250,6 @@ export default class jsMind {
261
250
  */
262
251
  set_node_color(node_id: string, bg_color?: string | undefined, fg_color?: string | undefined): void;
263
252
  /**
264
- * Set font style for a node.
265
253
  * @param {string} node_id
266
254
  * @param {number=} size
267
255
  * @param {string=} weight
@@ -270,15 +258,14 @@ export default class jsMind {
270
258
  */
271
259
  set_node_font_style(node_id: string, size?: number | undefined, weight?: string | undefined, style?: string | undefined): void;
272
260
  /**
273
- * Set background image for a node.
274
261
  * @param {string} node_id
275
- * @param {string=} image
262
+ * @param {string} image
276
263
  * @param {number=} width
277
264
  * @param {number=} height
278
265
  * @param {number=} rotation
279
266
  * @returns {void}
280
267
  */
281
- set_node_background_image(node_id: string, image?: string | undefined, width?: number | undefined, height?: number | undefined, rotation?: number | undefined): void;
268
+ set_node_background_image(node_id: string, image: string, width?: number | undefined, height?: number | undefined, rotation?: number | undefined): void;
282
269
  /**
283
270
  * @param {string} node_id
284
271
  * @param {number} rotation
@@ -31,22 +31,22 @@ export class Mind {
31
31
  * @param {string} node_id
32
32
  * @param {string} topic
33
33
  * @param {Record<string, any>=} data
34
- * @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)
34
+ * @param {number=} direction
35
35
  * @param {boolean=} expanded
36
36
  * @param {number=} idx
37
37
  * @returns {Node | null}
38
38
  */
39
- add_node(parent_node: Node, node_id: string, topic: string, data?: Record<string, any> | undefined, direction?: ("left" | "center" | "right" | "-1" | "0" | "1" | number) | undefined, expanded?: boolean | undefined, idx?: number | undefined): Node | null;
39
+ add_node(parent_node: Node, node_id: string, topic: string, data?: Record<string, any> | undefined, direction?: number | undefined, expanded?: boolean | undefined, idx?: number | undefined): Node | null;
40
40
  /**
41
41
  * Insert a node before target node.
42
42
  * @param {Node} node_before
43
43
  * @param {string} node_id
44
44
  * @param {string} topic
45
45
  * @param {Record<string, any>=} data
46
- * @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)
46
+ * @param {number=} direction
47
47
  * @returns {Node | null}
48
48
  */
49
- insert_node_before(node_before: Node, node_id: string, topic: string, data?: Record<string, any> | undefined, direction?: ("left" | "center" | "right" | "-1" | "0" | "1" | number) | undefined): Node | null;
49
+ insert_node_before(node_before: Node, node_id: string, topic: string, data?: Record<string, any> | undefined, direction?: number | undefined): Node | null;
50
50
  /**
51
51
  * Get previous sibling of a node or node id.
52
52
  * @param {string | Node} node
@@ -59,10 +59,10 @@ export class Mind {
59
59
  * @param {string} node_id
60
60
  * @param {string} topic
61
61
  * @param {Record<string, any>=} data
62
- * @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)
62
+ * @param {number=} direction
63
63
  * @returns {Node | null}
64
64
  */
65
- insert_node_after(node_after: Node, node_id: string, topic: string, data?: Record<string, any> | undefined, direction?: ("left" | "center" | "right" | "-1" | "0" | "1" | number) | undefined): Node | null;
65
+ insert_node_after(node_after: Node, node_id: string, topic: string, data?: Record<string, any> | undefined, direction?: number | undefined): Node | null;
66
66
  /**
67
67
  * Get next sibling of a node or node id.
68
68
  * @param {string | Node} node
@@ -72,18 +72,18 @@ export class Mind {
72
72
  /**
73
73
  * Move a node to new parent/position.
74
74
  * @param {Node} node
75
- * @param {string=} before_id - The ID of the node before which to place the moved node. Special values: "_first_", "_last_"
75
+ * @param {string=} before_id
76
76
  * @param {string=} parent_id
77
- * @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)
77
+ * @param {number=} direction
78
78
  * @returns {Node | null}
79
79
  */
80
- move_node(node: Node, before_id?: string | undefined, parent_id?: string | undefined, direction?: ("left" | "center" | "right" | "-1" | "0" | "1" | number) | undefined): Node | null;
80
+ move_node(node: Node, before_id?: string | undefined, parent_id?: string | undefined, direction?: number | undefined): Node | null;
81
81
  /**
82
82
  * Propagate direction to descendants.
83
83
  * @param {Node} node
84
- * @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)
84
+ * @param {number=} direction
85
85
  */
86
- _flow_node_direction(node: Node, direction?: ("left" | "center" | "right" | "-1" | "0" | "1" | number) | undefined): void;
86
+ _flow_node_direction(node: Node, direction?: number | undefined): void;
87
87
  /**
88
88
  * Re-index node among siblings based on before_id marker.
89
89
  * @param {Node} node
@@ -96,10 +96,10 @@ export class Mind {
96
96
  * @param {Node} node
97
97
  * @param {string} before_id
98
98
  * @param {string} parent_id
99
- * @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)
99
+ * @param {number=} direction
100
100
  * @returns {Node | null}
101
101
  */
102
- _move_node(node: Node, before_id: string, parent_id: string, direction?: ("left" | "center" | "right" | "-1" | "0" | "1" | number) | undefined): Node | null;
102
+ _move_node(node: Node, before_id: string, parent_id: string, direction?: number | undefined): Node | null;
103
103
  /**
104
104
  * Remove a node from the mind.
105
105
  * @param {Node} node
@@ -1,24 +1,24 @@
1
1
  /**
2
2
  * Merge user options with defaults. Throws if container missing.
3
- * @param {JsMindRuntimeOptions} options
3
+ * @param {Partial<JsMindRuntimeOptions>} options
4
4
  * @returns {JsMindRuntimeOptions}
5
5
  */
6
- export function merge_option(options: JsMindRuntimeOptions): JsMindRuntimeOptions;
6
+ export function merge_option(options: Partial<JsMindRuntimeOptions>): JsMindRuntimeOptions;
7
7
  export type JsMindRuntimeOptions = {
8
8
  container: string | HTMLElement;
9
- editable?: boolean;
10
- theme?: (string | null);
11
- mode?: ("full" | "side");
12
- support_html?: boolean;
13
- log_level?: "debug" | "info" | "warn" | "error" | "disable";
14
- view?: {
15
- engine?: "canvas" | "svg";
16
- enable_device_pixel_ratio?: boolean;
17
- hmargin?: number;
18
- vmargin?: number;
19
- line_width?: number;
20
- line_color?: string;
21
- line_style?: "curved" | "straight";
9
+ editable: boolean;
10
+ theme: (string | null);
11
+ mode: ("full" | "side");
12
+ support_html: boolean;
13
+ log_level: "debug" | "info" | "warn" | "error" | "disable";
14
+ view: {
15
+ engine: "canvas" | "svg";
16
+ enable_device_pixel_ratio: boolean;
17
+ hmargin: number;
18
+ vmargin: number;
19
+ line_width: number;
20
+ line_color: string;
21
+ line_style: "curved" | "straight";
22
22
  custom_line_render?: (this: object, arg: {
23
23
  ctx: CanvasRenderingContext2D | SVGPathElement;
24
24
  start_point: {
@@ -30,35 +30,35 @@ export type JsMindRuntimeOptions = {
30
30
  y: number;
31
31
  };
32
32
  }) => void;
33
- draggable?: boolean;
34
- hide_scrollbars_when_draggable?: boolean;
35
- node_overflow?: "hidden" | "wrap" | "visible";
36
- zoom?: {
37
- min?: number;
38
- max?: number;
39
- step?: number;
40
- mask_key?: number;
33
+ draggable: boolean;
34
+ hide_scrollbars_when_draggable: boolean;
35
+ node_overflow: "hidden" | "wrap";
36
+ zoom: {
37
+ min: number;
38
+ max: number;
39
+ step: number;
40
+ mask_key: number;
41
41
  };
42
- custom_node_render?: (null | ((jm: import("./jsmind.js").default, ele: HTMLElement, node: import("./jsmind.node.js").Node) => void));
43
- expander_style?: "char" | "number";
42
+ custom_node_render: (null | ((jm: import("./jsmind.js").default, ele: HTMLElement, node: import("./jsmind.node.js").Node) => void));
43
+ expander_style: "char" | "number";
44
44
  };
45
- layout?: {
46
- hspace?: number;
47
- vspace?: number;
48
- pspace?: number;
49
- cousin_space?: number;
45
+ layout: {
46
+ hspace: number;
47
+ vspace: number;
48
+ pspace: number;
49
+ cousin_space: number;
50
50
  };
51
- default_event_handle?: {
52
- enable_mousedown_handle?: boolean;
53
- enable_click_handle?: boolean;
54
- enable_dblclick_handle?: boolean;
55
- enable_mousewheel_handle?: boolean;
51
+ default_event_handle: {
52
+ enable_mousedown_handle: boolean;
53
+ enable_click_handle: boolean;
54
+ enable_dblclick_handle: boolean;
55
+ enable_mousewheel_handle: boolean;
56
56
  };
57
- shortcut?: {
58
- enable?: boolean;
59
- handles?: Record<string, (jm: import("./jsmind.js").default, e: KeyboardEvent) => void>;
60
- mapping?: Record<string, number | number[]>;
57
+ shortcut: {
58
+ enable: boolean;
59
+ handles: Record<string, (jm: import("./jsmind.js").default, e: KeyboardEvent) => void>;
60
+ mapping: Record<string, number | number[]>;
61
61
  id_generator?: () => string;
62
62
  };
63
- plugin?: Record<string, object>;
63
+ plugin: Record<string, object>;
64
64
  };