mind-elixir 5.9.3 → 5.10.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.
@@ -68,7 +68,6 @@ declare const methods: {
68
68
  initLeft: (this: MindElixirInstance) => void;
69
69
  initRight: (this: MindElixirInstance) => void;
70
70
  initSide: (this: MindElixirInstance) => void;
71
- setLocale: (this: MindElixirInstance, locale: import("./i18n").Locale) => void;
72
71
  expandNode: (this: MindElixirInstance, el: import("./docs").Topic, isExpand?: boolean) => void;
73
72
  expandNodeAll: (this: MindElixirInstance, el: import("./docs").Topic, isExpand?: boolean) => void;
74
73
  refresh: (this: MindElixirInstance, data?: MindElixirData) => void;
@@ -1,5 +1,6 @@
1
1
  import type { MindElixirInstance } from '../types/index';
2
2
  import './contextMenu.less';
3
+ import type { LangPack } from '../i18n';
3
4
  export type ContextMenuOption = {
4
5
  focus?: boolean;
5
6
  link?: boolean;
@@ -8,5 +9,6 @@ export type ContextMenuOption = {
8
9
  key?: string;
9
10
  onclick: (e: MouseEvent) => void;
10
11
  }[];
12
+ locale?: LangPack;
11
13
  };
12
14
  export default function (mind: MindElixirInstance, option: true | ContextMenuOption): () => void;
@@ -5,7 +5,6 @@ import type { LinkDragMoveHelperInstance } from '../utils/LinkDragMoveHelper';
5
5
  import type { Arrow } from '../arrow';
6
6
  import type { Summary, SummarySvgGroup } from '../summary';
7
7
  import type { MainLineParams, SubLineParams } from '../utils/generateBranch';
8
- import type { Locale } from '../i18n';
9
8
  import type { ContextMenuOption } from '../plugin/contextMenu';
10
9
  import type { createDragMoveHelper } from '../utils/dragMoveHelper';
11
10
  import type SelectionArea from '../viselect/src';
@@ -109,6 +108,15 @@ export interface MindElixirInstance extends Omit<Required<Options>, 'markdown' |
109
108
  history: Operation[];
110
109
  undo: () => void;
111
110
  redo: () => void;
111
+ /**
112
+ * Reset the undo/redo stack and update the internal baseline snapshot to the
113
+ * current diagram state. Call this after loading new data into an existing
114
+ * instance (e.g. after `refresh()`) to prevent users from undoing back into
115
+ * a previously loaded diagram.
116
+ *
117
+ * Only available when `allowUndo` is `true` (the default).
118
+ */
119
+ clearHistory?: () => void;
112
120
  selection: SelectionArea;
113
121
  dragMoveHelper: ReturnType<typeof createDragMoveHelper>;
114
122
  }
@@ -121,7 +129,10 @@ type PathString = string;
121
129
  export interface Options {
122
130
  el: string | HTMLElement;
123
131
  direction?: 0 | 1 | 2;
124
- locale?: Locale;
132
+ /**
133
+ * @deprecated Use `contextMenu.locale` instead.
134
+ */
135
+ locale?: string;
125
136
  /**
126
137
  * @deprecated Use `editable` instead
127
138
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mind-elixir",
3
- "version": "5.9.3",
3
+ "version": "5.10.0",
4
4
  "type": "module",
5
5
  "description": "Mind elixir is a free open source mind map core.",
6
6
  "keywords": [
@@ -10,7 +10,6 @@
10
10
  "visualization"
11
11
  ],
12
12
  "scripts": {
13
- "prepare": "husky install",
14
13
  "lint": "eslint --cache --max-warnings 0 \"src/**/*.{js,json,ts}\" --fix",
15
14
  "dev": "vite",
16
15
  "build": "node build.js && tsc",
@@ -28,21 +27,18 @@
28
27
  "exports": {
29
28
  ".": {
30
29
  "types": "./dist/types/index.d.ts",
31
- "import": "./dist/MindElixir.js",
32
- "require": "./dist/MindElixir.js"
30
+ "import": "./dist/MindElixir.js"
33
31
  },
34
32
  "./lite": {
35
33
  "import": "./dist/MindElixirLite.iife.js"
36
34
  },
37
35
  "./example": {
38
36
  "types": "./dist/types/exampleData/1.d.ts",
39
- "import": "./dist/example.js",
40
- "require": "./dist/example.js"
37
+ "import": "./dist/example.js"
41
38
  },
42
39
  "./LayoutSsr": {
43
40
  "types": "./dist/types/utils/LayoutSsr.d.ts",
44
- "import": "./dist/LayoutSsr.js",
45
- "require": "./dist/LayoutSsr.js"
41
+ "import": "./dist/LayoutSsr.js"
46
42
  },
47
43
  "./readme.md": "./readme.md",
48
44
  "./package.json": "./package.json",
@@ -51,13 +47,10 @@
51
47
  "./plaintextConverter": {
52
48
  "types": "./dist/types/utils/plaintextConverter.d.ts",
53
49
  "import": "./dist/PlaintextConverter.js"
54
- }
55
- },
56
- "typesVersions": {
57
- "*": {
58
- "example": [
59
- "./dist/types/exampleData/1.d.ts"
60
- ]
50
+ },
51
+ "./i18n": {
52
+ "types": "./dist/types/i18n.d.ts",
53
+ "import": "./dist/i18n.js"
61
54
  }
62
55
  },
63
56
  "main": "dist/MindElixir.js",
package/readme.md CHANGED
@@ -180,6 +180,7 @@ And in your CSS file:
180
180
 
181
181
  ```javascript
182
182
  import MindElixir from 'mind-elixir'
183
+ import { en } from 'mind-elixir/i18n'
183
184
  import 'mind-elixir/style.css'
184
185
  import example from 'mind-elixir/dist/example1'
185
186
 
@@ -188,11 +189,10 @@ let options = {
188
189
  direction: MindElixir.LEFT,
189
190
  toolBar: true, // default true
190
191
  keypress: true, // default true
191
- locale: 'en', // [zh_CN,zh_TW,en,ja,pt,ru,ro] waiting for PRs
192
192
  overflowHidden: false, // default false
193
- mainLinkStyle: 2, // [1,2] default 1
194
193
  mouseSelectionButton: 0, // 0 for left button, 2 for right button, default 0
195
194
  contextMenu: {
195
+ locale: en, // [cn,zh_CN,zh_TW,en,ru,ja,pt,it,es,fr,ko,ro,da,fi,de,nl,nb,sv]
196
196
  focus: true,
197
197
  link: true,
198
198
  extend: [