@inspecto-dev/core 0.3.5 → 0.3.6
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.
|
@@ -2928,7 +2928,7 @@ function createBadge(ctx) {
|
|
|
2928
2928
|
const state = asLauncherContext(ctx);
|
|
2929
2929
|
const btn = document.createElement("div");
|
|
2930
2930
|
btn.className = badgeClass;
|
|
2931
|
-
btn.style.
|
|
2931
|
+
btn.style.visibility = "hidden";
|
|
2932
2932
|
const indicator = document.createElement("span");
|
|
2933
2933
|
indicator.className = `${badgeClass}-indicator`;
|
|
2934
2934
|
indicator.dataset.inspectoLauncherIndicator = "true";
|
|
@@ -3013,14 +3013,85 @@ function createBadge(ctx) {
|
|
|
3013
3013
|
titleBlock.append(titleSpan, stateSpan);
|
|
3014
3014
|
content.append(indicator, titleBlock);
|
|
3015
3015
|
btn.append(content, eyes, panel);
|
|
3016
|
+
let isDragging = false;
|
|
3017
|
+
let dragStartX = 0;
|
|
3018
|
+
let dragStartY = 0;
|
|
3019
|
+
let initialBadgeX = 0;
|
|
3020
|
+
let initialBadgeY = 0;
|
|
3021
|
+
const handleDragStart = (e) => {
|
|
3022
|
+
const target = e.target;
|
|
3023
|
+
if (target.closest(`.${badgeClass}-panel`) || target.closest(`[data-inspecto-launcher-action]`)) {
|
|
3024
|
+
return;
|
|
3025
|
+
}
|
|
3026
|
+
if (e.type === "mousedown" && e.button !== 0) return;
|
|
3027
|
+
const clientX = e.type === "touchstart" ? e.touches[0].clientX : e.clientX;
|
|
3028
|
+
const clientY = e.type === "touchstart" ? e.touches[0].clientY : e.clientY;
|
|
3029
|
+
dragStartX = clientX;
|
|
3030
|
+
dragStartY = clientY;
|
|
3031
|
+
const rect = btn.getBoundingClientRect();
|
|
3032
|
+
initialBadgeX = rect.left;
|
|
3033
|
+
initialBadgeY = rect.top;
|
|
3034
|
+
isDragging = false;
|
|
3035
|
+
document.addEventListener("mousemove", handleDragMove, { passive: false });
|
|
3036
|
+
document.addEventListener("mouseup", handleDragEnd);
|
|
3037
|
+
document.addEventListener("touchmove", handleDragMove, { passive: false });
|
|
3038
|
+
document.addEventListener("touchend", handleDragEnd);
|
|
3039
|
+
};
|
|
3040
|
+
const handleDragMove = (e) => {
|
|
3041
|
+
const clientX = e.type === "touchmove" ? e.touches[0].clientX : e.clientX;
|
|
3042
|
+
const clientY = e.type === "touchmove" ? e.touches[0].clientY : e.clientY;
|
|
3043
|
+
const dx = clientX - dragStartX;
|
|
3044
|
+
const dy = clientY - dragStartY;
|
|
3045
|
+
if (!isDragging && Math.hypot(dx, dy) > 5) {
|
|
3046
|
+
isDragging = true;
|
|
3047
|
+
btn.style.transition = "none";
|
|
3048
|
+
}
|
|
3049
|
+
if (isDragging) {
|
|
3050
|
+
e.preventDefault();
|
|
3051
|
+
const maxX = window.innerWidth - btn.offsetWidth;
|
|
3052
|
+
const maxY = window.innerHeight - btn.offsetHeight;
|
|
3053
|
+
let newX = initialBadgeX + dx;
|
|
3054
|
+
let newY = initialBadgeY + dy;
|
|
3055
|
+
newX = Math.max(0, Math.min(newX, maxX));
|
|
3056
|
+
newY = Math.max(0, Math.min(newY, maxY));
|
|
3057
|
+
btn.style.bottom = "auto";
|
|
3058
|
+
btn.style.right = "auto";
|
|
3059
|
+
btn.style.left = `${newX}px`;
|
|
3060
|
+
btn.style.top = `${newY}px`;
|
|
3061
|
+
}
|
|
3062
|
+
};
|
|
3063
|
+
const handleDragEnd = () => {
|
|
3064
|
+
document.removeEventListener("mousemove", handleDragMove);
|
|
3065
|
+
document.removeEventListener("mouseup", handleDragEnd);
|
|
3066
|
+
document.removeEventListener("touchmove", handleDragMove);
|
|
3067
|
+
document.removeEventListener("touchend", handleDragEnd);
|
|
3068
|
+
if (isDragging) {
|
|
3069
|
+
btn.style.transition = "";
|
|
3070
|
+
setTimeout(() => {
|
|
3071
|
+
isDragging = false;
|
|
3072
|
+
}, 0);
|
|
3073
|
+
}
|
|
3074
|
+
};
|
|
3075
|
+
btn.addEventListener("mousedown", handleDragStart);
|
|
3076
|
+
btn.addEventListener("touchstart", handleDragStart, { passive: false });
|
|
3016
3077
|
btn.addEventListener("click", (event) => {
|
|
3017
3078
|
var _a2, _b;
|
|
3079
|
+
if (isDragging) {
|
|
3080
|
+
event.preventDefault();
|
|
3081
|
+
event.stopPropagation();
|
|
3082
|
+
return;
|
|
3083
|
+
}
|
|
3018
3084
|
if ((_b = (_a2 = event.target).closest) == null ? void 0 : _b.call(_a2, `[data-inspecto-launcher-action]`)) return;
|
|
3019
3085
|
state.launcherPanelOpen = !state.launcherPanelOpen;
|
|
3020
3086
|
state.updateBadgeContent();
|
|
3021
3087
|
});
|
|
3022
3088
|
state.shadowRootEl.appendChild(btn);
|
|
3023
3089
|
updateLauncherEye(state);
|
|
3090
|
+
requestAnimationFrame(() => {
|
|
3091
|
+
requestAnimationFrame(() => {
|
|
3092
|
+
btn.style.visibility = "";
|
|
3093
|
+
});
|
|
3094
|
+
});
|
|
3024
3095
|
return btn;
|
|
3025
3096
|
}
|
|
3026
3097
|
function setPaused(ctx, value) {
|
|
@@ -3856,6 +3927,14 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
3856
3927
|
menu.style.visibility = "visible";
|
|
3857
3928
|
setTimeout(() => input.focus(), 0);
|
|
3858
3929
|
const onDocClick = (e) => {
|
|
3930
|
+
const eventTarget = e.target;
|
|
3931
|
+
if (eventTarget) {
|
|
3932
|
+
if (eventTarget.closest(
|
|
3933
|
+
'[role="dialog"], [role="menu"], [role="tooltip"], [role="presentation"], [role="listbox"], [data-radix-popper-content-wrapper], [data-radix-focus-guard]'
|
|
3934
|
+
)) {
|
|
3935
|
+
return;
|
|
3936
|
+
}
|
|
3937
|
+
}
|
|
3859
3938
|
const path = e.composedPath();
|
|
3860
3939
|
if (path.includes(menu)) return;
|
|
3861
3940
|
cleanup();
|
|
@@ -4672,6 +4751,14 @@ function handleMouseMove(ctx, event) {
|
|
|
4672
4751
|
state.lastPointerY = event.clientY;
|
|
4673
4752
|
state.updateLauncherEye();
|
|
4674
4753
|
if (state.cleanupMenu !== null) {
|
|
4754
|
+
const eventTarget = event.target;
|
|
4755
|
+
if (eventTarget) {
|
|
4756
|
+
if (eventTarget.closest(
|
|
4757
|
+
'[role="dialog"], [role="menu"], [role="tooltip"], [role="presentation"], [role="listbox"], [data-radix-popper-content-wrapper], [data-radix-focus-guard]'
|
|
4758
|
+
)) {
|
|
4759
|
+
return;
|
|
4760
|
+
}
|
|
4761
|
+
}
|
|
4675
4762
|
state.overlay.hide();
|
|
4676
4763
|
return;
|
|
4677
4764
|
}
|
|
@@ -4697,7 +4784,17 @@ function handleMouseMove(ctx, event) {
|
|
|
4697
4784
|
}
|
|
4698
4785
|
function handleTrigger(ctx, event) {
|
|
4699
4786
|
const state = asInteractionContext(ctx);
|
|
4700
|
-
if (state.cleanupMenu !== null)
|
|
4787
|
+
if (state.cleanupMenu !== null) {
|
|
4788
|
+
const eventTarget = event.target;
|
|
4789
|
+
if (eventTarget) {
|
|
4790
|
+
if (eventTarget.closest(
|
|
4791
|
+
'[role="dialog"], [role="menu"], [role="tooltip"], [role="presentation"], [role="listbox"], [data-radix-popper-content-wrapper], [data-radix-focus-guard]'
|
|
4792
|
+
)) {
|
|
4793
|
+
return;
|
|
4794
|
+
}
|
|
4795
|
+
}
|
|
4796
|
+
return;
|
|
4797
|
+
}
|
|
4701
4798
|
if (!state.isInspectorActive(event)) return;
|
|
4702
4799
|
const target = findInspectable(event.target);
|
|
4703
4800
|
if (!target) return;
|
|
@@ -5778,6 +5875,7 @@ function createOverlay(shadowRoot) {
|
|
|
5778
5875
|
overlay.style.display = "none";
|
|
5779
5876
|
const tooltip = document.createElement("div");
|
|
5780
5877
|
tooltip.className = tooltipClass;
|
|
5878
|
+
tooltip.style.display = "none";
|
|
5781
5879
|
const tagSpan = document.createElement("span");
|
|
5782
5880
|
tagSpan.className = tagClass;
|
|
5783
5881
|
const idSpan = document.createElement("span");
|
|
@@ -6401,4 +6499,4 @@ if (typeof customElements !== "undefined" && !customElements.get("inspecto-overl
|
|
|
6401
6499
|
export {
|
|
6402
6500
|
InspectoElement
|
|
6403
6501
|
};
|
|
6404
|
-
//# sourceMappingURL=component-
|
|
6502
|
+
//# sourceMappingURL=component-YOUXVPMF.js.map
|