@neo4j-nvl/base 1.0.0-e90ba568 → 1.0.0-ea46e3c1

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 (54) hide show
  1. package/dist/base.mjs +1 -1
  2. package/dist/types/index.d.ts +21 -11
  3. package/dist/types/layouts/circularLayout/CircularLayout.d.ts +18 -0
  4. package/dist/types/layouts/forcedirectedlayout/ForceCytoLayout.d.ts +1 -1
  5. package/dist/types/layouts/forcedirectedlayout/physlayout/PhysLayout.d.ts +8 -3
  6. package/dist/types/layouts/forcedirectedlayout/physlayout/shaders/multilevel-fragment-verlet.d.ts +1 -1
  7. package/dist/types/layouts/forcedirectedlayout/physlayout/solarmerger/SolarMerger.d.ts +17 -39
  8. package/dist/types/layouts/forcedirectedlayout/physlayout/solarmerger/types.d.ts +49 -0
  9. package/dist/types/modules/NvlController.d.ts +6 -2
  10. package/dist/types/modules/state/types.d.ts +30 -9
  11. package/dist/types/modules/state/utils.d.ts +2 -2
  12. package/dist/types/renderers/domrenderer/BaseRenderer.d.ts +66 -0
  13. package/dist/types/renderers/domrenderer/canvasrenderer/CanvasRenderer.d.ts +153 -0
  14. package/dist/types/renderers/{canvasrenderer/util.d.ts → domrenderer/canvasrenderer/canvasUtils.d.ts} +2 -14
  15. package/dist/types/renderers/{canvasrenderer → domrenderer/shared}/ImageCache.d.ts +1 -1
  16. package/dist/types/renderers/{canvasrenderer → domrenderer/shared}/arrows/ArrowBundle.d.ts +2 -2
  17. package/dist/types/renderers/{canvasrenderer → domrenderer/shared}/arrows/ArrowBundler.d.ts +1 -1
  18. package/dist/types/renderers/domrenderer/shared/arrows/arrows.d.ts +148 -0
  19. package/dist/types/renderers/domrenderer/shared/nodes/nodeUtils.d.ts +28 -0
  20. package/dist/types/renderers/domrenderer/shared/nodes/nodes.d.ts +58 -0
  21. package/dist/types/renderers/{canvasrenderer → domrenderer/shared}/types.d.ts +2 -2
  22. package/dist/types/renderers/domrenderer/shared/util.d.ts +11 -0
  23. package/dist/types/renderers/{canvasrenderer → domrenderer/shared}/vectorUtils.d.ts +1 -1
  24. package/dist/types/renderers/domrenderer/shared/wordwrap.test.d.ts +1 -0
  25. package/dist/types/renderers/domrenderer/svgrenderer/SvgRenderer.d.ts +27 -0
  26. package/dist/types/renderers/domrenderer/svgrenderer/SvgRenderer.test.d.ts +1 -0
  27. package/dist/types/renderers/domrenderer/svgrenderer/svgUtils.d.ts +191 -0
  28. package/dist/types/renderers/webglrenderer/Renderer.d.ts +5 -1
  29. package/dist/types/renderers/webglrenderer/Renderer.test.d.ts +1 -0
  30. package/dist/types/types/graph-element.d.ts +1 -1
  31. package/dist/types/utils/canvasManagement.d.ts +16 -1
  32. package/dist/types/utils/circularUtils.d.ts +3 -0
  33. package/dist/types/utils/circularUtils.test.d.ts +1 -0
  34. package/dist/types/utils/constants.d.ts +3 -1
  35. package/dist/types/utils/graphObjectUtils.d.ts +2 -2
  36. package/dist/types/utils/jsDriverResultTransformer.d.ts +1 -1
  37. package/package.json +23 -23
  38. package/dist/types/modules/performance.d.ts +0 -93
  39. package/dist/types/renderers/canvasrenderer/CanvasRenderer.d.ts +0 -93
  40. package/dist/types/renderers/canvasrenderer/arrows/arrows.d.ts +0 -55
  41. package/dist/types/renderers/canvasrenderer/nodes/nodes.d.ts +0 -59
  42. /package/dist/types/{renderers/canvasrenderer/Animation.test.d.ts → layouts/d3forcelayout/circularLayout.test.d.ts} +0 -0
  43. /package/dist/types/renderers/{canvasrenderer → domrenderer/canvasrenderer}/Animation.d.ts +0 -0
  44. /package/dist/types/renderers/{canvasrenderer/CanvasRenderer.test.d.ts → domrenderer/canvasrenderer/Animation.test.d.ts} +0 -0
  45. /package/dist/types/renderers/{canvasrenderer → domrenderer/canvasrenderer}/AnimationHandler.d.ts +0 -0
  46. /package/dist/types/renderers/{canvasrenderer/ImageCache.test.d.ts → domrenderer/canvasrenderer/CanvasRenderer.test.d.ts} +0 -0
  47. /package/dist/types/renderers/{canvasrenderer/arrows/ArrowBundle.test.d.ts → domrenderer/shared/ImageCache.test.d.ts} +0 -0
  48. /package/dist/types/renderers/{canvasrenderer/arrows/ArrowBundler.test.d.ts → domrenderer/shared/arrows/ArrowBundle.test.d.ts} +0 -0
  49. /package/dist/types/renderers/{canvasrenderer/arrows/arrows.test.d.ts → domrenderer/shared/arrows/ArrowBundler.test.d.ts} +0 -0
  50. /package/dist/types/renderers/{canvasrenderer/nodes/nodes.test.d.ts → domrenderer/shared/arrows/arrows.test.d.ts} +0 -0
  51. /package/dist/types/renderers/{canvasrenderer → domrenderer/shared}/arrows/constants.d.ts +0 -0
  52. /package/dist/types/renderers/{canvasrenderer/util.test.d.ts → domrenderer/shared/nodes/nodes.test.d.ts} +0 -0
  53. /package/dist/types/renderers/{canvasrenderer/wordwrap.test.d.ts → domrenderer/shared/util.test.d.ts} +0 -0
  54. /package/dist/types/renderers/{canvasrenderer → domrenderer/shared}/wordwrap.d.ts +0 -0
@@ -1,4 +1,4 @@
1
- import type { Cache } from './types';
1
+ import type { Cache } from '../shared/types';
2
2
  declare class ImageCache {
3
3
  cache: Cache;
4
4
  constructor();
@@ -1,5 +1,5 @@
1
- import type { Relationship } from '../../../types/graph-element';
2
- import type { Point } from '../../../utils/geometry';
1
+ import type { Relationship } from '../../../../types/graph-element';
2
+ import type { Point } from '../../../../utils/geometry';
3
3
  import type { WaypointPath } from '../types';
4
4
  export interface LabelGeometry {
5
5
  position: Point;
@@ -1,4 +1,4 @@
1
- import type { Node, Relationship } from '../../../types/graph-element';
1
+ import type { Node, Relationship } from '../../../../types/graph-element';
2
2
  import type { WaypointPath } from '../types';
3
3
  import ArrowBundle from './ArrowBundle';
4
4
  export default class ArrowBundler {
@@ -0,0 +1,148 @@
1
+ import type { BorderStyle } from '../../../../modules/state/types';
2
+ import type { Node, Relationship } from '../../../../types/graph-element';
3
+ import type { Point } from '../../../../utils/geometry';
4
+ import type ArrowBundle from './ArrowBundle';
5
+ /**
6
+ * This function calculates the difference in radius between two nodes.
7
+ * @param toArrowGap - The gap between the node and the arrow on the to side.
8
+ * @param fromArrowGap - The gap between the node and the arrow on the from side.
9
+ * @returns The difference in radius between the two nodes.
10
+ * @comment can be affected for example by the label crust and selected ring
11
+ * as well as a gap between the node and the arrow on it's side.
12
+ */
13
+ export declare const getRadiusDifference: (toArrowGap: number, fromArrowGap: number) => number;
14
+ /**
15
+ * Calculates control points for self-referencing relationships
16
+ * @param {Relationship} rel - The relationship
17
+ * @param {Node} node - The node the relationship refers to
18
+ * @param {ArrowBundle} bundle - The arrow bundle
19
+ * @returns Object containing angles and coordinate points for the self-loop
20
+ */
21
+ export declare const getSelfArrowControlPoints: (rel: Relationship, node: Node, bundle: ArrowBundle) => {
22
+ angle: number;
23
+ startAngle: number;
24
+ endAngle: number;
25
+ startPoint: {
26
+ x: number;
27
+ y: number;
28
+ };
29
+ endPoint: {
30
+ x: number;
31
+ y: number;
32
+ };
33
+ apexPoint: {
34
+ x: number;
35
+ y: number;
36
+ };
37
+ control1Point: {
38
+ x: number;
39
+ y: number;
40
+ };
41
+ control2Point: {
42
+ x: number;
43
+ y: number;
44
+ };
45
+ nodeGap: number;
46
+ };
47
+ /**
48
+ * Calculates the padding for selected relationships based on border style
49
+ * @param selectedBorderRings - Array of border rings for selected state
50
+ * @returns The total selection padding
51
+ */
52
+ export declare const getSelectionPadding: (selectedBorderRings?: BorderStyle["rings"]) => number;
53
+ /**
54
+ * Calculates the position and angle for a relationship label based on the Canvas renderer's logic.
55
+ * This handles both straight lines and curves, with special logic for odd/even number of points.
56
+ *
57
+ * @param points - Array of points defining the relationship line
58
+ * @param fromNode - The source node
59
+ * @param toNode - The target node
60
+ * @param drawCurves - Whether curves are being drawn
61
+ * @param isSelected - Whether the relationship is selected
62
+ * @param captionAlign - Caption alignment ('top' or 'bottom')
63
+ * @param selectedBorderRings - Array of border rings for selected state
64
+ * @returns Object containing x, y position and angle for the label
65
+ */
66
+ export declare const getRelationshipLabelPosition: (points: Point[], fromNode: Node, toNode: Node, drawCurves: boolean, isSelected: boolean, selectedBorderRings: BorderStyle["rings"], captionAlign?: "top" | "bottom") => {
67
+ x: number;
68
+ y: number;
69
+ angle: number;
70
+ };
71
+ /**
72
+ * This function calculates the coordinates of the via point
73
+ * between two nodes. The via point is used to bend the edge
74
+ * between the two nodes.
75
+ * @param fromNode - The node the edge starts from.
76
+ * @param toNode - The node the edge ends at.
77
+ * @param fromArrowGap - The gap between the node and the arrow on the from side.
78
+ * @param toArrowGap - The gap between the node and the arrow on the to side.
79
+ * @returns The coordinates of the via point.
80
+ */
81
+ export declare const getViaCoordinates: (fromNode: Node, toNode: Node, fromArrowGap: number, toArrowGap: number, rel: Relationship, bundle: ArrowBundle) => Point;
82
+ export declare const getPointsForStraight: (rel: Relationship, bundle: ArrowBundle, fromNode: Node, toNode: Node, showLabel: boolean, curved?: boolean) => Point[];
83
+ export declare const distanceToEdge: (pos: Point, rel: Relationship, fromNode: Node, toNode: Node, bundle: ArrowBundle, showLabel: boolean, drawCurves?: boolean) => number;
84
+ /**
85
+ * Returns the bounding box of the arrow.
86
+ * @param rel - The relationship to get the bounding box for.
87
+ * @param bundle - The arrow bundle the relationship is part of.
88
+ * @param fromNode - The node the relationship is coming from.
89
+ * @param toNode - The node the relationship is going to.
90
+ * @param showLabel - Whether or not a label is shown.
91
+ * @param drawCurves - Whether or the relationship is drawn as a curve.
92
+ * @returns The bounding box of the arrow.
93
+ */
94
+ export declare const getBoundingBox: (rel: Relationship, bundle: ArrowBundle, fromNode: Node, toNode: Node, showLabel?: boolean, drawCurves?: boolean) => DOMRect | null;
95
+ /**
96
+ * Calculates the width of a relationship including selection factor and pixel ratio
97
+ * @param rel - The relationship
98
+ * @param defaultWidth - The default relationship width
99
+ * @returns The calculated relationship width
100
+ */
101
+ export declare const getRelationshipWidth: (rel: Relationship, defaultWidth: number) => number;
102
+ /**
103
+ * Adjusts relationship line points to create proper gaps at start and end.
104
+ * The Canvas renderer uses this logic:
105
+ * - End gap (arrowhead): headHeight/2 + headSelectedAdjustment
106
+ * - Start gap (tail): Only for selected relationships, uses getSelectionPadding
107
+ *
108
+ * @param points - Array of points defining the relationship line (will be modified in place)
109
+ * @param isSelected - Whether the relationship is selected
110
+ * @param headHeight - The height of the arrowhead
111
+ * @param headSelectedAdjustment - Additional adjustment for selected relationships
112
+ * @param selectedBorderRings - Array of border rings for selected state
113
+ * @returns Object with adjusted points and the tail offset applied (for label positioning)
114
+ */
115
+ export declare const adjustPointsForGaps: (points: Point[], isSelected: boolean, headHeight: number, headSelectedAdjustment: number, selectedBorderRings: BorderStyle["rings"]) => {
116
+ tailOffset: Point | null;
117
+ };
118
+ /**
119
+ * Calculates the dimensions of an arrowhead
120
+ * @param relWidth - The width of the relationship line
121
+ * @param defaultRelWidth - The default relationship width
122
+ * @param isSelected - Whether the relationship is selected
123
+ * @param selectedBorderRings - Array of border rings for selected state
124
+ * @returns Object containing headHeight, headChinHeight, headWidth, and headSelectedAdjustment
125
+ */
126
+ export declare const getArrowheadDimensions: (relWidth: number, defaultRelWidth: number, isSelected: boolean, selectedBorderRings: BorderStyle["rings"]) => {
127
+ headHeight: number;
128
+ headChinHeight: number;
129
+ headWidth: number;
130
+ headSelectedAdjustment: number;
131
+ };
132
+ /**
133
+ * Calculates the size of an overlay icon on a relationship
134
+ * @param iconSizeFactor - The size factor from the overlay icon configuration
135
+ * @returns The calculated overlay icon size
136
+ */
137
+ export declare const getOverlayIconSize: (iconSizeFactor: number) => number;
138
+ /**
139
+ * Calculates the alignment offsets for an overlay icon on a relationship
140
+ * @param position - The position array [x, y] from overlay icon configuration
141
+ * @param width - The available width for the icon
142
+ * @param height - The height of the icon
143
+ * @returns Object with widthAlign and heightAlign offsets
144
+ */
145
+ export declare const getOverlayIconAlignment: (position: [number, number], width: number, height: number) => {
146
+ widthAlign: number;
147
+ heightAlign: number;
148
+ };
@@ -0,0 +1,28 @@
1
+ import type { Node } from '../../../../types/graph-element';
2
+ /**
3
+ * Returns the caption font size that should be used
4
+ * for the given info level and node diameter.
5
+ * @param infoLevel {number} - The info level.
6
+ * @param nodeRadius {number} - The radius of the node.
7
+ * @param captionSize {number} - The size of the caption.
8
+ * @returns {number} - The font size.
9
+ */
10
+ export declare const infoLevelToFontSize: (infoLevel: number, nodeRadius?: number, captionSize?: number, hasIcon?: boolean) => number;
11
+ /**
12
+ * Prepares node caption data for rendering (works for both Canvas and SVG)
13
+ * @param node - The node to prepare caption data for
14
+ * @param zoomLevel - Current zoom level
15
+ * @param ctx - Canvas context for text measurement (optional for SVG, will create one if not provided)
16
+ * @returns Caption rendering data including lines, styles, positioning, and font info
17
+ */
18
+ export declare function prepareNodeCaptionData(node: Node, zoomLevel: number, ctx?: CanvasRenderingContext2D): {
19
+ lines: any[];
20
+ stylesPerChar: string[][];
21
+ fullCaption: string;
22
+ fontSize: number;
23
+ fontFace: string;
24
+ fontColor: string;
25
+ yPos: number;
26
+ maxNoLines: number;
27
+ hasContent: boolean;
28
+ };
@@ -0,0 +1,58 @@
1
+ import type { Node } from '../../../../types/graph-element';
2
+ /**
3
+ * Returns the bounding box of a node with the given x, y, and size properties.
4
+ * If no size is given, the default size is used.
5
+ * @param Node - The node to get the bounding box for.
6
+ * @returns The bounding box of the node.
7
+ */
8
+ export declare const getBoundingBox: ({ x, y, size }: Node) => DOMRect;
9
+ /**
10
+ * Calculates the size of a node icon based on node properties
11
+ * @param mainFaceRadius - The radius of the node's main face (already adjusted for pixel ratio)
12
+ * @param hasCaption - Whether the node has a caption
13
+ * @param iconInfoLevel - The icon info level (determines size scaling)
14
+ * @param nodeInfoLevel - The node info level (determines whether icon should show with text)
15
+ * @returns The calculated icon size
16
+ */
17
+ export declare const getNodeIconSize: (mainFaceRadius: number, hasCaption: boolean, iconInfoLevel: number, nodeInfoLevel: number) => number;
18
+ /**
19
+ * Calculates the position of a node icon
20
+ * @param iconSize - The size of the icon
21
+ * @param hasCaption - Whether the node has a caption
22
+ * @param captionAlign - The caption alignment ('center', 'bottom', or 'top')
23
+ * @param iconInfoLevel - The icon info level
24
+ * @param nodeInfoLevel - The node info level
25
+ * @returns Object with iconXPos and iconYPos
26
+ */
27
+ export declare const getNodeIconPosition: (iconSize: number, hasCaption: boolean, captionAlign: string, iconInfoLevel: number, nodeInfoLevel: number) => {
28
+ iconXPos: number;
29
+ iconYPos: number;
30
+ };
31
+ /**
32
+ * Calculates the size of a node overlay icon
33
+ * @param mainFaceDiameter - The diameter of the node's main face (already adjusted for pixel ratio)
34
+ * @param overlayIconSizeFactor - The size factor from the overlay icon configuration
35
+ * @returns The calculated overlay icon size
36
+ */
37
+ export declare const getNodeOverlayIconSize: (mainFaceDiameter: number, overlayIconSizeFactor: number) => number;
38
+ /**
39
+ * Calculates the position of a node overlay icon
40
+ * @param iconSize - The size of the overlay icon
41
+ * @param mainFaceRadius - The radius of the node's main face
42
+ * @param position - The position array [x, y] from overlay icon configuration
43
+ * @returns Object with iconXPos and iconYPos
44
+ */
45
+ export declare const getNodeOverlayIconPosition: (iconSize: number, mainFaceRadius: number, position: [number, number]) => {
46
+ iconXPos: number;
47
+ iconYPos: number;
48
+ };
49
+ /**
50
+ * Calculates the rendered radius of a node including pixel ratio
51
+ * @param node - The node object with optional size property
52
+ * @param pixelRatio - Device pixel ratio
53
+ * @param defaultNodeSize - Default size to use if node.size is undefined
54
+ * @returns The radius in pixels
55
+ */
56
+ export declare const getNodeRadius: (node: {
57
+ size?: number;
58
+ }, pixelRatio: number, defaultNodeSize: number) => number;
@@ -1,5 +1,5 @@
1
- import type { Node, Relationship } from '../../types/graph-element';
2
- import type { Point } from '../../utils/geometry';
1
+ import type { Node, Relationship } from '../../../types/graph-element';
2
+ import type { Point } from '../../../utils/geometry';
3
3
  export type TextSegment = {
4
4
  hasEllipsisChar?: boolean;
5
5
  hasHyphenChar?: boolean;
@@ -0,0 +1,11 @@
1
+ export declare const fontThresholds: [number, number][];
2
+ /**
3
+ * This function takes color in hex format or rgb() or rgba() format and overrides the opacity. Returns rgba() string.
4
+ * @param color - * @param opacity - * @returns rgba() string with the given opacity.
5
+ */
6
+ export declare const overrideOpacity: (color: string, opacity: number) => string;
7
+ export declare function getIndividualInfoLevels(r: number, zoomLevel: number): {
8
+ nodeInfoLevel: number;
9
+ fontInfoLevel: number;
10
+ iconInfoLevel: number;
11
+ };
@@ -1,4 +1,4 @@
1
- import type { Point } from '../../utils/geometry';
1
+ import type { Point } from '../../../utils/geometry';
2
2
  export declare const add: (v1: Point, v2: Point) => {
3
3
  x: number;
4
4
  y: number;
@@ -0,0 +1,27 @@
1
+ import type { NvlState } from '../../../modules/state/types';
2
+ import type { Node } from '../../../types/graph-element';
3
+ import BaseRenderer from '../BaseRenderer';
4
+ export default class SvgRenderer extends BaseRenderer {
5
+ private svg;
6
+ private measurementContext;
7
+ constructor(svg: SVGSVGElement, state: NvlState, { relationshipThreshold }?: {
8
+ relationshipThreshold?: number;
9
+ });
10
+ needsToRun(): boolean;
11
+ render(positionArray: Node[], positionBoundaries?: {
12
+ centerX: number;
13
+ centerY: number;
14
+ nodesWidth: number;
15
+ nodesHeight: number;
16
+ }, options?: {
17
+ svg?: SVGSVGElement;
18
+ backgroundColor?: string;
19
+ showCaptions?: boolean;
20
+ }): void;
21
+ private getRelationshipsToRenderSvg;
22
+ private getNodesToRenderSvg;
23
+ private renderNodes;
24
+ private renderRelationships;
25
+ private getSvgTransform;
26
+ destroy(): void;
27
+ }
@@ -0,0 +1,191 @@
1
+ import type { Point } from '../../../utils/geometry';
2
+ /**
3
+ * Applies text styles to an SVG tspan element based on a style string
4
+ * @param {SVGTSpanElement} tspanElem - The SVG tspan element to style
5
+ * @param {string} styleStr - Comma-separated style string (e.g., "bold,italic")
6
+ */
7
+ export declare const applySvgTextStyles: (tspanElem: SVGTSpanElement, styleStr: string) => void;
8
+ /**
9
+ * Builds an SVG path string for a self-referencing loop using quadratic curves
10
+ * @param startPoint - The start point of the loop
11
+ * @param endPoint - The end point of the loop
12
+ * @param apexPoint - The apex (top) point of the loop
13
+ * @param control1Point - The first control point
14
+ * @param control2Point - The second control point
15
+ * @returns SVG path string
16
+ */
17
+ export declare const buildSelfLoopPath: (startPoint: Point, endPoint: Point, apexPoint: Point, control1Point: Point, control2Point: Point) => string;
18
+ /**
19
+ * Builds an SVG path string for a polyline with quadratic curves between points
20
+ * @param points - Array of points along the path
21
+ * @returns SVG path string
22
+ */
23
+ export declare const buildQuadraticCurvePath: (points: Point[]) => string;
24
+ /**
25
+ * Converts an array of points to an SVG polyline points attribute string
26
+ * @param points - Array of points
27
+ * @returns String suitable for SVG polyline points attribute
28
+ */
29
+ export declare const pointsToPolylineString: (points: Point[]) => string;
30
+ /**
31
+ * Creates an SVG arrowhead polygon element with selection rings
32
+ * @param arrowHead - Arrowhead geometry (tip, base1, base2 points)
33
+ * @param fillColor - Fill color for the arrowhead
34
+ * @param rings - Selection rings configuration
35
+ * @param pixelRatio - Device pixel ratio
36
+ * @returns Array of SVG polygon elements [rings..., arrowhead]
37
+ */
38
+ export declare const createArrowHeadWithRings: (arrowHead: {
39
+ tip: Point;
40
+ base1: Point;
41
+ base2: Point;
42
+ }, fillColor: string, rings: Array<{
43
+ color: string;
44
+ width: number;
45
+ }>, pixelRatio: number) => SVGPolygonElement[];
46
+ /**
47
+ * Creates an SVG text element with styled spans
48
+ * @param options - Configuration options for the text element
49
+ * @param options.x - X coordinate
50
+ * @param options.y - Y coordinate
51
+ * @param options.fontSize - Font size
52
+ * @param options.fontFace - Font family
53
+ * @param options.fontColor - Text color
54
+ * @param options.textAnchor - Text anchor ('start', 'middle', 'end')
55
+ * @param options.dominantBaseline - Dominant baseline ('auto', 'middle', etc.)
56
+ * @param options.lineSpans - Array of text spans with styles
57
+ * @param options.transform - Optional transform attribute
58
+ * @param options.fontWeight - Optional font weight
59
+ * @returns SVG text element with tspan children
60
+ */
61
+ export declare const createStyledTextElement: (options: {
62
+ x: number;
63
+ y: number;
64
+ fontSize: number;
65
+ fontFace: string;
66
+ fontColor: string;
67
+ textAnchor: string;
68
+ dominantBaseline: string;
69
+ lineSpans: Array<{
70
+ text: string;
71
+ style: string;
72
+ }>;
73
+ transform?: string;
74
+ fontWeight?: string;
75
+ }) => SVGTextElement;
76
+ /**
77
+ * Creates an SVG path element with selection rings
78
+ * @param pathData - SVG path d attribute
79
+ * @param strokeColor - Stroke color for the path
80
+ * @param strokeWidth - Stroke width for the path
81
+ * @param rings - Selection rings configuration
82
+ * @param pixelRatio - Device pixel ratio
83
+ * @returns Array of SVG path elements [rings..., path]
84
+ */
85
+ export declare const createPathWithRings: (pathData: string, strokeColor: string, strokeWidth: number, rings: Array<{
86
+ color: string;
87
+ width: number;
88
+ }>, pixelRatio: number) => SVGPathElement[];
89
+ /**
90
+ * Creates an SVG polyline element with selection rings
91
+ * @param points - Polyline points string
92
+ * @param strokeColor - Stroke color for the polyline
93
+ * @param strokeWidth - Stroke width for the polyline
94
+ * @param rings - Selection rings configuration
95
+ * @param pixelRatio - Device pixel ratio
96
+ * @returns Array of SVG polyline elements [rings..., polyline]
97
+ */
98
+ export declare const createPolylineWithRings: (points: string, strokeColor: string, strokeWidth: number, rings: Array<{
99
+ color: string;
100
+ width: number;
101
+ }>, pixelRatio: number) => SVGPolylineElement[];
102
+ /**
103
+ * Calculates arrowhead geometry for relationship endpoints (SVG-specific)
104
+ * @param point1 - First point (direction from)
105
+ * @param point2 - Second point (direction to)
106
+ * @param arrowLength - Length of the arrowhead
107
+ * @param arrowWidth - Width of the arrowhead
108
+ * @param offsetFactor - Factor to offset the tip (default 1/3)
109
+ * @returns Object containing arrowhead points
110
+ */
111
+ export declare const getArrowheadGeometry: (point1: {
112
+ x: number;
113
+ y: number;
114
+ }, point2: {
115
+ x: number;
116
+ y: number;
117
+ }, arrowLength: number, arrowWidth: number, offsetFactor?: number) => {
118
+ tip: {
119
+ x: number;
120
+ y: number;
121
+ };
122
+ base1: {
123
+ x: number;
124
+ y: number;
125
+ };
126
+ base2: {
127
+ x: number;
128
+ y: number;
129
+ };
130
+ angle: number;
131
+ };
132
+ /**
133
+ * Calculates the proper angle for relationship labels to prevent upside-down text (SVG-specific)
134
+ * @param angle - The original angle in radians
135
+ * @returns The corrected angle in degrees
136
+ */
137
+ export declare const getCorrectLabelAngle: (angle: number) => number;
138
+ /**
139
+ * Gets the maximum width for relationship labels based on waypoints (SVG-specific)
140
+ * @param points - Array of relationship waypoints
141
+ * @returns Maximum width for the label
142
+ */
143
+ export declare const getLabelMaxWidth: (points: {
144
+ x: number;
145
+ y: number;
146
+ }[]) => number;
147
+ /**
148
+ * Processes caption data for SVG rendering
149
+ * @param captions - Array of caption objects with value and styles
150
+ * @param caption - Legacy single caption string
151
+ * @returns Object with fullCaption and stylesPerChar array
152
+ */
153
+ export declare const processCaptionData: (captions?: {
154
+ value?: string;
155
+ styles?: string[];
156
+ }[], caption?: string) => {
157
+ fullCaption: string;
158
+ stylesPerChar: string[][];
159
+ };
160
+ /**
161
+ * Groups consecutive characters with the same style into text spans
162
+ * @param lineText - The text of the line
163
+ * @param stylesPerChar - Array of style arrays for each character
164
+ * @param startCharIndex - The starting character index in the overall caption
165
+ * @returns Array of text spans with their styles
166
+ */
167
+ export declare const getGroupedTextSpans: (lineText: string, stylesPerChar: string[][], startCharIndex: number) => {
168
+ text: string;
169
+ style: string;
170
+ }[];
171
+ /**
172
+ * Creates an SVG image element for node icons
173
+ * @param options - Configuration options for the icon element
174
+ * @param options.nodeX - X coordinate of the node center
175
+ * @param options.nodeY - Y coordinate of the node center
176
+ * @param options.iconXPos - X offset from node center to icon position
177
+ * @param options.iconYPos - Y offset from node center to icon position
178
+ * @param options.iconSize - Size (width and height) of the icon
179
+ * @param options.image - The image from cache (HTMLCanvasElement)
180
+ * @param options.isDisabled - Whether the node is disabled
181
+ * @returns SVG image element
182
+ */
183
+ export declare const createSvgIconElement: (options: {
184
+ nodeX: number;
185
+ nodeY: number;
186
+ iconXPos: number;
187
+ iconYPos: number;
188
+ iconSize: number;
189
+ image: HTMLCanvasElement;
190
+ isDisabled: boolean;
191
+ }) => SVGImageElement;
@@ -27,13 +27,17 @@ export default class Renderer {
27
27
  private relBuffer;
28
28
  private nodeBuffer;
29
29
  private posTexture;
30
+ private nodeVao;
31
+ private relVao;
32
+ private nodeAnimVao;
33
+ private vaoExt;
30
34
  constructor(gl: WebGLRenderingContext, nodes: DataSet<Node>, rels: DataSet<Relationship>, state: NvlState);
31
35
  private setShaderUniforms;
32
36
  setData(data: {
33
37
  nodes: Node[];
34
38
  rels: Relationship[];
35
39
  }): void;
36
- render(positionArray: Node[], nodes: any, rels: any): void;
40
+ render(positionArray: Node[]): void;
37
41
  renderViewbox(): void;
38
42
  updateNodes(updates: Node[]): void;
39
43
  updateRelationships(relItems: Relationship[]): void;
@@ -1,4 +1,4 @@
1
- import type { StyledCaption } from '../renderers/canvasrenderer/types';
1
+ import type { StyledCaption } from '../renderers/domrenderer/shared/types';
2
2
  /**
3
3
  * The base type for graph elements.
4
4
  * @private
@@ -13,6 +13,21 @@ export declare const createCanvasForScreenshot: (fullWidth: number, fullHeight:
13
13
  export declare const createCanvasForRenderer: (parent?: HTMLElement, onContextLostCallback?: (e: WebGLContextEvent) => void) => HTMLCanvasElement;
14
14
  export declare const removeCanvas: (canvas: HTMLCanvasElement) => void;
15
15
  export declare const getCanvas2DContext: (canvas: HTMLCanvasElement) => CanvasRenderingContext2D;
16
- export declare const getWebGLContext: (canvas: HTMLCanvasElement) => WebGLRenderingContext | WebGL2RenderingContext;
16
+ export declare const getWebGLContext: (canvas: HTMLCanvasElement) => WebGLRenderingContext;
17
17
  export declare const removeWebGLContext: (webGLCtx: WebGLRenderingContext) => void;
18
18
  export declare const checkWebGLAvailability: (canvas?: HTMLCanvasElement) => boolean;
19
+ /**
20
+ * Measures the width of text with caching to avoid expensive measureText operations.
21
+ *
22
+ * The cache key is based on the current font, so that measurements are accurate
23
+ * even when font properties change.
24
+ *
25
+ * @param ctx - The canvas rendering context
26
+ * @param text - The text to measure
27
+ * @returns The width of the text in pixels
28
+ */
29
+ export declare const measureTextCached: (ctx: CanvasRenderingContext2D, text: string) => number;
30
+ /**
31
+ * Clears the text measurement cache.
32
+ */
33
+ export declare const clearTextMeasurementCache: () => void;
@@ -0,0 +1,3 @@
1
+ import type { Node } from '../types/graph-element';
2
+ export declare const MIN_RADIUS = 250;
3
+ export declare const getPositionsOnCircle: (nodes: Node[]) => Record<string, Node>;
@@ -0,0 +1 @@
1
+ export {};
@@ -2,7 +2,7 @@ export declare const PhysTextureSize = 256;
2
2
  export declare const SpringTextureSize = 4096;
3
3
  export declare const MaxIndexBuffer = 65536;
4
4
  export declare const MinRelLength = 100;
5
- export declare const Gravity = 100;
5
+ export declare const Gravity = 25;
6
6
  export declare const SimulationStopVelocity = 100;
7
7
  export declare const VerletSimulationStopVelocity = 0.25;
8
8
  export declare const MappingEnd = 999999;
@@ -19,6 +19,8 @@ export declare const DefaultSelectedInnerColor = "#F5F6F6";
19
19
  export declare const DefaultSelectedOuterColor = "#8FE3E8";
20
20
  export declare const TextColor = "#1A1B1D";
21
21
  export declare const TextColorInverse = "#FFFFFF";
22
+ export declare const MaxArrowCountWithShadows = 500;
23
+ export declare const DefaultFontFace = "\"Open Sans\", sans-serif";
22
24
  export declare const absFillStyle: {
23
25
  position: string;
24
26
  top: number;
@@ -4,7 +4,7 @@ export type FlatRel = Omit<Relationship & {
4
4
  bundledRels: Omit<Relationship, 'from' | 'to'>[];
5
5
  key: string;
6
6
  }, 'id'>;
7
- export declare const getRelItemKey: (from: Node['id'], to: Node['id']) => string;
7
+ export declare const getRelItemKey: (from: Node["id"], to: Node["id"]) => string;
8
8
  export declare const relItemsToFlatKeySet: (relItems: Relationship[]) => Set<string>;
9
9
  /**
10
10
  * Flattens a list of relationships so only one relationship remains between two nodes.
@@ -19,7 +19,7 @@ export declare const getAdjNodesMapAndRelMap: (rels: Relationship[]) => {
19
19
  adjNodesMap: Record<string, Set<string>>;
20
20
  relMap: Record<string, Relationship[]>;
21
21
  };
22
- export declare const getConnectedNodesAndRels: (addedNodes: Set<Node['id']>, addedRels: Set<Relationship['id']>, nodes: DataSet<Node>, rels: DataSet<Relationship>) => {
22
+ export declare const getConnectedNodesAndRels: (addedNodes: Set<Node["id"]>, addedRels: Set<Relationship["id"]>, nodes: DataSet<Node>, rels: DataSet<Relationship>) => {
23
23
  connectedNodes: Record<string, Node>;
24
24
  connectedRels: Record<string, Relationship>;
25
25
  };
@@ -31,7 +31,7 @@ export declare const recordCollector: (graphElements: NestedGraphElements[]) =>
31
31
  *
32
32
  * @see {@link https://neo4j.com/docs/api/javascript-driver/current/class/lib6/result-transformers.js~ResultTransformers.html|ResultTransformers on Neo4j JS Driver API Docs}
33
33
  */
34
- export declare const nvlResultTransformer: import("neo4j-driver-core/types/result-transformers").ResultTransformer<{
34
+ export declare const nvlResultTransformer: import("neo4j-driver-core").ResultTransformer<{
35
35
  /** The nodes of the graph. */
36
36
  nodes: NvlNode[];
37
37
  /** The relationships of the graph. */