@xyflow/react 12.1.1 → 12.2.0
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/esm/components/EdgeWrapper/EdgeUpdateAnchors.d.ts +1 -3
- package/dist/esm/components/EdgeWrapper/EdgeUpdateAnchors.d.ts.map +1 -1
- package/dist/esm/components/EdgeWrapper/index.d.ts.map +1 -1
- package/dist/esm/hooks/useReactFlow.d.ts.map +1 -1
- package/dist/esm/index.js +32 -18
- package/dist/esm/index.mjs +32 -18
- package/dist/esm/types/instance.d.ts +14 -1
- package/dist/esm/types/instance.d.ts.map +1 -1
- package/dist/esm/utils/changes.d.ts.map +1 -1
- package/dist/umd/components/EdgeWrapper/EdgeUpdateAnchors.d.ts +1 -3
- package/dist/umd/components/EdgeWrapper/EdgeUpdateAnchors.d.ts.map +1 -1
- package/dist/umd/components/EdgeWrapper/index.d.ts.map +1 -1
- package/dist/umd/hooks/useReactFlow.d.ts.map +1 -1
- package/dist/umd/index.js +2 -2
- package/dist/umd/types/instance.d.ts +14 -1
- package/dist/umd/types/instance.d.ts.map +1 -1
- package/dist/umd/utils/changes.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -4,14 +4,12 @@ type EdgeUpdateAnchorsProps<EdgeType extends Edge = Edge> = {
|
|
|
4
4
|
edge: EdgeType;
|
|
5
5
|
isReconnectable: boolean | 'source' | 'target';
|
|
6
6
|
reconnectRadius: EdgeWrapperProps['reconnectRadius'];
|
|
7
|
-
sourceHandleId: Edge['sourceHandle'];
|
|
8
|
-
targetHandleId: Edge['targetHandle'];
|
|
9
7
|
onReconnect: EdgeWrapperProps<EdgeType>['onReconnect'];
|
|
10
8
|
onReconnectStart: EdgeWrapperProps<EdgeType>['onReconnectStart'];
|
|
11
9
|
onReconnectEnd: EdgeWrapperProps<EdgeType>['onReconnectEnd'];
|
|
12
10
|
setUpdateHover: (hover: boolean) => void;
|
|
13
11
|
setReconnecting: (updating: boolean) => void;
|
|
14
12
|
} & EdgePosition;
|
|
15
|
-
export declare function EdgeUpdateAnchors<EdgeType extends Edge = Edge>({ isReconnectable, reconnectRadius, edge,
|
|
13
|
+
export declare function EdgeUpdateAnchors<EdgeType extends Edge = Edge>({ isReconnectable, reconnectRadius, edge, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, onReconnect, onReconnectStart, onReconnectEnd, setReconnecting, setUpdateHover, }: EdgeUpdateAnchorsProps<EdgeType>): import("react/jsx-runtime").JSX.Element;
|
|
16
14
|
export {};
|
|
17
15
|
//# sourceMappingURL=EdgeUpdateAnchors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EdgeUpdateAnchors.d.ts","sourceRoot":"","sources":["../../../src/components/EdgeWrapper/EdgeUpdateAnchors.tsx"],"names":[],"mappings":"AACA,OAAO,EAA6B,YAAY,
|
|
1
|
+
{"version":3,"file":"EdgeUpdateAnchors.d.ts","sourceRoot":"","sources":["../../../src/components/EdgeWrapper/EdgeUpdateAnchors.tsx"],"names":[],"mappings":"AACA,OAAO,EAA6B,YAAY,EAAoC,MAAM,gBAAgB,CAAC;AAG3G,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGhE,KAAK,sBAAsB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI;IAC1D,IAAI,EAAE,QAAQ,CAAC;IACf,eAAe,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC/C,eAAe,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;IACrD,WAAW,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC,aAAa,CAAC,CAAC;IACvD,gBAAgB,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC,kBAAkB,CAAC,CAAC;IACjE,cAAc,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC,gBAAgB,CAAC,CAAC;IAC7D,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,eAAe,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C,GAAG,YAAY,CAAC;AAEjB,wBAAgB,iBAAiB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,EAC9D,eAAe,EACf,eAAe,EACf,IAAI,EACJ,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,cAAc,EACd,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,cAAc,GACf,EAAE,sBAAsB,CAAC,QAAQ,CAAC,2CAmGlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/EdgeWrapper/index.tsx"],"names":[],"mappings":";AAeA,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE1D,wBAAgB,WAAW,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,EACxD,EAAE,EACF,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,OAAO,EACP,aAAa,EACb,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,IAAI,EACJ,SAAS,EACT,cAAc,EACd,OAAO,EACP,mBAAmB,GACpB,EAAE,gBAAgB,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/EdgeWrapper/index.tsx"],"names":[],"mappings":";AAeA,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE1D,wBAAgB,WAAW,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,EACxD,EAAE,EACF,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,OAAO,EACP,aAAa,EACb,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,IAAI,EACJ,SAAS,EACT,cAAc,EACd,OAAO,EACP,mBAAmB,GACpB,EAAE,gBAAgB,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAiOjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReactFlow.d.ts","sourceRoot":"","sources":["../../src/hooks/useReactFlow.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,IAAI,EAAgD,MAAM,UAAU,CAAC;AAI5G;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,KAAK,iBAAiB,CAC3G,QAAQ,EACR,QAAQ,CACT,
|
|
1
|
+
{"version":3,"file":"useReactFlow.d.ts","sourceRoot":"","sources":["../../src/hooks/useReactFlow.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,IAAI,EAAgD,MAAM,UAAU,CAAC;AAI5G;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,KAAK,iBAAiB,CAC3G,QAAQ,EACR,QAAQ,CACT,CA4NA"}
|
package/dist/esm/index.js
CHANGED
|
@@ -511,9 +511,10 @@ function applyChanges(changes, elements) {
|
|
|
511
511
|
// By storing a map of changes for each element, we can a quick lookup as we
|
|
512
512
|
// iterate over the elements array!
|
|
513
513
|
const changesMap = new Map();
|
|
514
|
+
const addItemChanges = [];
|
|
514
515
|
for (const change of changes) {
|
|
515
516
|
if (change.type === 'add') {
|
|
516
|
-
|
|
517
|
+
addItemChanges.push(change);
|
|
517
518
|
continue;
|
|
518
519
|
}
|
|
519
520
|
else if (change.type === 'remove' || change.type === 'replace') {
|
|
@@ -558,6 +559,18 @@ function applyChanges(changes, elements) {
|
|
|
558
559
|
}
|
|
559
560
|
updatedElements.push(updatedElement);
|
|
560
561
|
}
|
|
562
|
+
// we need to wait for all changes to be applied before adding new items
|
|
563
|
+
// to be able to add them at the correct index
|
|
564
|
+
if (addItemChanges.length) {
|
|
565
|
+
addItemChanges.forEach((change) => {
|
|
566
|
+
if (change.index !== undefined) {
|
|
567
|
+
updatedElements.splice(change.index, 0, { ...change.item });
|
|
568
|
+
}
|
|
569
|
+
else {
|
|
570
|
+
updatedElements.push({ ...change.item });
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
}
|
|
561
574
|
return updatedElements;
|
|
562
575
|
}
|
|
563
576
|
// Applies a single change to an element. This is a *mutable* update.
|
|
@@ -666,14 +679,14 @@ function getSelectionChanges(items, selectedIds = new Set(), mutateItem = false)
|
|
|
666
679
|
function getElementsDiffChanges({ items = [], lookup, }) {
|
|
667
680
|
const changes = [];
|
|
668
681
|
const itemsLookup = new Map(items.map((item) => [item.id, item]));
|
|
669
|
-
for (const item of items) {
|
|
682
|
+
for (const [index, item] of items.entries()) {
|
|
670
683
|
const lookupItem = lookup.get(item.id);
|
|
671
684
|
const storeItem = lookupItem?.internals?.userNode ?? lookupItem;
|
|
672
685
|
if (storeItem !== undefined && storeItem !== item) {
|
|
673
686
|
changes.push({ id: item.id, item: item, type: 'replace' });
|
|
674
687
|
}
|
|
675
688
|
if (storeItem === undefined) {
|
|
676
|
-
changes.push({ item: item, type: 'add' });
|
|
689
|
+
changes.push({ item: item, type: 'add', index });
|
|
677
690
|
}
|
|
678
691
|
}
|
|
679
692
|
for (const [id] of lookup) {
|
|
@@ -980,6 +993,10 @@ function useReactFlow() {
|
|
|
980
993
|
return options.replace ? { ...edge, data: nextData } : { ...edge, data: { ...edge.data, ...nextData } };
|
|
981
994
|
}, options);
|
|
982
995
|
},
|
|
996
|
+
getHandleConnections: ({ type, id, nodeId }) => Array.from(store
|
|
997
|
+
.getState()
|
|
998
|
+
.connectionLookup.get(`${nodeId}-${type}-${id ?? null}`)
|
|
999
|
+
?.values() ?? []),
|
|
983
1000
|
};
|
|
984
1001
|
}, []);
|
|
985
1002
|
return useMemo(() => {
|
|
@@ -2242,23 +2259,20 @@ function EdgeAnchor({ position, centerX, centerY, radius = 10, onMouseDown, onMo
|
|
|
2242
2259
|
return (jsx("circle", { onMouseDown: onMouseDown, onMouseEnter: onMouseEnter, onMouseOut: onMouseOut, className: cc([EdgeUpdaterClassName, `${EdgeUpdaterClassName}-${type}`]), cx: shiftX(centerX, radius, position), cy: shiftY(centerY, radius, position), r: radius, stroke: "transparent", fill: "transparent" }));
|
|
2243
2260
|
}
|
|
2244
2261
|
|
|
2245
|
-
function EdgeUpdateAnchors({ isReconnectable, reconnectRadius, edge,
|
|
2262
|
+
function EdgeUpdateAnchors({ isReconnectable, reconnectRadius, edge, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, onReconnect, onReconnectStart, onReconnectEnd, setReconnecting, setUpdateHover, }) {
|
|
2246
2263
|
const store = useStoreApi();
|
|
2247
|
-
const handleEdgeUpdater = (event,
|
|
2264
|
+
const handleEdgeUpdater = (event, oppositeHandle) => {
|
|
2248
2265
|
// avoid triggering edge updater if mouse btn is not left
|
|
2249
2266
|
if (event.button !== 0) {
|
|
2250
2267
|
return;
|
|
2251
2268
|
}
|
|
2252
2269
|
const { autoPanOnConnect, domNode, isValidConnection, connectionMode, connectionRadius, lib, onConnectStart, onConnectEnd, cancelConnection, nodeLookup, rfId: flowId, panBy, updateConnection, } = store.getState();
|
|
2253
|
-
const
|
|
2254
|
-
const handleId = (isSourceHandle ? targetHandleId : sourceHandleId) || null;
|
|
2255
|
-
const handleType = isSourceHandle ? 'target' : 'source';
|
|
2256
|
-
const isTarget = isSourceHandle;
|
|
2270
|
+
const isTarget = oppositeHandle.type === 'target';
|
|
2257
2271
|
setReconnecting(true);
|
|
2258
|
-
onReconnectStart?.(event, edge,
|
|
2272
|
+
onReconnectStart?.(event, edge, oppositeHandle.type);
|
|
2259
2273
|
const _onReconnectEnd = (evt, connectionState) => {
|
|
2260
2274
|
setReconnecting(false);
|
|
2261
|
-
onReconnectEnd?.(evt, edge,
|
|
2275
|
+
onReconnectEnd?.(evt, edge, oppositeHandle.type, connectionState);
|
|
2262
2276
|
};
|
|
2263
2277
|
const onConnectEdge = (connection) => onReconnect?.(edge, connection);
|
|
2264
2278
|
XYHandle.onPointerDown(event.nativeEvent, {
|
|
@@ -2266,11 +2280,11 @@ function EdgeUpdateAnchors({ isReconnectable, reconnectRadius, edge, targetHandl
|
|
|
2266
2280
|
connectionMode,
|
|
2267
2281
|
connectionRadius,
|
|
2268
2282
|
domNode,
|
|
2269
|
-
handleId,
|
|
2270
|
-
nodeId,
|
|
2283
|
+
handleId: oppositeHandle.id,
|
|
2284
|
+
nodeId: oppositeHandle.nodeId,
|
|
2271
2285
|
nodeLookup,
|
|
2272
2286
|
isTarget,
|
|
2273
|
-
edgeUpdaterType:
|
|
2287
|
+
edgeUpdaterType: oppositeHandle.type,
|
|
2274
2288
|
lib,
|
|
2275
2289
|
flowId,
|
|
2276
2290
|
cancelConnection,
|
|
@@ -2285,11 +2299,11 @@ function EdgeUpdateAnchors({ isReconnectable, reconnectRadius, edge, targetHandl
|
|
|
2285
2299
|
getFromHandle: () => store.getState().connection.fromHandle,
|
|
2286
2300
|
});
|
|
2287
2301
|
};
|
|
2288
|
-
const onReconnectSourceMouseDown = (event) => handleEdgeUpdater(event,
|
|
2289
|
-
const onReconnectTargetMouseDown = (event) => handleEdgeUpdater(event,
|
|
2302
|
+
const onReconnectSourceMouseDown = (event) => handleEdgeUpdater(event, { nodeId: edge.target, id: edge.targetHandle ?? null, type: 'target' });
|
|
2303
|
+
const onReconnectTargetMouseDown = (event) => handleEdgeUpdater(event, { nodeId: edge.source, id: edge.sourceHandle ?? null, type: 'source' });
|
|
2290
2304
|
const onReconnectMouseEnter = () => setUpdateHover(true);
|
|
2291
2305
|
const onReconnectMouseOut = () => setUpdateHover(false);
|
|
2292
|
-
return (jsxs(Fragment, { children: [(isReconnectable ===
|
|
2306
|
+
return (jsxs(Fragment, { children: [(isReconnectable === true || isReconnectable === 'source') && (jsx(EdgeAnchor, { position: sourcePosition, centerX: sourceX, centerY: sourceY, radius: reconnectRadius, onMouseDown: onReconnectSourceMouseDown, onMouseEnter: onReconnectMouseEnter, onMouseOut: onReconnectMouseOut, type: "source" })), (isReconnectable === true || isReconnectable === 'target') && (jsx(EdgeAnchor, { position: targetPosition, centerX: targetX, centerY: targetY, radius: reconnectRadius, onMouseDown: onReconnectTargetMouseDown, onMouseEnter: onReconnectMouseEnter, onMouseOut: onReconnectMouseOut, type: "target" }))] }));
|
|
2293
2307
|
}
|
|
2294
2308
|
|
|
2295
2309
|
function EdgeWrapper({ id, edgesFocusable, edgesReconnectable, elementsSelectable, onClick, onDoubleClick, onContextMenu, onMouseEnter, onMouseMove, onMouseLeave, reconnectRadius, onReconnect, onReconnectStart, onReconnectEnd, rfId, edgeTypes, noPanClassName, onError, disableKeyboardA11y, }) {
|
|
@@ -2412,7 +2426,7 @@ function EdgeWrapper({ id, edgesFocusable, edgesReconnectable, elementsSelectabl
|
|
|
2412
2426
|
updating: updateHover,
|
|
2413
2427
|
selectable: isSelectable,
|
|
2414
2428
|
},
|
|
2415
|
-
]), 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: [!reconnecting && (jsx(EdgeComponent, { id: id, source: edge.source, target: edge.target, type: edge.type, selected: edge.selected, animated: edge.animated, selectable: isSelectable, deletable: edge.deletable ?? true, 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 })), isReconnectable && (jsx(EdgeUpdateAnchors, { edge: edge, isReconnectable: isReconnectable, reconnectRadius: reconnectRadius, onReconnect: onReconnect, onReconnectStart: onReconnectStart, onReconnectEnd: onReconnectEnd, sourceX: sourceX, sourceY: sourceY, targetX: targetX, targetY: targetY, sourcePosition: sourcePosition, targetPosition: targetPosition, setUpdateHover: setUpdateHover, setReconnecting: setReconnecting
|
|
2429
|
+
]), 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: [!reconnecting && (jsx(EdgeComponent, { id: id, source: edge.source, target: edge.target, type: edge.type, selected: edge.selected, animated: edge.animated, selectable: isSelectable, deletable: edge.deletable ?? true, 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 })), isReconnectable && (jsx(EdgeUpdateAnchors, { edge: edge, isReconnectable: isReconnectable, reconnectRadius: reconnectRadius, onReconnect: onReconnect, onReconnectStart: onReconnectStart, onReconnectEnd: onReconnectEnd, sourceX: sourceX, sourceY: sourceY, targetX: targetX, targetY: targetY, sourcePosition: sourcePosition, targetPosition: targetPosition, setUpdateHover: setUpdateHover, setReconnecting: setReconnecting }))] }) }));
|
|
2416
2430
|
}
|
|
2417
2431
|
|
|
2418
2432
|
const selector$a = (s) => ({
|
package/dist/esm/index.mjs
CHANGED
|
@@ -511,9 +511,10 @@ function applyChanges(changes, elements) {
|
|
|
511
511
|
// By storing a map of changes for each element, we can a quick lookup as we
|
|
512
512
|
// iterate over the elements array!
|
|
513
513
|
const changesMap = new Map();
|
|
514
|
+
const addItemChanges = [];
|
|
514
515
|
for (const change of changes) {
|
|
515
516
|
if (change.type === 'add') {
|
|
516
|
-
|
|
517
|
+
addItemChanges.push(change);
|
|
517
518
|
continue;
|
|
518
519
|
}
|
|
519
520
|
else if (change.type === 'remove' || change.type === 'replace') {
|
|
@@ -558,6 +559,18 @@ function applyChanges(changes, elements) {
|
|
|
558
559
|
}
|
|
559
560
|
updatedElements.push(updatedElement);
|
|
560
561
|
}
|
|
562
|
+
// we need to wait for all changes to be applied before adding new items
|
|
563
|
+
// to be able to add them at the correct index
|
|
564
|
+
if (addItemChanges.length) {
|
|
565
|
+
addItemChanges.forEach((change) => {
|
|
566
|
+
if (change.index !== undefined) {
|
|
567
|
+
updatedElements.splice(change.index, 0, { ...change.item });
|
|
568
|
+
}
|
|
569
|
+
else {
|
|
570
|
+
updatedElements.push({ ...change.item });
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
}
|
|
561
574
|
return updatedElements;
|
|
562
575
|
}
|
|
563
576
|
// Applies a single change to an element. This is a *mutable* update.
|
|
@@ -666,14 +679,14 @@ function getSelectionChanges(items, selectedIds = new Set(), mutateItem = false)
|
|
|
666
679
|
function getElementsDiffChanges({ items = [], lookup, }) {
|
|
667
680
|
const changes = [];
|
|
668
681
|
const itemsLookup = new Map(items.map((item) => [item.id, item]));
|
|
669
|
-
for (const item of items) {
|
|
682
|
+
for (const [index, item] of items.entries()) {
|
|
670
683
|
const lookupItem = lookup.get(item.id);
|
|
671
684
|
const storeItem = lookupItem?.internals?.userNode ?? lookupItem;
|
|
672
685
|
if (storeItem !== undefined && storeItem !== item) {
|
|
673
686
|
changes.push({ id: item.id, item: item, type: 'replace' });
|
|
674
687
|
}
|
|
675
688
|
if (storeItem === undefined) {
|
|
676
|
-
changes.push({ item: item, type: 'add' });
|
|
689
|
+
changes.push({ item: item, type: 'add', index });
|
|
677
690
|
}
|
|
678
691
|
}
|
|
679
692
|
for (const [id] of lookup) {
|
|
@@ -980,6 +993,10 @@ function useReactFlow() {
|
|
|
980
993
|
return options.replace ? { ...edge, data: nextData } : { ...edge, data: { ...edge.data, ...nextData } };
|
|
981
994
|
}, options);
|
|
982
995
|
},
|
|
996
|
+
getHandleConnections: ({ type, id, nodeId }) => Array.from(store
|
|
997
|
+
.getState()
|
|
998
|
+
.connectionLookup.get(`${nodeId}-${type}-${id ?? null}`)
|
|
999
|
+
?.values() ?? []),
|
|
983
1000
|
};
|
|
984
1001
|
}, []);
|
|
985
1002
|
return useMemo(() => {
|
|
@@ -2242,23 +2259,20 @@ function EdgeAnchor({ position, centerX, centerY, radius = 10, onMouseDown, onMo
|
|
|
2242
2259
|
return (jsx("circle", { onMouseDown: onMouseDown, onMouseEnter: onMouseEnter, onMouseOut: onMouseOut, className: cc([EdgeUpdaterClassName, `${EdgeUpdaterClassName}-${type}`]), cx: shiftX(centerX, radius, position), cy: shiftY(centerY, radius, position), r: radius, stroke: "transparent", fill: "transparent" }));
|
|
2243
2260
|
}
|
|
2244
2261
|
|
|
2245
|
-
function EdgeUpdateAnchors({ isReconnectable, reconnectRadius, edge,
|
|
2262
|
+
function EdgeUpdateAnchors({ isReconnectable, reconnectRadius, edge, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, onReconnect, onReconnectStart, onReconnectEnd, setReconnecting, setUpdateHover, }) {
|
|
2246
2263
|
const store = useStoreApi();
|
|
2247
|
-
const handleEdgeUpdater = (event,
|
|
2264
|
+
const handleEdgeUpdater = (event, oppositeHandle) => {
|
|
2248
2265
|
// avoid triggering edge updater if mouse btn is not left
|
|
2249
2266
|
if (event.button !== 0) {
|
|
2250
2267
|
return;
|
|
2251
2268
|
}
|
|
2252
2269
|
const { autoPanOnConnect, domNode, isValidConnection, connectionMode, connectionRadius, lib, onConnectStart, onConnectEnd, cancelConnection, nodeLookup, rfId: flowId, panBy, updateConnection, } = store.getState();
|
|
2253
|
-
const
|
|
2254
|
-
const handleId = (isSourceHandle ? targetHandleId : sourceHandleId) || null;
|
|
2255
|
-
const handleType = isSourceHandle ? 'target' : 'source';
|
|
2256
|
-
const isTarget = isSourceHandle;
|
|
2270
|
+
const isTarget = oppositeHandle.type === 'target';
|
|
2257
2271
|
setReconnecting(true);
|
|
2258
|
-
onReconnectStart?.(event, edge,
|
|
2272
|
+
onReconnectStart?.(event, edge, oppositeHandle.type);
|
|
2259
2273
|
const _onReconnectEnd = (evt, connectionState) => {
|
|
2260
2274
|
setReconnecting(false);
|
|
2261
|
-
onReconnectEnd?.(evt, edge,
|
|
2275
|
+
onReconnectEnd?.(evt, edge, oppositeHandle.type, connectionState);
|
|
2262
2276
|
};
|
|
2263
2277
|
const onConnectEdge = (connection) => onReconnect?.(edge, connection);
|
|
2264
2278
|
XYHandle.onPointerDown(event.nativeEvent, {
|
|
@@ -2266,11 +2280,11 @@ function EdgeUpdateAnchors({ isReconnectable, reconnectRadius, edge, targetHandl
|
|
|
2266
2280
|
connectionMode,
|
|
2267
2281
|
connectionRadius,
|
|
2268
2282
|
domNode,
|
|
2269
|
-
handleId,
|
|
2270
|
-
nodeId,
|
|
2283
|
+
handleId: oppositeHandle.id,
|
|
2284
|
+
nodeId: oppositeHandle.nodeId,
|
|
2271
2285
|
nodeLookup,
|
|
2272
2286
|
isTarget,
|
|
2273
|
-
edgeUpdaterType:
|
|
2287
|
+
edgeUpdaterType: oppositeHandle.type,
|
|
2274
2288
|
lib,
|
|
2275
2289
|
flowId,
|
|
2276
2290
|
cancelConnection,
|
|
@@ -2285,11 +2299,11 @@ function EdgeUpdateAnchors({ isReconnectable, reconnectRadius, edge, targetHandl
|
|
|
2285
2299
|
getFromHandle: () => store.getState().connection.fromHandle,
|
|
2286
2300
|
});
|
|
2287
2301
|
};
|
|
2288
|
-
const onReconnectSourceMouseDown = (event) => handleEdgeUpdater(event,
|
|
2289
|
-
const onReconnectTargetMouseDown = (event) => handleEdgeUpdater(event,
|
|
2302
|
+
const onReconnectSourceMouseDown = (event) => handleEdgeUpdater(event, { nodeId: edge.target, id: edge.targetHandle ?? null, type: 'target' });
|
|
2303
|
+
const onReconnectTargetMouseDown = (event) => handleEdgeUpdater(event, { nodeId: edge.source, id: edge.sourceHandle ?? null, type: 'source' });
|
|
2290
2304
|
const onReconnectMouseEnter = () => setUpdateHover(true);
|
|
2291
2305
|
const onReconnectMouseOut = () => setUpdateHover(false);
|
|
2292
|
-
return (jsxs(Fragment, { children: [(isReconnectable ===
|
|
2306
|
+
return (jsxs(Fragment, { children: [(isReconnectable === true || isReconnectable === 'source') && (jsx(EdgeAnchor, { position: sourcePosition, centerX: sourceX, centerY: sourceY, radius: reconnectRadius, onMouseDown: onReconnectSourceMouseDown, onMouseEnter: onReconnectMouseEnter, onMouseOut: onReconnectMouseOut, type: "source" })), (isReconnectable === true || isReconnectable === 'target') && (jsx(EdgeAnchor, { position: targetPosition, centerX: targetX, centerY: targetY, radius: reconnectRadius, onMouseDown: onReconnectTargetMouseDown, onMouseEnter: onReconnectMouseEnter, onMouseOut: onReconnectMouseOut, type: "target" }))] }));
|
|
2293
2307
|
}
|
|
2294
2308
|
|
|
2295
2309
|
function EdgeWrapper({ id, edgesFocusable, edgesReconnectable, elementsSelectable, onClick, onDoubleClick, onContextMenu, onMouseEnter, onMouseMove, onMouseLeave, reconnectRadius, onReconnect, onReconnectStart, onReconnectEnd, rfId, edgeTypes, noPanClassName, onError, disableKeyboardA11y, }) {
|
|
@@ -2412,7 +2426,7 @@ function EdgeWrapper({ id, edgesFocusable, edgesReconnectable, elementsSelectabl
|
|
|
2412
2426
|
updating: updateHover,
|
|
2413
2427
|
selectable: isSelectable,
|
|
2414
2428
|
},
|
|
2415
|
-
]), 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: [!reconnecting && (jsx(EdgeComponent, { id: id, source: edge.source, target: edge.target, type: edge.type, selected: edge.selected, animated: edge.animated, selectable: isSelectable, deletable: edge.deletable ?? true, 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 })), isReconnectable && (jsx(EdgeUpdateAnchors, { edge: edge, isReconnectable: isReconnectable, reconnectRadius: reconnectRadius, onReconnect: onReconnect, onReconnectStart: onReconnectStart, onReconnectEnd: onReconnectEnd, sourceX: sourceX, sourceY: sourceY, targetX: targetX, targetY: targetY, sourcePosition: sourcePosition, targetPosition: targetPosition, setUpdateHover: setUpdateHover, setReconnecting: setReconnecting
|
|
2429
|
+
]), 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: [!reconnecting && (jsx(EdgeComponent, { id: id, source: edge.source, target: edge.target, type: edge.type, selected: edge.selected, animated: edge.animated, selectable: isSelectable, deletable: edge.deletable ?? true, 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 })), isReconnectable && (jsx(EdgeUpdateAnchors, { edge: edge, isReconnectable: isReconnectable, reconnectRadius: reconnectRadius, onReconnect: onReconnect, onReconnectStart: onReconnectStart, onReconnectEnd: onReconnectEnd, sourceX: sourceX, sourceY: sourceY, targetX: targetX, targetY: targetY, sourcePosition: sourcePosition, targetPosition: targetPosition, setUpdateHover: setUpdateHover, setReconnecting: setReconnecting }))] }) }));
|
|
2416
2430
|
}
|
|
2417
2431
|
|
|
2418
2432
|
const selector$a = (s) => ({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Rect, Viewport } from '@xyflow/system';
|
|
1
|
+
import type { HandleConnection, HandleType, Rect, Viewport } from '@xyflow/system';
|
|
2
2
|
import type { Node, Edge, ViewportHelperFunctions, InternalNode } from '.';
|
|
3
3
|
export type ReactFlowJsonObject<NodeType extends Node = Node, EdgeType extends Edge = Edge> = {
|
|
4
4
|
nodes: NodeType[];
|
|
@@ -165,6 +165,19 @@ export type GeneralHelpers<NodeType extends Node = Node, EdgeType extends Edge =
|
|
|
165
165
|
updateEdgeData: (id: string, dataUpdate: Partial<EdgeType['data']> | ((edge: EdgeType) => Partial<EdgeType['data']>), options?: {
|
|
166
166
|
replace: boolean;
|
|
167
167
|
}) => void;
|
|
168
|
+
/**
|
|
169
|
+
* Gets all connections for a given handle belonging to a specific node.
|
|
170
|
+
*
|
|
171
|
+
* @param type - handle type 'source' or 'target'
|
|
172
|
+
* @param id - the handle id (this is only needed if you have multiple handles of the same type, meaning you have to provide a unique id for each handle)
|
|
173
|
+
* @param nodeId - the node id the handle belongs to
|
|
174
|
+
* @returns an array with handle connections
|
|
175
|
+
*/
|
|
176
|
+
getHandleConnections: ({ type, id, nodeId, }: {
|
|
177
|
+
type: HandleType;
|
|
178
|
+
nodeId: string;
|
|
179
|
+
id?: string | null;
|
|
180
|
+
}) => HandleConnection[];
|
|
168
181
|
};
|
|
169
182
|
export type ReactFlowInstance<NodeType extends Node = Node, EdgeType extends Edge = Edge> = GeneralHelpers<NodeType, EdgeType> & Omit<ViewportHelperFunctions, 'initialized'> & {
|
|
170
183
|
viewportInitialized: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../src/types/instance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../src/types/instance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,GAAG,CAAC;AAE3E,MAAM,MAAM,mBAAmB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI;IAC5F,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,CAAC,EAAE,CAAC,IAAI,GAAG;QAAE,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;KAAE,CAAC,EAAE,CAAC;IACtC,KAAK,CAAC,EAAE,CAAC,IAAI,GAAG;QAAE,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;KAAE,CAAC,EAAE,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI;IACvF;;;;OAIG;IACH,QAAQ,EAAE,MAAM,QAAQ,EAAE,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,EAAE,CAAC,OAA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OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EACvF,OAAO,CAAC,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,KAC3B,IAAI,CAAC;IACV;;;;;;;OAOG;IACH,oBAAoB,EAAE,CAAC,EACrB,IAAI,EACJ,EAAE,EACF,MAAM,GACP,EAAE;QACD,IAAI,EAAE,UAAU,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACpB,KAAK,gBAAgB,EAAE,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,cAAc,CACxG,QAAQ,EACR,QAAQ,CACT,GACC,IAAI,CAAC,uBAAuB,EAAE,aAAa,CAAC,GAAG;IAC7C,mBAAmB,EAAE,OAAO,CAAC;CAC9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changes.d.ts","sourceRoot":"","sources":["../../src/utils/changes.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"changes.d.ts","sourceRoot":"","sources":["../../src/utils/changes.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAyHzD;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 @@ type EdgeUpdateAnchorsProps<EdgeType extends Edge = Edge> = {
|
|
|
4
4
|
edge: EdgeType;
|
|
5
5
|
isReconnectable: boolean | 'source' | 'target';
|
|
6
6
|
reconnectRadius: EdgeWrapperProps['reconnectRadius'];
|
|
7
|
-
sourceHandleId: Edge['sourceHandle'];
|
|
8
|
-
targetHandleId: Edge['targetHandle'];
|
|
9
7
|
onReconnect: EdgeWrapperProps<EdgeType>['onReconnect'];
|
|
10
8
|
onReconnectStart: EdgeWrapperProps<EdgeType>['onReconnectStart'];
|
|
11
9
|
onReconnectEnd: EdgeWrapperProps<EdgeType>['onReconnectEnd'];
|
|
12
10
|
setUpdateHover: (hover: boolean) => void;
|
|
13
11
|
setReconnecting: (updating: boolean) => void;
|
|
14
12
|
} & EdgePosition;
|
|
15
|
-
export declare function EdgeUpdateAnchors<EdgeType extends Edge = Edge>({ isReconnectable, reconnectRadius, edge,
|
|
13
|
+
export declare function EdgeUpdateAnchors<EdgeType extends Edge = Edge>({ isReconnectable, reconnectRadius, edge, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, onReconnect, onReconnectStart, onReconnectEnd, setReconnecting, setUpdateHover, }: EdgeUpdateAnchorsProps<EdgeType>): import("react/jsx-runtime").JSX.Element;
|
|
16
14
|
export {};
|
|
17
15
|
//# sourceMappingURL=EdgeUpdateAnchors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EdgeUpdateAnchors.d.ts","sourceRoot":"","sources":["../../../src/components/EdgeWrapper/EdgeUpdateAnchors.tsx"],"names":[],"mappings":"AACA,OAAO,EAA6B,YAAY,
|
|
1
|
+
{"version":3,"file":"EdgeUpdateAnchors.d.ts","sourceRoot":"","sources":["../../../src/components/EdgeWrapper/EdgeUpdateAnchors.tsx"],"names":[],"mappings":"AACA,OAAO,EAA6B,YAAY,EAAoC,MAAM,gBAAgB,CAAC;AAG3G,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,mB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e,EACf,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,IAAI,EACJ,SAAS,EACT,cAAc,EACd,OAAO,EACP,mBAAmB,GACpB,EAAE,gBAAgB,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/EdgeWrapper/index.tsx"],"names":[],"mappings":";AAeA,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE1D,wBAAgB,WAAW,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,EACxD,EAAE,EACF,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,OAAO,EACP,aAAa,EACb,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,IAAI,EACJ,SAAS,EACT,cAAc,EACd,OAAO,EACP,mBAAmB,GACpB,EAAE,gBAAgB,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAiOjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReactFlow.d.ts","sourceRoot":"","sources":["../../src/hooks/useReactFlow.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,IAAI,EAAgD,MAAM,UAAU,CAAC;AAI5G;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,KAAK,iBAAiB,CAC3G,QAAQ,EACR,QAAQ,CACT,
|
|
1
|
+
{"version":3,"file":"useReactFlow.d.ts","sourceRoot":"","sources":["../../src/hooks/useReactFlow.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,IAAI,EAAgD,MAAM,UAAU,CAAC;AAI5G;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,KAAK,iBAAiB,CAC3G,QAAQ,EACR,QAAQ,CACT,CA4NA"}
|