New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@neo4j-nvl/react

Package Overview
Dependencies
Maintainers
3
Versions
165
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@neo4j-nvl/react - npm Package Compare versions

Comparing version 0.2.27 to 0.2.28

2

lib/basic-wrapper/BasicNvlWrapper.d.ts

@@ -112,3 +112,3 @@ import type { ExternalCallbacks, Layout, LayoutOptions, Node, NvlOptions, Relationship } from '@neo4j-nvl/core';

*/
export declare const BasicNvlWrapper: React.MemoExoticComponent<React.ForwardRefExoticComponent<BasicReactWrapperProps & React.RefAttributes<IncludeMethods<NVL>>>>;
export declare const BasicNvlWrapper: React.MemoExoticComponent<React.ForwardRefExoticComponent<Pick<BasicReactWrapperProps & React.HTMLProps<HTMLDivElement>, "max" | "required" | "type" | "data" | "default" | "high" | "low" | "key" | "id" | "media" | "height" | "width" | "start" | "open" | "name" | "color" | "content" | "translate" | "value" | "hidden" | "cite" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "dir" | "pattern" | "acceptCharset" | "action" | "method" | "noValidate" | "rel" | "target" | "accessKey" | "draggable" | "lang" | "className" | "prefix" | "role" | "children" | "contentEditable" | "inputMode" | "nonce" | "tabIndex" | "async" | "disabled" | "multiple" | "size" | "manifest" | "wrap" | "accept" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "list" | "loop" | "marginHeight" | "marginWidth" | "maxLength" | "mediaGroup" | "min" | "minLength" | "muted" | "optimum" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "contextMenu" | "placeholder" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "playsInline" | "poster" | "preload" | "readOnly" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "step" | "useMap" | "wmode" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | keyof BasicReactWrapperProps> & React.RefAttributes<IncludeMethods<NVL>>>>;
export {};

@@ -102,22 +102,21 @@ var __rest = (this && this.__rest) || function (s, e) {

var { nodes, rels, layout, layoutOptions, nvlCallbacks = {}, nvlOptions = {}, onInitializationError } = _a, nvlEvents = __rest(_a, ["nodes", "rels", "layout", "layoutOptions", "nvlCallbacks", "nvlOptions", "onInitializationError"]);
const nvlRef = useRef(null);
useImperativeHandle(ref, () => {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
const nvlMethods = Object.getOwnPropertyNames(NVL.prototype);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore revisit better typing for reduce function
return nvlMethods.reduce((current, method) => (Object.assign(Object.assign({}, current), {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
return nvlMethods.reduce((current, method) => (Object.assign(Object.assign({}, current), { [method]: (...args) =>
// @ts-ignore suppress the type casting error on spreading
[method]: (...args) => nvlRef && nvlRef.current && nvlRef.current[method](...args) })), {});
nvlRef !== undefined && nvlRef.current !== null && nvlRef.current[method](...args) })), {});
});
const containerRef = useRef();
const nvlRef = useRef();
const [currentNodes, setCurrentNodes] = useState(nodes);
const [currentRels, setCurrentRels] = useState(rels);
useEffect(() => {
if (!nvlRef.current) {
let newNvl;
if (nvlRef.current === null) {
const combinedOptions = Object.assign(Object.assign({}, nvlOptions), { layoutOptions });
if (layout) {
if (layout !== undefined) {
combinedOptions.layout = layout;
}
let newNvl;
try {

@@ -137,9 +136,10 @@ newNvl = new NVL(containerRef.current, currentNodes, currentRels, combinedOptions, nvlCallbacks);

}
return () => {
newNvl === null || newNvl === void 0 ? void 0 : newNvl.destroy();
};
}
return () => {
newNvl === null || newNvl === void 0 ? void 0 : newNvl.destroy();
};
}, []);
useEffect(() => {
if (!nvlRef.current) {
var _a, _b, _c;
if (nvlRef.current === null) {
return;

@@ -152,21 +152,23 @@ }

setCurrentNodes(nodes);
nvlRef.current &&
nvlRef.current.addAndUpdateElementsInGraph([...nodeChanges.added, ...nodeDiff], [...relChanges.added, ...relChanges.updated]);
nvlRef.current &&
nvlRef.current.removeRelationshipsWithIds(relChanges.removed.map((r) => r.id));
nvlRef.current && nvlRef.current.removeNodesWithIds(nodeChanges.removed.map((n) => n.id));
(_a = nvlRef.current) === null || _a === void 0 ? void 0 : _a.addAndUpdateElementsInGraph([...nodeChanges.added, ...nodeDiff], [...relChanges.added, ...relChanges.updated]);
(_b = nvlRef.current) === null || _b === void 0 ? void 0 : _b.removeRelationshipsWithIds(relChanges.removed.map((r) => r.id));
(_c = nvlRef.current) === null || _c === void 0 ? void 0 : _c.removeNodesWithIds(nodeChanges.removed.map((n) => n.id));
}, [nodes, rels]);
useEffect(() => {
nvlRef.current && nvlRef.current.setLayout(layout);
var _a;
(_a = nvlRef.current) === null || _a === void 0 ? void 0 : _a.setLayout(layout);
}, [layout]);
useDeepCompareEffect(() => {
nvlRef.current && nvlRef.current.setLayoutOptions(layoutOptions);
var _a;
(_a = nvlRef.current) === null || _a === void 0 ? void 0 : _a.setLayoutOptions(layoutOptions);
}, [layoutOptions]);
useEffect(() => {
nvlRef.current && nvlRef.current.setUseWebGLRenderer(nvlOptions.useWebGL);
var _a;
(_a = nvlRef.current) === null || _a === void 0 ? void 0 : _a.setUseWebGLRenderer(nvlOptions.useWebGL);
}, [nvlOptions.useWebGL]);
useEffect(() => {
nvlRef.current && nvlRef.current.setDisableWebGL(nvlOptions.disableWebGL);
var _a;
(_a = nvlRef.current) === null || _a === void 0 ? void 0 : _a.setDisableWebGL(nvlOptions.disableWebGL);
}, [nvlOptions.disableWebGL]);
return React.createElement("div", Object.assign({ ref: containerRef, style: { height: '100%', outline: '0' } }, nvlEvents));
}));

@@ -42,5 +42,5 @@ import type NVL from '@neo4j-nvl/core';

* mouseEventCallbacks={{
* onHover: (element) => console.log(element),
* onNodeClick: (node) => console.log(node),
* onMultiSelect: multiSelect
* onHover: (element) => console.log(element),
* onNodeClick: (node) => console.log(node),
* onMultiSelect: multiSelect
* }}

@@ -47,0 +47,0 @@ * />

@@ -11,3 +11,4 @@ import { ClickInteraction, DragNodeInteraction, DrawInteraction, HoverInteraction, MultiSelectInteraction, PanInteraction, ZoomInteraction } from '@neo4j-nvl/interaction-handlers';

const destroyInteraction = (interactionRef) => {
interactionRef.current && interactionRef.current.destroy();
var _a;
(_a = interactionRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
// eslint-disable-next-line @typescript-eslint/ban-ts-comment

@@ -20,4 +21,4 @@ // @ts-ignore

setTimeout(() => {
if (callback) {
if (!interactionRef.current) {
if (callback === true || typeof callback === 'function') {
if (interactionRef.current === null || interactionRef.current === undefined) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment

@@ -65,5 +66,5 @@ // @ts-ignore

* mouseEventCallbacks={{
* onHover: (element) => console.log(element),
* onNodeClick: (node) => console.log(node),
* onMultiSelect: multiSelect
* onHover: (element) => console.log(element),
* onNodeClick: (node) => console.log(node),
* onMultiSelect: multiSelect
* }}

@@ -74,3 +75,3 @@ * />

*/
export const InteractiveNvlWrapper = memo(forwardRef(({ nodes, rels, layout, layoutOptions, mouseEventCallbacks, nvlCallbacks, nvlOptions = {}, interactionOptions = options }, nvlRef) => {
export const InteractiveNvlWrapper = memo(forwardRef(({ nodes, rels, layout, layoutOptions, mouseEventCallbacks = {}, nvlCallbacks = {}, nvlOptions = {}, interactionOptions = options }, nvlRef) => {
const myNvlRef = nvlRef !== null ? nvlRef : useRef(null);

@@ -77,0 +78,0 @@ const { onHover, onNodeClick, onNodeDoubleClick, onNodeRightClick, onRelationshipClick, onRelationshipDoubleClick, onRelationshipRightClick, onCanvasClick, onCanvasRightClick, onPan, onZoom, onDrag, onDragStart, onDragEnd, onDrawEnd, onMultiSelect } = mouseEventCallbacks;

@@ -19,19 +19,21 @@ import { isEqual, keyBy, keys, sortBy, transform } from 'lodash';

}
i++;
j++;
i += 1;
j += 1;
}
else if (prevId < currId) {
removed.push(prevId);
i++;
i += 1;
}
else {
added.push(currId);
j++;
j += 1;
}
}
while (i < prevIds.length) {
removed.push(prevIds[i++]);
removed.push(prevIds[i]);
i += 1;
}
while (j < currentIds.length) {
added.push(currentIds[j++]);
added.push(currentIds[j]);
j += 1;
}

@@ -49,3 +51,3 @@ return {

const previousNode = prevNodeMap[nodeToUpdate.id];
if (!previousNode) {
if (previousNode === undefined) {
return null;

@@ -59,4 +61,4 @@ }

})
.filter((n) => n && Object.keys(n).length > 1);
.filter((n) => n !== null && Object.keys(n).length > 1);
};
export { getNodeAttributeDifferences, getMapDifferences };
{
"name": "@neo4j-nvl/react",
"version": "0.2.27",
"version": "0.2.28",
"main": "lib/index.js",

@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN 'Neo4j Early Access Agreement - Visualization Library.pdf'",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc