mind-elixir 2.1.0 → 3.0.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.
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "mind-elixir",
3
- "version": "2.1.0",
3
+ "version": "3.0.0",
4
+ "type": "module",
4
5
  "description": "Mind elixir is a free open source mind map core.",
5
6
  "keywords": [
6
7
  "mind-elixir",
@@ -8,36 +9,39 @@
8
9
  "dom",
9
10
  "visualization"
10
11
  ],
11
- "main": "dist/MindElixir.js",
12
12
  "scripts": {
13
13
  "prepare": "husky install",
14
14
  "lint": "eslint --cache --max-warnings 0 \"src/**/*.{js,json,ts}\" --fix",
15
- "start": "webpack-dev-server --mode development --env dist=0",
16
- "startd": "webpack-dev-server --mode development --env dist=1",
15
+ "dev": "vite",
16
+ "build": "node build.js && tsc",
17
+ "preview": "vite preview",
17
18
  "test": "jest --runInBand",
18
- "build": "webpack --mode production",
19
- "doc": "./node_modules/.bin/jsdoc src/ -R readme.md -c conf.json",
20
- "md": "./node_modules/.bin/jsdoc2md 'src/*.js' > api.md",
21
- "publish2": "npm run build && npm version patch -m \"build: release %s\" && npm publish",
19
+ "doc": "tsc && api-extractor run --local --verbose",
22
20
  "beta": "npm run build && npm publish --tag beta"
23
21
  },
24
- "types": "dist/types/index.d.ts",
25
22
  "exports": {
26
23
  ".": {
27
24
  "types": "./dist/types/index.d.ts",
28
25
  "import": "./dist/MindElixir.js",
29
26
  "require": "./dist/MindElixir.js"
30
27
  },
31
- "./dist/example1": {
28
+ "./example": {
32
29
  "types": "./dist/types/exampleData/1.d.ts",
33
- "import": "./dist/example1.js",
34
- "require": "./dist/example1.js"
30
+ "import": "./dist/example.js",
31
+ "require": "./dist/example.js"
35
32
  },
36
- "./readme.md": {
37
- "import": "./readme.md",
38
- "require": "./readme.md"
33
+ "./readme.md": "./readme.md",
34
+ "./package.json": "./package.json"
35
+ },
36
+ "typesVersions": {
37
+ "*": {
38
+ "example": [
39
+ "./dist/types/exampleData/1.d.ts"
40
+ ]
39
41
  }
40
42
  },
43
+ "main": "dist/MindElixir.js",
44
+ "types": "dist/types/index.d.ts",
41
45
  "lint-staged": {
42
46
  "src/**/*.{ts,js}": [
43
47
  "eslint --cache --fix"
@@ -58,41 +62,21 @@
58
62
  "author": "ssshooter",
59
63
  "license": "MIT",
60
64
  "devDependencies": {
61
- "@babel/core": "^7.4.5",
62
- "@babel/plugin-transform-runtime": "^7.12.10",
63
- "@babel/preset-env": "^7.11.5",
64
- "@babel/runtime": "^7.15.4",
65
- "@commitlint/cli": "^17.4.3",
66
- "@commitlint/config-conventional": "^17.4.3",
67
- "@typescript-eslint/eslint-plugin": "^5.52.0",
68
- "@typescript-eslint/parser": "^5.52.0",
69
- "babel-loader": "^8.0.6",
70
- "better-docs": "^2.3.2",
71
- "css-loader": "^6.7.1",
72
- "docdash": "^1.1.1",
73
- "eslint": "^8.34.0",
74
- "eslint-config-prettier": "^8.6.0",
65
+ "@commitlint/cli": "^17.6.7",
66
+ "@commitlint/config-conventional": "^17.6.7",
67
+ "@microsoft/api-extractor": "^7.36.4",
68
+ "@typescript-eslint/eslint-plugin": "^5.62.0",
69
+ "@typescript-eslint/parser": "^5.62.0",
70
+ "eslint": "^8.46.0",
71
+ "eslint-config-prettier": "^8.10.0",
75
72
  "eslint-plugin-prettier": "^4.2.1",
76
- "html-webpack-plugin": "^5.3.2",
77
73
  "husky": "^8.0.3",
78
- "jest": "^27.5.1",
79
- "jsdoc": "^3.6.3",
80
- "jsdoc-to-markdown": "^7.1.1",
81
- "less": "^4.1.2",
74
+ "less": "^4.1.3",
82
75
  "less-loader": "^10.2.0",
83
- "lint-staged": "^13.1.2",
76
+ "lint-staged": "^13.2.3",
84
77
  "prettier": "2.8.4",
85
- "puppeteer": "^13.5.1",
86
- "puppeteer-to-istanbul": "^1.4.0",
87
- "regenerator-runtime": "^0.13.7",
88
- "style-loader": "^3.3.1",
89
- "terser-webpack-plugin": "^5.3.1",
90
- "ts-loader": "^9.2.6",
91
- "typescript": "^4.4.3",
92
- "url-loader": "^4.1.1",
93
- "webpack": "5.76.0",
94
- "webpack-bundle-analyzer": "^4.5.0",
95
- "webpack-cli": "^4.9.2",
96
- "webpack-dev-server": "^4.7.4"
78
+ "typescript": "^5.1.6",
79
+ "vite": "^4.4.8",
80
+ "vite-plugin-css-injected-by-js": "^3.2.1"
97
81
  }
98
82
  }
package/readme.cn.md CHANGED
@@ -87,8 +87,6 @@ let options = {
87
87
  locale: 'en', // [zh_CN,zh_TW,en,ja,pt] waiting for PRs
88
88
  overflowHidden: false, // default false
89
89
  mainLinkStyle: 2, // [1,2] default 1
90
- mainNodeVerticalGap: 15, // default 25
91
- mainNodeHorizontalGap: 15, // default 65
92
90
  contextMenuOption: {
93
91
  focus: true,
94
92
  link: true,
package/readme.md CHANGED
@@ -140,8 +140,6 @@ let options = {
140
140
  locale: 'en', // [zh_CN,zh_TW,en,ja,pt,ru] waiting for PRs
141
141
  overflowHidden: false, // default false
142
142
  mainLinkStyle: 2, // [1,2] default 1
143
- mainNodeVerticalGap: 15, // default 25
144
- mainNodeHorizontalGap: 15, // default 65
145
143
  contextMenuOption: {
146
144
  focus: true,
147
145
  link: true,
package/dist/example1.js DELETED
@@ -1 +0,0 @@
1
- !function(d,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.example1=e():d.example1=e()}(self,(()=>(()=>{"use strict";var d={d:(e,i)=>{for(var c in i)d.o(i,c)&&!d.o(e,c)&&Object.defineProperty(e,c,{enumerable:!0,get:i[c]})},o:(d,e)=>Object.prototype.hasOwnProperty.call(d,e)},e={};d.d(e,{default:()=>i});const i={direction:2,nodeData:{id:"me-root",topic:"Mind Elixir",root:!0,tags:["Mind Map Core"],children:[{topic:"logo2",id:"56dae51a90d350a8",direction:0,expanded:!0,children:[{id:"use-image",topic:"mind-elixir",image:{url:"https://raw.githubusercontent.com/ssshooter/mind-elixir-core/master/images/logo2.png",height:90,width:90}}]},{topic:"What is Minde Elixir",id:"bd4313fbac40284b",direction:0,expanded:!0,children:[{topic:"A mind map core",id:"beeb823afd6d2114"},{topic:"Free",id:"c1f068377de9f3a0"},{topic:"Open-Source",id:"c1f06d38a09f23ca"},{topic:"Use without JavaScript framework",id:"c1f06e4cbcf16463",expanded:!0,children:[]},{topic:"Use in your own project",id:"c1f1f11a7fbf7550",children:[{topic:"import MindElixir from 'mind-elixir'",id:"c1f1e245b0a89f9b"},{topic:"new MindElixir({...}).init(data)",id:"c1f1ebc7072c8928"}]},{topic:"Easy to use",id:"c1f0723c07b408d7",expanded:!0,children:[{topic:"Use it like other mind map application",id:"c1f09612fd89920d"}]}]},{topic:"Basics",id:"bd1b66c4b56754d9",direction:0,expanded:!0,children:[{topic:"tab - Create a child node",id:"bd1b6892bcab126a"},{topic:"enter - Create a sibling node",id:"bd1b6b632a434b27"},{topic:"del - Remove a node",id:"bd1b983085187c0a"}]},{topic:"Focus mode",id:"bd1b9b94a9a7a913",direction:1,expanded:!0,children:[{topic:"Right click and select Focus Mode",id:"bd1bb2ac4bbab458"},{topic:"Right click and select Cancel Focus Mode",id:"bd1bb4b14d6697c3"}]},{topic:"Left menu",id:"bd1b9d1816ede134",direction:0,expanded:!0,children:[{topic:"Node distribution",id:"bd1ba11e620c3c1a",expanded:!0,children:[{topic:"Left",id:"bd1c1cb51e6745d3"},{topic:"Right",id:"bd1c1e12fd603ff6"},{topic:"Both l & r",id:"bd1c1f03def5c97b"}]}]},{topic:"Bottom menu",id:"bd1ba66996df4ba4",direction:1,expanded:!0,children:[{topic:"Full screen",id:"bd1ba81d9bc95a7e"},{topic:"Return to Center",id:"bd1babdd5c18a7a2"},{topic:"Zoom in",id:"bd1bae68e0ab186e"},{topic:"Zoom out",id:"bd1bb06377439977"}]},{topic:"Link",id:"bd1beff607711025",direction:0,expanded:!0,children:[{topic:"Right click and select Link",id:"bd1bf320da90046a"},{topic:"Click the target you want to link",id:"bd1bf6f94ff2e642"},{topic:"Modify link with control points",id:"bd1c0c4a487bd036"}]},{topic:"Node style",id:"bd1c217f9d0b20bd",direction:0,expanded:!0,children:[{topic:"Font Size",id:"bd1c24420cd2c2f5",style:{fontSize:"32",color:"#3298db"}},{topic:"Font Color",id:"bd1c2a59b9a2739c",style:{color:"#c0392c"}},{topic:"Background Color",id:"bd1c2de33f057eb4",style:{color:"#bdc3c7",background:"#2c3e50"}},{topic:"Add tags",id:"bd1cff58364436d0",tags:["Completed"]},{topic:"Add icons",id:"bd1d0317f7e8a61a",icons:["😂"],tags:["www"]},{topic:"Bolder",id:"bd41fd4ca32322a4",style:{fontWeight:"bold"}},{topic:"Hyper link",id:"bd41fd4ca32322a5",hyperLink:"https://github.com/ssshooter/mind-elixir-core"}]},{topic:"Draggable",id:"bd1f03fee1f63bc6",direction:1,expanded:!0,children:[{topic:"Drag a node to another node\nand the former one will become a child node of latter one",id:"bd1f07c598e729dc"}]},{topic:"TODO",id:"bd1facea32a1967c",direction:1,expanded:!0,children:[{topic:"Add image",id:"bd1fb1ec53010749"},{topic:"Free node (position)",id:"bd42d3e3bee992b9"},{topic:"Style adjustment",id:"beeb7f3db6ad6496"}]},{topic:"Export data",id:"beeb7586973430db",direction:1,expanded:!0,children:[{topic:"JSON",id:"beeb784cc189375f"},{topic:"HTML",id:"beeb7a6bec2d68f5"}]},{topic:"Caution",id:"bd42dad21aaf6bae",direction:0,style:{background:"#f1c40e"},expanded:!0,children:[{topic:"Only save manually",id:"bd42e1d0163ebf04",expanded:!0,children:[{topic:"Save button in the top-right corner",id:"bd42e619051878b3",expanded:!0,children:[]},{topic:"ctrl + S",id:"bd42e97d7ac35e99"}]}]}],expanded:!0},linkData:{}};return e=e.default})()));
package/dist/example2.js DELETED
@@ -1 +0,0 @@
1
- !function(e,d){"object"==typeof exports&&"object"==typeof module?module.exports=d():"function"==typeof define&&define.amd?define([],d):"object"==typeof exports?exports.example2=d():e.example2=d()}(self,(()=>(()=>{"use strict";var e={d:(d,c)=>{for(var t in c)e.o(c,t)&&!e.o(d,t)&&Object.defineProperty(d,t,{enumerable:!0,get:c[t]})},o:(e,d)=>Object.prototype.hasOwnProperty.call(e,d)},d={};e.d(d,{default:()=>c});const c={direction:1,theme:{name:"Dark",palette:["#848FA0","#748BE9","#D2F9FE","#4145A5","#789AFA","#706CF4","#EF987F","#775DD5","#FCEECF","#DA7FBC"],cssVar:{"--main-color":"#ffffff","--main-bgcolor":"#4c4f69","--color":"#cccccc","--bgcolor":"#252526"}},nodeData:{id:"me-root",topic:"HTML structure",root:!0,children:[{topic:"div.map-container",id:"33905a6bde6512e4",expanded:!0,children:[{topic:"div.map-canvas",id:"33905d3c66649e8f",tags:["A special case of a `grp` tag"],expanded:!0,children:[{topic:"me-root",id:"33906b754897b9b9",tags:["A special case of a `t` tag"],expanded:!0,children:[{topic:"ME-TPC",id:"33b5cbc93b9968ab"}]},{topic:"children.box",id:"33906db16ed7f956",expanded:!0,children:[{topic:"grp(group)",id:"33907d9a3664cc8a",expanded:!0,children:[{topic:"t(top)",id:"3390856d09415b95",expanded:!0,children:[{topic:"tpc(topic)",id:"33908dd36c7d32c5",expanded:!0,children:[{topic:"text",id:"3391630d4227e248"},{topic:"icons",id:"33916d74224b141f"},{topic:"tags",id:"33916421bfff1543"}],tags:["E() function return"]},{topic:"epd(expander)",id:"33909032ed7b5e8e",tags:["If had child"]}],tags:["createParent retun"]},{topic:"me-children",id:"339087e1a8a5ea68",expanded:!0,children:[{topic:"me-wrapper",id:"3390930112ea7367",tags:["what add node actually do is to append grp tag to children"]},{topic:"grp...",id:"3390940a8c8380a6"}],tags:["layoutChildren return"]},{topic:"svg.subLines",id:"33908986b6336a4f"}],tags:["have child"]},{topic:"me-wrapper",id:"339081c3c5f57756",expanded:!0,children:[{topic:"ME-PARENT",id:"33b6160ec048b997",expanded:!0,children:[{topic:"ME-TPC",id:"33b616f9fe7763fc"}]}],tags:["no child"]},{topic:"grp...",id:"33b61346707af71a"}]},{topic:"svg.lines",id:"3390707d68c0779d"},{topic:"svg.linkcontroller",id:"339072cb6cf95295"},{topic:"svg.topiclinks",id:"3390751acbdbdb9f"}]},{topic:"cmenu",id:"33905f95aeab942d"},{topic:"toolbar.rb",id:"339060ac0343f0d7"},{topic:"toolbar.lt",id:"3390622b29323de9"},{topic:"nmenu",id:"3390645e6d7c2b4e"}]}]},linkData:{}};return d=d.default})()));
@@ -1,13 +0,0 @@
1
- import './index.less';
2
- import './iconfont/iconfont.js';
3
- import type { MindElixirInstance, Options } from './types/index';
4
- export declare const E: (id: string, instance?: MindElixirInstance | undefined) => import("./types/dom").Topic;
5
- declare function MindElixir(this: MindElixirInstance, { el, direction, toolBar, keypress, newTopicName, mainLinkStyle, overflowHidden, mainNodeHorizontalGap, mainNodeVerticalGap, mobileMenu }: Options): Error | undefined;
6
- declare namespace MindElixir {
7
- var LEFT: number;
8
- var RIGHT: number;
9
- var SIDE: number;
10
- var version: string;
11
- var E: (id: string, instance?: MindElixirInstance | undefined) => import("./types/dom").Topic;
12
- }
13
- export default MindElixir;
@@ -1,45 +0,0 @@
1
- import type { Topic, Wrapper, Parent, Children, CustomSvg } from './dom';
2
- import type { MindElixirInstance, MindElixirData, NodeObj, LinkItem } from './index';
3
- export declare type Init = (this: MindElixirInstance, data: MindElixirData) => void;
4
- export declare type CreateInputDiv = (this: MindElixirInstance, el: Topic) => void;
5
- export declare type CreateWrapper = (this: MindElixirInstance, nodeObj: NodeObj, omitChildren?: boolean) => {
6
- grp: Wrapper;
7
- top: Parent;
8
- };
9
- export declare type CreateChildren = (this: MindElixirInstance, wrappers: Wrapper[]) => Children;
10
- export declare type CreateParent = (this: MindElixirInstance, nodeObj: NodeObj) => Parent;
11
- export declare type CreateTopic = (this: MindElixirInstance, nodeObj: NodeObj) => Topic;
12
- export declare type InsertNodeCommon = (this: MindElixirInstance, el?: Topic, node?: NodeObj) => void;
13
- export declare type RemoveNode = (this: MindElixirInstance, el?: Topic) => void;
14
- export declare type MoveNodeCommon = (this: MindElixirInstance, target?: Topic) => void;
15
- export declare type MoveNodeToCommon = (this: MindElixirInstance, from: Topic, to: Topic) => void;
16
- export declare type TNodeCopy = (this: MindElixirInstance, node: Topic, to: Topic) => void;
17
- export declare type AddChildFunction = (this: MindElixirInstance, nodeEle: Topic, node?: NodeObj) => {
18
- newTop: Parent;
19
- newNodeObj: NodeObj;
20
- } | null;
21
- export declare type ReshapeNode = (this: MindElixirInstance, tpc: Topic, patchData: NodeObj) => void;
22
- export declare type Layout = (this: MindElixirInstance) => void;
23
- export declare type LayoutChildren = (this: MindElixirInstance, data: NodeObj[], container?: Children, direction?: number) => Children;
24
- export declare type LinkDiv = (this: MindElixirInstance, mainNode?: Wrapper) => void;
25
- export declare type TraverseChildrenFunc = (children: HTMLCollection, parent: Parent, isFirst?: boolean) => string;
26
- export declare type JudgeDirection = (this: MindElixirInstance, mainNode: Wrapper, obj: NodeObj) => void;
27
- export declare type CreateLink = (this: MindElixirInstance, from: Topic, to: Topic, isInitPaint?: boolean, linkObj?: LinkItem) => void;
28
- export declare type RemoveLink = (this: MindElixirInstance, link?: CustomSvg) => void;
29
- export declare type SelectLink = (this: MindElixirInstance, link: CustomSvg) => void;
30
- export declare type LinkControllerData = {
31
- cx: number;
32
- cy: number;
33
- w: number;
34
- h: number;
35
- };
36
- export declare type ShowLinkController = (this: MindElixirInstance, p2x: number, p2y: number, p3x: number, p3y: number, linkItem: LinkItem, fromData: LinkControllerData, toData: LinkControllerData) => void;
37
- export declare type HideLinkController = (this: MindElixirInstance) => void;
38
- export declare type ExpandNode = (this: MindElixirInstance, el: Topic, isExpand?: boolean) => void;
39
- export declare type SelectNodeFunc = (this: MindElixirInstance, targetElement: Topic, isNewNode?: boolean, e?: MouseEvent) => void;
40
- export declare type CommonSelectFunc = (this: MindElixirInstance) => void;
41
- export declare type SiblingSelectFunc = (this: MindElixirInstance) => boolean;
42
- export declare type GetDataStringFunc = (this: MindElixirInstance) => string;
43
- export declare type GetDataFunc = (this: MindElixirInstance) => MindElixirData;
44
- export declare type RefreshFunc = (this: MindElixirInstance, data?: MindElixirData) => void;
45
- export declare type SetNodeTopic = (this: MindElixirInstance, el: Topic, topic: string) => void;
@@ -1,14 +0,0 @@
1
- import type { Topic } from './dom';
2
- import type { MindElixirInstance } from './index';
3
- export declare type CancelFocus = (this: MindElixirInstance) => void;
4
- export declare type InitLeft = (this: MindElixirInstance) => void;
5
- export declare type InitRight = (this: MindElixirInstance) => void;
6
- export declare type InitSide = (this: MindElixirInstance) => void;
7
- export declare type SetLocale = (this: MindElixirInstance, locale: string) => void;
8
- export declare type FocusNode = (this: MindElixirInstance, el: Topic) => void;
9
- export declare type EnableEdit = (this: MindElixirInstance) => void;
10
- export declare type DisableEdit = (this: MindElixirInstance) => void;
11
- export declare type Scale = (this: MindElixirInstance, val: number) => void;
12
- export declare type ToCenter = (this: MindElixirInstance) => void;
13
- export declare type MindElixirPlugin = (instance: MindElixirInstance) => void;
14
- export declare type Install = (this: MindElixirInstance, plugin: MindElixirPlugin) => void;
@@ -1,18 +0,0 @@
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
- };