@umbraci/jsmind 0.10.9 → 0.10.11

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": "@umbraci/jsmind",
3
- "version": "0.10.9",
3
+ "version": "0.10.11",
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": "lib/jsmind.js",
6
6
  "module": "es/jsmind.js",
@@ -305,14 +305,11 @@ declare class jsMind {
305
305
  */
306
306
  remove_node(node: string | import("./jsmind.node.js").Node): boolean;
307
307
  /**
308
- * Update the topic (text content) and/or data of a node.
309
- * @param {string} node_id
310
- * @param {string|{topic?:string, data?:Record<string,any>}} topic_or_options - Topic string or options object
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
311
  */
312
- update_node(node_id: string, topic_or_options: string | {
313
- topic?: string;
314
- data?: Record<string, any>;
315
- }): void;
312
+ update_node(node_id: string, topic_or_updates: string | Partial<Pick<import("./jsmind.node.js").Node, "topic" | "data" | "id" | "index" | "expanded" | "direction">>): void;
316
313
  /**
317
314
  * Move a node and optionally change direction.
318
315
  * @param {string} node_id
@@ -59,6 +59,11 @@ export function flatten(tree: NodeTreeFormat | NodeTreeData, opts?: FlattenOptio
59
59
  * const after = jm.get_data('node_tree');
60
60
  * const result = jm.history.diff(before, after);
61
61
  * // fieldNames are automatically applied, no need to specify fields manually
62
+ *
63
+ * @example
64
+ * // Ignore index changes caused by preceding node deletions
65
+ * const result = jm.history.diff(before, after, { ignoreDeletionShift: true });
66
+ * // Now nodes that only change index due to deletion of previous siblings won't be marked as moved
62
67
  */
63
68
  export function diff(a: NodeTreeFormat | NodeTreeData, b: NodeTreeFormat | NodeTreeData, opts?: DiffOptions): DiffResult;
64
69
  export type NodeTreeFormat = {
@@ -298,4 +303,8 @@ export type DiffOptions = {
298
303
  * - Whether to categorize updates into moved/modified/movedAndModified. Defaults to false
299
304
  */
300
305
  categorize?: boolean;
306
+ /**
307
+ * - Whether to ignore index changes caused by preceding node deletions. When true, nodes that only change index due to deletion of previous siblings won't be marked as moved. Defaults to false
308
+ */
309
+ ignoreDeletionShift?: boolean;
301
310
  };