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.
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  useUILintContext,
5
5
  useUILintStore
6
- } from "./chunk-BJD2V2LF.js";
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("div", { "data-ui-lint": true, children: [
322
- /* @__PURE__ */ jsx(BadgeAnimationStyles, {}),
323
- visibleBadges.filter((pos, idx, arr) => {
324
- const id = pos.element.id;
325
- return arr.findIndex((p) => p.element.id === id) === idx;
326
- }).map((nudgedPos) => {
327
- const distance = Math.hypot(
328
- nudgedPos.nudgedX - cursorPos.x,
329
- nudgedPos.nudgedY - cursorPos.y
330
- );
331
- const nearbyBadges = findNearbyBadges(
332
- visibleBadges,
333
- nudgedPos.nudgedX,
334
- nudgedPos.nudgedY,
335
- NEARBY_THRESHOLD
336
- );
337
- return /* @__PURE__ */ jsx(
338
- NudgedBadge,
339
- {
340
- position: nudgedPos,
341
- distance,
342
- nearbyBadges,
343
- cursorPos,
344
- onSelect: handleSelect
345
- },
346
- nudgedPos.element.id
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,
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ "use client";
3
+ import {
4
+ InspectionPanel
5
+ } from "./chunk-UF6KN2JJ.js";
6
+ import "./chunk-S4IWHBOQ.js";
7
+ import "./chunk-RAPUZC5J.js";
8
+ export {
9
+ InspectionPanel
10
+ };
@@ -3,8 +3,8 @@
3
3
  import {
4
4
  InspectedElementHighlight,
5
5
  LocatorOverlay
6
- } from "./chunk-YLTHKMTO.js";
7
- import "./chunk-BJD2V2LF.js";
6
+ } from "./chunk-LNLTM7N6.js";
7
+ import "./chunk-RAPUZC5J.js";
8
8
  export {
9
9
  InspectedElementHighlight,
10
10
  LocatorOverlay
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ "use client";
3
+ import {
4
+ UILintToolbar
5
+ } from "./chunk-OSYIUF52.js";
6
+ import "./chunk-S4IWHBOQ.js";
7
+ import "./chunk-RAPUZC5J.js";
8
+ export {
9
+ UILintToolbar
10
+ };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  useUILintContext
4
- } from "./chunk-BJD2V2LF.js";
4
+ } from "./chunk-RAPUZC5J.js";
5
5
 
6
6
  // src/components/ui-lint/LocatorOverlay.tsx
7
7
  import { useState, useEffect, useMemo } from "react";