uilint-react 0.1.45 → 0.1.47
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/{ElementBadges-RV7I6QXS.js → ElementBadges-N2N3CBLI.js} +73 -32
- package/dist/InspectionPanel-4P7I4QVY.js +10 -0
- package/dist/{LocatorOverlay-Z24VU27L.js → LocatorOverlay-L3EPYQEF.js} +2 -2
- package/dist/UILintToolbar-FWVC6MNG.js +10 -0
- package/dist/{chunk-YLTHKMTO.js → chunk-LNLTM7N6.js} +1 -1
- package/dist/{chunk-EQKEHJI4.js → chunk-OSYIUF52.js} +460 -387
- package/dist/{chunk-BJD2V2LF.js → chunk-RAPUZC5J.js} +4 -4
- package/dist/chunk-S4IWHBOQ.js +178 -0
- package/dist/{chunk-ZZOKTGSU.js → chunk-UF6KN2JJ.js} +18 -103
- package/dist/index.d.ts +5 -11
- package/dist/index.js +7 -6
- package/package.json +2 -2
- package/dist/InspectionPanel-QC6WR5IG.js +0 -10
- package/dist/UILintToolbar-5NK77IQJ.js +0 -10
- package/dist/chunk-W42PI2OF.js +0 -81
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import {
|
|
4
4
|
useUILintContext,
|
|
5
5
|
useUILintStore
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RAPUZC5J.js";
|
|
7
7
|
|
|
8
8
|
// src/components/ui-lint/ElementBadges.tsx
|
|
9
9
|
import React, { useState, useEffect, useCallback, useMemo } from "react";
|
|
@@ -129,6 +129,24 @@ function findNearbyBadges(positions, x, y, threshold) {
|
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
// src/components/ui-lint/visibility-utils.ts
|
|
133
|
+
function isElementCoveredByOverlay(element, badgeX, badgeY) {
|
|
134
|
+
const elementsAtPoint = document.elementsFromPoint(badgeX, badgeY);
|
|
135
|
+
for (const el of elementsAtPoint) {
|
|
136
|
+
if (el.hasAttribute("data-ui-lint")) continue;
|
|
137
|
+
if (el === element || element.contains(el)) continue;
|
|
138
|
+
if (el.contains(element)) continue;
|
|
139
|
+
const style = window.getComputedStyle(el);
|
|
140
|
+
const position = style.position;
|
|
141
|
+
const zIndex = parseInt(style.zIndex, 10);
|
|
142
|
+
const isOverlay = (position === "fixed" || position === "absolute") && (zIndex > 0 || style.zIndex === "auto" || style.zIndex === "inherit");
|
|
143
|
+
if (isOverlay) {
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
|
|
132
150
|
// src/components/ui-lint/ElementBadges.tsx
|
|
133
151
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
134
152
|
var STYLES = {
|
|
@@ -256,6 +274,9 @@ function ElementBadges() {
|
|
|
256
274
|
const y = rect.top - 8;
|
|
257
275
|
if (rect.top < -50 || rect.top > window.innerHeight + 50) continue;
|
|
258
276
|
if (rect.left < -50 || rect.left > window.innerWidth + 50) continue;
|
|
277
|
+
if (isElementCoveredByOverlay(element.element, x, y)) {
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
259
280
|
positions.push({ element, issue, x, y, rect });
|
|
260
281
|
}
|
|
261
282
|
setBadgePositions(positions);
|
|
@@ -316,37 +337,53 @@ function ElementBadges() {
|
|
|
316
337
|
}
|
|
317
338
|
return filtered;
|
|
318
339
|
}, [nudgedPositions, isAltKeyPressed, selectedFilePath, hoveredFilePath]);
|
|
340
|
+
const handleUILintInteraction = useCallback(
|
|
341
|
+
(e) => {
|
|
342
|
+
e.stopPropagation();
|
|
343
|
+
},
|
|
344
|
+
[]
|
|
345
|
+
);
|
|
319
346
|
if (!mounted) return null;
|
|
320
347
|
if (autoScanState.status === "idle") return null;
|
|
321
|
-
const content = /* @__PURE__ */ jsxs(
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
nudgedPos
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
348
|
+
const content = /* @__PURE__ */ jsxs(
|
|
349
|
+
"div",
|
|
350
|
+
{
|
|
351
|
+
"data-ui-lint": true,
|
|
352
|
+
onMouseDown: handleUILintInteraction,
|
|
353
|
+
onClick: handleUILintInteraction,
|
|
354
|
+
onKeyDown: handleUILintInteraction,
|
|
355
|
+
style: { pointerEvents: "none" },
|
|
356
|
+
children: [
|
|
357
|
+
/* @__PURE__ */ jsx(BadgeAnimationStyles, {}),
|
|
358
|
+
visibleBadges.filter((pos, idx, arr) => {
|
|
359
|
+
const id = pos.element.id;
|
|
360
|
+
return arr.findIndex((p) => p.element.id === id) === idx;
|
|
361
|
+
}).map((nudgedPos) => {
|
|
362
|
+
const distance = Math.hypot(
|
|
363
|
+
nudgedPos.nudgedX - cursorPos.x,
|
|
364
|
+
nudgedPos.nudgedY - cursorPos.y
|
|
365
|
+
);
|
|
366
|
+
const nearbyBadges = findNearbyBadges(
|
|
367
|
+
visibleBadges,
|
|
368
|
+
nudgedPos.nudgedX,
|
|
369
|
+
nudgedPos.nudgedY,
|
|
370
|
+
NEARBY_THRESHOLD
|
|
371
|
+
);
|
|
372
|
+
return /* @__PURE__ */ jsx(
|
|
373
|
+
NudgedBadge,
|
|
374
|
+
{
|
|
375
|
+
position: nudgedPos,
|
|
376
|
+
distance,
|
|
377
|
+
nearbyBadges,
|
|
378
|
+
cursorPos,
|
|
379
|
+
onSelect: handleSelect
|
|
380
|
+
},
|
|
381
|
+
nudgedPos.element.id
|
|
382
|
+
);
|
|
383
|
+
})
|
|
384
|
+
]
|
|
385
|
+
}
|
|
386
|
+
);
|
|
350
387
|
return createPortal(content, document.body);
|
|
351
388
|
}
|
|
352
389
|
function NudgedBadge({
|
|
@@ -415,7 +452,9 @@ function NudgedBadge({
|
|
|
415
452
|
boxShadow: "0 4px 20px rgba(0, 0, 0, 0.4)",
|
|
416
453
|
padding: "4px 0",
|
|
417
454
|
minWidth: "200px",
|
|
418
|
-
fontFamily: STYLES.font
|
|
455
|
+
fontFamily: STYLES.font,
|
|
456
|
+
pointerEvents: "auto"
|
|
457
|
+
// Re-enable pointer events for interactive dropdown
|
|
419
458
|
};
|
|
420
459
|
}, [snappedPosition]);
|
|
421
460
|
const scale = isExpanded ? 1.1 : getScaleFromDistance(distance);
|
|
@@ -468,7 +507,9 @@ function NudgedBadge({
|
|
|
468
507
|
cursor: "pointer",
|
|
469
508
|
transition: "transform 0.1s ease-out",
|
|
470
509
|
transform: `scale(${scale})`,
|
|
471
|
-
transformOrigin: "center center"
|
|
510
|
+
transformOrigin: "center center",
|
|
511
|
+
pointerEvents: "auto"
|
|
512
|
+
// Re-enable pointer events for interactive badge
|
|
472
513
|
},
|
|
473
514
|
"data-ui-lint": true,
|
|
474
515
|
onMouseEnter: handleMouseEnter,
|