@neo4j-nvl/base 0.3.7 → 0.3.8-00226a59
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/CHANGELOG.md +37 -0
- package/LICENSE.txt +3 -48
- package/dist/base.mjs +1 -1
- package/dist/types/layouts/forcedirectedlayout/physlayout/shaders/multilevel-repulsive-fragment-verlet.d.ts +1 -1
- 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/dist/types/utils/constants.d.ts +1 -1
- package/dist/types/utils/jsDriverResultTransformer.d.ts +4 -1
- package/package.json +6 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "precision mediump float;\nuniform sampler2D u_physData;\nuniform sampler2D u_clusterData;\nuniform sampler2D u_finestIndexes;\nuniform sampler2D u_prevForce;\n\nuniform float u_baseLength;\nuniform float u_numNodes;\nuniform float u_iterationMultiplier;\nuniform float u_isTopLevel;\n\nfloat PI = 3.1415926535897932384626433832795;\nfloat TIMESTEP = 1.0 / 30.0;\nfloat VELOCITYDECAY = 0
|
|
1
|
+
declare const _default: "precision mediump float;\nuniform sampler2D u_physData;\nuniform sampler2D u_clusterData;\nuniform sampler2D u_finestIndexes;\nuniform sampler2D u_prevForce;\n\nuniform float u_baseLength;\nuniform float u_numNodes;\nuniform float u_iterationMultiplier;\nuniform float u_isTopLevel;\n\nfloat PI = 3.1415926535897932384626433832795;\nfloat TIMESTEP = 1.0 / 30.0;\nfloat VELOCITYDECAY = 1.0;\n\nvec4 getTextureData(sampler2D texture, float index, float base) {\n float x = mod(index, base);\n float y = (index - x) / base;\n return texture2D(texture, vec2(x + 0.5, y + 0.5) / base);\n}\n\nfloat getSquaredLogClusterWeight(float value) {\n return pow(log(value), 2.0);\n}\n\nvoid main(void) {\n float index = (gl_FragCoord.x - 0.5) + (gl_FragCoord.y - 0.5) * 256.0;\n\n if (index >= u_numNodes) {\n discard;\n }\n\n vec4 clusterData = getTextureData(u_clusterData, index, 256.0);\n\n float clusterIndex = clusterData.x;\n float clusterStartIndex = clusterData.y;\n float clusterSize = clusterData.z;\n float clusterArea = pow(clusterSize + u_baseLength * 2.0, 2.0);\n\n float finestIndex = getTextureData(u_finestIndexes, index, 256.0).a;\n vec4 myPosition = getTextureData(u_physData, finestIndex, 256.0);\n vec4 previousForce = getTextureData(u_prevForce, clusterIndex, 256.0);\n float fScale = 1.0 + sqrt(u_iterationMultiplier);\n\n vec2 acceleration = previousForce.xy;\n\n // Repulsion & Collision Detection\n for (float i = 0.0; i < 256.0 * 256.0; i++) {\n if (i >= clusterStartIndex + clusterSize || i >= u_numNodes) {\n break;\n }\n if (i < clusterStartIndex || i == index) {\n continue;\n }\n\n vec4 otherClusterData = getTextureData(u_clusterData, i, 256.0);\n float otherClusterWeight = getSquaredLogClusterWeight(otherClusterData.w);\n\n float otherFinestIndex = getTextureData(u_finestIndexes, i, 256.0).a;\n vec4 otherPosition = getTextureData(u_physData, otherFinestIndex, 256.0);\n\n vec2 delta = myPosition.xy - otherPosition.xy;\n float dist = max(length(delta), 0.0000001);\n float maxDist = 25.0;\n float repulsionForceScale = 0.1;\n\n float F = (clusterArea * fScale) / (dist * dist);\n\n if (u_isTopLevel == 1.0) {\n repulsionForceScale = 0.2;\n }\n\n acceleration += ((delta / sqrt(dist)) * F) * repulsionForceScale * otherClusterWeight;\n\n if (dist < maxDist) {\n float collide = (maxDist - dist) / (dist * dist);\n acceleration += delta * collide * fScale * maxDist / (maxDist + 1.0);\n }\n }\n\n gl_FragColor = vec4(acceleration, vec2(finestIndex, 0));\n}";
|
|
2
2
|
export default _default;
|
|
@@ -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.
|
|
@@ -4,7 +4,7 @@ export declare const MaxIndexBuffer = 65536;
|
|
|
4
4
|
export declare const MinRelLength = 100;
|
|
5
5
|
export declare const Gravity = 100;
|
|
6
6
|
export declare const SimulationStopVelocity = 100;
|
|
7
|
-
export declare const VerletSimulationStopVelocity = 0.
|
|
7
|
+
export declare const VerletSimulationStopVelocity = 0.25;
|
|
8
8
|
export declare const MappingEnd = 999999;
|
|
9
9
|
export declare const ActiveAnimDuration = 1000;
|
|
10
10
|
export declare const DefaultNodeSize = 25;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Node as DriverNode, Relationship as DriverRelationship, Path, Record } from 'neo4j-driver';
|
|
2
2
|
export declare const recordMapper: (record: Record) => any[];
|
|
3
|
-
|
|
3
|
+
type GraphElement = DriverNode | DriverRelationship | Path;
|
|
4
|
+
type NestedGraphElements = GraphElement | NestedGraphElements[];
|
|
5
|
+
export declare const recordCollector: (graphElements: NestedGraphElements[]) => {
|
|
4
6
|
recordObjectMap: Map<any, any>;
|
|
5
7
|
nodes: any[];
|
|
6
8
|
relationships: any[];
|
|
@@ -30,3 +32,4 @@ export declare const nvlResultTransformer: import("neo4j-driver-core/types/resul
|
|
|
30
32
|
nodes: any[];
|
|
31
33
|
relationships: any[];
|
|
32
34
|
}>;
|
|
35
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-nvl/base",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8-00226a59",
|
|
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.
|
|
32
|
+
"@neo4j-nvl/layout-workers": "0.3.8-00226a59",
|
|
32
33
|
"@segment/analytics-next": "^1.70.0",
|
|
33
34
|
"color-string": "^1.9.1",
|
|
34
35
|
"d3-force": "^3.0.0",
|
|
@@ -57,5 +58,6 @@
|
|
|
57
58
|
},
|
|
58
59
|
"peerDependencies": {
|
|
59
60
|
"neo4j-driver": "*"
|
|
60
|
-
}
|
|
61
|
+
},
|
|
62
|
+
"stableVersion": "0.3.8"
|
|
61
63
|
}
|