@neo4j-nvl/base 0.3.1-fd6624ed → 0.3.2-e0e72a58

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.
@@ -16,7 +16,7 @@ export declare class ForceCytoLayout {
16
16
  getShouldUpdate(): boolean;
17
17
  getComputing(): boolean;
18
18
  updateNodes(positionList: any): void;
19
- getNodePositions(data: any): any[];
19
+ getNodePositions(data: any): import("../..").Node[];
20
20
  terminateUpdate(): void;
21
21
  destroy(): void;
22
22
  }
@@ -1,70 +1,86 @@
1
- export class PhysLayout {
2
- constructor(config: any);
3
- _physVbo: any;
4
- _physSmallVbo: any;
5
- _physProjection: mat4;
6
- _physSmallProjection: mat4;
7
- _gl: any;
8
- _averageNodeSize: number;
9
- shouldUpdate: boolean;
10
- iterationCount: number;
11
- lastSpeedValues: any[];
12
- rollingAvgGraphSpeed: number;
13
- nodeVariation: number;
14
- nodeCenterPoint: number[];
15
- peakIterationMultiplier: number;
16
- stateDisposers: any[];
17
- _state: any;
18
- _dpr: number;
1
+ import type { ForceDirectedOptions, NvlState } from '../../../modules/state';
2
+ import type { Node, Relationship } from '../../../types/graph-element';
3
+ import type { Point } from '../../../utils/geometry';
4
+ export declare class PhysLayout {
5
+ private physVbo;
6
+ private physSmallVbo;
7
+ private physProjection;
8
+ private physSmallProjection;
9
+ private gl;
10
+ private useReadpixelWorkaround;
11
+ private averageNodeSize;
12
+ private shouldUpdate;
13
+ private iterationCount;
14
+ private lastSpeedValues;
15
+ private rollingAvgGraphSpeed;
16
+ private nodeVariation;
17
+ private nodeCenterPoint;
18
+ private peakIterationMultiplier;
19
+ private stateDisposers;
20
+ private state;
21
+ private dpr;
22
+ private intelWorkaround;
23
+ private simulationStopVelocitySquared;
24
+ private gravity;
25
+ private force;
26
+ private nodeIdToIndex;
27
+ private nodeIndexToId;
28
+ private numNodes;
29
+ private solarMerger;
30
+ private subGraphs;
31
+ private nodeSortMap;
32
+ private firstUpdate;
33
+ private curPhysData;
34
+ private apprxRepForceShader;
35
+ private levelsClusterTexture;
36
+ private levelsFinestIndexTexture;
37
+ private initalLevelTexture;
38
+ private levelsData;
39
+ private collisionDetectionMultiplier;
40
+ private physShader;
41
+ private physData;
42
+ private workaroundData;
43
+ private pinData;
44
+ private updateData;
45
+ private updateShader;
46
+ private workaroundShader;
47
+ private physPositions;
48
+ private springTexture;
49
+ private sizeTexture;
50
+ private offsetTexture;
51
+ private pinTexture;
52
+ private addedNodes;
53
+ private updateTexture;
54
+ enableVerlet: boolean;
55
+ constructor(config: ForceDirectedOptions & {
56
+ webGLContext: WebGL2RenderingContext;
57
+ state: NvlState;
58
+ });
19
59
  /**
20
60
  * Sets the layout options
21
- * @param {Object} options the object with the options
22
- * @param {boolean} options.intelWorkaround whether to use the layout implementation for Intel GPUs
23
- * @param {Number} options.simulationStopVelocity the graph speed at which to stop the layout
24
- * @param {Number} options.gravity the force layout's gravity strength
61
+ * @param {ForceDirectedOptions} options the object with the options
25
62
  * @param {boolean} [initial=false] whether this is the first setting of options
26
63
  */
27
- setOptions(options: {
28
- intelWorkaround: boolean;
29
- simulationStopVelocity: number;
30
- gravity: number;
31
- }, initial?: boolean): void;
32
- intelWorkaround: boolean;
33
- enableVerlet: any;
34
- simulationStopVelocitySquared: number;
35
- gravity: number;
36
- force: any;
64
+ setOptions(options?: ForceDirectedOptions, initial?: boolean): void;
37
65
  /**
38
66
  * Sets graph data to be used
39
- * @param {Object} data the graph object
40
- * @param {Array<Object>} data.nodes the nodes in the graph
41
- * @param {Array<Object>} data.rels the relationships in the graph
42
- * @returns {Object} the top level graph of the subgraphs created by the solar merger
67
+ * @param {{ nodes: Node[]; rels: Relationship[] }} data the graph object
68
+ * @returns the top level graph of the subgraphs created by the solar merger
43
69
  */
44
70
  setData(data: {
45
- nodes: Array<any>;
46
- rels: Array<any>;
71
+ nodes: Node[];
72
+ rels: Relationship[];
47
73
  }): any;
48
- _nodeIdToIndex: {};
49
- _nodeIndexToId: {};
50
- _numNodes: any;
51
- solarMerger: SolarMerger;
52
- subGraphs: any[];
53
- nodeSortMap: {};
54
- _firstUpdate: boolean;
55
- _curPhysData: any;
56
74
  /**
57
75
  * Updates the node's positions for the next step in the physics layout iterations if the layout needs to update
58
- * @param {boolean} refreshPositions whether the entire layout should be reheated
59
- * @returns {boolean} whether the layout should update in the following step
76
+ * @param refreshPositions whether the entire layout should be reheated
77
+ * @returns whether the layout should update in the following step
60
78
  */
61
- update(refreshPositions: boolean): boolean;
62
- collisionDetectionMultiplier: number;
79
+ update(refreshPositions?: boolean): boolean;
63
80
  /**
64
81
  * Stops the layout
65
82
  */
66
83
  terminateUpdate(): void;
67
- addedNodes: {};
68
84
  /**
69
85
  * Returns whether the current layout needs to be updated in the next iteration step.
70
86
  * @returns {boolean} Whether the layout should update in the following step.
@@ -78,20 +94,23 @@ export class PhysLayout {
78
94
  getComputing(): boolean;
79
95
  /**
80
96
  * Adds the current x,y coordinates for each node to a given list of nodes.
81
- * @param {Array<Object>} nodeList The list of nodes to get positions for.
82
- * @returns {Array<Object>} The list of nodes containing the x,y coordinates on each node object.
97
+ * @param {Node[]} nodeList The list of nodes to get positions for.
98
+ * @returns {(Node & Point)[]} The list of nodes containing the x,y coordinates on each node object.
83
99
  */
84
- getNodePositions(nodeList: Array<any>): Array<any>;
100
+ getNodePositions(nodeList: Node[]): (Node & Point)[];
85
101
  /**
86
102
  * Reheats the layout
87
103
  * @param {Object} fullData The entire graph object.
88
104
  */
89
- reheat(fullData: any): void;
105
+ reheat(fullData: {
106
+ nodes: Node[];
107
+ rels?: Relationship[];
108
+ }): void;
90
109
  /**
91
110
  * Updates the existing nodes of a graph with a given list of updates
92
- * @param {Array<Object>} nodeList The list of updates.
111
+ * @param {Node[]} nodeList The list of updates.
93
112
  */
94
- updateNodes(nodeList: Array<any>): void;
113
+ updateNodes(nodeList: Node[]): void;
95
114
  /**
96
115
  * Adds and removes nodes from the graph based on given updates
97
116
  * @param {Object} fullData The entire graph object.
@@ -102,66 +121,37 @@ export class PhysLayout {
102
121
  * @param {Array<Object>} nodeChanges.removes A list of nodes to be removed.
103
122
  */
104
123
  addRemoveData(fullData: {
105
- nodes: Array<any>;
106
- rels: Array<any>;
124
+ nodes: Node[];
125
+ rels: Relationship[];
107
126
  }, nodeChanges: {
108
- adds: Array<any>;
109
- removes: Array<any>;
127
+ adds: Record<string, Node>;
128
+ removes: Record<string, Node>;
110
129
  }): any;
111
- _pinData: Uint8Array;
112
130
  /**
113
131
  * Destroys the class and all buffers and textures.
114
132
  */
115
133
  destroy(): void;
116
- _physPositions: Float32Array;
117
- _dumpTexture(framebuffer: any, numItems: any, msg: any): void;
118
- _getScaleNumber(iterationNo: any, delayedDecayFormula?: (iterationNo: any, p: any, lowerBar: any) => any): any;
119
- _getBaseLength(subGraphNodeCount: any): number;
120
- _checkForUpdates(fullRefresh?: boolean): void;
121
- _getNodePosition(nodeIndex: any): {
122
- x: any;
123
- y: any;
124
- };
125
- _getMaxSpeedSquared(): number;
126
- _getMedianSpeedSquared(addedNodes: any): number;
127
- _getPhysData(offset?: number): any;
128
- _getLevelData(offset?: number): any;
129
- _newTexture(gl: any, data: any, side: any, type?: any, internalformat?: any): any;
130
- _newFramebuffer(gl: any, texture: any): any;
131
- _checkCompatibility(gl: any): void;
132
- _useReadpixelWorkaround: boolean;
133
- _printGlStats(gl: any): void;
134
- _adjustToGlSize(size: any): number;
135
- _setupSize(data?: {
136
- nodes: any[];
137
- }): void;
138
- _sizeTexture: any;
139
- _setupSprings(data: any): void;
140
- connections: any;
141
- _offsetTexture: any;
142
- _springTexture: any;
143
- _setupPhysics(): void;
144
- _setupPhysicsForNodes(): void;
145
- _physData: any[];
146
- _physShader: Shader;
147
- _setupPhysicsForCoarse(): void;
148
- levelsData: any[];
149
- levelsClusterTexture: any[];
150
- levelsFinestIndexTexture: any[];
151
- initalLevelTexture: any;
152
- _apprxRepForceShader: Shader;
153
- _setupPinData(): void;
154
- _pinTexture: any;
155
- _setupUpdates(): void;
156
- _updateData: Float32Array;
157
- _updateTexture: any;
158
- _updateShader: Shader;
159
- _setupReadpixelWorkaround(): void;
160
- _workaroundShader: Shader;
161
- _workaroundData: any[];
162
- _doReadpixelWorkaround(): void;
163
- _definePhysicsArrays(): void;
134
+ private dumpTexture;
135
+ private getScaleNumber;
136
+ private getBaseLength;
137
+ private checkForUpdates;
138
+ private getNodePosition;
139
+ private getMaxSpeedSquared;
140
+ private getMedianSpeedSquared;
141
+ private getPhysData;
142
+ private newTexture;
143
+ private newFramebuffer;
144
+ private checkCompatibility;
145
+ private printGlStats;
146
+ private adjustToGlSize;
147
+ private setupSize;
148
+ private setupSprings;
149
+ private setupPhysics;
150
+ private setupPhysicsForNodes;
151
+ private setupPhysicsForCoarse;
152
+ private setupPinData;
153
+ private setupUpdates;
154
+ private setupReadpixelWorkaround;
155
+ private doReadpixelWorkaround;
156
+ private definePhysicsArrays;
164
157
  }
165
- import { mat4 } from 'gl-matrix';
166
- import SolarMerger from './solarmerger/SolarMerger';
167
- import Shader from '../../../modules/Shader';
@@ -1,7 +1,7 @@
1
1
  import type { BorderStyle } from '../../../modules/state';
2
2
  import type { Node, Relationship } from '../../../types/graph-element';
3
3
  import type { Point } from '../../../utils/geometry';
4
- import ImageCache from '../ImageCache';
4
+ import type ImageCache from '../ImageCache';
5
5
  import type ArrowBundle from './ArrowBundle';
6
6
  /**
7
7
  * This function calculates the difference in radius between two nodes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-nvl/base",
3
- "version": "0.3.1-fd6624ed",
3
+ "version": "0.3.2-e0e72a58",
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",
@@ -34,9 +34,9 @@
34
34
  "tsconfig": "./tsconfig.json"
35
35
  },
36
36
  "dependencies": {
37
- "@neo4j-nvl/layout-workers": "^0.3.1-fd6624ed",
37
+ "@neo4j-nvl/layout-workers": "^0.3.2-e0e72a58",
38
+ "@segment/analytics-next": "^1.70.0",
38
39
  "color-string": "^1.9.1",
39
- "contrast": "1.0.1",
40
40
  "d3-force": "^3.0.0",
41
41
  "gl-matrix": "^3.3.0",
42
42
  "glsl-inject-defines": "^1.0.3",
@@ -45,14 +45,15 @@
45
45
  "mobx": "^3.2.2",
46
46
  "node-pid-controller": "^1.0.1",
47
47
  "resizelistener": "^1.1.0",
48
+ "tinycolor2": "1.6.0",
48
49
  "uuid": "^8.3.2"
49
50
  },
50
51
  "devDependencies": {
51
- "@segment/analytics-next": "^1.70.0",
52
52
  "@types/color-string": "^1.5.5",
53
53
  "@types/d3-force": "^3.0.3",
54
54
  "@types/lodash": "4.14.202",
55
55
  "@types/segment-analytics": "0.0.38",
56
+ "@types/tinycolor2": "^1.4.6",
56
57
  "babel-loader": "^8.2.5",
57
58
  "copy-webpack-plugin": "^11.0.0",
58
59
  "eslint": "^8.38.0",
@@ -67,5 +68,5 @@
67
68
  "jest": "*",
68
69
  "typescript": "*"
69
70
  },
70
- "stableVersion": "0.3.1"
71
+ "stableVersion": "0.3.2"
71
72
  }