@xyflow/system 0.0.15 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -163,8 +163,10 @@ const getIncomers = (node, nodes, edges) => {
163
163
  const getNodePositionWithOrigin = (node, nodeOrigin = [0, 0]) => {
164
164
  if (!node) {
165
165
  return {
166
- x: 0,
167
- y: 0,
166
+ position: {
167
+ x: 0,
168
+ y: 0,
169
+ },
168
170
  positionAbsolute: {
169
171
  x: 0,
170
172
  y: 0,
@@ -178,7 +180,7 @@ const getNodePositionWithOrigin = (node, nodeOrigin = [0, 0]) => {
178
180
  y: node.position.y - offsetY,
179
181
  };
180
182
  return {
181
- ...position,
183
+ position,
182
184
  positionAbsolute: node.computed?.positionAbsolute
183
185
  ? {
184
186
  x: node.computed.positionAbsolute.x - offsetX,
@@ -192,18 +194,18 @@ const getNodePositionWithOrigin = (node, nodeOrigin = [0, 0]) => {
192
194
  * @public
193
195
  * @remarks Useful when combined with {@link getViewportForBounds} to calculate the correct transform to fit the given nodes in a viewport.
194
196
  * @param nodes - Nodes to calculate the bounds for
195
- * @param nodeOrigin - Origin of the nodes: [0, 0] - top left, [0.5, 0.5] - center
197
+ * @param params.nodeOrigin - Origin of the nodes: [0, 0] - top left, [0.5, 0.5] - center
198
+ * @param params.useRelativePosition - Whether to use the relative or absolute node positions
196
199
  * @returns Bounding box enclosing all nodes
197
200
  */
198
- const getNodesBounds = (nodes, nodeOrigin = [0, 0]) => {
201
+ const getNodesBounds = (nodes, params = { nodeOrigin: [0, 0], useRelativePosition: false }) => {
199
202
  if (nodes.length === 0) {
200
203
  return { x: 0, y: 0, width: 0, height: 0 };
201
204
  }
202
205
  const box = nodes.reduce((currBox, node) => {
203
- const { x, y } = getNodePositionWithOrigin(node, node.origin || nodeOrigin);
206
+ const nodePos = getNodePositionWithOrigin(node, node.origin || params.nodeOrigin);
204
207
  return getBoundsOfBoxes(currBox, rectToBox({
205
- x,
206
- y,
208
+ ...nodePos[params.useRelativePosition ? 'position' : 'positionAbsolute'],
207
209
  width: node.computed?.width ?? node.width ?? 0,
208
210
  height: node.computed?.height ?? node.height ?? 0,
209
211
  }));
@@ -259,64 +261,73 @@ function fitView({ nodes, width, height, panZoom, minZoom, maxZoom, nodeOrigin =
259
261
  return isVisible;
260
262
  });
261
263
  if (filteredNodes.length > 0) {
262
- const bounds = getNodesBounds(filteredNodes, nodeOrigin);
264
+ const bounds = getNodesBounds(filteredNodes, { nodeOrigin });
263
265
  const viewport = getViewportForBounds(bounds, width, height, options?.minZoom ?? minZoom, options?.maxZoom ?? maxZoom, options?.padding ?? 0.1);
264
266
  panZoom.setViewport(viewport, { duration: options?.duration });
265
267
  return true;
266
268
  }
267
269
  return false;
268
270
  }
271
+ /**
272
+ * This function clamps the passed extend by the node's width and height.
273
+ * This is needed to prevent the node from being dragged outside of its extent.
274
+ *
275
+ * @param node
276
+ * @param extent
277
+ * @returns
278
+ */
269
279
  function clampNodeExtent(node, extent) {
270
280
  if (!extent || extent === 'parent') {
271
281
  return extent;
272
282
  }
273
283
  return [extent[0], [extent[1][0] - (node.computed?.width ?? 0), extent[1][1] - (node.computed?.height ?? 0)]];
274
284
  }
275
- function calcNextPosition(node, nextPosition, nodes, nodeExtent, nodeOrigin = [0, 0], onError) {
276
- const clampedNodeExtent = clampNodeExtent(node, node.extent || nodeExtent);
277
- let currentExtent = clampedNodeExtent;
278
- let parentNode = null;
279
- let parentPos = { x: 0, y: 0 };
280
- if (node.parentNode) {
281
- parentNode = nodes.find((n) => n.id === node.parentNode) || null;
282
- parentPos = parentNode
283
- ? getNodePositionWithOrigin(parentNode, parentNode.origin || nodeOrigin).positionAbsolute
284
- : parentPos;
285
- }
285
+ /**
286
+ * This function calculates the next position of a node, taking into account the node's extent, parent node, and origin.
287
+ *
288
+ * @internal
289
+ * @returns position, positionAbsolute
290
+ */
291
+ function calculateNodePosition({ nodeId, nextPosition, nodeLookup, nodeOrigin = [0, 0], nodeExtent, onError, }) {
292
+ const node = nodeLookup.get(nodeId);
293
+ const parentNode = node.parentNode ? nodeLookup.get(node.parentNode) : undefined;
294
+ const { x: parentX, y: parentY } = parentNode
295
+ ? getNodePositionWithOrigin(parentNode, parentNode.origin || nodeOrigin).positionAbsolute
296
+ : { x: 0, y: 0 };
297
+ let currentExtent = clampNodeExtent(node, node.extent || nodeExtent);
286
298
  if (node.extent === 'parent' && !node.expandParent) {
287
- const nodeWidth = node.computed?.width;
288
- const nodeHeight = node.computed?.height;
289
- if (node.parentNode && nodeWidth && nodeHeight) {
290
- const currNodeOrigin = node.origin || nodeOrigin;
291
- currentExtent =
292
- parentNode && isNumeric(parentNode.computed?.width) && isNumeric(parentNode.computed?.height)
293
- ? [
294
- [parentPos.x + nodeWidth * currNodeOrigin[0], parentPos.y + nodeHeight * currNodeOrigin[1]],
295
- [
296
- parentPos.x + (parentNode.computed?.width ?? 0) - nodeWidth + nodeWidth * currNodeOrigin[0],
297
- parentPos.y + (parentNode.computed?.height ?? 0) - nodeHeight + nodeHeight * currNodeOrigin[1],
298
- ],
299
- ]
300
- : currentExtent;
299
+ if (!parentNode) {
300
+ onError?.('005', errorMessages['error005']());
301
301
  }
302
302
  else {
303
- onError?.('005', errorMessages['error005']());
304
- currentExtent = clampedNodeExtent;
303
+ const nodeWidth = node.computed?.width;
304
+ const nodeHeight = node.computed?.height;
305
+ const parentWidth = parentNode?.computed?.width;
306
+ const parentHeight = parentNode?.computed?.height;
307
+ if (nodeWidth && nodeHeight && parentWidth && parentHeight) {
308
+ const currNodeOrigin = node.origin || nodeOrigin;
309
+ const extentX = parentX + nodeWidth * currNodeOrigin[0];
310
+ const extentY = parentY + nodeHeight * currNodeOrigin[1];
311
+ currentExtent = [
312
+ [extentX, extentY],
313
+ [extentX + parentWidth - nodeWidth, extentY + parentHeight - nodeHeight],
314
+ ];
315
+ }
305
316
  }
306
317
  }
307
- else if (node.extent && node.parentNode && node.extent !== 'parent') {
318
+ else if (parentNode && isCoordinateExtent(node.extent)) {
308
319
  currentExtent = [
309
- [node.extent[0][0] + parentPos.x, node.extent[0][1] + parentPos.y],
310
- [node.extent[1][0] + parentPos.x, node.extent[1][1] + parentPos.y],
320
+ [node.extent[0][0] + parentX, node.extent[0][1] + parentY],
321
+ [node.extent[1][0] + parentX, node.extent[1][1] + parentY],
311
322
  ];
312
323
  }
313
- const positionAbsolute = currentExtent && currentExtent !== 'parent'
324
+ const positionAbsolute = isCoordinateExtent(currentExtent)
314
325
  ? clampPosition(nextPosition, currentExtent)
315
326
  : nextPosition;
316
327
  return {
317
328
  position: {
318
- x: positionAbsolute.x - parentPos.x,
319
- y: positionAbsolute.y - parentPos.y,
329
+ x: positionAbsolute.x - parentX,
330
+ y: positionAbsolute.y - parentY,
320
331
  },
321
332
  positionAbsolute,
322
333
  };
@@ -503,6 +514,9 @@ const getViewportForBounds = (bounds, width, height, minZoom, maxZoom, padding)
503
514
  return { x, y, zoom: clampedZoom };
504
515
  };
505
516
  const isMacOs = () => typeof navigator !== 'undefined' && navigator?.userAgent?.indexOf('Mac') >= 0;
517
+ function isCoordinateExtent(extent) {
518
+ return extent !== undefined && extent !== 'parent';
519
+ }
506
520
 
507
521
  function getPointerPosition(event, { snapGrid = [0, 0], snapToGrid = false, transform }) {
508
522
  const { x, y } = getEventPosition(event);
@@ -1048,13 +1062,8 @@ function getHandle(bounds, handleId) {
1048
1062
  if (!bounds) {
1049
1063
  return null;
1050
1064
  }
1051
- if (bounds.length === 1 || !handleId) {
1052
- return bounds[0];
1053
- }
1054
- else if (handleId) {
1055
- return bounds.find((d) => d.id === handleId) || null;
1056
- }
1057
- return null;
1065
+ // if no handleId is given, we use the first handle, otherwise we check for the id
1066
+ return (!handleId ? bounds[0] : bounds.find((d) => d.id === handleId)) || null;
1058
1067
  }
1059
1068
 
1060
1069
  function getMarkerId(marker, id) {
@@ -1070,16 +1079,16 @@ function getMarkerId(marker, id) {
1070
1079
  .map((key) => `${key}=${marker[key]}`)
1071
1080
  .join('&')}`;
1072
1081
  }
1073
- function createMarkerIds(edges, { id, defaultColor }) {
1074
- const ids = [];
1082
+ function createMarkerIds(edges, { id, defaultColor, defaultMarkerStart, defaultMarkerEnd, }) {
1083
+ const ids = new Set();
1075
1084
  return edges
1076
1085
  .reduce((markers, edge) => {
1077
- [edge.markerStart, edge.markerEnd].forEach((marker) => {
1086
+ [edge.markerStart || defaultMarkerStart, edge.markerEnd || defaultMarkerEnd].forEach((marker) => {
1078
1087
  if (marker && typeof marker === 'object') {
1079
1088
  const markerId = getMarkerId(marker, id);
1080
- if (!ids.includes(markerId)) {
1089
+ if (!ids.has(markerId)) {
1081
1090
  markers.push({ id: markerId, color: marker.color || defaultColor, ...marker });
1082
- ids.push(markerId);
1091
+ ids.add(markerId);
1083
1092
  }
1084
1093
  }
1085
1094
  });
@@ -1201,7 +1210,7 @@ function calculateXYZPosition(node, nodes, nodeLookup, result, nodeOrigin) {
1201
1210
  return result;
1202
1211
  }
1203
1212
  const parentNode = nodeLookup.get(node.parentNode);
1204
- const parentNodePosition = getNodePositionWithOrigin(parentNode, parentNode?.origin || nodeOrigin);
1213
+ const { position: parentNodePosition } = getNodePositionWithOrigin(parentNode, parentNode?.origin || nodeOrigin);
1205
1214
  return calculateXYZPosition(parentNode, nodes, nodeLookup, {
1206
1215
  x: (result.x ?? 0) + parentNodePosition.x,
1207
1216
  y: (result.y ?? 0) + parentNodePosition.y,
@@ -1351,6 +1360,7 @@ function getEventHandlerParams({ nodeId, dragItems, nodeLookup, }) {
1351
1360
  return [nodeId ? nodesFromDragItems.find((n) => n.id === nodeId) : nodesFromDragItems[0], nodesFromDragItems];
1352
1361
  }
1353
1362
 
1363
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1354
1364
  function XYDrag({ domNode, onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragStop, }) {
1355
1365
  let lastPos = { x: null, y: null };
1356
1366
  let autoPanId = 0;
@@ -1364,12 +1374,12 @@ function XYDrag({ domNode, onNodeMouseDown, getStoreItems, onDragStart, onDrag,
1364
1374
  // public functions
1365
1375
  function update({ noDragClassName, handleSelector, domNode, isSelectable, nodeId }) {
1366
1376
  function updateNodes({ x, y }) {
1367
- const { nodes, nodeLookup, nodeExtent, snapGrid, snapToGrid, nodeOrigin, onNodeDrag, onSelectionDrag, onError, updateNodePositions, } = getStoreItems();
1377
+ const { nodeLookup, nodeExtent, snapGrid, snapToGrid, nodeOrigin, onNodeDrag, onSelectionDrag, onError, updateNodePositions, } = getStoreItems();
1368
1378
  lastPos = { x, y };
1369
1379
  let hasChange = false;
1370
1380
  let nodesBox = { x: 0, y: 0, x2: 0, y2: 0 };
1371
1381
  if (dragItems.length > 1 && nodeExtent) {
1372
- const rect = getNodesBounds(dragItems, nodeOrigin);
1382
+ const rect = getNodesBounds(dragItems, { nodeOrigin });
1373
1383
  nodesBox = rectToBox(rect);
1374
1384
  }
1375
1385
  dragItems = dragItems.map((n) => {
@@ -1391,11 +1401,18 @@ function XYDrag({ domNode, onNodeMouseDown, getStoreItems, onDragStart, onDrag,
1391
1401
  adjustedNodeExtent[1][1] =
1392
1402
  n.computed.positionAbsolute.y + (n.computed?.height ?? 0) - nodesBox.y2 + nodeExtent[1][1];
1393
1403
  }
1394
- const updatedPos = calcNextPosition(n, nextPosition, nodes, adjustedNodeExtent, nodeOrigin, onError);
1404
+ const { position, positionAbsolute } = calculateNodePosition({
1405
+ nodeId: n.id,
1406
+ nextPosition,
1407
+ nodeLookup,
1408
+ nodeExtent: adjustedNodeExtent,
1409
+ nodeOrigin,
1410
+ onError,
1411
+ });
1395
1412
  // we want to make sure that we only fire a change event when there is a change
1396
- hasChange = hasChange || n.position.x !== updatedPos.position.x || n.position.y !== updatedPos.position.y;
1397
- n.position = updatedPos.position;
1398
- n.computed.positionAbsolute = updatedPos.positionAbsolute;
1413
+ hasChange = hasChange || n.position.x !== position.x || n.position.y !== position.y;
1414
+ n.position = position;
1415
+ n.computed.positionAbsolute = positionAbsolute;
1399
1416
  return n;
1400
1417
  });
1401
1418
  if (!hasChange) {
@@ -1732,7 +1749,9 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
1732
1749
  // checks if and returns connection in fom of an object { source: 123, target: 312 }
1733
1750
  function isValidHandle(event, { handle, connectionMode, fromNodeId, fromHandleId, fromType, doc, lib, flowId, isValidConnection = alwaysValid, }) {
1734
1751
  const isTarget = fromType === 'target';
1735
- const handleDomNode = doc.querySelector(`.${lib}-flow__handle[data-id="${flowId}-${handle?.nodeId}-${handle?.id}-${handle?.type}"]`);
1752
+ const handleDomNode = handle
1753
+ ? doc.querySelector(`.${lib}-flow__handle[data-id="${flowId}-${handle?.nodeId}-${handle?.id}-${handle?.type}"]`)
1754
+ : null;
1736
1755
  const { x, y } = getEventPosition(event);
1737
1756
  const handleBelow = doc.elementFromPoint(x, y);
1738
1757
  // we always want to prioritize the handle below the mouse cursor over the closest distance handle,
@@ -2391,4 +2410,4 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange }) {
2391
2410
  };
2392
2411
  }
2393
2412
 
2394
- export { ConnectionLineType, ConnectionMode, MarkerType, PanOnScrollMode, Position, ResizeControlVariant, SelectionMode, XYDrag, XYHandle, XYMinimap, XYPanZoom, XYResizer, XY_RESIZER_HANDLE_POSITIONS, XY_RESIZER_LINE_POSITIONS, addEdge, adoptUserProvidedNodes, areConnectionMapsEqual, boxToRect, calcAutoPan, calcNextPosition, clamp, clampPosition, createMarkerIds, devWarn, elementSelectionKeys, errorMessages, fitView, getBezierEdgeCenter, getBezierPath, getBoundsOfBoxes, getBoundsOfRects, getConnectedEdges, getDimensions, getEdgeCenter, getEdgePosition, getElementsToRemove, getElevatedEdgeZIndex, getEventPosition, getHandleBounds, getHostForElement, getIncomers, getMarkerId, getNodePositionWithOrigin, getNodeToolbarTransform, getNodesBounds, getNodesInside, getOutgoers, getOverlappingArea, getPointerPosition, getPositionWithOrigin, getSmoothStepPath, getStraightPath, getViewportForBounds, handleConnectionChange, infiniteExtent, internalsSymbol, isEdgeBase, isEdgeVisible, isInputDOMNode, isMacOs, isMouseEvent, isNodeBase, isNumeric, isRectObject, nodeToBox, nodeToRect, panBy, pointToRendererPoint, rectToBox, rendererPointToPoint, snapPosition, updateAbsolutePositions, updateConnectionLookup, updateEdge, updateNodeDimensions };
2413
+ export { ConnectionLineType, ConnectionMode, MarkerType, PanOnScrollMode, Position, ResizeControlVariant, SelectionMode, XYDrag, XYHandle, XYMinimap, XYPanZoom, XYResizer, XY_RESIZER_HANDLE_POSITIONS, XY_RESIZER_LINE_POSITIONS, addEdge, adoptUserProvidedNodes, areConnectionMapsEqual, boxToRect, calcAutoPan, calculateNodePosition, clamp, clampPosition, createMarkerIds, devWarn, elementSelectionKeys, errorMessages, fitView, getBezierEdgeCenter, getBezierPath, getBoundsOfBoxes, getBoundsOfRects, getConnectedEdges, getDimensions, getEdgeCenter, getEdgePosition, getElementsToRemove, getElevatedEdgeZIndex, getEventPosition, getHandleBounds, getHostForElement, getIncomers, getMarkerId, getNodePositionWithOrigin, getNodeToolbarTransform, getNodesBounds, getNodesInside, getOutgoers, getOverlappingArea, getPointerPosition, getPositionWithOrigin, getSmoothStepPath, getStraightPath, getViewportForBounds, handleConnectionChange, infiniteExtent, internalsSymbol, isCoordinateExtent, isEdgeBase, isEdgeVisible, isInputDOMNode, isMacOs, isMouseEvent, isNodeBase, isNumeric, isRectObject, nodeToBox, nodeToRect, panBy, pointToRendererPoint, rectToBox, rendererPointToPoint, snapPosition, updateAbsolutePositions, updateConnectionLookup, updateEdge, updateNodeDimensions };
@@ -163,8 +163,10 @@ const getIncomers = (node, nodes, edges) => {
163
163
  const getNodePositionWithOrigin = (node, nodeOrigin = [0, 0]) => {
164
164
  if (!node) {
165
165
  return {
166
- x: 0,
167
- y: 0,
166
+ position: {
167
+ x: 0,
168
+ y: 0,
169
+ },
168
170
  positionAbsolute: {
169
171
  x: 0,
170
172
  y: 0,
@@ -178,7 +180,7 @@ const getNodePositionWithOrigin = (node, nodeOrigin = [0, 0]) => {
178
180
  y: node.position.y - offsetY,
179
181
  };
180
182
  return {
181
- ...position,
183
+ position,
182
184
  positionAbsolute: node.computed?.positionAbsolute
183
185
  ? {
184
186
  x: node.computed.positionAbsolute.x - offsetX,
@@ -192,18 +194,18 @@ const getNodePositionWithOrigin = (node, nodeOrigin = [0, 0]) => {
192
194
  * @public
193
195
  * @remarks Useful when combined with {@link getViewportForBounds} to calculate the correct transform to fit the given nodes in a viewport.
194
196
  * @param nodes - Nodes to calculate the bounds for
195
- * @param nodeOrigin - Origin of the nodes: [0, 0] - top left, [0.5, 0.5] - center
197
+ * @param params.nodeOrigin - Origin of the nodes: [0, 0] - top left, [0.5, 0.5] - center
198
+ * @param params.useRelativePosition - Whether to use the relative or absolute node positions
196
199
  * @returns Bounding box enclosing all nodes
197
200
  */
198
- const getNodesBounds = (nodes, nodeOrigin = [0, 0]) => {
201
+ const getNodesBounds = (nodes, params = { nodeOrigin: [0, 0], useRelativePosition: false }) => {
199
202
  if (nodes.length === 0) {
200
203
  return { x: 0, y: 0, width: 0, height: 0 };
201
204
  }
202
205
  const box = nodes.reduce((currBox, node) => {
203
- const { x, y } = getNodePositionWithOrigin(node, node.origin || nodeOrigin);
206
+ const nodePos = getNodePositionWithOrigin(node, node.origin || params.nodeOrigin);
204
207
  return getBoundsOfBoxes(currBox, rectToBox({
205
- x,
206
- y,
208
+ ...nodePos[params.useRelativePosition ? 'position' : 'positionAbsolute'],
207
209
  width: node.computed?.width ?? node.width ?? 0,
208
210
  height: node.computed?.height ?? node.height ?? 0,
209
211
  }));
@@ -259,64 +261,73 @@ function fitView({ nodes, width, height, panZoom, minZoom, maxZoom, nodeOrigin =
259
261
  return isVisible;
260
262
  });
261
263
  if (filteredNodes.length > 0) {
262
- const bounds = getNodesBounds(filteredNodes, nodeOrigin);
264
+ const bounds = getNodesBounds(filteredNodes, { nodeOrigin });
263
265
  const viewport = getViewportForBounds(bounds, width, height, options?.minZoom ?? minZoom, options?.maxZoom ?? maxZoom, options?.padding ?? 0.1);
264
266
  panZoom.setViewport(viewport, { duration: options?.duration });
265
267
  return true;
266
268
  }
267
269
  return false;
268
270
  }
271
+ /**
272
+ * This function clamps the passed extend by the node's width and height.
273
+ * This is needed to prevent the node from being dragged outside of its extent.
274
+ *
275
+ * @param node
276
+ * @param extent
277
+ * @returns
278
+ */
269
279
  function clampNodeExtent(node, extent) {
270
280
  if (!extent || extent === 'parent') {
271
281
  return extent;
272
282
  }
273
283
  return [extent[0], [extent[1][0] - (node.computed?.width ?? 0), extent[1][1] - (node.computed?.height ?? 0)]];
274
284
  }
275
- function calcNextPosition(node, nextPosition, nodes, nodeExtent, nodeOrigin = [0, 0], onError) {
276
- const clampedNodeExtent = clampNodeExtent(node, node.extent || nodeExtent);
277
- let currentExtent = clampedNodeExtent;
278
- let parentNode = null;
279
- let parentPos = { x: 0, y: 0 };
280
- if (node.parentNode) {
281
- parentNode = nodes.find((n) => n.id === node.parentNode) || null;
282
- parentPos = parentNode
283
- ? getNodePositionWithOrigin(parentNode, parentNode.origin || nodeOrigin).positionAbsolute
284
- : parentPos;
285
- }
285
+ /**
286
+ * This function calculates the next position of a node, taking into account the node's extent, parent node, and origin.
287
+ *
288
+ * @internal
289
+ * @returns position, positionAbsolute
290
+ */
291
+ function calculateNodePosition({ nodeId, nextPosition, nodeLookup, nodeOrigin = [0, 0], nodeExtent, onError, }) {
292
+ const node = nodeLookup.get(nodeId);
293
+ const parentNode = node.parentNode ? nodeLookup.get(node.parentNode) : undefined;
294
+ const { x: parentX, y: parentY } = parentNode
295
+ ? getNodePositionWithOrigin(parentNode, parentNode.origin || nodeOrigin).positionAbsolute
296
+ : { x: 0, y: 0 };
297
+ let currentExtent = clampNodeExtent(node, node.extent || nodeExtent);
286
298
  if (node.extent === 'parent' && !node.expandParent) {
287
- const nodeWidth = node.computed?.width;
288
- const nodeHeight = node.computed?.height;
289
- if (node.parentNode && nodeWidth && nodeHeight) {
290
- const currNodeOrigin = node.origin || nodeOrigin;
291
- currentExtent =
292
- parentNode && isNumeric(parentNode.computed?.width) && isNumeric(parentNode.computed?.height)
293
- ? [
294
- [parentPos.x + nodeWidth * currNodeOrigin[0], parentPos.y + nodeHeight * currNodeOrigin[1]],
295
- [
296
- parentPos.x + (parentNode.computed?.width ?? 0) - nodeWidth + nodeWidth * currNodeOrigin[0],
297
- parentPos.y + (parentNode.computed?.height ?? 0) - nodeHeight + nodeHeight * currNodeOrigin[1],
298
- ],
299
- ]
300
- : currentExtent;
299
+ if (!parentNode) {
300
+ onError?.('005', errorMessages['error005']());
301
301
  }
302
302
  else {
303
- onError?.('005', errorMessages['error005']());
304
- currentExtent = clampedNodeExtent;
303
+ const nodeWidth = node.computed?.width;
304
+ const nodeHeight = node.computed?.height;
305
+ const parentWidth = parentNode?.computed?.width;
306
+ const parentHeight = parentNode?.computed?.height;
307
+ if (nodeWidth && nodeHeight && parentWidth && parentHeight) {
308
+ const currNodeOrigin = node.origin || nodeOrigin;
309
+ const extentX = parentX + nodeWidth * currNodeOrigin[0];
310
+ const extentY = parentY + nodeHeight * currNodeOrigin[1];
311
+ currentExtent = [
312
+ [extentX, extentY],
313
+ [extentX + parentWidth - nodeWidth, extentY + parentHeight - nodeHeight],
314
+ ];
315
+ }
305
316
  }
306
317
  }
307
- else if (node.extent && node.parentNode && node.extent !== 'parent') {
318
+ else if (parentNode && isCoordinateExtent(node.extent)) {
308
319
  currentExtent = [
309
- [node.extent[0][0] + parentPos.x, node.extent[0][1] + parentPos.y],
310
- [node.extent[1][0] + parentPos.x, node.extent[1][1] + parentPos.y],
320
+ [node.extent[0][0] + parentX, node.extent[0][1] + parentY],
321
+ [node.extent[1][0] + parentX, node.extent[1][1] + parentY],
311
322
  ];
312
323
  }
313
- const positionAbsolute = currentExtent && currentExtent !== 'parent'
324
+ const positionAbsolute = isCoordinateExtent(currentExtent)
314
325
  ? clampPosition(nextPosition, currentExtent)
315
326
  : nextPosition;
316
327
  return {
317
328
  position: {
318
- x: positionAbsolute.x - parentPos.x,
319
- y: positionAbsolute.y - parentPos.y,
329
+ x: positionAbsolute.x - parentX,
330
+ y: positionAbsolute.y - parentY,
320
331
  },
321
332
  positionAbsolute,
322
333
  };
@@ -503,6 +514,9 @@ const getViewportForBounds = (bounds, width, height, minZoom, maxZoom, padding)
503
514
  return { x, y, zoom: clampedZoom };
504
515
  };
505
516
  const isMacOs = () => typeof navigator !== 'undefined' && navigator?.userAgent?.indexOf('Mac') >= 0;
517
+ function isCoordinateExtent(extent) {
518
+ return extent !== undefined && extent !== 'parent';
519
+ }
506
520
 
507
521
  function getPointerPosition(event, { snapGrid = [0, 0], snapToGrid = false, transform }) {
508
522
  const { x, y } = getEventPosition(event);
@@ -1048,13 +1062,8 @@ function getHandle(bounds, handleId) {
1048
1062
  if (!bounds) {
1049
1063
  return null;
1050
1064
  }
1051
- if (bounds.length === 1 || !handleId) {
1052
- return bounds[0];
1053
- }
1054
- else if (handleId) {
1055
- return bounds.find((d) => d.id === handleId) || null;
1056
- }
1057
- return null;
1065
+ // if no handleId is given, we use the first handle, otherwise we check for the id
1066
+ return (!handleId ? bounds[0] : bounds.find((d) => d.id === handleId)) || null;
1058
1067
  }
1059
1068
 
1060
1069
  function getMarkerId(marker, id) {
@@ -1070,16 +1079,16 @@ function getMarkerId(marker, id) {
1070
1079
  .map((key) => `${key}=${marker[key]}`)
1071
1080
  .join('&')}`;
1072
1081
  }
1073
- function createMarkerIds(edges, { id, defaultColor }) {
1074
- const ids = [];
1082
+ function createMarkerIds(edges, { id, defaultColor, defaultMarkerStart, defaultMarkerEnd, }) {
1083
+ const ids = new Set();
1075
1084
  return edges
1076
1085
  .reduce((markers, edge) => {
1077
- [edge.markerStart, edge.markerEnd].forEach((marker) => {
1086
+ [edge.markerStart || defaultMarkerStart, edge.markerEnd || defaultMarkerEnd].forEach((marker) => {
1078
1087
  if (marker && typeof marker === 'object') {
1079
1088
  const markerId = getMarkerId(marker, id);
1080
- if (!ids.includes(markerId)) {
1089
+ if (!ids.has(markerId)) {
1081
1090
  markers.push({ id: markerId, color: marker.color || defaultColor, ...marker });
1082
- ids.push(markerId);
1091
+ ids.add(markerId);
1083
1092
  }
1084
1093
  }
1085
1094
  });
@@ -1201,7 +1210,7 @@ function calculateXYZPosition(node, nodes, nodeLookup, result, nodeOrigin) {
1201
1210
  return result;
1202
1211
  }
1203
1212
  const parentNode = nodeLookup.get(node.parentNode);
1204
- const parentNodePosition = getNodePositionWithOrigin(parentNode, parentNode?.origin || nodeOrigin);
1213
+ const { position: parentNodePosition } = getNodePositionWithOrigin(parentNode, parentNode?.origin || nodeOrigin);
1205
1214
  return calculateXYZPosition(parentNode, nodes, nodeLookup, {
1206
1215
  x: (result.x ?? 0) + parentNodePosition.x,
1207
1216
  y: (result.y ?? 0) + parentNodePosition.y,
@@ -1351,6 +1360,7 @@ function getEventHandlerParams({ nodeId, dragItems, nodeLookup, }) {
1351
1360
  return [nodeId ? nodesFromDragItems.find((n) => n.id === nodeId) : nodesFromDragItems[0], nodesFromDragItems];
1352
1361
  }
1353
1362
 
1363
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1354
1364
  function XYDrag({ domNode, onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragStop, }) {
1355
1365
  let lastPos = { x: null, y: null };
1356
1366
  let autoPanId = 0;
@@ -1364,12 +1374,12 @@ function XYDrag({ domNode, onNodeMouseDown, getStoreItems, onDragStart, onDrag,
1364
1374
  // public functions
1365
1375
  function update({ noDragClassName, handleSelector, domNode, isSelectable, nodeId }) {
1366
1376
  function updateNodes({ x, y }) {
1367
- const { nodes, nodeLookup, nodeExtent, snapGrid, snapToGrid, nodeOrigin, onNodeDrag, onSelectionDrag, onError, updateNodePositions, } = getStoreItems();
1377
+ const { nodeLookup, nodeExtent, snapGrid, snapToGrid, nodeOrigin, onNodeDrag, onSelectionDrag, onError, updateNodePositions, } = getStoreItems();
1368
1378
  lastPos = { x, y };
1369
1379
  let hasChange = false;
1370
1380
  let nodesBox = { x: 0, y: 0, x2: 0, y2: 0 };
1371
1381
  if (dragItems.length > 1 && nodeExtent) {
1372
- const rect = getNodesBounds(dragItems, nodeOrigin);
1382
+ const rect = getNodesBounds(dragItems, { nodeOrigin });
1373
1383
  nodesBox = rectToBox(rect);
1374
1384
  }
1375
1385
  dragItems = dragItems.map((n) => {
@@ -1391,11 +1401,18 @@ function XYDrag({ domNode, onNodeMouseDown, getStoreItems, onDragStart, onDrag,
1391
1401
  adjustedNodeExtent[1][1] =
1392
1402
  n.computed.positionAbsolute.y + (n.computed?.height ?? 0) - nodesBox.y2 + nodeExtent[1][1];
1393
1403
  }
1394
- const updatedPos = calcNextPosition(n, nextPosition, nodes, adjustedNodeExtent, nodeOrigin, onError);
1404
+ const { position, positionAbsolute } = calculateNodePosition({
1405
+ nodeId: n.id,
1406
+ nextPosition,
1407
+ nodeLookup,
1408
+ nodeExtent: adjustedNodeExtent,
1409
+ nodeOrigin,
1410
+ onError,
1411
+ });
1395
1412
  // we want to make sure that we only fire a change event when there is a change
1396
- hasChange = hasChange || n.position.x !== updatedPos.position.x || n.position.y !== updatedPos.position.y;
1397
- n.position = updatedPos.position;
1398
- n.computed.positionAbsolute = updatedPos.positionAbsolute;
1413
+ hasChange = hasChange || n.position.x !== position.x || n.position.y !== position.y;
1414
+ n.position = position;
1415
+ n.computed.positionAbsolute = positionAbsolute;
1399
1416
  return n;
1400
1417
  });
1401
1418
  if (!hasChange) {
@@ -1732,7 +1749,9 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
1732
1749
  // checks if and returns connection in fom of an object { source: 123, target: 312 }
1733
1750
  function isValidHandle(event, { handle, connectionMode, fromNodeId, fromHandleId, fromType, doc, lib, flowId, isValidConnection = alwaysValid, }) {
1734
1751
  const isTarget = fromType === 'target';
1735
- const handleDomNode = doc.querySelector(`.${lib}-flow__handle[data-id="${flowId}-${handle?.nodeId}-${handle?.id}-${handle?.type}"]`);
1752
+ const handleDomNode = handle
1753
+ ? doc.querySelector(`.${lib}-flow__handle[data-id="${flowId}-${handle?.nodeId}-${handle?.id}-${handle?.type}"]`)
1754
+ : null;
1736
1755
  const { x, y } = getEventPosition(event);
1737
1756
  const handleBelow = doc.elementFromPoint(x, y);
1738
1757
  // we always want to prioritize the handle below the mouse cursor over the closest distance handle,
@@ -2391,4 +2410,4 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange }) {
2391
2410
  };
2392
2411
  }
2393
2412
 
2394
- export { ConnectionLineType, ConnectionMode, MarkerType, PanOnScrollMode, Position, ResizeControlVariant, SelectionMode, XYDrag, XYHandle, XYMinimap, XYPanZoom, XYResizer, XY_RESIZER_HANDLE_POSITIONS, XY_RESIZER_LINE_POSITIONS, addEdge, adoptUserProvidedNodes, areConnectionMapsEqual, boxToRect, calcAutoPan, calcNextPosition, clamp, clampPosition, createMarkerIds, devWarn, elementSelectionKeys, errorMessages, fitView, getBezierEdgeCenter, getBezierPath, getBoundsOfBoxes, getBoundsOfRects, getConnectedEdges, getDimensions, getEdgeCenter, getEdgePosition, getElementsToRemove, getElevatedEdgeZIndex, getEventPosition, getHandleBounds, getHostForElement, getIncomers, getMarkerId, getNodePositionWithOrigin, getNodeToolbarTransform, getNodesBounds, getNodesInside, getOutgoers, getOverlappingArea, getPointerPosition, getPositionWithOrigin, getSmoothStepPath, getStraightPath, getViewportForBounds, handleConnectionChange, infiniteExtent, internalsSymbol, isEdgeBase, isEdgeVisible, isInputDOMNode, isMacOs, isMouseEvent, isNodeBase, isNumeric, isRectObject, nodeToBox, nodeToRect, panBy, pointToRendererPoint, rectToBox, rendererPointToPoint, snapPosition, updateAbsolutePositions, updateConnectionLookup, updateEdge, updateNodeDimensions };
2413
+ export { ConnectionLineType, ConnectionMode, MarkerType, PanOnScrollMode, Position, ResizeControlVariant, SelectionMode, XYDrag, XYHandle, XYMinimap, XYPanZoom, XYResizer, XY_RESIZER_HANDLE_POSITIONS, XY_RESIZER_LINE_POSITIONS, addEdge, adoptUserProvidedNodes, areConnectionMapsEqual, boxToRect, calcAutoPan, calculateNodePosition, clamp, clampPosition, createMarkerIds, devWarn, elementSelectionKeys, errorMessages, fitView, getBezierEdgeCenter, getBezierPath, getBoundsOfBoxes, getBoundsOfRects, getConnectedEdges, getDimensions, getEdgeCenter, getEdgePosition, getElementsToRemove, getElevatedEdgeZIndex, getEventPosition, getHandleBounds, getHostForElement, getIncomers, getMarkerId, getNodePositionWithOrigin, getNodeToolbarTransform, getNodesBounds, getNodesInside, getOutgoers, getOverlappingArea, getPointerPosition, getPositionWithOrigin, getSmoothStepPath, getStraightPath, getViewportForBounds, handleConnectionChange, infiniteExtent, internalsSymbol, isCoordinateExtent, isEdgeBase, isEdgeVisible, isInputDOMNode, isMacOs, isMouseEvent, isNodeBase, isNumeric, isRectObject, nodeToBox, nodeToRect, panBy, pointToRendererPoint, rectToBox, rendererPointToPoint, snapPosition, updateAbsolutePositions, updateConnectionLookup, updateEdge, updateNodeDimensions };
@@ -106,7 +106,7 @@ export type UpdateConnection = (params: {
106
106
  export type ColorModeClass = 'light' | 'dark';
107
107
  export type ColorMode = ColorModeClass | 'system';
108
108
  export type ConnectionLookup = Map<string, Map<string, Connection>>;
109
- export type OnBeforeDelete = <NodeType extends NodeBase = NodeBase, EdgeType extends EdgeBase = EdgeBase>({ nodes, edges, }: {
109
+ export type OnBeforeDeleteBase<NodeType extends NodeBase = NodeBase, EdgeType extends EdgeBase = EdgeBase> = ({ nodes, edges, }: {
110
110
  nodes: NodeType[];
111
111
  edges: EdgeType[];
112
112
  }) => Promise<boolean | {
@@ -1 +1 @@
1
- {"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../src/types/general.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,IAAI,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAE/F,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,E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AAM,MAAM,mBAAmB,GAAG,CAChC,SAAS,EAAE,YAAY,EAAE,GAAG,QAAQ,EAAE,EACtC,eAAe,CAAC,EAAE,OAAO,EACzB,QAAQ,CAAC,EAAE,OAAO,KACf,IAAI,CAAC;AACV,MAAM,MAAM,KAAK,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC;AAEnD,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE;IACtC,kBAAkB,EAAE,UAAU,GAAG,IAAI,CAAC;IACtC,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC1C,qBAAqB,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC/C,mBAAmB,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAC9C,KAAK,IAAI,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,CAAC;AAC9C,MAAM,MAAM,SAAS,GAAG,cAAc,GAAG,QAAQ,CAAC;AAElD,MAAM,MAAM,gBAAgB,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;AAEpE,MAAM,MAAM,kBAAkB,CAAC,QAAQ,SAAS,QAAQ,GAAG,QAAQ,EAAE,QAAQ,SAAS,QAAQ,GAAG,QAAQ,IAAI,CAAC,EAC5G,KAAK,EACL,KAAK,GACN,EAAE;IACD,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,KAAK,OAAO,CAAC,OAAO,GAAG;IAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IAAC,KAAK,EAAE,QAAQ,EAAE,CAAA;CAAE,CAAC,CAAC"}
@@ -88,9 +88,9 @@ export type NodeProps<T = any> = {
88
88
  positionAbsoluteY: number;
89
89
  width?: number;
90
90
  height?: number;
91
- dragging: boolean;
92
- targetPosition?: Position;
93
- sourcePosition?: Position;
91
+ dragging: NodeBase['dragging'];
92
+ sourcePosition?: NodeBase['sourcePosition'];
93
+ targetPosition?: NodeBase['targetPosition'];
94
94
  };
95
95
  export type NodeHandleBounds = {
96
96
  source: HandleElement[] | null;
@@ -121,7 +121,6 @@ export type NodeDragItem = {
121
121
  expandParent?: boolean;
122
122
  };
123
123
  export type NodeOrigin = [number, number];
124
- export type OnNodeDrag = (event: MouseEvent, node: NodeBase, nodes: NodeBase[]) => void;
125
124
  export type OnSelectionDrag = (event: MouseEvent, nodes: NodeBase[]) => void;
126
125
  export type NodeHandle = Optional<HandleElement, 'width' | 'height'>;
127
126
  export type Align = 'center' | 'start' | 'end';
@@ -1 +1 @@
1
- {"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../src/types/nodes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,GAAG,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,IAAI;IACjF,0BAA0B;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,QAAQ,EAAE,UAAU,CAAC;IACrB,sCAAsC;IACtC,IAAI,EAAE,CAAC,CAAC;IACR,wCAAwC;IACxC,IAAI,CAAC,EAAE,CAAC,CAAC;IACT;;OAEG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B;;OAEG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;I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UAAU,CAAC;IACrB,QAAQ,EAAE;QACR,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,gBAAgB,EAAE,UAAU,CAAC;KAC9B,CAAC;IACF,MAAM,CAAC,EAAE,QAAQ,GAAG,gBAAgB,CAAC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE1C,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;AAE7E,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,EAAE,OAAO,GAAG,QAAQ,CAAC,CAAC;AAErE,MAAM,MAAM,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;AAE/C,MAAM,MAAM,UAAU,CAAC,QAAQ,SAAS,QAAQ,GAAG,QAAQ,IAAI,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC"}
@@ -44,4 +44,5 @@ export declare const rendererPointToPoint: ({ x, y }: XYPosition, [tx, ty, tScal
44
44
  */
45
45
  export declare const getViewportForBounds: (bounds: Rect, width: number, height: number, minZoom: number, maxZoom: number, padding: number) => Viewport;
46
46
  export declare const isMacOs: () => boolean;
47
+ export declare function isCoordinateExtent(extent?: CoordinateExtent | 'parent'): extent is CoordinateExtent;
47
48
  //# sourceMappingURL=general.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../src/utils/general.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,GAAG,EACH,IA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