@neo4j-nvl/base 2.0.0-c8e499dc → 2.0.0-ec6fdba7
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 +23 -0
- package/dist/base.mjs +1062 -1058
- package/dist/types/index.d.ts +382 -385
- package/dist/types/layouts/animatedlayout/AnimatedLayout.d.ts +23 -23
- package/dist/types/layouts/animatedlayout/animationUtils.d.ts +3 -3
- package/dist/types/layouts/circularLayout/CircularLayout.d.ts +14 -14
- package/dist/types/layouts/d3forcelayout/circularLayout.d.ts +4 -4
- package/dist/types/layouts/d3forcelayout/constants.d.ts +3 -3
- package/dist/types/layouts/d3forcelayout/d3ForceLayout.d.ts +31 -31
- package/dist/types/layouts/d3forcelayout/types.d.ts +7 -7
- package/dist/types/layouts/forcedirectedlayout/PhysLayout.d.ts +261 -261
- package/dist/types/layouts/forcedirectedlayout/clustering/ClusterByMerger.d.ts +52 -52
- package/dist/types/layouts/forcedirectedlayout/clustering/SolarMerger.d.ts +49 -49
- package/dist/types/layouts/forcedirectedlayout/clustering/clustering-utils.d.ts +35 -35
- package/dist/types/layouts/forcedirectedlayout/clustering/types.d.ts +39 -39
- package/dist/types/layouts/forcedirectedlayout/glwrapper.d.ts +3 -3
- package/dist/types/layouts/forcedirectedlayout/shaders/multilevel-fragment.d.ts +1 -1
- package/dist/types/layouts/forcedirectedlayout/shaders/multilevel-repulsive-fragment.d.ts +1 -1
- package/dist/types/layouts/forcedirectedlayout/shaders/multilevel-update-fragment.d.ts +1 -1
- package/dist/types/layouts/forcedirectedlayout/shaders/sim-vertex.d.ts +1 -1
- package/dist/types/layouts/freeLayout/FreeLayout.d.ts +23 -23
- package/dist/types/layouts/gridLayout/GridLayout.d.ts +26 -26
- package/dist/types/layouts/hierarchicallayout/HierarchicalLayout.d.ts +28 -28
- package/dist/types/layouts/hierarchicallayout/constants.d.ts +2 -2
- package/dist/types/modules/CallbackHelper.d.ts +23 -23
- package/dist/types/modules/ExternalCallbackHandler.d.ts +33 -33
- package/dist/types/modules/NvlController.d.ts +212 -209
- package/dist/types/modules/Shader.d.ts +17 -17
- package/dist/types/modules/ZoomTransitionHandler.d.ts +24 -24
- package/dist/types/modules/dataset.d.ts +24 -24
- package/dist/types/modules/logging.d.ts +4 -4
- package/dist/types/modules/state/constants.d.ts +2 -2
- package/dist/types/modules/state/state.d.ts +2 -2
- package/dist/types/modules/state/types.d.ts +296 -288
- package/dist/types/modules/state/utils.d.ts +36 -36
- package/dist/types/renderers/ClusterOverlay.d.ts +67 -67
- package/dist/types/renderers/domrenderer/BaseRenderer.d.ts +69 -69
- package/dist/types/renderers/domrenderer/canvasrenderer/Animation.d.ts +57 -57
- package/dist/types/renderers/domrenderer/canvasrenderer/AnimationHandler.d.ts +65 -65
- package/dist/types/renderers/domrenderer/canvasrenderer/CanvasRenderer.d.ts +84 -85
- package/dist/types/renderers/domrenderer/canvasrenderer/arrowDrawing.d.ts +31 -31
- package/dist/types/renderers/domrenderer/canvasrenderer/nodeDrawing.d.ts +32 -32
- package/dist/types/renderers/domrenderer/shared/ImageCache.d.ts +16 -16
- package/dist/types/renderers/domrenderer/shared/arrows/ArrowBundle.d.ts +89 -89
- package/dist/types/renderers/domrenderer/shared/arrows/ArrowBundler.d.ts +42 -42
- package/dist/types/renderers/domrenderer/shared/arrows/arrows.d.ts +49 -49
- package/dist/types/renderers/domrenderer/shared/arrows/constants.d.ts +4 -4
- package/dist/types/renderers/domrenderer/shared/nodes/nodes.d.ts +21 -21
- package/dist/types/renderers/domrenderer/shared/types.d.ts +29 -29
- package/dist/types/renderers/domrenderer/shared/util.d.ts +4 -4
- package/dist/types/renderers/domrenderer/shared/vectorUtils.d.ts +10 -10
- package/dist/types/renderers/domrenderer/shared/wordwrap.d.ts +10 -10
- package/dist/types/renderers/domrenderer/svgrenderer/SvgRenderer.d.ts +18 -19
- package/dist/types/renderers/domrenderer/svgrenderer/arrowDrawing.d.ts +15 -15
- package/dist/types/renderers/domrenderer/svgrenderer/nodeDrawing.d.ts +4 -4
- package/dist/types/renderers/domrenderer/svgrenderer/svgUtils.d.ts +21 -21
- package/dist/types/renderers/webglrenderer/Controller.d.ts +83 -82
- package/dist/types/renderers/webglrenderer/IconLayerRegistry.d.ts +8 -8
- package/dist/types/renderers/webglrenderer/Renderer.d.ts +89 -89
- package/dist/types/renderers/webglrenderer/node-animation-fragment.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/node-animation-vertex.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/node-fragment-point.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/node-vertex-point.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/rel-fragment-line.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/rel-glsl-utils.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/rel-vertex-arrow.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/rel-vertex-line.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/viewport-box-fragment.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/viewport-box-vertex.d.ts +1 -1
- package/dist/types/types/graph-element.d.ts +103 -103
- package/dist/types/types/nvl-window-functions.d.ts +12 -13
- package/dist/types/types/utils.d.ts +1 -1
- package/dist/types/utils/ariaUtils.d.ts +2 -2
- package/dist/types/utils/canvasManagement.d.ts +1 -1
- package/dist/types/utils/circularUtils.d.ts +2 -2
- package/dist/types/utils/clusterGeometry.d.ts +3 -3
- package/dist/types/utils/clusterHitRegions.d.ts +12 -12
- package/dist/types/utils/colorUtils.d.ts +2 -2
- package/dist/types/utils/constants.d.ts +6 -6
- package/dist/types/utils/errors.d.ts +6 -6
- package/dist/types/utils/geometry.d.ts +48 -48
- package/dist/types/utils/graphObjectUtils.d.ts +9 -9
- package/dist/types/utils/hitTest.d.ts +47 -47
- package/dist/types/utils/jsDriverResultTransformer.d.ts +16 -16
- package/dist/types/utils/layoutSeeding.d.ts +2 -2
- package/dist/types/utils/mouseUtils.d.ts +5 -5
- package/dist/types/utils/segmentAnalytics.d.ts +42 -42
- package/dist/types/utils/webWorkerUtils.d.ts +1 -1
- package/dist/types/utils/zoomFunctions.d.ts +16 -15
- package/package.json +12 -10
- package/skills/neo4j-nvl-skill/SKILL.md +238 -398
- package/skills/neo4j-nvl-skill/references/api/base/classes/NVL.md +977 -0
- package/skills/neo4j-nvl-skill/references/api/base/functions/getZoomTargetForNodePositions.md +37 -0
- package/skills/neo4j-nvl-skill/references/api/base/index.md +71 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/CircularOptions.md +11 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/ClusteringOptions.md +14 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/ExternalCallbacks.md +18 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/ForceDirectedOptions.md +12 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/HierarchicalOptions.md +13 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/HitTargetCluster.md +13 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/HitTargetNode.md +16 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/HitTargetRelationship.md +15 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/Node.md +32 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/NvlMouseEvent.md +16 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/NvlOptions.md +38 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/Point.md +12 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/Relationship.md +32 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/CanvasRendererType.md +14 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/Cluster.md +20 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/ClusterByFn.md +20 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/ClusterId.md +10 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/HitTargets.md +22 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/HitTestTarget.md +7 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/Layout.md +15 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/LayoutOptions.md +12 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/NodeWithClientPosition.md +18 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/PartialNode.md +17 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/PartialRelationship.md +17 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/Renderer.md +9 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/StyledCaption.md +21 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/WebGLRendererType.md +14 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/ZoomOptions.md +25 -0
- package/skills/neo4j-nvl-skill/references/api/base/variables/CircularLayoutType.md +11 -0
- package/skills/neo4j-nvl-skill/references/api/base/variables/ForceDirectedLayoutType.md +9 -0
- package/skills/neo4j-nvl-skill/references/api/base/variables/FreeLayoutType.md +9 -0
- package/skills/neo4j-nvl-skill/references/api/base/variables/GridLayoutType.md +9 -0
- package/skills/neo4j-nvl-skill/references/api/base/variables/HierarchicalLayoutType.md +9 -0
- package/skills/neo4j-nvl-skill/references/api/base/variables/d3ForceLayoutType.md +9 -0
- package/skills/neo4j-nvl-skill/references/api/base/variables/nvlResultTransformer.md +38 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/BoxSelectInteraction.md +163 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/ClickInteraction.md +163 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/DragNodeInteraction.md +164 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/HoverInteraction.md +160 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/KeyboardInteraction.md +185 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/LassoInteraction.md +163 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/PanInteraction.md +196 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/ZoomInteraction.md +164 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/index.md +37 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/BoxSelectInteractionCallbacks.md +19 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/BoxSelectInteractionOptions.md +17 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/ClickInteractionCallbacks.md +39 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/ClickInteractionOptions.md +17 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/DragNodeInteractionCallbacks.md +21 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/DrawInteractionOptions.md +22 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/HoverInteractionCallbacks.md +17 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/HoverInteractionOptions.md +17 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/KeyboardInteractionCallbacks.md +35 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/KeyboardInteractionOptions.md +55 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/LassoInteractionCallbacks.md +19 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/LassoInteractionOptions.md +17 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/PanInteractionCallbacks.md +17 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/PanInteractionOptions.md +19 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/ZoomInteractionCallbacks.md +17 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/ZoomInteractionOptions.md +17 -0
- package/skills/neo4j-nvl-skill/references/api/react/functions/StaticPictureWrapper.md +35 -0
- package/skills/neo4j-nvl-skill/references/api/react/index.md +34 -0
- package/skills/neo4j-nvl-skill/references/api/react/interfaces/BasicReactWrapperProps.md +24 -0
- package/skills/neo4j-nvl-skill/references/api/react/interfaces/InteractiveNvlWrapperProps.md +27 -0
- package/skills/neo4j-nvl-skill/references/api/react/type-aliases/InteractionOptions.md +10 -0
- package/skills/neo4j-nvl-skill/references/api/react/type-aliases/KeyboardEvent.md +7 -0
- package/skills/neo4j-nvl-skill/references/api/react/type-aliases/KeyboardEventCallbacks.md +10 -0
- package/skills/neo4j-nvl-skill/references/api/react/type-aliases/MouseEvent.md +10 -0
- package/skills/neo4j-nvl-skill/references/api/react/type-aliases/MouseEventCallbacks.md +10 -0
- package/skills/neo4j-nvl-skill/references/api/react/type-aliases/StaticPictureWrapperProps.md +27 -0
- package/skills/neo4j-nvl-skill/references/api/react/variables/BasicNvlWrapper.md +50 -0
- package/skills/neo4j-nvl-skill/references/api/react/variables/InteractiveNvlWrapper.md +17 -0
- package/skills/neo4j-nvl-skill/references/clustering.md +87 -0
- package/skills/neo4j-nvl-skill/references/data-from-neo4j.md +67 -0
- package/skills/neo4j-nvl-skill/references/labels-and-overlays.md +76 -0
- package/skills/neo4j-nvl-skill/references/layouts-and-positions.md +65 -0
- package/skills/neo4j-nvl-skill/references/lifecycle-and-updates.md +65 -0
- package/skills/neo4j-nvl-skill/references/migrating-1x-to-2.md +50 -0
- package/skills/neo4j-nvl-skill/references/react-wrappers.md +88 -0
- package/skills/neo4j-nvl-skill/references/verifying-nvl-apps.md +52 -0
- package/skills/neo4j-nvl-skill/references/vite-and-bundlers.md +62 -0
- package/dist/types/layouts/animatedlayout/AnimatedLayout.test.d.ts +0 -1
- package/dist/types/layouts/animatedlayout/animationUtils.test.d.ts +0 -1
- package/dist/types/layouts/d3forcelayout/__mocks__/d3ForceLayout.d.ts +0 -10
- package/dist/types/layouts/d3forcelayout/circularLayout.test.d.ts +0 -1
- package/dist/types/layouts/d3forcelayout/d3ForceLayout.test.d.ts +0 -1
- package/dist/types/layouts/forcedirectedlayout/PhysLayout.test.d.ts +0 -1
- package/dist/types/layouts/forcedirectedlayout/clustering/ClusterByMerger.test.d.ts +0 -1
- package/dist/types/layouts/forcedirectedlayout/clustering/SolarMerger.bench.d.ts +0 -1
- package/dist/types/layouts/forcedirectedlayout/clustering/SolarMerger.test.d.ts +0 -1
- package/dist/types/layouts/forcedirectedlayout/clustering/clustering-utils.test.d.ts +0 -1
- package/dist/types/modules/NvlController.test.d.ts +0 -1
- package/dist/types/modules/ZoomTransitionHandler.test.d.ts +0 -1
- package/dist/types/modules/dataset.test.d.ts +0 -1
- package/dist/types/modules/state/state.test.d.ts +0 -1
- package/dist/types/modules/state/utils.test.d.ts +0 -1
- package/dist/types/renderers/ClusterOverlay.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/BaseRenderer.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/canvasrenderer/Animation.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/canvasrenderer/CanvasRenderer.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/canvasrenderer/arrowDrawing.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/canvasrenderer/nodeDrawing.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/shared/ImageCache.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/shared/arrows/ArrowBundle.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/shared/arrows/ArrowBundler.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/shared/arrows/arrows.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/shared/nodes/nodes.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/shared/util.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/shared/wordwrap.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/svgrenderer/SvgRenderer.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/svgrenderer/arrowDrawing.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/svgrenderer/nodeDrawing.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/svgrenderer/svgUtils.test.d.ts +0 -1
- package/dist/types/renderers/webglrenderer/Controller.test.d.ts +0 -1
- package/dist/types/renderers/webglrenderer/IconLayerRegistry.test.d.ts +0 -1
- package/dist/types/renderers/webglrenderer/Renderer.test.d.ts +0 -1
- package/dist/types/utils/ariaUtils.test.d.ts +0 -1
- package/dist/types/utils/canvasManagement.test.d.ts +0 -1
- package/dist/types/utils/circularUtils.test.d.ts +0 -1
- package/dist/types/utils/clusterGeometry.test.d.ts +0 -1
- package/dist/types/utils/clusterHitRegions.test.d.ts +0 -1
- package/dist/types/utils/colorUtils.test.d.ts +0 -1
- package/dist/types/utils/errors.test.d.ts +0 -1
- package/dist/types/utils/geometry.test.d.ts +0 -1
- package/dist/types/utils/graphObjectUtils.test.d.ts +0 -1
- package/dist/types/utils/hitTest.test.d.ts +0 -1
- package/dist/types/utils/jsDriverResultTransformer.test.d.ts +0 -1
- package/dist/types/utils/layoutSeeding.test.d.ts +0 -1
- package/dist/types/utils/mouseUtils.test.d.ts +0 -1
- package/dist/types/utils/webWorkerUtils.test.d.ts +0 -1
- package/dist/types/utils/zoomFunctions.test.d.ts +0 -1
- package/skills/neo4j-nvl-skill/references/api-surface.md +0 -596
- package/skills/neo4j-nvl-skill/references/troubleshooting.md +0 -317
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[//]: # (This file is auto-generated by scripts/docs/generate-skills.mjs, do not edit it manually)
|
|
2
|
+
|
|
3
|
+
# @neo4j-nvl/react
|
|
4
|
+
|
|
5
|
+
## Interfaces
|
|
6
|
+
|
|
7
|
+
| Interface | Description |
|
|
8
|
+
| ------ | ------ |
|
|
9
|
+
| [BasicReactWrapperProps](interfaces/BasicReactWrapperProps.md) | The properties that can be passed to the [BasicNvlWrapper](variables/BasicNvlWrapper.md) component. |
|
|
10
|
+
| [InteractiveNvlWrapperProps](interfaces/InteractiveNvlWrapperProps.md) | The properties that can be passed to the [InteractiveNvlWrapper](variables/InteractiveNvlWrapper.md) component. |
|
|
11
|
+
|
|
12
|
+
## Type Aliases
|
|
13
|
+
|
|
14
|
+
| Type Alias | Description |
|
|
15
|
+
| ------ | ------ |
|
|
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) | - |
|
|
18
|
+
| [KeyboardEventCallbacks](type-aliases/KeyboardEventCallbacks.md) | Collection of keyboard event callbacks that can be used with the [InteractiveNvlWrapper](variables/InteractiveNvlWrapper.md) component. |
|
|
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
|
+
| [MouseEventCallbacks](type-aliases/MouseEventCallbacks.md) | Collection of mouse event callbacks that can be used with the [InteractiveNvlWrapper](variables/InteractiveNvlWrapper.md) component. |
|
|
21
|
+
| [StaticPictureWrapperProps](type-aliases/StaticPictureWrapperProps.md) | The properties that can be passed to the StaticPictureWrapper component. |
|
|
22
|
+
|
|
23
|
+
## Variables
|
|
24
|
+
|
|
25
|
+
| Variable | Description |
|
|
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. |
|
|
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
|
+
|
|
30
|
+
## Functions
|
|
31
|
+
|
|
32
|
+
| Function | Description |
|
|
33
|
+
| ------ | ------ |
|
|
34
|
+
| [StaticPictureWrapper](functions/StaticPictureWrapper.md) | A React component that creates a static picture of a graph using NVL. This component is useful for generating static visualizations of graphs without requiring user interaction. The component automatically fits all nodes in the viewport before capturing the image NVL is automatically destroyed after capturing the image to free up resources. |
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[//]: # (This file is auto-generated by scripts/docs/generate-skills.mjs, do not edit it manually)
|
|
2
|
+
|
|
3
|
+
# Interface: BasicReactWrapperProps
|
|
4
|
+
|
|
5
|
+
The properties that can be passed to the [BasicNvlWrapper](../variables/BasicNvlWrapper.md) component.
|
|
6
|
+
|
|
7
|
+
## Extended by
|
|
8
|
+
|
|
9
|
+
- [`InteractiveNvlWrapperProps`](InteractiveNvlWrapperProps.md)
|
|
10
|
+
|
|
11
|
+
## Properties
|
|
12
|
+
|
|
13
|
+
| Property | Type | Description |
|
|
14
|
+
| ------ | ------ | ------ |
|
|
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 |
|
|
18
|
+
| `onInitializationError?` | (`error`) => `void` | A callback to handle any errors that happen during NVL initialization |
|
|
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
|
+
| `pan.x` | `number` | The x coordinate of the pan. |
|
|
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. |
|
|
23
|
+
| `rels` | `Relationship`[] | The rels of the graph of type Relationship[] |
|
|
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. |
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[//]: # (This file is auto-generated by scripts/docs/generate-skills.mjs, do not edit it manually)
|
|
2
|
+
|
|
3
|
+
# Interface: InteractiveNvlWrapperProps
|
|
4
|
+
|
|
5
|
+
The properties that can be passed to the [InteractiveNvlWrapper](../variables/InteractiveNvlWrapper.md) component.
|
|
6
|
+
|
|
7
|
+
## Extends
|
|
8
|
+
|
|
9
|
+
- [`BasicReactWrapperProps`](BasicReactWrapperProps.md)
|
|
10
|
+
|
|
11
|
+
## Properties
|
|
12
|
+
|
|
13
|
+
| Property | Type | Description | Inherited from |
|
|
14
|
+
| ------ | ------ | ------ | ------ |
|
|
15
|
+
| `interactionOptions?` | [`InteractionOptions`](../type-aliases/InteractionOptions.md) | [InteractionOptions](../type-aliases/InteractionOptions.md) for the underlying interaction handlers | - |
|
|
16
|
+
| `keyboardEventCallbacks?` | `KeyboardInteractionCallbacks` | [KeyboardEventCallbacks](../type-aliases/KeyboardEventCallbacks.md) containing functions for callbacks on keyboard actions | - |
|
|
17
|
+
| `mouseEventCallbacks?` | [`MouseEventCallbacks`](../type-aliases/MouseEventCallbacks.md) | [MouseEventCallbacks](../type-aliases/MouseEventCallbacks.md) containing functions for callbacks on certain actions | - |
|
|
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) |
|
|
21
|
+
| `onInitializationError?` | (`error`) => `void` | A callback to handle any errors that happen during NVL initialization | [`BasicReactWrapperProps`](BasicReactWrapperProps.md).[`onInitializationError`](BasicReactWrapperProps.md#oninitializationerror) |
|
|
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
|
+
| `pan.x` | `number` | The x coordinate of the pan. | - |
|
|
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) |
|
|
26
|
+
| `rels` | `Relationship`[] | The rels of the graph of type Relationship[] | [`BasicReactWrapperProps`](BasicReactWrapperProps.md).[`rels`](BasicReactWrapperProps.md#rels) |
|
|
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) |
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
[//]: # (This file is auto-generated by scripts/docs/generate-skills.mjs, do not edit it manually)
|
|
2
|
+
|
|
3
|
+
# Type Alias: InteractionOptions
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type InteractionOptions = ClickInteractionOptions & BoxSelectInteractionOptions & HoverInteractionOptions & PanInteractionOptions & ZoomInteractionOptions & LassoInteractionOptions & DrawInteractionOptions & KeyboardInteractionOptions;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Collection of interaction options that can be used with
|
|
10
|
+
the [InteractiveNvlWrapper](../variables/InteractiveNvlWrapper.md) component.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
[//]: # (This file is auto-generated by scripts/docs/generate-skills.mjs, do not edit it manually)
|
|
2
|
+
|
|
3
|
+
# Type Alias: KeyboardEventCallbacks
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type KeyboardEventCallbacks = KeyboardInteractionCallbacks;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Collection of keyboard event callbacks that can be used with
|
|
10
|
+
the [InteractiveNvlWrapper](../variables/InteractiveNvlWrapper.md) component.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
[//]: # (This file is auto-generated by scripts/docs/generate-skills.mjs, do not edit it manually)
|
|
2
|
+
|
|
3
|
+
# Type Alias: MouseEvent
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type MouseEvent = keyof MouseEventCallbacks;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
The events that can be passed to the [MouseEventCallbacks](MouseEventCallbacks.md) object
|
|
10
|
+
to turn on/off certain events for the [InteractiveNvlWrapper](../variables/InteractiveNvlWrapper.md) component.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
[//]: # (This file is auto-generated by scripts/docs/generate-skills.mjs, do not edit it manually)
|
|
2
|
+
|
|
3
|
+
# Type Alias: MouseEventCallbacks
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type MouseEventCallbacks = ClickInteractionCallbacks & DragNodeInteractionCallbacks & HoverInteractionCallbacks & PanInteractionCallbacks & ZoomInteractionCallbacks & BoxSelectInteractionCallbacks & DrawInteractionCallbacks & LassoInteractionCallbacks;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Collection of mouse event callbacks that can be used with
|
|
10
|
+
the [InteractiveNvlWrapper](../variables/InteractiveNvlWrapper.md) component.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[//]: # (This file is auto-generated by scripts/docs/generate-skills.mjs, do not edit it manually)
|
|
2
|
+
|
|
3
|
+
# Type Alias: StaticPictureWrapperProps
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type StaticPictureWrapperProps = {
|
|
7
|
+
format?: "png" | "svg";
|
|
8
|
+
height?: number;
|
|
9
|
+
nodes: Node[];
|
|
10
|
+
nvlOptions?: NvlOptions;
|
|
11
|
+
rels: Relationship[];
|
|
12
|
+
width?: number;
|
|
13
|
+
};
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The properties that can be passed to the StaticPictureWrapper component.
|
|
17
|
+
|
|
18
|
+
## Properties
|
|
19
|
+
|
|
20
|
+
| Property | Type | Description |
|
|
21
|
+
| ------ | ------ | ------ |
|
|
22
|
+
| `format?` | `"png"` \| `"svg"` | The format of the static picture: 'png' or 'svg'. Defaults to 'png'. |
|
|
23
|
+
| `height?` | `number` | The height of the static picture in pixels. |
|
|
24
|
+
| `nodes` | `Node`[] | The nodes to be displayed in the graph. |
|
|
25
|
+
| `nvlOptions?` | `NvlOptions` | Options to customize the NVL instance. |
|
|
26
|
+
| `rels` | `Relationship`[] | The relationships to be displayed in the graph. |
|
|
27
|
+
| `width?` | `number` | The width of the static picture in pixels. |
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[//]: # (This file is auto-generated by scripts/docs/generate-skills.mjs, do not edit it manually)
|
|
2
|
+
|
|
3
|
+
# Variable: BasicNvlWrapper
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
const BasicNvlWrapper: MemoExoticComponent<ForwardRefExoticComponent<Omit<BasicReactWrapperProps & HTMLProps<HTMLDivElement>, "ref"> & RefAttributes<Partial<Pick<NVL,
|
|
7
|
+
| "restart"
|
|
8
|
+
| "addAndUpdateElementsInGraph"
|
|
9
|
+
| "getSelectedNodes"
|
|
10
|
+
| "getSelectedRelationships"
|
|
11
|
+
| "removeNodesWithIds"
|
|
12
|
+
| "removeRelationshipsWithIds"
|
|
13
|
+
| "getNodes"
|
|
14
|
+
| "getRelationships"
|
|
15
|
+
| "getNodeById"
|
|
16
|
+
| "getRelationshipById"
|
|
17
|
+
| "getPositionById"
|
|
18
|
+
| "getCurrentOptions"
|
|
19
|
+
| "destroy"
|
|
20
|
+
| "deselectAll"
|
|
21
|
+
| "fit"
|
|
22
|
+
| "resetZoom"
|
|
23
|
+
| "setRenderer"
|
|
24
|
+
| "setDisableWebGL"
|
|
25
|
+
| "pinNode"
|
|
26
|
+
| "unPinNode"
|
|
27
|
+
| "setLayout"
|
|
28
|
+
| "setLayoutOptions"
|
|
29
|
+
| "getNodesOnScreen"
|
|
30
|
+
| "getNodePositions"
|
|
31
|
+
| "setNodePositions"
|
|
32
|
+
| "isLayoutMoving"
|
|
33
|
+
| "saveToFile"
|
|
34
|
+
| "saveToSvg"
|
|
35
|
+
| "getImageDataUrl"
|
|
36
|
+
| "getSvgDataUrl"
|
|
37
|
+
| "saveFullGraphToLargeFile"
|
|
38
|
+
| "getZoomLimits"
|
|
39
|
+
| "setZoom"
|
|
40
|
+
| "getScale"
|
|
41
|
+
| "getPan"
|
|
42
|
+
| "getHits"
|
|
43
|
+
| "getContainer">>>>>;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
A basic React wrapper that wraps the NVL base library within a React component.
|
|
47
|
+
It takes the class' arguments as properties, which are passed to the NVL constructor.
|
|
48
|
+
Any changes in properties will be reflected in the NVL instance by calling the corresponding methods.
|
|
49
|
+
|
|
50
|
+
For examples, head to the [Basic React wrapper documentation page](https://neo4j.com/docs/nvl/current/react-wrappers/#_basic_react_wrapper).
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[//]: # (This file is auto-generated by scripts/docs/generate-skills.mjs, do not edit it manually)
|
|
2
|
+
|
|
3
|
+
# Variable: InteractiveNvlWrapper
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
const InteractiveNvlWrapper: MemoExoticComponent<ForwardRefExoticComponent<Omit<InteractiveNvlWrapperProps & HTMLProps<HTMLDivElement>, "ref"> & RefAttributes<NVL>>>;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
The interactive React wrapper component contains a collection of interaction handlers by default
|
|
10
|
+
and provides a variety of common functionality and callbacks.
|
|
11
|
+
It is an extension of the [BasicNvlWrapper](BasicNvlWrapper.md) component and incorporates the
|
|
12
|
+
@neo4j-nvl/interaction-handlers module's decorators to provide a set of interaction events.
|
|
13
|
+
|
|
14
|
+
The mouseEventCallbacks property takes an object where various callbacks can be defined
|
|
15
|
+
and behavior can be toggled on and off.
|
|
16
|
+
|
|
17
|
+
For examples, head to the [Interactive React wrapper documentation page](https://neo4j.com/docs/nvl/current/react-wrappers/#_interactive_react_wrapper).
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Clustering
|
|
2
|
+
|
|
3
|
+
When you need this: you want nodes grouped by a property, drawn with outlines or halos, or you need to react to clicks and hovers on a cluster.
|
|
4
|
+
|
|
5
|
+
Verification tags: **source**, **types**, **runtime** (see `SKILL.md`).
|
|
6
|
+
|
|
7
|
+
## Options per layout
|
|
8
|
+
|
|
9
|
+
`clusterBy` is `(nodeId: string) => string | number | undefined`. Nodes returning the same value share a cluster; `undefined` means independent. Keep the function reference stable (`useCallback` in React) or the clustering is re-evaluated on every render. *types*
|
|
10
|
+
|
|
11
|
+
| Layout | Where | Decorations | Hulls / hit-testing |
|
|
12
|
+
|---|---|---|---|
|
|
13
|
+
| `forceDirected` | `layoutOptions.clustering: { clusterBy, drawOutline, drawHalo, crossClusterRelationshipMultiplier }` | yes | yes |
|
|
14
|
+
| `hierarchical` | `layoutOptions.clusterBy` (experimental) | no | no |
|
|
15
|
+
| `circular` | none; order nodes with `layoutOptions.sortFunction` | no | no |
|
|
16
|
+
| `free`, `grid`, `d3Force` | not supported | no | no |
|
|
17
|
+
|
|
18
|
+
*types, source*
|
|
19
|
+
|
|
20
|
+
```javascript
|
|
21
|
+
const clusterBy = (nodeId) => categoryByNodeId[nodeId]
|
|
22
|
+
|
|
23
|
+
// force-directed
|
|
24
|
+
new NVL(container, nodes, rels, {
|
|
25
|
+
layout: 'forceDirected',
|
|
26
|
+
layoutOptions: {
|
|
27
|
+
clustering: { clusterBy, drawOutline: true, drawHalo: true, crossClusterRelationshipMultiplier: 0.2 }
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
// hierarchical
|
|
32
|
+
new NVL(container, nodes, rels, {
|
|
33
|
+
layout: 'hierarchical',
|
|
34
|
+
layoutOptions: { direction: 'down', clusterBy }
|
|
35
|
+
})
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`crossClusterRelationshipMultiplier` (default `0`, capped `0..1`) scales the spring pull of relationships that cross clusters; intra-cluster edges stay at full strength. Values near `1` can destabilise highly connected graphs. *types*
|
|
39
|
+
|
|
40
|
+
## Outlines and halos
|
|
41
|
+
|
|
42
|
+
- Outline colour is the shared node colour of the cluster; if colours differ it falls back to `styling.overlayLineColor`. *types*
|
|
43
|
+
- A halo is drawn **only** when every node in the cluster has the same colour. Mixed colours → no halo, no error. *types*
|
|
44
|
+
- Decorations are drawn for the force-directed layout only. Switching to `free` keeps positions but removes the overlay. *source, runtime*
|
|
45
|
+
- Changing `layoutOptions.clustering` through `setLayoutOptions` redraws the overlay. *source*
|
|
46
|
+
|
|
47
|
+
## A `Cluster` is not a graph element
|
|
48
|
+
|
|
49
|
+
`Cluster = { id: string | number, nodeIds: string[] }`. It has no colour or position of its own; its hull is computed from the member positions. *types*
|
|
50
|
+
|
|
51
|
+
## Clicks
|
|
52
|
+
|
|
53
|
+
`ClickInteraction` resolves hits in priority order: nodes, then relationships, then clusters, then canvas. Cluster callbacks (`onClusterClick`, `onClusterDoubleClick`, `onClusterRightClick`) fire only for empty space inside a hull. *source*
|
|
54
|
+
|
|
55
|
+
With `selectOnClick: true`, clicking inside a hull selects **all** `cluster.nodeIds`; clicking again deselects them (a cluster counts as selected when all members are). *source*
|
|
56
|
+
|
|
57
|
+
To select single nodes but still know when a hull is clicked:
|
|
58
|
+
|
|
59
|
+
```javascript
|
|
60
|
+
const click = new ClickInteraction(nvl, { selectOnClick: false })
|
|
61
|
+
click.updateCallback('onNodeClick', (node) => nvl.updateElementsInGraph([{ id: node.id, selected: true }], []))
|
|
62
|
+
click.updateCallback('onClusterClick', (cluster) => console.log('hull', cluster.id, cluster.nodeIds.length))
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Hover
|
|
66
|
+
|
|
67
|
+
`HoverInteraction` has a single `onHover(element, hitElements, event)` callback where `element` is a node, a relationship or `undefined`. There is no cluster hover event, but `hitElements.clusters` is filled: *types, source*
|
|
68
|
+
|
|
69
|
+
```javascript
|
|
70
|
+
hover.updateCallback('onHover', (element, hits) => {
|
|
71
|
+
const cluster = hits.clusters[0]?.data
|
|
72
|
+
if (!element && cluster) showTooltip(cluster.id)
|
|
73
|
+
})
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Without the interaction handlers: `nvl.getHits(event, ['cluster'])` returns `nvlTargets.clusters` with `data`, `pointerCoordinates` and the convex `hull` points. Clusters are included by default when the target list is omitted. *types*
|
|
77
|
+
|
|
78
|
+
## Clustering and pinned nodes
|
|
79
|
+
|
|
80
|
+
With `clustering.clusterBy` set, the force simulation moves pinned nodes too; re-applying positions does not hold them. Do not combine pinning with clustering. *runtime*
|
|
81
|
+
|
|
82
|
+
## Checklist
|
|
83
|
+
|
|
84
|
+
- Force-directed for decorations and hull interactions; hierarchical only groups.
|
|
85
|
+
- One colour per cluster if you want halos.
|
|
86
|
+
- `selectOnClick: false` if a hull click must not select every member.
|
|
87
|
+
- Stable `clusterBy` reference in React.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Data from Neo4j
|
|
2
|
+
|
|
3
|
+
When you need this: you have `neo4j-driver` results and want them on screen, styled from the data.
|
|
4
|
+
|
|
5
|
+
Each statement below ends with how it was verified: **source** (read in the NVL repository), **types** (in the shipped `.d.ts`) or **runtime** (observed in a running app).
|
|
6
|
+
|
|
7
|
+
## What `nvlResultTransformer` returns
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { nvlResultTransformer } from '@neo4j-nvl/base'
|
|
11
|
+
|
|
12
|
+
const { nodes, relationships, recordObjectMap } = await driver.executeQuery(
|
|
13
|
+
'MATCH (a)-[r]-(b) RETURN a, r, b LIMIT 100',
|
|
14
|
+
{},
|
|
15
|
+
{ database: 'neo4j', resultTransformer: nvlResultTransformer }
|
|
16
|
+
)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
- `nodes` are bare `{ id }` and `relationships` are bare `{ id, from, to }`. `id` is the driver `elementId`. No caption, colour, size or type is set. *source*
|
|
20
|
+
- `recordObjectMap` is a `Map<elementId, driver Node | Relationship | Path>`; it holds `labels`, `type` and `properties`. *source*
|
|
21
|
+
- Every `Node`, `Relationship` and `Path` in every column is collected, including nested arrays. Paths are expanded to their segments. *source*
|
|
22
|
+
- Output is not deduplicated. A node in several records appears several times. NVL ignores repeated ids on insert, so passing the array straight to NVL is fine. *source*
|
|
23
|
+
|
|
24
|
+
## Enrich before rendering
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
const styledNodes = nodes.map((node) => {
|
|
28
|
+
const record = recordObjectMap.get(node.id)
|
|
29
|
+
if (!record || !('labels' in record)) return node
|
|
30
|
+
const label = record.labels[0]
|
|
31
|
+
return {
|
|
32
|
+
...node,
|
|
33
|
+
caption: String(record.properties.name ?? label),
|
|
34
|
+
color: colorByLabel[label],
|
|
35
|
+
size: 20
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const styledRels = relationships.map((rel) => {
|
|
40
|
+
const record = recordObjectMap.get(rel.id)
|
|
41
|
+
return record && 'type' in record ? { ...rel, caption: record.type } : rel
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
new NVL(container, styledNodes, styledRels)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Dedupe yourself if you keep your own node store (`new Map(nodes.map((n) => [n.id, n]))`).
|
|
48
|
+
|
|
49
|
+
## Values that need converting
|
|
50
|
+
|
|
51
|
+
Driver values are not plain JS values. Convert before using them as captions or sizes. *types*
|
|
52
|
+
|
|
53
|
+
- `Integer` → `value.toNumber()` (or `toString()` for ids), or open the driver with `disableLosslessIntegers: true`.
|
|
54
|
+
- `Date`, `DateTime`, `Duration` → `value.toString()` or `toStandardDate()`.
|
|
55
|
+
- Spatial `Point` → `value.x`, `value.y`.
|
|
56
|
+
|
|
57
|
+
Driver setup, sessions and transactions belong to `neo4j-driver-javascript-skill`.
|
|
58
|
+
|
|
59
|
+
## Passing the raw result
|
|
60
|
+
|
|
61
|
+
```javascript
|
|
62
|
+
// ❌ records are not graph elements; NVL gets ids missing
|
|
63
|
+
const result = await driver.executeQuery('MATCH (a)-[r]-(b) RETURN a, r, b')
|
|
64
|
+
new NVL(container, result.records, [])
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Always go through the transformer, or map the records yourself to `{ id, ... }` / `{ id, from, to, ... }`.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Labels, icons and overlays
|
|
2
|
+
|
|
3
|
+
When you need this: text or images on nodes, especially with the WebGL renderer, or you want to draw your own overlay (axes, legends, tooltips) that follows pan and zoom.
|
|
4
|
+
|
|
5
|
+
Verification tags: **source**, **types**, **runtime** (see `SKILL.md`).
|
|
6
|
+
|
|
7
|
+
## Renderer trade-off
|
|
8
|
+
|
|
9
|
+
| Renderer | Practical ceiling | Captions | Icons / arrowheads | Hit-test |
|
|
10
|
+
|---|---|---|---|---|
|
|
11
|
+
| `'canvas'` (default) | ~1,000 nodes | yes | yes | exact |
|
|
12
|
+
| `'webgl'` | 100,000+ nodes | **no** | yes | approximate |
|
|
13
|
+
|
|
14
|
+
WebGL rendering and the force-directed physics need **WebGL2**. `disableWebGL: true` forces Canvas and the non-GPU layout implementations. Switch at runtime with `setRenderer`. *types*
|
|
15
|
+
|
|
16
|
+
## Captions
|
|
17
|
+
|
|
18
|
+
`caption` (single string) or `captions: StyledCaption[]` (styled, multiple); `captions` wins if both are set. Captions are drawn by the Canvas renderer only; with WebGL they are silently absent. There is no texture-size limit involved; it is a renderer feature gap. *types*
|
|
19
|
+
|
|
20
|
+
Options when you need text and WebGL:
|
|
21
|
+
|
|
22
|
+
1. `html` overlay per node (see below) for a few hundred visible nodes.
|
|
23
|
+
2. `icon` for an image glyph instead of text.
|
|
24
|
+
3. Draw your own overlay from `getNodes()` positions.
|
|
25
|
+
4. Switch to `'canvas'` when zoomed in.
|
|
26
|
+
|
|
27
|
+
## `icon`
|
|
28
|
+
|
|
29
|
+
- URL of a square image drawn inside the node. Icons are expected to be black; on dark node colours they are inverted to white. *types*
|
|
30
|
+
- Many distinct icon URLs (≈1,800 across 3,825 nodes) led to many nodes with no icon drawn and no warning. Keep the set of distinct images small. *runtime*
|
|
31
|
+
|
|
32
|
+
## `overlayIcon`
|
|
33
|
+
|
|
34
|
+
`{ url, position?: number[], size?: number }` draws a square image anywhere over the element; `size` is relative to the node size (default `1`). *types*
|
|
35
|
+
|
|
36
|
+
## `html`
|
|
37
|
+
|
|
38
|
+
`html: HTMLElement` is placed in an absolutely positioned `<div>` over the node, scaled with the zoom level. Experimental. *types, source*
|
|
39
|
+
|
|
40
|
+
- Each node with `html` keeps about two DOM elements alive; 3,825 nodes gave ~7,700 elements and idle FPS fell from ~60 to ~50. *runtime*
|
|
41
|
+
- Any `html` overlay disables the GPU position fast path, because positions must be read back to the CPU each frame. *source*
|
|
42
|
+
- Relationship HTML captions are hidden with the WebGL renderer. *source*
|
|
43
|
+
|
|
44
|
+
## Drawing your own overlay
|
|
45
|
+
|
|
46
|
+
Use a sibling element over the container and convert coordinates:
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
const toScreen = ({ x, y }) => {
|
|
50
|
+
const scale = nvl.getScale()
|
|
51
|
+
const pan = nvl.getPan()
|
|
52
|
+
const { width, height } = nvl.getContainer().getBoundingClientRect()
|
|
53
|
+
return { x: (x - pan.x) * scale + width / 2, y: (y - pan.y) * scale + height / 2 }
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- Node `size` is the radius in world units, so the screen radius is `size * scale`. *runtime*
|
|
58
|
+
- `getNodes()` already includes `clientPosition` relative to the canvas, which is the same conversion. *types*
|
|
59
|
+
- Redraw on `onZoomAndPan`, `onPan` and `onLayoutStep` (or on `onLayoutDone` if per-frame updates are not needed, to keep the GPU fast path).
|
|
60
|
+
|
|
61
|
+
## Hit testing without interaction handlers
|
|
62
|
+
|
|
63
|
+
```javascript
|
|
64
|
+
container.addEventListener('click', (evt) => {
|
|
65
|
+
const { nvlTargets } = nvl.getHits(evt, ['node', 'relationship', 'cluster'], { hitNodeMarginWidth: 4 })
|
|
66
|
+
const node = nvlTargets.nodes[0]?.data
|
|
67
|
+
const rel = nvlTargets.relationships[0]?.data
|
|
68
|
+
const cluster = nvlTargets.clusters[0]?.data
|
|
69
|
+
})
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`HitTargetNode` / `HitTargetRelationship` carry `data`, `pointerCoordinates`, `distance` and `insideNode` (nodes). `HitTargetCluster` carries `data`, `pointerCoordinates` and the convex `hull`. Default `hitNodeMarginWidth` is `0`, so widen it when clicks near the edge miss. *types*
|
|
73
|
+
|
|
74
|
+
## Image export
|
|
75
|
+
|
|
76
|
+
Call `saveToFile({ filename, backgroundColor })`, `saveToSvg(...)` or `getImageDataUrl(...)` from `onLayoutDone`; before that the positions are still settling and the PNG can be blank. *types, runtime*
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Layouts and positions
|
|
2
|
+
|
|
3
|
+
When you need this: a layout does not re-run when you expect it to, nodes do not move when you set coordinates, or you need to choose a layout.
|
|
4
|
+
|
|
5
|
+
Verification tags: **source**, **types**, **runtime** (see `SKILL.md`).
|
|
6
|
+
|
|
7
|
+
## Choosing a layout
|
|
8
|
+
|
|
9
|
+
| Data shape | `layout` | Notes |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| Generic network | `'forceDirected'` (default) | GPU physics on WebGL2; `layoutOptions.clustering`, `seedingMethod: 'box' \| 'circle'` |
|
|
12
|
+
| Tree / DAG | `'hierarchical'` | `layoutOptions.direction`, `packing`; runs in a `SharedWorker` (see [vite-and-bundlers](vite-and-bundlers.md)) |
|
|
13
|
+
| Ring | `'circular'` | `layoutOptions.sortFunction: (nodes) => nodes` |
|
|
14
|
+
| Your own coordinates | `'free'` | Nothing moves; use `setNodePositions` |
|
|
15
|
+
| Grid | `'grid'` | |
|
|
16
|
+
| CPU force (d3) | `'d3Force'` | |
|
|
17
|
+
|
|
18
|
+
*types*
|
|
19
|
+
|
|
20
|
+
`minFps` / `maxFps` (defaults `3` / `30`, capped `1..120`) set the presentation rate while a layout is active. *types*
|
|
21
|
+
|
|
22
|
+
## Callbacks
|
|
23
|
+
|
|
24
|
+
- `onLayoutComputing(isComputing)` fires at start and end of a computation.
|
|
25
|
+
- `onLayoutDone()` fires when the layout settles. Trigger `fit`, exports and screenshots from here.
|
|
26
|
+
- `onLayoutStep(nodes)` fires every step with `NodeWithClientPosition[]`. Registering it disables the GPU position fast path (positions must be read back to the CPU each frame), so use it only when you need per-frame positions. *source*
|
|
27
|
+
|
|
28
|
+
## When a layout re-runs, and when it does not
|
|
29
|
+
|
|
30
|
+
- `setLayout(type)` with a **different** type switches and runs the new layout. Calling it with the current type does nothing visible. *source*
|
|
31
|
+
- `setLayoutOptions(options)` updates the layout's options and redraws the cluster overlay when `clustering` is present. For the circular layout, changing `sortFunction` does **not** re-run the layout or fire `onLayoutDone`. *source, runtime*
|
|
32
|
+
- Un-pinning nodes while `forceDirected` is active does not restart a settled simulation. *runtime*
|
|
33
|
+
- `restart(options, true)` rebuilds NVL with merged options and keeps positions; it did not restart the simulation in the un-pin case. *runtime*
|
|
34
|
+
|
|
35
|
+
Working restarts:
|
|
36
|
+
|
|
37
|
+
```javascript
|
|
38
|
+
// circular with a new order
|
|
39
|
+
nvl.setLayout('free')
|
|
40
|
+
nvl.setLayoutOptions({ sortFunction: byDegree })
|
|
41
|
+
nvl.setLayout('circular')
|
|
42
|
+
|
|
43
|
+
// wake a settled force-directed layout
|
|
44
|
+
nvl.setNodePositions(nvl.getNodePositions(), true)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Setting positions
|
|
48
|
+
|
|
49
|
+
- `setNodePositions(nodes, updateLayout = false)` moves nodes to the given `x` / `y`. With `updateLayout: true` the current layout continues from there. *types*
|
|
50
|
+
- `x` / `y` in node data are applied **on insert only**. Updating an existing node through `updateElementsInGraph` or the React `nodes` prop with new `x` / `y` does not move it; `setNodePositions` does. *source*
|
|
51
|
+
- `pinNode(id)` / `unPinNode(ids: string[])` or `pinned: true` in node data hold nodes in place for the force-directed layout. Clustering forces ignore pins (see [clustering](clustering.md)). *types, runtime*
|
|
52
|
+
- Mixed layouts (some nodes at data positions, others free): pin the fixed nodes, call `setNodePositions` for them, keep `forceDirected` for the rest. Switching back: un-pin, then `setNodePositions(current, true)`.
|
|
53
|
+
|
|
54
|
+
## Coordinates
|
|
55
|
+
|
|
56
|
+
`getNodes()` returns `x` / `y` in layout space and `clientPosition` relative to the canvas element. `getNodePositions()` returns layout coordinates only. *types*
|
|
57
|
+
|
|
58
|
+
Layout → screen: `screen = (world - pan) * scale + containerSize / 2`, with `scale = getScale()` and `pan = getPan()`. A node's `size` is its radius in world units. *runtime*
|
|
59
|
+
|
|
60
|
+
## Layout never settles
|
|
61
|
+
|
|
62
|
+
- Pin anchor nodes (`pinNode`).
|
|
63
|
+
- Use `hierarchical` for tree-shaped data.
|
|
64
|
+
- Reduce the node count.
|
|
65
|
+
- There is no `layoutTimeLimit` option; older guidance that mentions it is wrong. *types*
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Lifecycle and graph updates
|
|
2
|
+
|
|
3
|
+
When you need this: you add, change or remove elements after the first render, restart NVL, tear it down, or handle WebGL context loss.
|
|
4
|
+
|
|
5
|
+
Verification tags: **source**, **types**, **runtime** (see `SKILL.md`).
|
|
6
|
+
|
|
7
|
+
## Updating the graph
|
|
8
|
+
|
|
9
|
+
| Method | Behaviour |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `addAndUpdateElementsInGraph(nodes, rels)` | Insert new ids; update existing ones with the given fields |
|
|
12
|
+
| `updateElementsInGraph(nodes, rels)` | Update existing only; unknown ids are ignored |
|
|
13
|
+
| `addElementsToGraph(nodes, rels)` | Insert only; **existing ids are silently skipped** |
|
|
14
|
+
| `removeNodesWithIds(ids)` | Remove nodes and their relationships |
|
|
15
|
+
| `removeRelationshipsWithIds(ids)` | Remove relationships |
|
|
16
|
+
| `setNodePositions(nodes, updateLayout?)` | Move nodes; optionally let the layout continue |
|
|
17
|
+
| `restart(options?, retainPositions?)` | Rebuild with merged options |
|
|
18
|
+
|
|
19
|
+
*source*
|
|
20
|
+
|
|
21
|
+
Updates take `PartialNode` / `PartialRelationship`: only `id` is required. *types*
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
nvl.updateElementsInGraph(
|
|
25
|
+
[{ id: '1', color: '#f00', selected: true }],
|
|
26
|
+
[{ id: '12', width: 4 }]
|
|
27
|
+
)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Prefer the update methods over `restart` for data changes: `restart` recreates the renderer and layout and resets interaction state.
|
|
31
|
+
|
|
32
|
+
Invalid elements (missing `id`, or a relationship whose `from` / `to` is unknown) go to `onError` when it is registered; otherwise a `TypeError` is thrown. *source*
|
|
33
|
+
|
|
34
|
+
## Teardown
|
|
35
|
+
|
|
36
|
+
Vanilla: destroy every interaction handler, then the instance.
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
for (const h of handlers) h.destroy()
|
|
40
|
+
nvl.destroy()
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
React: the wrappers do this on unmount. A manual `new NVL(...)` inside `useEffect` needs `return () => nvl.destroy()`, or the instance leaks across route changes.
|
|
44
|
+
|
|
45
|
+
## `restart`
|
|
46
|
+
|
|
47
|
+
`restart(options, retainPositions)` merges `options` into the current ones and rebuilds. With `retainPositions: true` nodes keep their coordinates. Use it to change creation-time options such as `styling` or `minZoom`; it does not restart a settled force-directed simulation (see [layouts-and-positions](layouts-and-positions.md)). *types, runtime*
|
|
48
|
+
|
|
49
|
+
## WebGL context lost
|
|
50
|
+
|
|
51
|
+
`onWebGLContextLost(event)` fires when the GPU drops the context (tab backgrounded, driver reset). Recover by switching renderer or restarting: *types*
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
new NVL(container, nodes, rels, { renderer: 'webgl' }, {
|
|
55
|
+
onWebGLContextLost: () => nvl.restart({ renderer: 'canvas' }, true)
|
|
56
|
+
})
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Telemetry
|
|
60
|
+
|
|
61
|
+
NVL sends anonymous usage events through Segment unless `disableTelemetry: true` is set. Set it in regulated, offline and test environments. *source*
|
|
62
|
+
|
|
63
|
+
## Errors
|
|
64
|
+
|
|
65
|
+
Register `onError` to receive validation errors instead of exceptions; without it they throw. Worker construction failures are only logged with `console.warn` and fall back silently; a worker that loads but fails is not reported at all (see [vite-and-bundlers](vite-and-bundlers.md)). *source*
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Migrating from NVL 1.x to 2.0
|
|
2
|
+
|
|
3
|
+
When you need this: code or examples written for 1.x behave differently, or an option is reported as unknown.
|
|
4
|
+
|
|
5
|
+
Verification tags: **source**, **types**, **runtime** (see `SKILL.md`).
|
|
6
|
+
|
|
7
|
+
## React wrapper props
|
|
8
|
+
|
|
9
|
+
`layout` and `layoutOptions` are no longer props of the wrappers; they live in `nvlOptions`. Passing them as props is a type error and has no effect. *types*
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
// 1.x
|
|
13
|
+
<InteractiveNvlWrapper layout="hierarchical" layoutOptions={{ direction: 'down' }} />
|
|
14
|
+
|
|
15
|
+
// 2.0
|
|
16
|
+
<InteractiveNvlWrapper nvlOptions={{ layout: 'hierarchical', layoutOptions: { direction: 'down' } }} />
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## `onZoom` removed
|
|
20
|
+
|
|
21
|
+
The `ZoomInteraction` callback is `onZoomAndPan(zoomLevel, panX, panY, event)`. In the React wrapper the key is `mouseEventCallbacks.onZoomAndPan`; it is also what enables wheel zoom. *source*
|
|
22
|
+
|
|
23
|
+
## Removed options
|
|
24
|
+
|
|
25
|
+
- `intelWorkaround` (GPU shader workaround) is gone.
|
|
26
|
+
- `enableCytoscape` and other Cytoscape-related layout settings are gone.
|
|
27
|
+
|
|
28
|
+
*types*
|
|
29
|
+
|
|
30
|
+
## Renderer
|
|
31
|
+
|
|
32
|
+
- WebGL rendering and the force-directed physics require **WebGL2**; WebGL1 is not supported.
|
|
33
|
+
- The WebGL renderer supports node icons and relationship arrowheads but **not captions**. Use the Canvas renderer when labels matter.
|
|
34
|
+
- `disableWebGL: true` forces Canvas rendering and non-GPU layouts.
|
|
35
|
+
|
|
36
|
+
*types*
|
|
37
|
+
|
|
38
|
+
## Return types
|
|
39
|
+
|
|
40
|
+
`getNodes()` and `onLayoutStep` return `NodeWithClientPosition[]`: `x` / `y` are layout coordinates and `clientPosition` is relative to the canvas element. *types*
|
|
41
|
+
|
|
42
|
+
## Styling
|
|
43
|
+
|
|
44
|
+
`styling.minimapViewportBoxColor` is deprecated; use `styling.overlayLineColor`, which also colours cluster outlines for mixed-colour clusters. *types*
|
|
45
|
+
|
|
46
|
+
## New in 2.0
|
|
47
|
+
|
|
48
|
+
- Clustering: `layoutOptions.clustering` for force-directed, `layoutOptions.clusterBy` for hierarchical (see [clustering](clustering.md)).
|
|
49
|
+
- `onClusterClick` / `onClusterDoubleClick` / `onClusterRightClick` in `ClickInteraction` and `getHits(event, ['cluster'])`.
|
|
50
|
+
- `minFps` / `maxFps` presentation targets and `layoutOptions.seedingMethod` for force-directed.
|