@localstack/appinspector-ui 1.0.188 → 1.0.189

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/index.js CHANGED
@@ -2520,6 +2520,7 @@ var FILTER_CONSUMER_TEST_ID = "filter-consumer";
2520
2520
  var HIDDEN_OPS_NOTE_TEST_ID = "hidden-ops-note";
2521
2521
  var TRACE_SIDEBAR_TEST_ID = "trace-sidebar";
2522
2522
  var TRACE_SIDEBAR_RESIZE_HANDLE_TEST_ID = "trace-sidebar-resize-handle";
2523
+ var TRACE_SIDEBAR_SPLIT_HANDLE_TEST_ID = "trace-sidebar-split-handle";
2523
2524
  var TRACE_SIDEBAR_WATERFALL_BUTTON_TEST_ID = "trace-sidebar-waterfall-button";
2524
2525
  var TRACE_SIDEBAR_MAP_BUTTON_TEST_ID = "trace-sidebar-map-button";
2525
2526
  var TRACE_SIDEBAR_ROOT_HEADING_TEST_ID = "trace-sidebar-root-heading";
@@ -32626,12 +32627,20 @@ var MIN_WIDTH = 360;
32626
32627
  var MAX_WIDTH_SHARE = 0.8;
32627
32628
  var KEYBOARD_STEP = 24;
32628
32629
  var WIDTH_STORAGE_KEY = "appinspector-trace-sidebar-width";
32630
+ var DEFAULT_SPLIT = 0.4;
32631
+ var MIN_SPLIT = 0.15;
32632
+ var MAX_SPLIT = 0.7;
32633
+ var KEYBOARD_SPLIT_STEP = 0.05;
32634
+ var SPLIT_STORAGE_KEY = "appinspector-trace-sidebar-split";
32635
+ var clampSplit = (split2) => Math.min(MAX_SPLIT, Math.max(MIN_SPLIT, split2));
32629
32636
  var noop = () => void 0;
32630
32637
  var TraceSidebar = ({ onClose, onSelectSpan, selectedSpanId, spanMatches, spans }) => {
32631
32638
  const { requestTerms } = useDevSettings();
32632
32639
  const [storedWidth, setStoredWidth] = useLocalStorage(WIDTH_STORAGE_KEY, DEFAULT_WIDTH);
32640
+ const [storedSplit, setStoredSplit] = useLocalStorage(SPLIT_STORAGE_KEY, DEFAULT_SPLIT);
32633
32641
  const [view, setView] = React125.useState("waterfall");
32634
32642
  const sidebarRef = React125.useRef(null);
32643
+ const traceViewRef = React125.useRef(null);
32635
32644
  const clampWidth = (width) => {
32636
32645
  const parentWidth = sidebarRef.current?.parentElement?.clientWidth;
32637
32646
  const max2 = parentWidth === void 0 || parentWidth === 0 ? Number.POSITIVE_INFINITY : Math.max(MIN_WIDTH, parentWidth * MAX_WIDTH_SHARE);
@@ -32654,6 +32663,19 @@ var TraceSidebar = ({ onClose, onSelectSpan, selectedSpanId, spanMatches, spans
32654
32663
  event.preventDefault();
32655
32664
  setStoredWidth(clampWidth(storedWidth + delta));
32656
32665
  };
32666
+ const handleSplitPointerMove = (event) => {
32667
+ if (!event.currentTarget.hasPointerCapture(event.pointerId)) return;
32668
+ const sidebarHeight = sidebarRef.current?.clientHeight;
32669
+ const traceViewTop = traceViewRef.current?.getBoundingClientRect().top;
32670
+ if (!sidebarHeight || traceViewTop === void 0) return;
32671
+ setStoredSplit(clampSplit((event.clientY - traceViewTop) / sidebarHeight));
32672
+ };
32673
+ const handleSplitKeyDown = (event) => {
32674
+ const delta = event.key === "ArrowUp" ? -KEYBOARD_SPLIT_STEP : event.key === "ArrowDown" ? KEYBOARD_SPLIT_STEP : 0;
32675
+ if (delta === 0) return;
32676
+ event.preventDefault();
32677
+ setStoredSplit(clampSplit(storedSplit + delta));
32678
+ };
32657
32679
  const { root: root2, selectedSpan, stats } = React125.useMemo(() => {
32658
32680
  const tree = buildTraceTree(spans);
32659
32681
  const issues = spans.map((span) => getSpanIssues(span));
@@ -32752,7 +32774,7 @@ var TraceSidebar = ({ onClose, onSelectSpan, selectedSpanId, spanMatches, spans
32752
32774
  ),
32753
32775
  /* @__PURE__ */ jsx148(IconButton8, { "aria-label": "Close", "data-testid": EVENT_DETAILS_CLOSE_BUTTON_TEST_ID, onClick: onClose, size: "small", children: /* @__PURE__ */ jsx148(Close4, {}) })
32754
32776
  ] }),
32755
- /* @__PURE__ */ jsx148(Box20, { sx: { borderBottom: 1, borderColor: "divider", display: "flex", flex: "0 0 40%", flexDirection: "column", minHeight: 0, overflow: "auto", position: "relative" }, children: view === "waterfall" ? /* @__PURE__ */ jsx148(Waterfall, { onSelectSpan, selectedSpanId, spanMatches, spans }) : /* @__PURE__ */ jsx148(Box20, { sx: { height: "100%" }, children: /* @__PURE__ */ jsx148(ReactFlowProvider, { children: /* @__PURE__ */ jsx148(
32777
+ /* @__PURE__ */ jsx148(Box20, { ref: traceViewRef, sx: { borderBottom: 1, borderColor: "divider", display: "flex", flex: `0 0 ${String(storedSplit * 100)}%`, flexDirection: "column", minHeight: 0, overflow: "auto", position: "relative" }, children: view === "waterfall" ? /* @__PURE__ */ jsx148(Waterfall, { onSelectSpan, selectedSpanId, spanMatches, spans }) : /* @__PURE__ */ jsx148(Box20, { sx: { height: "100%" }, children: /* @__PURE__ */ jsx148(ReactFlowProvider, { children: /* @__PURE__ */ jsx148(
32756
32778
  TraceGraph,
32757
32779
  {
32758
32780
  hideMiniMap: true,
@@ -32762,6 +32784,35 @@ var TraceSidebar = ({ onClose, onSelectSpan, selectedSpanId, spanMatches, spans
32762
32784
  spans: { data: spans, error: void 0, loading: false }
32763
32785
  }
32764
32786
  ) }) }) }),
32787
+ /* @__PURE__ */ jsx148(Box20, { sx: { flexShrink: 0, position: "relative" }, children: /* @__PURE__ */ jsx148(
32788
+ Box20,
32789
+ {
32790
+ "aria-label": "Resize the operation details",
32791
+ "aria-orientation": "horizontal",
32792
+ "aria-valuemax": MAX_SPLIT * 100,
32793
+ "aria-valuemin": MIN_SPLIT * 100,
32794
+ "aria-valuenow": Math.round(storedSplit * 100),
32795
+ "data-testid": TRACE_SIDEBAR_SPLIT_HANDLE_TEST_ID,
32796
+ onKeyDown: handleSplitKeyDown,
32797
+ onPointerDown: handlePointerDown,
32798
+ onPointerMove: handleSplitPointerMove,
32799
+ onPointerUp: handlePointerUp,
32800
+ role: "separator",
32801
+ sx: {
32802
+ "&:hover, &:focus-visible, &:active": { backgroundColor: "primary.main", opacity: 0.5 },
32803
+ "cursor": "row-resize",
32804
+ "height": 6,
32805
+ "left": 0,
32806
+ "outline": 0,
32807
+ "position": "absolute",
32808
+ "right": 0,
32809
+ "top": -4,
32810
+ "touchAction": "none",
32811
+ "zIndex": 2
32812
+ },
32813
+ tabIndex: 0
32814
+ }
32815
+ ) }),
32765
32816
  /* @__PURE__ */ jsx148(Box20, { sx: { flex: 1, minHeight: 0 }, children: selectedSpan ? /* @__PURE__ */ jsx148(EventDetails, { selectedEvent: selectedSpan }) : /* @__PURE__ */ jsx148(Typography15, { color: "text.secondary", sx: { p: 3, textAlign: "center" }, variant: "body2", children: "The selected operation is not part of this trace." }) })
32766
32817
  ]
32767
32818
  }