uidex 0.5.1 → 0.5.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.
@@ -3520,16 +3520,18 @@ function createCursorTooltip(deps) {
3520
3520
  const renderBody = () => {
3521
3521
  body.replaceChildren();
3522
3522
  if (typeof currentContent === "string") {
3523
- applyColor(DEFAULT_TOOLTIP_COLOR);
3523
+ applyColor("#a1a1aa");
3524
+ el2.style.opacity = "0.6";
3524
3525
  body.append(document.createTextNode(currentContent));
3525
3526
  return;
3526
3527
  }
3527
3528
  if (!currentContent) return;
3529
+ el2.style.opacity = "1";
3528
3530
  const { entity, node } = currentContent;
3529
3531
  const style = KIND_STYLE[entity.kind];
3530
3532
  const demoted = entity.kind === "primitive";
3531
3533
  applyColor(style?.color ?? DEFAULT_TOOLTIP_COLOR);
3532
- el2.style.opacity = demoted ? "0.55" : "1";
3534
+ if (demoted) el2.style.opacity = "0.55";
3533
3535
  if (style) {
3534
3536
  const svg2 = (0, import_lucide2.createElement)(style.icon);
3535
3537
  svg2.setAttribute("aria-hidden", "true");
@@ -3646,7 +3648,8 @@ function createInspector(options) {
3646
3648
  resolveAll = (target) => defaultResolveAllMatches(target, registry),
3647
3649
  onHover,
3648
3650
  onSelect,
3649
- onCycle
3651
+ onCycle,
3652
+ onObscured
3650
3653
  } = options;
3651
3654
  let mounted = false;
3652
3655
  let currentEl = null;
@@ -3655,6 +3658,13 @@ function createInspector(options) {
3655
3658
  let layerIndex = 0;
3656
3659
  let lastCursor = { x: 0, y: 0 };
3657
3660
  const makeStack = () => stack.length > 0 ? { matches: stack, index: layerIndex, current: stack[layerIndex] } : null;
3661
+ const onDocumentLeave = () => {
3662
+ currentEl = null;
3663
+ stack = [];
3664
+ layerIndex = 0;
3665
+ session.highlight.unhover();
3666
+ onObscured?.(lastCursor);
3667
+ };
3658
3668
  const onMouseMove = (e) => {
3659
3669
  if (!(e.target instanceof Element)) return;
3660
3670
  const matches = resolveAll(e.target);
@@ -3707,6 +3717,7 @@ function createInspector(options) {
3707
3717
  document.head.appendChild(cursorStyleEl);
3708
3718
  }
3709
3719
  document.addEventListener("mousemove", onMouseMove);
3720
+ document.addEventListener("mouseleave", onDocumentLeave);
3710
3721
  document.addEventListener("click", onClick, true);
3711
3722
  document.addEventListener("contextmenu", onContextMenu, true);
3712
3723
  },
@@ -3721,6 +3732,7 @@ function createInspector(options) {
3721
3732
  cursorStyleEl = null;
3722
3733
  }
3723
3734
  document.removeEventListener("mousemove", onMouseMove);
3735
+ document.removeEventListener("mouseleave", onDocumentLeave);
3724
3736
  document.removeEventListener("click", onClick, true);
3725
3737
  document.removeEventListener("contextmenu", onContextMenu, true);
3726
3738
  session.highlight.unhover();
@@ -4619,6 +4631,10 @@ function createSurfaceShell(options) {
4619
4631
  },
4620
4632
  onCycle: (stack, cursor) => {
4621
4633
  showStack(stack, cursor);
4634
+ },
4635
+ onObscured: (cursor) => {
4636
+ overlay.hide();
4637
+ tooltip.update("iframe", cursor);
4622
4638
  }
4623
4639
  });
4624
4640
  cleanup.add(inspector);