@neo4j-nvl/base 1.2.0 → 1.2.2
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 +29 -0
- package/README.md +1 -1
- package/dist/base.mjs +1 -1
- package/dist/types/index.d.ts +4 -0
- package/dist/types/modules/ExternalCallbackHandler.d.ts +7 -1
- package/dist/types/modules/state/types.d.ts +14 -2
- package/dist/types/modules/state/utils.d.ts +2 -2
- package/dist/types/renderers/domrenderer/canvasrenderer/arrowDrawing.d.ts +2 -16
- package/dist/types/renderers/domrenderer/shared/arrows/arrows.d.ts +4 -6
- package/package.json +4 -4
package/dist/types/index.d.ts
CHANGED
|
@@ -139,7 +139,11 @@ declare class NVL {
|
|
|
139
139
|
removeRelationshipsWithIds(relationshipIds: string[]): void;
|
|
140
140
|
/**
|
|
141
141
|
* Returns all nodes that is currently stored in the visualisation.
|
|
142
|
+
* `x` and `y` are client/screen coordinates relative to the canvas.
|
|
142
143
|
* @returns The array of {@link Node nodes}.
|
|
144
|
+
*
|
|
145
|
+
* @note In the next major release, `x` and `y` become layout coordinates and
|
|
146
|
+
* screen coordinates move to a `clientPosition` field.
|
|
143
147
|
*/
|
|
144
148
|
getNodes(): Node[];
|
|
145
149
|
/**
|
|
@@ -5,7 +5,13 @@ import type { Node } from '../types/graph-element';
|
|
|
5
5
|
export interface ExternalCallbacks {
|
|
6
6
|
/** Triggered when a layout is done moving. */
|
|
7
7
|
onLayoutDone?: () => void;
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Triggered on each step of a layout.
|
|
10
|
+
* Node `x` and `y` are client/screen coordinates relative to the canvas.
|
|
11
|
+
*
|
|
12
|
+
* @note In the next major release, `x` and `y` become layout coordinates and
|
|
13
|
+
* screen coordinates move to a `clientPosition` field.
|
|
14
|
+
*/
|
|
9
15
|
onLayoutStep?: (p: Node[]) => void;
|
|
10
16
|
/** Triggered when NVL throws an error after initialization. */
|
|
11
17
|
onError?: (error: Error) => void;
|
|
@@ -43,6 +43,9 @@ export interface ForceDirectedOptions {
|
|
|
43
43
|
* rendering problems on Intel graphics hardware.
|
|
44
44
|
*
|
|
45
45
|
* @remarks Requires a restart of NVL as shaders need to be recompiled.
|
|
46
|
+
*
|
|
47
|
+
* @deprecated This option will be removed in a future release, where WebGL will be upgraded to WebGL2,
|
|
48
|
+
* which resolves the compatibility issues with Intel GPUs.
|
|
46
49
|
*/
|
|
47
50
|
intelWorkaround?: boolean;
|
|
48
51
|
/**
|
|
@@ -223,7 +226,16 @@ export interface NvlOptions {
|
|
|
223
226
|
disabledItemColor?: string;
|
|
224
227
|
/** The color to use for the labels of the disabled nodes and relationships */
|
|
225
228
|
disabledItemFontColor?: string;
|
|
226
|
-
/**
|
|
229
|
+
/**
|
|
230
|
+
* Stroke color for overlay UI lines (e.g. minimap viewport box).
|
|
231
|
+
* Use a dark color on light backgrounds and a light color on dark backgrounds.
|
|
232
|
+
* @defaultValue `#1A1B1D`
|
|
233
|
+
*/
|
|
234
|
+
overlayLineColor?: string;
|
|
235
|
+
/**
|
|
236
|
+
* The color to use for the viewport box in the minimap.
|
|
237
|
+
* @deprecated Use {@link overlayLineColor}.
|
|
238
|
+
*/
|
|
227
239
|
minimapViewportBoxColor?: string;
|
|
228
240
|
};
|
|
229
241
|
/**
|
|
@@ -317,6 +329,6 @@ export interface NvlState {
|
|
|
317
329
|
disabledItemStyles: DisabledItemStyles;
|
|
318
330
|
defaultNodeColor: string;
|
|
319
331
|
defaultRelationshipColor: string;
|
|
320
|
-
|
|
332
|
+
overlayLineColor: string;
|
|
321
333
|
}
|
|
322
334
|
export {};
|
|
@@ -6,7 +6,7 @@ import type { NvlOptions } from './types';
|
|
|
6
6
|
* If both caption and captions are provided, captions takes precedence.
|
|
7
7
|
*/
|
|
8
8
|
export declare const processCaptions: (item: Partial<Node | Relationship>) => StyledCaption[];
|
|
9
|
-
export declare const processColorStyles: (styling
|
|
9
|
+
export declare const processColorStyles: (styling?: NvlOptions["styling"]) => {
|
|
10
10
|
nodeBorderStyles: {
|
|
11
11
|
default: {
|
|
12
12
|
rings?: {
|
|
@@ -42,5 +42,5 @@ export declare const processColorStyles: (styling: NvlOptions["styling"]) => {
|
|
|
42
42
|
};
|
|
43
43
|
defaultNodeColor: string;
|
|
44
44
|
defaultRelationshipColor: string;
|
|
45
|
-
|
|
45
|
+
overlayLineColor: string;
|
|
46
46
|
};
|
|
@@ -18,20 +18,6 @@ export declare const calculateLabelDimensions: (fullCaption: string, measureWidt
|
|
|
18
18
|
label: string;
|
|
19
19
|
width: number;
|
|
20
20
|
};
|
|
21
|
-
/**
|
|
22
|
-
* Calculate label transform including rotation and flip adjustments.
|
|
23
|
-
*
|
|
24
|
-
* @param angle - The base rotation angle in radians
|
|
25
|
-
* @param fontSize - The font size in pixels (including pixel ratio scaling)
|
|
26
|
-
* @param flip - Whether to flip the label (applies additional rotation)
|
|
27
|
-
* @param point - The base point (used to calculate offset in flip case)
|
|
28
|
-
* @returns object with final position and angle
|
|
29
|
-
*/
|
|
30
|
-
export declare const calculateLabelTransform: (angle: number, fontSize: number, flip: boolean, point: Point) => {
|
|
31
|
-
finalX: number;
|
|
32
|
-
finalY: number;
|
|
33
|
-
finalAngle: number;
|
|
34
|
-
};
|
|
35
21
|
/**
|
|
36
22
|
* Calculate vertical alignment offset for label based on caption alignment.
|
|
37
23
|
*
|
|
@@ -55,7 +41,7 @@ export declare const calculateLabelHeightAlign: (captionAlign: string, fontSize:
|
|
|
55
41
|
* @param flip - Whether the label is flipped
|
|
56
42
|
* @returns object with position, rotation, width, and height for hit detection
|
|
57
43
|
*/
|
|
58
|
-
export declare const calculateLabelGeometry: (point: Point, angle: number, maxWidth: number, fontSize: number, heightAlign: number, padding: number, pixelRatio: number
|
|
44
|
+
export declare const calculateLabelGeometry: (point: Point, angle: number, maxWidth: number, fontSize: number, heightAlign: number, padding: number, pixelRatio: number) => {
|
|
59
45
|
position: {
|
|
60
46
|
x: number;
|
|
61
47
|
y: number;
|
|
@@ -164,5 +150,5 @@ export declare const drawLoop: (ctx: CanvasRenderingContext2D, fromPoint: Point,
|
|
|
164
150
|
* @param fontColor - The font color to use
|
|
165
151
|
* @param flip - Whether to flip the label orientation (default false)
|
|
166
152
|
*/
|
|
167
|
-
export declare const drawLabel: (ctx: CanvasRenderingContext2D, point: Point, angle: number, maxWidth: number, rel: Relationship, bundle: ArrowBundle, disabledItemStyles: DisabledItemStyles, fontColor: string
|
|
153
|
+
export declare const drawLabel: (ctx: CanvasRenderingContext2D, point: Point, angle: number, maxWidth: number, rel: Relationship, bundle: ArrowBundle, disabledItemStyles: DisabledItemStyles, fontColor: string) => void;
|
|
168
154
|
export {};
|
|
@@ -44,12 +44,8 @@ export declare const getSelfArrowControlPoints: (rel: Relationship, node: Node,
|
|
|
44
44
|
};
|
|
45
45
|
nodeGap: number;
|
|
46
46
|
};
|
|
47
|
-
/**
|
|
48
|
-
|
|
49
|
-
* Used by both Canvas and SVG renderers to ensure consistent positioning.
|
|
50
|
-
* This function handles all the math internally including headAngle and headSelectedAdjustment calculations.
|
|
51
|
-
*/
|
|
52
|
-
export declare const getSelfArrowLabelPosition: (apexPoint: Point, angle: number, endPoint: Point, control2Point: Point, isSelected: boolean, selectionRings: BorderStyle["rings"], relWidth?: number) => {
|
|
47
|
+
/** Calculates anchor position and readable rotation for a self-referencing relationship label. */
|
|
48
|
+
export declare const getSelfArrowLabelPosition: (apexPoint: Point, angle: number, endPoint: Point, control2Point: Point, isSelected: boolean, selectionRings: BorderStyle["rings"], relWidth?: number, captionSize?: number) => {
|
|
53
49
|
x: number;
|
|
54
50
|
y: number;
|
|
55
51
|
angle: number;
|
|
@@ -173,3 +169,5 @@ export declare const getOverlayIconAlignment: (position: [number, number], width
|
|
|
173
169
|
widthAlign: number;
|
|
174
170
|
heightAlign: number;
|
|
175
171
|
};
|
|
172
|
+
/** Vertical offset for a self-loop caption; `top`/`bottom` mean outside/inside the loop. */
|
|
173
|
+
export declare const getSelfLoopHeightAlign: (captionAlign: string, fontSize: number, lineWidth: number, padding: number, flip: 1 | -1) => number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-nvl/base",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
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.2.
|
|
33
|
+
"@neo4j-nvl/layout-workers": "1.2.2",
|
|
34
34
|
"@segment/analytics-next": "1.81.1",
|
|
35
35
|
"color-string": "1.9.1",
|
|
36
36
|
"d3-force": "3.0.0",
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
"node-pid-controller": "1.0.1",
|
|
43
43
|
"resizelistener": "1.1.0",
|
|
44
44
|
"tinycolor2": "1.6.0",
|
|
45
|
-
"uuid": "14.0.
|
|
45
|
+
"uuid": "14.0.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@babel/core": "7.
|
|
48
|
+
"@babel/core": "7.29.7",
|
|
49
49
|
"@types/color-string": "1.5.5",
|
|
50
50
|
"@types/d3-force": "3.0.10",
|
|
51
51
|
"@types/lodash": "4.17.21",
|