@railtownai/railtracks-visualizer 0.0.37 → 0.0.38

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/cjs/index.js CHANGED
@@ -6006,7 +6006,7 @@ function createPanZoomEndHandler({ zoomPanValues, panOnDrag, panOnScroll, onDrag
6006
6006
  return (!event.ctrlKey || isWheelEvent) && buttonAllowed;
6007
6007
  };
6008
6008
  }
6009
- function XYPanZoom({ domNode, minZoom, maxZoom, paneClickDistance, translateExtent, viewport, onPanZoom, onPanZoomStart, onPanZoomEnd, onDraggingChange }) {
6009
+ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPanZoom, onPanZoomStart, onPanZoomEnd, onDraggingChange }) {
6010
6010
  const zoomPanValues = {
6011
6011
  isZoomingOrPanning: false,
6012
6012
  usedRightMouseButton: false,
@@ -6018,7 +6018,7 @@ function XYPanZoom({ domNode, minZoom, maxZoom, paneClickDistance, translateExte
6018
6018
  isPanScrolling: false
6019
6019
  };
6020
6020
  const bbox = domNode.getBoundingClientRect();
6021
- const d3ZoomInstance = zoom().clickDistance(!isNumeric(paneClickDistance) || paneClickDistance < 0 ? 0 : paneClickDistance).scaleExtent([
6021
+ const d3ZoomInstance = zoom().scaleExtent([
6022
6022
  minZoom,
6023
6023
  maxZoom
6024
6024
  ]).translateExtent(translateExtent);
@@ -6049,11 +6049,12 @@ function XYPanZoom({ domNode, minZoom, maxZoom, paneClickDistance, translateExte
6049
6049
  return Promise.resolve(false);
6050
6050
  }
6051
6051
  // public functions
6052
- function update({ noWheelClassName, noPanClassName, onPaneContextMenu, userSelectionActive, panOnScroll, panOnDrag, panOnScrollMode, panOnScrollSpeed, preventScrolling, zoomOnPinch, zoomOnScroll, zoomOnDoubleClick, zoomActivationKeyPressed, lib, onTransformChange, connectionInProgress }) {
6052
+ function update({ noWheelClassName, noPanClassName, onPaneContextMenu, userSelectionActive, panOnScroll, panOnDrag, panOnScrollMode, panOnScrollSpeed, preventScrolling, zoomOnPinch, zoomOnScroll, zoomOnDoubleClick, zoomActivationKeyPressed, lib, onTransformChange, connectionInProgress, paneClickDistance, selectionOnDrag }) {
6053
6053
  if (userSelectionActive && !zoomPanValues.isZoomingOrPanning) {
6054
6054
  destroy();
6055
6055
  }
6056
6056
  const isPanOnScroll = panOnScroll && !zoomActivationKeyPressed && !userSelectionActive;
6057
+ d3ZoomInstance.clickDistance(selectionOnDrag ? Infinity : !isNumeric(paneClickDistance) || paneClickDistance < 0 ? 0 : paneClickDistance);
6057
6058
  const wheelHandler = isPanOnScroll ? createPanOnScrollHandler({
6058
6059
  zoomPanValues,
6059
6060
  noWheelClassName,
@@ -7335,7 +7336,6 @@ const reactFlowFieldsToTrack = [
7335
7336
  'onBeforeDelete',
7336
7337
  'debug',
7337
7338
  'autoPanSpeed',
7338
- 'paneClickDistance',
7339
7339
  'ariaLabelConfig'
7340
7340
  ];
7341
7341
  // rfId doesn't exist in ReactFlowProps, but it's one of the fields we want to update
@@ -7351,8 +7351,7 @@ const selector$l = (s)=>({
7351
7351
  setTranslateExtent: s.setTranslateExtent,
7352
7352
  setNodeExtent: s.setNodeExtent,
7353
7353
  reset: s.reset,
7354
- setDefaultNodesAndEdges: s.setDefaultNodesAndEdges,
7355
- setPaneClickDistance: s.setPaneClickDistance
7354
+ setDefaultNodesAndEdges: s.setDefaultNodesAndEdges
7356
7355
  });
7357
7356
  const initPrevValues = {
7358
7357
  /*
@@ -7365,11 +7364,10 @@ const initPrevValues = {
7365
7364
  maxZoom: 2,
7366
7365
  elementsSelectable: true,
7367
7366
  noPanClassName: 'nopan',
7368
- rfId: '1',
7369
- paneClickDistance: 0
7367
+ rfId: '1'
7370
7368
  };
7371
7369
  function StoreUpdater(props) {
7372
- const { setNodes, setEdges, setMinZoom, setMaxZoom, setTranslateExtent, setNodeExtent, reset, setDefaultNodesAndEdges, setPaneClickDistance } = useStore(selector$l, shallow$1);
7370
+ const { setNodes, setEdges, setMinZoom, setMaxZoom, setTranslateExtent, setNodeExtent, reset, setDefaultNodesAndEdges } = useStore(selector$l, shallow$1);
7373
7371
  const store = useStoreApi();
7374
7372
  React.useEffect(()=>{
7375
7373
  setDefaultNodesAndEdges(props.defaultNodes, props.defaultEdges);
@@ -7393,7 +7391,6 @@ function StoreUpdater(props) {
7393
7391
  else if (fieldName === 'maxZoom') setMaxZoom(fieldValue);
7394
7392
  else if (fieldName === 'translateExtent') setTranslateExtent(fieldValue);
7395
7393
  else if (fieldName === 'nodeExtent') setNodeExtent(fieldValue);
7396
- else if (fieldName === 'paneClickDistance') setPaneClickDistance(fieldValue);
7397
7394
  else if (fieldName === 'ariaLabelConfig') store.setState({
7398
7395
  ariaLabelConfig: mergeAriaLabelConfig(fieldValue)
7399
7396
  });
@@ -8455,7 +8452,7 @@ const selector$j = (s)=>({
8455
8452
  lib: s.lib,
8456
8453
  connectionInProgress: s.connection.inProgress
8457
8454
  });
8458
- function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true, panOnScroll = false, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = true, panOnDrag = true, defaultViewport, translateExtent, minZoom, maxZoom, zoomActivationKeyCode, preventScrolling = true, children, noWheelClassName, noPanClassName, onViewportChange, isControlledViewport, paneClickDistance }) {
8455
+ function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true, panOnScroll = false, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = true, panOnDrag = true, defaultViewport, translateExtent, minZoom, maxZoom, zoomActivationKeyCode, preventScrolling = true, children, noWheelClassName, noPanClassName, onViewportChange, isControlledViewport, paneClickDistance, selectionOnDrag }) {
8459
8456
  const store = useStoreApi();
8460
8457
  const zoomPane = React.useRef(null);
8461
8458
  const { userSelectionActive, lib, connectionInProgress } = useStore(selector$j, shallow$1);
@@ -8485,7 +8482,6 @@ function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true,
8485
8482
  maxZoom,
8486
8483
  translateExtent,
8487
8484
  viewport: defaultViewport,
8488
- paneClickDistance,
8489
8485
  onDraggingChange: (paneDragging)=>store.setState({
8490
8486
  paneDragging
8491
8487
  }),
@@ -8537,7 +8533,9 @@ function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true,
8537
8533
  noWheelClassName,
8538
8534
  lib,
8539
8535
  onTransformChange,
8540
- connectionInProgress
8536
+ connectionInProgress,
8537
+ selectionOnDrag,
8538
+ paneClickDistance
8541
8539
  });
8542
8540
  }, [
8543
8541
  onPaneContextMenu,
@@ -8555,7 +8553,9 @@ function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true,
8555
8553
  noWheelClassName,
8556
8554
  lib,
8557
8555
  onTransformChange,
8558
- connectionInProgress
8556
+ connectionInProgress,
8557
+ selectionOnDrag,
8558
+ paneClickDistance
8559
8559
  ]);
8560
8560
  return jsxRuntime.jsx("div", {
8561
8561
  className: "react-flow__renderer",
@@ -8597,17 +8597,16 @@ const selector$h = (s)=>({
8597
8597
  connectionInProgress: s.connection.inProgress,
8598
8598
  dragging: s.paneDragging
8599
8599
  });
8600
- function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.Full, panOnDrag, selectionOnDrag, onSelectionStart, onSelectionEnd, onPaneClick, onPaneContextMenu, onPaneScroll, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, children }) {
8600
+ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.Full, panOnDrag, paneClickDistance, selectionOnDrag, onSelectionStart, onSelectionEnd, onPaneClick, onPaneContextMenu, onPaneScroll, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, children }) {
8601
8601
  const store = useStoreApi();
8602
8602
  const { userSelectionActive, elementsSelectable, dragging, connectionInProgress } = useStore(selector$h, shallow$1);
8603
- const hasActiveSelection = elementsSelectable && (isSelecting || userSelectionActive);
8603
+ const isSelectionEnabled = elementsSelectable && (isSelecting || userSelectionActive);
8604
8604
  const container = React.useRef(null);
8605
8605
  const containerBounds = React.useRef();
8606
8606
  const selectedNodeIds = React.useRef(new Set());
8607
8607
  const selectedEdgeIds = React.useRef(new Set());
8608
8608
  // Used to prevent click events when the user lets go of the selectionKey during a selection
8609
8609
  const selectionInProgress = React.useRef(false);
8610
- const selectionStarted = React.useRef(false);
8611
8610
  const onClick = (event)=>{
8612
8611
  // We prevent click events when the user let go of the selectionKey during a selection
8613
8612
  // We also prevent click events when a connection is in progress
@@ -8630,29 +8629,27 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
8630
8629
  };
8631
8630
  const onWheel = onPaneScroll ? (event)=>onPaneScroll(event) : undefined;
8632
8631
  const onClickCapture = (event)=>{
8633
- const isSelectionOnDragActive = selectionOnDrag && container.current === event.target || !selectionOnDrag || selectionKeyPressed;
8634
- if (!isSelectionOnDragActive) {
8635
- return;
8632
+ if (selectionInProgress.current) {
8633
+ event.stopPropagation();
8634
+ selectionInProgress.current = false;
8636
8635
  }
8637
- event.stopPropagation();
8638
8636
  };
8639
8637
  // We are using capture here in order to prevent other pointer events
8640
8638
  // to be able to create a selection above a node or an edge
8641
8639
  const onPointerDownCapture = (event)=>{
8642
- const { resetSelectedElements, domNode } = store.getState();
8640
+ const { domNode } = store.getState();
8643
8641
  containerBounds.current = domNode?.getBoundingClientRect();
8644
- const isNoKeyEvent = event.target !== container.current && !!event.target.closest('.nokey');
8645
- const isSelectionActive = selectionOnDrag && container.current === event.target || !selectionOnDrag || selectionKeyPressed;
8646
- if (!elementsSelectable || !isSelecting || event.button !== 0 || !containerBounds.current || isNoKeyEvent || !isSelectionActive || !event.isPrimary) {
8642
+ if (!containerBounds.current) return;
8643
+ const eventTargetIsContainer = event.target === container.current;
8644
+ // if a child element has the 'nokey' class, we don't want to swallow the event and don't start a selection
8645
+ const isNoKeyEvent = !eventTargetIsContainer && !!event.target.closest('.nokey');
8646
+ const isSelectionActive = selectionOnDrag && eventTargetIsContainer || selectionKeyPressed;
8647
+ if (isNoKeyEvent || !isSelecting || !isSelectionActive || event.button !== 0 || !event.isPrimary) {
8647
8648
  return;
8648
8649
  }
8649
- event.stopPropagation();
8650
- event.preventDefault();
8651
8650
  event.target?.setPointerCapture?.(event.pointerId);
8652
- selectionStarted.current = true;
8653
8651
  selectionInProgress.current = false;
8654
8652
  const { x, y } = getEventPosition(event.nativeEvent, containerBounds.current);
8655
- resetSelectedElements();
8656
8653
  store.setState({
8657
8654
  userSelectionRect: {
8658
8655
  width: 0,
@@ -8663,16 +8660,28 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
8663
8660
  y
8664
8661
  }
8665
8662
  });
8666
- onSelectionStart?.(event);
8663
+ if (!eventTargetIsContainer) {
8664
+ event.stopPropagation();
8665
+ event.preventDefault();
8666
+ }
8667
8667
  };
8668
8668
  const onPointerMove = (event)=>{
8669
- const { userSelectionRect, transform, nodeLookup, edgeLookup, connectionLookup, triggerNodeChanges, triggerEdgeChanges, defaultEdgeOptions } = store.getState();
8669
+ const { userSelectionRect, transform, nodeLookup, edgeLookup, connectionLookup, triggerNodeChanges, triggerEdgeChanges, defaultEdgeOptions, resetSelectedElements } = store.getState();
8670
8670
  if (!containerBounds.current || !userSelectionRect) {
8671
8671
  return;
8672
8672
  }
8673
- selectionInProgress.current = true;
8674
8673
  const { x: mouseX, y: mouseY } = getEventPosition(event.nativeEvent, containerBounds.current);
8675
8674
  const { startX, startY } = userSelectionRect;
8675
+ if (!selectionInProgress.current) {
8676
+ const requiredDistance = selectionKeyPressed ? 0 : paneClickDistance;
8677
+ const distance = Math.hypot(mouseX - startX, mouseY - startY);
8678
+ if (distance <= requiredDistance) {
8679
+ return;
8680
+ }
8681
+ resetSelectedElements();
8682
+ onSelectionStart?.(event);
8683
+ }
8684
+ selectionInProgress.current = true;
8676
8685
  const nextUserSelectRect = {
8677
8686
  startX,
8678
8687
  startY,
@@ -8712,30 +8721,26 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
8712
8721
  });
8713
8722
  };
8714
8723
  const onPointerUp = (event)=>{
8715
- if (event.button !== 0 || !selectionStarted.current) {
8724
+ if (event.button !== 0) {
8716
8725
  return;
8717
8726
  }
8718
8727
  event.target?.releasePointerCapture?.(event.pointerId);
8719
- const { userSelectionRect } = store.getState();
8720
8728
  /*
8721
8729
  * We only want to trigger click functions when in selection mode if
8722
8730
  * the user did not move the mouse.
8723
- */ if (!userSelectionActive && userSelectionRect && event.target === container.current) {
8731
+ */ if (!userSelectionActive && event.target === container.current && store.getState().userSelectionRect) {
8724
8732
  onClick?.(event);
8725
8733
  }
8726
8734
  store.setState({
8727
8735
  userSelectionActive: false,
8728
- userSelectionRect: null,
8729
- nodesSelectionActive: selectedNodeIds.current.size > 0
8736
+ userSelectionRect: null
8730
8737
  });
8731
- onSelectionEnd?.(event);
8732
- /*
8733
- * If the user kept holding the selectionKey during the selection,
8734
- * we need to reset the selectionInProgress, so the next click event is not prevented
8735
- */ if (selectionKeyPressed || selectionOnDrag) {
8736
- selectionInProgress.current = false;
8738
+ if (selectionInProgress.current) {
8739
+ onSelectionEnd?.(event);
8740
+ store.setState({
8741
+ nodesSelectionActive: selectedNodeIds.current.size > 0
8742
+ });
8737
8743
  }
8738
- selectionStarted.current = false;
8739
8744
  };
8740
8745
  const draggable = panOnDrag === true || Array.isArray(panOnDrag) && panOnDrag.includes(0);
8741
8746
  return jsxRuntime.jsxs("div", {
@@ -8747,14 +8752,14 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
8747
8752
  selection: isSelecting
8748
8753
  }
8749
8754
  ]),
8750
- onClick: hasActiveSelection ? undefined : wrapHandler(onClick, container),
8755
+ onClick: isSelectionEnabled ? undefined : wrapHandler(onClick, container),
8751
8756
  onContextMenu: wrapHandler(onContextMenu, container),
8752
8757
  onWheel: wrapHandler(onWheel, container),
8753
- onPointerEnter: hasActiveSelection ? undefined : onPaneMouseEnter,
8754
- onPointerMove: hasActiveSelection ? onPointerMove : onPaneMouseMove,
8755
- onPointerUp: hasActiveSelection ? onPointerUp : undefined,
8756
- onPointerDownCapture: hasActiveSelection ? onPointerDownCapture : undefined,
8757
- onClickCapture: hasActiveSelection ? onClickCapture : undefined,
8758
+ onPointerEnter: isSelectionEnabled ? undefined : onPaneMouseEnter,
8759
+ onPointerMove: isSelectionEnabled ? onPointerMove : onPaneMouseMove,
8760
+ onPointerUp: isSelectionEnabled ? onPointerUp : undefined,
8761
+ onPointerDownCapture: isSelectionEnabled ? onPointerDownCapture : undefined,
8762
+ onClickCapture: isSelectionEnabled ? onClickCapture : undefined,
8758
8763
  onPointerLeave: onPaneMouseLeave,
8759
8764
  ref: container,
8760
8765
  style: containerStyle,
@@ -9304,6 +9309,7 @@ function FlowRendererComponent({ children, onPaneClick, onPaneMouseEnter, onPane
9304
9309
  onViewportChange: onViewportChange,
9305
9310
  isControlledViewport: isControlledViewport,
9306
9311
  paneClickDistance: paneClickDistance,
9312
+ selectionOnDrag: _selectionOnDrag,
9307
9313
  children: jsxRuntime.jsxs(Pane, {
9308
9314
  onSelectionStart: onSelectionStart,
9309
9315
  onSelectionEnd: onSelectionEnd,
@@ -9317,6 +9323,7 @@ function FlowRendererComponent({ children, onPaneClick, onPaneMouseEnter, onPane
9317
9323
  isSelecting: !!isSelecting,
9318
9324
  selectionMode: selectionMode,
9319
9325
  selectionKeyPressed: selectionKeyPressed,
9326
+ paneClickDistance: paneClickDistance,
9320
9327
  selectionOnDrag: _selectionOnDrag,
9321
9328
  children: [
9322
9329
  children,
@@ -11399,9 +11406,6 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
11399
11406
  translateExtent
11400
11407
  });
11401
11408
  },
11402
- setPaneClickDistance: (clickDistance)=>{
11403
- get().panZoom?.setClickDistance(clickDistance);
11404
- },
11405
11409
  resetSelectedElements: ()=>{
11406
11410
  const { edges, nodes, triggerNodeChanges, triggerEdgeChanges, elementsSelectable } = get();
11407
11411
  if (!elementsSelectable) {
@@ -11730,7 +11734,6 @@ function ReactFlow({ nodes, edges, defaultNodes, defaultEdges, className, nodeTy
11730
11734
  nodeDragThreshold: nodeDragThreshold,
11731
11735
  connectionDragThreshold: connectionDragThreshold,
11732
11736
  onBeforeDelete: onBeforeDelete,
11733
- paneClickDistance: paneClickDistance,
11734
11737
  debug: debug,
11735
11738
  ariaLabelConfig: ariaLabelConfig
11736
11739
  }),
@@ -12696,7 +12699,7 @@ var css_248z = "/* this gets exported as style.css and can be used for the defau
12696
12699
  styleInject(css_248z);
12697
12700
 
12698
12701
  /**
12699
- * @license lucide-react v0.546.0 - ISC
12702
+ * @license lucide-react v0.553.0 - ISC
12700
12703
  *
12701
12704
  * This source code is licensed under the ISC license.
12702
12705
  * See the LICENSE file in the root directory of this source tree.
@@ -12718,7 +12721,7 @@ const hasA11yProp = (props)=>{
12718
12721
  };
12719
12722
 
12720
12723
  /**
12721
- * @license lucide-react v0.546.0 - ISC
12724
+ * @license lucide-react v0.553.0 - ISC
12722
12725
  *
12723
12726
  * This source code is licensed under the ISC license.
12724
12727
  * See the LICENSE file in the root directory of this source tree.
@@ -15801,6 +15804,8 @@ const Label$1 = styled.span`
15801
15804
  `;
15802
15805
  const Value$1 = styled.span`
15803
15806
  font-size: 0.75rem;
15807
+ overflow-wrap: break-word;
15808
+ word-wrap: break-word;
15804
15809
  color: ${(props)=>props.themeColors.primary};
15805
15810
  `;
15806
15811
  const EmptyIndicator = styled.span`
@@ -15820,8 +15825,8 @@ const TreeContainer = styled.div`
15820
15825
  `;
15821
15826
  const TreeScrollContainer = styled.div`
15822
15827
  width: 100%;
15823
- max-height: 16rem;
15824
15828
  overflow-y: auto;
15829
+ max-height: 16rem;
15825
15830
  padding: 0.5rem;
15826
15831
  `;
15827
15832
  const NoDataMessage = styled.div`
@@ -15842,7 +15847,8 @@ const SimpleValueContainer = styled.div`
15842
15847
  border: 1px solid ${(props)=>props.themeColors.border};
15843
15848
  font-size: 0.75rem;
15844
15849
  color: ${(props)=>props.themeColors.foreground};
15845
- word-break: break-all;
15850
+ overflow-wrap: break-word;
15851
+ word-wrap: break-word;
15846
15852
  `;
15847
15853
  styled.div`
15848
15854
  width: 100%;
@@ -15862,6 +15868,8 @@ const SimpleValueLabel = styled.span`
15862
15868
  `;
15863
15869
  const SimpleValueText = styled.span`
15864
15870
  color: ${(props)=>props.themeColors.foreground};
15871
+ word-wrap: break-word;
15872
+ overflow-wrap: break-word;
15865
15873
  font-size: 0.875rem;
15866
15874
  `;
15867
15875
  const EmptyStateContainer = styled.div`
@@ -16031,6 +16039,8 @@ const JsonTreeViewer = ({ data, maxDepth = 4, initialExpanded = false, expanded
16031
16039
  })()));
16032
16040
  };
16033
16041
 
16042
+ const NODE_MAX_WIDTH = 500;
16043
+
16034
16044
  const OutputRenderer = ({ data })=>{
16035
16045
  const [isExpanded, setIsExpanded] = React.useState(false);
16036
16046
  const contentType = detectContentType(data);
@@ -16039,20 +16049,26 @@ const OutputRenderer = ({ data })=>{
16039
16049
  };
16040
16050
  switch(contentType){
16041
16051
  case "string":
16042
- return /*#__PURE__*/ React.createElement(OutputScrollableContent, null, /*#__PURE__*/ React.createElement(ExpandableTextarea, {
16052
+ return /*#__PURE__*/ React.createElement(OutputScrollableContent, {
16053
+ className: "agent-node-scrollable"
16054
+ }, /*#__PURE__*/ React.createElement(ExpandableTextarea, {
16043
16055
  label: "Output",
16044
16056
  content: data.content,
16045
16057
  isExpanded: isExpanded,
16046
16058
  onToggle: handleToggle
16047
16059
  }));
16048
16060
  case "toolResponse":
16049
- return /*#__PURE__*/ React.createElement(OutputScrollableContent, null, /*#__PURE__*/ React.createElement(NodeSubHeader, null, "Output - Tool Response"), /*#__PURE__*/ React.createElement(JsonTreeViewer, {
16061
+ return /*#__PURE__*/ React.createElement(OutputScrollableContent, {
16062
+ className: "agent-node-scrollable"
16063
+ }, /*#__PURE__*/ React.createElement(NodeSubHeader, null, "Output - Tool Response"), /*#__PURE__*/ React.createElement(JsonTreeViewer, {
16050
16064
  data: data,
16051
16065
  expanded: true
16052
16066
  }));
16053
16067
  case "toolCallList":
16054
16068
  const formattedCode = formatToolCalls(data.content);
16055
- return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(OutputScrollableContent, null, /*#__PURE__*/ React.createElement(NodeSubHeader, null, /*#__PURE__*/ React.createElement("span", null, "Output - Tool Calls"), /*#__PURE__*/ React.createElement("span", {
16069
+ return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(OutputScrollableContent, {
16070
+ className: "agent-node-scrollable"
16071
+ }, /*#__PURE__*/ React.createElement(NodeSubHeader, null, /*#__PURE__*/ React.createElement("span", null, "Output - Tool Calls"), /*#__PURE__*/ React.createElement("span", {
16056
16072
  style: {
16057
16073
  display: "flex",
16058
16074
  alignItems: "center",
@@ -16067,7 +16083,7 @@ const OutputRenderer = ({ data })=>{
16067
16083
  })));
16068
16084
  case "other":
16069
16085
  default:
16070
- return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(OutputScrollableContent, null, /*#__PURE__*/ React.createElement(NodeSubHeader, null, "Output"), /*#__PURE__*/ React.createElement(JsonTreeViewer, {
16086
+ return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(OutputScrollableContent, null, /*#__PURE__*/ React.createElement(NodeSubHeader, null, "Output - JSON"), /*#__PURE__*/ React.createElement(JsonTreeViewer, {
16071
16087
  data: data,
16072
16088
  expanded: true
16073
16089
  })));
@@ -16090,12 +16106,13 @@ const NodeSubHeader = styled.span`
16090
16106
  `;
16091
16107
  const OutputScrollableContent = styled.div`
16092
16108
  width: 100%;
16109
+ max-width: ${NODE_MAX_WIDTH}px;
16093
16110
  display: flex;
16094
16111
  flex-direction: column;
16112
+ align-items: stretch;
16095
16113
  padding-bottom: 0.5rem;
16114
+ padding-right: 2px;
16096
16115
  gap: 0.5rem;
16097
- max-height: 200px;
16098
- overflow-y: auto;
16099
16116
  `;
16100
16117
 
16101
16118
  function _objectWithoutPropertiesLoose(r, e) {
@@ -16407,7 +16424,9 @@ const InputArrayRenderer = ({ input })=>{
16407
16424
  }
16408
16425
  }, /*#__PURE__*/ React.createElement(MessageSquare, {
16409
16426
  size: 12
16410
- }), input.length)), /*#__PURE__*/ React.createElement(InputArrayScrollableContent, null, input.map((item, index)=>/*#__PURE__*/ React.createElement(InputItem, {
16427
+ }), input.length)), /*#__PURE__*/ React.createElement(InputArrayScrollableContent, {
16428
+ className: "agent-node-scrollable"
16429
+ }, input.map((item, index)=>/*#__PURE__*/ React.createElement(InputItem, {
16411
16430
  key: index
16412
16431
  }, /*#__PURE__*/ React.createElement(InputItemHeader, null, /*#__PURE__*/ React.createElement(InputItemLabel, null, getRoleEmoji(item.role), " ", getRoleDisplayName(item.role))), /*#__PURE__*/ React.createElement(InputItemTextarea, {
16413
16432
  onClick: (e)=>{
@@ -16419,7 +16438,8 @@ const InputArrayRenderer = ({ input })=>{
16419
16438
  border: `1px solid ${themeColors.border}`,
16420
16439
  backgroundColor: themeColors.muted,
16421
16440
  color: themeColors.foreground
16422
- }
16441
+ },
16442
+ className: "agent-node-scrollable"
16423
16443
  })))));
16424
16444
  };
16425
16445
  // Styled components
@@ -16434,6 +16454,7 @@ const InputArrayScrollableContent = styled.div`
16434
16454
  display: flex;
16435
16455
  flex-direction: column;
16436
16456
  padding-bottom: 0.5rem;
16457
+ padding-right: 2px;
16437
16458
  gap: 0.5rem;
16438
16459
  max-height: 200px;
16439
16460
  overflow-y: auto;
@@ -16563,12 +16584,7 @@ const getNodeIcon$1 = (nodeType, modelProvider)=>{
16563
16584
  }
16564
16585
  return "🤖";
16565
16586
  };
16566
- const NodeDetailsPopover = ({ isVisible, onClose, nodeData, triggerRef })=>{
16567
- const [position, setPosition] = React.useState({
16568
- top: 0,
16569
- left: 0,
16570
- arrowPosition: "right"
16571
- });
16587
+ const NodeDetailsPopover = ({ isVisible, onClose, nodeData })=>{
16572
16588
  const [selectedRowIndex, setSelectedRowIndex] = React.useState(null);
16573
16589
  const [selectedLlmDetails, setSelectedLlmDetails] = React.useState(null);
16574
16590
  // Default to last row (total/aggregate) when popover opens (only on first open)
@@ -16593,54 +16609,6 @@ const NodeDetailsPopover = ({ isVisible, onClose, nodeData, triggerRef })=>{
16593
16609
  setSelectedLlmDetails(nodeData.details.internals.llm_details[nodeData.details.internals.llm_details.length]);
16594
16610
  }
16595
16611
  };
16596
- // Calculate popover position based on trigger element
16597
- React.useEffect(()=>{
16598
- if (isVisible && triggerRef.current) {
16599
- const rect = triggerRef.current.getBoundingClientRect();
16600
- const viewportWidth = window.innerWidth;
16601
- const viewportHeight = window.innerHeight;
16602
- const popoverWidth = DEFAULT_POPOVER_WIDTH; // Match the width from styled component
16603
- const popoverHeight = DEFAULT_POPOVER_HEIGHT; // Approximate max height
16604
- const gap = 12; // Gap between node and popover
16605
- // Check if the rect is valid (has non-zero dimensions and is in viewport)
16606
- const isValidRect = rect.width > 0 && rect.height > 0 && rect.top >= 0 && rect.left >= 0;
16607
- if (isValidRect) {
16608
- // Normal positioning logic for ReactFlow
16609
- let left = rect.right + gap;
16610
- let top = rect.top;
16611
- let arrowPosition = "right"; // Arrow points right (popover is to the right)
16612
- // If popover would go off-screen, position it to the left of the node
16613
- if (left + popoverWidth > viewportWidth) {
16614
- left = rect.left - popoverWidth - gap;
16615
- arrowPosition = "left"; // Arrow points left (popover is to the left)
16616
- }
16617
- // Ensure popover doesn't go off the top or bottom of the viewport
16618
- if (top < 0) {
16619
- top = 20; // Small margin from top
16620
- } else if (top + popoverHeight > viewportHeight) {
16621
- top = viewportHeight - popoverHeight - 20; // Small margin from bottom
16622
- }
16623
- setPosition({
16624
- top,
16625
- left,
16626
- arrowPosition
16627
- });
16628
- } else {
16629
- // Fallback positioning for isolated environments (like Storybook)
16630
- // Center the popover in the viewport
16631
- const centerLeft = Math.max(20, (viewportWidth - popoverWidth) / 2);
16632
- const centerTop = Math.max(20, (viewportHeight - popoverHeight) / 2);
16633
- setPosition({
16634
- top: centerTop,
16635
- left: centerLeft,
16636
- arrowPosition: "none" // No arrow in fallback mode
16637
- });
16638
- }
16639
- }
16640
- }, [
16641
- isVisible,
16642
- triggerRef
16643
- ]);
16644
16612
  // Handle ESC key to close popover
16645
16613
  React.useEffect(()=>{
16646
16614
  const handleEscKey = (event)=>{
@@ -16666,7 +16634,7 @@ const NodeDetailsPopover = ({ isVisible, onClose, nodeData, triggerRef })=>{
16666
16634
  // Handle click outside to close popover
16667
16635
  React.useEffect(()=>{
16668
16636
  const handleClickOutside = (event)=>{
16669
- if (isVisible && triggerRef.current && !triggerRef.current.contains(event.target) && !event.target.closest("[data-popover-content]")) {
16637
+ if (isVisible && !event.target.closest("[data-popover-content]") && !event.target.closest(".react-flow__node")) {
16670
16638
  onClose();
16671
16639
  }
16672
16640
  };
@@ -16676,8 +16644,7 @@ const NodeDetailsPopover = ({ isVisible, onClose, nodeData, triggerRef })=>{
16676
16644
  }
16677
16645
  }, [
16678
16646
  isVisible,
16679
- onClose,
16680
- triggerRef
16647
+ onClose
16681
16648
  ]);
16682
16649
  if (!isVisible) return null;
16683
16650
  const llOverviewDetails = getOverviewLlmDetails(nodeData.details?.internals?.llm_details || []);
@@ -16685,16 +16652,14 @@ const NodeDetailsPopover = ({ isVisible, onClose, nodeData, triggerRef })=>{
16685
16652
  const totalInputTokens = sumTotalInputTokens(nodeData.details?.internals?.llm_details || []);
16686
16653
  const totalOutputTokens = sumTotalOutputTokens(nodeData.details?.internals?.llm_details || []);
16687
16654
  const totalLatency = sumTotalLatency(nodeData.details?.internals?.llm_details || []);
16688
- const popoverContent = /*#__PURE__*/ React.createElement(PopoverPortal, {
16689
- style: {
16690
- top: position.top,
16691
- left: position.left
16692
- }
16693
- }, /*#__PURE__*/ React.createElement(PopoverContent, {
16655
+ const popoverContent = /*#__PURE__*/ React.createElement(PopoverPortal, null, /*#__PURE__*/ React.createElement(PopoverContent, {
16694
16656
  "data-popover-content": true,
16695
- $arrowPosition: position.arrowPosition
16657
+ $arrowPosition: "left"
16696
16658
  }, /*#__PURE__*/ React.createElement(PopoverHeader, null, /*#__PURE__*/ React.createElement(PopoverTitle, null, /*#__PURE__*/ React.createElement(NodeIcon$3, null, getNodeIcon$1(nodeData.nodeType || "Agent", llOverviewDetails?.model_provider)), /*#__PURE__*/ React.createElement("span", null, nodeData.label, " Details")), /*#__PURE__*/ React.createElement(PopoverHeaderButtons, null, /*#__PURE__*/ React.createElement(CloseButton, {
16697
- onClick: onClose
16659
+ onClick: (e)=>{
16660
+ e.stopPropagation();
16661
+ onClose();
16662
+ }
16698
16663
  }, /*#__PURE__*/ React.createElement(X, {
16699
16664
  size: 16
16700
16665
  })))), /*#__PURE__*/ React.createElement(PopoverBody, null, llOverviewDetails && /*#__PURE__*/ React.createElement(Section, null, /*#__PURE__*/ React.createElement(InfoGrid, null, (()=>{
@@ -16838,14 +16803,20 @@ const NodeDetailsPopover = ({ isVisible, onClose, nodeData, triggerRef })=>{
16838
16803
  }), /*#__PURE__*/ React.createElement(OutputRenderer, {
16839
16804
  data: selectedLlmDetails.output
16840
16805
  })) : null))));
16841
- // Use React Portal to render outside of ReactFlow container
16842
- return /*#__PURE__*/ ReactDOM.createPortal(popoverContent, document.body);
16806
+ return popoverContent;
16843
16807
  };
16844
16808
  // Styled components
16845
16809
  const PopoverPortal = styled.div`
16846
- position: fixed;
16810
+ position: absolute;
16811
+ left: calc(100% + 12px);
16812
+ top: 0;
16847
16813
  z-index: 99999;
16848
- pointer-events: none;
16814
+
16815
+ /* Position to the left of the node if there's not enough space on the right */
16816
+ @media (max-width: 768px) {
16817
+ left: auto;
16818
+ right: calc(100% + 12px);
16819
+ }
16849
16820
  `;
16850
16821
  const PopoverContent = styled.div`
16851
16822
  width: ${DEFAULT_POPOVER_WIDTH}px;
@@ -16881,7 +16852,7 @@ const PopoverContent = styled.div`
16881
16852
  height: 0;
16882
16853
  border-top: 6px solid transparent;
16883
16854
  border-bottom: 6px solid transparent;
16884
- ${props.$arrowPosition === "right" ? `
16855
+ ${props.$arrowPosition === "left" ? `
16885
16856
  left: -6px;
16886
16857
  border-right: 6px solid ${props.theme?.colors?.border || "hsl(214.3 31.8% 91.4%)"};
16887
16858
  ` : `
@@ -16898,7 +16869,7 @@ const PopoverContent = styled.div`
16898
16869
  height: 0;
16899
16870
  border-top: 6px solid transparent;
16900
16871
  border-bottom: 6px solid transparent;
16901
- ${props.$arrowPosition === "right" ? `
16872
+ ${props.$arrowPosition === "left" ? `
16902
16873
  left: -5px;
16903
16874
  border-right: 6px solid ${props.theme?.colors?.background || "hsl(0 0% 100%)"};
16904
16875
  ` : `
@@ -16979,7 +16950,7 @@ const PopoverHeaderButtons = styled.div`
16979
16950
  display: flex;
16980
16951
  align-items: center;
16981
16952
  gap: 0.5rem;
16982
- justify-content: flex-start;
16953
+ justify-content: flex-end;
16983
16954
  `;
16984
16955
  const CloseButton = styled.button`
16985
16956
  display: flex;
@@ -16993,6 +16964,8 @@ const CloseButton = styled.button`
16993
16964
  color: ${(props)=>props.theme?.colors?.mutedForeground || "hsl(215.4 16.3% 46.9%)"};
16994
16965
  cursor: pointer;
16995
16966
  transition: all 0.2s ease-in-out;
16967
+ pointer-events: auto;
16968
+ flex-shrink: 0;
16996
16969
 
16997
16970
  &:hover {
16998
16971
  background-color: ${(props)=>props.theme?.colors?.muted || "hsl(210 40% 96%)"};
@@ -17003,9 +16976,13 @@ const CloseButton = styled.button`
17003
16976
  outline: 2px solid ${(props)=>props.theme?.colors?.primary || "hsl(221.2 83.2% 53.3%)"};
17004
16977
  outline-offset: 2px;
17005
16978
  }
16979
+
16980
+ &:active {
16981
+ transform: scale(0.95);
16982
+ }
17006
16983
  `;
17007
16984
  const PopoverBody = styled.div`
17008
- max-height: 500px;
16985
+ max-height: 400px; /* Reduced by 100px to account for PopoverHeader and spacing */
17009
16986
  overflow-y: auto;
17010
16987
  padding: 1rem;
17011
16988
  display: flex;
@@ -17018,6 +16995,7 @@ const Section = styled.div`
17018
16995
  gap: 0.75rem;
17019
16996
  `;
17020
16997
  const FadingSection = styled(Section)`
16998
+ overflow-y: auto; /* Base style: enables scrolling after animation completes */
17021
16999
  animation:
17022
17000
  expandHeight 300ms ease-out,
17023
17001
  fadeInContent 200ms ease-in-out 200ms both;
@@ -17028,8 +17006,8 @@ const FadingSection = styled(Section)`
17028
17006
  overflow: hidden;
17029
17007
  }
17030
17008
  to {
17031
- max-height: 500px; /* Adjust based on expected content height */
17032
- overflow: visible;
17009
+ max-height: 350px; /* Reduced to fit within PopoverBody (400px) accounting for padding and gaps */
17010
+ overflow: hidden; /* Keep hidden during animation, base overflow-y: auto takes effect after */
17033
17011
  }
17034
17012
  }
17035
17013
 
@@ -17138,7 +17116,7 @@ const AgentNode = ({ data, id, onInspect })=>{
17138
17116
  return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(NodeContainer$2, {
17139
17117
  ref: nodeRef,
17140
17118
  onClick: handleNodeClick,
17141
- className: "nowheel"
17119
+ className: "nowheel agent-node"
17142
17120
  }, hasIncomingEdges && /*#__PURE__*/ React.createElement(Handle$1, {
17143
17121
  type: "target",
17144
17122
  position: Position.Top,
@@ -17171,15 +17149,14 @@ const AgentNode = ({ data, id, onInspect })=>{
17171
17149
  cursor: "default"
17172
17150
  },
17173
17151
  isConnectable: false
17174
- })), /*#__PURE__*/ React.createElement(NodeDetailsPopover, {
17152
+ }), /*#__PURE__*/ React.createElement(NodeDetailsPopover, {
17175
17153
  isVisible: isPopoverOpen,
17176
17154
  onClose: handleClosePopover,
17177
17155
  nodeData: {
17178
17156
  ...data,
17179
17157
  id: id
17180
- },
17181
- triggerRef: nodeRef
17182
- }));
17158
+ }
17159
+ })));
17183
17160
  };
17184
17161
  // Styled components
17185
17162
  const NodeContainer$2 = styled.div`
@@ -17188,9 +17165,9 @@ const NodeContainer$2 = styled.div`
17188
17165
  border: 2px solid ${(props)=>props.theme?.colors?.border || "hsl(214.3 31.8% 91.4%)"};
17189
17166
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
17190
17167
  min-width: 300px;
17168
+ max-width: ${NODE_MAX_WIDTH}px;
17191
17169
  transition: all 0.2s ease-in-out;
17192
17170
  position: relative;
17193
- cursor: pointer;
17194
17171
 
17195
17172
  &:hover {
17196
17173
  border-color: ${(props)=>props.theme?.colors?.primary || "hsl(221.2 83.2% 53.3%)"};
@@ -17371,15 +17348,15 @@ const ToolNode = ({ data, id, onInspect })=>{
17371
17348
  nodeData = {
17372
17349
  ...baseData,
17373
17350
  input: {
17374
- args: data.edgeDetails[0]?.input_args,
17375
- kwargs: data.edgeDetails[0]?.input_kwargs
17351
+ ...data.edgeDetails[0]?.input_kwargs
17376
17352
  },
17377
17353
  output: data.edgeDetails[0]?.output,
17378
17354
  status: data.edgeDetails[0]?.status
17379
17355
  };
17380
17356
  }
17381
17357
  return /*#__PURE__*/ React.createElement(NodeContainer, {
17382
- onClick: handleNodeClick
17358
+ onClick: handleNodeClick,
17359
+ className: "nowheel"
17383
17360
  }, hasIncomingEdges && /*#__PURE__*/ React.createElement(Handle$1, {
17384
17361
  type: "target",
17385
17362
  position: Position.Top,
@@ -17420,6 +17397,7 @@ const NodeContainer = styled.div`
17420
17397
  border: 2px solid ${(props)=>props.theme?.colors?.border || "hsl(214.3 31.8% 91.4%)"};
17421
17398
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
17422
17399
  min-width: 300px;
17400
+ max-width: ${NODE_MAX_WIDTH}px;
17423
17401
  transition: all 0.2s ease-in-out;
17424
17402
  position: relative;
17425
17403
  cursor: pointer;
@@ -20691,7 +20669,7 @@ const AgenticFlowVisualizer = ({ flowData: propFlowData, width = "100dvw", heigh
20691
20669
  ]);
20692
20670
  // Pan to specific node when panToNodeId prop is provided
20693
20671
  React.useEffect(()=>{
20694
- if (!panToNodeId || !reactFlowInstance || disableAutoFit || nodes.length === 0) {
20672
+ if (!panToNodeId || !reactFlowInstance || nodes.length === 0) {
20695
20673
  return;
20696
20674
  }
20697
20675
  // Check if the specified node ID exists in the current nodes array
@@ -20716,7 +20694,6 @@ const AgenticFlowVisualizer = ({ flowData: propFlowData, width = "100dvw", heigh
20716
20694
  }, [
20717
20695
  panToNodeId,
20718
20696
  reactFlowInstance,
20719
- disableAutoFit,
20720
20697
  nodes,
20721
20698
  defaultAutoFitDuration,
20722
20699
  defaultAutoFitDelay,
@@ -20852,6 +20829,7 @@ const AgenticFlowVisualizer = ({ flowData: propFlowData, width = "100dvw", heigh
20852
20829
  colorMode: isDarkMode ? "dark" : "light",
20853
20830
  nodes: nodesState,
20854
20831
  edges: edgesState,
20832
+ minZoom: 0.2,
20855
20833
  onNodesChange: onNodesChange,
20856
20834
  onEdgesChange: onEdgesChange,
20857
20835
  onConnect: onConnect,