@neo4j-nvl/base 1.1.0-4e2c14bf → 1.1.0-4e86c5a4

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.
@@ -1,7 +1,8 @@
1
1
  import type { Cache } from '../shared/types';
2
2
  declare class ImageCache {
3
- cache: Cache;
4
- constructor();
3
+ readonly cache: Cache;
4
+ private readonly onImageLoadedCb?;
5
+ constructor(onImageLoaded?: () => void);
5
6
  getImage(src: string, inverted?: boolean): HTMLCanvasElement;
6
7
  private getOrCreateEntry;
7
8
  private invertCanvas;
@@ -2,6 +2,13 @@ import type { BorderStyles } from '../../../../modules/state/types';
2
2
  import type { Node } from '../../../../types/graph-element';
3
3
  import type AnimationHandler from '../../canvasrenderer/AnimationHandler';
4
4
  import type { TextSegment } from '../types';
5
+ /**
6
+ * Returns the effective node size, which is either the provided size
7
+ * if it's a positive and finite number, or the default node size otherwise.
8
+ * @param size
9
+ * @returns The effective node size.
10
+ */
11
+ export declare const getEffectiveNodeSize: (size?: number) => number;
5
12
  /**
6
13
  * Returns the bounding box of a node with the given x, y, and size properties.
7
14
  * If no size is given, the default size is used.
@@ -36,11 +36,22 @@ export declare const tryWithNumberOfLines: (text: string, measureWidth: (text: s
36
36
  export declare const tryBreakingOnSpaces: (text: string, measureWidth: (text: string) => number, getAvailableWidth: (a: number, b: number) => number, numberOfLines: number) => TextSegment[];
37
37
  /**
38
38
  * @param ctx - = Canvas.2dContext
39
- * @param rtlAdjustedText - The text to display
39
+ * @param text - The text to display
40
40
  *
41
41
  * @return array of text lines
42
42
  */
43
43
  export declare const getLines: (ctx: CanvasRenderingContext2D, text: string, fontFace: string, fontSize: string | number, maxWidth: number, hasIcon: boolean, maxNoLines: number, align: string) => TextSegment[];
44
+ /**
45
+ * Groups consecutive characters with the same style into text spans.
46
+ * @param lineText - The text of the line to process.
47
+ * @param stylesPerChar - A 2D array where each entry corresponds to a character.
48
+ * @param startCharIndex - The index of the first character of lineText in the full caption.
49
+ * @returns An array of objects, each containing a text span and its associated style string.
50
+ */
51
+ export declare const getGroupedTextSpans: (lineText: string, stylesPerChar: string[][], startCharIndex: number) => {
52
+ text: string;
53
+ style: string;
54
+ }[];
44
55
  /**
45
56
  * Returns the styles by char for a group of property values.
46
57
  * @param captions - = array of captions
@@ -65,14 +65,3 @@ export declare const createStyledTextElement: (options: {
65
65
  transform?: string;
66
66
  fontWeight?: string;
67
67
  }) => SVGTextElement;
68
- /**
69
- * Groups consecutive characters with the same style into text spans
70
- * @param lineText - The text of the line
71
- * @param stylesPerChar - Array of style arrays for each character
72
- * @param startCharIndex - The starting character index in the overall caption
73
- * @returns Array of text spans with their styles
74
- */
75
- export declare const getGroupedTextSpans: (lineText: string, stylesPerChar: string[][], startCharIndex: number) => {
76
- text: string;
77
- style: string;
78
- }[];
@@ -9,6 +9,10 @@ export interface Point {
9
9
  y: number;
10
10
  }
11
11
  export declare const isPointDefined: (point: Point | Node) => boolean;
12
+ /**
13
+ * Returns true when value is a finite number (not NaN or Infinity).
14
+ */
15
+ export declare const isValidFiniteNumber: (value: unknown) => value is number;
12
16
  /**
13
17
  * This function checks if the coordinates are defined.
14
18
  * @param from - The {@link Node} the edge starts from.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-nvl/base",
3
- "version": "1.1.0-4e2c14bf",
3
+ "version": "1.1.0-4e86c5a4",
4
4
  "license": "SEE LICENSE IN 'LICENSE.txt'",
5
5
  "homepage": "https://neo4j.com/docs/nvl/current/",
6
6
  "description": "Base library for the Neo4j Visualization Library",
@@ -30,7 +30,7 @@
30
30
  "postpack": "rm LICENSE.txt && rm CHANGELOG.md"
31
31
  },
32
32
  "dependencies": {
33
- "@neo4j-nvl/layout-workers": "1.1.0-4e2c14bf",
33
+ "@neo4j-nvl/layout-workers": "1.1.0-4e86c5a4",
34
34
  "@segment/analytics-next": "1.81.1",
35
35
  "color-string": "1.9.1",
36
36
  "d3-force": "3.0.0",