mind-elixir 2.0.2 → 2.0.3

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.
Files changed (39) hide show
  1. package/dist/MindElixir.js +1 -1
  2. package/dist/MindElixirLite.js +1 -1
  3. package/dist/example1.js +1 -1
  4. package/dist/types/const.d.ts +18 -0
  5. package/dist/types/customLink.d.ts +6 -0
  6. package/dist/types/dev.d.ts +1 -0
  7. package/dist/types/exampleData/1.cn.d.ts +126 -0
  8. package/dist/types/exampleData/1.d.ts +3 -0
  9. package/dist/types/exampleData/2.d.ts +3 -0
  10. package/dist/types/exampleData/3.d.ts +3 -0
  11. package/dist/types/i18n.d.ts +2 -0
  12. package/dist/types/index.d.ts +53 -0
  13. package/dist/types/index.lite.d.ts +13 -0
  14. package/dist/types/interact.d.ts +140 -0
  15. package/dist/types/linkDiv.d.ts +14 -0
  16. package/dist/types/mouse.d.ts +2 -0
  17. package/dist/types/nodeOperation.d.ts +159 -0
  18. package/dist/types/plugin/contextMenu.d.ts +3 -0
  19. package/dist/types/plugin/keypress.d.ts +2 -0
  20. package/dist/types/plugin/mobileMenu.d.ts +3 -0
  21. package/dist/types/plugin/nodeDraggable.d.ts +2 -0
  22. package/dist/types/plugin/operationHistory.d.ts +2 -0
  23. package/dist/types/plugin/toolBar.d.ts +3 -0
  24. package/dist/types/types/dom.d.ts +41 -0
  25. package/dist/types/types/function.d.ts +45 -0
  26. package/dist/types/types/global.d.ts +7 -0
  27. package/dist/types/types/index.d.ts +219 -0
  28. package/dist/types/types/interact.d.ts +14 -0
  29. package/dist/types/types/linkDiv.d.ts +18 -0
  30. package/dist/types/utils/LinkDragMoveHelper.d.ts +5 -0
  31. package/dist/types/utils/dom.d.ts +12 -0
  32. package/dist/types/utils/dragMoveHelper.d.ts +9 -0
  33. package/dist/types/utils/index.d.ts +36 -0
  34. package/dist/types/utils/layout.d.ts +12 -0
  35. package/dist/types/utils/pubsub.d.ts +10 -0
  36. package/dist/types/utils/svg.d.ts +6 -0
  37. package/package.json +88 -75
  38. package/readme.cn.md +1 -1
  39. package/readme.md +19 -1
@@ -0,0 +1,18 @@
1
+ export declare type MainLineParams = {
2
+ x1: number;
3
+ y1: number;
4
+ x2: number;
5
+ y2: number;
6
+ };
7
+ export declare type SubLineParams = {
8
+ pT: number;
9
+ pL: number;
10
+ pW: number;
11
+ pH: number;
12
+ cT: number;
13
+ cL: number;
14
+ cW: number;
15
+ cH: number;
16
+ direction: string;
17
+ isFirst: boolean | undefined;
18
+ };
@@ -0,0 +1,5 @@
1
+ import type { LinkDragMoveHelperInstance } from '../types/index';
2
+ declare const LinkDragMoveHelper: {
3
+ create: (dom: HTMLElement) => LinkDragMoveHelperInstance;
4
+ };
5
+ export default LinkDragMoveHelper;
@@ -0,0 +1,12 @@
1
+ import type { Topic, Expander } from '../types/dom';
2
+ import type { CreateWrapper, CreateParent, CreateChildren, CreateTopic, CreateInputDiv } from '../types/function';
3
+ import type { MindElixirInstance, NodeObj } from '../types/index';
4
+ export declare const findEle: (id: string, instance?: MindElixirInstance | undefined) => Topic;
5
+ export declare const shapeTpc: (tpc: Topic, nodeObj: NodeObj) => void;
6
+ export declare const createWrapper: CreateWrapper;
7
+ export declare const createParent: CreateParent;
8
+ export declare const createChildren: CreateChildren;
9
+ export declare const createTopic: CreateTopic;
10
+ export declare function selectText(div: HTMLElement): void;
11
+ export declare const createInputDiv: CreateInputDiv;
12
+ export declare const createExpander: (expanded: boolean | undefined) => Expander;
@@ -0,0 +1,9 @@
1
+ declare const _default: {
2
+ afterMoving: boolean;
3
+ mousedown: boolean;
4
+ lastX: number;
5
+ lastY: number;
6
+ onMove(e: MouseEvent, container: HTMLElement): void;
7
+ clear(): void;
8
+ };
9
+ export default _default;
@@ -0,0 +1,36 @@
1
+ import type { LinkControllerData } from '../types/function';
2
+ import type { GetObjById, FillParent, NodeObj, GenerateNewObj } from '../types/index';
3
+ export declare function encodeHTML(s: string): string;
4
+ export declare const isMobile: () => boolean;
5
+ export declare const getObjById: GetObjById;
6
+ export declare const fillParent: FillParent;
7
+ export declare function refreshIds(data: NodeObj): void;
8
+ export declare const throttle: (fn: (...args: any[]) => void, wait: number) => (...args: any[]) => void;
9
+ export declare function getArrowPoints(p3x: number, p3y: number, p4x: number, p4y: number): {
10
+ x1: number;
11
+ y1: number;
12
+ x2: number;
13
+ y2: number;
14
+ };
15
+ export declare function calcP1(fromData: LinkControllerData, p2x: number, p2y: number): {
16
+ x: number;
17
+ y: number;
18
+ };
19
+ export declare function calcP4(toData: LinkControllerData, p3x: number, p3y: number): {
20
+ x: number;
21
+ y: number;
22
+ };
23
+ export declare function generateUUID(): string;
24
+ export declare const generateNewObj: GenerateNewObj;
25
+ export declare function checkMoveValid(from: NodeObj, to: NodeObj): boolean;
26
+ export declare function getObjSibling(obj: NodeObj): NodeObj | null;
27
+ export declare function moveUpObj(obj: NodeObj): void;
28
+ export declare function moveDownObj(obj: NodeObj): void;
29
+ export declare function removeNodeObj(obj: NodeObj): number;
30
+ export declare function insertNodeObj(obj: NodeObj, newObj: NodeObj): void;
31
+ export declare function insertBeforeNodeObj(obj: NodeObj, newObj: NodeObj): void;
32
+ export declare function insertParentNodeObj(obj: NodeObj, newObj: NodeObj): void;
33
+ export declare function moveNodeObj(from: NodeObj, to: NodeObj): void;
34
+ export declare function moveNodeBeforeObj(from: NodeObj, to: NodeObj): void;
35
+ export declare function moveNodeAfterObj(from: NodeObj, to: NodeObj): void;
36
+ export declare function deepClone(obj: NodeObj): any;
@@ -0,0 +1,12 @@
1
+ import type { Layout, LayoutChildren, JudgeDirection } from '../types/function';
2
+ export declare const layout: Layout;
3
+ /**
4
+ * traversal data and generate dom structure of mind map
5
+ * @ignore
6
+ * @param {object} data node data object
7
+ * @param {object} container node container(optional)
8
+ * @param {number} direction main node direction(optional)
9
+ * @return {ChildrenElement} children element.
10
+ */
11
+ export declare const layoutChildren: LayoutChildren;
12
+ export declare const judgeDirection: JudgeDirection;
@@ -0,0 +1,10 @@
1
+ declare const Bus: {
2
+ create(): {
3
+ handlers: Record<string, ((...arg: any[]) => void)[]>;
4
+ showHandler: () => void;
5
+ addListener: (type: string, handler: (...arg: any[]) => void) => void;
6
+ fire: (type: string, ...payload: any[]) => void;
7
+ removeListener: (type: string, handler: (...arg: any[]) => void) => void;
8
+ };
9
+ };
10
+ export default Bus;
@@ -0,0 +1,6 @@
1
+ import type { CustomSvg } from '../types/dom';
2
+ export declare const createMainPath: (d: string, color: string) => SVGPathElement;
3
+ export declare const createLinkSvg: (klass: string) => SVGSVGElement;
4
+ export declare const createLine: (x1: number, y1: number, x2: number, y2: number) => SVGLineElement;
5
+ export declare const createPath: (d: string, color: string) => SVGPathElement;
6
+ export declare const createSvgGroup: (d: string, arrowd: string) => CustomSvg;
package/package.json CHANGED
@@ -1,75 +1,88 @@
1
- {
2
- "name": "mind-elixir",
3
- "version": "2.0.2",
4
- "description": "Mind elixir is a free open source mind map core.",
5
- "main": "dist/MindElixir.js",
6
- "scripts": {
7
- "prepare": "husky install",
8
- "lint": "eslint --cache --max-warnings 0 \"src/**/*.{js,json,ts}\" --fix",
9
- "start": "webpack-dev-server --mode development --env dist=0",
10
- "startd": "webpack-dev-server --mode development --env dist=1",
11
- "test": "jest --runInBand",
12
- "build": "webpack --mode production",
13
- "doc": "./node_modules/.bin/jsdoc src/ -R readme.md -c conf.json",
14
- "md": "./node_modules/.bin/jsdoc2md 'src/*.js' > api.md",
15
- "publish2": "npm run build && npm version patch -m \"build: release %s\" && npm publish",
16
- "beta": "npm run build && npm publish --tag beta"
17
- },
18
- "lint-staged": {
19
- "src/**/*.{ts,js}": [
20
- "eslint --cache --fix"
21
- ],
22
- "src/**/*.{json,less}": [
23
- "prettier --write"
24
- ]
25
- },
26
- "files": [
27
- "package.json",
28
- "dist"
29
- ],
30
- "repository": {
31
- "type": "git",
32
- "url": "https://github.com/ssshooter/mind-elixir-core"
33
- },
34
- "homepage": "https://mind-elixir.com/",
35
- "author": "ssshooter",
36
- "license": "MIT",
37
- "devDependencies": {
38
- "@babel/core": "^7.4.5",
39
- "@babel/plugin-transform-runtime": "^7.12.10",
40
- "@babel/preset-env": "^7.11.5",
41
- "@babel/runtime": "^7.15.4",
42
- "@commitlint/cli": "^17.4.3",
43
- "@commitlint/config-conventional": "^17.4.3",
44
- "@typescript-eslint/eslint-plugin": "^5.52.0",
45
- "@typescript-eslint/parser": "^5.52.0",
46
- "babel-loader": "^8.0.6",
47
- "better-docs": "^2.3.2",
48
- "css-loader": "^6.7.1",
49
- "docdash": "^1.1.1",
50
- "eslint": "^8.34.0",
51
- "eslint-config-prettier": "^8.6.0",
52
- "eslint-plugin-prettier": "^4.2.1",
53
- "html-webpack-plugin": "^5.3.2",
54
- "husky": "^8.0.3",
55
- "jest": "^27.5.1",
56
- "jsdoc": "^3.6.3",
57
- "jsdoc-to-markdown": "^7.1.1",
58
- "less": "^4.1.2",
59
- "less-loader": "^10.2.0",
60
- "lint-staged": "^13.1.2",
61
- "prettier": "2.8.4",
62
- "puppeteer": "^13.5.1",
63
- "puppeteer-to-istanbul": "^1.4.0",
64
- "regenerator-runtime": "^0.13.7",
65
- "style-loader": "^3.3.1",
66
- "terser-webpack-plugin": "^5.3.1",
67
- "ts-loader": "^9.2.6",
68
- "typescript": "^4.4.3",
69
- "url-loader": "^4.1.1",
70
- "webpack": "5.76.0",
71
- "webpack-bundle-analyzer": "^4.5.0",
72
- "webpack-cli": "^4.9.2",
73
- "webpack-dev-server": "^4.7.4"
74
- }
75
- }
1
+ {
2
+ "name": "mind-elixir",
3
+ "version": "2.0.3",
4
+ "description": "Mind elixir is a free open source mind map core.",
5
+ "main": "dist/MindElixir.js",
6
+ "scripts": {
7
+ "prepare": "husky install",
8
+ "lint": "eslint --cache --max-warnings 0 \"src/**/*.{js,json,ts}\" --fix",
9
+ "start": "webpack-dev-server --mode development --env dist=0",
10
+ "startd": "webpack-dev-server --mode development --env dist=1",
11
+ "test": "jest --runInBand",
12
+ "build": "webpack --mode production",
13
+ "doc": "./node_modules/.bin/jsdoc src/ -R readme.md -c conf.json",
14
+ "md": "./node_modules/.bin/jsdoc2md 'src/*.js' > api.md",
15
+ "publish2": "npm run build && npm version patch -m \"build: release %s\" && npm publish",
16
+ "beta": "npm run build && npm publish --tag beta"
17
+ },
18
+ "types": "dist/types/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/types/index.d.ts",
22
+ "import": "./dist/MindElixir.js",
23
+ "require": "./dist/MindElixir.js"
24
+ },
25
+ "./dist/example1": {
26
+ "types": "./dist/types/exampleData/1.d.ts",
27
+ "import": "./dist/example1.js",
28
+ "require": "./dist/example1.js"
29
+ }
30
+ },
31
+ "lint-staged": {
32
+ "src/**/*.{ts,js}": [
33
+ "eslint --cache --fix"
34
+ ],
35
+ "src/**/*.{json,less}": [
36
+ "prettier --write"
37
+ ]
38
+ },
39
+ "files": [
40
+ "package.json",
41
+ "dist"
42
+ ],
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "https://github.com/ssshooter/mind-elixir-core"
46
+ },
47
+ "homepage": "https://mind-elixir.com/",
48
+ "author": "ssshooter",
49
+ "license": "MIT",
50
+ "devDependencies": {
51
+ "@babel/core": "^7.4.5",
52
+ "@babel/plugin-transform-runtime": "^7.12.10",
53
+ "@babel/preset-env": "^7.11.5",
54
+ "@babel/runtime": "^7.15.4",
55
+ "@commitlint/cli": "^17.4.3",
56
+ "@commitlint/config-conventional": "^17.4.3",
57
+ "@typescript-eslint/eslint-plugin": "^5.52.0",
58
+ "@typescript-eslint/parser": "^5.52.0",
59
+ "babel-loader": "^8.0.6",
60
+ "better-docs": "^2.3.2",
61
+ "css-loader": "^6.7.1",
62
+ "docdash": "^1.1.1",
63
+ "eslint": "^8.34.0",
64
+ "eslint-config-prettier": "^8.6.0",
65
+ "eslint-plugin-prettier": "^4.2.1",
66
+ "html-webpack-plugin": "^5.3.2",
67
+ "husky": "^8.0.3",
68
+ "jest": "^27.5.1",
69
+ "jsdoc": "^3.6.3",
70
+ "jsdoc-to-markdown": "^7.1.1",
71
+ "less": "^4.1.2",
72
+ "less-loader": "^10.2.0",
73
+ "lint-staged": "^13.1.2",
74
+ "prettier": "2.8.4",
75
+ "puppeteer": "^13.5.1",
76
+ "puppeteer-to-istanbul": "^1.4.0",
77
+ "regenerator-runtime": "^0.13.7",
78
+ "style-loader": "^3.3.1",
79
+ "terser-webpack-plugin": "^5.3.1",
80
+ "ts-loader": "^9.2.6",
81
+ "typescript": "^4.4.3",
82
+ "url-loader": "^4.1.1",
83
+ "webpack": "5.76.0",
84
+ "webpack-bundle-analyzer": "^4.5.0",
85
+ "webpack-cli": "^4.9.2",
86
+ "webpack-dev-server": "^4.7.4"
87
+ }
88
+ }
package/readme.cn.md CHANGED
@@ -22,7 +22,7 @@ Mind elixir 是一个无框架依赖的思维导图内核
22
22
 
23
23
  ## 立即尝试
24
24
 
25
- ![mindelixir](https://raw.githubusercontent.com/ssshooter/mind-elixir-core/master/images/screenshot.png)
25
+ ![mindelixir](https://raw.githubusercontent.com/ssshooter/mind-elixir-core/master/images/screenshot2.png)
26
26
 
27
27
  https://mind-elixir.com/#/
28
28
 
package/readme.md CHANGED
@@ -50,6 +50,7 @@ Mind elixir is a free open source mind map core.
50
50
  - [Operation Guards](#operation-guards)
51
51
  - [Theme](#theme)
52
52
  - [Not only core](#not-only-core)
53
+ - [Development](#development)
53
54
 
54
55
  </details>
55
56
 
@@ -59,7 +60,7 @@ https://doc.mind-elixir.com/
59
60
 
60
61
  ## Try now
61
62
 
62
- ![mindelixir](https://raw.githubusercontent.com/ssshooter/mind-elixir-core/master/images/screenshot.png)
63
+ ![mindelixir](https://raw.githubusercontent.com/ssshooter/mind-elixir-core/master/images/screenshot2.png)
63
64
 
64
65
  https://mind-elixir.com/
65
66
 
@@ -180,6 +181,7 @@ const nodeData = {
180
181
  topic: 'node topic',
181
182
  id: 'bd1c24420cd2c2f5',
182
183
  style: { fontSize: '32', color: '#3298db', background: '#ecf0f1' },
184
+ expanded: true,
183
185
  parent: null,
184
186
  tags: ['Tag'],
185
187
  icons: ['😀'],
@@ -295,3 +297,19 @@ const options = {
295
297
  - [@mind-elixir/export-html](https://github.com/ssshooter/export-html)
296
298
  - [@mind-elixir/export-image](https://github.com/ssshooter/export-image) (WIP🚧)
297
299
  - [mind-elixir-react](https://github.com/ssshooter/mind-elixir-react)
300
+
301
+ ## Development
302
+
303
+ ```
304
+ yarn
305
+ npm start
306
+ ```
307
+
308
+ Test generated files with `dev.dist.ts`:
309
+
310
+ ```
311
+ npm run build
312
+ npm link
313
+ npm link mind-elixir
314
+ npm run startd
315
+ ```