@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
|
@@ -2933,10 +2933,10 @@ function zoom_default2() {
|
|
|
2933
2933
|
|
|
2934
2934
|
// node_modules/@xyflow/system/dist/esm/index.js
|
|
2935
2935
|
var errorMessages = {
|
|
2936
|
-
error001: (
|
|
2936
|
+
error001: (lib = "react") => `Seems like you have not used zustand provider as an ancestor. Help: https://${lib}flow.dev/error#001`,
|
|
2937
2937
|
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.",
|
|
2938
2938
|
error003: (nodeType) => `Node type "${nodeType}" not found. Using fallback type "default".`,
|
|
2939
|
-
error004: () => "The
|
|
2939
|
+
error004: () => "The parent container needs a width and a height to render the graph.",
|
|
2940
2940
|
error005: () => "Only child nodes can use a parent extent.",
|
|
2941
2941
|
error006: () => "Can't create edge. An edge needs a source and a target.",
|
|
2942
2942
|
error007: (id2) => `The old edge with id=${id2} does not exist.`,
|
|
@@ -2947,7 +2947,8 @@ var errorMessages = {
|
|
|
2947
2947
|
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.`,
|
|
2948
2948
|
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.`,
|
|
2949
2949
|
error014: () => "useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",
|
|
2950
|
-
error015: () => "It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."
|
|
2950
|
+
error015: () => "It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",
|
|
2951
|
+
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.`
|
|
2951
2952
|
};
|
|
2952
2953
|
var infiniteExtent = [
|
|
2953
2954
|
[Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY],
|
|
@@ -3115,7 +3116,7 @@ function getFitViewNodes(nodeLookup, options) {
|
|
|
3115
3116
|
}
|
|
3116
3117
|
async function fitViewport({ nodes, width, height, panZoom, minZoom, maxZoom }, options) {
|
|
3117
3118
|
if (nodes.size === 0) {
|
|
3118
|
-
return
|
|
3119
|
+
return true;
|
|
3119
3120
|
}
|
|
3120
3121
|
const nodesToFit = getFitViewNodes(nodes, options);
|
|
3121
3122
|
const bounds = getInternalNodesBounds(nodesToFit);
|
|
@@ -3125,7 +3126,7 @@ async function fitViewport({ nodes, width, height, panZoom, minZoom, maxZoom },
|
|
|
3125
3126
|
ease: options?.ease,
|
|
3126
3127
|
interpolate: options?.interpolate
|
|
3127
3128
|
});
|
|
3128
|
-
return
|
|
3129
|
+
return true;
|
|
3129
3130
|
}
|
|
3130
3131
|
function calculateNodePosition({ nodeId, nextPosition, nodeLookup, nodeOrigin = [0, 0], nodeExtent, onError }) {
|
|
3131
3132
|
const node = nodeLookup.get(nodeId);
|
|
@@ -3272,9 +3273,9 @@ var getOverlappingArea = (rectA, rectB) => {
|
|
|
3272
3273
|
};
|
|
3273
3274
|
var isRectObject = (obj) => isNumeric(obj.width) && isNumeric(obj.height) && isNumeric(obj.x) && isNumeric(obj.y);
|
|
3274
3275
|
var isNumeric = (n) => !isNaN(n) && isFinite(n);
|
|
3275
|
-
var
|
|
3276
|
+
var createDevWarn = (lib, helpUrl) => (id2, message) => {
|
|
3276
3277
|
if (process.env.NODE_ENV === "development") {
|
|
3277
|
-
console.warn(`[
|
|
3278
|
+
console.warn(`[${lib}]: ${message} Help: ${helpUrl}error#${id2}`);
|
|
3278
3279
|
}
|
|
3279
3280
|
};
|
|
3280
3281
|
var snapPosition = (position, snapGrid = [1, 1]) => {
|
|
@@ -3312,7 +3313,7 @@ function parsePadding(padding, viewport) {
|
|
|
3312
3313
|
return Math.floor(viewport * paddingValue * 0.01);
|
|
3313
3314
|
}
|
|
3314
3315
|
}
|
|
3315
|
-
console.error(`
|
|
3316
|
+
console.error(`The padding value "${padding}" is invalid. Please provide a number or a string with a valid unit (px or %).`);
|
|
3316
3317
|
return 0;
|
|
3317
3318
|
}
|
|
3318
3319
|
function parsePaddings(padding, width, height) {
|
|
@@ -3566,7 +3567,7 @@ var connectionExists = (edge, edges) => {
|
|
|
3566
3567
|
};
|
|
3567
3568
|
var addEdge = (edgeParams, edges, options = {}) => {
|
|
3568
3569
|
if (!edgeParams.source || !edgeParams.target) {
|
|
3569
|
-
|
|
3570
|
+
options.onError?.("006", errorMessages["error006"]());
|
|
3570
3571
|
return edges;
|
|
3571
3572
|
}
|
|
3572
3573
|
const edgeIdGenerator = options.getEdgeId || getEdgeId;
|
|
@@ -4162,7 +4163,7 @@ function updateNodeInternals(updates, nodeLookup, parentLookup, domNode, nodeOri
|
|
|
4162
4163
|
}
|
|
4163
4164
|
async function panBy({ delta, panZoom, transform: transform2, translateExtent, width, height }) {
|
|
4164
4165
|
if (!panZoom || !delta.x && !delta.y) {
|
|
4165
|
-
return
|
|
4166
|
+
return false;
|
|
4166
4167
|
}
|
|
4167
4168
|
const nextViewport = await panZoom.setViewportConstrained({
|
|
4168
4169
|
x: transform2[0] + delta.x,
|
|
@@ -4173,7 +4174,7 @@ async function panBy({ delta, panZoom, transform: transform2, translateExtent, w
|
|
|
4173
4174
|
[width, height]
|
|
4174
4175
|
], translateExtent);
|
|
4175
4176
|
const transformChanged = !!nextViewport && (nextViewport.x !== transform2[0] || nextViewport.y !== transform2[1] || nextViewport.k !== transform2[2]);
|
|
4176
|
-
return
|
|
4177
|
+
return transformChanged;
|
|
4177
4178
|
}
|
|
4178
4179
|
function addConnectionToLookup(type, connection, connectionKey, connectionLookup, nodeId, handleId) {
|
|
4179
4180
|
let key = nodeId;
|
|
@@ -4463,6 +4464,9 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
|
|
|
4463
4464
|
}
|
|
4464
4465
|
}).on("end", (event) => {
|
|
4465
4466
|
if (!dragStarted || abortDrag) {
|
|
4467
|
+
if (abortDrag && dragItems.size > 0) {
|
|
4468
|
+
getStoreItems().updateNodePositions(dragItems, false);
|
|
4469
|
+
}
|
|
4466
4470
|
return;
|
|
4467
4471
|
}
|
|
4468
4472
|
autoPanStarted = false;
|
|
@@ -5004,7 +5008,7 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
|
|
|
5004
5008
|
const zoomPanValues = {
|
|
5005
5009
|
isZoomingOrPanning: false,
|
|
5006
5010
|
usedRightMouseButton: false,
|
|
5007
|
-
prevViewport: {
|
|
5011
|
+
prevViewport: {},
|
|
5008
5012
|
mouseButton: 0,
|
|
5009
5013
|
timerId: void 0,
|
|
5010
5014
|
panScrollTimeout: void 0,
|
|
@@ -5024,13 +5028,13 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
|
|
|
5024
5028
|
const d3ZoomHandler = d3Selection.on("wheel.zoom");
|
|
5025
5029
|
const d3DblClickZoomHandler = d3Selection.on("dblclick.zoom");
|
|
5026
5030
|
d3ZoomInstance.wheelDelta(wheelDelta);
|
|
5027
|
-
function setTransform(transform2, options) {
|
|
5031
|
+
async function setTransform(transform2, options) {
|
|
5028
5032
|
if (d3Selection) {
|
|
5029
5033
|
return new Promise((resolve) => {
|
|
5030
5034
|
d3ZoomInstance?.interpolate(options?.interpolate === "linear" ? value_default : zoom_default).transform(getD3Transition(d3Selection, options?.duration, options?.ease, () => resolve(true)), transform2);
|
|
5031
5035
|
});
|
|
5032
5036
|
}
|
|
5033
|
-
return
|
|
5037
|
+
return false;
|
|
5034
5038
|
}
|
|
5035
5039
|
function update({ noWheelClassName, noPanClassName, onPaneContextMenu, userSelectionActive, panOnScroll, panOnDrag, panOnScrollMode, panOnScrollSpeed, preventScrolling, zoomOnPinch, zoomOnScroll, zoomOnDoubleClick, zoomActivationKeyPressed, lib, onTransformChange, connectionInProgress, paneClickDistance, selectionOnDrag }) {
|
|
5036
5040
|
if (userSelectionActive && !zoomPanValues.isZoomingOrPanning) {
|
|
@@ -5055,31 +5059,29 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
|
|
|
5055
5059
|
d3ZoomHandler
|
|
5056
5060
|
});
|
|
5057
5061
|
d3Selection.on("wheel.zoom", wheelHandler, { passive: false });
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
d3ZoomInstance.on("end", panZoomEndHandler);
|
|
5082
|
-
}
|
|
5062
|
+
const startHandler = createPanZoomStartHandler({
|
|
5063
|
+
zoomPanValues,
|
|
5064
|
+
onDraggingChange,
|
|
5065
|
+
onPanZoomStart
|
|
5066
|
+
});
|
|
5067
|
+
d3ZoomInstance.on("start", startHandler);
|
|
5068
|
+
const panZoomHandler = createPanZoomHandler({
|
|
5069
|
+
zoomPanValues,
|
|
5070
|
+
panOnDrag,
|
|
5071
|
+
onPaneContextMenu: !!onPaneContextMenu,
|
|
5072
|
+
onPanZoom,
|
|
5073
|
+
onTransformChange
|
|
5074
|
+
});
|
|
5075
|
+
d3ZoomInstance.on("zoom", panZoomHandler);
|
|
5076
|
+
const panZoomEndHandler = createPanZoomEndHandler({
|
|
5077
|
+
zoomPanValues,
|
|
5078
|
+
panOnDrag,
|
|
5079
|
+
panOnScroll,
|
|
5080
|
+
onPaneContextMenu,
|
|
5081
|
+
onPanZoomEnd,
|
|
5082
|
+
onDraggingChange
|
|
5083
|
+
});
|
|
5084
|
+
d3ZoomInstance.on("end", panZoomEndHandler);
|
|
5083
5085
|
const filter2 = createFilter({
|
|
5084
5086
|
zoomActivationKeyPressed,
|
|
5085
5087
|
panOnDrag,
|
|
@@ -5109,12 +5111,12 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
|
|
|
5109
5111
|
if (contrainedTransform) {
|
|
5110
5112
|
await setTransform(contrainedTransform);
|
|
5111
5113
|
}
|
|
5112
|
-
return
|
|
5114
|
+
return contrainedTransform;
|
|
5113
5115
|
}
|
|
5114
5116
|
async function setViewport(viewport2, options) {
|
|
5115
5117
|
const nextTransform = viewportToTransform(viewport2);
|
|
5116
5118
|
await setTransform(nextTransform, options);
|
|
5117
|
-
return
|
|
5119
|
+
return nextTransform;
|
|
5118
5120
|
}
|
|
5119
5121
|
function syncViewport(viewport2) {
|
|
5120
5122
|
if (d3Selection) {
|
|
@@ -5129,21 +5131,21 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
|
|
|
5129
5131
|
const transform2 = d3Selection ? transform(d3Selection.node()) : { x: 0, y: 0, k: 1 };
|
|
5130
5132
|
return { x: transform2.x, y: transform2.y, zoom: transform2.k };
|
|
5131
5133
|
}
|
|
5132
|
-
function scaleTo(zoom, options) {
|
|
5134
|
+
async function scaleTo(zoom, options) {
|
|
5133
5135
|
if (d3Selection) {
|
|
5134
5136
|
return new Promise((resolve) => {
|
|
5135
5137
|
d3ZoomInstance?.interpolate(options?.interpolate === "linear" ? value_default : zoom_default).scaleTo(getD3Transition(d3Selection, options?.duration, options?.ease, () => resolve(true)), zoom);
|
|
5136
5138
|
});
|
|
5137
5139
|
}
|
|
5138
|
-
return
|
|
5140
|
+
return false;
|
|
5139
5141
|
}
|
|
5140
|
-
function scaleBy(factor, options) {
|
|
5142
|
+
async function scaleBy(factor, options) {
|
|
5141
5143
|
if (d3Selection) {
|
|
5142
5144
|
return new Promise((resolve) => {
|
|
5143
5145
|
d3ZoomInstance?.interpolate(options?.interpolate === "linear" ? value_default : zoom_default).scaleBy(getD3Transition(d3Selection, options?.duration, options?.ease, () => resolve(true)), factor);
|
|
5144
5146
|
});
|
|
5145
5147
|
}
|
|
5146
|
-
return
|
|
5148
|
+
return false;
|
|
5147
5149
|
}
|
|
5148
5150
|
function setScaleExtent(scaleExtent) {
|
|
5149
5151
|
d3ZoomInstance?.scaleExtent(scaleExtent);
|
|
@@ -5338,12 +5340,6 @@ var initStartValues = {
|
|
|
5338
5340
|
pointerY: 0,
|
|
5339
5341
|
aspectRatio: 1
|
|
5340
5342
|
};
|
|
5341
|
-
function nodeToParentExtent(node) {
|
|
5342
|
-
return [
|
|
5343
|
-
[0, 0],
|
|
5344
|
-
[node.measured.width, node.measured.height]
|
|
5345
|
-
];
|
|
5346
|
-
}
|
|
5347
5343
|
function nodeToChildExtent(child, parent, nodeOrigin) {
|
|
5348
5344
|
const x = parent.position.x + child.position.x;
|
|
5349
5345
|
const y = parent.position.y + child.position.y;
|
|
@@ -5382,7 +5378,7 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
|
|
|
5382
5378
|
let containerBounds = null;
|
|
5383
5379
|
let childNodes = [];
|
|
5384
5380
|
let parentNode = void 0;
|
|
5385
|
-
let
|
|
5381
|
+
let nodeExtent = void 0;
|
|
5386
5382
|
let childExtent = void 0;
|
|
5387
5383
|
let resizeDetected = false;
|
|
5388
5384
|
const dragHandler = drag_default().on("start", (event) => {
|
|
@@ -5411,9 +5407,15 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
|
|
|
5411
5407
|
aspectRatio: prevValues.width / prevValues.height
|
|
5412
5408
|
};
|
|
5413
5409
|
parentNode = void 0;
|
|
5410
|
+
nodeExtent = isCoordinateExtent(node.extent) ? node.extent : void 0;
|
|
5414
5411
|
if (node.parentId && (node.extent === "parent" || node.expandParent)) {
|
|
5415
5412
|
parentNode = nodeLookup.get(node.parentId);
|
|
5416
|
-
|
|
5413
|
+
}
|
|
5414
|
+
if (parentNode && node.extent === "parent") {
|
|
5415
|
+
nodeExtent = [
|
|
5416
|
+
[0, 0],
|
|
5417
|
+
[parentNode.measured.width, parentNode.measured.height]
|
|
5418
|
+
];
|
|
5417
5419
|
}
|
|
5418
5420
|
childNodes = [];
|
|
5419
5421
|
childExtent = void 0;
|
|
@@ -5453,7 +5455,7 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
|
|
|
5453
5455
|
const { x: prevX, y: prevY, width: prevWidth, height: prevHeight } = prevValues;
|
|
5454
5456
|
const change = {};
|
|
5455
5457
|
const nodeOrigin = node.origin ?? storeNodeOrigin;
|
|
5456
|
-
const { width, height, x, y } = getDimensionsAfterResize(startValues, params.controlDirection, pointerPosition, params.boundaries, params.keepAspectRatio, nodeOrigin,
|
|
5458
|
+
const { width, height, x, y } = getDimensionsAfterResize(startValues, params.controlDirection, pointerPosition, params.boundaries, params.keepAspectRatio, nodeOrigin, nodeExtent, childExtent);
|
|
5457
5459
|
const isWidthChange = width !== prevWidth;
|
|
5458
5460
|
const isHeightChange = height !== prevHeight;
|
|
5459
5461
|
const isXPosChange = x !== prevX && isWidthChange;
|
|
@@ -5699,7 +5701,7 @@ function shallow$1(objA, objB) {
|
|
|
5699
5701
|
}
|
|
5700
5702
|
var StoreContext = createContext(null);
|
|
5701
5703
|
var Provider$1 = StoreContext.Provider;
|
|
5702
|
-
var zustandErrorMessage = errorMessages["error001"]();
|
|
5704
|
+
var zustandErrorMessage = errorMessages["error001"]("react");
|
|
5703
5705
|
function useStore(selector, equalityFn) {
|
|
5704
5706
|
const store = useContext(StoreContext);
|
|
5705
5707
|
if (store === null) {
|
|
@@ -5791,7 +5793,6 @@ function SelectionListener({ onSelectionChange }) {
|
|
|
5791
5793
|
}
|
|
5792
5794
|
return null;
|
|
5793
5795
|
}
|
|
5794
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
5795
5796
|
var defaultNodeOrigin = [0, 0];
|
|
5796
5797
|
var defaultViewport = { x: 0, y: 0, zoom: 1 };
|
|
5797
5798
|
var reactFlowFieldsToTrack = [
|
|
@@ -5882,7 +5883,7 @@ var initPrevValues2 = {
|
|
|
5882
5883
|
function StoreUpdater(props) {
|
|
5883
5884
|
const { setNodes, setEdges, setMinZoom, setMaxZoom, setTranslateExtent, setNodeExtent, reset, setDefaultNodesAndEdges } = useStore(selector$l, shallow$1);
|
|
5884
5885
|
const store = useStoreApi();
|
|
5885
|
-
|
|
5886
|
+
useEffect(() => {
|
|
5886
5887
|
setDefaultNodesAndEdges(props.defaultNodes, props.defaultEdges);
|
|
5887
5888
|
return () => {
|
|
5888
5889
|
previousFields.current = initPrevValues2;
|
|
@@ -5890,7 +5891,7 @@ function StoreUpdater(props) {
|
|
|
5890
5891
|
};
|
|
5891
5892
|
}, []);
|
|
5892
5893
|
const previousFields = useRef(initPrevValues2);
|
|
5893
|
-
|
|
5894
|
+
useEffect(
|
|
5894
5895
|
() => {
|
|
5895
5896
|
for (const fieldName of fieldsToTrack) {
|
|
5896
5897
|
const fieldValue = props[fieldName];
|
|
@@ -6026,30 +6027,30 @@ var useViewportHelper = () => {
|
|
|
6026
6027
|
const store = useStoreApi();
|
|
6027
6028
|
return useMemo(() => {
|
|
6028
6029
|
return {
|
|
6029
|
-
zoomIn: (options) => {
|
|
6030
|
+
zoomIn: async (options) => {
|
|
6030
6031
|
const { panZoom } = store.getState();
|
|
6031
|
-
return panZoom ? panZoom.scaleBy(1.2, options) :
|
|
6032
|
+
return panZoom ? panZoom.scaleBy(1.2, options) : false;
|
|
6032
6033
|
},
|
|
6033
|
-
zoomOut: (options) => {
|
|
6034
|
+
zoomOut: async (options) => {
|
|
6034
6035
|
const { panZoom } = store.getState();
|
|
6035
|
-
return panZoom ? panZoom.scaleBy(1 / 1.2, options) :
|
|
6036
|
+
return panZoom ? panZoom.scaleBy(1 / 1.2, options) : false;
|
|
6036
6037
|
},
|
|
6037
|
-
zoomTo: (zoomLevel, options) => {
|
|
6038
|
+
zoomTo: async (zoomLevel, options) => {
|
|
6038
6039
|
const { panZoom } = store.getState();
|
|
6039
|
-
return panZoom ? panZoom.scaleTo(zoomLevel, options) :
|
|
6040
|
+
return panZoom ? panZoom.scaleTo(zoomLevel, options) : false;
|
|
6040
6041
|
},
|
|
6041
6042
|
getZoom: () => store.getState().transform[2],
|
|
6042
6043
|
setViewport: async (viewport, options) => {
|
|
6043
6044
|
const { transform: [tX, tY, tZoom], panZoom } = store.getState();
|
|
6044
6045
|
if (!panZoom) {
|
|
6045
|
-
return
|
|
6046
|
+
return false;
|
|
6046
6047
|
}
|
|
6047
6048
|
await panZoom.setViewport({
|
|
6048
6049
|
x: viewport.x ?? tX,
|
|
6049
6050
|
y: viewport.y ?? tY,
|
|
6050
6051
|
zoom: viewport.zoom ?? tZoom
|
|
6051
6052
|
}, options);
|
|
6052
|
-
return
|
|
6053
|
+
return true;
|
|
6053
6054
|
},
|
|
6054
6055
|
getViewport: () => {
|
|
6055
6056
|
const [x, y, zoom] = store.getState().transform;
|
|
@@ -6062,14 +6063,14 @@ var useViewportHelper = () => {
|
|
|
6062
6063
|
const { width, height, minZoom, maxZoom, panZoom } = store.getState();
|
|
6063
6064
|
const viewport = getViewportForBounds(bounds, width, height, minZoom, maxZoom, options?.padding ?? 0.1);
|
|
6064
6065
|
if (!panZoom) {
|
|
6065
|
-
return
|
|
6066
|
+
return false;
|
|
6066
6067
|
}
|
|
6067
6068
|
await panZoom.setViewport(viewport, {
|
|
6068
6069
|
duration: options?.duration,
|
|
6069
6070
|
ease: options?.ease,
|
|
6070
6071
|
interpolate: options?.interpolate
|
|
6071
6072
|
});
|
|
6072
|
-
return
|
|
6073
|
+
return true;
|
|
6073
6074
|
},
|
|
6074
6075
|
screenToFlowPosition: (clientPosition, options = {}) => {
|
|
6075
6076
|
const { transform: transform2, snapGrid, snapToGrid, domNode } = store.getState();
|
|
@@ -6238,11 +6239,19 @@ function elementToRemoveChange(item) {
|
|
|
6238
6239
|
type: "remove"
|
|
6239
6240
|
};
|
|
6240
6241
|
}
|
|
6242
|
+
var defaultOnError = createDevWarn("React Flow", "https://reactflow.dev/");
|
|
6243
|
+
function addEdge2(edgeParams, edges, options = {}) {
|
|
6244
|
+
return addEdge(edgeParams, edges, {
|
|
6245
|
+
...options,
|
|
6246
|
+
onError: options.onError ?? defaultOnError
|
|
6247
|
+
});
|
|
6248
|
+
}
|
|
6241
6249
|
var isNode = (element) => isNodeBase(element);
|
|
6242
6250
|
var isEdge = (element) => isEdgeBase(element);
|
|
6243
6251
|
function fixedForwardRef(render) {
|
|
6244
6252
|
return forwardRef(render);
|
|
6245
6253
|
}
|
|
6254
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
6246
6255
|
function useQueue(runQueue) {
|
|
6247
6256
|
const [serial, setSerial] = useState(BigInt(0));
|
|
6248
6257
|
const [queue] = useState(() => createQueue(() => setSerial((n) => n + BigInt(1))));
|
|
@@ -6673,17 +6682,22 @@ var selector$h = (s) => ({
|
|
|
6673
6682
|
userSelectionActive: s.userSelectionActive,
|
|
6674
6683
|
elementsSelectable: s.elementsSelectable,
|
|
6675
6684
|
connectionInProgress: s.connection.inProgress,
|
|
6676
|
-
dragging: s.paneDragging
|
|
6685
|
+
dragging: s.paneDragging,
|
|
6686
|
+
panBy: s.panBy,
|
|
6687
|
+
autoPanSpeed: s.autoPanSpeed
|
|
6677
6688
|
});
|
|
6678
|
-
function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.Full, panOnDrag, paneClickDistance, selectionOnDrag, onSelectionStart, onSelectionEnd, onPaneClick, onPaneContextMenu, onPaneScroll, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, children: children2 }) {
|
|
6689
|
+
function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.Full, panOnDrag, autoPanOnSelection, paneClickDistance, selectionOnDrag, onSelectionStart, onSelectionEnd, onPaneClick, onPaneContextMenu, onPaneScroll, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, children: children2 }) {
|
|
6690
|
+
const autoPanId = useRef(0);
|
|
6679
6691
|
const store = useStoreApi();
|
|
6680
|
-
const { userSelectionActive, elementsSelectable, dragging, connectionInProgress } = useStore(selector$h, shallow$1);
|
|
6692
|
+
const { userSelectionActive, elementsSelectable, dragging, connectionInProgress, panBy: panBy2, autoPanSpeed } = useStore(selector$h, shallow$1);
|
|
6681
6693
|
const isSelectionEnabled = elementsSelectable && (isSelecting || userSelectionActive);
|
|
6682
6694
|
const container = useRef(null);
|
|
6683
6695
|
const containerBounds = useRef();
|
|
6684
6696
|
const selectedNodeIds = useRef(/* @__PURE__ */ new Set());
|
|
6685
6697
|
const selectedEdgeIds = useRef(/* @__PURE__ */ new Set());
|
|
6686
6698
|
const selectionInProgress = useRef(false);
|
|
6699
|
+
const position = useRef({ x: 0, y: 0 });
|
|
6700
|
+
const autoPanStarted = useRef(false);
|
|
6687
6701
|
const onClick = (event) => {
|
|
6688
6702
|
if (selectionInProgress.current || connectionInProgress) {
|
|
6689
6703
|
selectionInProgress.current = false;
|
|
@@ -6708,7 +6722,7 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
6708
6722
|
}
|
|
6709
6723
|
};
|
|
6710
6724
|
const onPointerDownCapture = (event) => {
|
|
6711
|
-
const { domNode } = store.getState();
|
|
6725
|
+
const { domNode, transform: transform2 } = store.getState();
|
|
6712
6726
|
containerBounds.current = domNode?.getBoundingClientRect();
|
|
6713
6727
|
if (!containerBounds.current)
|
|
6714
6728
|
return;
|
|
@@ -6721,12 +6735,13 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
6721
6735
|
event.target?.setPointerCapture?.(event.pointerId);
|
|
6722
6736
|
selectionInProgress.current = false;
|
|
6723
6737
|
const { x, y } = getEventPosition(event.nativeEvent, containerBounds.current);
|
|
6738
|
+
const userSelectionStartPosition = pointToRendererPoint({ x, y }, transform2);
|
|
6724
6739
|
store.setState({
|
|
6725
6740
|
userSelectionRect: {
|
|
6726
6741
|
width: 0,
|
|
6727
6742
|
height: 0,
|
|
6728
|
-
startX: x,
|
|
6729
|
-
startY: y,
|
|
6743
|
+
startX: userSelectionStartPosition.x,
|
|
6744
|
+
startY: userSelectionStartPosition.y,
|
|
6730
6745
|
x,
|
|
6731
6746
|
y
|
|
6732
6747
|
}
|
|
@@ -6736,30 +6751,21 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
6736
6751
|
event.preventDefault();
|
|
6737
6752
|
}
|
|
6738
6753
|
};
|
|
6739
|
-
|
|
6740
|
-
const { userSelectionRect
|
|
6741
|
-
if (!
|
|
6754
|
+
function commitUserSelectionRect(mouseX, mouseY) {
|
|
6755
|
+
const { userSelectionRect } = store.getState();
|
|
6756
|
+
if (!userSelectionRect) {
|
|
6742
6757
|
return;
|
|
6743
6758
|
}
|
|
6744
|
-
const {
|
|
6745
|
-
const { startX, startY }
|
|
6746
|
-
|
|
6747
|
-
const requiredDistance = selectionKeyPressed ? 0 : paneClickDistance;
|
|
6748
|
-
const distance2 = Math.hypot(mouseX - startX, mouseY - startY);
|
|
6749
|
-
if (distance2 <= requiredDistance) {
|
|
6750
|
-
return;
|
|
6751
|
-
}
|
|
6752
|
-
resetSelectedElements();
|
|
6753
|
-
onSelectionStart?.(event);
|
|
6754
|
-
}
|
|
6755
|
-
selectionInProgress.current = true;
|
|
6759
|
+
const { transform: transform2, nodeLookup, edgeLookup, connectionLookup, triggerNodeChanges, triggerEdgeChanges, defaultEdgeOptions } = store.getState();
|
|
6760
|
+
const userStartPosition = { x: userSelectionRect.startX, y: userSelectionRect.startY };
|
|
6761
|
+
const { x: screenStartX, y: screenStartY } = rendererPointToPoint(userStartPosition, transform2);
|
|
6756
6762
|
const nextUserSelectRect = {
|
|
6757
|
-
startX,
|
|
6758
|
-
startY,
|
|
6759
|
-
x: mouseX <
|
|
6760
|
-
y: mouseY <
|
|
6761
|
-
width: Math.abs(mouseX -
|
|
6762
|
-
height: Math.abs(mouseY -
|
|
6763
|
+
startX: userStartPosition.x,
|
|
6764
|
+
startY: userStartPosition.y,
|
|
6765
|
+
x: mouseX < screenStartX ? mouseX : screenStartX,
|
|
6766
|
+
y: mouseY < screenStartY ? mouseY : screenStartY,
|
|
6767
|
+
width: Math.abs(mouseX - screenStartX),
|
|
6768
|
+
height: Math.abs(mouseY - screenStartY)
|
|
6763
6769
|
};
|
|
6764
6770
|
const prevSelectedNodeIds = selectedNodeIds.current;
|
|
6765
6771
|
const prevSelectedEdgeIds = selectedEdgeIds.current;
|
|
@@ -6790,6 +6796,53 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
6790
6796
|
userSelectionActive: true,
|
|
6791
6797
|
nodesSelectionActive: false
|
|
6792
6798
|
});
|
|
6799
|
+
}
|
|
6800
|
+
function autoPan() {
|
|
6801
|
+
if (!autoPanOnSelection || !containerBounds.current) {
|
|
6802
|
+
return;
|
|
6803
|
+
}
|
|
6804
|
+
const [x, y] = calcAutoPan(position.current, containerBounds.current, autoPanSpeed);
|
|
6805
|
+
panBy2({ x, y }).then((panned) => {
|
|
6806
|
+
if (!selectionInProgress.current || !panned) {
|
|
6807
|
+
autoPanId.current = requestAnimationFrame(autoPan);
|
|
6808
|
+
return;
|
|
6809
|
+
}
|
|
6810
|
+
const { x: mx, y: my } = position.current;
|
|
6811
|
+
commitUserSelectionRect(mx, my);
|
|
6812
|
+
autoPanId.current = requestAnimationFrame(autoPan);
|
|
6813
|
+
});
|
|
6814
|
+
}
|
|
6815
|
+
const cleanupAutoPan = () => {
|
|
6816
|
+
cancelAnimationFrame(autoPanId.current);
|
|
6817
|
+
autoPanId.current = 0;
|
|
6818
|
+
autoPanStarted.current = false;
|
|
6819
|
+
};
|
|
6820
|
+
useEffect(() => {
|
|
6821
|
+
return () => cleanupAutoPan();
|
|
6822
|
+
}, []);
|
|
6823
|
+
const onPointerMove = (event) => {
|
|
6824
|
+
const { userSelectionRect, transform: transform2, resetSelectedElements } = store.getState();
|
|
6825
|
+
if (!containerBounds.current || !userSelectionRect) {
|
|
6826
|
+
return;
|
|
6827
|
+
}
|
|
6828
|
+
const { x: mouseX, y: mouseY } = getEventPosition(event.nativeEvent, containerBounds.current);
|
|
6829
|
+
position.current = { x: mouseX, y: mouseY };
|
|
6830
|
+
const screenStart = rendererPointToPoint({ x: userSelectionRect.startX, y: userSelectionRect.startY }, transform2);
|
|
6831
|
+
if (!selectionInProgress.current) {
|
|
6832
|
+
const requiredDistance = selectionKeyPressed ? 0 : paneClickDistance;
|
|
6833
|
+
const distance2 = Math.hypot(mouseX - screenStart.x, mouseY - screenStart.y);
|
|
6834
|
+
if (distance2 <= requiredDistance) {
|
|
6835
|
+
return;
|
|
6836
|
+
}
|
|
6837
|
+
resetSelectedElements();
|
|
6838
|
+
onSelectionStart?.(event);
|
|
6839
|
+
}
|
|
6840
|
+
selectionInProgress.current = true;
|
|
6841
|
+
if (!autoPanStarted.current) {
|
|
6842
|
+
autoPan();
|
|
6843
|
+
autoPanStarted.current = true;
|
|
6844
|
+
}
|
|
6845
|
+
commitUserSelectionRect(mouseX, mouseY);
|
|
6793
6846
|
};
|
|
6794
6847
|
const onPointerUp = (event) => {
|
|
6795
6848
|
if (event.button !== 0) {
|
|
@@ -6809,9 +6862,14 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
6809
6862
|
nodesSelectionActive: selectedNodeIds.current.size > 0
|
|
6810
6863
|
});
|
|
6811
6864
|
}
|
|
6865
|
+
cleanupAutoPan();
|
|
6866
|
+
};
|
|
6867
|
+
const onPointerCancel = (event) => {
|
|
6868
|
+
event.target?.releasePointerCapture?.(event.pointerId);
|
|
6869
|
+
cleanupAutoPan();
|
|
6812
6870
|
};
|
|
6813
6871
|
const draggable = panOnDrag === true || Array.isArray(panOnDrag) && panOnDrag.includes(0);
|
|
6814
|
-
return 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, jsx(UserSelection, {})] });
|
|
6872
|
+
return 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, jsx(UserSelection, {})] });
|
|
6815
6873
|
}
|
|
6816
6874
|
function handleNodeClick({ id: id2, store, unselect = false, nodeRef }) {
|
|
6817
6875
|
const { addSelectedNodes, unselectNodesAndEdges, multiSelectionActive, nodeLookup, onError } = store.getState();
|
|
@@ -6949,8 +7007,8 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
|
|
|
6949
7007
|
...params
|
|
6950
7008
|
};
|
|
6951
7009
|
if (hasDefaultEdges) {
|
|
6952
|
-
const { edges, setEdges } = store.getState();
|
|
6953
|
-
setEdges(
|
|
7010
|
+
const { edges, setEdges, onError } = store.getState();
|
|
7011
|
+
setEdges(addEdge2(edgeParams, edges, { onError }));
|
|
6954
7012
|
}
|
|
6955
7013
|
onConnectAction?.(edgeParams);
|
|
6956
7014
|
onConnect?.(edgeParams);
|
|
@@ -7146,7 +7204,7 @@ var win = typeof window !== "undefined" ? window : void 0;
|
|
|
7146
7204
|
var selector$e = (s) => {
|
|
7147
7205
|
return { nodesSelectionActive: s.nodesSelectionActive, userSelectionActive: s.userSelectionActive };
|
|
7148
7206
|
};
|
|
7149
|
-
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 }) {
|
|
7207
|
+
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 }) {
|
|
7150
7208
|
const { nodesSelectionActive, userSelectionActive } = useStore(selector$e, shallow$1);
|
|
7151
7209
|
const selectionKeyPressed = useKeyPress(selectionKeyCode, { target: win });
|
|
7152
7210
|
const panActivationKeyPressed = useKeyPress(panActivationKeyCode, { target: win });
|
|
@@ -7155,7 +7213,7 @@ function FlowRendererComponent({ children: children2, onPaneClick, onPaneMouseEn
|
|
|
7155
7213
|
const _selectionOnDrag = selectionOnDrag && panOnDrag !== true;
|
|
7156
7214
|
const isSelecting = selectionKeyPressed || userSelectionActive || _selectionOnDrag;
|
|
7157
7215
|
useGlobalKeyHandler({ deleteKeyCode, multiSelectionKeyCode });
|
|
7158
|
-
return 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: jsxs(Pane, { onSelectionStart, onSelectionEnd, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneContextMenu, onPaneScroll, panOnDrag, isSelecting: !!isSelecting, selectionMode, selectionKeyPressed, paneClickDistance, selectionOnDrag: _selectionOnDrag, children: [children2, nodesSelectionActive && jsx(NodesSelection, { onSelectionContextMenu, noPanClassName, disableKeyboardA11y })] }) });
|
|
7216
|
+
return 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: jsxs(Pane, { onSelectionStart, onSelectionEnd, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneContextMenu, onPaneScroll, panOnDrag, autoPanOnSelection, isSelecting: !!isSelecting, selectionMode, selectionKeyPressed, paneClickDistance, selectionOnDrag: _selectionOnDrag, children: [children2, nodesSelectionActive && jsx(NodesSelection, { onSelectionContextMenu, noPanClassName, disableKeyboardA11y })] }) });
|
|
7159
7217
|
}
|
|
7160
7218
|
FlowRendererComponent.displayName = "FlowRenderer";
|
|
7161
7219
|
var FlowRenderer = memo(FlowRendererComponent);
|
|
@@ -7960,16 +8018,17 @@ function useStylesLoadedWarning() {
|
|
|
7960
8018
|
}
|
|
7961
8019
|
}, []);
|
|
7962
8020
|
}
|
|
7963
|
-
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 }) {
|
|
8021
|
+
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 }) {
|
|
7964
8022
|
useNodeOrEdgeTypesWarning(nodeTypes);
|
|
7965
8023
|
useNodeOrEdgeTypesWarning(edgeTypes);
|
|
7966
8024
|
useStylesLoadedWarning();
|
|
7967
8025
|
useOnInitHandler(onInit);
|
|
7968
8026
|
useViewportSync(viewport);
|
|
7969
|
-
return 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: jsxs(Viewport, { children: [jsx(EdgeRenderer, { edgeTypes, onEdgeClick, onEdgeDoubleClick, onReconnect, onReconnectStart, onReconnectEnd, onlyRenderVisibleElements, onEdgeContextMenu, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius, defaultMarkerColor, noPanClassName, disableKeyboardA11y, rfId }), jsx(ConnectionLineWrapper, { style: connectionLineStyle, type: connectionLineType, component: connectionLineComponent, containerStyle: connectionLineContainerStyle }), jsx("div", { className: "react-flow__edgelabel-renderer" }), jsx(NodeRenderer, { nodeTypes, onNodeClick, onNodeDoubleClick, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, nodeClickDistance, onlyRenderVisibleElements, noPanClassName, noDragClassName, disableKeyboardA11y, nodeExtent, rfId }), jsx("div", { className: "react-flow__viewport-portal" })] }) });
|
|
8027
|
+
return 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: jsxs(Viewport, { children: [jsx(EdgeRenderer, { edgeTypes, onEdgeClick, onEdgeDoubleClick, onReconnect, onReconnectStart, onReconnectEnd, onlyRenderVisibleElements, onEdgeContextMenu, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius, defaultMarkerColor, noPanClassName, disableKeyboardA11y, rfId }), jsx(ConnectionLineWrapper, { style: connectionLineStyle, type: connectionLineType, component: connectionLineComponent, containerStyle: connectionLineContainerStyle }), jsx("div", { className: "react-flow__edgelabel-renderer" }), jsx(NodeRenderer, { nodeTypes, onNodeClick, onNodeDoubleClick, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, nodeClickDistance, onlyRenderVisibleElements, noPanClassName, noDragClassName, disableKeyboardA11y, nodeExtent, rfId }), jsx("div", { className: "react-flow__viewport-portal" })] }) });
|
|
7970
8028
|
}
|
|
7971
8029
|
GraphViewComponent.displayName = "GraphView";
|
|
7972
8030
|
var GraphView = memo(GraphViewComponent);
|
|
8031
|
+
var devWarn = createDevWarn("React Flow", "https://reactflow.dev/");
|
|
7973
8032
|
var getInitialState = ({ nodes, edges, defaultNodes, defaultEdges, width, height, fitView, fitViewOptions, minZoom = 0.5, maxZoom = 2, nodeOrigin, nodeExtent, zIndexMode = "basic" } = {}) => {
|
|
7974
8033
|
const nodeLookup = /* @__PURE__ */ new Map();
|
|
7975
8034
|
const parentLookup = /* @__PURE__ */ new Map();
|
|
@@ -8316,7 +8375,7 @@ var createStore2 = ({ nodes, edges, defaultNodes, defaultEdges, width, height, f
|
|
|
8316
8375
|
setCenter: async (x, y, options) => {
|
|
8317
8376
|
const { width: width2, height: height2, maxZoom: maxZoom2, panZoom } = get3();
|
|
8318
8377
|
if (!panZoom) {
|
|
8319
|
-
return
|
|
8378
|
+
return false;
|
|
8320
8379
|
}
|
|
8321
8380
|
const nextZoom = typeof options?.zoom !== "undefined" ? options.zoom : maxZoom2;
|
|
8322
8381
|
await panZoom.setViewport({
|
|
@@ -8324,7 +8383,7 @@ var createStore2 = ({ nodes, edges, defaultNodes, defaultEdges, width, height, f
|
|
|
8324
8383
|
y: height2 / 2 - y * nextZoom,
|
|
8325
8384
|
zoom: nextZoom
|
|
8326
8385
|
}, { duration: options?.duration, ease: options?.ease, interpolate: options?.interpolate });
|
|
8327
|
-
return
|
|
8386
|
+
return true;
|
|
8328
8387
|
},
|
|
8329
8388
|
cancelConnection: () => {
|
|
8330
8389
|
set3({
|
|
@@ -8369,14 +8428,14 @@ var wrapperStyle = {
|
|
|
8369
8428
|
position: "relative",
|
|
8370
8429
|
zIndex: 0
|
|
8371
8430
|
};
|
|
8372
|
-
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) {
|
|
8431
|
+
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) {
|
|
8373
8432
|
const rfId = id2 || "1";
|
|
8374
8433
|
const colorModeClassName = useColorModeClass(colorMode);
|
|
8375
8434
|
const wrapperOnScroll = useCallback((e) => {
|
|
8376
8435
|
e.currentTarget.scrollTo({ top: 0, left: 0, behavior: "instant" });
|
|
8377
8436
|
onScroll?.(e);
|
|
8378
8437
|
}, [onScroll]);
|
|
8379
|
-
return jsx("div", { "data-testid": "rf__wrapper", ...rest, onScroll: wrapperOnScroll, style: { ...style2, ...wrapperStyle }, ref, className: cc(["react-flow", className, colorModeClassName]), id: id2, role: "application", children: jsxs(Wrapper, { nodes, edges, width, height, fitView, fitViewOptions, minZoom, maxZoom, nodeOrigin, nodeExtent, zIndexMode, children: [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 }), 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 }), jsx(SelectionListener, { onSelectionChange }), children2, jsx(Attribution, { proOptions, position: attributionPosition }), jsx(A11yDescriptions, { rfId, disableKeyboardA11y })] }) });
|
|
8438
|
+
return jsx("div", { "data-testid": "rf__wrapper", ...rest, onScroll: wrapperOnScroll, style: { ...style2, ...wrapperStyle }, ref, className: cc(["react-flow", className, colorModeClassName]), id: id2, role: "application", children: jsxs(Wrapper, { nodes, edges, width, height, fitView, fitViewOptions, minZoom, maxZoom, nodeOrigin, nodeExtent, zIndexMode, children: [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 }), 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 }), jsx(SelectionListener, { onSelectionChange }), children2, jsx(Attribution, { proOptions, position: attributionPosition }), jsx(A11yDescriptions, { rfId, disableKeyboardA11y })] }) });
|
|
8380
8439
|
}
|
|
8381
8440
|
var index = fixedForwardRef(ReactFlow);
|
|
8382
8441
|
function LinePattern({ dimensions, lineWidth, variant, className }) {
|
|
@@ -8812,6 +8871,6 @@ function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle
|
|
|
8812
8871
|
}
|
|
8813
8872
|
memo(ResizeControl);
|
|
8814
8873
|
|
|
8815
|
-
export { Background, BackgroundVariant, Controls, Handle, MiniMap, Position, ReactFlowProvider, addEdge, applyEdgeChanges, applyNodeChanges, index, useReactFlow };
|
|
8816
|
-
//# sourceMappingURL=chunk-
|
|
8817
|
-
//# sourceMappingURL=chunk-
|
|
8874
|
+
export { Background, BackgroundVariant, Controls, Handle, MiniMap, Position, ReactFlowProvider, addEdge2 as addEdge, applyEdgeChanges, applyNodeChanges, index, useReactFlow };
|
|
8875
|
+
//# sourceMappingURL=chunk-2BZ6OE5H.js.map
|
|
8876
|
+
//# sourceMappingURL=chunk-2BZ6OE5H.js.map
|