@particle-academy/fancy-flow 0.3.1 → 0.4.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/{chunk-GJSFZR6J.js → chunk-2BZ6OE5H.js} +168 -109
- package/dist/chunk-2BZ6OE5H.js.map +1 -0
- package/dist/{chunk-4YBSEMF2.js → chunk-35OXF6W3.js} +3 -3
- package/dist/{chunk-4YBSEMF2.js.map → chunk-35OXF6W3.js.map} +1 -1
- package/dist/chunk-4PZQRN5Y.js +114 -0
- package/dist/chunk-4PZQRN5Y.js.map +1 -0
- package/dist/chunk-DW66NGU5.js +138 -0
- package/dist/chunk-DW66NGU5.js.map +1 -0
- package/dist/{chunk-OZPQAUZD.js → engine.cjs} +4 -111
- package/dist/engine.cjs.map +1 -0
- package/dist/engine.d.cts +35 -0
- package/dist/engine.d.ts +35 -0
- package/dist/engine.js +3 -0
- package/dist/engine.js.map +1 -0
- package/dist/index.cjs +167 -108
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +19 -19
- package/dist/index.d.ts +19 -19
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/registry/index.d.cts +2 -3
- package/dist/registry/index.d.ts +2 -3
- package/dist/registry.cjs +165 -106
- package/dist/registry.cjs.map +1 -1
- package/dist/registry.js +2 -2
- package/dist/runtime/index.d.cts +4 -32
- package/dist/runtime/index.d.ts +4 -32
- package/dist/runtime.cjs +166 -107
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.js +3 -2
- package/dist/schema/index.d.cts +1 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/{types-Ch4sAvum.d.cts → types-TemTtb04.d.cts} +1 -1
- package/dist/{types-Ch4sAvum.d.ts → types-TemTtb04.d.ts} +1 -1
- package/package.json +46 -9
- package/dist/chunk-GJSFZR6J.js.map +0 -1
- package/dist/chunk-OZPQAUZD.js.map +0 -1
package/dist/registry.cjs
CHANGED
|
@@ -3055,10 +3055,10 @@ function zoom_default2() {
|
|
|
3055
3055
|
|
|
3056
3056
|
// node_modules/@xyflow/system/dist/esm/index.js
|
|
3057
3057
|
var errorMessages = {
|
|
3058
|
-
error001: (
|
|
3058
|
+
error001: (lib = "react") => `Seems like you have not used zustand provider as an ancestor. Help: https://${lib}flow.dev/error#001`,
|
|
3059
3059
|
error002: () => "It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",
|
|
3060
3060
|
error003: (nodeType) => `Node type "${nodeType}" not found. Using fallback type "default".`,
|
|
3061
|
-
error004: () => "The
|
|
3061
|
+
error004: () => "The parent container needs a width and a height to render the graph.",
|
|
3062
3062
|
error005: () => "Only child nodes can use a parent extent.",
|
|
3063
3063
|
error006: () => "Can't create edge. An edge needs a source and a target.",
|
|
3064
3064
|
error007: (id2) => `The old edge with id=${id2} does not exist.`,
|
|
@@ -3069,7 +3069,8 @@ var errorMessages = {
|
|
|
3069
3069
|
error012: (id2) => `Node with id "${id2}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,
|
|
3070
3070
|
error013: (lib = "react") => `It seems that you haven't loaded the styles. Please import '@xyflow/${lib}/dist/style.css' or base.css to make sure everything is working properly.`,
|
|
3071
3071
|
error014: () => "useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",
|
|
3072
|
-
error015: () => "It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."
|
|
3072
|
+
error015: () => "It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",
|
|
3073
|
+
error016: (id2) => `Edge with id "${id2}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`
|
|
3073
3074
|
};
|
|
3074
3075
|
var infiniteExtent = [
|
|
3075
3076
|
[Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY],
|
|
@@ -3237,7 +3238,7 @@ function getFitViewNodes(nodeLookup, options) {
|
|
|
3237
3238
|
}
|
|
3238
3239
|
async function fitViewport({ nodes, width, height, panZoom, minZoom, maxZoom }, options) {
|
|
3239
3240
|
if (nodes.size === 0) {
|
|
3240
|
-
return
|
|
3241
|
+
return true;
|
|
3241
3242
|
}
|
|
3242
3243
|
const nodesToFit = getFitViewNodes(nodes, options);
|
|
3243
3244
|
const bounds = getInternalNodesBounds(nodesToFit);
|
|
@@ -3247,7 +3248,7 @@ async function fitViewport({ nodes, width, height, panZoom, minZoom, maxZoom },
|
|
|
3247
3248
|
ease: options?.ease,
|
|
3248
3249
|
interpolate: options?.interpolate
|
|
3249
3250
|
});
|
|
3250
|
-
return
|
|
3251
|
+
return true;
|
|
3251
3252
|
}
|
|
3252
3253
|
function calculateNodePosition({ nodeId, nextPosition, nodeLookup, nodeOrigin = [0, 0], nodeExtent, onError }) {
|
|
3253
3254
|
const node = nodeLookup.get(nodeId);
|
|
@@ -3394,9 +3395,9 @@ var getOverlappingArea = (rectA, rectB) => {
|
|
|
3394
3395
|
};
|
|
3395
3396
|
var isRectObject = (obj) => isNumeric(obj.width) && isNumeric(obj.height) && isNumeric(obj.x) && isNumeric(obj.y);
|
|
3396
3397
|
var isNumeric = (n) => !isNaN(n) && isFinite(n);
|
|
3397
|
-
var
|
|
3398
|
+
var createDevWarn = (lib, helpUrl) => (id2, message) => {
|
|
3398
3399
|
if (process.env.NODE_ENV === "development") {
|
|
3399
|
-
console.warn(`[
|
|
3400
|
+
console.warn(`[${lib}]: ${message} Help: ${helpUrl}error#${id2}`);
|
|
3400
3401
|
}
|
|
3401
3402
|
};
|
|
3402
3403
|
var snapPosition = (position, snapGrid = [1, 1]) => {
|
|
@@ -3434,7 +3435,7 @@ function parsePadding(padding, viewport) {
|
|
|
3434
3435
|
return Math.floor(viewport * paddingValue * 0.01);
|
|
3435
3436
|
}
|
|
3436
3437
|
}
|
|
3437
|
-
console.error(`
|
|
3438
|
+
console.error(`The padding value "${padding}" is invalid. Please provide a number or a string with a valid unit (px or %).`);
|
|
3438
3439
|
return 0;
|
|
3439
3440
|
}
|
|
3440
3441
|
function parsePaddings(padding, width, height) {
|
|
@@ -3688,7 +3689,7 @@ var connectionExists = (edge, edges) => {
|
|
|
3688
3689
|
};
|
|
3689
3690
|
var addEdge = (edgeParams, edges, options = {}) => {
|
|
3690
3691
|
if (!edgeParams.source || !edgeParams.target) {
|
|
3691
|
-
|
|
3692
|
+
options.onError?.("006", errorMessages["error006"]());
|
|
3692
3693
|
return edges;
|
|
3693
3694
|
}
|
|
3694
3695
|
const edgeIdGenerator = options.getEdgeId || getEdgeId;
|
|
@@ -4284,7 +4285,7 @@ function updateNodeInternals(updates, nodeLookup, parentLookup, domNode, nodeOri
|
|
|
4284
4285
|
}
|
|
4285
4286
|
async function panBy({ delta, panZoom, transform: transform2, translateExtent, width, height }) {
|
|
4286
4287
|
if (!panZoom || !delta.x && !delta.y) {
|
|
4287
|
-
return
|
|
4288
|
+
return false;
|
|
4288
4289
|
}
|
|
4289
4290
|
const nextViewport = await panZoom.setViewportConstrained({
|
|
4290
4291
|
x: transform2[0] + delta.x,
|
|
@@ -4295,7 +4296,7 @@ async function panBy({ delta, panZoom, transform: transform2, translateExtent, w
|
|
|
4295
4296
|
[width, height]
|
|
4296
4297
|
], translateExtent);
|
|
4297
4298
|
const transformChanged = !!nextViewport && (nextViewport.x !== transform2[0] || nextViewport.y !== transform2[1] || nextViewport.k !== transform2[2]);
|
|
4298
|
-
return
|
|
4299
|
+
return transformChanged;
|
|
4299
4300
|
}
|
|
4300
4301
|
function addConnectionToLookup(type, connection, connectionKey, connectionLookup, nodeId, handleId) {
|
|
4301
4302
|
let key = nodeId;
|
|
@@ -4585,6 +4586,9 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
|
|
|
4585
4586
|
}
|
|
4586
4587
|
}).on("end", (event) => {
|
|
4587
4588
|
if (!dragStarted || abortDrag) {
|
|
4589
|
+
if (abortDrag && dragItems.size > 0) {
|
|
4590
|
+
getStoreItems().updateNodePositions(dragItems, false);
|
|
4591
|
+
}
|
|
4588
4592
|
return;
|
|
4589
4593
|
}
|
|
4590
4594
|
autoPanStarted = false;
|
|
@@ -5126,7 +5130,7 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
|
|
|
5126
5130
|
const zoomPanValues = {
|
|
5127
5131
|
isZoomingOrPanning: false,
|
|
5128
5132
|
usedRightMouseButton: false,
|
|
5129
|
-
prevViewport: {
|
|
5133
|
+
prevViewport: {},
|
|
5130
5134
|
mouseButton: 0,
|
|
5131
5135
|
timerId: void 0,
|
|
5132
5136
|
panScrollTimeout: void 0,
|
|
@@ -5146,13 +5150,13 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
|
|
|
5146
5150
|
const d3ZoomHandler = d3Selection.on("wheel.zoom");
|
|
5147
5151
|
const d3DblClickZoomHandler = d3Selection.on("dblclick.zoom");
|
|
5148
5152
|
d3ZoomInstance.wheelDelta(wheelDelta);
|
|
5149
|
-
function setTransform(transform2, options) {
|
|
5153
|
+
async function setTransform(transform2, options) {
|
|
5150
5154
|
if (d3Selection) {
|
|
5151
5155
|
return new Promise((resolve) => {
|
|
5152
5156
|
d3ZoomInstance?.interpolate(options?.interpolate === "linear" ? value_default : zoom_default).transform(getD3Transition(d3Selection, options?.duration, options?.ease, () => resolve(true)), transform2);
|
|
5153
5157
|
});
|
|
5154
5158
|
}
|
|
5155
|
-
return
|
|
5159
|
+
return false;
|
|
5156
5160
|
}
|
|
5157
5161
|
function update({ noWheelClassName, noPanClassName, onPaneContextMenu, userSelectionActive, panOnScroll, panOnDrag, panOnScrollMode, panOnScrollSpeed, preventScrolling, zoomOnPinch, zoomOnScroll, zoomOnDoubleClick, zoomActivationKeyPressed, lib, onTransformChange, connectionInProgress, paneClickDistance, selectionOnDrag }) {
|
|
5158
5162
|
if (userSelectionActive && !zoomPanValues.isZoomingOrPanning) {
|
|
@@ -5177,31 +5181,29 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
|
|
|
5177
5181
|
d3ZoomHandler
|
|
5178
5182
|
});
|
|
5179
5183
|
d3Selection.on("wheel.zoom", wheelHandler, { passive: false });
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
d3ZoomInstance.on("end", panZoomEndHandler);
|
|
5204
|
-
}
|
|
5184
|
+
const startHandler = createPanZoomStartHandler({
|
|
5185
|
+
zoomPanValues,
|
|
5186
|
+
onDraggingChange,
|
|
5187
|
+
onPanZoomStart
|
|
5188
|
+
});
|
|
5189
|
+
d3ZoomInstance.on("start", startHandler);
|
|
5190
|
+
const panZoomHandler = createPanZoomHandler({
|
|
5191
|
+
zoomPanValues,
|
|
5192
|
+
panOnDrag,
|
|
5193
|
+
onPaneContextMenu: !!onPaneContextMenu,
|
|
5194
|
+
onPanZoom,
|
|
5195
|
+
onTransformChange
|
|
5196
|
+
});
|
|
5197
|
+
d3ZoomInstance.on("zoom", panZoomHandler);
|
|
5198
|
+
const panZoomEndHandler = createPanZoomEndHandler({
|
|
5199
|
+
zoomPanValues,
|
|
5200
|
+
panOnDrag,
|
|
5201
|
+
panOnScroll,
|
|
5202
|
+
onPaneContextMenu,
|
|
5203
|
+
onPanZoomEnd,
|
|
5204
|
+
onDraggingChange
|
|
5205
|
+
});
|
|
5206
|
+
d3ZoomInstance.on("end", panZoomEndHandler);
|
|
5205
5207
|
const filter2 = createFilter({
|
|
5206
5208
|
zoomActivationKeyPressed,
|
|
5207
5209
|
panOnDrag,
|
|
@@ -5231,12 +5233,12 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
|
|
|
5231
5233
|
if (contrainedTransform) {
|
|
5232
5234
|
await setTransform(contrainedTransform);
|
|
5233
5235
|
}
|
|
5234
|
-
return
|
|
5236
|
+
return contrainedTransform;
|
|
5235
5237
|
}
|
|
5236
5238
|
async function setViewport(viewport2, options) {
|
|
5237
5239
|
const nextTransform = viewportToTransform(viewport2);
|
|
5238
5240
|
await setTransform(nextTransform, options);
|
|
5239
|
-
return
|
|
5241
|
+
return nextTransform;
|
|
5240
5242
|
}
|
|
5241
5243
|
function syncViewport(viewport2) {
|
|
5242
5244
|
if (d3Selection) {
|
|
@@ -5251,21 +5253,21 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
|
|
|
5251
5253
|
const transform2 = d3Selection ? transform(d3Selection.node()) : { x: 0, y: 0, k: 1 };
|
|
5252
5254
|
return { x: transform2.x, y: transform2.y, zoom: transform2.k };
|
|
5253
5255
|
}
|
|
5254
|
-
function scaleTo(zoom, options) {
|
|
5256
|
+
async function scaleTo(zoom, options) {
|
|
5255
5257
|
if (d3Selection) {
|
|
5256
5258
|
return new Promise((resolve) => {
|
|
5257
5259
|
d3ZoomInstance?.interpolate(options?.interpolate === "linear" ? value_default : zoom_default).scaleTo(getD3Transition(d3Selection, options?.duration, options?.ease, () => resolve(true)), zoom);
|
|
5258
5260
|
});
|
|
5259
5261
|
}
|
|
5260
|
-
return
|
|
5262
|
+
return false;
|
|
5261
5263
|
}
|
|
5262
|
-
function scaleBy(factor, options) {
|
|
5264
|
+
async function scaleBy(factor, options) {
|
|
5263
5265
|
if (d3Selection) {
|
|
5264
5266
|
return new Promise((resolve) => {
|
|
5265
5267
|
d3ZoomInstance?.interpolate(options?.interpolate === "linear" ? value_default : zoom_default).scaleBy(getD3Transition(d3Selection, options?.duration, options?.ease, () => resolve(true)), factor);
|
|
5266
5268
|
});
|
|
5267
5269
|
}
|
|
5268
|
-
return
|
|
5270
|
+
return false;
|
|
5269
5271
|
}
|
|
5270
5272
|
function setScaleExtent(scaleExtent) {
|
|
5271
5273
|
d3ZoomInstance?.scaleExtent(scaleExtent);
|
|
@@ -5460,12 +5462,6 @@ var initStartValues = {
|
|
|
5460
5462
|
pointerY: 0,
|
|
5461
5463
|
aspectRatio: 1
|
|
5462
5464
|
};
|
|
5463
|
-
function nodeToParentExtent(node) {
|
|
5464
|
-
return [
|
|
5465
|
-
[0, 0],
|
|
5466
|
-
[node.measured.width, node.measured.height]
|
|
5467
|
-
];
|
|
5468
|
-
}
|
|
5469
5465
|
function nodeToChildExtent(child, parent, nodeOrigin) {
|
|
5470
5466
|
const x = parent.position.x + child.position.x;
|
|
5471
5467
|
const y = parent.position.y + child.position.y;
|
|
@@ -5504,7 +5500,7 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
|
|
|
5504
5500
|
let containerBounds = null;
|
|
5505
5501
|
let childNodes = [];
|
|
5506
5502
|
let parentNode = void 0;
|
|
5507
|
-
let
|
|
5503
|
+
let nodeExtent = void 0;
|
|
5508
5504
|
let childExtent = void 0;
|
|
5509
5505
|
let resizeDetected = false;
|
|
5510
5506
|
const dragHandler = drag_default().on("start", (event) => {
|
|
@@ -5533,9 +5529,15 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
|
|
|
5533
5529
|
aspectRatio: prevValues.width / prevValues.height
|
|
5534
5530
|
};
|
|
5535
5531
|
parentNode = void 0;
|
|
5532
|
+
nodeExtent = isCoordinateExtent(node.extent) ? node.extent : void 0;
|
|
5536
5533
|
if (node.parentId && (node.extent === "parent" || node.expandParent)) {
|
|
5537
5534
|
parentNode = nodeLookup.get(node.parentId);
|
|
5538
|
-
|
|
5535
|
+
}
|
|
5536
|
+
if (parentNode && node.extent === "parent") {
|
|
5537
|
+
nodeExtent = [
|
|
5538
|
+
[0, 0],
|
|
5539
|
+
[parentNode.measured.width, parentNode.measured.height]
|
|
5540
|
+
];
|
|
5539
5541
|
}
|
|
5540
5542
|
childNodes = [];
|
|
5541
5543
|
childExtent = void 0;
|
|
@@ -5575,7 +5577,7 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
|
|
|
5575
5577
|
const { x: prevX, y: prevY, width: prevWidth, height: prevHeight } = prevValues;
|
|
5576
5578
|
const change = {};
|
|
5577
5579
|
const nodeOrigin = node.origin ?? storeNodeOrigin;
|
|
5578
|
-
const { width, height, x, y } = getDimensionsAfterResize(startValues, params.controlDirection, pointerPosition, params.boundaries, params.keepAspectRatio, nodeOrigin,
|
|
5580
|
+
const { width, height, x, y } = getDimensionsAfterResize(startValues, params.controlDirection, pointerPosition, params.boundaries, params.keepAspectRatio, nodeOrigin, nodeExtent, childExtent);
|
|
5579
5581
|
const isWidthChange = width !== prevWidth;
|
|
5580
5582
|
const isHeightChange = height !== prevHeight;
|
|
5581
5583
|
const isXPosChange = x !== prevX && isWidthChange;
|
|
@@ -5803,7 +5805,7 @@ function shallow$1(objA, objB) {
|
|
|
5803
5805
|
}
|
|
5804
5806
|
var StoreContext = ReactExports.createContext(null);
|
|
5805
5807
|
var Provider$1 = StoreContext.Provider;
|
|
5806
|
-
var zustandErrorMessage = errorMessages["error001"]();
|
|
5808
|
+
var zustandErrorMessage = errorMessages["error001"]("react");
|
|
5807
5809
|
function useStore(selector, equalityFn) {
|
|
5808
5810
|
const store = ReactExports.useContext(StoreContext);
|
|
5809
5811
|
if (store === null) {
|
|
@@ -5895,7 +5897,6 @@ function SelectionListener({ onSelectionChange }) {
|
|
|
5895
5897
|
}
|
|
5896
5898
|
return null;
|
|
5897
5899
|
}
|
|
5898
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? ReactExports.useLayoutEffect : ReactExports.useEffect;
|
|
5899
5900
|
var defaultNodeOrigin = [0, 0];
|
|
5900
5901
|
var defaultViewport = { x: 0, y: 0, zoom: 1 };
|
|
5901
5902
|
var reactFlowFieldsToTrack = [
|
|
@@ -5986,7 +5987,7 @@ var initPrevValues2 = {
|
|
|
5986
5987
|
function StoreUpdater(props) {
|
|
5987
5988
|
const { setNodes, setEdges, setMinZoom, setMaxZoom, setTranslateExtent, setNodeExtent, reset, setDefaultNodesAndEdges } = useStore(selector$l, shallow$1);
|
|
5988
5989
|
const store = useStoreApi();
|
|
5989
|
-
|
|
5990
|
+
ReactExports.useEffect(() => {
|
|
5990
5991
|
setDefaultNodesAndEdges(props.defaultNodes, props.defaultEdges);
|
|
5991
5992
|
return () => {
|
|
5992
5993
|
previousFields.current = initPrevValues2;
|
|
@@ -5994,7 +5995,7 @@ function StoreUpdater(props) {
|
|
|
5994
5995
|
};
|
|
5995
5996
|
}, []);
|
|
5996
5997
|
const previousFields = ReactExports.useRef(initPrevValues2);
|
|
5997
|
-
|
|
5998
|
+
ReactExports.useEffect(
|
|
5998
5999
|
() => {
|
|
5999
6000
|
for (const fieldName of fieldsToTrack) {
|
|
6000
6001
|
const fieldValue = props[fieldName];
|
|
@@ -6130,30 +6131,30 @@ var useViewportHelper = () => {
|
|
|
6130
6131
|
const store = useStoreApi();
|
|
6131
6132
|
return ReactExports.useMemo(() => {
|
|
6132
6133
|
return {
|
|
6133
|
-
zoomIn: (options) => {
|
|
6134
|
+
zoomIn: async (options) => {
|
|
6134
6135
|
const { panZoom } = store.getState();
|
|
6135
|
-
return panZoom ? panZoom.scaleBy(1.2, options) :
|
|
6136
|
+
return panZoom ? panZoom.scaleBy(1.2, options) : false;
|
|
6136
6137
|
},
|
|
6137
|
-
zoomOut: (options) => {
|
|
6138
|
+
zoomOut: async (options) => {
|
|
6138
6139
|
const { panZoom } = store.getState();
|
|
6139
|
-
return panZoom ? panZoom.scaleBy(1 / 1.2, options) :
|
|
6140
|
+
return panZoom ? panZoom.scaleBy(1 / 1.2, options) : false;
|
|
6140
6141
|
},
|
|
6141
|
-
zoomTo: (zoomLevel, options) => {
|
|
6142
|
+
zoomTo: async (zoomLevel, options) => {
|
|
6142
6143
|
const { panZoom } = store.getState();
|
|
6143
|
-
return panZoom ? panZoom.scaleTo(zoomLevel, options) :
|
|
6144
|
+
return panZoom ? panZoom.scaleTo(zoomLevel, options) : false;
|
|
6144
6145
|
},
|
|
6145
6146
|
getZoom: () => store.getState().transform[2],
|
|
6146
6147
|
setViewport: async (viewport, options) => {
|
|
6147
6148
|
const { transform: [tX, tY, tZoom], panZoom } = store.getState();
|
|
6148
6149
|
if (!panZoom) {
|
|
6149
|
-
return
|
|
6150
|
+
return false;
|
|
6150
6151
|
}
|
|
6151
6152
|
await panZoom.setViewport({
|
|
6152
6153
|
x: viewport.x ?? tX,
|
|
6153
6154
|
y: viewport.y ?? tY,
|
|
6154
6155
|
zoom: viewport.zoom ?? tZoom
|
|
6155
6156
|
}, options);
|
|
6156
|
-
return
|
|
6157
|
+
return true;
|
|
6157
6158
|
},
|
|
6158
6159
|
getViewport: () => {
|
|
6159
6160
|
const [x, y, zoom] = store.getState().transform;
|
|
@@ -6166,14 +6167,14 @@ var useViewportHelper = () => {
|
|
|
6166
6167
|
const { width, height, minZoom, maxZoom, panZoom } = store.getState();
|
|
6167
6168
|
const viewport = getViewportForBounds(bounds, width, height, minZoom, maxZoom, options?.padding ?? 0.1);
|
|
6168
6169
|
if (!panZoom) {
|
|
6169
|
-
return
|
|
6170
|
+
return false;
|
|
6170
6171
|
}
|
|
6171
6172
|
await panZoom.setViewport(viewport, {
|
|
6172
6173
|
duration: options?.duration,
|
|
6173
6174
|
ease: options?.ease,
|
|
6174
6175
|
interpolate: options?.interpolate
|
|
6175
6176
|
});
|
|
6176
|
-
return
|
|
6177
|
+
return true;
|
|
6177
6178
|
},
|
|
6178
6179
|
screenToFlowPosition: (clientPosition, options = {}) => {
|
|
6179
6180
|
const { transform: transform2, snapGrid, snapToGrid, domNode } = store.getState();
|
|
@@ -6342,11 +6343,19 @@ function elementToRemoveChange(item) {
|
|
|
6342
6343
|
type: "remove"
|
|
6343
6344
|
};
|
|
6344
6345
|
}
|
|
6346
|
+
var defaultOnError = createDevWarn("React Flow", "https://reactflow.dev/");
|
|
6347
|
+
function addEdge2(edgeParams, edges, options = {}) {
|
|
6348
|
+
return addEdge(edgeParams, edges, {
|
|
6349
|
+
...options,
|
|
6350
|
+
onError: options.onError ?? defaultOnError
|
|
6351
|
+
});
|
|
6352
|
+
}
|
|
6345
6353
|
var isNode = (element) => isNodeBase(element);
|
|
6346
6354
|
var isEdge = (element) => isEdgeBase(element);
|
|
6347
6355
|
function fixedForwardRef(render) {
|
|
6348
6356
|
return ReactExports.forwardRef(render);
|
|
6349
6357
|
}
|
|
6358
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? ReactExports.useLayoutEffect : ReactExports.useEffect;
|
|
6350
6359
|
function useQueue(runQueue) {
|
|
6351
6360
|
const [serial, setSerial] = ReactExports.useState(BigInt(0));
|
|
6352
6361
|
const [queue] = ReactExports.useState(() => createQueue(() => setSerial((n) => n + BigInt(1))));
|
|
@@ -6777,17 +6786,22 @@ var selector$h = (s) => ({
|
|
|
6777
6786
|
userSelectionActive: s.userSelectionActive,
|
|
6778
6787
|
elementsSelectable: s.elementsSelectable,
|
|
6779
6788
|
connectionInProgress: s.connection.inProgress,
|
|
6780
|
-
dragging: s.paneDragging
|
|
6789
|
+
dragging: s.paneDragging,
|
|
6790
|
+
panBy: s.panBy,
|
|
6791
|
+
autoPanSpeed: s.autoPanSpeed
|
|
6781
6792
|
});
|
|
6782
|
-
function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.Full, panOnDrag, paneClickDistance, selectionOnDrag, onSelectionStart, onSelectionEnd, onPaneClick, onPaneContextMenu, onPaneScroll, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, children: children2 }) {
|
|
6793
|
+
function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.Full, panOnDrag, autoPanOnSelection, paneClickDistance, selectionOnDrag, onSelectionStart, onSelectionEnd, onPaneClick, onPaneContextMenu, onPaneScroll, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, children: children2 }) {
|
|
6794
|
+
const autoPanId = ReactExports.useRef(0);
|
|
6783
6795
|
const store = useStoreApi();
|
|
6784
|
-
const { userSelectionActive, elementsSelectable, dragging, connectionInProgress } = useStore(selector$h, shallow$1);
|
|
6796
|
+
const { userSelectionActive, elementsSelectable, dragging, connectionInProgress, panBy: panBy2, autoPanSpeed } = useStore(selector$h, shallow$1);
|
|
6785
6797
|
const isSelectionEnabled = elementsSelectable && (isSelecting || userSelectionActive);
|
|
6786
6798
|
const container = ReactExports.useRef(null);
|
|
6787
6799
|
const containerBounds = ReactExports.useRef();
|
|
6788
6800
|
const selectedNodeIds = ReactExports.useRef(/* @__PURE__ */ new Set());
|
|
6789
6801
|
const selectedEdgeIds = ReactExports.useRef(/* @__PURE__ */ new Set());
|
|
6790
6802
|
const selectionInProgress = ReactExports.useRef(false);
|
|
6803
|
+
const position = ReactExports.useRef({ x: 0, y: 0 });
|
|
6804
|
+
const autoPanStarted = ReactExports.useRef(false);
|
|
6791
6805
|
const onClick = (event) => {
|
|
6792
6806
|
if (selectionInProgress.current || connectionInProgress) {
|
|
6793
6807
|
selectionInProgress.current = false;
|
|
@@ -6812,7 +6826,7 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
6812
6826
|
}
|
|
6813
6827
|
};
|
|
6814
6828
|
const onPointerDownCapture = (event) => {
|
|
6815
|
-
const { domNode } = store.getState();
|
|
6829
|
+
const { domNode, transform: transform2 } = store.getState();
|
|
6816
6830
|
containerBounds.current = domNode?.getBoundingClientRect();
|
|
6817
6831
|
if (!containerBounds.current)
|
|
6818
6832
|
return;
|
|
@@ -6825,12 +6839,13 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
6825
6839
|
event.target?.setPointerCapture?.(event.pointerId);
|
|
6826
6840
|
selectionInProgress.current = false;
|
|
6827
6841
|
const { x, y } = getEventPosition(event.nativeEvent, containerBounds.current);
|
|
6842
|
+
const userSelectionStartPosition = pointToRendererPoint({ x, y }, transform2);
|
|
6828
6843
|
store.setState({
|
|
6829
6844
|
userSelectionRect: {
|
|
6830
6845
|
width: 0,
|
|
6831
6846
|
height: 0,
|
|
6832
|
-
startX: x,
|
|
6833
|
-
startY: y,
|
|
6847
|
+
startX: userSelectionStartPosition.x,
|
|
6848
|
+
startY: userSelectionStartPosition.y,
|
|
6834
6849
|
x,
|
|
6835
6850
|
y
|
|
6836
6851
|
}
|
|
@@ -6840,30 +6855,21 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
6840
6855
|
event.preventDefault();
|
|
6841
6856
|
}
|
|
6842
6857
|
};
|
|
6843
|
-
|
|
6844
|
-
const { userSelectionRect
|
|
6845
|
-
if (!
|
|
6858
|
+
function commitUserSelectionRect(mouseX, mouseY) {
|
|
6859
|
+
const { userSelectionRect } = store.getState();
|
|
6860
|
+
if (!userSelectionRect) {
|
|
6846
6861
|
return;
|
|
6847
6862
|
}
|
|
6848
|
-
const {
|
|
6849
|
-
const { startX, startY }
|
|
6850
|
-
|
|
6851
|
-
const requiredDistance = selectionKeyPressed ? 0 : paneClickDistance;
|
|
6852
|
-
const distance2 = Math.hypot(mouseX - startX, mouseY - startY);
|
|
6853
|
-
if (distance2 <= requiredDistance) {
|
|
6854
|
-
return;
|
|
6855
|
-
}
|
|
6856
|
-
resetSelectedElements();
|
|
6857
|
-
onSelectionStart?.(event);
|
|
6858
|
-
}
|
|
6859
|
-
selectionInProgress.current = true;
|
|
6863
|
+
const { transform: transform2, nodeLookup, edgeLookup, connectionLookup, triggerNodeChanges, triggerEdgeChanges, defaultEdgeOptions } = store.getState();
|
|
6864
|
+
const userStartPosition = { x: userSelectionRect.startX, y: userSelectionRect.startY };
|
|
6865
|
+
const { x: screenStartX, y: screenStartY } = rendererPointToPoint(userStartPosition, transform2);
|
|
6860
6866
|
const nextUserSelectRect = {
|
|
6861
|
-
startX,
|
|
6862
|
-
startY,
|
|
6863
|
-
x: mouseX <
|
|
6864
|
-
y: mouseY <
|
|
6865
|
-
width: Math.abs(mouseX -
|
|
6866
|
-
height: Math.abs(mouseY -
|
|
6867
|
+
startX: userStartPosition.x,
|
|
6868
|
+
startY: userStartPosition.y,
|
|
6869
|
+
x: mouseX < screenStartX ? mouseX : screenStartX,
|
|
6870
|
+
y: mouseY < screenStartY ? mouseY : screenStartY,
|
|
6871
|
+
width: Math.abs(mouseX - screenStartX),
|
|
6872
|
+
height: Math.abs(mouseY - screenStartY)
|
|
6867
6873
|
};
|
|
6868
6874
|
const prevSelectedNodeIds = selectedNodeIds.current;
|
|
6869
6875
|
const prevSelectedEdgeIds = selectedEdgeIds.current;
|
|
@@ -6894,6 +6900,53 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
6894
6900
|
userSelectionActive: true,
|
|
6895
6901
|
nodesSelectionActive: false
|
|
6896
6902
|
});
|
|
6903
|
+
}
|
|
6904
|
+
function autoPan() {
|
|
6905
|
+
if (!autoPanOnSelection || !containerBounds.current) {
|
|
6906
|
+
return;
|
|
6907
|
+
}
|
|
6908
|
+
const [x, y] = calcAutoPan(position.current, containerBounds.current, autoPanSpeed);
|
|
6909
|
+
panBy2({ x, y }).then((panned) => {
|
|
6910
|
+
if (!selectionInProgress.current || !panned) {
|
|
6911
|
+
autoPanId.current = requestAnimationFrame(autoPan);
|
|
6912
|
+
return;
|
|
6913
|
+
}
|
|
6914
|
+
const { x: mx, y: my } = position.current;
|
|
6915
|
+
commitUserSelectionRect(mx, my);
|
|
6916
|
+
autoPanId.current = requestAnimationFrame(autoPan);
|
|
6917
|
+
});
|
|
6918
|
+
}
|
|
6919
|
+
const cleanupAutoPan = () => {
|
|
6920
|
+
cancelAnimationFrame(autoPanId.current);
|
|
6921
|
+
autoPanId.current = 0;
|
|
6922
|
+
autoPanStarted.current = false;
|
|
6923
|
+
};
|
|
6924
|
+
ReactExports.useEffect(() => {
|
|
6925
|
+
return () => cleanupAutoPan();
|
|
6926
|
+
}, []);
|
|
6927
|
+
const onPointerMove = (event) => {
|
|
6928
|
+
const { userSelectionRect, transform: transform2, resetSelectedElements } = store.getState();
|
|
6929
|
+
if (!containerBounds.current || !userSelectionRect) {
|
|
6930
|
+
return;
|
|
6931
|
+
}
|
|
6932
|
+
const { x: mouseX, y: mouseY } = getEventPosition(event.nativeEvent, containerBounds.current);
|
|
6933
|
+
position.current = { x: mouseX, y: mouseY };
|
|
6934
|
+
const screenStart = rendererPointToPoint({ x: userSelectionRect.startX, y: userSelectionRect.startY }, transform2);
|
|
6935
|
+
if (!selectionInProgress.current) {
|
|
6936
|
+
const requiredDistance = selectionKeyPressed ? 0 : paneClickDistance;
|
|
6937
|
+
const distance2 = Math.hypot(mouseX - screenStart.x, mouseY - screenStart.y);
|
|
6938
|
+
if (distance2 <= requiredDistance) {
|
|
6939
|
+
return;
|
|
6940
|
+
}
|
|
6941
|
+
resetSelectedElements();
|
|
6942
|
+
onSelectionStart?.(event);
|
|
6943
|
+
}
|
|
6944
|
+
selectionInProgress.current = true;
|
|
6945
|
+
if (!autoPanStarted.current) {
|
|
6946
|
+
autoPan();
|
|
6947
|
+
autoPanStarted.current = true;
|
|
6948
|
+
}
|
|
6949
|
+
commitUserSelectionRect(mouseX, mouseY);
|
|
6897
6950
|
};
|
|
6898
6951
|
const onPointerUp = (event) => {
|
|
6899
6952
|
if (event.button !== 0) {
|
|
@@ -6913,9 +6966,14 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
6913
6966
|
nodesSelectionActive: selectedNodeIds.current.size > 0
|
|
6914
6967
|
});
|
|
6915
6968
|
}
|
|
6969
|
+
cleanupAutoPan();
|
|
6970
|
+
};
|
|
6971
|
+
const onPointerCancel = (event) => {
|
|
6972
|
+
event.target?.releasePointerCapture?.(event.pointerId);
|
|
6973
|
+
cleanupAutoPan();
|
|
6916
6974
|
};
|
|
6917
6975
|
const draggable = panOnDrag === true || Array.isArray(panOnDrag) && panOnDrag.includes(0);
|
|
6918
|
-
return jsxRuntime.jsxs("div", { className: cc(["react-flow__pane", { draggable, dragging, selection: isSelecting }]), onClick: isSelectionEnabled ? void 0 : wrapHandler(onClick, container), onContextMenu: wrapHandler(onContextMenu, container), onWheel: wrapHandler(onWheel, container), onPointerEnter: isSelectionEnabled ? void 0 : onPaneMouseEnter, onPointerMove: isSelectionEnabled ? onPointerMove : onPaneMouseMove, onPointerUp: isSelectionEnabled ? onPointerUp : void 0, onPointerDownCapture: isSelectionEnabled ? onPointerDownCapture : void 0, onClickCapture: isSelectionEnabled ? onClickCapture : void 0, onPointerLeave: onPaneMouseLeave, ref: container, style: containerStyle, children: [children2, jsxRuntime.jsx(UserSelection, {})] });
|
|
6976
|
+
return jsxRuntime.jsxs("div", { className: cc(["react-flow__pane", { draggable, dragging, selection: isSelecting }]), onClick: isSelectionEnabled ? void 0 : wrapHandler(onClick, container), onContextMenu: wrapHandler(onContextMenu, container), onWheel: wrapHandler(onWheel, container), onPointerEnter: isSelectionEnabled ? void 0 : onPaneMouseEnter, onPointerMove: isSelectionEnabled ? onPointerMove : onPaneMouseMove, onPointerUp: isSelectionEnabled ? onPointerUp : void 0, onPointerCancel: isSelectionEnabled ? onPointerCancel : void 0, onPointerDownCapture: isSelectionEnabled ? onPointerDownCapture : void 0, onClickCapture: isSelectionEnabled ? onClickCapture : void 0, onPointerLeave: onPaneMouseLeave, ref: container, style: containerStyle, children: [children2, jsxRuntime.jsx(UserSelection, {})] });
|
|
6919
6977
|
}
|
|
6920
6978
|
function handleNodeClick({ id: id2, store, unselect = false, nodeRef }) {
|
|
6921
6979
|
const { addSelectedNodes, unselectNodesAndEdges, multiSelectionActive, nodeLookup, onError } = store.getState();
|
|
@@ -7053,8 +7111,8 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
|
|
|
7053
7111
|
...params
|
|
7054
7112
|
};
|
|
7055
7113
|
if (hasDefaultEdges) {
|
|
7056
|
-
const { edges, setEdges } = store.getState();
|
|
7057
|
-
setEdges(
|
|
7114
|
+
const { edges, setEdges, onError } = store.getState();
|
|
7115
|
+
setEdges(addEdge2(edgeParams, edges, { onError }));
|
|
7058
7116
|
}
|
|
7059
7117
|
onConnectAction?.(edgeParams);
|
|
7060
7118
|
onConnect?.(edgeParams);
|
|
@@ -7250,7 +7308,7 @@ var win = typeof window !== "undefined" ? window : void 0;
|
|
|
7250
7308
|
var selector$e = (s) => {
|
|
7251
7309
|
return { nodesSelectionActive: s.nodesSelectionActive, userSelectionActive: s.userSelectionActive };
|
|
7252
7310
|
};
|
|
7253
|
-
function FlowRendererComponent({ children: children2, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneContextMenu, onPaneScroll, paneClickDistance, deleteKeyCode, selectionKeyCode, selectionOnDrag, selectionMode, onSelectionStart, onSelectionEnd, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, elementsSelectable, zoomOnScroll, zoomOnPinch, panOnScroll: _panOnScroll, panOnScrollSpeed, panOnScrollMode, zoomOnDoubleClick, panOnDrag: _panOnDrag, defaultViewport: defaultViewport2, translateExtent, minZoom, maxZoom, preventScrolling, onSelectionContextMenu, noWheelClassName, noPanClassName, disableKeyboardA11y, onViewportChange, isControlledViewport }) {
|
|
7311
|
+
function FlowRendererComponent({ children: children2, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneContextMenu, onPaneScroll, paneClickDistance, deleteKeyCode, selectionKeyCode, selectionOnDrag, selectionMode, onSelectionStart, onSelectionEnd, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, elementsSelectable, zoomOnScroll, zoomOnPinch, panOnScroll: _panOnScroll, panOnScrollSpeed, panOnScrollMode, zoomOnDoubleClick, panOnDrag: _panOnDrag, autoPanOnSelection, defaultViewport: defaultViewport2, translateExtent, minZoom, maxZoom, preventScrolling, onSelectionContextMenu, noWheelClassName, noPanClassName, disableKeyboardA11y, onViewportChange, isControlledViewport }) {
|
|
7254
7312
|
const { nodesSelectionActive, userSelectionActive } = useStore(selector$e, shallow$1);
|
|
7255
7313
|
const selectionKeyPressed = useKeyPress(selectionKeyCode, { target: win });
|
|
7256
7314
|
const panActivationKeyPressed = useKeyPress(panActivationKeyCode, { target: win });
|
|
@@ -7259,7 +7317,7 @@ function FlowRendererComponent({ children: children2, onPaneClick, onPaneMouseEn
|
|
|
7259
7317
|
const _selectionOnDrag = selectionOnDrag && panOnDrag !== true;
|
|
7260
7318
|
const isSelecting = selectionKeyPressed || userSelectionActive || _selectionOnDrag;
|
|
7261
7319
|
useGlobalKeyHandler({ deleteKeyCode, multiSelectionKeyCode });
|
|
7262
|
-
return jsxRuntime.jsx(ZoomPane, { onPaneContextMenu, elementsSelectable, zoomOnScroll, zoomOnPinch, panOnScroll, panOnScrollSpeed, panOnScrollMode, zoomOnDoubleClick, panOnDrag: !selectionKeyPressed && panOnDrag, defaultViewport: defaultViewport2, translateExtent, minZoom, maxZoom, zoomActivationKeyCode, preventScrolling, noWheelClassName, noPanClassName, onViewportChange, isControlledViewport, paneClickDistance, selectionOnDrag: _selectionOnDrag, children: jsxRuntime.jsxs(Pane, { onSelectionStart, onSelectionEnd, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneContextMenu, onPaneScroll, panOnDrag, isSelecting: !!isSelecting, selectionMode, selectionKeyPressed, paneClickDistance, selectionOnDrag: _selectionOnDrag, children: [children2, nodesSelectionActive && jsxRuntime.jsx(NodesSelection, { onSelectionContextMenu, noPanClassName, disableKeyboardA11y })] }) });
|
|
7320
|
+
return jsxRuntime.jsx(ZoomPane, { onPaneContextMenu, elementsSelectable, zoomOnScroll, zoomOnPinch, panOnScroll, panOnScrollSpeed, panOnScrollMode, zoomOnDoubleClick, panOnDrag: !selectionKeyPressed && panOnDrag, defaultViewport: defaultViewport2, translateExtent, minZoom, maxZoom, zoomActivationKeyCode, preventScrolling, noWheelClassName, noPanClassName, onViewportChange, isControlledViewport, paneClickDistance, selectionOnDrag: _selectionOnDrag, children: jsxRuntime.jsxs(Pane, { onSelectionStart, onSelectionEnd, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneContextMenu, onPaneScroll, panOnDrag, autoPanOnSelection, isSelecting: !!isSelecting, selectionMode, selectionKeyPressed, paneClickDistance, selectionOnDrag: _selectionOnDrag, children: [children2, nodesSelectionActive && jsxRuntime.jsx(NodesSelection, { onSelectionContextMenu, noPanClassName, disableKeyboardA11y })] }) });
|
|
7263
7321
|
}
|
|
7264
7322
|
FlowRendererComponent.displayName = "FlowRenderer";
|
|
7265
7323
|
var FlowRenderer = ReactExports.memo(FlowRendererComponent);
|
|
@@ -8064,16 +8122,17 @@ function useStylesLoadedWarning() {
|
|
|
8064
8122
|
}
|
|
8065
8123
|
}, []);
|
|
8066
8124
|
}
|
|
8067
|
-
function GraphViewComponent({ nodeTypes, edgeTypes, onInit, onNodeClick, onEdgeClick, onNodeDoubleClick, onEdgeDoubleClick, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onSelectionContextMenu, onSelectionStart, onSelectionEnd, connectionLineType, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, selectionKeyCode, selectionOnDrag, selectionMode, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, deleteKeyCode, onlyRenderVisibleElements, elementsSelectable, defaultViewport: defaultViewport2, translateExtent, minZoom, maxZoom, preventScrolling, defaultMarkerColor, zoomOnScroll, zoomOnPinch, panOnScroll, panOnScrollSpeed, panOnScrollMode, zoomOnDoubleClick, panOnDrag, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, paneClickDistance, nodeClickDistance, onEdgeContextMenu, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius, onReconnect, onReconnectStart, onReconnectEnd, noDragClassName, noWheelClassName, noPanClassName, disableKeyboardA11y, nodeExtent, rfId, viewport, onViewportChange }) {
|
|
8125
|
+
function GraphViewComponent({ nodeTypes, edgeTypes, onInit, onNodeClick, onEdgeClick, onNodeDoubleClick, onEdgeDoubleClick, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onSelectionContextMenu, onSelectionStart, onSelectionEnd, connectionLineType, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, selectionKeyCode, selectionOnDrag, selectionMode, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, deleteKeyCode, onlyRenderVisibleElements, elementsSelectable, defaultViewport: defaultViewport2, translateExtent, minZoom, maxZoom, preventScrolling, defaultMarkerColor, zoomOnScroll, zoomOnPinch, panOnScroll, panOnScrollSpeed, panOnScrollMode, zoomOnDoubleClick, panOnDrag, autoPanOnSelection, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, paneClickDistance, nodeClickDistance, onEdgeContextMenu, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius, onReconnect, onReconnectStart, onReconnectEnd, noDragClassName, noWheelClassName, noPanClassName, disableKeyboardA11y, nodeExtent, rfId, viewport, onViewportChange }) {
|
|
8068
8126
|
useNodeOrEdgeTypesWarning(nodeTypes);
|
|
8069
8127
|
useNodeOrEdgeTypesWarning(edgeTypes);
|
|
8070
8128
|
useStylesLoadedWarning();
|
|
8071
8129
|
useOnInitHandler(onInit);
|
|
8072
8130
|
useViewportSync(viewport);
|
|
8073
|
-
return jsxRuntime.jsx(FlowRenderer, { onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneContextMenu, onPaneScroll, paneClickDistance, deleteKeyCode, selectionKeyCode, selectionOnDrag, selectionMode, onSelectionStart, onSelectionEnd, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, elementsSelectable, zoomOnScroll, zoomOnPinch, zoomOnDoubleClick, panOnScroll, panOnScrollSpeed, panOnScrollMode, panOnDrag, defaultViewport: defaultViewport2, translateExtent, minZoom, maxZoom, onSelectionContextMenu, preventScrolling, noDragClassName, noWheelClassName, noPanClassName, disableKeyboardA11y, onViewportChange, isControlledViewport: !!viewport, children: jsxRuntime.jsxs(Viewport, { children: [jsxRuntime.jsx(EdgeRenderer, { edgeTypes, onEdgeClick, onEdgeDoubleClick, onReconnect, onReconnectStart, onReconnectEnd, onlyRenderVisibleElements, onEdgeContextMenu, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius, defaultMarkerColor, noPanClassName, disableKeyboardA11y, rfId }), jsxRuntime.jsx(ConnectionLineWrapper, { style: connectionLineStyle, type: connectionLineType, component: connectionLineComponent, containerStyle: connectionLineContainerStyle }), jsxRuntime.jsx("div", { className: "react-flow__edgelabel-renderer" }), jsxRuntime.jsx(NodeRenderer, { nodeTypes, onNodeClick, onNodeDoubleClick, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, nodeClickDistance, onlyRenderVisibleElements, noPanClassName, noDragClassName, disableKeyboardA11y, nodeExtent, rfId }), jsxRuntime.jsx("div", { className: "react-flow__viewport-portal" })] }) });
|
|
8131
|
+
return jsxRuntime.jsx(FlowRenderer, { onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneContextMenu, onPaneScroll, paneClickDistance, deleteKeyCode, selectionKeyCode, selectionOnDrag, selectionMode, onSelectionStart, onSelectionEnd, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, elementsSelectable, zoomOnScroll, zoomOnPinch, zoomOnDoubleClick, panOnScroll, panOnScrollSpeed, panOnScrollMode, panOnDrag, autoPanOnSelection, defaultViewport: defaultViewport2, translateExtent, minZoom, maxZoom, onSelectionContextMenu, preventScrolling, noDragClassName, noWheelClassName, noPanClassName, disableKeyboardA11y, onViewportChange, isControlledViewport: !!viewport, children: jsxRuntime.jsxs(Viewport, { children: [jsxRuntime.jsx(EdgeRenderer, { edgeTypes, onEdgeClick, onEdgeDoubleClick, onReconnect, onReconnectStart, onReconnectEnd, onlyRenderVisibleElements, onEdgeContextMenu, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius, defaultMarkerColor, noPanClassName, disableKeyboardA11y, rfId }), jsxRuntime.jsx(ConnectionLineWrapper, { style: connectionLineStyle, type: connectionLineType, component: connectionLineComponent, containerStyle: connectionLineContainerStyle }), jsxRuntime.jsx("div", { className: "react-flow__edgelabel-renderer" }), jsxRuntime.jsx(NodeRenderer, { nodeTypes, onNodeClick, onNodeDoubleClick, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, nodeClickDistance, onlyRenderVisibleElements, noPanClassName, noDragClassName, disableKeyboardA11y, nodeExtent, rfId }), jsxRuntime.jsx("div", { className: "react-flow__viewport-portal" })] }) });
|
|
8074
8132
|
}
|
|
8075
8133
|
GraphViewComponent.displayName = "GraphView";
|
|
8076
8134
|
var GraphView = ReactExports.memo(GraphViewComponent);
|
|
8135
|
+
var devWarn = createDevWarn("React Flow", "https://reactflow.dev/");
|
|
8077
8136
|
var getInitialState = ({ nodes, edges, defaultNodes, defaultEdges, width, height, fitView, fitViewOptions, minZoom = 0.5, maxZoom = 2, nodeOrigin, nodeExtent, zIndexMode = "basic" } = {}) => {
|
|
8078
8137
|
const nodeLookup = /* @__PURE__ */ new Map();
|
|
8079
8138
|
const parentLookup = /* @__PURE__ */ new Map();
|
|
@@ -8420,7 +8479,7 @@ var createStore2 = ({ nodes, edges, defaultNodes, defaultEdges, width, height, f
|
|
|
8420
8479
|
setCenter: async (x, y, options) => {
|
|
8421
8480
|
const { width: width2, height: height2, maxZoom: maxZoom2, panZoom } = get3();
|
|
8422
8481
|
if (!panZoom) {
|
|
8423
|
-
return
|
|
8482
|
+
return false;
|
|
8424
8483
|
}
|
|
8425
8484
|
const nextZoom = typeof options?.zoom !== "undefined" ? options.zoom : maxZoom2;
|
|
8426
8485
|
await panZoom.setViewport({
|
|
@@ -8428,7 +8487,7 @@ var createStore2 = ({ nodes, edges, defaultNodes, defaultEdges, width, height, f
|
|
|
8428
8487
|
y: height2 / 2 - y * nextZoom,
|
|
8429
8488
|
zoom: nextZoom
|
|
8430
8489
|
}, { duration: options?.duration, ease: options?.ease, interpolate: options?.interpolate });
|
|
8431
|
-
return
|
|
8490
|
+
return true;
|
|
8432
8491
|
},
|
|
8433
8492
|
cancelConnection: () => {
|
|
8434
8493
|
set3({
|
|
@@ -8473,14 +8532,14 @@ var wrapperStyle = {
|
|
|
8473
8532
|
position: "relative",
|
|
8474
8533
|
zIndex: 0
|
|
8475
8534
|
};
|
|
8476
|
-
function ReactFlow({ nodes, edges, defaultNodes, defaultEdges, className, nodeTypes, edgeTypes, onNodeClick, onEdgeClick, onInit, onMove, onMoveStart, onMoveEnd, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, onNodeDragStart, onNodeDrag, onNodeDragStop, onNodesDelete, onEdgesDelete, onDelete, onSelectionChange, onSelectionDragStart, onSelectionDrag, onSelectionDragStop, onSelectionContextMenu, onSelectionStart, onSelectionEnd, onBeforeDelete, connectionMode, connectionLineType = ConnectionLineType.Bezier, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, deleteKeyCode = "Backspace", selectionKeyCode = "Shift", selectionOnDrag = false, selectionMode = SelectionMode.Full, panActivationKeyCode = "Space", multiSelectionKeyCode = isMacOs() ? "Meta" : "Control", zoomActivationKeyCode = isMacOs() ? "Meta" : "Control", snapToGrid, snapGrid, onlyRenderVisibleElements = false, selectNodesOnDrag, nodesDraggable, autoPanOnNodeFocus, nodesConnectable, nodesFocusable, nodeOrigin = defaultNodeOrigin, edgesFocusable, edgesReconnectable, elementsSelectable = true, defaultViewport: defaultViewport$1 = defaultViewport, minZoom = 0.5, maxZoom = 2, translateExtent = infiniteExtent, preventScrolling = true, nodeExtent, defaultMarkerColor = "#b1b1b7", zoomOnScroll = true, zoomOnPinch = true, panOnScroll = false, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = true, panOnDrag = true, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, paneClickDistance = 1, nodeClickDistance = 0, children: children2, onReconnect, onReconnectStart, onReconnectEnd, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius = 10, onNodesChange, onEdgesChange, noDragClassName = "nodrag", noWheelClassName = "nowheel", noPanClassName = "nopan", fitView, fitViewOptions, connectOnClick, attributionPosition, proOptions, defaultEdgeOptions, elevateNodesOnSelect = true, elevateEdgesOnSelect = false, disableKeyboardA11y = false, autoPanOnConnect, autoPanOnNodeDrag, autoPanSpeed, connectionRadius, isValidConnection, onError, style: style2, id: id2, nodeDragThreshold, connectionDragThreshold, viewport, onViewportChange, width, height, colorMode = "light", debug, onScroll, ariaLabelConfig, zIndexMode = "basic", ...rest }, ref) {
|
|
8535
|
+
function ReactFlow({ nodes, edges, defaultNodes, defaultEdges, className, nodeTypes, edgeTypes, onNodeClick, onEdgeClick, onInit, onMove, onMoveStart, onMoveEnd, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, onNodeDragStart, onNodeDrag, onNodeDragStop, onNodesDelete, onEdgesDelete, onDelete, onSelectionChange, onSelectionDragStart, onSelectionDrag, onSelectionDragStop, onSelectionContextMenu, onSelectionStart, onSelectionEnd, onBeforeDelete, connectionMode, connectionLineType = ConnectionLineType.Bezier, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, deleteKeyCode = "Backspace", selectionKeyCode = "Shift", selectionOnDrag = false, selectionMode = SelectionMode.Full, panActivationKeyCode = "Space", multiSelectionKeyCode = isMacOs() ? "Meta" : "Control", zoomActivationKeyCode = isMacOs() ? "Meta" : "Control", snapToGrid, snapGrid, onlyRenderVisibleElements = false, selectNodesOnDrag, nodesDraggable, autoPanOnNodeFocus, nodesConnectable, nodesFocusable, nodeOrigin = defaultNodeOrigin, edgesFocusable, edgesReconnectable, elementsSelectable = true, defaultViewport: defaultViewport$1 = defaultViewport, minZoom = 0.5, maxZoom = 2, translateExtent = infiniteExtent, preventScrolling = true, nodeExtent, defaultMarkerColor = "#b1b1b7", zoomOnScroll = true, zoomOnPinch = true, panOnScroll = false, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = true, panOnDrag = true, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, paneClickDistance = 1, nodeClickDistance = 0, children: children2, onReconnect, onReconnectStart, onReconnectEnd, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius = 10, onNodesChange, onEdgesChange, noDragClassName = "nodrag", noWheelClassName = "nowheel", noPanClassName = "nopan", fitView, fitViewOptions, connectOnClick, attributionPosition, proOptions, defaultEdgeOptions, elevateNodesOnSelect = true, elevateEdgesOnSelect = false, disableKeyboardA11y = false, autoPanOnConnect, autoPanOnNodeDrag, autoPanOnSelection = true, autoPanSpeed, connectionRadius, isValidConnection, onError, style: style2, id: id2, nodeDragThreshold, connectionDragThreshold, viewport, onViewportChange, width, height, colorMode = "light", debug, onScroll, ariaLabelConfig, zIndexMode = "basic", ...rest }, ref) {
|
|
8477
8536
|
const rfId = id2 || "1";
|
|
8478
8537
|
const colorModeClassName = useColorModeClass(colorMode);
|
|
8479
8538
|
const wrapperOnScroll = ReactExports.useCallback((e) => {
|
|
8480
8539
|
e.currentTarget.scrollTo({ top: 0, left: 0, behavior: "instant" });
|
|
8481
8540
|
onScroll?.(e);
|
|
8482
8541
|
}, [onScroll]);
|
|
8483
|
-
return jsxRuntime.jsx("div", { "data-testid": "rf__wrapper", ...rest, onScroll: wrapperOnScroll, style: { ...style2, ...wrapperStyle }, ref, className: cc(["react-flow", className, colorModeClassName]), id: id2, role: "application", children: jsxRuntime.jsxs(Wrapper, { nodes, edges, width, height, fitView, fitViewOptions, minZoom, maxZoom, nodeOrigin, nodeExtent, zIndexMode, children: [jsxRuntime.jsx(StoreUpdater, { nodes, edges, defaultNodes, defaultEdges, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, nodesDraggable, autoPanOnNodeFocus, nodesConnectable, nodesFocusable, edgesFocusable, edgesReconnectable, elementsSelectable, elevateNodesOnSelect, elevateEdgesOnSelect, minZoom, maxZoom, nodeExtent, onNodesChange, onEdgesChange, snapToGrid, snapGrid, connectionMode, translateExtent, connectOnClick, defaultEdgeOptions, fitView, fitViewOptions, onNodesDelete, onEdgesDelete, onDelete, onNodeDragStart, onNodeDrag, onNodeDragStop, onSelectionDrag, onSelectionDragStart, onSelectionDragStop, onMove, onMoveStart, onMoveEnd, noPanClassName, nodeOrigin, rfId, autoPanOnConnect, autoPanOnNodeDrag, autoPanSpeed, onError, connectionRadius, isValidConnection, selectNodesOnDrag, nodeDragThreshold, connectionDragThreshold, onBeforeDelete, debug, ariaLabelConfig, zIndexMode }), jsxRuntime.jsx(GraphView, { onInit, onNodeClick, onEdgeClick, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, nodeTypes, edgeTypes, connectionLineType, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, selectionKeyCode, selectionOnDrag, selectionMode, deleteKeyCode, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, onlyRenderVisibleElements, defaultViewport: defaultViewport$1, translateExtent, minZoom, maxZoom, preventScrolling, zoomOnScroll, zoomOnPinch, zoomOnDoubleClick, panOnScroll, panOnScrollSpeed, panOnScrollMode, panOnDrag, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, paneClickDistance, nodeClickDistance, onSelectionContextMenu, onSelectionStart, onSelectionEnd, onReconnect, onReconnectStart, onReconnectEnd, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius, defaultMarkerColor, noDragClassName, noWheelClassName, noPanClassName, rfId, disableKeyboardA11y, nodeExtent, viewport, onViewportChange }), jsxRuntime.jsx(SelectionListener, { onSelectionChange }), children2, jsxRuntime.jsx(Attribution, { proOptions, position: attributionPosition }), jsxRuntime.jsx(A11yDescriptions, { rfId, disableKeyboardA11y })] }) });
|
|
8542
|
+
return jsxRuntime.jsx("div", { "data-testid": "rf__wrapper", ...rest, onScroll: wrapperOnScroll, style: { ...style2, ...wrapperStyle }, ref, className: cc(["react-flow", className, colorModeClassName]), id: id2, role: "application", children: jsxRuntime.jsxs(Wrapper, { nodes, edges, width, height, fitView, fitViewOptions, minZoom, maxZoom, nodeOrigin, nodeExtent, zIndexMode, children: [jsxRuntime.jsx(StoreUpdater, { nodes, edges, defaultNodes, defaultEdges, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, nodesDraggable, autoPanOnNodeFocus, nodesConnectable, nodesFocusable, edgesFocusable, edgesReconnectable, elementsSelectable, elevateNodesOnSelect, elevateEdgesOnSelect, minZoom, maxZoom, nodeExtent, onNodesChange, onEdgesChange, snapToGrid, snapGrid, connectionMode, translateExtent, connectOnClick, defaultEdgeOptions, fitView, fitViewOptions, onNodesDelete, onEdgesDelete, onDelete, onNodeDragStart, onNodeDrag, onNodeDragStop, onSelectionDrag, onSelectionDragStart, onSelectionDragStop, onMove, onMoveStart, onMoveEnd, noPanClassName, nodeOrigin, rfId, autoPanOnConnect, autoPanOnNodeDrag, autoPanSpeed, onError, connectionRadius, isValidConnection, selectNodesOnDrag, nodeDragThreshold, connectionDragThreshold, onBeforeDelete, debug, ariaLabelConfig, zIndexMode }), jsxRuntime.jsx(GraphView, { onInit, onNodeClick, onEdgeClick, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, nodeTypes, edgeTypes, connectionLineType, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, selectionKeyCode, selectionOnDrag, selectionMode, deleteKeyCode, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, onlyRenderVisibleElements, defaultViewport: defaultViewport$1, translateExtent, minZoom, maxZoom, preventScrolling, zoomOnScroll, zoomOnPinch, zoomOnDoubleClick, panOnScroll, panOnScrollSpeed, panOnScrollMode, panOnDrag, autoPanOnSelection, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, paneClickDistance, nodeClickDistance, onSelectionContextMenu, onSelectionStart, onSelectionEnd, onReconnect, onReconnectStart, onReconnectEnd, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius, defaultMarkerColor, noDragClassName, noWheelClassName, noPanClassName, rfId, disableKeyboardA11y, nodeExtent, viewport, onViewportChange }), jsxRuntime.jsx(SelectionListener, { onSelectionChange }), children2, jsxRuntime.jsx(Attribution, { proOptions, position: attributionPosition }), jsxRuntime.jsx(A11yDescriptions, { rfId, disableKeyboardA11y })] }) });
|
|
8484
8543
|
}
|
|
8485
8544
|
fixedForwardRef(ReactFlow);
|
|
8486
8545
|
function LinePattern({ dimensions, lineWidth, variant, className }) {
|