@tutti-os/workbench-surface 0.0.106 → 0.0.108

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
@@ -8040,9 +8040,8 @@ function resolveDockMagnificationHitBounds(slotRects, dockPlacement, crossAxisPa
8040
8040
  crossEnd = Math.max(crossEnd, rect.bottom);
8041
8041
  }
8042
8042
  }
8043
- const effectiveCrossAxisEndPadding = dockPlacement === "left" ? crossAxisPadding + (DOCK_ICON_PEAK_SIZE - DOCK_ICON_BASE_SIZE) : crossAxisPadding;
8044
8043
  return {
8045
- crossEnd: crossEnd + effectiveCrossAxisEndPadding,
8044
+ crossEnd: crossEnd + crossAxisPadding,
8046
8045
  crossStart: crossStart - crossAxisPadding,
8047
8046
  mainEnd,
8048
8047
  mainStart
@@ -8990,6 +8989,22 @@ function resolveMinimizedStackTrackTranslateXPx(input) {
8990
8989
  return -fanXPx;
8991
8990
  }
8992
8991
 
8992
+ // src/host/dockPopupViewportClamp.ts
8993
+ function resolveDockPopupVerticalClampOffsetPx(input) {
8994
+ const marginPx = input.marginPx ?? 8;
8995
+ const minTopPx = marginPx;
8996
+ const maxBottomPx = input.viewportHeightPx - marginPx;
8997
+ if (input.naturalTopPx < minTopPx) {
8998
+ return minTopPx - input.naturalTopPx;
8999
+ }
9000
+ if (input.naturalBottomPx > maxBottomPx) {
9001
+ const shiftUpPx = input.naturalBottomPx - maxBottomPx;
9002
+ const resultingTopPx = input.naturalTopPx - shiftUpPx;
9003
+ return resultingTopPx < minTopPx ? minTopPx - input.naturalTopPx : -shiftUpPx;
9004
+ }
9005
+ return 0;
9006
+ }
9007
+
8993
9008
  // src/host/WorkbenchHostDockPopup.tsx
8994
9009
  import { Fragment as Fragment5, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
8995
9010
  var dockPopupCardWidthPx = 165;
@@ -9077,7 +9092,6 @@ function WorkbenchHostDockPopup({
9077
9092
  onRunDockRetentionAction,
9078
9093
  onSelectNode,
9079
9094
  onShowAllWindows,
9080
- openLabel,
9081
9095
  onQuit,
9082
9096
  placement = "bottom",
9083
9097
  quitLabel,
@@ -9100,6 +9114,7 @@ function WorkbenchHostDockPopup({
9100
9114
  const minimizedStackViewportRef = useRef7(null);
9101
9115
  const [pointer, setPointer] = useState7(null);
9102
9116
  const [minimizedStackScrollOffset, setMinimizedStackScrollOffset] = useState7(0);
9117
+ const [verticalClampOffsetPx, setVerticalClampOffsetPx] = useState7(0);
9103
9118
  const [capturedPreviewByMemoryKey, setCapturedPreviewByMemoryKey] = useState7({});
9104
9119
  const columnCount = isContextMenu ? 1 : Math.min(Math.max(items.length + createCardCount, 1), 3);
9105
9120
  const popupWidthPx = isContextMenu ? 268 : columnCount * dockPopupCardWidthPx + Math.max(0, columnCount - 1) * dockPopupGridGapPx + dockPopupPanelPaddingInlinePx * 2 + dockPopupPanelBorderInlinePx;
@@ -9146,7 +9161,8 @@ function WorkbenchHostDockPopup({
9146
9161
  leftGutterPx: minimizedStackLeftGutterPx
9147
9162
  }) : placement === "left" ? anchorRect.left + anchorRect.width + dockPopupPlacementGapPx : anchorRect.left + anchorRect.width / 2,
9148
9163
  top: isLeftMinimizedStack ? resolveMinimizedStackPopupTopPx({ anchorTop: anchorRect.top }) : placement === "left" ? popupCenterY : anchorRect.top - dockPopupPlacementGapPx,
9149
- ...isLeftMinimizedStack ? { zIndex: dockPopupMinimizedStackPopupZIndex } : {}
9164
+ ...isLeftMinimizedStack ? { zIndex: dockPopupMinimizedStackPopupZIndex } : {},
9165
+ ...isMinimizedStack ? {} : { "--desktop-dock-popup-clamp-offset": `${verticalClampOffsetPx}px` }
9150
9166
  };
9151
9167
  const minimizedStackMaxScrollOffset = Math.max(
9152
9168
  0,
@@ -9197,6 +9213,45 @@ function WorkbenchHostDockPopup({
9197
9213
  viewportWidth: window.innerWidth
9198
9214
  });
9199
9215
  }, [debugDiagnostics, popupDiagnosticKey]);
9216
+ useLayoutEffect4(() => {
9217
+ if (isMinimizedStack || typeof window === "undefined") {
9218
+ return;
9219
+ }
9220
+ const rootElement = popupRootRef.current;
9221
+ const panelElement = rootElement?.querySelector(
9222
+ "[data-desktop-dock-popup-panel]"
9223
+ );
9224
+ if (!panelElement) {
9225
+ return;
9226
+ }
9227
+ const measureAndClamp = () => {
9228
+ const panelHeightPx = panelElement.offsetHeight;
9229
+ const naturalTopPx = placement === "left" ? popupCenterY - panelHeightPx / 2 : anchorRect.top - dockPopupPlacementGapPx - panelHeightPx;
9230
+ const naturalBottomPx = placement === "left" ? popupCenterY + panelHeightPx / 2 : anchorRect.top - dockPopupPlacementGapPx;
9231
+ const offsetPx = resolveDockPopupVerticalClampOffsetPx({
9232
+ naturalBottomPx,
9233
+ naturalTopPx,
9234
+ viewportHeightPx: window.innerHeight
9235
+ });
9236
+ setVerticalClampOffsetPx(
9237
+ (current) => current === offsetPx ? current : offsetPx
9238
+ );
9239
+ };
9240
+ measureAndClamp();
9241
+ const resizeObserver = new ResizeObserver(measureAndClamp);
9242
+ resizeObserver.observe(panelElement);
9243
+ window.addEventListener("resize", measureAndClamp);
9244
+ return () => {
9245
+ resizeObserver.disconnect();
9246
+ window.removeEventListener("resize", measureAndClamp);
9247
+ };
9248
+ }, [
9249
+ anchorRect.top,
9250
+ isMinimizedStack,
9251
+ placement,
9252
+ popupCenterY,
9253
+ popupDiagnosticKey
9254
+ ]);
9200
9255
  const registerCard = useCallback9((nodeId) => {
9201
9256
  const existing = cardRefCallbacksRef.current.get(nodeId);
9202
9257
  if (existing) {
@@ -9539,7 +9594,6 @@ function WorkbenchHostDockPopup({
9539
9594
  onRunDockRetentionAction,
9540
9595
  onSelectNode,
9541
9596
  onShowAllWindows,
9542
- openLabel,
9543
9597
  quitLabel,
9544
9598
  showAllWindowsLabel,
9545
9599
  showOpen: showOpen === true
@@ -9676,7 +9730,6 @@ function WorkbenchHostDockContextMenu({
9676
9730
  onRunDockRetentionAction,
9677
9731
  onSelectNode,
9678
9732
  onShowAllWindows,
9679
- openLabel,
9680
9733
  quitLabel,
9681
9734
  showAllWindowsLabel,
9682
9735
  showOpen
@@ -9733,7 +9786,7 @@ function WorkbenchHostDockContextMenu({
9733
9786
  {
9734
9787
  disabled: !showOpen,
9735
9788
  icon: /* @__PURE__ */ jsx11(FileCreateIcon, { "aria-hidden": "true", className: "size-4" }),
9736
- label: openLabel,
9789
+ label: newWindowLabel,
9737
9790
  onSelect: onCreateNew
9738
9791
  }
9739
9792
  ) : null,
@@ -11883,7 +11936,6 @@ function WorkbenchHostDock({
11883
11936
  label: popupEntry.entry.label,
11884
11937
  labelMode: popupEntry.entry.popupCardLabelMode,
11885
11938
  newWindowLabel: i18n.t("newWindow"),
11886
- openLabel: i18n.t("dockContextMenu.open"),
11887
11939
  closeWindowLabel: (title) => i18n.t("closeWindow", { title }),
11888
11940
  fullscreenLabel: i18n.t("dockContextMenu.fullscreen"),
11889
11941
  hideLabel: i18n.t("dockContextMenu.hide"),