@neo4j-nvl/base 0.3.9-dc45154c → 1.0.0

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 (34) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/base.mjs +1 -1
  3. package/dist/types/index.d.ts +85 -72
  4. package/dist/types/layouts/animatedlayout/animationUtils.d.ts +3 -3
  5. package/dist/types/layouts/forcedirectedlayout/physlayout/PhysLayout.d.ts +19 -19
  6. package/dist/types/modules/CallbackHelper.d.ts +5 -5
  7. package/dist/types/modules/ExternalCallbackHandler.d.ts +7 -0
  8. package/dist/types/modules/NvlController.d.ts +5 -5
  9. package/dist/types/modules/dataset.d.ts +1 -1
  10. package/dist/types/modules/state/state.d.ts +2 -2
  11. package/dist/types/modules/state/types.d.ts +43 -52
  12. package/dist/types/modules/state/utils.d.ts +8 -6
  13. package/dist/types/renderers/canvasrenderer/Animation.d.ts +8 -11
  14. package/dist/types/renderers/canvasrenderer/AnimationHandler.d.ts +15 -16
  15. package/dist/types/renderers/canvasrenderer/CanvasRenderer.d.ts +10 -10
  16. package/dist/types/renderers/canvasrenderer/arrows/ArrowBundle.d.ts +15 -15
  17. package/dist/types/renderers/canvasrenderer/arrows/ArrowBundler.d.ts +8 -8
  18. package/dist/types/renderers/canvasrenderer/arrows/arrows.d.ts +26 -26
  19. package/dist/types/renderers/canvasrenderer/nodes/nodes.d.ts +9 -9
  20. package/dist/types/renderers/canvasrenderer/types.d.ts +6 -4
  21. package/dist/types/renderers/canvasrenderer/util.d.ts +20 -21
  22. package/dist/types/renderers/canvasrenderer/wordwrap.d.ts +13 -13
  23. package/dist/types/types/graph-element.d.ts +15 -6
  24. package/dist/types/utils/canvasManagement.d.ts +2 -1
  25. package/dist/types/utils/colorUtils.d.ts +3 -3
  26. package/dist/types/utils/constants.d.ts +3 -3
  27. package/dist/types/utils/errors.d.ts +2 -1
  28. package/dist/types/utils/geometry.d.ts +31 -30
  29. package/dist/types/utils/graphObjectUtils.d.ts +3 -3
  30. package/dist/types/utils/hittest.d.ts +2 -0
  31. package/dist/types/utils/jsDriverResultTransformer.d.ts +13 -6
  32. package/dist/types/utils/segmentAnalytics.d.ts +8 -8
  33. package/dist/types/utils/zoomFunctions.d.ts +30 -23
  34. package/package.json +3 -4
@@ -18,6 +18,7 @@ export type BorderStyle = {
18
18
  };
19
19
  /**
20
20
  * @internal
21
+ * @hidden
21
22
  */
22
23
  export type BorderStyles = {
23
24
  selected: BorderStyle;
@@ -25,6 +26,7 @@ export type BorderStyles = {
25
26
  };
26
27
  /**
27
28
  * @internal
29
+ * @hidden
28
30
  */
29
31
  export type DisabledItemStyles = {
30
32
  color: string;
@@ -35,25 +37,25 @@ export type DisabledItemStyles = {
35
37
  */
36
38
  export interface ForceDirectedOptions {
37
39
  /**
38
- * @internal
39
- */
40
- gravity?: number;
41
- /**
42
- * @internal
40
+ * Enables a workaround for Intel GPU compatibility issues in WebGL shader compilation.
41
+ * When enabled, this flag modifies how physics simulation shaders are compiled to avoid
42
+ * rendering problems on Intel graphics hardware.
43
+ *
44
+ * @remarks Requires a restart of NVL as shaders need to be recompiled.
43
45
  */
44
46
  intelWorkaround?: boolean;
45
47
  /**
46
- * @internal
48
+ * Whether to enable automatic switching to CoseBilkent layout for small graphs.
49
+ * When enabled, small graphs will automatically use the CoseBilkent layout algorithm
50
+ * which can provide better initial positioning for smaller datasets.
47
51
  */
48
52
  enableCytoscape?: boolean;
49
53
  /**
54
+ * Wether to use the new physics engine instead of the legacy one.
55
+ * @defaultValue true
50
56
  * @internal
51
57
  */
52
58
  enableVerlet?: boolean;
53
- /**
54
- * @internal
55
- */
56
- simulationStopVelocity?: number;
57
59
  }
58
60
  /**
59
61
  * The options for the hierarchical layout
@@ -66,34 +68,48 @@ export interface HierarchicalOptions {
66
68
  }
67
69
  export declare const isHierarchicalLayoutOptions: (options: LayoutOptions) => options is HierarchicalOptions;
68
70
  /**
69
- * The name of the force directed layout
71
+ * NVL's main force directed layout.
70
72
  */
71
73
  export declare const ForceDirectedLayoutType = "forceDirected";
72
74
  /**
73
- * The name of the hierarchical layout
75
+ * A hierarchical layout using the dagre algorithm.
74
76
  */
75
77
  export declare const HierarchicalLayoutType = "hierarchical";
76
78
  /**
77
- * The name of the grid layout
78
- * @internal
79
+ * A basic grid layout.
79
80
  */
80
81
  export declare const GridLayoutType = "grid";
81
82
  /**
82
- * The name of the free layout
83
- * @internal
83
+ * A free layout that allows for arbitrary positioning of elements using NVL's setPosition method.
84
84
  */
85
85
  export declare const FreeLayoutType = "free";
86
86
  /**
87
- * The name of the d3 force layout
88
- * @internal
87
+ * The commonly used d3-force layout.
89
88
  */
90
89
  export declare const d3ForceLayoutType = "d3Force";
90
+ /**
91
+ * A WebGL renderer that uses the GPU for rendering.
92
+ *
93
+ * @remarks
94
+ * This renderer has better performance than the canvas renderer,
95
+ * but does not support captions and arrowheads.
96
+ */
91
97
  export declare const WebGLRendererType = "webgl";
98
+ /**
99
+ * A renderer using canvas.
100
+ *
101
+ * @remarks
102
+ * This renderer has lower performance than the WebGL renderer,
103
+ * but supports captions and arrowheads.
104
+ */
92
105
  export declare const CanvasRendererType = "canvas";
93
106
  /**
94
107
  * The different types of layouts available
95
108
  */
96
109
  export type Layout = typeof ForceDirectedLayoutType | typeof HierarchicalLayoutType | typeof GridLayoutType | typeof FreeLayoutType | typeof d3ForceLayoutType;
110
+ /**
111
+ * The options for the layout.
112
+ */
97
113
  export type LayoutOptions = ForceDirectedOptions | HierarchicalOptions;
98
114
  /**
99
115
  * The different types of renderers available
@@ -102,7 +118,6 @@ export type Renderer = typeof WebGLRendererType | typeof CanvasRendererType;
102
118
  /** Configurations for a NVL instance */
103
119
  export interface NvlOptions {
104
120
  /**
105
- * @internal
106
121
  * Id for uniquely identifying the instance of Nvl
107
122
  */
108
123
  instanceId?: string;
@@ -128,16 +143,10 @@ export interface NvlOptions {
128
143
  * @defaultValue true
129
144
  */
130
145
  allowDynamicMinZoom?: boolean;
131
- /**
132
- * @internal
133
- * @deprecated
134
- * The DOM element in which to render the graph visualization
135
- */
136
- frame?: HTMLElement;
137
146
  /**
138
147
  * The DOM container in which to render the minimap.
139
148
  *
140
- * @note When using a React ref, make sure the attached element is rendered before the NVL instance is created.
149
+ * @remarks When using a React ref, make sure the attached element is rendered before the NVL instance is created.
141
150
  * Otherwise, the minimap will not be displayed.
142
151
  */
143
152
  minimapContainer?: HTMLElement;
@@ -149,12 +158,6 @@ export interface NvlOptions {
149
158
  panY?: number;
150
159
  /** Zoom value of the current viewport */
151
160
  initialZoom?: number;
152
- /**
153
- * @deprecated use {@link renderer} instead
154
- * Whether to user the Canvas or WebGL renderer
155
- * Will be ignored when {@link renderer} is set
156
- */
157
- useWebGL?: boolean;
158
161
  /**
159
162
  * What renderer to use
160
163
  * Possible values are 'webgl' or 'canvas'
@@ -165,11 +168,13 @@ export interface NvlOptions {
165
168
  renderer?: Renderer;
166
169
  /**
167
170
  * @internal
171
+ * @hidden
168
172
  * Whether or not to disable WebGL completely.
169
173
  */
170
174
  disableWebGL?: boolean;
171
175
  /**
172
176
  * @internal
177
+ * @hidden
173
178
  * Specify the log level.
174
179
  */
175
180
  logging?: {
@@ -177,11 +182,16 @@ export interface NvlOptions {
177
182
  };
178
183
  /**
179
184
  * @internal
185
+ * @hidden
180
186
  */
181
187
  relationshipThreshold?: number;
188
+ /** Callbacks for various events in the NVL instance. */
182
189
  callbacks?: ExternalCallbacks;
190
+ /** Styling options for the NVL instance. */
183
191
  styling?: {
192
+ /** The default color for nodes. */
184
193
  defaultNodeColor?: string;
194
+ /** The default color for relationships. */
185
195
  defaultRelationshipColor?: string;
186
196
  /** The color to use for the default border of nodes */
187
197
  nodeDefaultBorderColor?: string;
@@ -198,28 +208,9 @@ export interface NvlOptions {
198
208
  /** The color to use for the viewport box in the minimap */
199
209
  minimapViewportBoxColor?: string;
200
210
  };
201
- /**
202
- * The color to use for the default border of nodes
203
- * @deprecated Use {@link styling.nodeDefaultBorderColor} instead
204
- */
205
- nodeDefaultBorderColor?: string;
206
- /**
207
- * The color to use for the selected border of nodes
208
- * @deprecated Use {@link styling.selectedBorderColor} instead
209
- */
210
- selectedBorderColor?: string;
211
- /**
212
- * The color to use for the disabled nodes and relationships
213
- * @deprecated Use {@link styling.disabledItemColor} instead
214
- */
215
- disabledItemColor?: string;
216
- /**
217
- * The color to use for the labels of the disabled nodes and relationships
218
- * @deprecated Use {@link styling.disabledItemFontColor} instead
219
- */
220
- disabledItemFontColor?: string;
221
211
  /**
222
212
  * @internal
213
+ * @hidden
223
214
  * Defines a time limit for how long layout iterations may run
224
215
  */
225
216
  layoutTimeLimit?: number;
@@ -1,10 +1,12 @@
1
+ import type { StyledCaption } from '../../renderers/canvasrenderer/types';
2
+ import type { Node, Relationship } from '../../types/graph-element';
1
3
  import type { NvlOptions } from './types';
2
- export declare const processColorStyles: (styling: NvlOptions['styling'], { legacyNodeDefaultBorderColor, legacySelectedBorderColor, legacyDisabledItemColor, legacyDisabledItemFontColor }: {
3
- legacyNodeDefaultBorderColor?: string;
4
- legacySelectedBorderColor?: string;
5
- legacyDisabledItemColor?: string;
6
- legacyDisabledItemFontColor?: string;
7
- }) => {
4
+ /**
5
+ * Converts a {@link Node.caption} string to {@link Node.captions} array format.
6
+ * If both caption and captions are provided, captions takes precedence.
7
+ */
8
+ export declare const processCaptions: (item: Partial<Node | Relationship>) => StyledCaption[];
9
+ export declare const processColorStyles: (styling: NvlOptions['styling']) => {
8
10
  nodeBorderStyles: {
9
11
  default: {
10
12
  rings?: {
@@ -24,40 +24,37 @@ export declare class Animation {
24
24
  private hasNextAnimation;
25
25
  /**
26
26
  * Constructor
27
- * @param {string} elementId The id of the element to animate.
28
- * @param {number} startValue The start value of the animation.
27
+ * @param elementId - The id of the element to animate.
28
+ * @param startValue - The start value of the animation.
29
29
  */
30
30
  constructor(elementId: string, startValue: number);
31
31
  /**
32
- * Sets the duration of the animation
33
- * @param {number} duration The duration of the animation.
34
- * @returns {void}
32
+ * Sets the duration of the animation.
33
+ * @param duration - The duration of the animation.
35
34
  * @public
36
35
  */
37
36
  setDuration(duration: number): void;
38
37
  /**
39
38
  * Returns the status of the animation
40
- * @returns {number} The status of the animation.
39
+ * @returns The status of the animation.
41
40
  * @public
42
41
  */
43
42
  getStatus(): number;
44
43
  /**
45
44
  * Advances the animation to the next frame
46
- * @returns {boolean} True if there is a next animation, false otherwise.
45
+ * @returns True if there is a next animation, false otherwise.
47
46
  * @public
48
47
  */
49
48
  advance(): boolean;
50
49
  /**
51
50
  * Sets the end value of the animation
52
- * @param {number} targetValue The end value of the animation.
53
- * @returns {void}
51
+ * @param targetValue - The end value of the animation.
54
52
  * @public
55
53
  */
56
54
  setEndValue(targetValue: number): void;
57
55
  /**
58
56
  * Sets the end time of the animation
59
- * @param {number} newEndTime The end time of the animation.
60
- * @returns {void}
57
+ * @param newEndTime - The end time of the animation.
61
58
  * @private
62
59
  */
63
60
  private setEndTime;
@@ -18,18 +18,18 @@ export default class AnimationHandler {
18
18
  constructor();
19
19
  /**
20
20
  * Main function run once per frame to advance all animations
21
- * @returns {boolean} true if any animation is still running
21
+ * @returns True if any animation is still running.
22
22
  */
23
23
  advance(): boolean;
24
24
  /**
25
25
  * Sets a flag if animations should be ignored.
26
26
  * If set to true all animations always return their end value.
27
- * @param {boolean} shouldIgnore
27
+ * @param shouldIgnore - Whether animations should be ignored.
28
28
  */
29
29
  ignoreAnimations(shouldIgnore: boolean): void;
30
30
  /**
31
31
  * Sets the duration for all animations
32
- * @param {Object} options - An object containing animation durations for fade and size
32
+ * @param options - An object containing animation durations for fade and size.
33
33
  */
34
34
  setOptions(options: {
35
35
  fadeDuration: number;
@@ -37,14 +37,13 @@ export default class AnimationHandler {
37
37
  }): void;
38
38
  /**
39
39
  * Returns whether any animation is running
40
- * @returns {boolean}
41
- */
40
+ * @returns */
42
41
  needsToRun(): boolean;
43
42
  /**
44
43
  * Returns the current value of an animation
45
- * @param {string} elementId - The id of the element the animation is running on
46
- * @param {string} name - The name of the animation
47
- * @returns {number} The current value of the animation
44
+ * @param elementId - The id of the element the animation is running on.
45
+ * @param name - The name of the animation.
46
+ * @returns The current value of the animation.
48
47
  */
49
48
  getValueForAnimationName(elementId: string, name: string, target: number, type?: number): number;
50
49
  private createAnimation;
@@ -53,20 +52,20 @@ export default class AnimationHandler {
53
52
  * Creates a new size animation for the given element and name.
54
53
  * If an animation already exists for the given element and name, it will be returned.
55
54
  * If not, a new animation will be created.
56
- * @param {number} currentValue - The current value of the animation
57
- * @param {string} elementId - The id of the element to animate
58
- * @param {string} name - The name of the animation
59
- * @returns {Animation} The animation
55
+ * @param currentValue - The current value of the animation.
56
+ * @param elementId - The id of the element to animate.
57
+ * @param name - The name of the animation.
58
+ * @returns The animation.
60
59
  */
61
60
  private createFadeAnimation;
62
61
  /**
63
62
  * Creates a new fade animation for the given element and name.
64
63
  * If an animation already exists for the given element and name, it will be returned.
65
64
  * If not, a new animation will be created.
66
- * @param {number} currentValue - The current value of the animation
67
- * @param {string} elementId - The id of the element to animate
68
- * @param {string} name - The name of the animation
69
- * @returns {Animation} The animation
65
+ * @param currentValue - The current value of the animation.
66
+ * @param elementId - The id of the element to animate.
67
+ * @param name - The name of the animation.
68
+ * @returns The animation.
70
69
  */
71
70
  private createSizeAnimation;
72
71
  }
@@ -30,7 +30,7 @@ export default class CanvasRenderer {
30
30
  });
31
31
  /**
32
32
  * Checks if the renderer needs to run.
33
- * @returns {boolean} - Whether the renderer needs to run
33
+ * @returns Whether the renderer needs to run.
34
34
  */
35
35
  needsToRun(): boolean;
36
36
  /**
@@ -55,26 +55,26 @@ export default class CanvasRenderer {
55
55
  private renderRelationships;
56
56
  /**
57
57
  * Returns the nodes at the pointer position
58
- * @param {Point} pointer - the position of the pointer
59
- * @returns {HitTargetNode[]} - the nodes at the pointer position
58
+ * @param pointer - The position of the pointer.
59
+ * @returns The nodes at the pointer position.
60
60
  * @todo Sort nodes by distance descending
61
61
  */
62
62
  getNodesAt(pointer: Point, hitNodeMarginWidth?: number): HitTargetNode[];
63
63
  /**
64
64
  * Returns the relationships at the pointer position
65
- * @param {Point} pointer - the position of the pointer
66
- * @returns {HitTargetRelationship[]} - the relationships at the pointer position
65
+ * @param pointer - The position of the pointer.
66
+ * @returns The relationships at the pointer position.
67
67
  * @todo: sort relationships by distance descending
68
68
  */
69
69
  getRelsAt(pointer: Point): HitTargetRelationship[];
70
70
  destroy(): void;
71
71
  /**
72
72
  * Checks if the bounding box is outside of the screen.
73
- * @param boundingBox - The bounding box to check
74
- * @param clientWidth - The client width of the canvas
75
- * @param clientHeight - The client height of the canvas
76
- * @returns Whether the bounding box is off screen
77
- * @note This check doesn't catch all items that are off screen but its simple and removes many of them
73
+ * @param boundingBox - The bounding box to check.
74
+ * @param clientWidth - The client width of the canvas.
75
+ * @param clientHeight - The client height of the canvas.
76
+ * @returns Whether the bounding box is off screen.
77
+ * @remarks This check doesn't catch all items that are off screen but its simple and removes many of them
78
78
  */
79
79
  private isBoundingBoxOffScreen;
80
80
  /**
@@ -20,60 +20,60 @@ export default class ArrowBundle {
20
20
  angles: number[];
21
21
  labelInfo: Record<string, LabelGeometry>;
22
22
  /**
23
- * @param {string} key - The key of the arrow bundle
24
- * @param {string} fromId - The source node of the arrow bundle
25
- * @param {string} toId - The target node of the arrow bundle
23
+ * @param key - The key of the arrow bundle.
24
+ * @param fromId - The source node of the arrow bundle.
25
+ * @param toId - The target node of the arrow bundle.
26
26
  */
27
27
  constructor(key: string, fromId: string, toId: string);
28
28
  /**
29
29
  * Insert a new arrow to the bundle
30
- * @param {Relationship} rel - The relationship to insert
30
+ * @param rel - The relationship to insert.
31
31
  */
32
32
  insert(rel: Relationship): void;
33
33
  setLabelInfo(relId: string, labelInfo: LabelGeometry): void;
34
34
  has({ id }: Relationship): boolean;
35
35
  /**
36
36
  * Remove an arrow from the bundle
37
- * @param {Relationship} rel - The arrow to remove
37
+ * @param rel - The arrow to remove.
38
38
  */
39
39
  remove({ id }: Relationship): void;
40
40
  /**
41
41
  * Get the size of the arrow bundle
42
- * @returns {number} The size of the arrow bundle
42
+ * @returns The size of the arrow bundle.
43
43
  */
44
44
  size(): number;
45
45
  relArray(): Relationship[];
46
46
  /**
47
47
  * Get the maximum font size of the arrows in the bundle
48
- * @returns {number} The maximum font size of the arrows in the bundle
48
+ * @returns The maximum font size of the arrows in the bundle.
49
49
  */
50
50
  maxFontSize(): number;
51
51
  /**
52
52
  * Check if relationship is in opposite direction to the bundle.
53
- * @param {Relationship} rel - The relationship to check
54
- * @returns {boolean} True if the relationship is in opposite direction to the bundle
53
+ * @param rel - The relationship to check.
54
+ * @returns True if the relationship is in opposite direction to the bundle.
55
55
  */
56
56
  relIsOppositeDirection({ from, to }: Relationship): boolean;
57
57
  /**
58
58
  * Get the index of a given arrow in the bundle
59
- * @param {Relationship} rel - The arrow to look for
60
- * @returns {number} The index of the arrow in the bundle, or -1 if not found
59
+ * @param rel - The arrow to look for.
60
+ * @returns The index of the arrow in the bundle, or -1 if not found.
61
61
  */
62
62
  indexOf({ id }: Relationship): number;
63
63
  /**
64
64
  * Get the arrow at a given index in the bundle
65
- * @param {number} index - The index of the arrow to get
66
- * @returns {Relationship | null} The arrow at the given index
65
+ * @param index - The index of the arrow to get.
66
+ * @returns The arrow at the given index.
67
67
  */
68
68
  getRel(index: number): Relationship | null;
69
69
  /**
70
70
  * Set the waypoints for the arrow bundle
71
- * @param {WaypointPath} waypoints - The waypoints for the arrow bundle
71
+ * @param waypoints - The waypoints for the arrow bundle.
72
72
  */
73
73
  setWaypoints(waypoints: WaypointPath): void;
74
74
  /**
75
75
  * Set the angles for the arrow bundle
76
- * @param {number[]} angles - The angles for the arrow bundle
76
+ * @param angles - The angles for the arrow bundle.
77
77
  */
78
78
  setAngles(angles: number[]): void;
79
79
  }
@@ -7,15 +7,15 @@ export default class ArrowBundler {
7
7
  constructor(rels: Relationship[], waypoints: Record<string, WaypointPath>);
8
8
  /**
9
9
  * Get the arrow bundle for a given relation
10
- * @param {Relationship} rel - The relationship
11
- * @returns {ArrowBundle} The arrow bundle
10
+ * @param rel - The relationship.
11
+ * @returns The arrow bundle.
12
12
  */
13
13
  getBundle(rel: Relationship): ArrowBundle;
14
14
  /**
15
15
  * Update the data
16
- * @param {Record<string, Relationship>} addedRels - The added relations
17
- * @param {Record<string, Relationship>} removedRels - The removed relations
18
- * @param {Record<string, WaypointPath>} waypoints - The waypoints
16
+ * @param addedRels - The added relations.
17
+ * @param removedRels - The removed relations.
18
+ * @param waypoints - The waypoints.
19
19
  */
20
20
  updateData(addedRels: Record<string, Relationship>, removedRels: Record<string, Relationship>, updatedRels: Record<string, Relationship>, waypoints: Record<string, WaypointPath>): void;
21
21
  /**
@@ -25,9 +25,9 @@ export default class ArrowBundler {
25
25
  updatePositions(positionMap: Record<string, Node>): void;
26
26
  /**
27
27
  * Get a unique ID for a pair of IDs
28
- * @param {string} id1 - The first ID
29
- * @param {string} id2 - The second ID
30
- * @returns {string} A unique ID for the pair of IDs
28
+ * @param id1 - The first ID.
29
+ * @param id2 - The second ID.
30
+ * @returns A unique ID for the pair of IDs.
31
31
  */
32
32
  private generatePairId;
33
33
  }
@@ -5,9 +5,9 @@ import type ImageCache from '../ImageCache';
5
5
  import type ArrowBundle from './ArrowBundle';
6
6
  /**
7
7
  * This function calculates the difference in radius between two nodes.
8
- * @param {number} toArrowGap - The gap between the node and the arrow on the to side.
9
- * @param {number} fromArrowGap - The gap between the node and the arrow on the from side.
10
- * @returns {number} The difference in radius between the two nodes.
8
+ * @param toArrowGap - The gap between the node and the arrow on the to side.
9
+ * @param fromArrowGap - The gap between the node and the arrow on the from side.
10
+ * @returns The difference in radius between the two nodes.
11
11
  * @comment can be affected for example by the label crust and selected ring
12
12
  * as well as a gap between the node and the arrow on it's side.
13
13
  */
@@ -16,26 +16,26 @@ export declare const getRadiusDifference: (toArrowGap: number, fromArrowGap: num
16
16
  * This function calculates the coordinates of the via point
17
17
  * between two nodes. The via point is used to bend the edge
18
18
  * between the two nodes.
19
- * @param {Node} fromNode - The node the edge starts from.
20
- * @param {Node} toNode - The node the edge ends at.
21
- * @param {number} fromArrowGap - The gap between the node and the arrow on the from side.
22
- * @param {number} toArrowGap - The gap between the node and the arrow on the to side.
23
- * @returns {Point} The coordinates of the via point.
19
+ * @param fromNode - The node the edge starts from.
20
+ * @param toNode - The node the edge ends at.
21
+ * @param fromArrowGap - The gap between the node and the arrow on the from side.
22
+ * @param toArrowGap - The gap between the node and the arrow on the to side.
23
+ * @returns The coordinates of the via point.
24
24
  */
25
25
  export declare const getViaCoordinates: (fromNode: Node, toNode: Node, fromArrowGap: number, toArrowGap: number, rel: Relationship, bundle: ArrowBundle) => Point;
26
26
  export declare const getPointsForStraight: (rel: Relationship, bundle: ArrowBundle, fromNode: Node, toNode: Node, showLabel: boolean, curved?: boolean) => Point[];
27
27
  /**
28
- * Draws a label for a relationship
29
- * @param {CanvasRenderingContext2D} ctx - the canvas context
30
- * @param {number} x - the x coordinate of the label
31
- * @param {number} y - the y coordinate of the label
32
- * @param {number} angle - the angle of the label
33
- * @param {number} maxWidth - the maximum width of the label
34
- * @param {Relationship} rel - the relationship
35
- * @param {ArrowBundle} bundle - the arrow bundle
36
- * @param {DisabledItemStyles} disabledItemStyles - the styles for disabled items
37
- * @param {string} fontColor - the color of the font
38
- * @param {boolean} flip - whether to flip the label
28
+ * Draws a label for a relationship.
29
+ * @param ctx - The canvas context.
30
+ * @param x - The x coordinate of the label.
31
+ * @param y - The y coordinate of the label.
32
+ * @param angle - The angle of the label.
33
+ * @param maxWidth - The maximum width of the label.
34
+ * @param rel - The relationship.
35
+ * @param bundle - The arrow bundle.
36
+ * @param disabledItemStyles - The styles for disabled items.
37
+ * @param fontColor - The color of the font.
38
+ * @param flip - Whether to flip the label.
39
39
  */
40
40
  export declare const drawLabel: (ctx: CanvasRenderingContext2D, point: Point, angle: number, maxWidth: number, rel: Relationship, bundle: ArrowBundle, disabledItemStyles: DisabledItemStyles, fontColor: string, flip?: boolean) => void;
41
41
  export declare const renderWaypointArrow: (ctx: CanvasRenderingContext2D, rel: Relationship, from: Node, to: Node, bundle: ArrowBundle, imageCache: ImageCache, showLabel: boolean, drawCurves: boolean, selectedBorderStyle: BorderStyle, disabledItemStyles: DisabledItemStyles, defaultRelationshipColor?: string) => void;
@@ -44,12 +44,12 @@ export declare const renderArrow: (ctx: CanvasRenderingContext2D, rel: Relations
44
44
  export declare const distanceToEdge: (pos: Point, rel: Relationship, fromNode: Node, toNode: Node, bundle: ArrowBundle, showLabel: boolean, drawCurves?: boolean) => number;
45
45
  /**
46
46
  * Returns the bounding box of the arrow.
47
- * @param {Relationship} rel - The relationship to get the bounding box for.
48
- * @param {ArrowBundle} bundle - The arrow bundle the relationship is part of.
49
- * @param {Node} fromNode - The node the relationship is coming from.
50
- * @param {Node} toNode - The node the relationship is going to.
51
- * @param {boolean} showLabel - Whether or not a label is shown.
52
- * @param {boolean} drawCurves - Whether or the relationship is drawn as a curve.
53
- * @returns {DOMRect} The bounding box of the arrow.
47
+ * @param rel - The relationship to get the bounding box for.
48
+ * @param bundle - The arrow bundle the relationship is part of.
49
+ * @param fromNode - The node the relationship is coming from.
50
+ * @param toNode - The node the relationship is going to.
51
+ * @param showLabel - Whether or not a label is shown.
52
+ * @param drawCurves - Whether or the relationship is drawn as a curve.
53
+ * @returns The bounding box of the arrow.
54
54
  */
55
55
  export declare const getBoundingBox: (rel: Relationship, bundle: ArrowBundle, fromNode: Node, toNode: Node, showLabel?: boolean, drawCurves?: boolean) => DOMRect | null;
@@ -11,17 +11,17 @@ type RingStyle = {
11
11
  * If the node is selected, it returns the selectedStyle.rings array.
12
12
  * If the node is not selected, it returns an array containing only one object with
13
13
  * a width of 0 and an empty color.
14
- * @param node {Node} - The node to get the ring styles for.
15
- * @param animationHandler {AnimationHandler} - The animation handler.
16
- * @param nodeBorderStyles {BorderStyles} - The node border styles.
17
- * @returns {{ width: number, color: string }[]} - An array of ring styles.
14
+ * @param node - The node to get the ring styles for.
15
+ * @param animationHandler - The animation handler.
16
+ * @param nodeBorderStyles - The node border styles.
17
+ * @returns An array of ring styles.
18
18
  */
19
19
  export declare const getRingStyles: (node: Node, animationHandler: AnimationHandler, nodeBorderStyles: any) => RingStyle[];
20
20
  /**
21
21
  * Returns the bounding box of a node with the given x, y, and size properties.
22
22
  * If no size is given, the default size is used.
23
- * @param {Node} Node - The node to get the bounding box for.
24
- * @returns {object} The bounding box of the node.
23
+ * @param Node - The node to get the bounding box for.
24
+ * @returns The bounding box of the node.
25
25
  */
26
26
  export declare const getBoundingBox: ({ x, y, size }: Node) => DOMRect;
27
27
  /**
@@ -30,19 +30,19 @@ export declare const getBoundingBox: ({ x, y, size }: Node) => DOMRect;
30
30
  * @param infoLevel {number} - The info level.
31
31
  * @param nodeRadius {number} - The radius of the node.
32
32
  * @param captionSize {number} - The size of the caption.
33
- * @returns {number} - The font size.
33
+ * @returns The font size.
34
34
  */
35
35
  export declare const infoLevelToFontSize: (infoLevel: number, nodeRadius?: number, captionSize?: number, hasIcon?: boolean) => number;
36
36
  /**
37
37
  * Returns maximum length of lines
38
38
  * @param lines {array} - The lines info
39
- * @returns {number} - The font size.
39
+ * @returns The font size.
40
40
  */
41
41
  export declare const findMaxLength: (lines: any[], ctx: CanvasRenderingContext2D, pixelRatio: number) => number;
42
42
  /**
43
43
  * Returns minimum length of lines
44
44
  * @param lines {array} - The lines info
45
- * @returns {number} - The font size.
45
+ * @returns The font size.
46
46
  */
47
47
  export declare const findMinLength: (lines: any[], ctx: CanvasRenderingContext2D, pixelRatio: number) => any;
48
48
  /**
@@ -8,14 +8,16 @@ export type TextSegment = {
8
8
  };
9
9
  /**
10
10
  * The caption text and its text style.
11
- * @property styles - The font styles as comma separated values
12
- * @example 'bold,italic'
13
- * @property value - The text for the caption.
14
- * @property key - The caption identifier key.
15
11
  */
16
12
  export type StyledCaption = {
13
+ /**
14
+ * The font styles as an array of style keywords.
15
+ * @example `['bold', 'italic']`
16
+ */
17
17
  styles?: string[];
18
+ /** The text value for the caption. */
18
19
  value?: string;
20
+ /** The identifier key for the caption. */
19
21
  key?: string;
20
22
  };
21
23
  export type StyledCaptionWithChars = StyledCaption & {