@agent-native/pinpoint 0.1.4 → 0.1.5
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.
|
@@ -2955,14 +2955,40 @@ var LINE_WIDTHS = [{
|
|
|
2955
2955
|
width: 8,
|
|
2956
2956
|
name: "Thick"
|
|
2957
2957
|
}];
|
|
2958
|
+
var EDGE_GAP = 16;
|
|
2959
|
+
var COLLAPSED_TOOLBAR_SIZE = 60;
|
|
2960
|
+
var EXPANDED_TOOLBAR_WIDTH = 320;
|
|
2961
|
+
var AGENT_SIDEBAR_SELECTOR = ".agent-sidebar-panel";
|
|
2962
|
+
function clampRightOffset(right, toolbarWidth) {
|
|
2963
|
+
if (typeof window === "undefined") return right;
|
|
2964
|
+
const maxRight = Math.max(0, window.innerWidth - toolbarWidth - EDGE_GAP);
|
|
2965
|
+
return Math.min(right, maxRight);
|
|
2966
|
+
}
|
|
2967
|
+
function getVisibleRightSidebarInset() {
|
|
2968
|
+
if (typeof window === "undefined") return 0;
|
|
2969
|
+
let inset = 0;
|
|
2970
|
+
for (const panel of document.querySelectorAll(AGENT_SIDEBAR_SELECTOR)) {
|
|
2971
|
+
const style2 = window.getComputedStyle(panel);
|
|
2972
|
+
if (style2.display === "none" || style2.visibility === "hidden" || panel.getAttribute("aria-hidden") === "true") {
|
|
2973
|
+
continue;
|
|
2974
|
+
}
|
|
2975
|
+
const rect = panel.getBoundingClientRect();
|
|
2976
|
+
const isVisible = rect.width > 0 && rect.height > 0;
|
|
2977
|
+
const isAnchoredToRight = rect.right >= window.innerWidth - 1 && rect.left < window.innerWidth - 1;
|
|
2978
|
+
if (!isVisible || !isAnchoredToRight) continue;
|
|
2979
|
+
inset = Math.max(inset, Math.ceil(window.innerWidth - rect.left));
|
|
2980
|
+
}
|
|
2981
|
+
return inset;
|
|
2982
|
+
}
|
|
2958
2983
|
var Toolbar = (props) => {
|
|
2959
2984
|
const [pos, setPos] = createSignal(props.position ? {
|
|
2960
2985
|
right: window.innerWidth - props.position.x,
|
|
2961
2986
|
bottom: window.innerHeight - props.position.y
|
|
2962
2987
|
} : {
|
|
2963
|
-
right:
|
|
2964
|
-
bottom:
|
|
2988
|
+
right: EDGE_GAP,
|
|
2989
|
+
bottom: EDGE_GAP
|
|
2965
2990
|
});
|
|
2991
|
+
const [reservedRight, setReservedRight] = createSignal(0);
|
|
2966
2992
|
const [dragging, setDragging] = createSignal(false);
|
|
2967
2993
|
const [dragStart, setDragStart] = createSignal({
|
|
2968
2994
|
x: 0,
|
|
@@ -2971,6 +2997,39 @@ var Toolbar = (props) => {
|
|
|
2971
2997
|
bottom: 0
|
|
2972
2998
|
});
|
|
2973
2999
|
const [didDrag, setDidDrag] = createSignal(false);
|
|
3000
|
+
onMount(() => {
|
|
3001
|
+
if (typeof window === "undefined") return;
|
|
3002
|
+
let resizeObserver;
|
|
3003
|
+
const updateReservedRight = () => {
|
|
3004
|
+
setReservedRight(getVisibleRightSidebarInset());
|
|
3005
|
+
resizeObserver?.disconnect();
|
|
3006
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
3007
|
+
resizeObserver = new ResizeObserver(() => {
|
|
3008
|
+
setReservedRight(getVisibleRightSidebarInset());
|
|
3009
|
+
});
|
|
3010
|
+
for (const panel of document.querySelectorAll(AGENT_SIDEBAR_SELECTOR)) {
|
|
3011
|
+
resizeObserver.observe(panel);
|
|
3012
|
+
}
|
|
3013
|
+
};
|
|
3014
|
+
updateReservedRight();
|
|
3015
|
+
const mutationObserver = new MutationObserver(updateReservedRight);
|
|
3016
|
+
mutationObserver.observe(document.body, {
|
|
3017
|
+
attributes: true,
|
|
3018
|
+
attributeFilter: ["class", "style", "aria-hidden"],
|
|
3019
|
+
childList: true,
|
|
3020
|
+
subtree: true
|
|
3021
|
+
});
|
|
3022
|
+
window.addEventListener("resize", updateReservedRight);
|
|
3023
|
+
onCleanup(() => {
|
|
3024
|
+
mutationObserver.disconnect();
|
|
3025
|
+
resizeObserver?.disconnect();
|
|
3026
|
+
window.removeEventListener("resize", updateReservedRight);
|
|
3027
|
+
});
|
|
3028
|
+
});
|
|
3029
|
+
const toolbarRight = () => {
|
|
3030
|
+
const toolbarWidth = props.expanded ? EXPANDED_TOOLBAR_WIDTH : COLLAPSED_TOOLBAR_SIZE;
|
|
3031
|
+
return clampRightOffset((props.expanded ? EDGE_GAP : pos().right) + reservedRight(), toolbarWidth);
|
|
3032
|
+
};
|
|
2974
3033
|
function handleMouseDown(e) {
|
|
2975
3034
|
if (props.expanded) return;
|
|
2976
3035
|
setDragging(true);
|
|
@@ -2986,9 +3045,10 @@ var Toolbar = (props) => {
|
|
|
2986
3045
|
const start = dragStart();
|
|
2987
3046
|
const dx = e2.clientX - start.x;
|
|
2988
3047
|
const dy = e2.clientY - start.y;
|
|
3048
|
+
const maxRight = Math.max(0, window.innerWidth - reservedRight() - COLLAPSED_TOOLBAR_SIZE);
|
|
2989
3049
|
setPos({
|
|
2990
|
-
right: Math.max(0, Math.min(
|
|
2991
|
-
bottom: Math.max(0, Math.min(window.innerHeight -
|
|
3050
|
+
right: Math.max(0, Math.min(maxRight, start.right - dx)),
|
|
3051
|
+
bottom: Math.max(0, Math.min(window.innerHeight - COLLAPSED_TOOLBAR_SIZE, start.bottom - dy))
|
|
2992
3052
|
});
|
|
2993
3053
|
};
|
|
2994
3054
|
const handleUp = () => {
|
|
@@ -3347,10 +3407,10 @@ var Toolbar = (props) => {
|
|
|
3347
3407
|
createRenderEffect((_p$) => {
|
|
3348
3408
|
var _v$ = `pp-toolbar ${props.expanded ? "pp-toolbar--expanded" : "pp-toolbar--collapsed"}`, _v$2 = {
|
|
3349
3409
|
...props.expanded ? {
|
|
3350
|
-
bottom:
|
|
3351
|
-
right:
|
|
3410
|
+
bottom: `${EDGE_GAP}px`,
|
|
3411
|
+
right: `${toolbarRight()}px`
|
|
3352
3412
|
} : {
|
|
3353
|
-
right: `${
|
|
3413
|
+
right: `${toolbarRight()}px`,
|
|
3354
3414
|
bottom: `${pos().bottom}px`
|
|
3355
3415
|
}
|
|
3356
3416
|
};
|
|
@@ -4867,4 +4927,4 @@ export {
|
|
|
4867
4927
|
mountPinpoint,
|
|
4868
4928
|
unmountPinpoint
|
|
4869
4929
|
};
|
|
4870
|
-
//# sourceMappingURL=chunk-
|
|
4930
|
+
//# sourceMappingURL=chunk-SI7E6GTM.js.map
|