@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.cjs CHANGED
@@ -2524,6 +2524,7 @@ var FILTER_CONSUMER_TEST_ID = "filter-consumer";
2524
2524
  var HIDDEN_OPS_NOTE_TEST_ID = "hidden-ops-note";
2525
2525
  var TRACE_SIDEBAR_TEST_ID = "trace-sidebar";
2526
2526
  var TRACE_SIDEBAR_RESIZE_HANDLE_TEST_ID = "trace-sidebar-resize-handle";
2527
+ var TRACE_SIDEBAR_SPLIT_HANDLE_TEST_ID = "trace-sidebar-split-handle";
2527
2528
  var TRACE_SIDEBAR_WATERFALL_BUTTON_TEST_ID = "trace-sidebar-waterfall-button";
2528
2529
  var TRACE_SIDEBAR_MAP_BUTTON_TEST_ID = "trace-sidebar-map-button";
2529
2530
  var TRACE_SIDEBAR_ROOT_HEADING_TEST_ID = "trace-sidebar-root-heading";
@@ -32600,12 +32601,20 @@ var MIN_WIDTH = 360;
32600
32601
  var MAX_WIDTH_SHARE = 0.8;
32601
32602
  var KEYBOARD_STEP = 24;
32602
32603
  var WIDTH_STORAGE_KEY = "appinspector-trace-sidebar-width";
32604
+ var DEFAULT_SPLIT = 0.4;
32605
+ var MIN_SPLIT = 0.15;
32606
+ var MAX_SPLIT = 0.7;
32607
+ var KEYBOARD_SPLIT_STEP = 0.05;
32608
+ var SPLIT_STORAGE_KEY = "appinspector-trace-sidebar-split";
32609
+ var clampSplit = (split2) => Math.min(MAX_SPLIT, Math.max(MIN_SPLIT, split2));
32603
32610
  var noop = () => void 0;
32604
32611
  var TraceSidebar = ({ onClose, onSelectSpan, selectedSpanId, spanMatches, spans }) => {
32605
32612
  const { requestTerms } = useDevSettings();
32606
32613
  const [storedWidth, setStoredWidth] = useLocalStorage(WIDTH_STORAGE_KEY, DEFAULT_WIDTH);
32614
+ const [storedSplit, setStoredSplit] = useLocalStorage(SPLIT_STORAGE_KEY, DEFAULT_SPLIT);
32607
32615
  const [view, setView] = React125.useState("waterfall");
32608
32616
  const sidebarRef = React125.useRef(null);
32617
+ const traceViewRef = React125.useRef(null);
32609
32618
  const clampWidth = (width) => {
32610
32619
  const parentWidth = sidebarRef.current?.parentElement?.clientWidth;
32611
32620
  const max2 = parentWidth === void 0 || parentWidth === 0 ? Number.POSITIVE_INFINITY : Math.max(MIN_WIDTH, parentWidth * MAX_WIDTH_SHARE);
@@ -32628,6 +32637,19 @@ var TraceSidebar = ({ onClose, onSelectSpan, selectedSpanId, spanMatches, spans
32628
32637
  event.preventDefault();
32629
32638
  setStoredWidth(clampWidth(storedWidth + delta));
32630
32639
  };
32640
+ const handleSplitPointerMove = (event) => {
32641
+ if (!event.currentTarget.hasPointerCapture(event.pointerId)) return;
32642
+ const sidebarHeight = sidebarRef.current?.clientHeight;
32643
+ const traceViewTop = traceViewRef.current?.getBoundingClientRect().top;
32644
+ if (!sidebarHeight || traceViewTop === void 0) return;
32645
+ setStoredSplit(clampSplit((event.clientY - traceViewTop) / sidebarHeight));
32646
+ };
32647
+ const handleSplitKeyDown = (event) => {
32648
+ const delta = event.key === "ArrowUp" ? -KEYBOARD_SPLIT_STEP : event.key === "ArrowDown" ? KEYBOARD_SPLIT_STEP : 0;
32649
+ if (delta === 0) return;
32650
+ event.preventDefault();
32651
+ setStoredSplit(clampSplit(storedSplit + delta));
32652
+ };
32631
32653
  const { root: root2, selectedSpan, stats } = React125.useMemo(() => {
32632
32654
  const tree = buildTraceTree(spans);
32633
32655
  const issues = spans.map((span) => getSpanIssues(span));
@@ -32726,7 +32748,7 @@ var TraceSidebar = ({ onClose, onSelectSpan, selectedSpanId, spanMatches, spans
32726
32748
  ),
32727
32749
  /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(import_material25.IconButton, { "aria-label": "Close", "data-testid": EVENT_DETAILS_CLOSE_BUTTON_TEST_ID, onClick: onClose, size: "small", children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(import_icons_material15.Close, {}) })
32728
32750
  ] }),
32729
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(import_material25.Box, { sx: { borderBottom: 1, borderColor: "divider", display: "flex", flex: "0 0 40%", flexDirection: "column", minHeight: 0, overflow: "auto", position: "relative" }, children: view === "waterfall" ? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(Waterfall, { onSelectSpan, selectedSpanId, spanMatches, spans }) : /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(import_material25.Box, { sx: { height: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(import_react61.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
32751
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(import_material25.Box, { 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__ */ (0, import_jsx_runtime148.jsx)(Waterfall, { onSelectSpan, selectedSpanId, spanMatches, spans }) : /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(import_material25.Box, { sx: { height: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(import_react61.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
32730
32752
  TraceGraph,
32731
32753
  {
32732
32754
  hideMiniMap: true,
@@ -32736,6 +32758,35 @@ var TraceSidebar = ({ onClose, onSelectSpan, selectedSpanId, spanMatches, spans
32736
32758
  spans: { data: spans, error: void 0, loading: false }
32737
32759
  }
32738
32760
  ) }) }) }),
32761
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(import_material25.Box, { sx: { flexShrink: 0, position: "relative" }, children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
32762
+ import_material25.Box,
32763
+ {
32764
+ "aria-label": "Resize the operation details",
32765
+ "aria-orientation": "horizontal",
32766
+ "aria-valuemax": MAX_SPLIT * 100,
32767
+ "aria-valuemin": MIN_SPLIT * 100,
32768
+ "aria-valuenow": Math.round(storedSplit * 100),
32769
+ "data-testid": TRACE_SIDEBAR_SPLIT_HANDLE_TEST_ID,
32770
+ onKeyDown: handleSplitKeyDown,
32771
+ onPointerDown: handlePointerDown,
32772
+ onPointerMove: handleSplitPointerMove,
32773
+ onPointerUp: handlePointerUp,
32774
+ role: "separator",
32775
+ sx: {
32776
+ "&:hover, &:focus-visible, &:active": { backgroundColor: "primary.main", opacity: 0.5 },
32777
+ "cursor": "row-resize",
32778
+ "height": 6,
32779
+ "left": 0,
32780
+ "outline": 0,
32781
+ "position": "absolute",
32782
+ "right": 0,
32783
+ "top": -4,
32784
+ "touchAction": "none",
32785
+ "zIndex": 2
32786
+ },
32787
+ tabIndex: 0
32788
+ }
32789
+ ) }),
32739
32790
  /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(import_material25.Box, { sx: { flex: 1, minHeight: 0 }, children: selectedSpan ? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(EventDetails, { selectedEvent: selectedSpan }) : /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(import_material25.Typography, { color: "text.secondary", sx: { p: 3, textAlign: "center" }, variant: "body2", children: "The selected operation is not part of this trace." }) })
32740
32791
  ]
32741
32792
  }