@neo4j-nvl/base 0.3.8-950b8eb7 → 0.3.8-9dc481fc
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/LICENSE.txt +3 -48
- package/dist/base.mjs +1 -1
- package/dist/types/layouts/forcedirectedlayout/physlayout/PhysLayout.d.ts +7 -8
- package/dist/types/layouts/forcedirectedlayout/physlayout/solarmerger/SolarMerger.d.ts +39 -17
- package/dist/types/layouts/forcedirectedlayout/physlayout/solarmerger/solar-placer.d.ts +1 -4
- package/dist/types/modules/CallbackHelper.d.ts +1 -1
- package/dist/types/modules/ExternalCallbackHandler.d.ts +3 -0
- package/dist/types/renderers/canvasrenderer/arrows/ArrowBundle.d.ts +3 -3
- package/dist/types/renderers/canvasrenderer/arrows/ArrowBundler.d.ts +1 -1
- package/package.json +4 -3
- package/dist/types/layouts/forcedirectedlayout/physlayout/solarmerger/types.d.ts +0 -48
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import type { ForceDirectedOptions, NvlState } from '../../../modules/state/types';
|
|
2
2
|
import type { Node, Relationship } from '../../../types/graph-element';
|
|
3
3
|
import type { Point } from '../../../utils/geometry';
|
|
4
|
-
import type { CoarsenedGraph } from './solarmerger/types';
|
|
5
4
|
export declare class PhysLayout {
|
|
6
5
|
private physVbo;
|
|
7
6
|
private physSmallVbo;
|
|
8
7
|
private physProjection;
|
|
9
8
|
private physSmallProjection;
|
|
10
9
|
private gl;
|
|
11
|
-
private
|
|
10
|
+
private useReadpixelWorkaround;
|
|
12
11
|
private averageNodeSize;
|
|
13
12
|
private shouldUpdate;
|
|
14
13
|
private iterationCount;
|
|
@@ -32,10 +31,10 @@ export declare class PhysLayout {
|
|
|
32
31
|
private nodeSortMap;
|
|
33
32
|
private firstUpdate;
|
|
34
33
|
private curPhysData;
|
|
35
|
-
private
|
|
34
|
+
private apprxRepForceShader;
|
|
36
35
|
private levelsClusterTexture;
|
|
37
36
|
private levelsFinestIndexTexture;
|
|
38
|
-
private
|
|
37
|
+
private initalLevelTexture;
|
|
39
38
|
private levelsData;
|
|
40
39
|
private collisionDetectionMultiplier;
|
|
41
40
|
private physShader;
|
|
@@ -71,7 +70,7 @@ export declare class PhysLayout {
|
|
|
71
70
|
setData(data: {
|
|
72
71
|
nodes: Node[];
|
|
73
72
|
rels: Relationship[];
|
|
74
|
-
}):
|
|
73
|
+
}): any;
|
|
75
74
|
/**
|
|
76
75
|
* Updates the node's positions for the next step in the physics layout iterations if the layout needs to update
|
|
77
76
|
* @param refreshPositions whether the entire layout should be reheated
|
|
@@ -127,7 +126,7 @@ export declare class PhysLayout {
|
|
|
127
126
|
}, nodeChanges: {
|
|
128
127
|
adds: Record<string, Node>;
|
|
129
128
|
removes: Record<string, Node>;
|
|
130
|
-
}):
|
|
129
|
+
}): any;
|
|
131
130
|
/**
|
|
132
131
|
* Destroys the class and all buffers and textures.
|
|
133
132
|
*/
|
|
@@ -152,7 +151,7 @@ export declare class PhysLayout {
|
|
|
152
151
|
private setupPhysicsForCoarse;
|
|
153
152
|
private setupPinData;
|
|
154
153
|
private setupUpdates;
|
|
155
|
-
private
|
|
156
|
-
private
|
|
154
|
+
private setupReadpixelWorkaround;
|
|
155
|
+
private doReadpixelWorkaround;
|
|
157
156
|
private definePhysicsArrays;
|
|
158
157
|
}
|
|
@@ -1,21 +1,43 @@
|
|
|
1
|
-
import type { Node, Relationship } from '../../../../types/graph-element';
|
|
2
|
-
import type { CoarsenedGraph, SolarNode, SolarRelationship } from './types';
|
|
3
1
|
export default class SolarMerger {
|
|
2
|
+
constructor(graph: any, nodeIdToIndex: any);
|
|
4
3
|
graph: {
|
|
5
|
-
nodes:
|
|
6
|
-
relationships:
|
|
7
|
-
idToRel:
|
|
4
|
+
nodes: any[];
|
|
5
|
+
relationships: any[];
|
|
6
|
+
idToRel: {};
|
|
7
|
+
};
|
|
8
|
+
subGraphs: any[];
|
|
9
|
+
sunMap: {};
|
|
10
|
+
constructGraphObjects(graph: any, nodeIdToIndex: any): {
|
|
11
|
+
nodes: any[];
|
|
12
|
+
relationships: any[];
|
|
13
|
+
idToRel: {};
|
|
14
|
+
};
|
|
15
|
+
relIdMap: any[];
|
|
16
|
+
coarsenTo(targetSize: any): {
|
|
17
|
+
nodes: any[];
|
|
18
|
+
relationships: any[];
|
|
19
|
+
idToRel: {};
|
|
20
|
+
};
|
|
21
|
+
nodeSortMap: {};
|
|
22
|
+
coarsenBy(levelToCoarsenBy: any): {
|
|
23
|
+
nodes: any[];
|
|
24
|
+
relationships: any[];
|
|
25
|
+
idToRel: {};
|
|
26
|
+
};
|
|
27
|
+
coarsen({ nodes, relationships }: {
|
|
28
|
+
nodes: any;
|
|
29
|
+
relationships: any;
|
|
30
|
+
}, firstIteration: any): {
|
|
31
|
+
output: {
|
|
32
|
+
nodes: {
|
|
33
|
+
id: any;
|
|
34
|
+
}[];
|
|
35
|
+
relationships: any[];
|
|
36
|
+
};
|
|
37
|
+
sortedInput: {
|
|
38
|
+
nodes: any[];
|
|
39
|
+
relationships: any[];
|
|
40
|
+
};
|
|
41
|
+
nodeSortMap: {};
|
|
8
42
|
};
|
|
9
|
-
subGraphs: CoarsenedGraph[];
|
|
10
|
-
sunMap: Record<string, string>;
|
|
11
|
-
relIdMap: string[][];
|
|
12
|
-
nodeSortMap?: Record<number, number>;
|
|
13
|
-
constructor(inputGraph: {
|
|
14
|
-
nodes: Node[];
|
|
15
|
-
rels: Relationship[];
|
|
16
|
-
}, nodeIdToIndex: Record<string, number>);
|
|
17
|
-
private constructGraphObjects;
|
|
18
|
-
coarsenTo(targetSize: number): CoarsenedGraph;
|
|
19
|
-
coarsenBy(levelToCoarsenBy: number): CoarsenedGraph;
|
|
20
|
-
private coarsen;
|
|
21
43
|
}
|
|
@@ -1,5 +1,2 @@
|
|
|
1
1
|
import type { Point } from '../../../../utils/geometry';
|
|
2
|
-
export declare const calculatePositions: (centre: Point, r: number, noOfChildren: number) =>
|
|
3
|
-
x: number;
|
|
4
|
-
y: number;
|
|
5
|
-
}[];
|
|
2
|
+
export declare const calculatePositions: (centre: Point, r: number, noOfChildren: number) => any[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ExternalCallbacks } from './ExternalCallbackHandler';
|
|
2
|
-
type CallbackFunction = ExternalCallbacks[
|
|
2
|
+
type CallbackFunction = ExternalCallbacks[keyof ExternalCallbacks];
|
|
3
3
|
/**
|
|
4
4
|
* A class for registering and calling callbacks
|
|
5
5
|
* @example
|
|
@@ -9,6 +9,8 @@ export interface ExternalCallbacks {
|
|
|
9
9
|
onLayoutStep?: (p: Node[]) => void;
|
|
10
10
|
/** Triggered when NVL throws an error after initialization. */
|
|
11
11
|
onError?: (error: Error) => void;
|
|
12
|
+
/** Triggered when NVL is initialized. */
|
|
13
|
+
onInitialization?: () => void;
|
|
12
14
|
/** Triggered when a asynchronous layout calculation starts/stops. */
|
|
13
15
|
onLayoutComputing?: (isComputing: boolean) => void;
|
|
14
16
|
onWebGLContextLost?: (webGLContextEvent: WebGLContextEvent) => void;
|
|
@@ -20,6 +22,7 @@ export declare const isExternalCallback: (callback: unknown) => callback is keyo
|
|
|
20
22
|
export default class ExternalCallbackHandler {
|
|
21
23
|
callbacks: ExternalCallbacks;
|
|
22
24
|
constructor(externalCallbacks?: ExternalCallbacks);
|
|
25
|
+
onInitialization(): void;
|
|
23
26
|
onZoomTransitionDone(): void;
|
|
24
27
|
onLayoutDone(): void;
|
|
25
28
|
onLayoutStep(p: Node[]): void;
|
|
@@ -12,9 +12,7 @@ export interface LabelGeometry {
|
|
|
12
12
|
*/
|
|
13
13
|
export default class ArrowBundle {
|
|
14
14
|
key: string;
|
|
15
|
-
rels:
|
|
16
|
-
rel: Relationship;
|
|
17
|
-
}[];
|
|
15
|
+
rels: Map<string, Relationship>;
|
|
18
16
|
waypointPath: WaypointPath;
|
|
19
17
|
readonly selfReferring: boolean;
|
|
20
18
|
fromId: string;
|
|
@@ -33,6 +31,7 @@ export default class ArrowBundle {
|
|
|
33
31
|
*/
|
|
34
32
|
insert(rel: Relationship): void;
|
|
35
33
|
setLabelInfo(relId: string, labelInfo: LabelGeometry): void;
|
|
34
|
+
has({ id }: Relationship): boolean;
|
|
36
35
|
/**
|
|
37
36
|
* Remove an arrow from the bundle
|
|
38
37
|
* @param {Relationship} rel - The arrow to remove
|
|
@@ -43,6 +42,7 @@ export default class ArrowBundle {
|
|
|
43
42
|
* @returns {number} The size of the arrow bundle
|
|
44
43
|
*/
|
|
45
44
|
size(): number;
|
|
45
|
+
relArray(): Relationship[];
|
|
46
46
|
/**
|
|
47
47
|
* Get the maximum font size of the arrows in the bundle
|
|
48
48
|
* @returns {number} The maximum font size of the arrows in the bundle
|
|
@@ -17,7 +17,7 @@ export default class ArrowBundler {
|
|
|
17
17
|
* @param {Record<string, Relationship>} removedRels - The removed relations
|
|
18
18
|
* @param {Record<string, WaypointPath>} waypoints - The waypoints
|
|
19
19
|
*/
|
|
20
|
-
updateData(addedRels: Record<string, Relationship>, removedRels: Record<string, Relationship>, waypoints: Record<string, WaypointPath>): void;
|
|
20
|
+
updateData(addedRels: Record<string, Relationship>, removedRels: Record<string, Relationship>, updatedRels: Record<string, Relationship>, waypoints: Record<string, WaypointPath>): void;
|
|
21
21
|
/**
|
|
22
22
|
* Updates the positions of the arrow bundles based on the provided `positionMap`.
|
|
23
23
|
* @param positionMap A map of node IDs to positions.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-nvl/base",
|
|
3
|
-
"version": "0.3.8-
|
|
3
|
+
"version": "0.3.8-9dc481fc",
|
|
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",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "yarn global:tsc && webpack",
|
|
23
|
-
"
|
|
23
|
+
"build:dev": "yarn global:tsc && webpack --mode development",
|
|
24
|
+
"watch": "concurrently 'tsc -w' 'webpack -w --mode development' -k -n 'tsc,webpack' -c 'cyan,magenta'",
|
|
24
25
|
"test": "yarn global:jest",
|
|
25
26
|
"eslint": "yarn global:eslint ./src/",
|
|
26
27
|
"coverage": "yarn test --coverage --silent",
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
"postpack": "rm LICENSE.txt && rm CHANGELOG.md"
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"@neo4j-nvl/layout-workers": "0.3.8-
|
|
32
|
+
"@neo4j-nvl/layout-workers": "0.3.8-9dc481fc",
|
|
32
33
|
"@segment/analytics-next": "^1.70.0",
|
|
33
34
|
"color-string": "^1.9.1",
|
|
34
35
|
"d3-force": "^3.0.0",
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { Node } from '../../../../types/graph-element';
|
|
2
|
-
export interface SolarNode extends Node {
|
|
3
|
-
id: string;
|
|
4
|
-
solarId: number;
|
|
5
|
-
weight?: number;
|
|
6
|
-
finestIndex?: number;
|
|
7
|
-
originalId?: string;
|
|
8
|
-
position?: {
|
|
9
|
-
x: number;
|
|
10
|
-
y: number;
|
|
11
|
-
};
|
|
12
|
-
placement?: {
|
|
13
|
-
x: number;
|
|
14
|
-
y: number;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export interface SolarRelationship {
|
|
18
|
-
id: string;
|
|
19
|
-
from: string;
|
|
20
|
-
to: string;
|
|
21
|
-
}
|
|
22
|
-
export interface CoarsenedGraph {
|
|
23
|
-
nodes: Sun[];
|
|
24
|
-
relationships: number[][];
|
|
25
|
-
idToRel: Record<string, SolarRelationship>;
|
|
26
|
-
}
|
|
27
|
-
export interface Sun extends SolarNode {
|
|
28
|
-
planets?: Planet[];
|
|
29
|
-
solarSize?: () => number;
|
|
30
|
-
children?: () => Planet[];
|
|
31
|
-
previousIndex?: number;
|
|
32
|
-
}
|
|
33
|
-
export interface Planet extends SolarNode {
|
|
34
|
-
parent: Sun;
|
|
35
|
-
sunId: number;
|
|
36
|
-
moons: Moon[];
|
|
37
|
-
solarSize: () => number;
|
|
38
|
-
children: () => Moon[];
|
|
39
|
-
}
|
|
40
|
-
export interface Moon extends SolarNode {
|
|
41
|
-
parent: Planet;
|
|
42
|
-
sunId: number;
|
|
43
|
-
solarSize: () => number;
|
|
44
|
-
}
|
|
45
|
-
export type Celestial = Sun | Planet | Moon;
|
|
46
|
-
export declare const isSun: (node: SolarNode | Celestial) => node is Sun;
|
|
47
|
-
export declare const isPlanet: (node: SolarNode | Celestial) => node is Planet;
|
|
48
|
-
export declare const isMoon: (node: SolarNode | Celestial) => node is Moon;
|