@xyflow/system 0.0.52 → 0.0.54

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.
Files changed (40) hide show
  1. package/dist/esm/constants.d.ts.map +1 -1
  2. package/dist/esm/index.js +120 -12
  3. package/dist/esm/index.mjs +120 -12
  4. package/dist/esm/types/edges.d.ts +13 -16
  5. package/dist/esm/types/edges.d.ts.map +1 -1
  6. package/dist/esm/types/general.d.ts +31 -4
  7. package/dist/esm/types/general.d.ts.map +1 -1
  8. package/dist/esm/types/handles.d.ts +23 -9
  9. package/dist/esm/types/handles.d.ts.map +1 -1
  10. package/dist/esm/types/nodes.d.ts +24 -14
  11. package/dist/esm/types/nodes.d.ts.map +1 -1
  12. package/dist/esm/utils/general.d.ts +4 -4
  13. package/dist/esm/utils/general.d.ts.map +1 -1
  14. package/dist/esm/utils/graph.d.ts +1 -2
  15. package/dist/esm/utils/graph.d.ts.map +1 -1
  16. package/dist/esm/utils/store.d.ts +1 -1
  17. package/dist/esm/utils/store.d.ts.map +1 -1
  18. package/dist/esm/xypanzoom/eventhandler.d.ts.map +1 -1
  19. package/dist/esm/xyresizer/XYResizer.d.ts +1 -1
  20. package/dist/esm/xyresizer/XYResizer.d.ts.map +1 -1
  21. package/dist/umd/constants.d.ts.map +1 -1
  22. package/dist/umd/index.js +1 -1
  23. package/dist/umd/types/edges.d.ts +13 -16
  24. package/dist/umd/types/edges.d.ts.map +1 -1
  25. package/dist/umd/types/general.d.ts +31 -4
  26. package/dist/umd/types/general.d.ts.map +1 -1
  27. package/dist/umd/types/handles.d.ts +23 -9
  28. package/dist/umd/types/handles.d.ts.map +1 -1
  29. package/dist/umd/types/nodes.d.ts +24 -14
  30. package/dist/umd/types/nodes.d.ts.map +1 -1
  31. package/dist/umd/utils/general.d.ts +4 -4
  32. package/dist/umd/utils/general.d.ts.map +1 -1
  33. package/dist/umd/utils/graph.d.ts +1 -2
  34. package/dist/umd/utils/graph.d.ts.map +1 -1
  35. package/dist/umd/utils/store.d.ts +1 -1
  36. package/dist/umd/utils/store.d.ts.map +1 -1
  37. package/dist/umd/xypanzoom/eventhandler.d.ts.map +1 -1
  38. package/dist/umd/xyresizer/XYResizer.d.ts +1 -1
  39. package/dist/umd/xyresizer/XYResizer.d.ts.map +1 -1
  40. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEvD,eAAO,MAAM,aAAa;;;yBAKH,MAAM;;;;mBAIZ,MAAM;qBACJ,MAAM;2BAET,UAAU;YACoB,MAAM;sBAAgB,MAAM,GAAG,IAAI;sBAAgB,MAAM,GAAG,IAAI;;;yBAMvF,MAAM;mBACZ,MAAM;qBAEL,MAAM;;;CAMvB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,gBAG5B,CAAC;AAEF,eAAO,MAAM,oBAAoB,UAA2B,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEvD,eAAO,MAAM,aAAa;;;yBAKH,MAAM;;;;mBAIZ,MAAM;qBACJ,MAAM;2BAET,UAAU,sCACc;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;;yBAMzF,MAAM;mBACZ,MAAM;qBAEL,MAAM;;;CAMvB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,gBAG5B,CAAC;AAEF,eAAO,MAAM,oBAAoB,UAA2B,CAAC"}
package/dist/esm/index.js CHANGED
@@ -407,11 +407,12 @@ function getFitViewNodes(nodeLookup, options) {
407
407
  });
408
408
  return fitViewNodes;
409
409
  }
410
- async function fitView({ nodes, width, height, panZoom, minZoom, maxZoom }, options) {
410
+ async function fitViewport({ nodes, width, height, panZoom, minZoom, maxZoom }, options) {
411
411
  if (nodes.size === 0) {
412
- return Promise.resolve(false);
412
+ return Promise.resolve(true);
413
413
  }
414
- const bounds = getInternalNodesBounds(nodes);
414
+ const nodesToFit = getFitViewNodes(nodes, options);
415
+ const bounds = getInternalNodesBounds(nodesToFit);
415
416
  const viewport = getViewportForBounds(bounds, width, height, options?.minZoom ?? minZoom, options?.maxZoom ?? maxZoom, options?.padding ?? 0.1);
416
417
  await panZoom.setViewport(viewport, { duration: options?.duration });
417
418
  return Promise.resolve(true);
@@ -622,6 +623,85 @@ const rendererPointToPoint = ({ x, y }, [tx, ty, tScale]) => {
622
623
  y: y * tScale + ty,
623
624
  };
624
625
  };
626
+ /**
627
+ * Parses a single padding value to a number
628
+ * @internal
629
+ * @param padding - Padding to parse
630
+ * @param viewport - Width or height of the viewport
631
+ * @returns The padding in pixels
632
+ */
633
+ function parsePadding(padding, viewport) {
634
+ if (typeof padding === 'number') {
635
+ return Math.floor(viewport - viewport / (1 + padding));
636
+ }
637
+ if (typeof padding === 'string' && padding.endsWith('px')) {
638
+ const paddingValue = parseFloat(padding);
639
+ if (!Number.isNaN(paddingValue)) {
640
+ return Math.floor(paddingValue);
641
+ }
642
+ }
643
+ if (typeof padding === 'string' && padding.endsWith('%')) {
644
+ const paddingValue = parseFloat(padding);
645
+ if (!Number.isNaN(paddingValue)) {
646
+ return Math.floor(viewport * paddingValue * 0.01);
647
+ }
648
+ }
649
+ console.error(`[React Flow] The padding value "${padding}" is invalid. Please provide a number or a string with a valid unit (px or %).`);
650
+ return 0;
651
+ }
652
+ /**
653
+ * Parses the paddings to an object with top, right, bottom, left, x and y paddings
654
+ * @internal
655
+ * @param padding - Padding to parse
656
+ * @param width - Width of the viewport
657
+ * @param height - Height of the viewport
658
+ * @returns An object with the paddings in pixels
659
+ */
660
+ function parsePaddings(padding, width, height) {
661
+ if (typeof padding === 'string' || typeof padding === 'number') {
662
+ const paddingY = parsePadding(padding, height);
663
+ const paddingX = parsePadding(padding, width);
664
+ return {
665
+ top: paddingY,
666
+ right: paddingX,
667
+ bottom: paddingY,
668
+ left: paddingX,
669
+ x: paddingX * 2,
670
+ y: paddingY * 2,
671
+ };
672
+ }
673
+ if (typeof padding === 'object') {
674
+ const top = parsePadding(padding.top ?? padding.y ?? 0, height);
675
+ const bottom = parsePadding(padding.bottom ?? padding.y ?? 0, height);
676
+ const left = parsePadding(padding.left ?? padding.x ?? 0, width);
677
+ const right = parsePadding(padding.right ?? padding.x ?? 0, width);
678
+ return { top, right, bottom, left, x: left + right, y: top + bottom };
679
+ }
680
+ return { top: 0, right: 0, bottom: 0, left: 0, x: 0, y: 0 };
681
+ }
682
+ /**
683
+ * Calculates the resulting paddings if the new viewport is applied
684
+ * @internal
685
+ * @param bounds - Bounds to fit inside viewport
686
+ * @param x - X position of the viewport
687
+ * @param y - Y position of the viewport
688
+ * @param zoom - Zoom level of the viewport
689
+ * @param width - Width of the viewport
690
+ * @param height - Height of the viewport
691
+ * @returns An object with the minimum padding required to fit the bounds inside the viewport
692
+ */
693
+ function calculateAppliedPaddings(bounds, x, y, zoom, width, height) {
694
+ const { x: left, y: top } = rendererPointToPoint(bounds, [x, y, zoom]);
695
+ const { x: boundRight, y: boundBottom } = rendererPointToPoint({ x: bounds.x + bounds.width, y: bounds.y + bounds.height }, [x, y, zoom]);
696
+ const right = width - boundRight;
697
+ const bottom = height - boundBottom;
698
+ return {
699
+ left: Math.floor(left),
700
+ top: Math.floor(top),
701
+ right: Math.floor(right),
702
+ bottom: Math.floor(bottom),
703
+ };
704
+ }
625
705
  /**
626
706
  * Returns a viewport that encloses the given bounds with optional padding.
627
707
  * @public
@@ -635,19 +715,35 @@ const rendererPointToPoint = ({ x, y }, [tx, ty, tScale]) => {
635
715
  * @returns A transforned {@link Viewport} that encloses the given bounds which you can pass to e.g. {@link setViewport}
636
716
  * @example
637
717
  * const { x, y, zoom } = getViewportForBounds(
638
- *{ x: 0, y: 0, width: 100, height: 100},
639
- *1200, 800, 0.5, 2);
718
+ * { x: 0, y: 0, width: 100, height: 100},
719
+ * 1200, 800, 0.5, 2);
640
720
  */
641
721
  const getViewportForBounds = (bounds, width, height, minZoom, maxZoom, padding) => {
642
- const xZoom = width / (bounds.width * (1 + padding));
643
- const yZoom = height / (bounds.height * (1 + padding));
722
+ // First we resolve all the paddings to actual pixel values
723
+ const p = parsePaddings(padding, width, height);
724
+ const xZoom = (width - p.x) / bounds.width;
725
+ const yZoom = (height - p.y) / bounds.height;
726
+ // We calculate the new x, y, zoom for a centered view
644
727
  const zoom = Math.min(xZoom, yZoom);
645
728
  const clampedZoom = clamp(zoom, minZoom, maxZoom);
646
729
  const boundsCenterX = bounds.x + bounds.width / 2;
647
730
  const boundsCenterY = bounds.y + bounds.height / 2;
648
731
  const x = width / 2 - boundsCenterX * clampedZoom;
649
732
  const y = height / 2 - boundsCenterY * clampedZoom;
650
- return { x, y, zoom: clampedZoom };
733
+ // Then we calculate the minimum padding, to respect asymmetric paddings
734
+ const newPadding = calculateAppliedPaddings(bounds, x, y, clampedZoom, width, height);
735
+ // We only want to have an offset if the newPadding is smaller than the required padding
736
+ const offset = {
737
+ left: Math.min(newPadding.left - p.left, 0),
738
+ top: Math.min(newPadding.top - p.top, 0),
739
+ right: Math.min(newPadding.right - p.right, 0),
740
+ bottom: Math.min(newPadding.bottom - p.bottom, 0),
741
+ };
742
+ return {
743
+ x: x - offset.left + offset.right,
744
+ y: y - offset.top + offset.bottom,
745
+ zoom: clampedZoom,
746
+ };
651
747
  };
652
748
  const isMacOs = () => typeof navigator !== 'undefined' && navigator?.userAgent?.indexOf('Mac') >= 0;
653
749
  function isCoordinateExtent(extent) {
@@ -1391,6 +1487,7 @@ function updateAbsolutePositions(nodeLookup, parentLookup, options) {
1391
1487
  }
1392
1488
  function adoptUserNodes(nodes, nodeLookup, parentLookup, options) {
1393
1489
  const _options = mergeObjects(adoptUserNodesDefaultOptions, options);
1490
+ let nodesInitialized = true;
1394
1491
  const tmpLookup = new Map(nodeLookup);
1395
1492
  const selectedNodeZ = _options?.elevateNodesOnSelect ? 1000 : 0;
1396
1493
  nodeLookup.clear();
@@ -1421,10 +1518,15 @@ function adoptUserNodes(nodes, nodeLookup, parentLookup, options) {
1421
1518
  };
1422
1519
  nodeLookup.set(userNode.id, internalNode);
1423
1520
  }
1521
+ if ((!internalNode.measured || !internalNode.measured.width || !internalNode.measured.height) &&
1522
+ !internalNode.hidden) {
1523
+ nodesInitialized = false;
1524
+ }
1424
1525
  if (userNode.parentId) {
1425
1526
  updateChildNode(internalNode, nodeLookup, parentLookup, options);
1426
1527
  }
1427
1528
  }
1529
+ return nodesInitialized;
1428
1530
  }
1429
1531
  function updateParentLookup(node, parentLookup) {
1430
1532
  if (!node.parentId) {
@@ -2458,9 +2560,15 @@ function createPanOnScrollHandler({ zoomPanValues, noWheelClassName, d3Selection
2458
2560
  }
2459
2561
  function createZoomOnScrollHandler({ noWheelClassName, preventScrolling, d3ZoomHandler }) {
2460
2562
  return function (event, d) {
2563
+ const isWheel = event.type === 'wheel';
2461
2564
  // we still want to enable pinch zooming even if preventScrolling is set to false
2462
- const preventZoom = !preventScrolling && event.type === 'wheel' && !event.ctrlKey;
2463
- if (preventZoom || isWrappedWithClass(event, noWheelClassName)) {
2565
+ const preventZoom = !preventScrolling && isWheel && !event.ctrlKey;
2566
+ const hasNoWheelClass = isWrappedWithClass(event, noWheelClassName);
2567
+ // if user is pinch zooming above a nowheel element, we don't want the browser to zoom
2568
+ if (event.ctrlKey && isWheel && hasNoWheelClass) {
2569
+ event.preventDefault();
2570
+ }
2571
+ if (preventZoom || hasNoWheelClass) {
2464
2572
  return null;
2465
2573
  }
2466
2574
  event.preventDefault();
@@ -3173,7 +3281,7 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
3173
3281
  })
3174
3282
  .on('end', (event) => {
3175
3283
  onResizeEnd?.(event, { ...prevValues });
3176
- onEnd?.();
3284
+ onEnd?.({ ...prevValues });
3177
3285
  });
3178
3286
  selection.call(dragHandler);
3179
3287
  }
@@ -3186,4 +3294,4 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
3186
3294
  };
3187
3295
  }
3188
3296
 
3189
- export { ConnectionLineType, ConnectionMode, MarkerType, PanOnScrollMode, Position, ResizeControlVariant, SelectionMode, XYDrag, XYHandle, XYMinimap, XYPanZoom, XYResizer, XY_RESIZER_HANDLE_POSITIONS, XY_RESIZER_LINE_POSITIONS, addEdge, adoptUserNodes, areConnectionMapsEqual, areSetsEqual, boxToRect, calcAutoPan, calculateNodePosition, clamp, clampPosition, clampPositionToParent, createMarkerIds, devWarn, elementSelectionKeys, errorMessages, evaluateAbsolutePosition, fitView, getBezierEdgeCenter, getBezierPath, getBoundsOfBoxes, getBoundsOfRects, getConnectedEdges, getConnectionStatus, getDimensions, getEdgeCenter, getEdgePosition, getElementsToRemove, getElevatedEdgeZIndex, getEventPosition, getFitViewNodes, getHandleBounds, getHandlePosition, getHostForElement, getIncomers, getInternalNodesBounds, getMarkerId, getNodeDimensions, getNodePositionWithOrigin, getNodeToolbarTransform, getNodesBounds, getNodesInside, getOutgoers, getOverlappingArea, getPointerPosition, getSmoothStepPath, getStraightPath, getViewportForBounds, handleConnectionChange, handleExpandParent, infiniteExtent, initialConnection, isCoordinateExtent, isEdgeBase, isEdgeVisible, isInputDOMNode, isInternalNodeBase, isMacOs, isMouseEvent, isNodeBase, isNumeric, isRectObject, nodeHasDimensions, nodeToBox, nodeToRect, oppositePosition, panBy, pointToRendererPoint, reconnectEdge, rectToBox, rendererPointToPoint, shallowNodeData, snapPosition, updateAbsolutePositions, updateConnectionLookup, updateNodeInternals };
3297
+ export { ConnectionLineType, ConnectionMode, MarkerType, PanOnScrollMode, Position, ResizeControlVariant, SelectionMode, XYDrag, XYHandle, XYMinimap, XYPanZoom, XYResizer, XY_RESIZER_HANDLE_POSITIONS, XY_RESIZER_LINE_POSITIONS, addEdge, adoptUserNodes, areConnectionMapsEqual, areSetsEqual, boxToRect, calcAutoPan, calculateNodePosition, clamp, clampPosition, clampPositionToParent, createMarkerIds, devWarn, elementSelectionKeys, errorMessages, evaluateAbsolutePosition, fitViewport, getBezierEdgeCenter, getBezierPath, getBoundsOfBoxes, getBoundsOfRects, getConnectedEdges, getConnectionStatus, getDimensions, getEdgeCenter, getEdgePosition, getElementsToRemove, getElevatedEdgeZIndex, getEventPosition, getHandleBounds, getHandlePosition, getHostForElement, getIncomers, getInternalNodesBounds, getMarkerId, getNodeDimensions, getNodePositionWithOrigin, getNodeToolbarTransform, getNodesBounds, getNodesInside, getOutgoers, getOverlappingArea, getPointerPosition, getSmoothStepPath, getStraightPath, getViewportForBounds, handleConnectionChange, handleExpandParent, infiniteExtent, initialConnection, isCoordinateExtent, isEdgeBase, isEdgeVisible, isInputDOMNode, isInternalNodeBase, isMacOs, isMouseEvent, isNodeBase, isNumeric, isRectObject, nodeHasDimensions, nodeToBox, nodeToRect, oppositePosition, panBy, pointToRendererPoint, reconnectEdge, rectToBox, rendererPointToPoint, shallowNodeData, snapPosition, updateAbsolutePositions, updateConnectionLookup, updateNodeInternals };
@@ -407,11 +407,12 @@ function getFitViewNodes(nodeLookup, options) {
407
407
  });
408
408
  return fitViewNodes;
409
409
  }
410
- async function fitView({ nodes, width, height, panZoom, minZoom, maxZoom }, options) {
410
+ async function fitViewport({ nodes, width, height, panZoom, minZoom, maxZoom }, options) {
411
411
  if (nodes.size === 0) {
412
- return Promise.resolve(false);
412
+ return Promise.resolve(true);
413
413
  }
414
- const bounds = getInternalNodesBounds(nodes);
414
+ const nodesToFit = getFitViewNodes(nodes, options);
415
+ const bounds = getInternalNodesBounds(nodesToFit);
415
416
  const viewport = getViewportForBounds(bounds, width, height, options?.minZoom ?? minZoom, options?.maxZoom ?? maxZoom, options?.padding ?? 0.1);
416
417
  await panZoom.setViewport(viewport, { duration: options?.duration });
417
418
  return Promise.resolve(true);
@@ -622,6 +623,85 @@ const rendererPointToPoint = ({ x, y }, [tx, ty, tScale]) => {
622
623
  y: y * tScale + ty,
623
624
  };
624
625
  };
626
+ /**
627
+ * Parses a single padding value to a number
628
+ * @internal
629
+ * @param padding - Padding to parse
630
+ * @param viewport - Width or height of the viewport
631
+ * @returns The padding in pixels
632
+ */
633
+ function parsePadding(padding, viewport) {
634
+ if (typeof padding === 'number') {
635
+ return Math.floor(viewport - viewport / (1 + padding));
636
+ }
637
+ if (typeof padding === 'string' && padding.endsWith('px')) {
638
+ const paddingValue = parseFloat(padding);
639
+ if (!Number.isNaN(paddingValue)) {
640
+ return Math.floor(paddingValue);
641
+ }
642
+ }
643
+ if (typeof padding === 'string' && padding.endsWith('%')) {
644
+ const paddingValue = parseFloat(padding);
645
+ if (!Number.isNaN(paddingValue)) {
646
+ return Math.floor(viewport * paddingValue * 0.01);
647
+ }
648
+ }
649
+ console.error(`[React Flow] The padding value "${padding}" is invalid. Please provide a number or a string with a valid unit (px or %).`);
650
+ return 0;
651
+ }
652
+ /**
653
+ * Parses the paddings to an object with top, right, bottom, left, x and y paddings
654
+ * @internal
655
+ * @param padding - Padding to parse
656
+ * @param width - Width of the viewport
657
+ * @param height - Height of the viewport
658
+ * @returns An object with the paddings in pixels
659
+ */
660
+ function parsePaddings(padding, width, height) {
661
+ if (typeof padding === 'string' || typeof padding === 'number') {
662
+ const paddingY = parsePadding(padding, height);
663
+ const paddingX = parsePadding(padding, width);
664
+ return {
665
+ top: paddingY,
666
+ right: paddingX,
667
+ bottom: paddingY,
668
+ left: paddingX,
669
+ x: paddingX * 2,
670
+ y: paddingY * 2,
671
+ };
672
+ }
673
+ if (typeof padding === 'object') {
674
+ const top = parsePadding(padding.top ?? padding.y ?? 0, height);
675
+ const bottom = parsePadding(padding.bottom ?? padding.y ?? 0, height);
676
+ const left = parsePadding(padding.left ?? padding.x ?? 0, width);
677
+ const right = parsePadding(padding.right ?? padding.x ?? 0, width);
678
+ return { top, right, bottom, left, x: left + right, y: top + bottom };
679
+ }
680
+ return { top: 0, right: 0, bottom: 0, left: 0, x: 0, y: 0 };
681
+ }
682
+ /**
683
+ * Calculates the resulting paddings if the new viewport is applied
684
+ * @internal
685
+ * @param bounds - Bounds to fit inside viewport
686
+ * @param x - X position of the viewport
687
+ * @param y - Y position of the viewport
688
+ * @param zoom - Zoom level of the viewport
689
+ * @param width - Width of the viewport
690
+ * @param height - Height of the viewport
691
+ * @returns An object with the minimum padding required to fit the bounds inside the viewport
692
+ */
693
+ function calculateAppliedPaddings(bounds, x, y, zoom, width, height) {
694
+ const { x: left, y: top } = rendererPointToPoint(bounds, [x, y, zoom]);
695
+ const { x: boundRight, y: boundBottom } = rendererPointToPoint({ x: bounds.x + bounds.width, y: bounds.y + bounds.height }, [x, y, zoom]);
696
+ const right = width - boundRight;
697
+ const bottom = height - boundBottom;
698
+ return {
699
+ left: Math.floor(left),
700
+ top: Math.floor(top),
701
+ right: Math.floor(right),
702
+ bottom: Math.floor(bottom),
703
+ };
704
+ }
625
705
  /**
626
706
  * Returns a viewport that encloses the given bounds with optional padding.
627
707
  * @public
@@ -635,19 +715,35 @@ const rendererPointToPoint = ({ x, y }, [tx, ty, tScale]) => {
635
715
  * @returns A transforned {@link Viewport} that encloses the given bounds which you can pass to e.g. {@link setViewport}
636
716
  * @example
637
717
  * const { x, y, zoom } = getViewportForBounds(
638
- *{ x: 0, y: 0, width: 100, height: 100},
639
- *1200, 800, 0.5, 2);
718
+ * { x: 0, y: 0, width: 100, height: 100},
719
+ * 1200, 800, 0.5, 2);
640
720
  */
641
721
  const getViewportForBounds = (bounds, width, height, minZoom, maxZoom, padding) => {
642
- const xZoom = width / (bounds.width * (1 + padding));
643
- const yZoom = height / (bounds.height * (1 + padding));
722
+ // First we resolve all the paddings to actual pixel values
723
+ const p = parsePaddings(padding, width, height);
724
+ const xZoom = (width - p.x) / bounds.width;
725
+ const yZoom = (height - p.y) / bounds.height;
726
+ // We calculate the new x, y, zoom for a centered view
644
727
  const zoom = Math.min(xZoom, yZoom);
645
728
  const clampedZoom = clamp(zoom, minZoom, maxZoom);
646
729
  const boundsCenterX = bounds.x + bounds.width / 2;
647
730
  const boundsCenterY = bounds.y + bounds.height / 2;
648
731
  const x = width / 2 - boundsCenterX * clampedZoom;
649
732
  const y = height / 2 - boundsCenterY * clampedZoom;
650
- return { x, y, zoom: clampedZoom };
733
+ // Then we calculate the minimum padding, to respect asymmetric paddings
734
+ const newPadding = calculateAppliedPaddings(bounds, x, y, clampedZoom, width, height);
735
+ // We only want to have an offset if the newPadding is smaller than the required padding
736
+ const offset = {
737
+ left: Math.min(newPadding.left - p.left, 0),
738
+ top: Math.min(newPadding.top - p.top, 0),
739
+ right: Math.min(newPadding.right - p.right, 0),
740
+ bottom: Math.min(newPadding.bottom - p.bottom, 0),
741
+ };
742
+ return {
743
+ x: x - offset.left + offset.right,
744
+ y: y - offset.top + offset.bottom,
745
+ zoom: clampedZoom,
746
+ };
651
747
  };
652
748
  const isMacOs = () => typeof navigator !== 'undefined' && navigator?.userAgent?.indexOf('Mac') >= 0;
653
749
  function isCoordinateExtent(extent) {
@@ -1391,6 +1487,7 @@ function updateAbsolutePositions(nodeLookup, parentLookup, options) {
1391
1487
  }
1392
1488
  function adoptUserNodes(nodes, nodeLookup, parentLookup, options) {
1393
1489
  const _options = mergeObjects(adoptUserNodesDefaultOptions, options);
1490
+ let nodesInitialized = true;
1394
1491
  const tmpLookup = new Map(nodeLookup);
1395
1492
  const selectedNodeZ = _options?.elevateNodesOnSelect ? 1000 : 0;
1396
1493
  nodeLookup.clear();
@@ -1421,10 +1518,15 @@ function adoptUserNodes(nodes, nodeLookup, parentLookup, options) {
1421
1518
  };
1422
1519
  nodeLookup.set(userNode.id, internalNode);
1423
1520
  }
1521
+ if ((!internalNode.measured || !internalNode.measured.width || !internalNode.measured.height) &&
1522
+ !internalNode.hidden) {
1523
+ nodesInitialized = false;
1524
+ }
1424
1525
  if (userNode.parentId) {
1425
1526
  updateChildNode(internalNode, nodeLookup, parentLookup, options);
1426
1527
  }
1427
1528
  }
1529
+ return nodesInitialized;
1428
1530
  }
1429
1531
  function updateParentLookup(node, parentLookup) {
1430
1532
  if (!node.parentId) {
@@ -2458,9 +2560,15 @@ function createPanOnScrollHandler({ zoomPanValues, noWheelClassName, d3Selection
2458
2560
  }
2459
2561
  function createZoomOnScrollHandler({ noWheelClassName, preventScrolling, d3ZoomHandler }) {
2460
2562
  return function (event, d) {
2563
+ const isWheel = event.type === 'wheel';
2461
2564
  // we still want to enable pinch zooming even if preventScrolling is set to false
2462
- const preventZoom = !preventScrolling && event.type === 'wheel' && !event.ctrlKey;
2463
- if (preventZoom || isWrappedWithClass(event, noWheelClassName)) {
2565
+ const preventZoom = !preventScrolling && isWheel && !event.ctrlKey;
2566
+ const hasNoWheelClass = isWrappedWithClass(event, noWheelClassName);
2567
+ // if user is pinch zooming above a nowheel element, we don't want the browser to zoom
2568
+ if (event.ctrlKey && isWheel && hasNoWheelClass) {
2569
+ event.preventDefault();
2570
+ }
2571
+ if (preventZoom || hasNoWheelClass) {
2464
2572
  return null;
2465
2573
  }
2466
2574
  event.preventDefault();
@@ -3173,7 +3281,7 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
3173
3281
  })
3174
3282
  .on('end', (event) => {
3175
3283
  onResizeEnd?.(event, { ...prevValues });
3176
- onEnd?.();
3284
+ onEnd?.({ ...prevValues });
3177
3285
  });
3178
3286
  selection.call(dragHandler);
3179
3287
  }
@@ -3186,4 +3294,4 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
3186
3294
  };
3187
3295
  }
3188
3296
 
3189
- export { ConnectionLineType, ConnectionMode, MarkerType, PanOnScrollMode, Position, ResizeControlVariant, SelectionMode, XYDrag, XYHandle, XYMinimap, XYPanZoom, XYResizer, XY_RESIZER_HANDLE_POSITIONS, XY_RESIZER_LINE_POSITIONS, addEdge, adoptUserNodes, areConnectionMapsEqual, areSetsEqual, boxToRect, calcAutoPan, calculateNodePosition, clamp, clampPosition, clampPositionToParent, createMarkerIds, devWarn, elementSelectionKeys, errorMessages, evaluateAbsolutePosition, fitView, getBezierEdgeCenter, getBezierPath, getBoundsOfBoxes, getBoundsOfRects, getConnectedEdges, getConnectionStatus, getDimensions, getEdgeCenter, getEdgePosition, getElementsToRemove, getElevatedEdgeZIndex, getEventPosition, getFitViewNodes, getHandleBounds, getHandlePosition, getHostForElement, getIncomers, getInternalNodesBounds, getMarkerId, getNodeDimensions, getNodePositionWithOrigin, getNodeToolbarTransform, getNodesBounds, getNodesInside, getOutgoers, getOverlappingArea, getPointerPosition, getSmoothStepPath, getStraightPath, getViewportForBounds, handleConnectionChange, handleExpandParent, infiniteExtent, initialConnection, isCoordinateExtent, isEdgeBase, isEdgeVisible, isInputDOMNode, isInternalNodeBase, isMacOs, isMouseEvent, isNodeBase, isNumeric, isRectObject, nodeHasDimensions, nodeToBox, nodeToRect, oppositePosition, panBy, pointToRendererPoint, reconnectEdge, rectToBox, rendererPointToPoint, shallowNodeData, snapPosition, updateAbsolutePositions, updateConnectionLookup, updateNodeInternals };
3297
+ export { ConnectionLineType, ConnectionMode, MarkerType, PanOnScrollMode, Position, ResizeControlVariant, SelectionMode, XYDrag, XYHandle, XYMinimap, XYPanZoom, XYResizer, XY_RESIZER_HANDLE_POSITIONS, XY_RESIZER_LINE_POSITIONS, addEdge, adoptUserNodes, areConnectionMapsEqual, areSetsEqual, boxToRect, calcAutoPan, calculateNodePosition, clamp, clampPosition, clampPositionToParent, createMarkerIds, devWarn, elementSelectionKeys, errorMessages, evaluateAbsolutePosition, fitViewport, getBezierEdgeCenter, getBezierPath, getBoundsOfBoxes, getBoundsOfRects, getConnectedEdges, getConnectionStatus, getDimensions, getEdgeCenter, getEdgePosition, getElementsToRemove, getElevatedEdgeZIndex, getEventPosition, getHandleBounds, getHandlePosition, getHostForElement, getIncomers, getInternalNodesBounds, getMarkerId, getNodeDimensions, getNodePositionWithOrigin, getNodeToolbarTransform, getNodesBounds, getNodesInside, getOutgoers, getOverlappingArea, getPointerPosition, getSmoothStepPath, getStraightPath, getViewportForBounds, handleConnectionChange, handleExpandParent, infiniteExtent, initialConnection, isCoordinateExtent, isEdgeBase, isEdgeVisible, isInputDOMNode, isInternalNodeBase, isMacOs, isMouseEvent, isNodeBase, isNumeric, isRectObject, nodeHasDimensions, nodeToBox, nodeToRect, oppositePosition, panBy, pointToRendererPoint, reconnectEdge, rectToBox, rendererPointToPoint, shallowNodeData, snapPosition, updateAbsolutePositions, updateConnectionLookup, updateNodeInternals };
@@ -1,43 +1,40 @@
1
1
  import { Position } from './utils';
2
2
  export type EdgeBase<EdgeData extends Record<string, unknown> = Record<string, unknown>, EdgeType extends string | undefined = string | undefined> = {
3
- /** Unique id of an edge */
3
+ /** Unique id of an edge. */
4
4
  id: string;
5
- /** Type of an edge defined in edgeTypes */
5
+ /** Type of edge defined in `edgeTypes`. */
6
6
  type?: EdgeType;
7
- /** Id of source node */
7
+ /** Id of source node. */
8
8
  source: string;
9
- /** Id of target node */
9
+ /** Id of target node. */
10
10
  target: string;
11
- /**
12
- * Id of source handle
13
- * only needed if there are multiple handles per node
14
- */
11
+ /** Id of source handle, only needed if there are multiple handles per node. */
15
12
  sourceHandle?: string | null;
16
- /**
17
- * Id of target handle
18
- * only needed if there are multiple handles per node
19
- */
13
+ /** Id of target handle, only needed if there are multiple handles per node. */
20
14
  targetHandle?: string | null;
21
15
  animated?: boolean;
22
16
  hidden?: boolean;
23
17
  deletable?: boolean;
24
18
  selectable?: boolean;
25
- /** Arbitrary data passed to an edge */
19
+ /** Arbitrary data passed to an edge. */
26
20
  data?: EdgeData;
27
21
  selected?: boolean;
28
22
  /**
29
- * Set the marker on the beginning of an edge
23
+ * Set the marker on the beginning of an edge.
30
24
  * @example 'arrow', 'arrowclosed' or custom marker
31
25
  */
32
26
  markerStart?: EdgeMarkerType;
33
27
  /**
34
- * Set the marker on the end of an edge
28
+ * Set the marker on the end of an edge.
35
29
  * @example 'arrow', 'arrowclosed' or custom marker
36
30
  */
37
31
  markerEnd?: EdgeMarkerType;
38
32
  zIndex?: number;
39
33
  ariaLabel?: string;
40
- /** Padding around the edge where interaction is still possible */
34
+ /**
35
+ * ReactFlow renders an invisible path around each edge to make them easier to click or tap on.
36
+ * This property sets the width of that invisible path.
37
+ */
41
38
  interactionWidth?: number;
42
39
  };
43
40
  export type SmoothStepPathOptions = {
@@ -1 +1 @@
1
- {"version":3,"file":"edges.d.ts","sourceRoot":"","sources":["../../src/types/edges.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,MAAM,MAAM,QAAQ,CAClB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE,QAAQ,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,IACtD;IACF,2BAA2B;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,2CAA2C;IAC3C,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uCAAuC;IACvC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,MAAM,CAA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;IACf,WAAW,gBAAgB;CAC5B;AAED,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG;IACrC,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,QAAQ,CAAC;IACzB,cAAc,EAAE,QAAQ,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,QAAQ,SAAS,QAAQ,GAAG,QAAQ,IAAI,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC"}
@@ -25,19 +25,23 @@ export type FitBounds = (bounds: Rect, options?: FitBoundsOptions) => Promise<bo
25
25
  * @public
26
26
  */
27
27
  export type Connection = {
28
+ /** The id of the node this connection originates from. */
28
29
  source: string;
30
+ /** The id of the node this connection terminates at. */
29
31
  target: string;
32
+ /** When not `null`, the id of the handle on the source node that this connection originates from. */
30
33
  sourceHandle: string | null;
34
+ /** When not `null`, the id of the handle on the target node that this connection terminates at. */
31
35
  targetHandle: string | null;
32
36
  };
33
37
  /**
34
- * The `HandleConnection` type is an extention of a basic [Connection](/api-reference/types/connection) that includes the `edgeId`.
38
+ * The `HandleConnection` type is an extension of a basic [Connection](/api-reference/types/connection) that includes the `edgeId`.
35
39
  */
36
40
  export type HandleConnection = Connection & {
37
41
  edgeId: string;
38
42
  };
39
43
  /**
40
- * The `NodeConnection` type is an extention of a basic [Connection](/api-reference/types/connection) that includes the `edgeId`.
44
+ * The `NodeConnection` type is an extension of a basic [Connection](/api-reference/types/connection) that includes the `edgeId`.
41
45
  *
42
46
  */
43
47
  export type NodeConnection = Connection & {
@@ -74,11 +78,21 @@ export type FitViewParamsBase<NodeType extends NodeBase> = {
74
78
  minZoom: number;
75
79
  maxZoom: number;
76
80
  };
81
+ export type PaddingUnit = 'px' | '%';
82
+ export type PaddingWithUnit = `${number}${PaddingUnit}` | number;
83
+ export type Padding = PaddingWithUnit | {
84
+ top?: PaddingWithUnit;
85
+ right?: PaddingWithUnit;
86
+ bottom?: PaddingWithUnit;
87
+ left?: PaddingWithUnit;
88
+ x?: PaddingWithUnit;
89
+ y?: PaddingWithUnit;
90
+ };
77
91
  /**
78
92
  * @inline
79
93
  */
80
94
  export type FitViewOptionsBase<NodeType extends NodeBase = NodeBase> = {
81
- padding?: number;
95
+ padding?: Padding;
82
96
  includeHiddenNodes?: boolean;
83
97
  minZoom?: number;
84
98
  maxZoom?: number;
@@ -143,7 +157,7 @@ export type UpdateNodeInternals = (nodeId: string | string[]) => void;
143
157
  *
144
158
  * @public
145
159
  */
146
- export type PanelPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
160
+ export type PanelPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'center-left' | 'center-right';
147
161
  export type ProOptions = {
148
162
  account?: string;
149
163
  hideAttribution: boolean;
@@ -174,15 +188,28 @@ export type NoConnection = {
174
188
  toNode: null;
175
189
  };
176
190
  export type ConnectionInProgress<NodeType extends InternalNodeBase = InternalNodeBase> = {
191
+ /** Indicates whether a connection is currently in progress. */
177
192
  inProgress: true;
193
+ /**
194
+ * If an ongoing connection is above a handle or inside the connection radius, this will be `true`
195
+ * or `false`, otherwise `null`.
196
+ */
178
197
  isValid: boolean | null;
198
+ /** Returns the xy start position or `null` if no connection is in progress. */
179
199
  from: XYPosition;
200
+ /** Returns the start handle or `null` if no connection is in progress. */
180
201
  fromHandle: Handle;
202
+ /** Returns the side (called position) of the start handle or `null` if no connection is in progress. */
181
203
  fromPosition: Position;
204
+ /** Returns the start node or `null` if no connection is in progress. */
182
205
  fromNode: NodeType;
206
+ /** Returns the xy end position or `null` if no connection is in progress. */
183
207
  to: XYPosition;
208
+ /** Returns the end handle or `null` if no connection is in progress. */
184
209
  toHandle: Handle | null;
210
+ /** Returns the side (called position) of the end handle or `null` if no connection is in progress. */
185
211
  toPosition: Position;
212
+ /** Returns the end node or `null` if no connection is in progress. */
186
213
  toNode: NodeType | null;
187
214
  };
188
215
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../src/types/general.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAK5C,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAE9B,MAAM,MAAM,OAAO,GAAG,CAAC,QAAQ,EAAE,UAAU,KAAK,UAAU,CAAC;AAE3D,MAAM,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI,EAAE,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;AACzF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AACjC,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,CAAC,EAAE,6BAA6B,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AACtF,MAAM,MAAM,MAAM,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,6BAA6B,KAAK,OAAO,CA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AClB,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"}
@@ -12,29 +12,43 @@ export type Handle = {
12
12
  };
13
13
  export type HandleProps = {
14
14
  /**
15
- * Type of the handle
15
+ * Type of the handle.
16
+ * @default "source"
16
17
  * @example HandleType.Source, HandleType.Target
17
18
  */
18
19
  type: HandleType;
19
20
  /**
20
- * Position of the handle
21
- * @example Position.TopLeft, Position.TopRight,
22
- * Position.BottomLeft, Position.BottomRight
21
+ * The position of the handle relative to the node. In a horizontal flow source handles are
22
+ * typically `Position.Right` and in a vertical flow they are typically `Position.Top`.
23
+ * @default Position.Top
24
+ * @example Position.TopLeft, Position.TopRight, Position.BottomLeft, Position.BottomRight
23
25
  */
24
26
  position: Position;
25
- /** Should you be able to connect to/from this handle */
27
+ /**
28
+ * Should you be able to connect to/from this handle.
29
+ * @default true
30
+ */
26
31
  isConnectable?: boolean;
27
- /** Should you be able to connect from this handle */
32
+ /**
33
+ * Dictates whether a connection can start from this handle.
34
+ * @default true
35
+ */
28
36
  isConnectableStart?: boolean;
29
- /** Should you be able to connect to this handle */
37
+ /**
38
+ * Dictates whether a connection can end on this handle.
39
+ * @default true
40
+ */
30
41
  isConnectableEnd?: boolean;
31
42
  /**
32
- * Callback if connection is valid
43
+ * Called when a connection is dragged to this handle. You can use this callback to perform some
44
+ * custom validation logic based on the connection target and source, for example. Where possible,
45
+ * we recommend you move this logic to the `isValidConnection` prop on the main ReactFlow
46
+ * component for performance reasons.
33
47
  * @remarks connection becomes an edge if isValidConnection returns true
34
48
  */
35
49
  isValidConnection?: IsValidConnection;
36
50
  /**
37
- * Id of the handle
51
+ * Id of the handle.
38
52
  * @remarks optional if there is only one handle of this type
39
53
  */
40
54
  id?: string | null;