@xyflow/system 0.0.73 → 0.0.74

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
@@ -995,11 +995,11 @@ function getEdgeCenter({ sourceX, sourceY, targetX, targetY, }) {
995
995
  * By default, edges are rendered below nodes. This behaviour is different for edges that are
996
996
  * connected to nodes with a parent, as they are rendered above the parent node.
997
997
  */
998
- function getElevatedEdgeZIndex({ sourceNode, targetNode, selected = false, zIndex, elevateOnSelect = false, }) {
999
- if (zIndex !== undefined) {
998
+ function getElevatedEdgeZIndex({ sourceNode, targetNode, selected = false, zIndex = 0, elevateOnSelect = false, zIndexMode = 'basic', }) {
999
+ if (zIndexMode === 'manual') {
1000
1000
  return zIndex;
1001
1001
  }
1002
- const edgeZ = elevateOnSelect && selected ? 1000 : 0;
1002
+ const edgeZ = elevateOnSelect && selected ? zIndex + 1000 : zIndex;
1003
1003
  const nodeZ = Math.max(sourceNode.parentId || (elevateOnSelect && sourceNode.selected) ? sourceNode.internals.z : 0, targetNode.parentId || (elevateOnSelect && targetNode.selected) ? targetNode.internals.z : 0);
1004
1004
  return edgeZ + nodeZ;
1005
1005
  }
@@ -1019,6 +1019,12 @@ function isEdgeVisible({ sourceNode, targetNode, width, height, transform }) {
1019
1019
  };
1020
1020
  return getOverlappingArea(viewRect, boxToRect(edgeBox)) > 0;
1021
1021
  }
1022
+ /**
1023
+ * The default edge ID generator function. Generates an ID based on the source, target, and handles.
1024
+ * @public
1025
+ * @param params - The connection or edge to generate an ID for.
1026
+ * @returns The generated edge ID.
1027
+ */
1022
1028
  const getEdgeId = ({ source, sourceHandle, target, targetHandle }) => `xy-edge__${source}${sourceHandle || ''}-${target}${targetHandle || ''}`;
1023
1029
  const connectionExists = (edge, edges) => {
1024
1030
  return edges.some((el) => el.source === edge.source &&
@@ -1031,6 +1037,7 @@ const connectionExists = (edge, edges) => {
1031
1037
  * @public
1032
1038
  * @param edgeParams - Either an `Edge` or a `Connection` you want to add.
1033
1039
  * @param edges - The array of all current edges.
1040
+ * @param options - Optional configuration object.
1034
1041
  * @returns A new array of edges with the new edge added.
1035
1042
  *
1036
1043
  * @remarks If an edge with the same `target` and `source` already exists (and the same
@@ -1038,11 +1045,12 @@ const connectionExists = (edge, edges) => {
1038
1045
  *a new edge even if the `id` property is different.
1039
1046
  *
1040
1047
  */
1041
- const addEdge = (edgeParams, edges) => {
1048
+ const addEdge = (edgeParams, edges, options = {}) => {
1042
1049
  if (!edgeParams.source || !edgeParams.target) {
1043
1050
  devWarn('006', errorMessages['error006']());
1044
1051
  return edges;
1045
1052
  }
1053
+ const edgeIdGenerator = options.getEdgeId || getEdgeId;
1046
1054
  let edge;
1047
1055
  if (isEdgeBase(edgeParams)) {
1048
1056
  edge = { ...edgeParams };
@@ -1050,7 +1058,7 @@ const addEdge = (edgeParams, edges) => {
1050
1058
  else {
1051
1059
  edge = {
1052
1060
  ...edgeParams,
1053
- id: getEdgeId(edgeParams),
1061
+ id: edgeIdGenerator(edgeParams),
1054
1062
  };
1055
1063
  }
1056
1064
  if (connectionExists(edge, edges)) {
@@ -1091,10 +1099,11 @@ const reconnectEdge = (oldEdge, newConnection, edges, options = { shouldReplaceI
1091
1099
  devWarn('007', errorMessages['error007'](oldEdgeId));
1092
1100
  return edges;
1093
1101
  }
1102
+ const edgeIdGenerator = options.getEdgeId || getEdgeId;
1094
1103
  // Remove old edge and create the new edge with parameters of old edge.
1095
1104
  const edge = {
1096
1105
  ...rest,
1097
- id: options.shouldReplaceId ? getEdgeId(newConnection) : oldEdgeId,
1106
+ id: options.shouldReplaceId ? edgeIdGenerator(newConnection) : oldEdgeId,
1098
1107
  source: newConnection.source,
1099
1108
  target: newConnection.target,
1100
1109
  sourceHandle: newConnection.sourceHandle,
@@ -1528,6 +1537,7 @@ const defaultOptions = {
1528
1537
  nodeOrigin: [0, 0],
1529
1538
  nodeExtent: infiniteExtent,
1530
1539
  elevateNodesOnSelect: true,
1540
+ zIndexMode: 'basic',
1531
1541
  defaults: {},
1532
1542
  };
1533
1543
  const adoptUserNodesDefaultOptions = {
@@ -1587,12 +1597,15 @@ function parseHandles(userNode, internalNode) {
1587
1597
  target,
1588
1598
  };
1589
1599
  }
1590
- function adoptUserNodes(nodes, nodeLookup, parentLookup, options) {
1600
+ function isManualZIndexMode(zIndexMode) {
1601
+ return zIndexMode === 'manual';
1602
+ }
1603
+ function adoptUserNodes(nodes, nodeLookup, parentLookup, options = {}) {
1591
1604
  const _options = mergeObjects(adoptUserNodesDefaultOptions, options);
1592
- let rootParentIndex = { i: -1 };
1593
- let nodesInitialized = nodes.length > 0;
1605
+ const rootParentIndex = { i: 0 };
1594
1606
  const tmpLookup = new Map(nodeLookup);
1595
- const selectedNodeZ = _options?.elevateNodesOnSelect ? SELECTED_NODE_Z : 0;
1607
+ const selectedNodeZ = _options?.elevateNodesOnSelect && !isManualZIndexMode(_options.zIndexMode) ? SELECTED_NODE_Z : 0;
1608
+ let nodesInitialized = nodes.length > 0;
1596
1609
  nodeLookup.clear();
1597
1610
  parentLookup.clear();
1598
1611
  for (const userNode of nodes) {
@@ -1615,7 +1628,7 @@ function adoptUserNodes(nodes, nodeLookup, parentLookup, options) {
1615
1628
  positionAbsolute: clampedPosition,
1616
1629
  // if user re-initializes the node or removes `measured` for whatever reason, we reset the handleBounds so that the node gets re-measured
1617
1630
  handleBounds: parseHandles(userNode, internalNode),
1618
- z: calculateZ(userNode, selectedNodeZ),
1631
+ z: calculateZ(userNode, selectedNodeZ, _options.zIndexMode),
1619
1632
  userNode,
1620
1633
  },
1621
1634
  };
@@ -1649,7 +1662,7 @@ function updateParentLookup(node, parentLookup) {
1649
1662
  * Updates positionAbsolute and zIndex of a child node and the parentLookup.
1650
1663
  */
1651
1664
  function updateChildNode(node, nodeLookup, parentLookup, options, rootParentIndex) {
1652
- const { elevateNodesOnSelect, nodeOrigin, nodeExtent } = mergeObjects(defaultOptions, options);
1665
+ const { elevateNodesOnSelect, nodeOrigin, nodeExtent, zIndexMode } = mergeObjects(defaultOptions, options);
1653
1666
  const parentId = node.parentId;
1654
1667
  const parentNode = nodeLookup.get(parentId);
1655
1668
  if (!parentNode) {
@@ -1658,7 +1671,10 @@ function updateChildNode(node, nodeLookup, parentLookup, options, rootParentInde
1658
1671
  }
1659
1672
  updateParentLookup(node, parentLookup);
1660
1673
  // We just want to set the rootParentIndex for the first child
1661
- if (rootParentIndex && !parentNode.parentId && parentNode.internals.rootParentIndex === undefined) {
1674
+ if (rootParentIndex &&
1675
+ !parentNode.parentId &&
1676
+ parentNode.internals.rootParentIndex === undefined &&
1677
+ zIndexMode === 'auto') {
1662
1678
  parentNode.internals.rootParentIndex = ++rootParentIndex.i;
1663
1679
  parentNode.internals.z = parentNode.internals.z + rootParentIndex.i * ROOT_PARENT_Z_INCREMENT;
1664
1680
  }
@@ -1666,8 +1682,8 @@ function updateChildNode(node, nodeLookup, parentLookup, options, rootParentInde
1666
1682
  if (rootParentIndex && parentNode.internals.rootParentIndex !== undefined) {
1667
1683
  rootParentIndex.i = parentNode.internals.rootParentIndex;
1668
1684
  }
1669
- const selectedNodeZ = elevateNodesOnSelect ? SELECTED_NODE_Z : 0;
1670
- const { x, y, z } = calculateChildXYZ(node, parentNode, nodeOrigin, nodeExtent, selectedNodeZ);
1685
+ const selectedNodeZ = elevateNodesOnSelect && !isManualZIndexMode(zIndexMode) ? SELECTED_NODE_Z : 0;
1686
+ const { x, y, z } = calculateChildXYZ(node, parentNode, nodeOrigin, nodeExtent, selectedNodeZ, zIndexMode);
1671
1687
  const { positionAbsolute } = node.internals;
1672
1688
  const positionChanged = x !== positionAbsolute.x || y !== positionAbsolute.y;
1673
1689
  if (positionChanged || z !== node.internals.z) {
@@ -1682,10 +1698,14 @@ function updateChildNode(node, nodeLookup, parentLookup, options, rootParentInde
1682
1698
  });
1683
1699
  }
1684
1700
  }
1685
- function calculateZ(node, selectedNodeZ) {
1686
- return (isNumeric(node.zIndex) ? node.zIndex : 0) + (node.selected ? selectedNodeZ : 0);
1701
+ function calculateZ(node, selectedNodeZ, zIndexMode) {
1702
+ const zIndex = isNumeric(node.zIndex) ? node.zIndex : 0;
1703
+ if (isManualZIndexMode(zIndexMode)) {
1704
+ return zIndex;
1705
+ }
1706
+ return zIndex + (node.selected ? selectedNodeZ : 0);
1687
1707
  }
1688
- function calculateChildXYZ(childNode, parentNode, nodeOrigin, nodeExtent, selectedNodeZ) {
1708
+ function calculateChildXYZ(childNode, parentNode, nodeOrigin, nodeExtent, selectedNodeZ, zIndexMode) {
1689
1709
  const { x: parentX, y: parentY } = parentNode.internals.positionAbsolute;
1690
1710
  const childDimensions = getNodeDimensions(childNode);
1691
1711
  const positionWithOrigin = getNodePositionWithOrigin(childNode, nodeOrigin);
@@ -1696,7 +1716,7 @@ function calculateChildXYZ(childNode, parentNode, nodeOrigin, nodeExtent, select
1696
1716
  if (childNode.extent === 'parent') {
1697
1717
  absolutePosition = clampPositionToParent(absolutePosition, childDimensions, parentNode);
1698
1718
  }
1699
- const childZ = calculateZ(childNode, selectedNodeZ);
1719
+ const childZ = calculateZ(childNode, selectedNodeZ, zIndexMode);
1700
1720
  const parentZ = parentNode.internals.z ?? 0;
1701
1721
  return {
1702
1722
  x: absolutePosition.x,
@@ -1773,7 +1793,7 @@ function handleExpandParent(children, nodeLookup, parentLookup, nodeOrigin = [0,
1773
1793
  }
1774
1794
  return changes;
1775
1795
  }
1776
- function updateNodeInternals(updates, nodeLookup, parentLookup, domNode, nodeOrigin, nodeExtent) {
1796
+ function updateNodeInternals(updates, nodeLookup, parentLookup, domNode, nodeOrigin, nodeExtent, zIndexMode) {
1777
1797
  const viewportNode = domNode?.querySelector('.xyflow__viewport');
1778
1798
  let updatedInternals = false;
1779
1799
  if (!viewportNode) {
@@ -1829,7 +1849,7 @@ function updateNodeInternals(updates, nodeLookup, parentLookup, domNode, nodeOri
1829
1849
  };
1830
1850
  nodeLookup.set(node.id, newNode);
1831
1851
  if (node.parentId) {
1832
- updateChildNode(newNode, nodeLookup, parentLookup, { nodeOrigin });
1852
+ updateChildNode(newNode, nodeLookup, parentLookup, { nodeOrigin, zIndexMode });
1833
1853
  }
1834
1854
  updatedInternals = true;
1835
1855
  if (dimensionChanged) {
@@ -2400,15 +2420,15 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
2400
2420
  type: handleType,
2401
2421
  position: fromHandleInternal.position,
2402
2422
  };
2403
- const fromNodeInternal = nodeLookup.get(nodeId);
2404
- const from = getHandlePosition(fromNodeInternal, fromHandle, Position.Left, true);
2423
+ const fromInternalNode = nodeLookup.get(nodeId);
2424
+ const from = getHandlePosition(fromInternalNode, fromHandle, Position.Left, true);
2405
2425
  let previousConnection = {
2406
2426
  inProgress: true,
2407
2427
  isValid: null,
2408
2428
  from,
2409
2429
  fromHandle,
2410
2430
  fromPosition: fromHandle.position,
2411
- fromNode: fromNodeInternal,
2431
+ fromNode: fromInternalNode,
2412
2432
  to: position,
2413
2433
  toHandle: null,
2414
2434
  toPosition: oppositePosition[fromHandle.position],
@@ -2460,9 +2480,13 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
2460
2480
  resultHandleDomNode = result.handleDomNode;
2461
2481
  connection = result.connection;
2462
2482
  isValid = isConnectionValid(!!closestHandle, result.isValid);
2483
+ const fromInternalNode = nodeLookup.get(nodeId);
2484
+ const from = fromInternalNode
2485
+ ? getHandlePosition(fromInternalNode, fromHandle, Position.Left, true)
2486
+ : previousConnection.from;
2463
2487
  const newConnection = {
2464
- // from stays the same
2465
2488
  ...previousConnection,
2489
+ from,
2466
2490
  isValid,
2467
2491
  to: result.toHandle && isValid
2468
2492
  ? rendererPointToPoint({ x: result.toHandle.x, y: result.toHandle.y }, transform)
@@ -3486,4 +3510,4 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
3486
3510
  };
3487
3511
  }
3488
3512
 
3489
- 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, defaultAriaLabelConfig, devWarn, elementSelectionKeys, errorMessages, evaluateAbsolutePosition, fitViewport, getBezierEdgeCenter, getBezierPath, getBoundsOfBoxes, getBoundsOfRects, getConnectedEdges, getConnectionStatus, getDimensions, getEdgeCenter, getEdgePosition, getEdgeToolbarTransform, 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, mergeAriaLabelConfig, nodeHasDimensions, nodeToBox, nodeToRect, oppositePosition, panBy, pointToRendererPoint, reconnectEdge, rectToBox, rendererPointToPoint, shallowNodeData, snapPosition, updateAbsolutePositions, updateConnectionLookup, updateNodeInternals, withResolvers };
3513
+ 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, defaultAriaLabelConfig, devWarn, elementSelectionKeys, errorMessages, evaluateAbsolutePosition, fitViewport, getBezierEdgeCenter, getBezierPath, getBoundsOfBoxes, getBoundsOfRects, getConnectedEdges, getConnectionStatus, getDimensions, getEdgeCenter, getEdgeId, getEdgePosition, getEdgeToolbarTransform, 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, isManualZIndexMode, isMouseEvent, isNodeBase, isNumeric, isRectObject, mergeAriaLabelConfig, nodeHasDimensions, nodeToBox, nodeToRect, oppositePosition, panBy, pointToRendererPoint, reconnectEdge, rectToBox, rendererPointToPoint, shallowNodeData, snapPosition, updateAbsolutePositions, updateConnectionLookup, updateNodeInternals, withResolvers };
@@ -995,11 +995,11 @@ function getEdgeCenter({ sourceX, sourceY, targetX, targetY, }) {
995
995
  * By default, edges are rendered below nodes. This behaviour is different for edges that are
996
996
  * connected to nodes with a parent, as they are rendered above the parent node.
997
997
  */
998
- function getElevatedEdgeZIndex({ sourceNode, targetNode, selected = false, zIndex, elevateOnSelect = false, }) {
999
- if (zIndex !== undefined) {
998
+ function getElevatedEdgeZIndex({ sourceNode, targetNode, selected = false, zIndex = 0, elevateOnSelect = false, zIndexMode = 'basic', }) {
999
+ if (zIndexMode === 'manual') {
1000
1000
  return zIndex;
1001
1001
  }
1002
- const edgeZ = elevateOnSelect && selected ? 1000 : 0;
1002
+ const edgeZ = elevateOnSelect && selected ? zIndex + 1000 : zIndex;
1003
1003
  const nodeZ = Math.max(sourceNode.parentId || (elevateOnSelect && sourceNode.selected) ? sourceNode.internals.z : 0, targetNode.parentId || (elevateOnSelect && targetNode.selected) ? targetNode.internals.z : 0);
1004
1004
  return edgeZ + nodeZ;
1005
1005
  }
@@ -1019,6 +1019,12 @@ function isEdgeVisible({ sourceNode, targetNode, width, height, transform }) {
1019
1019
  };
1020
1020
  return getOverlappingArea(viewRect, boxToRect(edgeBox)) > 0;
1021
1021
  }
1022
+ /**
1023
+ * The default edge ID generator function. Generates an ID based on the source, target, and handles.
1024
+ * @public
1025
+ * @param params - The connection or edge to generate an ID for.
1026
+ * @returns The generated edge ID.
1027
+ */
1022
1028
  const getEdgeId = ({ source, sourceHandle, target, targetHandle }) => `xy-edge__${source}${sourceHandle || ''}-${target}${targetHandle || ''}`;
1023
1029
  const connectionExists = (edge, edges) => {
1024
1030
  return edges.some((el) => el.source === edge.source &&
@@ -1031,6 +1037,7 @@ const connectionExists = (edge, edges) => {
1031
1037
  * @public
1032
1038
  * @param edgeParams - Either an `Edge` or a `Connection` you want to add.
1033
1039
  * @param edges - The array of all current edges.
1040
+ * @param options - Optional configuration object.
1034
1041
  * @returns A new array of edges with the new edge added.
1035
1042
  *
1036
1043
  * @remarks If an edge with the same `target` and `source` already exists (and the same
@@ -1038,11 +1045,12 @@ const connectionExists = (edge, edges) => {
1038
1045
  *a new edge even if the `id` property is different.
1039
1046
  *
1040
1047
  */
1041
- const addEdge = (edgeParams, edges) => {
1048
+ const addEdge = (edgeParams, edges, options = {}) => {
1042
1049
  if (!edgeParams.source || !edgeParams.target) {
1043
1050
  devWarn('006', errorMessages['error006']());
1044
1051
  return edges;
1045
1052
  }
1053
+ const edgeIdGenerator = options.getEdgeId || getEdgeId;
1046
1054
  let edge;
1047
1055
  if (isEdgeBase(edgeParams)) {
1048
1056
  edge = { ...edgeParams };
@@ -1050,7 +1058,7 @@ const addEdge = (edgeParams, edges) => {
1050
1058
  else {
1051
1059
  edge = {
1052
1060
  ...edgeParams,
1053
- id: getEdgeId(edgeParams),
1061
+ id: edgeIdGenerator(edgeParams),
1054
1062
  };
1055
1063
  }
1056
1064
  if (connectionExists(edge, edges)) {
@@ -1091,10 +1099,11 @@ const reconnectEdge = (oldEdge, newConnection, edges, options = { shouldReplaceI
1091
1099
  devWarn('007', errorMessages['error007'](oldEdgeId));
1092
1100
  return edges;
1093
1101
  }
1102
+ const edgeIdGenerator = options.getEdgeId || getEdgeId;
1094
1103
  // Remove old edge and create the new edge with parameters of old edge.
1095
1104
  const edge = {
1096
1105
  ...rest,
1097
- id: options.shouldReplaceId ? getEdgeId(newConnection) : oldEdgeId,
1106
+ id: options.shouldReplaceId ? edgeIdGenerator(newConnection) : oldEdgeId,
1098
1107
  source: newConnection.source,
1099
1108
  target: newConnection.target,
1100
1109
  sourceHandle: newConnection.sourceHandle,
@@ -1528,6 +1537,7 @@ const defaultOptions = {
1528
1537
  nodeOrigin: [0, 0],
1529
1538
  nodeExtent: infiniteExtent,
1530
1539
  elevateNodesOnSelect: true,
1540
+ zIndexMode: 'basic',
1531
1541
  defaults: {},
1532
1542
  };
1533
1543
  const adoptUserNodesDefaultOptions = {
@@ -1587,12 +1597,15 @@ function parseHandles(userNode, internalNode) {
1587
1597
  target,
1588
1598
  };
1589
1599
  }
1590
- function adoptUserNodes(nodes, nodeLookup, parentLookup, options) {
1600
+ function isManualZIndexMode(zIndexMode) {
1601
+ return zIndexMode === 'manual';
1602
+ }
1603
+ function adoptUserNodes(nodes, nodeLookup, parentLookup, options = {}) {
1591
1604
  const _options = mergeObjects(adoptUserNodesDefaultOptions, options);
1592
- let rootParentIndex = { i: -1 };
1593
- let nodesInitialized = nodes.length > 0;
1605
+ const rootParentIndex = { i: 0 };
1594
1606
  const tmpLookup = new Map(nodeLookup);
1595
- const selectedNodeZ = _options?.elevateNodesOnSelect ? SELECTED_NODE_Z : 0;
1607
+ const selectedNodeZ = _options?.elevateNodesOnSelect && !isManualZIndexMode(_options.zIndexMode) ? SELECTED_NODE_Z : 0;
1608
+ let nodesInitialized = nodes.length > 0;
1596
1609
  nodeLookup.clear();
1597
1610
  parentLookup.clear();
1598
1611
  for (const userNode of nodes) {
@@ -1615,7 +1628,7 @@ function adoptUserNodes(nodes, nodeLookup, parentLookup, options) {
1615
1628
  positionAbsolute: clampedPosition,
1616
1629
  // if user re-initializes the node or removes `measured` for whatever reason, we reset the handleBounds so that the node gets re-measured
1617
1630
  handleBounds: parseHandles(userNode, internalNode),
1618
- z: calculateZ(userNode, selectedNodeZ),
1631
+ z: calculateZ(userNode, selectedNodeZ, _options.zIndexMode),
1619
1632
  userNode,
1620
1633
  },
1621
1634
  };
@@ -1649,7 +1662,7 @@ function updateParentLookup(node, parentLookup) {
1649
1662
  * Updates positionAbsolute and zIndex of a child node and the parentLookup.
1650
1663
  */
1651
1664
  function updateChildNode(node, nodeLookup, parentLookup, options, rootParentIndex) {
1652
- const { elevateNodesOnSelect, nodeOrigin, nodeExtent } = mergeObjects(defaultOptions, options);
1665
+ const { elevateNodesOnSelect, nodeOrigin, nodeExtent, zIndexMode } = mergeObjects(defaultOptions, options);
1653
1666
  const parentId = node.parentId;
1654
1667
  const parentNode = nodeLookup.get(parentId);
1655
1668
  if (!parentNode) {
@@ -1658,7 +1671,10 @@ function updateChildNode(node, nodeLookup, parentLookup, options, rootParentInde
1658
1671
  }
1659
1672
  updateParentLookup(node, parentLookup);
1660
1673
  // We just want to set the rootParentIndex for the first child
1661
- if (rootParentIndex && !parentNode.parentId && parentNode.internals.rootParentIndex === undefined) {
1674
+ if (rootParentIndex &&
1675
+ !parentNode.parentId &&
1676
+ parentNode.internals.rootParentIndex === undefined &&
1677
+ zIndexMode === 'auto') {
1662
1678
  parentNode.internals.rootParentIndex = ++rootParentIndex.i;
1663
1679
  parentNode.internals.z = parentNode.internals.z + rootParentIndex.i * ROOT_PARENT_Z_INCREMENT;
1664
1680
  }
@@ -1666,8 +1682,8 @@ function updateChildNode(node, nodeLookup, parentLookup, options, rootParentInde
1666
1682
  if (rootParentIndex && parentNode.internals.rootParentIndex !== undefined) {
1667
1683
  rootParentIndex.i = parentNode.internals.rootParentIndex;
1668
1684
  }
1669
- const selectedNodeZ = elevateNodesOnSelect ? SELECTED_NODE_Z : 0;
1670
- const { x, y, z } = calculateChildXYZ(node, parentNode, nodeOrigin, nodeExtent, selectedNodeZ);
1685
+ const selectedNodeZ = elevateNodesOnSelect && !isManualZIndexMode(zIndexMode) ? SELECTED_NODE_Z : 0;
1686
+ const { x, y, z } = calculateChildXYZ(node, parentNode, nodeOrigin, nodeExtent, selectedNodeZ, zIndexMode);
1671
1687
  const { positionAbsolute } = node.internals;
1672
1688
  const positionChanged = x !== positionAbsolute.x || y !== positionAbsolute.y;
1673
1689
  if (positionChanged || z !== node.internals.z) {
@@ -1682,10 +1698,14 @@ function updateChildNode(node, nodeLookup, parentLookup, options, rootParentInde
1682
1698
  });
1683
1699
  }
1684
1700
  }
1685
- function calculateZ(node, selectedNodeZ) {
1686
- return (isNumeric(node.zIndex) ? node.zIndex : 0) + (node.selected ? selectedNodeZ : 0);
1701
+ function calculateZ(node, selectedNodeZ, zIndexMode) {
1702
+ const zIndex = isNumeric(node.zIndex) ? node.zIndex : 0;
1703
+ if (isManualZIndexMode(zIndexMode)) {
1704
+ return zIndex;
1705
+ }
1706
+ return zIndex + (node.selected ? selectedNodeZ : 0);
1687
1707
  }
1688
- function calculateChildXYZ(childNode, parentNode, nodeOrigin, nodeExtent, selectedNodeZ) {
1708
+ function calculateChildXYZ(childNode, parentNode, nodeOrigin, nodeExtent, selectedNodeZ, zIndexMode) {
1689
1709
  const { x: parentX, y: parentY } = parentNode.internals.positionAbsolute;
1690
1710
  const childDimensions = getNodeDimensions(childNode);
1691
1711
  const positionWithOrigin = getNodePositionWithOrigin(childNode, nodeOrigin);
@@ -1696,7 +1716,7 @@ function calculateChildXYZ(childNode, parentNode, nodeOrigin, nodeExtent, select
1696
1716
  if (childNode.extent === 'parent') {
1697
1717
  absolutePosition = clampPositionToParent(absolutePosition, childDimensions, parentNode);
1698
1718
  }
1699
- const childZ = calculateZ(childNode, selectedNodeZ);
1719
+ const childZ = calculateZ(childNode, selectedNodeZ, zIndexMode);
1700
1720
  const parentZ = parentNode.internals.z ?? 0;
1701
1721
  return {
1702
1722
  x: absolutePosition.x,
@@ -1773,7 +1793,7 @@ function handleExpandParent(children, nodeLookup, parentLookup, nodeOrigin = [0,
1773
1793
  }
1774
1794
  return changes;
1775
1795
  }
1776
- function updateNodeInternals(updates, nodeLookup, parentLookup, domNode, nodeOrigin, nodeExtent) {
1796
+ function updateNodeInternals(updates, nodeLookup, parentLookup, domNode, nodeOrigin, nodeExtent, zIndexMode) {
1777
1797
  const viewportNode = domNode?.querySelector('.xyflow__viewport');
1778
1798
  let updatedInternals = false;
1779
1799
  if (!viewportNode) {
@@ -1829,7 +1849,7 @@ function updateNodeInternals(updates, nodeLookup, parentLookup, domNode, nodeOri
1829
1849
  };
1830
1850
  nodeLookup.set(node.id, newNode);
1831
1851
  if (node.parentId) {
1832
- updateChildNode(newNode, nodeLookup, parentLookup, { nodeOrigin });
1852
+ updateChildNode(newNode, nodeLookup, parentLookup, { nodeOrigin, zIndexMode });
1833
1853
  }
1834
1854
  updatedInternals = true;
1835
1855
  if (dimensionChanged) {
@@ -2400,15 +2420,15 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
2400
2420
  type: handleType,
2401
2421
  position: fromHandleInternal.position,
2402
2422
  };
2403
- const fromNodeInternal = nodeLookup.get(nodeId);
2404
- const from = getHandlePosition(fromNodeInternal, fromHandle, Position.Left, true);
2423
+ const fromInternalNode = nodeLookup.get(nodeId);
2424
+ const from = getHandlePosition(fromInternalNode, fromHandle, Position.Left, true);
2405
2425
  let previousConnection = {
2406
2426
  inProgress: true,
2407
2427
  isValid: null,
2408
2428
  from,
2409
2429
  fromHandle,
2410
2430
  fromPosition: fromHandle.position,
2411
- fromNode: fromNodeInternal,
2431
+ fromNode: fromInternalNode,
2412
2432
  to: position,
2413
2433
  toHandle: null,
2414
2434
  toPosition: oppositePosition[fromHandle.position],
@@ -2460,9 +2480,13 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
2460
2480
  resultHandleDomNode = result.handleDomNode;
2461
2481
  connection = result.connection;
2462
2482
  isValid = isConnectionValid(!!closestHandle, result.isValid);
2483
+ const fromInternalNode = nodeLookup.get(nodeId);
2484
+ const from = fromInternalNode
2485
+ ? getHandlePosition(fromInternalNode, fromHandle, Position.Left, true)
2486
+ : previousConnection.from;
2463
2487
  const newConnection = {
2464
- // from stays the same
2465
2488
  ...previousConnection,
2489
+ from,
2466
2490
  isValid,
2467
2491
  to: result.toHandle && isValid
2468
2492
  ? rendererPointToPoint({ x: result.toHandle.x, y: result.toHandle.y }, transform)
@@ -3486,4 +3510,4 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
3486
3510
  };
3487
3511
  }
3488
3512
 
3489
- 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, defaultAriaLabelConfig, devWarn, elementSelectionKeys, errorMessages, evaluateAbsolutePosition, fitViewport, getBezierEdgeCenter, getBezierPath, getBoundsOfBoxes, getBoundsOfRects, getConnectedEdges, getConnectionStatus, getDimensions, getEdgeCenter, getEdgePosition, getEdgeToolbarTransform, 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, mergeAriaLabelConfig, nodeHasDimensions, nodeToBox, nodeToRect, oppositePosition, panBy, pointToRendererPoint, reconnectEdge, rectToBox, rendererPointToPoint, shallowNodeData, snapPosition, updateAbsolutePositions, updateConnectionLookup, updateNodeInternals, withResolvers };
3513
+ 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, defaultAriaLabelConfig, devWarn, elementSelectionKeys, errorMessages, evaluateAbsolutePosition, fitViewport, getBezierEdgeCenter, getBezierPath, getBoundsOfBoxes, getBoundsOfRects, getConnectedEdges, getConnectionStatus, getDimensions, getEdgeCenter, getEdgeId, getEdgePosition, getEdgeToolbarTransform, 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, isManualZIndexMode, isMouseEvent, isNodeBase, isNumeric, isRectObject, mergeAriaLabelConfig, nodeHasDimensions, nodeToBox, nodeToRect, oppositePosition, panBy, pointToRendererPoint, reconnectEdge, rectToBox, rendererPointToPoint, shallowNodeData, snapPosition, updateAbsolutePositions, updateConnectionLookup, updateNodeInternals, withResolvers };
@@ -284,4 +284,13 @@ export type OnBeforeDeleteBase<NodeType extends NodeBase = NodeBase, EdgeType ex
284
284
  nodes: NodeType[];
285
285
  edges: EdgeType[];
286
286
  }>;
287
+ /**
288
+ * The `ZIndexMode` type is used to define how z-indexing is calculated for nodes and edges.
289
+ * `auto` mode will automatically manage z-indexing for selections and sub flows.
290
+ * `basic` mode will only manage z-indexing for selections.
291
+ * `manual` mode does not apply any automatic z-indexing.
292
+ *
293
+ * @public
294
+ */
295
+ export type ZIndexMode = 'auto' | 'basic' | 'manual';
287
296
  //# sourceMappingURL=general.d.ts.map
@@ -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;AAI5C,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;;GAEG;AACH,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;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,CAAC,EAAE,6BAA6B,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AACtF;;GAEG;AACH,MA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AG,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;AAElE;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Connection, InternalNodeBase, Transform, EdgeBase } from '../..';
1
+ import { Connection, InternalNodeBase, Transform, EdgeBase, ZIndexMode } from '../..';
2
2
  export declare function getEdgeCenter({ sourceX, sourceY, targetX, targetY, }: {
3
3
  sourceX: number;
4
4
  sourceY: number;
@@ -11,13 +11,14 @@ export type GetEdgeZIndexParams = {
11
11
  selected?: boolean;
12
12
  zIndex?: number;
13
13
  elevateOnSelect?: boolean;
14
+ zIndexMode?: ZIndexMode;
14
15
  };
15
16
  /**
16
17
  * Returns the z-index for an edge based on the node it connects and whether it is selected.
17
18
  * By default, edges are rendered below nodes. This behaviour is different for edges that are
18
19
  * connected to nodes with a parent, as they are rendered above the parent node.
19
20
  */
20
- export declare function getElevatedEdgeZIndex({ sourceNode, targetNode, selected, zIndex, elevateOnSelect, }: GetEdgeZIndexParams): number;
21
+ export declare function getElevatedEdgeZIndex({ sourceNode, targetNode, selected, zIndex, elevateOnSelect, zIndexMode, }: GetEdgeZIndexParams): number;
21
22
  type IsEdgeVisibleParams = {
22
23
  sourceNode: InternalNodeBase;
23
24
  targetNode: InternalNodeBase;
@@ -26,11 +27,30 @@ type IsEdgeVisibleParams = {
26
27
  transform: Transform;
27
28
  };
28
29
  export declare function isEdgeVisible({ sourceNode, targetNode, width, height, transform }: IsEdgeVisibleParams): boolean;
30
+ /**
31
+ * Type for a custom edge ID generator function.
32
+ * @public
33
+ */
34
+ export type GetEdgeId = (params: Connection | EdgeBase) => string;
35
+ /**
36
+ * The default edge ID generator function. Generates an ID based on the source, target, and handles.
37
+ * @public
38
+ * @param params - The connection or edge to generate an ID for.
39
+ * @returns The generated edge ID.
40
+ */
41
+ export declare const getEdgeId: ({ source, sourceHandle, target, targetHandle }: Connection | EdgeBase) => string;
42
+ export type AddEdgeOptions = {
43
+ /**
44
+ * Custom function to generate edge IDs. If not provided, the default `getEdgeId` function is used.
45
+ */
46
+ getEdgeId?: GetEdgeId;
47
+ };
29
48
  /**
30
49
  * This util is a convenience function to add a new Edge to an array of edges. It also performs some validation to make sure you don't add an invalid edge or duplicate an existing one.
31
50
  * @public
32
51
  * @param edgeParams - Either an `Edge` or a `Connection` you want to add.
33
52
  * @param edges - The array of all current edges.
53
+ * @param options - Optional configuration object.
34
54
  * @returns A new array of edges with the new edge added.
35
55
  *
36
56
  * @remarks If an edge with the same `target` and `source` already exists (and the same
@@ -38,13 +58,17 @@ export declare function isEdgeVisible({ sourceNode, targetNode, width, height, t
38
58
  *a new edge even if the `id` property is different.
39
59
  *
40
60
  */
41
- export declare const addEdge: <EdgeType extends EdgeBase>(edgeParams: EdgeType | Connection, edges: EdgeType[]) => EdgeType[];
61
+ export declare const addEdge: <EdgeType extends EdgeBase>(edgeParams: EdgeType | Connection, edges: EdgeType[], options?: AddEdgeOptions) => EdgeType[];
42
62
  export type ReconnectEdgeOptions = {
43
63
  /**
44
64
  * Should the id of the old edge be replaced with the new connection id.
45
65
  * @default true
46
66
  */
47
67
  shouldReplaceId?: boolean;
68
+ /**
69
+ * Custom function to generate edge IDs. If not provided, the default `getEdgeId` function is used.
70
+ */
71
+ getEdgeId?: GetEdgeId;
48
72
  };
49
73
  /**
50
74
  * A handy utility to update an existing [`Edge`](/api-reference/types/edge) with new properties.
@@ -1 +1 @@
1
- {"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/general.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d,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAmBhH;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,QAAQ,KAAK,MAAM,CAAC;AAElE;;;;;GAKG;AACH,eAAO,MAAM,SAAS,mDAAoD,UAAU,GAAG,QAAQ,KAAG,MACxB,CAAC;AAY3E,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO,GAAI,QAAQ,SAAS,QAAQ,cACnC,QAAQ,GAAG,UAAU,SAC1B,QAAQ,EAAE,YACR,cAAc,KACtB,QAAQ,EAgCV,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,SAAS,QAAQ,WAC5C,QAAQ,iBACF,UAAU,SAClB,QAAQ,EAAE,YACR,oBAAoB,KAC5B,QAAQ,EA8BV,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { ZIndexMode } from '..';
1
2
  import { NodeBase, CoordinateExtent, InternalNodeUpdate, NodeOrigin, PanZoomInstance, Transform, XYPosition, ConnectionLookup, EdgeBase, EdgeLookup, InternalNodeBase, NodeLookup, NodeDimensionChange, NodePositionChange, ParentLookup } from '../types';
2
3
  import { ParentExpandChild } from './types';
3
4
  export declare function updateAbsolutePositions<NodeType extends NodeBase>(nodeLookup: NodeLookup<InternalNodeBase<NodeType>>, parentLookup: ParentLookup<InternalNodeBase<NodeType>>, options?: UpdateNodesOptions<NodeType>): void;
@@ -6,11 +7,13 @@ type UpdateNodesOptions<NodeType extends NodeBase> = {
6
7
  nodeExtent?: CoordinateExtent;
7
8
  elevateNodesOnSelect?: boolean;
8
9
  defaults?: Partial<NodeType>;
10
+ zIndexMode?: ZIndexMode;
9
11
  checkEquality?: boolean;
10
12
  };
13
+ export declare function isManualZIndexMode(zIndexMode?: ZIndexMode): boolean;
11
14
  export declare function adoptUserNodes<NodeType extends NodeBase>(nodes: NodeType[], nodeLookup: NodeLookup<InternalNodeBase<NodeType>>, parentLookup: ParentLookup<InternalNodeBase<NodeType>>, options?: UpdateNodesOptions<NodeType>): boolean;
12
15
  export declare function handleExpandParent(children: ParentExpandChild[], nodeLookup: NodeLookup, parentLookup: ParentLookup, nodeOrigin?: NodeOrigin): (NodeDimensionChange | NodePositionChange)[];
13
- export declare function updateNodeInternals<NodeType extends InternalNodeBase>(updates: Map<string, InternalNodeUpdate>, nodeLookup: NodeLookup<NodeType>, parentLookup: ParentLookup<NodeType>, domNode: HTMLElement | null, nodeOrigin?: NodeOrigin, nodeExtent?: CoordinateExtent): {
16
+ export declare function updateNodeInternals<NodeType extends InternalNodeBase>(updates: Map<string, InternalNodeUpdate>, nodeLookup: NodeLookup<NodeType>, parentLookup: ParentLookup<NodeType>, domNode: HTMLElement | null, nodeOrigin?: NodeOrigin, nodeExtent?: CoordinateExtent, zIndexMode?: ZIndexMode): {
14
17
  changes: (NodeDimensionChange | NodePositionChange)[];
15
18
  updatedInternals: boolean;
16
19
  };
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/utils/store.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,EACV,eAAe,EACf,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,UAAU,E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UAAU,EACvB,UAAU,CAAC,EAAE,gBAAgB,EAC7B,UAAU,CAAC,EAAE,UAAU,GACtB;IAAE,OAAO,EAAE,CAAC,mBAAmB,GAAG,kBAAkB,CAAC,EAAE,CAAC;IAAC,gBAAgB,EAAE,OAAO,CAAA;CAAE,CAgGtF;AAED,wBAAsB,KAAK,CAAC,EAC1B,KAAK,EACL,OAAO,EACP,SAAS,EACT,eAAe,EACf,KAAK,EACL,MAAM,GACP,EAAE;IACD,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;IAChC,SAAS,EAAE,SAAS,CAAC;IACrB,eAAe,EAAE,gBAAgB,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,OAAO,CAAC,CAuBnB;AAwCD,wBAAgB,sBAAsB,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,QAgBnH"}
@@ -1 +1 @@
1
- {"version":3,"file":"XYHandle.d.ts","sourceRoot":"","sources":["../../src/xyhandle/XYHandle.ts"],"names":[],"mappings":"AAkBA,OAAO,EAA8C,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAwSvF,eAAO,MAAM,QAAQ,EAAE,gBAGtB,CAAC"}
1
+ {"version":3,"file":"XYHandle.d.ts","sourceRoot":"","sources":["../../src/xyhandle/XYHandle.ts"],"names":[],"mappings":"AAkBA,OAAO,EAA8C,gBAAgB,EAAE,MAAM,SAAS,CAAC;AA6SvF,eAAO,MAAM,QAAQ,EAAE,gBAGtB,CAAC"}