@neo4j-nvl/base
Advanced tools
Comparing version 0.3.5 to 0.3.6-51f1e11c
@@ -0,3 +1,14 @@ | ||
/*! | ||
* The buffer module from node.js, for the browser. | ||
* | ||
* @author Feross Aboukhadijeh <https://feross.org> | ||
* @license MIT | ||
*/ | ||
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ | ||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ | ||
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */ | ||
/** | ||
@@ -4,0 +15,0 @@ * @license |
@@ -10,2 +10,4 @@ import type { ExternalCallbacks } from './modules/ExternalCallbackHandler'; | ||
import type { HitTargetNode, HitTargetRelationship, HitTargets } from './utils/hittest'; | ||
import { nvlResultTransformer } from './utils/jsDriverResultTransformer'; | ||
import { getZoomTargetForNodePositions } from './utils/zoomFunctions'; | ||
/** | ||
@@ -189,3 +191,3 @@ * Extends the MouseEvent interface with the {@link HitTargets} property. | ||
*/ | ||
fit(nodeIds: string[], zoomOptions: NvlState['zoomOptions']): void; | ||
fit(nodeIds: string[], zoomOptions?: NvlState['zoomOptions']): void; | ||
/** | ||
@@ -368,2 +370,2 @@ * Resets the zoom of the viewport back to the default zoom level of 0.75 | ||
export type { NvlOptions, Renderer, Node, Relationship, PartialNode, PartialRelationship, Layout, LayoutOptions, ForceDirectedOptions, HierarchicalOptions, ExternalCallbacks, HitTargets, HitTargetNode, HitTargetRelationship, Point, NvlMouseEvent, ZoomOptions, StyledCaption, WebGLRendererType, CanvasRendererType }; | ||
export { NVL, colorMapperFunctions, CompatibilityError, ForceDirectedLayoutType, HierarchicalLayoutType, GridLayoutType, FreeLayoutType, d3ForceLayoutType, drawCircleBand }; | ||
export { NVL, colorMapperFunctions, CompatibilityError, ForceDirectedLayoutType, HierarchicalLayoutType, GridLayoutType, FreeLayoutType, d3ForceLayoutType, drawCircleBand, nvlResultTransformer, getZoomTargetForNodePositions }; |
@@ -18,3 +18,3 @@ import type { NvlState } from '../../../modules/state'; | ||
pendingLayoutData: LayoutData; | ||
worker: SharedWorker | any; | ||
worker: SharedWorker; | ||
constructor(config: { | ||
@@ -25,3 +25,3 @@ state: NvlState; | ||
}); | ||
setupWorker(): Promise<unknown>; | ||
setupWorker(): Promise<SharedWorker>; | ||
setOptions(): void; | ||
@@ -28,0 +28,0 @@ update(refreshPositions?: boolean, updateMobXNodes?: Node[], updateMobXRelationships?: Relationship[]): void; |
@@ -22,3 +22,3 @@ export default class SolarMerger { | ||
nodeSortMap: {}; | ||
coarsenBy(level: any): { | ||
coarsenBy(levelToCoarsenBy: any): { | ||
nodes: any[]; | ||
@@ -25,0 +25,0 @@ relationships: any[]; |
@@ -10,3 +10,3 @@ export class GridLayout { | ||
update(refreshPositions?: boolean): void; | ||
layout(nodes: any, nodeIds: any, idToPosition: any, rels: any): void; | ||
layout(mobxNodes: any, nodeIds: any, idToPosition: any, rels: any): void; | ||
getNodePositions(nodeList: any): any[]; | ||
@@ -13,0 +13,0 @@ getShouldUpdate(): boolean; |
@@ -18,3 +18,3 @@ import { type HierarchicalOptions, type LayoutOptions, type NvlState } from '../../modules/state'; | ||
constructor(config: HierarchicalLayoutConfig); | ||
setupWorker(): Promise<unknown>; | ||
setupWorker(): Promise<SharedWorker>; | ||
setOptions(options: LayoutOptions): void; | ||
@@ -21,0 +21,0 @@ update(refreshPositions?: boolean): void; |
@@ -15,2 +15,4 @@ import type { Node } from '../types/graph-element'; | ||
onWebGLContextLost?: (webGLContextEvent: WebGLContextEvent) => void; | ||
/** Triggered when a zoom transition (e.g. {@link NVL.fit} or {@link NVL.resetZoom}) function is done. */ | ||
onZoomTransitionDone?: () => void; | ||
restart?: () => void; | ||
@@ -22,2 +24,3 @@ } | ||
constructor(externalCallbacks?: ExternalCallbacks); | ||
onZoomTransitionDone(): void; | ||
onLayoutDone(): void; | ||
@@ -24,0 +27,0 @@ onLayoutStep(p: Node[]): void; |
@@ -11,2 +11,3 @@ import type { Node, Relationship } from '../types/graph-element'; | ||
export declare const EVENT_ERROR = "onError"; | ||
export declare const EVENT_ZOOM_TRANSITION_DONE = "onZoomTransitionDone"; | ||
export declare const EVENT_LAYOUT_DONE = "onLayoutDone"; | ||
@@ -99,3 +100,3 @@ export declare const EVENT_LAYOUT_STEP = "onLayoutStep"; | ||
setZoomAndPan(zoom: number, panX: number, panY: number): void; | ||
fit(nodeIds: string[], zoomOptions: ZoomOptions): void; | ||
fit(nodeIds: string[], zoomOptions?: ZoomOptions): void; | ||
resetZoom(): void; | ||
@@ -102,0 +103,0 @@ setRenderer(renderer: string): void; |
@@ -16,6 +16,6 @@ /** | ||
* by a call to endTest(). Tests can be nested. | ||
* @param {String} name String identifying this measurement. Only used for printing, so | ||
* @param {String} measurement String identifying this measurement. Only used for printing, so | ||
* keep it human readable. | ||
*/ | ||
startTest(name: string): void; | ||
startTest(measurement: string): void; | ||
/** | ||
@@ -22,0 +22,0 @@ * Ends the last started test, giving it an end time. |
@@ -133,3 +133,8 @@ import type { LogLevelDesc } from 'loglevel'; | ||
frame?: HTMLElement; | ||
/** The DOM container in which to render the minimap */ | ||
/** | ||
* The DOM container in which to render the minimap. | ||
* | ||
* @note When using a React ref, make sure the attached element is rendered before the NVL instance is created. | ||
* Otherwise, the minimap will not be displayed. | ||
*/ | ||
minimapContainer?: HTMLElement; | ||
@@ -200,2 +205,4 @@ /** Configuration for the current layout */ | ||
maxZoom?: number; | ||
/** If true, will not animate the zoom/pan transition. */ | ||
animated?: boolean; | ||
}; | ||
@@ -202,0 +209,0 @@ export interface NvlState { |
@@ -12,12 +12,10 @@ import PIDController from 'node-pid-controller'; | ||
private readonly canvas; | ||
private readonly defaultZoomLevel; | ||
private readonly stateDisposers; | ||
constructor({ state, getNodePositions, canvas, defaultZoomLevel }: { | ||
constructor({ state, getNodePositions, canvas }: { | ||
state: NvlState; | ||
getNodePositions: (data: Node[]) => Node[]; | ||
canvas: HTMLCanvasElement; | ||
defaultZoomLevel: number; | ||
}); | ||
needsToRun(): boolean; | ||
update(layoutActive: boolean): void; | ||
update(layoutActive: boolean, onTransitionCompleted?: () => void): void; | ||
destroy(): void; | ||
@@ -24,0 +22,0 @@ private recalculateTarget; |
@@ -68,5 +68,11 @@ import type { StyledCaption } from '../renderers/canvasrenderer/types'; | ||
pinned?: boolean; | ||
/** The x-coordinate for the position of the node.*/ | ||
/** | ||
* @ignore | ||
* The x-coordinate for the position of the node. | ||
*/ | ||
x?: number; | ||
/** The y-coordinate for the position of the node.*/ | ||
/** | ||
* @ignore | ||
* The y-coordinate for the position of the node. | ||
*/ | ||
y?: number; | ||
@@ -73,0 +79,0 @@ /** Whether or not the current node is activated.*/ |
@@ -5,2 +5,8 @@ import type { Node } from '../index'; | ||
declare const getMaxDistance: (extremeLimits?: Point[]) => number; | ||
/** | ||
* Gets the center choordinates and the width and height for the given node positions | ||
* @param {Point[] | Node[]} nodePositions - The node positions | ||
* @param {number} maxNodeRadius - The maximum node radius | ||
* @returns An object with the center x and y coordinates and the width and height | ||
*/ | ||
declare const getPositionBoundaries: (nodePositions?: Point[] | Node[], maxNodeRadius?: number) => { | ||
@@ -12,2 +18,10 @@ centerX: number; | ||
}; | ||
/** | ||
* Gets the required zoom level for the given view and scene dimensions to fit the scene into the view | ||
* @param {number} viewWidth - The width of the required view | ||
* @param {number} viewHeight - The height of the required view | ||
* @param {number} sceneWidth - The width of the canvas scene | ||
* @param {number} sceneHeight - The height of the canvas scene | ||
* @returns An object with the zoom level for the x and y axis | ||
*/ | ||
declare const getZoomLevel: (viewWidth: number, viewHeight: number, sceneWidth: number, sceneHeight: number) => { | ||
@@ -17,3 +31,20 @@ zoomX: number; | ||
}; | ||
/** | ||
* Creates a zoom target based on the given zoom levels and the min and max zoom level | ||
* @param {number} zoomX - The zoom level for the x axis | ||
* @param {number} zoomY - The zoom level for the y axis | ||
* @param {number} minZoom - The minimum zoom level | ||
* @param {number} maxZoom - The maximum zoom level | ||
* @returns The zoom target | ||
*/ | ||
declare const createZoomTarget: (zoomX: number, zoomY: number, minZoom?: number, maxZoom?: number) => number; | ||
/** | ||
* Gets the zoom target to fit the given node positions into the scene | ||
* @param {Point[]} nodePositions - The node positions | ||
* @param {number} containerWidth - The width of the container NVL is displayed in | ||
* @param {number} containerHeight - The height of the container NVL is displayed in | ||
* @param {number} maxNodeRadius - The maximum node radius, which is added as margin to the scene (defaults to `50`) | ||
* @returns | ||
*/ | ||
declare const getZoomTargetForNodePositions: (nodePositions: Point[], containerWidth: number, containerHeight: number, maxNodeRadius?: number) => number; | ||
declare const getFlexibleZoomLimit: (nodePositions: Point[], rect: HTMLCanvasElement, maxNodeRadius: number) => number; | ||
@@ -23,2 +54,2 @@ declare const getNewZoomWithinLimits: (newZoom: number, oldZoom: number, minZoom: number, maxZoom: number) => number; | ||
declare const getDynamicZoom: (nodePositions: Point[] & Node[], minZoom: number, maxZoom: number, rect: HTMLCanvasElement, newZoom: number, currentZoom: number) => number; | ||
export { getFlexibleZoomLimit, isZoomOutAtLimit, getNewZoomWithinLimits, getExtremeLimits, getMaxDistance, getPositionBoundaries, getZoomLevel, createZoomTarget, getDynamicZoom }; | ||
export { getFlexibleZoomLimit, getZoomTargetForNodePositions, isZoomOutAtLimit, getNewZoomWithinLimits, getExtremeLimits, getMaxDistance, getPositionBoundaries, getZoomLevel, createZoomTarget, getDynamicZoom }; |
{ | ||
"name": "@neo4j-nvl/base", | ||
"version": "0.3.5", | ||
"version": "0.3.6-51f1e11c", | ||
"license": "SEE LICENSE IN 'LICENSE.txt'", | ||
@@ -25,3 +25,3 @@ "homepage": "https://neo4j.com/docs/nvl/current/", | ||
"test": "yarn global:jest", | ||
"eslint": "yarn global:eslint ./src/ --plugin only-warn", | ||
"eslint": "yarn global:eslint ./src/", | ||
"coverage": "yarn test --coverage --silent", | ||
@@ -32,3 +32,3 @@ "prepack": "cp ../../LICENSE.txt ./", | ||
"dependencies": { | ||
"@neo4j-nvl/layout-workers": "0.3.5", | ||
"@neo4j-nvl/layout-workers": "0.3.6-51f1e11c", | ||
"@segment/analytics-next": "^1.70.0", | ||
@@ -55,6 +55,11 @@ "color-string": "^1.9.1", | ||
"copy-webpack-plugin": "^11.0.0", | ||
"neo4j-driver": "^5.26.0", | ||
"typedoc": "^0.23.15", | ||
"webpack": "^5.75.0", | ||
"webpack-cli": "^5.0.0" | ||
} | ||
}, | ||
"peerDependencies": { | ||
"neo4j-driver": "*" | ||
}, | ||
"stableVersion": "0.3.6" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
1211125
101
2930
14
11
+ Added@neo4j-nvl/layout-workers@0.3.6-51f1e11c(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbuffer@6.0.3(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedneo4j-driver@5.27.0(transitive)
+ Addedneo4j-driver-bolt-connection@5.27.0(transitive)
+ Addedneo4j-driver-core@5.27.0(transitive)
+ Addedrxjs@7.8.1(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedstring_decoder@1.3.0(transitive)
- Removed@neo4j-nvl/layout-workers@0.3.5(transitive)