@neo4j-nvl/base 0.3.8 → 0.3.9-3a97de48
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.
- package/CHANGELOG.md +24 -0
- package/LICENSE.txt +3 -48
- package/dist/base.mjs +1 -1
- package/dist/base.mjs.LICENSE.txt +1 -1
- package/dist/types/index.d.ts +5 -2
- package/dist/types/layouts/forcedirectedlayout/physlayout/PhysLayout.d.ts +13 -0
- package/dist/types/modules/CallbackHelper.d.ts +1 -1
- package/dist/types/modules/ExternalCallbackHandler.d.ts +3 -0
- package/dist/types/modules/NvlController.d.ts +6 -2
- package/dist/types/renderers/canvasrenderer/arrows/ArrowBundle.d.ts +3 -3
- package/dist/types/renderers/canvasrenderer/arrows/ArrowBundler.d.ts +1 -1
- package/dist/types/renderers/canvasrenderer/wordwrap.d.ts +1 -1
- package/dist/types/utils/canvasManagement.d.ts +2 -0
- package/dist/types/utils/constants.d.ts +1 -0
- package/dist/types/utils/graphObjectUtils.d.ts +2 -0
- package/package.json +6 -4
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
9
9
|
|
|
10
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/
|
|
10
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
11
11
|
|
|
12
12
|
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
13
13
|
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ExternalCallbacks } from './ExternalCallbackHandler';
|
|
2
|
-
type CallbackFunction = ExternalCallbacks[
|
|
2
|
+
type CallbackFunction = ExternalCallbacks[keyof ExternalCallbacks];
|
|
3
3
|
/**
|
|
4
4
|
* A class for registering and calling callbacks
|
|
5
5
|
* @example
|
|
@@ -9,6 +9,8 @@ export interface ExternalCallbacks {
|
|
|
9
9
|
onLayoutStep?: (p: Node[]) => void;
|
|
10
10
|
/** Triggered when NVL throws an error after initialization. */
|
|
11
11
|
onError?: (error: Error) => void;
|
|
12
|
+
/** Triggered when NVL is initialized. */
|
|
13
|
+
onInitialization?: () => void;
|
|
12
14
|
/** Triggered when a asynchronous layout calculation starts/stops. */
|
|
13
15
|
onLayoutComputing?: (isComputing: boolean) => void;
|
|
14
16
|
onWebGLContextLost?: (webGLContextEvent: WebGLContextEvent) => void;
|
|
@@ -20,6 +22,7 @@ export declare const isExternalCallback: (callback: unknown) => callback is keyo
|
|
|
20
22
|
export default class ExternalCallbackHandler {
|
|
21
23
|
callbacks: ExternalCallbacks;
|
|
22
24
|
constructor(externalCallbacks?: ExternalCallbacks);
|
|
25
|
+
onInitialization(): void;
|
|
23
26
|
onZoomTransitionDone(): void;
|
|
24
27
|
onLayoutDone(): void;
|
|
25
28
|
onLayoutStep(p: Node[]): void;
|
|
@@ -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
|
-
|
|
112
|
+
private getDataUrlForCanvas;
|
|
113
|
+
private initiateFileDownload;
|
|
114
|
+
private updateLayoutAndPositions;
|
|
113
115
|
saveToFile(options: SaveToFileOptions): void;
|
|
114
|
-
|
|
116
|
+
getImageDataURL(options: SaveToFileOptions): string;
|
|
117
|
+
private prepareLargeFileForDownload;
|
|
118
|
+
private createCanvasAndRenderImage;
|
|
115
119
|
saveFullGraphToLargeFile(options: SaveToFileOptions): Promise<void>;
|
|
116
120
|
}
|
|
117
121
|
export {};
|
|
@@ -12,9 +12,7 @@ export interface LabelGeometry {
|
|
|
12
12
|
*/
|
|
13
13
|
export default class ArrowBundle {
|
|
14
14
|
key: string;
|
|
15
|
-
rels:
|
|
16
|
-
rel: Relationship;
|
|
17
|
-
}[];
|
|
15
|
+
rels: Map<string, Relationship>;
|
|
18
16
|
waypointPath: WaypointPath;
|
|
19
17
|
readonly selfReferring: boolean;
|
|
20
18
|
fromId: string;
|
|
@@ -33,6 +31,7 @@ export default class ArrowBundle {
|
|
|
33
31
|
*/
|
|
34
32
|
insert(rel: Relationship): void;
|
|
35
33
|
setLabelInfo(relId: string, labelInfo: LabelGeometry): void;
|
|
34
|
+
has({ id }: Relationship): boolean;
|
|
36
35
|
/**
|
|
37
36
|
* Remove an arrow from the bundle
|
|
38
37
|
* @param {Relationship} rel - The arrow to remove
|
|
@@ -43,6 +42,7 @@ export default class ArrowBundle {
|
|
|
43
42
|
* @returns {number} The size of the arrow bundle
|
|
44
43
|
*/
|
|
45
44
|
size(): number;
|
|
45
|
+
relArray(): Relationship[];
|
|
46
46
|
/**
|
|
47
47
|
* Get the maximum font size of the arrows in the bundle
|
|
48
48
|
* @returns {number} The maximum font size of the arrows in the bundle
|
|
@@ -17,7 +17,7 @@ export default class ArrowBundler {
|
|
|
17
17
|
* @param {Record<string, Relationship>} removedRels - The removed relations
|
|
18
18
|
* @param {Record<string, WaypointPath>} waypoints - The waypoints
|
|
19
19
|
*/
|
|
20
|
-
updateData(addedRels: Record<string, Relationship>, removedRels: Record<string, Relationship>, waypoints: Record<string, WaypointPath>): void;
|
|
20
|
+
updateData(addedRels: Record<string, Relationship>, removedRels: Record<string, Relationship>, updatedRels: Record<string, Relationship>, waypoints: Record<string, WaypointPath>): void;
|
|
21
21
|
/**
|
|
22
22
|
* Updates the positions of the arrow bundles based on the provided `positionMap`.
|
|
23
23
|
* @param positionMap A map of node IDs to positions.
|
|
@@ -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}
|
|
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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-nvl/base",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.9-3a97de48",
|
|
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",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "yarn global:tsc && webpack",
|
|
23
|
-
"
|
|
23
|
+
"build:dev": "yarn global:tsc && webpack --mode development",
|
|
24
|
+
"watch": "concurrently 'tsc -w' 'webpack -w --mode development' -k -n 'tsc,webpack' -c 'cyan,magenta'",
|
|
24
25
|
"test": "yarn global:jest",
|
|
25
26
|
"eslint": "yarn global:eslint ./src/",
|
|
26
27
|
"coverage": "yarn test --coverage --silent",
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
"postpack": "rm LICENSE.txt && rm CHANGELOG.md"
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"@neo4j-nvl/layout-workers": "0.3.
|
|
32
|
+
"@neo4j-nvl/layout-workers": "0.3.9-3a97de48",
|
|
32
33
|
"@segment/analytics-next": "^1.70.0",
|
|
33
34
|
"color-string": "^1.9.1",
|
|
34
35
|
"d3-force": "^3.0.0",
|
|
@@ -57,5 +58,6 @@
|
|
|
57
58
|
},
|
|
58
59
|
"peerDependencies": {
|
|
59
60
|
"neo4j-driver": "*"
|
|
60
|
-
}
|
|
61
|
+
},
|
|
62
|
+
"stableVersion": "0.3.9"
|
|
61
63
|
}
|