ui-sniper 3.2.1 → 3.2.2
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/README.md +11 -2
- package/dist/index.js +50 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3623,7 +3623,7 @@ var styles_module_default4 = classNames5;
|
|
|
3623
3623
|
|
|
3624
3624
|
// src/components/xray-overlay/index.tsx
|
|
3625
3625
|
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3626
|
-
function XRayOverlay({ isActive, isDarkMode }) {
|
|
3626
|
+
function XRayOverlay({ isActive, isDarkMode, isFrozen }) {
|
|
3627
3627
|
const [hoveredNode, setHoveredNode] = useState4(null);
|
|
3628
3628
|
const [stylesData, setStylesData] = useState4({});
|
|
3629
3629
|
const [cursorPos, setCursorPos] = useState4({ x: 0, y: 0 });
|
|
@@ -3633,6 +3633,7 @@ function XRayOverlay({ isActive, isDarkMode }) {
|
|
|
3633
3633
|
return;
|
|
3634
3634
|
}
|
|
3635
3635
|
const onMouseMove = (e) => {
|
|
3636
|
+
if (isFrozen) return;
|
|
3636
3637
|
setCursorPos({ x: e.clientX, y: e.clientY });
|
|
3637
3638
|
const target = e.target;
|
|
3638
3639
|
if (target.closest("[data-ui-sniper-toolbar]") || target.closest("[data-ui-sniper-root]") || target.closest("[data-review-panel]")) {
|
|
@@ -3656,7 +3657,7 @@ function XRayOverlay({ isActive, isDarkMode }) {
|
|
|
3656
3657
|
};
|
|
3657
3658
|
window.addEventListener("mousemove", onMouseMove);
|
|
3658
3659
|
return () => window.removeEventListener("mousemove", onMouseMove);
|
|
3659
|
-
}, [isActive]);
|
|
3660
|
+
}, [isActive, isFrozen]);
|
|
3660
3661
|
if (!isActive || !hoveredNode) return null;
|
|
3661
3662
|
const rect = hoveredNode.getBoundingClientRect();
|
|
3662
3663
|
return createPortal2(
|
|
@@ -7796,20 +7797,6 @@ async function getDomCapture() {
|
|
|
7796
7797
|
}
|
|
7797
7798
|
}
|
|
7798
7799
|
function findCaptureTarget(captureX, captureY, captureW, captureH) {
|
|
7799
|
-
const cx = captureX + captureW / 2;
|
|
7800
|
-
const cy = captureY + captureH / 2;
|
|
7801
|
-
const elements = document.elementsFromPoint(cx, cy);
|
|
7802
|
-
for (const el of elements) {
|
|
7803
|
-
if (!(el instanceof HTMLElement)) continue;
|
|
7804
|
-
if (el.hasAttribute("data-ui-sniper-root")) continue;
|
|
7805
|
-
if (el.closest?.("[data-ui-sniper-root]")) continue;
|
|
7806
|
-
if (el.tagName === "CANVAS") continue;
|
|
7807
|
-
if (el === document.documentElement || el === document.body) continue;
|
|
7808
|
-
const rect = el.getBoundingClientRect();
|
|
7809
|
-
if (rect.left <= captureX + captureW * 0.1 && rect.top <= captureY + captureH * 0.1 && rect.right >= captureX + captureW * 0.9 && rect.bottom >= captureY + captureH * 0.9) {
|
|
7810
|
-
return el;
|
|
7811
|
-
}
|
|
7812
|
-
}
|
|
7813
7800
|
return document.body;
|
|
7814
7801
|
}
|
|
7815
7802
|
async function captureDomRegion(regionX, regionY, regionW, regionH, strokes, padding = 32, quality = 0.85, piiConfig) {
|
|
@@ -8865,7 +8852,7 @@ function SettingsPanel({
|
|
|
8865
8852
|
/* @__PURE__ */ jsx15("a", { className: styles_module_default11.settingsBrand, href: "https://hara-xy.com", target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ jsx15("svg", { width: "72", height: "16", viewBox: "0 0 500 151", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx15("text", { x: "10", y: "110", fontFamily: "'Arial Black', 'Impact', sans-serif", fontSize: "105", fontWeight: "900", fontStyle: "italic", letterSpacing: "-2", fill: "currentColor", children: "UI SNIPER" }) }) }),
|
|
8866
8853
|
/* @__PURE__ */ jsxs14("p", { className: styles_module_default11.settingsVersion, children: [
|
|
8867
8854
|
"v",
|
|
8868
|
-
"3.2.
|
|
8855
|
+
"3.2.2"
|
|
8869
8856
|
] }),
|
|
8870
8857
|
/* @__PURE__ */ jsx15(
|
|
8871
8858
|
"button",
|
|
@@ -10898,7 +10885,7 @@ function PageFeedbackToolbarCSS({
|
|
|
10898
10885
|
});
|
|
10899
10886
|
}, [effectiveReactMode]);
|
|
10900
10887
|
useEffect8(() => {
|
|
10901
|
-
if (!isActive || isDrawMode || isDesignMode ||
|
|
10888
|
+
if (!isActive || isDrawMode || isDesignMode || showReviewPanel) return;
|
|
10902
10889
|
const handleClick = (e) => {
|
|
10903
10890
|
if (justFinishedDragRef.current) {
|
|
10904
10891
|
justFinishedDragRef.current = false;
|
|
@@ -11051,7 +11038,7 @@ function PageFeedbackToolbarCSS({
|
|
|
11051
11038
|
};
|
|
11052
11039
|
}, [isActive, pendingMultiSelectElements, createMultiSelectPendingAnnotation]);
|
|
11053
11040
|
useEffect8(() => {
|
|
11054
|
-
if (!isActive || pendingAnnotation || isDrawMode || isDesignMode
|
|
11041
|
+
if (!isActive || pendingAnnotation || isDrawMode || isDesignMode) return;
|
|
11055
11042
|
const handleMouseDown = (e) => {
|
|
11056
11043
|
const target = e.composedPath()[0] || e.target;
|
|
11057
11044
|
if (closestCrossingShadow(target, "[data-feedback-toolbar]")) return;
|
|
@@ -11402,16 +11389,30 @@ function PageFeedbackToolbarCSS({
|
|
|
11402
11389
|
}
|
|
11403
11390
|
if (elToCapture) {
|
|
11404
11391
|
try {
|
|
11405
|
-
|
|
11392
|
+
let targetRect = elToCapture.getBoundingClientRect();
|
|
11393
|
+
let currentEl = elToCapture;
|
|
11394
|
+
const MAX_W = Math.min(800, window.innerWidth - 40);
|
|
11395
|
+
const MAX_H = Math.min(600, window.innerHeight - 40);
|
|
11396
|
+
for (let i = 0; i < 4; i++) {
|
|
11397
|
+
if (!currentEl || !currentEl.parentElement) break;
|
|
11398
|
+
if (currentEl.parentElement === document.body) break;
|
|
11399
|
+
const parentRect = currentEl.parentElement.getBoundingClientRect();
|
|
11400
|
+
if (parentRect.width <= MAX_W && parentRect.height <= MAX_H) {
|
|
11401
|
+
targetRect = parentRect;
|
|
11402
|
+
currentEl = currentEl.parentElement;
|
|
11403
|
+
} else {
|
|
11404
|
+
break;
|
|
11405
|
+
}
|
|
11406
|
+
}
|
|
11406
11407
|
const result = await captureDomRegion(
|
|
11407
|
-
|
|
11408
|
-
|
|
11409
|
-
|
|
11410
|
-
|
|
11408
|
+
targetRect.left,
|
|
11409
|
+
targetRect.top,
|
|
11410
|
+
targetRect.width,
|
|
11411
|
+
targetRect.height,
|
|
11411
11412
|
[],
|
|
11412
11413
|
// No strokes for standard annotation
|
|
11413
|
-
|
|
11414
|
-
//
|
|
11414
|
+
48,
|
|
11415
|
+
// 48px extra padding around the logical parent
|
|
11415
11416
|
0.8,
|
|
11416
11417
|
piiConfig.enabled ? piiConfig : void 0
|
|
11417
11418
|
);
|
|
@@ -12119,7 +12120,7 @@ function PageFeedbackToolbarCSS({
|
|
|
12119
12120
|
copyOutput();
|
|
12120
12121
|
}
|
|
12121
12122
|
}
|
|
12122
|
-
if (e.key === "x" || e.key === "X") {
|
|
12123
|
+
if ((e.key === "x" || e.key === "X") && e.shiftKey) {
|
|
12123
12124
|
if (annotations.length > 0 || designPlacements.length > 0 || rearrangeState) {
|
|
12124
12125
|
e.preventDefault();
|
|
12125
12126
|
hideTooltipsUntilMouseLeave();
|
|
@@ -12127,6 +12128,24 @@ function PageFeedbackToolbarCSS({
|
|
|
12127
12128
|
if (designPlacements.length > 0) setDesignPlacements([]);
|
|
12128
12129
|
if (rearrangeState) setRearrangeState(null);
|
|
12129
12130
|
}
|
|
12131
|
+
} else if ((e.key === "x" || e.key === "X") && !e.shiftKey) {
|
|
12132
|
+
e.preventDefault();
|
|
12133
|
+
hideTooltipsUntilMouseLeave();
|
|
12134
|
+
setIsXRayMode(!isXRayMode);
|
|
12135
|
+
}
|
|
12136
|
+
if (e.key === "l" || e.key === "L") {
|
|
12137
|
+
e.preventDefault();
|
|
12138
|
+
hideTooltipsUntilMouseLeave();
|
|
12139
|
+
if (isDesignMode) {
|
|
12140
|
+
closeDesignMode();
|
|
12141
|
+
} else {
|
|
12142
|
+
setIsDesignMode(true);
|
|
12143
|
+
}
|
|
12144
|
+
}
|
|
12145
|
+
if (e.key === "p" || e.key === "P") {
|
|
12146
|
+
e.preventDefault();
|
|
12147
|
+
hideTooltipsUntilMouseLeave();
|
|
12148
|
+
toggleFreeze();
|
|
12130
12149
|
}
|
|
12131
12150
|
if (e.key === "s" || e.key === "S") {
|
|
12132
12151
|
const hasValidWebhook = isValidUrl(settings.webhookUrl) || isValidUrl(webhookUrl || "");
|
|
@@ -12155,7 +12174,8 @@ function PageFeedbackToolbarCSS({
|
|
|
12155
12174
|
toggleFreeze,
|
|
12156
12175
|
copyOutput,
|
|
12157
12176
|
clearAll,
|
|
12158
|
-
pendingMultiSelectElements
|
|
12177
|
+
pendingMultiSelectElements,
|
|
12178
|
+
isXRayMode
|
|
12159
12179
|
]);
|
|
12160
12180
|
if (!mounted) return null;
|
|
12161
12181
|
if (isToolbarHidden) return null;
|
|
@@ -12478,7 +12498,7 @@ function PageFeedbackToolbarCSS({
|
|
|
12478
12498
|
),
|
|
12479
12499
|
/* @__PURE__ */ jsxs16("span", { className: styles_module_default6.buttonTooltip, children: [
|
|
12480
12500
|
"Clear your notes",
|
|
12481
|
-
/* @__PURE__ */ jsx17("span", { className: styles_module_default6.shortcut, children: "X" })
|
|
12501
|
+
/* @__PURE__ */ jsx17("span", { className: styles_module_default6.shortcut, children: "Shift+X" })
|
|
12482
12502
|
] })
|
|
12483
12503
|
] }),
|
|
12484
12504
|
/* @__PURE__ */ jsxs16("div", { className: styles_module_default6.buttonWrapper, children: [
|
|
@@ -12727,7 +12747,7 @@ function PageFeedbackToolbarCSS({
|
|
|
12727
12747
|
}
|
|
12728
12748
|
}
|
|
12729
12749
|
),
|
|
12730
|
-
/* @__PURE__ */ jsx17(XRayOverlay, { isActive: isXRayMode, isDarkMode }),
|
|
12750
|
+
/* @__PURE__ */ jsx17(XRayOverlay, { isActive: isXRayMode, isDarkMode, isFrozen: !!(pendingAnnotation || editingAnnotation) }),
|
|
12731
12751
|
(isDesignMode || designOverlayExiting) && /* @__PURE__ */ jsx17(
|
|
12732
12752
|
"div",
|
|
12733
12753
|
{
|