@neo4j-nvl/base 1.2.2 → 2.0.0-1e695738

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 (235) hide show
  1. package/CHANGELOG.md +54 -1
  2. package/README.md +8 -0
  3. package/dist/base.mjs +35891 -2
  4. package/dist/types/index.d.ts +382 -386
  5. package/dist/types/layouts/animatedlayout/AnimatedLayout.d.ts +23 -23
  6. package/dist/types/layouts/animatedlayout/animationUtils.d.ts +3 -3
  7. package/dist/types/layouts/circularLayout/CircularLayout.d.ts +14 -14
  8. package/dist/types/layouts/d3forcelayout/circularLayout.d.ts +4 -4
  9. package/dist/types/layouts/d3forcelayout/constants.d.ts +3 -4
  10. package/dist/types/layouts/d3forcelayout/d3ForceLayout.d.ts +31 -31
  11. package/dist/types/layouts/d3forcelayout/types.d.ts +7 -7
  12. package/dist/types/layouts/forcedirectedlayout/PhysLayout.d.ts +275 -0
  13. package/dist/types/layouts/forcedirectedlayout/clustering/ClusterByMerger.d.ts +62 -0
  14. package/dist/types/layouts/forcedirectedlayout/clustering/SolarMerger.d.ts +56 -0
  15. package/dist/types/layouts/forcedirectedlayout/clustering/clustering-utils.d.ts +143 -0
  16. package/dist/types/layouts/forcedirectedlayout/clustering/types.d.ts +59 -0
  17. package/dist/types/layouts/forcedirectedlayout/glwrapper.d.ts +4 -0
  18. package/dist/types/layouts/forcedirectedlayout/shaders/multilevel-fragment.d.ts +2 -0
  19. package/dist/types/layouts/forcedirectedlayout/shaders/multilevel-repulsive-fragment.d.ts +2 -0
  20. package/dist/types/layouts/forcedirectedlayout/shaders/multilevel-update-fragment.d.ts +2 -0
  21. package/dist/types/layouts/forcedirectedlayout/shaders/sim-vertex.d.ts +2 -0
  22. package/dist/types/layouts/freeLayout/FreeLayout.d.ts +23 -25
  23. package/dist/types/layouts/gridLayout/GridLayout.d.ts +26 -30
  24. package/dist/types/layouts/hierarchicallayout/HierarchicalLayout.d.ts +28 -23
  25. package/dist/types/layouts/hierarchicallayout/constants.d.ts +2 -2
  26. package/dist/types/modules/CallbackHelper.d.ts +23 -23
  27. package/dist/types/modules/ExternalCallbackHandler.d.ts +33 -39
  28. package/dist/types/modules/NvlController.d.ts +212 -129
  29. package/dist/types/modules/Shader.d.ts +17 -17
  30. package/dist/types/modules/ZoomTransitionHandler.d.ts +24 -24
  31. package/dist/types/modules/dataset.d.ts +26 -24
  32. package/dist/types/modules/logging.d.ts +4 -4
  33. package/dist/types/modules/state/constants.d.ts +2 -2
  34. package/dist/types/modules/state/state.d.ts +2 -2
  35. package/dist/types/modules/state/types.d.ts +338 -228
  36. package/dist/types/modules/state/utils.d.ts +36 -36
  37. package/dist/types/renderers/ClusterOverlay.d.ts +73 -0
  38. package/dist/types/renderers/domrenderer/BaseRenderer.d.ts +69 -69
  39. package/dist/types/renderers/domrenderer/canvasrenderer/Animation.d.ts +57 -57
  40. package/dist/types/renderers/domrenderer/canvasrenderer/AnimationHandler.d.ts +65 -65
  41. package/dist/types/renderers/domrenderer/canvasrenderer/CanvasRenderer.d.ts +84 -85
  42. package/dist/types/renderers/domrenderer/canvasrenderer/arrowDrawing.d.ts +31 -31
  43. package/dist/types/renderers/domrenderer/canvasrenderer/nodeDrawing.d.ts +32 -32
  44. package/dist/types/renderers/domrenderer/shared/ImageCache.d.ts +16 -15
  45. package/dist/types/renderers/domrenderer/shared/arrows/ArrowBundle.d.ts +89 -89
  46. package/dist/types/renderers/domrenderer/shared/arrows/ArrowBundler.d.ts +42 -42
  47. package/dist/types/renderers/domrenderer/shared/arrows/arrows.d.ts +49 -49
  48. package/dist/types/renderers/domrenderer/shared/arrows/constants.d.ts +4 -4
  49. package/dist/types/renderers/domrenderer/shared/nodes/nodes.d.ts +21 -21
  50. package/dist/types/renderers/domrenderer/shared/types.d.ts +29 -30
  51. package/dist/types/renderers/domrenderer/shared/util.d.ts +4 -4
  52. package/dist/types/renderers/domrenderer/shared/vectorUtils.d.ts +10 -10
  53. package/dist/types/renderers/domrenderer/shared/wordwrap.d.ts +10 -10
  54. package/dist/types/renderers/domrenderer/svgrenderer/SvgRenderer.d.ts +18 -19
  55. package/dist/types/renderers/domrenderer/svgrenderer/arrowDrawing.d.ts +15 -15
  56. package/dist/types/renderers/domrenderer/svgrenderer/nodeDrawing.d.ts +4 -4
  57. package/dist/types/renderers/domrenderer/svgrenderer/svgUtils.d.ts +21 -21
  58. package/dist/types/renderers/webglrenderer/Controller.d.ts +83 -61
  59. package/dist/types/renderers/webglrenderer/IconLayerRegistry.d.ts +14 -0
  60. package/dist/types/renderers/webglrenderer/Renderer.d.ts +91 -51
  61. package/dist/types/renderers/webglrenderer/node-animation-fragment.d.ts +2 -2
  62. package/dist/types/renderers/webglrenderer/node-animation-vertex.d.ts +2 -2
  63. package/dist/types/renderers/webglrenderer/node-fragment-point.d.ts +2 -2
  64. package/dist/types/renderers/webglrenderer/node-vertex-point.d.ts +2 -2
  65. package/dist/types/renderers/webglrenderer/rel-fragment-line.d.ts +2 -2
  66. package/dist/types/renderers/webglrenderer/rel-glsl-utils.d.ts +1 -0
  67. package/dist/types/renderers/webglrenderer/rel-vertex-arrow.d.ts +2 -0
  68. package/dist/types/renderers/webglrenderer/rel-vertex-line.d.ts +2 -2
  69. package/dist/types/renderers/webglrenderer/viewport-box-fragment.d.ts +2 -2
  70. package/dist/types/renderers/webglrenderer/viewport-box-vertex.d.ts +2 -2
  71. package/dist/types/types/graph-element.d.ts +109 -101
  72. package/dist/types/types/nvl-window-functions.d.ts +12 -13
  73. package/dist/types/types/utils.d.ts +1 -1
  74. package/dist/types/utils/ariaUtils.d.ts +2 -2
  75. package/dist/types/utils/canvasManagement.d.ts +8 -2
  76. package/dist/types/utils/circularUtils.d.ts +2 -2
  77. package/dist/types/utils/clusterGeometry.d.ts +14 -0
  78. package/dist/types/utils/clusterHitRegions.d.ts +42 -0
  79. package/dist/types/utils/colorUtils.d.ts +2 -2
  80. package/dist/types/utils/constants.d.ts +12 -6
  81. package/dist/types/utils/errors.d.ts +6 -6
  82. package/dist/types/utils/geometry.d.ts +91 -48
  83. package/dist/types/utils/graphObjectUtils.d.ts +9 -9
  84. package/dist/types/utils/hitTest.d.ts +84 -0
  85. package/dist/types/utils/jsDriverResultTransformer.d.ts +27 -25
  86. package/dist/types/utils/layoutSeeding.d.ts +7 -0
  87. package/dist/types/utils/mouseUtils.d.ts +5 -5
  88. package/dist/types/utils/segmentAnalytics.d.ts +42 -42
  89. package/dist/types/utils/webWorkerUtils.d.ts +2 -2
  90. package/dist/types/utils/zoomFunctions.d.ts +24 -16
  91. package/package.json +15 -15
  92. package/skills/neo4j-nvl-skill/README.md +39 -0
  93. package/skills/neo4j-nvl-skill/SKILL.md +296 -0
  94. package/skills/neo4j-nvl-skill/references/api/base/classes/NVL.md +977 -0
  95. package/skills/neo4j-nvl-skill/references/api/base/functions/getZoomTargetForNodePositions.md +37 -0
  96. package/skills/neo4j-nvl-skill/references/api/base/index.md +71 -0
  97. package/skills/neo4j-nvl-skill/references/api/base/interfaces/CircularOptions.md +11 -0
  98. package/skills/neo4j-nvl-skill/references/api/base/interfaces/ClusteringOptions.md +14 -0
  99. package/skills/neo4j-nvl-skill/references/api/base/interfaces/ExternalCallbacks.md +18 -0
  100. package/skills/neo4j-nvl-skill/references/api/base/interfaces/ForceDirectedOptions.md +12 -0
  101. package/skills/neo4j-nvl-skill/references/api/base/interfaces/HierarchicalOptions.md +13 -0
  102. package/skills/neo4j-nvl-skill/references/api/base/interfaces/HitTargetCluster.md +13 -0
  103. package/skills/neo4j-nvl-skill/references/api/base/interfaces/HitTargetNode.md +16 -0
  104. package/skills/neo4j-nvl-skill/references/api/base/interfaces/HitTargetRelationship.md +15 -0
  105. package/skills/neo4j-nvl-skill/references/api/base/interfaces/Node.md +32 -0
  106. package/skills/neo4j-nvl-skill/references/api/base/interfaces/NvlMouseEvent.md +16 -0
  107. package/skills/neo4j-nvl-skill/references/api/base/interfaces/NvlOptions.md +38 -0
  108. package/skills/neo4j-nvl-skill/references/api/base/interfaces/Point.md +12 -0
  109. package/skills/neo4j-nvl-skill/references/api/base/interfaces/Relationship.md +32 -0
  110. package/skills/neo4j-nvl-skill/references/api/base/type-aliases/CanvasRendererType.md +14 -0
  111. package/skills/neo4j-nvl-skill/references/api/base/type-aliases/Cluster.md +20 -0
  112. package/skills/neo4j-nvl-skill/references/api/base/type-aliases/ClusterByFn.md +20 -0
  113. package/skills/neo4j-nvl-skill/references/api/base/type-aliases/ClusterId.md +10 -0
  114. package/skills/neo4j-nvl-skill/references/api/base/type-aliases/HitTargets.md +22 -0
  115. package/skills/neo4j-nvl-skill/references/api/base/type-aliases/HitTestTarget.md +7 -0
  116. package/skills/neo4j-nvl-skill/references/api/base/type-aliases/Layout.md +15 -0
  117. package/skills/neo4j-nvl-skill/references/api/base/type-aliases/LayoutOptions.md +12 -0
  118. package/skills/neo4j-nvl-skill/references/api/base/type-aliases/NodeWithClientPosition.md +18 -0
  119. package/skills/neo4j-nvl-skill/references/api/base/type-aliases/PartialNode.md +17 -0
  120. package/skills/neo4j-nvl-skill/references/api/base/type-aliases/PartialRelationship.md +17 -0
  121. package/skills/neo4j-nvl-skill/references/api/base/type-aliases/Renderer.md +9 -0
  122. package/skills/neo4j-nvl-skill/references/api/base/type-aliases/StyledCaption.md +21 -0
  123. package/skills/neo4j-nvl-skill/references/api/base/type-aliases/WebGLRendererType.md +14 -0
  124. package/skills/neo4j-nvl-skill/references/api/base/type-aliases/ZoomOptions.md +25 -0
  125. package/skills/neo4j-nvl-skill/references/api/base/variables/CircularLayoutType.md +11 -0
  126. package/skills/neo4j-nvl-skill/references/api/base/variables/ForceDirectedLayoutType.md +9 -0
  127. package/skills/neo4j-nvl-skill/references/api/base/variables/FreeLayoutType.md +9 -0
  128. package/skills/neo4j-nvl-skill/references/api/base/variables/GridLayoutType.md +9 -0
  129. package/skills/neo4j-nvl-skill/references/api/base/variables/HierarchicalLayoutType.md +9 -0
  130. package/skills/neo4j-nvl-skill/references/api/base/variables/d3ForceLayoutType.md +9 -0
  131. package/skills/neo4j-nvl-skill/references/api/base/variables/nvlResultTransformer.md +38 -0
  132. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/BoxSelectInteraction.md +163 -0
  133. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/ClickInteraction.md +163 -0
  134. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/DragNodeInteraction.md +164 -0
  135. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/HoverInteraction.md +160 -0
  136. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/KeyboardInteraction.md +185 -0
  137. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/LassoInteraction.md +163 -0
  138. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/PanInteraction.md +196 -0
  139. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/ZoomInteraction.md +164 -0
  140. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/index.md +37 -0
  141. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/BoxSelectInteractionCallbacks.md +19 -0
  142. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/BoxSelectInteractionOptions.md +17 -0
  143. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/ClickInteractionCallbacks.md +39 -0
  144. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/ClickInteractionOptions.md +17 -0
  145. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/DragNodeInteractionCallbacks.md +21 -0
  146. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/DrawInteractionOptions.md +22 -0
  147. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/HoverInteractionCallbacks.md +17 -0
  148. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/HoverInteractionOptions.md +17 -0
  149. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/KeyboardInteractionCallbacks.md +35 -0
  150. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/KeyboardInteractionOptions.md +55 -0
  151. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/LassoInteractionCallbacks.md +19 -0
  152. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/LassoInteractionOptions.md +17 -0
  153. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/PanInteractionCallbacks.md +17 -0
  154. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/PanInteractionOptions.md +19 -0
  155. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/ZoomInteractionCallbacks.md +17 -0
  156. package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/ZoomInteractionOptions.md +17 -0
  157. package/skills/neo4j-nvl-skill/references/api/react/functions/StaticPictureWrapper.md +35 -0
  158. package/skills/neo4j-nvl-skill/references/api/react/index.md +34 -0
  159. package/skills/neo4j-nvl-skill/references/api/react/interfaces/BasicReactWrapperProps.md +24 -0
  160. package/skills/neo4j-nvl-skill/references/api/react/interfaces/InteractiveNvlWrapperProps.md +27 -0
  161. package/skills/neo4j-nvl-skill/references/api/react/type-aliases/InteractionOptions.md +10 -0
  162. package/skills/neo4j-nvl-skill/references/api/react/type-aliases/KeyboardEvent.md +7 -0
  163. package/skills/neo4j-nvl-skill/references/api/react/type-aliases/KeyboardEventCallbacks.md +10 -0
  164. package/skills/neo4j-nvl-skill/references/api/react/type-aliases/MouseEvent.md +10 -0
  165. package/skills/neo4j-nvl-skill/references/api/react/type-aliases/MouseEventCallbacks.md +10 -0
  166. package/skills/neo4j-nvl-skill/references/api/react/type-aliases/StaticPictureWrapperProps.md +27 -0
  167. package/skills/neo4j-nvl-skill/references/api/react/variables/BasicNvlWrapper.md +50 -0
  168. package/skills/neo4j-nvl-skill/references/api/react/variables/InteractiveNvlWrapper.md +17 -0
  169. package/skills/neo4j-nvl-skill/references/clustering.md +87 -0
  170. package/skills/neo4j-nvl-skill/references/data-from-neo4j.md +67 -0
  171. package/skills/neo4j-nvl-skill/references/labels-and-overlays.md +76 -0
  172. package/skills/neo4j-nvl-skill/references/layouts-and-positions.md +65 -0
  173. package/skills/neo4j-nvl-skill/references/lifecycle-and-updates.md +65 -0
  174. package/skills/neo4j-nvl-skill/references/migrating-1x-to-2.md +50 -0
  175. package/skills/neo4j-nvl-skill/references/react-wrappers.md +88 -0
  176. package/skills/neo4j-nvl-skill/references/verifying-nvl-apps.md +52 -0
  177. package/skills/neo4j-nvl-skill/references/vite-and-bundlers.md +62 -0
  178. package/dist/base.mjs.LICENSE.txt +0 -21
  179. package/dist/types/layouts/animatedlayout/AnimatedLayout.test.d.ts +0 -1
  180. package/dist/types/layouts/animatedlayout/animationUtils.test.d.ts +0 -1
  181. package/dist/types/layouts/d3forcelayout/__mocks__/d3ForceLayout.d.ts +0 -10
  182. package/dist/types/layouts/d3forcelayout/circularLayout.test.d.ts +0 -1
  183. package/dist/types/layouts/d3forcelayout/d3ForceLayout.test.d.ts +0 -1
  184. package/dist/types/layouts/forcedirectedlayout/ForceCytoLayout.d.ts +0 -22
  185. package/dist/types/layouts/forcedirectedlayout/cosebilkentlayout/CoseBilkentLayout.d.ts +0 -33
  186. package/dist/types/layouts/forcedirectedlayout/physlayout/PhysLayout.d.ts +0 -174
  187. package/dist/types/layouts/forcedirectedlayout/physlayout/PhysLayout.test.d.ts +0 -1
  188. package/dist/types/layouts/forcedirectedlayout/physlayout/glwrapper.d.ts +0 -4
  189. package/dist/types/layouts/forcedirectedlayout/physlayout/shaders/multilevel-fragment.d.ts +0 -2
  190. package/dist/types/layouts/forcedirectedlayout/physlayout/shaders/multilevel-repulsive-fragment.d.ts +0 -2
  191. package/dist/types/layouts/forcedirectedlayout/physlayout/shaders/multilevel-update-fragment.d.ts +0 -2
  192. package/dist/types/layouts/forcedirectedlayout/physlayout/shaders/sim-vertex.d.ts +0 -2
  193. package/dist/types/layouts/forcedirectedlayout/physlayout/shaders/workaround-fragment.d.ts +0 -2
  194. package/dist/types/layouts/forcedirectedlayout/physlayout/solarmerger/SolarMerger.bench.d.ts +0 -1
  195. package/dist/types/layouts/forcedirectedlayout/physlayout/solarmerger/SolarMerger.d.ts +0 -21
  196. package/dist/types/layouts/forcedirectedlayout/physlayout/solarmerger/SolarMerger.test.d.ts +0 -1
  197. package/dist/types/layouts/forcedirectedlayout/physlayout/solarmerger/solar-placer.d.ts +0 -2
  198. package/dist/types/layouts/forcedirectedlayout/physlayout/solarmerger/solar-placer.test.d.ts +0 -1
  199. package/dist/types/layouts/forcedirectedlayout/physlayout/solarmerger/types.d.ts +0 -49
  200. package/dist/types/modules/NvlController.test.d.ts +0 -1
  201. package/dist/types/modules/ZoomTransitionHandler.test.d.ts +0 -1
  202. package/dist/types/modules/dataset.test.d.ts +0 -1
  203. package/dist/types/modules/state/state.test.d.ts +0 -1
  204. package/dist/types/modules/state/utils.test.d.ts +0 -1
  205. package/dist/types/renderers/domrenderer/BaseRenderer.test.d.ts +0 -1
  206. package/dist/types/renderers/domrenderer/canvasrenderer/Animation.test.d.ts +0 -1
  207. package/dist/types/renderers/domrenderer/canvasrenderer/CanvasRenderer.test.d.ts +0 -1
  208. package/dist/types/renderers/domrenderer/canvasrenderer/arrowDrawing.test.d.ts +0 -1
  209. package/dist/types/renderers/domrenderer/canvasrenderer/nodeDrawing.test.d.ts +0 -1
  210. package/dist/types/renderers/domrenderer/shared/ImageCache.test.d.ts +0 -1
  211. package/dist/types/renderers/domrenderer/shared/arrows/ArrowBundle.test.d.ts +0 -1
  212. package/dist/types/renderers/domrenderer/shared/arrows/ArrowBundler.test.d.ts +0 -1
  213. package/dist/types/renderers/domrenderer/shared/arrows/arrows.test.d.ts +0 -1
  214. package/dist/types/renderers/domrenderer/shared/nodes/nodes.test.d.ts +0 -1
  215. package/dist/types/renderers/domrenderer/shared/util.test.d.ts +0 -1
  216. package/dist/types/renderers/domrenderer/shared/wordwrap.test.d.ts +0 -1
  217. package/dist/types/renderers/domrenderer/svgrenderer/SvgRenderer.test.d.ts +0 -1
  218. package/dist/types/renderers/domrenderer/svgrenderer/arrowDrawing.test.d.ts +0 -1
  219. package/dist/types/renderers/domrenderer/svgrenderer/nodeDrawing.test.d.ts +0 -1
  220. package/dist/types/renderers/domrenderer/svgrenderer/svgUtils.test.d.ts +0 -1
  221. package/dist/types/renderers/webglrenderer/Controller.test.d.ts +0 -1
  222. package/dist/types/renderers/webglrenderer/Renderer.test.d.ts +0 -1
  223. package/dist/types/utils/ariaUtils.test.d.ts +0 -1
  224. package/dist/types/utils/canvasManagement.test.d.ts +0 -1
  225. package/dist/types/utils/circularUtils.test.d.ts +0 -1
  226. package/dist/types/utils/colorUtils.test.d.ts +0 -1
  227. package/dist/types/utils/errors.test.d.ts +0 -1
  228. package/dist/types/utils/geometry.test.d.ts +0 -1
  229. package/dist/types/utils/graphObjectUtils.test.d.ts +0 -1
  230. package/dist/types/utils/hittest.d.ts +0 -58
  231. package/dist/types/utils/hittest.test.d.ts +0 -1
  232. package/dist/types/utils/jsDriverResultTransformer.test.d.ts +0 -1
  233. package/dist/types/utils/mouseUtils.test.d.ts +0 -1
  234. package/dist/types/utils/webWorkerUtils.test.d.ts +0 -1
  235. package/dist/types/utils/zoomFunctions.test.d.ts +0 -1
@@ -1,21 +1,20 @@
1
- import type { ExternalCallbacks } from './modules/ExternalCallbackHandler';
2
- import type { CircularOptions, ForceDirectedOptions, HierarchicalOptions, Renderer as InternalRenderer, Layout, LayoutOptions, NvlOptions, NvlState, ZoomOptions } from './modules/state/types';
3
- import { CanvasRendererType, CircularLayoutType, ForceDirectedLayoutType, FreeLayoutType, GridLayoutType, HierarchicalLayoutType, SvgRendererType, WebGLRendererType, d3ForceLayoutType } from './modules/state/types';
4
- import { drawCircleBand } from './renderers/domrenderer/canvasrenderer/nodeDrawing';
5
- import type { StyledCaption } from './renderers/domrenderer/shared/types';
6
- import type { Node, PartialNode, PartialRelationship, Relationship } from './types/graph-element';
7
- import { CompatibilityError } from './utils/errors';
8
- import type { Point } from './utils/geometry';
9
- import type { HitTargetNode, HitTargetRelationship, HitTargets } from './utils/hittest';
10
- import { nvlResultTransformer } from './utils/jsDriverResultTransformer';
11
- import { getZoomTargetForNodePositions } from './utils/zoomFunctions';
1
+ import { Point } from "./utils/geometry.js";
2
+ import { StyledCaption } from "./renderers/domrenderer/shared/types.js";
3
+ import { Node, NodeWithClientPosition, PartialNode, PartialRelationship, Relationship } from "./types/graph-element.js";
4
+ import { ExternalCallbacks } from "./modules/ExternalCallbackHandler.js";
5
+ import { CanvasRendererType, CircularLayoutType, CircularOptions, Cluster, ClusterByFn, ClusterId, ClusteringOptions, ForceDirectedLayoutType, ForceDirectedOptions, FreeLayoutType, GridLayoutType, HierarchicalLayoutType, HierarchicalOptions, Layout, LayoutOptions, NvlOptions, NvlState, Renderer as Renderer$1, SvgRendererType, WebGLRendererType, ZoomOptions, d3ForceLayoutType } from "./modules/state/types.js";
6
+ import { drawCircleBand } from "./renderers/domrenderer/canvasrenderer/nodeDrawing.js";
7
+ import { CompatibilityError } from "./utils/errors.js";
8
+ import { HitTargetCluster, HitTargetNode, HitTargetRelationship, HitTargets, HitTestTarget } from "./utils/hitTest.js";
9
+ import { nvlResultTransformer } from "./utils/jsDriverResultTransformer.js";
10
+ import { getZoomTargetForNodePositions } from "./utils/zoomFunctions.js";
12
11
  /**
13
12
  * Extends the MouseEvent interface with the {@link HitTargets} property.
14
13
  * The result of a {@link NVL.getHits} call.
15
14
  */
16
15
  interface NvlMouseEvent extends MouseEvent {
17
- /** The graph elements that have been hit by the pointer event. */
18
- nvlTargets: HitTargets;
16
+ /** The graph elements that have been hit by the pointer event. */
17
+ nvlTargets: HitTargets;
19
18
  }
20
19
  /**
21
20
  * Class for a NVL instance.
@@ -37,374 +36,373 @@ interface NvlMouseEvent extends MouseEvent {
37
36
  * ```
38
37
  */
39
38
  declare class NVL {
40
- #private;
41
- /**
42
- * Creates a new NVL instance.
43
- * @param frame - The DOM element to display the graph in.
44
- * @param nvlNodes - An array of {@link Node nodes}.
45
- * @param nvlRels - An array of {@link Relationship relationships}.
46
- * @param options - The {@link NvlOptions options} for the NVL instance.
47
- * @param callbacks - Callbacks triggered on NVL events.
48
- */
49
- constructor(frame: HTMLElement, nvlNodes?: Node[], nvlRels?: Relationship[], options?: NvlOptions, callbacks?: ExternalCallbacks);
50
- /**
51
- * Restarts the NVL instance.
52
- * @param options - New {@link NvlOptions} for the NVL instance.
53
- * @param retainPositions - Whether or not to retain the current node positions.
54
- * New options will be merged with current options
55
- */
56
- restart(options?: NvlOptions, retainPositions?: boolean): void;
57
- /**
58
- * Adds nodes and relationships to NVL and updates existing nodes and relationships.
59
- * @param nodes - An Array of {@link Node nodes} to be added or updated.
60
- * @param relationships - An Array of {@link Relationship relationships} to be added or updated.
61
- * To update nodes or relationships, they must have an id that matches the id of the
62
- * node or relationship to be updated.
63
- * Only the properties that are provided will be updated.
64
- * If an existing property is not provided, it will not be changed.
65
- * @example
66
- * Adding and updating nodes and relationships
67
- * ```ts
68
- * import { NVL } from '@neo4j-nvl/base'
69
- *
70
- * const nvl = new NVL(document.getElementById('frame'), [{ id: '0' }], [])
71
- *
72
- * const nodes = [
73
- * { id: '1', label: 'Node 1', color: '#e04141' },
74
- * { id: '2', label: 'Node 2', color: '#e09c41' }
75
- * ]
76
- * const relationships = [
77
- * { id: '12', from: '1', to: '2' }
78
- * ]
79
- * // Adds new nodes and relationships
80
- * nvl.addAndUpdateElementsInGraph(nodes, relationships)
81
- * // Updates an existing relationship
82
- * nvl.addAndUpdateElementsInGraph([], [{ id: '12', color: '#e0df41' }])
83
- * ```
84
- */
85
- addAndUpdateElementsInGraph(nodes?: Node[] | PartialNode[], relationships?: Relationship[] | PartialRelationship[]): void;
86
- /**
87
- * Gets the currently selected nodes.
88
- * @returns An array of all currently selected {@link Node nodes} and their positions.
89
- */
90
- getSelectedNodes(): (Node & Point)[];
91
- /**
92
- * Gets the currently selected relationships.
93
- * @returns An array of all currently selected {@link Relationship relationships}.
94
- */
95
- getSelectedRelationships(): Relationship[];
96
- /**
97
- * Updates relationships in the current scene with the provided array of nodes and relationships.
98
- * @param nodes - The updated {@link Node nodes}.
99
- * @param relationships - The updated {@link Relationship relationships}.
100
- * Ignores any nodes or relationships that do not exist in the current scene.
101
- * To update nodes or relationships, they must have an id that matches the id of the
102
- * node or relationship to be updated.
103
- * Only the properties that are provided will be updated.
104
- * If an existing property is not provided, it will not be changed.
105
- * @example
106
- * Updating nodes and relationships
107
- * ```ts
108
- * import { NVL } from '@neo4j-nvl/base'
109
- *
110
- * const nodes = [
111
- * { id: '1', label: 'Node 1', color: '#e04141' },
112
- * { id: '2', label: 'Node 2', color: '#e09c41' }
113
- * ]
114
- * const relationships = [
115
- * { id: '12', from: '1', to: '2' }
116
- * ]
117
- * const nvl = new NVL(document.getElementById('frame'), nodes, relationships)
118
- * // Updates an existing node and relationship
119
- * nvl.updateElementsInGraph([{ id: '1', selected: true }], [{ id: '12', color: '#e0df41' }])
120
- * ```
121
- */
122
- updateElementsInGraph(nodes: Node[] | PartialNode[], relationships: Relationship[] | PartialRelationship[]): void;
123
- /**
124
- * Adds nodes and relationships in the current scene.
125
- * @param nodes - The nodes to be added.
126
- * @param relationships - The relationships to be added.
127
- */
128
- addElementsToGraph(nodes: Node[], relationships: Relationship[]): void;
129
- /**
130
- * Removes the specified nodes from the current scene.
131
- * @param nodeIds - The node ids to be removed.
132
- * Adjacent relationships will also be removed.
133
- */
134
- removeNodesWithIds(nodeIds: string[]): void;
135
- /**
136
- * Removes the specified relationships from the current scene.
137
- * @param relationshipIds - The relationship ids to be removed.
138
- */
139
- removeRelationshipsWithIds(relationshipIds: string[]): void;
140
- /**
141
- * Returns all nodes that is currently stored in the visualisation.
142
- * `x` and `y` are client/screen coordinates relative to the canvas.
143
- * @returns The array of {@link Node nodes}.
144
- *
145
- * @note In the next major release, `x` and `y` become layout coordinates and
146
- * screen coordinates move to a `clientPosition` field.
147
- */
148
- getNodes(): Node[];
149
- /**
150
- * Returns the relationships that are currently in the visualization.
151
- * @returns An array of the {@link Relationship relationships} in the visualization.
152
- */
153
- getRelationships(): Relationship[];
154
- /**
155
- * Returns the node data that is currently stored in the visualisation for a given id.
156
- * @param id - The id of the {@link Node node} that should be returned.
157
- * @returns The {@link Node node} or undefined if there is no node with the given id.
158
- */
159
- getNodeById(id: string): Node;
160
- /**
161
- * Returns the relationship data that is currently stored in the visualisation for a given id.
162
- * @param id - The id of the {@link Relationship relationship} that should be returned.
163
- * @returns The {@link Relationship relationship} or undefined if there is no relationship with the given id.
164
- */
165
- getRelationshipById(id: string): Relationship;
166
- /**
167
- * Returns the node position that is currently stored in the visualisation for a given id.
168
- * @param id - The id of the node position that should be returned.
169
- * @returns The position information for the given id, or undefined if there is no such {@link Node node}.
170
- * or the layout has not yet run with that node.
171
- */
172
- getPositionById(id: string): Node;
173
- /**
174
- * Returns the current options.
175
- * @returns The current options.
176
- */
177
- getCurrentOptions(): NvlOptions;
178
- /** Removes the graph visualization from the DOM and cleans up everything. */
179
- destroy(): void;
180
- /**
181
- * De-selects all nodes and relationships.
182
- */
183
- deselectAll(): void;
184
- /**
185
- * Updates pan and zoom fit the specified nodes in the viewport.
186
- * @param nodeIds - The ids of the nodes to fit on the screen.
187
- * @param zoomOptions - Specific options on how to transition the zoom.
188
- *
189
- * @remarks
190
- * If the zoom level required to fit the provided nodes is outside of the range provided by the
191
- * {@link NvlOptions.minZoom minZoom} and {@link NvlOptions.maxZoom maxZoom} options, and the
192
- * {@link NvlOptions.allowDynamicMinZoom allowDynamicMinZoom} option is set to `false`,
193
- * the zoom level will be set to the closest valid zoom level,
194
- * even if the given nodes do not fit the viewport yet.
195
- */
196
- fit(nodeIds: string[], zoomOptions?: NvlState['zoomOptions']): void;
197
- /**
198
- * Resets the zoom of the viewport back to the default zoom level of 0.75.
199
- */
200
- resetZoom(): void;
201
- /**
202
- * Switches between rendering methods
203
- * @param renderer - which rendering method to use
204
- */
205
- setRenderer(renderer: string): void;
206
- /**
207
- * Restarts NVL with or without WebGL support.
208
- * @param disabled - Whether or not WebGL should be disabled.
209
- * @experimental
210
- */
211
- setDisableWebGL(disabled?: boolean): void;
212
- /**
213
- * Pins the specified node so it is not affected by layout forces.
214
- * @param nodeId - The id of the node to be pinned.
215
- */
216
- pinNode(nodeId: string): void;
217
- /**
218
- * Un-pins the specified nodes so it is affected by layout forces again.
219
- * @param nodeIds The ids of the nodes to be un-pinned.
220
- */
221
- unPinNode(nodeIds: string[]): void;
222
- /**
223
- * Changes the layout type.
224
- * @param layout - The {@link Layout} type.
225
- */
226
- setLayout(layout: Layout): void;
227
- /**
228
- * Updates the configuration of the current layout.
229
- * @param options - The {@link LayoutOptions} configuration.
230
- */
231
- setLayoutOptions(options: LayoutOptions): void;
232
- /**
233
- * Returns the nodes that are currently in the visualization.
234
- * The `rels` property of the returned object is always empty.
235
- * @returns An object containing the nodes and relationships in the visualization.
236
- */
237
- getNodesOnScreen(): {
238
- /** The nodes in the visualization. */
239
- nodes: Node[];
240
- /** The relationships in the visualization. */
241
- rels: Relationship[];
242
- };
243
- /**
244
- * Fetches and returns the current positions of all nodes as an array of coordinates.
245
- * @returns An array of {@link Node node} positions.
246
- */
247
- getNodePositions(): (Node & Point)[];
248
- /**
249
- * Sets the node positions based on data provided.
250
- * @param data - The positions that the nodes should be set to.
251
- * @param updateLayout - Whether or not the current layout algorithm
252
- * should update the graph after setting the node positions.
253
- *
254
- * @remarks
255
- * For node positions to be unaffected by layout algorithms, use the 'free' layout type
256
- * or use {@link pinNode} to pin the nodes that should remain still.
257
- * False by default.
258
- */
259
- setNodePositions(data: Node[], updateLayout?: boolean): void;
260
- /**
261
- * Checks and returns whether the current layout is still in flux.
262
- * @returns Whether or not the layout is moving.
263
- */
264
- isLayoutMoving(): boolean;
265
- /**
266
- * Saves the current view of the graph visualization canvas as a png to the client.
267
- * @param {{ filename: string, backgroundColor: string }} options The filename and background color of the png.
268
- * @param options.filename - The filename of the png file.
269
- * @param options.backgroundColor - The background color of the png file.
270
- * The size of the png file will be the size of the canvas in the DOM.
271
- */
272
- saveToFile(options?: {
273
- filename?: string;
274
- backgroundColor?: string;
275
- }): void;
276
- /**
277
- * Saves the entire graph visualization as an SVG file to the client.
278
- * @param options - Options for the SVG export
279
- * @param options.filename - The filename of the SVG file.
280
- * @param options.backgroundColor - The background color of the SVG file.
281
- * @experimental
282
- */
283
- saveToSvg(options?: {
284
- filename?: string;
285
- backgroundColor?: string;
286
- }): void;
287
- /**
288
- * Returns the current view of the graph visualization canvas as a data URL.
289
- * @param options - The options for the image.
290
- * @param options.backgroundColor - The background color of the data URL.
291
- * @returns A data URL of the current view of the graph visualization canvas.
292
- */
293
- getImageDataUrl(options?: {
294
- backgroundColor?: string;
295
- }): string;
296
- /**
297
- * Returns the entire graph visualization as an SVG data URL.
298
- * @param options - Options for the SVG export
299
- * @param options.backgroundColor - The background color of the SVG (defaults to transparent).
300
- * @returns A Promise resolving to a data URL string representing the graph as SVG (data:image/svg+xml;...)
301
- * @experimental
302
- *
303
- * @example
304
- * ```typescript
305
- * const svgDataUrl = await nvl.getSvgDataUrl({ backgroundColor: '#ffffff' })
306
- * const img = document.createElement('img')
307
- * img.src = svgDataUrl
308
- * img.alt = 'Graph Visualization'
309
- * document.body.appendChild(img)
310
- * ```
311
- */
312
- getSvgDataUrl(options?: {
313
- backgroundColor?: string;
314
- }): Promise<string>;
315
- /**
316
- * Saves the entire graph visualization canvas as a png to the client.
317
- * @param {{ filename: string, backgroundColor: string }} options The filename and background color of the png.
318
- * @param options.filename - The filename of the png file.
319
- * @param options.backgroundColor - The background color of the png file.
320
- * The size of the png file will be as large as the entire graph at the default zoom level.
321
- * Can result in a very large file.
322
- */
323
- saveFullGraphToLargeFile(options?: {
324
- filename?: string;
325
- backgroundColor?: string;
326
- }): void;
327
- getZoomLimits(): {
328
- minZoom: number;
329
- maxZoom: number;
330
- };
331
- /**
332
- * Sets the zoom of the viewport to a specific value.
333
- * @param zoomValue - The desired zoom level.
334
- * @remarks
335
- *
336
- * When updating both the zoom level and pan coordinates,
337
- * use {@link setZoomAndPan} instead of calling {@link setZoom} and {@link setPan}
338
- * separately to avoid jittering.
339
- *
340
- * If the zoom level is outside of the range provided by the
341
- * {@link NvlOptions.minZoom} and {@link NvlOptions.maxZoom} options,
342
- * the zoom level will be set to the closest valid zoom level.
343
- * If {@link NvlOptions.allowDynamicMinZoom} is set to true,
344
- * the {@link NvlOptions.minZoom} option will be ignored of the current graph does not fit the viewport.
345
- */
346
- setZoom(zoomValue: number): void;
347
- /**
348
- * Sets the zoom of the viewport to a specific value.
349
- * @param panX - The desired panX value.
350
- * @param panY - The desired panY value.
351
- * @remarks When updating both the zoom level and pan coordinates,
352
- * use {@link setZoomAndPan} instead of calling {@link setZoom} and {@link setPan} separately to avoid jittering.
353
- */
354
- setPan(panX: number, panY: number): void;
355
- /**
356
- * Sets the zoom and pan of the viewport to specific values.
357
- * @param zoom - The desired zoom level.
358
- * @param panX - The desired panX value.
359
- * @param panY - The desired panY value.
360
- * @remarks When only updating zoom level or pan coordinates, use {@link setZoom} or {@link setPan} instead.
361
- *
362
- * If the zoom level is outside of the range provided by the
363
- * {@link NvlOptions.minZoom} and {@link NvlOptions.maxZoom} options,
364
- * the zoom level will be set to the closest valid zoom level.
365
- * If {@link NvlOptions.allowDynamicMinZoom} is set to true,
366
- * the {@link NvlOptions.minZoom} option will be ignored of the current graph does not fit the viewport.
367
- */
368
- setZoomAndPan(zoom: number, panX: number, panY: number): void;
369
- /**
370
- * Get the current zoom level of the viewport.
371
- * @returns The current zoom level.
372
- */
373
- getScale(): number;
374
- /**
375
- * Returns the current pan of the viewport.
376
- * @returns The current pan of the viewport.
377
- */
378
- getPan(): Point;
379
- /**
380
- * Gets the nodes and relationships that have been hit by a pointer event.
381
- * @param evt - The mouse event.
382
- * @param targets - The graph elements to check for hits. Defaults to ['node', 'relationship'].
383
- * @param hitOptions - Options for the hit test.
384
- * @returns A {@link NvlMouseEvent} with the {@link HitTargets} property
385
- * containing the nodes and relationships that have been hit by the pointer event.
386
- *
387
- * @example
388
- * ```js
389
- * const container = document.getElementById('frame')
390
- * const nvl = new NVL(container, [{ id: '0' }], [])
391
- *
392
- * // Get the nodes and relationships that have been hit by a pointer event.
393
- * container?.addEventListener('click', (evt) => {
394
- * const { nvlTargets } = nvl.getHits(evt)
395
- * console.log('clicked elements:', nvlTargets)
396
- * })
397
- * ```
398
- */
399
- getHits(evt: MouseEvent, targets?: ('node' | 'relationship')[], hitOptions?: {
400
- hitNodeMarginWidth: number;
401
- }): NvlMouseEvent;
402
- /**
403
- * Provides the container DOM element the graph is rendered in.
404
- * @returns The container element of the NVL instance.
405
- */
406
- getContainer(): HTMLElement;
407
- private checkWebGLCompatibility;
39
+ #private;
40
+ /**
41
+ * Creates a new NVL instance.
42
+ * @param frame - The DOM element to display the graph in.
43
+ * @param nvlNodes - An array of {@link Node nodes}.
44
+ * @param nvlRels - An array of {@link Relationship relationships}.
45
+ * @param options - The {@link NvlOptions options} for the NVL instance.
46
+ * @param callbacks - Callbacks triggered on NVL events.
47
+ */
48
+ constructor(frame: HTMLElement, nvlNodes?: Node[], nvlRels?: Relationship[], options?: NvlOptions, callbacks?: ExternalCallbacks);
49
+ /**
50
+ * Restarts the NVL instance.
51
+ * @param options - New {@link NvlOptions} for the NVL instance.
52
+ * @param retainPositions - Whether or not to retain the current node positions.
53
+ * New options will be merged with current options
54
+ */
55
+ restart(options?: NvlOptions, retainPositions?: boolean): void;
56
+ /**
57
+ * Adds nodes and relationships to NVL and updates existing nodes and relationships.
58
+ * @param nodes - An Array of {@link Node nodes} to be added or updated.
59
+ * @param relationships - An Array of {@link Relationship relationships} to be added or updated.
60
+ * To update nodes or relationships, they must have an id that matches the id of the
61
+ * node or relationship to be updated.
62
+ * Only the properties that are provided will be updated.
63
+ * If an existing property is not provided, it will not be changed.
64
+ * @example
65
+ * Adding and updating nodes and relationships
66
+ * ```ts
67
+ * import { NVL } from '@neo4j-nvl/base'
68
+ *
69
+ * const nvl = new NVL(document.getElementById('frame'), [{ id: '0' }], [])
70
+ *
71
+ * const nodes = [
72
+ * { id: '1', label: 'Node 1', color: '#e04141' },
73
+ * { id: '2', label: 'Node 2', color: '#e09c41' }
74
+ * ]
75
+ * const relationships = [
76
+ * { id: '12', from: '1', to: '2' }
77
+ * ]
78
+ * // Adds new nodes and relationships
79
+ * nvl.addAndUpdateElementsInGraph(nodes, relationships)
80
+ * // Updates an existing relationship
81
+ * nvl.addAndUpdateElementsInGraph([], [{ id: '12', color: '#e0df41' }])
82
+ * ```
83
+ */
84
+ addAndUpdateElementsInGraph(nodes?: Node[] | PartialNode[], relationships?: Relationship[] | PartialRelationship[]): void;
85
+ /**
86
+ * Gets the currently selected nodes.
87
+ * @returns An array of all currently selected {@link Node nodes} and their positions.
88
+ */
89
+ getSelectedNodes(): (Node & Point)[];
90
+ /**
91
+ * Gets the currently selected relationships.
92
+ * @returns An array of all currently selected {@link Relationship relationships}.
93
+ */
94
+ getSelectedRelationships(): Relationship[];
95
+ /**
96
+ * Updates relationships in the current scene with the provided array of nodes and relationships.
97
+ * @param nodes - The updated {@link Node nodes}.
98
+ * @param relationships - The updated {@link Relationship relationships}.
99
+ * Ignores any nodes or relationships that do not exist in the current scene.
100
+ * To update nodes or relationships, they must have an id that matches the id of the
101
+ * node or relationship to be updated.
102
+ * Only the properties that are provided will be updated.
103
+ * If an existing property is not provided, it will not be changed.
104
+ * @example
105
+ * Updating nodes and relationships
106
+ * ```ts
107
+ * import { NVL } from '@neo4j-nvl/base'
108
+ *
109
+ * const nodes = [
110
+ * { id: '1', label: 'Node 1', color: '#e04141' },
111
+ * { id: '2', label: 'Node 2', color: '#e09c41' }
112
+ * ]
113
+ * const relationships = [
114
+ * { id: '12', from: '1', to: '2' }
115
+ * ]
116
+ * const nvl = new NVL(document.getElementById('frame'), nodes, relationships)
117
+ * // Updates an existing node and relationship
118
+ * nvl.updateElementsInGraph([{ id: '1', selected: true }], [{ id: '12', color: '#e0df41' }])
119
+ * ```
120
+ */
121
+ updateElementsInGraph(nodes: Node[] | PartialNode[], relationships: Relationship[] | PartialRelationship[]): void;
122
+ /**
123
+ * Adds nodes and relationships in the current scene.
124
+ * @param nodes - The nodes to be added.
125
+ * @param relationships - The relationships to be added.
126
+ */
127
+ addElementsToGraph(nodes: Node[], relationships: Relationship[]): void;
128
+ /**
129
+ * Removes the specified nodes from the current scene.
130
+ * @param nodeIds - The node ids to be removed.
131
+ * Adjacent relationships will also be removed.
132
+ */
133
+ removeNodesWithIds(nodeIds: string[]): void;
134
+ /**
135
+ * Removes the specified relationships from the current scene.
136
+ * @param relationshipIds - The relationship ids to be removed.
137
+ */
138
+ removeRelationshipsWithIds(relationshipIds: string[]): void;
139
+ /**
140
+ * Returns all nodes that is currently stored in the visualisation.
141
+ * Each node includes layout coordinates (`x`, `y`) and a `clientPosition` in screen space.
142
+ * @returns The array of {@link NodeWithClientPosition nodes}.
143
+ */
144
+ getNodes(): NodeWithClientPosition[];
145
+ /**
146
+ * Returns the relationships that are currently in the visualization.
147
+ * @returns An array of the {@link Relationship relationships} in the visualization.
148
+ */
149
+ getRelationships(): Relationship[];
150
+ /**
151
+ * Returns the node data that is currently stored in the visualisation for a given id.
152
+ * @param id - The id of the {@link Node node} that should be returned.
153
+ * @returns The {@link Node node} or undefined if there is no node with the given id.
154
+ */
155
+ getNodeById(id: string): Node;
156
+ /**
157
+ * Returns the relationship data that is currently stored in the visualisation for a given id.
158
+ * @param id - The id of the {@link Relationship relationship} that should be returned.
159
+ * @returns The {@link Relationship relationship} or undefined if there is no relationship with the given id.
160
+ */
161
+ getRelationshipById(id: string): Relationship;
162
+ /**
163
+ * Returns the node position that is currently stored in the visualisation for a given id.
164
+ * @param id - The id of the node position that should be returned.
165
+ * @returns The position information for the given id, or undefined if there is no such {@link Node node}.
166
+ * or the layout has not yet run with that node.
167
+ */
168
+ getPositionById(id: string): Node;
169
+ /**
170
+ * Returns the current options.
171
+ * @returns The current options.
172
+ */
173
+ getCurrentOptions(): NvlOptions;
174
+ /** Removes the graph visualization from the DOM and cleans up everything. */
175
+ destroy(): void;
176
+ /**
177
+ * De-selects all nodes and relationships.
178
+ */
179
+ deselectAll(): void;
180
+ /**
181
+ * Updates pan and zoom to fit the specified nodes in the viewport.
182
+ * @param nodeIds - The ids of the nodes to fit on the screen.
183
+ * @param zoomOptions - Specific options on how to transition the zoom.
184
+ *
185
+ * @remarks
186
+ * Zoom is limited by {@link ZoomOptions.minZoom} / {@link ZoomOptions.maxZoom} and the
187
+ * {@link NvlOptions.minZoom minZoom} / {@link NvlOptions.maxZoom maxZoom} /
188
+ * {@link NvlOptions.allowDynamicMinZoom allowDynamicMinZoom} options. See those for details.
189
+ */
190
+ fit(nodeIds: string[], zoomOptions?: NvlState['zoomOptions']): void;
191
+ /**
192
+ * Resets the zoom of the viewport back to the default zoom level of 0.75.
193
+ */
194
+ resetZoom(): void;
195
+ /**
196
+ * Switches between rendering methods
197
+ * @param renderer - which rendering method to use
198
+ */
199
+ setRenderer(renderer: string): void;
200
+ /**
201
+ * Restarts NVL with or without WebGL support.
202
+ * @param disabled - Whether or not WebGL should be disabled.
203
+ * @experimental
204
+ */
205
+ setDisableWebGL(disabled?: boolean): void;
206
+ /**
207
+ * Pins the specified node so it is not affected by layout forces.
208
+ * @param nodeId - The id of the node to be pinned.
209
+ */
210
+ pinNode(nodeId: string): void;
211
+ /**
212
+ * Un-pins the specified nodes so it is affected by layout forces again.
213
+ * @param nodeIds The ids of the nodes to be un-pinned.
214
+ */
215
+ unPinNode(nodeIds: string[]): void;
216
+ /**
217
+ * Changes the layout type.
218
+ * @param layout - The {@link Layout} type.
219
+ */
220
+ setLayout(layout: Layout): void;
221
+ /**
222
+ * Updates the configuration of the current layout.
223
+ * @param options - The {@link LayoutOptions} configuration.
224
+ */
225
+ setLayoutOptions(options: LayoutOptions): void;
226
+ /**
227
+ * Returns the nodes that are currently in the visualization.
228
+ * The `rels` property of the returned object is always empty.
229
+ * @returns An object containing the nodes and relationships in the visualization.
230
+ */
231
+ getNodesOnScreen(): {
232
+ /** The nodes in the visualization. */
233
+ nodes: Node[];
234
+ /** The relationships in the visualization. */
235
+ rels: Relationship[];
236
+ };
237
+ /**
238
+ * Fetches and returns the current positions of all nodes as an array of coordinates.
239
+ * @returns An array of {@link Node node} positions.
240
+ */
241
+ getNodePositions(): (Node & Point)[];
242
+ /**
243
+ * Sets the node positions based on data provided.
244
+ * @param data - The positions that the nodes should be set to.
245
+ * @param updateLayout - Whether or not the current layout algorithm
246
+ * should update the graph after setting the node positions.
247
+ *
248
+ * @remarks
249
+ * For node positions to be unaffected by layout algorithms, use the 'free' layout type
250
+ * or use {@link pinNode} to pin the nodes that should remain still.
251
+ * False by default.
252
+ */
253
+ setNodePositions(data: Node[], updateLayout?: boolean): void;
254
+ /**
255
+ * Checks and returns whether the current layout is still in flux.
256
+ * @returns Whether or not the layout is moving.
257
+ */
258
+ isLayoutMoving(): boolean;
259
+ /**
260
+ * Saves the current view of the graph visualization canvas as a png to the client.
261
+ * @param {{ filename: string, backgroundColor: string }} options The filename and background color of the png.
262
+ * @param options.filename - The filename of the png file.
263
+ * @param options.backgroundColor - The background color of the png file.
264
+ * The size of the png file will be the size of the canvas in the DOM.
265
+ */
266
+ saveToFile(options?: {
267
+ filename?: string;
268
+ backgroundColor?: string;
269
+ }): void;
270
+ /**
271
+ * Saves the entire graph visualization as an SVG file to the client.
272
+ * @param options - Options for the SVG export
273
+ * @param options.filename - The filename of the SVG file.
274
+ * @param options.backgroundColor - The background color of the SVG file.
275
+ * @experimental
276
+ */
277
+ saveToSvg(options?: {
278
+ filename?: string;
279
+ backgroundColor?: string;
280
+ }): void;
281
+ /**
282
+ * Returns the current view of the graph visualization canvas as a data URL.
283
+ * @param options - The options for the image.
284
+ * @param options.backgroundColor - The background color of the data URL.
285
+ * @returns A data URL of the current view of the graph visualization canvas.
286
+ */
287
+ getImageDataUrl(options?: {
288
+ backgroundColor?: string;
289
+ }): string;
290
+ /**
291
+ * Returns the entire graph visualization as an SVG data URL.
292
+ * @param options - Options for the SVG export
293
+ * @param options.backgroundColor - The background color of the SVG (defaults to transparent).
294
+ * @returns A Promise resolving to a data URL string representing the graph as SVG (data:image/svg+xml;...)
295
+ * @experimental
296
+ *
297
+ * @example
298
+ * ```typescript
299
+ * import { NVL } from '@neo4j-nvl/base'
300
+ *
301
+ * const nvl = new NVL(document.getElementById('frame'), [{ id: '0' }], [])
302
+ * const renderSvg = async () => {
303
+ * const svgDataUrl = await nvl.getSvgDataUrl({ backgroundColor: '#ffffff' })
304
+ * const img = document.createElement('img')
305
+ * img.src = svgDataUrl
306
+ * document.body.appendChild(img)
307
+ * }
308
+ * ```
309
+ */
310
+ getSvgDataUrl(options?: {
311
+ backgroundColor?: string;
312
+ }): Promise<string>;
313
+ /**
314
+ * Saves the entire graph visualization canvas as a png to the client.
315
+ * @param {{ filename: string, backgroundColor: string }} options The filename and background color of the png.
316
+ * @param options.filename - The filename of the png file.
317
+ * @param options.backgroundColor - The background color of the png file.
318
+ * The size of the png file will be as large as the entire graph at the default zoom level.
319
+ * Can result in a very large file.
320
+ */
321
+ saveFullGraphToLargeFile(options?: {
322
+ filename?: string;
323
+ backgroundColor?: string;
324
+ }): void;
325
+ getZoomLimits(): {
326
+ minZoom: number;
327
+ maxZoom: number;
328
+ };
329
+ /**
330
+ * Sets the zoom of the viewport to a specific value.
331
+ * @param zoomValue - The desired zoom level.
332
+ * @remarks
333
+ *
334
+ * When updating both the zoom level and pan coordinates,
335
+ * use {@link setZoomAndPan} instead of calling {@link setZoom} and {@link setPan}
336
+ * separately to avoid jittering.
337
+ *
338
+ * If the zoom level is outside of the range provided by the
339
+ * {@link NvlOptions.minZoom} and {@link NvlOptions.maxZoom} options,
340
+ * the zoom level will be set to the closest valid zoom level.
341
+ * If {@link NvlOptions.allowDynamicMinZoom} is set to true,
342
+ * the {@link NvlOptions.minZoom} option will be ignored of the current graph does not fit the viewport.
343
+ */
344
+ setZoom(zoomValue: number): void;
345
+ /**
346
+ * Sets the zoom of the viewport to a specific value.
347
+ * @param panX - The desired panX value.
348
+ * @param panY - The desired panY value.
349
+ * @remarks When updating both the zoom level and pan coordinates,
350
+ * use {@link setZoomAndPan} instead of calling {@link setZoom} and {@link setPan} separately to avoid jittering.
351
+ */
352
+ setPan(panX: number, panY: number): void;
353
+ /**
354
+ * Sets the zoom and pan of the viewport to specific values.
355
+ * @param zoom - The desired zoom level.
356
+ * @param panX - The desired panX value.
357
+ * @param panY - The desired panY value.
358
+ * @remarks When only updating zoom level or pan coordinates, use {@link setZoom} or {@link setPan} instead.
359
+ *
360
+ * If the zoom level is outside of the range provided by the
361
+ * {@link NvlOptions.minZoom} and {@link NvlOptions.maxZoom} options,
362
+ * the zoom level will be set to the closest valid zoom level.
363
+ * If {@link NvlOptions.allowDynamicMinZoom} is set to true,
364
+ * the {@link NvlOptions.minZoom} option will be ignored of the current graph does not fit the viewport.
365
+ */
366
+ setZoomAndPan(zoom: number, panX: number, panY: number): void;
367
+ /**
368
+ * Get the current zoom level of the viewport.
369
+ * @returns The current zoom level.
370
+ */
371
+ getScale(): number;
372
+ /**
373
+ * Returns the current pan of the viewport.
374
+ * @returns The current pan of the viewport.
375
+ */
376
+ getPan(): Point;
377
+ /**
378
+ * Gets the nodes, relationships, and clusters that have been hit by a pointer event.
379
+ * @param evt - The mouse event.
380
+ * @param targets - The graph elements to check for hits. Defaults to ['node', 'relationship', 'cluster'].
381
+ * @param hitOptions - Options for the hit test.
382
+ * @returns A {@link NvlMouseEvent} with the {@link HitTargets} property
383
+ * containing the nodes, relationships, and clusters that have been hit by the pointer event.
384
+ *
385
+ * @example
386
+ * ```js
387
+ * const container = document.getElementById('frame')
388
+ * const nvl = new NVL(container, [{ id: '0' }], [])
389
+ *
390
+ * // Get the nodes and relationships that have been hit by a pointer event.
391
+ * container?.addEventListener('click', (evt) => {
392
+ * const { nvlTargets } = nvl.getHits(evt)
393
+ * console.log('clicked elements:', nvlTargets)
394
+ * })
395
+ * ```
396
+ */
397
+ getHits(evt: MouseEvent, targets?: HitTestTarget[], hitOptions?: {
398
+ hitNodeMarginWidth: number;
399
+ }): NvlMouseEvent;
400
+ /**
401
+ * Provides the container DOM element the graph is rendered in.
402
+ * @returns The container element of the NVL instance.
403
+ */
404
+ getContainer(): HTMLElement;
405
+ private checkWebGLCompatibility;
408
406
  }
409
407
  /**
410
408
  * Functions for mapping colors.
@@ -412,12 +410,10 @@ declare class NVL {
412
410
  * @hidden
413
411
  */
414
412
  declare const colorMapperFunctions: {
415
- textColorForBackground: (color: string) => string;
413
+ textColorForBackground: (color: string) => string;
416
414
  };
417
415
  /**
418
416
  * The different types of renderers available
419
417
  */
420
- type Renderer = Exclude<InternalRenderer, typeof SvgRendererType>;
421
- export default NVL;
422
- export type { NvlOptions, Renderer, Node, Relationship, PartialNode, PartialRelationship, Layout, LayoutOptions, ForceDirectedOptions, HierarchicalOptions, CircularOptions, ExternalCallbacks, HitTargets, HitTargetNode, HitTargetRelationship, Point, NvlMouseEvent, ZoomOptions, StyledCaption, WebGLRendererType, CanvasRendererType };
423
- export { NVL, colorMapperFunctions, CompatibilityError, ForceDirectedLayoutType, HierarchicalLayoutType, GridLayoutType, FreeLayoutType, d3ForceLayoutType, CircularLayoutType, drawCircleBand, nvlResultTransformer, getZoomTargetForNodePositions };
418
+ type Renderer = Exclude<Renderer$1, typeof SvgRendererType>;
419
+ export { type CanvasRendererType, CircularLayoutType, type CircularOptions, type Cluster, type ClusterByFn, type ClusterId, type ClusteringOptions, CompatibilityError, type ExternalCallbacks, ForceDirectedLayoutType, type ForceDirectedOptions, FreeLayoutType, GridLayoutType, HierarchicalLayoutType, type HierarchicalOptions, type HitTargetCluster, type HitTargetNode, type HitTargetRelationship, type HitTargets, type HitTestTarget, type Layout, type LayoutOptions, NVL, NVL as default, type Node, type NodeWithClientPosition, type NvlMouseEvent, type NvlOptions, type PartialNode, type PartialRelationship, type Point, type Relationship, type Renderer, type StyledCaption, type WebGLRendererType, type ZoomOptions, colorMapperFunctions, d3ForceLayoutType, drawCircleBand, getZoomTargetForNodePositions, nvlResultTransformer };