@neo4j-nvl/base 2.0.0-ec6fdba7 → 2.1.0-307fceac

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +2 -1
  2. package/README.md +5 -1
  3. package/dist/types/index.d.ts +62 -27
  4. package/dist/types/modules/ExternalCallbackHandler.d.ts +17 -4
  5. package/dist/types/modules/NvlController.d.ts +1 -1
  6. package/dist/types/modules/state/types.d.ts +20 -2
  7. package/dist/types/types/graph-element.d.ts +32 -15
  8. package/dist/types/types/nvl-window-functions.d.ts +16 -0
  9. package/dist/types/utils/hitTest.d.ts +3 -0
  10. package/dist/types/utils/jsDriverResultTransformer.d.ts +10 -0
  11. package/dist/types/utils/zoomFunctions.d.ts +1 -2
  12. package/package.json +3 -3
  13. package/skills/neo4j-nvl-skill/SKILL.md +13 -9
  14. package/skills/neo4j-nvl-skill/references/api/base/classes/NVL.md +76 -33
  15. package/skills/neo4j-nvl-skill/references/api/base/functions/getZoomTargetForNodePositions.md +1 -1
  16. package/skills/neo4j-nvl-skill/references/api/base/index.md +3 -2
  17. package/skills/neo4j-nvl-skill/references/api/base/interfaces/CircularOptions.md +1 -1
  18. package/skills/neo4j-nvl-skill/references/api/base/interfaces/ClusteringOptions.md +17 -0
  19. package/skills/neo4j-nvl-skill/references/api/base/interfaces/ExternalCallbacks.md +4 -4
  20. package/skills/neo4j-nvl-skill/references/api/base/interfaces/HierarchicalOptions.md +1 -1
  21. package/skills/neo4j-nvl-skill/references/api/base/interfaces/Node.md +5 -5
  22. package/skills/neo4j-nvl-skill/references/api/base/interfaces/NvlOptions.md +1 -1
  23. package/skills/neo4j-nvl-skill/references/api/base/interfaces/NvlWindow.md +18 -0
  24. package/skills/neo4j-nvl-skill/references/api/base/interfaces/Relationship.md +3 -3
  25. package/skills/neo4j-nvl-skill/references/api/base/type-aliases/HitTestTarget.md +2 -0
  26. package/skills/neo4j-nvl-skill/references/api/base/type-aliases/NodeWithClientPosition.md +10 -4
  27. package/skills/neo4j-nvl-skill/references/api/base/type-aliases/Renderer.md +3 -1
  28. package/skills/neo4j-nvl-skill/references/api/base/variables/nvlResultTransformer.md +11 -0
  29. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/HoverInteraction.md +6 -0
  30. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/PanInteraction.md +2 -1
  31. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/ZoomInteraction.md +5 -0
  32. package/skills/neo4j-nvl-skill/references/api/react/functions/StaticPictureWrapper.md +7 -0
  33. package/skills/neo4j-nvl-skill/references/api/react/index.md +2 -2
  34. package/skills/neo4j-nvl-skill/references/api/react/interfaces/BasicReactWrapperProps.md +3 -3
  35. package/skills/neo4j-nvl-skill/references/api/react/interfaces/InteractiveNvlWrapperProps.md +4 -4
  36. package/skills/neo4j-nvl-skill/references/api/react/type-aliases/KeyboardEvent.md +3 -0
  37. package/skills/neo4j-nvl-skill/references/api/react/type-aliases/MouseEventCallbacks.md +9 -0
  38. package/skills/neo4j-nvl-skill/references/api/react/variables/BasicNvlWrapper.md +16 -1
  39. package/skills/neo4j-nvl-skill/references/api/react/variables/InteractiveNvlWrapper.md +1 -0
  40. package/skills/neo4j-nvl-skill/references/labels-and-overlays.md +3 -1
  41. package/skills/neo4j-nvl-skill/references/layouts-and-positions.md +3 -3
  42. package/skills/neo4j-nvl-skill/references/react-wrappers.md +6 -2
@@ -82,12 +82,10 @@ import { NVL } from '@neo4j-nvl/base'
82
82
  const nvl = new NVL(document.getElementById('frame'), [{ id: '0' }], [])
83
83
 
84
84
  const nodes = [
85
- { id: '1', label: 'Node 1', color: '#e04141' },
86
- { id: '2', label: 'Node 2', color: '#e09c41' }
87
- ]
88
- const relationships = [
89
- { id: '12', from: '1', to: '2' }
85
+ { id: '1', caption: 'Node 1', color: '#e04141' },
86
+ { id: '2', caption: 'Node 2', color: '#e09c41' }
90
87
  ]
88
+ const relationships = [{ id: '12', from: '1', to: '2' }]
91
89
  // Adds new nodes and relationships
92
90
  nvl.addAndUpdateElementsInGraph(nodes, relationships)
93
91
  // Updates an existing relationship
@@ -115,6 +113,11 @@ Adds nodes and relationships in the current scene.
115
113
 
116
114
  `void`
117
115
 
116
+ #### Remarks
117
+
118
+ Elements whose id already exists are skipped silently; use
119
+ [addAndUpdateElementsInGraph](#addandupdateelementsingraph) to add and update in one call.
120
+
118
121
  ***
119
122
 
120
123
  ### deselectAll()
@@ -157,7 +160,7 @@ Updates pan and zoom to fit the specified nodes in the viewport.
157
160
 
158
161
  | Parameter | Type | Description |
159
162
  | ------ | ------ | ------ |
160
- | `nodeIds` | `string`[] | The ids of the nodes to fit on the screen. |
163
+ | `nodeIds` | `string`[] | The ids of the nodes to fit on the screen. Unknown ids are ignored; an empty array (or only unknown ids) does nothing. Pass every id to fit the whole graph. |
161
164
  | `zoomOptions?` | [`ZoomOptions`](../type-aliases/ZoomOptions.md) | Specific options on how to transition the zoom. |
162
165
 
163
166
  #### Returns
@@ -170,6 +173,18 @@ Zoom is limited by [ZoomOptions.minZoom](../type-aliases/ZoomOptions.md#minzoom)
170
173
  [minZoom](../interfaces/NvlOptions.md#minzoom) / [maxZoom](../interfaces/NvlOptions.md#maxzoom) /
171
174
  [allowDynamicMinZoom](../interfaces/NvlOptions.md#allowdynamicminzoom) options. See those for details.
172
175
 
176
+ #### Example
177
+
178
+ ```ts
179
+ import { NVL } from '@neo4j-nvl/base'
180
+
181
+ const nodes = [{ id: '1' }, { id: '2' }]
182
+ const nvl = new NVL(document.getElementById('frame'), nodes, [])
183
+
184
+ // Fit the whole graph
185
+ nvl.fit(nodes.map((node) => node.id))
186
+ ```
187
+
173
188
  ***
174
189
 
175
190
  ### getContainer()
@@ -222,7 +237,7 @@ Gets the nodes, relationships, and clusters that have been hit by a pointer even
222
237
  | ------ | ------ | ------ |
223
238
  | `evt` | `MouseEvent` | The mouse event. |
224
239
  | `targets` | [`HitTestTarget`](../type-aliases/HitTestTarget.md)[] | The graph elements to check for hits. Defaults to ['node', 'relationship', 'cluster']. |
225
- | `hitOptions` | \{ `hitNodeMarginWidth`: `number`; \} | Options for the hit test. |
240
+ | `hitOptions` | \{ `hitNodeMarginWidth`: `number`; \} | Options for the hit test. `hitNodeMarginWidth` widens the node hit area in layout units. |
226
241
  | `hitOptions.hitNodeMarginWidth` | `number` | - |
227
242
 
228
243
  #### Returns
@@ -232,17 +247,30 @@ Gets the nodes, relationships, and clusters that have been hit by a pointer even
232
247
  A [NvlMouseEvent](../interfaces/NvlMouseEvent.md) with the [HitTargets](../type-aliases/HitTargets.md) property
233
248
  containing the nodes, relationships, and clusters that have been hit by the pointer event.
234
249
 
250
+ #### Remarks
251
+
252
+ Clusters are hit when the pointer is inside a cluster hull, including over its nodes.
253
+ This is the way to react to cluster hover; the hover interaction handler only reports nodes and relationships.
254
+
235
255
  #### Example
236
256
 
237
- ```js
238
- const container = document.getElementById('frame')
257
+ ```ts
258
+ import { NVL } from '@neo4j-nvl/base'
259
+
260
+ const container = document.createElement('div')
239
261
  const nvl = new NVL(container, [{ id: '0' }], [])
240
262
 
241
263
  // Get the nodes and relationships that have been hit by a pointer event.
242
- container?.addEventListener('click', (evt) => {
264
+ container.addEventListener('click', (evt) => {
243
265
  const { nvlTargets } = nvl.getHits(evt)
244
266
  console.log('clicked elements:', nvlTargets)
245
267
  })
268
+
269
+ // Cluster hover
270
+ container.addEventListener('mousemove', (evt) => {
271
+ const cluster = nvl.getHits(evt, ['cluster']).nvlTargets.clusters[0]?.data
272
+ console.log('hovered cluster:', cluster?.id)
273
+ })
246
274
  ```
247
275
 
248
276
  ***
@@ -354,13 +382,17 @@ An object containing the nodes and relationships in the visualization.
354
382
  getPan(): Point;
355
383
  ```
356
384
 
357
- Returns the current pan of the viewport.
385
+ Returns the current pan of the viewport, in layout coordinates.
358
386
 
359
387
  #### Returns
360
388
 
361
389
  [`Point`](../interfaces/Point.md)
362
390
 
363
- The current pan of the viewport.
391
+ The layout-space point shown at the center of the container.
392
+
393
+ #### See
394
+
395
+ [NodeWithClientPosition](../type-aliases/NodeWithClientPosition.md) for the layout-to-screen formula.
364
396
 
365
397
  ***
366
398
 
@@ -439,6 +471,10 @@ Get the current zoom level of the viewport.
439
471
 
440
472
  The current zoom level.
441
473
 
474
+ #### See
475
+
476
+ [NodeWithClientPosition](../type-aliases/NodeWithClientPosition.md) for the layout-to-screen formula.
477
+
442
478
  ***
443
479
 
444
480
  ### getSelectedNodes()
@@ -498,10 +534,11 @@ A Promise resolving to a data URL string representing the graph as SVG (data:ima
498
534
 
499
535
  #### Example
500
536
 
501
- ```typescript
537
+ ```ts
502
538
  import { NVL } from '@neo4j-nvl/base'
503
539
 
504
540
  const nvl = new NVL(document.getElementById('frame'), [{ id: '0' }], [])
541
+
505
542
  const renderSvg = async () => {
506
543
  const svgDataUrl = await nvl.getSvgDataUrl({ backgroundColor: '#ffffff' })
507
544
  const img = document.createElement('img')
@@ -521,19 +558,17 @@ getZoomLimits(): {
521
558
  };
522
559
  ```
523
560
 
561
+ Returns the effective zoom limits.
562
+
524
563
  #### Returns
525
564
 
526
- ```ts
527
- {
528
- maxZoom: number;
529
- minZoom: number;
530
- }
531
- ```
565
+ The current `minZoom` and `maxZoom`. `minZoom` can be lower than the configured
566
+ option when [NvlOptions.allowDynamicMinZoom](../interfaces/NvlOptions.md#allowdynamicminzoom) let the graph zoom out further.
532
567
 
533
- | Name | Type |
534
- | ------ | ------ |
535
- | `maxZoom` | `number` |
536
- | `minZoom` | `number` |
568
+ | Name | Type | Description |
569
+ | ------ | ------ | ------ |
570
+ | `maxZoom` | `number` | The highest zoom level the graph can currently reach. |
571
+ | `minZoom` | `number` | The lowest zoom level the graph can currently reach. |
537
572
 
538
573
  ***
539
574
 
@@ -756,6 +791,11 @@ Changes the layout type.
756
791
 
757
792
  `void`
758
793
 
794
+ #### Remarks
795
+
796
+ The layout is re-run only when the type actually changes. Calling this with the
797
+ current layout type is a no-op.
798
+
759
799
  ***
760
800
 
761
801
  ### setLayoutOptions()
@@ -770,7 +810,7 @@ Updates the configuration of the current layout.
770
810
 
771
811
  | Parameter | Type | Description |
772
812
  | ------ | ------ | ------ |
773
- | `options` | [`LayoutOptions`](../type-aliases/LayoutOptions.md) | The [LayoutOptions](../type-aliases/LayoutOptions.md) configuration. |
813
+ | `options` | [`LayoutOptions`](../type-aliases/LayoutOptions.md) | The [LayoutOptions](../type-aliases/LayoutOptions.md) configuration. Replaces the previous options. |
774
814
 
775
815
  #### Returns
776
816
 
@@ -799,9 +839,11 @@ Sets the node positions based on data provided.
799
839
 
800
840
  #### Remarks
801
841
 
842
+ Ids that are not in the graph are skipped with a warning.
843
+ This is the way to position nodes; do not set `x` and `y` on the nodes passed to
844
+ [addAndUpdateElementsInGraph](#addandupdateelementsingraph) or [updateElementsInGraph](#updateelementsingraph).
802
845
  For node positions to be unaffected by layout algorithms, use the 'free' layout type
803
846
  or use [pinNode](#pinnode) to pin the nodes that should remain still.
804
- False by default.
805
847
 
806
848
  ***
807
849
 
@@ -925,7 +967,7 @@ the [NvlOptions.minZoom](../interfaces/NvlOptions.md#minzoom) option will be ign
925
967
  unPinNode(nodeIds): void;
926
968
  ```
927
969
 
928
- Un-pins the specified nodes so it is affected by layout forces again.
970
+ Un-pins the specified nodes so they are affected by layout forces again.
929
971
 
930
972
  #### Parameters
931
973
 
@@ -937,6 +979,11 @@ Un-pins the specified nodes so it is affected by layout forces again.
937
979
 
938
980
  `void`
939
981
 
982
+ #### Remarks
983
+
984
+ A settled force-directed layout does not restart on its own after un-pinning.
985
+ Call [setNodePositions](#setnodepositions) with `updateLayout: true` to wake it up.
986
+
940
987
  ***
941
988
 
942
989
  ### updateElementsInGraph()
@@ -964,14 +1011,10 @@ Updating nodes and relationships
964
1011
  ```ts
965
1012
  import { NVL } from '@neo4j-nvl/base'
966
1013
 
967
- const nodes = [
968
- { id: '1', label: 'Node 1', color: '#e04141' },
969
- { id: '2', label: 'Node 2', color: '#e09c41' }
970
- ]
971
- const relationships = [
972
- { id: '12', from: '1', to: '2' }
973
- ]
1014
+ const nodes = [{ id: '1' }, { id: '2' }]
1015
+ const relationships = [{ id: '12', from: '1', to: '2' }]
974
1016
  const nvl = new NVL(document.getElementById('frame'), nodes, relationships)
1017
+
975
1018
  // Updates an existing node and relationship
976
1019
  nvl.updateElementsInGraph([{ id: '1', selected: true }], [{ id: '12', color: '#e0df41' }])
977
1020
  ```
@@ -24,7 +24,7 @@ Gets the zoom target to fit the given node positions into the scene.
24
24
  | `nodePositions` | [`Point`](../interfaces/Point.md)[] | The node positions. |
25
25
  | `containerWidth` | `number` | The width of the container NVL is displayed in. |
26
26
  | `containerHeight` | `number` | The height of the container NVL is displayed in. |
27
- | `maxNodeRadius` | `number` | The maximum node radius, which is added as margin to the scene (defaults to 2 * DefaultNodeSize). |
27
+ | `maxNodeRadius` | `number` | The maximum node radius, used to pad the scene (defaults to `50`). |
28
28
 
29
29
  ## Returns
30
30
 
@@ -23,6 +23,7 @@
23
23
  | [Node](interfaces/Node.md) | A node inside the graph visualization. |
24
24
  | [NvlMouseEvent](interfaces/NvlMouseEvent.md) | Extends the MouseEvent interface with the [HitTargets](type-aliases/HitTargets.md) property. The result of a [NVL.getHits](classes/NVL.md#gethits) call. |
25
25
  | [NvlOptions](interfaces/NvlOptions.md) | Configurations for a NVL instance |
26
+ | [NvlWindow](interfaces/NvlWindow.md) | Read-only debugging hooks that every NVL instance registers on `window`, for tests and tooling that cannot reach the NVL object. Hooks exist from the first instance's construction and stay on `window` after it is destroyed. `instanceId` is the [NvlOptions.instanceId](interfaces/NvlOptions.md#instanceid) given to NVL (default `'default'`); an unknown id falls back to the most recently created instance. |
26
27
  | [Point](interfaces/Point.md) | An object representing a point in 2D space. |
27
28
  | [Relationship](interfaces/Relationship.md) | A relationship inside the graph visualization. |
28
29
 
@@ -35,10 +36,10 @@
35
36
  | [ClusterByFn](type-aliases/ClusterByFn.md) | Function that maps a node id to a [ClusterId](type-aliases/ClusterId.md) for force-directed clustering. Returns `undefined` for nodes that should remain independent. |
36
37
  | [ClusterId](type-aliases/ClusterId.md) | Identifier returned by [ClusterByFn](type-aliases/ClusterByFn.md) to group nodes into physical clusters. Nodes sharing the same string or number are clustered together. |
37
38
  | [HitTargets](type-aliases/HitTargets.md) | A collection of nodes, relationships and clusters that have been hit by a pointer event Part of the result of a [NVL](classes/NVL.md).[NVL.getHits](classes/NVL.md#gethits) call |
38
- | [HitTestTarget](type-aliases/HitTestTarget.md) | - |
39
+ | [HitTestTarget](type-aliases/HitTestTarget.md) | The kinds of element [NVL.getHits](classes/NVL.md#gethits) can test for. |
39
40
  | [Layout](type-aliases/Layout.md) | The different types of layouts available |
40
41
  | [LayoutOptions](type-aliases/LayoutOptions.md) | The options for the layout. |
41
- | [NodeWithClientPosition](type-aliases/NodeWithClientPosition.md) | A node returned by [NVL.getNodes](classes/NVL.md#getnodes) with layout coordinates and screen position. `x` and `y` are canvas/layout space; `clientPosition` is relative to the canvas element. |
42
+ | [NodeWithClientPosition](type-aliases/NodeWithClientPosition.md) | A node returned by [NVL.getNodes](classes/NVL.md#getnodes) with layout coordinates and screen position. `x` and `y` are layout space; `clientPosition` is in CSS pixels relative to the top-left corner of the container. |
42
43
  | [PartialNode](type-aliases/PartialNode.md) | A node with only a subset of its properties. |
43
44
  | [PartialRelationship](type-aliases/PartialRelationship.md) | A relationship with only a subset of its properties. |
44
45
  | [Renderer](type-aliases/Renderer.md) | The different types of renderers available |
@@ -8,4 +8,4 @@ The options for the circular layout.
8
8
 
9
9
  | Property | Type | Description |
10
10
  | ------ | ------ | ------ |
11
- | `sortFunction?` | (`nodes`) => [`Node`](Node.md)[] | Function which should return the sorted nodes. |
11
+ | `sortFunction?` | (`nodes`) => [`Node`](Node.md)[] | Function which should return the sorted nodes. Nodes are placed around the circle in the returned order. **Remarks** Changing this via [NVL.setLayoutOptions](../classes/NVL.md#setlayoutoptions) does not re-run the layout on its own. Switch to another layout and back with [NVL.setLayout](../classes/NVL.md#setlayout), or call [NVL.restart](../classes/NVL.md#restart), to re-place nodes. |
@@ -4,6 +4,23 @@
4
4
 
5
5
  Options that control physical clustering and cluster decorations for the force-directed layout.
6
6
 
7
+ ## Remarks
8
+
9
+ Only used by the `'forceDirected'` layout. The hierarchical layout has its own
10
+ [HierarchicalOptions.clusterBy](HierarchicalOptions.md#clusterby) without decorations.
11
+ Clusters can be clicked and hit-tested (see [NVL.getHits](../classes/NVL.md#gethits)), but are not hoverable elements.
12
+
13
+ ## Example
14
+
15
+ ```ts
16
+ import { NVL } from '@neo4j-nvl/base'
17
+
18
+ const nvl = new NVL(document.getElementById('frame'), [{ id: 'a:1' }, { id: 'a:2' }], [])
19
+
20
+ const clusterBy = (nodeId: string) => nodeId.split(':')[0]
21
+ nvl.setLayoutOptions({ clustering: { clusterBy, drawOutline: true } })
22
+ ```
23
+
7
24
  ## Properties
8
25
 
9
26
  | Property | Type | Default value | Description |
@@ -8,11 +8,11 @@ An object specifying the required callback functions for certain actions
8
8
 
9
9
  | Property | Type | Description |
10
10
  | ------ | ------ | ------ |
11
- | `onError?` | (`error`) => `void` | Triggered when NVL throws an error after initialization. |
11
+ | `onError?` | (`error`) => `void` | Triggered when NVL throws an error after initialization. **Remarks** Constructor errors are thrown, not reported here. |
12
12
  | `onInitialization?` | () => `void` | Triggered when NVL is initialized. |
13
- | `onLayoutComputing?` | (`isComputing`) => `void` | Triggered when a asynchronous layout calculation starts/stops. |
14
- | `onLayoutDone?` | () => `void` | Triggered when a layout is done moving. |
15
- | `onLayoutStep?` | (`p`) => `void` | Triggered on each step of a layout. |
13
+ | `onLayoutComputing?` | (`isComputing`) => `void` | Triggered when an asynchronous layout calculation starts (`true`) and stops (`false`). Not triggered by iterative layouts (e.g. force-directed). |
14
+ | `onLayoutDone?` | () => `void` | Triggered when a layout is done moving. Fires again after every change that re-runs the layout (added or removed elements, layout switch). |
15
+ | `onLayoutStep?` | (`p`) => `void` | Triggered on each step of a layout with the current node positions. **Remarks** Can have a large performance footprint. Prefer [onLayoutDone](#onlayoutdone) and [NVL.getNodes](../classes/NVL.md#getnodes) unless per-frame positions are needed. |
16
16
  | `onWebGLContextLost?` | (`webGLContextEvent`) => `void` | Triggered when the WebGL context is lost. [https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/webglcontextlost\_event](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/webglcontextlost_event) |
17
17
  | `onZoomTransitionDone?` | () => `void` | Triggered when a zoom transition (e.g. [NVL.fit](../classes/NVL.md#fit) or [NVL.resetZoom](../classes/NVL.md#resetzoom)) function is done. |
18
18
  | `restart?` | () => `void` | Triggered when NVL is restarted. |
@@ -8,6 +8,6 @@ The options for the hierarchical layout
8
8
 
9
9
  | Property | Type | Description |
10
10
  | ------ | ------ | ------ |
11
- | `clusterBy?` | [`ClusterByFn`](../type-aliases/ClusterByFn.md) | **`Experimental`** Optional function to group nodes into semantic clusters based on a custom identifier. Nodes returning the same string or number will be grouped together in the layout via dagre compound subgraphs. Nodes returning undefined will be treated as independent. **Remarks** Ensure this function has a stable reference to avoid evaluation on every render. |
11
+ | `clusterBy?` | [`ClusterByFn`](../type-aliases/ClusterByFn.md) | **`Experimental`** Optional function to group nodes into semantic clusters based on a custom identifier. Nodes returning the same string or number will be grouped together in the layout via dagre compound subgraphs. Nodes returning undefined will be treated as independent. **Remarks** No outline or halo is drawn (only present for the `'forceDirected'` layout via [ClusteringOptions](ClusteringOptions.md)). Ensure this function has a stable reference to avoid evaluation on every render. |
12
12
  | `direction?` | `"up"` \| `"down"` \| `"left"` \| `"right"` | The direction in which the layout should be oriented |
13
13
  | `packing?` | `"bin"` \| `"stack"` | The packing method to be used |
@@ -13,17 +13,17 @@ A node inside the graph visualization.
13
13
  | Property | Modifier | Type | Description | Inherited from |
14
14
  | ------ | ------ | ------ | ------ | ------ |
15
15
  | `activated?` | `public` | `boolean` | Whether or not the current node is activated. | - |
16
- | `caption?` | `public` | `string` | The text to display inside on node or relationship. @note: If both caption and captions are provided, captions takes precedence. @note: To provide multiple captions with custom styles, use the [captions](#captions) property. @note: Captions are only visible when using the 'canvas' renderer. | `GraphElement.caption` |
16
+ | `caption?` | `public` | `string` | The text to display on the node or relationship. **Remarks** If both `caption` and [captions](#captions) are provided, `captions` takes precedence. To provide multiple captions with custom styles, use the [captions](#captions) property. Captions are only visible when using the 'canvas' renderer. **See** [Node.html](#html) and [Node.icon](#icon) for labelling nodes with the WebGL renderer. | `GraphElement.caption` |
17
17
  | `captionAlign?` | `public` | `"top"` \| `"bottom"` \| `"center"` | The caption align. Has no affect on self-referring relationships. | `GraphElement.captionAlign` |
18
- | `captions?` | `public` | [`StyledCaption`](../type-aliases/StyledCaption.md)[] | The caption text and font styles. @note: To provide a single caption without custom styles, you can also use the [caption](#caption) property. @note: Captions are only visible when using the 'canvas' renderer. | `GraphElement.captions` |
18
+ | `captions?` | `public` | [`StyledCaption`](../type-aliases/StyledCaption.md)[] | Multiple captions with individual text styles. **Remarks** Only drawn by the `'canvas'` renderer. For a single unstyled caption use [caption](#caption). | `GraphElement.captions` |
19
19
  | `captionSize?` | `public` | `number` | The caption text size. | `GraphElement.captionSize` |
20
20
  | `color?` | `public` | `string` | The color of the graph element. | `GraphElement.color` |
21
21
  | `disabled?` | `public` | `boolean` | Whether or not the current node or relationship is disabled. | `GraphElement.disabled` |
22
22
  | `hovered?` | `public` | `boolean` | Whether or not the current node or relationship is hovered. | `GraphElement.hovered` |
23
- | `html?` | `public` | `HTMLElement` | **`Experimental`** The DOM element to display on top of a node. | - |
24
- | `icon?` | `public` | `string` | The url to an icon to display inside the node. Icons are expected to be black. If the node's background color is dark, the icon will be inverted to white. Icons are expected to be square. | - |
23
+ | `html?` | `public` | `HTMLElement` | **`Experimental`** The DOM element to display on top of a node. Positioned by NVL on every frame. **Remarks** Any HTML overlay disables the WebGL renderer's GPU fast path because node positions must be available on the CPU every frame. Prefer [icon](#icon) or [overlayIcon](#overlayicon) for many nodes. | - |
24
+ | `icon?` | `public` | `string` | The url to an icon to display inside the node. Icons are expected to be black and square. If the node's background color is dark, the icon will be inverted to white. Works with both renderers. **Remarks** The WebGL renderer keeps at most 256 distinct icon images (per url and inverted/not inverted); icons beyond that are not drawn and no warning is logged. The canvas renderer has no such cap. Keep the set of distinct icon urls small. | - |
25
25
  | `id` | `readonly` | `string` | The id of the current node or relationship. Ids need to be unique across all nodes and relationships. Ids need to be strings and cannot be empty. | `GraphElement.id` |
26
- | `overlayIcon?` | `public` | \{ `position?`: `number`[]; `size?`: `number`; `url`: `string`; \} | An icon to be displayed anywhere on top of the graph element. Icons are expected to be square. | `GraphElement.overlayIcon` |
26
+ | `overlayIcon?` | `public` | \{ `position?`: `number`[]; `size?`: `number`; `url`: `string`; \} | An icon to be displayed anywhere on top of the graph element. Icons are expected to be square. Works with both renderers. | `GraphElement.overlayIcon` |
27
27
  | `overlayIcon.position?` | `public` | `number`[] | The position of the icon relative to the node or relationship. The position is a percentage of the node or relationship size. `[1, 1]` is the bottom right corner of the node or relationship. `[-1, -1]` is the top left corner of the node or relationship. | - |
28
28
  | `overlayIcon.size?` | `public` | `number` | The size of the icon relative to the node size or relationship caption size. The size is a percentage of the node size or relationship caption size. | - |
29
29
  | `overlayIcon.url` | `public` | `string` | The url to the icon. | - |
@@ -12,7 +12,7 @@ Configurations for a NVL instance
12
12
  | `callbacks?` | [`ExternalCallbacks`](ExternalCallbacks.md) | `undefined` | Callbacks for various events in the NVL instance. |
13
13
  | `disableAria?` | `boolean` | `false` | Disables [ARIA](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) attributes on the graph. By default, NVL adds ARIA attributes to the graph container to make it more accessible. Attributes include `role="image"`, `aria-label="Graph visualization"` and `aria-describedby="nvl-${instanceId}-description"`. The description element is a live region that will announce changes to the graph. |
14
14
  | `disableTelemetry?` | `boolean` | `false` | Disables tracking of library usage |
15
- | `disableWebWorkers?` | `boolean` | `undefined` | Disables the use of [web workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers) for the layout calculations. |
15
+ | `disableWebWorkers?` | `boolean` | `undefined` | Disables the use of [web workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers) for the layout calculations. **Remarks** Only the hierarchical layout uses a worker (a `SharedWorker` from `@neo4j-nvl/layout-workers`). If the worker cannot be created, NVL logs a warning and attempts to fall back to synchronous layout automatically. |
16
16
  | `initialZoom?` | `number` | `undefined` | Zoom value of the current viewport |
17
17
  | `instanceId?` | `string` | `undefined` | Id for uniquely identifying the instance of Nvl |
18
18
  | `layout?` | [`Layout`](../type-aliases/Layout.md) | `undefined` | The graph layout algorithm to be used |
@@ -0,0 +1,18 @@
1
+ [//]: # (This file is auto-generated by scripts/docs/generate-skills.mjs, do not edit it manually)
2
+
3
+ # Interface: NvlWindow
4
+
5
+ Read-only debugging hooks that every NVL instance registers on `window`, for tests and tooling
6
+ that cannot reach the NVL object. Hooks exist from the first instance's construction and stay on
7
+ `window` after it is destroyed. `instanceId` is the [NvlOptions.instanceId](NvlOptions.md#instanceid) given to NVL
8
+ (default `'default'`); an unknown id falls back to the most recently created instance.
9
+
10
+ ## Properties
11
+
12
+ | Property | Type | Description |
13
+ | ------ | ------ | ------ |
14
+ | `__Nvl_dumpNodes` | (`instanceId?`) => [`NodeWithClientPosition`](../type-aliases/NodeWithClientPosition.md)[] | Same as [NVL.getNodes](../classes/NVL.md#getnodes): all nodes with layout coordinates and `clientPosition`. |
15
+ | `__Nvl_dumpRelationships` | (`instanceId?`) => [`Relationship`](Relationship.md)[] | Same as [NVL.getRelationships](../classes/NVL.md#getrelationships). |
16
+ | `__Nvl_getNodesOnScreen` | (`instanceId?`) => \{ `nodes`: [`Node`](Node.md)[]; `rels`: [`Relationship`](Relationship.md)[]; \} | Same as [NVL.getNodesOnScreen](../classes/NVL.md#getnodesonscreen): nodes inside the viewport; `rels` is always empty. |
17
+ | `__Nvl_getZoomLevel` | (`instanceId?`) => `number` | Same as [NVL.getScale](../classes/NVL.md#getscale). |
18
+ | `__Nvl_registerDoneCallback` | (`cb`, `instanceId`) => `void` | Adds a listener for [ExternalCallbacks.onLayoutDone](ExternalCallbacks.md#onlayoutdone). Called on every layout completion, not just the first; listeners cannot be removed. |
@@ -12,17 +12,17 @@ A relationship inside the graph visualization.
12
12
 
13
13
  | Property | Modifier | Type | Description | Inherited from |
14
14
  | ------ | ------ | ------ | ------ | ------ |
15
- | `caption?` | `public` | `string` | The text to display inside on node or relationship. @note: If both caption and captions are provided, captions takes precedence. @note: To provide multiple captions with custom styles, use the [captions](Node.md#captions) property. @note: Captions are only visible when using the 'canvas' renderer. | `GraphElement.caption` |
15
+ | `caption?` | `public` | `string` | The text to display on the node or relationship. **Remarks** If both `caption` and [captions](Node.md#captions) are provided, `captions` takes precedence. To provide multiple captions with custom styles, use the [captions](Node.md#captions) property. Captions are only visible when using the 'canvas' renderer. **See** [Node.html](Node.md#html) and [Node.icon](Node.md#icon) for labelling nodes with the WebGL renderer. | `GraphElement.caption` |
16
16
  | `captionAlign?` | `public` | `"top"` \| `"bottom"` \| `"center"` | The caption align. Has no affect on self-referring relationships. | `GraphElement.captionAlign` |
17
17
  | `captionHtml?` | `public` | `HTMLElement` | **`Experimental`** The DOM element to display on top of a relationship caption. The [captionSize](Node.md#captionsize) and [captionAlign](Node.md#captionalign) properties will affect the position and height of the html container element. | - |
18
- | `captions?` | `public` | [`StyledCaption`](../type-aliases/StyledCaption.md)[] | The caption text and font styles. @note: To provide a single caption without custom styles, you can also use the [caption](Node.md#caption) property. @note: Captions are only visible when using the 'canvas' renderer. | `GraphElement.captions` |
18
+ | `captions?` | `public` | [`StyledCaption`](../type-aliases/StyledCaption.md)[] | Multiple captions with individual text styles. **Remarks** Only drawn by the `'canvas'` renderer. For a single unstyled caption use [caption](Node.md#caption). | `GraphElement.captions` |
19
19
  | `captionSize?` | `public` | `number` | The caption text size. | `GraphElement.captionSize` |
20
20
  | `color?` | `public` | `string` | The color of the graph element. | `GraphElement.color` |
21
21
  | `disabled?` | `public` | `boolean` | Whether or not the current node or relationship is disabled. | `GraphElement.disabled` |
22
22
  | `from` | `public` | `string` | Node id where the relationship starts from. | - |
23
23
  | `hovered?` | `public` | `boolean` | Whether or not the current node or relationship is hovered. | `GraphElement.hovered` |
24
24
  | `id` | `readonly` | `string` | The id of the current node or relationship. Ids need to be unique across all nodes and relationships. Ids need to be strings and cannot be empty. | `GraphElement.id` |
25
- | `overlayIcon?` | `public` | \{ `position?`: `number`[]; `size?`: `number`; `url`: `string`; \} | An icon to be displayed anywhere on top of the graph element. Icons are expected to be square. | `GraphElement.overlayIcon` |
25
+ | `overlayIcon?` | `public` | \{ `position?`: `number`[]; `size?`: `number`; `url`: `string`; \} | An icon to be displayed anywhere on top of the graph element. Icons are expected to be square. Works with both renderers. | `GraphElement.overlayIcon` |
26
26
  | `overlayIcon.position?` | `public` | `number`[] | The position of the icon relative to the node or relationship. The position is a percentage of the node or relationship size. `[1, 1]` is the bottom right corner of the node or relationship. `[-1, -1]` is the top left corner of the node or relationship. | - |
27
27
  | `overlayIcon.size?` | `public` | `number` | The size of the icon relative to the node size or relationship caption size. The size is a percentage of the node size or relationship caption size. | - |
28
28
  | `overlayIcon.url` | `public` | `string` | The url to the icon. | - |
@@ -5,3 +5,5 @@
5
5
  ```ts
6
6
  type HitTestTarget = "node" | "relationship" | "cluster";
7
7
  ```
8
+
9
+ The kinds of element [NVL.getHits](../classes/NVL.md#gethits) can test for.
@@ -9,10 +9,16 @@ type NodeWithClientPosition = Node & Point & {
9
9
  ```
10
10
 
11
11
  A node returned by [NVL.getNodes](../classes/NVL.md#getnodes) with layout coordinates and screen position.
12
- `x` and `y` are canvas/layout space; `clientPosition` is relative to the canvas element.
12
+ `x` and `y` are layout space; `clientPosition` is in CSS pixels relative to the top-left
13
+ corner of the container.
13
14
 
14
15
  ## Type Declaration
15
16
 
16
- | Name | Type |
17
- | ------ | ------ |
18
- | `clientPosition` | [`Point`](../interfaces/Point.md) |
17
+ | Name | Type | Description |
18
+ | ------ | ------ | ------ |
19
+ | `clientPosition` | [`Point`](../interfaces/Point.md) | Screen position in CSS pixels, relative to the top-left corner of the container. |
20
+
21
+ ## Remarks
22
+
23
+ `clientPosition = ((x, y) - pan) * zoom / devicePixelRatio + containerSize / 2`,
24
+ with `pan` from [NVL.getPan](../classes/NVL.md#getpan) and `zoom` from [NVL.getScale](../classes/NVL.md#getscale).
@@ -3,7 +3,9 @@
3
3
  # Type Alias: Renderer
4
4
 
5
5
  ```ts
6
- type Renderer = Exclude<InternalRenderer, typeof SvgRendererType>;
6
+ type Renderer =
7
+ | typeof WebGLRendererType
8
+ | typeof CanvasRendererType;
7
9
  ```
8
10
 
9
11
  The different types of renderers available
@@ -15,6 +15,17 @@ const nvlResultTransformer: ResultTransformer<{
15
15
 
16
16
  Result transformer for the Neo4j JavaScript driver results to NVL graph elements.
17
17
 
18
+ Collects every node, relationship and path (including nested lists) from all record fields and returns
19
+ - `nodes`: `{ id: elementId }` per node, no labels, properties or captions,
20
+ - `relationships`: `{ id, from, to }` per relationship using element ids,
21
+ - `recordObjectMap`: `Map<elementId, driver Node | Relationship>` for looking up labels and properties.
22
+
23
+ ## Remarks
24
+
25
+ Nodes and relationships returned by several records appear several times in the arrays. NVL
26
+ deduplicates by id when adding them, so this only matters if the arrays are processed before that.
27
+ Driver `Integer` values are not converted; use `toNumber()` or `toString()` before putting them in captions.
28
+
18
29
  ## Example
19
30
 
20
31
  ```ts
@@ -4,6 +4,12 @@
4
4
 
5
5
  Interaction handler for hovering nodes and relationships.
6
6
 
7
+ ## Remarks
8
+
9
+ Clusters are not hoverable elements: `element` is never a cluster and no hover state is drawn
10
+ for hulls. Read `hitElements.clusters` in [HoverInteractionCallbacks.onHover](../type-aliases/HoverInteractionCallbacks.md#onhover), or call
11
+ NVL.getHits with `['cluster']`, to react to the pointer being inside a cluster hull.
12
+
7
13
  For examples, head to the [Hover Interaction documentation page](https://neo4j.com/docs/nvl/current/interaction-handlers/#_hoverinteraction).
8
14
 
9
15
  ## Extends
@@ -184,11 +184,12 @@ Updates which type of graph elements should hinder panning.
184
184
 
185
185
  #### Example
186
186
 
187
- ```js
187
+ ```ts
188
188
  import { NVL } from '@neo4j-nvl/base'
189
189
  import { PanInteraction } from '@neo4j-nvl/interaction-handlers'
190
190
 
191
191
  const nvl = new NVL(document.createElement('div'), [{ id: '0' }], [])
192
+
192
193
  const panInteraction = new PanInteraction(nvl)
193
194
 
194
195
  // Pan canvas even when dragging on nodes and relationships
@@ -6,6 +6,11 @@ Interaction handler for zooming the canvas, which is achieved by:
6
6
  - Scrolling the mouse wheel on the canvas
7
7
  - Using trackpad pinch gestures (equivalent to Ctrl/Cmd + scroll)
8
8
 
9
+ ## Remarks
10
+
11
+ [ZoomInteractionCallbacks.onZoomAndPan](../type-aliases/ZoomInteractionCallbacks.md#onzoomandpan) is the only callback. Zooming also changes the pan so the
12
+ point under the pointer stays fixed. Zoom limits come from NVL.getZoomLimits.
13
+
9
14
  For examples, head to the [Zoom Interaction documentation page](https://neo4j.com/docs/nvl/current/interaction-handlers/#_zoominteraction).
10
15
 
11
16
  ## Extends
@@ -23,6 +23,13 @@ NVL is automatically destroyed after capturing the image to free up resources.
23
23
 
24
24
  An img element displaying the graph visualization, or null during rendering
25
25
 
26
+ ## Remarks
27
+
28
+ When showing many pictures at once, either set `disableWebGL: true` in `nvlOptions` or mount the components in
29
+ batches to avoid exceeding the WebGL context limit of the browser.
30
+ Otherwise, the browser may drop the oldest contexts and warn "Too many active WebGL contexts" when reaching its limit
31
+ and some pictures can fail to render.
32
+
26
33
  ## Example
27
34
 
28
35
  ```tsx
@@ -14,7 +14,7 @@
14
14
  | Type Alias | Description |
15
15
  | ------ | ------ |
16
16
  | [InteractionOptions](type-aliases/InteractionOptions.md) | Collection of interaction options that can be used with the [InteractiveNvlWrapper](variables/InteractiveNvlWrapper.md) component. |
17
- | [KeyboardEvent](type-aliases/KeyboardEvent.md) | - |
17
+ | [KeyboardEvent](type-aliases/KeyboardEvent.md) | The events that can be passed to the [KeyboardEventCallbacks](type-aliases/KeyboardEventCallbacks.md) object to turn on/off certain events for the [InteractiveNvlWrapper](variables/InteractiveNvlWrapper.md) component. |
18
18
  | [KeyboardEventCallbacks](type-aliases/KeyboardEventCallbacks.md) | Collection of keyboard event callbacks that can be used with the [InteractiveNvlWrapper](variables/InteractiveNvlWrapper.md) component. |
19
19
  | [MouseEvent](type-aliases/MouseEvent.md) | The events that can be passed to the [MouseEventCallbacks](type-aliases/MouseEventCallbacks.md) object to turn on/off certain events for the [InteractiveNvlWrapper](variables/InteractiveNvlWrapper.md) component. |
20
20
  | [MouseEventCallbacks](type-aliases/MouseEventCallbacks.md) | Collection of mouse event callbacks that can be used with the [InteractiveNvlWrapper](variables/InteractiveNvlWrapper.md) component. |
@@ -24,7 +24,7 @@
24
24
 
25
25
  | Variable | Description |
26
26
  | ------ | ------ |
27
- | [BasicNvlWrapper](variables/BasicNvlWrapper.md) | A basic React wrapper that wraps the NVL base library within a React component. It takes the class' arguments as properties, which are passed to the NVL constructor. Any changes in properties will be reflected in the NVL instance by calling the corresponding methods. |
27
+ | [BasicNvlWrapper](variables/BasicNvlWrapper.md) | A basic React wrapper that wraps the NVL base library within a React component. It takes the class' arguments as properties, which are passed to the NVL constructor. |
28
28
  | [InteractiveNvlWrapper](variables/InteractiveNvlWrapper.md) | The interactive React wrapper component contains a collection of interaction handlers by default and provides a variety of common functionality and callbacks. It is an extension of the [BasicNvlWrapper](variables/BasicNvlWrapper.md) component and incorporates the @neo4j-nvl/interaction-handlers module's decorators to provide a set of interaction events. |
29
29
 
30
30
  ## Functions
@@ -13,12 +13,12 @@ The properties that can be passed to the [BasicNvlWrapper](../variables/BasicNvl
13
13
  | Property | Type | Description |
14
14
  | ------ | ------ | ------ |
15
15
  | `nodes` | `Node`[] | The nodes of the graph of type Node[] |
16
- | `nvlCallbacks?` | `ExternalCallbacks` | an Object containing functions for callbacks on certain actions |
17
- | `nvlOptions?` | `NvlOptions` | An object containing options for the Nvl instance |
16
+ | `nvlCallbacks?` | `ExternalCallbacks` | An object containing functions for callbacks on certain actions. **Remarks** Passed to the NVL constructor once; later changes to this prop are ignored. Read changing state through a ref inside the callbacks instead of redefining them. |
17
+ | `nvlOptions?` | `NvlOptions` | An object containing options for the Nvl instance. **Remarks** If `minimapContainer` is present it must be a non-null element before NVL is created, otherwise creation is deferred until it is. |
18
18
  | `onInitializationError?` | (`error`) => `void` | A callback to handle any errors that happen during NVL initialization |
19
19
  | `pan?` | \{ `x`: `number`; `y`: `number`; \} | Sets the pan coordinates of the viewport using the setPan method. **Remarks** If both zoom and pan are provided, the setZoomAndPan method will be used. |
20
20
  | `pan.x` | `number` | The x coordinate of the pan. |
21
21
  | `pan.y` | `number` | The y coordinate of the pan. |
22
- | `positions?` | `Node`[] | Sets the positions of the nodes in the graph using the setNodePositions method. |
22
+ | `positions?` | `Node`[] | Sets the positions of the nodes in the graph using the setNodePositions method. **Remarks** Applied whenever the array reference changes and is non-empty. This is the way to position nodes. Do not set `x` and `y` on `nodes` directly. |
23
23
  | `rels` | `Relationship`[] | The rels of the graph of type Relationship[] |
24
24
  | `zoom?` | `number` | Sets the zoom level of the viewport using the setZoom method. **Remarks** If both zoom and pan are provided, the setZoomAndPan method will be used. |
@@ -12,16 +12,16 @@ The properties that can be passed to the [InteractiveNvlWrapper](../variables/In
12
12
 
13
13
  | Property | Type | Description | Inherited from |
14
14
  | ------ | ------ | ------ | ------ |
15
- | `interactionOptions?` | [`InteractionOptions`](../type-aliases/InteractionOptions.md) | [InteractionOptions](../type-aliases/InteractionOptions.md) for the underlying interaction handlers | - |
15
+ | `interactionOptions?` | [`InteractionOptions`](../type-aliases/InteractionOptions.md) | [InteractionOptions](../type-aliases/InteractionOptions.md) for the underlying interaction handlers. **Remarks** Options are read when a handler is first created and changing them later does not affect existing handlers. | - |
16
16
  | `keyboardEventCallbacks?` | `KeyboardInteractionCallbacks` | [KeyboardEventCallbacks](../type-aliases/KeyboardEventCallbacks.md) containing functions for callbacks on keyboard actions | - |
17
17
  | `mouseEventCallbacks?` | [`MouseEventCallbacks`](../type-aliases/MouseEventCallbacks.md) | [MouseEventCallbacks](../type-aliases/MouseEventCallbacks.md) containing functions for callbacks on certain actions | - |
18
18
  | `nodes` | `Node`[] | The nodes of the graph of type Node[] | [`BasicReactWrapperProps`](BasicReactWrapperProps.md).[`nodes`](BasicReactWrapperProps.md#nodes) |
19
- | `nvlCallbacks?` | `ExternalCallbacks` | an Object containing functions for callbacks on certain actions | [`BasicReactWrapperProps`](BasicReactWrapperProps.md).[`nvlCallbacks`](BasicReactWrapperProps.md#nvlcallbacks) |
20
- | `nvlOptions?` | `NvlOptions` | An object containing options for the Nvl instance | [`BasicReactWrapperProps`](BasicReactWrapperProps.md).[`nvlOptions`](BasicReactWrapperProps.md#nvloptions) |
19
+ | `nvlCallbacks?` | `ExternalCallbacks` | An object containing functions for callbacks on certain actions. **Remarks** Passed to the NVL constructor once; later changes to this prop are ignored. Read changing state through a ref inside the callbacks instead of redefining them. | [`BasicReactWrapperProps`](BasicReactWrapperProps.md).[`nvlCallbacks`](BasicReactWrapperProps.md#nvlcallbacks) |
20
+ | `nvlOptions?` | `NvlOptions` | An object containing options for the Nvl instance. **Remarks** If `minimapContainer` is present it must be a non-null element before NVL is created, otherwise creation is deferred until it is. | [`BasicReactWrapperProps`](BasicReactWrapperProps.md).[`nvlOptions`](BasicReactWrapperProps.md#nvloptions) |
21
21
  | `onInitializationError?` | (`error`) => `void` | A callback to handle any errors that happen during NVL initialization | [`BasicReactWrapperProps`](BasicReactWrapperProps.md).[`onInitializationError`](BasicReactWrapperProps.md#oninitializationerror) |
22
22
  | `pan?` | \{ `x`: `number`; `y`: `number`; \} | Sets the pan coordinates of the viewport using the setPan method. **Remarks** If both zoom and pan are provided, the setZoomAndPan method will be used. | [`BasicReactWrapperProps`](BasicReactWrapperProps.md).[`pan`](BasicReactWrapperProps.md#pan) |
23
23
  | `pan.x` | `number` | The x coordinate of the pan. | - |
24
24
  | `pan.y` | `number` | The y coordinate of the pan. | - |
25
- | `positions?` | `Node`[] | Sets the positions of the nodes in the graph using the setNodePositions method. | [`BasicReactWrapperProps`](BasicReactWrapperProps.md).[`positions`](BasicReactWrapperProps.md#positions) |
25
+ | `positions?` | `Node`[] | Sets the positions of the nodes in the graph using the setNodePositions method. **Remarks** Applied whenever the array reference changes and is non-empty. This is the way to position nodes. Do not set `x` and `y` on `nodes` directly. | [`BasicReactWrapperProps`](BasicReactWrapperProps.md).[`positions`](BasicReactWrapperProps.md#positions) |
26
26
  | `rels` | `Relationship`[] | The rels of the graph of type Relationship[] | [`BasicReactWrapperProps`](BasicReactWrapperProps.md).[`rels`](BasicReactWrapperProps.md#rels) |
27
27
  | `zoom?` | `number` | Sets the zoom level of the viewport using the setZoom method. **Remarks** If both zoom and pan are provided, the setZoomAndPan method will be used. | [`BasicReactWrapperProps`](BasicReactWrapperProps.md).[`zoom`](BasicReactWrapperProps.md#zoom) |
@@ -5,3 +5,6 @@
5
5
  ```ts
6
6
  type KeyboardEvent = keyof KeyboardEventCallbacks;
7
7
  ```
8
+
9
+ The events that can be passed to the [KeyboardEventCallbacks](KeyboardEventCallbacks.md) object
10
+ to turn on/off certain events for the [InteractiveNvlWrapper](../variables/InteractiveNvlWrapper.md) component.
@@ -8,3 +8,12 @@ type MouseEventCallbacks = ClickInteractionCallbacks & DragNodeInteractionCallba
8
8
 
9
9
  Collection of mouse event callbacks that can be used with
10
10
  the [InteractiveNvlWrapper](../variables/InteractiveNvlWrapper.md) component.
11
+
12
+ Each key enables the interaction handler that owns it: a function enables the handler and is
13
+ called.
14
+ `true` enables it without a callback and `false` destroys the handler (and all its other callbacks).
15
+
16
+ ## Remarks
17
+
18
+ Zoom is only enabled through `onZoomAndPan`. There is no `onZoom` key.
19
+ Keyboard callbacks use the separate [KeyboardEventCallbacks](KeyboardEventCallbacks.md) prop.