@neo4j-nvl/base 0.3.8-e5dee203 → 0.3.9-381e4a0c

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.
@@ -37,6 +37,7 @@ interface NvlMouseEvent extends MouseEvent {
37
37
  */
38
38
  declare class NVL {
39
39
  #private;
40
+ readonly performance: any;
40
41
  /**
41
42
  * Creates a new NVL instance.
42
43
  * @param {HTMLElement} frame - The DOM element to display the graph in
@@ -267,10 +268,13 @@ declare class NVL {
267
268
  * @param {string} options.backgroundColor - The background color of the png file.
268
269
  * The size of the png file will be the size of the canvas in the DOM.
269
270
  */
270
- saveToFile(options: {
271
+ saveToFile(options?: {
271
272
  filename?: string;
272
273
  backgroundColor?: string;
273
274
  }): void;
275
+ getImageDataUrl(options?: {
276
+ backgroundColor?: string;
277
+ }): string;
274
278
  /**
275
279
  * Saves the entire graph visualization canvas as a png to the client.
276
280
  * @param {{ filename: string, backgroundColor: string }} options The filename and background color of the png.
@@ -279,7 +283,7 @@ declare class NVL {
279
283
  * The size of the png file will be as large as the entire graph at the default zoom level.
280
284
  * Can result in a very large file.
281
285
  */
282
- saveFullGraphToLargeFile(options: {
286
+ saveFullGraphToLargeFile(options?: {
283
287
  filename?: string;
284
288
  backgroundColor?: string;
285
289
  }): void;
@@ -25,6 +25,7 @@ export declare class PhysLayout {
25
25
  private force;
26
26
  private nodeIdToIndex;
27
27
  private nodeIndexToId;
28
+ private flatRelationshipKeys;
28
29
  private numNodes;
29
30
  private solarMerger;
30
31
  private subGraphs;
@@ -126,11 +127,23 @@ export declare class PhysLayout {
126
127
  }, nodeChanges: {
127
128
  adds: Record<string, Node>;
128
129
  removes: Record<string, Node>;
130
+ }, relationshipChanges: {
131
+ adds: Record<string, Relationship>;
132
+ removes: Record<string, Relationship>;
129
133
  }): any;
130
134
  /**
131
135
  * Destroys the class and all buffers and textures.
132
136
  */
133
137
  destroy(): void;
138
+ /**
139
+ * Takes the new flat key set of relationships and the current relationship changes
140
+ * and checks whether removed relationships are still in the new flat key set
141
+ * and whether added relationships were already in the old flat key set.
142
+ * @param newFlatKeySet The new flat key set of relationships.
143
+ * @param relationshipChanges The changes in the relationships.
144
+ * @returns {boolean} Whether the relationship flat map has changed.
145
+ */
146
+ private hasRelationshipFlatMapChanged;
134
147
  private dumpTexture;
135
148
  private getScaleNumber;
136
149
  private getBaseLength;
@@ -109,9 +109,13 @@ export default class NvlController {
109
109
  private getLayout;
110
110
  setLayout(layoutType: Layout): void;
111
111
  setLayoutOptions(options: LayoutOptions): void;
112
- createDownloadLink(filename: string, canvas: HTMLCanvasElement): HTMLAnchorElement;
112
+ private getDataUrlForCanvas;
113
+ private initiateFileDownload;
114
+ private updateLayoutAndPositions;
113
115
  saveToFile(options: SaveToFileOptions): void;
114
- prepareLargeFileForDownload(options: SaveToFileOptions): Promise<unknown>;
116
+ getImageDataURL(options: SaveToFileOptions): string;
117
+ private prepareLargeFileForDownload;
118
+ private createCanvasAndRenderImage;
115
119
  saveFullGraphToLargeFile(options: SaveToFileOptions): Promise<void>;
116
120
  }
117
121
  export {};
@@ -26,7 +26,7 @@ export declare const tryWithNumberOfLines: (text: string, measureWidth: (text: s
26
26
  export declare const tryBreakingOnSpaces: (text: string, measureWidth: (text: string) => number, getAvailableWidth: (a: number, b: number) => number, numberOfLines: number) => TextSegment[];
27
27
  /**
28
28
  * @param {object} ctx = Canvas.2dContext
29
- * @param {object} text - The text to display
29
+ * @param {object} rtlAdjustedText - The text to display
30
30
  *
31
31
  * @return array of text lines
32
32
  */
@@ -3,6 +3,8 @@
3
3
  * @param canvas The canvas to fix the size of.
4
4
  *
5
5
  * Make sure canvas pixel buffer is 1 to 1 vs screen pixels
6
+ *
7
+ * @note If the parent element is not connected to the DOM, it will use the width and height from the style properties.
6
8
  */
7
9
  export declare const fitCanvasSizeToParent: (canvas: HTMLCanvasElement) => void;
8
10
  export declare const addWebGLContextLostListener: (canvas: HTMLCanvasElement, contextLostCallback?: (e: WebGLContextEvent) => void) => void;
@@ -11,6 +11,7 @@ export declare const DefaultNodeSize = 25;
11
11
  export declare const DefaultNodeColor = "#FFDF81";
12
12
  export declare const DefaultRelColor = "#818790";
13
13
  export declare const DefaultRelWidth = 1;
14
+ export declare const MaxFlatRelWidth = 20;
14
15
  export declare const DisabledItemColor = "#EDEDED";
15
16
  export declare const DisabledItemFontColor = "#DDDDDD";
16
17
  export declare const DefaultShadowColor = "#CFD1D4";
@@ -4,6 +4,8 @@ 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;
8
+ export declare const relItemsToFlatKeySet: (relItems: Relationship[]) => Set<string>;
7
9
  /**
8
10
  * Flattens a list of relationships so only one relationship remains between two nodes.
9
11
  * Falls back to default rel color when relationships between two nodes have varying colors.
@@ -28,7 +28,7 @@ export declare abstract class AnalyticsFunction {
28
28
  /**
29
29
  * Track arbitrary event
30
30
  */
31
- abstract trackEvent(payload: AnalyticsTrackPayload): void;
31
+ abstract trackEvent(payload: AnalyticsTrackPayload): Promise<void>;
32
32
  }
33
33
  /**
34
34
  * Analytics adapter for Segment Analytics.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-nvl/base",
3
- "version": "0.3.8-e5dee203",
3
+ "version": "0.3.9-381e4a0c",
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",
@@ -29,7 +29,7 @@
29
29
  "postpack": "rm LICENSE.txt && rm CHANGELOG.md"
30
30
  },
31
31
  "dependencies": {
32
- "@neo4j-nvl/layout-workers": "0.3.8-e5dee203",
32
+ "@neo4j-nvl/layout-workers": "0.3.9-381e4a0c",
33
33
  "@segment/analytics-next": "^1.70.0",
34
34
  "color-string": "^1.9.1",
35
35
  "d3-force": "^3.0.0",
@@ -44,6 +44,7 @@
44
44
  "uuid": "^8.3.2"
45
45
  },
46
46
  "devDependencies": {
47
+ "@babel/core": "^7.21.4",
47
48
  "@types/color-string": "^1.5.5",
48
49
  "@types/d3-force": "^3.0.3",
49
50
  "@types/lodash": "4.14.202",
@@ -52,12 +53,11 @@
52
53
  "babel-loader": "^8.2.5",
53
54
  "copy-webpack-plugin": "^11.0.0",
54
55
  "neo4j-driver": "^5.26.0",
55
- "typedoc": "^0.23.15",
56
56
  "webpack": "^5.75.0",
57
57
  "webpack-cli": "^5.0.0"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "neo4j-driver": "*"
61
61
  },
62
- "stableVersion": "0.3.8"
62
+ "stableVersion": "0.3.9"
63
63
  }