@neo4j-nvl/base 1.2.0-158df7fc → 1.2.0-36beb1e1
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/types/layouts/animatedlayout/AnimatedLayout.d.ts +2 -2
- package/dist/types/layouts/d3forcelayout/d3ForceLayout.d.ts +2 -2
- package/dist/types/layouts/forcedirectedlayout/physlayout/PhysLayout.d.ts +8 -2
- package/dist/types/layouts/freeLayout/FreeLayout.d.ts +2 -4
- package/dist/types/layouts/gridLayout/GridLayout.d.ts +2 -6
- package/dist/types/modules/NvlController.d.ts +2 -0
- package/dist/types/modules/dataset.d.ts +2 -1
- package/dist/types/modules/state/types.d.ts +6 -15
- package/dist/types/renderers/domrenderer/canvasrenderer/arrowDrawing.d.ts +2 -16
- package/dist/types/renderers/domrenderer/shared/arrows/arrows.d.ts +4 -6
- package/dist/types/renderers/webglrenderer/Controller.d.ts +6 -6
- package/dist/types/renderers/webglrenderer/Renderer.d.ts +4 -1
- package/dist/types/renderers/webglrenderer/node-animation-fragment.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/node-animation-vertex.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/rel-vertex-line.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/utils/constants.d.ts +1 -0
- package/dist/types/utils/webWorkerUtils.d.ts +1 -1
- package/package.json +4 -4
- package/dist/types/layouts/forcedirectedlayout/ForceCytoLayout.d.ts +0 -22
- package/dist/types/layouts/forcedirectedlayout/cosebilkentlayout/CoseBilkentLayout.d.ts +0 -33
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NvlState } from '../../modules/state/types';
|
|
2
|
-
import type { Node } from '../../types/graph-element';
|
|
2
|
+
import type { Node, PartialNode } from '../../types/graph-element';
|
|
3
3
|
export default class AnimatedLayout {
|
|
4
4
|
positions: Record<string, Node>;
|
|
5
5
|
oldPositions: Record<string, Node>;
|
|
@@ -20,6 +20,6 @@ export default class AnimatedLayout {
|
|
|
20
20
|
updateOldPositionFromState(): void;
|
|
21
21
|
startAnimation(): void;
|
|
22
22
|
update(): void;
|
|
23
|
-
updateNodes(positionList:
|
|
23
|
+
updateNodes(positionList: PartialNode[]): void;
|
|
24
24
|
getNodePositions(nodeList: Node[]): Node[];
|
|
25
25
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Simulation, SimulationLinkDatum, SimulationNodeDatum } from 'd3-force';
|
|
2
2
|
import type { NvlState } from '../../modules/state/types';
|
|
3
|
-
import type { Node, Relationship } from '../../types/graph-element';
|
|
3
|
+
import type { Node, PartialNode, Relationship } from '../../types/graph-element';
|
|
4
4
|
import type { Point } from '../../utils/geometry';
|
|
5
5
|
import type { D3Node } from './types';
|
|
6
6
|
export declare class D3ForceLayout {
|
|
@@ -20,7 +20,7 @@ export declare class D3ForceLayout {
|
|
|
20
20
|
state: NvlState;
|
|
21
21
|
});
|
|
22
22
|
setOptions(options: any): void;
|
|
23
|
-
updateNodes(positionList:
|
|
23
|
+
updateNodes(positionList: PartialNode[]): void;
|
|
24
24
|
update(refreshPositions?: boolean): void;
|
|
25
25
|
layout(_nodes: Node[], _rels: Relationship[], firstTimeAddingNodes: boolean): void;
|
|
26
26
|
getNodePositions(nodeList: D3Node[]): any[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ForceDirectedOptions, NvlState } from '../../../modules/state/types';
|
|
2
|
-
import type { Node, Relationship } from '../../../types/graph-element';
|
|
2
|
+
import type { Node, PartialNode, Relationship } from '../../../types/graph-element';
|
|
3
3
|
import type { Point } from '../../../utils/geometry';
|
|
4
4
|
export declare class PhysLayout {
|
|
5
5
|
private physVbo;
|
|
@@ -45,6 +45,7 @@ export declare class PhysLayout {
|
|
|
45
45
|
private updateData;
|
|
46
46
|
private updateShader;
|
|
47
47
|
private physPositions;
|
|
48
|
+
private physDirty;
|
|
48
49
|
private springTexture;
|
|
49
50
|
private sizeTexture;
|
|
50
51
|
private offsetTexture;
|
|
@@ -95,6 +96,11 @@ export declare class PhysLayout {
|
|
|
95
96
|
* Stops the layout
|
|
96
97
|
*/
|
|
97
98
|
terminateUpdate(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Synchronously reads the latest node positions/velocities from the GPU into
|
|
101
|
+
* this.physPositions.
|
|
102
|
+
*/
|
|
103
|
+
private readbackPositions;
|
|
98
104
|
/**
|
|
99
105
|
* Returns whether the current layout needs to be updated in the next iteration step.
|
|
100
106
|
* @returns Whether the layout should update in the following step.
|
|
@@ -122,7 +128,7 @@ export declare class PhysLayout {
|
|
|
122
128
|
* Updates the existing nodes of a graph with a given list of updates
|
|
123
129
|
* @param nodeList - The list of updates.
|
|
124
130
|
*/
|
|
125
|
-
updateNodes(nodeList:
|
|
131
|
+
updateNodes(nodeList: PartialNode[]): void;
|
|
126
132
|
/**
|
|
127
133
|
* Adds and removes nodes from the graph based on given updates
|
|
128
134
|
* @param fullData - The entire graph object.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NvlState } from '../../modules/state/types';
|
|
2
|
-
import type { Node } from '../../types/graph-element';
|
|
2
|
+
import type { Node, PartialNode } from '../../types/graph-element';
|
|
3
3
|
import type { Point } from '../../utils/geometry';
|
|
4
4
|
export declare class FreeLayout {
|
|
5
5
|
private state;
|
|
@@ -10,9 +10,7 @@ export declare class FreeLayout {
|
|
|
10
10
|
state: NvlState;
|
|
11
11
|
});
|
|
12
12
|
setOptions(): any;
|
|
13
|
-
updateNodes(positionList:
|
|
14
|
-
id: string;
|
|
15
|
-
})[]): void;
|
|
13
|
+
updateNodes(positionList: PartialNode[]): void;
|
|
16
14
|
update(refreshPositions?: boolean): void;
|
|
17
15
|
layout(nodes: Node[], nodeIds: Record<string, Node>, idToPosition: Record<string, Node>): void;
|
|
18
16
|
setNodePositions(p: Record<string, Point>): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NvlState } from '../../modules/state/types';
|
|
2
|
-
import type { Node } from '../../types/graph-element';
|
|
2
|
+
import type { Node, PartialNode } from '../../types/graph-element';
|
|
3
3
|
import type { Point } from '../../utils/geometry';
|
|
4
4
|
export declare class GridLayout {
|
|
5
5
|
state: NvlState;
|
|
@@ -10,11 +10,7 @@ export declare class GridLayout {
|
|
|
10
10
|
state: NvlState;
|
|
11
11
|
});
|
|
12
12
|
setOptions(): void;
|
|
13
|
-
updateNodes(positionList:
|
|
14
|
-
id: string;
|
|
15
|
-
x: number;
|
|
16
|
-
y: number;
|
|
17
|
-
}[]): void;
|
|
13
|
+
updateNodes(positionList: PartialNode[]): void;
|
|
18
14
|
update(refreshPositions?: boolean): void;
|
|
19
15
|
layout(mobxNodes: any): void;
|
|
20
16
|
setNodePositions(idToPosition: Record<string, Node & Point>): void;
|
|
@@ -68,6 +68,8 @@ export default class NvlController {
|
|
|
68
68
|
private isWithinBudget;
|
|
69
69
|
private updateMinimapZoom;
|
|
70
70
|
private startMainLoop;
|
|
71
|
+
private renderNodeHtmlOverlays;
|
|
72
|
+
private renderRelationshipHtmlOverlays;
|
|
71
73
|
updateHtmlOverlay(): void;
|
|
72
74
|
dumpNodes(): Node[];
|
|
73
75
|
dumpRelationships(): Relationship[];
|
|
@@ -29,7 +29,8 @@ export interface Channel<T> {
|
|
|
29
29
|
updates: Record<string, T>;
|
|
30
30
|
removes: Record<string, T>;
|
|
31
31
|
}
|
|
32
|
-
export declare const
|
|
32
|
+
export declare const getHtmlKey: (item: Node | Relationship) => "html" | "captionHtml";
|
|
33
|
+
export declare const getHtmlProperty: (item: Node | Relationship) => HTMLElement | undefined;
|
|
33
34
|
/**
|
|
34
35
|
* Creates an empty dataset in which a graph be stored and updated using mobx actions.
|
|
35
36
|
* @returns A new and empty {@link DataSet}.
|
|
@@ -42,14 +42,6 @@ export interface ForceDirectedOptions {
|
|
|
42
42
|
* require the Intel GPU shader workaround. This option will be removed in a future release.
|
|
43
43
|
*/
|
|
44
44
|
intelWorkaround?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* @deprecated This option will be removed in a future release. For small datasets, use the d3Force layout instead.
|
|
47
|
-
* Whether to enable automatic switching to CoseBilkent layout for small graphs.
|
|
48
|
-
* When enabled, small graphs will automatically use the CoseBilkent layout algorithm
|
|
49
|
-
* which can provide better initial positioning for smaller datasets.
|
|
50
|
-
* @defaultValue true
|
|
51
|
-
*/
|
|
52
|
-
enableCytoscape?: boolean;
|
|
53
45
|
/**
|
|
54
46
|
* How initial node positions are seeded before the physics simulation runs.
|
|
55
47
|
* @defaultValue 'box'
|
|
@@ -237,22 +229,21 @@ export interface NvlOptions {
|
|
|
237
229
|
minimapViewportBoxColor?: string;
|
|
238
230
|
};
|
|
239
231
|
/**
|
|
240
|
-
* Target minimum presentation
|
|
241
|
-
*
|
|
232
|
+
* Target minimum presentation fps while layout is active, at the cost of stabilization speed when set higher.
|
|
233
|
+
* Budgets layout steps only. Actual fps may undershoot when rendering is expensive.
|
|
242
234
|
*
|
|
243
235
|
* @defaultValue 3
|
|
244
236
|
*
|
|
245
|
-
* @note
|
|
237
|
+
* @note Will be capped between 1 and 120.
|
|
246
238
|
*/
|
|
247
239
|
minFps?: number;
|
|
248
240
|
/**
|
|
249
|
-
* Target maximum presentation
|
|
250
|
-
*
|
|
251
|
-
* computation available is used to speed up layout stabilization.
|
|
241
|
+
* Target maximum presentation fps while layout is active; extra time in the tick goes to layout stabilization.
|
|
242
|
+
* Budgets layout steps only. Actual fps may undershoot when rendering is expensive.
|
|
252
243
|
*
|
|
253
244
|
* @defaultValue 30
|
|
254
245
|
*
|
|
255
|
-
* @note
|
|
246
|
+
* @note Will be capped between 1 and 120.
|
|
256
247
|
*/
|
|
257
248
|
maxFps?: number;
|
|
258
249
|
/**
|
|
@@ -18,20 +18,6 @@ export declare const calculateLabelDimensions: (fullCaption: string, measureWidt
|
|
|
18
18
|
label: string;
|
|
19
19
|
width: number;
|
|
20
20
|
};
|
|
21
|
-
/**
|
|
22
|
-
* Calculate label transform including rotation and flip adjustments.
|
|
23
|
-
*
|
|
24
|
-
* @param angle - The base rotation angle in radians
|
|
25
|
-
* @param fontSize - The font size in pixels (including pixel ratio scaling)
|
|
26
|
-
* @param flip - Whether to flip the label (applies additional rotation)
|
|
27
|
-
* @param point - The base point (used to calculate offset in flip case)
|
|
28
|
-
* @returns object with final position and angle
|
|
29
|
-
*/
|
|
30
|
-
export declare const calculateLabelTransform: (angle: number, fontSize: number, flip: boolean, point: Point) => {
|
|
31
|
-
finalX: number;
|
|
32
|
-
finalY: number;
|
|
33
|
-
finalAngle: number;
|
|
34
|
-
};
|
|
35
21
|
/**
|
|
36
22
|
* Calculate vertical alignment offset for label based on caption alignment.
|
|
37
23
|
*
|
|
@@ -55,7 +41,7 @@ export declare const calculateLabelHeightAlign: (captionAlign: string, fontSize:
|
|
|
55
41
|
* @param flip - Whether the label is flipped
|
|
56
42
|
* @returns object with position, rotation, width, and height for hit detection
|
|
57
43
|
*/
|
|
58
|
-
export declare const calculateLabelGeometry: (point: Point, angle: number, maxWidth: number, fontSize: number, heightAlign: number, padding: number, pixelRatio: number
|
|
44
|
+
export declare const calculateLabelGeometry: (point: Point, angle: number, maxWidth: number, fontSize: number, heightAlign: number, padding: number, pixelRatio: number) => {
|
|
59
45
|
position: {
|
|
60
46
|
x: number;
|
|
61
47
|
y: number;
|
|
@@ -164,5 +150,5 @@ export declare const drawLoop: (ctx: CanvasRenderingContext2D, fromPoint: Point,
|
|
|
164
150
|
* @param fontColor - The font color to use
|
|
165
151
|
* @param flip - Whether to flip the label orientation (default false)
|
|
166
152
|
*/
|
|
167
|
-
export declare const drawLabel: (ctx: CanvasRenderingContext2D, point: Point, angle: number, maxWidth: number, rel: Relationship, bundle: ArrowBundle, disabledItemStyles: DisabledItemStyles, fontColor: string
|
|
153
|
+
export declare const drawLabel: (ctx: CanvasRenderingContext2D, point: Point, angle: number, maxWidth: number, rel: Relationship, bundle: ArrowBundle, disabledItemStyles: DisabledItemStyles, fontColor: string) => void;
|
|
168
154
|
export {};
|
|
@@ -44,12 +44,8 @@ export declare const getSelfArrowControlPoints: (rel: Relationship, node: Node,
|
|
|
44
44
|
};
|
|
45
45
|
nodeGap: number;
|
|
46
46
|
};
|
|
47
|
-
/**
|
|
48
|
-
|
|
49
|
-
* Used by both Canvas and SVG renderers to ensure consistent positioning.
|
|
50
|
-
* This function handles all the math internally including headAngle and headSelectedAdjustment calculations.
|
|
51
|
-
*/
|
|
52
|
-
export declare const getSelfArrowLabelPosition: (apexPoint: Point, angle: number, endPoint: Point, control2Point: Point, isSelected: boolean, selectionRings: BorderStyle["rings"], relWidth?: number) => {
|
|
47
|
+
/** Calculates anchor position and readable rotation for a self-referencing relationship label. */
|
|
48
|
+
export declare const getSelfArrowLabelPosition: (apexPoint: Point, angle: number, endPoint: Point, control2Point: Point, isSelected: boolean, selectionRings: BorderStyle["rings"], relWidth?: number, captionSize?: number) => {
|
|
53
49
|
x: number;
|
|
54
50
|
y: number;
|
|
55
51
|
angle: number;
|
|
@@ -173,3 +169,5 @@ export declare const getOverlayIconAlignment: (position: [number, number], width
|
|
|
173
169
|
widthAlign: number;
|
|
174
170
|
heightAlign: number;
|
|
175
171
|
};
|
|
172
|
+
/** Vertical offset for a self-loop caption; `top`/`bottom` mean outside/inside the loop. */
|
|
173
|
+
export declare const getSelfLoopHeightAlign: (captionAlign: string, fontSize: number, lineWidth: number, padding: number, flip: 1 | -1) => number;
|
|
@@ -10,8 +10,8 @@ export interface ControllerInterface {
|
|
|
10
10
|
stateDisposers: NvlState['autorun'][];
|
|
11
11
|
state: NvlState;
|
|
12
12
|
needsToRun: () => boolean;
|
|
13
|
-
renderMainScene: (positionArray: Node[]) => void;
|
|
14
|
-
renderMinimap: (positionArray: Node[]) => void;
|
|
13
|
+
renderMainScene: (positionArray: Node[], positionsChanged?: boolean) => void;
|
|
14
|
+
renderMinimap: (positionArray: Node[], positionsChanged?: boolean) => void;
|
|
15
15
|
checkForUpdates: (nodes: DataSet<Node>, rels: DataSet<Relationship>) => void;
|
|
16
16
|
onResize: () => void;
|
|
17
17
|
updateMainViewport: (zoom: number, panX: number, panY: number) => void;
|
|
@@ -34,8 +34,8 @@ export default class Controller implements ControllerInterface {
|
|
|
34
34
|
state?: NvlState;
|
|
35
35
|
});
|
|
36
36
|
needsToRun(): boolean;
|
|
37
|
-
renderMainScene(positionArray: Node[]): void;
|
|
38
|
-
renderMinimap(positionArray: Node[]): void;
|
|
37
|
+
renderMainScene(positionArray: Node[], positionsChanged?: boolean): void;
|
|
38
|
+
renderMinimap(positionArray: Node[], positionsChanged?: boolean): void;
|
|
39
39
|
checkForUpdates(nodes: DataSet<Node>, rels: DataSet<Relationship>): void;
|
|
40
40
|
onResize(): void;
|
|
41
41
|
updateMainViewport(zoom: number, panX: number, panY: number): void;
|
|
@@ -52,8 +52,8 @@ export declare class DummyController implements ControllerInterface {
|
|
|
52
52
|
minimapMouseDown: boolean;
|
|
53
53
|
stateDisposers: NvlState['autorun'][];
|
|
54
54
|
state: NvlState;
|
|
55
|
-
renderMainScene(positionArray: Node[]): void;
|
|
56
|
-
renderMinimap(positionArray: Node[]): void;
|
|
55
|
+
renderMainScene(positionArray: Node[], positionsChanged?: boolean): void;
|
|
56
|
+
renderMinimap(positionArray: Node[], positionsChanged?: boolean): void;
|
|
57
57
|
checkForUpdates(nodes: DataSet<Node>, rels: DataSet<Relationship>): void;
|
|
58
58
|
onResize(): void;
|
|
59
59
|
updateMainViewport(zoom: number, panX: number, panY: number): void;
|
|
@@ -14,16 +14,19 @@ export default class Renderer {
|
|
|
14
14
|
private readonly disableNodeColor;
|
|
15
15
|
private readonly gl;
|
|
16
16
|
activeNodes: Record<string, boolean>;
|
|
17
|
+
numActiveNodes: number;
|
|
17
18
|
readonly canvas: HTMLCanvasElement;
|
|
18
19
|
projection: mat4;
|
|
19
20
|
private idToIndex;
|
|
20
21
|
private posBuffer;
|
|
22
|
+
private positionsDirty;
|
|
21
23
|
private numRels;
|
|
22
24
|
private numNodes;
|
|
23
25
|
private nodeDataByte;
|
|
24
26
|
private relIdToIndex;
|
|
25
27
|
private relData;
|
|
26
28
|
private viewportBoxBuffer;
|
|
29
|
+
private readonly viewportBoxVertices;
|
|
27
30
|
private relBuffer;
|
|
28
31
|
private nodeBuffer;
|
|
29
32
|
private posTexture;
|
|
@@ -36,7 +39,7 @@ export default class Renderer {
|
|
|
36
39
|
nodes: Node[];
|
|
37
40
|
rels: Relationship[];
|
|
38
41
|
}): void;
|
|
39
|
-
render(positionArray: Node[]): void;
|
|
42
|
+
render(positionArray: Node[], positionsChanged?: boolean): void;
|
|
40
43
|
renderViewbox(): void;
|
|
41
44
|
updateNodes(updates: Node[]): void;
|
|
42
45
|
updateRelationships(relItems: Relationship[]): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "#version 300 es\nprecision
|
|
1
|
+
declare const _default: "#version 300 es\nprecision mediump float;\n\nuniform mediump float u_zoom;\nuniform lowp float u_animPos;\nuniform mediump float u_glAdjust;\n\nin lowp vec4 color;\nin mediump float varNodeSize;\n\nout vec4 fragColor;\n\nconst float pulseCircleEdge = 0.50;\n\nvoid main(void) {\n float dist = distance(gl_PointCoord, vec2(0.5));\n\n if (dist > 0.51) {\n discard;\n } else {\n float alpha = 1.0 - smoothstep(pulseCircleEdge - (1.0 / (varNodeSize * 2.0 * u_zoom * u_glAdjust)), pulseCircleEdge, dist);\n float pulseAlpha = 0.9 - 0.9 * u_animPos;\n fragColor = vec4(color.xyz, 1.0) * alpha * pulseAlpha;\n }\n}\n";
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "#version 300 es\nuniform mat4 u_projection;\nuniform sampler2D u_positions;\nuniform lowp float u_animPos;\nuniform mediump float u_zoom;\nuniform mediump float u_glAdjust;\n\nin float a_size;\nin
|
|
1
|
+
declare const _default: "#version 300 es\nuniform mat4 u_projection;\nuniform sampler2D u_positions;\nuniform lowp float u_animPos;\nuniform mediump float u_zoom;\nuniform mediump float u_glAdjust;\n\nin float a_size;\nin highp vec2 a_index;\nin lowp vec4 a_color;\nin lowp float a_active;\n\nout mediump float varNodeSize;\nout lowp vec4 color;\n\nvoid main(void) {\n vec4 data = texture(u_positions, a_index);\n\n gl_Position = u_projection * vec4(data.xy, 0.0, 1.0);\n\n float nodeSize = a_size * u_zoom * u_glAdjust;\n nodeSize = nodeSize * 0.8;\n\n gl_PointSize = a_active > 0.5\n ? nodeSize + 0.88 * nodeSize * u_animPos\n : 0.0;\n\n color = a_color;\n varNodeSize = a_size;\n}";
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "#version 300 es\nprecision
|
|
1
|
+
declare const _default: "#version 300 es\nprecision mediump float;\n\nuniform lowp vec3 u_nodeBorderColor;\nuniform lowp vec3 u_selectedBorderColor;\nuniform lowp vec3 u_selectedInnerBorderColor;\nuniform lowp vec3 u_shadowColor;\nuniform lowp float u_drawDefaultBorder;\n\nin lowp vec4 color;\nin lowp float selected;\nin lowp float hovered;\nin mediump float varNodeSize;\n\nout vec4 fragColor;\n\nconst float circleSize = 0.40;\nconst float defaultBorderSize = 0.42;\nconst float innerSelectedRingSize = 0.43;\nconst float outerSelectedRingSize = 0.47;\nconst float shadowSize = 0.51;\n\nfloat getShadowAlpha(float size, float dist) {\n return (1.0 - smoothstep(size, shadowSize, dist)) * 0.25;\n}\n\nfloat getCircleAlpha(float ringSize, float nodeSize, float dist) {\n return color.w - smoothstep(ringSize - nodeSize, ringSize, dist);\n}\n\nvoid main() {\n float dist = distance(gl_PointCoord, vec2(0.5));\n\n if (dist > 0.51) {\n discard;\n } else {\n float nodeSize = 1.0 / varNodeSize;\n float nodeAlpha = getCircleAlpha(circleSize, nodeSize, dist);\n float borderAlpha = getCircleAlpha(defaultBorderSize, nodeSize, dist);\n float ringAlpha = getCircleAlpha(innerSelectedRingSize, nodeSize, dist);\n vec3 finalColor = color.xyz;\n float finalAlpha = nodeAlpha;\n\n if (selected > 0.0) {\n float shadowAlpha = getShadowAlpha(outerSelectedRingSize, dist);\n float ringAlpha2 = getCircleAlpha(outerSelectedRingSize, nodeSize, dist);\n\n if (u_drawDefaultBorder > 0.0) {\n finalColor = mix(u_nodeBorderColor, finalColor, nodeAlpha);\n finalColor = mix(u_selectedInnerBorderColor, finalColor, borderAlpha);\n finalColor = mix(u_selectedBorderColor, finalColor, ringAlpha);\n finalColor = mix(u_shadowColor, finalColor, ringAlpha2);\n finalAlpha = max(shadowAlpha, max(nodeAlpha, max(borderAlpha, ringAlpha2)));\n } else {\n finalColor = mix(u_selectedInnerBorderColor, finalColor, nodeAlpha);\n finalColor = mix(u_selectedBorderColor, finalColor, ringAlpha);\n finalColor = mix(u_shadowColor, finalColor, ringAlpha2);\n finalAlpha = max(shadowAlpha, max(nodeAlpha, max(ringAlpha, ringAlpha2)));\n }\n } else if (hovered > 0.0) {\n if (u_drawDefaultBorder > 0.0) {\n float shadowAlpha = getShadowAlpha(defaultBorderSize, dist);\n finalColor = mix(u_nodeBorderColor, finalColor, nodeAlpha);\n finalColor = mix(u_shadowColor, finalColor, borderAlpha);\n finalAlpha = max(shadowAlpha, max(nodeAlpha, ringAlpha));\n } else {\n float shadowAlpha = getShadowAlpha(circleSize, dist);\n finalColor = mix(u_shadowColor, finalColor, nodeAlpha);\n finalAlpha = max(shadowAlpha, nodeAlpha);\n }\n } else {\n if (u_drawDefaultBorder > 0.0) {\n finalColor = mix(u_nodeBorderColor, finalColor, nodeAlpha);\n finalAlpha = borderAlpha;\n }\n }\n fragColor = vec4(finalColor, 1.0) * finalAlpha;\n }\n}\n";
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "#version 300 es\nuniform mat4 u_projection;\nuniform sampler2D u_positions;\nuniform mediump float u_zoom;\nuniform mediump float u_glAdjust;\
|
|
1
|
+
declare const _default: "#version 300 es\nuniform mat4 u_projection;\nuniform sampler2D u_positions;\nuniform mediump float u_zoom;\nuniform mediump float u_glAdjust;\n\nin float a_size;\nin highp vec2 a_index;\nin lowp vec4 a_color;\nin lowp float a_selected;\nin lowp float a_hovered;\n\nout lowp vec4 color;\nout lowp float selected;\nout lowp float hovered;\nout mediump float varNodeSize;\n\nconst float MinNodeSize = 5.0;\n\nvoid main(void) {\n vec4 data = texture(u_positions, a_index);\n gl_Position = u_projection * vec4(data.xy, 0.0, 1.0);\n\n float nodeSize = max(a_size * u_zoom * u_glAdjust, MinNodeSize);\n gl_PointSize = nodeSize;\n varNodeSize = nodeSize;\n\n color = a_color;\n selected = a_selected;\n hovered = a_hovered;\n}";
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "#version 300 es\nuniform mat4 u_projection;\nuniform sampler2D u_positions;\nuniform mediump float u_glAdjust;\n\nin vec2 a_from;\nin vec2 a_to;\nin lowp vec4 a_color;\nin lowp float a_triside;\nin float a_width;\n\nout lowp vec4 color;\n\nvoid main(void) {\n vec4 from = texture(u_positions, a_from);\n vec4 to = texture(u_positions, a_to);\n vec2 direction = normalize(to.xy - from.xy);\n
|
|
1
|
+
declare const _default: "#version 300 es\nuniform mat4 u_projection;\nuniform sampler2D u_positions;\nuniform mediump float u_glAdjust;\n\nin vec2 a_from;\nin vec2 a_to;\nin lowp vec4 a_color;\nin lowp float a_triside;\nin float a_width;\n\nout lowp vec4 color;\n\nvoid main(void) {\n vec4 from = texture(u_positions, a_from);\n vec4 to = texture(u_positions, a_to);\n vec2 direction = normalize(to.xy - from.xy);\n vec2 perpendicular = vec2(-direction.y, direction.x);\n\n float halfWidth = a_width * u_glAdjust * 0.25;\n float sideSign = 1.0 - 2.0 * a_triside;\n from.xy += sideSign * halfWidth * perpendicular;\n\n color = a_color;\n gl_Position = u_projection * vec4(from.xy, 0.0, 1.0);\n}\n";
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "#version 300 es\nprecision lowp float;\n\
|
|
1
|
+
declare const _default: "#version 300 es\nprecision lowp float;\n\nuniform lowp vec4 u_minimapViewportBoxColor;\n\nout vec4 fragColor;\n\nvoid main(void) {\n fragColor = u_minimapViewportBoxColor;\n}\n";
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "#version 300 es\nin vec2 coordinates;\nuniform mat4 u_projection;\
|
|
1
|
+
declare const _default: "#version 300 es\nin vec2 coordinates;\nuniform mat4 u_projection;\n\nvoid main(void) {\n gl_Position = u_projection * vec4(coordinates, 0.0, 1.0);\n}\n";
|
|
2
2
|
export default _default;
|
|
@@ -6,6 +6,7 @@ export declare const Gravity = 25;
|
|
|
6
6
|
export declare const SimulationStopVelocity = 0.25;
|
|
7
7
|
export declare const MappingEnd = 999999;
|
|
8
8
|
export declare const LayoutStepIntervalMs = 13;
|
|
9
|
+
export declare const MaxLayoutStepsPerFrame = 20;
|
|
9
10
|
export declare const DefaultMaxFps = 30;
|
|
10
11
|
export declare const DefaultMinFps = 3;
|
|
11
12
|
export declare const MinAllowedFps = 1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-nvl/base",
|
|
3
|
-
"version": "1.2.0-
|
|
3
|
+
"version": "1.2.0-36beb1e1",
|
|
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",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"postpack": "rm LICENSE.txt && rm CHANGELOG.md"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@neo4j-nvl/layout-workers": "1.2.0-
|
|
33
|
+
"@neo4j-nvl/layout-workers": "1.2.0-36beb1e1",
|
|
34
34
|
"@segment/analytics-next": "1.81.1",
|
|
35
35
|
"color-string": "1.9.1",
|
|
36
36
|
"d3-force": "3.0.0",
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
"glsl-inject-defines": "1.0.3",
|
|
39
39
|
"lodash": "4.18.1",
|
|
40
40
|
"loglevel": "1.9.2",
|
|
41
|
-
"mobx": "
|
|
41
|
+
"mobx": "6.15.0",
|
|
42
42
|
"node-pid-controller": "1.0.1",
|
|
43
43
|
"resizelistener": "1.1.0",
|
|
44
44
|
"tinycolor2": "1.6.0",
|
|
45
45
|
"uuid": "14.0.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@babel/core": "7.
|
|
48
|
+
"@babel/core": "7.29.6",
|
|
49
49
|
"@types/color-string": "1.5.5",
|
|
50
50
|
"@types/d3-force": "3.0.10",
|
|
51
51
|
"@types/lodash": "4.17.21",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare const ForceDirectedLayoutType = "forceDirected";
|
|
2
|
-
export declare const CoseBilkentType = "coseBilkent";
|
|
3
|
-
export declare class ForceCytoLayout {
|
|
4
|
-
private readonly physLayout;
|
|
5
|
-
private readonly coseBilkentLayout;
|
|
6
|
-
private readonly state;
|
|
7
|
-
private currentLayoutType;
|
|
8
|
-
private enableCytoscape;
|
|
9
|
-
private currentLayout;
|
|
10
|
-
constructor(config: any);
|
|
11
|
-
setOptions(options: any): void;
|
|
12
|
-
private getLayout;
|
|
13
|
-
private setLayout;
|
|
14
|
-
copyLayoutPositions(nodeList: any, prevLayout: any, nextLayout: any): void;
|
|
15
|
-
update(refreshPositions?: boolean): void;
|
|
16
|
-
getShouldUpdate(): boolean;
|
|
17
|
-
getComputing(): boolean;
|
|
18
|
-
updateNodes(positionList: any): void;
|
|
19
|
-
getNodePositions(data: any): import("../..").Node[];
|
|
20
|
-
terminateUpdate(): void;
|
|
21
|
-
destroy(): void;
|
|
22
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { NvlState } from '../../../modules/state/types';
|
|
2
|
-
import type { Node, Relationship } from '../../../types/graph-element';
|
|
3
|
-
import AnimatedLayout from '../../animatedlayout/AnimatedLayout';
|
|
4
|
-
type LayoutData = {
|
|
5
|
-
elements: {
|
|
6
|
-
group: string;
|
|
7
|
-
data: {
|
|
8
|
-
id: string;
|
|
9
|
-
};
|
|
10
|
-
}[];
|
|
11
|
-
spacingFactor: number;
|
|
12
|
-
};
|
|
13
|
-
export declare class CoseBilkentLayout extends AnimatedLayout {
|
|
14
|
-
private stateDisposers;
|
|
15
|
-
cytoCompleteCallback: () => void;
|
|
16
|
-
computing: boolean;
|
|
17
|
-
pendingLayoutData: LayoutData;
|
|
18
|
-
worker: SharedWorker;
|
|
19
|
-
private workersDisabled;
|
|
20
|
-
constructor(config: {
|
|
21
|
-
state: NvlState;
|
|
22
|
-
cytoCompleteCallback?: () => void;
|
|
23
|
-
animationCompleteCallback?: () => void;
|
|
24
|
-
});
|
|
25
|
-
setOptions(): void;
|
|
26
|
-
update(refreshPositions?: boolean, updateMobXNodes?: Node[], updateMobXRelationships?: Relationship[]): void;
|
|
27
|
-
getShouldUpdate(): boolean;
|
|
28
|
-
getComputing(): boolean;
|
|
29
|
-
layout(nodes: Node[], relationships: Relationship[]): void;
|
|
30
|
-
terminateUpdate(): void;
|
|
31
|
-
destroy(): void;
|
|
32
|
-
}
|
|
33
|
-
export {};
|