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.
@@ -3488,16 +3488,18 @@ function createCursorTooltip(deps) {
3488
3488
  const renderBody = () => {
3489
3489
  body.replaceChildren();
3490
3490
  if (typeof currentContent === "string") {
3491
- applyColor(DEFAULT_TOOLTIP_COLOR);
3491
+ applyColor("#a1a1aa");
3492
+ el2.style.opacity = "0.6";
3492
3493
  body.append(document.createTextNode(currentContent));
3493
3494
  return;
3494
3495
  }
3495
3496
  if (!currentContent) return;
3497
+ el2.style.opacity = "1";
3496
3498
  const { entity, node } = currentContent;
3497
3499
  const style = KIND_STYLE[entity.kind];
3498
3500
  const demoted = entity.kind === "primitive";
3499
3501
  applyColor(style?.color ?? DEFAULT_TOOLTIP_COLOR);
3500
- el2.style.opacity = demoted ? "0.55" : "1";
3502
+ if (demoted) el2.style.opacity = "0.55";
3501
3503
  if (style) {
3502
3504
  const svg2 = createLucideElement(style.icon);
3503
3505
  svg2.setAttribute("aria-hidden", "true");
@@ -3614,7 +3616,8 @@ function createInspector(options) {
3614
3616
  resolveAll = (target) => defaultResolveAllMatches(target, registry),
3615
3617
  onHover,
3616
3618
  onSelect,
3617
- onCycle
3619
+ onCycle,
3620
+ onObscured
3618
3621
  } = options;
3619
3622
  let mounted = false;
3620
3623
  let currentEl = null;
@@ -3623,6 +3626,13 @@ function createInspector(options) {
3623
3626
  let layerIndex = 0;
3624
3627
  let lastCursor = { x: 0, y: 0 };
3625
3628
  const makeStack = () => stack.length > 0 ? { matches: stack, index: layerIndex, current: stack[layerIndex] } : null;
3629
+ const onDocumentLeave = () => {
3630
+ currentEl = null;
3631
+ stack = [];
3632
+ layerIndex = 0;
3633
+ session.highlight.unhover();
3634
+ onObscured?.(lastCursor);
3635
+ };
3626
3636
  const onMouseMove = (e) => {
3627
3637
  if (!(e.target instanceof Element)) return;
3628
3638
  const matches = resolveAll(e.target);
@@ -3675,6 +3685,7 @@ function createInspector(options) {
3675
3685
  document.head.appendChild(cursorStyleEl);
3676
3686
  }
3677
3687
  document.addEventListener("mousemove", onMouseMove);
3688
+ document.addEventListener("mouseleave", onDocumentLeave);
3678
3689
  document.addEventListener("click", onClick, true);
3679
3690
  document.addEventListener("contextmenu", onContextMenu, true);
3680
3691
  },
@@ -3689,6 +3700,7 @@ function createInspector(options) {
3689
3700
  cursorStyleEl = null;
3690
3701
  }
3691
3702
  document.removeEventListener("mousemove", onMouseMove);
3703
+ document.removeEventListener("mouseleave", onDocumentLeave);
3692
3704
  document.removeEventListener("click", onClick, true);
3693
3705
  document.removeEventListener("contextmenu", onContextMenu, true);
3694
3706
  session.highlight.unhover();
@@ -4596,6 +4608,10 @@ function createSurfaceShell(options) {
4596
4608
  },
4597
4609
  onCycle: (stack, cursor) => {
4598
4610
  showStack(stack, cursor);
4611
+ },
4612
+ onObscured: (cursor) => {
4613
+ overlay.hide();
4614
+ tooltip.update("iframe", cursor);
4599
4615
  }
4600
4616
  });
4601
4617
  cleanup.add(inspector);