@copilotkit/web-inspector 1.75.2 → 1.76.0

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.umd.js CHANGED
@@ -2245,11 +2245,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2245
2245
  };
2246
2246
  }
2247
2247
  function clampSize(size, viewport, edgeMargin, minWidth, minHeight) {
2248
- const maxWidth = Math.max(minWidth, viewport.width - edgeMargin * 2);
2249
- const maxHeight = Math.max(minHeight, viewport.height - edgeMargin * 2);
2248
+ const maxWidth = Math.max(0, viewport.width - edgeMargin * 2);
2249
+ const maxHeight = Math.max(0, viewport.height - edgeMargin * 2);
2250
2250
  return {
2251
- width: clamp(size.width, minWidth, maxWidth),
2252
- height: clamp(size.height, minHeight, maxHeight)
2251
+ width: clamp(size.width, Math.min(minWidth, maxWidth), maxWidth),
2252
+ height: clamp(size.height, Math.min(minHeight, maxHeight), maxHeight)
2253
2253
  };
2254
2254
  }
2255
2255
  function constrainToViewport(state, position, viewport, edgeMargin) {
@@ -2919,7 +2919,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2919
2919
 
2920
2920
  //#endregion
2921
2921
  //#region package.json
2922
- var version = "1.75.2";
2922
+ var version = "1.76.0";
2923
2923
 
2924
2924
  //#endregion
2925
2925
  //#region src/lib/telemetry.ts
@@ -3731,8 +3731,18 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3731
3731
  const MIN_WINDOW_WIDTH = 880;
3732
3732
  const MIN_WINDOW_WIDTH_DOCKED_LEFT = 640;
3733
3733
  const MIN_WINDOW_HEIGHT = 480;
3734
+ /**
3735
+ * A window minimum that gives way on screens smaller than it, so the window
3736
+ * (and its close control) never runs past the viewport edge.
3737
+ */
3738
+ const viewportCappedMin = (px, unit) => `min(${px}px, calc(100${unit} - ${EDGE_MARGIN * 2}px))`;
3739
+ /**
3740
+ * The floating window zooms down with the screen, never below this, once the
3741
+ * viewport can no longer hold the default window at full size.
3742
+ */
3743
+ const MIN_WINDOW_SCALE = .8;
3734
3744
  const INSPECTOR_STORAGE_KEY = "cpk:inspector:state";
3735
- const LAUNCHER_MIN_SIZE = 51.84;
3745
+ const LAUNCHER_MIN_SIZE = 34;
3736
3746
  const LAUNCHER_MAX_SIZE = 62.208;
3737
3747
  const DEFAULT_BUTTON_SIZE = {
3738
3748
  width: LAUNCHER_MIN_SIZE,
@@ -9056,7 +9066,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
9056
9066
  const sidebarBounds = sidebar.getBoundingClientRect();
9057
9067
  this.sidebarRailTooltip = {
9058
9068
  label,
9059
- top: targetBounds.top - sidebarBounds.top + targetBounds.height / 2
9069
+ top: (targetBounds.top - sidebarBounds.top + targetBounds.height / 2) / this.getWindowScale()
9060
9070
  };
9061
9071
  this.requestUpdate();
9062
9072
  };
@@ -12923,6 +12933,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
12923
12933
  const isPoppedOut = this.isPoppedOut;
12924
12934
  const isTransitioning = this.hasAttribute("data-transitioning");
12925
12935
  const disableDrag = isDocked || isPoppedOut;
12936
+ const scale = this.getWindowScale();
12926
12937
  const windowStyles = isPoppedOut ? {
12927
12938
  position: "fixed",
12928
12939
  inset: "0",
@@ -12936,17 +12947,18 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
12936
12947
  ...this.getDockedWindowStyles(),
12937
12948
  overflowX: "hidden"
12938
12949
  } : {
12939
- width: `${Math.round(windowState.size.width)}px`,
12940
- height: `${Math.round(windowState.size.height)}px`,
12941
- minWidth: `${MIN_WINDOW_WIDTH}px`,
12942
- minHeight: `${MIN_WINDOW_HEIGHT}px`,
12943
- overflowX: "hidden"
12950
+ width: `${Math.round(windowState.size.width / scale)}px`,
12951
+ height: `${Math.round(windowState.size.height / scale)}px`,
12952
+ minWidth: viewportCappedMin(MIN_WINDOW_WIDTH, "vw"),
12953
+ minHeight: viewportCappedMin(MIN_WINDOW_HEIGHT, "vh"),
12954
+ overflowX: "hidden",
12955
+ ...scale < 1 ? { zoom: String(scale) } : {}
12944
12956
  };
12945
12957
  const hasContextDropdown = this.contextOptions.some((option) => option.key !== "all-agents");
12946
12958
  const viewportWidth = isPoppedOut ? (_this$popOut$win$inne = (_this$popOut2 = this.popOut) === null || _this$popOut2 === void 0 ? void 0 : _this$popOut2.win.innerWidth) !== null && _this$popOut$win$inne !== void 0 ? _this$popOut$win$inne : windowState.size.width : typeof window === "undefined" ? windowState.size.width : window.innerWidth;
12947
12959
  const automaticallyCollapsed = shouldUseIconRail({
12948
12960
  dockedLeft: this.dockMode === "docked-left",
12949
- width: viewportWidth
12961
+ width: viewportWidth / scale
12950
12962
  });
12951
12963
  const iconRail = this.sidebarCollapsed || automaticallyCollapsed;
12952
12964
  const contextDropdown = hasContextDropdown ? this.renderContextDropdown(iconRail) : lit.nothing;
@@ -13280,8 +13292,9 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
13280
13292
  var _this$shadowRoot5;
13281
13293
  const inspectorWindow = (_this$shadowRoot5 = this.shadowRoot) === null || _this$shadowRoot5 === void 0 ? void 0 : _this$shadowRoot5.querySelector(".inspector-window");
13282
13294
  if (inspectorWindow) {
13283
- const width = Math.round(Number.parseFloat(inspectorWindow.style.width));
13284
- const height = Math.round(Number.parseFloat(inspectorWindow.style.height));
13295
+ const scale = this.getWindowScale();
13296
+ const width = Math.round(Number.parseFloat(inspectorWindow.style.width) * scale);
13297
+ const height = Math.round(Number.parseFloat(inspectorWindow.style.height) * scale);
13285
13298
  if (Number.isFinite(width) && Number.isFinite(height)) return {
13286
13299
  width,
13287
13300
  height
@@ -13370,6 +13383,16 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
13370
13383
  height: window.innerHeight
13371
13384
  };
13372
13385
  }
13386
+ /**
13387
+ * Zoom for the floating window: 1 while the viewport holds the default
13388
+ * window, then proportional to the screen down to MIN_WINDOW_SCALE, so a
13389
+ * small screen gets the same layout smaller rather than a cramped one.
13390
+ */
13391
+ getWindowScale() {
13392
+ if (typeof window === "undefined" || this.isPoppedOut || this.dockMode !== "floating") return 1;
13393
+ const fit = Math.min(window.innerWidth / (DEFAULT_WINDOW_SIZE.width + EDGE_MARGIN * 2), window.innerHeight / (DEFAULT_WINDOW_SIZE.height + EDGE_MARGIN * 2));
13394
+ return Math.min(1, Math.max(MIN_WINDOW_SCALE, Math.round(fit * 20) / 20));
13395
+ }
13373
13396
  persistState() {
13374
13397
  var _this$pendingPersiste, _state$selectedContex;
13375
13398
  const state = {
@@ -13676,14 +13699,14 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
13676
13699
  bottom: "0",
13677
13700
  width: `${Math.round(this.contextState.window.size.width)}px`,
13678
13701
  height: "auto",
13679
- minWidth: `${MIN_WINDOW_WIDTH_DOCKED_LEFT}px`,
13702
+ minWidth: viewportCappedMin(MIN_WINDOW_WIDTH_DOCKED_LEFT, "vw"),
13680
13703
  borderRadius: "0"
13681
13704
  };
13682
13705
  return {
13683
13706
  width: `${Math.round(this.contextState.window.size.width)}px`,
13684
13707
  height: `${Math.round(this.contextState.window.size.height)}px`,
13685
- minWidth: `${MIN_WINDOW_WIDTH}px`,
13686
- minHeight: `${MIN_WINDOW_HEIGHT}px`
13708
+ minWidth: viewportCappedMin(MIN_WINDOW_WIDTH, "vw"),
13709
+ minHeight: viewportCappedMin(MIN_WINDOW_HEIGHT, "vh")
13687
13710
  };
13688
13711
  }
13689
13712
  handleDockClick(mode) {
@@ -15567,7 +15590,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
15567
15590
  <div style="display:flex;min-height:0;flex:1;overflow:hidden;">
15568
15591
  <!-- Left sidebar: thread list -->
15569
15592
  <div
15570
- style="display:${this.threadListCollapsed ? "none" : "flex"};width:${this.threadListWidth}px;flex-shrink:0;overflow:hidden;flex-direction:column;border-right:1px solid #DBDBE5;"
15593
+ style="display:${this.threadListCollapsed ? "none" : "flex"};width:${this.threadListWidth}px;max-width:calc(100% - 160px);flex-shrink:0;overflow:hidden;flex-direction:column;border-right:1px solid #DBDBE5;"
15571
15594
  >
15572
15595
  ${ephemeral ? lit.html`
15573
15596
  <button type="button" class="cpk-ephemeral-threads-banner"
@@ -17970,7 +17993,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
17970
17993
  is the button's sibling, can clear the mark by the same length. */
17971
17994
  --cpk-launcher-size: clamp(
17972
17995
  ${LAUNCHER_MIN_SIZE}px,
17973
- 7vw,
17996
+ calc(22px + 2.8vw),
17974
17997
  ${LAUNCHER_MAX_SIZE}px
17975
17998
  );
17976
17999
  }