@neo4j-nvl/base 0.3.9-9edeba96 → 0.3.9-ce347313
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/index.d.ts +91 -68
- package/dist/types/layouts/animatedlayout/animationUtils.d.ts +3 -3
- package/dist/types/layouts/forcedirectedlayout/physlayout/PhysLayout.d.ts +19 -19
- package/dist/types/modules/CallbackHelper.d.ts +5 -5
- package/dist/types/modules/ExternalCallbackHandler.d.ts +9 -0
- package/dist/types/modules/NvlController.d.ts +4 -4
- 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 +44 -13
- package/dist/types/renderers/canvasrenderer/Animation.d.ts +8 -11
- package/dist/types/renderers/canvasrenderer/AnimationHandler.d.ts +15 -16
- package/dist/types/renderers/canvasrenderer/CanvasRenderer.d.ts +10 -10
- package/dist/types/renderers/canvasrenderer/arrows/ArrowBundle.d.ts +15 -15
- package/dist/types/renderers/canvasrenderer/arrows/ArrowBundler.d.ts +8 -8
- package/dist/types/renderers/canvasrenderer/arrows/arrows.d.ts +26 -26
- package/dist/types/renderers/canvasrenderer/nodes/nodes.d.ts +9 -9
- package/dist/types/renderers/canvasrenderer/types.d.ts +6 -4
- package/dist/types/renderers/canvasrenderer/util.d.ts +20 -21
- package/dist/types/renderers/canvasrenderer/wordwrap.d.ts +13 -13
- package/dist/types/types/graph-element.d.ts +7 -2
- package/dist/types/utils/canvasManagement.d.ts +2 -1
- package/dist/types/utils/colorUtils.d.ts +3 -3
- package/dist/types/utils/constants.d.ts +3 -3
- 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 +3 -3
- package/dist/types/utils/hittest.d.ts +2 -0
- package/dist/types/utils/jsDriverResultTransformer.d.ts +13 -6
- package/dist/types/utils/segmentAnalytics.d.ts +7 -7
- package/dist/types/utils/zoomFunctions.d.ts +25 -22
- package/package.json +2 -2
package/dist/types/index.d.ts
CHANGED
|
@@ -11,9 +11,10 @@ import { nvlResultTransformer } from './utils/jsDriverResultTransformer';
|
|
|
11
11
|
import { getZoomTargetForNodePositions } from './utils/zoomFunctions';
|
|
12
12
|
/**
|
|
13
13
|
* Extends the MouseEvent interface with the {@link HitTargets} property.
|
|
14
|
-
* The result of a
|
|
14
|
+
* The result of a {@link NVL.getHits} call.
|
|
15
15
|
*/
|
|
16
16
|
interface NvlMouseEvent extends MouseEvent {
|
|
17
|
+
/** The graph elements that have been hit by the pointer event. */
|
|
17
18
|
nvlTargets: HitTargets;
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
@@ -37,27 +38,31 @@ interface NvlMouseEvent extends MouseEvent {
|
|
|
37
38
|
*/
|
|
38
39
|
declare class NVL {
|
|
39
40
|
#private;
|
|
41
|
+
/**
|
|
42
|
+
* @internal
|
|
43
|
+
* @hidden
|
|
44
|
+
*/
|
|
40
45
|
readonly performance: any;
|
|
41
46
|
/**
|
|
42
47
|
* Creates a new NVL instance.
|
|
43
|
-
* @param
|
|
44
|
-
* @param
|
|
45
|
-
* @param
|
|
46
|
-
* @param {NvlOptions
|
|
47
|
-
* @param
|
|
48
|
+
* @param frame - The DOM element to display the graph in.
|
|
49
|
+
* @param nvlNodes - An array of {@link Node nodes}.
|
|
50
|
+
* @param nvlRels - An array of {@link Relationship relationships}.
|
|
51
|
+
* @param options - The {@link NvlOptions options} for the NVL instance.
|
|
52
|
+
* @param callbacks - Callbacks triggered on NVL events.
|
|
48
53
|
*/
|
|
49
54
|
constructor(frame: HTMLElement, nvlNodes?: Node[], nvlRels?: Relationship[], options?: NvlOptions, callbacks?: ExternalCallbacks);
|
|
50
55
|
/**
|
|
51
56
|
* Restarts the NVL instance.
|
|
52
|
-
* @param
|
|
53
|
-
* @param
|
|
57
|
+
* @param options - New {@link NvlOptions} for the NVL instance.
|
|
58
|
+
* @param retainPositions - Whether or not to retain the current node positions.
|
|
54
59
|
* New options will be merged with current options
|
|
55
60
|
*/
|
|
56
61
|
restart(options?: NvlOptions, retainPositions?: boolean): void;
|
|
57
62
|
/**
|
|
58
63
|
* Adds nodes and relationships to NVL and updates existing nodes and relationships.
|
|
59
|
-
* @param
|
|
60
|
-
* @param
|
|
64
|
+
* @param nodes - An Array of {@link Node nodes} to be added or updated.
|
|
65
|
+
* @param relationships - An Array of {@link Relationship relationships} to be added or updated.
|
|
61
66
|
* To update nodes or relationships, they must have an id that matches the id of the
|
|
62
67
|
* node or relationship to be updated.
|
|
63
68
|
* Only the properties that are provided will be updated.
|
|
@@ -85,18 +90,18 @@ declare class NVL {
|
|
|
85
90
|
addAndUpdateElementsInGraph(nodes?: Node[] | PartialNode[], relationships?: Relationship[] | PartialRelationship[]): void;
|
|
86
91
|
/**
|
|
87
92
|
* Gets the currently selected nodes.
|
|
88
|
-
* @returns
|
|
93
|
+
* @returns An array of all currently selected {@link Node nodes} and their positions.
|
|
89
94
|
*/
|
|
90
95
|
getSelectedNodes(): (Node & Point)[];
|
|
91
96
|
/**
|
|
92
97
|
* Gets the currently selected relationships.
|
|
93
|
-
* @returns
|
|
98
|
+
* @returns An array of all currently selected {@link Relationship relationships}.
|
|
94
99
|
*/
|
|
95
100
|
getSelectedRelationships(): Relationship[];
|
|
96
101
|
/**
|
|
97
102
|
* Updates relationships in the current scene with the provided array of nodes and relationships.
|
|
98
|
-
* @param
|
|
99
|
-
* @param
|
|
103
|
+
* @param nodes - The updated {@link Node nodes}.
|
|
104
|
+
* @param relationships - The updated {@link Relationship relationships}.
|
|
100
105
|
* Ignores any nodes or relationships that do not exist in the current scene.
|
|
101
106
|
* To update nodes or relationships, they must have an id that matches the id of the
|
|
102
107
|
* node or relationship to be updated.
|
|
@@ -122,54 +127,55 @@ declare class NVL {
|
|
|
122
127
|
updateElementsInGraph(nodes: Node[] | PartialNode[], relationships: Relationship[] | PartialRelationship[]): void;
|
|
123
128
|
/**
|
|
124
129
|
* Adds nodes and relationships in the current scene.
|
|
125
|
-
* @param
|
|
126
|
-
* @param
|
|
130
|
+
* @param nodes - The nodes to be added.
|
|
131
|
+
* @param relationships - The relationships to be added.
|
|
127
132
|
*/
|
|
128
133
|
addElementsToGraph(nodes: Node[], relationships: Relationship[]): void;
|
|
129
134
|
/**
|
|
130
135
|
* Removes the specified nodes from the current scene.
|
|
131
|
-
* @param
|
|
136
|
+
* @param nodeIds - The node ids to be removed.
|
|
132
137
|
* Adjacent relationships will also be removed.
|
|
133
138
|
*/
|
|
134
139
|
removeNodesWithIds(nodeIds: string[]): void;
|
|
135
140
|
/**
|
|
136
141
|
* Removes the specified relationships from the current scene.
|
|
137
|
-
* @param
|
|
142
|
+
* @param relationshipIds - The relationship ids to be removed.
|
|
138
143
|
*/
|
|
139
144
|
removeRelationshipsWithIds(relationshipIds: string[]): void;
|
|
140
145
|
/**
|
|
141
146
|
* Returns all nodes that is currently stored in the visualisation.
|
|
142
|
-
* @returns
|
|
147
|
+
* @returns The array of {@link Node nodes}.
|
|
143
148
|
*/
|
|
144
149
|
getNodes(): Node[];
|
|
145
150
|
/**
|
|
146
151
|
* Returns the relationships that are currently in the visualization.
|
|
147
|
-
* @returns
|
|
152
|
+
* @returns An array of the {@link Relationship relationships} in the visualization.
|
|
148
153
|
*/
|
|
149
154
|
getRelationships(): Relationship[];
|
|
150
155
|
/**
|
|
151
156
|
* Returns the node data that is currently stored in the visualisation for a given id.
|
|
152
|
-
* @param
|
|
153
|
-
* @returns {Node
|
|
157
|
+
* @param id - The id of the {@link Node node} that should be returned.
|
|
158
|
+
* @returns The {@link Node node} or undefined if there is no node with the given id.
|
|
154
159
|
*/
|
|
155
160
|
getNodeById(id: string): Node;
|
|
156
161
|
/**
|
|
157
162
|
* Returns the relationship data that is currently stored in the visualisation for a given id.
|
|
158
|
-
* @param
|
|
159
|
-
* @returns {Relationship
|
|
163
|
+
* @param id - The id of the {@link Relationship relationship} that should be returned.
|
|
164
|
+
* @returns The {@link Relationship relationship} or undefined if there is no relationship with the given id.
|
|
160
165
|
*/
|
|
161
166
|
getRelationshipById(id: string): Relationship;
|
|
162
167
|
/**
|
|
163
168
|
* Returns the node position that is currently stored in the visualisation for a given id.
|
|
164
|
-
* @param
|
|
165
|
-
* @returns
|
|
169
|
+
* @param id - The id of the node position that should be returned.
|
|
170
|
+
* @returns The position information for the given id, or undefined if there is no such {@link Node node}.
|
|
166
171
|
* or the layout has not yet run with that node.
|
|
167
172
|
*/
|
|
168
173
|
getPositionById(id: string): Node;
|
|
169
174
|
/**
|
|
170
175
|
* Returns the current options.
|
|
171
|
-
* @returns
|
|
176
|
+
* @returns The current options.
|
|
172
177
|
* @internal
|
|
178
|
+
* @hidden
|
|
173
179
|
*/
|
|
174
180
|
getCurrentOptions(): NvlOptions;
|
|
175
181
|
/** Removes the graph visualization from the DOM and cleans up everything. */
|
|
@@ -180,106 +186,118 @@ declare class NVL {
|
|
|
180
186
|
deselectAll(): void;
|
|
181
187
|
/**
|
|
182
188
|
* Updates pan and zoom fit the specified nodes in the viewport.
|
|
183
|
-
* @param
|
|
184
|
-
* @param
|
|
189
|
+
* @param nodeIds - The ids of the nodes to fit on the screen.
|
|
190
|
+
* @param zoomOptions - Specific options on how to transition the zoom.
|
|
191
|
+
*
|
|
192
|
+
* @remarks
|
|
185
193
|
* If the zoom level required to fit the provided nodes is outside of the range provided by the
|
|
186
|
-
* {@link NvlOptions.minZoom} and {@link NvlOptions.maxZoom} options,
|
|
187
|
-
*
|
|
194
|
+
* {@link NvlOptions.minZoom minZoom} and {@link NvlOptions.maxZoom maxZoom} options, and the
|
|
195
|
+
* {@link NvlOptions.allowDynamicMinZoom allowDynamicMinZoom} option is set to `false`,
|
|
188
196
|
* the zoom level will be set to the closest valid zoom level,
|
|
189
197
|
* even if the given nodes do not fit the viewport yet.
|
|
190
198
|
*/
|
|
191
199
|
fit(nodeIds: string[], zoomOptions?: NvlState['zoomOptions']): void;
|
|
192
200
|
/**
|
|
193
|
-
* Resets the zoom of the viewport back to the default zoom level of 0.75
|
|
201
|
+
* Resets the zoom of the viewport back to the default zoom level of 0.75.
|
|
194
202
|
*/
|
|
195
203
|
resetZoom(): void;
|
|
196
204
|
/**
|
|
197
205
|
* Toggles between the WebGL and Canvas rendering.
|
|
198
206
|
* @deprecated use {@link setRenderer} instead.
|
|
199
|
-
* @param
|
|
207
|
+
* @param enabled - Whether or not WebGL renderer should be used.
|
|
200
208
|
* @internal
|
|
209
|
+
* @hidden
|
|
201
210
|
*/
|
|
202
211
|
setUseWebGLRenderer(enabled: boolean): void;
|
|
203
212
|
/**
|
|
204
|
-
* Switches between rendering methods
|
|
205
|
-
* @param renderer -
|
|
213
|
+
* Switches between rendering methods.
|
|
214
|
+
* @param renderer - Which rendering method to use.
|
|
206
215
|
*/
|
|
207
216
|
setRenderer(renderer: string): void;
|
|
208
217
|
/**
|
|
209
218
|
* Restarts NVL with or without WebGL support.
|
|
210
|
-
* @param
|
|
211
|
-
* Not to be confused with {@link setUseWebGLRenderer}, which only affects the rendering method
|
|
219
|
+
* @param disabled - Whether or not WebGL should be disabled.
|
|
212
220
|
* @experimental
|
|
213
221
|
*/
|
|
214
222
|
setDisableWebGL(disabled?: boolean): void;
|
|
215
223
|
/**
|
|
216
224
|
* Pins the specified node so it is not affected by layout forces.
|
|
217
|
-
* @param
|
|
225
|
+
* @param nodeId - The id of the node to be pinned.
|
|
218
226
|
*/
|
|
219
227
|
pinNode(nodeId: string): void;
|
|
220
228
|
/**
|
|
221
229
|
* Un-pins the specified nodes so it is affected by layout forces again.
|
|
222
|
-
* @param
|
|
230
|
+
* @param nodeIds The ids of the nodes to be un-pinned.
|
|
223
231
|
*/
|
|
224
232
|
unPinNode(nodeIds: string[]): void;
|
|
225
233
|
/**
|
|
226
234
|
* Changes the layout type.
|
|
227
|
-
* @param
|
|
235
|
+
* @param layout - The {@link Layout} type.
|
|
228
236
|
*/
|
|
229
237
|
setLayout(layout: Layout): void;
|
|
230
238
|
/**
|
|
231
239
|
* Updates the configuration of the current layout.
|
|
232
|
-
* @param
|
|
240
|
+
* @param options - The {@link LayoutOptions} configuration.
|
|
233
241
|
*/
|
|
234
242
|
setLayoutOptions(options: LayoutOptions): void;
|
|
235
243
|
/**
|
|
236
244
|
* Returns the nodes that are currently in the visualization.
|
|
237
245
|
* The `rels` property of the returned object is always empty.
|
|
238
|
-
* @returns
|
|
246
|
+
* @returns An object containing the nodes and relationships in the visualization.
|
|
239
247
|
*/
|
|
240
248
|
getNodesOnScreen(): {
|
|
249
|
+
/** The nodes in the visualization. */
|
|
241
250
|
nodes: Node[];
|
|
251
|
+
/** The relationships in the visualization. */
|
|
242
252
|
rels: Relationship[];
|
|
243
253
|
};
|
|
244
254
|
/**
|
|
245
255
|
* Fetches and returns the current positions of all nodes as an array of coordinates.
|
|
246
|
-
* @returns
|
|
256
|
+
* @returns An array of {@link Node node} positions.
|
|
247
257
|
*/
|
|
248
258
|
getNodePositions(): (Node & Point)[];
|
|
249
259
|
/**
|
|
250
|
-
* Sets the node positions based on data provided
|
|
251
|
-
* @param
|
|
252
|
-
* @param
|
|
260
|
+
* Sets the node positions based on data provided.
|
|
261
|
+
* @param data - The positions that the nodes should be set to.
|
|
262
|
+
* @param updateLayout - Whether or not the current layout algorithm
|
|
253
263
|
* should update the graph after setting the node positions.
|
|
254
|
-
*
|
|
264
|
+
*
|
|
265
|
+
* @remarks
|
|
266
|
+
* For node positions to be unaffected by layout algorithms, use the 'free' layout type
|
|
255
267
|
* or use {@link pinNode} to pin the nodes that should remain still.
|
|
256
268
|
* False by default.
|
|
257
269
|
*/
|
|
258
270
|
setNodePositions(data: Node[], updateLayout?: boolean): void;
|
|
259
271
|
/**
|
|
260
272
|
* Checks and returns whether the current layout is still in flux.
|
|
261
|
-
* @returns
|
|
273
|
+
* @returns Whether or not the layout is moving.
|
|
262
274
|
*/
|
|
263
275
|
isLayoutMoving(): boolean;
|
|
264
276
|
/**
|
|
265
277
|
* Saves the current view of the graph visualization canvas as a png to the client.
|
|
266
278
|
* @param {{ filename: string, backgroundColor: string }} options The filename and background color of the png.
|
|
267
|
-
* @param
|
|
268
|
-
* @param
|
|
279
|
+
* @param options.filename - The filename of the png file.
|
|
280
|
+
* @param options.backgroundColor - The background color of the png file.
|
|
269
281
|
* The size of the png file will be the size of the canvas in the DOM.
|
|
270
282
|
*/
|
|
271
283
|
saveToFile(options?: {
|
|
272
284
|
filename?: string;
|
|
273
285
|
backgroundColor?: string;
|
|
274
286
|
}): void;
|
|
287
|
+
/**
|
|
288
|
+
* Returns the current view of the graph visualization canvas as a data URL.
|
|
289
|
+
* @param options - The options for the image.
|
|
290
|
+
* @param options.backgroundColor - The background color of the data URL.
|
|
291
|
+
* @returns A data URL of the current view of the graph visualization canvas.
|
|
292
|
+
*/
|
|
275
293
|
getImageDataUrl(options?: {
|
|
276
294
|
backgroundColor?: string;
|
|
277
295
|
}): string;
|
|
278
296
|
/**
|
|
279
297
|
* Saves the entire graph visualization canvas as a png to the client.
|
|
280
298
|
* @param {{ filename: string, backgroundColor: string }} options The filename and background color of the png.
|
|
281
|
-
* @param
|
|
282
|
-
* @param
|
|
299
|
+
* @param options.filename - The filename of the png file.
|
|
300
|
+
* @param options.backgroundColor - The background color of the png file.
|
|
283
301
|
* The size of the png file will be as large as the entire graph at the default zoom level.
|
|
284
302
|
* Can result in a very large file.
|
|
285
303
|
*/
|
|
@@ -289,32 +307,36 @@ declare class NVL {
|
|
|
289
307
|
}): void;
|
|
290
308
|
/**
|
|
291
309
|
* Sets the zoom of the viewport to a specific value.
|
|
292
|
-
* @param
|
|
293
|
-
* @
|
|
310
|
+
* @param zoomValue - The desired zoom level.
|
|
311
|
+
* @remarks
|
|
312
|
+
*
|
|
313
|
+
* When updating both the zoom level and pan coordinates,
|
|
294
314
|
* use {@link setZoomAndPan} instead of calling {@link setZoom} and {@link setPan}
|
|
295
315
|
* separately to avoid jittering.
|
|
296
|
-
*
|
|
316
|
+
*
|
|
317
|
+
* If the zoom level is outside of the range provided by the
|
|
297
318
|
* {@link NvlOptions.minZoom} and {@link NvlOptions.maxZoom} options,
|
|
298
319
|
* the zoom level will be set to the closest valid zoom level.
|
|
299
320
|
* If {@link NvlOptions.allowDynamicMinZoom} is set to true,
|
|
300
321
|
* the {@link NvlOptions.minZoom} option will be ignored of the current graph does not fit the viewport.
|
|
301
322
|
*/
|
|
302
|
-
setZoom(
|
|
323
|
+
setZoom(zoomValue: number): void;
|
|
303
324
|
/**
|
|
304
325
|
* Sets the zoom of the viewport to a specific value.
|
|
305
|
-
* @param
|
|
306
|
-
* @param
|
|
307
|
-
* @
|
|
326
|
+
* @param panX - The desired panX value.
|
|
327
|
+
* @param panY - The desired panY value.
|
|
328
|
+
* @remarks When updating both the zoom level and pan coordinates,
|
|
308
329
|
* use {@link setZoomAndPan} instead of calling {@link setZoom} and {@link setPan} separately to avoid jittering.
|
|
309
330
|
*/
|
|
310
331
|
setPan(panX: number, panY: number): void;
|
|
311
332
|
/**
|
|
312
333
|
* Sets the zoom and pan of the viewport to specific values.
|
|
313
|
-
* @param
|
|
314
|
-
* @param
|
|
315
|
-
* @param
|
|
316
|
-
* @
|
|
317
|
-
*
|
|
334
|
+
* @param zoom - The desired zoom level.
|
|
335
|
+
* @param panX - The desired panX value.
|
|
336
|
+
* @param panY - The desired panY value.
|
|
337
|
+
* @remarks When only updating zoom level or pan coordinates, use {@link setZoom} or {@link setPan} instead.
|
|
338
|
+
*
|
|
339
|
+
* If the zoom level is outside of the range provided by the
|
|
318
340
|
* {@link NvlOptions.minZoom} and {@link NvlOptions.maxZoom} options,
|
|
319
341
|
* the zoom level will be set to the closest valid zoom level.
|
|
320
342
|
* If {@link NvlOptions.allowDynamicMinZoom} is set to true,
|
|
@@ -323,18 +345,18 @@ declare class NVL {
|
|
|
323
345
|
setZoomAndPan(zoom: number, panX: number, panY: number): void;
|
|
324
346
|
/**
|
|
325
347
|
* Get the current zoom level of the viewport.
|
|
326
|
-
* @returns
|
|
348
|
+
* @returns The current zoom level.
|
|
327
349
|
*/
|
|
328
350
|
getScale(): number;
|
|
329
351
|
/**
|
|
330
352
|
* Returns the current pan of the viewport.
|
|
331
|
-
* @returns
|
|
353
|
+
* @returns The current pan of the viewport.
|
|
332
354
|
*/
|
|
333
355
|
getPan(): Point;
|
|
334
356
|
/**
|
|
335
357
|
* Gets the nodes and relationships that have been hit by a pointer event.
|
|
336
|
-
* @param evt The mouse event.
|
|
337
|
-
* @param targets The graph elements to check for hits. Defaults to ['node', 'relationship'].
|
|
358
|
+
* @param evt - The mouse event.
|
|
359
|
+
* @param targets - The graph elements to check for hits. Defaults to ['node', 'relationship'].
|
|
338
360
|
* @param hitOptions - Options for the hit test.
|
|
339
361
|
* @returns A {@link NvlMouseEvent} with the {@link HitTargets} property
|
|
340
362
|
* containing the nodes and relationships that have been hit by the pointer event.
|
|
@@ -364,6 +386,7 @@ declare class NVL {
|
|
|
364
386
|
/**
|
|
365
387
|
* Functions for mapping colors.
|
|
366
388
|
* @internal
|
|
389
|
+
* @hidden
|
|
367
390
|
*/
|
|
368
391
|
declare const colorMapperFunctions: {
|
|
369
392
|
textColorForBackground: (color: string) => string;
|
|
@@ -2,8 +2,8 @@ import type { Node } from '../../types/graph-element';
|
|
|
2
2
|
import type { Point } from '../../utils/geometry';
|
|
3
3
|
/**
|
|
4
4
|
* Calculates the average node coordinates for a given set of nodes.
|
|
5
|
-
* @param
|
|
6
|
-
* @param
|
|
7
|
-
* @returns
|
|
5
|
+
* @param nodes - The nodes to calculate the average position for.
|
|
6
|
+
* @param positions - The positions of the nodes.
|
|
7
|
+
* @returns The average node coordinates.
|
|
8
8
|
*/
|
|
9
9
|
export declare const calculateAverageNodePosition: (nodes: Node[], positions: Record<string, Node | Point>) => number[];
|
|
@@ -58,15 +58,15 @@ export declare class PhysLayout {
|
|
|
58
58
|
state: NvlState;
|
|
59
59
|
});
|
|
60
60
|
/**
|
|
61
|
-
* Sets the layout options
|
|
62
|
-
* @param
|
|
63
|
-
* @param
|
|
61
|
+
* Sets the layout options.
|
|
62
|
+
* @param options - The object with the options.
|
|
63
|
+
* @param initial - Whether this is the first setting of options.
|
|
64
64
|
*/
|
|
65
65
|
setOptions(options?: ForceDirectedOptions, initial?: boolean): void;
|
|
66
66
|
/**
|
|
67
67
|
* Sets graph data to be used
|
|
68
68
|
* @param {{ nodes: Node[]; rels: Relationship[] }} data the graph object
|
|
69
|
-
* @returns
|
|
69
|
+
* @returns The top level graph of the subgraphs created by the solar merger.
|
|
70
70
|
*/
|
|
71
71
|
setData(data: {
|
|
72
72
|
nodes: Node[];
|
|
@@ -75,7 +75,7 @@ export declare class PhysLayout {
|
|
|
75
75
|
/**
|
|
76
76
|
* Updates the node's positions for the next step in the physics layout iterations if the layout needs to update
|
|
77
77
|
* @param refreshPositions whether the entire layout should be reheated
|
|
78
|
-
* @returns
|
|
78
|
+
* @returns Whether the layout should update in the following step.
|
|
79
79
|
*/
|
|
80
80
|
update(refreshPositions?: boolean): boolean;
|
|
81
81
|
/**
|
|
@@ -84,24 +84,24 @@ export declare class PhysLayout {
|
|
|
84
84
|
terminateUpdate(): void;
|
|
85
85
|
/**
|
|
86
86
|
* Returns whether the current layout needs to be updated in the next iteration step.
|
|
87
|
-
* @returns
|
|
87
|
+
* @returns Whether the layout should update in the following step.
|
|
88
88
|
*/
|
|
89
89
|
getShouldUpdate(): boolean;
|
|
90
90
|
/**
|
|
91
91
|
* Returns whether the current layout is computing.
|
|
92
92
|
* Always returns false because the force-directed layout has no computing step
|
|
93
|
-
* @returns
|
|
93
|
+
* @returns Whether the layout is computing.
|
|
94
94
|
*/
|
|
95
95
|
getComputing(): boolean;
|
|
96
96
|
/**
|
|
97
97
|
* Adds the current x,y coordinates for each node to a given list of nodes.
|
|
98
|
-
* @param
|
|
99
|
-
* @returns
|
|
98
|
+
* @param nodeList - The list of nodes to get positions for.
|
|
99
|
+
* @returns The list of nodes containing the x,y coordinates on each node object.
|
|
100
100
|
*/
|
|
101
101
|
getNodePositions(nodeList: Node[]): (Node & Point)[];
|
|
102
102
|
/**
|
|
103
103
|
* Reheats the layout
|
|
104
|
-
* @param
|
|
104
|
+
* @param fullData - The entire graph object.
|
|
105
105
|
*/
|
|
106
106
|
reheat(fullData: {
|
|
107
107
|
nodes: Node[];
|
|
@@ -109,17 +109,17 @@ export declare class PhysLayout {
|
|
|
109
109
|
}): void;
|
|
110
110
|
/**
|
|
111
111
|
* Updates the existing nodes of a graph with a given list of updates
|
|
112
|
-
* @param
|
|
112
|
+
* @param nodeList - The list of updates.
|
|
113
113
|
*/
|
|
114
114
|
updateNodes(nodeList: Node[]): void;
|
|
115
115
|
/**
|
|
116
116
|
* Adds and removes nodes from the graph based on given updates
|
|
117
|
-
* @param
|
|
118
|
-
* @param
|
|
119
|
-
* @param
|
|
120
|
-
* @param
|
|
121
|
-
* @param
|
|
122
|
-
* @param
|
|
117
|
+
* @param fullData - The entire graph object.
|
|
118
|
+
* @param fullData.nodes - The nodes in the graph.
|
|
119
|
+
* @param fullData.rels - The relationships in the graph.
|
|
120
|
+
* @param nodeChanges - The changes in the graph.
|
|
121
|
+
* @param nodeChanges.adds - A list of nodes to be added.
|
|
122
|
+
* @param nodeChanges.removes - A list of nodes to be removed.
|
|
123
123
|
*/
|
|
124
124
|
addRemoveData(fullData: {
|
|
125
125
|
nodes: Node[];
|
|
@@ -137,11 +137,11 @@ export declare class PhysLayout {
|
|
|
137
137
|
destroy(): void;
|
|
138
138
|
/**
|
|
139
139
|
* Takes the new flat key set of relationships and the current relationship changes
|
|
140
|
-
* and checks whether removed relationships are still in the new flat key set
|
|
140
|
+
* and checks whether removed relationships are still in the new flat key set.
|
|
141
141
|
* and whether added relationships were already in the old flat key set.
|
|
142
142
|
* @param newFlatKeySet The new flat key set of relationships.
|
|
143
143
|
* @param relationshipChanges The changes in the relationships.
|
|
144
|
-
* @returns
|
|
144
|
+
* @returns Whether the relationship flat map has changed.
|
|
145
145
|
*/
|
|
146
146
|
private hasRelationshipFlatMapChanged;
|
|
147
147
|
private dumpTexture;
|
|
@@ -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,18 @@ 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
|
+
* @internal
|
|
26
|
+
* @hidden
|
|
27
|
+
*/
|
|
19
28
|
restart?: () => void;
|
|
20
29
|
}
|
|
21
30
|
export declare const isExternalCallback: (callback: unknown) => callback is keyof ExternalCallbacks;
|
|
@@ -63,8 +63,8 @@ export default class NvlController {
|
|
|
63
63
|
dumpRelationships(): Relationship[];
|
|
64
64
|
/**
|
|
65
65
|
* Map a relative Canvas space to the DOM position
|
|
66
|
-
* @param
|
|
67
|
-
* @param
|
|
66
|
+
* @param canvasX - X position in the canvas space.
|
|
67
|
+
* @param canvasY - Y position position in the canvas space.
|
|
68
68
|
*/
|
|
69
69
|
mapCanvasSpaceToRelativePosition(canvasX: number, canvasY: number): {
|
|
70
70
|
x: number;
|
|
@@ -72,8 +72,8 @@ export default class NvlController {
|
|
|
72
72
|
};
|
|
73
73
|
/**
|
|
74
74
|
* Map a relative DOM position to the Canvas space
|
|
75
|
-
* @param
|
|
76
|
-
* @param
|
|
75
|
+
* @param clientX - Relative X position from the top left [0..rect.width].
|
|
76
|
+
* @param clientY - Relative Y position from the top left [0..rect.height].
|
|
77
77
|
*/
|
|
78
78
|
mapRelativePositionToCanvasSpace(clientX: number, clientY: number): {
|
|
79
79
|
x: number;
|
|
@@ -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;
|