mind-elixir 4.5.2 → 4.6.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.
@@ -4,7 +4,7 @@ import { LEFT, RIGHT, SIDE, DARK_THEME, THEME } from './const';
4
4
  import { findEle } from './utils/dom';
5
5
  import dragMoveHelper from './utils/dragMoveHelper';
6
6
  import type { MindElixirData, MindElixirInstance, MindElixirMethods, Options } from './types/index';
7
- declare function MindElixir(this: MindElixirInstance, { el, direction, locale, draggable, editable, contextMenu, contextMenuOption, toolBar, keypress, mouseSelectionButton, selectionContainer, before, newTopicName, allowUndo, generateMainBranch, generateSubBranch, overflowHidden, theme, alignment, }: Options): void;
7
+ declare function MindElixir(this: MindElixirInstance, { el, direction, locale, draggable, editable, contextMenu, toolBar, keypress, mouseSelectionButton, selectionContainer, before, newTopicName, allowUndo, generateMainBranch, generateSubBranch, overflowHidden, theme, alignment, }: Options): void;
8
8
  declare namespace MindElixir {
9
9
  export var prototype: {
10
10
  init(this: MindElixirInstance, data: MindElixirData): Error | undefined;
@@ -44,8 +44,7 @@ declare namespace MindElixir {
44
44
  selectNode: (this: MindElixirInstance, targetElement: import("./types/dom").Topic, isNewNode?: boolean, e?: MouseEvent) => void;
45
45
  unselectNode: (this: MindElixirInstance) => void;
46
46
  selectNodes: (this: MindElixirInstance, tpc: import("./types/dom").Topic[]) => void;
47
- unselectNodes: (// record the direction before enter focus mode, must true in focus mode, reset to null after exit focus
48
- this: MindElixirInstance) => void;
47
+ unselectNodes: (this: MindElixirInstance) => void;
49
48
  clearSelection: (this: MindElixirInstance) => void;
50
49
  getDataString: (this: MindElixirInstance) => string;
51
50
  getData: (this: MindElixirInstance) => MindElixirData;
@@ -9,4 +9,4 @@ export type ContextMenuOption = {
9
9
  onclick: (e: MouseEvent) => void;
10
10
  }[];
11
11
  };
12
- export default function (mind: MindElixirInstance, option?: ContextMenuOption): () => void;
12
+ export default function (mind: MindElixirInstance, option: true | ContextMenuOption): () => void;
@@ -1,2 +1,2 @@
1
- import type { MindElixirInstance } from '../types/index';
2
- export default function (mind: MindElixirInstance): void;
1
+ import type { KeypressOptions, MindElixirInstance } from '../types/index';
2
+ export default function (mind: MindElixirInstance, options: boolean | KeypressOptions): void;
@@ -51,16 +51,19 @@ export type Theme = {
51
51
  }>;
52
52
  };
53
53
  export type Alignment = 'root' | 'nodes';
54
+ export interface KeypressOptions {
55
+ [key: string]: (e: KeyboardEvent) => void;
56
+ }
54
57
  /**
55
58
  * The MindElixir instance
56
59
  *
57
60
  * @public
58
61
  */
59
- export interface MindElixirInstance extends MindElixirMethods {
62
+ export interface MindElixirInstance extends Required<Options>, MindElixirMethods {
63
+ el: HTMLElement;
60
64
  disposable: Array<() => void>;
61
65
  isFocusMode: boolean;
62
66
  nodeDataBackup: NodeObj;
63
- mindElixirBox: HTMLElement;
64
67
  nodeData: NodeObj;
65
68
  arrows: Arrow[];
66
69
  summaries: Summary[];
@@ -71,23 +74,6 @@ export interface MindElixirInstance extends MindElixirMethods {
71
74
  waitCopy: Topic[] | null;
72
75
  scaleVal: number;
73
76
  tempDirection: number | null;
74
- theme: Theme;
75
- userTheme?: Theme;
76
- direction: number;
77
- locale: Locale;
78
- draggable: boolean;
79
- editable: boolean;
80
- contextMenu: boolean;
81
- contextMenuOption?: ContextMenuOption;
82
- toolBar: boolean;
83
- keypress: boolean;
84
- mouseSelectionButton: 0 | 2;
85
- before: Before;
86
- newTopicName: string;
87
- allowUndo: boolean;
88
- overflowHidden: boolean;
89
- generateMainBranch: (params: MainLineParams) => PathString;
90
- generateSubBranch: (params: SubLineParams) => PathString;
91
77
  container: HTMLElement;
92
78
  map: HTMLElement;
93
79
  root: HTMLElement;
@@ -113,8 +99,6 @@ export interface MindElixirInstance extends MindElixirMethods {
113
99
  undo: () => void;
114
100
  redo: () => void;
115
101
  selection: SelectionArea;
116
- selectionContainer?: string | HTMLElement;
117
- alignment: Alignment;
118
102
  }
119
103
  type PathString = string;
120
104
  /**
@@ -122,16 +106,15 @@ type PathString = string;
122
106
  *
123
107
  * @public
124
108
  */
125
- export type Options = {
109
+ export interface Options {
126
110
  el: string | HTMLElement;
127
111
  direction?: number;
128
112
  locale?: Locale;
129
113
  draggable?: boolean;
130
114
  editable?: boolean;
131
- contextMenu?: boolean;
132
- contextMenuOption?: ContextMenuOption;
115
+ contextMenu?: boolean | ContextMenuOption;
133
116
  toolBar?: boolean;
134
- keypress?: boolean;
117
+ keypress?: boolean | KeypressOptions;
135
118
  mouseSelectionButton?: 0 | 2;
136
119
  before?: Before;
137
120
  newTopicName?: string;
@@ -140,10 +123,9 @@ export type Options = {
140
123
  generateMainBranch?: (this: MindElixirInstance, params: MainLineParams) => PathString;
141
124
  generateSubBranch?: (this: MindElixirInstance, params: SubLineParams) => PathString;
142
125
  theme?: Theme;
143
- nodeMenu?: boolean;
144
126
  selectionContainer?: string | HTMLElement;
145
127
  alignment?: Alignment;
146
- };
128
+ }
147
129
  export type Uid = string;
148
130
  export type Left = 0;
149
131
  export type Right = 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mind-elixir",
3
- "version": "4.5.2",
3
+ "version": "4.6.0",
4
4
  "type": "module",
5
5
  "description": "Mind elixir is a free open source mind map core.",
6
6
  "keywords": [