@xyflow/react 12.0.0-next.7 → 12.0.0-next.8
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/dist/base.css +2 -16
- package/dist/esm/additional-components/MiniMap/MiniMap.d.ts.map +1 -1
- package/dist/esm/components/EdgeWrapper/index.d.ts.map +1 -1
- package/dist/esm/components/Handle/index.d.ts +6 -2
- package/dist/esm/components/Handle/index.d.ts.map +1 -1
- package/dist/esm/container/EdgeRenderer/MarkerDefinitions.d.ts.map +1 -1
- package/dist/esm/container/FlowRenderer/index.d.ts.map +1 -1
- package/dist/esm/container/ReactFlow/index.d.ts +4 -117
- package/dist/esm/container/ReactFlow/index.d.ts.map +1 -1
- package/dist/esm/hooks/useConnection.d.ts +13 -7
- package/dist/esm/hooks/useConnection.d.ts.map +1 -1
- package/dist/esm/hooks/useDrag.d.ts +1 -1
- package/dist/esm/hooks/useDrag.d.ts.map +1 -1
- package/dist/esm/hooks/useHandleConnections.d.ts +1 -1
- package/dist/esm/hooks/useNodesInitialized.d.ts.map +1 -1
- package/dist/esm/hooks/useOnSelectionChange.d.ts +1 -1
- package/dist/esm/hooks/useUpdateNodePositions.d.ts.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +59 -42
- package/dist/esm/index.mjs +59 -42
- package/dist/esm/store/initialState.d.ts.map +1 -1
- package/dist/esm/types/component-props.d.ts +7 -7
- package/dist/esm/types/component-props.d.ts.map +1 -1
- package/dist/esm/types/general.d.ts +79 -4
- package/dist/esm/types/general.d.ts.map +1 -1
- package/dist/esm/types/instance.d.ts +93 -0
- package/dist/esm/types/instance.d.ts.map +1 -1
- package/dist/esm/types/nodes.d.ts +3 -3
- package/dist/esm/types/nodes.d.ts.map +1 -1
- package/dist/esm/types/store.d.ts +2 -2
- package/dist/esm/types/store.d.ts.map +1 -1
- package/dist/esm/utils/changes.d.ts.map +1 -1
- package/dist/style.css +10 -12
- package/dist/umd/additional-components/MiniMap/MiniMap.d.ts.map +1 -1
- package/dist/umd/components/EdgeWrapper/index.d.ts.map +1 -1
- package/dist/umd/components/Handle/index.d.ts +6 -2
- package/dist/umd/components/Handle/index.d.ts.map +1 -1
- package/dist/umd/container/EdgeRenderer/MarkerDefinitions.d.ts.map +1 -1
- package/dist/umd/container/FlowRenderer/index.d.ts.map +1 -1
- package/dist/umd/container/ReactFlow/index.d.ts +4 -117
- package/dist/umd/container/ReactFlow/index.d.ts.map +1 -1
- package/dist/umd/hooks/useConnection.d.ts +13 -7
- package/dist/umd/hooks/useConnection.d.ts.map +1 -1
- package/dist/umd/hooks/useDrag.d.ts +1 -1
- package/dist/umd/hooks/useDrag.d.ts.map +1 -1
- package/dist/umd/hooks/useHandleConnections.d.ts +1 -1
- package/dist/umd/hooks/useNodesInitialized.d.ts.map +1 -1
- package/dist/umd/hooks/useOnSelectionChange.d.ts +1 -1
- package/dist/umd/hooks/useUpdateNodePositions.d.ts.map +1 -1
- package/dist/umd/index.d.ts +1 -1
- package/dist/umd/index.d.ts.map +1 -1
- package/dist/umd/index.js +2 -2
- package/dist/umd/store/initialState.d.ts.map +1 -1
- package/dist/umd/types/component-props.d.ts +7 -7
- package/dist/umd/types/component-props.d.ts.map +1 -1
- package/dist/umd/types/general.d.ts +79 -4
- package/dist/umd/types/general.d.ts.map +1 -1
- package/dist/umd/types/instance.d.ts +93 -0
- package/dist/umd/types/instance.d.ts.map +1 -1
- package/dist/umd/types/nodes.d.ts +3 -3
- package/dist/umd/types/nodes.d.ts.map +1 -1
- package/dist/umd/types/store.d.ts +2 -2
- package/dist/umd/types/store.d.ts.map +1 -1
- package/dist/umd/utils/changes.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/esm/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { createContext, useContext, useMemo, useEffect, useRef, useState, useCallback, forwardRef, memo } from 'react';
|
|
4
4
|
import cc from 'classcat';
|
|
5
|
-
import { errorMessages, infiniteExtent, isInputDOMNode, fitView, getViewportForBounds, pointToRendererPoint, rendererPointToPoint, isNodeBase, isEdgeBase, getElementsToRemove, isRectObject, nodeToRect, getOverlappingArea, getDimensions, XYPanZoom, PanOnScrollMode, SelectionMode, getEventPosition, getNodesInside, XYDrag, snapPosition,
|
|
5
|
+
import { errorMessages, infiniteExtent, isInputDOMNode, fitView, getViewportForBounds, pointToRendererPoint, rendererPointToPoint, isNodeBase, isEdgeBase, getElementsToRemove, isRectObject, nodeToRect, getOverlappingArea, getDimensions, XYPanZoom, PanOnScrollMode, SelectionMode, getEventPosition, getNodesInside, XYDrag, snapPosition, calculateNodePosition, Position, isMouseEvent, XYHandle, getHostForElement, addEdge, getNodesBounds, clampPosition, internalsSymbol, getPositionWithOrigin, elementSelectionKeys, isEdgeVisible, MarkerType, createMarkerIds, isNumeric, getBezierEdgeCenter, getSmoothStepPath, getStraightPath, getBezierPath, getEdgePosition, getElevatedEdgeZIndex, getMarkerId, ConnectionMode, ConnectionLineType, updateConnectionLookup, adoptUserProvidedNodes, devWarn, updateNodeDimensions, updateAbsolutePositions, panBy, isMacOs, areConnectionMapsEqual, handleConnectionChange, getNodePositionWithOrigin, XYMinimap, getBoundsOfRects, ResizeControlVariant, XYResizer, XY_RESIZER_LINE_POSITIONS, XY_RESIZER_HANDLE_POSITIONS, getNodeToolbarTransform } from '@xyflow/system';
|
|
6
6
|
export { ConnectionLineType, ConnectionMode, MarkerType, PanOnScrollMode, Position, SelectionMode, addEdge, getBezierEdgeCenter, getBezierPath, getConnectedEdges, getEdgeCenter, getIncomers, getNodesBounds, getOutgoers, getSmoothStepPath, getStraightPath, getViewportForBounds, internalsSymbol, updateEdge } from '@xyflow/system';
|
|
7
7
|
import { useStoreWithEqualityFn, createWithEqualityFn } from 'zustand/traditional';
|
|
8
8
|
import { shallow } from 'zustand/shallow';
|
|
@@ -424,25 +424,25 @@ const useViewportHelper = () => {
|
|
|
424
424
|
const viewport = getViewportForBounds(bounds, width, height, minZoom, maxZoom, options?.padding ?? 0.1);
|
|
425
425
|
panZoom?.setViewport(viewport, { duration: options?.duration });
|
|
426
426
|
},
|
|
427
|
-
screenToFlowPosition: (
|
|
427
|
+
screenToFlowPosition: (clientPosition, options = { snapToGrid: true }) => {
|
|
428
428
|
const { transform, snapGrid, domNode } = store.getState();
|
|
429
429
|
if (!domNode) {
|
|
430
|
-
return
|
|
430
|
+
return clientPosition;
|
|
431
431
|
}
|
|
432
432
|
const { x: domX, y: domY } = domNode.getBoundingClientRect();
|
|
433
433
|
const correctedPosition = {
|
|
434
|
-
x:
|
|
435
|
-
y:
|
|
434
|
+
x: clientPosition.x - domX,
|
|
435
|
+
y: clientPosition.y - domY,
|
|
436
436
|
};
|
|
437
437
|
return pointToRendererPoint(correctedPosition, transform, options.snapToGrid, snapGrid);
|
|
438
438
|
},
|
|
439
|
-
flowToScreenPosition: (
|
|
439
|
+
flowToScreenPosition: (flowPosition) => {
|
|
440
440
|
const { transform, domNode } = store.getState();
|
|
441
441
|
if (!domNode) {
|
|
442
|
-
return
|
|
442
|
+
return flowPosition;
|
|
443
443
|
}
|
|
444
444
|
const { x: domX, y: domY } = domNode.getBoundingClientRect();
|
|
445
|
-
const rendererPosition = rendererPointToPoint(
|
|
445
|
+
const rendererPosition = rendererPointToPoint(flowPosition, transform);
|
|
446
446
|
return {
|
|
447
447
|
x: rendererPosition.x + domX,
|
|
448
448
|
y: rendererPosition.y + domY,
|
|
@@ -458,9 +458,7 @@ function handleParentExpand(updatedElements, updateItem) {
|
|
|
458
458
|
for (const [index, item] of updatedElements.entries()) {
|
|
459
459
|
if (item.id === updateItem.parentNode) {
|
|
460
460
|
const parent = { ...item };
|
|
461
|
-
|
|
462
|
-
parent.computed = {};
|
|
463
|
-
}
|
|
461
|
+
parent.computed ??= {};
|
|
464
462
|
const extendWidth = updateItem.position.x + updateItem.computed.width - parent.computed.width;
|
|
465
463
|
const extendHeight = updateItem.position.y + updateItem.computed.height - parent.computed.height;
|
|
466
464
|
if (extendWidth > 0 || extendHeight > 0 || updateItem.position.x < 0 || updateItem.position.y < 0) {
|
|
@@ -543,7 +541,7 @@ function applyChanges(changes, elements) {
|
|
|
543
541
|
/// each _mutate_ this object, so there's only ever one copy.
|
|
544
542
|
const updatedElement = { ...element };
|
|
545
543
|
for (const change of changes) {
|
|
546
|
-
applyChange(change, updatedElement,
|
|
544
|
+
applyChange(change, updatedElement, updatedElements);
|
|
547
545
|
}
|
|
548
546
|
updatedElements.push(updatedElement);
|
|
549
547
|
}
|
|
@@ -1264,7 +1262,7 @@ function useDrag({ nodeRef, disabled = false, noDragClassName, handleSelector, n
|
|
|
1264
1262
|
handleNodeClick({
|
|
1265
1263
|
id,
|
|
1266
1264
|
store,
|
|
1267
|
-
nodeRef
|
|
1265
|
+
nodeRef,
|
|
1268
1266
|
});
|
|
1269
1267
|
},
|
|
1270
1268
|
onDragStart: () => {
|
|
@@ -1306,7 +1304,7 @@ const selectedAndDraggable = (nodesDraggable) => (n) => n.selected && (n.draggab
|
|
|
1306
1304
|
function useUpdateNodePositions() {
|
|
1307
1305
|
const store = useStoreApi();
|
|
1308
1306
|
const updatePositions = useCallback((params) => {
|
|
1309
|
-
const { nodeExtent, nodes, snapToGrid, snapGrid, nodesDraggable, onError, updateNodePositions } = store.getState();
|
|
1307
|
+
const { nodeExtent, nodes, snapToGrid, snapGrid, nodesDraggable, onError, updateNodePositions, nodeLookup, nodeOrigin, } = store.getState();
|
|
1310
1308
|
const selectedNodes = nodes.filter(selectedAndDraggable(nodesDraggable));
|
|
1311
1309
|
// by default a node moves 5px on each key press, or 20px if shift is pressed
|
|
1312
1310
|
// if snap grid is enabled, we use that for the velocity.
|
|
@@ -1318,17 +1316,21 @@ function useUpdateNodePositions() {
|
|
|
1318
1316
|
const nodeUpdates = selectedNodes.map((node) => {
|
|
1319
1317
|
if (node.computed?.positionAbsolute) {
|
|
1320
1318
|
let nextPosition = {
|
|
1321
|
-
x: node.computed
|
|
1322
|
-
y: node.computed
|
|
1319
|
+
x: node.computed.positionAbsolute.x + xDiff,
|
|
1320
|
+
y: node.computed.positionAbsolute.y + yDiff,
|
|
1323
1321
|
};
|
|
1324
1322
|
if (snapToGrid) {
|
|
1325
1323
|
nextPosition = snapPosition(nextPosition, snapGrid);
|
|
1326
1324
|
}
|
|
1327
|
-
const {
|
|
1325
|
+
const { position, positionAbsolute } = calculateNodePosition({
|
|
1326
|
+
nodeId: node.id,
|
|
1327
|
+
nextPosition,
|
|
1328
|
+
nodeLookup,
|
|
1329
|
+
nodeExtent,
|
|
1330
|
+
nodeOrigin,
|
|
1331
|
+
onError,
|
|
1332
|
+
});
|
|
1328
1333
|
node.position = position;
|
|
1329
|
-
if (!node.computed) {
|
|
1330
|
-
node.computed = {};
|
|
1331
|
-
}
|
|
1332
1334
|
node.computed.positionAbsolute = positionAbsolute;
|
|
1333
1335
|
}
|
|
1334
1336
|
return node;
|
|
@@ -1470,6 +1472,9 @@ const HandleComponent = forwardRef(({ type = 'source', position = Position.Top,
|
|
|
1470
1472
|
]), onMouseDown: onPointerDown, onTouchStart: onPointerDown, onClick: connectOnClick ? onClick : undefined, ref: ref, ...rest, children: children }));
|
|
1471
1473
|
});
|
|
1472
1474
|
HandleComponent.displayName = 'Handle';
|
|
1475
|
+
/**
|
|
1476
|
+
* The Handle component is the part of a node that can be used to connect nodes.
|
|
1477
|
+
*/
|
|
1473
1478
|
const Handle = memo(HandleComponent);
|
|
1474
1479
|
|
|
1475
1480
|
function InputNode({ data, isConnectable, sourcePosition = Position.Bottom }) {
|
|
@@ -1503,7 +1508,7 @@ const builtinNodeTypes = {
|
|
|
1503
1508
|
|
|
1504
1509
|
const selector$h = (s) => {
|
|
1505
1510
|
const selectedNodes = s.nodes.filter((n) => n.selected);
|
|
1506
|
-
const { width, height, x, y } = getNodesBounds(selectedNodes, s.nodeOrigin);
|
|
1511
|
+
const { width, height, x, y } = getNodesBounds(selectedNodes, { nodeOrigin: s.nodeOrigin });
|
|
1507
1512
|
return {
|
|
1508
1513
|
width,
|
|
1509
1514
|
height,
|
|
@@ -1552,14 +1557,16 @@ function NodesSelection({ onSelectionContextMenu, noPanClassName, disableKeyboar
|
|
|
1552
1557
|
} }) }));
|
|
1553
1558
|
}
|
|
1554
1559
|
|
|
1555
|
-
const selector$g = (s) =>
|
|
1560
|
+
const selector$g = (s) => {
|
|
1561
|
+
return { nodesSelectionActive: s.nodesSelectionActive, userSelectionActive: s.userSelectionActive };
|
|
1562
|
+
};
|
|
1556
1563
|
const FlowRendererComponent = ({ children, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneContextMenu, onPaneScroll, deleteKeyCode, selectionKeyCode, selectionOnDrag, selectionMode, onSelectionStart, onSelectionEnd, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, elementsSelectable, zoomOnScroll, zoomOnPinch, panOnScroll: _panOnScroll, panOnScrollSpeed, panOnScrollMode, zoomOnDoubleClick, panOnDrag: _panOnDrag, defaultViewport, translateExtent, minZoom, maxZoom, preventScrolling, onSelectionContextMenu, noWheelClassName, noPanClassName, disableKeyboardA11y, onViewportChange, isControlledViewport, }) => {
|
|
1557
|
-
const nodesSelectionActive = useStore(selector$g);
|
|
1564
|
+
const { nodesSelectionActive, userSelectionActive } = useStore(selector$g);
|
|
1558
1565
|
const selectionKeyPressed = useKeyPress(selectionKeyCode);
|
|
1559
1566
|
const panActivationKeyPressed = useKeyPress(panActivationKeyCode);
|
|
1560
1567
|
const panOnDrag = panActivationKeyPressed || _panOnDrag;
|
|
1561
1568
|
const panOnScroll = panActivationKeyPressed || _panOnScroll;
|
|
1562
|
-
const isSelecting = selectionKeyPressed || (selectionOnDrag && panOnDrag !== true);
|
|
1569
|
+
const isSelecting = selectionKeyPressed || userSelectionActive || (selectionOnDrag && panOnDrag !== true);
|
|
1563
1570
|
useGlobalKeyHandler({ deleteKeyCode, multiSelectionKeyCode });
|
|
1564
1571
|
return (jsx(ZoomPane, { onPaneContextMenu: onPaneContextMenu, elementsSelectable: elementsSelectable, zoomOnScroll: zoomOnScroll, zoomOnPinch: zoomOnPinch, panOnScroll: panOnScroll, panOnScrollSpeed: panOnScrollSpeed, panOnScrollMode: panOnScrollMode, zoomOnDoubleClick: zoomOnDoubleClick, panOnDrag: !selectionKeyPressed && panOnDrag, defaultViewport: defaultViewport, translateExtent: translateExtent, minZoom: minZoom, maxZoom: maxZoom, zoomActivationKeyCode: zoomActivationKeyCode, preventScrolling: preventScrolling, noWheelClassName: noWheelClassName, noPanClassName: noPanClassName, onViewportChange: onViewportChange, isControlledViewport: isControlledViewport, children: jsxs(Pane, { onSelectionStart: onSelectionStart, onSelectionEnd: onSelectionEnd, onPaneClick: onPaneClick, onPaneMouseEnter: onPaneMouseEnter, onPaneMouseMove: onPaneMouseMove, onPaneMouseLeave: onPaneMouseLeave, onPaneContextMenu: onPaneContextMenu, onPaneScroll: onPaneScroll, panOnDrag: panOnDrag, isSelecting: !!isSelecting, selectionMode: selectionMode, children: [children, nodesSelectionActive && (jsx(NodesSelection, { onSelectionContextMenu: onSelectionContextMenu, noPanClassName: noPanClassName, disableKeyboardA11y: disableKeyboardA11y }))] }) }));
|
|
1565
1572
|
};
|
|
@@ -1884,18 +1891,21 @@ const Marker = ({ id, type, color, width = 12.5, height = 12.5, markerUnits = 's
|
|
|
1884
1891
|
}
|
|
1885
1892
|
return (jsx("marker", { className: "react-flow__arrowhead", id: id, markerWidth: `${width}`, markerHeight: `${height}`, viewBox: "-10 -10 20 20", markerUnits: markerUnits, orient: orient, refX: "0", refY: "0", children: jsx(Symbol, { color: color, strokeWidth: strokeWidth }) }));
|
|
1886
1893
|
};
|
|
1887
|
-
const markerSelector = ({ defaultColor, rfId }) => (s) => {
|
|
1888
|
-
const markers = createMarkerIds(s.edges, { id: rfId, defaultColor });
|
|
1889
|
-
return markers;
|
|
1890
|
-
};
|
|
1891
|
-
const markersEqual = (a, b) =>
|
|
1892
|
-
// the id includes all marker options, so we just need to look at that part of the marker
|
|
1893
|
-
!(a.length !== b.length || a.some((m, i) => m.id !== b[i].id));
|
|
1894
1894
|
// when you have multiple flows on a page and you hide the first one, the other ones have no markers anymore
|
|
1895
1895
|
// when they do have markers with the same ids. To prevent this the user can pass a unique id to the react flow wrapper
|
|
1896
1896
|
// that we can then use for creating our unique marker ids
|
|
1897
1897
|
const MarkerDefinitions = ({ defaultColor, rfId }) => {
|
|
1898
|
-
const
|
|
1898
|
+
const edges = useStore((s) => s.edges);
|
|
1899
|
+
const defaultEdgeOptions = useStore((s) => s.defaultEdgeOptions);
|
|
1900
|
+
const markers = useMemo(() => {
|
|
1901
|
+
const markers = createMarkerIds(edges, {
|
|
1902
|
+
id: rfId,
|
|
1903
|
+
defaultColor,
|
|
1904
|
+
defaultMarkerStart: defaultEdgeOptions?.markerStart,
|
|
1905
|
+
defaultMarkerEnd: defaultEdgeOptions?.markerEnd,
|
|
1906
|
+
});
|
|
1907
|
+
return markers;
|
|
1908
|
+
}, [edges, defaultEdgeOptions, rfId, defaultColor]);
|
|
1899
1909
|
if (!markers.length) {
|
|
1900
1910
|
return null;
|
|
1901
1911
|
}
|
|
@@ -2259,6 +2269,7 @@ function EdgeWrapper({ id, edgesFocusable, edgesUpdatable, elementsSelectable, o
|
|
|
2259
2269
|
animated: edge.animated,
|
|
2260
2270
|
inactive: !isSelectable && !onClick,
|
|
2261
2271
|
updating: updateHover,
|
|
2272
|
+
selectable: isSelectable,
|
|
2262
2273
|
},
|
|
2263
2274
|
]), onClick: onEdgeClick, onDoubleClick: onEdgeDoubleClick, onContextMenu: onEdgeContextMenu, onMouseEnter: onEdgeMouseEnter, onMouseMove: onEdgeMouseMove, onMouseLeave: onEdgeMouseLeave, onKeyDown: isFocusable ? onKeyDown : undefined, tabIndex: isFocusable ? 0 : undefined, role: isFocusable ? 'button' : 'img', "data-id": id, "data-testid": `rf__edge-${id}`, "aria-label": edge.ariaLabel === null ? undefined : edge.ariaLabel || `Edge from ${edge.source} to ${edge.target}`, "aria-describedby": isFocusable ? `${ARIA_EDGE_DESC_KEY}-${rfId}` : undefined, ref: edgeRef, children: [!updating && (jsx(EdgeComponent, { id: id, source: edge.source, target: edge.target, selected: edge.selected, animated: edge.animated, label: edge.label, labelStyle: edge.labelStyle, labelShowBg: edge.labelShowBg, labelBgStyle: edge.labelBgStyle, labelBgPadding: edge.labelBgPadding, labelBgBorderRadius: edge.labelBgBorderRadius, sourceX: sourceX, sourceY: sourceY, targetX: targetX, targetY: targetY, sourcePosition: sourcePosition, targetPosition: targetPosition, data: edge.data, style: edge.style, sourceHandleId: edge.sourceHandle, targetHandleId: edge.targetHandle, markerStart: markerStartUrl, markerEnd: markerEndUrl, pathOptions: 'pathOptions' in edge ? edge.pathOptions : undefined, interactionWidth: edge.interactionWidth })), isUpdatable && (jsx(EdgeUpdateAnchors, { edge: edge, isUpdatable: isUpdatable, edgeUpdaterRadius: edgeUpdaterRadius, onEdgeUpdate: onEdgeUpdate, onEdgeUpdateStart: onEdgeUpdateStart, onEdgeUpdateEnd: onEdgeUpdateEnd, sourceX: sourceX, sourceY: sourceY, targetX: targetX, targetY: targetY, sourcePosition: sourcePosition, targetPosition: targetPosition, setUpdateHover: setUpdateHover, setUpdating: setUpdating, sourceHandleId: edge.sourceHandle, targetHandleId: edge.targetHandle }))] }) }));
|
|
2264
2275
|
}
|
|
@@ -2468,7 +2479,8 @@ const getInitialState = ({ nodes = [], edges = [], width, height, fitView, } = {
|
|
|
2468
2479
|
let transform = [0, 0, 1];
|
|
2469
2480
|
if (fitView && width && height) {
|
|
2470
2481
|
const nodesWithDimensions = nextNodes.filter((node) => node.width && node.height);
|
|
2471
|
-
|
|
2482
|
+
// @todo users nodeOrigin should be used here
|
|
2483
|
+
const bounds = getNodesBounds(nodesWithDimensions, { nodeOrigin: [0, 0] });
|
|
2472
2484
|
const { x, y, zoom } = getViewportForBounds(bounds, width, height, 0.5, 2, 0.1);
|
|
2473
2485
|
transform = [x, y, zoom];
|
|
2474
2486
|
}
|
|
@@ -2525,7 +2537,7 @@ const getInitialState = ({ nodes = [], edges = [], width, height, fitView, } = {
|
|
|
2525
2537
|
autoPanOnConnect: true,
|
|
2526
2538
|
autoPanOnNodeDrag: true,
|
|
2527
2539
|
connectionRadius: 20,
|
|
2528
|
-
onError:
|
|
2540
|
+
onError: devWarn,
|
|
2529
2541
|
isValidConnection: undefined,
|
|
2530
2542
|
onSelectionChangeHandlers: [],
|
|
2531
2543
|
lib: 'react',
|
|
@@ -2948,7 +2960,7 @@ function useOnViewportChange({ onStart, onChange, onEnd }) {
|
|
|
2948
2960
|
* Hook for registering an onSelectionChange handler.
|
|
2949
2961
|
*
|
|
2950
2962
|
* @public
|
|
2951
|
-
* @
|
|
2963
|
+
* @param params.onChange - The handler to register
|
|
2952
2964
|
*/
|
|
2953
2965
|
function useOnSelectionChange({ onChange }) {
|
|
2954
2966
|
const store = useStoreApi();
|
|
@@ -2966,9 +2978,14 @@ const selector$6 = (options) => (s) => {
|
|
|
2966
2978
|
if (s.nodes.length === 0) {
|
|
2967
2979
|
return false;
|
|
2968
2980
|
}
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2981
|
+
for (const node of s.nodes) {
|
|
2982
|
+
if (options.includeHiddenNodes || !node.hidden) {
|
|
2983
|
+
if (node[internalsSymbol]?.handleBounds === undefined) {
|
|
2984
|
+
return false;
|
|
2985
|
+
}
|
|
2986
|
+
}
|
|
2987
|
+
}
|
|
2988
|
+
return true;
|
|
2972
2989
|
};
|
|
2973
2990
|
const defaultOptions = {
|
|
2974
2991
|
includeHiddenNodes: false,
|
|
@@ -2986,7 +3003,7 @@ function useNodesInitialized(options = defaultOptions) {
|
|
|
2986
3003
|
}
|
|
2987
3004
|
|
|
2988
3005
|
/**
|
|
2989
|
-
*
|
|
3006
|
+
* Hook to check if a <Handle /> is connected to another <Handle /> and get the connections.
|
|
2990
3007
|
*
|
|
2991
3008
|
* @public
|
|
2992
3009
|
* @param param.type - handle type 'source' or 'target'
|
|
@@ -3041,7 +3058,7 @@ const selector$5 = (s) => ({
|
|
|
3041
3058
|
* Hook for accessing the ongoing connection.
|
|
3042
3059
|
*
|
|
3043
3060
|
* @public
|
|
3044
|
-
* @returns ongoing connection
|
|
3061
|
+
* @returns ongoing connection
|
|
3045
3062
|
*/
|
|
3046
3063
|
function useConnection() {
|
|
3047
3064
|
const ongoingConnection = useStore(selector$5, shallow);
|
|
@@ -3214,7 +3231,7 @@ const selector$1 = (s) => {
|
|
|
3214
3231
|
};
|
|
3215
3232
|
return {
|
|
3216
3233
|
viewBB,
|
|
3217
|
-
boundingRect: s.nodes.length > 0 ? getBoundsOfRects(getNodesBounds(s.nodes, s.nodeOrigin), viewBB) : viewBB,
|
|
3234
|
+
boundingRect: s.nodes.length > 0 ? getBoundsOfRects(getNodesBounds(s.nodes, { nodeOrigin: s.nodeOrigin }), viewBB) : viewBB,
|
|
3218
3235
|
rfId: s.rfId,
|
|
3219
3236
|
nodeOrigin: s.nodeOrigin,
|
|
3220
3237
|
panZoom: s.panZoom,
|
|
@@ -3450,7 +3467,7 @@ function NodeToolbar({ nodeId, children, className, style, isVisible, position =
|
|
|
3450
3467
|
if (!isActive || !nodes.length) {
|
|
3451
3468
|
return null;
|
|
3452
3469
|
}
|
|
3453
|
-
const nodeRect = getNodesBounds(nodes, nodeOrigin);
|
|
3470
|
+
const nodeRect = getNodesBounds(nodes, { nodeOrigin });
|
|
3454
3471
|
const zIndex = Math.max(...nodes.map((node) => (node[internalsSymbol]?.z || 1) + 1));
|
|
3455
3472
|
const wrapperStyle = {
|
|
3456
3473
|
position: 'absolute',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialState.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/store/initialState.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"initialState.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/store/initialState.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE3D,QAAA,MAAM,eAAe;;;;;;MAYZ,cAqFR,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { CSSProperties, HTMLAttributes, MouseEvent as ReactMouseEvent, WheelEvent } from 'react';
|
|
2
|
-
import type { ConnectionMode, ConnectionLineType, OnConnect, OnConnectStart, OnConnectEnd, CoordinateExtent, KeyCode, PanOnScrollMode, ProOptions, PanelPosition, OnMove, OnMoveStart, OnMoveEnd, Viewport, NodeOrigin, HandleType, SelectionMode, OnError, IsValidConnection, ColorMode, SnapGrid
|
|
3
|
-
import type { OnSelectionChangeFunc, NodeTypes, EdgeTypes, Node, Edge, ConnectionLineComponent, OnEdgeUpdateFunc, OnInit, DefaultEdgeOptions, FitViewOptions, OnNodesDelete, OnEdgesDelete, OnDelete, OnNodesChange, OnEdgesChange,
|
|
2
|
+
import type { ConnectionMode, ConnectionLineType, OnConnect, OnConnectStart, OnConnectEnd, CoordinateExtent, KeyCode, PanOnScrollMode, ProOptions, PanelPosition, OnMove, OnMoveStart, OnMoveEnd, Viewport, NodeOrigin, HandleType, SelectionMode, OnError, IsValidConnection, ColorMode, SnapGrid } from '@xyflow/system';
|
|
3
|
+
import type { OnSelectionChangeFunc, NodeTypes, EdgeTypes, Node, Edge, ConnectionLineComponent, OnEdgeUpdateFunc, OnInit, DefaultEdgeOptions, FitViewOptions, OnNodesDelete, OnEdgesDelete, OnDelete, OnNodesChange, OnEdgesChange, NodeMouseHandler, SelectionDragHandler, EdgeMouseHandler, OnNodeDrag, OnBeforeDelete } from '.';
|
|
4
4
|
/**
|
|
5
5
|
* ReactFlow component props.
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export interface ReactFlowProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onError'> {
|
|
9
9
|
/** An array of nodes to render in a controlled flow.
|
|
10
10
|
* @example
|
|
11
11
|
* const nodes = [
|
|
@@ -66,11 +66,11 @@ export type ReactFlowProps = Omit<HTMLAttributes<HTMLDivElement>, 'onError'> & {
|
|
|
66
66
|
/** This event handler is called when a user right clicks on a node */
|
|
67
67
|
onNodeContextMenu?: NodeMouseHandler;
|
|
68
68
|
/** This event handler is called when a user starts to drag a node */
|
|
69
|
-
onNodeDragStart?:
|
|
69
|
+
onNodeDragStart?: OnNodeDrag;
|
|
70
70
|
/** This event handler is called when a user drags a node */
|
|
71
|
-
onNodeDrag?:
|
|
71
|
+
onNodeDrag?: OnNodeDrag;
|
|
72
72
|
/** This event handler is called when a user stops dragging a node */
|
|
73
|
-
onNodeDragStop?:
|
|
73
|
+
onNodeDragStop?: OnNodeDrag;
|
|
74
74
|
/** This event handler is called when a user clicks on an edge */
|
|
75
75
|
onEdgeClick?: (event: ReactMouseEvent, edge: Edge) => void;
|
|
76
76
|
/** This event handler is called when a user right clicks on an edge */
|
|
@@ -457,6 +457,6 @@ export type ReactFlowProps = Omit<HTMLAttributes<HTMLDivElement>, 'onError'> & {
|
|
|
457
457
|
* @example 'system' | 'light' | 'dark'
|
|
458
458
|
*/
|
|
459
459
|
colorMode?: ColorMode;
|
|
460
|
-
}
|
|
460
|
+
}
|
|
461
461
|
export type ReactFlowRefType = HTMLDivElement;
|
|
462
462
|
//# sourceMappingURL=component-props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-props.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/types/component-props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,IAAI,eAAe,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACtG,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,eAAe,EACf,UAAU,EACV,aAAa,EACb,MAAM,EACN,WAAW,EACX,SAAS,EACT,QAAQ,EACR,UAAU,EACV,UAAU,EACV,aAAa,EACb,OAAO,EACP,iBAAiB,EACjB,SAAS,EACT,QAAQ,
|
|
1
|
+
{"version":3,"file":"component-props.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/types/component-props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,IAAI,eAAe,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACtG,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,eAAe,EACf,UAAU,EACV,aAAa,EACb,MAAM,EACN,WAAW,EACX,SAAS,EACT,QAAQ,EACR,UAAU,EACV,UAAU,EACV,aAAa,EACb,OAAO,EACP,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACT,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EACV,qBAAqB,EACrB,SAAS,EACT,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,uBAAuB,EACvB,gBAAgB,EAChB,MAAM,EACN,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,aAAa,EACb,QAAQ,EACR,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,cAAc,EACf,MAAM,GAAG,CAAC;AAEX;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,SAAS,CAAC;IACrF;;;;;;;;;;OAUG;IACH,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,2DAA2D;IAC3D,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,2DAA2D;IAC3D,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB;;;;;;;;;;;;;;;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,MAAM,CAAC;IAChB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { FitViewParamsBase, FitViewOptionsBase, ZoomInOut, ZoomTo, SetViewport, GetZoom, GetViewport, SetCenter, FitBounds, XYPosition, NodeProps } from '@xyflow/system';
|
|
1
|
+
import { FitViewParamsBase, FitViewOptionsBase, ZoomInOut, ZoomTo, SetViewport, GetZoom, GetViewport, SetCenter, FitBounds, XYPosition, NodeProps, OnBeforeDeleteBase } from '@xyflow/system';
|
|
2
2
|
import type { NodeChange, EdgeChange, Node, Edge, ReactFlowInstance, EdgeProps } from '.';
|
|
3
3
|
import { ComponentType } from 'react';
|
|
4
4
|
export type OnNodesChange<NodeType extends Node = Node> = (changes: NodeChange<NodeType>[]) => void;
|
|
5
5
|
export type OnEdgesChange<EdgeType extends Edge = Edge> = (changes: EdgeChange<EdgeType>[]) => void;
|
|
6
|
-
export type OnNodesDelete = (nodes:
|
|
6
|
+
export type OnNodesDelete<NodeType extends Node = Node> = (nodes: NodeType[]) => void;
|
|
7
7
|
export type OnEdgesDelete = (edges: Edge[]) => void;
|
|
8
8
|
export type OnDelete = (params: {
|
|
9
9
|
nodes: Node[];
|
|
@@ -29,19 +29,94 @@ export type FitViewOptions = FitViewOptionsBase<Node>;
|
|
|
29
29
|
export type FitView = (fitViewOptions?: FitViewOptions) => boolean;
|
|
30
30
|
export type OnInit<NodeType extends Node = Node, EdgeType extends Edge = Edge> = (reactFlowInstance: ReactFlowInstance<NodeType, EdgeType>) => void;
|
|
31
31
|
export type ViewportHelperFunctions = {
|
|
32
|
+
/**
|
|
33
|
+
* Zooms viewport in by 1.2.
|
|
34
|
+
*
|
|
35
|
+
* @param options.duration - optional duration. If set, a transition will be applied
|
|
36
|
+
*/
|
|
32
37
|
zoomIn: ZoomInOut;
|
|
38
|
+
/**
|
|
39
|
+
* Zooms viewport out by 1 / 1.2.
|
|
40
|
+
*
|
|
41
|
+
* @param options.duration - optional duration. If set, a transition will be applied
|
|
42
|
+
*/
|
|
33
43
|
zoomOut: ZoomInOut;
|
|
44
|
+
/**
|
|
45
|
+
* Sets the current zoom level.
|
|
46
|
+
*
|
|
47
|
+
* @param zoomLevel - the zoom level to set
|
|
48
|
+
* @param options.duration - optional duration. If set, a transition will be applied
|
|
49
|
+
*/
|
|
34
50
|
zoomTo: ZoomTo;
|
|
51
|
+
/**
|
|
52
|
+
* Returns the current zoom level.
|
|
53
|
+
*
|
|
54
|
+
* @returns current zoom as a number
|
|
55
|
+
*/
|
|
35
56
|
getZoom: GetZoom;
|
|
57
|
+
/**
|
|
58
|
+
* Sets the current viewport.
|
|
59
|
+
*
|
|
60
|
+
* @param viewport - the viewport to set
|
|
61
|
+
* @param options.duration - optional duration. If set, a transition will be applied
|
|
62
|
+
*/
|
|
36
63
|
setViewport: SetViewport;
|
|
64
|
+
/**
|
|
65
|
+
* Returns the current viewport.
|
|
66
|
+
*
|
|
67
|
+
* @returns Viewport
|
|
68
|
+
*/
|
|
37
69
|
getViewport: GetViewport;
|
|
70
|
+
/**
|
|
71
|
+
* Fits the view.
|
|
72
|
+
*
|
|
73
|
+
* @param options.padding - optional padding
|
|
74
|
+
* @param options.includeHiddenNodes - optional includeHiddenNodes
|
|
75
|
+
* @param options.minZoom - optional minZoom
|
|
76
|
+
* @param options.maxZoom - optional maxZoom
|
|
77
|
+
* @param options.duration - optional duration. If set, a transition will be applied
|
|
78
|
+
* @param options.nodes - optional nodes to fit the view to
|
|
79
|
+
*/
|
|
38
80
|
fitView: FitView;
|
|
81
|
+
/**
|
|
82
|
+
* Sets the center of the view to the given position.
|
|
83
|
+
*
|
|
84
|
+
* @param x - x position
|
|
85
|
+
* @param y - y position
|
|
86
|
+
* @param options.zoom - optional zoom
|
|
87
|
+
*/
|
|
39
88
|
setCenter: SetCenter;
|
|
89
|
+
/**
|
|
90
|
+
* Fits the view to the given bounds .
|
|
91
|
+
*
|
|
92
|
+
* @param bounds - the bounds ({ x: number, y: number, width: number, height: number }) to fit the view to
|
|
93
|
+
* @param options.padding - optional padding
|
|
94
|
+
*/
|
|
40
95
|
fitBounds: FitBounds;
|
|
41
|
-
|
|
96
|
+
/**
|
|
97
|
+
* Converts a screen / client position to a flow position.
|
|
98
|
+
*
|
|
99
|
+
* @param clientPosition - the screen / client position. When you are working with events you can use event.clientX and event.clientY
|
|
100
|
+
* @param options.snapToGrid - if true, the converted position will be snapped to the grid
|
|
101
|
+
* @returns position as { x: number, y: number }
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* const flowPosition = screenToFlowPosition({ x: event.clientX, y: event.clientY })
|
|
105
|
+
*/
|
|
106
|
+
screenToFlowPosition: (clientPosition: XYPosition, options?: {
|
|
42
107
|
snapToGrid: boolean;
|
|
43
108
|
}) => XYPosition;
|
|
44
|
-
|
|
109
|
+
/**
|
|
110
|
+
* Converts a flow position to a screen / client position.
|
|
111
|
+
*
|
|
112
|
+
* @param flowPosition - the screen / client position. When you are working with events you can use event.clientX and event.clientY
|
|
113
|
+
* @returns position as { x: number, y: number }
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* const clientPosition = flowToScreenPosition({ x: node.position.x, y: node.position.y })
|
|
117
|
+
*/
|
|
118
|
+
flowToScreenPosition: (flowPosition: XYPosition) => XYPosition;
|
|
45
119
|
viewportInitialized: boolean;
|
|
46
120
|
};
|
|
121
|
+
export type OnBeforeDelete<NodeType extends Node = Node, EdgeType extends Edge = Edge> = OnBeforeDeleteBase<NodeType, EdgeType>;
|
|
47
122
|
//# sourceMappingURL=general.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/types/general.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,MAAM,EACN,WAAW,EACX,OAAO,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;IACrB;;;;;;;;;OASG;IACH,oBAAoB,EAAE,CAAC,cAAc,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE;QAAE,UAAU,EAAE,OAAO,CAAA;KAAE,KAAK,UAAU,CAAC;IACpG;;;;;;;;OAQG;IACH,oBAAoB,EAAE,CAAC,YAAY,EAAE,UAAU,KAAK,UAAU,CAAC;IAC/D,mBAAmB,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,kBAAkB,CACzG,QAAQ,EACR,QAAQ,CACT,CAAC"}
|
|
@@ -41,19 +41,112 @@ export declare namespace Instance {
|
|
|
41
41
|
}) => void;
|
|
42
42
|
}
|
|
43
43
|
export type ReactFlowInstance<NodeType extends Node = Node, EdgeType extends Edge = Edge> = {
|
|
44
|
+
/**
|
|
45
|
+
* Returns nodes.
|
|
46
|
+
*
|
|
47
|
+
* @returns nodes array
|
|
48
|
+
*/
|
|
44
49
|
getNodes: Instance.GetNodes<NodeType>;
|
|
50
|
+
/**
|
|
51
|
+
* Sets nodes.
|
|
52
|
+
*
|
|
53
|
+
* @param payload - the nodes to set or a function that receives the current nodes and returns the new nodes
|
|
54
|
+
*/
|
|
45
55
|
setNodes: Instance.SetNodes<NodeType>;
|
|
56
|
+
/**
|
|
57
|
+
* Adds nodes.
|
|
58
|
+
*
|
|
59
|
+
* @param payload - the nodes to add
|
|
60
|
+
*/
|
|
46
61
|
addNodes: Instance.AddNodes<NodeType>;
|
|
62
|
+
/**
|
|
63
|
+
* Returns a node by id.
|
|
64
|
+
*
|
|
65
|
+
* @param id - the node id
|
|
66
|
+
* @returns the node or undefined if no node was found
|
|
67
|
+
*/
|
|
47
68
|
getNode: Instance.GetNode<NodeType>;
|
|
69
|
+
/**
|
|
70
|
+
* Returns edges.
|
|
71
|
+
*
|
|
72
|
+
* @returns edges array
|
|
73
|
+
*/
|
|
48
74
|
getEdges: Instance.GetEdges<EdgeType>;
|
|
75
|
+
/**
|
|
76
|
+
* Sets edges.
|
|
77
|
+
*
|
|
78
|
+
* @param payload - the edges to set or a function that receives the current edges and returns the new edges
|
|
79
|
+
*/
|
|
49
80
|
setEdges: Instance.SetEdges<EdgeType>;
|
|
81
|
+
/**
|
|
82
|
+
* Adds edges.
|
|
83
|
+
*
|
|
84
|
+
* @param payload - the edges to add
|
|
85
|
+
*/
|
|
50
86
|
addEdges: Instance.AddEdges<EdgeType>;
|
|
87
|
+
/**
|
|
88
|
+
* Returns an edge by id.
|
|
89
|
+
*
|
|
90
|
+
* @param id - the edge id
|
|
91
|
+
* @returns the edge or undefined if no edge was found
|
|
92
|
+
*/
|
|
51
93
|
getEdge: Instance.GetEdge<EdgeType>;
|
|
94
|
+
/**
|
|
95
|
+
* Returns the nodes, edges and the viewport as a JSON object.
|
|
96
|
+
*
|
|
97
|
+
* @returns the nodes, edges and the viewport as a JSON object
|
|
98
|
+
*/
|
|
52
99
|
toObject: Instance.ToObject<NodeType, EdgeType>;
|
|
100
|
+
/**
|
|
101
|
+
* Deletes nodes and edges.
|
|
102
|
+
*
|
|
103
|
+
* @param params.nodes - optional nodes array to delete
|
|
104
|
+
* @param params.edges - optional edges array to delete
|
|
105
|
+
*
|
|
106
|
+
* @returns a promise that resolves with the deleted nodes and edges
|
|
107
|
+
*/
|
|
53
108
|
deleteElements: Instance.DeleteElements;
|
|
109
|
+
/**
|
|
110
|
+
* Returns all nodes that intersect with the given node or rect.
|
|
111
|
+
*
|
|
112
|
+
* @param node - the node or rect to check for intersections
|
|
113
|
+
* @param partially - if true, the node is considered to be intersecting if it partially overlaps with the passed node or rect
|
|
114
|
+
* @param nodes - optional nodes array to check for intersections
|
|
115
|
+
*
|
|
116
|
+
* @returns an array of intersecting nodes
|
|
117
|
+
*/
|
|
54
118
|
getIntersectingNodes: Instance.GetIntersectingNodes<NodeType>;
|
|
119
|
+
/**
|
|
120
|
+
* Checks if the given node or rect intersects with the passed rect.
|
|
121
|
+
*
|
|
122
|
+
* @param node - the node or rect to check for intersections
|
|
123
|
+
* @param area - the rect to check for intersections
|
|
124
|
+
* @param partially - if true, the node is considered to be intersecting if it partially overlaps with the passed react
|
|
125
|
+
*
|
|
126
|
+
* @returns true if the node or rect intersects with the given area
|
|
127
|
+
*/
|
|
55
128
|
isNodeIntersecting: Instance.IsNodeIntersecting<NodeType>;
|
|
129
|
+
/**
|
|
130
|
+
* Updates a node.
|
|
131
|
+
*
|
|
132
|
+
* @param id - id of the node to update
|
|
133
|
+
* @param nodeUpdate - the node update as an object or a function that receives the current node and returns the node update
|
|
134
|
+
* @param options.replace - if true, the node is replaced with the node update, otherwise the changes get merged
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* updateNode('node-1', (node) => ({ position: { x: node.position.x + 10, y: node.position.y } }));
|
|
138
|
+
*/
|
|
56
139
|
updateNode: Instance.UpdateNode<NodeType>;
|
|
140
|
+
/**
|
|
141
|
+
* Updates the data attribute of a node.
|
|
142
|
+
*
|
|
143
|
+
* @param id - id of the node to update
|
|
144
|
+
* @param dataUpdate - the data update as an object or a function that receives the current data and returns the data update
|
|
145
|
+
* @param options.replace - if true, the data is replaced with the data update, otherwise the changes get merged
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* updateNodeData('node-1', { label: 'A new label' });
|
|
149
|
+
*/
|
|
57
150
|
updateNodeData: Instance.UpdateNodeData<NodeType>;
|
|
58
151
|
viewportInitialized: boolean;
|
|
59
152
|
} & Omit<ViewportHelperFunctions, 'initialized'>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/types/instance.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,uBAAuB,EAAE,MAAM,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,EAAE,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACtC;;;;;OAKG;IACH,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACpC;;;;OAIG;IACH,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACtC;;;;OAIG;IACH,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACtC;;;;OAIG;IACH,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACtC;;;;;OAKG;IACH,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACpC;;;;OAIG;IACH,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAChD;;;;;;;OAOG;IACH,cAAc,EAAE,QAAQ,CAAC,cAAc,CAAC;IACxC;;;;;;;;OAQG;IACH,oBAAoB,EAAE,QAAQ,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAC9D;;;;;;;;OAQG;IACH,kBAAkB,EAAE,QAAQ,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC1D;;;;;;;;;OASG;IACH,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC1C;;;;;;;;;OASG;IACH,cAAc,EAAE,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAClD,mBAAmB,EAAE,OAAO,CAAC;CAC9B,GAAG,IAAI,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC"}
|
|
@@ -11,9 +11,9 @@ export type Node<NodeData = any, NodeType extends string | undefined = string |
|
|
|
11
11
|
resizing?: boolean;
|
|
12
12
|
focusable?: boolean;
|
|
13
13
|
};
|
|
14
|
-
export type NodeMouseHandler = (event: ReactMouseEvent, node:
|
|
15
|
-
export type
|
|
16
|
-
export type
|
|
14
|
+
export type NodeMouseHandler<NodeType extends Node = Node> = (event: ReactMouseEvent, node: NodeType) => void;
|
|
15
|
+
export type SelectionDragHandler<NodeType extends Node = Node> = (event: ReactMouseEvent, nodes: NodeType[]) => void;
|
|
16
|
+
export type OnNodeDrag<NodeType extends Node = Node> = (event: ReactMouseEvent, node: NodeType, nodes: NodeType[]) => void;
|
|
17
17
|
export type NodeWrapperProps = {
|
|
18
18
|
id: string;
|
|
19
19
|
nodesConnectable: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/types/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEtF,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/types/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEtF,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;;GAGG;AAEH,MAAM,MAAM,IAAI,CAAC,QAAQ,GAAG,GAAG,EAAE,QAAQ,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,IAAI,QAAQ,CACnG,QAAQ,EACR,QAAQ,CACT,GAAG;IACF,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAA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CACnB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConnectionMode, type ConnectionStatus, type CoordinateExtent, type NodeDimensionUpdate, type UpdateNodePositions, type NodeOrigin, type OnConnect, type OnError, type OnViewportChange, type SelectionRect, type SnapGrid, type ConnectingHandle, type Transform, type XYPosition, type PanZoomInstance, type PanBy, type OnConnectStart, type OnConnectEnd, type
|
|
2
|
-
import type { Edge, Node, NodeChange, OnNodesChange, OnEdgesChange, DefaultEdgeOptions, FitViewOptions, OnNodesDelete, OnEdgesDelete, OnSelectionChangeFunc, UnselectNodesAndEdgesParams, OnDelete } from '.';
|
|
1
|
+
import { ConnectionMode, type ConnectionStatus, type CoordinateExtent, type NodeDimensionUpdate, type UpdateNodePositions, type NodeOrigin, type OnConnect, type OnError, type OnViewportChange, type SelectionRect, type SnapGrid, type ConnectingHandle, type Transform, type XYPosition, type PanZoomInstance, type PanBy, type OnConnectStart, type OnConnectEnd, type OnSelectionDrag, type OnMoveStart, type OnMove, type OnMoveEnd, type IsValidConnection, type UpdateConnection, type EdgeLookup, type ConnectionLookup, type NodeLookup } from '@xyflow/system';
|
|
2
|
+
import type { Edge, Node, NodeChange, OnNodesChange, OnEdgesChange, DefaultEdgeOptions, FitViewOptions, OnNodesDelete, OnEdgesDelete, OnSelectionChangeFunc, UnselectNodesAndEdgesParams, OnDelete, OnNodeDrag, OnBeforeDelete } from '.';
|
|
3
3
|
export type ReactFlowStore = {
|
|
4
4
|
rfId: string;
|
|
5
5
|
width: number;
|