@neo4j-nvl/base 0.3.5 → 0.3.6-02e96ab6
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/dist/base.mjs +1 -1
- package/dist/base.mjs.LICENSE.txt +11 -0
- package/dist/types/index.d.ts +8 -4
- package/dist/types/layouts/animatedlayout/AnimatedLayout.d.ts +1 -1
- package/dist/types/layouts/forcedirectedlayout/cosebilkentlayout/CoseBilkentLayout.d.ts +3 -3
- package/dist/types/layouts/forcedirectedlayout/physlayout/PhysLayout.d.ts +1 -1
- package/dist/types/layouts/forcedirectedlayout/physlayout/solarmerger/SolarMerger.d.ts +1 -1
- package/dist/types/layouts/freeLayout/FreeLayout.d.ts +1 -1
- package/dist/types/layouts/gridLayout/GridLayout.d.ts +1 -1
- package/dist/types/layouts/hierarchicallayout/HierarchicalLayout.d.ts +2 -2
- package/dist/types/layouts/hierarchicallayout/constants.d.ts +1 -1
- package/dist/types/modules/ExternalCallbackHandler.d.ts +3 -0
- package/dist/types/modules/NvlController.d.ts +4 -2
- package/dist/types/modules/ZoomTransitionHandler.d.ts +3 -5
- package/dist/types/modules/performance.d.ts +2 -2
- package/dist/types/modules/state/constants.d.ts +9 -0
- package/dist/types/modules/state/state.d.ts +8 -0
- package/dist/types/modules/{state.d.ts → state/types.d.ts} +72 -16
- package/dist/types/modules/state/utils.d.ts +44 -0
- package/dist/types/modules/state/utils.test.d.ts +1 -0
- package/dist/types/renderers/canvasrenderer/CanvasRenderer.d.ts +2 -1
- package/dist/types/renderers/canvasrenderer/arrows/arrows.d.ts +8 -5
- package/dist/types/renderers/canvasrenderer/arrows/constants.d.ts +1 -6
- package/dist/types/renderers/canvasrenderer/nodes/nodes.d.ts +3 -2
- package/dist/types/renderers/canvasrenderer/util.d.ts +2 -2
- package/dist/types/renderers/canvasrenderer/wordwrap.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/Controller.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/Renderer.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/node-fragment-point.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/node-vertex-point.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/viewport-box-fragment.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/viewport-box-vertex.d.ts +1 -1
- package/dist/types/types/graph-element.d.ts +8 -2
- package/dist/types/utils/ariaUtils.d.ts +3 -0
- package/dist/types/utils/ariaUtils.test.d.ts +1 -0
- package/dist/types/utils/colorUtils.d.ts +14 -0
- package/dist/types/utils/colorUtils.test.d.ts +1 -0
- package/dist/types/utils/constants.d.ts +9 -2
- package/dist/types/utils/graphObjectUtils.d.ts +2 -1
- package/dist/types/utils/hittest.d.ts +1 -1
- package/dist/types/utils/jsDriverResultTransformer.d.ts +32 -0
- package/dist/types/utils/jsDriverResultTransformer.test.d.ts +1 -0
- package/dist/types/utils/webWorkerUtils.d.ts +3 -0
- package/dist/types/utils/webWorkerUtils.test.d.ts +1 -0
- package/dist/types/utils/zoomFunctions.d.ts +32 -1
- package/package.json +9 -4
- package/dist/types/utils/colorMapperFunctions.d.ts +0 -6
- /package/dist/types/modules/{state.test.d.ts → state/state.test.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import colorString from 'color-string';
|
|
2
|
+
/**
|
|
3
|
+
* Determines whether a black or white font color is more readable for a given background color
|
|
4
|
+
* @param {string} color The background color
|
|
5
|
+
* @returns {string} The font color that should be used @defaultValue '#fff'
|
|
6
|
+
*/
|
|
7
|
+
export declare const textColorForBackground: (color: string) => string;
|
|
8
|
+
export declare const colorToRGB: (color: string) => colorString.Color;
|
|
9
|
+
export declare const isValidColor: (color: unknown) => boolean;
|
|
10
|
+
export declare const rgbaToVec4: (rgba: number[]) => number[];
|
|
11
|
+
export declare const rgbToVec3: (rgb: number[]) => number[];
|
|
12
|
+
export declare const colorToUIntArray: (color: string) => number;
|
|
13
|
+
export declare const colorToVec3: (color: string) => number[];
|
|
14
|
+
export declare const colorToVec4: (color: string) => number[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -8,9 +8,16 @@ export declare const VerletSimulationStopVelocity = 0.1;
|
|
|
8
8
|
export declare const MappingEnd = 999999;
|
|
9
9
|
export declare const ActiveAnimDuration = 1000;
|
|
10
10
|
export declare const DefaultNodeSize = 25;
|
|
11
|
-
export declare const DefaultNodeColor = "#
|
|
11
|
+
export declare const DefaultNodeColor = "#FFDF81";
|
|
12
|
+
export declare const DefaultRelColor = "#818790";
|
|
12
13
|
export declare const DefaultRelWidth = 1;
|
|
13
|
-
export declare const
|
|
14
|
+
export declare const DisabledItemColor = "#EDEDED";
|
|
15
|
+
export declare const DisabledItemFontColor = "#DDDDDD";
|
|
16
|
+
export declare const DefaultShadowColor = "#CFD1D4";
|
|
17
|
+
export declare const DefaultSelectedInnerColor = "#F5F6F6";
|
|
18
|
+
export declare const DefaultSelectedOuterColor = "#8FE3E8";
|
|
19
|
+
export declare const TextColor = "#1A1B1D";
|
|
20
|
+
export declare const TextColorInverse = "#FFFFFF";
|
|
14
21
|
export declare const absFillStyle: {
|
|
15
22
|
position: string;
|
|
16
23
|
top: number;
|
|
@@ -9,9 +9,10 @@ export type FlatRel = Omit<Relationship & {
|
|
|
9
9
|
* Falls back to default rel color when relationships between two nodes have varying colors.
|
|
10
10
|
* Sums widths of relationships when more than one relationship exists between two nodes.
|
|
11
11
|
* @param {Relationship[]} relItems List of all relationships and their connected ids.
|
|
12
|
+
* @param {string} [disabledItemColor] The color to use for the disabled relationships
|
|
12
13
|
* @return {FlatRel[]} A flattened list of relationships.
|
|
13
14
|
*/
|
|
14
|
-
export declare const relItemsToFlatList: (relItems: Relationship[]) => FlatRel[];
|
|
15
|
+
export declare const relItemsToFlatList: (relItems: Relationship[], disabledItemColor?: string) => FlatRel[];
|
|
15
16
|
export declare const getAdjNodesMapAndRelMap: (rels: Relationship[]) => {
|
|
16
17
|
adjNodesMap: Record<string, Set<string>>;
|
|
17
18
|
relMap: Record<string, Relationship[]>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Node as DriverNode, Relationship as DriverRelationship, Path, Record } from 'neo4j-driver';
|
|
2
|
+
export declare const recordMapper: (record: Record) => any[];
|
|
3
|
+
export declare const recordCollector: (graphElements: (DriverNode | DriverRelationship | Path)[][]) => {
|
|
4
|
+
recordObjectMap: Map<any, any>;
|
|
5
|
+
nodes: any[];
|
|
6
|
+
relationships: any[];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Result transformer for the Neo4j JavaScript driver results to NVL graph elements.
|
|
10
|
+
* @example
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* import neo4j from "neo4j-driver";
|
|
14
|
+
* import { nvlResultTransformer, NVL } from "@neo4j-nvl/base";
|
|
15
|
+
*
|
|
16
|
+
* const driver = neo4j.driver("{uri}", neo4j.auth.basic("{user}", "{password}"));
|
|
17
|
+
* const nvlGraph = await driver.executeQuery(
|
|
18
|
+
* "MATCH (a)-[r]-(b) RETURN a,r,b LIMIT 25",
|
|
19
|
+
* {},
|
|
20
|
+
* { resultTransformer: nvlResultTransformer }
|
|
21
|
+
* );
|
|
22
|
+
*
|
|
23
|
+
* const nvl = new NVL(document.getElementById('viz'), nvlGraph.nodes, nvlGraph.relationships);
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @see {@link https://neo4j.com/docs/api/javascript-driver/current/class/lib6/result-transformers.js~ResultTransformers.html|ResultTransformers on Neo4j JS Driver API Docs}
|
|
27
|
+
*/
|
|
28
|
+
export declare const nvlResultTransformer: import("neo4j-driver-core/types/result-transformers").ResultTransformer<{
|
|
29
|
+
recordObjectMap: Map<any, any>;
|
|
30
|
+
nodes: any[];
|
|
31
|
+
relationships: any[];
|
|
32
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,19 +2,50 @@ import type { Node } from '../index';
|
|
|
2
2
|
import type { Point } from './geometry';
|
|
3
3
|
declare const getExtremeLimits: (nodePositions: Point[]) => Point[];
|
|
4
4
|
declare const getMaxDistance: (extremeLimits?: Point[]) => number;
|
|
5
|
+
/**
|
|
6
|
+
* Gets the center choordinates and the width and height for the given node positions
|
|
7
|
+
* @param {Point[] | Node[]} nodePositions - The node positions
|
|
8
|
+
* @param {number} maxNodeRadius - The maximum node radius
|
|
9
|
+
* @returns An object with the center x and y coordinates and the width and height
|
|
10
|
+
*/
|
|
5
11
|
declare const getPositionBoundaries: (nodePositions?: Point[] | Node[], maxNodeRadius?: number) => {
|
|
6
12
|
centerX: number;
|
|
7
13
|
centerY: number;
|
|
8
14
|
nodesWidth: number;
|
|
9
15
|
nodesHeight: number;
|
|
10
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Gets the required zoom level for the given view and scene dimensions to fit the scene into the view
|
|
19
|
+
* @param {number} viewWidth - The width of the required view
|
|
20
|
+
* @param {number} viewHeight - The height of the required view
|
|
21
|
+
* @param {number} sceneWidth - The width of the canvas scene
|
|
22
|
+
* @param {number} sceneHeight - The height of the canvas scene
|
|
23
|
+
* @returns An object with the zoom level for the x and y axis
|
|
24
|
+
*/
|
|
11
25
|
declare const getZoomLevel: (viewWidth: number, viewHeight: number, sceneWidth: number, sceneHeight: number) => {
|
|
12
26
|
zoomX: number;
|
|
13
27
|
zoomY: number;
|
|
14
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* Creates a zoom target based on the given zoom levels and the min and max zoom level
|
|
31
|
+
* @param {number} zoomX - The zoom level for the x axis
|
|
32
|
+
* @param {number} zoomY - The zoom level for the y axis
|
|
33
|
+
* @param {number} minZoom - The minimum zoom level
|
|
34
|
+
* @param {number} maxZoom - The maximum zoom level
|
|
35
|
+
* @returns The zoom target
|
|
36
|
+
*/
|
|
15
37
|
declare const createZoomTarget: (zoomX: number, zoomY: number, minZoom?: number, maxZoom?: number) => number;
|
|
38
|
+
/**
|
|
39
|
+
* Gets the zoom target to fit the given node positions into the scene
|
|
40
|
+
* @param {Point[]} nodePositions - The node positions
|
|
41
|
+
* @param {number} containerWidth - The width of the container NVL is displayed in
|
|
42
|
+
* @param {number} containerHeight - The height of the container NVL is displayed in
|
|
43
|
+
* @param {number} maxNodeRadius - The maximum node radius, which is added as margin to the scene (defaults to `50`)
|
|
44
|
+
* @returns
|
|
45
|
+
*/
|
|
46
|
+
declare const getZoomTargetForNodePositions: (nodePositions: Point[], containerWidth: number, containerHeight: number, maxNodeRadius?: number) => number;
|
|
16
47
|
declare const getFlexibleZoomLimit: (nodePositions: Point[], rect: HTMLCanvasElement, maxNodeRadius: number) => number;
|
|
17
48
|
declare const getNewZoomWithinLimits: (newZoom: number, oldZoom: number, minZoom: number, maxZoom: number) => number;
|
|
18
49
|
declare const isZoomOutAtLimit: (newZoom: number, oldZoom: number, zoomOutLimit: number) => boolean;
|
|
19
50
|
declare const getDynamicZoom: (nodePositions: Point[] & Node[], minZoom: number, maxZoom: number, rect: HTMLCanvasElement, newZoom: number, currentZoom: number) => number;
|
|
20
|
-
export { getFlexibleZoomLimit, isZoomOutAtLimit, getNewZoomWithinLimits, getExtremeLimits, getMaxDistance, getPositionBoundaries, getZoomLevel, createZoomTarget, getDynamicZoom };
|
|
51
|
+
export { getFlexibleZoomLimit, getZoomTargetForNodePositions, isZoomOutAtLimit, getNewZoomWithinLimits, getExtremeLimits, getMaxDistance, getPositionBoundaries, getZoomLevel, createZoomTarget, getDynamicZoom };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-nvl/base",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6-02e96ab6",
|
|
4
4
|
"license": "SEE LICENSE IN 'LICENSE.txt'",
|
|
5
5
|
"homepage": "https://neo4j.com/docs/nvl/current/",
|
|
6
6
|
"description": "Base library for the Neo4j Visualization Library",
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"build": "yarn global:tsc && webpack",
|
|
23
23
|
"watch": "concurrently 'tsc -w' 'webpack -w' -k -n 'tsc,webpack' -c 'cyan,magenta'",
|
|
24
24
|
"test": "yarn global:jest",
|
|
25
|
-
"eslint": "yarn global:eslint ./src/
|
|
25
|
+
"eslint": "yarn global:eslint ./src/",
|
|
26
26
|
"coverage": "yarn test --coverage --silent",
|
|
27
27
|
"prepack": "cp ../../LICENSE.txt ./",
|
|
28
28
|
"postpack": "rm LICENSE.txt"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@neo4j-nvl/layout-workers": "0.3.
|
|
31
|
+
"@neo4j-nvl/layout-workers": "0.3.6-02e96ab6",
|
|
32
32
|
"@segment/analytics-next": "^1.70.0",
|
|
33
33
|
"color-string": "^1.9.1",
|
|
34
34
|
"d3-force": "^3.0.0",
|
|
@@ -50,8 +50,13 @@
|
|
|
50
50
|
"@types/tinycolor2": "^1.4.6",
|
|
51
51
|
"babel-loader": "^8.2.5",
|
|
52
52
|
"copy-webpack-plugin": "^11.0.0",
|
|
53
|
+
"neo4j-driver": "^5.26.0",
|
|
53
54
|
"typedoc": "^0.23.15",
|
|
54
55
|
"webpack": "^5.75.0",
|
|
55
56
|
"webpack-cli": "^5.0.0"
|
|
56
|
-
}
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"neo4j-driver": "*"
|
|
60
|
+
},
|
|
61
|
+
"stableVersion": "0.3.6"
|
|
57
62
|
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Determines whether a black or white font color is more readable for a given background color
|
|
3
|
-
* @param {string} color The background color
|
|
4
|
-
* @returns {string} The font color that should be used @defaultValue '#fff'
|
|
5
|
-
*/
|
|
6
|
-
export declare const textColorForBackground: (color: string) => string;
|
|
File without changes
|