apextree 1.3.0 → 1.4.2

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 (42) hide show
  1. package/.editorconfig +7 -0
  2. package/.eslintignore +2 -0
  3. package/.eslintrc +9 -0
  4. package/.github/workflows/publish.yml +20 -0
  5. package/.husky/commit-msg +1 -0
  6. package/.husky/pre-push +1 -0
  7. package/.prettierrc +5 -0
  8. package/.vscode/settings.json +5 -0
  9. package/CHANGELOG.md +25 -0
  10. package/LICENSE +80 -0
  11. package/README.md +2 -0
  12. package/apextree.es.min.js +15673 -1530
  13. package/apextree.min.js +1 -1
  14. package/commitlint.config.js +5 -0
  15. package/demo/bottom_to_top_view.html +3 -3
  16. package/demo/custom_font_options.html +2 -2
  17. package/demo/dynamic_view_change.html +2 -2
  18. package/demo/expand_collapse_nodes.html +1 -1
  19. package/demo/group_leaf_nodes.html +118 -0
  20. package/demo/left_to_right_view.html +3 -3
  21. package/demo/per_node_options.html +7 -5
  22. package/demo/right_to_left_view.html +1 -2
  23. package/demo/top_to_bottom_view.html +1 -2
  24. package/globals.d.ts +4 -0
  25. package/lib/ApexTree.d.ts +4 -3
  26. package/lib/models/DagreGraph.d.ts +30 -0
  27. package/lib/models/Graph.d.ts +10 -24
  28. package/lib/models/GraphNode.d.ts +20 -0
  29. package/lib/models/GraphPoint.d.ts +4 -0
  30. package/lib/models/Paper.d.ts +22 -22
  31. package/lib/models/TreeNode.d.ts +15 -0
  32. package/lib/models/index.d.ts +3 -2
  33. package/lib/settings/DirectionConfig.d.ts +22 -30
  34. package/lib/settings/Options.d.ts +36 -26
  35. package/lib/utils/EdgeUtils.d.ts +3 -2
  36. package/lib/utils/GraphUtils.d.ts +4 -7
  37. package/package.json +24 -10
  38. package/tsconfig.json +28 -0
  39. package/webpack.common.ts +68 -0
  40. package/webpack.config.ts +7 -0
  41. package/webpack.dev.ts +12 -0
  42. package/webpack.prod.ts +9 -0
@@ -1,10 +1,7 @@
1
- import { Node, TreeNode } from '../models/Graph';
2
1
  import { TreeOptions } from '../settings/Options';
2
+
3
3
  export declare const setAttributes: (element: Element | null, attrs?: Record<string, any>) => void;
4
4
  export declare const ExpandCollapseButtonSize = 14;
5
- export declare const highlightToPath: (nodes: ReadonlyArray<TreeNode<Node>>, selfNode: TreeNode<Node>, isHighlighted: boolean, options: TreeOptions) => void;
6
- export declare const getTooltipStyles: (x: number, y: number, maxWidth: number, borderColor: string, bgColor: string, addPadding: boolean) => ReadonlyArray<string>;
7
- export declare const generateStyles: (styleObject?: Record<string, number | string>) => string;
8
- export declare const getTooltip: (tooltipId?: string) => HTMLElement;
9
- export declare const updateTooltip: (id?: string, styles?: string | undefined, content?: string) => void;
10
- export declare const camelToKebabCase: (str: string) => string;
5
+ export declare const highlightToPath: (selfNode: any, nodeMap: any, isHighlighted: boolean, options: TreeOptions) => void;
6
+ export declare function processNodes(data: any): Record<string, any>;
7
+ export declare function findParentsWithOnlyLeafNodes(tree: any): any[];
package/package.json CHANGED
@@ -1,23 +1,37 @@
1
1
  {
2
2
  "name": "apextree",
3
- "version": "1.3.0",
3
+ "version": "1.4.2",
4
4
  "dependencies": {
5
+ "@dagrejs/dagre": "^1.1.4",
5
6
  "@svgdotjs/svg.js": "^3.2.0",
6
- "@svgdotjs/svg.panzoom.js": "^2.1.2",
7
- "d3-flextree": "^2.1.2"
8
- },
9
- "peerDependencies": {
10
- "@svgdotjs/svg.js": "*",
11
7
  "@svgdotjs/svg.panzoom.js": "^2.1.2"
12
8
  },
13
9
  "type": "module",
14
- "typings": "./index.d.ts",
10
+ "types": "./index.d.ts",
15
11
  "main": "./apextree.min.js",
16
12
  "module": "./apextree.es.min.js",
13
+ "license": "See LICENSE in LICENSE",
17
14
  "exports": {
18
15
  ".": {
19
- "import": "./apextree.es.min.js",
20
- "require": "./apextree.min.js"
16
+ "import": {
17
+ "types": "./index.d.ts",
18
+ "default": "./apextree.es.min.js"
19
+ },
20
+ "require": {
21
+ "types": "./index.d.ts",
22
+ "default": "./apextree.min.js"
23
+ }
21
24
  }
25
+ },
26
+ "devDependencies": {
27
+ "@commitlint/cli": "^19.8.1",
28
+ "@commitlint/config-conventional": "^19.8.1",
29
+ "commitlint": "^19.8.1",
30
+ "husky": "^9.1.7",
31
+ "standard-version": "^9.5.0"
32
+ },
33
+ "scripts": {
34
+ "prepare": "husky",
35
+ "release": "standard-version"
22
36
  }
23
- }
37
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowSyntheticDefaultImports": true,
4
+ "baseUrl": ".",
5
+ "rootDir": ".",
6
+ "module": "commonjs",
7
+ "moduleResolution": "Node",
8
+ "resolveJsonModule": true,
9
+ "target": "es6",
10
+ "esModuleInterop": true,
11
+ "noImplicitAny": true,
12
+ "strictNullChecks": true,
13
+ "lib": [
14
+ "es2021",
15
+ "dom"
16
+ ]
17
+ },
18
+ "include": ["src/**/*"],
19
+ "exclude": [
20
+ "node_modules",
21
+ "dist",
22
+ ],
23
+ "ts-node": {
24
+ "esm": true,
25
+ "experimentalSpecifierResolution": "node"
26
+ },
27
+ "files": ["globals.d.ts"]
28
+ }
@@ -0,0 +1,68 @@
1
+ import path from 'path';
2
+ import {Compiler, Configuration, WebpackPluginInstance} from 'webpack';
3
+
4
+ export const ROOT = path.resolve(__dirname, '.');
5
+
6
+ interface CommonConfig extends Configuration {
7
+ plugins: (((this: Compiler, compiler: Compiler) => void) | WebpackPluginInstance)[];
8
+ }
9
+
10
+ export const commonConfig: CommonConfig = {
11
+ entry: [path.resolve(__dirname, 'src/ApexTree.ts')],
12
+ output: {
13
+ clean: true,
14
+ filename: 'ApexTree.js',
15
+ path: path.resolve(__dirname, 'dist'),
16
+ library: 'ApexTree',
17
+ libraryTarget: 'umd',
18
+ libraryExport: 'ApexTree',
19
+ },
20
+ module: {
21
+ rules: [
22
+ {
23
+ // Include ts, tsx, js, and jsx files.
24
+ test: /\.(ts|js)?$/,
25
+ include: [ROOT],
26
+ exclude: [/node_modules/],
27
+ use: [
28
+ {
29
+ loader: 'babel-loader',
30
+ options: {
31
+ // Rely on babel loading it's `babel.config.js` file. If we need to edit it for
32
+ // Hot Module Reloading support so be it.
33
+ // https://gist.github.com/rmoorman/94eeed830942758e218d92f15ce58d88
34
+ presets: [['@babel/preset-env', {targets: 'defaults'}]],
35
+ plugins: ['@babel/plugin-proposal-class-properties', '@babel/plugin-transform-runtime'],
36
+ },
37
+ },
38
+ ],
39
+ },
40
+ {
41
+ test: /\.ts?$/,
42
+ include: [ROOT],
43
+ exclude: [/node_modules/],
44
+ use: [
45
+ 'babel-loader',
46
+ {
47
+ loader: 'ts-loader',
48
+ options: {
49
+ configFile: 'tsconfig.json',
50
+ transpileOnly: true,
51
+ experimentalWatchApi: true,
52
+ },
53
+ },
54
+ ],
55
+ },
56
+ {test: /\.(less)$/, loader: 'asset/resource'},
57
+ {
58
+ test: /\.svg$/,
59
+ loader: 'raw-loader',
60
+ },
61
+ ],
62
+ },
63
+ resolve: {
64
+ modules: [__dirname, 'src', 'node_modules'],
65
+ extensions: ['.ts', '.js'],
66
+ },
67
+ plugins: [],
68
+ };
@@ -0,0 +1,7 @@
1
+ import {Configuration} from 'webpack';
2
+
3
+ export default (argv: any, env: any = {mode: 'production'}): Configuration => {
4
+ const mode = argv?.mode || env.mode;
5
+ const config: Configuration = require(`./webpack.${mode === 'development' ? 'dev' : 'prod'}`).default;
6
+ return config;
7
+ };
package/webpack.dev.ts ADDED
@@ -0,0 +1,12 @@
1
+ import {Configuration} from 'webpack';
2
+ import {commonConfig} from './webpack.common';
3
+
4
+ const config: Configuration = {
5
+ ...commonConfig,
6
+ mode: 'development',
7
+ optimization: {
8
+ minimize: false
9
+ },
10
+ };
11
+
12
+ export default config;
@@ -0,0 +1,9 @@
1
+ import {Configuration} from 'webpack';
2
+ import {commonConfig} from './webpack.common';
3
+
4
+ const config: Configuration = {
5
+ ...commonConfig,
6
+ mode: 'production',
7
+ };
8
+
9
+ export default config;