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.
package/dist/index.cjs CHANGED
@@ -3563,16 +3563,18 @@ function createCursorTooltip(deps) {
3563
3563
  const renderBody = () => {
3564
3564
  body.replaceChildren();
3565
3565
  if (typeof currentContent === "string") {
3566
- applyColor(DEFAULT_TOOLTIP_COLOR);
3566
+ applyColor("#a1a1aa");
3567
+ el2.style.opacity = "0.6";
3567
3568
  body.append(document.createTextNode(currentContent));
3568
3569
  return;
3569
3570
  }
3570
3571
  if (!currentContent) return;
3572
+ el2.style.opacity = "1";
3571
3573
  const { entity, node } = currentContent;
3572
3574
  const style = KIND_STYLE[entity.kind];
3573
3575
  const demoted = entity.kind === "primitive";
3574
3576
  applyColor(style?.color ?? DEFAULT_TOOLTIP_COLOR);
3575
- el2.style.opacity = demoted ? "0.55" : "1";
3577
+ if (demoted) el2.style.opacity = "0.55";
3576
3578
  if (style) {
3577
3579
  const svg2 = (0, import_lucide2.createElement)(style.icon);
3578
3580
  svg2.setAttribute("aria-hidden", "true");
@@ -3733,7 +3735,8 @@ function createInspector(options) {
3733
3735
  resolveAll = (target) => defaultResolveAllMatches(target, registry),
3734
3736
  onHover,
3735
3737
  onSelect,
3736
- onCycle
3738
+ onCycle,
3739
+ onObscured
3737
3740
  } = options;
3738
3741
  let mounted = false;
3739
3742
  let currentEl = null;
@@ -3742,6 +3745,13 @@ function createInspector(options) {
3742
3745
  let layerIndex = 0;
3743
3746
  let lastCursor = { x: 0, y: 0 };
3744
3747
  const makeStack = () => stack.length > 0 ? { matches: stack, index: layerIndex, current: stack[layerIndex] } : null;
3748
+ const onDocumentLeave = () => {
3749
+ currentEl = null;
3750
+ stack = [];
3751
+ layerIndex = 0;
3752
+ session.highlight.unhover();
3753
+ onObscured?.(lastCursor);
3754
+ };
3745
3755
  const onMouseMove = (e) => {
3746
3756
  if (!(e.target instanceof Element)) return;
3747
3757
  const matches = resolveAll(e.target);
@@ -3794,6 +3804,7 @@ function createInspector(options) {
3794
3804
  document.head.appendChild(cursorStyleEl);
3795
3805
  }
3796
3806
  document.addEventListener("mousemove", onMouseMove);
3807
+ document.addEventListener("mouseleave", onDocumentLeave);
3797
3808
  document.addEventListener("click", onClick, true);
3798
3809
  document.addEventListener("contextmenu", onContextMenu, true);
3799
3810
  },
@@ -3808,6 +3819,7 @@ function createInspector(options) {
3808
3819
  cursorStyleEl = null;
3809
3820
  }
3810
3821
  document.removeEventListener("mousemove", onMouseMove);
3822
+ document.removeEventListener("mouseleave", onDocumentLeave);
3811
3823
  document.removeEventListener("click", onClick, true);
3812
3824
  document.removeEventListener("contextmenu", onContextMenu, true);
3813
3825
  session.highlight.unhover();
@@ -4706,6 +4718,10 @@ function createSurfaceShell(options) {
4706
4718
  },
4707
4719
  onCycle: (stack, cursor) => {
4708
4720
  showStack(stack, cursor);
4721
+ },
4722
+ onObscured: (cursor) => {
4723
+ overlay.hide();
4724
+ tooltip.update("iframe", cursor);
4709
4725
  }
4710
4726
  });
4711
4727
  cleanup.add(inspector);