@neo4j-nvl/interaction-handlers
Advanced tools
Comparing version 0.2.8 to 0.2.9
@@ -6,5 +6,6 @@ import type { ClickInteractionCallbacks, ClickInteractionOptions } from './interaction-handlers/click-interaction'; | ||
import { DrawInteraction } from './interaction-handlers/draw-interaction'; | ||
import type { DrawInteractionCallbacks } from './interaction-handlers/draw-interaction'; | ||
import type { HoverInteractionOptions, HoverInteractionCallbacks } from './interaction-handlers/hover-interaction'; | ||
import { HoverInteraction } from './interaction-handlers/hover-interaction'; | ||
import type { MultiSelectInteractionOptions } from './interaction-handlers/multi-select-interaction'; | ||
import type { MultiSelectInteractionOptions, MultiSelectInteractionCallbacks } from './interaction-handlers/multi-select-interaction'; | ||
import { MultiSelectInteraction } from './interaction-handlers/multi-select-interaction'; | ||
@@ -15,3 +16,3 @@ import type { PanInteractionCallbacks } from './interaction-handlers/pan-interaction'; | ||
import { ZoomInteraction } from './interaction-handlers/zoom-interaction'; | ||
export type { MultiSelectInteractionOptions, ClickInteractionOptions, HoverInteractionOptions, HoverInteractionCallbacks, DragNodeInteractionCallbacks, ClickInteractionCallbacks, PanInteractionCallbacks, ZoomInteractionCallbacks }; | ||
export type { MultiSelectInteractionOptions, MultiSelectInteractionCallbacks, ClickInteractionOptions, HoverInteractionOptions, HoverInteractionCallbacks, DragNodeInteractionCallbacks, ClickInteractionCallbacks, PanInteractionCallbacks, ZoomInteractionCallbacks, DrawInteractionCallbacks }; | ||
export { ZoomInteraction, PanInteraction, MultiSelectInteraction, ClickInteraction, HoverInteraction, DragNodeInteraction, DrawInteraction }; |
@@ -7,3 +7,3 @@ import { NVL } from '@neo4j-nvl/core'; | ||
*/ | ||
declare abstract class BaseInteraction<T extends Record<string, (...args: unknown[]) => void>> { | ||
declare abstract class BaseInteraction<T extends Record<string, ((...args: unknown[]) => void) | boolean>> { | ||
private readonly nvl; | ||
@@ -38,3 +38,3 @@ private readonly container; | ||
*/ | ||
callCallbackIfRegistered: (name: keyof T, ...args: Parameters<T[keyof T]>) => void; | ||
callCallbackIfRegistered: (name: keyof T, ...args: any) => void; | ||
/** | ||
@@ -41,0 +41,0 @@ * Add or update a callback for a given event of type. |
@@ -63,3 +63,3 @@ /** | ||
const callback = this.callbackMap.get(name); | ||
if (callback) { | ||
if (typeof callback === 'function') { | ||
callback(...args); | ||
@@ -66,0 +66,0 @@ } |
@@ -23,3 +23,3 @@ import type { HitTargets, NVL, Node, Relationship } from '@neo4j-nvl/core'; | ||
*/ | ||
onNodeClick: (nodes: Node, hitElements: HitTargets, event: MouseEvent) => void; | ||
onNodeClick?: ((nodes: Node, hitElements: HitTargets, event: MouseEvent) => void) | boolean; | ||
/** | ||
@@ -31,3 +31,3 @@ * Called when a relationship is clicked | ||
*/ | ||
onRelationshipClick: (relationship: Relationship, hitElements: HitTargets, event: MouseEvent) => void; | ||
onRelationshipClick?: ((relationship: Relationship, hitElements: HitTargets, event: MouseEvent) => void) | boolean; | ||
/** | ||
@@ -37,3 +37,3 @@ * Called when the canvas is clicked | ||
*/ | ||
onCanvasClick: (event: MouseEvent) => void; | ||
onCanvasClick?: ((event: MouseEvent) => void) | boolean; | ||
/** | ||
@@ -43,3 +43,3 @@ * Called when a node is double clicked | ||
*/ | ||
onCanvasDoubleClick: (event: MouseEvent) => void; | ||
onCanvasDoubleClick?: ((event: MouseEvent) => void) | boolean; | ||
/** | ||
@@ -49,3 +49,3 @@ * Called when a relationship is right-clicked | ||
*/ | ||
onCanvasRightClick: (event: MouseEvent) => void; | ||
onCanvasRightClick?: ((event: MouseEvent) => void) | boolean; | ||
/** | ||
@@ -57,3 +57,3 @@ * Called when a node is double-clicked | ||
*/ | ||
onNodeDoubleClick: (node: Node, hitElements: HitTargets, event: MouseEvent) => void; | ||
onNodeDoubleClick?: ((node: Node, hitElements: HitTargets, event: MouseEvent) => void) | boolean; | ||
/** | ||
@@ -65,3 +65,3 @@ * Called when a node is right-clicked | ||
*/ | ||
onNodeRightClick: (node: Node, hitElements: HitTargets, event: MouseEvent) => void; | ||
onNodeRightClick?: ((node: Node, hitElements: HitTargets, event: MouseEvent) => void) | boolean; | ||
/** | ||
@@ -73,3 +73,3 @@ * Called when a relationship is double-clicked | ||
*/ | ||
onRelationshipDoubleClick: (relationship: Relationship, hitElements: HitTargets, event: MouseEvent) => void; | ||
onRelationshipDoubleClick?: ((relationship: Relationship, hitElements: HitTargets, event: MouseEvent) => void) | boolean; | ||
/** | ||
@@ -81,3 +81,3 @@ * Called when a relationship is right-clicked | ||
*/ | ||
onRelationshipRightClick: (relationship: Relationship, hitElements: HitTargets, event: MouseEvent) => void; | ||
onRelationshipRightClick?: ((relationship: Relationship, hitElements: HitTargets, event: MouseEvent) => void) | boolean; | ||
}; | ||
@@ -84,0 +84,0 @@ /** |
@@ -11,3 +11,3 @@ import type { NVL, Node } from '@neo4j-nvl/core'; | ||
*/ | ||
onDrag: (nodes: Node[]) => void; | ||
onDrag?: ((nodes: Node[]) => void) | boolean; | ||
}; | ||
@@ -14,0 +14,0 @@ /** |
@@ -5,6 +5,12 @@ import { NVL, Node, Relationship } from '@neo4j-nvl/core'; | ||
* @internal | ||
* @experimental | ||
*/ | ||
export declare class DrawInteraction extends BaseInteraction<{ | ||
onDrawEnd: (newRelationshipToAdd: Relationship | null, newTargetNodeToAdd: Node | null) => void; | ||
}> { | ||
export type DrawInteractionCallbacks = { | ||
onDrawEnd?: ((newRelationshipToAdd: Relationship | null, newTargetNodeToAdd: Node | null) => void) | boolean; | ||
}; | ||
/** | ||
* @internal | ||
* @experimental | ||
*/ | ||
export declare class DrawInteraction extends BaseInteraction<DrawInteractionCallbacks> { | ||
private overlayRenderer; | ||
@@ -11,0 +17,0 @@ private isMoved; |
@@ -7,2 +7,3 @@ import { OverlayRenderer } from '../overlay-renderer/overlay-renderer'; | ||
* @internal | ||
* @experimental | ||
*/ | ||
@@ -9,0 +10,0 @@ export class DrawInteraction extends BaseInteraction { |
@@ -25,3 +25,3 @@ import type { HitTargets, NVL, Node, Relationship } from '@neo4j-nvl/core'; | ||
*/ | ||
onHover: (element: Node | Relationship, hitElements: HitTargets, event: MouseEvent) => void; | ||
onHover?: ((element: Node | Relationship, hitElements: HitTargets, event: MouseEvent) => void) | boolean; | ||
}; | ||
@@ -28,0 +28,0 @@ /** |
@@ -19,6 +19,6 @@ import type { NVL, Node, Relationship } from '@neo4j-nvl/core'; | ||
*/ | ||
onMultiSelect: ({ nodes, rels }: { | ||
onMultiSelect?: (({ nodes, rels }: { | ||
nodes: Node[]; | ||
rels: Relationship[]; | ||
}) => void; | ||
}) => void) | boolean; | ||
}; | ||
@@ -25,0 +25,0 @@ /** |
@@ -11,6 +11,6 @@ import { NVL } from '@neo4j-nvl/core'; | ||
*/ | ||
onPan: (panning: { | ||
onPan?: ((panning: { | ||
x: number; | ||
y: number; | ||
}) => void; | ||
}) => void) | boolean; | ||
}; | ||
@@ -17,0 +17,0 @@ /** |
@@ -11,3 +11,3 @@ import { NVL } from '@neo4j-nvl/core'; | ||
*/ | ||
onZoom: (zoomLevel: number) => void; | ||
onZoom?: (zoomLevel: number) => void | boolean; | ||
}; | ||
@@ -14,0 +14,0 @@ /** |
{ | ||
"name": "@neo4j-nvl/interaction-handlers", | ||
"version": "0.2.8", | ||
"version": "0.2.9", | ||
"license": "SEE LICENSE IN 'Neo4j Early Access Agreement - Visualization Library.pdf'", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
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
267008
1741