@tutti-os/workbench-surface 0.0.107 → 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 +59 -6
- package/dist/index.js.map +1 -1
- package/dist/styles/workbench.css +8 -2
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -8989,6 +8989,22 @@ function resolveMinimizedStackTrackTranslateXPx(input) {
|
|
|
8989
8989
|
return -fanXPx;
|
|
8990
8990
|
}
|
|
8991
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
|
+
|
|
8992
9008
|
// src/host/WorkbenchHostDockPopup.tsx
|
|
8993
9009
|
import { Fragment as Fragment5, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
8994
9010
|
var dockPopupCardWidthPx = 165;
|
|
@@ -9076,7 +9092,6 @@ function WorkbenchHostDockPopup({
|
|
|
9076
9092
|
onRunDockRetentionAction,
|
|
9077
9093
|
onSelectNode,
|
|
9078
9094
|
onShowAllWindows,
|
|
9079
|
-
openLabel,
|
|
9080
9095
|
onQuit,
|
|
9081
9096
|
placement = "bottom",
|
|
9082
9097
|
quitLabel,
|
|
@@ -9099,6 +9114,7 @@ function WorkbenchHostDockPopup({
|
|
|
9099
9114
|
const minimizedStackViewportRef = useRef7(null);
|
|
9100
9115
|
const [pointer, setPointer] = useState7(null);
|
|
9101
9116
|
const [minimizedStackScrollOffset, setMinimizedStackScrollOffset] = useState7(0);
|
|
9117
|
+
const [verticalClampOffsetPx, setVerticalClampOffsetPx] = useState7(0);
|
|
9102
9118
|
const [capturedPreviewByMemoryKey, setCapturedPreviewByMemoryKey] = useState7({});
|
|
9103
9119
|
const columnCount = isContextMenu ? 1 : Math.min(Math.max(items.length + createCardCount, 1), 3);
|
|
9104
9120
|
const popupWidthPx = isContextMenu ? 268 : columnCount * dockPopupCardWidthPx + Math.max(0, columnCount - 1) * dockPopupGridGapPx + dockPopupPanelPaddingInlinePx * 2 + dockPopupPanelBorderInlinePx;
|
|
@@ -9145,7 +9161,8 @@ function WorkbenchHostDockPopup({
|
|
|
9145
9161
|
leftGutterPx: minimizedStackLeftGutterPx
|
|
9146
9162
|
}) : placement === "left" ? anchorRect.left + anchorRect.width + dockPopupPlacementGapPx : anchorRect.left + anchorRect.width / 2,
|
|
9147
9163
|
top: isLeftMinimizedStack ? resolveMinimizedStackPopupTopPx({ anchorTop: anchorRect.top }) : placement === "left" ? popupCenterY : anchorRect.top - dockPopupPlacementGapPx,
|
|
9148
|
-
...isLeftMinimizedStack ? { zIndex: dockPopupMinimizedStackPopupZIndex } : {}
|
|
9164
|
+
...isLeftMinimizedStack ? { zIndex: dockPopupMinimizedStackPopupZIndex } : {},
|
|
9165
|
+
...isMinimizedStack ? {} : { "--desktop-dock-popup-clamp-offset": `${verticalClampOffsetPx}px` }
|
|
9149
9166
|
};
|
|
9150
9167
|
const minimizedStackMaxScrollOffset = Math.max(
|
|
9151
9168
|
0,
|
|
@@ -9196,6 +9213,45 @@ function WorkbenchHostDockPopup({
|
|
|
9196
9213
|
viewportWidth: window.innerWidth
|
|
9197
9214
|
});
|
|
9198
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
|
+
]);
|
|
9199
9255
|
const registerCard = useCallback9((nodeId) => {
|
|
9200
9256
|
const existing = cardRefCallbacksRef.current.get(nodeId);
|
|
9201
9257
|
if (existing) {
|
|
@@ -9538,7 +9594,6 @@ function WorkbenchHostDockPopup({
|
|
|
9538
9594
|
onRunDockRetentionAction,
|
|
9539
9595
|
onSelectNode,
|
|
9540
9596
|
onShowAllWindows,
|
|
9541
|
-
openLabel,
|
|
9542
9597
|
quitLabel,
|
|
9543
9598
|
showAllWindowsLabel,
|
|
9544
9599
|
showOpen: showOpen === true
|
|
@@ -9675,7 +9730,6 @@ function WorkbenchHostDockContextMenu({
|
|
|
9675
9730
|
onRunDockRetentionAction,
|
|
9676
9731
|
onSelectNode,
|
|
9677
9732
|
onShowAllWindows,
|
|
9678
|
-
openLabel,
|
|
9679
9733
|
quitLabel,
|
|
9680
9734
|
showAllWindowsLabel,
|
|
9681
9735
|
showOpen
|
|
@@ -9732,7 +9786,7 @@ function WorkbenchHostDockContextMenu({
|
|
|
9732
9786
|
{
|
|
9733
9787
|
disabled: !showOpen,
|
|
9734
9788
|
icon: /* @__PURE__ */ jsx11(FileCreateIcon, { "aria-hidden": "true", className: "size-4" }),
|
|
9735
|
-
label:
|
|
9789
|
+
label: newWindowLabel,
|
|
9736
9790
|
onSelect: onCreateNew
|
|
9737
9791
|
}
|
|
9738
9792
|
) : null,
|
|
@@ -11882,7 +11936,6 @@ function WorkbenchHostDock({
|
|
|
11882
11936
|
label: popupEntry.entry.label,
|
|
11883
11937
|
labelMode: popupEntry.entry.popupCardLabelMode,
|
|
11884
11938
|
newWindowLabel: i18n.t("newWindow"),
|
|
11885
|
-
openLabel: i18n.t("dockContextMenu.open"),
|
|
11886
11939
|
closeWindowLabel: (title) => i18n.t("closeWindow", { title }),
|
|
11887
11940
|
fullscreenLabel: i18n.t("dockContextMenu.fullscreen"),
|
|
11888
11941
|
hideLabel: i18n.t("dockContextMenu.hide"),
|