@neo4j-nvl/base 0.3.8-e5dee203 → 0.3.9-93453bb0

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.
@@ -267,10 +267,13 @@ declare class NVL {
267
267
  * @param {string} options.backgroundColor - The background color of the png file.
268
268
  * The size of the png file will be the size of the canvas in the DOM.
269
269
  */
270
- saveToFile(options: {
270
+ saveToFile(options?: {
271
271
  filename?: string;
272
272
  backgroundColor?: string;
273
273
  }): void;
274
+ getImageDataUrl(options?: {
275
+ backgroundColor?: string;
276
+ }): string;
274
277
  /**
275
278
  * Saves the entire graph visualization canvas as a png to the client.
276
279
  * @param {{ filename: string, backgroundColor: string }} options The filename and background color of the png.
@@ -279,7 +282,7 @@ declare class NVL {
279
282
  * The size of the png file will be as large as the entire graph at the default zoom level.
280
283
  * Can result in a very large file.
281
284
  */
282
- saveFullGraphToLargeFile(options: {
285
+ saveFullGraphToLargeFile(options?: {
283
286
  filename?: string;
284
287
  backgroundColor?: string;
285
288
  }): 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 {};
@@ -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.
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-93453bb0",
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-93453bb0",
33
33
  "@segment/analytics-next": "^1.70.0",
34
34
  "color-string": "^1.9.1",
35
35
  "d3-force": "^3.0.0",
@@ -59,5 +59,5 @@
59
59
  "peerDependencies": {
60
60
  "neo4j-driver": "*"
61
61
  },
62
- "stableVersion": "0.3.8"
62
+ "stableVersion": "0.3.9"
63
63
  }