@neo4j-nvl/base 0.3.9 → 1.0.0-08b14670
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 +20 -0
- package/dist/base.mjs +1 -1
- package/dist/types/index.d.ts +101 -78
- package/dist/types/layouts/animatedlayout/animationUtils.d.ts +3 -3
- package/dist/types/layouts/circularLayout/CircularLayout.d.ts +18 -0
- package/dist/types/layouts/forcedirectedlayout/ForceCytoLayout.d.ts +1 -1
- package/dist/types/layouts/forcedirectedlayout/physlayout/PhysLayout.d.ts +27 -22
- package/dist/types/layouts/forcedirectedlayout/physlayout/shaders/multilevel-fragment-verlet.d.ts +1 -1
- package/dist/types/layouts/forcedirectedlayout/physlayout/solarmerger/SolarMerger.d.ts +17 -39
- package/dist/types/layouts/forcedirectedlayout/physlayout/solarmerger/types.d.ts +49 -0
- package/dist/types/modules/CallbackHelper.d.ts +5 -5
- package/dist/types/modules/ExternalCallbackHandler.d.ts +7 -0
- package/dist/types/modules/NvlController.d.ts +11 -7
- package/dist/types/modules/dataset.d.ts +1 -1
- package/dist/types/modules/state/state.d.ts +2 -2
- package/dist/types/modules/state/types.d.ts +73 -61
- package/dist/types/modules/state/utils.d.ts +8 -6
- package/dist/types/renderers/domrenderer/BaseRenderer.d.ts +66 -0
- package/dist/types/renderers/{canvasrenderer → domrenderer/canvasrenderer}/Animation.d.ts +8 -11
- package/dist/types/renderers/{canvasrenderer → domrenderer/canvasrenderer}/AnimationHandler.d.ts +15 -16
- package/dist/types/renderers/domrenderer/canvasrenderer/CanvasRenderer.d.ts +153 -0
- package/dist/types/renderers/domrenderer/canvasrenderer/canvasUtils.d.ts +56 -0
- package/dist/types/renderers/{canvasrenderer → domrenderer/shared}/ImageCache.d.ts +1 -1
- package/dist/types/renderers/{canvasrenderer → domrenderer/shared}/arrows/ArrowBundle.d.ts +17 -17
- package/dist/types/renderers/{canvasrenderer → domrenderer/shared}/arrows/ArrowBundler.d.ts +9 -9
- package/dist/types/renderers/domrenderer/shared/arrows/arrows.d.ts +148 -0
- package/dist/types/renderers/domrenderer/shared/nodes/nodeUtils.d.ts +28 -0
- package/dist/types/renderers/domrenderer/shared/nodes/nodes.d.ts +58 -0
- package/dist/types/renderers/{canvasrenderer → domrenderer/shared}/types.d.ts +8 -6
- package/dist/types/renderers/domrenderer/shared/util.d.ts +11 -0
- package/dist/types/renderers/{canvasrenderer → domrenderer/shared}/vectorUtils.d.ts +1 -1
- package/dist/types/renderers/{canvasrenderer → domrenderer/shared}/wordwrap.d.ts +13 -13
- package/dist/types/renderers/domrenderer/shared/wordwrap.test.d.ts +1 -0
- package/dist/types/renderers/domrenderer/svgrenderer/SvgRenderer.d.ts +27 -0
- package/dist/types/renderers/domrenderer/svgrenderer/SvgRenderer.test.d.ts +1 -0
- package/dist/types/renderers/domrenderer/svgrenderer/svgUtils.d.ts +191 -0
- package/dist/types/renderers/webglrenderer/Renderer.d.ts +5 -1
- package/dist/types/renderers/webglrenderer/Renderer.test.d.ts +1 -0
- package/dist/types/types/graph-element.d.ts +16 -7
- package/dist/types/utils/canvasManagement.d.ts +18 -2
- package/dist/types/utils/circularUtils.d.ts +3 -0
- package/dist/types/utils/circularUtils.test.d.ts +1 -0
- package/dist/types/utils/colorUtils.d.ts +3 -3
- package/dist/types/utils/constants.d.ts +6 -4
- package/dist/types/utils/errors.d.ts +2 -1
- package/dist/types/utils/geometry.d.ts +31 -30
- package/dist/types/utils/graphObjectUtils.d.ts +5 -5
- package/dist/types/utils/hittest.d.ts +2 -0
- package/dist/types/utils/jsDriverResultTransformer.d.ts +14 -7
- package/dist/types/utils/segmentAnalytics.d.ts +8 -8
- package/dist/types/utils/zoomFunctions.d.ts +30 -23
- package/package.json +25 -24
- package/dist/types/modules/performance.d.ts +0 -93
- package/dist/types/renderers/canvasrenderer/CanvasRenderer.d.ts +0 -93
- package/dist/types/renderers/canvasrenderer/arrows/arrows.d.ts +0 -55
- package/dist/types/renderers/canvasrenderer/nodes/nodes.d.ts +0 -59
- package/dist/types/renderers/canvasrenderer/util.d.ts +0 -69
- /package/dist/types/{renderers/canvasrenderer/Animation.test.d.ts → layouts/d3forcelayout/circularLayout.test.d.ts} +0 -0
- /package/dist/types/renderers/{canvasrenderer/CanvasRenderer.test.d.ts → domrenderer/canvasrenderer/Animation.test.d.ts} +0 -0
- /package/dist/types/renderers/{canvasrenderer/ImageCache.test.d.ts → domrenderer/canvasrenderer/CanvasRenderer.test.d.ts} +0 -0
- /package/dist/types/renderers/{canvasrenderer/arrows/ArrowBundle.test.d.ts → domrenderer/shared/ImageCache.test.d.ts} +0 -0
- /package/dist/types/renderers/{canvasrenderer/arrows/ArrowBundler.test.d.ts → domrenderer/shared/arrows/ArrowBundle.test.d.ts} +0 -0
- /package/dist/types/renderers/{canvasrenderer/arrows/arrows.test.d.ts → domrenderer/shared/arrows/ArrowBundler.test.d.ts} +0 -0
- /package/dist/types/renderers/{canvasrenderer/nodes/nodes.test.d.ts → domrenderer/shared/arrows/arrows.test.d.ts} +0 -0
- /package/dist/types/renderers/{canvasrenderer → domrenderer/shared}/arrows/constants.d.ts +0 -0
- /package/dist/types/renderers/{canvasrenderer/util.test.d.ts → domrenderer/shared/nodes/nodes.test.d.ts} +0 -0
- /package/dist/types/renderers/{canvasrenderer/wordwrap.test.d.ts → domrenderer/shared/util.test.d.ts} +0 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Node } from '../../../../types/graph-element';
|
|
2
|
+
export interface SolarNode extends Omit<Node, 'id' | 'size'> {
|
|
3
|
+
id: number;
|
|
4
|
+
weight?: number;
|
|
5
|
+
finestIndex?: number;
|
|
6
|
+
originalId: string;
|
|
7
|
+
position?: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
};
|
|
11
|
+
placement?: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
};
|
|
15
|
+
size?: number | (() => number);
|
|
16
|
+
}
|
|
17
|
+
export interface SolarRelationship {
|
|
18
|
+
id: string;
|
|
19
|
+
from: string;
|
|
20
|
+
to: string;
|
|
21
|
+
}
|
|
22
|
+
export interface CoarsenedGraph {
|
|
23
|
+
nodes: SolarNode[];
|
|
24
|
+
relationships: number[][];
|
|
25
|
+
idToRel: Record<string, SolarRelationship>;
|
|
26
|
+
}
|
|
27
|
+
export interface Sun extends SolarNode {
|
|
28
|
+
planets: Planet[];
|
|
29
|
+
size: () => number;
|
|
30
|
+
children: () => Planet[];
|
|
31
|
+
previousIndex: number;
|
|
32
|
+
}
|
|
33
|
+
export interface Planet extends SolarNode {
|
|
34
|
+
parent: Sun;
|
|
35
|
+
sunId: number;
|
|
36
|
+
moons: Moon[];
|
|
37
|
+
size: () => number;
|
|
38
|
+
children: () => Moon[];
|
|
39
|
+
}
|
|
40
|
+
export interface Moon extends SolarNode {
|
|
41
|
+
parent: Planet;
|
|
42
|
+
sunId: number;
|
|
43
|
+
size: () => number;
|
|
44
|
+
}
|
|
45
|
+
export type Celestial = Sun | Planet | Moon;
|
|
46
|
+
export declare const isSolarNode: (node: SolarNode | Node) => node is SolarNode;
|
|
47
|
+
export declare const isSun: (node: SolarNode | Celestial) => node is Sun;
|
|
48
|
+
export declare const isPlanet: (node: SolarNode | Celestial) => node is Planet;
|
|
49
|
+
export declare const isMoon: (node: SolarNode | Celestial) => node is Moon;
|
|
@@ -17,21 +17,21 @@ export declare class CallbackHelper {
|
|
|
17
17
|
constructor();
|
|
18
18
|
/**
|
|
19
19
|
* Register a callback function to be called when an event of that name happens
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
20
|
+
* @param name - The name of the callback to register.
|
|
21
|
+
* @param callback - A function that will be called when an event of that name happens.
|
|
22
22
|
* If other callbacks are already registered for that name it is added to the list
|
|
23
23
|
*/
|
|
24
24
|
register(name: keyof ExternalCallbacks, callback: CallbackFunction): void;
|
|
25
25
|
/**
|
|
26
26
|
* Check if a callback function with that name is registered already
|
|
27
|
-
* @param
|
|
27
|
+
* @param name - The name of the callbacks to check.
|
|
28
28
|
* @return {boolean} Whether or not a callback function with that name is registered
|
|
29
29
|
*/
|
|
30
30
|
isCallbackRegistered(name: keyof ExternalCallbacks): boolean;
|
|
31
31
|
/**
|
|
32
32
|
* Call all callbacks registered for a given name
|
|
33
|
-
* @param
|
|
34
|
-
* @param
|
|
33
|
+
* @param name - The name of the callbacks to call.
|
|
34
|
+
* @param data - Data to pass when calling the callbacks.
|
|
35
35
|
*/
|
|
36
36
|
callIfRegistered(): void;
|
|
37
37
|
}
|
|
@@ -13,9 +13,16 @@ export interface ExternalCallbacks {
|
|
|
13
13
|
onInitialization?: () => void;
|
|
14
14
|
/** Triggered when a asynchronous layout calculation starts/stops. */
|
|
15
15
|
onLayoutComputing?: (isComputing: boolean) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Triggered when the WebGL context is lost.
|
|
18
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/webglcontextlost_event}
|
|
19
|
+
*/
|
|
16
20
|
onWebGLContextLost?: (webGLContextEvent: WebGLContextEvent) => void;
|
|
17
21
|
/** Triggered when a zoom transition (e.g. {@link NVL.fit} or {@link NVL.resetZoom}) function is done. */
|
|
18
22
|
onZoomTransitionDone?: () => void;
|
|
23
|
+
/**
|
|
24
|
+
* Triggered when NVL is restarted.
|
|
25
|
+
*/
|
|
19
26
|
restart?: () => void;
|
|
20
27
|
}
|
|
21
28
|
export declare const isExternalCallback: (callback: unknown) => callback is keyof ExternalCallbacks;
|
|
@@ -27,12 +27,15 @@ export default class NvlController {
|
|
|
27
27
|
private readonly gridLayout;
|
|
28
28
|
private readonly freeLayout;
|
|
29
29
|
private readonly d3ForceLayout;
|
|
30
|
+
private readonly circularLayout;
|
|
30
31
|
private readonly forceLayout;
|
|
31
32
|
private readonly canvasRenderer;
|
|
33
|
+
private readonly svgRenderer;
|
|
32
34
|
private readonly glCanvas;
|
|
33
35
|
private canvasRect;
|
|
34
36
|
private readonly glMinimapCanvas;
|
|
35
37
|
private readonly c2dCanvas;
|
|
38
|
+
private readonly svg;
|
|
36
39
|
private isInRenderSwitchAnimation;
|
|
37
40
|
private justSwitchedRenderer;
|
|
38
41
|
private justSwitchedLayout;
|
|
@@ -54,7 +57,7 @@ export default class NvlController {
|
|
|
54
57
|
private layoutComputingCallback;
|
|
55
58
|
private currentLayoutType;
|
|
56
59
|
private descriptionElement;
|
|
57
|
-
constructor(state: NvlState, options: NvlOptions);
|
|
60
|
+
constructor(state: NvlState, frame: HTMLElement, options: NvlOptions);
|
|
58
61
|
private onWebGLContextLost;
|
|
59
62
|
private updateMinimapZoom;
|
|
60
63
|
private startMainLoop;
|
|
@@ -63,8 +66,8 @@ export default class NvlController {
|
|
|
63
66
|
dumpRelationships(): Relationship[];
|
|
64
67
|
/**
|
|
65
68
|
* Map a relative Canvas space to the DOM position
|
|
66
|
-
* @param
|
|
67
|
-
* @param
|
|
69
|
+
* @param canvasX - X position in the canvas space.
|
|
70
|
+
* @param canvasY - Y position position in the canvas space.
|
|
68
71
|
*/
|
|
69
72
|
mapCanvasSpaceToRelativePosition(canvasX: number, canvasY: number): {
|
|
70
73
|
x: number;
|
|
@@ -72,8 +75,8 @@ export default class NvlController {
|
|
|
72
75
|
};
|
|
73
76
|
/**
|
|
74
77
|
* Map a relative DOM position to the Canvas space
|
|
75
|
-
* @param
|
|
76
|
-
* @param
|
|
78
|
+
* @param clientX - Relative X position from the top left [0..rect.width].
|
|
79
|
+
* @param clientY - Relative Y position from the top left [0..rect.height].
|
|
77
80
|
*/
|
|
78
81
|
mapRelativePositionToCanvasSpace(clientX: number, clientY: number): {
|
|
79
82
|
x: number;
|
|
@@ -104,8 +107,8 @@ export default class NvlController {
|
|
|
104
107
|
isDestroyed(): boolean;
|
|
105
108
|
destroy(): void;
|
|
106
109
|
callIfRegistered(...args: any[]): void;
|
|
107
|
-
getCanvasRelsAt(point: Point): import("
|
|
108
|
-
getCanvasNodesAt(point: Point, hitNodeMarginWidth?: number): import("
|
|
110
|
+
getCanvasRelsAt(point: Point): import("..").HitTargetRelationship[];
|
|
111
|
+
getCanvasNodesAt(point: Point, hitNodeMarginWidth?: number): import("..").HitTargetNode[];
|
|
109
112
|
private getLayout;
|
|
110
113
|
setLayout(layoutType: Layout): void;
|
|
111
114
|
setLayoutOptions(options: LayoutOptions): void;
|
|
@@ -113,6 +116,7 @@ export default class NvlController {
|
|
|
113
116
|
private initiateFileDownload;
|
|
114
117
|
private updateLayoutAndPositions;
|
|
115
118
|
saveToFile(options: SaveToFileOptions): void;
|
|
119
|
+
saveToSvg(options?: SaveToFileOptions): void;
|
|
116
120
|
getImageDataURL(options: SaveToFileOptions): string;
|
|
117
121
|
private prepareLargeFileForDownload;
|
|
118
122
|
private createCanvasAndRenderImage;
|
|
@@ -32,6 +32,6 @@ export interface Channel<T> {
|
|
|
32
32
|
export declare const getHtmlProperty: (item: Partial<Node | Relationship>) => HTMLElement | undefined;
|
|
33
33
|
/**
|
|
34
34
|
* Creates an empty dataset in which a graph be stored and updated using mobx actions.
|
|
35
|
-
* @returns A new and empty {@link DataSet}
|
|
35
|
+
* @returns A new and empty {@link DataSet}.
|
|
36
36
|
*/
|
|
37
37
|
export declare const createDataSet: <T extends Node | Relationship>() => DataSet<T>;
|
|
@@ -2,7 +2,7 @@ import type { NvlOptions, NvlState } from './types';
|
|
|
2
2
|
/**
|
|
3
3
|
* Create a new NVL state
|
|
4
4
|
*
|
|
5
|
-
* @param
|
|
6
|
-
* @returns
|
|
5
|
+
* @param options - The options for the new state.
|
|
6
|
+
* @returns The state object.
|
|
7
7
|
*/
|
|
8
8
|
export declare const createState: (options: NvlOptions) => NvlState;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { LogLevelDesc } from 'loglevel';
|
|
2
|
-
import type { WaypointPath } from '../../renderers/
|
|
2
|
+
import type { WaypointPath } from '../../renderers/domrenderer/shared/types';
|
|
3
|
+
import type { Node } from '../../types/graph-element';
|
|
3
4
|
import type { ExternalCallbacks } from '../ExternalCallbackHandler';
|
|
4
5
|
import type { NodeDataSet, RelationshipDataSet } from '../dataset';
|
|
5
6
|
type RingStyle = {
|
|
@@ -18,6 +19,7 @@ export type BorderStyle = {
|
|
|
18
19
|
};
|
|
19
20
|
/**
|
|
20
21
|
* @internal
|
|
22
|
+
* @hidden
|
|
21
23
|
*/
|
|
22
24
|
export type BorderStyles = {
|
|
23
25
|
selected: BorderStyle;
|
|
@@ -25,6 +27,7 @@ export type BorderStyles = {
|
|
|
25
27
|
};
|
|
26
28
|
/**
|
|
27
29
|
* @internal
|
|
30
|
+
* @hidden
|
|
28
31
|
*/
|
|
29
32
|
export type DisabledItemStyles = {
|
|
30
33
|
color: string;
|
|
@@ -35,25 +38,25 @@ export type DisabledItemStyles = {
|
|
|
35
38
|
*/
|
|
36
39
|
export interface ForceDirectedOptions {
|
|
37
40
|
/**
|
|
38
|
-
*
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
* @
|
|
41
|
+
* Enables a workaround for Intel GPU compatibility issues in WebGL shader compilation.
|
|
42
|
+
* When enabled, this flag modifies how physics simulation shaders are compiled to avoid
|
|
43
|
+
* rendering problems on Intel graphics hardware.
|
|
44
|
+
*
|
|
45
|
+
* @remarks Requires a restart of NVL as shaders need to be recompiled.
|
|
43
46
|
*/
|
|
44
47
|
intelWorkaround?: boolean;
|
|
45
48
|
/**
|
|
46
|
-
*
|
|
49
|
+
* Whether to enable automatic switching to CoseBilkent layout for small graphs.
|
|
50
|
+
* When enabled, small graphs will automatically use the CoseBilkent layout algorithm
|
|
51
|
+
* which can provide better initial positioning for smaller datasets.
|
|
47
52
|
*/
|
|
48
53
|
enableCytoscape?: boolean;
|
|
49
54
|
/**
|
|
55
|
+
* Wether to use the new physics engine instead of the legacy one.
|
|
56
|
+
* @defaultValue true
|
|
50
57
|
* @internal
|
|
51
58
|
*/
|
|
52
59
|
enableVerlet?: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* @internal
|
|
55
|
-
*/
|
|
56
|
-
simulationStopVelocity?: number;
|
|
57
60
|
}
|
|
58
61
|
/**
|
|
59
62
|
* The options for the hierarchical layout
|
|
@@ -66,43 +69,78 @@ export interface HierarchicalOptions {
|
|
|
66
69
|
}
|
|
67
70
|
export declare const isHierarchicalLayoutOptions: (options: LayoutOptions) => options is HierarchicalOptions;
|
|
68
71
|
/**
|
|
69
|
-
* The
|
|
72
|
+
* The options for the circular layout.
|
|
73
|
+
*/
|
|
74
|
+
export interface CircularOptions {
|
|
75
|
+
/**
|
|
76
|
+
* Function which should return the sorted nodes.
|
|
77
|
+
*/
|
|
78
|
+
sortFunction?: (nodes: Node[]) => Node[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* NVL's main force directed layout.
|
|
70
82
|
*/
|
|
71
83
|
export declare const ForceDirectedLayoutType = "forceDirected";
|
|
72
84
|
/**
|
|
73
|
-
*
|
|
85
|
+
* A hierarchical layout using the dagre algorithm.
|
|
74
86
|
*/
|
|
75
87
|
export declare const HierarchicalLayoutType = "hierarchical";
|
|
76
88
|
/**
|
|
77
|
-
*
|
|
78
|
-
* @internal
|
|
89
|
+
* A basic grid layout.
|
|
79
90
|
*/
|
|
80
91
|
export declare const GridLayoutType = "grid";
|
|
81
92
|
/**
|
|
82
|
-
*
|
|
83
|
-
* @internal
|
|
93
|
+
* A free layout that allows for arbitrary positioning of elements using NVL's setPosition method.
|
|
84
94
|
*/
|
|
85
95
|
export declare const FreeLayoutType = "free";
|
|
86
96
|
/**
|
|
87
|
-
* The
|
|
88
|
-
* @internal
|
|
97
|
+
* The commonly used d3-force layout.
|
|
89
98
|
*/
|
|
90
99
|
export declare const d3ForceLayoutType = "d3Force";
|
|
100
|
+
/**
|
|
101
|
+
* A basic circular layout.
|
|
102
|
+
* @experimental
|
|
103
|
+
*/
|
|
104
|
+
export declare const CircularLayoutType = "circular";
|
|
105
|
+
/**
|
|
106
|
+
* A WebGL renderer that uses the GPU for rendering.
|
|
107
|
+
*
|
|
108
|
+
* @remarks
|
|
109
|
+
* This renderer has better performance than the canvas renderer,
|
|
110
|
+
* but does not support captions and arrowheads.
|
|
111
|
+
*/
|
|
91
112
|
export declare const WebGLRendererType = "webgl";
|
|
113
|
+
/**
|
|
114
|
+
* A renderer using canvas.
|
|
115
|
+
*
|
|
116
|
+
* @remarks
|
|
117
|
+
* This renderer has lower performance than the WebGL renderer,
|
|
118
|
+
* but supports captions and arrowheads.
|
|
119
|
+
*/
|
|
92
120
|
export declare const CanvasRendererType = "canvas";
|
|
121
|
+
/**
|
|
122
|
+
* A renderer using SVG.
|
|
123
|
+
*
|
|
124
|
+
* @experimental
|
|
125
|
+
* @remarks
|
|
126
|
+
* This renderer is experimental.
|
|
127
|
+
*/
|
|
128
|
+
export declare const SvgRendererType = "svg";
|
|
93
129
|
/**
|
|
94
130
|
* The different types of layouts available
|
|
95
131
|
*/
|
|
96
|
-
export type Layout = typeof ForceDirectedLayoutType | typeof HierarchicalLayoutType | typeof GridLayoutType | typeof FreeLayoutType | typeof d3ForceLayoutType;
|
|
97
|
-
|
|
132
|
+
export type Layout = typeof ForceDirectedLayoutType | typeof HierarchicalLayoutType | typeof GridLayoutType | typeof FreeLayoutType | typeof d3ForceLayoutType | typeof CircularLayoutType;
|
|
133
|
+
/**
|
|
134
|
+
* The options for the layout.
|
|
135
|
+
*/
|
|
136
|
+
export type LayoutOptions = ForceDirectedOptions | HierarchicalOptions | CircularOptions;
|
|
98
137
|
/**
|
|
99
138
|
* The different types of renderers available
|
|
100
139
|
*/
|
|
101
|
-
export type Renderer = typeof WebGLRendererType | typeof CanvasRendererType;
|
|
140
|
+
export type Renderer = typeof WebGLRendererType | typeof CanvasRendererType | typeof SvgRendererType;
|
|
102
141
|
/** Configurations for a NVL instance */
|
|
103
142
|
export interface NvlOptions {
|
|
104
143
|
/**
|
|
105
|
-
* @internal
|
|
106
144
|
* Id for uniquely identifying the instance of Nvl
|
|
107
145
|
*/
|
|
108
146
|
instanceId?: string;
|
|
@@ -128,19 +166,13 @@ export interface NvlOptions {
|
|
|
128
166
|
* @defaultValue true
|
|
129
167
|
*/
|
|
130
168
|
allowDynamicMinZoom?: boolean;
|
|
131
|
-
/**
|
|
132
|
-
* @internal
|
|
133
|
-
* @deprecated
|
|
134
|
-
* The DOM element in which to render the graph visualization
|
|
135
|
-
*/
|
|
136
|
-
frame?: HTMLElement;
|
|
137
169
|
/**
|
|
138
170
|
* The DOM container in which to render the minimap.
|
|
139
171
|
*
|
|
140
|
-
* @
|
|
172
|
+
* @remarks When using a React ref, make sure the attached element is rendered before the NVL instance is created.
|
|
141
173
|
* Otherwise, the minimap will not be displayed.
|
|
142
174
|
*/
|
|
143
|
-
minimapContainer?: HTMLElement;
|
|
175
|
+
minimapContainer?: HTMLElement | null;
|
|
144
176
|
/** Configuration for the current layout */
|
|
145
177
|
layoutOptions?: LayoutOptions;
|
|
146
178
|
/** X-coordinate for panning of the current viewport */
|
|
@@ -149,27 +181,22 @@ export interface NvlOptions {
|
|
|
149
181
|
panY?: number;
|
|
150
182
|
/** Zoom value of the current viewport */
|
|
151
183
|
initialZoom?: number;
|
|
152
|
-
/**
|
|
153
|
-
* @deprecated use {@link renderer} instead
|
|
154
|
-
* Whether to user the Canvas or WebGL renderer
|
|
155
|
-
* Will be ignored when {@link renderer} is set
|
|
156
|
-
*/
|
|
157
|
-
useWebGL?: boolean;
|
|
158
184
|
/**
|
|
159
185
|
* What renderer to use
|
|
160
|
-
*
|
|
161
|
-
* @defaultValue 'webgl'
|
|
186
|
+
* @defaultValue 'canvas'
|
|
162
187
|
* WebGL renderer uses GPU and has better performance.
|
|
163
|
-
* Captions and arrowheads are only displayed when using the canvas renderer.
|
|
188
|
+
* Captions and arrowheads are only displayed when using the canvas or svg renderer.
|
|
164
189
|
*/
|
|
165
190
|
renderer?: Renderer;
|
|
166
191
|
/**
|
|
167
192
|
* @internal
|
|
193
|
+
* @hidden
|
|
168
194
|
* Whether or not to disable WebGL completely.
|
|
169
195
|
*/
|
|
170
196
|
disableWebGL?: boolean;
|
|
171
197
|
/**
|
|
172
198
|
* @internal
|
|
199
|
+
* @hidden
|
|
173
200
|
* Specify the log level.
|
|
174
201
|
*/
|
|
175
202
|
logging?: {
|
|
@@ -177,11 +204,16 @@ export interface NvlOptions {
|
|
|
177
204
|
};
|
|
178
205
|
/**
|
|
179
206
|
* @internal
|
|
207
|
+
* @hidden
|
|
180
208
|
*/
|
|
181
209
|
relationshipThreshold?: number;
|
|
210
|
+
/** Callbacks for various events in the NVL instance. */
|
|
182
211
|
callbacks?: ExternalCallbacks;
|
|
212
|
+
/** Styling options for the NVL instance. */
|
|
183
213
|
styling?: {
|
|
214
|
+
/** The default color for nodes. */
|
|
184
215
|
defaultNodeColor?: string;
|
|
216
|
+
/** The default color for relationships. */
|
|
185
217
|
defaultRelationshipColor?: string;
|
|
186
218
|
/** The color to use for the default border of nodes */
|
|
187
219
|
nodeDefaultBorderColor?: string;
|
|
@@ -198,28 +230,9 @@ export interface NvlOptions {
|
|
|
198
230
|
/** The color to use for the viewport box in the minimap */
|
|
199
231
|
minimapViewportBoxColor?: string;
|
|
200
232
|
};
|
|
201
|
-
/**
|
|
202
|
-
* The color to use for the default border of nodes
|
|
203
|
-
* @deprecated Use {@link styling.nodeDefaultBorderColor} instead
|
|
204
|
-
*/
|
|
205
|
-
nodeDefaultBorderColor?: string;
|
|
206
|
-
/**
|
|
207
|
-
* The color to use for the selected border of nodes
|
|
208
|
-
* @deprecated Use {@link styling.selectedBorderColor} instead
|
|
209
|
-
*/
|
|
210
|
-
selectedBorderColor?: string;
|
|
211
|
-
/**
|
|
212
|
-
* The color to use for the disabled nodes and relationships
|
|
213
|
-
* @deprecated Use {@link styling.disabledItemColor} instead
|
|
214
|
-
*/
|
|
215
|
-
disabledItemColor?: string;
|
|
216
|
-
/**
|
|
217
|
-
* The color to use for the labels of the disabled nodes and relationships
|
|
218
|
-
* @deprecated Use {@link styling.disabledItemFontColor} instead
|
|
219
|
-
*/
|
|
220
|
-
disabledItemFontColor?: string;
|
|
221
233
|
/**
|
|
222
234
|
* @internal
|
|
235
|
+
* @hidden
|
|
223
236
|
* Defines a time limit for how long layout iterations may run
|
|
224
237
|
*/
|
|
225
238
|
layoutTimeLimit?: number;
|
|
@@ -267,7 +280,6 @@ export interface NvlState {
|
|
|
267
280
|
fitNodeIds: string[];
|
|
268
281
|
resetZoom: boolean;
|
|
269
282
|
forceWebGL: boolean;
|
|
270
|
-
webGLVisible: boolean;
|
|
271
283
|
renderer: Renderer;
|
|
272
284
|
disableWebGL: boolean;
|
|
273
285
|
disableWebWorkers: boolean;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import type { StyledCaption } from '../../renderers/domrenderer/shared/types';
|
|
2
|
+
import type { Node, Relationship } from '../../types/graph-element';
|
|
1
3
|
import type { NvlOptions } from './types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Converts a {@link Node.caption} string to {@link Node.captions} array format.
|
|
6
|
+
* If both caption and captions are provided, captions takes precedence.
|
|
7
|
+
*/
|
|
8
|
+
export declare const processCaptions: (item: Partial<Node | Relationship>) => StyledCaption[];
|
|
9
|
+
export declare const processColorStyles: (styling: NvlOptions["styling"]) => {
|
|
8
10
|
nodeBorderStyles: {
|
|
9
11
|
default: {
|
|
10
12
|
rings?: {
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { NvlState } from '../../modules/state/types';
|
|
2
|
+
import type { Node } from '../../types/graph-element';
|
|
3
|
+
import ImageCache from './shared/ImageCache';
|
|
4
|
+
import ArrowBundler from './shared/arrows/ArrowBundler';
|
|
5
|
+
import type { RelationshipToRender } from './shared/types';
|
|
6
|
+
/**
|
|
7
|
+
* Base class for renderers (Canvas and SVG) that provides common functionality
|
|
8
|
+
*/
|
|
9
|
+
export default abstract class BaseRenderer {
|
|
10
|
+
arrowBundler: ArrowBundler;
|
|
11
|
+
protected state: NvlState;
|
|
12
|
+
protected relationshipThreshold: number;
|
|
13
|
+
protected stateDisposers: NvlState['reaction'][];
|
|
14
|
+
protected needsRun: boolean;
|
|
15
|
+
protected imageCache: ImageCache;
|
|
16
|
+
protected nodeVersion: number;
|
|
17
|
+
protected relVersion: number;
|
|
18
|
+
protected waypointVersion: number;
|
|
19
|
+
protected channelId: string;
|
|
20
|
+
constructor(state: NvlState, relationshipThreshold: number, channelId: string);
|
|
21
|
+
/**
|
|
22
|
+
* Gets relationships to render, sorted by their rendering order
|
|
23
|
+
* @param showCaptions - Whether to show relationship captions
|
|
24
|
+
* @param zoom - Current zoom level (optional, used for threshold checking)
|
|
25
|
+
* @param checkOffScreen - Whether to check if relationships are off screen
|
|
26
|
+
* @param clientWidth - Width of the rendering area (only needed if checkOffScreen is true)
|
|
27
|
+
* @param clientHeight - Height of the rendering area (only needed if checkOffScreen is true)
|
|
28
|
+
* @returns Array of relationships to render, sorted (disabled, normal, selected)
|
|
29
|
+
*/
|
|
30
|
+
protected getRelationshipsToRender(showCaptions: boolean, zoom?: number, clientWidth?: number, clientHeight?: number, checkOffScreen?: boolean): RelationshipToRender[];
|
|
31
|
+
/**
|
|
32
|
+
* Gets nodes to render, sorted by their rendering order
|
|
33
|
+
* @param positionArray - Array of nodes with positions
|
|
34
|
+
* @param checkOffScreen - Whether to check if nodes are off screen
|
|
35
|
+
* @param clientWidth - Width of the rendering area (only needed if checkOffScreen is true)
|
|
36
|
+
* @param clientHeight - Height of the rendering area (only needed if checkOffScreen is true)
|
|
37
|
+
* @returns Array of nodes to render, sorted (disabled, normal, selected)
|
|
38
|
+
*/
|
|
39
|
+
protected getNodesToRender(positionArray: Node[], clientWidth?: number, clientHeight?: number, checkOffScreen?: boolean): Node[];
|
|
40
|
+
/**
|
|
41
|
+
* Processes updates in nodes and relationships.
|
|
42
|
+
* Subclasses can override onNodeVersionUpdate() for custom behavior.
|
|
43
|
+
*/
|
|
44
|
+
processUpdates(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Hook for subclasses to handle node version updates.
|
|
47
|
+
* Override this to add custom node update handling.
|
|
48
|
+
*/
|
|
49
|
+
protected onNodeVersionUpdate(nodeChannel: any): void;
|
|
50
|
+
/**
|
|
51
|
+
* Checks if a bounding box is off screen
|
|
52
|
+
* @param boundingBox - The bounding box to check
|
|
53
|
+
* @param clientWidth - Width of the rendering area
|
|
54
|
+
* @param clientHeight - Height of the rendering area
|
|
55
|
+
* @returns Whether the bounding box is off screen
|
|
56
|
+
*/
|
|
57
|
+
protected isBoundingBoxOffScreen(boundingBox: DOMRect, clientWidth: number, clientHeight: number): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Abstract method to be implemented by subclasses
|
|
60
|
+
*/
|
|
61
|
+
abstract needsToRun(): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Abstract method to be implemented by subclasses
|
|
64
|
+
*/
|
|
65
|
+
abstract destroy(): void;
|
|
66
|
+
}
|
|
@@ -24,40 +24,37 @@ export declare class Animation {
|
|
|
24
24
|
private hasNextAnimation;
|
|
25
25
|
/**
|
|
26
26
|
* Constructor
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
27
|
+
* @param elementId - The id of the element to animate.
|
|
28
|
+
* @param startValue - The start value of the animation.
|
|
29
29
|
*/
|
|
30
30
|
constructor(elementId: string, startValue: number);
|
|
31
31
|
/**
|
|
32
|
-
* Sets the duration of the animation
|
|
33
|
-
* @param
|
|
34
|
-
* @returns {void}
|
|
32
|
+
* Sets the duration of the animation.
|
|
33
|
+
* @param duration - The duration of the animation.
|
|
35
34
|
* @public
|
|
36
35
|
*/
|
|
37
36
|
setDuration(duration: number): void;
|
|
38
37
|
/**
|
|
39
38
|
* Returns the status of the animation
|
|
40
|
-
* @returns
|
|
39
|
+
* @returns The status of the animation.
|
|
41
40
|
* @public
|
|
42
41
|
*/
|
|
43
42
|
getStatus(): number;
|
|
44
43
|
/**
|
|
45
44
|
* Advances the animation to the next frame
|
|
46
|
-
* @returns
|
|
45
|
+
* @returns True if there is a next animation, false otherwise.
|
|
47
46
|
* @public
|
|
48
47
|
*/
|
|
49
48
|
advance(): boolean;
|
|
50
49
|
/**
|
|
51
50
|
* Sets the end value of the animation
|
|
52
|
-
* @param
|
|
53
|
-
* @returns {void}
|
|
51
|
+
* @param targetValue - The end value of the animation.
|
|
54
52
|
* @public
|
|
55
53
|
*/
|
|
56
54
|
setEndValue(targetValue: number): void;
|
|
57
55
|
/**
|
|
58
56
|
* Sets the end time of the animation
|
|
59
|
-
* @param
|
|
60
|
-
* @returns {void}
|
|
57
|
+
* @param newEndTime - The end time of the animation.
|
|
61
58
|
* @private
|
|
62
59
|
*/
|
|
63
60
|
private setEndTime;
|
package/dist/types/renderers/{canvasrenderer → domrenderer/canvasrenderer}/AnimationHandler.d.ts
RENAMED
|
@@ -18,18 +18,18 @@ export default class AnimationHandler {
|
|
|
18
18
|
constructor();
|
|
19
19
|
/**
|
|
20
20
|
* Main function run once per frame to advance all animations
|
|
21
|
-
* @returns
|
|
21
|
+
* @returns True if any animation is still running.
|
|
22
22
|
*/
|
|
23
23
|
advance(): boolean;
|
|
24
24
|
/**
|
|
25
25
|
* Sets a flag if animations should be ignored.
|
|
26
26
|
* If set to true all animations always return their end value.
|
|
27
|
-
* @param
|
|
27
|
+
* @param shouldIgnore - Whether animations should be ignored.
|
|
28
28
|
*/
|
|
29
29
|
ignoreAnimations(shouldIgnore: boolean): void;
|
|
30
30
|
/**
|
|
31
31
|
* Sets the duration for all animations
|
|
32
|
-
* @param
|
|
32
|
+
* @param options - An object containing animation durations for fade and size.
|
|
33
33
|
*/
|
|
34
34
|
setOptions(options: {
|
|
35
35
|
fadeDuration: number;
|
|
@@ -37,14 +37,13 @@ export default class AnimationHandler {
|
|
|
37
37
|
}): void;
|
|
38
38
|
/**
|
|
39
39
|
* Returns whether any animation is running
|
|
40
|
-
* @returns
|
|
41
|
-
*/
|
|
40
|
+
* @returns */
|
|
42
41
|
needsToRun(): boolean;
|
|
43
42
|
/**
|
|
44
43
|
* Returns the current value of an animation
|
|
45
|
-
* @param
|
|
46
|
-
* @param
|
|
47
|
-
* @returns
|
|
44
|
+
* @param elementId - The id of the element the animation is running on.
|
|
45
|
+
* @param name - The name of the animation.
|
|
46
|
+
* @returns The current value of the animation.
|
|
48
47
|
*/
|
|
49
48
|
getValueForAnimationName(elementId: string, name: string, target: number, type?: number): number;
|
|
50
49
|
private createAnimation;
|
|
@@ -53,20 +52,20 @@ export default class AnimationHandler {
|
|
|
53
52
|
* Creates a new size animation for the given element and name.
|
|
54
53
|
* If an animation already exists for the given element and name, it will be returned.
|
|
55
54
|
* If not, a new animation will be created.
|
|
56
|
-
* @param
|
|
57
|
-
* @param
|
|
58
|
-
* @param
|
|
59
|
-
* @returns
|
|
55
|
+
* @param currentValue - The current value of the animation.
|
|
56
|
+
* @param elementId - The id of the element to animate.
|
|
57
|
+
* @param name - The name of the animation.
|
|
58
|
+
* @returns The animation.
|
|
60
59
|
*/
|
|
61
60
|
private createFadeAnimation;
|
|
62
61
|
/**
|
|
63
62
|
* Creates a new fade animation for the given element and name.
|
|
64
63
|
* If an animation already exists for the given element and name, it will be returned.
|
|
65
64
|
* If not, a new animation will be created.
|
|
66
|
-
* @param
|
|
67
|
-
* @param
|
|
68
|
-
* @param
|
|
69
|
-
* @returns
|
|
65
|
+
* @param currentValue - The current value of the animation.
|
|
66
|
+
* @param elementId - The id of the element to animate.
|
|
67
|
+
* @param name - The name of the animation.
|
|
68
|
+
* @returns The animation.
|
|
70
69
|
*/
|
|
71
70
|
private createSizeAnimation;
|
|
72
71
|
}
|