@localstack/appinspector-ui 1.0.207 → 1.0.209

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
@@ -2526,6 +2526,8 @@ var TRACE_SIDEBAR_SPLIT_HANDLE_TEST_ID = "trace-sidebar-split-handle";
2526
2526
  var TRACE_SIDEBAR_WATERFALL_BUTTON_TEST_ID = "trace-sidebar-waterfall-button";
2527
2527
  var TRACE_SIDEBAR_MAP_BUTTON_TEST_ID = "trace-sidebar-map-button";
2528
2528
  var TRACE_SIDEBAR_ROOT_HEADING_TEST_ID = "trace-sidebar-root-heading";
2529
+ var TRACE_SIDEBAR_MAXIMIZE_BUTTON_TEST_ID = "trace-sidebar-maximize-button";
2530
+ var TRACE_SIDEBAR_STATS_TEST_ID = "trace-sidebar-stats";
2529
2531
  var WATERFALL_TEST_ID = "waterfall";
2530
2532
  var WATERFALL_ROW_TEST_ID = "waterfall-row";
2531
2533
  var WATERFALL_ROW_TOGGLE_TEST_ID = "waterfall-row-toggle";
@@ -16817,7 +16819,7 @@ var getTraceBounds = (spans) => {
16817
16819
  };
16818
16820
 
16819
16821
  // src/components/trace-panel/trace-sidebar.tsx
16820
- import { Close as Close4 } from "@mui/icons-material";
16822
+ import { Close as Close4, CloseFullscreen, OpenInFull } from "@mui/icons-material";
16821
16823
  import { Box as Box20, IconButton as IconButton8, ToggleButton as ToggleButton3, ToggleButtonGroup as ToggleButtonGroup3, Typography as Typography15 } from "@mui/material";
16822
16824
  import { ReactFlowProvider } from "@xyflow/react";
16823
16825
  import * as React125 from "react";
@@ -32869,11 +32871,13 @@ var Waterfall = ({ onSelectSpan, selectedSpanId, spanMatches, spans }) => {
32869
32871
 
32870
32872
  // src/components/trace-panel/trace-sidebar.tsx
32871
32873
  import { jsx as jsx149, jsxs as jsxs137 } from "react/jsx-runtime";
32872
- var DEFAULT_WIDTH = 560;
32873
- var MIN_WIDTH = 360;
32874
+ var DEFAULT_WIDTH_SHARE = 0.75;
32874
32875
  var MAX_WIDTH_SHARE = 0.8;
32875
- var KEYBOARD_STEP = 24;
32876
- var WIDTH_STORAGE_KEY = "appinspector-trace-sidebar-width";
32876
+ var SNAP_WIDTH_SHARE = (MAX_WIDTH_SHARE + 1) / 2;
32877
+ var MIN_WIDTH = 360;
32878
+ var KEYBOARD_STEP = 0.05;
32879
+ var WIDTH_STORAGE_KEY = "appinspector-trace-sidebar-width-share";
32880
+ var MAXIMIZED_STORAGE_KEY = "appinspector-trace-sidebar-maximized";
32877
32881
  var DEFAULT_SPLIT = 0.4;
32878
32882
  var MIN_SPLIT = 0.15;
32879
32883
  var MAX_SPLIT = 0.7;
@@ -32882,23 +32886,39 @@ var SPLIT_STORAGE_KEY = "appinspector-trace-sidebar-split";
32882
32886
  var clampSplit = (split2) => Math.min(MAX_SPLIT, Math.max(MIN_SPLIT, split2));
32883
32887
  var noop = () => void 0;
32884
32888
  var TraceSidebar = ({ onClose, onSelectSpan, selectedSpanId, spanMatches, spans }) => {
32885
- const [storedWidth, setStoredWidth] = useLocalStorage(WIDTH_STORAGE_KEY, DEFAULT_WIDTH);
32889
+ const [storedWidth, setStoredWidth] = useLocalStorage(WIDTH_STORAGE_KEY, DEFAULT_WIDTH_SHARE);
32890
+ const [maximized, setMaximized] = useLocalStorage(MAXIMIZED_STORAGE_KEY, false);
32886
32891
  const [storedSplit, setStoredSplit] = useLocalStorage(SPLIT_STORAGE_KEY, DEFAULT_SPLIT);
32887
32892
  const [view, setView] = React125.useState("waterfall");
32888
32893
  const sidebarRef = React125.useRef(null);
32889
32894
  const traceViewRef = React125.useRef(null);
32890
- const clampWidth = (width) => {
32891
- const parentWidth = sidebarRef.current?.parentElement?.clientWidth;
32892
- const max2 = parentWidth === void 0 || parentWidth === 0 ? Number.POSITIVE_INFINITY : Math.max(MIN_WIDTH, parentWidth * MAX_WIDTH_SHARE);
32893
- return Math.round(Math.min(max2, Math.max(MIN_WIDTH, width)));
32895
+ const width = maximized ? 1 : storedWidth;
32896
+ const [parentWidth, setParentWidth] = React125.useState(0);
32897
+ React125.useLayoutEffect(() => {
32898
+ const parent = sidebarRef.current?.parentElement;
32899
+ if (!parent) return;
32900
+ const observer = new ResizeObserver(([entry]) => {
32901
+ if (entry) setParentWidth(entry.contentRect.width);
32902
+ });
32903
+ observer.observe(parent);
32904
+ return () => {
32905
+ observer.disconnect();
32906
+ };
32907
+ }, []);
32908
+ const minWidth = parentWidth === 0 ? 0 : Math.min(1, MIN_WIDTH / parentWidth);
32909
+ const resize = (share) => {
32910
+ const snap = share > SNAP_WIDTH_SHARE;
32911
+ setMaximized(snap);
32912
+ if (!snap) setStoredWidth(Math.min(MAX_WIDTH_SHARE, Math.max(minWidth, share)));
32894
32913
  };
32895
32914
  const handlePointerDown = (event) => {
32896
32915
  event.currentTarget.setPointerCapture(event.pointerId);
32897
32916
  };
32898
32917
  const handlePointerMove = (event) => {
32899
32918
  if (!event.currentTarget.hasPointerCapture(event.pointerId)) return;
32900
- const right = sidebarRef.current?.getBoundingClientRect().right ?? event.clientX;
32901
- setStoredWidth(clampWidth(right - event.clientX));
32919
+ const right = sidebarRef.current?.getBoundingClientRect().right;
32920
+ if (right === void 0 || parentWidth === 0) return;
32921
+ resize((right - event.clientX) / parentWidth);
32902
32922
  };
32903
32923
  const handlePointerUp = (event) => {
32904
32924
  event.currentTarget.releasePointerCapture(event.pointerId);
@@ -32907,7 +32927,8 @@ var TraceSidebar = ({ onClose, onSelectSpan, selectedSpanId, spanMatches, spans
32907
32927
  const delta = event.key === "ArrowLeft" ? KEYBOARD_STEP : event.key === "ArrowRight" ? -KEYBOARD_STEP : 0;
32908
32928
  if (delta === 0) return;
32909
32929
  event.preventDefault();
32910
- setStoredWidth(clampWidth(storedWidth + delta));
32930
+ const next = Math.round((width + delta) * 100) / 100;
32931
+ resize(maximized ? delta < 0 ? MAX_WIDTH_SHARE : 1 : next > MAX_WIDTH_SHARE ? 1 : next);
32911
32932
  };
32912
32933
  const handleSplitPointerMove = (event) => {
32913
32934
  if (!event.currentTarget.hasPointerCapture(event.pointerId)) return;
@@ -32953,10 +32974,10 @@ var TraceSidebar = ({ onClose, onSelectSpan, selectedSpanId, spanMatches, spans
32953
32974
  flexDirection: "column",
32954
32975
  flexShrink: 0,
32955
32976
  height: "100%",
32956
- maxWidth: `${String(MAX_WIDTH_SHARE * 100)}%`,
32977
+ maxWidth: "100%",
32957
32978
  minWidth: MIN_WIDTH,
32958
32979
  position: "relative",
32959
- width: storedWidth
32980
+ width: `${String(width * 100)}%`
32960
32981
  },
32961
32982
  children: [
32962
32983
  /* @__PURE__ */ jsx149(
@@ -32964,8 +32985,9 @@ var TraceSidebar = ({ onClose, onSelectSpan, selectedSpanId, spanMatches, spans
32964
32985
  {
32965
32986
  "aria-label": "Resize the sidebar",
32966
32987
  "aria-orientation": "vertical",
32967
- "aria-valuemin": MIN_WIDTH,
32968
- "aria-valuenow": storedWidth,
32988
+ "aria-valuemax": maximized ? 100 : MAX_WIDTH_SHARE * 100,
32989
+ "aria-valuemin": Math.round(minWidth * 100),
32990
+ "aria-valuenow": Math.round(width * 100),
32969
32991
  "data-testid": TRACE_SIDEBAR_RESIZE_HANDLE_TEST_ID,
32970
32992
  onKeyDown: handleKeyDown,
32971
32993
  onPointerDown: handlePointerDown,
@@ -32995,7 +33017,7 @@ var TraceSidebar = ({ onClose, onSelectSpan, selectedSpanId, spanMatches, spans
32995
33017
  /* @__PURE__ */ jsx149(Typography15, { noWrap: true, sx: { flex: "0 1 auto", fontWeight: 600, minWidth: 0 }, title: root2.operation_name, variant: "subtitle1", children: root2.operation_name }),
32996
33018
  rootResource !== "" && rootResource !== "*" && /* @__PURE__ */ jsx149(Typography15, { color: "text.secondary", noWrap: true, sx: { flex: "1 1 0", minWidth: 0 }, title: rootResource, variant: "body2", children: rootResource })
32997
33019
  ] }),
32998
- /* @__PURE__ */ jsx149(Typography15, { color: "text.secondary", variant: "caption", children: [
33020
+ /* @__PURE__ */ jsx149(Typography15, { color: "text.secondary", component: "div", "data-testid": TRACE_SIDEBAR_STATS_TEST_ID, variant: "caption", children: [
32999
33021
  formatDuration(stats.durationMs),
33000
33022
  pluralize(spans.length, "op"),
33001
33023
  ...stats.errors > 0 ? [pluralize(stats.errors, "error")] : [],
@@ -33018,6 +33040,9 @@ var TraceSidebar = ({ onClose, onSelectSpan, selectedSpanId, spanMatches, spans
33018
33040
  ]
33019
33041
  }
33020
33042
  ),
33043
+ /* @__PURE__ */ jsx149(IconButton8, { "aria-label": maximized ? "Restore" : "Maximize", "aria-pressed": maximized, "data-testid": TRACE_SIDEBAR_MAXIMIZE_BUTTON_TEST_ID, onClick: () => {
33044
+ setMaximized(!maximized);
33045
+ }, size: "small", children: maximized ? /* @__PURE__ */ jsx149(CloseFullscreen, { fontSize: "small" }) : /* @__PURE__ */ jsx149(OpenInFull, { fontSize: "small" }) }),
33021
33046
  /* @__PURE__ */ jsx149(IconButton8, { "aria-label": "Close", "data-testid": EVENT_DETAILS_CLOSE_BUTTON_TEST_ID, onClick: onClose, size: "small", children: /* @__PURE__ */ jsx149(Close4, {}) })
33022
33047
  ] }),
33023
33048
  /* @__PURE__ */ jsx149(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__ */ jsx149(Waterfall, { onSelectSpan, selectedSpanId, spanMatches, spans }) : /* @__PURE__ */ jsx149(Box20, { sx: { height: "100%" }, children: /* @__PURE__ */ jsx149(ReactFlowProvider, { children: /* @__PURE__ */ jsx149(
@@ -33941,7 +33966,9 @@ var SpansListPage = () => {
33941
33966
  display: "flex",
33942
33967
  flexDirection: "column",
33943
33968
  flexGrow: 1,
33944
- minWidth: 0
33969
+ minWidth: 0,
33970
+ // A full-width trace sidebar leaves the list no width: clip it rather than let it spill under.
33971
+ overflow: "hidden"
33945
33972
  },
33946
33973
  children: [
33947
33974
  /* @__PURE__ */ jsx151(