@xyflow/react 12.0.0-next.6 → 12.0.0-next.7
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/LICENSE +1 -1
- package/dist/esm/additional-components/Background/types.d.ts +13 -0
- package/dist/esm/additional-components/Background/types.d.ts.map +1 -1
- package/dist/esm/additional-components/Controls/types.d.ts +14 -0
- package/dist/esm/additional-components/Controls/types.d.ts.map +1 -1
- package/dist/esm/additional-components/MiniMap/types.d.ts +21 -0
- package/dist/esm/additional-components/MiniMap/types.d.ts.map +1 -1
- package/dist/esm/additional-components/NodeResizer/types.d.ts +25 -0
- package/dist/esm/additional-components/NodeResizer/types.d.ts.map +1 -1
- package/dist/esm/additional-components/NodeToolbar/types.d.ts +10 -0
- package/dist/esm/additional-components/NodeToolbar/types.d.ts.map +1 -1
- package/dist/esm/components/EdgeWrapper/EdgeUpdateAnchors.d.ts.map +1 -1
- package/dist/esm/components/Handle/index.d.ts.map +1 -1
- package/dist/esm/components/Panel/index.d.ts +3 -0
- package/dist/esm/components/Panel/index.d.ts.map +1 -1
- package/dist/esm/container/ReactFlow/index.d.ts +3 -3
- package/dist/esm/hooks/useNodesEdgesState.d.ts +2 -2
- package/dist/esm/hooks/useNodesEdgesState.d.ts.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +19 -56
- package/dist/esm/index.mjs +19 -56
- package/dist/esm/types/changes.d.ts +2 -2
- package/dist/esm/types/changes.d.ts.map +1 -1
- package/dist/esm/types/component-props.d.ts +339 -1
- package/dist/esm/types/component-props.d.ts.map +1 -1
- package/dist/esm/types/edges.d.ts +11 -0
- package/dist/esm/types/edges.d.ts.map +1 -1
- package/dist/esm/types/general.d.ts +5 -3
- package/dist/esm/types/general.d.ts.map +1 -1
- package/dist/esm/types/instance.d.ts +0 -9
- package/dist/esm/types/instance.d.ts.map +1 -1
- package/dist/esm/utils/changes.d.ts +3 -3
- package/dist/esm/utils/changes.d.ts.map +1 -1
- package/dist/esm/utils/general.d.ts +2 -49
- package/dist/esm/utils/general.d.ts.map +1 -1
- package/dist/umd/additional-components/Background/types.d.ts +13 -0
- package/dist/umd/additional-components/Background/types.d.ts.map +1 -1
- package/dist/umd/additional-components/Controls/types.d.ts +14 -0
- package/dist/umd/additional-components/Controls/types.d.ts.map +1 -1
- package/dist/umd/additional-components/MiniMap/types.d.ts +21 -0
- package/dist/umd/additional-components/MiniMap/types.d.ts.map +1 -1
- package/dist/umd/additional-components/NodeResizer/types.d.ts +25 -0
- package/dist/umd/additional-components/NodeResizer/types.d.ts.map +1 -1
- package/dist/umd/additional-components/NodeToolbar/types.d.ts +10 -0
- package/dist/umd/additional-components/NodeToolbar/types.d.ts.map +1 -1
- package/dist/umd/components/EdgeWrapper/EdgeUpdateAnchors.d.ts.map +1 -1
- package/dist/umd/components/Handle/index.d.ts.map +1 -1
- package/dist/umd/components/Panel/index.d.ts +3 -0
- package/dist/umd/components/Panel/index.d.ts.map +1 -1
- package/dist/umd/container/ReactFlow/index.d.ts +3 -3
- package/dist/umd/hooks/useNodesEdgesState.d.ts +2 -2
- package/dist/umd/hooks/useNodesEdgesState.d.ts.map +1 -1
- package/dist/umd/index.d.ts +2 -2
- package/dist/umd/index.d.ts.map +1 -1
- package/dist/umd/index.js +2 -2
- package/dist/umd/types/changes.d.ts +2 -2
- package/dist/umd/types/changes.d.ts.map +1 -1
- package/dist/umd/types/component-props.d.ts +339 -1
- package/dist/umd/types/component-props.d.ts.map +1 -1
- package/dist/umd/types/edges.d.ts +11 -0
- package/dist/umd/types/edges.d.ts.map +1 -1
- package/dist/umd/types/general.d.ts +5 -3
- package/dist/umd/types/general.d.ts.map +1 -1
- package/dist/umd/types/instance.d.ts +0 -9
- package/dist/umd/types/instance.d.ts.map +1 -1
- package/dist/umd/utils/changes.d.ts +3 -3
- package/dist/umd/utils/changes.d.ts.map +1 -1
- package/dist/umd/utils/general.d.ts +2 -49
- package/dist/umd/utils/general.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/esm/index.mjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
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,
|
|
6
|
-
export { ConnectionLineType, ConnectionMode, MarkerType, PanOnScrollMode, Position, SelectionMode, getBezierEdgeCenter, getBezierPath, getEdgeCenter, getNodesBounds, getSmoothStepPath, getStraightPath, getViewportForBounds, internalsSymbol } from '@xyflow/system';
|
|
5
|
+
import { errorMessages, infiniteExtent, isInputDOMNode, fitView, getViewportForBounds, pointToRendererPoint, rendererPointToPoint, isNodeBase, isEdgeBase, getElementsToRemove, isRectObject, nodeToRect, getOverlappingArea, getDimensions, XYPanZoom, PanOnScrollMode, SelectionMode, getEventPosition, getNodesInside, XYDrag, snapPosition, calcNextPosition, 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, updateNodeDimensions, updateAbsolutePositions, panBy, isMacOs, areConnectionMapsEqual, handleConnectionChange, getNodePositionWithOrigin, XYMinimap, getBoundsOfRects, ResizeControlVariant, XYResizer, XY_RESIZER_LINE_POSITIONS, XY_RESIZER_HANDLE_POSITIONS, getNodeToolbarTransform } from '@xyflow/system';
|
|
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';
|
|
9
9
|
import { createPortal } from 'react-dom';
|
|
@@ -424,8 +424,8 @@ 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: (position) => {
|
|
428
|
-
const { transform,
|
|
427
|
+
screenToFlowPosition: (position, options = { snapToGrid: true }) => {
|
|
428
|
+
const { transform, snapGrid, domNode } = store.getState();
|
|
429
429
|
if (!domNode) {
|
|
430
430
|
return position;
|
|
431
431
|
}
|
|
@@ -434,7 +434,7 @@ const useViewportHelper = () => {
|
|
|
434
434
|
x: position.x - domX,
|
|
435
435
|
y: position.y - domY,
|
|
436
436
|
};
|
|
437
|
-
return pointToRendererPoint(correctedPosition, transform, snapToGrid, snapGrid
|
|
437
|
+
return pointToRendererPoint(correctedPosition, transform, options.snapToGrid, snapGrid);
|
|
438
438
|
},
|
|
439
439
|
flowToScreenPosition: (position) => {
|
|
440
440
|
const { transform, domNode } = store.getState();
|
|
@@ -688,7 +688,7 @@ function getElementsDiffChanges({ items = [], lookup, }) {
|
|
|
688
688
|
* @param element - The element to test
|
|
689
689
|
* @returns A boolean indicating whether the element is an Node
|
|
690
690
|
*/
|
|
691
|
-
const isNode = (isNodeBase);
|
|
691
|
+
const isNode = (element) => isNodeBase(element);
|
|
692
692
|
/**
|
|
693
693
|
* Test whether an object is useable as an Edge
|
|
694
694
|
* @public
|
|
@@ -696,50 +696,7 @@ const isNode = (isNodeBase);
|
|
|
696
696
|
* @param element - The element to test
|
|
697
697
|
* @returns A boolean indicating whether the element is an Edge
|
|
698
698
|
*/
|
|
699
|
-
const isEdge = (isEdgeBase);
|
|
700
|
-
/**
|
|
701
|
-
* Pass in a node, and get connected nodes where edge.source === node.id
|
|
702
|
-
* @public
|
|
703
|
-
* @param node - The node to get the connected nodes from
|
|
704
|
-
* @param nodes - The array of all nodes
|
|
705
|
-
* @param edges - The array of all edges
|
|
706
|
-
* @returns An array of nodes that are connected over eges where the source is the given node
|
|
707
|
-
*/
|
|
708
|
-
const getOutgoers = (getOutgoersBase);
|
|
709
|
-
/**
|
|
710
|
-
* Pass in a node, and get connected nodes where edge.target === node.id
|
|
711
|
-
* @public
|
|
712
|
-
* @param node - The node to get the connected nodes from
|
|
713
|
-
* @param nodes - The array of all nodes
|
|
714
|
-
* @param edges - The array of all edges
|
|
715
|
-
* @returns An array of nodes that are connected over eges where the target is the given node
|
|
716
|
-
*/
|
|
717
|
-
const getIncomers = (getIncomersBase);
|
|
718
|
-
/**
|
|
719
|
-
* This util is a convenience function to add a new Edge to an array of edges
|
|
720
|
-
* @remarks It also performs some validation to make sure you don't add an invalid edge or duplicate an existing one.
|
|
721
|
-
* @public
|
|
722
|
-
* @param edgeParams - Either an Edge or a Connection you want to add
|
|
723
|
-
* @param edges - The array of all current edges
|
|
724
|
-
* @returns A new array of edges with the new edge added
|
|
725
|
-
*/
|
|
726
|
-
const addEdge = (addEdgeBase);
|
|
727
|
-
/**
|
|
728
|
-
* A handy utility to update an existing Edge with new properties
|
|
729
|
-
* @param oldEdge - The edge you want to update
|
|
730
|
-
* @param newConnection - The new connection you want to update the edge with
|
|
731
|
-
* @param edges - The array of all current edges
|
|
732
|
-
* @param options.shouldReplaceId - should the id of the old edge be replaced with the new connection id
|
|
733
|
-
* @returns the updated edges array
|
|
734
|
-
*/
|
|
735
|
-
const updateEdge = (updateEdgeBase);
|
|
736
|
-
/**
|
|
737
|
-
* Get all connecting edges for a given set of nodes
|
|
738
|
-
* @param nodes - Nodes you want to get the connected edges for
|
|
739
|
-
* @param edges - All edges
|
|
740
|
-
* @returns Array of edges that connect any of the given nodes with each other
|
|
741
|
-
*/
|
|
742
|
-
const getConnectedEdges = (getConnectedEdgesBase);
|
|
699
|
+
const isEdge = (element) => isEdgeBase(element);
|
|
743
700
|
|
|
744
701
|
/**
|
|
745
702
|
* Hook for accessing the ReactFlow instance.
|
|
@@ -883,6 +840,9 @@ function useReactFlow() {
|
|
|
883
840
|
const getNodeRect = useCallback((nodeOrRect) => {
|
|
884
841
|
const isRect = isRectObject(nodeOrRect);
|
|
885
842
|
const node = isRect ? null : store.getState().nodeLookup.get(nodeOrRect.id);
|
|
843
|
+
if (!isRect && !node) {
|
|
844
|
+
return [null, null, isRect];
|
|
845
|
+
}
|
|
886
846
|
const nodeRect = isRect ? nodeOrRect : nodeToRect(node);
|
|
887
847
|
return [nodeRect, node, isRect];
|
|
888
848
|
}, []);
|
|
@@ -1387,9 +1347,9 @@ const useNodeId = () => {
|
|
|
1387
1347
|
};
|
|
1388
1348
|
|
|
1389
1349
|
const selector$i = (s) => ({
|
|
1390
|
-
connectionStartHandle: s.connectionStartHandle,
|
|
1391
1350
|
connectOnClick: s.connectOnClick,
|
|
1392
1351
|
noPanClassName: s.noPanClassName,
|
|
1352
|
+
rfId: s.rfId,
|
|
1393
1353
|
});
|
|
1394
1354
|
const connectingSelector = (nodeId, handleId, type) => (state) => {
|
|
1395
1355
|
const { connectionStartHandle: startHandle, connectionEndHandle: endHandle, connectionClickStartHandle: clickHandle, } = state;
|
|
@@ -1404,7 +1364,7 @@ const HandleComponent = forwardRef(({ type = 'source', position = Position.Top,
|
|
|
1404
1364
|
const isTarget = type === 'target';
|
|
1405
1365
|
const store = useStoreApi();
|
|
1406
1366
|
const nodeId = useNodeId();
|
|
1407
|
-
const { connectOnClick, noPanClassName } = useStore(selector$i, shallow);
|
|
1367
|
+
const { connectOnClick, noPanClassName, rfId } = useStore(selector$i, shallow);
|
|
1408
1368
|
const { connecting, clickConnecting } = useStore(connectingSelector(nodeId, handleId, type), shallow);
|
|
1409
1369
|
if (!nodeId) {
|
|
1410
1370
|
store.getState().onError?.('010', errorMessages['error010']());
|
|
@@ -1440,6 +1400,7 @@ const HandleComponent = forwardRef(({ type = 'source', position = Position.Top,
|
|
|
1440
1400
|
isTarget,
|
|
1441
1401
|
handleId,
|
|
1442
1402
|
nodeId,
|
|
1403
|
+
flowId: currentStore.rfId,
|
|
1443
1404
|
panBy: currentStore.panBy,
|
|
1444
1405
|
cancelConnection: currentStore.cancelConnection,
|
|
1445
1406
|
onConnectStart: currentStore.onConnectStart,
|
|
@@ -1458,7 +1419,7 @@ const HandleComponent = forwardRef(({ type = 'source', position = Position.Top,
|
|
|
1458
1419
|
}
|
|
1459
1420
|
};
|
|
1460
1421
|
const onClick = (event) => {
|
|
1461
|
-
const { onClickConnectStart, onClickConnectEnd, connectionClickStartHandle, connectionMode, isValidConnection: isValidConnectionStore, lib, } = store.getState();
|
|
1422
|
+
const { onClickConnectStart, onClickConnectEnd, connectionClickStartHandle, connectionMode, isValidConnection: isValidConnectionStore, lib, rfId: flowId, } = store.getState();
|
|
1462
1423
|
if (!nodeId || (!connectionClickStartHandle && !isConnectableStart)) {
|
|
1463
1424
|
return;
|
|
1464
1425
|
}
|
|
@@ -1480,6 +1441,7 @@ const HandleComponent = forwardRef(({ type = 'source', position = Position.Top,
|
|
|
1480
1441
|
fromHandleId: connectionClickStartHandle.handleId || null,
|
|
1481
1442
|
fromType: connectionClickStartHandle.type,
|
|
1482
1443
|
isValidConnection: isValidConnectionHandler,
|
|
1444
|
+
flowId,
|
|
1483
1445
|
doc,
|
|
1484
1446
|
lib,
|
|
1485
1447
|
});
|
|
@@ -1489,7 +1451,7 @@ const HandleComponent = forwardRef(({ type = 'source', position = Position.Top,
|
|
|
1489
1451
|
onClickConnectEnd?.(event);
|
|
1490
1452
|
store.setState({ connectionClickStartHandle: null });
|
|
1491
1453
|
};
|
|
1492
|
-
return (jsx("div", { "data-handleid": handleId, "data-nodeid": nodeId, "data-handlepos": position, "data-id": `${nodeId}-${handleId}-${type}`, className: cc([
|
|
1454
|
+
return (jsx("div", { "data-handleid": handleId, "data-nodeid": nodeId, "data-handlepos": position, "data-id": `${rfId}-${nodeId}-${handleId}-${type}`, className: cc([
|
|
1493
1455
|
'react-flow__handle',
|
|
1494
1456
|
`react-flow__handle-${position}`,
|
|
1495
1457
|
'nodrag',
|
|
@@ -2137,7 +2099,7 @@ function EdgeUpdateAnchors({ isUpdatable, edgeUpdaterRadius, edge, targetHandleI
|
|
|
2137
2099
|
if (event.button !== 0) {
|
|
2138
2100
|
return;
|
|
2139
2101
|
}
|
|
2140
|
-
const { autoPanOnConnect, domNode, isValidConnection, connectionMode, connectionRadius, lib, onConnectStart, onConnectEnd, cancelConnection, nodes, panBy, updateConnection, } = store.getState();
|
|
2102
|
+
const { autoPanOnConnect, domNode, isValidConnection, connectionMode, connectionRadius, lib, onConnectStart, onConnectEnd, cancelConnection, nodes, rfId: flowId, panBy, updateConnection, } = store.getState();
|
|
2141
2103
|
const nodeId = isSourceHandle ? edge.target : edge.source;
|
|
2142
2104
|
const handleId = (isSourceHandle ? targetHandleId : sourceHandleId) || null;
|
|
2143
2105
|
const handleType = isSourceHandle ? 'target' : 'source';
|
|
@@ -2160,6 +2122,7 @@ function EdgeUpdateAnchors({ isUpdatable, edgeUpdaterRadius, edge, targetHandleI
|
|
|
2160
2122
|
isTarget,
|
|
2161
2123
|
edgeUpdaterType: handleType,
|
|
2162
2124
|
lib,
|
|
2125
|
+
flowId,
|
|
2163
2126
|
cancelConnection,
|
|
2164
2127
|
panBy,
|
|
2165
2128
|
isValidConnection,
|
|
@@ -3498,4 +3461,4 @@ function NodeToolbar({ nodeId, children, className, style, isVisible, position =
|
|
|
3498
3461
|
return (jsx(NodeToolbarPortal, { children: jsx("div", { style: wrapperStyle, className: cc(['react-flow__node-toolbar', className]), ...rest, "data-id": nodes.reduce((acc, node) => `${acc}${node.id} `, '').trim(), children: children }) }));
|
|
3499
3462
|
}
|
|
3500
3463
|
|
|
3501
|
-
export { Background, BackgroundVariant, BaseEdge, BezierEdge, ControlButton, Controls, EdgeLabelRenderer, EdgeText, Handle, MiniMap, NodeResizeControl, NodeResizer, NodeToolbar, Panel, ReactFlow, ReactFlowProvider, SimpleBezierEdge, SmoothStepEdge, StepEdge, StraightEdge, ViewportPortal,
|
|
3464
|
+
export { Background, BackgroundVariant, BaseEdge, BezierEdge, ControlButton, Controls, EdgeLabelRenderer, EdgeText, Handle, MiniMap, NodeResizeControl, NodeResizer, NodeToolbar, Panel, ReactFlow, ReactFlowProvider, SimpleBezierEdge, SmoothStepEdge, StepEdge, StraightEdge, ViewportPortal, applyEdgeChanges, applyNodeChanges, getSimpleBezierPath, handleParentExpand, isEdge, isNode, useConnection, useEdges, useEdgesState, useHandleConnections, useKeyPress, useNodeId, useNodes, useNodesData, useNodesInitialized, useNodesState, useOnSelectionChange, useOnViewportChange, useReactFlow, useStore, useStoreApi, useUpdateNodeInternals, useViewport };
|
|
@@ -35,7 +35,7 @@ export type NodeReplaceChange<NodeType extends Node = Node> = {
|
|
|
35
35
|
* Union type of all possible node changes.
|
|
36
36
|
* @public
|
|
37
37
|
*/
|
|
38
|
-
export type NodeChange = NodeDimensionChange | NodePositionChange | NodeSelectionChange | NodeRemoveChange | NodeAddChange | NodeReplaceChange
|
|
38
|
+
export type NodeChange<NodeType extends Node = Node> = NodeDimensionChange | NodePositionChange | NodeSelectionChange | NodeRemoveChange | NodeAddChange<NodeType> | NodeReplaceChange<NodeType>;
|
|
39
39
|
export type EdgeSelectionChange = NodeSelectionChange;
|
|
40
40
|
export type EdgeRemoveChange = NodeRemoveChange;
|
|
41
41
|
export type EdgeAddChange<EdgeType extends Edge = Edge> = {
|
|
@@ -47,5 +47,5 @@ export type EdgeReplaceChange<EdgeType extends Edge = Edge> = {
|
|
|
47
47
|
item: EdgeType;
|
|
48
48
|
type: 'replace';
|
|
49
49
|
};
|
|
50
|
-
export type EdgeChange = EdgeSelectionChange | EdgeRemoveChange | EdgeAddChange | EdgeReplaceChange
|
|
50
|
+
export type EdgeChange<EdgeType extends Edge = Edge> = EdgeSelectionChange | EdgeRemoveChange | EdgeAddChange<EdgeType> | EdgeReplaceChange<EdgeType>;
|
|
51
51
|
//# sourceMappingURL=changes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changes.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/types/changes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;AAEpC,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,gBAAgB,CAAC,EAAE,UAAU,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI;IACxD,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,KAAK,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI;IAC5D,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"changes.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/types/changes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;AAEpC,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,gBAAgB,CAAC,EAAE,UAAU,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI;IACxD,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,KAAK,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI;IAC5D,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAC/C,mBAAmB,GACnB,kBAAkB,GAClB,mBAAmB,GACnB,gBAAgB,GAChB,aAAa,CAAC,QAAQ,CAAC,GACvB,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAEhC,MAAM,MAAM,mBAAmB,GAAG,mBAAmB,CAAC;AACtD,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAChD,MAAM,MAAM,aAAa,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI;IACxD,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,KAAK,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI;IAC5D,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAC/C,mBAAmB,GACnB,gBAAgB,GAChB,aAAa,CAAC,QAAQ,CAAC,GACvB,iBAAiB,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -6,118 +6,456 @@ import type { OnSelectionChangeFunc, NodeTypes, EdgeTypes, Node, Edge, Connectio
|
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
8
|
export type ReactFlowProps = Omit<HTMLAttributes<HTMLDivElement>, 'onError'> & {
|
|
9
|
+
/** An array of nodes to render in a controlled flow.
|
|
10
|
+
* @example
|
|
11
|
+
* const nodes = [
|
|
12
|
+
* {
|
|
13
|
+
* id: 'node-1',
|
|
14
|
+
* type: 'input',
|
|
15
|
+
* data: { label: 'Node 1' },
|
|
16
|
+
* position: { x: 250, y: 50 }
|
|
17
|
+
* }
|
|
18
|
+
* ];
|
|
19
|
+
*/
|
|
9
20
|
nodes?: Node[];
|
|
21
|
+
/** An array of edges to render in a controlled flow.
|
|
22
|
+
* @example
|
|
23
|
+
* const edges = [
|
|
24
|
+
* {
|
|
25
|
+
* id: 'edge-1-2',
|
|
26
|
+
* source: 'node-1',
|
|
27
|
+
* target: 'node-2',
|
|
28
|
+
* }
|
|
29
|
+
* ];
|
|
30
|
+
*/
|
|
10
31
|
edges?: Edge[];
|
|
32
|
+
/** The initial nodes to render in an uncontrolled flow. */
|
|
11
33
|
defaultNodes?: Node[];
|
|
34
|
+
/** The initial edges to render in an uncontrolled flow. */
|
|
12
35
|
defaultEdges?: Edge[];
|
|
36
|
+
/** Defaults to be applied to all new edges that are added to the flow.
|
|
37
|
+
*
|
|
38
|
+
* Properties on a new edge will override these defaults if they exist.
|
|
39
|
+
* @example
|
|
40
|
+
* const defaultEdgeOptions = {
|
|
41
|
+
* type: 'customEdgeType',
|
|
42
|
+
* animated: true,
|
|
43
|
+
* interactionWidth: 10,
|
|
44
|
+
* data: { label: 'custom label' },
|
|
45
|
+
* hidden: false,
|
|
46
|
+
* deletable: true,
|
|
47
|
+
* selected: false,
|
|
48
|
+
* focusable: true,
|
|
49
|
+
* markerStart: EdgeMarker.ArrowClosed,
|
|
50
|
+
* markerEnd: EdgeMarker.ArrowClosed,
|
|
51
|
+
* zIndex: 12,
|
|
52
|
+
* ariaLabel: 'custom aria label'
|
|
53
|
+
* }
|
|
54
|
+
*/
|
|
13
55
|
defaultEdgeOptions?: DefaultEdgeOptions;
|
|
56
|
+
/** This event handler is called when a user clicks on a node */
|
|
14
57
|
onNodeClick?: NodeMouseHandler;
|
|
58
|
+
/** This event handler is called when a user double clicks on a node */
|
|
15
59
|
onNodeDoubleClick?: NodeMouseHandler;
|
|
60
|
+
/** This event handler is called when mouse of a user enters a node */
|
|
16
61
|
onNodeMouseEnter?: NodeMouseHandler;
|
|
62
|
+
/** This event handler is called when mouse of a user moves over a node */
|
|
17
63
|
onNodeMouseMove?: NodeMouseHandler;
|
|
64
|
+
/** This event handler is called when mouse of a user leaves a node */
|
|
18
65
|
onNodeMouseLeave?: NodeMouseHandler;
|
|
66
|
+
/** This event handler is called when a user right clicks on a node */
|
|
19
67
|
onNodeContextMenu?: NodeMouseHandler;
|
|
68
|
+
/** This event handler is called when a user starts to drag a node */
|
|
20
69
|
onNodeDragStart?: NodeDragHandler;
|
|
70
|
+
/** This event handler is called when a user drags a node */
|
|
21
71
|
onNodeDrag?: NodeDragHandler;
|
|
72
|
+
/** This event handler is called when a user stops dragging a node */
|
|
22
73
|
onNodeDragStop?: NodeDragHandler;
|
|
74
|
+
/** This event handler is called when a user clicks on an edge */
|
|
23
75
|
onEdgeClick?: (event: ReactMouseEvent, edge: Edge) => void;
|
|
24
|
-
|
|
76
|
+
/** This event handler is called when a user right clicks on an edge */
|
|
25
77
|
onEdgeContextMenu?: EdgeMouseHandler;
|
|
78
|
+
/** This event handler is called when mouse of a user enters an edge */
|
|
26
79
|
onEdgeMouseEnter?: EdgeMouseHandler;
|
|
80
|
+
/** This event handler is called when mouse of a user moves over an edge */
|
|
27
81
|
onEdgeMouseMove?: EdgeMouseHandler;
|
|
82
|
+
/** This event handler is called when mouse of a user leaves an edge */
|
|
28
83
|
onEdgeMouseLeave?: EdgeMouseHandler;
|
|
84
|
+
/** This event handler is called when a user double clicks on an edge */
|
|
29
85
|
onEdgeDoubleClick?: EdgeMouseHandler;
|
|
30
86
|
onEdgeUpdateStart?: (event: ReactMouseEvent, edge: Edge, handleType: HandleType) => void;
|
|
31
87
|
onEdgeUpdateEnd?: (event: MouseEvent | TouchEvent, edge: Edge, handleType: HandleType) => void;
|
|
88
|
+
onEdgeUpdate?: OnEdgeUpdateFunc;
|
|
89
|
+
/** This event handler is called when a Node is updated
|
|
90
|
+
* @example // Use NodesState hook to create edges and get onNodesChange handler
|
|
91
|
+
* import ReactFlow, { useNodesState } from '@xyflow/react';
|
|
92
|
+
* const [edges, setNodes, onNodesChange] = useNodesState(initialNodes);
|
|
93
|
+
*
|
|
94
|
+
* return (<ReactFlow onNodeChange={onNodeChange} {...rest} />)
|
|
95
|
+
* @example // Use helper function to update edge
|
|
96
|
+
* import ReactFlow, { applyNodeChanges } from '@xyflow/react';
|
|
97
|
+
*
|
|
98
|
+
* const onNodeChange = useCallback(
|
|
99
|
+
* (changes) => setNode((eds) => applyNodeChanges(changes, eds)),
|
|
100
|
+
* [],
|
|
101
|
+
* );
|
|
102
|
+
*
|
|
103
|
+
* return (<ReactFlow onNodeChange={onNodeChange} {...rest} />)
|
|
104
|
+
*/
|
|
32
105
|
onNodesChange?: OnNodesChange;
|
|
106
|
+
/** This event handler is called when a Edge is updated
|
|
107
|
+
* @example // Use EdgesState hook to create edges and get onEdgesChange handler
|
|
108
|
+
* import ReactFlow, { useEdgesState } from '@xyflow/react';
|
|
109
|
+
* const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
|
|
110
|
+
*
|
|
111
|
+
* return (<ReactFlow onEdgesChange={onEdgesChange} {...rest} />)
|
|
112
|
+
* @example // Use helper function to update edge
|
|
113
|
+
* import ReactFlow, { applyEdgeChanges } from '@xyflow/react';
|
|
114
|
+
*
|
|
115
|
+
* const onEdgesChange = useCallback(
|
|
116
|
+
* (changes) => setEdges((eds) => applyEdgeChanges(changes, eds)),
|
|
117
|
+
* [],
|
|
118
|
+
* );
|
|
119
|
+
*
|
|
120
|
+
* return (<ReactFlow onEdgesChange={onEdgesChange} {...rest} />)
|
|
121
|
+
*/
|
|
33
122
|
onEdgesChange?: OnEdgesChange;
|
|
123
|
+
/** This event handler gets called when a Node is deleted */
|
|
34
124
|
onNodesDelete?: OnNodesDelete;
|
|
125
|
+
/** This event handler gets called when a Edge is deleted */
|
|
35
126
|
onEdgesDelete?: OnEdgesDelete;
|
|
127
|
+
/** This event handler gets called when a Node or Edge is deleted */
|
|
36
128
|
onDelete?: OnDelete;
|
|
129
|
+
/** This event handler gets called when a user starts to drag a selection box */
|
|
37
130
|
onSelectionDragStart?: SelectionDragHandler;
|
|
131
|
+
/** This event handler gets called when a user drags a selection box */
|
|
38
132
|
onSelectionDrag?: SelectionDragHandler;
|
|
133
|
+
/** This event handler gets called when a user stops dragging a selection box */
|
|
39
134
|
onSelectionDragStop?: SelectionDragHandler;
|
|
40
135
|
onSelectionStart?: (event: ReactMouseEvent) => void;
|
|
41
136
|
onSelectionEnd?: (event: ReactMouseEvent) => void;
|
|
42
137
|
onSelectionContextMenu?: (event: ReactMouseEvent, nodes: Node[]) => void;
|
|
138
|
+
/** When a connection line is completed and two nodes are connected by the user, this event fires with the new connection.
|
|
139
|
+
*
|
|
140
|
+
* You can use the addEdge utility to convert the connection to a complete edge.
|
|
141
|
+
* @example // Use helper function to update edges onConnect
|
|
142
|
+
* import ReactFlow, { addEdge } from '@xyflow/react';
|
|
143
|
+
*
|
|
144
|
+
* const onConnect = useCallback(
|
|
145
|
+
* (params) => setEdges((eds) => addEdge(params, eds)),
|
|
146
|
+
* [],
|
|
147
|
+
* );
|
|
148
|
+
*
|
|
149
|
+
* return (<ReactFlow onConnect={onConnect} {...rest} />)
|
|
150
|
+
*/
|
|
43
151
|
onConnect?: OnConnect;
|
|
152
|
+
/** This event handler gets called when a user starts to drag a connection line */
|
|
44
153
|
onConnectStart?: OnConnectStart;
|
|
154
|
+
/** This event handler gets called when a user stops dragging a connection line */
|
|
45
155
|
onConnectEnd?: OnConnectEnd;
|
|
46
156
|
onClickConnectStart?: OnConnectStart;
|
|
47
157
|
onClickConnectEnd?: OnConnectEnd;
|
|
158
|
+
/** This event handler gets called when a flow has finished initializing */
|
|
48
159
|
onInit?: OnInit;
|
|
160
|
+
/** This event handler is called while the user is either panning or zooming the viewport. */
|
|
49
161
|
onMove?: OnMove;
|
|
162
|
+
/** This event handler gets called when a user starts to pan or zoom the viewport */
|
|
50
163
|
onMoveStart?: OnMoveStart;
|
|
164
|
+
/** This event handler gets called when a user stops panning or zooming the viewport */
|
|
51
165
|
onMoveEnd?: OnMoveEnd;
|
|
166
|
+
/** This event handler gets called when a user changes group of selected elements in the flow */
|
|
52
167
|
onSelectionChange?: OnSelectionChangeFunc;
|
|
168
|
+
/** This event handler gets called when user scroll inside the pane */
|
|
53
169
|
onPaneScroll?: (event?: WheelEvent) => void;
|
|
170
|
+
/** This event handler gets called when user clicks inside the pane */
|
|
54
171
|
onPaneClick?: (event: ReactMouseEvent) => void;
|
|
172
|
+
/** This event handler gets called when user right clicks inside the pane */
|
|
55
173
|
onPaneContextMenu?: (event: ReactMouseEvent | MouseEvent) => void;
|
|
174
|
+
/** This event handler gets called when mouse enters the pane */
|
|
56
175
|
onPaneMouseEnter?: (event: ReactMouseEvent) => void;
|
|
176
|
+
/** This event handler gets called when mouse moves over the pane */
|
|
57
177
|
onPaneMouseMove?: (event: ReactMouseEvent) => void;
|
|
178
|
+
/** This event handler gets called when mouse leaves the pane */
|
|
58
179
|
onPaneMouseLeave?: (event: ReactMouseEvent) => void;
|
|
180
|
+
/** This handler gets called before the user deletes nodes or edges and provides a way to abort the deletion by returning false. */
|
|
59
181
|
onBeforeDelete?: OnBeforeDelete;
|
|
182
|
+
/** Custom node types to be available in a flow.
|
|
183
|
+
*
|
|
184
|
+
* React Flow matches a node's type to a component in the nodeTypes object.
|
|
185
|
+
* @example
|
|
186
|
+
* import CustomNode from './CustomNode';
|
|
187
|
+
*
|
|
188
|
+
* const nodeTypes = { nameOfNodeType: CustomNode };
|
|
189
|
+
*/
|
|
60
190
|
nodeTypes?: NodeTypes;
|
|
191
|
+
/** Custom edge types to be available in a flow.
|
|
192
|
+
*
|
|
193
|
+
* React Flow matches an edge's type to a component in the edgeTypes object.
|
|
194
|
+
* @example
|
|
195
|
+
* import CustomEdge from './CustomEdge';
|
|
196
|
+
*
|
|
197
|
+
* const edgeTypes = { nameOfEdgeType: CustomEdge };
|
|
198
|
+
*/
|
|
61
199
|
edgeTypes?: EdgeTypes;
|
|
200
|
+
/** The type of edge path to use for connection lines.
|
|
201
|
+
*
|
|
202
|
+
* Although created edges can be of any type, React Flow needs to know what type of path to render for the connection line before the edge is created!
|
|
203
|
+
*/
|
|
62
204
|
connectionLineType?: ConnectionLineType;
|
|
205
|
+
/** Styles to be applied to the connection line */
|
|
63
206
|
connectionLineStyle?: CSSProperties;
|
|
207
|
+
/** React Component to be used as a connection line */
|
|
64
208
|
connectionLineComponent?: ConnectionLineComponent;
|
|
209
|
+
/** Styles to be applied to the container of the connection line */
|
|
65
210
|
connectionLineContainerStyle?: CSSProperties;
|
|
211
|
+
/** 'strict' connection mode will only allow you to connect source handles to target handles.
|
|
212
|
+
*
|
|
213
|
+
* 'loose' connection mode will allow you to connect handles of any type to one another.
|
|
214
|
+
* @default 'strict'
|
|
215
|
+
*/
|
|
66
216
|
connectionMode?: ConnectionMode;
|
|
217
|
+
/** Pressing down this key deletes all selected nodes & edges.
|
|
218
|
+
* @default 'Backspace'
|
|
219
|
+
*/
|
|
67
220
|
deleteKeyCode?: KeyCode | null;
|
|
221
|
+
/** If a key is set, you can pan the viewport while that key is held down even if panOnScroll is set to false.
|
|
222
|
+
*
|
|
223
|
+
* By setting this prop to null you can disable this functionality.
|
|
224
|
+
* @default 'Space'
|
|
225
|
+
*/
|
|
68
226
|
selectionKeyCode?: KeyCode | null;
|
|
227
|
+
/** Select multiple elements with a selection box, without pressing down selectionKey */
|
|
69
228
|
selectionOnDrag?: boolean;
|
|
229
|
+
/** When set to "partial", when the user creates a selection box by click and dragging nodes that are only partially in the box are still selected.
|
|
230
|
+
* @default 'full'
|
|
231
|
+
*/
|
|
70
232
|
selectionMode?: SelectionMode;
|
|
233
|
+
/** If a key is set, you can pan the viewport while that key is held down even if panOnScroll is set to false.
|
|
234
|
+
*
|
|
235
|
+
* By setting this prop to null you can disable this functionality.
|
|
236
|
+
* @default 'Space'
|
|
237
|
+
*/
|
|
71
238
|
panActivationKeyCode?: KeyCode | null;
|
|
239
|
+
/** Pressing down this key you can select multiple elements by clicking.
|
|
240
|
+
* @default 'Meta' for macOS, "Ctrl" for other systems
|
|
241
|
+
*/
|
|
72
242
|
multiSelectionKeyCode?: KeyCode | null;
|
|
243
|
+
/** If a key is set, you can zoom the viewport while that key is held down even if panOnScroll is set to false.
|
|
244
|
+
*
|
|
245
|
+
* By setting this prop to null you can disable this functionality.
|
|
246
|
+
* @default 'Meta' for macOS, "Ctrl" for other systems
|
|
247
|
+
* */
|
|
73
248
|
zoomActivationKeyCode?: KeyCode | null;
|
|
249
|
+
/** Set this prop to make the flow snap to the grid */
|
|
74
250
|
snapToGrid?: boolean;
|
|
251
|
+
/** Grid all nodes will snap to
|
|
252
|
+
* @example [20, 20]
|
|
253
|
+
*/
|
|
75
254
|
snapGrid?: SnapGrid;
|
|
255
|
+
/** You can enable this optimisation to instruct Svelte Flow to only render nodes and edges that would be visible in the viewport.
|
|
256
|
+
*
|
|
257
|
+
* This might improve performance when you have a large number of nodes and edges but also adds an overhead.
|
|
258
|
+
* @default false
|
|
259
|
+
*/
|
|
76
260
|
onlyRenderVisibleElements?: boolean;
|
|
261
|
+
/** Controls if all nodes should be draggable
|
|
262
|
+
* @default true
|
|
263
|
+
*/
|
|
77
264
|
nodesDraggable?: boolean;
|
|
265
|
+
/** Controls if all nodes should be connectable to each other
|
|
266
|
+
* @default true
|
|
267
|
+
*/
|
|
78
268
|
nodesConnectable?: boolean;
|
|
269
|
+
/** Controls if all nodes should be focusable
|
|
270
|
+
* @default true
|
|
271
|
+
*/
|
|
79
272
|
nodesFocusable?: boolean;
|
|
273
|
+
/** Defines nodes relative position to its coordinates
|
|
274
|
+
* @example
|
|
275
|
+
* [0, 0] // default, top left
|
|
276
|
+
* [0.5, 0.5] // center
|
|
277
|
+
* [1, 1] // bottom right
|
|
278
|
+
*/
|
|
80
279
|
nodeOrigin?: NodeOrigin;
|
|
280
|
+
/** Controls if all edges should be focusable
|
|
281
|
+
* @default true
|
|
282
|
+
*/
|
|
81
283
|
edgesFocusable?: boolean;
|
|
284
|
+
/** Controls if all edges should be updateable
|
|
285
|
+
* @default true
|
|
286
|
+
*/
|
|
82
287
|
edgesUpdatable?: boolean;
|
|
288
|
+
/** Controls if all elements should (nodes & edges) be selectable
|
|
289
|
+
* @default true
|
|
290
|
+
*/
|
|
83
291
|
elementsSelectable?: boolean;
|
|
292
|
+
/** If true, nodes get selected on drag
|
|
293
|
+
* @default true
|
|
294
|
+
*/
|
|
84
295
|
selectNodesOnDrag?: boolean;
|
|
296
|
+
/** Enableing this prop allows users to pan the viewport by clicking and dragging.
|
|
297
|
+
*
|
|
298
|
+
* You can also set this prop to an array of numbers to limit which mouse buttons can activate panning.
|
|
299
|
+
* @example [0, 2] // allows panning with the left and right mouse buttons
|
|
300
|
+
* [0, 1, 2, 3, 4] // allows panning with all mouse buttons
|
|
301
|
+
*/
|
|
85
302
|
panOnDrag?: boolean | number[];
|
|
303
|
+
/** Minimum zoom level
|
|
304
|
+
* @default 0.1
|
|
305
|
+
*/
|
|
86
306
|
minZoom?: number;
|
|
307
|
+
/** Maximum zoom level
|
|
308
|
+
* @default 1
|
|
309
|
+
*/
|
|
87
310
|
maxZoom?: number;
|
|
311
|
+
/** Controlled viewport to be used instead of internal one */
|
|
88
312
|
viewport?: Viewport;
|
|
313
|
+
/** Sets the initial position and zoom of the viewport.
|
|
314
|
+
*
|
|
315
|
+
* If a default viewport is provided but fitView is enabled, the default viewport will be ignored.
|
|
316
|
+
* @example
|
|
317
|
+
* const initialViewport = {
|
|
318
|
+
* zoom: 0.5,
|
|
319
|
+
* position: { x: 0, y: 0 }
|
|
320
|
+
* };
|
|
321
|
+
*/
|
|
89
322
|
defaultViewport?: Viewport;
|
|
323
|
+
/**
|
|
324
|
+
* Gets called when the viewport changes.
|
|
325
|
+
*/
|
|
90
326
|
onViewportChange?: (viewport: Viewport) => void;
|
|
327
|
+
/** By default the viewport extends infinitely. You can use this prop to set a boundary.
|
|
328
|
+
*
|
|
329
|
+
* The first pair of coordinates is the top left boundary and the second pair is the bottom right.
|
|
330
|
+
* @example [[-1000, -10000], [1000, 1000]]
|
|
331
|
+
*/
|
|
91
332
|
translateExtent?: CoordinateExtent;
|
|
333
|
+
/** Disabling this prop will allow the user to scroll the page even when their pointer is over the flow.
|
|
334
|
+
* @default true
|
|
335
|
+
*/
|
|
92
336
|
preventScrolling?: boolean;
|
|
337
|
+
/** By default nodes can be placed on an infinite flow. You can use this prop to set a boundary.
|
|
338
|
+
*
|
|
339
|
+
* The first pair of coordinates is the top left boundary and the second pair is the bottom right.
|
|
340
|
+
* @example [[-1000, -10000], [1000, 1000]]
|
|
341
|
+
*/
|
|
93
342
|
nodeExtent?: CoordinateExtent;
|
|
343
|
+
/** Color of edge markers
|
|
344
|
+
* @example "#b1b1b7"
|
|
345
|
+
*/
|
|
94
346
|
defaultMarkerColor?: string;
|
|
347
|
+
/** Controls if the viewport should zoom by scrolling inside the container */
|
|
95
348
|
zoomOnScroll?: boolean;
|
|
349
|
+
/** Controls if the viewport should zoom by pinching on a touch screen */
|
|
96
350
|
zoomOnPinch?: boolean;
|
|
351
|
+
/** Controls if the viewport should pan by scrolling inside the container
|
|
352
|
+
*
|
|
353
|
+
* Can be limited to a specific direction with panOnScrollMode
|
|
354
|
+
*/
|
|
97
355
|
panOnScroll?: boolean;
|
|
356
|
+
/** Controls how fast viewport should be panned on scroll.
|
|
357
|
+
*
|
|
358
|
+
* Use togther with panOnScroll prop.
|
|
359
|
+
*/
|
|
98
360
|
panOnScrollSpeed?: number;
|
|
361
|
+
/** This prop is used to limit the direction of panning when panOnScroll is enabled.
|
|
362
|
+
*
|
|
363
|
+
* The "free" option allows panning in any direction.
|
|
364
|
+
* @default "free"
|
|
365
|
+
* @example "horizontal" | "vertical"
|
|
366
|
+
*/
|
|
99
367
|
panOnScrollMode?: PanOnScrollMode;
|
|
368
|
+
/** Controls if the viewport should zoom by double clicking somewhere on the flow */
|
|
100
369
|
zoomOnDoubleClick?: boolean;
|
|
101
370
|
edgeUpdaterRadius?: number;
|
|
102
371
|
noDragClassName?: string;
|
|
103
372
|
noWheelClassName?: string;
|
|
104
373
|
noPanClassName?: string;
|
|
374
|
+
/** If set, initial viewport will show all nodes & edges */
|
|
105
375
|
fitView?: boolean;
|
|
376
|
+
/** Options to be used in combination with fitView
|
|
377
|
+
* @example
|
|
378
|
+
* const fitViewOptions = {
|
|
379
|
+
* padding: 0.1,
|
|
380
|
+
* includeHiddenNodes: false,
|
|
381
|
+
* minZoom: 0.1,
|
|
382
|
+
* maxZoom: 1,
|
|
383
|
+
* duration: 200,
|
|
384
|
+
* nodes: [{id: 'node-1'}, {id: 'node-2'}], // nodes to fit
|
|
385
|
+
* };
|
|
386
|
+
*/
|
|
106
387
|
fitViewOptions?: FitViewOptions;
|
|
388
|
+
/**The connectOnClick option lets you click or tap on a source handle to start a connection
|
|
389
|
+
* and then click on a target handle to complete the connection.
|
|
390
|
+
*
|
|
391
|
+
* If you set this option to false, users will need to drag the connection line to the target
|
|
392
|
+
* handle to create a connection.
|
|
393
|
+
*/
|
|
107
394
|
connectOnClick?: boolean;
|
|
395
|
+
/** Set position of the attribution
|
|
396
|
+
* @default 'bottom-right'
|
|
397
|
+
* @example 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'
|
|
398
|
+
*/
|
|
108
399
|
attributionPosition?: PanelPosition;
|
|
400
|
+
/** By default, we render a small attribution in the corner of your flows that links back to the project.
|
|
401
|
+
*
|
|
402
|
+
* Anyone is free to remove this attribution whether they're a Pro subscriber or not
|
|
403
|
+
* but we ask that you take a quick look at our {@link https://reactflow.dev/learn/troubleshooting/remove-attribution | removing attribution guide}
|
|
404
|
+
* before doing so.
|
|
405
|
+
*/
|
|
109
406
|
proOptions?: ProOptions;
|
|
407
|
+
/** Enabling this option will raise the z-index of nodes when they are selected.
|
|
408
|
+
* @default true
|
|
409
|
+
*/
|
|
110
410
|
elevateNodesOnSelect?: boolean;
|
|
411
|
+
/** Enabling this option will raise the z-index of edges when they are selected.
|
|
412
|
+
* @default true
|
|
413
|
+
*/
|
|
111
414
|
elevateEdgesOnSelect?: boolean;
|
|
415
|
+
/**
|
|
416
|
+
* Can be set true if built-in keyboard controls should be disabled.
|
|
417
|
+
* @default false
|
|
418
|
+
*/
|
|
112
419
|
disableKeyboardA11y?: boolean;
|
|
420
|
+
/** You can enable this prop to automatically pan the viewport while dragging a node.
|
|
421
|
+
* @default true
|
|
422
|
+
*/
|
|
113
423
|
autoPanOnNodeDrag?: boolean;
|
|
424
|
+
/** You can enable this prop to automatically pan the viewport while dragging a node.
|
|
425
|
+
* @default true
|
|
426
|
+
*/
|
|
114
427
|
autoPanOnConnect?: boolean;
|
|
428
|
+
/** You can enable this prop to automatically pan the viewport while making a new connection.
|
|
429
|
+
* @default true
|
|
430
|
+
*/
|
|
115
431
|
connectionRadius?: number;
|
|
432
|
+
/** Ocassionally something may happen that causes Svelte Flow to throw an error.
|
|
433
|
+
*
|
|
434
|
+
* Instead of exploding your application, we log a message to the console and then call this event handler.
|
|
435
|
+
* You might use it for additional logging or to show a message to the user.
|
|
436
|
+
*/
|
|
116
437
|
onError?: OnError;
|
|
438
|
+
/** This callback can be used to validate a new connection
|
|
439
|
+
*
|
|
440
|
+
* If you return false, the edge will not be added to your flow.
|
|
441
|
+
* If you have custom connection logic its preferred to use this callback over the isValidConnection prop on the handle component for performance reasons.
|
|
442
|
+
* @default (connection: Connection) => true
|
|
443
|
+
*/
|
|
117
444
|
isValidConnection?: IsValidConnection;
|
|
445
|
+
/** With a threshold greater than zero you can control the distinction between node drag and click events.
|
|
446
|
+
*
|
|
447
|
+
* If threshold equals 1, you need to drag the node 1 pixel before a drag event is fired.
|
|
448
|
+
* @default 1
|
|
449
|
+
*/
|
|
118
450
|
nodeDragThreshold?: number;
|
|
451
|
+
/** Sets a fixed width for the flow */
|
|
119
452
|
width?: number;
|
|
453
|
+
/** Sets a fixed height for the flow */
|
|
120
454
|
height?: number;
|
|
455
|
+
/** Controls color scheme used for styling the flow
|
|
456
|
+
* @default 'system'
|
|
457
|
+
* @example 'system' | 'light' | 'dark'
|
|
458
|
+
*/
|
|
121
459
|
colorMode?: ColorMode;
|
|
122
460
|
};
|
|
123
461
|
export type ReactFlowRefType = HTMLDivElement;
|